summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.project2
-rw-r--r--.travis.yml34
-rw-r--r--README.md10
-rw-r--r--compat/opendir.c4
-rw-r--r--compat/waitpid.c4
-rw-r--r--doc/AddErrInfo.311
-rw-r--r--doc/Alloc.335
-rw-r--r--doc/AllowExc.33
-rw-r--r--doc/AssocData.36
-rw-r--r--doc/Async.34
-rw-r--r--doc/Backslash.347
-rw-r--r--doc/ByteArrObj.34
-rw-r--r--doc/CallDel.34
-rw-r--r--doc/Cancel.32
-rw-r--r--doc/ChnlStack.32
-rw-r--r--doc/Class.314
-rw-r--r--doc/CrtChannel.338
-rw-r--r--doc/CrtChnlHdlr.34
-rw-r--r--doc/CrtCloseHdlr.34
-rw-r--r--doc/CrtCommand.36
-rw-r--r--doc/CrtFileHdlr.34
-rw-r--r--doc/CrtMathFnc.3162
-rw-r--r--doc/CrtObjCmd.320
-rw-r--r--doc/CrtTimerHdlr.34
-rw-r--r--doc/CrtTrace.312
-rw-r--r--doc/DString.316
-rw-r--r--doc/DoWhenIdle.34
-rw-r--r--doc/DumpActiveMemory.36
-rw-r--r--doc/Encoding.327
-rw-r--r--doc/Eval.322
-rw-r--r--doc/Exit.311
-rw-r--r--doc/FileSystem.326
-rw-r--r--doc/FindExec.33
-rw-r--r--doc/GetInt.37
-rw-r--r--doc/GetOpnFl.32
-rw-r--r--doc/GetTime.38
-rw-r--r--doc/Hash.314
-rw-r--r--doc/InitStubs.36
-rw-r--r--doc/Interp.313
-rw-r--r--doc/Limit.36
-rw-r--r--doc/LinkVar.34
-rw-r--r--doc/Method.314
-rw-r--r--doc/NRE.320
-rw-r--r--doc/Namespace.34
-rw-r--r--doc/Notifier.314
-rw-r--r--doc/Object.34
-rw-r--r--doc/ObjectType.34
-rw-r--r--doc/OpenFileChnl.326
-rw-r--r--doc/OpenTcp.36
-rw-r--r--doc/Panic.312
-rw-r--r--doc/ParseArgs.38
-rw-r--r--doc/ParseCmd.328
-rw-r--r--doc/Preserve.34
-rw-r--r--doc/PrintDbl.39
-rw-r--r--doc/RecEvalObj.32
-rw-r--r--doc/RegExp.316
-rw-r--r--doc/SetRecLmt.32
-rw-r--r--doc/SetResult.320
-rw-r--r--doc/SplitList.310
-rw-r--r--doc/StaticPkg.33
-rw-r--r--doc/StringObj.329
-rw-r--r--doc/TCL_MEM_DEBUG.312
-rw-r--r--doc/TclZlib.38
-rw-r--r--doc/Thread.36
-rw-r--r--doc/TraceCmd.310
-rw-r--r--doc/TraceVar.318
-rw-r--r--doc/Utf.331
-rw-r--r--doc/case.n60
-rw-r--r--doc/define.n2
-rw-r--r--doc/expr.n4
-rw-r--r--doc/load.n2
-rw-r--r--doc/mathfunc.n5
-rw-r--r--doc/memory.n32
-rw-r--r--doc/re_syntax.n2
-rw-r--r--doc/scan.n6
-rw-r--r--doc/tclvars.n66
-rw-r--r--generic/regc_locale.c73
-rw-r--r--generic/regcomp.c11
-rw-r--r--generic/regcustom.h10
-rw-r--r--generic/regerror.c2
-rw-r--r--generic/regex.h22
-rw-r--r--generic/regexec.c4
-rw-r--r--generic/tcl.decls743
-rw-r--r--generic/tcl.h516
-rw-r--r--generic/tclAlloc.c39
-rw-r--r--generic/tclAssembly.c38
-rw-r--r--generic/tclAsync.c4
-rw-r--r--generic/tclBasic.c1001
-rw-r--r--generic/tclBinary.c205
-rw-r--r--generic/tclCkalloc.c190
-rw-r--r--generic/tclClock.c18
-rw-r--r--generic/tclCmdAH.c147
-rw-r--r--generic/tclCmdIL.c101
-rw-r--r--generic/tclCmdMZ.c361
-rw-r--r--generic/tclCompCmds.c87
-rw-r--r--generic/tclCompCmdsGR.c24
-rw-r--r--generic/tclCompCmdsSZ.c114
-rw-r--r--generic/tclCompExpr.c72
-rw-r--r--generic/tclCompile.c185
-rw-r--r--generic/tclCompile.h676
-rw-r--r--generic/tclConfig.c21
-rw-r--r--generic/tclDTrace.d4
-rw-r--r--generic/tclDate.c30
-rw-r--r--generic/tclDecls.h1281
-rw-r--r--generic/tclDictObj.c51
-rw-r--r--generic/tclDisassemble.c49
-rw-r--r--generic/tclEncoding.c143
-rw-r--r--generic/tclEnsemble.c78
-rw-r--r--generic/tclEnv.c53
-rw-r--r--generic/tclEvent.c57
-rw-r--r--generic/tclExecute.c765
-rw-r--r--generic/tclFCmd.c2
-rw-r--r--generic/tclFileName.c87
-rw-r--r--generic/tclFileSystem.h2
-rw-r--r--generic/tclGet.c2
-rw-r--r--generic/tclGetDate.y28
-rw-r--r--generic/tclHash.c132
-rw-r--r--generic/tclHistory.c11
-rw-r--r--generic/tclIO.c307
-rw-r--r--generic/tclIO.h6
-rw-r--r--generic/tclIOCmd.c55
-rw-r--r--generic/tclIOGT.c18
-rw-r--r--generic/tclIORChan.c66
-rw-r--r--generic/tclIORTrans.c108
-rw-r--r--generic/tclIOSock.c2
-rw-r--r--generic/tclIOUtil.c103
-rw-r--r--generic/tclIndexObj.c155
-rw-r--r--generic/tclInt.decls393
-rw-r--r--generic/tclInt.h670
-rw-r--r--generic/tclIntDecls.h411
-rw-r--r--generic/tclIntPlatDecls.h181
-rw-r--r--generic/tclInterp.c68
-rw-r--r--generic/tclLink.c132
-rw-r--r--generic/tclListObj.c677
-rw-r--r--generic/tclLiteral.c124
-rw-r--r--generic/tclLoad.c60
-rw-r--r--generic/tclMain.c27
-rw-r--r--generic/tclNamesp.c118
-rw-r--r--generic/tclNotify.c18
-rw-r--r--generic/tclOO.c82
-rw-r--r--generic/tclOO.decls22
-rw-r--r--generic/tclOO.h14
-rw-r--r--generic/tclOOBasic.c26
-rw-r--r--generic/tclOOCall.c40
-rw-r--r--generic/tclOODecls.h28
-rw-r--r--generic/tclOODefineCmds.c82
-rw-r--r--generic/tclOOInfo.c8
-rw-r--r--generic/tclOOInt.h122
-rw-r--r--generic/tclOOIntDecls.h28
-rw-r--r--generic/tclOOMethod.c69
-rw-r--r--generic/tclObj.c486
-rw-r--r--generic/tclOptimize.c6
-rw-r--r--generic/tclPanic.c82
-rw-r--r--generic/tclParse.c96
-rw-r--r--generic/tclPathObj.c108
-rw-r--r--generic/tclPipe.c12
-rw-r--r--generic/tclPkg.c125
-rw-r--r--generic/tclPlatDecls.h16
-rw-r--r--generic/tclPreserve.c26
-rw-r--r--generic/tclProc.c78
-rw-r--r--generic/tclProcess.c10
-rw-r--r--generic/tclRegexp.c65
-rw-r--r--generic/tclResolve.c8
-rw-r--r--generic/tclResult.c623
-rw-r--r--generic/tclScan.c20
-rw-r--r--generic/tclStrToD.c106
-rw-r--r--generic/tclStringObj.c645
-rw-r--r--generic/tclStringRep.h30
-rw-r--r--generic/tclStubInit.c562
-rw-r--r--generic/tclStubLib.c4
-rw-r--r--generic/tclTest.c165
-rw-r--r--generic/tclTestObj.c16
-rw-r--r--generic/tclTestProcBodyObj.c6
-rw-r--r--generic/tclThread.c18
-rw-r--r--generic/tclThreadAlloc.c74
-rw-r--r--generic/tclThreadJoin.c4
-rw-r--r--generic/tclThreadStorage.c8
-rw-r--r--generic/tclThreadTest.c46
-rw-r--r--generic/tclTimer.c36
-rw-r--r--generic/tclTomMath.decls79
-rw-r--r--generic/tclTomMathDecls.h191
-rw-r--r--generic/tclTomMathInterface.c2
-rw-r--r--generic/tclTrace.c242
-rw-r--r--generic/tclUtf.c91
-rw-r--r--generic/tclUtil.c790
-rw-r--r--generic/tclVar.c255
-rw-r--r--generic/tclZipfs.c228
-rw-r--r--generic/tclZlib.c216
-rw-r--r--library/http/cookiejar.tcl2
-rw-r--r--library/init.tcl2
-rw-r--r--library/safe.tcl2
-rw-r--r--library/tzdata/SystemV/AST45
-rw-r--r--library/tzdata/SystemV/AST4ADT5
-rw-r--r--library/tzdata/SystemV/CST65
-rw-r--r--library/tzdata/SystemV/CST6CDT5
-rw-r--r--library/tzdata/SystemV/EST55
-rw-r--r--library/tzdata/SystemV/EST5EDT5
-rw-r--r--library/tzdata/SystemV/HST105
-rw-r--r--library/tzdata/SystemV/MST75
-rw-r--r--library/tzdata/SystemV/MST7MDT5
-rw-r--r--library/tzdata/SystemV/PST85
-rw-r--r--library/tzdata/SystemV/PST8PDT5
-rw-r--r--library/tzdata/SystemV/YST95
-rw-r--r--library/tzdata/SystemV/YST9YDT5
-rw-r--r--macosx/README6
-rw-r--r--macosx/Tcl-Common.xcconfig2
-rw-r--r--macosx/Tcl.xcode/project.pbxproj10
-rw-r--r--macosx/Tcl.xcodeproj/project.pbxproj10
-rw-r--r--macosx/tclMacOSXBundle.c4
-rw-r--r--macosx/tclMacOSXFCmd.c5
-rw-r--r--macosx/tclMacOSXNotify.c6
-rw-r--r--tests/assemble.test14
-rw-r--r--tests/case.test94
-rw-r--r--tests/cmdAH.test10
-rw-r--r--tests/compExpr-old.test26
-rw-r--r--tests/compExpr.test1
-rw-r--r--tests/compile.test2
-rw-r--r--tests/execute.test26
-rw-r--r--tests/expr-old.test65
-rw-r--r--tests/expr.test47
-rw-r--r--tests/format.test6
-rw-r--r--tests/get.test8
-rw-r--r--tests/lindex.test16
-rw-r--r--tests/mathop.test194
-rw-r--r--tests/namespace-old.test24
-rw-r--r--tests/namespace.test36
-rw-r--r--tests/parse.test6
-rw-r--r--tests/result.test4
-rw-r--r--tests/string.test4
-rw-r--r--tests/tcltest.test1
-rw-r--r--tests/utf.test4
-rw-r--r--tests/util.test1953
-rw-r--r--tests/var.test9
-rw-r--r--tests/while-old.test2
-rw-r--r--tests/while.test4
-rw-r--r--tools/README2
-rwxr-xr-xtools/checkLibraryDoc.tcl6
-rwxr-xr-xtools/configure2
-rw-r--r--tools/configure.ac2
-rwxr-xr-x[-rw-r--r--]tools/encoding/ebcdic.txt0
-rwxr-xr-x[-rw-r--r--]tools/encoding/tis-620.txt0
-rw-r--r--tools/tcl.hpj.in4
-rwxr-xr-xtools/tcltk-man2html.tcl4
-rw-r--r--unix/Makefile.in137
-rwxr-xr-xunix/config.status.lineno920
-rwxr-xr-xunix/configure26
-rw-r--r--unix/configure.ac10
-rw-r--r--unix/tcl.m48
-rw-r--r--unix/tcl.spec2
-rw-r--r--unix/tclEpollNotfy.c22
-rw-r--r--unix/tclKqueueNotfy.c18
-rw-r--r--unix/tclLoadDl.c8
-rw-r--r--unix/tclLoadDyld.c22
-rw-r--r--unix/tclLoadNext.c6
-rw-r--r--unix/tclLoadOSF.c6
-rw-r--r--unix/tclLoadShl.c6
-rw-r--r--unix/tclSelectNotfy.c6
-rw-r--r--unix/tclUnixChan.c51
-rw-r--r--unix/tclUnixCompat.c22
-rw-r--r--unix/tclUnixFCmd.c63
-rw-r--r--unix/tclUnixFile.c19
-rw-r--r--unix/tclUnixInit.c17
-rw-r--r--unix/tclUnixPipe.c16
-rw-r--r--unix/tclUnixPort.h6
-rw-r--r--unix/tclUnixSock.c31
-rw-r--r--unix/tclUnixThrd.c70
-rw-r--r--unix/tclUnixTime.c220
-rw-r--r--unix/tclXtNotify.c10
-rw-r--r--win/Makefile.in14
-rw-r--r--win/README8
-rwxr-xr-xwin/configure29
-rw-r--r--win/configure.ac22
-rw-r--r--win/makefile.vc34
-rw-r--r--win/rules.vc10
-rw-r--r--win/tcl.dsp16
-rw-r--r--win/tcl.hpj.in4
-rw-r--r--win/tcl.m48
-rw-r--r--win/tclAppInit.c5
-rw-r--r--win/tclWin32Dll.c22
-rw-r--r--win/tclWinChan.c6
-rw-r--r--win/tclWinConsole.c12
-rw-r--r--win/tclWinError.c8
-rw-r--r--win/tclWinFCmd.c18
-rw-r--r--win/tclWinFile.c80
-rw-r--r--win/tclWinInit.c35
-rw-r--r--win/tclWinInt.h6
-rw-r--r--win/tclWinLoad.c10
-rw-r--r--win/tclWinPanic.c4
-rw-r--r--win/tclWinPipe.c55
-rw-r--r--win/tclWinPort.h19
-rw-r--r--win/tclWinSerial.c22
-rw-r--r--win/tclWinSock.c78
-rw-r--r--win/tclWinTest.c37
-rw-r--r--win/tclWinThrd.c16
-rw-r--r--win/tclWinTime.c331
295 files changed, 7483 insertions, 16186 deletions
diff --git a/.project b/.project
index eddd834..f274ff9 100644
--- a/.project
+++ b/.project
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>tcl8</name>
+ <name>tcl9</name>
<comment></comment>
<projects>
</projects>
diff --git a/.travis.yml b/.travis.yml
index 73e3fc2..b2416dc 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -31,13 +31,6 @@ matrix:
env:
- BUILD_DIR=unix
- CFGOPT=CFLAGS=-DTCL_UTF_MAX=3
- - name: "Linux/GCC/Shared: NO_DEPRECATED"
- os: linux
- dist: xenial
- compiler: gcc
- env:
- - BUILD_DIR=unix
- - CFGOPT=CFLAGS=-DTCL_NO_DEPRECATED=1
# Debug build. Running test-cases disabled, because it is currently failing.
- name: "Linux/GCC/Debug/no test"
os: linux
@@ -208,15 +201,6 @@ matrix:
- BUILD_DIR=win
- CFGOPT="--host=i686-w64-mingw32 CFLAGS=-DTCL_UTF_MAX=3"
script: *crosstest
- - name: "Linux-cross-Windows-32/GCC/Shared/no test: NO_DEPRECATED"
- os: linux
- dist: xenial
- compiler: i686-w64-mingw32-gcc
- addons: *mingw32
- env:
- - BUILD_DIR=win
- - CFGOPT="--host=i686-w64-mingw32 CFLAGS=-DTCL_NO_DEPRECATED=1"
- script: *crosstest
- name: "Linux-cross-Windows-32/GCC/Debug/no test"
os: linux
dist: xenial
@@ -271,15 +255,6 @@ matrix:
- BUILD_DIR=win
- CFGOPT="--host=x86_64-w64-mingw32 --enable-64bit CFLAGS=-DTCL_UTF_MAX=3"
script: *crosstest
- - name: "Linux-cross-Windows-64/GCC/Shared/no test: NO_DEPRECATED"
- os: linux
- dist: xenial
- compiler: x86_64-w64-mingw32-gcc
- addons: *mingw64
- env:
- - BUILD_DIR=win
- - CFGOPT="--host=x86_64-w64-mingw32 --enable-64bit CFLAGS=-DTCL_NO_DEPRECATED=1"
- script: *crosstest
- name: "Linux-cross-Windows-64/GCC/Debug/no test"
os: linux
dist: xenial
@@ -312,15 +287,6 @@ matrix:
script:
- cmd.exe /C 'vcvarsall.bat x64 && nmake OPTS=utfmax -f makefile.vc all tcltest'
- cmd.exe /C 'vcvarsall.bat x64 && nmake OPTS=utfmax -f makefile.vc test'
- - name: "Windows/MSVC/Shared: NO_DEPRECATED"
- os: windows
- compiler: cl
- env: *vcenv
- before_install: *vcpreinst
- install: []
- script:
- - cmd.exe /C 'vcvarsall.bat x64 && nmake OPTS=nodep -f makefile.vc all tcltest'
- - cmd.exe /C 'vcvarsall.bat x64 && nmake OPTS=nodep -f makefile.vc test'
- name: "Windows/MSVC/Static"
os: windows
compiler: cl
diff --git a/README.md b/README.md
index 6be63d4..240cdf2 100644
--- a/README.md
+++ b/README.md
@@ -1,11 +1,11 @@
# README: Tcl
-This is the **Tcl 8.7a2** source distribution.
+This is the **Tcl 9.0a0** source distribution.
You can get any source release of Tcl from [our distribution
site](https://sourceforge.net/projects/tcl/files/Tcl/).
-[![Build Status](https://travis-ci.org/tcltk/tcl.svg?branch=core-8-branch)](https://travis-ci.org/tcltk/tcl)
+[![Build Status](https://travis-ci.org/tcltk/tcl.svg?branch=master)](https://travis-ci.org/tcltk/tcl)
## Contents
1. [Introduction](#intro)
@@ -43,7 +43,7 @@ and selling it either in whole or in part. See the file
## <a id="doc">2.</a> Documentation
Extensive documentation is available at our website.
The home page for this release, including new features, is
-[here](https://www.tcl.tk/software/tcltk/8.7.html).
+[here](https://www.tcl.tk/software/tcltk/9.0.html).
Detailed release notes can be found at the
[file distributions page](https://sourceforge.net/projects/tcl/files/Tcl/)
by clicking on the relevant version.
@@ -53,8 +53,8 @@ Xchange](https://www.tcl-lang.org/about/).
There have been many Tcl books on the market. Many are mentioned in
[the Wiki](https://wiki.tcl-lang.org/_/ref?N=25206).
-The complete set of reference manual entries for Tcl 8.7 is [online,
-here](https://www.tcl-lang.org/man/tcl8.7/).
+The complete set of reference manual entries for Tcl 9.0 is [online,
+here](https://www.tcl-lang.org/man/tcl9.0/).
### <a id="doc.unix">2a.</a> Unix Documentation
The `doc` subdirectory in this release contains a complete set of
diff --git a/compat/opendir.c b/compat/opendir.c
index 7a49566..3525093 100644
--- a/compat/opendir.c
+++ b/compat/opendir.c
@@ -28,7 +28,7 @@ opendir(
if ((fd = open(myname, 0, 0)) == -1) {
return NULL;
}
- dirp = (DIR *) ckalloc(sizeof(DIR));
+ dirp = (DIR *) Tcl_Alloc(sizeof(DIR));
if (dirp == NULL) {
/* unreachable? */
close(fd);
@@ -106,5 +106,5 @@ closedir(
close(dirp->dd_fd);
dirp->dd_fd = -1;
dirp->dd_loc = 0;
- ckfree(dirp);
+ Tcl_Free(dirp);
}
diff --git a/compat/waitpid.c b/compat/waitpid.c
index d4473a8..707018d 100644
--- a/compat/waitpid.c
+++ b/compat/waitpid.c
@@ -100,7 +100,7 @@ waitpid(
} else {
prevPtr->nextPtr = waitPtr->nextPtr;
}
- ckfree(waitPtr);
+ Tcl_Free(waitPtr);
return result;
}
@@ -156,7 +156,7 @@ waitpid(
goto waitAgain;
}
}
- waitPtr = (WaitInfo *) ckalloc(sizeof(WaitInfo));
+ waitPtr = (WaitInfo *) Tcl_Alloc(sizeof(WaitInfo));
waitPtr->pid = result;
waitPtr->status = status;
waitPtr->nextPtr = deadList;
diff --git a/doc/AddErrInfo.3 b/doc/AddErrInfo.3
index 0b59349..95451d3 100644
--- a/doc/AddErrInfo.3
+++ b/doc/AddErrInfo.3
@@ -9,7 +9,7 @@
.so man.macros
.BS
.SH NAME
-Tcl_GetReturnOptions, Tcl_SetReturnOptions, Tcl_AddErrorInfo, Tcl_AppendObjToErrorInfo, Tcl_AddObjErrorInfo, Tcl_SetObjErrorCode, Tcl_SetErrorCode, Tcl_SetErrorCodeVA, Tcl_SetErrorLine, Tcl_GetErrorLine, Tcl_PosixError, Tcl_LogCommandInfo \- retrieve or record information about errors and other return options
+Tcl_GetReturnOptions, Tcl_SetReturnOptions, Tcl_AddErrorInfo, Tcl_AppendObjToErrorInfo, Tcl_AddObjErrorInfo, Tcl_SetObjErrorCode, Tcl_SetErrorCode, Tcl_SetErrorLine, Tcl_GetErrorLine, Tcl_PosixError, Tcl_LogCommandInfo \- retrieve or record information about errors and other return options
.SH SYNOPSIS
.nf
\fB#include <tcl.h>\fR
@@ -30,8 +30,6 @@ int
.sp
\fBTcl_SetErrorCode\fR(\fIinterp, element, element, ... \fB(char *) NULL\fR)
.sp
-\fBTcl_SetErrorCodeVA\fR(\fIinterp, argList\fR)
-.sp
\fBTcl_GetErrorLine\fR(\fIinterp\fR)
.sp
\fBTcl_SetErrorLine\fR(\fIinterp, lineNum\fR)
@@ -60,10 +58,10 @@ unless \fIlength\fR is negative.
.AP Tcl_Obj *objPtr in
A message to be appended to the \fB\-errorinfo\fR return option
in the form of a Tcl_Obj value.
-.AP int length in
+.AP size_t length in
The number of bytes to copy from \fImessage\fR when
appending to the \fB\-errorinfo\fR return option.
-If negative, all bytes up to the first null byte are used.
+If TCL_AUTO_LENGTH, all bytes up to the first null byte are used.
.AP Tcl_Obj *errorObjPtr in
The \fB\-errorcode\fR return option will be set to this value.
.AP char *element in
@@ -245,9 +243,6 @@ The procedure \fBTcl_SetErrorCode\fR is also used to set the
record instead of a value. Otherwise, it is similar to
\fBTcl_SetObjErrorCode\fR in behavior.
.PP
-\fBTcl_SetErrorCodeVA\fR is the same as \fBTcl_SetErrorCode\fR except that
-instead of taking a variable number of arguments it takes an argument list.
-.PP
The procedure \fBTcl_GetErrorLine\fR is used to read the integer value
of the \fB\-errorline\fR return option without the overhead of a full
call to \fBTcl_GetReturnOptions\fR. Likewise, \fBTcl_SetErrorLine\fR
diff --git a/doc/Alloc.3 b/doc/Alloc.3
index 8f25c52..849f65e 100644
--- a/doc/Alloc.3
+++ b/doc/Alloc.3
@@ -8,7 +8,7 @@
.so man.macros
.BS
.SH NAME
-Tcl_Alloc, Tcl_Free, Tcl_Realloc, Tcl_AttemptAlloc, Tcl_AttemptRealloc, ckalloc, ckfree, ckrealloc, attemptckalloc, attemptckrealloc \- allocate or free heap memory
+Tcl_Alloc, Tcl_Free, Tcl_Realloc, Tcl_AttemptAlloc, Tcl_AttemptRealloc \- allocate or free heap memory
.SH SYNOPSIS
.nf
\fB#include <tcl.h>\fR
@@ -19,29 +19,14 @@ char *
void
\fBTcl_Free\fR(\fIptr\fR)
.sp
-char *
+void *
\fBTcl_Realloc\fR(\fIptr, size\fR)
.sp
-char *
+void *
\fBTcl_AttemptAlloc\fR(\fIsize\fR)
.sp
-char *
+void *
\fBTcl_AttemptRealloc\fR(\fIptr, size\fR)
-.sp
-char *
-\fBckalloc\fR(\fIsize\fR)
-.sp
-void
-\fBckfree\fR(\fIptr\fR)
-.sp
-char *
-\fBckrealloc\fR(\fIptr, size\fR)
-.sp
-char *
-\fBattemptckalloc\fR(\fIsize\fR)
-.sp
-char *
-\fBattemptckrealloc\fR(\fIptr, size\fR)
.SH ARGUMENTS
.AS char *size
.AP "unsigned int" size in
@@ -79,14 +64,10 @@ allocation fails, these functions will return NULL. Note that on some
platforms, but not all, attempting to allocate a zero-sized block of
memory will also cause these functions to return NULL.
.PP
-The procedures \fBckalloc\fR, \fBckfree\fR, \fBckrealloc\fR,
-\fBattemptckalloc\fR, and \fBattemptckrealloc\fR are implemented
-as macros. Normally, they are synonyms for the corresponding
-procedures documented on this page. When Tcl and all modules
-calling Tcl are compiled with \fBTCL_MEM_DEBUG\fR defined, however,
-these macros are redefined to be special debugging versions
-of these procedures. To support Tcl's memory debugging within a
-module, use the macros rather than direct calls to \fBTcl_Alloc\fR, etc.
+When a module or Tcl itself is compiled with \fBTCL_MEM_DEBUG\fR defined,
+the procedures \fBTcl_Alloc\fR, \fBTcl_Free\fR, \fBTcl_Realloc\fR,
+\fBTcl_AttemptAlloc\fR, and \fBTcl_AttempRealloc\fR are implemented
+as macros, redefined to be special debugging versions of these procedures.
.SH KEYWORDS
alloc, allocation, free, malloc, memory, realloc, TCL_MEM_DEBUG
diff --git a/doc/AllowExc.3 b/doc/AllowExc.3
index 172bb30..29e31be 100644
--- a/doc/AllowExc.3
+++ b/doc/AllowExc.3
@@ -30,8 +30,7 @@ or \fBTCL_RETURN\fR, then Tcl normally converts this into a \fBTCL_ERROR\fR
return with an appropriate message. The particular script
evaluation procedures of Tcl that act in the manner are
\fBTcl_EvalObjEx\fR, \fBTcl_EvalObjv\fR, \fBTcl_Eval\fR, \fBTcl_EvalEx\fR,
-\fBTcl_GlobalEval\fR, \fBTcl_GlobalEvalObj\fR, \fBTcl_VarEval\fR and
-\fBTcl_VarEvalVA\fR.
+\fBTcl_GlobalEval\fR, \fBTcl_GlobalEvalObj\fR and \fBTcl_VarEval\fR.
.PP
However, if \fBTcl_AllowExceptions\fR is invoked immediately before
calling one of those a procedures, then arbitrary completion
diff --git a/doc/AssocData.3 b/doc/AssocData.3
index d4fa3d7..e95c26b 100644
--- a/doc/AssocData.3
+++ b/doc/AssocData.3
@@ -13,7 +13,7 @@ Tcl_GetAssocData, Tcl_SetAssocData, Tcl_DeleteAssocData \- manage associations o
.nf
\fB#include <tcl.h>\fR
.sp
-ClientData
+void *
\fBTcl_GetAssocData\fR(\fIinterp, key, delProcPtr\fR)
.sp
\fBTcl_SetAssocData\fR(\fIinterp, key, delProc, clientData\fR)
@@ -31,7 +31,7 @@ Procedure to call when \fIinterp\fR is deleted.
.AP Tcl_InterpDeleteProc **delProcPtr in
Pointer to location in which to store address of current deletion procedure
for association. Ignored if NULL.
-.AP ClientData clientData in
+.AP void *clientData in
Arbitrary one-word value associated with the given key in this
interpreter. This data is owned by the caller.
.BE
@@ -64,7 +64,7 @@ the type \fBTcl_InterpDeleteProc\fR:
.PP
.CS
typedef void \fBTcl_InterpDeleteProc\fR(
- ClientData \fIclientData\fR,
+ void *\fIclientData\fR,
Tcl_Interp *\fIinterp\fR);
.CE
.PP
diff --git a/doc/Async.3 b/doc/Async.3
index 347ba3d..62f450e 100644
--- a/doc/Async.3
+++ b/doc/Async.3
@@ -30,7 +30,7 @@ int
.AS Tcl_AsyncHandler clientData
.AP Tcl_AsyncProc *proc in
Procedure to invoke to handle an asynchronous event.
-.AP ClientData clientData in
+.AP void *clientData in
One-word value to pass to \fIproc\fR.
.AP Tcl_AsyncHandler async in
Token for asynchronous event handler.
@@ -84,7 +84,7 @@ type \fBTcl_AsyncProc\fR:
.PP
.CS
typedef int \fBTcl_AsyncProc\fR(
- ClientData \fIclientData\fR,
+ void *\fIclientData\fR,
Tcl_Interp *\fIinterp\fR,
int \fIcode\fR);
.CE
diff --git a/doc/Backslash.3 b/doc/Backslash.3
deleted file mode 100644
index 0805f8e..0000000
--- a/doc/Backslash.3
+++ /dev/null
@@ -1,47 +0,0 @@
-'\"
-'\" Copyright (c) 1989-1993 The Regents of the University of California.
-'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
-'\"
-'\" See the file "license.terms" for information on usage and redistribution
-'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-'\"
-.TH Tcl_Backslash 3 "8.1" Tcl "Tcl Library Procedures"
-.so man.macros
-.BS
-.SH NAME
-Tcl_Backslash \- parse a backslash sequence
-.SH SYNOPSIS
-.nf
-\fB#include <tcl.h>\fR
-.sp
-char
-\fBTcl_Backslash\fR(\fIsrc, countPtr\fR)
-.SH ARGUMENTS
-.AS char *countPtr out
-.AP char *src in
-Pointer to a string starting with a backslash.
-.AP int *countPtr out
-If \fIcountPtr\fR is not NULL, \fI*countPtr\fR gets filled
-in with number of characters in the backslash sequence, including
-the backslash character.
-.BE
-
-.SH DESCRIPTION
-.PP
-The use of \fBTcl_Backslash\fR is deprecated in favor of
-\fBTcl_UtfBackslash\fR.
-.PP
-This is a utility procedure provided for backwards compatibility with
-non-internationalized Tcl extensions. It parses a backslash sequence and
-returns the low byte of the Unicode character corresponding to the sequence.
-\fBTcl_Backslash\fR modifies \fI*countPtr\fR to contain the number of
-characters in the backslash sequence.
-.PP
-See the Tcl manual entry for information on the valid backslash sequences.
-All of the sequences described in the Tcl manual entry are supported by
-\fBTcl_Backslash\fR.
-.SH "SEE ALSO"
-Tcl(n), Tcl_UtfBackslash(3)
-
-.SH KEYWORDS
-backslash, parse
diff --git a/doc/ByteArrObj.3 b/doc/ByteArrObj.3
index ff0b4e1..d6947eb 100644
--- a/doc/ByteArrObj.3
+++ b/doc/ByteArrObj.3
@@ -29,8 +29,8 @@ unsigned char *
.AP "const unsigned char" *bytes in
The array of bytes used to initialize or set a byte-array value. May be NULL
even if \fIlength\fR is non-zero.
-.AP int length in
-The length of the array of bytes. It must be >= 0.
+.AP size_t length in
+The length of the array of bytes.
.AP Tcl_Obj *objPtr in/out
For \fBTcl_SetByteArrayObj\fR, this points to the value to be converted to
byte-array type. For \fBTcl_GetByteArrayFromObj\fR and
diff --git a/doc/CallDel.3 b/doc/CallDel.3
index 33b8afc..00763b6 100644
--- a/doc/CallDel.3
+++ b/doc/CallDel.3
@@ -23,7 +23,7 @@ Tcl_CallWhenDeleted, Tcl_DontCallWhenDeleted \- Arrange for callback when interp
Interpreter with which to associated callback.
.AP Tcl_InterpDeleteProc *proc in
Procedure to call when \fIinterp\fR is deleted.
-.AP ClientData clientData in
+.AP void *clientData in
Arbitrary one-word value to pass to \fIproc\fR.
.BE
.SH DESCRIPTION
@@ -38,7 +38,7 @@ type \fBTcl_InterpDeleteProc\fR:
.PP
.CS
typedef void \fBTcl_InterpDeleteProc\fR(
- ClientData \fIclientData\fR,
+ void *\fIclientData\fR,
Tcl_Interp *\fIinterp\fR);
.CE
.PP
diff --git a/doc/Cancel.3 b/doc/Cancel.3
index 847707e..def0f2a 100644
--- a/doc/Cancel.3
+++ b/doc/Cancel.3
@@ -30,7 +30,7 @@ ORed combination of flag bits that specify additional options.
For \fBTcl_CancelEval\fR, only \fBTCL_CANCEL_UNWIND\fR is currently
supported. For \fBTcl_Canceled\fR, only \fBTCL_LEAVE_ERR_MSG\fR and
\fBTCL_CANCEL_UNWIND\fR are currently supported.
-.AP ClientData clientData in
+.AP void *clientData in
Currently reserved for future use.
It should be set to NULL.
.BE
diff --git a/doc/ChnlStack.3 b/doc/ChnlStack.3
index b046cd2..70d1050 100644
--- a/doc/ChnlStack.3
+++ b/doc/ChnlStack.3
@@ -32,7 +32,7 @@ Tcl_Channel
Interpreter for error reporting.
.AP "const Tcl_ChannelType" *typePtr in
The new channel I/O procedures to use for \fIchannel\fR.
-.AP ClientData clientData in
+.AP void *clientData in
Arbitrary one-word value to pass to channel I/O procedures.
.AP int mask in
Conditions under which \fIchannel\fR will be used: OR-ed combination of
diff --git a/doc/Class.3 b/doc/Class.3
index 57203d5..12658ce 100644
--- a/doc/Class.3
+++ b/doc/Class.3
@@ -41,12 +41,12 @@ Tcl_Object
int
\fBTcl_ObjectDeleted\fR(\fIobject\fR)
.sp
-ClientData
+void *
\fBTcl_ObjectGetMetadata\fR(\fIobject, metaTypePtr\fR)
.sp
\fBTcl_ObjectSetMetadata\fR(\fIobject, metaTypePtr, metadata\fR)
.sp
-ClientData
+void *
\fBTcl_ClassGetMetadata\fR(\fIclass, metaTypePtr\fR)
.sp
\fBTcl_ClassSetMetadata\fR(\fIclass, metaTypePtr, metadata\fR)
@@ -56,7 +56,7 @@ Tcl_ObjectMapMethodNameProc
.sp
\fBTcl_ObjectSetMethodNameMapper\fR(\fIobject\fR, \fImethodNameMapper\fR)
.SH ARGUMENTS
-.AS ClientData metadata in/out
+.AS void *metadata in/out
.AP Tcl_Interp *interp in/out
Interpreter providing the context for looking up or creating an object, and
into whose result error messages will be written on failure.
@@ -85,7 +85,7 @@ error messages even when complicated calling patterns are used (e.g., via the
.AP Tcl_ObjectMetadataType *metaTypePtr in
The type of \fImetadata\fR being set with \fBTcl_ClassSetMetadata\fR or
retrieved with \fBTcl_ClassGetMetadata\fR.
-.AP ClientData metadata in
+.AP void *metadata in
An item of metadata to attach to the class, or NULL to remove the metadata
associated with a particular \fImetaTypePtr\fR.
.AP "Tcl_ObjectMapMethodNameProc" "methodNameMapper" in
@@ -185,7 +185,7 @@ a class or object.
.PP
.CS
typedef void \fBTcl_ObjectMetadataDeleteProc\fR(
- ClientData \fImetadata\fR);
+ void *\fImetadata\fR);
.CE
.PP
The \fImetadata\fR argument gives the address of the metadata to be
@@ -198,8 +198,8 @@ associated with a class or object.
.CS
typedef int \fBTcl_CloneProc\fR(
Tcl_Interp *\fIinterp\fR,
- ClientData \fIsrcMetadata\fR,
- ClientData *\fIdstMetadataPtr\fR);
+ void *\fIsrcMetadata\fR,
+ void **\fIdstMetadataPtr\fR);
.CE
.PP
The \fIinterp\fR argument gives a place to write an error message when the
diff --git a/doc/CrtChannel.3 b/doc/CrtChannel.3
index 6ef94b5..b987646 100644
--- a/doc/CrtChannel.3
+++ b/doc/CrtChannel.3
@@ -17,7 +17,7 @@ Tcl_CreateChannel, Tcl_GetChannelInstanceData, Tcl_GetChannelType, Tcl_GetChanne
Tcl_Channel
\fBTcl_CreateChannel\fR(\fItypePtr, channelName, instanceData, mask\fR)
.sp
-ClientData
+void *
\fBTcl_GetChannelInstanceData\fR(\fIchannel\fR)
.sp
const Tcl_ChannelType *
@@ -128,7 +128,7 @@ by any other channel. Can be NULL, in which case the channel is
created without a name. If the created channel is assigned to one
of the standard channels (\fBstdin\fR, \fBstdout\fR or \fBstderr\fR),
the assigned channel name will be the name of the standard channel.
-.AP ClientData instanceData in
+.AP void *instanceData in
Arbitrary one-word value to be associated with this channel. This
value is passed to procedures in \fItypePtr\fR when they are invoked.
.AP int mask in
@@ -139,7 +139,7 @@ The channel to operate on.
.AP int direction in
\fBTCL_READABLE\fR means the input handle is wanted; \fBTCL_WRITABLE\fR
means the output handle is wanted.
-.AP ClientData *handlePtr out
+.AP void **handlePtr out
Points to the location where the desired OS-specific handle should be
stored.
.AP int size in
@@ -399,7 +399,7 @@ the generic layer to set blocking and nonblocking mode on the device.
.PP
.CS
typedef int \fBTcl_DriverBlockModeProc\fR(
- ClientData \fIinstanceData\fR,
+ void *\fIinstanceData\fR,
int \fImode\fR);
.CE
.PP
@@ -434,7 +434,7 @@ closed. \fICloseProc\fR must match the following prototype:
.PP
.CS
typedef int \fBTcl_DriverCloseProc\fR(
- ClientData \fIinstanceData\fR,
+ void *\fIinstanceData\fR,
Tcl_Interp *\fIinterp\fR);
.CE
.PP
@@ -456,7 +456,7 @@ following prototype:
.PP
.CS
typedef int \fBTcl_DriverClose2Proc\fR(
- ClientData \fIinstanceData\fR,
+ void *\fIinstanceData\fR,
Tcl_Interp *\fIinterp\fR,
int \fIflags\fR);
.CE
@@ -487,7 +487,7 @@ internal buffer. \fIInputProc\fR must match the following prototype:
.PP
.CS
typedef int \fBTcl_DriverInputProc\fR(
- ClientData \fIinstanceData\fR,
+ void *\fIinstanceData\fR,
char *\fIbuf\fR,
int \fIbufSize\fR,
int *\fIerrorCodePtr\fR);
@@ -531,7 +531,7 @@ generic layer to transfer data from an internal buffer to the output device.
.PP
.CS
typedef int \fBTcl_DriverOutputProc\fR(
- ClientData \fIinstanceData\fR,
+ void *\fIinstanceData\fR,
const char *\fIbuf\fR,
int \fItoWrite\fR,
int *\fIerrorCodePtr\fR);
@@ -570,7 +570,7 @@ prototype:
.PP
.CS
typedef int \fBTcl_DriverSeekProc\fR(
- ClientData \fIinstanceData\fR,
+ void *\fIinstanceData\fR,
long \fIoffset\fR,
int \fIseekMode\fR,
int *\fIerrorCodePtr\fR);
@@ -600,7 +600,7 @@ following prototype:
.PP
.CS
typedef Tcl_WideInt \fBTcl_DriverWideSeekProc\fR(
- ClientData \fIinstanceData\fR,
+ void *\fIinstanceData\fR,
Tcl_WideInt \fIoffset\fR,
int \fIseekMode\fR,
int *\fIerrorCodePtr\fR);
@@ -622,7 +622,7 @@ the generic layer to set a channel type specific option on a channel.
.PP
.CS
typedef int \fBTcl_DriverSetOptionProc\fR(
- ClientData \fIinstanceData\fR,
+ void *\fIinstanceData\fR,
Tcl_Interp *\fIinterp\fR,
const char *\fIoptionName\fR,
const char *\fInewValue\fR);
@@ -663,7 +663,7 @@ channel. \fIgetOptionProc\fR must match the following prototype:
.PP
.CS
typedef int \fBTcl_DriverGetOptionProc\fR(
- ClientData \fIinstanceData\fR,
+ void *\fIinstanceData\fR,
Tcl_Interp *\fIinterp\fR,
const char *\fIoptionName\fR,
Tcl_DString *\fIoptionValue\fR);
@@ -701,7 +701,7 @@ notice events of interest on this channel.
.PP
.CS
typedef void \fBTcl_DriverWatchProc\fR(
- ClientData \fIinstanceData\fR,
+ void *\fIinstanceData\fR,
int \fImask\fR);
.CE
.PP
@@ -732,9 +732,9 @@ the generic layer to retrieve a device-specific handle from the channel.
.PP
.CS
typedef int \fBTcl_DriverGetHandleProc\fR(
- ClientData \fIinstanceData\fR,
+ void *\fIinstanceData\fR,
int \fIdirection\fR,
- ClientData *\fIhandlePtr\fR);
+ void **\fIhandlePtr\fR);
.CE
.PP
\fIInstanceData\fR is the same as the value passed to
@@ -761,7 +761,7 @@ It should be set to NULL.
.PP
.CS
typedef int \fBTcl_DriverFlushProc\fR(
- ClientData \fIinstanceData\fR);
+ void *\fIinstanceData\fR);
.CE
.PP
This value can be retrieved with \fBTcl_ChannelFlushProc\fR, which returns
@@ -776,7 +776,7 @@ that occur on the underlying (stacked) channel.
.PP
.CS
typedef int \fBTcl_DriverHandlerProc\fR(
- ClientData \fIinstanceData\fR,
+ void *\fIinstanceData\fR,
int \fIinterestMask\fR);
.CE
.PP
@@ -805,7 +805,7 @@ might be maintaining using the calling thread as the associate. See
.PP
.CS
typedef void \fBTcl_DriverThreadActionProc\fR(
- ClientData \fIinstanceData\fR,
+ void *\fIinstanceData\fR,
int \fIaction\fR);
.CE
.PP
@@ -822,7 +822,7 @@ length. It can be NULL.
.PP
.CS
typedef int \fBTcl_DriverTruncateProc\fR(
- ClientData \fIinstanceData\fR,
+ void *\fIinstanceData\fR,
Tcl_WideInt \fIlength\fR);
.CE
.PP
diff --git a/doc/CrtChnlHdlr.3 b/doc/CrtChnlHdlr.3
index 0ecd3c9..c9f4efe 100644
--- a/doc/CrtChnlHdlr.3
+++ b/doc/CrtChnlHdlr.3
@@ -32,7 +32,7 @@ a zero value to temporarily disable an existing handler.
.AP Tcl_FileProc *proc in
Procedure to invoke whenever the channel indicated by \fIchannel\fR meets
the conditions specified by \fImask\fR.
-.AP ClientData clientData in
+.AP void *clientData in
Arbitrary one-word value to pass to \fIproc\fR.
.BE
.SH DESCRIPTION
@@ -48,7 +48,7 @@ what it means for a channel to be readable or writable.
.PP
.CS
typedef void \fBTcl_ChannelProc\fR(
- ClientData \fIclientData\fR,
+ void *\fIclientData\fR,
int \fImask\fR);
.CE
.PP
diff --git a/doc/CrtCloseHdlr.3 b/doc/CrtCloseHdlr.3
index bac2431..1046ea3 100644
--- a/doc/CrtCloseHdlr.3
+++ b/doc/CrtCloseHdlr.3
@@ -26,7 +26,7 @@ void
The channel for which to create or delete a close callback.
.AP Tcl_CloseProc *proc in
The procedure to call as the callback.
-.AP ClientData clientData in
+.AP void *clientData in
Arbitrary one-word value to pass to \fIproc\fR.
.BE
.SH DESCRIPTION
@@ -38,7 +38,7 @@ Arbitrary one-word value to pass to \fIproc\fR.
.PP
.CS
typedef void \fBTcl_CloseProc\fR(
- ClientData \fIclientData\fR);
+ void *\fIclientData\fR);
.CE
.PP
The \fIclientData\fR is the same as the value provided in the call to
diff --git a/doc/CrtCommand.3 b/doc/CrtCommand.3
index bf76d48..50baa6f 100644
--- a/doc/CrtCommand.3
+++ b/doc/CrtCommand.3
@@ -25,7 +25,7 @@ Name of command.
.AP Tcl_CmdProc *proc in
Implementation of new command: \fIproc\fR will be called whenever
\fIcmdName\fR is invoked as a command.
-.AP ClientData clientData in
+.AP voie *clientData in
Arbitrary one-word value to pass to \fIproc\fR and \fIdeleteProc\fR.
.AP Tcl_CmdDeleteProc *deleteProc in
Procedure to call before \fIcmdName\fR is deleted from the interpreter;
@@ -75,7 +75,7 @@ and it returns NULL.
.PP
.CS
typedef int \fBTcl_CmdProc\fR(
- ClientData \fIclientData\fR,
+ void *\fIclientData\fR,
Tcl_Interp *\fIinterp\fR,
int \fIargc\fR,
const char *\fIargv\fR[]);
@@ -131,7 +131,7 @@ result that match the type \fBTcl_CmdDeleteProc\fR:
.PP
.CS
typedef void \fBTcl_CmdDeleteProc\fR(
- ClientData \fIclientData\fR);
+ void *\fIclientData\fR);
.CE
.PP
The \fIclientData\fR argument will be the same as the \fIclientData\fR
diff --git a/doc/CrtFileHdlr.3 b/doc/CrtFileHdlr.3
index f1b8df7..0dfb429 100644
--- a/doc/CrtFileHdlr.3
+++ b/doc/CrtFileHdlr.3
@@ -29,7 +29,7 @@ a handler.
.AP Tcl_FileProc *proc in
Procedure to invoke whenever the file or device indicated
by \fIfile\fR meets the conditions specified by \fImask\fR.
-.AP ClientData clientData in
+.AP void *clientData in
Arbitrary one-word value to pass to \fIproc\fR.
.BE
.SH DESCRIPTION
@@ -51,7 +51,7 @@ type \fBTcl_FileProc\fR:
.PP
.CS
typedef void \fBTcl_FileProc\fR(
- ClientData \fIclientData\fR,
+ void *\fIclientData\fR,
int \fImask\fR);
.CE
.PP
diff --git a/doc/CrtMathFnc.3 b/doc/CrtMathFnc.3
deleted file mode 100644
index acceb5b..0000000
--- a/doc/CrtMathFnc.3
+++ /dev/null
@@ -1,162 +0,0 @@
-'\"
-'\" Copyright (c) 1989-1993 The Regents of the University of California.
-'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
-'\"
-'\" See the file "license.terms" for information on usage and redistribution
-'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-'\"
-.TH Tcl_CreateMathFunc 3 8.4 Tcl "Tcl Library Procedures"
-.so man.macros
-.BS
-.SH NAME
-Tcl_CreateMathFunc, Tcl_GetMathFuncInfo, Tcl_ListMathFuncs \- Define, query and enumerate math functions for expressions
-.SH "NOTICE OF EVENTUAL DEPRECATION"
-.PP
-The \fBTcl_CreateMathFunc\fR and \fBTcl_GetMathFuncInfo\fR functions
-are rendered somewhat obsolete by the ability to create functions for
-expressions by placing commands in the \fBtcl::mathfunc\fR namespace,
-as described in the \fBmathfunc\fR manual page; the API described on
-this page is not expected to be maintained indefinitely.
-.SH SYNOPSIS
-.nf
-\fB#include <tcl.h>\fR
-.sp
-void
-\fBTcl_CreateMathFunc\fR(\fIinterp, name, numArgs, argTypes, proc, clientData\fR)
-.sp
-int
-\fBTcl_GetMathFuncInfo\fR(\fIinterp, name, numArgsPtr, argTypesPtr, procPtr,
- clientDataPtr\fR)
-.sp
-Tcl_Obj *
-\fBTcl_ListMathFuncs\fR(\fIinterp, pattern\fR)
-.SH ARGUMENTS
-.AS Tcl_ValueType *clientDataPtr out
-.AP Tcl_Interp *interp in
-Interpreter in which new function will be defined.
-.AP "const char" *name in
-Name for new function.
-.AP int numArgs in
-Number of arguments to new function; also gives size of \fIargTypes\fR array.
-.AP Tcl_ValueType *argTypes in
-Points to an array giving the permissible types for each argument to
-function.
-.AP Tcl_MathProc *proc in
-Procedure that implements the function.
-.AP ClientData clientData in
-Arbitrary one-word value to pass to \fIproc\fR when it is invoked.
-.AP int *numArgsPtr out
-Points to a variable that will be set to contain the number of
-arguments to the function.
-.AP Tcl_ValueType **argTypesPtr out
-Points to a variable that will be set to contain a pointer to an array
-giving the permissible types for each argument to the function which
-will need to be freed up using \fITcl_Free\fR.
-.AP Tcl_MathProc **procPtr out
-Points to a variable that will be set to contain a pointer to the
-implementation code for the function (or NULL if the function is
-implemented directly in bytecode).
-.AP ClientData *clientDataPtr out
-Points to a variable that will be set to contain the clientData
-argument passed to \fITcl_CreateMathFunc\fR when the function was
-created if the function is not implemented directly in bytecode.
-.AP "const char" *pattern in
-Pattern to match against function names so as to filter them (by
-passing to \fITcl_StringMatch\fR), or NULL to not apply any filter.
-.BE
-.SH DESCRIPTION
-.PP
-Tcl allows a number of mathematical functions to be used in
-expressions, such as \fBsin\fR, \fBcos\fR, and \fBhypot\fR.
-These functions are represented by commands in the namespace,
-\fBtcl::mathfunc\fR. The \fBTcl_CreateMathFunc\fR function is
-an obsolete way for applications to add additional functions
-to those already provided by Tcl or to replace existing functions.
-It should not be used by new applications, which should create
-math functions using \fBTcl_CreateObjCommand\fR to create a command
-in the \fBtcl::mathfunc\fR namespace.
-.PP
-In the \fBTcl_CreateMathFunc\fR interface,
-\fIName\fR is the name of the function as it will appear in expressions.
-If \fIname\fR does not already exist in the \fB::tcl::mathfunc\fR
-namespace, then a new command is created in that namespace.
-If \fIname\fR does exist, then the existing function is replaced.
-\fINumArgs\fR and \fIargTypes\fR describe the arguments to the function.
-Each entry in the \fIargTypes\fR array must be
-one of \fBTCL_INT\fR, \fBTCL_DOUBLE\fR, \fBTCL_WIDE_INT\fR,
-or \fBTCL_EITHER\fR to indicate whether the corresponding argument must be an
-integer, a double-precision floating value, a wide (64-bit) integer,
-or any, respectively.
-.PP
-Whenever the function is invoked in an expression Tcl will invoke
-\fIproc\fR. \fIProc\fR should have arguments and result that match
-the type \fBTcl_MathProc\fR:
-.PP
-.CS
-typedef int \fBTcl_MathProc\fR(
- ClientData \fIclientData\fR,
- Tcl_Interp *\fIinterp\fR,
- Tcl_Value *\fIargs\fR,
- Tcl_Value *\fIresultPtr\fR);
-.CE
-.PP
-When \fIproc\fR is invoked the \fIclientData\fR and \fIinterp\fR
-arguments will be the same as those passed to \fBTcl_CreateMathFunc\fR.
-\fIArgs\fR will point to an array of \fInumArgs\fR Tcl_Value structures,
-which describe the actual arguments to the function:
-.PP
-.CS
-typedef struct Tcl_Value {
- Tcl_ValueType \fItype\fR;
- long \fIintValue\fR;
- double \fIdoubleValue\fR;
- Tcl_WideInt \fIwideValue\fR;
-} \fBTcl_Value\fR;
-.CE
-.PP
-The \fItype\fR field indicates the type of the argument and is
-one of \fBTCL_INT\fR, \fBTCL_DOUBLE\fR or \fBTCL_WIDE_INT\fR.
-It will match the \fIargTypes\fR value specified for the function unless
-the \fIargTypes\fR value was \fBTCL_EITHER\fR. Tcl converts
-the argument supplied in the expression to the type requested in
-\fIargTypes\fR, if that is necessary.
-Depending on the value of the \fItype\fR field, the \fIintValue\fR,
-\fIdoubleValue\fR or \fIwideValue\fR
-field will contain the actual value of the argument.
-.PP
-\fIProc\fR should compute its result and store it either as an integer
-in \fIresultPtr->intValue\fR or as a floating value in
-\fIresultPtr->doubleValue\fR.
-It should set also \fIresultPtr->type\fR to one of
-\fBTCL_INT\fR, \fBTCL_DOUBLE\fR or \fBTCL_WIDE_INT\fR
-to indicate which value was set.
-Under normal circumstances \fIproc\fR should return \fBTCL_OK\fR.
-If an error occurs while executing the function, \fIproc\fR should
-return \fBTCL_ERROR\fR and leave an error message in the interpreter's result.
-.PP
-\fBTcl_GetMathFuncInfo\fR retrieves the values associated with
-function \fIname\fR that were passed to a preceding
-\fBTcl_CreateMathFunc\fR call. Normally, the return code is
-\fBTCL_OK\fR but if the named function does not exist, \fBTCL_ERROR\fR
-is returned and an error message is placed in the interpreter's
-result.
-.PP
-If an error did not occur, the array reference placed in the variable
-pointed to by \fIargTypesPtr\fR is newly allocated, and should be
-released by passing it to \fBTcl_Free\fR. Some functions (the
-standard set implemented in the core, and those defined by placing
-commands in the \fBtcl::mathfunc\fR namespace) do not have
-argument type information; attempting to retrieve values for
-them causes a NULL to be stored in the variable pointed to by
-\fIprocPtr\fR and the variable pointed to by \fIclientDataPtr\fR
-will not be modified. The variable pointed to by \fInumArgsPointer\fR
-will contain -1, and no argument types will be stored in the variable
-pointed to by \fIargTypesPointer\fR.
-.PP
-\fBTcl_ListMathFuncs\fR returns a Tcl value containing a list of all
-the math functions defined in the interpreter whose name matches
-\fIpattern\fR. The returned value has a reference count of zero.
-.SH "SEE ALSO"
-expr(n), info(n), Tcl_CreateObjCommand(3), Tcl_Free(3), Tcl_NewListObj(3)
-.SH KEYWORDS
-expression, mathematical function
diff --git a/doc/CrtObjCmd.3 b/doc/CrtObjCmd.3
index 2cd9222..746faba 100644
--- a/doc/CrtObjCmd.3
+++ b/doc/CrtObjCmd.3
@@ -59,7 +59,7 @@ Name of command.
.AP Tcl_ObjCmdProc *proc in
Implementation of the new command: \fIproc\fR will be called whenever
\fIcmdName\fR is invoked as a command.
-.AP ClientData clientData in
+.AP void *clientData in
Arbitrary one-word value to pass to \fIproc\fR and \fIdeleteProc\fR.
.AP Tcl_CmdDeleteProc *deleteProc in
Procedure to call before \fIcmdName\fR is deleted from the interpreter;
@@ -102,7 +102,7 @@ and it returns NULL.
.PP
.CS
typedef int \fBTcl_ObjCmdProc\fR(
- ClientData \fIclientData\fR,
+ void *\fIclientData\fR,
Tcl_Interp *\fIinterp\fR,
int \fIobjc\fR,
Tcl_Obj *const \fIobjv\fR[]);
@@ -175,7 +175,7 @@ result that match the type \fBTcl_CmdDeleteProc\fR:
.PP
.CS
typedef void \fBTcl_CmdDeleteProc\fR(
- ClientData \fIclientData\fR);
+ void *\fIclientData\fR);
.CE
.PP
The \fIclientData\fR argument will be the same as the \fIclientData\fR
@@ -217,11 +217,11 @@ A \fBTcl_CmdInfo\fR structure has the following fields:
typedef struct Tcl_CmdInfo {
int \fIisNativeObjectProc\fR;
Tcl_ObjCmdProc *\fIobjProc\fR;
- ClientData \fIobjClientData\fR;
+ void *\fIobjClientData\fR;
Tcl_CmdProc *\fIproc\fR;
- ClientData \fIclientData\fR;
+ void *\fIclientData\fR;
Tcl_CmdDeleteProc *\fIdeleteProc\fR;
- ClientData \fIdeleteData\fR;
+ void *\fIdeleteData\fR;
Tcl_Namespace *\fInamespacePtr\fR;
} \fBTcl_CmdInfo\fR;
.CE
@@ -247,7 +247,7 @@ otherwise, this is a compatibility procedure
registered by \fBTcl_CreateObjCommand\fR
that simply calls the command's
value-based procedure after converting its string arguments to Tcl values.
-The field \fIdeleteData\fR is the ClientData value
+The field \fIdeleteData\fR is the clientData value
to pass to \fIdeleteProc\fR; it is normally the same as
\fIclientData\fR but may be set independently using the
\fBTcl_SetCommandInfo\fR procedure.
@@ -261,7 +261,7 @@ from \fBTcl_CreateObjCommand\fR in place of the command name. If the
and fills in the structure designated by \fIinfoPtr\fR.
.PP
\fBTcl_SetCommandInfo\fR is used to modify the procedures and
-ClientData values associated with a command.
+clientData values associated with a command.
Its \fIcmdName\fR argument is the name of a command in \fIinterp\fR.
\fIcmdName\fR may include \fB::\fR namespace qualifiers
to identify a command in a particular namespace.
@@ -277,9 +277,9 @@ copies the information from \fI*infoPtr\fR to Tcl's internal structure
for the command and returns 1.
.PP
Note that \fBTcl_SetCommandInfo\fR and
-\fBTcl_SetCommandInfoFromToken\fR both allow the ClientData for a
+\fBTcl_SetCommandInfoFromToken\fR both allow the clientData for a
command's deletion procedure to be given a different value than the
-ClientData for its command procedure.
+clientData for its command procedure.
.PP
Note that neither \fBTcl_SetCommandInfo\fR nor
\fBTcl_SetCommandInfoFromToken\fR will change a command's namespace.
diff --git a/doc/CrtTimerHdlr.3 b/doc/CrtTimerHdlr.3
index c229a23..1190417 100644
--- a/doc/CrtTimerHdlr.3
+++ b/doc/CrtTimerHdlr.3
@@ -24,7 +24,7 @@ Tcl_TimerToken
How many milliseconds to wait before invoking \fIproc\fR.
.AP Tcl_TimerProc *proc in
Procedure to invoke after \fImilliseconds\fR have elapsed.
-.AP ClientData clientData in
+.AP void *clientData in
Arbitrary one-word value to pass to \fIproc\fR.
.AP Tcl_TimerToken token in
Token for previously created timer handler (the return value
@@ -51,7 +51,7 @@ the type \fBTcl_TimerProc\fR:
.PP
.CS
typedef void \fBTcl_TimerProc\fR(
- ClientData \fIclientData\fR);
+ void *\fIclientData\fR);
.CE
.PP
The \fIclientData\fR parameter to \fIproc\fR is a
diff --git a/doc/CrtTrace.3 b/doc/CrtTrace.3
index d5353ac..fbce7e1 100644
--- a/doc/CrtTrace.3
+++ b/doc/CrtTrace.3
@@ -41,7 +41,7 @@ details of the calling sequence.
.AP Tcl_CmdTraceProc *proc in
Procedure to call for each command that is executed. See below for
details on the calling sequence.
-.AP ClientData clientData in
+.AP void *clientData in
Arbitrary one-word value to pass to \fIobjProc\fR or \fIproc\fR.
.AP Tcl_CmdObjTraceDeleteProc *deleteProc in
Procedure to call when the trace is deleted. See below for details of
@@ -66,7 +66,7 @@ interpreter.
.PP
.CS
typedef int \fBTcl_CmdObjTraceProc\fR(
- \fBClientData\fR \fIclientData\fR,
+ \fBvoid *\fR \fIclientData\fR,
\fBTcl_Interp\fR* \fIinterp\fR,
int \fIlevel\fR,
const char *\fIcommand\fR,
@@ -77,7 +77,7 @@ typedef int \fBTcl_CmdObjTraceProc\fR(
.PP
The \fIclientData\fR and \fIinterp\fR parameters are copies of the
corresponding arguments given to \fBTcl_CreateTrace\fR.
-\fIClientData\fR typically points to an application-specific data
+\fIclientData\fR typically points to an application-specific data
structure that describes what to do when \fIobjProc\fR is invoked. The
\fIlevel\fR parameter gives the nesting level of the command (1 for
top-level commands passed to \fBTcl_Eval\fR by the application, 2 for
@@ -144,7 +144,7 @@ When \fBTcl_DeleteTrace\fR is called, the interpreter invokes the
.PP
.CS
typedef void \fBTcl_CmdObjTraceDeleteProc\fR(
- \fBClientData\fR \fIclientData\fR);
+ \fBvoid *\fR \fIclientData\fR);
.CE
.PP
The \fIclientData\fR parameter will be the same as the
@@ -160,12 +160,12 @@ match the type \fBTcl_CmdTraceProc\fR:
.PP
.CS
typedef void \fBTcl_CmdTraceProc\fR(
- ClientData \fIclientData\fR,
+ void *\fIclientData\fR,
Tcl_Interp *\fIinterp\fR,
int \fIlevel\fR,
char *\fIcommand\fR,
Tcl_CmdProc *\fIcmdProc\fR,
- ClientData \fIcmdClientData\fR,
+ void *\fIcmdClientData\fR,
int \fIargc\fR,
const char *\fIargv\fR[]);
.CE
diff --git a/doc/DString.3 b/doc/DString.3
index 00f1b8a..b4d0922 100644
--- a/doc/DString.3
+++ b/doc/DString.3
@@ -9,7 +9,7 @@
.so man.macros
.BS
.SH NAME
-Tcl_DStringInit, Tcl_DStringAppend, Tcl_DStringAppendElement, Tcl_DStringStartSublist, Tcl_DStringEndSublist, Tcl_DStringLength, Tcl_DStringValue, Tcl_DStringSetLength, Tcl_DStringTrunc, Tcl_DStringFree, Tcl_DStringResult, Tcl_DStringGetResult \- manipulate dynamic strings
+Tcl_DStringInit, Tcl_DStringAppend, Tcl_DStringAppendElement, Tcl_DStringStartSublist, Tcl_DStringEndSublist, Tcl_DStringLength, Tcl_DStringValue, Tcl_DStringSetLength, Tcl_DStringFree, Tcl_DStringResult, Tcl_DStringGetResult \- manipulate dynamic strings
.SH SYNOPSIS
.nf
\fB#include <tcl.h>\fR
@@ -26,7 +26,7 @@ char *
.sp
\fBTcl_DStringEndSublist\fR(\fIdsPtr\fR)
.sp
-int
+size_t
\fBTcl_DStringLength\fR(\fIdsPtr\fR)
.sp
char *
@@ -34,8 +34,6 @@ char *
.sp
\fBTcl_DStringSetLength\fR(\fIdsPtr, newLength\fR)
.sp
-\fBTcl_DStringTrunc\fR(\fIdsPtr, newLength\fR)
-.sp
\fBTcl_DStringFree\fR(\fIdsPtr\fR)
.sp
\fBTcl_DStringResult\fR(\fIinterp, dsPtr\fR)
@@ -49,10 +47,10 @@ Pointer to structure that is used to manage a dynamic string.
Pointer to characters to append to dynamic string.
.AP "const char" *element in
Pointer to characters to append as list element to dynamic string.
-.AP int length in
-Number of bytes from \fIbytes\fR to add to dynamic string. If -1,
+.AP size_t length in
+Number of bytes from \fIbytes\fR to add to dynamic string. If TCL_AUTO_LENGTH,
add all characters up to null terminating character.
-.AP int newLength in
+.AP size_t newLength in
New length for dynamic string, not including null terminating
character.
.AP Tcl_Interp *interp in/out
@@ -128,10 +126,6 @@ caller to fill in the new space.
even if the string is truncated to zero length, so \fBTcl_DStringFree\fR
will still need to be called.
.PP
-\fBTcl_DStringTrunc\fR changes the length of a dynamic string.
-This procedure is now deprecated. \fBTcl_DStringSetLength\fR should
-be used instead.
-.PP
\fBTcl_DStringFree\fR should be called when you are finished using
the string. It frees up any memory that was allocated for the string
and reinitializes the string's value to an empty string.
diff --git a/doc/DoWhenIdle.3 b/doc/DoWhenIdle.3
index cfdbff9..1a252cc 100644
--- a/doc/DoWhenIdle.3
+++ b/doc/DoWhenIdle.3
@@ -21,7 +21,7 @@ Tcl_DoWhenIdle, Tcl_CancelIdleCall \- invoke a procedure when there are no pendi
.AS Tcl_IdleProc clientData
.AP Tcl_IdleProc *proc in
Procedure to invoke.
-.AP ClientData clientData in
+.AP coid *clientData in
Arbitrary one-word value to pass to \fIproc\fR.
.BE
.SH DESCRIPTION
@@ -43,7 +43,7 @@ type \fBTcl_IdleProc\fR:
.PP
.CS
typedef void \fBTcl_IdleProc\fR(
- ClientData \fIclientData\fR);
+ void *\fIclientData\fR);
.CE
.PP
The \fIclientData\fR parameter to \fIproc\fR is a copy of the \fIclientData\fR
diff --git a/doc/DumpActiveMemory.3 b/doc/DumpActiveMemory.3
index 43333da..ab75ad2 100644
--- a/doc/DumpActiveMemory.3
+++ b/doc/DumpActiveMemory.3
@@ -43,7 +43,7 @@ is not defined, these functions are all no-ops.
\fBTcl_DumpActiveMemory\fR will output a list of all currently
allocated memory to the specified file. The information output for
each allocated block of memory is: starting and ending addresses
-(excluding guard zone), size, source file where \fBckalloc\fR was
+(excluding guard zone), size, source file where \fBTcl_Alloc\fR was
called to allocate the block and line number in that file. It is
especially useful to call \fBTcl_DumpActiveMemory\fR after the Tcl
interpreter has been deleted.
@@ -55,8 +55,8 @@ by \fBTcl_Main\fR.
\fBTcl_ValidateAllMemory\fR forces a validation of the guard zones of
all currently allocated blocks of memory. Normally validation of a
block occurs when its freed, unless full validation is enabled, in
-which case validation of all blocks occurs when \fBckalloc\fR and
-\fBckfree\fR are called. This function forces the validation to occur
+which case validation of all blocks occurs when \fBTcl_Alloc\fR and
+\fBTcl_Free\fR are called. This function forces the validation to occur
at any point.
.SH "SEE ALSO"
diff --git a/doc/Encoding.3 b/doc/Encoding.3
index 79fca0f..c3161e1 100644
--- a/doc/Encoding.3
+++ b/doc/Encoding.3
@@ -8,7 +8,7 @@
.so man.macros
.BS
.SH NAME
-Tcl_GetEncoding, Tcl_FreeEncoding, Tcl_GetEncodingFromObj, Tcl_ExternalToUtfDString, Tcl_ExternalToUtf, Tcl_UtfToExternalDString, Tcl_UtfToExternal, Tcl_WinTCharToUtf, Tcl_WinUtfToTChar, Tcl_GetEncodingName, Tcl_SetSystemEncoding, Tcl_GetEncodingNameFromEnvironment, Tcl_GetEncodingNames, Tcl_CreateEncoding, Tcl_GetEncodingSearchPath, Tcl_SetEncodingSearchPath, Tcl_GetDefaultEncodingDir, Tcl_SetDefaultEncodingDir \- procedures for creating and using encodings
+Tcl_GetEncoding, Tcl_FreeEncoding, Tcl_GetEncodingFromObj, Tcl_ExternalToUtfDString, Tcl_ExternalToUtf, Tcl_UtfToExternalDString, Tcl_UtfToExternal, Tcl_WinTCharToUtf, Tcl_WinUtfToTChar, Tcl_GetEncodingName, Tcl_SetSystemEncoding, Tcl_GetEncodingNameFromEnvironment, Tcl_GetEncodingNames, Tcl_CreateEncoding, Tcl_GetEncodingSearchPath, Tcl_SetEncodingSearchPath \- procedures for creating and using encodings
.SH SYNOPSIS
.nf
\fB#include <tcl.h>\fR
@@ -62,12 +62,6 @@ Tcl_Obj *
.sp
int
\fBTcl_SetEncodingSearchPath\fR(\fIsearchPath\fR)
-.sp
-const char *
-\fBTcl_GetDefaultEncodingDir\fR(\fIvoid\fR)
-.sp
-void
-\fBTcl_SetDefaultEncodingDir\fR(\fIpath\fR)
.SH ARGUMENTS
.AS "const Tcl_EncodingType" *dstWrotePtr in/out
.AP Tcl_Interp *interp in
@@ -89,7 +83,7 @@ specified encoding that are to be converted to UTF-8. For the
UTF-8 characters to be converted to the specified encoding.
.AP "const TCHAR" *tsrc in
An array of Windows TCHAR characters to convert to UTF-8.
-.AP int srcLen in
+.AP size_t srcLen in
Length of \fIsrc\fR or \fItsrc\fR in bytes. If the length is negative, the
encoding-specific length of the string is used.
.AP Tcl_DString *dstPtr out
@@ -287,7 +281,7 @@ the encoding name to it. The \fBTcl_DStringValue\fR is returned.
\fBTcl_GetEncodingNames\fR sets the \fIinterp\fR result to a list
consisting of the names of all the encodings that are currently defined
or can be dynamically loaded, searching the encoding path specified by
-\fBTcl_SetDefaultEncodingDir\fR. This procedure does not ensure that the
+\fBTcl_SetEncodingSearchPath\fR. This procedure does not ensure that the
dynamically-loadable encoding files contain valid data, but merely that they
exist.
.PP
@@ -314,7 +308,7 @@ typedef struct Tcl_EncodingType {
Tcl_EncodingConvertProc *\fItoUtfProc\fR;
Tcl_EncodingConvertProc *\fIfromUtfProc\fR;
Tcl_EncodingFreeProc *\fIfreeProc\fR;
- ClientData \fIclientData\fR;
+ void *\fIclientData\fR;
int \fInullSize\fR;
} \fBTcl_EncodingType\fR;
.CE
@@ -345,7 +339,7 @@ type \fBTcl_EncodingConvertProc\fR:
.PP
.CS
typedef int \fBTcl_EncodingConvertProc\fR(
- ClientData \fIclientData\fR,
+ void *\fIclientData\fR,
const char *\fIsrc\fR,
int \fIsrcLen\fR,
int \fIflags\fR,
@@ -377,7 +371,7 @@ The callback procedure \fIfreeProc\fR, if non-NULL, should match the type
.PP
.CS
typedef void \fBTcl_EncodingFreeProc\fR(
- ClientData \fIclientData\fR);
+ void *\fIclientData\fR);
.CE
.PP
This \fIfreeProc\fR function is called when the encoding is deleted. The
@@ -402,15 +396,6 @@ are not verified as existing readable filesystem directories. When
searching for encoding data files takes place, and non-existent or
non-readable filesystem directories on the \fIsearchPath\fR are silently
ignored.
-.PP
-\fBTcl_GetDefaultEncodingDir\fR and \fBTcl_SetDefaultEncodingDir\fR
-are obsolete interfaces best replaced with calls to
-\fBTcl_GetEncodingSearchPath\fR and \fBTcl_SetEncodingSearchPath\fR.
-They are called to access and set the first element of the \fIsearchPath\fR
-list. Since Tcl searches \fIsearchPath\fR for encoding data files in
-list order, these routines establish the
-.QW default
-directory in which to find encoding data files.
.SH "ENCODING FILES"
Space would prohibit precompiling into Tcl every possible encoding
algorithm, so many encodings are stored on disk as dynamically-loadable
diff --git a/doc/Eval.3 b/doc/Eval.3
index e241794..a094019 100644
--- a/doc/Eval.3
+++ b/doc/Eval.3
@@ -10,7 +10,7 @@
.so man.macros
.BS
.SH NAME
-Tcl_EvalObjEx, Tcl_EvalFile, Tcl_EvalObjv, Tcl_Eval, Tcl_EvalEx, Tcl_GlobalEval, Tcl_GlobalEvalObj, Tcl_VarEval, Tcl_VarEvalVA \- execute Tcl scripts
+Tcl_EvalObjEx, Tcl_EvalFile, Tcl_EvalObjv, Tcl_Eval, Tcl_EvalEx, Tcl_GlobalEval, Tcl_GlobalEvalObj, Tcl_VarEval \- execute Tcl scripts
.SH SYNOPSIS
.nf
\fB#include <tcl.h>\fR
@@ -38,9 +38,6 @@ int
.sp
int
\fBTcl_VarEval\fR(\fIinterp, part, part, ... \fB(char *) NULL\fR)
-.sp
-int
-\fBTcl_VarEvalVA\fR(\fIinterp, argList\fR)
.SH ARGUMENTS
.AS Tcl_Interp **termPtr
.AP Tcl_Interp *interp in
@@ -67,9 +64,6 @@ first null byte are used.
Points to first byte of script to execute (null-terminated and UTF-8).
.AP char *part in
String forming part of a Tcl script.
-.AP va_list argList in
-An argument list which must have been initialized using
-\fBva_start\fR, and cleared using \fBva_end\fR.
.BE
.SH DESCRIPTION
@@ -128,16 +122,10 @@ might be a UTF-8 special code. The string is parsed and executed directly
bytecodes. In situations where it is known that the script will never be
executed again, \fBTcl_Eval\fR may be faster than \fBTcl_EvalObjEx\fR.
\fBTcl_Eval\fR returns a completion code and result just like
-\fBTcl_EvalObjEx\fR. Note: for backward compatibility with versions before
-Tcl 8.0, \fBTcl_Eval\fR copies the value result in \fIinterp\fR to
-\fIinterp->result\fR (use is deprecated) where it can be accessed directly.
- This makes \fBTcl_Eval\fR somewhat slower than \fBTcl_EvalEx\fR, which
-does not do the copy.
+\fBTcl_EvalObjEx\fR.
.PP
\fBTcl_EvalEx\fR is an extended version of \fBTcl_Eval\fR that takes
-additional arguments \fInumBytes\fR and \fIflags\fR. For the
-efficiency reason given above, \fBTcl_EvalEx\fR is generally preferred
-over \fBTcl_Eval\fR.
+additional arguments \fInumBytes\fR and \fIflags\fR.
.PP
\fBTcl_GlobalEval\fR and \fBTcl_GlobalEvalObj\fR are older procedures
that are now deprecated. They are similar to \fBTcl_EvalEx\fR and
@@ -153,10 +141,6 @@ It returns the result of the command and also modifies
\fIinterp->result\fR 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
-\fBTcl_VarEvalVA\fR is the same as \fBTcl_VarEval\fR except that
-instead of taking a variable number of arguments it takes an argument
-list. Like \fBTcl_VarEval\fR, \fBTcl_VarEvalVA\fR is deprecated.
.SH "FLAG BITS"
.PP
diff --git a/doc/Exit.3 b/doc/Exit.3
index a52b2e1..874ea90 100644
--- a/doc/Exit.3
+++ b/doc/Exit.3
@@ -42,7 +42,7 @@ usually means that an error occurred.
Procedure to invoke before exiting application, or (for
\fBTcl_SetExitProc\fR) NULL to uninstall the current application exit
procedure.
-.AP ClientData clientData in
+.AP void *clientData in
Arbitrary one-word value to pass to \fIproc\fR.
.BE
@@ -64,7 +64,7 @@ otherwise causes the application to terminate without calling
returns control to its caller.
If an application exit handler has been installed (see
\fBTcl_SetExitProc\fR), that handler is invoked with an argument
-consisting of the exit status (cast to ClientData); the application
+consisting of the exit status (cast to void *); the application
exit handler should not return control to Tcl.
.PP
\fBTcl_Finalize\fR is similar to \fBTcl_Exit\fR except that it does not
@@ -93,7 +93,7 @@ and freeing global memory.
.PP
.CS
typedef void \fBTcl_ExitProc\fR(
- ClientData \fIclientData\fR);
+ void *\fIclientData\fR);
.CE
.PP
The \fIclientData\fR parameter to \fIproc\fR is a
@@ -133,10 +133,9 @@ installed, that exit handler takes over complete responsibility for
finalization of Tcl's subsystems via \fBTcl_Finalize\fR at an
appropriate time. The argument passed to \fIproc\fR when it is
invoked will be the exit status code (as passed to \fBTcl_Exit\fR)
-cast to a ClientData value.
+cast to a void *value.
.PP
-\fBTcl_SetExitProc\fR can not be used in stub-enabled extensions. Its symbol
-entry in the stub table is deprecated and it will be removed in Tcl 9.0.
+\fBTcl_SetExitProc\fR can not be used in stub-enabled extensions.
.SH "SEE ALSO"
exit(n)
.SH KEYWORDS
diff --git a/doc/FileSystem.3 b/doc/FileSystem.3
index 28ee8f0..7fe9194 100644
--- a/doc/FileSystem.3
+++ b/doc/FileSystem.3
@@ -20,7 +20,7 @@ int
int
\fBTcl_FSUnregister\fR(\fIfsPtr\fR)
.sp
-ClientData
+void *
\fBTcl_FSData\fR(\fIfsPtr\fR)
.sp
void
@@ -125,7 +125,7 @@ Tcl_Obj *
int
\fBTcl_FSConvertToPathType\fR(\fIinterp, pathPtr\fR)
.sp
-ClientData
+void *
\fBTcl_FSGetInternalRep\fR(\fIpathPtr, fsPtr\fR)
.sp
Tcl_Obj *
@@ -212,7 +212,7 @@ this structure will be returned. This parameter may be NULL.
.AP Tcl_Interp *interp in
Interpreter to use either for results, evaluation, or reporting error
messages.
-.AP ClientData clientData in
+.AP void *clientData in
The native description of the path value to create.
.AP Tcl_Obj *firstPtr in
The first of two path values to compare. The value may be converted
@@ -249,7 +249,7 @@ Name of a procedure to look up in the file's symbol table
Filled with the init function for this code.
.AP Tcl_PackageInitProc **proc2Ptr out
Filled with the safe-init function for this code.
-.AP ClientData *clientDataPtr out
+.AP void **clientDataPtr out
Filled with the clientData value to pass to this code's unload
function when it is called.
.AP Tcl_LoadHandle *loadHandlePtr out
@@ -724,7 +724,7 @@ better functions to use for most purposes.
\fBTcl_FSGetTranslatedStringPath\fR does the same as
\fBTcl_FSGetTranslatedPath\fR, but returns a character string or NULL.
The string returned is dynamically allocated and owned by the caller,
-which must store it or call \fBckfree\fR to ensure it is freed. Again,
+which must store it or call \fBTcl_Free\fR to ensure it is freed. Again,
\fBTcl_FSGetNormalizedPath\fR or \fBTcl_FSGetNativePath\fR are usually
better functions to use for most purposes.
.PP
@@ -791,7 +791,7 @@ It returns one of \fBTCL_PATH_ABSOLUTE\fR, \fBTCL_PATH_RELATIVE\fR, or
.SS "PORTABLE STAT RESULT API"
.PP
\fBTcl_AllocStatBuf\fR allocates a \fITcl_StatBuf\fR on the system heap (which
-may be deallocated by being passed to \fBckfree\fR). This allows extensions to
+may be deallocated by being passed to \fBTcl_Free\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
@@ -841,7 +841,7 @@ general that is not a good thing to do). \fBTCL_OK\fR will be returned.
the list of known filesystems, if it is known, and returns \fBTCL_OK\fR. If
the filesystem is not currently registered, \fBTCL_ERROR\fR is returned.
.PP
-\fBTcl_FSData\fR will return the ClientData associated with the given
+\fBTcl_FSData\fR will return the clientData associated with the given
filesystem, if that filesystem is registered. Otherwise it will
return NULL.
.PP
@@ -1018,7 +1018,7 @@ Tcl's internal list of known filesystems.
.CS
typedef int \fBTcl_FSPathInFilesystemProc\fR(
Tcl_Obj *\fIpathPtr\fR,
- ClientData *\fIclientDataPtr\fR);
+ void **\fIclientDataPtr\fR);
.CE
.SS DUPINTERNALREPPROC
.PP
@@ -1028,8 +1028,8 @@ simply not copy the internal representation, which may then need to be
regenerated later.
.PP
.CS
-typedef ClientData \fBTcl_FSDupInternalRepProc\fR(
- ClientData \fIclientData\fR);
+typedef void *\fBTcl_FSDupInternalRepProc\fR(
+ void *\fIclientData\fR);
.CE
.SS FREEINTERNALREPPROC
Free the internal representation. This must be implemented if internal
@@ -1038,7 +1038,7 @@ internal representation is generated), but may otherwise be NULL.
.PP
.CS
typedef void \fBTcl_FSFreeInternalRepProc\fR(
- ClientData \fIclientData\fR);
+ void *\fIclientData\fR);
.CE
.SS INTERNALTONORMALIZEDPROC
.PP
@@ -1049,7 +1049,7 @@ representation is the normalized path.
.PP
.CS
typedef Tcl_Obj *\fBTcl_FSInternalToNormalizedProc\fR(
- ClientData \fIclientData\fR);
+ void *\fIclientData\fR);
.CE
.SS CREATEINTERNALREPPROC
.PP
@@ -1060,7 +1060,7 @@ the \fITcl_FSPathInFilesystemProc\fR for this filesystem always
immediately creates an internal representation for paths it accepts.
.PP
.CS
-typedef ClientData \fBTcl_FSCreateInternalRepProc\fR(
+typedef void *\fBTcl_FSCreateInternalRepProc\fR(
Tcl_Obj *\fIpathPtr\fR);
.CE
.SS NORMALIZEPATHPROC
diff --git a/doc/FindExec.3 b/doc/FindExec.3
index 149ef8a..a1dd20d 100644
--- a/doc/FindExec.3
+++ b/doc/FindExec.3
@@ -59,7 +59,6 @@ equivalent to the \fBinfo nameofexecutable\fR command. NULL
is returned if the internal full path name has not been
computed or unknown.
.PP
-\fBTcl_FindExecutable\fR can not be used in stub-enabled extensions. Its symbol
-entry in the stub table is deprecated and it will be removed in Tcl 9.0.
+\fBTcl_FindExecutable\fR can not be used in stub-enabled extensions.
.SH KEYWORDS
binary, executable file
diff --git a/doc/GetInt.3 b/doc/GetInt.3
index eba549d..5562e28 100644
--- a/doc/GetInt.3
+++ b/doc/GetInt.3
@@ -64,12 +64,9 @@ if the first such characters are
then \fIsrc\fR is expected to be in octal form; otherwise,
if the first such characters are
.QW \fB0b\fR
-then \fIsrc\fR is expected to be in binary form; otherwise,
-if the first such character is
-.QW \fB0\fR
then \fIsrc\fR
-is expected to be in octal form; otherwise, \fIsrc\fR
-is expected to be in decimal form.
+is expected to be in binary form; otherwise, \fIsrc\fR is
+expected to be in decimal form.
.PP
\fBTcl_GetDouble\fR expects \fIsrc\fR to consist of a floating-point
number, which is: white space; a sign; a sequence of digits; a
diff --git a/doc/GetOpnFl.3 b/doc/GetOpnFl.3
index a450b02..5ac5391 100644
--- a/doc/GetOpnFl.3
+++ b/doc/GetOpnFl.3
@@ -28,7 +28,7 @@ be used for reading.
.AP int checkUsage in
If non-zero, then an error will be generated if the file was not opened
for the access indicated by \fIwrite\fR.
-.AP ClientData *filePtr out
+.AP void **filePtr out
Points to word in which to store pointer to FILE structure for
the file given by \fIchanID\fR.
.BE
diff --git a/doc/GetTime.3 b/doc/GetTime.3
index 9f96be5..4bb3759 100644
--- a/doc/GetTime.3
+++ b/doc/GetTime.3
@@ -27,13 +27,13 @@ Pointer to handler function replacing \fBTcl_GetTime\fR's access to the OS.
.AP Tcl_ScaleTimeProc scaleProc in
Pointer to handler function for the conversion of time delays in the
virtual domain to real-time.
-.AP ClientData clientData in
+.AP void *clientData in
Value passed through to the two handler functions.
.AP Tcl_GetTimeProc *getProcPtr out
Pointer to place the currently registered get handler function into.
.AP Tcl_ScaleTimeProc *scaleProcPtr out
Pointer to place the currently registered scale handler function into.
-.AP ClientData *clientDataPtr out
+.AP void **clientDataPtr out
Pointer to place the currently registered pass-through value into.
.BE
.SH DESCRIPTION
@@ -83,10 +83,10 @@ The signatures of the handler functions are as follows:
.CS
typedef void \fBTcl_GetTimeProc\fR(
Tcl_Time *\fItimebuf\fR,
- ClientData \fIclientData\fR);
+ void *\fIclientData\fR);
typedef void \fBTcl_ScaleTimeProc\fR(
Tcl_Time *\fItimebuf\fR,
- ClientData \fIclientData\fR);
+ void *\fIclientData\fR);
.CE
.PP
The \fItimebuf\fR fields contain the time to manipulate, and the
diff --git a/doc/Hash.3 b/doc/Hash.3
index aa79b86..c3ef6b3 100644
--- a/doc/Hash.3
+++ b/doc/Hash.3
@@ -30,7 +30,7 @@ Tcl_HashEntry *
Tcl_HashEntry *
\fBTcl_FindHashEntry\fR(\fItablePtr, key\fR)
.sp
-ClientData
+void *
\fBTcl_GetHashValue\fR(\fIentryPtr\fR)
.sp
\fBTcl_SetHashValue\fR(\fIentryPtr, value\fR)
@@ -66,9 +66,8 @@ The word at \fI*newPtr\fR is set to 1 if a new entry was created
and 0 if there was already an entry for \fIkey\fR.
.AP Tcl_HashEntry *entryPtr in
Pointer to hash table entry.
-.AP ClientData value in
-New value to assign to hash table entry. Need not have type
-ClientData, but must fit in same space as ClientData.
+.AP void *value in
+New value to assign to hash table entry.
.AP Tcl_HashSearch *searchPtr in
Pointer to record to use to keep track of progress in enumerating
all the entries in a hash table.
@@ -186,11 +185,6 @@ instead, it returns NULL as result.
.PP
\fBTcl_GetHashValue\fR and \fBTcl_SetHashValue\fR are used to
read and write an entry's value, respectively.
-Values are stored and retrieved as type
-.QW ClientData ,
-which is
-large enough to hold a pointer value. On almost all machines this is
-large enough to hold an integer value too.
.PP
\fBTcl_GetHashKey\fR returns the key for a given hash table entry,
either as a pointer to a string, a one-word
@@ -229,7 +223,7 @@ overall information about a hash table, such as the number of
entries it contains, the number of buckets in its hash array,
and the utilization of the buckets.
It is the caller's responsibility to free the result string
-by passing it to \fBckfree\fR.
+by passing it to \fBTcl_Free\fR.
.PP
The header file \fBtcl.h\fR defines the actual data structures
used to implement hash tables.
diff --git a/doc/InitStubs.3 b/doc/InitStubs.3
index 4423666..20105fe 100644
--- a/doc/InitStubs.3
+++ b/doc/InitStubs.3
@@ -63,9 +63,9 @@ Define the \fBUSE_TCL_STUBS\fR symbol. Typically, you would include the
\fB\-DUSE_TCL_STUBS\fR flag when compiling the extension.
.IP 3) 5
Link the extension with the Tcl stubs library instead of the standard
-Tcl library. For example, to use the Tcl 8.6 ABI on Unix platforms,
-the library name is \fIlibtclstub8.6.a\fR; on Windows platforms, the
-library name is \fItclstub86.lib\fR.
+Tcl library. For example, to use the Tcl 9.0 ABI on Unix platforms,
+the library name is \fIlibtclstub9.0.a\fR; on Windows platforms, the
+library name is \fItclstub90.lib\fR.
.PP
If the extension also requires the Tk API, it must also call
\fBTk_InitStubs\fR to initialize the Tk stubs interface and link
diff --git a/doc/Interp.3 b/doc/Interp.3
index 4ccff21..64cb5a0 100644
--- a/doc/Interp.3
+++ b/doc/Interp.3
@@ -33,19 +33,6 @@ 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,
diff --git a/doc/Limit.3 b/doc/Limit.3
index 5939a80..3aac88a 100644
--- a/doc/Limit.3
+++ b/doc/Limit.3
@@ -83,7 +83,7 @@ the handler returns. Many handlers may be attached to the same
interpreter limit; their order of execution is not defined, and they
must be identified by \fIhandlerProc\fR and \fIclientData\fR when they
are deleted.
-.AP ClientData clientData in
+.AP void *clientData in
Arbitrary pointer-sized word used to pass some context to the
\fIhandlerProc\fR function.
.AP Tcl_LimitHandlerDeleteProc *deleteProc in
@@ -162,7 +162,7 @@ following prototype:
.PP
.CS
typedef void \fBTcl_LimitHandlerProc\fR(
- ClientData \fIclientData\fR,
+ void *\fIclientData\fR,
Tcl_Interp *\fIinterp\fR);
.CE
.PP
@@ -179,7 +179,7 @@ following prototype:
.PP
.CS
typedef void \fBTcl_LimitHandlerDeleteProc\fR(
- ClientData \fIclientData\fR);
+ void *\fIclientData\fR);
.CE
.PP
A limit handler may be deleted using \fBTcl_LimitRemoveHandler\fR; the
diff --git a/doc/LinkVar.3 b/doc/LinkVar.3
index 1e42858..6710702 100644
--- a/doc/LinkVar.3
+++ b/doc/LinkVar.3
@@ -59,7 +59,7 @@ In \fBTcl_LinkArray\fR, the additional linked types \fBTCL_LINK_CHARS\fR and
All the above for both functions may be
optionally OR'ed with \fBTCL_LINK_READ_ONLY\fR to make the Tcl
variable read-only.
-.AP int size in
+.AP size_t size in
.VS "TIP 312"
The number of elements in the C array. Must be greater than zero.
.VE "TIP 312"
@@ -265,7 +265,7 @@ Tcl errors.
.
The C variable is of type \fBchar *\fR.
If its value is not NULL then it must be a pointer to a string
-allocated with \fBTcl_Alloc\fR or \fBckalloc\fR.
+allocated with \fBTcl_Alloc\fR.
Whenever the Tcl variable is modified the current C string will be
freed and new memory will be allocated to hold a copy of the variable's
new value.
diff --git a/doc/Method.3 b/doc/Method.3
index 9e636a1..41e190d 100644
--- a/doc/Method.3
+++ b/doc/Method.3
@@ -61,7 +61,7 @@ Tcl_Object
int
\fBTcl_ObjectContextSkippedArgs\fR(\fIcontext\fR)
.SH ARGUMENTS
-.AS ClientData clientData in
+.AS void *clientData in
.AP Tcl_Interp *interp in/out
The interpreter holding the object or class to create or update a method in.
.AP Tcl_Object object in
@@ -83,10 +83,10 @@ and \fBTCL_OO_METHOD_PRIVATE\fR for a private method.
.AP Tcl_MethodType *methodTypePtr in
A description of the type of the method to create, or the type of method to
compare against.
-.AP ClientData clientData in
+.AP void *clientData in
A piece of data that is passed to the implementation of the method without
interpretation.
-.AP ClientData *clientDataPtr out
+.AP void **clientDataPtr out
A pointer to a variable in which to write the \fIclientData\fR value supplied
when the method was created. If NULL, the \fIclientData\fR value will not be
retrieved.
@@ -213,7 +213,7 @@ Functions matching this signature are called when the method is invoked.
.PP
.CS
typedef int \fBTcl_MethodCallProc\fR(
- ClientData \fIclientData\fR,
+ void *\fIclientData\fR,
Tcl_Interp *\fIinterp\fR,
Tcl_ObjectContext \fIobjectContext\fR,
int \fIobjc\fR,
@@ -234,7 +234,7 @@ through a new method being created or because the object or class is deleted.
.PP
.CS
typedef void \fBTcl_MethodDeleteProc\fR(
- ClientData \fIclientData\fR);
+ void *\fIclientData\fR);
.CE
.PP
The \fIclientData\fR argument to a Tcl_MethodDeleteProc will be the same as
@@ -248,8 +248,8 @@ class is copied using \fBTcl_CopyObjectInstance\fR (or \fBoo::copy\fR).
.CS
typedef int \fBTcl_CloneProc\fR(
Tcl_Interp *\fIinterp\fR,
- ClientData \fIoldClientData\fR,
- ClientData *\fInewClientDataPtr\fR);
+ void *\fIoldClientData\fR,
+ void **\fInewClientDataPtr\fR);
.CE
.PP
The \fIinterp\fR argument gives a place to write an error message when the
diff --git a/doc/NRE.3 b/doc/NRE.3
index 6024b6a..f4d6a95 100644
--- a/doc/NRE.3
+++ b/doc/NRE.3
@@ -49,7 +49,7 @@ in the same way as the \fIproc\fR argument to \fBTcl_CreateObjCommand\fR(3)
(\fIq.v.\fR).
.AP Tcl_ObjCmdProc *nreProc in
Called instead of \fIproc\fR when a trampoline is already in use.
-.AP ClientData clientData in
+.AP void *clientData in
Arbitrary one-word value passed to \fIproc\fR, \fInreProc\fR, \fIdeleteProc\fR
and \fIobjProc\fR.
.AP Tcl_CmdDeleteProc *deleteProc in/out
@@ -72,10 +72,10 @@ Pointer to an unshared Tcl_Obj where the result of the evaluation is stored if
the return code is TCL_OK.
.AP Tcl_NRPostProc *postProcPtr in
A function to push.
-.AP ClientData data0 in
-.AP ClientData data1 in
-.AP ClientData data2 in
-.AP ClientData data3 in
+.AP void *data0 in
+.AP void *data1 in
+.AP void *data2 in
+.AP void *data3 in
\fIdata0\fR through \fIdata3\fR are four one-word values that will be passed
to the function designated by \fIpostProcPtr\fR when it is invoked.
.BE
@@ -130,7 +130,7 @@ a message as the interpreter's result.
.CS
typedef int
\fBTcl_NRPostProc\fR(
- \fBClientData\fR \fIdata\fR[],
+ \fBvoid *\fR \fIdata\fR[],
\fBTcl_Interp\fR *\fIinterp\fR,
int \fIresult\fR);
.CE
@@ -146,7 +146,7 @@ stack, to evalute a script:
.CS
int
\fITheCmdOldObjProc\fR(
- ClientData clientData,
+ void *clientData,
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -177,7 +177,7 @@ call \fITheCmdNRObjProc\fR:
.CS
int
\fITheCmdOldObjProc\fR(
- ClientData clientData,
+ void *clientData,
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -190,7 +190,7 @@ int
.CS
int
\fITheCmdNRObjProc\fR
- ClientData clientData,
+ void *clientData,
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -211,7 +211,7 @@ int
.CS
int
\fITheCmdNRPostProc\fR(
- ClientData data[],
+ void *data[],
Tcl_Interp *interp,
int result)
{
diff --git a/doc/Namespace.3 b/doc/Namespace.3
index a037442..c69d547 100644
--- a/doc/Namespace.3
+++ b/doc/Namespace.3
@@ -57,7 +57,7 @@ The interpreter in which the namespace exists and where name lookups
are performed. Also where error result messages are written.
.AP "const char" *name in
The name of the namespace or command to be created or accessed.
-.AP ClientData clientData in
+.AP void *clientData in
A context pointer by the creator of the namespace. Not interpreted by
Tcl at all.
.AP Tcl_NamespaceDeleteProc *deleteProc in
@@ -117,7 +117,7 @@ the global namespace.)
.PP
.CS
typedef void \fBTcl_NamespaceDeleteProc\fR(
- ClientData \fIclientData\fR);
+ void *\fIclientData\fR);
.CE
.PP
\fBTcl_DeleteNamespace\fR deletes a namespace, calling the
diff --git a/doc/Notifier.3 b/doc/Notifier.3
index ec9f910..1899032 100644
--- a/doc/Notifier.3
+++ b/doc/Notifier.3
@@ -38,7 +38,7 @@ Tcl_ThreadId
void
\fBTcl_DeleteEvents\fR(\fIdeleteProc, clientData\fR)
.sp
-ClientData
+void *
\fBTcl_InitNotifier\fR()
.sp
void
@@ -78,7 +78,7 @@ Procedure to invoke to prepare for event wait in \fBTcl_DoOneEvent\fR.
Procedure for \fBTcl_DoOneEvent\fR to invoke after waiting for
events. Checks to see if any events have occurred and, if so,
queues them.
-.AP ClientData clientData in
+.AP void *clientData in
Arbitrary one-word value to pass to \fIsetupProc\fR, \fIcheckProc\fR, or
\fIdeleteProc\fR.
.AP "const Tcl_Time" *timePtr in
@@ -89,7 +89,7 @@ is NULL, it means there is no maximum wait time: wait forever if
necessary.
.AP Tcl_Event *evPtr in
An event to add to the event queue. The storage for the event must
-have been allocated by the caller using \fBTcl_Alloc\fR or \fBckalloc\fR.
+have been allocated by the caller using \fBTcl_Alloc\fR.
.AP Tcl_QueuePosition position in
Where to add the new event in the queue: \fBTCL_QUEUE_TAIL\fR,
\fBTCL_QUEUE_HEAD\fR, or \fBTCL_QUEUE_MARK\fR.
@@ -225,7 +225,7 @@ the event source.
.PP
.CS
typedef void \fBTcl_EventSetupProc\fR(
- ClientData \fIclientData\fR,
+ void *\fIclientData\fR,
int \fIflags\fR);
.CE
.PP
@@ -303,7 +303,7 @@ following prototype:
.PP
.CS
typedef void \fBTcl_EventCheckProc\fR(
- ClientData \fIclientData\fR,
+ void *\fIclientData\fR,
int \fIflags\fR);
.CE
.PP
@@ -394,7 +394,7 @@ of window events.
When \fIproc\fR returns 1, \fBTcl_ServiceEvent\fR will remove the
event from the event queue and free its storage.
Note that the storage for an event must be allocated by
-the event source (using \fBTcl_Alloc\fR or the Tcl macro \fBckalloc\fR)
+the event source (using \fBTcl_Alloc\fR)
before calling \fBTcl_QueueEvent\fR, but it
will be freed by \fBTcl_ServiceEvent\fR, not by the event source.
.PP
@@ -419,7 +419,7 @@ queue. \fIProc\fR should match the following prototype:
.CS
typedef int \fBTcl_EventDeleteProc\fR(
Tcl_Event *\fIevPtr\fR,
- ClientData \fIclientData\fR);
+ void *\fIclientData\fR);
.CE
.PP
The \fIclientData\fR argument will be the same as the \fIclientData\fR
diff --git a/doc/Object.3 b/doc/Object.3
index eadd041..117e631 100644
--- a/doc/Object.3
+++ b/doc/Object.3
@@ -111,9 +111,9 @@ which is defined as follows.
.PP
.CS
typedef struct Tcl_Obj {
- int \fIrefCount\fR;
+ size_t \fIrefCount\fR;
char *\fIbytes\fR;
- int \fIlength\fR;
+ size_t \fIlength\fR;
const Tcl_ObjType *\fItypePtr\fR;
union {
long \fIlongValue\fR;
diff --git a/doc/ObjectType.3 b/doc/ObjectType.3
index bf414ac..36b45e1 100644
--- a/doc/ObjectType.3
+++ b/doc/ObjectType.3
@@ -186,8 +186,8 @@ to be treated as conventional null character-terminated C strings.
These restrictions are easily met by using Tcl's internal UTF encoding
for the string representation, same as one would do for other
Tcl routines accepting string values as arguments.
-Storage for the byte array must be allocated in the heap by \fBTcl_Alloc\fR
-or \fBckalloc\fR. Note that \fIupdateStringProc\fRs must allocate
+Storage for the byte array must be allocated in the heap by \fBTcl_Alloc\fR.
+Note that \fIupdateStringProc\fRs must allocate
enough storage for the string's bytes and the terminating null byte.
.PP
The \fIupdateStringProc\fR for Tcl's built-in double type, for example,
diff --git a/doc/OpenFileChnl.3 b/doc/OpenFileChnl.3
index 582ff4b..eb307e6 100644
--- a/doc/OpenFileChnl.3
+++ b/doc/OpenFileChnl.3
@@ -53,28 +53,28 @@ int
int
\fBTcl_Read\fR(\fIchannel, readBuf, bytesToRead\fR)
.sp
-int
+size_t
\fBTcl_GetsObj\fR(\fIchannel, lineObjPtr\fR)
.sp
-int
+size_t
\fBTcl_Gets\fR(\fIchannel, lineRead\fR)
.sp
-int
+size_t
\fBTcl_Ungets\fR(\fIchannel, input, inputLen, addAtEnd\fR)
.sp
-int
+size_t
\fBTcl_WriteObj\fR(\fIchannel, writeObjPtr\fR)
.sp
-int
+size_t
\fBTcl_WriteChars\fR(\fIchannel, charBuf, bytesToWrite\fR)
.sp
-int
+size_t
\fBTcl_Write\fR(\fIchannel, byteBuf, bytesToWrite\fR)
.sp
-int
+size_t
\fBTcl_ReadRaw\fR(\fIchannel, readBuf, bytesToRead\fR)
.sp
-int
+size_t
\fBTcl_WriteRaw\fR(\fIchannel, byteBuf, bytesToWrite\fR)
.sp
int
@@ -134,7 +134,7 @@ input of the invoking process; likewise for \fBTCL_STDOUT\fR and
redirect stdio handles to override the stdio handles for which
\fBTCL_STDIN\fR, \fBTCL_STDOUT\fR and \fBTCL_STDERR\fR have been set. If it
is set, then such redirections cause an error.
-.AP ClientData handle in
+.AP void *handle in
Operating system specific handle for I/O to a file. For Unix this is a
file descriptor, for Windows it is a HANDLE.
.AP int readOrWrite in
@@ -154,7 +154,7 @@ from a procedure such as \fBTcl_OpenFileChannel\fR.
.AP Tcl_Obj *readObjPtr in/out
A pointer to a Tcl value in which to store the characters read from the
channel.
-.AP int charsToRead in
+.AP size_t charsToRead in
The number of characters to read from the channel. If the channel's encoding
is \fBbinary\fR, this is equivalent to the number of bytes to read from the
channel.
@@ -163,7 +163,7 @@ If non-zero, data read from the channel will be appended to the value.
Otherwise, the data will replace the existing contents of the value.
.AP char *readBuf out
A buffer in which to store the bytes read from the channel.
-.AP int bytesToRead in
+.AP size_t bytesToRead in
The number of bytes to read from the channel. The buffer \fIreadBuf\fR must
be large enough to hold this many bytes.
.AP Tcl_Obj *lineObjPtr in/out
@@ -176,7 +176,7 @@ channel. Must have been initialized by the caller. The line read will be
appended to any data already in the dynamic string.
.AP "const char" *input in
The input to add to a channel buffer.
-.AP int inputLen in
+.AP size_t inputLen in
Length of the input
.AP int addAtEnd in
Flag indicating whether the input should be added to the end or
@@ -187,7 +187,7 @@ A pointer to a Tcl value whose contents will be output to the channel.
A buffer containing the characters to output to the channel.
.AP "const char" *byteBuf in
A buffer containing the bytes to output to the channel.
-.AP int bytesToWrite in
+.AP size_t bytesToWrite in
The number of bytes to consume from \fIcharBuf\fR or \fIbyteBuf\fR and
output to the channel.
.AP Tcl_WideInt offset in
diff --git a/doc/OpenTcp.3 b/doc/OpenTcp.3
index 5b941dc..fbaa04f 100644
--- a/doc/OpenTcp.3
+++ b/doc/OpenTcp.3
@@ -50,12 +50,12 @@ If nonzero, the client socket is connected asynchronously to the server.
.AP "unsigned int" flags in
ORed combination of \fBTCL_TCPSERVER\fR flags that specify additional
informations about the socket being created.
-.AP ClientData sock in
+.AP void *sock in
Platform-specific handle for client TCP socket.
.AP Tcl_TcpAcceptProc *proc in
Pointer to a procedure to invoke each time a new connection is
accepted via the socket.
-.AP ClientData clientData in
+.AP void *clientData in
Arbitrary one-word value to pass to \fIproc\fR.
.BE
.SH DESCRIPTION
@@ -127,7 +127,7 @@ the channel. \fIProc\fR must match the following prototype:
.PP
.CS
typedef void \fBTcl_TcpAcceptProc\fR(
- ClientData \fIclientData\fR,
+ void *\fIclientData\fR,
Tcl_Channel \fIchannel\fR,
char *\fIhostName\fR,
int \fIport\fR);
diff --git a/doc/Panic.3 b/doc/Panic.3
index ba39ddf..d0c2a6d 100644
--- a/doc/Panic.3
+++ b/doc/Panic.3
@@ -7,7 +7,7 @@
.BS
'\" Note: do not modify the .SH NAME line immediately below!
.SH NAME
-Tcl_Panic, Tcl_PanicVA, Tcl_SetPanicProc, Tcl_ConsolePanic \- report fatal error and abort
+Tcl_Panic, Tcl_SetPanicProc, Tcl_ConsolePanic \- report fatal error and abort
.SH SYNOPSIS
.nf
\fB#include <tcl.h>\fR
@@ -16,9 +16,6 @@ void
\fBTcl_Panic\fR(\fIformat\fR, \fIarg\fR, \fIarg\fR, \fI...\fR)
.sp
void
-\fBTcl_PanicVA\fR(\fIformat\fR, \fIargList\fR)
-.sp
-void
\fBTcl_SetPanicProc\fR(\fIpanicProc\fR)
.sp
void
@@ -92,12 +89,7 @@ by any extension or application that wishes to abort the process and
have a panic message displayed the same way that panic messages from Tcl
will be displayed.
.PP
-\fBTcl_PanicVA\fR is the same as \fBTcl_Panic\fR except that instead of
-taking a variable number of arguments it takes an argument list. This
-function is deprecated and will be removed in Tcl 9.0.
-.PP
-This function can not be used in stub-enabled extensions. Its symbol
-entry in the stub table is deprecated and it will be removed in Tcl 9.0.
+This function can not be used in stub-enabled extensions.
.SH "SEE ALSO"
abort(3), printf(3), exec(n), format(n)
.SH KEYWORDS
diff --git a/doc/ParseArgs.3 b/doc/ParseArgs.3
index c254148..af58cbf 100644
--- a/doc/ParseArgs.3
+++ b/doc/ParseArgs.3
@@ -31,7 +31,7 @@ The array of arguments to be parsed.
Pointer to a variable that will hold the array of unprocessed arguments.
Should be NULL if no return of unprocessed arguments is required. If
\fIobjcPtr\fR is updated to a non-zero value, the array returned through this
-must be deallocated using \fBckfree\fR.
+must be deallocated using \fBTcl_Free\fR.
.BE
.SH DESCRIPTION
.PP
@@ -84,7 +84,7 @@ typedef struct {
void *\fIsrcPtr\fR;
void *\fIdstPtr\fR;
const char *\fIhelpStr\fR;
- ClientData \fIclientData\fR;
+ void *\fIclientData\fR;
} \fBTcl_ArgvInfo\fR;
.CE
.PP
@@ -127,7 +127,7 @@ have the following signature:
.PP
.CS
typedef int (\fBTcl_ArgvFuncProc\fR)(
- ClientData \fIclientData\fR,
+ void *\fIclientData\fR,
Tcl_Obj *\fIobjPtr\fR,
void *\fIdstPtr\fR);
.CE
@@ -149,7 +149,7 @@ function will have the following signature:
.PP
.CS
typedef int (\fBTcl_ArgvGenFuncProc\fR)(
- ClientData \fIclientData\fR,
+ void *\fIclientData\fR,
Tcl_Interp *\fIinterp\fR,
int \fIobjc\fR,
Tcl_Obj *const *\fIobjv\fR,
diff --git a/doc/ParseCmd.3 b/doc/ParseCmd.3
index 667d697..41f43cb 100644
--- a/doc/ParseCmd.3
+++ b/doc/ParseCmd.3
@@ -8,7 +8,7 @@
.so man.macros
.BS
.SH NAME
-Tcl_ParseCommand, Tcl_ParseExpr, Tcl_ParseBraces, Tcl_ParseQuotedString, Tcl_ParseVarName, Tcl_ParseVar, Tcl_FreeParse, Tcl_EvalTokens, Tcl_EvalTokensStandard \- parse Tcl scripts and expressions
+Tcl_ParseCommand, Tcl_ParseExpr, Tcl_ParseBraces, Tcl_ParseQuotedString, Tcl_ParseVarName, Tcl_ParseVar, Tcl_FreeParse, Tcl_EvalTokensStandard \- parse Tcl scripts and expressions
.SH SYNOPSIS
.nf
\fB#include <tcl.h>\fR
@@ -33,20 +33,16 @@ const char *
.sp
\fBTcl_FreeParse\fR(\fIusedParsePtr\fR)
.sp
-Tcl_Obj *
-\fBTcl_EvalTokens\fR(\fIinterp, tokenPtr, numTokens\fR)
-.sp
int
\fBTcl_EvalTokensStandard\fR(\fIinterp, tokenPtr, numTokens\fR)
.SH ARGUMENTS
.AS Tcl_Interp *usedParsePtr out
.AP Tcl_Interp *interp out
-For procedures other than \fBTcl_FreeParse\fR, \fBTcl_EvalTokens\fR
-and \fBTcl_EvalTokensStandard\fR, used only for error reporting;
+For procedures other than \fBTcl_FreeParse\fR and
+\fBTcl_EvalTokensStandard\fR, used only for error reporting;
if NULL, then no error messages are left after errors.
-For \fBTcl_EvalTokens\fR and \fBTcl_EvalTokensStandard\fR,
-determines the context for evaluating the
-script and also is used for error reporting; must not be NULL.
+For \fBTcl_EvalTokensStandard\fR, determines the context for evaluating
+the script and also is used for error reporting; must not be NULL.
.AP "const char" *start in
Pointer to first character in string to parse.
.AP int numBytes in
@@ -191,16 +187,6 @@ code with one of the values \fBTCL_OK\fR, \fBTCL_ERROR\fR,
some other integer value originating in an extension.
In addition, a result value or error message is left in \fIinterp\fR's
result; it can be retrieved using \fBTcl_GetObjResult\fR.
-.PP
-\fBTcl_EvalTokens\fR differs from \fBTcl_EvalTokensStandard\fR only in
-the return convention used: it returns the result in a new Tcl_Obj.
-The reference count of the value returned as result has been
-incremented, so the caller must
-invoke \fBTcl_DecrRefCount\fR when it is finished with the value.
-If an error or other exception occurs while evaluating the tokens
-(such as a reference to a non-existent variable) then the return value
-is NULL and an error message is left in \fIinterp\fR's result. The use
-of \fBTcl_EvalTokens\fR is deprecated.
.SH "TCL_PARSE STRUCTURE"
.PP
\fBTcl_ParseCommand\fR, \fBTcl_ParseExpr\fR, \fBTcl_ParseBraces\fR,
@@ -222,8 +208,8 @@ typedef struct Tcl_Parse {
typedef struct Tcl_Token {
int \fItype\fR;
const char *\fIstart\fR;
- int \fIsize\fR;
- int \fInumComponents\fR;
+ size_t \fIsize\fR;
+ size_t \fInumComponents\fR;
} \fBTcl_Token\fR;
.CE
.PP
diff --git a/doc/Preserve.3 b/doc/Preserve.3
index c8f34a2..eb50a5f 100644
--- a/doc/Preserve.3
+++ b/doc/Preserve.3
@@ -21,7 +21,7 @@ Tcl_Preserve, Tcl_Release, Tcl_EventuallyFree \- avoid freeing storage while it
\fBTcl_EventuallyFree\fR(\fIclientData, freeProc\fR)
.SH ARGUMENTS
.AS Tcl_FreeProc clientData
-.AP ClientData clientData in
+.AP void *clientData in
Token describing structure to be freed or reallocated. Usually a pointer
to memory for structure.
.AP Tcl_FreeProc *freeProc in
@@ -91,7 +91,7 @@ reasons, but the value is the same.
.PP
When the \fIclientData\fR argument to \fBTcl_EventuallyFree\fR
refers to storage allocated and returned by a prior call to
-\fBTcl_Alloc\fR, \fBckalloc\fR, or another function of the Tcl library,
+\fBTcl_Alloc\fR or another function of the Tcl library,
then the \fIfreeProc\fR argument should be given the special value of
\fBTCL_DYNAMIC\fR.
.PP
diff --git a/doc/PrintDbl.3 b/doc/PrintDbl.3
index 896b6eb..42b258c 100644
--- a/doc/PrintDbl.3
+++ b/doc/PrintDbl.3
@@ -18,10 +18,7 @@ Tcl_PrintDouble \- Convert floating value to string
.SH ARGUMENTS
.AS Tcl_Interp *interp out
.AP Tcl_Interp *interp in
-Before Tcl 8.0, the \fBtcl_precision\fR variable in this interpreter
-controlled the conversion. As of Tcl 8.0, this argument is ignored and
-the conversion is controlled by the \fBtcl_precision\fR variable
-that is now shared by all interpreters.
+This argument is ignored.
.AP double value in
Floating-point value to be converted.
.AP char *dst out
@@ -41,9 +38,7 @@ so that it does not look like an integer. Where \fB%g\fR would
generate an integer with no decimal point, \fBTcl_PrintDouble\fR adds
.QW .0 .
.PP
-If the \fBtcl_precision\fR value is non-zero, the result will have
-precisely that many digits of significance. If the value is zero
-(the default), the result will have the fewest digits needed to
+The result will have the fewest digits needed to
represent the number in such a way that \fBTcl_NewDoubleObj\fR
will generate the same number when presented with the given string.
IEEE semantics of rounding to even apply to the conversion.
diff --git a/doc/RecEvalObj.3 b/doc/RecEvalObj.3
index f9550a2..1d77c12 100644
--- a/doc/RecEvalObj.3
+++ b/doc/RecEvalObj.3
@@ -31,7 +31,7 @@ the command at global level instead of the current stack level.
.SH DESCRIPTION
.PP
\fBTcl_RecordAndEvalObj\fR is invoked to record a command as an event
-on the history list and then execute it using \fBTcl_EvalObjEx\fR
+on the history list and then execute it using \fBTcl_EvalObjEx\fR.
It returns a completion code such as \fBTCL_OK\fR just like \fBTcl_EvalObjEx\fR,
as well as a result value containing additional information
(a result value or error message)
diff --git a/doc/RegExp.3 b/doc/RegExp.3
index aa757bc..95716e9 100644
--- a/doc/RegExp.3
+++ b/doc/RegExp.3
@@ -64,7 +64,7 @@ identifies the beginning of the larger string.
If it is not the same as \fItext\fR, then no
.QW \fB^\fR
matches will be allowed.
-.AP int index in
+.AP size_t index in
Specifies which range is desired: 0 means the range of the entire
match, 1 or greater means the range that matched a parenthesized
sub-expression.
@@ -80,14 +80,14 @@ OR-ed combination of the compilation flags \fBTCL_REG_ADVANCED\fR,
\fBTCL_REG_QUOTE\fR, \fBTCL_REG_NOCASE\fR, \fBTCL_REG_NEWLINE\fR,
\fBTCL_REG_NLSTOP\fR, \fBTCL_REG_NLANCH\fR, \fBTCL_REG_NOSUB\fR, and
\fBTCL_REG_CANMATCH\fR. See below for more information.
-.AP int offset in
+.AP size_t offset in
The character offset into the text where matching should begin.
The value of the offset has no impact on \fB^\fR matches. This
behavior is controlled by \fIeflags\fR.
-.AP int nmatches in
+.AP size_t nmatches in
The number of matching subexpressions that should be remembered for
later use. If this value is 0, then no subexpression match
-information will be computed. If the value is \-1, then
+information will be computed. If the value is TCL_INDEX_NONE, then
all of the matching subexpressions will be remembered. Any other
value will be taken as the maximum number of subexpressions to
remember.
@@ -337,9 +337,9 @@ defined as follows:
.PP
.CS
typedef struct Tcl_RegExpInfo {
- int \fInsubs\fR;
+ size_t \fInsubs\fR;
Tcl_RegExpIndices *\fImatches\fR;
- long \fIextendStart\fR;
+ size_t \fIextendStart\fR;
} \fBTcl_RegExpInfo\fR;
.CE
.PP
@@ -355,8 +355,8 @@ follows:
.PP
.CS
typedef struct Tcl_RegExpIndices {
- long \fIstart\fR;
- long \fIend\fR;
+ size_t \fIstart\fR;
+ size_t \fIend\fR;
} \fBTcl_RegExpIndices\fR;
.CE
.PP
diff --git a/doc/SetRecLmt.3 b/doc/SetRecLmt.3
index ec55794..41c2a0a 100644
--- a/doc/SetRecLmt.3
+++ b/doc/SetRecLmt.3
@@ -29,7 +29,7 @@ New limit for nested calls to \fBTcl_Eval\fR for \fIinterp\fR.
.PP
At any given time Tcl enforces a limit on the number of recursive
calls that may be active for \fBTcl_Eval\fR and related procedures
-such as \fBTcl_GlobalEval\fR.
+such as \fBTcl_EvalEx\fR.
Any call to \fBTcl_Eval\fR that exceeds this depth is aborted with
an error.
By default the recursion limit is 1000.
diff --git a/doc/SetResult.3 b/doc/SetResult.3
index e5b81d7..81f0264 100644
--- a/doc/SetResult.3
+++ b/doc/SetResult.3
@@ -9,7 +9,7 @@
.so man.macros
.BS
.SH NAME
-Tcl_SetObjResult, Tcl_GetObjResult, Tcl_SetResult, Tcl_GetStringResult, Tcl_AppendResult, Tcl_AppendResultVA, Tcl_AppendElement, Tcl_ResetResult, Tcl_TransferResult, Tcl_FreeResult \- manipulate Tcl result
+Tcl_SetObjResult, Tcl_GetObjResult, Tcl_SetResult, Tcl_GetStringResult, Tcl_AppendResult, Tcl_AppendElement, Tcl_ResetResult, Tcl_TransferResult, Tcl_FreeResult \- manipulate Tcl result
.SH SYNOPSIS
.nf
\fB#include <tcl.h>\fR
@@ -26,8 +26,6 @@ const char *
.sp
\fBTcl_AppendResult\fR(\fIinterp, result, result, ... , \fB(char *) NULL\fR)
.sp
-\fBTcl_AppendResultVA\fR(\fIinterp, argList\fR)
-.sp
\fBTcl_ResetResult\fR(\fIinterp\fR)
.sp
.VS 8.6
@@ -152,9 +150,6 @@ extensions.
Any number of \fIresult\fR arguments may be passed in a single
call; the last argument in the list must be a NULL pointer.
.PP
-\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
@@ -197,19 +192,6 @@ It also sets \fIinterp->freeProc\fR to zero, but does not
change \fIinterp->result\fR or clear error state.
\fBTcl_FreeResult\fR is most commonly used when a procedure
is about to replace one result value with another.
-.SS "DIRECT ACCESS TO INTERP->RESULT"
-.PP
-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
-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
diff --git a/doc/SplitList.3 b/doc/SplitList.3
index d19ca14..4b0eee6 100644
--- a/doc/SplitList.3
+++ b/doc/SplitList.3
@@ -20,16 +20,16 @@ int
char *
\fBTcl_Merge\fR(\fIargc, argv\fR)
.sp
-int
+size_t
\fBTcl_ScanElement\fR(\fIsrc, flagsPtr\fR)
.sp
-int
+size_t
\fBTcl_ScanCountedElement\fR(\fIsrc, length, flagsPtr\fR)
.sp
-int
+size_t
\fBTcl_ConvertElement\fR(\fIsrc, dst, flags\fR)
.sp
-int
+size_t
\fBTcl_ConvertCountedElement\fR(\fIsrc, length, dst, flags\fR)
.SH ARGUMENTS
.AS "const char *const" ***argvPtr out
@@ -55,7 +55,7 @@ String that is to become an element of a list.
.AP int *flagsPtr in
Pointer to word to fill in with information about \fIsrc\fR.
The value of *\fIflagsPtr\fR must be passed to \fBTcl_ConvertElement\fR.
-.AP int length in
+.AP size_t length in
Number of bytes in string \fIsrc\fR.
.AP char *dst in
Place to copy converted list element. Must contain enough characters
diff --git a/doc/StaticPkg.3 b/doc/StaticPkg.3
index 8d04cd1..6e7e94a 100644
--- a/doc/StaticPkg.3
+++ b/doc/StaticPkg.3
@@ -65,8 +65,7 @@ error message. The result or error from the initialization procedure will
be returned as the result of the \fBload\fR command that caused the
initialization procedure to be invoked.
.PP
-This function can not be used in stub-enabled extensions. Its symbol
-entry in the stub table is deprecated and it will be removed in Tcl 9.0.
+This function can not be used in stub-enabled extensions.
.SH KEYWORDS
initialization procedure, package, static linking
.SH "SEE ALSO"
diff --git a/doc/StringObj.3 b/doc/StringObj.3
index e011c27..56ed654 100644
--- a/doc/StringObj.3
+++ b/doc/StringObj.3
@@ -8,7 +8,7 @@
.so man.macros
.BS
.SH NAME
-Tcl_NewStringObj, Tcl_NewUnicodeObj, Tcl_SetStringObj, Tcl_SetUnicodeObj, Tcl_GetStringFromObj, Tcl_GetString, Tcl_GetUnicodeFromObj, Tcl_GetUnicode, Tcl_GetUniChar, Tcl_GetCharLength, Tcl_GetRange, Tcl_AppendToObj, Tcl_AppendUnicodeToObj, Tcl_AppendObjToObj, Tcl_AppendStringsToObj, Tcl_AppendStringsToObjVA, Tcl_AppendLimitedToObj, Tcl_Format, Tcl_AppendFormatToObj, Tcl_ObjPrintf, Tcl_AppendPrintfToObj, Tcl_SetObjLength, Tcl_AttemptSetObjLength, Tcl_ConcatObj \- manipulate Tcl values as strings
+Tcl_NewStringObj, Tcl_NewUnicodeObj, Tcl_SetStringObj, Tcl_SetUnicodeObj, Tcl_GetStringFromObj, Tcl_GetString, Tcl_GetUnicodeFromObj, Tcl_GetUnicode, Tcl_GetUniChar, Tcl_GetCharLength, Tcl_GetRange, Tcl_AppendToObj, Tcl_AppendUnicodeToObj, Tcl_AppendObjToObj, Tcl_AppendStringsToObj, Tcl_AppendLimitedToObj, Tcl_Format, Tcl_AppendFormatToObj, Tcl_ObjPrintf, Tcl_AppendPrintfToObj, Tcl_SetObjLength, Tcl_AttemptSetObjLength, Tcl_ConcatObj \- manipulate Tcl values as strings
.SH SYNOPSIS
.nf
\fB#include <tcl.h>\fR
@@ -59,9 +59,6 @@ void
\fBTcl_AppendStringsToObj\fR(\fIobjPtr, string, string, ... \fB(char *) NULL\fR)
.sp
void
-\fBTcl_AppendStringsToObjVA\fR(\fIobjPtr, argList\fR)
-.sp
-void
\fBTcl_AppendLimitedToObj\fR(\fIobjPtr, bytes, length, limit, ellipsis\fR)
.sp
Tcl_Obj *
@@ -90,29 +87,29 @@ Tcl_Obj *
Points to the first byte of an array of UTF-8-encoded bytes
used to set or append to a string value.
This byte array may contain embedded null characters
-unless \fInumChars\fR is negative. (Applications needing null bytes
+unless \fInumChars\fR is TCL_AUTO_LENGTH. (Applications needing null bytes
should represent them as the two-byte sequence \fI\e700\e600\fR, use
\fBTcl_ExternalToUtf\fR to convert, or \fBTcl_NewByteArrayObj\fR if
the string is a collection of uninterpreted bytes.)
-.AP int length in
+.AP size_t length in
The number of bytes to copy from \fIbytes\fR when
initializing, setting, or appending to a string value.
-If negative, all bytes up to the first null are used.
+If TCL_AUTO_LENGTH, all bytes up to the first null are used.
.AP "const Tcl_UniChar" *unicode in
Points to the first byte of an array of Unicode characters
used to set or append to a string value.
This byte array may contain embedded null characters
unless \fInumChars\fR is negative.
-.AP int numChars in
+.AP size_t numChars in
The number of Unicode characters to copy from \fIunicode\fR when
initializing, setting, or appending to a string value.
-If negative, all characters up to the first null character are used.
-.AP int index in
+If TCL_AUTO_LENGTH, all characters up to the first null character are used.
+.AP size_t index in
The index of the Unicode character to return.
-.AP int first in
+.AP size_t first in
The index of the first Unicode character in the Unicode range to be
returned as a new value.
-.AP int last in
+.AP size_t last in
The index of the last Unicode character in the Unicode range to be
returned as a new value.
.AP Tcl_Obj *objPtr in/out
@@ -127,7 +124,7 @@ Null-terminated string value to append to \fIobjPtr\fR.
.AP va_list argList in
An argument list which must have been initialized using
\fBva_start\fR, and cleared using \fBva_end\fR.
-.AP int limit in
+.AP size_t limit in
Maximum number of bytes to be appended.
.AP "const char" *ellipsis in
Suffix to append when the limit leads to string truncation.
@@ -140,7 +137,7 @@ Format control string including % conversion specifiers.
The number of elements to format or concatenate.
.AP Tcl_Obj *objv[] in
The array of values to format or concatenate.
-.AP int newLength in
+.AP size_t newLength in
New length for the string value of \fIobjPtr\fR, not including the
final null character.
.BE
@@ -247,10 +244,6 @@ values may contain internal null characters). Any number of
\fIstring\fR arguments may be provided, but the last argument
must be a NULL pointer to indicate the end of the list.
.PP
-\fBTcl_AppendStringsToObjVA\fR is the same as \fBTcl_AppendStringsToObj\fR
-except that instead of taking a variable number of arguments it takes an
-argument list.
-.PP
\fBTcl_AppendLimitedToObj\fR is similar to \fBTcl_AppendToObj\fR
except that it imposes a limit on how many bytes are appended.
This can be handy when the string to be appended might be
diff --git a/doc/TCL_MEM_DEBUG.3 b/doc/TCL_MEM_DEBUG.3
index 3a014d4..38489a3 100644
--- a/doc/TCL_MEM_DEBUG.3
+++ b/doc/TCL_MEM_DEBUG.3
@@ -34,7 +34,7 @@ and the Tcl \fBmemory\fR command can be used to validate and examine
memory usage.
.SH "GUARD ZONES"
.PP
-When memory debugging is enabled, whenever a call to \fBckalloc\fR is
+When memory debugging is enabled, whenever a call to \fBTcl_Alloc\fR is
made, slightly more memory than requested is allocated so the memory
debugging code can keep track of the allocated memory, and eight-byte
.QW "guard zones"
@@ -44,7 +44,7 @@ C #define \fBLOW_GUARD_SIZE\fR and #define \fBHIGH_GUARD_SIZE\fR
in the file \fIgeneric/tclCkalloc.c\fR \(em it can
be extended if you suspect large overwrite problems, at some cost in
performance.) A known pattern is written into the guard zones and, on
-a call to \fBckfree\fR, the guard zones of the space being freed are
+a call to \fBTcl_Free\fR, the guard zones of the space being freed are
checked to see if either zone has been modified in any way. If one
has been, the guard bytes and their new contents are identified, and a
.QW "low guard failed"
@@ -53,7 +53,7 @@ or
message is issued. The
.QW "guard failed"
message includes the address of the memory packet and
-the file name and line number of the code that called \fBckfree\fR.
+the file name and line number of the code that called \fBTcl_Free\fR.
This allows you to detect the common sorts of one-off problems, where
not enough space was allocated to contain the data written, for
example.
@@ -66,15 +66,15 @@ suspect (or know) that corruption is occurring before the Tcl
interpreter comes up far enough for you to issue commands, you can set
\fBMEM_VALIDATE\fR define, recompile tclCkalloc.c and rebuild Tcl.
This will enable memory validation from the first call to
-\fBckalloc\fR, again, at a large performance impact.
+\fBTcl_Alloc\fR, again, at a large performance impact.
.PP
If you are desperate and validating memory on every call to
-\fBckalloc\fR and \fBckfree\fR is not enough, you can explicitly call
+\fBTcl_Alloc\fR and \fBTcl_Free\fR is not enough, you can explicitly call
\fBTcl_ValidateAllMemory\fR directly at any point. It takes a \fIchar
*\fR and an \fIint\fR which are normally the filename and line number
of the caller, but they can actually be anything you want. Remember
to remove the calls after you find the problem.
.SH "SEE ALSO"
-ckalloc, memory, Tcl_ValidateAllMemory, Tcl_DumpActiveMemory
+Tcl_Alloc, memory, Tcl_ValidateAllMemory, Tcl_DumpActiveMemory
.SH KEYWORDS
memory, debug
diff --git a/doc/TclZlib.3 b/doc/TclZlib.3
index 4a5df89..4093cfc 100644
--- a/doc/TclZlib.3
+++ b/doc/TclZlib.3
@@ -88,7 +88,7 @@ The initial value for the checksum algorithm.
.AP "unsigned char" *bytes in
An array of bytes to run the checksum algorithm over, or NULL to get the
recommended initial value for the checksum algorithm.
-.AP int length in
+.AP size_t length in
The number of bytes in the array.
.AP int mode in
What mode to operate the stream in. Should be either
@@ -107,9 +107,9 @@ if the currently compressed data must be made available for access using
into a state where the decompressor can recover from on corruption, or
\fBTCL_ZLIB_FINALIZE\fR to ensure that the stream is finished and that any
trailer demanded by the format is written.
-.AP int count in
-The maximum number of bytes to get from the stream, or -1 to get all remaining
-bytes from the stream's buffers.
+.AP size_t count in
+The maximum number of bytes to get from the stream, or TCL_AUTO_LENGTH to get
+all remaining bytes from the stream's buffers.
.AP Tcl_Obj *compDict in
A byte array value that is the compression dictionary to use with the stream.
Note that this is \fInot a Tcl dictionary\fR, and it is recommended that this
diff --git a/doc/Thread.3 b/doc/Thread.3
index 2005c93..51df5bb 100644
--- a/doc/Thread.3
+++ b/doc/Thread.3
@@ -67,7 +67,7 @@ Id of the thread waited upon.
.AP Tcl_ThreadCreateProc *proc in
This procedure will act as the \fBmain()\fR of the newly created
thread. The specified \fIclientData\fR will be its sole argument.
-.AP ClientData clientData in
+.AP void *clientData in
Arbitrary information. Passed as sole argument to the \fIproc\fR.
.AP int stackSize in
The size of the stack given to the new thread.
@@ -208,7 +208,7 @@ value and then finishes.
.CS
static \fBTcl_ThreadCreateType\fR
MyThreadImplFunc(
- ClientData clientData)
+ void *clientData)
{
int i, limit = (int) clientData;
for (i=0 ; i<limit ; i++) {
@@ -223,7 +223,7 @@ would do this:
.PP
.CS
int limit = 1000000000;
-ClientData limitData = (void*)((intptr_t) limit);
+void *limitData = (void*)((intptr_t) limit);
Tcl_ThreadId id; \fI/* holds identity of thread created */\fR
int result;
diff --git a/doc/TraceCmd.3 b/doc/TraceCmd.3
index 99914a6..8ae946e 100644
--- a/doc/TraceCmd.3
+++ b/doc/TraceCmd.3
@@ -13,7 +13,7 @@ Tcl_CommandTraceInfo, Tcl_TraceCommand, Tcl_UntraceCommand \- monitor renames an
.nf
\fB#include <tcl.h>\fR
.sp
-ClientData
+void *
\fBTcl_CommandTraceInfo(\fIinterp, cmdName, flags, proc, prevClientData\fB)\fR
.sp
int
@@ -32,9 +32,9 @@ OR'ed collection of the values \fBTCL_TRACE_RENAME\fR and
\fBTCL_TRACE_DELETE\fR.
.AP Tcl_CommandTraceProc *proc in
Procedure to call when specified operations occur to \fIcmdName\fR.
-.AP ClientData clientData in
+.AP void *clientData in
Arbitrary argument to pass to \fIproc\fR.
-.AP ClientData prevClientData in
+.AP void *prevClientData in
If non-NULL, gives last value returned by \fBTcl_CommandTraceInfo\fR,
so this call will return information about next trace. If NULL, this
call will return information about first trace.
@@ -65,7 +65,7 @@ match the type \fBTcl_CommandTraceProc\fR:
.PP
.CS
typedef void \fBTcl_CommandTraceProc\fR(
- ClientData \fIclientData\fR,
+ void *\fIclientData\fR,
Tcl_Interp *\fIinterp\fR,
const char *\fIoldName\fR,
const char *\fInewName\fR,
@@ -74,7 +74,7 @@ typedef void \fBTcl_CommandTraceProc\fR(
.PP
The \fIclientData\fR and \fIinterp\fR parameters will have the same
values as those passed to \fBTcl_TraceCommand\fR when the trace was
-created. \fIClientData\fR typically points to an application-specific
+created. \fIclientData\fR typically points to an application-specific
data structure that describes what to do when \fIproc\fR is invoked.
\fIOldName\fR gives the name of the command being renamed, and
\fInewName\fR gives the name that the command is being renamed to (or
diff --git a/doc/TraceVar.3 b/doc/TraceVar.3
index c3edfa4..8dc221a 100644
--- a/doc/TraceVar.3
+++ b/doc/TraceVar.3
@@ -24,13 +24,13 @@ int
.sp
\fBTcl_UntraceVar2(\fIinterp, name1, name2, flags, proc, clientData\fB)\fR
.sp
-ClientData
+void *
\fBTcl_VarTraceInfo(\fIinterp, varName, flags, proc, prevClientData\fB)\fR
.sp
-ClientData
+void *
\fBTcl_VarTraceInfo2(\fIinterp, name1, name2, flags, proc, prevClientData\fB)\fR
.SH ARGUMENTS
-.AS Tcl_VarTraceProc prevClientData
+.AS void *prevClientData
.AP Tcl_Interp *interp in
Interpreter containing variable.
.AP "const char" *varName in
@@ -46,7 +46,7 @@ Not all flags are used by all
procedures. See below for more information.
.AP Tcl_VarTraceProc *proc in
Procedure to invoke whenever one of the traced operations occurs.
-.AP ClientData clientData in
+.AP void *clientData in
Arbitrary one-word value to pass to \fIproc\fR.
.AP "const char" *name1 in
Name of scalar or array variable (without array index).
@@ -54,7 +54,7 @@ Name of scalar or array variable (without array index).
For a trace on an element of an array, gives the index of the
element. For traces on scalar variables or on whole arrays,
is NULL.
-.AP ClientData prevClientData in
+.AP void *prevClientData in
If non-NULL, gives last value returned by \fBTcl_VarTraceInfo\fR or
\fBTcl_VarTraceInfo2\fR, so this call will return information about
next trace. If NULL, this call will return information about first
@@ -107,7 +107,7 @@ before an array set, but that will trigger write traces.
\fBTCL_TRACE_RESULT_DYNAMIC\fR
The result of invoking the \fIproc\fR is a dynamically allocated
string that will be released by the Tcl library via a call to
-\fBckfree\fR. Must not be specified at the same time as
+\fBTcl_Free\fR. Must not be specified at the same time as
\fBTCL_TRACE_RESULT_OBJECT\fR.
.TP
\fBTCL_TRACE_RESULT_OBJECT\fR
@@ -124,7 +124,7 @@ It should have arguments and result that match the type
.PP
.CS
typedef char *\fBTcl_VarTraceProc\fR(
- ClientData \fIclientData\fR,
+ void *\fIclientData\fR,
Tcl_Interp *\fIinterp\fR,
char *\fIname1\fR,
char *\fIname2\fR,
@@ -134,7 +134,7 @@ typedef char *\fBTcl_VarTraceProc\fR(
The \fIclientData\fR and \fIinterp\fR parameters will
have the same values as those passed to \fBTcl_TraceVar\fR when the
trace was created.
-\fIClientData\fR typically points to an application-specific
+\fIclientData\fR typically points to an application-specific
data structure that describes what to do when \fIproc\fR
is invoked.
\fIName1\fR and \fIname2\fR give the name of the traced variable
@@ -312,7 +312,7 @@ The return value must be a pointer to a static character string
containing an error message,
unless (\fIexactly\fR one of) the \fBTCL_TRACE_RESULT_DYNAMIC\fR and
\fBTCL_TRACE_RESULT_OBJECT\fR flags is set, which specify that the result is
-either a dynamic string (to be released with \fBckfree\fR) or a
+either a dynamic string (to be released with \fBTcl_Free\fR) or a
Tcl_Obj* (cast to char* and to be released with
\fBTcl_DecrRefCount\fR) containing the error message.
If a trace procedure returns an error, no further traces are
diff --git a/doc/Utf.3 b/doc/Utf.3
index da2083f..94f6f4e 100644
--- a/doc/Utf.3
+++ b/doc/Utf.3
@@ -31,19 +31,19 @@ int
\fBTcl_UniCharLen\fR(\fIuniStr\fR)
.sp
int
-\fBTcl_UniCharNcmp\fR(\fIucs, uct, numChars\fR)
+\fBTcl_UniCharNcmp\fR(\fIucs, uct, uniLength\fR)
.sp
int
-\fBTcl_UniCharNcasecmp\fR(\fIucs, uct, numChars\fR)
+\fBTcl_UniCharNcasecmp\fR(\fIucs, uct, uniLength\fR)
.sp
int
\fBTcl_UniCharCaseMatch\fR(\fIuniStr, uniPattern, nocase\fR)
.sp
int
-\fBTcl_UtfNcmp\fR(\fIcs, ct, numChars\fR)
+\fBTcl_UtfNcmp\fR(\fIcs, ct, length\fR)
.sp
int
-\fBTcl_UtfNcasecmp\fR(\fIcs, ct, numChars\fR)
+\fBTcl_UtfNcasecmp\fR(\fIcs, ct, length\fR)
.sp
int
\fBTcl_UtfCharComplete\fR(\fIsrc, length\fR)
@@ -69,7 +69,7 @@ int
const char *
\fBTcl_UtfAtIndex\fR(\fIsrc, index\fR)
.sp
-int
+size_t
\fBTcl_UtfBackslash\fR(\fIsrc, readPtr, dst\fR)
.SH ARGUMENTS
.AS "const Tcl_UniChar" *uniPattern in/out
@@ -94,19 +94,16 @@ A null-terminated Unicode string.
A null-terminated Unicode string.
.AP "const Tcl_UniChar" *uniPattern in
A null-terminated Unicode string.
-.AP int length in
+.AP size_t length in
The length of the UTF-8 string in bytes (not UTF-8 characters). If
-negative, all bytes up to the first null byte are used.
-.AP int uniLength in
-The length of the Unicode string in characters. Must be greater than or
-equal to 0.
+TCL_AUTO_LENGTH, all bytes up to the first null byte are used.
+.AP size_t uniLength in
+The length of the Unicode string in characters.
.AP "Tcl_DString" *dsPtr in/out
A pointer to a previously initialized \fBTcl_DString\fR.
-.AP "unsigned long" numChars in
-The number of characters to compare.
.AP "const char" *start in
Pointer to the beginning of a UTF-8 string.
-.AP int index in
+.AP size_t index in
The index of a character (not byte) in the UTF-8 string.
.AP int *readPtr out
If non-NULL, filled with the number of bytes in the backslash sequence,
@@ -176,7 +173,7 @@ the number of Unicode characters (not bytes) in that string.
\fBTcl_UniCharNcmp\fR and \fBTcl_UniCharNcasecmp\fR correspond to
\fBstrncmp\fR and \fBstrncasecmp\fR, respectively, for Unicode characters.
They accept two null-terminated Unicode strings and the number of characters
-to compare. Both strings are assumed to be at least \fInumChars\fR characters
+to compare. Both strings are assumed to be at least \fIuniLength\fR characters
long. \fBTcl_UniCharNcmp\fR compares the two strings character-by-character
according to the Unicode character ordering. It returns an integer greater
than, equal to, or less than 0 if the first string is greater than, equal
@@ -190,7 +187,7 @@ be case sensitive and returns whether the string matches the pattern.
.PP
\fBTcl_UtfNcmp\fR corresponds to \fBstrncmp\fR for UTF-8 strings. It
accepts two null-terminated UTF-8 strings and the number of characters
-to compare. (Both strings are assumed to be at least \fInumChars\fR
+to compare. (Both strings are assumed to be at least \fIlength\fR
characters long.) \fBTcl_UtfNcmp\fR compares the two strings
character-by-character according to the Unicode character ordering.
It returns an integer greater than, equal to, or less than 0 if the
@@ -242,12 +239,12 @@ return value will be \fIstart\fR.
Pascal Ord() function. It returns the Tcl_UniChar represented at the
specified character (not byte) \fIindex\fR in the UTF-8 string
\fIsrc\fR. The source string must contain at least \fIindex\fR
-characters. Behavior is undefined if a negative \fIindex\fR is given.
+characters.
.PP
\fBTcl_UtfAtIndex\fR returns a pointer to the specified character (not
byte) \fIindex\fR in the UTF-8 string \fIsrc\fR. The source string must
contain at least \fIindex\fR characters. This is equivalent to calling
-\fBTcl_UtfNext\fR \fIindex\fR times. If a negative \fIindex\fR is given,
+\fBTcl_UtfNext\fR \fIindex\fR times. If \fIindex\fR is TCL_INDEX_NONE,
the return pointer points to the first character in the source string.
.PP
\fBTcl_UtfBackslash\fR is a utility procedure used by several of the Tcl
diff --git a/doc/case.n b/doc/case.n
deleted file mode 100644
index c48d634..0000000
--- a/doc/case.n
+++ /dev/null
@@ -1,60 +0,0 @@
-'\"
-'\" Copyright (c) 1993 The Regents of the University of California.
-'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
-'\"
-'\" See the file "license.terms" for information on usage and redistribution
-'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-'\"
-.TH case n 7.0 Tcl "Tcl Built-In Commands"
-.so man.macros
-.BS
-'\" Note: do not modify the .SH NAME line immediately below!
-.SH NAME
-case \- Evaluate one of several scripts, depending on a given value
-.SH SYNOPSIS
-\fBcase\fI string \fR?\fBin\fR? \fIpatList body \fR?\fIpatList body \fR...?
-.sp
-\fBcase\fI string \fR?\fBin\fR? {\fIpatList body \fR?\fIpatList body \fR...?}
-.BE
-
-.SH DESCRIPTION
-.PP
-\fINote: the \fBcase\fI command is obsolete and is supported only
-for backward compatibility. At some point in the future it may be
-removed entirely. You should use the \fBswitch\fI command instead.\fR
-.PP
-The \fBcase\fR command matches \fIstring\fR against each of
-the \fIpatList\fR arguments in order.
-Each \fIpatList\fR argument is a list of one or
-more patterns. If any of these patterns matches \fIstring\fR then
-\fBcase\fR evaluates the following \fIbody\fR argument
-by passing it recursively to the Tcl interpreter and returns the result
-of that evaluation.
-Each \fIpatList\fR argument consists of a single
-pattern or list of patterns. Each pattern may contain any of the wild-cards
-described under \fBstring match\fR. If a \fIpatList\fR
-argument is \fBdefault\fR, the corresponding body will be evaluated
-if no \fIpatList\fR matches \fIstring\fR. If no \fIpatList\fR argument
-matches \fIstring\fR and no default is given, then the \fBcase\fR
-command returns an empty string.
-.PP
-Two syntaxes are provided for the \fIpatList\fR and \fIbody\fR arguments.
-The first uses a separate argument for each of the patterns and commands;
-this form is convenient if substitutions are desired on some of the
-patterns or commands.
-The second form places all of the patterns and commands together into
-a single argument; the argument must have proper list structure, with
-the elements of the list being the patterns and commands.
-The second form makes it easy to construct multi-line case commands,
-since the braces around the whole list make it unnecessary to include a
-backslash at the end of each line.
-Since the \fIpatList\fR arguments are in braces in the second form,
-no command or variable substitutions are performed on them; this makes
-the behavior of the second form different than the first form in some
-cases.
-
-.SH "SEE ALSO"
-switch(n)
-
-.SH KEYWORDS
-case, match, regular expression
diff --git a/doc/define.n b/doc/define.n
index 9046203..4175efc 100644
--- a/doc/define.n
+++ b/doc/define.n
@@ -588,7 +588,7 @@ for reading from slots is via \fBinfo class\fR and \fBinfo object\fR).
.SH EXAMPLES
This example demonstrates how to use both forms of the \fBoo::define\fR and
\fBoo::objdefine\fR commands (they work in the same way), as well as
-illustrating four of the subcommands of them.
+illustrating four of their subcommands.
.PP
.CS
oo::class create c
diff --git a/doc/expr.n b/doc/expr.n
index 04f0cef..3e57935 100644
--- a/doc/expr.n
+++ b/doc/expr.n
@@ -50,9 +50,7 @@ An integer operand may be specified in decimal (the normal case, the optional
first two characters are \fB0d\fR), binary
(the first two characters are \fB0b\fR), octal
(the first two characters are \fB0o\fR), or hexadecimal
-(the first two characters are \fB0x\fR) form. For
-compatibility with older Tcl releases, an operand that begins with \fB0\fR is
-interpreted as an octal integer even if the second character is not \fBo\fR.
+(the first two characters are \fB0x\fR) form.
A floating-point number may be specified in any of several
common decimal formats, and may use the decimal point \fB.\fR,
\fBe\fR or \fBE\fR for scientific notation, and
diff --git a/doc/load.n b/doc/load.n
index b592bb3..03b4f4e 100644
--- a/doc/load.n
+++ b/doc/load.n
@@ -154,7 +154,7 @@ The following is a minimal extension:
.CS
#include <tcl.h>
#include <stdio.h>
-static int fooCmd(ClientData clientData,
+static int fooCmd(void *clientData,
Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) {
printf("called with %d arguments\en", objc);
return TCL_OK;
diff --git a/doc/mathfunc.n b/doc/mathfunc.n
index 375d867..9b14587 100644
--- a/doc/mathfunc.n
+++ b/doc/mathfunc.n
@@ -124,10 +124,7 @@ of which work solely with floating-point numbers unless otherwise noted:
In addition to these predefined functions, applications may
define additional functions by using \fBproc\fR (or any other method,
such as \fBinterp alias\fR or \fBTcl_CreateObjCommand\fR) to define
-new commands in the \fBtcl::mathfunc\fR namespace. In addition, an
-obsolete interface named \fBTcl_CreateMathFunc\fR() is available to
-extensions that are written in C. The latter interface is not recommended
-for new implementations.
+new commands in the \fBtcl::mathfunc\fR namespace.
.SS "DETAILED DEFINITIONS"
.TP
\fBabs \fIarg\fR
diff --git a/doc/memory.n b/doc/memory.n
index c8cdb21..5e1566a 100644
--- a/doc/memory.n
+++ b/doc/memory.n
@@ -25,7 +25,7 @@ Write a list of all currently allocated memory to the specified \fIfile\fR.
.TP
\fBmemory break_on_malloc\fR \fIcount\fR
.
-After the \fIcount\fR allocations have been performed, \fBckalloc\fR
+After the \fIcount\fR allocations have been performed, \fBTcl_Alloc\fR
outputs a message to this effect and that it is now attempting to enter
the C debugger. Tcl will then issue a \fISIGINT\fR signal against itself.
If you are running Tcl under a C debugger, it should then enter the debugger
@@ -35,8 +35,8 @@ command mode.
.
Returns a report containing the total allocations and frees since
Tcl began, the current packets allocated (the current
-number of calls to \fBckalloc\fR not met by a corresponding call
-to \fBckfree\fR), the current bytes allocated, and the maximum number
+number of calls to \fBTcl_Alloc\fR not met by a corresponding call
+to \fBTcl_Free\fR), the current bytes allocated, and the maximum number
of packets and bytes allocated.
.TP
\fBmemory init \fR[\fBon\fR|\fBoff\fR]
@@ -59,34 +59,34 @@ that memory is properly cleaned up during process exit.
.TP
\fBmemory tag\fR \fIstring\fR
.
-Each packet of memory allocated by \fBckalloc\fR can have associated
+Each packet of memory allocated by \fBTcl_Alloc\fR can have associated
with it a string-valued tag. In the lists of allocated memory generated
by \fBmemory active\fR and \fBmemory onexit\fR, the tag for each packet
is printed along with other information about the packet. The
\fBmemory tag\fR command sets the tag value for subsequent calls
-to \fBckalloc\fR to be \fIstring\fR.
+to \fBTcl_Alloc\fR to be \fIstring\fR.
.TP
\fBmemory trace \fR[\fBon\fR|\fBoff\fR]
.
Turns memory tracing on or off. When memory tracing is on, every call
-to \fBckalloc\fR causes a line of trace information to be written to
-\fIstderr\fR, consisting of the word \fIckalloc\fR, followed by the
+to \fBTcl_Alloc\fR causes a line of trace information to be written to
+\fIstderr\fR, consisting of the word \fITcl_Alloc\fR, followed by the
address returned, the amount of memory allocated, and the C filename
and line number of the code performing the allocation. For example:
.RS
.PP
.CS
-ckalloc 40e478 98 tclProc.c 1406
+Tcl_Alloc 40e478 98 tclProc.c 1406
.CE
.PP
-Calls to \fBckfree\fR are traced in the same manner.
+Calls to \fBTcl_Free\fR are traced in the same manner.
.RE
.TP
\fBmemory trace_on_at_malloc\fR \fIcount\fR
.
-Enable memory tracing after \fIcount\fR \fBckalloc\fRs have been performed.
+Enable memory tracing after \fIcount\fR \fBTcl_Alloc\fRs have been performed.
For example, if you enter \fBmemory trace_on_at_malloc 100\fR,
-after the 100th call to \fBckalloc\fR, memory trace information will begin
+after the 100th call to \fBTcl_Alloc\fR, memory trace information will begin
being displayed for all allocations and frees. Since there can be a lot
of memory activity before a problem occurs, judicious use of this option
can reduce the slowdown caused by tracing (and the amount of trace information
@@ -97,17 +97,17 @@ occurred since Tcl started is printed on a guard zone failure.
\fBmemory validate \fR[\fBon\fR|\fBoff\fR]
.
Turns memory validation on or off. When memory validation is enabled,
-on every call to \fBckalloc\fR or \fBckfree\fR, the guard zones are
+on every call to \fBTcl_Alloc\fR or \fBTcl_Free\fR, the guard zones are
checked for every piece of memory currently in existence that was
-allocated by \fBckalloc\fR. This has a large performance impact and
+allocated by \fBTcl_Alloc\fR. This has a large performance impact and
should only be used when overwrite problems are strongly suspected.
The advantage of enabling memory validation is that a guard zone
-overwrite can be detected on the first call to \fBckalloc\fR or
-\fBckfree\fR after the overwrite occurred, rather than when the
+overwrite can be detected on the first call to \fBTcl_Alloc\fR or
+\fBTcl_Free\fR after the overwrite occurred, rather than when the
specific memory with the overwritten guard zone(s) is freed, which may
occur long after the overwrite occurred.
.SH "SEE ALSO"
-ckalloc, ckfree, Tcl_ValidateAllMemory, Tcl_DumpActiveMemory, TCL_MEM_DEBUG
+Tcl_Alloc, Tcl_Free, Tcl_ValidateAllMemory, Tcl_DumpActiveMemory, TCL_MEM_DEBUG
.SH KEYWORDS
memory, debug
'\"Local Variables:
diff --git a/doc/re_syntax.n b/doc/re_syntax.n
index 8d732ed..43c8417 100644
--- a/doc/re_syntax.n
+++ b/doc/re_syntax.n
@@ -375,7 +375,7 @@ value of \fBU+\fI10ffff\fR.
.TP
\fB\ev\fR
.
-vertical tab, as in C are all available.
+vertical tab, as in C
.TP
\fB\ex\fIhh\fR
.
diff --git a/doc/scan.n b/doc/scan.n
index 0c24fea..e87bef1 100644
--- a/doc/scan.n
+++ b/doc/scan.n
@@ -224,12 +224,10 @@ set string "#08D03F"
\fBscan\fR $string "#%2x%2x%2x" r g b
.CE
.PP
-Parse a \fIHH:MM\fR time string, noting that this avoids problems with
-octal numbers by forcing interpretation as decimals (if we did not
-care, we would use the \fB%i\fR conversion instead):
+Parse a \fIHH:MM\fR time string:
.PP
.CS
-set string "08:08" ;# *Not* octal!
+set string "08:08"
if {[\fBscan\fR $string "%d:%d" hours minutes] != 2} {
error "not a valid time string"
}
diff --git a/doc/tclvars.n b/doc/tclvars.n
index adefe40..42e9212 100644
--- a/doc/tclvars.n
+++ b/doc/tclvars.n
@@ -10,7 +10,7 @@
.BS
'\" Note: do not modify the .SH NAME line immediately below!
.SH NAME
-argc, argv, argv0, auto_path, env, errorCode, errorInfo, tcl_interactive, tcl_library, tcl_nonwordchars, tcl_patchLevel, tcl_pkgPath, tcl_platform, tcl_precision, tcl_rcFileName, tcl_traceCompile, tcl_traceExec, tcl_wordchars, tcl_version \- Variables used by Tcl
+argc, argv, argv0, auto_path, env, errorCode, errorInfo, tcl_interactive, tcl_library, tcl_nonwordchars, tcl_patchLevel, tcl_pkgPath, tcl_platform, tcl_rcFileName, tcl_traceCompile, tcl_traceExec, tcl_wordchars, tcl_version \- Variables used by Tcl
.BE
.SH DESCRIPTION
.PP
@@ -356,70 +356,6 @@ This gives the size of the native-machine word in bytes (strictly, it
is same as the result of evaluating \fIsizeof(long)\fR in C.)
.RE
.TP
-\fBtcl_precision\fR
-.
-This variable controls the number of digits to generate
-when converting floating-point values to strings. It defaults
-to 0. \fIApplications should not change this value;\fR it is
-provided for compatibility with legacy code.
-.PP
-.RS
-The default value of 0 is special, meaning that Tcl should
-convert numbers using as few digits as possible while still
-distinguishing any floating point number from its nearest
-neighbours. It differs from using an arbitrarily high value
-for \fItcl_precision\fR in that an inexact number like \fI1.4\fR
-will convert as \fI1.4\fR rather than \fI1.3999999999999999\fR
-even though the latter is nearer to the exact value of the
-binary number.
-.RE
-.PP
-.RS
-If \fBtcl_precision\fR is not zero, then when Tcl converts a floating
-point number, it creates a decimal representation of at most
-\fBtcl_precision\fR significant digits; the result may be shorter if
-the shorter result represents the original number exactly. If no
-result of at most \fBtcl_precision\fR digits is an exact representation
-of the original number, the one that is closest to the original
-number is chosen.
-If the original number lies precisely between two equally accurate
-decimal representations, then the one with an even value for the least
-significant digit is chosen; for instance, if \fBtcl_precision\fR is 3, then
-0.3125 will convert to 0.312, not 0.313, while 0.6875 will convert to
-0.688, not 0.687. Any string of trailing zeroes that remains is trimmed.
-.RE
-.PP
-.RS
-a \fBtcl_precision\fR value of 17 digits is
-.QW perfect
-for IEEE floating-point in that it allows
-double-precision values to be converted to strings and back to
-binary with no loss of information. For this reason, you will often
-see it as a value in legacy code that must run on Tcl versions before
-8.5. It is no longer recommended; as noted above, a zero value is the
-preferred method.
-.RE
-.PP
-.RS
-All interpreters in a thread share a single \fBtcl_precision\fR value:
-changing it in one interpreter will affect all other interpreters as
-well. Safe interpreters are not allowed to modify the
-variable.
-.RE
-.PP
-.RS
-Valid values for \fBtcl_precision\fR range from 0 to 17.
-.RE
-.TP
-\fBtcl_rcFileName\fR
-.
-This variable is used during initialization to indicate the name of a
-user-specific startup file. If it is set by application-specific
-initialization, then the Tcl startup code will check for the existence
-of this file and \fBsource\fR it if it exists. For example, for \fBwish\fR
-the variable is set to \fB~/.wishrc\fR for Unix and \fB~/wishrc.tcl\fR
-for Windows.
-.TP
\fBtcl_traceCompile\fR
.
The value of this variable can be set to control
diff --git a/generic/regc_locale.c b/generic/regc_locale.c
index 0614fb6..9b2f7ae 100644
--- a/generic/regc_locale.c
+++ b/generic/regc_locale.c
@@ -798,8 +798,6 @@ static const chr graphCharTable[] = {
/*
* End of auto-generated Unicode character ranges declarations.
*/
-
-#define CH NOCELT
/*
- element - map collating-element name to celt
@@ -892,9 +890,9 @@ range(
for (c=a; c<=b; c++) {
addchr(cv, c);
- lc = Tcl_UniCharToLower((chr)c);
- uc = Tcl_UniCharToUpper((chr)c);
- tc = Tcl_UniCharToTitle((chr)c);
+ lc = Tcl_UniCharToLower(c);
+ uc = Tcl_UniCharToUpper(c);
+ tc = Tcl_UniCharToTitle(c);
if (c != lc) {
addchr(cv, lc);
}
@@ -943,11 +941,11 @@ eclass(
if ((v->cflags&REG_FAKE) && c == 'x') {
cv = getcvec(v, 4, 0);
- addchr(cv, (chr)'x');
- addchr(cv, (chr)'y');
+ addchr(cv, 'x');
+ addchr(cv, 'y');
if (cases) {
- addchr(cv, (chr)'X');
- addchr(cv, (chr)'Y');
+ addchr(cv, 'X');
+ addchr(cv, 'Y');
}
return cv;
}
@@ -961,7 +959,7 @@ eclass(
}
cv = getcvec(v, 1, 0);
assert(cv != NULL);
- addchr(cv, (chr)c);
+ addchr(cv, c);
return cv;
}
@@ -982,7 +980,8 @@ cclass(
Tcl_DString ds;
const char *np;
const char *const *namePtr;
- int i, index;
+ size_t i;
+ int index;
/*
* The following arrays define the valid character class names.
@@ -1005,7 +1004,7 @@ cclass(
len = endp - startp;
Tcl_DStringInit(&ds);
- np = Tcl_UniCharToUtfDString(startp, (int)len, &ds);
+ np = Tcl_UniCharToUtfDString(startp, len, &ds);
/*
* Map the name to the corresponding enumerated value.
@@ -1040,14 +1039,14 @@ cclass(
case CC_ALNUM:
cv = getcvec(v, NUM_ALPHA_CHAR, NUM_DIGIT_RANGE + NUM_ALPHA_RANGE);
if (cv) {
- for (i=0 ; (size_t)i<NUM_ALPHA_CHAR ; i++) {
+ for (i=0 ; i<NUM_ALPHA_CHAR ; i++) {
addchr(cv, alphaCharTable[i]);
}
- for (i=0 ; (size_t)i<NUM_ALPHA_RANGE ; i++) {
+ for (i=0 ; i<NUM_ALPHA_RANGE ; i++) {
addrange(cv, alphaRangeTable[i].start,
alphaRangeTable[i].end);
}
- for (i=0 ; (size_t)i<NUM_DIGIT_RANGE ; i++) {
+ for (i=0 ; i<NUM_DIGIT_RANGE ; i++) {
addrange(cv, digitRangeTable[i].start,
digitRangeTable[i].end);
}
@@ -1056,11 +1055,11 @@ cclass(
case CC_ALPHA:
cv = getcvec(v, NUM_ALPHA_CHAR, NUM_ALPHA_RANGE);
if (cv) {
- for (i=0 ; (size_t)i<NUM_ALPHA_RANGE ; i++) {
+ for (i=0 ; i<NUM_ALPHA_RANGE ; i++) {
addrange(cv, alphaRangeTable[i].start,
alphaRangeTable[i].end);
}
- for (i=0 ; (size_t)i<NUM_ALPHA_CHAR ; i++) {
+ for (i=0 ; i<NUM_ALPHA_CHAR ; i++) {
addchr(cv, alphaCharTable[i]);
}
}
@@ -1079,11 +1078,11 @@ cclass(
case CC_CNTRL:
cv = getcvec(v, NUM_CONTROL_CHAR, NUM_CONTROL_RANGE);
if (cv) {
- for (i=0 ; (size_t)i<NUM_CONTROL_RANGE ; i++) {
+ for (i=0 ; i<NUM_CONTROL_RANGE ; i++) {
addrange(cv, controlRangeTable[i].start,
controlRangeTable[i].end);
}
- for (i=0 ; (size_t)i<NUM_CONTROL_CHAR ; i++) {
+ for (i=0 ; i<NUM_CONTROL_CHAR ; i++) {
addchr(cv, controlCharTable[i]);
}
}
@@ -1091,7 +1090,7 @@ cclass(
case CC_DIGIT:
cv = getcvec(v, 0, NUM_DIGIT_RANGE);
if (cv) {
- for (i=0 ; (size_t)i<NUM_DIGIT_RANGE ; i++) {
+ for (i=0 ; i<NUM_DIGIT_RANGE ; i++) {
addrange(cv, digitRangeTable[i].start,
digitRangeTable[i].end);
}
@@ -1100,11 +1099,11 @@ cclass(
case CC_PUNCT:
cv = getcvec(v, NUM_PUNCT_CHAR, NUM_PUNCT_RANGE);
if (cv) {
- for (i=0 ; (size_t)i<NUM_PUNCT_RANGE ; i++) {
+ for (i=0 ; i<NUM_PUNCT_RANGE ; i++) {
addrange(cv, punctRangeTable[i].start,
punctRangeTable[i].end);
}
- for (i=0 ; (size_t)i<NUM_PUNCT_CHAR ; i++) {
+ for (i=0 ; i<NUM_PUNCT_CHAR ; i++) {
addchr(cv, punctCharTable[i]);
}
}
@@ -1129,11 +1128,11 @@ cclass(
case CC_SPACE:
cv = getcvec(v, NUM_SPACE_CHAR, NUM_SPACE_RANGE);
if (cv) {
- for (i=0 ; (size_t)i<NUM_SPACE_RANGE ; i++) {
+ for (i=0 ; i<NUM_SPACE_RANGE ; i++) {
addrange(cv, spaceRangeTable[i].start,
spaceRangeTable[i].end);
}
- for (i=0 ; (size_t)i<NUM_SPACE_CHAR ; i++) {
+ for (i=0 ; i<NUM_SPACE_CHAR ; i++) {
addchr(cv, spaceCharTable[i]);
}
}
@@ -1141,11 +1140,11 @@ cclass(
case CC_LOWER:
cv = getcvec(v, NUM_LOWER_CHAR, NUM_LOWER_RANGE);
if (cv) {
- for (i=0 ; (size_t)i<NUM_LOWER_RANGE ; i++) {
+ for (i=0 ; i<NUM_LOWER_RANGE ; i++) {
addrange(cv, lowerRangeTable[i].start,
lowerRangeTable[i].end);
}
- for (i=0 ; (size_t)i<NUM_LOWER_CHAR ; i++) {
+ for (i=0 ; i<NUM_LOWER_CHAR ; i++) {
addchr(cv, lowerCharTable[i]);
}
}
@@ -1153,11 +1152,11 @@ cclass(
case CC_UPPER:
cv = getcvec(v, NUM_UPPER_CHAR, NUM_UPPER_RANGE);
if (cv) {
- for (i=0 ; (size_t)i<NUM_UPPER_RANGE ; i++) {
+ for (i=0 ; i<NUM_UPPER_RANGE ; i++) {
addrange(cv, upperRangeTable[i].start,
upperRangeTable[i].end);
}
- for (i=0 ; (size_t)i<NUM_UPPER_CHAR ; i++) {
+ for (i=0 ; i<NUM_UPPER_CHAR ; i++) {
addchr(cv, upperCharTable[i]);
}
}
@@ -1165,18 +1164,18 @@ cclass(
case CC_PRINT:
cv = getcvec(v, NUM_SPACE_CHAR + NUM_GRAPH_CHAR, NUM_SPACE_RANGE + NUM_GRAPH_RANGE - 1);
if (cv) {
- for (i=1 ; (size_t)i<NUM_SPACE_RANGE ; i++) {
+ for (i=1 ; i<NUM_SPACE_RANGE ; i++) {
addrange(cv, spaceRangeTable[i].start,
spaceRangeTable[i].end);
}
- for (i=0 ; (size_t)i<NUM_SPACE_CHAR ; i++) {
+ for (i=0 ; i<NUM_SPACE_CHAR ; i++) {
addchr(cv, spaceCharTable[i]);
}
- for (i=0 ; (size_t)i<NUM_GRAPH_RANGE ; i++) {
+ for (i=0 ; i<NUM_GRAPH_RANGE ; i++) {
addrange(cv, graphRangeTable[i].start,
graphRangeTable[i].end);
}
- for (i=0 ; (size_t)i<NUM_GRAPH_CHAR ; i++) {
+ for (i=0 ; i<NUM_GRAPH_CHAR ; i++) {
addchr(cv, graphCharTable[i]);
}
}
@@ -1184,11 +1183,11 @@ cclass(
case CC_GRAPH:
cv = getcvec(v, NUM_GRAPH_CHAR, NUM_GRAPH_RANGE);
if (cv) {
- for (i=0 ; (size_t)i<NUM_GRAPH_RANGE ; i++) {
+ for (i=0 ; i<NUM_GRAPH_RANGE ; i++) {
addrange(cv, graphRangeTable[i].start,
graphRangeTable[i].end);
}
- for (i=0 ; (size_t)i<NUM_GRAPH_CHAR ; i++) {
+ for (i=0 ; i<NUM_GRAPH_CHAR ; i++) {
addchr(cv, graphCharTable[i]);
}
}
@@ -1215,9 +1214,9 @@ allcases(
chr c = (chr)pc;
chr lc, uc, tc;
- lc = Tcl_UniCharToLower((chr)c);
- uc = Tcl_UniCharToUpper((chr)c);
- tc = Tcl_UniCharToTitle((chr)c);
+ lc = Tcl_UniCharToLower(c);
+ uc = Tcl_UniCharToUpper(c);
+ tc = Tcl_UniCharToTitle(c);
if (tc != uc) {
cv = getcvec(v, 3, 0);
diff --git a/generic/regcomp.c b/generic/regcomp.c
index 49b024f..9bf862c 100644
--- a/generic/regcomp.c
+++ b/generic/regcomp.c
@@ -39,7 +39,7 @@
/* automatically gathered by fwd; do not hand-edit */
/* === regcomp.c === */
int compile(regex_t *, const chr *, size_t, int);
-static void moresubs(struct vars *, int);
+static void moresubs(struct vars *, size_t);
static int freev(struct vars *, int);
static void makesearch(struct vars *, struct nfa *);
static struct subre *parse(struct vars *, int, int, struct state *, struct state *);
@@ -338,7 +338,6 @@ compile(
v->spaceused = 0;
re->re_magic = REMAGIC;
re->re_info = 0; /* bits get set during parse */
- re->re_csize = sizeof(chr);
re->re_guts = NULL;
re->re_fns = (void*)(&functions);
@@ -468,12 +467,12 @@ compile(
/*
- moresubs - enlarge subRE vector
- ^ static void moresubs(struct vars *, int);
+ ^ static void moresubs(struct vars *, size_t);
*/
static void
moresubs(
struct vars *v,
- int wanted) /* want enough room for this one */
+ size_t wanted) /* want enough room for this one */
{
struct subre **p;
int n;
@@ -2085,8 +2084,8 @@ dump(
}
fprintf(f, "\n\n\n========= DUMP ==========\n");
- fprintf(f, "nsub %d, info 0%lo, csize %d, ntree %d\n",
- (int) re->re_nsub, re->re_info, re->re_csize, g->ntree);
+ fprintf(f, "nsub %" TCL_Z_MODIFIER "d, info 0%lo, ntree %d\n",
+ re->re_nsub, re->re_info, g->ntree);
dumpcolors(&g->cmap, f);
if (!NULLCNFA(g->search)) {
diff --git a/generic/regcustom.h b/generic/regcustom.h
index 4396399..caa6cc9 100644
--- a/generic/regcustom.h
+++ b/generic/regcustom.h
@@ -36,9 +36,9 @@
* Overrides for regguts.h definitions, if any.
*/
-#define MALLOC(n) (void*)(attemptckalloc(n))
-#define FREE(p) ckfree((void*)(p))
-#define REALLOC(p,n) (void*)(attemptckrealloc((void*)(p),n))
+#define MALLOC(n) Tcl_AttemptAlloc(n)
+#define FREE(p) Tcl_Free(p)
+#define REALLOC(p,n) Tcl_AttemptRealloc(p,n)
/*
* Do not insert extras between the "begin" and "end" lines - this chunk is
@@ -56,9 +56,6 @@
#ifdef __REG_WIDE_EXEC
#undef __REG_WIDE_EXEC
#endif
-#ifdef __REG_REGOFF_T
-#undef __REG_REGOFF_T
-#endif
#ifdef __REG_NOFRONT
#undef __REG_NOFRONT
#endif
@@ -67,7 +64,6 @@
#endif
/* Interface types */
#define __REG_WIDE_T Tcl_UniChar
-#define __REG_REGOFF_T long /* Not really right, but good enough... */
/* Names and declarations */
#define __REG_WIDE_COMPILE TclReComp
#define __REG_WIDE_EXEC TclReExec
diff --git a/generic/regerror.c b/generic/regerror.c
index 49d93ed..14f92f6 100644
--- a/generic/regerror.c
+++ b/generic/regerror.c
@@ -88,7 +88,7 @@ regerror(
if (r->code >= 0) {
msg = r->name;
} else { /* Unknown; tell him the number */
- sprintf(convbuf, "REG_%u", (unsigned)icode);
+ sprintf(convbuf, "REG_%u", icode);
msg = convbuf;
}
break;
diff --git a/generic/regex.h b/generic/regex.h
index f3159c6..938b31e 100644
--- a/generic/regex.h
+++ b/generic/regex.h
@@ -89,9 +89,6 @@ extern "C" {
#ifdef __REG_WIDE_EXEC
#undef __REG_WIDE_EXEC
#endif
-#ifdef __REG_REGOFF_T
-#undef __REG_REGOFF_T
-#endif
#ifdef __REG_NOFRONT
#undef __REG_NOFRONT
#endif
@@ -100,7 +97,6 @@ extern "C" {
#endif
/* interface types */
#define __REG_WIDE_T Tcl_UniChar
-#define __REG_REGOFF_T long /* not really right, but good enough... */
/* names and declarations */
#define __REG_WIDE_COMPILE TclReComp
#define __REG_WIDE_EXEC TclReExec
@@ -115,25 +111,14 @@ extern "C" {
*/
/*
- * regoff_t has to be large enough to hold either off_t or ssize_t, and must
- * be signed; it's only a guess that long is suitable, so we offer
- * <sys/types.h> an override.
- */
-#ifdef __REG_REGOFF_T
-typedef __REG_REGOFF_T regoff_t;
-#else
-typedef long regoff_t;
-#endif
-
-/*
* other interface types
*/
/* the biggie, a compiled RE (or rather, a front end to same) */
typedef struct {
int re_magic; /* magic number */
- size_t re_nsub; /* number of subexpressions */
long re_info; /* information about RE */
+ size_t re_nsub; /* number of subexpressions */
#define REG_UBACKREF 000001
#define REG_ULOOKAHEAD 000002
#define REG_UBOUNDS 000004
@@ -148,7 +133,6 @@ typedef struct {
#define REG_UEMPTYMATCH 004000
#define REG_UIMPOSSIBLE 010000
#define REG_USHORTEST 020000
- int re_csize; /* sizeof(character) */
char *re_endp; /* backward compatibility kludge */
/* the rest is opaque pointers to hidden innards */
void *re_guts;
@@ -157,8 +141,8 @@ typedef struct {
/* result reporting (may acquire more fields later) */
typedef struct {
- regoff_t rm_so; /* start of substring */
- regoff_t rm_eo; /* end of substring */
+ size_t rm_so; /* start of substring */
+ size_t rm_eo; /* end of substring */
} regmatch_t;
/* supplementary control and reporting */
diff --git a/generic/regexec.c b/generic/regexec.c
index 1a3e114..f243968 100644
--- a/generic/regexec.c
+++ b/generic/regexec.c
@@ -187,10 +187,6 @@ exec(
FreeVars(v);
return REG_INVARG;
}
- if (re->re_csize != sizeof(chr)) {
- FreeVars(v);
- return REG_MIXED;
- }
/*
* Setup.
diff --git a/generic/tcl.decls b/generic/tcl.decls
index 19672a7..6cf7e36 100644
--- a/generic/tcl.decls
+++ b/generic/tcl.decls
@@ -40,22 +40,22 @@ declare 2 {
TCL_NORETURN void Tcl_Panic(const char *format, ...)
}
declare 3 {
- char *Tcl_Alloc(unsigned int size)
+ void *Tcl_Alloc(size_t size)
}
declare 4 {
- void Tcl_Free(char *ptr)
+ void Tcl_Free(void *ptr)
}
declare 5 {
- char *Tcl_Realloc(char *ptr, unsigned int size)
+ void *Tcl_Realloc(void *ptr, size_t size)
}
declare 6 {
- char *Tcl_DbCkalloc(unsigned int size, const char *file, int line)
+ void *Tcl_DbCkalloc(size_t size, const char *file, int line)
}
declare 7 {
- void Tcl_DbCkfree(char *ptr, const char *file, int line)
+ void Tcl_DbCkfree(void *ptr, const char *file, int line)
}
declare 8 {
- char *Tcl_DbCkrealloc(char *ptr, unsigned int size,
+ void *Tcl_DbCkrealloc(void *ptr, size_t size,
const char *file, int line)
}
@@ -65,7 +65,7 @@ declare 8 {
declare 9 unix {
void Tcl_CreateFileHandler(int fd, int mask, Tcl_FileProc *proc,
- ClientData clientData)
+ void *clientData)
}
declare 10 unix {
void Tcl_DeleteFileHandler(int fd)
@@ -86,7 +86,7 @@ declare 15 {
void Tcl_AppendStringsToObj(Tcl_Obj *objPtr, ...)
}
declare 16 {
- void Tcl_AppendToObj(Tcl_Obj *objPtr, const char *bytes, int length)
+ void Tcl_AppendToObj(Tcl_Obj *objPtr, const char *bytes, size_t length)
}
declare 17 {
Tcl_Obj *Tcl_ConcatObj(int objc, Tcl_Obj *const objv[])
@@ -104,11 +104,12 @@ declare 20 {
declare 21 {
int Tcl_DbIsShared(Tcl_Obj *objPtr, const char *file, int line)
}
-declare 22 {deprecated {No longer in use, changed to macro}} {
- Tcl_Obj *Tcl_DbNewBooleanObj(int boolValue, const char *file, int line)
-}
+# Removed in 9.0 (changed to macro):
+#declare 22 {
+# Tcl_Obj *Tcl_DbNewBooleanObj(int boolValue, const char *file, int line)
+#}
declare 23 {
- Tcl_Obj *Tcl_DbNewByteArrayObj(const unsigned char *bytes, int length,
+ Tcl_Obj *Tcl_DbNewByteArrayObj(const unsigned char *bytes, size_t length,
const char *file, int line)
}
declare 24 {
@@ -119,23 +120,24 @@ declare 25 {
Tcl_Obj *Tcl_DbNewListObj(int objc, Tcl_Obj *const *objv,
const char *file, int line)
}
-declare 26 {deprecated {No longer in use, changed to macro}} {
- Tcl_Obj *Tcl_DbNewLongObj(long longValue, const char *file, int line)
-}
+# Removed in 9.0 (changed to macro):
+#declare 26 {
+# Tcl_Obj *Tcl_DbNewLongObj(long longValue, const char *file, int line)
+#}
declare 27 {
Tcl_Obj *Tcl_DbNewObj(const char *file, int line)
}
declare 28 {
- Tcl_Obj *Tcl_DbNewStringObj(const char *bytes, int length,
+ Tcl_Obj *Tcl_DbNewStringObj(const char *bytes, size_t length,
const char *file, int line)
}
declare 29 {
Tcl_Obj *Tcl_DuplicateObj(Tcl_Obj *objPtr)
}
-# Only available as stub-entry, for backwards-compatible stub-enabled extensions
-declare 30 {
- void TclOldFreeObj(Tcl_Obj *objPtr)
-}
+# Removed in 9.0
+#declare 30 {
+# void TclFreeObj(Tcl_Obj *objPtr)
+#}
declare 31 {
int Tcl_GetBoolean(Tcl_Interp *interp, const char *src, int *boolPtr)
}
@@ -153,10 +155,11 @@ declare 35 {
int Tcl_GetDoubleFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr,
double *doublePtr)
}
-declare 36 {deprecated {No longer in use, changed to macro}} {
- int Tcl_GetIndexFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr,
- const char *const *tablePtr, const char *msg, int flags, int *indexPtr)
-}
+# Removed in 9.0, replaced by macro.
+#declare 36 {deprecated {No longer in use, changed to macro}} {
+# int Tcl_GetIndexFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr,
+# const char *const *tablePtr, const char *msg, int flags, int *indexPtr)
+#}
declare 37 {
int Tcl_GetInt(Tcl_Interp *interp, const char *src, int *intPtr)
}
@@ -167,7 +170,7 @@ declare 39 {
int Tcl_GetLongFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, long *longPtr)
}
declare 40 {
- CONST86 Tcl_ObjType *Tcl_GetObjType(const char *typeName)
+ const Tcl_ObjType *Tcl_GetObjType(const char *typeName)
}
declare 41 {
char *Tcl_GetStringFromObj(Tcl_Obj *objPtr, int *lengthPtr)
@@ -199,65 +202,73 @@ declare 48 {
int Tcl_ListObjReplace(Tcl_Interp *interp, Tcl_Obj *listPtr, int first,
int count, int objc, Tcl_Obj *const objv[])
}
-declare 49 {deprecated {No longer in use, changed to macro}} {
- Tcl_Obj *Tcl_NewBooleanObj(int boolValue)
-}
+# Removed in 9.0 (changed to macro):
+#declare 49 {
+# Tcl_Obj *Tcl_NewBooleanObj(int boolValue)
+#}
declare 50 {
- Tcl_Obj *Tcl_NewByteArrayObj(const unsigned char *bytes, int length)
+ Tcl_Obj *Tcl_NewByteArrayObj(const unsigned char *bytes, size_t length)
}
declare 51 {
Tcl_Obj *Tcl_NewDoubleObj(double doubleValue)
}
-declare 52 {deprecated {No longer in use, changed to macro}} {
- Tcl_Obj *Tcl_NewIntObj(int intValue)
-}
+# Removed in 9.0 (changed to macro):
+#declare 52 {
+# Tcl_Obj *Tcl_NewIntObj(int intValue)
+#}
declare 53 {
Tcl_Obj *Tcl_NewListObj(int objc, Tcl_Obj *const objv[])
}
-declare 54 {deprecated {No longer in use, changed to macro}} {
- Tcl_Obj *Tcl_NewLongObj(long longValue)
-}
+# Removed in 9.0 (changed to macro):
+#declare 54 {
+# Tcl_Obj *Tcl_NewLongObj(long longValue)
+#}
declare 55 {
Tcl_Obj *Tcl_NewObj(void)
}
declare 56 {
- Tcl_Obj *Tcl_NewStringObj(const char *bytes, int length)
-}
-declare 57 {deprecated {No longer in use, changed to macro}} {
- void Tcl_SetBooleanObj(Tcl_Obj *objPtr, int boolValue)
+ Tcl_Obj *Tcl_NewStringObj(const char *bytes, size_t length)
}
+# Removed in 9.0 (changed to macro):
+#declare 57 {
+# void Tcl_SetBooleanObj(Tcl_Obj *objPtr, int boolValue)
+#}
declare 58 {
- unsigned char *Tcl_SetByteArrayLength(Tcl_Obj *objPtr, int length)
+ unsigned char *Tcl_SetByteArrayLength(Tcl_Obj *objPtr, size_t length)
}
declare 59 {
void Tcl_SetByteArrayObj(Tcl_Obj *objPtr, const unsigned char *bytes,
- int length)
+ size_t length)
}
declare 60 {
void Tcl_SetDoubleObj(Tcl_Obj *objPtr, double doubleValue)
}
-declare 61 {deprecated {No longer in use, changed to macro}} {
- void Tcl_SetIntObj(Tcl_Obj *objPtr, int intValue)
-}
+# Removed in 9.0 (changed to macro):
+#declare 61 {
+# void Tcl_SetIntObj(Tcl_Obj *objPtr, int intValue)
+#}
declare 62 {
void Tcl_SetListObj(Tcl_Obj *objPtr, int objc, Tcl_Obj *const objv[])
}
-declare 63 {deprecated {No longer in use, changed to macro}} {
- void Tcl_SetLongObj(Tcl_Obj *objPtr, long longValue)
-}
+# Removed in 9.0 (changed to macro):
+#declare 63 {
+# void Tcl_SetLongObj(Tcl_Obj *objPtr, long longValue)
+#}
declare 64 {
- void Tcl_SetObjLength(Tcl_Obj *objPtr, int length)
+ void Tcl_SetObjLength(Tcl_Obj *objPtr, size_t length)
}
declare 65 {
- void Tcl_SetStringObj(Tcl_Obj *objPtr, const char *bytes, int length)
-}
-declare 66 {deprecated {No longer in use, changed to macro}} {
- void Tcl_AddErrorInfo(Tcl_Interp *interp, const char *message)
-}
-declare 67 {deprecated {No longer in use, changed to macro}} {
- void Tcl_AddObjErrorInfo(Tcl_Interp *interp, const char *message,
- int length)
-}
+ void Tcl_SetStringObj(Tcl_Obj *objPtr, const char *bytes, size_t length)
+}
+# Removed in 9.0, replaced by macro.
+#declare 66 {deprecated {No longer in use, changed to macro}} {
+# void Tcl_AddErrorInfo(Tcl_Interp *interp, const char *message)
+#}
+# Removed in 9.0, replaced by macro.
+#declare 67 {deprecated {No longer in use, changed to macro}} {
+# void Tcl_AddObjErrorInfo(Tcl_Interp *interp, const char *message,
+# int length)
+#}
declare 68 {
void Tcl_AllowExceptions(Tcl_Interp *interp)
}
@@ -269,7 +280,7 @@ declare 70 {
}
declare 71 {
Tcl_AsyncHandler Tcl_AsyncCreate(Tcl_AsyncProc *proc,
- ClientData clientData)
+ void *clientData)
}
declare 72 {
void Tcl_AsyncDelete(Tcl_AsyncHandler async)
@@ -283,22 +294,24 @@ declare 74 {
declare 75 {
int Tcl_AsyncReady(void)
}
-declare 76 {deprecated {No longer in use, changed to macro}} {
- void Tcl_BackgroundError(Tcl_Interp *interp)
-}
-declare 77 {deprecated {Use Tcl_UtfBackslash}} {
- char Tcl_Backslash(const char *src, int *readPtr)
-}
+# Removed in 9.0
+#declare 76 {deprecated {No longer in use, changed to macro}} {
+# void Tcl_BackgroundError(Tcl_Interp *interp)
+#}
+# Removed in 9.0:
+#declare 77 {deprecated {Use Tcl_UtfBackslash}} {
+# char Tcl_Backslash(const char *src, int *readPtr)
+#}
declare 78 {
int Tcl_BadChannelOption(Tcl_Interp *interp, const char *optionName,
const char *optionList)
}
declare 79 {
void Tcl_CallWhenDeleted(Tcl_Interp *interp, Tcl_InterpDeleteProc *proc,
- ClientData clientData)
+ void *clientData)
}
declare 80 {
- void Tcl_CancelIdleCall(Tcl_IdleProc *idleProc, ClientData clientData)
+ void Tcl_CancelIdleCall(Tcl_IdleProc *idleProc, void *clientData)
}
declare 81 {
int Tcl_Close(Tcl_Interp *interp, Tcl_Channel chan)
@@ -310,10 +323,10 @@ declare 83 {
char *Tcl_Concat(int argc, const char *const *argv)
}
declare 84 {
- int Tcl_ConvertElement(const char *src, char *dst, int flags)
+ size_t Tcl_ConvertElement(const char *src, char *dst, int flags)
}
declare 85 {
- int Tcl_ConvertCountedElement(const char *src, int length, char *dst,
+ size_t Tcl_ConvertCountedElement(const char *src, size_t length, char *dst,
int flags)
}
declare 86 {
@@ -328,40 +341,41 @@ declare 87 {
}
declare 88 {
Tcl_Channel Tcl_CreateChannel(const Tcl_ChannelType *typePtr,
- const char *chanName, ClientData instanceData, int mask)
+ const char *chanName, void *instanceData, int mask)
}
declare 89 {
void Tcl_CreateChannelHandler(Tcl_Channel chan, int mask,
- Tcl_ChannelProc *proc, ClientData clientData)
+ Tcl_ChannelProc *proc, void *clientData)
}
declare 90 {
void Tcl_CreateCloseHandler(Tcl_Channel chan, Tcl_CloseProc *proc,
- ClientData clientData)
+ void *clientData)
}
declare 91 {
Tcl_Command Tcl_CreateCommand(Tcl_Interp *interp, const char *cmdName,
- Tcl_CmdProc *proc, ClientData clientData,
+ Tcl_CmdProc *proc, void *clientData,
Tcl_CmdDeleteProc *deleteProc)
}
declare 92 {
void Tcl_CreateEventSource(Tcl_EventSetupProc *setupProc,
- Tcl_EventCheckProc *checkProc, ClientData clientData)
+ Tcl_EventCheckProc *checkProc, void *clientData)
}
declare 93 {
- void Tcl_CreateExitHandler(Tcl_ExitProc *proc, ClientData clientData)
+ void Tcl_CreateExitHandler(Tcl_ExitProc *proc, void *clientData)
}
declare 94 {
Tcl_Interp *Tcl_CreateInterp(void)
}
-declare 95 {deprecated {}} {
- void Tcl_CreateMathFunc(Tcl_Interp *interp, const char *name,
- int numArgs, Tcl_ValueType *argTypes,
- Tcl_MathProc *proc, ClientData clientData)
-}
+# Removed in 9.0:
+#declare 95 {deprecated {}} {
+# void Tcl_CreateMathFunc(Tcl_Interp *interp, const char *name,
+# int numArgs, Tcl_ValueType *argTypes,
+# Tcl_MathProc *proc, void *clientData)
+#}
declare 96 {
Tcl_Command Tcl_CreateObjCommand(Tcl_Interp *interp,
const char *cmdName,
- Tcl_ObjCmdProc *proc, ClientData clientData,
+ Tcl_ObjCmdProc *proc, void *clientData,
Tcl_CmdDeleteProc *deleteProc)
}
declare 97 {
@@ -370,22 +384,22 @@ declare 97 {
}
declare 98 {
Tcl_TimerToken Tcl_CreateTimerHandler(int milliseconds,
- Tcl_TimerProc *proc, ClientData clientData)
+ Tcl_TimerProc *proc, void *clientData)
}
declare 99 {
Tcl_Trace Tcl_CreateTrace(Tcl_Interp *interp, int level,
- Tcl_CmdTraceProc *proc, ClientData clientData)
+ Tcl_CmdTraceProc *proc, void *clientData)
}
declare 100 {
void Tcl_DeleteAssocData(Tcl_Interp *interp, const char *name)
}
declare 101 {
void Tcl_DeleteChannelHandler(Tcl_Channel chan, Tcl_ChannelProc *proc,
- ClientData clientData)
+ void *clientData)
}
declare 102 {
void Tcl_DeleteCloseHandler(Tcl_Channel chan, Tcl_CloseProc *proc,
- ClientData clientData)
+ void *clientData)
}
declare 103 {
int Tcl_DeleteCommand(Tcl_Interp *interp, const char *cmdName)
@@ -394,14 +408,14 @@ declare 104 {
int Tcl_DeleteCommandFromToken(Tcl_Interp *interp, Tcl_Command command)
}
declare 105 {
- void Tcl_DeleteEvents(Tcl_EventDeleteProc *proc, ClientData clientData)
+ void Tcl_DeleteEvents(Tcl_EventDeleteProc *proc, void *clientData)
}
declare 106 {
void Tcl_DeleteEventSource(Tcl_EventSetupProc *setupProc,
- Tcl_EventCheckProc *checkProc, ClientData clientData)
+ Tcl_EventCheckProc *checkProc, void *clientData)
}
declare 107 {
- void Tcl_DeleteExitHandler(Tcl_ExitProc *proc, ClientData clientData)
+ void Tcl_DeleteExitHandler(Tcl_ExitProc *proc, void *clientData)
}
declare 108 {
void Tcl_DeleteHashEntry(Tcl_HashEntry *entryPtr)
@@ -423,16 +437,16 @@ declare 113 {
}
declare 114 {
void Tcl_DontCallWhenDeleted(Tcl_Interp *interp,
- Tcl_InterpDeleteProc *proc, ClientData clientData)
+ Tcl_InterpDeleteProc *proc, void *clientData)
}
declare 115 {
int Tcl_DoOneEvent(int flags)
}
declare 116 {
- void Tcl_DoWhenIdle(Tcl_IdleProc *proc, ClientData clientData)
+ void Tcl_DoWhenIdle(Tcl_IdleProc *proc, void *clientData)
}
declare 117 {
- char *Tcl_DStringAppend(Tcl_DString *dsPtr, const char *bytes, int length)
+ char *Tcl_DStringAppend(Tcl_DString *dsPtr, const char *bytes, size_t length)
}
declare 118 {
char *Tcl_DStringAppendElement(Tcl_DString *dsPtr, const char *element)
@@ -453,7 +467,7 @@ declare 123 {
void Tcl_DStringResult(Tcl_Interp *interp, Tcl_DString *dsPtr)
}
declare 124 {
- void Tcl_DStringSetLength(Tcl_DString *dsPtr, int length)
+ void Tcl_DStringSetLength(Tcl_DString *dsPtr, size_t length)
}
declare 125 {
void Tcl_DStringStartSublist(Tcl_DString *dsPtr)
@@ -467,17 +481,19 @@ declare 127 {
declare 128 {
const char *Tcl_ErrnoMsg(int err)
}
-declare 129 {
- int Tcl_Eval(Tcl_Interp *interp, const char *script)
-}
+# Removed in 9.0, replaced by macro.
+#declare 129 {
+# int Tcl_Eval(Tcl_Interp *interp, const char *script)
+#}
declare 130 {
int Tcl_EvalFile(Tcl_Interp *interp, const char *fileName)
}
-declare 131 {deprecated {No longer in use, changed to macro}} {
- int Tcl_EvalObj(Tcl_Interp *interp, Tcl_Obj *objPtr)
-}
+# Removed in 9.0, replaced by macro.
+#declare 131 {
+# int Tcl_EvalObj(Tcl_Interp *interp, Tcl_Obj *objPtr)
+#}
declare 132 {
- void Tcl_EventuallyFree(ClientData clientData, Tcl_FreeProc *freeProc)
+ void Tcl_EventuallyFree(void *clientData, Tcl_FreeProc *freeProc)
}
declare 133 {
TCL_NORETURN void Tcl_Exit(int status)
@@ -514,9 +530,10 @@ declare 142 {
declare 143 {
void Tcl_Finalize(void)
}
-declare 144 {nostub {Don't use this function in a stub-enabled extension}} {
- void Tcl_FindExecutable(const char *argv0)
-}
+# Removed in 9.0 (stub entry only)
+#declare 144 {
+# void Tcl_FindExecutable(const char *argv0)
+#}
declare 145 {
Tcl_HashEntry *Tcl_FirstHashEntry(Tcl_HashTable *tablePtr,
Tcl_HashSearch *searchPtr)
@@ -538,7 +555,7 @@ declare 149 {
int *objcPtr, Tcl_Obj ***objv)
}
declare 150 {
- ClientData Tcl_GetAssocData(Tcl_Interp *interp, const char *name,
+ void *Tcl_GetAssocData(Tcl_Interp *interp, const char *name,
Tcl_InterpDeleteProc **procPtr)
}
declare 151 {
@@ -550,10 +567,10 @@ declare 152 {
}
declare 153 {
int Tcl_GetChannelHandle(Tcl_Channel chan, int direction,
- ClientData *handlePtr)
+ void **handlePtr)
}
declare 154 {
- ClientData Tcl_GetChannelInstanceData(Tcl_Channel chan)
+ void *Tcl_GetChannelInstanceData(Tcl_Channel chan)
}
declare 155 {
int Tcl_GetChannelMode(Tcl_Channel chan)
@@ -566,7 +583,7 @@ declare 157 {
const char *optionName, Tcl_DString *dsPtr)
}
declare 158 {
- CONST86 Tcl_ChannelType *Tcl_GetChannelType(Tcl_Channel chan)
+ const Tcl_ChannelType *Tcl_GetChannelType(Tcl_Channel chan)
}
declare 159 {
int Tcl_GetCommandInfo(Tcl_Interp *interp, const char *cmdName,
@@ -600,7 +617,7 @@ declare 166 {
declare 167 unix {
int Tcl_GetOpenFile(Tcl_Interp *interp, const char *chanID, int forWriting,
- int checkUsage, ClientData *filePtr)
+ int checkUsage, void **filePtr)
}
# Obsolete. Should now use Tcl_FSGetPathType which is objectified
# and therefore usually faster.
@@ -608,10 +625,10 @@ declare 168 {
Tcl_PathType Tcl_GetPathType(const char *path)
}
declare 169 {
- int Tcl_Gets(Tcl_Channel chan, Tcl_DString *dsPtr)
+ size_t Tcl_Gets(Tcl_Channel chan, Tcl_DString *dsPtr)
}
declare 170 {
- int Tcl_GetsObj(Tcl_Channel chan, Tcl_Obj *objPtr)
+ size_t Tcl_GetsObj(Tcl_Channel chan, Tcl_Obj *objPtr)
}
declare 171 {
int Tcl_GetServiceMode(void)
@@ -622,23 +639,27 @@ declare 172 {
declare 173 {
Tcl_Channel Tcl_GetStdChannel(int type)
}
-declare 174 {
- const char *Tcl_GetStringResult(Tcl_Interp *interp)
-}
-declare 175 {deprecated {No longer in use, changed to macro}} {
- const char *Tcl_GetVar(Tcl_Interp *interp, const char *varName,
- int flags)
-}
+# Removed in 9.0, replaced by macro.
+#declare 174 {
+# const char *Tcl_GetStringResult(Tcl_Interp *interp)
+#}
+# Removed in 9.0, replaced by macro.
+#declare 175 {deprecated {No longer in use, changed to macro}} {
+# const char *Tcl_GetVar(Tcl_Interp *interp, const char *varName,
+# int flags)
+#}
declare 176 {
const char *Tcl_GetVar2(Tcl_Interp *interp, const char *part1,
const char *part2, int flags)
}
-declare 177 {
- int Tcl_GlobalEval(Tcl_Interp *interp, const char *command)
-}
-declare 178 {deprecated {No longer in use, changed to macro}} {
- int Tcl_GlobalEvalObj(Tcl_Interp *interp, Tcl_Obj *objPtr)
-}
+# Removed in 9.0, replaced by macro.
+#declare 177 {
+# int Tcl_GlobalEval(Tcl_Interp *interp, const char *command)
+#}
+# Removed in 9.0, replaced by macro.
+#declare 178 {
+# int Tcl_GlobalEvalObj(Tcl_Interp *interp, Tcl_Obj *objPtr)
+#}
declare 179 {
int Tcl_HideCommand(Tcl_Interp *interp, const char *cmdName,
const char *hiddenCmdToken)
@@ -677,13 +698,13 @@ declare 187 {
# }
declare 189 {
- Tcl_Channel Tcl_MakeFileChannel(ClientData handle, int mode)
+ Tcl_Channel Tcl_MakeFileChannel(void *handle, int mode)
}
declare 190 {
int Tcl_MakeSafe(Tcl_Interp *interp)
}
declare 191 {
- Tcl_Channel Tcl_MakeTcpClientChannel(ClientData tcpSocket)
+ Tcl_Channel Tcl_MakeTcpClientChannel(void *tcpSocket)
}
declare 192 {
char *Tcl_Merge(int argc, const char *const *argv)
@@ -718,10 +739,10 @@ declare 199 {
declare 200 {
Tcl_Channel Tcl_OpenTcpServer(Tcl_Interp *interp, int port,
const char *host, Tcl_TcpAcceptProc *acceptProc,
- ClientData callbackData)
+ void *callbackData)
}
declare 201 {
- void Tcl_Preserve(ClientData data)
+ void Tcl_Preserve(void *data)
}
declare 202 {
void Tcl_PrintDouble(Tcl_Interp *interp, double value, char *dst)
@@ -736,7 +757,7 @@ declare 205 {
void Tcl_QueueEvent(Tcl_Event *evPtr, Tcl_QueuePosition position)
}
declare 206 {
- int Tcl_Read(Tcl_Channel chan, char *bufPtr, int toRead)
+ size_t Tcl_Read(Tcl_Channel chan, char *bufPtr, size_t toRead)
}
declare 207 {
void Tcl_ReapDetachedProcs(void)
@@ -765,24 +786,25 @@ declare 214 {
const char *pattern)
}
declare 215 {
- void Tcl_RegExpRange(Tcl_RegExp regexp, int index,
+ void Tcl_RegExpRange(Tcl_RegExp regexp, size_t index,
const char **startPtr, const char **endPtr)
}
declare 216 {
- void Tcl_Release(ClientData clientData)
+ void Tcl_Release(void *clientData)
}
declare 217 {
void Tcl_ResetResult(Tcl_Interp *interp)
}
declare 218 {
- int Tcl_ScanElement(const char *src, int *flagPtr)
+ size_t Tcl_ScanElement(const char *src, int *flagPtr)
}
declare 219 {
- int Tcl_ScanCountedElement(const char *src, int length, int *flagPtr)
-}
-declare 220 {deprecated {}} {
- int Tcl_SeekOld(Tcl_Channel chan, int offset, int mode)
+ size_t Tcl_ScanCountedElement(const char *src, size_t length, int *flagPtr)
}
+# Removed in 9.0:
+#declare 220 {
+# int Tcl_SeekOld(Tcl_Channel chan, int offset, int mode)
+#}
declare 221 {
int Tcl_ServiceAll(void)
}
@@ -791,7 +813,7 @@ declare 222 {
}
declare 223 {
void Tcl_SetAssocData(Tcl_Interp *interp, const char *name,
- Tcl_InterpDeleteProc *proc, ClientData clientData)
+ Tcl_InterpDeleteProc *proc, void *clientData)
}
declare 224 {
void Tcl_SetChannelBufferSize(Tcl_Channel chan, int sz)
@@ -813,16 +835,18 @@ declare 228 {
declare 229 {
void Tcl_SetMaxBlockTime(const Tcl_Time *timePtr)
}
-declare 230 {nostub {Don't use this function in a stub-enabled extension}} {
- void Tcl_SetPanicProc(TCL_NORETURN1 Tcl_PanicProc *panicProc)
-}
+# Removed in 9.0 (stub entry only)
+#declare 230 {
+# void Tcl_SetPanicProc(TCL_NORETURN1 Tcl_PanicProc *panicProc)
+#}
declare 231 {
int Tcl_SetRecursionLimit(Tcl_Interp *interp, int depth)
}
-declare 232 {
- void Tcl_SetResult(Tcl_Interp *interp, char *result,
- Tcl_FreeProc *freeProc)
-}
+# Removed in 9.0, replaced by macro.
+#declare 232 {
+# void Tcl_SetResult(Tcl_Interp *interp, char *result,
+# Tcl_FreeProc *freeProc)
+#}
declare 233 {
int Tcl_SetServiceMode(int mode)
}
@@ -835,10 +859,11 @@ declare 235 {
declare 236 {
void Tcl_SetStdChannel(Tcl_Channel channel, int type)
}
-declare 237 {deprecated {No longer in use, changed to macro}} {
- const char *Tcl_SetVar(Tcl_Interp *interp, const char *varName,
- const char *newValue, int flags)
-}
+# Removed in 9.0, replaced by macro.
+#declare 237 {deprecated {No longer in use, changed to macro}} {
+# const char *Tcl_SetVar(Tcl_Interp *interp, const char *varName,
+# const char *newValue, int flags)
+#}
declare 238 {
const char *Tcl_SetVar2(Tcl_Interp *interp, const char *part1,
const char *part2, const char *newValue, int flags)
@@ -860,30 +885,34 @@ declare 242 {
declare 243 {
void Tcl_SplitPath(const char *path, int *argcPtr, const char ***argvPtr)
}
-declare 244 {nostub {Don't use this function in a stub-enabled extension}} {
- void Tcl_StaticPackage(Tcl_Interp *interp, const char *pkgName,
- Tcl_PackageInitProc *initProc, Tcl_PackageInitProc *safeInitProc)
-}
-declare 245 {deprecated {No longer in use, changed to macro}} {
- int Tcl_StringMatch(const char *str, const char *pattern)
-}
-declare 246 {deprecated {}} {
- int Tcl_TellOld(Tcl_Channel chan)
-}
-declare 247 {deprecated {No longer in use, changed to macro}} {
- int Tcl_TraceVar(Tcl_Interp *interp, const char *varName, int flags,
- Tcl_VarTraceProc *proc, ClientData clientData)
-}
+# Removed in 9.0 (stub entry only)
+#declare 244 {
+# void Tcl_StaticPackage(Tcl_Interp *interp, const char *pkgName,
+# Tcl_PackageInitProc *initProc, Tcl_PackageInitProc *safeInitProc)
+#}
+# Removed in 9.0 (stub entry only)
+#declare 245 {
+# int Tcl_StringMatch(const char *str, const char *pattern)
+#}
+# Removed in 9.0:
+#declare 246 {
+# int Tcl_TellOld(Tcl_Channel chan)
+#}
+# Removed in 9.0, replaced by macro.
+#declare 247 {deprecated {No longer in use, changed to macro}} {
+# int Tcl_TraceVar(Tcl_Interp *interp, const char *varName, int flags,
+# Tcl_VarTraceProc *proc, ClientData clientData)
+#}
declare 248 {
int Tcl_TraceVar2(Tcl_Interp *interp, const char *part1, const char *part2,
- int flags, Tcl_VarTraceProc *proc, ClientData clientData)
+ int flags, Tcl_VarTraceProc *proc, void *clientData)
}
declare 249 {
char *Tcl_TranslateFileName(Tcl_Interp *interp, const char *name,
Tcl_DString *bufferPtr)
}
declare 250 {
- int Tcl_Ungets(Tcl_Channel chan, const char *str, int len, int atHead)
+ size_t Tcl_Ungets(Tcl_Channel chan, const char *str, size_t len, int atHead)
}
declare 251 {
void Tcl_UnlinkVar(Tcl_Interp *interp, const char *varName)
@@ -891,29 +920,32 @@ declare 251 {
declare 252 {
int Tcl_UnregisterChannel(Tcl_Interp *interp, Tcl_Channel chan)
}
-declare 253 {deprecated {No longer in use, changed to macro}} {
- int Tcl_UnsetVar(Tcl_Interp *interp, const char *varName, int flags)
-}
+# Removed in 9.0, replaced by macro.
+#declare 253 {deprecated {No longer in use, changed to macro}} {
+# int Tcl_UnsetVar(Tcl_Interp *interp, const char *varName, int flags)
+#}
declare 254 {
int Tcl_UnsetVar2(Tcl_Interp *interp, const char *part1, const char *part2,
int flags)
}
-declare 255 {deprecated {No longer in use, changed to macro}} {
- void Tcl_UntraceVar(Tcl_Interp *interp, const char *varName, int flags,
- Tcl_VarTraceProc *proc, ClientData clientData)
-}
+# Removed in 9.0, replaced by macro.
+#declare 255 {deprecated {No longer in use, changed to macro}} {
+# void Tcl_UntraceVar(Tcl_Interp *interp, const char *varName, int flags,
+# Tcl_VarTraceProc *proc, ClientData clientData)
+#}
declare 256 {
void Tcl_UntraceVar2(Tcl_Interp *interp, const char *part1,
const char *part2, int flags, Tcl_VarTraceProc *proc,
- ClientData clientData)
+ void *clientData)
}
declare 257 {
void Tcl_UpdateLinkedVar(Tcl_Interp *interp, const char *varName)
}
-declare 258 {deprecated {No longer in use, changed to macro}} {
- int Tcl_UpVar(Tcl_Interp *interp, const char *frameName,
- const char *varName, const char *localName, int flags)
-}
+# Removed in 9.0, replaced by macro.
+#declare 258 {deprecated {No longer in use, changed to macro}} {
+# int Tcl_UpVar(Tcl_Interp *interp, const char *frameName,
+# const char *varName, const char *localName, int flags)
+#}
declare 259 {
int Tcl_UpVar2(Tcl_Interp *interp, const char *frameName, const char *part1,
const char *part2, const char *localName, int flags)
@@ -921,17 +953,18 @@ declare 259 {
declare 260 {
int Tcl_VarEval(Tcl_Interp *interp, ...)
}
-declare 261 {deprecated {No longer in use, changed to macro}} {
- ClientData Tcl_VarTraceInfo(Tcl_Interp *interp, const char *varName,
- int flags, Tcl_VarTraceProc *procPtr, ClientData prevClientData)
-}
+# Removed in 9.0, replaced by macro.
+#declare 261 {deprecated {No longer in use, changed to macro}} {
+# ClientData Tcl_VarTraceInfo(Tcl_Interp *interp, const char *varName,
+# int flags, Tcl_VarTraceProc *procPtr, ClientData prevClientData)
+#}
declare 262 {
- ClientData Tcl_VarTraceInfo2(Tcl_Interp *interp, const char *part1,
+ void *Tcl_VarTraceInfo2(Tcl_Interp *interp, const char *part1,
const char *part2, int flags, Tcl_VarTraceProc *procPtr,
- ClientData prevClientData)
+ void *prevClientData)
}
declare 263 {
- int Tcl_Write(Tcl_Channel chan, const char *s, int slen)
+ size_t Tcl_Write(Tcl_Channel chan, const char *s, size_t slen)
}
declare 264 {
void Tcl_WrongNumArgs(Tcl_Interp *interp, int objc,
@@ -943,12 +976,14 @@ declare 265 {
declare 266 {
void Tcl_ValidateAllMemory(const char *file, int line)
}
-declare 267 {deprecated {see TIP #422}} {
- void Tcl_AppendResultVA(Tcl_Interp *interp, va_list argList)
-}
-declare 268 {deprecated {see TIP #422}} {
- void Tcl_AppendStringsToObjVA(Tcl_Obj *objPtr, va_list argList)
-}
+# Removed in 9.0:
+#declare 267 {
+# void Tcl_AppendResultVA(Tcl_Interp *interp, va_list argList)
+#}
+# Removed in 9.0:
+#declare 268 {
+# void Tcl_AppendStringsToObjVA(Tcl_Obj *objPtr, va_list argList)
+#}
declare 269 {
char *Tcl_HashStats(Tcl_HashTable *tablePtr)
}
@@ -956,36 +991,42 @@ declare 270 {
const char *Tcl_ParseVar(Tcl_Interp *interp, const char *start,
const char **termPtr)
}
-declare 271 {deprecated {No longer in use, changed to macro}} {
- const char *Tcl_PkgPresent(Tcl_Interp *interp, const char *name,
- const char *version, int exact)
-}
+# Removed in 9.0, replaced by macro.
+#declare 271 {deprecated {No longer in use, changed to macro}} {
+# const char *Tcl_PkgPresent(Tcl_Interp *interp, const char *name,
+# const char *version, int exact)
+#}
declare 272 {
const char *Tcl_PkgPresentEx(Tcl_Interp *interp,
const char *name, const char *version, int exact,
void *clientDataPtr)
}
-declare 273 {deprecated {No longer in use, changed to macro}} {
- int Tcl_PkgProvide(Tcl_Interp *interp, const char *name,
- const char *version)
-}
+# Removed in 9.0, replaced by macro.
+#declare 273 {deprecated {No longer in use, changed to macro}} {
+# int Tcl_PkgProvide(Tcl_Interp *interp, const char *name,
+# const char *version)
+#}
# TIP #268: The internally used new Require function is in slot 573.
-declare 274 {deprecated {No longer in use, changed to macro}} {
- const char *Tcl_PkgRequire(Tcl_Interp *interp, const char *name,
- const char *version, int exact)
-}
-declare 275 {deprecated {see TIP #422}} {
- void Tcl_SetErrorCodeVA(Tcl_Interp *interp, va_list argList)
-}
-declare 276 {deprecated {see TIP #422}} {
- int Tcl_VarEvalVA(Tcl_Interp *interp, va_list argList)
-}
+# Removed in 9.0, replaced by macro.
+#declare 274 {deprecated {No longer in use, changed to macro}} {
+# const char *Tcl_PkgRequire(Tcl_Interp *interp, const char *name,
+# const char *version, int exact)
+#}
+# Removed in 9.0:
+#declare 275 {
+# void Tcl_SetErrorCodeVA(Tcl_Interp *interp, va_list argList)
+#}
+# Removed in 9.0:
+#declare 276 {
+# int Tcl_VarEvalVA(Tcl_Interp *interp, va_list argList)
+#}
declare 277 {
Tcl_Pid Tcl_WaitPid(Tcl_Pid pid, int *statPtr, int options)
}
-declare 278 {deprecated {see TIP #422}} {
- TCL_NORETURN void Tcl_PanicVA(const char *format, va_list argList)
-}
+# Removed in 9.0:
+#declare 278 {
+# TCL_NORETURN void Tcl_PanicVA(const char *format, va_list argList)
+#}
declare 279 {
void Tcl_GetVersion(int *major, int *minor, int *patchLevel, int *type)
}
@@ -1009,7 +1050,7 @@ declare 280 {
declare 281 {
Tcl_Channel Tcl_StackChannel(Tcl_Interp *interp,
- const Tcl_ChannelType *typePtr, ClientData instanceData,
+ const Tcl_ChannelType *typePtr, void *instanceData,
int mask, Tcl_Channel prevChan)
}
declare 282 {
@@ -1037,16 +1078,17 @@ declare 287 {
Tcl_Encoding Tcl_CreateEncoding(const Tcl_EncodingType *typePtr)
}
declare 288 {
- void Tcl_CreateThreadExitHandler(Tcl_ExitProc *proc, ClientData clientData)
+ void Tcl_CreateThreadExitHandler(Tcl_ExitProc *proc, void *clientData)
}
declare 289 {
- void Tcl_DeleteThreadExitHandler(Tcl_ExitProc *proc, ClientData clientData)
-}
-declare 290 {
- void Tcl_DiscardResult(Tcl_SavedResult *statePtr)
+ void Tcl_DeleteThreadExitHandler(Tcl_ExitProc *proc, void *clientData)
}
+# Removed in 9.0, replaced by macro.
+#declare 290 {
+# void Tcl_DiscardResult(Tcl_SavedResult *statePtr)
+#}
declare 291 {
- int Tcl_EvalEx(Tcl_Interp *interp, const char *script, int numBytes,
+ int Tcl_EvalEx(Tcl_Interp *interp, const char *script, size_t numBytes,
int flags)
}
declare 292 {
@@ -1061,19 +1103,19 @@ declare 294 {
}
declare 295 {
int Tcl_ExternalToUtf(Tcl_Interp *interp, Tcl_Encoding encoding,
- const char *src, int srcLen, int flags,
- Tcl_EncodingState *statePtr, char *dst, int dstLen,
+ const char *src, size_t srcLen, int flags,
+ Tcl_EncodingState *statePtr, char *dst, size_t dstLen,
int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr)
}
declare 296 {
char *Tcl_ExternalToUtfDString(Tcl_Encoding encoding,
- const char *src, int srcLen, Tcl_DString *dsPtr)
+ const char *src, size_t srcLen, Tcl_DString *dsPtr)
}
declare 297 {
void Tcl_FinalizeThread(void)
}
declare 298 {
- void Tcl_FinalizeNotifier(ClientData clientData)
+ void Tcl_FinalizeNotifier(void *clientData)
}
declare 299 {
void Tcl_FreeEncoding(Tcl_Encoding encoding)
@@ -1092,18 +1134,18 @@ declare 303 {
}
declare 304 {
int Tcl_GetIndexFromObjStruct(Tcl_Interp *interp, Tcl_Obj *objPtr,
- const void *tablePtr, int offset, const char *msg, int flags,
+ const void *tablePtr, size_t offset, const char *msg, int flags,
int *indexPtr)
}
declare 305 {
- void *Tcl_GetThreadData(Tcl_ThreadDataKey *keyPtr, int size)
+ void *Tcl_GetThreadData(Tcl_ThreadDataKey *keyPtr, size_t size)
}
declare 306 {
Tcl_Obj *Tcl_GetVar2Ex(Tcl_Interp *interp, const char *part1,
const char *part2, int flags)
}
declare 307 {
- ClientData Tcl_InitNotifier(void)
+ void *Tcl_InitNotifier(void)
}
declare 308 {
void Tcl_MutexLock(Tcl_Mutex *mutexPtr)
@@ -1119,18 +1161,20 @@ declare 311 {
const Tcl_Time *timePtr)
}
declare 312 {
- int Tcl_NumUtfChars(const char *src, int length)
+ size_t Tcl_NumUtfChars(const char *src, size_t length)
}
declare 313 {
- int Tcl_ReadChars(Tcl_Channel channel, Tcl_Obj *objPtr, int charsToRead,
- int appendFlag)
-}
-declare 314 {
- void Tcl_RestoreResult(Tcl_Interp *interp, Tcl_SavedResult *statePtr)
-}
-declare 315 {
- void Tcl_SaveResult(Tcl_Interp *interp, Tcl_SavedResult *statePtr)
-}
+ size_t Tcl_ReadChars(Tcl_Channel channel, Tcl_Obj *objPtr,
+ size_t charsToRead, int appendFlag)
+}
+# Removed in 9.0, replaced by macro.
+#declare 314 {deprecated {No longer in use, changed to macro}} {
+# void Tcl_RestoreResult(Tcl_Interp *interp, Tcl_SavedResult *statePtr)
+#}
+# Removed in 9.0, replaced by macro.
+#declare 315 {deprecated {No longer in use, changed to macro}} {
+# void Tcl_SaveResult(Tcl_Interp *interp, Tcl_SavedResult *statePtr)
+#}
declare 316 {
int Tcl_SetSystemEncoding(Tcl_Interp *interp, const char *name)
}
@@ -1146,7 +1190,7 @@ declare 319 {
Tcl_QueuePosition position)
}
declare 320 {
- int Tcl_UniCharAtIndex(const char *src, int index)
+ int Tcl_UniCharAtIndex(const char *src, size_t index)
}
declare 321 {
int Tcl_UniCharToLower(int ch)
@@ -1161,13 +1205,13 @@ declare 324 {
int Tcl_UniCharToUtf(int ch, char *buf)
}
declare 325 {
- const char *Tcl_UtfAtIndex(const char *src, int index)
+ const char *Tcl_UtfAtIndex(const char *src, size_t index)
}
declare 326 {
- int Tcl_UtfCharComplete(const char *src, int length)
+ int Tcl_UtfCharComplete(const char *src, size_t length)
}
declare 327 {
- int Tcl_UtfBackslash(const char *src, int *readPtr, char *dst)
+ size_t Tcl_UtfBackslash(const char *src, int *readPtr, char *dst)
}
declare 328 {
const char *Tcl_UtfFindFirst(const char *src, int ch)
@@ -1183,13 +1227,13 @@ declare 331 {
}
declare 332 {
int Tcl_UtfToExternal(Tcl_Interp *interp, Tcl_Encoding encoding,
- const char *src, int srcLen, int flags,
- Tcl_EncodingState *statePtr, char *dst, int dstLen,
+ const char *src, size_t srcLen, int flags,
+ Tcl_EncodingState *statePtr, char *dst, size_t dstLen,
int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr)
}
declare 333 {
char *Tcl_UtfToExternalDString(Tcl_Encoding encoding,
- const char *src, int srcLen, Tcl_DString *dsPtr)
+ const char *src, size_t srcLen, Tcl_DString *dsPtr)
}
declare 334 {
int Tcl_UtfToLower(char *src)
@@ -1204,22 +1248,24 @@ declare 337 {
int Tcl_UtfToUpper(char *src)
}
declare 338 {
- int Tcl_WriteChars(Tcl_Channel chan, const char *src, int srcLen)
+ size_t Tcl_WriteChars(Tcl_Channel chan, const char *src, size_t srcLen)
}
declare 339 {
- int Tcl_WriteObj(Tcl_Channel chan, Tcl_Obj *objPtr)
+ size_t Tcl_WriteObj(Tcl_Channel chan, Tcl_Obj *objPtr)
}
declare 340 {
char *Tcl_GetString(Tcl_Obj *objPtr)
}
-declare 341 {deprecated {Use Tcl_GetEncodingSearchPath}} {
- const char *Tcl_GetDefaultEncodingDir(void)
-}
-declare 342 {deprecated {Use Tcl_SetEncodingSearchPath}} {
- void Tcl_SetDefaultEncodingDir(const char *path)
-}
+# Removed in 9.0:
+#declare 341 {deprecated {Use Tcl_GetEncodingSearchPath}} {
+# const char *Tcl_GetDefaultEncodingDir(void)
+#}
+# Removed in 9.0:
+#declare 342 {deprecated {Use Tcl_SetEncodingSearchPath}} {
+# void Tcl_SetDefaultEncodingDir(const char *path)
+#}
declare 343 {
- void Tcl_AlertNotifier(ClientData clientData)
+ void Tcl_AlertNotifier(void *clientData)
}
declare 344 {
void Tcl_ServiceModeHook(int mode)
@@ -1246,55 +1292,57 @@ declare 351 {
int Tcl_UniCharIsWordChar(int ch)
}
declare 352 {
- int Tcl_UniCharLen(const Tcl_UniChar *uniStr)
+ size_t Tcl_UniCharLen(const Tcl_UniChar *uniStr)
}
declare 353 {
int Tcl_UniCharNcmp(const Tcl_UniChar *ucs, const Tcl_UniChar *uct,
- unsigned long numChars)
+ size_t numChars)
}
declare 354 {
char *Tcl_UniCharToUtfDString(const Tcl_UniChar *uniStr,
- int uniLength, Tcl_DString *dsPtr)
+ size_t uniLength, Tcl_DString *dsPtr)
}
declare 355 {
Tcl_UniChar *Tcl_UtfToUniCharDString(const char *src,
- int length, Tcl_DString *dsPtr)
+ size_t length, Tcl_DString *dsPtr)
}
declare 356 {
Tcl_RegExp Tcl_GetRegExpFromObj(Tcl_Interp *interp, Tcl_Obj *patObj,
int flags)
}
-declare 357 {deprecated {Use Tcl_EvalTokensStandard}} {
- Tcl_Obj *Tcl_EvalTokens(Tcl_Interp *interp, Tcl_Token *tokenPtr,
- int count)
-}
+# Removed in 9.0:
+#declare 357 {deprecated {Use Tcl_EvalTokensStandard}} {
+# Tcl_Obj *Tcl_EvalTokens(Tcl_Interp *interp, Tcl_Token *tokenPtr,
+# int count)
+#}
declare 358 {
void Tcl_FreeParse(Tcl_Parse *parsePtr)
}
declare 359 {
void Tcl_LogCommandInfo(Tcl_Interp *interp, const char *script,
- const char *command, int length)
+ const char *command, size_t length)
}
declare 360 {
- int Tcl_ParseBraces(Tcl_Interp *interp, const char *start, int numBytes,
- Tcl_Parse *parsePtr, int append, const char **termPtr)
+ int Tcl_ParseBraces(Tcl_Interp *interp, const char *start,
+ size_t numBytes, Tcl_Parse *parsePtr, int append,
+ const char **termPtr)
}
declare 361 {
- int Tcl_ParseCommand(Tcl_Interp *interp, const char *start, int numBytes,
- int nested, Tcl_Parse *parsePtr)
+ int Tcl_ParseCommand(Tcl_Interp *interp, const char *start,
+ size_t numBytes, int nested, Tcl_Parse *parsePtr)
}
declare 362 {
- int Tcl_ParseExpr(Tcl_Interp *interp, const char *start, int numBytes,
+ int Tcl_ParseExpr(Tcl_Interp *interp, const char *start, size_t numBytes,
Tcl_Parse *parsePtr)
}
declare 363 {
int Tcl_ParseQuotedString(Tcl_Interp *interp, const char *start,
- int numBytes, Tcl_Parse *parsePtr, int append,
+ size_t numBytes, Tcl_Parse *parsePtr, int append,
const char **termPtr)
}
declare 364 {
- int Tcl_ParseVarName(Tcl_Interp *interp, const char *start, int numBytes,
- Tcl_Parse *parsePtr, int append)
+ int Tcl_ParseVarName(Tcl_Interp *interp, const char *start,
+ size_t numBytes, Tcl_Parse *parsePtr, int append)
}
# These 4 functions are obsolete, use Tcl_FSGetCwd, Tcl_FSChdir,
# Tcl_FSAccess and Tcl_FSStat
@@ -1311,10 +1359,10 @@ declare 368 {
int Tcl_Stat(const char *path, struct stat *bufPtr)
}
declare 369 {
- int Tcl_UtfNcmp(const char *s1, const char *s2, unsigned long n)
+ int Tcl_UtfNcmp(const char *s1, const char *s2, size_t n)
}
declare 370 {
- int Tcl_UtfNcasecmp(const char *s1, const char *s2, unsigned long n)
+ int Tcl_UtfNcasecmp(const char *s1, const char *s2, size_t n)
}
declare 371 {
int Tcl_StringCaseMatch(const char *str, const char *pattern, int nocase)
@@ -1333,33 +1381,34 @@ declare 375 {
}
declare 376 {
int Tcl_RegExpExecObj(Tcl_Interp *interp, Tcl_RegExp regexp,
- Tcl_Obj *textObj, int offset, int nmatches, int flags)
+ Tcl_Obj *textObj, size_t offset, size_t nmatches, int flags)
}
declare 377 {
void Tcl_RegExpGetInfo(Tcl_RegExp regexp, Tcl_RegExpInfo *infoPtr)
}
declare 378 {
- Tcl_Obj *Tcl_NewUnicodeObj(const Tcl_UniChar *unicode, int numChars)
+ Tcl_Obj *Tcl_NewUnicodeObj(const Tcl_UniChar *unicode, size_t numChars)
}
declare 379 {
void Tcl_SetUnicodeObj(Tcl_Obj *objPtr, const Tcl_UniChar *unicode,
- int numChars)
+ size_t numChars)
}
declare 380 {
- int Tcl_GetCharLength(Tcl_Obj *objPtr)
+ size_t Tcl_GetCharLength(Tcl_Obj *objPtr)
}
declare 381 {
- int Tcl_GetUniChar(Tcl_Obj *objPtr, int index)
-}
-declare 382 {deprecated {No longer in use, changed to macro}} {
- Tcl_UniChar *Tcl_GetUnicode(Tcl_Obj *objPtr)
+ int Tcl_GetUniChar(Tcl_Obj *objPtr, size_t index)
}
+# Removed in 9.0, replaced by macro.
+#declare 382 {deprecated {No longer in use, changed to macro}} {
+# Tcl_UniChar *Tcl_GetUnicode(Tcl_Obj *objPtr)
+#}
declare 383 {
- Tcl_Obj *Tcl_GetRange(Tcl_Obj *objPtr, int first, int last)
+ Tcl_Obj *Tcl_GetRange(Tcl_Obj *objPtr, size_t first, size_t last)
}
declare 384 {
void Tcl_AppendUnicodeToObj(Tcl_Obj *objPtr, const Tcl_UniChar *unicode,
- int length)
+ size_t length)
}
declare 385 {
int Tcl_RegExpMatchObj(Tcl_Interp *interp, Tcl_Obj *textObj,
@@ -1378,7 +1427,7 @@ declare 389 {
int Tcl_GetChannelNamesEx(Tcl_Interp *interp, const char *pattern)
}
declare 390 {
- int Tcl_ProcObjCmd(ClientData clientData, Tcl_Interp *interp,
+ int Tcl_ProcObjCmd(void *clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[])
}
declare 391 {
@@ -1389,15 +1438,15 @@ declare 392 {
}
declare 393 {
int Tcl_CreateThread(Tcl_ThreadId *idPtr, Tcl_ThreadCreateProc *proc,
- ClientData clientData, int stackSize, int flags)
+ void *clientData, size_t stackSize, int flags)
}
# Introduced in 8.3.2
declare 394 {
- int Tcl_ReadRaw(Tcl_Channel chan, char *dst, int bytesToRead)
+ size_t Tcl_ReadRaw(Tcl_Channel chan, char *dst, size_t bytesToRead)
}
declare 395 {
- int Tcl_WriteRaw(Tcl_Channel chan, const char *src, int srcLen)
+ size_t Tcl_WriteRaw(Tcl_Channel chan, const char *src, size_t srcLen)
}
declare 396 {
Tcl_Channel Tcl_GetTopChannel(Tcl_Channel chan)
@@ -1485,19 +1534,21 @@ declare 418 {
}
declare 419 {
int Tcl_UniCharNcasecmp(const Tcl_UniChar *ucs, const Tcl_UniChar *uct,
- unsigned long numChars)
+ size_t numChars)
}
declare 420 {
int Tcl_UniCharCaseMatch(const Tcl_UniChar *uniStr,
const Tcl_UniChar *uniPattern, int nocase)
}
-declare 421 {
- Tcl_HashEntry *Tcl_FindHashEntry(Tcl_HashTable *tablePtr, const void *key)
-}
-declare 422 {
- Tcl_HashEntry *Tcl_CreateHashEntry(Tcl_HashTable *tablePtr,
- const void *key, int *newPtr)
-}
+# Removed in 9.0, as it is actually a macro:
+#declare 421 {
+# Tcl_HashEntry *Tcl_FindHashEntry(Tcl_HashTable *tablePtr, const void *key)
+#}
+# Removed in 9.0, as it is actually a macro:
+#declare 422 {
+# Tcl_HashEntry *Tcl_CreateHashEntry(Tcl_HashTable *tablePtr,
+# const void *key, int *newPtr)
+#}
declare 423 {
void Tcl_InitCustomHashTable(Tcl_HashTable *tablePtr, int keyType,
const Tcl_HashKeyType *typePtr)
@@ -1506,33 +1557,33 @@ declare 424 {
void Tcl_InitObjHashTable(Tcl_HashTable *tablePtr)
}
declare 425 {
- ClientData Tcl_CommandTraceInfo(Tcl_Interp *interp, const char *varName,
+ void *Tcl_CommandTraceInfo(Tcl_Interp *interp, const char *varName,
int flags, Tcl_CommandTraceProc *procPtr,
- ClientData prevClientData)
+ void *prevClientData)
}
declare 426 {
int Tcl_TraceCommand(Tcl_Interp *interp, const char *varName, int flags,
- Tcl_CommandTraceProc *proc, ClientData clientData)
+ Tcl_CommandTraceProc *proc, void *clientData)
}
declare 427 {
void Tcl_UntraceCommand(Tcl_Interp *interp, const char *varName,
- int flags, Tcl_CommandTraceProc *proc, ClientData clientData)
+ int flags, Tcl_CommandTraceProc *proc, void *clientData)
}
declare 428 {
- char *Tcl_AttemptAlloc(unsigned int size)
+ void *Tcl_AttemptAlloc(size_t size)
}
declare 429 {
- char *Tcl_AttemptDbCkalloc(unsigned int size, const char *file, int line)
+ void *Tcl_AttemptDbCkalloc(size_t size, const char *file, int line)
}
declare 430 {
- char *Tcl_AttemptRealloc(char *ptr, unsigned int size)
+ void *Tcl_AttemptRealloc(void *ptr, size_t size)
}
declare 431 {
- char *Tcl_AttemptDbCkrealloc(char *ptr, unsigned int size,
+ void *Tcl_AttemptDbCkrealloc(void *ptr, size_t size,
const char *file, int line)
}
declare 432 {
- int Tcl_AttemptSetObjLength(Tcl_Obj *objPtr, int length)
+ int Tcl_AttemptSetObjLength(Tcl_Obj *objPtr, size_t length)
}
# TIP#10 (thread-aware channels) akupries
@@ -1546,14 +1597,16 @@ declare 434 {
}
# TIP#15 (math function introspection) dkf
-declare 435 {deprecated {}} {
- int Tcl_GetMathFuncInfo(Tcl_Interp *interp, const char *name,
- int *numArgsPtr, Tcl_ValueType **argTypesPtr,
- Tcl_MathProc **procPtr, ClientData *clientDataPtr)
-}
-declare 436 {deprecated {}} {
- Tcl_Obj *Tcl_ListMathFuncs(Tcl_Interp *interp, const char *pattern)
-}
+# Removed in 9.0:
+#declare 435 {deprecated {}} {
+# int Tcl_GetMathFuncInfo(Tcl_Interp *interp, const char *name,
+# int *numArgsPtr, Tcl_ValueType **argTypesPtr,
+# Tcl_MathProc **procPtr, void **clientDataPtr)
+#}
+# Removed in 9.0:
+#declare 436 {deprecated {}} {
+# Tcl_Obj *Tcl_ListMathFuncs(Tcl_Interp *interp, const char *pattern)
+#}
# TIP#36 (better access to 'subst') dkf
declare 437 {
@@ -1615,7 +1668,7 @@ declare 452 {
int index, Tcl_Obj *pathPtr, Tcl_Obj *objPtr)
}
declare 453 {
- const char *CONST86 *Tcl_FSFileAttrStrings(Tcl_Obj *pathPtr,
+ const char *const *Tcl_FSFileAttrStrings(Tcl_Obj *pathPtr,
Tcl_Obj **objPtrRef)
}
declare 454 {
@@ -1654,7 +1707,7 @@ declare 464 {
Tcl_Obj *const objv[])
}
declare 465 {
- ClientData Tcl_FSGetInternalRep(Tcl_Obj *pathPtr,
+ void *Tcl_FSGetInternalRep(Tcl_Obj *pathPtr,
const Tcl_Filesystem *fsPtr)
}
declare 466 {
@@ -1665,7 +1718,7 @@ declare 467 {
}
declare 468 {
Tcl_Obj *Tcl_FSNewNativePath(const Tcl_Filesystem *fromFilesystem,
- ClientData clientData)
+ void *clientData)
}
declare 469 {
const void *Tcl_FSGetNativePath(Tcl_Obj *pathPtr)
@@ -1680,20 +1733,20 @@ declare 472 {
Tcl_Obj *Tcl_FSListVolumes(void)
}
declare 473 {
- int Tcl_FSRegister(ClientData clientData, const Tcl_Filesystem *fsPtr)
+ int Tcl_FSRegister(void *clientData, const Tcl_Filesystem *fsPtr)
}
declare 474 {
int Tcl_FSUnregister(const Tcl_Filesystem *fsPtr)
}
declare 475 {
- ClientData Tcl_FSData(const Tcl_Filesystem *fsPtr)
+ void *Tcl_FSData(const Tcl_Filesystem *fsPtr)
}
declare 476 {
const char *Tcl_FSGetTranslatedStringPath(Tcl_Interp *interp,
Tcl_Obj *pathPtr)
}
declare 477 {
- CONST86 Tcl_Filesystem *Tcl_FSGetFileSystemForPath(Tcl_Obj *pathPtr)
+ const Tcl_Filesystem *Tcl_FSGetFileSystemForPath(Tcl_Obj *pathPtr)
}
declare 478 {
Tcl_PathType Tcl_FSGetPathType(Tcl_Obj *pathPtr)
@@ -1710,7 +1763,7 @@ declare 480 {
# TIP#56 (evaluate a parsed script) msofer
declare 481 {
int Tcl_EvalTokensStandard(Tcl_Interp *interp, Tcl_Token *tokenPtr,
- int count)
+ size_t count)
}
# TIP#73 (access to current time) kbk
@@ -1721,7 +1774,7 @@ declare 482 {
# TIP#32 (object-enabled traces) kbk
declare 483 {
Tcl_Trace Tcl_CreateObjTrace(Tcl_Interp *interp, int level, int flags,
- Tcl_CmdObjTraceProc *objProc, ClientData clientData,
+ Tcl_CmdObjTraceProc *objProc, void *clientData,
Tcl_CmdObjTraceDeleteProc *delProc)
}
declare 484 {
@@ -1819,7 +1872,7 @@ declare 505 {
# dkf, API by Brent Welch?
declare 506 {
Tcl_Namespace *Tcl_CreateNamespace(Tcl_Interp *interp, const char *name,
- ClientData clientData, Tcl_NamespaceDeleteProc *deleteProc)
+ void *clientData, Tcl_NamespaceDeleteProc *deleteProc)
}
declare 507 {
void Tcl_DeleteNamespace(Tcl_Namespace *nsPtr)
@@ -1868,20 +1921,20 @@ declare 518 {
const char *encodingName)
}
-# TIP#121 (exit handler) dkf for Joe Mistachkin
-declare 519 {nostub {Don't use this function in a stub-enabled extension}} {
- Tcl_ExitProc *Tcl_SetExitProc(TCL_NORETURN1 Tcl_ExitProc *proc)
-}
+# Removed in 9.0 (stub entry only)
+#declare 519 {nostub {Don't use this function in a stub-enabled extension}} {
+# Tcl_ExitProc *Tcl_SetExitProc(TCL_NORETURN1 Tcl_ExitProc *proc)
+#}
# TIP#143 (resource limits) dkf
declare 520 {
void Tcl_LimitAddHandler(Tcl_Interp *interp, int type,
- Tcl_LimitHandlerProc *handlerProc, ClientData clientData,
+ Tcl_LimitHandlerProc *handlerProc, void *clientData,
Tcl_LimitHandlerDeleteProc *deleteProc)
}
declare 521 {
void Tcl_LimitRemoveHandler(Tcl_Interp *interp, int type,
- Tcl_LimitHandlerProc *handlerProc, ClientData clientData)
+ Tcl_LimitHandlerProc *handlerProc, void *clientData)
}
declare 522 {
int Tcl_LimitReady(Tcl_Interp *interp)
@@ -1994,12 +2047,12 @@ declare 551 {
declare 552 {
void Tcl_SetTimeProc(Tcl_GetTimeProc *getProc,
Tcl_ScaleTimeProc *scaleProc,
- ClientData clientData)
+ void *clientData)
}
declare 553 {
void Tcl_QueryTimeProc(Tcl_GetTimeProc **getProc,
Tcl_ScaleTimeProc **scaleProc,
- ClientData *clientData)
+ void **clientData)
}
# TIP#218 (driver thread actions) davygrvy/akupries ChannelType ver 4
@@ -2090,8 +2143,8 @@ declare 574 {
void Tcl_AppendObjToErrorInfo(Tcl_Interp *interp, Tcl_Obj *objPtr)
}
declare 575 {
- void Tcl_AppendLimitedToObj(Tcl_Obj *objPtr, const char *bytes, int length,
- int limit, const char *ellipsis)
+ void Tcl_AppendLimitedToObj(Tcl_Obj *objPtr, const char *bytes,
+ size_t length, size_t limit, const char *ellipsis)
}
declare 576 {
Tcl_Obj *Tcl_Format(Tcl_Interp *interp, const char *format, int objc,
@@ -2113,7 +2166,7 @@ declare 579 {
# TIP #285 (script cancellation support) jmistachkin
declare 580 {
int Tcl_CancelEval(Tcl_Interp *interp, Tcl_Obj *resultObjPtr,
- ClientData clientData, int flags)
+ void *clientData, int flags)
}
declare 581 {
int Tcl_Canceled(Tcl_Interp *interp, int flags)
@@ -2129,15 +2182,15 @@ declare 582 {
declare 583 {
Tcl_Command Tcl_NRCreateCommand(Tcl_Interp *interp,
const char *cmdName, Tcl_ObjCmdProc *proc,
- Tcl_ObjCmdProc *nreProc, ClientData clientData,
+ Tcl_ObjCmdProc *nreProc, void *clientData,
Tcl_CmdDeleteProc *deleteProc)
}
declare 584 {
int Tcl_NREvalObj(Tcl_Interp *interp, Tcl_Obj *objPtr, int flags)
}
declare 585 {
- int Tcl_NREvalObjv(Tcl_Interp *interp, int objc, Tcl_Obj *const objv[],
- int flags)
+ int Tcl_NREvalObjv(Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[], int flags)
}
declare 586 {
int Tcl_NRCmdSwap(Tcl_Interp *interp, Tcl_Command cmd, int objc,
@@ -2145,14 +2198,14 @@ declare 586 {
}
declare 587 {
void Tcl_NRAddCallback(Tcl_Interp *interp, Tcl_NRPostProc *postProcPtr,
- ClientData data0, ClientData data1, ClientData data2,
- ClientData data3)
+ void *data0, void *data1, void *data2,
+ void *data3)
}
# For use by NR extenders, to have a simple way to also provide a (required!)
# classic objProc
declare 588 {
int Tcl_NRCallObjProc(Tcl_Interp *interp, Tcl_ObjCmdProc *objProc,
- ClientData clientData, int objc, Tcl_Obj *const objv[])
+ void *clientData, int objc, Tcl_Obj *const objv[])
}
# TIP#316 (Tcl_StatBuf reader functions) dkf
@@ -2243,15 +2296,15 @@ declare 610 {
}
declare 611 {
int Tcl_ZlibInflate(Tcl_Interp *interp, int format, Tcl_Obj *data,
- int buffersize, Tcl_Obj *gzipHeaderDictObj)
+ size_t buffersize, Tcl_Obj *gzipHeaderDictObj)
}
declare 612 {
unsigned int Tcl_ZlibCRC32(unsigned int crc, const unsigned char *buf,
- int len)
+ size_t len)
}
declare 613 {
unsigned int Tcl_ZlibAdler32(unsigned int adler, const unsigned char *buf,
- int len)
+ size_t len)
}
declare 614 {
int Tcl_ZlibStreamInit(Tcl_Interp *interp, int mode, int format,
@@ -2270,7 +2323,8 @@ declare 618 {
int Tcl_ZlibStreamPut(Tcl_ZlibStream zshandle, Tcl_Obj *data, int flush)
}
declare 619 {
- int Tcl_ZlibStreamGet(Tcl_ZlibStream zshandle, Tcl_Obj *data, int count)
+ int Tcl_ZlibStreamGet(Tcl_ZlibStream zshandle, Tcl_Obj *data,
+ size_t count)
}
declare 620 {
int Tcl_ZlibStreamClose(Tcl_ZlibStream zshandle)
@@ -2328,7 +2382,7 @@ declare 630 {
declare 631 {
Tcl_Channel Tcl_OpenTcpServerEx(Tcl_Interp *interp, const char *service,
const char *host, unsigned int flags, Tcl_TcpAcceptProc *acceptProc,
- ClientData callbackData)
+ void *callbackData)
}
# TIP #430
@@ -2353,7 +2407,7 @@ declare 636 {
}
declare 637 {
char *Tcl_InitStringRep(Tcl_Obj *objPtr, const char *bytes,
- unsigned int numBytes)
+ size_t numBytes)
}
declare 638 {
Tcl_ObjIntRep *Tcl_FetchIntRep(Tcl_Obj *objPtr, const Tcl_ObjType *typePtr)
@@ -2382,12 +2436,12 @@ declare 643 {
# TIP#312 New Tcl_LinkArray() function
declare 644 {
int Tcl_LinkArray(Tcl_Interp *interp, const char *varName, void *addr,
- int type, int size)
+ int type, size_t size)
}
declare 645 {
int Tcl_GetIntForIndex(Tcl_Interp *interp, Tcl_Obj *objPtr,
- int endValue, int *indexPtr)
+ size_t endValue, size_t *indexPtr)
}
# ----- BASELINE -- FOR -- 8.7.0 ----- #
@@ -2409,10 +2463,10 @@ interface tclPlat
# Added in Tcl 8.1
declare 0 win {
- TCHAR *Tcl_WinUtfToTChar(const char *str, int len, Tcl_DString *dsPtr)
+ TCHAR *Tcl_WinUtfToTChar(const char *str, size_t len, Tcl_DString *dsPtr)
}
declare 1 win {
- char *Tcl_WinTCharToUtf(const TCHAR *str, int len, Tcl_DString *dsPtr)
+ char *Tcl_WinTCharToUtf(const TCHAR *str, size_t len, Tcl_DString *dsPtr)
}
################################
@@ -2421,12 +2475,12 @@ declare 1 win {
declare 0 macosx {
int Tcl_MacOSXOpenBundleResources(Tcl_Interp *interp,
const char *bundleName, int hasResourceFile,
- int maxPathLen, char *libraryPath)
+ size_t maxPathLen, char *libraryPath)
}
declare 1 macosx {
int Tcl_MacOSXOpenVersionedBundleResources(Tcl_Interp *interp,
const char *bundleName, const char *bundleVersion,
- int hasResourceFile, int maxPathLen, char *libraryPath)
+ int hasResourceFile, size_t maxPathLen, char *libraryPath)
}
##############################################################################
@@ -2434,9 +2488,6 @@ declare 1 macosx {
# Public functions that are not accessible via the stubs table.
export {
- void Tcl_Main(int argc, char **argv, Tcl_AppInitProc *appInitProc)
-}
-export {
void Tcl_MainEx(int argc, char **argv, Tcl_AppInitProc *appInitProc,
Tcl_Interp *interp)
}
diff --git a/generic/tcl.h b/generic/tcl.h
index f3253db..37895b8 100644
--- a/generic/tcl.h
+++ b/generic/tcl.h
@@ -48,30 +48,15 @@ extern "C" {
* tools/tcl.hpj.in (not patchlevel, for windows installer)
*/
-#define TCL_MAJOR_VERSION 8
-#define TCL_MINOR_VERSION 7
+#define TCL_MAJOR_VERSION 9
+#define TCL_MINOR_VERSION 0
#define TCL_RELEASE_LEVEL TCL_ALPHA_RELEASE
-#define TCL_RELEASE_SERIAL 2
+#define TCL_RELEASE_SERIAL 0
-#define TCL_VERSION "8.7"
-#define TCL_PATCH_LEVEL "8.7a2"
+#define TCL_VERSION "9.0"
+#define TCL_PATCH_LEVEL "9.0a0"
-#if !defined(TCL_NO_DEPRECATED) || defined(RC_INVOKED)
-/*
- *----------------------------------------------------------------------------
- * The following definitions set up the proper options for Windows compilers.
- * We use this method because there is no autoconf equivalent.
- */
-
-#ifdef _WIN32
-# ifndef __WIN32__
-# define __WIN32__
-# endif
-# ifndef WIN32
-# define WIN32
-# endif
-#endif
-
+#if defined(RC_INVOKED)
/*
* Utility macros: STRINGIFY takes an argument and wraps it in "" (double
* quotation marks), JOIN joins two arguments.
@@ -85,11 +70,7 @@ extern "C" {
# define JOIN(a,b) JOIN1(a,b)
# define JOIN1(a,b) a##b
#endif
-
-#ifndef TCL_THREADS
-# define TCL_THREADS 1
-#endif
-#endif /* !TCL_NO_DEPRECATED */
+#endif /* RC_INVOKED */
/*
* A special definition used to allow this header file to be included from
@@ -120,32 +101,11 @@ extern "C" {
#include <stdio.h>
-/*
- *----------------------------------------------------------------------------
- * Support for functions with a variable number of arguments.
- *
- * The following TCL_VARARGS* macros are to support old extensions
- * written for older versions of Tcl where the macros permitted
- * support for the varargs.h system as well as stdarg.h .
- *
- * New code should just directly be written to use stdarg.h conventions.
- */
-
-#include <stdarg.h>
-#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
-# define TCL_VARARGS(type, name) (type name, ...)
-# define TCL_VARARGS_DEF(type, name) (type name, ...)
-# define TCL_VARARGS_START(type, name, list) (va_start(list, name), name)
-#endif /* !TCL_NO_DEPRECATED */
#if defined(__GNUC__) && (__GNUC__ > 2)
# define TCL_FORMAT_PRINTF(a,b) __attribute__ ((__format__ (__printf__, a, b)))
# define TCL_NORETURN __attribute__ ((noreturn))
# define TCL_NOINLINE __attribute__ ((noinline))
-# if defined(BUILD_tcl) || defined(BUILD_tk)
-# define TCL_NORETURN1 __attribute__ ((noreturn))
-# else
-# define TCL_NORETURN1 /* nothing */
-# endif
+# define TCL_NORETURN1 __attribute__ ((noreturn))
#else
# define TCL_FORMAT_PRINTF(a,b)
# if defined(_MSC_VER) && (_MSC_VER >= 1310)
@@ -241,33 +201,7 @@ extern "C" {
# endif
#endif
-/*
- * The following _ANSI_ARGS_ macro is to support old extensions
- * written for older versions of Tcl where it permitted support
- * for compilers written in the pre-prototype era of C.
- *
- * New code should use prototypes.
- */
-
-#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
-# undef _ANSI_ARGS_
-# define _ANSI_ARGS_(x) x
-
-/*
- * Definitions that allow this header file to be used either with or without
- * ANSI C features.
- */
-
-#ifndef INLINE
-# define INLINE
-#endif
-#ifndef CONST
-# define CONST const
-#endif
-
-#endif /* !TCL_NO_DEPRECATED */
-
-#ifndef CONST86
+#if !defined(CONST86) && !defined(TCL_NO_DEPRECATED)
# define CONST86 const
#endif
@@ -286,40 +220,10 @@ extern "C" {
#endif
/*
- *----------------------------------------------------------------------------
- * The following code is copied from winnt.h. If we don't replicate it here,
- * then <windows.h> can't be included after tcl.h, since tcl.h also defines
- * VOID. This block is skipped under Cygwin and Mingw.
- */
-
-#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
-#if defined(_WIN32) && !defined(HAVE_WINNT_IGNORE_VOID)
-#ifndef VOID
-#define VOID void
-typedef char CHAR;
-typedef short SHORT;
-typedef long LONG;
-#endif
-#endif /* _WIN32 && !HAVE_WINNT_IGNORE_VOID */
-
-/*
- * Macro to use instead of "void" for arguments that must have type "void *"
- * in ANSI C; maps them to type "char *" in non-ANSI systems.
- */
-
-#ifndef __VXWORKS__
-# define VOID void
-#endif
-#endif /* !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 */
-
-/*
* Miscellaneous declarations.
*/
-#ifndef _CLIENTDATA
- typedef void *ClientData;
-# define _CLIENTDATA
-#endif
+typedef void *ClientData;
/*
* Darwin specific configure overrides (to support fat compiles, where
@@ -404,15 +308,7 @@ typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt;
#define Tcl_DoubleAsWide(val) ((Tcl_WideInt)((double)(val)))
#if defined(_WIN32)
-# ifdef __BORLANDC__
- typedef struct stati64 Tcl_StatBuf;
-# elif defined(_WIN64) || defined(__MINGW_USE_VC2005_COMPAT) || defined(_USE_64BIT_TIME_T)
- typedef struct __stat64 Tcl_StatBuf;
-# elif (defined(_MSC_VER) && (_MSC_VER < 1400)) || defined(_USE_32BIT_TIME_T)
- typedef struct _stati64 Tcl_StatBuf;
-# else
- typedef struct _stat32i64 Tcl_StatBuf;
-# endif /* _MSC_VER < 1400 */
+ typedef struct __stat64 Tcl_StatBuf;
#elif defined(__CYGWIN__)
typedef struct {
dev_t st_dev;
@@ -425,13 +321,10 @@ typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt;
dev_t st_rdev;
/* Here is a 4-byte gap */
long long st_size;
- struct {long tv_sec;} st_atim;
- struct {long tv_sec;} st_mtim;
- struct {long tv_sec;} st_ctim;
- /* Here is a 4-byte gap */
+ struct {long long tv_sec;} st_atim;
+ struct {long long tv_sec;} st_mtim;
+ struct {long long tv_sec;} st_ctim;
} Tcl_StatBuf;
-#elif defined(HAVE_STRUCT_STAT64) && !defined(__APPLE__)
- typedef struct stat64 Tcl_StatBuf;
#else
typedef struct stat Tcl_StatBuf;
#endif
@@ -456,17 +349,7 @@ typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt;
* accessed with Tcl_GetObjResult() and Tcl_SetObjResult().
*/
-typedef struct Tcl_Interp
-#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
-{
- /* TIP #330: Strongly discourage extensions from using the string
- * result. */
- char *resultDontUse; /* Don't use in extensions! */
- void (*freeProcDontUse) (char *); /* Don't use in extensions! */
- int errorLineDontUse; /* Don't use in extensions! */
-}
-#endif /* !TCL_NO_DEPRECATED */
-Tcl_Interp;
+typedef struct Tcl_Interp Tcl_Interp;
typedef struct Tcl_AsyncHandler_ *Tcl_AsyncHandler;
typedef struct Tcl_Channel_ *Tcl_Channel;
@@ -497,9 +380,9 @@ typedef struct Tcl_ZLibStream_ *Tcl_ZlibStream;
*/
#if defined _WIN32
-typedef unsigned (__stdcall Tcl_ThreadCreateProc) (ClientData clientData);
+typedef unsigned (__stdcall Tcl_ThreadCreateProc) (void *clientData);
#else
-typedef void (Tcl_ThreadCreateProc) (ClientData clientData);
+typedef void (Tcl_ThreadCreateProc) (void *clientData);
#endif
/*
@@ -565,19 +448,18 @@ typedef void (Tcl_ThreadCreateProc) (ClientData clientData);
*/
typedef struct Tcl_RegExpIndices {
- long start; /* Character offset of first character in
+ size_t start; /* Character offset of first character in
* match. */
- long end; /* Character offset of first character after
+ size_t end; /* Character offset of first character after
* the match. */
} Tcl_RegExpIndices;
typedef struct Tcl_RegExpInfo {
- int nsubs; /* Number of subexpressions in the compiled
+ size_t nsubs; /* Number of subexpressions in the compiled
* expression. */
Tcl_RegExpIndices *matches; /* Array of nsubs match offset pairs. */
- long extendStart; /* The offset at which a subsequent match
+ size_t extendStart; /* The offset at which a subsequent match
* might begin. */
- long reserved; /* Reserved for later use. */
} Tcl_RegExpInfo;
/*
@@ -615,10 +497,6 @@ typedef struct stat *Tcl_OldStat_;
#define TCL_BREAK 3
#define TCL_CONTINUE 4
-#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
-#define TCL_RESULT_SIZE 200
-#endif
-
/*
*----------------------------------------------------------------------------
* Flags to control what substitutions are performed by Tcl_SubstObj():
@@ -630,27 +508,6 @@ typedef struct stat *Tcl_OldStat_;
#define TCL_SUBST_ALL 007
/*
- * Argument descriptors for math function callbacks in expressions:
- */
-
-#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
-typedef enum {
- TCL_INT, TCL_DOUBLE, TCL_EITHER, TCL_WIDE_INT
-} Tcl_ValueType;
-
-typedef struct Tcl_Value {
- Tcl_ValueType type; /* Indicates intValue or doubleValue is valid,
- * or both. */
- long intValue; /* Integer value. */
- double doubleValue; /* Double-precision floating value. */
- Tcl_WideInt wideValue; /* Wide (min. 64-bit) integer value. */
-} Tcl_Value;
-#else
-#define Tcl_ValueType void /* Just enough to prevent compilation error in Tcl */
-#define Tcl_Value void /* Just enough to prevent compilation error in Tcl */
-#endif
-
-/*
* Forward declaration of Tcl_Obj to prevent an error when the forward
* reference to Tcl_Obj is encountered in the function types declared below.
*/
@@ -663,62 +520,60 @@ struct Tcl_Obj;
*/
typedef int (Tcl_AppInitProc) (Tcl_Interp *interp);
-typedef int (Tcl_AsyncProc) (ClientData clientData, Tcl_Interp *interp,
+typedef int (Tcl_AsyncProc) (void *clientData, Tcl_Interp *interp,
int code);
-typedef void (Tcl_ChannelProc) (ClientData clientData, int mask);
-typedef void (Tcl_CloseProc) (ClientData data);
-typedef void (Tcl_CmdDeleteProc) (ClientData clientData);
-typedef int (Tcl_CmdProc) (ClientData clientData, Tcl_Interp *interp,
+typedef void (Tcl_ChannelProc) (void *clientData, int mask);
+typedef void (Tcl_CloseProc) (void *data);
+typedef void (Tcl_CmdDeleteProc) (void *clientData);
+typedef int (Tcl_CmdProc) (void *clientData, Tcl_Interp *interp,
int argc, const char *argv[]);
-typedef void (Tcl_CmdTraceProc) (ClientData clientData, Tcl_Interp *interp,
+typedef void (Tcl_CmdTraceProc) (void *clientData, Tcl_Interp *interp,
int level, char *command, Tcl_CmdProc *proc,
- ClientData cmdClientData, int argc, const char *argv[]);
-typedef int (Tcl_CmdObjTraceProc) (ClientData clientData, Tcl_Interp *interp,
+ void *cmdClientData, int argc, const char *argv[]);
+typedef int (Tcl_CmdObjTraceProc) (void *clientData, Tcl_Interp *interp,
int level, const char *command, Tcl_Command commandInfo, int objc,
struct Tcl_Obj *const *objv);
-typedef void (Tcl_CmdObjTraceDeleteProc) (ClientData clientData);
+typedef void (Tcl_CmdObjTraceDeleteProc) (void *clientData);
typedef void (Tcl_DupInternalRepProc) (struct Tcl_Obj *srcPtr,
struct Tcl_Obj *dupPtr);
-typedef int (Tcl_EncodingConvertProc) (ClientData clientData, const char *src,
+typedef int (Tcl_EncodingConvertProc) (void *clientData, const char *src,
int srcLen, int flags, Tcl_EncodingState *statePtr, char *dst,
int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr);
-typedef void (Tcl_EncodingFreeProc) (ClientData clientData);
+#define Tcl_EncodingFreeProc Tcl_FreeProc
typedef int (Tcl_EventProc) (Tcl_Event *evPtr, int flags);
-typedef void (Tcl_EventCheckProc) (ClientData clientData, int flags);
-typedef int (Tcl_EventDeleteProc) (Tcl_Event *evPtr, ClientData clientData);
-typedef void (Tcl_EventSetupProc) (ClientData clientData, int flags);
-typedef void (Tcl_ExitProc) (ClientData clientData);
-typedef void (Tcl_FileProc) (ClientData clientData, int mask);
-typedef void (Tcl_FileFreeProc) (ClientData clientData);
+typedef void (Tcl_EventCheckProc) (void *clientData, int flags);
+typedef int (Tcl_EventDeleteProc) (Tcl_Event *evPtr, void *clientData);
+typedef void (Tcl_EventSetupProc) (void *clientData, int flags);
+#define Tcl_ExitProc Tcl_FreeProc
+typedef void (Tcl_FileProc) (void *clientData, int mask);
+#define Tcl_FileFreeProc Tcl_FreeProc
typedef void (Tcl_FreeInternalRepProc) (struct Tcl_Obj *objPtr);
-typedef void (Tcl_FreeProc) (char *blockPtr);
-typedef void (Tcl_IdleProc) (ClientData clientData);
-typedef void (Tcl_InterpDeleteProc) (ClientData clientData,
+typedef void (Tcl_FreeProc) (void *blockPtr);
+typedef void (Tcl_IdleProc) (void *clientData);
+typedef void (Tcl_InterpDeleteProc) (void *clientData,
Tcl_Interp *interp);
-typedef int (Tcl_MathProc) (ClientData clientData, Tcl_Interp *interp,
- Tcl_Value *args, Tcl_Value *resultPtr);
-typedef void (Tcl_NamespaceDeleteProc) (ClientData clientData);
-typedef int (Tcl_ObjCmdProc) (ClientData clientData, Tcl_Interp *interp,
+typedef void (Tcl_NamespaceDeleteProc) (void *clientData);
+typedef int (Tcl_ObjCmdProc) (void *clientData, Tcl_Interp *interp,
int objc, struct Tcl_Obj *const *objv);
typedef int (Tcl_PackageInitProc) (Tcl_Interp *interp);
typedef int (Tcl_PackageUnloadProc) (Tcl_Interp *interp, int flags);
typedef void (Tcl_PanicProc) (const char *format, ...);
-typedef void (Tcl_TcpAcceptProc) (ClientData callbackData, Tcl_Channel chan,
+typedef void (Tcl_TcpAcceptProc) (void *callbackData, Tcl_Channel chan,
char *address, int port);
-typedef void (Tcl_TimerProc) (ClientData clientData);
+typedef void (Tcl_TimerProc) (void *clientData);
typedef int (Tcl_SetFromAnyProc) (Tcl_Interp *interp, struct Tcl_Obj *objPtr);
typedef void (Tcl_UpdateStringProc) (struct Tcl_Obj *objPtr);
-typedef char * (Tcl_VarTraceProc) (ClientData clientData, Tcl_Interp *interp,
+typedef char * (Tcl_VarTraceProc) (void *clientData, Tcl_Interp *interp,
const char *part1, const char *part2, int flags);
-typedef void (Tcl_CommandTraceProc) (ClientData clientData, Tcl_Interp *interp,
+typedef void (Tcl_CommandTraceProc) (void *clientData, Tcl_Interp *interp,
const char *oldName, const char *newName, int flags);
typedef void (Tcl_CreateFileHandlerProc) (int fd, int mask, Tcl_FileProc *proc,
- ClientData clientData);
+ void *clientData);
typedef void (Tcl_DeleteFileHandlerProc) (int fd);
-typedef void (Tcl_AlertNotifierProc) (ClientData clientData);
+typedef void (Tcl_AlertNotifierProc) (void *clientData);
typedef void (Tcl_ServiceModeHookProc) (int mode);
-typedef ClientData (Tcl_InitNotifierProc) (void);
-typedef void (Tcl_FinalizeNotifierProc) (ClientData clientData);
+typedef void *(Tcl_InitNotifierProc) (void);
+typedef void (Tcl_FinalizeNotifierProc) (void *clientData);
typedef void (Tcl_MainLoopProc) (void);
/*
@@ -776,19 +631,19 @@ typedef union Tcl_ObjIntRep { /* The internal representation: */
*/
typedef struct Tcl_Obj {
- int refCount; /* When 0 the object will be freed. */
+ size_t refCount; /* When 0 the object will be freed. */
char *bytes; /* This points to the first byte of the
* object's string representation. The array
* must be followed by a null byte (i.e., at
* offset length) but may also contain
* embedded null characters. The array's
- * storage is allocated by ckalloc. NULL means
+ * storage is allocated by Tcl_Alloc. NULL means
* the string rep is invalid and must be
* regenerated from the internal rep. Clients
* should use Tcl_GetStringFromObj or
* Tcl_GetString to get a pointer to the byte
* array as a readonly value. */
- int length; /* The number of bytes at *bytes, not
+ size_t length; /* The number of bytes at *bytes, not
* including the terminating null. */
const Tcl_ObjType *typePtr; /* Denotes the object's type. Always
* corresponds to the type of the object's
@@ -800,20 +655,11 @@ typedef struct Tcl_Obj {
/*
*----------------------------------------------------------------------------
- * The following structure contains the state needed by Tcl_SaveResult. No-one
- * outside of Tcl should access any of these fields. This structure is
- * typically allocated on the stack.
+ * The following type contains the state needed by Tcl_SaveResult. It
+ * is typically allocated on the stack.
*/
-typedef struct Tcl_SavedResult {
- char *result;
- Tcl_FreeProc *freeProc;
- Tcl_Obj *objResultPtr;
- char *appendResult;
- int appendAvl;
- int appendUsed;
- char resultSpace[200+1];
-} Tcl_SavedResult;
+typedef Tcl_Obj *Tcl_SavedResult;
/*
*----------------------------------------------------------------------------
@@ -829,7 +675,7 @@ typedef struct Tcl_Namespace {
* is an synonym. */
char *fullName; /* The namespace's fully qualified name. This
* starts with ::. */
- ClientData clientData; /* Arbitrary value associated with this
+ void *clientData; /* Arbitrary value associated with this
* namespace. */
Tcl_NamespaceDeleteProc *deleteProc;
/* Function invoked when deleting the
@@ -901,13 +747,13 @@ typedef struct Tcl_CmdInfo {
* Tcl_SetCmdInfo does not modify this
* field. */
Tcl_ObjCmdProc *objProc; /* Command's object-based function. */
- ClientData objClientData; /* ClientData for object proc. */
+ void *objClientData; /* ClientData for object proc. */
Tcl_CmdProc *proc; /* Command's string-based function. */
- ClientData clientData; /* ClientData for string proc. */
+ void *clientData; /* ClientData for string proc. */
Tcl_CmdDeleteProc *deleteProc;
/* Function to call when command is
* deleted. */
- ClientData deleteData; /* Value to pass to deleteProc (usually the
+ void *deleteData; /* Value to pass to deleteProc (usually the
* same as clientData). */
Tcl_Namespace *namespacePtr;/* Points to the namespace that contains this
* command. Note that Tcl_SetCmdInfo will not
@@ -927,9 +773,9 @@ typedef struct Tcl_CmdInfo {
typedef struct Tcl_DString {
char *string; /* Points to beginning of string: either
* staticSpace below or a malloced array. */
- int length; /* Number of non-NULL characters in the
+ size_t length; /* Number of non-NULL characters in the
* string. */
- int spaceAvl; /* Total number of bytes available for the
+ size_t spaceAvl; /* Total number of bytes available for the
* string and its terminating NULL char. */
char staticSpace[TCL_DSTRING_STATIC_SIZE];
/* Space to use in common case where string is
@@ -938,14 +784,11 @@ typedef struct Tcl_DString {
#define Tcl_DStringLength(dsPtr) ((dsPtr)->length)
#define Tcl_DStringValue(dsPtr) ((dsPtr)->string)
-#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
-# define Tcl_DStringTrunc Tcl_DStringSetLength
-#endif /* !TCL_NO_DEPRECATED */
/*
* Definitions for the maximum number of digits of precision that may be
- * specified in the "tcl_precision" variable, and the number of bytes of
- * buffer space required by Tcl_PrintDouble.
+ * produced by Tcl_PrintDouble, and the number of bytes of buffer space
+ * required by Tcl_PrintDouble.
*/
#define TCL_MAX_PREC 17
@@ -1060,17 +903,6 @@ typedef struct Tcl_DString {
#define TCL_ALLOW_INLINE_COMPILATION 0x20000
/*
- * The TCL_PARSE_PART1 flag is deprecated and has no effect. The part1 is now
- * always parsed whenever the part2 is NULL. (This is to avoid a common error
- * when converting code to use the new object based APIs and forgetting to
- * give the flag)
- */
-
-#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
-# define TCL_PARSE_PART1 0x400
-#endif /* !TCL_NO_DEPRECATED */
-
-/*
* Types for linked variables:
*/
@@ -1103,7 +935,7 @@ typedef struct Tcl_DString {
*/
#ifndef TCL_HASH_TYPE
-# define TCL_HASH_TYPE unsigned
+# define TCL_HASH_TYPE size_t
#endif
typedef struct Tcl_HashKeyType Tcl_HashKeyType;
@@ -1125,10 +957,8 @@ struct Tcl_HashEntry {
Tcl_HashEntry *nextPtr; /* Pointer to next entry in this hash bucket,
* or NULL for end of chain. */
Tcl_HashTable *tablePtr; /* Pointer to table containing entry. */
- void *hash; /* Hash value, stored as pointer to ensure
- * that the offsets of the fields in this
- * structure are not changed. */
- ClientData clientData; /* Application stores something here with
+ size_t hash; /* Hash value. */
+ void *clientData; /* Application stores something here with
* Tcl_SetHashValue. */
union { /* Key has one of these forms: */
char *oneWordValue; /* One-word value for key. */
@@ -1216,16 +1046,16 @@ struct Tcl_HashTable {
Tcl_HashEntry *staticBuckets[TCL_SMALL_HASH_TABLE];
/* Bucket array used for small tables (to
* avoid mallocs and frees). */
- int numBuckets; /* Total number of buckets allocated at
+ size_t numBuckets; /* Total number of buckets allocated at
* **bucketPtr. */
- int numEntries; /* Total number of entries present in
+ size_t numEntries; /* Total number of entries present in
* table. */
- int rebuildSize; /* Enlarge table when numEntries gets to be
+ size_t rebuildSize; /* Enlarge table when numEntries gets to be
* this large. */
+ size_t mask; /* Mask value used in hashing function. */
int downShift; /* Shift count used in hashing function.
* Designed to use high-order bits of
* randomized keys. */
- int mask; /* Mask value used in hashing function. */
int keyType; /* Type of keys used in this table. It's
* either TCL_CUSTOM_KEYS, TCL_STRING_KEYS,
* TCL_ONE_WORD_KEYS, or an integer giving the
@@ -1246,7 +1076,7 @@ struct Tcl_HashTable {
typedef struct Tcl_HashSearch {
Tcl_HashTable *tablePtr; /* Table being searched. */
- int nextIndex; /* Index of next bucket to be enumerated after
+ size_t nextIndex; /* Index of next bucket to be enumerated after
* present one. */
Tcl_HashEntry *nextEntryPtr;/* Next entry to be enumerated in the current
* bucket. */
@@ -1287,7 +1117,7 @@ typedef struct Tcl_HashSearch {
typedef struct {
void *next; /* Search position for underlying hash
* table. */
- unsigned int epoch; /* Epoch marker for dictionary being searched,
+ size_t epoch; /* Epoch marker for dictionary being searched,
* or 0 if search has terminated. */
Tcl_Dict dictionaryPtr; /* Reference to dictionary being searched. */
} Tcl_DictSearch;
@@ -1346,15 +1176,15 @@ typedef struct Tcl_Time {
long usec; /* Microseconds. */
} Tcl_Time;
-typedef void (Tcl_SetTimerProc) (CONST86 Tcl_Time *timePtr);
-typedef int (Tcl_WaitForEventProc) (CONST86 Tcl_Time *timePtr);
+typedef void (Tcl_SetTimerProc) (const Tcl_Time *timePtr);
+typedef int (Tcl_WaitForEventProc) (const Tcl_Time *timePtr);
/*
* TIP #233 (Virtualized Time)
*/
-typedef void (Tcl_GetTimeProc) (Tcl_Time *timebuf, ClientData clientData);
-typedef void (Tcl_ScaleTimeProc) (Tcl_Time *timebuf, ClientData clientData);
+typedef void (Tcl_GetTimeProc) (Tcl_Time *timebuf, void *clientData);
+typedef void (Tcl_ScaleTimeProc) (Tcl_Time *timebuf, void *clientData);
/*
*----------------------------------------------------------------------------
@@ -1413,40 +1243,40 @@ typedef void (Tcl_ScaleTimeProc) (Tcl_Time *timebuf, ClientData clientData);
* Typedefs for the various operations in a channel type:
*/
-typedef int (Tcl_DriverBlockModeProc) (ClientData instanceData, int mode);
-typedef int (Tcl_DriverCloseProc) (ClientData instanceData,
+typedef int (Tcl_DriverBlockModeProc) (void *instanceData, int mode);
+typedef int (Tcl_DriverCloseProc) (void *instanceData,
Tcl_Interp *interp);
-typedef int (Tcl_DriverClose2Proc) (ClientData instanceData,
+typedef int (Tcl_DriverClose2Proc) (void *instanceData,
Tcl_Interp *interp, int flags);
-typedef int (Tcl_DriverInputProc) (ClientData instanceData, char *buf,
+typedef int (Tcl_DriverInputProc) (void *instanceData, char *buf,
int toRead, int *errorCodePtr);
-typedef int (Tcl_DriverOutputProc) (ClientData instanceData,
+typedef int (Tcl_DriverOutputProc) (void *instanceData,
const char *buf, int toWrite, int *errorCodePtr);
-typedef int (Tcl_DriverSeekProc) (ClientData instanceData, long offset,
+typedef int (Tcl_DriverSeekProc) (void *instanceData, long offset,
int mode, int *errorCodePtr);
-typedef int (Tcl_DriverSetOptionProc) (ClientData instanceData,
+typedef int (Tcl_DriverSetOptionProc) (void *instanceData,
Tcl_Interp *interp, const char *optionName,
const char *value);
-typedef int (Tcl_DriverGetOptionProc) (ClientData instanceData,
+typedef int (Tcl_DriverGetOptionProc) (void *instanceData,
Tcl_Interp *interp, const char *optionName,
Tcl_DString *dsPtr);
-typedef void (Tcl_DriverWatchProc) (ClientData instanceData, int mask);
-typedef int (Tcl_DriverGetHandleProc) (ClientData instanceData,
- int direction, ClientData *handlePtr);
-typedef int (Tcl_DriverFlushProc) (ClientData instanceData);
-typedef int (Tcl_DriverHandlerProc) (ClientData instanceData,
+typedef void (Tcl_DriverWatchProc) (void *instanceData, int mask);
+typedef int (Tcl_DriverGetHandleProc) (void *instanceData,
+ int direction, void **handlePtr);
+typedef int (Tcl_DriverFlushProc) (void *instanceData);
+typedef int (Tcl_DriverHandlerProc) (void *instanceData,
int interestMask);
-typedef Tcl_WideInt (Tcl_DriverWideSeekProc) (ClientData instanceData,
+typedef Tcl_WideInt (Tcl_DriverWideSeekProc) (void *instanceData,
Tcl_WideInt offset, int mode, int *errorCodePtr);
/*
* TIP #218, Channel Thread Actions
*/
-typedef void (Tcl_DriverThreadActionProc) (ClientData instanceData,
+typedef void (Tcl_DriverThreadActionProc) (void *instanceData,
int action);
/*
* TIP #208, File Truncation (etc.)
*/
-typedef int (Tcl_DriverTruncateProc) (ClientData instanceData,
+typedef int (Tcl_DriverTruncateProc) (void *instanceData,
Tcl_WideInt length);
/*
@@ -1619,7 +1449,7 @@ typedef int (Tcl_FSNormalizePathProc) (Tcl_Interp *interp, Tcl_Obj *pathPtr,
int nextCheckpoint);
typedef int (Tcl_FSFileAttrsGetProc) (Tcl_Interp *interp, int index,
Tcl_Obj *pathPtr, Tcl_Obj **objPtrRef);
-typedef const char *CONST86 * (Tcl_FSFileAttrStringsProc) (Tcl_Obj *pathPtr,
+typedef const char *const * (Tcl_FSFileAttrStringsProc) (Tcl_Obj *pathPtr,
Tcl_Obj **objPtrRef);
typedef int (Tcl_FSFileAttrsSetProc) (Tcl_Interp *interp, int index,
Tcl_Obj *pathPtr, Tcl_Obj *objPtr);
@@ -1628,13 +1458,13 @@ typedef Tcl_Obj * (Tcl_FSLinkProc) (Tcl_Obj *pathPtr, Tcl_Obj *toPtr,
typedef int (Tcl_FSLoadFileProc) (Tcl_Interp *interp, Tcl_Obj *pathPtr,
Tcl_LoadHandle *handlePtr, Tcl_FSUnloadFileProc **unloadProcPtr);
typedef int (Tcl_FSPathInFilesystemProc) (Tcl_Obj *pathPtr,
- ClientData *clientDataPtr);
+ void **clientDataPtr);
typedef Tcl_Obj * (Tcl_FSFilesystemPathTypeProc) (Tcl_Obj *pathPtr);
typedef Tcl_Obj * (Tcl_FSFilesystemSeparatorProc) (Tcl_Obj *pathPtr);
-typedef void (Tcl_FSFreeInternalRepProc) (ClientData clientData);
-typedef ClientData (Tcl_FSDupInternalRepProc) (ClientData clientData);
-typedef Tcl_Obj * (Tcl_FSInternalToNormalizedProc) (ClientData clientData);
-typedef ClientData (Tcl_FSCreateInternalRepProc) (Tcl_Obj *pathPtr);
+#define Tcl_FSFreeInternalRepProc Tcl_FreeProc
+typedef void *(Tcl_FSDupInternalRepProc) (void *clientData);
+typedef Tcl_Obj * (Tcl_FSInternalToNormalizedProc) (void *clientData);
+typedef void *(Tcl_FSCreateInternalRepProc) (Tcl_Obj *pathPtr);
typedef struct Tcl_FSVersion_ *Tcl_FSVersion;
@@ -1664,7 +1494,7 @@ typedef struct Tcl_FSVersion_ *Tcl_FSVersion;
typedef struct Tcl_Filesystem {
const char *typeName; /* The name of the filesystem. */
- int structureLength; /* Length of this structure, so future binary
+ size_t structureLength; /* Length of this structure, so future binary
* compatibility can be assured. */
Tcl_FSVersion version; /* Version of the filesystem type. */
Tcl_FSPathInFilesystemProc *pathInFilesystemProc;
@@ -1854,8 +1684,8 @@ typedef struct Tcl_Token {
int type; /* Type of token, such as TCL_TOKEN_WORD; see
* below for valid types. */
const char *start; /* First character in token. */
- int size; /* Number of bytes in token. */
- int numComponents; /* If this token is composed of other tokens,
+ size_t size; /* Number of bytes in token. */
+ size_t numComponents; /* If this token is composed of other tokens,
* this field tells how many of them there are
* (including components of components, etc.).
* The component tokens immediately follow
@@ -1921,7 +1751,7 @@ typedef struct Tcl_Token {
* TCL_TOKEN_OPERATOR - The token describes one expression operator.
* An operator might be the name of a math
* function such as "abs". A TCL_TOKEN_OPERATOR
- * token is always preceded by one
+ * token is always preceeded by one
* TCL_TOKEN_SUB_EXPR token for the operator's
* subexpression, and is followed by zero or more
* TCL_TOKEN_SUB_EXPR tokens for the operator's
@@ -1969,7 +1799,7 @@ typedef struct Tcl_Token {
typedef struct Tcl_Parse {
const char *commentStart; /* Pointer to # that begins the first of one
* or more comments preceding the command. */
- int commentSize; /* Number of bytes in comments (up through
+ size_t commentSize; /* Number of bytes in comments (up through
* newline character that terminates the last
* comment). If there were no comments, this
* field is 0. */
@@ -2037,10 +1867,10 @@ typedef struct Tcl_EncodingType {
Tcl_EncodingConvertProc *fromUtfProc;
/* Function to convert from UTF-8 into
* external encoding. */
- Tcl_EncodingFreeProc *freeProc;
+ Tcl_FreeProc *freeProc;
/* If non-NULL, function to call when this
* encoding is deleted. */
- ClientData clientData; /* Arbitrary value associated with encoding
+ void *clientData; /* Arbitrary value associated with encoding
* type. Passed to conversion functions. */
int nullSize; /* Number of zero bytes that signify
* end-of-string in this encoding. This number
@@ -2194,8 +2024,8 @@ typedef struct Tcl_Config {
* command- or time-limit is exceeded by an interpreter.
*/
-typedef void (Tcl_LimitHandlerProc) (ClientData clientData, Tcl_Interp *interp);
-typedef void (Tcl_LimitHandlerDeleteProc) (ClientData clientData);
+typedef void (Tcl_LimitHandlerProc) (void *clientData, Tcl_Interp *interp);
+typedef void (Tcl_LimitHandlerDeleteProc) (void *clientData);
/*
*----------------------------------------------------------------------------
@@ -2226,7 +2056,7 @@ typedef struct {
* depends on type.*/
const char *helpStr; /* Documentation message describing this
* option. */
- ClientData clientData; /* Word to pass to function callbacks. */
+ void *clientData; /* Word to pass to function callbacks. */
} Tcl_ArgvInfo;
/*
@@ -2249,9 +2079,9 @@ typedef struct {
* argument types:
*/
-typedef int (Tcl_ArgvFuncProc)(ClientData clientData, Tcl_Obj *objPtr,
+typedef int (Tcl_ArgvFuncProc)(void *clientData, Tcl_Obj *objPtr,
void *dstPtr);
-typedef int (Tcl_ArgvGenFuncProc)(ClientData clientData, Tcl_Interp *interp,
+typedef int (Tcl_ArgvGenFuncProc)(void *clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *const *objv, void *dstPtr);
/*
@@ -2324,19 +2154,19 @@ typedef int (Tcl_ArgvGenFuncProc)(ClientData clientData, Tcl_Interp *interp,
#define TCL_TCPSERVER_REUSEPORT (1<<1)
/*
- * Constants for special int-typed values, see TIP #494
+ * Constants for special size_t-typed values, see TIP #494
*/
-#define TCL_IO_FAILURE (-1)
-#define TCL_AUTO_LENGTH (-1)
-#define TCL_INDEX_NONE (-1)
+#define TCL_IO_FAILURE ((size_t)-1)
+#define TCL_AUTO_LENGTH ((size_t)-1)
+#define TCL_INDEX_NONE ((size_t)-1)
/*
*----------------------------------------------------------------------------
* Single public declaration for NRE.
*/
-typedef int (Tcl_NRPostProc) (ClientData data[], Tcl_Interp *interp,
+typedef int (Tcl_NRPostProc) (void *data[], Tcl_Interp *interp,
int result);
/*
@@ -2345,7 +2175,7 @@ typedef int (Tcl_NRPostProc) (ClientData data[], Tcl_Interp *interp,
* stubs tables. If TCL_UTF_MAX>4 use a different value.
*/
-#define TCL_STUB_MAGIC ((int) 0xFCA3BACF + (TCL_UTF_MAX>4))
+#define TCL_STUB_MAGIC ((int) 0xFCA3BACB + (int) sizeof(void *) + (TCL_UTF_MAX>4))
/*
* The following function is required to be defined in all stubs aware
@@ -2359,9 +2189,9 @@ const char * Tcl_InitStubs(Tcl_Interp *interp, const char *version,
const char * TclTomMathInitializeStubs(Tcl_Interp *interp,
const char *version, int epoch, int revision);
#if defined(_WIN32)
- TCL_NORETURN void Tcl_ConsolePanic(const char *format, ...);
+ TCL_NORETURN1 void Tcl_ConsolePanic(const char *format, ...);
#else
-# define Tcl_ConsolePanic ((Tcl_PanicProc *)0)
+# define Tcl_ConsolePanic NULL
#endif
#ifdef USE_TCL_STUBS
@@ -2395,11 +2225,19 @@ const char * TclTomMathInitializeStubs(Tcl_Interp *interp,
#define Tcl_Main(argc, argv, proc) Tcl_MainEx(argc, argv, proc, \
((Tcl_SetPanicProc(Tcl_ConsolePanic), Tcl_CreateInterp)()))
-EXTERN void Tcl_MainEx(int argc, char **argv,
+EXTERN TCL_NORETURN void Tcl_MainEx(int argc, char **argv,
Tcl_AppInitProc *appInitProc, Tcl_Interp *interp);
EXTERN const char * Tcl_PkgInitStubsCheck(Tcl_Interp *interp,
const char *version, int exact);
EXTERN void Tcl_GetMemoryInfo(Tcl_DString *dsPtr);
+EXTERN void Tcl_FindExecutable(const char *argv0);
+EXTERN void Tcl_SetPanicProc(
+ TCL_NORETURN1 Tcl_PanicProc *panicProc);
+EXTERN void Tcl_StaticPackage(Tcl_Interp *interp,
+ const char *pkgName,
+ Tcl_PackageInitProc *initProc,
+ Tcl_PackageInitProc *safeInitProc);
+EXTERN Tcl_ExitProc *Tcl_SetExitProc(TCL_NORETURN1 Tcl_ExitProc *proc);
#ifndef _WIN32
EXTERN int TclZipfs_AppHook(int *argc, char ***argv);
#endif
@@ -2427,25 +2265,17 @@ EXTERN int TclZipfs_AppHook(int *argc, char ***argv);
/*
*----------------------------------------------------------------------------
- * The following declarations either map ckalloc and ckfree to malloc and
- * free, or they map them to functions with all sorts of debugging hooks
- * defined in tclCkalloc.c.
+ * The following declarations map ckalloc and ckfree to Tcl_Alloc and
+ * Tcl_Free.
*/
-#ifdef TCL_MEM_DEBUG
+#define ckalloc Tcl_Alloc
+#define ckfree Tcl_Free
+#define ckrealloc Tcl_Realloc
+#define attemptckalloc Tcl_AttemptAlloc
+#define attemptckrealloc Tcl_AttemptRealloc
-# define ckalloc(x) \
- ((void *) Tcl_DbCkalloc((unsigned)(x), __FILE__, __LINE__))
-# define ckfree(x) \
- Tcl_DbCkfree((char *)(x), __FILE__, __LINE__)
-# define ckrealloc(x,y) \
- ((void *) Tcl_DbCkrealloc((char *)(x), (unsigned)(y), __FILE__, __LINE__))
-# define attemptckalloc(x) \
- ((void *) Tcl_AttemptDbCkalloc((unsigned)(x), __FILE__, __LINE__))
-# define attemptckrealloc(x,y) \
- ((void *) Tcl_AttemptDbCkrealloc((char *)(x), (unsigned)(y), __FILE__, __LINE__))
-
-#else /* !TCL_MEM_DEBUG */
+#ifndef TCL_MEM_DEBUG
/*
* If we are not using the debugging allocator, we should call the Tcl_Alloc,
@@ -2453,16 +2283,6 @@ EXTERN int TclZipfs_AppHook(int *argc, char ***argv);
* memory allocator both inside and outside of the Tcl library.
*/
-# define ckalloc(x) \
- ((void *) Tcl_Alloc((unsigned)(x)))
-# define ckfree(x) \
- Tcl_Free((char *)(x))
-# define ckrealloc(x,y) \
- ((void *) Tcl_Realloc((char *)(x), (unsigned)(y)))
-# define attemptckalloc(x) \
- ((void *) Tcl_AttemptAlloc((unsigned)(x)))
-# define attemptckrealloc(x,y) \
- ((void *) Tcl_AttemptRealloc((char *)(x), (unsigned)(y)))
# undef Tcl_InitMemory
# define Tcl_InitMemory(x)
# undef Tcl_DumpActiveMemory
@@ -2482,32 +2302,6 @@ EXTERN int TclZipfs_AppHook(int *argc, char ***argv);
# undef Tcl_IsShared
# define Tcl_IsShared(objPtr) \
Tcl_DbIsShared(objPtr, __FILE__, __LINE__)
-#elif (!defined(TCL_NO_DEPRECATED) && defined(USE_TCL_STUBS))
-/*
- * When compiling stub-enabled extensions without -DTCL_NO_DEPRECATED,
- * those extensions are expected to run fine with Tcl 8.6 as well.
- * This means we must continue to use macro's for the above 3 functions,
- * and the old stub entry for TclFreeObj. All other usage of TclFreeObj()
- * is forbidden now, therefore it is changed to be MODULE_SCOPE internal.
- */
-# undef Tcl_IncrRefCount
-# define Tcl_IncrRefCount(objPtr) \
- ++(objPtr)->refCount
- /*
- * Use do/while0 idiom for optimum correctness without compiler warnings.
- * http://c2.com/cgi/wiki?TrivialDoWhileLoop
- */
-# undef Tcl_DecrRefCount
-# define Tcl_DecrRefCount(objPtr) \
- do { \
- Tcl_Obj *_objPtr = (objPtr); \
- if ((_objPtr)->refCount-- <= 1) { \
- TclOldFreeObj(_objPtr); \
- } \
- } while(0)
-# undef Tcl_IsShared
-# define Tcl_IsShared(objPtr) \
- ((objPtr)->refCount > 1)
#endif
/*
@@ -2549,7 +2343,7 @@ EXTERN int TclZipfs_AppHook(int *argc, char ***argv);
*/
#define Tcl_GetHashValue(h) ((h)->clientData)
-#define Tcl_SetHashValue(h, value) ((h)->clientData = (ClientData) (value))
+#define Tcl_SetHashValue(h, value) ((h)->clientData = (void *) (value))
#define Tcl_GetHashKey(tablePtr, h) \
((void *) (((tablePtr)->keyType == TCL_ONE_WORD_KEYS || \
(tablePtr)->keyType == TCL_CUSTOM_PTR_KEYS) \
@@ -2561,45 +2355,11 @@ EXTERN int TclZipfs_AppHook(int *argc, char ***argv);
* hash tables:
*/
-#undef Tcl_FindHashEntry
#define Tcl_FindHashEntry(tablePtr, key) \
(*((tablePtr)->findProc))(tablePtr, (const char *)(key))
-#undef Tcl_CreateHashEntry
#define Tcl_CreateHashEntry(tablePtr, key, newPtr) \
(*((tablePtr)->createProc))(tablePtr, (const char *)(key), newPtr)
-/*
- *----------------------------------------------------------------------------
- * Deprecated Tcl functions:
- */
-
-#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
-/*
- * These function have been renamed. The old names are deprecated, but we
- * define these macros for backwards compatibility.
- */
-
-# define Tcl_Ckalloc Tcl_Alloc
-# define Tcl_Ckfree Tcl_Free
-# define Tcl_Ckrealloc Tcl_Realloc
-# define Tcl_Return Tcl_SetResult
-# define Tcl_TildeSubst Tcl_TranslateFileName
-#if !defined(__APPLE__) /* On OSX, there is a conflict with "mach/mach.h" */
-# define panic Tcl_Panic
-#endif
-# define panicVA Tcl_PanicVA
-
-/*
- *----------------------------------------------------------------------------
- * Convenience declaration of Tcl_AppInit for backwards compatibility. This
- * function is not *implemented* by the tcl library, so the storage class is
- * neither DLLEXPORT nor DLLIMPORT.
- */
-
-extern Tcl_AppInitProc Tcl_AppInit;
-
-#endif /* !TCL_NO_DEPRECATED */
-
#endif /* RC_INVOKED */
/*
diff --git a/generic/tclAlloc.c b/generic/tclAlloc.c
index bad3d8a..36ae5d4 100644
--- a/generic/tclAlloc.c
+++ b/generic/tclAlloc.c
@@ -249,13 +249,13 @@ TclFinalizeAllocSubsystem(void)
*----------------------------------------------------------------------
*/
-char *
+void *
TclpAlloc(
- unsigned int numBytes) /* Number of bytes to allocate. */
+ size_t numBytes) /* Number of bytes to allocate. */
{
register union overhead *overPtr;
register size_t bucket;
- register unsigned amount;
+ register size_t amount;
struct block *bigBlockPtr = NULL;
if (!allocInit) {
@@ -274,8 +274,8 @@ TclpAlloc(
if (numBytes >= MAXMALLOC - OVERHEAD) {
if (numBytes <= UINT_MAX - OVERHEAD -sizeof(struct block)) {
- bigBlockPtr = (struct block *) TclpSysAlloc(
- sizeof(struct block) + OVERHEAD + numBytes, 0);
+ bigBlockPtr = TclpSysAlloc(
+ sizeof(struct block) + OVERHEAD + numBytes);
}
if (bigBlockPtr == NULL) {
Tcl_MutexUnlock(allocMutexPtr);
@@ -405,8 +405,7 @@ MoreCore(
numBlocks = amount / size;
ASSERT(numBlocks*size == amount);
- blockPtr = (struct block *) TclpSysAlloc(
- (sizeof(struct block) + amount), 1);
+ blockPtr = TclpSysAlloc(sizeof(struct block) + amount);
/* no more room! */
if (blockPtr == NULL) {
return;
@@ -446,7 +445,7 @@ MoreCore(
void
TclpFree(
- char *oldPtr) /* Pointer to memory to free. */
+ void *oldPtr) /* Pointer to memory to free. */
{
register size_t size;
register union overhead *overPtr;
@@ -509,10 +508,10 @@ TclpFree(
*----------------------------------------------------------------------
*/
-char *
+void *
TclpRealloc(
- char *oldPtr, /* Pointer to alloced block. */
- unsigned int numBytes) /* New size of memory. */
+ void *oldPtr, /* Pointer to alloced block. */
+ size_t numBytes) /* New size of memory. */
{
int i;
union overhead *overPtr;
@@ -692,11 +691,12 @@ mstats(
*----------------------------------------------------------------------
*/
-char *
+#undef TclpAlloc
+void *
TclpAlloc(
- unsigned int numBytes) /* Number of bytes to allocate. */
+ size_t numBytes) /* Number of bytes to allocate. */
{
- return (char *) malloc(numBytes);
+ return malloc(numBytes);
}
/*
@@ -715,9 +715,10 @@ TclpAlloc(
*----------------------------------------------------------------------
*/
+#undef TclpFree
void
TclpFree(
- char *oldPtr) /* Pointer to memory to free. */
+ void *oldPtr) /* Pointer to memory to free. */
{
free(oldPtr);
return;
@@ -739,12 +740,12 @@ TclpFree(
*----------------------------------------------------------------------
*/
-char *
+void *
TclpRealloc(
- char *oldPtr, /* Pointer to alloced block. */
- unsigned int numBytes) /* New size of memory. */
+ void *oldPtr, /* Pointer to alloced block. */
+ size_t numBytes) /* New size of memory. */
{
- return (char *) realloc(oldPtr, numBytes);
+ return realloc(oldPtr, numBytes);
}
#endif /* !USE_TCLALLOC */
diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c
index e8ca9ca..8d84044 100644
--- a/generic/tclAssembly.c
+++ b/generic/tclAssembly.c
@@ -410,7 +410,6 @@ static const TalInstDesc TalInstructionTable[] = {
{"jumpTrue", ASSEM_JUMP, INST_JUMP_TRUE1, 1, 0},
{"jumpTrue4", ASSEM_JUMP4, INST_JUMP_TRUE4, 1, 0},
{"label", ASSEM_LABEL, 0, 0, 0},
- {"land", ASSEM_1BYTE, INST_LAND, 2, 1},
{"lappend", ASSEM_LVT, (INST_LAPPEND_SCALAR1<<8
| INST_LAPPEND_SCALAR4),
1, 1},
@@ -438,7 +437,6 @@ static const TalInstDesc TalInstructionTable[] = {
| INST_LOAD_ARRAY4), 1, 1},
{"loadArrayStk", ASSEM_1BYTE, INST_LOAD_ARRAY_STK, 2, 1},
{"loadStk", ASSEM_1BYTE, INST_LOAD_STK, 1, 1},
- {"lor", ASSEM_1BYTE, INST_LOR, 2, 1},
{"lsetFlat", ASSEM_LSET_FLAT,INST_LSET_FLAT, INT_MIN,1},
{"lsetList", ASSEM_1BYTE, INST_LSET_LIST, 3, 1},
{"lshift", ASSEM_1BYTE, INST_LSHIFT, 2, 1},
@@ -859,7 +857,7 @@ CompileAssembleObj(
* names in the bytecode resolve */
int status; /* Status return from Tcl_AssembleCode */
const char* source; /* String representation of the source code */
- int sourceLen; /* Length of the source code in bytes */
+ size_t sourceLen; /* Length of the source code in bytes */
/*
* Get the expression ByteCode from the object. If it exists, make sure it
@@ -993,7 +991,7 @@ TclCompileAssembleCmd(
Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
"\n (\"%.*s\" body, line %d)",
- parsePtr->tokenPtr->size, parsePtr->tokenPtr->start,
+ (int)parsePtr->tokenPtr->size, parsePtr->tokenPtr->start,
Tcl_GetErrorLine(interp)));
envPtr->numCommands = numCommands;
envPtr->codeNext = envPtr->codeStart + offset;
@@ -1080,7 +1078,7 @@ TclAssembleCode(
*/
if (parsePtr->numWords > 0) {
- int instLen = parsePtr->commandSize;
+ size_t instLen = parsePtr->commandSize;
/* Length in bytes of the current command */
if (parsePtr->term == parsePtr->commandStart + instLen - 1) {
@@ -1093,8 +1091,8 @@ TclAssembleCode(
#ifdef TCL_COMPILE_DEBUG
if ((tclTraceCompile >= 2) && (envPtr->procPtr == NULL)) {
- printf(" %4ld Assembling: ",
- (long)(envPtr->codeNext - envPtr->codeStart));
+ printf(" %4" TCL_Z_MODIFIER "d Assembling: ",
+ envPtr->codeNext - envPtr->codeStart);
TclPrintSource(stdout, parsePtr->commandStart,
TclMin(instLen, 55));
printf("\n");
@@ -1220,14 +1218,14 @@ FreeAssemblyEnv(
Tcl_DecrRefCount(thisBB->jumpTarget);
}
if (thisBB->foreignExceptions != NULL) {
- ckfree(thisBB->foreignExceptions);
+ Tcl_Free(thisBB->foreignExceptions);
}
nextBB = thisBB->successor1;
if (thisBB->jtPtr != NULL) {
DeleteMirrorJumpTable(thisBB->jtPtr);
thisBB->jtPtr = NULL;
}
- ckfree(thisBB);
+ Tcl_Free(thisBB);
}
/*
@@ -1273,7 +1271,7 @@ AssembleOneLine(
Tcl_Obj* operand1Obj = NULL;
/* First operand to the instruction */
const char* operand1; /* String rep of the operand */
- int operand1Len; /* String length of the operand */
+ size_t operand1Len; /* String length of the operand */
int opnd; /* Integer representation of an operand */
int litIndex; /* Literal pool index of a constant */
int localVar; /* LVT index of a local variable */
@@ -1546,7 +1544,7 @@ AssembleOneLine(
goto cleanup;
}
- jtPtr = (JumptableInfo*)ckalloc(sizeof(JumptableInfo));
+ jtPtr = (JumptableInfo*)Tcl_Alloc(sizeof(JumptableInfo));
Tcl_InitHashTable(&jtPtr->hashTable, TCL_STRING_KEYS);
assemEnvPtr->curr_bb->jumpLine = assemEnvPtr->cmdLine;
@@ -1945,7 +1943,7 @@ MoveExceptionRangesToBasicBlock(
curr_bb->foreignExceptionBase = savedExceptArrayNext;
curr_bb->foreignExceptionCount = exceptionCount;
curr_bb->foreignExceptions =
- (ExceptionRange*)ckalloc(exceptionCount * sizeof(ExceptionRange));
+ (ExceptionRange*)Tcl_Alloc(exceptionCount * sizeof(ExceptionRange));
memcpy(curr_bb->foreignExceptions,
envPtr->exceptArrayPtr + savedExceptArrayNext,
exceptionCount * sizeof(ExceptionRange));
@@ -2010,7 +2008,7 @@ CreateMirrorJumpTable(
* Allocate the jumptable.
*/
- jtPtr = (JumptableInfo*)ckalloc(sizeof(JumptableInfo));
+ jtPtr = (JumptableInfo*)Tcl_Alloc(sizeof(JumptableInfo));
jtHashPtr = &jtPtr->hashTable;
Tcl_InitHashTable(jtHashPtr, TCL_STRING_KEYS);
@@ -2075,7 +2073,7 @@ DeleteMirrorJumpTable(
Tcl_SetHashValue(entry, NULL);
}
Tcl_DeleteHashTable(jtHashPtr);
- ckfree(jtPtr);
+ Tcl_Free(jtPtr);
}
/*
@@ -2318,7 +2316,7 @@ FindLocalVar(
* source code. */
Tcl_Obj* varNameObj; /* Name of the variable */
const char* varNameStr;
- int varNameLen;
+ size_t varNameLen;
int localVar; /* Index of the variable in the LVT */
if (GetNextOperand(assemEnvPtr, tokenPtrPtr, &varNameObj) != TCL_OK) {
@@ -2658,7 +2656,7 @@ AllocBB(
AssemblyEnv* assemEnvPtr) /* Assembly environment */
{
CompileEnv* envPtr = assemEnvPtr->envPtr;
- BasicBlock *bb = (BasicBlock*)ckalloc(sizeof(BasicBlock));
+ BasicBlock *bb = (BasicBlock*)Tcl_Alloc(sizeof(BasicBlock));
bb->originalStartOffset =
bb->startOffset = envPtr->codeNext - envPtr->codeStart;
@@ -3936,8 +3934,8 @@ BuildExceptionRanges(
* Allocate memory for a stack of active catches.
*/
- catches = (BasicBlock**)ckalloc(maxCatchDepth * sizeof(BasicBlock*));
- catchIndices = (int *)ckalloc(maxCatchDepth * sizeof(int));
+ catches = (BasicBlock**)Tcl_Alloc(maxCatchDepth * sizeof(BasicBlock*));
+ catchIndices = (int *)Tcl_Alloc(maxCatchDepth * sizeof(int));
for (i = 0; i < maxCatchDepth; ++i) {
catches[i] = NULL;
catchIndices[i] = -1;
@@ -3976,8 +3974,8 @@ BuildExceptionRanges(
/* Free temp storage */
- ckfree(catchIndices);
- ckfree(catches);
+ Tcl_Free(catchIndices);
+ Tcl_Free(catches);
return TCL_OK;
}
diff --git a/generic/tclAsync.c b/generic/tclAsync.c
index c432e4f..8b0b61e 100644
--- a/generic/tclAsync.c
+++ b/generic/tclAsync.c
@@ -118,7 +118,7 @@ Tcl_AsyncCreate(
AsyncHandler *asyncPtr;
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
- asyncPtr = (AsyncHandler*)ckalloc(sizeof(AsyncHandler));
+ asyncPtr = (AsyncHandler*)Tcl_Alloc(sizeof(AsyncHandler));
asyncPtr->ready = 0;
asyncPtr->nextPtr = NULL;
asyncPtr->proc = proc;
@@ -310,7 +310,7 @@ Tcl_AsyncDelete(
}
}
Tcl_MutexUnlock(&tsdPtr->asyncMutex);
- ckfree(asyncPtr);
+ Tcl_Free(asyncPtr);
}
/*
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index f3a75bb..867acca 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -78,18 +78,6 @@
#endif
/*
- * The following structure defines the client data for a math function
- * registered with Tcl_CreateMathFunc
- */
-
-typedef struct OldMathFuncData {
- Tcl_MathProc *proc; /* Handler function */
- int numArgs; /* Number of args expected */
- Tcl_ValueType *argTypes; /* Types of the args */
- ClientData clientData; /* Client data for the handler function */
-} OldMathFuncData;
-
-/*
* This is the script cancellation struct and hash table. The hash table is
* used to keep track of the information necessary to process script
* cancellation requests, including the original interp, asynchronous handler
@@ -105,7 +93,7 @@ typedef struct {
* cancellation. */
char *result; /* The script cancellation result or NULL for
* a default result. */
- int length; /* Length of the above error message. */
+ size_t length; /* Length of the above error message. */
ClientData clientData; /* Ignored */
int flags; /* Additional flags */
} CancelInfo;
@@ -190,10 +178,6 @@ static Tcl_NRPostProc NRCoroutineCallerCallback;
static Tcl_NRPostProc NRCoroutineExitCallback;
static Tcl_NRPostProc NRCommand;
-#if !defined(TCL_NO_DEPRECATED)
-static Tcl_ObjCmdProc OldMathFuncProc;
-static void OldMathFuncDeleteProc(ClientData clientData);
-#endif /* !defined(TCL_NO_DEPRECATED) */
static void ProcessUnexpectedResult(Tcl_Interp *interp,
int returnCode);
static int RewindCoroutine(CoroutineData *corPtr, int result);
@@ -288,9 +272,6 @@ static const CmdInfo builtInCmds[] = {
{"append", Tcl_AppendObjCmd, TclCompileAppendCmd, NULL, CMD_IS_SAFE},
{"apply", Tcl_ApplyObjCmd, NULL, TclNRApplyObjCmd, CMD_IS_SAFE},
{"break", Tcl_BreakObjCmd, TclCompileBreakCmd, NULL, CMD_IS_SAFE},
-#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
- {"case", Tcl_CaseObjCmd, NULL, NULL, CMD_IS_SAFE},
-#endif
{"catch", Tcl_CatchObjCmd, TclCompileCatchCmd, TclNRCatchObjCmd, CMD_IS_SAFE},
{"concat", Tcl_ConcatObjCmd, TclCompileConcatCmd, NULL, CMD_IS_SAFE},
{"continue", Tcl_ContinueObjCmd, TclCompileContinueCmd, NULL, CMD_IS_SAFE},
@@ -657,23 +638,15 @@ Tcl_CreateInterp(void)
Tcl_Panic("Tcl_CallFrame must not be smaller than CallFrame");
}
-#if defined(_WIN32) && !defined(_WIN64) && !defined(_USE_64BIT_TIME_T) \
- && !defined(__MINGW_USE_VC2005_COMPAT)
- /* If Tcl is compiled on Win32 using -D_USE_64BIT_TIME_T or
- * -D__MINGW_USE_VC2005_COMPAT, the result is a binary incompatible
- * with the 'standard' build of Tcl: All extensions using Tcl_StatBuf
- * or interal functions like TclpGetDate() need to be recompiled in
- * the same way. Therefore, this is not officially supported.
- * In stead, it is recommended to use Win64 or Tcl 9.0 (not released yet)
- */
- if (sizeof(time_t) != 4) {
+#if defined(_WIN32) && !defined(_WIN64)
+ if (sizeof(time_t) != 8) {
/*NOTREACHED*/
- Tcl_Panic("<time.h> is not compatible with MSVC");
+ Tcl_Panic("<time.h> is not compatible with VS2005+");
}
if ((offsetof(Tcl_StatBuf,st_atime) != 32)
- || (offsetof(Tcl_StatBuf,st_ctime) != 40)) {
+ || (offsetof(Tcl_StatBuf,st_ctime) != 48)) {
/*NOTREACHED*/
- Tcl_Panic("<sys/stat.h> is not compatible with MSVC");
+ Tcl_Panic("<sys/stat.h> is not compatible with VS2005+");
}
#endif
@@ -706,16 +679,15 @@ Tcl_CreateInterp(void)
* object type table and other object management code.
*/
- iPtr = ckalloc(sizeof(Interp));
+ iPtr = Tcl_Alloc(sizeof(Interp));
interp = (Tcl_Interp *) iPtr;
-#ifdef TCL_NO_DEPRECATED
- iPtr->result = &tclEmptyString;
-#else
- iPtr->result = iPtr->resultSpace;
-#endif
- iPtr->freeProc = NULL;
+ iPtr->legacyResult = NULL;
+ /* Special invalid value: Any attempt to free the legacy result
+ * will cause a crash. */
+ iPtr->legacyFreeProc = (void (*) (void))-1;
iPtr->errorLine = 0;
+ iPtr->stubTable = &tclStubs;
iPtr->objResultPtr = Tcl_NewObj();
Tcl_IncrRefCount(iPtr->objResultPtr);
iPtr->handle = TclHandleCreate(iPtr);
@@ -723,8 +695,7 @@ Tcl_CreateInterp(void)
iPtr->hiddenCmdTablePtr = NULL;
iPtr->interpInfo = NULL;
- TCL_CT_ASSERT(sizeof(iPtr->extra) <= sizeof(Tcl_HashTable));
- iPtr->extra.optimizer = TclOptimizeBytecode;
+ iPtr->optimizer = TclOptimizeBytecode;
iPtr->numLevels = 0;
iPtr->maxNestingDepth = MAX_NESTING_DEPTH;
@@ -737,10 +708,10 @@ Tcl_CreateInterp(void)
*/
iPtr->cmdFramePtr = NULL;
- iPtr->linePBodyPtr = ckalloc(sizeof(Tcl_HashTable));
- iPtr->lineBCPtr = ckalloc(sizeof(Tcl_HashTable));
- iPtr->lineLAPtr = ckalloc(sizeof(Tcl_HashTable));
- iPtr->lineLABCPtr = ckalloc(sizeof(Tcl_HashTable));
+ iPtr->linePBodyPtr = Tcl_Alloc(sizeof(Tcl_HashTable));
+ iPtr->lineBCPtr = Tcl_Alloc(sizeof(Tcl_HashTable));
+ iPtr->lineLAPtr = Tcl_Alloc(sizeof(Tcl_HashTable));
+ iPtr->lineLABCPtr = Tcl_Alloc(sizeof(Tcl_HashTable));
Tcl_InitHashTable(iPtr->linePBodyPtr, TCL_ONE_WORD_KEYS);
Tcl_InitHashTable(iPtr->lineBCPtr, TCL_ONE_WORD_KEYS);
Tcl_InitHashTable(iPtr->lineLAPtr, TCL_ONE_WORD_KEYS);
@@ -773,12 +744,6 @@ Tcl_CreateInterp(void)
iPtr->rootFramePtr = NULL; /* Initialise as soon as :: is available */
iPtr->lookupNsPtr = NULL;
-#ifndef TCL_NO_DEPRECATED
- iPtr->appendResult = NULL;
- iPtr->appendAvl = 0;
- iPtr->appendUsed = 0;
-#endif
-
Tcl_InitHashTable(&iPtr->packageTable, TCL_STRING_KEYS);
iPtr->packageUnknown = NULL;
@@ -807,9 +772,6 @@ Tcl_CreateInterp(void)
iPtr->emptyObjPtr = Tcl_NewObj();
/* Another empty object. */
Tcl_IncrRefCount(iPtr->emptyObjPtr);
-#ifndef TCL_NO_DEPRECATED
- iPtr->resultSpace[0] = 0;
-#endif
iPtr->threadId = Tcl_GetCurrentThread();
/* TIP #378 */
@@ -843,7 +805,7 @@ Tcl_CreateInterp(void)
*/
/* This is needed to satisfy GCC 3.3's strict aliasing rules */
- framePtr = ckalloc(sizeof(CallFrame));
+ framePtr = Tcl_Alloc(sizeof(CallFrame));
(void) Tcl_PushCallFrame(interp, (Tcl_CallFrame *) framePtr,
(Tcl_Namespace *) iPtr->globalNsPtr, /*isProcCallFrame*/ 0);
framePtr->objc = 0;
@@ -873,7 +835,7 @@ Tcl_CreateInterp(void)
iPtr->asyncCancelMsg = Tcl_NewObj();
- cancelInfo = ckalloc(sizeof(CancelInfo));
+ cancelInfo = Tcl_Alloc(sizeof(CancelInfo));
cancelInfo->interp = interp;
iPtr->asyncCancel = Tcl_AsyncCreate(CancelEvalProc, cancelInfo);
@@ -920,12 +882,6 @@ Tcl_CreateInterp(void)
#endif /* TCL_COMPILE_STATS */
/*
- * Initialise the stub table pointer.
- */
-
- iPtr->stubTable = &tclStubs;
-
- /*
* Initialize the ensemble error message rewriting support.
*/
@@ -972,7 +928,7 @@ Tcl_CreateInterp(void)
hPtr = Tcl_CreateHashEntry(&iPtr->globalNsPtr->cmdTable,
cmdInfoPtr->name, &isNew);
if (isNew) {
- cmdPtr = ckalloc(sizeof(Command));
+ cmdPtr = Tcl_Alloc(sizeof(Command));
cmdPtr->hPtr = hPtr;
cmdPtr->nsPtr = iPtr->globalNsPtr;
cmdPtr->refCount = 1;
@@ -1102,7 +1058,7 @@ Tcl_CreateInterp(void)
#define MATH_OP_PREFIX_LEN 15 /* == strlen("::tcl::mathop::") */
memcpy(mathFuncName, "::tcl::mathop::", MATH_OP_PREFIX_LEN);
for (opcmdInfoPtr=mathOpCmds ; opcmdInfoPtr->name!=NULL ; opcmdInfoPtr++){
- TclOpCmdClientData *occdPtr = ckalloc(sizeof(TclOpCmdClientData));
+ TclOpCmdClientData *occdPtr = Tcl_Alloc(sizeof(TclOpCmdClientData));
occdPtr->op = opcmdInfoPtr->name;
occdPtr->i.numArgs = opcmdInfoPtr->i.numArgs;
@@ -1160,11 +1116,6 @@ Tcl_CreateInterp(void)
Tcl_SetVar2(interp, "tcl_patchLevel", NULL, TCL_PATCH_LEVEL, TCL_GLOBAL_ONLY);
Tcl_SetVar2(interp, "tcl_version", NULL, TCL_VERSION, TCL_GLOBAL_ONLY);
-#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
- Tcl_TraceVar2(interp, "tcl_precision", NULL,
- TCL_GLOBAL_ONLY|TCL_TRACE_READS|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
- TclPrecTraceProc, NULL);
-#endif /* !TCL_NO_DEPRECATED */
TclpSetVariables(interp);
#if TCL_THREADS
@@ -1186,11 +1137,11 @@ Tcl_CreateInterp(void)
Tcl_PkgProvideEx(interp, "Tcl", TCL_PATCH_LEVEL, &tclStubs);
if (TclTommath_Init(interp) != TCL_OK) {
- Tcl_Panic("%s", TclGetString(Tcl_GetObjResult(interp)));
+ Tcl_Panic("%s", Tcl_GetStringResult(interp));
}
if (TclOOInit(interp) != TCL_OK) {
- Tcl_Panic("%s", TclGetString(Tcl_GetObjResult(interp)));
+ Tcl_Panic("%s", Tcl_GetStringResult(interp));
}
/*
@@ -1200,10 +1151,10 @@ Tcl_CreateInterp(void)
#ifdef HAVE_ZLIB
if (TclZlibInit(interp) != TCL_OK) {
- Tcl_Panic("%s", TclGetString(Tcl_GetObjResult(interp)));
+ Tcl_Panic("%s", Tcl_GetStringResult(interp));
}
if (TclZipfs_Init(interp) != TCL_OK) {
- Tcl_Panic("%s", Tcl_GetString(Tcl_GetObjResult(interp)));
+ Tcl_Panic("%s", Tcl_GetStringResult(interp));
}
#endif
@@ -1217,7 +1168,7 @@ DeleteOpCmdClientData(
{
TclOpCmdClientData *occdPtr = clientData;
- ckfree(occdPtr);
+ Tcl_Free(occdPtr);
}
/*
@@ -1335,7 +1286,7 @@ TclHideUnsafeCommands(
TclGetString(hideName)) != TCL_OK) {
Tcl_Panic("problem making '%s %s' safe: %s",
unsafePtr->ensembleNsName, unsafePtr->commandName,
- Tcl_GetString(Tcl_GetObjResult(interp)));
+ Tcl_GetStringResult(interp));
}
Tcl_CreateObjCommand(interp, TclGetString(cmdName),
BadEnsembleSubcommand, (ClientData) unsafePtr, NULL);
@@ -1350,7 +1301,7 @@ TclHideUnsafeCommands(
unsafePtr->ensembleNsName) != TCL_OK) {
Tcl_Panic("problem making '%s' safe: %s",
unsafePtr->ensembleNsName,
- Tcl_GetString(Tcl_GetObjResult(interp)));
+ Tcl_GetStringResult(interp));
}
}
}
@@ -1426,14 +1377,14 @@ Tcl_CallWhenDeleted(
Tcl_GetThreadData(&assocDataCounterKey, sizeof(int));
int isNew;
char buffer[32 + TCL_INTEGER_SPACE];
- AssocData *dPtr = ckalloc(sizeof(AssocData));
+ AssocData *dPtr = Tcl_Alloc(sizeof(AssocData));
Tcl_HashEntry *hPtr;
sprintf(buffer, "Assoc Data Key #%d", *assocDataCounterPtr);
(*assocDataCounterPtr)++;
if (iPtr->assocData == NULL) {
- iPtr->assocData = ckalloc(sizeof(Tcl_HashTable));
+ iPtr->assocData = Tcl_Alloc(sizeof(Tcl_HashTable));
Tcl_InitHashTable(iPtr->assocData, TCL_STRING_KEYS);
}
hPtr = Tcl_CreateHashEntry(iPtr->assocData, buffer, &isNew);
@@ -1482,7 +1433,7 @@ Tcl_DontCallWhenDeleted(
hPtr = Tcl_NextHashEntry(&hSearch)) {
dPtr = Tcl_GetHashValue(hPtr);
if ((dPtr->proc == proc) && (dPtr->clientData == clientData)) {
- ckfree(dPtr);
+ Tcl_Free(dPtr);
Tcl_DeleteHashEntry(hPtr);
return;
}
@@ -1522,14 +1473,14 @@ Tcl_SetAssocData(
int isNew;
if (iPtr->assocData == NULL) {
- iPtr->assocData = ckalloc(sizeof(Tcl_HashTable));
+ iPtr->assocData = Tcl_Alloc(sizeof(Tcl_HashTable));
Tcl_InitHashTable(iPtr->assocData, TCL_STRING_KEYS);
}
hPtr = Tcl_CreateHashEntry(iPtr->assocData, name, &isNew);
if (isNew == 0) {
dPtr = Tcl_GetHashValue(hPtr);
} else {
- dPtr = ckalloc(sizeof(AssocData));
+ dPtr = Tcl_Alloc(sizeof(AssocData));
}
dPtr->proc = proc;
dPtr->clientData = clientData;
@@ -1574,7 +1525,7 @@ Tcl_DeleteAssocData(
if (dPtr->proc != NULL) {
dPtr->proc(dPtr->clientData, interp);
}
- ckfree(dPtr);
+ Tcl_Free(dPtr);
Tcl_DeleteHashEntry(hPtr);
}
@@ -1770,9 +1721,9 @@ DeleteInterpProc(
if (cancelInfo != NULL) {
if (cancelInfo->result != NULL) {
- ckfree(cancelInfo->result);
+ Tcl_Free(cancelInfo->result);
}
- ckfree(cancelInfo);
+ Tcl_Free(cancelInfo);
}
Tcl_DeleteHashEntry(hPtr);
@@ -1827,7 +1778,7 @@ DeleteInterpProc(
Tcl_DeleteCommandFromToken(interp, Tcl_GetHashValue(hPtr));
}
Tcl_DeleteHashTable(hTablePtr);
- ckfree(hTablePtr);
+ Tcl_Free(hTablePtr);
}
/*
@@ -1848,10 +1799,10 @@ DeleteInterpProc(
if (dPtr->proc != NULL) {
dPtr->proc(dPtr->clientData, interp);
}
- ckfree(dPtr);
+ Tcl_Free(dPtr);
}
Tcl_DeleteHashTable(hTablePtr);
- ckfree(hTablePtr);
+ Tcl_Free(hTablePtr);
}
/*
@@ -1863,7 +1814,7 @@ DeleteInterpProc(
Tcl_Panic("DeleteInterpProc: popping rootCallFrame with other frames on top");
}
Tcl_PopCallFrame(interp);
- ckfree(iPtr->rootFramePtr);
+ Tcl_Free(iPtr->rootFramePtr);
iPtr->rootFramePtr = NULL;
Tcl_DeleteNamespace((Tcl_Namespace *) iPtr->globalNsPtr);
@@ -1873,7 +1824,6 @@ DeleteInterpProc(
*/
Tcl_FreeResult(interp);
- iPtr->result = NULL;
Tcl_DecrRefCount(iPtr->objResultPtr);
iPtr->objResultPtr = NULL;
Tcl_DecrRefCount(iPtr->ecVar);
@@ -1895,12 +1845,6 @@ DeleteInterpProc(
if (iPtr->returnOpts) {
Tcl_DecrRefCount(iPtr->returnOpts);
}
-#ifndef TCL_NO_DEPRECATED
- if (iPtr->appendResult != NULL) {
- ckfree(iPtr->appendResult);
- iPtr->appendResult = NULL;
- }
-#endif
TclFreePackageInfo(iPtr);
while (iPtr->tracePtr != NULL) {
Tcl_DeleteTrace((Tcl_Interp *) iPtr, (Tcl_Trace) iPtr->tracePtr);
@@ -1918,8 +1862,8 @@ DeleteInterpProc(
resPtr = iPtr->resolverPtr;
while (resPtr) {
nextResPtr = resPtr->nextPtr;
- ckfree(resPtr->name);
- ckfree(resPtr);
+ Tcl_Free(resPtr->name);
+ Tcl_Free(resPtr);
resPtr = nextResPtr;
}
@@ -1946,13 +1890,13 @@ DeleteInterpProc(
if (cfPtr->type == TCL_LOCATION_SOURCE) {
Tcl_DecrRefCount(cfPtr->data.eval.path);
}
- ckfree(cfPtr->line);
- ckfree(cfPtr);
+ Tcl_Free(cfPtr->line);
+ Tcl_Free(cfPtr);
}
Tcl_DeleteHashEntry(hPtr);
}
Tcl_DeleteHashTable(iPtr->linePBodyPtr);
- ckfree(iPtr->linePBodyPtr);
+ Tcl_Free(iPtr->linePBodyPtr);
iPtr->linePBodyPtr = NULL;
/*
@@ -1968,18 +1912,18 @@ DeleteInterpProc(
Tcl_DecrRefCount(eclPtr->path);
}
for (i=0; i< eclPtr->nuloc; i++) {
- ckfree(eclPtr->loc[i].line);
+ Tcl_Free(eclPtr->loc[i].line);
}
if (eclPtr->loc != NULL) {
- ckfree(eclPtr->loc);
+ Tcl_Free(eclPtr->loc);
}
- ckfree(eclPtr);
+ Tcl_Free(eclPtr);
Tcl_DeleteHashEntry(hPtr);
}
Tcl_DeleteHashTable(iPtr->lineBCPtr);
- ckfree(iPtr->lineBCPtr);
+ Tcl_Free(iPtr->lineBCPtr);
iPtr->lineBCPtr = NULL;
/*
@@ -1998,7 +1942,7 @@ DeleteInterpProc(
}
Tcl_DeleteHashTable(iPtr->lineLAPtr);
- ckfree(iPtr->lineLAPtr);
+ Tcl_Free(iPtr->lineLAPtr);
iPtr->lineLAPtr = NULL;
if (iPtr->lineLABCPtr->numEntries && !TclInExit()) {
@@ -2011,7 +1955,7 @@ DeleteInterpProc(
}
Tcl_DeleteHashTable(iPtr->lineLABCPtr);
- ckfree(iPtr->lineLABCPtr);
+ Tcl_Free(iPtr->lineLABCPtr);
iPtr->lineLABCPtr = NULL;
/*
@@ -2022,7 +1966,7 @@ DeleteInterpProc(
Tcl_DeleteHashTable(&iPtr->varTraces);
Tcl_DeleteHashTable(&iPtr->varSearches);
- ckfree(iPtr);
+ Tcl_Free(iPtr);
}
/*
@@ -2126,7 +2070,7 @@ Tcl_HideCommand(
hiddenCmdTablePtr = iPtr->hiddenCmdTablePtr;
if (hiddenCmdTablePtr == NULL) {
- hiddenCmdTablePtr = ckalloc(sizeof(Tcl_HashTable));
+ hiddenCmdTablePtr = Tcl_Alloc(sizeof(Tcl_HashTable));
Tcl_InitHashTable(hiddenCmdTablePtr, TCL_STRING_KEYS);
iPtr->hiddenCmdTablePtr = hiddenCmdTablePtr;
}
@@ -2492,7 +2436,7 @@ Tcl_CreateCommand(
* infinite loop).
*/
- ckfree(Tcl_GetHashValue(hPtr));
+ Tcl_Free(Tcl_GetHashValue(hPtr));
}
if (!deleted) {
@@ -2517,7 +2461,7 @@ Tcl_CreateCommand(
TclInvalidateNsCmdLookup(nsPtr);
TclInvalidateNsPath(nsPtr);
}
- cmdPtr = ckalloc(sizeof(Command));
+ cmdPtr = Tcl_Alloc(sizeof(Command));
Tcl_SetHashValue(hPtr, cmdPtr);
cmdPtr->hPtr = hPtr;
cmdPtr->nsPtr = nsPtr;
@@ -2575,7 +2519,6 @@ Tcl_CreateCommand(
* Side effects:
* If a command named "cmdName" already exists for interp, it is
* first deleted. Then the new command is created from the arguments.
- * [***] (See below for exception).
*
* In the future, during bytecode evaluation when "cmdName" is seen as
* the name of a command by Tcl_EvalObj or Tcl_Eval, the object-based
@@ -2684,24 +2627,7 @@ TclCreateObjCommandInNs(
cmdPtr = Tcl_GetHashValue(hPtr);
/*
- * [***] This is wrong. See Tcl Bug a16752c252.
- * However, this buggy behavior is kept under particular circumstances
- * to accommodate deployed binaries of the "tclcompiler" program
- * <http://sourceforge.net/projects/tclpro/> that crash if the bug is
- * fixed.
- */
-
- if (cmdPtr->objProc == TclInvokeStringCommand
- && cmdPtr->clientData == clientData
- && cmdPtr->deleteData == clientData
- && cmdPtr->deleteProc == deleteProc) {
- cmdPtr->objProc = proc;
- cmdPtr->objClientData = clientData;
- return (Tcl_Command) cmdPtr;
- }
-
- /*
- * Otherwise, we delete the old command. Be careful to preserve any
+ * Command already exists; delete it. Be careful to preserve any
* existing import links so we can restore them down below. That way,
* you can redefine a command and its import status will remain
* intact.
@@ -2737,7 +2663,7 @@ TclCreateObjCommandInNs(
* infinite loop).
*/
- ckfree(Tcl_GetHashValue(hPtr));
+ Tcl_Free(Tcl_GetHashValue(hPtr));
}
if (!deleted) {
@@ -2762,7 +2688,7 @@ TclCreateObjCommandInNs(
TclInvalidateNsCmdLookup(nsPtr);
TclInvalidateNsPath(nsPtr);
}
- cmdPtr = ckalloc(sizeof(Command));
+ cmdPtr = Tcl_Alloc(sizeof(Command));
Tcl_SetHashValue(hPtr, cmdPtr);
cmdPtr->hPtr = hPtr;
cmdPtr->nsPtr = nsPtr;
@@ -2908,13 +2834,6 @@ TclInvokeObjectCommand(
}
/*
- * Move the interpreter's object result to the string result, then reset
- * the object result.
- */
-
- (void) Tcl_GetStringResult(interp);
-
- /*
* Decrement the ref counts for the argument objects created above, then
* free the objv array if malloc'ed storage was used.
*/
@@ -3524,7 +3443,7 @@ Tcl_DeleteCommandFromToken(
CommandTrace *nextPtr = tracePtr->nextPtr;
if (tracePtr->refCount-- <= 1) {
- ckfree(tracePtr);
+ Tcl_Free(tracePtr);
}
tracePtr = nextPtr;
}
@@ -3563,10 +3482,10 @@ Tcl_DeleteCommandFromToken(
* If you are getting a crash during the call to deleteProc and
* cmdPtr->deleteProc is a pointer to the function free(), the most
* likely cause is that your extension allocated memory for the
- * clientData argument to Tcl_CreateObjCommand with the ckalloc()
+ * clientData argument to Tcl_CreateObjCommand with the Tcl_Alloc()
* macro and you are now trying to deallocate this memory with free()
- * instead of ckfree(). You should pass a pointer to your own method
- * that calls ckfree().
+ * instead of Tcl_Free(). You should pass a pointer to your own method
+ * that calls Tcl_Free().
*/
cmdPtr->deleteProc(cmdPtr->deleteData);
@@ -3718,7 +3637,7 @@ CallCommandTraces(
oldName, newName, flags);
cmdPtr->flags &= ~tracePtr->flags;
if (tracePtr->refCount-- <= 1) {
- ckfree(tracePtr);
+ Tcl_Free(tracePtr);
}
}
@@ -3850,374 +3769,13 @@ TclCleanupCommand(
* be freed. */
{
if (cmdPtr->refCount-- <= 1) {
- ckfree(cmdPtr);
+ Tcl_Free(cmdPtr);
}
}
/*
*----------------------------------------------------------------------
*
- * Tcl_CreateMathFunc --
- *
- * Creates a new math function for expressions in a given interpreter.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The Tcl function defined by "name" is created or redefined. If the
- * function already exists then its definition is replaced; this includes
- * the builtin functions. Redefining a builtin function forces all
- * existing code to be invalidated since that code may be compiled using
- * an instruction specific to the replaced function. In addition,
- * redefioning a non-builtin function will force existing code to be
- * invalidated if the number of arguments has changed.
- *
- *----------------------------------------------------------------------
- */
-
-#if !defined(TCL_NO_DEPRECATED)
-void
-Tcl_CreateMathFunc(
- Tcl_Interp *interp, /* Interpreter in which function is to be
- * available. */
- const char *name, /* Name of function (e.g. "sin"). */
- int numArgs, /* Nnumber of arguments required by
- * function. */
- Tcl_ValueType *argTypes, /* Array of types acceptable for each
- * argument. */
- Tcl_MathProc *proc, /* C function that implements the math
- * function. */
- ClientData clientData) /* Additional value to pass to the
- * function. */
-{
- Tcl_DString bigName;
- OldMathFuncData *data = ckalloc(sizeof(OldMathFuncData));
-
- data->proc = proc;
- data->numArgs = numArgs;
- data->argTypes = ckalloc(numArgs * sizeof(Tcl_ValueType));
- memcpy(data->argTypes, argTypes, numArgs * sizeof(Tcl_ValueType));
- data->clientData = clientData;
-
- Tcl_DStringInit(&bigName);
- TclDStringAppendLiteral(&bigName, "::tcl::mathfunc::");
- Tcl_DStringAppend(&bigName, name, -1);
-
- Tcl_CreateObjCommand(interp, Tcl_DStringValue(&bigName),
- OldMathFuncProc, data, OldMathFuncDeleteProc);
- Tcl_DStringFree(&bigName);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * OldMathFuncProc --
- *
- * Dispatch to a math function created with Tcl_CreateMathFunc
- *
- * Results:
- * Returns a standard Tcl result.
- *
- * Side effects:
- * Whatever the math function does.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-OldMathFuncProc(
- ClientData clientData, /* Pointer to OldMathFuncData describing the
- * function being called */
- Tcl_Interp *interp, /* Tcl interpreter */
- int objc, /* Actual parameter count */
- Tcl_Obj *const *objv) /* Parameter vector */
-{
- Tcl_Obj *valuePtr;
- OldMathFuncData *dataPtr = clientData;
- Tcl_Value funcResult, *args;
- int result;
- int j, k;
- double d;
-
- /*
- * Check argument count.
- */
-
- if (objc != dataPtr->numArgs + 1) {
- MathFuncWrongNumArgs(interp, dataPtr->numArgs+1, objc, objv);
- return TCL_ERROR;
- }
-
- /*
- * Convert arguments from Tcl_Obj's to Tcl_Value's.
- */
-
- args = ckalloc(dataPtr->numArgs * sizeof(Tcl_Value));
- for (j = 1, k = 0; j < objc; ++j, ++k) {
- /* TODO: Convert to TclGetNumberFromObj? */
- valuePtr = objv[j];
- result = Tcl_GetDoubleFromObj(NULL, valuePtr, &d);
-#ifdef ACCEPT_NAN
- if (result != TCL_OK) {
- const Tcl_ObjIntRep *irPtr
- = TclFetchIntRep(valuePtr, &tclDoubleType);
-
- if (irPtr) {
- d = irPtr->doubleValue;
- result = TCL_OK;
- }
- }
-#endif
- if (result != TCL_OK) {
- /*
- * We have a non-numeric argument.
- */
-
- Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "argument to math function didn't have numeric value",
- -1));
- TclCheckBadOctal(interp, TclGetString(valuePtr));
- ckfree(args);
- return TCL_ERROR;
- }
-
- /*
- * Copy the object's numeric value to the argument record, converting
- * it if necessary.
- *
- * NOTE: no bignum support; use the new mathfunc interface for that.
- */
-
- args[k].type = dataPtr->argTypes[k];
- switch (args[k].type) {
- case TCL_EITHER:
- if (Tcl_GetLongFromObj(NULL, valuePtr, &args[k].intValue)
- == TCL_OK) {
- args[k].type = TCL_INT;
- break;
- }
- if (TclGetWideIntFromObj(interp, valuePtr, &args[k].wideValue)
- == TCL_OK) {
- args[k].type = TCL_WIDE_INT;
- break;
- }
- args[k].type = TCL_DOUBLE;
- /* FALLTHROUGH */
-
- case TCL_DOUBLE:
- args[k].doubleValue = d;
- break;
- case TCL_INT:
- if (ExprIntFunc(NULL, interp, 2, &objv[j-1]) != TCL_OK) {
- ckfree(args);
- return TCL_ERROR;
- }
- valuePtr = Tcl_GetObjResult(interp);
- Tcl_GetLongFromObj(NULL, valuePtr, &args[k].intValue);
- Tcl_ResetResult(interp);
- break;
- case TCL_WIDE_INT:
- if (ExprWideFunc(NULL, interp, 2, &objv[j-1]) != TCL_OK) {
- ckfree(args);
- return TCL_ERROR;
- }
- valuePtr = Tcl_GetObjResult(interp);
- TclGetWideIntFromObj(NULL, valuePtr, &args[k].wideValue);
- Tcl_ResetResult(interp);
- break;
- }
- }
-
- /*
- * Call the function.
- */
-
- errno = 0;
- result = dataPtr->proc(dataPtr->clientData, interp, args, &funcResult);
- ckfree(args);
- if (result != TCL_OK) {
- return result;
- }
-
- /*
- * Return the result of the call.
- */
-
- if (funcResult.type == TCL_INT) {
- TclNewIntObj(valuePtr, funcResult.intValue);
- } else if (funcResult.type == TCL_WIDE_INT) {
- valuePtr = Tcl_NewWideIntObj(funcResult.wideValue);
- } else {
- return CheckDoubleResult(interp, funcResult.doubleValue);
- }
- Tcl_SetObjResult(interp, valuePtr);
- return TCL_OK;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * OldMathFuncDeleteProc --
- *
- * Cleans up after deleting a math function registered with
- * Tcl_CreateMathFunc
- *
- * Results:
- * None.
- *
- * Side effects:
- * Frees allocated memory.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-OldMathFuncDeleteProc(
- ClientData clientData)
-{
- OldMathFuncData *dataPtr = clientData;
-
- ckfree(dataPtr->argTypes);
- ckfree(dataPtr);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * Tcl_GetMathFuncInfo --
- *
- * Discovers how a particular math function was created in a given
- * interpreter.
- *
- * Results:
- * TCL_OK if it succeeds, TCL_ERROR else (leaving an error message in the
- * interpreter result if that happens.)
- *
- * Side effects:
- * If this function succeeds, the variables pointed to by the numArgsPtr
- * and argTypePtr arguments will be updated to detail the arguments
- * allowed by the function. The variable pointed to by the procPtr
- * argument will be set to NULL if the function is a builtin function,
- * and will be set to the address of the C function used to implement the
- * math function otherwise (in which case the variable pointed to by the
- * clientDataPtr argument will also be updated.)
- *
- *----------------------------------------------------------------------
- */
-
-int
-Tcl_GetMathFuncInfo(
- Tcl_Interp *interp,
- const char *name,
- int *numArgsPtr,
- Tcl_ValueType **argTypesPtr,
- Tcl_MathProc **procPtr,
- ClientData *clientDataPtr)
-{
- Tcl_Obj *cmdNameObj;
- Command *cmdPtr;
-
- /*
- * Get the command that implements the math function.
- */
-
- TclNewLiteralStringObj(cmdNameObj, "tcl::mathfunc::");
- Tcl_AppendToObj(cmdNameObj, name, -1);
- Tcl_IncrRefCount(cmdNameObj);
- cmdPtr = (Command *) Tcl_GetCommandFromObj(interp, cmdNameObj);
- Tcl_DecrRefCount(cmdNameObj);
-
- /*
- * Report unknown functions.
- */
-
- if (cmdPtr == NULL) {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "unknown math function \"%s\"", name));
- Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "MATHFUNC", name, NULL);
- *numArgsPtr = -1;
- *argTypesPtr = NULL;
- *procPtr = NULL;
- *clientDataPtr = NULL;
- return TCL_ERROR;
- }
-
- /*
- * Retrieve function info for user defined functions; return dummy
- * information for builtins.
- */
-
- if (cmdPtr->objProc == &OldMathFuncProc) {
- OldMathFuncData *dataPtr = cmdPtr->clientData;
-
- *procPtr = dataPtr->proc;
- *numArgsPtr = dataPtr->numArgs;
- *argTypesPtr = dataPtr->argTypes;
- *clientDataPtr = dataPtr->clientData;
- } else {
- *procPtr = NULL;
- *numArgsPtr = -1;
- *argTypesPtr = NULL;
- *procPtr = NULL;
- *clientDataPtr = NULL;
- }
- return TCL_OK;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * Tcl_ListMathFuncs --
- *
- * Produces a list of all the math functions defined in a given
- * interpreter.
- *
- * Results:
- * A pointer to a Tcl_Obj structure with a reference count of zero, or
- * NULL in the case of an error (in which case a suitable error message
- * will be left in the interpreter result.)
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-Tcl_Obj *
-Tcl_ListMathFuncs(
- Tcl_Interp *interp,
- const char *pattern)
-{
- Tcl_Obj *script = Tcl_NewStringObj("::info functions ", -1);
- Tcl_Obj *result;
- Tcl_InterpState state;
-
- if (pattern) {
- Tcl_Obj *patternObj = Tcl_NewStringObj(pattern, -1);
- Tcl_Obj *arg = Tcl_NewListObj(1, &patternObj);
-
- Tcl_AppendObjToObj(script, arg);
- Tcl_DecrRefCount(arg); /* Should tear down patternObj too */
- }
-
- state = Tcl_SaveInterpState(interp, TCL_OK);
- Tcl_IncrRefCount(script);
- if (TCL_OK == Tcl_EvalObjEx(interp, script, 0)) {
- result = Tcl_DuplicateObj(Tcl_GetObjResult(interp));
- } else {
- result = Tcl_NewObj();
- }
- Tcl_DecrRefCount(script);
- Tcl_RestoreInterpState(interp, state);
-
- return result;
-}
-#endif /* !defined(TCL_NO_DEPRECATED) */
-
-/*
- *----------------------------------------------------------------------
- *
* TclInterpReady --
*
* Check if an interpreter is ready to eval commands or scripts, i.e., if
@@ -4228,7 +3786,7 @@ Tcl_ListMathFuncs(
* otherwise.
*
* Side effects:
- * The interpreters object and string results are cleared.
+ * The interpreter's result is cleared.
*
*----------------------------------------------------------------------
*/
@@ -4240,8 +3798,8 @@ TclInterpReady(
register Interp *iPtr = (Interp *) interp;
/*
- * Reset both the interpreter's string and object results and clear out
- * any previous error information.
+ * Reset the interpreter's result and clear out any previous error
+ * information.
*/
Tcl_ResetResult(interp);
@@ -4390,7 +3948,7 @@ Tcl_Canceled(
if (flags & TCL_LEAVE_ERR_MSG) {
const char *id, *message = NULL;
- int length;
+ size_t length;
/*
* Setup errorCode variables so that we can differentiate between
@@ -4498,7 +4056,7 @@ Tcl_CancelEval(
if (resultObjPtr != NULL) {
result = TclGetStringFromObj(resultObjPtr, &cancelInfo->length);
- cancelInfo->result = ckrealloc(cancelInfo->result,cancelInfo->length);
+ cancelInfo->result = Tcl_Realloc(cancelInfo->result,cancelInfo->length);
memcpy(cancelInfo->result, result, cancelInfo->length);
TclDecrRefCount(resultObjPtr); /* Discard their result object. */
} else {
@@ -4825,30 +4383,6 @@ TclNRRunCallbacks(
/* All callbacks down to rootPtr not inclusive
* are to be run. */
{
-#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
- Interp *iPtr = (Interp *) interp;
-#endif /* !defined(TCL_NO_DEPRECATED) */
-
- /*
- * If the interpreter has a non-empty string result, the result object is
- * either empty or stale because some function set interp->result
- * directly. If so, move the string result to the result object, then
- * reset the string result.
- *
- * This only needs to be done for the first item in the list: all other
- * are for NR function calls, and those are Tcl_Obj based.
- */
-
-#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
- if (*(iPtr->result) != 0) {
- (void) Tcl_GetObjResult(interp);
- }
-#endif /* !defined(TCL_NO_DEPRECATED) */
-
- /*
- * This is the trampoline.
- */
-
while (TOP_CB(interp) != rootPtr) {
NRE_callback *callbackPtr = TOP_CB(interp);
Tcl_NRPostProc *procPtr = callbackPtr->procPtr;
@@ -5008,7 +4542,7 @@ TEOV_Error(
Interp *iPtr = (Interp *) interp;
Tcl_Obj *listPtr;
const char *cmdString;
- int cmdLen;
+ size_t cmdLen;
int objc = PTR2INT(data[0]);
Tcl_Obj **objv = data[1];
@@ -5164,8 +4698,8 @@ TEOV_RunEnterTraces(
{
Interp *iPtr = (Interp *) interp;
Command *cmdPtr = *cmdPtrPtr;
- unsigned int newEpoch, cmdEpoch = cmdPtr->cmdEpoch;
- int length, traceCode = TCL_OK;
+ size_t length, newEpoch, cmdEpoch = cmdPtr->cmdEpoch;
+ int traceCode = TCL_OK;
const char *command = TclGetStringFromObj(commandPtr, &length);
/*
@@ -5217,7 +4751,7 @@ TEOV_RunLeaveTraces(
Tcl_Obj *commandPtr = data[1];
Command *cmdPtr = data[2];
Tcl_Obj **objv = data[3];
- int length;
+ size_t length;
const char *command = TclGetStringFromObj(commandPtr, &length);
if (!(cmdPtr->flags & CMD_IS_DELETED)) {
@@ -5300,63 +4834,13 @@ Tcl_EvalTokensStandard(
* errors. */
Tcl_Token *tokenPtr, /* Pointer to first in an array of tokens to
* evaluate and concatenate. */
- int count) /* Number of tokens to consider at tokenPtr.
+ size_t count) /* Number of tokens to consider at tokenPtr.
* Must be at least 1. */
{
return TclSubstTokens(interp, tokenPtr, count, /* numLeftPtr */ NULL, 1,
NULL, NULL);
}
-#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
-/*
- *----------------------------------------------------------------------
- *
- * Tcl_EvalTokens --
- *
- * Given an array of tokens parsed from a Tcl command (e.g., the tokens
- * that make up a word or the index for an array variable) this function
- * evaluates the tokens and concatenates their values to form a single
- * result value.
- *
- * Results:
- * The return value is a pointer to a newly allocated Tcl_Obj containing
- * the value of the array of tokens. The reference count of the returned
- * object has been incremented. If an error occurs in evaluating the
- * tokens then a NULL value is returned and an error message is left in
- * interp's result.
- *
- * Side effects:
- * A new object is allocated to hold the result.
- *
- *----------------------------------------------------------------------
- *
- * This uses a non-standard return convention; its use is now deprecated. It
- * is a wrapper for the new function Tcl_EvalTokensStandard, and is not used
- * in the core any longer. It is only kept for backward compatibility.
- */
-
-Tcl_Obj *
-Tcl_EvalTokens(
- Tcl_Interp *interp, /* Interpreter in which to lookup variables,
- * execute nested commands, and report
- * errors. */
- Tcl_Token *tokenPtr, /* Pointer to first in an array of tokens to
- * evaluate and concatenate. */
- int count) /* Number of tokens to consider at tokenPtr.
- * Must be at least 1. */
-{
- Tcl_Obj *resPtr;
-
- if (Tcl_EvalTokensStandard(interp, tokenPtr, count) != TCL_OK) {
- return NULL;
- }
- resPtr = Tcl_GetObjResult(interp);
- Tcl_IncrRefCount(resPtr);
- Tcl_ResetResult(interp);
- return resPtr;
-}
-#endif /* !TCL_NO_DEPRECATED */
-
/*
*----------------------------------------------------------------------
*
@@ -5383,7 +4867,7 @@ Tcl_EvalEx(
Tcl_Interp *interp, /* Interpreter in which to evaluate the
* script. Also used for error reporting. */
const char *script, /* First character of script to evaluate. */
- int numBytes, /* Number of bytes in script. If < 0, the
+ size_t numBytes, /* Number of bytes in script. If -1, the
* script consists of all bytes up to the
* first null character. */
int flags) /* Collection of OR-ed bits that control the
@@ -5398,7 +4882,7 @@ TclEvalEx(
Tcl_Interp *interp, /* Interpreter in which to evaluate the
* script. Also used for error reporting. */
const char *script, /* First character of script to evaluate. */
- int numBytes, /* Number of bytes in script. If < 0, the
+ size_t numBytes, /* Number of bytes in script. If -1, the
* script consists of all bytes up to the
* first NUL character. */
int flags, /* Collection of OR-ed bits that control the
@@ -5429,7 +4913,8 @@ TclEvalEx(
Tcl_Obj **objv, **objvSpace;
int *expand, *lines, *lineSpace;
Tcl_Token *tokenPtr;
- int commandLength, bytesLeft, expandRequested, code = TCL_OK;
+ int bytesLeft, expandRequested, code = TCL_OK;
+ size_t commandLength;
CallFrame *savedVarFramePtr;/* Saves old copy of iPtr->varFramePtr in case
* TCL_EVAL_GLOBAL was set. */
int allowExceptions = (iPtr->evalFlags & TCL_ALLOW_EXCEPTIONS);
@@ -5463,7 +4948,7 @@ TclEvalEx(
}
}
- if (numBytes < 0) {
+ if (numBytes == TCL_AUTO_LENGTH) {
numBytes = strlen(script);
}
Tcl_ResetResult(interp);
@@ -5580,9 +5065,9 @@ TclEvalEx(
*/
if (numWords > minObjs) {
- expand = ckalloc(numWords * sizeof(int));
- objvSpace = ckalloc(numWords * sizeof(Tcl_Obj *));
- lineSpace = ckalloc(numWords * sizeof(int));
+ expand = Tcl_Alloc(numWords * sizeof(int));
+ objvSpace = Tcl_Alloc(numWords * sizeof(Tcl_Obj *));
+ lineSpace = Tcl_Alloc(numWords * sizeof(int));
}
expandRequested = 0;
objv = objvSpace;
@@ -5668,8 +5153,8 @@ TclEvalEx(
if ((numWords > minObjs) || (objectsNeeded > minObjs)) {
objv = objvSpace =
- ckalloc(objectsNeeded * sizeof(Tcl_Obj *));
- lines = lineSpace = ckalloc(objectsNeeded * sizeof(int));
+ Tcl_Alloc(objectsNeeded * sizeof(Tcl_Obj *));
+ lines = lineSpace = Tcl_Alloc(objectsNeeded * sizeof(int));
}
objectsUsed = 0;
@@ -5696,10 +5181,10 @@ TclEvalEx(
objv += objIdx+1;
if (copy != stackObjArray) {
- ckfree(copy);
+ Tcl_Free(copy);
}
if (lcopy != linesStack) {
- ckfree(lcopy);
+ Tcl_Free(lcopy);
}
}
@@ -5744,9 +5229,9 @@ TclEvalEx(
}
objectsUsed = 0;
if (objvSpace != stackObjArray) {
- ckfree(objvSpace);
+ Tcl_Free(objvSpace);
objvSpace = stackObjArray;
- ckfree(lineSpace);
+ Tcl_Free(lineSpace);
lineSpace = linesStack;
}
@@ -5756,7 +5241,7 @@ TclEvalEx(
*/
if (expand != expandStack) {
- ckfree(expand);
+ Tcl_Free(expand);
expand = expandStack;
}
}
@@ -5822,11 +5307,11 @@ TclEvalEx(
Tcl_FreeParse(parsePtr);
}
if (objvSpace != stackObjArray) {
- ckfree(objvSpace);
- ckfree(lineSpace);
+ Tcl_Free(objvSpace);
+ Tcl_Free(lineSpace);
}
if (expand != expandStack) {
- ckfree(expand);
+ Tcl_Free(expand);
}
iPtr->varFramePtr = savedVarFramePtr;
@@ -5990,7 +5475,7 @@ TclArgumentEnter(
* and initialize references.
*/
- cfwPtr = ckalloc(sizeof(CFWord));
+ cfwPtr = Tcl_Alloc(sizeof(CFWord));
cfwPtr->framePtr = cfPtr;
cfwPtr->word = i;
cfwPtr->refCount = 1;
@@ -6050,7 +5535,7 @@ TclArgumentRelease(
continue;
}
- ckfree(cfwPtr);
+ Tcl_Free(cfwPtr);
Tcl_DeleteHashEntry(hPtr);
}
}
@@ -6083,7 +5568,7 @@ TclArgumentBCEnter(
void *codePtr,
CmdFrame *cfPtr,
int cmd,
- int pc)
+ size_t pc)
{
ExtCmdLoc *eclPtr;
int word;
@@ -6132,7 +5617,7 @@ TclArgumentBCEnter(
int isnew;
Tcl_HashEntry *hPtr = Tcl_CreateHashEntry(iPtr->lineLABCPtr,
objv[word], &isnew);
- CFWordBC *cfwPtr = ckalloc(sizeof(CFWordBC));
+ CFWordBC *cfwPtr = Tcl_Alloc(sizeof(CFWordBC));
cfwPtr->framePtr = cfPtr;
cfwPtr->obj = objv[word];
@@ -6210,7 +5695,7 @@ TclArgumentBCRelease(
Tcl_DeleteHashEntry(hPtr);
}
- ckfree(cfwPtr);
+ Tcl_Free(cfwPtr);
cfwPtr = nextPtr;
}
@@ -6292,83 +5777,6 @@ TclArgumentGet(
/*
*----------------------------------------------------------------------
*
- * Tcl_Eval --
- *
- * Execute a Tcl command in a string. This function executes the script
- * directly, rather than compiling it to bytecodes. Before the arrival of
- * the bytecode compiler in Tcl 8.0 Tcl_Eval was the main function used
- * for executing Tcl commands, but nowadays it isn't used much.
- *
- * Results:
- * The return value is one of the return codes defined in tcl.h (such as
- * TCL_OK), and interp's result contains a value to supplement the return
- * code. The value of the result will persist only until the next call to
- * Tcl_Eval or Tcl_EvalObj: you must copy it or lose it!
- *
- * Side effects:
- * Can be almost arbitrary, depending on the commands in the script.
- *
- *----------------------------------------------------------------------
- */
-
-#ifndef TCL_NO_DEPRECATED
-#undef Tcl_Eval
-int
-Tcl_Eval(
- Tcl_Interp *interp, /* Token for command interpreter (returned by
- * previous call to Tcl_CreateInterp). */
- const char *script) /* Pointer to TCL command to execute. */
-{
- int code = Tcl_EvalEx(interp, script, -1, 0);
-
- /*
- * For backwards compatibility with old C code that predates the object
- * system in Tcl 8.0, we have to mirror the object result back into the
- * string result (some callers may expect it there).
- */
-
- (void) Tcl_GetStringResult(interp);
- return code;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * Tcl_EvalObj, Tcl_GlobalEvalObj --
- *
- * These functions are deprecated but we keep them around for backwards
- * compatibility reasons.
- *
- * Results:
- * See the functions they call.
- *
- * Side effects:
- * See the functions they call.
- *
- *----------------------------------------------------------------------
- */
-
-#undef Tcl_EvalObj
-int
-Tcl_EvalObj(
- Tcl_Interp *interp,
- Tcl_Obj *objPtr)
-{
- return Tcl_EvalObjEx(interp, objPtr, 0);
-}
-#undef Tcl_GlobalEvalObj
-int
-Tcl_GlobalEvalObj(
- Tcl_Interp *interp,
- Tcl_Obj *objPtr)
-{
- return Tcl_EvalObjEx(interp, objPtr, TCL_EVAL_GLOBAL);
-}
-#endif /* TCL_NO_DEPRECATED */
-
-/*
- *----------------------------------------------------------------------
- *
* Tcl_EvalObjEx, TclEvalObjEx --
*
* Execute Tcl commands stored in a Tcl object. These commands are
@@ -6559,7 +5967,7 @@ TclNREvalObjEx(
*/
const char *script;
- int numSrcBytes;
+ size_t numSrcBytes;
/*
* Now we check if we have data about invisible continuation lines for
@@ -6613,7 +6021,7 @@ TEOEx_ByteCodeCallback(
}
if ((result != TCL_OK) && (result != TCL_ERROR) && !allowExceptions) {
const char *script;
- int numSrcBytes;
+ size_t numSrcBytes;
ProcessUnexpectedResult(interp, result);
result = TCL_ERROR;
@@ -6751,9 +6159,6 @@ Tcl_ExprLong(
Tcl_IncrRefCount(exprPtr);
result = Tcl_ExprLongObj(interp, exprPtr, ptr);
Tcl_DecrRefCount(exprPtr);
- if (result != TCL_OK) {
- (void) Tcl_GetStringResult(interp);
- }
}
return result;
}
@@ -6780,9 +6185,6 @@ Tcl_ExprDouble(
result = Tcl_ExprDoubleObj(interp, exprPtr, ptr);
Tcl_DecrRefCount(exprPtr);
/* Discard the expression object. */
- if (result != TCL_OK) {
- (void) Tcl_GetStringResult(interp);
- }
}
return result;
}
@@ -6808,14 +6210,6 @@ Tcl_ExprBoolean(
Tcl_IncrRefCount(exprPtr);
result = Tcl_ExprBooleanObj(interp, exprPtr, ptr);
Tcl_DecrRefCount(exprPtr);
- if (result != TCL_OK) {
- /*
- * Move the interpreter's object result to the string result, then
- * reset the object result.
- */
-
- (void) Tcl_GetStringResult(interp);
- }
return result;
}
}
@@ -7132,12 +6526,6 @@ Tcl_ExprString(
Tcl_DecrRefCount(resultPtr);
}
}
-
- /*
- * Force the string rep of the interp result.
- */
-
- (void) Tcl_GetStringResult(interp);
return code;
}
@@ -7160,82 +6548,17 @@ Tcl_ExprString(
*----------------------------------------------------------------------
*/
-#undef Tcl_AddObjErrorInfo
void
Tcl_AppendObjToErrorInfo(
Tcl_Interp *interp, /* Interpreter to which error information
* pertains. */
Tcl_Obj *objPtr) /* Message to record. */
{
- const char *message = TclGetString(objPtr);
+ size_t length;
+ const char *message = TclGetStringFromObj(objPtr, &length);
+ register Interp *iPtr = (Interp *) interp;
Tcl_IncrRefCount(objPtr);
- Tcl_AddObjErrorInfo(interp, message, objPtr->length);
- Tcl_DecrRefCount(objPtr);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * Tcl_AddErrorInfo --
- *
- * Add information to the errorInfo field that describes the current
- * error.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The contents of message are appended to the errorInfo field. If we are
- * just starting to log an error, errorInfo is initialized from the error
- * message in the interpreter's result.
- *
- *----------------------------------------------------------------------
- */
-
-#ifndef TCL_NO_DEPRECATED
-#undef Tcl_AddErrorInfo
-void
-Tcl_AddErrorInfo(
- Tcl_Interp *interp, /* Interpreter to which error information
- * pertains. */
- const char *message) /* Message to record. */
-{
- Tcl_AddObjErrorInfo(interp, message, -1);
-}
-#endif /* TCL_NO_DEPRECATED */
-
-/*
- *----------------------------------------------------------------------
- *
- * Tcl_AddObjErrorInfo --
- *
- * Add information to the errorInfo field that describes the current
- * error. This routine differs from Tcl_AddErrorInfo by taking a byte
- * pointer and length.
- *
- * Results:
- * None.
- *
- * Side effects:
- * "length" bytes from "message" are appended to the errorInfo field. If
- * "length" is negative, use bytes up to the first NULL byte. If we are
- * just starting to log an error, errorInfo is initialized from the error
- * message in the interpreter's result.
- *
- *----------------------------------------------------------------------
- */
-
-void
-Tcl_AddObjErrorInfo(
- Tcl_Interp *interp, /* Interpreter to which error information
- * pertains. */
- const char *message, /* Points to the first byte of an array of
- * bytes of the message. */
- int length) /* The number of bytes in the message. If < 0,
- * then append all bytes up to a NULL byte. */
-{
- register Interp *iPtr = (Interp *) interp;
/*
* If we are just starting to log an error, errorInfo is initialized from
@@ -7244,20 +6567,7 @@ Tcl_AddObjErrorInfo(
iPtr->flags |= ERR_LEGACY_COPY;
if (iPtr->errorInfo == NULL) {
-#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
- if (*(iPtr->result) != 0) {
- /*
- * The interp's string result is set, apparently by some extension
- * making a deprecated direct write to it. That extension may
- * expect interp->result to continue to be set, so we'll take
- * special pains to avoid clearing it, until we drop support for
- * interp->result completely.
- */
-
- iPtr->errorInfo = Tcl_NewStringObj(iPtr->result, -1);
- } else
-#endif /* !defined(TCL_NO_DEPRECATED) */
- iPtr->errorInfo = iPtr->objResultPtr;
+ iPtr->errorInfo = iPtr->objResultPtr;
Tcl_IncrRefCount(iPtr->errorInfo);
if (!iPtr->errorCode) {
Tcl_SetErrorCode(interp, "NONE", NULL);
@@ -7276,39 +6586,42 @@ Tcl_AddObjErrorInfo(
}
Tcl_AppendToObj(iPtr->errorInfo, message, length);
}
+ Tcl_DecrRefCount(objPtr);
}
/*
- *---------------------------------------------------------------------------
+ *----------------------------------------------------------------------
*
- * Tcl_VarEvalVA --
+ * Tcl_VarEval --
*
* Given a variable number of string arguments, concatenate them all
* together and execute the result as a Tcl command.
*
* Results:
* A standard Tcl return result. An error message or other result may be
- * left in the interp's result.
+ * left in the interp.
*
* Side effects:
* Depends on what was done by the command.
*
- *---------------------------------------------------------------------------
+ *----------------------------------------------------------------------
*/
-
+ /* ARGSUSED */
int
-Tcl_VarEvalVA(
- Tcl_Interp *interp, /* Interpreter in which to evaluate command */
- va_list argList) /* Variable argument list. */
+Tcl_VarEval(
+ Tcl_Interp *interp,
+ ...)
{
+ va_list argList;
+ int result;
Tcl_DString buf;
char *string;
- int result;
+ va_start(argList, interp);
/*
* Copy the strings one after the other into a single larger string. Use
* stack-allocated space for small commands, but if the command gets too
- * large than call ckalloc to create the space.
+ * large than call Tcl_Alloc to create the space.
*/
Tcl_DStringInit(&buf);
@@ -7328,78 +6641,6 @@ Tcl_VarEvalVA(
/*
*----------------------------------------------------------------------
*
- * Tcl_VarEval --
- *
- * Given a variable number of string arguments, concatenate them all
- * together and execute the result as a Tcl command.
- *
- * Results:
- * A standard Tcl return result. An error message or other result may be
- * left in interp->result.
- *
- * Side effects:
- * Depends on what was done by the command.
- *
- *----------------------------------------------------------------------
- */
- /* ARGSUSED */
-int
-Tcl_VarEval(
- Tcl_Interp *interp,
- ...)
-{
- va_list argList;
- int result;
-
- va_start(argList, interp);
- result = Tcl_VarEvalVA(interp, argList);
- va_end(argList);
-
- return result;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * Tcl_GlobalEval --
- *
- * Evaluate a command at global level in an interpreter.
- *
- * Results:
- * A standard Tcl result is returned, and the interp's result is modified
- * accordingly.
- *
- * Side effects:
- * The command string is executed in interp, and the execution is carried
- * out in the variable context of global level (no functions active),
- * just as if an "uplevel #0" command were being executed.
- *
- *----------------------------------------------------------------------
- */
-
-#ifndef TCL_NO_DEPRECATED
-#undef Tcl_GlobalEval
-int
-Tcl_GlobalEval(
- Tcl_Interp *interp, /* Interpreter in which to evaluate
- * command. */
- const char *command) /* Command to evaluate. */
-{
- register Interp *iPtr = (Interp *) interp;
- int result;
- CallFrame *savedVarFramePtr;
-
- savedVarFramePtr = iPtr->varFramePtr;
- iPtr->varFramePtr = iPtr->rootFramePtr;
- result = Tcl_EvalEx(interp, command, -1, 0);
- iPtr->varFramePtr = savedVarFramePtr;
- return result;
-}
-#endif /* TCL_NO_DEPRECATED */
-
-/*
- *----------------------------------------------------------------------
- *
* Tcl_SetRecursionLimit --
*
* Set the maximum number of recursive calls that may be active for an
@@ -7884,7 +7125,7 @@ ExprAbsFunc(
goto unChanged;
} else if (l == 0) {
if (TclHasStringRep(objv[1])) {
- int numBytes;
+ size_t numBytes;
const char *bytes = TclGetStringFromObj(objv[1], &numBytes);
while (numBytes) {
@@ -9489,7 +8730,7 @@ NRCoroutineCallerCallback(
NRE_ASSERT(iPtr->varFramePtr == corPtr->caller.varFramePtr);
NRE_ASSERT(iPtr->framePtr == corPtr->caller.framePtr);
NRE_ASSERT(iPtr->cmdFramePtr == corPtr->caller.cmdFramePtr);
- ckfree(corPtr);
+ Tcl_Free(corPtr);
return result;
}
@@ -9548,7 +8789,7 @@ NRCoroutineExitCallback(
*/
Tcl_DeleteHashTable(corPtr->lineLABCPtr);
- ckfree(corPtr->lineLABCPtr);
+ Tcl_Free(corPtr->lineLABCPtr);
corPtr->lineLABCPtr = NULL;
RESTORE_CONTEXT(corPtr->caller);
@@ -10162,7 +9403,7 @@ TclNRCoroutineObjCmd(
* struct and create the corresponding command.
*/
- corPtr = ckalloc(sizeof(CoroutineData));
+ corPtr = Tcl_Alloc(sizeof(CoroutineData));
cmdPtr = (Command *) TclNRCreateCommandInNs(interp, simpleName,
(Tcl_Namespace *)nsPtr, /*objProc*/ NULL, TclNRInterpCoroutine,
@@ -10184,7 +9425,7 @@ TclNRCoroutineObjCmd(
Tcl_HashSearch hSearch;
Tcl_HashEntry *hePtr;
- corPtr->lineLABCPtr = ckalloc(sizeof(Tcl_HashTable));
+ corPtr->lineLABCPtr = Tcl_Alloc(sizeof(Tcl_HashTable));
Tcl_InitHashTable(corPtr->lineLABCPtr, TCL_ONE_WORD_KEYS);
for (hePtr = Tcl_FirstHashEntry(iPtr->lineLABCPtr,&hSearch);
diff --git a/generic/tclBinary.c b/generic/tclBinary.c
index d8b9ae9..053c58e 100644
--- a/generic/tclBinary.c
+++ b/generic/tclBinary.c
@@ -22,8 +22,8 @@
* special conditions in the parsing of a format specifier.
*/
-#define BINARY_ALL -1 /* Use all elements in the argument. */
-#define BINARY_NOCOUNT -2 /* No count was specified in format. */
+#define BINARY_ALL ((size_t)-1) /* Use all elements in the argument. */
+#define BINARY_NOCOUNT ((size_t)-2) /* No count was specified in format. */
/*
* The following flags may be ORed together and returned by GetFormatSpec
@@ -64,7 +64,7 @@ static int FormatNumber(Tcl_Interp *interp, int type,
static void FreeByteArrayInternalRep(Tcl_Obj *objPtr);
static void FreeProperByteArrayInternalRep(Tcl_Obj *objPtr);
static int GetFormatSpec(const char **formatPtr, char *cmdPtr,
- int *countPtr, int *flagsPtr);
+ size_t *countPtr, int *flagsPtr);
static Tcl_Obj * ScanNumber(unsigned char *buffer, int type,
int flags, Tcl_HashTable **numberCachePtr);
static int SetByteArrayFromAny(Tcl_Interp *interp,
@@ -73,7 +73,7 @@ static void UpdateStringOfByteArray(Tcl_Obj *listPtr);
static void DeleteScanNumberCache(Tcl_HashTable *numberCachePtr);
static int NeedReversing(int format);
static void CopyNumber(const void *from, void *to,
- unsigned length, int type);
+ size_t length, int type);
/* Binary ensemble commands */
static int BinaryFormatCmd(ClientData clientData,
Tcl_Interp *interp,
@@ -266,10 +266,10 @@ const Tcl_ObjType tclByteArrayType = {
* fewer mallocs.
*/
-typedef struct ByteArray {
- unsigned int used; /* The number of bytes used in the byte
+typedef struct {
+ size_t used; /* The number of bytes used in the byte
* array. */
- unsigned int allocated; /* The amount of space actually allocated
+ size_t allocated; /* The amount of space actually allocated
* minus 1 byte. */
unsigned char bytes[1]; /* The array of bytes. The actual size of this
* field depends on the 'allocated' field
@@ -280,8 +280,8 @@ typedef struct ByteArray {
(offsetof(ByteArray, bytes) + (len))
#define GET_BYTEARRAY(irPtr) ((ByteArray *) (irPtr)->twoPtrValue.ptr1)
#define SET_BYTEARRAY(irPtr, baPtr) \
- (irPtr)->twoPtrValue.ptr1 = (void *) (baPtr)
-
+ (irPtr)->twoPtrValue.ptr1 = (baPtr)
+
int
TclIsPureByteArray(
Tcl_Obj * objPtr)
@@ -313,8 +313,7 @@ Tcl_Obj *
Tcl_NewByteArrayObj(
const unsigned char *bytes, /* The array of bytes used to initialize the
* new object. */
- int length) /* Length of the array of bytes, which must be
- * >= 0. */
+ size_t length) /* Length of the array of bytes */
{
#ifdef TCL_MEM_DEBUG
return Tcl_DbNewByteArrayObj(bytes, length, "unknown", 0);
@@ -356,8 +355,7 @@ Tcl_Obj *
Tcl_DbNewByteArrayObj(
const unsigned char *bytes, /* The array of bytes used to initialize the
* new object. */
- int length, /* Length of the array of bytes, which must be
- * >= 0. */
+ size_t length, /* Length of the array of bytes. */
const char *file, /* The name of the source file calling this
* procedure; used for debugging. */
int line) /* Line number in the source file; used for
@@ -397,7 +395,7 @@ Tcl_SetByteArrayObj(
Tcl_Obj *objPtr, /* Object to initialize as a ByteArray. */
const unsigned char *bytes, /* The array of bytes to use as the new value.
* May be NULL even if length > 0. */
- int length) /* Length of the array of bytes, which must
+ size_t length) /* Length of the array of bytes, which must
* be >= 0. */
{
ByteArray *byteArrayPtr;
@@ -408,10 +406,7 @@ Tcl_SetByteArrayObj(
}
TclInvalidateStringRep(objPtr);
- if (length < 0) {
- length = 0;
- }
- byteArrayPtr = ckalloc(BYTEARRAY_SIZE(length));
+ byteArrayPtr = Tcl_Alloc(BYTEARRAY_SIZE(length));
byteArrayPtr->used = length;
byteArrayPtr->allocated = length;
@@ -493,15 +488,11 @@ Tcl_GetByteArrayFromObj(
unsigned char *
Tcl_SetByteArrayLength(
Tcl_Obj *objPtr, /* The ByteArray object. */
- int length) /* New length for internal byte array. */
+ size_t length) /* New length for internal byte array. */
{
ByteArray *byteArrayPtr;
- unsigned newLength;
Tcl_ObjIntRep *irPtr;
- assert(length >= 0);
- newLength = (unsigned int)length;
-
if (Tcl_IsShared(objPtr)) {
Tcl_Panic("%s called with shared object", "Tcl_SetByteArrayLength");
}
@@ -519,13 +510,13 @@ Tcl_SetByteArrayLength(
}
byteArrayPtr = GET_BYTEARRAY(irPtr);
- if (newLength > byteArrayPtr->allocated) {
- byteArrayPtr = ckrealloc(byteArrayPtr, BYTEARRAY_SIZE(newLength));
- byteArrayPtr->allocated = newLength;
+ if (length > byteArrayPtr->allocated) {
+ byteArrayPtr = Tcl_Realloc(byteArrayPtr, BYTEARRAY_SIZE(length));
+ byteArrayPtr->allocated = length;
SET_BYTEARRAY(irPtr, byteArrayPtr);
}
TclInvalidateStringRep(objPtr);
- byteArrayPtr->used = newLength;
+ byteArrayPtr->used = length;
return byteArrayPtr->bytes;
}
@@ -565,11 +556,10 @@ SetByteArrayFromAny(
return TCL_OK;
}
- src = TclGetString(objPtr);
- length = objPtr->length;
+ src = TclGetStringFromObj(objPtr, &length);
srcEnd = src + length;
- byteArrayPtr = ckalloc(BYTEARRAY_SIZE(length));
+ byteArrayPtr = Tcl_Alloc(BYTEARRAY_SIZE(length));
for (dst = byteArrayPtr->bytes; src < srcEnd; ) {
src += TclUtfToUniChar(src, &ch);
improper = improper || (ch > 255);
@@ -606,14 +596,14 @@ static void
FreeByteArrayInternalRep(
Tcl_Obj *objPtr) /* Object with internal rep to free. */
{
- ckfree(GET_BYTEARRAY(TclFetchIntRep(objPtr, &tclByteArrayType)));
+ Tcl_Free(GET_BYTEARRAY(TclFetchIntRep(objPtr, &tclByteArrayType)));
}
static void
FreeProperByteArrayInternalRep(
Tcl_Obj *objPtr) /* Object with internal rep to free. */
{
- ckfree(GET_BYTEARRAY(TclFetchIntRep(objPtr, &properByteArrayType)));
+ Tcl_Free(GET_BYTEARRAY(TclFetchIntRep(objPtr, &properByteArrayType)));
}
/*
@@ -638,14 +628,14 @@ DupByteArrayInternalRep(
Tcl_Obj *srcPtr, /* Object with internal rep to copy. */
Tcl_Obj *copyPtr) /* Object with internal rep to set. */
{
- unsigned int length;
+ size_t length;
ByteArray *srcArrayPtr, *copyArrayPtr;
Tcl_ObjIntRep ir;
srcArrayPtr = GET_BYTEARRAY(TclFetchIntRep(srcPtr, &tclByteArrayType));
length = srcArrayPtr->used;
- copyArrayPtr = ckalloc(BYTEARRAY_SIZE(length));
+ copyArrayPtr = Tcl_Alloc(BYTEARRAY_SIZE(length));
copyArrayPtr->used = length;
copyArrayPtr->allocated = length;
memcpy(copyArrayPtr->bytes, srcArrayPtr->bytes, length);
@@ -666,7 +656,7 @@ DupProperByteArrayInternalRep(
srcArrayPtr = GET_BYTEARRAY(TclFetchIntRep(srcPtr, &properByteArrayType));
length = srcArrayPtr->used;
- copyArrayPtr = ckalloc(BYTEARRAY_SIZE(length));
+ copyArrayPtr = Tcl_Alloc(BYTEARRAY_SIZE(length));
copyArrayPtr->used = length;
copyArrayPtr->allocated = length;
memcpy(copyArrayPtr->bytes, srcArrayPtr->bytes, length);
@@ -700,21 +690,18 @@ UpdateStringOfByteArray(
const Tcl_ObjIntRep *irPtr = TclFetchIntRep(objPtr, &properByteArrayType);
ByteArray *byteArrayPtr = GET_BYTEARRAY(irPtr);
unsigned char *src = byteArrayPtr->bytes;
- unsigned int i, length = byteArrayPtr->used;
- unsigned int size = length;
+ size_t i, length = byteArrayPtr->used;
+ size_t size = length;
/*
* How much space will string rep need?
*/
- for (i = 0; i < length && size <= INT_MAX; i++) {
+ for (i = 0; i < length; i++) {
if ((src[i] == 0) || (src[i] > 127)) {
size++;
}
}
- if (size > INT_MAX) {
- Tcl_Panic("max size for a Tcl value (%d bytes) exceeded", INT_MAX);
- }
if (size == length) {
char *dst = Tcl_InitStringRep(objPtr, (char *)src, size);
@@ -754,16 +741,16 @@ void
TclAppendBytesToByteArray(
Tcl_Obj *objPtr,
const unsigned char *bytes,
- int len)
+ size_t len)
{
ByteArray *byteArrayPtr;
- unsigned int length, needed;
+ size_t needed;
Tcl_ObjIntRep *irPtr;
if (Tcl_IsShared(objPtr)) {
Tcl_Panic("%s called with shared object","TclAppendBytesToByteArray");
}
- if (len < 0) {
+ if (len == TCL_AUTO_LENGTH) {
Tcl_Panic("%s must be called with definite number of bytes to append",
"TclAppendBytesToByteArray");
}
@@ -775,8 +762,6 @@ TclAppendBytesToByteArray(
return;
}
- length = (unsigned int) len;
-
irPtr = TclFetchIntRep(objPtr, &properByteArrayType);
if (irPtr == NULL) {
irPtr = TclFetchIntRep(objPtr, &tclByteArrayType);
@@ -790,18 +775,18 @@ TclAppendBytesToByteArray(
}
byteArrayPtr = GET_BYTEARRAY(irPtr);
- if (length > INT_MAX - byteArrayPtr->used) {
- Tcl_Panic("max size for a Tcl value (%d bytes) exceeded", INT_MAX);
+ if (len > UINT_MAX - byteArrayPtr->used) {
+ Tcl_Panic("max size for a Tcl value (%u bytes) exceeded", UINT_MAX);
}
- needed = byteArrayPtr->used + length;
+ needed = byteArrayPtr->used + len;
/*
* If we need to, resize the allocated space in the byte array.
*/
if (needed > byteArrayPtr->allocated) {
ByteArray *ptr = NULL;
- unsigned int attempt;
+ size_t attempt;
if (needed <= INT_MAX/2) {
/*
@@ -809,19 +794,19 @@ TclAppendBytesToByteArray(
*/
attempt = 2 * needed;
- ptr = attemptckrealloc(byteArrayPtr, BYTEARRAY_SIZE(attempt));
+ ptr = Tcl_AttemptRealloc(byteArrayPtr, BYTEARRAY_SIZE(attempt));
}
if (ptr == NULL) {
/*
* Try to allocate double the increment that is needed (plus).
*/
- unsigned int limit = INT_MAX - needed;
- unsigned int extra = length + TCL_MIN_GROWTH;
- int growth = (int) ((extra > limit) ? limit : extra);
+ size_t limit = UINT_MAX - needed;
+ size_t extra = len + TCL_MIN_GROWTH;
+ size_t growth = (extra > limit) ? limit : extra;
attempt = needed + growth;
- ptr = attemptckrealloc(byteArrayPtr, BYTEARRAY_SIZE(attempt));
+ ptr = Tcl_AttemptRealloc(byteArrayPtr, BYTEARRAY_SIZE(attempt));
}
if (ptr == NULL) {
/*
@@ -829,7 +814,7 @@ TclAppendBytesToByteArray(
*/
attempt = needed;
- ptr = ckrealloc(byteArrayPtr, BYTEARRAY_SIZE(attempt));
+ ptr = Tcl_Realloc(byteArrayPtr, BYTEARRAY_SIZE(attempt));
}
byteArrayPtr = ptr;
byteArrayPtr->allocated = attempt;
@@ -837,9 +822,9 @@ TclAppendBytesToByteArray(
}
if (bytes) {
- memcpy(byteArrayPtr->bytes + byteArrayPtr->used, bytes, length);
+ memcpy(byteArrayPtr->bytes + byteArrayPtr->used, bytes, len);
}
- byteArrayPtr->used += length;
+ byteArrayPtr->used += len;
TclInvalidateStringRep(objPtr);
}
@@ -899,7 +884,7 @@ BinaryFormatCmd(
int value = 0; /* Current integer value to be packed.
* Initialized to avoid compiler warning. */
char cmd; /* Current format character. */
- int count; /* Count associated with current format
+ size_t count; /* Count associated with current format
* character. */
int flags; /* Format field flags */
const char *format; /* Pointer to current position in format
@@ -911,7 +896,8 @@ BinaryFormatCmd(
* cursor has visited.*/
const char *errorString;
const char *errorValue, *str;
- int offset, size, length;
+ int offset, size;
+ size_t length;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "formatString ?arg ...?");
@@ -950,7 +936,7 @@ BinaryFormatCmd(
goto badIndex;
}
if (count == BINARY_ALL) {
- Tcl_GetByteArrayFromObj(objv[arg], &count);
+ (void)TclGetByteArrayFromObj(objv[arg], &count);
} else if (count == BINARY_NOCOUNT) {
count = 1;
}
@@ -1022,7 +1008,7 @@ BinaryFormatCmd(
if (count == BINARY_ALL) {
count = listc;
- } else if (count > listc) {
+ } else if (count > (size_t)listc) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"number of elements in list does not match count",
-1));
@@ -1046,16 +1032,16 @@ BinaryFormatCmd(
if (count == BINARY_NOCOUNT) {
count = 1;
}
- if ((count > offset) || (count == BINARY_ALL)) {
+ if ((count > (size_t)offset) || (count == BINARY_ALL)) {
count = offset;
}
- if (offset > length) {
+ if (offset > (int)length) {
length = offset;
}
offset -= count;
break;
case '@':
- if (offset > length) {
+ if (offset > (int)length) {
length = offset;
}
if (count == BINARY_ALL) {
@@ -1071,7 +1057,7 @@ BinaryFormatCmd(
goto badField;
}
}
- if (offset > length) {
+ if (offset > (int)length) {
length = offset;
}
if (length == 0) {
@@ -1114,8 +1100,8 @@ BinaryFormatCmd(
char pad = (char) (cmd == 'a' ? '\0' : ' ');
unsigned char *bytes;
- bytes = Tcl_GetByteArrayFromObj(objv[arg++], &length);
-
+ bytes = TclGetByteArrayFromObj(objv[arg], &length);
+ arg++;
if (count == BINARY_ALL) {
count = length;
} else if (count == BINARY_NOCOUNT) {
@@ -1148,7 +1134,7 @@ BinaryFormatCmd(
value = 0;
errorString = "binary";
if (cmd == 'B') {
- for (offset = 0; offset < count; offset++) {
+ for (offset = 0; (size_t)offset < count; offset++) {
value <<= 1;
if (str[offset] == '1') {
value |= 1;
@@ -1163,7 +1149,7 @@ BinaryFormatCmd(
}
}
} else {
- for (offset = 0; offset < count; offset++) {
+ for (offset = 0; (size_t)offset < count; offset++) {
value >>= 1;
if (str[offset] == '1') {
value |= 128;
@@ -1210,7 +1196,7 @@ BinaryFormatCmd(
value = 0;
errorString = "hexadecimal";
if (cmd == 'H') {
- for (offset = 0; offset < count; offset++) {
+ for (offset = 0; (size_t)offset < count; offset++) {
value <<= 4;
if (!isxdigit(UCHAR(str[offset]))) { /* INTL: digit */
errorValue = str;
@@ -1231,7 +1217,7 @@ BinaryFormatCmd(
}
}
} else {
- for (offset = 0; offset < count; offset++) {
+ for (offset = 0; (size_t)offset < count; offset++) {
value >>= 4;
if (!isxdigit(UCHAR(str[offset]))) { /* INTL: digit */
@@ -1302,7 +1288,7 @@ BinaryFormatCmd(
}
}
arg++;
- for (i = 0; i < count; i++) {
+ for (i = 0; (size_t)i < count; i++) {
if (FormatNumber(interp, cmd, listv[i], &cursor) != TCL_OK) {
Tcl_DecrRefCount(resultPtr);
return TCL_ERROR;
@@ -1324,7 +1310,7 @@ BinaryFormatCmd(
if (count == BINARY_NOCOUNT) {
count = 1;
}
- if ((count == BINARY_ALL) || (count > (cursor - buffer))) {
+ if ((count == BINARY_ALL) || (count > (size_t)(cursor - buffer))) {
cursor = buffer;
} else {
cursor -= count;
@@ -1404,7 +1390,7 @@ BinaryScanCmd(
int value = 0; /* Current integer value to be packed.
* Initialized to avoid compiler warning. */
char cmd; /* Current format character. */
- int count; /* Count associated with current format
+ size_t count; /* Count associated with current format
* character. */
int flags; /* Format field flags */
const char *format; /* Pointer to current position in format
@@ -1413,7 +1399,8 @@ BinaryScanCmd(
unsigned char *buffer; /* Start of result buffer. */
const char *errorString;
const char *str;
- int offset, size, length;
+ int offset, size;
+ size_t length = 0;
int i;
Tcl_Obj *valuePtr, *elementPtr;
@@ -1427,7 +1414,7 @@ BinaryScanCmd(
}
numberCachePtr = &numberCacheHash;
Tcl_InitHashTable(numberCachePtr, TCL_ONE_WORD_KEYS);
- buffer = Tcl_GetByteArrayFromObj(objv[1], &length);
+ buffer = TclGetByteArrayFromObj(objv[1], &length);
format = TclGetString(objv[2]);
arg = 3;
offset = 0;
@@ -1452,7 +1439,7 @@ BinaryScanCmd(
if (count == BINARY_NOCOUNT) {
count = 1;
}
- if (count > (length - offset)) {
+ if (count > length - offset) {
goto done;
}
}
@@ -1511,7 +1498,7 @@ BinaryScanCmd(
if (count == BINARY_NOCOUNT) {
count = 1;
}
- if (count > (length - offset) * 8) {
+ if (count > (size_t)(length - offset) * 8) {
goto done;
}
}
@@ -1521,7 +1508,7 @@ BinaryScanCmd(
dest = TclGetString(valuePtr);
if (cmd == 'b') {
- for (i = 0; i < count; i++) {
+ for (i = 0; (size_t)i < count; i++) {
if (i % 8) {
value >>= 1;
} else {
@@ -1530,7 +1517,7 @@ BinaryScanCmd(
*dest++ = (char) ((value & 1) ? '1' : '0');
}
} else {
- for (i = 0; i < count; i++) {
+ for (i = 0; (size_t)i < count; i++) {
if (i % 8) {
value <<= 1;
} else {
@@ -1576,7 +1563,7 @@ BinaryScanCmd(
dest = TclGetString(valuePtr);
if (cmd == 'h') {
- for (i = 0; i < count; i++) {
+ for (i = 0; (size_t)i < count; i++) {
if (i % 2) {
value >>= 4;
} else {
@@ -1585,7 +1572,7 @@ BinaryScanCmd(
*dest++ = hexdigit[value & 0xf];
}
} else {
- for (i = 0; i < count; i++) {
+ for (i = 0; (size_t)i < count; i++) {
if (i % 2) {
value <<= 4;
} else {
@@ -1642,7 +1629,7 @@ BinaryScanCmd(
goto badIndex;
}
if (count == BINARY_NOCOUNT) {
- if ((length - offset) < size) {
+ if ((length - offset) < (size_t)size) {
goto done;
}
valuePtr = ScanNumber(buffer+offset, cmd, flags,
@@ -1657,7 +1644,7 @@ BinaryScanCmd(
}
valuePtr = Tcl_NewObj();
src = buffer + offset;
- for (i = 0; i < count; i++) {
+ for (i = 0; (size_t)i < count; i++) {
elementPtr = ScanNumber(src, cmd, flags, &numberCachePtr);
src += size;
Tcl_ListObjAppendElement(NULL, valuePtr, elementPtr);
@@ -1678,7 +1665,7 @@ BinaryScanCmd(
if (count == BINARY_NOCOUNT) {
count = 1;
}
- if ((count == BINARY_ALL) || (count > (length - offset))) {
+ if ((count == BINARY_ALL) || (count > length - offset)) {
offset = length;
} else {
offset += count;
@@ -1688,7 +1675,7 @@ BinaryScanCmd(
if (count == BINARY_NOCOUNT) {
count = 1;
}
- if ((count == BINARY_ALL) || (count > offset)) {
+ if ((count == BINARY_ALL) || (count > (size_t)offset)) {
offset = 0;
} else {
offset -= count;
@@ -1772,7 +1759,7 @@ static int
GetFormatSpec(
const char **formatPtr, /* Pointer to format string. */
char *cmdPtr, /* Pointer to location of command char. */
- int *countPtr, /* Pointer to repeat count value. */
+ size_t *countPtr, /* Pointer to repeat count value. */
int *flagsPtr) /* Pointer to field flags */
{
/*
@@ -1938,7 +1925,7 @@ static void
CopyNumber(
const void *from, /* source */
void *to, /* destination */
- unsigned length, /* Number of bytes to copy */
+ size_t length, /* Number of bytes to copy */
int type) /* What type of thing are we copying? */
{
switch (NeedReversing(type)) {
@@ -2470,7 +2457,7 @@ BinaryEncodeHex(
Tcl_Obj *resultObj = NULL;
unsigned char *data = NULL;
unsigned char *cursor = NULL;
- int offset = 0, count = 0;
+ size_t offset = 0, count = 0;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "data");
@@ -2478,7 +2465,7 @@ BinaryEncodeHex(
}
TclNewObj(resultObj);
- data = Tcl_GetByteArrayFromObj(objv[1], &count);
+ data = TclGetByteArrayFromObj(objv[1], &count);
cursor = Tcl_SetByteArrayLength(resultObj, count * 2);
for (offset = 0; offset < count; ++offset) {
*cursor++ = HexDigits[(data[offset] >> 4) & 0x0f];
@@ -2514,7 +2501,8 @@ BinaryDecodeHex(
Tcl_Obj *resultObj = NULL;
unsigned char *data, *datastart, *dataend;
unsigned char *begin, *cursor, c;
- int i, index, value, size, count = 0, cut = 0, strict = 0;
+ int i, index, value, size, cut = 0, strict = 0;
+ size_t count = 0;
enum {OPT_STRICT };
static const char *const optStrings[] = { "-strict", NULL };
@@ -2583,8 +2571,8 @@ BinaryDecodeHex(
badChar:
TclDecrRefCount(resultObj);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "invalid hexadecimal digit \"%c\" at position %d",
- c, (int) (data - datastart - 1)));
+ "invalid hexadecimal digit \"%c\" at position %" TCL_Z_MODIFIER "u",
+ c, data - datastart - 1));
return TCL_ERROR;
}
@@ -2634,8 +2622,9 @@ BinaryEncode64(
unsigned char *data, *cursor, *limit;
int maxlen = 0;
const char *wrapchar = "\n";
- int wrapcharlen = 1;
- int offset, i, index, size, outindex = 0, count = 0;
+ size_t wrapcharlen = 1;
+ int i, index, size, outindex = 0;
+ size_t offset, count = 0;
enum { OPT_MAXLEN, OPT_WRAPCHAR };
static const char *const optStrings[] = { "-maxlen", "-wrapchar", NULL };
@@ -2672,7 +2661,7 @@ BinaryEncode64(
}
resultObj = Tcl_NewObj();
- data = Tcl_GetByteArrayFromObj(objv[objc - 1], &count);
+ data = TclGetByteArrayFromObj(objv[objc - 1], &count);
if (count > 0) {
size = (((count * 4) / 3) + 3) & ~3; /* ensure 4 byte chunks */
if (maxlen > 0 && size > maxlen) {
@@ -2738,11 +2727,11 @@ BinaryEncodeUu(
{
Tcl_Obj *resultObj;
unsigned char *data, *start, *cursor;
- int offset, count, rawLength, n, i, j, bits, index;
+ int rawLength, n, i, bits, index;
int lineLength = 61;
const unsigned char SingleNewline[] = { (unsigned char) '\n' };
const unsigned char *wrapchar = SingleNewline;
- int wrapcharlen = sizeof(SingleNewline);
+ size_t j, offset, count = 0, wrapcharlen = sizeof(SingleNewline);
enum { OPT_MAXLEN, OPT_WRAPCHAR };
static const char *const optStrings[] = { "-maxlen", "-wrapchar", NULL };
@@ -2771,7 +2760,7 @@ BinaryEncodeUu(
}
break;
case OPT_WRAPCHAR:
- wrapchar = Tcl_GetByteArrayFromObj(objv[i + 1], &wrapcharlen);
+ wrapchar = TclGetByteArrayFromObj(objv[i + 1], &wrapcharlen);
break;
}
}
@@ -2783,7 +2772,7 @@ BinaryEncodeUu(
resultObj = Tcl_NewObj();
offset = 0;
- data = Tcl_GetByteArrayFromObj(objv[objc - 1], &count);
+ data = TclGetByteArrayFromObj(objv[objc - 1], &count);
rawLength = (lineLength - 1) * 3 / 4;
start = cursor = Tcl_SetByteArrayLength(resultObj,
(lineLength + wrapcharlen) *
@@ -2856,7 +2845,8 @@ BinaryDecodeUu(
Tcl_Obj *resultObj = NULL;
unsigned char *data, *datastart, *dataend;
unsigned char *begin, *cursor;
- int i, index, size, count = 0, strict = 0, lineLen;
+ int i, index, size, strict = 0, lineLen;
+ size_t count = 0;
unsigned char c;
enum { OPT_STRICT };
static const char *const optStrings[] = { "-strict", NULL };
@@ -2986,8 +2976,8 @@ BinaryDecodeUu(
badUu:
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "invalid uuencode character \"%c\" at position %d",
- c, (int) (data - datastart - 1)));
+ "invalid uuencode character \"%c\" at position %" TCL_Z_MODIFIER "u",
+ c, data - datastart - 1));
Tcl_SetErrorCode(interp, "TCL", "BINARY", "DECODE", "INVALID", NULL);
TclDecrRefCount(resultObj);
return TCL_ERROR;
@@ -3021,7 +3011,8 @@ BinaryDecode64(
unsigned char *begin = NULL;
unsigned char *cursor = NULL;
int strict = 0;
- int i, index, size, cut = 0, count = 0;
+ int i, index, size, cut = 0;
+ size_t count = 0;
enum { OPT_STRICT };
static const char *const optStrings[] = { "-strict", NULL };
@@ -3150,8 +3141,8 @@ BinaryDecode64(
bad64:
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "invalid base64 character \"%c\" at position %d",
- (char) c, (int) (data - datastart - 1)));
+ "invalid base64 character \"%c\" at position %" TCL_Z_MODIFIER "u",
+ (char) c, data - datastart - 1));
TclDecrRefCount(resultObj);
return TCL_ERROR;
}
diff --git a/generic/tclCkalloc.c b/generic/tclCkalloc.c
index d60633b..f1d36cb 100644
--- a/generic/tclCkalloc.c
+++ b/generic/tclCkalloc.c
@@ -20,9 +20,7 @@
#define FALSE 0
#define TRUE 1
-#undef Tcl_Alloc
#undef Tcl_Free
-#undef Tcl_Realloc
#undef Tcl_AttemptAlloc
#undef Tcl_AttemptRealloc
@@ -33,7 +31,7 @@
* "memory tag" command is invoked, to hold the current tag.
*/
-typedef struct MemTag {
+typedef struct {
size_t refCount; /* Number of mem_headers referencing this
* tag. */
char string[1]; /* Actual size of string will be as large as
@@ -121,7 +119,7 @@ static char dumpFile[100]; /* Records where to dump memory allocation
/*
* Mutex to serialize allocations. This is a low-level mutex that must be
* explicitly initialized. This is necessary because the self initializing
- * mutexes use ckalloc...
+ * mutexes use Tcl_Alloc...
*/
static Tcl_Mutex *ckallocMutexPtr;
@@ -245,12 +243,12 @@ ValidateMemory(
guard_failed = TRUE;
fflush(stdout);
byte &= 0xff;
- fprintf(stderr, "low guard byte %d is 0x%x \t%c\n", (int)idx, byte,
+ fprintf(stderr, "low guard byte %" TCL_Z_MODIFIER "u is 0x%x \t%c\n", idx, byte,
(isprint(UCHAR(byte)) ? byte : ' ')); /* INTL: bytes */
}
}
if (guard_failed) {
- TclDumpMemoryInfo((ClientData) stderr, 0);
+ TclDumpMemoryInfo(stderr, 0);
fprintf(stderr, "low guard failed at %p, %s %d\n",
memHeaderP->body, file, line);
fflush(stderr); /* In case name pointer is bad. */
@@ -266,13 +264,13 @@ ValidateMemory(
guard_failed = TRUE;
fflush(stdout);
byte &= 0xff;
- fprintf(stderr, "hi guard byte %d is 0x%x \t%c\n", (int)idx, byte,
+ fprintf(stderr, "hi guard byte %" TCL_Z_MODIFIER "u is 0x%x \t%c\n", idx, byte,
(isprint(UCHAR(byte)) ? byte : ' ')); /* INTL: bytes */
}
}
if (guard_failed) {
- TclDumpMemoryInfo((ClientData) stderr, 0);
+ TclDumpMemoryInfo(stderr, 0);
fprintf(stderr, "high guard failed at %p, %s %d\n",
memHeaderP->body, file, line);
fflush(stderr); /* In case name pointer is bad. */
@@ -376,7 +374,7 @@ Tcl_DumpActiveMemory(
/*
*----------------------------------------------------------------------
*
- * Tcl_DbCkalloc - debugging ckalloc
+ * Tcl_DbCkalloc - debugging Tcl_Alloc
*
* Allocate the requested amount of space plus some extra for guard bands
* at both ends of the request, plus a size, panicing if there isn't
@@ -385,15 +383,15 @@ Tcl_DumpActiveMemory(
*
* The second and third arguments are file and line, these contain the
* filename and line number corresponding to the caller. These are sent
- * by the ckalloc macro; it uses the preprocessor autodefines __FILE__
+ * by the Tcl_Alloc macro; it uses the preprocessor autodefines __FILE__
* and __LINE__.
*
*----------------------------------------------------------------------
*/
-char *
+void *
Tcl_DbCkalloc(
- unsigned int size,
+ size_t size,
const char *file,
int line)
{
@@ -410,8 +408,8 @@ Tcl_DbCkalloc(
}
if (result == NULL) {
fflush(stdout);
- TclDumpMemoryInfo((ClientData) stderr, 0);
- Tcl_Panic("unable to alloc %u bytes, %s line %d", size, file, line);
+ TclDumpMemoryInfo(stderr, 0);
+ Tcl_Panic("unable to alloc %" TCL_Z_MODIFIER "u bytes, %s line %d", size, file, line);
}
/*
@@ -457,7 +455,7 @@ Tcl_DbCkalloc(
}
if (alloc_tracing) {
- fprintf(stderr,"ckalloc %p %u %s %d\n",
+ fprintf(stderr,"Tcl_Alloc %p %" TCL_Z_MODIFIER "u %s %d\n",
result->body, size, file, line);
}
@@ -481,9 +479,9 @@ Tcl_DbCkalloc(
return result->body;
}
-char *
+void *
Tcl_AttemptDbCkalloc(
- unsigned int size,
+ size_t size,
const char *file,
int line)
{
@@ -500,7 +498,7 @@ Tcl_AttemptDbCkalloc(
}
if (result == NULL) {
fflush(stdout);
- TclDumpMemoryInfo((ClientData) stderr, 0);
+ TclDumpMemoryInfo(stderr, 0);
return NULL;
}
@@ -546,7 +544,7 @@ Tcl_AttemptDbCkalloc(
}
if (alloc_tracing) {
- fprintf(stderr,"ckalloc %p %u %s %d\n",
+ fprintf(stderr,"Tcl_Alloc %p %" TCL_Z_MODIFIER "u %s %d\n",
result->body, size, file, line);
}
@@ -573,7 +571,7 @@ Tcl_AttemptDbCkalloc(
/*
*----------------------------------------------------------------------
*
- * Tcl_DbCkfree - debugging ckfree
+ * Tcl_DbCkfree - debugging Tcl_Free
*
* Verify that the low and high guards are intact, and if so then free
* the buffer else Tcl_Panic.
@@ -582,7 +580,7 @@ Tcl_AttemptDbCkalloc(
*
* The second and third arguments are file and line, these contain the
* filename and line number corresponding to the caller. These are sent
- * by the ckfree macro; it uses the preprocessor autodefines __FILE__ and
+ * by the Tcl_Free macro; it uses the preprocessor autodefines __FILE__ and
* __LINE__.
*
*----------------------------------------------------------------------
@@ -590,7 +588,7 @@ Tcl_AttemptDbCkalloc(
void
Tcl_DbCkfree(
- char *ptr,
+ void *ptr,
const char *file,
int line)
{
@@ -611,7 +609,7 @@ Tcl_DbCkfree(
memp = (struct mem_header *) (((size_t) ptr) - BODY_OFFSET);
if (alloc_tracing) {
- fprintf(stderr, "ckfree %p %" TCL_Z_MODIFIER "u %s %d\n",
+ fprintf(stderr, "Tcl_Free %p %" TCL_Z_MODIFIER "u %s %d\n",
memp->body, memp->length, file, line);
}
@@ -655,7 +653,7 @@ Tcl_DbCkfree(
/*
*--------------------------------------------------------------------
*
- * Tcl_DbCkrealloc - debugging ckrealloc
+ * Tcl_DbCkrealloc - debugging Tcl_Realloc
*
* Reallocate a chunk of memory by allocating a new one of the right
* size, copying the old data to the new location, and then freeing the
@@ -665,10 +663,10 @@ Tcl_DbCkfree(
*--------------------------------------------------------------------
*/
-char *
+void *
Tcl_DbCkrealloc(
- char *ptr,
- unsigned int size,
+ void *ptr,
+ size_t size,
const char *file,
int line)
{
@@ -696,10 +694,10 @@ Tcl_DbCkrealloc(
return newPtr;
}
-char *
+void *
Tcl_AttemptDbCkrealloc(
- char *ptr,
- unsigned int size,
+ void *ptr,
+ size_t size,
const char *file,
int line)
{
@@ -734,59 +732,6 @@ Tcl_AttemptDbCkrealloc(
/*
*----------------------------------------------------------------------
*
- * Tcl_Alloc, et al. --
- *
- * These functions are defined in terms of the debugging versions when
- * TCL_MEM_DEBUG is set.
- *
- * Results:
- * Same as the debug versions.
- *
- * Side effects:
- * Same as the debug versions.
- *
- *----------------------------------------------------------------------
- */
-
-char *
-Tcl_Alloc(
- unsigned int size)
-{
- return Tcl_DbCkalloc(size, "unknown", 0);
-}
-
-char *
-Tcl_AttemptAlloc(
- unsigned int size)
-{
- return Tcl_AttemptDbCkalloc(size, "unknown", 0);
-}
-
-void
-Tcl_Free(
- char *ptr)
-{
- Tcl_DbCkfree(ptr, "unknown", 0);
-}
-
-char *
-Tcl_Realloc(
- char *ptr,
- unsigned int size)
-{
- return Tcl_DbCkrealloc(ptr, size, "unknown", 0);
-}
-char *
-Tcl_AttemptRealloc(
- char *ptr,
- unsigned int size)
-{
- return Tcl_AttemptDbCkrealloc(ptr, size, "unknown", 0);
-}
-
-/*
- *----------------------------------------------------------------------
- *
* MemoryCmd --
*
* Implements the Tcl "memory" command, which provides Tcl-level control
@@ -1052,11 +997,12 @@ Tcl_InitMemory(
*----------------------------------------------------------------------
*/
-char *
+#undef Tcl_Alloc
+void *
Tcl_Alloc(
- unsigned int size)
+ size_t size)
{
- char *result;
+ void *result;
result = TclpAlloc(size);
@@ -1071,24 +1017,25 @@ Tcl_Alloc(
*/
if ((result == NULL) && size) {
- Tcl_Panic("unable to alloc %u bytes", size);
+ Tcl_Panic("unable to alloc %" TCL_Z_MODIFIER "u bytes", size);
}
return result;
}
-char *
+void *
Tcl_DbCkalloc(
- unsigned int size,
+ size_t size,
const char *file,
int line)
{
- char *result;
+ void *result;
- result = (char *) TclpAlloc(size);
+ result = TclpAlloc(size);
if ((result == NULL) && size) {
fflush(stdout);
- Tcl_Panic("unable to alloc %u bytes, %s line %d", size, file, line);
+ Tcl_Panic("unable to alloc %" TCL_Z_MODIFIER "u bytes, %s line %d",
+ size, file, line);
}
return result;
}
@@ -1104,25 +1051,25 @@ Tcl_DbCkalloc(
*----------------------------------------------------------------------
*/
-char *
+void *
Tcl_AttemptAlloc(
- unsigned int size)
+ size_t size)
{
- char *result;
+ void *result;
result = TclpAlloc(size);
return result;
}
-char *
+void *
Tcl_AttemptDbCkalloc(
- unsigned int size,
+ size_t size,
const char *file,
int line)
{
- char *result;
+ void *result;
- result = (char *) TclpAlloc(size);
+ result = TclpAlloc(size);
return result;
}
@@ -1137,35 +1084,37 @@ Tcl_AttemptDbCkalloc(
*----------------------------------------------------------------------
*/
-char *
+#undef Tcl_Realloc
+void *
Tcl_Realloc(
- char *ptr,
- unsigned int size)
+ void *ptr,
+ size_t size)
{
char *result;
result = TclpRealloc(ptr, size);
if ((result == NULL) && size) {
- Tcl_Panic("unable to realloc %u bytes", size);
+ Tcl_Panic("unable to realloc %" TCL_Z_MODIFIER "u bytes", size);
}
return result;
}
-char *
+void *
Tcl_DbCkrealloc(
- char *ptr,
- unsigned int size,
+ void *ptr,
+ size_t size,
const char *file,
int line)
{
- char *result;
+ void *result;
- result = (char *) TclpRealloc(ptr, size);
+ result = TclpRealloc(ptr, size);
if ((result == NULL) && size) {
fflush(stdout);
- Tcl_Panic("unable to realloc %u bytes, %s line %d", size, file, line);
+ Tcl_Panic("unable to realloc %" TCL_Z_MODIFIER "u bytes, %s line %d",
+ size, file, line);
}
return result;
}
@@ -1181,27 +1130,27 @@ Tcl_DbCkrealloc(
*----------------------------------------------------------------------
*/
-char *
+void *
Tcl_AttemptRealloc(
- char *ptr,
- unsigned int size)
+ void *ptr,
+ size_t size)
{
- char *result;
+ void *result;
result = TclpRealloc(ptr, size);
return result;
}
-char *
+void *
Tcl_AttemptDbCkrealloc(
- char *ptr,
- unsigned int size,
+ void *ptr,
+ size_t size,
const char *file,
int line)
{
- char *result;
+ void *result;
- result = (char *) TclpRealloc(ptr, size);
+ result = TclpRealloc(ptr, size);
return result;
}
@@ -1217,16 +1166,17 @@ Tcl_AttemptDbCkrealloc(
*----------------------------------------------------------------------
*/
+#undef Tcl_Free
void
Tcl_Free(
- char *ptr)
+ void *ptr)
{
TclpFree(ptr);
}
void
Tcl_DbCkfree(
- char *ptr,
+ void *ptr,
const char *file,
int line)
{
diff --git a/generic/tclClock.c b/generic/tclClock.c
index aeff164..c5677a5 100644
--- a/generic/tclClock.c
+++ b/generic/tclClock.c
@@ -100,7 +100,7 @@ typedef struct {
* Structure containing the fields used in [clock format] and [clock scan]
*/
-typedef struct TclDateFields {
+typedef struct {
Tcl_WideInt seconds; /* Time expressed in seconds from the Posix
* epoch */
Tcl_WideInt localSeconds; /* Local time expressed in nominal seconds
@@ -275,9 +275,9 @@ TclClockInit(
* Create the client data, which is a refcounted literal pool.
*/
- data = ckalloc(sizeof(ClockClientData));
+ data = Tcl_Alloc(sizeof(ClockClientData));
data->refCount = 0;
- data->literals = ckalloc(LIT__END * sizeof(Tcl_Obj*));
+ data->literals = Tcl_Alloc(LIT__END * sizeof(Tcl_Obj*));
for (i = 0; i < LIT__END; ++i) {
data->literals[i] = Tcl_NewStringObj(literals[i], -1);
Tcl_IncrRefCount(data->literals[i]);
@@ -1917,7 +1917,7 @@ ClockParseformatargsObjCmd(
if (Tcl_GetIndexFromObj(interp, objv[i], options, "option", 0,
&optionIndex) != TCL_OK) {
Tcl_SetErrorCode(interp, "CLOCK", "badOption",
- Tcl_GetString(objv[i]), NULL);
+ TclGetString(objv[i]), NULL);
return TCL_ERROR;
}
switch (optionIndex) {
@@ -2034,13 +2034,13 @@ TzsetIfNecessary(void)
|| strcmp(tzIsNow, tzWas) != 0)) {
tzset();
if (tzWas != NULL && tzWas != INT2PTR(-1)) {
- ckfree(tzWas);
+ Tcl_Free(tzWas);
}
- tzWas = ckalloc(strlen(tzIsNow) + 1);
+ tzWas = Tcl_Alloc(strlen(tzIsNow) + 1);
strcpy(tzWas, tzIsNow);
} else if (tzIsNow == NULL && tzWas != NULL) {
tzset();
- if (tzWas != INT2PTR(-1)) ckfree(tzWas);
+ if (tzWas != INT2PTR(-1)) Tcl_Free(tzWas);
tzWas = NULL;
}
Tcl_MutexUnlock(&clockMutex);
@@ -2071,8 +2071,8 @@ ClockDeleteCmdProc(
for (i = 0; i < LIT__END; ++i) {
Tcl_DecrRefCount(data->literals[i]);
}
- ckfree(data->literals);
- ckfree(data);
+ Tcl_Free(data->literals);
+ Tcl_Free(data);
}
}
diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c
index c7ec4f9..8b5a15c 100644
--- a/generic/tclCmdAH.c
+++ b/generic/tclCmdAH.c
@@ -145,143 +145,6 @@ Tcl_BreakObjCmd(
/*
*----------------------------------------------------------------------
*
- * Tcl_CaseObjCmd --
- *
- * This procedure is invoked to process the "case" Tcl command. See the
- * user documentation for details on what it does. THIS COMMAND IS
- * OBSOLETE AND DEPRECATED. SLATED FOR REMOVAL IN TCL 9.0.
- *
- * Results:
- * A standard Tcl object result.
- *
- * Side effects:
- * See the user documentation.
- *
- *----------------------------------------------------------------------
- */
-#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
- /* ARGSUSED */
-int
-Tcl_CaseObjCmd(
- ClientData dummy, /* Not used. */
- Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
- Tcl_Obj *const objv[]) /* Argument objects. */
-{
- register int i;
- int body, result, caseObjc;
- const char *stringPtr, *arg;
- Tcl_Obj *const *caseObjv;
- Tcl_Obj *armPtr;
-
- if (objc < 3) {
- Tcl_WrongNumArgs(interp, 1, objv,
- "string ?in? ?pattern body ...? ?default body?");
- return TCL_ERROR;
- }
-
- stringPtr = TclGetString(objv[1]);
- body = -1;
-
- arg = TclGetString(objv[2]);
- if (strcmp(arg, "in") == 0) {
- i = 3;
- } else {
- i = 2;
- }
- caseObjc = objc - i;
- caseObjv = objv + i;
-
- /*
- * If all of the pattern/command pairs are lumped into a single argument,
- * split them out again.
- */
-
- if (caseObjc == 1) {
- Tcl_Obj **newObjv;
-
- TclListObjGetElements(interp, caseObjv[0], &caseObjc, &newObjv);
- caseObjv = newObjv;
- }
-
- for (i = 0; i < caseObjc; i += 2) {
- int patObjc, j;
- const char **patObjv;
- const char *pat, *p;
-
- if (i == caseObjc-1) {
- Tcl_ResetResult(interp);
- Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "extra case pattern with no body", -1));
- return TCL_ERROR;
- }
-
- /*
- * Check for special case of single pattern (no list) with no
- * backslash sequences.
- */
-
- pat = TclGetString(caseObjv[i]);
- for (p = pat; *p != '\0'; p++) {
- if (TclIsSpaceProc(*p) || (*p == '\\')) {
- break;
- }
- }
- if (*p == '\0') {
- if ((*pat == 'd') && (strcmp(pat, "default") == 0)) {
- body = i + 1;
- }
- if (Tcl_StringMatch(stringPtr, pat)) {
- body = i + 1;
- goto match;
- }
- continue;
- }
-
- /*
- * Break up pattern lists, then check each of the patterns in the
- * list.
- */
-
- result = Tcl_SplitList(interp, pat, &patObjc, &patObjv);
- if (result != TCL_OK) {
- return result;
- }
- for (j = 0; j < patObjc; j++) {
- if (Tcl_StringMatch(stringPtr, patObjv[j])) {
- body = i + 1;
- break;
- }
- }
- ckfree(patObjv);
- if (j < patObjc) {
- break;
- }
- }
-
- match:
- if (body != -1) {
- armPtr = caseObjv[body - 1];
- result = Tcl_EvalObjEx(interp, caseObjv[body], 0);
- if (result == TCL_ERROR) {
- Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
- "\n (\"%.50s\" arm line %d)",
- TclGetString(armPtr), Tcl_GetErrorLine(interp)));
- }
- return result;
- }
-
- /*
- * Nothing matched: return nothing.
- */
-
- return TCL_OK;
-}
-#endif /* !TCL_NO_DEPRECATED */
-
-/*
- *----------------------------------------------------------------------
- *
* Tcl_CatchObjCmd --
*
* This object-based procedure is invoked to process the "catch" Tcl
@@ -564,7 +427,7 @@ EncodingConvertfromObjCmd(
Tcl_Obj *data; /* Byte array to convert */
Tcl_DString ds; /* Buffer to hold the string */
Tcl_Encoding encoding; /* Encoding to use */
- int length; /* Length of the byte array being converted */
+ size_t length = 0; /* Length of the byte array being converted */
const char *bytesPtr; /* Pointer to the first byte of the array */
if (objc == 2) {
@@ -583,7 +446,7 @@ EncodingConvertfromObjCmd(
/*
* Convert the string into a byte array in 'ds'
*/
- bytesPtr = (char *) Tcl_GetByteArrayFromObj(data, &length);
+ bytesPtr = (char *) TclGetByteArrayFromObj(data, &length);
Tcl_ExternalToUtfDString(encoding, bytesPtr, length, &ds);
/*
@@ -626,7 +489,7 @@ EncodingConverttoObjCmd(
Tcl_Obj *data; /* String to convert */
Tcl_DString ds; /* Buffer to hold the byte array */
Tcl_Encoding encoding; /* Encoding to use */
- int length; /* Length of the string being converted */
+ size_t length; /* Length of the string being converted */
const char *stringPtr; /* Pointer to the first byte of the string */
/* TODO - ADJUST OBJ INDICES WHEN ENSEMBLIFYING THIS */
@@ -1847,7 +1710,7 @@ PathFilesystemCmd(
if (fsInfo == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj("unrecognised path", -1));
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "FILESYSTEM",
- Tcl_GetString(objv[1]), NULL);
+ TclGetString(objv[1]), NULL);
return TCL_ERROR;
}
Tcl_SetObjResult(interp, fsInfo);
@@ -2099,7 +1962,7 @@ FilesystemSeparatorCmd(
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"unrecognised path", -1));
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "FILESYSTEM",
- Tcl_GetString(objv[1]), NULL);
+ TclGetString(objv[1]), NULL);
return TCL_ERROR;
}
Tcl_SetObjResult(interp, separatorObj);
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c
index cbb40c6..3057ba4 100644
--- a/generic/tclCmdIL.c
+++ b/generic/tclCmdIL.c
@@ -35,7 +35,7 @@ typedef struct SortElement {
} collationKey;
union { /* Object being sorted, or its index. */
Tcl_Obj *objPtr;
- int index;
+ size_t index;
} payload;
struct SortElement *nextPtr;/* Next element in the list, or NULL for end
* of list. */
@@ -541,7 +541,7 @@ InfoBodyCmd(
register Interp *iPtr = (Interp *) interp;
const char *name, *bytes;
Proc *procPtr;
- int numBytes;
+ size_t numBytes;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "procname");
@@ -651,7 +651,7 @@ InfoCommandsCmd(
Tcl_Obj *listPtr, *elemObjPtr;
int specificNsInPattern = 0;/* Init. to avoid compiler warning. */
Tcl_Command cmd;
- int i;
+ size_t i;
/*
* Get the pattern and find the "effective namespace" in which to list
@@ -1396,7 +1396,7 @@ TclInfoFrame(
ADD_PAIR("proc", procNameObj);
} else if (procPtr->cmdPtr->clientData) {
ExtraFrameInfo *efiPtr = procPtr->cmdPtr->clientData;
- int i;
+ size_t i;
/*
* This is a non-standard command. Luckily, it's told us how to
@@ -2200,7 +2200,8 @@ Tcl_JoinObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* The argument objects. */
{
- int length, listLen;
+ size_t length;
+ int listLen;
Tcl_Obj *resObjPtr = NULL, *joinObjPtr, **elemPtrs;
if ((objc < 2) || (objc > 3)) {
@@ -2419,7 +2420,8 @@ Tcl_LinsertObjCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tcl_Obj *listPtr;
- int index, len, result;
+ size_t index;
+ int len, result;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 1, objv, "list index ?element ...?");
@@ -2441,7 +2443,7 @@ Tcl_LinsertObjCmd(
if (result != TCL_OK) {
return result;
}
- if (index > len) {
+ if (index + 1 > (size_t)len + 1) {
index = len;
}
@@ -2455,7 +2457,7 @@ Tcl_LinsertObjCmd(
listPtr = TclListObjCopy(NULL, listPtr);
}
- if ((objc == 4) && (index == len)) {
+ if ((objc == 4) && (index == (size_t)len)) {
/*
* Special case: insert one element at the end of the list.
*/
@@ -2676,7 +2678,8 @@ Tcl_LrangeObjCmd(
register Tcl_Obj *const objv[])
/* Argument objects. */
{
- int listLen, first, last, result;
+ int listLen, result;
+ size_t first, last;
if (objc != 4) {
Tcl_WrongNumArgs(interp, 1, objv, "list first last");
@@ -2726,8 +2729,8 @@ LremoveIndexCompare(
const void *el1Ptr,
const void *el2Ptr)
{
- int idx1 = *((const int *) el1Ptr);
- int idx2 = *((const int *) el2Ptr);
+ size_t idx1 = *((const size_t *) el1Ptr);
+ size_t idx2 = *((const size_t *) el2Ptr);
/*
* This will put the larger element first.
@@ -2743,8 +2746,8 @@ Tcl_LremoveObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- int i, idxc;
- int listLen, *idxv, prevIdx, first, num;
+ int i, idxc, listLen, prevIdx, first, num;
+ size_t *idxv;
Tcl_Obj *listObj;
/*
@@ -2766,11 +2769,11 @@ Tcl_LremoveObjCmd(
Tcl_SetObjResult(interp, listObj);
return TCL_OK;
}
- idxv = ckalloc((objc - 2) * sizeof(int));
+ idxv = Tcl_Alloc((objc - 2) * sizeof(size_t));
for (i = 2; i < objc; i++) {
if (TclGetIntForIndexM(interp, objv[i], /*endValue*/ listLen - 1,
&idxv[i - 2]) != TCL_OK) {
- ckfree(idxv);
+ Tcl_Free(idxv);
return TCL_ERROR;
}
}
@@ -2781,7 +2784,7 @@ Tcl_LremoveObjCmd(
*/
if (idxc > 1) {
- qsort(idxv, idxc, sizeof(int), LremoveIndexCompare);
+ qsort(idxv, idxc, sizeof(size_t), LremoveIndexCompare);
}
/*
@@ -2833,7 +2836,7 @@ Tcl_LremoveObjCmd(
if (num != 0) {
(void) Tcl_ListObjReplace(interp, listObj, first, num, 0, NULL);
}
- ckfree(idxv);
+ Tcl_Free(idxv);
Tcl_SetObjResult(interp, listObj);
return TCL_OK;
}
@@ -2972,7 +2975,8 @@ Tcl_LreplaceObjCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
register Tcl_Obj *listPtr;
- int first, last, listLen, numToDelete, result;
+ size_t first, last;
+ int listLen, numToDelete, result;
if (objc < 4) {
Tcl_WrongNumArgs(interp, 1, objv,
@@ -3003,15 +3007,14 @@ Tcl_LreplaceObjCmd(
if (first == TCL_INDEX_NONE) {
first = 0;
- }
- if (first > listLen) {
+ } else if (first > (size_t)listLen) {
first = listLen;
}
- if (last >= listLen) {
+ if (last + 1 > (size_t)listLen) {
last = listLen - 1;
}
- if (first <= last) {
+ if (first + 1 <= last + 1) {
numToDelete = last - first + 1;
} else {
numToDelete = 0;
@@ -3152,10 +3155,11 @@ Tcl_LsearchObjCmd(
Tcl_Obj *const objv[]) /* Argument values. */
{
const char *bytes, *patternBytes;
- int i, match, index, result=TCL_OK, listc, length, elemLen, bisect;
+ int i, match, index, result=TCL_OK, listc, bisect;
+ size_t length = 0, elemLen, start, groupSize, groupOffset, lower, upper;
int allocatedIndexVector = 0;
- int dataType, isIncreasing, lower, upper, start, groupSize, groupOffset;
- Tcl_WideInt patWide, objWide;
+ int dataType, isIncreasing;
+ Tcl_WideInt patWide, objWide, wide;
int allMatches, inlineReturn, negatedMatch, returnSubindices, noCase;
double patDouble, objDouble;
SortInfo sortInfo;
@@ -3311,11 +3315,11 @@ Tcl_LsearchObjCmd(
result = TCL_ERROR;
goto done;
}
- if (Tcl_GetIntFromObj(interp, objv[i+1], &groupSize) != TCL_OK) {
+ if (Tcl_GetWideIntFromObj(interp, objv[i+1], &wide) != TCL_OK) {
result = TCL_ERROR;
goto done;
}
- if (groupSize < 1) {
+ if (wide < 1) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"stride length must be at least 1", -1));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LSORT",
@@ -3323,6 +3327,7 @@ Tcl_LsearchObjCmd(
result = TCL_ERROR;
goto done;
}
+ groupSize = wide;
i++;
break;
case LSEARCH_INDEX: { /* -index */
@@ -3482,7 +3487,7 @@ Tcl_LsearchObjCmd(
*/
groupOffset = TclIndexDecode(sortInfo.indexv[0], groupSize - 1);
- if (groupOffset < 0 || groupOffset >= groupSize) {
+ if (groupOffset >= groupSize) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"when used with \"-stride\", the leading \"-index\""
" value must be within the group", -1));
@@ -3522,7 +3527,7 @@ Tcl_LsearchObjCmd(
* "did not match anything at all" result straight away. [Bug 1374778]
*/
- if (start > listc-1) {
+ if (start >= (size_t)listc) {
if (allMatches || inlineReturn) {
Tcl_ResetResult(interp);
} else {
@@ -3730,8 +3735,7 @@ Tcl_LsearchObjCmd(
if (noCase) {
match = (TclUtfCasecmp(bytes, patternBytes) == 0);
} else {
- match = (memcmp(bytes, patternBytes,
- (size_t) length) == 0);
+ match = (memcmp(bytes, patternBytes, length) == 0);
}
}
break;
@@ -3815,9 +3819,9 @@ Tcl_LsearchObjCmd(
} else if (returnSubindices) {
int j;
- itemPtr = Tcl_NewWideIntObj(i+groupOffset);
+ itemPtr = TclNewWideIntObjFromSize(i+groupOffset);
for (j=0 ; j<sortInfo.indexc ; j++) {
- Tcl_ListObjAppendElement(interp, itemPtr, Tcl_NewWideIntObj(
+ Tcl_ListObjAppendElement(interp, itemPtr, TclNewWideIntObjFromSize(
TclIndexDecode(sortInfo.indexv[j], listc)));
}
Tcl_ListObjAppendElement(interp, listPtr, itemPtr);
@@ -3837,9 +3841,9 @@ Tcl_LsearchObjCmd(
if (returnSubindices) {
int j;
- itemPtr = Tcl_NewWideIntObj(index+groupOffset);
+ itemPtr = TclNewWideIntObjFromSize(index+groupOffset);
for (j=0 ; j<sortInfo.indexc ; j++) {
- Tcl_ListObjAppendElement(interp, itemPtr, Tcl_NewWideIntObj(
+ Tcl_ListObjAppendElement(interp, itemPtr, TclNewWideIntObjFromSize(
TclIndexDecode(sortInfo.indexv[j], listc)));
}
Tcl_SetObjResult(interp, itemPtr);
@@ -3988,9 +3992,11 @@ Tcl_LsortObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument values. */
{
- int i, j, index, indices, length, nocase = 0, indexc;
+ int i, index, indices, length, nocase = 0, indexc;
int sortMode = SORTMODE_ASCII;
- int group, groupSize, groupOffset, idx, allocatedIndexVector = 0;
+ int group, allocatedIndexVector = 0;
+ size_t j, idx, groupSize, groupOffset;
+ Tcl_WideInt wide;
Tcl_Obj *resultPtr, *cmdPtr, **listObjPtrs, *listObj, *indexPtr;
SortElement *elementArray = NULL, *elementPtr;
SortInfo sortInfo; /* Information about this sort that needs to
@@ -4092,7 +4098,7 @@ Tcl_LsortObjCmd(
* options is done.
*/
- for (j=0 ; j<indexc ; j++) {
+ for (j=0 ; j<(size_t)indexc ; j++) {
int encoded = 0;
int result = TclIndexEncode(interp, indexv[j],
TCL_INDEX_NONE, TCL_INDEX_NONE, &encoded);
@@ -4107,7 +4113,7 @@ Tcl_LsortObjCmd(
}
if (result == TCL_ERROR) {
Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
- "\n (-index option item number %d)", j));
+ "\n (-index option item number %" TCL_Z_MODIFIER "d)", j));
sortInfo.resultCode = TCL_ERROR;
goto done;
}
@@ -4140,11 +4146,11 @@ Tcl_LsortObjCmd(
sortInfo.resultCode = TCL_ERROR;
goto done;
}
- if (Tcl_GetIntFromObj(interp, objv[i+1], &groupSize) != TCL_OK) {
+ if (Tcl_GetWideIntFromObj(interp, objv[i+1], &wide) != TCL_OK) {
sortInfo.resultCode = TCL_ERROR;
goto done;
}
- if (groupSize < 2) {
+ if (wide < 2) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"stride length must be at least 2", -1));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LSORT",
@@ -4152,6 +4158,7 @@ Tcl_LsortObjCmd(
sortInfo.resultCode = TCL_ERROR;
goto done;
}
+ groupSize = wide;
group = 1;
i++;
break;
@@ -4184,7 +4191,7 @@ Tcl_LsortObjCmd(
allocatedIndexVector = 1; /* Cannot use indexc field, as it
* might be decreased by 1 later. */
}
- for (j=0 ; j<sortInfo.indexc ; j++) {
+ for (j=0 ; j<(size_t)sortInfo.indexc ; j++) {
/* Prescreened values, no errors or out of range possible */
TclIndexEncode(NULL, indexv[j], TCL_INDEX_NONE,
TCL_INDEX_NONE, &sortInfo.indexv[j]);
@@ -4259,7 +4266,7 @@ Tcl_LsortObjCmd(
*/
groupOffset = TclIndexDecode(sortInfo.indexv[0], groupSize - 1);
- if (groupOffset < 0 || groupOffset >= groupSize) {
+ if (groupOffset >= groupSize) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"when used with \"-stride\", the leading \"-index\""
" value must be within the group", -1));
@@ -4317,7 +4324,7 @@ Tcl_LsortObjCmd(
* begins sorting it into the sublists as it appears.
*/
- elementArray = ckalloc(length * sizeof(SortElement));
+ elementArray = Tcl_Alloc(length * sizeof(SortElement));
for (i=0; i < length; i++) {
idx = groupSize * i + groupOffset;
@@ -4413,7 +4420,7 @@ Tcl_LsortObjCmd(
idx = elementPtr->payload.index;
for (j = 0; j < groupSize; j++) {
if (indices) {
- objPtr = Tcl_NewWideIntObj(idx + j - groupOffset);
+ objPtr = TclNewWideIntObjFromSize(idx + j - groupOffset);
newArray[i++] = objPtr;
Tcl_IncrRefCount(objPtr);
} else {
@@ -4425,7 +4432,7 @@ Tcl_LsortObjCmd(
}
} else if (indices) {
for (i=0; elementPtr != NULL ; elementPtr = elementPtr->nextPtr) {
- objPtr = Tcl_NewWideIntObj(elementPtr->payload.index);
+ objPtr = TclNewWideIntObjFromSize(elementPtr->payload.index);
newArray[i++] = objPtr;
Tcl_IncrRefCount(objPtr);
}
@@ -4450,7 +4457,7 @@ Tcl_LsortObjCmd(
TclStackFree(interp, sortInfo.indexv);
}
if (elementArray) {
- ckfree(elementArray);
+ Tcl_Free(elementArray);
}
return sortInfo.resultCode;
}
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c
index a754a09..79d5d09 100644
--- a/generic/tclCmdMZ.c
+++ b/generic/tclCmdMZ.c
@@ -127,8 +127,8 @@ Tcl_RegexpObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- int i, indices, match, about, offset, all, doinline, numMatchesSaved;
- int cflags, eflags, stringLength, matchLength;
+ size_t offset, stringLength, matchLength, cflags, eflags;
+ int i, indices, match, about, all, doinline, numMatchesSaved;
Tcl_RegExp regExpr;
Tcl_Obj *objPtr, *startIndex = NULL, *resultPtr = NULL;
Tcl_RegExpInfo info;
@@ -146,7 +146,7 @@ Tcl_RegexpObjCmd(
indices = 0;
about = 0;
cflags = TCL_REG_ADVANCED;
- offset = 0;
+ offset = TCL_INDEX_START;
all = 0;
doinline = 0;
@@ -191,11 +191,11 @@ Tcl_RegexpObjCmd(
cflags |= TCL_REG_NLANCH;
break;
case REGEXP_START: {
- int temp;
+ size_t temp;
if (++i >= objc) {
goto endOfForLoop;
}
- if (TclGetIntForIndexM(interp, objv[i], 0, &temp) != TCL_OK) {
+ if (TclGetIntForIndexM(interp, objv[i], TCL_INDEX_START, &temp) != TCL_OK) {
goto optionError;
}
if (startIndex) {
@@ -261,8 +261,8 @@ Tcl_RegexpObjCmd(
if (startIndex) {
TclGetIntForIndexM(interp, startIndex, stringLength, &offset);
Tcl_DecrRefCount(startIndex);
- if (offset < 0) {
- offset = 0;
+ if (offset == TCL_INDEX_NONE) {
+ offset = TCL_INDEX_START;
}
}
@@ -306,9 +306,9 @@ Tcl_RegexpObjCmd(
* start of the string unless the previous character is a newline.
*/
- if (offset == 0) {
+ if (offset == TCL_INDEX_START) {
eflags = 0;
- } else if (offset > stringLength) {
+ } else if (offset + 1 > stringLength + 1) {
eflags = TCL_REG_NOTBOL;
} else if (Tcl_GetUniChar(objPtr, offset-1) == '\n') {
eflags = 0;
@@ -364,7 +364,7 @@ Tcl_RegexpObjCmd(
Tcl_Obj *newPtr;
if (indices) {
- int start, end;
+ size_t start, end;
Tcl_Obj *objs[2];
/*
@@ -372,7 +372,7 @@ Tcl_RegexpObjCmd(
* area. (Scriptics Bug 4391/SF Bug #219232)
*/
- if (i <= info.nsubs && info.matches[i].start >= 0) {
+ if (i <= (int)info.nsubs && info.matches[i].start != TCL_INDEX_NONE) {
start = offset + info.matches[i].start;
end = offset + info.matches[i].end;
@@ -381,20 +381,20 @@ Tcl_RegexpObjCmd(
* match instead of the first character after the match.
*/
- if (end >= offset) {
+ if (end + 1 >= offset + 1) {
end--;
}
} else {
- start = -1;
- end = -1;
+ start = TCL_INDEX_NONE;
+ end = TCL_INDEX_NONE;
}
- objs[0] = Tcl_NewWideIntObj(start);
- objs[1] = Tcl_NewWideIntObj(end);
+ objs[0] = TclNewWideIntObjFromSize(start);
+ objs[1] = TclNewWideIntObjFromSize(end);
newPtr = Tcl_NewListObj(2, objs);
} else {
- if (i <= info.nsubs) {
+ if (i <= (int)info.nsubs) {
newPtr = Tcl_GetRange(objPtr,
offset + info.matches[i].start,
offset + info.matches[i].end - 1);
@@ -444,7 +444,7 @@ Tcl_RegexpObjCmd(
offset++;
}
all++;
- if (offset >= stringLength) {
+ if (offset + 1 >= stringLength + 1) {
break;
}
}
@@ -487,8 +487,9 @@ Tcl_RegsubObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- int idx, result, cflags, all, wlen, wsublen, numMatches, offset;
- int start, end, subStart, subEnd, match, command, numParts;
+ int result, cflags, all, match, command, numParts;
+ size_t idx, wlen, wsublen = 0, offset, numMatches;
+ size_t start, end, subStart, subEnd;
Tcl_RegExp regExpr;
Tcl_RegExpInfo info;
Tcl_Obj *resultPtr, *subPtr, *objPtr, *startIndex = NULL;
@@ -507,11 +508,11 @@ Tcl_RegsubObjCmd(
cflags = TCL_REG_ADVANCED;
all = 0;
- offset = 0;
+ offset = TCL_INDEX_START;
command = 0;
resultPtr = NULL;
- for (idx = 1; idx < objc; idx++) {
+ for (idx = 1; idx < (size_t)objc; idx++) {
const char *name;
int index;
@@ -546,11 +547,11 @@ Tcl_RegsubObjCmd(
cflags |= TCL_REG_NLANCH;
break;
case REGSUB_START: {
- int temp;
- if (++idx >= objc) {
+ size_t temp;
+ if (++idx >= (size_t)objc) {
goto endOfForLoop;
}
- if (TclGetIntForIndexM(interp, objv[idx], 0, &temp) != TCL_OK) {
+ if (TclGetIntForIndexM(interp, objv[idx], TCL_INDEX_START, &temp) != TCL_OK) {
goto optionError;
}
if (startIndex) {
@@ -567,7 +568,7 @@ Tcl_RegsubObjCmd(
}
endOfForLoop:
- if (objc-idx < 3 || objc-idx > 4) {
+ if ((size_t)objc < idx + 3 || (size_t)objc > idx + 4) {
Tcl_WrongNumArgs(interp, 1, objv,
"?-option ...? exp string subSpec ?varName?");
optionError:
@@ -581,16 +582,16 @@ Tcl_RegsubObjCmd(
objv += idx;
if (startIndex) {
- int stringLength = Tcl_GetCharLength(objv[1]);
+ size_t stringLength = Tcl_GetCharLength(objv[1]);
TclGetIntForIndexM(interp, startIndex, stringLength, &offset);
Tcl_DecrRefCount(startIndex);
- if (offset < 0) {
- offset = 0;
+ if (offset == TCL_INDEX_NONE) {
+ offset = TCL_INDEX_START;
}
}
- if (all && (offset == 0) && (command == 0)
+ if (all && (offset == TCL_INDEX_START) && (command == 0)
&& (strpbrk(TclGetString(objv[2]), "&\\") == NULL)
&& (strpbrk(TclGetString(objv[0]), "*+?{}()[].\\|^$") == NULL)) {
/*
@@ -598,17 +599,18 @@ Tcl_RegsubObjCmd(
* slightly modified version of the one pair STR_MAP code.
*/
- int slen, nocase, wsrclc;
- int (*strCmpFn)(const Tcl_UniChar*,const Tcl_UniChar*,unsigned long);
+ size_t slen;
+ int nocase, wsrclc;
+ int (*strCmpFn)(const Tcl_UniChar*,const Tcl_UniChar*,size_t);
Tcl_UniChar *p;
numMatches = 0;
nocase = (cflags & TCL_REG_NOCASE);
strCmpFn = nocase ? Tcl_UniCharNcasecmp : Tcl_UniCharNcmp;
- wsrc = Tcl_GetUnicodeFromObj(objv[0], &slen);
- wstring = Tcl_GetUnicodeFromObj(objv[1], &wlen);
- wsubspec = Tcl_GetUnicodeFromObj(objv[2], &wsublen);
+ wsrc = TclGetUnicodeFromObj(objv[0], &slen);
+ wstring = TclGetUnicodeFromObj(objv[1], &wlen);
+ wsubspec = TclGetUnicodeFromObj(objv[2], &wsublen);
wend = wstring + wlen - (slen ? slen - 1 : 0);
result = TCL_OK;
@@ -633,8 +635,7 @@ Tcl_RegsubObjCmd(
for (p = wfirstChar = wstring; wstring < wend; wstring++) {
if ((*wstring == *wsrc ||
(nocase && Tcl_UniCharToLower(*wstring)==wsrclc)) &&
- (slen==1 || (strCmpFn(wstring, wsrc,
- (unsigned long) slen) == 0))) {
+ (slen==1 || (strCmpFn(wstring, wsrc, slen) == 0))) {
if (numMatches == 0) {
resultPtr = Tcl_NewUnicodeObj(wstring, 0);
Tcl_IncrRefCount(resultPtr);
@@ -699,14 +700,14 @@ Tcl_RegsubObjCmd(
} else {
objPtr = objv[1];
}
- wstring = Tcl_GetUnicodeFromObj(objPtr, &wlen);
+ wstring = TclGetUnicodeFromObj(objPtr, &wlen);
if (objv[2] == objv[0]) {
subPtr = Tcl_DuplicateObj(objv[2]);
} else {
subPtr = objv[2];
}
if (!command) {
- wsubspec = Tcl_GetUnicodeFromObj(subPtr, &wsublen);
+ wsubspec = TclGetUnicodeFromObj(subPtr, &wsublen);
}
result = TCL_OK;
@@ -744,7 +745,7 @@ Tcl_RegsubObjCmd(
if (numMatches == 0) {
resultPtr = Tcl_NewUnicodeObj(wstring, 0);
Tcl_IncrRefCount(resultPtr);
- if (offset > 0) {
+ if (offset > TCL_INDEX_START) {
/*
* Copy the initial portion of the string in if an offset was
* specified.
@@ -778,7 +779,7 @@ Tcl_RegsubObjCmd(
Tcl_ListObjGetElements(interp, subPtr, &numParts, &parts);
numArgs = numParts + info.nsubs + 1;
- args = ckalloc(sizeof(Tcl_Obj*) * numArgs);
+ args = Tcl_Alloc(sizeof(Tcl_Obj*) * numArgs);
memcpy(args, parts, sizeof(Tcl_Obj*) * numParts);
for (idx = 0 ; idx <= info.nsubs ; idx++) {
@@ -808,7 +809,7 @@ Tcl_RegsubObjCmd(
for (idx = 0 ; idx <= info.nsubs ; idx++) {
TclDecrRefCount(args[idx + numParts]);
}
- ckfree(args);
+ Tcl_Free(args);
if (result != TCL_OK) {
if (result == TCL_ERROR) {
Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
@@ -826,7 +827,7 @@ Tcl_RegsubObjCmd(
* the user code.
*/
- wstring = Tcl_GetUnicodeFromObj(objPtr, &wlen);
+ wstring = TclGetUnicodeFromObj(objPtr, &wlen);
offset += end;
if (end == 0 || start == end) {
@@ -1179,7 +1180,7 @@ Tcl_SplitObjCmd(
const char *splitChars;
const char *stringPtr;
const char *end;
- int splitCharLen, stringLen;
+ size_t splitCharLen, stringLen;
Tcl_Obj *listPtr, *objPtr;
if (objc == 2) {
@@ -1258,7 +1259,7 @@ Tcl_SplitObjCmd(
* byte in length.
*/
- while (*stringPtr && (p=strchr(stringPtr,(int)*splitChars)) != NULL) {
+ while (*stringPtr && (p=strchr(stringPtr,*splitChars)) != NULL) {
objPtr = Tcl_NewStringObj(stringPtr, p - stringPtr);
Tcl_ListObjAppendElement(NULL, listPtr, objPtr);
stringPtr = p + 1;
@@ -1267,7 +1268,7 @@ Tcl_SplitObjCmd(
Tcl_ListObjAppendElement(NULL, listPtr, objPtr);
} else {
const char *element, *p, *splitEnd;
- int splitLen;
+ size_t splitLen;
Tcl_UniChar splitChar = 0;
/*
@@ -1322,7 +1323,7 @@ StringFirstCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- int start = 0;
+ size_t start = TCL_INDEX_START;
if (objc < 3 || objc > 4) {
Tcl_WrongNumArgs(interp, 1, objv,
@@ -1331,13 +1332,13 @@ StringFirstCmd(
}
if (objc == 4) {
- int size = Tcl_GetCharLength(objv[2]);
+ size_t end = Tcl_GetCharLength(objv[2]) - 1;
- if (TCL_OK != TclGetIntForIndexM(interp, objv[3], size - 1, &start)) {
+ if (TCL_OK != TclGetIntForIndexM(interp, objv[3], end, &start)) {
return TCL_ERROR;
}
}
- Tcl_SetObjResult(interp, Tcl_NewWideIntObj(TclStringFirst(objv[1],
+ Tcl_SetObjResult(interp, TclNewWideIntObjFromSize(TclStringFirst(objv[1],
objv[2], start)));
return TCL_OK;
}
@@ -1367,7 +1368,7 @@ StringLastCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- int last = INT_MAX - 1;
+ size_t last = TCL_INDEX_END;
if (objc < 3 || objc > 4) {
Tcl_WrongNumArgs(interp, 1, objv,
@@ -1376,13 +1377,13 @@ StringLastCmd(
}
if (objc == 4) {
- int size = Tcl_GetCharLength(objv[2]);
+ size_t end = Tcl_GetCharLength(objv[2]) - 1;
- if (TCL_OK != TclGetIntForIndexM(interp, objv[3], size - 1, &last)) {
+ if (TCL_OK != TclGetIntForIndexM(interp, objv[3], end, &last)) {
return TCL_ERROR;
}
}
- Tcl_SetObjResult(interp, Tcl_NewWideIntObj(TclStringLast(objv[1],
+ Tcl_SetObjResult(interp, TclNewWideIntObjFromSize(TclStringLast(objv[1],
objv[2], last)));
return TCL_OK;
}
@@ -1412,7 +1413,7 @@ StringIndexCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- int length, index;
+ size_t index, end;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 1, objv, "string charIndex");
@@ -1423,12 +1424,12 @@ StringIndexCmd(
* Get the char length to calculate what 'end' means.
*/
- length = Tcl_GetCharLength(objv[1]);
- if (TclGetIntForIndexM(interp, objv[2], length-1, &index) != TCL_OK) {
+ end = Tcl_GetCharLength(objv[1]) - 1;
+ if (TclGetIntForIndexM(interp, objv[2], end, &index) != TCL_OK) {
return TCL_ERROR;
}
- if ((index >= 0) && (index < length)) {
+ if ((index != TCL_INDEX_NONE) && (index + 1 <= end + 1)) {
int ch = Tcl_GetUniChar(objv[1], index);
if (ch == -1) {
@@ -1447,11 +1448,11 @@ StringIndexCmd(
} else {
char buf[4] = "";
- length = Tcl_UniCharToUtf(ch, buf);
- if ((ch >= 0xD800) && (length < 3)) {
- length += Tcl_UniCharToUtf(-1, buf + length);
+ end = Tcl_UniCharToUtf(ch, buf);
+ if ((ch >= 0xD800) && (end < 3)) {
+ end += Tcl_UniCharToUtf(-1, buf + end);
}
- Tcl_SetObjResult(interp, Tcl_NewStringObj(buf, length));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(buf, end));
}
}
return TCL_OK;
@@ -1482,8 +1483,8 @@ StringInsertCmd(
int objc, /* Number of arguments */
Tcl_Obj *const objv[]) /* Argument objects */
{
- int length; /* String length */
- int index; /* Insert index */
+ size_t length; /* String length */
+ size_t index; /* Insert index */
Tcl_Obj *outObj; /* Output object */
if (objc != 4) {
@@ -1496,8 +1497,8 @@ StringInsertCmd(
return TCL_ERROR;
}
- if (index < 0) {
- index = 0;
+ if (index == TCL_INDEX_NONE) {
+ index = TCL_INDEX_START;
}
if (index > length) {
index = length;
@@ -1542,7 +1543,9 @@ StringIsCmd(
const char *string1, *end, *stop;
Tcl_UniChar ch = 0;
int (*chcomp)(int) = NULL; /* The UniChar comparison function. */
- int i, failat = 0, result = 1, strict = 0, index, length1, length2;
+ int i, result = 1, strict = 0, index, length3;
+ size_t failat = 0;
+ size_t length1, length2;
Tcl_Obj *objPtr, *failVarObj = NULL;
Tcl_WideInt w;
@@ -1637,11 +1640,9 @@ StringIsCmd(
string1 = TclGetStringFromObj(objPtr, &length1);
result = length1 == 0;
}
- } else if (index != STR_IS_BOOL) {
- TclGetBooleanFromObj(NULL, objPtr, &i);
- if ((index == STR_IS_TRUE) ^ i) {
- result = 0;
- }
+ } else if ((objPtr->internalRep.wideValue != 0)
+ ? (index == STR_IS_FALSE) : (index == STR_IS_TRUE)) {
+ result = 0;
}
break;
case STR_IS_CONTROL:
@@ -1661,7 +1662,8 @@ StringIsCmd(
*/
const char *elemStart, *nextElem;
- int lenRemain, elemSize;
+ int lenRemain;
+ size_t elemSize;
register const char *p;
string1 = TclGetStringFromObj(objPtr, &length1);
@@ -1829,7 +1831,7 @@ StringIsCmd(
* well-formed lists.
*/
- if (TCL_OK == TclListObjLength(NULL, objPtr, &length2)) {
+ if (TCL_OK == TclListObjLength(NULL, objPtr, &length3)) {
break;
}
@@ -1841,7 +1843,8 @@ StringIsCmd(
*/
const char *elemStart, *nextElem;
- int lenRemain, elemSize;
+ size_t lenRemain;
+ size_t elemSize;
register const char *p;
string1 = TclGetStringFromObj(objPtr, &length1);
@@ -1931,7 +1934,7 @@ StringIsCmd(
str_is_done:
if ((result == 0) && (failVarObj != NULL) &&
- Tcl_ObjSetVar2(interp, failVarObj, NULL, Tcl_NewWideIntObj(failat),
+ Tcl_ObjSetVar2(interp, failVarObj, NULL, TclNewWideIntObjFromSize(failat),
TCL_LEAVE_ERR_MSG) == NULL) {
return TCL_ERROR;
}
@@ -1978,11 +1981,11 @@ StringMapCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- int length1, length2, mapElemc, index;
+ size_t length1, length2, mapElemc, index;
int nocase = 0, mapWithDict = 0, copySource = 0;
Tcl_Obj **mapElemv, *sourceObj, *resultPtr;
Tcl_UniChar *ustring1, *ustring2, *p, *end;
- int (*strCmpFn)(const Tcl_UniChar*, const Tcl_UniChar*, unsigned long);
+ int (*strCmpFn)(const Tcl_UniChar*, const Tcl_UniChar*, size_t);
if (objc < 3 || objc > 4) {
Tcl_WrongNumArgs(interp, 1, objv, "?-nocase? charMap string");
@@ -2019,8 +2022,8 @@ StringMapCmd(
* sure. This shortens this code quite a bit.
*/
- Tcl_DictObjSize(interp, objv[objc-2], &mapElemc);
- if (mapElemc == 0) {
+ Tcl_DictObjSize(interp, objv[objc-2], &i);
+ if (i == 0) {
/*
* Empty charMap, just return whatever string was given.
*/
@@ -2029,7 +2032,7 @@ StringMapCmd(
return TCL_OK;
}
- mapElemc *= 2;
+ mapElemc = 2 * i;
mapWithDict = 1;
/*
@@ -2040,15 +2043,17 @@ StringMapCmd(
mapElemv = TclStackAlloc(interp, sizeof(Tcl_Obj *) * mapElemc);
Tcl_DictObjFirst(interp, objv[objc-2], &search, mapElemv+0,
mapElemv+1, &done);
- for (i=2 ; i<mapElemc ; i+=2) {
- Tcl_DictObjNext(&search, mapElemv+i, mapElemv+i+1, &done);
+ for (index=2 ; index<mapElemc ; index+=2) {
+ Tcl_DictObjNext(&search, mapElemv+index, mapElemv+index+1, &done);
}
Tcl_DictObjDone(&search);
} else {
- if (TclListObjGetElements(interp, objv[objc-2], &mapElemc,
+ int i;
+ if (TclListObjGetElements(interp, objv[objc-2], &i,
&mapElemv) != TCL_OK) {
return TCL_ERROR;
}
+ mapElemc = i;
if (mapElemc == 0) {
/*
* empty charMap, just return whatever string was given.
@@ -2080,7 +2085,7 @@ StringMapCmd(
} else {
sourceObj = objv[objc-1];
}
- ustring1 = Tcl_GetUnicodeFromObj(sourceObj, &length1);
+ ustring1 = TclGetUnicodeFromObj(sourceObj, &length1);
if (length1 == 0) {
/*
* Empty input string, just stop now.
@@ -2106,10 +2111,11 @@ StringMapCmd(
* larger strings.
*/
- int mapLen, u2lc;
+ size_t mapLen;
+ int u2lc;
Tcl_UniChar *mapString;
- ustring2 = Tcl_GetUnicodeFromObj(mapElemv[0], &length2);
+ ustring2 = TclGetUnicodeFromObj(mapElemv[0], &length2);
p = ustring1;
if ((length2 > length1) || (length2 == 0)) {
/*
@@ -2118,13 +2124,13 @@ StringMapCmd(
ustring1 = end;
} else {
- mapString = Tcl_GetUnicodeFromObj(mapElemv[1], &mapLen);
+ mapString = TclGetUnicodeFromObj(mapElemv[1], &mapLen);
u2lc = (nocase ? Tcl_UniCharToLower(*ustring2) : 0);
for (; ustring1 < end; ustring1++) {
if (((*ustring1 == *ustring2) ||
(nocase&&Tcl_UniCharToLower(*ustring1)==u2lc)) &&
(length2==1 || strCmpFn(ustring1, ustring2,
- (unsigned long) length2) == 0)) {
+ length2) == 0)) {
if (p != ustring1) {
Tcl_AppendUnicodeToObj(resultPtr, p, ustring1-p);
p = ustring1 + length2;
@@ -2139,7 +2145,8 @@ StringMapCmd(
}
} else {
Tcl_UniChar **mapStrings;
- int *mapLens, *u2lc = NULL;
+ size_t *mapLens;
+ int *u2lc = 0;
/*
* Precompute pointers to the unicode string and length. This saves us
@@ -2148,13 +2155,13 @@ StringMapCmd(
* case.
*/
- mapStrings = TclStackAlloc(interp, mapElemc*2*sizeof(Tcl_UniChar *));
- mapLens = TclStackAlloc(interp, mapElemc * 2 * sizeof(int));
+ mapStrings = TclStackAlloc(interp, mapElemc*sizeof(Tcl_UniChar *)*2);
+ mapLens = TclStackAlloc(interp, mapElemc * sizeof(size_t) * 2);
if (nocase) {
u2lc = TclStackAlloc(interp, mapElemc * sizeof(int));
}
for (index = 0; index < mapElemc; index++) {
- mapStrings[index] = Tcl_GetUnicodeFromObj(mapElemv[index],
+ mapStrings[index] = TclGetUnicodeFromObj(mapElemv[index],
mapLens+index);
if (nocase && ((index % 2) == 0)) {
u2lc[index/2] = Tcl_UniCharToLower(*mapStrings[index]);
@@ -2171,7 +2178,7 @@ StringMapCmd(
if ((length2 > 0) && ((*ustring1 == *ustring2) || (nocase &&
(Tcl_UniCharToLower(*ustring1) == u2lc[index/2]))) &&
/* Restrict max compare length. */
- (end-ustring1 >= length2) && ((length2 == 1) ||
+ ((size_t)(end-ustring1) >= length2) && ((length2 == 1) ||
!strCmpFn(ustring2, ustring1, length2))) {
if (p != ustring1) {
/*
@@ -2257,7 +2264,7 @@ StringMatchCmd(
}
if (objc == 4) {
- int length;
+ size_t length;
const char *string = TclGetStringFromObj(objv[1], &length);
if ((length > 1) &&
@@ -2301,7 +2308,7 @@ StringRangeCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- int length, first, last;
+ size_t first, last, end;
if (objc != 4) {
Tcl_WrongNumArgs(interp, 1, objv, "string first last");
@@ -2313,20 +2320,20 @@ StringRangeCmd(
* 'end' refers to the last character, not one past it.
*/
- length = Tcl_GetCharLength(objv[1]) - 1;
+ end = Tcl_GetCharLength(objv[1]) - 1;
- if (TclGetIntForIndexM(interp, objv[2], length, &first) != TCL_OK ||
- TclGetIntForIndexM(interp, objv[3], length, &last) != TCL_OK) {
+ if (TclGetIntForIndexM(interp, objv[2], end, &first) != TCL_OK ||
+ TclGetIntForIndexM(interp, objv[3], end, &last) != TCL_OK) {
return TCL_ERROR;
}
- if (first < 0) {
- first = 0;
+ if (first == TCL_INDEX_NONE) {
+ first = TCL_INDEX_START;
}
- if (last >= length) {
- last = length;
+ if (last + 1 >= end + 1) {
+ last = end;
}
- if (last >= first) {
+ if (last + 1 >= first + 1) {
Tcl_SetObjResult(interp, Tcl_GetRange(objv[1], first, last));
}
return TCL_OK;
@@ -2413,15 +2420,14 @@ StringRplcCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- int first, last, length, end;
+ size_t first, last, end;
if (objc < 4 || objc > 5) {
Tcl_WrongNumArgs(interp, 1, objv, "string first last ?string?");
return TCL_ERROR;
}
- length = Tcl_GetCharLength(objv[1]);
- end = length - 1;
+ end = Tcl_GetCharLength(objv[1]) - 1;
if (TclGetIntForIndexM(interp, objv[2], end, &first) != TCL_OK ||
TclGetIntForIndexM(interp, objv[3], end, &last) != TCL_OK) {
@@ -2434,10 +2440,9 @@ StringRplcCmd(
* result is the original string.
*/
- if ((last < 0) || /* Range ends before start of string */
- (first > end) || /* Range begins after end of string */
- (last < first)) { /* Range begins after it starts */
-
+ if ((last == TCL_INDEX_NONE) || /* Range ends before start of string */
+ (first + 1 > end + 1) || /* Range begins after end of string */
+ (last + 1 < first + 1)) { /* Range begins after it starts */
/*
* BUT!!! when (end < 0) -- an empty original string -- we can
* have (first <= end < 0 <= last) and an empty string is permitted
@@ -2448,10 +2453,10 @@ StringRplcCmd(
} else {
Tcl_Obj *resultPtr;
- if (first < 0) {
- first = 0;
+ if (first == TCL_INDEX_NONE) {
+ first = TCL_INDEX_START;
}
- if (last > end) {
+ if (last + 1 > end + 1) {
last = end;
}
@@ -2526,7 +2531,7 @@ StringStartCmd(
{
Tcl_UniChar ch = 0;
const char *p, *string;
- int cur, index, length, numChars;
+ size_t numChars, length, cur, index;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 1, objv, "string index");
@@ -2534,18 +2539,18 @@ StringStartCmd(
}
string = TclGetStringFromObj(objv[1], &length);
- numChars = Tcl_NumUtfChars(string, length);
- if (TclGetIntForIndexM(interp, objv[2], numChars-1, &index) != TCL_OK) {
+ numChars = Tcl_NumUtfChars(string, length) - 1;
+ if (TclGetIntForIndexM(interp, objv[2], numChars, &index) != TCL_OK) {
return TCL_ERROR;
}
- string = TclGetStringFromObj(objv[1], &length);
- if (index >= numChars) {
- index = numChars - 1;
+ string = TclGetString(objv[1]);
+ if (index + 1 > numChars + 1) {
+ index = numChars;
}
cur = 0;
- if (index > 0) {
+ if (index + 1 > 1) {
p = Tcl_UtfAtIndex(string, index);
- for (cur = index; cur >= 0; cur--) {
+ for (cur = index; cur != TCL_INDEX_NONE; cur--) {
TclUtfToUniChar(p, &ch);
if (!Tcl_UniCharIsWordChar(ch)) {
break;
@@ -2556,7 +2561,7 @@ StringStartCmd(
cur += 1;
}
}
- Tcl_SetObjResult(interp, Tcl_NewWideIntObj(cur));
+ Tcl_SetObjResult(interp, TclNewWideIntObjFromSize(cur));
return TCL_OK;
}
@@ -2587,7 +2592,7 @@ StringEndCmd(
{
Tcl_UniChar ch = 0;
const char *p, *end, *string;
- int cur, index, length, numChars;
+ size_t length, numChars, cur, index;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 1, objv, "string index");
@@ -2595,15 +2600,15 @@ StringEndCmd(
}
string = TclGetStringFromObj(objv[1], &length);
- numChars = Tcl_NumUtfChars(string, length);
- if (TclGetIntForIndexM(interp, objv[2], numChars-1, &index) != TCL_OK) {
+ numChars = Tcl_NumUtfChars(string, length) - 1;
+ if (TclGetIntForIndexM(interp, objv[2], numChars, &index) != TCL_OK) {
return TCL_ERROR;
}
string = TclGetStringFromObj(objv[1], &length);
- if (index < 0) {
- index = 0;
+ if (index == TCL_INDEX_NONE) {
+ index = TCL_INDEX_START;
}
- if (index < numChars) {
+ if (index + 1 <= numChars + 1) {
p = Tcl_UtfAtIndex(string, index);
end = string+length;
for (cur = index; p < end; cur++) {
@@ -2616,9 +2621,9 @@ StringEndCmd(
cur++;
}
} else {
- cur = numChars;
+ cur = numChars + 1;
}
- Tcl_SetObjResult(interp, Tcl_NewWideIntObj(cur));
+ Tcl_SetObjResult(interp, TclNewWideIntObjFromSize(cur));
return TCL_OK;
}
@@ -2654,7 +2659,8 @@ StringEqualCmd(
*/
const char *string2;
- int length, i, match, nocase = 0, reqlength = -1;
+ int i, match, nocase = 0, reqlength = -1;
+ size_t length;
if (objc < 3 || objc > 6) {
str_cmp_args:
@@ -2749,7 +2755,8 @@ TclStringCmpOpts(
int *nocase,
int *reqlength)
{
- int i, length;
+ int i;
+ size_t length;
const char *string;
*reqlength = -1;
@@ -2848,6 +2855,7 @@ StringCatCmd(
*
*----------------------------------------------------------------------
*/
+
static int
StringBytesCmd(
ClientData dummy, /* Not used. */
@@ -2855,7 +2863,7 @@ StringBytesCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- int length;
+ size_t length;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "string");
@@ -2926,7 +2934,7 @@ StringLowerCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- int length1, length2;
+ size_t length1, length2;
const char *string1;
char *string2;
@@ -2944,7 +2952,7 @@ StringLowerCmd(
Tcl_SetObjLength(resultPtr, length1);
Tcl_SetObjResult(interp, resultPtr);
} else {
- int first, last;
+ size_t first, last;
const char *start, *end;
Tcl_Obj *resultPtr;
@@ -2952,7 +2960,7 @@ StringLowerCmd(
if (TclGetIntForIndexM(interp,objv[2],length1, &first) != TCL_OK) {
return TCL_ERROR;
}
- if (first < 0) {
+ if (first == TCL_INDEX_NONE) {
first = 0;
}
last = first;
@@ -2962,10 +2970,10 @@ StringLowerCmd(
return TCL_ERROR;
}
- if (last >= length1) {
+ if (last + 1 >= length1 + 1) {
last = length1;
}
- if (last < first) {
+ if (last + 1 < first + 1) {
Tcl_SetObjResult(interp, objv[1]);
return TCL_OK;
}
@@ -3011,7 +3019,7 @@ StringUpperCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- int length1, length2;
+ size_t length1, length2;
const char *string1;
char *string2;
@@ -3029,7 +3037,7 @@ StringUpperCmd(
Tcl_SetObjLength(resultPtr, length1);
Tcl_SetObjResult(interp, resultPtr);
} else {
- int first, last;
+ size_t first, last;
const char *start, *end;
Tcl_Obj *resultPtr;
@@ -3037,8 +3045,8 @@ StringUpperCmd(
if (TclGetIntForIndexM(interp,objv[2],length1, &first) != TCL_OK) {
return TCL_ERROR;
}
- if (first < 0) {
- first = 0;
+ if (first == TCL_INDEX_NONE) {
+ first = TCL_INDEX_START;
}
last = first;
@@ -3047,10 +3055,10 @@ StringUpperCmd(
return TCL_ERROR;
}
- if (last >= length1) {
+ if (last + 1 >= length1 + 1) {
last = length1;
}
- if (last < first) {
+ if (last + 1 < first + 1) {
Tcl_SetObjResult(interp, objv[1]);
return TCL_OK;
}
@@ -3096,7 +3104,7 @@ StringTitleCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- int length1, length2;
+ size_t length1, length2;
const char *string1;
char *string2;
@@ -3114,7 +3122,7 @@ StringTitleCmd(
Tcl_SetObjLength(resultPtr, length1);
Tcl_SetObjResult(interp, resultPtr);
} else {
- int first, last;
+ size_t first, last;
const char *start, *end;
Tcl_Obj *resultPtr;
@@ -3122,8 +3130,8 @@ StringTitleCmd(
if (TclGetIntForIndexM(interp,objv[2],length1, &first) != TCL_OK) {
return TCL_ERROR;
}
- if (first < 0) {
- first = 0;
+ if (first == TCL_INDEX_NONE) {
+ first = TCL_INDEX_START;
}
last = first;
@@ -3132,10 +3140,10 @@ StringTitleCmd(
return TCL_ERROR;
}
- if (last >= length1) {
+ if (last + 1 >= length1 + 1) {
last = length1;
}
- if (last < first) {
+ if (last + 1 < first + 1) {
Tcl_SetObjResult(interp, objv[1]);
return TCL_OK;
}
@@ -3182,7 +3190,7 @@ StringTrimCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
const char *string1, *string2;
- int triml, trimr, length1, length2;
+ size_t triml, trimr, length1, length2;
if (objc == 3) {
string2 = TclGetStringFromObj(objv[2], &length2);
@@ -3229,7 +3237,8 @@ StringTrimLCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
const char *string1, *string2;
- int trim, length1, length2;
+ int trim;
+ size_t length1, length2;
if (objc == 3) {
string2 = TclGetStringFromObj(objv[2], &length2);
@@ -3275,7 +3284,8 @@ StringTrimRCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
const char *string1, *string2;
- int trim, length1, length2;
+ int trim;
+ size_t length1, length2;
if (objc == 3) {
string2 = TclGetStringFromObj(objv[2], &length2);
@@ -3474,8 +3484,9 @@ TclNRSwitchObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- int i,j, index, mode, foundmode, splitObjs, numMatchesSaved;
- int noCase, patternLength;
+ int i, index, mode, foundmode, splitObjs, numMatchesSaved;
+ int noCase;
+ size_t patternLength, j;
const char *pattern;
Tcl_Obj *stringObj, *indexVarObj, *matchVarObj;
Tcl_Obj *const *savedObjv = objv;
@@ -3786,9 +3797,9 @@ TclNRSwitchObjCmd(
if (indexVarObj != NULL) {
Tcl_Obj *rangeObjAry[2];
- if (info.matches[j].end > 0) {
- rangeObjAry[0] = Tcl_NewWideIntObj(info.matches[j].start);
- rangeObjAry[1] = Tcl_NewWideIntObj(info.matches[j].end-1);
+ if (info.matches[j].end + 1 > 1) {
+ rangeObjAry[0] = TclNewWideIntObjFromSize(info.matches[j].start);
+ rangeObjAry[1] = TclNewWideIntObjFromSize(info.matches[j].end-1);
} else {
rangeObjAry[0] = rangeObjAry[1] = Tcl_NewWideIntObj(-1);
}
@@ -3882,7 +3893,7 @@ TclNRSwitchObjCmd(
if (ctxPtr->type == TCL_LOCATION_SOURCE && ctxPtr->line[bidx] >= 0) {
int bline = ctxPtr->line[bidx];
- ctxPtr->line = ckalloc(objc * sizeof(int));
+ ctxPtr->line = Tcl_Alloc(objc * sizeof(int));
ctxPtr->nline = objc;
TclListLines(blist, bline, objc, ctxPtr->line, objv);
} else {
@@ -3896,7 +3907,7 @@ TclNRSwitchObjCmd(
int k;
- ctxPtr->line = ckalloc(objc * sizeof(int));
+ ctxPtr->line = Tcl_Alloc(objc * sizeof(int));
ctxPtr->nline = objc;
for (k=0; k < objc; k++) {
ctxPtr->line[k] = -1;
@@ -3905,7 +3916,7 @@ TclNRSwitchObjCmd(
}
for (j = i + 1; ; j += 2) {
- if (j >= objc) {
+ if (j >= (size_t)objc) {
/*
* This shouldn't happen since we've checked that the last body is
* not a continuation...
@@ -3939,14 +3950,14 @@ SwitchPostProc(
CmdFrame *ctxPtr = data[1];
int pc = PTR2INT(data[2]);
const char *pattern = data[3];
- int patternLength = strlen(pattern);
+ size_t patternLength = strlen(pattern);
/*
* Clean up TIP 280 context information
*/
if (splitObjs) {
- ckfree(ctxPtr->line);
+ Tcl_Free(ctxPtr->line);
if (pc && (ctxPtr->type == TCL_LOCATION_SOURCE)) {
/*
* Death of SrcInfo reference.
@@ -3961,12 +3972,12 @@ SwitchPostProc(
*/
if (result == TCL_ERROR) {
- int limit = 50;
+ unsigned limit = 50;
int overflow = (patternLength > limit);
Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
"\n (\"%.*s%s\" arm line %d)",
- (overflow ? limit : patternLength), pattern,
+ (overflow ? limit : (unsigned)patternLength), pattern,
(overflow ? "..." : ""), Tcl_GetErrorLine(interp)));
}
TclStackFree(interp, ctxPtr);
@@ -4164,14 +4175,14 @@ Tcl_TimeRateObjCmd(
register Tcl_Obj *objPtr;
register int result, i;
Tcl_Obj *calibrate = NULL, *direct = NULL;
- TclWideMUInt count = 0; /* Holds repetition count */
+ Tcl_WideUInt count = 0; /* Holds repetition count */
Tcl_WideInt maxms = WIDE_MIN;
/* Maximal running time (in milliseconds) */
- TclWideMUInt maxcnt = WIDE_MAX;
+ Tcl_WideUInt maxcnt = WIDE_MAX;
/* Maximal count of iterations. */
- TclWideMUInt threshold = 1; /* Current threshold for check time (faster
+ Tcl_WideUInt threshold = 1; /* Current threshold for check time (faster
* repeat count without time check) */
- TclWideMUInt maxIterTm = 1; /* Max time of some iteration as max
+ Tcl_WideUInt maxIterTm = 1; /* Max time of some iteration as max
* threshold, additionally avoiding divide to
* zero (i.e., never < 1) */
unsigned short factor = 50; /* Factor (4..50) limiting threshold to avoid
@@ -4542,13 +4553,13 @@ Tcl_TimeRateObjCmd(
{
Tcl_Obj *objarr[8], **objs = objarr;
- TclWideMUInt usec, val;
+ Tcl_WideUInt usec, val;
int digits;
/*
* Absolute execution time in microseconds or in wide clicks.
*/
- usec = (TclWideMUInt)(middle - start);
+ usec = (Tcl_WideUInt)(middle - start);
#ifdef TCL_WIDE_CLICKS
/*
@@ -4577,7 +4588,7 @@ Tcl_TimeRateObjCmd(
* Estimate the time of overhead (microsecs).
*/
- TclWideMUInt curOverhead = overhead * count;
+ Tcl_WideUInt curOverhead = overhead * count;
if (usec > curOverhead) {
usec -= curOverhead;
@@ -4797,7 +4808,7 @@ TclNRTryObjCmd(
if (Tcl_ListObjLength(NULL, objv[i+1], &dummy) != TCL_OK) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"bad prefix '%s': must be a list",
- Tcl_GetString(objv[i+1])));
+ TclGetString(objv[i+1])));
Tcl_DecrRefCount(handlersObj);
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "TRY", "TRAP",
"EXNFORMAT", NULL);
@@ -5336,7 +5347,7 @@ TclListLines(
Tcl_Obj *const *elems) /* The list elems as Tcl_Obj*, in need of
* derived continuation data */
{
- const char *listStr = Tcl_GetString(listObj);
+ const char *listStr = TclGetString(listObj);
const char *listHead = listStr;
int i, length = strlen(listStr);
const char *element = NULL, *next = NULL;
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c
index c015204..4973d45 100644
--- a/generic/tclCompCmds.c
+++ b/generic/tclCompCmds.c
@@ -403,9 +403,9 @@ TclCompileArraySetCmd(
keyVar = AnonymousLocal(envPtr);
valVar = AnonymousLocal(envPtr);
- infoPtr = ckalloc(sizeof(ForeachInfo));
+ infoPtr = Tcl_Alloc(sizeof(ForeachInfo));
infoPtr->numLists = 1;
- infoPtr->varLists[0] = ckalloc(sizeof(ForeachVarList) + sizeof(int));
+ infoPtr->varLists[0] = Tcl_Alloc(sizeof(ForeachVarList) + sizeof(int));
infoPtr->varLists[0]->numVars = 2;
infoPtr->varLists[0]->varIndexes[0] = keyVar;
infoPtr->varLists[0]->varIndexes[1] = valVar;
@@ -701,8 +701,8 @@ TclCompileCatchCmd(
/* Stack at this point on both branches: result returnCode */
if (TclFixupForwardJumpToHere(envPtr, &jumpFixup, 127)) {
- Tcl_Panic("TclCompileCatchCmd: bad jump distance %d",
- (int)(CurrentOffset(envPtr) - jumpFixup.codeOffset));
+ Tcl_Panic("TclCompileCatchCmd: bad jump distance %" TCL_Z_MODIFIER "d",
+ (CurrentOffset(envPtr) - jumpFixup.codeOffset));
}
/*
@@ -908,12 +908,13 @@ TclCompileConcatCmd(
Tcl_Obj **objs;
const char *bytes;
int len;
+ size_t slen;
Tcl_ListObjGetElements(NULL, listObj, &len, &objs);
objPtr = Tcl_ConcatObj(len, objs);
Tcl_DecrRefCount(listObj);
- bytes = TclGetStringFromObj(objPtr, &len);
- PushLiteral(envPtr, bytes, len);
+ bytes = TclGetStringFromObj(objPtr, &slen);
+ PushLiteral(envPtr, bytes, slen);
Tcl_DecrRefCount(objPtr);
return TCL_OK;
}
@@ -1096,7 +1097,8 @@ TclCompileDictIncrCmd(
if (parsePtr->numWords == 4) {
const char *word;
- int numBytes, code;
+ size_t numBytes;
+ int code;
Tcl_Token *incrTokenPtr;
Tcl_Obj *intObj;
@@ -1312,7 +1314,8 @@ TclCompileDictCreateCmd(
Tcl_Token *tokenPtr;
Tcl_Obj *keyObj, *valueObj, *dictObj;
const char *bytes;
- int i, len;
+ int i;
+ size_t len;
if ((parsePtr->numWords & 1) == 0) {
return TCL_ERROR;
@@ -1595,7 +1598,7 @@ CompileDictEachCmd(
}
Tcl_DStringFree(&buffer);
if (numVars != 2) {
- ckfree(argv);
+ Tcl_Free((void *)argv);
return TclCompileBasic3ArgCmd(interp, parsePtr, cmdPtr, envPtr);
}
@@ -1603,7 +1606,7 @@ CompileDictEachCmd(
keyVarIndex = LocalScalar(argv[0], nameChars, envPtr);
nameChars = strlen(argv[1]);
valueVarIndex = LocalScalar(argv[1], nameChars, envPtr);
- ckfree(argv);
+ Tcl_Free((void *)argv);
if ((keyVarIndex < 0) || (valueVarIndex < 0)) {
return TclCompileBasic3ArgCmd(interp, parsePtr, cmdPtr, envPtr);
@@ -1811,7 +1814,7 @@ TclCompileDictUpdateCmd(
* that are to be used.
*/
- duiPtr = ckalloc(sizeof(DictUpdateInfo) + sizeof(int) * (numVars - 1));
+ duiPtr = Tcl_Alloc(sizeof(DictUpdateInfo) + sizeof(int) * (numVars - 1));
duiPtr->length = numVars;
keyTokenPtrs = TclStackAlloc(interp, sizeof(Tcl_Token *) * numVars);
tokenPtr = TokenAfter(dictVarTokenPtr);
@@ -1894,8 +1897,8 @@ TclCompileDictUpdateCmd(
TclEmitInvoke(envPtr,INST_RETURN_STK);
if (TclFixupForwardJumpToHere(envPtr, &jumpFixup, 127)) {
- Tcl_Panic("TclCompileDictCmd(update): bad jump distance %d",
- (int) (CurrentOffset(envPtr) - jumpFixup.codeOffset));
+ Tcl_Panic("TclCompileDictCmd(update): bad jump distance %" TCL_Z_MODIFIER "d",
+ CurrentOffset(envPtr) - jumpFixup.codeOffset);
}
TclStackFree(interp, keyTokenPtrs);
return TCL_OK;
@@ -1905,7 +1908,7 @@ TclCompileDictUpdateCmd(
*/
failedUpdateInfoAssembly:
- ckfree(duiPtr);
+ Tcl_Free(duiPtr);
TclStackFree(interp, keyTokenPtrs);
issueFallback:
return TclCompileBasicMin2ArgCmd(interp, parsePtr, cmdPtr, envPtr);
@@ -2256,8 +2259,8 @@ TclCompileDictWithCmd(
*/
if (TclFixupForwardJumpToHere(envPtr, &jumpFixup, 127)) {
- Tcl_Panic("TclCompileDictCmd(update): bad jump distance %d",
- (int) (CurrentOffset(envPtr) - jumpFixup.codeOffset));
+ Tcl_Panic("TclCompileDictCmd(update): bad jump distance %" TCL_Z_MODIFIER "d",
+ CurrentOffset(envPtr) - jumpFixup.codeOffset);
}
return TCL_OK;
}
@@ -2294,7 +2297,7 @@ DupDictUpdateInfo(
dui1Ptr = clientData;
len = sizeof(DictUpdateInfo) + sizeof(int) * (dui1Ptr->length - 1);
- dui2Ptr = ckalloc(len);
+ dui2Ptr = Tcl_Alloc(len);
memcpy(dui2Ptr, dui1Ptr, len);
return dui2Ptr;
}
@@ -2303,7 +2306,7 @@ static void
FreeDictUpdateInfo(
ClientData clientData)
{
- ckfree(clientData);
+ Tcl_Free(clientData);
}
static void
@@ -2314,7 +2317,7 @@ PrintDictUpdateInfo(
unsigned int pcOffset)
{
DictUpdateInfo *duiPtr = clientData;
- int i;
+ size_t i;
for (i=0 ; i<duiPtr->length ; i++) {
if (i) {
@@ -2332,7 +2335,7 @@ DisassembleDictUpdateInfo(
unsigned int pcOffset)
{
DictUpdateInfo *duiPtr = clientData;
- int i;
+ size_t i;
Tcl_Obj *variables = Tcl_NewObj();
for (i=0 ; i<duiPtr->length ; i++) {
@@ -2747,7 +2750,7 @@ CompileEachloopCmd(
*/
numLists = (numWords - 2)/2;
- infoPtr = ckalloc(sizeof(ForeachInfo)
+ infoPtr = Tcl_Alloc(sizeof(ForeachInfo)
+ (numLists - 1) * sizeof(ForeachVarList *));
infoPtr->numLists = 0; /* Count this up as we go */
@@ -2781,7 +2784,7 @@ CompileEachloopCmd(
goto done;
}
- varListPtr = ckalloc(sizeof(ForeachVarList)
+ varListPtr = Tcl_Alloc(sizeof(ForeachVarList)
+ (numVars - 1) * sizeof(int));
varListPtr->numVars = numVars;
infoPtr->varLists[i/2] = varListPtr;
@@ -2790,11 +2793,13 @@ CompileEachloopCmd(
for (j = 0; j < numVars; j++) {
Tcl_Obj *varNameObj;
const char *bytes;
- int numBytes, varIndex;
+ int varIndex;
+ size_t length;
+
Tcl_ListObjIndex(NULL, varListObj, j, &varNameObj);
- bytes = TclGetStringFromObj(varNameObj, &numBytes);
- varIndex = LocalScalar(bytes, numBytes, envPtr);
+ bytes = TclGetStringFromObj(varNameObj, &length);
+ varIndex = LocalScalar(bytes, length, envPtr);
if (varIndex < 0) {
code = TCL_ERROR;
goto done;
@@ -2917,7 +2922,7 @@ DupForeachInfo(
register ForeachVarList *srcListPtr, *dupListPtr;
int numVars, i, j, numLists = srcPtr->numLists;
- dupPtr = ckalloc(sizeof(ForeachInfo)
+ dupPtr = Tcl_Alloc(sizeof(ForeachInfo)
+ numLists * sizeof(ForeachVarList *));
dupPtr->numLists = numLists;
dupPtr->firstValueTemp = srcPtr->firstValueTemp;
@@ -2926,7 +2931,7 @@ DupForeachInfo(
for (i = 0; i < numLists; i++) {
srcListPtr = srcPtr->varLists[i];
numVars = srcListPtr->numVars;
- dupListPtr = ckalloc(sizeof(ForeachVarList)
+ dupListPtr = Tcl_Alloc(sizeof(ForeachVarList)
+ numVars * sizeof(int));
dupListPtr->numVars = numVars;
for (j = 0; j < numVars; j++) {
@@ -2968,9 +2973,9 @@ FreeForeachInfo(
for (i = 0; i < numLists; i++) {
listPtr = infoPtr->varLists[i];
- ckfree(listPtr);
+ Tcl_Free(listPtr);
}
- ckfree(infoPtr);
+ Tcl_Free(infoPtr);
}
/*
@@ -3175,7 +3180,8 @@ TclCompileFormatCmd(
Tcl_Token *tokenPtr = parsePtr->tokenPtr;
Tcl_Obj **objv, *formatObj, *tmpObj;
const char *bytes, *start;
- int i, j, len;
+ int i, j;
+ size_t len;
/*
* Don't handle any guaranteed-error cases.
@@ -3198,7 +3204,7 @@ TclCompileFormatCmd(
return TCL_ERROR;
}
- objv = ckalloc((parsePtr->numWords-2) * sizeof(Tcl_Obj *));
+ objv = Tcl_Alloc((parsePtr->numWords-2) * sizeof(Tcl_Obj *));
for (i=0 ; i+2 < parsePtr->numWords ; i++) {
tokenPtr = TokenAfter(tokenPtr);
objv[i] = Tcl_NewObj();
@@ -3213,12 +3219,12 @@ TclCompileFormatCmd(
* the format is broken). Do the format now.
*/
- tmpObj = Tcl_Format(interp, Tcl_GetString(formatObj),
+ tmpObj = Tcl_Format(interp, TclGetString(formatObj),
parsePtr->numWords-2, objv);
for (; --i>=0 ;) {
Tcl_DecrRefCount(objv[i]);
}
- ckfree(objv);
+ Tcl_Free(objv);
Tcl_DecrRefCount(formatObj);
if (tmpObj == NULL) {
TclCompileSyntaxError(interp, envPtr);
@@ -3248,7 +3254,7 @@ TclCompileFormatCmd(
for (; i>=0 ; i--) {
Tcl_DecrRefCount(objv[i]);
}
- ckfree(objv);
+ Tcl_Free(objv);
tokenPtr = TokenAfter(parsePtr->tokenPtr);
tokenPtr = TokenAfter(tokenPtr);
i = 0;
@@ -3257,7 +3263,7 @@ TclCompileFormatCmd(
* Now scan through and check for non-%s and non-%% substitutions.
*/
- for (bytes = Tcl_GetString(formatObj) ; *bytes ; bytes++) {
+ for (bytes = TclGetString(formatObj) ; *bytes ; bytes++) {
if (*bytes == '%') {
bytes++;
if (*bytes == 's') {
@@ -3290,7 +3296,7 @@ TclCompileFormatCmd(
i = 0; /* The count of things to concat. */
j = 2; /* The index into the argument tokens, for
* TIP#280 handling. */
- start = Tcl_GetString(formatObj);
+ start = TclGetString(formatObj);
/* The start of the currently-scanned literal
* in the format string. */
tmpObj = Tcl_NewObj(); /* The buffer used to accumulate the literal
@@ -3390,7 +3396,7 @@ TclLocalScalarFromToken(
int
TclLocalScalar(
const char *bytes,
- int numBytes,
+ size_t numBytes,
CompileEnv *envPtr)
{
Tcl_Token token[2] = {{TCL_TOKEN_SIMPLE_WORD, NULL, 0, 1},
@@ -3441,9 +3447,10 @@ TclPushVarName(
{
register const char *p;
const char *last, *name, *elName;
- register int n;
+ register size_t n;
Tcl_Token *elemTokenPtr = NULL;
- int nameLen, elNameLen, simpleVarName, localIndex;
+ size_t nameLen, elNameLen;
+ int simpleVarName, localIndex;
int elemTokenCount = 0, allocedTokens = 0, removedParen = 0;
/*
@@ -3519,7 +3526,7 @@ TclPushVarName(
}
}
if (simpleVarName) {
- int remainingLen;
+ size_t remainingLen;
/*
* Check the last token: if it is just ')', do not count it.
diff --git a/generic/tclCompCmdsGR.c b/generic/tclCompCmdsGR.c
index 3c8a156..c3684e0 100644
--- a/generic/tclCompCmdsGR.c
+++ b/generic/tclCompCmdsGR.c
@@ -49,8 +49,8 @@ static int IndexTailVarIfKnown(Tcl_Interp *interp,
int
TclGetIndexFromToken(
Tcl_Token *tokenPtr,
- int before,
- int after,
+ size_t before,
+ size_t after,
int *indexPtr)
{
Tcl_Obj *tmpObj = Tcl_NewObj();
@@ -181,7 +181,8 @@ TclCompileIfCmd(
* determined. */
Tcl_Token *tokenPtr, *testTokenPtr;
int jumpIndex = 0; /* Avoid compiler warning. */
- int jumpFalseDist, numWords, wordIdx, numBytes, j, code;
+ size_t numBytes;
+ int jumpFalseDist, numWords, wordIdx, j, code;
const char *word;
int realCond = 1; /* Set to 0 for static conditions:
* "if 0 {..}" */
@@ -499,7 +500,7 @@ TclCompileIncrCmd(
incrTokenPtr = TokenAfter(varTokenPtr);
if (incrTokenPtr->type == TCL_TOKEN_SIMPLE_WORD) {
const char *word = incrTokenPtr[1].start;
- int numBytes = incrTokenPtr[1].size;
+ size_t numBytes = incrTokenPtr[1].size;
int code;
Tcl_Obj *intObj = Tcl_NewStringObj(word, numBytes);
@@ -2080,7 +2081,8 @@ TclCompileRegexpCmd(
{
Tcl_Token *varTokenPtr; /* Pointer to the Tcl_Token representing the
* parse of the RE or string. */
- int i, len, nocase, exact, sawLast, simple;
+ size_t len;
+ int i, nocase, exact, sawLast, simple;
const char *str;
DefineLineInformation; /* TIP #280 */
@@ -2121,7 +2123,7 @@ TclCompileRegexpCmd(
sawLast++;
i++;
break;
- } else if ((len > 1) && (strncmp(str, "-nocase", len) == 0)) {
+ } else if ((len > 1) && (strncmp(str,"-nocase", len) == 0)) {
nocase = 1;
} else {
/*
@@ -2268,7 +2270,8 @@ TclCompileRegsubCmd(
Tcl_Obj *patternObj = NULL, *replacementObj = NULL;
Tcl_DString pattern;
const char *bytes;
- int len, exact, quantified, result = TCL_ERROR;
+ int exact, quantified, result = TCL_ERROR;
+ size_t len;
if (parsePtr->numWords < 5 || parsePtr->numWords > 6) {
return TCL_ERROR;
@@ -2346,7 +2349,7 @@ TclCompileRegsubCmd(
*/
len = Tcl_DStringLength(&pattern) - 2;
- if (len > 0) {
+ if (len + 2 > 2) {
goto isSimpleGlob;
}
@@ -2633,7 +2636,7 @@ TclCompileSyntaxError(
CompileEnv *envPtr)
{
Tcl_Obj *msg = Tcl_GetObjResult(interp);
- int numBytes;
+ size_t numBytes;
const char *bytes = TclGetStringFromObj(msg, &numBytes);
TclErrorStackResetIf(interp, bytes, numBytes);
@@ -2861,7 +2864,8 @@ IndexTailVarIfKnown(
{
Tcl_Obj *tailPtr;
const char *tailName, *p;
- int len, n = varTokenPtr->numComponents;
+ int n = varTokenPtr->numComponents;
+ size_t len;
Tcl_Token *lastTokenPtr;
int full, localIndex;
diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c
index f0bf5ca..46cf425 100644
--- a/generic/tclCompCmdsSZ.c
+++ b/generic/tclCompCmdsSZ.c
@@ -259,7 +259,7 @@ TclCompileStringCatCmd(
} else {
Tcl_DecrRefCount(obj);
if (folded) {
- int len;
+ size_t len;
const char *bytes = TclGetStringFromObj(folded, &len);
PushLiteral(envPtr, bytes, len);
@@ -277,7 +277,7 @@ TclCompileStringCatCmd(
wordTokenPtr = TokenAfter(wordTokenPtr);
}
if (folded) {
- int len;
+ size_t len;
const char *bytes = TclGetStringFromObj(folded, &len);
PushLiteral(envPtr, bytes, len);
@@ -803,7 +803,8 @@ TclCompileStringMatchCmd(
{
DefineLineInformation; /* TIP #280 */
Tcl_Token *tokenPtr;
- int i, length, exactMatch = 0, nocase = 0;
+ size_t length;
+ int i, exactMatch = 0, nocase = 0;
const char *str;
if (parsePtr->numWords < 3 || parsePtr->numWords > 4) {
@@ -900,9 +901,9 @@ TclCompileStringLenCmd(
*/
char buf[TCL_INTEGER_SPACE];
- int len = Tcl_GetCharLength(objPtr);
+ size_t len = Tcl_GetCharLength(objPtr);
- len = sprintf(buf, "%d", len);
+ len = sprintf(buf, "%" TCL_Z_MODIFIER "d", len);
PushLiteral(envPtr, buf, len);
} else {
SetLineInformation(1);
@@ -927,6 +928,7 @@ TclCompileStringMapCmd(
Tcl_Obj *mapObj, **objv;
const char *bytes;
int len;
+ size_t slen;
/*
* We only handle the case:
@@ -962,13 +964,13 @@ TclCompileStringMapCmd(
* correct semantics for mapping.
*/
- bytes = TclGetStringFromObj(objv[0], &len);
- if (len == 0) {
+ bytes = TclGetStringFromObj(objv[0], &slen);
+ if (slen == 0) {
CompileWord(envPtr, stringTokenPtr, interp, 2);
} else {
- PushLiteral(envPtr, bytes, len);
- bytes = TclGetStringFromObj(objv[1], &len);
- PushLiteral(envPtr, bytes, len);
+ PushLiteral(envPtr, bytes, slen);
+ bytes = TclGetStringFromObj(objv[1], &slen);
+ PushLiteral(envPtr, bytes, slen);
CompileWord(envPtr, stringTokenPtr, interp, 2);
OP(STR_MAP);
}
@@ -1527,7 +1529,7 @@ void
TclSubstCompile(
Tcl_Interp *interp,
const char *bytes,
- int numBytes,
+ size_t numBytes,
int flags,
int line,
CompileEnv *envPtr)
@@ -1558,7 +1560,8 @@ TclSubstCompile(
for (endTokenPtr = tokenPtr + parse.numTokens;
tokenPtr < endTokenPtr; tokenPtr = TokenAfter(tokenPtr)) {
- int length, literal, catchRange, breakJump;
+ size_t length;
+ int literal, catchRange, breakJump;
char buf[4] = "";
JumpFixup startFixup, okFixup, returnFixup, breakFixup;
JumpFixup continueFixup, otherFixup, endFixup;
@@ -1589,7 +1592,8 @@ TclSubstCompile(
*/
if (tokenPtr->numComponents > 1) {
- int i, foundCommand = 0;
+ size_t i;
+ int foundCommand = 0;
for (i=2 ; i<=tokenPtr->numComponents ; i++) {
if (tokenPtr[i].type == TCL_TOKEN_COMMAND) {
@@ -1628,8 +1632,8 @@ TclSubstCompile(
/* Start */
if (TclFixupForwardJumpToHere(envPtr, &startFixup, 127)) {
- Tcl_Panic("TclCompileSubstCmd: bad start jump distance %d",
- (int) (CurrentOffset(envPtr) - startFixup.codeOffset));
+ Tcl_Panic("TclCompileSubstCmd: bad start jump distance %" TCL_Z_MODIFIER "d",
+ CurrentOffset(envPtr) - startFixup.codeOffset);
}
}
@@ -1687,8 +1691,8 @@ TclSubstCompile(
TclAdjustStackDepth(1, envPtr);
/* BREAK destination */
if (TclFixupForwardJumpToHere(envPtr, &breakFixup, 127)) {
- Tcl_Panic("TclCompileSubstCmd: bad break jump distance %d",
- (int) (CurrentOffset(envPtr) - breakFixup.codeOffset));
+ Tcl_Panic("TclCompileSubstCmd: bad break jump distance %" TCL_Z_MODIFIER "d",
+ CurrentOffset(envPtr) - breakFixup.codeOffset);
}
OP( POP);
OP( POP);
@@ -1703,8 +1707,8 @@ TclSubstCompile(
TclAdjustStackDepth(2, envPtr);
/* CONTINUE destination */
if (TclFixupForwardJumpToHere(envPtr, &continueFixup, 127)) {
- Tcl_Panic("TclCompileSubstCmd: bad continue jump distance %d",
- (int) (CurrentOffset(envPtr) - continueFixup.codeOffset));
+ Tcl_Panic("TclCompileSubstCmd: bad continue jump distance %" TCL_Z_MODIFIER "d",
+ CurrentOffset(envPtr) - continueFixup.codeOffset);
}
OP( POP);
OP( POP);
@@ -1713,12 +1717,12 @@ TclSubstCompile(
TclAdjustStackDepth(2, envPtr);
/* RETURN + other destination */
if (TclFixupForwardJumpToHere(envPtr, &returnFixup, 127)) {
- Tcl_Panic("TclCompileSubstCmd: bad return jump distance %d",
- (int) (CurrentOffset(envPtr) - returnFixup.codeOffset));
+ Tcl_Panic("TclCompileSubstCmd: bad return jump distance %" TCL_Z_MODIFIER "d",
+ CurrentOffset(envPtr) - returnFixup.codeOffset);
}
if (TclFixupForwardJumpToHere(envPtr, &otherFixup, 127)) {
- Tcl_Panic("TclCompileSubstCmd: bad other jump distance %d",
- (int) (CurrentOffset(envPtr) - otherFixup.codeOffset));
+ Tcl_Panic("TclCompileSubstCmd: bad other jump distance %" TCL_Z_MODIFIER "d",
+ CurrentOffset(envPtr) - otherFixup.codeOffset);
}
/*
@@ -1730,8 +1734,8 @@ TclSubstCompile(
/* OK destination */
if (TclFixupForwardJumpToHere(envPtr, &okFixup, 127)) {
- Tcl_Panic("TclCompileSubstCmd: bad ok jump distance %d",
- (int) (CurrentOffset(envPtr) - okFixup.codeOffset));
+ Tcl_Panic("TclCompileSubstCmd: bad ok jump distance %" TCL_Z_MODIFIER "d",
+ CurrentOffset(envPtr) - okFixup.codeOffset);
}
if (count > 1) {
OP1(STR_CONCAT1, count);
@@ -1740,8 +1744,8 @@ TclSubstCompile(
/* CONTINUE jump to here */
if (TclFixupForwardJumpToHere(envPtr, &endFixup, 127)) {
- Tcl_Panic("TclCompileSubstCmd: bad end jump distance %d",
- (int) (CurrentOffset(envPtr) - endFixup.codeOffset));
+ Tcl_Panic("TclCompileSubstCmd: bad end jump distance %" TCL_Z_MODIFIER "d",
+ CurrentOffset(envPtr) - endFixup.codeOffset);
}
bline = envPtr->line;
}
@@ -1862,7 +1866,7 @@ TclCompileSwitchCmd(
*/
for (; numWords>=3 ; tokenPtr=TokenAfter(tokenPtr),numWords--) {
- register unsigned size = tokenPtr[1].size;
+ register size_t size = tokenPtr[1].size;
register const char *chrs = tokenPtr[1].start;
/*
@@ -1953,7 +1957,7 @@ TclCompileSwitchCmd(
if (numWords == 1) {
const char *bytes;
- int maxLen, numBytes;
+ size_t maxLen, numBytes;
int bline; /* TIP #280: line of the pattern/action list,
* and start of list for when tracking the
* location. This list comes immediately after
@@ -1970,10 +1974,10 @@ TclCompileSwitchCmd(
if (maxLen < 2) {
return TCL_ERROR;
}
- bodyTokenArray = ckalloc(sizeof(Tcl_Token) * maxLen);
- bodyToken = ckalloc(sizeof(Tcl_Token *) * maxLen);
- bodyLines = ckalloc(sizeof(int) * maxLen);
- bodyContLines = ckalloc(sizeof(int*) * maxLen);
+ bodyTokenArray = Tcl_Alloc(sizeof(Tcl_Token) * maxLen);
+ bodyToken = Tcl_Alloc(sizeof(Tcl_Token *) * maxLen);
+ bodyLines = Tcl_Alloc(sizeof(int) * maxLen);
+ bodyContLines = Tcl_Alloc(sizeof(int*) * maxLen);
bline = mapPtr->loc[eclIndex].line[valueIndex+1];
numWords = 0;
@@ -2011,10 +2015,10 @@ TclCompileSwitchCmd(
}
if (numWords % 2) {
abort:
- ckfree(bodyToken);
- ckfree(bodyTokenArray);
- ckfree(bodyLines);
- ckfree(bodyContLines);
+ Tcl_Free(bodyToken);
+ Tcl_Free(bodyTokenArray);
+ Tcl_Free(bodyLines);
+ Tcl_Free(bodyContLines);
return TCL_ERROR;
}
} else if (numWords % 2 || numWords == 0) {
@@ -2032,9 +2036,9 @@ TclCompileSwitchCmd(
* Multi-word definition of patterns & actions.
*/
- bodyToken = ckalloc(sizeof(Tcl_Token *) * numWords);
- bodyLines = ckalloc(sizeof(int) * numWords);
- bodyContLines = ckalloc(sizeof(int*) * numWords);
+ bodyToken = Tcl_Alloc(sizeof(Tcl_Token *) * numWords);
+ bodyLines = Tcl_Alloc(sizeof(int) * numWords);
+ bodyContLines = Tcl_Alloc(sizeof(int*) * numWords);
bodyTokenArray = NULL;
for (i=0 ; i<numWords ; i++) {
/*
@@ -2093,11 +2097,11 @@ TclCompileSwitchCmd(
*/
freeTemporaries:
- ckfree(bodyToken);
- ckfree(bodyLines);
- ckfree(bodyContLines);
+ Tcl_Free(bodyToken);
+ Tcl_Free(bodyLines);
+ Tcl_Free(bodyContLines);
if (bodyTokenArray != NULL) {
- ckfree(bodyTokenArray);
+ Tcl_Free(bodyTokenArray);
}
return result;
}
@@ -2398,7 +2402,7 @@ IssueSwitchJumpTable(
* Start by allocating the jump table itself, plus some workspace.
*/
- jtPtr = ckalloc(sizeof(JumptableInfo));
+ jtPtr = Tcl_Alloc(sizeof(JumptableInfo));
Tcl_InitHashTable(&jtPtr->hashTable, TCL_STRING_KEYS);
infoIndex = TclCreateAuxData(jtPtr, &tclJumptableInfoType, envPtr);
finalFixups = TclStackAlloc(interp, sizeof(int) * (numBodyTokens/2));
@@ -2570,7 +2574,7 @@ DupJumptableInfo(
ClientData clientData)
{
JumptableInfo *jtPtr = clientData;
- JumptableInfo *newJtPtr = ckalloc(sizeof(JumptableInfo));
+ JumptableInfo *newJtPtr = Tcl_Alloc(sizeof(JumptableInfo));
Tcl_HashEntry *hPtr, *newHPtr;
Tcl_HashSearch search;
int isNew;
@@ -2592,7 +2596,7 @@ FreeJumptableInfo(
JumptableInfo *jtPtr = clientData;
Tcl_DeleteHashTable(&jtPtr->hashTable);
- ckfree(jtPtr);
+ Tcl_Free(jtPtr);
}
static void
@@ -2933,7 +2937,7 @@ TclCompileTryCmd(
goto failedToCompile;
}
if (objc > 0) {
- int len;
+ size_t len;
const char *varname = TclGetStringFromObj(objv[0], &len);
resultVarIndices[i] = LocalScalar(varname, len, envPtr);
@@ -2945,7 +2949,7 @@ TclCompileTryCmd(
resultVarIndices[i] = -1;
}
if (objc == 2) {
- int len;
+ size_t len;
const char *varname = TclGetStringFromObj(objv[1], &len);
optionVarIndices[i] = LocalScalar(varname, len, envPtr);
@@ -3064,6 +3068,7 @@ IssueTryClausesInstructions(
DefineLineInformation; /* TIP #280 */
int range, resultVar, optionsVar;
int i, j, len, forwardsNeedFixing = 0, trapZero = 0, afterBody = 0;
+ size_t slen;
int *addrsToFix, *forwardsToFix, notCodeJumpSource, notECJumpSource;
int *noError;
char buf[TCL_INTEGER_SPACE];
@@ -3149,8 +3154,8 @@ IssueTryClausesInstructions(
OP4( DICT_GET, 1);
TclAdjustStackDepth(-1, envPtr);
OP44( LIST_RANGE_IMM, 0, len-1);
- p = TclGetStringFromObj(matchClauses[i], &len);
- PushLiteral(envPtr, p, len);
+ p = TclGetStringFromObj(matchClauses[i], &slen);
+ PushLiteral(envPtr, p, slen);
OP( STR_EQ);
JUMP4( JUMP_FALSE, notECJumpSource);
} else {
@@ -3277,6 +3282,7 @@ IssueTryClausesFinallyInstructions(
int trapZero = 0, afterBody = 0, finalOK, finalError, noFinalError;
int *addrsToFix, *forwardsToFix, notCodeJumpSource, notECJumpSource;
char buf[TCL_INTEGER_SPACE];
+ size_t slen;
resultVar = AnonymousLocal(envPtr);
optionsVar = AnonymousLocal(envPtr);
@@ -3360,8 +3366,8 @@ IssueTryClausesFinallyInstructions(
OP4( DICT_GET, 1);
TclAdjustStackDepth(-1, envPtr);
OP44( LIST_RANGE_IMM, 0, len-1);
- p = TclGetStringFromObj(matchClauses[i], &len);
- PushLiteral(envPtr, p, len);
+ p = TclGetStringFromObj(matchClauses[i], &slen);
+ PushLiteral(envPtr, p, slen);
OP( STR_EQ);
JUMP4( JUMP_FALSE, notECJumpSource);
} else {
@@ -3686,7 +3692,7 @@ TclCompileUnsetCmd(
}
if (varCount == 0) {
const char *bytes;
- int len;
+ size_t len;
bytes = TclGetStringFromObj(leadingWord, &len);
if (i == 1 && len == 11 && !strncmp("-nocomplain", bytes, 11)) {
diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c
index a6ac797..4cbabbf 100644
--- a/generic/tclCompExpr.c
+++ b/generic/tclCompExpr.c
@@ -22,7 +22,7 @@
* The tree is composed of OpNodes.
*/
-typedef struct OpNode {
+typedef struct {
int left; /* "Pointer" to the left operand. */
int right; /* "Pointer" to the right operand. */
union {
@@ -509,16 +509,16 @@ static void CompileExprTree(Tcl_Interp *interp, OpNode *nodes,
int index, Tcl_Obj *const **litObjvPtr,
Tcl_Obj *const *funcObjv, Tcl_Token *tokenPtr,
CompileEnv *envPtr, int optimize);
-static void ConvertTreeToTokens(const char *start, int numBytes,
+static void ConvertTreeToTokens(const char *start, size_t numBytes,
OpNode *nodes, Tcl_Token *tokenPtr,
Tcl_Parse *parsePtr);
static int ExecConstantExprTree(Tcl_Interp *interp, OpNode *nodes,
int index, Tcl_Obj * const **litObjvPtr);
static int ParseExpr(Tcl_Interp *interp, const char *start,
- int numBytes, OpNode **opTreePtr,
+ size_t numBytes, OpNode **opTreePtr,
Tcl_Obj *litList, Tcl_Obj *funcList,
Tcl_Parse *parsePtr, int parseOnly);
-static int ParseLexeme(const char *start, int numBytes,
+static size_t ParseLexeme(const char *start, size_t numBytes,
unsigned char *lexemePtr, Tcl_Obj **literalPtr);
/*
@@ -544,7 +544,7 @@ static int ParseLexeme(const char *start, int numBytes,
* Side effects:
* Memory will be allocated. If TCL_OK is returned, the caller must clean
* up the returned data structures. The (OpNode *) value written to
- * opTreePtr should be passed to ckfree() and the parsePtr argument
+ * opTreePtr should be passed to Tcl_Free() and the parsePtr argument
* should be passed to Tcl_FreeParse(). The elements appended to the
* litList and funcList will automatically be freed whenever the refcount
* on those lists indicates they can be freed.
@@ -556,7 +556,7 @@ static int
ParseExpr(
Tcl_Interp *interp, /* Used for error reporting. */
const char *start, /* Start of source string to parse. */
- int numBytes, /* Number of bytes in string. */
+ size_t numBytes, /* Number of bytes in string. */
OpNode **opTreePtr, /* Points to space where a pointer to the
* allocated OpNode tree should go. */
Tcl_Obj *litList, /* List to append literals to. */
@@ -579,7 +579,7 @@ ParseExpr(
* no need for array growth and
* reallocation. */
unsigned int nodesUsed = 0; /* Number of OpNodes filled. */
- int scanned = 0; /* Capture number of byte scanned by parsing
+ size_t scanned = 0; /* Capture number of byte scanned by parsing
* routines. */
int lastParsed; /* Stores info about what the lexeme parsed
* the previous pass through the parsing loop
@@ -623,7 +623,7 @@ ParseExpr(
* error in the expression. */
int insertMark = 0; /* A boolean controlling whether the "mark"
* should be inserted. */
- const int limit = 25; /* Portions of the error message are
+ const unsigned limit = 25; /* Portions of the error message are
* constructed out of substrings of the
* original expression. In order to keep the
* error message readable, we impose this
@@ -631,7 +631,7 @@ ParseExpr(
TclParseInit(interp, start, numBytes, parsePtr);
- nodes = attemptckalloc(nodesAvailable * sizeof(OpNode));
+ nodes = Tcl_AttemptAlloc(nodesAvailable * sizeof(OpNode));
if (nodes == NULL) {
TclNewLiteralStringObj(msg, "not enough memory to parse expression");
errCode = "NOMEM";
@@ -675,7 +675,7 @@ ParseExpr(
do {
if (size <= UINT_MAX/sizeof(OpNode)) {
- newPtr = attemptckrealloc(nodes, size * sizeof(OpNode));
+ newPtr = Tcl_AttemptRealloc(nodes, size * sizeof(OpNode));
}
} while ((newPtr == NULL)
&& ((size -= (size - nodesUsed) / 2) > nodesUsed));
@@ -710,12 +710,12 @@ ParseExpr(
switch (lexeme) {
case INVALID:
msg = Tcl_ObjPrintf("invalid character \"%.*s\"",
- scanned, start);
+ (int)scanned, start);
errCode = "BADCHAR";
goto error;
case INCOMPLETE:
msg = Tcl_ObjPrintf("incomplete operator \"%.*s\"",
- scanned, start);
+ (int)scanned, start);
errCode = "PARTOP";
goto error;
case BAREWORD:
@@ -744,16 +744,16 @@ ParseExpr(
} else {
Tcl_DecrRefCount(literal);
msg = Tcl_ObjPrintf("invalid bareword \"%.*s%s\"",
- (scanned < limit) ? scanned : limit - 3, start,
+ (scanned < limit) ? (int)scanned : (int)limit - 3, start,
(scanned < limit) ? "" : "...");
post = Tcl_ObjPrintf(
"should be \"$%.*s%s\" or \"{%.*s%s}\"",
- (scanned < limit) ? scanned : limit - 3,
+ (scanned < limit) ? (int)scanned : (int)limit - 3,
start, (scanned < limit) ? "" : "...",
- (scanned < limit) ? scanned : limit - 3,
+ (scanned < limit) ? (int)scanned : (int)limit - 3,
start, (scanned < limit) ? "" : "...");
Tcl_AppendPrintfToObj(post, " or \"%.*s%s(...)\" or ...",
- (scanned < limit) ? scanned : limit - 3,
+ (scanned < limit) ? (int)scanned : (int)limit - 3,
start, (scanned < limit) ? "" : "...");
errCode = "BAREWORD";
if (start[0] == '0') {
@@ -1385,7 +1385,7 @@ ParseExpr(
*/
if (nodes != NULL) {
- ckfree(nodes);
+ Tcl_Free(nodes);
}
if (interp == NULL) {
@@ -1414,13 +1414,13 @@ ParseExpr(
Tcl_AppendPrintfToObj(msg, "\nin expression \"%s%.*s%.*s%s%s%.*s%s\"",
((start - limit) < parsePtr->string) ? "" : "...",
((start - limit) < parsePtr->string)
- ? (int) (start - parsePtr->string) : limit - 3,
+ ? (int) (start - parsePtr->string) : (int)limit - 3,
((start - limit) < parsePtr->string)
? parsePtr->string : start - limit + 3,
- (scanned < limit) ? scanned : limit - 3, start,
+ (scanned < limit) ? (int)scanned : (int)limit - 3, start,
(scanned < limit) ? "" : "...", insertMark ? mark : "",
(start + scanned + limit > parsePtr->end)
- ? (int) (parsePtr->end - start) - scanned : limit-3,
+ ? (int) (parsePtr->end - start) - (int)scanned : (int)limit-3,
start + scanned,
(start + scanned + limit > parsePtr->end) ? "" : "...");
@@ -1442,7 +1442,7 @@ ParseExpr(
numBytes = parsePtr->end - parsePtr->string;
Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
"\n (parsing expression \"%.*s%s\")",
- (numBytes < limit) ? numBytes : limit - 3,
+ (numBytes < limit) ? (int)numBytes : (int)limit - 3,
parsePtr->string, (numBytes < limit) ? "" : "..."));
if (errCode) {
Tcl_SetErrorCode(interp, "TCL", "PARSE", "EXPR", errCode,
@@ -1479,7 +1479,7 @@ ParseExpr(
static void
ConvertTreeToTokens(
const char *start,
- int numBytes,
+ size_t numBytes,
OpNode *nodes,
Tcl_Token *tokenPtr,
Tcl_Parse *parsePtr)
@@ -1568,7 +1568,7 @@ ConvertTreeToTokens(
TclGrowParseTokenArray(parsePtr, toCopy);
subExprTokenPtr = parsePtr->tokenPtr + parsePtr->numTokens;
memcpy(subExprTokenPtr, tokenPtr,
- (size_t) toCopy * sizeof(Tcl_Token));
+ toCopy * sizeof(Tcl_Token));
subExprTokenPtr->type = TCL_TOKEN_SUB_EXPR;
parsePtr->numTokens += toCopy;
} else {
@@ -1585,7 +1585,7 @@ ConvertTreeToTokens(
subExprTokenPtr->numComponents++;
subExprTokenPtr++;
memcpy(subExprTokenPtr, tokenPtr,
- (size_t) toCopy * sizeof(Tcl_Token));
+ toCopy * sizeof(Tcl_Token));
parsePtr->numTokens += toCopy + 1;
}
@@ -1827,7 +1827,7 @@ int
Tcl_ParseExpr(
Tcl_Interp *interp, /* Used for error reporting. */
const char *start, /* Start of source string to parse. */
- int numBytes, /* Number of bytes in string. If < 0, the
+ size_t numBytes, /* Number of bytes in string. If -1, the
* string consists of all bytes up to the
* first null character. */
Tcl_Parse *parsePtr) /* Structure to fill with information about
@@ -1841,7 +1841,7 @@ Tcl_ParseExpr(
Tcl_Parse *exprParsePtr = TclStackAlloc(interp, sizeof(Tcl_Parse));
/* Holds the Tcl_Tokens of substitutions. */
- if (numBytes < 0) {
+ if (numBytes == TCL_AUTO_LENGTH) {
numBytes = (start ? strlen(start) : 0);
}
@@ -1861,7 +1861,7 @@ Tcl_ParseExpr(
Tcl_FreeParse(exprParsePtr);
TclStackFree(interp, exprParsePtr);
- ckfree(opTree);
+ Tcl_Free(opTree);
return code;
}
@@ -1882,17 +1882,16 @@ Tcl_ParseExpr(
*----------------------------------------------------------------------
*/
-static int
+static size_t
ParseLexeme(
const char *start, /* Start of lexeme to parse. */
- int numBytes, /* Number of bytes in string. */
+ size_t numBytes, /* Number of bytes in string. */
unsigned char *lexemePtr, /* Write code of parsed lexeme to this
* storage. */
Tcl_Obj **literalPtr) /* Write corresponding literal value to this
storage, if non-NULL. */
{
const char *end;
- int scanned;
Tcl_UniChar ch = 0;
Tcl_Obj *literal = NULL;
unsigned char byte;
@@ -2100,6 +2099,7 @@ ParseLexeme(
*/
if (!TclIsBareword(*start) || *start == '_') {
+ size_t scanned;
if (Tcl_UtfCharComplete(start, numBytes)) {
scanned = TclUtfToUniChar(start, &ch);
} else {
@@ -2149,7 +2149,7 @@ void
TclCompileExpr(
Tcl_Interp *interp, /* Used for error reporting. */
const char *script, /* The source script to compile. */
- int numBytes, /* Number of bytes in script. */
+ size_t numBytes, /* Number of bytes in script. */
CompileEnv *envPtr, /* Holds resulting instructions. */
int optimize) /* 0 for one-off expressions. */
{
@@ -2187,7 +2187,7 @@ TclCompileExpr(
TclStackFree(interp, parsePtr);
Tcl_DecrRefCount(funcList);
Tcl_DecrRefCount(litList);
- ckfree(opTree);
+ Tcl_Free(opTree);
}
/*
@@ -2297,7 +2297,7 @@ CompileExprTree(
case FUNCTION: {
Tcl_DString cmdName;
const char *p;
- int length;
+ size_t length;
Tcl_DStringInit(&cmdName);
TclDStringAppendLiteral(&cmdName, "tcl::mathfunc::");
@@ -2456,7 +2456,7 @@ CompileExprTree(
Tcl_Obj *literal = *litObjv;
if (optimize) {
- int length;
+ size_t length;
const char *bytes = TclGetStringFromObj(literal, &length);
int index = TclRegisterLiteral(envPtr, bytes, length, 0);
Tcl_Obj *objPtr = TclFetchLiteral(envPtr, index);
@@ -2515,9 +2515,9 @@ CompileExprTree(
if (TclHasStringRep(objPtr)) {
Tcl_Obj *tableValue;
- int numBytes;
+ size_t numBytes;
const char *bytes
- = Tcl_GetStringFromObj(objPtr, &numBytes);
+ = TclGetStringFromObj(objPtr, &numBytes);
index = TclRegisterLiteral(envPtr, bytes, numBytes, 0);
tableValue = TclFetchLiteral(envPtr, index);
diff --git a/generic/tclCompile.c b/generic/tclCompile.c
index c10e3ee..345b660 100644
--- a/generic/tclCompile.c
+++ b/generic/tclCompile.c
@@ -129,10 +129,6 @@ InstructionDesc const tclInstructionTable[] = {
{"jumpFalse4", 5, -1, 1, {OPERAND_OFFSET4}},
/* Jump relative to (pc + op4) if stktop expr object is false */
- {"lor", 1, -1, 0, {OPERAND_NONE}},
- /* Logical or: push (stknext || stktop) */
- {"land", 1, -1, 0, {OPERAND_NONE}},
- /* Logical and: push (stknext && stktop) */
{"bitor", 1, -1, 0, {OPERAND_NONE}},
/* Bitwise or: push (stknext | stktop) */
{"bitxor", 1, -1, 0, {OPERAND_NONE}},
@@ -173,10 +169,6 @@ InstructionDesc const tclInstructionTable[] = {
/* Bitwise not: push ~stktop */
{"not", 1, 0, 0, {OPERAND_NONE}},
/* Logical not: push !stktop */
- {"callBuiltinFunc1", 2, 1, 1, {OPERAND_UINT1}},
- /* Call builtin math function with index op1; any args are on stk */
- {"callFunc1", 2, INT_MIN, 1, {OPERAND_UINT1}},
- /* Call non-builtin func objv[0]; <objc,objv>=<op1,top op1> */
{"tryCvtToNumeric", 1, 0, 0, {OPERAND_NONE}},
/* Try converting stktop to first int then double if possible. */
@@ -186,13 +178,6 @@ InstructionDesc const tclInstructionTable[] = {
/* Skip to next iteration of closest enclosing loop; if none, return
* TCL_CONTINUE code. */
- {"foreach_start4", 5, 0, 1, {OPERAND_AUX4}},
- /* Initialize execution of a foreach loop. Operand is aux data index
- * of the ForeachInfo structure for the foreach command. */
- {"foreach_step4", 5, +1, 1, {OPERAND_AUX4}},
- /* "Step" or begin next iteration of foreach loop. Push 0 if to
- * terminate loop, else push 1. */
-
{"beginCatch4", 5, 0, 1, {OPERAND_UINT4}},
/* Record start of catch with the operand's exception index. Push the
* current stack depth onto a special catch stack. */
@@ -340,9 +325,6 @@ InstructionDesc const tclInstructionTable[] = {
{"dictNext", 5, +3, 1, {OPERAND_LVT4}},
/* Get the next iteration from the iterator in op4's local scalar.
* Stack: ... => ... value key doneBool */
- {"dictDone", 5, 0, 1, {OPERAND_LVT4}},
- /* Terminate the iterator in op4's local scalar. Use unsetScalar
- * instead (with 0 for flags). */
{"dictUpdateStart", 9, 0, 2, {OPERAND_LVT4, OPERAND_AUX4}},
/* Create the variables (described in the aux data referred to by the
* second immediate argument) to mirror the state of the dictionary in
@@ -712,7 +694,7 @@ static void StartExpanding(CompileEnv *envPtr);
* commands.
*/
static void EnterCmdWordData(ExtCmdLoc *eclPtr, int srcOffset,
- Tcl_Token *tokenPtr, const char *cmd, int len,
+ Tcl_Token *tokenPtr, const char *cmd,
int numWords, int line, int *clNext, int **lines,
CompileEnv *envPtr);
static void ReleaseCmdWordData(ExtCmdLoc *eclPtr);
@@ -804,8 +786,7 @@ TclSetByteCodeFromAny(
}
#endif
- stringPtr = TclGetString(objPtr);
- length = objPtr->length;
+ stringPtr = TclGetStringFromObj(objPtr, &length);
/*
* TIP #280: Pick up the CmdFrame in which the BC compiler was invoked and
@@ -871,8 +852,8 @@ TclSetByteCodeFromAny(
* instruction generator boundaries.
*/
- if (iPtr->extra.optimizer) {
- (iPtr->extra.optimizer)(&compEnv);
+ if (iPtr->optimizer) {
+ (iPtr->optimizer)(&compEnv);
}
/*
@@ -1153,12 +1134,12 @@ CleanupByteCode(
}
}
- if (codePtr->localCachePtr && (--codePtr->localCachePtr->refCount == 0)) {
+ if (codePtr->localCachePtr && (codePtr->localCachePtr->refCount-- <= 1)) {
TclFreeLocalCache(interp, codePtr->localCachePtr);
}
TclHandleRelease(codePtr->interpHandle);
- ckfree(codePtr);
+ Tcl_Free(codePtr);
}
/*
@@ -1343,7 +1324,7 @@ CompileSubstObj(
}
if (codePtr == NULL) {
CompileEnv compEnv;
- int numBytes;
+ size_t numBytes;
const char *bytes = TclGetStringFromObj(objPtr, &numBytes);
/* TODO: Check for more TIP 280 */
@@ -1412,14 +1393,14 @@ ReleaseCmdWordData(
Tcl_DecrRefCount(eclPtr->path);
}
for (i=0 ; i<eclPtr->nuloc ; i++) {
- ckfree(eclPtr->loc[i].line);
+ Tcl_Free(eclPtr->loc[i].line);
}
if (eclPtr->loc != NULL) {
- ckfree(eclPtr->loc);
+ Tcl_Free(eclPtr->loc);
}
- ckfree(eclPtr);
+ Tcl_Free(eclPtr);
}
/*
@@ -1446,14 +1427,14 @@ TclInitCompileEnv(
register CompileEnv *envPtr,/* Points to the CompileEnv structure to
* initialize. */
const char *stringPtr, /* The source string to be compiled. */
- int numBytes, /* Number of bytes in source string. */
+ size_t numBytes, /* Number of bytes in source string. */
const CmdFrame *invoker, /* Location context invoking the bcc */
int word) /* Index of the word in that context getting
* compiled */
{
Interp *iPtr = (Interp *) interp;
- assert(tclInstructionTable[LAST_INST_OPCODE+1].name == NULL);
+ assert(tclInstructionTable[LAST_INST_OPCODE].name == NULL);
envPtr->iPtr = iPtr;
envPtr->source = stringPtr;
@@ -1498,7 +1479,7 @@ TclInitCompileEnv(
* non-compiling evaluator
*/
- envPtr->extCmdMapPtr = ckalloc(sizeof(ExtCmdLoc));
+ envPtr->extCmdMapPtr = Tcl_Alloc(sizeof(ExtCmdLoc));
envPtr->extCmdMapPtr->loc = NULL;
envPtr->extCmdMapPtr->nloc = 0;
envPtr->extCmdMapPtr->nuloc = 0;
@@ -1653,7 +1634,7 @@ TclFreeCompileEnv(
register CompileEnv *envPtr)/* Points to the CompileEnv structure. */
{
if (envPtr->localLitTable.buckets != envPtr->localLitTable.staticBuckets){
- ckfree(envPtr->localLitTable.buckets);
+ Tcl_Free(envPtr->localLitTable.buckets);
envPtr->localLitTable.buckets = envPtr->localLitTable.staticBuckets;
}
if (envPtr->iPtr) {
@@ -1683,20 +1664,20 @@ TclFreeCompileEnv(
}
}
if (envPtr->mallocedCodeArray) {
- ckfree(envPtr->codeStart);
+ Tcl_Free(envPtr->codeStart);
}
if (envPtr->mallocedLiteralArray) {
- ckfree(envPtr->literalArrayPtr);
+ Tcl_Free(envPtr->literalArrayPtr);
}
if (envPtr->mallocedExceptArray) {
- ckfree(envPtr->exceptArrayPtr);
- ckfree(envPtr->exceptAuxArrayPtr);
+ Tcl_Free(envPtr->exceptArrayPtr);
+ Tcl_Free(envPtr->exceptAuxArrayPtr);
}
if (envPtr->mallocedCmdMap) {
- ckfree(envPtr->cmdMapPtr);
+ Tcl_Free(envPtr->cmdMapPtr);
}
if (envPtr->mallocedAuxDataArray) {
- ckfree(envPtr->auxDataArrayPtr);
+ Tcl_Free(envPtr->auxDataArrayPtr);
}
if (envPtr->extCmdMapPtr) {
ReleaseCmdWordData(envPtr->extCmdMapPtr);
@@ -1762,7 +1743,7 @@ TclWordKnownAtCompileTime(
case TCL_TOKEN_BS:
if (tempPtr != NULL) {
char utfBuf[4] = "";
- int length = TclParseBackslash(tokenPtr->start,
+ size_t length = TclParseBackslash(tokenPtr->start,
tokenPtr->size, NULL, utfBuf);
Tcl_AppendToObj(tempPtr, utfBuf, length);
@@ -1805,7 +1786,7 @@ TclWordKnownAtCompileTime(
static int
ExpandRequested(
Tcl_Token *tokenPtr,
- int numWords)
+ size_t numWords)
{
/* Determine whether any words of the command require expansion */
while (numWords--) {
@@ -1823,18 +1804,18 @@ CompileCmdLiteral(
Tcl_Obj *cmdObj,
CompileEnv *envPtr)
{
- int numBytes;
const char *bytes;
Command *cmdPtr;
int cmdLitIdx, extraLiteralFlags = LITERAL_CMD_NAME;
+ size_t length;
cmdPtr = (Command *) Tcl_GetCommandFromObj(interp, cmdObj);
if ((cmdPtr != NULL) && (cmdPtr->flags & CMD_VIA_RESOLVER)) {
extraLiteralFlags |= LITERAL_UNSHARED;
}
- bytes = TclGetStringFromObj(cmdObj, &numBytes);
- cmdLitIdx = TclRegisterLiteral(envPtr, bytes, numBytes, extraLiteralFlags);
+ bytes = TclGetStringFromObj(cmdObj, &length);
+ cmdLitIdx = TclRegisterLiteral(envPtr, bytes, length, extraLiteralFlags);
if (cmdPtr) {
TclSetCmdNameObj(interp, TclFetchLiteral(envPtr, cmdLitIdx), cmdPtr);
@@ -1847,10 +1828,11 @@ TclCompileInvocation(
Tcl_Interp *interp,
Tcl_Token *tokenPtr,
Tcl_Obj *cmdObj,
- int numWords,
+ size_t numWords,
CompileEnv *envPtr)
{
- int wordIdx = 0, depth = TclGetStackDepth(envPtr);
+ size_t wordIdx = 0;
+ int depth = TclGetStackDepth(envPtr);
DefineLineInformation;
if (cmdObj) {
@@ -2015,7 +1997,7 @@ CompileCmdCompileProc(
while (mapPtr->nuloc - 1 > eclIndex) {
mapPtr->nuloc--;
- ckfree(mapPtr->loc[mapPtr->nuloc].line);
+ Tcl_Free(mapPtr->loc[mapPtr->nuloc].line);
mapPtr->loc[mapPtr->nuloc].line = NULL;
}
@@ -2065,7 +2047,7 @@ CompileCommandTokens(
EnterCmdWordData(eclPtr, parsePtr->commandStart - envPtr->source,
parsePtr->tokenPtr, parsePtr->commandStart,
- parsePtr->commandSize, parsePtr->numWords, cmdLine,
+ parsePtr->numWords, cmdLine,
clNext, &wlines, envPtr);
wlineat = eclPtr->nuloc - 1;
@@ -2133,8 +2115,8 @@ CompileCommandTokens(
envPtr->line = cmdLine;
envPtr->clNext = clNext;
- ckfree(eclPtr->loc[wlineat].line);
- ckfree(eclPtr->loc[wlineat].next);
+ Tcl_Free(eclPtr->loc[wlineat].line);
+ Tcl_Free(eclPtr->loc[wlineat].next);
eclPtr->loc[wlineat].line = wlines;
eclPtr->loc[wlineat].next = NULL;
@@ -2148,7 +2130,7 @@ TclCompileScript(
* serves as context for finding and compiling
* commands. May not be NULL. */
const char *script, /* The source script to compile. */
- int numBytes, /* Number of bytes in script. If < 0, the
+ size_t numBytes, /* Number of bytes in script. If -1, the
* script consists of all bytes up to the
* first null character. */
CompileEnv *envPtr) /* Holds resulting instructions. */
@@ -2166,7 +2148,7 @@ TclCompileScript(
/* Each iteration compiles one command from the script. */
- while (numBytes > 0) {
+ while (numBytes + 1 > 1) {
Tcl_Parse parse;
const char *next;
@@ -2301,8 +2283,8 @@ TclCompileVarSubst(
CompileEnv *envPtr)
{
const char *p, *name = tokenPtr[1].start;
- int nameBytes = tokenPtr[1].size;
- int i, localVar, localVarName = 1;
+ size_t i, nameBytes = tokenPtr[1].size;
+ int localVar, localVarName = 1;
/*
* Determine how the variable name should be handled: if it contains any
@@ -2376,7 +2358,8 @@ TclCompileTokens(
Tcl_DString textBuffer; /* Holds concatenated chars from adjacent
* TCL_TOKEN_TEXT, TCL_TOKEN_BS tokens. */
char buffer[4] = "";
- int i, numObjsToConcat, length, adjust;
+ int i, numObjsToConcat, adjust;
+ size_t length;
unsigned char *entryCodeNext = envPtr->codeNext;
#define NUM_STATIC_POS 20
int isLiteral, maxNumCL, numCL;
@@ -2411,7 +2394,7 @@ TclCompileTokens(
if (isLiteral) {
maxNumCL = NUM_STATIC_POS;
- clPosition = ckalloc(maxNumCL * sizeof(int));
+ clPosition = Tcl_Alloc(maxNumCL * sizeof(int));
}
adjust = 0;
@@ -2452,7 +2435,7 @@ TclCompileTokens(
if (numCL >= maxNumCL) {
maxNumCL *= 2;
- clPosition = ckrealloc(clPosition,
+ clPosition = Tcl_Realloc(clPosition,
maxNumCL * sizeof(int));
}
clPosition[numCL] = clPos;
@@ -2510,7 +2493,7 @@ TclCompileTokens(
default:
Tcl_Panic("Unexpected token type in TclCompileTokens: %d; %.*s",
- tokenPtr->type, tokenPtr->size, tokenPtr->start);
+ tokenPtr->type, (int)tokenPtr->size, tokenPtr->start);
}
}
@@ -2557,7 +2540,7 @@ TclCompileTokens(
*/
if (maxNumCL) {
- ckfree(clPosition);
+ Tcl_Free(clPosition);
}
TclCheckStackDepth(depth+1, envPtr);
}
@@ -2768,7 +2751,7 @@ PreventCycle(
* can be sure we do not have any lingering cycles hiding in
* the intrep.
*/
- int numBytes;
+ size_t numBytes;
const char *bytes = TclGetStringFromObj(objPtr, &numBytes);
Tcl_Obj *copyPtr = Tcl_NewStringObj(bytes, numBytes);
@@ -2826,7 +2809,7 @@ TclInitByteCode(
namespacePtr = envPtr->iPtr->globalNsPtr;
}
- p = ckalloc(structureSize);
+ p = Tcl_Alloc(structureSize);
codePtr = (ByteCode *) p;
codePtr->interpHandle = TclHandlePreserve(iPtr->handle);
codePtr->compileEpoch = iPtr->compileEpoch;
@@ -2971,7 +2954,7 @@ TclFindCompiledLocal(
register const char *name, /* Points to first character of the name of a
* scalar or array variable. If NULL, a
* temporary var should be created. */
- int nameBytes, /* Number of bytes in the name. */
+ size_t nameBytes, /* Number of bytes in the name. */
int create, /* If 1, allocate a local frame entry for the
* variable if it is new. */
CompileEnv *envPtr) /* Points to the current compile environment*/
@@ -2997,7 +2980,7 @@ TclFindCompiledLocal(
LocalCache *cachePtr = envPtr->iPtr->varFramePtr->localCachePtr;
const char *localName;
Tcl_Obj **varNamePtr;
- int len;
+ size_t len;
if (!cachePtr || !name) {
return -1;
@@ -3006,8 +2989,7 @@ TclFindCompiledLocal(
varNamePtr = &cachePtr->varName0;
for (i=0; i < cachePtr->numVars; varNamePtr++, i++) {
if (*varNamePtr) {
- localName = TclGetString(*varNamePtr);
- len = (*varNamePtr)->length;
+ localName = TclGetStringFromObj(*varNamePtr, &len);
if ((len == nameBytes) && !strncmp(name, localName, len)) {
return i;
}
@@ -3025,7 +3007,7 @@ TclFindCompiledLocal(
char *localName = localPtr->name;
if ((nameBytes == localPtr->nameLength) &&
- (strncmp(name, localName, nameBytes) == 0)) {
+ (strncmp(name,localName,nameBytes) == 0)) {
return i;
}
}
@@ -3039,7 +3021,7 @@ TclFindCompiledLocal(
if (create || (name == NULL)) {
localVar = procPtr->numCompiledLocals;
- localPtr = ckalloc(offsetof(CompiledLocal, name) + nameBytes + 1);
+ localPtr = Tcl_Alloc(offsetof(CompiledLocal, name) + nameBytes + 1);
if (procPtr->firstLocalPtr == NULL) {
procPtr->firstLocalPtr = procPtr->lastLocalPtr = localPtr;
} else {
@@ -3103,14 +3085,14 @@ TclExpandCodeArray(
size_t newBytes = 2 * (envPtr->codeEnd - envPtr->codeStart);
if (envPtr->mallocedCodeArray) {
- envPtr->codeStart = ckrealloc(envPtr->codeStart, newBytes);
+ envPtr->codeStart = Tcl_Realloc(envPtr->codeStart, newBytes);
} else {
/*
- * envPtr->codeStart isn't a ckalloc'd pointer, so we must code a
- * ckrealloc equivalent for ourselves.
+ * envPtr->codeStart isn't a Tcl_Alloc'd pointer, so we must code a
+ * Tcl_Realloc equivalent for ourselves.
*/
- unsigned char *newPtr = ckalloc(newBytes);
+ unsigned char *newPtr = Tcl_Alloc(newBytes);
memcpy(newPtr, envPtr->codeStart, currBytes);
envPtr->codeStart = newPtr;
@@ -3170,14 +3152,14 @@ EnterCmdStartData(
size_t newBytes = newElems * sizeof(CmdLocation);
if (envPtr->mallocedCmdMap) {
- envPtr->cmdMapPtr = ckrealloc(envPtr->cmdMapPtr, newBytes);
+ envPtr->cmdMapPtr = Tcl_Realloc(envPtr->cmdMapPtr, newBytes);
} else {
/*
- * envPtr->cmdMapPtr isn't a ckalloc'd pointer, so we must code a
- * ckrealloc equivalent for ourselves.
+ * envPtr->cmdMapPtr isn't a Tcl_Alloc'd pointer, so we must code a
+ * Tcl_Realloc equivalent for ourselves.
*/
- CmdLocation *newPtr = ckalloc(newBytes);
+ CmdLocation *newPtr = Tcl_Alloc(newBytes);
memcpy(newPtr, envPtr->cmdMapPtr, currBytes);
envPtr->cmdMapPtr = newPtr;
@@ -3274,7 +3256,6 @@ EnterCmdWordData(
int srcOffset, /* Offset of first char of the command. */
Tcl_Token *tokenPtr,
const char *cmd,
- int len,
int numWords,
int line,
int *clNext,
@@ -3296,16 +3277,16 @@ EnterCmdWordData(
size_t newElems = (currElems ? 2*currElems : 1);
size_t newBytes = newElems * sizeof(ECL);
- eclPtr->loc = ckrealloc(eclPtr->loc, newBytes);
+ eclPtr->loc = Tcl_Realloc(eclPtr->loc, newBytes);
eclPtr->nloc = newElems;
}
ePtr = &eclPtr->loc[eclPtr->nuloc];
ePtr->srcOffset = srcOffset;
- ePtr->line = ckalloc(numWords * sizeof(int));
- ePtr->next = ckalloc(numWords * sizeof(int *));
+ ePtr->line = Tcl_Alloc(numWords * sizeof(int));
+ ePtr->next = Tcl_Alloc(numWords * sizeof(int *));
ePtr->nline = numWords;
- wwlines = ckalloc(numWords * sizeof(int));
+ wwlines = Tcl_Alloc(numWords * sizeof(int));
last = cmd;
wordLine = line;
@@ -3374,17 +3355,17 @@ TclCreateExceptRange(
if (envPtr->mallocedExceptArray) {
envPtr->exceptArrayPtr =
- ckrealloc(envPtr->exceptArrayPtr, newBytes);
+ Tcl_Realloc(envPtr->exceptArrayPtr, newBytes);
envPtr->exceptAuxArrayPtr =
- ckrealloc(envPtr->exceptAuxArrayPtr, newBytes2);
+ Tcl_Realloc(envPtr->exceptAuxArrayPtr, newBytes2);
} else {
/*
- * envPtr->exceptArrayPtr isn't a ckalloc'd pointer, so we must
- * code a ckrealloc equivalent for ourselves.
+ * envPtr->exceptArrayPtr isn't a Tcl_Alloc'd pointer, so we must
+ * code a Tcl_Realloc equivalent for ourselves.
*/
- ExceptionRange *newPtr = ckalloc(newBytes);
- ExceptionAux *newPtr2 = ckalloc(newBytes2);
+ ExceptionRange *newPtr = Tcl_Alloc(newBytes);
+ ExceptionAux *newPtr2 = Tcl_Alloc(newBytes2);
memcpy(newPtr, envPtr->exceptArrayPtr, currBytes);
memcpy(newPtr2, envPtr->exceptAuxArrayPtr, currBytes2);
@@ -3487,11 +3468,11 @@ TclAddLoopBreakFixup(
auxPtr->allocBreakTargets *= 2;
auxPtr->allocBreakTargets += 2;
if (auxPtr->breakTargets) {
- auxPtr->breakTargets = ckrealloc(auxPtr->breakTargets,
+ auxPtr->breakTargets = Tcl_Realloc(auxPtr->breakTargets,
sizeof(int) * auxPtr->allocBreakTargets);
} else {
auxPtr->breakTargets =
- ckalloc(sizeof(int) * auxPtr->allocBreakTargets);
+ Tcl_Alloc(sizeof(int) * auxPtr->allocBreakTargets);
}
}
auxPtr->breakTargets[auxPtr->numBreakTargets - 1] = CurrentOffset(envPtr);
@@ -3513,11 +3494,11 @@ TclAddLoopContinueFixup(
auxPtr->allocContinueTargets *= 2;
auxPtr->allocContinueTargets += 2;
if (auxPtr->continueTargets) {
- auxPtr->continueTargets = ckrealloc(auxPtr->continueTargets,
+ auxPtr->continueTargets = Tcl_Realloc(auxPtr->continueTargets,
sizeof(int) * auxPtr->allocContinueTargets);
} else {
auxPtr->continueTargets =
- ckalloc(sizeof(int) * auxPtr->allocContinueTargets);
+ Tcl_Alloc(sizeof(int) * auxPtr->allocContinueTargets);
}
}
auxPtr->continueTargets[auxPtr->numContinueTargets - 1] =
@@ -3679,12 +3660,12 @@ TclFinalizeLoopExceptionRange(
*/
if (auxPtr->breakTargets) {
- ckfree(auxPtr->breakTargets);
+ Tcl_Free(auxPtr->breakTargets);
auxPtr->breakTargets = NULL;
auxPtr->numBreakTargets = 0;
}
if (auxPtr->continueTargets) {
- ckfree(auxPtr->continueTargets);
+ Tcl_Free(auxPtr->continueTargets);
auxPtr->continueTargets = NULL;
auxPtr->numContinueTargets = 0;
}
@@ -3740,14 +3721,14 @@ TclCreateAuxData(
if (envPtr->mallocedAuxDataArray) {
envPtr->auxDataArrayPtr =
- ckrealloc(envPtr->auxDataArrayPtr, newBytes);
+ Tcl_Realloc(envPtr->auxDataArrayPtr, newBytes);
} else {
/*
- * envPtr->auxDataArrayPtr isn't a ckalloc'd pointer, so we must
- * code a ckrealloc equivalent for ourselves.
+ * envPtr->auxDataArrayPtr isn't a Tcl_Alloc'd pointer, so we must
+ * code a Tcl_Realloc equivalent for ourselves.
*/
- AuxData *newPtr = ckalloc(newBytes);
+ AuxData *newPtr = Tcl_Alloc(newBytes);
memcpy(newPtr, envPtr->auxDataArrayPtr, currBytes);
envPtr->auxDataArrayPtr = newPtr;
@@ -3829,14 +3810,14 @@ TclExpandJumpFixupArray(
size_t newBytes = newElems * sizeof(JumpFixup);
if (fixupArrayPtr->mallocedArray) {
- fixupArrayPtr->fixup = ckrealloc(fixupArrayPtr->fixup, newBytes);
+ fixupArrayPtr->fixup = Tcl_Realloc(fixupArrayPtr->fixup, newBytes);
} else {
/*
- * fixupArrayPtr->fixup isn't a ckalloc'd pointer, so we must code a
- * ckrealloc equivalent for ourselves.
+ * fixupArrayPtr->fixup isn't a Tcl_Alloc'd pointer, so we must code a
+ * Tcl_Realloc equivalent for ourselves.
*/
- JumpFixup *newPtr = ckalloc(newBytes);
+ JumpFixup *newPtr = Tcl_Alloc(newBytes);
memcpy(newPtr, fixupArrayPtr->fixup, currBytes);
fixupArrayPtr->fixup = newPtr;
@@ -3868,7 +3849,7 @@ TclFreeJumpFixupArray(
* free. */
{
if (fixupArrayPtr->mallocedArray) {
- ckfree(fixupArrayPtr->fixup);
+ Tcl_Free(fixupArrayPtr->fixup);
}
}
@@ -3968,7 +3949,7 @@ TclFixupForwardJump(
{
unsigned char *jumpPc, *p;
int firstCmd, lastCmd, firstRange, lastRange, k;
- unsigned numBytes;
+ size_t numBytes;
if (jumpDist <= distThreshold) {
jumpPc = envPtr->codeStart + jumpFixupPtr->codeOffset;
diff --git a/generic/tclCompile.h b/generic/tclCompile.h
index 5e39a21..4d5f973 100644
--- a/generic/tclCompile.h
+++ b/generic/tclCompile.h
@@ -87,7 +87,7 @@ typedef enum {
* to a catch PC offset. */
} ExceptionRangeType;
-typedef struct ExceptionRange {
+typedef struct {
ExceptionRangeType type; /* The kind of ExceptionRange. */
int nestingLevel; /* Static depth of the exception range. Used
* to find the most deeply-nested range
@@ -162,7 +162,7 @@ typedef struct ExceptionAux {
* source offset is not monotonic.
*/
-typedef struct CmdLocation {
+typedef struct {
int codeOffset; /* Offset of first byte of command code. */
int numCodeBytes; /* Number of bytes for command's code. */
int srcOffset; /* Offset of first char of the command. */
@@ -180,8 +180,8 @@ typedef struct CmdLocation {
* frame and associated information, like the path of a sourced file.
*/
-typedef struct ECL {
- int srcOffset; /* Command location to find the entry. */
+typedef struct {
+ size_t srcOffset; /* Command location to find the entry. */
int nline; /* Number of words in the command */
int *line; /* Line information for all words in the
* command. */
@@ -190,7 +190,7 @@ typedef struct ECL {
* lines. */
} ECL;
-typedef struct ExtCmdLoc {
+typedef struct {
int type; /* Context type. */
int start; /* Starting line for compiled script. Needed
* for the extended recompile check in
@@ -217,9 +217,9 @@ typedef struct ExtCmdLoc {
* the AuxData structure.
*/
-typedef ClientData (AuxDataDupProc) (ClientData clientData);
-typedef void (AuxDataFreeProc) (ClientData clientData);
-typedef void (AuxDataPrintProc)(ClientData clientData,
+typedef void *(AuxDataDupProc) (void *clientData);
+typedef void (AuxDataFreeProc) (void *clientData);
+typedef void (AuxDataPrintProc)(void *clientData,
Tcl_Obj *appendObj, struct ByteCode *codePtr,
unsigned int pcOffset);
@@ -417,7 +417,7 @@ typedef struct ByteCode {
* procs are specific to an interpreter so the
* code emitted will depend on the
* interpreter. */
- unsigned int compileEpoch; /* Value of iPtr->compileEpoch when this
+ size_t compileEpoch; /* Value of iPtr->compileEpoch when this
* ByteCode was compiled. Used to invalidate
* code when, e.g., commands with compile
* procs are redefined. */
@@ -425,11 +425,11 @@ typedef struct ByteCode {
* compiled. If the code is executed if a
* different namespace, it must be
* recompiled. */
- unsigned int nsEpoch; /* Value of nsPtr->resolverEpoch when this
+ size_t nsEpoch; /* Value of nsPtr->resolverEpoch when this
* ByteCode was compiled. Used to invalidate
* code when new namespace resolution rules
* are put into effect. */
- unsigned int refCount; /* Reference count: set 1 when created plus 1
+ size_t refCount; /* Reference count: set 1 when created plus 1
* for each execution of the code currently
* active. This structure can be freed when
* refCount becomes zero. */
@@ -536,320 +536,298 @@ typedef struct ByteCode {
* Opcodes for the Tcl bytecode instructions. These must correspond to the
* entries in the table of instruction descriptions, tclInstructionTable, in
* tclCompile.c. Also, the order and number of the expression opcodes (e.g.,
- * INST_LOR) must match the entries in the array operatorStrings in
+ * INST_BITOR) must match the entries in the array operatorStrings in
* tclExecute.c.
*/
-/* Opcodes 0 to 9 */
-#define INST_DONE 0
-#define INST_PUSH1 1
-#define INST_PUSH4 2
-#define INST_POP 3
-#define INST_DUP 4
-#define INST_STR_CONCAT1 5
-#define INST_INVOKE_STK1 6
-#define INST_INVOKE_STK4 7
-#define INST_EVAL_STK 8
-#define INST_EXPR_STK 9
-
-/* Opcodes 10 to 23 */
-#define INST_LOAD_SCALAR1 10
-#define INST_LOAD_SCALAR4 11
-#define INST_LOAD_SCALAR_STK 12
-#define INST_LOAD_ARRAY1 13
-#define INST_LOAD_ARRAY4 14
-#define INST_LOAD_ARRAY_STK 15
-#define INST_LOAD_STK 16
-#define INST_STORE_SCALAR1 17
-#define INST_STORE_SCALAR4 18
-#define INST_STORE_SCALAR_STK 19
-#define INST_STORE_ARRAY1 20
-#define INST_STORE_ARRAY4 21
-#define INST_STORE_ARRAY_STK 22
-#define INST_STORE_STK 23
-
-/* Opcodes 24 to 33 */
-#define INST_INCR_SCALAR1 24
-#define INST_INCR_SCALAR_STK 25
-#define INST_INCR_ARRAY1 26
-#define INST_INCR_ARRAY_STK 27
-#define INST_INCR_STK 28
-#define INST_INCR_SCALAR1_IMM 29
-#define INST_INCR_SCALAR_STK_IMM 30
-#define INST_INCR_ARRAY1_IMM 31
-#define INST_INCR_ARRAY_STK_IMM 32
-#define INST_INCR_STK_IMM 33
-
-/* Opcodes 34 to 39 */
-#define INST_JUMP1 34
-#define INST_JUMP4 35
-#define INST_JUMP_TRUE1 36
-#define INST_JUMP_TRUE4 37
-#define INST_JUMP_FALSE1 38
-#define INST_JUMP_FALSE4 39
-
-/* Opcodes 40 to 64 */
-#define INST_LOR 40
-#define INST_LAND 41
-#define INST_BITOR 42
-#define INST_BITXOR 43
-#define INST_BITAND 44
-#define INST_EQ 45
-#define INST_NEQ 46
-#define INST_LT 47
-#define INST_GT 48
-#define INST_LE 49
-#define INST_GE 50
-#define INST_LSHIFT 51
-#define INST_RSHIFT 52
-#define INST_ADD 53
-#define INST_SUB 54
-#define INST_MULT 55
-#define INST_DIV 56
-#define INST_MOD 57
-#define INST_UPLUS 58
-#define INST_UMINUS 59
-#define INST_BITNOT 60
-#define INST_LNOT 61
-#define INST_CALL_BUILTIN_FUNC1 62
-#define INST_CALL_FUNC1 63
-#define INST_TRY_CVT_TO_NUMERIC 64
-
-/* Opcodes 65 to 66 */
-#define INST_BREAK 65
-#define INST_CONTINUE 66
-
-/* Opcodes 67 to 68 */
-#define INST_FOREACH_START4 67 /* DEPRECATED */
-#define INST_FOREACH_STEP4 68 /* DEPRECATED */
-
-/* Opcodes 69 to 72 */
-#define INST_BEGIN_CATCH4 69
-#define INST_END_CATCH 70
-#define INST_PUSH_RESULT 71
-#define INST_PUSH_RETURN_CODE 72
-
-/* Opcodes 73 to 78 */
-#define INST_STR_EQ 73
-#define INST_STR_NEQ 74
-#define INST_STR_CMP 75
-#define INST_STR_LEN 76
-#define INST_STR_INDEX 77
-#define INST_STR_MATCH 78
-
-/* Opcodes 78 to 81 */
-#define INST_LIST 79
-#define INST_LIST_INDEX 80
-#define INST_LIST_LENGTH 81
-
-/* Opcodes 82 to 87 */
-#define INST_APPEND_SCALAR1 82
-#define INST_APPEND_SCALAR4 83
-#define INST_APPEND_ARRAY1 84
-#define INST_APPEND_ARRAY4 85
-#define INST_APPEND_ARRAY_STK 86
-#define INST_APPEND_STK 87
-
-/* Opcodes 88 to 93 */
-#define INST_LAPPEND_SCALAR1 88
-#define INST_LAPPEND_SCALAR4 89
-#define INST_LAPPEND_ARRAY1 90
-#define INST_LAPPEND_ARRAY4 91
-#define INST_LAPPEND_ARRAY_STK 92
-#define INST_LAPPEND_STK 93
-
-/* TIP #22 - LINDEX operator with flat arg list */
-
-#define INST_LIST_INDEX_MULTI 94
-
-/*
- * TIP #33 - 'lset' command. Code gen also required a Forth-like
- * OVER operation.
- */
-
-#define INST_OVER 95
-#define INST_LSET_LIST 96
-#define INST_LSET_FLAT 97
-
-/* TIP#90 - 'return' command. */
-
-#define INST_RETURN_IMM 98
-
-/* TIP#123 - exponentiation operator. */
-
-#define INST_EXPON 99
-
-/* TIP #157 - {*}... (word expansion) language syntax support. */
-
-#define INST_EXPAND_START 100
-#define INST_EXPAND_STKTOP 101
-#define INST_INVOKE_EXPANDED 102
-
-/*
- * TIP #57 - 'lassign' command. Code generation requires immediate
- * LINDEX and LRANGE operators.
- */
-
-#define INST_LIST_INDEX_IMM 103
-#define INST_LIST_RANGE_IMM 104
-
-#define INST_START_CMD 105
-
-#define INST_LIST_IN 106
-#define INST_LIST_NOT_IN 107
-
-#define INST_PUSH_RETURN_OPTIONS 108
-#define INST_RETURN_STK 109
-
-/*
- * Dictionary (TIP#111) related commands.
- */
-
-#define INST_DICT_GET 110
-#define INST_DICT_SET 111
-#define INST_DICT_UNSET 112
-#define INST_DICT_INCR_IMM 113
-#define INST_DICT_APPEND 114
-#define INST_DICT_LAPPEND 115
-#define INST_DICT_FIRST 116
-#define INST_DICT_NEXT 117
-#define INST_DICT_DONE 118
-#define INST_DICT_UPDATE_START 119
-#define INST_DICT_UPDATE_END 120
-
-/*
- * Instruction to support jumps defined by tables (instead of the classic
- * [switch] technique of chained comparisons).
- */
-
-#define INST_JUMP_TABLE 121
-
-/*
- * Instructions to support compilation of global, variable, upvar and
- * [namespace upvar].
- */
-
-#define INST_UPVAR 122
-#define INST_NSUPVAR 123
-#define INST_VARIABLE 124
-
-/* Instruction to support compiling syntax error to bytecode */
-
-#define INST_SYNTAX 125
-
-/* Instruction to reverse N items on top of stack */
-
-#define INST_REVERSE 126
-
-/* regexp instruction */
-
-#define INST_REGEXP 127
-
-/* For [info exists] compilation */
-#define INST_EXIST_SCALAR 128
-#define INST_EXIST_ARRAY 129
-#define INST_EXIST_ARRAY_STK 130
-#define INST_EXIST_STK 131
-
-/* For [subst] compilation */
-#define INST_NOP 132
-#define INST_RETURN_CODE_BRANCH 133
-
-/* For [unset] compilation */
-#define INST_UNSET_SCALAR 134
-#define INST_UNSET_ARRAY 135
-#define INST_UNSET_ARRAY_STK 136
-#define INST_UNSET_STK 137
-
-/* For [dict with], [dict exists], [dict create] and [dict merge] */
-#define INST_DICT_EXPAND 138
-#define INST_DICT_RECOMBINE_STK 139
-#define INST_DICT_RECOMBINE_IMM 140
-#define INST_DICT_EXISTS 141
-#define INST_DICT_VERIFY 142
-
-/* For [string map] and [regsub] compilation */
-#define INST_STR_MAP 143
-#define INST_STR_FIND 144
-#define INST_STR_FIND_LAST 145
-#define INST_STR_RANGE_IMM 146
-#define INST_STR_RANGE 147
-
-/* For operations to do with coroutines and other NRE-manipulators */
-#define INST_YIELD 148
-#define INST_COROUTINE_NAME 149
-#define INST_TAILCALL 150
-
-/* For compilation of basic information operations */
-#define INST_NS_CURRENT 151
-#define INST_INFO_LEVEL_NUM 152
-#define INST_INFO_LEVEL_ARGS 153
-#define INST_RESOLVE_COMMAND 154
-
-/* For compilation relating to TclOO */
-#define INST_TCLOO_SELF 155
-#define INST_TCLOO_CLASS 156
-#define INST_TCLOO_NS 157
-#define INST_TCLOO_IS_OBJECT 158
-
-/* For compilation of [array] subcommands */
-#define INST_ARRAY_EXISTS_STK 159
-#define INST_ARRAY_EXISTS_IMM 160
-#define INST_ARRAY_MAKE_STK 161
-#define INST_ARRAY_MAKE_IMM 162
-
-#define INST_INVOKE_REPLACE 163
-
-#define INST_LIST_CONCAT 164
-
-#define INST_EXPAND_DROP 165
-
-/* New foreach implementation */
-#define INST_FOREACH_START 166
-#define INST_FOREACH_STEP 167
-#define INST_FOREACH_END 168
-#define INST_LMAP_COLLECT 169
-
-/* For compilation of [string trim] and related */
-#define INST_STR_TRIM 170
-#define INST_STR_TRIM_LEFT 171
-#define INST_STR_TRIM_RIGHT 172
-
-#define INST_CONCAT_STK 173
-
-#define INST_STR_UPPER 174
-#define INST_STR_LOWER 175
-#define INST_STR_TITLE 176
-#define INST_STR_REPLACE 177
-
-#define INST_ORIGIN_COMMAND 178
-
-#define INST_TCLOO_NEXT 179
-#define INST_TCLOO_NEXT_CLASS 180
-
-#define INST_YIELD_TO_INVOKE 181
-
-#define INST_NUM_TYPE 182
-#define INST_TRY_CVT_TO_BOOLEAN 183
-#define INST_STR_CLASS 184
-
-#define INST_LAPPEND_LIST 185
-#define INST_LAPPEND_LIST_ARRAY 186
-#define INST_LAPPEND_LIST_ARRAY_STK 187
-#define INST_LAPPEND_LIST_STK 188
-
-#define INST_CLOCK_READ 189
-
-#define INST_DICT_GET_DEF 190
-
-/* TIP 461 */
-#define INST_STR_LT 191
-#define INST_STR_GT 192
-#define INST_STR_LE 193
-#define INST_STR_GE 194
-
-/* The last opcode */
-#define LAST_INST_OPCODE 194
+enum TclInstruction {
+ /* Opcodes 0 to 9 */
+ INST_DONE = 0,
+ INST_PUSH1,
+ INST_PUSH4,
+ INST_POP,
+ INST_DUP,
+ INST_STR_CONCAT1,
+ INST_INVOKE_STK1,
+ INST_INVOKE_STK4,
+ INST_EVAL_STK,
+ INST_EXPR_STK,
+
+ /* Opcodes 10 to 23 */
+ INST_LOAD_SCALAR1,
+ INST_LOAD_SCALAR4,
+ INST_LOAD_SCALAR_STK,
+ INST_LOAD_ARRAY1,
+ INST_LOAD_ARRAY4,
+ INST_LOAD_ARRAY_STK,
+ INST_LOAD_STK,
+ INST_STORE_SCALAR1,
+ INST_STORE_SCALAR4,
+ INST_STORE_SCALAR_STK,
+ INST_STORE_ARRAY1,
+ INST_STORE_ARRAY4,
+ INST_STORE_ARRAY_STK,
+ INST_STORE_STK,
+
+ /* Opcodes 24 to 33 */
+ INST_INCR_SCALAR1,
+ INST_INCR_SCALAR_STK,
+ INST_INCR_ARRAY1,
+ INST_INCR_ARRAY_STK,
+ INST_INCR_STK,
+ INST_INCR_SCALAR1_IMM,
+ INST_INCR_SCALAR_STK_IMM,
+ INST_INCR_ARRAY1_IMM,
+ INST_INCR_ARRAY_STK_IMM,
+ INST_INCR_STK_IMM,
+
+ /* Opcodes 34 to 39 */
+ INST_JUMP1,
+ INST_JUMP4,
+ INST_JUMP_TRUE1,
+ INST_JUMP_TRUE4,
+ INST_JUMP_FALSE1,
+ INST_JUMP_FALSE4,
+
+ /* Opcodes 42 to 64 */
+ INST_BITOR,
+ INST_BITXOR,
+ INST_BITAND,
+ INST_EQ,
+ INST_NEQ,
+ INST_LT,
+ INST_GT,
+ INST_LE,
+ INST_GE,
+ INST_LSHIFT,
+ INST_RSHIFT,
+ INST_ADD,
+ INST_SUB,
+ INST_MULT,
+ INST_DIV,
+ INST_MOD,
+ INST_UPLUS,
+ INST_UMINUS,
+ INST_BITNOT,
+ INST_LNOT,
+ INST_TRY_CVT_TO_NUMERIC,
+
+ /* Opcodes 65 to 66 */
+ INST_BREAK,
+ INST_CONTINUE,
+
+ /* Opcodes 69 to 72 */
+ INST_BEGIN_CATCH4,
+ INST_END_CATCH,
+ INST_PUSH_RESULT,
+ INST_PUSH_RETURN_CODE,
+
+ /* Opcodes 73 to 78 */
+ INST_STR_EQ,
+ INST_STR_NEQ,
+ INST_STR_CMP,
+ INST_STR_LEN,
+ INST_STR_INDEX,
+ INST_STR_MATCH,
+
+ /* Opcodes 79 to 81 */
+ INST_LIST,
+ INST_LIST_INDEX,
+ INST_LIST_LENGTH,
+
+ /* Opcodes 82 to 87 */
+ INST_APPEND_SCALAR1,
+ INST_APPEND_SCALAR4,
+ INST_APPEND_ARRAY1,
+ INST_APPEND_ARRAY4,
+ INST_APPEND_ARRAY_STK,
+ INST_APPEND_STK,
+
+ /* Opcodes 88 to 93 */
+ INST_LAPPEND_SCALAR1,
+ INST_LAPPEND_SCALAR4,
+ INST_LAPPEND_ARRAY1,
+ INST_LAPPEND_ARRAY4,
+ INST_LAPPEND_ARRAY_STK,
+ INST_LAPPEND_STK,
+
+ /* TIP #22 - LINDEX operator with flat arg list */
+ INST_LIST_INDEX_MULTI,
+
+ /*
+ * TIP #33 - 'lset' command. Code gen also required a Forth-like
+ * OVER operation.
+ */
+ INST_OVER,
+ INST_LSET_LIST,
+ INST_LSET_FLAT,
+
+ /* TIP#90 - 'return' command. */
+ INST_RETURN_IMM,
+
+ /* TIP#123 - exponentiation operator. */
+ INST_EXPON,
+
+ /* TIP #157 - {*}... (word expansion) language syntax support. */
+ INST_EXPAND_START,
+ INST_EXPAND_STKTOP,
+ INST_INVOKE_EXPANDED,
+
+ /*
+ * TIP #57 - 'lassign' command. Code generation requires immediate
+ * LINDEX and LRANGE operators.
+ */
+ INST_LIST_INDEX_IMM,
+ INST_LIST_RANGE_IMM,
+ INST_START_CMD,
+ INST_LIST_IN,
+ INST_LIST_NOT_IN,
+ INST_PUSH_RETURN_OPTIONS,
+ INST_RETURN_STK,
+
+ /*
+ * Dictionary (TIP#111) related commands.
+ */
+ INST_DICT_GET,
+ INST_DICT_SET,
+ INST_DICT_UNSET,
+ INST_DICT_INCR_IMM,
+ INST_DICT_APPEND,
+ INST_DICT_LAPPEND,
+ INST_DICT_FIRST,
+ INST_DICT_NEXT,
+ INST_DICT_UPDATE_START,
+ INST_DICT_UPDATE_END,
+
+ /*
+ * Instruction to support jumps defined by tables (instead of the classic
+ * [switch] technique of chained comparisons).
+ */
+ INST_JUMP_TABLE,
+
+ /*
+ * Instructions to support compilation of global, variable, upvar and
+ * [namespace upvar].
+ */
+ INST_UPVAR,
+ INST_NSUPVAR,
+ INST_VARIABLE,
+
+ /* Instruction to support compiling syntax error to bytecode */
+ INST_SYNTAX,
+
+ /* Instruction to reverse N items on top of stack */
+ INST_REVERSE,
+
+ /* regexp instruction */
+ INST_REGEXP,
+
+ /* For [info exists] compilation */
+ INST_EXIST_SCALAR,
+ INST_EXIST_ARRAY,
+ INST_EXIST_ARRAY_STK,
+ INST_EXIST_STK,
+
+ /* For [subst] compilation */
+ INST_NOP,
+ INST_RETURN_CODE_BRANCH,
+
+ /* For [unset] compilation */
+ INST_UNSET_SCALAR,
+ INST_UNSET_ARRAY,
+ INST_UNSET_ARRAY_STK,
+ INST_UNSET_STK,
+
+ /* For [dict with], [dict exists], [dict create] and [dict merge] */
+ INST_DICT_EXPAND,
+ INST_DICT_RECOMBINE_STK,
+ INST_DICT_RECOMBINE_IMM,
+ INST_DICT_EXISTS,
+ INST_DICT_VERIFY,
+
+ /* For [string map] and [regsub] compilation */
+ INST_STR_MAP,
+ INST_STR_FIND,
+ INST_STR_FIND_LAST,
+ INST_STR_RANGE_IMM,
+ INST_STR_RANGE,
+
+ /* For operations to do with coroutines and other NRE-manipulators */
+ INST_YIELD,
+ INST_COROUTINE_NAME,
+ INST_TAILCALL,
+
+ /* For compilation of basic information operations */
+ INST_NS_CURRENT,
+ INST_INFO_LEVEL_NUM,
+ INST_INFO_LEVEL_ARGS,
+ INST_RESOLVE_COMMAND,
+
+ /* For compilation relating to TclOO */
+ INST_TCLOO_SELF,
+ INST_TCLOO_CLASS,
+ INST_TCLOO_NS,
+ INST_TCLOO_IS_OBJECT,
+
+ /* For compilation of [array] subcommands */
+ INST_ARRAY_EXISTS_STK,
+ INST_ARRAY_EXISTS_IMM,
+ INST_ARRAY_MAKE_STK,
+ INST_ARRAY_MAKE_IMM,
+
+ INST_INVOKE_REPLACE,
+
+ INST_LIST_CONCAT,
+
+ INST_EXPAND_DROP,
+
+ /* New foreach implementation */
+ INST_FOREACH_START,
+ INST_FOREACH_STEP,
+ INST_FOREACH_END,
+ INST_LMAP_COLLECT,
+
+ /* For compilation of [string trim] and related */
+ INST_STR_TRIM,
+ INST_STR_TRIM_LEFT,
+ INST_STR_TRIM_RIGHT,
+
+ INST_CONCAT_STK,
+
+ INST_STR_UPPER,
+ INST_STR_LOWER,
+ INST_STR_TITLE,
+ INST_STR_REPLACE,
+
+ INST_ORIGIN_COMMAND,
+
+ INST_TCLOO_NEXT,
+ INST_TCLOO_NEXT_CLASS,
+
+ INST_YIELD_TO_INVOKE,
+
+ INST_NUM_TYPE,
+ INST_TRY_CVT_TO_BOOLEAN,
+ INST_STR_CLASS,
+
+ INST_LAPPEND_LIST,
+ INST_LAPPEND_LIST_ARRAY,
+ INST_LAPPEND_LIST_ARRAY_STK,
+ INST_LAPPEND_LIST_STK,
+
+ INST_CLOCK_READ,
+
+ INST_DICT_GET_DEF,
+
+ /* TIP 461 */
+ INST_STR_LT,
+ INST_STR_GT,
+ INST_STR_LE,
+ INST_STR_GE,
+
+ /* The last opcode */
+ LAST_INST_OPCODE
+};
/*
* Table describing the Tcl bytecode instructions: their name (for displaying
@@ -887,7 +865,7 @@ typedef enum InstOperandType {
typedef struct InstructionDesc {
const char *name; /* Name of instruction. */
- int numBytes; /* Total number of bytes for instruction. */
+ size_t numBytes; /* Total number of bytes for instruction. */
int stackEffect; /* The worst-case balance stack effect of the
* instruction, used for stack requirements
* computations. The value INT_MIN signals
@@ -1045,7 +1023,7 @@ MODULE_SCOPE const AuxDataType tclJumptableInfoType;
*/
typedef struct {
- int length; /* Size of array */
+ size_t length; /* Size of array */
int varIndices[1]; /* Array of variable indices to manage when
* processing the start and end of a [dict
* update]. There is really more than one
@@ -1100,15 +1078,15 @@ MODULE_SCOPE void TclCompileCmdWord(Tcl_Interp *interp,
Tcl_Token *tokenPtr, int count,
CompileEnv *envPtr);
MODULE_SCOPE void TclCompileExpr(Tcl_Interp *interp, const char *script,
- int numBytes, CompileEnv *envPtr, int optimize);
+ size_t numBytes, CompileEnv *envPtr, int optimize);
MODULE_SCOPE void TclCompileExprWords(Tcl_Interp *interp,
Tcl_Token *tokenPtr, int numWords,
CompileEnv *envPtr);
MODULE_SCOPE void TclCompileInvocation(Tcl_Interp *interp,
- Tcl_Token *tokenPtr, Tcl_Obj *cmdObj, int numWords,
+ Tcl_Token *tokenPtr, Tcl_Obj *cmdObj, size_t numWords,
CompileEnv *envPtr);
MODULE_SCOPE void TclCompileScript(Tcl_Interp *interp,
- const char *script, int numBytes,
+ const char *script, size_t numBytes,
CompileEnv *envPtr);
MODULE_SCOPE void TclCompileSyntaxError(Tcl_Interp *interp,
CompileEnv *envPtr);
@@ -1117,13 +1095,13 @@ MODULE_SCOPE void TclCompileTokens(Tcl_Interp *interp,
CompileEnv *envPtr);
MODULE_SCOPE void TclCompileVarSubst(Tcl_Interp *interp,
Tcl_Token *tokenPtr, CompileEnv *envPtr);
-MODULE_SCOPE int TclCreateAuxData(ClientData clientData,
+MODULE_SCOPE int TclCreateAuxData(void *clientData,
const AuxDataType *typePtr, CompileEnv *envPtr);
MODULE_SCOPE int TclCreateExceptRange(ExceptionRangeType type,
CompileEnv *envPtr);
-MODULE_SCOPE ExecEnv * TclCreateExecEnv(Tcl_Interp *interp, int size);
+MODULE_SCOPE ExecEnv * TclCreateExecEnv(Tcl_Interp *interp, size_t size);
MODULE_SCOPE Tcl_Obj * TclCreateLiteral(Interp *iPtr, const char *bytes,
- int length, unsigned int hash, int *newPtr,
+ size_t length, size_t hash, int *newPtr,
Namespace *nsPtr, int flags,
LiteralEntry **globalPtrPtr);
MODULE_SCOPE void TclDeleteExecEnv(ExecEnv *eePtr);
@@ -1137,8 +1115,8 @@ MODULE_SCOPE ExceptionRange * TclGetExceptionRangeForPc(unsigned char *pc,
MODULE_SCOPE void TclExpandJumpFixupArray(JumpFixupArray *fixupArrayPtr);
MODULE_SCOPE int TclNRExecuteByteCode(Tcl_Interp *interp,
ByteCode *codePtr);
-MODULE_SCOPE Tcl_Obj * TclFetchLiteral(CompileEnv *envPtr, unsigned int index);
-MODULE_SCOPE int TclFindCompiledLocal(const char *name, int nameChars,
+MODULE_SCOPE Tcl_Obj * TclFetchLiteral(CompileEnv *envPtr, size_t index);
+MODULE_SCOPE int TclFindCompiledLocal(const char *name, size_t nameChars,
int create, CompileEnv *envPtr);
MODULE_SCOPE int TclFixupForwardJump(CompileEnv *envPtr,
JumpFixup *jumpFixupPtr, int jumpDist,
@@ -1146,13 +1124,13 @@ MODULE_SCOPE int TclFixupForwardJump(CompileEnv *envPtr,
MODULE_SCOPE void TclFreeCompileEnv(CompileEnv *envPtr);
MODULE_SCOPE void TclFreeJumpFixupArray(JumpFixupArray *fixupArrayPtr);
MODULE_SCOPE int TclGetIndexFromToken(Tcl_Token *tokenPtr,
- int before, int after, int *indexPtr);
+ size_t before, size_t after, int *indexPtr);
MODULE_SCOPE ByteCode * TclInitByteCode(CompileEnv *envPtr);
MODULE_SCOPE ByteCode * TclInitByteCodeObj(Tcl_Obj *objPtr,
const Tcl_ObjType *typePtr, CompileEnv *envPtr);
MODULE_SCOPE void TclInitCompileEnv(Tcl_Interp *interp,
CompileEnv *envPtr, const char *string,
- int numBytes, const CmdFrame *invoker, int word);
+ size_t numBytes, const CmdFrame *invoker, int word);
MODULE_SCOPE void TclInitJumpFixupArray(JumpFixupArray *fixupArrayPtr);
MODULE_SCOPE void TclInitLiteralTable(LiteralTable *tablePtr);
MODULE_SCOPE ExceptionRange *TclGetInnermostExceptionRange(CompileEnv *envPtr,
@@ -1167,7 +1145,7 @@ MODULE_SCOPE void TclFinalizeLoopExceptionRange(CompileEnv *envPtr,
MODULE_SCOPE char * TclLiteralStats(LiteralTable *tablePtr);
MODULE_SCOPE int TclLog2(int value);
#endif
-MODULE_SCOPE int TclLocalScalar(const char *bytes, int numBytes,
+MODULE_SCOPE int TclLocalScalar(const char *bytes, size_t numBytes,
CompileEnv *envPtr);
MODULE_SCOPE int TclLocalScalarFromToken(Tcl_Token *tokenPtr,
CompileEnv *envPtr);
@@ -1179,9 +1157,9 @@ MODULE_SCOPE void TclPrintByteCodeObj(Tcl_Interp *interp,
MODULE_SCOPE int TclPrintInstruction(ByteCode *codePtr,
const unsigned char *pc);
MODULE_SCOPE void TclPrintObject(FILE *outFile,
- Tcl_Obj *objPtr, int maxChars);
+ Tcl_Obj *objPtr, size_t maxChars);
MODULE_SCOPE void TclPrintSource(FILE *outFile,
- const char *string, int maxChars);
+ const char *string, size_t maxChars);
MODULE_SCOPE void TclPushVarName(Tcl_Interp *interp,
Tcl_Token *varTokenPtr, CompileEnv *envPtr,
int flags, int *localIndexPtr,
@@ -1191,16 +1169,16 @@ MODULE_SCOPE void TclReleaseByteCode(ByteCode *codePtr);
MODULE_SCOPE void TclReleaseLiteral(Tcl_Interp *interp, Tcl_Obj *objPtr);
MODULE_SCOPE void TclInvalidateCmdLiteral(Tcl_Interp *interp,
const char *name, Namespace *nsPtr);
-MODULE_SCOPE int TclSingleOpCmd(ClientData clientData,
+MODULE_SCOPE int TclSingleOpCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int TclSortingOpCmd(ClientData clientData,
+MODULE_SCOPE int TclSortingOpCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int TclVariadicOpCmd(ClientData clientData,
+MODULE_SCOPE int TclVariadicOpCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int TclNoIdentOpCmd(ClientData clientData,
+MODULE_SCOPE int TclNoIdentOpCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
#ifdef TCL_COMPILE_DEBUG
@@ -1211,12 +1189,12 @@ MODULE_SCOPE int TclWordKnownAtCompileTime(Tcl_Token *tokenPtr,
Tcl_Obj *valuePtr);
MODULE_SCOPE void TclLogCommandInfo(Tcl_Interp *interp,
const char *script, const char *command,
- int length, const unsigned char *pc,
+ size_t length, const unsigned char *pc,
Tcl_Obj **tosPtr);
MODULE_SCOPE Tcl_Obj *TclGetInnerContext(Tcl_Interp *interp,
const unsigned char *pc, Tcl_Obj **tosPtr);
MODULE_SCOPE Tcl_Obj *TclNewInstNameObj(unsigned char inst);
-MODULE_SCOPE int TclPushProcCallFrame(ClientData clientData,
+MODULE_SCOPE int TclPushProcCallFrame(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[], int isLambda);
@@ -1231,7 +1209,7 @@ MODULE_SCOPE int TclPushProcCallFrame(ClientData clientData,
/*
* Simplified form to access AuxData.
*
- * ClientData TclFetchAuxData(CompileEng *envPtr, int index);
+ * void *TclFetchAuxData(CompileEng *envPtr, int index);
*/
#define TclFetchAuxData(envPtr, index) \
@@ -1550,7 +1528,7 @@ MODULE_SCOPE int TclPushProcCallFrame(ClientData clientData,
* these macros are:
*
* static void PushLiteral(CompileEnv *envPtr,
- * const char *string, int length);
+ * const char *string, size_t length);
* static void PushStringLiteral(CompileEnv *envPtr,
* const char *string);
*/
@@ -1558,7 +1536,7 @@ MODULE_SCOPE int TclPushProcCallFrame(ClientData clientData,
#define PushLiteral(envPtr, string, length) \
TclEmitPush(TclRegisterLiteral(envPtr, string, length, 0), (envPtr))
#define PushStringLiteral(envPtr, string) \
- PushLiteral(envPtr, string, (int) (sizeof(string "") - 1))
+ PushLiteral(envPtr, string, sizeof(string "") - 1)
/*
* Macro to advance to the next token; it is more mnemonic than the address
@@ -1574,7 +1552,7 @@ MODULE_SCOPE int TclPushProcCallFrame(ClientData clientData,
* Macro to get the offset to the next instruction to be issued. The ANSI C
* "prototype" for this macro is:
*
- * static int CurrentOffset(CompileEnv *envPtr);
+ * static ptrdiff_t CurrentOffset(CompileEnv *envPtr);
*/
#define CurrentOffset(envPtr) \
@@ -1826,8 +1804,8 @@ MODULE_SCOPE void TclDTraceInfo(Tcl_Obj *info, const char **args, int *argsi);
FILE *tclDTraceDebugLog = NULL; \
void TclDTraceOpenDebugLog(void) { \
char n[35]; \
- sprintf(n, "/tmp/tclDTraceDebug-%lu.log", \
- (unsigned long) getpid()); \
+ sprintf(n, "/tmp/tclDTraceDebug-%" TCL_Z_MODIFIER "u.log", \
+ (size_t) getpid()); \
tclDTraceDebugLog = fopen(n, "a"); \
}
diff --git a/generic/tclConfig.c b/generic/tclConfig.c
index eb6807c..8393b9c 100644
--- a/generic/tclConfig.c
+++ b/generic/tclConfig.c
@@ -31,7 +31,7 @@
* the (Tcl_Interp *) in which it is stored, and the encoding.
*/
-typedef struct QCCD {
+typedef struct {
Tcl_Obj *pkg;
Tcl_Interp *interp;
char *encoding;
@@ -79,11 +79,11 @@ Tcl_RegisterConfig(
Tcl_Obj *pDB, *pkgDict;
Tcl_DString cmdName;
const Tcl_Config *cfg;
- QCCD *cdPtr = ckalloc(sizeof(QCCD));
+ QCCD *cdPtr = Tcl_Alloc(sizeof(QCCD));
cdPtr->interp = interp;
if (valEncoding) {
- cdPtr->encoding = ckalloc(strlen(valEncoding)+1);
+ cdPtr->encoding = Tcl_Alloc(strlen(valEncoding)+1);
strcpy(cdPtr->encoding, valEncoding);
} else {
cdPtr->encoding = NULL;
@@ -202,7 +202,8 @@ QueryConfigObjCmd(
QCCD *cdPtr = clientData;
Tcl_Obj *pkgName = cdPtr->pkg;
Tcl_Obj *pDB, *pkgDict, *val, *listPtr;
- int n, index;
+ size_t n = 0;
+ int index, m;
static const char *const subcmdStrings[] = {
"get", "list", NULL
};
@@ -261,7 +262,7 @@ QueryConfigObjCmd(
* Value is stored as-is in a byte array, see Bug [9b2e636361],
* so we have to decode it first.
*/
- value = (const char *) Tcl_GetByteArrayFromObj(val, &n);
+ value = (const char *) TclGetByteArrayFromObj(val, &n);
value = Tcl_ExternalToUtfDString(venc, value, n, &conv);
Tcl_SetObjResult(interp, Tcl_NewStringObj(value,
Tcl_DStringLength(&conv)));
@@ -274,8 +275,8 @@ QueryConfigObjCmd(
return TCL_ERROR;
}
- Tcl_DictObjSize(interp, pkgDict, &n);
- listPtr = Tcl_NewListObj(n, NULL);
+ Tcl_DictObjSize(interp, pkgDict, &m);
+ listPtr = Tcl_NewListObj(m, NULL);
if (!listPtr) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
@@ -284,7 +285,7 @@ QueryConfigObjCmd(
return TCL_ERROR;
}
- if (n) {
+ if (m) {
Tcl_DictSearch s;
Tcl_Obj *key;
int done;
@@ -333,9 +334,9 @@ QueryConfigDelete(
Tcl_DictObjRemove(NULL, pDB, pkgName);
Tcl_DecrRefCount(pkgName);
if (cdPtr->encoding) {
- ckfree(cdPtr->encoding);
+ Tcl_Free(cdPtr->encoding);
}
- ckfree(cdPtr);
+ Tcl_Free(cdPtr);
}
/*
diff --git a/generic/tclDTrace.d b/generic/tclDTrace.d
index f5493b1..9d1adc0 100644
--- a/generic/tclDTrace.d
+++ b/generic/tclDTrace.d
@@ -181,9 +181,9 @@ typedef struct Tcl_ObjType {
} Tcl_ObjType;
struct Tcl_Obj {
- int refCount;
+ size_t refCount;
char *bytes;
- int length;
+ size_t length;
const Tcl_ObjType *typePtr;
union {
long longValue;
diff --git a/generic/tclDate.c b/generic/tclDate.c
index 32c71de..aa65e77 100644
--- a/generic/tclDate.c
+++ b/generic/tclDate.c
@@ -138,8 +138,8 @@ typedef struct DateInfo {
int dateDigitCount;
} DateInfo;
-#define YYMALLOC ckalloc
-#define YYFREE(x) (ckfree((void*) (x)))
+#define YYMALLOC Tcl_Alloc
+#define YYFREE(x) (Tcl_Free((void*) (x)))
#define yyDSTmode (info->dateDSTmode)
#define yyDayOrdinal (info->dateDayOrdinal)
@@ -2761,7 +2761,7 @@ TclClockOldscanObjCmd(
return TCL_ERROR;
}
- yyInput = Tcl_GetString( objv[1] );
+ yyInput = TclGetString(objv[1]);
dateInfo.dateStart = yyInput;
yyHaveDate = 0;
@@ -2848,16 +2848,16 @@ TclClockOldscanObjCmd(
resultElement = Tcl_NewObj();
if (yyHaveDate) {
Tcl_ListObjAppendElement(interp, resultElement,
- Tcl_NewIntObj((int) yyYear));
+ Tcl_NewIntObj(yyYear));
Tcl_ListObjAppendElement(interp, resultElement,
- Tcl_NewIntObj((int) yyMonth));
+ Tcl_NewIntObj(yyMonth));
Tcl_ListObjAppendElement(interp, resultElement,
- Tcl_NewIntObj((int) yyDay));
+ Tcl_NewIntObj(yyDay));
}
Tcl_ListObjAppendElement(interp, result, resultElement);
if (yyHaveTime) {
- Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj((int)
+ Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj(
ToSeconds(yyHour, yyMinutes, yySeconds, yyMeridian)));
} else {
Tcl_ListObjAppendElement(interp, result, Tcl_NewObj());
@@ -2866,7 +2866,7 @@ TclClockOldscanObjCmd(
resultElement = Tcl_NewObj();
if (yyHaveZone) {
Tcl_ListObjAppendElement(interp, resultElement,
- Tcl_NewIntObj((int) -yyTimezone));
+ Tcl_NewIntObj(-yyTimezone));
Tcl_ListObjAppendElement(interp, resultElement,
Tcl_NewIntObj(1 - yyDSTmode));
}
@@ -2875,29 +2875,29 @@ TclClockOldscanObjCmd(
resultElement = Tcl_NewObj();
if (yyHaveRel) {
Tcl_ListObjAppendElement(interp, resultElement,
- Tcl_NewIntObj((int) yyRelMonth));
+ Tcl_NewIntObj(yyRelMonth));
Tcl_ListObjAppendElement(interp, resultElement,
- Tcl_NewIntObj((int) yyRelDay));
+ Tcl_NewIntObj(yyRelDay));
Tcl_ListObjAppendElement(interp, resultElement,
- Tcl_NewIntObj((int) yyRelSeconds));
+ Tcl_NewIntObj(yyRelSeconds));
}
Tcl_ListObjAppendElement(interp, result, resultElement);
resultElement = Tcl_NewObj();
if (yyHaveDay && !yyHaveDate) {
Tcl_ListObjAppendElement(interp, resultElement,
- Tcl_NewIntObj((int) yyDayOrdinal));
+ Tcl_NewIntObj(yyDayOrdinal));
Tcl_ListObjAppendElement(interp, resultElement,
- Tcl_NewIntObj((int) yyDayNumber));
+ Tcl_NewIntObj(yyDayNumber));
}
Tcl_ListObjAppendElement(interp, result, resultElement);
resultElement = Tcl_NewObj();
if (yyHaveOrdinalMonth) {
Tcl_ListObjAppendElement(interp, resultElement,
- Tcl_NewIntObj((int) yyMonthOrdinal));
+ Tcl_NewIntObj(yyMonthOrdinal));
Tcl_ListObjAppendElement(interp, resultElement,
- Tcl_NewIntObj((int) yyMonth));
+ Tcl_NewIntObj(yyMonth));
}
Tcl_ListObjAppendElement(interp, result, resultElement);
diff --git a/generic/tclDecls.h b/generic/tclDecls.h
index 3f39cd5..35ad3fa 100644
--- a/generic/tclDecls.h
+++ b/generic/tclDecls.h
@@ -59,28 +59,28 @@ EXTERN const char * Tcl_PkgRequireEx(Tcl_Interp *interp,
/* 2 */
EXTERN TCL_NORETURN void Tcl_Panic(const char *format, ...) TCL_FORMAT_PRINTF(1, 2);
/* 3 */
-EXTERN char * Tcl_Alloc(unsigned int size);
+EXTERN void * Tcl_Alloc(size_t size);
/* 4 */
-EXTERN void Tcl_Free(char *ptr);
+EXTERN void Tcl_Free(void *ptr);
/* 5 */
-EXTERN char * Tcl_Realloc(char *ptr, unsigned int size);
+EXTERN void * Tcl_Realloc(void *ptr, size_t size);
/* 6 */
-EXTERN char * Tcl_DbCkalloc(unsigned int size, const char *file,
+EXTERN void * Tcl_DbCkalloc(size_t size, const char *file,
int line);
/* 7 */
-EXTERN void Tcl_DbCkfree(char *ptr, const char *file, int line);
+EXTERN void Tcl_DbCkfree(void *ptr, const char *file, int line);
/* 8 */
-EXTERN char * Tcl_DbCkrealloc(char *ptr, unsigned int size,
+EXTERN void * Tcl_DbCkrealloc(void *ptr, size_t size,
const char *file, int line);
#if !defined(_WIN32) && !defined(MAC_OSX_TCL) /* UNIX */
/* 9 */
EXTERN void Tcl_CreateFileHandler(int fd, int mask,
- Tcl_FileProc *proc, ClientData clientData);
+ Tcl_FileProc *proc, void *clientData);
#endif /* UNIX */
#ifdef MAC_OSX_TCL /* MACOSX */
/* 9 */
EXTERN void Tcl_CreateFileHandler(int fd, int mask,
- Tcl_FileProc *proc, ClientData clientData);
+ Tcl_FileProc *proc, void *clientData);
#endif /* MACOSX */
#if !defined(_WIN32) && !defined(MAC_OSX_TCL) /* UNIX */
/* 10 */
@@ -103,7 +103,7 @@ EXTERN int Tcl_AppendAllObjTypes(Tcl_Interp *interp,
EXTERN void Tcl_AppendStringsToObj(Tcl_Obj *objPtr, ...);
/* 16 */
EXTERN void Tcl_AppendToObj(Tcl_Obj *objPtr, const char *bytes,
- int length);
+ size_t length);
/* 17 */
EXTERN Tcl_Obj * Tcl_ConcatObj(int objc, Tcl_Obj *const objv[]);
/* 18 */
@@ -118,32 +118,25 @@ EXTERN void Tcl_DbIncrRefCount(Tcl_Obj *objPtr, const char *file,
/* 21 */
EXTERN int Tcl_DbIsShared(Tcl_Obj *objPtr, const char *file,
int line);
-/* 22 */
-TCL_DEPRECATED("No longer in use, changed to macro")
-Tcl_Obj * Tcl_DbNewBooleanObj(int boolValue, const char *file,
- int line);
+/* Slot 22 is reserved */
/* 23 */
EXTERN Tcl_Obj * Tcl_DbNewByteArrayObj(const unsigned char *bytes,
- int length, const char *file, int line);
+ size_t length, const char *file, int line);
/* 24 */
EXTERN Tcl_Obj * Tcl_DbNewDoubleObj(double doubleValue,
const char *file, int line);
/* 25 */
EXTERN Tcl_Obj * Tcl_DbNewListObj(int objc, Tcl_Obj *const *objv,
const char *file, int line);
-/* 26 */
-TCL_DEPRECATED("No longer in use, changed to macro")
-Tcl_Obj * Tcl_DbNewLongObj(long longValue, const char *file,
- int line);
+/* Slot 26 is reserved */
/* 27 */
EXTERN Tcl_Obj * Tcl_DbNewObj(const char *file, int line);
/* 28 */
-EXTERN Tcl_Obj * Tcl_DbNewStringObj(const char *bytes, int length,
+EXTERN Tcl_Obj * Tcl_DbNewStringObj(const char *bytes, size_t length,
const char *file, int line);
/* 29 */
EXTERN Tcl_Obj * Tcl_DuplicateObj(Tcl_Obj *objPtr);
-/* 30 */
-EXTERN void TclOldFreeObj(Tcl_Obj *objPtr);
+/* Slot 30 is reserved */
/* 31 */
EXTERN int Tcl_GetBoolean(Tcl_Interp *interp, const char *src,
int *boolPtr);
@@ -159,11 +152,7 @@ EXTERN int Tcl_GetDouble(Tcl_Interp *interp, const char *src,
/* 35 */
EXTERN int Tcl_GetDoubleFromObj(Tcl_Interp *interp,
Tcl_Obj *objPtr, double *doublePtr);
-/* 36 */
-TCL_DEPRECATED("No longer in use, changed to macro")
-int Tcl_GetIndexFromObj(Tcl_Interp *interp,
- Tcl_Obj *objPtr, const char *const *tablePtr,
- const char *msg, int flags, int *indexPtr);
+/* Slot 36 is reserved */
/* 37 */
EXTERN int Tcl_GetInt(Tcl_Interp *interp, const char *src,
int *intPtr);
@@ -174,7 +163,7 @@ EXTERN int Tcl_GetIntFromObj(Tcl_Interp *interp,
EXTERN int Tcl_GetLongFromObj(Tcl_Interp *interp,
Tcl_Obj *objPtr, long *longPtr);
/* 40 */
-EXTERN CONST86 Tcl_ObjType * Tcl_GetObjType(const char *typeName);
+EXTERN const Tcl_ObjType * Tcl_GetObjType(const char *typeName);
/* 41 */
EXTERN char * Tcl_GetStringFromObj(Tcl_Obj *objPtr, int *lengthPtr);
/* 42 */
@@ -200,58 +189,41 @@ EXTERN int Tcl_ListObjLength(Tcl_Interp *interp,
EXTERN int Tcl_ListObjReplace(Tcl_Interp *interp,
Tcl_Obj *listPtr, int first, int count,
int objc, Tcl_Obj *const objv[]);
-/* 49 */
-TCL_DEPRECATED("No longer in use, changed to macro")
-Tcl_Obj * Tcl_NewBooleanObj(int boolValue);
+/* Slot 49 is reserved */
/* 50 */
EXTERN Tcl_Obj * Tcl_NewByteArrayObj(const unsigned char *bytes,
- int length);
+ size_t length);
/* 51 */
EXTERN Tcl_Obj * Tcl_NewDoubleObj(double doubleValue);
-/* 52 */
-TCL_DEPRECATED("No longer in use, changed to macro")
-Tcl_Obj * Tcl_NewIntObj(int intValue);
+/* Slot 52 is reserved */
/* 53 */
EXTERN Tcl_Obj * Tcl_NewListObj(int objc, Tcl_Obj *const objv[]);
-/* 54 */
-TCL_DEPRECATED("No longer in use, changed to macro")
-Tcl_Obj * Tcl_NewLongObj(long longValue);
+/* Slot 54 is reserved */
/* 55 */
EXTERN Tcl_Obj * Tcl_NewObj(void);
/* 56 */
-EXTERN Tcl_Obj * Tcl_NewStringObj(const char *bytes, int length);
-/* 57 */
-TCL_DEPRECATED("No longer in use, changed to macro")
-void Tcl_SetBooleanObj(Tcl_Obj *objPtr, int boolValue);
+EXTERN Tcl_Obj * Tcl_NewStringObj(const char *bytes, size_t length);
+/* Slot 57 is reserved */
/* 58 */
-EXTERN unsigned char * Tcl_SetByteArrayLength(Tcl_Obj *objPtr, int length);
+EXTERN unsigned char * Tcl_SetByteArrayLength(Tcl_Obj *objPtr,
+ size_t length);
/* 59 */
EXTERN void Tcl_SetByteArrayObj(Tcl_Obj *objPtr,
- const unsigned char *bytes, int length);
+ const unsigned char *bytes, size_t length);
/* 60 */
EXTERN void Tcl_SetDoubleObj(Tcl_Obj *objPtr, double doubleValue);
-/* 61 */
-TCL_DEPRECATED("No longer in use, changed to macro")
-void Tcl_SetIntObj(Tcl_Obj *objPtr, int intValue);
+/* Slot 61 is reserved */
/* 62 */
EXTERN void Tcl_SetListObj(Tcl_Obj *objPtr, int objc,
Tcl_Obj *const objv[]);
-/* 63 */
-TCL_DEPRECATED("No longer in use, changed to macro")
-void Tcl_SetLongObj(Tcl_Obj *objPtr, long longValue);
+/* Slot 63 is reserved */
/* 64 */
-EXTERN void Tcl_SetObjLength(Tcl_Obj *objPtr, int length);
+EXTERN void Tcl_SetObjLength(Tcl_Obj *objPtr, size_t length);
/* 65 */
EXTERN void Tcl_SetStringObj(Tcl_Obj *objPtr, const char *bytes,
- int length);
-/* 66 */
-TCL_DEPRECATED("No longer in use, changed to macro")
-void Tcl_AddErrorInfo(Tcl_Interp *interp,
- const char *message);
-/* 67 */
-TCL_DEPRECATED("No longer in use, changed to macro")
-void Tcl_AddObjErrorInfo(Tcl_Interp *interp,
- const char *message, int length);
+ size_t length);
+/* Slot 66 is reserved */
+/* Slot 67 is reserved */
/* 68 */
EXTERN void Tcl_AllowExceptions(Tcl_Interp *interp);
/* 69 */
@@ -261,7 +233,7 @@ EXTERN void Tcl_AppendElement(Tcl_Interp *interp,
EXTERN void Tcl_AppendResult(Tcl_Interp *interp, ...);
/* 71 */
EXTERN Tcl_AsyncHandler Tcl_AsyncCreate(Tcl_AsyncProc *proc,
- ClientData clientData);
+ void *clientData);
/* 72 */
EXTERN void Tcl_AsyncDelete(Tcl_AsyncHandler async);
/* 73 */
@@ -270,23 +242,18 @@ EXTERN int Tcl_AsyncInvoke(Tcl_Interp *interp, int code);
EXTERN void Tcl_AsyncMark(Tcl_AsyncHandler async);
/* 75 */
EXTERN int Tcl_AsyncReady(void);
-/* 76 */
-TCL_DEPRECATED("No longer in use, changed to macro")
-void Tcl_BackgroundError(Tcl_Interp *interp);
-/* 77 */
-TCL_DEPRECATED("Use Tcl_UtfBackslash")
-char Tcl_Backslash(const char *src, int *readPtr);
+/* Slot 76 is reserved */
+/* Slot 77 is reserved */
/* 78 */
EXTERN int Tcl_BadChannelOption(Tcl_Interp *interp,
const char *optionName,
const char *optionList);
/* 79 */
EXTERN void Tcl_CallWhenDeleted(Tcl_Interp *interp,
- Tcl_InterpDeleteProc *proc,
- ClientData clientData);
+ Tcl_InterpDeleteProc *proc, void *clientData);
/* 80 */
EXTERN void Tcl_CancelIdleCall(Tcl_IdleProc *idleProc,
- ClientData clientData);
+ void *clientData);
/* 81 */
EXTERN int Tcl_Close(Tcl_Interp *interp, Tcl_Channel chan);
/* 82 */
@@ -294,11 +261,11 @@ EXTERN int Tcl_CommandComplete(const char *cmd);
/* 83 */
EXTERN char * Tcl_Concat(int argc, const char *const *argv);
/* 84 */
-EXTERN int Tcl_ConvertElement(const char *src, char *dst,
+EXTERN size_t Tcl_ConvertElement(const char *src, char *dst,
int flags);
/* 85 */
-EXTERN int Tcl_ConvertCountedElement(const char *src,
- int length, char *dst, int flags);
+EXTERN size_t Tcl_ConvertCountedElement(const char *src,
+ size_t length, char *dst, int flags);
/* 86 */
EXTERN int Tcl_CreateAlias(Tcl_Interp *slave,
const char *slaveCmd, Tcl_Interp *target,
@@ -311,58 +278,52 @@ EXTERN int Tcl_CreateAliasObj(Tcl_Interp *slave,
Tcl_Obj *const objv[]);
/* 88 */
EXTERN Tcl_Channel Tcl_CreateChannel(const Tcl_ChannelType *typePtr,
- const char *chanName,
- ClientData instanceData, int mask);
+ const char *chanName, void *instanceData,
+ int mask);
/* 89 */
EXTERN void Tcl_CreateChannelHandler(Tcl_Channel chan, int mask,
- Tcl_ChannelProc *proc, ClientData clientData);
+ Tcl_ChannelProc *proc, void *clientData);
/* 90 */
EXTERN void Tcl_CreateCloseHandler(Tcl_Channel chan,
- Tcl_CloseProc *proc, ClientData clientData);
+ Tcl_CloseProc *proc, void *clientData);
/* 91 */
EXTERN Tcl_Command Tcl_CreateCommand(Tcl_Interp *interp,
const char *cmdName, Tcl_CmdProc *proc,
- ClientData clientData,
+ void *clientData,
Tcl_CmdDeleteProc *deleteProc);
/* 92 */
EXTERN void Tcl_CreateEventSource(Tcl_EventSetupProc *setupProc,
Tcl_EventCheckProc *checkProc,
- ClientData clientData);
+ void *clientData);
/* 93 */
EXTERN void Tcl_CreateExitHandler(Tcl_ExitProc *proc,
- ClientData clientData);
+ void *clientData);
/* 94 */
EXTERN Tcl_Interp * Tcl_CreateInterp(void);
-/* 95 */
-TCL_DEPRECATED("")
-void Tcl_CreateMathFunc(Tcl_Interp *interp,
- const char *name, int numArgs,
- Tcl_ValueType *argTypes, Tcl_MathProc *proc,
- ClientData clientData);
+/* Slot 95 is reserved */
/* 96 */
EXTERN Tcl_Command Tcl_CreateObjCommand(Tcl_Interp *interp,
const char *cmdName, Tcl_ObjCmdProc *proc,
- ClientData clientData,
+ void *clientData,
Tcl_CmdDeleteProc *deleteProc);
/* 97 */
EXTERN Tcl_Interp * Tcl_CreateSlave(Tcl_Interp *interp,
const char *slaveName, int isSafe);
/* 98 */
EXTERN Tcl_TimerToken Tcl_CreateTimerHandler(int milliseconds,
- Tcl_TimerProc *proc, ClientData clientData);
+ Tcl_TimerProc *proc, void *clientData);
/* 99 */
EXTERN Tcl_Trace Tcl_CreateTrace(Tcl_Interp *interp, int level,
- Tcl_CmdTraceProc *proc,
- ClientData clientData);
+ Tcl_CmdTraceProc *proc, void *clientData);
/* 100 */
EXTERN void Tcl_DeleteAssocData(Tcl_Interp *interp,
const char *name);
/* 101 */
EXTERN void Tcl_DeleteChannelHandler(Tcl_Channel chan,
- Tcl_ChannelProc *proc, ClientData clientData);
+ Tcl_ChannelProc *proc, void *clientData);
/* 102 */
EXTERN void Tcl_DeleteCloseHandler(Tcl_Channel chan,
- Tcl_CloseProc *proc, ClientData clientData);
+ Tcl_CloseProc *proc, void *clientData);
/* 103 */
EXTERN int Tcl_DeleteCommand(Tcl_Interp *interp,
const char *cmdName);
@@ -371,14 +332,14 @@ EXTERN int Tcl_DeleteCommandFromToken(Tcl_Interp *interp,
Tcl_Command command);
/* 105 */
EXTERN void Tcl_DeleteEvents(Tcl_EventDeleteProc *proc,
- ClientData clientData);
+ void *clientData);
/* 106 */
EXTERN void Tcl_DeleteEventSource(Tcl_EventSetupProc *setupProc,
Tcl_EventCheckProc *checkProc,
- ClientData clientData);
+ void *clientData);
/* 107 */
EXTERN void Tcl_DeleteExitHandler(Tcl_ExitProc *proc,
- ClientData clientData);
+ void *clientData);
/* 108 */
EXTERN void Tcl_DeleteHashEntry(Tcl_HashEntry *entryPtr);
/* 109 */
@@ -393,16 +354,14 @@ EXTERN void Tcl_DeleteTimerHandler(Tcl_TimerToken token);
EXTERN void Tcl_DeleteTrace(Tcl_Interp *interp, Tcl_Trace trace);
/* 114 */
EXTERN void Tcl_DontCallWhenDeleted(Tcl_Interp *interp,
- Tcl_InterpDeleteProc *proc,
- ClientData clientData);
+ Tcl_InterpDeleteProc *proc, void *clientData);
/* 115 */
EXTERN int Tcl_DoOneEvent(int flags);
/* 116 */
-EXTERN void Tcl_DoWhenIdle(Tcl_IdleProc *proc,
- ClientData clientData);
+EXTERN void Tcl_DoWhenIdle(Tcl_IdleProc *proc, void *clientData);
/* 117 */
EXTERN char * Tcl_DStringAppend(Tcl_DString *dsPtr,
- const char *bytes, int length);
+ const char *bytes, size_t length);
/* 118 */
EXTERN char * Tcl_DStringAppendElement(Tcl_DString *dsPtr,
const char *element);
@@ -419,7 +378,8 @@ EXTERN void Tcl_DStringInit(Tcl_DString *dsPtr);
EXTERN void Tcl_DStringResult(Tcl_Interp *interp,
Tcl_DString *dsPtr);
/* 124 */
-EXTERN void Tcl_DStringSetLength(Tcl_DString *dsPtr, int length);
+EXTERN void Tcl_DStringSetLength(Tcl_DString *dsPtr,
+ size_t length);
/* 125 */
EXTERN void Tcl_DStringStartSublist(Tcl_DString *dsPtr);
/* 126 */
@@ -428,16 +388,13 @@ EXTERN int Tcl_Eof(Tcl_Channel chan);
EXTERN const char * Tcl_ErrnoId(void);
/* 128 */
EXTERN const char * Tcl_ErrnoMsg(int err);
-/* 129 */
-EXTERN int Tcl_Eval(Tcl_Interp *interp, const char *script);
+/* Slot 129 is reserved */
/* 130 */
EXTERN int Tcl_EvalFile(Tcl_Interp *interp,
const char *fileName);
-/* 131 */
-TCL_DEPRECATED("No longer in use, changed to macro")
-int Tcl_EvalObj(Tcl_Interp *interp, Tcl_Obj *objPtr);
+/* Slot 131 is reserved */
/* 132 */
-EXTERN void Tcl_EventuallyFree(ClientData clientData,
+EXTERN void Tcl_EventuallyFree(void *clientData,
Tcl_FreeProc *freeProc);
/* 133 */
EXTERN TCL_NORETURN void Tcl_Exit(int status);
@@ -470,8 +427,7 @@ EXTERN int Tcl_ExprObj(Tcl_Interp *interp, Tcl_Obj *objPtr,
EXTERN int Tcl_ExprString(Tcl_Interp *interp, const char *expr);
/* 143 */
EXTERN void Tcl_Finalize(void);
-/* 144 */
-EXTERN void Tcl_FindExecutable(const char *argv0);
+/* Slot 144 is reserved */
/* 145 */
EXTERN Tcl_HashEntry * Tcl_FirstHashEntry(Tcl_HashTable *tablePtr,
Tcl_HashSearch *searchPtr);
@@ -492,7 +448,7 @@ EXTERN int Tcl_GetAliasObj(Tcl_Interp *interp,
const char **targetCmdPtr, int *objcPtr,
Tcl_Obj ***objv);
/* 150 */
-EXTERN ClientData Tcl_GetAssocData(Tcl_Interp *interp,
+EXTERN void * Tcl_GetAssocData(Tcl_Interp *interp,
const char *name,
Tcl_InterpDeleteProc **procPtr);
/* 151 */
@@ -502,9 +458,9 @@ EXTERN Tcl_Channel Tcl_GetChannel(Tcl_Interp *interp,
EXTERN int Tcl_GetChannelBufferSize(Tcl_Channel chan);
/* 153 */
EXTERN int Tcl_GetChannelHandle(Tcl_Channel chan, int direction,
- ClientData *handlePtr);
+ void **handlePtr);
/* 154 */
-EXTERN ClientData Tcl_GetChannelInstanceData(Tcl_Channel chan);
+EXTERN void * Tcl_GetChannelInstanceData(Tcl_Channel chan);
/* 155 */
EXTERN int Tcl_GetChannelMode(Tcl_Channel chan);
/* 156 */
@@ -514,7 +470,7 @@ EXTERN int Tcl_GetChannelOption(Tcl_Interp *interp,
Tcl_Channel chan, const char *optionName,
Tcl_DString *dsPtr);
/* 158 */
-EXTERN CONST86 Tcl_ChannelType * Tcl_GetChannelType(Tcl_Channel chan);
+EXTERN const Tcl_ChannelType * Tcl_GetChannelType(Tcl_Channel chan);
/* 159 */
EXTERN int Tcl_GetCommandInfo(Tcl_Interp *interp,
const char *cmdName, Tcl_CmdInfo *infoPtr);
@@ -538,20 +494,20 @@ EXTERN Tcl_Obj * Tcl_GetObjResult(Tcl_Interp *interp);
/* 167 */
EXTERN int Tcl_GetOpenFile(Tcl_Interp *interp,
const char *chanID, int forWriting,
- int checkUsage, ClientData *filePtr);
+ int checkUsage, void **filePtr);
#endif /* UNIX */
#ifdef MAC_OSX_TCL /* MACOSX */
/* 167 */
EXTERN int Tcl_GetOpenFile(Tcl_Interp *interp,
const char *chanID, int forWriting,
- int checkUsage, ClientData *filePtr);
+ int checkUsage, void **filePtr);
#endif /* MACOSX */
/* 168 */
EXTERN Tcl_PathType Tcl_GetPathType(const char *path);
/* 169 */
-EXTERN int Tcl_Gets(Tcl_Channel chan, Tcl_DString *dsPtr);
+EXTERN size_t Tcl_Gets(Tcl_Channel chan, Tcl_DString *dsPtr);
/* 170 */
-EXTERN int Tcl_GetsObj(Tcl_Channel chan, Tcl_Obj *objPtr);
+EXTERN size_t Tcl_GetsObj(Tcl_Channel chan, Tcl_Obj *objPtr);
/* 171 */
EXTERN int Tcl_GetServiceMode(void);
/* 172 */
@@ -559,22 +515,13 @@ EXTERN Tcl_Interp * Tcl_GetSlave(Tcl_Interp *interp,
const char *slaveName);
/* 173 */
EXTERN Tcl_Channel Tcl_GetStdChannel(int type);
-/* 174 */
-EXTERN const char * Tcl_GetStringResult(Tcl_Interp *interp);
-/* 175 */
-TCL_DEPRECATED("No longer in use, changed to macro")
-const char * Tcl_GetVar(Tcl_Interp *interp, const char *varName,
- int flags);
+/* Slot 174 is reserved */
+/* Slot 175 is reserved */
/* 176 */
EXTERN const char * Tcl_GetVar2(Tcl_Interp *interp, const char *part1,
const char *part2, int flags);
-/* 177 */
-EXTERN int Tcl_GlobalEval(Tcl_Interp *interp,
- const char *command);
-/* 178 */
-TCL_DEPRECATED("No longer in use, changed to macro")
-int Tcl_GlobalEvalObj(Tcl_Interp *interp,
- Tcl_Obj *objPtr);
+/* Slot 177 is reserved */
+/* Slot 178 is reserved */
/* 179 */
EXTERN int Tcl_HideCommand(Tcl_Interp *interp,
const char *cmdName,
@@ -600,11 +547,11 @@ EXTERN int Tcl_LinkVar(Tcl_Interp *interp, const char *varName,
void *addr, int type);
/* Slot 188 is reserved */
/* 189 */
-EXTERN Tcl_Channel Tcl_MakeFileChannel(ClientData handle, int mode);
+EXTERN Tcl_Channel Tcl_MakeFileChannel(void *handle, int mode);
/* 190 */
EXTERN int Tcl_MakeSafe(Tcl_Interp *interp);
/* 191 */
-EXTERN Tcl_Channel Tcl_MakeTcpClientChannel(ClientData tcpSocket);
+EXTERN Tcl_Channel Tcl_MakeTcpClientChannel(void *tcpSocket);
/* 192 */
EXTERN char * Tcl_Merge(int argc, const char *const *argv);
/* 193 */
@@ -633,9 +580,9 @@ EXTERN Tcl_Channel Tcl_OpenTcpClient(Tcl_Interp *interp, int port,
EXTERN Tcl_Channel Tcl_OpenTcpServer(Tcl_Interp *interp, int port,
const char *host,
Tcl_TcpAcceptProc *acceptProc,
- ClientData callbackData);
+ void *callbackData);
/* 201 */
-EXTERN void Tcl_Preserve(ClientData data);
+EXTERN void Tcl_Preserve(void *data);
/* 202 */
EXTERN void Tcl_PrintDouble(Tcl_Interp *interp, double value,
char *dst);
@@ -647,7 +594,8 @@ EXTERN const char * Tcl_PosixError(Tcl_Interp *interp);
EXTERN void Tcl_QueueEvent(Tcl_Event *evPtr,
Tcl_QueuePosition position);
/* 206 */
-EXTERN int Tcl_Read(Tcl_Channel chan, char *bufPtr, int toRead);
+EXTERN size_t Tcl_Read(Tcl_Channel chan, char *bufPtr,
+ size_t toRead);
/* 207 */
EXTERN void Tcl_ReapDetachedProcs(void);
/* 208 */
@@ -671,20 +619,18 @@ EXTERN int Tcl_RegExpExec(Tcl_Interp *interp, Tcl_RegExp regexp,
EXTERN int Tcl_RegExpMatch(Tcl_Interp *interp, const char *text,
const char *pattern);
/* 215 */
-EXTERN void Tcl_RegExpRange(Tcl_RegExp regexp, int index,
+EXTERN void Tcl_RegExpRange(Tcl_RegExp regexp, size_t index,
const char **startPtr, const char **endPtr);
/* 216 */
-EXTERN void Tcl_Release(ClientData clientData);
+EXTERN void Tcl_Release(void *clientData);
/* 217 */
EXTERN void Tcl_ResetResult(Tcl_Interp *interp);
/* 218 */
-EXTERN int Tcl_ScanElement(const char *src, int *flagPtr);
+EXTERN size_t Tcl_ScanElement(const char *src, int *flagPtr);
/* 219 */
-EXTERN int Tcl_ScanCountedElement(const char *src, int length,
- int *flagPtr);
-/* 220 */
-TCL_DEPRECATED("")
-int Tcl_SeekOld(Tcl_Channel chan, int offset, int mode);
+EXTERN size_t Tcl_ScanCountedElement(const char *src,
+ size_t length, int *flagPtr);
+/* Slot 220 is reserved */
/* 221 */
EXTERN int Tcl_ServiceAll(void);
/* 222 */
@@ -692,7 +638,7 @@ EXTERN int Tcl_ServiceEvent(int flags);
/* 223 */
EXTERN void Tcl_SetAssocData(Tcl_Interp *interp,
const char *name, Tcl_InterpDeleteProc *proc,
- ClientData clientData);
+ void *clientData);
/* 224 */
EXTERN void Tcl_SetChannelBufferSize(Tcl_Channel chan, int sz);
/* 225 */
@@ -709,14 +655,10 @@ EXTERN void Tcl_SetErrno(int err);
EXTERN void Tcl_SetErrorCode(Tcl_Interp *interp, ...);
/* 229 */
EXTERN void Tcl_SetMaxBlockTime(const Tcl_Time *timePtr);
-/* 230 */
-EXTERN void Tcl_SetPanicProc(
- TCL_NORETURN1 Tcl_PanicProc *panicProc);
+/* Slot 230 is reserved */
/* 231 */
EXTERN int Tcl_SetRecursionLimit(Tcl_Interp *interp, int depth);
-/* 232 */
-EXTERN void Tcl_SetResult(Tcl_Interp *interp, char *result,
- Tcl_FreeProc *freeProc);
+/* Slot 232 is reserved */
/* 233 */
EXTERN int Tcl_SetServiceMode(int mode);
/* 234 */
@@ -727,10 +669,7 @@ EXTERN void Tcl_SetObjResult(Tcl_Interp *interp,
Tcl_Obj *resultObjPtr);
/* 236 */
EXTERN void Tcl_SetStdChannel(Tcl_Channel channel, int type);
-/* 237 */
-TCL_DEPRECATED("No longer in use, changed to macro")
-const char * Tcl_SetVar(Tcl_Interp *interp, const char *varName,
- const char *newValue, int flags);
+/* Slot 237 is reserved */
/* 238 */
EXTERN const char * Tcl_SetVar2(Tcl_Interp *interp, const char *part1,
const char *part2, const char *newValue,
@@ -748,84 +687,55 @@ EXTERN int Tcl_SplitList(Tcl_Interp *interp,
/* 243 */
EXTERN void Tcl_SplitPath(const char *path, int *argcPtr,
const char ***argvPtr);
-/* 244 */
-EXTERN void Tcl_StaticPackage(Tcl_Interp *interp,
- const char *pkgName,
- Tcl_PackageInitProc *initProc,
- Tcl_PackageInitProc *safeInitProc);
-/* 245 */
-TCL_DEPRECATED("No longer in use, changed to macro")
-int Tcl_StringMatch(const char *str, const char *pattern);
-/* 246 */
-TCL_DEPRECATED("")
-int Tcl_TellOld(Tcl_Channel chan);
-/* 247 */
-TCL_DEPRECATED("No longer in use, changed to macro")
-int Tcl_TraceVar(Tcl_Interp *interp, const char *varName,
- int flags, Tcl_VarTraceProc *proc,
- ClientData clientData);
+/* Slot 244 is reserved */
+/* Slot 245 is reserved */
+/* Slot 246 is reserved */
+/* Slot 247 is reserved */
/* 248 */
EXTERN int Tcl_TraceVar2(Tcl_Interp *interp, const char *part1,
const char *part2, int flags,
- Tcl_VarTraceProc *proc,
- ClientData clientData);
+ Tcl_VarTraceProc *proc, void *clientData);
/* 249 */
EXTERN char * Tcl_TranslateFileName(Tcl_Interp *interp,
const char *name, Tcl_DString *bufferPtr);
/* 250 */
-EXTERN int Tcl_Ungets(Tcl_Channel chan, const char *str,
- int len, int atHead);
+EXTERN size_t Tcl_Ungets(Tcl_Channel chan, const char *str,
+ size_t len, int atHead);
/* 251 */
EXTERN void Tcl_UnlinkVar(Tcl_Interp *interp,
const char *varName);
/* 252 */
EXTERN int Tcl_UnregisterChannel(Tcl_Interp *interp,
Tcl_Channel chan);
-/* 253 */
-TCL_DEPRECATED("No longer in use, changed to macro")
-int Tcl_UnsetVar(Tcl_Interp *interp, const char *varName,
- int flags);
+/* Slot 253 is reserved */
/* 254 */
EXTERN int Tcl_UnsetVar2(Tcl_Interp *interp, const char *part1,
const char *part2, int flags);
-/* 255 */
-TCL_DEPRECATED("No longer in use, changed to macro")
-void Tcl_UntraceVar(Tcl_Interp *interp,
- const char *varName, int flags,
- Tcl_VarTraceProc *proc,
- ClientData clientData);
+/* Slot 255 is reserved */
/* 256 */
EXTERN void Tcl_UntraceVar2(Tcl_Interp *interp,
const char *part1, const char *part2,
int flags, Tcl_VarTraceProc *proc,
- ClientData clientData);
+ void *clientData);
/* 257 */
EXTERN void Tcl_UpdateLinkedVar(Tcl_Interp *interp,
const char *varName);
-/* 258 */
-TCL_DEPRECATED("No longer in use, changed to macro")
-int Tcl_UpVar(Tcl_Interp *interp, const char *frameName,
- const char *varName, const char *localName,
- int flags);
+/* Slot 258 is reserved */
/* 259 */
EXTERN int Tcl_UpVar2(Tcl_Interp *interp, const char *frameName,
const char *part1, const char *part2,
const char *localName, int flags);
/* 260 */
EXTERN int Tcl_VarEval(Tcl_Interp *interp, ...);
-/* 261 */
-TCL_DEPRECATED("No longer in use, changed to macro")
-ClientData Tcl_VarTraceInfo(Tcl_Interp *interp,
- const char *varName, int flags,
- Tcl_VarTraceProc *procPtr,
- ClientData prevClientData);
+/* Slot 261 is reserved */
/* 262 */
-EXTERN ClientData Tcl_VarTraceInfo2(Tcl_Interp *interp,
+EXTERN void * Tcl_VarTraceInfo2(Tcl_Interp *interp,
const char *part1, const char *part2,
int flags, Tcl_VarTraceProc *procPtr,
- ClientData prevClientData);
+ void *prevClientData);
/* 263 */
-EXTERN int Tcl_Write(Tcl_Channel chan, const char *s, int slen);
+EXTERN size_t Tcl_Write(Tcl_Channel chan, const char *s,
+ size_t slen);
/* 264 */
EXTERN void Tcl_WrongNumArgs(Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[], const char *message);
@@ -833,47 +743,25 @@ EXTERN void Tcl_WrongNumArgs(Tcl_Interp *interp, int objc,
EXTERN int Tcl_DumpActiveMemory(const char *fileName);
/* 266 */
EXTERN void Tcl_ValidateAllMemory(const char *file, int line);
-/* 267 */
-TCL_DEPRECATED("see TIP #422")
-void Tcl_AppendResultVA(Tcl_Interp *interp,
- va_list argList);
-/* 268 */
-TCL_DEPRECATED("see TIP #422")
-void Tcl_AppendStringsToObjVA(Tcl_Obj *objPtr,
- va_list argList);
+/* Slot 267 is reserved */
+/* Slot 268 is reserved */
/* 269 */
EXTERN char * Tcl_HashStats(Tcl_HashTable *tablePtr);
/* 270 */
EXTERN const char * Tcl_ParseVar(Tcl_Interp *interp, const char *start,
const char **termPtr);
-/* 271 */
-TCL_DEPRECATED("No longer in use, changed to macro")
-const char * Tcl_PkgPresent(Tcl_Interp *interp, const char *name,
- const char *version, int exact);
+/* Slot 271 is reserved */
/* 272 */
EXTERN const char * Tcl_PkgPresentEx(Tcl_Interp *interp,
const char *name, const char *version,
int exact, void *clientDataPtr);
-/* 273 */
-TCL_DEPRECATED("No longer in use, changed to macro")
-int Tcl_PkgProvide(Tcl_Interp *interp, const char *name,
- const char *version);
-/* 274 */
-TCL_DEPRECATED("No longer in use, changed to macro")
-const char * Tcl_PkgRequire(Tcl_Interp *interp, const char *name,
- const char *version, int exact);
-/* 275 */
-TCL_DEPRECATED("see TIP #422")
-void Tcl_SetErrorCodeVA(Tcl_Interp *interp,
- va_list argList);
-/* 276 */
-TCL_DEPRECATED("see TIP #422")
-int Tcl_VarEvalVA(Tcl_Interp *interp, va_list argList);
+/* Slot 273 is reserved */
+/* Slot 274 is reserved */
+/* Slot 275 is reserved */
+/* Slot 276 is reserved */
/* 277 */
EXTERN Tcl_Pid Tcl_WaitPid(Tcl_Pid pid, int *statPtr, int options);
-/* 278 */
-TCL_DEPRECATED("see TIP #422")
-TCL_NORETURN void Tcl_PanicVA(const char *format, va_list argList);
+/* Slot 278 is reserved */
/* 279 */
EXTERN void Tcl_GetVersion(int *major, int *minor,
int *patchLevel, int *type);
@@ -882,7 +770,7 @@ EXTERN void Tcl_InitMemory(Tcl_Interp *interp);
/* 281 */
EXTERN Tcl_Channel Tcl_StackChannel(Tcl_Interp *interp,
const Tcl_ChannelType *typePtr,
- ClientData instanceData, int mask,
+ void *instanceData, int mask,
Tcl_Channel prevChan);
/* 282 */
EXTERN int Tcl_UnstackChannel(Tcl_Interp *interp,
@@ -899,15 +787,14 @@ EXTERN void Tcl_AppendObjToObj(Tcl_Obj *objPtr,
EXTERN Tcl_Encoding Tcl_CreateEncoding(const Tcl_EncodingType *typePtr);
/* 288 */
EXTERN void Tcl_CreateThreadExitHandler(Tcl_ExitProc *proc,
- ClientData clientData);
+ void *clientData);
/* 289 */
EXTERN void Tcl_DeleteThreadExitHandler(Tcl_ExitProc *proc,
- ClientData clientData);
-/* 290 */
-EXTERN void Tcl_DiscardResult(Tcl_SavedResult *statePtr);
+ void *clientData);
+/* Slot 290 is reserved */
/* 291 */
EXTERN int Tcl_EvalEx(Tcl_Interp *interp, const char *script,
- int numBytes, int flags);
+ size_t numBytes, int flags);
/* 292 */
EXTERN int Tcl_EvalObjv(Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[], int flags);
@@ -919,18 +806,18 @@ EXTERN TCL_NORETURN void Tcl_ExitThread(int status);
/* 295 */
EXTERN int Tcl_ExternalToUtf(Tcl_Interp *interp,
Tcl_Encoding encoding, const char *src,
- int srcLen, int flags,
+ size_t srcLen, int flags,
Tcl_EncodingState *statePtr, char *dst,
- int dstLen, int *srcReadPtr,
+ size_t dstLen, int *srcReadPtr,
int *dstWrotePtr, int *dstCharsPtr);
/* 296 */
EXTERN char * Tcl_ExternalToUtfDString(Tcl_Encoding encoding,
- const char *src, int srcLen,
+ const char *src, size_t srcLen,
Tcl_DString *dsPtr);
/* 297 */
EXTERN void Tcl_FinalizeThread(void);
/* 298 */
-EXTERN void Tcl_FinalizeNotifier(ClientData clientData);
+EXTERN void Tcl_FinalizeNotifier(void *clientData);
/* 299 */
EXTERN void Tcl_FreeEncoding(Tcl_Encoding encoding);
/* 300 */
@@ -944,16 +831,16 @@ EXTERN void Tcl_GetEncodingNames(Tcl_Interp *interp);
/* 304 */
EXTERN int Tcl_GetIndexFromObjStruct(Tcl_Interp *interp,
Tcl_Obj *objPtr, const void *tablePtr,
- int offset, const char *msg, int flags,
+ size_t offset, const char *msg, int flags,
int *indexPtr);
/* 305 */
EXTERN void * Tcl_GetThreadData(Tcl_ThreadDataKey *keyPtr,
- int size);
+ size_t size);
/* 306 */
EXTERN Tcl_Obj * Tcl_GetVar2Ex(Tcl_Interp *interp, const char *part1,
const char *part2, int flags);
/* 307 */
-EXTERN ClientData Tcl_InitNotifier(void);
+EXTERN void * Tcl_InitNotifier(void);
/* 308 */
EXTERN void Tcl_MutexLock(Tcl_Mutex *mutexPtr);
/* 309 */
@@ -964,16 +851,12 @@ EXTERN void Tcl_ConditionNotify(Tcl_Condition *condPtr);
EXTERN void Tcl_ConditionWait(Tcl_Condition *condPtr,
Tcl_Mutex *mutexPtr, const Tcl_Time *timePtr);
/* 312 */
-EXTERN int Tcl_NumUtfChars(const char *src, int length);
+EXTERN size_t Tcl_NumUtfChars(const char *src, size_t length);
/* 313 */
-EXTERN int Tcl_ReadChars(Tcl_Channel channel, Tcl_Obj *objPtr,
- int charsToRead, int appendFlag);
-/* 314 */
-EXTERN void Tcl_RestoreResult(Tcl_Interp *interp,
- Tcl_SavedResult *statePtr);
-/* 315 */
-EXTERN void Tcl_SaveResult(Tcl_Interp *interp,
- Tcl_SavedResult *statePtr);
+EXTERN size_t Tcl_ReadChars(Tcl_Channel channel, Tcl_Obj *objPtr,
+ size_t charsToRead, int appendFlag);
+/* Slot 314 is reserved */
+/* Slot 315 is reserved */
/* 316 */
EXTERN int Tcl_SetSystemEncoding(Tcl_Interp *interp,
const char *name);
@@ -987,7 +870,7 @@ EXTERN void Tcl_ThreadAlert(Tcl_ThreadId threadId);
EXTERN void Tcl_ThreadQueueEvent(Tcl_ThreadId threadId,
Tcl_Event *evPtr, Tcl_QueuePosition position);
/* 320 */
-EXTERN int Tcl_UniCharAtIndex(const char *src, int index);
+EXTERN int Tcl_UniCharAtIndex(const char *src, size_t index);
/* 321 */
EXTERN int Tcl_UniCharToLower(int ch);
/* 322 */
@@ -997,11 +880,11 @@ EXTERN int Tcl_UniCharToUpper(int ch);
/* 324 */
EXTERN int Tcl_UniCharToUtf(int ch, char *buf);
/* 325 */
-EXTERN const char * Tcl_UtfAtIndex(const char *src, int index);
+EXTERN const char * Tcl_UtfAtIndex(const char *src, size_t index);
/* 326 */
-EXTERN int Tcl_UtfCharComplete(const char *src, int length);
+EXTERN int Tcl_UtfCharComplete(const char *src, size_t length);
/* 327 */
-EXTERN int Tcl_UtfBackslash(const char *src, int *readPtr,
+EXTERN size_t Tcl_UtfBackslash(const char *src, int *readPtr,
char *dst);
/* 328 */
EXTERN const char * Tcl_UtfFindFirst(const char *src, int ch);
@@ -1014,13 +897,13 @@ EXTERN const char * Tcl_UtfPrev(const char *src, const char *start);
/* 332 */
EXTERN int Tcl_UtfToExternal(Tcl_Interp *interp,
Tcl_Encoding encoding, const char *src,
- int srcLen, int flags,
+ size_t srcLen, int flags,
Tcl_EncodingState *statePtr, char *dst,
- int dstLen, int *srcReadPtr,
+ size_t dstLen, int *srcReadPtr,
int *dstWrotePtr, int *dstCharsPtr);
/* 333 */
EXTERN char * Tcl_UtfToExternalDString(Tcl_Encoding encoding,
- const char *src, int srcLen,
+ const char *src, size_t srcLen,
Tcl_DString *dsPtr);
/* 334 */
EXTERN int Tcl_UtfToLower(char *src);
@@ -1031,20 +914,16 @@ EXTERN int Tcl_UtfToUniChar(const char *src, Tcl_UniChar *chPtr);
/* 337 */
EXTERN int Tcl_UtfToUpper(char *src);
/* 338 */
-EXTERN int Tcl_WriteChars(Tcl_Channel chan, const char *src,
- int srcLen);
+EXTERN size_t Tcl_WriteChars(Tcl_Channel chan, const char *src,
+ size_t srcLen);
/* 339 */
-EXTERN int Tcl_WriteObj(Tcl_Channel chan, Tcl_Obj *objPtr);
+EXTERN size_t Tcl_WriteObj(Tcl_Channel chan, Tcl_Obj *objPtr);
/* 340 */
EXTERN char * Tcl_GetString(Tcl_Obj *objPtr);
-/* 341 */
-TCL_DEPRECATED("Use Tcl_GetEncodingSearchPath")
-const char * Tcl_GetDefaultEncodingDir(void);
-/* 342 */
-TCL_DEPRECATED("Use Tcl_SetEncodingSearchPath")
-void Tcl_SetDefaultEncodingDir(const char *path);
+/* Slot 341 is reserved */
+/* Slot 342 is reserved */
/* 343 */
-EXTERN void Tcl_AlertNotifier(ClientData clientData);
+EXTERN void Tcl_AlertNotifier(void *clientData);
/* 344 */
EXTERN void Tcl_ServiceModeHook(int mode);
/* 345 */
@@ -1062,50 +941,46 @@ EXTERN int Tcl_UniCharIsUpper(int ch);
/* 351 */
EXTERN int Tcl_UniCharIsWordChar(int ch);
/* 352 */
-EXTERN int Tcl_UniCharLen(const Tcl_UniChar *uniStr);
+EXTERN size_t Tcl_UniCharLen(const Tcl_UniChar *uniStr);
/* 353 */
EXTERN int Tcl_UniCharNcmp(const Tcl_UniChar *ucs,
- const Tcl_UniChar *uct,
- unsigned long numChars);
+ const Tcl_UniChar *uct, size_t numChars);
/* 354 */
EXTERN char * Tcl_UniCharToUtfDString(const Tcl_UniChar *uniStr,
- int uniLength, Tcl_DString *dsPtr);
+ size_t uniLength, Tcl_DString *dsPtr);
/* 355 */
-EXTERN Tcl_UniChar * Tcl_UtfToUniCharDString(const char *src, int length,
- Tcl_DString *dsPtr);
+EXTERN Tcl_UniChar * Tcl_UtfToUniCharDString(const char *src,
+ size_t length, Tcl_DString *dsPtr);
/* 356 */
EXTERN Tcl_RegExp Tcl_GetRegExpFromObj(Tcl_Interp *interp,
Tcl_Obj *patObj, int flags);
-/* 357 */
-TCL_DEPRECATED("Use Tcl_EvalTokensStandard")
-Tcl_Obj * Tcl_EvalTokens(Tcl_Interp *interp,
- Tcl_Token *tokenPtr, int count);
+/* Slot 357 is reserved */
/* 358 */
EXTERN void Tcl_FreeParse(Tcl_Parse *parsePtr);
/* 359 */
EXTERN void Tcl_LogCommandInfo(Tcl_Interp *interp,
const char *script, const char *command,
- int length);
+ size_t length);
/* 360 */
EXTERN int Tcl_ParseBraces(Tcl_Interp *interp,
- const char *start, int numBytes,
+ const char *start, size_t numBytes,
Tcl_Parse *parsePtr, int append,
const char **termPtr);
/* 361 */
EXTERN int Tcl_ParseCommand(Tcl_Interp *interp,
- const char *start, int numBytes, int nested,
- Tcl_Parse *parsePtr);
+ const char *start, size_t numBytes,
+ int nested, Tcl_Parse *parsePtr);
/* 362 */
EXTERN int Tcl_ParseExpr(Tcl_Interp *interp, const char *start,
- int numBytes, Tcl_Parse *parsePtr);
+ size_t numBytes, Tcl_Parse *parsePtr);
/* 363 */
EXTERN int Tcl_ParseQuotedString(Tcl_Interp *interp,
- const char *start, int numBytes,
+ const char *start, size_t numBytes,
Tcl_Parse *parsePtr, int append,
const char **termPtr);
/* 364 */
EXTERN int Tcl_ParseVarName(Tcl_Interp *interp,
- const char *start, int numBytes,
+ const char *start, size_t numBytes,
Tcl_Parse *parsePtr, int append);
/* 365 */
EXTERN char * Tcl_GetCwd(Tcl_Interp *interp, Tcl_DString *cwdPtr);
@@ -1116,11 +991,10 @@ EXTERN int Tcl_Access(const char *path, int mode);
/* 368 */
EXTERN int Tcl_Stat(const char *path, struct stat *bufPtr);
/* 369 */
-EXTERN int Tcl_UtfNcmp(const char *s1, const char *s2,
- unsigned long n);
+EXTERN int Tcl_UtfNcmp(const char *s1, const char *s2, size_t n);
/* 370 */
EXTERN int Tcl_UtfNcasecmp(const char *s1, const char *s2,
- unsigned long n);
+ size_t n);
/* 371 */
EXTERN int Tcl_StringCaseMatch(const char *str,
const char *pattern, int nocase);
@@ -1135,28 +1009,27 @@ EXTERN int Tcl_UniCharIsPunct(int ch);
/* 376 */
EXTERN int Tcl_RegExpExecObj(Tcl_Interp *interp,
Tcl_RegExp regexp, Tcl_Obj *textObj,
- int offset, int nmatches, int flags);
+ size_t offset, size_t nmatches, int flags);
/* 377 */
EXTERN void Tcl_RegExpGetInfo(Tcl_RegExp regexp,
Tcl_RegExpInfo *infoPtr);
/* 378 */
EXTERN Tcl_Obj * Tcl_NewUnicodeObj(const Tcl_UniChar *unicode,
- int numChars);
+ size_t numChars);
/* 379 */
EXTERN void Tcl_SetUnicodeObj(Tcl_Obj *objPtr,
- const Tcl_UniChar *unicode, int numChars);
+ const Tcl_UniChar *unicode, size_t numChars);
/* 380 */
-EXTERN int Tcl_GetCharLength(Tcl_Obj *objPtr);
+EXTERN size_t Tcl_GetCharLength(Tcl_Obj *objPtr);
/* 381 */
-EXTERN int Tcl_GetUniChar(Tcl_Obj *objPtr, int index);
-/* 382 */
-TCL_DEPRECATED("No longer in use, changed to macro")
-Tcl_UniChar * Tcl_GetUnicode(Tcl_Obj *objPtr);
+EXTERN int Tcl_GetUniChar(Tcl_Obj *objPtr, size_t index);
+/* Slot 382 is reserved */
/* 383 */
-EXTERN Tcl_Obj * Tcl_GetRange(Tcl_Obj *objPtr, int first, int last);
+EXTERN Tcl_Obj * Tcl_GetRange(Tcl_Obj *objPtr, size_t first,
+ size_t last);
/* 384 */
EXTERN void Tcl_AppendUnicodeToObj(Tcl_Obj *objPtr,
- const Tcl_UniChar *unicode, int length);
+ const Tcl_UniChar *unicode, size_t length);
/* 385 */
EXTERN int Tcl_RegExpMatchObj(Tcl_Interp *interp,
Tcl_Obj *textObj, Tcl_Obj *patternObj);
@@ -1170,24 +1043,22 @@ EXTERN int Tcl_GetChannelNames(Tcl_Interp *interp);
EXTERN int Tcl_GetChannelNamesEx(Tcl_Interp *interp,
const char *pattern);
/* 390 */
-EXTERN int Tcl_ProcObjCmd(ClientData clientData,
- Tcl_Interp *interp, int objc,
- Tcl_Obj *const objv[]);
+EXTERN int Tcl_ProcObjCmd(void *clientData, Tcl_Interp *interp,
+ int objc, Tcl_Obj *const objv[]);
/* 391 */
EXTERN void Tcl_ConditionFinalize(Tcl_Condition *condPtr);
/* 392 */
EXTERN void Tcl_MutexFinalize(Tcl_Mutex *mutex);
/* 393 */
EXTERN int Tcl_CreateThread(Tcl_ThreadId *idPtr,
- Tcl_ThreadCreateProc *proc,
- ClientData clientData, int stackSize,
- int flags);
+ Tcl_ThreadCreateProc *proc, void *clientData,
+ size_t stackSize, int flags);
/* 394 */
-EXTERN int Tcl_ReadRaw(Tcl_Channel chan, char *dst,
- int bytesToRead);
+EXTERN size_t Tcl_ReadRaw(Tcl_Channel chan, char *dst,
+ size_t bytesToRead);
/* 395 */
-EXTERN int Tcl_WriteRaw(Tcl_Channel chan, const char *src,
- int srcLen);
+EXTERN size_t Tcl_WriteRaw(Tcl_Channel chan, const char *src,
+ size_t srcLen);
/* 396 */
EXTERN Tcl_Channel Tcl_GetTopChannel(Tcl_Channel chan);
/* 397 */
@@ -1250,65 +1121,50 @@ EXTERN void Tcl_ClearChannelHandlers(Tcl_Channel channel);
EXTERN int Tcl_IsChannelExisting(const char *channelName);
/* 419 */
EXTERN int Tcl_UniCharNcasecmp(const Tcl_UniChar *ucs,
- const Tcl_UniChar *uct,
- unsigned long numChars);
+ const Tcl_UniChar *uct, size_t numChars);
/* 420 */
EXTERN int Tcl_UniCharCaseMatch(const Tcl_UniChar *uniStr,
const Tcl_UniChar *uniPattern, int nocase);
-/* 421 */
-EXTERN Tcl_HashEntry * Tcl_FindHashEntry(Tcl_HashTable *tablePtr,
- const void *key);
-/* 422 */
-EXTERN Tcl_HashEntry * Tcl_CreateHashEntry(Tcl_HashTable *tablePtr,
- const void *key, int *newPtr);
+/* Slot 421 is reserved */
+/* Slot 422 is reserved */
/* 423 */
EXTERN void Tcl_InitCustomHashTable(Tcl_HashTable *tablePtr,
int keyType, const Tcl_HashKeyType *typePtr);
/* 424 */
EXTERN void Tcl_InitObjHashTable(Tcl_HashTable *tablePtr);
/* 425 */
-EXTERN ClientData Tcl_CommandTraceInfo(Tcl_Interp *interp,
+EXTERN void * Tcl_CommandTraceInfo(Tcl_Interp *interp,
const char *varName, int flags,
Tcl_CommandTraceProc *procPtr,
- ClientData prevClientData);
+ void *prevClientData);
/* 426 */
EXTERN int Tcl_TraceCommand(Tcl_Interp *interp,
const char *varName, int flags,
- Tcl_CommandTraceProc *proc,
- ClientData clientData);
+ Tcl_CommandTraceProc *proc, void *clientData);
/* 427 */
EXTERN void Tcl_UntraceCommand(Tcl_Interp *interp,
const char *varName, int flags,
- Tcl_CommandTraceProc *proc,
- ClientData clientData);
+ Tcl_CommandTraceProc *proc, void *clientData);
/* 428 */
-EXTERN char * Tcl_AttemptAlloc(unsigned int size);
+EXTERN void * Tcl_AttemptAlloc(size_t size);
/* 429 */
-EXTERN char * Tcl_AttemptDbCkalloc(unsigned int size,
- const char *file, int line);
+EXTERN void * Tcl_AttemptDbCkalloc(size_t size, const char *file,
+ int line);
/* 430 */
-EXTERN char * Tcl_AttemptRealloc(char *ptr, unsigned int size);
+EXTERN void * Tcl_AttemptRealloc(void *ptr, size_t size);
/* 431 */
-EXTERN char * Tcl_AttemptDbCkrealloc(char *ptr, unsigned int size,
+EXTERN void * Tcl_AttemptDbCkrealloc(void *ptr, size_t size,
const char *file, int line);
/* 432 */
-EXTERN int Tcl_AttemptSetObjLength(Tcl_Obj *objPtr, int length);
+EXTERN int Tcl_AttemptSetObjLength(Tcl_Obj *objPtr,
+ size_t length);
/* 433 */
EXTERN Tcl_ThreadId Tcl_GetChannelThread(Tcl_Channel channel);
/* 434 */
EXTERN Tcl_UniChar * Tcl_GetUnicodeFromObj(Tcl_Obj *objPtr,
int *lengthPtr);
-/* 435 */
-TCL_DEPRECATED("")
-int Tcl_GetMathFuncInfo(Tcl_Interp *interp,
- const char *name, int *numArgsPtr,
- Tcl_ValueType **argTypesPtr,
- Tcl_MathProc **procPtr,
- ClientData *clientDataPtr);
-/* 436 */
-TCL_DEPRECATED("")
-Tcl_Obj * Tcl_ListMathFuncs(Tcl_Interp *interp,
- const char *pattern);
+/* Slot 435 is reserved */
+/* Slot 436 is reserved */
/* 437 */
EXTERN Tcl_Obj * Tcl_SubstObj(Tcl_Interp *interp, Tcl_Obj *objPtr,
int flags);
@@ -1358,7 +1214,7 @@ EXTERN int Tcl_FSFileAttrsGet(Tcl_Interp *interp, int index,
EXTERN int Tcl_FSFileAttrsSet(Tcl_Interp *interp, int index,
Tcl_Obj *pathPtr, Tcl_Obj *objPtr);
/* 453 */
-EXTERN const char *CONST86 * Tcl_FSFileAttrStrings(Tcl_Obj *pathPtr,
+EXTERN const char *const * Tcl_FSFileAttrStrings(Tcl_Obj *pathPtr,
Tcl_Obj **objPtrRef);
/* 454 */
EXTERN int Tcl_FSStat(Tcl_Obj *pathPtr, Tcl_StatBuf *buf);
@@ -1389,7 +1245,7 @@ EXTERN Tcl_Obj * Tcl_FSGetNormalizedPath(Tcl_Interp *interp,
EXTERN Tcl_Obj * Tcl_FSJoinToPath(Tcl_Obj *pathPtr, int objc,
Tcl_Obj *const objv[]);
/* 465 */
-EXTERN ClientData Tcl_FSGetInternalRep(Tcl_Obj *pathPtr,
+EXTERN void * Tcl_FSGetInternalRep(Tcl_Obj *pathPtr,
const Tcl_Filesystem *fsPtr);
/* 466 */
EXTERN Tcl_Obj * Tcl_FSGetTranslatedPath(Tcl_Interp *interp,
@@ -1399,7 +1255,7 @@ EXTERN int Tcl_FSEvalFile(Tcl_Interp *interp, Tcl_Obj *fileName);
/* 468 */
EXTERN Tcl_Obj * Tcl_FSNewNativePath(
const Tcl_Filesystem *fromFilesystem,
- ClientData clientData);
+ void *clientData);
/* 469 */
EXTERN const void * Tcl_FSGetNativePath(Tcl_Obj *pathPtr);
/* 470 */
@@ -1409,17 +1265,17 @@ EXTERN Tcl_Obj * Tcl_FSPathSeparator(Tcl_Obj *pathPtr);
/* 472 */
EXTERN Tcl_Obj * Tcl_FSListVolumes(void);
/* 473 */
-EXTERN int Tcl_FSRegister(ClientData clientData,
+EXTERN int Tcl_FSRegister(void *clientData,
const Tcl_Filesystem *fsPtr);
/* 474 */
EXTERN int Tcl_FSUnregister(const Tcl_Filesystem *fsPtr);
/* 475 */
-EXTERN ClientData Tcl_FSData(const Tcl_Filesystem *fsPtr);
+EXTERN void * Tcl_FSData(const Tcl_Filesystem *fsPtr);
/* 476 */
EXTERN const char * Tcl_FSGetTranslatedStringPath(Tcl_Interp *interp,
Tcl_Obj *pathPtr);
/* 477 */
-EXTERN CONST86 Tcl_Filesystem * Tcl_FSGetFileSystemForPath(Tcl_Obj *pathPtr);
+EXTERN const Tcl_Filesystem * Tcl_FSGetFileSystemForPath(Tcl_Obj *pathPtr);
/* 478 */
EXTERN Tcl_PathType Tcl_FSGetPathType(Tcl_Obj *pathPtr);
/* 479 */
@@ -1428,13 +1284,13 @@ EXTERN int Tcl_OutputBuffered(Tcl_Channel chan);
EXTERN void Tcl_FSMountsChanged(const Tcl_Filesystem *fsPtr);
/* 481 */
EXTERN int Tcl_EvalTokensStandard(Tcl_Interp *interp,
- Tcl_Token *tokenPtr, int count);
+ Tcl_Token *tokenPtr, size_t count);
/* 482 */
EXTERN void Tcl_GetTime(Tcl_Time *timeBuf);
/* 483 */
EXTERN Tcl_Trace Tcl_CreateObjTrace(Tcl_Interp *interp, int level,
int flags, Tcl_CmdObjTraceProc *objProc,
- ClientData clientData,
+ void *clientData,
Tcl_CmdObjTraceDeleteProc *delProc);
/* 484 */
EXTERN int Tcl_GetCommandInfoFromToken(Tcl_Command token,
@@ -1505,7 +1361,7 @@ EXTERN void Tcl_RegisterConfig(Tcl_Interp *interp,
const char *valEncoding);
/* 506 */
EXTERN Tcl_Namespace * Tcl_CreateNamespace(Tcl_Interp *interp,
- const char *name, ClientData clientData,
+ const char *name, void *clientData,
Tcl_NamespaceDeleteProc *deleteProc);
/* 507 */
EXTERN void Tcl_DeleteNamespace(Tcl_Namespace *nsPtr);
@@ -1541,17 +1397,16 @@ EXTERN void Tcl_GetCommandFullName(Tcl_Interp *interp,
/* 518 */
EXTERN int Tcl_FSEvalFileEx(Tcl_Interp *interp,
Tcl_Obj *fileName, const char *encodingName);
-/* 519 */
-EXTERN Tcl_ExitProc * Tcl_SetExitProc(TCL_NORETURN1 Tcl_ExitProc *proc);
+/* Slot 519 is reserved */
/* 520 */
EXTERN void Tcl_LimitAddHandler(Tcl_Interp *interp, int type,
Tcl_LimitHandlerProc *handlerProc,
- ClientData clientData,
+ void *clientData,
Tcl_LimitHandlerDeleteProc *deleteProc);
/* 521 */
EXTERN void Tcl_LimitRemoveHandler(Tcl_Interp *interp, int type,
Tcl_LimitHandlerProc *handlerProc,
- ClientData clientData);
+ void *clientData);
/* 522 */
EXTERN int Tcl_LimitReady(Tcl_Interp *interp);
/* 523 */
@@ -1634,11 +1489,11 @@ EXTERN int Tcl_GetEnsembleNamespace(Tcl_Interp *interp,
/* 552 */
EXTERN void Tcl_SetTimeProc(Tcl_GetTimeProc *getProc,
Tcl_ScaleTimeProc *scaleProc,
- ClientData clientData);
+ void *clientData);
/* 553 */
EXTERN void Tcl_QueryTimeProc(Tcl_GetTimeProc **getProc,
Tcl_ScaleTimeProc **scaleProc,
- ClientData *clientData);
+ void **clientData);
/* 554 */
EXTERN Tcl_DriverThreadActionProc * Tcl_ChannelThreadActionProc(
const Tcl_ChannelType *chanTypePtr);
@@ -1699,8 +1554,8 @@ EXTERN void Tcl_AppendObjToErrorInfo(Tcl_Interp *interp,
Tcl_Obj *objPtr);
/* 575 */
EXTERN void Tcl_AppendLimitedToObj(Tcl_Obj *objPtr,
- const char *bytes, int length, int limit,
- const char *ellipsis);
+ const char *bytes, size_t length,
+ size_t limit, const char *ellipsis);
/* 576 */
EXTERN Tcl_Obj * Tcl_Format(Tcl_Interp *interp, const char *format,
int objc, Tcl_Obj *const objv[]);
@@ -1715,7 +1570,7 @@ EXTERN void Tcl_AppendPrintfToObj(Tcl_Obj *objPtr,
const char *format, ...) TCL_FORMAT_PRINTF(2, 3);
/* 580 */
EXTERN int Tcl_CancelEval(Tcl_Interp *interp,
- Tcl_Obj *resultObjPtr, ClientData clientData,
+ Tcl_Obj *resultObjPtr, void *clientData,
int flags);
/* 581 */
EXTERN int Tcl_Canceled(Tcl_Interp *interp, int flags);
@@ -1726,8 +1581,7 @@ EXTERN int Tcl_CreatePipe(Tcl_Interp *interp,
/* 583 */
EXTERN Tcl_Command Tcl_NRCreateCommand(Tcl_Interp *interp,
const char *cmdName, Tcl_ObjCmdProc *proc,
- Tcl_ObjCmdProc *nreProc,
- ClientData clientData,
+ Tcl_ObjCmdProc *nreProc, void *clientData,
Tcl_CmdDeleteProc *deleteProc);
/* 584 */
EXTERN int Tcl_NREvalObj(Tcl_Interp *interp, Tcl_Obj *objPtr,
@@ -1740,14 +1594,12 @@ EXTERN int Tcl_NRCmdSwap(Tcl_Interp *interp, Tcl_Command cmd,
int objc, Tcl_Obj *const objv[], int flags);
/* 587 */
EXTERN void Tcl_NRAddCallback(Tcl_Interp *interp,
- Tcl_NRPostProc *postProcPtr,
- ClientData data0, ClientData data1,
- ClientData data2, ClientData data3);
+ Tcl_NRPostProc *postProcPtr, void *data0,
+ void *data1, void *data2, void *data3);
/* 588 */
EXTERN int Tcl_NRCallObjProc(Tcl_Interp *interp,
- Tcl_ObjCmdProc *objProc,
- ClientData clientData, int objc,
- Tcl_Obj *const objv[]);
+ Tcl_ObjCmdProc *objProc, void *clientData,
+ int objc, Tcl_Obj *const objv[]);
/* 589 */
EXTERN unsigned Tcl_GetFSDeviceFromStat(const Tcl_StatBuf *statPtr);
/* 590 */
@@ -1802,14 +1654,14 @@ EXTERN int Tcl_ZlibDeflate(Tcl_Interp *interp, int format,
Tcl_Obj *gzipHeaderDictObj);
/* 611 */
EXTERN int Tcl_ZlibInflate(Tcl_Interp *interp, int format,
- Tcl_Obj *data, int buffersize,
+ Tcl_Obj *data, size_t buffersize,
Tcl_Obj *gzipHeaderDictObj);
/* 612 */
EXTERN unsigned int Tcl_ZlibCRC32(unsigned int crc,
- const unsigned char *buf, int len);
+ const unsigned char *buf, size_t len);
/* 613 */
EXTERN unsigned int Tcl_ZlibAdler32(unsigned int adler,
- const unsigned char *buf, int len);
+ const unsigned char *buf, size_t len);
/* 614 */
EXTERN int Tcl_ZlibStreamInit(Tcl_Interp *interp, int mode,
int format, int level, Tcl_Obj *dictObj,
@@ -1825,7 +1677,7 @@ EXTERN int Tcl_ZlibStreamPut(Tcl_ZlibStream zshandle,
Tcl_Obj *data, int flush);
/* 619 */
EXTERN int Tcl_ZlibStreamGet(Tcl_ZlibStream zshandle,
- Tcl_Obj *data, int count);
+ Tcl_Obj *data, size_t count);
/* 620 */
EXTERN int Tcl_ZlibStreamClose(Tcl_ZlibStream zshandle);
/* 621 */
@@ -1863,7 +1715,7 @@ EXTERN Tcl_Channel Tcl_OpenTcpServerEx(Tcl_Interp *interp,
const char *service, const char *host,
unsigned int flags,
Tcl_TcpAcceptProc *acceptProc,
- ClientData callbackData);
+ void *callbackData);
/* 632 */
EXTERN int TclZipfs_Mount(Tcl_Interp *interp,
const char *mountPoint, const char *zipname,
@@ -1881,7 +1733,7 @@ EXTERN int TclZipfs_MountBuffer(Tcl_Interp *interp,
EXTERN void Tcl_FreeIntRep(Tcl_Obj *objPtr);
/* 637 */
EXTERN char * Tcl_InitStringRep(Tcl_Obj *objPtr, const char *bytes,
- unsigned int numBytes);
+ size_t numBytes);
/* 638 */
EXTERN Tcl_ObjIntRep * Tcl_FetchIntRep(Tcl_Obj *objPtr,
const Tcl_ObjType *typePtr);
@@ -1900,10 +1752,11 @@ EXTERN int Tcl_IsShared(Tcl_Obj *objPtr);
/* 644 */
EXTERN int Tcl_LinkArray(Tcl_Interp *interp,
const char *varName, void *addr, int type,
- int size);
+ size_t size);
/* 645 */
EXTERN int Tcl_GetIntForIndex(Tcl_Interp *interp,
- Tcl_Obj *objPtr, int endValue, int *indexPtr);
+ Tcl_Obj *objPtr, size_t endValue,
+ size_t *indexPtr);
typedef struct {
const struct TclPlatStubs *tclPlatStubs;
@@ -1918,20 +1771,20 @@ typedef struct TclStubs {
int (*tcl_PkgProvideEx) (Tcl_Interp *interp, const char *name, const char *version, const void *clientData); /* 0 */
const char * (*tcl_PkgRequireEx) (Tcl_Interp *interp, const char *name, const char *version, int exact, void *clientDataPtr); /* 1 */
TCL_NORETURN1 void (*tcl_Panic) (const char *format, ...) TCL_FORMAT_PRINTF(1, 2); /* 2 */
- char * (*tcl_Alloc) (unsigned int size); /* 3 */
- void (*tcl_Free) (char *ptr); /* 4 */
- char * (*tcl_Realloc) (char *ptr, unsigned int size); /* 5 */
- char * (*tcl_DbCkalloc) (unsigned int size, const char *file, int line); /* 6 */
- void (*tcl_DbCkfree) (char *ptr, const char *file, int line); /* 7 */
- char * (*tcl_DbCkrealloc) (char *ptr, unsigned int size, const char *file, int line); /* 8 */
+ void * (*tcl_Alloc) (size_t size); /* 3 */
+ void (*tcl_Free) (void *ptr); /* 4 */
+ void * (*tcl_Realloc) (void *ptr, size_t size); /* 5 */
+ void * (*tcl_DbCkalloc) (size_t size, const char *file, int line); /* 6 */
+ void (*tcl_DbCkfree) (void *ptr, const char *file, int line); /* 7 */
+ void * (*tcl_DbCkrealloc) (void *ptr, size_t size, const char *file, int line); /* 8 */
#if !defined(_WIN32) && !defined(MAC_OSX_TCL) /* UNIX */
- void (*tcl_CreateFileHandler) (int fd, int mask, Tcl_FileProc *proc, ClientData clientData); /* 9 */
+ void (*tcl_CreateFileHandler) (int fd, int mask, Tcl_FileProc *proc, void *clientData); /* 9 */
#endif /* UNIX */
#if defined(_WIN32) /* WIN */
void (*reserved9)(void);
#endif /* WIN */
#ifdef MAC_OSX_TCL /* MACOSX */
- void (*tcl_CreateFileHandler) (int fd, int mask, Tcl_FileProc *proc, ClientData clientData); /* 9 */
+ void (*tcl_CreateFileHandler) (int fd, int mask, Tcl_FileProc *proc, void *clientData); /* 9 */
#endif /* MACOSX */
#if !defined(_WIN32) && !defined(MAC_OSX_TCL) /* UNIX */
void (*tcl_DeleteFileHandler) (int fd); /* 10 */
@@ -1947,31 +1800,31 @@ typedef struct TclStubs {
int (*tcl_WaitForEvent) (const Tcl_Time *timePtr); /* 13 */
int (*tcl_AppendAllObjTypes) (Tcl_Interp *interp, Tcl_Obj *objPtr); /* 14 */
void (*tcl_AppendStringsToObj) (Tcl_Obj *objPtr, ...); /* 15 */
- void (*tcl_AppendToObj) (Tcl_Obj *objPtr, const char *bytes, int length); /* 16 */
+ void (*tcl_AppendToObj) (Tcl_Obj *objPtr, const char *bytes, size_t length); /* 16 */
Tcl_Obj * (*tcl_ConcatObj) (int objc, Tcl_Obj *const objv[]); /* 17 */
int (*tcl_ConvertToType) (Tcl_Interp *interp, Tcl_Obj *objPtr, const Tcl_ObjType *typePtr); /* 18 */
void (*tcl_DbDecrRefCount) (Tcl_Obj *objPtr, const char *file, int line); /* 19 */
void (*tcl_DbIncrRefCount) (Tcl_Obj *objPtr, const char *file, int line); /* 20 */
int (*tcl_DbIsShared) (Tcl_Obj *objPtr, const char *file, int line); /* 21 */
- TCL_DEPRECATED_API("No longer in use, changed to macro") Tcl_Obj * (*tcl_DbNewBooleanObj) (int boolValue, const char *file, int line); /* 22 */
- Tcl_Obj * (*tcl_DbNewByteArrayObj) (const unsigned char *bytes, int length, const char *file, int line); /* 23 */
+ void (*reserved22)(void);
+ Tcl_Obj * (*tcl_DbNewByteArrayObj) (const unsigned char *bytes, size_t length, const char *file, int line); /* 23 */
Tcl_Obj * (*tcl_DbNewDoubleObj) (double doubleValue, const char *file, int line); /* 24 */
Tcl_Obj * (*tcl_DbNewListObj) (int objc, Tcl_Obj *const *objv, const char *file, int line); /* 25 */
- TCL_DEPRECATED_API("No longer in use, changed to macro") Tcl_Obj * (*tcl_DbNewLongObj) (long longValue, const char *file, int line); /* 26 */
+ void (*reserved26)(void);
Tcl_Obj * (*tcl_DbNewObj) (const char *file, int line); /* 27 */
- Tcl_Obj * (*tcl_DbNewStringObj) (const char *bytes, int length, const char *file, int line); /* 28 */
+ Tcl_Obj * (*tcl_DbNewStringObj) (const char *bytes, size_t length, const char *file, int line); /* 28 */
Tcl_Obj * (*tcl_DuplicateObj) (Tcl_Obj *objPtr); /* 29 */
- void (*tclOldFreeObj) (Tcl_Obj *objPtr); /* 30 */
+ void (*reserved30)(void);
int (*tcl_GetBoolean) (Tcl_Interp *interp, const char *src, int *boolPtr); /* 31 */
int (*tcl_GetBooleanFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *boolPtr); /* 32 */
unsigned char * (*tcl_GetByteArrayFromObj) (Tcl_Obj *objPtr, int *lengthPtr); /* 33 */
int (*tcl_GetDouble) (Tcl_Interp *interp, const char *src, double *doublePtr); /* 34 */
int (*tcl_GetDoubleFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, double *doublePtr); /* 35 */
- TCL_DEPRECATED_API("No longer in use, changed to macro") int (*tcl_GetIndexFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, const char *const *tablePtr, const char *msg, int flags, int *indexPtr); /* 36 */
+ void (*reserved36)(void);
int (*tcl_GetInt) (Tcl_Interp *interp, const char *src, int *intPtr); /* 37 */
int (*tcl_GetIntFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *intPtr); /* 38 */
int (*tcl_GetLongFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, long *longPtr); /* 39 */
- CONST86 Tcl_ObjType * (*tcl_GetObjType) (const char *typeName); /* 40 */
+ const Tcl_ObjType * (*tcl_GetObjType) (const char *typeName); /* 40 */
char * (*tcl_GetStringFromObj) (Tcl_Obj *objPtr, int *lengthPtr); /* 41 */
void (*tcl_InvalidateStringRep) (Tcl_Obj *objPtr); /* 42 */
int (*tcl_ListObjAppendList) (Tcl_Interp *interp, Tcl_Obj *listPtr, Tcl_Obj *elemListPtr); /* 43 */
@@ -1980,90 +1833,90 @@ typedef struct TclStubs {
int (*tcl_ListObjIndex) (Tcl_Interp *interp, Tcl_Obj *listPtr, int index, Tcl_Obj **objPtrPtr); /* 46 */
int (*tcl_ListObjLength) (Tcl_Interp *interp, Tcl_Obj *listPtr, int *lengthPtr); /* 47 */
int (*tcl_ListObjReplace) (Tcl_Interp *interp, Tcl_Obj *listPtr, int first, int count, int objc, Tcl_Obj *const objv[]); /* 48 */
- TCL_DEPRECATED_API("No longer in use, changed to macro") Tcl_Obj * (*tcl_NewBooleanObj) (int boolValue); /* 49 */
- Tcl_Obj * (*tcl_NewByteArrayObj) (const unsigned char *bytes, int length); /* 50 */
+ void (*reserved49)(void);
+ Tcl_Obj * (*tcl_NewByteArrayObj) (const unsigned char *bytes, size_t length); /* 50 */
Tcl_Obj * (*tcl_NewDoubleObj) (double doubleValue); /* 51 */
- TCL_DEPRECATED_API("No longer in use, changed to macro") Tcl_Obj * (*tcl_NewIntObj) (int intValue); /* 52 */
+ void (*reserved52)(void);
Tcl_Obj * (*tcl_NewListObj) (int objc, Tcl_Obj *const objv[]); /* 53 */
- TCL_DEPRECATED_API("No longer in use, changed to macro") Tcl_Obj * (*tcl_NewLongObj) (long longValue); /* 54 */
+ void (*reserved54)(void);
Tcl_Obj * (*tcl_NewObj) (void); /* 55 */
- Tcl_Obj * (*tcl_NewStringObj) (const char *bytes, int length); /* 56 */
- TCL_DEPRECATED_API("No longer in use, changed to macro") void (*tcl_SetBooleanObj) (Tcl_Obj *objPtr, int boolValue); /* 57 */
- unsigned char * (*tcl_SetByteArrayLength) (Tcl_Obj *objPtr, int length); /* 58 */
- void (*tcl_SetByteArrayObj) (Tcl_Obj *objPtr, const unsigned char *bytes, int length); /* 59 */
+ Tcl_Obj * (*tcl_NewStringObj) (const char *bytes, size_t length); /* 56 */
+ void (*reserved57)(void);
+ unsigned char * (*tcl_SetByteArrayLength) (Tcl_Obj *objPtr, size_t length); /* 58 */
+ void (*tcl_SetByteArrayObj) (Tcl_Obj *objPtr, const unsigned char *bytes, size_t length); /* 59 */
void (*tcl_SetDoubleObj) (Tcl_Obj *objPtr, double doubleValue); /* 60 */
- TCL_DEPRECATED_API("No longer in use, changed to macro") void (*tcl_SetIntObj) (Tcl_Obj *objPtr, int intValue); /* 61 */
+ void (*reserved61)(void);
void (*tcl_SetListObj) (Tcl_Obj *objPtr, int objc, Tcl_Obj *const objv[]); /* 62 */
- TCL_DEPRECATED_API("No longer in use, changed to macro") void (*tcl_SetLongObj) (Tcl_Obj *objPtr, long longValue); /* 63 */
- void (*tcl_SetObjLength) (Tcl_Obj *objPtr, int length); /* 64 */
- void (*tcl_SetStringObj) (Tcl_Obj *objPtr, const char *bytes, int length); /* 65 */
- TCL_DEPRECATED_API("No longer in use, changed to macro") void (*tcl_AddErrorInfo) (Tcl_Interp *interp, const char *message); /* 66 */
- TCL_DEPRECATED_API("No longer in use, changed to macro") void (*tcl_AddObjErrorInfo) (Tcl_Interp *interp, const char *message, int length); /* 67 */
+ void (*reserved63)(void);
+ void (*tcl_SetObjLength) (Tcl_Obj *objPtr, size_t length); /* 64 */
+ void (*tcl_SetStringObj) (Tcl_Obj *objPtr, const char *bytes, size_t length); /* 65 */
+ void (*reserved66)(void);
+ void (*reserved67)(void);
void (*tcl_AllowExceptions) (Tcl_Interp *interp); /* 68 */
void (*tcl_AppendElement) (Tcl_Interp *interp, const char *element); /* 69 */
void (*tcl_AppendResult) (Tcl_Interp *interp, ...); /* 70 */
- Tcl_AsyncHandler (*tcl_AsyncCreate) (Tcl_AsyncProc *proc, ClientData clientData); /* 71 */
+ Tcl_AsyncHandler (*tcl_AsyncCreate) (Tcl_AsyncProc *proc, void *clientData); /* 71 */
void (*tcl_AsyncDelete) (Tcl_AsyncHandler async); /* 72 */
int (*tcl_AsyncInvoke) (Tcl_Interp *interp, int code); /* 73 */
void (*tcl_AsyncMark) (Tcl_AsyncHandler async); /* 74 */
int (*tcl_AsyncReady) (void); /* 75 */
- TCL_DEPRECATED_API("No longer in use, changed to macro") void (*tcl_BackgroundError) (Tcl_Interp *interp); /* 76 */
- TCL_DEPRECATED_API("Use Tcl_UtfBackslash") char (*tcl_Backslash) (const char *src, int *readPtr); /* 77 */
+ void (*reserved76)(void);
+ void (*reserved77)(void);
int (*tcl_BadChannelOption) (Tcl_Interp *interp, const char *optionName, const char *optionList); /* 78 */
- void (*tcl_CallWhenDeleted) (Tcl_Interp *interp, Tcl_InterpDeleteProc *proc, ClientData clientData); /* 79 */
- void (*tcl_CancelIdleCall) (Tcl_IdleProc *idleProc, ClientData clientData); /* 80 */
+ void (*tcl_CallWhenDeleted) (Tcl_Interp *interp, Tcl_InterpDeleteProc *proc, void *clientData); /* 79 */
+ void (*tcl_CancelIdleCall) (Tcl_IdleProc *idleProc, void *clientData); /* 80 */
int (*tcl_Close) (Tcl_Interp *interp, Tcl_Channel chan); /* 81 */
int (*tcl_CommandComplete) (const char *cmd); /* 82 */
char * (*tcl_Concat) (int argc, const char *const *argv); /* 83 */
- int (*tcl_ConvertElement) (const char *src, char *dst, int flags); /* 84 */
- int (*tcl_ConvertCountedElement) (const char *src, int length, char *dst, int flags); /* 85 */
+ size_t (*tcl_ConvertElement) (const char *src, char *dst, int flags); /* 84 */
+ size_t (*tcl_ConvertCountedElement) (const char *src, size_t length, char *dst, int flags); /* 85 */
int (*tcl_CreateAlias) (Tcl_Interp *slave, const char *slaveCmd, Tcl_Interp *target, const char *targetCmd, int argc, const char *const *argv); /* 86 */
int (*tcl_CreateAliasObj) (Tcl_Interp *slave, const char *slaveCmd, Tcl_Interp *target, const char *targetCmd, int objc, Tcl_Obj *const objv[]); /* 87 */
- Tcl_Channel (*tcl_CreateChannel) (const Tcl_ChannelType *typePtr, const char *chanName, ClientData instanceData, int mask); /* 88 */
- void (*tcl_CreateChannelHandler) (Tcl_Channel chan, int mask, Tcl_ChannelProc *proc, ClientData clientData); /* 89 */
- void (*tcl_CreateCloseHandler) (Tcl_Channel chan, Tcl_CloseProc *proc, ClientData clientData); /* 90 */
- Tcl_Command (*tcl_CreateCommand) (Tcl_Interp *interp, const char *cmdName, Tcl_CmdProc *proc, ClientData clientData, Tcl_CmdDeleteProc *deleteProc); /* 91 */
- void (*tcl_CreateEventSource) (Tcl_EventSetupProc *setupProc, Tcl_EventCheckProc *checkProc, ClientData clientData); /* 92 */
- void (*tcl_CreateExitHandler) (Tcl_ExitProc *proc, ClientData clientData); /* 93 */
+ Tcl_Channel (*tcl_CreateChannel) (const Tcl_ChannelType *typePtr, const char *chanName, void *instanceData, int mask); /* 88 */
+ void (*tcl_CreateChannelHandler) (Tcl_Channel chan, int mask, Tcl_ChannelProc *proc, void *clientData); /* 89 */
+ void (*tcl_CreateCloseHandler) (Tcl_Channel chan, Tcl_CloseProc *proc, void *clientData); /* 90 */
+ Tcl_Command (*tcl_CreateCommand) (Tcl_Interp *interp, const char *cmdName, Tcl_CmdProc *proc, void *clientData, Tcl_CmdDeleteProc *deleteProc); /* 91 */
+ void (*tcl_CreateEventSource) (Tcl_EventSetupProc *setupProc, Tcl_EventCheckProc *checkProc, void *clientData); /* 92 */
+ void (*tcl_CreateExitHandler) (Tcl_ExitProc *proc, void *clientData); /* 93 */
Tcl_Interp * (*tcl_CreateInterp) (void); /* 94 */
- TCL_DEPRECATED_API("") void (*tcl_CreateMathFunc) (Tcl_Interp *interp, const char *name, int numArgs, Tcl_ValueType *argTypes, Tcl_MathProc *proc, ClientData clientData); /* 95 */
- Tcl_Command (*tcl_CreateObjCommand) (Tcl_Interp *interp, const char *cmdName, Tcl_ObjCmdProc *proc, ClientData clientData, Tcl_CmdDeleteProc *deleteProc); /* 96 */
+ void (*reserved95)(void);
+ Tcl_Command (*tcl_CreateObjCommand) (Tcl_Interp *interp, const char *cmdName, Tcl_ObjCmdProc *proc, void *clientData, Tcl_CmdDeleteProc *deleteProc); /* 96 */
Tcl_Interp * (*tcl_CreateSlave) (Tcl_Interp *interp, const char *slaveName, int isSafe); /* 97 */
- Tcl_TimerToken (*tcl_CreateTimerHandler) (int milliseconds, Tcl_TimerProc *proc, ClientData clientData); /* 98 */
- Tcl_Trace (*tcl_CreateTrace) (Tcl_Interp *interp, int level, Tcl_CmdTraceProc *proc, ClientData clientData); /* 99 */
+ Tcl_TimerToken (*tcl_CreateTimerHandler) (int milliseconds, Tcl_TimerProc *proc, void *clientData); /* 98 */
+ Tcl_Trace (*tcl_CreateTrace) (Tcl_Interp *interp, int level, Tcl_CmdTraceProc *proc, void *clientData); /* 99 */
void (*tcl_DeleteAssocData) (Tcl_Interp *interp, const char *name); /* 100 */
- void (*tcl_DeleteChannelHandler) (Tcl_Channel chan, Tcl_ChannelProc *proc, ClientData clientData); /* 101 */
- void (*tcl_DeleteCloseHandler) (Tcl_Channel chan, Tcl_CloseProc *proc, ClientData clientData); /* 102 */
+ void (*tcl_DeleteChannelHandler) (Tcl_Channel chan, Tcl_ChannelProc *proc, void *clientData); /* 101 */
+ void (*tcl_DeleteCloseHandler) (Tcl_Channel chan, Tcl_CloseProc *proc, void *clientData); /* 102 */
int (*tcl_DeleteCommand) (Tcl_Interp *interp, const char *cmdName); /* 103 */
int (*tcl_DeleteCommandFromToken) (Tcl_Interp *interp, Tcl_Command command); /* 104 */
- void (*tcl_DeleteEvents) (Tcl_EventDeleteProc *proc, ClientData clientData); /* 105 */
- void (*tcl_DeleteEventSource) (Tcl_EventSetupProc *setupProc, Tcl_EventCheckProc *checkProc, ClientData clientData); /* 106 */
- void (*tcl_DeleteExitHandler) (Tcl_ExitProc *proc, ClientData clientData); /* 107 */
+ void (*tcl_DeleteEvents) (Tcl_EventDeleteProc *proc, void *clientData); /* 105 */
+ void (*tcl_DeleteEventSource) (Tcl_EventSetupProc *setupProc, Tcl_EventCheckProc *checkProc, void *clientData); /* 106 */
+ void (*tcl_DeleteExitHandler) (Tcl_ExitProc *proc, void *clientData); /* 107 */
void (*tcl_DeleteHashEntry) (Tcl_HashEntry *entryPtr); /* 108 */
void (*tcl_DeleteHashTable) (Tcl_HashTable *tablePtr); /* 109 */
void (*tcl_DeleteInterp) (Tcl_Interp *interp); /* 110 */
void (*tcl_DetachPids) (int numPids, Tcl_Pid *pidPtr); /* 111 */
void (*tcl_DeleteTimerHandler) (Tcl_TimerToken token); /* 112 */
void (*tcl_DeleteTrace) (Tcl_Interp *interp, Tcl_Trace trace); /* 113 */
- void (*tcl_DontCallWhenDeleted) (Tcl_Interp *interp, Tcl_InterpDeleteProc *proc, ClientData clientData); /* 114 */
+ void (*tcl_DontCallWhenDeleted) (Tcl_Interp *interp, Tcl_InterpDeleteProc *proc, void *clientData); /* 114 */
int (*tcl_DoOneEvent) (int flags); /* 115 */
- void (*tcl_DoWhenIdle) (Tcl_IdleProc *proc, ClientData clientData); /* 116 */
- char * (*tcl_DStringAppend) (Tcl_DString *dsPtr, const char *bytes, int length); /* 117 */
+ void (*tcl_DoWhenIdle) (Tcl_IdleProc *proc, void *clientData); /* 116 */
+ char * (*tcl_DStringAppend) (Tcl_DString *dsPtr, const char *bytes, size_t length); /* 117 */
char * (*tcl_DStringAppendElement) (Tcl_DString *dsPtr, const char *element); /* 118 */
void (*tcl_DStringEndSublist) (Tcl_DString *dsPtr); /* 119 */
void (*tcl_DStringFree) (Tcl_DString *dsPtr); /* 120 */
void (*tcl_DStringGetResult) (Tcl_Interp *interp, Tcl_DString *dsPtr); /* 121 */
void (*tcl_DStringInit) (Tcl_DString *dsPtr); /* 122 */
void (*tcl_DStringResult) (Tcl_Interp *interp, Tcl_DString *dsPtr); /* 123 */
- void (*tcl_DStringSetLength) (Tcl_DString *dsPtr, int length); /* 124 */
+ void (*tcl_DStringSetLength) (Tcl_DString *dsPtr, size_t length); /* 124 */
void (*tcl_DStringStartSublist) (Tcl_DString *dsPtr); /* 125 */
int (*tcl_Eof) (Tcl_Channel chan); /* 126 */
const char * (*tcl_ErrnoId) (void); /* 127 */
const char * (*tcl_ErrnoMsg) (int err); /* 128 */
- int (*tcl_Eval) (Tcl_Interp *interp, const char *script); /* 129 */
+ void (*reserved129)(void);
int (*tcl_EvalFile) (Tcl_Interp *interp, const char *fileName); /* 130 */
- TCL_DEPRECATED_API("No longer in use, changed to macro") int (*tcl_EvalObj) (Tcl_Interp *interp, Tcl_Obj *objPtr); /* 131 */
- void (*tcl_EventuallyFree) (ClientData clientData, Tcl_FreeProc *freeProc); /* 132 */
+ void (*reserved131)(void);
+ void (*tcl_EventuallyFree) (void *clientData, Tcl_FreeProc *freeProc); /* 132 */
TCL_NORETURN1 void (*tcl_Exit) (int status); /* 133 */
int (*tcl_ExposeCommand) (Tcl_Interp *interp, const char *hiddenCmdToken, const char *cmdName); /* 134 */
int (*tcl_ExprBoolean) (Tcl_Interp *interp, const char *expr, int *ptr); /* 135 */
@@ -2075,21 +1928,21 @@ typedef struct TclStubs {
int (*tcl_ExprObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_Obj **resultPtrPtr); /* 141 */
int (*tcl_ExprString) (Tcl_Interp *interp, const char *expr); /* 142 */
void (*tcl_Finalize) (void); /* 143 */
- TCL_DEPRECATED_API("Don't use this function in a stub-enabled extension") void (*tcl_FindExecutable) (const char *argv0); /* 144 */
+ void (*reserved144)(void);
Tcl_HashEntry * (*tcl_FirstHashEntry) (Tcl_HashTable *tablePtr, Tcl_HashSearch *searchPtr); /* 145 */
int (*tcl_Flush) (Tcl_Channel chan); /* 146 */
void (*tcl_FreeResult) (Tcl_Interp *interp); /* 147 */
int (*tcl_GetAlias) (Tcl_Interp *interp, const char *slaveCmd, Tcl_Interp **targetInterpPtr, const char **targetCmdPtr, int *argcPtr, const char ***argvPtr); /* 148 */
int (*tcl_GetAliasObj) (Tcl_Interp *interp, const char *slaveCmd, Tcl_Interp **targetInterpPtr, const char **targetCmdPtr, int *objcPtr, Tcl_Obj ***objv); /* 149 */
- ClientData (*tcl_GetAssocData) (Tcl_Interp *interp, const char *name, Tcl_InterpDeleteProc **procPtr); /* 150 */
+ void * (*tcl_GetAssocData) (Tcl_Interp *interp, const char *name, Tcl_InterpDeleteProc **procPtr); /* 150 */
Tcl_Channel (*tcl_GetChannel) (Tcl_Interp *interp, const char *chanName, int *modePtr); /* 151 */
int (*tcl_GetChannelBufferSize) (Tcl_Channel chan); /* 152 */
- int (*tcl_GetChannelHandle) (Tcl_Channel chan, int direction, ClientData *handlePtr); /* 153 */
- ClientData (*tcl_GetChannelInstanceData) (Tcl_Channel chan); /* 154 */
+ int (*tcl_GetChannelHandle) (Tcl_Channel chan, int direction, void **handlePtr); /* 153 */
+ void * (*tcl_GetChannelInstanceData) (Tcl_Channel chan); /* 154 */
int (*tcl_GetChannelMode) (Tcl_Channel chan); /* 155 */
const char * (*tcl_GetChannelName) (Tcl_Channel chan); /* 156 */
int (*tcl_GetChannelOption) (Tcl_Interp *interp, Tcl_Channel chan, const char *optionName, Tcl_DString *dsPtr); /* 157 */
- CONST86 Tcl_ChannelType * (*tcl_GetChannelType) (Tcl_Channel chan); /* 158 */
+ const Tcl_ChannelType * (*tcl_GetChannelType) (Tcl_Channel chan); /* 158 */
int (*tcl_GetCommandInfo) (Tcl_Interp *interp, const char *cmdName, Tcl_CmdInfo *infoPtr); /* 159 */
const char * (*tcl_GetCommandName) (Tcl_Interp *interp, Tcl_Command command); /* 160 */
int (*tcl_GetErrno) (void); /* 161 */
@@ -2099,25 +1952,25 @@ typedef struct TclStubs {
const char * (*tcl_GetNameOfExecutable) (void); /* 165 */
Tcl_Obj * (*tcl_GetObjResult) (Tcl_Interp *interp); /* 166 */
#if !defined(_WIN32) && !defined(MAC_OSX_TCL) /* UNIX */
- int (*tcl_GetOpenFile) (Tcl_Interp *interp, const char *chanID, int forWriting, int checkUsage, ClientData *filePtr); /* 167 */
+ int (*tcl_GetOpenFile) (Tcl_Interp *interp, const char *chanID, int forWriting, int checkUsage, void **filePtr); /* 167 */
#endif /* UNIX */
#if defined(_WIN32) /* WIN */
void (*reserved167)(void);
#endif /* WIN */
#ifdef MAC_OSX_TCL /* MACOSX */
- int (*tcl_GetOpenFile) (Tcl_Interp *interp, const char *chanID, int forWriting, int checkUsage, ClientData *filePtr); /* 167 */
+ int (*tcl_GetOpenFile) (Tcl_Interp *interp, const char *chanID, int forWriting, int checkUsage, void **filePtr); /* 167 */
#endif /* MACOSX */
Tcl_PathType (*tcl_GetPathType) (const char *path); /* 168 */
- int (*tcl_Gets) (Tcl_Channel chan, Tcl_DString *dsPtr); /* 169 */
- int (*tcl_GetsObj) (Tcl_Channel chan, Tcl_Obj *objPtr); /* 170 */
+ size_t (*tcl_Gets) (Tcl_Channel chan, Tcl_DString *dsPtr); /* 169 */
+ size_t (*tcl_GetsObj) (Tcl_Channel chan, Tcl_Obj *objPtr); /* 170 */
int (*tcl_GetServiceMode) (void); /* 171 */
Tcl_Interp * (*tcl_GetSlave) (Tcl_Interp *interp, const char *slaveName); /* 172 */
Tcl_Channel (*tcl_GetStdChannel) (int type); /* 173 */
- const char * (*tcl_GetStringResult) (Tcl_Interp *interp); /* 174 */
- TCL_DEPRECATED_API("No longer in use, changed to macro") const char * (*tcl_GetVar) (Tcl_Interp *interp, const char *varName, int flags); /* 175 */
+ void (*reserved174)(void);
+ void (*reserved175)(void);
const char * (*tcl_GetVar2) (Tcl_Interp *interp, const char *part1, const char *part2, int flags); /* 176 */
- int (*tcl_GlobalEval) (Tcl_Interp *interp, const char *command); /* 177 */
- TCL_DEPRECATED_API("No longer in use, changed to macro") int (*tcl_GlobalEvalObj) (Tcl_Interp *interp, Tcl_Obj *objPtr); /* 178 */
+ void (*reserved177)(void);
+ void (*reserved178)(void);
int (*tcl_HideCommand) (Tcl_Interp *interp, const char *cmdName, const char *hiddenCmdToken); /* 179 */
int (*tcl_Init) (Tcl_Interp *interp); /* 180 */
void (*tcl_InitHashTable) (Tcl_HashTable *tablePtr, int keyType); /* 181 */
@@ -2128,9 +1981,9 @@ typedef struct TclStubs {
char * (*tcl_JoinPath) (int argc, const char *const *argv, Tcl_DString *resultPtr); /* 186 */
int (*tcl_LinkVar) (Tcl_Interp *interp, const char *varName, void *addr, int type); /* 187 */
void (*reserved188)(void);
- Tcl_Channel (*tcl_MakeFileChannel) (ClientData handle, int mode); /* 189 */
+ Tcl_Channel (*tcl_MakeFileChannel) (void *handle, int mode); /* 189 */
int (*tcl_MakeSafe) (Tcl_Interp *interp); /* 190 */
- Tcl_Channel (*tcl_MakeTcpClientChannel) (ClientData tcpSocket); /* 191 */
+ Tcl_Channel (*tcl_MakeTcpClientChannel) (void *tcpSocket); /* 191 */
char * (*tcl_Merge) (int argc, const char *const *argv); /* 192 */
Tcl_HashEntry * (*tcl_NextHashEntry) (Tcl_HashSearch *searchPtr); /* 193 */
void (*tcl_NotifyChannel) (Tcl_Channel channel, int mask); /* 194 */
@@ -2139,13 +1992,13 @@ typedef struct TclStubs {
Tcl_Channel (*tcl_OpenCommandChannel) (Tcl_Interp *interp, int argc, const char **argv, int flags); /* 197 */
Tcl_Channel (*tcl_OpenFileChannel) (Tcl_Interp *interp, const char *fileName, const char *modeString, int permissions); /* 198 */
Tcl_Channel (*tcl_OpenTcpClient) (Tcl_Interp *interp, int port, const char *address, const char *myaddr, int myport, int async); /* 199 */
- Tcl_Channel (*tcl_OpenTcpServer) (Tcl_Interp *interp, int port, const char *host, Tcl_TcpAcceptProc *acceptProc, ClientData callbackData); /* 200 */
- void (*tcl_Preserve) (ClientData data); /* 201 */
+ Tcl_Channel (*tcl_OpenTcpServer) (Tcl_Interp *interp, int port, const char *host, Tcl_TcpAcceptProc *acceptProc, void *callbackData); /* 200 */
+ void (*tcl_Preserve) (void *data); /* 201 */
void (*tcl_PrintDouble) (Tcl_Interp *interp, double value, char *dst); /* 202 */
int (*tcl_PutEnv) (const char *assignment); /* 203 */
const char * (*tcl_PosixError) (Tcl_Interp *interp); /* 204 */
void (*tcl_QueueEvent) (Tcl_Event *evPtr, Tcl_QueuePosition position); /* 205 */
- int (*tcl_Read) (Tcl_Channel chan, char *bufPtr, int toRead); /* 206 */
+ size_t (*tcl_Read) (Tcl_Channel chan, char *bufPtr, size_t toRead); /* 206 */
void (*tcl_ReapDetachedProcs) (void); /* 207 */
int (*tcl_RecordAndEval) (Tcl_Interp *interp, const char *cmd, int flags); /* 208 */
int (*tcl_RecordAndEvalObj) (Tcl_Interp *interp, Tcl_Obj *cmdPtr, int flags); /* 209 */
@@ -2154,135 +2007,135 @@ typedef struct TclStubs {
Tcl_RegExp (*tcl_RegExpCompile) (Tcl_Interp *interp, const char *pattern); /* 212 */
int (*tcl_RegExpExec) (Tcl_Interp *interp, Tcl_RegExp regexp, const char *text, const char *start); /* 213 */
int (*tcl_RegExpMatch) (Tcl_Interp *interp, const char *text, const char *pattern); /* 214 */
- void (*tcl_RegExpRange) (Tcl_RegExp regexp, int index, const char **startPtr, const char **endPtr); /* 215 */
- void (*tcl_Release) (ClientData clientData); /* 216 */
+ void (*tcl_RegExpRange) (Tcl_RegExp regexp, size_t index, const char **startPtr, const char **endPtr); /* 215 */
+ void (*tcl_Release) (void *clientData); /* 216 */
void (*tcl_ResetResult) (Tcl_Interp *interp); /* 217 */
- int (*tcl_ScanElement) (const char *src, int *flagPtr); /* 218 */
- int (*tcl_ScanCountedElement) (const char *src, int length, int *flagPtr); /* 219 */
- TCL_DEPRECATED_API("") int (*tcl_SeekOld) (Tcl_Channel chan, int offset, int mode); /* 220 */
+ size_t (*tcl_ScanElement) (const char *src, int *flagPtr); /* 218 */
+ size_t (*tcl_ScanCountedElement) (const char *src, size_t length, int *flagPtr); /* 219 */
+ void (*reserved220)(void);
int (*tcl_ServiceAll) (void); /* 221 */
int (*tcl_ServiceEvent) (int flags); /* 222 */
- void (*tcl_SetAssocData) (Tcl_Interp *interp, const char *name, Tcl_InterpDeleteProc *proc, ClientData clientData); /* 223 */
+ void (*tcl_SetAssocData) (Tcl_Interp *interp, const char *name, Tcl_InterpDeleteProc *proc, void *clientData); /* 223 */
void (*tcl_SetChannelBufferSize) (Tcl_Channel chan, int sz); /* 224 */
int (*tcl_SetChannelOption) (Tcl_Interp *interp, Tcl_Channel chan, const char *optionName, const char *newValue); /* 225 */
int (*tcl_SetCommandInfo) (Tcl_Interp *interp, const char *cmdName, const Tcl_CmdInfo *infoPtr); /* 226 */
void (*tcl_SetErrno) (int err); /* 227 */
void (*tcl_SetErrorCode) (Tcl_Interp *interp, ...); /* 228 */
void (*tcl_SetMaxBlockTime) (const Tcl_Time *timePtr); /* 229 */
- TCL_DEPRECATED_API("Don't use this function in a stub-enabled extension") void (*tcl_SetPanicProc) (TCL_NORETURN1 Tcl_PanicProc *panicProc); /* 230 */
+ void (*reserved230)(void);
int (*tcl_SetRecursionLimit) (Tcl_Interp *interp, int depth); /* 231 */
- void (*tcl_SetResult) (Tcl_Interp *interp, char *result, Tcl_FreeProc *freeProc); /* 232 */
+ void (*reserved232)(void);
int (*tcl_SetServiceMode) (int mode); /* 233 */
void (*tcl_SetObjErrorCode) (Tcl_Interp *interp, Tcl_Obj *errorObjPtr); /* 234 */
void (*tcl_SetObjResult) (Tcl_Interp *interp, Tcl_Obj *resultObjPtr); /* 235 */
void (*tcl_SetStdChannel) (Tcl_Channel channel, int type); /* 236 */
- TCL_DEPRECATED_API("No longer in use, changed to macro") const char * (*tcl_SetVar) (Tcl_Interp *interp, const char *varName, const char *newValue, int flags); /* 237 */
+ void (*reserved237)(void);
const char * (*tcl_SetVar2) (Tcl_Interp *interp, const char *part1, const char *part2, const char *newValue, int flags); /* 238 */
const char * (*tcl_SignalId) (int sig); /* 239 */
const char * (*tcl_SignalMsg) (int sig); /* 240 */
void (*tcl_SourceRCFile) (Tcl_Interp *interp); /* 241 */
int (*tcl_SplitList) (Tcl_Interp *interp, const char *listStr, int *argcPtr, const char ***argvPtr); /* 242 */
void (*tcl_SplitPath) (const char *path, int *argcPtr, const char ***argvPtr); /* 243 */
- TCL_DEPRECATED_API("Don't use this function in a stub-enabled extension") void (*tcl_StaticPackage) (Tcl_Interp *interp, const char *pkgName, Tcl_PackageInitProc *initProc, Tcl_PackageInitProc *safeInitProc); /* 244 */
- TCL_DEPRECATED_API("No longer in use, changed to macro") int (*tcl_StringMatch) (const char *str, const char *pattern); /* 245 */
- TCL_DEPRECATED_API("") int (*tcl_TellOld) (Tcl_Channel chan); /* 246 */
- TCL_DEPRECATED_API("No longer in use, changed to macro") int (*tcl_TraceVar) (Tcl_Interp *interp, const char *varName, int flags, Tcl_VarTraceProc *proc, ClientData clientData); /* 247 */
- int (*tcl_TraceVar2) (Tcl_Interp *interp, const char *part1, const char *part2, int flags, Tcl_VarTraceProc *proc, ClientData clientData); /* 248 */
+ void (*reserved244)(void);
+ void (*reserved245)(void);
+ void (*reserved246)(void);
+ void (*reserved247)(void);
+ int (*tcl_TraceVar2) (Tcl_Interp *interp, const char *part1, const char *part2, int flags, Tcl_VarTraceProc *proc, void *clientData); /* 248 */
char * (*tcl_TranslateFileName) (Tcl_Interp *interp, const char *name, Tcl_DString *bufferPtr); /* 249 */
- int (*tcl_Ungets) (Tcl_Channel chan, const char *str, int len, int atHead); /* 250 */
+ size_t (*tcl_Ungets) (Tcl_Channel chan, const char *str, size_t len, int atHead); /* 250 */
void (*tcl_UnlinkVar) (Tcl_Interp *interp, const char *varName); /* 251 */
int (*tcl_UnregisterChannel) (Tcl_Interp *interp, Tcl_Channel chan); /* 252 */
- TCL_DEPRECATED_API("No longer in use, changed to macro") int (*tcl_UnsetVar) (Tcl_Interp *interp, const char *varName, int flags); /* 253 */
+ void (*reserved253)(void);
int (*tcl_UnsetVar2) (Tcl_Interp *interp, const char *part1, const char *part2, int flags); /* 254 */
- TCL_DEPRECATED_API("No longer in use, changed to macro") void (*tcl_UntraceVar) (Tcl_Interp *interp, const char *varName, int flags, Tcl_VarTraceProc *proc, ClientData clientData); /* 255 */
- void (*tcl_UntraceVar2) (Tcl_Interp *interp, const char *part1, const char *part2, int flags, Tcl_VarTraceProc *proc, ClientData clientData); /* 256 */
+ void (*reserved255)(void);
+ void (*tcl_UntraceVar2) (Tcl_Interp *interp, const char *part1, const char *part2, int flags, Tcl_VarTraceProc *proc, void *clientData); /* 256 */
void (*tcl_UpdateLinkedVar) (Tcl_Interp *interp, const char *varName); /* 257 */
- TCL_DEPRECATED_API("No longer in use, changed to macro") int (*tcl_UpVar) (Tcl_Interp *interp, const char *frameName, const char *varName, const char *localName, int flags); /* 258 */
+ void (*reserved258)(void);
int (*tcl_UpVar2) (Tcl_Interp *interp, const char *frameName, const char *part1, const char *part2, const char *localName, int flags); /* 259 */
int (*tcl_VarEval) (Tcl_Interp *interp, ...); /* 260 */
- TCL_DEPRECATED_API("No longer in use, changed to macro") ClientData (*tcl_VarTraceInfo) (Tcl_Interp *interp, const char *varName, int flags, Tcl_VarTraceProc *procPtr, ClientData prevClientData); /* 261 */
- ClientData (*tcl_VarTraceInfo2) (Tcl_Interp *interp, const char *part1, const char *part2, int flags, Tcl_VarTraceProc *procPtr, ClientData prevClientData); /* 262 */
- int (*tcl_Write) (Tcl_Channel chan, const char *s, int slen); /* 263 */
+ void (*reserved261)(void);
+ void * (*tcl_VarTraceInfo2) (Tcl_Interp *interp, const char *part1, const char *part2, int flags, Tcl_VarTraceProc *procPtr, void *prevClientData); /* 262 */
+ size_t (*tcl_Write) (Tcl_Channel chan, const char *s, size_t slen); /* 263 */
void (*tcl_WrongNumArgs) (Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], const char *message); /* 264 */
int (*tcl_DumpActiveMemory) (const char *fileName); /* 265 */
void (*tcl_ValidateAllMemory) (const char *file, int line); /* 266 */
- TCL_DEPRECATED_API("see TIP #422") void (*tcl_AppendResultVA) (Tcl_Interp *interp, va_list argList); /* 267 */
- TCL_DEPRECATED_API("see TIP #422") void (*tcl_AppendStringsToObjVA) (Tcl_Obj *objPtr, va_list argList); /* 268 */
+ void (*reserved267)(void);
+ void (*reserved268)(void);
char * (*tcl_HashStats) (Tcl_HashTable *tablePtr); /* 269 */
const char * (*tcl_ParseVar) (Tcl_Interp *interp, const char *start, const char **termPtr); /* 270 */
- TCL_DEPRECATED_API("No longer in use, changed to macro") const char * (*tcl_PkgPresent) (Tcl_Interp *interp, const char *name, const char *version, int exact); /* 271 */
+ void (*reserved271)(void);
const char * (*tcl_PkgPresentEx) (Tcl_Interp *interp, const char *name, const char *version, int exact, void *clientDataPtr); /* 272 */
- TCL_DEPRECATED_API("No longer in use, changed to macro") int (*tcl_PkgProvide) (Tcl_Interp *interp, const char *name, const char *version); /* 273 */
- TCL_DEPRECATED_API("No longer in use, changed to macro") const char * (*tcl_PkgRequire) (Tcl_Interp *interp, const char *name, const char *version, int exact); /* 274 */
- TCL_DEPRECATED_API("see TIP #422") void (*tcl_SetErrorCodeVA) (Tcl_Interp *interp, va_list argList); /* 275 */
- TCL_DEPRECATED_API("see TIP #422") int (*tcl_VarEvalVA) (Tcl_Interp *interp, va_list argList); /* 276 */
+ void (*reserved273)(void);
+ void (*reserved274)(void);
+ void (*reserved275)(void);
+ void (*reserved276)(void);
Tcl_Pid (*tcl_WaitPid) (Tcl_Pid pid, int *statPtr, int options); /* 277 */
- TCL_DEPRECATED_API("see TIP #422") TCL_NORETURN1 void (*tcl_PanicVA) (const char *format, va_list argList); /* 278 */
+ void (*reserved278)(void);
void (*tcl_GetVersion) (int *major, int *minor, int *patchLevel, int *type); /* 279 */
void (*tcl_InitMemory) (Tcl_Interp *interp); /* 280 */
- Tcl_Channel (*tcl_StackChannel) (Tcl_Interp *interp, const Tcl_ChannelType *typePtr, ClientData instanceData, int mask, Tcl_Channel prevChan); /* 281 */
+ Tcl_Channel (*tcl_StackChannel) (Tcl_Interp *interp, const Tcl_ChannelType *typePtr, void *instanceData, int mask, Tcl_Channel prevChan); /* 281 */
int (*tcl_UnstackChannel) (Tcl_Interp *interp, Tcl_Channel chan); /* 282 */
Tcl_Channel (*tcl_GetStackedChannel) (Tcl_Channel chan); /* 283 */
void (*tcl_SetMainLoop) (Tcl_MainLoopProc *proc); /* 284 */
void (*reserved285)(void);
void (*tcl_AppendObjToObj) (Tcl_Obj *objPtr, Tcl_Obj *appendObjPtr); /* 286 */
Tcl_Encoding (*tcl_CreateEncoding) (const Tcl_EncodingType *typePtr); /* 287 */
- void (*tcl_CreateThreadExitHandler) (Tcl_ExitProc *proc, ClientData clientData); /* 288 */
- void (*tcl_DeleteThreadExitHandler) (Tcl_ExitProc *proc, ClientData clientData); /* 289 */
- void (*tcl_DiscardResult) (Tcl_SavedResult *statePtr); /* 290 */
- int (*tcl_EvalEx) (Tcl_Interp *interp, const char *script, int numBytes, int flags); /* 291 */
+ void (*tcl_CreateThreadExitHandler) (Tcl_ExitProc *proc, void *clientData); /* 288 */
+ void (*tcl_DeleteThreadExitHandler) (Tcl_ExitProc *proc, void *clientData); /* 289 */
+ void (*reserved290)(void);
+ int (*tcl_EvalEx) (Tcl_Interp *interp, const char *script, size_t numBytes, int flags); /* 291 */
int (*tcl_EvalObjv) (Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], int flags); /* 292 */
int (*tcl_EvalObjEx) (Tcl_Interp *interp, Tcl_Obj *objPtr, int flags); /* 293 */
TCL_NORETURN1 void (*tcl_ExitThread) (int status); /* 294 */
- int (*tcl_ExternalToUtf) (Tcl_Interp *interp, Tcl_Encoding encoding, const char *src, int srcLen, int flags, Tcl_EncodingState *statePtr, char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr); /* 295 */
- char * (*tcl_ExternalToUtfDString) (Tcl_Encoding encoding, const char *src, int srcLen, Tcl_DString *dsPtr); /* 296 */
+ int (*tcl_ExternalToUtf) (Tcl_Interp *interp, Tcl_Encoding encoding, const char *src, size_t srcLen, int flags, Tcl_EncodingState *statePtr, char *dst, size_t dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr); /* 295 */
+ char * (*tcl_ExternalToUtfDString) (Tcl_Encoding encoding, const char *src, size_t srcLen, Tcl_DString *dsPtr); /* 296 */
void (*tcl_FinalizeThread) (void); /* 297 */
- void (*tcl_FinalizeNotifier) (ClientData clientData); /* 298 */
+ void (*tcl_FinalizeNotifier) (void *clientData); /* 298 */
void (*tcl_FreeEncoding) (Tcl_Encoding encoding); /* 299 */
Tcl_ThreadId (*tcl_GetCurrentThread) (void); /* 300 */
Tcl_Encoding (*tcl_GetEncoding) (Tcl_Interp *interp, const char *name); /* 301 */
const char * (*tcl_GetEncodingName) (Tcl_Encoding encoding); /* 302 */
void (*tcl_GetEncodingNames) (Tcl_Interp *interp); /* 303 */
- int (*tcl_GetIndexFromObjStruct) (Tcl_Interp *interp, Tcl_Obj *objPtr, const void *tablePtr, int offset, const char *msg, int flags, int *indexPtr); /* 304 */
- void * (*tcl_GetThreadData) (Tcl_ThreadDataKey *keyPtr, int size); /* 305 */
+ int (*tcl_GetIndexFromObjStruct) (Tcl_Interp *interp, Tcl_Obj *objPtr, const void *tablePtr, size_t offset, const char *msg, int flags, int *indexPtr); /* 304 */
+ void * (*tcl_GetThreadData) (Tcl_ThreadDataKey *keyPtr, size_t size); /* 305 */
Tcl_Obj * (*tcl_GetVar2Ex) (Tcl_Interp *interp, const char *part1, const char *part2, int flags); /* 306 */
- ClientData (*tcl_InitNotifier) (void); /* 307 */
+ void * (*tcl_InitNotifier) (void); /* 307 */
void (*tcl_MutexLock) (Tcl_Mutex *mutexPtr); /* 308 */
void (*tcl_MutexUnlock) (Tcl_Mutex *mutexPtr); /* 309 */
void (*tcl_ConditionNotify) (Tcl_Condition *condPtr); /* 310 */
void (*tcl_ConditionWait) (Tcl_Condition *condPtr, Tcl_Mutex *mutexPtr, const Tcl_Time *timePtr); /* 311 */
- int (*tcl_NumUtfChars) (const char *src, int length); /* 312 */
- int (*tcl_ReadChars) (Tcl_Channel channel, Tcl_Obj *objPtr, int charsToRead, int appendFlag); /* 313 */
- void (*tcl_RestoreResult) (Tcl_Interp *interp, Tcl_SavedResult *statePtr); /* 314 */
- void (*tcl_SaveResult) (Tcl_Interp *interp, Tcl_SavedResult *statePtr); /* 315 */
+ size_t (*tcl_NumUtfChars) (const char *src, size_t length); /* 312 */
+ size_t (*tcl_ReadChars) (Tcl_Channel channel, Tcl_Obj *objPtr, size_t charsToRead, int appendFlag); /* 313 */
+ void (*reserved314)(void);
+ void (*reserved315)(void);
int (*tcl_SetSystemEncoding) (Tcl_Interp *interp, const char *name); /* 316 */
Tcl_Obj * (*tcl_SetVar2Ex) (Tcl_Interp *interp, const char *part1, const char *part2, Tcl_Obj *newValuePtr, int flags); /* 317 */
void (*tcl_ThreadAlert) (Tcl_ThreadId threadId); /* 318 */
void (*tcl_ThreadQueueEvent) (Tcl_ThreadId threadId, Tcl_Event *evPtr, Tcl_QueuePosition position); /* 319 */
- int (*tcl_UniCharAtIndex) (const char *src, int index); /* 320 */
+ int (*tcl_UniCharAtIndex) (const char *src, size_t index); /* 320 */
int (*tcl_UniCharToLower) (int ch); /* 321 */
int (*tcl_UniCharToTitle) (int ch); /* 322 */
int (*tcl_UniCharToUpper) (int ch); /* 323 */
int (*tcl_UniCharToUtf) (int ch, char *buf); /* 324 */
- const char * (*tcl_UtfAtIndex) (const char *src, int index); /* 325 */
- int (*tcl_UtfCharComplete) (const char *src, int length); /* 326 */
- int (*tcl_UtfBackslash) (const char *src, int *readPtr, char *dst); /* 327 */
+ const char * (*tcl_UtfAtIndex) (const char *src, size_t index); /* 325 */
+ int (*tcl_UtfCharComplete) (const char *src, size_t length); /* 326 */
+ size_t (*tcl_UtfBackslash) (const char *src, int *readPtr, char *dst); /* 327 */
const char * (*tcl_UtfFindFirst) (const char *src, int ch); /* 328 */
const char * (*tcl_UtfFindLast) (const char *src, int ch); /* 329 */
const char * (*tcl_UtfNext) (const char *src); /* 330 */
const char * (*tcl_UtfPrev) (const char *src, const char *start); /* 331 */
- int (*tcl_UtfToExternal) (Tcl_Interp *interp, Tcl_Encoding encoding, const char *src, int srcLen, int flags, Tcl_EncodingState *statePtr, char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr); /* 332 */
- char * (*tcl_UtfToExternalDString) (Tcl_Encoding encoding, const char *src, int srcLen, Tcl_DString *dsPtr); /* 333 */
+ int (*tcl_UtfToExternal) (Tcl_Interp *interp, Tcl_Encoding encoding, const char *src, size_t srcLen, int flags, Tcl_EncodingState *statePtr, char *dst, size_t dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr); /* 332 */
+ char * (*tcl_UtfToExternalDString) (Tcl_Encoding encoding, const char *src, size_t srcLen, Tcl_DString *dsPtr); /* 333 */
int (*tcl_UtfToLower) (char *src); /* 334 */
int (*tcl_UtfToTitle) (char *src); /* 335 */
int (*tcl_UtfToUniChar) (const char *src, Tcl_UniChar *chPtr); /* 336 */
int (*tcl_UtfToUpper) (char *src); /* 337 */
- int (*tcl_WriteChars) (Tcl_Channel chan, const char *src, int srcLen); /* 338 */
- int (*tcl_WriteObj) (Tcl_Channel chan, Tcl_Obj *objPtr); /* 339 */
+ size_t (*tcl_WriteChars) (Tcl_Channel chan, const char *src, size_t srcLen); /* 338 */
+ size_t (*tcl_WriteObj) (Tcl_Channel chan, Tcl_Obj *objPtr); /* 339 */
char * (*tcl_GetString) (Tcl_Obj *objPtr); /* 340 */
- TCL_DEPRECATED_API("Use Tcl_GetEncodingSearchPath") const char * (*tcl_GetDefaultEncodingDir) (void); /* 341 */
- TCL_DEPRECATED_API("Use Tcl_SetEncodingSearchPath") void (*tcl_SetDefaultEncodingDir) (const char *path); /* 342 */
- void (*tcl_AlertNotifier) (ClientData clientData); /* 343 */
+ void (*reserved341)(void);
+ void (*reserved342)(void);
+ void (*tcl_AlertNotifier) (void *clientData); /* 343 */
void (*tcl_ServiceModeHook) (int mode); /* 344 */
int (*tcl_UniCharIsAlnum) (int ch); /* 345 */
int (*tcl_UniCharIsAlpha) (int ch); /* 346 */
@@ -2291,50 +2144,50 @@ typedef struct TclStubs {
int (*tcl_UniCharIsSpace) (int ch); /* 349 */
int (*tcl_UniCharIsUpper) (int ch); /* 350 */
int (*tcl_UniCharIsWordChar) (int ch); /* 351 */
- int (*tcl_UniCharLen) (const Tcl_UniChar *uniStr); /* 352 */
- int (*tcl_UniCharNcmp) (const Tcl_UniChar *ucs, const Tcl_UniChar *uct, unsigned long numChars); /* 353 */
- char * (*tcl_UniCharToUtfDString) (const Tcl_UniChar *uniStr, int uniLength, Tcl_DString *dsPtr); /* 354 */
- Tcl_UniChar * (*tcl_UtfToUniCharDString) (const char *src, int length, Tcl_DString *dsPtr); /* 355 */
+ size_t (*tcl_UniCharLen) (const Tcl_UniChar *uniStr); /* 352 */
+ int (*tcl_UniCharNcmp) (const Tcl_UniChar *ucs, const Tcl_UniChar *uct, size_t numChars); /* 353 */
+ char * (*tcl_UniCharToUtfDString) (const Tcl_UniChar *uniStr, size_t uniLength, Tcl_DString *dsPtr); /* 354 */
+ Tcl_UniChar * (*tcl_UtfToUniCharDString) (const char *src, size_t length, Tcl_DString *dsPtr); /* 355 */
Tcl_RegExp (*tcl_GetRegExpFromObj) (Tcl_Interp *interp, Tcl_Obj *patObj, int flags); /* 356 */
- TCL_DEPRECATED_API("Use Tcl_EvalTokensStandard") Tcl_Obj * (*tcl_EvalTokens) (Tcl_Interp *interp, Tcl_Token *tokenPtr, int count); /* 357 */
+ void (*reserved357)(void);
void (*tcl_FreeParse) (Tcl_Parse *parsePtr); /* 358 */
- void (*tcl_LogCommandInfo) (Tcl_Interp *interp, const char *script, const char *command, int length); /* 359 */
- int (*tcl_ParseBraces) (Tcl_Interp *interp, const char *start, int numBytes, Tcl_Parse *parsePtr, int append, const char **termPtr); /* 360 */
- int (*tcl_ParseCommand) (Tcl_Interp *interp, const char *start, int numBytes, int nested, Tcl_Parse *parsePtr); /* 361 */
- int (*tcl_ParseExpr) (Tcl_Interp *interp, const char *start, int numBytes, Tcl_Parse *parsePtr); /* 362 */
- int (*tcl_ParseQuotedString) (Tcl_Interp *interp, const char *start, int numBytes, Tcl_Parse *parsePtr, int append, const char **termPtr); /* 363 */
- int (*tcl_ParseVarName) (Tcl_Interp *interp, const char *start, int numBytes, Tcl_Parse *parsePtr, int append); /* 364 */
+ void (*tcl_LogCommandInfo) (Tcl_Interp *interp, const char *script, const char *command, size_t length); /* 359 */
+ int (*tcl_ParseBraces) (Tcl_Interp *interp, const char *start, size_t numBytes, Tcl_Parse *parsePtr, int append, const char **termPtr); /* 360 */
+ int (*tcl_ParseCommand) (Tcl_Interp *interp, const char *start, size_t numBytes, int nested, Tcl_Parse *parsePtr); /* 361 */
+ int (*tcl_ParseExpr) (Tcl_Interp *interp, const char *start, size_t numBytes, Tcl_Parse *parsePtr); /* 362 */
+ int (*tcl_ParseQuotedString) (Tcl_Interp *interp, const char *start, size_t numBytes, Tcl_Parse *parsePtr, int append, const char **termPtr); /* 363 */
+ int (*tcl_ParseVarName) (Tcl_Interp *interp, const char *start, size_t numBytes, Tcl_Parse *parsePtr, int append); /* 364 */
char * (*tcl_GetCwd) (Tcl_Interp *interp, Tcl_DString *cwdPtr); /* 365 */
int (*tcl_Chdir) (const char *dirName); /* 366 */
int (*tcl_Access) (const char *path, int mode); /* 367 */
int (*tcl_Stat) (const char *path, struct stat *bufPtr); /* 368 */
- int (*tcl_UtfNcmp) (const char *s1, const char *s2, unsigned long n); /* 369 */
- int (*tcl_UtfNcasecmp) (const char *s1, const char *s2, unsigned long n); /* 370 */
+ int (*tcl_UtfNcmp) (const char *s1, const char *s2, size_t n); /* 369 */
+ int (*tcl_UtfNcasecmp) (const char *s1, const char *s2, size_t n); /* 370 */
int (*tcl_StringCaseMatch) (const char *str, const char *pattern, int nocase); /* 371 */
int (*tcl_UniCharIsControl) (int ch); /* 372 */
int (*tcl_UniCharIsGraph) (int ch); /* 373 */
int (*tcl_UniCharIsPrint) (int ch); /* 374 */
int (*tcl_UniCharIsPunct) (int ch); /* 375 */
- int (*tcl_RegExpExecObj) (Tcl_Interp *interp, Tcl_RegExp regexp, Tcl_Obj *textObj, int offset, int nmatches, int flags); /* 376 */
+ int (*tcl_RegExpExecObj) (Tcl_Interp *interp, Tcl_RegExp regexp, Tcl_Obj *textObj, size_t offset, size_t nmatches, int flags); /* 376 */
void (*tcl_RegExpGetInfo) (Tcl_RegExp regexp, Tcl_RegExpInfo *infoPtr); /* 377 */
- Tcl_Obj * (*tcl_NewUnicodeObj) (const Tcl_UniChar *unicode, int numChars); /* 378 */
- void (*tcl_SetUnicodeObj) (Tcl_Obj *objPtr, const Tcl_UniChar *unicode, int numChars); /* 379 */
- int (*tcl_GetCharLength) (Tcl_Obj *objPtr); /* 380 */
- int (*tcl_GetUniChar) (Tcl_Obj *objPtr, int index); /* 381 */
- TCL_DEPRECATED_API("No longer in use, changed to macro") Tcl_UniChar * (*tcl_GetUnicode) (Tcl_Obj *objPtr); /* 382 */
- Tcl_Obj * (*tcl_GetRange) (Tcl_Obj *objPtr, int first, int last); /* 383 */
- void (*tcl_AppendUnicodeToObj) (Tcl_Obj *objPtr, const Tcl_UniChar *unicode, int length); /* 384 */
+ Tcl_Obj * (*tcl_NewUnicodeObj) (const Tcl_UniChar *unicode, size_t numChars); /* 378 */
+ void (*tcl_SetUnicodeObj) (Tcl_Obj *objPtr, const Tcl_UniChar *unicode, size_t numChars); /* 379 */
+ size_t (*tcl_GetCharLength) (Tcl_Obj *objPtr); /* 380 */
+ int (*tcl_GetUniChar) (Tcl_Obj *objPtr, size_t index); /* 381 */
+ void (*reserved382)(void);
+ Tcl_Obj * (*tcl_GetRange) (Tcl_Obj *objPtr, size_t first, size_t last); /* 383 */
+ void (*tcl_AppendUnicodeToObj) (Tcl_Obj *objPtr, const Tcl_UniChar *unicode, size_t length); /* 384 */
int (*tcl_RegExpMatchObj) (Tcl_Interp *interp, Tcl_Obj *textObj, Tcl_Obj *patternObj); /* 385 */
void (*tcl_SetNotifier) (Tcl_NotifierProcs *notifierProcPtr); /* 386 */
Tcl_Mutex * (*tcl_GetAllocMutex) (void); /* 387 */
int (*tcl_GetChannelNames) (Tcl_Interp *interp); /* 388 */
int (*tcl_GetChannelNamesEx) (Tcl_Interp *interp, const char *pattern); /* 389 */
- int (*tcl_ProcObjCmd) (ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* 390 */
+ int (*tcl_ProcObjCmd) (void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* 390 */
void (*tcl_ConditionFinalize) (Tcl_Condition *condPtr); /* 391 */
void (*tcl_MutexFinalize) (Tcl_Mutex *mutex); /* 392 */
- int (*tcl_CreateThread) (Tcl_ThreadId *idPtr, Tcl_ThreadCreateProc *proc, ClientData clientData, int stackSize, int flags); /* 393 */
- int (*tcl_ReadRaw) (Tcl_Channel chan, char *dst, int bytesToRead); /* 394 */
- int (*tcl_WriteRaw) (Tcl_Channel chan, const char *src, int srcLen); /* 395 */
+ int (*tcl_CreateThread) (Tcl_ThreadId *idPtr, Tcl_ThreadCreateProc *proc, void *clientData, size_t stackSize, int flags); /* 393 */
+ size_t (*tcl_ReadRaw) (Tcl_Channel chan, char *dst, size_t bytesToRead); /* 394 */
+ size_t (*tcl_WriteRaw) (Tcl_Channel chan, const char *src, size_t srcLen); /* 395 */
Tcl_Channel (*tcl_GetTopChannel) (Tcl_Channel chan); /* 396 */
int (*tcl_ChannelBuffered) (Tcl_Channel chan); /* 397 */
const char * (*tcl_ChannelName) (const Tcl_ChannelType *chanTypePtr); /* 398 */
@@ -2358,24 +2211,24 @@ typedef struct TclStubs {
void (*tcl_SpliceChannel) (Tcl_Channel channel); /* 416 */
void (*tcl_ClearChannelHandlers) (Tcl_Channel channel); /* 417 */
int (*tcl_IsChannelExisting) (const char *channelName); /* 418 */
- int (*tcl_UniCharNcasecmp) (const Tcl_UniChar *ucs, const Tcl_UniChar *uct, unsigned long numChars); /* 419 */
+ int (*tcl_UniCharNcasecmp) (const Tcl_UniChar *ucs, const Tcl_UniChar *uct, size_t numChars); /* 419 */
int (*tcl_UniCharCaseMatch) (const Tcl_UniChar *uniStr, const Tcl_UniChar *uniPattern, int nocase); /* 420 */
- Tcl_HashEntry * (*tcl_FindHashEntry) (Tcl_HashTable *tablePtr, const void *key); /* 421 */
- Tcl_HashEntry * (*tcl_CreateHashEntry) (Tcl_HashTable *tablePtr, const void *key, int *newPtr); /* 422 */
+ void (*reserved421)(void);
+ void (*reserved422)(void);
void (*tcl_InitCustomHashTable) (Tcl_HashTable *tablePtr, int keyType, const Tcl_HashKeyType *typePtr); /* 423 */
void (*tcl_InitObjHashTable) (Tcl_HashTable *tablePtr); /* 424 */
- ClientData (*tcl_CommandTraceInfo) (Tcl_Interp *interp, const char *varName, int flags, Tcl_CommandTraceProc *procPtr, ClientData prevClientData); /* 425 */
- int (*tcl_TraceCommand) (Tcl_Interp *interp, const char *varName, int flags, Tcl_CommandTraceProc *proc, ClientData clientData); /* 426 */
- void (*tcl_UntraceCommand) (Tcl_Interp *interp, const char *varName, int flags, Tcl_CommandTraceProc *proc, ClientData clientData); /* 427 */
- char * (*tcl_AttemptAlloc) (unsigned int size); /* 428 */
- char * (*tcl_AttemptDbCkalloc) (unsigned int size, const char *file, int line); /* 429 */
- char * (*tcl_AttemptRealloc) (char *ptr, unsigned int size); /* 430 */
- char * (*tcl_AttemptDbCkrealloc) (char *ptr, unsigned int size, const char *file, int line); /* 431 */
- int (*tcl_AttemptSetObjLength) (Tcl_Obj *objPtr, int length); /* 432 */
+ void * (*tcl_CommandTraceInfo) (Tcl_Interp *interp, const char *varName, int flags, Tcl_CommandTraceProc *procPtr, void *prevClientData); /* 425 */
+ int (*tcl_TraceCommand) (Tcl_Interp *interp, const char *varName, int flags, Tcl_CommandTraceProc *proc, void *clientData); /* 426 */
+ void (*tcl_UntraceCommand) (Tcl_Interp *interp, const char *varName, int flags, Tcl_CommandTraceProc *proc, void *clientData); /* 427 */
+ void * (*tcl_AttemptAlloc) (size_t size); /* 428 */
+ void * (*tcl_AttemptDbCkalloc) (size_t size, const char *file, int line); /* 429 */
+ void * (*tcl_AttemptRealloc) (void *ptr, size_t size); /* 430 */
+ void * (*tcl_AttemptDbCkrealloc) (void *ptr, size_t size, const char *file, int line); /* 431 */
+ int (*tcl_AttemptSetObjLength) (Tcl_Obj *objPtr, size_t length); /* 432 */
Tcl_ThreadId (*tcl_GetChannelThread) (Tcl_Channel channel); /* 433 */
Tcl_UniChar * (*tcl_GetUnicodeFromObj) (Tcl_Obj *objPtr, int *lengthPtr); /* 434 */
- TCL_DEPRECATED_API("") int (*tcl_GetMathFuncInfo) (Tcl_Interp *interp, const char *name, int *numArgsPtr, Tcl_ValueType **argTypesPtr, Tcl_MathProc **procPtr, ClientData *clientDataPtr); /* 435 */
- TCL_DEPRECATED_API("") Tcl_Obj * (*tcl_ListMathFuncs) (Tcl_Interp *interp, const char *pattern); /* 436 */
+ void (*reserved435)(void);
+ void (*reserved436)(void);
Tcl_Obj * (*tcl_SubstObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int flags); /* 437 */
int (*tcl_DetachChannel) (Tcl_Interp *interp, Tcl_Channel channel); /* 438 */
int (*tcl_IsStandardChannel) (Tcl_Channel channel); /* 439 */
@@ -2392,7 +2245,7 @@ typedef struct TclStubs {
int (*tcl_FSUtime) (Tcl_Obj *pathPtr, struct utimbuf *tval); /* 450 */
int (*tcl_FSFileAttrsGet) (Tcl_Interp *interp, int index, Tcl_Obj *pathPtr, Tcl_Obj **objPtrRef); /* 451 */
int (*tcl_FSFileAttrsSet) (Tcl_Interp *interp, int index, Tcl_Obj *pathPtr, Tcl_Obj *objPtr); /* 452 */
- const char *CONST86 * (*tcl_FSFileAttrStrings) (Tcl_Obj *pathPtr, Tcl_Obj **objPtrRef); /* 453 */
+ const char *const * (*tcl_FSFileAttrStrings) (Tcl_Obj *pathPtr, Tcl_Obj **objPtrRef); /* 453 */
int (*tcl_FSStat) (Tcl_Obj *pathPtr, Tcl_StatBuf *buf); /* 454 */
int (*tcl_FSAccess) (Tcl_Obj *pathPtr, int mode); /* 455 */
Tcl_Channel (*tcl_FSOpenFileChannel) (Tcl_Interp *interp, Tcl_Obj *pathPtr, const char *modeString, int permissions); /* 456 */
@@ -2404,25 +2257,25 @@ typedef struct TclStubs {
int (*tcl_FSEqualPaths) (Tcl_Obj *firstPtr, Tcl_Obj *secondPtr); /* 462 */
Tcl_Obj * (*tcl_FSGetNormalizedPath) (Tcl_Interp *interp, Tcl_Obj *pathPtr); /* 463 */
Tcl_Obj * (*tcl_FSJoinToPath) (Tcl_Obj *pathPtr, int objc, Tcl_Obj *const objv[]); /* 464 */
- ClientData (*tcl_FSGetInternalRep) (Tcl_Obj *pathPtr, const Tcl_Filesystem *fsPtr); /* 465 */
+ void * (*tcl_FSGetInternalRep) (Tcl_Obj *pathPtr, const Tcl_Filesystem *fsPtr); /* 465 */
Tcl_Obj * (*tcl_FSGetTranslatedPath) (Tcl_Interp *interp, Tcl_Obj *pathPtr); /* 466 */
int (*tcl_FSEvalFile) (Tcl_Interp *interp, Tcl_Obj *fileName); /* 467 */
- Tcl_Obj * (*tcl_FSNewNativePath) (const Tcl_Filesystem *fromFilesystem, ClientData clientData); /* 468 */
+ Tcl_Obj * (*tcl_FSNewNativePath) (const Tcl_Filesystem *fromFilesystem, void *clientData); /* 468 */
const void * (*tcl_FSGetNativePath) (Tcl_Obj *pathPtr); /* 469 */
Tcl_Obj * (*tcl_FSFileSystemInfo) (Tcl_Obj *pathPtr); /* 470 */
Tcl_Obj * (*tcl_FSPathSeparator) (Tcl_Obj *pathPtr); /* 471 */
Tcl_Obj * (*tcl_FSListVolumes) (void); /* 472 */
- int (*tcl_FSRegister) (ClientData clientData, const Tcl_Filesystem *fsPtr); /* 473 */
+ int (*tcl_FSRegister) (void *clientData, const Tcl_Filesystem *fsPtr); /* 473 */
int (*tcl_FSUnregister) (const Tcl_Filesystem *fsPtr); /* 474 */
- ClientData (*tcl_FSData) (const Tcl_Filesystem *fsPtr); /* 475 */
+ void * (*tcl_FSData) (const Tcl_Filesystem *fsPtr); /* 475 */
const char * (*tcl_FSGetTranslatedStringPath) (Tcl_Interp *interp, Tcl_Obj *pathPtr); /* 476 */
- CONST86 Tcl_Filesystem * (*tcl_FSGetFileSystemForPath) (Tcl_Obj *pathPtr); /* 477 */
+ const Tcl_Filesystem * (*tcl_FSGetFileSystemForPath) (Tcl_Obj *pathPtr); /* 477 */
Tcl_PathType (*tcl_FSGetPathType) (Tcl_Obj *pathPtr); /* 478 */
int (*tcl_OutputBuffered) (Tcl_Channel chan); /* 479 */
void (*tcl_FSMountsChanged) (const Tcl_Filesystem *fsPtr); /* 480 */
- int (*tcl_EvalTokensStandard) (Tcl_Interp *interp, Tcl_Token *tokenPtr, int count); /* 481 */
+ int (*tcl_EvalTokensStandard) (Tcl_Interp *interp, Tcl_Token *tokenPtr, size_t count); /* 481 */
void (*tcl_GetTime) (Tcl_Time *timeBuf); /* 482 */
- Tcl_Trace (*tcl_CreateObjTrace) (Tcl_Interp *interp, int level, int flags, Tcl_CmdObjTraceProc *objProc, ClientData clientData, Tcl_CmdObjTraceDeleteProc *delProc); /* 483 */
+ Tcl_Trace (*tcl_CreateObjTrace) (Tcl_Interp *interp, int level, int flags, Tcl_CmdObjTraceProc *objProc, void *clientData, Tcl_CmdObjTraceDeleteProc *delProc); /* 483 */
int (*tcl_GetCommandInfoFromToken) (Tcl_Command token, Tcl_CmdInfo *infoPtr); /* 484 */
int (*tcl_SetCommandInfoFromToken) (Tcl_Command token, const Tcl_CmdInfo *infoPtr); /* 485 */
Tcl_Obj * (*tcl_DbNewWideIntObj) (Tcl_WideInt wideValue, const char *file, int line); /* 486 */
@@ -2445,7 +2298,7 @@ typedef struct TclStubs {
Tcl_Obj * (*tcl_NewDictObj) (void); /* 503 */
Tcl_Obj * (*tcl_DbNewDictObj) (const char *file, int line); /* 504 */
void (*tcl_RegisterConfig) (Tcl_Interp *interp, const char *pkgName, const Tcl_Config *configuration, const char *valEncoding); /* 505 */
- Tcl_Namespace * (*tcl_CreateNamespace) (Tcl_Interp *interp, const char *name, ClientData clientData, Tcl_NamespaceDeleteProc *deleteProc); /* 506 */
+ Tcl_Namespace * (*tcl_CreateNamespace) (Tcl_Interp *interp, const char *name, void *clientData, Tcl_NamespaceDeleteProc *deleteProc); /* 506 */
void (*tcl_DeleteNamespace) (Tcl_Namespace *nsPtr); /* 507 */
int (*tcl_AppendExportList) (Tcl_Interp *interp, Tcl_Namespace *nsPtr, Tcl_Obj *objPtr); /* 508 */
int (*tcl_Export) (Tcl_Interp *interp, Tcl_Namespace *nsPtr, const char *pattern, int resetListFirst); /* 509 */
@@ -2458,9 +2311,9 @@ typedef struct TclStubs {
Tcl_Command (*tcl_GetCommandFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr); /* 516 */
void (*tcl_GetCommandFullName) (Tcl_Interp *interp, Tcl_Command command, Tcl_Obj *objPtr); /* 517 */
int (*tcl_FSEvalFileEx) (Tcl_Interp *interp, Tcl_Obj *fileName, const char *encodingName); /* 518 */
- TCL_DEPRECATED_API("Don't use this function in a stub-enabled extension") Tcl_ExitProc * (*tcl_SetExitProc) (TCL_NORETURN1 Tcl_ExitProc *proc); /* 519 */
- void (*tcl_LimitAddHandler) (Tcl_Interp *interp, int type, Tcl_LimitHandlerProc *handlerProc, ClientData clientData, Tcl_LimitHandlerDeleteProc *deleteProc); /* 520 */
- void (*tcl_LimitRemoveHandler) (Tcl_Interp *interp, int type, Tcl_LimitHandlerProc *handlerProc, ClientData clientData); /* 521 */
+ void (*reserved519)(void);
+ void (*tcl_LimitAddHandler) (Tcl_Interp *interp, int type, Tcl_LimitHandlerProc *handlerProc, void *clientData, Tcl_LimitHandlerDeleteProc *deleteProc); /* 520 */
+ void (*tcl_LimitRemoveHandler) (Tcl_Interp *interp, int type, Tcl_LimitHandlerProc *handlerProc, void *clientData); /* 521 */
int (*tcl_LimitReady) (Tcl_Interp *interp); /* 522 */
int (*tcl_LimitCheck) (Tcl_Interp *interp); /* 523 */
int (*tcl_LimitExceeded) (Tcl_Interp *interp); /* 524 */
@@ -2491,8 +2344,8 @@ typedef struct TclStubs {
int (*tcl_GetEnsembleUnknownHandler) (Tcl_Interp *interp, Tcl_Command token, Tcl_Obj **unknownListPtr); /* 549 */
int (*tcl_GetEnsembleFlags) (Tcl_Interp *interp, Tcl_Command token, int *flagsPtr); /* 550 */
int (*tcl_GetEnsembleNamespace) (Tcl_Interp *interp, Tcl_Command token, Tcl_Namespace **namespacePtrPtr); /* 551 */
- void (*tcl_SetTimeProc) (Tcl_GetTimeProc *getProc, Tcl_ScaleTimeProc *scaleProc, ClientData clientData); /* 552 */
- void (*tcl_QueryTimeProc) (Tcl_GetTimeProc **getProc, Tcl_ScaleTimeProc **scaleProc, ClientData *clientData); /* 553 */
+ void (*tcl_SetTimeProc) (Tcl_GetTimeProc *getProc, Tcl_ScaleTimeProc *scaleProc, void *clientData); /* 552 */
+ void (*tcl_QueryTimeProc) (Tcl_GetTimeProc **getProc, Tcl_ScaleTimeProc **scaleProc, void **clientData); /* 553 */
Tcl_DriverThreadActionProc * (*tcl_ChannelThreadActionProc) (const Tcl_ChannelType *chanTypePtr); /* 554 */
Tcl_Obj * (*tcl_NewBignumObj) (mp_int *value); /* 555 */
Tcl_Obj * (*tcl_DbNewBignumObj) (mp_int *value, const char *file, int line); /* 556 */
@@ -2514,20 +2367,20 @@ typedef struct TclStubs {
const char * (*tcl_GetEncodingNameFromEnvironment) (Tcl_DString *bufPtr); /* 572 */
int (*tcl_PkgRequireProc) (Tcl_Interp *interp, const char *name, int objc, Tcl_Obj *const objv[], void *clientDataPtr); /* 573 */
void (*tcl_AppendObjToErrorInfo) (Tcl_Interp *interp, Tcl_Obj *objPtr); /* 574 */
- void (*tcl_AppendLimitedToObj) (Tcl_Obj *objPtr, const char *bytes, int length, int limit, const char *ellipsis); /* 575 */
+ void (*tcl_AppendLimitedToObj) (Tcl_Obj *objPtr, const char *bytes, size_t length, size_t limit, const char *ellipsis); /* 575 */
Tcl_Obj * (*tcl_Format) (Tcl_Interp *interp, const char *format, int objc, Tcl_Obj *const objv[]); /* 576 */
int (*tcl_AppendFormatToObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, const char *format, int objc, Tcl_Obj *const objv[]); /* 577 */
Tcl_Obj * (*tcl_ObjPrintf) (const char *format, ...) TCL_FORMAT_PRINTF(1, 2); /* 578 */
void (*tcl_AppendPrintfToObj) (Tcl_Obj *objPtr, const char *format, ...) TCL_FORMAT_PRINTF(2, 3); /* 579 */
- int (*tcl_CancelEval) (Tcl_Interp *interp, Tcl_Obj *resultObjPtr, ClientData clientData, int flags); /* 580 */
+ int (*tcl_CancelEval) (Tcl_Interp *interp, Tcl_Obj *resultObjPtr, void *clientData, int flags); /* 580 */
int (*tcl_Canceled) (Tcl_Interp *interp, int flags); /* 581 */
int (*tcl_CreatePipe) (Tcl_Interp *interp, Tcl_Channel *rchan, Tcl_Channel *wchan, int flags); /* 582 */
- Tcl_Command (*tcl_NRCreateCommand) (Tcl_Interp *interp, const char *cmdName, Tcl_ObjCmdProc *proc, Tcl_ObjCmdProc *nreProc, ClientData clientData, Tcl_CmdDeleteProc *deleteProc); /* 583 */
+ Tcl_Command (*tcl_NRCreateCommand) (Tcl_Interp *interp, const char *cmdName, Tcl_ObjCmdProc *proc, Tcl_ObjCmdProc *nreProc, void *clientData, Tcl_CmdDeleteProc *deleteProc); /* 583 */
int (*tcl_NREvalObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int flags); /* 584 */
int (*tcl_NREvalObjv) (Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], int flags); /* 585 */
int (*tcl_NRCmdSwap) (Tcl_Interp *interp, Tcl_Command cmd, int objc, Tcl_Obj *const objv[], int flags); /* 586 */
- void (*tcl_NRAddCallback) (Tcl_Interp *interp, Tcl_NRPostProc *postProcPtr, ClientData data0, ClientData data1, ClientData data2, ClientData data3); /* 587 */
- int (*tcl_NRCallObjProc) (Tcl_Interp *interp, Tcl_ObjCmdProc *objProc, ClientData clientData, int objc, Tcl_Obj *const objv[]); /* 588 */
+ void (*tcl_NRAddCallback) (Tcl_Interp *interp, Tcl_NRPostProc *postProcPtr, void *data0, void *data1, void *data2, void *data3); /* 587 */
+ int (*tcl_NRCallObjProc) (Tcl_Interp *interp, Tcl_ObjCmdProc *objProc, void *clientData, int objc, Tcl_Obj *const objv[]); /* 588 */
unsigned (*tcl_GetFSDeviceFromStat) (const Tcl_StatBuf *statPtr); /* 589 */
unsigned (*tcl_GetFSInodeFromStat) (const Tcl_StatBuf *statPtr); /* 590 */
unsigned (*tcl_GetModeFromStat) (const Tcl_StatBuf *statPtr); /* 591 */
@@ -2550,15 +2403,15 @@ typedef struct TclStubs {
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 */
- int (*tcl_ZlibInflate) (Tcl_Interp *interp, int format, Tcl_Obj *data, int buffersize, Tcl_Obj *gzipHeaderDictObj); /* 611 */
- unsigned int (*tcl_ZlibCRC32) (unsigned int crc, const unsigned char *buf, int len); /* 612 */
- unsigned int (*tcl_ZlibAdler32) (unsigned int adler, const unsigned char *buf, int len); /* 613 */
+ int (*tcl_ZlibInflate) (Tcl_Interp *interp, int format, Tcl_Obj *data, size_t buffersize, Tcl_Obj *gzipHeaderDictObj); /* 611 */
+ unsigned int (*tcl_ZlibCRC32) (unsigned int crc, const unsigned char *buf, size_t len); /* 612 */
+ unsigned int (*tcl_ZlibAdler32) (unsigned int adler, const unsigned char *buf, size_t len); /* 613 */
int (*tcl_ZlibStreamInit) (Tcl_Interp *interp, int mode, int format, int level, Tcl_Obj *dictObj, Tcl_ZlibStream *zshandle); /* 614 */
Tcl_Obj * (*tcl_ZlibStreamGetCommandName) (Tcl_ZlibStream zshandle); /* 615 */
int (*tcl_ZlibStreamEof) (Tcl_ZlibStream zshandle); /* 616 */
int (*tcl_ZlibStreamChecksum) (Tcl_ZlibStream zshandle); /* 617 */
int (*tcl_ZlibStreamPut) (Tcl_ZlibStream zshandle, Tcl_Obj *data, int flush); /* 618 */
- int (*tcl_ZlibStreamGet) (Tcl_ZlibStream zshandle, Tcl_Obj *data, int count); /* 619 */
+ int (*tcl_ZlibStreamGet) (Tcl_ZlibStream zshandle, Tcl_Obj *data, size_t count); /* 619 */
int (*tcl_ZlibStreamClose) (Tcl_ZlibStream zshandle); /* 620 */
int (*tcl_ZlibStreamReset) (Tcl_ZlibStream zshandle); /* 621 */
void (*tcl_SetStartupScript) (Tcl_Obj *path, const char *encoding); /* 622 */
@@ -2570,21 +2423,21 @@ typedef struct TclStubs {
void * (*tcl_FindSymbol) (Tcl_Interp *interp, Tcl_LoadHandle handle, const char *symbol); /* 628 */
int (*tcl_FSUnloadFile) (Tcl_Interp *interp, Tcl_LoadHandle handlePtr); /* 629 */
void (*tcl_ZlibStreamSetCompressionDictionary) (Tcl_ZlibStream zhandle, Tcl_Obj *compressionDictionaryObj); /* 630 */
- Tcl_Channel (*tcl_OpenTcpServerEx) (Tcl_Interp *interp, const char *service, const char *host, unsigned int flags, Tcl_TcpAcceptProc *acceptProc, ClientData callbackData); /* 631 */
+ Tcl_Channel (*tcl_OpenTcpServerEx) (Tcl_Interp *interp, const char *service, const char *host, unsigned int flags, Tcl_TcpAcceptProc *acceptProc, void *callbackData); /* 631 */
int (*tclZipfs_Mount) (Tcl_Interp *interp, const char *mountPoint, const char *zipname, const char *passwd); /* 632 */
int (*tclZipfs_Unmount) (Tcl_Interp *interp, const char *mountPoint); /* 633 */
Tcl_Obj * (*tclZipfs_TclLibrary) (void); /* 634 */
int (*tclZipfs_MountBuffer) (Tcl_Interp *interp, const char *mountPoint, unsigned char *data, size_t datalen, int copy); /* 635 */
void (*tcl_FreeIntRep) (Tcl_Obj *objPtr); /* 636 */
- char * (*tcl_InitStringRep) (Tcl_Obj *objPtr, const char *bytes, unsigned int numBytes); /* 637 */
+ char * (*tcl_InitStringRep) (Tcl_Obj *objPtr, const char *bytes, size_t numBytes); /* 637 */
Tcl_ObjIntRep * (*tcl_FetchIntRep) (Tcl_Obj *objPtr, const Tcl_ObjType *typePtr); /* 638 */
void (*tcl_StoreIntRep) (Tcl_Obj *objPtr, const Tcl_ObjType *typePtr, const Tcl_ObjIntRep *irPtr); /* 639 */
int (*tcl_HasStringRep) (Tcl_Obj *objPtr); /* 640 */
void (*tcl_IncrRefCount) (Tcl_Obj *objPtr); /* 641 */
void (*tcl_DecrRefCount) (Tcl_Obj *objPtr); /* 642 */
int (*tcl_IsShared) (Tcl_Obj *objPtr); /* 643 */
- int (*tcl_LinkArray) (Tcl_Interp *interp, const char *varName, void *addr, int type, int size); /* 644 */
- int (*tcl_GetIntForIndex) (Tcl_Interp *interp, Tcl_Obj *objPtr, int endValue, int *indexPtr); /* 645 */
+ int (*tcl_LinkArray) (Tcl_Interp *interp, const char *varName, void *addr, int type, size_t size); /* 644 */
+ int (*tcl_GetIntForIndex) (Tcl_Interp *interp, Tcl_Obj *objPtr, size_t endValue, size_t *indexPtr); /* 645 */
} TclStubs;
extern const TclStubs *tclStubsPtr;
@@ -2655,24 +2508,21 @@ extern const TclStubs *tclStubsPtr;
(tclStubsPtr->tcl_DbIncrRefCount) /* 20 */
#define Tcl_DbIsShared \
(tclStubsPtr->tcl_DbIsShared) /* 21 */
-#define Tcl_DbNewBooleanObj \
- (tclStubsPtr->tcl_DbNewBooleanObj) /* 22 */
+/* Slot 22 is reserved */
#define Tcl_DbNewByteArrayObj \
(tclStubsPtr->tcl_DbNewByteArrayObj) /* 23 */
#define Tcl_DbNewDoubleObj \
(tclStubsPtr->tcl_DbNewDoubleObj) /* 24 */
#define Tcl_DbNewListObj \
(tclStubsPtr->tcl_DbNewListObj) /* 25 */
-#define Tcl_DbNewLongObj \
- (tclStubsPtr->tcl_DbNewLongObj) /* 26 */
+/* Slot 26 is reserved */
#define Tcl_DbNewObj \
(tclStubsPtr->tcl_DbNewObj) /* 27 */
#define Tcl_DbNewStringObj \
(tclStubsPtr->tcl_DbNewStringObj) /* 28 */
#define Tcl_DuplicateObj \
(tclStubsPtr->tcl_DuplicateObj) /* 29 */
-#define TclOldFreeObj \
- (tclStubsPtr->tclOldFreeObj) /* 30 */
+/* Slot 30 is reserved */
#define Tcl_GetBoolean \
(tclStubsPtr->tcl_GetBoolean) /* 31 */
#define Tcl_GetBooleanFromObj \
@@ -2683,8 +2533,7 @@ extern const TclStubs *tclStubsPtr;
(tclStubsPtr->tcl_GetDouble) /* 34 */
#define Tcl_GetDoubleFromObj \
(tclStubsPtr->tcl_GetDoubleFromObj) /* 35 */
-#define Tcl_GetIndexFromObj \
- (tclStubsPtr->tcl_GetIndexFromObj) /* 36 */
+/* Slot 36 is reserved */
#define Tcl_GetInt \
(tclStubsPtr->tcl_GetInt) /* 37 */
#define Tcl_GetIntFromObj \
@@ -2709,44 +2558,36 @@ extern const TclStubs *tclStubsPtr;
(tclStubsPtr->tcl_ListObjLength) /* 47 */
#define Tcl_ListObjReplace \
(tclStubsPtr->tcl_ListObjReplace) /* 48 */
-#define Tcl_NewBooleanObj \
- (tclStubsPtr->tcl_NewBooleanObj) /* 49 */
+/* Slot 49 is reserved */
#define Tcl_NewByteArrayObj \
(tclStubsPtr->tcl_NewByteArrayObj) /* 50 */
#define Tcl_NewDoubleObj \
(tclStubsPtr->tcl_NewDoubleObj) /* 51 */
-#define Tcl_NewIntObj \
- (tclStubsPtr->tcl_NewIntObj) /* 52 */
+/* Slot 52 is reserved */
#define Tcl_NewListObj \
(tclStubsPtr->tcl_NewListObj) /* 53 */
-#define Tcl_NewLongObj \
- (tclStubsPtr->tcl_NewLongObj) /* 54 */
+/* Slot 54 is reserved */
#define Tcl_NewObj \
(tclStubsPtr->tcl_NewObj) /* 55 */
#define Tcl_NewStringObj \
(tclStubsPtr->tcl_NewStringObj) /* 56 */
-#define Tcl_SetBooleanObj \
- (tclStubsPtr->tcl_SetBooleanObj) /* 57 */
+/* Slot 57 is reserved */
#define Tcl_SetByteArrayLength \
(tclStubsPtr->tcl_SetByteArrayLength) /* 58 */
#define Tcl_SetByteArrayObj \
(tclStubsPtr->tcl_SetByteArrayObj) /* 59 */
#define Tcl_SetDoubleObj \
(tclStubsPtr->tcl_SetDoubleObj) /* 60 */
-#define Tcl_SetIntObj \
- (tclStubsPtr->tcl_SetIntObj) /* 61 */
+/* Slot 61 is reserved */
#define Tcl_SetListObj \
(tclStubsPtr->tcl_SetListObj) /* 62 */
-#define Tcl_SetLongObj \
- (tclStubsPtr->tcl_SetLongObj) /* 63 */
+/* Slot 63 is reserved */
#define Tcl_SetObjLength \
(tclStubsPtr->tcl_SetObjLength) /* 64 */
#define Tcl_SetStringObj \
(tclStubsPtr->tcl_SetStringObj) /* 65 */
-#define Tcl_AddErrorInfo \
- (tclStubsPtr->tcl_AddErrorInfo) /* 66 */
-#define Tcl_AddObjErrorInfo \
- (tclStubsPtr->tcl_AddObjErrorInfo) /* 67 */
+/* Slot 66 is reserved */
+/* Slot 67 is reserved */
#define Tcl_AllowExceptions \
(tclStubsPtr->tcl_AllowExceptions) /* 68 */
#define Tcl_AppendElement \
@@ -2763,10 +2604,8 @@ extern const TclStubs *tclStubsPtr;
(tclStubsPtr->tcl_AsyncMark) /* 74 */
#define Tcl_AsyncReady \
(tclStubsPtr->tcl_AsyncReady) /* 75 */
-#define Tcl_BackgroundError \
- (tclStubsPtr->tcl_BackgroundError) /* 76 */
-#define Tcl_Backslash \
- (tclStubsPtr->tcl_Backslash) /* 77 */
+/* Slot 76 is reserved */
+/* Slot 77 is reserved */
#define Tcl_BadChannelOption \
(tclStubsPtr->tcl_BadChannelOption) /* 78 */
#define Tcl_CallWhenDeleted \
@@ -2801,8 +2640,7 @@ extern const TclStubs *tclStubsPtr;
(tclStubsPtr->tcl_CreateExitHandler) /* 93 */
#define Tcl_CreateInterp \
(tclStubsPtr->tcl_CreateInterp) /* 94 */
-#define Tcl_CreateMathFunc \
- (tclStubsPtr->tcl_CreateMathFunc) /* 95 */
+/* Slot 95 is reserved */
#define Tcl_CreateObjCommand \
(tclStubsPtr->tcl_CreateObjCommand) /* 96 */
#define Tcl_CreateSlave \
@@ -2869,12 +2707,10 @@ extern const TclStubs *tclStubsPtr;
(tclStubsPtr->tcl_ErrnoId) /* 127 */
#define Tcl_ErrnoMsg \
(tclStubsPtr->tcl_ErrnoMsg) /* 128 */
-#define Tcl_Eval \
- (tclStubsPtr->tcl_Eval) /* 129 */
+/* Slot 129 is reserved */
#define Tcl_EvalFile \
(tclStubsPtr->tcl_EvalFile) /* 130 */
-#define Tcl_EvalObj \
- (tclStubsPtr->tcl_EvalObj) /* 131 */
+/* Slot 131 is reserved */
#define Tcl_EventuallyFree \
(tclStubsPtr->tcl_EventuallyFree) /* 132 */
#define Tcl_Exit \
@@ -2899,8 +2735,7 @@ extern const TclStubs *tclStubsPtr;
(tclStubsPtr->tcl_ExprString) /* 142 */
#define Tcl_Finalize \
(tclStubsPtr->tcl_Finalize) /* 143 */
-#define Tcl_FindExecutable \
- (tclStubsPtr->tcl_FindExecutable) /* 144 */
+/* Slot 144 is reserved */
#define Tcl_FirstHashEntry \
(tclStubsPtr->tcl_FirstHashEntry) /* 145 */
#define Tcl_Flush \
@@ -2965,16 +2800,12 @@ extern const TclStubs *tclStubsPtr;
(tclStubsPtr->tcl_GetSlave) /* 172 */
#define Tcl_GetStdChannel \
(tclStubsPtr->tcl_GetStdChannel) /* 173 */
-#define Tcl_GetStringResult \
- (tclStubsPtr->tcl_GetStringResult) /* 174 */
-#define Tcl_GetVar \
- (tclStubsPtr->tcl_GetVar) /* 175 */
+/* Slot 174 is reserved */
+/* Slot 175 is reserved */
#define Tcl_GetVar2 \
(tclStubsPtr->tcl_GetVar2) /* 176 */
-#define Tcl_GlobalEval \
- (tclStubsPtr->tcl_GlobalEval) /* 177 */
-#define Tcl_GlobalEvalObj \
- (tclStubsPtr->tcl_GlobalEvalObj) /* 178 */
+/* Slot 177 is reserved */
+/* Slot 178 is reserved */
#define Tcl_HideCommand \
(tclStubsPtr->tcl_HideCommand) /* 179 */
#define Tcl_Init \
@@ -3056,8 +2887,7 @@ extern const TclStubs *tclStubsPtr;
(tclStubsPtr->tcl_ScanElement) /* 218 */
#define Tcl_ScanCountedElement \
(tclStubsPtr->tcl_ScanCountedElement) /* 219 */
-#define Tcl_SeekOld \
- (tclStubsPtr->tcl_SeekOld) /* 220 */
+/* Slot 220 is reserved */
#define Tcl_ServiceAll \
(tclStubsPtr->tcl_ServiceAll) /* 221 */
#define Tcl_ServiceEvent \
@@ -3076,12 +2906,10 @@ extern const TclStubs *tclStubsPtr;
(tclStubsPtr->tcl_SetErrorCode) /* 228 */
#define Tcl_SetMaxBlockTime \
(tclStubsPtr->tcl_SetMaxBlockTime) /* 229 */
-#define Tcl_SetPanicProc \
- (tclStubsPtr->tcl_SetPanicProc) /* 230 */
+/* Slot 230 is reserved */
#define Tcl_SetRecursionLimit \
(tclStubsPtr->tcl_SetRecursionLimit) /* 231 */
-#define Tcl_SetResult \
- (tclStubsPtr->tcl_SetResult) /* 232 */
+/* Slot 232 is reserved */
#define Tcl_SetServiceMode \
(tclStubsPtr->tcl_SetServiceMode) /* 233 */
#define Tcl_SetObjErrorCode \
@@ -3090,8 +2918,7 @@ extern const TclStubs *tclStubsPtr;
(tclStubsPtr->tcl_SetObjResult) /* 235 */
#define Tcl_SetStdChannel \
(tclStubsPtr->tcl_SetStdChannel) /* 236 */
-#define Tcl_SetVar \
- (tclStubsPtr->tcl_SetVar) /* 237 */
+/* Slot 237 is reserved */
#define Tcl_SetVar2 \
(tclStubsPtr->tcl_SetVar2) /* 238 */
#define Tcl_SignalId \
@@ -3104,14 +2931,10 @@ extern const TclStubs *tclStubsPtr;
(tclStubsPtr->tcl_SplitList) /* 242 */
#define Tcl_SplitPath \
(tclStubsPtr->tcl_SplitPath) /* 243 */
-#define Tcl_StaticPackage \
- (tclStubsPtr->tcl_StaticPackage) /* 244 */
-#define Tcl_StringMatch \
- (tclStubsPtr->tcl_StringMatch) /* 245 */
-#define Tcl_TellOld \
- (tclStubsPtr->tcl_TellOld) /* 246 */
-#define Tcl_TraceVar \
- (tclStubsPtr->tcl_TraceVar) /* 247 */
+/* Slot 244 is reserved */
+/* Slot 245 is reserved */
+/* Slot 246 is reserved */
+/* Slot 247 is reserved */
#define Tcl_TraceVar2 \
(tclStubsPtr->tcl_TraceVar2) /* 248 */
#define Tcl_TranslateFileName \
@@ -3122,24 +2945,20 @@ extern const TclStubs *tclStubsPtr;
(tclStubsPtr->tcl_UnlinkVar) /* 251 */
#define Tcl_UnregisterChannel \
(tclStubsPtr->tcl_UnregisterChannel) /* 252 */
-#define Tcl_UnsetVar \
- (tclStubsPtr->tcl_UnsetVar) /* 253 */
+/* Slot 253 is reserved */
#define Tcl_UnsetVar2 \
(tclStubsPtr->tcl_UnsetVar2) /* 254 */
-#define Tcl_UntraceVar \
- (tclStubsPtr->tcl_UntraceVar) /* 255 */
+/* Slot 255 is reserved */
#define Tcl_UntraceVar2 \
(tclStubsPtr->tcl_UntraceVar2) /* 256 */
#define Tcl_UpdateLinkedVar \
(tclStubsPtr->tcl_UpdateLinkedVar) /* 257 */
-#define Tcl_UpVar \
- (tclStubsPtr->tcl_UpVar) /* 258 */
+/* Slot 258 is reserved */
#define Tcl_UpVar2 \
(tclStubsPtr->tcl_UpVar2) /* 259 */
#define Tcl_VarEval \
(tclStubsPtr->tcl_VarEval) /* 260 */
-#define Tcl_VarTraceInfo \
- (tclStubsPtr->tcl_VarTraceInfo) /* 261 */
+/* Slot 261 is reserved */
#define Tcl_VarTraceInfo2 \
(tclStubsPtr->tcl_VarTraceInfo2) /* 262 */
#define Tcl_Write \
@@ -3150,30 +2969,22 @@ extern const TclStubs *tclStubsPtr;
(tclStubsPtr->tcl_DumpActiveMemory) /* 265 */
#define Tcl_ValidateAllMemory \
(tclStubsPtr->tcl_ValidateAllMemory) /* 266 */
-#define Tcl_AppendResultVA \
- (tclStubsPtr->tcl_AppendResultVA) /* 267 */
-#define Tcl_AppendStringsToObjVA \
- (tclStubsPtr->tcl_AppendStringsToObjVA) /* 268 */
+/* Slot 267 is reserved */
+/* Slot 268 is reserved */
#define Tcl_HashStats \
(tclStubsPtr->tcl_HashStats) /* 269 */
#define Tcl_ParseVar \
(tclStubsPtr->tcl_ParseVar) /* 270 */
-#define Tcl_PkgPresent \
- (tclStubsPtr->tcl_PkgPresent) /* 271 */
+/* Slot 271 is reserved */
#define Tcl_PkgPresentEx \
(tclStubsPtr->tcl_PkgPresentEx) /* 272 */
-#define Tcl_PkgProvide \
- (tclStubsPtr->tcl_PkgProvide) /* 273 */
-#define Tcl_PkgRequire \
- (tclStubsPtr->tcl_PkgRequire) /* 274 */
-#define Tcl_SetErrorCodeVA \
- (tclStubsPtr->tcl_SetErrorCodeVA) /* 275 */
-#define Tcl_VarEvalVA \
- (tclStubsPtr->tcl_VarEvalVA) /* 276 */
+/* Slot 273 is reserved */
+/* Slot 274 is reserved */
+/* Slot 275 is reserved */
+/* Slot 276 is reserved */
#define Tcl_WaitPid \
(tclStubsPtr->tcl_WaitPid) /* 277 */
-#define Tcl_PanicVA \
- (tclStubsPtr->tcl_PanicVA) /* 278 */
+/* Slot 278 is reserved */
#define Tcl_GetVersion \
(tclStubsPtr->tcl_GetVersion) /* 279 */
#define Tcl_InitMemory \
@@ -3195,8 +3006,7 @@ extern const TclStubs *tclStubsPtr;
(tclStubsPtr->tcl_CreateThreadExitHandler) /* 288 */
#define Tcl_DeleteThreadExitHandler \
(tclStubsPtr->tcl_DeleteThreadExitHandler) /* 289 */
-#define Tcl_DiscardResult \
- (tclStubsPtr->tcl_DiscardResult) /* 290 */
+/* Slot 290 is reserved */
#define Tcl_EvalEx \
(tclStubsPtr->tcl_EvalEx) /* 291 */
#define Tcl_EvalObjv \
@@ -3243,10 +3053,8 @@ extern const TclStubs *tclStubsPtr;
(tclStubsPtr->tcl_NumUtfChars) /* 312 */
#define Tcl_ReadChars \
(tclStubsPtr->tcl_ReadChars) /* 313 */
-#define Tcl_RestoreResult \
- (tclStubsPtr->tcl_RestoreResult) /* 314 */
-#define Tcl_SaveResult \
- (tclStubsPtr->tcl_SaveResult) /* 315 */
+/* Slot 314 is reserved */
+/* Slot 315 is reserved */
#define Tcl_SetSystemEncoding \
(tclStubsPtr->tcl_SetSystemEncoding) /* 316 */
#define Tcl_SetVar2Ex \
@@ -3297,10 +3105,8 @@ extern const TclStubs *tclStubsPtr;
(tclStubsPtr->tcl_WriteObj) /* 339 */
#define Tcl_GetString \
(tclStubsPtr->tcl_GetString) /* 340 */
-#define Tcl_GetDefaultEncodingDir \
- (tclStubsPtr->tcl_GetDefaultEncodingDir) /* 341 */
-#define Tcl_SetDefaultEncodingDir \
- (tclStubsPtr->tcl_SetDefaultEncodingDir) /* 342 */
+/* Slot 341 is reserved */
+/* Slot 342 is reserved */
#define Tcl_AlertNotifier \
(tclStubsPtr->tcl_AlertNotifier) /* 343 */
#define Tcl_ServiceModeHook \
@@ -3329,8 +3135,7 @@ extern const TclStubs *tclStubsPtr;
(tclStubsPtr->tcl_UtfToUniCharDString) /* 355 */
#define Tcl_GetRegExpFromObj \
(tclStubsPtr->tcl_GetRegExpFromObj) /* 356 */
-#define Tcl_EvalTokens \
- (tclStubsPtr->tcl_EvalTokens) /* 357 */
+/* Slot 357 is reserved */
#define Tcl_FreeParse \
(tclStubsPtr->tcl_FreeParse) /* 358 */
#define Tcl_LogCommandInfo \
@@ -3379,8 +3184,7 @@ extern const TclStubs *tclStubsPtr;
(tclStubsPtr->tcl_GetCharLength) /* 380 */
#define Tcl_GetUniChar \
(tclStubsPtr->tcl_GetUniChar) /* 381 */
-#define Tcl_GetUnicode \
- (tclStubsPtr->tcl_GetUnicode) /* 382 */
+/* Slot 382 is reserved */
#define Tcl_GetRange \
(tclStubsPtr->tcl_GetRange) /* 383 */
#define Tcl_AppendUnicodeToObj \
@@ -3457,10 +3261,8 @@ extern const TclStubs *tclStubsPtr;
(tclStubsPtr->tcl_UniCharNcasecmp) /* 419 */
#define Tcl_UniCharCaseMatch \
(tclStubsPtr->tcl_UniCharCaseMatch) /* 420 */
-#define Tcl_FindHashEntry \
- (tclStubsPtr->tcl_FindHashEntry) /* 421 */
-#define Tcl_CreateHashEntry \
- (tclStubsPtr->tcl_CreateHashEntry) /* 422 */
+/* Slot 421 is reserved */
+/* Slot 422 is reserved */
#define Tcl_InitCustomHashTable \
(tclStubsPtr->tcl_InitCustomHashTable) /* 423 */
#define Tcl_InitObjHashTable \
@@ -3485,10 +3287,8 @@ extern const TclStubs *tclStubsPtr;
(tclStubsPtr->tcl_GetChannelThread) /* 433 */
#define Tcl_GetUnicodeFromObj \
(tclStubsPtr->tcl_GetUnicodeFromObj) /* 434 */
-#define Tcl_GetMathFuncInfo \
- (tclStubsPtr->tcl_GetMathFuncInfo) /* 435 */
-#define Tcl_ListMathFuncs \
- (tclStubsPtr->tcl_ListMathFuncs) /* 436 */
+/* Slot 435 is reserved */
+/* Slot 436 is reserved */
#define Tcl_SubstObj \
(tclStubsPtr->tcl_SubstObj) /* 437 */
#define Tcl_DetachChannel \
@@ -3653,8 +3453,7 @@ extern const TclStubs *tclStubsPtr;
(tclStubsPtr->tcl_GetCommandFullName) /* 517 */
#define Tcl_FSEvalFileEx \
(tclStubsPtr->tcl_FSEvalFileEx) /* 518 */
-#define Tcl_SetExitProc \
- (tclStubsPtr->tcl_SetExitProc) /* 519 */
+/* Slot 519 is reserved */
#define Tcl_LimitAddHandler \
(tclStubsPtr->tcl_LimitAddHandler) /* 520 */
#define Tcl_LimitRemoveHandler \
@@ -3914,15 +3713,9 @@ extern const TclStubs *tclStubsPtr;
#if defined(USE_TCL_STUBS)
# undef Tcl_CreateInterp
-# undef Tcl_FindExecutable
-# undef Tcl_GetStringResult
# undef Tcl_Init
-# undef Tcl_SetPanicProc
-# undef Tcl_SetExitProc
# undef Tcl_ObjSetVar2
-# undef Tcl_StaticPackage
# define Tcl_CreateInterp() (tclStubsPtr->tcl_CreateInterp())
-# define Tcl_GetStringResult(interp) (tclStubsPtr->tcl_GetStringResult(interp))
# define Tcl_Init(interp) (tclStubsPtr->tcl_Init(interp))
# define Tcl_ObjSetVar2(interp, part1, part2, newValue, flags) \
(tclStubsPtr->tcl_ObjSetVar2(interp, part1, part2, newValue, flags))
@@ -3931,7 +3724,7 @@ extern const TclStubs *tclStubsPtr;
#if defined(_WIN32) && defined(UNICODE)
# define Tcl_FindExecutable(arg) ((Tcl_FindExecutable)((const char *)(arg)))
# define Tcl_MainEx Tcl_MainExW
- EXTERN void Tcl_MainExW(int argc, wchar_t **argv,
+ EXTERN TCL_NORETURN void Tcl_MainExW(int argc, wchar_t **argv,
Tcl_AppInitProc *appInitProc, Tcl_Interp *interp);
EXTERN int TclZipfs_AppHook(int *argc, wchar_t ***argv);
#endif
@@ -3939,85 +3732,58 @@ extern const TclStubs *tclStubsPtr;
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLIMPORT
-#undef Tcl_SeekOld
-#undef Tcl_TellOld
-
-#undef Tcl_PkgPresent
#define Tcl_PkgPresent(interp, name, version, exact) \
Tcl_PkgPresentEx(interp, name, version, exact, NULL)
-#undef Tcl_PkgProvide
#define Tcl_PkgProvide(interp, name, version) \
Tcl_PkgProvideEx(interp, name, version, NULL)
-#undef Tcl_PkgRequire
#define Tcl_PkgRequire(interp, name, version, exact) \
Tcl_PkgRequireEx(interp, name, version, exact, NULL)
-#undef Tcl_GetIndexFromObj
#define Tcl_GetIndexFromObj(interp, objPtr, tablePtr, msg, flags, indexPtr) \
Tcl_GetIndexFromObjStruct(interp, objPtr, tablePtr, \
sizeof(char *), msg, flags, indexPtr)
-#undef Tcl_NewBooleanObj
#define Tcl_NewBooleanObj(boolValue) \
Tcl_NewWideIntObj((boolValue)!=0)
-#undef Tcl_DbNewBooleanObj
#define Tcl_DbNewBooleanObj(boolValue, file, line) \
Tcl_DbNewWideIntObj((boolValue)!=0, file, line)
-#undef Tcl_SetBooleanObj
#define Tcl_SetBooleanObj(objPtr, boolValue) \
Tcl_SetWideIntObj(objPtr, (boolValue)!=0)
-#undef Tcl_SetVar
#define Tcl_SetVar(interp, varName, newValue, flags) \
Tcl_SetVar2(interp, varName, NULL, newValue, flags)
-#undef Tcl_UnsetVar
#define Tcl_UnsetVar(interp, varName, flags) \
Tcl_UnsetVar2(interp, varName, NULL, flags)
-#undef Tcl_GetVar
#define Tcl_GetVar(interp, varName, flags) \
Tcl_GetVar2(interp, varName, NULL, flags)
-#undef Tcl_TraceVar
#define Tcl_TraceVar(interp, varName, flags, proc, clientData) \
Tcl_TraceVar2(interp, varName, NULL, flags, proc, clientData)
-#undef Tcl_UntraceVar
#define Tcl_UntraceVar(interp, varName, flags, proc, clientData) \
Tcl_UntraceVar2(interp, varName, NULL, flags, proc, clientData)
-#undef Tcl_VarTraceInfo
#define Tcl_VarTraceInfo(interp, varName, flags, proc, prevClientData) \
Tcl_VarTraceInfo2(interp, varName, NULL, flags, proc, prevClientData)
-#undef Tcl_UpVar
#define Tcl_UpVar(interp, frameName, varName, localName, flags) \
Tcl_UpVar2(interp, frameName, varName, NULL, localName, flags)
-#undef Tcl_AddErrorInfo
#define Tcl_AddErrorInfo(interp, message) \
Tcl_AppendObjToErrorInfo(interp, Tcl_NewStringObj(message, -1))
-#undef Tcl_AddObjErrorInfo
#define Tcl_AddObjErrorInfo(interp, message, length) \
Tcl_AppendObjToErrorInfo(interp, Tcl_NewStringObj(message, length))
-#ifdef TCL_NO_DEPRECATED
-#undef Tcl_GetStringResult
-#define Tcl_GetStringResult(interp) Tcl_GetString(Tcl_GetObjResult(interp))
-#undef Tcl_Eval
#define Tcl_Eval(interp, objPtr) \
Tcl_EvalEx(interp, objPtr, -1, 0)
-#undef Tcl_GlobalEval
#define Tcl_GlobalEval(interp, objPtr) \
Tcl_EvalEx(interp, objPtr, -1, TCL_EVAL_GLOBAL)
-#undef Tcl_SaveResult
+#define Tcl_GetStringResult(interp) Tcl_GetString(Tcl_GetObjResult(interp))
#define Tcl_SaveResult(interp, statePtr) \
do { \
- (statePtr)->objResultPtr = Tcl_GetObjResult(interp); \
- Tcl_IncrRefCount((statePtr)->objResultPtr); \
+ *(statePtr) = Tcl_GetObjResult(interp); \
+ Tcl_IncrRefCount(*(statePtr)); \
Tcl_SetObjResult(interp, Tcl_NewObj()); \
} while(0)
-#undef Tcl_RestoreResult
#define Tcl_RestoreResult(interp, statePtr) \
do { \
Tcl_ResetResult(interp); \
- Tcl_SetObjResult(interp, (statePtr)->objResultPtr); \
- Tcl_DecrRefCount((statePtr)->objResultPtr); \
+ Tcl_SetObjResult(interp, *(statePtr)); \
+ Tcl_DecrRefCount(*(statePtr)); \
} while(0)
-#undef Tcl_DiscardResult
#define Tcl_DiscardResult(statePtr) \
- Tcl_DecrRefCount((statePtr)->objResultPtr)
-#undef Tcl_SetResult
+ Tcl_DecrRefCount(*(statePtr))
#define Tcl_SetResult(interp, result, freeProc) \
do { \
char *__result = result; \
@@ -4025,13 +3791,12 @@ extern const TclStubs *tclStubsPtr;
Tcl_SetObjResult(interp, Tcl_NewStringObj(__result, -1)); \
if (__result != NULL && __freeProc != NULL && __freeProc != TCL_VOLATILE) { \
if (__freeProc == TCL_DYNAMIC) { \
- ckfree(__result); \
+ Tcl_Free(__result); \
} else { \
(*__freeProc)(__result); \
} \
} \
} while(0)
-#endif /* TCL_NO_DEPRECATED */
#if defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS)
# if defined(__CYGWIN__) && defined(TCL_WIDE_INT_IS_LONG)
@@ -4045,10 +3810,6 @@ extern const TclStubs *tclStubsPtr;
# undef Tcl_GetLongFromObj
# undef Tcl_ExprLong
# undef Tcl_ExprLongObj
-# undef Tcl_UniCharNcmp
-# undef Tcl_UtfNcmp
-# undef Tcl_UtfNcasecmp
-# undef Tcl_UniCharNcasecmp
# define Tcl_GetLongFromObj ((int(*)(Tcl_Interp*,Tcl_Obj*,long*))Tcl_GetWideIntFromObj)
# define Tcl_ExprLong TclExprLong
static inline int TclExprLong(Tcl_Interp *interp, const char *string, long *ptr){
@@ -4064,43 +3825,79 @@ extern const TclStubs *tclStubsPtr;
if (result == TCL_OK) *ptr = (long)intValue;
return result;
}
-# define Tcl_UniCharNcmp(ucs,uct,n) \
- ((int(*)(const Tcl_UniChar*,const Tcl_UniChar*,unsigned int))tclStubsPtr->tcl_UniCharNcmp)(ucs,uct,(unsigned int)(n))
-# define Tcl_UtfNcmp(s1,s2,n) \
- ((int(*)(const char*,const char*,unsigned int))tclStubsPtr->tcl_UtfNcmp)(s1,s2,(unsigned int)(n))
-# define Tcl_UtfNcasecmp(s1,s2,n) \
- ((int(*)(const char*,const char*,unsigned int))tclStubsPtr->tcl_UtfNcasecmp)(s1,s2,(unsigned int)(n))
-# define Tcl_UniCharNcasecmp(ucs,uct,n) \
- ((int(*)(const Tcl_UniChar*,const Tcl_UniChar*,unsigned int))tclStubsPtr->tcl_UniCharNcasecmp)(ucs,uct,(unsigned int)(n))
# endif
#endif
-#undef Tcl_NewLongObj
+#ifdef TCL_MEM_DEBUG
+# undef Tcl_Alloc
+# define Tcl_Alloc(x) \
+ (Tcl_DbCkalloc((x), __FILE__, __LINE__))
+# undef Tcl_Free
+# define Tcl_Free(x) \
+ Tcl_DbCkfree((x), __FILE__, __LINE__)
+# undef Tcl_Realloc
+# define Tcl_Realloc(x,y) \
+ (Tcl_DbCkrealloc((x), (y), __FILE__, __LINE__))
+# undef Tcl_AttemptAlloc
+# define Tcl_AttemptAlloc(x) \
+ (Tcl_AttemptDbCkalloc((x), __FILE__, __LINE__))
+# undef Tcl_AttemptRealloc
+# define Tcl_AttemptRealloc(x,y) \
+ (Tcl_AttemptDbCkrealloc((x), (y), __FILE__, __LINE__))
+#endif /* !TCL_MEM_DEBUG */
+
#define Tcl_NewLongObj(value) Tcl_NewWideIntObj((long)(value))
-#undef Tcl_NewIntObj
#define Tcl_NewIntObj(value) Tcl_NewWideIntObj((int)(value))
-#undef Tcl_DbNewLongObj
#define Tcl_DbNewLongObj(value, file, line) Tcl_DbNewWideIntObj((long)(value), file, line)
-#undef Tcl_SetIntObj
#define Tcl_SetIntObj(objPtr, value) Tcl_SetWideIntObj((objPtr), (int)(value))
-#undef Tcl_SetLongObj
#define Tcl_SetLongObj(objPtr, value) Tcl_SetWideIntObj((objPtr), (long)(value))
-#undef Tcl_GetUnicode
#define Tcl_GetUnicode(objPtr) Tcl_GetUnicodeFromObj((objPtr), NULL)
-#undef Tcl_BackgroundError
#define Tcl_BackgroundError(interp) Tcl_BackgroundException((interp), TCL_ERROR)
-#undef Tcl_StringMatch
#define Tcl_StringMatch(str, pattern) Tcl_StringCaseMatch((str), (pattern), 0)
/*
* Deprecated Tcl procedures:
*/
-#undef Tcl_EvalObj
#define Tcl_EvalObj(interp, objPtr) \
Tcl_EvalObjEx(interp, objPtr, 0)
-#undef Tcl_GlobalEvalObj
#define Tcl_GlobalEvalObj(interp, objPtr) \
Tcl_EvalObjEx(interp, objPtr, TCL_EVAL_GLOBAL)
+#if defined(TCL_8_COMPAT) && !defined(BUILD_tcl)
+# ifdef USE_TCL_STUBS
+# undef Tcl_Gets
+# undef Tcl_GetsObj
+# undef Tcl_Read
+# undef Tcl_Ungets
+# undef Tcl_Write
+# undef Tcl_ReadChars
+# undef Tcl_WriteChars
+# undef Tcl_WriteObj
+# undef Tcl_ReadRaw
+# undef Tcl_WriteRaw
+# define Tcl_Gets(chan, dsPtr) (((Tcl_WideInt)((tclStubsPtr->tcl_Gets)(chan, dsPtr)+1))-1)
+# define Tcl_GetsObj(chan, objPtr) (((Tcl_WideInt)((tclStubsPtr->tcl_GetsObj)(chan, objPtr)+1))-1)
+# define Tcl_Read(chan, bufPtr, toRead) (((Tcl_WideInt)((tclStubsPtr->tcl_Read)(chan, bufPtr, toRead)+1))-1)
+# define Tcl_Ungets(chan, str, len, atHead) (((Tcl_WideInt)((tclStubsPtr->tcl_Ungets)(chan, str, len, atHead)+1))-1)
+# define Tcl_Write(chan, s, slen) (((Tcl_WideInt)((tclStubsPtr->tcl_Write)(chan, s, slen)+1))-1)
+# define Tcl_ReadChars(channel, objPtr, charsToRead, appendFlag) (((Tcl_WideInt)((tclStubsPtr->tcl_ReadChars)(channel, objPtr, charsToRead, appendFlag)+1))-1)
+# define Tcl_WriteChars(chan, src, srcLen) (((Tcl_WideInt)((tclStubsPtr->tcl_WriteChars)(chan, src, srcLen)+1))-1)
+# define Tcl_WriteObj(chan, objPtr) (((Tcl_WideInt)((tclStubsPtr->tcl_WriteObj)(chan, objPtr)+1))-1)
+# define Tcl_ReadRaw(chan, dst, bytesToRead) (((Tcl_WideInt)((tclStubsPtr->tcl_ReadRaw)(chan, dst, bytesToRead)+1))-1)
+# define Tcl_WriteRaw(chan, src, srcLen) (((Tcl_WideInt)((tclStubsPtr->tcl_WriteRaw()(chan, src, srcLen)+1))-1)
+# else
+# define Tcl_Gets(chan, dsPtr) (((Tcl_WideInt)((Tcl_Gets)(chan, dsPtr)+1))-1)
+# define Tcl_GetsObj(chan, objPtr) (((Tcl_WideInt)((Tcl_GetsObj)(chan, objPtr)+1))-1)
+# define Tcl_Read(chan, bufPtr, toRead) (((Tcl_WideInt)((Tcl_Read)(chan, bufPtr, toRead)+1))-1)
+# define Tcl_Ungets(chan, str, len, atHead) (((Tcl_WideInt)((Tcl_Ungets)(chan, str, len, atHead)+1))-1)
+# define Tcl_Write(chan, s, slen) (((Tcl_WideInt)((Tcl_Write)(chan, s, slen)+1))-1)
+# define Tcl_ReadChars(channel, objPtr, charsToRead, appendFlag) (((Tcl_WideInt)((Tcl_ReadChars)(channel, objPtr, charsToRead, appendFlag)+1))-1)
+# define Tcl_WriteChars(chan, src, srcLen) (((Tcl_WideInt)((Tcl_WriteChars)(chan, src, srcLen)+1))-1)
+# define Tcl_WriteObj(chan, objPtr) (((Tcl_WideInt)((Tcl_WriteObj)(chan, objPtr)+1))-1)
+# define Tcl_ReadRaw(chan, dst, bytesToRead) (((Tcl_WideInt)((Tcl_ReadRaw)(chan, dst, bytesToRead)+1))-1)
+# define Tcl_WriteRaw(chan, src, srcLen) (((Tcl_WideInt)((Tcl_WriteRaw()(chan, src, srcLen)+1))-1)
+# endif
+#endif
+
#endif /* _TCLDECLS */
diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c
index f3b0981..84e8ed4 100644
--- a/generic/tclDictObj.c
+++ b/generic/tclDictObj.c
@@ -67,7 +67,7 @@ static void FreeDictInternalRep(Tcl_Obj *dictPtr);
static void InvalidateDictChain(Tcl_Obj *dictObj);
static int SetDictFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr);
static void UpdateStringOfDict(Tcl_Obj *dictPtr);
-static Tcl_HashEntry * AllocChainEntry(Tcl_HashTable *tablePtr,void *keyPtr);
+static Tcl_HashEntry * AllocChainEntry(Tcl_HashTable *tablePtr, void *keyPtr);
static inline void InitChainTable(struct Dict *dict);
static inline void DeleteChainTable(struct Dict *dict);
static inline Tcl_HashEntry *CreateChainEntry(struct Dict *dict,
@@ -147,7 +147,7 @@ typedef struct Dict {
* the dictionary. Used for doing traversal of
* the entries in the order that they are
* created. */
- unsigned int epoch; /* Epoch counter */
+ size_t epoch; /* Epoch counter */
size_t refCount; /* Reference counter (see above) */
Tcl_Obj *chain; /* Linked list used for invalidating the
* string representations of updated nested
@@ -243,13 +243,13 @@ AllocChainEntry(
Tcl_HashTable *tablePtr,
void *keyPtr)
{
- Tcl_Obj *objPtr = keyPtr;
+ Tcl_Obj *objPtr = (Tcl_Obj *)keyPtr;
ChainEntry *cPtr;
- cPtr = ckalloc(sizeof(ChainEntry));
+ cPtr = Tcl_Alloc(sizeof(ChainEntry));
cPtr->entry.key.objPtr = objPtr;
Tcl_IncrRefCount(objPtr);
- cPtr->entry.clientData = NULL;
+ Tcl_SetHashValue(&cPtr->entry, NULL);
cPtr->prevPtr = cPtr->nextPtr = NULL;
return &cPtr->entry;
@@ -377,7 +377,7 @@ DupDictInternalRep(
Tcl_Obj *srcPtr,
Tcl_Obj *copyPtr)
{
- Dict *oldDict, *newDict = ckalloc(sizeof(Dict));
+ Dict *oldDict, *newDict = Tcl_Alloc(sizeof(Dict));
ChainEntry *cPtr;
DictGetIntRep(srcPtr, oldDict);
@@ -472,7 +472,7 @@ DeleteDict(
Dict *dict)
{
DeleteChainTable(dict);
- ckfree(dict);
+ Tcl_Free(dict);
}
/*
@@ -506,7 +506,7 @@ UpdateStringOfDict(
Dict *dict;
ChainEntry *cPtr;
Tcl_Obj *keyPtr, *valuePtr;
- int i, length, bytesNeeded = 0;
+ size_t i, length, bytesNeeded = 0;
const char *elem;
char *dst;
@@ -515,7 +515,7 @@ UpdateStringOfDict(
* is not exposed by any API function...
*/
- int numElems;
+ size_t numElems;
DictGetIntRep(dictPtr, dict);
@@ -536,7 +536,7 @@ UpdateStringOfDict(
if (numElems <= LOCAL_SIZE) {
flagPtr = localFlags;
} else {
- flagPtr = ckalloc(numElems);
+ flagPtr = Tcl_Alloc(numElems);
}
for (i=0,cPtr=dict->entryChainHead; i<numElems; i+=2,cPtr=cPtr->nextPtr) {
/*
@@ -548,20 +548,10 @@ UpdateStringOfDict(
keyPtr = Tcl_GetHashKey(&dict->table, &cPtr->entry);
elem = TclGetStringFromObj(keyPtr, &length);
bytesNeeded += TclScanElement(elem, length, flagPtr+i);
- if (bytesNeeded < 0) {
- Tcl_Panic("max size for a Tcl value (%d bytes) exceeded", INT_MAX);
- }
-
flagPtr[i+1] = TCL_DONT_QUOTE_HASH;
valuePtr = Tcl_GetHashValue(&cPtr->entry);
elem = TclGetStringFromObj(valuePtr, &length);
bytesNeeded += TclScanElement(elem, length, flagPtr+i+1);
- if (bytesNeeded < 0) {
- Tcl_Panic("max size for a Tcl value (%d bytes) exceeded", INT_MAX);
- }
- }
- if (bytesNeeded > INT_MAX - numElems + 1) {
- Tcl_Panic("max size for a Tcl value (%d bytes) exceeded", INT_MAX);
}
bytesNeeded += numElems;
@@ -587,7 +577,7 @@ UpdateStringOfDict(
(void)Tcl_InitStringRep(dictPtr, NULL, bytesNeeded - 1);
if (flagPtr != localFlags) {
- ckfree(flagPtr);
+ Tcl_Free(flagPtr);
}
}
@@ -618,7 +608,7 @@ SetDictFromAny(
{
Tcl_HashEntry *hPtr;
int isNew;
- Dict *dict = ckalloc(sizeof(Dict));
+ Dict *dict = Tcl_Alloc(sizeof(Dict));
InitChainTable(dict);
@@ -651,7 +641,7 @@ SetDictFromAny(
* convert back.
*/
- (void) Tcl_GetString(objPtr);
+ (void) TclGetString(objPtr);
TclDecrRefCount(discardedValue);
}
@@ -659,14 +649,15 @@ SetDictFromAny(
Tcl_IncrRefCount(objv[i+1]); /* Since hash now holds ref to it */
}
} else {
- int length;
+ size_t length;
const char *nextElem = TclGetStringFromObj(objPtr, &length);
const char *limit = (nextElem + length);
while (nextElem < limit) {
Tcl_Obj *keyPtr, *valuePtr;
const char *elemStart;
- int elemSize, literal;
+ size_t elemSize;
+ int literal;
if (TclFindDictElement(interp, nextElem, (limit - nextElem),
&elemStart, &nextElem, &elemSize, &literal) != TCL_OK) {
@@ -746,7 +737,7 @@ SetDictFromAny(
}
errorInFindDictElement:
DeleteChainTable(dict);
- ckfree(dict);
+ Tcl_Free(dict);
return TCL_ERROR;
}
@@ -1424,7 +1415,7 @@ Tcl_NewDictObj(void)
TclNewObj(dictPtr);
TclInvalidateStringRep(dictPtr);
- dict = ckalloc(sizeof(Dict));
+ dict = Tcl_Alloc(sizeof(Dict));
InitChainTable(dict);
dict->epoch = 1;
dict->chain = NULL;
@@ -1472,7 +1463,7 @@ Tcl_DbNewDictObj(
TclDbNewObj(dictPtr, file, line);
TclInvalidateStringRep(dictPtr);
- dict = ckalloc(sizeof(Dict));
+ dict = Tcl_Alloc(sizeof(Dict));
InitChainTable(dict);
dict->epoch = 1;
dict->chain = NULL;
@@ -2136,7 +2127,7 @@ DictInfoCmd(
statsStr = Tcl_HashStats(&dict->table);
Tcl_SetObjResult(interp, Tcl_NewStringObj(statsStr, -1));
- ckfree(statsStr);
+ Tcl_Free(statsStr);
return TCL_OK;
}
@@ -3309,7 +3300,7 @@ DictUpdateCmd(
}
if (objPtr == NULL) {
/* ??? */
- Tcl_UnsetVar(interp, Tcl_GetString(objv[i+1]), 0);
+ Tcl_UnsetVar(interp, TclGetString(objv[i+1]), 0);
} else if (Tcl_ObjSetVar2(interp, objv[i+1], NULL, objPtr,
TCL_LEAVE_ERR_MSG) == NULL) {
TclDecrRefCount(dictPtr);
diff --git a/generic/tclDisassemble.c b/generic/tclDisassemble.c
index 76a4d46..210b35c 100644
--- a/generic/tclDisassemble.c
+++ b/generic/tclDisassemble.c
@@ -195,10 +195,10 @@ TclPrintObject(
FILE *outFile, /* The file to print the source to. */
Tcl_Obj *objPtr, /* Points to the Tcl object whose string
* representation should be printed. */
- int maxChars) /* Maximum number of chars to print. */
+ size_t maxChars) /* Maximum number of chars to print. */
{
char *bytes;
- int length;
+ size_t length;
bytes = TclGetStringFromObj(objPtr, &length);
TclPrintSource(outFile, bytes, TclMin(length, maxChars));
@@ -226,7 +226,7 @@ void
TclPrintSource(
FILE *outFile, /* The file to print the source to. */
const char *stringPtr, /* The string to print. */
- int maxChars) /* Maximum number of chars to print. */
+ size_t maxChars) /* Maximum number of chars to print. */
{
Tcl_Obj *bufferObj;
@@ -280,16 +280,15 @@ DisassembleByteCodeObj(
*/
Tcl_AppendPrintfToObj(bufferObj,
- "ByteCode %p, refCt %u, epoch %u, interp %p (epoch %u)\n",
- codePtr, codePtr->refCount, codePtr->compileEpoch, iPtr,
- iPtr->compileEpoch);
+ "ByteCode %p, refCt %" TCL_Z_MODIFIER "u, epoch %" TCL_Z_MODIFIER "u, interp %p (epoch %" TCL_Z_MODIFIER "u)\n",
+ codePtr, codePtr->refCount, codePtr->compileEpoch, iPtr, iPtr->compileEpoch);
Tcl_AppendToObj(bufferObj, " Source ", -1);
PrintSourceToObj(bufferObj, codePtr->source,
TclMin(codePtr->numSrcBytes, 55));
GetLocationInformation(codePtr->procPtr, &fileObj, &line);
if (line > -1 && fileObj != NULL) {
Tcl_AppendPrintfToObj(bufferObj, "\n File \"%s\" Line %d",
- Tcl_GetString(fileObj), line);
+ TclGetString(fileObj), line);
}
Tcl_AppendPrintfToObj(bufferObj,
"\n Cmds %d, src %d, inst %d, litObjs %u, aux %d, stkDepth %u, code/src %.2f\n",
@@ -325,7 +324,7 @@ DisassembleByteCodeObj(
int numCompiledLocals = procPtr->numCompiledLocals;
Tcl_AppendPrintfToObj(bufferObj,
- " Proc %p, refCt %u, args %d, compiled locals %d\n",
+ " Proc %p, refCt %" TCL_Z_MODIFIER "u, args %d, compiled locals %d\n",
procPtr, procPtr->refCount, procPtr->numArgs,
numCompiledLocals);
if (numCompiledLocals > 0) {
@@ -409,7 +408,7 @@ DisassembleByteCodeObj(
srcLengthNext = codePtr->srcLengthStart;
codeOffset = srcOffset = 0;
for (i = 0; i < numCmds; i++) {
- if ((unsigned) *codeDeltaNext == (unsigned) 0xFF) {
+ if (*codeDeltaNext == 0xFF) {
codeDeltaNext++;
delta = TclGetInt4AtPtr(codeDeltaNext);
codeDeltaNext += 4;
@@ -419,7 +418,7 @@ DisassembleByteCodeObj(
}
codeOffset += delta;
- if ((unsigned) *codeLengthNext == (unsigned) 0xFF) {
+ if (*codeLengthNext == 0xFF) {
codeLengthNext++;
codeLen = TclGetInt4AtPtr(codeLengthNext);
codeLengthNext += 4;
@@ -428,7 +427,7 @@ DisassembleByteCodeObj(
codeLengthNext++;
}
- if ((unsigned) *srcDeltaNext == (unsigned) 0xFF) {
+ if (*srcDeltaNext == 0xFF) {
srcDeltaNext++;
delta = TclGetInt4AtPtr(srcDeltaNext);
srcDeltaNext += 4;
@@ -438,7 +437,7 @@ DisassembleByteCodeObj(
}
srcOffset += delta;
- if ((unsigned) *srcLengthNext == (unsigned) 0xFF) {
+ if (*srcLengthNext == 0xFF) {
srcLengthNext++;
srcLen = TclGetInt4AtPtr(srcLengthNext);
srcLengthNext += 4;
@@ -468,7 +467,7 @@ DisassembleByteCodeObj(
codeOffset = srcOffset = 0;
pc = codeStart;
for (i = 0; i < numCmds; i++) {
- if ((unsigned) *codeDeltaNext == (unsigned) 0xFF) {
+ if (*codeDeltaNext == 0xFF) {
codeDeltaNext++;
delta = TclGetInt4AtPtr(codeDeltaNext);
codeDeltaNext += 4;
@@ -478,7 +477,7 @@ DisassembleByteCodeObj(
}
codeOffset += delta;
- if ((unsigned) *srcDeltaNext == (unsigned) 0xFF) {
+ if (*srcDeltaNext == 0xFF) {
srcDeltaNext++;
delta = TclGetInt4AtPtr(srcDeltaNext);
srcDeltaNext += 4;
@@ -488,7 +487,7 @@ DisassembleByteCodeObj(
}
srcOffset += delta;
- if ((unsigned) *srcLengthNext == (unsigned) 0xFF) {
+ if (*srcLengthNext == 0xFF) {
srcLengthNext++;
srcLen = TclGetInt4AtPtr(srcLengthNext);
srcLengthNext += 4;
@@ -568,7 +567,7 @@ FormatInstruction(
break;
case OPERAND_UINT1:
opnd = TclGetUInt1AtPtr(pc+numBytes); numBytes++;
- Tcl_AppendPrintfToObj(bufferObj, "%u ", (unsigned) opnd);
+ Tcl_AppendPrintfToObj(bufferObj, "%u ", opnd);
break;
case OPERAND_UINT4:
opnd = TclGetUInt4AtPtr(pc+numBytes); numBytes += 4;
@@ -576,7 +575,7 @@ FormatInstruction(
sprintf(suffixBuffer+strlen(suffixBuffer),
", %u cmds start here", opnd);
}
- Tcl_AppendPrintfToObj(bufferObj, "%u ", (unsigned) opnd);
+ Tcl_AppendPrintfToObj(bufferObj, "%u ", opnd);
break;
case OPERAND_OFFSET1:
opnd = TclGetInt1AtPtr(pc+numBytes); numBytes++;
@@ -595,16 +594,16 @@ FormatInstruction(
case OPERAND_LIT1:
opnd = TclGetUInt1AtPtr(pc+numBytes); numBytes++;
suffixObj = codePtr->objArrayPtr[opnd];
- Tcl_AppendPrintfToObj(bufferObj, "%u ", (unsigned) opnd);
+ Tcl_AppendPrintfToObj(bufferObj, "%u ", opnd);
break;
case OPERAND_LIT4:
opnd = TclGetUInt4AtPtr(pc+numBytes); numBytes += 4;
suffixObj = codePtr->objArrayPtr[opnd];
- Tcl_AppendPrintfToObj(bufferObj, "%u ", (unsigned) opnd);
+ Tcl_AppendPrintfToObj(bufferObj, "%u ", opnd);
break;
case OPERAND_AUX4:
opnd = TclGetUInt4AtPtr(pc+numBytes); numBytes += 4;
- Tcl_AppendPrintfToObj(bufferObj, "%u ", (unsigned) opnd);
+ Tcl_AppendPrintfToObj(bufferObj, "%u ", opnd);
auxPtr = &codePtr->auxDataArrayPtr[opnd];
break;
case OPERAND_IDX4:
@@ -628,19 +627,19 @@ FormatInstruction(
if (localPtr != NULL) {
if (opnd >= localCt) {
Tcl_Panic("FormatInstruction: bad local var index %u (%u locals)",
- (unsigned) opnd, localCt);
+ opnd, localCt);
}
for (j = 0; j < opnd; j++) {
localPtr = localPtr->nextPtr;
}
if (TclIsVarTemporary(localPtr)) {
- sprintf(suffixBuffer, "temp var %u", (unsigned) opnd);
+ sprintf(suffixBuffer, "temp var %u", opnd);
} else {
sprintf(suffixBuffer, "var ");
suffixSrc = localPtr->name;
}
}
- Tcl_AppendPrintfToObj(bufferObj, "%%v%u ", (unsigned) opnd);
+ Tcl_AppendPrintfToObj(bufferObj, "%%v%u ", opnd);
break;
case OPERAND_SCLS1:
opnd = TclGetUInt1AtPtr(pc+numBytes); numBytes++;
@@ -654,7 +653,7 @@ FormatInstruction(
}
if (suffixObj) {
const char *bytes;
- int length;
+ size_t length;
Tcl_AppendToObj(bufferObj, "\t# ", -1);
bytes = TclGetStringFromObj(codePtr->objArrayPtr[opnd], &length);
@@ -841,7 +840,7 @@ UpdateStringOfInstName(
(void) Tcl_InitStringRep(objPtr, NULL, strlen(dst));
} else {
const char *s = tclInstructionTable[inst].name;
- unsigned int len = strlen(s);
+ size_t len = strlen(s);
dst = Tcl_InitStringRep(objPtr, s, len);
TclOOM(dst, len);
}
diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c
index a88c1a7..6b4cc8e 100644
--- a/generic/tclEncoding.c
+++ b/generic/tclEncoding.c
@@ -645,14 +645,14 @@ TclInitEncodingSubsystem(void)
* code to duplicate the structure of a table encoding here.
*/
- dataPtr = ckalloc(sizeof(TableEncodingData));
+ dataPtr = Tcl_Alloc(sizeof(TableEncodingData));
memset(dataPtr, 0, sizeof(TableEncodingData));
dataPtr->fallback = '?';
size = 256*(sizeof(unsigned short *) + sizeof(unsigned short));
- dataPtr->toUnicode = ckalloc(size);
+ dataPtr->toUnicode = Tcl_Alloc(size);
memset(dataPtr->toUnicode, 0, size);
- dataPtr->fromUnicode = ckalloc(size);
+ dataPtr->fromUnicode = Tcl_Alloc(size);
memset(dataPtr->fromUnicode, 0, size);
dataPtr->toUnicode[0] = (unsigned short *) (dataPtr->toUnicode + 256);
@@ -729,70 +729,6 @@ TclFinalizeEncodingSubsystem(void)
/*
*-------------------------------------------------------------------------
*
- * Tcl_GetDefaultEncodingDir --
- *
- * Legacy public interface to retrieve first directory in the encoding
- * searchPath.
- *
- * Results:
- * The directory pathname, as a string, or NULL for an empty encoding
- * search path.
- *
- * Side effects:
- * None.
- *
- *-------------------------------------------------------------------------
- */
-
-#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
-const char *
-Tcl_GetDefaultEncodingDir(void)
-{
- int numDirs;
- Tcl_Obj *first, *searchPath = Tcl_GetEncodingSearchPath();
-
- Tcl_ListObjLength(NULL, searchPath, &numDirs);
- if (numDirs == 0) {
- return NULL;
- }
- Tcl_ListObjIndex(NULL, searchPath, 0, &first);
-
- return TclGetString(first);
-}
-
-/*
- *-------------------------------------------------------------------------
- *
- * Tcl_SetDefaultEncodingDir --
- *
- * Legacy public interface to set the first directory in the encoding
- * search path.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Modifies the encoding search path.
- *
- *-------------------------------------------------------------------------
- */
-
-void
-Tcl_SetDefaultEncodingDir(
- const char *path)
-{
- Tcl_Obj *searchPath = Tcl_GetEncodingSearchPath();
- Tcl_Obj *directory = Tcl_NewStringObj(path, -1);
-
- searchPath = Tcl_DuplicateObj(searchPath);
- Tcl_ListObjReplace(NULL, searchPath, 0, 0, 1, &directory);
- Tcl_SetEncodingSearchPath(searchPath);
-}
-#endif
-
-/*
- *-------------------------------------------------------------------------
- *
* Tcl_GetEncoding --
*
* Given the name of a encoding, find the corresponding Tcl_Encoding
@@ -905,9 +841,9 @@ FreeEncoding(
Tcl_DeleteHashEntry(encodingPtr->hPtr);
}
if (encodingPtr->name) {
- ckfree(encodingPtr->name);
+ Tcl_Free(encodingPtr->name);
}
- ckfree(encodingPtr);
+ Tcl_Free(encodingPtr);
}
}
@@ -1095,7 +1031,7 @@ Tcl_CreateEncoding(
const Tcl_EncodingType *typePtr)
/* The encoding type. */
{
- Encoding *encodingPtr = ckalloc(sizeof(Encoding));
+ Encoding *encodingPtr = Tcl_Alloc(sizeof(Encoding));
encodingPtr->name = NULL;
encodingPtr->toUtfProc = typePtr->toUtfProc;
encodingPtr->fromUtfProc = typePtr->fromUtfProc;
@@ -1127,7 +1063,7 @@ Tcl_CreateEncoding(
replaceMe->hPtr = NULL;
}
- name = ckalloc(strlen(typePtr->encodingName) + 1);
+ name = Tcl_Alloc(strlen(typePtr->encodingName) + 1);
encodingPtr->name = strcpy(name, typePtr->encodingName);
encodingPtr->hPtr = hPtr;
Tcl_SetHashValue(hPtr, encodingPtr);
@@ -1163,7 +1099,7 @@ Tcl_ExternalToUtfDString(
Tcl_Encoding encoding, /* The encoding for the source string, or NULL
* for the default system encoding. */
const char *src, /* Source string in specified encoding. */
- int srcLen, /* Source string length in bytes, or < 0 for
+ size_t srcLen, /* Source string length in bytes, or -1 for
* encoding-specific string length. */
Tcl_DString *dstPtr) /* Uninitialized or free DString in which the
* converted string is stored. */
@@ -1171,7 +1107,8 @@ Tcl_ExternalToUtfDString(
char *dst;
Tcl_EncodingState state;
const Encoding *encodingPtr;
- int flags, dstLen, result, soFar, srcRead, dstWrote, dstChars;
+ int flags, result, soFar, srcRead, dstWrote, dstChars;
+ size_t dstLen;
Tcl_DStringInit(dstPtr);
dst = Tcl_DStringValue(dstPtr);
@@ -1184,7 +1121,7 @@ Tcl_ExternalToUtfDString(
if (src == NULL) {
srcLen = 0;
- } else if (srcLen < 0) {
+ } else if (srcLen == TCL_AUTO_LENGTH) {
srcLen = encodingPtr->lengthProc(src);
}
@@ -1236,8 +1173,8 @@ Tcl_ExternalToUtf(
Tcl_Encoding encoding, /* The encoding for the source string, or NULL
* for the default system encoding. */
const char *src, /* Source string in specified encoding. */
- int srcLen, /* Source string length in bytes, or < 0 for
- * encoding-specific string length. */
+ size_t srcLen, /* Source string length in bytes, or -1
+ * for encoding-specific string length. */
int flags, /* Conversion control flags. */
Tcl_EncodingState *statePtr,/* Place for conversion routine to store state
* information used during a piecewise
@@ -1246,7 +1183,7 @@ Tcl_ExternalToUtf(
* routine under control of flags argument. */
char *dst, /* Output buffer in which converted string is
* stored. */
- int dstLen, /* The maximum length of output buffer in
+ size_t dstLen, /* The maximum length of output buffer in
* bytes. */
int *srcReadPtr, /* Filled with the number of bytes from the
* source string that were converted. This may
@@ -1274,7 +1211,7 @@ Tcl_ExternalToUtf(
if (src == NULL) {
srcLen = 0;
- } else if (srcLen < 0) {
+ } else if (srcLen == TCL_AUTO_LENGTH) {
srcLen = encodingPtr->lengthProc(src);
}
if (statePtr == NULL) {
@@ -1353,7 +1290,7 @@ Tcl_UtfToExternalDString(
Tcl_Encoding encoding, /* The encoding for the converted string, or
* NULL for the default system encoding. */
const char *src, /* Source string in UTF-8. */
- int srcLen, /* Source string length in bytes, or < 0 for
+ size_t srcLen, /* Source string length in bytes, or -1 for
* strlen(). */
Tcl_DString *dstPtr) /* Uninitialized or free DString in which the
* converted string is stored. */
@@ -1361,7 +1298,8 @@ Tcl_UtfToExternalDString(
char *dst;
Tcl_EncodingState state;
const Encoding *encodingPtr;
- int flags, dstLen, result, soFar, srcRead, dstWrote, dstChars;
+ int flags, result, soFar, srcRead, dstWrote, dstChars;
+ size_t dstLen;
Tcl_DStringInit(dstPtr);
dst = Tcl_DStringValue(dstPtr);
@@ -1374,7 +1312,7 @@ Tcl_UtfToExternalDString(
if (src == NULL) {
srcLen = 0;
- } else if (srcLen < 0) {
+ } else if (srcLen == TCL_AUTO_LENGTH) {
srcLen = strlen(src);
}
flags = TCL_ENCODING_START | TCL_ENCODING_END;
@@ -1428,8 +1366,8 @@ Tcl_UtfToExternal(
Tcl_Encoding encoding, /* The encoding for the converted string, or
* NULL for the default system encoding. */
const char *src, /* Source string in UTF-8. */
- int srcLen, /* Source string length in bytes, or < 0 for
- * strlen(). */
+ size_t srcLen, /* Source string length in bytes, or -1
+ * for strlen(). */
int flags, /* Conversion control flags. */
Tcl_EncodingState *statePtr,/* Place for conversion routine to store state
* information used during a piecewise
@@ -1438,7 +1376,7 @@ Tcl_UtfToExternal(
* routine under control of flags argument. */
char *dst, /* Output buffer in which converted string
* is stored. */
- int dstLen, /* The maximum length of output buffer in
+ size_t dstLen, /* The maximum length of output buffer in
* bytes. */
int *srcReadPtr, /* Filled with the number of bytes from the
* source string that were converted. This may
@@ -1463,7 +1401,7 @@ Tcl_UtfToExternal(
if (src == NULL) {
srcLen = 0;
- } else if (srcLen < 0) {
+ } else if (srcLen == TCL_AUTO_LENGTH) {
srcLen = strlen(src);
}
if (statePtr == NULL) {
@@ -1795,7 +1733,7 @@ LoadTableEncoding(
#undef PAGESIZE
#define PAGESIZE (256 * sizeof(unsigned short))
- dataPtr = ckalloc(sizeof(TableEncodingData));
+ dataPtr = Tcl_Alloc(sizeof(TableEncodingData));
memset(dataPtr, 0, sizeof(TableEncodingData));
dataPtr->fallback = fallback;
@@ -1807,7 +1745,7 @@ LoadTableEncoding(
*/
size = 256 * sizeof(unsigned short *) + numPages * PAGESIZE;
- dataPtr->toUnicode = ckalloc(size);
+ dataPtr->toUnicode = Tcl_Alloc(size);
memset(dataPtr->toUnicode, 0, size);
pageMemPtr = (unsigned short *) (dataPtr->toUnicode + 256);
@@ -1816,7 +1754,7 @@ LoadTableEncoding(
for (i = 0; i < numPages; i++) {
int ch;
const char *p;
- int expected = 3 + 16 * (16 * 4 + 1);
+ size_t expected = 3 + 16 * (16 * 4 + 1);
if (Tcl_ReadChars(chan, objPtr, expected, 0) != expected) {
return NULL;
@@ -1868,7 +1806,7 @@ LoadTableEncoding(
}
}
size = 256 * sizeof(unsigned short *) + numPages * PAGESIZE;
- dataPtr->fromUnicode = ckalloc(size);
+ dataPtr->fromUnicode = Tcl_Alloc(size);
memset(dataPtr->fromUnicode, 0, size);
pageMemPtr = (unsigned short *) (dataPtr->fromUnicode + 256);
@@ -1964,7 +1902,7 @@ LoadTableEncoding(
*/
for (TclDStringClear(&lineString);
- (len = Tcl_Gets(chan, &lineString)) >= 0;
+ (len = Tcl_Gets(chan, &lineString)) != -1;
TclDStringClear(&lineString)) {
const unsigned char *p;
int to, from;
@@ -2058,7 +1996,7 @@ LoadEscapeEncoding(
Tcl_DString lineString;
Tcl_DStringInit(&lineString);
- if (Tcl_Gets(chan, &lineString) < 0) {
+ if (Tcl_Gets(chan, &lineString) == TCL_IO_FAILURE) {
break;
}
line = Tcl_DStringValue(&lineString);
@@ -2100,13 +2038,13 @@ LoadEscapeEncoding(
Tcl_DStringAppend(&escapeData, (char *) &est, sizeof(est));
}
}
- ckfree(argv);
+ Tcl_Free((void *)argv);
Tcl_DStringFree(&lineString);
}
size = sizeof(EscapeEncodingData) - sizeof(EscapeSubTable)
+ Tcl_DStringLength(&escapeData);
- dataPtr = ckalloc(size);
+ dataPtr = Tcl_Alloc(size);
dataPtr->initLen = strlen(init);
memcpy(dataPtr->init, init, dataPtr->initLen + 1);
dataPtr->finalLen = strlen(final);
@@ -3216,11 +3154,11 @@ TableFreeProc(
* Make sure we aren't freeing twice on shutdown. [Bug 219314]
*/
- ckfree(dataPtr->toUnicode);
+ Tcl_Free(dataPtr->toUnicode);
dataPtr->toUnicode = NULL;
- ckfree(dataPtr->fromUnicode);
+ Tcl_Free(dataPtr->fromUnicode);
dataPtr->fromUnicode = NULL;
- ckfree(dataPtr);
+ Tcl_Free(dataPtr);
}
/*
@@ -3593,8 +3531,7 @@ EscapeFromUtfProc(
result = TCL_CONVERT_NOSPACE;
break;
}
- memcpy(dst, subTablePtr->sequence,
- subTablePtr->sequenceLen);
+ memcpy(dst, subTablePtr->sequence, subTablePtr->sequenceLen);
dst += subTablePtr->sequenceLen;
}
}
@@ -3699,7 +3636,7 @@ EscapeFreeProc(
subTablePtr++;
}
}
- ckfree(dataPtr);
+ Tcl_Free(dataPtr);
}
/*
@@ -3800,7 +3737,7 @@ unilen(
static void
InitializeEncodingSearchPath(
char **valuePtr,
- unsigned int *lengthPtr,
+ size_t *lengthPtr,
Tcl_Encoding *encodingPtr)
{
const char *bytes;
@@ -3834,10 +3771,8 @@ InitializeEncodingSearchPath(
if (*encodingPtr) {
((Encoding *)(*encodingPtr))->refCount++;
}
- bytes = TclGetString(searchPathObj);
-
- *lengthPtr = searchPathObj->length;
- *valuePtr = ckalloc(*lengthPtr + 1);
+ bytes = TclGetStringFromObj(searchPathObj, lengthPtr);
+ *valuePtr = Tcl_Alloc(*lengthPtr + 1);
memcpy(*valuePtr, bytes, *lengthPtr + 1);
Tcl_DecrRefCount(searchPathObj);
}
diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c
index 9964250..566e8d3 100644
--- a/generic/tclEnsemble.c
+++ b/generic/tclEnsemble.c
@@ -105,7 +105,7 @@ static const Tcl_ObjType ensembleCmdType = {
*/
typedef struct {
- unsigned int epoch; /* Used to confirm when the data in this
+ size_t epoch; /* Used to confirm when the data in this
* really structure matches up with the
* ensemble. */
Command *token; /* Reference to the command for which this
@@ -675,12 +675,12 @@ TclCreateEnsembleInNs(
EnsembleConfig *ensemblePtr;
Tcl_Command token;
- ensemblePtr = ckalloc(sizeof(EnsembleConfig));
+ ensemblePtr = Tcl_Alloc(sizeof(EnsembleConfig));
token = TclNRCreateCommandInNs(interp, name,
(Tcl_Namespace *) nameNsPtr, TclEnsembleImplementationCmd,
NsEnsembleImplementationCmdNR, ensemblePtr, DeleteEnsembleConfig);
if (token == NULL) {
- ckfree(ensemblePtr);
+ Tcl_Free(ensemblePtr);
return NULL;
}
@@ -1624,7 +1624,7 @@ TclMakeEnsemble(
Tcl_DStringSetLength(&hiddenBuf, hiddenLen);
if (Tcl_HideCommand(interp, "___tmp",
Tcl_DStringAppend(&hiddenBuf, map[i].name, -1))) {
- Tcl_Panic("%s", Tcl_GetString(Tcl_GetObjResult(interp)));
+ Tcl_Panic("%s", Tcl_GetStringResult(interp));
}
} else {
/*
@@ -1645,7 +1645,7 @@ TclMakeEnsemble(
Tcl_DStringFree(&buf);
Tcl_DStringFree(&hiddenBuf);
if (nameParts != NULL) {
- ckfree(nameParts);
+ Tcl_Free((void *)nameParts);
}
return ensemble;
}
@@ -1701,7 +1701,7 @@ NsEnsembleImplementationCmdNR(
int reparseCount = 0; /* Number of reparses. */
Tcl_Obj *errorObj; /* Used for building error messages. */
Tcl_Obj *subObj;
- int subIdx;
+ size_t subIdx;
/*
* Must recheck objc, since numParameters might have changed. Cf. test
@@ -1710,7 +1710,7 @@ NsEnsembleImplementationCmdNR(
restartEnsembleParse:
subIdx = 1 + ensemblePtr->numParameters;
- if (objc < subIdx + 1) {
+ if ((size_t)objc < subIdx + 1) {
/*
* We don't have a subcommand argument. Make error message.
*/
@@ -1807,8 +1807,8 @@ NsEnsembleImplementationCmdNR(
* it (will be an error for a non-unique
* prefix). */
char *fullName = NULL; /* Full name of the subcommand. */
- int stringLength, i;
- int tableLength = ensemblePtr->subcommandTable.numEntries;
+ size_t stringLength, i;
+ size_t tableLength = ensemblePtr->subcommandTable.numEntries;
Tcl_Obj *fix;
subcmdName = TclGetStringFromObj(subObj, &stringLength);
@@ -1972,7 +1972,7 @@ NsEnsembleImplementationCmdNR(
if (ensemblePtr->subcommandTable.numEntries == 1) {
Tcl_AppendToObj(errorObj, ensemblePtr->subcommandArrayPtr[0], -1);
} else {
- int i;
+ size_t i;
for (i=0 ; i<ensemblePtr->subcommandTable.numEntries-1 ; i++) {
Tcl_AppendToObj(errorObj, ensemblePtr->subcommandArrayPtr[i], -1);
@@ -2017,8 +2017,8 @@ TclClearRootEnsemble(
int
TclInitRewriteEnsemble(
Tcl_Interp *interp,
- int numRemoved,
- int numInserted,
+ size_t numRemoved,
+ size_t numInserted,
Tcl_Obj *const *objv)
{
Interp *iPtr = (Interp *) interp;
@@ -2030,7 +2030,7 @@ TclInitRewriteEnsemble(
iPtr->ensembleRewrite.numRemovedObjs = numRemoved;
iPtr->ensembleRewrite.numInsertedObjs = numInserted;
} else {
- int numIns = iPtr->ensembleRewrite.numInsertedObjs;
+ size_t numIns = iPtr->ensembleRewrite.numInsertedObjs;
if (numIns < numRemoved) {
iPtr->ensembleRewrite.numRemovedObjs += numRemoved - numIns;
@@ -2100,8 +2100,8 @@ FreeER(
Tcl_Obj **tmp = (Tcl_Obj **) data[0];
Tcl_Obj **store = (Tcl_Obj **) data[1];
- ckfree(store);
- ckfree(tmp);
+ Tcl_Free(store);
+ Tcl_Free(tmp);
return result;
}
@@ -2110,15 +2110,15 @@ TclSpellFix(
Tcl_Interp *interp,
Tcl_Obj *const *objv,
int objc,
- int badIdx,
+ size_t badIdx,
Tcl_Obj *bad,
Tcl_Obj *fix)
{
Interp *iPtr = (Interp *) interp;
Tcl_Obj *const *search;
Tcl_Obj **store;
- int idx;
- int size;
+ size_t idx;
+ size_t size;
if (iPtr->ensembleRewrite.sourceObjs == NULL) {
iPtr->ensembleRewrite.sourceObjs = objv;
@@ -2176,9 +2176,9 @@ TclSpellFix(
if (search[0] == NULL) {
store = (Tcl_Obj **) search[2];
} else {
- Tcl_Obj **tmp = ckalloc(3 * sizeof(Tcl_Obj *));
+ Tcl_Obj **tmp = Tcl_Alloc(3 * sizeof(Tcl_Obj *));
- store = ckalloc(size * sizeof(Tcl_Obj *));
+ store = Tcl_Alloc(size * sizeof(Tcl_Obj *));
memcpy(store, iPtr->ensembleRewrite.sourceObjs,
size * sizeof(Tcl_Obj *));
@@ -2418,7 +2418,7 @@ MakeCachedEnsembleCommand(
* our own.
*/
- ensembleCmd = ckalloc(sizeof(EnsembleCmdRep));
+ ensembleCmd = Tcl_Alloc(sizeof(EnsembleCmdRep));
ECRSetIntRep(objPtr, ensembleCmd);
}
@@ -2471,7 +2471,7 @@ ClearTable(
Tcl_DecrRefCount(prefixObj);
hPtr = Tcl_NextHashEntry(&search);
}
- ckfree((char *) ensemblePtr->subcommandArrayPtr);
+ Tcl_Free(ensemblePtr->subcommandArrayPtr);
}
Tcl_DeleteHashTable(hash);
}
@@ -2568,7 +2568,8 @@ BuildEnsembleConfig(
Tcl_HashSearch search; /* Used for scanning the set of commands in
* the namespace that backs up this
* ensemble. */
- int i, j, isNew;
+ size_t i, j;
+ int isNew;
Tcl_HashTable *hash = &ensemblePtr->subcommandTable;
Tcl_HashEntry *hPtr;
Tcl_Obj *mapDict = ensemblePtr->subcommandDict;
@@ -2594,7 +2595,7 @@ BuildEnsembleConfig(
* as the dict mapping to targets.
*/
- for (i = 0; i < subc; i += 2) {
+ for (i = 0; i < (size_t)subc; i += 2) {
name = TclGetString(subv[i]);
hPtr = Tcl_CreateHashEntry(hash, name, &isNew);
if (!isNew) {
@@ -2618,7 +2619,7 @@ BuildEnsembleConfig(
* Usual case where we can freely act on the list and dict.
*/
- for (i = 0; i < subc; i++) {
+ for (i = 0; i < (size_t)subc; i++) {
name = TclGetString(subv[i]);
hPtr = Tcl_CreateHashEntry(hash, name, &isNew);
if (!isNew) {
@@ -2740,7 +2741,7 @@ BuildEnsembleConfig(
*/
ensemblePtr->subcommandArrayPtr =
- ckalloc(sizeof(char *) * hash->numEntries);
+ Tcl_Alloc(sizeof(char *) * hash->numEntries);
/*
* Fill array from both ends as this makes us less likely to end up with
@@ -2834,7 +2835,7 @@ FreeEnsembleCmdRep(
if (ensembleCmd->fix) {
Tcl_DecrRefCount(ensembleCmd->fix);
}
- ckfree(ensembleCmd);
+ Tcl_Free(ensembleCmd);
}
/*
@@ -2861,7 +2862,7 @@ DupEnsembleCmdRep(
Tcl_Obj *copyPtr)
{
EnsembleCmdRep *ensembleCmd;
- EnsembleCmdRep *ensembleCopy = ckalloc(sizeof(EnsembleCmdRep));
+ EnsembleCmdRep *ensembleCopy = Tcl_Alloc(sizeof(EnsembleCmdRep));
ECRGetIntRep(objPtr, ensembleCmd);
ECRSetIntRep(copyPtr, ensembleCopy);
@@ -2913,7 +2914,7 @@ TclCompileEnsemble(
Command *oldCmdPtr = cmdPtr, *newCmdPtr;
int len, result, flags = 0, i, depth = 1, invokeAnyway = 0;
int ourResult = TCL_ERROR;
- unsigned numBytes;
+ size_t numBytes;
const char *word;
DefineLineInformation;
@@ -2983,7 +2984,7 @@ TclCompileEnsemble(
(void) Tcl_GetEnsembleSubcommandList(NULL, ensemble, &listObj);
if (listObj != NULL) {
- int sclen;
+ size_t sclen;
const char *str;
Tcl_Obj *matchObj = NULL;
@@ -2992,7 +2993,7 @@ TclCompileEnsemble(
}
for (i=0 ; i<len ; i++) {
str = TclGetStringFromObj(elems[i], &sclen);
- if ((sclen == (int) numBytes) && !memcmp(word, str, numBytes)) {
+ if ((sclen == numBytes) && !memcmp(word, str, numBytes)) {
/*
* Exact match! Excellent!
*/
@@ -3039,7 +3040,7 @@ TclCompileEnsemble(
* No map, so check the dictionary directly.
*/
- TclNewStringObj(subcmdObj, word, (int) numBytes);
+ TclNewStringObj(subcmdObj, word, numBytes);
result = Tcl_DictObjGet(NULL, mapObj, subcmdObj, &targetCmdObj);
if (result == TCL_OK && targetCmdObj != NULL) {
/*
@@ -3180,7 +3181,7 @@ TclCompileEnsemble(
while (mapPtr->nuloc - 1 > eclIndex) {
mapPtr->nuloc--;
- ckfree(mapPtr->loc[mapPtr->nuloc].line);
+ Tcl_Free(mapPtr->loc[mapPtr->nuloc].line);
mapPtr->loc[mapPtr->nuloc].line = NULL;
}
@@ -3355,7 +3356,7 @@ TclAttemptCompileProc(
if (diff != 1) {
Tcl_Panic("bad stack adjustment when compiling"
- " %.*s (was %d instead of 1)", parsePtr->tokenPtr->size,
+ " %.*s (was %d instead of 1)", (int)parsePtr->tokenPtr->size,
parsePtr->tokenPtr->start, diff);
}
#endif
@@ -3381,6 +3382,7 @@ CompileToInvokedCommand(
Tcl_Obj *objPtr, **words;
const char *bytes;
int i, numWords, cmdLit, extraLiteralFlags = LITERAL_CMD_NAME;
+ size_t length;
DefineLineInformation;
/*
@@ -3393,8 +3395,8 @@ CompileToInvokedCommand(
for (i = 0, tokPtr = parsePtr->tokenPtr; i < parsePtr->numWords;
i++, tokPtr = TokenAfter(tokPtr)) {
if (i > 0 && i < numWords+1) {
- bytes = TclGetString(words[i-1]);
- PushLiteral(envPtr, bytes, words[i-1]->length);
+ bytes = TclGetStringFromObj(words[i-1], &length);
+ PushLiteral(envPtr, bytes, length);
continue;
}
@@ -3422,11 +3424,11 @@ CompileToInvokedCommand(
objPtr = Tcl_NewObj();
Tcl_GetCommandFullName(interp, (Tcl_Command) cmdPtr, objPtr);
- bytes = TclGetString(objPtr);
+ bytes = TclGetStringFromObj(objPtr, &length);
if ((cmdPtr != NULL) && (cmdPtr->flags & CMD_VIA_RESOLVER)) {
extraLiteralFlags |= LITERAL_UNSHARED;
}
- cmdLit = TclRegisterLiteral(envPtr, bytes, objPtr->length, extraLiteralFlags);
+ cmdLit = TclRegisterLiteral(envPtr, bytes, length, extraLiteralFlags);
TclSetCmdNameObj(interp, TclFetchLiteral(envPtr, cmdLit), cmdPtr);
TclEmitPush(cmdLit, envPtr);
TclDecrRefCount(objPtr);
diff --git a/generic/tclEnv.c b/generic/tclEnv.c
index 9677b86..49b544d 100644
--- a/generic/tclEnv.c
+++ b/generic/tclEnv.c
@@ -18,7 +18,7 @@
TCL_DECLARE_MUTEX(envMutex) /* To serialize access to environ. */
static struct {
- int cacheSize; /* Number of env strings in cache. */
+ size_t cacheSize; /* Number of env strings in cache. */
char **cache; /* Array containing all of the environment
* strings that Tcl has allocated. */
#ifndef USE_PUTENV
@@ -26,7 +26,7 @@ static struct {
* need to track this in case another
* subsystem swaps around the environ array
* like we do. */
- int ourEnvironSize; /* Non-zero means that the environ array was
+ size_t ourEnvironSize; /* Non-zero means that the environ array was
* malloced and has this many total entries
* allocated to it (not all may be in use at
* once). Zero means that the environment
@@ -216,8 +216,8 @@ TclSetEnv(
const char *value) /* New value for variable (UTF-8). */
{
Tcl_DString envString;
- unsigned nameLength, valueLength;
- int index, length;
+ size_t nameLength, valueLength;
+ size_t index, length;
char *p, *oldValue;
const char *p2;
@@ -230,7 +230,7 @@ TclSetEnv(
Tcl_MutexLock(&envMutex);
index = TclpFindVariable(name, &length);
- if (index == -1) {
+ if (index == TCL_INDEX_NONE) {
#ifndef USE_PUTENV
/*
* We need to handle the case where the environment may be changed
@@ -239,11 +239,11 @@ TclSetEnv(
*/
if ((env.ourEnviron != environ) || (length+2 > env.ourEnvironSize)) {
- char **newEnviron = ckalloc((length + 5) * sizeof(char *));
+ char **newEnviron = Tcl_Alloc((length + 5) * sizeof(char *));
memcpy(newEnviron, environ, length * sizeof(char *));
if ((env.ourEnvironSize != 0) && (env.ourEnviron != NULL)) {
- ckfree(env.ourEnviron);
+ Tcl_Free(env.ourEnviron);
}
environ = env.ourEnviron = newEnviron;
env.ourEnvironSize = length + 5;
@@ -283,7 +283,7 @@ TclSetEnv(
*/
valueLength = strlen(value);
- p = ckalloc(nameLength + valueLength + 2);
+ p = Tcl_Alloc(nameLength + valueLength + 2);
memcpy(p, name, nameLength);
p[nameLength] = '=';
memcpy(p+nameLength+1, value, valueLength+1);
@@ -293,7 +293,7 @@ TclSetEnv(
* Copy the native string to heap memory.
*/
- p = ckrealloc(p, Tcl_DStringLength(&envString) + 1);
+ p = Tcl_Realloc(p, Tcl_DStringLength(&envString) + 1);
memcpy(p, p2, Tcl_DStringLength(&envString) + 1);
Tcl_DStringFree(&envString);
@@ -314,7 +314,7 @@ TclSetEnv(
* string in the cache.
*/
- if ((index != -1) && (environ[index] == p)) {
+ if ((index != TCL_INDEX_NONE) && (environ[index] == p)) {
ReplaceString(oldValue, p);
#ifdef HAVE_PUTENV_THAT_COPIES
} else {
@@ -322,7 +322,7 @@ TclSetEnv(
* This putenv() copies instead of taking ownership.
*/
- ckfree(p);
+ Tcl_Free(p);
#endif /* HAVE_PUTENV_THAT_COPIES */
}
@@ -414,8 +414,7 @@ TclUnsetEnv(
const char *name) /* Name of variable to remove (UTF-8). */
{
char *oldValue;
- int length;
- int index;
+ size_t length, index;
#ifdef USE_PUTENV_FOR_UNSET
Tcl_DString envString;
char *string;
@@ -431,7 +430,7 @@ TclUnsetEnv(
* needless work and to avoid recursion on the unset.
*/
- if (index == -1) {
+ if (index == TCL_AUTO_LENGTH) {
Tcl_MutexUnlock(&envMutex);
return;
}
@@ -454,18 +453,18 @@ TclUnsetEnv(
*/
#if defined(_WIN32)
- string = ckalloc(length + 2);
+ string = Tcl_Alloc(length + 2);
memcpy(string, name, length);
string[length] = '=';
string[length+1] = '\0';
#else
- string = ckalloc(length + 1);
+ string = Tcl_Alloc(length + 1);
memcpy(string, name, length);
string[length] = '\0';
#endif /* _WIN32 */
Tcl_UtfToExternalDString(NULL, string, -1, &envString);
- string = ckrealloc(string, Tcl_DStringLength(&envString) + 1);
+ string = Tcl_Realloc(string, Tcl_DStringLength(&envString) + 1);
memcpy(string, Tcl_DStringValue(&envString),
Tcl_DStringLength(&envString)+1);
Tcl_DStringFree(&envString);
@@ -486,7 +485,7 @@ TclUnsetEnv(
* This putenv() copies instead of taking ownership.
*/
- ckfree(string);
+ Tcl_Free(string);
#endif /* HAVE_PUTENV_THAT_COPIES */
}
#else /* !USE_PUTENV_FOR_UNSET */
@@ -530,13 +529,13 @@ TclGetEnv(
* value of the environment variable is
* stored. */
{
- int length, index;
+ size_t length, index;
const char *result;
Tcl_MutexLock(&envMutex);
index = TclpFindVariable(name, &length);
result = NULL;
- if (index != -1) {
+ if (index != TCL_AUTO_LENGTH) {
Tcl_DString envStr;
result = Tcl_ExternalToUtfDString(NULL, environ[index], -1, &envStr);
@@ -663,7 +662,7 @@ ReplaceString(
const char *oldStr, /* Old environment string. */
char *newStr) /* New environment string. */
{
- int i;
+ size_t i;
/*
* Check to see if the old value was allocated by Tcl. If so, it needs to
@@ -683,7 +682,7 @@ ReplaceString(
*/
if (env.cache[i]) {
- ckfree(env.cache[i]);
+ Tcl_Free(env.cache[i]);
}
if (newStr) {
@@ -701,11 +700,11 @@ ReplaceString(
const int growth = 5;
- env.cache = ckrealloc(env.cache,
+ env.cache = Tcl_Realloc(env.cache,
(env.cacheSize + growth) * sizeof(char *));
env.cache[env.cacheSize] = newStr;
(void) memset(env.cache+env.cacheSize+1, 0,
- (size_t) (growth-1) * sizeof(char *));
+ (growth-1) * sizeof(char *));
env.cacheSize += growth;
}
}
@@ -744,15 +743,15 @@ TclFinalizeEnvironment(void)
#ifdef PURIFY
int i;
for (i = 0; i < env.cacheSize; i++) {
- ckfree(env.cache[i]);
+ Tcl_Free(env.cache[i]);
}
#endif
- ckfree(env.cache);
+ Tcl_Free(env.cache);
env.cache = NULL;
env.cacheSize = 0;
#ifndef USE_PUTENV
if ((env.ourEnviron != NULL)) {
- ckfree(env.ourEnviron);
+ Tcl_Free(env.ourEnviron);
env.ourEnviron = NULL;
}
env.ourEnvironSize = 0;
diff --git a/generic/tclEvent.c b/generic/tclEvent.c
index 734f114..b224349 100644
--- a/generic/tclEvent.c
+++ b/generic/tclEvent.c
@@ -124,7 +124,7 @@ static void FinalizeThread(int quick);
/*
*----------------------------------------------------------------------
*
- * Tcl_BackgroundError --
+ * Tcl_BackgroundException --
*
* This function is invoked to handle errors that occur in Tcl commands
* that are invoked in "background" (e.g. from event or timer bindings).
@@ -139,17 +139,6 @@ static void FinalizeThread(int quick);
*----------------------------------------------------------------------
*/
-#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
-#undef Tcl_BackgroundError
-void
-Tcl_BackgroundError(
- Tcl_Interp *interp) /* Interpreter in which an error has
- * occurred. */
-{
- Tcl_BackgroundException(interp, TCL_ERROR);
-}
-#endif /* TCL_NO_DEPRECATED */
-
void
Tcl_BackgroundException(
Tcl_Interp *interp, /* Interpreter in which an exception has
@@ -163,7 +152,7 @@ Tcl_BackgroundException(
return;
}
- errPtr = ckalloc(sizeof(BgError));
+ errPtr = Tcl_Alloc(sizeof(BgError));
errPtr->errorMsg = Tcl_GetObjResult(interp);
Tcl_IncrRefCount(errPtr->errorMsg);
errPtr->returnOpts = Tcl_GetReturnOptions(interp, code);
@@ -230,7 +219,7 @@ HandleBgErrors(
errPtr = assocPtr->firstBgPtr;
Tcl_ListObjGetElements(NULL, copyObj, &prefixObjc, &prefixObjv);
- tempObjv = ckalloc((prefixObjc+2) * sizeof(Tcl_Obj *));
+ tempObjv = Tcl_Alloc((prefixObjc+2) * sizeof(Tcl_Obj *));
memcpy(tempObjv, prefixObjv, prefixObjc*sizeof(Tcl_Obj *));
tempObjv[prefixObjc] = errPtr->errorMsg;
tempObjv[prefixObjc+1] = errPtr->returnOpts;
@@ -245,8 +234,8 @@ HandleBgErrors(
Tcl_DecrRefCount(errPtr->errorMsg);
Tcl_DecrRefCount(errPtr->returnOpts);
assocPtr->firstBgPtr = errPtr->nextPtr;
- ckfree(errPtr);
- ckfree(tempObjv);
+ Tcl_Free(errPtr);
+ Tcl_Free(tempObjv);
if (code == TCL_BREAK) {
/*
@@ -259,7 +248,7 @@ HandleBgErrors(
assocPtr->firstBgPtr = errPtr->nextPtr;
Tcl_DecrRefCount(errPtr->errorMsg);
Tcl_DecrRefCount(errPtr->returnOpts);
- ckfree(errPtr);
+ Tcl_Free(errPtr);
}
} else if ((code == TCL_ERROR) && !Tcl_IsSafe(interp)) {
Tcl_Channel errChannel = Tcl_GetStdChannel(TCL_STDERR);
@@ -528,7 +517,7 @@ TclSetBgErrorHandler(
* First access: initialize.
*/
- assocPtr = ckalloc(sizeof(ErrAssocData));
+ assocPtr = Tcl_Alloc(sizeof(ErrAssocData));
assocPtr->interp = interp;
assocPtr->cmdPrefix = NULL;
assocPtr->firstBgPtr = NULL;
@@ -607,7 +596,7 @@ BgErrorDeleteProc(
assocPtr->firstBgPtr = errPtr->nextPtr;
Tcl_DecrRefCount(errPtr->errorMsg);
Tcl_DecrRefCount(errPtr->returnOpts);
- ckfree(errPtr);
+ Tcl_Free(errPtr);
}
Tcl_CancelIdleCall(HandleBgErrors, assocPtr);
Tcl_DecrRefCount(assocPtr->cmdPrefix);
@@ -637,7 +626,7 @@ Tcl_CreateExitHandler(
Tcl_ExitProc *proc, /* Function to invoke. */
ClientData clientData) /* Arbitrary value to pass to proc. */
{
- ExitHandler *exitPtr = ckalloc(sizeof(ExitHandler));
+ ExitHandler *exitPtr = Tcl_Alloc(sizeof(ExitHandler));
exitPtr->proc = proc;
exitPtr->clientData = clientData;
@@ -670,7 +659,7 @@ TclCreateLateExitHandler(
Tcl_ExitProc *proc, /* Function to invoke. */
ClientData clientData) /* Arbitrary value to pass to proc. */
{
- ExitHandler *exitPtr = ckalloc(sizeof(ExitHandler));
+ ExitHandler *exitPtr = Tcl_Alloc(sizeof(ExitHandler));
exitPtr->proc = proc;
exitPtr->clientData = clientData;
@@ -715,7 +704,7 @@ Tcl_DeleteExitHandler(
} else {
prevPtr->nextPtr = exitPtr->nextPtr;
}
- ckfree(exitPtr);
+ Tcl_Free(exitPtr);
break;
}
}
@@ -758,7 +747,7 @@ TclDeleteLateExitHandler(
} else {
prevPtr->nextPtr = exitPtr->nextPtr;
}
- ckfree(exitPtr);
+ Tcl_Free(exitPtr);
break;
}
}
@@ -792,7 +781,7 @@ Tcl_CreateThreadExitHandler(
ExitHandler *exitPtr;
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
- exitPtr = ckalloc(sizeof(ExitHandler));
+ exitPtr = Tcl_Alloc(sizeof(ExitHandler));
exitPtr->proc = proc;
exitPtr->clientData = clientData;
exitPtr->nextPtr = tsdPtr->firstExitPtr;
@@ -834,7 +823,7 @@ Tcl_DeleteThreadExitHandler(
} else {
prevPtr->nextPtr = exitPtr->nextPtr;
}
- ckfree(exitPtr);
+ Tcl_Free(exitPtr);
return;
}
}
@@ -912,7 +901,7 @@ InvokeExitHandlers(void)
firstExitPtr = exitPtr->nextPtr;
Tcl_MutexUnlock(&exitMutex);
exitPtr->proc(exitPtr->clientData);
- ckfree(exitPtr);
+ Tcl_Free(exitPtr);
Tcl_MutexLock(&exitMutex);
}
firstExitPtr = NULL;
@@ -1140,7 +1129,7 @@ Tcl_Finalize(void)
firstLateExitPtr = exitPtr->nextPtr;
Tcl_MutexUnlock(&exitMutex);
exitPtr->proc(exitPtr->clientData);
- ckfree(exitPtr);
+ Tcl_Free(exitPtr);
Tcl_MutexLock(&exitMutex);
}
firstLateExitPtr = NULL;
@@ -1251,7 +1240,7 @@ Tcl_Finalize(void)
TclResetFilesystem();
/*
- * At this point, there should no longer be any ckalloc'ed memory.
+ * At this point, there should no longer be any Tcl_Alloc'ed memory.
*/
TclFinalizeMemorySubsystem();
@@ -1310,7 +1299,7 @@ FinalizeThread(
tsdPtr->firstExitPtr = exitPtr->nextPtr;
exitPtr->proc(exitPtr->clientData);
- ckfree(exitPtr);
+ Tcl_Free(exitPtr);
}
TclFinalizeIOSubsystem();
TclFinalizeNotifier();
@@ -1411,7 +1400,7 @@ Tcl_VwaitObjCmd(
Tcl_WrongNumArgs(interp, 1, objv, "name");
return TCL_ERROR;
}
- nameString = Tcl_GetString(objv[1]);
+ nameString = TclGetString(objv[1]);
if (Tcl_TraceVar2(interp, nameString, NULL,
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
VwaitVarProc, &done) != TCL_OK) {
@@ -1573,7 +1562,7 @@ NewThreadProc(
threadProc = cdPtr->proc;
threadClientData = cdPtr->clientData;
- ckfree(clientData); /* Allocated in Tcl_CreateThread() */
+ Tcl_Free(clientData); /* Allocated in Tcl_CreateThread() */
threadProc(threadClientData);
@@ -1605,19 +1594,19 @@ Tcl_CreateThread(
Tcl_ThreadId *idPtr, /* Return, the ID of the thread */
Tcl_ThreadCreateProc *proc, /* Main() function of the thread */
ClientData clientData, /* The one argument to Main() */
- int stackSize, /* Size of stack for the new thread */
+ size_t stackSize, /* Size of stack for the new thread */
int flags) /* Flags controlling behaviour of the new
* thread. */
{
#if TCL_THREADS
- ThreadClientData *cdPtr = ckalloc(sizeof(ThreadClientData));
+ ThreadClientData *cdPtr = Tcl_Alloc(sizeof(ThreadClientData));
int result;
cdPtr->proc = proc;
cdPtr->clientData = clientData;
result = TclpThreadCreate(idPtr, NewThreadProc, cdPtr, stackSize, flags);
if (result != TCL_OK) {
- ckfree(cdPtr);
+ Tcl_Free(cdPtr);
}
return result;
#else
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index faf5865..f9b6566 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -73,11 +73,11 @@ int tclTraceExec = 0;
* expression opcodes (e.g., INST_LOR) in tclCompile.h.
*
* Does not include the string for INST_EXPON (and beyond), as that is
- * disjoint for backward-compatability reasons.
+ * disjoint for backward-compatibility reasons.
*/
static const char *const operatorStrings[] = {
- "||", "&&", "|", "^", "&", "==", "!=", "<", ">", "<=", ">=", "<<", ">>",
+ "|", "^", "&", "==", "!=", "<", ">", "<=", ">=", "<<", ">>",
"+", "-", "*", "/", "%", "+", "-", "~", "!"
};
@@ -101,64 +101,6 @@ size_t tclObjsAlloced = 0;
size_t tclObjsFreed = 0;
size_t tclObjsShared[TCL_MAX_SHARED_OBJ_STATS] = { 0, 0, 0, 0, 0 };
#endif /* TCL_COMPILE_STATS */
-
-/*
- * Support pre-8.5 bytecodes unless specifically requested otherwise.
- */
-
-#ifndef TCL_SUPPORT_84_BYTECODE
-#define TCL_SUPPORT_84_BYTECODE 1
-#endif
-
-#if TCL_SUPPORT_84_BYTECODE
-/*
- * We need to know the tclBuiltinFuncTable to support translation of pre-8.5
- * math functions to the namespace-based ::tcl::mathfunc::op in 8.5+.
- */
-
-typedef struct {
- const char *name; /* Name of function. */
- int numArgs; /* Number of arguments for function. */
-} BuiltinFunc;
-
-/*
- * Table describing the built-in math functions. Entries in this table are
- * indexed by the values of the INST_CALL_BUILTIN_FUNC instruction's
- * operand byte.
- */
-
-static BuiltinFunc const tclBuiltinFuncTable[] = {
- {"acos", 1},
- {"asin", 1},
- {"atan", 1},
- {"atan2", 2},
- {"ceil", 1},
- {"cos", 1},
- {"cosh", 1},
- {"exp", 1},
- {"floor", 1},
- {"fmod", 2},
- {"hypot", 2},
- {"log", 1},
- {"log10", 1},
- {"pow", 2},
- {"sin", 1},
- {"sinh", 1},
- {"sqrt", 1},
- {"tan", 1},
- {"tanh", 1},
- {"abs", 1},
- {"double", 1},
- {"int", 1},
- {"rand", 0},
- {"round", 1},
- {"srand", 1},
- {"wide", 1},
- {NULL, 0},
-};
-
-#define LAST_BUILTIN_FUNC 25
-#endif
/*
* NR_TEBC
@@ -166,7 +108,7 @@ static BuiltinFunc const tclBuiltinFuncTable[] = {
* Minimal data required to fully reconstruct the execution state.
*/
-typedef struct TEBCdata {
+typedef struct {
ByteCode *codePtr; /* Constant until the BC returns */
/* -----------------------------------------*/
ptrdiff_t *catchTop; /* These fields are used on return TO this */
@@ -501,13 +443,13 @@ VarHashCreateVar(
#define GetNumberFromObj(interp, objPtr, ptrPtr, tPtr) \
((TclHasIntRep((objPtr), &tclIntType)) \
? (*(tPtr) = TCL_NUMBER_INT, \
- *(ptrPtr) = (ClientData) \
+ *(ptrPtr) = (void *) \
(&((objPtr)->internalRep.wideValue)), TCL_OK) : \
TclHasIntRep((objPtr), &tclDoubleType) \
? (((TclIsNaN((objPtr)->internalRep.doubleValue)) \
? (*(tPtr) = TCL_NUMBER_NAN) \
: (*(tPtr) = TCL_NUMBER_DOUBLE)), \
- *(ptrPtr) = (ClientData) \
+ *(ptrPtr) = (void *) \
(&((objPtr)->internalRep.doubleValue)), TCL_OK) : \
(((objPtr)->bytes != NULL) && ((objPtr)->length == 0)) \
? TCL_ERROR : \
@@ -683,7 +625,7 @@ static void FreeExprCodeInternalRep(Tcl_Obj *objPtr);
static ExceptionRange * GetExceptRangeForPc(const unsigned char *pc,
int searchMode, ByteCode *codePtr);
static const char * GetSrcInfoForPc(const unsigned char *pc,
- ByteCode *codePtr, int *lengthPtr,
+ ByteCode *codePtr, size_t *lengthPtr,
const unsigned char **pcBeg, int *cmdIdxPtr);
static Tcl_Obj ** GrowEvaluationStack(ExecEnv *eePtr, int growth,
int move);
@@ -693,8 +635,8 @@ static void InitByteCodeExecution(Tcl_Interp *interp);
static inline int wordSkip(void *ptr);
static void ReleaseDictIterator(Tcl_Obj *objPtr);
/* Useful elsewhere, make available in tclInt.h or stubs? */
-static Tcl_Obj ** StackAllocWords(Tcl_Interp *interp, int numWords);
-static Tcl_Obj ** StackReallocWords(Tcl_Interp *interp, int numWords);
+static Tcl_Obj ** StackAllocWords(Tcl_Interp *interp, size_t numWords);
+static Tcl_Obj ** StackReallocWords(Tcl_Interp *interp, size_t numWords);
static Tcl_NRPostProc CopyCallback;
static Tcl_NRPostProc ExprObjCallback;
static Tcl_NRPostProc FinalizeOONext;
@@ -760,7 +702,7 @@ ReleaseDictIterator(
searchPtr = irPtr->twoPtrValue.ptr1;
Tcl_DictObjDone(searchPtr);
- ckfree(searchPtr);
+ Tcl_Free(searchPtr);
dictPtr = irPtr->twoPtrValue.ptr2;
TclDecrRefCount(dictPtr);
@@ -830,12 +772,12 @@ ExecEnv *
TclCreateExecEnv(
Tcl_Interp *interp, /* Interpreter for which the execution
* environment is being created. */
- int size) /* The initial stack size, in number of words
+ size_t size) /* The initial stack size, in number of words
* [sizeof(Tcl_Obj*)] */
{
- ExecEnv *eePtr = ckalloc(sizeof(ExecEnv));
- ExecStack *esPtr = ckalloc(sizeof(ExecStack)
- + (size_t) (size-1) * sizeof(Tcl_Obj *));
+ ExecEnv *eePtr = Tcl_Alloc(sizeof(ExecEnv));
+ ExecStack *esPtr = Tcl_Alloc(sizeof(ExecStack)
+ + (size-1) * sizeof(Tcl_Obj *));
eePtr->execStackPtr = esPtr;
TclNewIntObj(eePtr->constants[0], 0);
@@ -894,7 +836,7 @@ DeleteExecStack(
if (esPtr->nextPtr) {
esPtr->nextPtr->prevPtr = esPtr->prevPtr;
}
- ckfree(esPtr);
+ Tcl_Free(esPtr);
}
void
@@ -926,7 +868,7 @@ TclDeleteExecEnv(
if (eePtr->corPtr && !cachedInExit) {
Tcl_Panic("Deleting execEnv with existing coroutine");
}
- ckfree(eePtr);
+ Tcl_Free(eePtr);
}
/*
@@ -1017,8 +959,8 @@ GrowEvaluationStack(
int move) /* 1 if move words since last marker. */
{
ExecStack *esPtr = eePtr->execStackPtr, *oldPtr = NULL;
- int newBytes, newElems, currElems;
- int needed = growth - (esPtr->endPtr - esPtr->tosPtr);
+ size_t newBytes;
+ int newElems, currElems, needed = growth - (esPtr->endPtr - esPtr->tosPtr);
Tcl_Obj **markerPtr = esPtr->markerPtr, **memStart;
int moveWords = 0;
@@ -1103,7 +1045,7 @@ GrowEvaluationStack(
newBytes = sizeof(ExecStack) + (newElems-1) * sizeof(Tcl_Obj *);
oldPtr = esPtr;
- esPtr = ckalloc(newBytes);
+ esPtr = Tcl_Alloc(newBytes);
oldPtr->nextPtr = esPtr;
esPtr->prevPtr = oldPtr;
@@ -1163,7 +1105,7 @@ GrowEvaluationStack(
static Tcl_Obj **
StackAllocWords(
Tcl_Interp *interp,
- int numWords)
+ size_t numWords)
{
/*
* Note that GrowEvaluationStack sets a marker in the stack. This marker
@@ -1181,7 +1123,7 @@ StackAllocWords(
static Tcl_Obj **
StackReallocWords(
Tcl_Interp *interp,
- int numWords)
+ size_t numWords)
{
Interp *iPtr = (Interp *) interp;
ExecEnv *eePtr = iPtr->execEnvPtr;
@@ -1202,7 +1144,7 @@ TclStackFree(
Tcl_Obj **markerPtr, *marker;
if (iPtr == NULL || iPtr->execEnvPtr == NULL) {
- ckfree(freePtr);
+ Tcl_Free(freePtr);
return;
}
@@ -1260,32 +1202,32 @@ TclStackFree(
void *
TclStackAlloc(
Tcl_Interp *interp,
- int numBytes)
+ size_t numBytes)
{
Interp *iPtr = (Interp *) interp;
- int numWords;
+ size_t numWords;
if (iPtr == NULL || iPtr->execEnvPtr == NULL) {
- return (void *) ckalloc(numBytes);
+ return (void *) Tcl_Alloc(numBytes);
}
numWords = (numBytes + (sizeof(Tcl_Obj *) - 1))/sizeof(Tcl_Obj *);
- return (void *) StackAllocWords(interp, numWords);
+ return StackAllocWords(interp, numWords);
}
void *
TclStackRealloc(
Tcl_Interp *interp,
void *ptr,
- int numBytes)
+ size_t numBytes)
{
Interp *iPtr = (Interp *) interp;
ExecEnv *eePtr;
ExecStack *esPtr;
Tcl_Obj **markerPtr;
- int numWords;
+ size_t numWords;
if (iPtr == NULL || iPtr->execEnvPtr == NULL) {
- return (void *) ckrealloc((char *) ptr, numBytes);
+ return Tcl_Realloc(ptr, numBytes);
}
eePtr = iPtr->execEnvPtr;
@@ -1327,7 +1269,7 @@ int
Tcl_ExprObj(
Tcl_Interp *interp, /* Context in which to evaluate the
* expression. */
- register Tcl_Obj *objPtr, /* Points to Tcl object containing expression
+ Tcl_Obj *objPtr, /* Points to Tcl object containing expression
* to evaluate. */
Tcl_Obj **resultPtrPtr) /* Where the Tcl_Obj* that is the expression
* result is stored if no errors occur. */
@@ -1444,7 +1386,7 @@ CompileExprObj(
Interp *iPtr = (Interp *) interp;
CompileEnv compEnv; /* Compilation environment structure allocated
* in frame. */
- register ByteCode *codePtr = NULL;
+ ByteCode *codePtr = NULL;
/* Tcl Internal type of bytecode. Initialized
* to avoid compiler warning. */
@@ -1473,10 +1415,11 @@ CompileExprObj(
* TIP #280: No invoker (yet) - Expression compilation.
*/
- const char *string = TclGetString(objPtr);
+ size_t length;
+ const char *string = TclGetStringFromObj(objPtr, &length);
- TclInitCompileEnv(interp, &compEnv, string, objPtr->length, NULL, 0);
- TclCompileExpr(interp, string, objPtr->length, &compEnv, 0);
+ TclInitCompileEnv(interp, &compEnv, string, length, NULL, 0);
+ TclCompileExpr(interp, string, length, &compEnv, 0);
/*
* Successful compilation. If the expression yielded no instructions,
@@ -1598,8 +1541,8 @@ TclCompileObj(
const CmdFrame *invoker,
int word)
{
- register Interp *iPtr = (Interp *) interp;
- register ByteCode *codePtr; /* Tcl Internal type of bytecode. */
+ Interp *iPtr = (Interp *) interp;
+ ByteCode *codePtr; /* Tcl Internal type of bytecode. */
Namespace *namespacePtr = iPtr->varFramePtr->nsPtr;
/*
@@ -2501,7 +2444,7 @@ TEBCresume(
#ifdef TCL_COMPILE_DEBUG
/* FIXME: What is the right thing to trace? */
{
- register int i;
+ int i;
TRACE(("%d [", opnd));
for (i=opnd-1 ; i>=0 ; i--) {
@@ -2631,7 +2574,7 @@ TEBCresume(
* command starts.
*
* Use a Tcl_Obj as linked list element; slight mem waste, but faster
- * allocation than ckalloc. This also abuses the Tcl_Obj structure, as
+ * allocation than Tcl_Alloc. This also abuses the Tcl_Obj structure, as
* we do not define a special tclObjType for it. It is not dangerous
* as the obj is never passed anywhere, so that all manipulations are
* performed here and in INST_INVOKE_EXPANDED (in case of an expansion
@@ -2821,91 +2764,6 @@ TEBCresume(
return TclNREvalObjv(interp, objc, objv,
TCL_EVAL_NOERR | TCL_EVAL_SOURCE_IN_FRAME, NULL);
-#if TCL_SUPPORT_84_BYTECODE
- case INST_CALL_BUILTIN_FUNC1:
- /*
- * Call one of the built-in pre-8.5 Tcl math functions. This
- * translates to INST_INVOKE_STK1 with the first argument of
- * ::tcl::mathfunc::$objv[0]. We need to insert the named math
- * function into the stack.
- */
-
- opnd = TclGetUInt1AtPtr(pc+1);
- if ((opnd < 0) || (opnd > LAST_BUILTIN_FUNC)) {
- TRACE(("UNRECOGNIZED BUILTIN FUNC CODE %d\n", opnd));
- Tcl_Panic("TclNRExecuteByteCode: unrecognized builtin function code %d", opnd);
- }
-
- TclNewLiteralStringObj(objPtr, "::tcl::mathfunc::");
- Tcl_AppendToObj(objPtr, tclBuiltinFuncTable[opnd].name, -1);
-
- /*
- * Only 0, 1 or 2 args.
- */
-
- {
- int numArgs = tclBuiltinFuncTable[opnd].numArgs;
- Tcl_Obj *tmpPtr1, *tmpPtr2;
-
- if (numArgs == 0) {
- PUSH_OBJECT(objPtr);
- } else if (numArgs == 1) {
- tmpPtr1 = POP_OBJECT();
- PUSH_OBJECT(objPtr);
- PUSH_OBJECT(tmpPtr1);
- Tcl_DecrRefCount(tmpPtr1);
- } else {
- tmpPtr2 = POP_OBJECT();
- tmpPtr1 = POP_OBJECT();
- PUSH_OBJECT(objPtr);
- PUSH_OBJECT(tmpPtr1);
- PUSH_OBJECT(tmpPtr2);
- Tcl_DecrRefCount(tmpPtr1);
- Tcl_DecrRefCount(tmpPtr2);
- }
- objc = numArgs + 1;
- }
- pcAdjustment = 2;
- goto doInvocation;
-
- case INST_CALL_FUNC1:
- /*
- * Call a non-builtin Tcl math function previously registered by a
- * call to Tcl_CreateMathFunc pre-8.5. This is essentially
- * INST_INVOKE_STK1 converting the first arg to
- * ::tcl::mathfunc::$objv[0].
- */
-
- objc = TclGetUInt1AtPtr(pc+1); /* Number of arguments. The function
- * name is the 0-th argument. */
-
- objPtr = OBJ_AT_DEPTH(objc-1);
- TclNewLiteralStringObj(tmpPtr, "::tcl::mathfunc::");
- Tcl_AppendObjToObj(tmpPtr, objPtr);
- Tcl_DecrRefCount(objPtr);
-
- /*
- * Variation of PUSH_OBJECT.
- */
-
- OBJ_AT_DEPTH(objc-1) = tmpPtr;
- Tcl_IncrRefCount(tmpPtr);
-
- pcAdjustment = 2;
- goto doInvocation;
-#else
- /*
- * INST_CALL_BUILTIN_FUNC1 and INST_CALL_FUNC1 were made obsolete by the
- * changes to add a ::tcl::mathfunc namespace in 8.5. Optional support
- * remains for existing bytecode precompiled files.
- */
-
- case INST_CALL_BUILTIN_FUNC1:
- Tcl_Panic("TclNRExecuteByteCode: obsolete INST_CALL_BUILTIN_FUNC1 found");
- case INST_CALL_FUNC1:
- Tcl_Panic("TclNRExecuteByteCode: obsolete INST_CALL_FUNC1 found");
-#endif
-
case INST_INVOKE_REPLACE:
objc = TclGetUInt4AtPtr(pc+1);
opnd = TclGetUInt1AtPtr(pc+5);
@@ -3726,7 +3584,7 @@ TEBCresume(
arrayPtr = NULL;
part1Ptr = part2Ptr = NULL;
cleanup = 0;
- TRACE(("%u %s => ", opnd, Tcl_GetString(incrPtr)));
+ TRACE(("%u %s => ", opnd, TclGetString(incrPtr)));
doIncrVar:
if (TclIsVarDirectModifyable2(varPtr, arrayPtr)) {
@@ -3993,29 +3851,6 @@ TEBCresume(
CACHE_STACK_INFO();
TRACE_ERROR(interp);
goto gotError;
-
- /*
- * This is really an unset operation these days. Do not issue.
- */
-
- case INST_DICT_DONE:
- opnd = TclGetUInt4AtPtr(pc+1);
- TRACE(("%u => OK\n", opnd));
- varPtr = LOCAL(opnd);
- while (TclIsVarLink(varPtr)) {
- varPtr = varPtr->value.linkPtr;
- }
- if (TclIsVarDirectUnsettable(varPtr) && !TclIsVarInHash(varPtr)) {
- if (!TclIsVarUndefined(varPtr)) {
- TclDecrRefCount(varPtr->value.objPtr);
- }
- varPtr->value.objPtr = NULL;
- } else {
- DECACHE_STACK_INFO();
- TclPtrUnsetVarIdx(interp, varPtr, NULL, NULL, NULL, 0, opnd);
- CACHE_STACK_INFO();
- }
- NEXT_INST_F(5, 0, 0);
}
/*
@@ -4334,50 +4169,6 @@ TEBCresume(
}
/*
- * These two instructions are now redundant: the complete logic of the LOR
- * and LAND is now handled by the expression compiler.
- */
-
- case INST_LOR:
- case INST_LAND: {
- /*
- * Operands must be boolean or numeric. No int->double conversions are
- * performed.
- */
-
- int i1, i2, iResult;
-
- value2Ptr = OBJ_AT_TOS;
- valuePtr = OBJ_UNDER_TOS;
- if (TclGetBooleanFromObj(NULL, valuePtr, &i1) != TCL_OK) {
- TRACE(("\"%.20s\" => ILLEGAL TYPE %s \n", O2S(valuePtr),
- (valuePtr->typePtr? valuePtr->typePtr->name : "null")));
- DECACHE_STACK_INFO();
- IllegalExprOperandType(interp, pc, valuePtr);
- CACHE_STACK_INFO();
- goto gotError;
- }
-
- if (TclGetBooleanFromObj(NULL, value2Ptr, &i2) != TCL_OK) {
- TRACE(("\"%.20s\" => ILLEGAL TYPE %s \n", O2S(value2Ptr),
- (value2Ptr->typePtr? value2Ptr->typePtr->name : "null")));
- DECACHE_STACK_INFO();
- IllegalExprOperandType(interp, pc, value2Ptr);
- CACHE_STACK_INFO();
- goto gotError;
- }
-
- if (*pc == INST_LOR) {
- iResult = (i1 || i2);
- } else {
- iResult = (i1 && i2);
- }
- objResultPtr = TCONST(iResult);
- TRACE(("%.20s %.20s => %d\n", O2S(valuePtr),O2S(value2Ptr),iResult));
- NEXT_INST_F(1, 2, 1);
- }
-
- /*
* -----------------------------------------------------------------
* Start of general introspector instructions.
*/
@@ -4411,8 +4202,8 @@ TEBCresume(
NEXT_INST_F(1, 0, 1);
case INST_INFO_LEVEL_ARGS: {
int level;
- register CallFrame *framePtr = iPtr->varFramePtr;
- register CallFrame *rootFramePtr = iPtr->rootFramePtr;
+ CallFrame *framePtr = iPtr->varFramePtr;
+ CallFrame *rootFramePtr = iPtr->rootFramePtr;
TRACE(("\"%.30s\" => ", O2S(OBJ_AT_TOS)));
if (TclGetIntFromObj(interp, OBJ_AT_TOS, &level) != TCL_OK) {
@@ -4709,7 +4500,7 @@ TEBCresume(
}
{
- register Method *const mPtr =
+ Method *const mPtr =
contextPtr->callPtr->chain[newDepth].mPtr;
return mPtr->typePtr->callProc(mPtr->clientData, interp,
@@ -4754,8 +4545,8 @@ TEBCresume(
*/
{
- int index, numIndices, fromIdx, toIdx;
- int nocase, match, length2, cflags, s1len, s2len;
+ int numIndices, nocase, match, cflags;
+ size_t slength, length2, fromIdx, toIdx, index, s1len, s2len;
const char *s1, *s2;
case INST_LIST:
@@ -4838,7 +4629,7 @@ TEBCresume(
pcAdjustment = 5;
lindexFastPath:
- if (index >= 0 && index < objc) {
+ if (index < (size_t)objc) {
objResultPtr = objv[index];
} else {
TclNewObj(objResultPtr);
@@ -5001,13 +4792,13 @@ TEBCresume(
NEXT_INST_F(9, 1, 1);
}
toIdx = TclIndexDecode(toIdx, objc - 1);
- if (toIdx < 0) {
+ if (toIdx == TCL_INDEX_NONE) {
goto emptyList;
- } else if (toIdx >= objc) {
+ } else if (toIdx + 1 >= (size_t)objc + 1) {
toIdx = objc - 1;
}
- assert ( toIdx >= 0 && toIdx < objc);
+ assert (toIdx < (size_t)objc);
/*
assert ( fromIdx != TCL_INDEX_NONE );
*
@@ -5163,24 +4954,24 @@ TEBCresume(
case INST_STR_LEN:
valuePtr = OBJ_AT_TOS;
- length = Tcl_GetCharLength(valuePtr);
- TclNewIntObj(objResultPtr, length);
- TRACE(("\"%.20s\" => %d\n", O2S(valuePtr), length));
+ slength = Tcl_GetCharLength(valuePtr);
+ objResultPtr = TclNewWideIntObjFromSize(slength);
+ TRACE(("\"%.20s\" => %" TCL_Z_MODIFIER "u\n", O2S(valuePtr), slength));
NEXT_INST_F(1, 1, 1);
case INST_STR_UPPER:
valuePtr = OBJ_AT_TOS;
TRACE(("\"%.20s\" => ", O2S(valuePtr)));
if (Tcl_IsShared(valuePtr)) {
- s1 = TclGetStringFromObj(valuePtr, &length);
- TclNewStringObj(objResultPtr, s1, length);
- length = Tcl_UtfToUpper(TclGetString(objResultPtr));
- Tcl_SetObjLength(objResultPtr, length);
+ s1 = TclGetStringFromObj(valuePtr, &slength);
+ TclNewStringObj(objResultPtr, s1, slength);
+ slength = Tcl_UtfToUpper(TclGetString(objResultPtr));
+ Tcl_SetObjLength(objResultPtr, slength);
TRACE_APPEND(("\"%.20s\"\n", O2S(objResultPtr)));
NEXT_INST_F(1, 1, 1);
} else {
- length = Tcl_UtfToUpper(TclGetString(valuePtr));
- Tcl_SetObjLength(valuePtr, length);
+ slength = Tcl_UtfToUpper(TclGetString(valuePtr));
+ Tcl_SetObjLength(valuePtr, slength);
TclFreeIntRep(valuePtr);
TRACE_APPEND(("\"%.20s\"\n", O2S(valuePtr)));
NEXT_INST_F(1, 0, 0);
@@ -5189,15 +4980,15 @@ TEBCresume(
valuePtr = OBJ_AT_TOS;
TRACE(("\"%.20s\" => ", O2S(valuePtr)));
if (Tcl_IsShared(valuePtr)) {
- s1 = TclGetStringFromObj(valuePtr, &length);
- TclNewStringObj(objResultPtr, s1, length);
- length = Tcl_UtfToLower(TclGetString(objResultPtr));
- Tcl_SetObjLength(objResultPtr, length);
+ s1 = TclGetStringFromObj(valuePtr, &slength);
+ TclNewStringObj(objResultPtr, s1, slength);
+ slength = Tcl_UtfToLower(TclGetString(objResultPtr));
+ Tcl_SetObjLength(objResultPtr, slength);
TRACE_APPEND(("\"%.20s\"\n", O2S(objResultPtr)));
NEXT_INST_F(1, 1, 1);
} else {
- length = Tcl_UtfToLower(TclGetString(valuePtr));
- Tcl_SetObjLength(valuePtr, length);
+ slength = Tcl_UtfToLower(TclGetString(valuePtr));
+ Tcl_SetObjLength(valuePtr, slength);
TclFreeIntRep(valuePtr);
TRACE_APPEND(("\"%.20s\"\n", O2S(valuePtr)));
NEXT_INST_F(1, 0, 0);
@@ -5206,15 +4997,15 @@ TEBCresume(
valuePtr = OBJ_AT_TOS;
TRACE(("\"%.20s\" => ", O2S(valuePtr)));
if (Tcl_IsShared(valuePtr)) {
- s1 = TclGetStringFromObj(valuePtr, &length);
- TclNewStringObj(objResultPtr, s1, length);
- length = Tcl_UtfToTitle(TclGetString(objResultPtr));
- Tcl_SetObjLength(objResultPtr, length);
+ s1 = TclGetStringFromObj(valuePtr, &slength);
+ TclNewStringObj(objResultPtr, s1, slength);
+ slength = Tcl_UtfToTitle(TclGetString(objResultPtr));
+ Tcl_SetObjLength(objResultPtr, slength);
TRACE_APPEND(("\"%.20s\"\n", O2S(objResultPtr)));
NEXT_INST_F(1, 1, 1);
} else {
- length = Tcl_UtfToTitle(TclGetString(valuePtr));
- Tcl_SetObjLength(valuePtr, length);
+ slength = Tcl_UtfToTitle(TclGetString(valuePtr));
+ Tcl_SetObjLength(valuePtr, slength);
TclFreeIntRep(valuePtr);
TRACE_APPEND(("\"%.20s\"\n", O2S(valuePtr)));
NEXT_INST_F(1, 0, 0);
@@ -5229,18 +5020,18 @@ TEBCresume(
* Get char length to calulate what 'end' means.
*/
- length = Tcl_GetCharLength(valuePtr);
- if (TclGetIntForIndexM(interp, value2Ptr, length-1, &index)!=TCL_OK) {
+ slength = Tcl_GetCharLength(valuePtr);
+ if (TclGetIntForIndexM(interp, value2Ptr, slength-1, &index)!=TCL_OK) {
TRACE_ERROR(interp);
goto gotError;
}
- if ((index < 0) || (index >= length)) {
+ if (index >= slength) {
TclNewObj(objResultPtr);
} else if (TclIsPureByteArray(valuePtr)) {
objResultPtr = Tcl_NewByteArrayObj(
Tcl_GetByteArrayFromObj(valuePtr, NULL)+index, 1);
- } else if (valuePtr->bytes && length == valuePtr->length) {
+ } else if (valuePtr->bytes && slength == valuePtr->length) {
objResultPtr = Tcl_NewStringObj((const char *)
valuePtr->bytes+index, 1);
} else {
@@ -5255,11 +5046,11 @@ TEBCresume(
if (ch == -1) {
objResultPtr = Tcl_NewObj();
} else {
- length = Tcl_UniCharToUtf(ch, buf);
- if ((ch >= 0xD800) && (length < 3)) {
- length += Tcl_UniCharToUtf(-1, buf + length);
+ slength = Tcl_UniCharToUtf(ch, buf);
+ if ((ch >= 0xD800) && (slength < 3)) {
+ slength += Tcl_UniCharToUtf(-1, buf + slength);
}
- objResultPtr = Tcl_NewStringObj(buf, length);
+ objResultPtr = Tcl_NewStringObj(buf, slength);
}
}
@@ -5269,22 +5060,22 @@ TEBCresume(
case INST_STR_RANGE:
TRACE(("\"%.20s\" %.20s %.20s =>",
O2S(OBJ_AT_DEPTH(2)), O2S(OBJ_UNDER_TOS), O2S(OBJ_AT_TOS)));
- length = Tcl_GetCharLength(OBJ_AT_DEPTH(2)) - 1;
- if (TclGetIntForIndexM(interp, OBJ_UNDER_TOS, length,
+ slength = Tcl_GetCharLength(OBJ_AT_DEPTH(2)) - 1;
+ if (TclGetIntForIndexM(interp, OBJ_UNDER_TOS, slength,
&fromIdx) != TCL_OK
- || TclGetIntForIndexM(interp, OBJ_AT_TOS, length,
+ || TclGetIntForIndexM(interp, OBJ_AT_TOS, slength,
&toIdx) != TCL_OK) {
TRACE_ERROR(interp);
goto gotError;
}
- if (fromIdx < 0) {
- fromIdx = 0;
+ if (fromIdx == TCL_INDEX_NONE) {
+ fromIdx = TCL_INDEX_START;
}
- if (toIdx >= length) {
- toIdx = length;
+ if (toIdx + 1 >= slength + 1) {
+ toIdx = slength;
}
- if (toIdx >= fromIdx) {
+ if (toIdx + 1 >= fromIdx + 1) {
objResultPtr = Tcl_GetRange(OBJ_AT_DEPTH(2), fromIdx, toIdx);
} else {
TclNewObj(objResultPtr);
@@ -5296,11 +5087,11 @@ TEBCresume(
valuePtr = OBJ_AT_TOS;
fromIdx = TclGetInt4AtPtr(pc+1);
toIdx = TclGetInt4AtPtr(pc+5);
- length = Tcl_GetCharLength(valuePtr);
- TRACE(("\"%.20s\" %d %d => ", O2S(valuePtr), fromIdx, toIdx));
+ slength = Tcl_GetCharLength(valuePtr);
+ TRACE(("\"%.20s\" %" TCL_LL_MODIFIER "d %" TCL_LL_MODIFIER "d => ", O2S(valuePtr), TclWideIntFromSize(fromIdx), TclWideIntFromSize(toIdx)));
/* Every range of an empty value is an empty value */
- if (length == 0) {
+ if (slength == 0) {
TRACE_APPEND(("\n"));
NEXT_INST_F(9, 0, 0);
}
@@ -5316,14 +5107,14 @@ TEBCresume(
goto emptyRange;
}
- toIdx = TclIndexDecode(toIdx, length - 1);
- if (toIdx < 0) {
+ toIdx = TclIndexDecode(toIdx, slength - 1);
+ if (toIdx == TCL_INDEX_NONE) {
goto emptyRange;
- } else if (toIdx >= length) {
- toIdx = length - 1;
+ } else if (toIdx >= slength) {
+ toIdx = slength - 1;
}
- assert ( toIdx >= 0 && toIdx < length );
+ assert ( toIdx != TCL_INDEX_NONE && toIdx < slength );
/*
assert ( fromIdx != TCL_INDEX_NONE );
@@ -5334,12 +5125,12 @@ TEBCresume(
fromIdx = TCL_INDEX_START;
}
- fromIdx = TclIndexDecode(fromIdx, length - 1);
- if (fromIdx < 0) {
- fromIdx = 0;
+ fromIdx = TclIndexDecode(fromIdx, slength - 1);
+ if (fromIdx == TCL_INDEX_NONE) {
+ fromIdx = TCL_INDEX_START;
}
- if (fromIdx <= toIdx) {
+ if (fromIdx + 1 <= toIdx + 1) {
objResultPtr = Tcl_GetRange(valuePtr, fromIdx, toIdx);
} else {
emptyRange:
@@ -5350,18 +5141,18 @@ TEBCresume(
{
Tcl_UniChar *ustring1, *ustring2, *ustring3, *end, *p;
- int length3, endIdx;
+ size_t length3;
Tcl_Obj *value3Ptr;
case INST_STR_REPLACE:
value3Ptr = POP_OBJECT();
valuePtr = OBJ_AT_DEPTH(2);
- endIdx = Tcl_GetCharLength(valuePtr) - 1;
+ slength = Tcl_GetCharLength(valuePtr) - 1;
TRACE(("\"%.20s\" %s %s \"%.20s\" => ", O2S(valuePtr),
O2S(OBJ_UNDER_TOS), O2S(OBJ_AT_TOS), O2S(value3Ptr)));
- if (TclGetIntForIndexM(interp, OBJ_UNDER_TOS, endIdx,
+ if (TclGetIntForIndexM(interp, OBJ_UNDER_TOS, slength,
&fromIdx) != TCL_OK
- || TclGetIntForIndexM(interp, OBJ_AT_TOS, endIdx,
+ || TclGetIntForIndexM(interp, OBJ_AT_TOS, slength,
&toIdx) != TCL_OK) {
TclDecrRefCount(value3Ptr);
TRACE_ERROR(interp);
@@ -5372,23 +5163,23 @@ TEBCresume(
TclDecrRefCount(OBJ_AT_TOS);
(void) POP_OBJECT();
- if ((toIdx < 0) ||
- (fromIdx > endIdx) ||
- (toIdx < fromIdx)) {
+ if ((toIdx == TCL_INDEX_NONE) ||
+ (fromIdx + 1 > slength + 1) ||
+ (toIdx + 1 < fromIdx + 1)) {
TRACE_APPEND(("\"%.30s\"\n", O2S(valuePtr)));
TclDecrRefCount(value3Ptr);
NEXT_INST_F(1, 0, 0);
}
- if (fromIdx < 0) {
- fromIdx = 0;
+ if (fromIdx == TCL_INDEX_NONE) {
+ fromIdx = TCL_INDEX_START;
}
- if (toIdx > endIdx) {
- toIdx = endIdx;
+ if (toIdx + 1 > slength + 1) {
+ toIdx = slength;
}
- if (fromIdx == 0 && toIdx == endIdx) {
+ if ((fromIdx == TCL_INDEX_START) && (toIdx == slength)) {
TclDecrRefCount(OBJ_AT_TOS);
OBJ_AT_TOS = value3Ptr;
TRACE_APPEND(("\"%.30s\"\n", O2S(value3Ptr)));
@@ -5420,28 +5211,28 @@ TEBCresume(
objResultPtr = value3Ptr;
goto doneStringMap;
}
- ustring1 = Tcl_GetUnicodeFromObj(valuePtr, &length);
- if (length == 0) {
+ ustring1 = TclGetUnicodeFromObj(valuePtr, &slength);
+ if (slength == 0) {
objResultPtr = valuePtr;
goto doneStringMap;
}
- ustring2 = Tcl_GetUnicodeFromObj(value2Ptr, &length2);
- if (length2 > length || length2 == 0) {
+ ustring2 = TclGetUnicodeFromObj(value2Ptr, &length2);
+ if (length2 > slength || length2 == 0) {
objResultPtr = valuePtr;
goto doneStringMap;
- } else if (length2 == length) {
- if (memcmp(ustring1, ustring2, sizeof(Tcl_UniChar) * length)) {
+ } else if (length2 == slength) {
+ if (memcmp(ustring1, ustring2, sizeof(Tcl_UniChar) * slength)) {
objResultPtr = valuePtr;
} else {
objResultPtr = value3Ptr;
}
goto doneStringMap;
}
- ustring3 = Tcl_GetUnicodeFromObj(value3Ptr, &length3);
+ ustring3 = TclGetUnicodeFromObj(value3Ptr, &length3);
objResultPtr = Tcl_NewUnicodeObj(ustring1, 0);
p = ustring1;
- end = ustring1 + length;
+ end = ustring1 + slength;
for (; ustring1 < end; ustring1++) {
if ((*ustring1 == *ustring2) && (length2==1 ||
memcmp(ustring1, ustring2, sizeof(Tcl_UniChar) * length2)
@@ -5470,19 +5261,19 @@ TEBCresume(
NEXT_INST_V(1, 3, 1);
case INST_STR_FIND:
- match = TclStringFirst(OBJ_UNDER_TOS, OBJ_AT_TOS, 0);
+ slength = TclStringFirst(OBJ_UNDER_TOS, OBJ_AT_TOS, 0);
- TRACE(("%.20s %.20s => %d\n",
- O2S(OBJ_UNDER_TOS), O2S(OBJ_AT_TOS), match));
- TclNewIntObj(objResultPtr, match);
+ TRACE(("%.20s %.20s => %" TCL_LL_MODIFIER "d\n",
+ O2S(OBJ_UNDER_TOS), O2S(OBJ_AT_TOS), TclWideIntFromSize(slength)));
+ objResultPtr = TclNewWideIntObjFromSize(slength);
NEXT_INST_F(1, 2, 1);
case INST_STR_FIND_LAST:
- match = TclStringLast(OBJ_UNDER_TOS, OBJ_AT_TOS, INT_MAX - 1);
+ slength = TclStringLast(OBJ_UNDER_TOS, OBJ_AT_TOS, TCL_INDEX_END);
- TRACE(("%.20s %.20s => %d\n",
- O2S(OBJ_UNDER_TOS), O2S(OBJ_AT_TOS), match));
- TclNewIntObj(objResultPtr, match);
+ TRACE(("%.20s %.20s => %" TCL_LL_MODIFIER "d\n",
+ O2S(OBJ_UNDER_TOS), O2S(OBJ_AT_TOS), TclWideIntFromSize(slength)));
+ objResultPtr = TclNewWideIntObjFromSize(slength);
NEXT_INST_F(1, 2, 1);
case INST_STR_CLASS:
@@ -5490,10 +5281,10 @@ TEBCresume(
valuePtr = OBJ_AT_TOS;
TRACE(("%s \"%.30s\" => ", tclStringClassTable[opnd].name,
O2S(valuePtr)));
- ustring1 = Tcl_GetUnicodeFromObj(valuePtr, &length);
+ ustring1 = TclGetUnicodeFromObj(valuePtr, &slength);
match = 1;
- if (length > 0) {
- end = ustring1 + length;
+ if (slength > 0) {
+ end = ustring1 + slength;
for (p=ustring1 ; p<end ; p++) {
if (!tclStringClassTable[opnd].comparator(*p)) {
match = 0;
@@ -5519,16 +5310,17 @@ TEBCresume(
|| TclHasIntRep(value2Ptr, &tclStringType)) {
Tcl_UniChar *ustring1, *ustring2;
- ustring1 = Tcl_GetUnicodeFromObj(valuePtr, &length);
- ustring2 = Tcl_GetUnicodeFromObj(value2Ptr, &length2);
- match = TclUniCharMatch(ustring1, length, ustring2, length2,
+ ustring1 = TclGetUnicodeFromObj(valuePtr, &slength);
+ ustring2 = TclGetUnicodeFromObj(value2Ptr, &length2);
+ match = TclUniCharMatch(ustring1, slength, ustring2, length2,
nocase);
} else if (TclIsPureByteArray(valuePtr) && !nocase) {
unsigned char *bytes1, *bytes2;
+ size_t wlen1 = 0, wlen2 = 0;
- bytes1 = Tcl_GetByteArrayFromObj(valuePtr, &length);
- bytes2 = Tcl_GetByteArrayFromObj(value2Ptr, &length2);
- match = TclByteArrayMatch(bytes1, length, bytes2, length2, 0);
+ bytes1 = TclGetByteArrayFromObj(valuePtr, &wlen1);
+ bytes2 = TclGetByteArrayFromObj(value2Ptr, &wlen2);
+ match = TclByteArrayMatch(bytes1, wlen1, bytes2, wlen2, 0);
} else {
match = Tcl_StringCaseMatch(TclGetString(valuePtr),
TclGetString(value2Ptr), nocase);
@@ -5549,30 +5341,30 @@ TEBCresume(
{
const char *string1, *string2;
- int trim1, trim2;
+ size_t trim1, trim2;
case INST_STR_TRIM_LEFT:
valuePtr = OBJ_UNDER_TOS; /* String */
value2Ptr = OBJ_AT_TOS; /* TrimSet */
string2 = TclGetStringFromObj(value2Ptr, &length2);
- string1 = TclGetStringFromObj(valuePtr, &length);
- trim1 = TclTrimLeft(string1, length, string2, length2);
+ string1 = TclGetStringFromObj(valuePtr, &slength);
+ trim1 = TclTrimLeft(string1, slength, string2, length2);
trim2 = 0;
goto createTrimmedString;
case INST_STR_TRIM_RIGHT:
valuePtr = OBJ_UNDER_TOS; /* String */
value2Ptr = OBJ_AT_TOS; /* TrimSet */
string2 = TclGetStringFromObj(value2Ptr, &length2);
- string1 = TclGetStringFromObj(valuePtr, &length);
- trim2 = TclTrimRight(string1, length, string2, length2);
+ string1 = TclGetStringFromObj(valuePtr, &slength);
+ trim2 = TclTrimRight(string1, slength, string2, length2);
trim1 = 0;
goto createTrimmedString;
case INST_STR_TRIM:
valuePtr = OBJ_UNDER_TOS; /* String */
value2Ptr = OBJ_AT_TOS; /* TrimSet */
string2 = TclGetStringFromObj(value2Ptr, &length2);
- string1 = TclGetStringFromObj(valuePtr, &length);
- trim1 = TclTrim(string1, length, string2, length2, &trim2);
+ string1 = TclGetStringFromObj(valuePtr, &slength);
+ trim1 = TclTrim(string1, slength, string2, length2, &trim2);
createTrimmedString:
/*
* Careful here; trim set often contains non-ASCII characters so we
@@ -5595,7 +5387,7 @@ TEBCresume(
#endif
NEXT_INST_F(1, 1, 0);
} else {
- objResultPtr = Tcl_NewStringObj(string1+trim1, length-trim1-trim2);
+ objResultPtr = Tcl_NewStringObj(string1+trim1, slength-trim1-trim2);
#ifdef TCL_COMPILE_DEBUG
if (traceInstructions) {
TclPrintObject(stdout, objResultPtr, 30);
@@ -6355,170 +6147,6 @@ TEBCresume(
{
ForeachInfo *infoPtr;
- Var *iterVarPtr, *listVarPtr;
- Tcl_Obj *oldValuePtr, *listPtr, **elements;
- ForeachVarList *varListPtr;
- int numLists, listTmpIndex, listLen, numVars;
- size_t iterNum;
- int varIndex, valIndex, continueLoop, j, iterTmpIndex;
- long i;
-
- case INST_FOREACH_START4: /* DEPRECATED */
- /*
- * Initialize the temporary local var that holds the count of the
- * number of iterations of the loop body to -1.
- */
-
- opnd = TclGetUInt4AtPtr(pc+1);
- infoPtr = codePtr->auxDataArrayPtr[opnd].clientData;
- iterTmpIndex = infoPtr->loopCtTemp;
- iterVarPtr = LOCAL(iterTmpIndex);
- oldValuePtr = iterVarPtr->value.objPtr;
-
- if (oldValuePtr == NULL) {
- TclNewIntObj(iterVarPtr->value.objPtr, -1);
- Tcl_IncrRefCount(iterVarPtr->value.objPtr);
- } else {
- TclSetIntObj(oldValuePtr, -1);
- }
- TRACE(("%u => loop iter count temp %d\n", opnd, iterTmpIndex));
-
-#ifndef TCL_COMPILE_DEBUG
- /*
- * Remark that the compiler ALWAYS sets INST_FOREACH_STEP4 immediately
- * after INST_FOREACH_START4 - let us just fall through instead of
- * jumping back to the top.
- */
-
- pc += 5;
- TCL_DTRACE_INST_NEXT();
-#else
- NEXT_INST_F(5, 0, 0);
-#endif
-
- case INST_FOREACH_STEP4: /* DEPRECATED */
- /*
- * "Step" a foreach loop (i.e., begin its next iteration) by assigning
- * the next value list element to each loop var.
- */
-
- opnd = TclGetUInt4AtPtr(pc+1);
- TRACE(("%u => ", opnd));
- infoPtr = codePtr->auxDataArrayPtr[opnd].clientData;
- numLists = infoPtr->numLists;
-
- /*
- * Increment the temp holding the loop iteration number.
- */
-
- iterVarPtr = LOCAL(infoPtr->loopCtTemp);
- valuePtr = iterVarPtr->value.objPtr;
- iterNum = (size_t)valuePtr->internalRep.wideValue + 1;
- TclSetIntObj(valuePtr, iterNum);
-
- /*
- * Check whether all value lists are exhausted and we should stop the
- * loop.
- */
-
- continueLoop = 0;
- listTmpIndex = infoPtr->firstValueTemp;
- for (i = 0; i < numLists; i++) {
- varListPtr = infoPtr->varLists[i];
- numVars = varListPtr->numVars;
-
- listVarPtr = LOCAL(listTmpIndex);
- listPtr = listVarPtr->value.objPtr;
- if (TclListObjLength(interp, listPtr, &listLen) != TCL_OK) {
- TRACE_APPEND(("ERROR converting list %ld, \"%.30s\": %s\n",
- i, O2S(listPtr), O2S(Tcl_GetObjResult(interp))));
- goto gotError;
- }
- if ((size_t)listLen > iterNum * numVars) {
- continueLoop = 1;
- }
- listTmpIndex++;
- }
-
- /*
- * If some var in some var list still has a remaining list element
- * iterate one more time. Assign to var the next element from its
- * value list. We already checked above that each list temp holds a
- * valid list object (by calling Tcl_ListObjLength), but cannot rely
- * on that check remaining valid: one list could have been shimmered
- * as a side effect of setting a traced variable.
- */
-
- if (continueLoop) {
- listTmpIndex = infoPtr->firstValueTemp;
- for (i = 0; i < numLists; i++) {
- varListPtr = infoPtr->varLists[i];
- numVars = varListPtr->numVars;
-
- listVarPtr = LOCAL(listTmpIndex);
- listPtr = TclListObjCopy(NULL, listVarPtr->value.objPtr);
- TclListObjGetElements(interp, listPtr, &listLen, &elements);
-
- valIndex = (iterNum * numVars);
- for (j = 0; j < numVars; j++) {
- if (valIndex >= listLen) {
- TclNewObj(valuePtr);
- } else {
- valuePtr = elements[valIndex];
- }
-
- varIndex = varListPtr->varIndexes[j];
- varPtr = LOCAL(varIndex);
- while (TclIsVarLink(varPtr)) {
- varPtr = varPtr->value.linkPtr;
- }
- if (TclIsVarDirectWritable(varPtr)) {
- value2Ptr = varPtr->value.objPtr;
- if (valuePtr != value2Ptr) {
- if (value2Ptr != NULL) {
- TclDecrRefCount(value2Ptr);
- }
- varPtr->value.objPtr = valuePtr;
- Tcl_IncrRefCount(valuePtr);
- }
- } else {
- DECACHE_STACK_INFO();
- if (TclPtrSetVarIdx(interp, varPtr, NULL, NULL, NULL,
- valuePtr, TCL_LEAVE_ERR_MSG, varIndex)==NULL){
- CACHE_STACK_INFO();
- TRACE_APPEND((
- "ERROR init. index temp %d: %s\n",
- varIndex, O2S(Tcl_GetObjResult(interp))));
- TclDecrRefCount(listPtr);
- goto gotError;
- }
- CACHE_STACK_INFO();
- }
- valIndex++;
- }
- TclDecrRefCount(listPtr);
- listTmpIndex++;
- }
- }
- TRACE_APPEND(("%d lists, iter %" TCL_Z_MODIFIER "u, %s loop\n",
- numLists, iterNum, (continueLoop? "continue" : "exit")));
-
- /*
- * Run-time peep-hole optimisation: the compiler ALWAYS follows
- * INST_FOREACH_STEP4 with an INST_JUMP_FALSE. We just skip that
- * instruction and jump direct from here.
- */
-
- pc += 5;
- if (*pc == INST_JUMP_FALSE1) {
- NEXT_INST_F((continueLoop? 2 : TclGetInt1AtPtr(pc+1)), 0, 0);
- } else {
- NEXT_INST_F((continueLoop? 5 : TclGetInt4AtPtr(pc+1)), 0, 0);
- }
-
- }
- {
- ForeachInfo *infoPtr;
Tcl_Obj *listPtr, **elements, *tmpPtr;
ForeachVarList *varListPtr;
int numLists, listLen, numVars;
@@ -6799,7 +6427,7 @@ TEBCresume(
NEXT_INST_F(1, 1, 0);
case INST_DICT_EXISTS: {
- register int found;
+ int found;
opnd = TclGetUInt4AtPtr(pc+1);
TRACE(("%u => ", opnd));
@@ -7143,7 +6771,7 @@ TEBCresume(
opnd = TclGetUInt4AtPtr(pc+1);
TRACE(("%u => ", opnd));
dictPtr = POP_OBJECT();
- searchPtr = ckalloc(sizeof(Tcl_DictSearch));
+ searchPtr = Tcl_Alloc(sizeof(Tcl_DictSearch));
if (Tcl_DictObjFirst(interp, dictPtr, searchPtr, &keyPtr,
&valuePtr, &done) != TCL_OK) {
@@ -7154,7 +6782,7 @@ TEBCresume(
*/
Tcl_DecrRefCount(dictPtr);
- ckfree(searchPtr);
+ Tcl_Free(searchPtr);
TRACE_ERROR(interp);
goto gotError;
}
@@ -7239,7 +6867,7 @@ TEBCresume(
TRACE_ERROR(interp);
goto gotError;
}
- if (length != duiPtr->length) {
+ if ((size_t)length != duiPtr->length) {
Tcl_Panic("dictUpdateStart argument length mismatch");
}
for (i=0 ; i<length ; i++) {
@@ -7599,11 +7227,12 @@ TEBCresume(
}
if ((result == TCL_ERROR) && !(iPtr->flags & ERR_ALREADY_LOGGED)) {
const unsigned char *pcBeg;
+ size_t xxx1length;
- bytes = GetSrcInfoForPc(pc, codePtr, &length, &pcBeg, NULL);
+ bytes = GetSrcInfoForPc(pc, codePtr, &xxx1length, &pcBeg, NULL);
DECACHE_STACK_INFO();
TclLogCommandInfo(interp, codePtr->source, bytes,
- bytes ? length : 0, pcBeg, tosPtr);
+ bytes ? xxx1length : 0, pcBeg, tosPtr);
CACHE_STACK_INFO();
}
iPtr->flags &= ~ERR_ALREADY_LOGGED;
@@ -7765,9 +7394,10 @@ TEBCresume(
instStartCmdFailed:
{
const char *bytes;
+ size_t xxx1length;
checkInterp = 1;
- length = 0;
+ xxx1length = 0;
/*
* We used to switch to direct eval; for NRE-awareness we now
@@ -7780,11 +7410,11 @@ TEBCresume(
}
codePtr->flags |= TCL_BYTECODE_RECOMPILE;
- bytes = GetSrcInfoForPc(pc, codePtr, &length, NULL, NULL);
+ bytes = GetSrcInfoForPc(pc, codePtr, &xxx1length, NULL, NULL);
opnd = TclGetUInt4AtPtr(pc+1);
pc += (opnd-1);
assert(bytes);
- PUSH_OBJECT(Tcl_NewStringObj(bytes, length));
+ PUSH_OBJECT(Tcl_NewStringObj(bytes, xxx1length));
goto instEvalStk;
}
}
@@ -8900,16 +8530,15 @@ TclCompareTwoNumbers(
static void
PrintByteCodeInfo(
- register ByteCode *codePtr) /* The bytecode whose summary is printed to
+ ByteCode *codePtr) /* The bytecode whose summary is printed to
* stdout. */
{
Proc *procPtr = codePtr->procPtr;
Interp *iPtr = (Interp *) *codePtr->interpHandle;
- fprintf(stdout, "\nExecuting ByteCode 0x%p, refCt %" TCL_Z_MODIFIER "u, epoch %u, interp 0x%p (epoch %u)\n",
- codePtr, (size_t)codePtr->refCount, codePtr->compileEpoch, iPtr,
+ fprintf(stdout, "\nExecuting ByteCode 0x%p, refCt %" TCL_Z_MODIFIER "u, epoch %" TCL_Z_MODIFIER "u, interp 0x%p (epoch %" TCL_Z_MODIFIER "u)\n",
+ codePtr, codePtr->refCount, codePtr->compileEpoch, iPtr,
iPtr->compileEpoch);
-
fprintf(stdout, " Source: ");
TclPrintSource(stdout, codePtr->source, 60);
@@ -8935,7 +8564,7 @@ PrintByteCodeInfo(
#endif /* TCL_COMPILE_STATS */
if (procPtr != NULL) {
fprintf(stdout,
- " Proc 0x%p, refCt %d, args %d, compiled locals %d\n",
+ " Proc 0x%p, refCt %" TCL_Z_MODIFIER "u, args %d, compiled locals %d\n",
procPtr, procPtr->refCount, procPtr->numArgs,
procPtr->numCompiledLocals);
}
@@ -8964,7 +8593,7 @@ PrintByteCodeInfo(
#ifdef TCL_COMPILE_DEBUG
static void
ValidatePcAndStackTop(
- register ByteCode *codePtr, /* The bytecode whose summary is printed to
+ ByteCode *codePtr, /* The bytecode whose summary is printed to
* stdout. */
const unsigned char *pc, /* Points to first byte of a bytecode
* instruction. The program counter. */
@@ -8987,14 +8616,14 @@ ValidatePcAndStackTop(
pc);
Tcl_Panic("TclNRExecuteByteCode execution failure: bad pc");
}
- if ((unsigned) opCode > LAST_INST_OPCODE) {
+ if ((unsigned) opCode >= LAST_INST_OPCODE) {
fprintf(stderr, "\nBad opcode %d at pc %" TCL_Z_MODIFIER "u in TclNRExecuteByteCode\n",
(unsigned) opCode, relativePc);
Tcl_Panic("TclNRExecuteByteCode execution failure: bad opcode");
}
if (checkStack &&
((stackTop < 0) || (stackTop > stackUpperBound))) {
- int numChars;
+ size_t numChars;
const char *cmd = GetSrcInfoForPc(pc, codePtr, &numChars, NULL, NULL);
fprintf(stderr, "\nBad stack top %d at pc %" TCL_Z_MODIFIER "u in TclNRExecuteByteCode (min 0, max %i)",
@@ -9050,20 +8679,11 @@ IllegalExprOperandType(
if (opcode == INST_EXPON) {
operator = "**";
} else if (opcode <= INST_LNOT) {
- operator = operatorStrings[opcode - INST_LOR];
+ operator = operatorStrings[opcode - INST_BITOR];
}
if (GetNumberFromObj(NULL, opndPtr, &ptr, &type) != TCL_OK) {
- int numBytes;
- const char *bytes = TclGetStringFromObj(opndPtr, &numBytes);
-
- if (numBytes == 0) {
- description = "empty string";
- } else if (TclCheckBadOctal(NULL, bytes)) {
- description = "invalid octal number";
- } else {
- description = "non-numeric string";
- }
+ description = "non-numeric string";
} else if (type == TCL_NUMBER_NAN) {
description = "non-numeric floating-point value";
} else if (type == TCL_NUMBER_DOUBLE) {
@@ -9074,7 +8694,8 @@ IllegalExprOperandType(
}
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't use %s as operand of \"%s\"", description, operator));
+ "can't use %s \"%s\" as operand of \"%s\"", description,
+ TclGetString(opndPtr), operator));
Tcl_SetErrorCode(interp, "ARITH", "DOMAIN", description, NULL);
}
@@ -9151,7 +8772,8 @@ TclGetSrcInfoForPc(
ExtCmdLoc *eclPtr;
ECL *locPtr = NULL;
- int srcOffset, i;
+ size_t srcOffset;
+ int i;
Interp *iPtr = (Interp *) *codePtr->interpHandle;
Tcl_HashEntry *hePtr =
Tcl_FindHashEntry(iPtr->lineBCPtr, codePtr);
@@ -9197,7 +8819,7 @@ GetSrcInfoForPc(
* in codePtr's code. */
ByteCode *codePtr, /* The bytecode sequence in which to look up
* the command source for the pc. */
- int *lengthPtr, /* If non-NULL, the location where the length
+ size_t *lengthPtr, /* If non-NULL, the location where the length
* of the command's source should be stored.
* If NULL, no length is stored. */
const unsigned char **pcBeg,/* If non-NULL, the bytecode location
@@ -9207,18 +8829,18 @@ GetSrcInfoForPc(
* of the command containing the pc should
* be stored. */
{
- register int pcOffset = (pc - codePtr->codeStart);
- int numCmds = codePtr->numCommands;
+ size_t pcOffset = (size_t)(pc - codePtr->codeStart);
+ size_t numCmds = codePtr->numCommands;
unsigned char *codeDeltaNext, *codeLengthNext;
unsigned char *srcDeltaNext, *srcLengthNext;
- int codeOffset, codeLen, codeEnd, srcOffset, srcLen, delta, i;
+ size_t codeOffset, codeLen, codeEnd, srcOffset, srcLen, delta, i;
int bestDist = INT_MAX; /* Distance of pc to best cmd's start pc. */
int bestSrcOffset = -1; /* Initialized to avoid compiler warning. */
int bestSrcLength = -1; /* Initialized to avoid compiler warning. */
int bestCmdIdx = -1;
/* The pc must point within the bytecode */
- assert ((pcOffset >= 0) && (pcOffset < codePtr->numCodeBytes));
+ assert (pcOffset < (size_t)codePtr->numCodeBytes);
/*
* Decode the code and source offset and length for each command. The
@@ -9360,9 +8982,9 @@ GetExceptRangeForPc(
{
ExceptionRange *rangeArrayPtr;
int numRanges = codePtr->numExceptRanges;
- register ExceptionRange *rangePtr;
- int pcOffset = pc - codePtr->codeStart;
- register int start;
+ ExceptionRange *rangePtr;
+ size_t pcOffset = pc - codePtr->codeStart;
+ size_t start;
if (numRanges == 0) {
return NULL;
@@ -9494,11 +9116,11 @@ TclExprFloatError(
int
TclLog2(
- register int value) /* The integer for which to compute the log
+ int value) /* The integer for which to compute the log
* base 2. */
{
- register int n = value;
- register int result = 0;
+ int n = value;
+ int result = 0;
while (n > 1) {
n = n >> 1;
@@ -9540,9 +9162,8 @@ EvalStatsCmd(
double strBytesSharedMultX, strBytesSharedOnce;
double numInstructions, currentHeaderBytes;
size_t numCurrentByteCodes, numByteCodeLits;
- size_t refCountSum, literalMgmtBytes, sum;
+ size_t refCountSum, literalMgmtBytes, sum, decadeHigh, length;
size_t numSharedMultX, numSharedOnce, minSizeDecade, maxSizeDecade, i;
- int decadeHigh, length;
char *litTableStats;
LiteralEntry *entryPtr;
Tcl_Obj *objPtr;
@@ -9584,8 +9205,8 @@ EvalStatsCmd(
Tcl_AppendPrintfToObj(objPtr, "\n----------------------------------------------------------------\n");
Tcl_AppendPrintfToObj(objPtr,
- "Compilation and execution statistics for interpreter %#" TCL_Z_MODIFIER "x\n",
- (size_t)iPtr);
+ "Compilation and execution statistics for interpreter %p\n",
+ iPtr);
Tcl_AppendPrintfToObj(objPtr, "\nNumber ByteCodes executed\t%" TCL_Z_MODIFIER "u\n",
statsPtr->numExecutions);
@@ -9632,11 +9253,11 @@ EvalStatsCmd(
statsPtr->currentByteCodeBytes);
Tcl_AppendPrintfToObj(objPtr, " Literal bytes\t\t%.6g\n",
currentLiteralBytes);
- Tcl_AppendPrintfToObj(objPtr, " table %lu + bkts %lu + entries %lu + objects %lu + strings %.6g\n",
- (unsigned long) sizeof(LiteralTable),
- (unsigned long) (iPtr->literalTable.numBuckets * sizeof(LiteralEntry *)),
- (unsigned long) (iPtr->literalTable.numEntries * sizeof(LiteralEntry)),
- (unsigned long) (iPtr->literalTable.numEntries * sizeof(Tcl_Obj)),
+ Tcl_AppendPrintfToObj(objPtr, " table %" TCL_Z_MODIFIER "u + bkts %" TCL_Z_MODIFIER "u + entries %" TCL_Z_MODIFIER "u + objects %" TCL_Z_MODIFIER "u + strings %.6g\n",
+ sizeof(LiteralTable),
+ iPtr->literalTable.numBuckets * sizeof(LiteralEntry *),
+ iPtr->literalTable.numEntries * sizeof(LiteralEntry),
+ iPtr->literalTable.numEntries * sizeof(Tcl_Obj),
statsPtr->currentLitStringBytes);
Tcl_AppendPrintfToObj(objPtr, " Mean code/source\t\t%.1f\n",
currentCodeBytes / statsPtr->currentSrcBytes);
@@ -9707,7 +9328,7 @@ EvalStatsCmd(
Tcl_AppendPrintfToObj(objPtr, "Total literal objects\t\t%" TCL_Z_MODIFIER "u\n",
statsPtr->numLiteralsCreated);
- Tcl_AppendPrintfToObj(objPtr, "\nCurrent literal objects\t\t%d (%0.1f%% of current objects)\n",
+ Tcl_AppendPrintfToObj(objPtr, "\nCurrent literal objects\t\t%" TCL_Z_MODIFIER "u (%0.1f%% of current objects)\n",
globalTablePtr->numEntries,
Percent(globalTablePtr->numEntries, tclObjsAlloced-tclObjsFreed));
Tcl_AppendPrintfToObj(objPtr, " ByteCode literals\t\t%" TCL_Z_MODIFIER "u (%0.1f%% of current literals)\n",
@@ -9799,14 +9420,14 @@ EvalStatsCmd(
for (i = 0; i <= maxSizeDecade; i++) {
decadeHigh = (1 << (i+1)) - 1;
sum += statsPtr->literalCount[i];
- Tcl_AppendPrintfToObj(objPtr, "\t%10d\t\t%8.0f%%\n",
+ Tcl_AppendPrintfToObj(objPtr, "\t%10" TCL_Z_MODIFIER "u\t\t%8.0f%%\n",
decadeHigh, Percent(sum, statsPtr->numLiteralsCreated));
}
litTableStats = TclLiteralStats(globalTablePtr);
Tcl_AppendPrintfToObj(objPtr, "\nCurrent literal table statistics:\n%s\n",
litTableStats);
- ckfree(litTableStats);
+ Tcl_Free(litTableStats);
/*
* Source and ByteCode size distributions.
@@ -9831,7 +9452,7 @@ EvalStatsCmd(
for (i = minSizeDecade; i <= maxSizeDecade; i++) {
decadeHigh = (1 << (i+1)) - 1;
sum += statsPtr->srcCount[i];
- Tcl_AppendPrintfToObj(objPtr, "\t%10d\t\t%8.0f%%\n",
+ Tcl_AppendPrintfToObj(objPtr, "\t%10" TCL_Z_MODIFIER "u\t\t%8.0f%%\n",
decadeHigh, Percent(sum, statsPtr->numCompilations));
}
@@ -9854,7 +9475,7 @@ EvalStatsCmd(
for (i = minSizeDecade; i <= maxSizeDecade; i++) {
decadeHigh = (1 << (i+1)) - 1;
sum += statsPtr->byteCodeCount[i];
- Tcl_AppendPrintfToObj(objPtr, "\t%10d\t\t%8.0f%%\n",
+ Tcl_AppendPrintfToObj(objPtr, "\t%10" TCL_Z_MODIFIER "u\t\t%8.0f%%\n",
decadeHigh, Percent(sum, statsPtr->numCompilations));
}
@@ -9886,7 +9507,7 @@ EvalStatsCmd(
*/
Tcl_AppendPrintfToObj(objPtr, "\nInstruction counts:\n");
- for (i = 0; i <= LAST_INST_OPCODE; i++) {
+ for (i = 0; i < LAST_INST_OPCODE; i++) {
Tcl_AppendPrintfToObj(objPtr, "%20s %8" TCL_Z_MODIFIER "u ",
tclInstructionTable[i].name, statsPtr->instructionCount[i]);
if (statsPtr->instructionCount[i]) {
@@ -9899,7 +9520,7 @@ EvalStatsCmd(
#ifdef TCL_MEM_DEBUG
Tcl_AppendPrintfToObj(objPtr, "\nHeap Statistics:\n");
- TclDumpMemoryInfo((ClientData) objPtr, 1);
+ TclDumpMemoryInfo(objPtr, 1);
#endif
Tcl_AppendPrintfToObj(objPtr, "\n----------------------------------------------------------------\n");
diff --git a/generic/tclFCmd.c b/generic/tclFCmd.c
index 8ef0456..264711d 100644
--- a/generic/tclFCmd.c
+++ b/generic/tclFCmd.c
@@ -1389,7 +1389,7 @@ TclFileTemporaryCmd(
TclNewObj(nameObj);
}
if (objc > 2) {
- int length;
+ size_t length;
Tcl_Obj *templateObj = objv[2];
const char *string = TclGetStringFromObj(templateObj, &length);
diff --git a/generic/tclFileName.c b/generic/tclFileName.c
index 98ee37c..d35c5b5 100644
--- a/generic/tclFileName.c
+++ b/generic/tclFileName.c
@@ -386,8 +386,7 @@ TclpGetNativePathType(
Tcl_Obj **driveNameRef)
{
Tcl_PathType type = TCL_PATH_ABSOLUTE;
- int pathLen;
- const char *path = TclGetStringFromObj(pathPtr, &pathLen);
+ const char *path = TclGetString(pathPtr);
if (path[0] == '~') {
/*
@@ -504,11 +503,11 @@ TclpNativeSplitPath(
switch (tclPlatform) {
case TCL_PLATFORM_UNIX:
- resultPtr = SplitUnixPath(Tcl_GetString(pathPtr));
+ resultPtr = SplitUnixPath(TclGetString(pathPtr));
break;
case TCL_PLATFORM_WINDOWS:
- resultPtr = SplitWinPath(Tcl_GetString(pathPtr));
+ resultPtr = SplitWinPath(TclGetString(pathPtr));
break;
}
@@ -537,7 +536,7 @@ TclpNativeSplitPath(
* *argcPtr will get filled in with the number of valid elements in the
* array. A single block of memory is dynamically allocated to hold both
* the argv array and a copy of the path elements. The caller must
- * eventually free this memory by calling ckfree() on *argvPtr. Note:
+ * eventually free this memory by calling Tcl_Free() on *argvPtr. Note:
* *argvPtr and *argcPtr are only modified if the procedure returns
* normally.
*
@@ -557,7 +556,8 @@ Tcl_SplitPath(
{
Tcl_Obj *resultPtr = NULL; /* Needed only to prevent gcc warnings. */
Tcl_Obj *tmpPtr, *eltPtr;
- int i, size, len;
+ int i;
+ size_t size, len;
char *p;
const char *str;
@@ -578,7 +578,7 @@ Tcl_SplitPath(
size = 1;
for (i = 0; i < *argcPtr; i++) {
Tcl_ListObjIndex(NULL, resultPtr, i, &eltPtr);
- TclGetStringFromObj(eltPtr, &len);
+ (void)TclGetStringFromObj(eltPtr, &len);
size += len + 1;
}
@@ -587,7 +587,7 @@ Tcl_SplitPath(
* plus the argv pointers and the terminating NULL pointer.
*/
- *argvPtr = ckalloc((((*argcPtr) + 1) * sizeof(char *)) + size);
+ *argvPtr = Tcl_Alloc((((*argcPtr) + 1) * sizeof(char *)) + size);
/*
* Position p after the last argv pointer and copy the contents of the
@@ -642,7 +642,7 @@ static Tcl_Obj *
SplitUnixPath(
const char *path) /* Pointer to string containing a path. */
{
- int length;
+ size_t length;
const char *origPath = path, *elementStart;
Tcl_Obj *result = Tcl_NewObj();
@@ -731,7 +731,7 @@ static Tcl_Obj *
SplitWinPath(
const char *path) /* Pointer to string containing a path. */
{
- int length;
+ size_t length;
const char *p, *elementStart;
Tcl_PathType type = TCL_PATH_ABSOLUTE;
Tcl_DString buf;
@@ -821,12 +821,12 @@ Tcl_FSJoinToPath(
return TclJoinPath(2, pair, 0);
} else {
int elemc = objc + 1;
- Tcl_Obj *ret, **elemv = ckalloc(elemc*sizeof(Tcl_Obj *));
+ Tcl_Obj *ret, **elemv = Tcl_Alloc(elemc*sizeof(Tcl_Obj *));
elemv[0] = pathPtr;
memcpy(elemv+1, objv, objc*sizeof(Tcl_Obj *));
ret = TclJoinPath(elemc, elemv, 0);
- ckfree(elemv);
+ Tcl_Free(elemv);
return ret;
}
}
@@ -852,7 +852,8 @@ TclpNativeJoinPath(
Tcl_Obj *prefix,
const char *joining)
{
- int length, needsSep;
+ int needsSep;
+ size_t length;
char *dest;
const char *p;
const char *start;
@@ -885,7 +886,7 @@ TclpNativeJoinPath(
if (length > 0 && (start[length-1] != '/')) {
Tcl_AppendToObj(prefix, "/", 1);
- TclGetStringFromObj(prefix, &length);
+ (void)TclGetStringFromObj(prefix, &length);
}
needsSep = 0;
@@ -895,7 +896,7 @@ TclpNativeJoinPath(
Tcl_SetObjLength(prefix, length + (int) strlen(p));
- dest = Tcl_GetString(prefix) + length;
+ dest = TclGetString(prefix) + length;
for (; *p != '\0'; p++) {
if (*p == '/') {
while (p[1] == '/') {
@@ -909,7 +910,7 @@ TclpNativeJoinPath(
needsSep = 1;
}
}
- length = dest - Tcl_GetString(prefix);
+ length = dest - TclGetString(prefix);
Tcl_SetObjLength(prefix, length);
break;
@@ -921,7 +922,7 @@ TclpNativeJoinPath(
if ((length > 0) &&
(start[length-1] != '/') && (start[length-1] != ':')) {
Tcl_AppendToObj(prefix, "/", 1);
- TclGetStringFromObj(prefix, &length);
+ (void)TclGetStringFromObj(prefix, &length);
}
needsSep = 0;
@@ -930,7 +931,7 @@ TclpNativeJoinPath(
*/
Tcl_SetObjLength(prefix, length + (int) strlen(p));
- dest = Tcl_GetString(prefix) + length;
+ dest = TclGetString(prefix) + length;
for (; *p != '\0'; p++) {
if ((*p == '/') || (*p == '\\')) {
while ((p[1] == '/') || (p[1] == '\\')) {
@@ -944,7 +945,7 @@ TclpNativeJoinPath(
needsSep = 1;
}
}
- length = dest - Tcl_GetString(prefix);
+ length = dest - TclGetString(prefix);
Tcl_SetObjLength(prefix, length);
break;
}
@@ -976,7 +977,8 @@ Tcl_JoinPath(
const char *const *argv,
Tcl_DString *resultPtr) /* Pointer to previously initialized DString */
{
- int i, len;
+ int i;
+ size_t len;
Tcl_Obj *listObj = Tcl_NewObj();
Tcl_Obj *resultObj;
const char *resultStr;
@@ -1249,7 +1251,7 @@ Tcl_GlobObjCmd(
for (i = 1; i < objc; i++) {
if (Tcl_GetIndexFromObj(interp, objv[i], options, "option", 0,
&index) != TCL_OK) {
- string = TclGetStringFromObj(objv[i], &length);
+ string = TclGetString(objv[i]);
if (string[0] == '-') {
/*
* It looks like the command contains an option so signal an
@@ -1355,7 +1357,7 @@ Tcl_GlobObjCmd(
}
if (dir == PATH_GENERAL) {
- int pathlength;
+ size_t pathlength;
const char *last;
const char *first = TclGetStringFromObj(pathOrDir,&pathlength);
@@ -1407,7 +1409,7 @@ Tcl_GlobObjCmd(
* there are none presently in the prefix.
*/
- if (strpbrk(Tcl_GetString(pathOrDir), "\\/") == NULL) {
+ if (strpbrk(TclGetString(pathOrDir), "\\/") == NULL) {
Tcl_AppendToObj(pathOrDir, last-1, 1);
}
}
@@ -1456,7 +1458,7 @@ Tcl_GlobObjCmd(
globTypes->macCreator = NULL;
while (--length >= 0) {
- int len;
+ size_t len;
const char *str;
Tcl_ListObjIndex(interp, typePtr, length, &look);
@@ -1514,13 +1516,14 @@ Tcl_GlobObjCmd(
} else {
Tcl_Obj *item;
+ int llen;
- if ((Tcl_ListObjLength(NULL, look, &len) == TCL_OK)
- && (len == 3)) {
+ if ((Tcl_ListObjLength(NULL, look, &llen) == TCL_OK)
+ && (llen == 3)) {
Tcl_ListObjIndex(interp, look, 0, &item);
- if (!strcmp("macintosh", Tcl_GetString(item))) {
+ if (!strcmp("macintosh", TclGetString(item))) {
Tcl_ListObjIndex(interp, look, 1, &item);
- if (!strcmp("type", Tcl_GetString(item))) {
+ if (!strcmp("type", TclGetString(item))) {
Tcl_ListObjIndex(interp, look, 2, &item);
if (globTypes->macType != NULL) {
goto badMacTypesArg;
@@ -1528,7 +1531,7 @@ Tcl_GlobObjCmd(
globTypes->macType = item;
Tcl_IncrRefCount(item);
continue;
- } else if (!strcmp("creator", Tcl_GetString(item))) {
+ } else if (!strcmp("creator", TclGetString(item))) {
Tcl_ListObjIndex(interp, look, 2, &item);
if (globTypes->macCreator != NULL) {
goto badMacTypesArg;
@@ -1548,7 +1551,7 @@ Tcl_GlobObjCmd(
badTypesArg:
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"bad argument to \"-types\": %s",
- Tcl_GetString(look)));
+ TclGetString(look)));
Tcl_SetErrorCode(interp, "TCL", "ARGUMENT", "BAD", NULL);
result = TCL_ERROR;
join = 0;
@@ -1612,7 +1615,7 @@ Tcl_GlobObjCmd(
Tcl_DStringFree(&str);
} else {
for (i = 0; i < objc; i++) {
- string = Tcl_GetString(objv[i]);
+ string = TclGetString(objv[i]);
if (TclGlob(interp, string, pathOrDir, globFlags,
globTypes) != TCL_OK) {
result = TCL_ERROR;
@@ -1644,7 +1647,7 @@ Tcl_GlobObjCmd(
for (i = 0; i < objc; i++) {
Tcl_AppendPrintfToObj(errorMsg, "%s%s",
- sep, Tcl_GetString(objv[i]));
+ sep, TclGetString(objv[i]));
sep = " ";
}
}
@@ -1847,7 +1850,7 @@ TclGlob(
Tcl_DecrRefCount(temp);
return TCL_ERROR;
}
- pathPrefix = Tcl_NewStringObj(Tcl_GetString(cwd), 3);
+ pathPrefix = Tcl_NewStringObj(TclGetString(cwd), 3);
Tcl_DecrRefCount(cwd);
if (tail[0] == '/') {
tail++;
@@ -1981,7 +1984,7 @@ TclGlob(
if (globFlags & TCL_GLOBMODE_TAILS) {
int objc, i;
Tcl_Obj **objv;
- int prefixLen;
+ size_t prefixLen;
const char *pre;
/*
@@ -2009,7 +2012,7 @@ TclGlob(
Tcl_ListObjGetElements(NULL, filenamesObj, &objc, &objv);
for (i = 0; i< objc; i++) {
- int len;
+ size_t len;
const char *oldStr = TclGetStringFromObj(objv[i], &len);
Tcl_Obj *elem;
@@ -2341,7 +2344,7 @@ DoGlob(
for (i=0; result==TCL_OK && i<subdirc; i++) {
Tcl_Obj *copy = NULL;
- if (pathPtr == NULL && Tcl_GetString(subdirv[i])[0] == '~') {
+ if (pathPtr == NULL && TclGetString(subdirv[i])[0] == '~') {
Tcl_ListObjLength(NULL, matchesObj, &repair);
copy = subdirv[i];
subdirv[i] = Tcl_NewStringObj("./", 2);
@@ -2358,7 +2361,7 @@ DoGlob(
Tcl_ListObjLength(NULL, matchesObj, &end);
while (repair < end) {
const char *bytes;
- int numBytes;
+ size_t numBytes;
Tcl_Obj *fixme, *newObj;
Tcl_ListObjIndex(NULL, matchesObj, repair, &fixme);
@@ -2381,7 +2384,7 @@ DoGlob(
*/
if (*p == '\0') {
- int length;
+ size_t length;
Tcl_DString append;
/*
@@ -2445,7 +2448,7 @@ DoGlob(
* The current prefix must end in a separator.
*/
- int len;
+ size_t len;
const char *joined = TclGetStringFromObj(joinedPtr,&len);
if (strchr(separators, joined[len-1]) == NULL) {
@@ -2482,7 +2485,7 @@ DoGlob(
* This behaviour is not currently tested for in the test suite.
*/
- int len;
+ size_t len;
const char *joined = TclGetStringFromObj(joinedPtr,&len);
if (strchr(separators, joined[len-1]) == NULL) {
@@ -2512,7 +2515,7 @@ DoGlob(
*
* Results:
* A pointer to a Tcl_StatBuf which may be deallocated by being passed to
- * ckfree().
+ * Tcl_Free().
*
* Side effects:
* None.
@@ -2523,7 +2526,7 @@ DoGlob(
Tcl_StatBuf *
Tcl_AllocStatBuf(void)
{
- return ckalloc(sizeof(Tcl_StatBuf));
+ return Tcl_Alloc(sizeof(Tcl_StatBuf));
}
/*
diff --git a/generic/tclFileSystem.h b/generic/tclFileSystem.h
index 1eec7ff..684407c 100644
--- a/generic/tclFileSystem.h
+++ b/generic/tclFileSystem.h
@@ -30,7 +30,7 @@ MODULE_SCOPE Tcl_Obj * TclFSMakePathRelative(Tcl_Interp *interp,
MODULE_SCOPE int TclFSEnsureEpochOk(Tcl_Obj *pathPtr,
const Tcl_Filesystem **fsPtrPtr);
MODULE_SCOPE void TclFSSetPathDetails(Tcl_Obj *pathPtr,
- const Tcl_Filesystem *fsPtr, ClientData clientData);
+ const Tcl_Filesystem *fsPtr, void *clientData);
MODULE_SCOPE Tcl_Obj * TclFSNormalizeAbsolutePath(Tcl_Interp *interp,
Tcl_Obj *pathPtr);
MODULE_SCOPE size_t TclFSEpoch(void);
diff --git a/generic/tclGet.c b/generic/tclGet.c
index 12e0e79..4811c42 100644
--- a/generic/tclGet.c
+++ b/generic/tclGet.c
@@ -142,7 +142,7 @@ Tcl_GetBoolean(
Tcl_Panic("invalid sharing of Tcl_Obj on C stack");
}
if (code == TCL_OK) {
- TclGetBooleanFromObj(NULL, &obj, boolPtr);
+ *boolPtr = obj.internalRep.wideValue != 0;
}
return code;
}
diff --git a/generic/tclGetDate.y b/generic/tclGetDate.y
index 59f85bd..017f3c0 100644
--- a/generic/tclGetDate.y
+++ b/generic/tclGetDate.y
@@ -89,8 +89,8 @@ typedef struct DateInfo {
int dateDigitCount;
} DateInfo;
-#define YYMALLOC ckalloc
-#define YYFREE(x) (ckfree((void*) (x)))
+#define YYMALLOC Tcl_Alloc
+#define YYFREE(x) (Tcl_Free((void*) (x)))
#define yyDSTmode (info->dateDSTmode)
#define yyDayOrdinal (info->dateDayOrdinal)
@@ -1064,16 +1064,16 @@ TclClockOldscanObjCmd(
resultElement = Tcl_NewObj();
if (yyHaveDate) {
Tcl_ListObjAppendElement(interp, resultElement,
- Tcl_NewIntObj((int) yyYear));
+ Tcl_NewIntObj(yyYear));
Tcl_ListObjAppendElement(interp, resultElement,
- Tcl_NewIntObj((int) yyMonth));
+ Tcl_NewIntObj(yyMonth));
Tcl_ListObjAppendElement(interp, resultElement,
- Tcl_NewIntObj((int) yyDay));
+ Tcl_NewIntObj(yyDay));
}
Tcl_ListObjAppendElement(interp, result, resultElement);
if (yyHaveTime) {
- Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj((int)
+ Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj(
ToSeconds(yyHour, yyMinutes, yySeconds, yyMeridian)));
} else {
Tcl_ListObjAppendElement(interp, result, Tcl_NewObj());
@@ -1082,7 +1082,7 @@ TclClockOldscanObjCmd(
resultElement = Tcl_NewObj();
if (yyHaveZone) {
Tcl_ListObjAppendElement(interp, resultElement,
- Tcl_NewIntObj((int) -yyTimezone));
+ Tcl_NewIntObj(-yyTimezone));
Tcl_ListObjAppendElement(interp, resultElement,
Tcl_NewIntObj(1 - yyDSTmode));
}
@@ -1091,29 +1091,29 @@ TclClockOldscanObjCmd(
resultElement = Tcl_NewObj();
if (yyHaveRel) {
Tcl_ListObjAppendElement(interp, resultElement,
- Tcl_NewIntObj((int) yyRelMonth));
+ Tcl_NewIntObj(yyRelMonth));
Tcl_ListObjAppendElement(interp, resultElement,
- Tcl_NewIntObj((int) yyRelDay));
+ Tcl_NewIntObj(yyRelDay));
Tcl_ListObjAppendElement(interp, resultElement,
- Tcl_NewIntObj((int) yyRelSeconds));
+ Tcl_NewIntObj(yyRelSeconds));
}
Tcl_ListObjAppendElement(interp, result, resultElement);
resultElement = Tcl_NewObj();
if (yyHaveDay && !yyHaveDate) {
Tcl_ListObjAppendElement(interp, resultElement,
- Tcl_NewIntObj((int) yyDayOrdinal));
+ Tcl_NewIntObj(yyDayOrdinal));
Tcl_ListObjAppendElement(interp, resultElement,
- Tcl_NewIntObj((int) yyDayNumber));
+ Tcl_NewIntObj(yyDayNumber));
}
Tcl_ListObjAppendElement(interp, result, resultElement);
resultElement = Tcl_NewObj();
if (yyHaveOrdinalMonth) {
Tcl_ListObjAppendElement(interp, resultElement,
- Tcl_NewIntObj((int) yyMonthOrdinal));
+ Tcl_NewIntObj(yyMonthOrdinal));
Tcl_ListObjAppendElement(interp, resultElement,
- Tcl_NewIntObj((int) yyMonth));
+ Tcl_NewIntObj(yyMonth));
}
Tcl_ListObjAppendElement(interp, result, resultElement);
diff --git a/generic/tclHash.c b/generic/tclHash.c
index 8bbb0c7..3dcacbf 100644
--- a/generic/tclHash.c
+++ b/generic/tclHash.c
@@ -14,13 +14,6 @@
#include "tclInt.h"
/*
- * Prevent macros from clashing with function definitions.
- */
-
-#undef Tcl_FindHashEntry
-#undef Tcl_CreateHashEntry
-
-/*
* When there are this many entries per bucket, on average, rebuild the hash
* table to make it larger.
*/
@@ -35,7 +28,7 @@
*/
#define RANDOM_INDEX(tablePtr, i) \
- ((((i)*1103515245L) >> (tablePtr)->downShift) & (tablePtr)->mask)
+ ((((i)*(size_t)1103515245) >> (tablePtr)->downShift) & (tablePtr)->mask)
/*
* Prototypes for the array hash key methods.
@@ -200,7 +193,7 @@ Tcl_InitCustomHashTable(
/*
*----------------------------------------------------------------------
*
- * Tcl_FindHashEntry --
+ * FindHashEntry --
*
* Given a hash table find the entry with a matching key.
*
@@ -214,14 +207,6 @@ Tcl_InitCustomHashTable(
*----------------------------------------------------------------------
*/
-Tcl_HashEntry *
-Tcl_FindHashEntry(
- Tcl_HashTable *tablePtr, /* Table in which to lookup entry. */
- const void *key) /* Key to use to find matching entry. */
-{
- return (*((tablePtr)->findProc))(tablePtr, key);
-}
-
static Tcl_HashEntry *
FindHashEntry(
Tcl_HashTable *tablePtr, /* Table in which to lookup entry. */
@@ -234,7 +219,7 @@ FindHashEntry(
/*
*----------------------------------------------------------------------
*
- * Tcl_CreateHashEntry --
+ * CreateHashEntry --
*
* Given a hash table with string keys, and a string key, find the entry
* with a matching key. If there is no matching entry, then create a new
@@ -252,17 +237,6 @@ FindHashEntry(
*----------------------------------------------------------------------
*/
-Tcl_HashEntry *
-Tcl_CreateHashEntry(
- Tcl_HashTable *tablePtr, /* Table in which to lookup entry. */
- const void *key, /* Key to use to find or create matching
- * entry. */
- int *newPtr) /* Store info here telling whether a new entry
- * was created. */
-{
- return (*((tablePtr)->createProc))(tablePtr, key, newPtr);
-}
-
static Tcl_HashEntry *
CreateHashEntry(
Tcl_HashTable *tablePtr, /* Table in which to lookup entry. */
@@ -273,8 +247,7 @@ CreateHashEntry(
{
register Tcl_HashEntry *hPtr;
const Tcl_HashKeyType *typePtr;
- unsigned int hash;
- int index;
+ size_t hash, index;
if (tablePtr->keyType == TCL_STRING_KEYS) {
typePtr = &tclStringHashKeyType;
@@ -295,7 +268,7 @@ CreateHashEntry(
index = hash & tablePtr->mask;
}
} else {
- hash = PTR2UINT(key);
+ hash = (size_t) key;
index = RANDOM_INDEX(tablePtr, hash);
}
@@ -308,7 +281,7 @@ CreateHashEntry(
for (hPtr = tablePtr->buckets[index]; hPtr != NULL;
hPtr = hPtr->nextPtr) {
- if (hash != PTR2UINT(hPtr->hash)) {
+ if (hash != hPtr->hash) {
continue;
}
/* if keys pointers or values are equal */
@@ -324,7 +297,7 @@ CreateHashEntry(
} else {
for (hPtr = tablePtr->buckets[index]; hPtr != NULL;
hPtr = hPtr->nextPtr) {
- if (hash != PTR2UINT(hPtr->hash)) {
+ if (hash != hPtr->hash) {
continue;
}
if (key == hPtr->key.oneWordValue) {
@@ -348,13 +321,13 @@ CreateHashEntry(
if (typePtr->allocEntryProc) {
hPtr = typePtr->allocEntryProc(tablePtr, (void *) key);
} else {
- hPtr = ckalloc(sizeof(Tcl_HashEntry));
+ hPtr = Tcl_Alloc(sizeof(Tcl_HashEntry));
hPtr->key.oneWordValue = (char *) key;
- hPtr->clientData = 0;
+ Tcl_SetHashValue(hPtr, NULL);
}
hPtr->tablePtr = tablePtr;
- hPtr->hash = UINT2PTR(hash);
+ hPtr->hash = hash;
hPtr->nextPtr = tablePtr->buckets[index];
tablePtr->buckets[index] = hPtr;
tablePtr->numEntries++;
@@ -396,7 +369,7 @@ Tcl_DeleteHashEntry(
const Tcl_HashKeyType *typePtr;
Tcl_HashTable *tablePtr;
Tcl_HashEntry **bucketPtr;
- int index;
+ size_t index;
tablePtr = entryPtr->tablePtr;
@@ -413,9 +386,9 @@ Tcl_DeleteHashEntry(
if (typePtr->hashKeyProc == NULL
|| typePtr->flags & TCL_HASH_KEY_RANDOMIZE_HASH) {
- index = RANDOM_INDEX(tablePtr, PTR2INT(entryPtr->hash));
+ index = RANDOM_INDEX(tablePtr, entryPtr->hash);
} else {
- index = PTR2UINT(entryPtr->hash) & tablePtr->mask;
+ index = entryPtr->hash & tablePtr->mask;
}
bucketPtr = &tablePtr->buckets[index];
@@ -438,7 +411,7 @@ Tcl_DeleteHashEntry(
if (typePtr->freeEntryProc) {
typePtr->freeEntryProc(entryPtr);
} else {
- ckfree(entryPtr);
+ Tcl_Free(entryPtr);
}
}
@@ -465,7 +438,7 @@ Tcl_DeleteHashTable(
{
register Tcl_HashEntry *hPtr, *nextPtr;
const Tcl_HashKeyType *typePtr;
- int i;
+ size_t i;
if (tablePtr->keyType == TCL_STRING_KEYS) {
typePtr = &tclStringHashKeyType;
@@ -489,7 +462,7 @@ Tcl_DeleteHashTable(
if (typePtr->freeEntryProc) {
typePtr->freeEntryProc(hPtr);
} else {
- ckfree(hPtr);
+ Tcl_Free(hPtr);
}
hPtr = nextPtr;
}
@@ -503,7 +476,7 @@ Tcl_DeleteHashTable(
if (typePtr->flags & TCL_HASH_KEY_SYSTEM_HASH) {
TclpSysFree((char *) tablePtr->buckets);
} else {
- ckfree(tablePtr->buckets);
+ Tcl_Free(tablePtr->buckets);
}
}
@@ -614,7 +587,7 @@ Tcl_HashStats(
Tcl_HashTable *tablePtr) /* Table for which to produce stats. */
{
#define NUM_COUNTERS 10
- int count[NUM_COUNTERS], overflow, i, j;
+ size_t count[NUM_COUNTERS], overflow, i, j;
double average, tmp;
register Tcl_HashEntry *hPtr;
char *result, *p;
@@ -648,16 +621,16 @@ Tcl_HashStats(
* Print out the histogram and a few other pieces of information.
*/
- result = ckalloc((NUM_COUNTERS * 60) + 300);
- sprintf(result, "%d entries in table, %d buckets\n",
+ result = Tcl_Alloc((NUM_COUNTERS * 60) + 300);
+ sprintf(result, "%" TCL_Z_MODIFIER "u entries in table, %" TCL_Z_MODIFIER "u buckets\n",
tablePtr->numEntries, tablePtr->numBuckets);
p = result + strlen(result);
for (i = 0; i < NUM_COUNTERS; i++) {
- sprintf(p, "number of buckets with %d entries: %d\n",
+ sprintf(p, "number of buckets with %" TCL_Z_MODIFIER "u entries: %" TCL_Z_MODIFIER "u\n",
i, count[i]);
p += strlen(p);
}
- sprintf(p, "number of buckets with %d or more entries: %d\n",
+ sprintf(p, "number of buckets with %d or more entries: %" TCL_Z_MODIFIER "u\n",
NUM_COUNTERS, overflow);
p += strlen(p);
sprintf(p, "average search distance for entry: %.1f", average);
@@ -683,13 +656,13 @@ Tcl_HashStats(
static Tcl_HashEntry *
AllocArrayEntry(
Tcl_HashTable *tablePtr, /* Hash table. */
- void *keyPtr) /* Key to store in the hash table entry. */
+ void *keyPtr) /* Key to store in the hash table entry. */
{
int *array = (int *) keyPtr;
register int *iPtr1, *iPtr2;
Tcl_HashEntry *hPtr;
int count;
- unsigned int size;
+ size_t size;
count = tablePtr->keyType;
@@ -697,13 +670,13 @@ AllocArrayEntry(
if (size < sizeof(Tcl_HashEntry)) {
size = sizeof(Tcl_HashEntry);
}
- hPtr = ckalloc(size);
+ hPtr = Tcl_Alloc(size);
for (iPtr1 = array, iPtr2 = hPtr->key.words;
count > 0; count--, iPtr1++, iPtr2++) {
*iPtr2 = *iPtr1;
}
- hPtr->clientData = 0;
+ Tcl_SetHashValue(hPtr, NULL);
return hPtr;
}
@@ -727,11 +700,11 @@ AllocArrayEntry(
static int
CompareArrayKeys(
- void *keyPtr, /* New key to compare. */
+ void *keyPtr, /* New key to compare. */
Tcl_HashEntry *hPtr) /* Existing key to compare. */
{
- register const int *iPtr1 = (const int *) keyPtr;
- register const int *iPtr2 = (const int *) hPtr->key.words;
+ const int *iPtr1 = keyPtr;
+ const int *iPtr2 = hPtr->key.words;
Tcl_HashTable *tablePtr = hPtr->tablePtr;
int count;
@@ -767,17 +740,17 @@ CompareArrayKeys(
static TCL_HASH_TYPE
HashArrayKey(
Tcl_HashTable *tablePtr, /* Hash table. */
- void *keyPtr) /* Key from which to compute hash value. */
+ void *keyPtr) /* Key from which to compute hash value. */
{
register const int *array = (const int *) keyPtr;
- register unsigned int result;
+ register TCL_HASH_TYPE result;
int count;
for (result = 0, count = tablePtr->keyType; count > 0;
count--, array++) {
result += *array;
}
- return (TCL_HASH_TYPE) result;
+ return result;
}
/*
@@ -799,20 +772,20 @@ HashArrayKey(
static Tcl_HashEntry *
AllocStringEntry(
Tcl_HashTable *tablePtr, /* Hash table. */
- void *keyPtr) /* Key to store in the hash table entry. */
+ void *keyPtr) /* Key to store in the hash table entry. */
{
const char *string = (const char *) keyPtr;
Tcl_HashEntry *hPtr;
- unsigned int size, allocsize;
+ size_t size, allocsize;
allocsize = size = strlen(string) + 1;
if (size < sizeof(hPtr->key)) {
allocsize = sizeof(hPtr->key);
}
- hPtr = ckalloc(offsetof(Tcl_HashEntry, key) + allocsize);
+ hPtr = Tcl_Alloc(offsetof(Tcl_HashEntry, key) + allocsize);
memset(hPtr, 0, sizeof(Tcl_HashEntry) + allocsize - sizeof(hPtr->key));
memcpy(hPtr->key.string, string, size);
- hPtr->clientData = 0;
+ Tcl_SetHashValue(hPtr, NULL);
return hPtr;
}
@@ -835,13 +808,10 @@ AllocStringEntry(
static int
CompareStringKeys(
- void *keyPtr, /* New key to compare. */
+ void *keyPtr, /* New key to compare. */
Tcl_HashEntry *hPtr) /* Existing key to compare. */
{
- register const char *p1 = (const char *) keyPtr;
- register const char *p2 = (const char *) hPtr->key.string;
-
- return !strcmp(p1, p2);
+ return !strcmp(keyPtr, hPtr->key.string);
}
/*
@@ -864,10 +834,10 @@ CompareStringKeys(
static TCL_HASH_TYPE
HashStringKey(
Tcl_HashTable *tablePtr, /* Hash table. */
- void *keyPtr) /* Key from which to compute hash value. */
+ void *keyPtr) /* Key from which to compute hash value. */
{
register const char *string = keyPtr;
- register unsigned int result;
+ register TCL_HASH_TYPE result;
register char c;
/*
@@ -907,7 +877,7 @@ HashStringKey(
result += (result << 3) + UCHAR(c);
}
}
- return (TCL_HASH_TYPE) result;
+ return result;
}
/*
@@ -989,14 +959,14 @@ static void
RebuildTable(
register Tcl_HashTable *tablePtr) /* Table to enlarge. */
{
- int count, index, oldSize = tablePtr->numBuckets;
+ size_t count, index, oldSize = tablePtr->numBuckets;
Tcl_HashEntry **oldBuckets = tablePtr->buckets;
register Tcl_HashEntry **oldChainPtr, **newChainPtr;
register Tcl_HashEntry *hPtr;
const Tcl_HashKeyType *typePtr;
/* Avoid outgrowing capability of the memory allocators */
- if (oldSize > (int)(UINT_MAX / (4 * sizeof(Tcl_HashEntry *)))) {
+ if (oldSize > UINT_MAX / (4 * sizeof(Tcl_HashEntry *))) {
tablePtr->rebuildSize = INT_MAX;
return;
}
@@ -1019,18 +989,20 @@ RebuildTable(
tablePtr->numBuckets *= 4;
if (typePtr->flags & TCL_HASH_KEY_SYSTEM_HASH) {
- tablePtr->buckets = (Tcl_HashEntry **) TclpSysAlloc(
- tablePtr->numBuckets * sizeof(Tcl_HashEntry *), 0);
+ tablePtr->buckets = TclpSysAlloc(
+ tablePtr->numBuckets * sizeof(Tcl_HashEntry *));
} else {
tablePtr->buckets =
- ckalloc(tablePtr->numBuckets * sizeof(Tcl_HashEntry *));
+ Tcl_Alloc(tablePtr->numBuckets * sizeof(Tcl_HashEntry *));
}
for (count = tablePtr->numBuckets, newChainPtr = tablePtr->buckets;
count > 0; count--, newChainPtr++) {
*newChainPtr = NULL;
}
tablePtr->rebuildSize *= 4;
- tablePtr->downShift -= 2;
+ if (tablePtr->downShift > 1) {
+ tablePtr->downShift -= 2;
+ }
tablePtr->mask = (tablePtr->mask << 2) + 3;
/*
@@ -1042,9 +1014,9 @@ RebuildTable(
*oldChainPtr = hPtr->nextPtr;
if (typePtr->hashKeyProc == NULL
|| typePtr->flags & TCL_HASH_KEY_RANDOMIZE_HASH) {
- index = RANDOM_INDEX(tablePtr, PTR2INT(hPtr->hash));
+ index = RANDOM_INDEX(tablePtr, hPtr->hash);
} else {
- index = PTR2UINT(hPtr->hash) & tablePtr->mask;
+ index = hPtr->hash & tablePtr->mask;
}
hPtr->nextPtr = tablePtr->buckets[index];
tablePtr->buckets[index] = hPtr;
@@ -1059,7 +1031,7 @@ RebuildTable(
if (typePtr->flags & TCL_HASH_KEY_SYSTEM_HASH) {
TclpSysFree((char *) oldBuckets);
} else {
- ckfree(oldBuckets);
+ Tcl_Free(oldBuckets);
}
}
}
diff --git a/generic/tclHistory.c b/generic/tclHistory.c
index 47806d4..eb12651 100644
--- a/generic/tclHistory.c
+++ b/generic/tclHistory.c
@@ -74,13 +74,6 @@ Tcl_RecordAndEval(
result = Tcl_RecordAndEvalObj(interp, cmdPtr, flags);
/*
- * Move the interpreter's object result to the string result, then
- * reset the object result.
- */
-
- (void) Tcl_GetStringResult(interp);
-
- /*
* Discard the Tcl object created to hold the command.
*/
@@ -137,7 +130,7 @@ Tcl_RecordAndEvalObj(
*/
if (histObjsPtr == NULL) {
- histObjsPtr = ckalloc(sizeof(HistoryObjs));
+ histObjsPtr = Tcl_Alloc(sizeof(HistoryObjs));
TclNewLiteralStringObj(histObjsPtr->historyObj, "::history");
TclNewLiteralStringObj(histObjsPtr->addObj, "add");
Tcl_IncrRefCount(histObjsPtr->historyObj);
@@ -217,7 +210,7 @@ DeleteHistoryObjs(
TclDecrRefCount(histObjsPtr->historyObj);
TclDecrRefCount(histObjsPtr->addObj);
- ckfree(histObjsPtr);
+ Tcl_Free(histObjsPtr);
}
/*
diff --git a/generic/tclIO.c b/generic/tclIO.c
index 118820a..9d15ff5 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -191,9 +191,9 @@ static int DetachChannel(Tcl_Interp *interp, Tcl_Channel chan);
static void DiscardInputQueued(ChannelState *statePtr,
int discardSavedBuffers);
static void DiscardOutputQueued(ChannelState *chanPtr);
-static int DoRead(Channel *chanPtr, char *dst, int bytesToRead,
+static int DoRead(Channel *chanPtr, char *dst, size_t bytesToRead,
int allowShortReads);
-static int DoReadChars(Channel *chan, Tcl_Obj *objPtr, int toRead,
+static int DoReadChars(Channel *chan, Tcl_Obj *objPtr, size_t toRead,
int appendFlag);
static int FilterInputBytes(Channel *chanPtr,
GetsState *statePtr);
@@ -239,7 +239,7 @@ static int WillRead(Channel *chanPtr);
* short description of what the macro does.
*
* --------------------------------------------------------------------------
- * int BytesLeft(ChannelBuffer *bufPtr)
+ * size_t BytesLeft(ChannelBuffer *bufPtr)
*
* Returns the number of bytes of data remaining in the buffer.
*
@@ -277,9 +277,9 @@ static int WillRead(Channel *chanPtr);
* --------------------------------------------------------------------------
*/
-#define BytesLeft(bufPtr) ((bufPtr)->nextAdded - (bufPtr)->nextRemoved)
+#define BytesLeft(bufPtr) ((size_t)((bufPtr)->nextAdded - (bufPtr)->nextRemoved))
-#define SpaceLeft(bufPtr) ((bufPtr)->bufLength - (bufPtr)->nextAdded)
+#define SpaceLeft(bufPtr) ((size_t)((bufPtr)->bufLength - (bufPtr)->nextAdded))
#define IsBufferReady(bufPtr) ((bufPtr)->nextAdded > (bufPtr)->nextRemoved)
@@ -440,7 +440,7 @@ ChanRead(
}
ResetFlag(chanPtr->state, CHANNEL_BLOCKED | CHANNEL_EOF);
chanPtr->state->inputEncodingFlags &= ~TCL_ENCODING_END;
- if (WillRead(chanPtr) < 0) {
+ if (WillRead(chanPtr) == -1) {
return -1;
}
@@ -456,7 +456,16 @@ ChanRead(
}
ResetFlag(chanPtr->state, CHANNEL_BLOCKED | CHANNEL_EOF);
chanPtr->state->inputEncodingFlags &= ~TCL_ENCODING_END;
- if (bytesRead > 0) {
+ if (bytesRead == -1) {
+ if ((result == EWOULDBLOCK) || (result == EAGAIN)) {
+ SetFlag(chanPtr->state, CHANNEL_BLOCKED);
+ result = EAGAIN;
+ }
+ Tcl_SetErrno(result);
+ } else if (bytesRead == 0) {
+ SetFlag(chanPtr->state, CHANNEL_EOF);
+ chanPtr->state->inputEncodingFlags |= TCL_ENCODING_END;
+ } else {
/*
* If we get a short read, signal up that we may be BLOCKED. We should
* avoid calling the driver because on some platforms we will block in
@@ -467,15 +476,6 @@ ChanRead(
if (bytesRead < dstSize) {
SetFlag(chanPtr->state, CHANNEL_BLOCKED);
}
- } else if (bytesRead == 0) {
- SetFlag(chanPtr->state, CHANNEL_EOF);
- chanPtr->state->inputEncodingFlags |= TCL_ENCODING_END;
- } else if (bytesRead < 0) {
- if ((result == EWOULDBLOCK) || (result == EAGAIN)) {
- SetFlag(chanPtr->state, CHANNEL_BLOCKED);
- result = EAGAIN;
- }
- Tcl_SetErrno(result);
}
return bytesRead;
}
@@ -673,7 +673,7 @@ TclFinalizeIOSubsystem(void)
statePtr->refCount--;
}
- if (statePtr->refCount <= 0) {
+ if (statePtr->refCount + 1 <= 1) {
/*
* Close it only if the refcount indicates that the channel is
* not referenced from any interpreter. If it is, that
@@ -860,7 +860,7 @@ Tcl_CreateCloseHandler(
ChannelState *statePtr = ((Channel *) chan)->state;
CloseCallback *cbPtr;
- cbPtr = ckalloc(sizeof(CloseCallback));
+ cbPtr = Tcl_Alloc(sizeof(CloseCallback));
cbPtr->proc = proc;
cbPtr->clientData = clientData;
@@ -906,7 +906,7 @@ Tcl_DeleteCloseHandler(
} else {
cbPrevPtr->nextPtr = cbPtr->nextPtr;
}
- ckfree(cbPtr);
+ Tcl_Free(cbPtr);
break;
}
cbPrevPtr = cbPtr;
@@ -941,7 +941,7 @@ GetChannelTable(
hTblPtr = Tcl_GetAssocData(interp, "tclIO", NULL);
if (hTblPtr == NULL) {
- hTblPtr = ckalloc(sizeof(Tcl_HashTable));
+ hTblPtr = Tcl_Alloc(sizeof(Tcl_HashTable));
Tcl_InitHashTable(hTblPtr, TCL_STRING_KEYS);
Tcl_SetAssocData(interp, "tclIO",
(Tcl_InterpDeleteProc *) DeleteChannelTable, hTblPtr);
@@ -1033,7 +1033,7 @@ DeleteChannelTable(
TclChannelEventScriptInvoker, sPtr);
TclDecrRefCount(sPtr->scriptPtr);
- ckfree(sPtr);
+ Tcl_Free(sPtr);
} else {
prevPtr = sPtr;
}
@@ -1056,7 +1056,7 @@ DeleteChannelTable(
}
Tcl_DeleteHashTable(hTblPtr);
- ckfree(hTblPtr);
+ Tcl_Free(hTblPtr);
}
/*
@@ -1091,7 +1091,7 @@ CheckForStdChannelsBeingClosed(
if (tsdPtr->stdinInitialized == 1
&& tsdPtr->stdinChannel != NULL
&& statePtr == ((Channel *)tsdPtr->stdinChannel)->state) {
- if (statePtr->refCount < 2) {
+ if (statePtr->refCount + 1 < 3) {
statePtr->refCount = 0;
tsdPtr->stdinChannel = NULL;
return;
@@ -1099,7 +1099,7 @@ CheckForStdChannelsBeingClosed(
} else if (tsdPtr->stdoutInitialized == 1
&& tsdPtr->stdoutChannel != NULL
&& statePtr == ((Channel *)tsdPtr->stdoutChannel)->state) {
- if (statePtr->refCount < 2) {
+ if (statePtr->refCount + 1 < 3) {
statePtr->refCount = 0;
tsdPtr->stdoutChannel = NULL;
return;
@@ -1107,7 +1107,7 @@ CheckForStdChannelsBeingClosed(
} else if (tsdPtr->stderrInitialized == 1
&& tsdPtr->stderrChannel != NULL
&& statePtr == ((Channel *)tsdPtr->stderrChannel)->state) {
- if (statePtr->refCount < 2) {
+ if (statePtr->refCount + 1 < 3) {
statePtr->refCount = 0;
tsdPtr->stderrChannel = NULL;
return;
@@ -1269,7 +1269,7 @@ Tcl_UnregisterChannel(
* If the refCount reached zero, close the actual channel.
*/
- if (statePtr->refCount <= 0) {
+ if (statePtr->refCount + 1 <= 1) {
Tcl_Preserve(statePtr);
if (!GotFlag(statePtr, BG_FLUSH_SCHEDULED)) {
/*
@@ -1563,15 +1563,15 @@ TclGetChannelFromObj(
* Re-use the ResolvedCmdName struct.
*/
- Tcl_Release((ClientData) resPtr->statePtr);
+ Tcl_Release(resPtr->statePtr);
} else {
- resPtr = (ResolvedChanName *) ckalloc(sizeof(ResolvedChanName));
+ resPtr = (ResolvedChanName *) Tcl_Alloc(sizeof(ResolvedChanName));
resPtr->refCount = 0;
ChanSetIntRep(objPtr, resPtr); /* Overwrites, if needed */
}
statePtr = ((Channel *)chan)->state;
resPtr->statePtr = statePtr;
- Tcl_Preserve((ClientData) statePtr);
+ Tcl_Preserve(statePtr);
resPtr->interp = interp;
resPtr->epoch = statePtr->epoch;
@@ -1649,8 +1649,8 @@ Tcl_CreateChannel(
* assignments to 0/NULL below.
*/
- chanPtr = ckalloc(sizeof(Channel));
- statePtr = ckalloc(sizeof(ChannelState));
+ chanPtr = Tcl_Alloc(sizeof(Channel));
+ statePtr = Tcl_Alloc(sizeof(ChannelState));
chanPtr->state = statePtr;
chanPtr->instanceData = instanceData;
@@ -1669,10 +1669,10 @@ Tcl_CreateChannel(
* later.
*/
- tmp = ckalloc((len < 7) ? 7 : len);
+ tmp = Tcl_Alloc((len < 7) ? 7 : len);
strcpy(tmp, chanName);
} else {
- tmp = ckalloc(7);
+ tmp = Tcl_Alloc(7);
tmp[0] = '\0';
}
statePtr->channelName = tmp;
@@ -1945,7 +1945,7 @@ Tcl_StackChannel(
statePtr->inQueueTail = NULL;
}
- chanPtr = ckalloc(sizeof(Channel));
+ chanPtr = Tcl_Alloc(sizeof(Channel));
/*
* Save some of the current state into the new structure, reinitialize the
@@ -2007,7 +2007,7 @@ TclChannelRelease(
return;
}
if (chanPtr->typePtr == NULL) {
- ckfree(chanPtr);
+ Tcl_Free(chanPtr);
}
}
@@ -2015,8 +2015,8 @@ static void
ChannelFree(
Channel *chanPtr)
{
- if (chanPtr->refCount == 0) {
- ckfree(chanPtr);
+ if (!chanPtr->refCount) {
+ Tcl_Free(chanPtr);
return;
}
chanPtr->typePtr = NULL;
@@ -2187,7 +2187,7 @@ Tcl_UnstackChannel(
* necessary.
*/
- if (statePtr->refCount <= 0) {
+ if (statePtr->refCount + 1 <= 1) {
if (Tcl_Close(interp, chan) != TCL_OK) {
/*
* TIP #219, Tcl Channel Reflection API.
@@ -2474,7 +2474,7 @@ AllocChannelBuffer(
int n;
n = length + CHANNELBUFFER_HEADER_SIZE + BUFFER_PADDING + BUFFER_PADDING;
- bufPtr = ckalloc(n);
+ bufPtr = Tcl_Alloc(n);
bufPtr->nextAdded = BUFFER_PADDING;
bufPtr->nextRemoved = BUFFER_PADDING;
bufPtr->bufLength = length + BUFFER_PADDING;
@@ -2487,7 +2487,7 @@ static void
PreserveChannelBuffer(
ChannelBuffer *bufPtr)
{
- if (bufPtr->refCount == 0) {
+ if (!bufPtr->refCount) {
Tcl_Panic("Reuse of ChannelBuffer! %p", bufPtr);
}
bufPtr->refCount++;
@@ -2500,14 +2500,14 @@ ReleaseChannelBuffer(
if (--bufPtr->refCount) {
return;
}
- ckfree(bufPtr);
+ Tcl_Free(bufPtr);
}
static int
IsShared(
ChannelBuffer *bufPtr)
{
- return bufPtr->refCount > 1;
+ return bufPtr->refCount + 1 > 2;
}
/*
@@ -2943,7 +2943,7 @@ FlushChannel(
* current output buffer.
*/
- if (GotFlag(statePtr, CHANNEL_CLOSED) && (statePtr->refCount <= 0) &&
+ if (GotFlag(statePtr, CHANNEL_CLOSED) && (statePtr->refCount + 1 <= 1) &&
(statePtr->outQueueHead == NULL) &&
((statePtr->curOutPtr == NULL) ||
IsBufferEmpty(statePtr->curOutPtr))) {
@@ -3079,7 +3079,7 @@ CloseChannel(
if (chanPtr == statePtr->bottomChanPtr) {
if (statePtr->channelName != NULL) {
- ckfree(statePtr->channelName);
+ Tcl_Free(statePtr->channelName);
statePtr->channelName = NULL;
}
@@ -3410,7 +3410,7 @@ Tcl_Close(
statePtr = chanPtr->state;
chanPtr = statePtr->topChanPtr;
- if (statePtr->refCount > 0) {
+ if (statePtr->refCount + 1 > 1) {
Tcl_Panic("called Tcl_Close on channel with refCount > 0");
}
@@ -3475,7 +3475,7 @@ Tcl_Close(
cbPtr = statePtr->closeCbPtr;
statePtr->closeCbPtr = cbPtr->nextPtr;
cbPtr->proc(cbPtr->clientData);
- ckfree(cbPtr);
+ Tcl_Free(cbPtr);
}
ResetFlag(statePtr, CHANNEL_INCLOSE);
@@ -3945,7 +3945,7 @@ Tcl_ClearChannelHandlers(
for (chPtr = statePtr->chPtr; chPtr != NULL; chPtr = chNext) {
chNext = chPtr->nextPtr;
- ckfree(chPtr);
+ Tcl_Free(chPtr);
}
statePtr->chPtr = NULL;
@@ -3972,7 +3972,7 @@ Tcl_ClearChannelHandlers(
for (ePtr = statePtr->scriptRecordPtr; ePtr != NULL; ePtr = eNextPtr) {
eNextPtr = ePtr->nextPtr;
TclDecrRefCount(ePtr->scriptPtr);
- ckfree(ePtr);
+ Tcl_Free(ePtr);
}
statePtr->scriptRecordPtr = NULL;
}
@@ -3991,8 +3991,8 @@ Tcl_ClearChannelHandlers(
* No encoding conversions are applied to the bytes being read.
*
* Results:
- * The number of bytes written or -1 in case of error. If -1,
- * Tcl_GetErrno will return the error code.
+ * The number of bytes written or TCL_IO_FAILURE in case of error. If
+ * TCL_IO_FAILURE, Tcl_GetErrno will return the error code.
*
* Side effects:
* May buffer up output and may cause output to be produced on the
@@ -4001,11 +4001,11 @@ Tcl_ClearChannelHandlers(
*----------------------------------------------------------------------
*/
-int
+size_t
Tcl_Write(
Tcl_Channel chan, /* The channel to buffer output for. */
const char *src, /* Data to queue in output buffer. */
- int srcLen) /* Length of data in bytes, or < 0 for
+ size_t srcLen) /* Length of data in bytes, or -1 for
* strlen(). */
{
/*
@@ -4019,14 +4019,14 @@ Tcl_Write(
chanPtr = statePtr->topChanPtr;
if (CheckChannelErrors(statePtr, TCL_WRITABLE) != 0) {
- return -1;
+ return TCL_IO_FAILURE;
}
- if (srcLen < 0) {
+ if (srcLen == TCL_AUTO_LENGTH) {
srcLen = strlen(src);
}
- if (WriteBytes(chanPtr, src, srcLen) < 0) {
- return -1;
+ if (WriteBytes(chanPtr, src, srcLen) == -1) {
+ return TCL_IO_FAILURE;
}
return srcLen;
}
@@ -4045,8 +4045,8 @@ Tcl_Write(
* No encoding conversions are applied to the bytes being read.
*
* Results:
- * The number of bytes written or -1 in case of error. If -1,
- * Tcl_GetErrno will return the error code.
+ * The number of bytes written or TCL_IO_FAILURE in case of error. If
+ * TCL_IO_FAILURE, Tcl_GetErrno will return the error code.
*
* Side effects:
* May buffer up output and may cause output to be produced on the
@@ -4055,23 +4055,24 @@ Tcl_Write(
*----------------------------------------------------------------------
*/
-int
+size_t
Tcl_WriteRaw(
Tcl_Channel chan, /* The channel to buffer output for. */
const char *src, /* Data to queue in output buffer. */
- int srcLen) /* Length of data in bytes, or < 0 for
+ size_t srcLen) /* Length of data in bytes, or -1 for
* strlen(). */
{
Channel *chanPtr = ((Channel *) chan);
ChannelState *statePtr = chanPtr->state;
/* State info for channel */
- int errorCode, written;
+ int errorCode;
+ size_t written;
if (CheckChannelErrors(statePtr, TCL_WRITABLE | CHANNEL_RAW_MODE) != 0) {
- return -1;
+ return TCL_IO_FAILURE;
}
- if (srcLen < 0) {
+ if (srcLen == TCL_AUTO_LENGTH) {
srcLen = strlen(src);
}
@@ -4081,7 +4082,7 @@ Tcl_WriteRaw(
*/
written = ChanWrite(chanPtr, src, srcLen, &errorCode);
- if (written < 0) {
+ if (written == TCL_IO_FAILURE) {
Tcl_SetErrno(errorCode);
}
@@ -4101,8 +4102,8 @@ Tcl_WriteRaw(
* specified channel to the topmost channel in a stack.
*
* Results:
- * The number of bytes written or -1 in case of error. If -1,
- * Tcl_GetErrno will return the error code.
+ * The number of bytes written or TCL_IO_FAILURE in case of error. If
+ * TCL_IO_FAILURE, Tcl_GetErrno will return the error code.
*
* Side effects:
* May buffer up output and may cause output to be produced on the
@@ -4111,12 +4112,12 @@ Tcl_WriteRaw(
*----------------------------------------------------------------------
*/
-int
+size_t
Tcl_WriteChars(
Tcl_Channel chan, /* The channel to buffer output for. */
const char *src, /* UTF-8 characters to queue in output
* buffer. */
- int len) /* Length of string in bytes, or < 0 for
+ size_t len) /* Length of string in bytes, or -1 for
* strlen(). */
{
Channel *chanPtr = (Channel *) chan;
@@ -4125,12 +4126,12 @@ Tcl_WriteChars(
Tcl_Obj *objPtr;
if (CheckChannelErrors(statePtr, TCL_WRITABLE) != 0) {
- return -1;
+ return TCL_IO_FAILURE;
}
chanPtr = statePtr->topChanPtr;
- if (len < 0) {
+ if (len == TCL_AUTO_LENGTH) {
len = strlen(src);
}
if (statePtr->encoding) {
@@ -4149,7 +4150,7 @@ Tcl_WriteChars(
}
objPtr = Tcl_NewStringObj(src, len);
- src = (char *) Tcl_GetByteArrayFromObj(objPtr, &len);
+ src = (char *) TclGetByteArrayFromObj(objPtr, &len);
result = WriteBytes(chanPtr, src, len);
TclDecrRefCount(objPtr);
return result;
@@ -4180,7 +4181,7 @@ Tcl_WriteChars(
*----------------------------------------------------------------------
*/
-int
+size_t
Tcl_WriteObj(
Tcl_Channel chan, /* The channel to buffer output for. */
Tcl_Obj *objPtr) /* The object to write. */
@@ -4192,16 +4193,16 @@ Tcl_WriteObj(
Channel *chanPtr;
ChannelState *statePtr; /* State info for channel */
const char *src;
- int srcLen;
+ size_t srcLen = 0;
statePtr = ((Channel *) chan)->state;
chanPtr = statePtr->topChanPtr;
if (CheckChannelErrors(statePtr, TCL_WRITABLE) != 0) {
- return -1;
+ return TCL_IO_FAILURE;
}
if (statePtr->encoding == NULL) {
- src = (char *) Tcl_GetByteArrayFromObj(objPtr, &srcLen);
+ src = (char *) TclGetByteArrayFromObj(objPtr, &srcLen);
return WriteBytes(chanPtr, src, srcLen);
} else {
src = TclGetStringFromObj(objPtr, &srcLen);
@@ -4412,7 +4413,7 @@ Write(
* beginning of the next buffer.
*/
- saved = -SpaceLeft(bufPtr);
+ saved = 1 + ~SpaceLeft(bufPtr);
memcpy(safe, dst + dstLen, saved);
bufPtr->nextAdded = bufPtr->bufLength;
}
@@ -4476,7 +4477,7 @@ Write(
*---------------------------------------------------------------------------
*/
-int
+size_t
Tcl_Gets(
Tcl_Channel chan, /* Channel from which to read. */
Tcl_DString *lineRead) /* The line read will be appended to this
@@ -4485,11 +4486,11 @@ Tcl_Gets(
* for managing the storage. */
{
Tcl_Obj *objPtr;
- int charsStored;
+ size_t charsStored;
TclNewObj(objPtr);
charsStored = Tcl_GetsObj(chan, objPtr);
- if (charsStored > 0) {
+ if (charsStored + 1 > 1) {
TclDStringAppendObj(lineRead, objPtr);
}
TclDecrRefCount(objPtr);
@@ -4519,7 +4520,7 @@ Tcl_Gets(
*---------------------------------------------------------------------------
*/
-int
+size_t
Tcl_GetsObj(
Tcl_Channel chan, /* Channel from which to read. */
Tcl_Obj *objPtr) /* The line read will be appended to this
@@ -4530,13 +4531,14 @@ Tcl_GetsObj(
ChannelState *statePtr = chanPtr->state;
/* State info for channel */
ChannelBuffer *bufPtr;
- int inEofChar, skip, copiedTotal, oldLength, oldFlags, oldRemoved;
+ int inEofChar, skip, copiedTotal, oldFlags, oldRemoved;
+ size_t oldLength;
Tcl_Encoding encoding;
char *dst, *dstEnd, *eol, *eof;
Tcl_EncodingState oldState;
if (CheckChannelErrors(statePtr, TCL_READABLE) != 0) {
- return -1;
+ return TCL_IO_FAILURE;
}
/*
@@ -4551,7 +4553,7 @@ Tcl_GetsObj(
/* TODO: Do we need this? */
UpdateInterest(chanPtr);
- return -1;
+ return TCL_IO_FAILURE;
}
/*
@@ -4581,7 +4583,7 @@ Tcl_GetsObj(
* newline in the available input.
*/
- TclGetStringFromObj(objPtr, &oldLength);
+ (void)TclGetStringFromObj(objPtr, &oldLength);
oldFlags = statePtr->inputEncodingFlags;
oldState = statePtr->inputEncodingState;
oldRemoved = BUFFER_PADDING;
@@ -4678,7 +4680,7 @@ Tcl_GetsObj(
*/
if (eol >= dstEnd) {
- int offset;
+ size_t offset;
if (eol != eof) {
offset = eol - objPtr->bytes;
@@ -4724,7 +4726,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--;
}
}
@@ -4945,8 +4947,9 @@ TclGetsObjBinary(
ChannelState *statePtr = chanPtr->state;
/* State info for channel */
ChannelBuffer *bufPtr;
- int inEofChar, skip, copiedTotal, oldLength, oldFlags, oldRemoved;
- int rawLen, byteLen, eolChar;
+ int inEofChar, skip, copiedTotal, oldFlags, oldRemoved;
+ size_t rawLen, byteLen = 0, oldLength;
+ int eolChar;
unsigned char *dst, *dstEnd, *eol, *eof, *byteArray;
/*
@@ -4963,7 +4966,7 @@ TclGetsObjBinary(
* newline in the available input.
*/
- byteArray = Tcl_GetByteArrayFromObj(objPtr, &byteLen);
+ byteArray = TclGetByteArrayFromObj(objPtr, &byteLen);
oldFlags = statePtr->inputEncodingFlags;
oldRemoved = BUFFER_PADDING;
oldLength = byteLen;
@@ -5406,7 +5409,7 @@ FilterInputBytes(
}
extra = rawLen - gsPtr->rawRead;
memcpy(nextPtr->buf + (BUFFER_PADDING - extra),
- raw + gsPtr->rawRead, (size_t) extra);
+ raw + gsPtr->rawRead, extra);
nextPtr->nextRemoved -= extra;
bufPtr->nextAdded -= extra;
}
@@ -5586,11 +5589,11 @@ CommonGetsCleanup(
*----------------------------------------------------------------------
*/
-int
+size_t
Tcl_Read(
Tcl_Channel chan, /* The channel from which to read. */
char *dst, /* Where to store input read. */
- int bytesToRead) /* Maximum number of bytes to read. */
+ size_t bytesToRead) /* Maximum number of bytes to read. */
{
Channel *chanPtr = (Channel *) chan;
ChannelState *statePtr = chanPtr->state;
@@ -5603,7 +5606,7 @@ Tcl_Read(
chanPtr = statePtr->topChanPtr;
if (CheckChannelErrors(statePtr, TCL_READABLE) != 0) {
- return -1;
+ return TCL_IO_FAILURE;
}
return DoRead(chanPtr, dst, bytesToRead, 0);
@@ -5631,11 +5634,11 @@ Tcl_Read(
*----------------------------------------------------------------------
*/
-int
+size_t
Tcl_ReadRaw(
Tcl_Channel chan, /* The channel from which to read. */
char *readBuf, /* Where to store input read. */
- int bytesToRead) /* Maximum number of bytes to read. */
+ size_t bytesToRead) /* Maximum number of bytes to read. */
{
Channel *chanPtr = (Channel *) chan;
ChannelState *statePtr = chanPtr->state;
@@ -5644,7 +5647,7 @@ Tcl_ReadRaw(
assert(bytesToRead > 0);
if (CheckChannelErrors(statePtr, TCL_READABLE | CHANNEL_RAW_MODE) != 0) {
- return -1;
+ return TCL_IO_FAILURE;
}
/*
@@ -5654,8 +5657,8 @@ Tcl_ReadRaw(
while (chanPtr->inQueueHead && bytesToRead > 0) {
ChannelBuffer *bufPtr = chanPtr->inQueueHead;
int bytesInBuffer = BytesLeft(bufPtr);
- int toCopy = (bytesInBuffer < bytesToRead) ? bytesInBuffer
- : bytesToRead;
+ int toCopy = (bytesInBuffer < (int)bytesToRead) ? bytesInBuffer
+ : (int)bytesToRead;
/*
* Copy the current chunk into the read buffer.
@@ -5698,13 +5701,7 @@ Tcl_ReadRaw(
if (bytesToRead > 0) {
int nread = ChanRead(chanPtr, readBuf, bytesToRead);
- if (nread > 0) {
- /*
- * Successful read (short is OK) - add to bytes copied.
- */
-
- copied += nread;
- } else if (nread < 0) {
+ if (nread == -1) {
/*
* An error signaled. If CHANNEL_BLOCKED, then the error is not
* real, but an indication of blocked state. In that case, retain
@@ -5718,6 +5715,12 @@ Tcl_ReadRaw(
if (!GotFlag(statePtr, CHANNEL_BLOCKED) || copied == 0) {
copied = -1;
}
+ } else if (nread > 0) {
+ /*
+ * Successful read (short is OK) - add to bytes copied.
+ */
+
+ copied += nread;
} else {
/*
* nread == 0. Driver is at EOF. Let that state filter up.
@@ -5749,11 +5752,11 @@ Tcl_ReadRaw(
*---------------------------------------------------------------------------
*/
-int
+size_t
Tcl_ReadChars(
Tcl_Channel chan, /* The channel to read. */
Tcl_Obj *objPtr, /* Input data is stored in this object. */
- int toRead, /* Maximum number of characters to store, or
+ size_t toRead, /* Maximum number of characters to store, or
* -1 to read all available data (up to EOF or
* when channel blocks). */
int appendFlag) /* If non-zero, data read from the channel
@@ -5809,7 +5812,7 @@ static int
DoReadChars(
Channel *chanPtr, /* The channel to read. */
Tcl_Obj *objPtr, /* Input data is stored in this object. */
- int toRead, /* Maximum number of characters to store, or
+ size_t toRead, /* Maximum number of characters to store, or
* -1 to read all available data (up to EOF or
* when channel blocks). */
int appendFlag) /* If non-zero, data read from the channel
@@ -5895,7 +5898,7 @@ DoReadChars(
}
ResetFlag(statePtr, CHANNEL_BLOCKED|CHANNEL_EOF);
statePtr->inputEncodingFlags &= ~TCL_ENCODING_END;
- for (copied = 0; (unsigned) toRead > 0; ) {
+ for (copied = 0; toRead > 0; ) {
copiedNow = -1;
if (statePtr->inQueueHead != NULL) {
if (binaryMode) {
@@ -6013,7 +6016,7 @@ ReadBytes(
* been allocated to hold data, not how many
* bytes of data have been stored in the
* object. */
- int bytesToRead) /* Maximum number of bytes to store, or < 0 to
+ int bytesToRead) /* Maximum number of bytes to store, or -1 to
* get all available bytes. Bytes are obtained
* from the first buffer in the queue - even
* if this number is larger than the number of
@@ -6090,7 +6093,8 @@ ReadChars(
int savedIEFlags = statePtr->inputEncodingFlags;
int savedFlags = statePtr->flags;
char *dst, *src = RemovePoint(bufPtr);
- int numBytes, srcLen = BytesLeft(bufPtr);
+ size_t numBytes;
+ int srcLen = BytesLeft(bufPtr);
/*
* One src byte can yield at most one character. So when the number of
@@ -6113,7 +6117,7 @@ ReadChars(
(void) TclGetStringFromObj(objPtr, &numBytes);
Tcl_AppendToObj(objPtr, NULL, dstLimit);
if (toRead == srcLen) {
- unsigned int size;
+ size_t size;
dst = TclGetStringStorage(objPtr, &size) + numBytes;
dstLimit = size - numBytes;
@@ -6619,7 +6623,7 @@ TranslateInputEOL(
* channel, at either the head or tail of the queue.
*
* Results:
- * The number of bytes stored in the channel, or -1 on error.
+ * The number of bytes stored in the channel, or TCL_IO_FAILURE on error.
*
* Side effects:
* Adds input to the input queue of a channel.
@@ -6627,11 +6631,11 @@ TranslateInputEOL(
*----------------------------------------------------------------------
*/
-int
+size_t
Tcl_Ungets(
Tcl_Channel chan, /* The channel for which to add the input. */
const char *str, /* The input itself. */
- int len, /* The length of the input. */
+ size_t len, /* The length of the input. */
int atEnd) /* If non-zero, add at end of queue; otherwise
* add at head of queue. */
{
@@ -6655,7 +6659,7 @@ Tcl_Ungets(
flags = statePtr->flags;
if (CheckChannelErrors(statePtr, TCL_READABLE) != 0) {
- len = -1;
+ len = TCL_IO_FAILURE;
goto done;
}
statePtr->flags = flags;
@@ -7247,7 +7251,7 @@ Tcl_TruncateChannel(
WillWrite(chanPtr);
- if (WillRead(chanPtr) < 0) {
+ if (WillRead(chanPtr) == -1) {
return TCL_ERROR;
}
@@ -7675,7 +7679,7 @@ Tcl_BadChannelOption(
Tcl_AppendPrintfToObj(errObj, "or -%s", argv[i]);
Tcl_SetObjResult(interp, errObj);
Tcl_DStringFree(&ds);
- ckfree(argv);
+ Tcl_Free((void *)argv);
}
Tcl_SetErrno(EINVAL);
return TCL_ERROR;
@@ -8066,7 +8070,7 @@ Tcl_SetChannelOption(
"bad value for -eofchar: must be non-NUL ASCII"
" character", -1));
}
- ckfree(argv);
+ Tcl_Free((void *)argv);
return TCL_ERROR;
}
if (GotFlag(statePtr, TCL_READABLE)) {
@@ -8081,11 +8085,11 @@ Tcl_SetChannelOption(
"bad value for -eofchar: should be a list of zero,"
" one, or two elements", -1));
}
- ckfree(argv);
+ Tcl_Free((void *)argv);
return TCL_ERROR;
}
if (argv != NULL) {
- ckfree(argv);
+ Tcl_Free((void *)argv);
}
/*
@@ -8119,7 +8123,7 @@ Tcl_SetChannelOption(
"bad value for -translation: must be a one or two"
" element list", -1));
}
- ckfree(argv);
+ Tcl_Free((void *)argv);
return TCL_ERROR;
}
@@ -8149,7 +8153,7 @@ Tcl_SetChannelOption(
"bad value for -translation: must be one of "
"auto, binary, cr, lf, crlf, or platform", -1));
}
- ckfree(argv);
+ Tcl_Free((void *)argv);
return TCL_ERROR;
}
@@ -8199,11 +8203,11 @@ Tcl_SetChannelOption(
"bad value for -translation: must be one of "
"auto, binary, cr, lf, crlf, or platform", -1));
}
- ckfree(argv);
+ Tcl_Free((void *)argv);
return TCL_ERROR;
}
}
- ckfree(argv);
+ Tcl_Free((void *)argv);
return TCL_OK;
} else if (chanPtr->typePtr->setOptionProc != NULL) {
return chanPtr->typePtr->setOptionProc(chanPtr->instanceData, interp,
@@ -8262,7 +8266,7 @@ CleanupChannelHandlers(
TclChannelEventScriptInvoker, sPtr);
TclDecrRefCount(sPtr->scriptPtr);
- ckfree(sPtr);
+ Tcl_Free(sPtr);
} else {
prevPtr = sPtr;
}
@@ -8632,7 +8636,7 @@ Tcl_CreateChannelHandler(
}
}
if (chPtr == NULL) {
- chPtr = ckalloc(sizeof(ChannelHandler));
+ chPtr = Tcl_Alloc(sizeof(ChannelHandler));
chPtr->mask = 0;
chPtr->proc = proc;
chPtr->clientData = clientData;
@@ -8736,7 +8740,7 @@ Tcl_DeleteChannelHandler(
} else {
prevChPtr->nextPtr = chPtr->nextPtr;
}
- ckfree(chPtr);
+ Tcl_Free(chPtr);
/*
* Recompute the interest list for the channel, so that infinite loops
@@ -8795,7 +8799,7 @@ DeleteScriptRecord(
TclChannelEventScriptInvoker, esPtr);
TclDecrRefCount(esPtr->scriptPtr);
- ckfree(esPtr);
+ Tcl_Free(esPtr);
break;
}
@@ -8844,7 +8848,7 @@ CreateScriptRecord(
makeCH = (esPtr == NULL);
if (makeCH) {
- esPtr = ckalloc(sizeof(EventScriptRecord));
+ esPtr = Tcl_Alloc(sizeof(EventScriptRecord));
}
/*
@@ -9078,20 +9082,6 @@ ZeroTransferTimerProc(
*----------------------------------------------------------------------
*/
-#if !defined(TCL_NO_DEPRECATED)
-int
-TclCopyChannelOld(
- Tcl_Interp *interp, /* Current interpreter. */
- Tcl_Channel inChan, /* Channel to read from. */
- Tcl_Channel outChan, /* Channel to write to. */
- int toRead, /* Amount of data to copy, or -1 for all. */
- Tcl_Obj *cmdPtr) /* Pointer to script to execute or NULL. */
-{
- return TclCopyChannel(interp, inChan, outChan, (Tcl_WideInt) toRead,
- cmdPtr);
-}
-#endif
-
int
TclCopyChannel(
Tcl_Interp *interp, /* Current interpreter. */
@@ -9174,7 +9164,7 @@ TclCopyChannel(
* completed.
*/
- csPtr = ckalloc(sizeof(CopyState) + !moveBytes * inStatePtr->bufSize);
+ csPtr = Tcl_Alloc(sizeof(CopyState) + !moveBytes * inStatePtr->bufSize);
csPtr->bufSize = !moveBytes * inStatePtr->bufSize;
csPtr->readPtr = inPtr;
csPtr->writePtr = outPtr;
@@ -9468,7 +9458,8 @@ CopyData(
Tcl_Obj *cmdPtr, *errObj = NULL, *bufObj = NULL, *msg = NULL;
Tcl_Channel inChan, outChan;
ChannelState *inStatePtr, *outStatePtr;
- int result = TCL_OK, size, sizeb;
+ int result = TCL_OK, size;
+ size_t sizeb;
Tcl_WideInt total;
const char *buffer;
int inBinary, outBinary, sameEncoding;
@@ -9534,7 +9525,7 @@ CopyData(
|| (csPtr->toRead > (Tcl_WideInt) csPtr->bufSize)) {
sizeb = csPtr->bufSize;
} else {
- sizeb = (int) csPtr->toRead;
+ sizeb = csPtr->toRead;
}
if (inBinary || sameEncoding) {
@@ -9544,7 +9535,7 @@ CopyData(
size = DoReadChars(inStatePtr->topChanPtr, bufObj, sizeb,
0 /* No append */);
}
- underflow = (size >= 0) && (size < sizeb); /* Input underflow */
+ underflow = (size >= 0) && ((size_t)size < sizeb); /* Input underflow */
}
if (size < 0) {
@@ -9628,7 +9619,7 @@ CopyData(
* unsuitable for updating totals and toRead.
*/
- if (sizeb < 0) {
+ if (sizeb == TCL_AUTO_LENGTH) {
writeError:
if (interp) {
TclNewObj(errObj);
@@ -9796,14 +9787,12 @@ static int
DoRead(
Channel *chanPtr, /* The channel from which to read. */
char *dst, /* Where to store input read. */
- int bytesToRead, /* Maximum number of bytes to read. */
+ size_t bytesToRead, /* Maximum number of bytes to read. */
int allowShortReads) /* Allow half-blocking (pipes,sockets) */
{
ChannelState *statePtr = chanPtr->state;
char *p = dst;
- assert(bytesToRead >= 0);
-
/*
* Early out when we know a read will get the eofchar.
*
@@ -9857,7 +9846,7 @@ DoRead(
while (!bufPtr || /* We got no buffer! OR */
(!IsBufferFull(bufPtr) && /* Our buffer has room AND */
- (BytesLeft(bufPtr) < bytesToRead))) {
+ ((size_t)BytesLeft(bufPtr) < bytesToRead))) {
/* Not enough bytes in it yet
* to fill the dst */
int code;
@@ -10101,7 +10090,7 @@ StopCopy(
}
inStatePtr->csPtrR = NULL;
outStatePtr->csPtrW = NULL;
- ckfree(csPtr);
+ Tcl_Free(csPtr);
}
/*
@@ -10403,7 +10392,7 @@ Tcl_IsChannelShared(
ChannelState *statePtr = ((Channel *) chan)->state;
/* State of real channel structure. */
- return ((statePtr->refCount > 1) ? 1 : 0);
+ return ((statePtr->refCount + 1 > 2) ? 1 : 0);
}
/*
@@ -10447,7 +10436,7 @@ Tcl_IsChannelExisting(
}
if ((*chanName == *name) &&
- (memcmp(name, chanName, (size_t) chanNameLen + 1) == 0)) {
+ (memcmp(name, chanName, chanNameLen + 1) == 0)) {
return 1;
}
}
@@ -11074,7 +11063,7 @@ FixLevelCode(
lcn += 2;
}
- lvn = ckalloc(lcn * sizeof(Tcl_Obj *));
+ lvn = Tcl_Alloc(lcn * sizeof(Tcl_Obj *));
/*
* New level/code information is spliced into the first occurence of
@@ -11127,7 +11116,7 @@ FixLevelCode(
msg = Tcl_NewListObj(j, lvn);
- ckfree(lvn);
+ Tcl_Free(lvn);
return msg;
}
@@ -11275,7 +11264,7 @@ FreeChannelIntRep(
return;
}
Tcl_Release(resPtr->statePtr);
- ckfree(resPtr);
+ Tcl_Free(resPtr);
}
#if 0
diff --git a/generic/tclIO.h b/generic/tclIO.h
index d10f268..1fd6458 100644
--- a/generic/tclIO.h
+++ b/generic/tclIO.h
@@ -36,7 +36,7 @@
*/
typedef struct ChannelBuffer {
- int refCount; /* Current uses count */
+ size_t refCount; /* Current uses count */
int nextAdded; /* The next position into which a character
* will be put in the buffer. */
int nextRemoved; /* Position of next byte to be removed from
@@ -113,7 +113,7 @@ typedef struct Channel {
ChannelBuffer *inQueueHead; /* Points at first buffer in input queue. */
ChannelBuffer *inQueueTail; /* Points at last buffer in input queue. */
- int refCount;
+ size_t refCount;
} Channel;
/*
@@ -163,7 +163,7 @@ typedef struct ChannelState {
int unreportedError; /* Non-zero if an error report was deferred
* because it happened in the background. The
* value is the POSIX error code. */
- int refCount; /* How many interpreters hold references to
+ size_t refCount; /* How many interpreters hold references to
* this IO channel? */
struct CloseCallback *closeCbPtr;
/* Callbacks registered to be called when the
diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c
index 271fc57..522ed3d 100644
--- a/generic/tclIOCmd.c
+++ b/generic/tclIOCmd.c
@@ -15,7 +15,7 @@
* Callback structure for accept callback in a TCP server.
*/
-typedef struct AcceptCallback {
+typedef struct {
Tcl_Obj *script; /* Script to invoke. */
Tcl_Interp *interp; /* Interpreter in which to run it. */
} AcceptCallback;
@@ -137,19 +137,6 @@ Tcl_PutsObjCmd(
chanObjPtr = objv[2];
string = objv[3];
break;
-#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
- } else if (strcmp(TclGetString(objv[3]), "nonewline") == 0) {
- /*
- * The code below provides backwards compatibility with an old
- * form of the command that is no longer recommended or
- * documented. See also [Bug #3151675]. Will be removed in Tcl 9,
- * maybe even earlier.
- */
-
- chanObjPtr = objv[1];
- string = objv[2];
- break;
-#endif
}
/* Fall through */
default: /* [puts] or
@@ -181,12 +168,12 @@ Tcl_PutsObjCmd(
TclChannelPreserve(chan);
result = Tcl_WriteObj(chan, string);
- if (result < 0) {
+ if (result == -1) {
goto error;
}
if (newline != 0) {
result = Tcl_WriteChars(chan, "\n", 1);
- if (result < 0) {
+ if (result == -1) {
goto error;
}
}
@@ -439,25 +426,11 @@ Tcl_ReadObjCmd(
if (i < objc) {
if ((TclGetIntFromObj(interp, objv[i], &toRead) != TCL_OK)
|| (toRead < 0)) {
-#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
- /*
- * The code below provides backwards compatibility with an old
- * form of the command that is no longer recommended or
- * documented. See also [Bug #3151675]. Will be removed in Tcl 9,
- * maybe even earlier.
- */
-
- if (strcmp(TclGetString(objv[i]), "nonewline") != 0) {
-#endif
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"expected non-negative integer but got \"%s\"",
TclGetString(objv[i])));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "NUMBER", NULL);
return TCL_ERROR;
-#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
- }
- newline = 1;
-#endif
}
}
@@ -489,7 +462,7 @@ Tcl_ReadObjCmd(
if ((charactersRead > 0) && (newline != 0)) {
const char *result;
- int length;
+ size_t length;
result = TclGetStringFromObj(resultPtr, &length);
if (result[length - 1] == '\n') {
@@ -735,7 +708,7 @@ Tcl_CloseObjCmd(
Tcl_Obj *resultPtr = Tcl_GetObjResult(interp);
const char *string;
- int len;
+ size_t len;
if (Tcl_IsShared(resultPtr)) {
resultPtr = Tcl_DuplicateObj(resultPtr);
@@ -897,8 +870,8 @@ Tcl_ExecObjCmd(
* on the _Tcl_ stack. */
const char *string;
Tcl_Channel chan;
- int argc, background, i, index, keepNewline, result, skip, length;
- int ignoreStderr;
+ int argc, background, i, index, keepNewline, result, skip, ignoreStderr;
+ size_t length;
static const char *const options[] = {
"-ignorestderr", "-keepnewline", "--", NULL
};
@@ -1192,7 +1165,7 @@ Tcl_OpenObjCmd(
Tcl_SetChannelOption(interp, chan, "-translation", "binary");
}
}
- ckfree(cmdArgv);
+ Tcl_Free((void *)cmdArgv);
}
if (chan == NULL) {
return TCL_ERROR;
@@ -1241,7 +1214,7 @@ TcpAcceptCallbacksDeleteProc(
acceptCallbackPtr->interp = NULL;
}
Tcl_DeleteHashTable(hTblPtr);
- ckfree(hTblPtr);
+ Tcl_Free(hTblPtr);
}
/*
@@ -1281,7 +1254,7 @@ RegisterTcpServerInterpCleanup(
hTblPtr = Tcl_GetAssocData(interp, "tclTCPAcceptCallbacks", NULL);
if (hTblPtr == NULL) {
- hTblPtr = ckalloc(sizeof(Tcl_HashTable));
+ hTblPtr = Tcl_Alloc(sizeof(Tcl_HashTable));
Tcl_InitHashTable(hTblPtr, TCL_ONE_WORD_KEYS);
Tcl_SetAssocData(interp, "tclTCPAcceptCallbacks",
TcpAcceptCallbacksDeleteProc, hTblPtr);
@@ -1456,7 +1429,7 @@ TcpServerCloseProc(
acceptCallbackPtr);
}
Tcl_DecrRefCount(acceptCallbackPtr->script);
- ckfree(acceptCallbackPtr);
+ Tcl_Free(acceptCallbackPtr);
}
/*
@@ -1503,7 +1476,7 @@ Tcl_SocketObjCmd(
}
for (a = 1; a < objc; a++) {
- const char *arg = Tcl_GetString(objv[a]);
+ const char *arg = TclGetString(objv[a]);
if (arg[0] != '-') {
break;
@@ -1652,7 +1625,7 @@ Tcl_SocketObjCmd(
port = TclGetString(objv[a]);
if (server) {
- AcceptCallback *acceptCallbackPtr = ckalloc(sizeof(AcceptCallback));
+ AcceptCallback *acceptCallbackPtr = Tcl_Alloc(sizeof(AcceptCallback));
Tcl_IncrRefCount(script);
acceptCallbackPtr->script = script;
@@ -1662,7 +1635,7 @@ Tcl_SocketObjCmd(
AcceptCallbackProc, acceptCallbackPtr);
if (chan == NULL) {
Tcl_DecrRefCount(script);
- ckfree(acceptCallbackPtr);
+ Tcl_Free(acceptCallbackPtr);
return TCL_ERROR;
}
diff --git a/generic/tclIOGT.c b/generic/tclIOGT.c
index 9949a0e..9cda58c 100644
--- a/generic/tclIOGT.c
+++ b/generic/tclIOGT.c
@@ -230,7 +230,7 @@ ReleaseData(
}
ResultClear(&dataPtr->result);
Tcl_DecrRefCount(dataPtr->command);
- ckfree(dataPtr);
+ Tcl_Free(dataPtr);
}
/*
@@ -287,7 +287,7 @@ TclChannelTransform(
* regime of the underlying channel and to use the same for us too.
*/
- dataPtr = ckalloc(sizeof(TransformChannelData));
+ dataPtr = Tcl_Alloc(sizeof(TransformChannelData));
dataPtr->refCount = 1;
Tcl_DStringInit(&ds);
@@ -378,7 +378,7 @@ ExecuteCallback(
* interpreters. */
{
Tcl_Obj *resObj; /* See below, switch (transmit). */
- int resLen;
+ size_t resLen = 0;
unsigned char *resBuf;
Tcl_InterpState state = NULL;
int res = TCL_OK;
@@ -443,7 +443,7 @@ ExecuteCallback(
break;
}
resObj = Tcl_GetObjResult(eval);
- resBuf = Tcl_GetByteArrayFromObj(resObj, &resLen);
+ resBuf = TclGetByteArrayFromObj(resObj, &resLen);
Tcl_WriteRaw(Tcl_GetStackedChannel(dataPtr->self), (char *) resBuf,
resLen);
break;
@@ -453,13 +453,13 @@ ExecuteCallback(
break;
}
resObj = Tcl_GetObjResult(eval);
- resBuf = Tcl_GetByteArrayFromObj(resObj, &resLen);
+ resBuf = TclGetByteArrayFromObj(resObj, &resLen);
Tcl_WriteRaw(dataPtr->self, (char *) resBuf, resLen);
break;
case TRANSMIT_IBUF:
resObj = Tcl_GetObjResult(eval);
- resBuf = Tcl_GetByteArrayFromObj(resObj, &resLen);
+ resBuf = TclGetByteArrayFromObj(resObj, &resLen);
ResultAdd(&dataPtr->result, resBuf, resLen);
break;
@@ -1272,7 +1272,7 @@ ResultClear(
r->used = 0;
if (r->allocated) {
- ckfree(r->buf);
+ Tcl_Free(r->buf);
r->buf = NULL;
r->allocated = 0;
}
@@ -1416,10 +1416,10 @@ ResultAdd(
if (r->allocated == 0) {
r->allocated = toWrite + INCREMENT;
- r->buf = ckalloc(r->allocated);
+ r->buf = Tcl_Alloc(r->allocated);
} else {
r->allocated += toWrite + INCREMENT;
- r->buf = ckrealloc(r->buf, r->allocated);
+ r->buf = Tcl_Realloc(r->buf, r->allocated);
}
}
diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c
index 23049fb..f356184 100644
--- a/generic/tclIORChan.c
+++ b/generic/tclIORChan.c
@@ -263,7 +263,7 @@ typedef struct {
struct ForwardParamInput {
ForwardParamBase base; /* "Supertype". MUST COME FIRST. */
char *buf; /* O: Where to store the read bytes */
- int toRead; /* I: #bytes to read,
+ size_t toRead; /* I: #bytes to read,
* O: #bytes actually read */
};
struct ForwardParamOutput {
@@ -396,7 +396,7 @@ static void SrcExitProc(ClientData clientData);
#define FreeReceivedError(p) \
if ((p)->base.mustFree) { \
- ckfree((p)->base.msgStr); \
+ Tcl_Free((p)->base.msgStr); \
}
#define PassReceivedErrorInterp(i,p) \
if ((i) != NULL) { \
@@ -681,7 +681,7 @@ TclChanCreateObjCmd(
* as the actual channel type.
*/
- Tcl_ChannelType *clonePtr = ckalloc(sizeof(Tcl_ChannelType));
+ Tcl_ChannelType *clonePtr = Tcl_Alloc(sizeof(Tcl_ChannelType));
memcpy(clonePtr, &tclRChannelType, sizeof(Tcl_ChannelType));
@@ -736,7 +736,7 @@ TclChanCreateObjCmd(
Tcl_DecrRefCount(rcPtr->name);
Tcl_DecrRefCount(rcPtr->methods);
Tcl_DecrRefCount(rcPtr->cmd);
- ckfree(rcPtr);
+ Tcl_Free(rcPtr);
return TCL_ERROR;
#undef MODE
@@ -945,7 +945,7 @@ TclChanPostEventObjCmd(
}
#if TCL_THREADS
} else {
- ReflectEvent *ev = ckalloc(sizeof(ReflectEvent));
+ ReflectEvent *ev = Tcl_Alloc(sizeof(ReflectEvent));
ev->header.proc = ReflectEventRun;
ev->events = events;
@@ -1198,7 +1198,7 @@ ReflectClose(
tctPtr = ((Channel *)rcPtr->chan)->typePtr;
if (tctPtr && tctPtr != &tclRChannelType) {
- ckfree(tctPtr);
+ Tcl_Free((void *)tctPtr);
((Channel *)rcPtr->chan)->typePtr = NULL;
}
if (rcPtr->readTimer != NULL) {
@@ -1273,7 +1273,7 @@ ReflectClose(
#endif
tctPtr = ((Channel *)rcPtr->chan)->typePtr;
if (tctPtr && tctPtr != &tclRChannelType) {
- ckfree(tctPtr);
+ Tcl_Free((void *)tctPtr);
((Channel *)rcPtr->chan)->typePtr = NULL;
}
if (rcPtr->readTimer != NULL) {
@@ -1311,7 +1311,7 @@ ReflectInput(
{
ReflectedChannel *rcPtr = clientData;
Tcl_Obj *toReadObj;
- int bytec; /* Number of returned bytes */
+ size_t bytec = 0; /* Number of returned bytes */
unsigned char *bytev; /* Array of returned bytes */
Tcl_Obj *resObj; /* Result data for 'read' */
@@ -1339,7 +1339,7 @@ ReflectInput(
PassReceivedError(rcPtr->chan, &p);
*errorCodePtr = EINVAL;
}
- p.input.toRead = -1;
+ p.input.toRead = TCL_AUTO_LENGTH;
} else {
*errorCodePtr = EOK;
}
@@ -1368,16 +1368,16 @@ ReflectInput(
goto invalid;
}
- bytev = Tcl_GetByteArrayFromObj(resObj, &bytec);
+ bytev = TclGetByteArrayFromObj(resObj, &bytec);
- if (toRead < bytec) {
+ if ((size_t)toRead < bytec) {
SetChannelErrorStr(rcPtr->chan, msg_read_toomuch);
- goto invalid;
+ goto invalid;
}
*errorCodePtr = EOK;
- if (bytec > 0) {
+ if (bytec + 1 > 1) {
memcpy(buf, bytev, bytec);
}
@@ -2009,7 +2009,7 @@ ReflectGetOption(
(listc == 1 ? "" : "s")));
goto error;
} else {
- int len;
+ size_t len;
const char *str = TclGetStringFromObj(resObj, &len);
if (len) {
@@ -2176,7 +2176,7 @@ NewReflectedChannel(
ReflectedChannel *rcPtr;
MethodName mn = METH_BLOCKING;
- rcPtr = ckalloc(sizeof(ReflectedChannel));
+ rcPtr = Tcl_Alloc(sizeof(ReflectedChannel));
/* rcPtr->chan: Assigned by caller. Dummy data here. */
@@ -2263,7 +2263,7 @@ FreeReflectedChannel(
if (rcPtr->cmd) {
Tcl_DecrRefCount(rcPtr->cmd);
}
- ckfree(rcPtr);
+ Tcl_Free(rcPtr);
}
/*
@@ -2384,7 +2384,7 @@ InvokeTclMethod(
*/
if (result != TCL_ERROR) {
- int cmdLen;
+ size_t cmdLen;
const char *cmdString = TclGetStringFromObj(cmd, &cmdLen);
Tcl_IncrRefCount(cmd);
@@ -2499,7 +2499,7 @@ GetReflectedChannelMap(
ReflectedChannelMap *rcmPtr = Tcl_GetAssocData(interp, RCMKEY, NULL);
if (rcmPtr == NULL) {
- rcmPtr = ckalloc(sizeof(ReflectedChannelMap));
+ rcmPtr = Tcl_Alloc(sizeof(ReflectedChannelMap));
Tcl_InitHashTable(&rcmPtr->map, TCL_STRING_KEYS);
Tcl_SetAssocData(interp, RCMKEY,
(Tcl_InterpDeleteProc *) DeleteReflectedChannelMap, rcmPtr);
@@ -2588,7 +2588,7 @@ DeleteReflectedChannelMap(
Tcl_DeleteHashEntry(hPtr);
}
Tcl_DeleteHashTable(&rcmPtr->map);
- ckfree(&rcmPtr->map);
+ Tcl_Free(&rcmPtr->map);
#if TCL_THREADS
/*
@@ -2700,7 +2700,7 @@ GetThreadReflectedChannelMap(void)
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
if (!tsdPtr->rcmPtr) {
- tsdPtr->rcmPtr = ckalloc(sizeof(ReflectedChannelMap));
+ tsdPtr->rcmPtr = Tcl_Alloc(sizeof(ReflectedChannelMap));
Tcl_InitHashTable(&tsdPtr->rcmPtr->map, TCL_STRING_KEYS);
Tcl_CreateThreadExitHandler(DeleteThreadReflectedChannelMap, NULL);
}
@@ -2823,7 +2823,7 @@ DeleteThreadReflectedChannelMap(
MarkDead(rcPtr);
Tcl_DeleteHashEntry(hPtr);
}
- ckfree(rcmPtr);
+ Tcl_Free(rcmPtr);
}
static void
@@ -2863,8 +2863,8 @@ ForwardOpToHandlerThread(
* Create and initialize the event and data structures.
*/
- evPtr = ckalloc(sizeof(ForwardingEvent));
- resultPtr = ckalloc(sizeof(ForwardingResult));
+ evPtr = Tcl_Alloc(sizeof(ForwardingEvent));
+ resultPtr = Tcl_Alloc(sizeof(ForwardingResult));
evPtr->event.proc = ForwardProc;
evPtr->resultPtr = resultPtr;
@@ -2946,7 +2946,7 @@ ForwardOpToHandlerThread(
Tcl_DeleteThreadExitHandler(SrcExitProc, evPtr);
- ckfree(resultPtr);
+ Tcl_Free(resultPtr);
}
static int
@@ -3046,22 +3046,22 @@ ForwardProc(
} else {
ForwardSetObjError(paramPtr, resObj);
}
- paramPtr->input.toRead = -1;
+ paramPtr->input.toRead = TCL_IO_FAILURE;
} else {
/*
* Process a regular result.
*/
- int bytec; /* Number of returned bytes */
+ size_t bytec = 0; /* Number of returned bytes */
unsigned char *bytev; /* Array of returned bytes */
- bytev = Tcl_GetByteArrayFromObj(resObj, &bytec);
+ bytev = TclGetByteArrayFromObj(resObj, &bytec);
if (paramPtr->input.toRead < bytec) {
ForwardSetStaticError(paramPtr, msg_read_toomuch);
- paramPtr->input.toRead = -1;
+ paramPtr->input.toRead = TCL_IO_FAILURE;
} else {
- if (bytec > 0) {
+ if (bytec + 1 > 1) {
memcpy(paramPtr->input.buf, bytev, bytec);
}
paramPtr->input.toRead = bytec;
@@ -3241,14 +3241,14 @@ ForwardProc(
* Odd number of elements is wrong. [x].
*/
- char *buf = ckalloc(200);
+ char *buf = Tcl_Alloc(200);
sprintf(buf,
"{Expected list with even number of elements, got %d %s instead}",
listc, (listc == 1 ? "element" : "elements"));
ForwardSetDynamicError(paramPtr, buf);
} else {
- int len;
+ size_t len;
const char *str = TclGetStringFromObj(resObj, &len);
if (len) {
@@ -3347,11 +3347,11 @@ ForwardSetObjError(
ForwardParam *paramPtr,
Tcl_Obj *obj)
{
- int len;
+ size_t len;
const char *msgStr = TclGetStringFromObj(obj, &len);
len++;
- ForwardSetDynamicError(paramPtr, ckalloc(len));
+ ForwardSetDynamicError(paramPtr, Tcl_Alloc(len));
memcpy(paramPtr->base.msgStr, msgStr, len);
}
#endif
diff --git a/generic/tclIORTrans.c b/generic/tclIORTrans.c
index 8e24cf7..9327037 100644
--- a/generic/tclIORTrans.c
+++ b/generic/tclIORTrans.c
@@ -89,8 +89,8 @@ static const Tcl_ChannelType tclRTransformType = {
typedef struct {
unsigned char *buf; /* Reference to the buffer area. */
- int allocated; /* Allocated size of the buffer area. */
- int used; /* Number of bytes in the buffer,
+ size_t allocated; /* Allocated size of the buffer area. */
+ size_t used; /* Number of bytes in the buffer,
* <= allocated. */
} ResultBuffer;
@@ -270,7 +270,7 @@ struct ForwardParamTransform {
ForwardParamBase base; /* "Supertype". MUST COME FIRST. */
char *buf; /* I: Bytes to transform,
* O: Bytes in transform result */
- int size; /* I: #bytes to transform,
+ size_t size; /* I: #bytes to transform,
* O: #bytes in the transform result */
};
struct ForwardParamLimit {
@@ -366,7 +366,7 @@ static void SrcExitProc(ClientData clientData);
#define FreeReceivedError(p) \
do { \
if ((p)->base.mustFree) { \
- ckfree((p)->base.msgStr); \
+ Tcl_Free((p)->base.msgStr); \
} \
} while (0)
#define PassReceivedErrorInterp(i,p) \
@@ -620,7 +620,7 @@ TclChanPushObjCmd(
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"chan handler \"%s initialize\" returned %s",
TclGetString(cmdObj),
- Tcl_GetString(Tcl_GetObjResult(interp))));
+ Tcl_GetStringResult(interp)));
Tcl_DecrRefCount(resObj);
goto error;
}
@@ -1014,7 +1014,7 @@ ReflectClose(
if (!rtPtr->dead) {
rtmPtr = GetReflectedTransformMap(rtPtr->interp);
- hPtr = Tcl_FindHashEntry(&rtmPtr->map, Tcl_GetString(rtPtr->handle));
+ hPtr = Tcl_FindHashEntry(&rtmPtr->map, TclGetString(rtPtr->handle));
if (hPtr) {
Tcl_DeleteHashEntry(hPtr);
}
@@ -1759,7 +1759,7 @@ NewReflectedTransform(
Tcl_Obj **listv;
int i;
- rtPtr = ckalloc(sizeof(ReflectedTransform));
+ rtPtr = Tcl_Alloc(sizeof(ReflectedTransform));
/* rtPtr->chan: Assigned by caller. Dummy data here. */
/* rtPtr->methods: Assigned by caller. Dummy data here. */
@@ -1806,7 +1806,7 @@ NewReflectedTransform(
*/
rtPtr->argc = listc + 2;
- rtPtr->argv = ckalloc(sizeof(Tcl_Obj *) * (listc+4));
+ rtPtr->argv = Tcl_Alloc(sizeof(Tcl_Obj *) * (listc+4));
/*
* Duplicate object references.
@@ -1914,8 +1914,8 @@ FreeReflectedTransform(
FreeReflectedTransformArgs(rtPtr);
- ckfree(rtPtr->argv);
- ckfree(rtPtr);
+ Tcl_Free(rtPtr->argv);
+ Tcl_Free(rtPtr);
}
/*
@@ -2041,7 +2041,7 @@ InvokeTclMethod(
*/
if (result != TCL_ERROR) {
Tcl_Obj *cmd = Tcl_NewListObj(cmdc, rtPtr->argv);
- int cmdLen;
+ size_t cmdLen;
const char *cmdString = TclGetStringFromObj(cmd, &cmdLen);
Tcl_IncrRefCount(cmd);
@@ -2114,7 +2114,7 @@ GetReflectedTransformMap(
ReflectedTransformMap *rtmPtr = Tcl_GetAssocData(interp, RTMKEY, NULL);
if (rtmPtr == NULL) {
- rtmPtr = ckalloc(sizeof(ReflectedTransformMap));
+ rtmPtr = Tcl_Alloc(sizeof(ReflectedTransformMap));
Tcl_InitHashTable(&rtmPtr->map, TCL_STRING_KEYS);
Tcl_SetAssocData(interp, RTMKEY,
(Tcl_InterpDeleteProc *) DeleteReflectedTransformMap, rtmPtr);
@@ -2179,7 +2179,7 @@ DeleteReflectedTransformMap(
Tcl_DeleteHashEntry(hPtr);
}
Tcl_DeleteHashTable(&rtmPtr->map);
- ckfree(&rtmPtr->map);
+ Tcl_Free(&rtmPtr->map);
#if TCL_THREADS
/*
@@ -2277,7 +2277,7 @@ GetThreadReflectedTransformMap(void)
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
if (!tsdPtr->rtmPtr) {
- tsdPtr->rtmPtr = ckalloc(sizeof(ReflectedTransformMap));
+ tsdPtr->rtmPtr = Tcl_Alloc(sizeof(ReflectedTransformMap));
Tcl_InitHashTable(&tsdPtr->rtmPtr->map, TCL_STRING_KEYS);
Tcl_CreateThreadExitHandler(DeleteThreadReflectedTransformMap, NULL);
}
@@ -2335,7 +2335,7 @@ DeleteThreadReflectedTransformMap(
FreeReflectedTransformArgs(rtPtr);
Tcl_DeleteHashEntry(hPtr);
}
- ckfree(rtmPtr);
+ Tcl_Free(rtmPtr);
/*
* Go through the list of pending results and cancel all whose events were
@@ -2412,8 +2412,8 @@ ForwardOpToOwnerThread(
* Create and initialize the event and data structures.
*/
- evPtr = ckalloc(sizeof(ForwardingEvent));
- resultPtr = ckalloc(sizeof(ForwardingResult));
+ evPtr = Tcl_Alloc(sizeof(ForwardingEvent));
+ resultPtr = Tcl_Alloc(sizeof(ForwardingResult));
evPtr->event.proc = ForwardProc;
evPtr->resultPtr = resultPtr;
@@ -2493,7 +2493,7 @@ ForwardOpToOwnerThread(
Tcl_DeleteThreadExitHandler(SrcExitProc, evPtr);
- ckfree(resultPtr);
+ Tcl_Free(resultPtr);
}
static int
@@ -2590,23 +2590,23 @@ ForwardProc(
if (InvokeTclMethod(rtPtr, "read", bufObj, NULL, &resObj) != TCL_OK) {
ForwardSetObjError(paramPtr, resObj);
- paramPtr->transform.size = -1;
+ paramPtr->transform.size = TCL_AUTO_LENGTH;
} else {
/*
* Process a regular return. Contains the transformation result.
* Sent it back to the request originator.
*/
- int bytec; /* Number of returned bytes */
+ size_t bytec = 0; /* Number of returned bytes */
unsigned char *bytev;
/* Array of returned bytes */
- bytev = Tcl_GetByteArrayFromObj(resObj, &bytec);
+ bytev = TclGetByteArrayFromObj(resObj, &bytec);
paramPtr->transform.size = bytec;
if (bytec > 0) {
- paramPtr->transform.buf = ckalloc(bytec);
+ paramPtr->transform.buf = Tcl_Alloc(bytec);
memcpy(paramPtr->transform.buf, bytev, bytec);
} else {
paramPtr->transform.buf = NULL;
@@ -2624,23 +2624,23 @@ ForwardProc(
if (InvokeTclMethod(rtPtr, "write", bufObj, NULL, &resObj) != TCL_OK) {
ForwardSetObjError(paramPtr, resObj);
- paramPtr->transform.size = -1;
+ paramPtr->transform.size = TCL_AUTO_LENGTH;
} else {
/*
* Process a regular return. Contains the transformation result.
* Sent it back to the request originator.
*/
- int bytec; /* Number of returned bytes */
+ size_t bytec = 0; /* Number of returned bytes */
unsigned char *bytev;
/* Array of returned bytes */
- bytev = Tcl_GetByteArrayFromObj(resObj, &bytec);
+ bytev = TclGetByteArrayFromObj(resObj, &bytec);
paramPtr->transform.size = bytec;
if (bytec > 0) {
- paramPtr->transform.buf = ckalloc(bytec);
+ paramPtr->transform.buf = Tcl_Alloc(bytec);
memcpy(paramPtr->transform.buf, bytev, bytec);
} else {
paramPtr->transform.buf = NULL;
@@ -2654,22 +2654,22 @@ ForwardProc(
case ForwardedDrain:
if (InvokeTclMethod(rtPtr, "drain", NULL, NULL, &resObj) != TCL_OK) {
ForwardSetObjError(paramPtr, resObj);
- paramPtr->transform.size = -1;
+ paramPtr->transform.size = TCL_AUTO_LENGTH;
} else {
/*
* Process a regular return. Contains the transformation result.
* Sent it back to the request originator.
*/
- int bytec; /* Number of returned bytes */
+ size_t bytec = 0; /* Number of returned bytes */
unsigned char *bytev; /* Array of returned bytes */
- bytev = Tcl_GetByteArrayFromObj(resObj, &bytec);
+ bytev = TclGetByteArrayFromObj(resObj, &bytec);
paramPtr->transform.size = bytec;
if (bytec > 0) {
- paramPtr->transform.buf = ckalloc(bytec);
+ paramPtr->transform.buf = Tcl_Alloc(bytec);
memcpy(paramPtr->transform.buf, bytev, bytec);
} else {
paramPtr->transform.buf = NULL;
@@ -2680,23 +2680,23 @@ ForwardProc(
case ForwardedFlush:
if (InvokeTclMethod(rtPtr, "flush", NULL, NULL, &resObj) != TCL_OK) {
ForwardSetObjError(paramPtr, resObj);
- paramPtr->transform.size = -1;
+ paramPtr->transform.size = TCL_AUTO_LENGTH;
} else {
/*
* Process a regular return. Contains the transformation result.
* Sent it back to the request originator.
*/
- int bytec; /* Number of returned bytes */
+ size_t bytec = 0; /* Number of returned bytes */
unsigned char *bytev;
/* Array of returned bytes */
- bytev = Tcl_GetByteArrayFromObj(resObj, &bytec);
+ bytev = TclGetByteArrayFromObj(resObj, &bytec);
paramPtr->transform.size = bytec;
if (bytec > 0) {
- paramPtr->transform.buf = ckalloc(bytec);
+ paramPtr->transform.buf = Tcl_Alloc(bytec);
memcpy(paramPtr->transform.buf, bytev, bytec);
} else {
paramPtr->transform.buf = NULL;
@@ -2805,11 +2805,11 @@ ForwardSetObjError(
ForwardParam *paramPtr,
Tcl_Obj *obj)
{
- int len;
+ size_t len;
const char *msgStr = TclGetStringFromObj(obj, &len);
len++;
- ForwardSetDynamicError(paramPtr, ckalloc(len));
+ ForwardSetDynamicError(paramPtr, Tcl_Alloc(len));
memcpy(paramPtr->base.msgStr, msgStr, len);
}
#endif /* TCL_THREADS */
@@ -2954,7 +2954,7 @@ ResultClear(
return;
}
- ckfree(rPtr->buf);
+ Tcl_Free(rPtr->buf);
rPtr->buf = NULL;
rPtr->allocated = 0;
}
@@ -2989,10 +2989,10 @@ ResultAdd(
if (rPtr->allocated == 0) {
rPtr->allocated = toWrite + RB_INCREMENT;
- rPtr->buf = UCHARP(ckalloc(rPtr->allocated));
+ rPtr->buf = UCHARP(Tcl_Alloc(rPtr->allocated));
} else {
rPtr->allocated += toWrite + RB_INCREMENT;
- rPtr->buf = UCHARP(ckrealloc((char *) rPtr->buf,
+ rPtr->buf = UCHARP(Tcl_Realloc((char *) rPtr->buf,
rPtr->allocated));
}
}
@@ -3037,7 +3037,7 @@ ResultCopy(
*/
copied = 0;
- } else if (rPtr->used == toRead) {
+ } else if (rPtr->used == (size_t)toRead) {
/*
* We have just enough. Copy everything to the caller.
*/
@@ -3045,7 +3045,7 @@ ResultCopy(
memcpy(buf, rPtr->buf, toRead);
rPtr->used = 0;
copied = toRead;
- } else if (rPtr->used > toRead) {
+ } else if (rPtr->used > (size_t)toRead) {
/*
* The internal buffer contains more than requested. Copy the
* requested subset to the caller, and shift the remaining bytes down.
@@ -3080,7 +3080,7 @@ TransformRead(
Tcl_Obj *bufObj)
{
Tcl_Obj *resObj;
- int bytec; /* Number of returned bytes */
+ size_t bytec = 0; /* Number of returned bytes */
unsigned char *bytev; /* Array of returned bytes */
/*
@@ -3091,7 +3091,7 @@ TransformRead(
if (rtPtr->thread != Tcl_GetCurrentThread()) {
ForwardParam p;
- p.transform.buf = (char *) Tcl_GetByteArrayFromObj(bufObj,
+ p.transform.buf = (char *) TclGetByteArrayFromObj(bufObj,
&(p.transform.size));
ForwardOpToOwnerThread(rtPtr, ForwardedInput, &p);
@@ -3104,7 +3104,7 @@ TransformRead(
*errorCodePtr = EOK;
ResultAdd(&rtPtr->result, UCHARP(p.transform.buf), p.transform.size);
- ckfree(p.transform.buf);
+ Tcl_Free(p.transform.buf);
return 1;
}
#endif /* TCL_THREADS */
@@ -3119,7 +3119,7 @@ TransformRead(
return 0;
}
- bytev = Tcl_GetByteArrayFromObj(resObj, &bytec);
+ bytev = TclGetByteArrayFromObj(resObj, &bytec);
ResultAdd(&rtPtr->result, bytev, bytec);
Tcl_DecrRefCount(resObj); /* Remove reference held from invoke */
@@ -3135,7 +3135,7 @@ TransformWrite(
{
Tcl_Obj *bufObj;
Tcl_Obj *resObj;
- int bytec; /* Number of returned bytes */
+ size_t bytec = 0; /* Number of returned bytes */
unsigned char *bytev; /* Array of returned bytes */
int res;
@@ -3161,7 +3161,7 @@ TransformWrite(
*errorCodePtr = EOK;
res = Tcl_WriteRaw(rtPtr->parent, (char *) p.transform.buf,
p.transform.size);
- ckfree(p.transform.buf);
+ Tcl_Free(p.transform.buf);
} else
#endif /* TCL_THREADS */
{
@@ -3181,7 +3181,7 @@ TransformWrite(
*errorCodePtr = EOK;
- bytev = Tcl_GetByteArrayFromObj(resObj, &bytec);
+ bytev = TclGetByteArrayFromObj(resObj, &bytec);
res = Tcl_WriteRaw(rtPtr->parent, (char *) bytev, bytec);
Tcl_DecrRefCount(bufObj);
@@ -3202,7 +3202,7 @@ TransformDrain(
int *errorCodePtr)
{
Tcl_Obj *resObj;
- int bytec; /* Number of returned bytes */
+ size_t bytec = 0; /* Number of returned bytes */
unsigned char *bytev; /* Array of returned bytes */
/*
@@ -3223,7 +3223,7 @@ TransformDrain(
*errorCodePtr = EOK;
ResultAdd(&rtPtr->result, UCHARP(p.transform.buf), p.transform.size);
- ckfree(p.transform.buf);
+ Tcl_Free(p.transform.buf);
} else
#endif /* TCL_THREADS */
{
@@ -3234,7 +3234,7 @@ TransformDrain(
return 0;
}
- bytev = Tcl_GetByteArrayFromObj(resObj, &bytec);
+ bytev = TclGetByteArrayFromObj(resObj, &bytec);
ResultAdd(&rtPtr->result, bytev, bytec);
Tcl_DecrRefCount(resObj); /* Remove reference held from invoke */
@@ -3251,7 +3251,7 @@ TransformFlush(
int op)
{
Tcl_Obj *resObj;
- int bytec; /* Number of returned bytes */
+ size_t bytec = 0; /* Number of returned bytes */
unsigned char *bytev; /* Array of returned bytes */
int res;
@@ -3278,7 +3278,7 @@ TransformFlush(
} else {
res = 0;
}
- ckfree(p.transform.buf);
+ Tcl_Free(p.transform.buf);
} else
#endif /* TCL_THREADS */
{
@@ -3290,7 +3290,7 @@ TransformFlush(
}
if (op == FLUSH_WRITE) {
- bytev = Tcl_GetByteArrayFromObj(resObj, &bytec);
+ bytev = TclGetByteArrayFromObj(resObj, &bytec);
res = Tcl_WriteRaw(rtPtr->parent, (char *) bytev, bytec);
} else {
res = 0;
diff --git a/generic/tclIOSock.c b/generic/tclIOSock.c
index 12e2900..db124fb 100644
--- a/generic/tclIOSock.c
+++ b/generic/tclIOSock.c
@@ -223,7 +223,7 @@ TclCreateSocketAddress(
* using AI_ADDRCONFIG is probably low even in situations where it works,
* we'll leave it out for now. After all, it is just an optimisation.
*
- * Missing on: OpenBSD, NetBSD.
+ * Missing on NetBSD.
* Causes failure when used on AIX 5.1 and HP-UX
*/
diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c
index 3773159..21d7c67 100644
--- a/generic/tclIOUtil.c
+++ b/generic/tclIOUtil.c
@@ -457,7 +457,7 @@ FsThrExitProc(
while (fsRecPtr != NULL) {
tmpFsRecPtr = fsRecPtr->nextPtr;
fsRecPtr->fsPtr = NULL;
- ckfree(fsRecPtr);
+ Tcl_Free(fsRecPtr);
fsRecPtr = tmpFsRecPtr;
}
tsdPtr->filesystemList = NULL;
@@ -539,7 +539,7 @@ TclFSCwdPointerEquals(
if (tsdPtr->cwdPathPtr == *pathPtrPtr) {
return 1;
} else {
- int len1, len2;
+ size_t len1, len2;
const char *str1, *str2;
str1 = TclGetStringFromObj(tsdPtr->cwdPathPtr, &len1);
@@ -596,7 +596,7 @@ FsRecacheFilesystemList(void)
list = NULL;
fsRecPtr = tmpFsRecPtr;
while (fsRecPtr != NULL) {
- tmpFsRecPtr = ckalloc(sizeof(FilesystemRecord));
+ tmpFsRecPtr = Tcl_Alloc(sizeof(FilesystemRecord));
*tmpFsRecPtr = *fsRecPtr;
tmpFsRecPtr->nextPtr = list;
tmpFsRecPtr->prevPtr = NULL;
@@ -611,7 +611,7 @@ FsRecacheFilesystemList(void)
FilesystemRecord *next = toFree->nextPtr;
toFree->fsPtr = NULL;
- ckfree(toFree);
+ Tcl_Free(toFree);
toFree = next;
}
@@ -681,7 +681,7 @@ FsUpdateCwd(
Tcl_Obj *cwdObj,
ClientData clientData)
{
- int len;
+ size_t len = 0;
const char *str = NULL;
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&fsDataKey);
@@ -787,7 +787,7 @@ TclFinalizeFilesystem(void)
*/
if (fsRecPtr != &nativeFilesystemRecord) {
- ckfree(fsRecPtr);
+ Tcl_Free(fsRecPtr);
}
fsRecPtr = tmpFsRecPtr;
}
@@ -872,7 +872,7 @@ Tcl_FSRegister(
return TCL_ERROR;
}
- newFilesystemPtr = ckalloc(sizeof(FilesystemRecord));
+ newFilesystemPtr = Tcl_Alloc(sizeof(FilesystemRecord));
newFilesystemPtr->clientData = clientData;
newFilesystemPtr->fsPtr = fsPtr;
@@ -975,7 +975,7 @@ Tcl_FSUnregister(
++theFilesystemEpoch;
}
- ckfree(fsRecPtr);
+ Tcl_Free(fsRecPtr);
retVal = TCL_OK;
} else {
@@ -1203,7 +1203,7 @@ FsAddMountsToGlobResult(
}
if (!found && dir) {
Tcl_Obj *norm;
- int len, mlen;
+ size_t len, mlen;
/*
* We know mElt is absolute normalized and lies inside pathPtr, so
@@ -1390,7 +1390,7 @@ TclFSNormalizeToUniquePath(
{
FilesystemRecord *fsRecPtr, *firstFsRecPtr;
- int i;
+ size_t i;
int isVfsPath = 0;
const char *path;
@@ -1403,7 +1403,7 @@ TclFSNormalizeToUniquePath(
* We check these first to avoid useless calls to the native filesystem's
* normalizePathProc.
*/
- path = Tcl_GetStringFromObj(pathPtr, &i);
+ path = TclGetStringFromObj(pathPtr, &i);
if ( (i >= 3) && ( (path[0] == '/' && path[1] == '/')
|| (path[0] == '\\' && path[1] == '\\') ) ) {
@@ -1667,7 +1667,7 @@ TclGetOpenModeEx(
"access mode \"%s\" not supported by this system",
flag));
}
- ckfree(modeArgv);
+ Tcl_Free((void *)modeArgv);
return -1;
#endif
@@ -1680,7 +1680,7 @@ TclGetOpenModeEx(
"access mode \"%s\" not supported by this system",
flag));
}
- ckfree(modeArgv);
+ Tcl_Free((void *)modeArgv);
return -1;
#endif
@@ -1696,12 +1696,12 @@ TclGetOpenModeEx(
"RDWR, APPEND, BINARY, CREAT, EXCL, NOCTTY, NONBLOCK,"
" or TRUNC", flag));
}
- ckfree(modeArgv);
+ Tcl_Free((void *)modeArgv);
return -1;
}
}
- ckfree(modeArgv);
+ Tcl_Free((void *)modeArgv);
if (!gotRW) {
if (interp != NULL) {
@@ -1752,7 +1752,8 @@ Tcl_FSEvalFileEx(
const char *encodingName) /* If non-NULL, then use this encoding for the
* file. NULL means use the system encoding. */
{
- int length, result = TCL_ERROR;
+ size_t length;
+ int result = TCL_ERROR;
Tcl_StatBuf statBuf;
Tcl_Obj *oldScriptFile;
Interp *iPtr;
@@ -1768,14 +1769,14 @@ Tcl_FSEvalFileEx(
Tcl_SetErrno(errno);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"couldn't read file \"%s\": %s",
- Tcl_GetString(pathPtr), Tcl_PosixError(interp)));
+ TclGetString(pathPtr), Tcl_PosixError(interp)));
return result;
}
chan = Tcl_FSOpenFileChannel(interp, pathPtr, "r", 0644);
if (chan == NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"couldn't read file \"%s\": %s",
- Tcl_GetString(pathPtr), Tcl_PosixError(interp)));
+ TclGetString(pathPtr), Tcl_PosixError(interp)));
return result;
}
@@ -1811,10 +1812,10 @@ Tcl_FSEvalFileEx(
Tcl_Close(interp, chan);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"couldn't read file \"%s\": %s",
- Tcl_GetString(pathPtr), Tcl_PosixError(interp)));
+ TclGetString(pathPtr), Tcl_PosixError(interp)));
goto end;
}
- string = Tcl_GetString(objPtr);
+ string = TclGetString(objPtr);
/*
* If first character is not a BOM, append the remaining characters,
@@ -1826,7 +1827,7 @@ Tcl_FSEvalFileEx(
Tcl_Close(interp, chan);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"couldn't read file \"%s\": %s",
- Tcl_GetString(pathPtr), Tcl_PosixError(interp)));
+ TclGetString(pathPtr), Tcl_PosixError(interp)));
goto end;
}
@@ -1866,12 +1867,12 @@ Tcl_FSEvalFileEx(
*/
const char *pathString = TclGetStringFromObj(pathPtr, &length);
- int limit = 150;
+ unsigned limit = 150;
int overflow = (length > limit);
Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
"\n (file \"%.*s%s\" line %d)",
- (overflow ? limit : length), pathString,
+ (overflow ? limit : (unsigned)length), pathString,
(overflow ? "..." : ""), Tcl_GetErrorLine(interp)));
}
@@ -1902,17 +1903,17 @@ TclNREvalFile(
Tcl_SetErrno(errno);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"couldn't read file \"%s\": %s",
- Tcl_GetString(pathPtr), Tcl_PosixError(interp)));
+ TclGetString(pathPtr), Tcl_PosixError(interp)));
return TCL_ERROR;
}
chan = Tcl_FSOpenFileChannel(interp, pathPtr, "r", 0644);
if (chan == NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"couldn't read file \"%s\": %s",
- Tcl_GetString(pathPtr), Tcl_PosixError(interp)));
+ TclGetString(pathPtr), Tcl_PosixError(interp)));
return TCL_ERROR;
}
- TclPkgFileSeen(interp, Tcl_GetString(pathPtr));
+ TclPkgFileSeen(interp, TclGetString(pathPtr));
/*
* The eofchar is \32 (^Z). This is the usual on Windows, but we effect
@@ -1946,11 +1947,11 @@ TclNREvalFile(
Tcl_Close(interp, chan);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"couldn't read file \"%s\": %s",
- Tcl_GetString(pathPtr), Tcl_PosixError(interp)));
+ TclGetString(pathPtr), Tcl_PosixError(interp)));
Tcl_DecrRefCount(objPtr);
return TCL_ERROR;
}
- string = Tcl_GetString(objPtr);
+ string = TclGetString(objPtr);
/*
* If first character is not a BOM, append the remaining characters,
@@ -1962,7 +1963,7 @@ TclNREvalFile(
Tcl_Close(interp, chan);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"couldn't read file \"%s\": %s",
- Tcl_GetString(pathPtr), Tcl_PosixError(interp)));
+ TclGetString(pathPtr), Tcl_PosixError(interp)));
Tcl_DecrRefCount(objPtr);
return TCL_ERROR;
}
@@ -2016,14 +2017,14 @@ EvalFileCallback(
* Record information telling where the error occurred.
*/
- int length;
+ size_t length;
const char *pathString = TclGetStringFromObj(pathPtr, &length);
- const int limit = 150;
+ const unsigned int limit = 150;
int overflow = (length > limit);
Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
"\n (file \"%.*s%s\" line %d)",
- (overflow ? limit : length), pathString,
+ (overflow ? limit : (unsigned int)length), pathString,
(overflow ? "..." : ""), Tcl_GetErrorLine(interp)));
}
@@ -2300,7 +2301,7 @@ Tcl_FSOpenFileChannel(
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"could not seek to end of file while opening \"%s\": %s",
- Tcl_GetString(pathPtr), Tcl_PosixError(interp)));
+ TclGetString(pathPtr), Tcl_PosixError(interp)));
}
Tcl_Close(NULL, retVal);
return NULL;
@@ -2319,7 +2320,7 @@ Tcl_FSOpenFileChannel(
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"couldn't open \"%s\": %s",
- Tcl_GetString(pathPtr), Tcl_PosixError(interp)));
+ TclGetString(pathPtr), Tcl_PosixError(interp)));
}
return NULL;
}
@@ -2867,7 +2868,7 @@ Tcl_FSGetCwd(
* bug when trying to normalize tsdPtr->cwdPathPtr.
*/
- int len1, len2;
+ size_t len1, len2;
const char *str1, *str2;
str1 = TclGetStringFromObj(tsdPtr->cwdPathPtr, &len1);
@@ -3227,7 +3228,7 @@ skipUnlink(
#ifndef AUFS_SUPER_MAGIC
#define AUFS_SUPER_MAGIC ('a' << 24 | 'u' << 16 | 'f' << 8 | 's')
#endif /* AUFS_SUPER_MAGIC */
- if ((statfs(Tcl_GetString(shlibFile), &fs) == 0)
+ if ((statfs(TclGetString(shlibFile), &fs) == 0)
&& (fs.f_type == AUFS_SUPER_MAGIC)) {
return 1;
}
@@ -3303,7 +3304,7 @@ Tcl_LoadFile(
if (interp) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"couldn't load library \"%s\": %s",
- Tcl_GetString(pathPtr), Tcl_PosixError(interp)));
+ TclGetString(pathPtr), Tcl_PosixError(interp)));
}
return TCL_ERROR;
}
@@ -3466,7 +3467,7 @@ Tcl_LoadFile(
* unload and cleanup the temporary file correctly.
*/
- tvdlPtr = ckalloc(sizeof(FsDivertLoad));
+ tvdlPtr = Tcl_Alloc(sizeof(FsDivertLoad));
/*
* Remember three pieces of information. This allows us to cleanup the
@@ -3512,7 +3513,7 @@ Tcl_LoadFile(
copyToPtr = NULL;
- divertedLoadHandle = ckalloc(sizeof(struct Tcl_LoadHandle_));
+ divertedLoadHandle = Tcl_Alloc(sizeof(struct Tcl_LoadHandle_));
divertedLoadHandle->clientData = tvdlPtr;
divertedLoadHandle->findSymbolProcPtr = DivertFindSymbol;
divertedLoadHandle->unloadFileProcPtr = DivertUnloadFile;
@@ -3658,8 +3659,8 @@ DivertUnloadFile(
Tcl_DecrRefCount(tvdlPtr->divertedFile);
}
- ckfree(tvdlPtr);
- ckfree(loadHandle);
+ Tcl_Free(tvdlPtr);
+ Tcl_Free(loadHandle);
}
/*
@@ -3808,7 +3809,7 @@ TclFSUnloadTempFile(
Tcl_DecrRefCount(tvdlPtr->divertedFile);
}
- ckfree(tvdlPtr);
+ Tcl_Free(tvdlPtr);
}
/*
@@ -4033,7 +4034,7 @@ Tcl_FSSplitPath(
if (sep != NULL) {
Tcl_IncrRefCount(sep);
- separator = Tcl_GetString(sep)[0];
+ separator = TclGetString(sep)[0];
Tcl_DecrRefCount(sep);
}
}
@@ -4045,7 +4046,7 @@ Tcl_FSSplitPath(
*/
result = Tcl_NewObj();
- p = Tcl_GetString(pathPtr);
+ p = TclGetString(pathPtr);
Tcl_ListObjAppendElement(NULL, result,
Tcl_NewStringObj(p, driveNameLength));
p += driveNameLength;
@@ -4122,7 +4123,7 @@ TclGetPathType(
* path, already with a refCount for the
* caller. */
{
- int pathLen;
+ size_t pathLen;
const char *path = TclGetStringFromObj(pathPtr, &pathLen);
Tcl_PathType type;
@@ -4230,16 +4231,16 @@ TclFSNonnativePathType(
}
while (numVolumes > 0) {
Tcl_Obj *vol;
- int len;
+ size_t len;
const char *strVol;
numVolumes--;
Tcl_ListObjIndex(NULL, thisFsVolumes, numVolumes, &vol);
strVol = TclGetStringFromObj(vol,&len);
- if (pathLen < len) {
+ if ((size_t) 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;
@@ -4578,14 +4579,14 @@ Tcl_FSRemoveDirectory(
if (cwdPtr != NULL) {
const char *cwdStr, *normPathStr;
- int cwdLen, normLen;
+ size_t cwdLen, normLen;
Tcl_Obj *normPath = Tcl_FSGetNormalizedPath(NULL, pathPtr);
if (normPath != NULL) {
normPathStr = TclGetStringFromObj(normPath, &normLen);
cwdStr = TclGetStringFromObj(cwdPtr, &cwdLen);
if ((cwdLen >= normLen) && (strncmp(normPathStr, cwdStr,
- (size_t) normLen) == 0)) {
+ normLen) == 0)) {
/*
* The cwd is inside the directory, so we perform a 'cd
* [file dirname $path]'.
@@ -4749,7 +4750,7 @@ static void
NativeFreeInternalRep(
ClientData clientData)
{
- ckfree(clientData);
+ Tcl_Free(clientData);
}
/*
diff --git a/generic/tclIndexObj.c b/generic/tclIndexObj.c
index 919db92..e566f57 100644
--- a/generic/tclIndexObj.c
+++ b/generic/tclIndexObj.c
@@ -61,8 +61,8 @@ static const Tcl_ObjType indexType = {
typedef struct {
void *tablePtr; /* Pointer to the table of strings */
- int offset; /* Offset between table entries */
- int index; /* Selected index into table. */
+ size_t offset; /* Offset between table entries */
+ size_t index; /* Selected index into table. */
} IndexRep;
/*
@@ -79,75 +79,6 @@ typedef struct {
/*
*----------------------------------------------------------------------
*
- * Tcl_GetIndexFromObj --
- *
- * This function looks up an object's value in a table of strings and
- * returns the index of the matching string, if any.
- *
- * Results:
- * If the value of objPtr is identical to or a unique abbreviation for
- * one of the entries in tablePtr, then the return value is TCL_OK and the
- * index of the matching entry is stored at *indexPtr. If there isn't a
- * proper match, then TCL_ERROR is returned and an error message is left
- * in interp's result (unless interp is NULL). The msg argument is used
- * in the error message; for example, if msg has the value "option" then
- * the error message will say something flag 'bad option "foo": must be
- * ...'
- *
- * Side effects:
- * The result of the lookup is cached as the internal rep of objPtr, so
- * that repeated lookups can be done quickly.
- *
- *----------------------------------------------------------------------
- */
-
-#ifndef TCL_NO_DEPRECATED
-#undef Tcl_GetIndexFromObj
-int
-Tcl_GetIndexFromObj(
- Tcl_Interp *interp, /* Used for error reporting if not NULL. */
- Tcl_Obj *objPtr, /* Object containing the string to lookup. */
- const char *const*tablePtr, /* Array of strings to compare against the
- * value of objPtr; last entry must be NULL
- * and there must not be duplicate entries. */
- const char *msg, /* Identifying word to use in error
- * messages. */
- int flags, /* 0 or TCL_EXACT */
- int *indexPtr) /* Place to store resulting integer index. */
-{
- if (!(flags & INDEX_TEMP_TABLE)) {
-
- /*
- * See if there is a valid cached result from a previous lookup (doing the
- * check here saves the overhead of calling Tcl_GetIndexFromObjStruct in
- * the common case where the result is cached).
- */
-
- const Tcl_ObjIntRep *irPtr = TclFetchIntRep(objPtr, &indexType);
-
- if (irPtr) {
- IndexRep *indexRep = irPtr->twoPtrValue.ptr1;
-
- /*
- * Here's hoping we don't get hit by unfortunate packing constraints
- * on odd platforms like a Cray PVP...
- */
-
- if (indexRep->tablePtr == (void *) tablePtr
- && indexRep->offset == sizeof(char *)) {
- *indexPtr = indexRep->index;
- return TCL_OK;
- }
- }
- }
- return Tcl_GetIndexFromObjStruct(interp, objPtr, tablePtr, sizeof(char *),
- msg, flags, indexPtr);
-}
-#endif /* TCL_NO_DEPRECATED */
-
-/*
- *----------------------------------------------------------------------
- *
* GetIndexFromObjList --
*
* This procedure looks up an object's value in a table of strings and
@@ -200,26 +131,26 @@ GetIndexFromObjList(
* Build a string table from the list.
*/
- tablePtr = ckalloc((objc + 1) * sizeof(char *));
+ tablePtr = Tcl_Alloc((objc + 1) * sizeof(char *));
for (t = 0; t < objc; t++) {
if (objv[t] == objPtr) {
/*
* An exact match is always chosen, so we can stop here.
*/
- ckfree(tablePtr);
+ Tcl_Free((void *)tablePtr);
*indexPtr = t;
return TCL_OK;
}
- tablePtr[t] = Tcl_GetString(objv[t]);
+ tablePtr[t] = TclGetString(objv[t]);
}
tablePtr[objc] = NULL;
result = Tcl_GetIndexFromObjStruct(interp, objPtr, tablePtr,
sizeof(char *), msg, flags | INDEX_TEMP_TABLE, indexPtr);
- ckfree(tablePtr);
+ Tcl_Free((void *)tablePtr);
return result;
}
@@ -259,7 +190,7 @@ Tcl_GetIndexFromObjStruct(
* offset, the third plus the offset again,
* etc. The last entry must be NULL and there
* must not be duplicate entries. */
- int offset, /* The number of bytes between entries */
+ size_t offset, /* The number of bytes between entries */
const char *msg, /* Identifying word to use in error
* messages. */
int flags, /* 0 or TCL_EXACT */
@@ -274,8 +205,8 @@ Tcl_GetIndexFromObjStruct(
const Tcl_ObjIntRep *irPtr;
/* Protect against invalid values, like -1 or 0. */
- if (offset < (int)sizeof(char *)) {
- offset = (int)sizeof(char *);
+ if (offset+1 <= sizeof(char *)) {
+ offset = sizeof(char *);
}
/*
* See if there is a valid cached result from a previous lookup.
@@ -352,7 +283,7 @@ Tcl_GetIndexFromObjStruct(
} else {
Tcl_ObjIntRep ir;
- indexRep = ckalloc(sizeof(IndexRep));
+ indexRep = Tcl_Alloc(sizeof(IndexRep));
ir.twoPtrValue.ptr1 = indexRep;
Tcl_StoreIntRep(objPtr, &indexType, &ir);
}
@@ -487,7 +418,7 @@ DupIndex(
Tcl_Obj *dupPtr)
{
Tcl_ObjIntRep ir;
- IndexRep *dupIndexRep = ckalloc(sizeof(IndexRep));
+ IndexRep *dupIndexRep = Tcl_Alloc(sizeof(IndexRep));
memcpy(dupIndexRep, TclFetchIntRep(srcPtr, &indexType)->twoPtrValue.ptr1,
sizeof(IndexRep));
@@ -517,7 +448,7 @@ static void
FreeIndex(
Tcl_Obj *objPtr)
{
- ckfree(TclFetchIntRep(objPtr, &indexType)->twoPtrValue.ptr1);
+ Tcl_Free(TclFetchIntRep(objPtr, &indexType)->twoPtrValue.ptr1);
objPtr->typePtr = NULL;
}
@@ -613,7 +544,7 @@ PrefixMatchObjCmd(
return TCL_ERROR;
}
i++;
- message = Tcl_GetString(objv[i]);
+ message = TclGetString(objv[i]);
break;
case PRFMATCH_ERROR:
if (i > objc-4) {
@@ -703,7 +634,8 @@ PrefixAllObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- int tableObjc, result, t, length, elemLength;
+ int tableObjc, result, t;
+ size_t length, elemLength;
const char *string, *elemString;
Tcl_Obj **tableObjv, *resultPtr;
@@ -760,7 +692,8 @@ PrefixLongestObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- int tableObjc, result, i, t, length, elemLength, resultLength;
+ int tableObjc, result, t;
+ size_t i, length, elemLength, resultLength;
const char *string, *elemString, *resultString;
Tcl_Obj **tableObjv;
@@ -883,34 +816,12 @@ Tcl_WrongNumArgs(
* NULL. */
{
Tcl_Obj *objPtr;
- int i, len, elemLen;
+ int i;
+ size_t len, elemLen;
char flags;
Interp *iPtr = (Interp *) interp;
const char *elementStr;
- /*
- * [incr Tcl] does something fairly horrific when generating error
- * messages for its ensembles; it passes the whole set of ensemble
- * arguments as a list in the first argument. This means that this code
- * causes a problem in iTcl if it attempts to correctly quote all
- * arguments, which would be the correct thing to do. We work around this
- * nasty behaviour for now, and hope that we can remove it all in the
- * future...
- */
-
-#ifndef AVOID_HACKS_FOR_ITCL
- int isFirst = 1; /* Special flag used to inhibit the treating
- * of the first word as a list element so the
- * hacky way Itcl generates error messages for
- * its ensembles will still work. [Bug
- * 1066837] */
-# define MAY_QUOTE_WORD (!isFirst)
-# define AFTER_FIRST_WORD (isFirst = 0)
-#else /* !AVOID_HACKS_FOR_ITCL */
-# define MAY_QUOTE_WORD 1
-# define AFTER_FIRST_WORD (void) 0
-#endif /* AVOID_HACKS_FOR_ITCL */
-
TclNewObj(objPtr);
if (iPtr->flags & INTERP_ALTERNATE_WRONG_ARGS) {
iPtr->flags &= ~INTERP_ALTERNATE_WRONG_ARGS;
@@ -977,7 +888,7 @@ Tcl_WrongNumArgs(
flags = 0;
len = TclScanElement(elementStr, elemLen, &flags);
- if (MAY_QUOTE_WORD && len != elemLen) {
+ if (len != elemLen) {
char *quotedElementStr = TclStackAlloc(interp, len + 1);
len = TclConvertElement(elementStr, elemLen,
@@ -988,8 +899,6 @@ Tcl_WrongNumArgs(
Tcl_AppendToObj(objPtr, elementStr, elemLen);
}
- AFTER_FIRST_WORD;
-
/*
* Add a space if the word is not the last one (which has a
* moderately complex condition here).
@@ -1028,7 +937,7 @@ Tcl_WrongNumArgs(
flags = 0;
len = TclScanElement(elementStr, elemLen, &flags);
- if (MAY_QUOTE_WORD && len != elemLen) {
+ if (len != elemLen) {
char *quotedElementStr = TclStackAlloc(interp, len + 1);
len = TclConvertElement(elementStr, elemLen,
@@ -1040,8 +949,6 @@ Tcl_WrongNumArgs(
}
}
- AFTER_FIRST_WORD;
-
/*
* Append a space character (" ") if there is more text to follow
* (either another element from objv, or the message string).
@@ -1064,8 +971,6 @@ Tcl_WrongNumArgs(
Tcl_AppendStringsToObj(objPtr, "\"", NULL);
Tcl_SetErrorCode(interp, "TCL", "WRONGARGS", NULL);
Tcl_SetObjResult(interp, objPtr);
-#undef MAY_QUOTE_WORD
-#undef AFTER_FIRST_WORD
}
/*
@@ -1124,7 +1029,7 @@ Tcl_ParseArgsObjv(
* being processed, primarily for error
* reporting. */
int objc; /* # arguments in objv still to process. */
- int length; /* Number of characters in current argument */
+ size_t length; /* Number of characters in current argument */
if (remObjv != NULL) {
/*
@@ -1135,7 +1040,7 @@ Tcl_ParseArgsObjv(
*/
nrem = 1;
- leftovers = ckalloc((1 + *objcPtr) * sizeof(Tcl_Obj *));
+ leftovers = Tcl_Alloc((1 + *objcPtr) * sizeof(Tcl_Obj *));
leftovers[0] = objv[0];
} else {
nrem = 0;
@@ -1221,7 +1126,7 @@ Tcl_ParseArgsObjv(
(int *) infoPtr->dstPtr) == TCL_ERROR) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"expected integer argument for \"%s\" but got \"%s\"",
- infoPtr->keyStr, Tcl_GetString(objv[srcIndex])));
+ infoPtr->keyStr, TclGetString(objv[srcIndex])));
goto error;
}
srcIndex++;
@@ -1232,7 +1137,7 @@ Tcl_ParseArgsObjv(
goto missingArg;
}
*((const char **) infoPtr->dstPtr) =
- Tcl_GetString(objv[srcIndex]);
+ TclGetString(objv[srcIndex]);
srcIndex++;
objc--;
break;
@@ -1254,7 +1159,7 @@ Tcl_ParseArgsObjv(
(double *) infoPtr->dstPtr) == TCL_ERROR) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"expected floating-point argument for \"%s\" but got \"%s\"",
- infoPtr->keyStr, Tcl_GetString(objv[srcIndex])));
+ infoPtr->keyStr, TclGetString(objv[srcIndex])));
goto error;
}
srcIndex++;
@@ -1319,7 +1224,7 @@ Tcl_ParseArgsObjv(
}
leftovers[nrem] = NULL;
*objcPtr = nrem++;
- *remObjv = ckrealloc(leftovers, nrem * sizeof(Tcl_Obj *));
+ *remObjv = Tcl_Realloc(leftovers, nrem * sizeof(Tcl_Obj *));
return TCL_OK;
/*
@@ -1332,7 +1237,7 @@ Tcl_ParseArgsObjv(
"\"%s\" option requires an additional argument", str));
error:
if (leftovers != NULL) {
- ckfree(leftovers);
+ Tcl_Free(leftovers);
}
return TCL_ERROR;
}
@@ -1376,13 +1281,13 @@ PrintUsage(
width = 4;
for (infoPtr = argTable; infoPtr->type != TCL_ARGV_END; infoPtr++) {
- int length;
+ size_t length;
if (infoPtr->keyStr == NULL) {
continue;
}
length = strlen(infoPtr->keyStr);
- if (length > width) {
+ if (length > (size_t)width) {
width = length;
}
}
diff --git a/generic/tclInt.decls b/generic/tclInt.decls
index 556da28..bcdea6c 100644
--- a/generic/tclInt.decls
+++ b/generic/tclInt.decls
@@ -48,12 +48,13 @@ declare 6 {
void TclCleanupCommand(Command *cmdPtr)
}
declare 7 {
- int TclCopyAndCollapse(int count, const char *src, char *dst)
-}
-declare 8 {deprecated {}} {
- int TclCopyChannelOld(Tcl_Interp *interp, Tcl_Channel inChan,
- Tcl_Channel outChan, int toRead, Tcl_Obj *cmdPtr)
+ size_t TclCopyAndCollapse(size_t count, const char *src, char *dst)
}
+# Removed in 9.0:
+#declare 8 {
+# int TclCopyChannelOld(Tcl_Interp *interp, Tcl_Channel inChan,
+# Tcl_Channel outChan, int toRead, Tcl_Obj *cmdPtr)
+#}
# TclCreatePipeline unofficially exported for use by BLT.
@@ -79,7 +80,7 @@ declare 12 {
# Tcl_DString *headPtr, char *tail, Tcl_GlobTypeData *types)
#}
declare 14 {
- int TclDumpMemoryInfo(ClientData clientData, int flags)
+ int TclDumpMemoryInfo(void *clientData, int flags)
}
# Removed in 8.1:
# declare 15 {
@@ -107,14 +108,14 @@ declare 16 {
declare 22 {
int TclFindElement(Tcl_Interp *interp, const char *listStr,
int listLength, const char **elementPtr, const char **nextPtr,
- int *sizePtr, int *bracePtr)
+ size_t *sizePtr, int *bracePtr)
}
declare 23 {
Proc *TclFindProc(Interp *iPtr, const char *procName)
}
# Replaced with macro (see tclInt.h) in Tcl 8.5.0, restored in 8.5.10
declare 24 {
- int TclFormatInt(char *buffer, Tcl_WideInt n)
+ size_t TclFormatInt(char *buffer, Tcl_WideInt n)
}
declare 25 {
void TclFreePackageInfo(Interp *iPtr)
@@ -151,10 +152,11 @@ declare 32 {
#declare 33 {
# TclCmdProcType TclGetInterpProc(void)
#}
-declare 34 {deprecated {Use Tcl_GetIntForIndex}} {
- int TclGetIntForIndex(Tcl_Interp *interp, Tcl_Obj *objPtr,
- int endValue, int *indexPtr)
-}
+# Removed in 9.0:
+#declare 34 {deprecated {Use Tcl_GetIntForIndex}} {
+# int TclGetIntForIndex(Tcl_Interp *interp, Tcl_Obj *objPtr,
+# int endValue, int *indexPtr)
+#}
# Removed in 8.4b2:
#declare 35 {
# Tcl_Obj *TclGetIndexedScalar(Tcl_Interp *interp, int localIndex,
@@ -183,7 +185,7 @@ declare 41 {
Tcl_Command TclGetOriginalCommand(Tcl_Command command)
}
declare 42 {
- CONST86 char *TclpGetUserHome(const char *name, Tcl_DString *bufferPtr)
+ const char *TclpGetUserHome(const char *name, Tcl_DString *bufferPtr)
}
# Removed in 8.5a2:
#declare 43 {
@@ -226,11 +228,11 @@ declare 51 {
# int flags)
#}
declare 53 {
- int TclInvokeObjectCommand(ClientData clientData, Tcl_Interp *interp,
+ int TclInvokeObjectCommand(void *clientData, Tcl_Interp *interp,
int argc, const char **argv)
}
declare 54 {
- int TclInvokeStringCommand(ClientData clientData, Tcl_Interp *interp,
+ int TclInvokeStringCommand(void *clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[])
}
declare 55 {
@@ -266,7 +268,7 @@ declare 62 {
int TclObjCommandComplete(Tcl_Obj *cmdPtr)
}
declare 63 {
- int TclObjInterpProc(ClientData clientData, Tcl_Interp *interp,
+ int TclObjInterpProc(void *clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[])
}
declare 64 {
@@ -289,7 +291,7 @@ declare 64 {
# int TclpAccess(const char *path, int mode)
#}
declare 69 {
- char *TclpAlloc(unsigned int size)
+ void *TclpAlloc(size_t size)
}
#declare 70 {
# int TclpCopyFile(const char *source, const char *dest)
@@ -305,17 +307,19 @@ declare 69 {
# int TclpDeleteFile(const char *path)
#}
declare 74 {
- void TclpFree(char *ptr)
+ void TclpFree(void *ptr)
}
declare 75 {
- unsigned long TclpGetClicks(void)
+ Tcl_WideUInt TclpGetClicks(void)
}
declare 76 {
- unsigned long TclpGetSeconds(void)
-}
-declare 77 {deprecated {}} {
- void TclpGetTime(Tcl_Time *time)
+ Tcl_WideUInt TclpGetSeconds(void)
}
+
+# Removed in 9.0:
+#declare 77 {
+# void TclpGetTime(Tcl_Time *time)
+#}
# Removed in 8.6:
#declare 78 {
# int TclpGetTimeZone(unsigned long time)
@@ -330,7 +334,7 @@ declare 77 {deprecated {}} {
# char *modeString, int permissions)
#}
declare 81 {
- char *TclpRealloc(char *ptr, unsigned int size)
+ void *TclpRealloc(void *ptr, size_t size)
}
#declare 82 {
# int TclpRemoveDirectory(const char *path, int recursive,
@@ -355,10 +359,11 @@ declare 81 {
# declare 87 {
# void TclPlatformInit(Tcl_Interp *interp)
# }
-declare 88 {deprecated {}} {
- char *TclPrecTraceProc(ClientData clientData, Tcl_Interp *interp,
- const char *name1, const char *name2, int flags)
-}
+# Removed in 9.0:
+#declare 88 {
+# char *TclPrecTraceProc(void *clientData, Tcl_Interp *interp,
+# const char *name1, const char *name2, int flags)
+#}
declare 89 {
int TclPreventAliasLoop(Tcl_Interp *interp, Tcl_Interp *cmdInterp,
Tcl_Command cmd)
@@ -376,11 +381,11 @@ declare 92 {
const char *procName)
}
declare 93 {
- void TclProcDeleteProc(ClientData clientData)
+ void TclProcDeleteProc(void *clientData)
}
# Removed in 8.5:
#declare 94 {
-# int TclProcInterpProc(ClientData clientData, Tcl_Interp *interp,
+# int TclProcInterpProc(void *clientData, Tcl_Interp *interp,
# int argc, const char **argv)
#}
# Replaced by Tcl_FSStat in 8.4:
@@ -408,7 +413,7 @@ declare 98 {
# Tcl_Obj *objPtr, int flags)
#}
declare 101 {
- CONST86 char *TclSetPreInitScript(const char *string)
+ const char *TclSetPreInitScript(const char *string)
}
declare 102 {
void TclSetupEnv(Tcl_Interp *interp)
@@ -417,9 +422,10 @@ declare 103 {
int TclSockGetPort(Tcl_Interp *interp, const char *str, const char *proto,
int *portPtr)
}
-declare 104 {deprecated {}} {
- int TclSockMinimumBuffersOld(int sock, int size)
-}
+# Removed in 9.0:
+#declare 104 {
+# int TclSockMinimumBuffersOld(int sock, int size)
+#}
# Replaced by Tcl_FSStat in 8.4:
#declare 105 {
# int TclStat(const char *path, Tcl_StatBuf *buf)
@@ -452,29 +458,35 @@ declare 111 {
Tcl_ResolveCmdProc *cmdProc, Tcl_ResolveVarProc *varProc,
Tcl_ResolveCompiledVarProc *compiledVarProc)
}
-declare 112 {
- int TclAppendExportList(Tcl_Interp *interp, Tcl_Namespace *nsPtr,
- Tcl_Obj *objPtr)
-}
-declare 113 {
- Tcl_Namespace *TclCreateNamespace(Tcl_Interp *interp, const char *name,
- ClientData clientData, Tcl_NamespaceDeleteProc *deleteProc)
-}
-declare 114 {
- void TclDeleteNamespace(Tcl_Namespace *nsPtr)
-}
-declare 115 {
- int TclExport(Tcl_Interp *interp, Tcl_Namespace *nsPtr,
- const char *pattern, int resetListFirst)
-}
-declare 116 {
- Tcl_Command TclFindCommand(Tcl_Interp *interp, const char *name,
- Tcl_Namespace *contextNsPtr, int flags)
-}
-declare 117 {
- Tcl_Namespace *TclFindNamespace(Tcl_Interp *interp, const char *name,
- Tcl_Namespace *contextNsPtr, int flags)
-}
+# Removed in 9.0:
+#declare 112 {
+# int Tcl_AppendExportList(Tcl_Interp *interp, Tcl_Namespace *nsPtr,
+# Tcl_Obj *objPtr)
+#}
+# Removed in 9.0:
+#declare 113 {
+# Tcl_Namespace *Tcl_CreateNamespace(Tcl_Interp *interp, const char *name,
+# void *clientData, Tcl_NamespaceDeleteProc *deleteProc)
+#}
+# Removed in 9.0:
+#declare 114 {
+# void Tcl_DeleteNamespace(Tcl_Namespace *nsPtr)
+#}
+# Removed in 9.0:
+#declare 115 {
+# int Tcl_Export(Tcl_Interp *interp, Tcl_Namespace *nsPtr,
+# const char *pattern, int resetListFirst)
+#}
+# Removed in 9.0:
+#declare 116 {
+# Tcl_Command Tcl_FindCommand(Tcl_Interp *interp, const char *name,
+# Tcl_Namespace *contextNsPtr, int flags)
+#}
+# Removed in 9.0:
+#declare 117 {
+# Tcl_Namespace *Tcl_FindNamespace(Tcl_Interp *interp, const char *name,
+# Tcl_Namespace *contextNsPtr, int flags)
+#}
declare 118 {
int Tcl_GetInterpResolvers(Tcl_Interp *interp, const char *name,
Tcl_ResolverInfo *resInfo)
@@ -487,31 +499,37 @@ declare 120 {
Tcl_Var Tcl_FindNamespaceVar(Tcl_Interp *interp, const char *name,
Tcl_Namespace *contextNsPtr, int flags)
}
-declare 121 {
- int TclForgetImport(Tcl_Interp *interp, Tcl_Namespace *nsPtr,
- const char *pattern)
-}
-declare 122 {
- Tcl_Command TclGetCommandFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr)
-}
-declare 123 {
- void TclGetCommandFullName(Tcl_Interp *interp, Tcl_Command command,
- Tcl_Obj *objPtr)
-}
-declare 124 {
- Tcl_Namespace *TclGetCurrentNamespace_(Tcl_Interp *interp)
-}
-declare 125 {
- Tcl_Namespace *TclGetGlobalNamespace_(Tcl_Interp *interp)
-}
+# Removed in 9.0:
+#declare 121 {
+# int Tcl_ForgetImport(Tcl_Interp *interp, Tcl_Namespace *nsPtr,
+# const char *pattern)
+#}
+# Removed in 9.0:
+#declare 122 {
+# Tcl_Command Tcl_GetCommandFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr)
+#}
+# Removed in 9.0:
+#declare 123 {
+# void Tcl_GetCommandFullName(Tcl_Interp *interp, Tcl_Command command,
+# Tcl_Obj *objPtr)
+#}
+# Removed in 9.0:
+#declare 124 {
+# Tcl_Namespace *Tcl_GetCurrentNamespace(Tcl_Interp *interp)
+#}
+# Removed in 9.0:
+#declare 125 {
+# Tcl_Namespace *Tcl_GetGlobalNamespace(Tcl_Interp *interp)
+#}
declare 126 {
void Tcl_GetVariableFullName(Tcl_Interp *interp, Tcl_Var variable,
Tcl_Obj *objPtr)
}
-declare 127 {
- int TclImport(Tcl_Interp *interp, Tcl_Namespace *nsPtr,
- const char *pattern, int allowOverwrite)
-}
+# Removed in 9.0:
+#declare 127 {
+# int Tcl_Import(Tcl_Interp *interp, Tcl_Namespace *nsPtr,
+# const char *pattern, int allowOverwrite)
+#}
declare 128 {
void Tcl_PopCallFrame(Tcl_Interp *interp)
}
@@ -530,9 +548,10 @@ declare 131 {
declare 132 {
int TclpHasSockets(Tcl_Interp *interp)
}
-declare 133 {deprecated {}} {
- struct tm *TclpGetDate(const time_t *time, int useGMT)
-}
+# Removed in 9.0
+#declare 133 {
+# struct tm *TclpGetDate(const time_t *time, int useGMT)
+#}
# Removed in 8.5
#declare 134 {
# size_t TclpStrftime(char *s, size_t maxsize, const char *format,
@@ -553,7 +572,7 @@ declare 138 {
#declare 139 {
# int TclpLoadFile(Tcl_Interp *interp, char *fileName, char *sym1,
# char *sym2, Tcl_PackageInitProc **proc1Ptr,
-# Tcl_PackageInitProc **proc2Ptr, ClientData *clientDataPtr)
+# Tcl_PackageInitProc **proc2Ptr, void **clientDataPtr)
#}
#declare 140 {
# int TclLooksLikeInt(const char *bytes, int length)
@@ -564,7 +583,7 @@ declare 141 {
}
declare 142 {
int TclSetByteCodeFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr,
- CompileHookProc *hookProc, ClientData clientData)
+ CompileHookProc *hookProc, void *clientData)
}
declare 143 {
int TclAddLiteralObj(struct CompileEnv *envPtr, Tcl_Obj *objPtr,
@@ -596,8 +615,8 @@ declare 150 {
int TclRegAbout(Tcl_Interp *interp, Tcl_RegExp re)
}
declare 151 {
- void TclRegExpRangeUniChar(Tcl_RegExp re, int index, int *startPtr,
- int *endPtr)
+ void TclRegExpRangeUniChar(Tcl_RegExp re, size_t index, size_t *startPtr,
+ size_t *endPtr)
}
declare 152 {
void TclSetLibraryPath(Tcl_Obj *pathPtr)
@@ -608,11 +627,11 @@ declare 153 {
# moved to tclTest.c (static) in 8.3.2/8.4a2
#declare 154 {
-# int TclTestChannelCmd(ClientData clientData,
+# int TclTestChannelCmd(void *clientData,
# Tcl_Interp *interp, int argc, char **argv)
#}
#declare 155 {
-# int TclTestChannelEventCmd(ClientData clientData,
+# int TclTestChannelEventCmd(void *clientData,
# Tcl_Interp *interp, int argc, char **argv)
#}
@@ -623,12 +642,14 @@ declare 156 {
declare 157 {
Var *TclVarTraceExists(Tcl_Interp *interp, const char *varName)
}
-declare 158 {deprecated {use public Tcl_SetStartupScript()}} {
- void TclSetStartupScriptFileName(const char *filename)
-}
-declare 159 {deprecated {use public Tcl_GetStartupScript()}} {
- const char *TclGetStartupScriptFileName(void)
-}
+# REMOVED - use public Tcl_SetStartupScript()
+#declare 158 {
+# void TclSetStartupScriptFileName(const char *filename)
+#}
+# REMOVED - use public Tcl_GetStartupScript()
+#declare 159 {
+# const char *TclGetStartupScriptFileName(void)
+#}
#declare 160 {
# int TclpMatchFilesTypes(Tcl_Interp *interp, char *separators,
# Tcl_DString *dirPtr, char *pattern, char *tail,
@@ -641,7 +662,7 @@ declare 161 {
Tcl_Obj *cmdObjPtr)
}
declare 162 {
- void TclChannelEventScriptInvoker(ClientData clientData, int flags)
+ void TclChannelEventScriptInvoker(void *clientData, int flags)
}
# ALERT: The result of 'TclGetInstructionTable' is actually a
@@ -672,24 +693,27 @@ declare 166 {
int index, Tcl_Obj *valuePtr)
}
-declare 167 {deprecated {use public Tcl_SetStartupScript()}} {
- void TclSetStartupScriptPath(Tcl_Obj *pathPtr)
-}
-declare 168 {deprecated {use public Tcl_GetStartupScript()}} {
- Tcl_Obj *TclGetStartupScriptPath(void)
-}
+# VFS-aware versions of Tcl*StartupScriptFileName (158 and 159 above)
+# REMOVED - use public Tcl_SetStartupScript()
+#declare 167 {
+# void TclSetStartupScriptPath(Tcl_Obj *pathPtr)
+#}
+# REMOVED - use public Tcl_GetStartupScript()
+#declare 168 {
+# Tcl_Obj *TclGetStartupScriptPath(void)
+#}
# variant of Tcl_UtfNCmp that takes n as bytes, not chars
declare 169 {
- int TclpUtfNcmp2(const char *s1, const char *s2, unsigned long n)
+ int TclpUtfNcmp2(const char *s1, const char *s2, size_t n)
}
declare 170 {
int TclCheckInterpTraces(Tcl_Interp *interp, const char *command,
- int numChars, Command *cmdPtr, int result, int traceFlags,
+ size_t numChars, Command *cmdPtr, int result, int traceFlags,
int objc, Tcl_Obj *const objv[])
}
declare 171 {
int TclCheckExecutionTraces(Tcl_Interp *interp, const char *command,
- int numChars, Command *cmdPtr, int result, int traceFlags,
+ size_t numChars, Command *cmdPtr, int result, int traceFlags,
int objc, Tcl_Obj *const objv[])
}
declare 172 {
@@ -699,8 +723,8 @@ declare 172 {
# added for 8.4.2
declare 173 {
- int TclUniCharMatch(const Tcl_UniChar *string, int strLen,
- const Tcl_UniChar *pattern, int ptnLen, int flags)
+ int TclUniCharMatch(const Tcl_UniChar *string, size_t strLen,
+ const Tcl_UniChar *pattern, size_t ptnLen, int flags)
}
# added for 8.4.3
@@ -723,12 +747,13 @@ declare 177 {
void TclVarErrMsg(Tcl_Interp *interp, const char *part1, const char *part2,
const char *operation, const char *reason)
}
-declare 178 {
- void TclSetStartupScript(Tcl_Obj *pathPtr, const char *encodingName)
-}
-declare 179 {
- Tcl_Obj *TclGetStartupScript(const char **encodingNamePtr)
-}
+# TIP 338 made these public - now declared in tcl.h
+#declare 178 {
+# void Tcl_SetStartupScript(Tcl_Obj *pathPtr, const char *encodingName)
+#}
+#declare 179 {
+# Tcl_Obj *Tcl_GetStartupScript(const char **encodingNamePtr)
+#}
# REMOVED
# Allocate lists without copying arrays
@@ -740,12 +765,14 @@ declare 179 {
# const char *file, int line)
#}
-declare 182 {deprecated {}} {
- struct tm *TclpLocaltime(const time_t *clock)
-}
-declare 183 {deprecated {}} {
- struct tm *TclpGmtime(const time_t *clock)
-}
+# Removed in 9.0
+#declare 182 {
+# struct tm *TclpLocaltime(const time_t *clock)
+#}
+# Removed in 9.0
+#declare 183 {
+# struct tm *TclpGmtime(const time_t *clock)
+#}
# For the new "Thread Storage" subsystem.
@@ -860,7 +887,7 @@ declare 214 {
void TclSetObjNameOfExecutable(Tcl_Obj *name, Tcl_Encoding encoding)
}
declare 215 {
- void *TclStackAlloc(Tcl_Interp *interp, int numBytes)
+ void *TclStackAlloc(Tcl_Interp *interp, size_t numBytes)
}
declare 216 {
void TclStackFree(Tcl_Interp *interp, void *freePtr)
@@ -887,7 +914,7 @@ declare 226 {
int TclObjBeingDeleted(Tcl_Obj *objPtr)
}
declare 227 {
- void TclSetNsPath(Namespace *nsPtr, int pathLength,
+ void TclSetNsPath(Namespace *nsPtr, size_t pathLength,
Tcl_Namespace *pathAry[])
}
# Used to be needed for TclOO-extension; unneeded now that TclOO is in the
@@ -927,9 +954,12 @@ declare 234 {
declare 235 {
void TclInitVarHashTable(TclVarHashTable *tablePtr, Namespace *nsPtr)
}
-declare 236 {deprecated {use Tcl_BackgroundException}} {
- void TclBackgroundException(Tcl_Interp *interp, int code)
-}
+
+
+# TIP 337 made this one public
+#declare 236 {
+# void TclBackgroundException(Tcl_Interp *interp, int code)
+#}
# TIP #285: Script cancellation support.
declare 237 {
@@ -939,7 +969,7 @@ declare 237 {
# NRE functions for "rogue" extensions to exploit NRE; they will need to
# include NRE.h too.
declare 238 {
- int TclNRInterpProc(ClientData clientData, Tcl_Interp *interp,
+ int TclNRInterpProc(void *clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[])
}
declare 239 {
@@ -972,8 +1002,8 @@ declare 245 {
Tcl_HashTable *TclGetNamespaceCommandTable(Tcl_Namespace *nsPtr)
}
declare 246 {
- int TclInitRewriteEnsemble(Tcl_Interp *interp, int numRemoved,
- int numInserted, Tcl_Obj *const *objv)
+ int TclInitRewriteEnsemble(Tcl_Interp *interp, size_t numRemoved,
+ size_t numInserted, Tcl_Obj *const *objv)
}
declare 247 {
void TclResetRewriteEnsemble(Tcl_Interp *interp, int isRootEnsemble)
@@ -996,7 +1026,7 @@ declare 250 {
# Allow extensions for optimization
declare 251 {
int TclRegisterLiteral(void *envPtr,
- const char *bytes, int length, int flags)
+ const char *bytes, size_t length, int flags)
}
# Exporting of the internal API to variables.
@@ -1048,17 +1078,20 @@ interface tclIntPlat
declare 0 win {
void TclWinConvertError(DWORD errCode)
}
-declare 1 win {
- void TclWinConvertWSAError(DWORD errCode)
-}
-declare 2 win {
- struct servent *TclWinGetServByName(const char *nm,
- const char *proto)
-}
-declare 3 win {
- int TclWinGetSockOpt(SOCKET s, int level, int optname,
- char *optval, int *optlen)
-}
+# Removed in 9.0:
+#declare 1 win {
+# void TclWinConvertWSAError(DWORD errCode)
+#}
+# Removed in 9.0:
+#declare 2 win {
+# struct servent *TclWinGetServByName(const char *nm,
+# const char *proto)
+#}
+# Removed in 9.0:
+#declare 3 win {
+# int TclWinGetSockOpt(SOCKET s, int level, int optname,
+# char *optval, int *optlen)
+#}
declare 4 win {
HINSTANCE TclWinGetTclInstance(void)
}
@@ -1070,23 +1103,26 @@ declare 5 win {
# declare 5 win {
# HINSTANCE TclWinLoadLibrary(char *name)
# }
-declare 6 win {
- unsigned short TclWinNToHS(unsigned short ns)
-}
-declare 7 win {
- int TclWinSetSockOpt(SOCKET s, int level, int optname,
- const char *optval, int optlen)
-}
+# Removed in 9.0:
+#declare 6 win {
+# unsigned short TclWinNToHS(unsigned short ns)
+#}
+# Removed in 9.0:
+#declare 7 win {
+# int TclWinSetSockOpt(SOCKET s, int level, int optname,
+# const char *optval, int optlen)
+#}
declare 8 win {
- int TclpGetPid(Tcl_Pid pid)
-}
-declare 9 win {
- int TclWinGetPlatformId(void)
-}
-# new for 8.4.20+/8.5.12+ Cygwin only
-declare 10 win {
- Tcl_DirEntry *TclpReaddir(TclDIR *dir)
+ size_t TclpGetPid(Tcl_Pid pid)
}
+# Removed in 9.0:
+#declare 9 win {
+# int TclWinGetPlatformId(void)
+#}
+# Removed in 9.0:
+#declare 10 win {
+# Tcl_DirEntry *TclpReaddir(TclDIR *dir)
+#}
# Removed in 8.3.1 (for Win32s only):
#declare 10 win {
# int TclWinSynchSpawn(void *args, int type, void **trans, Tcl_Pid *pidPtr)
@@ -1135,11 +1171,12 @@ declare 19 win {
TclFile TclpOpenFile(const char *fname, int mode)
}
declare 20 win {
- void TclWinAddProcess(HANDLE hProcess, DWORD id)
-}
-declare 21 win {
- char *TclpInetNtoa(struct in_addr addr)
+ void TclWinAddProcess(HANDLE hProcess, size_t id)
}
+# Removed in 9.0:
+#declare 21 win {
+# char *TclpInetNtoa(struct in_addr addr)
+#}
# removed permanently for 8.4
#declare 21 win {
# void TclpAsyncMark(Tcl_AsyncHandler async)
@@ -1160,9 +1197,10 @@ declare 24 win {
#declare 25 win {
# TclPlatformType *TclWinGetPlatform(void)
#}
-declare 26 win {
- void TclWinSetInterfaces(int wide)
-}
+# Removed in 9.0:
+#declare 26 win {
+# void TclWinSetInterfaces(int wide)
+#}
# Added in Tcl 8.3.3 / 8.4
@@ -1172,9 +1210,10 @@ declare 27 win {
# Added in 8.4.2
-declare 28 win {
- void TclWinResetInterfaces(void)
-}
+# Removed in 9.0:
+#declare 28 win {
+# void TclWinResetInterfaces(void)
+#}
################################
# Unix specific functions
@@ -1221,20 +1260,22 @@ declare 9 unix {
# Added in 8.4:
-declare 10 unix {
- Tcl_DirEntry *TclpReaddir(TclDIR *dir)
-}
-# Slots 11 and 12 are forwarders for functions that were promoted to
-# generic Stubs
-declare 11 unix {
- struct tm *TclpLocaltime_unix(const time_t *clock)
-}
-declare 12 unix {
- struct tm *TclpGmtime_unix(const time_t *clock)
-}
-declare 13 unix {
- char *TclpInetNtoa(struct in_addr addr)
-}
+# Removed in 9.0:
+#declare 10 unix {
+# Tcl_DirEntry *TclpReaddir(TclDIR *dir)
+#}
+# Removed in 9.0:
+#declare 11 unix {
+# struct tm *TclpLocaltime_unix(const time_t *clock)
+#}
+# Removed in 9.0:
+#declare 12 unix {
+# struct tm *TclpGmtime_unix(const time_t *clock)
+#}
+# Removed in 9.0:
+#declare 13 unix {
+# char *TclpInetNtoa(struct in_addr addr)
+#}
# Added in 8.5:
diff --git a/generic/tclInt.h b/generic/tclInt.h
index d75d3fa..cb08a54 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -26,20 +26,6 @@
#undef ACCEPT_NAN
/*
- * In Tcl 8.7, stop supporting special hacks for legacy Itcl 3.
- * Itcl 4 doesn't need them. Itcl 3 can be updated to not need them
- * using the Tcl(Init|Reset)RewriteEnsemble() routines in all Tcl 8.6+
- * releases. Perhaps Tcl 8.7 will add even better public interfaces
- * supporting all the re-invocation mechanisms extensions like Itcl 3
- * need. As an absolute last resort, folks who must make Itcl 3 work
- * unchanged with Tcl 8.7 can remove this line to regain the migration
- * support. Tcl 9 will no longer offer even that option.
- */
-
-#define AVOID_HACKS_FOR_ITCL 1
-
-
-/*
* Used to tag functions that are only to be visible within the module being
* built and not outside it (where this is supported by the linker).
* Also used in the platform-specific *Port.h files.
@@ -53,8 +39,6 @@
# endif
#endif
-
-
/*
* Common include files needed by most of the Tcl source files are included
* here, so that system-dependent personalizations for the include files only
@@ -68,6 +52,7 @@
#include <stdio.h>
#include <ctype.h>
+#include <stdarg.h>
#ifdef NO_STDLIB_H
# include "../compat/stdlib.h"
#else
@@ -214,9 +199,6 @@ typedef struct Tcl_ResolverInfo {
* - Bug #696893 - variable is either proc-local or in the current
* namespace; never follow the second (global) resolution path
* - Bug #631741 - do not use special namespace or interp resolvers
- *
- * It should also not collide with the (deprecated) TCL_PARSE_PART1 flag
- * (Bug #835020)
*/
#define TCL_AVOID_RESOLVERS 0x40000
@@ -289,16 +271,16 @@ typedef struct Namespace {
* strings; values have type (Namespace *). If
* NULL, there are no children. */
#endif
- unsigned long nsId; /* Unique id for the namespace. */
- Tcl_Interp *interp; /* The interpreter containing this
+ size_t nsId; /* Unique id for the namespace. */
+ Tcl_Interp *interp; /* The interpreter containing this
* namespace. */
int flags; /* OR-ed combination of the namespace status
* flags NS_DYING and NS_DEAD listed below. */
- int activationCount; /* Number of "activations" or active call
+ size_t activationCount; /* Number of "activations" or active call
* frames for this namespace that are on the
* Tcl call stack. The namespace won't be
* freed until activationCount becomes zero. */
- unsigned int refCount; /* Count of references by namespaceName
+ size_t refCount; /* Count of references by namespaceName
* objects. The namespace can't be freed until
* refCount becomes zero. */
Tcl_HashTable cmdTable; /* Contains all the commands currently
@@ -319,16 +301,16 @@ typedef struct Namespace {
* commands; however, no namespace qualifiers
* are allowed. NULL if no export patterns are
* registered. */
- int numExportPatterns; /* Number of export patterns currently
+ size_t numExportPatterns; /* Number of export patterns currently
* registered using "namespace export". */
- int maxExportPatterns; /* Mumber of export patterns for which space
+ size_t maxExportPatterns; /* Number of export patterns for which space
* is currently allocated. */
- unsigned int cmdRefEpoch; /* Incremented if a newly added command
+ size_t cmdRefEpoch; /* Incremented if a newly added command
* shadows a command for which this namespace
* has already cached a Command* pointer; this
* causes all its cached Command* pointers to
* be invalidated. */
- unsigned int resolverEpoch; /* Incremented whenever (a) the name
+ size_t resolverEpoch; /* Incremented whenever (a) the name
* resolution rules change for this namespace
* or (b) a newly added command shadows a
* command that is compiled to bytecodes. This
@@ -355,7 +337,7 @@ typedef struct Namespace {
* LookupCompiledLocal to resolve variable
* references within the namespace at compile
* time. */
- unsigned int exportLookupEpoch; /* Incremented whenever a command is added to
+ size_t exportLookupEpoch; /* Incremented whenever a command is added to
* a namespace, removed from a namespace or
* the exports of a namespace are changed.
* Allows TIP#112-driven command lists to be
@@ -366,7 +348,7 @@ typedef struct Namespace {
Tcl_Obj *unknownHandlerPtr; /* A script fragment to be used when command
* resolution in this namespace fails. TIP
* 181. */
- int commandPathLength; /* The length of the explicit path. */
+ size_t commandPathLength; /* The length of the explicit path. */
NamespacePathEntry *commandPathArray;
/* The explicit path of the namespace as an
* array. */
@@ -456,7 +438,7 @@ typedef struct EnsembleConfig {
* if the command has been deleted (or never
* existed; the global namespace never has an
* ensemble command.) */
- unsigned int epoch; /* The epoch at which this ensemble's table of
+ size_t epoch; /* The epoch at which this ensemble's table of
* exported commands is valid. */
char **subcommandArrayPtr; /* Array of ensemble subcommand names. At all
* consistent points, this will have the same
@@ -569,7 +551,7 @@ typedef struct CommandTrace {
struct CommandTrace *nextPtr;
/* Next in list of traces associated with a
* particular command. */
- unsigned int refCount; /* Used to ensure this structure is not
+ size_t refCount; /* Used to ensure this structure is not
* deleted too early. Keeps track of how many
* pieces of code have a pointer to this
* structure. */
@@ -632,7 +614,7 @@ typedef struct Var {
TclVarHashTable *tablePtr;/* For array variables, this points to
* information about the hash table used to
* implement the associative array. Points to
- * ckalloc-ed data. */
+ * Tcl_Alloc-ed data. */
struct Var *linkPtr; /* If this is a global variable being referred
* to in a procedure, or a variable created by
* "upvar", this field points to the
@@ -642,7 +624,7 @@ typedef struct Var {
typedef struct VarInHash {
Var var;
- unsigned int refCount; /* Counts number of active uses of this
+ size_t refCount; /* Counts number of active uses of this
* variable: 1 for the entry in the hash
* table, 1 for each additional variable whose
* linkPtr points here, 1 for each nested
@@ -939,7 +921,7 @@ typedef struct CompiledLocal {
/* Next compiler-recognized local variable for
* this procedure, or NULL if this is the last
* local. */
- int nameLength; /* The number of bytes in local variable's name.
+ size_t nameLength; /* The number of bytes in local variable's name.
* Among others used to speed up var lookups. */
int frameIndex; /* Index in the array of compiler-assigned
* variables in the procedure call frame. */
@@ -973,7 +955,7 @@ typedef struct CompiledLocal {
typedef struct Proc {
struct Interp *iPtr; /* Interpreter for which this command is
* defined. */
- unsigned int refCount; /* Reference count: 1 if still present in
+ size_t refCount; /* Reference count: 1 if still present in
* command table plus 1 for each call to the
* procedure that is currently active. This
* structure can be freed when refCount
@@ -1090,7 +1072,7 @@ typedef struct AssocData {
*/
typedef struct LocalCache {
- unsigned int refCount;
+ size_t refCount;
int numVars;
Tcl_Obj *varName0;
} LocalCache;
@@ -1245,7 +1227,7 @@ typedef struct CmdFrame {
} data;
Tcl_Obj *cmdObj;
const char *cmd; /* The executed command, if possible... */
- int len; /* ... and its length. */
+ size_t len; /* ... and its length. */
const struct CFWordBC *litarg;
/* Link to set of literal arguments which have
* ben pushed on the lineLABCPtr stack by
@@ -1256,13 +1238,13 @@ typedef struct CmdFrame {
typedef struct CFWord {
CmdFrame *framePtr; /* CmdFrame to access. */
int word; /* Index of the word in the command. */
- unsigned int refCount; /* Number of times the word is on the
+ size_t refCount; /* Number of times the word is on the
* stack. */
} CFWord;
typedef struct CFWordBC {
CmdFrame *framePtr; /* CmdFrame to access. */
- int pc; /* Instruction pointer of a command in
+ size_t pc; /* Instruction pointer of a command in
* ExtCmdLoc.loc[.] */
int word; /* Index of word in
* ExtCmdLoc.loc[cmd]->line[.] */
@@ -1343,7 +1325,7 @@ typedef struct {
* proc field is NULL. */
} ExtraFrameInfoField;
typedef struct {
- int length; /* Length of array. */
+ size_t length; /* Length of array. */
ExtraFrameInfoField fields[2];
/* Really as long as necessary, but this is
* long enough for nearly anything. */
@@ -1432,7 +1414,7 @@ typedef int (CompileProc)(Tcl_Interp *interp, Tcl_Parse *parsePtr,
*/
typedef int (CompileHookProc)(Tcl_Interp *interp,
- struct CompileEnv *compEnvPtr, ClientData clientData);
+ struct CompileEnv *compEnvPtr, void *clientData);
/*
* The data structure for a (linked list of) execution stacks.
@@ -1519,11 +1501,11 @@ typedef struct LiteralEntry {
* NULL if end of chain. */
Tcl_Obj *objPtr; /* Points to Tcl object that holds the
* literal's bytes and length. */
- unsigned int refCount; /* If in an interpreter's global literal
+ size_t refCount; /* If in an interpreter's global literal
* table, the number of ByteCode structures
* that share the literal object; the literal
* entry can be freed when refCount drops to
- * 0. If in a local literal table, (unsigned)-1. */
+ * 0. If in a local literal table, TCL_AUTO_LENGTH. */
Namespace *nsPtr; /* Namespace in which this literal is used. We
* try to avoid sharing literal non-FQ command
* names among different namespaces to reduce
@@ -1537,13 +1519,13 @@ typedef struct LiteralTable {
LiteralEntry *staticBuckets[TCL_SMALL_HASH_TABLE];
/* Bucket array used for small tables to avoid
* mallocs and frees. */
- unsigned int numBuckets; /* Total number of buckets allocated at
+ size_t numBuckets; /* Total number of buckets allocated at
* **buckets. */
- unsigned int numEntries; /* Total number of entries present in
+ size_t numEntries; /* Total number of entries present in
* table. */
- unsigned int rebuildSize; /* Enlarge table when numEntries gets to be
+ size_t rebuildSize; /* Enlarge table when numEntries gets to be
* this large. */
- unsigned int mask; /* Mask value used in hashing function. */
+ size_t mask; /* Mask value used in hashing function. */
} LiteralTable;
/*
@@ -1661,12 +1643,12 @@ typedef struct Command {
* recreated). */
Namespace *nsPtr; /* Points to the namespace containing this
* command. */
- unsigned int refCount; /* 1 if in command hashtable plus 1 for each
+ size_t refCount; /* 1 if in command hashtable plus 1 for each
* reference from a CmdName Tcl object
* representing a command's name in a ByteCode
* instruction sequence. This structure can be
* freed when refCount becomes zero. */
- unsigned int cmdEpoch; /* Incremented to invalidate any references
+ size_t cmdEpoch; /* Incremented to invalidate any references
* that point to this command when it is
* renamed, deleted, hidden, or exposed. */
CompileProc *compileProc; /* Procedure called to compile command. NULL
@@ -1786,7 +1768,7 @@ typedef struct AllocCache {
struct Cache *nextPtr; /* Linked list of cache entries. */
Tcl_ThreadId owner; /* Which thread's cache is this? */
Tcl_Obj *firstObjPtr; /* List of free objects for thread. */
- int numObjects; /* Number of objects for thread. */
+ size_t numObjects; /* Number of objects for thread. */
} AllocCache;
/*
@@ -1800,41 +1782,31 @@ typedef struct AllocCache {
typedef struct Interp {
/*
- * Note: the first three fields must match exactly the fields in a
- * Tcl_Interp struct (see tcl.h). If you change one, be sure to change the
- * other.
- *
- * The interpreter's result is held in both the string and the
- * objResultPtr fields. These fields hold, respectively, the result's
- * string or object value. The interpreter's result is always in the
- * result field if that is non-empty, otherwise it is in objResultPtr.
- * The two fields are kept consistent unless some C code sets
- * interp->result directly. Programs should not access result and
- * objResultPtr directly; instead, they should always get and set the
- * result using procedures such as Tcl_SetObjResult, Tcl_GetObjResult, and
- * Tcl_GetStringResult. See the SetResult man page for details.
+ * The first two fields were named "result" and "freeProc" in earlier
+ * versions of Tcl. They are no longer used within Tcl, and are no
+ * longer available to be accessed by extensions. However, they cannot
+ * be removed. Why? There is a deployed base of stub-enabled extensions
+ * that query the value of iPtr->stubTable. For them to continue to work,
+ * the location of the field "stubTable" within the Interp struct cannot
+ * change. The most robust way to assure that is to leave all fields up to
+ * that one undisturbed.
*/
- char *result; /* If the last command returned a string
- * result, this points to it. Should not be
- * accessed directly; see comment above. */
- Tcl_FreeProc *freeProc; /* Zero means a string result is statically
- * allocated. TCL_DYNAMIC means string result
- * was allocated with ckalloc and should be
- * freed with ckfree. Other values give
- * address of procedure to invoke to free the
- * string result. Tcl_Eval must free it before
- * executing next command. */
+ const char *legacyResult;
+ void (*legacyFreeProc) (void);
int errorLine; /* When TCL_ERROR is returned, this gives the
* line number in the command where the error
* occurred (1 means first line). */
const struct TclStubs *stubTable;
- /* Pointer to the exported Tcl stub table. On
- * previous versions of Tcl this is a pointer
- * to the objResultPtr or a pointer to a
- * buckets array in a hash table. We therefore
- * have to do some careful checking before we
- * can use this. */
+ /* Pointer to the exported Tcl stub table. In
+ * ancient pre-8.1 versions of Tcl this was a
+ * pointer to the objResultPtr or a pointer to a
+ * buckets array in a hash table. Deployed stubs
+ * enabled extensions check for a NULL pointer value
+ * and for a TCL_STUBS_MAGIC value to verify they
+ * are not [load]ing into one of those pre-stubs
+ * interps.
+ */
TclHandle handle; /* Handle used to keep track of when this
* interp is deleted. */
@@ -1847,15 +1819,7 @@ typedef struct Interp {
void *interpInfo; /* Information used by tclInterp.c to keep
* track of master/slave interps on a
* per-interp basis. */
- union {
- void (*optimizer)(void *envPtr);
- Tcl_HashTable unused2; /* No longer used (was mathFuncTable). The
- * unused space in interp was repurposed for
- * pluggable bytecode optimizers. The core
- * contains one optimizer, which can be
- * selectively overridden by extensions. */
- } extra;
-
+ void (*optimizer)(void *envPtr);
/*
* Information related to procedures and variables. See tclProc.c and
* tclVar.c for usage.
@@ -1885,25 +1849,6 @@ typedef struct Interp {
* TCL_EVAL_INVOKE call to Tcl_EvalObjv. */
/*
- * Information used by Tcl_AppendResult to keep track of partial results.
- * See Tcl_AppendResult code for details.
- */
-
-#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
- char *appendResult; /* Storage space for results generated by
- * Tcl_AppendResult. Ckalloc-ed. NULL means
- * not yet allocated. */
- int appendAvl; /* Total amount of space available at
- * partialResult. */
- int appendUsed; /* Number of non-null bytes currently stored
- * at partialResult. */
-#else
- char *appendResultDontUse;
- int appendAvlDontUse;
- int appendUsedDontUse;
-#endif
-
- /*
* Information about packages. Used only in tclPkg.c.
*/
@@ -1919,19 +1864,18 @@ typedef struct Interp {
* Miscellaneous information:
*/
- int cmdCount; /* Total number of times a command procedure
+ size_t cmdCount; /* Total number of times a command procedure
* has been called for this interpreter. */
int evalFlags; /* Flags to control next call to Tcl_Eval.
* Normally zero, but may be set before
* calling Tcl_Eval. See below for valid
* values. */
- int unused1; /* No longer used (was termOffset) */
LiteralTable literalTable; /* Contains LiteralEntry's describing all Tcl
* objects holding literals of scripts
* compiled by the interpreter. Indexed by the
* string representations of literals. Used to
* avoid creating duplicate objects. */
- unsigned int compileEpoch; /* Holds the current "compilation epoch" for
+ size_t compileEpoch; /* Holds the current "compilation epoch" for
* this interpreter. This is incremented to
* invalidate existing ByteCodes when, e.g., a
* command with a compile procedure is
@@ -1963,14 +1907,6 @@ typedef struct Interp {
* string. Returned by Tcl_ObjSetVar2 when
* variable traces change a variable in a
* gross way. */
-#if TCL_MAJOR_VERSION < 9
-# if !defined(TCL_NO_DEPRECATED)
- char resultSpace[TCL_DSTRING_STATIC_SIZE+1];
- /* Static space holding small results. */
-# else
- char resultSpaceDontUse[TCL_DSTRING_STATIC_SIZE+1];
-# endif
-#endif
Tcl_Obj *objResultPtr; /* If the last command returned an object
* result, this points to it. Should not be
* accessed directly; see comment above. */
@@ -2013,7 +1949,7 @@ typedef struct Interp {
* as flag values the same as the 'active'
* field. */
- int cmdCount; /* Limit for how many commands to execute in
+ size_t cmdCount; /* Limit for how many commands to execute in
* the interpreter. */
LimitHandler *cmdHandlers;
/* Handlers to execute when the limit is
@@ -2049,9 +1985,9 @@ typedef struct Interp {
* *root* ensemble command? (Nested ensembles
* don't rewrite this.) NULL if we're not
* processing an ensemble. */
- int numRemovedObjs; /* How many arguments have been stripped off
+ size_t numRemovedObjs; /* How many arguments have been stripped off
* because of ensemble processing. */
- int numInsertedObjs; /* How many of the current arguments were
+ size_t numInsertedObjs; /* How many of the current arguments were
* inserted by an ensemble. */
} ensembleRewrite;
@@ -2368,7 +2304,7 @@ typedef struct Interp {
*/
#define TclOOM(ptr, size) \
- ((size) && ((ptr)||(Tcl_Panic("unable to alloc %u bytes", (size)),1)))
+ ((size) && ((ptr)||(Tcl_Panic("unable to alloc %" TCL_Z_MODIFIER "u bytes", (size_t)(size)),1)))
/*
* The following enum values are used to specify the runtime platform setting
@@ -2421,7 +2357,7 @@ typedef enum TclEolTranslation {
*/
typedef struct List {
- unsigned int refCount;
+ size_t refCount;
int maxElemCount; /* Total number of element array slots. */
int elemCount; /* Current number of list elements. */
int canonicalFlag; /* Set if the string representation was
@@ -2435,7 +2371,7 @@ typedef struct List {
#define LIST_MAX \
(1 + (int)(((size_t)UINT_MAX - sizeof(List))/sizeof(Tcl_Obj *)))
#define LIST_SIZE(numElems) \
- (unsigned)(sizeof(List) + (((numElems) - 1) * sizeof(Tcl_Obj *)))
+ (sizeof(List) + (((numElems) - 1) * sizeof(Tcl_Obj *)))
/*
* Macro used to get the elements of a list object.
@@ -2484,10 +2420,9 @@ typedef struct List {
*/
#define TclGetBooleanFromObj(interp, objPtr, boolPtr) \
- (((objPtr)->typePtr == &tclIntType) \
+ (((objPtr)->typePtr == &tclIntType \
+ || (objPtr)->typePtr == &tclBooleanType) \
? (*(boolPtr) = ((objPtr)->internalRep.wideValue!=0), TCL_OK) \
- : ((objPtr)->typePtr == &tclBooleanType) \
- ? (*(boolPtr) = ((objPtr)->internalRep.longValue!=0), TCL_OK) \
: Tcl_GetBooleanFromObj((interp), (objPtr), (boolPtr)))
#ifdef TCL_WIDE_INT_IS_LONG
@@ -2514,7 +2449,7 @@ typedef struct List {
(((objPtr)->typePtr == &tclIntType \
&& (objPtr)->internalRep.wideValue <= (Tcl_WideInt)(INT_MAX)) \
? ((*(idxPtr) = ((objPtr)->internalRep.wideValue >= 0) \
- ? (int)(objPtr)->internalRep.wideValue : TCL_INDEX_NONE), TCL_OK) \
+ ? (size_t)(objPtr)->internalRep.wideValue : TCL_INDEX_NONE), TCL_OK) \
: Tcl_GetIntForIndex((interp), (objPtr), (endValue), (idxPtr)))
/*
@@ -2572,7 +2507,7 @@ typedef struct List {
*/
#define TCL_FILESYSTEM_VERSION_2 ((Tcl_FSVersion) 0x2)
-typedef ClientData (TclFSGetCwdProc2)(ClientData clientData);
+typedef void *(TclFSGetCwdProc2)(void *clientData);
typedef int (Tcl_FSLoadFileProc2) (Tcl_Interp *interp, Tcl_Obj *pathPtr,
Tcl_LoadHandle *handlePtr, Tcl_FSUnloadFileProc **unloadProcPtr, int flags);
@@ -2653,7 +2588,7 @@ typedef Tcl_ObjCmdProc *TclObjCmdProcType;
*----------------------------------------------------------------
*/
-typedef void (TclInitProcessGlobalValueProc)(char **valuePtr, unsigned int *lengthPtr,
+typedef void (TclInitProcessGlobalValueProc)(char **valuePtr, size_t *lengthPtr,
Tcl_Encoding *encodingPtr);
/*
@@ -2665,9 +2600,9 @@ typedef void (TclInitProcessGlobalValueProc)(char **valuePtr, unsigned int *leng
*/
typedef struct ProcessGlobalValue {
- unsigned int epoch; /* Epoch counter to detect changes in the
+ size_t epoch; /* Epoch counter to detect changes in the
* master value. */
- unsigned int numBytes; /* Length of the master string. */
+ size_t numBytes; /* Length of the master string. */
char *value; /* The master string value. */
Tcl_Encoding encoding; /* system encoding when master string was
* initialized. */
@@ -2711,10 +2646,6 @@ typedef struct ProcessGlobalValue {
*/
#define TCL_NUMBER_INT 2
-#if (TCL_MAJOR_VERSION < 9) && !defined(TCL_NO_DEPRECATED)
-# define TCL_NUMBER_LONG 1 /* deprecated, not used any more */
-# define TCL_NUMBER_WIDE TCL_NUMBER_INT /* deprecated */
-#endif
#define TCL_NUMBER_BIG 3
#define TCL_NUMBER_DOUBLE 4
#define TCL_NUMBER_NAN 5
@@ -2740,7 +2671,7 @@ MODULE_SCOPE Tcl_Encoding tclIdentityEncoding;
MODULE_SCOPE Tcl_GetTimeProc *tclGetTimeProcPtr;
MODULE_SCOPE Tcl_ScaleTimeProc *tclScaleTimeProcPtr;
-MODULE_SCOPE ClientData tclTimeClientData;
+MODULE_SCOPE void *tclTimeClientData;
/*
* Variables denoting the Tcl object types defined in the core.
@@ -2900,7 +2831,7 @@ struct Tcl_LoadHandle_ {
*/
MODULE_SCOPE void TclAppendBytesToByteArray(Tcl_Obj *objPtr,
- const unsigned char *bytes, int len);
+ const unsigned char *bytes, size_t len);
MODULE_SCOPE int TclNREvalCmd(Tcl_Interp *interp, Tcl_Obj *objPtr,
int flags);
MODULE_SCOPE void TclAdvanceContinuations(int *line, int **next,
@@ -2913,22 +2844,20 @@ MODULE_SCOPE void TclArgumentRelease(Tcl_Interp *interp,
Tcl_Obj *objv[], int objc);
MODULE_SCOPE void TclArgumentBCEnter(Tcl_Interp *interp,
Tcl_Obj *objv[], int objc,
- void *codePtr, CmdFrame *cfPtr, int cmd, int pc);
+ void *codePtr, CmdFrame *cfPtr, int cmd, size_t pc);
MODULE_SCOPE void TclArgumentBCRelease(Tcl_Interp *interp,
CmdFrame *cfPtr);
MODULE_SCOPE void TclArgumentGet(Tcl_Interp *interp, Tcl_Obj *obj,
CmdFrame **cfPtrPtr, int *wordPtr);
MODULE_SCOPE double TclBignumToDouble(const mp_int *bignum);
MODULE_SCOPE int TclByteArrayMatch(const unsigned char *string,
- int strLen, const unsigned char *pattern,
- int ptnLen, int flags);
+ size_t strLen, const unsigned char *pattern,
+ size_t ptnLen, int flags);
MODULE_SCOPE double TclCeil(const mp_int *a);
MODULE_SCOPE void TclChannelPreserve(Tcl_Channel chan);
MODULE_SCOPE void TclChannelRelease(Tcl_Channel chan);
MODULE_SCOPE int TclCheckArrayTraces(Tcl_Interp *interp, Var *varPtr,
Var *arrayPtr, Tcl_Obj *name, int index);
-MODULE_SCOPE int TclCheckBadOctal(Tcl_Interp *interp,
- const char *value);
MODULE_SCOPE int TclCheckEmptyString(Tcl_Obj *objPtr);
MODULE_SCOPE int TclChanCaughtErrorBypass(Tcl_Interp *interp,
Tcl_Channel chan);
@@ -2943,11 +2872,11 @@ MODULE_SCOPE void TclContinuationsEnterDerived(Tcl_Obj *objPtr,
MODULE_SCOPE ContLineLoc *TclContinuationsGet(Tcl_Obj *objPtr);
MODULE_SCOPE void TclContinuationsCopy(Tcl_Obj *objPtr,
Tcl_Obj *originObjPtr);
-MODULE_SCOPE int TclConvertElement(const char *src, int length,
+MODULE_SCOPE size_t TclConvertElement(const char *src, size_t length,
char *dst, int flags);
MODULE_SCOPE Tcl_Command TclCreateObjCommandInNs(Tcl_Interp *interp,
const char *cmdName, Tcl_Namespace *nsPtr,
- Tcl_ObjCmdProc *proc, ClientData clientData,
+ Tcl_ObjCmdProc *proc, void *clientData,
Tcl_CmdDeleteProc *deleteProc);
MODULE_SCOPE Tcl_Command TclCreateEnsembleInNs(Tcl_Interp *interp,
const char *name, Tcl_Namespace *nameNamespacePtr,
@@ -2956,10 +2885,10 @@ MODULE_SCOPE void TclDeleteNamespaceVars(Namespace *nsPtr);
MODULE_SCOPE int TclFindDictElement(Tcl_Interp *interp,
const char *dict, int dictLength,
const char **elementPtr, const char **nextPtr,
- int *sizePtr, int *literalPtr);
+ size_t *sizePtr, int *literalPtr);
/* TIP #280 - Modified token based evaluation, with line information. */
MODULE_SCOPE int TclEvalEx(Tcl_Interp *interp, const char *script,
- int numBytes, int flags, int line,
+ size_t numBytes, int flags, int line,
int *clNextOuter, const char *outerScript);
MODULE_SCOPE Tcl_ObjCmdProc TclFileAttrsCmd;
MODULE_SCOPE Tcl_ObjCmdProc TclFileCopyCmd;
@@ -2971,9 +2900,9 @@ MODULE_SCOPE Tcl_ObjCmdProc TclFileRenameCmd;
MODULE_SCOPE Tcl_ObjCmdProc TclFileTempDirCmd;
MODULE_SCOPE Tcl_ObjCmdProc TclFileTemporaryCmd;
MODULE_SCOPE void TclCreateLateExitHandler(Tcl_ExitProc *proc,
- ClientData clientData);
+ void *clientData);
MODULE_SCOPE void TclDeleteLateExitHandler(Tcl_ExitProc *proc,
- ClientData clientData);
+ void *clientData);
MODULE_SCOPE char * TclDStringAppendObj(Tcl_DString *dsPtr,
Tcl_Obj *objPtr);
MODULE_SCOPE char * TclDStringAppendDString(Tcl_DString *dsPtr,
@@ -3012,7 +2941,7 @@ MODULE_SCOPE int TclFSFileAttrIndex(Tcl_Obj *pathPtr,
MODULE_SCOPE Tcl_Command TclNRCreateCommandInNs(Tcl_Interp *interp,
const char *cmdName, Tcl_Namespace *nsPtr,
Tcl_ObjCmdProc *proc, Tcl_ObjCmdProc *nreProc,
- ClientData clientData,
+ void *clientData,
Tcl_CmdDeleteProc *deleteProc);
MODULE_SCOPE int TclNREvalFile(Tcl_Interp *interp, Tcl_Obj *pathPtr,
const char *encodingName);
@@ -3028,7 +2957,7 @@ MODULE_SCOPE int TclGetCompletionCodeFromObj(Tcl_Interp *interp,
MODULE_SCOPE Proc * TclGetLambdaFromObj(Tcl_Interp *interp,
Tcl_Obj *objPtr, Tcl_Obj **nsObjPtrPtr);
MODULE_SCOPE int TclGetNumberFromObj(Tcl_Interp *interp,
- Tcl_Obj *objPtr, ClientData *clientDataPtr,
+ Tcl_Obj *objPtr, void **clientDataPtr,
int *typePtr);
MODULE_SCOPE int TclGetOpenModeEx(Tcl_Interp *interp,
const char *modeString, int *seekFlagPtr,
@@ -3037,7 +2966,7 @@ MODULE_SCOPE Tcl_Obj * TclGetProcessGlobalValue(ProcessGlobalValue *pgvPtr);
MODULE_SCOPE Tcl_Obj * TclGetSourceFromFrame(CmdFrame *cfPtr, int objc,
Tcl_Obj *const objv[]);
MODULE_SCOPE char * TclGetStringStorage(Tcl_Obj *objPtr,
- unsigned int *sizePtr);
+ size_t *sizePtr);
MODULE_SCOPE int TclGetLoadedPackagesEx(Tcl_Interp *interp,
const char *targetName,
const char *packageName);
@@ -3050,16 +2979,16 @@ MODULE_SCOPE int TclIncrObj(Tcl_Interp *interp, Tcl_Obj *valuePtr,
Tcl_Obj *incrPtr);
MODULE_SCOPE Tcl_Obj * TclIncrObjVar2(Tcl_Interp *interp, Tcl_Obj *part1Ptr,
Tcl_Obj *part2Ptr, Tcl_Obj *incrPtr, int flags);
-MODULE_SCOPE int TclInfoExistsCmd(ClientData dummy, Tcl_Interp *interp,
+MODULE_SCOPE int TclInfoExistsCmd(void *dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
-MODULE_SCOPE int TclInfoCoroutineCmd(ClientData dummy, Tcl_Interp *interp,
+MODULE_SCOPE int TclInfoCoroutineCmd(void *dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
MODULE_SCOPE Tcl_Obj * TclInfoFrame(Tcl_Interp *interp, CmdFrame *framePtr);
-MODULE_SCOPE int TclInfoGlobalsCmd(ClientData dummy, Tcl_Interp *interp,
+MODULE_SCOPE int TclInfoGlobalsCmd(void *dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
-MODULE_SCOPE int TclInfoLocalsCmd(ClientData dummy, Tcl_Interp *interp,
+MODULE_SCOPE int TclInfoLocalsCmd(void *dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
-MODULE_SCOPE int TclInfoVarsCmd(ClientData dummy, Tcl_Interp *interp,
+MODULE_SCOPE int TclInfoVarsCmd(void *dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
MODULE_SCOPE void TclInitAlloc(void);
MODULE_SCOPE void TclInitBignumFromWideInt(mp_int *, Tcl_WideInt);
@@ -3099,7 +3028,7 @@ MODULE_SCOPE Tcl_Obj * TclLsetFlat(Tcl_Interp *interp, Tcl_Obj *listPtr,
Tcl_Obj *valuePtr);
MODULE_SCOPE Tcl_Command TclMakeEnsemble(Tcl_Interp *interp, const char *name,
const EnsembleImplMap map[]);
-MODULE_SCOPE int TclMaxListLength(const char *bytes, int numBytes,
+MODULE_SCOPE int TclMaxListLength(const char *bytes, size_t numBytes,
const char **endPtr);
MODULE_SCOPE int TclMergeReturnOptions(Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[], Tcl_Obj **optionsPtrPtr,
@@ -3117,22 +3046,22 @@ MODULE_SCOPE int TclObjInvokeNamespace(Tcl_Interp *interp,
MODULE_SCOPE int TclObjUnsetVar2(Tcl_Interp *interp,
Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, int flags);
MODULE_SCOPE int TclParseBackslash(const char *src,
- int numBytes, int *readPtr, char *dst);
-MODULE_SCOPE int TclParseHex(const char *src, int numBytes,
+ size_t numBytes, size_t *readPtr, char *dst);
+MODULE_SCOPE int TclParseHex(const char *src, size_t numBytes,
int *resultPtr);
MODULE_SCOPE int TclParseNumber(Tcl_Interp *interp, Tcl_Obj *objPtr,
const char *expected, const char *bytes,
- int numBytes, const char **endPtrPtr, int flags);
+ size_t numBytes, const char **endPtrPtr, int flags);
MODULE_SCOPE void TclParseInit(Tcl_Interp *interp, const char *string,
- int numBytes, Tcl_Parse *parsePtr);
-MODULE_SCOPE int TclParseAllWhiteSpace(const char *src, int numBytes);
+ size_t numBytes, Tcl_Parse *parsePtr);
+MODULE_SCOPE size_t TclParseAllWhiteSpace(const char *src, size_t numBytes);
MODULE_SCOPE int TclProcessReturn(Tcl_Interp *interp,
int code, int level, Tcl_Obj *returnOpts);
MODULE_SCOPE int TclpObjLstat(Tcl_Obj *pathPtr, Tcl_StatBuf *buf);
MODULE_SCOPE Tcl_Obj * TclpTempFileName(void);
MODULE_SCOPE Tcl_Obj * TclpTempFileNameForLibrary(Tcl_Interp *interp, Tcl_Obj* pathPtr);
MODULE_SCOPE Tcl_Obj * TclNewFSPathObj(Tcl_Obj *dirPtr, const char *addStrRep,
- int len);
+ size_t len);
MODULE_SCOPE int TclpDeleteFile(const void *path);
MODULE_SCOPE void TclpFinalizeCondition(Tcl_Condition *condPtr);
MODULE_SCOPE void TclpFinalizeMutex(Tcl_Mutex *mutexPtr);
@@ -3143,11 +3072,11 @@ MODULE_SCOPE int TclCreateSocketAddress(Tcl_Interp *interp,
const char *host, int port, int willBind,
const char **errorMsgPtr);
MODULE_SCOPE int TclpThreadCreate(Tcl_ThreadId *idPtr,
- Tcl_ThreadCreateProc *proc, ClientData clientData,
- int stackSize, int flags);
-MODULE_SCOPE int TclpFindVariable(const char *name, int *lengthPtr);
+ Tcl_ThreadCreateProc *proc, void *clientData,
+ size_t stackSize, int flags);
+MODULE_SCOPE size_t TclpFindVariable(const char *name, size_t *lengthPtr);
MODULE_SCOPE void TclpInitLibraryPath(char **valuePtr,
- unsigned int *lengthPtr, Tcl_Encoding *encodingPtr);
+ size_t *lengthPtr, Tcl_Encoding *encodingPtr);
MODULE_SCOPE void TclpInitLock(void);
MODULE_SCOPE void TclpInitPlatform(void);
MODULE_SCOPE void TclpInitUnlock(void);
@@ -3167,7 +3096,7 @@ MODULE_SCOPE int TclCrossFilesystemCopy(Tcl_Interp *interp,
MODULE_SCOPE int TclpMatchInDirectory(Tcl_Interp *interp,
Tcl_Obj *resultPtr, Tcl_Obj *pathPtr,
const char *pattern, Tcl_GlobTypeData *types);
-MODULE_SCOPE ClientData TclpGetNativeCwd(ClientData clientData);
+MODULE_SCOPE void *TclpGetNativeCwd(void *clientData);
MODULE_SCOPE Tcl_FSDupInternalRepProc TclNativeDupInternalRep;
MODULE_SCOPE Tcl_Obj * TclpObjLink(Tcl_Obj *pathPtr, Tcl_Obj *toPtr,
int linkType);
@@ -3191,9 +3120,9 @@ MODULE_SCOPE void TclRememberJoinableThread(Tcl_ThreadId id);
MODULE_SCOPE void TclRememberMutex(Tcl_Mutex *mutex);
MODULE_SCOPE void TclRemoveScriptLimitCallbacks(Tcl_Interp *interp);
MODULE_SCOPE int TclReToGlob(Tcl_Interp *interp, const char *reStr,
- int reStrLen, Tcl_DString *dsPtr, int *flagsPtr,
+ size_t reStrLen, Tcl_DString *dsPtr, int *flagsPtr,
int *quantifiersFoundPtr);
-MODULE_SCOPE int TclScanElement(const char *string, int length,
+MODULE_SCOPE size_t TclScanElement(const char *string, size_t length,
char *flagPtr);
MODULE_SCOPE void TclSetBgErrorHandler(Tcl_Interp *interp,
Tcl_Obj *cmdPrefix);
@@ -3208,37 +3137,37 @@ MODULE_SCOPE void TclSetProcessGlobalValue(ProcessGlobalValue *pgvPtr,
Tcl_Obj *newValue, Tcl_Encoding encoding);
MODULE_SCOPE void TclSignalExitThread(Tcl_ThreadId id, int result);
MODULE_SCOPE void TclSpellFix(Tcl_Interp *interp,
- Tcl_Obj *const *objv, int objc, int subIdx,
+ Tcl_Obj *const *objv, int objc, size_t subIdx,
Tcl_Obj *bad, Tcl_Obj *fix);
MODULE_SCOPE void * TclStackRealloc(Tcl_Interp *interp, void *ptr,
- int numBytes);
+ size_t numBytes);
typedef int (*memCmpFn_t)(const void*, const void*, size_t);
MODULE_SCOPE int TclStringCmp(Tcl_Obj *value1Ptr, Tcl_Obj *value2Ptr,
- int checkEq, int nocase, int reqlength);
+ int checkEq, int nocase, size_t reqlength);
MODULE_SCOPE int TclStringCmpOpts(Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[], int *nocase,
int *reqlength);
-MODULE_SCOPE int TclStringMatch(const char *str, int strLen,
+MODULE_SCOPE int TclStringMatch(const char *str, size_t strLen,
const char *pattern, int ptnLen, int flags);
MODULE_SCOPE int TclStringMatchObj(Tcl_Obj *stringObj,
Tcl_Obj *patternObj, int flags);
MODULE_SCOPE void TclSubstCompile(Tcl_Interp *interp, const char *bytes,
- int numBytes, int flags, int line,
+ size_t numBytes, int flags, int line,
struct CompileEnv *envPtr);
MODULE_SCOPE int TclSubstOptions(Tcl_Interp *interp, int numOpts,
Tcl_Obj *const opts[], int *flagPtr);
MODULE_SCOPE void TclSubstParse(Tcl_Interp *interp, const char *bytes,
- int numBytes, int flags, Tcl_Parse *parsePtr,
+ size_t numBytes, int flags, Tcl_Parse *parsePtr,
Tcl_InterpState *statePtr);
MODULE_SCOPE int TclSubstTokens(Tcl_Interp *interp, Tcl_Token *tokenPtr,
int count, int *tokensLeftPtr, int line,
int *clNextOuter, const char *outerScript);
-MODULE_SCOPE int TclTrim(const char *bytes, int numBytes,
- const char *trim, int numTrim, int *trimRight);
-MODULE_SCOPE int TclTrimLeft(const char *bytes, int numBytes,
- const char *trim, int numTrim);
-MODULE_SCOPE int TclTrimRight(const char *bytes, int numBytes,
- const char *trim, int numTrim);
+MODULE_SCOPE size_t TclTrim(const char *bytes, size_t numBytes,
+ const char *trim, size_t numTrim, size_t *trimRight);
+MODULE_SCOPE size_t TclTrimLeft(const char *bytes, size_t numBytes,
+ const char *trim, size_t numTrim);
+MODULE_SCOPE size_t TclTrimRight(const char *bytes, size_t numBytes,
+ const char *trim, size_t numTrim);
MODULE_SCOPE const char*TclGetCommandTypeName(Tcl_Command command);
MODULE_SCOPE void TclRegisterCommandTypeName(
Tcl_ObjCmdProc *implementationProc,
@@ -3256,8 +3185,8 @@ MODULE_SCOPE WCHAR * TclUtfToWCharDString(const char *src,
#endif
MODULE_SCOPE int TclUtfCmp(const char *cs, const char *ct);
MODULE_SCOPE int TclUtfCasecmp(const char *cs, const char *ct);
-MODULE_SCOPE int TclUtfCount(int ch);
-MODULE_SCOPE Tcl_Obj * TclpNativeToNormalized(ClientData clientData);
+MODULE_SCOPE size_t TclUtfCount(int ch);
+MODULE_SCOPE Tcl_Obj * TclpNativeToNormalized(void *clientData);
MODULE_SCOPE Tcl_Obj * TclpFilesystemPathType(Tcl_Obj *pathPtr);
MODULE_SCOPE int TclpDlopen(Tcl_Interp *interp, Tcl_Obj *pathPtr,
Tcl_LoadHandle *loadHandle,
@@ -3273,13 +3202,6 @@ MODULE_SCOPE void TclInitThreadStorage(void);
MODULE_SCOPE void TclFinalizeThreadDataThread(void);
MODULE_SCOPE void TclFinalizeThreadStorage(void);
-/* TclWideMUInt -- wide integer used for measurement calculations: */
-#if (!defined(_WIN32) || !defined(_MSC_VER) || (_MSC_VER >= 1400))
-# define TclWideMUInt Tcl_WideUInt
-#else
-/* older MSVS may not allow conversions between unsigned __int64 and double) */
-# define TclWideMUInt Tcl_WideInt
-#endif
#ifdef TCL_WIDE_CLICKS
MODULE_SCOPE Tcl_WideInt TclpGetWideClicks(void);
MODULE_SCOPE double TclpWideClicksToNanoseconds(Tcl_WideInt clicks);
@@ -3301,7 +3223,7 @@ MODULE_SCOPE void TclpThreadDeleteKey(void *keyPtr);
MODULE_SCOPE void TclpThreadSetMasterTSD(void *tsdKeyPtr, void *ptr);
MODULE_SCOPE void * TclpThreadGetMasterTSD(void *tsdKeyPtr);
MODULE_SCOPE void TclErrorStackResetIf(Tcl_Interp *interp,
- const char *msg, int length);
+ const char *msg, size_t length);
/* Tip 430 */
MODULE_SCOPE int TclZipfs_Init(Tcl_Interp *interp);
@@ -3312,60 +3234,55 @@ MODULE_SCOPE int TclZipfs_Init(Tcl_Interp *interp);
*----------------------------------------------------------------
*/
-MODULE_SCOPE int Tcl_AfterObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_AfterObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_AppendObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_AppendObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_ApplyObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_ApplyObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
MODULE_SCOPE Tcl_Command TclInitArrayCmd(Tcl_Interp *interp);
MODULE_SCOPE Tcl_Command TclInitBinaryCmd(Tcl_Interp *interp);
-MODULE_SCOPE int Tcl_BreakObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_BreakObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
-MODULE_SCOPE int Tcl_CaseObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_CatchObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-#endif
-MODULE_SCOPE int Tcl_CatchObjCmd(ClientData clientData,
- Tcl_Interp *interp, int objc,
- Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_CdObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_CdObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
MODULE_SCOPE Tcl_Command TclInitChanCmd(Tcl_Interp *interp);
-MODULE_SCOPE int TclChanCreateObjCmd(ClientData clientData,
+MODULE_SCOPE int TclChanCreateObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int TclChanPostEventObjCmd(ClientData clientData,
+MODULE_SCOPE int TclChanPostEventObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int TclChanPopObjCmd(ClientData clientData,
+MODULE_SCOPE int TclChanPopObjCmd(void *clientData,
Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]);
-MODULE_SCOPE int TclChanPushObjCmd(ClientData clientData,
+MODULE_SCOPE int TclChanPushObjCmd(void *clientData,
Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]);
MODULE_SCOPE void TclClockInit(Tcl_Interp *interp);
MODULE_SCOPE int TclClockOldscanObjCmd(
void *clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_CloseObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_CloseObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_ConcatObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_ConcatObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_ContinueObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_ContinueObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
MODULE_SCOPE Tcl_TimerToken TclCreateAbsoluteTimerHandler(
Tcl_Time *timePtr, Tcl_TimerProc *proc,
- ClientData clientData);
+ void *clientData);
MODULE_SCOPE int TclDefaultBgErrorHandlerObjCmd(
- ClientData clientData, Tcl_Interp *interp,
+ void *clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
MODULE_SCOPE Tcl_Command TclInitDictCmd(Tcl_Interp *interp);
MODULE_SCOPE int TclDictWithFinish(Tcl_Interp *interp, Var *varPtr,
@@ -3374,236 +3291,236 @@ MODULE_SCOPE int TclDictWithFinish(Tcl_Interp *interp, Var *varPtr,
Tcl_Obj *const pathv[], Tcl_Obj *keysPtr);
MODULE_SCOPE Tcl_Obj * TclDictWithInit(Tcl_Interp *interp, Tcl_Obj *dictPtr,
int pathc, Tcl_Obj *const pathv[]);
-MODULE_SCOPE int Tcl_DisassembleObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_DisassembleObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
/* Assemble command function */
-MODULE_SCOPE int Tcl_AssembleObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_AssembleObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int TclNRAssembleObjCmd(ClientData clientData,
+MODULE_SCOPE int TclNRAssembleObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
MODULE_SCOPE Tcl_Command TclInitEncodingCmd(Tcl_Interp *interp);
-MODULE_SCOPE int Tcl_EofObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_EofObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_ErrorObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_ErrorObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_EvalObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_EvalObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_ExecObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_ExecObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_ExitObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_ExitObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_ExprObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_ExprObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_FblockedObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_FblockedObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
MODULE_SCOPE int Tcl_FconfigureObjCmd(
- ClientData clientData, Tcl_Interp *interp,
+ void *clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_FcopyObjCmd(ClientData dummy,
+MODULE_SCOPE int Tcl_FcopyObjCmd(void *dummy,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
MODULE_SCOPE Tcl_Command TclInitFileCmd(Tcl_Interp *interp);
-MODULE_SCOPE int Tcl_FileEventObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_FileEventObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_FlushObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_FlushObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_ForObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_ForObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_ForeachObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_ForeachObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_FormatObjCmd(ClientData dummy,
+MODULE_SCOPE int Tcl_FormatObjCmd(void *dummy,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_GetsObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_GetsObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_GlobalObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_GlobalObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_GlobObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_GlobObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_IfObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_IfObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_IncrObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_IncrObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
MODULE_SCOPE Tcl_Command TclInitInfoCmd(Tcl_Interp *interp);
-MODULE_SCOPE int Tcl_InterpObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_InterpObjCmd(void *clientData,
Tcl_Interp *interp, int argc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_JoinObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_JoinObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_LappendObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_LappendObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_LassignObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_LassignObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_LindexObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_LindexObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_LinsertObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_LinsertObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_LlengthObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_LlengthObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_ListObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_ListObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_LmapObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_LmapObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_LoadObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_LoadObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_LpopObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_LpopObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_LrangeObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_LrangeObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_LremoveObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_LremoveObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_LrepeatObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_LrepeatObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_LreplaceObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_LreplaceObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_LreverseObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_LreverseObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_LsearchObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_LsearchObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_LsetObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_LsetObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_LsortObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_LsortObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
MODULE_SCOPE Tcl_Command TclInitNamespaceCmd(Tcl_Interp *interp);
-MODULE_SCOPE int TclNamespaceEnsembleCmd(ClientData dummy,
+MODULE_SCOPE int TclNamespaceEnsembleCmd(void *dummy,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_OpenObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_OpenObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_PackageObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_PackageObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_PidObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_PidObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
MODULE_SCOPE Tcl_Command TclInitPrefixCmd(Tcl_Interp *interp);
-MODULE_SCOPE int Tcl_PutsObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_PutsObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_PwdObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_PwdObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_ReadObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_ReadObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_RegexpObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_RegexpObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_RegsubObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_RegsubObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_RenameObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_RenameObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_RepresentationCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_RepresentationCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_ReturnObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_ReturnObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_ScanObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_ScanObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_SeekObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_SeekObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_SetObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_SetObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_SplitObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_SplitObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_SocketObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_SocketObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_SourceObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_SourceObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
MODULE_SCOPE Tcl_Command TclInitStringCmd(Tcl_Interp *interp);
-MODULE_SCOPE int Tcl_SubstObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_SubstObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_SwitchObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_SwitchObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_TellObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_TellObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_ThrowObjCmd(ClientData dummy, Tcl_Interp *interp,
+MODULE_SCOPE int Tcl_ThrowObjCmd(void *dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_TimeObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_TimeObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_TimeRateObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_TimeRateObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_TraceObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_TraceObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_TryObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_TryObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_UnloadObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_UnloadObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_UnsetObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_UnsetObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_UpdateObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_UpdateObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_UplevelObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_UplevelObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_UpvarObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_UpvarObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_VariableObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_VariableObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_VwaitObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_VwaitObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tcl_WhileObjCmd(ClientData clientData,
+MODULE_SCOPE int Tcl_WhileObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
@@ -3935,103 +3852,103 @@ MODULE_SCOPE int TclCompileBasicMin2ArgCmd(Tcl_Interp *interp,
Tcl_Parse *parsePtr, Command *cmdPtr,
struct CompileEnv *envPtr);
-MODULE_SCOPE int TclInvertOpCmd(ClientData clientData,
+MODULE_SCOPE int TclInvertOpCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
MODULE_SCOPE int TclCompileInvertOpCmd(Tcl_Interp *interp,
Tcl_Parse *parsePtr, Command *cmdPtr,
struct CompileEnv *envPtr);
-MODULE_SCOPE int TclNotOpCmd(ClientData clientData,
+MODULE_SCOPE int TclNotOpCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
MODULE_SCOPE int TclCompileNotOpCmd(Tcl_Interp *interp,
Tcl_Parse *parsePtr, Command *cmdPtr,
struct CompileEnv *envPtr);
-MODULE_SCOPE int TclAddOpCmd(ClientData clientData,
+MODULE_SCOPE int TclAddOpCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
MODULE_SCOPE int TclCompileAddOpCmd(Tcl_Interp *interp,
Tcl_Parse *parsePtr, Command *cmdPtr,
struct CompileEnv *envPtr);
-MODULE_SCOPE int TclMulOpCmd(ClientData clientData,
+MODULE_SCOPE int TclMulOpCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
MODULE_SCOPE int TclCompileMulOpCmd(Tcl_Interp *interp,
Tcl_Parse *parsePtr, Command *cmdPtr,
struct CompileEnv *envPtr);
-MODULE_SCOPE int TclAndOpCmd(ClientData clientData,
+MODULE_SCOPE int TclAndOpCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
MODULE_SCOPE int TclCompileAndOpCmd(Tcl_Interp *interp,
Tcl_Parse *parsePtr, Command *cmdPtr,
struct CompileEnv *envPtr);
-MODULE_SCOPE int TclOrOpCmd(ClientData clientData,
+MODULE_SCOPE int TclOrOpCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
MODULE_SCOPE int TclCompileOrOpCmd(Tcl_Interp *interp,
Tcl_Parse *parsePtr, Command *cmdPtr,
struct CompileEnv *envPtr);
-MODULE_SCOPE int TclXorOpCmd(ClientData clientData,
+MODULE_SCOPE int TclXorOpCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
MODULE_SCOPE int TclCompileXorOpCmd(Tcl_Interp *interp,
Tcl_Parse *parsePtr, Command *cmdPtr,
struct CompileEnv *envPtr);
-MODULE_SCOPE int TclPowOpCmd(ClientData clientData,
+MODULE_SCOPE int TclPowOpCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
MODULE_SCOPE int TclCompilePowOpCmd(Tcl_Interp *interp,
Tcl_Parse *parsePtr, Command *cmdPtr,
struct CompileEnv *envPtr);
-MODULE_SCOPE int TclLshiftOpCmd(ClientData clientData,
+MODULE_SCOPE int TclLshiftOpCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
MODULE_SCOPE int TclCompileLshiftOpCmd(Tcl_Interp *interp,
Tcl_Parse *parsePtr, Command *cmdPtr,
struct CompileEnv *envPtr);
-MODULE_SCOPE int TclRshiftOpCmd(ClientData clientData,
+MODULE_SCOPE int TclRshiftOpCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
MODULE_SCOPE int TclCompileRshiftOpCmd(Tcl_Interp *interp,
Tcl_Parse *parsePtr, Command *cmdPtr,
struct CompileEnv *envPtr);
-MODULE_SCOPE int TclModOpCmd(ClientData clientData,
+MODULE_SCOPE int TclModOpCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
MODULE_SCOPE int TclCompileModOpCmd(Tcl_Interp *interp,
Tcl_Parse *parsePtr, Command *cmdPtr,
struct CompileEnv *envPtr);
-MODULE_SCOPE int TclNeqOpCmd(ClientData clientData,
+MODULE_SCOPE int TclNeqOpCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
MODULE_SCOPE int TclCompileNeqOpCmd(Tcl_Interp *interp,
Tcl_Parse *parsePtr, Command *cmdPtr,
struct CompileEnv *envPtr);
-MODULE_SCOPE int TclStrneqOpCmd(ClientData clientData,
+MODULE_SCOPE int TclStrneqOpCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
MODULE_SCOPE int TclCompileStrneqOpCmd(Tcl_Interp *interp,
Tcl_Parse *parsePtr, Command *cmdPtr,
struct CompileEnv *envPtr);
-MODULE_SCOPE int TclInOpCmd(ClientData clientData,
+MODULE_SCOPE int TclInOpCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
MODULE_SCOPE int TclCompileInOpCmd(Tcl_Interp *interp,
Tcl_Parse *parsePtr, Command *cmdPtr,
struct CompileEnv *envPtr);
-MODULE_SCOPE int TclNiOpCmd(ClientData clientData,
+MODULE_SCOPE int TclNiOpCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
MODULE_SCOPE int TclCompileNiOpCmd(Tcl_Interp *interp,
Tcl_Parse *parsePtr, Command *cmdPtr,
struct CompileEnv *envPtr);
-MODULE_SCOPE int TclMinusOpCmd(ClientData clientData,
+MODULE_SCOPE int TclMinusOpCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
MODULE_SCOPE int TclCompileMinusOpCmd(Tcl_Interp *interp,
Tcl_Parse *parsePtr, Command *cmdPtr,
struct CompileEnv *envPtr);
-MODULE_SCOPE int TclDivOpCmd(ClientData clientData,
+MODULE_SCOPE int TclDivOpCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
MODULE_SCOPE int TclCompileDivOpCmd(Tcl_Interp *interp,
@@ -4079,14 +3996,14 @@ MODULE_SCOPE int TclCompileAssembleCmd(Tcl_Interp *interp,
MODULE_SCOPE Tcl_Obj * TclStringCat(Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[], int flags);
-MODULE_SCOPE int TclStringFirst(Tcl_Obj *needle, Tcl_Obj *haystack,
- int start);
-MODULE_SCOPE int TclStringLast(Tcl_Obj *needle, Tcl_Obj *haystack,
- int last);
+MODULE_SCOPE size_t TclStringFirst(Tcl_Obj *needle, Tcl_Obj *haystack,
+ size_t start);
+MODULE_SCOPE size_t TclStringLast(Tcl_Obj *needle, Tcl_Obj *haystack,
+ size_t last);
MODULE_SCOPE Tcl_Obj * TclStringRepeat(Tcl_Interp *interp, Tcl_Obj *objPtr,
- int count, int flags);
+ size_t count, int flags);
MODULE_SCOPE Tcl_Obj * TclStringReplace(Tcl_Interp *interp, Tcl_Obj *objPtr,
- int first, int count, Tcl_Obj *insertPtr,
+ size_t first, size_t count, Tcl_Obj *insertPtr,
int flags);
MODULE_SCOPE Tcl_Obj * TclStringReverse(Tcl_Obj *objPtr, int flags);
@@ -4201,12 +4118,12 @@ MODULE_SCOPE Tcl_Obj * TclGetArrayDefault(Var *arrayPtr);
*/
MODULE_SCOPE int TclIndexEncode(Tcl_Interp *interp, Tcl_Obj *objPtr,
- int before, int after, int *indexPtr);
-MODULE_SCOPE int TclIndexDecode(int encoded, int endValue);
+ size_t before, size_t after, int *indexPtr);
+MODULE_SCOPE size_t TclIndexDecode(int encoded, size_t endValue);
/* Constants used in index value encoding routines. */
-#define TCL_INDEX_END (-2)
-#define TCL_INDEX_START (0)
+#define TCL_INDEX_END ((size_t)-2)
+#define TCL_INDEX_START ((size_t)0)
/*
*----------------------------------------------------------------
@@ -4273,7 +4190,7 @@ MODULE_SCOPE int TclIndexDecode(int encoded, int endValue);
/*
* Invalidate the string rep first so we can use the bytes value for our
* pointer chain, and signal an obj deletion (as opposed to shimmering) with
- * 'length == -1'.
+ * 'length == TCL_AUTO_LENGTH'.
* Use empty 'if ; else' to handle use in unbraced outer if/else conditions.
*/
@@ -4283,9 +4200,9 @@ MODULE_SCOPE int TclIndexDecode(int encoded, int endValue);
TCL_DTRACE_OBJ_FREE(objPtr); \
if ((objPtr)->bytes \
&& ((objPtr)->bytes != &tclEmptyString)) { \
- ckfree((objPtr)->bytes); \
+ Tcl_Free((objPtr)->bytes); \
} \
- (objPtr)->length = -1; \
+ (objPtr)->length = TCL_AUTO_LENGTH; \
TclFreeObjStorage(objPtr); \
TclIncrObjsFreed(); \
} else { \
@@ -4307,10 +4224,10 @@ MODULE_SCOPE int TclIndexDecode(int encoded, int endValue);
*/
# define TclAllocObjStorageEx(interp, objPtr) \
- (objPtr) = (Tcl_Obj *) ckalloc(sizeof(Tcl_Obj))
+ (objPtr) = (Tcl_Obj *) Tcl_Alloc(sizeof(Tcl_Obj))
# define TclFreeObjStorageEx(interp, objPtr) \
- ckfree(objPtr)
+ Tcl_Free(objPtr)
#undef USE_THREAD_ALLOC
#undef USE_TCLALLOC
@@ -4438,7 +4355,7 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file,
* is referenced multiple times, it should be as simple an expression as
* possible. The ANSI C "prototype" for this macro is:
*
- * MODULE_SCOPE void TclInitStringRep(Tcl_Obj *objPtr, char *bytePtr, int len);
+ * MODULE_SCOPE void TclInitStringRep(Tcl_Obj *objPtr, char *bytePtr, size_t len);
*
* This macro should only be called on an unshared objPtr where
* objPtr->typePtr->freeIntRepProc == NULL
@@ -4450,7 +4367,7 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file,
(objPtr)->bytes = &tclEmptyString; \
(objPtr)->length = 0; \
} else { \
- (objPtr)->bytes = (char *) ckalloc((len) + 1); \
+ (objPtr)->bytes = Tcl_Alloc((len) + 1); \
memcpy((objPtr)->bytes, (bytePtr) ? (bytePtr) : &tclEmptyString, (len)); \
(objPtr)->bytes[len] = '\0'; \
(objPtr)->length = (len); \
@@ -4471,10 +4388,38 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file,
#define TclGetString(objPtr) \
((objPtr)->bytes? (objPtr)->bytes : Tcl_GetString(objPtr))
+#if 0
+ static inline char *TclGetStringFromObj(Tcl_Obj *objPtr, size_t *lenPtr) {
+ char *response = Tcl_GetString(objPtr);
+ *(lenPtr) = objPtr->length;
+ return response;
+ }
+ static inline Tcl_UniChar *TclGetUnicodeFromObj(Tcl_Obj *objPtr, size_t *lenPtr) {
+ Tcl_UniChar *response = Tcl_GetUnicodeFromObj(objPtr, NULL);
+ *(lenPtr) = *((size_t *) (objPtr)->internalRep.twoPtrValue.ptr1);
+ return response;
+ }
+ static inline unsigned char *TclGetByteArrayFromObj(Tcl_Obj *objPtr, size_t *lenPtr) {
+ unsigned char *response = Tcl_GetByteArrayFromObj(objPtr, NULL);
+ if (response) {
+ *(lenPtr) = *((size_t *) (objPtr)->internalRep.twoPtrValue.ptr1);
+ }
+ return response;
+ }
+#else
#define TclGetStringFromObj(objPtr, lenPtr) \
- ((objPtr)->bytes \
- ? (*(lenPtr) = (objPtr)->length, (objPtr)->bytes) \
- : Tcl_GetStringFromObj((objPtr), (lenPtr)))
+ (((objPtr)->bytes \
+ ? NULL : Tcl_GetString((objPtr)), \
+ *(lenPtr) = (objPtr)->length, (objPtr)->bytes))
+#define TclGetUnicodeFromObj(objPtr, lenPtr) \
+ (Tcl_GetUnicodeFromObj((objPtr), NULL), \
+ *(lenPtr) = *((size_t *) (objPtr)->internalRep.twoPtrValue.ptr1), \
+ Tcl_GetUnicodeFromObj((objPtr), NULL))
+#define TclGetByteArrayFromObj(objPtr, lenPtr) \
+ (Tcl_GetByteArrayFromObj((objPtr), NULL) ? \
+ (*(lenPtr) = *((size_t *) (objPtr)->internalRep.twoPtrValue.ptr1), \
+ (unsigned char *)(((size_t *) (objPtr)->internalRep.twoPtrValue.ptr1) + 2)) : NULL)
+#endif
/*
*----------------------------------------------------------------
@@ -4506,7 +4451,7 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file,
#define TclInvalidateStringRep(objPtr) \
if ((objPtr)->bytes != NULL) { \
if ((objPtr)->bytes != &tclEmptyString) { \
- ckfree((objPtr)->bytes); \
+ Tcl_Free((objPtr)->bytes); \
} \
(objPtr)->bytes = NULL; \
}
@@ -4595,20 +4540,20 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file,
if (allocated > TCL_MAX_TOKENS) { \
allocated = TCL_MAX_TOKENS; \
} \
- newPtr = (Tcl_Token *) attemptckrealloc((char *) oldPtr, \
- allocated * sizeof(Tcl_Token)); \
+ newPtr = (Tcl_Token *) Tcl_AttemptRealloc((char *) oldPtr, \
+ (allocated * sizeof(Tcl_Token))); \
if (newPtr == NULL) { \
allocated = _needed + (append) + TCL_MIN_TOKEN_GROWTH; \
if (allocated > TCL_MAX_TOKENS) { \
allocated = TCL_MAX_TOKENS; \
} \
- newPtr = (Tcl_Token *) ckrealloc((char *) oldPtr, \
- allocated * sizeof(Tcl_Token)); \
+ newPtr = (Tcl_Token *) Tcl_Realloc((char *) oldPtr, \
+ (allocated * sizeof(Tcl_Token))); \
} \
(available) = allocated; \
if (oldPtr == NULL) { \
memcpy(newPtr, staticPtr, \
- (used) * sizeof(Tcl_Token)); \
+ ((used) * sizeof(Tcl_Token))); \
} \
(tokenPtr) = newPtr; \
} \
@@ -4644,13 +4589,13 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file,
* "prototype" for this macro is:
*
* MODULE_SCOPE void TclNumUtfChars(int numChars, const char *bytes,
- * int numBytes);
+ * size_t numBytes);
*----------------------------------------------------------------
*/
#define TclNumUtfChars(numChars, bytes, numBytes) \
do { \
- int _count, _i = (numBytes); \
+ size_t _count, _i = (numBytes); \
unsigned char *_str = (unsigned char *) (bytes); \
while (_i && (*_str < 0xC0)) { _i--; _str++; } \
_count = (numBytes) - _i; \
@@ -4793,7 +4738,7 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit;
*
* MODULE_SCOPE void TclNewIntObj(Tcl_Obj *objPtr, Tcl_WideInt w);
* MODULE_SCOPE void TclNewDoubleObj(Tcl_Obj *objPtr, double d);
- * MODULE_SCOPE void TclNewStringObj(Tcl_Obj *objPtr, const char *s, int len);
+ * MODULE_SCOPE void TclNewStringObj(Tcl_Obj *objPtr, const char *s, size_t len);
* MODULE_SCOPE void TclNewLiteralStringObj(Tcl_Obj*objPtr, const char *sLiteral);
*
*----------------------------------------------------------------
@@ -4848,7 +4793,7 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit;
* sizeof(sLiteral "") will fail to compile otherwise.
*/
#define TclNewLiteralStringObj(objPtr, sLiteral) \
- TclNewStringObj((objPtr), (sLiteral), (int) (sizeof(sLiteral "") - 1))
+ TclNewStringObj((objPtr), (sLiteral), sizeof(sLiteral "") - 1)
/*
*----------------------------------------------------------------
@@ -4861,7 +4806,7 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit;
*/
#define TclDStringAppendLiteral(dsPtr, sLiteral) \
- Tcl_DStringAppend((dsPtr), (sLiteral), (int) (sizeof(sLiteral "") - 1))
+ Tcl_DStringAppend((dsPtr), (sLiteral), sizeof(sLiteral "") - 1)
#define TclDStringClear(dsPtr) \
Tcl_DStringSetLength((dsPtr), 0)
@@ -4886,14 +4831,6 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit;
# endif
#endif
-/*
- * Macro to use to find the offset of a field in astructure.
- * Computes number of bytes from beginning of structure to a given field.
- */
-
-#ifndef TCL_NO_DEPRECATED
-# define TclOffset(type, field) ((int) offsetof(type, field))
-#endif
/* Workaround for platforms missing offsetof(), e.g. VC++ 6.0 */
#ifndef offsetof
# define offsetof(type, field) ((size_t) ((char *) &((type *) 0)->field))
@@ -4918,7 +4855,7 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit;
#define TclCleanupCommandMacro(cmdPtr) \
if ((cmdPtr)->refCount-- <= 1) { \
- ckfree(cmdPtr);\
+ Tcl_Free(cmdPtr);\
}
/*
@@ -4981,13 +4918,13 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit;
Tcl_Obj *_objPtr; \
TCL_CT_ASSERT((nbytes)<=sizeof(Tcl_Obj)); \
TclIncrObjsAllocated(); \
- TclAllocObjStorageEx((interp), (_objPtr)); \
- memPtr = (ClientData) (_objPtr); \
+ TclAllocObjStorageEx((interp), _objPtr); \
+ memPtr = (void *)_objPtr; \
} while (0)
#define TclSmallFreeEx(interp, memPtr) \
do { \
- TclFreeObjStorageEx((interp), (Tcl_Obj *) (memPtr)); \
+ TclFreeObjStorageEx((interp), (Tcl_Obj *)memPtr); \
TclIncrObjsFreed(); \
} while (0)
@@ -4997,7 +4934,7 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit;
Tcl_Obj *_objPtr; \
TCL_CT_ASSERT((nbytes)<=sizeof(Tcl_Obj)); \
TclNewObj(_objPtr); \
- memPtr = (ClientData) _objPtr; \
+ memPtr = (void *)_objPtr; \
} while (0)
#define TclSmallFreeEx(interp, memPtr) \
@@ -5011,6 +4948,21 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit;
#endif /* TCL_MEM_DEBUG */
/*
+ * Macros to convert size_t to wide-int (and wide-int object) considering
+ * platform-related negative value ((size_t)-1), if wide-int and size_t
+ * have different dimensions (e. g. 32-bit platform).
+ */
+
+#if (!defined(TCL_WIDE_INT_IS_LONG) || (LONG_MAX > UINT_MAX)) && (SIZE_MAX <= UINT_MAX)
+# define TclWideIntFromSize(value) (((Tcl_WideInt)(((size_t)(value))+1))-1)
+# define TclNewWideIntObjFromSize(value) \
+ Tcl_NewWideIntObj(TclWideIntFromSize(value))
+#else
+# define TclWideIntFromSize(value) ((Tcl_WideInt)(value))
+# define TclNewWideIntObjFromSize Tcl_NewWideIntObj
+#endif
+
+/*
* Support for Clang Static Analyzer <http://clang-analyzer.llvm.org>
*/
@@ -5046,7 +4998,7 @@ void Tcl_Panic(const char *, ...) __attribute__((analyzer_noreturn));
typedef struct NRE_callback {
Tcl_NRPostProc *procPtr;
- ClientData data[4];
+ void *data[4];
struct NRE_callback *nextPtr;
} NRE_callback;
@@ -5061,10 +5013,10 @@ typedef struct NRE_callback {
NRE_callback *_callbackPtr; \
TCLNR_ALLOC((interp), (_callbackPtr)); \
_callbackPtr->procPtr = (postProcPtr); \
- _callbackPtr->data[0] = (ClientData)(data0); \
- _callbackPtr->data[1] = (ClientData)(data1); \
- _callbackPtr->data[2] = (ClientData)(data2); \
- _callbackPtr->data[3] = (ClientData)(data3); \
+ _callbackPtr->data[0] = (void *)(data0); \
+ _callbackPtr->data[1] = (void *)(data1); \
+ _callbackPtr->data[2] = (void *)(data2); \
+ _callbackPtr->data[3] = (void *)(data3); \
_callbackPtr->nextPtr = TOP_CB(interp); \
TOP_CB(interp) = _callbackPtr; \
} while (0)
@@ -5075,8 +5027,8 @@ typedef struct NRE_callback {
#define TCLNR_FREE(interp, ptr) TclSmallFreeEx((interp), (ptr))
#else
#define TCLNR_ALLOC(interp, ptr) \
- (ptr = ((ClientData) ckalloc(sizeof(NRE_callback))))
-#define TCLNR_FREE(interp, ptr) ckfree(ptr)
+ (ptr = (Tcl_Alloc(sizeof(NRE_callback))))
+#define TCLNR_FREE(interp, ptr) Tcl_Free(ptr)
#endif
#if NRE_ENABLE_ASSERTS
@@ -5090,9 +5042,9 @@ typedef struct NRE_callback {
#include "tclTomMathDecls.h"
#if !defined(USE_TCL_STUBS) && !defined(TCL_MEM_DEBUG)
-#define Tcl_AttemptAlloc(size) TclpAlloc(size)
-#define Tcl_AttemptRealloc(ptr, size) TclpRealloc((ptr), (size))
-#define Tcl_Free(ptr) TclpFree(ptr)
+#define Tcl_AttemptAlloc TclpAlloc
+#define Tcl_AttemptRealloc TclpRealloc
+#define Tcl_Free TclpFree
#endif
#endif /* _TCLINT */
diff --git a/generic/tclIntDecls.h b/generic/tclIntDecls.h
index 16bcdf8..260ef3e 100644
--- a/generic/tclIntDecls.h
+++ b/generic/tclIntDecls.h
@@ -27,23 +27,6 @@
# endif
#endif
-#if !defined(TCL_NO_DEPRECATED) && (TCL_MAJOR_VERSION < 9)
-# define tclGetIntForIndex tcl_GetIntForIndex
-/* Those macro's are especially for Itcl 3.4 compatibility */
-# define tclCreateNamespace tcl_CreateNamespace
-# define tclDeleteNamespace tcl_DeleteNamespace
-# define tclAppendExportList tcl_AppendExportList
-# define tclExport tcl_Export
-# define tclImport tcl_Import
-# define tclForgetImport tcl_ForgetImport
-# define tclGetCurrentNamespace_ tcl_GetCurrentNamespace
-# define tclGetGlobalNamespace_ tcl_GetGlobalNamespace
-# define tclFindNamespace tcl_FindNamespace
-# define tclFindCommand tcl_FindCommand
-# define tclGetCommandFromObj tcl_GetCommandFromObj
-# define tclGetCommandFullName tcl_GetCommandFullName
-#endif /* !defined(TCL_NO_DEPRECATED) */
-
/*
* WARNING: This file is automatically generated by the tools/genStubs.tcl
* script. Any modifications to the function declarations below should be made
@@ -72,13 +55,9 @@ EXTERN int TclCleanupChildren(Tcl_Interp *interp, int numPids,
/* 6 */
EXTERN void TclCleanupCommand(Command *cmdPtr);
/* 7 */
-EXTERN int TclCopyAndCollapse(int count, const char *src,
+EXTERN size_t TclCopyAndCollapse(size_t count, const char *src,
char *dst);
-/* 8 */
-TCL_DEPRECATED("")
-int TclCopyChannelOld(Tcl_Interp *interp,
- Tcl_Channel inChan, Tcl_Channel outChan,
- int toRead, Tcl_Obj *cmdPtr);
+/* Slot 8 is reserved */
/* 9 */
EXTERN int TclCreatePipeline(Tcl_Interp *interp, int argc,
const char **argv, Tcl_Pid **pidArrayPtr,
@@ -96,7 +75,7 @@ EXTERN void TclDeleteVars(Interp *iPtr,
TclVarHashTable *tablePtr);
/* Slot 13 is reserved */
/* 14 */
-EXTERN int TclDumpMemoryInfo(ClientData clientData, int flags);
+EXTERN int TclDumpMemoryInfo(void *clientData, int flags);
/* Slot 15 is reserved */
/* 16 */
EXTERN void TclExprFloatError(Tcl_Interp *interp, double value);
@@ -109,12 +88,12 @@ EXTERN void TclExprFloatError(Tcl_Interp *interp, double value);
EXTERN int TclFindElement(Tcl_Interp *interp,
const char *listStr, int listLength,
const char **elementPtr,
- const char **nextPtr, int *sizePtr,
+ const char **nextPtr, size_t *sizePtr,
int *bracePtr);
/* 23 */
EXTERN Proc * TclFindProc(Interp *iPtr, const char *procName);
/* 24 */
-EXTERN int TclFormatInt(char *buffer, Tcl_WideInt n);
+EXTERN size_t TclFormatInt(char *buffer, Tcl_WideInt n);
/* 25 */
EXTERN void TclFreePackageInfo(Interp *iPtr);
/* Slot 26 is reserved */
@@ -129,10 +108,7 @@ EXTERN const char * TclGetExtension(const char *name);
EXTERN int TclGetFrame(Tcl_Interp *interp, const char *str,
CallFrame **framePtrPtr);
/* Slot 33 is reserved */
-/* 34 */
-TCL_DEPRECATED("Use Tcl_GetIntForIndex")
-int TclGetIntForIndex(Tcl_Interp *interp,
- Tcl_Obj *objPtr, int endValue, int *indexPtr);
+/* Slot 34 is reserved */
/* Slot 35 is reserved */
/* Slot 36 is reserved */
/* 37 */
@@ -153,7 +129,7 @@ EXTERN int TclGetOpenMode(Tcl_Interp *interp, const char *str,
/* 41 */
EXTERN Tcl_Command TclGetOriginalCommand(Tcl_Command command);
/* 42 */
-EXTERN CONST86 char * TclpGetUserHome(const char *name,
+EXTERN const char * TclpGetUserHome(const char *name,
Tcl_DString *bufferPtr);
/* Slot 43 is reserved */
/* 44 */
@@ -173,11 +149,11 @@ EXTERN void TclInitCompiledLocals(Tcl_Interp *interp,
EXTERN int TclInterpInit(Tcl_Interp *interp);
/* Slot 52 is reserved */
/* 53 */
-EXTERN int TclInvokeObjectCommand(ClientData clientData,
+EXTERN int TclInvokeObjectCommand(void *clientData,
Tcl_Interp *interp, int argc,
const char **argv);
/* 54 */
-EXTERN int TclInvokeStringCommand(ClientData clientData,
+EXTERN int TclInvokeStringCommand(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
/* 55 */
@@ -197,7 +173,7 @@ EXTERN Tcl_Obj * TclNewProcBodyObj(Proc *procPtr);
/* 62 */
EXTERN int TclObjCommandComplete(Tcl_Obj *cmdPtr);
/* 63 */
-EXTERN int TclObjInterpProc(ClientData clientData,
+EXTERN int TclObjInterpProc(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
/* 64 */
@@ -208,36 +184,30 @@ EXTERN int TclObjInvoke(Tcl_Interp *interp, int objc,
/* Slot 67 is reserved */
/* Slot 68 is reserved */
/* 69 */
-EXTERN char * TclpAlloc(unsigned int size);
+EXTERN void * TclpAlloc(size_t size);
/* Slot 70 is reserved */
/* Slot 71 is reserved */
/* Slot 72 is reserved */
/* Slot 73 is reserved */
/* 74 */
-EXTERN void TclpFree(char *ptr);
+EXTERN void TclpFree(void *ptr);
/* 75 */
-EXTERN unsigned long TclpGetClicks(void);
+EXTERN Tcl_WideUInt TclpGetClicks(void);
/* 76 */
-EXTERN unsigned long TclpGetSeconds(void);
-/* 77 */
-TCL_DEPRECATED("")
-void TclpGetTime(Tcl_Time *time);
+EXTERN Tcl_WideUInt TclpGetSeconds(void);
+/* Slot 77 is reserved */
/* Slot 78 is reserved */
/* Slot 79 is reserved */
/* Slot 80 is reserved */
/* 81 */
-EXTERN char * TclpRealloc(char *ptr, unsigned int size);
+EXTERN void * TclpRealloc(void *ptr, size_t size);
/* Slot 82 is reserved */
/* Slot 83 is reserved */
/* Slot 84 is reserved */
/* Slot 85 is reserved */
/* Slot 86 is reserved */
/* Slot 87 is reserved */
-/* 88 */
-TCL_DEPRECATED("")
-char * TclPrecTraceProc(ClientData clientData,
- Tcl_Interp *interp, const char *name1,
- const char *name2, int flags);
+/* Slot 88 is reserved */
/* 89 */
EXTERN int TclPreventAliasLoop(Tcl_Interp *interp,
Tcl_Interp *cmdInterp, Tcl_Command cmd);
@@ -250,7 +220,7 @@ EXTERN int TclProcCompileProc(Tcl_Interp *interp, Proc *procPtr,
const char *description,
const char *procName);
/* 93 */
-EXTERN void TclProcDeleteProc(ClientData clientData);
+EXTERN void TclProcDeleteProc(void *clientData);
/* Slot 94 is reserved */
/* Slot 95 is reserved */
/* 96 */
@@ -264,15 +234,13 @@ EXTERN int TclServiceIdle(void);
/* Slot 99 is reserved */
/* Slot 100 is reserved */
/* 101 */
-EXTERN CONST86 char * TclSetPreInitScript(const char *string);
+EXTERN const char * TclSetPreInitScript(const char *string);
/* 102 */
EXTERN void TclSetupEnv(Tcl_Interp *interp);
/* 103 */
EXTERN int TclSockGetPort(Tcl_Interp *interp, const char *str,
const char *proto, int *portPtr);
-/* 104 */
-TCL_DEPRECATED("")
-int TclSockMinimumBuffersOld(int sock, int size);
+/* Slot 104 is reserved */
/* Slot 105 is reserved */
/* Slot 106 is reserved */
/* Slot 107 is reserved */
@@ -288,25 +256,12 @@ EXTERN void Tcl_AddInterpResolvers(Tcl_Interp *interp,
Tcl_ResolveCmdProc *cmdProc,
Tcl_ResolveVarProc *varProc,
Tcl_ResolveCompiledVarProc *compiledVarProc);
-/* 112 */
-EXTERN int TclAppendExportList(Tcl_Interp *interp,
- Tcl_Namespace *nsPtr, Tcl_Obj *objPtr);
-/* 113 */
-EXTERN Tcl_Namespace * TclCreateNamespace(Tcl_Interp *interp,
- const char *name, ClientData clientData,
- Tcl_NamespaceDeleteProc *deleteProc);
-/* 114 */
-EXTERN void TclDeleteNamespace(Tcl_Namespace *nsPtr);
-/* 115 */
-EXTERN int TclExport(Tcl_Interp *interp, Tcl_Namespace *nsPtr,
- const char *pattern, int resetListFirst);
-/* 116 */
-EXTERN Tcl_Command TclFindCommand(Tcl_Interp *interp, const char *name,
- Tcl_Namespace *contextNsPtr, int flags);
-/* 117 */
-EXTERN Tcl_Namespace * TclFindNamespace(Tcl_Interp *interp,
- const char *name,
- Tcl_Namespace *contextNsPtr, int flags);
+/* Slot 112 is reserved */
+/* Slot 113 is reserved */
+/* Slot 114 is reserved */
+/* Slot 115 is reserved */
+/* Slot 116 is reserved */
+/* Slot 117 is reserved */
/* 118 */
EXTERN int Tcl_GetInterpResolvers(Tcl_Interp *interp,
const char *name, Tcl_ResolverInfo *resInfo);
@@ -318,25 +273,15 @@ EXTERN int Tcl_GetNamespaceResolvers(
EXTERN Tcl_Var Tcl_FindNamespaceVar(Tcl_Interp *interp,
const char *name,
Tcl_Namespace *contextNsPtr, int flags);
-/* 121 */
-EXTERN int TclForgetImport(Tcl_Interp *interp,
- Tcl_Namespace *nsPtr, const char *pattern);
-/* 122 */
-EXTERN Tcl_Command TclGetCommandFromObj(Tcl_Interp *interp,
- Tcl_Obj *objPtr);
-/* 123 */
-EXTERN void TclGetCommandFullName(Tcl_Interp *interp,
- Tcl_Command command, Tcl_Obj *objPtr);
-/* 124 */
-EXTERN Tcl_Namespace * TclGetCurrentNamespace_(Tcl_Interp *interp);
-/* 125 */
-EXTERN Tcl_Namespace * TclGetGlobalNamespace_(Tcl_Interp *interp);
+/* Slot 121 is reserved */
+/* Slot 122 is reserved */
+/* Slot 123 is reserved */
+/* Slot 124 is reserved */
+/* Slot 125 is reserved */
/* 126 */
EXTERN void Tcl_GetVariableFullName(Tcl_Interp *interp,
Tcl_Var variable, Tcl_Obj *objPtr);
-/* 127 */
-EXTERN int TclImport(Tcl_Interp *interp, Tcl_Namespace *nsPtr,
- const char *pattern, int allowOverwrite);
+/* Slot 127 is reserved */
/* 128 */
EXTERN void Tcl_PopCallFrame(Tcl_Interp *interp);
/* 129 */
@@ -354,9 +299,7 @@ EXTERN void Tcl_SetNamespaceResolvers(
Tcl_ResolveCompiledVarProc *compiledVarProc);
/* 132 */
EXTERN int TclpHasSockets(Tcl_Interp *interp);
-/* 133 */
-TCL_DEPRECATED("")
-struct tm * TclpGetDate(const time_t *time, int useGMT);
+/* Slot 133 is reserved */
/* Slot 134 is reserved */
/* Slot 135 is reserved */
/* Slot 136 is reserved */
@@ -370,7 +313,7 @@ EXTERN const char * TclpGetCwd(Tcl_Interp *interp, Tcl_DString *cwdPtr);
/* 142 */
EXTERN int TclSetByteCodeFromAny(Tcl_Interp *interp,
Tcl_Obj *objPtr, CompileHookProc *hookProc,
- ClientData clientData);
+ void *clientData);
/* 143 */
EXTERN int TclAddLiteralObj(struct CompileEnv *envPtr,
Tcl_Obj *objPtr, LiteralEntry **litPtrPtr);
@@ -390,8 +333,8 @@ EXTERN void TclHandleRelease(TclHandle handle);
/* 150 */
EXTERN int TclRegAbout(Tcl_Interp *interp, Tcl_RegExp re);
/* 151 */
-EXTERN void TclRegExpRangeUniChar(Tcl_RegExp re, int index,
- int *startPtr, int *endPtr);
+EXTERN void TclRegExpRangeUniChar(Tcl_RegExp re, size_t index,
+ size_t *startPtr, size_t *endPtr);
/* 152 */
EXTERN void TclSetLibraryPath(Tcl_Obj *pathPtr);
/* 153 */
@@ -404,18 +347,14 @@ EXTERN void TclRegError(Tcl_Interp *interp, const char *msg,
/* 157 */
EXTERN Var * TclVarTraceExists(Tcl_Interp *interp,
const char *varName);
-/* 158 */
-TCL_DEPRECATED("use public Tcl_SetStartupScript()")
-void TclSetStartupScriptFileName(const char *filename);
-/* 159 */
-TCL_DEPRECATED("use public Tcl_GetStartupScript()")
-const char * TclGetStartupScriptFileName(void);
+/* Slot 158 is reserved */
+/* Slot 159 is reserved */
/* Slot 160 is reserved */
/* 161 */
EXTERN int TclChannelTransform(Tcl_Interp *interp,
Tcl_Channel chan, Tcl_Obj *cmdObjPtr);
/* 162 */
-EXTERN void TclChannelEventScriptInvoker(ClientData clientData,
+EXTERN void TclChannelEventScriptInvoker(void *clientData,
int flags);
/* 163 */
EXTERN const void * TclGetInstructionTable(void);
@@ -427,31 +366,27 @@ EXTERN void TclpSetInitialEncodings(void);
EXTERN int TclListObjSetElement(Tcl_Interp *interp,
Tcl_Obj *listPtr, int index,
Tcl_Obj *valuePtr);
-/* 167 */
-TCL_DEPRECATED("use public Tcl_SetStartupScript()")
-void TclSetStartupScriptPath(Tcl_Obj *pathPtr);
-/* 168 */
-TCL_DEPRECATED("use public Tcl_GetStartupScript()")
-Tcl_Obj * TclGetStartupScriptPath(void);
+/* Slot 167 is reserved */
+/* Slot 168 is reserved */
/* 169 */
EXTERN int TclpUtfNcmp2(const char *s1, const char *s2,
- unsigned long n);
+ size_t n);
/* 170 */
EXTERN int TclCheckInterpTraces(Tcl_Interp *interp,
- const char *command, int numChars,
+ const char *command, size_t numChars,
Command *cmdPtr, int result, int traceFlags,
int objc, Tcl_Obj *const objv[]);
/* 171 */
EXTERN int TclCheckExecutionTraces(Tcl_Interp *interp,
- const char *command, int numChars,
+ const char *command, size_t numChars,
Command *cmdPtr, int result, int traceFlags,
int objc, Tcl_Obj *const objv[]);
/* 172 */
EXTERN int TclInThreadExit(void);
/* 173 */
EXTERN int TclUniCharMatch(const Tcl_UniChar *string,
- int strLen, const Tcl_UniChar *pattern,
- int ptnLen, int flags);
+ size_t strLen, const Tcl_UniChar *pattern,
+ size_t ptnLen, int flags);
/* Slot 174 is reserved */
/* 175 */
EXTERN int TclCallVarTraces(Interp *iPtr, Var *arrayPtr,
@@ -464,19 +399,12 @@ EXTERN void TclCleanupVar(Var *varPtr, Var *arrayPtr);
EXTERN void TclVarErrMsg(Tcl_Interp *interp, const char *part1,
const char *part2, const char *operation,
const char *reason);
-/* 178 */
-EXTERN void TclSetStartupScript(Tcl_Obj *pathPtr,
- const char *encodingName);
-/* 179 */
-EXTERN Tcl_Obj * TclGetStartupScript(const char **encodingNamePtr);
+/* Slot 178 is reserved */
+/* Slot 179 is reserved */
/* Slot 180 is reserved */
/* Slot 181 is reserved */
-/* 182 */
-TCL_DEPRECATED("")
-struct tm * TclpLocaltime(const time_t *clock);
-/* 183 */
-TCL_DEPRECATED("")
-struct tm * TclpGmtime(const time_t *clock);
+/* Slot 182 is reserved */
+/* Slot 183 is reserved */
/* Slot 184 is reserved */
/* Slot 185 is reserved */
/* Slot 186 is reserved */
@@ -529,7 +457,7 @@ EXTERN Tcl_Obj * TclGetObjNameOfExecutable(void);
EXTERN void TclSetObjNameOfExecutable(Tcl_Obj *name,
Tcl_Encoding encoding);
/* 215 */
-EXTERN void * TclStackAlloc(Tcl_Interp *interp, int numBytes);
+EXTERN void * TclStackAlloc(Tcl_Interp *interp, size_t numBytes);
/* 216 */
EXTERN void TclStackFree(Tcl_Interp *interp, void *freePtr);
/* 217 */
@@ -553,7 +481,7 @@ EXTERN Tcl_Obj * TclTraceDictPath(Tcl_Interp *interp,
/* 226 */
EXTERN int TclObjBeingDeleted(Tcl_Obj *objPtr);
/* 227 */
-EXTERN void TclSetNsPath(Namespace *nsPtr, int pathLength,
+EXTERN void TclSetNsPath(Namespace *nsPtr, size_t pathLength,
Tcl_Namespace *pathAry[]);
/* Slot 228 is reserved */
/* 229 */
@@ -579,15 +507,12 @@ EXTERN Var * TclVarHashCreateVar(TclVarHashTable *tablePtr,
/* 235 */
EXTERN void TclInitVarHashTable(TclVarHashTable *tablePtr,
Namespace *nsPtr);
-/* 236 */
-TCL_DEPRECATED("use Tcl_BackgroundException")
-void TclBackgroundException(Tcl_Interp *interp, int code);
+/* Slot 236 is reserved */
/* 237 */
EXTERN int TclResetCancellation(Tcl_Interp *interp, int force);
/* 238 */
-EXTERN int TclNRInterpProc(ClientData clientData,
- Tcl_Interp *interp, int objc,
- Tcl_Obj *const objv[]);
+EXTERN int TclNRInterpProc(void *clientData, Tcl_Interp *interp,
+ int objc, Tcl_Obj *const objv[]);
/* 239 */
EXTERN int TclNRInterpProcCore(Tcl_Interp *interp,
Tcl_Obj *procNameObj, int skip,
@@ -610,7 +535,7 @@ EXTERN Tcl_HashTable * TclGetNamespaceChildTable(Tcl_Namespace *nsPtr);
EXTERN Tcl_HashTable * TclGetNamespaceCommandTable(Tcl_Namespace *nsPtr);
/* 246 */
EXTERN int TclInitRewriteEnsemble(Tcl_Interp *interp,
- int numRemoved, int numInserted,
+ size_t numRemoved, size_t numInserted,
Tcl_Obj *const *objv);
/* 247 */
EXTERN void TclResetRewriteEnsemble(Tcl_Interp *interp,
@@ -627,7 +552,7 @@ EXTERN void TclSetSlaveCancelFlags(Tcl_Interp *interp, int flags,
int force);
/* 251 */
EXTERN int TclRegisterLiteral(void *envPtr, const char *bytes,
- int length, int flags);
+ size_t length, int flags);
/* 252 */
EXTERN Tcl_Obj * TclPtrGetVar(Tcl_Interp *interp, Tcl_Var varPtr,
Tcl_Var arrayPtr, Tcl_Obj *part1Ptr,
@@ -670,14 +595,14 @@ typedef struct TclIntStubs {
void (*reserved4)(void);
int (*tclCleanupChildren) (Tcl_Interp *interp, int numPids, Tcl_Pid *pidPtr, Tcl_Channel errorChan); /* 5 */
void (*tclCleanupCommand) (Command *cmdPtr); /* 6 */
- int (*tclCopyAndCollapse) (int count, const char *src, char *dst); /* 7 */
- TCL_DEPRECATED_API("") int (*tclCopyChannelOld) (Tcl_Interp *interp, Tcl_Channel inChan, Tcl_Channel outChan, int toRead, Tcl_Obj *cmdPtr); /* 8 */
+ size_t (*tclCopyAndCollapse) (size_t count, const char *src, char *dst); /* 7 */
+ void (*reserved8)(void);
int (*tclCreatePipeline) (Tcl_Interp *interp, int argc, const char **argv, Tcl_Pid **pidArrayPtr, TclFile *inPipePtr, TclFile *outPipePtr, TclFile *errFilePtr); /* 9 */
int (*tclCreateProc) (Tcl_Interp *interp, Namespace *nsPtr, const char *procName, Tcl_Obj *argsPtr, Tcl_Obj *bodyPtr, Proc **procPtrPtr); /* 10 */
void (*tclDeleteCompiledLocalVars) (Interp *iPtr, CallFrame *framePtr); /* 11 */
void (*tclDeleteVars) (Interp *iPtr, TclVarHashTable *tablePtr); /* 12 */
void (*reserved13)(void);
- int (*tclDumpMemoryInfo) (ClientData clientData, int flags); /* 14 */
+ int (*tclDumpMemoryInfo) (void *clientData, int flags); /* 14 */
void (*reserved15)(void);
void (*tclExprFloatError) (Tcl_Interp *interp, double value); /* 16 */
void (*reserved17)(void);
@@ -685,9 +610,9 @@ typedef struct TclIntStubs {
void (*reserved19)(void);
void (*reserved20)(void);
void (*reserved21)(void);
- int (*tclFindElement) (Tcl_Interp *interp, const char *listStr, int listLength, const char **elementPtr, const char **nextPtr, int *sizePtr, int *bracePtr); /* 22 */
+ int (*tclFindElement) (Tcl_Interp *interp, const char *listStr, int listLength, const char **elementPtr, const char **nextPtr, size_t *sizePtr, int *bracePtr); /* 22 */
Proc * (*tclFindProc) (Interp *iPtr, const char *procName); /* 23 */
- int (*tclFormatInt) (char *buffer, Tcl_WideInt n); /* 24 */
+ size_t (*tclFormatInt) (char *buffer, Tcl_WideInt n); /* 24 */
void (*tclFreePackageInfo) (Interp *iPtr); /* 25 */
void (*reserved26)(void);
void (*reserved27)(void);
@@ -697,7 +622,7 @@ typedef struct TclIntStubs {
const char * (*tclGetExtension) (const char *name); /* 31 */
int (*tclGetFrame) (Tcl_Interp *interp, const char *str, CallFrame **framePtrPtr); /* 32 */
void (*reserved33)(void);
- TCL_DEPRECATED_API("Use Tcl_GetIntForIndex") int (*tclGetIntForIndex) (Tcl_Interp *interp, Tcl_Obj *objPtr, int endValue, int *indexPtr); /* 34 */
+ void (*reserved34)(void);
void (*reserved35)(void);
void (*reserved36)(void);
int (*tclGetLoadedPackages) (Tcl_Interp *interp, const char *targetName); /* 37 */
@@ -705,7 +630,7 @@ typedef struct TclIntStubs {
TclObjCmdProcType (*tclGetObjInterpProc) (void); /* 39 */
int (*tclGetOpenMode) (Tcl_Interp *interp, const char *str, int *seekFlagPtr); /* 40 */
Tcl_Command (*tclGetOriginalCommand) (Tcl_Command command); /* 41 */
- CONST86 char * (*tclpGetUserHome) (const char *name, Tcl_DString *bufferPtr); /* 42 */
+ const char * (*tclpGetUserHome) (const char *name, Tcl_DString *bufferPtr); /* 42 */
void (*reserved43)(void);
int (*tclGuessPackageName) (const char *fileName, Tcl_DString *bufPtr); /* 44 */
int (*tclHideUnsafeCommands) (Tcl_Interp *interp); /* 45 */
@@ -716,8 +641,8 @@ typedef struct TclIntStubs {
void (*tclInitCompiledLocals) (Tcl_Interp *interp, CallFrame *framePtr, Namespace *nsPtr); /* 50 */
int (*tclInterpInit) (Tcl_Interp *interp); /* 51 */
void (*reserved52)(void);
- int (*tclInvokeObjectCommand) (ClientData clientData, Tcl_Interp *interp, int argc, const char **argv); /* 53 */
- int (*tclInvokeStringCommand) (ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* 54 */
+ int (*tclInvokeObjectCommand) (void *clientData, Tcl_Interp *interp, int argc, const char **argv); /* 53 */
+ int (*tclInvokeStringCommand) (void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* 54 */
Proc * (*tclIsProc) (Command *cmdPtr); /* 55 */
void (*reserved56)(void);
void (*reserved57)(void);
@@ -726,37 +651,37 @@ typedef struct TclIntStubs {
int (*tclNeedSpace) (const char *start, const char *end); /* 60 */
Tcl_Obj * (*tclNewProcBodyObj) (Proc *procPtr); /* 61 */
int (*tclObjCommandComplete) (Tcl_Obj *cmdPtr); /* 62 */
- int (*tclObjInterpProc) (ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* 63 */
+ int (*tclObjInterpProc) (void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* 63 */
int (*tclObjInvoke) (Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], int flags); /* 64 */
void (*reserved65)(void);
void (*reserved66)(void);
void (*reserved67)(void);
void (*reserved68)(void);
- char * (*tclpAlloc) (unsigned int size); /* 69 */
+ void * (*tclpAlloc) (size_t size); /* 69 */
void (*reserved70)(void);
void (*reserved71)(void);
void (*reserved72)(void);
void (*reserved73)(void);
- void (*tclpFree) (char *ptr); /* 74 */
- unsigned long (*tclpGetClicks) (void); /* 75 */
- unsigned long (*tclpGetSeconds) (void); /* 76 */
- TCL_DEPRECATED_API("") void (*tclpGetTime) (Tcl_Time *time); /* 77 */
+ void (*tclpFree) (void *ptr); /* 74 */
+ Tcl_WideUInt (*tclpGetClicks) (void); /* 75 */
+ Tcl_WideUInt (*tclpGetSeconds) (void); /* 76 */
+ void (*reserved77)(void);
void (*reserved78)(void);
void (*reserved79)(void);
void (*reserved80)(void);
- char * (*tclpRealloc) (char *ptr, unsigned int size); /* 81 */
+ void * (*tclpRealloc) (void *ptr, size_t size); /* 81 */
void (*reserved82)(void);
void (*reserved83)(void);
void (*reserved84)(void);
void (*reserved85)(void);
void (*reserved86)(void);
void (*reserved87)(void);
- TCL_DEPRECATED_API("") char * (*tclPrecTraceProc) (ClientData clientData, Tcl_Interp *interp, const char *name1, const char *name2, int flags); /* 88 */
+ void (*reserved88)(void);
int (*tclPreventAliasLoop) (Tcl_Interp *interp, Tcl_Interp *cmdInterp, Tcl_Command cmd); /* 89 */
void (*reserved90)(void);
void (*tclProcCleanupProc) (Proc *procPtr); /* 91 */
int (*tclProcCompileProc) (Tcl_Interp *interp, Proc *procPtr, Tcl_Obj *bodyPtr, Namespace *nsPtr, const char *description, const char *procName); /* 92 */
- void (*tclProcDeleteProc) (ClientData clientData); /* 93 */
+ void (*tclProcDeleteProc) (void *clientData); /* 93 */
void (*reserved94)(void);
void (*reserved95)(void);
int (*tclRenameCommand) (Tcl_Interp *interp, const char *oldName, const char *newName); /* 96 */
@@ -764,10 +689,10 @@ typedef struct TclIntStubs {
int (*tclServiceIdle) (void); /* 98 */
void (*reserved99)(void);
void (*reserved100)(void);
- CONST86 char * (*tclSetPreInitScript) (const char *string); /* 101 */
+ const char * (*tclSetPreInitScript) (const char *string); /* 101 */
void (*tclSetupEnv) (Tcl_Interp *interp); /* 102 */
int (*tclSockGetPort) (Tcl_Interp *interp, const char *str, const char *proto, int *portPtr); /* 103 */
- TCL_DEPRECATED_API("") int (*tclSockMinimumBuffersOld) (int sock, int size); /* 104 */
+ void (*reserved104)(void);
void (*reserved105)(void);
void (*reserved106)(void);
void (*reserved107)(void);
@@ -775,28 +700,28 @@ typedef struct TclIntStubs {
int (*tclUpdateReturnInfo) (Interp *iPtr); /* 109 */
int (*tclSockMinimumBuffers) (void *sock, int size); /* 110 */
void (*tcl_AddInterpResolvers) (Tcl_Interp *interp, const char *name, Tcl_ResolveCmdProc *cmdProc, Tcl_ResolveVarProc *varProc, Tcl_ResolveCompiledVarProc *compiledVarProc); /* 111 */
- int (*tclAppendExportList) (Tcl_Interp *interp, Tcl_Namespace *nsPtr, Tcl_Obj *objPtr); /* 112 */
- Tcl_Namespace * (*tclCreateNamespace) (Tcl_Interp *interp, const char *name, ClientData clientData, Tcl_NamespaceDeleteProc *deleteProc); /* 113 */
- void (*tclDeleteNamespace) (Tcl_Namespace *nsPtr); /* 114 */
- int (*tclExport) (Tcl_Interp *interp, Tcl_Namespace *nsPtr, const char *pattern, int resetListFirst); /* 115 */
- Tcl_Command (*tclFindCommand) (Tcl_Interp *interp, const char *name, Tcl_Namespace *contextNsPtr, int flags); /* 116 */
- Tcl_Namespace * (*tclFindNamespace) (Tcl_Interp *interp, const char *name, Tcl_Namespace *contextNsPtr, int flags); /* 117 */
+ void (*reserved112)(void);
+ void (*reserved113)(void);
+ void (*reserved114)(void);
+ void (*reserved115)(void);
+ void (*reserved116)(void);
+ void (*reserved117)(void);
int (*tcl_GetInterpResolvers) (Tcl_Interp *interp, const char *name, Tcl_ResolverInfo *resInfo); /* 118 */
int (*tcl_GetNamespaceResolvers) (Tcl_Namespace *namespacePtr, Tcl_ResolverInfo *resInfo); /* 119 */
Tcl_Var (*tcl_FindNamespaceVar) (Tcl_Interp *interp, const char *name, Tcl_Namespace *contextNsPtr, int flags); /* 120 */
- int (*tclForgetImport) (Tcl_Interp *interp, Tcl_Namespace *nsPtr, const char *pattern); /* 121 */
- Tcl_Command (*tclGetCommandFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr); /* 122 */
- void (*tclGetCommandFullName) (Tcl_Interp *interp, Tcl_Command command, Tcl_Obj *objPtr); /* 123 */
- Tcl_Namespace * (*tclGetCurrentNamespace_) (Tcl_Interp *interp); /* 124 */
- Tcl_Namespace * (*tclGetGlobalNamespace_) (Tcl_Interp *interp); /* 125 */
+ void (*reserved121)(void);
+ void (*reserved122)(void);
+ void (*reserved123)(void);
+ void (*reserved124)(void);
+ void (*reserved125)(void);
void (*tcl_GetVariableFullName) (Tcl_Interp *interp, Tcl_Var variable, Tcl_Obj *objPtr); /* 126 */
- int (*tclImport) (Tcl_Interp *interp, Tcl_Namespace *nsPtr, const char *pattern, int allowOverwrite); /* 127 */
+ void (*reserved127)(void);
void (*tcl_PopCallFrame) (Tcl_Interp *interp); /* 128 */
int (*tcl_PushCallFrame) (Tcl_Interp *interp, Tcl_CallFrame *framePtr, Tcl_Namespace *nsPtr, int isProcCallFrame); /* 129 */
int (*tcl_RemoveInterpResolvers) (Tcl_Interp *interp, const char *name); /* 130 */
void (*tcl_SetNamespaceResolvers) (Tcl_Namespace *namespacePtr, Tcl_ResolveCmdProc *cmdProc, Tcl_ResolveVarProc *varProc, Tcl_ResolveCompiledVarProc *compiledVarProc); /* 131 */
int (*tclpHasSockets) (Tcl_Interp *interp); /* 132 */
- TCL_DEPRECATED_API("") struct tm * (*tclpGetDate) (const time_t *time, int useGMT); /* 133 */
+ void (*reserved133)(void);
void (*reserved134)(void);
void (*reserved135)(void);
void (*reserved136)(void);
@@ -805,7 +730,7 @@ typedef struct TclIntStubs {
void (*reserved139)(void);
void (*reserved140)(void);
const char * (*tclpGetCwd) (Tcl_Interp *interp, Tcl_DString *cwdPtr); /* 141 */
- int (*tclSetByteCodeFromAny) (Tcl_Interp *interp, Tcl_Obj *objPtr, CompileHookProc *hookProc, ClientData clientData); /* 142 */
+ int (*tclSetByteCodeFromAny) (Tcl_Interp *interp, Tcl_Obj *objPtr, CompileHookProc *hookProc, void *clientData); /* 142 */
int (*tclAddLiteralObj) (struct CompileEnv *envPtr, Tcl_Obj *objPtr, LiteralEntry **litPtrPtr); /* 143 */
void (*tclHideLiteral) (Tcl_Interp *interp, struct CompileEnv *envPtr, int index); /* 144 */
const struct AuxDataType * (*tclGetAuxDataType) (const char *typeName); /* 145 */
@@ -814,39 +739,39 @@ typedef struct TclIntStubs {
TclHandle (*tclHandlePreserve) (TclHandle handle); /* 148 */
void (*tclHandleRelease) (TclHandle handle); /* 149 */
int (*tclRegAbout) (Tcl_Interp *interp, Tcl_RegExp re); /* 150 */
- void (*tclRegExpRangeUniChar) (Tcl_RegExp re, int index, int *startPtr, int *endPtr); /* 151 */
+ void (*tclRegExpRangeUniChar) (Tcl_RegExp re, size_t index, size_t *startPtr, size_t *endPtr); /* 151 */
void (*tclSetLibraryPath) (Tcl_Obj *pathPtr); /* 152 */
Tcl_Obj * (*tclGetLibraryPath) (void); /* 153 */
void (*reserved154)(void);
void (*reserved155)(void);
void (*tclRegError) (Tcl_Interp *interp, const char *msg, int status); /* 156 */
Var * (*tclVarTraceExists) (Tcl_Interp *interp, const char *varName); /* 157 */
- TCL_DEPRECATED_API("use public Tcl_SetStartupScript()") void (*tclSetStartupScriptFileName) (const char *filename); /* 158 */
- TCL_DEPRECATED_API("use public Tcl_GetStartupScript()") const char * (*tclGetStartupScriptFileName) (void); /* 159 */
+ void (*reserved158)(void);
+ void (*reserved159)(void);
void (*reserved160)(void);
int (*tclChannelTransform) (Tcl_Interp *interp, Tcl_Channel chan, Tcl_Obj *cmdObjPtr); /* 161 */
- void (*tclChannelEventScriptInvoker) (ClientData clientData, int flags); /* 162 */
+ void (*tclChannelEventScriptInvoker) (void *clientData, int flags); /* 162 */
const void * (*tclGetInstructionTable) (void); /* 163 */
void (*tclExpandCodeArray) (void *envPtr); /* 164 */
void (*tclpSetInitialEncodings) (void); /* 165 */
int (*tclListObjSetElement) (Tcl_Interp *interp, Tcl_Obj *listPtr, int index, Tcl_Obj *valuePtr); /* 166 */
- TCL_DEPRECATED_API("use public Tcl_SetStartupScript()") void (*tclSetStartupScriptPath) (Tcl_Obj *pathPtr); /* 167 */
- TCL_DEPRECATED_API("use public Tcl_GetStartupScript()") Tcl_Obj * (*tclGetStartupScriptPath) (void); /* 168 */
- int (*tclpUtfNcmp2) (const char *s1, const char *s2, unsigned long n); /* 169 */
- int (*tclCheckInterpTraces) (Tcl_Interp *interp, const char *command, int numChars, Command *cmdPtr, int result, int traceFlags, int objc, Tcl_Obj *const objv[]); /* 170 */
- int (*tclCheckExecutionTraces) (Tcl_Interp *interp, const char *command, int numChars, Command *cmdPtr, int result, int traceFlags, int objc, Tcl_Obj *const objv[]); /* 171 */
+ void (*reserved167)(void);
+ void (*reserved168)(void);
+ int (*tclpUtfNcmp2) (const char *s1, const char *s2, size_t n); /* 169 */
+ int (*tclCheckInterpTraces) (Tcl_Interp *interp, const char *command, size_t numChars, Command *cmdPtr, int result, int traceFlags, int objc, Tcl_Obj *const objv[]); /* 170 */
+ int (*tclCheckExecutionTraces) (Tcl_Interp *interp, const char *command, size_t numChars, Command *cmdPtr, int result, int traceFlags, int objc, Tcl_Obj *const objv[]); /* 171 */
int (*tclInThreadExit) (void); /* 172 */
- int (*tclUniCharMatch) (const Tcl_UniChar *string, int strLen, const Tcl_UniChar *pattern, int ptnLen, int flags); /* 173 */
+ int (*tclUniCharMatch) (const Tcl_UniChar *string, size_t strLen, const Tcl_UniChar *pattern, size_t ptnLen, int flags); /* 173 */
void (*reserved174)(void);
int (*tclCallVarTraces) (Interp *iPtr, Var *arrayPtr, Var *varPtr, const char *part1, const char *part2, int flags, int leaveErrMsg); /* 175 */
void (*tclCleanupVar) (Var *varPtr, Var *arrayPtr); /* 176 */
void (*tclVarErrMsg) (Tcl_Interp *interp, const char *part1, const char *part2, const char *operation, const char *reason); /* 177 */
- void (*tclSetStartupScript) (Tcl_Obj *pathPtr, const char *encodingName); /* 178 */
- Tcl_Obj * (*tclGetStartupScript) (const char **encodingNamePtr); /* 179 */
+ void (*reserved178)(void);
+ void (*reserved179)(void);
void (*reserved180)(void);
void (*reserved181)(void);
- TCL_DEPRECATED_API("") struct tm * (*tclpLocaltime) (const time_t *clock); /* 182 */
- TCL_DEPRECATED_API("") struct tm * (*tclpGmtime) (const time_t *clock); /* 183 */
+ void (*reserved182)(void);
+ void (*reserved183)(void);
void (*reserved184)(void);
void (*reserved185)(void);
void (*reserved186)(void);
@@ -878,7 +803,7 @@ typedef struct TclIntStubs {
void (*tclpFindExecutable) (const char *argv0); /* 212 */
Tcl_Obj * (*tclGetObjNameOfExecutable) (void); /* 213 */
void (*tclSetObjNameOfExecutable) (Tcl_Obj *name, Tcl_Encoding encoding); /* 214 */
- void * (*tclStackAlloc) (Tcl_Interp *interp, int numBytes); /* 215 */
+ void * (*tclStackAlloc) (Tcl_Interp *interp, size_t numBytes); /* 215 */
void (*tclStackFree) (Tcl_Interp *interp, void *freePtr); /* 216 */
int (*tclPushStackFrame) (Tcl_Interp *interp, Tcl_CallFrame **framePtrPtr, Tcl_Namespace *namespacePtr, int isProcCallFrame); /* 217 */
void (*tclPopStackFrame) (Tcl_Interp *interp); /* 218 */
@@ -890,7 +815,7 @@ typedef struct TclIntStubs {
TclPlatformType * (*tclGetPlatform) (void); /* 224 */
Tcl_Obj * (*tclTraceDictPath) (Tcl_Interp *interp, Tcl_Obj *rootPtr, int keyc, Tcl_Obj *const keyv[], int flags); /* 225 */
int (*tclObjBeingDeleted) (Tcl_Obj *objPtr); /* 226 */
- void (*tclSetNsPath) (Namespace *nsPtr, int pathLength, Tcl_Namespace *pathAry[]); /* 227 */
+ void (*tclSetNsPath) (Namespace *nsPtr, size_t pathLength, Tcl_Namespace *pathAry[]); /* 227 */
void (*reserved228)(void);
int (*tclPtrMakeUpvar) (Tcl_Interp *interp, Var *otherP1Ptr, const char *myName, int myFlags, int index); /* 229 */
Var * (*tclObjLookupVar) (Tcl_Interp *interp, Tcl_Obj *part1Ptr, const char *part2, int flags, const char *msg, const int createPart1, const int createPart2, Var **arrayPtrPtr); /* 230 */
@@ -899,9 +824,9 @@ typedef struct TclIntStubs {
void (*tclGetSrcInfoForPc) (CmdFrame *contextPtr); /* 233 */
Var * (*tclVarHashCreateVar) (TclVarHashTable *tablePtr, const char *key, int *newPtr); /* 234 */
void (*tclInitVarHashTable) (TclVarHashTable *tablePtr, Namespace *nsPtr); /* 235 */
- TCL_DEPRECATED_API("use Tcl_BackgroundException") void (*tclBackgroundException) (Tcl_Interp *interp, int code); /* 236 */
+ void (*reserved236)(void);
int (*tclResetCancellation) (Tcl_Interp *interp, int force); /* 237 */
- int (*tclNRInterpProc) (ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* 238 */
+ int (*tclNRInterpProc) (void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* 238 */
int (*tclNRInterpProcCore) (Tcl_Interp *interp, Tcl_Obj *procNameObj, int skip, ProcErrorProc *errorProc); /* 239 */
int (*tclNRRunCallbacks) (Tcl_Interp *interp, int result, struct NRE_callback *rootPtr); /* 240 */
int (*tclNREvalObjEx) (Tcl_Interp *interp, Tcl_Obj *objPtr, int flags, const CmdFrame *invoker, int word); /* 241 */
@@ -909,12 +834,12 @@ typedef struct TclIntStubs {
void (*tclDbDumpActiveObjects) (FILE *outFile); /* 243 */
Tcl_HashTable * (*tclGetNamespaceChildTable) (Tcl_Namespace *nsPtr); /* 244 */
Tcl_HashTable * (*tclGetNamespaceCommandTable) (Tcl_Namespace *nsPtr); /* 245 */
- int (*tclInitRewriteEnsemble) (Tcl_Interp *interp, int numRemoved, int numInserted, Tcl_Obj *const *objv); /* 246 */
+ int (*tclInitRewriteEnsemble) (Tcl_Interp *interp, size_t numRemoved, size_t numInserted, Tcl_Obj *const *objv); /* 246 */
void (*tclResetRewriteEnsemble) (Tcl_Interp *interp, int isRootEnsemble); /* 247 */
int (*tclCopyChannel) (Tcl_Interp *interp, Tcl_Channel inChan, Tcl_Channel outChan, Tcl_WideInt toRead, Tcl_Obj *cmdPtr); /* 248 */
char * (*tclDoubleDigits) (double dv, int ndigits, int flags, int *decpt, int *signum, char **endPtr); /* 249 */
void (*tclSetSlaveCancelFlags) (Tcl_Interp *interp, int flags, int force); /* 250 */
- int (*tclRegisterLiteral) (void *envPtr, const char *bytes, int length, int flags); /* 251 */
+ int (*tclRegisterLiteral) (void *envPtr, const char *bytes, size_t length, int flags); /* 251 */
Tcl_Obj * (*tclPtrGetVar) (Tcl_Interp *interp, Tcl_Var varPtr, Tcl_Var arrayPtr, Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, const int flags); /* 252 */
Tcl_Obj * (*tclPtrSetVar) (Tcl_Interp *interp, Tcl_Var varPtr, Tcl_Var arrayPtr, Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, Tcl_Obj *newValuePtr, const int flags); /* 253 */
Tcl_Obj * (*tclPtrIncrObjVar) (Tcl_Interp *interp, Tcl_Var varPtr, Tcl_Var arrayPtr, Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, Tcl_Obj *incrPtr, const int flags); /* 254 */
@@ -948,8 +873,7 @@ extern const TclIntStubs *tclIntStubsPtr;
(tclIntStubsPtr->tclCleanupCommand) /* 6 */
#define TclCopyAndCollapse \
(tclIntStubsPtr->tclCopyAndCollapse) /* 7 */
-#define TclCopyChannelOld \
- (tclIntStubsPtr->tclCopyChannelOld) /* 8 */
+/* Slot 8 is reserved */
#define TclCreatePipeline \
(tclIntStubsPtr->tclCreatePipeline) /* 9 */
#define TclCreateProc \
@@ -988,8 +912,7 @@ extern const TclIntStubs *tclIntStubsPtr;
#define TclGetFrame \
(tclIntStubsPtr->tclGetFrame) /* 32 */
/* Slot 33 is reserved */
-#define TclGetIntForIndex \
- (tclIntStubsPtr->tclGetIntForIndex) /* 34 */
+/* Slot 34 is reserved */
/* Slot 35 is reserved */
/* Slot 36 is reserved */
#define TclGetLoadedPackages \
@@ -1056,8 +979,7 @@ extern const TclIntStubs *tclIntStubsPtr;
(tclIntStubsPtr->tclpGetClicks) /* 75 */
#define TclpGetSeconds \
(tclIntStubsPtr->tclpGetSeconds) /* 76 */
-#define TclpGetTime \
- (tclIntStubsPtr->tclpGetTime) /* 77 */
+/* Slot 77 is reserved */
/* Slot 78 is reserved */
/* Slot 79 is reserved */
/* Slot 80 is reserved */
@@ -1069,8 +991,7 @@ extern const TclIntStubs *tclIntStubsPtr;
/* Slot 85 is reserved */
/* Slot 86 is reserved */
/* Slot 87 is reserved */
-#define TclPrecTraceProc \
- (tclIntStubsPtr->tclPrecTraceProc) /* 88 */
+/* Slot 88 is reserved */
#define TclPreventAliasLoop \
(tclIntStubsPtr->tclPreventAliasLoop) /* 89 */
/* Slot 90 is reserved */
@@ -1096,8 +1017,7 @@ extern const TclIntStubs *tclIntStubsPtr;
(tclIntStubsPtr->tclSetupEnv) /* 102 */
#define TclSockGetPort \
(tclIntStubsPtr->tclSockGetPort) /* 103 */
-#define TclSockMinimumBuffersOld \
- (tclIntStubsPtr->tclSockMinimumBuffersOld) /* 104 */
+/* Slot 104 is reserved */
/* Slot 105 is reserved */
/* Slot 106 is reserved */
/* Slot 107 is reserved */
@@ -1109,38 +1029,26 @@ extern const TclIntStubs *tclIntStubsPtr;
(tclIntStubsPtr->tclSockMinimumBuffers) /* 110 */
#define Tcl_AddInterpResolvers \
(tclIntStubsPtr->tcl_AddInterpResolvers) /* 111 */
-#define TclAppendExportList \
- (tclIntStubsPtr->tclAppendExportList) /* 112 */
-#define TclCreateNamespace \
- (tclIntStubsPtr->tclCreateNamespace) /* 113 */
-#define TclDeleteNamespace \
- (tclIntStubsPtr->tclDeleteNamespace) /* 114 */
-#define TclExport \
- (tclIntStubsPtr->tclExport) /* 115 */
-#define TclFindCommand \
- (tclIntStubsPtr->tclFindCommand) /* 116 */
-#define TclFindNamespace \
- (tclIntStubsPtr->tclFindNamespace) /* 117 */
+/* Slot 112 is reserved */
+/* Slot 113 is reserved */
+/* Slot 114 is reserved */
+/* Slot 115 is reserved */
+/* Slot 116 is reserved */
+/* Slot 117 is reserved */
#define Tcl_GetInterpResolvers \
(tclIntStubsPtr->tcl_GetInterpResolvers) /* 118 */
#define Tcl_GetNamespaceResolvers \
(tclIntStubsPtr->tcl_GetNamespaceResolvers) /* 119 */
#define Tcl_FindNamespaceVar \
(tclIntStubsPtr->tcl_FindNamespaceVar) /* 120 */
-#define TclForgetImport \
- (tclIntStubsPtr->tclForgetImport) /* 121 */
-#define TclGetCommandFromObj \
- (tclIntStubsPtr->tclGetCommandFromObj) /* 122 */
-#define TclGetCommandFullName \
- (tclIntStubsPtr->tclGetCommandFullName) /* 123 */
-#define TclGetCurrentNamespace_ \
- (tclIntStubsPtr->tclGetCurrentNamespace_) /* 124 */
-#define TclGetGlobalNamespace_ \
- (tclIntStubsPtr->tclGetGlobalNamespace_) /* 125 */
+/* Slot 121 is reserved */
+/* Slot 122 is reserved */
+/* Slot 123 is reserved */
+/* Slot 124 is reserved */
+/* Slot 125 is reserved */
#define Tcl_GetVariableFullName \
(tclIntStubsPtr->tcl_GetVariableFullName) /* 126 */
-#define TclImport \
- (tclIntStubsPtr->tclImport) /* 127 */
+/* Slot 127 is reserved */
#define Tcl_PopCallFrame \
(tclIntStubsPtr->tcl_PopCallFrame) /* 128 */
#define Tcl_PushCallFrame \
@@ -1151,8 +1059,7 @@ extern const TclIntStubs *tclIntStubsPtr;
(tclIntStubsPtr->tcl_SetNamespaceResolvers) /* 131 */
#define TclpHasSockets \
(tclIntStubsPtr->tclpHasSockets) /* 132 */
-#define TclpGetDate \
- (tclIntStubsPtr->tclpGetDate) /* 133 */
+/* Slot 133 is reserved */
/* Slot 134 is reserved */
/* Slot 135 is reserved */
/* Slot 136 is reserved */
@@ -1193,10 +1100,8 @@ extern const TclIntStubs *tclIntStubsPtr;
(tclIntStubsPtr->tclRegError) /* 156 */
#define TclVarTraceExists \
(tclIntStubsPtr->tclVarTraceExists) /* 157 */
-#define TclSetStartupScriptFileName \
- (tclIntStubsPtr->tclSetStartupScriptFileName) /* 158 */
-#define TclGetStartupScriptFileName \
- (tclIntStubsPtr->tclGetStartupScriptFileName) /* 159 */
+/* Slot 158 is reserved */
+/* Slot 159 is reserved */
/* Slot 160 is reserved */
#define TclChannelTransform \
(tclIntStubsPtr->tclChannelTransform) /* 161 */
@@ -1210,10 +1115,8 @@ extern const TclIntStubs *tclIntStubsPtr;
(tclIntStubsPtr->tclpSetInitialEncodings) /* 165 */
#define TclListObjSetElement \
(tclIntStubsPtr->tclListObjSetElement) /* 166 */
-#define TclSetStartupScriptPath \
- (tclIntStubsPtr->tclSetStartupScriptPath) /* 167 */
-#define TclGetStartupScriptPath \
- (tclIntStubsPtr->tclGetStartupScriptPath) /* 168 */
+/* Slot 167 is reserved */
+/* Slot 168 is reserved */
#define TclpUtfNcmp2 \
(tclIntStubsPtr->tclpUtfNcmp2) /* 169 */
#define TclCheckInterpTraces \
@@ -1231,16 +1134,12 @@ extern const TclIntStubs *tclIntStubsPtr;
(tclIntStubsPtr->tclCleanupVar) /* 176 */
#define TclVarErrMsg \
(tclIntStubsPtr->tclVarErrMsg) /* 177 */
-#define TclSetStartupScript \
- (tclIntStubsPtr->tclSetStartupScript) /* 178 */
-#define TclGetStartupScript \
- (tclIntStubsPtr->tclGetStartupScript) /* 179 */
+/* Slot 178 is reserved */
+/* Slot 179 is reserved */
/* Slot 180 is reserved */
/* Slot 181 is reserved */
-#define TclpLocaltime \
- (tclIntStubsPtr->tclpLocaltime) /* 182 */
-#define TclpGmtime \
- (tclIntStubsPtr->tclpGmtime) /* 183 */
+/* Slot 182 is reserved */
+/* Slot 183 is reserved */
/* Slot 184 is reserved */
/* Slot 185 is reserved */
/* Slot 186 is reserved */
@@ -1321,8 +1220,7 @@ extern const TclIntStubs *tclIntStubsPtr;
(tclIntStubsPtr->tclVarHashCreateVar) /* 234 */
#define TclInitVarHashTable \
(tclIntStubsPtr->tclInitVarHashTable) /* 235 */
-#define TclBackgroundException \
- (tclIntStubsPtr->tclBackgroundException) /* 236 */
+/* Slot 236 is reserved */
#define TclResetCancellation \
(tclIntStubsPtr->tclResetCancellation) /* 237 */
#define TclNRInterpProc \
@@ -1372,34 +1270,13 @@ extern const TclIntStubs *tclIntStubsPtr;
/* !END!: Do not edit above this line. */
+#if defined(USE_TCL_STUBS)
+#undef Tcl_StaticPackage
+#define Tcl_StaticPackage \
+ (tclIntStubsPtr->tclStaticPackage)
+#endif /* defined(USE_TCL_STUBS) */
+
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLIMPORT
-#if defined(USE_TCL_STUBS)
-# undef TclGetStartupScriptFileName
-# undef TclSetStartupScriptFileName
-# undef TclGetStartupScriptPath
-# undef TclSetStartupScriptPath
-# undef TclBackgroundException
-# undef TclSetStartupScript
-# undef TclGetStartupScript
-# undef TclGetIntForIndex
-# undef TclCreateNamespace
-# undef TclDeleteNamespace
-# undef TclAppendExportList
-# undef TclExport
-# undef TclImport
-# undef TclForgetImport
-# undef TclGetCurrentNamespace_
-# undef TclGetGlobalNamespace_
-# undef TclFindNamespace
-# undef TclFindCommand
-# undef TclGetCommandFromObj
-# undef TclGetCommandFullName
-# undef TclCopyChannelOld
-# undef TclSockMinimumBuffersOld
-# undef Tcl_StaticPackage
-# define Tcl_StaticPackage (tclIntStubsPtr->tclStaticPackage)
-#endif
-
#endif /* _TCLINTDECLS */
diff --git a/generic/tclIntPlatDecls.h b/generic/tclIntPlatDecls.h
index 51d2f65..37a9176 100644
--- a/generic/tclIntPlatDecls.h
+++ b/generic/tclIntPlatDecls.h
@@ -66,14 +66,10 @@ EXTERN TclFile TclpOpenFile(const char *fname, int mode);
EXTERN int TclUnixWaitForFile(int fd, int mask, int timeout);
/* 9 */
EXTERN TclFile TclpCreateTempFile(const char *contents);
-/* 10 */
-EXTERN Tcl_DirEntry * TclpReaddir(TclDIR *dir);
-/* 11 */
-EXTERN struct tm * TclpLocaltime_unix(const time_t *clock);
-/* 12 */
-EXTERN struct tm * TclpGmtime_unix(const time_t *clock);
-/* 13 */
-EXTERN char * TclpInetNtoa(struct in_addr addr);
+/* Slot 10 is reserved */
+/* Slot 11 is reserved */
+/* Slot 12 is reserved */
+/* Slot 13 is reserved */
/* 14 */
EXTERN int TclUnixCopyFile(const char *src, const char *dst,
const Tcl_StatBuf *statBufPtr,
@@ -102,29 +98,19 @@ EXTERN int TclUnixOpenTemporaryFile(Tcl_Obj *dirObj,
#if defined(_WIN32) || defined(__CYGWIN__) /* WIN */
/* 0 */
EXTERN void TclWinConvertError(DWORD errCode);
-/* 1 */
-EXTERN void TclWinConvertWSAError(DWORD errCode);
-/* 2 */
-EXTERN struct servent * TclWinGetServByName(const char *nm,
- const char *proto);
-/* 3 */
-EXTERN int TclWinGetSockOpt(SOCKET s, int level, int optname,
- char *optval, int *optlen);
+/* Slot 1 is reserved */
+/* Slot 2 is reserved */
+/* Slot 3 is reserved */
/* 4 */
EXTERN HINSTANCE TclWinGetTclInstance(void);
/* 5 */
EXTERN int TclUnixWaitForFile(int fd, int mask, int timeout);
-/* 6 */
-EXTERN unsigned short TclWinNToHS(unsigned short ns);
-/* 7 */
-EXTERN int TclWinSetSockOpt(SOCKET s, int level, int optname,
- const char *optval, int optlen);
+/* Slot 6 is reserved */
+/* Slot 7 is reserved */
/* 8 */
-EXTERN int TclpGetPid(Tcl_Pid pid);
-/* 9 */
-EXTERN int TclWinGetPlatformId(void);
-/* 10 */
-EXTERN Tcl_DirEntry * TclpReaddir(TclDIR *dir);
+EXTERN size_t TclpGetPid(Tcl_Pid pid);
+/* Slot 9 is reserved */
+/* Slot 10 is reserved */
/* 11 */
EXTERN void TclGetAndDetachPids(Tcl_Interp *interp,
Tcl_Channel chan);
@@ -152,21 +138,18 @@ EXTERN TclFile TclpMakeFile(Tcl_Channel channel, int direction);
/* 19 */
EXTERN TclFile TclpOpenFile(const char *fname, int mode);
/* 20 */
-EXTERN void TclWinAddProcess(HANDLE hProcess, DWORD id);
-/* 21 */
-EXTERN char * TclpInetNtoa(struct in_addr addr);
+EXTERN void TclWinAddProcess(HANDLE hProcess, size_t id);
+/* Slot 21 is reserved */
/* 22 */
EXTERN TclFile TclpCreateTempFile(const char *contents);
/* Slot 23 is reserved */
/* 24 */
EXTERN char * TclWinNoBackslash(char *path);
/* Slot 25 is reserved */
-/* 26 */
-EXTERN void TclWinSetInterfaces(int wide);
+/* Slot 26 is reserved */
/* 27 */
EXTERN void TclWinFlushDirtyChannels(void);
-/* 28 */
-EXTERN void TclWinResetInterfaces(void);
+/* Slot 28 is reserved */
/* 29 */
EXTERN int TclWinCPUID(int index, int *regs);
/* 30 */
@@ -200,14 +183,10 @@ EXTERN TclFile TclpOpenFile(const char *fname, int mode);
EXTERN int TclUnixWaitForFile(int fd, int mask, int timeout);
/* 9 */
EXTERN TclFile TclpCreateTempFile(const char *contents);
-/* 10 */
-EXTERN Tcl_DirEntry * TclpReaddir(TclDIR *dir);
-/* 11 */
-EXTERN struct tm * TclpLocaltime_unix(const time_t *clock);
-/* 12 */
-EXTERN struct tm * TclpGmtime_unix(const time_t *clock);
-/* 13 */
-EXTERN char * TclpInetNtoa(struct in_addr addr);
+/* Slot 10 is reserved */
+/* Slot 11 is reserved */
+/* Slot 12 is reserved */
+/* Slot 13 is reserved */
/* 14 */
EXTERN int TclUnixCopyFile(const char *src, const char *dst,
const Tcl_StatBuf *statBufPtr,
@@ -264,10 +243,10 @@ typedef struct TclIntPlatStubs {
TclFile (*tclpOpenFile) (const char *fname, int mode); /* 7 */
int (*tclUnixWaitForFile) (int fd, int mask, int timeout); /* 8 */
TclFile (*tclpCreateTempFile) (const char *contents); /* 9 */
- Tcl_DirEntry * (*tclpReaddir) (TclDIR *dir); /* 10 */
- struct tm * (*tclpLocaltime_unix) (const time_t *clock); /* 11 */
- struct tm * (*tclpGmtime_unix) (const time_t *clock); /* 12 */
- char * (*tclpInetNtoa) (struct in_addr addr); /* 13 */
+ void (*reserved10)(void);
+ void (*reserved11)(void);
+ void (*reserved12)(void);
+ void (*reserved13)(void);
int (*tclUnixCopyFile) (const char *src, const char *dst, const Tcl_StatBuf *statBufPtr, int dontCopyAtts); /* 14 */
void (*reserved15)(void);
void (*reserved16)(void);
@@ -288,16 +267,16 @@ typedef struct TclIntPlatStubs {
#endif /* UNIX */
#if defined(_WIN32) || defined(__CYGWIN__) /* WIN */
void (*tclWinConvertError) (DWORD errCode); /* 0 */
- void (*tclWinConvertWSAError) (DWORD errCode); /* 1 */
- struct servent * (*tclWinGetServByName) (const char *nm, const char *proto); /* 2 */
- int (*tclWinGetSockOpt) (SOCKET s, int level, int optname, char *optval, int *optlen); /* 3 */
+ void (*reserved1)(void);
+ void (*reserved2)(void);
+ void (*reserved3)(void);
HINSTANCE (*tclWinGetTclInstance) (void); /* 4 */
int (*tclUnixWaitForFile) (int fd, int mask, int timeout); /* 5 */
- unsigned short (*tclWinNToHS) (unsigned short ns); /* 6 */
- int (*tclWinSetSockOpt) (SOCKET s, int level, int optname, const char *optval, int optlen); /* 7 */
- int (*tclpGetPid) (Tcl_Pid pid); /* 8 */
- int (*tclWinGetPlatformId) (void); /* 9 */
- Tcl_DirEntry * (*tclpReaddir) (TclDIR *dir); /* 10 */
+ void (*reserved6)(void);
+ void (*reserved7)(void);
+ size_t (*tclpGetPid) (Tcl_Pid pid); /* 8 */
+ void (*reserved9)(void);
+ void (*reserved10)(void);
void (*tclGetAndDetachPids) (Tcl_Interp *interp, Tcl_Channel chan); /* 11 */
int (*tclpCloseFile) (TclFile file); /* 12 */
Tcl_Channel (*tclpCreateCommandChannel) (TclFile readFile, TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr); /* 13 */
@@ -307,15 +286,15 @@ typedef struct TclIntPlatStubs {
int (*tclUnixCopyFile) (const char *src, const char *dst, const Tcl_StatBuf *statBufPtr, int dontCopyAtts); /* 17 */
TclFile (*tclpMakeFile) (Tcl_Channel channel, int direction); /* 18 */
TclFile (*tclpOpenFile) (const char *fname, int mode); /* 19 */
- void (*tclWinAddProcess) (HANDLE hProcess, DWORD id); /* 20 */
- char * (*tclpInetNtoa) (struct in_addr addr); /* 21 */
+ void (*tclWinAddProcess) (HANDLE hProcess, size_t id); /* 20 */
+ void (*reserved21)(void);
TclFile (*tclpCreateTempFile) (const char *contents); /* 22 */
void (*reserved23)(void);
char * (*tclWinNoBackslash) (char *path); /* 24 */
void (*reserved25)(void);
- void (*tclWinSetInterfaces) (int wide); /* 26 */
+ void (*reserved26)(void);
void (*tclWinFlushDirtyChannels) (void); /* 27 */
- void (*tclWinResetInterfaces) (void); /* 28 */
+ void (*reserved28)(void);
int (*tclWinCPUID) (int index, int *regs); /* 29 */
int (*tclUnixOpenTemporaryFile) (Tcl_Obj *dirObj, Tcl_Obj *basenameObj, Tcl_Obj *extensionObj, Tcl_Obj *resultingNameObj); /* 30 */
#endif /* WIN */
@@ -330,10 +309,10 @@ typedef struct TclIntPlatStubs {
TclFile (*tclpOpenFile) (const char *fname, int mode); /* 7 */
int (*tclUnixWaitForFile) (int fd, int mask, int timeout); /* 8 */
TclFile (*tclpCreateTempFile) (const char *contents); /* 9 */
- Tcl_DirEntry * (*tclpReaddir) (TclDIR *dir); /* 10 */
- struct tm * (*tclpLocaltime_unix) (const time_t *clock); /* 11 */
- struct tm * (*tclpGmtime_unix) (const time_t *clock); /* 12 */
- char * (*tclpInetNtoa) (struct in_addr addr); /* 13 */
+ void (*reserved10)(void);
+ void (*reserved11)(void);
+ void (*reserved12)(void);
+ void (*reserved13)(void);
int (*tclUnixCopyFile) (const char *src, const char *dst, const Tcl_StatBuf *statBufPtr, int dontCopyAtts); /* 14 */
int (*tclMacOSXGetFileAttribute) (Tcl_Interp *interp, int objIndex, Tcl_Obj *fileName, Tcl_Obj **attributePtrPtr); /* 15 */
int (*tclMacOSXSetFileAttribute) (Tcl_Interp *interp, int objIndex, Tcl_Obj *fileName, Tcl_Obj *attributePtr); /* 16 */
@@ -386,14 +365,10 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr;
(tclIntPlatStubsPtr->tclUnixWaitForFile) /* 8 */
#define TclpCreateTempFile \
(tclIntPlatStubsPtr->tclpCreateTempFile) /* 9 */
-#define TclpReaddir \
- (tclIntPlatStubsPtr->tclpReaddir) /* 10 */
-#define TclpLocaltime_unix \
- (tclIntPlatStubsPtr->tclpLocaltime_unix) /* 11 */
-#define TclpGmtime_unix \
- (tclIntPlatStubsPtr->tclpGmtime_unix) /* 12 */
-#define TclpInetNtoa \
- (tclIntPlatStubsPtr->tclpInetNtoa) /* 13 */
+/* Slot 10 is reserved */
+/* Slot 11 is reserved */
+/* Slot 12 is reserved */
+/* Slot 13 is reserved */
#define TclUnixCopyFile \
(tclIntPlatStubsPtr->tclUnixCopyFile) /* 14 */
/* Slot 15 is reserved */
@@ -418,26 +393,19 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr;
#if defined(_WIN32) || defined(__CYGWIN__) /* WIN */
#define TclWinConvertError \
(tclIntPlatStubsPtr->tclWinConvertError) /* 0 */
-#define TclWinConvertWSAError \
- (tclIntPlatStubsPtr->tclWinConvertWSAError) /* 1 */
-#define TclWinGetServByName \
- (tclIntPlatStubsPtr->tclWinGetServByName) /* 2 */
-#define TclWinGetSockOpt \
- (tclIntPlatStubsPtr->tclWinGetSockOpt) /* 3 */
+/* Slot 1 is reserved */
+/* Slot 2 is reserved */
+/* Slot 3 is reserved */
#define TclWinGetTclInstance \
(tclIntPlatStubsPtr->tclWinGetTclInstance) /* 4 */
#define TclUnixWaitForFile \
(tclIntPlatStubsPtr->tclUnixWaitForFile) /* 5 */
-#define TclWinNToHS \
- (tclIntPlatStubsPtr->tclWinNToHS) /* 6 */
-#define TclWinSetSockOpt \
- (tclIntPlatStubsPtr->tclWinSetSockOpt) /* 7 */
+/* Slot 6 is reserved */
+/* Slot 7 is reserved */
#define TclpGetPid \
(tclIntPlatStubsPtr->tclpGetPid) /* 8 */
-#define TclWinGetPlatformId \
- (tclIntPlatStubsPtr->tclWinGetPlatformId) /* 9 */
-#define TclpReaddir \
- (tclIntPlatStubsPtr->tclpReaddir) /* 10 */
+/* Slot 9 is reserved */
+/* Slot 10 is reserved */
#define TclGetAndDetachPids \
(tclIntPlatStubsPtr->tclGetAndDetachPids) /* 11 */
#define TclpCloseFile \
@@ -458,20 +426,17 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr;
(tclIntPlatStubsPtr->tclpOpenFile) /* 19 */
#define TclWinAddProcess \
(tclIntPlatStubsPtr->tclWinAddProcess) /* 20 */
-#define TclpInetNtoa \
- (tclIntPlatStubsPtr->tclpInetNtoa) /* 21 */
+/* Slot 21 is reserved */
#define TclpCreateTempFile \
(tclIntPlatStubsPtr->tclpCreateTempFile) /* 22 */
/* Slot 23 is reserved */
#define TclWinNoBackslash \
(tclIntPlatStubsPtr->tclWinNoBackslash) /* 24 */
/* Slot 25 is reserved */
-#define TclWinSetInterfaces \
- (tclIntPlatStubsPtr->tclWinSetInterfaces) /* 26 */
+/* Slot 26 is reserved */
#define TclWinFlushDirtyChannels \
(tclIntPlatStubsPtr->tclWinFlushDirtyChannels) /* 27 */
-#define TclWinResetInterfaces \
- (tclIntPlatStubsPtr->tclWinResetInterfaces) /* 28 */
+/* Slot 28 is reserved */
#define TclWinCPUID \
(tclIntPlatStubsPtr->tclWinCPUID) /* 29 */
#define TclUnixOpenTemporaryFile \
@@ -497,14 +462,10 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr;
(tclIntPlatStubsPtr->tclUnixWaitForFile) /* 8 */
#define TclpCreateTempFile \
(tclIntPlatStubsPtr->tclpCreateTempFile) /* 9 */
-#define TclpReaddir \
- (tclIntPlatStubsPtr->tclpReaddir) /* 10 */
-#define TclpLocaltime_unix \
- (tclIntPlatStubsPtr->tclpLocaltime_unix) /* 11 */
-#define TclpGmtime_unix \
- (tclIntPlatStubsPtr->tclpGmtime_unix) /* 12 */
-#define TclpInetNtoa \
- (tclIntPlatStubsPtr->tclpInetNtoa) /* 13 */
+/* Slot 10 is reserved */
+/* Slot 11 is reserved */
+/* Slot 12 is reserved */
+/* Slot 13 is reserved */
#define TclUnixCopyFile \
(tclIntPlatStubsPtr->tclUnixCopyFile) /* 14 */
#define TclMacOSXGetFileAttribute \
@@ -538,33 +499,11 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr;
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLIMPORT
-#undef TclpLocaltime_unix
-#undef TclpGmtime_unix
-#undef TclWinConvertWSAError
#define TclWinConvertWSAError TclWinConvertError
-#undef TclpInetNtoa
-#define TclpInetNtoa inet_ntoa
-#if defined(_WIN32)
-# undef TclWinNToHS
-# undef TclWinGetServByName
-# undef TclWinGetSockOpt
-# undef TclWinSetSockOpt
-# undef TclWinGetPlatformId
-# undef TclWinResetInterfaces
-# undef TclWinSetInterfaces
-# if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
-# define TclWinNToHS ntohs
-# define TclWinGetServByName getservbyname
-# define TclWinGetSockOpt getsockopt
-# define TclWinSetSockOpt setsockopt
-# define TclWinGetPlatformId() (2) /* VER_PLATFORM_WIN32_NT */
-# define TclWinResetInterfaces() /* nop */
-# define TclWinSetInterfaces(dummy) /* nop */
-# endif /* TCL_NO_DEPRECATED */
-#else
+#if !defined(_WIN32)
# undef TclpGetPid
-# define TclpGetPid(pid) ((unsigned long) (pid))
+# define TclpGetPid(pid) ((size_t) (pid))
#endif
#endif /* _TCLINTPLATDECLS */
diff --git a/generic/tclInterp.c b/generic/tclInterp.c
index 92c6159..ffbd935 100644
--- a/generic/tclInterp.c
+++ b/generic/tclInterp.c
@@ -25,14 +25,14 @@ static const char *tclPreInitScript = NULL;
struct Target;
/*
- * struct Alias:
+ * Alias:
*
* Stores information about an alias. Is stored in the slave interpreter and
* used by the source command to find the target command in the master when
* the source command is invoked.
*/
-typedef struct Alias {
+typedef struct {
Tcl_Obj *token; /* Token for the alias command in the slave
* interp. This used to be the command name in
* the slave when the alias was first
@@ -66,14 +66,14 @@ typedef struct Alias {
/*
*
- * struct Slave:
+ * Slave:
*
* Used by the "interp" command to record and find information about slave
* interpreters. Maps from a command name in the master to information about a
* slave interpreter, e.g. what aliases are defined in it.
*/
-typedef struct Slave {
+typedef struct {
Tcl_Interp *masterInterp; /* Master interpreter for this slave. */
Tcl_HashEntry *slaveEntryPtr;
/* Hash entry in masters slave table for this
@@ -112,7 +112,7 @@ typedef struct Target {
} Target;
/*
- * struct Master:
+ * Master:
*
* This record is used for two purposes: First, slaveTable (a hashtable) maps
* from names of commands to slave interpreters. This hashtable is used to
@@ -127,7 +127,7 @@ typedef struct Target {
* only load safe extensions.
*/
-typedef struct Master {
+typedef struct {
Tcl_HashTable slaveTable; /* Hash table for slave interpreters. Maps
* from command names to Slave records. */
Target *targetsPtr; /* The head of a doubly-linked list of all the
@@ -144,7 +144,7 @@ typedef struct Master {
* on a per-interp basis.
*/
-typedef struct InterpInfo {
+typedef struct {
Master master; /* Keeps track of all interps for which this
* interp is the Master. */
Slave slave; /* Information necessary for this interp to
@@ -158,7 +158,7 @@ typedef struct InterpInfo {
* likely to work properly on 64-bit architectures.
*/
-typedef struct ScriptLimitCallback {
+typedef struct {
Tcl_Interp *interp; /* The interpreter in which to execute the
* callback. */
Tcl_Obj *scriptObj; /* The script to execute to perform the
@@ -171,7 +171,7 @@ typedef struct ScriptLimitCallback {
* table. */
} ScriptLimitCallback;
-typedef struct ScriptLimitCallbackKey {
+typedef struct {
Tcl_Interp *interp; /* The interpreter that the limit callback was
* attached to. This is not the interpreter
* that the callback runs in! */
@@ -485,7 +485,7 @@ TclInterpInit(
Master *masterPtr;
Slave *slavePtr;
- interpInfoPtr = ckalloc(sizeof(InterpInfo));
+ interpInfoPtr = Tcl_Alloc(sizeof(InterpInfo));
((Interp *) interp)->interpInfo = interpInfoPtr;
masterPtr = &interpInfoPtr->master;
@@ -582,7 +582,7 @@ InterpInfoDeleteProc(
}
Tcl_DeleteHashTable(&slavePtr->aliasTable);
- ckfree(interpInfoPtr);
+ Tcl_Free(interpInfoPtr);
}
/*
@@ -786,7 +786,7 @@ NRInterpCmd(
slavePtr = NULL;
last = 0;
for (i = 2; i < objc; i++) {
- if ((last == 0) && (Tcl_GetString(objv[i])[0] == '-')) {
+ if ((last == 0) && (TclGetString(objv[i])[0] == '-')) {
if (Tcl_GetIndexFromObj(interp, objv[i], createOptions,
"option", 0, &index) != TCL_OK) {
return TCL_ERROR;
@@ -1100,7 +1100,7 @@ NRInterpCmd(
if (hPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"alias \"%s\" in path \"%s\" not found",
- aliasName, Tcl_GetString(objv[2])));
+ aliasName, TclGetString(objv[2])));
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "ALIAS", aliasName,
NULL);
return TCL_ERROR;
@@ -1109,7 +1109,7 @@ NRInterpCmd(
if (Tcl_GetInterpPath(interp, aliasPtr->targetInterp) != TCL_OK) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"target interpreter for alias \"%s\" in path \"%s\" is "
- "not my descendant", aliasName, Tcl_GetString(objv[2])));
+ "not my descendant", aliasName, TclGetString(objv[2])));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "INTERP",
"TARGETSHROUDED", NULL);
return TCL_ERROR;
@@ -1309,7 +1309,7 @@ Tcl_GetAlias(
}
if (argvPtr != NULL) {
*argvPtr = (const char **)
- ckalloc(sizeof(const char *) * (objc - 1));
+ Tcl_Alloc(sizeof(const char *) * (objc - 1));
for (i = 1; i < objc; i++) {
(*argvPtr)[i - 1] = TclGetString(objv[i]);
}
@@ -1517,7 +1517,7 @@ AliasCreate(
Tcl_Obj **prefv;
int isNew, i;
- aliasPtr = ckalloc(sizeof(Alias) + objc * sizeof(Tcl_Obj *));
+ aliasPtr = Tcl_Alloc(sizeof(Alias) + objc * sizeof(Tcl_Obj *));
aliasPtr->token = namePtr;
Tcl_IncrRefCount(aliasPtr->token);
aliasPtr->targetInterp = masterInterp;
@@ -1568,7 +1568,7 @@ AliasCreate(
cmdPtr->deleteData = NULL;
Tcl_DeleteCommandFromToken(slaveInterp, aliasPtr->slaveCmd);
- ckfree(aliasPtr);
+ Tcl_Free(aliasPtr);
/*
* The result was already set by TclPreventAliasLoop.
@@ -1625,7 +1625,7 @@ AliasCreate(
* interp alias {} foo {} zop # Now recreate "foo"...
*/
- targetPtr = ckalloc(sizeof(Target));
+ targetPtr = Tcl_Alloc(sizeof(Target));
targetPtr->slaveCmd = aliasPtr->slaveCmd;
targetPtr->slaveInterp = slaveInterp;
@@ -1727,7 +1727,7 @@ AliasDescribe(
*/
slavePtr = &((InterpInfo *) ((Interp *) slaveInterp)->interpInfo)->slave;
- hPtr = Tcl_FindHashEntry(&slavePtr->aliasTable, Tcl_GetString(namePtr));
+ hPtr = Tcl_FindHashEntry(&slavePtr->aliasTable, TclGetString(namePtr));
if (hPtr == NULL) {
return TCL_OK;
}
@@ -1831,8 +1831,8 @@ AliasNRCmd(
cmdv = &listRep->elements;
prefv = &aliasPtr->objPtr;
- memcpy(cmdv, prefv, prefc * sizeof(Tcl_Obj *));
- memcpy(cmdv+prefc, objv+1, (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]);
@@ -2059,8 +2059,8 @@ AliasObjCmdDeleteProc(
targetPtr->nextPtr->prevPtr = targetPtr->prevPtr;
}
- ckfree(targetPtr);
- ckfree(aliasPtr);
+ Tcl_Free(targetPtr);
+ Tcl_Free(aliasPtr);
}
/*
@@ -3560,7 +3560,7 @@ RunLimitHandlers(
if (handlerPtr->deleteProc != NULL) {
handlerPtr->deleteProc(handlerPtr->clientData);
}
- ckfree(handlerPtr);
+ Tcl_Free(handlerPtr);
}
}
}
@@ -3597,14 +3597,14 @@ Tcl_LimitAddHandler(
*/
if (deleteProc == (Tcl_LimitHandlerDeleteProc *) TCL_DYNAMIC) {
- deleteProc = (Tcl_LimitHandlerDeleteProc *) Tcl_Free;
+ deleteProc = (Tcl_LimitHandlerDeleteProc *) TclpFree;
}
/*
* Allocate a handler record.
*/
- handlerPtr = ckalloc(sizeof(LimitHandler));
+ handlerPtr = Tcl_Alloc(sizeof(LimitHandler));
handlerPtr->flags = 0;
handlerPtr->handlerProc = handlerProc;
handlerPtr->clientData = clientData;
@@ -3723,7 +3723,7 @@ Tcl_LimitRemoveHandler(
if (handlerPtr->deleteProc != NULL) {
handlerPtr->deleteProc(handlerPtr->clientData);
}
- ckfree(handlerPtr);
+ Tcl_Free(handlerPtr);
}
return;
}
@@ -3783,7 +3783,7 @@ TclLimitRemoveAllHandlers(
if (handlerPtr->deleteProc != NULL) {
handlerPtr->deleteProc(handlerPtr->clientData);
}
- ckfree(handlerPtr);
+ Tcl_Free(handlerPtr);
}
}
@@ -3816,7 +3816,7 @@ TclLimitRemoveAllHandlers(
if (handlerPtr->deleteProc != NULL) {
handlerPtr->deleteProc(handlerPtr->clientData);
}
- ckfree(handlerPtr);
+ Tcl_Free(handlerPtr);
}
}
@@ -4211,7 +4211,7 @@ DeleteScriptLimitCallback(
if (limitCBPtr->entryPtr != NULL) {
Tcl_DeleteHashEntry(limitCBPtr->entryPtr);
}
- ckfree(limitCBPtr);
+ Tcl_Free(limitCBPtr);
}
/*
@@ -4311,7 +4311,7 @@ SetScriptLimitCallback(
limitCBPtr);
}
- limitCBPtr = ckalloc(sizeof(ScriptLimitCallback));
+ limitCBPtr = Tcl_Alloc(sizeof(ScriptLimitCallback));
limitCBPtr->interp = interp;
limitCBPtr->scriptObj = scriptObj;
limitCBPtr->entryPtr = hashPtr;
@@ -4564,7 +4564,8 @@ SlaveCommandLimitCmd(
Tcl_WrongNumArgs(interp, consumedObjc, objv, "?-option value ...?");
return TCL_ERROR;
} else {
- int i, scriptLen = 0, limitLen = 0;
+ int i;
+ size_t scriptLen = 0, limitLen = 0;
Tcl_Obj *scriptObj = NULL, *granObj = NULL, *limitObj = NULL;
int gran = 0, limit = 0;
@@ -4769,7 +4770,8 @@ SlaveTimeLimitCmd(
Tcl_WrongNumArgs(interp, consumedObjc, objv, "?-option value ...?");
return TCL_ERROR;
} else {
- int i, scriptLen = 0, milliLen = 0, secLen = 0;
+ int i;
+ size_t scriptLen = 0, milliLen = 0, secLen = 0;
Tcl_Obj *scriptObj = NULL, *granObj = NULL;
Tcl_Obj *milliObj = NULL, *secObj = NULL;
int gran = 0;
diff --git a/generic/tclLink.c b/generic/tclLink.c
index 030e471..67f1ec9 100644
--- a/generic/tclLink.c
+++ b/generic/tclLink.c
@@ -25,7 +25,7 @@
* variable.
*/
-typedef struct Link {
+typedef struct {
Tcl_Interp *interp; /* Interpreter containing Tcl variable. */
Namespace *nsPtr; /* Namespace containing Tcl variable */
Tcl_Obj *varName; /* Name of variable (must be global). This is
@@ -33,10 +33,10 @@ typedef struct Link {
* actual variable may be aliased at that time
* via upvar. */
void *addr; /* Location of C variable. */
- int bytes; /* Size of C variable array. This is 0 when
+ size_t bytes; /* Size of C variable array. This is 0 when
* single variables, and >0 used for array
* variables. */
- int numElems; /* Number of elements in C variable array.
+ size_t numElems; /* Number of elements in C variable array.
* Zero for single variables. */
int type; /* Type of link (TCL_LINK_INT, etc.). */
union {
@@ -171,7 +171,7 @@ Tcl_LinkVar(
return TCL_ERROR;
}
- linkPtr = ckalloc(sizeof(Link));
+ linkPtr = Tcl_Alloc(sizeof(Link));
linkPtr->interp = interp;
linkPtr->nsPtr = NULL;
linkPtr->varName = Tcl_NewStringObj(varName, -1);
@@ -245,7 +245,7 @@ Tcl_LinkArray(
* interpreter result. */
int type, /* Type of C variable: TCL_LINK_INT, etc. Also
* may have TCL_LINK_READ_ONLY OR'ed in. */
- int size) /* Size of C variable array, >1 if array */
+ size_t size) /* Size of C variable array, >1 if array */
{
Tcl_Obj *objPtr;
Link *linkPtr;
@@ -259,7 +259,7 @@ Tcl_LinkArray(
return TCL_ERROR;
}
- linkPtr = ckalloc(sizeof(Link));
+ linkPtr = Tcl_Alloc(sizeof(Link));
linkPtr->type = type & ~TCL_LINK_READ_ONLY;
linkPtr->numElems = size;
if (type & TCL_LINK_READ_ONLY) {
@@ -319,7 +319,7 @@ Tcl_LinkArray(
*/
if (addr == NULL) {
- linkPtr->lastValue.aryPtr = ckalloc(linkPtr->bytes);
+ linkPtr->lastValue.aryPtr = Tcl_Alloc(linkPtr->bytes);
linkPtr->flags |= LINK_ALLOC_LAST;
addr = (char *) &linkPtr->lastValue.cPtr;
}
@@ -340,7 +340,7 @@ Tcl_LinkArray(
*/
if (addr == NULL) {
- linkPtr->addr = ckalloc(linkPtr->bytes);
+ linkPtr->addr = Tcl_Alloc(linkPtr->bytes);
linkPtr->flags |= LINK_ALLOC_ADDR;
} else {
linkPtr->addr = addr;
@@ -351,7 +351,7 @@ Tcl_LinkArray(
*/
if (size > 1) {
- linkPtr->lastValue.aryPtr = ckalloc(linkPtr->bytes);
+ linkPtr->lastValue.aryPtr = Tcl_Alloc(linkPtr->bytes);
linkPtr->flags |= LINK_ALLOC_LAST;
}
@@ -623,20 +623,20 @@ SetInvalidRealFromAny(
Tcl_Interp *interp,
Tcl_Obj *objPtr)
{
- const char *str;
- const char *endPtr;
+ size_t length;
+ const char *str, *endPtr;
- str = TclGetString(objPtr);
- if ((objPtr->length == 1) && (str[0] == '.')) {
+ str = TclGetStringFromObj(objPtr, &length);
+ if ((length == 1) && (str[0] == '.')) {
objPtr->typePtr = &invalidRealType;
objPtr->internalRep.doubleValue = 0.0;
return TCL_OK;
}
- if (TclParseNumber(NULL, objPtr, NULL, str, objPtr->length, &endPtr,
+ if (TclParseNumber(NULL, objPtr, NULL, str, length, &endPtr,
TCL_PARSE_DECIMAL_ONLY) == TCL_OK) {
/*
- * If number is followed by [eE][+-]?, then it is an invalid
- * double, but it could be the start of a valid double.
+ * If number is followed by [eE][+-]?, then it is an invalid double,
+ * but it could be the start of a valid double.
*/
if (*endPtr == 'e' || *endPtr == 'E') {
@@ -659,10 +659,10 @@ SetInvalidRealFromAny(
}
/*
- * This function checks for integer representations, which are valid
- * when linking with C variables, but which are invalid in other
- * contexts in Tcl. Handled are "+", "-", "", "0x", "0b", "0d" and "0o"
- * (upperand lowercase). See bug [39f6304c2e].
+ * This function checks for integer representations, which are valid when
+ * linking with C variables, but which are invalid in other contexts in Tcl.
+ * Handled are "+", "-", "", "0x", "0b", "0d" and "0o" (upper- and
+ * lower-case). See bug [39f6304c2e].
*/
static int
@@ -670,13 +670,14 @@ GetInvalidIntFromObj(
Tcl_Obj *objPtr,
int *intPtr)
{
- const char *str = TclGetString(objPtr);
+ size_t length;
+ const char *str = TclGetStringFromObj(objPtr, &length);
- if ((objPtr->length == 0) || ((objPtr->length == 2) && (str[0] == '0')
- && strchr("xXbBoOdD", str[1]))) {
+ if ((length == 0) ||
+ ((length == 2) && (str[0] == '0') && strchr("xXbBoOdD", str[1]))) {
*intPtr = 0;
return TCL_OK;
- } else if ((objPtr->length == 1) && strchr("+-", str[0])) {
+ } else if ((length == 1) && strchr("+-", str[0])) {
*intPtr = (str[0] == '+');
return TCL_OK;
}
@@ -684,10 +685,10 @@ GetInvalidIntFromObj(
}
/*
- * This function checks for double representations, which are valid
- * when linking with C variables, but which are invalid in other
- * contexts in Tcl. Handled are "+", "-", "", ".", "0x", "0b" and "0o"
- * (upper- and lowercase) and sequences like "1e-". See bug [39f6304c2e].
+ * This function checks for double representations, which are valid when
+ * linking with C variables, but which are invalid in other contexts in Tcl.
+ * Handled are "+", "-", "", ".", "0x", "0b" and "0o" (upper- and lower-case)
+ * and sequences like "1e-". See bug [39f6304c2e].
*/
static int
@@ -743,7 +744,7 @@ LinkTraceProc(
{
Link *linkPtr = clientData;
int changed;
- int valueLength;
+ size_t valueLength = 0;
const char *value;
char **pp;
Tcl_Obj *valueObj;
@@ -767,7 +768,7 @@ LinkTraceProc(
} else if (flags & TCL_TRACE_DESTROYED) {
Tcl_ObjSetVar2(interp, linkPtr->varName, NULL, ObjValue(linkPtr),
TCL_GLOBAL_ONLY);
- Tcl_TraceVar2(interp, Tcl_GetString(linkPtr->varName), NULL,
+ Tcl_TraceVar2(interp, TclGetString(linkPtr->varName), NULL,
TCL_GLOBAL_ONLY|TCL_TRACE_READS|TCL_TRACE_WRITES
|TCL_TRACE_UNSETS, LinkTraceProc, linkPtr);
}
@@ -885,16 +886,15 @@ LinkTraceProc(
switch (linkPtr->type) {
case TCL_LINK_STRING:
- value = TclGetString(valueObj);
- valueLength = valueObj->length + 1;
+ value = TclGetStringFromObj(valueObj, &valueLength);
pp = (char **) linkPtr->addr;
- *pp = ckrealloc(*pp, valueLength);
+ *pp = Tcl_Realloc(*pp, ++valueLength);
memcpy(*pp, value, valueLength);
return NULL;
case TCL_LINK_CHARS:
- value = (char *) Tcl_GetStringFromObj(valueObj, &valueLength);
+ value = (char *) TclGetStringFromObj(valueObj, &valueLength);
valueLength++; /* include end of string char */
if (valueLength > linkPtr->bytes) {
return (char *) "wrong size of char* value";
@@ -909,7 +909,7 @@ LinkTraceProc(
return NULL;
case TCL_LINK_BINARY:
- value = (char *) Tcl_GetByteArrayFromObj(valueObj, &valueLength);
+ value = (char *) TclGetByteArrayFromObj(valueObj, &valueLength);
if (valueLength != linkPtr->bytes) {
return (char *) "wrong size of binary value";
}
@@ -937,7 +937,7 @@ LinkTraceProc(
if (linkPtr->flags & LINK_ALLOC_LAST) {
if (Tcl_ListObjGetElements(NULL, (valueObj), &objc, &objv) == TCL_ERROR
- || objc != linkPtr->numElems) {
+ || (size_t)objc != linkPtr->numElems) {
return (char *) "wrong dimension";
}
}
@@ -1277,18 +1277,18 @@ ObjValue(
{
char *p;
Tcl_Obj *resultObj, **objv;
- int i;
+ size_t i;
switch (linkPtr->type) {
case TCL_LINK_INT:
if (linkPtr->flags & LINK_ALLOC_LAST) {
memcpy(linkPtr->lastValue.aryPtr, linkPtr->addr, linkPtr->bytes);
- objv = ckalloc(linkPtr->numElems * sizeof(Tcl_Obj *));
+ objv = Tcl_Alloc(linkPtr->numElems * sizeof(Tcl_Obj *));
for (i=0; i < linkPtr->numElems; i++) {
objv[i] = Tcl_NewIntObj(linkPtr->lastValue.iPtr[i]);
}
resultObj = Tcl_NewListObj(linkPtr->numElems, objv);
- ckfree(objv);
+ Tcl_Free(objv);
return resultObj;
}
linkPtr->lastValue.i = LinkedVar(int);
@@ -1296,12 +1296,12 @@ ObjValue(
case TCL_LINK_WIDE_INT:
if (linkPtr->flags & LINK_ALLOC_LAST) {
memcpy(linkPtr->lastValue.aryPtr, linkPtr->addr, linkPtr->bytes);
- objv = ckalloc(linkPtr->numElems * sizeof(Tcl_Obj *));
+ objv = Tcl_Alloc(linkPtr->numElems * sizeof(Tcl_Obj *));
for (i=0; i < linkPtr->numElems; i++) {
objv[i] = Tcl_NewWideIntObj(linkPtr->lastValue.wPtr[i]);
}
resultObj = Tcl_NewListObj(linkPtr->numElems, objv);
- ckfree(objv);
+ Tcl_Free(objv);
return resultObj;
}
linkPtr->lastValue.w = LinkedVar(Tcl_WideInt);
@@ -1309,12 +1309,12 @@ ObjValue(
case TCL_LINK_DOUBLE:
if (linkPtr->flags & LINK_ALLOC_LAST) {
memcpy(linkPtr->lastValue.aryPtr, linkPtr->addr, linkPtr->bytes);
- objv = ckalloc(linkPtr->numElems * sizeof(Tcl_Obj *));
+ objv = Tcl_Alloc(linkPtr->numElems * sizeof(Tcl_Obj *));
for (i=0; i < linkPtr->numElems; i++) {
objv[i] = Tcl_NewDoubleObj(linkPtr->lastValue.dPtr[i]);
}
resultObj = Tcl_NewListObj(linkPtr->numElems, objv);
- ckfree(objv);
+ Tcl_Free(objv);
return resultObj;
}
linkPtr->lastValue.d = LinkedVar(double);
@@ -1322,12 +1322,12 @@ ObjValue(
case TCL_LINK_BOOLEAN:
if (linkPtr->flags & LINK_ALLOC_LAST) {
memcpy(linkPtr->lastValue.aryPtr, linkPtr->addr, linkPtr->bytes);
- objv = ckalloc(linkPtr->numElems * sizeof(Tcl_Obj *));
+ objv = Tcl_Alloc(linkPtr->numElems * sizeof(Tcl_Obj *));
for (i=0; i < linkPtr->numElems; i++) {
objv[i] = Tcl_NewBooleanObj(linkPtr->lastValue.iPtr[i] != 0);
}
resultObj = Tcl_NewListObj(linkPtr->numElems, objv);
- ckfree(objv);
+ Tcl_Free(objv);
return resultObj;
}
linkPtr->lastValue.i = LinkedVar(int);
@@ -1335,12 +1335,12 @@ ObjValue(
case TCL_LINK_CHAR:
if (linkPtr->flags & LINK_ALLOC_LAST) {
memcpy(linkPtr->lastValue.aryPtr, linkPtr->addr, linkPtr->bytes);
- objv = ckalloc(linkPtr->numElems * sizeof(Tcl_Obj *));
+ objv = Tcl_Alloc(linkPtr->numElems * sizeof(Tcl_Obj *));
for (i=0; i < linkPtr->numElems; i++) {
objv[i] = Tcl_NewIntObj(linkPtr->lastValue.cPtr[i]);
}
resultObj = Tcl_NewListObj(linkPtr->numElems, objv);
- ckfree(objv);
+ Tcl_Free(objv);
return resultObj;
}
linkPtr->lastValue.c = LinkedVar(char);
@@ -1348,12 +1348,12 @@ ObjValue(
case TCL_LINK_UCHAR:
if (linkPtr->flags & LINK_ALLOC_LAST) {
memcpy(linkPtr->lastValue.aryPtr, linkPtr->addr, linkPtr->bytes);
- objv = ckalloc(linkPtr->numElems * sizeof(Tcl_Obj *));
+ objv = Tcl_Alloc(linkPtr->numElems * sizeof(Tcl_Obj *));
for (i=0; i < linkPtr->numElems; i++) {
objv[i] = Tcl_NewIntObj(linkPtr->lastValue.ucPtr[i]);
}
resultObj = Tcl_NewListObj(linkPtr->numElems, objv);
- ckfree(objv);
+ Tcl_Free(objv);
return resultObj;
}
linkPtr->lastValue.uc = LinkedVar(unsigned char);
@@ -1361,12 +1361,12 @@ ObjValue(
case TCL_LINK_SHORT:
if (linkPtr->flags & LINK_ALLOC_LAST) {
memcpy(linkPtr->lastValue.aryPtr, linkPtr->addr, linkPtr->bytes);
- objv = ckalloc(linkPtr->numElems * sizeof(Tcl_Obj *));
+ objv = Tcl_Alloc(linkPtr->numElems * sizeof(Tcl_Obj *));
for (i=0; i < linkPtr->numElems; i++) {
objv[i] = Tcl_NewIntObj(linkPtr->lastValue.sPtr[i]);
}
resultObj = Tcl_NewListObj(linkPtr->numElems, objv);
- ckfree(objv);
+ Tcl_Free(objv);
return resultObj;
}
linkPtr->lastValue.s = LinkedVar(short);
@@ -1374,12 +1374,12 @@ ObjValue(
case TCL_LINK_USHORT:
if (linkPtr->flags & LINK_ALLOC_LAST) {
memcpy(linkPtr->lastValue.aryPtr, linkPtr->addr, linkPtr->bytes);
- objv = ckalloc(linkPtr->numElems * sizeof(Tcl_Obj *));
+ objv = Tcl_Alloc(linkPtr->numElems * sizeof(Tcl_Obj *));
for (i=0; i < linkPtr->numElems; i++) {
objv[i] = Tcl_NewIntObj(linkPtr->lastValue.usPtr[i]);
}
resultObj = Tcl_NewListObj(linkPtr->numElems, objv);
- ckfree(objv);
+ Tcl_Free(objv);
return resultObj;
}
linkPtr->lastValue.us = LinkedVar(unsigned short);
@@ -1387,12 +1387,12 @@ ObjValue(
case TCL_LINK_UINT:
if (linkPtr->flags & LINK_ALLOC_LAST) {
memcpy(linkPtr->lastValue.aryPtr, linkPtr->addr, linkPtr->bytes);
- objv = ckalloc(linkPtr->numElems * sizeof(Tcl_Obj *));
+ objv = Tcl_Alloc(linkPtr->numElems * sizeof(Tcl_Obj *));
for (i=0; i < linkPtr->numElems; i++) {
objv[i] = Tcl_NewWideIntObj(linkPtr->lastValue.uiPtr[i]);
}
resultObj = Tcl_NewListObj(linkPtr->numElems, objv);
- ckfree(objv);
+ Tcl_Free(objv);
return resultObj;
}
linkPtr->lastValue.ui = LinkedVar(unsigned int);
@@ -1401,12 +1401,12 @@ ObjValue(
case TCL_LINK_LONG:
if (linkPtr->flags & LINK_ALLOC_LAST) {
memcpy(linkPtr->lastValue.aryPtr, linkPtr->addr, linkPtr->bytes);
- objv = ckalloc(linkPtr->numElems * sizeof(Tcl_Obj *));
+ objv = Tcl_Alloc(linkPtr->numElems * sizeof(Tcl_Obj *));
for (i=0; i < linkPtr->numElems; i++) {
objv[i] = Tcl_NewWideIntObj(linkPtr->lastValue.lPtr[i]);
}
resultObj = Tcl_NewListObj(linkPtr->numElems, objv);
- ckfree(objv);
+ Tcl_Free(objv);
return resultObj;
}
linkPtr->lastValue.l = LinkedVar(long);
@@ -1414,12 +1414,12 @@ ObjValue(
case TCL_LINK_ULONG:
if (linkPtr->flags & LINK_ALLOC_LAST) {
memcpy(linkPtr->lastValue.aryPtr, linkPtr->addr, linkPtr->bytes);
- objv = ckalloc(linkPtr->numElems * sizeof(Tcl_Obj *));
+ objv = Tcl_Alloc(linkPtr->numElems * sizeof(Tcl_Obj *));
for (i=0; i < linkPtr->numElems; i++) {
objv[i] = Tcl_NewWideIntObj(linkPtr->lastValue.ulPtr[i]);
}
resultObj = Tcl_NewListObj(linkPtr->numElems, objv);
- ckfree(objv);
+ Tcl_Free(objv);
return resultObj;
}
linkPtr->lastValue.ul = LinkedVar(unsigned long);
@@ -1428,12 +1428,12 @@ ObjValue(
case TCL_LINK_FLOAT:
if (linkPtr->flags & LINK_ALLOC_LAST) {
memcpy(linkPtr->lastValue.aryPtr, linkPtr->addr, linkPtr->bytes);
- objv = ckalloc(linkPtr->numElems * sizeof(Tcl_Obj *));
+ objv = Tcl_Alloc(linkPtr->numElems * sizeof(Tcl_Obj *));
for (i=0; i < linkPtr->numElems; i++) {
objv[i] = Tcl_NewDoubleObj(linkPtr->lastValue.fPtr[i]);
}
resultObj = Tcl_NewListObj(linkPtr->numElems, objv);
- ckfree(objv);
+ Tcl_Free(objv);
return resultObj;
}
linkPtr->lastValue.f = LinkedVar(float);
@@ -1441,13 +1441,13 @@ ObjValue(
case TCL_LINK_WIDE_UINT:
if (linkPtr->flags & LINK_ALLOC_LAST) {
memcpy(linkPtr->lastValue.aryPtr, linkPtr->addr, linkPtr->bytes);
- objv = ckalloc(linkPtr->numElems * sizeof(Tcl_Obj *));
+ objv = Tcl_Alloc(linkPtr->numElems * sizeof(Tcl_Obj *));
for (i=0; i < linkPtr->numElems; i++) {
objv[i] = Tcl_NewWideIntObj((Tcl_WideInt)
linkPtr->lastValue.uwPtr[i]);
}
resultObj = Tcl_NewListObj(linkPtr->numElems, objv);
- ckfree(objv);
+ Tcl_Free(objv);
return resultObj;
}
linkPtr->lastValue.uw = LinkedVar(Tcl_WideUInt);
@@ -1515,12 +1515,12 @@ LinkFree(
TclNsDecrRefCount(linkPtr->nsPtr);
}
if (linkPtr->flags & LINK_ALLOC_ADDR) {
- ckfree(linkPtr->addr);
+ Tcl_Free(linkPtr->addr);
}
if (linkPtr->flags & LINK_ALLOC_LAST) {
- ckfree(linkPtr->lastValue.aryPtr);
+ Tcl_Free(linkPtr->lastValue.aryPtr);
}
- ckfree((char *) linkPtr);
+ Tcl_Free(linkPtr);
}
/*
diff --git a/generic/tclListObj.c b/generic/tclListObj.c
index ad64971..023794c 100644
--- a/generic/tclListObj.c
+++ b/generic/tclListObj.c
@@ -77,20 +77,22 @@ const Tcl_ObjType tclListType = {
*
* NewListIntRep --
*
- * Creates a list internal rep with space for objc elements. objc
- * must be > 0. If objv!=NULL, initializes with the first objc values
- * in that array. If objv==NULL, initalize list internal rep to have
- * 0 elements, with space to add objc more. Flag value "p" indicates
+ * Creates a 'List' structure with space for 'objc' elements. 'objc' must
+ * be > 0. If 'objv' is not NULL, The list is initialized with first
+ * 'objc' values in that array. Otherwise the list is initialized to have
+ * 0 elements, with space to add 'objc' more. Flag value 'p' indicates
* how to behave on failure.
*
- * Results:
- * A new List struct with refCount 0 is returned. If some failure
- * prevents this then if p=0, NULL is returned and otherwise the
- * routine panics.
+ * Value
*
- * Side effects:
- * The ref counts of the elements in objv are incremented since the
- * resulting list now refers to them.
+ * A new 'List' structure with refCount 0. If some failure
+ * prevents this NULL is returned if 'p' is 0 , and 'Tcl_Panic'
+ * is called if it is not.
+ *
+ * Effect
+ *
+ * The refCount of each value in 'objv' is incremented as it is added
+ * to the list.
*
*----------------------------------------------------------------------
*/
@@ -122,10 +124,10 @@ NewListIntRep(
return NULL;
}
- listRepPtr = attemptckalloc(LIST_SIZE(objc));
+ listRepPtr = Tcl_AttemptAlloc(LIST_SIZE(objc));
if (listRepPtr == NULL) {
if (p) {
- Tcl_Panic("list creation failed: unable to alloc %u bytes",
+ Tcl_Panic("list creation failed: unable to alloc %" TCL_Z_MODIFIER "u bytes",
LIST_SIZE(objc));
}
return NULL;
@@ -154,21 +156,9 @@ NewListIntRep(
/*
*----------------------------------------------------------------------
*
- * AttemptNewList --
+ * AttemptNewList --
*
- * Creates a list internal rep with space for objc elements. objc
- * must be > 0. If objv!=NULL, initializes with the first objc values
- * in that array. If objv==NULL, initalize list internal rep to have
- * 0 elements, with space to add objc more.
- *
- * Results:
- * A new List struct with refCount 0 is returned. If some failure
- * prevents this then NULL is returned, and an error message is left
- * in the interp result, unless interp is NULL.
- *
- * Side effects:
- * The ref counts of the elements in objv are incremented since the
- * resulting list now refers to them.
+ * Like NewListIntRep, but additionally sets an error message on failure.
*
*----------------------------------------------------------------------
*/
@@ -188,7 +178,7 @@ AttemptNewList(
LIST_MAX));
} else {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "list creation failed: unable to alloc %u bytes",
+ "list creation failed: unable to alloc %" TCL_Z_MODIFIER "u bytes",
LIST_SIZE(objc)));
}
Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL);
@@ -201,23 +191,20 @@ AttemptNewList(
*
* Tcl_NewListObj --
*
- * This function is normally called when not debugging: i.e., when
- * TCL_MEM_DEBUG is not defined. It creates a new list object from an
- * (objc,objv) array: that is, each of the objc elements of the array
- * referenced by objv is inserted as an element into a new Tcl object.
+ * Creates a new list object and adds values to it. When TCL_MEM_DEBUG is
+ * defined, 'Tcl_DbNewListObj' is called instead.
*
- * When TCL_MEM_DEBUG is defined, this function just returns the result
- * of calling the debugging version Tcl_DbNewListObj.
+ * Value
*
- * Results:
- * A new list object is returned that is initialized from the object
- * pointers in objv. If objc is less than or equal to zero, an empty
- * object is returned. The new object's string representation is left
- * NULL. The resulting new list object has ref count 0.
+ * A new list 'Tcl_Obj' to which is appended values from 'objv', or if
+ * 'objc' is less than or equal to zero, a list 'Tcl_Obj' having no
+ * elements. The string representation of the new 'Tcl_Obj' is set to
+ * NULL. The refCount of the list is 0.
*
- * Side effects:
- * The ref counts of the elements in objv are incremented since the
- * resulting list now refers to them.
+ * Effect
+ *
+ * The refCount of each elements in 'objv' is incremented as it is added
+ * to the list.
*
*----------------------------------------------------------------------
*/
@@ -268,28 +255,14 @@ Tcl_NewListObj(
/*
*----------------------------------------------------------------------
*
- * Tcl_DbNewListObj --
- *
- * This function is normally called when debugging: i.e., when
- * TCL_MEM_DEBUG is defined. It creates new list objects. It is the same
- * as the Tcl_NewListObj function above except that it calls
- * Tcl_DbCkalloc directly with the file name and line number from its
- * caller. This simplifies debugging since then the [memory active]
- * command will report the correct file name and line number when
- * reporting objects that haven't been freed.
+ * Tcl_DbNewListObj --
*
- * When TCL_MEM_DEBUG is not defined, this function just returns the
- * result of calling Tcl_NewListObj.
+ * Like 'Tcl_NewListObj', but it calls Tcl_DbCkalloc directly with the
+ * file name and line number from its caller. This simplifies debugging
+ * since the [memory active] command will report the correct file
+ * name and line number when reporting objects that haven't been freed.
*
- * Results:
- * A new list object is returned that is initialized from the object
- * pointers in objv. If objc is less than or equal to zero, an empty
- * object is returned. The new object's string representation is left
- * NULL. The new list object has ref count 0.
- *
- * Side effects:
- * The ref counts of the elements in objv are incremented since the
- * resulting list now refers to them.
+ * When TCL_MEM_DEBUG is not defined, 'Tcl_NewListObj' is called instead.
*
*----------------------------------------------------------------------
*/
@@ -350,19 +323,8 @@ Tcl_DbNewListObj(
*
* Tcl_SetListObj --
*
- * Modify an object to be a list containing each of the objc elements of
- * the object array referenced by objv.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The object is made a list object and is initialized from the object
- * pointers in objv. If objc is less than or equal to zero, an empty
- * object is returned. The new object's string representation is left
- * NULL. The ref counts of the elements in objv are incremented since the
- * list now refers to them. The object's old string and internal
- * representations are freed and its type is set NULL.
+ * Like 'Tcl_NewListObj', but operates on an existing 'Tcl_Obj'instead of
+ * creating a new one.
*
*----------------------------------------------------------------------
*/
@@ -405,18 +367,20 @@ Tcl_SetListObj(
*
* TclListObjCopy --
*
- * Makes a "pure list" copy of a list value. This provides for the C
- * level a counterpart of the [lrange $list 0 end] command, while using
- * internals details to be as efficient as possible.
+ * Creates a new 'Tcl_Obj' which is a pure copy of a list value. This
+ * provides for the C level a counterpart of the [lrange $list 0 end]
+ * command, while using internals details to be as efficient as possible.
*
- * Results:
- * Normally returns a pointer to a new Tcl_Obj, that contains the same
- * list value as *listPtr does. The returned Tcl_Obj has a refCount of
- * zero. If *listPtr does not hold a list, NULL is returned, and if
- * interp is non-NULL, an error message is recorded there.
+ * Value
*
- * Side effects:
- * None.
+ * The address of the new 'Tcl_Obj' which shares its internal
+ * representation with 'listPtr', and whose refCount is 0. If 'listPtr'
+ * is not actually a list, the value is NULL, and an error message is left
+ * in 'interp' if it is not NULL.
+ *
+ * Effect
+ *
+ * 'listPtr' is converted to a list if it isn't one already.
*
*----------------------------------------------------------------------
*/
@@ -529,27 +493,30 @@ TclListObjRange(
*
* Tcl_ListObjGetElements --
*
- * This function returns an (objc,objv) array of the elements in a list
- * object.
+ * Retreive the elements in a list 'Tcl_Obj'.
*
- * Results:
- * The return value is normally TCL_OK; in this case *objcPtr is set to
- * the count of list elements and *objvPtr is set to a pointer to an
- * array of (*objcPtr) pointers to each list element. If listPtr does not
- * refer to a list object and the object can not be converted to one,
- * TCL_ERROR is returned and an error message will be left in the
- * interpreter's result if interp is not NULL.
- *
- * The objects referenced by the returned array should be treated as
- * readonly and their ref counts are _not_ incremented; the caller must
- * do that if it holds on to a reference. Furthermore, the pointer and
- * length returned by this function may change as soon as any function is
- * called on the list object; be careful about retaining the pointer in a
- * local data structure.
+ * Value
*
- * Side effects:
- * The possible conversion of the object referenced by listPtr
- * to a list object.
+ * TCL_OK
+ *
+ * A count of list elements is stored, 'objcPtr', And a pointer to the
+ * array of elements in the list is stored in 'objvPtr'.
+ *
+ * The elements accessible via 'objvPtr' should be treated as readonly
+ * and the refCount for each object is _not_ incremented; the caller
+ * must do that if it holds on to a reference. Furthermore, the
+ * pointer and length returned by this function may change as soon as
+ * any function is called on the list object. Be careful about
+ * retaining the pointer in a local data structure.
+ *
+ * TCL_ERROR
+ *
+ * 'listPtr' is not a valid list. An error message is left in the
+ * interpreter's result if 'interp' is not NULL.
+ *
+ * Effect
+ *
+ * 'listPtr' is converted to a list object if it isn't one already.
*
*----------------------------------------------------------------------
*/
@@ -569,9 +536,10 @@ Tcl_ListObjGetElements(
ListGetIntRep(listPtr, listRepPtr);
if (listRepPtr == NULL) {
- int result, length;
+ int result;
+ size_t length;
- (void) Tcl_GetStringFromObj(listPtr, &length);
+ (void) TclGetStringFromObj(listPtr, &length);
if (length == 0) {
*objcPtr = 0;
*objvPtr = NULL;
@@ -593,20 +561,27 @@ Tcl_ListObjGetElements(
*
* Tcl_ListObjAppendList --
*
- * This function appends the elements in the list value referenced by
- * elemListPtr to the list value referenced by listPtr.
+ * Appends the elements of elemListPtr to those of listPtr.
*
- * Results:
- * The return value is normally TCL_OK. If listPtr or elemListPtr do not
- * refer to list values, TCL_ERROR is returned and an error message is
- * left in the interpreter's result if interp is not NULL.
+ * Value
*
- * Side effects:
- * The reference counts of the elements in elemListPtr are incremented
- * since the list now refers to them. listPtr and elemListPtr are
- * converted, if necessary, to list objects. Also, appending the new
- * elements may cause listObj's array of element pointers to grow.
- * listPtr's old string representation, if any, is invalidated.
+ * TCL_OK
+ *
+ * Success.
+ *
+ * TCL_ERROR
+ *
+ * 'listPtr' or 'elemListPtr' are not valid lists. An error
+ * message is left in the interpreter's result if 'interp' is not NULL.
+ *
+ * Effect
+ *
+ * The reference count of each element of 'elemListPtr' as it is added to
+ * 'listPtr'. 'listPtr' and 'elemListPtr' are converted to 'tclListType'
+ * if they are not already. Appending the new elements may cause the
+ * array of element pointers in 'listObj' to grow. If any objects are
+ * appended to 'listPtr'. Any preexisting string representation of
+ * 'listPtr' is invalidated.
*
*----------------------------------------------------------------------
*/
@@ -645,24 +620,27 @@ Tcl_ListObjAppendList(
*
* Tcl_ListObjAppendElement --
*
- * This function is a special purpose version of Tcl_ListObjAppendList:
- * it appends a single object referenced by objPtr to the list object
- * referenced by listPtr. If listPtr is not already a list object, an
- * attempt will be made to convert it to one.
+ * Like 'Tcl_ListObjAppendList', but Appends a single value to a list.
*
- * Results:
- * The return value is normally TCL_OK; in this case objPtr is added to
- * the end of listPtr's list. If listPtr does not refer to a list object
- * and the object can not be converted to one, TCL_ERROR is returned and
- * an error message will be left in the interpreter's result if interp is
- * not NULL.
+ * Value
*
- * Side effects:
- * The ref count of objPtr is incremented since the list now refers to
- * it. listPtr will be converted, if necessary, to a list object. Also,
- * appending the new element may cause listObj's array of element
- * pointers to grow. listPtr's old string representation, if any, is
- * invalidated.
+ * TCL_OK
+ *
+ * 'objPtr' is appended to the elements of 'listPtr'.
+ *
+ * TCL_ERROR
+ *
+ * listPtr does not refer to a list object and the object can not be
+ * converted to one. An error message will be left in the
+ * interpreter's result if interp is not NULL.
+ *
+ * Effect
+ *
+ * If 'listPtr' is not already of type 'tclListType', it is converted.
+ * The 'refCount' of 'objPtr' is incremented as it is added to 'listPtr'.
+ * Appending the new element may cause the the array of element pointers
+ * in 'listObj' to grow. Any preexisting string representation of
+ * 'listPtr' is invalidated.
*
*----------------------------------------------------------------------
*/
@@ -682,9 +660,10 @@ Tcl_ListObjAppendElement(
ListGetIntRep(listPtr, listRepPtr);
if (listRepPtr == NULL) {
- int result, length;
+ int result;
+ size_t length;
- (void) Tcl_GetStringFromObj(listPtr, &length);
+ (void) TclGetStringFromObj(listPtr, &length);
if (length == 0) {
Tcl_SetListObj(listPtr, 1, &objPtr);
return TCL_OK;
@@ -718,18 +697,18 @@ Tcl_ListObjAppendElement(
attempt = 2 * numRequired;
if (attempt <= LIST_MAX) {
- newPtr = attemptckrealloc(listRepPtr, LIST_SIZE(attempt));
+ newPtr = Tcl_AttemptRealloc(listRepPtr, LIST_SIZE(attempt));
}
if (newPtr == NULL) {
attempt = numRequired + 1 + TCL_MIN_ELEMENT_GROWTH;
if (attempt > LIST_MAX) {
attempt = LIST_MAX;
}
- newPtr = attemptckrealloc(listRepPtr, LIST_SIZE(attempt));
+ newPtr = Tcl_AttemptRealloc(listRepPtr, LIST_SIZE(attempt));
}
if (newPtr == NULL) {
attempt = numRequired;
- newPtr = attemptckrealloc(listRepPtr, LIST_SIZE(attempt));
+ newPtr = Tcl_AttemptRealloc(listRepPtr, LIST_SIZE(attempt));
}
if (newPtr) {
listRepPtr = newPtr;
@@ -787,7 +766,7 @@ Tcl_ListObjAppendElement(
*/
memcpy(dst, src, numElems * sizeof(Tcl_Obj *));
- ckfree(listRepPtr);
+ Tcl_Free(listRepPtr);
}
listRepPtr = newPtr;
}
@@ -820,23 +799,27 @@ Tcl_ListObjAppendElement(
*
* Tcl_ListObjIndex --
*
- * This function returns a pointer to the index'th object from the list
- * referenced by listPtr. The first element has index 0. If index is
- * negative or greater than or equal to the number of elements in the
- * list, a NULL is returned. If listPtr is not a list object, an attempt
- * will be made to convert it to a list.
+ * Retrieve a pointer to the element of 'listPtr' at 'index'. The index
+ * of the first element is 0.
*
- * Results:
- * The return value is normally TCL_OK; in this case objPtrPtr is set to
- * the Tcl_Obj pointer for the index'th list element or NULL if index is
- * out of range. This object should be treated as readonly and its ref
- * count is _not_ incremented; the caller must do that if it holds on to
- * the reference. If listPtr does not refer to a list and can't be
- * converted to one, TCL_ERROR is returned and an error message is left
- * in the interpreter's result if interp is not NULL.
+ * Value
*
- * Side effects:
- * listPtr will be converted, if necessary, to a list object.
+ * TCL_OK
+ *
+ * A pointer to the element at 'index' is stored in 'objPtrPtr'. If
+ * 'index' is out of range, NULL is stored in 'objPtrPtr'. This
+ * object should be treated as readonly and its 'refCount' is _not_
+ * incremented. The caller must do that if it holds on to the
+ * reference.
+ *
+ * TCL_ERROR
+ *
+ * 'listPtr' is not a valid list. An an error message is left in the
+ * interpreter's result if 'interp' is not NULL.
+ *
+ * Effect
+ *
+ * If 'listPtr' is not already of type 'tclListType', it is converted.
*
*----------------------------------------------------------------------
*/
@@ -852,9 +835,10 @@ Tcl_ListObjIndex(
ListGetIntRep(listPtr, listRepPtr);
if (listRepPtr == NULL) {
- int result, length;
+ int result;
+ size_t length;
- (void) Tcl_GetStringFromObj(listPtr, &length);
+ (void) TclGetStringFromObj(listPtr, &length);
if (length == 0) {
*objPtrPtr = NULL;
return TCL_OK;
@@ -880,19 +864,20 @@ Tcl_ListObjIndex(
*
* Tcl_ListObjLength --
*
- * This function returns the number of elements in a list object. If the
- * object is not already a list object, an attempt will be made to
- * convert it to one.
+ * Retrieve the number of elements in a list.
*
- * Results:
- * The return value is normally TCL_OK; in this case *intPtr will be set
- * to the integer count of list elements. If listPtr does not refer to a
- * list object and the object can not be converted to one, TCL_ERROR is
- * returned and an error message will be left in the interpreter's result
- * if interp is not NULL.
+ * Value
*
- * Side effects:
- * The possible conversion of the argument object to a list object.
+ * TCL_OK
+ *
+ * A count of list elements is stored at the address provided by
+ * 'intPtr'. If 'listPtr' is not already of type 'tclListPtr', it is
+ * converted.
+ *
+ * TCL_ERROR
+ *
+ * 'listPtr' is not a valid list. An error message will be left in
+ * the interpreter's result if 'interp' is not NULL.
*
*----------------------------------------------------------------------
*/
@@ -907,9 +892,10 @@ Tcl_ListObjLength(
ListGetIntRep(listPtr, listRepPtr);
if (listRepPtr == NULL) {
- int result, length;
+ int result;
+ size_t length;
- (void) Tcl_GetStringFromObj(listPtr, &length);
+ (void) TclGetStringFromObj(listPtr, &length);
if (length == 0) {
*intPtr = 0;
return TCL_OK;
@@ -930,35 +916,36 @@ Tcl_ListObjLength(
*
* Tcl_ListObjReplace --
*
- * This function replaces zero or more elements of the list referenced by
- * listPtr with the objects from an (objc,objv) array. The objc elements
- * of the array referenced by objv replace the count elements in listPtr
- * starting at first.
+ * Replace values in a list.
*
- * If the argument first is zero or negative, it refers to the first
- * element. If first is greater than or equal to the number of elements
- * in the list, then no elements are deleted; the new elements are
- * appended to the list. Count gives the number of elements to replace.
- * If count is zero or negative then no elements are deleted; the new
- * elements are simply inserted before first.
+ * If 'first' is zero or negative, it refers to the first element. If
+ * 'first' outside the range of elements in the list, no elements are
+ * deleted.
*
- * The argument objv refers to an array of objc pointers to the new
- * elements to be added to listPtr in place of those that were deleted.
- * If objv is NULL, no new elements are added. If listPtr is not a list
- * object, an attempt will be made to convert it to one.
+ * If 'count' is zero or negative no elements are deleted, and any new
+ * elements are inserted at the beginning of the list.
*
- * Results:
- * The return value is normally TCL_OK. If listPtr does not refer to a
- * list object and can not be converted to one, TCL_ERROR is returned and
- * an error message will be left in the interpreter's result if interp is
- * not NULL.
+ * Value
*
- * Side effects:
- * The ref counts of the objc elements in objv are incremented since the
- * resulting list now refers to them. Similarly, the ref counts for
- * replaced objects are decremented. listPtr is converted, if necessary,
- * to a list object. listPtr's old string representation, if any, is
- * freed.
+ * TCL_OK
+ *
+ * The first 'objc' values of 'objv' replaced 'count' elements in 'listPtr'
+ * starting at 'first'. If 'objc' 0, no new elements are added.
+ *
+ * TCL_ERROR
+ *
+ * 'listPtr' is not a valid list. An error message is left in the
+ * interpreter's result if 'interp' is not NULL.
+ *
+ * Effect
+ *
+ * If 'listPtr' is not of type 'tclListType', it is converted if possible.
+ *
+ * The 'refCount' of each element appended to the list is incremented.
+ * Similarly, the 'refCount' for each replaced element is decremented.
+ *
+ * If 'listPtr' is modified, any previous string representation is
+ * invalidated.
*
*----------------------------------------------------------------------
*/
@@ -983,9 +970,9 @@ Tcl_ListObjReplace(
ListGetIntRep(listPtr, listRepPtr);
if (listRepPtr == NULL) {
- int length;
+ size_t length;
- (void) Tcl_GetStringFromObj(listPtr, &length);
+ (void) TclGetStringFromObj(listPtr, &length);
if (length == 0) {
if (objc == 0) {
return TCL_OK;
@@ -1047,18 +1034,18 @@ Tcl_ListObjReplace(
List *newPtr = NULL;
int attempt = 2 * numRequired;
if (attempt <= LIST_MAX) {
- newPtr = attemptckrealloc(listRepPtr, LIST_SIZE(attempt));
+ newPtr = Tcl_AttemptRealloc(listRepPtr, LIST_SIZE(attempt));
}
if (newPtr == NULL) {
attempt = numRequired + 1 + TCL_MIN_ELEMENT_GROWTH;
if (attempt > LIST_MAX) {
attempt = LIST_MAX;
}
- newPtr = attemptckrealloc(listRepPtr, LIST_SIZE(attempt));
+ newPtr = Tcl_AttemptRealloc(listRepPtr, LIST_SIZE(attempt));
}
if (newPtr == NULL) {
attempt = numRequired;
- newPtr = attemptckrealloc(listRepPtr, LIST_SIZE(attempt));
+ newPtr = Tcl_AttemptRealloc(listRepPtr, LIST_SIZE(attempt));
}
if (newPtr) {
listRepPtr = newPtr;
@@ -1093,7 +1080,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 {
/*
@@ -1124,11 +1111,7 @@ Tcl_ListObjReplace(
if (listRepPtr == NULL) {
for (i = 0; i < objc; i++) {
/* See bug 3598580 */
-#if TCL_MAJOR_VERSION > 8
Tcl_DecrRefCount(objv[i]);
-#else
- objv[i]->refCount--;
-#endif
}
return TCL_ERROR;
}
@@ -1189,7 +1172,7 @@ Tcl_ListObjReplace(
(size_t) numAfterLast * sizeof(Tcl_Obj *));
}
- ckfree(oldListRepPtr);
+ Tcl_Free(oldListRepPtr);
}
}
@@ -1226,22 +1209,19 @@ Tcl_ListObjReplace(
*
* TclLindexList --
*
- * This procedure handles the 'lindex' command when objc==3.
+ * Implements the 'lindex' command when objc==3.
*
- * Results:
- * Returns a pointer to the object extracted, or NULL if an error
- * occurred. The returned object already includes one reference count for
- * the pointer returned.
+ * Implemented entirely as a wrapper around 'TclLindexFlat'. Reconfigures
+ * the argument format into required form while taking care to manage
+ * shimmering so as to tend to keep the most useful intreps
+ * and/or avoid the most expensive conversions.
*
- * Side effects:
- * None.
+ * Value
*
- * Notes:
- * This procedure is implemented entirely as a wrapper around
- * TclLindexFlat. All it does is reconfigure the argument format into the
- * form required by TclLindexFlat, while taking care to manage shimmering
- * in such a way that we tend to keep the most useful intreps and/or
- * avoid the most expensive conversions.
+ * A pointer to the specified element, with its 'refCount' incremented, or
+ * NULL if an error occurred.
+ *
+ * Notes
*
*----------------------------------------------------------------------
*/
@@ -1253,7 +1233,7 @@ TclLindexList(
Tcl_Obj *argPtr) /* Index or index list. */
{
- int index; /* Index into the list. */
+ size_t index; /* Index into the list. */
Tcl_Obj *indexListCopy;
List *listRepPtr;
@@ -1265,7 +1245,7 @@ TclLindexList(
ListGetIntRep(argPtr, listRepPtr);
if ((listRepPtr == NULL)
- && TclGetIntForIndexM(NULL , argPtr, 0, &index) == TCL_OK) {
+ && TclGetIntForIndexM(NULL , argPtr, TCL_INDEX_START, &index) == TCL_OK) {
/*
* argPtr designates a single index.
*/
@@ -1308,25 +1288,20 @@ TclLindexList(
/*
*----------------------------------------------------------------------
*
- * TclLindexFlat --
+ * TclLindexFlat --
*
- * This procedure is the core of the 'lindex' command, with all index
- * arguments presented as a flat list.
+ * The core of the 'lindex' command, with all index
+ * arguments presented as a flat list.
*
- * Results:
- * Returns a pointer to the object extracted, or NULL if an error
- * occurred. The returned object already includes one reference count for
- * the pointer returned.
+ * Value
*
- * Side effects:
- * None.
+ * A pointer to the object extracted, with its 'refCount' incremented, or
+ * NULL if an error occurred. Thus, the calling code will usually do
+ * something like:
+ *
+ * Tcl_SetObjResult(interp, result);
+ * Tcl_DecrRefCount(result);
*
- * Notes:
- * The reference count of the returned object includes one reference
- * corresponding to the pointer returned. Thus, the calling code will
- * usually do something like:
- * Tcl_SetObjResult(interp, result);
- * Tcl_DecrRefCount(result);
*
*----------------------------------------------------------------------
*/
@@ -1344,7 +1319,8 @@ TclLindexFlat(
Tcl_IncrRefCount(listPtr);
for (i=0 ; i<indexCount && listPtr ; i++) {
- int index, listLen = 0;
+ size_t index;
+ int listLen = 0;
Tcl_Obj **elemPtrs = NULL, *sublistCopy;
/*
@@ -1368,14 +1344,14 @@ TclLindexFlat(
if (TclGetIntForIndexM(interp, indexArray[i], /*endValue*/ listLen-1,
&index) == TCL_OK) {
- if (index<0 || index>=listLen) {
+ if (index >= (size_t)listLen) {
/*
* Index is out of range. Break out of loop with empty result.
* First check remaining indices for validity
*/
while (++i < indexCount) {
- if (TclGetIntForIndexM(interp, indexArray[i], -1, &index)
+ if (TclGetIntForIndexM(interp, indexArray[i], TCL_INDEX_NONE, &index)
!= TCL_OK) {
Tcl_DecrRefCount(sublistCopy);
return NULL;
@@ -1402,24 +1378,17 @@ TclLindexFlat(
*
* TclLsetList --
*
- * Core of the 'lset' command when objc == 4. Objv[2] may be either a
+ * The core of [lset] when objc == 4. Objv[2] may be either a
* scalar index or a list of indices.
* It also handles 'lpop' when given a NULL value.
*
- * Results:
- * Returns the new value of the list variable, or NULL if there was an
- * error. The returned object includes one reference count for the
- * pointer returned.
+ * Implemented entirely as a wrapper around 'TclLindexFlat', as described
+ * for 'TclLindexList'.
*
- * Side effects:
- * None.
+ * Value
*
- * Notes:
- * This procedure is implemented entirely as a wrapper around
- * TclLsetFlat. All it does is reconfigure the argument format into the
- * form required by TclLsetFlat, while taking care to manage shimmering
- * in such a way that we tend to keep the most useful intreps and/or
- * avoid the most expensive conversions.
+ * The new list, with the 'refCount' of 'valuPtr' incremented, or NULL if
+ * there was an error.
*
*----------------------------------------------------------------------
*/
@@ -1434,7 +1403,7 @@ TclLsetList(
int indexCount = 0; /* Number of indices in the index list. */
Tcl_Obj **indices = NULL; /* Vector of indices in the index list. */
Tcl_Obj *retValuePtr; /* Pointer to the list to be returned. */
- int index; /* Current index in the list - discarded. */
+ size_t index; /* Current index in the list - discarded. */
Tcl_Obj *indexListCopy;
List *listRepPtr;
@@ -1446,7 +1415,7 @@ TclLsetList(
ListGetIntRep(indexArgPtr, listRepPtr);
if (listRepPtr == NULL
- && TclGetIntForIndexM(NULL, indexArgPtr, 0, &index) == TCL_OK) {
+ && TclGetIntForIndexM(NULL, indexArgPtr, TCL_INDEX_START, &index) == TCL_OK) {
/*
* indexArgPtr designates a single index.
*/
@@ -1484,36 +1453,39 @@ TclLsetList(
* Core engine of the 'lset' command.
* It also handles 'lpop' when given a NULL value.
*
- * Results:
- * Returns the new value of the list variable, or NULL if an error
- * occurred. The returned object includes one reference count for the
- * pointer returned.
+ * Value
*
- * Side effects:
- * On entry, the reference count of the variable value does not reflect
- * any references held on the stack. The first action of this function is
- * to determine whether the object is shared, and to duplicate it if it
- * is. The reference count of the duplicate is incremented. At this
- * point, the reference count will be 1 for either case, so that the
- * object will appear to be unshared.
- *
- * If an error occurs, and the object has been duplicated, the reference
- * count on the duplicate is decremented so that it is now 0: this
- * dismisses any memory that was allocated by this function.
- *
- * If no error occurs, the reference count of the original object is
- * incremented if the object has not been duplicated, and nothing is done
- * to a reference count of the duplicate. Now the reference count of an
- * unduplicated object is 2 (the returned pointer, plus the one stored in
- * the variable). The reference count of a duplicate object is 1,
- * reflecting that the returned pointer is the only active reference. The
- * caller is expected to store the returned value back in the variable
- * and decrement its reference count. (INST_STORE_* does exactly this.)
- *
- * Surgery is performed on the unshared list value to produce the result.
- * TclLsetFlat maintains a linked list of Tcl_Obj's whose string
+ * The resulting list
+ *
+ * The 'refCount' of 'valuePtr' is incremented. If 'listPtr' was not
+ * duplicated, its 'refCount' is incremented. The reference count of
+ * an unduplicated object is therefore 2 (one for the returned pointer
+ * and one for the variable that holds it). The reference count of a
+ * duplicate object is 1, reflecting that result is the only active
+ * reference. The caller is expected to store the result in the
+ * variable and decrement its reference count. (INST_STORE_* does
+ * exactly this.)
+ *
+ * NULL
+ *
+ * An error occurred. If 'listPtr' was duplicated, the reference
+ * count on the duplicate is decremented so that it is 0, causing any
+ * memory allocated by this function to be freed.
+ *
+ *
+ * Effect
+ *
+ * On entry, the reference count of 'listPtr' does not reflect any
+ * references held on the stack. The first action of this function is to
+ * determine whether 'listPtr' is shared and to create a duplicate
+ * unshared copy if it is. The reference count of the duplicate is
+ * incremented. At this point, the reference count is 1 in either case so
+ * that the object is considered unshared.
+ *
+ * The unshared list is altered directly to produce the result.
+ * 'TclLsetFlat' maintains a linked list of 'Tcl_Obj' values whose string
* representations must be spoilt by threading via 'ptr2' of the
- * two-pointer internal representation. On entry to TclLsetFlat, the
+ * two-pointer internal representation. On entry to 'TclLsetFlat', the
* values of 'ptr2' are immaterial; on exit, the 'ptr2' field of any
* Tcl_Obj that has been modified is set to NULL.
*
@@ -1529,7 +1501,8 @@ TclLsetFlat(
/* Index args. */
Tcl_Obj *valuePtr) /* Value arg to 'lset' or NULL to 'lpop'. */
{
- int index, result, len;
+ size_t index;
+ int result, len;
Tcl_Obj *subListPtr, *retValuePtr, *chainPtr;
Tcl_ObjIntRep *irPtr;
@@ -1602,8 +1575,8 @@ TclLsetFlat(
}
indexArray++;
- if (index < 0 || index > elemCount
- || (valuePtr == NULL && index >= elemCount)) {
+ if (index > (size_t)elemCount
+ || (valuePtr == NULL && index >= (size_t)elemCount)) {
/* ...the index points outside the sublist. */
if (interp != NULL) {
Tcl_SetObjResult(interp,
@@ -1625,7 +1598,7 @@ TclLsetFlat(
if (--indexCount) {
parentList = subListPtr;
- if (index == elemCount) {
+ if (index == (size_t)elemCount) {
subListPtr = Tcl_NewObj();
} else {
subListPtr = elemPtrs[index];
@@ -1643,7 +1616,7 @@ TclLsetFlat(
* and store another copy.
*/
- if (index == elemCount) {
+ if (index == (size_t)elemCount) {
Tcl_ListObjAppendElement(NULL, parentList, subListPtr);
} else {
TclListObjSetElement(NULL, parentList, index, subListPtr);
@@ -1732,7 +1705,7 @@ TclLsetFlat(
TclListObjLength(NULL, subListPtr, &len);
if (valuePtr == NULL) {
Tcl_ListObjReplace(NULL, subListPtr, index, 1, 0, NULL);
- } else if (index == len) {
+ } else if (index == (size_t)len) {
Tcl_ListObjAppendElement(NULL, subListPtr, valuePtr);
} else {
TclListObjSetElement(NULL, subListPtr, index, valuePtr);
@@ -1747,26 +1720,38 @@ TclLsetFlat(
*
* TclListObjSetElement --
*
- * Set a single element of a list to a specified value
+ * Set a single element of a list to a specified value.
*
- * Results:
- * The return value is normally TCL_OK. If listPtr does not refer to a
- * list object and cannot be converted to one, TCL_ERROR is returned and
- * an error message will be left in the interpreter result if interp is
- * not NULL. Similarly, if index designates an element outside the range
- * [0..listLength-1], where listLength is the count of elements in the
- * list object designated by listPtr, TCL_ERROR is returned and an error
- * message is left in the interpreter result.
+ * It is the caller's responsibility to invalidate the string
+ * representation of the 'listPtr'.
*
- * Side effects:
- * Tcl_Panic if listPtr designates a shared object. Otherwise, attempts
- * to convert it to a list with a non-shared internal rep. Decrements the
- * ref count of the object at the specified index within the list,
- * replaces with the object designated by valuePtr, and increments the
- * ref count of the replacement object.
+ * Value
+ *
+ * TCL_OK
+ *
+ * Success.
+ *
+ * TCL_ERROR
+ *
+ * 'listPtr' does not refer to a list object and cannot be converted
+ * to one. An error message will be left in the interpreter result if
+ * interp is not NULL.
+ *
+ * TCL_ERROR
+ *
+ * An index designates an element outside the range [0..listLength-1],
+ * where 'listLength' is the count of elements in the list object
+ * designated by 'listPtr'. An error message is left in the
+ * interpreter result.
+ *
+ * Effect
+ *
+ * If 'listPtr' designates a shared object, 'Tcl_Panic' is called. If
+ * 'listPtr' is not already of type 'tclListType', it is converted and the
+ * internal representation is unshared. The 'refCount' of the element at
+ * 'index' is decremented and replaced in the list with the 'valuePtr',
+ * whose 'refCount' in turn is incremented.
*
- * It is the caller's responsibility to invalidate the string
- * representation of the object.
*
*----------------------------------------------------------------------
*/
@@ -1796,9 +1781,10 @@ TclListObjSetElement(
ListGetIntRep(listPtr, listRepPtr);
if (listRepPtr == NULL) {
- int result, length;
+ int result;
+ size_t length;
- (void) Tcl_GetStringFromObj(listPtr, &length);
+ (void) TclGetStringFromObj(listPtr, &length);
if (length == 0) {
if (interp != NULL) {
Tcl_SetObjResult(interp,
@@ -1900,13 +1886,11 @@ TclListObjSetElement(
*
* FreeListInternalRep --
*
- * Deallocate the storage associated with a list object's internal
- * representation.
+ * Deallocate the storage associated with the internal representation of a
+ * a list object.
*
- * Results:
- * None.
+ * Effect
*
- * Side effects:
* Frees listPtr's List* internal representation, if no longer shared.
* May decrement the ref counts of element objects, which may free them.
*
@@ -1929,7 +1913,7 @@ FreeListInternalRep(
for (i = 0; i < numElems; i++) {
Tcl_DecrRefCount(elemPtrs[i]);
}
- ckfree(listRepPtr);
+ Tcl_Free(listRepPtr);
}
}
@@ -1938,14 +1922,12 @@ FreeListInternalRep(
*
* DupListInternalRep --
*
- * Initialize the internal representation of a list Tcl_Obj to share the
+ * Initialize the internal representation of a list 'Tcl_Obj' to share the
* internal representation of an existing list object.
*
- * Results:
- * None.
+ * Effect
*
- * Side effects:
- * The reference count of the List internal rep is incremented.
+ * The 'refCount' of the List internal rep is incremented.
*
*----------------------------------------------------------------------
*/
@@ -1967,16 +1949,20 @@ DupListInternalRep(
*
* SetListFromAny --
*
- * Attempt to generate a list internal form for the Tcl object "objPtr".
+ * Convert any object to a list.
*
- * Results:
- * The return value is TCL_OK or TCL_ERROR. If an error occurs during
- * conversion, an error message is left in the interpreter's result
- * unless "interp" is NULL.
+ * Value
+ *
+ * TCL_OK
+ *
+ * Success. The internal representation of 'objPtr' is set, and the type
+ * of 'objPtr' is 'tclListType'.
+ *
+ * TCL_ERROR
+ *
+ * An error occured during conversion. An error message is left in the
+ * interpreter's result if 'interp' is not NULL.
*
- * Side effects:
- * If no error occurs, a list is stored as "objPtr"s internal
- * representation.
*
*----------------------------------------------------------------------
*/
@@ -2032,7 +2018,8 @@ SetListFromAny(
Tcl_DictObjNext(&search, &keyPtr, &valuePtr, &done);
}
} else {
- int estCount, length;
+ int estCount;
+ size_t length;
const char *limit, *nextElem = TclGetStringFromObj(objPtr, &length);
/*
@@ -2056,7 +2043,8 @@ SetListFromAny(
while (nextElem < limit) {
const char *elemStart;
char *check;
- int elemSize, literal;
+ size_t elemSize;
+ int literal;
if (TCL_OK != TclFindElement(interp, nextElem, limit - nextElem,
&elemStart, &nextElem, &elemSize, &literal)) {
@@ -2064,7 +2052,7 @@ SetListFromAny(
while (--elemPtrs >= &listRepPtr->elements) {
Tcl_DecrRefCount(*elemPtrs);
}
- ckfree(listRepPtr);
+ Tcl_Free(listRepPtr);
return TCL_ERROR;
}
if (elemStart == limit) {
@@ -2109,18 +2097,16 @@ SetListFromAny(
*
* UpdateStringOfList --
*
- * Update the string representation for a list object. Note: This
- * function does not invalidate an existing old string rep so storage
- * will be lost if this has not already been done.
+ * Update the string representation for a list object.
*
- * Results:
- * None.
+ * Any previously-exising string representation is not invalidated, so
+ * storage is lost if this has not been taken care of.
*
- * Side effects:
- * The object's string is set to a valid string that results from the
- * list-to-string conversion. This string will be empty if the list has
- * no elements. The list internal representation should not be NULL and
- * we assume it is not NULL.
+ * Effect
+ *
+ * The string representation of 'listPtr' is set to the resulting string.
+ * This string will be empty if the list has no elements. It is assumed
+ * that the list internal representation is not NULL.
*
*----------------------------------------------------------------------
*/
@@ -2131,7 +2117,8 @@ UpdateStringOfList(
{
# define LOCAL_SIZE 64
char localFlags[LOCAL_SIZE], *flagPtr = NULL;
- int numElems, i, length, bytesNeeded = 0;
+ int numElems, i;
+ size_t length, bytesNeeded = 0;
const char *elem, *start;
char *dst;
Tcl_Obj **elemPtrs;
@@ -2171,19 +2158,13 @@ UpdateStringOfList(
* We know numElems <= LIST_MAX, so this is safe.
*/
- flagPtr = ckalloc(numElems);
+ flagPtr = Tcl_Alloc(numElems);
}
elemPtrs = &listRepPtr->elements;
for (i = 0; i < numElems; i++) {
flagPtr[i] = (i ? TCL_DONT_QUOTE_HASH : 0);
elem = TclGetStringFromObj(elemPtrs[i], &length);
bytesNeeded += TclScanElement(elem, length, flagPtr+i);
- if (bytesNeeded < 0) {
- Tcl_Panic("max size for a Tcl value (%d bytes) exceeded", INT_MAX);
- }
- }
- if (bytesNeeded > INT_MAX - numElems + 1) {
- Tcl_Panic("max size for a Tcl value (%d bytes) exceeded", INT_MAX);
}
bytesNeeded += numElems - 1;
@@ -2204,7 +2185,7 @@ UpdateStringOfList(
(void) Tcl_InitStringRep(listPtr, NULL, dst - 1 - start);
if (flagPtr != localFlags) {
- ckfree(flagPtr);
+ Tcl_Free(flagPtr);
}
}
diff --git a/generic/tclLiteral.c b/generic/tclLiteral.c
index 83eee07..c01d5aa 100644
--- a/generic/tclLiteral.c
+++ b/generic/tclLiteral.c
@@ -31,7 +31,7 @@
static int AddLocalLiteralEntry(CompileEnv *envPtr,
Tcl_Obj *objPtr, int localHash);
static void ExpandLocalLiteralArray(CompileEnv *envPtr);
-static unsigned HashString(const char *string, int length);
+static size_t HashString(const char *string, size_t length);
#ifdef TCL_COMPILE_DEBUG
static LiteralEntry * LookupLiteralEntry(Tcl_Interp *interp,
Tcl_Obj *objPtr);
@@ -131,7 +131,7 @@ TclDeleteLiteralTable(
objPtr = entryPtr->objPtr;
TclDecrRefCount(objPtr);
nextPtr = entryPtr->nextPtr;
- ckfree(entryPtr);
+ Tcl_Free(entryPtr);
entryPtr = nextPtr;
}
}
@@ -141,7 +141,7 @@ TclDeleteLiteralTable(
*/
if (tablePtr->buckets != tablePtr->staticBuckets) {
- ckfree(tablePtr->buckets);
+ Tcl_Free(tablePtr->buckets);
}
}
@@ -176,8 +176,8 @@ TclCreateLiteral(
Interp *iPtr,
const char *bytes, /* The start of the string. Note that this is
* not a NUL-terminated string. */
- int length, /* Number of bytes in the string. */
- unsigned hash, /* The string's hash. If -1, it will be
+ size_t length, /* Number of bytes in the string. */
+ size_t hash, /* The string's hash. If -1, it will be
* computed here. */
int *newPtr,
Namespace *nsPtr,
@@ -186,14 +186,14 @@ TclCreateLiteral(
{
LiteralTable *globalTablePtr = &iPtr->literalTable;
LiteralEntry *globalPtr;
- unsigned int globalHash;
+ size_t globalHash;
Tcl_Obj *objPtr;
/*
* Is it in the interpreter's global literal table?
*/
- if (hash == (unsigned) -1) {
+ if (hash == TCL_AUTO_LENGTH) {
hash = HashString(bytes, length);
}
globalHash = (hash & globalTablePtr->mask);
@@ -208,7 +208,7 @@ TclCreateLiteral(
* https://stackoverflow.com/q/54337750/301832
*/
- int objLength;
+ size_t objLength;
const char *objBytes = TclGetStringFromObj(objPtr, &objLength);
if ((objLength == length) && ((length == 0)
@@ -225,9 +225,9 @@ TclCreateLiteral(
*globalPtrPtr = globalPtr;
}
if (flags & LITERAL_ON_HEAP) {
- ckfree(bytes);
+ Tcl_Free((void *)bytes);
}
- if (globalPtr->refCount != (unsigned) -1) {
+ if (globalPtr->refCount != TCL_AUTO_LENGTH) {
globalPtr->refCount++;
}
return objPtr;
@@ -236,7 +236,7 @@ TclCreateLiteral(
}
if (!newPtr) {
if ((flags & LITERAL_ON_HEAP)) {
- ckfree(bytes);
+ Tcl_Free((void *)bytes);
}
return NULL;
}
@@ -272,11 +272,11 @@ TclCreateLiteral(
#ifdef TCL_COMPILE_DEBUG
if (LookupLiteralEntry((Tcl_Interp *) iPtr, objPtr) != NULL) {
Tcl_Panic("%s: literal \"%.*s\" found globally but shouldn't be",
- "TclRegisterLiteral", (length>60? 60 : length), bytes);
+ "TclRegisterLiteral", (length>60? 60 : (int)length), bytes);
}
#endif
- globalPtr = ckalloc(sizeof(LiteralEntry));
+ globalPtr = Tcl_Alloc(sizeof(LiteralEntry));
globalPtr->objPtr = objPtr;
Tcl_IncrRefCount(objPtr);
globalPtr->refCount = 1;
@@ -312,7 +312,7 @@ TclCreateLiteral(
}
if (!found) {
Tcl_Panic("%s: literal \"%.*s\" wasn't global",
- "TclRegisterLiteral", (length>60? 60 : length), bytes);
+ "TclRegisterLiteral", (length>60? 60 : (int)length), bytes);
}
}
#endif /*TCL_COMPILE_DEBUG*/
@@ -349,10 +349,10 @@ Tcl_Obj *
TclFetchLiteral(
CompileEnv *envPtr, /* Points to the CompileEnv from which to
* fetch the registered literal value. */
- unsigned int index) /* Index of the desired literal, as returned
+ size_t index) /* Index of the desired literal, as returned
* by prior call to TclRegisterLiteral() */
{
- if (index >= (unsigned int) envPtr->literalArrayNext) {
+ if (index >= (size_t) envPtr->literalArrayNext) {
return NULL;
}
return envPtr->literalArrayPtr[index].objPtr;
@@ -392,7 +392,7 @@ TclRegisterLiteral(
register const char *bytes, /* Points to string for which to find or
* create an object in CompileEnv's object
* array. */
- int length, /* Number of bytes in the string. If < 0, the
+ size_t length, /* Number of bytes in the string. If -1, the
* string consists of all bytes up to the
* first null character. */
int flags) /* If LITERAL_ON_HEAP then the caller already
@@ -406,12 +406,11 @@ TclRegisterLiteral(
LiteralTable *localTablePtr = &envPtr->localLitTable;
LiteralEntry *globalPtr, *localPtr;
Tcl_Obj *objPtr;
- unsigned hash;
- unsigned int localHash;
- int objIndex, isNew;
+ size_t hash, localHash, objIndex;
+ int isNew;
Namespace *nsPtr;
- if (length < 0) {
+ if (length == TCL_AUTO_LENGTH) {
length = (bytes ? strlen(bytes) : 0);
}
hash = HashString(bytes, length);
@@ -429,7 +428,7 @@ TclRegisterLiteral(
|| ((objPtr->bytes[0] == bytes[0])
&& (memcmp(objPtr->bytes, bytes, length) == 0)))) {
if ((flags & LITERAL_ON_HEAP)) {
- ckfree(bytes);
+ Tcl_Free((void *)bytes);
}
objIndex = (localPtr - envPtr->literalArrayPtr);
#ifdef TCL_COMPILE_DEBUG
@@ -467,9 +466,9 @@ TclRegisterLiteral(
objIndex = AddLocalLiteralEntry(envPtr, objPtr, localHash);
#ifdef TCL_COMPILE_DEBUG
- if (globalPtr != NULL && globalPtr->refCount + 1 < 2) {
- Tcl_Panic("%s: global literal \"%.*s\" had bad refCount %d",
- "TclRegisterLiteral", (length>60? 60 : length), bytes,
+ if (globalPtr != NULL && (globalPtr->refCount + 1 < 2)) {
+ Tcl_Panic("%s: global literal \"%.*s\" had bad refCount %" TCL_Z_MODIFIER "u",
+ "TclRegisterLiteral", (length>60? 60 : (int)length), bytes,
globalPtr->refCount);
}
TclVerifyLocalLiteralTable(envPtr);
@@ -507,7 +506,7 @@ LookupLiteralEntry(
LiteralTable *globalTablePtr = &iPtr->literalTable;
register LiteralEntry *entryPtr;
const char *bytes;
- int length, globalHash;
+ size_t globalHash, length;
bytes = TclGetStringFromObj(objPtr, &length);
globalHash = (HashString(bytes, length) & globalTablePtr->mask);
@@ -552,8 +551,7 @@ TclHideLiteral(
{
LiteralEntry **nextPtrPtr, *entryPtr, *lPtr;
LiteralTable *localTablePtr = &envPtr->localLitTable;
- unsigned int localHash;
- int length;
+ size_t localHash, length;
const char *bytes;
Tcl_Obj *newObjPtr;
@@ -628,7 +626,7 @@ TclAddLiteralObj(
lPtr = &envPtr->literalArrayPtr[objIndex];
lPtr->objPtr = objPtr;
Tcl_IncrRefCount(objPtr);
- lPtr->refCount = (unsigned) -1; /* i.e., unused */
+ lPtr->refCount = TCL_AUTO_LENGTH; /* i.e., unused */
lPtr->nextPtr = NULL;
if (litPtrPtr) {
@@ -690,8 +688,8 @@ AddLocalLiteralEntry(
TclVerifyLocalLiteralTable(envPtr);
{
char *bytes;
- int length, found;
- size_t i;
+ int found;
+ size_t length, i;
found = 0;
for (i=0 ; i<localTablePtr->numBuckets ; i++) {
@@ -706,7 +704,7 @@ AddLocalLiteralEntry(
if (!found) {
bytes = TclGetStringFromObj(objPtr, &length);
Tcl_Panic("%s: literal \"%.*s\" wasn't found locally",
- "AddLocalLiteralEntry", (length>60? 60 : length), bytes);
+ "AddLocalLiteralEntry", (length>60? 60 : (int)length), bytes);
}
}
#endif /*TCL_COMPILE_DEBUG*/
@@ -758,14 +756,14 @@ ExpandLocalLiteralArray(
}
if (envPtr->mallocedLiteralArray) {
- newArrayPtr = ckrealloc(currArrayPtr, newSize);
+ newArrayPtr = Tcl_Realloc(currArrayPtr, newSize);
} else {
/*
- * envPtr->literalArrayPtr isn't a ckalloc'd pointer, so we must
- * code a ckrealloc equivalent for ourselves.
+ * envPtr->literalArrayPtr isn't a Tcl_Alloc'd pointer, so we must
+ * code a Tcl_Realloc equivalent for ourselves.
*/
- newArrayPtr = ckalloc(newSize);
+ newArrayPtr = Tcl_Alloc(newSize);
memcpy(newArrayPtr, currArrayPtr, currBytes);
envPtr->mallocedLiteralArray = 1;
}
@@ -826,8 +824,7 @@ TclReleaseLiteral(
LiteralTable *globalTablePtr;
register LiteralEntry *entryPtr, *prevPtr;
const char *bytes;
- int length;
- unsigned int index;
+ size_t length, index;
if (iPtr == NULL) {
goto done;
@@ -835,7 +832,7 @@ TclReleaseLiteral(
globalTablePtr = &iPtr->literalTable;
bytes = TclGetStringFromObj(objPtr, &length);
- index = (HashString(bytes, length) & globalTablePtr->mask);
+ index = HashString(bytes, length) & globalTablePtr->mask;
/*
* Check to see if the object is in the global literal table and remove
@@ -852,13 +849,13 @@ TclReleaseLiteral(
* literal table entry (decrement the ref count of the object).
*/
- if ((entryPtr->refCount != (unsigned)-1) && (entryPtr->refCount-- <= 1)) {
+ if ((entryPtr->refCount != TCL_AUTO_LENGTH) && (entryPtr->refCount-- <= 1)) {
if (prevPtr == NULL) {
globalTablePtr->buckets[index] = entryPtr->nextPtr;
} else {
prevPtr->nextPtr = entryPtr->nextPtr;
}
- ckfree(entryPtr);
+ Tcl_Free(entryPtr);
globalTablePtr->numEntries--;
TclDecrRefCount(objPtr);
@@ -896,12 +893,12 @@ TclReleaseLiteral(
*----------------------------------------------------------------------
*/
-static unsigned
+static size_t
HashString(
register const char *string, /* String for which to compute hash value. */
- int length) /* Number of bytes in the string. */
+ size_t length) /* Number of bytes in the string. */
{
- register unsigned int result = 0;
+ register size_t result = 0;
/*
* I tried a zillion different hash functions and asked many other people
@@ -970,8 +967,7 @@ RebuildLiteralTable(
register LiteralEntry *entryPtr;
LiteralEntry **bucketPtr;
const char *bytes;
- unsigned int oldSize, index;
- int count, length;
+ size_t oldSize, count, index, length;
oldSize = tablePtr->numBuckets;
oldBuckets = tablePtr->buckets;
@@ -992,7 +988,7 @@ RebuildLiteralTable(
}
tablePtr->numBuckets *= 4;
- tablePtr->buckets = ckalloc(tablePtr->numBuckets * sizeof(LiteralEntry*));
+ tablePtr->buckets = Tcl_Alloc(tablePtr->numBuckets * sizeof(LiteralEntry*));
for (count=tablePtr->numBuckets, newChainPtr=tablePtr->buckets;
count>0 ; count--, newChainPtr++) {
*newChainPtr = NULL;
@@ -1021,7 +1017,7 @@ RebuildLiteralTable(
*/
if (oldBuckets != tablePtr->staticBuckets) {
- ckfree(oldBuckets);
+ Tcl_Free(oldBuckets);
}
}
@@ -1094,9 +1090,7 @@ TclLiteralStats(
LiteralTable *tablePtr) /* Table for which to produce stats. */
{
#define NUM_COUNTERS 10
- size_t count[NUM_COUNTERS];
- int overflow;
- size_t i, j;
+ size_t count[NUM_COUNTERS], overflow, i, j;
double average, tmp;
register LiteralEntry *entryPtr;
char *result, *p;
@@ -1130,8 +1124,8 @@ TclLiteralStats(
* Print out the histogram and a few other pieces of information.
*/
- result = ckalloc(NUM_COUNTERS*60 + 300);
- sprintf(result, "%d entries in table, %d buckets\n",
+ result = Tcl_Alloc(NUM_COUNTERS*60 + 300);
+ sprintf(result, "%" TCL_Z_MODIFIER "u entries in table, %" TCL_Z_MODIFIER "u buckets\n",
tablePtr->numEntries, tablePtr->numBuckets);
p = result + strlen(result);
for (i=0 ; i<NUM_COUNTERS ; i++) {
@@ -1139,7 +1133,7 @@ TclLiteralStats(
i, count[i]);
p += strlen(p);
}
- sprintf(p, "number of buckets with %d or more entries: %d\n",
+ sprintf(p, "number of buckets with %d or more entries: %" TCL_Z_MODIFIER "u\n",
NUM_COUNTERS, overflow);
p += strlen(p);
sprintf(p, "average search distance for entry: %.1f", average);
@@ -1172,19 +1166,17 @@ TclVerifyLocalLiteralTable(
register LiteralTable *localTablePtr = &envPtr->localLitTable;
register LiteralEntry *localPtr;
char *bytes;
- size_t i, count;
- int length;
+ size_t i, length, count = 0;
- count = 0;
for (i=0 ; i<localTablePtr->numBuckets ; i++) {
for (localPtr=localTablePtr->buckets[i] ; localPtr!=NULL;
localPtr=localPtr->nextPtr) {
count++;
- if (localPtr->refCount != (unsigned)-1) {
+ if (localPtr->refCount != TCL_AUTO_LENGTH) {
bytes = TclGetStringFromObj(localPtr->objPtr, &length);
- Tcl_Panic("%s: local literal \"%.*s\" had bad refCount %u",
+ Tcl_Panic("%s: local literal \"%.*s\" had bad refCount %" TCL_Z_MODIFIER "u",
"TclVerifyLocalLiteralTable",
- (length>60? 60 : length), bytes, localPtr->refCount);
+ (length>60? 60 : (int) length), bytes, localPtr->refCount);
}
if (localPtr->objPtr->bytes == NULL) {
Tcl_Panic("%s: literal has NULL string rep",
@@ -1193,7 +1185,7 @@ TclVerifyLocalLiteralTable(
}
}
if (count != localTablePtr->numEntries) {
- Tcl_Panic("%s: local literal table had %" TCL_Z_MODIFIER "u entries, should be %u",
+ Tcl_Panic("%s: local literal table had %" TCL_Z_MODIFIER "u entries, should be %" TCL_Z_MODIFIER "u",
"TclVerifyLocalLiteralTable", count,
localTablePtr->numEntries);
}
@@ -1223,19 +1215,17 @@ TclVerifyGlobalLiteralTable(
register LiteralTable *globalTablePtr = &iPtr->literalTable;
register LiteralEntry *globalPtr;
char *bytes;
- size_t i, count;
- int length;
+ size_t i, length, count = 0;
- count = 0;
for (i=0 ; i<globalTablePtr->numBuckets ; i++) {
for (globalPtr=globalTablePtr->buckets[i] ; globalPtr!=NULL;
globalPtr=globalPtr->nextPtr) {
count++;
if (globalPtr->refCount + 1 < 2) {
bytes = TclGetStringFromObj(globalPtr->objPtr, &length);
- Tcl_Panic("%s: global literal \"%.*s\" had bad refCount %d",
+ Tcl_Panic("%s: global literal \"%.*s\" had bad refCount %" TCL_Z_MODIFIER "u",
"TclVerifyGlobalLiteralTable",
- (length>60? 60 : length), bytes, globalPtr->refCount);
+ (length>60? 60 : (int)length), bytes, globalPtr->refCount);
}
if (globalPtr->objPtr->bytes == NULL) {
Tcl_Panic("%s: literal has NULL string rep",
@@ -1244,7 +1234,7 @@ TclVerifyGlobalLiteralTable(
}
}
if (count != globalTablePtr->numEntries) {
- Tcl_Panic("%s: global literal table had %" TCL_Z_MODIFIER "u entries, should be %u",
+ Tcl_Panic("%s: global literal table had %" TCL_Z_MODIFIER "u entries, should be %" TCL_Z_MODIFIER "u",
"TclVerifyGlobalLiteralTable", count,
globalTablePtr->numEntries);
}
diff --git a/generic/tclLoad.c b/generic/tclLoad.c
index add4f6f..062e1a0 100644
--- a/generic/tclLoad.c
+++ b/generic/tclLoad.c
@@ -131,7 +131,7 @@ Tcl_LoadObjCmd(
const char *p, *fullFileName, *packageName;
Tcl_LoadHandle loadHandle;
Tcl_UniChar ch = 0;
- unsigned len;
+ size_t len;
int index, flags = 0;
Tcl_Obj *const *savedobjv = objv;
static const char *const options[] = {
@@ -165,7 +165,7 @@ Tcl_LoadObjCmd(
if (Tcl_FSConvertToPathType(interp, objv[1]) != TCL_OK) {
return TCL_ERROR;
}
- fullFileName = Tcl_GetString(objv[1]);
+ fullFileName = TclGetString(objv[1]);
Tcl_DStringInit(&pkgName);
Tcl_DStringInit(&initName);
@@ -176,7 +176,7 @@ Tcl_LoadObjCmd(
packageName = NULL;
if (objc >= 3) {
- packageName = Tcl_GetString(objv[2]);
+ packageName = TclGetString(objv[2]);
if (packageName[0] == '\0') {
packageName = NULL;
}
@@ -196,7 +196,7 @@ Tcl_LoadObjCmd(
target = interp;
if (objc == 4) {
- const char *slaveIntName = Tcl_GetString(objv[3]);
+ const char *slaveIntName = TclGetString(objv[3]);
target = Tcl_GetSlave(interp, slaveIntName);
if (target == NULL) {
@@ -324,7 +324,7 @@ Tcl_LoadObjCmd(
splitPtr = Tcl_FSSplitPath(objv[1], &pElements);
Tcl_ListObjIndex(NULL, splitPtr, pElements -1, &pkgGuessPtr);
- pkgGuess = Tcl_GetString(pkgGuessPtr);
+ pkgGuess = TclGetString(pkgGuessPtr);
if ((pkgGuess[0] == 'l') && (pkgGuess[1] == 'i')
&& (pkgGuess[2] == 'b')) {
pkgGuess += 3;
@@ -401,12 +401,12 @@ Tcl_LoadObjCmd(
* Create a new record to describe this package.
*/
- pkgPtr = ckalloc(sizeof(LoadedPackage));
+ pkgPtr = Tcl_Alloc(sizeof(LoadedPackage));
len = strlen(fullFileName) + 1;
- pkgPtr->fileName = ckalloc(len);
+ pkgPtr->fileName = Tcl_Alloc(len);
memcpy(pkgPtr->fileName, fullFileName, len);
len = Tcl_DStringLength(&pkgName) + 1;
- pkgPtr->packageName = ckalloc(len);
+ pkgPtr->packageName = Tcl_Alloc(len);
memcpy(pkgPtr->packageName, Tcl_DStringValue(&pkgName), len);
pkgPtr->loadHandle = loadHandle;
pkgPtr->initProc = initProc;
@@ -470,19 +470,17 @@ Tcl_LoadObjCmd(
*/
if (code != TCL_OK) {
-#if defined(TCL_NO_DEPRECATED) || TCL_MAJOR_VERSION > 8
Interp *iPtr = (Interp *) target;
- if (iPtr->result && *(iPtr->result) && !iPtr->freeProc) {
+ if (iPtr->legacyResult && *(iPtr->legacyResult) && !iPtr->legacyFreeProc) {
/*
* A call to Tcl_InitStubs() determined the caller extension and
* this interp are incompatible in their stubs mechanisms, and
* recorded the error in the oldest legacy place we have to do so.
*/
- Tcl_SetObjResult(target, Tcl_NewStringObj(iPtr->result, -1));
- iPtr->result = &tclEmptyString;
- iPtr->freeProc = NULL;
+ Tcl_SetObjResult(target, Tcl_NewStringObj(iPtr->legacyResult, -1));
+ iPtr->legacyResult = NULL;
+ iPtr->legacyFreeProc = (void (*) (void))-1;
}
-#endif /* defined(TCL_NO_DEPRECATED) */
Tcl_TransferResult(target, code, interp);
goto done;
}
@@ -508,7 +506,7 @@ Tcl_LoadObjCmd(
*/
ipFirstPtr = Tcl_GetAssocData(target, "tclLoad", NULL);
- ipPtr = ckalloc(sizeof(InterpPackage));
+ ipPtr = Tcl_Alloc(sizeof(InterpPackage));
ipPtr->pkgPtr = pkgPtr;
ipPtr->nextPtr = ipFirstPtr;
Tcl_SetAssocData(target, "tclLoad", LoadCleanupProc, ipPtr);
@@ -566,7 +564,7 @@ Tcl_UnloadObjCmd(
for (i = 1; i < objc; i++) {
if (Tcl_GetIndexFromObj(interp, objv[i], options, "option", 0,
&index) != TCL_OK) {
- fullFileName = Tcl_GetString(objv[i]);
+ fullFileName = TclGetString(objv[i]);
if (fullFileName[0] == '-') {
/*
* It looks like the command contains an option so signal an
@@ -606,13 +604,13 @@ Tcl_UnloadObjCmd(
return TCL_ERROR;
}
- fullFileName = Tcl_GetString(objv[i]);
+ fullFileName = TclGetString(objv[i]);
Tcl_DStringInit(&pkgName);
Tcl_DStringInit(&tmp);
packageName = NULL;
if (objc - i >= 2) {
- packageName = Tcl_GetString(objv[i+1]);
+ packageName = TclGetString(objv[i+1]);
if (packageName[0] == '\0') {
packageName = NULL;
}
@@ -632,7 +630,7 @@ Tcl_UnloadObjCmd(
target = interp;
if (objc - i == 3) {
- const char *slaveIntName = Tcl_GetString(objv[i + 2]);
+ const char *slaveIntName = TclGetString(objv[i + 2]);
target = Tcl_GetSlave(interp, slaveIntName);
if (target == NULL) {
@@ -892,10 +890,10 @@ Tcl_UnloadObjCmd(
}
Tcl_SetAssocData(target, "tclLoad", LoadCleanupProc,
ipFirstPtr);
- ckfree(defaultPtr->fileName);
- ckfree(defaultPtr->packageName);
- ckfree(defaultPtr);
- ckfree(ipPtr);
+ Tcl_Free(defaultPtr->fileName);
+ Tcl_Free(defaultPtr->packageName);
+ Tcl_Free(defaultPtr);
+ Tcl_Free(ipPtr);
Tcl_MutexUnlock(&packageMutex);
} else {
code = TCL_ERROR;
@@ -982,10 +980,10 @@ Tcl_StaticPackage(
*/
if (pkgPtr == NULL) {
- pkgPtr = ckalloc(sizeof(LoadedPackage));
- pkgPtr->fileName = ckalloc(1);
+ pkgPtr = Tcl_Alloc(sizeof(LoadedPackage));
+ pkgPtr->fileName = Tcl_Alloc(1);
pkgPtr->fileName[0] = 0;
- pkgPtr->packageName = ckalloc(strlen(pkgName) + 1);
+ pkgPtr->packageName = Tcl_Alloc(strlen(pkgName) + 1);
strcpy(pkgPtr->packageName, pkgName);
pkgPtr->loadHandle = NULL;
pkgPtr->initProc = initProc;
@@ -1015,7 +1013,7 @@ Tcl_StaticPackage(
* loaded.
*/
- ipPtr = ckalloc(sizeof(InterpPackage));
+ ipPtr = Tcl_Alloc(sizeof(InterpPackage));
ipPtr->pkgPtr = pkgPtr;
ipPtr->nextPtr = ipFirstPtr;
Tcl_SetAssocData(interp, "tclLoad", LoadCleanupProc, ipPtr);
@@ -1159,7 +1157,7 @@ LoadCleanupProc(
ipPtr = clientData;
while (ipPtr != NULL) {
nextPtr = ipPtr->nextPtr;
- ckfree(ipPtr);
+ Tcl_Free(ipPtr);
ipPtr = nextPtr;
}
}
@@ -1210,9 +1208,9 @@ TclFinalizeLoad(void)
}
#endif
- ckfree(pkgPtr->fileName);
- ckfree(pkgPtr->packageName);
- ckfree(pkgPtr);
+ Tcl_Free(pkgPtr->fileName);
+ Tcl_Free(pkgPtr->packageName);
+ Tcl_Free(pkgPtr);
}
}
diff --git a/generic/tclMain.c b/generic/tclMain.c
index 4b8fa8c..ea69b2d 100644
--- a/generic/tclMain.c
+++ b/generic/tclMain.c
@@ -18,7 +18,7 @@
/*
* On Windows, this file needs to be compiled twice, once with TCL_ASCII_MAIN
- * defined. This way both Tcl_Main and Tcl_MainExW can be implemented, sharing
+ * defined. This way both Tcl_MainEx and Tcl_MainExW can be implemented, sharing
* the same source code.
*/
@@ -65,7 +65,7 @@
static inline Tcl_Obj *
NewNativeObj(
TCHAR *string,
- int length)
+ size_t length)
{
Tcl_DString ds;
@@ -222,7 +222,7 @@ Tcl_GetStartupScript(
if (tsdPtr->encoding == NULL) {
*encodingPtr = NULL;
} else {
- *encodingPtr = Tcl_GetString(tsdPtr->encoding);
+ *encodingPtr = TclGetString(tsdPtr->encoding);
}
}
return tsdPtr->path;
@@ -306,7 +306,7 @@ Tcl_SourceRCFile(
*----------------------------------------------------------------------
*/
-void
+TCL_NORETURN void
Tcl_MainEx(
int argc, /* Number of arguments. */
TCHAR **argv, /* Array of argument strings. */
@@ -350,7 +350,7 @@ Tcl_MainEx(
&& ('-' != argv[3][0])) {
Tcl_Obj *value = NewNativeObj(argv[2], -1);
Tcl_SetStartupScript(NewNativeObj(argv[3], -1),
- Tcl_GetString(value));
+ TclGetString(value));
Tcl_DecrRefCount(value);
argc -= 3;
argv += 3;
@@ -474,7 +474,7 @@ Tcl_MainEx(
while ((is.input != NULL) && !Tcl_InterpDeleted(interp)) {
mainLoopProc = TclGetMainLoop();
if (mainLoopProc == NULL) {
- int length;
+ size_t length;
if (is.tty) {
Prompt(interp, &is);
@@ -495,7 +495,7 @@ Tcl_MainEx(
Tcl_IncrRefCount(is.commandPtr);
}
length = Tcl_GetsObj(is.input, is.commandPtr);
- if (length < 0) {
+ if (length == TCL_AUTO_LENGTH) {
if (Tcl_InputBlocked(is.input)) {
/*
* This can only happen if stdin has been set to
@@ -539,7 +539,7 @@ Tcl_MainEx(
* error messages troubles deeper in, so lop it back off.
*/
- TclGetStringFromObj(is.commandPtr, &length);
+ (void)TclGetStringFromObj(is.commandPtr, &length);
Tcl_SetObjLength(is.commandPtr, --length);
code = Tcl_RecordAndEvalObj(interp, is.commandPtr,
TCL_EVAL_GLOBAL);
@@ -556,7 +556,7 @@ Tcl_MainEx(
} else if (is.tty) {
resultPtr = Tcl_GetObjResult(interp);
Tcl_IncrRefCount(resultPtr);
- TclGetStringFromObj(resultPtr, &length);
+ (void)TclGetStringFromObj(resultPtr, &length);
chan = Tcl_GetStdChannel(TCL_STDOUT);
if ((length > 0) && chan) {
Tcl_WriteObj(chan, resultPtr);
@@ -760,7 +760,8 @@ StdinProc(
ClientData clientData, /* The state of interactive cmd line */
int mask) /* Not used. */
{
- int code, length;
+ int code;
+ size_t length;
InteractiveState *isPtr = clientData;
Tcl_Channel chan = isPtr->input;
Tcl_Obj *commandPtr = isPtr->commandPtr;
@@ -772,7 +773,7 @@ StdinProc(
Tcl_IncrRefCount(commandPtr);
}
length = Tcl_GetsObj(chan, commandPtr);
- if (length < 0) {
+ if (length == TCL_AUTO_LENGTH) {
if (Tcl_InputBlocked(chan)) {
return;
}
@@ -800,7 +801,7 @@ StdinProc(
goto prompt;
}
isPtr->prompt = PROMPT_START;
- TclGetStringFromObj(commandPtr, &length);
+ (void)TclGetStringFromObj(commandPtr, &length);
Tcl_SetObjLength(commandPtr, --length);
/*
@@ -831,7 +832,7 @@ StdinProc(
chan = Tcl_GetStdChannel(TCL_STDOUT);
Tcl_IncrRefCount(resultPtr);
- TclGetStringFromObj(resultPtr, &length);
+ (void)TclGetStringFromObj(resultPtr, &length);
if ((length > 0) && (chan != NULL)) {
Tcl_WriteObj(chan, resultPtr);
Tcl_WriteChars(chan, "\n", 1);
diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c
index bbe357d..7259384 100644
--- a/generic/tclNamesp.c
+++ b/generic/tclNamesp.c
@@ -33,7 +33,7 @@
*/
typedef struct {
- unsigned long numNsCreated; /* Count of the number of namespaces created
+ size_t numNsCreated; /* Count of the number of namespaces created
* within the thread. This value is used as a
* unique id for each namespace. Cannot be
* per-interp because the nsId is used to
@@ -53,7 +53,7 @@ static Tcl_ThreadDataKey dataKey;
* with some information that is used to check the cached pointer's validity.
*/
-typedef struct ResolvedNsName {
+typedef struct {
Namespace *nsPtr; /* A cached pointer to the Namespace that the
* name resolved to. */
Namespace *refNsPtr; /* Points to the namespace context in which
@@ -412,7 +412,7 @@ Tcl_PopCallFrame(
if (framePtr->varTablePtr != NULL) {
TclDeleteVars(iPtr, framePtr->varTablePtr);
- ckfree(framePtr->varTablePtr);
+ Tcl_Free(framePtr->varTablePtr);
framePtr->varTablePtr = NULL;
}
if (framePtr->numCompiledLocals > 0) {
@@ -430,9 +430,8 @@ Tcl_PopCallFrame(
*/
nsPtr = framePtr->nsPtr;
- nsPtr->activationCount--;
- if ((nsPtr->flags & NS_DYING)
- && (nsPtr->activationCount - (nsPtr == iPtr->globalNsPtr) == 0)) {
+ if ((--nsPtr->activationCount <= (unsigned)(nsPtr == iPtr->globalNsPtr))
+ && (nsPtr->flags & NS_DYING)) {
Tcl_DeleteNamespace((Tcl_Namespace *) nsPtr);
}
framePtr->nsPtr = NULL;
@@ -686,7 +685,8 @@ Tcl_CreateNamespace(
Tcl_HashEntry *entryPtr;
Tcl_DString buffer1, buffer2;
Tcl_DString *namePtr, *buffPtr;
- int newEntry, nameLen;
+ int newEntry;
+ size_t nameLen;
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
const char *nameStr;
Tcl_DString tmpBuffer;
@@ -785,9 +785,9 @@ Tcl_CreateNamespace(
*/
doCreate:
- nsPtr = ckalloc(sizeof(Namespace));
+ nsPtr = Tcl_Alloc(sizeof(Namespace));
nameLen = strlen(simpleName) + 1;
- nsPtr->name = ckalloc(nameLen);
+ nsPtr->name = Tcl_Alloc(nameLen);
memcpy(nsPtr->name, simpleName, nameLen);
nsPtr->fullName = NULL; /* Set below. */
nsPtr->clientData = clientData;
@@ -875,7 +875,7 @@ Tcl_CreateNamespace(
name = Tcl_DStringValue(namePtr);
nameLen = Tcl_DStringLength(namePtr);
- nsPtr->fullName = ckalloc(nameLen + 1);
+ nsPtr->fullName = Tcl_Alloc(nameLen + 1);
memcpy(nsPtr->fullName, name, nameLen + 1);
Tcl_DStringFree(&buffer1);
@@ -1023,7 +1023,7 @@ Tcl_DeleteNamespace(
* refCount reaches 0.
*/
- if (nsPtr->activationCount - (nsPtr == globalNsPtr) > 0) {
+ if (nsPtr->activationCount > (unsigned)(nsPtr == globalNsPtr)) {
nsPtr->flags |= NS_DYING;
if (nsPtr->parentPtr != NULL) {
entryPtr = Tcl_FindHashEntry(
@@ -1062,7 +1062,7 @@ Tcl_DeleteNamespace(
#else
if (nsPtr->childTablePtr != NULL) {
Tcl_DeleteHashTable(nsPtr->childTablePtr);
- ckfree(nsPtr->childTablePtr);
+ Tcl_Free(nsPtr->childTablePtr);
}
#endif
Tcl_DeleteHashTable(&nsPtr->cmdTable);
@@ -1124,7 +1124,7 @@ TclTeardownNamespace(
Interp *iPtr = (Interp *) nsPtr->interp;
register Tcl_HashEntry *entryPtr;
Tcl_HashSearch search;
- int i;
+ size_t i;
/*
* Start by destroying the namespace's variable table, since variables
@@ -1145,7 +1145,7 @@ TclTeardownNamespace(
*/
while (nsPtr->cmdTable.numEntries > 0) {
- int length = nsPtr->cmdTable.numEntries;
+ size_t length = nsPtr->cmdTable.numEntries;
Command **cmds = TclStackAlloc((Tcl_Interp *) iPtr,
sizeof(Command *) * length);
@@ -1217,7 +1217,7 @@ TclTeardownNamespace(
#ifndef BREAK_NAMESPACE_COMPAT
while (nsPtr->childTable.numEntries > 0) {
- int length = nsPtr->childTable.numEntries;
+ size_t length = nsPtr->childTable.numEntries;
Namespace **children = TclStackAlloc((Tcl_Interp *) iPtr,
sizeof(Namespace *) * length);
@@ -1238,7 +1238,7 @@ TclTeardownNamespace(
#else
if (nsPtr->childTablePtr != NULL) {
while (nsPtr->childTablePtr->numEntries > 0) {
- int length = nsPtr->childTablePtr->numEntries;
+ size_t length = nsPtr->childTablePtr->numEntries;
Namespace **children = TclStackAlloc((Tcl_Interp *) iPtr,
sizeof(Namespace *) * length);
@@ -1265,9 +1265,9 @@ TclTeardownNamespace(
if (nsPtr->exportArrayPtr != NULL) {
for (i = 0; i < nsPtr->numExportPatterns; i++) {
- ckfree(nsPtr->exportArrayPtr[i]);
+ Tcl_Free(nsPtr->exportArrayPtr[i]);
}
- ckfree(nsPtr->exportArrayPtr);
+ Tcl_Free(nsPtr->exportArrayPtr);
nsPtr->exportArrayPtr = NULL;
nsPtr->numExportPatterns = 0;
nsPtr->maxExportPatterns = 0;
@@ -1319,9 +1319,9 @@ NamespaceFree(
* (for error messages), and the structure itself.
*/
- ckfree(nsPtr->name);
- ckfree(nsPtr->fullName);
- ckfree(nsPtr);
+ Tcl_Free(nsPtr->name);
+ Tcl_Free(nsPtr->fullName);
+ Tcl_Free(nsPtr);
}
/*
@@ -1390,7 +1390,7 @@ Tcl_Export(
Namespace *currNsPtr = (Namespace *) TclGetCurrentNamespace(interp);
const char *simplePattern;
char *patternCpy;
- int neededElems, len, i;
+ size_t neededElems, len, i;
/*
* If the specified namespace is NULL, use the current namespace.
@@ -1410,9 +1410,9 @@ Tcl_Export(
if (resetListFirst) {
if (nsPtr->exportArrayPtr != NULL) {
for (i = 0; i < nsPtr->numExportPatterns; i++) {
- ckfree(nsPtr->exportArrayPtr[i]);
+ Tcl_Free(nsPtr->exportArrayPtr[i]);
}
- ckfree(nsPtr->exportArrayPtr);
+ Tcl_Free(nsPtr->exportArrayPtr);
nsPtr->exportArrayPtr = NULL;
TclInvalidateNsCmdLookup(nsPtr);
nsPtr->numExportPatterns = 0;
@@ -1459,7 +1459,7 @@ Tcl_Export(
if (neededElems > nsPtr->maxExportPatterns) {
nsPtr->maxExportPatterns = nsPtr->maxExportPatterns ?
2 * nsPtr->maxExportPatterns : INIT_EXPORT_PATTERNS;
- nsPtr->exportArrayPtr = ckrealloc(nsPtr->exportArrayPtr,
+ nsPtr->exportArrayPtr = Tcl_Realloc(nsPtr->exportArrayPtr,
sizeof(char *) * nsPtr->maxExportPatterns);
}
@@ -1468,7 +1468,7 @@ Tcl_Export(
*/
len = strlen(pattern);
- patternCpy = ckalloc(len + 1);
+ patternCpy = Tcl_Alloc(len + 1);
memcpy(patternCpy, pattern, len + 1);
nsPtr->exportArrayPtr[nsPtr->numExportPatterns] = patternCpy;
@@ -1517,7 +1517,8 @@ Tcl_AppendExportList(
* export pattern list is appended. */
{
Namespace *nsPtr;
- int i, result;
+ size_t i;
+ int result;
/*
* If the specified namespace is NULL, use the current namespace.
@@ -1719,7 +1720,7 @@ DoImport(
Namespace *importNsPtr,
int allowOverwrite)
{
- int i = 0, exported = 0;
+ size_t i = 0, exported = 0;
Tcl_HashEntry *found;
/*
@@ -1786,7 +1787,7 @@ DoImport(
}
}
- dataPtr = ckalloc(sizeof(ImportedCmdData));
+ dataPtr = Tcl_Alloc(sizeof(ImportedCmdData));
importedCmd = Tcl_NRCreateCommand(interp, Tcl_DStringValue(&ds),
TclInvokeImportedCmd, InvokeImportedNRCmd, dataPtr,
DeleteImportedCmd);
@@ -1800,7 +1801,7 @@ DoImport(
* and add it to the import ref list in the "real" command.
*/
- refPtr = ckalloc(sizeof(ImportRef));
+ refPtr = Tcl_Alloc(sizeof(ImportRef));
refPtr->importedCmdPtr = (Command *) importedCmd;
refPtr->nextPtr = cmdPtr->importRefPtr;
cmdPtr->importRefPtr = refPtr;
@@ -2097,8 +2098,8 @@ DeleteImportedCmd(
} else {
prevPtr->nextPtr = refPtr->nextPtr;
}
- ckfree(refPtr);
- ckfree(dataPtr);
+ Tcl_Free(refPtr);
+ Tcl_Free(dataPtr);
return;
}
prevPtr = refPtr;
@@ -2628,7 +2629,7 @@ Tcl_FindCommand(
cmdPtr = NULL;
if (cxtNsPtr->commandPathLength!=0 && strncmp(name, "::", 2)
&& !(flags & TCL_NAMESPACE_ONLY)) {
- int i;
+ size_t i;
Namespace *pathNsPtr, *realNsPtr, *dummyNsPtr;
(void) TclGetNamespaceForQualName(interp, name, cxtNsPtr,
@@ -3055,7 +3056,7 @@ NamespaceChildrenCmd(
listPtr = Tcl_NewListObj(0, NULL);
if ((pattern != NULL) && TclMatchIsTrivial(pattern)) {
- unsigned int length = strlen(nsPtr->fullName);
+ size_t length = strlen(nsPtr->fullName);
if (strncmp(pattern, nsPtr->fullName, length) != 0) {
goto searchDone;
@@ -3135,7 +3136,7 @@ NamespaceCodeCmd(
Namespace *currNsPtr;
Tcl_Obj *listPtr, *objPtr;
register const char *arg;
- int length;
+ size_t length;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "arg");
@@ -3448,15 +3449,15 @@ NsEval_Callback(
Tcl_Namespace *namespacePtr = data[0];
if (result == TCL_ERROR) {
- int length = strlen(namespacePtr->fullName);
- int limit = 200;
+ size_t length = strlen(namespacePtr->fullName);
+ unsigned limit = 200;
int overflow = (length > limit);
char *cmd = data[1];
Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
"\n (in namespace %s \"%.*s%s\" script line %d)",
cmd,
- (overflow ? limit : length), namespacePtr->fullName,
+ (overflow ? limit : (unsigned)length), namespacePtr->fullName,
(overflow ? "..." : ""), Tcl_GetErrorLine(interp)));
}
@@ -3576,7 +3577,7 @@ NamespaceExportCmd(
*/
firstArg = 1;
- if (strcmp("-clear", Tcl_GetString(objv[firstArg])) == 0) {
+ if (strcmp("-clear", TclGetString(objv[firstArg])) == 0) {
Tcl_Export(interp, NULL, "::", 1);
Tcl_ResetResult(interp);
firstArg++;
@@ -3587,7 +3588,7 @@ NamespaceExportCmd(
*/
for (i = firstArg; i < objc; i++) {
- int result = Tcl_Export(interp, NULL, Tcl_GetString(objv[i]), 0);
+ int result = Tcl_Export(interp, NULL, TclGetString(objv[i]), 0);
if (result != TCL_OK) {
return result;
}
@@ -4029,7 +4030,8 @@ NamespacePathCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
Namespace *nsPtr = (Namespace *) TclGetCurrentNamespace(interp);
- int i, nsObjc, result = TCL_ERROR;
+ size_t i;
+ int nsObjc, result = TCL_ERROR;
Tcl_Obj **nsObjv;
Tcl_Namespace **namespaceList = NULL;
@@ -4066,7 +4068,7 @@ NamespacePathCmd(
namespaceList = TclStackAlloc(interp,
sizeof(Tcl_Namespace *) * nsObjc);
- for (i=0 ; i<nsObjc ; i++) {
+ for (i=0 ; i<(size_t)nsObjc ; i++) {
if (TclGetNamespaceFromObj(interp, nsObjv[i],
&namespaceList[i]) != TCL_OK) {
goto badNamespace;
@@ -4111,13 +4113,13 @@ NamespacePathCmd(
void
TclSetNsPath(
Namespace *nsPtr, /* Namespace whose path is to be set. */
- int pathLength, /* Length of pathAry. */
+ size_t pathLength, /* Length of pathAry. */
Tcl_Namespace *pathAry[]) /* Array of namespaces that are the path. */
{
if (pathLength != 0) {
NamespacePathEntry *tmpPathArray =
- ckalloc(sizeof(NamespacePathEntry) * pathLength);
- int i;
+ Tcl_Alloc(sizeof(NamespacePathEntry) * pathLength);
+ size_t i;
for (i=0 ; i<pathLength ; i++) {
tmpPathArray[i].nsPtr = (Namespace *) pathAry[i];
@@ -4168,7 +4170,7 @@ static void
UnlinkNsPath(
Namespace *nsPtr)
{
- int i;
+ size_t i;
for (i=0 ; i<nsPtr->commandPathLength ; i++) {
NamespacePathEntry *nsPathPtr = &nsPtr->commandPathArray[i];
@@ -4184,7 +4186,7 @@ UnlinkNsPath(
}
}
}
- ckfree(nsPtr->commandPathArray);
+ Tcl_Free(nsPtr->commandPathArray);
}
/*
@@ -4254,7 +4256,7 @@ NamespaceQualifiersCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
register const char *name, *p;
- int length;
+ size_t length;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "string");
@@ -4732,7 +4734,7 @@ FreeNsNameInternalRep(
*/
TclNsDecrRefCount(resNamePtr->nsPtr);
- ckfree(resNamePtr);
+ Tcl_Free(resNamePtr);
}
}
@@ -4819,7 +4821,7 @@ SetNsNameFromAny(
*/
nsPtr->refCount++;
- resNamePtr = ckalloc(sizeof(ResolvedNsName));
+ resNamePtr = Tcl_Alloc(sizeof(ResolvedNsName));
resNamePtr->nsPtr = nsPtr;
if ((name[0] == ':') && (name[1] == ':')) {
resNamePtr->refNsPtr = NULL;
@@ -4879,7 +4881,7 @@ TclGetNamespaceChildTable(
return &nPtr->childTable;
#else
if (nPtr->childTablePtr == NULL) {
- nPtr->childTablePtr = ckalloc(sizeof(Tcl_HashTable));
+ nPtr->childTablePtr = Tcl_Alloc(sizeof(Tcl_HashTable));
Tcl_InitHashTable(nPtr->childTablePtr, TCL_STRING_KEYS);
}
return nPtr->childTablePtr;
@@ -4915,8 +4917,8 @@ TclLogCommandInfo(
* command (must be <= command). */
const char *command, /* First character in command that generated
* the error. */
- int length, /* Number of bytes in command (-1 means use
- * all bytes up to first null byte). */
+ size_t length, /* Number of bytes in command (-1 means
+ * use all bytes up to first null byte). */
const unsigned char *pc, /* Current pc of bytecode execution context */
Tcl_Obj **tosPtr) /* Current stack of bytecode execution
* context */
@@ -4947,14 +4949,14 @@ TclLogCommandInfo(
}
}
- if (length < 0) {
+ if (length == TCL_AUTO_LENGTH) {
length = strlen(command);
}
- overflow = (length > limit);
+ overflow = (length > (size_t)limit);
Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
"\n %s\n\"%.*s%s\"", ((iPtr->errorInfo == NULL)
? "while executing" : "invoked from within"),
- (overflow ? limit : length), command,
+ (overflow ? limit : (int)length), command,
(overflow ? "..." : "")));
varPtr = TclObjLookupVarEx(interp, iPtr->eiVar, NULL, TCL_GLOBAL_ONLY,
@@ -5072,7 +5074,7 @@ void
TclErrorStackResetIf(
Tcl_Interp *interp,
const char *msg,
- int length)
+ size_t length)
{
Interp *iPtr = (Interp *) interp;
@@ -5127,7 +5129,7 @@ Tcl_LogCommandInfo(
* command (must be <= command). */
const char *command, /* First character in command that generated
* the error. */
- int length) /* Number of bytes in command (-1 means use
+ size_t length) /* Number of bytes in command (-1 means use
* all bytes up to first null byte). */
{
TclLogCommandInfo(interp, script, command, length, NULL, NULL);
diff --git a/generic/tclNotify.c b/generic/tclNotify.c
index e76bca8..41a70b1 100644
--- a/generic/tclNotify.c
+++ b/generic/tclNotify.c
@@ -181,7 +181,7 @@ TclFinalizeNotifier(void)
for (evPtr = tsdPtr->firstEventPtr; evPtr != NULL; ) {
hold = evPtr;
evPtr = evPtr->nextPtr;
- ckfree(hold);
+ Tcl_Free(hold);
}
tsdPtr->firstEventPtr = NULL;
tsdPtr->lastEventPtr = NULL;
@@ -276,7 +276,7 @@ Tcl_CreateEventSource(
* checkProc. */
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
- EventSource *sourcePtr = ckalloc(sizeof(EventSource));
+ EventSource *sourcePtr = Tcl_Alloc(sizeof(EventSource));
sourcePtr->setupProc = setupProc;
sourcePtr->checkProc = checkProc;
@@ -330,7 +330,7 @@ Tcl_DeleteEventSource(
} else {
prevPtr->nextPtr = sourcePtr->nextPtr;
}
- ckfree(sourcePtr);
+ Tcl_Free(sourcePtr);
return;
}
}
@@ -355,7 +355,7 @@ void
Tcl_QueueEvent(
Tcl_Event *evPtr, /* Event to add to queue. The storage space
* must have been allocated the caller with
- * malloc (ckalloc), and it becomes the
+ * malloc (Tcl_Alloc), and it becomes the
* property of the event queue. It will be
* freed after the event has been handled. */
Tcl_QueuePosition position) /* One of TCL_QUEUE_TAIL, TCL_QUEUE_HEAD,
@@ -387,7 +387,7 @@ Tcl_ThreadQueueEvent(
Tcl_ThreadId threadId, /* Identifier for thread to use. */
Tcl_Event *evPtr, /* Event to add to queue. The storage space
* must have been allocated the caller with
- * malloc (ckalloc), and it becomes the
+ * malloc (Tcl_Alloc), and it becomes the
* property of the event queue. It will be
* freed after the event has been handled. */
Tcl_QueuePosition position) /* One of TCL_QUEUE_TAIL, TCL_QUEUE_HEAD,
@@ -412,7 +412,7 @@ Tcl_ThreadQueueEvent(
if (tsdPtr) {
QueueEvent(tsdPtr, evPtr, position);
} else {
- ckfree(evPtr);
+ Tcl_Free(evPtr);
}
Tcl_MutexUnlock(&listLock);
}
@@ -444,7 +444,7 @@ QueueEvent(
* which event queue to use. */
Tcl_Event *evPtr, /* Event to add to queue. The storage space
* must have been allocated the caller with
- * malloc (ckalloc), and it becomes the
+ * malloc (Tcl_Alloc), and it becomes the
* property of the event queue. It will be
* freed after the event has been handled. */
Tcl_QueuePosition position) /* One of TCL_QUEUE_TAIL, TCL_QUEUE_HEAD,
@@ -563,7 +563,7 @@ Tcl_DeleteEvents(
hold = evPtr;
evPtr = evPtr->nextPtr;
- ckfree(hold);
+ Tcl_Free(hold);
} else {
/*
* Event is to be retained.
@@ -702,7 +702,7 @@ Tcl_ServiceEvent(
}
}
if (evPtr) {
- ckfree(evPtr);
+ Tcl_Free(evPtr);
}
Tcl_MutexUnlock(&(tsdPtr->queueMutex));
return 1;
diff --git a/generic/tclOO.c b/generic/tclOO.c
index e9cc0f0..a6a7060 100644
--- a/generic/tclOO.c
+++ b/generic/tclOO.c
@@ -300,7 +300,7 @@ InitFoundation(
static Tcl_ThreadDataKey tsdKey;
ThreadLocalData *tsdPtr =
Tcl_GetThreadData(&tsdKey, sizeof(ThreadLocalData));
- Foundation *fPtr = ckalloc(sizeof(Foundation));
+ Foundation *fPtr = Tcl_Alloc(sizeof(Foundation));
Tcl_Obj *namePtr;
Tcl_DString buffer;
Command *cmdPtr;
@@ -323,7 +323,7 @@ InitFoundation(
DeletedObjdefNamespace);
fPtr->helpersNs = Tcl_CreateNamespace(interp, "::oo::Helpers", fPtr,
DeletedHelpersNamespace);
- fPtr->epoch = 0;
+ fPtr->epoch = 1;
fPtr->tsdPtr = tsdPtr;
TclNewLiteralStringObj(fPtr->unknownMethodNameObj, "unknown");
TclNewLiteralStringObj(fPtr->constructorName, "<constructor>");
@@ -465,7 +465,7 @@ InitClassSystemRoots(
*/
fPtr->objectCls->superclasses.num = 0;
- ckfree(fPtr->objectCls->superclasses.list);
+ Tcl_Free(fPtr->objectCls->superclasses.list);
fPtr->objectCls->superclasses.list = NULL;
/*
@@ -584,7 +584,7 @@ KillFoundation(
TclOODecrRefCount(fPtr->objectCls->thisPtr);
TclOODecrRefCount(fPtr->classCls->thisPtr);
- ckfree(fPtr);
+ Tcl_Free(fPtr);
}
/*
@@ -622,9 +622,9 @@ AllocObject(
Object *oPtr;
Command *cmdPtr;
CommandTrace *tracePtr;
- int creationEpoch;
+ size_t creationEpoch;
- oPtr = ckalloc(sizeof(Object));
+ oPtr = Tcl_Alloc(sizeof(Object));
memset(oPtr, 0, sizeof(Object));
/*
@@ -651,7 +651,7 @@ AllocObject(
while (1) {
char objName[10 + TCL_INTEGER_SPACE];
- sprintf(objName, "::oo::Obj%d", ++fPtr->tsdPtr->nsCount);
+ sprintf(objName, "::oo::Obj%" TCL_Z_MODIFIER "u", ++fPtr->tsdPtr->nsCount);
oPtr->namespacePtr = Tcl_CreateNamespace(interp, objName, oPtr, NULL);
if (oPtr->namespacePtr != NULL) {
creationEpoch = fPtr->tsdPtr->nsCount;
@@ -735,7 +735,7 @@ AllocObject(
cmdPtr = (Command *) oPtr->command;
cmdPtr->nreProc = PublicNRObjectCmd;
- cmdPtr->tracePtr = tracePtr = ckalloc(sizeof(CommandTrace));
+ cmdPtr->tracePtr = tracePtr = Tcl_Alloc(sizeof(CommandTrace));
tracePtr->traceProc = ObjectRenamedTrace;
tracePtr->clientData = oPtr;
tracePtr->flags = TCL_TRACE_RENAME|TCL_TRACE_DELETE;
@@ -889,7 +889,7 @@ TclOODeleteDescendants(
}
}
if (clsPtr->mixinSubs.size > 0) {
- ckfree(clsPtr->mixinSubs.list);
+ Tcl_Free(clsPtr->mixinSubs.list);
clsPtr->mixinSubs.size = 0;
}
@@ -909,7 +909,7 @@ TclOODeleteDescendants(
}
}
if (clsPtr->subclasses.size > 0) {
- ckfree(clsPtr->subclasses.list);
+ Tcl_Free(clsPtr->subclasses.list);
clsPtr->subclasses.list = NULL;
clsPtr->subclasses.size = 0;
}
@@ -934,7 +934,7 @@ TclOODeleteDescendants(
}
}
if (clsPtr->instances.size > 0) {
- ckfree(clsPtr->instances.list);
+ Tcl_Free(clsPtr->instances.list);
clsPtr->instances.list = NULL;
clsPtr->instances.size = 0;
}
@@ -1010,7 +1010,7 @@ TclOOReleaseClassContents(
TclOODeleteChain(callPtr);
}
Tcl_DeleteHashTable(clsPtr->classChainCache);
- ckfree(clsPtr->classChainCache);
+ Tcl_Free(clsPtr->classChainCache);
clsPtr->classChainCache = NULL;
}
@@ -1024,7 +1024,7 @@ TclOOReleaseClassContents(
FOREACH(filterObj, clsPtr->filters) {
TclDecrRefCount(filterObj);
}
- ckfree(clsPtr->filters.list);
+ Tcl_Free(clsPtr->filters.list);
clsPtr->filters.list = NULL;
clsPtr->filters.num = 0;
}
@@ -1041,7 +1041,7 @@ TclOOReleaseClassContents(
metadataTypePtr->deleteProc(value);
}
Tcl_DeleteHashTable(clsPtr->metadataPtr);
- ckfree(clsPtr->metadataPtr);
+ Tcl_Free(clsPtr->metadataPtr);
clsPtr->metadataPtr = NULL;
}
@@ -1050,7 +1050,7 @@ TclOOReleaseClassContents(
TclOORemoveFromMixinSubs(clsPtr, tmpClsPtr);
TclOODecrRefCount(tmpClsPtr->thisPtr);
}
- ckfree(clsPtr->mixins.list);
+ Tcl_Free(clsPtr->mixins.list);
clsPtr->mixins.list = NULL;
clsPtr->mixins.num = 0;
}
@@ -1060,7 +1060,7 @@ TclOOReleaseClassContents(
TclOORemoveFromSubclasses(clsPtr, tmpClsPtr);
TclOODecrRefCount(tmpClsPtr->thisPtr);
}
- ckfree(clsPtr->superclasses.list);
+ Tcl_Free(clsPtr->superclasses.list);
clsPtr->superclasses.num = 0;
clsPtr->superclasses.list = NULL;
}
@@ -1076,7 +1076,7 @@ TclOOReleaseClassContents(
TclDecrRefCount(variableObj);
}
if (i) {
- ckfree(clsPtr->variables.list);
+ Tcl_Free(clsPtr->variables.list);
}
FOREACH_STRUCT(privateVariable, clsPtr->privateVariables) {
@@ -1084,7 +1084,7 @@ TclOOReleaseClassContents(
TclDecrRefCount(privateVariable->fullNameObj);
}
if (i) {
- ckfree(clsPtr->privateVariables.list);
+ Tcl_Free(clsPtr->privateVariables.list);
}
if (IsRootClass(oPtr) && !Deleted(fPtr->objectCls->thisPtr)) {
@@ -1216,7 +1216,7 @@ ObjectNamespaceDeleted(
TclOODecrRefCount(mixinPtr->thisPtr);
}
if (oPtr->mixins.list != NULL) {
- ckfree(oPtr->mixins.list);
+ Tcl_Free(oPtr->mixins.list);
}
}
@@ -1224,7 +1224,7 @@ ObjectNamespaceDeleted(
TclDecrRefCount(filterObj);
}
if (i) {
- ckfree(oPtr->filters.list);
+ Tcl_Free(oPtr->filters.list);
}
if (oPtr->methodsPtr) {
@@ -1232,14 +1232,14 @@ ObjectNamespaceDeleted(
TclOODelMethodRef(mPtr);
}
Tcl_DeleteHashTable(oPtr->methodsPtr);
- ckfree(oPtr->methodsPtr);
+ Tcl_Free(oPtr->methodsPtr);
}
FOREACH(variableObj, oPtr->variables) {
TclDecrRefCount(variableObj);
}
if (i) {
- ckfree(oPtr->variables.list);
+ Tcl_Free(oPtr->variables.list);
}
FOREACH_STRUCT(privateVariable, oPtr->privateVariables) {
@@ -1247,7 +1247,7 @@ ObjectNamespaceDeleted(
TclDecrRefCount(privateVariable->fullNameObj);
}
if (i) {
- ckfree(oPtr->privateVariables.list);
+ Tcl_Free(oPtr->privateVariables.list);
}
if (oPtr->chainCache) {
@@ -1264,7 +1264,7 @@ ObjectNamespaceDeleted(
metadataTypePtr->deleteProc(value);
}
Tcl_DeleteHashTable(oPtr->metadataPtr);
- ckfree(oPtr->metadataPtr);
+ Tcl_Free(oPtr->metadataPtr);
oPtr->metadataPtr = NULL;
}
@@ -1320,9 +1320,9 @@ TclOODecrRefCount(
if (oPtr->refCount-- <= 1) {
if (oPtr->classPtr != NULL) {
- ckfree(oPtr->classPtr);
+ Tcl_Free(oPtr->classPtr);
}
- ckfree(oPtr);
+ Tcl_Free(oPtr);
return 1;
}
return 0;
@@ -1380,9 +1380,9 @@ TclOOAddToInstances(
if (clsPtr->instances.num >= clsPtr->instances.size) {
clsPtr->instances.size += ALLOC_CHUNK;
if (clsPtr->instances.size == ALLOC_CHUNK) {
- clsPtr->instances.list = ckalloc(sizeof(Object *) * ALLOC_CHUNK);
+ clsPtr->instances.list = Tcl_Alloc(sizeof(Object *) * ALLOC_CHUNK);
} else {
- clsPtr->instances.list = ckrealloc(clsPtr->instances.list,
+ clsPtr->instances.list = Tcl_Realloc(clsPtr->instances.list,
sizeof(Object *) * clsPtr->instances.size);
}
}
@@ -1419,7 +1419,7 @@ TclOORemoveFromMixins(
}
}
if (oPtr->mixins.num == 0) {
- ckfree(oPtr->mixins.list);
+ Tcl_Free(oPtr->mixins.list);
oPtr->mixins.list = NULL;
}
return res;
@@ -1479,9 +1479,9 @@ TclOOAddToSubclasses(
if (superPtr->subclasses.num >= superPtr->subclasses.size) {
superPtr->subclasses.size += ALLOC_CHUNK;
if (superPtr->subclasses.size == ALLOC_CHUNK) {
- superPtr->subclasses.list = ckalloc(sizeof(Class *) * ALLOC_CHUNK);
+ superPtr->subclasses.list = Tcl_Alloc(sizeof(Class *) * ALLOC_CHUNK);
} else {
- superPtr->subclasses.list = ckrealloc(superPtr->subclasses.list,
+ superPtr->subclasses.list = Tcl_Realloc(superPtr->subclasses.list,
sizeof(Class *) * superPtr->subclasses.size);
}
}
@@ -1544,9 +1544,9 @@ TclOOAddToMixinSubs(
if (superPtr->mixinSubs.num >= superPtr->mixinSubs.size) {
superPtr->mixinSubs.size += ALLOC_CHUNK;
if (superPtr->mixinSubs.size == ALLOC_CHUNK) {
- superPtr->mixinSubs.list = ckalloc(sizeof(Class *) * ALLOC_CHUNK);
+ superPtr->mixinSubs.list = Tcl_Alloc(sizeof(Class *) * ALLOC_CHUNK);
} else {
- superPtr->mixinSubs.list = ckrealloc(superPtr->mixinSubs.list,
+ superPtr->mixinSubs.list = Tcl_Realloc(superPtr->mixinSubs.list,
sizeof(Class *) * superPtr->mixinSubs.size);
}
}
@@ -1592,7 +1592,7 @@ TclOOAllocClass(
* representation. */
{
Foundation *fPtr = GetFoundation(interp);
- Class *clsPtr = ckalloc(sizeof(Class));
+ Class *clsPtr = Tcl_Alloc(sizeof(Class));
memset(clsPtr, 0, sizeof(Class));
clsPtr->thisPtr = useThisObj;
@@ -1609,7 +1609,7 @@ TclOOAllocClass(
*/
clsPtr->superclasses.num = 1;
- clsPtr->superclasses.list = ckalloc(sizeof(Class *));
+ clsPtr->superclasses.list = Tcl_Alloc(sizeof(Class *));
clsPtr->superclasses.list[0] = fPtr->objectCls;
AddRef(fPtr->objectCls->thisPtr);
@@ -1959,7 +1959,7 @@ Tcl_CopyObjectInstance(
}
TclOODecrRefCount(mixinPtr->thisPtr);
}
- ckfree(o2Ptr->mixins.list);
+ Tcl_Free(o2Ptr->mixins.list);
}
DUPLICATE(o2Ptr->mixins, oPtr->mixins, Class *);
FOREACH(mixinPtr, o2Ptr->mixins) {
@@ -2060,11 +2060,11 @@ Tcl_CopyObjectInstance(
TclOODecrRefCount(superPtr->thisPtr);
}
if (cls2Ptr->superclasses.num) {
- cls2Ptr->superclasses.list = ckrealloc(cls2Ptr->superclasses.list,
+ cls2Ptr->superclasses.list = Tcl_Realloc(cls2Ptr->superclasses.list,
sizeof(Class *) * clsPtr->superclasses.num);
} else {
cls2Ptr->superclasses.list =
- ckalloc(sizeof(Class *) * clsPtr->superclasses.num);
+ Tcl_Alloc(sizeof(Class *) * clsPtr->superclasses.num);
}
memcpy(cls2Ptr->superclasses.list, clsPtr->superclasses.list,
sizeof(Class *) * clsPtr->superclasses.num);
@@ -2115,7 +2115,7 @@ Tcl_CopyObjectInstance(
TclOORemoveFromMixinSubs(cls2Ptr, mixinPtr);
TclOODecrRefCount(mixinPtr->thisPtr);
}
- ckfree(clsPtr->mixins.list);
+ Tcl_Free(clsPtr->mixins.list);
}
DUPLICATE(cls2Ptr->mixins, clsPtr->mixins, Class *);
FOREACH(mixinPtr, cls2Ptr->mixins) {
@@ -2358,7 +2358,7 @@ Tcl_ClassSetMetadata(
if (metadata == NULL) {
return;
}
- clsPtr->metadataPtr = ckalloc(sizeof(Tcl_HashTable));
+ clsPtr->metadataPtr = Tcl_Alloc(sizeof(Tcl_HashTable));
Tcl_InitHashTable(clsPtr->metadataPtr, TCL_ONE_WORD_KEYS);
}
@@ -2438,7 +2438,7 @@ Tcl_ObjectSetMetadata(
if (metadata == NULL) {
return;
}
- oPtr->metadataPtr = ckalloc(sizeof(Tcl_HashTable));
+ oPtr->metadataPtr = Tcl_Alloc(sizeof(Tcl_HashTable));
Tcl_InitHashTable(oPtr->metadataPtr, TCL_ONE_WORD_KEYS);
}
diff --git a/generic/tclOO.decls b/generic/tclOO.decls
index f1bb320..ed7b800 100644
--- a/generic/tclOO.decls
+++ b/generic/tclOO.decls
@@ -51,7 +51,7 @@ declare 8 {
}
declare 9 {
int Tcl_MethodIsType(Tcl_Method method, const Tcl_MethodType *typePtr,
- ClientData *clientDataPtr)
+ void **clientDataPtr)
}
declare 10 {
Tcl_Obj *Tcl_MethodName(Tcl_Method method)
@@ -59,12 +59,12 @@ declare 10 {
declare 11 {
Tcl_Method Tcl_NewInstanceMethod(Tcl_Interp *interp, Tcl_Object object,
Tcl_Obj *nameObj, int flags, const Tcl_MethodType *typePtr,
- ClientData clientData)
+ void *clientData)
}
declare 12 {
Tcl_Method Tcl_NewMethod(Tcl_Interp *interp, Tcl_Class cls,
Tcl_Obj *nameObj, int flags, const Tcl_MethodType *typePtr,
- ClientData clientData)
+ void *clientData)
}
declare 13 {
Tcl_Object Tcl_NewObjectInstance(Tcl_Interp *interp, Tcl_Class cls,
@@ -87,20 +87,20 @@ declare 18 {
int Tcl_ObjectContextSkippedArgs(Tcl_ObjectContext context)
}
declare 19 {
- ClientData Tcl_ClassGetMetadata(Tcl_Class clazz,
+ void *Tcl_ClassGetMetadata(Tcl_Class clazz,
const Tcl_ObjectMetadataType *typePtr)
}
declare 20 {
void Tcl_ClassSetMetadata(Tcl_Class clazz,
- const Tcl_ObjectMetadataType *typePtr, ClientData metadata)
+ const Tcl_ObjectMetadataType *typePtr, void *metadata)
}
declare 21 {
- ClientData Tcl_ObjectGetMetadata(Tcl_Object object,
+ void *Tcl_ObjectGetMetadata(Tcl_Object object,
const Tcl_ObjectMetadataType *typePtr)
}
declare 22 {
void Tcl_ObjectSetMetadata(Tcl_Object object,
- const Tcl_ObjectMetadataType *typePtr, ClientData metadata)
+ const Tcl_ObjectMetadataType *typePtr, void *metadata)
}
declare 23 {
int Tcl_ObjectContextInvokeNext(Tcl_Interp *interp,
@@ -144,14 +144,14 @@ declare 0 {
declare 1 {
Tcl_Method TclOOMakeProcInstanceMethod(Tcl_Interp *interp, Object *oPtr,
int flags, Tcl_Obj *nameObj, Tcl_Obj *argsObj, Tcl_Obj *bodyObj,
- const Tcl_MethodType *typePtr, ClientData clientData,
+ const Tcl_MethodType *typePtr, void *clientData,
Proc **procPtrPtr)
}
declare 2 {
Tcl_Method TclOOMakeProcMethod(Tcl_Interp *interp, Class *clsPtr,
int flags, Tcl_Obj *nameObj, const char *namePtr,
Tcl_Obj *argsObj, Tcl_Obj *bodyObj, const Tcl_MethodType *typePtr,
- ClientData clientData, Proc **procPtrPtr)
+ void *clientData, Proc **procPtrPtr)
}
declare 3 {
Method *TclOONewProcInstanceMethod(Tcl_Interp *interp, Object *oPtr,
@@ -182,13 +182,13 @@ declare 9 {
Tcl_Method TclOONewProcInstanceMethodEx(Tcl_Interp *interp,
Tcl_Object oPtr, TclOO_PreCallProc *preCallPtr,
TclOO_PostCallProc *postCallPtr, ProcErrorProc *errProc,
- ClientData clientData, Tcl_Obj *nameObj, Tcl_Obj *argsObj,
+ void *clientData, Tcl_Obj *nameObj, Tcl_Obj *argsObj,
Tcl_Obj *bodyObj, int flags, void **internalTokenPtr)
}
declare 10 {
Tcl_Method TclOONewProcMethodEx(Tcl_Interp *interp, Tcl_Class clsPtr,
TclOO_PreCallProc *preCallPtr, TclOO_PostCallProc *postCallPtr,
- ProcErrorProc *errProc, ClientData clientData, Tcl_Obj *nameObj,
+ ProcErrorProc *errProc, void *clientData, Tcl_Obj *nameObj,
Tcl_Obj *argsObj, Tcl_Obj *bodyObj, int flags,
void **internalTokenPtr)
}
diff --git a/generic/tclOO.h b/generic/tclOO.h
index 9c1dd1e..4a3398f 100644
--- a/generic/tclOO.h
+++ b/generic/tclOO.h
@@ -60,12 +60,12 @@ typedef struct Tcl_ObjectContext_ *Tcl_ObjectContext;
* and to allow the attachment of arbitrary data to objects and classes.
*/
-typedef int (Tcl_MethodCallProc)(ClientData clientData, Tcl_Interp *interp,
+typedef int (Tcl_MethodCallProc)(void *clientData, Tcl_Interp *interp,
Tcl_ObjectContext objectContext, int objc, Tcl_Obj *const *objv);
-typedef void (Tcl_MethodDeleteProc)(ClientData clientData);
-typedef int (Tcl_CloneProc)(Tcl_Interp *interp, ClientData oldClientData,
- ClientData *newClientData);
-typedef void (Tcl_ObjectMetadataDeleteProc)(ClientData clientData);
+typedef void (Tcl_MethodDeleteProc)(void *clientData);
+typedef int (Tcl_CloneProc)(Tcl_Interp *interp, void *oldClientData,
+ void **newClientData);
+typedef void (Tcl_ObjectMetadataDeleteProc)(void *clientData);
typedef int (Tcl_ObjectMapMethodNameProc)(Tcl_Interp *interp,
Tcl_Object object, Tcl_Class *startClsPtr, Tcl_Obj *methodNameObj);
@@ -95,7 +95,7 @@ typedef struct {
/*
* The correct value for the version field of the Tcl_MethodType structure.
* This allows new versions of the structure to be introduced without breaking
- * binary compatability.
+ * binary compatibility.
*/
#define TCL_OO_METHOD_VERSION_CURRENT 1
@@ -131,7 +131,7 @@ typedef struct {
/*
* The correct value for the version field of the Tcl_ObjectMetadataType
* structure. This allows new versions of the structure to be introduced
- * without breaking binary compatability.
+ * without breaking binary compatibility.
*/
#define TCL_OO_METADATA_VERSION_CURRENT 1
diff --git a/generic/tclOOBasic.c b/generic/tclOOBasic.c
index 13c98f4..c1002ce 100644
--- a/generic/tclOOBasic.c
+++ b/generic/tclOOBasic.c
@@ -108,7 +108,7 @@ TclOO_Class_Constructor(
* Delegate to [oo::define] to do the work.
*/
- invoke = ckalloc(3 * sizeof(Tcl_Obj *));
+ invoke = Tcl_Alloc(3 * sizeof(Tcl_Obj *));
invoke[0] = oPtr->fPtr->defineName;
invoke[1] = TclOOObjectName(interp, oPtr);
invoke[2] = objv[objc-1];
@@ -154,7 +154,7 @@ DecrRefsPostClassConstructor(
code = Tcl_EvalObjv(interp, 2, invoke, 0);
TclDecrRefCount(invoke[0]);
TclDecrRefCount(invoke[1]);
- ckfree(invoke);
+ Tcl_Free(invoke);
if (code != TCL_OK) {
Tcl_DiscardInterpState(saved);
return code;
@@ -183,7 +183,7 @@ TclOO_Class_Create(
{
Object *oPtr = (Object *) Tcl_ObjectContextObject(context);
const char *objName;
- int len;
+ size_t len;
/*
* Sanity check; should not be possible to invoke this method on a
@@ -208,7 +208,7 @@ TclOO_Class_Create(
"objectName ?arg ...?");
return TCL_ERROR;
}
- objName = Tcl_GetStringFromObj(
+ objName = TclGetStringFromObj(
objv[Tcl_ObjectContextSkippedArgs(context)], &len);
if (len == 0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
@@ -248,7 +248,7 @@ TclOO_Class_CreateNs(
{
Object *oPtr = (Object *) Tcl_ObjectContextObject(context);
const char *objName, *nsName;
- int len;
+ size_t len;
/*
* Sanity check; should not be possible to invoke this method on a
@@ -273,7 +273,7 @@ TclOO_Class_CreateNs(
"objectName namespaceName ?arg ...?");
return TCL_ERROR;
}
- objName = Tcl_GetStringFromObj(
+ objName = TclGetStringFromObj(
objv[Tcl_ObjectContextSkippedArgs(context)], &len);
if (len == 0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
@@ -281,7 +281,7 @@ TclOO_Class_CreateNs(
Tcl_SetErrorCode(interp, "TCL", "OO", "EMPTY_NAME", NULL);
return TCL_ERROR;
}
- nsName = Tcl_GetStringFromObj(
+ nsName = TclGetStringFromObj(
objv[Tcl_ObjectContextSkippedArgs(context)+1], &len);
if (len == 0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
@@ -605,7 +605,7 @@ TclOO_Object_Unknown(
Tcl_AppendToObj(errorMsg, " or ", -1);
}
Tcl_AppendToObj(errorMsg, methodNames[i], -1);
- ckfree(methodNames);
+ Tcl_Free((void *)methodNames);
Tcl_SetObjResult(interp, errorMsg);
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "METHOD",
TclGetString(objv[skip]), NULL);
@@ -744,7 +744,7 @@ TclOO_Object_VarName(
return TCL_ERROR;
}
argPtr = objv[objc-1];
- arg = Tcl_GetString(argPtr);
+ arg = TclGetString(argPtr);
/*
* Convert the variable name to fully-qualified form if it wasn't already.
@@ -781,8 +781,8 @@ TclOO_Object_VarName(
if (mPtr->declaringObjectPtr == oPtr) {
FOREACH_STRUCT(pvPtr, oPtr->privateVariables) {
- if (!strcmp(Tcl_GetString(pvPtr->variableObj),
- Tcl_GetString(argPtr))) {
+ if (!strcmp(TclGetString(pvPtr->variableObj),
+ TclGetString(argPtr))) {
argPtr = pvPtr->fullNameObj;
break;
}
@@ -803,8 +803,8 @@ TclOO_Object_VarName(
}
if (isInstance) {
FOREACH_STRUCT(pvPtr, clsPtr->privateVariables) {
- if (!strcmp(Tcl_GetString(pvPtr->variableObj),
- Tcl_GetString(argPtr))) {
+ if (!strcmp(TclGetString(pvPtr->variableObj),
+ TclGetString(argPtr))) {
argPtr = pvPtr->fullNameObj;
break;
}
diff --git a/generic/tclOOCall.c b/generic/tclOOCall.c
index c0d2e64..df0f435 100644
--- a/generic/tclOOCall.c
+++ b/generic/tclOOCall.c
@@ -205,7 +205,7 @@ TclOODeleteChainCache(
}
}
Tcl_DeleteHashTable(tablePtr);
- ckfree(tablePtr);
+ Tcl_Free(tablePtr);
}
/*
@@ -226,9 +226,9 @@ TclOODeleteChain(
return;
}
if (callPtr->chain != callPtr->staticChain) {
- ckfree(callPtr->chain);
+ Tcl_Free(callPtr->chain);
}
- ckfree(callPtr);
+ Tcl_Free(callPtr);
}
/*
@@ -589,13 +589,13 @@ SortMethodNames(
* methods. Full private methods are handled
* on insertion to the table. */
const char ***stringsPtr) /* Where to store the sorted list of strings
- * that we produce. ckalloced() */
+ * that we produce. Tcl_Alloced() */
{
const char **strings;
FOREACH_HASH_DECLS;
Tcl_Obj *namePtr;
void *isWanted;
- int i = 0;
+ size_t i = 0;
/*
* See how many (visible) method names there are. If none, we do not (and
@@ -613,7 +613,7 @@ SortMethodNames(
* sorted when it is long enough to matter.
*/
- strings = ckalloc(sizeof(char *) * namesPtr->numEntries);
+ strings = Tcl_Alloc(sizeof(char *) * namesPtr->numEntries);
FOREACH_HASH(namePtr, isWanted, namesPtr) {
if (!WANT_PUBLIC(flags) || (PTR2INT(isWanted) & IN_LIST)) {
if (PTR2INT(isWanted) & NO_IMPLEMENTATION) {
@@ -635,7 +635,7 @@ SortMethodNames(
}
*stringsPtr = strings;
} else {
- ckfree(strings);
+ Tcl_Free((void *)strings);
*stringsPtr = NULL;
}
return i;
@@ -1037,11 +1037,11 @@ AddMethodToCallChain(
if (callPtr->numChain == CALL_CHAIN_STATIC_SIZE) {
callPtr->chain =
- ckalloc(sizeof(struct MInvoke) * (callPtr->numChain + 1));
+ Tcl_Alloc(sizeof(struct MInvoke) * (callPtr->numChain + 1));
memcpy(callPtr->chain, callPtr->staticChain,
sizeof(struct MInvoke) * callPtr->numChain);
} else if (callPtr->numChain > CALL_CHAIN_STATIC_SIZE) {
- callPtr->chain = ckrealloc(callPtr->chain,
+ callPtr->chain = Tcl_Realloc(callPtr->chain,
sizeof(struct MInvoke) * (callPtr->numChain + 1));
}
callPtr->chain[i].mPtr = mPtr;
@@ -1230,7 +1230,7 @@ TclOOGetCallContext(
doFilters = 1;
}
- callPtr = ckalloc(sizeof(CallChain));
+ callPtr = Tcl_Alloc(sizeof(CallChain));
InitCallChain(callPtr, oPtr, flags);
cb.callChainPtr = callPtr;
@@ -1248,7 +1248,7 @@ TclOOGetCallContext(
AddSimpleChainToCallContext(oPtr, NULL,
oPtr->fPtr->unknownMethodNameObj, &cb, NULL, 0, NULL);
callPtr->flags |= OO_UNKNOWN_METHOD;
- callPtr->epoch = -1;
+ callPtr->epoch = 0;
if (callPtr->numChain == 0) {
TclOODeleteChain(callPtr);
return NULL;
@@ -1325,7 +1325,7 @@ TclOOGetCallContext(
AddSimpleChainToCallContext(oPtr, NULL,
oPtr->fPtr->unknownMethodNameObj, &cb, NULL, 0, NULL);
callPtr->flags |= OO_UNKNOWN_METHOD;
- callPtr->epoch = -1;
+ callPtr->epoch = 0;
if (count == callPtr->numChain) {
TclOODeleteChain(callPtr);
return NULL;
@@ -1335,7 +1335,7 @@ TclOOGetCallContext(
if (oPtr->flags & USE_CLASS_CACHE) {
if (oPtr->selfCls->classChainCache == NULL) {
oPtr->selfCls->classChainCache =
- ckalloc(sizeof(Tcl_HashTable));
+ Tcl_Alloc(sizeof(Tcl_HashTable));
Tcl_InitObjHashTable(oPtr->selfCls->classChainCache);
}
@@ -1343,7 +1343,7 @@ TclOOGetCallContext(
(char *) methodNameObj, &i);
} else {
if (oPtr->chainCache == NULL) {
- oPtr->chainCache = ckalloc(sizeof(Tcl_HashTable));
+ oPtr->chainCache = Tcl_Alloc(sizeof(Tcl_HashTable));
Tcl_InitObjHashTable(oPtr->chainCache);
}
@@ -1450,7 +1450,7 @@ TclOOGetStereotypeCallChain(
hPtr = NULL;
}
- callPtr = ckalloc(sizeof(CallChain));
+ callPtr = Tcl_Alloc(sizeof(CallChain));
memset(callPtr, 0, sizeof(CallChain));
callPtr->flags = flags & (PUBLIC_METHOD|PRIVATE_METHOD|FILTER_HANDLING);
callPtr->epoch = fPtr->epoch;
@@ -1497,7 +1497,7 @@ TclOOGetStereotypeCallChain(
AddSimpleChainToCallContext(&obj, NULL, fPtr->unknownMethodNameObj,
&cb, NULL, 0, NULL);
callPtr->flags |= OO_UNKNOWN_METHOD;
- callPtr->epoch = -1;
+ callPtr->epoch = 0;
if (count == callPtr->numChain) {
TclOODeleteChain(callPtr);
return NULL;
@@ -1505,7 +1505,7 @@ TclOOGetStereotypeCallChain(
} else {
if (hPtr == NULL) {
if (clsPtr->classChainCache == NULL) {
- clsPtr->classChainCache = ckalloc(sizeof(Tcl_HashTable));
+ clsPtr->classChainCache = Tcl_Alloc(sizeof(Tcl_HashTable));
Tcl_InitObjHashTable(clsPtr->classChainCache);
}
hPtr = Tcl_CreateHashEntry(clsPtr->classChainCache,
@@ -1922,7 +1922,7 @@ TclOOGetDefineContextNamespace(
Tcl_ResetResult(interp);
}
if (define.list != staticSpace) {
- ckfree(define.list);
+ Tcl_Free(define.list);
}
return nsPtr;
}
@@ -2087,11 +2087,11 @@ AddDefinitionNamespaceToChain(
DefineEntry *staticList = definePtr->list;
definePtr->list =
- ckalloc(sizeof(DefineEntry) * definePtr->size);
+ Tcl_Alloc(sizeof(DefineEntry) * definePtr->size);
memcpy(definePtr->list, staticList,
sizeof(DefineEntry) * definePtr->num);
} else {
- definePtr->list = ckrealloc(definePtr->list,
+ definePtr->list = Tcl_Realloc(definePtr->list,
sizeof(DefineEntry) * definePtr->size);
}
}
diff --git a/generic/tclOODecls.h b/generic/tclOODecls.h
index 928d07e..9e47852 100644
--- a/generic/tclOODecls.h
+++ b/generic/tclOODecls.h
@@ -53,19 +53,19 @@ TCLAPI int Tcl_MethodIsPublic(Tcl_Method method);
/* 9 */
TCLAPI int Tcl_MethodIsType(Tcl_Method method,
const Tcl_MethodType *typePtr,
- ClientData *clientDataPtr);
+ void **clientDataPtr);
/* 10 */
TCLAPI Tcl_Obj * Tcl_MethodName(Tcl_Method method);
/* 11 */
TCLAPI Tcl_Method Tcl_NewInstanceMethod(Tcl_Interp *interp,
Tcl_Object object, Tcl_Obj *nameObj,
int flags, const Tcl_MethodType *typePtr,
- ClientData clientData);
+ void *clientData);
/* 12 */
TCLAPI Tcl_Method Tcl_NewMethod(Tcl_Interp *interp, Tcl_Class cls,
Tcl_Obj *nameObj, int flags,
const Tcl_MethodType *typePtr,
- ClientData clientData);
+ void *clientData);
/* 13 */
TCLAPI Tcl_Object Tcl_NewObjectInstance(Tcl_Interp *interp,
Tcl_Class cls, const char *nameStr,
@@ -84,19 +84,19 @@ TCLAPI Tcl_Object Tcl_ObjectContextObject(Tcl_ObjectContext context);
TCLAPI int Tcl_ObjectContextSkippedArgs(
Tcl_ObjectContext context);
/* 19 */
-TCLAPI ClientData Tcl_ClassGetMetadata(Tcl_Class clazz,
+TCLAPI void * Tcl_ClassGetMetadata(Tcl_Class clazz,
const Tcl_ObjectMetadataType *typePtr);
/* 20 */
TCLAPI void Tcl_ClassSetMetadata(Tcl_Class clazz,
const Tcl_ObjectMetadataType *typePtr,
- ClientData metadata);
+ void *metadata);
/* 21 */
-TCLAPI ClientData Tcl_ObjectGetMetadata(Tcl_Object object,
+TCLAPI void * Tcl_ObjectGetMetadata(Tcl_Object object,
const Tcl_ObjectMetadataType *typePtr);
/* 22 */
TCLAPI void Tcl_ObjectSetMetadata(Tcl_Object object,
const Tcl_ObjectMetadataType *typePtr,
- ClientData metadata);
+ void *metadata);
/* 23 */
TCLAPI int Tcl_ObjectContextInvokeNext(Tcl_Interp *interp,
Tcl_ObjectContext context, int objc,
@@ -136,20 +136,20 @@ typedef struct TclOOStubs {
Tcl_Class (*tcl_MethodDeclarerClass) (Tcl_Method method); /* 6 */
Tcl_Object (*tcl_MethodDeclarerObject) (Tcl_Method method); /* 7 */
int (*tcl_MethodIsPublic) (Tcl_Method method); /* 8 */
- int (*tcl_MethodIsType) (Tcl_Method method, const Tcl_MethodType *typePtr, ClientData *clientDataPtr); /* 9 */
+ int (*tcl_MethodIsType) (Tcl_Method method, const Tcl_MethodType *typePtr, void **clientDataPtr); /* 9 */
Tcl_Obj * (*tcl_MethodName) (Tcl_Method method); /* 10 */
- Tcl_Method (*tcl_NewInstanceMethod) (Tcl_Interp *interp, Tcl_Object object, Tcl_Obj *nameObj, int flags, const Tcl_MethodType *typePtr, ClientData clientData); /* 11 */
- Tcl_Method (*tcl_NewMethod) (Tcl_Interp *interp, Tcl_Class cls, Tcl_Obj *nameObj, int flags, const Tcl_MethodType *typePtr, ClientData clientData); /* 12 */
+ Tcl_Method (*tcl_NewInstanceMethod) (Tcl_Interp *interp, Tcl_Object object, Tcl_Obj *nameObj, int flags, const Tcl_MethodType *typePtr, void *clientData); /* 11 */
+ Tcl_Method (*tcl_NewMethod) (Tcl_Interp *interp, Tcl_Class cls, Tcl_Obj *nameObj, int flags, const Tcl_MethodType *typePtr, void *clientData); /* 12 */
Tcl_Object (*tcl_NewObjectInstance) (Tcl_Interp *interp, Tcl_Class cls, const char *nameStr, const char *nsNameStr, int objc, Tcl_Obj *const *objv, int skip); /* 13 */
int (*tcl_ObjectDeleted) (Tcl_Object object); /* 14 */
int (*tcl_ObjectContextIsFiltering) (Tcl_ObjectContext context); /* 15 */
Tcl_Method (*tcl_ObjectContextMethod) (Tcl_ObjectContext context); /* 16 */
Tcl_Object (*tcl_ObjectContextObject) (Tcl_ObjectContext context); /* 17 */
int (*tcl_ObjectContextSkippedArgs) (Tcl_ObjectContext context); /* 18 */
- ClientData (*tcl_ClassGetMetadata) (Tcl_Class clazz, const Tcl_ObjectMetadataType *typePtr); /* 19 */
- void (*tcl_ClassSetMetadata) (Tcl_Class clazz, const Tcl_ObjectMetadataType *typePtr, ClientData metadata); /* 20 */
- ClientData (*tcl_ObjectGetMetadata) (Tcl_Object object, const Tcl_ObjectMetadataType *typePtr); /* 21 */
- void (*tcl_ObjectSetMetadata) (Tcl_Object object, const Tcl_ObjectMetadataType *typePtr, ClientData metadata); /* 22 */
+ void * (*tcl_ClassGetMetadata) (Tcl_Class clazz, const Tcl_ObjectMetadataType *typePtr); /* 19 */
+ void (*tcl_ClassSetMetadata) (Tcl_Class clazz, const Tcl_ObjectMetadataType *typePtr, void *metadata); /* 20 */
+ void * (*tcl_ObjectGetMetadata) (Tcl_Object object, const Tcl_ObjectMetadataType *typePtr); /* 21 */
+ void (*tcl_ObjectSetMetadata) (Tcl_Object object, const Tcl_ObjectMetadataType *typePtr, void *metadata); /* 22 */
int (*tcl_ObjectContextInvokeNext) (Tcl_Interp *interp, Tcl_ObjectContext context, int objc, Tcl_Obj *const *objv, int skip); /* 23 */
Tcl_ObjectMapMethodNameProc * (*tcl_ObjectGetMethodNameMapper) (Tcl_Object object); /* 24 */
void (*tcl_ObjectSetMethodNameMapper) (Tcl_Object object, Tcl_ObjectMapMethodNameProc *mapMethodNameProc); /* 25 */
diff --git a/generic/tclOODefineCmds.c b/generic/tclOODefineCmds.c
index fb16007..b82b6af 100644
--- a/generic/tclOODefineCmds.c
+++ b/generic/tclOODefineCmds.c
@@ -267,7 +267,7 @@ TclOOObjectSetFilters(
* No list of filters was supplied, so we're deleting filters.
*/
- ckfree(oPtr->filters.list);
+ Tcl_Free(oPtr->filters.list);
oPtr->filters.list = NULL;
oPtr->filters.num = 0;
RecomputeClassCacheFlag(oPtr);
@@ -280,9 +280,9 @@ TclOOObjectSetFilters(
int size = sizeof(Tcl_Obj *) * numFilters; /* should be size_t */
if (oPtr->filters.num == 0) {
- filtersList = ckalloc(size);
+ filtersList = Tcl_Alloc(size);
} else {
- filtersList = ckrealloc(oPtr->filters.list, size);
+ filtersList = Tcl_Realloc(oPtr->filters.list, size);
}
for (i = 0 ; i < numFilters ; i++) {
filtersList[i] = filters[i];
@@ -327,7 +327,7 @@ TclOOClassSetFilters(
* No list of filters was supplied, so we're deleting filters.
*/
- ckfree(classPtr->filters.list);
+ Tcl_Free(classPtr->filters.list);
classPtr->filters.list = NULL;
classPtr->filters.num = 0;
} else {
@@ -339,9 +339,9 @@ TclOOClassSetFilters(
int size = sizeof(Tcl_Obj *) * numFilters; /* should be size_t */
if (classPtr->filters.num == 0) {
- filtersList = ckalloc(size);
+ filtersList = Tcl_Alloc(size);
} else {
- filtersList = ckrealloc(classPtr->filters.list, size);
+ filtersList = Tcl_Realloc(classPtr->filters.list, size);
}
for (i = 0 ; i < numFilters ; i++) {
filtersList[i] = filters[i];
@@ -383,7 +383,7 @@ TclOOObjectSetMixins(
TclOORemoveFromInstances(oPtr, mixinPtr);
TclOODecrRefCount(mixinPtr->thisPtr);
}
- ckfree(oPtr->mixins.list);
+ Tcl_Free(oPtr->mixins.list);
oPtr->mixins.num = 0;
}
RecomputeClassCacheFlag(oPtr);
@@ -395,10 +395,10 @@ TclOOObjectSetMixins(
}
TclOODecrRefCount(mixinPtr->thisPtr);
}
- oPtr->mixins.list = ckrealloc(oPtr->mixins.list,
+ oPtr->mixins.list = Tcl_Realloc(oPtr->mixins.list,
sizeof(Class *) * numMixins);
} else {
- oPtr->mixins.list = ckalloc(sizeof(Class *) * numMixins);
+ oPtr->mixins.list = Tcl_Alloc(sizeof(Class *) * numMixins);
oPtr->flags &= ~USE_CLASS_CACHE;
}
oPtr->mixins.num = numMixins;
@@ -444,7 +444,7 @@ TclOOClassSetMixins(
TclOORemoveFromMixinSubs(classPtr, mixinPtr);
TclOODecrRefCount(mixinPtr->thisPtr);
}
- ckfree(classPtr->mixins.list);
+ Tcl_Free(classPtr->mixins.list);
classPtr->mixins.num = 0;
}
} else {
@@ -453,10 +453,10 @@ TclOOClassSetMixins(
TclOORemoveFromMixinSubs(classPtr, mixinPtr);
TclOODecrRefCount(mixinPtr->thisPtr);
}
- classPtr->mixins.list = ckrealloc(classPtr->mixins.list,
+ classPtr->mixins.list = Tcl_Realloc(classPtr->mixins.list,
sizeof(Class *) * numMixins);
} else {
- classPtr->mixins.list = ckalloc(sizeof(Class *) * numMixins);
+ classPtr->mixins.list = Tcl_Alloc(sizeof(Class *) * numMixins);
}
classPtr->mixins.num = numMixins;
memcpy(classPtr->mixins.list, mixins, sizeof(Class *) * numMixins);
@@ -500,11 +500,11 @@ InstallStandardVariableMapping(
}
if (i != varc) {
if (varc == 0) {
- ckfree(vnlPtr->list);
+ Tcl_Free(vnlPtr->list);
} else if (i) {
- vnlPtr->list = ckrealloc(vnlPtr->list, sizeof(Tcl_Obj *) * varc);
+ vnlPtr->list = Tcl_Realloc(vnlPtr->list, sizeof(Tcl_Obj *) * varc);
} else {
- vnlPtr->list = ckalloc(sizeof(Tcl_Obj *) * varc);
+ vnlPtr->list = Tcl_Alloc(sizeof(Tcl_Obj *) * varc);
}
}
vnlPtr->num = 0;
@@ -525,7 +525,7 @@ InstallStandardVariableMapping(
*/
if (n != varc) {
- vnlPtr->list = ckrealloc(vnlPtr->list, sizeof(Tcl_Obj *) * n);
+ vnlPtr->list = Tcl_Realloc(vnlPtr->list, sizeof(Tcl_Obj *) * n);
}
Tcl_DeleteHashTable(&uniqueTable);
}
@@ -551,12 +551,12 @@ InstallPrivateVariableMapping(
}
if (i != varc) {
if (varc == 0) {
- ckfree(pvlPtr->list);
+ Tcl_Free(pvlPtr->list);
} else if (i) {
- pvlPtr->list = ckrealloc(pvlPtr->list,
+ pvlPtr->list = Tcl_Realloc(pvlPtr->list,
sizeof(PrivateVariableMapping) * varc);
} else {
- pvlPtr->list = ckalloc(sizeof(PrivateVariableMapping) * varc);
+ pvlPtr->list = Tcl_Alloc(sizeof(PrivateVariableMapping) * varc);
}
}
@@ -570,7 +570,7 @@ InstallPrivateVariableMapping(
privatePtr->variableObj = varv[i];
privatePtr->fullNameObj = Tcl_ObjPrintf(
PRIVATE_VARIABLE_PATTERN,
- creationEpoch, Tcl_GetString(varv[i]));
+ creationEpoch, TclGetString(varv[i]));
Tcl_IncrRefCount(privatePtr->fullNameObj);
} else {
Tcl_DecrRefCount(varv[i]);
@@ -583,7 +583,7 @@ InstallPrivateVariableMapping(
*/
if (n != varc) {
- pvlPtr->list = ckrealloc(pvlPtr->list,
+ pvlPtr->list = Tcl_Realloc(pvlPtr->list,
sizeof(PrivateVariableMapping) * n);
}
Tcl_DeleteHashTable(&uniqueTable);
@@ -703,7 +703,7 @@ TclOOUnknownDefinition(
Namespace *nsPtr = (Namespace *) Tcl_GetCurrentNamespace(interp);
Tcl_HashSearch search;
Tcl_HashEntry *hPtr;
- int soughtLen;
+ size_t soughtLen;
const char *soughtStr, *matchedStr = NULL;
if (objc < 2) {
@@ -777,7 +777,7 @@ FindCommand(
Tcl_Obj *stringObj,
Tcl_Namespace *const namespacePtr)
{
- int length;
+ size_t length;
const char *nameStr, *string = TclGetStringFromObj(stringObj, &length);
register Namespace *const nsPtr = (Namespace *) namespacePtr;
FOREACH_HASH_DECLS;
@@ -996,16 +996,16 @@ GenerateErrorInfo(
* an object, class or class-as-object that
* was being configured. */
{
- int length;
+ size_t length;
Tcl_Obj *realNameObj = Tcl_ObjectDeleted((Tcl_Object) oPtr)
? savedNameObj : TclOOObjectName(interp, oPtr);
const char *objName = TclGetStringFromObj(realNameObj, &length);
- int limit = OBJNAME_LENGTH_IN_ERRORINFO_LIMIT;
+ unsigned limit = OBJNAME_LENGTH_IN_ERRORINFO_LIMIT;
int overflow = (length > limit);
Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
"\n (in definition script for %s \"%.*s%s\" line %d)",
- typeOfSubject, (overflow ? limit : length), objName,
+ typeOfSubject, (overflow ? limit : (unsigned)length), objName,
(overflow ? "..." : ""), Tcl_GetErrorLine(interp)));
}
@@ -1496,8 +1496,8 @@ TclOODefineClassObjCmd(
TclOODeleteDescendants(interp, oPtr);
oPtr->flags &= ~DONT_DELETE;
TclOOReleaseClassContents(interp, oPtr);
- ckfree(oPtr->classPtr);
- oPtr->classPtr = NULL;
+ Tcl_Free(oPtr->classPtr);
+ oPtr->classPtr = NULL;
} else if (!wasClass && willBeClass) {
TclOOAllocClass(interp, oPtr);
}
@@ -1532,7 +1532,7 @@ TclOODefineConstructorObjCmd(
Object *oPtr;
Class *clsPtr;
Tcl_Method method;
- int bodyLength;
+ size_t bodyLength;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 1, objv, "arguments body");
@@ -1550,7 +1550,7 @@ TclOODefineConstructorObjCmd(
}
clsPtr = oPtr->classPtr;
- TclGetStringFromObj(objv[2], &bodyLength);
+ (void)TclGetStringFromObj(objv[2], &bodyLength);
if (bodyLength > 0) {
/*
* Create the method structure.
@@ -1638,7 +1638,7 @@ TclOODefineDefnNsObjCmd(
&kind) != TCL_OK) {
return TCL_ERROR;
}
- if (!Tcl_GetString(objv[objc - 1])[0]) {
+ if (!TclGetString(objv[objc - 1])[0]) {
nsNamePtr = NULL;
} else {
nsPtr = GetNamespaceInOuterContext(interp, objv[objc - 1]);
@@ -1743,7 +1743,7 @@ TclOODefineDestructorObjCmd(
Object *oPtr;
Class *clsPtr;
Tcl_Method method;
- int bodyLength;
+ size_t bodyLength;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "body");
@@ -1756,7 +1756,7 @@ TclOODefineDestructorObjCmd(
}
clsPtr = oPtr->classPtr;
- TclGetStringFromObj(objv[1], &bodyLength);
+ (void)TclGetStringFromObj(objv[1], &bodyLength);
if (bodyLength > 0) {
/*
* Create the method structure.
@@ -1841,7 +1841,7 @@ TclOODefineExportObjCmd(
if (isInstanceExport) {
if (!oPtr->methodsPtr) {
- oPtr->methodsPtr = ckalloc(sizeof(Tcl_HashTable));
+ oPtr->methodsPtr = Tcl_Alloc(sizeof(Tcl_HashTable));
Tcl_InitObjHashTable(oPtr->methodsPtr);
oPtr->flags &= ~USE_CLASS_CACHE;
}
@@ -1853,7 +1853,7 @@ TclOODefineExportObjCmd(
}
if (isNew) {
- mPtr = ckalloc(sizeof(Method));
+ mPtr = Tcl_Alloc(sizeof(Method));
memset(mPtr, 0, sizeof(Method));
mPtr->refCount = 1;
mPtr->namePtr = objv[i];
@@ -2154,7 +2154,7 @@ TclOODefineUnexportObjCmd(
if (isInstanceUnexport) {
if (!oPtr->methodsPtr) {
- oPtr->methodsPtr = ckalloc(sizeof(Tcl_HashTable));
+ oPtr->methodsPtr = Tcl_Alloc(sizeof(Tcl_HashTable));
Tcl_InitObjHashTable(oPtr->methodsPtr);
oPtr->flags &= ~USE_CLASS_CACHE;
}
@@ -2166,7 +2166,7 @@ TclOODefineUnexportObjCmd(
}
if (isNew) {
- mPtr = ckalloc(sizeof(Method));
+ mPtr = Tcl_Alloc(sizeof(Method));
memset(mPtr, 0, sizeof(Method));
mPtr->refCount = 1;
mPtr->namePtr = objv[i];
@@ -2575,7 +2575,7 @@ ClassSuperSet(
* Allocate some working space.
*/
- superclasses = (Class **) ckalloc(sizeof(Class *) * superc);
+ superclasses = (Class **) Tcl_Alloc(sizeof(Class *) * superc);
/*
* Parse the arguments to get the class to use as superclasses.
@@ -2585,7 +2585,7 @@ ClassSuperSet(
*/
if (superc == 0) {
- superclasses = ckrealloc(superclasses, sizeof(Class *));
+ superclasses = Tcl_Realloc(superclasses, sizeof(Class *));
if (TclOOIsReachable(oPtr->fPtr->classCls, oPtr->classPtr)) {
superclasses[0] = oPtr->fPtr->classCls;
} else {
@@ -2618,7 +2618,7 @@ ClassSuperSet(
for (; i > 0; i--) {
TclOODecrRefCount(superclasses[i]->thisPtr);
}
- ckfree(superclasses);
+ Tcl_Free(superclasses);
return TCL_ERROR;
}
@@ -2643,7 +2643,7 @@ ClassSuperSet(
TclOORemoveFromSubclasses(oPtr->classPtr, superPtr);
TclOODecrRefCount(superPtr->thisPtr);
}
- ckfree(oPtr->classPtr->superclasses.list);
+ Tcl_Free(oPtr->classPtr->superclasses.list);
}
oPtr->classPtr->superclasses.list = superclasses;
oPtr->classPtr->superclasses.num = superc;
diff --git a/generic/tclOOInfo.c b/generic/tclOOInfo.c
index 99918ae..3446392 100644
--- a/generic/tclOOInfo.c
+++ b/generic/tclOOInfo.c
@@ -612,7 +612,7 @@ InfoObjectMethodsCmd(
Tcl_NewStringObj(names[i], -1));
}
if (numNames > 0) {
- ckfree(names);
+ Tcl_Free((void *)names);
}
} else if (oPtr->methodsPtr) {
FOREACH_HASH(namePtr, mPtr, oPtr->methodsPtr) {
@@ -816,7 +816,7 @@ InfoObjectVariablesCmd(
return TCL_ERROR;
}
if (objc == 3) {
- if (strcmp("-private", Tcl_GetString(objv[2])) != 0) {
+ if (strcmp("-private", TclGetString(objv[2])) != 0) {
return TCL_ERROR;
}
isPrivate = 1;
@@ -1366,7 +1366,7 @@ InfoClassMethodsCmd(
Tcl_NewStringObj(names[i], -1));
}
if (numNames > 0) {
- ckfree(names);
+ Tcl_Free((void *)names);
}
} else {
FOREACH_HASH_DECLS;
@@ -1595,7 +1595,7 @@ InfoClassVariablesCmd(
return TCL_ERROR;
}
if (objc == 3) {
- if (strcmp("-private", Tcl_GetString(objv[2])) != 0) {
+ if (strcmp("-private", TclGetString(objv[2])) != 0) {
return TCL_ERROR;
}
isPrivate = 1;
diff --git a/generic/tclOOInt.h b/generic/tclOOInt.h
index 1f44ef8..fd1b051 100644
--- a/generic/tclOOInt.h
+++ b/generic/tclOOInt.h
@@ -46,7 +46,7 @@ typedef struct Method {
/* The type of method. If NULL, this is a
* special flag record which is just used for
* the setting of the flags field. */
- int refCount;
+ size_t refCount;
void *clientData; /* Type-specific data. */
Tcl_Obj *namePtr; /* Name of the method. */
struct Object *declaringObjectPtr;
@@ -65,12 +65,12 @@ typedef struct Method {
* tuned in their behaviour.
*/
-typedef int (TclOO_PreCallProc)(ClientData clientData, Tcl_Interp *interp,
+typedef int (TclOO_PreCallProc)(void *clientData, Tcl_Interp *interp,
Tcl_ObjectContext context, Tcl_CallFrame *framePtr, int *isFinished);
-typedef int (TclOO_PostCallProc)(ClientData clientData, Tcl_Interp *interp,
+typedef int (TclOO_PostCallProc)(void *clientData, Tcl_Interp *interp,
Tcl_ObjectContext context, Tcl_Namespace *namespacePtr, int result);
-typedef void (TclOO_PmCDDeleteProc)(ClientData clientData);
-typedef ClientData (TclOO_PmCDCloneProc)(ClientData clientData);
+typedef void (TclOO_PmCDDeleteProc)(void *clientData);
+typedef void *(TclOO_PmCDCloneProc)(void *clientData);
/*
* Procedure-like methods have the following extra information.
@@ -83,7 +83,7 @@ typedef struct ProcedureMethod {
* includes the argument definition and the
* body bytecodes. */
int flags; /* Flags to control features. */
- int refCount;
+ size_t refCount;
void *clientData;
TclOO_PmCDDeleteProc *deleteClientdataProc;
TclOO_PmCDCloneProc *cloneClientdataProc;
@@ -184,18 +184,18 @@ typedef struct Object {
struct Class *classPtr; /* This is non-NULL for all classes, and NULL
* for everything else. It points to the class
* structure. */
- int refCount; /* Number of strong references to this object.
+ size_t refCount; /* Number of strong references to this object.
* Note that there may be many more weak
* references; this mechanism exists to
* avoid Tcl_Preserve. */
int flags;
- int creationEpoch; /* Unique value to make comparisons of objects
+ size_t creationEpoch; /* Unique value to make comparisons of objects
* easier. */
- int epoch; /* Per-object epoch, incremented when the way
+ size_t epoch; /* Per-object epoch, incremented when the way
* an object should resolve call chains is
* changed. */
Tcl_HashTable *metadataPtr; /* Mapping from pointers to metadata type to
- * the ClientData values that are the values
+ * the void *values that are the values
* of each piece of attached metadata. This
* field starts out as NULL and is only
* allocated if metadata is attached. */
@@ -286,7 +286,7 @@ typedef struct Class {
Method *destructorPtr; /* Method record of the class destructor (if
* any). */
Tcl_HashTable *metadataPtr; /* Mapping from pointers to metadata type to
- * the ClientData values that are the values
+ * the void *values that are the values
* of each piece of attached metadata. This
* field starts out as NULL and is only
* allocated if metadata is attached. */
@@ -332,7 +332,7 @@ typedef struct Class {
*/
typedef struct ThreadLocalData {
- int nsCount; /* Master epoch counter is used for keeping
+ size_t nsCount; /* Master epoch counter is used for keeping
* the values used in Tcl_Obj internal
* representations sane. Must be thread-local
* because Tcl_Objs can cross interpreter
@@ -356,7 +356,7 @@ typedef struct Foundation {
Tcl_Namespace *helpersNs; /* Namespace containing the commands that are
* only valid when executing inside a
* procedural method. */
- int epoch; /* Used to invalidate method chains when the
+ size_t epoch; /* Used to invalidate method chains when the
* class structure changes. */
ThreadLocalData *tsdPtr; /* Counter so we can allocate a unique
* namespace to each object. */
@@ -390,15 +390,15 @@ struct MInvoke {
};
typedef struct CallChain {
- int objectCreationEpoch; /* The object's creation epoch. Note that the
+ size_t objectCreationEpoch; /* The object's creation epoch. Note that the
* object reference is not stored in the call
* chain; it is in the call context. */
- int objectEpoch; /* Local (object structure) epoch counter
+ size_t objectEpoch; /* Local (object structure) epoch counter
* snapshot. */
- int epoch; /* Global (class structure) epoch counter
+ size_t epoch; /* Global (class structure) epoch counter
* snapshot. */
int flags; /* Assorted flags, see below. */
- int refCount; /* Reference count. */
+ size_t refCount; /* Reference count. */
int numChain; /* Size of the call chain. */
struct MInvoke *chain; /* Array of call chain entries. May point to
* staticChain if the number of entries is
@@ -450,64 +450,88 @@ typedef struct {
*/
MODULE_SCOPE int TclOOInit(Tcl_Interp *interp);
-MODULE_SCOPE int TclOODefineObjCmd(ClientData clientData,
+MODULE_SCOPE int TclOODefineObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const *objv);
-MODULE_SCOPE int TclOOObjDefObjCmd(ClientData clientData,
+MODULE_SCOPE int TclOOObjDefObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const *objv);
-MODULE_SCOPE int TclOODefineConstructorObjCmd(ClientData clientData,
+MODULE_SCOPE int TclOODefineConstructorObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const *objv);
-MODULE_SCOPE int TclOODefineDefnNsObjCmd(ClientData clientData,
+MODULE_SCOPE int TclOODefineDeleteMethodObjCmd(void *clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const *objv);
+MODULE_SCOPE int TclOODefineDestructorObjCmd(void *clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const *objv);
+MODULE_SCOPE int TclOODefineExportObjCmd(void *clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const *objv);
+MODULE_SCOPE int TclOODefineForwardObjCmd(void *clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const *objv);
+MODULE_SCOPE int TclOODefineMethodObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const *objv);
-MODULE_SCOPE int TclOODefineDeleteMethodObjCmd(ClientData clientData,
+MODULE_SCOPE int TclOODefineRenameMethodObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const *objv);
-MODULE_SCOPE int TclOODefineDestructorObjCmd(ClientData clientData,
+MODULE_SCOPE int TclOODefineUnexportObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const *objv);
-MODULE_SCOPE int TclOODefineExportObjCmd(ClientData clientData,
+MODULE_SCOPE int TclOODefineClassObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const *objv);
-MODULE_SCOPE int TclOODefineForwardObjCmd(ClientData clientData,
+MODULE_SCOPE int TclOODefineSelfObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const *objv);
-MODULE_SCOPE int TclOODefineMethodObjCmd(ClientData clientData,
+MODULE_SCOPE int TclOODefineObjSelfObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const *objv);
-MODULE_SCOPE int TclOODefineRenameMethodObjCmd(ClientData clientData,
+MODULE_SCOPE int TclOOUnknownDefinition(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const *objv);
-MODULE_SCOPE int TclOODefineUnexportObjCmd(ClientData clientData,
+MODULE_SCOPE int TclOOCopyObjectCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const *objv);
-MODULE_SCOPE int TclOODefineClassObjCmd(ClientData clientData,
+MODULE_SCOPE int TclOONextObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const *objv);
-MODULE_SCOPE int TclOODefineSelfObjCmd(ClientData clientData,
+MODULE_SCOPE int TclOONextToObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const *objv);
-MODULE_SCOPE int TclOODefineObjSelfObjCmd(ClientData clientData,
+MODULE_SCOPE int TclOODefineUnexportObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const *objv);
-MODULE_SCOPE int TclOODefinePrivateObjCmd(ClientData clientData,
+MODULE_SCOPE int TclOODefineClassObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const *objv);
-MODULE_SCOPE int TclOOUnknownDefinition(ClientData clientData,
+MODULE_SCOPE int TclOODefineSelfObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const *objv);
-MODULE_SCOPE int TclOOCopyObjectCmd(ClientData clientData,
+MODULE_SCOPE int TclOODefineObjSelfObjCmd(void *clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const *objv);
+MODULE_SCOPE int TclOODefinePrivateObjCmd(void *clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const *objv);
+MODULE_SCOPE int TclOOUnknownDefinition(void *clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const *objv);
+MODULE_SCOPE int TclOOCopyObjectCmd(void *clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const *objv);
+MODULE_SCOPE int TclOODefineDefnNsObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const *objv);
-MODULE_SCOPE int TclOONextObjCmd(ClientData clientData,
+MODULE_SCOPE int TclOONextObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const *objv);
-MODULE_SCOPE int TclOONextToObjCmd(ClientData clientData,
+MODULE_SCOPE int TclOONextToObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const *objv);
-MODULE_SCOPE int TclOOSelfObjCmd(ClientData clientData,
+MODULE_SCOPE int TclOOSelfObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const *objv);
@@ -515,31 +539,31 @@ MODULE_SCOPE int TclOOSelfObjCmd(ClientData clientData,
* Method implementations (in tclOOBasic.c).
*/
-MODULE_SCOPE int TclOO_Class_Constructor(ClientData clientData,
+MODULE_SCOPE int TclOO_Class_Constructor(void *clientData,
Tcl_Interp *interp, Tcl_ObjectContext context,
int objc, Tcl_Obj *const *objv);
-MODULE_SCOPE int TclOO_Class_Create(ClientData clientData,
+MODULE_SCOPE int TclOO_Class_Create(void *clientData,
Tcl_Interp *interp, Tcl_ObjectContext context,
int objc, Tcl_Obj *const *objv);
-MODULE_SCOPE int TclOO_Class_CreateNs(ClientData clientData,
+MODULE_SCOPE int TclOO_Class_CreateNs(void *clientData,
Tcl_Interp *interp, Tcl_ObjectContext context,
int objc, Tcl_Obj *const *objv);
-MODULE_SCOPE int TclOO_Class_New(ClientData clientData,
+MODULE_SCOPE int TclOO_Class_New(void *clientData,
Tcl_Interp *interp, Tcl_ObjectContext context,
int objc, Tcl_Obj *const *objv);
-MODULE_SCOPE int TclOO_Object_Destroy(ClientData clientData,
+MODULE_SCOPE int TclOO_Object_Destroy(void *clientData,
Tcl_Interp *interp, Tcl_ObjectContext context,
int objc, Tcl_Obj *const *objv);
-MODULE_SCOPE int TclOO_Object_Eval(ClientData clientData,
+MODULE_SCOPE int TclOO_Object_Eval(void *clientData,
Tcl_Interp *interp, Tcl_ObjectContext context,
int objc, Tcl_Obj *const *objv);
-MODULE_SCOPE int TclOO_Object_LinkVar(ClientData clientData,
+MODULE_SCOPE int TclOO_Object_LinkVar(void *clientData,
Tcl_Interp *interp, Tcl_ObjectContext context,
int objc, Tcl_Obj *const *objv);
-MODULE_SCOPE int TclOO_Object_Unknown(ClientData clientData,
+MODULE_SCOPE int TclOO_Object_Unknown(void *clientData,
Tcl_Interp *interp, Tcl_ObjectContext context,
int objc, Tcl_Obj *const *objv);
-MODULE_SCOPE int TclOO_Object_VarName(ClientData clientData,
+MODULE_SCOPE int TclOO_Object_VarName(void *clientData,
Tcl_Interp *interp, Tcl_ObjectContext context,
int objc, Tcl_Obj *const *objv);
@@ -589,7 +613,7 @@ MODULE_SCOPE int TclOOGetSortedMethodList(Object *oPtr,
const char ***stringsPtr);
MODULE_SCOPE int TclOOInit(Tcl_Interp *interp);
MODULE_SCOPE void TclOOInitInfo(Tcl_Interp *interp);
-MODULE_SCOPE int TclOOInvokeContext(ClientData clientData,
+MODULE_SCOPE int TclOOInvokeContext(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
MODULE_SCOPE int TclNRObjectContextInvokeNext(Tcl_Interp *interp,
@@ -671,9 +695,9 @@ MODULE_SCOPE void TclOOSetupVariableResolver(Tcl_Namespace *nsPtr);
#undef DUPLICATE /* prevent possible conflict with definition in WINAPI nb30.h */
#define DUPLICATE(target,source,type) \
do { \
- unsigned len = sizeof(type) * ((target).num=(source).num);\
+ size_t len = sizeof(type) * ((target).num=(source).num);\
if (len != 0) { \
- memcpy(((target).list=(type*)ckalloc(len)), (source).list, len); \
+ memcpy(((target).list=(type*)Tcl_Alloc(len)), (source).list, len); \
} else { \
(target).list = NULL; \
} \
diff --git a/generic/tclOOIntDecls.h b/generic/tclOOIntDecls.h
index 74a8d81..6a5cfd3 100644
--- a/generic/tclOOIntDecls.h
+++ b/generic/tclOOIntDecls.h
@@ -22,14 +22,14 @@ TCLAPI Tcl_Method TclOOMakeProcInstanceMethod(Tcl_Interp *interp,
Object *oPtr, int flags, Tcl_Obj *nameObj,
Tcl_Obj *argsObj, Tcl_Obj *bodyObj,
const Tcl_MethodType *typePtr,
- ClientData clientData, Proc **procPtrPtr);
+ void *clientData, Proc **procPtrPtr);
/* 2 */
TCLAPI Tcl_Method TclOOMakeProcMethod(Tcl_Interp *interp,
Class *clsPtr, int flags, Tcl_Obj *nameObj,
const char *namePtr, Tcl_Obj *argsObj,
Tcl_Obj *bodyObj,
const Tcl_MethodType *typePtr,
- ClientData clientData, Proc **procPtrPtr);
+ void *clientData, Proc **procPtrPtr);
/* 3 */
TCLAPI Method * TclOONewProcInstanceMethod(Tcl_Interp *interp,
Object *oPtr, int flags, Tcl_Obj *nameObj,
@@ -59,19 +59,19 @@ TCLAPI Tcl_Method TclOONewProcInstanceMethodEx(Tcl_Interp *interp,
Tcl_Object oPtr,
TclOO_PreCallProc *preCallPtr,
TclOO_PostCallProc *postCallPtr,
- ProcErrorProc *errProc,
- ClientData clientData, Tcl_Obj *nameObj,
- Tcl_Obj *argsObj, Tcl_Obj *bodyObj,
- int flags, void **internalTokenPtr);
+ ProcErrorProc *errProc, void *clientData,
+ Tcl_Obj *nameObj, Tcl_Obj *argsObj,
+ Tcl_Obj *bodyObj, int flags,
+ void **internalTokenPtr);
/* 10 */
TCLAPI Tcl_Method TclOONewProcMethodEx(Tcl_Interp *interp,
Tcl_Class clsPtr,
TclOO_PreCallProc *preCallPtr,
TclOO_PostCallProc *postCallPtr,
- ProcErrorProc *errProc,
- ClientData clientData, Tcl_Obj *nameObj,
- Tcl_Obj *argsObj, Tcl_Obj *bodyObj,
- int flags, void **internalTokenPtr);
+ ProcErrorProc *errProc, void *clientData,
+ Tcl_Obj *nameObj, Tcl_Obj *argsObj,
+ Tcl_Obj *bodyObj, int flags,
+ void **internalTokenPtr);
/* 11 */
TCLAPI int TclOOInvokeObject(Tcl_Interp *interp,
Tcl_Object object, Tcl_Class startCls,
@@ -97,16 +97,16 @@ typedef struct TclOOIntStubs {
void *hooks;
Tcl_Object (*tclOOGetDefineCmdContext) (Tcl_Interp *interp); /* 0 */
- Tcl_Method (*tclOOMakeProcInstanceMethod) (Tcl_Interp *interp, Object *oPtr, int flags, Tcl_Obj *nameObj, Tcl_Obj *argsObj, Tcl_Obj *bodyObj, const Tcl_MethodType *typePtr, ClientData clientData, Proc **procPtrPtr); /* 1 */
- Tcl_Method (*tclOOMakeProcMethod) (Tcl_Interp *interp, Class *clsPtr, int flags, Tcl_Obj *nameObj, const char *namePtr, Tcl_Obj *argsObj, Tcl_Obj *bodyObj, const Tcl_MethodType *typePtr, ClientData clientData, Proc **procPtrPtr); /* 2 */
+ Tcl_Method (*tclOOMakeProcInstanceMethod) (Tcl_Interp *interp, Object *oPtr, int flags, Tcl_Obj *nameObj, Tcl_Obj *argsObj, Tcl_Obj *bodyObj, const Tcl_MethodType *typePtr, void *clientData, Proc **procPtrPtr); /* 1 */
+ Tcl_Method (*tclOOMakeProcMethod) (Tcl_Interp *interp, Class *clsPtr, int flags, Tcl_Obj *nameObj, const char *namePtr, Tcl_Obj *argsObj, Tcl_Obj *bodyObj, const Tcl_MethodType *typePtr, void *clientData, Proc **procPtrPtr); /* 2 */
Method * (*tclOONewProcInstanceMethod) (Tcl_Interp *interp, Object *oPtr, int flags, Tcl_Obj *nameObj, Tcl_Obj *argsObj, Tcl_Obj *bodyObj, ProcedureMethod **pmPtrPtr); /* 3 */
Method * (*tclOONewProcMethod) (Tcl_Interp *interp, Class *clsPtr, int flags, Tcl_Obj *nameObj, Tcl_Obj *argsObj, Tcl_Obj *bodyObj, ProcedureMethod **pmPtrPtr); /* 4 */
int (*tclOOObjectCmdCore) (Object *oPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv, int publicOnly, Class *startCls); /* 5 */
int (*tclOOIsReachable) (Class *targetPtr, Class *startPtr); /* 6 */
Method * (*tclOONewForwardMethod) (Tcl_Interp *interp, Class *clsPtr, int isPublic, Tcl_Obj *nameObj, Tcl_Obj *prefixObj); /* 7 */
Method * (*tclOONewForwardInstanceMethod) (Tcl_Interp *interp, Object *oPtr, int isPublic, Tcl_Obj *nameObj, Tcl_Obj *prefixObj); /* 8 */
- Tcl_Method (*tclOONewProcInstanceMethodEx) (Tcl_Interp *interp, Tcl_Object oPtr, TclOO_PreCallProc *preCallPtr, TclOO_PostCallProc *postCallPtr, ProcErrorProc *errProc, ClientData clientData, Tcl_Obj *nameObj, Tcl_Obj *argsObj, Tcl_Obj *bodyObj, int flags, void **internalTokenPtr); /* 9 */
- Tcl_Method (*tclOONewProcMethodEx) (Tcl_Interp *interp, Tcl_Class clsPtr, TclOO_PreCallProc *preCallPtr, TclOO_PostCallProc *postCallPtr, ProcErrorProc *errProc, ClientData clientData, Tcl_Obj *nameObj, Tcl_Obj *argsObj, Tcl_Obj *bodyObj, int flags, void **internalTokenPtr); /* 10 */
+ Tcl_Method (*tclOONewProcInstanceMethodEx) (Tcl_Interp *interp, Tcl_Object oPtr, TclOO_PreCallProc *preCallPtr, TclOO_PostCallProc *postCallPtr, ProcErrorProc *errProc, void *clientData, Tcl_Obj *nameObj, Tcl_Obj *argsObj, Tcl_Obj *bodyObj, int flags, void **internalTokenPtr); /* 9 */
+ Tcl_Method (*tclOONewProcMethodEx) (Tcl_Interp *interp, Tcl_Class clsPtr, TclOO_PreCallProc *preCallPtr, TclOO_PostCallProc *postCallPtr, ProcErrorProc *errProc, void *clientData, Tcl_Obj *nameObj, Tcl_Obj *argsObj, Tcl_Obj *bodyObj, int flags, void **internalTokenPtr); /* 10 */
int (*tclOOInvokeObject) (Tcl_Interp *interp, Tcl_Object object, Tcl_Class startCls, int publicPrivate, int objc, Tcl_Obj *const *objv); /* 11 */
void (*tclOOObjectSetFilters) (Object *oPtr, int numFilters, Tcl_Obj *const *filters); /* 12 */
void (*tclOOClassSetFilters) (Tcl_Interp *interp, Class *classPtr, int numFilters, Tcl_Obj *const *filters); /* 13 */
diff --git a/generic/tclOOMethod.c b/generic/tclOOMethod.c
index 32dd3c7..a6adf55 100644
--- a/generic/tclOOMethod.c
+++ b/generic/tclOOMethod.c
@@ -155,19 +155,19 @@ Tcl_NewInstanceMethod(
int isNew;
if (nameObj == NULL) {
- mPtr = ckalloc(sizeof(Method));
+ mPtr = Tcl_Alloc(sizeof(Method));
mPtr->namePtr = NULL;
mPtr->refCount = 1;
goto populate;
}
if (!oPtr->methodsPtr) {
- oPtr->methodsPtr = ckalloc(sizeof(Tcl_HashTable));
+ oPtr->methodsPtr = Tcl_Alloc(sizeof(Tcl_HashTable));
Tcl_InitObjHashTable(oPtr->methodsPtr);
oPtr->flags &= ~USE_CLASS_CACHE;
}
hPtr = Tcl_CreateHashEntry(oPtr->methodsPtr, (char *) nameObj, &isNew);
if (isNew) {
- mPtr = ckalloc(sizeof(Method));
+ mPtr = Tcl_Alloc(sizeof(Method));
mPtr->namePtr = nameObj;
mPtr->refCount = 1;
Tcl_IncrRefCount(nameObj);
@@ -227,14 +227,14 @@ Tcl_NewMethod(
int isNew;
if (nameObj == NULL) {
- mPtr = ckalloc(sizeof(Method));
+ mPtr = Tcl_Alloc(sizeof(Method));
mPtr->namePtr = NULL;
mPtr->refCount = 1;
goto populate;
}
hPtr = Tcl_CreateHashEntry(&clsPtr->classMethods, (char *)nameObj,&isNew);
if (isNew) {
- mPtr = ckalloc(sizeof(Method));
+ mPtr = Tcl_Alloc(sizeof(Method));
mPtr->refCount = 1;
mPtr->namePtr = nameObj;
Tcl_IncrRefCount(nameObj);
@@ -286,7 +286,7 @@ TclOODelMethodRef(
Tcl_DecrRefCount(mPtr->namePtr);
}
- ckfree(mPtr);
+ Tcl_Free(mPtr);
}
}
@@ -350,7 +350,7 @@ TclOONewProcInstanceMethod(
if (Tcl_ListObjLength(interp, argsObj, &argsLen) != TCL_OK) {
return NULL;
}
- pmPtr = ckalloc(sizeof(ProcedureMethod));
+ pmPtr = Tcl_Alloc(sizeof(ProcedureMethod));
memset(pmPtr, 0, sizeof(ProcedureMethod));
pmPtr->version = TCLOO_PROCEDURE_METHOD_VERSION;
pmPtr->flags = flags & USE_DECLARER_NS;
@@ -359,7 +359,7 @@ TclOONewProcInstanceMethod(
method = TclOOMakeProcInstanceMethod(interp, oPtr, flags, nameObj,
argsObj, bodyObj, &procMethodType, pmPtr, &pmPtr->procPtr);
if (method == NULL) {
- ckfree(pmPtr);
+ Tcl_Free(pmPtr);
} else if (pmPtrPtr != NULL) {
*pmPtrPtr = pmPtr;
}
@@ -411,7 +411,7 @@ TclOONewProcMethod(
procName = (nameObj==NULL ? "<constructor>" : TclGetString(nameObj));
}
- pmPtr = ckalloc(sizeof(ProcedureMethod));
+ pmPtr = Tcl_Alloc(sizeof(ProcedureMethod));
memset(pmPtr, 0, sizeof(ProcedureMethod));
pmPtr->version = TCLOO_PROCEDURE_METHOD_VERSION;
pmPtr->flags = flags & USE_DECLARER_NS;
@@ -424,7 +424,7 @@ TclOONewProcMethod(
Tcl_DecrRefCount(argsObj);
}
if (method == NULL) {
- ckfree(pmPtr);
+ Tcl_Free(pmPtr);
} else if (pmPtrPtr != NULL) {
*pmPtrPtr = pmPtr;
}
@@ -505,12 +505,12 @@ TclOOMakeProcInstanceMethod(
if (context.line
&& (context.nline >= 4) && (context.line[3] >= 0)) {
int isNew;
- CmdFrame *cfPtr = ckalloc(sizeof(CmdFrame));
+ CmdFrame *cfPtr = Tcl_Alloc(sizeof(CmdFrame));
Tcl_HashEntry *hPtr;
cfPtr->level = -1;
cfPtr->type = context.type;
- cfPtr->line = ckalloc(sizeof(int));
+ cfPtr->line = Tcl_Alloc(sizeof(int));
cfPtr->line[0] = context.line[3];
cfPtr->nline = 1;
cfPtr->framePtr = NULL;
@@ -618,12 +618,12 @@ TclOOMakeProcMethod(
if (context.line
&& (context.nline >= 4) && (context.line[3] >= 0)) {
int isNew;
- CmdFrame *cfPtr = ckalloc(sizeof(CmdFrame));
+ CmdFrame *cfPtr = Tcl_Alloc(sizeof(CmdFrame));
Tcl_HashEntry *hPtr;
cfPtr->level = -1;
cfPtr->type = context.type;
- cfPtr->line = ckalloc(sizeof(int));
+ cfPtr->line = Tcl_Alloc(sizeof(int));
cfPtr->line[0] = context.line[3];
cfPtr->nline = 1;
cfPtr->framePtr = NULL;
@@ -993,7 +993,8 @@ ProcedureMethodCompiledVarConnect(
Tcl_Obj *variableObj;
PrivateVariableMapping *privateVar;
Tcl_HashEntry *hPtr;
- int i, isNew, cacheIt, varLen, len;
+ int i, isNew, cacheIt;
+ size_t varLen, len;
const char *match, *varName;
/*
@@ -1100,7 +1101,7 @@ ProcedureMethodCompiledVarDelete(
TclCleanupVar((Var *) infoPtr->cachedObjectVar, NULL);
}
Tcl_DecrRefCount(infoPtr->variableObj);
- ckfree(infoPtr);
+ Tcl_Free(infoPtr);
}
static int
@@ -1119,13 +1120,13 @@ ProcedureMethodCompiledVarResolver(
* which look like array accesses. Both will lead us astray.
*/
- if (strstr(Tcl_GetString(variableObj), "::") != NULL ||
- Tcl_StringMatch(Tcl_GetString(variableObj), "*(*)")) {
+ if (strstr(TclGetString(variableObj), "::") != NULL ||
+ Tcl_StringMatch(TclGetString(variableObj), "*(*)")) {
Tcl_DecrRefCount(variableObj);
return TCL_CONTINUE;
}
- infoPtr = ckalloc(sizeof(OOResVarInfo));
+ infoPtr = Tcl_Alloc(sizeof(OOResVarInfo));
infoPtr->info.fetchProc = ProcedureMethodCompiledVarConnect;
infoPtr->info.deleteProc = ProcedureMethodCompiledVarDelete;
infoPtr->cachedObjectVar = NULL;
@@ -1178,14 +1179,14 @@ RenderDeclarerName(
#define LIMIT 60
#define ELLIPSIFY(str,len) \
- ((len) > LIMIT ? LIMIT : (len)), (str), ((len) > LIMIT ? "..." : "")
+ ((len) > LIMIT ? LIMIT : (int)(len)), (str), ((len) > LIMIT ? "..." : "")
static void
MethodErrorHandler(
Tcl_Interp *interp,
Tcl_Obj *methodNameObj)
{
- int nameLen, objectNameLen;
+ size_t nameLen, objectNameLen;
CallContext *contextPtr = ((Interp *) interp)->varFramePtr->clientData;
Method *mPtr = contextPtr->callPtr->chain[contextPtr->index].mPtr;
const char *objectName, *kindName, *methodName =
@@ -1203,7 +1204,7 @@ MethodErrorHandler(
kindName = "class";
}
- objectName = Tcl_GetStringFromObj(TclOOObjectName(interp, declarerPtr),
+ objectName = TclGetStringFromObj(TclOOObjectName(interp, declarerPtr),
&objectNameLen);
Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
"\n (%s \"%.*s%s\" method \"%.*s%s\" line %d)",
@@ -1220,7 +1221,7 @@ ConstructorErrorHandler(
Method *mPtr = contextPtr->callPtr->chain[contextPtr->index].mPtr;
Object *declarerPtr;
const char *objectName, *kindName;
- int objectNameLen;
+ size_t objectNameLen;
if (mPtr->declaringObjectPtr != NULL) {
declarerPtr = mPtr->declaringObjectPtr;
@@ -1233,7 +1234,7 @@ ConstructorErrorHandler(
kindName = "class";
}
- objectName = Tcl_GetStringFromObj(TclOOObjectName(interp, declarerPtr),
+ objectName = TclGetStringFromObj(TclOOObjectName(interp, declarerPtr),
&objectNameLen);
Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
"\n (%s \"%.*s%s\" constructor line %d)", kindName,
@@ -1249,7 +1250,7 @@ DestructorErrorHandler(
Method *mPtr = contextPtr->callPtr->chain[contextPtr->index].mPtr;
Object *declarerPtr;
const char *objectName, *kindName;
- int objectNameLen;
+ size_t objectNameLen;
if (mPtr->declaringObjectPtr != NULL) {
declarerPtr = mPtr->declaringObjectPtr;
@@ -1262,7 +1263,7 @@ DestructorErrorHandler(
kindName = "class";
}
- objectName = Tcl_GetStringFromObj(TclOOObjectName(interp, declarerPtr),
+ objectName = TclGetStringFromObj(TclOOObjectName(interp, declarerPtr),
&objectNameLen);
Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
"\n (%s \"%.*s%s\" destructor line %d)", kindName,
@@ -1287,7 +1288,7 @@ DeleteProcedureMethodRecord(
if (pmPtr->deleteClientdataProc) {
pmPtr->deleteClientdataProc(pmPtr->clientData);
}
- ckfree(pmPtr);
+ Tcl_Free(pmPtr);
}
static void
@@ -1337,7 +1338,7 @@ CloneProcedureMethod(
*/
bodyObj = Tcl_DuplicateObj(pmPtr->procPtr->bodyPtr);
- Tcl_GetString(bodyObj);
+ TclGetString(bodyObj);
Tcl_StoreIntRep(pmPtr->procPtr->bodyPtr, &tclByteCodeType, NULL);
/*
@@ -1345,7 +1346,7 @@ CloneProcedureMethod(
* record.
*/
- pm2Ptr = ckalloc(sizeof(ProcedureMethod));
+ pm2Ptr = Tcl_Alloc(sizeof(ProcedureMethod));
memcpy(pm2Ptr, pmPtr, sizeof(ProcedureMethod));
pm2Ptr->refCount = 1;
Tcl_IncrRefCount(argsObj);
@@ -1354,7 +1355,7 @@ CloneProcedureMethod(
&pm2Ptr->procPtr) != TCL_OK) {
Tcl_DecrRefCount(argsObj);
Tcl_DecrRefCount(bodyObj);
- ckfree(pm2Ptr);
+ Tcl_Free(pm2Ptr);
return TCL_ERROR;
}
Tcl_DecrRefCount(argsObj);
@@ -1399,7 +1400,7 @@ TclOONewForwardInstanceMethod(
return NULL;
}
- fmPtr = ckalloc(sizeof(ForwardMethod));
+ fmPtr = Tcl_Alloc(sizeof(ForwardMethod));
fmPtr->prefixObj = prefixObj;
Tcl_IncrRefCount(prefixObj);
return (Method *) Tcl_NewInstanceMethod(interp, (Tcl_Object) oPtr,
@@ -1438,7 +1439,7 @@ TclOONewForwardMethod(
return NULL;
}
- fmPtr = ckalloc(sizeof(ForwardMethod));
+ fmPtr = Tcl_Alloc(sizeof(ForwardMethod));
fmPtr->prefixObj = prefixObj;
Tcl_IncrRefCount(prefixObj);
return (Method *) Tcl_NewMethod(interp, (Tcl_Class) clsPtr, nameObj,
@@ -1519,7 +1520,7 @@ DeleteForwardMethod(
ForwardMethod *fmPtr = clientData;
Tcl_DecrRefCount(fmPtr->prefixObj);
- ckfree(fmPtr);
+ Tcl_Free(fmPtr);
}
static int
@@ -1529,7 +1530,7 @@ CloneForwardMethod(
void **newClientData)
{
ForwardMethod *fmPtr = clientData;
- ForwardMethod *fm2Ptr = ckalloc(sizeof(ForwardMethod));
+ ForwardMethod *fm2Ptr = Tcl_Alloc(sizeof(ForwardMethod));
fm2Ptr->prefixObj = fmPtr->prefixObj;
Tcl_IncrRefCount(fm2Ptr->prefixObj);
diff --git a/generic/tclObj.c b/generic/tclObj.c
index d329aba..42d8fde 100644
--- a/generic/tclObj.c
+++ b/generic/tclObj.c
@@ -58,7 +58,7 @@ char tclEmptyString = '\0';
* for sanity checking purposes.
*/
-typedef struct ObjData {
+typedef struct {
Tcl_Obj *objPtr; /* The pointer to the allocated Tcl_Obj. */
const char *file; /* The name of the source file calling this
* function; used for debugging. */
@@ -178,7 +178,7 @@ static Tcl_ThreadDataKey pendingObjDataKey;
#define PACK_BIGNUM(bignum, objPtr) \
if ((bignum).used > 0x7fff) { \
- mp_int *temp = (void *) ckalloc(sizeof(mp_int)); \
+ mp_int *temp = (void *) Tcl_Alloc(sizeof(mp_int)); \
*temp = bignum; \
(objPtr)->internalRep.twoPtrValue.ptr1 = temp; \
(objPtr)->internalRep.twoPtrValue.ptr2 = INT2PTR(-1); \
@@ -186,7 +186,7 @@ static Tcl_ThreadDataKey pendingObjDataKey;
if ((bignum).alloc > 0x7fff) { \
mp_shrink(&(bignum)); \
} \
- (objPtr)->internalRep.twoPtrValue.ptr1 = (void *) (bignum).dp; \
+ (objPtr)->internalRep.twoPtrValue.ptr1 = (bignum).dp; \
(objPtr)->internalRep.twoPtrValue.ptr2 = INT2PTR( ((bignum).sign << 30) \
| ((bignum).alloc << 15) | ((bignum).used)); \
}
@@ -200,9 +200,6 @@ static int SetDoubleFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr);
static int SetIntFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr);
static void UpdateStringOfDouble(Tcl_Obj *objPtr);
static void UpdateStringOfInt(Tcl_Obj *objPtr);
-#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 && !defined(TCL_WIDE_INT_IS_LONG)
-static void UpdateStringOfOldInt(Tcl_Obj *objPtr);
-#endif
static void FreeBignum(Tcl_Obj *objPtr);
static void DupBignum(Tcl_Obj *objPtr, Tcl_Obj *copyPtr);
static void UpdateStringOfBignum(Tcl_Obj *objPtr);
@@ -231,17 +228,8 @@ static int SetCmdNameFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr);
* implementations.
*/
-#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
-static const Tcl_ObjType oldBooleanType = {
- "boolean", /* name */
- NULL, /* freeIntRepProc */
- NULL, /* dupIntRepProc */
- NULL, /* updateStringProc */
- TclSetBooleanFromAny /* setFromAnyProc */
-};
-#endif
const Tcl_ObjType tclBooleanType = {
- "booleanString", /* name */
+ "boolean", /* name */
NULL, /* freeIntRepProc */
NULL, /* dupIntRepProc */
NULL, /* updateStringProc */
@@ -255,25 +243,12 @@ const Tcl_ObjType tclDoubleType = {
SetDoubleFromAny /* setFromAnyProc */
};
const Tcl_ObjType tclIntType = {
-#if defined(TCL_NO_DEPRECATED) || TCL_MAJOR_VERSION > 8 || defined(TCL_WIDE_INT_IS_LONG)
"int", /* name */
-#else
- "wideInt", /* name, keeping maximum compatibility with Tcl 8.6 on 32-bit platforms*/
-#endif
NULL, /* freeIntRepProc */
NULL, /* dupIntRepProc */
UpdateStringOfInt, /* updateStringProc */
SetIntFromAny /* setFromAnyProc */
};
-#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 && !defined(TCL_WIDE_INT_IS_LONG)
-static const Tcl_ObjType oldIntType = {
- "int", /* name */
- NULL, /* freeIntRepProc */
- NULL, /* dupIntRepProc */
- UpdateStringOfOldInt, /* updateStringProc */
- SetIntFromAny /* setFromAnyProc */
-};
-#endif
const Tcl_ObjType tclBignumType = {
"bignum", /* name */
FreeBignum, /* freeIntRepProc */
@@ -339,17 +314,17 @@ typedef struct ResolvedCmdName {
* reference (not the namespace that contains
* the referenced command). NULL if the name
* is fully qualified.*/
- unsigned long refNsId; /* refNsPtr's unique namespace id. Used to
+ size_t refNsId; /* refNsPtr's unique namespace id. Used to
* verify that refNsPtr is still valid (e.g.,
* it's possible that the cmd's containing
* namespace was deleted and a new one created
* at the same address). */
- unsigned int refNsCmdEpoch; /* Value of the referencing namespace's
+ size_t refNsCmdEpoch; /* Value of the referencing namespace's
* cmdRefEpoch when the pointer was cached.
* Before using the cached pointer, we check
* if the namespace's epoch was incremented;
* if so, this cached pointer is invalid. */
- unsigned int cmdEpoch; /* Value of the command's cmdEpoch when this
+ size_t cmdEpoch; /* Value of the command's cmdEpoch when this
* pointer was cached. Before using the cached
* pointer, we check if the cmd's epoch was
* incremented; if so, the cmd was renamed,
@@ -398,15 +373,6 @@ TclInitObjSubsystem(void)
Tcl_RegisterObjType(&tclRegexpType);
Tcl_RegisterObjType(&tclProcBodyType);
- /* For backward compatibility only ... */
-#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
- Tcl_RegisterObjType(&tclIntType);
-#if !defined(TCL_WIDE_INT_IS_LONG)
- Tcl_RegisterObjType(&oldIntType);
-#endif
- Tcl_RegisterObjType(&oldBooleanType);
-#endif
-
#ifdef TCL_COMPILE_STATS
Tcl_MutexLock(&tclObjMutex);
tclObjsAlloced = 0;
@@ -454,12 +420,12 @@ TclFinalizeThreadObjects(void)
ObjData *objData = Tcl_GetHashValue(hPtr);
if (objData != NULL) {
- ckfree(objData);
+ Tcl_Free(objData);
}
}
Tcl_DeleteHashTable(tablePtr);
- ckfree(tablePtr);
+ Tcl_Free(tablePtr);
tsdPtr->objThreadMap = NULL;
}
#endif
@@ -535,7 +501,7 @@ TclGetContLineTable(void)
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
if (!tsdPtr->lineCLPtr) {
- tsdPtr->lineCLPtr = ckalloc(sizeof(Tcl_HashTable));
+ tsdPtr->lineCLPtr = Tcl_Alloc(sizeof(Tcl_HashTable));
Tcl_InitHashTable(tsdPtr->lineCLPtr, TCL_ONE_WORD_KEYS);
Tcl_CreateThreadExitHandler(TclThreadFinalizeContLines,NULL);
}
@@ -570,7 +536,7 @@ TclContinuationsEnter(
ThreadSpecificData *tsdPtr = TclGetContLineTable();
Tcl_HashEntry *hPtr =
Tcl_CreateHashEntry(tsdPtr->lineCLPtr, objPtr, &newEntry);
- ContLineLoc *clLocPtr = ckalloc(sizeof(ContLineLoc) + num*sizeof(int));
+ ContLineLoc *clLocPtr = Tcl_Alloc(sizeof(ContLineLoc) + num*sizeof(int));
if (!newEntry) {
/*
@@ -594,7 +560,7 @@ TclContinuationsEnter(
* doing.
*/
- ckfree(Tcl_GetHashValue(hPtr));
+ Tcl_Free(Tcl_GetHashValue(hPtr));
}
clLocPtr->num = num;
@@ -630,7 +596,8 @@ TclContinuationsEnterDerived(
int start,
int *clNext)
{
- int length, end, num;
+ size_t length;
+ int end, num;
int *wordCLLast = clNext;
/*
@@ -657,7 +624,7 @@ TclContinuationsEnterDerived(
* better way which doesn't shimmer?)
*/
- TclGetStringFromObj(objPtr, &length);
+ (void)TclGetStringFromObj(objPtr, &length);
end = start + length; /* First char after the word */
/*
@@ -798,11 +765,11 @@ TclThreadFinalizeContLines(
for (hPtr = Tcl_FirstHashEntry(tsdPtr->lineCLPtr, &hSearch);
hPtr != NULL; hPtr = Tcl_NextHashEntry(&hSearch)) {
- ckfree(Tcl_GetHashValue(hPtr));
+ Tcl_Free(Tcl_GetHashValue(hPtr));
Tcl_DeleteHashEntry(hPtr);
}
Tcl_DeleteHashTable(tsdPtr->lineCLPtr);
- ckfree(tsdPtr->lineCLPtr);
+ Tcl_Free(tsdPtr->lineCLPtr);
tsdPtr->lineCLPtr = NULL;
}
@@ -1008,7 +975,7 @@ TclDbDumpActiveObjects(
tablePtr = tsdPtr->objThreadMap;
if (tablePtr != NULL) {
- fprintf(outFile, "total objects: %d\n", tablePtr->numEntries);
+ fprintf(outFile, "total objects: %" TCL_Z_MODIFIER "u\n", tablePtr->numEntries);
for (hPtr = Tcl_FirstHashEntry(tablePtr, &hSearch); hPtr != NULL;
hPtr = Tcl_NextHashEntry(&hSearch)) {
ObjData *objData = Tcl_GetHashValue(hPtr);
@@ -1072,7 +1039,7 @@ TclDbInitNewObj(
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
if (tsdPtr->objThreadMap == NULL) {
- tsdPtr->objThreadMap = ckalloc(sizeof(Tcl_HashTable));
+ tsdPtr->objThreadMap = Tcl_Alloc(sizeof(Tcl_HashTable));
Tcl_InitHashTable(tsdPtr->objThreadMap, TCL_ONE_WORD_KEYS);
}
tablePtr = tsdPtr->objThreadMap;
@@ -1085,7 +1052,7 @@ TclDbInitNewObj(
* Record the debugging information.
*/
- objData = ckalloc(sizeof(ObjData));
+ objData = Tcl_Alloc(sizeof(ObjData));
objData->objPtr = objPtr;
objData->file = file;
objData->line = line;
@@ -1210,7 +1177,7 @@ Tcl_DbNewObj(
* TclAllocateFreeObjects --
*
* Function to allocate a number of free Tcl_Objs. This is done using a
- * single ckalloc to reduce the overhead for Tcl_Obj allocation.
+ * single Tcl_Alloc to reduce the overhead for Tcl_Obj allocation.
*
* Assumes mutex is held.
*
@@ -1239,12 +1206,12 @@ TclAllocateFreeObjects(void)
* This has been noted by Purify to be a potential leak. The problem is
* that Tcl, when not TCL_MEM_DEBUG compiled, keeps around all allocated
* Tcl_Obj's, pointed to by tclFreeObjList, when freed instead of actually
- * freeing the memory. TclFinalizeObjects() does not ckfree() this memory,
+ * freeing the memory. TclFinalizeObjects() does not Tcl_Free() this memory,
* but leaves it to Tcl's memory subsystem finalization to release it.
* Purify apparently can't figure that out, and fires a false alarm.
*/
- basePtr = ckalloc(bytesToAlloc);
+ basePtr = Tcl_Alloc(bytesToAlloc);
prevPtr = NULL;
objPtr = (Tcl_Obj *) basePtr;
@@ -1319,7 +1286,7 @@ TclFreeObj(
ObjData *objData = Tcl_GetHashValue(hPtr);
if (objData != NULL) {
- ckfree(objData);
+ Tcl_Free(objData);
}
Tcl_DeleteHashEntry(hPtr);
@@ -1333,7 +1300,7 @@ TclFreeObj(
* either from 1 to 0, or from 0 to -1. Falling from -1 to -2, though,
* and so on, is always a sign of a botch in the caller.
*/
- if (objPtr->refCount < -1) {
+ if (objPtr->refCount == (size_t)-2) {
Tcl_Panic("Reference count for %p was negative", objPtr);
}
/*
@@ -1341,16 +1308,16 @@ TclFreeObj(
* sure we do not accept a second free when falling from 0 to -1.
* Skip that possibility so any double free will trigger the panic.
*/
- objPtr->refCount = -1;
+ objPtr->refCount = TCL_AUTO_LENGTH;
/*
* Invalidate the string rep first so we can use the bytes value for our
* pointer chain, and signal an obj deletion (as opposed to shimmering)
- * with 'length == -1'.
+ * with 'length == TCL_AUTO_LENGTH'.
*/
TclInvalidateStringRep(objPtr);
- objPtr->length = -1;
+ objPtr->length = TCL_AUTO_LENGTH;
if (ObjDeletePending(context)) {
PushObjToDelete(context, objPtr);
@@ -1363,7 +1330,7 @@ TclFreeObj(
}
Tcl_MutexLock(&tclObjMutex);
- ckfree(objPtr);
+ Tcl_Free(objPtr);
Tcl_MutexUnlock(&tclObjMutex);
TclIncrObjsFreed();
ObjDeletionLock(context);
@@ -1375,7 +1342,7 @@ TclFreeObj(
TclFreeIntRep(objToFree);
Tcl_MutexLock(&tclObjMutex);
- ckfree(objToFree);
+ Tcl_Free(objToFree);
Tcl_MutexUnlock(&tclObjMutex);
TclIncrObjsFreed();
}
@@ -1399,7 +1366,7 @@ TclFreeObj(
if (tsdPtr->lineCLPtr) {
hPtr = Tcl_FindHashEntry(tsdPtr->lineCLPtr, objPtr);
if (hPtr) {
- ckfree(Tcl_GetHashValue(hPtr));
+ Tcl_Free(Tcl_GetHashValue(hPtr));
Tcl_DeleteHashEntry(hPtr);
}
}
@@ -1418,7 +1385,7 @@ TclFreeObj(
*/
TclInvalidateStringRep(objPtr);
- objPtr->length = -1;
+ objPtr->length = TCL_AUTO_LENGTH;
if (!objPtr->typePtr || !objPtr->typePtr->freeIntRepProc) {
/*
@@ -1490,7 +1457,7 @@ TclFreeObj(
if (tsdPtr->lineCLPtr) {
hPtr = Tcl_FindHashEntry(tsdPtr->lineCLPtr, objPtr);
if (hPtr) {
- ckfree(Tcl_GetHashValue(hPtr));
+ Tcl_Free(Tcl_GetHashValue(hPtr));
Tcl_DeleteHashEntry(hPtr);
}
}
@@ -1520,7 +1487,7 @@ int
TclObjBeingDeleted(
Tcl_Obj *objPtr)
{
- return (objPtr->length == -1);
+ return (objPtr->length == TCL_AUTO_LENGTH);
}
/*
@@ -1639,7 +1606,7 @@ Tcl_GetString(
objPtr->typePtr->name);
}
objPtr->typePtr->updateStringProc(objPtr);
- if (objPtr->bytes == NULL || objPtr->length < 0
+ if (objPtr->bytes == NULL || objPtr->length == TCL_AUTO_LENGTH
|| objPtr->bytes[objPtr->length] != '\0') {
Tcl_Panic("UpdateStringProc for type '%s' "
"failed to create a valid string rep",
@@ -1698,7 +1665,7 @@ Tcl_GetStringFromObj(
objPtr->typePtr->name);
}
objPtr->typePtr->updateStringProc(objPtr);
- if (objPtr->bytes == NULL || objPtr->length < 0
+ if (objPtr->bytes == NULL || objPtr->length == TCL_AUTO_LENGTH
|| objPtr->bytes[objPtr->length] != '\0') {
Tcl_Panic("UpdateStringProc for type '%s' "
"failed to create a valid string rep",
@@ -1706,7 +1673,7 @@ Tcl_GetStringFromObj(
}
}
if (lengthPtr != NULL) {
- *lengthPtr = objPtr->length;
+ *lengthPtr = (objPtr->length < INT_MAX)? objPtr->length: INT_MAX;
}
return objPtr->bytes;
}
@@ -1720,15 +1687,15 @@ Tcl_GetStringFromObj(
* the tools needed to set an object's string representation. The
* function is determined by the arguments.
*
- * (objPtr->bytes != NULL && bytes != NULL) || (numBytes < 0)
+ * (objPtr->bytes != NULL && bytes != NULL) || (numBytes == -1)
* Invalid call -- panic!
*
- * objPtr->bytes == NULL && bytes == NULL && numBytes >= 0
+ * objPtr->bytes == NULL && bytes == NULL && numBytes != -1
* Allocation only - allocate space for (numBytes+1) chars.
* store in objPtr->bytes and return. Also sets
* objPtr->length to 0 and objPtr->bytes[0] to NUL.
*
- * objPtr->bytes == NULL && bytes != NULL && numBytes >= 0
+ * objPtr->bytes == NULL && bytes != NULL && numBytes != -1
* Allocate and copy. bytes is assumed to point to chars to
* copy into the string rep. objPtr->length = numBytes. Allocate
* array of (numBytes + 1) chars. store in objPtr->bytes. Copy
@@ -1737,7 +1704,7 @@ Tcl_GetStringFromObj(
* Caller must guarantee there are numBytes chars at bytes to
* be copied.
*
- * objPtr->bytes != NULL && bytes == NULL && numBytes >= 0
+ * objPtr->bytes != NULL && bytes == NULL && numBytes != -1
* Truncate. Set objPtr->length to numBytes and
* objPr->bytes[numBytes] to NUL. Caller has to guarantee
* that a prior allocating call allocated enough bytes for
@@ -1759,35 +1726,31 @@ char *
Tcl_InitStringRep(
Tcl_Obj *objPtr, /* Object whose string rep is to be set */
const char *bytes,
- unsigned int numBytes)
+ size_t numBytes)
{
assert(objPtr->bytes == NULL || bytes == NULL);
- if (numBytes > INT_MAX) {
- Tcl_Panic("max size for a Tcl value (%d bytes) exceeded", INT_MAX);
- }
-
/* Allocate */
if (objPtr->bytes == NULL) {
/* Allocate only as empty - extend later if bytes copied */
objPtr->length = 0;
if (numBytes) {
- objPtr->bytes = attemptckalloc(numBytes + 1);
+ objPtr->bytes = Tcl_AttemptAlloc(numBytes + 1);
if (objPtr->bytes == NULL) {
return NULL;
}
if (bytes) {
/* Copy */
memcpy(objPtr->bytes, bytes, numBytes);
- objPtr->length = (int) numBytes;
+ objPtr->length = numBytes;
}
} else {
TclInitStringRep(objPtr, NULL, 0);
}
} else {
/* objPtr->bytes != NULL bytes == NULL - Truncate */
- objPtr->bytes = ckrealloc(objPtr->bytes, numBytes + 1);
- objPtr->length = (int)numBytes;
+ objPtr->bytes = Tcl_Realloc(objPtr->bytes, numBytes + 1);
+ objPtr->length = numBytes;
}
/* Terminate */
@@ -1936,147 +1899,6 @@ Tcl_FreeIntRep(
/*
*----------------------------------------------------------------------
*
- * Tcl_NewBooleanObj --
- *
- * This function is normally called when not debugging: i.e., when
- * TCL_MEM_DEBUG is not defined. It creates a new Tcl_Obj and
- * initializes it from the argument boolean value. A nonzero "boolValue"
- * is coerced to 1.
- *
- * When TCL_MEM_DEBUG is defined, this function just returns the result
- * of calling the debugging version Tcl_DbNewLongObj.
- *
- * Results:
- * The newly created object is returned. This object will have an invalid
- * string representation. The returned object has ref count 0.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-#undef Tcl_NewBooleanObj
-#ifdef TCL_MEM_DEBUG
-
-Tcl_Obj *
-Tcl_NewBooleanObj(
- register int boolValue) /* Boolean used to initialize new object. */
-{
- return Tcl_DbNewWideIntObj(boolValue!=0, "unknown", 0);
-}
-
-#else /* if not TCL_MEM_DEBUG */
-
-Tcl_Obj *
-Tcl_NewBooleanObj(
- register int boolValue) /* Boolean used to initialize new object. */
-{
- register Tcl_Obj *objPtr;
-
- TclNewIntObj(objPtr, boolValue!=0);
- return objPtr;
-}
-#endif /* TCL_MEM_DEBUG */
-
-/*
- *----------------------------------------------------------------------
- *
- * Tcl_DbNewBooleanObj --
- *
- * This function is normally called when debugging: i.e., when
- * TCL_MEM_DEBUG is defined. It creates new boolean objects. It is the
- * same as the Tcl_NewBooleanObj function above except that it calls
- * Tcl_DbCkalloc directly with the file name and line number from its
- * caller. This simplifies debugging since then the [memory active]
- * command will report the correct file name and line number when
- * reporting objects that haven't been freed.
- *
- * When TCL_MEM_DEBUG is not defined, this function just returns the
- * result of calling Tcl_NewBooleanObj.
- *
- * Results:
- * The newly created object is returned. This object will have an invalid
- * string representation. The returned object has ref count 0.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-#ifndef TCL_NO_DEPRECATED
-#undef Tcl_DbNewBooleanObj
-#ifdef TCL_MEM_DEBUG
-
-Tcl_Obj *
-Tcl_DbNewBooleanObj(
- register int boolValue, /* Boolean used to initialize new object. */
- const char *file, /* The name of the source file calling this
- * function; used for debugging. */
- int line) /* Line number in the source file; used for
- * debugging. */
-{
- register Tcl_Obj *objPtr;
-
- TclDbNewObj(objPtr, file, line);
- /* Optimized TclInvalidateStringRep() */
- objPtr->bytes = NULL;
-
- objPtr->internalRep.wideValue = (boolValue != 0);
- objPtr->typePtr = &tclIntType;
- return objPtr;
-}
-
-#else /* if not TCL_MEM_DEBUG */
-
-Tcl_Obj *
-Tcl_DbNewBooleanObj(
- register int boolValue, /* Boolean used to initialize new object. */
- const char *file, /* The name of the source file calling this
- * function; used for debugging. */
- int line) /* Line number in the source file; used for
- * debugging. */
-{
- return Tcl_NewBooleanObj(boolValue);
-}
-#endif /* TCL_MEM_DEBUG */
-
-/*
- *----------------------------------------------------------------------
- *
- * Tcl_SetBooleanObj --
- *
- * Modify an object to be a boolean object and to have the specified
- * boolean value. A nonzero "boolValue" is coerced to 1.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The object's old string rep, if any, is freed. Also, any old internal
- * rep is freed.
- *
- *----------------------------------------------------------------------
- */
-
-#undef Tcl_SetBooleanObj
-void
-Tcl_SetBooleanObj(
- register Tcl_Obj *objPtr, /* Object whose internal rep to init. */
- register int boolValue) /* Boolean used to set object's value. */
-{
- if (Tcl_IsShared(objPtr)) {
- Tcl_Panic("%s called with shared object", "Tcl_SetBooleanObj");
- }
-
- TclSetIntObj(objPtr, boolValue!=0);
-}
-#endif /* TCL_NO_DEPRECATED */
-
-/*
- *----------------------------------------------------------------------
- *
* Tcl_GetBooleanFromObj --
*
* Attempt to return a boolean from the Tcl object "objPtr". This
@@ -2100,14 +1922,10 @@ Tcl_GetBooleanFromObj(
register int *boolPtr) /* Place to store resulting boolean. */
{
do {
- if (objPtr->typePtr == &tclIntType) {
+ if (objPtr->typePtr == &tclIntType || objPtr->typePtr == &tclBooleanType) {
*boolPtr = (objPtr->internalRep.wideValue != 0);
return TCL_OK;
}
- if (objPtr->typePtr == &tclBooleanType) {
- *boolPtr = objPtr->internalRep.longValue != 0;
- return TCL_OK;
- }
if (objPtr->typePtr == &tclDoubleType) {
/*
* Caution: Don't be tempted to check directly for the "double"
@@ -2149,12 +1967,7 @@ Tcl_GetBooleanFromObj(
*
* Side effects:
* If no error occurs, an integer 1 or 0 is stored as "objPtr"s internal
- * representation and the type of "objPtr" is set to boolean or int/wideInt.
- *
- * Warning: If the returned type is "wideInt" (32-bit platforms) and your
- * platform is bigendian, you cannot use internalRep.longValue to distinguish
- * between false and true. On Windows and most other platforms this still will
- * work fine, but basically it is non-portable.
+ * representation and the type of "objPtr" is set to boolean or int.
*
*----------------------------------------------------------------------
*/
@@ -2193,7 +2006,7 @@ TclSetBooleanFromAny(
badBoolean:
if (interp != NULL) {
- int length;
+ size_t length;
const char *str = TclGetStringFromObj(objPtr, &length);
Tcl_Obj *msg;
@@ -2212,8 +2025,8 @@ ParseBoolean(
{
int newBool;
char lowerCase[6];
- const char *str = TclGetString(objPtr);
- size_t i, length = objPtr->length;
+ size_t i, length;
+ const char *str = TclGetStringFromObj(objPtr, &length);
if ((length == 0) || (length > 5)) {
/*
@@ -2312,7 +2125,7 @@ ParseBoolean(
goodBoolean:
TclFreeIntRep(objPtr);
- objPtr->internalRep.longValue = newBool;
+ objPtr->internalRep.wideValue = newBool;
objPtr->typePtr = &tclBooleanType;
return TCL_OK;
@@ -2549,8 +2362,7 @@ SetDoubleFromAny(
* UpdateStringOfDouble --
*
* Update the string representation for a double-precision floating point
- * object. This must obey the current tcl_precision value for
- * double-to-string conversions. Note: This function does not free an
+ * object. Note: This function does not free an
* existing old string rep so storage will be lost if this has not
* already been done.
*
@@ -2579,112 +2391,28 @@ UpdateStringOfDouble(
/*
*----------------------------------------------------------------------
*
- * Tcl_NewIntObj --
+ * Tcl_GetIntFromObj --
*
- * If a client is compiled with TCL_MEM_DEBUG defined, calls to
- * Tcl_NewIntObj to create a new integer object end up calling the
- * debugging function Tcl_DbNewLongObj instead.
+ * Retrieve the integer value of 'objPtr'.
*
- * Otherwise, if the client is compiled without TCL_MEM_DEBUG defined,
- * calls to Tcl_NewIntObj result in a call to one of the two
- * Tcl_NewIntObj implementations below. We provide two implementations so
- * that the Tcl core can be compiled to do memory debugging of the core
- * even if a client does not request it for itself.
+ * Value
*
- * Integer and long integer objects share the same "integer" type
- * implementation. We store all integers as longs and Tcl_GetIntFromObj
- * checks whether the current value of the long can be represented by an
- * int.
+ * TCL_OK
*
- * Results:
- * The newly created object is returned. This object will have an invalid
- * string representation. The returned object has ref count 0.
+ * Success.
*
- * Side effects:
- * None.
+ * TCL_ERROR
*
- *----------------------------------------------------------------------
- */
-
-#ifndef TCL_NO_DEPRECATED
-#undef Tcl_NewIntObj
-#ifdef TCL_MEM_DEBUG
-
-Tcl_Obj *
-Tcl_NewIntObj(
- register int intValue) /* Int used to initialize the new object. */
-{
- return Tcl_DbNewWideIntObj((long)intValue, "unknown", 0);
-}
-
-#else /* if not TCL_MEM_DEBUG */
-
-Tcl_Obj *
-Tcl_NewIntObj(
- register int intValue) /* Int used to initialize the new object. */
-{
- register Tcl_Obj *objPtr;
-
- TclNewIntObj(objPtr, intValue);
- return objPtr;
-}
-#endif /* if TCL_MEM_DEBUG */
-#endif /* TCL_NO_DEPRECATED */
-
-/*
- *----------------------------------------------------------------------
- *
- * Tcl_SetIntObj --
+ * An error occurred during conversion or the integral value can not
+ * be represented as an integer (it might be too large). An error
+ * message is left in the interpreter's result if 'interp' is not
+ * NULL.
*
- * Modify an object to be an integer and to have the specified integer
- * value.
- *
- * Results:
- * None.
+ * Effect
*
- * Side effects:
- * The object's old string rep, if any, is freed. Also, any old internal
- * rep is freed.
- *
- *----------------------------------------------------------------------
- */
-#ifndef TCL_NO_DEPRECATED
-#undef Tcl_SetIntObj
-void
-Tcl_SetIntObj(
- register Tcl_Obj *objPtr, /* Object whose internal rep to init. */
- register int intValue) /* Integer used to set object's value. */
-{
- if (Tcl_IsShared(objPtr)) {
- Tcl_Panic("%s called with shared object", "Tcl_SetIntObj");
- }
-
- TclSetIntObj(objPtr, intValue);
-}
-#endif /* TCL_NO_DEPRECATED */
-
-/*
- *----------------------------------------------------------------------
- *
- * Tcl_GetIntFromObj --
- *
- * Attempt to return an int from the Tcl object "objPtr". If the object
- * is not already an int, an attempt will be made to convert it to one.
- *
- * Integer and long integer objects share the same "integer" type
- * implementation. We store all integers as longs and Tcl_GetIntFromObj
- * checks whether the current value of the long can be represented by an
- * int.
- *
- * Results:
- * The return value is a standard Tcl object result. If an error occurs
- * during conversion or if the long integer held by the object can not be
- * represented by an int, an error message is left in the interpreter's
- * result unless "interp" is NULL.
- *
- * Side effects:
- * If the object is not already an int, the conversion will free any old
- * internal representation.
+ * 'objPtr' is converted to an integer if necessary if it is not one
+ * already. The conversion frees any previously-existing internal
+ * representation.
*
*----------------------------------------------------------------------
*/
@@ -2771,19 +2499,6 @@ UpdateStringOfInt(
(void) Tcl_InitStringRep(objPtr, NULL,
TclFormatInt(dst, objPtr->internalRep.wideValue));
}
-
-#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 && !defined(TCL_WIDE_INT_IS_LONG)
-static void
-UpdateStringOfOldInt(
- register Tcl_Obj *objPtr) /* Int object whose string rep to update. */
-{
- char *dst = Tcl_InitStringRep( objPtr, NULL, TCL_INTEGER_SPACE);
-
- TclOOM(dst, TCL_INTEGER_SPACE + 1);
- (void) Tcl_InitStringRep(objPtr, NULL,
- TclFormatInt(dst, objPtr->internalRep.longValue));
-}
-#endif
/*
*----------------------------------------------------------------------
@@ -2917,40 +2632,6 @@ Tcl_DbNewLongObj(
/*
*----------------------------------------------------------------------
*
- * Tcl_SetLongObj --
- *
- * Modify an object to be an integer object and to have the specified
- * long integer value.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The object's old string rep, if any, is freed. Also, any old internal
- * rep is freed.
- *
- *----------------------------------------------------------------------
- */
-
-#ifndef TCL_NO_DEPRECATED
-#undef Tcl_SetLongObj
-void
-Tcl_SetLongObj(
- register Tcl_Obj *objPtr, /* Object whose internal rep to init. */
- register long longValue) /* Long integer used to initialize the
- * object's value. */
-{
- if (Tcl_IsShared(objPtr)) {
- Tcl_Panic("%s called with shared object", "Tcl_SetLongObj");
- }
-
- TclSetIntObj(objPtr, longValue);
-}
-#endif /* TCL_NO_DEPRECATED */
-
-/*
- *----------------------------------------------------------------------
- *
* Tcl_GetLongFromObj --
*
* Attempt to return an long integer from the Tcl object "objPtr". If the
@@ -3379,7 +3060,7 @@ FreeBignum(
TclUnpackBignum(objPtr, toFree);
mp_clear(&toFree);
if (PTR2INT(objPtr->internalRep.twoPtrValue.ptr2) < 0) {
- ckfree(objPtr->internalRep.twoPtrValue.ptr1);
+ Tcl_Free(objPtr->internalRep.twoPtrValue.ptr1);
}
objPtr->typePtr = NULL;
}
@@ -3824,8 +3505,7 @@ TclGetNumberFromObj(
}
if (objPtr->typePtr == &tclBignumType) {
static Tcl_ThreadDataKey bignumKey;
- mp_int *bigPtr = Tcl_GetThreadData(&bignumKey,
- (int) sizeof(mp_int));
+ mp_int *bigPtr = Tcl_GetThreadData(&bignumKey, sizeof(mp_int));
TclUnpackBignum(objPtr, *bigPtr);
*typePtr = TCL_NUMBER_BIG;
@@ -3899,7 +3579,7 @@ int
Tcl_IsShared(
Tcl_Obj *objPtr) /* The object to test for being shared. */
{
- return ((objPtr)->refCount > 1);
+ return ((objPtr)->refCount + 1 > 2);
}
/*
@@ -4155,8 +3835,8 @@ AllocObjEntry(
Tcl_HashTable *tablePtr, /* Hash table. */
void *keyPtr) /* Key to store in the hash table entry. */
{
- Tcl_Obj *objPtr = keyPtr;
- Tcl_HashEntry *hPtr = ckalloc(sizeof(Tcl_HashEntry));
+ Tcl_Obj *objPtr = (Tcl_Obj *)keyPtr;
+ Tcl_HashEntry *hPtr = Tcl_Alloc(sizeof(Tcl_HashEntry));
hPtr->key.objPtr = objPtr;
Tcl_IncrRefCount(objPtr);
@@ -4187,7 +3867,7 @@ TclCompareObjKeys(
void *keyPtr, /* New key to compare. */
Tcl_HashEntry *hPtr) /* Existing key to compare. */
{
- Tcl_Obj *objPtr1 = keyPtr;
+ Tcl_Obj *objPtr1 = (Tcl_Obj *) keyPtr;
Tcl_Obj *objPtr2 = (Tcl_Obj *) hPtr->key.oneWordValue;
register const char *p1, *p2;
register size_t l1, l2;
@@ -4250,7 +3930,7 @@ TclFreeObjEntry(
Tcl_Obj *objPtr = (Tcl_Obj *) hPtr->key.oneWordValue;
Tcl_DecrRefCount(objPtr);
- ckfree(hPtr);
+ Tcl_Free(hPtr);
}
/*
@@ -4276,10 +3956,10 @@ TclHashObjKey(
Tcl_HashTable *tablePtr, /* Hash table. */
void *keyPtr) /* Key from which to compute hash value. */
{
- Tcl_Obj *objPtr = keyPtr;
- int length;
- const char *string = TclGetStringFromObj(objPtr, &length);
- unsigned int result = 0;
+ Tcl_Obj *objPtr = (Tcl_Obj *)keyPtr;
+ const char *string = TclGetString(objPtr);
+ size_t length = objPtr->length;
+ TCL_HASH_TYPE result = 0;
/*
* I tried a zillion different hash functions and asked many other people
@@ -4315,13 +3995,13 @@ TclHashObjKey(
* See [tcl-Feature Request #2958832]
*/
- if (length > 0) {
+ if (length) {
result = UCHAR(*string);
while (--length) {
result += (result << 3) + UCHAR(*++string);
}
}
- return (TCL_HASH_TYPE) result;
+ return result;
}
/*
@@ -4440,7 +4120,7 @@ SetCmdNameObj(
if (resPtr) {
fillPtr = resPtr;
} else {
- fillPtr = ckalloc(sizeof(ResolvedCmdName));
+ fillPtr = Tcl_Alloc(sizeof(ResolvedCmdName));
fillPtr->refCount = 1;
}
@@ -4543,7 +4223,7 @@ FreeCmdNameInternalRep(
Command *cmdPtr = resPtr->cmdPtr;
TclCleanupCommandMacro(cmdPtr);
- ckfree(resPtr);
+ Tcl_Free(resPtr);
}
objPtr->typePtr = NULL;
}
@@ -4692,7 +4372,7 @@ Tcl_RepresentationCmd(
* "1872361827361287"
*/
- descObj = Tcl_ObjPrintf("value is a %s with a refcount of %d,"
+ descObj = Tcl_ObjPrintf("value is a %s with a refcount of %" TCL_Z_MODIFIER "u,"
" object pointer at %p",
objv[1]->typePtr ? objv[1]->typePtr->name : "pure string",
objv[1]->refCount, objv[1]);
diff --git a/generic/tclOptimize.c b/generic/tclOptimize.c
index 8267a7d..6419d87 100644
--- a/generic/tclOptimize.c
+++ b/generic/tclOptimize.c
@@ -231,7 +231,7 @@ ConvertZeroEffectToNOP(
&& TclGetUInt1AtPtr(currentInstPtr + size + 1) == 2) {
Tcl_Obj *litPtr = TclFetchLiteral(envPtr,
TclGetUInt1AtPtr(currentInstPtr + 1));
- int numBytes;
+ size_t numBytes;
(void) TclGetStringFromObj(litPtr, &numBytes);
if (numBytes == 0) {
@@ -246,7 +246,7 @@ ConvertZeroEffectToNOP(
&& TclGetUInt1AtPtr(currentInstPtr + size + 1) == 2) {
Tcl_Obj *litPtr = TclFetchLiteral(envPtr,
TclGetUInt4AtPtr(currentInstPtr + 1));
- int numBytes;
+ size_t numBytes;
(void) TclGetStringFromObj(litPtr, &numBytes);
if (numBytes == 0) {
@@ -287,8 +287,6 @@ ConvertZeroEffectToNOP(
case INST_INCR_ARRAY_STK:
case INST_INCR_SCALAR_STK:
case INST_INCR_STK:
- case INST_LOR:
- case INST_LAND:
case INST_EQ:
case INST_NEQ:
case INST_LT:
diff --git a/generic/tclPanic.c b/generic/tclPanic.c
index e8c1e7f..277f7ad 100644
--- a/generic/tclPanic.c
+++ b/generic/tclPanic.c
@@ -15,7 +15,7 @@
#include "tclInt.h"
#if defined(_WIN32) || defined(__CYGWIN__)
- MODULE_SCOPE TCL_NORETURN void tclWinDebugPanic(const char *format, ...);
+ MODULE_SCOPE void tclWinDebugPanic(const char *format, ...);
#endif
/*
@@ -23,11 +23,7 @@
* procedure.
*/
-#if defined(__CYGWIN__) || (defined(_WIN32) && (defined(TCL_NO_DEPRECATED) || TCL_MAJOR_VERSION > 8))
-static TCL_NORETURN1 Tcl_PanicProc *panicProc = tclWinDebugPanic;
-#else
static TCL_NORETURN1 Tcl_PanicProc *panicProc = NULL;
-#endif
/*
*----------------------------------------------------------------------
@@ -49,14 +45,6 @@ void
Tcl_SetPanicProc(
TCL_NORETURN1 Tcl_PanicProc *proc)
{
-#if defined(_WIN32)
- /* tclWinDebugPanic only installs if there is no panicProc yet. */
- if ((proc != tclWinDebugPanic) || (panicProc == NULL))
-#elif defined(__CYGWIN__)
- if (proc == NULL)
- panicProc = tclWinDebugPanic;
- else
-#endif
panicProc = proc;
TclInitSubsystems();
}
@@ -64,7 +52,7 @@ Tcl_SetPanicProc(
/*
*----------------------------------------------------------------------
*
- * Tcl_PanicVA --
+ * Tcl_Panic --
*
* Print an error message and kill the process.
*
@@ -77,16 +65,25 @@ Tcl_SetPanicProc(
*----------------------------------------------------------------------
*/
+ /* ARGSUSED */
+/*
+ * The following comment is here so that Coverity's static analizer knows that
+ * a Tcl_Panic() call can never return and avoids lots of false positives.
+ */
+
+/* coverity[+kill] */
void
-Tcl_PanicVA(
- const char *format, /* Format string, suitable for passing to
- * fprintf. */
- va_list argList) /* Variable argument list. */
+Tcl_Panic(
+ const char *format,
+ ...)
{
+ va_list argList;
char *arg1, *arg2, *arg3; /* Additional arguments (variable in number)
* to pass to fprintf. */
char *arg4, *arg5, *arg6, *arg7, *arg8;
+
+ va_start(argList, format);
arg1 = va_arg(argList, char *);
arg2 = va_arg(argList, char *);
arg3 = va_arg(argList, char *);
@@ -95,29 +92,28 @@ Tcl_PanicVA(
arg6 = va_arg(argList, char *);
arg7 = va_arg(argList, char *);
arg8 = va_arg(argList, char *);
+ va_end (argList);
if (panicProc != NULL) {
panicProc(format, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
-#ifdef _WIN32
- } else if (IsDebuggerPresent()) {
- tclWinDebugPanic(format, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
-#endif
} else {
+#if defined(_WIN32) || defined(__CYGWIN__)
+ tclWinDebugPanic(format, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
+#else
fprintf(stderr, format, arg1, arg2, arg3, arg4, arg5, arg6, arg7,
arg8);
fprintf(stderr, "\n");
fflush(stderr);
-#if defined(_WIN32) || defined(__CYGWIN__)
+#endif
# if defined(__GNUC__)
__builtin_trap();
# elif defined(_WIN64)
__debugbreak();
# elif defined(_MSC_VER) && defined (_M_IX86)
_asm {int 3}
-# else
+# elif defined(_WIN32)
DebugBreak();
# endif
-#endif
#if defined(_WIN32)
ExitProcess(1);
#else
@@ -127,42 +123,6 @@ Tcl_PanicVA(
}
/*
- *----------------------------------------------------------------------
- *
- * Tcl_Panic --
- *
- * Print an error message and kill the process.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The process dies, entering the debugger if possible.
- *
- *----------------------------------------------------------------------
- */
-
-/* ARGSUSED */
-
-/*
- * The following comment is here so that Coverity's static analizer knows that
- * a Tcl_Panic() call can never return and avoids lots of false positives.
- */
-
-/* coverity[+kill] */
-void
-Tcl_Panic(
- const char *format,
- ...)
-{
- va_list argList;
-
- va_start(argList, format);
- Tcl_PanicVA(format, argList);
- va_end (argList);
-}
-
-/*
* Local Variables:
* mode: c
* c-basic-offset: 4
diff --git a/generic/tclParse.c b/generic/tclParse.c
index 448ce5e..a049ee6 100644
--- a/generic/tclParse.c
+++ b/generic/tclParse.c
@@ -119,14 +119,14 @@ const char tclCharTypeTable[] = {
* Prototypes for local functions defined in this file:
*/
-static inline int CommandComplete(const char *script, int numBytes);
-static int ParseComment(const char *src, int numBytes,
+static inline int CommandComplete(const char *script, size_t numBytes);
+static size_t ParseComment(const char *src, size_t numBytes,
Tcl_Parse *parsePtr);
-static int ParseTokens(const char *src, int numBytes, int mask,
+static int ParseTokens(const char *src, size_t numBytes, int mask,
int flags, Tcl_Parse *parsePtr);
-static int ParseWhiteSpace(const char *src, int numBytes,
+static size_t ParseWhiteSpace(const char *src, size_t numBytes,
int *incompletePtr, char *typePtr);
-static int ParseAllWhiteSpace(const char *src, int numBytes,
+static size_t ParseAllWhiteSpace(const char *src, size_t numBytes,
int *incompletePtr);
/*
@@ -149,7 +149,7 @@ void
TclParseInit(
Tcl_Interp *interp, /* Interpreter to use for error reporting */
const char *start, /* Start of string to be parsed. */
- int numBytes, /* Total number of bytes in string. If < 0,
+ size_t numBytes, /* Total number of bytes in string. If -1,
* the script consists of all bytes up to the
* first null character. */
Tcl_Parse *parsePtr) /* Points to struct to initialize */
@@ -195,19 +195,19 @@ Tcl_ParseCommand(
* NULL, then no error message is provided. */
const char *start, /* First character of string containing one or
* more Tcl commands. */
- register int numBytes, /* Total number of bytes in string. If < 0,
+ size_t numBytes, /* Total number of bytes in string. If -1,
* the script consists of all bytes up to the
* first null character. */
int nested, /* Non-zero means this is a nested command:
* close bracket should be considered a
* command terminator. If zero, then close
* bracket has no special meaning. */
- register Tcl_Parse *parsePtr)
+ Tcl_Parse *parsePtr)
/* Structure to fill in with information about
* the parsed command; any previous
* information in the structure is ignored. */
{
- register const char *src; /* Points to current character in the
+ const char *src; /* Points to current character in the
* command. */
char type; /* Result returned by CHAR_TYPE(*src). */
Tcl_Token *tokenPtr; /* Pointer to token being filled in. */
@@ -216,7 +216,7 @@ Tcl_ParseCommand(
* command. */
const char *termPtr; /* Set by Tcl_ParseBraces/QuotedString to
* point to char after terminating one. */
- int scanned;
+ size_t scanned;
if ((start == NULL) && (numBytes != 0)) {
if (interp != NULL) {
@@ -225,7 +225,7 @@ Tcl_ParseCommand(
}
return TCL_ERROR;
}
- if (numBytes < 0) {
+ if (numBytes == TCL_AUTO_LENGTH) {
numBytes = strlen(start);
}
TclParseInit(interp, start, numBytes, parsePtr);
@@ -344,7 +344,7 @@ Tcl_ParseCommand(
/* Haven't seen prefix already */
&& (1 == parsePtr->numTokens - expIdx)
/* Only one token */
- && (((1 == (size_t) expPtr->size)
+ && (((1 == expPtr->size)
/* Same length as prefix */
&& (expPtr->start[0] == '*')))
/* Is the prefix */
@@ -379,7 +379,8 @@ Tcl_ParseCommand(
tokenPtr->size = src - tokenPtr->start;
tokenPtr->numComponents = parsePtr->numTokens - (wordIndex + 1);
if (expandWord) {
- int i, isLiteral = 1;
+ size_t i;
+ int isLiteral = 1;
/*
* When a command includes a word that is an expanded literal; for
@@ -425,7 +426,7 @@ Tcl_ParseCommand(
*/
while (nextElem < listEnd) {
- int size;
+ size_t size;
code = TclFindElement(NULL, nextElem, listEnd - nextElem,
&elemStart, &nextElem, &size, &literal);
@@ -617,10 +618,10 @@ TclIsBareword(
*----------------------------------------------------------------------
*/
-static int
+static size_t
ParseWhiteSpace(
const char *src, /* First character to parse. */
- register int numBytes, /* Max number of bytes to scan. */
+ size_t numBytes, /* Max number of bytes to scan. */
int *incompletePtr, /* Set this boolean memory to true if parsing
* indicates an incomplete command. */
char *typePtr) /* Points to location to store character type
@@ -671,17 +672,17 @@ ParseWhiteSpace(
*----------------------------------------------------------------------
*/
-static int
+static size_t
ParseAllWhiteSpace(
const char *src, /* First character to parse. */
- int numBytes, /* Max number of byes to scan */
+ size_t numBytes, /* Max number of byes to scan */
int *incompletePtr) /* Set true if parse is incomplete. */
{
char type;
const char *p = src;
do {
- int scanned = ParseWhiteSpace(p, numBytes, incompletePtr, &type);
+ size_t scanned = ParseWhiteSpace(p, numBytes, incompletePtr, &type);
p += scanned;
numBytes -= scanned;
@@ -689,10 +690,10 @@ ParseAllWhiteSpace(
return (p-src);
}
-int
+size_t
TclParseAllWhiteSpace(
const char *src, /* First character to parse. */
- int numBytes) /* Max number of byes to scan */
+ size_t numBytes) /* Max number of byes to scan */
{
int dummy;
return ParseAllWhiteSpace(src, numBytes, &dummy);
@@ -723,8 +724,8 @@ TclParseAllWhiteSpace(
int
TclParseHex(
const char *src, /* First character to parse. */
- int numBytes, /* Max number of byes to scan */
- int *resultPtr) /* Points to storage provided by caller where
+ size_t numBytes, /* Max number of byes to scan */
+ int *resultPtr) /* Points to storage provided by caller where
* the character resulting from the
* conversion is to be written. */
{
@@ -779,8 +780,8 @@ int
TclParseBackslash(
const char *src, /* Points to the backslash character of a a
* backslash sequence. */
- int numBytes, /* Max number of bytes to scan. */
- int *readPtr, /* NULL, or points to storage where the number
+ size_t numBytes, /* Max number of bytes to scan. */
+ size_t *readPtr, /* NULL, or points to storage where the number
* of bytes scanned should be written. */
char *dst) /* NULL, or points to buffer where the UTF-8
* encoding of the backslash sequence is to be
@@ -789,7 +790,7 @@ TclParseBackslash(
register const char *p = src+1;
Tcl_UniChar unichar = 0;
int result;
- int count;
+ size_t count;
char buf[4] = "";
if (numBytes == 0) {
@@ -963,10 +964,10 @@ TclParseBackslash(
*----------------------------------------------------------------------
*/
-static int
+static size_t
ParseComment(
const char *src, /* First character to parse. */
- register int numBytes, /* Max number of bytes to scan. */
+ size_t numBytes, /* Max number of bytes to scan. */
Tcl_Parse *parsePtr) /* Information about parse in progress.
* Updated if parsing indicates an incomplete
* command. */
@@ -975,7 +976,7 @@ ParseComment(
int incomplete = parsePtr->incomplete;
while (numBytes) {
- int scanned = ParseAllWhiteSpace(p, numBytes, &incomplete);
+ size_t scanned = ParseAllWhiteSpace(p, numBytes, &incomplete);
p += scanned;
numBytes -= scanned;
@@ -1039,7 +1040,7 @@ ParseComment(
static int
ParseTokens(
register const char *src, /* First character to parse. */
- register int numBytes, /* Max number of bytes to scan. */
+ size_t numBytes, /* Max number of bytes to scan. */
int mask, /* Specifies when to stop parsing. The parse
* stops at the first unquoted character whose
* CHAR_TYPE contains any of the bits in
@@ -1279,7 +1280,7 @@ Tcl_FreeParse(
* call to Tcl_ParseCommand. */
{
if (parsePtr->tokenPtr != parsePtr->staticTokens) {
- ckfree(parsePtr->tokenPtr);
+ Tcl_Free(parsePtr->tokenPtr);
parsePtr->tokenPtr = parsePtr->staticTokens;
}
}
@@ -1317,7 +1318,7 @@ Tcl_ParseVarName(
* NULL, then no error message is provided. */
const char *start, /* Start of variable substitution string.
* First character must be "$". */
- register int numBytes, /* Total number of bytes in string. If < 0,
+ size_t numBytes, /* Total number of bytes in string. If -1,
* the string consists of all bytes up to the
* first null character. */
Tcl_Parse *parsePtr, /* Structure to fill in with information about
@@ -1335,7 +1336,7 @@ Tcl_ParseVarName(
if ((numBytes == 0) || (start == NULL)) {
return TCL_ERROR;
}
- if (numBytes < 0) {
+ if (numBytes == TCL_AUTO_LENGTH) {
numBytes = strlen(start);
}
@@ -1595,7 +1596,7 @@ Tcl_ParseBraces(
* NULL, then no error message is provided. */
const char *start, /* Start of string enclosed in braces. The
* first character must be {'. */
- register int numBytes, /* Total number of bytes in string. If < 0,
+ size_t numBytes, /* Total number of bytes in string. If -1,
* the string consists of all bytes up to the
* first null character. */
register Tcl_Parse *parsePtr,
@@ -1612,12 +1613,13 @@ Tcl_ParseBraces(
{
Tcl_Token *tokenPtr;
register const char *src;
- int startIndex, level, length;
+ int startIndex, level;
+ size_t length;
if ((numBytes == 0) || (start == NULL)) {
return TCL_ERROR;
}
- if (numBytes < 0) {
+ if (numBytes == TCL_AUTO_LENGTH) {
numBytes = strlen(start);
}
@@ -1797,7 +1799,7 @@ Tcl_ParseQuotedString(
* NULL, then no error message is provided. */
const char *start, /* Start of the quoted string. The first
* character must be '"'. */
- register int numBytes, /* Total number of bytes in string. If < 0,
+ size_t numBytes, /* Total number of bytes in string. If -1,
* the string consists of all bytes up to the
* first null character. */
register Tcl_Parse *parsePtr,
@@ -1815,7 +1817,7 @@ Tcl_ParseQuotedString(
if ((numBytes == 0) || (start == NULL)) {
return TCL_ERROR;
}
- if (numBytes < 0) {
+ if (numBytes == TCL_AUTO_LENGTH) {
numBytes = strlen(start);
}
@@ -1879,12 +1881,12 @@ void
TclSubstParse(
Tcl_Interp *interp,
const char *bytes,
- int numBytes,
+ size_t numBytes,
int flags,
Tcl_Parse *parsePtr,
Tcl_InterpState *statePtr)
{
- int length = numBytes;
+ size_t length = numBytes;
const char *p = bytes;
TclParseInit(interp, p, length, parsePtr);
@@ -2141,7 +2143,7 @@ TclSubstTokens(
if (isLiteral) {
maxNumCL = NUM_STATIC_POS;
- clPosition = ckalloc(maxNumCL * sizeof(int));
+ clPosition = Tcl_Alloc(maxNumCL * sizeof(int));
}
adjust = 0;
@@ -2181,17 +2183,17 @@ TclSubstTokens(
if ((appendByteLength == 1) && (utfCharBytes[0] == ' ')
&& (tokenPtr->start[1] == '\n')) {
if (isLiteral) {
- int clPos;
+ size_t clPos;
if (result == 0) {
clPos = 0;
} else {
- TclGetStringFromObj(result, &clPos);
+ (void)TclGetStringFromObj(result, &clPos);
}
if (numCL >= maxNumCL) {
maxNumCL *= 2;
- clPosition = ckrealloc(clPosition,
+ clPosition = Tcl_Realloc(clPosition,
maxNumCL * sizeof(int));
}
clPosition[numCL] = clPos;
@@ -2349,7 +2351,7 @@ TclSubstTokens(
*/
if (maxNumCL) {
- ckfree(clPosition);
+ Tcl_Free(clPosition);
}
} else {
Tcl_ResetResult(interp);
@@ -2387,7 +2389,7 @@ TclSubstTokens(
static inline int
CommandComplete(
const char *script, /* Script to check. */
- int numBytes) /* Number of bytes in script. */
+ size_t numBytes) /* Number of bytes in script. */
{
Tcl_Parse parse;
const char *p, *end;
@@ -2461,7 +2463,7 @@ TclObjCommandComplete(
Tcl_Obj *objPtr) /* Points to object holding script to
* check. */
{
- int length;
+ size_t length;
const char *script = TclGetStringFromObj(objPtr, &length);
return CommandComplete(script, length);
diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c
index 78d87b9..dae903b 100644
--- a/generic/tclPathObj.c
+++ b/generic/tclPathObj.c
@@ -25,7 +25,7 @@ static void DupFsPathInternalRep(Tcl_Obj *srcPtr,
static void FreeFsPathInternalRep(Tcl_Obj *pathPtr);
static void UpdateStringOfFsPath(Tcl_Obj *pathPtr);
static int SetFsPathFromAny(Tcl_Interp *interp, Tcl_Obj *pathPtr);
-static int FindSplitPos(const char *path, int separator);
+static size_t FindSplitPos(const char *path, int separator);
static int IsSeparatorOrNull(int ch);
static Tcl_Obj * GetExtension(Tcl_Obj *pathPtr);
static int MakePathFromNormalized(Tcl_Interp *interp,
@@ -67,7 +67,7 @@ static const Tcl_ObjType fsPathType = {
*
*/
-typedef struct FsPath {
+typedef struct {
Tcl_Obj *translatedPathPtr; /* Name without any ~user sequences. If this
* is NULL, then this is a pure normalized,
* absolute path object, in which the parent
@@ -82,7 +82,7 @@ typedef struct FsPath {
* below. */
ClientData nativePathPtr; /* Native representation of this path, which
* is filesystem dependent. */
- int filesystemEpoch; /* Used to ensure the path representation was
+ size_t filesystemEpoch; /* Used to ensure the path representation was
* generated during the correct filesystem
* epoch. The epoch changes when
* filesystem-mounts are changed. */
@@ -221,14 +221,14 @@ TclFSNormalizeAbsolutePath(
/*
* Need to skip '.' in the path.
*/
- int curLen;
+ size_t curLen;
if (retVal == NULL) {
const char *path = TclGetString(pathPtr);
retVal = Tcl_NewStringObj(path, dirSep - path);
Tcl_IncrRefCount(retVal);
}
- TclGetStringFromObj(retVal, &curLen);
+ (void)TclGetStringFromObj(retVal, &curLen);
if (curLen == 0) {
Tcl_AppendToObj(retVal, dirSep, 1);
}
@@ -241,7 +241,7 @@ TclFSNormalizeAbsolutePath(
}
if (dirSep[2] == '.' && IsSeparatorOrNull(dirSep[3])) {
Tcl_Obj *linkObj;
- int curLen;
+ size_t curLen;
char *linkStr;
/*
@@ -254,7 +254,7 @@ TclFSNormalizeAbsolutePath(
retVal = Tcl_NewStringObj(path, dirSep - path);
Tcl_IncrRefCount(retVal);
}
- TclGetStringFromObj(retVal, &curLen);
+ (void)TclGetStringFromObj(retVal, &curLen);
if (curLen == 0) {
Tcl_AppendToObj(retVal, dirSep, 1);
}
@@ -287,7 +287,7 @@ TclFSNormalizeAbsolutePath(
const char *path =
TclGetStringFromObj(retVal, &curLen);
- while (--curLen >= 0) {
+ while (curLen-- > 0) {
if (IsSeparatorOrNull(path[curLen])) {
break;
}
@@ -320,7 +320,7 @@ TclFSNormalizeAbsolutePath(
*/
if (tclPlatform == TCL_PLATFORM_WINDOWS) {
- int i;
+ size_t i;
for (i = 0; i < curLen; i++) {
if (linkStr[i] == '\\') {
@@ -338,7 +338,7 @@ TclFSNormalizeAbsolutePath(
* not the first character of the path).
*/
- while (--curLen >= 0) {
+ while (curLen-- > 0) {
if (IsSeparatorOrNull(linkStr[curLen])) {
if (curLen) {
Tcl_SetObjLength(retVal, curLen);
@@ -400,7 +400,7 @@ TclFSNormalizeAbsolutePath(
*/
if (tclPlatform == TCL_PLATFORM_WINDOWS) {
- int len;
+ size_t len;
const char *path = TclGetStringFromObj(retVal, &len);
if (len == 2 && path[0] != 0 && path[1] == ':') {
@@ -574,9 +574,8 @@ TclPathPart(
* the standardPath code.
*/
- int numBytes;
- const char *rest =
- TclGetStringFromObj(fsPathPtr->normPathPtr, &numBytes);
+ size_t numBytes;
+ const char *rest = TclGetStringFromObj(fsPathPtr->normPathPtr, &numBytes);
if (strchr(rest, '/') != NULL) {
goto standardPath;
@@ -612,9 +611,8 @@ TclPathPart(
* we don't, and instead just use the standardPath code.
*/
- int numBytes;
- const char *rest =
- TclGetStringFromObj(fsPathPtr->normPathPtr, &numBytes);
+ size_t numBytes;
+ const char *rest = TclGetStringFromObj(fsPathPtr->normPathPtr, &numBytes);
if (strchr(rest, '/') != NULL) {
goto standardPath;
@@ -641,7 +639,7 @@ TclPathPart(
return GetExtension(fsPathPtr->normPathPtr);
case TCL_PATH_ROOT: {
const char *fileName, *extension;
- int length;
+ size_t length;
fileName = TclGetStringFromObj(fsPathPtr->normPathPtr,
&length);
@@ -664,7 +662,7 @@ TclPathPart(
Tcl_Obj *resultPtr =
TclNewFSPathObj(fsPathPtr->cwdPtr, fileName,
- (int)(length - strlen(extension)));
+ length - strlen(extension));
Tcl_IncrRefCount(resultPtr);
return resultPtr;
@@ -692,7 +690,7 @@ TclPathPart(
if (portion == TCL_PATH_EXTENSION) {
return GetExtension(pathPtr);
} else if (portion == TCL_PATH_ROOT) {
- int length;
+ size_t length;
const char *fileName, *extension;
fileName = TclGetStringFromObj(pathPtr, &length);
@@ -702,7 +700,7 @@ TclPathPart(
return pathPtr;
} else {
Tcl_Obj *root = Tcl_NewStringObj(fileName,
- (int) (length - strlen(extension)));
+ length - strlen(extension));
Tcl_IncrRefCount(root);
return root;
@@ -885,7 +883,7 @@ TclJoinPath(
TclGetPathType(tailObj, NULL, NULL, NULL);
if (type == TCL_PATH_RELATIVE) {
const char *str;
- int len;
+ size_t len;
str = TclGetStringFromObj(tailObj, &len);
if (len == 0) {
@@ -916,7 +914,7 @@ TclJoinPath(
*/
if ((tclPlatform != TCL_PLATFORM_WINDOWS)
- || (strchr(Tcl_GetString(elt), '\\') == NULL)) {
+ || (strchr(TclGetString(elt), '\\') == NULL)) {
if (PATHFLAGS(elt)) {
return TclNewFSPathObj(elt, str, len);
@@ -952,7 +950,8 @@ TclJoinPath(
assert ( res == NULL );
for (i = 0; i < elements; i++) {
- int driveNameLength, strEltLen, length;
+ int driveNameLength;
+ size_t strEltLen, length;
Tcl_PathType type;
char *strElt, *ptr;
Tcl_Obj *driveName = NULL;
@@ -1100,9 +1099,9 @@ TclJoinPath(
if (length > 0 && ptr[length -1] != '/') {
Tcl_AppendToObj(res, &separator, 1);
- TclGetStringFromObj(res, &length);
+ (void)TclGetStringFromObj(res, &length);
}
- Tcl_SetObjLength(res, length + (int) strlen(strElt));
+ Tcl_SetObjLength(res, length + strlen(strElt));
ptr = TclGetString(res) + length;
for (; *strElt != '\0'; strElt++) {
@@ -1204,7 +1203,7 @@ IsSeparatorOrNull(
* of the end of the string.
*/
-static int
+static size_t
FindSplitPos(
const char *path,
int separator)
@@ -1258,7 +1257,7 @@ Tcl_Obj *
TclNewFSPathObj(
Tcl_Obj *dirPtr,
const char *addStrRep,
- int len)
+ size_t len)
{
FsPath *fsPathPtr;
Tcl_Obj *pathPtr;
@@ -1290,7 +1289,7 @@ TclNewFSPathObj(
}
pathPtr = Tcl_NewObj();
- fsPathPtr = ckalloc(sizeof(FsPath));
+ fsPathPtr = Tcl_Alloc(sizeof(FsPath));
/*
* Set up the path.
@@ -1315,12 +1314,12 @@ TclNewFSPathObj(
* things as needing more aggressive normalization that don't actually
* need it. No harm done.
*/
- for (p = addStrRep; len > 0; p++, len--) {
+ for (p = addStrRep; len+1 > 1; p++, len--) {
switch (state) {
case 0: /* So far only "." since last dirsep or start */
switch (*p) {
case '.':
- count++;
+ count = 1;
break;
case '/':
case '\\':
@@ -1357,9 +1356,9 @@ AppendPath(
Tcl_Obj *head,
Tcl_Obj *tail)
{
- int numBytes;
const char *bytes;
Tcl_Obj *copy = Tcl_DuplicateObj(head);
+ size_t length;
/*
* This is likely buggy when dealing with virtual filesystem drivers
@@ -1369,8 +1368,8 @@ AppendPath(
* intrep produce the same results; that is, bugward compatibility. If
* we need to fix that bug here, it needs fixing in TclJoinPath() too.
*/
- bytes = TclGetStringFromObj(tail, &numBytes);
- if (numBytes == 0) {
+ bytes = TclGetStringFromObj(tail, &length);
+ if (length == 0) {
Tcl_AppendToObj(copy, "/", 1);
} else {
TclpNativeJoinPath(copy, bytes);
@@ -1406,7 +1405,7 @@ TclFSMakePathRelative(
Tcl_Obj *pathPtr, /* The path we have. */
Tcl_Obj *cwdPtr) /* Make it relative to this. */
{
- int cwdLen, len;
+ size_t cwdLen, len;
const char *tempStr;
Tcl_ObjIntRep *irPtr = TclFetchIntRep(pathPtr, &fsPathType);
@@ -1482,7 +1481,7 @@ MakePathFromNormalized(
return TCL_OK;
}
- fsPathPtr = ckalloc(sizeof(FsPath));
+ fsPathPtr = Tcl_Alloc(sizeof(FsPath));
/*
* It's a pure normalized absolute path.
@@ -1517,7 +1516,7 @@ MakePathFromNormalized(
* Any memory which is allocated for 'clientData' should be retained
* until clientData is passed to the filesystem's freeInternalRepProc
* when it can be freed. The built in platform-specific filesystems use
- * 'ckalloc' to allocate clientData, and ckfree to free it.
+ * 'Tcl_Alloc' to allocate clientData, and Tcl_Free to free it.
*
* Results:
* NULL or a valid path object pointer, with refCount zero.
@@ -1550,7 +1549,7 @@ Tcl_FSNewNativePath(
*/
Tcl_StoreIntRep(pathPtr, &fsPathType, NULL);
- fsPathPtr = ckalloc(sizeof(FsPath));
+ fsPathPtr = Tcl_Alloc(sizeof(FsPath));
fsPathPtr->translatedPathPtr = NULL;
@@ -1675,9 +1674,9 @@ Tcl_FSGetTranslatedStringPath(
Tcl_Obj *transPtr = Tcl_FSGetTranslatedPath(interp, pathPtr);
if (transPtr != NULL) {
- int len;
+ size_t len;
const char *orig = TclGetStringFromObj(transPtr, &len);
- char *result = ckalloc(len+1);
+ char *result = Tcl_Alloc(len+1);
memcpy(result, orig, len+1);
TclDecrRefCount(transPtr);
@@ -1725,7 +1724,8 @@ Tcl_FSGetNormalizedPath(
*/
Tcl_Obj *dir, *copy;
- int tailLen, cwdLen, pathType;
+ size_t tailLen, cwdLen;
+ int pathType;
pathType = Tcl_FSGetPathType(fsPathPtr->cwdPtr);
dir = Tcl_FSGetNormalizedPath(interp, fsPathPtr->cwdPtr);
@@ -1735,7 +1735,7 @@ Tcl_FSGetNormalizedPath(
/* TODO: Figure out why this is needed. */
TclGetString(pathPtr);
- TclGetStringFromObj(fsPathPtr->normPathPtr, &tailLen);
+ (void)TclGetStringFromObj(fsPathPtr->normPathPtr, &tailLen);
if (tailLen) {
copy = AppendPath(dir, fsPathPtr->normPathPtr);
} else {
@@ -1835,13 +1835,13 @@ Tcl_FSGetNormalizedPath(
}
fsPathPtr = PATHOBJ(pathPtr);
} else if (fsPathPtr->normPathPtr == NULL) {
- int cwdLen;
+ size_t cwdLen;
Tcl_Obj *copy;
copy = AppendPath(fsPathPtr->cwdPtr, pathPtr);
(void) TclGetStringFromObj(fsPathPtr->cwdPtr, &cwdLen);
- cwdLen += (Tcl_GetString(copy)[cwdLen] == '/');
+ cwdLen += (TclGetString(copy)[cwdLen] == '/');
/*
* Normalize the combined string, but only starting after the end
@@ -2180,7 +2180,8 @@ Tcl_FSEqualPaths(
Tcl_Obj *secondPtr)
{
const char *firstStr, *secondStr;
- int firstLen, secondLen, tempErrno;
+ size_t firstLen, secondLen;
+ int tempErrno;
if (firstPtr == secondPtr) {
return 1;
@@ -2239,7 +2240,7 @@ SetFsPathFromAny(
Tcl_Interp *interp, /* Used for error reporting if not NULL. */
Tcl_Obj *pathPtr) /* The object to convert. */
{
- int len;
+ size_t len;
FsPath *fsPathPtr;
Tcl_Obj *transPtr;
const char *name;
@@ -2270,7 +2271,7 @@ SetFsPathFromAny(
if (len && name[0] == '~') {
Tcl_DString temp;
- int split;
+ size_t split;
char separator = '/';
/*
@@ -2358,7 +2359,8 @@ SetFsPathFromAny(
objc--; objv++;
while (objc--) {
- TclpNativeJoinPath(transPtr, Tcl_GetString(*objv++));
+ TclpNativeJoinPath(transPtr, TclGetString(*objv));
+ objv++;
}
TclDecrRefCount(parts);
} else {
@@ -2384,7 +2386,7 @@ SetFsPathFromAny(
* slashes on Windows, and will not contain any ~user sequences.
*/
- fsPathPtr = ckalloc(sizeof(FsPath));
+ fsPathPtr = Tcl_Alloc(sizeof(FsPath));
if (transPtr == pathPtr) {
transPtr = Tcl_DuplicateObj(pathPtr);
@@ -2435,7 +2437,7 @@ FreeFsPathInternalRep(
}
}
- ckfree(fsPathPtr);
+ Tcl_Free(fsPathPtr);
}
static void
@@ -2444,7 +2446,7 @@ DupFsPathInternalRep(
Tcl_Obj *copyPtr) /* Path obj with internal rep to set. */
{
FsPath *srcFsPathPtr = PATHOBJ(srcPtr);
- FsPath *copyFsPathPtr = ckalloc(sizeof(FsPath));
+ FsPath *copyFsPathPtr = Tcl_Alloc(sizeof(FsPath));
SETPATHOBJ(copyPtr, copyFsPathPtr);
@@ -2504,7 +2506,7 @@ UpdateStringOfFsPath(
register Tcl_Obj *pathPtr) /* path obj with string rep to update. */
{
FsPath *fsPathPtr = PATHOBJ(pathPtr);
- int cwdLen;
+ size_t cwdLen;
Tcl_Obj *copy;
if (PATHFLAGS(pathPtr) == 0 || fsPathPtr->cwdPtr == NULL) {
@@ -2576,7 +2578,7 @@ TclNativePathInFilesystem(
* situation.
*/
- int len;
+ size_t len;
(void) TclGetStringFromObj(pathPtr, &len);
if (len == 0) {
diff --git a/generic/tclPipe.c b/generic/tclPipe.c
index 63fd2fa..4e16980 100644
--- a/generic/tclPipe.c
+++ b/generic/tclPipe.c
@@ -188,7 +188,7 @@ Tcl_DetachPids(
Tcl_MutexLock(&pipeMutex);
for (i = 0; i < numPids; i++) {
- detPtr = ckalloc(sizeof(Detached));
+ detPtr = Tcl_Alloc(sizeof(Detached));
detPtr->pid = pidPtr[i];
detPtr->nextPtr = detList;
detList = detPtr;
@@ -238,7 +238,7 @@ Tcl_ReapDetachedProcs(void)
} else {
prevPtr->nextPtr = detPtr->nextPtr;
}
- ckfree(detPtr);
+ Tcl_Free(detPtr);
detPtr = nextPtr;
}
Tcl_MutexUnlock(&pipeMutex);
@@ -336,7 +336,7 @@ TclCleanupChildren(
Tcl_Seek(errorChan, 0, SEEK_SET);
objPtr = Tcl_NewObj();
count = Tcl_ReadChars(errorChan, objPtr, -1, 0);
- if (count < 0) {
+ if (count == -1) {
result = TCL_ERROR;
Tcl_DecrRefCount(objPtr);
Tcl_ResetResult(interp);
@@ -824,7 +824,7 @@ TclCreatePipeline(
*/
Tcl_ReapDetachedProcs();
- pidPtr = ckalloc(cmdCount * sizeof(Tcl_Pid));
+ pidPtr = Tcl_Alloc(cmdCount * sizeof(Tcl_Pid));
curInFile = inputFile;
@@ -978,7 +978,7 @@ TclCreatePipeline(
Tcl_DetachPids(1, &pidPtr[i]);
}
}
- ckfree(pidPtr);
+ Tcl_Free(pidPtr);
}
numPids = -1;
goto cleanup;
@@ -1082,7 +1082,7 @@ Tcl_OpenCommandChannel(
error:
if (numPids > 0) {
Tcl_DetachPids(numPids, pidPtr);
- ckfree(pidPtr);
+ Tcl_Free(pidPtr);
}
if (inPipe != NULL) {
TclpCloseFile(inPipe);
diff --git a/generic/tclPkg.c b/generic/tclPkg.c
index 6727715..700323f 100644
--- a/generic/tclPkg.c
+++ b/generic/tclPkg.c
@@ -57,7 +57,7 @@ typedef struct PkgFiles {
* "Tk" (no version number).
*/
-typedef struct Package {
+typedef struct {
Tcl_Obj *version;
PkgAvail *availPtr; /* First in list of all available versions of
* this package. */
@@ -111,7 +111,7 @@ static int TclNRPackageObjCmdCleanup(ClientData data[], Tcl_Interp *interp, int
*/
#define DupBlock(v,s,len) \
- ((v) = ckalloc(len), memcpy((v),(s),(len)))
+ ((v) = Tcl_Alloc(len), memcpy((v),(s),(len)))
#define DupString(v,s) \
do { \
size_t local__len = strlen(s) + 1; \
@@ -175,13 +175,13 @@ Tcl_PkgProvideEx(
NULL) != TCL_OK) {
return TCL_ERROR;
} else if (CheckVersionAndConvert(interp, version, &vi, NULL) != TCL_OK) {
- ckfree(pvi);
+ Tcl_Free(pvi);
return TCL_ERROR;
}
res = CompareVersions(pvi, vi, NULL);
- ckfree(pvi);
- ckfree(vi);
+ Tcl_Free(pvi);
+ Tcl_Free(vi);
if (res == 0) {
if (clientData != NULL) {
@@ -236,7 +236,7 @@ PkgFilesCleanupProc(
PkgName *name = pkgFiles->names;
pkgFiles->names = name->nextPtr;
- ckfree(name);
+ Tcl_Free(name);
}
entry = Tcl_FirstHashEntry(&pkgFiles->table, &search);
while (entry) {
@@ -246,7 +246,7 @@ PkgFilesCleanupProc(
entry = Tcl_NextHashEntry(&search);
}
Tcl_DeleteHashTable(&pkgFiles->table);
- ckfree(pkgFiles);
+ Tcl_Free(pkgFiles);
return;
}
@@ -261,7 +261,7 @@ TclInitPkgFiles(
PkgFiles *pkgFiles = Tcl_GetAssocData(interp, "tclPkgFiles", NULL);
if (!pkgFiles) {
- pkgFiles = ckalloc(sizeof(PkgFiles));
+ pkgFiles = Tcl_Alloc(sizeof(PkgFiles));
pkgFiles->names = NULL;
Tcl_InitHashTable(&pkgFiles->table, TCL_STRING_KEYS);
Tcl_SetAssocData(interp, "tclPkgFiles", PkgFilesCleanupProc, pkgFiles);
@@ -470,7 +470,7 @@ PkgRequireCore(
if (code != TCL_OK) {
return code;
}
- reqPtr = ckalloc(sizeof(Require));
+ reqPtr = Tcl_Alloc(sizeof(Require));
Tcl_NRAddCallback(interp, PkgRequireCoreCleanup, reqPtr, NULL, NULL, NULL);
reqPtr->clientDataPtr = data[3];
reqPtr->name = name;
@@ -610,7 +610,7 @@ PkgRequireCoreFinal(
&pkgVersionI, NULL);
satisfies = SomeRequirementSatisfied(pkgVersionI, reqc, reqv);
- ckfree(pkgVersionI);
+ Tcl_Free(pkgVersionI);
if (!satisfies) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
@@ -638,7 +638,7 @@ PkgRequireCoreCleanup(
Tcl_Interp *interp,
int result)
{
- ckfree(data[0]);
+ Tcl_Free(data[0]);
return result;
}
@@ -707,7 +707,7 @@ SelectPackage(
if (reqc > 0) {
satisfies = SomeRequirementSatisfied(availVersion, reqc, reqv);
if (!satisfies) {
- ckfree(availVersion);
+ Tcl_Free(availVersion);
availVersion = NULL;
continue;
}
@@ -726,7 +726,7 @@ SelectPackage(
* currently selected version.
*/
- ckfree(bestVersion);
+ Tcl_Free(bestVersion);
bestVersion = NULL;
goto newbest;
}
@@ -741,7 +741,7 @@ SelectPackage(
}
if (!availStable) {
- ckfree(availVersion);
+ Tcl_Free(availVersion);
availVersion = NULL;
continue;
}
@@ -759,7 +759,7 @@ SelectPackage(
* the currently selected stable version.
*/
- ckfree(bestStableVersion);
+ Tcl_Free(bestStableVersion);
bestStableVersion = NULL;
goto newstable;
}
@@ -775,7 +775,7 @@ SelectPackage(
&bestStableVersion, NULL);
}
- ckfree(availVersion);
+ Tcl_Free(availVersion);
availVersion = NULL;
} /* end for */
@@ -784,12 +784,12 @@ SelectPackage(
*/
if (bestVersion != NULL) {
- ckfree(bestVersion);
+ Tcl_Free(bestVersion);
bestVersion = NULL;
}
if (bestStableVersion != NULL) {
- ckfree(bestStableVersion);
+ Tcl_Free(bestStableVersion);
bestStableVersion = NULL;
}
@@ -828,7 +828,7 @@ SelectPackage(
* Push "ifneeded" package name in "tclPkgFiles" assocdata.
*/
- pkgName = ckalloc(sizeof(PkgName) + strlen(name));
+ pkgName = Tcl_Alloc(sizeof(PkgName) + strlen(name));
pkgName->nextPtr = pkgFiles->names;
strcpy(pkgName->name, name);
pkgFiles->names = pkgName;
@@ -864,7 +864,7 @@ SelectPackageFinal(
PkgFiles *pkgFiles = Tcl_GetAssocData(interp, "tclPkgFiles", NULL);
PkgName *pkgName = pkgFiles->names;
pkgFiles->names = pkgName->nextPtr;
- ckfree(pkgName);
+ Tcl_Free(pkgName);
reqPtr->pkgPtr = FindPackage(interp, name);
if (result == TCL_OK) {
@@ -885,13 +885,13 @@ SelectPackageFinal(
result = TCL_ERROR;
} else if (CheckVersionAndConvert(interp,
versionToProvide, &vi, NULL) != TCL_OK) {
- ckfree(pvi);
+ Tcl_Free(pvi);
result = TCL_ERROR;
} else {
int res = CompareVersions(pvi, vi, NULL);
- ckfree(pvi);
- ckfree(vi);
+ Tcl_Free(pvi);
+ Tcl_Free(vi);
if (res != 0) {
result = TCL_ERROR;
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
@@ -1109,8 +1109,9 @@ TclNRPackageObjCmd(
}
pkgFiles = (PkgFiles *) Tcl_GetAssocData(interp, "tclPkgFiles", NULL);
if (pkgFiles) {
- Tcl_HashEntry *entry =
- Tcl_FindHashEntry(&pkgFiles->table, Tcl_GetString(objv[2]));
+ Tcl_HashEntry *entry = Tcl_FindHashEntry(&pkgFiles->table,
+ TclGetString(objv[2]));
+
if (entry) {
Tcl_SetObjResult(interp, (Tcl_Obj *)Tcl_GetHashValue(entry));
}
@@ -1151,14 +1152,15 @@ TclNRPackageObjCmd(
Tcl_EventuallyFree(availPtr->pkgIndex, TCL_DYNAMIC);
availPtr->pkgIndex = NULL;
}
- ckfree(availPtr);
+ Tcl_Free(availPtr);
}
- ckfree(pkgPtr);
+ Tcl_Free(pkgPtr);
}
break;
}
case PKG_IFNEEDED: {
- int length, res;
+ size_t length;
+ int res;
char *argv3i, *avi;
if ((objc != 4) && (objc != 5)) {
@@ -1173,7 +1175,7 @@ TclNRPackageObjCmd(
if (objc == 4) {
hPtr = Tcl_FindHashEntry(&iPtr->packageTable, argv2);
if (hPtr == NULL) {
- ckfree(argv3i);
+ Tcl_Free(argv3i);
return TCL_OK;
}
pkgPtr = Tcl_GetHashValue(hPtr);
@@ -1186,16 +1188,16 @@ TclNRPackageObjCmd(
prevPtr = availPtr, availPtr = availPtr->nextPtr) {
if (CheckVersionAndConvert(interp, availPtr->version, &avi,
NULL) != TCL_OK) {
- ckfree(argv3i);
+ Tcl_Free(argv3i);
return TCL_ERROR;
}
res = CompareVersions(avi, argv3i, NULL);
- ckfree(avi);
+ Tcl_Free(avi);
if (res == 0) {
if (objc == 4) {
- ckfree(argv3i);
+ Tcl_Free(argv3i);
Tcl_SetObjResult(interp,
Tcl_NewStringObj(availPtr->script, -1));
return TCL_OK;
@@ -1208,13 +1210,13 @@ TclNRPackageObjCmd(
break;
}
}
- ckfree(argv3i);
+ Tcl_Free(argv3i);
if (objc == 4) {
return TCL_OK;
}
if (availPtr == NULL) {
- availPtr = ckalloc(sizeof(PkgAvail));
+ availPtr = Tcl_Alloc(sizeof(PkgAvail));
availPtr->pkgIndex = NULL;
DupBlock(availPtr->version, argv3, length + 1);
@@ -1396,7 +1398,7 @@ TclNRPackageObjCmd(
}
break;
case PKG_UNKNOWN: {
- int length;
+ size_t length;
if (objc == 2) {
if (iPtr->packageUnknown != NULL) {
@@ -1405,7 +1407,7 @@ TclNRPackageObjCmd(
}
} else if (objc == 3) {
if (iPtr->packageUnknown != NULL) {
- ckfree(iPtr->packageUnknown);
+ Tcl_Free(iPtr->packageUnknown);
}
argv2 = TclGetStringFromObj(objv[2], &length);
if (argv2[0] == 0) {
@@ -1466,7 +1468,7 @@ TclNRPackageObjCmd(
if (CheckVersionAndConvert(interp, argv2, &iva, NULL) != TCL_OK ||
CheckVersionAndConvert(interp, argv3, &ivb, NULL) != TCL_OK) {
if (iva != NULL) {
- ckfree(iva);
+ Tcl_Free(iva);
}
/*
@@ -1482,8 +1484,8 @@ TclNRPackageObjCmd(
Tcl_SetObjResult(interp,
Tcl_NewIntObj(CompareVersions(iva, ivb, NULL)));
- ckfree(iva);
- ckfree(ivb);
+ Tcl_Free(iva);
+ Tcl_Free(ivb);
break;
case PKG_VERSIONS:
if (objc != 3) {
@@ -1517,12 +1519,12 @@ TclNRPackageObjCmd(
if (CheckVersionAndConvert(interp, argv2, &argv2i, NULL) != TCL_OK) {
return TCL_ERROR;
} else if (CheckAllRequirements(interp, objc-3, objv+3) != TCL_OK) {
- ckfree(argv2i);
+ Tcl_Free(argv2i);
return TCL_ERROR;
}
satisfies = SomeRequirementSatisfied(argv2i, objc-3, objv+3);
- ckfree(argv2i);
+ Tcl_Free(argv2i);
Tcl_SetObjResult(interp, Tcl_NewBooleanObj(satisfies));
break;
@@ -1574,7 +1576,7 @@ FindPackage(
hPtr = Tcl_CreateHashEntry(&iPtr->packageTable, name, &isNew);
if (isNew) {
- pkgPtr = ckalloc(sizeof(Package));
+ pkgPtr = Tcl_Alloc(sizeof(Package));
pkgPtr->version = NULL;
pkgPtr->availPtr = NULL;
pkgPtr->clientData = NULL;
@@ -1626,13 +1628,13 @@ TclFreePackageInfo(
Tcl_EventuallyFree(availPtr->pkgIndex, TCL_DYNAMIC);
availPtr->pkgIndex = NULL;
}
- ckfree(availPtr);
+ Tcl_Free(availPtr);
}
- ckfree(pkgPtr);
+ Tcl_Free(pkgPtr);
}
Tcl_DeleteHashTable(&iPtr->packageTable);
if (iPtr->packageUnknown != NULL) {
- ckfree(iPtr->packageUnknown);
+ Tcl_Free(iPtr->packageUnknown);
}
}
@@ -1672,7 +1674,7 @@ CheckVersionAndConvert(
* 4* assuming that each char is a separator (a,b become ' -x ').
* 4+ to have spce for an additional -2 at the end
*/
- char *ibuf = ckalloc(4 + 4*strlen(string));
+ char *ibuf = Tcl_Alloc(4 + 4*strlen(string));
char *ip = ibuf;
/*
@@ -1740,7 +1742,7 @@ CheckVersionAndConvert(
if (internal != NULL) {
*internal = ibuf;
} else {
- ckfree(ibuf);
+ Tcl_Free(ibuf);
}
if (stable != NULL) {
*stable = !hasunstable;
@@ -1749,7 +1751,7 @@ CheckVersionAndConvert(
}
error:
- ckfree(ibuf);
+ Tcl_Free(ibuf);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"expected version number but got \"%s\"", string));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "VERSION", NULL);
@@ -2023,7 +2025,7 @@ CheckRequirement(
* Exactly one dash is present. Copy the string, split at the location of
* dash and check that both parts are versions. Note that the max part can
* be empty. Also note that the string allocated with strdup() must be
- * freed with free() and not ckfree().
+ * freed with free() and not Tcl_Free().
*/
DupString(buf, string);
@@ -2034,11 +2036,11 @@ CheckRequirement(
if ((CheckVersionAndConvert(interp, buf, NULL, NULL) != TCL_OK) ||
((*dash != '\0') &&
(CheckVersionAndConvert(interp, dash, NULL, NULL) != TCL_OK))) {
- ckfree(buf);
+ Tcl_Free(buf);
return TCL_ERROR;
}
- ckfree(buf);
+ Tcl_Free(buf);
return TCL_OK;
}
@@ -2067,7 +2069,8 @@ AddRequirementsToResult(
* available. */
{
Tcl_Obj *result = Tcl_GetObjResult(interp);
- int i, length;
+ int i;
+ size_t length;
for (i = 0; i < reqc; i++) {
const char *v = TclGetStringFromObj(reqv[i], &length);
@@ -2203,7 +2206,7 @@ RequirementSatisfied(
strcat(reqi, " -2");
res = CompareVersions(havei, reqi, &thisIsMajor);
satisfied = (res == 0) || ((res == 1) && !thisIsMajor);
- ckfree(reqi);
+ Tcl_Free(reqi);
return satisfied;
}
@@ -2227,8 +2230,8 @@ RequirementSatisfied(
CheckVersionAndConvert(NULL, buf, &min, NULL);
strcat(min, " -2");
satisfied = (CompareVersions(havei, min, NULL) >= 0);
- ckfree(min);
- ckfree(buf);
+ Tcl_Free(min);
+ Tcl_Free(buf);
return satisfied;
}
@@ -2250,9 +2253,9 @@ RequirementSatisfied(
(CompareVersions(havei, max, NULL) < 0));
}
- ckfree(min);
- ckfree(max);
- ckfree(buf);
+ Tcl_Free(min);
+ Tcl_Free(max);
+ Tcl_Free(buf);
return satisfied;
}
@@ -2281,7 +2284,7 @@ Tcl_PkgInitStubsCheck(
const char * version,
int exact)
{
- const char *actualVersion = Tcl_PkgPresent(interp, "Tcl", version, 0);
+ const char *actualVersion = Tcl_PkgPresentEx(interp, "Tcl", version, 0, NULL);
if ((exact&1) && actualVersion) {
const char *p = version;
@@ -2293,11 +2296,11 @@ Tcl_PkgInitStubsCheck(
if (count == 1) {
if (0 != strncmp(version, actualVersion, strlen(version))) {
/* Construct error message */
- Tcl_PkgPresent(interp, "Tcl", version, 1);
+ Tcl_PkgPresentEx(interp, "Tcl", version, 1, NULL);
return NULL;
}
} else {
- return Tcl_PkgPresent(interp, "Tcl", version, 1);
+ return Tcl_PkgPresentEx(interp, "Tcl", version, 1, NULL);
}
}
return actualVersion;
diff --git a/generic/tclPlatDecls.h b/generic/tclPlatDecls.h
index abc8ee8..7218490 100644
--- a/generic/tclPlatDecls.h
+++ b/generic/tclPlatDecls.h
@@ -52,22 +52,22 @@ extern "C" {
#if defined(_WIN32) || defined(__CYGWIN__) /* WIN */
/* 0 */
-EXTERN TCHAR * Tcl_WinUtfToTChar(const char *str, int len,
+EXTERN TCHAR * Tcl_WinUtfToTChar(const char *str, size_t len,
Tcl_DString *dsPtr);
/* 1 */
-EXTERN char * Tcl_WinTCharToUtf(const TCHAR *str, int len,
+EXTERN char * Tcl_WinTCharToUtf(const TCHAR *str, size_t len,
Tcl_DString *dsPtr);
#endif /* WIN */
#ifdef MAC_OSX_TCL /* MACOSX */
/* 0 */
EXTERN int Tcl_MacOSXOpenBundleResources(Tcl_Interp *interp,
const char *bundleName, int hasResourceFile,
- int maxPathLen, char *libraryPath);
+ size_t maxPathLen, char *libraryPath);
/* 1 */
EXTERN int Tcl_MacOSXOpenVersionedBundleResources(
Tcl_Interp *interp, const char *bundleName,
const char *bundleVersion,
- int hasResourceFile, int maxPathLen,
+ int hasResourceFile, size_t maxPathLen,
char *libraryPath);
#endif /* MACOSX */
@@ -76,12 +76,12 @@ typedef struct TclPlatStubs {
void *hooks;
#if defined(_WIN32) || defined(__CYGWIN__) /* WIN */
- TCHAR * (*tcl_WinUtfToTChar) (const char *str, int len, Tcl_DString *dsPtr); /* 0 */
- char * (*tcl_WinTCharToUtf) (const TCHAR *str, int len, Tcl_DString *dsPtr); /* 1 */
+ TCHAR * (*tcl_WinUtfToTChar) (const char *str, size_t len, Tcl_DString *dsPtr); /* 0 */
+ char * (*tcl_WinTCharToUtf) (const TCHAR *str, size_t len, Tcl_DString *dsPtr); /* 1 */
#endif /* WIN */
#ifdef MAC_OSX_TCL /* MACOSX */
- int (*tcl_MacOSXOpenBundleResources) (Tcl_Interp *interp, const char *bundleName, int hasResourceFile, int maxPathLen, char *libraryPath); /* 0 */
- int (*tcl_MacOSXOpenVersionedBundleResources) (Tcl_Interp *interp, const char *bundleName, const char *bundleVersion, int hasResourceFile, int maxPathLen, char *libraryPath); /* 1 */
+ int (*tcl_MacOSXOpenBundleResources) (Tcl_Interp *interp, const char *bundleName, int hasResourceFile, size_t maxPathLen, char *libraryPath); /* 0 */
+ int (*tcl_MacOSXOpenVersionedBundleResources) (Tcl_Interp *interp, const char *bundleName, const char *bundleVersion, int hasResourceFile, size_t maxPathLen, char *libraryPath); /* 1 */
#endif /* MACOSX */
} TclPlatStubs;
diff --git a/generic/tclPreserve.c b/generic/tclPreserve.c
index 5c6097f..695eeb9 100644
--- a/generic/tclPreserve.c
+++ b/generic/tclPreserve.c
@@ -37,9 +37,9 @@ typedef struct {
*/
static Reference *refArray = NULL; /* First in array of references. */
-static int spaceAvl = 0; /* Total number of structures available at
+static size_t spaceAvl = 0; /* Total number of structures available at
* *firstRefPtr. */
-static int inUse = 0; /* Count of structures currently in use in
+static size_t inUse = 0; /* Count of structures currently in use in
* refArray. */
TCL_DECLARE_MUTEX(preserveMutex)/* To protect the above statics */
@@ -53,7 +53,7 @@ TCL_DECLARE_MUTEX(preserveMutex)/* To protect the above statics */
* objects that we don't want to live any longer than necessary.
*/
-typedef struct HandleStruct {
+typedef struct {
void *ptr; /* Pointer to the memory block being tracked.
* This field will become NULL when the memory
* block is deleted. This field must be the
@@ -89,7 +89,7 @@ TclFinalizePreserve(void)
{
Tcl_MutexLock(&preserveMutex);
if (spaceAvl != 0) {
- ckfree(refArray);
+ Tcl_Free(refArray);
refArray = NULL;
inUse = 0;
spaceAvl = 0;
@@ -121,7 +121,7 @@ Tcl_Preserve(
ClientData clientData) /* Pointer to malloc'ed block of memory. */
{
Reference *refPtr;
- int i;
+ size_t i;
/*
* See if there is already a reference for this pointer. If so, just
@@ -144,7 +144,7 @@ Tcl_Preserve(
if (inUse == spaceAvl) {
spaceAvl = spaceAvl ? 2*spaceAvl : INITIAL_SIZE;
- refArray = ckrealloc(refArray, spaceAvl * sizeof(Reference));
+ refArray = Tcl_Realloc(refArray, spaceAvl * sizeof(Reference));
}
/*
@@ -184,7 +184,7 @@ Tcl_Release(
ClientData clientData) /* Pointer to malloc'ed block of memory. */
{
Reference *refPtr;
- int i;
+ size_t i;
Tcl_MutexLock(&preserveMutex);
for (i=0, refPtr=refArray ; i<inUse ; i++, refPtr++) {
@@ -224,7 +224,7 @@ Tcl_Release(
Tcl_MutexUnlock(&preserveMutex);
if (mustFree) {
if (freeProc == TCL_DYNAMIC) {
- ckfree(clientData);
+ Tcl_Free(clientData);
} else {
freeProc(clientData);
}
@@ -264,7 +264,7 @@ Tcl_EventuallyFree(
Tcl_FreeProc *freeProc) /* Function to actually do free. */
{
Reference *refPtr;
- int i;
+ size_t i;
/*
* See if there is a reference for this pointer. If so, set its "mustFree"
@@ -291,7 +291,7 @@ Tcl_EventuallyFree(
*/
if (freeProc == TCL_DYNAMIC) {
- ckfree(clientData);
+ Tcl_Free(clientData);
} else {
freeProc(clientData);
}
@@ -327,7 +327,7 @@ TclHandleCreate(
* be tracked for deletion. Must not be
* NULL. */
{
- HandleStruct *handlePtr = ckalloc(sizeof(HandleStruct));
+ HandleStruct *handlePtr = Tcl_Alloc(sizeof(HandleStruct));
handlePtr->ptr = ptr;
#ifdef TCL_MEM_DEBUG
@@ -377,7 +377,7 @@ TclHandleFree(
#endif
handlePtr->ptr = NULL;
if (handlePtr->refCount == 0) {
- ckfree(handlePtr);
+ Tcl_Free(handlePtr);
}
}
@@ -460,7 +460,7 @@ TclHandleRelease(
}
#endif
if ((handlePtr->refCount-- <= 1) && (handlePtr->ptr == NULL)) {
- ckfree(handlePtr);
+ Tcl_Free(handlePtr);
}
}
diff --git a/generic/tclProc.c b/generic/tclProc.c
index 1ed48ac..b4192c0 100644
--- a/generic/tclProc.c
+++ b/generic/tclProc.c
@@ -263,11 +263,11 @@ Tcl_ProcObjCmd(
&& (contextPtr->nline >= 4) && (contextPtr->line[3] >= 0)) {
int isNew;
Tcl_HashEntry *hePtr;
- CmdFrame *cfPtr = ckalloc(sizeof(CmdFrame));
+ CmdFrame *cfPtr = Tcl_Alloc(sizeof(CmdFrame));
cfPtr->level = -1;
cfPtr->type = contextPtr->type;
- cfPtr->line = ckalloc(sizeof(int));
+ cfPtr->line = Tcl_Alloc(sizeof(int));
cfPtr->line[0] = contextPtr->line[3];
cfPtr->nline = 1;
cfPtr->framePtr = NULL;
@@ -295,9 +295,9 @@ Tcl_ProcObjCmd(
Tcl_DecrRefCount(cfOldPtr->data.eval.path);
cfOldPtr->data.eval.path = NULL;
}
- ckfree(cfOldPtr->line);
+ Tcl_Free(cfOldPtr->line);
cfOldPtr->line = NULL;
- ckfree(cfOldPtr);
+ Tcl_Free(cfOldPtr);
}
Tcl_SetHashValue(hePtr, cfPtr);
}
@@ -329,7 +329,7 @@ Tcl_ProcObjCmd(
* of all procs whose argument list is just _args_
*/
- if (TclHasIntRep(objv[3], &tclProcBodyType)) {
+ if (objv[3]->typePtr == &tclProcBodyType) {
goto done;
}
@@ -340,7 +340,7 @@ Tcl_ProcObjCmd(
}
if ((procArgs[0] == 'a') && (strncmp(procArgs, "args", 4) == 0)) {
- int numBytes;
+ size_t numBytes;
procArgs +=4;
while (*procArgs != '\0') {
@@ -446,7 +446,7 @@ TclCreateProc(
if (Tcl_IsShared(bodyPtr)) {
const char *bytes;
- int length;
+ size_t length;
Tcl_Obj *sharedBodyPtr = bodyPtr;
bytes = TclGetStringFromObj(bodyPtr, &length);
@@ -469,7 +469,7 @@ TclCreateProc(
Tcl_IncrRefCount(bodyPtr);
- procPtr = ckalloc(sizeof(Proc));
+ procPtr = Tcl_Alloc(sizeof(Proc));
procPtr->iPtr = iPtr;
procPtr->refCount = 1;
procPtr->bodyPtr = bodyPtr;
@@ -509,7 +509,8 @@ TclCreateProc(
for (i = 0; i < numArgs; i++) {
const char *argname, *argnamei, *argnamelast;
- int fieldCount, nameLength;
+ int fieldCount;
+ size_t nameLength;
Tcl_Obj **fieldValues;
/*
@@ -539,7 +540,7 @@ TclCreateProc(
goto procError;
}
- argname = Tcl_GetStringFromObj(fieldValues[0], &nameLength);
+ argname = TclGetStringFromObj(fieldValues[0], &nameLength);
/*
* Check that the formal parameter name is a scalar.
@@ -552,7 +553,7 @@ TclCreateProc(
if (*argnamelast == ')') { /* We have an array element. */
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"formal parameter \"%s\" is an array element",
- Tcl_GetString(fieldValues[0])));
+ TclGetString(fieldValues[0])));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC",
"FORMALARGUMENTFORMAT", NULL);
goto procError;
@@ -601,10 +602,9 @@ TclCreateProc(
*/
if (localPtr->defValuePtr != NULL) {
- const char *tmpPtr = TclGetString(localPtr->defValuePtr);
- size_t tmpLength = localPtr->defValuePtr->length;
- const char *value = TclGetString(fieldValues[1]);
- size_t valueLength = fieldValues[1]->length;
+ size_t tmpLength, valueLength;
+ const char *tmpPtr = TclGetStringFromObj(localPtr->defValuePtr, &tmpLength);
+ const char *value = TclGetStringFromObj(fieldValues[1], &valueLength);
if ((valueLength != tmpLength)
|| memcmp(value, tmpPtr, tmpLength) != 0
@@ -634,7 +634,7 @@ TclCreateProc(
* local variables for the argument.
*/
- localPtr = ckalloc(offsetof(CompiledLocal, name) + fieldValues[0]->length +1);
+ localPtr = Tcl_Alloc(offsetof(CompiledLocal, name) + fieldValues[0]->length +1);
if (procPtr->firstLocalPtr == NULL) {
procPtr->firstLocalPtr = procPtr->lastLocalPtr = localPtr;
} else {
@@ -679,9 +679,9 @@ TclCreateProc(
Tcl_DecrRefCount(localPtr->defValuePtr);
}
- ckfree(localPtr);
+ Tcl_Free(localPtr);
}
- ckfree(procPtr);
+ Tcl_Free(procPtr);
}
return TCL_ERROR;
}
@@ -1054,11 +1054,7 @@ ProcWrongNumArgs(
if (framePtr->isProcCallFrame & FRAME_IS_LAMBDA) {
desiredObjs[0] = Tcl_NewStringObj("lambdaExpr", -1);
} else {
-#ifdef AVOID_HACKS_FOR_ITCL
desiredObjs[0] = framePtr->objv[skip-1];
-#else
- desiredObjs[0] = Tcl_NewListObj(1, framePtr->objv + skip - 1);
-#endif /* AVOID_HACKS_FOR_ITCL */
}
Tcl_IncrRefCount(desiredObjs[0]);
@@ -1198,7 +1194,7 @@ InitResolvedLocals(
if (localPtr->resolveInfo->deleteProc) {
localPtr->resolveInfo->deleteProc(localPtr->resolveInfo);
} else {
- ckfree(localPtr->resolveInfo);
+ Tcl_Free(localPtr->resolveInfo);
}
localPtr->resolveInfo = NULL;
}
@@ -1284,7 +1280,7 @@ TclFreeLocalCache(
TclReleaseLiteral(interp, objPtr);
}
}
- ckfree(localCachePtr);
+ Tcl_Free(localCachePtr);
}
static void
@@ -1310,7 +1306,7 @@ InitLocalCache(
* for future calls.
*/
- localCachePtr = ckalloc(sizeof(LocalCache)
+ localCachePtr = Tcl_Alloc(sizeof(LocalCache)
+ (localCt - 1) * sizeof(Tcl_Obj *)
+ numArgs * sizeof(Var));
@@ -1322,7 +1318,7 @@ InitLocalCache(
*namePtr = NULL;
} else {
*namePtr = TclCreateLiteral(iPtr, localPtr->name,
- localPtr->nameLength, /* hash */ (unsigned int) -1,
+ localPtr->nameLength, /* hash */ -1,
&isNew, /* nsPtr */ NULL, 0, NULL);
Tcl_IncrRefCount(*namePtr);
}
@@ -1995,10 +1991,10 @@ TclProcCompileProc(
if (toFree->resolveInfo->deleteProc) {
toFree->resolveInfo->deleteProc(toFree->resolveInfo);
} else {
- ckfree(toFree->resolveInfo);
+ Tcl_Free(toFree->resolveInfo);
}
}
- ckfree(toFree);
+ Tcl_Free(toFree);
}
procPtr->numCompiledLocals = procPtr->numArgs;
}
@@ -2059,13 +2055,14 @@ MakeProcError(
Tcl_Obj *procNameObj) /* Name of the procedure. Used for error
* messages and trace information. */
{
- int overflow, limit = 60, nameLen;
+ unsigned int overflow, limit = 60;
+ size_t nameLen;
const char *procName = TclGetStringFromObj(procNameObj, &nameLen);
overflow = (nameLen > limit);
Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
"\n (procedure \"%.*s%s\" line %d)",
- (overflow ? limit : nameLen), procName,
+ (int)(overflow ? limit :nameLen), procName,
(overflow ? "..." : ""), Tcl_GetErrorLine(interp)));
}
@@ -2140,7 +2137,7 @@ TclProcCleanupProc(
if (resVarInfo->deleteProc) {
resVarInfo->deleteProc(resVarInfo);
} else {
- ckfree(resVarInfo);
+ Tcl_Free(resVarInfo);
}
}
@@ -2148,10 +2145,10 @@ TclProcCleanupProc(
defPtr = localPtr->defValuePtr;
Tcl_DecrRefCount(defPtr);
}
- ckfree(localPtr);
+ Tcl_Free(localPtr);
localPtr = nextPtr;
}
- ckfree(procPtr);
+ Tcl_Free(procPtr);
/*
* TIP #280: Release the location data associated with this Proc
@@ -2175,9 +2172,9 @@ TclProcCleanupProc(
Tcl_DecrRefCount(cfPtr->data.eval.path);
cfPtr->data.eval.path = NULL;
}
- ckfree(cfPtr->line);
+ Tcl_Free(cfPtr->line);
cfPtr->line = NULL;
- ckfree(cfPtr);
+ Tcl_Free(cfPtr);
}
Tcl_DeleteHashEntry(hePtr);
}
@@ -2425,7 +2422,7 @@ SetLambdaFromAny(
if ((result != TCL_OK) || ((objc != 2) && (objc != 3))) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't interpret \"%s\" as a lambda expression",
- Tcl_GetString(objPtr)));
+ TclGetString(objPtr)));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "LAMBDA", NULL);
return TCL_ERROR;
}
@@ -2511,12 +2508,12 @@ SetLambdaFromAny(
* location (line of 2nd list element).
*/
- cfPtr = ckalloc(sizeof(CmdFrame));
+ cfPtr = Tcl_Alloc(sizeof(CmdFrame));
TclListLines(objPtr, contextPtr->line[1], 2, buf, NULL);
cfPtr->level = -1;
cfPtr->type = contextPtr->type;
- cfPtr->line = ckalloc(sizeof(int));
+ cfPtr->line = Tcl_Alloc(sizeof(int));
cfPtr->line[0] = buf[1];
cfPtr->nline = 1;
cfPtr->framePtr = NULL;
@@ -2729,13 +2726,14 @@ MakeLambdaError(
Tcl_Obj *procNameObj) /* Name of the procedure. Used for error
* messages and trace information. */
{
- int overflow, limit = 60, nameLen;
+ unsigned int overflow, limit = 60;
+ size_t nameLen;
const char *procName = TclGetStringFromObj(procNameObj, &nameLen);
overflow = (nameLen > limit);
Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
"\n (lambda term \"%.*s%s\" line %d)",
- (overflow ? limit : nameLen), procName,
+ (int)(overflow ? limit : nameLen), procName,
(overflow ? "..." : ""), Tcl_GetErrorLine(interp)));
}
diff --git a/generic/tclProcess.c b/generic/tclProcess.c
index 2f3f4ba..254e1e7 100644
--- a/generic/tclProcess.c
+++ b/generic/tclProcess.c
@@ -47,7 +47,7 @@ static void InitProcessInfo(ProcessInfo *info, Tcl_Pid pid,
int resolvedPid);
static void FreeProcessInfo(ProcessInfo *info);
static int RefreshProcessInfo(ProcessInfo *info, int options);
-static TclProcessWaitStatus WaitProcessStatus(Tcl_Pid pid, int resolvedPid,
+static TclProcessWaitStatus WaitProcessStatus(Tcl_Pid pid, size_t resolvedPid,
int options, int *codePtr, Tcl_Obj **msgPtr,
Tcl_Obj **errorObjPtr);
static Tcl_Obj * BuildProcessStatusObj(ProcessInfo *info);
@@ -130,7 +130,7 @@ FreeProcessInfo(
* Free allocated structure.
*/
- ckfree(info);
+ Tcl_Free(info);
}
/*
@@ -193,7 +193,7 @@ RefreshProcessInfo(
TclProcessWaitStatus
WaitProcessStatus(
Tcl_Pid pid, /* Process id. */
- int resolvedPid, /* Resolved process id. */
+ size_t resolvedPid, /* Resolved process id. */
int options, /* Options passed to Tcl_WaitPid. */
int *codePtr, /* If non-NULL, will receive either:
* - 0 for normal exit.
@@ -799,7 +799,7 @@ void
TclProcessCreated(
Tcl_Pid pid) /* Process id. */
{
- int resolvedPid;
+ size_t resolvedPid;
Tcl_HashEntry *entry, *entry2;
int isNew;
ProcessInfo *info;
@@ -833,7 +833,7 @@ TclProcessCreated(
* Allocate and initialize info structure.
*/
- info = (ProcessInfo *) ckalloc(sizeof(ProcessInfo));
+ info = (ProcessInfo *) Tcl_Alloc(sizeof(ProcessInfo));
InitProcessInfo(info, pid, resolvedPid);
/*
diff --git a/generic/tclRegexp.c b/generic/tclRegexp.c
index d3f7428..53241ef 100644
--- a/generic/tclRegexp.c
+++ b/generic/tclRegexp.c
@@ -70,7 +70,7 @@ typedef struct {
char *patterns[NUM_REGEXPS];/* Strings corresponding to compiled regular
* expression patterns. NULL means that this
* slot isn't used. Malloc-ed. */
- int patLengths[NUM_REGEXPS];/* Number of non-null characters in
+ size_t patLengths[NUM_REGEXPS];/* Number of non-null characters in
* corresponding entry in patterns. -1 means
* entry isn't used. */
struct TclRegexp *regexps[NUM_REGEXPS];
@@ -85,15 +85,15 @@ static Tcl_ThreadDataKey dataKey;
*/
static TclRegexp * CompileRegexp(Tcl_Interp *interp, const char *pattern,
- int length, int flags);
+ size_t length, int flags);
static void DupRegexpInternalRep(Tcl_Obj *srcPtr,
Tcl_Obj *copyPtr);
static void FinalizeRegexp(ClientData clientData);
static void FreeRegexp(TclRegexp *regexpPtr);
static void FreeRegexpInternalRep(Tcl_Obj *objPtr);
static int RegExpExecUniChar(Tcl_Interp *interp, Tcl_RegExp re,
- const Tcl_UniChar *uniString, int numChars,
- int nmatches, int flags);
+ const Tcl_UniChar *uniString, size_t numChars,
+ size_t nmatches, int flags);
static int SetRegexpFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr);
/*
@@ -190,7 +190,8 @@ Tcl_RegExpExec(
* identifies beginning of larger string, so
* that "^" won't match. */
{
- int flags, result, numChars;
+ int flags, result;
+ size_t numChars;
TclRegexp *regexp = (TclRegexp *) re;
Tcl_DString ds;
const Tcl_UniChar *ustr;
@@ -250,7 +251,7 @@ void
Tcl_RegExpRange(
Tcl_RegExp re, /* Compiled regular expression that has been
* passed to Tcl_RegExpExec. */
- int index, /* 0 means give the range of the entire match,
+ size_t index, /* 0 means give the range of the entire match,
* > 0 means give the range of a matching
* subrange. */
const char **startPtr, /* Store address of first character in
@@ -261,7 +262,7 @@ Tcl_RegExpRange(
TclRegexp *regexpPtr = (TclRegexp *) re;
const char *string;
- if ((size_t) index > regexpPtr->re.re_nsub) {
+ if (index > regexpPtr->re.re_nsub) {
*startPtr = *endPtr = NULL;
} else if (regexpPtr->matches[index].rm_so == TCL_INDEX_NONE) {
*startPtr = *endPtr = NULL;
@@ -302,9 +303,8 @@ RegExpExecUniChar(
Tcl_RegExp re, /* Compiled regular expression; returned by a
* previous call to Tcl_GetRegExpFromObj */
const Tcl_UniChar *wString, /* String against which to match re. */
- int numChars, /* Length of Tcl_UniChar string (must be
- * >=0). */
- int nmatches, /* How many subexpression matches (counting
+ size_t numChars, /* Length of Tcl_UniChar string. */
+ size_t nm, /* How many subexpression matches (counting
* the whole match as subexpression 0) are of
* interest. -1 means "don't know". */
int flags) /* Regular expression flags. */
@@ -312,13 +312,12 @@ RegExpExecUniChar(
int status;
TclRegexp *regexpPtr = (TclRegexp *) re;
size_t last = regexpPtr->re.re_nsub + 1;
- size_t nm = last;
- if (nmatches >= 0 && (size_t) nmatches < nm) {
- nm = (size_t) nmatches;
+ if (nm >= last) {
+ nm = last;
}
- status = TclReExec(&regexpPtr->re, wString, (size_t) numChars,
+ status = TclReExec(&regexpPtr->re, wString, numChars,
&regexpPtr->details, nm, regexpPtr->matches, flags);
/*
@@ -362,13 +361,13 @@ void
TclRegExpRangeUniChar(
Tcl_RegExp re, /* Compiled regular expression that has been
* passed to Tcl_RegExpExec. */
- int index, /* 0 means give the range of the entire match,
+ size_t index, /* 0 means give the range of the entire match,
* > 0 means give the range of a matching
* subrange, TCL_INDEX_NONE means the range of the
* rm_extend field. */
- int *startPtr, /* Store address of first character in
+ size_t *startPtr, /* Store address of first character in
* (sub-)range here. */
- int *endPtr) /* Store address of character just after last
+ size_t *endPtr) /* Store address of character just after last
* in (sub-)range here. */
{
TclRegexp *regexpPtr = (TclRegexp *) re;
@@ -376,7 +375,7 @@ TclRegExpRangeUniChar(
if ((regexpPtr->flags&REG_EXPECT) && (index == TCL_INDEX_NONE)) {
*startPtr = regexpPtr->details.rm_extend.rm_so;
*endPtr = regexpPtr->details.rm_extend.rm_eo;
- } else if ((size_t) index > regexpPtr->re.re_nsub) {
+ } else if (index + 1 > regexpPtr->re.re_nsub + 1) {
*startPtr = TCL_INDEX_NONE;
*endPtr = TCL_INDEX_NONE;
} else {
@@ -442,16 +441,16 @@ Tcl_RegExpExecObj(
* returned by previous call to
* Tcl_GetRegExpFromObj. */
Tcl_Obj *textObj, /* Text against which to match re. */
- int offset, /* Character index that marks where matching
+ size_t offset, /* Character index that marks where matching
* should begin. */
- int nmatches, /* How many subexpression matches (counting
+ size_t nmatches, /* How many subexpression matches (counting
* the whole match as subexpression 0) are of
* interest. -1 means all of them. */
int flags) /* Regular expression execution flags. */
{
TclRegexp *regexpPtr = (TclRegexp *) re;
Tcl_UniChar *udata;
- int length;
+ size_t length;
int reflags = regexpPtr->flags;
#define TCL_REG_GLOBOK_FLAGS \
(TCL_REG_ADVANCED | TCL_REG_NOSUB | TCL_REG_NOCASE)
@@ -482,7 +481,7 @@ Tcl_RegExpExecObj(
regexpPtr->string = NULL;
regexpPtr->objPtr = textObj;
- udata = Tcl_GetUnicodeFromObj(textObj, &length);
+ udata = TclGetUnicodeFromObj(textObj, &length);
if (offset > length) {
offset = length;
@@ -594,7 +593,7 @@ Tcl_GetRegExpFromObj(
* expression. */
int flags) /* Regular expression compilation flags. */
{
- int length;
+ size_t length;
TclRegexp *regexpPtr;
const char *pattern;
@@ -678,7 +677,7 @@ TclRegAbout(
resultObj = Tcl_NewObj();
Tcl_ListObjAppendElement(NULL, resultObj,
- Tcl_NewWideIntObj((Tcl_WideInt) regexpPtr->re.re_nsub));
+ TclNewWideIntObjFromSize(regexpPtr->re.re_nsub));
/*
* Now append a list of all the bit-flags set for the RE.
@@ -858,7 +857,7 @@ static TclRegexp *
CompileRegexp(
Tcl_Interp *interp, /* Used for error reporting if not NULL. */
const char *string, /* The regexp to compile (UTF-8). */
- int length, /* The length of the string in bytes. */
+ size_t length, /* The length of the string in bytes. */
int flags) /* Compilation flags. */
{
TclRegexp *regexpPtr;
@@ -916,7 +915,7 @@ CompileRegexp(
* This is a new expression, so compile it and add it to the cache.
*/
- regexpPtr = ckalloc(sizeof(TclRegexp));
+ regexpPtr = Tcl_Alloc(sizeof(TclRegexp));
regexpPtr->objPtr = NULL;
regexpPtr->string = NULL;
regexpPtr->details.rm_extend.rm_so = -1;
@@ -943,7 +942,7 @@ CompileRegexp(
* Clean up and report errors in the interpreter, if possible.
*/
- ckfree(regexpPtr);
+ Tcl_Free(regexpPtr);
if (interp) {
TclRegError(interp,
"couldn't compile regular expression pattern: ", status);
@@ -971,7 +970,7 @@ CompileRegexp(
*/
regexpPtr->matches =
- ckalloc(sizeof(regmatch_t) * (regexpPtr->re.re_nsub + 1));
+ Tcl_Alloc(sizeof(regmatch_t) * (regexpPtr->re.re_nsub + 1));
/*
* Initialize the refcount to one initially, since it is in the cache.
@@ -990,14 +989,14 @@ CompileRegexp(
if (oldRegexpPtr->refCount-- <= 1) {
FreeRegexp(oldRegexpPtr);
}
- ckfree(tsdPtr->patterns[NUM_REGEXPS-1]);
+ Tcl_Free(tsdPtr->patterns[NUM_REGEXPS-1]);
}
for (i = NUM_REGEXPS - 2; i >= 0; i--) {
tsdPtr->patterns[i+1] = tsdPtr->patterns[i];
tsdPtr->patLengths[i+1] = tsdPtr->patLengths[i];
tsdPtr->regexps[i+1] = tsdPtr->regexps[i];
}
- tsdPtr->patterns[0] = ckalloc(length + 1);
+ tsdPtr->patterns[0] = Tcl_Alloc(length + 1);
memcpy(tsdPtr->patterns[0], string, length + 1);
tsdPtr->patLengths[0] = length;
tsdPtr->regexps[0] = regexpPtr;
@@ -1030,9 +1029,9 @@ FreeRegexp(
TclDecrRefCount(regexpPtr->globObjPtr);
}
if (regexpPtr->matches) {
- ckfree(regexpPtr->matches);
+ Tcl_Free(regexpPtr->matches);
}
- ckfree(regexpPtr);
+ Tcl_Free(regexpPtr);
}
/*
@@ -1064,7 +1063,7 @@ FinalizeRegexp(
if (regexpPtr->refCount-- <= 1) {
FreeRegexp(regexpPtr);
}
- ckfree(tsdPtr->patterns[i]);
+ Tcl_Free(tsdPtr->patterns[i]);
tsdPtr->patterns[i] = NULL;
}
diff --git a/generic/tclResolve.c b/generic/tclResolve.c
index 974737e..23f2326 100644
--- a/generic/tclResolve.c
+++ b/generic/tclResolve.c
@@ -101,9 +101,9 @@ Tcl_AddInterpResolvers(
* list, so that it overrides existing schemes.
*/
- resPtr = ckalloc(sizeof(ResolverScheme));
+ resPtr = Tcl_Alloc(sizeof(ResolverScheme));
len = strlen(name) + 1;
- resPtr->name = ckalloc(len);
+ resPtr->name = Tcl_Alloc(len);
memcpy(resPtr->name, name, len);
resPtr->cmdResProc = cmdProc;
resPtr->varResProc = varProc;
@@ -225,8 +225,8 @@ Tcl_RemoveInterpResolvers(
}
*prevPtrPtr = resPtr->nextPtr;
- ckfree(resPtr->name);
- ckfree(resPtr);
+ Tcl_Free(resPtr->name);
+ Tcl_Free(resPtr);
return 1;
}
diff --git a/generic/tclResult.c b/generic/tclResult.c
index 6e9d4a6..c75a1f1 100644
--- a/generic/tclResult.c
+++ b/generic/tclResult.c
@@ -27,9 +27,6 @@ enum returnKeys {
static Tcl_Obj ** GetKeys(void);
static void ReleaseKeys(ClientData clientData);
static void ResetObjResult(Interp *iPtr);
-#ifndef TCL_NO_DEPRECATED
-static void SetupAppendBuffer(Interp *iPtr, int newSpace);
-#endif /* !TCL_NO_DEPRECATED */
/*
* This structure is used to take a snapshot of the interpreter state in
@@ -77,7 +74,7 @@ Tcl_SaveInterpState(
int status) /* status code for current operation */
{
Interp *iPtr = (Interp *) interp;
- InterpState *statePtr = ckalloc(sizeof(InterpState));
+ InterpState *statePtr = Tcl_Alloc(sizeof(InterpState));
statePtr->status = status;
statePtr->flags = iPtr->flags & ERR_ALREADY_LOGGED;
@@ -207,302 +204,12 @@ Tcl_DiscardInterpState(
Tcl_DecrRefCount(statePtr->errorStack);
}
Tcl_DecrRefCount(statePtr->objResult);
- ckfree(statePtr);
+ Tcl_Free(statePtr);
}
/*
*----------------------------------------------------------------------
*
- * Tcl_SaveResult --
- *
- * Takes a snapshot of the current result state of the interpreter. The
- * snapshot can be restored at any point by Tcl_RestoreResult. Note that
- * this routine does not preserve the errorCode, errorInfo, or flags
- * fields so it should not be used if an error is in progress.
- *
- * Once a snapshot is saved, it must be restored by calling
- * Tcl_RestoreResult, or discarded by calling Tcl_DiscardResult.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Resets the interpreter result.
- *
- *----------------------------------------------------------------------
- */
-
-#ifndef TCL_NO_DEPRECATED
-#undef Tcl_SaveResult
-void
-Tcl_SaveResult(
- Tcl_Interp *interp, /* Interpreter to save. */
- Tcl_SavedResult *statePtr) /* Pointer to state structure. */
-{
- Interp *iPtr = (Interp *) interp;
-
- /*
- * Move the result object into the save state. Note that we don't need to
- * change its refcount because we're moving it, not adding a new
- * reference. Put an empty object into the interpreter.
- */
-
- statePtr->objResultPtr = iPtr->objResultPtr;
- iPtr->objResultPtr = Tcl_NewObj();
- Tcl_IncrRefCount(iPtr->objResultPtr);
-
- /*
- * Save the string result.
- */
-
- statePtr->freeProc = iPtr->freeProc;
- if (iPtr->result == iPtr->resultSpace) {
- /*
- * Copy the static string data out of the interp buffer.
- */
-
- statePtr->result = statePtr->resultSpace;
- strcpy(statePtr->result, iPtr->result);
- statePtr->appendResult = NULL;
- } else if (iPtr->result == iPtr->appendResult) {
- /*
- * Move the append buffer out of the interp.
- */
-
- statePtr->appendResult = iPtr->appendResult;
- statePtr->appendAvl = iPtr->appendAvl;
- statePtr->appendUsed = iPtr->appendUsed;
- statePtr->result = statePtr->appendResult;
- iPtr->appendResult = NULL;
- iPtr->appendAvl = 0;
- iPtr->appendUsed = 0;
- } else {
- /*
- * Move the dynamic or static string out of the interpreter.
- */
-
- statePtr->result = iPtr->result;
- statePtr->appendResult = NULL;
- }
-
- iPtr->result = iPtr->resultSpace;
- iPtr->resultSpace[0] = 0;
- iPtr->freeProc = 0;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * Tcl_RestoreResult --
- *
- * Restores the state of the interpreter to a snapshot taken by
- * Tcl_SaveResult. After this call, the token for the interpreter state
- * is no longer valid.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Restores the interpreter result.
- *
- *----------------------------------------------------------------------
- */
-
-#undef Tcl_RestoreResult
-void
-Tcl_RestoreResult(
- Tcl_Interp *interp, /* Interpreter being restored. */
- Tcl_SavedResult *statePtr) /* State returned by Tcl_SaveResult. */
-{
- Interp *iPtr = (Interp *) interp;
-
- Tcl_ResetResult(interp);
-
- /*
- * Restore the string result.
- */
-
- iPtr->freeProc = statePtr->freeProc;
- if (statePtr->result == statePtr->resultSpace) {
- /*
- * Copy the static string data into the interp buffer.
- */
-
- iPtr->result = iPtr->resultSpace;
- strcpy(iPtr->result, statePtr->result);
- } else if (statePtr->result == statePtr->appendResult) {
- /*
- * Move the append buffer back into the interp.
- */
-
- if (iPtr->appendResult != NULL) {
- ckfree(iPtr->appendResult);
- }
-
- iPtr->appendResult = statePtr->appendResult;
- iPtr->appendAvl = statePtr->appendAvl;
- iPtr->appendUsed = statePtr->appendUsed;
- iPtr->result = iPtr->appendResult;
- } else {
- /*
- * Move the dynamic or static string back into the interpreter.
- */
-
- iPtr->result = statePtr->result;
- }
-
- /*
- * Restore the object result.
- */
-
- Tcl_DecrRefCount(iPtr->objResultPtr);
- iPtr->objResultPtr = statePtr->objResultPtr;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * Tcl_DiscardResult --
- *
- * Frees the memory associated with an interpreter snapshot taken by
- * Tcl_SaveResult. If the snapshot is not restored, this function must be
- * called to discard it, or the memory will be lost.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-#undef Tcl_DiscardResult
-void
-Tcl_DiscardResult(
- Tcl_SavedResult *statePtr) /* State returned by Tcl_SaveResult. */
-{
- TclDecrRefCount(statePtr->objResultPtr);
-
- if (statePtr->result == statePtr->appendResult) {
- ckfree(statePtr->appendResult);
- } else if (statePtr->freeProc == TCL_DYNAMIC) {
- ckfree(statePtr->result);
- } else if (statePtr->freeProc) {
- statePtr->freeProc(statePtr->result);
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * Tcl_SetResult --
- *
- * Arrange for "result" to be the Tcl return value.
- *
- * Results:
- * None.
- *
- * Side effects:
- * interp->result is left pointing either to "result" or to a copy of it.
- * Also, the object result is reset.
- *
- *----------------------------------------------------------------------
- */
-
-void
-Tcl_SetResult(
- Tcl_Interp *interp, /* Interpreter with which to associate the
- * return value. */
- register char *result, /* Value to be returned. If NULL, the result
- * is set to an empty string. */
- Tcl_FreeProc *freeProc) /* Gives information about the string:
- * TCL_STATIC, TCL_VOLATILE, or the address of
- * a Tcl_FreeProc such as free. */
-{
- Interp *iPtr = (Interp *) interp;
- register Tcl_FreeProc *oldFreeProc = iPtr->freeProc;
- char *oldResult = iPtr->result;
-
- if (result == NULL) {
- iPtr->resultSpace[0] = 0;
- iPtr->result = iPtr->resultSpace;
- iPtr->freeProc = 0;
- } else if (freeProc == TCL_VOLATILE) {
- int length = strlen(result);
-
- if (length > TCL_RESULT_SIZE) {
- iPtr->result = ckalloc(length + 1);
- iPtr->freeProc = TCL_DYNAMIC;
- } else {
- iPtr->result = iPtr->resultSpace;
- iPtr->freeProc = 0;
- }
- memcpy(iPtr->result, result, length+1);
- } else {
- iPtr->result = (char *) result;
- iPtr->freeProc = freeProc;
- }
-
- /*
- * If the old result was dynamically-allocated, free it up. Do it here,
- * rather than at the beginning, in case the new result value was part of
- * the old result value.
- */
-
- if (oldFreeProc != 0) {
- if (oldFreeProc == TCL_DYNAMIC) {
- ckfree(oldResult);
- } else {
- oldFreeProc(oldResult);
- }
- }
-
- /*
- * Reset the object result since we just set the string result.
- */
-
- ResetObjResult(iPtr);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * Tcl_GetStringResult --
- *
- * Returns an interpreter's result value as a string.
- *
- * Results:
- * The interpreter's result as a string.
- *
- * Side effects:
- * If the string result is empty, the object result is moved to the
- * string result, then the object result is reset.
- *
- *----------------------------------------------------------------------
- */
-
-const char *
-Tcl_GetStringResult(
- register Tcl_Interp *interp)/* Interpreter whose result to return. */
-{
- Interp *iPtr = (Interp *) interp;
- /*
- * If the string result is empty, move the object result to the string
- * result, then reset the object result.
- */
-
- if (*(iPtr->result) == 0) {
- Tcl_SetResult(interp, TclGetString(Tcl_GetObjResult(interp)),
- TCL_VOLATILE);
- }
- return iPtr->result;
-}
-#endif /* !TCL_NO_DEPRECATED */
-
-/*
- *----------------------------------------------------------------------
- *
* Tcl_SetObjResult --
*
* Arrange for objPtr to be an interpreter's result value.
@@ -538,23 +245,6 @@ Tcl_SetObjResult(
*/
TclDecrRefCount(oldObjResult);
-
-#ifndef TCL_NO_DEPRECATED
- /*
- * Reset the string result since we just set the result object.
- */
-
- if (iPtr->freeProc != NULL) {
- if (iPtr->freeProc == TCL_DYNAMIC) {
- ckfree(iPtr->result);
- } else {
- iPtr->freeProc(iPtr->result);
- }
- iPtr->freeProc = 0;
- }
- iPtr->result = iPtr->resultSpace;
- iPtr->resultSpace[0] = 0;
-#endif
}
/*
@@ -583,75 +273,13 @@ Tcl_GetObjResult(
Tcl_Interp *interp) /* Interpreter whose result to return. */
{
register Interp *iPtr = (Interp *) interp;
-#ifndef TCL_NO_DEPRECATED
- Tcl_Obj *objResultPtr;
- int length;
-
- /*
- * If the string result is non-empty, move the string result to the object
- * result, then reset the string result.
- */
-
- if (iPtr->result[0] != 0) {
- ResetObjResult(iPtr);
- objResultPtr = iPtr->objResultPtr;
- length = strlen(iPtr->result);
- TclInitStringRep(objResultPtr, iPtr->result, length);
-
- if (iPtr->freeProc != NULL) {
- if (iPtr->freeProc == TCL_DYNAMIC) {
- ckfree(iPtr->result);
- } else {
- iPtr->freeProc(iPtr->result);
- }
- iPtr->freeProc = 0;
- }
- iPtr->result = iPtr->resultSpace;
- iPtr->result[0] = 0;
- }
-#endif /* !TCL_NO_DEPRECATED */
return iPtr->objResultPtr;
}
/*
*----------------------------------------------------------------------
*
- * Tcl_AppendResultVA --
- *
- * Append a variable number of strings onto the interpreter's result.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The result of the interpreter given by the first argument is extended
- * by the strings in the va_list (up to a terminating NULL argument).
- *
- * If the string result is non-empty, the object result forced to be a
- * duplicate of it first. There will be a string result afterwards.
- *
- *----------------------------------------------------------------------
- */
-
-void
-Tcl_AppendResultVA(
- Tcl_Interp *interp, /* Interpreter with which to associate the
- * return value. */
- va_list argList) /* Variable argument list. */
-{
- Tcl_Obj *objPtr = Tcl_GetObjResult(interp);
-
- if (Tcl_IsShared(objPtr)) {
- objPtr = Tcl_DuplicateObj(objPtr);
- }
- Tcl_AppendStringsToObjVA(objPtr, argList);
- Tcl_SetObjResult(interp, objPtr);
-}
-
-/*
- *----------------------------------------------------------------------
- *
* Tcl_AppendResult --
*
* Append a variable number of strings onto the interpreter's result.
@@ -675,9 +303,23 @@ Tcl_AppendResult(
Tcl_Interp *interp, ...)
{
va_list argList;
+ Tcl_Obj *objPtr;
va_start(argList, interp);
- Tcl_AppendResultVA(interp, argList);
+ objPtr = Tcl_GetObjResult(interp);
+
+ if (Tcl_IsShared(objPtr)) {
+ objPtr = Tcl_DuplicateObj(objPtr);
+ }
+ while (1) {
+ const char *bytes = va_arg(argList, char *);
+
+ if (bytes == NULL) {
+ break;
+ }
+ Tcl_AppendToObj(objPtr, bytes, -1);
+ }
+ Tcl_SetObjResult(interp, objPtr);
va_end(argList);
}
@@ -712,167 +354,39 @@ Tcl_AppendElement(
* to result. */
{
Interp *iPtr = (Interp *) interp;
-#ifdef TCL_NO_DEPRECATED
Tcl_Obj *elementPtr = Tcl_NewStringObj(element, -1);
Tcl_Obj *listPtr = Tcl_NewListObj(1, &elementPtr);
const char *bytes;
+ size_t length;
if (Tcl_IsShared(iPtr->objResultPtr)) {
Tcl_SetObjResult(interp, Tcl_DuplicateObj(iPtr->objResultPtr));
}
- bytes = TclGetString(iPtr->objResultPtr);
- if (TclNeedSpace(bytes, bytes+iPtr->objResultPtr->length)) {
+ bytes = TclGetStringFromObj(iPtr->objResultPtr, &length);
+ if (TclNeedSpace(bytes, bytes + length)) {
Tcl_AppendToObj(iPtr->objResultPtr, " ", 1);
}
Tcl_AppendObjToObj(iPtr->objResultPtr, listPtr);
Tcl_DecrRefCount(listPtr);
-#else
- char *dst;
- int size;
- int flags;
-
- /*
- * If the string result is empty, move the object result to the string
- * result, then reset the object result.
- */
-
- (void) Tcl_GetStringResult(interp);
-
- /*
- * See how much space is needed, and grow the append buffer if needed to
- * accommodate the list element.
- */
-
- size = Tcl_ScanElement(element, &flags) + 1;
- if ((iPtr->result != iPtr->appendResult)
- || (iPtr->appendResult[iPtr->appendUsed] != 0)
- || ((size + iPtr->appendUsed) >= iPtr->appendAvl)) {
- SetupAppendBuffer(iPtr, size+iPtr->appendUsed);
- }
-
- /*
- * Convert the string into a list element and copy it to the buffer that's
- * forming, with a space separator if needed.
- */
-
- dst = iPtr->appendResult + iPtr->appendUsed;
- if (TclNeedSpace(iPtr->appendResult, dst)) {
- iPtr->appendUsed++;
- *dst = ' ';
- dst++;
-
- /*
- * If we need a space to separate this element from preceding stuff,
- * then this element will not lead a list, and need not have it's
- * leading '#' quoted.
- */
-
- flags |= TCL_DONT_QUOTE_HASH;
- }
- iPtr->appendUsed += Tcl_ConvertElement(element, dst, flags);
-#endif /* !TCL_NO_DEPRECATED */
}
/*
*----------------------------------------------------------------------
*
- * SetupAppendBuffer --
- *
- * This function makes sure that there is an append buffer properly
- * initialized, if necessary, from the interpreter's result, and that it
- * has at least enough room to accommodate newSpace new bytes of
- * information.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-#ifndef TCL_NO_DEPRECATED
-static void
-SetupAppendBuffer(
- Interp *iPtr, /* Interpreter whose result is being set up. */
- int newSpace) /* Make sure that at least this many bytes of
- * new information may be added. */
-{
- int totalSpace;
-
- /*
- * Make the append buffer larger, if that's necessary, then copy the
- * result into the append buffer and make the append buffer the official
- * Tcl result.
- */
-
- if (iPtr->result != iPtr->appendResult) {
- /*
- * If an oversized buffer was used recently, then free it up so we go
- * back to a smaller buffer. This avoids tying up memory forever after
- * a large operation.
- */
-
- if (iPtr->appendAvl > 500) {
- ckfree(iPtr->appendResult);
- iPtr->appendResult = NULL;
- iPtr->appendAvl = 0;
- }
- iPtr->appendUsed = strlen(iPtr->result);
- } else if (iPtr->result[iPtr->appendUsed] != 0) {
- /*
- * Most likely someone has modified a result created by
- * Tcl_AppendResult et al. so that it has a different size. Just
- * recompute the size.
- */
-
- iPtr->appendUsed = strlen(iPtr->result);
- }
-
- totalSpace = newSpace + iPtr->appendUsed;
- if (totalSpace >= iPtr->appendAvl) {
- char *newSpace;
-
- if (totalSpace < 100) {
- totalSpace = 200;
- } else {
- totalSpace *= 2;
- }
- newSpace = ckalloc(totalSpace);
- strcpy(newSpace, iPtr->result);
- if (iPtr->appendResult != NULL) {
- ckfree(iPtr->appendResult);
- }
- iPtr->appendResult = newSpace;
- iPtr->appendAvl = totalSpace;
- } else if (iPtr->result != iPtr->appendResult) {
- strcpy(iPtr->appendResult, iPtr->result);
- }
-
- Tcl_FreeResult((Tcl_Interp *) iPtr);
- iPtr->result = iPtr->appendResult;
-}
-#endif /* !TCL_NO_DEPRECATED */
-
-/*
- *----------------------------------------------------------------------
- *
* Tcl_FreeResult --
*
* This function frees up the memory associated with an interpreter's
- * string result. It also resets the interpreter's result object.
- * Tcl_FreeResult is most commonly used when a function is about to
- * replace one result value with another.
+ * result, resetting the interpreter's result object. Tcl_FreeResult is
+ * most commonly used when a function is about to replace one result
+ * value with another.
*
* Results:
* None.
*
* Side effects:
- * Frees the memory associated with interp's string result and sets
- * interp->freeProc to zero, but does not change interp->result or clear
- * error state. Resets interp's result object to an unshared empty
- * object.
+ * Frees the memory associated with interp's result but does not change
+ * any part of the error dictionary (i.e., the errorinfo and errorcode
+ * remain the same).
*
*----------------------------------------------------------------------
*/
@@ -883,17 +397,6 @@ Tcl_FreeResult(
{
register Interp *iPtr = (Interp *) interp;
-#ifndef TCL_NO_DEPRECATED
- if (iPtr->freeProc != NULL) {
- if (iPtr->freeProc == TCL_DYNAMIC) {
- ckfree(iPtr->result);
- } else {
- iPtr->freeProc(iPtr->result);
- }
- iPtr->freeProc = 0;
- }
-
-#endif /* !TCL_NO_DEPRECATED */
ResetObjResult(iPtr);
}
@@ -923,18 +426,6 @@ Tcl_ResetResult(
register Interp *iPtr = (Interp *) interp;
ResetObjResult(iPtr);
-#ifndef TCL_NO_DEPRECATED
- if (iPtr->freeProc != NULL) {
- if (iPtr->freeProc == TCL_DYNAMIC) {
- ckfree(iPtr->result);
- } else {
- iPtr->freeProc(iPtr->result);
- }
- iPtr->freeProc = 0;
- }
- iPtr->result = iPtr->resultSpace;
- iPtr->resultSpace[0] = 0;
-#endif /* !TCL_NO_DEPRECATED */
if (iPtr->errorCode) {
/* Legacy support */
if (iPtr->flags & ERR_LEGACY_COPY) {
@@ -996,7 +487,7 @@ ResetObjResult(
} else {
if (objResultPtr->bytes != &tclEmptyString) {
if (objResultPtr->bytes) {
- ckfree(objResultPtr->bytes);
+ Tcl_Free(objResultPtr->bytes);
}
objResultPtr->bytes = &tclEmptyString;
objResultPtr->length = 0;
@@ -1008,7 +499,7 @@ ResetObjResult(
/*
*----------------------------------------------------------------------
*
- * Tcl_SetErrorCodeVA --
+ * Tcl_SetErrorCode --
*
* This function is called to record machine-readable information about
* an error that is about to be returned.
@@ -1025,11 +516,19 @@ ResetObjResult(
*/
void
-Tcl_SetErrorCodeVA(
- Tcl_Interp *interp, /* Interpreter in which to set errorCode */
- va_list argList) /* Variable argument list. */
+Tcl_SetErrorCode(
+ Tcl_Interp *interp, ...)
{
- Tcl_Obj *errorObj = Tcl_NewObj();
+ va_list argList;
+ Tcl_Obj *errorObj;
+
+ /*
+ * Scan through the arguments one at a time, appending them to the
+ * errorCode field as list elements.
+ */
+
+ va_start(argList, interp);
+ errorObj = Tcl_NewObj();
/*
* Scan through the arguments one at a time, appending them to the
@@ -1045,40 +544,6 @@ Tcl_SetErrorCodeVA(
Tcl_ListObjAppendElement(NULL, errorObj, Tcl_NewStringObj(elem, -1));
}
Tcl_SetObjErrorCode(interp, errorObj);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * Tcl_SetErrorCode --
- *
- * This function is called to record machine-readable information about
- * an error that is about to be returned.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The errorCode field of the interp is modified to hold all of the
- * arguments to this function, in a list form with each argument becoming
- * one element of the list.
- *
- *----------------------------------------------------------------------
- */
-
-void
-Tcl_SetErrorCode(
- Tcl_Interp *interp, ...)
-{
- va_list argList;
-
- /*
- * Scan through the arguments one at a time, appending them to the
- * errorCode field as list elements.
- */
-
- va_start(argList, interp);
- Tcl_SetErrorCodeVA(interp, argList);
va_end(argList);
}
@@ -1124,7 +589,6 @@ Tcl_SetObjErrorCode(
*----------------------------------------------------------------------
*/
-#undef Tcl_GetErrorLine
int
Tcl_GetErrorLine(
Tcl_Interp *interp)
@@ -1142,7 +606,6 @@ Tcl_GetErrorLine(
*----------------------------------------------------------------------
*/
-#undef Tcl_SetErrorLine
void
Tcl_SetErrorLine(
Tcl_Interp *interp,
@@ -1288,8 +751,10 @@ TclProcessReturn(
Tcl_DictObjGet(NULL, iPtr->returnOpts, keys[KEY_ERRORINFO],
&valuePtr);
if (valuePtr != NULL) {
- (void) TclGetString(valuePtr);
- if (valuePtr->length) {
+ size_t length;
+
+ (void) TclGetStringFromObj(valuePtr, &length);
+ if (length) {
iPtr->errorInfo = valuePtr;
Tcl_IncrRefCount(iPtr->errorInfo);
iPtr->flags |= ERR_ALREADY_LOGGED;
diff --git a/generic/tclScan.c b/generic/tclScan.c
index 74ec2da..95006ca 100644
--- a/generic/tclScan.c
+++ b/generic/tclScan.c
@@ -29,7 +29,7 @@
* character set.
*/
-typedef struct CharSet {
+typedef struct {
int exclude; /* 1 if this is an exclusion set. */
int nchars;
Tcl_UniChar *chars;
@@ -102,9 +102,9 @@ BuildCharSet(
end += TclUtfToUniChar(end, &ch);
}
- cset->chars = ckalloc(sizeof(Tcl_UniChar) * (end - format - 1));
+ cset->chars = Tcl_Alloc(sizeof(Tcl_UniChar) * (end - format - 1));
if (nranges > 0) {
- cset->ranges = ckalloc(sizeof(struct Range) * nranges);
+ cset->ranges = Tcl_Alloc(sizeof(struct Range) * nranges);
} else {
cset->ranges = NULL;
}
@@ -224,9 +224,9 @@ static void
ReleaseCharSet(
CharSet *cset)
{
- ckfree(cset->chars);
+ Tcl_Free(cset->chars);
if (cset->ranges) {
- ckfree(cset->ranges);
+ Tcl_Free(cset->ranges);
}
}
@@ -589,7 +589,7 @@ Tcl_ScanObjCmd(
return TCL_ERROR;
}
- format = Tcl_GetString(objv[2]);
+ format = TclGetString(objv[2]);
numVars = objc-3;
/*
@@ -605,13 +605,13 @@ Tcl_ScanObjCmd(
*/
if (totalVars > 0) {
- objs = ckalloc(sizeof(Tcl_Obj *) * totalVars);
+ objs = Tcl_Alloc(sizeof(Tcl_Obj *) * totalVars);
for (i = 0; i < totalVars; i++) {
objs[i] = NULL;
}
}
- string = Tcl_GetString(objv[1]);
+ string = TclGetString(objv[1]);
baseString = string;
/*
@@ -951,7 +951,7 @@ Tcl_ScanObjCmd(
if (code == TCL_ERROR) {
if (objs != NULL) {
- ckfree(objs);
+ Tcl_Free(objs);
}
Tcl_DecrRefCount(objPtr);
Tcl_SetObjResult(interp, Tcl_NewStringObj(
@@ -1076,7 +1076,7 @@ Tcl_ScanObjCmd(
}
}
if (objs != NULL) {
- ckfree(objs);
+ Tcl_Free(objs);
}
if (code == TCL_OK) {
if (underflow && (nconversions == 0)) {
diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c
index fd87446..2b59913 100644
--- a/generic/tclStrToD.c
+++ b/generic/tclStrToD.c
@@ -474,7 +474,7 @@ TclParseNumber(
* ("integer", "boolean value", etc.). */
const char *bytes, /* Pointer to the start of the string to
* scan. */
- int numBytes, /* Maximum number of bytes to scan, see
+ size_t numBytes, /* Maximum number of bytes to scan, see
* above. */
const char **endPtrPtr, /* Place to store pointer to the character
* that terminated the scan. */
@@ -483,7 +483,7 @@ TclParseNumber(
enum State {
INITIAL, SIGNUM, ZERO, ZERO_X,
ZERO_O, ZERO_B, ZERO_D, BINARY,
- HEXADECIMAL, OCTAL, BAD_OCTAL, DECIMAL,
+ HEXADECIMAL, OCTAL, DECIMAL,
LEADING_RADIX_POINT, FRACTION,
EXPONENT_START, EXPONENT_SIGNUM, EXPONENT,
sI, sIN, sINF, sINFI, sINFIN, sINFINI, sINFINIT, sINFINITY
@@ -528,7 +528,6 @@ TclParseNumber(
char d = 0; /* Last hexadecimal digit scanned; initialized
* to avoid a compiler warning. */
int shift = 0; /* Amount to shift when accumulating binary */
- int explicitOctal = 0;
#define ALL_BITS ((Tcl_WideUInt)-1)
#define MOST_BITS (ALL_BITS >> 1)
@@ -660,7 +659,6 @@ TclParseNumber(
goto zerob;
}
if (c == 'o' || c == 'O') {
- explicitOctal = 1;
state = ZERO_O;
break;
}
@@ -668,10 +666,7 @@ TclParseNumber(
state = ZERO_D;
break;
}
-#ifdef TCL_NO_DEPRECATED
goto decimal;
-#endif
- /* FALLTHROUGH */
case OCTAL:
/*
@@ -734,58 +729,6 @@ TclParseNumber(
state = OCTAL;
break;
}
- /* FALLTHROUGH */
-
- case BAD_OCTAL:
- if (explicitOctal) {
- /*
- * No forgiveness for bad digits in explicitly octal numbers.
- */
-
- goto endgame;
- }
- if (flags & TCL_PARSE_INTEGER_ONLY) {
- /*
- * No seeking floating point when parsing only integer.
- */
-
- goto endgame;
- }
-#ifndef TCL_NO_DEPRECATED
-
- /*
- * Scanned a number with a leading zero that contains an 8, 9,
- * radix point or E. This is an invalid octal number, but might
- * still be floating point.
- */
-
- if (c == '0') {
- numTrailZeros++;
- state = BAD_OCTAL;
- break;
- } else if (isdigit(UCHAR(c))) {
- if (objPtr != NULL) {
- significandOverflow = AccumulateDecimalDigit(
- (unsigned)(c-'0'), numTrailZeros,
- &significandWide, &significandBig,
- significandOverflow);
- }
- if (numSigDigs != 0) {
- numSigDigs += (numTrailZeros + 1);
- } else {
- numSigDigs = 1;
- }
- numTrailZeros = 0;
- state = BAD_OCTAL;
- break;
- } else if (c == '.') {
- state = FRACTION;
- break;
- } else if (c == 'E' || c == 'e') {
- state = EXPONENT_START;
- break;
- }
-#endif
goto endgame;
/*
@@ -900,9 +843,7 @@ TclParseNumber(
* digits.
*/
-#ifdef TCL_NO_DEPRECATED
decimal:
-#endif
acceptState = state;
acceptPoint = p;
acceptLen = len;
@@ -1170,7 +1111,7 @@ TclParseNumber(
}
}
if (endPtrPtr == NULL) {
- if ((len != 0) && ((numBytes > 0) || (*p != '\0'))) {
+ if ((len != 0) && ((numBytes + 1 > 1) || (*p != '\0'))) {
status = TCL_ERROR;
}
} else {
@@ -1186,7 +1127,6 @@ TclParseNumber(
TclFreeIntRep(objPtr);
switch (acceptState) {
case SIGNUM:
- case BAD_OCTAL:
case ZERO_X:
case ZERO_O:
case ZERO_B:
@@ -1384,9 +1324,6 @@ TclParseNumber(
Tcl_AppendLimitedToObj(msg, bytes, numBytes, 50, "");
Tcl_AppendToObj(msg, "\"", -1);
- if (state == BAD_OCTAL) {
- Tcl_AppendToObj(msg, " (looks like invalid octal number)", -1);
- }
Tcl_SetObjResult(interp, msg);
Tcl_SetErrorCode(interp, "TCL", "VALUE", "NUMBER", NULL);
}
@@ -2173,7 +2110,7 @@ TakeAbsoluteValue(
*
* Results:
* Returns one of the strings 'Infinity' and 'NaN'. The string returned
- * must be freed by the caller using 'ckfree'.
+ * must be freed by the caller using 'Tcl_Free'.
*
* Side effects:
* Stores 9999 in *decpt, and sets '*endPtr' to designate the terminating
@@ -2192,13 +2129,13 @@ FormatInfAndNaN(
*decpt = 9999;
if (!(d->w.word1) && !(d->w.word0 & HI_ORDER_SIG_MASK)) {
- retval = ckalloc(9);
+ retval = Tcl_Alloc(9);
strcpy(retval, "Infinity");
if (endPtr) {
*endPtr = retval + 8;
}
} else {
- retval = ckalloc(4);
+ retval = Tcl_Alloc(4);
strcpy(retval, "NaN");
if (endPtr) {
*endPtr = retval + 3;
@@ -2229,7 +2166,7 @@ FormatZero(
int *decpt, /* Location of the decimal point. */
char **endPtr) /* Pointer to the end of the formatted data */
{
- char *retval = ckalloc(2);
+ char *retval = Tcl_Alloc(2);
strcpy(retval, "0");
if (endPtr) {
@@ -2775,7 +2712,7 @@ QuickConversion(
* Handle the peculiar case where the result has no significant digits.
*/
- retval = ckalloc(len + 1);
+ retval = Tcl_Alloc(len + 1);
if (ilim == 0) {
d -= 5.;
if (d > eps.d) {
@@ -2786,7 +2723,7 @@ QuickConversion(
*decpt = k;
return retval;
} else {
- ckfree(retval);
+ Tcl_Free(retval);
return NULL;
}
}
@@ -2801,7 +2738,7 @@ QuickConversion(
end = StrictQuickFormat(d, k, ilim, eps.d, retval, decpt);
}
if (end == NULL) {
- ckfree(retval);
+ Tcl_Free(retval);
return NULL;
}
*end = '\0';
@@ -2886,7 +2823,7 @@ ShorteningInt64Conversion(
char **endPtr) /* OUTPUT: Position of the terminal '\0' at
* the end of the returned string. */
{
- char *retval = ckalloc(len + 1);
+ char *retval = Tcl_Alloc(len + 1);
/* Output buffer. */
Tcl_WideUInt b = (bw * wuipow5[b5]) << b2;
/* Numerator of the fraction being
@@ -3050,7 +2987,7 @@ StrictInt64Conversion(
char **endPtr) /* OUTPUT: Position of the terminal '\0' at
* the end of the returned string. */
{
- char *retval = ckalloc(len + 1);
+ char *retval = Tcl_Alloc(len + 1);
/* Output buffer. */
Tcl_WideUInt b = (bw * wuipow5[b5]) << b2;
/* Numerator of the fraction being
@@ -3251,7 +3188,7 @@ ShorteningBignumConversionPowD(
char **endPtr) /* OUTPUT: Position of the terminal '\0' at
* the end of the returned string. */
{
- char *retval = ckalloc(len + 1);
+ char *retval = Tcl_Alloc(len + 1);
/* Output buffer. */
mp_int b; /* Numerator of the fraction being
* converted. */
@@ -3439,7 +3376,7 @@ StrictBignumConversionPowD(
char **endPtr) /* OUTPUT: Position of the terminal '\0' at
* the end of the returned string. */
{
- char *retval = ckalloc(len + 1);
+ char *retval = Tcl_Alloc(len + 1);
/* Output buffer. */
mp_int b; /* Numerator of the fraction being
* converted. */
@@ -3633,7 +3570,7 @@ ShorteningBignumConversion(
int *decpt, /* OUTPUT: Position of the decimal point. */
char **endPtr) /* OUTPUT: Pointer to the end of the number */
{
- char *retval = ckalloc(len+1);
+ char *retval = Tcl_Alloc(len+1);
/* Buffer of digits to return. */
char *s = retval; /* Cursor in the return value. */
mp_int b; /* Numerator of the result. */
@@ -3844,7 +3781,7 @@ StrictBignumConversion(
int *decpt, /* OUTPUT: Position of the decimal point. */
char **endPtr) /* OUTPUT: Pointer to the end of the number */
{
- char *retval = ckalloc(len+1);
+ char *retval = Tcl_Alloc(len+1);
/* Buffer of digits to return. */
char *s = retval; /* Cursor in the return value. */
mp_int b; /* Numerator of the result. */
@@ -3996,15 +3933,14 @@ StrictBignumConversion(
* This function is a service routine that produces the string of digits for
* floating-point-to-decimal conversion. It can do a number of things
* according to the 'flags' argument. Valid values for 'flags' include:
- * TCL_DD_SHORTEST - This is the default for floating point conversion if
- * ::tcl_precision is 0. It constructs the shortest string of
+ * TCL_DD_SHORTEST - This is the default for floating point conversion.
+ * It constructs the shortest string of
* digits that will reconvert to the given number when scanned.
* For floating point numbers that are exactly between two
* decimal numbers, it resolves using the 'round to even' rule.
* With this value, the 'ndigits' parameter is ignored.
* TCL_DD_E_FORMAT - This value is used to prepare numbers for %e format
- * conversion (or for default floating->string if tcl_precision
- * is not 0). It constructs a string of at most 'ndigits' digits,
+ * conversion. It constructs a string of at most 'ndigits' digits,
* choosing the one that is closest to the given number (and
* resolving ties with 'round to even'). It is allowed to return
* fewer than 'ndigits' if the number converts exactly; if the
@@ -4338,7 +4274,7 @@ TclInitDoubleConversion(void)
maxpow10_wide = (int)
floor(sizeof(Tcl_WideUInt) * CHAR_BIT * log(2.) / log(10.));
- pow10_wide = ckalloc((maxpow10_wide + 1) * sizeof(Tcl_WideUInt));
+ pow10_wide = Tcl_Alloc((maxpow10_wide + 1) * sizeof(Tcl_WideUInt));
u = 1;
for (i = 0; i < maxpow10_wide; ++i) {
pow10_wide[i] = u;
@@ -4445,7 +4381,7 @@ TclFinalizeDoubleConversion(void)
{
int i;
- ckfree(pow10_wide);
+ Tcl_Free(pow10_wide);
for (i=0; i<9; ++i) {
mp_clear(pow5 + i);
}
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index ce687c6..872a0bf 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -46,28 +46,28 @@
static void AppendPrintfToObjVA(Tcl_Obj *objPtr,
const char *format, va_list argList);
static void AppendUnicodeToUnicodeRep(Tcl_Obj *objPtr,
- const Tcl_UniChar *unicode, int appendNumChars);
+ const Tcl_UniChar *unicode, size_t appendNumChars);
static void AppendUnicodeToUtfRep(Tcl_Obj *objPtr,
- const Tcl_UniChar *unicode, int numChars);
+ const Tcl_UniChar *unicode, size_t numChars);
static void AppendUtfToUnicodeRep(Tcl_Obj *objPtr,
- const char *bytes, int numBytes);
+ const char *bytes, size_t numBytes);
static void AppendUtfToUtfRep(Tcl_Obj *objPtr,
- const char *bytes, int numBytes);
+ const char *bytes, size_t numBytes);
static void DupStringInternalRep(Tcl_Obj *objPtr,
Tcl_Obj *copyPtr);
-static int ExtendStringRepWithUnicode(Tcl_Obj *objPtr,
- const Tcl_UniChar *unicode, int numChars);
+static size_t ExtendStringRepWithUnicode(Tcl_Obj *objPtr,
+ const Tcl_UniChar *unicode, size_t numChars);
static void ExtendUnicodeRepWithString(Tcl_Obj *objPtr,
- const char *bytes, int numBytes,
- int numAppendChars);
+ const char *bytes, size_t numBytes,
+ size_t numAppendChars);
static void FillUnicodeRep(Tcl_Obj *objPtr);
static void FreeStringInternalRep(Tcl_Obj *objPtr);
-static void GrowStringBuffer(Tcl_Obj *objPtr, int needed, int flag);
-static void GrowUnicodeBuffer(Tcl_Obj *objPtr, int needed);
+static void GrowStringBuffer(Tcl_Obj *objPtr, size_t needed, int flag);
+static void GrowUnicodeBuffer(Tcl_Obj *objPtr, size_t needed);
static int SetStringFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr);
static void SetUnicodeObj(Tcl_Obj *objPtr,
- const Tcl_UniChar *unicode, int numChars);
-static int UnicodeLength(const Tcl_UniChar *unicode);
+ const Tcl_UniChar *unicode, size_t numChars);
+static size_t UnicodeLength(const Tcl_UniChar *unicode);
static void UpdateStringOfString(Tcl_Obj *objPtr);
/*
@@ -123,7 +123,7 @@ const Tcl_ObjType tclStringType = {
static void
GrowStringBuffer(
Tcl_Obj *objPtr,
- int needed,
+ size_t needed,
int flag)
{
/*
@@ -135,28 +135,26 @@ GrowStringBuffer(
String *stringPtr = GET_STRING(objPtr);
char *ptr = NULL;
- int attempt;
+ size_t attempt;
if (objPtr->bytes == &tclEmptyString) {
objPtr->bytes = NULL;
}
if (flag == 0 || stringPtr->allocated > 0) {
- if (needed <= INT_MAX / 2) {
- attempt = 2 * needed;
- ptr = attemptckrealloc(objPtr->bytes, attempt + 1);
- }
+ attempt = 2 * needed;
+ ptr = Tcl_AttemptRealloc(objPtr->bytes, attempt + 1);
if (ptr == NULL) {
/*
* Take care computing the amount of modest growth to avoid
* overflow into invalid argument values for attempt.
*/
- unsigned int limit = INT_MAX - needed;
- unsigned int extra = needed - objPtr->length + TCL_MIN_GROWTH;
- int growth = (int) ((extra > limit) ? limit : extra);
+ size_t limit = INT_MAX - needed;
+ size_t extra = needed - objPtr->length + TCL_MIN_GROWTH;
+ size_t growth = (extra > limit) ? limit : extra;
attempt = needed + growth;
- ptr = attemptckrealloc(objPtr->bytes, attempt + 1);
+ ptr = Tcl_AttemptRealloc(objPtr->bytes, attempt + 1);
}
}
if (ptr == NULL) {
@@ -165,7 +163,7 @@ GrowStringBuffer(
*/
attempt = needed;
- ptr = ckrealloc(objPtr->bytes, attempt + 1);
+ ptr = Tcl_Realloc(objPtr->bytes, attempt + 1);
}
objPtr->bytes = ptr;
stringPtr->allocated = attempt;
@@ -174,39 +172,34 @@ GrowStringBuffer(
static void
GrowUnicodeBuffer(
Tcl_Obj *objPtr,
- int needed)
+ size_t needed)
{
/*
* Pre-conditions:
* objPtr->typePtr == &tclStringType
* needed > stringPtr->maxChars
- * needed < STRING_MAXCHARS
*/
String *ptr = NULL, *stringPtr = GET_STRING(objPtr);
- int attempt;
+ size_t attempt;
if (stringPtr->maxChars > 0) {
/*
* Subsequent appends - apply the growth algorithm.
*/
- if (needed <= STRING_MAXCHARS / 2) {
- attempt = 2 * needed;
- ptr = stringAttemptRealloc(stringPtr, attempt);
- }
+ attempt = 2 * needed;
+ ptr = stringAttemptRealloc(stringPtr, attempt);
if (ptr == NULL) {
/*
* Take care computing the amount of modest growth to avoid
* overflow into invalid argument values for attempt.
*/
- unsigned int limit = STRING_MAXCHARS - needed;
- unsigned int extra = needed - stringPtr->numChars
+ size_t extra = needed - stringPtr->numChars
+ TCL_MIN_UNICHAR_GROWTH;
- int growth = (int) ((extra > limit) ? limit : extra);
- attempt = needed + growth;
+ attempt = needed + extra;
ptr = stringAttemptRealloc(stringPtr, attempt);
}
}
@@ -254,7 +247,7 @@ Tcl_Obj *
Tcl_NewStringObj(
const char *bytes, /* Points to the first of the length bytes
* used to initialize the new object. */
- int length) /* The number of bytes to copy from "bytes"
+ size_t length) /* The number of bytes to copy from "bytes"
* when initializing the new object. If
* negative, use bytes up to the first NUL
* byte. */
@@ -266,14 +259,13 @@ Tcl_Obj *
Tcl_NewStringObj(
const char *bytes, /* Points to the first of the length bytes
* used to initialize the new object. */
- int length) /* The number of bytes to copy from "bytes"
- * when initializing the new object. If
- * negative, use bytes up to the first NUL
- * byte. */
+ size_t length) /* The number of bytes to copy from "bytes"
+ * when initializing the new object. If -1,
+ * use bytes up to the first NUL byte. */
{
Tcl_Obj *objPtr;
- if (length < 0) {
+ if (length == TCL_AUTO_LENGTH) {
length = (bytes? strlen(bytes) : 0);
}
TclNewStringObj(objPtr, bytes, length);
@@ -315,10 +307,9 @@ Tcl_Obj *
Tcl_DbNewStringObj(
const char *bytes, /* Points to the first of the length bytes
* used to initialize the new object. */
- int length, /* The number of bytes to copy from "bytes"
- * when initializing the new object. If
- * negative, use bytes up to the first NUL
- * byte. */
+ size_t length, /* The number of bytes to copy from "bytes"
+ * when initializing the new object. If -1,
+ * use bytes up to the first NUL byte. */
const char *file, /* The name of the source file calling this
* function; used for debugging. */
int line) /* Line number in the source file; used for
@@ -326,7 +317,7 @@ Tcl_DbNewStringObj(
{
Tcl_Obj *objPtr;
- if (length < 0) {
+ if (length == TCL_AUTO_LENGTH) {
length = (bytes? strlen(bytes) : 0);
}
TclDbNewObj(objPtr, file, line);
@@ -338,10 +329,9 @@ Tcl_Obj *
Tcl_DbNewStringObj(
const char *bytes, /* Points to the first of the length bytes
* used to initialize the new object. */
- int length, /* The number of bytes to copy from "bytes"
- * when initializing the new object. If
- * negative, use bytes up to the first NUL
- * byte. */
+ size_t length, /* The number of bytes to copy from "bytes"
+ * when initializing the new object. If -1,
+ * use bytes up to the first NUL byte. */
const char *file, /* The name of the source file calling this
* function; used for debugging. */
int line) /* Line number in the source file; used for
@@ -374,7 +364,7 @@ Tcl_Obj *
Tcl_NewUnicodeObj(
const Tcl_UniChar *unicode, /* The unicode string used to initialize the
* new object. */
- int numChars) /* Number of characters in the unicode
+ size_t numChars) /* Number of characters in the unicode
* string. */
{
Tcl_Obj *objPtr;
@@ -401,13 +391,13 @@ Tcl_NewUnicodeObj(
*----------------------------------------------------------------------
*/
-int
+size_t
Tcl_GetCharLength(
Tcl_Obj *objPtr) /* The String object to get the num chars
* of. */
{
String *stringPtr;
- int numChars;
+ size_t numChars = 0;
/*
* Quick, no-shimmer return for short string reps.
@@ -430,10 +420,8 @@ Tcl_GetCharLength(
*/
if (TclIsPureByteArray(objPtr)) {
- int length;
-
- (void) Tcl_GetByteArrayFromObj(objPtr, &length);
- return length;
+ (void) TclGetByteArrayFromObj(objPtr, &numChars);
+ return numChars;
}
/*
@@ -448,7 +436,7 @@ Tcl_GetCharLength(
* If numChars is unknown, compute it.
*/
- if (numChars == -1) {
+ if (numChars == TCL_AUTO_LENGTH) {
TclNumUtfChars(numChars, objPtr->bytes, objPtr->length);
stringPtr->numChars = numChars;
}
@@ -519,14 +507,10 @@ int
Tcl_GetUniChar(
Tcl_Obj *objPtr, /* The object to get the Unicode charater
* from. */
- int index) /* Get the index'th Unicode character. */
+ size_t index) /* Get the index'th Unicode character. */
{
String *stringPtr;
- int ch, length;
-
- if (index < 0) {
- return -1;
- }
+ int ch;
/*
* Optimize the case where we're really dealing with a bytearray object
@@ -534,12 +518,13 @@ Tcl_GetUniChar(
*/
if (TclIsPureByteArray(objPtr)) {
- unsigned char *bytes = Tcl_GetByteArrayFromObj(objPtr, &length);
+ size_t length = 0;
+ unsigned char *bytes = TclGetByteArrayFromObj(objPtr, &length);
if (index >= length) {
return -1;
}
- return (int) bytes[index];
+ return bytes[index];
}
/*
@@ -554,7 +539,7 @@ Tcl_GetUniChar(
* If numChars is unknown, compute it.
*/
- if (stringPtr->numChars == -1) {
+ if (stringPtr->numChars == TCL_AUTO_LENGTH) {
TclNumUtfChars(stringPtr->numChars, objPtr->bytes, objPtr->length);
}
if (stringPtr->numChars == objPtr->length) {
@@ -590,36 +575,6 @@ Tcl_GetUniChar(
/*
*----------------------------------------------------------------------
*
- * Tcl_GetUnicode --
- *
- * Get the Unicode form of the String object. If the object is not
- * already a String object, it will be converted to one. If the String
- * object does not have a Unicode rep, then one is created from the UTF
- * string format.
- *
- * Results:
- * Returns a pointer to the object's internal Unicode string.
- *
- * Side effects:
- * Converts the object to have the String internal rep.
- *
- *----------------------------------------------------------------------
- */
-
-#ifndef TCL_NO_DEPRECATED
-#undef Tcl_GetUnicode
-Tcl_UniChar *
-Tcl_GetUnicode(
- Tcl_Obj *objPtr) /* The object to find the unicode string
- * for. */
-{
- return Tcl_GetUnicodeFromObj(objPtr, NULL);
-}
-#endif /* TCL_NO_DEPRECATED */
-
-/*
- *----------------------------------------------------------------------
- *
* Tcl_GetUnicodeFromObj --
*
* Get the Unicode form of the String object with length. If the object
@@ -682,15 +637,18 @@ Tcl_GetUnicodeFromObj(
Tcl_Obj *
Tcl_GetRange(
Tcl_Obj *objPtr, /* The Tcl object to find the range of. */
- int first, /* First index of the range. */
- int last) /* Last index of the range. */
+ size_t first, /* First index of the range. */
+ size_t last) /* Last index of the range. */
{
Tcl_Obj *newObjPtr; /* The Tcl object to find the range of. */
String *stringPtr;
- int length;
+ size_t length = 0;
- if (first < 0) {
- first = 0;
+ if (first == TCL_INDEX_NONE) {
+ first = TCL_INDEX_START;
+ }
+ if (last + 2 <= first + 1) {
+ return Tcl_NewObj();
}
/*
@@ -699,7 +657,7 @@ Tcl_GetRange(
*/
if (TclIsPureByteArray(objPtr)) {
- unsigned char *bytes = Tcl_GetByteArrayFromObj(objPtr, &length);
+ unsigned char *bytes = TclGetByteArrayFromObj(objPtr, &length);
if (last >= length) {
last = length - 1;
@@ -722,7 +680,7 @@ Tcl_GetRange(
* If numChars is unknown, compute it.
*/
- if (stringPtr->numChars == -1) {
+ if (stringPtr->numChars == TCL_AUTO_LENGTH) {
TclNumUtfChars(stringPtr->numChars, objPtr->bytes, objPtr->length);
}
if (stringPtr->numChars == objPtr->length) {
@@ -754,11 +712,11 @@ Tcl_GetRange(
}
#if TCL_UTF_MAX <= 4
/* See: bug [11ae2be95dac9417] */
- if ((first > 0) && ((stringPtr->unicode[first] & 0xFC00) == 0xDC00)
+ if ((first + 1 > 1) && ((stringPtr->unicode[first] & 0xFC00) == 0xDC00)
&& ((stringPtr->unicode[first-1] & 0xFC00) == 0xD800)) {
++first;
}
- if ((last + 1 < stringPtr->numChars)
+ if ((last + 2 < stringPtr->numChars + 1)
&& ((stringPtr->unicode[last+1] & 0xFC00) == 0xDC00)
&& ((stringPtr->unicode[last] & 0xFC00) == 0xD800)) {
++last;
@@ -793,8 +751,8 @@ Tcl_SetStringObj(
Tcl_Obj *objPtr, /* Object whose internal rep to init. */
const char *bytes, /* Points to the first of the length bytes
* used to initialize the object. */
- int length) /* The number of bytes to copy from "bytes"
- * when initializing the object. If negative,
+ size_t length) /* The number of bytes to copy from "bytes"
+ * when initializing the object. If -1,
* use bytes up to the first NUL byte.*/
{
if (Tcl_IsShared(objPtr)) {
@@ -813,7 +771,7 @@ Tcl_SetStringObj(
*/
TclInvalidateStringRep(objPtr);
- if (length < 0) {
+ if (length == TCL_AUTO_LENGTH) {
length = (bytes? strlen(bytes) : 0);
}
TclInitStringRep(objPtr, bytes, length);
@@ -846,21 +804,12 @@ void
Tcl_SetObjLength(
Tcl_Obj *objPtr, /* Pointer to object. This object must not
* currently be shared. */
- int length) /* Number of bytes desired for string
+ size_t length) /* Number of bytes desired for string
* representation of object, not including
* terminating null byte. */
{
String *stringPtr;
- if (length < 0) {
- /*
- * Setting to a negative length is nonsense. This is probably the
- * result of overflowing the signed integer range.
- */
-
- Tcl_Panic("Tcl_SetObjLength: negative length requested: "
- "%d (integer overflow?)", length);
- }
if (Tcl_IsShared(objPtr)) {
Tcl_Panic("%s called with shared object", "Tcl_SetObjLength");
}
@@ -881,9 +830,9 @@ Tcl_SetObjLength(
* Need to enlarge the buffer.
*/
if (objPtr->bytes == &tclEmptyString) {
- objPtr->bytes = ckalloc(length + 1);
+ objPtr->bytes = Tcl_Alloc(length + 1);
} else {
- objPtr->bytes = ckrealloc(objPtr->bytes, length + 1);
+ objPtr->bytes = Tcl_Realloc(objPtr->bytes, length + 1);
}
stringPtr->allocated = length;
}
@@ -895,14 +844,9 @@ Tcl_SetObjLength(
* Invalidate the unicode data.
*/
- stringPtr->numChars = -1;
+ stringPtr->numChars = TCL_AUTO_LENGTH;
stringPtr->hasUnicode = 0;
} else {
- /*
- * Changing length of pure unicode string.
- */
-
- stringCheckLimits(length);
if (length > stringPtr->maxChars) {
stringPtr = stringRealloc(stringPtr, length);
SET_STRING(objPtr, stringPtr);
@@ -951,20 +895,12 @@ int
Tcl_AttemptSetObjLength(
Tcl_Obj *objPtr, /* Pointer to object. This object must not
* currently be shared. */
- int length) /* Number of bytes desired for string
+ size_t length) /* Number of bytes desired for string
* representation of object, not including
* terminating null byte. */
{
String *stringPtr;
- if (length < 0) {
- /*
- * Setting to a negative length is nonsense. This is probably the
- * result of overflowing the signed integer range.
- */
-
- return 0;
- }
if (Tcl_IsShared(objPtr)) {
Tcl_Panic("%s called with shared object", "Tcl_AttemptSetObjLength");
}
@@ -987,9 +923,9 @@ Tcl_AttemptSetObjLength(
char *newBytes;
if (objPtr->bytes == &tclEmptyString) {
- newBytes = attemptckalloc(length + 1);
+ newBytes = Tcl_AttemptAlloc(length + 1);
} else {
- newBytes = attemptckrealloc(objPtr->bytes, length + 1);
+ newBytes = Tcl_AttemptRealloc(objPtr->bytes, length + 1);
}
if (newBytes == NULL) {
return 0;
@@ -1005,16 +941,13 @@ Tcl_AttemptSetObjLength(
* Invalidate the unicode data.
*/
- stringPtr->numChars = -1;
+ stringPtr->numChars = TCL_AUTO_LENGTH;
stringPtr->hasUnicode = 0;
} else {
/*
* Changing length of pure unicode string.
*/
- if (length > STRING_MAXCHARS) {
- return 0;
- }
if (length > stringPtr->maxChars) {
stringPtr = stringAttemptRealloc(stringPtr, length);
if (stringPtr == NULL) {
@@ -1061,7 +994,7 @@ Tcl_SetUnicodeObj(
Tcl_Obj *objPtr, /* The object to set the string of. */
const Tcl_UniChar *unicode, /* The unicode string used to initialize the
* object. */
- int numChars) /* Number of characters in the unicode
+ size_t numChars) /* Number of characters in the unicode
* string. */
{
if (Tcl_IsShared(objPtr)) {
@@ -1071,18 +1004,17 @@ Tcl_SetUnicodeObj(
SetUnicodeObj(objPtr, unicode, numChars);
}
-static int
+static size_t
UnicodeLength(
const Tcl_UniChar *unicode)
{
- int numChars = 0;
+ size_t numChars = 0;
if (unicode) {
- while (numChars >= 0 && unicode[numChars] != 0) {
+ while ((numChars != TCL_AUTO_LENGTH) && (unicode[numChars] != 0)) {
numChars++;
}
}
- stringCheckLimits(numChars);
return numChars;
}
@@ -1091,12 +1023,12 @@ SetUnicodeObj(
Tcl_Obj *objPtr, /* The object to set the string of. */
const Tcl_UniChar *unicode, /* The unicode string used to initialize the
* object. */
- int numChars) /* Number of characters in the unicode
+ size_t numChars) /* Number of characters in the unicode
* string. */
{
String *stringPtr;
- if (numChars < 0) {
+ if (numChars == TCL_AUTO_LENGTH) {
numChars = UnicodeLength(unicode);
}
@@ -1104,7 +1036,6 @@ SetUnicodeObj(
* Allocate enough space for the String structure + Unicode string.
*/
- stringCheckLimits(numChars);
stringPtr = stringAlloc(numChars);
SET_STRING(objPtr, stringPtr);
objPtr->typePtr = &tclStringType;
@@ -1142,23 +1073,23 @@ Tcl_AppendLimitedToObj(
Tcl_Obj *objPtr, /* Points to the object to append to. */
const char *bytes, /* Points to the bytes to append to the
* object. */
- int length, /* The number of bytes available to be
- * appended from "bytes". If < 0, then all
- * bytes up to a NUL byte are available. */
- int limit, /* The maximum number of bytes to append to
+ size_t length, /* The number of bytes available to be
+ * appended from "bytes". If -1, then
+ * all bytes up to a NUL byte are available. */
+ size_t limit, /* The maximum number of bytes to append to
* the object. */
const char *ellipsis) /* Ellipsis marker string, appended to the
* object to indicate not all available bytes
* at "bytes" were appended. */
{
String *stringPtr;
- int toCopy = 0;
+ size_t toCopy = 0;
if (Tcl_IsShared(objPtr)) {
Tcl_Panic("%s called with shared object", "Tcl_AppendLimitedToObj");
}
- if (length < 0) {
+ if (length == TCL_AUTO_LENGTH) {
length = (bytes ? strlen(bytes) : 0);
}
if (length == 0) {
@@ -1172,7 +1103,7 @@ Tcl_AppendLimitedToObj(
ellipsis = "...";
}
toCopy = (bytes == NULL) ? limit
- : Tcl_UtfPrev(bytes+limit+1-strlen(ellipsis), bytes) - bytes;
+ : (size_t)(Tcl_UtfPrev(bytes+limit+1-strlen(ellipsis), bytes) - bytes);
}
/*
@@ -1184,7 +1115,7 @@ Tcl_AppendLimitedToObj(
SetStringFromAny(NULL, objPtr);
stringPtr = GET_STRING(objPtr);
- if (stringPtr->hasUnicode && stringPtr->numChars > 0) {
+ if (stringPtr->hasUnicode && (stringPtr->numChars+1) > 1) {
AppendUtfToUnicodeRep(objPtr, bytes, toCopy);
} else {
AppendUtfToUtfRep(objPtr, bytes, toCopy);
@@ -1195,7 +1126,7 @@ Tcl_AppendLimitedToObj(
}
stringPtr = GET_STRING(objPtr);
- if (stringPtr->hasUnicode && stringPtr->numChars > 0) {
+ if (stringPtr->hasUnicode && (stringPtr->numChars+1) > 1) {
AppendUtfToUnicodeRep(objPtr, ellipsis, strlen(ellipsis));
} else {
AppendUtfToUtfRep(objPtr, ellipsis, strlen(ellipsis));
@@ -1224,11 +1155,11 @@ Tcl_AppendToObj(
Tcl_Obj *objPtr, /* Points to the object to append to. */
const char *bytes, /* Points to the bytes to append to the
* object. */
- int length) /* The number of bytes to append from "bytes".
- * If < 0, then append all bytes up to NUL
+ size_t length) /* The number of bytes to append from "bytes".
+ * If -1, then append all bytes up to NUL
* byte. */
{
- Tcl_AppendLimitedToObj(objPtr, bytes, length, INT_MAX, NULL);
+ Tcl_AppendLimitedToObj(objPtr, bytes, length, TCL_AUTO_LENGTH, NULL);
}
/*
@@ -1253,7 +1184,7 @@ Tcl_AppendUnicodeToObj(
Tcl_Obj *objPtr, /* Points to the object to append to. */
const Tcl_UniChar *unicode, /* The unicode string to append to the
* object. */
- int length) /* Number of chars in "unicode". */
+ size_t length) /* Number of chars in "unicode". */
{
String *stringPtr;
@@ -1307,7 +1238,8 @@ Tcl_AppendObjToObj(
Tcl_Obj *appendObjPtr) /* Object to append. */
{
String *stringPtr;
- int length, numChars, appendNumChars = -1;
+ size_t length = 0, numChars;
+ size_t appendNumChars = TCL_AUTO_LENGTH;
const char *bytes;
/*
@@ -1331,7 +1263,7 @@ Tcl_AppendObjToObj(
/*
* You might expect the code here to be
*
- * bytes = Tcl_GetByteArrayFromObj(appendObjPtr, &length);
+ * bytes = TclGetByteArrayFromObj(appendObjPtr, &length);
* TclAppendBytesToByteArray(objPtr, bytes, length);
*
* and essentially all of the time that would be fine. However, it
@@ -1347,10 +1279,10 @@ Tcl_AppendObjToObj(
* First, get the lengths.
*/
- int lengthSrc;
+ size_t lengthSrc = 0;
- (void) Tcl_GetByteArrayFromObj(objPtr, &length);
- (void) Tcl_GetByteArrayFromObj(appendObjPtr, &lengthSrc);
+ (void) TclGetByteArrayFromObj(objPtr, &length);
+ (void) TclGetByteArrayFromObj(appendObjPtr, &lengthSrc);
/*
* Grow buffer enough for the append.
@@ -1393,7 +1325,7 @@ Tcl_AppendObjToObj(
if (TclHasIntRep(appendObjPtr, &tclStringType)) {
Tcl_UniChar *unicode =
- Tcl_GetUnicodeFromObj(appendObjPtr, &numChars);
+ TclGetUnicodeFromObj(appendObjPtr, &numChars);
AppendUnicodeToUnicodeRep(objPtr, unicode, numChars);
} else {
@@ -1412,7 +1344,7 @@ Tcl_AppendObjToObj(
bytes = TclGetStringFromObj(appendObjPtr, &length);
numChars = stringPtr->numChars;
- if ((numChars >= 0) && TclHasIntRep(appendObjPtr, &tclStringType)) {
+ if ((numChars != TCL_AUTO_LENGTH) && TclHasIntRep(appendObjPtr, &tclStringType)) {
String *appendStringPtr = GET_STRING(appendObjPtr);
appendNumChars = appendStringPtr->numChars;
@@ -1420,7 +1352,7 @@ Tcl_AppendObjToObj(
AppendUtfToUtfRep(objPtr, bytes, length);
- if (numChars >= 0 && appendNumChars >= 0) {
+ if ((numChars != TCL_AUTO_LENGTH) && (appendNumChars != TCL_AUTO_LENGTH)) {
stringPtr->numChars = numChars + appendNumChars;
}
}
@@ -1446,12 +1378,12 @@ static void
AppendUnicodeToUnicodeRep(
Tcl_Obj *objPtr, /* Points to the object to append to. */
const Tcl_UniChar *unicode, /* String to append. */
- int appendNumChars) /* Number of chars of "unicode" to append. */
+ size_t appendNumChars) /* Number of chars of "unicode" to append. */
{
String *stringPtr;
- int numChars;
+ size_t numChars;
- if (appendNumChars < 0) {
+ if (appendNumChars == TCL_AUTO_LENGTH) {
appendNumChars = UnicodeLength(unicode);
}
if (appendNumChars == 0) {
@@ -1470,10 +1402,9 @@ AppendUnicodeToUnicodeRep(
*/
numChars = stringPtr->numChars + appendNumChars;
- stringCheckLimits(numChars);
if (numChars > stringPtr->maxChars) {
- int offset = -1;
+ size_t index = TCL_INDEX_NONE;
/*
* Protect against case where unicode points into the existing
@@ -1483,7 +1414,7 @@ AppendUnicodeToUnicodeRep(
if (unicode && unicode >= stringPtr->unicode
&& unicode <= stringPtr->unicode + stringPtr->maxChars) {
- offset = unicode - stringPtr->unicode;
+ index = unicode - stringPtr->unicode;
}
GrowUnicodeBuffer(objPtr, numChars);
@@ -1493,8 +1424,8 @@ AppendUnicodeToUnicodeRep(
* Relocate unicode if needed; see above.
*/
- if (offset >= 0) {
- unicode = stringPtr->unicode + offset;
+ if (index != TCL_INDEX_NONE) {
+ unicode = stringPtr->unicode + index;
}
}
@@ -1535,13 +1466,13 @@ static void
AppendUnicodeToUtfRep(
Tcl_Obj *objPtr, /* Points to the object to append to. */
const Tcl_UniChar *unicode, /* String to convert to UTF. */
- int numChars) /* Number of chars of "unicode" to convert. */
+ size_t numChars) /* Number of chars of "unicode" to convert. */
{
String *stringPtr = GET_STRING(objPtr);
numChars = ExtendStringRepWithUnicode(objPtr, unicode, numChars);
- if (stringPtr->numChars != -1) {
+ if (stringPtr->numChars != TCL_AUTO_LENGTH) {
stringPtr->numChars += numChars;
}
}
@@ -1568,7 +1499,7 @@ static void
AppendUtfToUnicodeRep(
Tcl_Obj *objPtr, /* Points to the object to append to. */
const char *bytes, /* String to convert to Unicode. */
- int numBytes) /* Number of bytes of "bytes" to convert. */
+ size_t numBytes) /* Number of bytes of "bytes" to convert. */
{
String *stringPtr;
@@ -1604,10 +1535,10 @@ static void
AppendUtfToUtfRep(
Tcl_Obj *objPtr, /* Points to the object to append to. */
const char *bytes, /* String to append. */
- int numBytes) /* Number of bytes of "bytes" to append. */
+ size_t numBytes) /* Number of bytes of "bytes" to append. */
{
String *stringPtr;
- int newLength, oldLength;
+ size_t newLength, oldLength;
if (numBytes == 0) {
return;
@@ -1623,13 +1554,10 @@ AppendUtfToUtfRep(
}
oldLength = objPtr->length;
newLength = numBytes + oldLength;
- if (newLength < 0) {
- Tcl_Panic("max size for a Tcl value (%d bytes) exceeded", INT_MAX);
- }
stringPtr = GET_STRING(objPtr);
if (newLength > stringPtr->allocated) {
- int offset = -1;
+ size_t offset = TCL_AUTO_LENGTH;
/*
* Protect against case where unicode points into the existing
@@ -1653,7 +1581,7 @@ AppendUtfToUtfRep(
* Relocate bytes if needed; see above.
*/
- if (offset >= 0) {
+ if (offset != TCL_AUTO_LENGTH) {
bytes = objPtr->bytes + offset;
}
}
@@ -1662,7 +1590,7 @@ AppendUtfToUtfRep(
* Invalidate the unicode data.
*/
- stringPtr->numChars = -1;
+ stringPtr->numChars = TCL_AUTO_LENGTH;
stringPtr->hasUnicode = 0;
if (bytes) {
@@ -1675,7 +1603,7 @@ AppendUtfToUtfRep(
/*
*----------------------------------------------------------------------
*
- * Tcl_AppendStringsToObjVA --
+ * Tcl_AppendStringsToObj --
*
* This function appends one or more null-terminated strings to an
* object.
@@ -1691,10 +1619,13 @@ AppendUtfToUtfRep(
*/
void
-Tcl_AppendStringsToObjVA(
- Tcl_Obj *objPtr, /* Points to the object to append to. */
- va_list argList) /* Variable argument list. */
+Tcl_AppendStringsToObj(
+ Tcl_Obj *objPtr,
+ ...)
{
+ va_list argList;
+
+ va_start(argList, objPtr);
if (Tcl_IsShared(objPtr)) {
Tcl_Panic("%s called with shared object", "Tcl_AppendStringsToObj");
}
@@ -1707,35 +1638,6 @@ Tcl_AppendStringsToObjVA(
}
Tcl_AppendToObj(objPtr, bytes, -1);
}
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * Tcl_AppendStringsToObj --
- *
- * This function appends one or more null-terminated strings to an
- * object.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The contents of all the string arguments are appended to the string
- * representation of objPtr.
- *
- *----------------------------------------------------------------------
- */
-
-void
-Tcl_AppendStringsToObj(
- Tcl_Obj *objPtr,
- ...)
-{
- va_list argList;
-
- va_start(argList, objPtr);
- Tcl_AppendStringsToObjVA(objPtr, argList);
va_end(argList);
}
@@ -1768,8 +1670,8 @@ Tcl_AppendFormatToObj(
Tcl_Obj *const objv[])
{
const char *span = format, *msg, *errCode;
- int numBytes = 0, objIndex = 0, gotXpg = 0, gotSequential = 0;
- int originalLength, limit;
+ int objIndex = 0, gotXpg = 0, gotSequential = 0;
+ size_t originalLength, limit, numBytes = 0;
Tcl_UniChar ch = 0;
static const char *mixedXPG =
"cannot mix \"%\" and \"%n$\" conversion specifiers";
@@ -1782,8 +1684,8 @@ Tcl_AppendFormatToObj(
if (Tcl_IsShared(appendObj)) {
Tcl_Panic("%s called with shared object", "Tcl_AppendFormatToObj");
}
- TclGetStringFromObj(appendObj, &originalLength);
- limit = INT_MAX - originalLength;
+ (void)TclGetStringFromObj(appendObj, &originalLength);
+ limit = (size_t)INT_MAX - originalLength;
/*
* Format string is NUL-terminated.
@@ -1796,7 +1698,8 @@ Tcl_AppendFormatToObj(
#ifndef TCL_WIDE_INT_IS_LONG
int useWide = 0;
#endif
- int newXpg, numChars, allocSegment = 0, segmentLimit, segmentNumBytes;
+ int newXpg, numChars, allocSegment = 0, segmentLimit;
+ size_t segmentNumBytes;
Tcl_Obj *segment;
int step = TclUtfToUniChar(format, &ch);
@@ -1928,7 +1831,7 @@ Tcl_AppendFormatToObj(
format += step;
step = TclUtfToUniChar(format, &ch);
}
- if (width > limit) {
+ if (width > (int) limit) {
msg = overflow;
errCode = "OVERFLOW";
goto errorMsg;
@@ -2153,20 +2056,12 @@ Tcl_AppendFormatToObj(
Tcl_AppendToObj(segment, "0b", 2);
segmentLimit -= 2;
break;
-#if TCL_MAJOR_VERSION < 9
- case 'd':
- if (gotZero) {
- Tcl_AppendToObj(segment, "0d", 2);
- segmentLimit -= 2;
- }
- break;
-#endif
}
}
switch (ch) {
case 'd': {
- int length;
+ size_t length;
Tcl_Obj *pure;
const char *bytes;
@@ -2201,10 +2096,10 @@ Tcl_AppendFormatToObj(
*/
if (gotPrecision) {
- if (length < precision) {
+ if (length < (size_t)precision) {
segmentLimit -= precision - length;
}
- while (length < precision) {
+ while (length < (size_t)precision) {
Tcl_AppendToObj(segment, "0", 1);
length++;
}
@@ -2212,10 +2107,10 @@ Tcl_AppendFormatToObj(
}
if (gotZero) {
length += Tcl_GetCharLength(segment);
- if (length < width) {
+ if (length < (size_t)width) {
segmentLimit -= width - length;
}
- while (length < width) {
+ while (length < (size_t)width) {
Tcl_AppendToObj(segment, "0", 1);
length++;
}
@@ -2236,9 +2131,10 @@ Tcl_AppendFormatToObj(
case 'x':
case 'X':
case 'b': {
- Tcl_WideUInt bits = (Tcl_WideUInt) 0;
- Tcl_WideInt numDigits = (Tcl_WideInt) 0;
- int length, numBits = 4, base = 16, index = 0, shift = 0;
+ Tcl_WideUInt bits = 0;
+ Tcl_WideInt numDigits = 0;
+ int numBits = 4, base = 16, index = 0, shift = 0;
+ size_t length;
Tcl_Obj *pure;
char *bytes;
@@ -2302,9 +2198,9 @@ Tcl_AppendFormatToObj(
numDigits = 1;
}
pure = Tcl_NewObj();
- Tcl_SetObjLength(pure, (int) numDigits);
+ Tcl_SetObjLength(pure, numDigits);
bytes = TclGetString(pure);
- toAppend = length = (int) numDigits;
+ toAppend = length = numDigits;
while (numDigits--) {
int digitOffset;
@@ -2316,7 +2212,7 @@ Tcl_AppendFormatToObj(
}
shift -= numBits;
}
- digitOffset = (int) (bits % base);
+ digitOffset = bits % base;
if (digitOffset > 9) {
if (ch == 'X') {
bytes[numDigits] = 'A' + digitOffset - 10;
@@ -2332,10 +2228,10 @@ Tcl_AppendFormatToObj(
mp_clear(&big);
}
if (gotPrecision) {
- if (length < precision) {
+ if (length < (size_t)precision) {
segmentLimit -= precision - length;
}
- while (length < precision) {
+ while (length < (size_t)precision) {
Tcl_AppendToObj(segment, "0", 1);
length++;
}
@@ -2343,10 +2239,10 @@ Tcl_AppendFormatToObj(
}
if (gotZero) {
length += Tcl_GetCharLength(segment);
- if (length < width) {
+ if (length < (size_t)width) {
segmentLimit -= width - length;
}
- while (length < width) {
+ while (length < (size_t)width) {
Tcl_AppendToObj(segment, "0", 1);
length++;
}
@@ -2465,7 +2361,7 @@ Tcl_AppendFormatToObj(
}
}
- TclGetStringFromObj(segment, &segmentNumBytes);
+ (void)TclGetStringFromObj(segment, &segmentNumBytes);
if (segmentNumBytes > limit) {
if (allocSegment) {
Tcl_DecrRefCount(segment);
@@ -2608,7 +2504,7 @@ AppendPrintfToObjVA(
*/
q = Tcl_UtfPrev(end, bytes);
- if (!Tcl_UtfCharComplete(q, (int)(end - q))) {
+ if (!Tcl_UtfCharComplete(q, (end - q))) {
end = q;
}
@@ -2619,7 +2515,7 @@ AppendPrintfToObjVA(
}
Tcl_ListObjAppendElement(NULL, list,
- Tcl_NewStringObj(bytes , (int)(end - bytes)));
+ Tcl_NewStringObj(bytes , (end - bytes)));
break;
}
@@ -2669,7 +2565,7 @@ AppendPrintfToObjVA(
seekingConversion = 0;
break;
case '*':
- lastNum = (int) va_arg(argList, int);
+ lastNum = va_arg(argList, int);
Tcl_ListObjAppendElement(NULL, list, Tcl_NewWideIntObj(lastNum));
p++;
break;
@@ -2677,7 +2573,7 @@ AppendPrintfToObjVA(
case '5': case '6': case '7': case '8': case '9': {
char *end;
- lastNum = (int) strtoul(p, &end, 10);
+ lastNum = strtoul(p, &end, 10);
p = end;
break;
}
@@ -2728,7 +2624,7 @@ AppendPrintfToObjVA(
if (code != TCL_OK) {
Tcl_AppendPrintfToObj(objPtr,
"Unable to format \"%s\" with supplied arguments: %s",
- format, Tcl_GetString(list));
+ format, TclGetString(list));
}
Tcl_DecrRefCount(list);
}
@@ -2808,12 +2704,12 @@ Tcl_ObjPrintf(
char *
TclGetStringStorage(
Tcl_Obj *objPtr,
- unsigned int *sizePtr)
+ size_t *sizePtr)
{
String *stringPtr;
if (!TclHasIntRep(objPtr, &tclStringType) || objPtr->bytes == NULL) {
- return TclGetStringFromObj(objPtr, (int *)sizePtr);
+ return TclGetStringFromObj(objPtr, sizePtr);
}
stringPtr = GET_STRING(objPtr);
@@ -2842,12 +2738,12 @@ Tcl_Obj *
TclStringRepeat(
Tcl_Interp *interp,
Tcl_Obj *objPtr,
- int count,
+ size_t count,
int flags)
{
Tcl_Obj *objResultPtr;
int inPlace = flags & TCL_STRING_IN_PLACE;
- int length = 0, unichar = 0, done = 1;
+ size_t length = 0, unichar = 0, done = 1;
int binary = TclIsPureByteArray(objPtr);
/* assert (count >= 2) */
@@ -2870,13 +2766,13 @@ TclStringRepeat(
if (binary) {
/* Result will be pure byte array. Pre-size it */
- Tcl_GetByteArrayFromObj(objPtr, &length);
+ (void)TclGetByteArrayFromObj(objPtr, &length);
} else if (unichar) {
/* Result will be pure Tcl_UniChar array. Pre-size it. */
- Tcl_GetUnicodeFromObj(objPtr, &length);
+ (void)TclGetUnicodeFromObj(objPtr, &length);
} else {
/* Result will be concat of string reps. Pre-size it. */
- Tcl_GetStringFromObj(objPtr, &length);
+ (void)TclGetStringFromObj(objPtr, &length);
}
if (length == 0) {
@@ -2942,7 +2838,7 @@ TclStringRepeat(
*/
if (!inPlace || Tcl_IsShared(objPtr)) {
- objResultPtr = Tcl_NewStringObj(Tcl_GetString(objPtr), length);
+ objResultPtr = Tcl_NewStringObj(TclGetString(objPtr), length);
} else {
TclFreeIntRep(objPtr);
objResultPtr = objPtr;
@@ -2950,7 +2846,7 @@ TclStringRepeat(
if (0 == Tcl_AttemptSetObjLength(objResultPtr, count*length)) {
if (interp) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "string size overflow: unable to alloc %u bytes",
+ "string size overflow: unable to alloc %" TCL_Z_MODIFIER "u bytes",
count*length));
Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL);
}
@@ -2961,7 +2857,7 @@ TclStringRepeat(
Tcl_AppendObjToObj(objResultPtr, objResultPtr);
done *= 2;
}
- Tcl_AppendToObj(objResultPtr, Tcl_GetString(objResultPtr),
+ Tcl_AppendToObj(objResultPtr, TclGetString(objResultPtr),
(count - done) * length);
}
return objResultPtr;
@@ -2992,7 +2888,8 @@ TclStringCat(
int flags)
{
Tcl_Obj *objResultPtr, * const *ov;
- int oc, length = 0, binary = 1;
+ int oc, binary = 1;
+ size_t length = 0;
int allowUniChar = 1, requestUniChar = 0;
int first = objc - 1; /* Index of first value possibly not empty */
int last = 0; /* Index of last value possibly not empty */
@@ -3052,7 +2949,7 @@ TclStringCat(
* Result will be pure byte array. Pre-size it
*/
- int numBytes;
+ size_t numBytes = 0;
ov = objv;
oc = objc;
do {
@@ -3065,14 +2962,12 @@ TclStringCat(
*/
if (TclIsPureByteArray(objPtr)) {
- Tcl_GetByteArrayFromObj(objPtr, &numBytes); /* PANIC? */
+ (void)TclGetByteArrayFromObj(objPtr, &numBytes); /* PANIC? */
if (numBytes) {
last = objc - oc;
if (length == 0) {
first = last;
- } else if (numBytes > INT_MAX - length) {
- goto overflow;
}
length += numBytes;
}
@@ -3089,15 +2984,13 @@ TclStringCat(
Tcl_Obj *objPtr = *ov++;
if ((objPtr->bytes == NULL) || (objPtr->length)) {
- int numChars;
+ size_t numChars;
- Tcl_GetUnicodeFromObj(objPtr, &numChars); /* PANIC? */
+ (void)TclGetUnicodeFromObj(objPtr, &numChars); /* PANIC? */
if (numChars) {
last = objc - oc;
if (length == 0) {
first = last;
- } else if (numChars > INT_MAX - length) {
- goto overflow;
}
length += numChars;
}
@@ -3124,7 +3017,7 @@ TclStringCat(
/* No string rep; Take the chance we can avoid making it */
pendingPtr = objPtr;
} else {
- Tcl_GetStringFromObj(objPtr, &length); /* PANIC? */
+ (void)TclGetStringFromObj(objPtr, &length); /* PANIC? */
}
} while (--oc && (length == 0) && (pendingPtr == NULL));
@@ -3138,7 +3031,7 @@ TclStringCat(
first = last = objc - oc - 1;
if (oc && (length == 0)) {
- int numBytes;
+ size_t numBytes;
/* assert ( pendingPtr != NULL ) */
@@ -3150,20 +3043,20 @@ TclStringCat(
do {
Tcl_Obj *objPtr = *ov++;
- Tcl_GetStringFromObj(objPtr, &numBytes); /* PANIC? */
+ (void)TclGetStringFromObj(objPtr, &numBytes); /* PANIC? */
} while (--oc && numBytes == 0 && pendingPtr->bytes == NULL);
if (numBytes) {
last = objc -oc -1;
}
if (oc || numBytes) {
- Tcl_GetStringFromObj(pendingPtr, &length);
+ (void)TclGetStringFromObj(pendingPtr, &length);
}
if (length == 0) {
if (numBytes) {
first = last;
}
- } else if (numBytes > INT_MAX - length) {
+ } else if (numBytes + length > (size_t)INT_MAX) {
goto overflow;
}
length += numBytes;
@@ -3171,15 +3064,16 @@ TclStringCat(
} while (oc && (length == 0));
while (oc) {
- int numBytes;
+ size_t numBytes;
Tcl_Obj *objPtr = *ov++;
/* assert ( length > 0 && pendingPtr == NULL ) */
- Tcl_GetStringFromObj(objPtr, &numBytes); /* PANIC? */
+ TclGetString(objPtr); /* PANIC? */
+ numBytes = objPtr->length;
if (numBytes) {
last = objc - oc;
- if (numBytes > INT_MAX - length) {
+ if (numBytes + length > (size_t)INT_MAX) {
goto overflow;
}
length += numBytes;
@@ -3206,10 +3100,10 @@ TclStringCat(
*/
if (inPlace && !Tcl_IsShared(*objv)) {
- int start;
+ size_t start = 0;
objResultPtr = *objv++; objc--;
- Tcl_GetByteArrayFromObj(objResultPtr, &start);
+ (void)TclGetByteArrayFromObj(objResultPtr, &start);
dst = Tcl_SetByteArrayLength(objResultPtr, length) + start;
} else {
objResultPtr = Tcl_NewByteArrayObj(NULL, length);
@@ -3225,8 +3119,8 @@ TclStringCat(
*/
if (TclIsPureByteArray(objPtr)) {
- int more;
- unsigned char *src = Tcl_GetByteArrayFromObj(objPtr, &more);
+ size_t more = 0;
+ unsigned char *src = TclGetByteArrayFromObj(objPtr, &more);
memcpy(dst, src, more);
dst += more;
}
@@ -3236,12 +3130,12 @@ TclStringCat(
Tcl_UniChar *dst;
if (inPlace && !Tcl_IsShared(*objv)) {
- int start;
+ size_t start;
objResultPtr = *objv++; objc--;
/* Ugly interface! Force resize of the unicode array. */
- Tcl_GetUnicodeFromObj(objResultPtr, &start);
+ (void)TclGetUnicodeFromObj(objResultPtr, &start);
Tcl_InvalidateStringRep(objResultPtr);
if (0 == Tcl_AttemptSetObjLength(objResultPtr, length)) {
if (interp) {
@@ -3276,8 +3170,8 @@ TclStringCat(
Tcl_Obj *objPtr = *objv++;
if ((objPtr->bytes == NULL) || (objPtr->length)) {
- int more;
- Tcl_UniChar *src = Tcl_GetUnicodeFromObj(objPtr, &more);
+ size_t more;
+ Tcl_UniChar *src = TclGetUnicodeFromObj(objPtr, &more);
memcpy(dst, src, more * sizeof(Tcl_UniChar));
dst += more;
}
@@ -3287,21 +3181,21 @@ TclStringCat(
char *dst;
if (inPlace && !Tcl_IsShared(*objv)) {
- int start;
+ size_t start;
objResultPtr = *objv++; objc--;
- Tcl_GetStringFromObj(objResultPtr, &start);
+ (void)TclGetStringFromObj(objResultPtr, &start);
if (0 == Tcl_AttemptSetObjLength(objResultPtr, length)) {
if (interp) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "concatenation failed: unable to alloc %u bytes",
+ "concatenation failed: unable to alloc %" TCL_Z_MODIFIER "u bytes",
length));
Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL);
}
return NULL;
}
- dst = Tcl_GetString(objResultPtr) + start;
+ dst = TclGetString(objResultPtr) + start;
/* assert ( length > start ) */
TclFreeIntRep(objResultPtr);
@@ -3311,20 +3205,20 @@ TclStringCat(
Tcl_DecrRefCount(objResultPtr);
if (interp) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "concatenation failed: unable to alloc %u bytes",
+ "concatenation failed: unable to alloc %" TCL_Z_MODIFIER "u bytes",
length));
Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL);
}
return NULL;
}
- dst = Tcl_GetString(objResultPtr);
+ dst = TclGetString(objResultPtr);
}
while (objc--) {
Tcl_Obj *objPtr = *objv++;
if ((objPtr->bytes == NULL) || (objPtr->length)) {
- int more;
- char *src = Tcl_GetStringFromObj(objPtr, &more);
+ size_t more;
+ char *src = TclGetStringFromObj(objPtr, &more);
memcpy(dst, src, more);
dst += more;
@@ -3366,10 +3260,11 @@ TclStringCmp(
Tcl_Obj *value2Ptr,
int checkEq, /* comparison is only for equality */
int nocase, /* comparison is not case sensitive */
- int reqlength) /* requested length */
+ size_t reqlength) /* requested length */
{
char *s1, *s2;
- int empty, length, match, s1len, s2len;
+ int empty, match;
+ size_t length, s1len = 0, s2len = 0;
memCmpFn_t memCmpFn;
if ((reqlength == 0) || (value1Ptr == value2Ptr)) {
@@ -3387,8 +3282,8 @@ TclStringCmp(
* arrays anyway, and we have no memcasecmp() for some reason... :^)
*/
- s1 = (char *) Tcl_GetByteArrayFromObj(value1Ptr, &s1len);
- s2 = (char *) Tcl_GetByteArrayFromObj(value2Ptr, &s2len);
+ s1 = (char *) TclGetByteArrayFromObj(value1Ptr, &s1len);
+ s2 = (char *) TclGetByteArrayFromObj(value2Ptr, &s2len);
memCmpFn = memcmp;
} else if (TclHasIntRep(value1Ptr, &tclStringType)
&& TclHasIntRep(value2Ptr, &tclStringType)) {
@@ -3400,8 +3295,8 @@ TclStringCmp(
*/
if (nocase) {
- s1 = (char *) Tcl_GetUnicodeFromObj(value1Ptr, &s1len);
- s2 = (char *) Tcl_GetUnicodeFromObj(value2Ptr, &s2len);
+ s1 = (char *) TclGetUnicodeFromObj(value1Ptr, &s1len);
+ s2 = (char *) TclGetUnicodeFromObj(value2Ptr, &s2len);
memCmpFn = (memCmpFn_t)Tcl_UniCharNcasecmp;
} else {
s1len = Tcl_GetCharLength(value1Ptr);
@@ -3484,7 +3379,7 @@ TclStringCmp(
* length was requested.
*/
- if ((reqlength < 0) && !nocase) {
+ if ((reqlength == TCL_AUTO_LENGTH) && !nocase) {
memCmpFn = (memCmpFn_t) TclpUtfNcmp2;
} else {
s1len = Tcl_NumUtfChars(s1, s1len);
@@ -3496,15 +3391,15 @@ TclStringCmp(
}
length = (s1len < s2len) ? s1len : s2len;
- if (reqlength > 0 && reqlength < length) {
- length = reqlength;
- } else if (reqlength < 0) {
+ if (reqlength == TCL_AUTO_LENGTH) {
/*
* The requested length is negative, so we ignore it by setting it
* to length + 1 so we correct the match var.
*/
reqlength = length + 1;
+ } else if (reqlength > 0 && reqlength < length) {
+ length = reqlength;
}
if (checkEq && (s1len != s2len)) {
@@ -3515,7 +3410,7 @@ TclStringCmp(
* length only.
*/
- match = memCmpFn(s1, s2, (size_t) length);
+ match = memCmpFn(s1, s2, length);
}
if ((match == 0) && (reqlength > length)) {
match = s1len - s2len;
@@ -3536,7 +3431,7 @@ TclStringCmp(
* Results:
* If needle is found as a substring of haystack, the index of the
* first instance of such a find is returned. If needle is not present
- * as a substring of haystack, -1 is returned.
+ * as a substring of haystack, TCL_IO_FAILURE is returned.
*
* Side effects:
* needle and haystack may have their Tcl_ObjType changed.
@@ -3544,33 +3439,33 @@ TclStringCmp(
*---------------------------------------------------------------------------
*/
-int
+size_t
TclStringFirst(
Tcl_Obj *needle,
Tcl_Obj *haystack,
- int start)
+ size_t start)
{
- int lh, ln = Tcl_GetCharLength(needle);
+ size_t lh = 0, ln = Tcl_GetCharLength(needle);
- if (start < 0) {
+ if (start == TCL_AUTO_LENGTH) {
start = 0;
}
if (ln == 0) {
/* We don't find empty substrings. Bizarre!
* Whenever this routine is turned into a proper substring
* finder, change to `return start` after limits imposed. */
- return -1;
+ return TCL_IO_FAILURE;
}
if (TclIsPureByteArray(needle) && TclIsPureByteArray(haystack)) {
unsigned char *end, *check, *bh;
- unsigned char *bn = Tcl_GetByteArrayFromObj(needle, &ln);
+ unsigned char *bn = TclGetByteArrayFromObj(needle, &ln);
/* Find bytes in bytes */
- bh = Tcl_GetByteArrayFromObj(haystack, &lh);
+ bh = TclGetByteArrayFromObj(haystack, &lh);
if ((lh < ln) || (start > lh - ln)) {
/* Don't start the loop if there cannot be a valid answer */
- return -1;
+ return TCL_IO_FAILURE;
}
end = bh + lh;
@@ -3584,7 +3479,7 @@ TclStringFirst(
check = memchr(check, bn[0], (end + 1 - ln) - check);
if (check == NULL) {
/* Leading byte not found -> needle cannot be found. */
- return -1;
+ return TCL_IO_FAILURE;
}
/* Leading byte found, check rest of needle. */
if (0 == memcmp(check+1, bn+1, ln-1)) {
@@ -3594,7 +3489,7 @@ TclStringFirst(
/* Rest of needle match failed; Iterate to continue search. */
check++;
}
- return -1;
+ return TCL_IO_FAILURE;
}
/*
@@ -3611,12 +3506,12 @@ TclStringFirst(
{
Tcl_UniChar *check, *end, *uh;
- Tcl_UniChar *un = Tcl_GetUnicodeFromObj(needle, &ln);
+ Tcl_UniChar *un = TclGetUnicodeFromObj(needle, &ln);
- uh = Tcl_GetUnicodeFromObj(haystack, &lh);
+ uh = TclGetUnicodeFromObj(haystack, &lh);
if ((lh < ln) || (start > lh - ln)) {
/* Don't start the loop if there cannot be a valid answer */
- return -1;
+ return TCL_IO_FAILURE;
}
end = uh + lh;
@@ -3626,7 +3521,7 @@ TclStringFirst(
return (check - uh);
}
}
- return -1;
+ return TCL_IO_FAILURE;
}
}
@@ -3640,7 +3535,7 @@ TclStringFirst(
* Results:
* If needle is found as a substring of haystack, the index of the
* last instance of such a find is returned. If needle is not present
- * as a substring of haystack, -1 is returned.
+ * as a substring of haystack, TCL_IO_FAILURE is returned.
*
* Side effects:
* needle and haystack may have their Tcl_ObjType changed.
@@ -3648,13 +3543,13 @@ TclStringFirst(
*---------------------------------------------------------------------------
*/
-int
+size_t
TclStringLast(
Tcl_Obj *needle,
Tcl_Obj *haystack,
- int last)
+ size_t last)
{
- int lh, ln = Tcl_GetCharLength(needle);
+ size_t lh = 0, ln = Tcl_GetCharLength(needle);
if (ln == 0) {
/*
@@ -3663,19 +3558,19 @@ TclStringLast(
* TODO: When we one day make this a true substring
* finder, change this to "return last", after limitation.
*/
- return -1;
+ return TCL_IO_FAILURE;
}
if (TclIsPureByteArray(needle) && TclIsPureByteArray(haystack)) {
- unsigned char *check, *bh = Tcl_GetByteArrayFromObj(haystack, &lh);
- unsigned char *bn = Tcl_GetByteArrayFromObj(needle, &ln);
+ unsigned char *check, *bh = TclGetByteArrayFromObj(haystack, &lh);
+ unsigned char *bn = TclGetByteArrayFromObj(needle, &ln);
- if (last >= lh) {
+ if (last + 1 >= lh + 1) {
last = lh - 1;
}
if (last + 1 < ln) {
/* Don't start the loop if there cannot be a valid answer */
- return -1;
+ return TCL_IO_FAILURE;
}
check = bh + last + 1 - ln;
@@ -3686,19 +3581,19 @@ TclStringLast(
}
check--;
}
- return -1;
+ return TCL_IO_FAILURE;
}
{
- Tcl_UniChar *check, *uh = Tcl_GetUnicodeFromObj(haystack, &lh);
- Tcl_UniChar *un = Tcl_GetUnicodeFromObj(needle, &ln);
+ Tcl_UniChar *check, *uh = TclGetUnicodeFromObj(haystack, &lh);
+ Tcl_UniChar *un = TclGetUnicodeFromObj(needle, &ln);
- if (last >= lh) {
+ if (last + 1 >= lh + 1) {
last = lh - 1;
}
if (last + 1 < ln) {
/* Don't start the loop if there cannot be a valid answer */
- return -1;
+ return TCL_IO_FAILURE;
}
check = uh + last + 1 - ln;
while (check >= uh) {
@@ -3708,7 +3603,7 @@ TclStringLast(
}
check--;
}
- return -1;
+ return TCL_IO_FAILURE;
}
}
@@ -3734,7 +3629,7 @@ static void
ReverseBytes(
unsigned char *to, /* Copy bytes into here... */
unsigned char *from, /* ...from here... */
- int count) /* Until this many are copied, */
+ size_t count) /* Until this many are copied, */
/* reversing as you go. */
{
unsigned char *src = from + count;
@@ -3764,8 +3659,8 @@ TclStringReverse(
int inPlace = flags & TCL_STRING_IN_PLACE;
if (TclIsPureByteArray(objPtr)) {
- int numBytes;
- unsigned char *from = Tcl_GetByteArrayFromObj(objPtr, &numBytes);
+ size_t numBytes = 0;
+ unsigned char *from = TclGetByteArrayFromObj(objPtr, &numBytes);
if (!inPlace || Tcl_IsShared(objPtr)) {
objPtr = Tcl_NewByteArrayObj(NULL, numBytes);
@@ -3809,8 +3704,8 @@ TclStringReverse(
}
if (objPtr->bytes) {
- int numChars = stringPtr->numChars;
- int numBytes = objPtr->length;
+ size_t numChars = stringPtr->numChars;
+ size_t numBytes = objPtr->length;
char *to, *from = objPtr->bytes;
if (!inPlace || Tcl_IsShared(objPtr)) {
@@ -3819,7 +3714,7 @@ TclStringReverse(
}
to = objPtr->bytes;
- if (numChars < numBytes) {
+ if ((numChars == TCL_AUTO_LENGTH) || (numChars < numBytes)) {
/*
* Either numChars == -1 and we don't know how many chars are
* represented by objPtr->bytes and we need Pass 1 just in case,
@@ -3829,8 +3724,8 @@ TclStringReverse(
* Pass 1. Reverse the bytes of each multi-byte character.
*/
- int charCount = 0;
- int bytesLeft = numBytes;
+ size_t charCount = 0;
+ size_t bytesLeft = numBytes;
while (bytesLeft) {
/*
@@ -3839,7 +3734,7 @@ TclStringReverse(
* skip calling Tcl_UtfCharComplete() here.
*/
- int bytesInChar = TclUtfToUniChar(from, &ch);
+ size_t bytesInChar = TclUtfToUniChar(from, &ch);
ReverseBytes((unsigned char *)to, (unsigned char *)from,
bytesInChar);
@@ -3889,18 +3784,14 @@ Tcl_Obj *
TclStringReplace(
Tcl_Interp *interp, /* For error reporting, may be NULL */
Tcl_Obj *objPtr, /* String to act upon */
- int first, /* First index to replace */
- int count, /* How many chars to replace */
+ size_t first, /* First index to replace */
+ size_t count, /* How many chars to replace */
Tcl_Obj *insertPtr, /* Replacement string, may be NULL */
int flags) /* TCL_STRING_IN_PLACE => attempt in-place */
{
int inPlace = flags & TCL_STRING_IN_PLACE;
Tcl_Obj *result;
- /* Caller is expected to pass sensible arguments */
- assert ( count >= 0 ) ;
- assert ( first >= 0 ) ;
-
/* Replace nothing with nothing */
if ((insertPtr == NULL) && (count == 0)) {
if (inPlace) {
@@ -3918,8 +3809,8 @@ TclStringReplace(
*/
if (TclIsPureByteArray(objPtr)) {
- int numBytes;
- unsigned char *bytes = Tcl_GetByteArrayFromObj(objPtr, &numBytes);
+ size_t numBytes = 0;
+ unsigned char *bytes = TclGetByteArrayFromObj(objPtr, &numBytes);
if (insertPtr == NULL) {
/* Replace something with nothing. */
@@ -3941,9 +3832,9 @@ TclStringReplace(
}
if (TclIsPureByteArray(insertPtr)) {
- int newBytes;
+ size_t newBytes = 0;
unsigned char *iBytes
- = Tcl_GetByteArrayFromObj(insertPtr, &newBytes);
+ = TclGetByteArrayFromObj(insertPtr, &newBytes);
if (count == newBytes && inPlace && !Tcl_IsShared(objPtr)) {
/*
@@ -3956,7 +3847,7 @@ TclStringReplace(
return objPtr;
}
- if (newBytes > INT_MAX - (numBytes - count)) {
+ if ((size_t)newBytes > INT_MAX - (numBytes - count)) {
if (interp) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"max size for a Tcl value (%d bytes) exceeded",
@@ -3986,8 +3877,8 @@ TclStringReplace(
/* The traditional implementation... */
{
- int numChars;
- Tcl_UniChar *ustring = Tcl_GetUnicodeFromObj(objPtr, &numChars);
+ size_t numChars;
+ Tcl_UniChar *ustring = TclGetUnicodeFromObj(objPtr, &numChars);
/* TODO: Is there an in-place option worth pursuing here? */
@@ -3995,7 +3886,7 @@ TclStringReplace(
if (insertPtr) {
Tcl_AppendObjToObj(result, insertPtr);
}
- if (first + count < numChars) {
+ if (first + count < (size_t)numChars) {
Tcl_AppendUnicodeToObj(result, ustring + first + count,
numChars - first - count);
}
@@ -4036,21 +3927,20 @@ static void
ExtendUnicodeRepWithString(
Tcl_Obj *objPtr,
const char *bytes,
- int numBytes,
- int numAppendChars)
+ size_t numBytes,
+ size_t numAppendChars)
{
String *stringPtr = GET_STRING(objPtr);
- int needed, numOrigChars = 0;
+ size_t needed, numOrigChars = 0;
Tcl_UniChar *dst, unichar = 0;
if (stringPtr->hasUnicode) {
numOrigChars = stringPtr->numChars;
}
- if (numAppendChars == -1) {
+ if (numAppendChars == TCL_AUTO_LENGTH) {
TclNumUtfChars(numAppendChars, bytes, numBytes);
}
needed = numOrigChars + numAppendChars;
- stringCheckLimits(needed);
if (needed > stringPtr->maxChars) {
GrowUnicodeBuffer(objPtr, needed);
@@ -4098,7 +3988,7 @@ DupStringInternalRep(
String *srcStringPtr = GET_STRING(srcPtr);
String *copyStringPtr = NULL;
- if (srcStringPtr->numChars == -1) {
+ if (srcStringPtr->numChars == TCL_AUTO_LENGTH) {
/*
* The String struct in the source value holds zero useful data. Don't
* bother copying it. Don't even bother allocating space in which to
@@ -4234,21 +4124,21 @@ UpdateStringOfString(
}
}
-static int
+static size_t
ExtendStringRepWithUnicode(
Tcl_Obj *objPtr,
const Tcl_UniChar *unicode,
- int numChars)
+ size_t numChars)
{
/*
* Pre-condition: this is the "string" Tcl_ObjType.
*/
- int i, origLength, size = 0;
+ size_t i, origLength, size = 0;
char *dst;
String *stringPtr = GET_STRING(objPtr);
- if (numChars < 0) {
+ if (numChars == TCL_AUTO_LENGTH) {
numChars = UnicodeLength(unicode);
}
@@ -4270,12 +4160,9 @@ ExtendStringRepWithUnicode(
goto copyBytes;
}
- for (i = 0; i < numChars && size >= 0; i++) {
+ for (i = 0; i < numChars; i++) {
size += TclUtfCount(unicode[i]);
}
- if (size < 0) {
- Tcl_Panic("max size for a Tcl value (%d bytes) exceeded", INT_MAX);
- }
/*
* Grow space if needed.
@@ -4316,7 +4203,7 @@ static void
FreeStringInternalRep(
Tcl_Obj *objPtr) /* Object with internal rep to free. */
{
- ckfree(GET_STRING(objPtr));
+ Tcl_Free(GET_STRING(objPtr));
objPtr->typePtr = NULL;
}
diff --git a/generic/tclStringRep.h b/generic/tclStringRep.h
index fc5a713..73ccad6 100644
--- a/generic/tclStringRep.h
+++ b/generic/tclStringRep.h
@@ -31,6 +31,10 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
+
+#ifndef _TCLSTRINGREP
+#define _TCLSTRINGREP
+
/*
* The following structure is the internal rep for a String object. It keeps
@@ -47,15 +51,15 @@
*/
typedef struct {
- int numChars; /* The number of chars in the string. -1 means
- * this value has not been calculated. >= 0
+ size_t numChars; /* The number of chars in the string. -1 means
+ * this value has not been calculated. Any other
* means that there is a valid Unicode rep, or
* that the number of UTF bytes == the number
* of chars. */
- int allocated; /* The amount of space actually allocated for
+ size_t allocated; /* The amount of space actually allocated for
* the UTF string (minus 1 byte for the
* termination char). */
- int maxChars; /* Max number of chars that can fit in the
+ size_t maxChars; /* Max number of chars that can fit in the
* space allocated for the unicode array. */
int hasUnicode; /* Boolean determining whether the string has
* a Unicode representation. */
@@ -64,31 +68,23 @@ typedef struct {
* field above. */
} String;
-#define STRING_MAXCHARS \
- (int)(((size_t)UINT_MAX - sizeof(String))/sizeof(Tcl_UniChar))
#define STRING_SIZE(numChars) \
(sizeof(String) + ((numChars) * sizeof(Tcl_UniChar)))
-#define stringCheckLimits(numChars) \
- do { \
- if ((numChars) < 0 || (numChars) > STRING_MAXCHARS) { \
- Tcl_Panic("max length for a Tcl unicode value (%d chars) exceeded", \
- (int)STRING_MAXCHARS); \
- } \
- } while (0)
#define stringAttemptAlloc(numChars) \
- (String *) attemptckalloc(STRING_SIZE(numChars))
+ (String *) Tcl_AttemptAlloc(STRING_SIZE(numChars))
#define stringAlloc(numChars) \
- (String *) ckalloc(STRING_SIZE(numChars))
+ (String *) Tcl_Alloc(STRING_SIZE(numChars))
#define stringRealloc(ptr, numChars) \
- (String *) ckrealloc((ptr), STRING_SIZE(numChars))
+ (String *) Tcl_Realloc((ptr), STRING_SIZE(numChars))
#define stringAttemptRealloc(ptr, numChars) \
- (String *) attemptckrealloc((ptr), STRING_SIZE(numChars))
+ (String *) Tcl_AttemptRealloc((ptr), STRING_SIZE(numChars))
#define GET_STRING(objPtr) \
((String *) (objPtr)->internalRep.twoPtrValue.ptr1)
#define SET_STRING(objPtr, stringPtr) \
((objPtr)->internalRep.twoPtrValue.ptr2 = NULL), \
((objPtr)->internalRep.twoPtrValue.ptr1 = (void *) (stringPtr))
+#endif /* _TCLSTRINGREP */
/*
* Local Variables:
* mode: c
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index 5e918f5..493d56f 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.c
@@ -29,10 +29,8 @@
#undef Tcl_Alloc
#undef Tcl_Free
#undef Tcl_Realloc
-#undef Tcl_NewBooleanObj
#undef Tcl_NewByteArrayObj
#undef Tcl_NewDoubleObj
-#undef Tcl_NewIntObj
#undef Tcl_NewListObj
#undef Tcl_NewLongObj
#undef Tcl_DbNewLongObj
@@ -41,151 +39,37 @@
#undef Tcl_GetUnicode
#undef Tcl_DumpActiveMemory
#undef Tcl_ValidateAllMemory
-#undef Tcl_FindHashEntry
-#undef Tcl_CreateHashEntry
-#undef Tcl_Panic
-#undef Tcl_FindExecutable
#undef Tcl_SetExitProc
#undef Tcl_SetPanicProc
#undef TclpGetPid
-#undef TclSockMinimumBuffers
-#undef Tcl_SetIntObj
-#undef Tcl_SetLongObj
-#undef TclpInetNtoa
-#undef TclWinGetServByName
-#undef TclWinGetSockOpt
-#undef TclWinSetSockOpt
-#undef TclWinNToHS
#undef TclStaticPackage
-#undef TclBNInitBignumFromLong
#undef Tcl_BackgroundError
#define TclStaticPackage Tcl_StaticPackage
-#undef TclBN_mp_tc_and
-#undef TclBN_mp_tc_or
-#undef TclBN_mp_tc_xor
-#define TclBN_mp_tc_and TclBN_mp_and
-#define TclBN_mp_tc_or TclBN_mp_or
-#define TclBN_mp_tc_xor TclBN_mp_xor
-
-/* See bug 510001: TclSockMinimumBuffers needs plat imp */
-#if defined(_WIN64) || defined(TCL_NO_DEPRECATED) || TCL_MAJOR_VERSION > 8
-# define TclSockMinimumBuffersOld 0
-#else
-#define TclSockMinimumBuffersOld sockMinimumBuffersOld
-static int TclSockMinimumBuffersOld(int sock, int size)
-{
- return TclSockMinimumBuffers(INT2PTR(sock), size);
-}
-#endif
-
-#if defined(TCL_NO_DEPRECATED) || TCL_MAJOR_VERSION > 8
-# define TclSetStartupScriptPath 0
-# define TclGetStartupScriptPath 0
-# define TclSetStartupScriptFileName 0
-# define TclGetStartupScriptFileName 0
-# define TclPrecTraceProc 0
-# define TclpInetNtoa 0
-# define TclWinGetServByName 0
-# define TclWinGetSockOpt 0
-# define TclWinSetSockOpt 0
-# define TclWinNToHS 0
-# define TclWinGetPlatformId 0
-# define TclWinResetInterfaces 0
-# define TclWinSetInterfaces 0
-# define TclWinGetPlatformId 0
-# define TclBNInitBignumFromWideUInt 0
-# define TclBNInitBignumFromWideInt 0
-# define TclBNInitBignumFromLong 0
-# define Tcl_Backslash 0
-# define Tcl_GetDefaultEncodingDir 0
-# define Tcl_SetDefaultEncodingDir 0
-# define Tcl_EvalTokens 0
-# define Tcl_CreateMathFunc 0
-# define Tcl_GetMathFuncInfo 0
-# define Tcl_ListMathFuncs 0
-# define Tcl_SetIntObj 0
-# define Tcl_SetLongObj 0
-# define Tcl_NewIntObj 0
-# define Tcl_NewLongObj 0
-# define Tcl_DbNewLongObj 0
-# define Tcl_BackgroundError 0
-#else
-#define TclBNInitBignumFromLong initBignumFromLong
-static void TclBNInitBignumFromLong(mp_int *a, long b)
-{
- TclInitBignumFromWideInt(a, b);
-}
-#define TclSetStartupScriptPath setStartupScriptPath
-static void TclSetStartupScriptPath(Tcl_Obj *path)
-{
- Tcl_SetStartupScript(path, NULL);
-}
-#define TclGetStartupScriptPath getStartupScriptPath
-static Tcl_Obj *TclGetStartupScriptPath(void)
-{
- return Tcl_GetStartupScript(NULL);
-}
-#define TclSetStartupScriptFileName setStartupScriptFileName
-static void TclSetStartupScriptFileName(
- const char *fileName)
-{
- Tcl_SetStartupScript(Tcl_NewStringObj(fileName,-1), NULL);
-}
-#define TclGetStartupScriptFileName getStartupScriptFileName
-static const char *TclGetStartupScriptFileName(void)
-{
- Tcl_Obj *path = Tcl_GetStartupScript(NULL);
- if (path == NULL) {
- return NULL;
- }
- return Tcl_GetString(path);
-}
-#if defined(_WIN32) || defined(__CYGWIN__)
-#undef TclWinNToHS
-#undef TclWinGetPlatformId
-#undef TclWinResetInterfaces
-#undef TclWinSetInterfaces
-static void
-doNothing(void)
-{
- /* dummy implementation, no need to do anything */
-}
-#define TclWinNToHS winNToHS
-static unsigned short TclWinNToHS(unsigned short ns) {
- return ntohs(ns);
-}
-#define TclWinGetPlatformId winGetPlatformId
-static int
-TclWinGetPlatformId(void)
-{
- return 2; /* VER_PLATFORM_WIN32_NT */;
-}
-#define TclWinResetInterfaces doNothing
-#define TclWinSetInterfaces (void (*) (int)) doNothing
+#ifdef TCL_MEM_DEBUG
+# define Tcl_Alloc TclpAlloc
+# define Tcl_Free TclpFree
+# define Tcl_Realloc TclpRealloc
+# undef Tcl_AttemptAlloc
+# define Tcl_AttemptAlloc TclpAlloc
+# undef Tcl_AttemptRealloc
+# define Tcl_AttemptRealloc TclpRealloc
#endif
-# define TclBNInitBignumFromWideUInt TclInitBignumFromWideUInt
-# define TclBNInitBignumFromWideInt TclInitBignumFromWideInt
-#endif /* TCL_NO_DEPRECATED */
#ifdef _WIN32
# define TclUnixWaitForFile 0
# define TclUnixCopyFile 0
# define TclUnixOpenTemporaryFile 0
-# define TclpReaddir 0
# define TclpIsAtty 0
#elif defined(__CYGWIN__)
# define TclpIsAtty TclPlatIsAtty
-#if defined(TCL_NO_DEPRECATED) || TCL_MAJOR_VERSION > 8
static void
doNothing(void)
{
/* dummy implementation, no need to do anything */
}
-#endif
-# define TclWinAddProcess (void (*) (void *, unsigned int)) doNothing
+# define TclWinAddProcess (void (*) (void *, size_t)) doNothing
# define TclWinFlushDirtyChannels doNothing
-
static int
TclpIsAtty(int fd)
{
@@ -200,31 +84,6 @@ void *TclWinGetTclInstance()
return hInstance;
}
-#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
-#define TclWinSetSockOpt winSetSockOpt
-static int
-TclWinSetSockOpt(SOCKET s, int level, int optname,
- const char *optval, int optlen)
-{
- return setsockopt((int) s, level, optname, optval, optlen);
-}
-
-#define TclWinGetSockOpt winGetSockOpt
-static int
-TclWinGetSockOpt(SOCKET s, int level, int optname,
- char *optval, int *optlen)
-{
- return getsockopt((int) s, level, optname, optval, optlen);
-}
-
-#define TclWinGetServByName winGetServByName
-static struct servent *
-TclWinGetServByName(const char *name, const char *proto)
-{
- return getservbyname(name, proto);
-}
-#endif /* TCL_NO_DEPRECATED */
-
#define TclWinNoBackslash winNoBackslash
static char *
TclWinNoBackslash(char *path)
@@ -239,16 +98,16 @@ TclWinNoBackslash(char *path)
return path;
}
-int
+size_t
TclpGetPid(Tcl_Pid pid)
{
- return (int) (size_t) pid;
+ return (size_t) pid;
}
char *
Tcl_WinUtfToTChar(
const char *string,
- int len,
+ size_t len,
Tcl_DString *dsPtr)
{
Tcl_DStringInit(dsPtr);
@@ -261,14 +120,14 @@ Tcl_WinUtfToTChar(
char *
Tcl_WinTCharToUtf(
const char *string,
- int len,
+ size_t len,
Tcl_DString *dsPtr)
{
Tcl_DStringInit(dsPtr);
if (!string) {
return NULL;
}
- if (len < 0) {
+ if (len == TCL_AUTO_LENGTH) {
len = wcslen((wchar_t *)string);
} else {
len /= 2;
@@ -314,171 +173,10 @@ static int exprIntObj(Tcl_Interp *interp, Tcl_Obj*expr, int *ptr){
return result;
}
#define Tcl_ExprLongObj (int(*)(Tcl_Interp*,Tcl_Obj*,long*))exprIntObj
-static int uniCharNcmp(const Tcl_UniChar *ucs, const Tcl_UniChar *uct, unsigned int n){
- return Tcl_UniCharNcmp(ucs, uct, (unsigned long)n);
-}
-#define Tcl_UniCharNcmp (int(*)(const Tcl_UniChar*,const Tcl_UniChar*,unsigned long))uniCharNcmp
-static int utfNcmp(const char *s1, const char *s2, unsigned int n){
- return Tcl_UtfNcmp(s1, s2, (unsigned long)n);
-}
-#define Tcl_UtfNcmp (int(*)(const char*,const char*,unsigned long))utfNcmp
-static int utfNcasecmp(const char *s1, const char *s2, unsigned int n){
- return Tcl_UtfNcasecmp(s1, s2, (unsigned long)n);
-}
-#define Tcl_UtfNcasecmp (int(*)(const char*,const char*,unsigned long))utfNcasecmp
-static int uniCharNcasecmp(const Tcl_UniChar *ucs, const Tcl_UniChar *uct, unsigned int n){
- return Tcl_UniCharNcasecmp(ucs, uct, (unsigned long)n);
-}
-#define Tcl_UniCharNcasecmp (int(*)(const Tcl_UniChar*,const Tcl_UniChar*,unsigned long))uniCharNcasecmp
-
#endif /* TCL_WIDE_INT_IS_LONG */
#endif /* __CYGWIN__ */
-#if defined(TCL_NO_DEPRECATED)
-# define Tcl_SeekOld 0
-# define Tcl_TellOld 0
-# undef Tcl_SetBooleanObj
-# define Tcl_SetBooleanObj 0
-# undef Tcl_PkgPresent
-# define Tcl_PkgPresent 0
-# undef Tcl_PkgProvide
-# define Tcl_PkgProvide 0
-# undef Tcl_PkgRequire
-# define Tcl_PkgRequire 0
-# undef Tcl_GetIndexFromObj
-# define Tcl_GetIndexFromObj 0
-# define Tcl_NewBooleanObj 0
-# undef Tcl_DbNewBooleanObj
-# define Tcl_DbNewBooleanObj 0
-# undef Tcl_SetBooleanObj
-# define Tcl_SetBooleanObj 0
-# undef Tcl_SetVar
-# define Tcl_SetVar 0
-# undef Tcl_UnsetVar
-# define Tcl_UnsetVar 0
-# undef Tcl_GetVar
-# define Tcl_GetVar 0
-# undef Tcl_TraceVar
-# define Tcl_TraceVar 0
-# undef Tcl_UntraceVar
-# define Tcl_UntraceVar 0
-# undef Tcl_VarTraceInfo
-# define Tcl_VarTraceInfo 0
-# undef Tcl_UpVar
-# define Tcl_UpVar 0
-# undef Tcl_AddErrorInfo
-# define Tcl_AddErrorInfo 0
-# undef Tcl_AddObjErrorInfo
-# define Tcl_AddObjErrorInfo 0
-# undef Tcl_Eval
-# define Tcl_Eval 0
-# undef Tcl_GlobalEval
-# define Tcl_GlobalEval 0
-# undef Tcl_GetStringResult
-# define Tcl_GetStringResult 0
-# undef Tcl_SaveResult
-# define Tcl_SaveResult 0
-# undef Tcl_RestoreResult
-# define Tcl_RestoreResult 0
-# undef Tcl_DiscardResult
-# define Tcl_DiscardResult 0
-# undef Tcl_SetResult
-# define Tcl_SetResult 0
-# undef Tcl_EvalObj
-# define Tcl_EvalObj 0
-# undef Tcl_GlobalEvalObj
-# define Tcl_GlobalEvalObj 0
-# define TclBackgroundException 0
-# undef TclpReaddir
-# define TclpReaddir 0
-# define TclSetStartupScript 0
-# define TclGetStartupScript 0
-# define TclGetIntForIndex 0
-# define TclCreateNamespace 0
-# define TclDeleteNamespace 0
-# define TclAppendExportList 0
-# define TclExport 0
-# define TclImport 0
-# define TclForgetImport 0
-# define TclGetCurrentNamespace_ 0
-# define TclGetGlobalNamespace_ 0
-# define TclFindNamespace 0
-# define TclFindCommand 0
-# define TclGetCommandFromObj 0
-# define TclGetCommandFullName 0
-# define TclCopyChannelOld 0
-# define Tcl_AppendResultVA 0
-# define Tcl_AppendStringsToObjVA 0
-# define Tcl_SetErrorCodeVA 0
-# define Tcl_PanicVA 0
-# define Tcl_VarEvalVA 0
-# undef TclpGetDate
-# define TclpGetDate 0
-# undef TclpLocaltime
-# define TclpLocaltime 0
-# undef TclpGmtime
-# define TclpGmtime 0
-# define TclpLocaltime_unix 0
-# define TclpGmtime_unix 0
-# define Tcl_SetExitProc 0
-# define Tcl_SetPanicProc 0
-# define Tcl_FindExecutable 0
-# define Tcl_GetUnicode 0
-# define TclOldFreeObj 0
-# undef Tcl_StringMatch
-# define Tcl_StringMatch 0
-# define TclBN_reverse 0
-# define TclBN_fast_s_mp_mul_digs 0
-# define TclBN_fast_s_mp_sqr 0
-# define TclBN_mp_karatsuba_mul 0
-# define TclBN_mp_karatsuba_sqr 0
-# define TclBN_mp_toom_mul 0
-# define TclBN_mp_toom_sqr 0
-# define TclBN_s_mp_add 0
-# define TclBN_s_mp_mul_digs 0
-# define TclBN_s_mp_sqr 0
-# define TclBN_s_mp_sub 0
-#else /* TCL_NO_DEPRECATED */
-# define Tcl_SeekOld seekOld
-# define Tcl_TellOld tellOld
-# define TclBackgroundException Tcl_BackgroundException
-# define TclSetStartupScript Tcl_SetStartupScript
-# define TclGetStartupScript Tcl_GetStartupScript
-# define TclGetIntForIndex Tcl_GetIntForIndex
-# define TclCreateNamespace Tcl_CreateNamespace
-# define TclDeleteNamespace Tcl_DeleteNamespace
-# define TclAppendExportList Tcl_AppendExportList
-# define TclExport Tcl_Export
-# define TclImport Tcl_Import
-# define TclForgetImport Tcl_ForgetImport
-# define TclGetCurrentNamespace_ Tcl_GetCurrentNamespace
-# define TclGetGlobalNamespace_ Tcl_GetGlobalNamespace
-# define TclFindNamespace Tcl_FindNamespace
-# define TclFindCommand Tcl_FindCommand
-# define TclGetCommandFromObj Tcl_GetCommandFromObj
-# define TclGetCommandFullName Tcl_GetCommandFullName
-# define TclpLocaltime_unix TclpLocaltime
-# define TclpGmtime_unix TclpGmtime
-# define TclOldFreeObj TclFreeObj
-
-static int
-seekOld(
- Tcl_Channel chan, /* The channel on which to seek. */
- int offset, /* Offset to seek to. */
- int mode) /* Relative to which location to seek? */
-{
- return Tcl_Seek(chan, offset, mode);
-}
-
-static int
-tellOld(
- Tcl_Channel chan) /* The channel to return pos for. */
-{
- return Tcl_Tell(chan);
-}
-#endif /* !TCL_NO_DEPRECATED */
-
/*
* WARNING: The contents of this file is automatically generated by the
* tools/genStubs.tcl script. Any modifications to the function declarations
@@ -510,7 +208,7 @@ static const TclIntStubs tclIntStubs = {
TclCleanupChildren, /* 5 */
TclCleanupCommand, /* 6 */
TclCopyAndCollapse, /* 7 */
- TclCopyChannelOld, /* 8 */
+ 0, /* 8 */
TclCreatePipeline, /* 9 */
TclCreateProc, /* 10 */
TclDeleteCompiledLocalVars, /* 11 */
@@ -536,7 +234,7 @@ static const TclIntStubs tclIntStubs = {
TclGetExtension, /* 31 */
TclGetFrame, /* 32 */
0, /* 33 */
- TclGetIntForIndex, /* 34 */
+ 0, /* 34 */
0, /* 35 */
0, /* 36 */
TclGetLoadedPackages, /* 37 */
@@ -579,7 +277,7 @@ static const TclIntStubs tclIntStubs = {
TclpFree, /* 74 */
TclpGetClicks, /* 75 */
TclpGetSeconds, /* 76 */
- TclpGetTime, /* 77 */
+ 0, /* 77 */
0, /* 78 */
0, /* 79 */
0, /* 80 */
@@ -590,7 +288,7 @@ static const TclIntStubs tclIntStubs = {
0, /* 85 */
0, /* 86 */
0, /* 87 */
- TclPrecTraceProc, /* 88 */
+ 0, /* 88 */
TclPreventAliasLoop, /* 89 */
0, /* 90 */
TclProcCleanupProc, /* 91 */
@@ -606,7 +304,7 @@ static const TclIntStubs tclIntStubs = {
TclSetPreInitScript, /* 101 */
TclSetupEnv, /* 102 */
TclSockGetPort, /* 103 */
- TclSockMinimumBuffersOld, /* 104 */
+ 0, /* 104 */
0, /* 105 */
0, /* 106 */
0, /* 107 */
@@ -614,28 +312,28 @@ static const TclIntStubs tclIntStubs = {
TclUpdateReturnInfo, /* 109 */
TclSockMinimumBuffers, /* 110 */
Tcl_AddInterpResolvers, /* 111 */
- TclAppendExportList, /* 112 */
- TclCreateNamespace, /* 113 */
- TclDeleteNamespace, /* 114 */
- TclExport, /* 115 */
- TclFindCommand, /* 116 */
- TclFindNamespace, /* 117 */
+ 0, /* 112 */
+ 0, /* 113 */
+ 0, /* 114 */
+ 0, /* 115 */
+ 0, /* 116 */
+ 0, /* 117 */
Tcl_GetInterpResolvers, /* 118 */
Tcl_GetNamespaceResolvers, /* 119 */
Tcl_FindNamespaceVar, /* 120 */
- TclForgetImport, /* 121 */
- TclGetCommandFromObj, /* 122 */
- TclGetCommandFullName, /* 123 */
- TclGetCurrentNamespace_, /* 124 */
- TclGetGlobalNamespace_, /* 125 */
+ 0, /* 121 */
+ 0, /* 122 */
+ 0, /* 123 */
+ 0, /* 124 */
+ 0, /* 125 */
Tcl_GetVariableFullName, /* 126 */
- TclImport, /* 127 */
+ 0, /* 127 */
Tcl_PopCallFrame, /* 128 */
Tcl_PushCallFrame, /* 129 */
Tcl_RemoveInterpResolvers, /* 130 */
Tcl_SetNamespaceResolvers, /* 131 */
TclpHasSockets, /* 132 */
- TclpGetDate, /* 133 */
+ 0, /* 133 */
0, /* 134 */
0, /* 135 */
0, /* 136 */
@@ -660,8 +358,8 @@ static const TclIntStubs tclIntStubs = {
0, /* 155 */
TclRegError, /* 156 */
TclVarTraceExists, /* 157 */
- TclSetStartupScriptFileName, /* 158 */
- TclGetStartupScriptFileName, /* 159 */
+ 0, /* 158 */
+ 0, /* 159 */
0, /* 160 */
TclChannelTransform, /* 161 */
TclChannelEventScriptInvoker, /* 162 */
@@ -669,8 +367,8 @@ static const TclIntStubs tclIntStubs = {
TclExpandCodeArray, /* 164 */
TclpSetInitialEncodings, /* 165 */
TclListObjSetElement, /* 166 */
- TclSetStartupScriptPath, /* 167 */
- TclGetStartupScriptPath, /* 168 */
+ 0, /* 167 */
+ 0, /* 168 */
TclpUtfNcmp2, /* 169 */
TclCheckInterpTraces, /* 170 */
TclCheckExecutionTraces, /* 171 */
@@ -680,12 +378,12 @@ static const TclIntStubs tclIntStubs = {
TclCallVarTraces, /* 175 */
TclCleanupVar, /* 176 */
TclVarErrMsg, /* 177 */
- TclSetStartupScript, /* 178 */
- TclGetStartupScript, /* 179 */
+ 0, /* 178 */
+ 0, /* 179 */
0, /* 180 */
0, /* 181 */
- TclpLocaltime, /* 182 */
- TclpGmtime, /* 183 */
+ 0, /* 182 */
+ 0, /* 183 */
0, /* 184 */
0, /* 185 */
0, /* 186 */
@@ -738,7 +436,7 @@ static const TclIntStubs tclIntStubs = {
TclGetSrcInfoForPc, /* 233 */
TclVarHashCreateVar, /* 234 */
TclInitVarHashTable, /* 235 */
- TclBackgroundException, /* 236 */
+ 0, /* 236 */
TclResetCancellation, /* 237 */
TclNRInterpProc, /* 238 */
TclNRInterpProcCore, /* 239 */
@@ -777,10 +475,10 @@ static const TclIntPlatStubs tclIntPlatStubs = {
TclpOpenFile, /* 7 */
TclUnixWaitForFile, /* 8 */
TclpCreateTempFile, /* 9 */
- TclpReaddir, /* 10 */
- TclpLocaltime_unix, /* 11 */
- TclpGmtime_unix, /* 12 */
- TclpInetNtoa, /* 13 */
+ 0, /* 10 */
+ 0, /* 11 */
+ 0, /* 12 */
+ 0, /* 13 */
TclUnixCopyFile, /* 14 */
0, /* 15 */
0, /* 16 */
@@ -801,16 +499,16 @@ static const TclIntPlatStubs tclIntPlatStubs = {
#endif /* UNIX */
#if defined(_WIN32) || defined(__CYGWIN__) /* WIN */
TclWinConvertError, /* 0 */
- TclWinConvertWSAError, /* 1 */
- TclWinGetServByName, /* 2 */
- TclWinGetSockOpt, /* 3 */
+ 0, /* 1 */
+ 0, /* 2 */
+ 0, /* 3 */
TclWinGetTclInstance, /* 4 */
TclUnixWaitForFile, /* 5 */
- TclWinNToHS, /* 6 */
- TclWinSetSockOpt, /* 7 */
+ 0, /* 6 */
+ 0, /* 7 */
TclpGetPid, /* 8 */
- TclWinGetPlatformId, /* 9 */
- TclpReaddir, /* 10 */
+ 0, /* 9 */
+ 0, /* 10 */
TclGetAndDetachPids, /* 11 */
TclpCloseFile, /* 12 */
TclpCreateCommandChannel, /* 13 */
@@ -821,14 +519,14 @@ static const TclIntPlatStubs tclIntPlatStubs = {
TclpMakeFile, /* 18 */
TclpOpenFile, /* 19 */
TclWinAddProcess, /* 20 */
- TclpInetNtoa, /* 21 */
+ 0, /* 21 */
TclpCreateTempFile, /* 22 */
0, /* 23 */
TclWinNoBackslash, /* 24 */
0, /* 25 */
- TclWinSetInterfaces, /* 26 */
+ 0, /* 26 */
TclWinFlushDirtyChannels, /* 27 */
- TclWinResetInterfaces, /* 28 */
+ 0, /* 28 */
TclWinCPUID, /* 29 */
TclUnixOpenTemporaryFile, /* 30 */
#endif /* WIN */
@@ -843,10 +541,10 @@ static const TclIntPlatStubs tclIntPlatStubs = {
TclpOpenFile, /* 7 */
TclUnixWaitForFile, /* 8 */
TclpCreateTempFile, /* 9 */
- TclpReaddir, /* 10 */
- TclpLocaltime_unix, /* 11 */
- TclpGmtime_unix, /* 12 */
- TclpInetNtoa, /* 13 */
+ 0, /* 10 */
+ 0, /* 11 */
+ 0, /* 12 */
+ 0, /* 13 */
TclUnixCopyFile, /* 14 */
TclMacOSXGetFileAttribute, /* 15 */
TclMacOSXSetFileAttribute, /* 16 */
@@ -933,32 +631,32 @@ const TclTomMathStubs tclTomMathStubs = {
TclBN_mp_unsigned_bin_size, /* 47 */
TclBN_mp_xor, /* 48 */
TclBN_mp_zero, /* 49 */
- TclBN_reverse, /* 50 */
- TclBN_fast_s_mp_mul_digs, /* 51 */
- TclBN_fast_s_mp_sqr, /* 52 */
- TclBN_mp_karatsuba_mul, /* 53 */
- TclBN_mp_karatsuba_sqr, /* 54 */
- TclBN_mp_toom_mul, /* 55 */
- TclBN_mp_toom_sqr, /* 56 */
- TclBN_s_mp_add, /* 57 */
- TclBN_s_mp_mul_digs, /* 58 */
- TclBN_s_mp_sqr, /* 59 */
- TclBN_s_mp_sub, /* 60 */
+ 0, /* 50 */
+ 0, /* 51 */
+ 0, /* 52 */
+ 0, /* 53 */
+ 0, /* 54 */
+ 0, /* 55 */
+ 0, /* 56 */
+ 0, /* 57 */
+ 0, /* 58 */
+ 0, /* 59 */
+ 0, /* 60 */
TclBN_mp_init_set_int, /* 61 */
TclBN_mp_set_int, /* 62 */
TclBN_mp_cnt_lsb, /* 63 */
- TclBNInitBignumFromLong, /* 64 */
- TclBNInitBignumFromWideInt, /* 65 */
- TclBNInitBignumFromWideUInt, /* 66 */
+ 0, /* 64 */
+ 0, /* 65 */
+ 0, /* 66 */
TclBN_mp_expt_d_ex, /* 67 */
TclBN_mp_set_long_long, /* 68 */
TclBN_mp_get_long_long, /* 69 */
TclBN_mp_set_long, /* 70 */
TclBN_mp_get_long, /* 71 */
TclBN_mp_get_int, /* 72 */
- TclBN_mp_tc_and, /* 73 */
- TclBN_mp_tc_or, /* 74 */
- TclBN_mp_tc_xor, /* 75 */
+ 0, /* 73 */
+ 0, /* 74 */
+ 0, /* 75 */
TclBN_mp_signed_rsh, /* 76 */
TclBN_mp_get_bit, /* 77 */
};
@@ -1010,21 +708,21 @@ const TclStubs tclStubs = {
Tcl_DbDecrRefCount, /* 19 */
Tcl_DbIncrRefCount, /* 20 */
Tcl_DbIsShared, /* 21 */
- Tcl_DbNewBooleanObj, /* 22 */
+ 0, /* 22 */
Tcl_DbNewByteArrayObj, /* 23 */
Tcl_DbNewDoubleObj, /* 24 */
Tcl_DbNewListObj, /* 25 */
- Tcl_DbNewLongObj, /* 26 */
+ 0, /* 26 */
Tcl_DbNewObj, /* 27 */
Tcl_DbNewStringObj, /* 28 */
Tcl_DuplicateObj, /* 29 */
- TclOldFreeObj, /* 30 */
+ 0, /* 30 */
Tcl_GetBoolean, /* 31 */
Tcl_GetBooleanFromObj, /* 32 */
Tcl_GetByteArrayFromObj, /* 33 */
Tcl_GetDouble, /* 34 */
Tcl_GetDoubleFromObj, /* 35 */
- Tcl_GetIndexFromObj, /* 36 */
+ 0, /* 36 */
Tcl_GetInt, /* 37 */
Tcl_GetIntFromObj, /* 38 */
Tcl_GetLongFromObj, /* 39 */
@@ -1037,25 +735,25 @@ const TclStubs tclStubs = {
Tcl_ListObjIndex, /* 46 */
Tcl_ListObjLength, /* 47 */
Tcl_ListObjReplace, /* 48 */
- Tcl_NewBooleanObj, /* 49 */
+ 0, /* 49 */
Tcl_NewByteArrayObj, /* 50 */
Tcl_NewDoubleObj, /* 51 */
- Tcl_NewIntObj, /* 52 */
+ 0, /* 52 */
Tcl_NewListObj, /* 53 */
- Tcl_NewLongObj, /* 54 */
+ 0, /* 54 */
Tcl_NewObj, /* 55 */
Tcl_NewStringObj, /* 56 */
- Tcl_SetBooleanObj, /* 57 */
+ 0, /* 57 */
Tcl_SetByteArrayLength, /* 58 */
Tcl_SetByteArrayObj, /* 59 */
Tcl_SetDoubleObj, /* 60 */
- Tcl_SetIntObj, /* 61 */
+ 0, /* 61 */
Tcl_SetListObj, /* 62 */
- Tcl_SetLongObj, /* 63 */
+ 0, /* 63 */
Tcl_SetObjLength, /* 64 */
Tcl_SetStringObj, /* 65 */
- Tcl_AddErrorInfo, /* 66 */
- Tcl_AddObjErrorInfo, /* 67 */
+ 0, /* 66 */
+ 0, /* 67 */
Tcl_AllowExceptions, /* 68 */
Tcl_AppendElement, /* 69 */
Tcl_AppendResult, /* 70 */
@@ -1064,8 +762,8 @@ const TclStubs tclStubs = {
Tcl_AsyncInvoke, /* 73 */
Tcl_AsyncMark, /* 74 */
Tcl_AsyncReady, /* 75 */
- Tcl_BackgroundError, /* 76 */
- Tcl_Backslash, /* 77 */
+ 0, /* 76 */
+ 0, /* 77 */
Tcl_BadChannelOption, /* 78 */
Tcl_CallWhenDeleted, /* 79 */
Tcl_CancelIdleCall, /* 80 */
@@ -1083,7 +781,7 @@ const TclStubs tclStubs = {
Tcl_CreateEventSource, /* 92 */
Tcl_CreateExitHandler, /* 93 */
Tcl_CreateInterp, /* 94 */
- Tcl_CreateMathFunc, /* 95 */
+ 0, /* 95 */
Tcl_CreateObjCommand, /* 96 */
Tcl_CreateSlave, /* 97 */
Tcl_CreateTimerHandler, /* 98 */
@@ -1117,9 +815,9 @@ const TclStubs tclStubs = {
Tcl_Eof, /* 126 */
Tcl_ErrnoId, /* 127 */
Tcl_ErrnoMsg, /* 128 */
- Tcl_Eval, /* 129 */
+ 0, /* 129 */
Tcl_EvalFile, /* 130 */
- Tcl_EvalObj, /* 131 */
+ 0, /* 131 */
Tcl_EventuallyFree, /* 132 */
Tcl_Exit, /* 133 */
Tcl_ExposeCommand, /* 134 */
@@ -1132,7 +830,7 @@ const TclStubs tclStubs = {
Tcl_ExprObj, /* 141 */
Tcl_ExprString, /* 142 */
Tcl_Finalize, /* 143 */
- Tcl_FindExecutable, /* 144 */
+ 0, /* 144 */
Tcl_FirstHashEntry, /* 145 */
Tcl_Flush, /* 146 */
Tcl_FreeResult, /* 147 */
@@ -1170,11 +868,11 @@ const TclStubs tclStubs = {
Tcl_GetServiceMode, /* 171 */
Tcl_GetSlave, /* 172 */
Tcl_GetStdChannel, /* 173 */
- Tcl_GetStringResult, /* 174 */
- Tcl_GetVar, /* 175 */
+ 0, /* 174 */
+ 0, /* 175 */
Tcl_GetVar2, /* 176 */
- Tcl_GlobalEval, /* 177 */
- Tcl_GlobalEvalObj, /* 178 */
+ 0, /* 177 */
+ 0, /* 178 */
Tcl_HideCommand, /* 179 */
Tcl_Init, /* 180 */
Tcl_InitHashTable, /* 181 */
@@ -1216,7 +914,7 @@ const TclStubs tclStubs = {
Tcl_ResetResult, /* 217 */
Tcl_ScanElement, /* 218 */
Tcl_ScanCountedElement, /* 219 */
- Tcl_SeekOld, /* 220 */
+ 0, /* 220 */
Tcl_ServiceAll, /* 221 */
Tcl_ServiceEvent, /* 222 */
Tcl_SetAssocData, /* 223 */
@@ -1226,55 +924,55 @@ const TclStubs tclStubs = {
Tcl_SetErrno, /* 227 */
Tcl_SetErrorCode, /* 228 */
Tcl_SetMaxBlockTime, /* 229 */
- Tcl_SetPanicProc, /* 230 */
+ 0, /* 230 */
Tcl_SetRecursionLimit, /* 231 */
- Tcl_SetResult, /* 232 */
+ 0, /* 232 */
Tcl_SetServiceMode, /* 233 */
Tcl_SetObjErrorCode, /* 234 */
Tcl_SetObjResult, /* 235 */
Tcl_SetStdChannel, /* 236 */
- Tcl_SetVar, /* 237 */
+ 0, /* 237 */
Tcl_SetVar2, /* 238 */
Tcl_SignalId, /* 239 */
Tcl_SignalMsg, /* 240 */
Tcl_SourceRCFile, /* 241 */
Tcl_SplitList, /* 242 */
Tcl_SplitPath, /* 243 */
- Tcl_StaticPackage, /* 244 */
- Tcl_StringMatch, /* 245 */
- Tcl_TellOld, /* 246 */
- Tcl_TraceVar, /* 247 */
+ 0, /* 244 */
+ 0, /* 245 */
+ 0, /* 246 */
+ 0, /* 247 */
Tcl_TraceVar2, /* 248 */
Tcl_TranslateFileName, /* 249 */
Tcl_Ungets, /* 250 */
Tcl_UnlinkVar, /* 251 */
Tcl_UnregisterChannel, /* 252 */
- Tcl_UnsetVar, /* 253 */
+ 0, /* 253 */
Tcl_UnsetVar2, /* 254 */
- Tcl_UntraceVar, /* 255 */
+ 0, /* 255 */
Tcl_UntraceVar2, /* 256 */
Tcl_UpdateLinkedVar, /* 257 */
- Tcl_UpVar, /* 258 */
+ 0, /* 258 */
Tcl_UpVar2, /* 259 */
Tcl_VarEval, /* 260 */
- Tcl_VarTraceInfo, /* 261 */
+ 0, /* 261 */
Tcl_VarTraceInfo2, /* 262 */
Tcl_Write, /* 263 */
Tcl_WrongNumArgs, /* 264 */
Tcl_DumpActiveMemory, /* 265 */
Tcl_ValidateAllMemory, /* 266 */
- Tcl_AppendResultVA, /* 267 */
- Tcl_AppendStringsToObjVA, /* 268 */
+ 0, /* 267 */
+ 0, /* 268 */
Tcl_HashStats, /* 269 */
Tcl_ParseVar, /* 270 */
- Tcl_PkgPresent, /* 271 */
+ 0, /* 271 */
Tcl_PkgPresentEx, /* 272 */
- Tcl_PkgProvide, /* 273 */
- Tcl_PkgRequire, /* 274 */
- Tcl_SetErrorCodeVA, /* 275 */
- Tcl_VarEvalVA, /* 276 */
+ 0, /* 273 */
+ 0, /* 274 */
+ 0, /* 275 */
+ 0, /* 276 */
Tcl_WaitPid, /* 277 */
- Tcl_PanicVA, /* 278 */
+ 0, /* 278 */
Tcl_GetVersion, /* 279 */
Tcl_InitMemory, /* 280 */
Tcl_StackChannel, /* 281 */
@@ -1286,7 +984,7 @@ const TclStubs tclStubs = {
Tcl_CreateEncoding, /* 287 */
Tcl_CreateThreadExitHandler, /* 288 */
Tcl_DeleteThreadExitHandler, /* 289 */
- Tcl_DiscardResult, /* 290 */
+ 0, /* 290 */
Tcl_EvalEx, /* 291 */
Tcl_EvalObjv, /* 292 */
Tcl_EvalObjEx, /* 293 */
@@ -1310,8 +1008,8 @@ const TclStubs tclStubs = {
Tcl_ConditionWait, /* 311 */
Tcl_NumUtfChars, /* 312 */
Tcl_ReadChars, /* 313 */
- Tcl_RestoreResult, /* 314 */
- Tcl_SaveResult, /* 315 */
+ 0, /* 314 */
+ 0, /* 315 */
Tcl_SetSystemEncoding, /* 316 */
Tcl_SetVar2Ex, /* 317 */
Tcl_ThreadAlert, /* 318 */
@@ -1337,8 +1035,8 @@ const TclStubs tclStubs = {
Tcl_WriteChars, /* 338 */
Tcl_WriteObj, /* 339 */
Tcl_GetString, /* 340 */
- Tcl_GetDefaultEncodingDir, /* 341 */
- Tcl_SetDefaultEncodingDir, /* 342 */
+ 0, /* 341 */
+ 0, /* 342 */
Tcl_AlertNotifier, /* 343 */
Tcl_ServiceModeHook, /* 344 */
Tcl_UniCharIsAlnum, /* 345 */
@@ -1353,7 +1051,7 @@ const TclStubs tclStubs = {
Tcl_UniCharToUtfDString, /* 354 */
Tcl_UtfToUniCharDString, /* 355 */
Tcl_GetRegExpFromObj, /* 356 */
- Tcl_EvalTokens, /* 357 */
+ 0, /* 357 */
Tcl_FreeParse, /* 358 */
Tcl_LogCommandInfo, /* 359 */
Tcl_ParseBraces, /* 360 */
@@ -1378,7 +1076,7 @@ const TclStubs tclStubs = {
Tcl_SetUnicodeObj, /* 379 */
Tcl_GetCharLength, /* 380 */
Tcl_GetUniChar, /* 381 */
- Tcl_GetUnicode, /* 382 */
+ 0, /* 382 */
Tcl_GetRange, /* 383 */
Tcl_AppendUnicodeToObj, /* 384 */
Tcl_RegExpMatchObj, /* 385 */
@@ -1417,8 +1115,8 @@ const TclStubs tclStubs = {
Tcl_IsChannelExisting, /* 418 */
Tcl_UniCharNcasecmp, /* 419 */
Tcl_UniCharCaseMatch, /* 420 */
- Tcl_FindHashEntry, /* 421 */
- Tcl_CreateHashEntry, /* 422 */
+ 0, /* 421 */
+ 0, /* 422 */
Tcl_InitCustomHashTable, /* 423 */
Tcl_InitObjHashTable, /* 424 */
Tcl_CommandTraceInfo, /* 425 */
@@ -1431,8 +1129,8 @@ const TclStubs tclStubs = {
Tcl_AttemptSetObjLength, /* 432 */
Tcl_GetChannelThread, /* 433 */
Tcl_GetUnicodeFromObj, /* 434 */
- Tcl_GetMathFuncInfo, /* 435 */
- Tcl_ListMathFuncs, /* 436 */
+ 0, /* 435 */
+ 0, /* 436 */
Tcl_SubstObj, /* 437 */
Tcl_DetachChannel, /* 438 */
Tcl_IsStandardChannel, /* 439 */
@@ -1515,7 +1213,7 @@ const TclStubs tclStubs = {
Tcl_GetCommandFromObj, /* 516 */
Tcl_GetCommandFullName, /* 517 */
Tcl_FSEvalFileEx, /* 518 */
- Tcl_SetExitProc, /* 519 */
+ 0, /* 519 */
Tcl_LimitAddHandler, /* 520 */
Tcl_LimitRemoveHandler, /* 521 */
Tcl_LimitReady, /* 522 */
diff --git a/generic/tclStubLib.c b/generic/tclStubLib.c
index 5261591..b26fb01 100644
--- a/generic/tclStubLib.c
+++ b/generic/tclStubLib.c
@@ -66,8 +66,8 @@ Tcl_InitStubs(
*/
if (!stubsPtr || (stubsPtr->magic != (((exact&0xff00) >= 0x900) ? magic : TCL_STUB_MAGIC))) {
- iPtr->result = (char *)"interpreter uses an incompatible stubs mechanism";
- iPtr->freeProc = 0;
+ iPtr->legacyResult = "interpreter uses an incompatible stubs mechanism";
+ iPtr->legacyFreeProc = 0; /* TCL_STATIC */
return NULL;
}
diff --git a/generic/tclTest.c b/generic/tclTest.c
index 63a657c..c577a38 100644
--- a/generic/tclTest.c
+++ b/generic/tclTest.c
@@ -216,7 +216,7 @@ static int ObjTraceProc(void *clientData,
Tcl_Obj *const objv[]);
static void ObjTraceDeleteProc(void *clientData);
static void PrintParse(Tcl_Interp *interp, Tcl_Parse *parsePtr);
-static void SpecialFree(char *blockPtr);
+static void SpecialFree(void *blockPtr);
static int StaticInitProc(Tcl_Interp *interp);
static int TestasyncCmd(void *dummy,
Tcl_Interp *interp, int argc, const char **argv);
@@ -340,11 +340,11 @@ static int TestreturnObjCmd(void *dummy,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
static void TestregexpXflags(const char *string,
- int length, int *cflagsPtr, int *eflagsPtr);
+ size_t length, int *cflagsPtr, int *eflagsPtr);
static int TestsaveresultCmd(void *dummy,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-static void TestsaveresultFree(char *blockPtr);
+static void TestsaveresultFree(void *blockPtr);
static int TestsetassocdataCmd(void *dummy,
Tcl_Interp *interp, int argc, const char **argv);
static int TestsetCmd(void *dummy,
@@ -846,8 +846,8 @@ TestasyncCmd(
if (argc != 3) {
goto wrongNumArgs;
}
- asyncPtr = ckalloc(sizeof(TestAsyncHandler));
- asyncPtr->command = ckalloc(strlen(argv[2]) + 1);
+ asyncPtr = Tcl_Alloc(sizeof(TestAsyncHandler));
+ asyncPtr->command = Tcl_Alloc(strlen(argv[2]) + 1);
strcpy(asyncPtr->command, argv[2]);
Tcl_MutexLock(&asyncTestMutex);
asyncPtr->id = nextId;
@@ -865,8 +865,8 @@ TestasyncCmd(
asyncPtr = firstHandler;
firstHandler = asyncPtr->nextPtr;
Tcl_AsyncDelete(asyncPtr->handler);
- ckfree(asyncPtr->command);
- ckfree(asyncPtr);
+ Tcl_Free(asyncPtr->command);
+ Tcl_Free(asyncPtr);
}
Tcl_MutexUnlock(&asyncTestMutex);
return TCL_OK;
@@ -889,8 +889,8 @@ TestasyncCmd(
prevPtr->nextPtr = asyncPtr->nextPtr;
}
Tcl_AsyncDelete(asyncPtr->handler);
- ckfree(asyncPtr->command);
- ckfree(asyncPtr);
+ Tcl_Free(asyncPtr->command);
+ Tcl_Free(asyncPtr);
break;
}
Tcl_MutexUnlock(&asyncTestMutex);
@@ -961,7 +961,8 @@ AsyncHandlerProc(
{
TestAsyncHandler *asyncPtr;
int id = PTR2INT(clientData);
- const char *listArgv[4], *cmd;
+ const char *listArgv[4];
+ char *cmd;
char string[TCL_INTEGER_SPACE];
Tcl_MutexLock(&asyncTestMutex);
@@ -980,7 +981,7 @@ AsyncHandlerProc(
TclFormatInt(string, code);
listArgv[0] = asyncPtr->command;
- listArgv[1] = Tcl_GetString(Tcl_GetObjResult(interp));
+ listArgv[1] = Tcl_GetStringResult(interp);
listArgv[2] = string;
listArgv[3] = NULL;
cmd = Tcl_Merge(3, listArgv);
@@ -992,7 +993,7 @@ AsyncHandlerProc(
* invoked, it's possible. Better error checking is needed here.
*/
}
- ckfree(cmd);
+ Tcl_Free(cmd);
return code;
}
@@ -1620,9 +1621,9 @@ TestdelCmd(
return TCL_ERROR;
}
- dPtr = ckalloc(sizeof(DelCmd));
+ dPtr = Tcl_Alloc(sizeof(DelCmd));
dPtr->interp = interp;
- dPtr->deleteCmd = ckalloc(strlen(argv[3]) + 1);
+ dPtr->deleteCmd = Tcl_Alloc(strlen(argv[3]) + 1);
strcpy(dPtr->deleteCmd, argv[3]);
Tcl_CreateCommand(slave, argv[2], DelCmdProc, dPtr,
@@ -1640,8 +1641,8 @@ DelCmdProc(
DelCmd *dPtr = (DelCmd *) clientData;
Tcl_AppendResult(interp, dPtr->deleteCmd, NULL);
- ckfree(dPtr->deleteCmd);
- ckfree(dPtr);
+ Tcl_Free(dPtr->deleteCmd);
+ Tcl_Free(dPtr);
return TCL_OK;
}
@@ -1653,8 +1654,8 @@ DelDeleteProc(
Tcl_EvalEx(dPtr->interp, dPtr->deleteCmd, -1, 0);
Tcl_ResetResult(dPtr->interp);
- ckfree(dPtr->deleteCmd);
- ckfree(dPtr);
+ Tcl_Free(dPtr->deleteCmd);
+ Tcl_Free(dPtr);
}
/*
@@ -1776,7 +1777,7 @@ TestdoubledigitsObjCmd(void *unused,
}
str = TclDoubleDigits(d, ndigits, type, &decpt, &signum, &endPtr);
strObj = Tcl_NewStringObj(str, endPtr-str);
- ckfree(str);
+ Tcl_Free(str);
retval = Tcl_NewListObj(1, &strObj);
Tcl_ListObjAppendElement(NULL, retval, Tcl_NewIntObj(decpt));
strObj = Tcl_NewStringObj(signum ? "-" : "+", 1);
@@ -1854,11 +1855,11 @@ TestdstringCmd(
} else if (strcmp(argv[2], "staticlarge") == 0) {
Tcl_AppendResult(interp, "first0 first1 first2 first3 first4 first5 first6 first7 first8 first9\nsecond0 second1 second2 second3 second4 second5 second6 second7 second8 second9\nthird0 third1 third2 third3 third4 third5 third6 third7 third8 third9\nfourth0 fourth1 fourth2 fourth3 fourth4 fourth5 fourth6 fourth7 fourth8 fourth9\nfifth0 fifth1 fifth2 fifth3 fifth4 fifth5 fifth6 fifth7 fifth8 fifth9\nsixth0 sixth1 sixth2 sixth3 sixth4 sixth5 sixth6 sixth7 sixth8 sixth9\nseventh0 seventh1 seventh2 seventh3 seventh4 seventh5 seventh6 seventh7 seventh8 seventh9\n", NULL);
} else if (strcmp(argv[2], "free") == 0) {
- char *s = ckalloc(100);
+ char *s = Tcl_Alloc(100);
strcpy(s, "This is a malloc-ed string");
Tcl_SetResult(interp, s, TCL_DYNAMIC);
} else if (strcmp(argv[2], "special") == 0) {
- char *s = (char*)ckalloc(100) + 16;
+ char *s = (char*)Tcl_Alloc(100) + 16;
strcpy(s, "This is a specially-allocated string");
Tcl_SetResult(interp, s, SpecialFree);
} else {
@@ -1907,9 +1908,9 @@ TestdstringCmd(
*/
static void SpecialFree(blockPtr)
- char *blockPtr; /* Block to free. */
+ void *blockPtr; /* Block to free. */
{
- ckfree(blockPtr - 16);
+ Tcl_Free(((char *)blockPtr) - 16);
}
/*
@@ -1960,15 +1961,15 @@ TestencodingObjCmd(
if (objc != 5) {
return TCL_ERROR;
}
- encodingPtr = ckalloc(sizeof(TclEncoding));
+ encodingPtr = Tcl_Alloc(sizeof(TclEncoding));
encodingPtr->interp = interp;
string = Tcl_GetStringFromObj(objv[3], &length);
- encodingPtr->toUtfCmd = ckalloc(length + 1);
+ encodingPtr->toUtfCmd = Tcl_Alloc(length + 1);
memcpy(encodingPtr->toUtfCmd, string, length + 1);
string = Tcl_GetStringFromObj(objv[4], &length);
- encodingPtr->fromUtfCmd = ckalloc(length + 1);
+ encodingPtr->fromUtfCmd = Tcl_Alloc(length + 1);
memcpy(encodingPtr->fromUtfCmd, string, length + 1);
string = Tcl_GetStringFromObj(objv[2], &length);
@@ -2068,9 +2069,9 @@ EncodingFreeProc(
{
TclEncoding *encodingPtr = clientData;
- ckfree(encodingPtr->toUtfCmd);
- ckfree(encodingPtr->fromUtfCmd);
- ckfree(encodingPtr);
+ Tcl_Free(encodingPtr->toUtfCmd);
+ Tcl_Free(encodingPtr->fromUtfCmd);
+ Tcl_Free(encodingPtr);
}
/*
@@ -2225,7 +2226,7 @@ TesteventObjCmd(
"position specifier", TCL_EXACT, &posIndex) != TCL_OK) {
return TCL_ERROR;
}
- ev = ckalloc(sizeof(TestEvent));
+ ev = Tcl_Alloc(sizeof(TestEvent));
ev->header.proc = TesteventProc;
ev->header.nextPtr = NULL;
ev->interp = interp;
@@ -3078,12 +3079,12 @@ TestlinkCmd(
}
if (argv[5][0] != 0) {
if (stringVar != NULL) {
- ckfree(stringVar);
+ Tcl_Free(stringVar);
}
if (strcmp(argv[5], "-") == 0) {
stringVar = NULL;
} else {
- stringVar = ckalloc(strlen(argv[5]) + 1);
+ stringVar = Tcl_Alloc(strlen(argv[5]) + 1);
strcpy(stringVar, argv[5]);
}
}
@@ -3185,12 +3186,12 @@ TestlinkCmd(
}
if (argv[5][0] != 0) {
if (stringVar != NULL) {
- ckfree(stringVar);
+ Tcl_Free(stringVar);
}
if (strcmp(argv[5], "-") == 0) {
stringVar = NULL;
} else {
- stringVar = ckalloc(strlen(argv[5]) + 1);
+ stringVar = Tcl_Alloc(strlen(argv[5]) + 1);
strcpy(stringVar, argv[5]);
}
Tcl_UpdateLinkedVar(interp, "string");
@@ -3482,7 +3483,7 @@ CleanupTestSetassocdataTests(
void *clientData, /* Data to be released. */
Tcl_Interp *interp) /* Interpreter being deleted. */
{
- ckfree(clientData);
+ Tcl_Free(clientData);
}
/*
@@ -3887,7 +3888,8 @@ TestregexpObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- int i, ii, indices, stringLength, match, about;
+ int i, indices, stringLength, match, about;
+ size_t ii;
int hasxflags, cflags, eflags;
Tcl_RegExp regExpr;
const char *string;
@@ -4000,12 +4002,12 @@ TestregexpObjCmd(
if (objc > 2 && (cflags&REG_EXPECT) && indices) {
const char *varName;
const char *value;
- int start, end;
+ size_t start, end;
char resinfo[TCL_INTEGER_SPACE * 2];
varName = Tcl_GetString(objv[2]);
TclRegExpRangeUniChar(regExpr, -1, &start, &end);
- sprintf(resinfo, "%d %d", start, end-1);
+ sprintf(resinfo, "%" TCL_LL_MODIFIER "d %" TCL_LL_MODIFIER "d", TclWideIntFromSize(start), TclWideIntFromSize(end-1));
value = Tcl_SetVar2(interp, varName, NULL, resinfo, 0);
if (value == NULL) {
Tcl_AppendResult(interp, "couldn't set variable \"",
@@ -4019,7 +4021,7 @@ TestregexpObjCmd(
Tcl_RegExpGetInfo(regExpr, &info);
varName = Tcl_GetString(objv[2]);
- sprintf(resinfo, "%ld", info.extendStart);
+ sprintf(resinfo, "%" TCL_LL_MODIFIER "d", TclWideIntFromSize(info.extendStart));
value = Tcl_SetVar2(interp, varName, NULL, resinfo, 0);
if (value == NULL) {
Tcl_AppendResult(interp, "couldn't set variable \"",
@@ -4040,19 +4042,19 @@ TestregexpObjCmd(
Tcl_RegExpGetInfo(regExpr, &info);
for (i = 0; i < objc; i++) {
- int start, end;
+ size_t start, end;
Tcl_Obj *newPtr, *varPtr, *valuePtr;
varPtr = objv[i];
- ii = ((cflags&REG_EXPECT) && i == objc-1) ? -1 : i;
+ ii = ((cflags&REG_EXPECT) && i == objc-1) ? TCL_INDEX_NONE : (size_t)i;
if (indices) {
Tcl_Obj *objs[2];
- if (ii == -1) {
+ if (ii == TCL_INDEX_NONE) {
TclRegExpRangeUniChar(regExpr, ii, &start, &end);
} else if (ii > info.nsubs) {
- start = -1;
- end = -1;
+ start = TCL_INDEX_NONE;
+ end = TCL_INDEX_NONE;
} else {
start = info.matches[ii].start;
end = info.matches[ii].end;
@@ -4063,16 +4065,16 @@ TestregexpObjCmd(
* instead of the first character after the match.
*/
- if (end >= 0) {
+ if (end != TCL_INDEX_NONE) {
end--;
}
- objs[0] = Tcl_NewWideIntObj(start);
- objs[1] = Tcl_NewWideIntObj(end);
+ objs[0] = TclNewWideIntObjFromSize(start);
+ objs[1] = TclNewWideIntObjFromSize(end);
newPtr = Tcl_NewListObj(2, objs);
} else {
- if (ii == -1) {
+ if (ii == TCL_INDEX_NONE) {
TclRegExpRangeUniChar(regExpr, ii, &start, &end);
newPtr = Tcl_GetRange(objPtr, start, end);
} else if (ii > info.nsubs) {
@@ -4116,11 +4118,12 @@ TestregexpObjCmd(
static void
TestregexpXflags(
const char *string, /* The string of flags. */
- int length, /* The length of the string in bytes. */
+ size_t length, /* The length of the string in bytes. */
int *cflagsPtr, /* compile flags word */
int *eflagsPtr) /* exec flags word */
{
- int i, cflags, eflags;
+ size_t i;
+ int cflags, eflags;
cflags = *cflagsPtr;
eflags = *eflagsPtr;
@@ -4248,7 +4251,7 @@ TestsetassocdataCmd(
return TCL_ERROR;
}
- buf = ckalloc(strlen(argv[2]) + 1);
+ buf = Tcl_Alloc(strlen(argv[2]) + 1);
strcpy(buf, argv[2]);
/*
@@ -4258,7 +4261,7 @@ TestsetassocdataCmd(
oldData = (char *) Tcl_GetAssocData(interp, argv[1], &procPtr);
if ((oldData != NULL) && (procPtr == CleanupTestSetassocdataTests)) {
- ckfree(oldData);
+ Tcl_Free(oldData);
}
Tcl_SetAssocData(interp, argv[1], CleanupTestSetassocdataTests, buf);
@@ -4648,7 +4651,7 @@ TestpanicCmd(
argString = Tcl_Merge(argc-1, argv+1);
Tcl_Panic("%s", argString);
- ckfree(argString);
+ Tcl_Free(argString);
return TCL_OK;
}
@@ -4828,8 +4831,8 @@ GetTimesObjCmd(
fprintf(stderr, "alloc & free 100000 6 word items\n");
Tcl_GetTime(&start);
for (i = 0; i < 100000; i++) {
- objPtr = ckalloc(sizeof(Tcl_Obj));
- ckfree(objPtr);
+ objPtr = Tcl_Alloc(sizeof(Tcl_Obj));
+ Tcl_Free(objPtr);
}
Tcl_GetTime(&stop);
timePer = (stop.sec - start.sec)*1000000 + (stop.usec - start.usec);
@@ -4837,10 +4840,10 @@ GetTimesObjCmd(
/* alloc 5000 times */
fprintf(stderr, "alloc 5000 6 word items\n");
- objv = ckalloc(5000 * sizeof(Tcl_Obj *));
+ objv = Tcl_Alloc(5000 * sizeof(Tcl_Obj *));
Tcl_GetTime(&start);
for (i = 0; i < 5000; i++) {
- objv[i] = ckalloc(sizeof(Tcl_Obj));
+ objv[i] = Tcl_Alloc(sizeof(Tcl_Obj));
}
Tcl_GetTime(&stop);
timePer = (stop.sec - start.sec)*1000000 + (stop.usec - start.usec);
@@ -4850,7 +4853,7 @@ GetTimesObjCmd(
fprintf(stderr, "free 5000 6 word items\n");
Tcl_GetTime(&start);
for (i = 0; i < 5000; i++) {
- ckfree(objv[i]);
+ Tcl_Free(objv[i]);
}
Tcl_GetTime(&stop);
timePer = (stop.sec - start.sec)*1000000 + (stop.usec - start.usec);
@@ -4876,7 +4879,7 @@ GetTimesObjCmd(
Tcl_GetTime(&stop);
timePer = (stop.sec - start.sec)*1000000 + (stop.usec - start.usec);
fprintf(stderr, " %.3f usec per Tcl_DecrRefCount\n", timePer/5000);
- ckfree(objv);
+ Tcl_Free(objv);
/* TclGetString 100000 times */
fprintf(stderr, "TclGetStringFromObj of \"12345\" 100000 times\n");
@@ -5102,7 +5105,7 @@ TestpurebytesobjObjCmd(
if (objc == 2) {
const char *s = Tcl_GetString(objv[1]);
objPtr->length = objv[1]->length;
- objPtr->bytes = ckalloc(objPtr->length + 1);
+ objPtr->bytes = Tcl_Alloc(objPtr->length + 1);
memcpy(objPtr->bytes, s, objPtr->length);
objPtr->bytes[objPtr->length] = 0;
}
@@ -5258,7 +5261,6 @@ TestsaveresultCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* The argument objects. */
{
- Interp* iPtr = (Interp*) interp;
int discard, result, index;
Tcl_SavedResult state;
Tcl_Obj *objPtr;
@@ -5295,7 +5297,7 @@ TestsaveresultCmd(
Tcl_AppendResult(interp, "append result", NULL);
break;
case RESULT_FREE: {
- char *buf = ckalloc(200);
+ char *buf = Tcl_Alloc(200);
strcpy(buf, "free result");
Tcl_SetResult(interp, buf, TCL_DYNAMIC);
@@ -5326,12 +5328,9 @@ TestsaveresultCmd(
}
switch ((enum options) index) {
- case RESULT_DYNAMIC: {
- int presentOrFreed = (iPtr->freeProc == TestsaveresultFree) ^ freeCount;
-
- Tcl_AppendElement(interp, presentOrFreed ? "presentOrFreed" : "missingOrLeak");
+ case RESULT_DYNAMIC:
+ Tcl_AppendElement(interp, freeCount ? "freed" : "leak");
break;
- }
case RESULT_OBJECT:
Tcl_AppendElement(interp, Tcl_GetObjResult(interp) == objPtr
? "same" : "different");
@@ -5360,7 +5359,7 @@ TestsaveresultCmd(
static void
TestsaveresultFree(
- char *blockPtr)
+ void *blockPtr)
{
freeCount++;
}
@@ -5547,7 +5546,7 @@ TestChannelCmd(
*nextPtrPtr = curPtr->nextPtr;
curPtr->nextPtr = NULL;
chan = curPtr->chan;
- ckfree(curPtr);
+ Tcl_Free(curPtr);
break;
}
}
@@ -5617,7 +5616,7 @@ TestChannelCmd(
/* Remember the channel in the pool of detached channels */
- det = ckalloc(sizeof(TestChannel));
+ det = Tcl_Alloc(sizeof(TestChannel));
det->chan = chan;
det->nextPtr = firstDetached;
firstDetached = det;
@@ -6015,7 +6014,7 @@ TestChannelEventCmd(
return TCL_ERROR;
}
- esPtr = ckalloc(sizeof(EventScriptRecord));
+ esPtr = Tcl_Alloc(sizeof(EventScriptRecord));
esPtr->nextPtr = statePtr->scriptRecordPtr;
statePtr->scriptRecordPtr = esPtr;
@@ -6072,7 +6071,7 @@ TestChannelEventCmd(
Tcl_DeleteChannelHandler((Tcl_Channel) chanPtr,
TclChannelEventScriptInvoker, esPtr);
Tcl_DecrRefCount(esPtr->scriptPtr);
- ckfree(esPtr);
+ Tcl_Free(esPtr);
return TCL_OK;
}
@@ -6113,7 +6112,7 @@ TestChannelEventCmd(
Tcl_DeleteChannelHandler((Tcl_Channel) chanPtr,
TclChannelEventScriptInvoker, esPtr);
Tcl_DecrRefCount(esPtr->scriptPtr);
- ckfree(esPtr);
+ Tcl_Free(esPtr);
}
statePtr->scriptRecordPtr = NULL;
return TCL_OK;
@@ -7057,7 +7056,7 @@ TestHashSystemHashCmd(
Tcl_SetHashValue(hPtr, INT2PTR(i+42));
}
- if (hash.numEntries != limit) {
+ if (hash.numEntries != (size_t)limit) {
Tcl_AppendResult(interp, "unexpected maximal size", NULL);
Tcl_DeleteHashTable(&hash);
return TCL_ERROR;
@@ -7133,7 +7132,7 @@ TestlongsizeCmd(
Tcl_AppendResult(interp, "wrong # args", NULL);
return TCL_ERROR;
}
- Tcl_SetObjResult(interp, Tcl_NewIntObj((int)sizeof(long)));
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(sizeof(long)));
return TCL_OK;
}
@@ -7156,9 +7155,9 @@ NREUnwind_callback(
&none, NULL);
} else {
Tcl_Obj *idata[3];
- idata[0] = Tcl_NewIntObj((int) ((char *) data[1] - (char *) data[0]));
- idata[1] = Tcl_NewIntObj((int) ((char *) data[2] - (char *) data[0]));
- idata[2] = Tcl_NewIntObj((int) ((char *) &none - (char *) data[0]));
+ idata[0] = Tcl_NewIntObj(((char *) data[1] - (char *) data[0]));
+ idata[1] = Tcl_NewIntObj(((char *) data[2] - (char *) data[0]));
+ idata[2] = Tcl_NewIntObj(((char *) &none - (char *) data[0]));
Tcl_SetObjResult(interp, Tcl_NewListObj(3, idata));
}
return TCL_OK;
@@ -7558,7 +7557,7 @@ TestparseargsCmd(
result[1] = Tcl_NewIntObj(count);
result[2] = Tcl_NewListObj(count, remObjv);
Tcl_SetObjResult(interp, Tcl_NewListObj(3, result));
- ckfree(remObjv);
+ Tcl_Free(remObjv);
return TCL_OK;
}
@@ -7685,7 +7684,7 @@ HashVarFree(
Tcl_Var var)
{
if (VarHashRefCount(var) < 2) {
- ckfree(var);
+ Tcl_Free(var);
} else {
VarHashRefCount(var)--;
}
@@ -7701,7 +7700,7 @@ MyCompiledVarFree(
if (resVarInfo->var) {
HashVarFree(resVarInfo->var);
}
- ckfree(vInfoPtr);
+ Tcl_Free(vInfoPtr);
}
#define TclVarHashGetValue(hPtr) \
@@ -7744,7 +7743,7 @@ MyCompiledVarFetch(
resVarInfo->var = var;
/*
- * Increment the reference counter to avoid ckfree() of the variable in
+ * Increment the reference counter to avoid Tcl_Free() of the variable in
* Tcl's FreeVarEntry(); for cleanup, we provide our own HashVarFree();
*/
@@ -7761,7 +7760,7 @@ InterpCompiledVarResolver(
Tcl_ResolvedVarInfo **rPtr)
{
if (*name == 'T') {
- MyResolvedVarInfo *resVarInfo = ckalloc(sizeof(MyResolvedVarInfo));
+ MyResolvedVarInfo *resVarInfo = Tcl_Alloc(sizeof(MyResolvedVarInfo));
resVarInfo->vInfo.fetchProc = MyCompiledVarFetch;
resVarInfo->vInfo.deleteProc = MyCompiledVarFree;
diff --git a/generic/tclTestObj.c b/generic/tclTestObj.c
index c9e4a6f..4abd3a2 100644
--- a/generic/tclTestObj.c
+++ b/generic/tclTestObj.c
@@ -59,7 +59,7 @@ static void VarPtrDeleteProc(ClientData clientData, Tcl_Interp *interp)
if (varPtr[i]) Tcl_DecrRefCount(varPtr[i]);
}
Tcl_DeleteAssocData(interp, VARPTR_KEY);
- ckfree(varPtr);
+ Tcl_Free(varPtr);
}
static Tcl_Obj **GetVarPtr(Tcl_Interp *interp)
@@ -99,7 +99,7 @@ TclObjTest_Init(
*/
Tcl_Obj **varPtr;
- varPtr = (Tcl_Obj **) ckalloc(NUMBER_OF_OBJECT_VARS *sizeof(varPtr[0]));
+ varPtr = (Tcl_Obj **) Tcl_Alloc(NUMBER_OF_OBJECT_VARS *sizeof(varPtr[0]));
if (!varPtr) {
return TCL_ERROR;
}
@@ -576,8 +576,8 @@ TestindexobjCmd(
*/
struct IndexRep {
void *tablePtr; /* Pointer to the table of strings. */
- int offset; /* Offset between table entries. */
- int index; /* Selected index into table. */
+ size_t offset; /* Offset between table entries. */
+ size_t index; /* Selected index into table. */
};
struct IndexRep *indexRep;
@@ -616,7 +616,7 @@ TestindexobjCmd(
return TCL_ERROR;
}
- argv = ckalloc((objc-3) * sizeof(char *));
+ argv = Tcl_Alloc((objc-3) * sizeof(char *));
for (i = 4; i < objc; i++) {
argv[i-4] = Tcl_GetString(objv[i]);
}
@@ -625,7 +625,7 @@ TestindexobjCmd(
result = Tcl_GetIndexFromObj((setError? interp : NULL), objv[3],
argv, "token", INDEX_TEMP_TABLE|(allowAbbrev? 0 : TCL_EXACT),
&index);
- ckfree(argv);
+ Tcl_Free((void *)argv);
if (result == TCL_OK) {
Tcl_SetIntObj(Tcl_GetObjResult(interp), index);
}
@@ -1273,8 +1273,8 @@ TeststringobjCmd(
if (objc != 3) {
goto wrongNumArgs;
}
- Tcl_SetIntObj(Tcl_GetObjResult(interp), (varPtr[varIndex] != NULL)
- ? varPtr[varIndex]->length : -1);
+ Tcl_SetWideIntObj(Tcl_GetObjResult(interp), (varPtr[varIndex] != NULL)
+ ? (Tcl_WideInt)varPtr[varIndex]->length : (Tcl_WideInt)-1);
break;
case 5: /* length2 */
if (objc != 3) {
diff --git a/generic/tclTestProcBodyObj.c b/generic/tclTestProcBodyObj.c
index 11e841f..68c6c62 100644
--- a/generic/tclTestProcBodyObj.c
+++ b/generic/tclTestProcBodyObj.c
@@ -35,7 +35,7 @@ static const char checkCommand[] = "check";
* procs
*/
-typedef struct CmdTable {
+typedef struct {
const char *cmdName; /* command name */
Tcl_ObjCmdProc *proc; /* command proc */
int exportIt; /* if 1, export the command */
@@ -190,7 +190,7 @@ ProcBodyTestInitInternal(
}
}
- return Tcl_PkgProvide(interp, packageName, packageVersion);
+ return Tcl_PkgProvideEx(interp, packageName, packageVersion, NULL);
}
/*
@@ -339,7 +339,7 @@ ProcBodyTestCheckObjCmd(
return TCL_ERROR;
}
- version = Tcl_PkgPresent(interp, packageName, packageVersion, 1);
+ version = Tcl_PkgPresentEx(interp, packageName, packageVersion, 1, NULL);
Tcl_SetObjResult(interp, Tcl_NewWideIntObj(
strcmp(version, packageVersion) == 0));
return TCL_OK;
diff --git a/generic/tclThread.c b/generic/tclThread.c
index 661ac2f..45b0af2 100644
--- a/generic/tclThread.c
+++ b/generic/tclThread.c
@@ -61,7 +61,7 @@ static void RememberSyncObject(void *objPtr,
void *
Tcl_GetThreadData(
Tcl_ThreadDataKey *keyPtr, /* Identifier for the data chunk */
- int size) /* Size of storage block */
+ size_t size) /* Size of storage block */
{
void *result;
#if TCL_THREADS
@@ -72,13 +72,13 @@ Tcl_GetThreadData(
result = TclThreadStorageKeyGet(keyPtr);
if (result == NULL) {
- result = ckalloc(size);
+ result = Tcl_Alloc(size);
memset(result, 0, size);
TclThreadStorageKeySet(keyPtr, result);
}
#else /* TCL_THREADS */
if (*keyPtr == NULL) {
- result = ckalloc(size);
+ result = Tcl_Alloc(size);
memset(result, 0, size);
*keyPtr = result;
RememberSyncObject(keyPtr, &keyRecord);
@@ -164,14 +164,14 @@ RememberSyncObject(
if (recPtr->num >= recPtr->max) {
recPtr->max += 8;
- newList = ckalloc(recPtr->max * sizeof(void *));
+ newList = Tcl_Alloc(recPtr->max * sizeof(void *));
for (i=0,j=0 ; i<recPtr->num ; i++) {
if (recPtr->list[i] != NULL) {
newList[j++] = recPtr->list[i];
}
}
if (recPtr->list != NULL) {
- ckfree(recPtr->list);
+ Tcl_Free(recPtr->list);
}
recPtr->list = newList;
recPtr->num = j;
@@ -392,9 +392,9 @@ TclFinalizeSynchronization(void)
for (i=0 ; i<keyRecord.num ; i++) {
keyPtr = (Tcl_ThreadDataKey *) keyRecord.list[i];
blockPtr = *keyPtr;
- ckfree(blockPtr);
+ Tcl_Free(blockPtr);
}
- ckfree(keyRecord.list);
+ Tcl_Free(keyRecord.list);
keyRecord.list = NULL;
}
keyRecord.max = 0;
@@ -414,7 +414,7 @@ TclFinalizeSynchronization(void)
}
}
if (mutexRecord.list != NULL) {
- ckfree(mutexRecord.list);
+ Tcl_Free(mutexRecord.list);
mutexRecord.list = NULL;
}
mutexRecord.max = 0;
@@ -427,7 +427,7 @@ TclFinalizeSynchronization(void)
}
}
if (condRecord.list != NULL) {
- ckfree(condRecord.list);
+ Tcl_Free(condRecord.list);
condRecord.list = NULL;
}
condRecord.max = 0;
diff --git a/generic/tclThreadAlloc.c b/generic/tclThreadAlloc.c
index 3f1abc2..be95e1d 100644
--- a/generic/tclThreadAlloc.c
+++ b/generic/tclThreadAlloc.c
@@ -82,18 +82,18 @@ typedef union Block {
* and statistics information.
*/
-typedef struct Bucket {
+typedef struct {
Block *firstPtr; /* First block available */
Block *lastPtr; /* End of block list */
- long numFree; /* Number of blocks available */
+ size_t numFree; /* Number of blocks available */
/* All fields below for accounting only */
- long numRemoves; /* Number of removes from bucket */
- long numInserts; /* Number of inserts into bucket */
- long numWaits; /* Number of waits to acquire a lock */
- long numLocks; /* Number of locks acquired */
- long totalAssigned; /* Total space assigned to bucket */
+ size_t numRemoves; /* Number of removes from bucket */
+ size_t numInserts; /* Number of inserts into bucket */
+ size_t numWaits; /* Number of waits to acquire a lock */
+ size_t numLocks; /* Number of locks acquired */
+ size_t totalAssigned; /* Total space assigned to bucket */
} Bucket;
/*
@@ -120,8 +120,8 @@ typedef struct Cache {
static struct {
size_t blockSize; /* Bucket blocksize. */
- int maxBlocks; /* Max blocks before move to share. */
- int numMove; /* Num blocks to move to share. */
+ size_t maxBlocks; /* Max blocks before move to share. */
+ size_t numMove; /* Num blocks to move to share. */
Tcl_Mutex *lockPtr; /* Share bucket lock. */
} bucketInfo[NBUCKETS];
@@ -211,7 +211,7 @@ GetCache(void)
cachePtr = TclpGetAllocCache();
if (cachePtr == NULL) {
- cachePtr = TclpSysAlloc(sizeof(Cache), 0);
+ cachePtr = TclpSysAlloc(sizeof(Cache));
if (cachePtr == NULL) {
Tcl_Panic("alloc: could not allocate new cache");
}
@@ -299,28 +299,15 @@ TclFreeAllocCache(
*----------------------------------------------------------------------
*/
-char *
+void *
TclpAlloc(
- unsigned int reqSize)
+ size_t reqSize)
{
Cache *cachePtr;
Block *blockPtr;
register int bucket;
size_t size;
-#ifndef __LP64__
- if (sizeof(int) >= sizeof(size_t)) {
- /* An unsigned int overflow can also be a size_t overflow */
- const size_t zero = 0;
- const size_t max = ~zero;
-
- if (((size_t) reqSize) > max - sizeof(Block) - RCHECK) {
- /* Requested allocation exceeds memory */
- return NULL;
- }
- }
-#endif
-
GETCACHE(cachePtr);
/*
@@ -337,7 +324,7 @@ TclpAlloc(
#endif
if (size > MAXALLOC) {
bucket = NBUCKETS;
- blockPtr = TclpSysAlloc(size, 0);
+ blockPtr = TclpSysAlloc(size);
if (blockPtr != NULL) {
cachePtr->totalAssigned += reqSize;
}
@@ -378,7 +365,7 @@ TclpAlloc(
void
TclpFree(
- char *ptr)
+ void *ptr)
{
Cache *cachePtr;
Block *blockPtr;
@@ -435,10 +422,10 @@ TclpFree(
*----------------------------------------------------------------------
*/
-char *
+void *
TclpRealloc(
- char *ptr,
- unsigned int reqSize)
+ void *ptr,
+ size_t reqSize)
{
Cache *cachePtr;
Block *blockPtr;
@@ -450,19 +437,6 @@ TclpRealloc(
return TclpAlloc(reqSize);
}
-#ifndef __LP64__
- if (sizeof(int) >= sizeof(size_t)) {
- /* An unsigned int overflow can also be a size_t overflow */
- const size_t zero = 0;
- const size_t max = ~zero;
-
- if (((size_t) reqSize) > max - sizeof(Block) - RCHECK) {
- /* Requested allocation exceeds memory */
- return NULL;
- }
- }
-#endif
-
GETCACHE(cachePtr);
/*
@@ -563,7 +537,7 @@ TclThreadAllocObj(void)
Tcl_Obj *newObjsPtr;
cachePtr->numObjects = numMove = NOBJALLOC;
- newObjsPtr = TclpSysAlloc(sizeof(Tcl_Obj) * numMove, 0);
+ newObjsPtr = TclpSysAlloc(sizeof(Tcl_Obj) * numMove);
if (newObjsPtr == NULL) {
Tcl_Panic("alloc: could not allocate %d new objects", numMove);
}
@@ -671,8 +645,8 @@ Tcl_GetMemoryInfo(
Tcl_DStringAppendElement(dsPtr, buf);
}
for (n = 0; n < NBUCKETS; ++n) {
- sprintf(buf, "%lu %ld %ld %ld %ld %ld %ld",
- (unsigned long) bucketInfo[n].blockSize,
+ sprintf(buf, "%" TCL_Z_MODIFIER "u %" TCL_Z_MODIFIER "u %" TCL_Z_MODIFIER "u %" TCL_Z_MODIFIER "u %" TCL_Z_MODIFIER "u %" TCL_Z_MODIFIER "u %" TCL_Z_MODIFIER "u",
+ bucketInfo[n].blockSize,
cachePtr->buckets[n].numFree,
cachePtr->buckets[n].numRemoves,
cachePtr->buckets[n].numInserts,
@@ -961,7 +935,7 @@ GetBlocks(
int bucket)
{
register Block *blockPtr;
- register int n;
+ register size_t n;
/*
* First, atttempt to move blocks from the shared cache. Note the
@@ -1016,7 +990,7 @@ GetBlocks(
blockPtr = NULL;
n = NBUCKETS;
size = 0; /* lint */
- while (--n > bucket) {
+ while (--n > (size_t)bucket) {
if (cachePtr->buckets[n].numFree > 0) {
size = bucketInfo[n].blockSize;
blockPtr = cachePtr->buckets[n].firstPtr;
@@ -1032,7 +1006,7 @@ GetBlocks(
if (blockPtr == NULL) {
size = MAXALLOC;
- blockPtr = TclpSysAlloc(size, 0);
+ blockPtr = TclpSysAlloc(size);
if (blockPtr == NULL) {
return 0;
}
@@ -1082,7 +1056,7 @@ TclInitThreadAlloc(void)
objLockPtr = TclpNewAllocMutex();
for (i = 0; i < NBUCKETS; ++i) {
bucketInfo[i].blockSize = MINALLOC << i;
- bucketInfo[i].maxBlocks = 1 << (NBUCKETS - 1 - i);
+ bucketInfo[i].maxBlocks = ((size_t)1) << (NBUCKETS - 1 - i);
bucketInfo[i].numMove = i < NBUCKETS - 1 ?
1 << (NBUCKETS - 2 - i) : 1;
bucketInfo[i].lockPtr = TclpNewAllocMutex();
diff --git a/generic/tclThreadJoin.c b/generic/tclThreadJoin.c
index 5c70a62..66c54a0 100644
--- a/generic/tclThreadJoin.c
+++ b/generic/tclThreadJoin.c
@@ -201,7 +201,7 @@ TclJoinThread(
Tcl_ConditionFinalize(&threadPtr->cond);
Tcl_MutexFinalize(&threadPtr->threadMutex);
- ckfree(threadPtr);
+ Tcl_Free(threadPtr);
return TCL_OK;
}
@@ -230,7 +230,7 @@ TclRememberJoinableThread(
{
JoinableThread *threadPtr;
- threadPtr = ckalloc(sizeof(JoinableThread));
+ threadPtr = Tcl_Alloc(sizeof(JoinableThread));
threadPtr->id = id;
threadPtr->done = 0;
threadPtr->waitedUpon = 0;
diff --git a/generic/tclThreadStorage.c b/generic/tclThreadStorage.c
index b56ec80..339cc71 100644
--- a/generic/tclThreadStorage.c
+++ b/generic/tclThreadStorage.c
@@ -47,7 +47,7 @@ static struct TSDMaster {
* 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. */
@@ -85,14 +85,14 @@ TSDTableCreate(void)
TSDTable *tsdTablePtr;
sig_atomic_t i;
- tsdTablePtr = TclpSysAlloc(sizeof(TSDTable), 0);
+ tsdTablePtr = TclpSysAlloc(sizeof(TSDTable));
if (tsdTablePtr == NULL) {
Tcl_Panic("unable to allocate TSDTable");
}
tsdTablePtr->allocated = 8;
tsdTablePtr->tablePtr =
- TclpSysAlloc(sizeof(void *) * tsdTablePtr->allocated, 0);
+ TclpSysAlloc(sizeof(void *) * tsdTablePtr->allocated);
if (tsdTablePtr->tablePtr == NULL) {
Tcl_Panic("unable to allocate TSDTable");
}
@@ -117,7 +117,7 @@ TSDTableDelete(
* and must now be deallocated or they will leak.
*/
- ckfree(tsdTablePtr->tablePtr[i]);
+ Tcl_Free(tsdTablePtr->tablePtr[i]);
}
}
diff --git a/generic/tclThreadTest.c b/generic/tclThreadTest.c
index e9b1107..64858cb 100644
--- a/generic/tclThreadTest.c
+++ b/generic/tclThreadTest.c
@@ -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?");
@@ -432,10 +432,10 @@ ThreadObjCmd(
Tcl_MutexLock(&threadMutex);
errorThreadId = Tcl_GetCurrentThread();
if (errorProcString) {
- ckfree(errorProcString);
+ Tcl_Free(errorProcString);
}
proc = Tcl_GetString(objv[2]);
- errorProcString = ckalloc(strlen(proc) + 1);
+ errorProcString = Tcl_Alloc(strlen(proc) + 1);
strcpy(errorProcString, proc);
Tcl_MutexUnlock(&threadMutex);
return TCL_OK;
@@ -595,7 +595,7 @@ NewTestThread(
* eval'ing, for the case that we exit during evaluation
*/
- threadEvalScript = ckalloc(strlen(ctrlPtr->script) + 1);
+ threadEvalScript = Tcl_Alloc(strlen(ctrlPtr->script) + 1);
strcpy(threadEvalScript, ctrlPtr->script);
Tcl_CreateThreadExitHandler(ThreadExitProc, threadEvalScript);
@@ -670,7 +670,7 @@ ThreadErrorProc(
argv[2] = errorInfo;
script = Tcl_Merge(3, argv);
ThreadSend(interp, errorThreadId, script, 0);
- ckfree(script);
+ Tcl_Free(script);
}
}
@@ -840,13 +840,13 @@ ThreadSend(
* Create the event for its event queue.
*/
- threadEventPtr = ckalloc(sizeof(ThreadEvent));
- threadEventPtr->script = ckalloc(strlen(script) + 1);
+ threadEventPtr = Tcl_Alloc(sizeof(ThreadEvent));
+ threadEventPtr->script = Tcl_Alloc(strlen(script) + 1);
strcpy(threadEventPtr->script, script);
if (!wait) {
resultPtr = threadEventPtr->resultPtr = NULL;
} else {
- resultPtr = ckalloc(sizeof(ThreadEventResult));
+ resultPtr = Tcl_Alloc(sizeof(ThreadEventResult));
threadEventPtr->resultPtr = resultPtr;
/*
@@ -918,19 +918,19 @@ ThreadSend(
if (resultPtr->code != TCL_OK) {
if (resultPtr->errorCode) {
Tcl_SetErrorCode(interp, resultPtr->errorCode, NULL);
- ckfree(resultPtr->errorCode);
+ Tcl_Free(resultPtr->errorCode);
}
if (resultPtr->errorInfo) {
Tcl_AddErrorInfo(interp, resultPtr->errorInfo);
- ckfree(resultPtr->errorInfo);
+ Tcl_Free(resultPtr->errorInfo);
}
}
Tcl_AppendResult(interp, resultPtr->result, NULL);
Tcl_ConditionFinalize(&resultPtr->done);
code = resultPtr->code;
- ckfree(resultPtr->result);
- ckfree(resultPtr);
+ Tcl_Free(resultPtr->result);
+ Tcl_Free(resultPtr);
return code;
}
@@ -1038,18 +1038,18 @@ ThreadEventProc(
}
result = Tcl_GetStringResult(interp);
}
- ckfree(threadEventPtr->script);
+ Tcl_Free(threadEventPtr->script);
if (resultPtr) {
Tcl_MutexLock(&threadMutex);
resultPtr->code = code;
- resultPtr->result = ckalloc(strlen(result) + 1);
+ resultPtr->result = Tcl_Alloc(strlen(result) + 1);
strcpy(resultPtr->result, result);
if (errorCode != NULL) {
- resultPtr->errorCode = ckalloc(strlen(errorCode) + 1);
+ resultPtr->errorCode = Tcl_Alloc(strlen(errorCode) + 1);
strcpy(resultPtr->errorCode, errorCode);
}
if (errorInfo != NULL) {
- resultPtr->errorInfo = ckalloc(strlen(errorInfo) + 1);
+ resultPtr->errorInfo = Tcl_Alloc(strlen(errorInfo) + 1);
strcpy(resultPtr->errorInfo, errorInfo);
}
Tcl_ConditionNotify(&resultPtr->done);
@@ -1084,7 +1084,7 @@ ThreadFreeProc(
ClientData clientData)
{
if (clientData) {
- ckfree(clientData);
+ Tcl_Free(clientData);
}
}
@@ -1112,7 +1112,7 @@ ThreadDeleteEvent(
ClientData clientData) /* dummy */
{
if (eventPtr->proc == ThreadEventProc) {
- ckfree(((ThreadEvent *) eventPtr)->script);
+ Tcl_Free(((ThreadEvent *) eventPtr)->script);
return 1;
}
@@ -1159,14 +1159,14 @@ ThreadExitProc(
if (self == errorThreadId) {
if (errorProcString) { /* Extra safety */
- ckfree(errorProcString);
+ Tcl_Free(errorProcString);
errorProcString = NULL;
}
errorThreadId = 0;
}
if (threadEvalScript) {
- ckfree(threadEvalScript);
+ Tcl_Free(threadEvalScript);
threadEvalScript = NULL;
}
Tcl_DeleteEvents((Tcl_EventDeleteProc *) ThreadDeleteEvent, NULL);
@@ -1189,7 +1189,7 @@ ThreadExitProc(
}
resultPtr->nextPtr = resultPtr->prevPtr = 0;
resultPtr->eventPtr->resultPtr = NULL;
- ckfree(resultPtr);
+ Tcl_Free(resultPtr);
} else if (resultPtr->dstThreadId == self) {
/*
* Dang. The target is going away. Unblock the caller. The result
@@ -1199,7 +1199,7 @@ ThreadExitProc(
const char *msg = "target thread died";
- resultPtr->result = ckalloc(strlen(msg) + 1);
+ resultPtr->result = Tcl_Alloc(strlen(msg) + 1);
strcpy(resultPtr->result, msg);
resultPtr->code = TCL_ERROR;
Tcl_ConditionNotify(&resultPtr->done);
diff --git a/generic/tclTimer.c b/generic/tclTimer.c
index ea80320..c89318f 100644
--- a/generic/tclTimer.c
+++ b/generic/tclTimer.c
@@ -222,7 +222,7 @@ TimerExitProc(
timerHandlerPtr = tsdPtr->firstTimerHandlerPtr;
while (timerHandlerPtr != NULL) {
tsdPtr->firstTimerHandlerPtr = timerHandlerPtr->nextPtr;
- ckfree(timerHandlerPtr);
+ Tcl_Free(timerHandlerPtr);
timerHandlerPtr = tsdPtr->firstTimerHandlerPtr;
}
}
@@ -297,7 +297,7 @@ TclCreateAbsoluteTimerHandler(
register TimerHandler *timerHandlerPtr, *tPtr2, *prevPtr;
ThreadSpecificData *tsdPtr = InitTimer();
- timerHandlerPtr = ckalloc(sizeof(TimerHandler));
+ timerHandlerPtr = Tcl_Alloc(sizeof(TimerHandler));
/*
* Fill in fields for the event.
@@ -373,7 +373,7 @@ Tcl_DeleteTimerHandler(
} else {
prevPtr->nextPtr = timerHandlerPtr->nextPtr;
}
- ckfree(timerHandlerPtr);
+ Tcl_Free(timerHandlerPtr);
return;
}
}
@@ -488,7 +488,7 @@ TimerCheckProc(
if (blockTime.sec == 0 && blockTime.usec == 0 &&
!tsdPtr->timerPending) {
tsdPtr->timerPending = 1;
- timerEvPtr = ckalloc(sizeof(Tcl_Event));
+ timerEvPtr = Tcl_Alloc(sizeof(Tcl_Event));
timerEvPtr->proc = TimerHandlerEventProc;
Tcl_QueueEvent(timerEvPtr, TCL_QUEUE_TAIL);
}
@@ -591,7 +591,7 @@ TimerHandlerEventProc(
*nextPtrPtr = timerHandlerPtr->nextPtr;
timerHandlerPtr->proc(timerHandlerPtr->clientData);
- ckfree(timerHandlerPtr);
+ Tcl_Free(timerHandlerPtr);
}
TimerSetupProc(NULL, TCL_TIMER_EVENTS);
return 1;
@@ -625,7 +625,7 @@ Tcl_DoWhenIdle(
Tcl_Time blockTime;
ThreadSpecificData *tsdPtr = InitTimer();
- idlePtr = ckalloc(sizeof(IdleHandler));
+ idlePtr = Tcl_Alloc(sizeof(IdleHandler));
idlePtr->proc = proc;
idlePtr->clientData = clientData;
idlePtr->generation = tsdPtr->idleGeneration;
@@ -674,7 +674,7 @@ Tcl_CancelIdleCall(
while ((idlePtr->proc == proc)
&& (idlePtr->clientData == clientData)) {
nextPtr = idlePtr->nextPtr;
- ckfree(idlePtr);
+ Tcl_Free(idlePtr);
idlePtr = nextPtr;
if (prevPtr == NULL) {
tsdPtr->idleList = idlePtr;
@@ -749,7 +749,7 @@ TclServiceIdle(void)
tsdPtr->lastIdlePtr = NULL;
}
idlePtr->proc(idlePtr->clientData);
- ckfree(idlePtr);
+ Tcl_Free(idlePtr);
}
if (tsdPtr->idleList) {
blockTime.sec = 0;
@@ -788,7 +788,7 @@ Tcl_AfterObjCmd(
Tcl_Time wakeup;
AfterInfo *afterPtr;
AfterAssocData *assocPtr;
- int length;
+ size_t length;
int index = -1;
static const char *const afterSubCmds[] = {
"cancel", "idle", "info", NULL
@@ -808,7 +808,7 @@ Tcl_AfterObjCmd(
assocPtr = Tcl_GetAssocData(interp, "tclAfter", NULL);
if (assocPtr == NULL) {
- assocPtr = ckalloc(sizeof(AfterAssocData));
+ assocPtr = Tcl_Alloc(sizeof(AfterAssocData));
assocPtr->interp = interp;
assocPtr->firstAfterPtr = NULL;
Tcl_SetAssocData(interp, "tclAfter", AfterCleanupProc, assocPtr);
@@ -821,7 +821,7 @@ Tcl_AfterObjCmd(
if (Tcl_GetWideIntFromObj(NULL, objv[1], &ms) != TCL_OK) {
if (Tcl_GetIndexFromObj(NULL, objv[1], afterSubCmds, "", 0, &index)
!= TCL_OK) {
- const char *arg = Tcl_GetString(objv[1]);
+ const char *arg = TclGetString(objv[1]);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"bad argument \"%s\": must be"
@@ -845,7 +845,7 @@ Tcl_AfterObjCmd(
if (objc == 2) {
return AfterDelay(interp, ms);
}
- afterPtr = ckalloc(sizeof(AfterInfo));
+ afterPtr = Tcl_Alloc(sizeof(AfterInfo));
afterPtr->assocPtr = assocPtr;
if (objc == 3) {
afterPtr->commandPtr = objv[2];
@@ -883,7 +883,7 @@ Tcl_AfterObjCmd(
case AFTER_CANCEL: {
Tcl_Obj *commandPtr;
const char *command, *tempCommand;
- int tempLength;
+ size_t tempLength;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 2, objv, "id|command");
@@ -925,7 +925,7 @@ Tcl_AfterObjCmd(
Tcl_WrongNumArgs(interp, 2, objv, "script ?script ...?");
return TCL_ERROR;
}
- afterPtr = ckalloc(sizeof(AfterInfo));
+ afterPtr = Tcl_Alloc(sizeof(AfterInfo));
afterPtr->assocPtr = assocPtr;
if (objc == 3) {
afterPtr->commandPtr = objv[2];
@@ -1190,7 +1190,7 @@ AfterProc(
*/
Tcl_DecrRefCount(afterPtr->commandPtr);
- ckfree(afterPtr);
+ Tcl_Free(afterPtr);
}
/*
@@ -1228,7 +1228,7 @@ FreeAfterPtr(
prevPtr->nextPtr = afterPtr->nextPtr;
}
Tcl_DecrRefCount(afterPtr->commandPtr);
- ckfree(afterPtr);
+ Tcl_Free(afterPtr);
}
/*
@@ -1267,9 +1267,9 @@ AfterCleanupProc(
Tcl_CancelIdleCall(AfterProc, afterPtr);
}
Tcl_DecrRefCount(afterPtr->commandPtr);
- ckfree(afterPtr);
+ Tcl_Free(afterPtr);
}
- ckfree(assocPtr);
+ Tcl_Free(assocPtr);
}
/*
diff --git a/generic/tclTomMath.decls b/generic/tclTomMath.decls
index 01b6342..dd819c4 100644
--- a/generic/tclTomMath.decls
+++ b/generic/tclTomMath.decls
@@ -174,43 +174,6 @@ declare 48 {
declare 49 {
void TclBN_mp_zero(mp_int *a)
}
-
-# internal routines to libtommath - should not be called but must be
-# exported to accommodate the "tommath" extension
-
-declare 50 {deprecated {is private function in libtommath}} {
- void TclBN_reverse(unsigned char *s, int len)
-}
-declare 51 {deprecated {is private function in libtommath}} {
- int TclBN_fast_s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs)
-}
-declare 52 {deprecated {is private function in libtommath}} {
- int TclBN_fast_s_mp_sqr(const mp_int *a, mp_int *b)
-}
-declare 53 {deprecated {is private function in libtommath}} {
- int TclBN_mp_karatsuba_mul(const mp_int *a, const mp_int *b, mp_int *c)
-}
-declare 54 {deprecated {is private function in libtommath}} {
- int TclBN_mp_karatsuba_sqr(const mp_int *a, mp_int *b)
-}
-declare 55 {deprecated {is private function in libtommath}} {
- int TclBN_mp_toom_mul(const mp_int *a, const mp_int *b, mp_int *c)
-}
-declare 56 {deprecated {is private function in libtommath}} {
- int TclBN_mp_toom_sqr(const mp_int *a, mp_int *b)
-}
-declare 57 {deprecated {is private function in libtommath}} {
- int TclBN_s_mp_add(const mp_int *a, const mp_int *b, mp_int *c)
-}
-declare 58 {deprecated {is private function in libtommath}} {
- int TclBN_s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs)
-}
-declare 59 {deprecated {is private function in libtommath}} {
- int TclBN_s_mp_sqr(const mp_int *a, mp_int *b)
-}
-declare 60 {deprecated {is private function in libtommath}} {
- int TclBN_s_mp_sub(const mp_int *a, const mp_int *b, mp_int *c)
-}
declare 61 {
int TclBN_mp_init_set_int(mp_int *a, unsigned long i)
}
@@ -223,15 +186,18 @@ declare 63 {
# Formerly internal API to allow initialisation of bignums without knowing the
# typedefs of how a bignum works internally.
-declare 64 {deprecated {Use mp_init() + mp_set_long_long()}} {
- void TclBNInitBignumFromLong(mp_int *bignum, long initVal)
-}
-declare 65 {deprecated {Use mp_init() + mp_set_long_long()}} {
- void TclBNInitBignumFromWideInt(mp_int *bignum, Tcl_WideInt initVal)
-}
-declare 66 {deprecated {Use mp_init() + mp_set_long_long()}} {
- void TclBNInitBignumFromWideUInt(mp_int *bignum, Tcl_WideUInt initVal)
-}
+# Removed in 9.0
+#declare 64 {
+# void TclBNInitBignumFromLong(mp_int *bignum, long initVal)
+#}
+# Removed in 9.0
+#declare 65 {
+# void TclBNInitBignumFromWideInt(mp_int *bignum, Tcl_WideInt initVal)
+#}
+# Removed in 9.0
+#declare 66 {
+# void TclBNInitBignumFromWideUInt(mp_int *bignum, Tcl_WideUInt initVal)
+#}
# Added in libtommath 1.0
declare 67 {
@@ -255,15 +221,18 @@ declare 72 {
}
# Added in libtommath 1.1.0
-declare 73 {
- int TclBN_mp_tc_and(const mp_int *a, const mp_int *b, mp_int *c)
-}
-declare 74 {
- int TclBN_mp_tc_or(const mp_int *a, const mp_int *b, mp_int *c)
-}
-declare 75 {
- int TclBN_mp_tc_xor(const mp_int *a, const mp_int *b, mp_int *c)
-}
+# No longer in use: replaced by mp_and()
+#declare 73 {
+# int TclBN_mp_tc_and(const mp_int *a, const mp_int *b, mp_int *c)
+#}
+# No longer in use: replaced by mp_or()
+#declare 74 {
+# int TclBN_mp_tc_or(const mp_int *a, const mp_int *b, mp_int *c)
+#}
+# No longer in use: replaced by mp_xor()
+#declare 75 {
+# int TclBN_mp_tc_xor(const mp_int *a, const mp_int *b, mp_int *c)
+#}
declare 76 {
int TclBN_mp_signed_rsh(const mp_int *a, int b, mp_int *c)
}
diff --git a/generic/tclTomMathDecls.h b/generic/tclTomMathDecls.h
index 52b84ee..e697181 100644
--- a/generic/tclTomMathDecls.h
+++ b/generic/tclTomMathDecls.h
@@ -30,12 +30,13 @@
/* Define custom memory allocation for libtommath */
+
/* MODULE_SCOPE void* TclBNAlloc( size_t ); */
-#define TclBNAlloc(s) ((void*)ckalloc((size_t)(s)))
+#define TclBNAlloc(s) ((void*)Tcl_Alloc((size_t)(s)))
/* MODULE_SCOPE void* TclBNRealloc( void*, size_t ); */
-#define TclBNRealloc(x,s) ((void*)ckrealloc((char*)(x),(size_t)(s)))
+#define TclBNRealloc(x,s) ((void*)Tcl_Realloc((char*)(x),(size_t)(s)))
/* MODULE_SCOPE void TclBNFree( void* ); */
-#define TclBNFree(x) (ckfree((char*)(x)))
+#define TclBNFree(x) (Tcl_Free((char*)(x)))
#define XMALLOC(size) TclBNAlloc(size)
#define XFREE(mem, size) TclBNFree(mem)
@@ -70,7 +71,6 @@
#define mp_exch TclBN_mp_exch
#define mp_expt_d TclBN_mp_expt_d
#define mp_expt_d_ex TclBN_mp_expt_d_ex
-#define mp_get_bit TclBN_mp_get_bit
#define mp_get_int TclBN_mp_get_int
#define mp_get_long TclBN_mp_get_long
#define mp_get_long_long TclBN_mp_get_long_long
@@ -109,10 +109,6 @@
#define mp_sub TclBN_mp_sub
#define mp_sub_d TclBN_mp_sub_d
#define mp_signed_rsh TclBN_mp_signed_rsh
-#define mp_tc_and TclBN_mp_and
-#define mp_tc_div_2d TclBN_mp_signed_rsh
-#define mp_tc_or TclBN_mp_or
-#define mp_tc_xor TclBN_mp_xor
#define mp_to_unsigned_bin TclBN_mp_to_unsigned_bin
#define mp_to_unsigned_bin_n TclBN_mp_to_unsigned_bin_n
#define mp_toom_mul TclBN_mp_toom_mul
@@ -128,6 +124,24 @@
#define s_mp_sqr TclBN_s_mp_sqr
#define s_mp_sub TclBN_s_mp_sub
+MODULE_SCOPE void TclBN_reverse(unsigned char *s, int len);
+MODULE_SCOPE int TclBN_fast_s_mp_mul_digs(const mp_int *a,
+ const mp_int *b, mp_int *c, int digs);
+MODULE_SCOPE int TclBN_fast_s_mp_sqr(const mp_int *a, mp_int *b);
+MODULE_SCOPE int TclBN_mp_karatsuba_mul(const mp_int *a,
+ const mp_int *b, mp_int *c);
+MODULE_SCOPE int TclBN_mp_karatsuba_sqr(const mp_int *a, mp_int *b);
+MODULE_SCOPE int TclBN_mp_toom_mul(const mp_int *a, const mp_int *b,
+ mp_int *c);
+MODULE_SCOPE int TclBN_mp_toom_sqr(const mp_int *a, mp_int *b);
+MODULE_SCOPE int TclBN_s_mp_add(const mp_int *a, const mp_int *b,
+ mp_int *c);
+MODULE_SCOPE int TclBN_s_mp_mul_digs(const mp_int *a, const mp_int *b,
+ mp_int *c, int digs);
+MODULE_SCOPE int TclBN_s_mp_sqr(const mp_int *a, mp_int *b);
+MODULE_SCOPE int TclBN_s_mp_sub(const mp_int *a, const mp_int *b,
+ mp_int *c);
+
#undef TCL_STORAGE_CLASS
#ifdef BUILD_tcl
# define TCL_STORAGE_CLASS DLLEXPORT
@@ -275,62 +289,26 @@ EXTERN int TclBN_mp_xor(const mp_int *a, const mp_int *b,
mp_int *c);
/* 49 */
EXTERN void TclBN_mp_zero(mp_int *a);
-/* 50 */
-TCL_DEPRECATED("is private function in libtommath")
-void TclBN_reverse(unsigned char *s, int len);
-/* 51 */
-TCL_DEPRECATED("is private function in libtommath")
-int TclBN_fast_s_mp_mul_digs(const mp_int *a,
- const mp_int *b, mp_int *c, int digs);
-/* 52 */
-TCL_DEPRECATED("is private function in libtommath")
-int TclBN_fast_s_mp_sqr(const mp_int *a, mp_int *b);
-/* 53 */
-TCL_DEPRECATED("is private function in libtommath")
-int TclBN_mp_karatsuba_mul(const mp_int *a,
- const mp_int *b, mp_int *c);
-/* 54 */
-TCL_DEPRECATED("is private function in libtommath")
-int TclBN_mp_karatsuba_sqr(const mp_int *a, mp_int *b);
-/* 55 */
-TCL_DEPRECATED("is private function in libtommath")
-int TclBN_mp_toom_mul(const mp_int *a, const mp_int *b,
- mp_int *c);
-/* 56 */
-TCL_DEPRECATED("is private function in libtommath")
-int TclBN_mp_toom_sqr(const mp_int *a, mp_int *b);
-/* 57 */
-TCL_DEPRECATED("is private function in libtommath")
-int TclBN_s_mp_add(const mp_int *a, const mp_int *b,
- mp_int *c);
-/* 58 */
-TCL_DEPRECATED("is private function in libtommath")
-int TclBN_s_mp_mul_digs(const mp_int *a, const mp_int *b,
- mp_int *c, int digs);
-/* 59 */
-TCL_DEPRECATED("is private function in libtommath")
-int TclBN_s_mp_sqr(const mp_int *a, mp_int *b);
-/* 60 */
-TCL_DEPRECATED("is private function in libtommath")
-int TclBN_s_mp_sub(const mp_int *a, const mp_int *b,
- mp_int *c);
+/* Slot 50 is reserved */
+/* Slot 51 is reserved */
+/* Slot 52 is reserved */
+/* Slot 53 is reserved */
+/* Slot 54 is reserved */
+/* Slot 55 is reserved */
+/* Slot 56 is reserved */
+/* Slot 57 is reserved */
+/* Slot 58 is reserved */
+/* Slot 59 is reserved */
+/* Slot 60 is reserved */
/* 61 */
EXTERN int TclBN_mp_init_set_int(mp_int *a, unsigned long i);
/* 62 */
EXTERN int TclBN_mp_set_int(mp_int *a, unsigned long i);
/* 63 */
EXTERN int TclBN_mp_cnt_lsb(const mp_int *a);
-/* 64 */
-TCL_DEPRECATED("Use mp_init() + mp_set_long_long()")
-void TclBNInitBignumFromLong(mp_int *bignum, long initVal);
-/* 65 */
-TCL_DEPRECATED("Use mp_init() + mp_set_long_long()")
-void TclBNInitBignumFromWideInt(mp_int *bignum,
- Tcl_WideInt initVal);
-/* 66 */
-TCL_DEPRECATED("Use mp_init() + mp_set_long_long()")
-void TclBNInitBignumFromWideUInt(mp_int *bignum,
- Tcl_WideUInt initVal);
+/* Slot 64 is reserved */
+/* Slot 65 is reserved */
+/* Slot 66 is reserved */
/* 67 */
EXTERN int TclBN_mp_expt_d_ex(const mp_int *a, mp_digit b,
mp_int *c, int fast);
@@ -344,15 +322,9 @@ EXTERN int TclBN_mp_set_long(mp_int *a, unsigned long i);
EXTERN unsigned long TclBN_mp_get_long(const mp_int *a);
/* 72 */
EXTERN unsigned long TclBN_mp_get_int(const mp_int *a);
-/* 73 */
-EXTERN int TclBN_mp_tc_and(const mp_int *a, const mp_int *b,
- mp_int *c);
-/* 74 */
-EXTERN int TclBN_mp_tc_or(const mp_int *a, const mp_int *b,
- mp_int *c);
-/* 75 */
-EXTERN int TclBN_mp_tc_xor(const mp_int *a, const mp_int *b,
- mp_int *c);
+/* Slot 73 is reserved */
+/* Slot 74 is reserved */
+/* Slot 75 is reserved */
/* 76 */
EXTERN int TclBN_mp_signed_rsh(const mp_int *a, int b,
mp_int *c);
@@ -413,32 +385,32 @@ typedef struct TclTomMathStubs {
int (*tclBN_mp_unsigned_bin_size) (const mp_int *a); /* 47 */
int (*tclBN_mp_xor) (const mp_int *a, const mp_int *b, mp_int *c); /* 48 */
void (*tclBN_mp_zero) (mp_int *a); /* 49 */
- TCL_DEPRECATED_API("is private function in libtommath") void (*tclBN_reverse) (unsigned char *s, int len); /* 50 */
- TCL_DEPRECATED_API("is private function in libtommath") int (*tclBN_fast_s_mp_mul_digs) (const mp_int *a, const mp_int *b, mp_int *c, int digs); /* 51 */
- TCL_DEPRECATED_API("is private function in libtommath") int (*tclBN_fast_s_mp_sqr) (const mp_int *a, mp_int *b); /* 52 */
- TCL_DEPRECATED_API("is private function in libtommath") int (*tclBN_mp_karatsuba_mul) (const mp_int *a, const mp_int *b, mp_int *c); /* 53 */
- TCL_DEPRECATED_API("is private function in libtommath") int (*tclBN_mp_karatsuba_sqr) (const mp_int *a, mp_int *b); /* 54 */
- TCL_DEPRECATED_API("is private function in libtommath") int (*tclBN_mp_toom_mul) (const mp_int *a, const mp_int *b, mp_int *c); /* 55 */
- TCL_DEPRECATED_API("is private function in libtommath") int (*tclBN_mp_toom_sqr) (const mp_int *a, mp_int *b); /* 56 */
- TCL_DEPRECATED_API("is private function in libtommath") int (*tclBN_s_mp_add) (const mp_int *a, const mp_int *b, mp_int *c); /* 57 */
- TCL_DEPRECATED_API("is private function in libtommath") int (*tclBN_s_mp_mul_digs) (const mp_int *a, const mp_int *b, mp_int *c, int digs); /* 58 */
- TCL_DEPRECATED_API("is private function in libtommath") int (*tclBN_s_mp_sqr) (const mp_int *a, mp_int *b); /* 59 */
- TCL_DEPRECATED_API("is private function in libtommath") int (*tclBN_s_mp_sub) (const mp_int *a, const mp_int *b, mp_int *c); /* 60 */
+ void (*reserved50)(void);
+ void (*reserved51)(void);
+ void (*reserved52)(void);
+ void (*reserved53)(void);
+ void (*reserved54)(void);
+ void (*reserved55)(void);
+ void (*reserved56)(void);
+ void (*reserved57)(void);
+ void (*reserved58)(void);
+ void (*reserved59)(void);
+ void (*reserved60)(void);
int (*tclBN_mp_init_set_int) (mp_int *a, unsigned long i); /* 61 */
int (*tclBN_mp_set_int) (mp_int *a, unsigned long i); /* 62 */
int (*tclBN_mp_cnt_lsb) (const mp_int *a); /* 63 */
- TCL_DEPRECATED_API("Use mp_init() + mp_set_long_long()") void (*tclBNInitBignumFromLong) (mp_int *bignum, long initVal); /* 64 */
- TCL_DEPRECATED_API("Use mp_init() + mp_set_long_long()") void (*tclBNInitBignumFromWideInt) (mp_int *bignum, Tcl_WideInt initVal); /* 65 */
- TCL_DEPRECATED_API("Use mp_init() + mp_set_long_long()") void (*tclBNInitBignumFromWideUInt) (mp_int *bignum, Tcl_WideUInt initVal); /* 66 */
+ void (*reserved64)(void);
+ void (*reserved65)(void);
+ void (*reserved66)(void);
int (*tclBN_mp_expt_d_ex) (const mp_int *a, mp_digit b, mp_int *c, int fast); /* 67 */
int (*tclBN_mp_set_long_long) (mp_int *a, Tcl_WideUInt i); /* 68 */
Tcl_WideUInt (*tclBN_mp_get_long_long) (const mp_int *a); /* 69 */
int (*tclBN_mp_set_long) (mp_int *a, unsigned long i); /* 70 */
unsigned long (*tclBN_mp_get_long) (const mp_int *a); /* 71 */
unsigned long (*tclBN_mp_get_int) (const mp_int *a); /* 72 */
- int (*tclBN_mp_tc_and) (const mp_int *a, const mp_int *b, mp_int *c); /* 73 */
- int (*tclBN_mp_tc_or) (const mp_int *a, const mp_int *b, mp_int *c); /* 74 */
- int (*tclBN_mp_tc_xor) (const mp_int *a, const mp_int *b, mp_int *c); /* 75 */
+ void (*reserved73)(void);
+ void (*reserved74)(void);
+ void (*reserved75)(void);
int (*tclBN_mp_signed_rsh) (const mp_int *a, int b, mp_int *c); /* 76 */
int (*tclBN_mp_get_bit) (const mp_int *a, int b); /* 77 */
} TclTomMathStubs;
@@ -555,40 +527,26 @@ extern const TclTomMathStubs *tclTomMathStubsPtr;
(tclTomMathStubsPtr->tclBN_mp_xor) /* 48 */
#define TclBN_mp_zero \
(tclTomMathStubsPtr->tclBN_mp_zero) /* 49 */
-#define TclBN_reverse \
- (tclTomMathStubsPtr->tclBN_reverse) /* 50 */
-#define TclBN_fast_s_mp_mul_digs \
- (tclTomMathStubsPtr->tclBN_fast_s_mp_mul_digs) /* 51 */
-#define TclBN_fast_s_mp_sqr \
- (tclTomMathStubsPtr->tclBN_fast_s_mp_sqr) /* 52 */
-#define TclBN_mp_karatsuba_mul \
- (tclTomMathStubsPtr->tclBN_mp_karatsuba_mul) /* 53 */
-#define TclBN_mp_karatsuba_sqr \
- (tclTomMathStubsPtr->tclBN_mp_karatsuba_sqr) /* 54 */
-#define TclBN_mp_toom_mul \
- (tclTomMathStubsPtr->tclBN_mp_toom_mul) /* 55 */
-#define TclBN_mp_toom_sqr \
- (tclTomMathStubsPtr->tclBN_mp_toom_sqr) /* 56 */
-#define TclBN_s_mp_add \
- (tclTomMathStubsPtr->tclBN_s_mp_add) /* 57 */
-#define TclBN_s_mp_mul_digs \
- (tclTomMathStubsPtr->tclBN_s_mp_mul_digs) /* 58 */
-#define TclBN_s_mp_sqr \
- (tclTomMathStubsPtr->tclBN_s_mp_sqr) /* 59 */
-#define TclBN_s_mp_sub \
- (tclTomMathStubsPtr->tclBN_s_mp_sub) /* 60 */
+/* Slot 50 is reserved */
+/* Slot 51 is reserved */
+/* Slot 52 is reserved */
+/* Slot 53 is reserved */
+/* Slot 54 is reserved */
+/* Slot 55 is reserved */
+/* Slot 56 is reserved */
+/* Slot 57 is reserved */
+/* Slot 58 is reserved */
+/* Slot 59 is reserved */
+/* Slot 60 is reserved */
#define TclBN_mp_init_set_int \
(tclTomMathStubsPtr->tclBN_mp_init_set_int) /* 61 */
#define TclBN_mp_set_int \
(tclTomMathStubsPtr->tclBN_mp_set_int) /* 62 */
#define TclBN_mp_cnt_lsb \
(tclTomMathStubsPtr->tclBN_mp_cnt_lsb) /* 63 */
-#define TclBNInitBignumFromLong \
- (tclTomMathStubsPtr->tclBNInitBignumFromLong) /* 64 */
-#define TclBNInitBignumFromWideInt \
- (tclTomMathStubsPtr->tclBNInitBignumFromWideInt) /* 65 */
-#define TclBNInitBignumFromWideUInt \
- (tclTomMathStubsPtr->tclBNInitBignumFromWideUInt) /* 66 */
+/* Slot 64 is reserved */
+/* Slot 65 is reserved */
+/* Slot 66 is reserved */
#define TclBN_mp_expt_d_ex \
(tclTomMathStubsPtr->tclBN_mp_expt_d_ex) /* 67 */
#define TclBN_mp_set_long_long \
@@ -601,12 +559,9 @@ extern const TclTomMathStubs *tclTomMathStubsPtr;
(tclTomMathStubsPtr->tclBN_mp_get_long) /* 71 */
#define TclBN_mp_get_int \
(tclTomMathStubsPtr->tclBN_mp_get_int) /* 72 */
-#define TclBN_mp_tc_and \
- (tclTomMathStubsPtr->tclBN_mp_tc_and) /* 73 */
-#define TclBN_mp_tc_or \
- (tclTomMathStubsPtr->tclBN_mp_tc_or) /* 74 */
-#define TclBN_mp_tc_xor \
- (tclTomMathStubsPtr->tclBN_mp_tc_xor) /* 75 */
+/* Slot 73 is reserved */
+/* Slot 74 is reserved */
+/* Slot 75 is reserved */
#define TclBN_mp_signed_rsh \
(tclTomMathStubsPtr->tclBN_mp_signed_rsh) /* 76 */
#define TclBN_mp_get_bit \
diff --git a/generic/tclTomMathInterface.c b/generic/tclTomMathInterface.c
index ae1eb7e..32b1e15 100644
--- a/generic/tclTomMathInterface.c
+++ b/generic/tclTomMathInterface.c
@@ -114,7 +114,7 @@ TclInitBignumFromWideInt(
if (mp_init(a) != MP_OKAY) {
Tcl_Panic("initialization failure in TclInitBignumFromWideInt");
}
- if (v < 0) {
+ if (v < (Tcl_WideInt)0) {
mp_set_long_long(a, (Tcl_WideUInt)(-v));
mp_neg(a, a);
} else {
diff --git a/generic/tclTrace.c b/generic/tclTrace.c
index 1a6d459..c4112f1 100644
--- a/generic/tclTrace.c
+++ b/generic/tclTrace.c
@@ -121,7 +121,7 @@ static Tcl_TraceTypeObjCmd *const traceSubCmds[] = {
*/
static int CallTraceFunction(Tcl_Interp *interp, Trace *tracePtr,
- Command *cmdPtr, const char *command, int numChars,
+ Command *cmdPtr, const char *command, size_t numChars,
int objc, Tcl_Obj *const objv[]);
static char * TraceVarProc(ClientData clientData, Tcl_Interp *interp,
const char *name1, const char *name2, int flags);
@@ -271,7 +271,8 @@ Tcl_TraceObjCmd(
case TRACE_OLD_VDELETE: {
Tcl_Obj *copyObjv[6];
Tcl_Obj *opsList;
- int code, numFlags;
+ int code;
+ size_t numFlags;
if (objc != 5) {
Tcl_WrongNumArgs(interp, 2, objv, "name ops command");
@@ -323,7 +324,7 @@ Tcl_TraceObjCmd(
return TCL_ERROR;
}
resultListPtr = Tcl_NewObj();
- name = Tcl_GetString(objv[2]);
+ name = TclGetString(objv[2]);
FOREACH_VAR_TRACE(interp, name, clientData) {
TraceVarInfo *tvarPtr = clientData;
char *q = ops;
@@ -403,9 +404,9 @@ TraceExecutionObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- int commandLength, index;
+ int index;
const char *name, *command;
- size_t length;
+ size_t commandLength, length;
enum traceOptions {
TRACE_ADD, TRACE_INFO, TRACE_REMOVE
};
@@ -467,9 +468,9 @@ TraceExecutionObjCmd(
}
}
command = TclGetStringFromObj(objv[5], &commandLength);
- length = (size_t) commandLength;
+ length = commandLength;
if ((enum traceOptions) optionIndex == TRACE_ADD) {
- TraceCommandInfo *tcmdPtr = ckalloc(
+ TraceCommandInfo *tcmdPtr = Tcl_Alloc(
offsetof(TraceCommandInfo, command) + 1 + length);
tcmdPtr->flags = flags;
@@ -484,10 +485,10 @@ TraceExecutionObjCmd(
flags |= (TCL_TRACE_ENTER_EXEC | TCL_TRACE_LEAVE_EXEC);
}
memcpy(tcmdPtr->command, command, length+1);
- name = Tcl_GetString(objv[3]);
+ name = TclGetString(objv[3]);
if (Tcl_TraceCommand(interp, name, flags, TraceCommandProc,
tcmdPtr) != TCL_OK) {
- ckfree(tcmdPtr);
+ Tcl_Free(tcmdPtr);
return TCL_ERROR;
}
} else {
@@ -503,7 +504,7 @@ TraceExecutionObjCmd(
* First ensure the name given is valid.
*/
- name = Tcl_GetString(objv[3]);
+ name = TclGetString(objv[3]);
if (Tcl_FindCommand(interp,name,NULL,TCL_LEAVE_ERR_MSG) == NULL) {
return TCL_ERROR;
}
@@ -521,7 +522,7 @@ TraceExecutionObjCmd(
&& ((tcmdPtr->flags & (TCL_TRACE_ANY_EXEC |
TCL_TRACE_RENAME | TCL_TRACE_DELETE)) == flags)
&& (strncmp(command, tcmdPtr->command,
- (size_t) length) == 0)) {
+ length) == 0)) {
flags |= TCL_TRACE_DELETE;
if (flags & (TCL_TRACE_ENTER_DURING_EXEC |
TCL_TRACE_LEAVE_DURING_EXEC)) {
@@ -537,7 +538,7 @@ TraceExecutionObjCmd(
Tcl_DeleteTrace(interp, tcmdPtr->stepTrace);
tcmdPtr->stepTrace = NULL;
- ckfree(tcmdPtr->startCmd);
+ Tcl_Free(tcmdPtr->startCmd);
}
if (tcmdPtr->flags & TCL_TRACE_EXEC_IN_PROGRESS) {
/*
@@ -547,7 +548,7 @@ TraceExecutionObjCmd(
tcmdPtr->flags = 0;
}
if (tcmdPtr->refCount-- <= 1) {
- ckfree(tcmdPtr);
+ Tcl_Free(tcmdPtr);
}
break;
}
@@ -564,7 +565,7 @@ TraceExecutionObjCmd(
return TCL_ERROR;
}
- name = Tcl_GetString(objv[3]);
+ name = TclGetString(objv[3]);
/*
* First ensure the name given is valid.
@@ -651,9 +652,9 @@ TraceCommandObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- int commandLength, index;
+ int index;
const char *name, *command;
- size_t length;
+ size_t commandLength, length;
enum traceOptions { TRACE_ADD, TRACE_INFO, TRACE_REMOVE };
static const char *const opStrings[] = { "delete", "rename", NULL };
enum operations { TRACE_CMD_DELETE, TRACE_CMD_RENAME };
@@ -704,9 +705,9 @@ TraceCommandObjCmd(
}
command = TclGetStringFromObj(objv[5], &commandLength);
- length = (size_t) commandLength;
+ length = commandLength;
if ((enum traceOptions) optionIndex == TRACE_ADD) {
- TraceCommandInfo *tcmdPtr = ckalloc(
+ TraceCommandInfo *tcmdPtr = Tcl_Alloc(
offsetof(TraceCommandInfo, command) + 1 + length);
tcmdPtr->flags = flags;
@@ -717,10 +718,10 @@ TraceCommandObjCmd(
tcmdPtr->refCount = 1;
flags |= TCL_TRACE_DELETE;
memcpy(tcmdPtr->command, command, length+1);
- name = Tcl_GetString(objv[3]);
+ name = TclGetString(objv[3]);
if (Tcl_TraceCommand(interp, name, flags, TraceCommandProc,
tcmdPtr) != TCL_OK) {
- ckfree(tcmdPtr);
+ Tcl_Free(tcmdPtr);
return TCL_ERROR;
}
} else {
@@ -736,7 +737,7 @@ TraceCommandObjCmd(
* First ensure the name given is valid.
*/
- name = Tcl_GetString(objv[3]);
+ name = TclGetString(objv[3]);
if (Tcl_FindCommand(interp,name,NULL,TCL_LEAVE_ERR_MSG) == NULL) {
return TCL_ERROR;
}
@@ -746,12 +747,12 @@ TraceCommandObjCmd(
if ((tcmdPtr->length == length) && (tcmdPtr->flags == flags)
&& (strncmp(command, tcmdPtr->command,
- (size_t) length) == 0)) {
+ length) == 0)) {
Tcl_UntraceCommand(interp, name, flags | TCL_TRACE_DELETE,
TraceCommandProc, clientData);
tcmdPtr->flags |= TCL_TRACE_DESTROYED;
if (tcmdPtr->refCount-- <= 1) {
- ckfree(tcmdPtr);
+ Tcl_Free(tcmdPtr);
}
break;
}
@@ -772,7 +773,7 @@ TraceCommandObjCmd(
* First ensure the name given is valid.
*/
- name = Tcl_GetString(objv[3]);
+ name = TclGetString(objv[3]);
if (Tcl_FindCommand(interp, name, NULL, TCL_LEAVE_ERR_MSG) == NULL) {
return TCL_ERROR;
}
@@ -845,9 +846,9 @@ TraceVariableObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- int commandLength, index;
+ int index;
const char *name, *command;
- size_t length;
+ size_t commandLength, length;
ClientData clientData;
enum traceOptions { TRACE_ADD, TRACE_INFO, TRACE_REMOVE };
static const char *const opStrings[] = {
@@ -907,9 +908,9 @@ TraceVariableObjCmd(
}
}
command = TclGetStringFromObj(objv[5], &commandLength);
- length = (size_t) commandLength;
+ length = commandLength;
if ((enum traceOptions) optionIndex == TRACE_ADD) {
- CombinedTraceVarInfo *ctvarPtr = ckalloc(
+ CombinedTraceVarInfo *ctvarPtr = Tcl_Alloc(
offsetof(CombinedTraceVarInfo, traceCmdInfo.command)
+ 1 + length);
@@ -925,10 +926,10 @@ TraceVariableObjCmd(
ctvarPtr->traceInfo.traceProc = TraceVarProc;
ctvarPtr->traceInfo.clientData = &ctvarPtr->traceCmdInfo;
ctvarPtr->traceInfo.flags = flags;
- name = Tcl_GetString(objv[3]);
+ name = TclGetString(objv[3]);
if (TraceVarEx(interp, name, NULL, (VarTrace *) ctvarPtr)
!= TCL_OK) {
- ckfree(ctvarPtr);
+ Tcl_Free(ctvarPtr);
return TCL_ERROR;
}
} else {
@@ -938,7 +939,7 @@ TraceVariableObjCmd(
* first one that matches.
*/
- name = Tcl_GetString(objv[3]);
+ name = TclGetString(objv[3]);
FOREACH_VAR_TRACE(interp, name, clientData) {
TraceVarInfo *tvarPtr = clientData;
@@ -949,7 +950,7 @@ TraceVariableObjCmd(
#endif
)==flags)
&& (strncmp(command, tvarPtr->command,
- (size_t) length) == 0)) {
+ length) == 0)) {
Tcl_UntraceVar2(interp, name, NULL,
flags | TCL_TRACE_UNSETS | TCL_TRACE_RESULT_OBJECT,
TraceVarProc, clientData);
@@ -968,7 +969,7 @@ TraceVariableObjCmd(
}
resultListPtr = Tcl_NewObj();
- name = Tcl_GetString(objv[3]);
+ name = TclGetString(objv[3]);
FOREACH_VAR_TRACE(interp, name, clientData) {
Tcl_Obj *opObjPtr, *eachTraceObjPtr, *elemObjPtr;
TraceVarInfo *tvarPtr = clientData;
@@ -1126,7 +1127,7 @@ Tcl_TraceCommand(
* Set up trace information.
*/
- tracePtr = ckalloc(sizeof(CommandTrace));
+ tracePtr = Tcl_Alloc(sizeof(CommandTrace));
tracePtr->traceProc = proc;
tracePtr->clientData = clientData;
tracePtr->flags = flags &
@@ -1232,7 +1233,7 @@ Tcl_UntraceCommand(
tracePtr->flags = 0;
if (tracePtr->refCount-- <= 1) {
- ckfree(tracePtr);
+ Tcl_Free(tracePtr);
}
if (hasExecTraces) {
@@ -1305,7 +1306,7 @@ TraceCommandProc(
*/
Tcl_DStringInit(&cmd);
- Tcl_DStringAppend(&cmd, tcmdPtr->command, (int) tcmdPtr->length);
+ Tcl_DStringAppend(&cmd, tcmdPtr->command, tcmdPtr->length);
Tcl_DStringAppendElement(&cmd, oldName);
Tcl_DStringAppendElement(&cmd, (newName ? newName : ""));
if (flags & TCL_TRACE_RENAME) {
@@ -1347,7 +1348,7 @@ TraceCommandProc(
if (tcmdPtr->stepTrace != NULL) {
Tcl_DeleteTrace(interp, tcmdPtr->stepTrace);
tcmdPtr->stepTrace = NULL;
- ckfree(tcmdPtr->startCmd);
+ Tcl_Free(tcmdPtr->startCmd);
}
if (tcmdPtr->flags & TCL_TRACE_EXEC_IN_PROGRESS) {
/*
@@ -1389,7 +1390,7 @@ TraceCommandProc(
tcmdPtr->refCount--;
}
if (tcmdPtr->refCount-- <= 1) {
- ckfree(tcmdPtr);
+ Tcl_Free(tcmdPtr);
}
}
@@ -1423,7 +1424,7 @@ TclCheckExecutionTraces(
Tcl_Interp *interp, /* The current interpreter. */
const char *command, /* Pointer to beginning of the current command
* string. */
- int numChars, /* The number of characters in 'command' which
+ size_t numChars, /* The number of characters in 'command' which
* are part of the command string. */
Command *cmdPtr, /* Points to command's Command struct. */
int code, /* The current result code. */
@@ -1481,7 +1482,7 @@ TclCheckExecutionTraces(
traceCode = TraceExecutionProc(tcmdPtr, interp, curLevel,
command, (Tcl_Command) cmdPtr, objc, objv);
if (tcmdPtr->refCount-- <= 1) {
- ckfree(tcmdPtr);
+ Tcl_Free(tcmdPtr);
}
}
}
@@ -1529,7 +1530,7 @@ TclCheckInterpTraces(
Tcl_Interp *interp, /* The current interpreter. */
const char *command, /* Pointer to beginning of the current command
* string. */
- int numChars, /* The number of characters in 'command' which
+ size_t numChars, /* The number of characters in 'command' which
* are part of the command string. */
Command *cmdPtr, /* Points to command's Command struct. */
int code, /* The current result code. */
@@ -1676,7 +1677,7 @@ CallTraceFunction(
Command *cmdPtr, /* Points to command's Command struct. */
const char *command, /* Points to the first character of the
* command's source before substitutions. */
- int numChars, /* The number of characters in the command's
+ size_t numChars, /* The number of characters in the command's
* source. */
register int objc, /* Number of arguments for the command. */
Tcl_Obj *const objv[]) /* Pointers to Tcl_Obj of each argument. */
@@ -1728,7 +1729,7 @@ CommandObjTraceDeleted(
TraceCommandInfo *tcmdPtr = clientData;
if (tcmdPtr->refCount-- <= 1) {
- ckfree(tcmdPtr);
+ Tcl_Free(tcmdPtr);
}
}
@@ -1810,7 +1811,7 @@ TraceExecutionProc(
&& (strcmp(command, tcmdPtr->startCmd) == 0)) {
Tcl_DeleteTrace(interp, tcmdPtr->stepTrace);
tcmdPtr->stepTrace = NULL;
- ckfree(tcmdPtr->startCmd);
+ Tcl_Free(tcmdPtr->startCmd);
}
/*
@@ -1822,7 +1823,7 @@ TraceExecutionProc(
int i, saveInterpFlags;
Tcl_DStringInit(&cmd);
- Tcl_DStringAppend(&cmd, tcmdPtr->command, (int)tcmdPtr->length);
+ Tcl_DStringAppend(&cmd, tcmdPtr->command, tcmdPtr->length);
/*
* Append command with arguments.
@@ -1830,7 +1831,7 @@ TraceExecutionProc(
Tcl_DStringInit(&sub);
for (i = 0; i < objc; i++) {
- Tcl_DStringAppendElement(&sub, Tcl_GetString(objv[i]));
+ Tcl_DStringAppendElement(&sub, TclGetString(objv[i]));
}
Tcl_DStringAppendElement(&cmd, Tcl_DStringValue(&sub));
Tcl_DStringFree(&sub);
@@ -1854,7 +1855,7 @@ TraceExecutionProc(
*/
resultCode = Tcl_NewIntObj(code);
- resultCodeStr = Tcl_GetString(resultCode);
+ resultCodeStr = TclGetString(resultCode);
Tcl_DStringAppendElement(&cmd, resultCodeStr);
Tcl_DecrRefCount(resultCode);
@@ -1923,7 +1924,7 @@ TraceExecutionProc(
register unsigned len = strlen(command) + 1;
tcmdPtr->startLevel = level;
- tcmdPtr->startCmd = ckalloc(len);
+ tcmdPtr->startCmd = Tcl_Alloc(len);
memcpy(tcmdPtr->startCmd, command, len);
tcmdPtr->refCount++;
tcmdPtr->stepTrace = Tcl_CreateObjTrace(interp, 0,
@@ -1935,12 +1936,12 @@ TraceExecutionProc(
if (tcmdPtr->stepTrace != NULL) {
Tcl_DeleteTrace(interp, tcmdPtr->stepTrace);
tcmdPtr->stepTrace = NULL;
- ckfree(tcmdPtr->startCmd);
+ Tcl_Free(tcmdPtr->startCmd);
}
}
if (call) {
if (tcmdPtr->refCount-- <= 1) {
- ckfree(tcmdPtr);
+ Tcl_Free(tcmdPtr);
}
}
return traceCode;
@@ -1991,14 +1992,14 @@ TraceVarProc(
result = NULL;
if ((tvarPtr->flags & flags) && !Tcl_InterpDeleted(interp)
&& !Tcl_LimitExceeded(interp)) {
- if (tvarPtr->length != (size_t) 0) {
+ if (tvarPtr->length) {
/*
* Generate a command to execute by appending list elements for
* the two variable names and the operation.
*/
Tcl_DStringInit(&cmd);
- Tcl_DStringAppend(&cmd, tvarPtr->command, (int) tvarPtr->length);
+ Tcl_DStringAppend(&cmd, tvarPtr->command, tvarPtr->length);
Tcl_DStringAppendElement(&cmd, name1);
Tcl_DStringAppendElement(&cmd, (name2 ? name2 : ""));
#ifndef TCL_REMOVE_OBSOLETE_TRACES
@@ -2167,7 +2168,7 @@ Tcl_CreateObjTrace(
iPtr->tracesForbiddingInline++;
}
- tracePtr = ckalloc(sizeof(Trace));
+ tracePtr = Tcl_Alloc(sizeof(Trace));
tracePtr->level = level;
tracePtr->proc = proc;
tracePtr->clientData = clientData;
@@ -2230,7 +2231,7 @@ Tcl_CreateTrace(
* command. */
ClientData clientData) /* Arbitrary value word to pass to proc. */
{
- StringTraceData *data = ckalloc(sizeof(StringTraceData));
+ StringTraceData *data = Tcl_Alloc(sizeof(StringTraceData));
data->clientData = clientData;
data->proc = proc;
@@ -2277,7 +2278,7 @@ StringTraceProc(
argv = (const char **) TclStackAlloc(interp,
(objc + 1) * sizeof(const char *));
for (i = 0; i < objc; i++) {
- argv[i] = Tcl_GetString(objv[i]);
+ argv[i] = TclGetString(objv[i]);
}
argv[objc] = 0;
@@ -2314,7 +2315,7 @@ static void
StringTraceDeleteProc(
ClientData clientData)
{
- ckfree(clientData);
+ Tcl_Free(clientData);
}
/*
@@ -2780,7 +2781,7 @@ TclCallVarTraces(
(part2 ? ")" : "") ));
if (disposeFlags & TCL_TRACE_RESULT_OBJECT) {
TclVarErrMsg((Tcl_Interp *) iPtr, part1, part2, verb,
- Tcl_GetString((Tcl_Obj *) result));
+ TclGetString((Tcl_Obj *) result));
} else {
TclVarErrMsg((Tcl_Interp *) iPtr, part1, part2, verb, result);
}
@@ -2839,7 +2840,7 @@ DisposeTraceResult(
* to be disposed. */
{
if (flags & TCL_TRACE_RESULT_DYNAMIC) {
- ckfree(result);
+ Tcl_Free(result);
} else if (flags & TCL_TRACE_RESULT_OBJECT) {
Tcl_DecrRefCount((Tcl_Obj *) result);
}
@@ -2848,41 +2849,6 @@ DisposeTraceResult(
/*
*----------------------------------------------------------------------
*
- * Tcl_UntraceVar --
- *
- * Remove a previously-created trace for a variable.
- *
- * Results:
- * None.
- *
- * Side effects:
- * If there exists a trace for the variable given by varName with the
- * given flags, proc, and clientData, then that trace is removed.
- *
- *----------------------------------------------------------------------
- */
-
-#ifndef TCL_NO_DEPRECATED
-#undef Tcl_UntraceVar
-void
-Tcl_UntraceVar(
- Tcl_Interp *interp, /* Interpreter containing variable. */
- const char *varName, /* Name of variable; may end with "(index)" to
- * signify an array reference. */
- int flags, /* OR-ed collection of bits describing current
- * trace, including any of TCL_TRACE_READS,
- * TCL_TRACE_WRITES, TCL_TRACE_UNSETS,
- * TCL_GLOBAL_ONLY and TCL_NAMESPACE_ONLY. */
- Tcl_VarTraceProc *proc, /* Function assocated with trace. */
- ClientData clientData) /* Arbitrary argument to pass to proc. */
-{
- Tcl_UntraceVar2(interp, varName, NULL, flags, proc, clientData);
-}
-#endif /* TCL_NO_DEPRECATED */
-
-/*
- *----------------------------------------------------------------------
- *
* Tcl_UntraceVar2 --
*
* Remove a previously-created trace for a variable.
@@ -3013,49 +2979,6 @@ Tcl_UntraceVar2(
/*
*----------------------------------------------------------------------
*
- * Tcl_VarTraceInfo --
- *
- * Return the clientData value associated with a trace on a variable.
- * This function can also be used to step through all of the traces on a
- * particular variable that have the same trace function.
- *
- * Results:
- * The return value is the clientData value associated with a trace on
- * the given variable. Information will only be returned for a trace with
- * proc as trace function. If the clientData argument is NULL then the
- * first such trace is returned; otherwise, the next relevant one after
- * the one given by clientData will be returned. If the variable doesn't
- * exist, or if there are no (more) traces for it, then NULL is returned.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-#ifndef TCL_NO_DEPRECATED
-#undef Tcl_VarTraceInfo
-ClientData
-Tcl_VarTraceInfo(
- Tcl_Interp *interp, /* Interpreter containing variable. */
- const char *varName, /* Name of variable; may end with "(index)" to
- * signify an array reference. */
- int flags, /* OR-ed combo or TCL_GLOBAL_ONLY,
- * TCL_NAMESPACE_ONLY (can be 0). */
- Tcl_VarTraceProc *proc, /* Function assocated with trace. */
- ClientData prevClientData) /* If non-NULL, gives last value returned by
- * this function, so this call will return the
- * next trace after that one. If NULL, this
- * call will return the first trace. */
-{
- return Tcl_VarTraceInfo2(interp, varName, NULL, flags, proc,
- prevClientData);
-}
-#endif /* TCL_NO_DEPRECATED */
-
-/*
- *----------------------------------------------------------------------
- *
* Tcl_VarTraceInfo2 --
*
* Same as Tcl_VarTraceInfo, except takes name in two pieces instead of
@@ -3126,47 +3049,6 @@ Tcl_VarTraceInfo2(
/*
*----------------------------------------------------------------------
*
- * Tcl_TraceVar --
- *
- * Arrange for reads and/or writes to a variable to cause a function to
- * be invoked, which can monitor the operations and/or change their
- * actions.
- *
- * Results:
- * A standard Tcl return value.
- *
- * Side effects:
- * A trace is set up on the variable given by varName, such that future
- * references to the variable will be intermediated by proc. See the
- * manual entry for complete details on the calling sequence for proc.
- * The variable's flags are updated.
- *
- *----------------------------------------------------------------------
- */
-
-#ifndef TCL_NO_DEPRECATED
-#undef Tcl_TraceVar
-int
-Tcl_TraceVar(
- Tcl_Interp *interp, /* Interpreter in which variable is to be
- * traced. */
- const char *varName, /* Name of variable; may end with "(index)" to
- * signify an array reference. */
- int flags, /* OR-ed collection of bits, including any of
- * TCL_TRACE_READS, TCL_TRACE_WRITES,
- * TCL_TRACE_UNSETS, TCL_GLOBAL_ONLY, and
- * TCL_NAMESPACE_ONLY. */
- Tcl_VarTraceProc *proc, /* Function to call when specified ops are
- * invoked upon varName. */
- ClientData clientData) /* Arbitrary argument to pass to proc. */
-{
- return Tcl_TraceVar2(interp, varName, NULL, flags, proc, clientData);
-}
-#endif /* TCL_NO_DEPRECATED */
-
-/*
- *----------------------------------------------------------------------
- *
* Tcl_TraceVar2 --
*
* Arrange for reads and/or writes to a variable to cause a function to
@@ -3204,7 +3086,7 @@ Tcl_TraceVar2(
register VarTrace *tracePtr;
int result;
- tracePtr = ckalloc(sizeof(VarTrace));
+ tracePtr = Tcl_Alloc(sizeof(VarTrace));
tracePtr->traceProc = proc;
tracePtr->clientData = clientData;
tracePtr->flags = flags;
@@ -3212,7 +3094,7 @@ Tcl_TraceVar2(
result = TraceVarEx(interp, part1, part2, tracePtr);
if (result != TCL_OK) {
- ckfree(tracePtr);
+ Tcl_Free(tracePtr);
}
return result;
}
@@ -3248,7 +3130,7 @@ TraceVarEx(
* as-a-whole. */
register VarTrace *tracePtr)/* Structure containing flags, traceProc and
* clientData fields. Others should be left
- * blank. Will be ckfree()d (eventually) if
+ * blank. Will be Tcl_Free()d (eventually) if
* this function returns TCL_OK, and up to
* caller to free if this function returns
* TCL_ERROR. */
diff --git a/generic/tclUtf.c b/generic/tclUtf.c
index 1387ee7..ef89a6a 100644
--- a/generic/tclUtf.c
+++ b/generic/tclUtf.c
@@ -86,7 +86,7 @@ static const unsigned char totalBytes[256] = {
*---------------------------------------------------------------------------
*/
-int
+size_t
TclUtfCount(
int ch) /* The Unicode character whose size is returned. */
{
@@ -224,14 +224,15 @@ three:
char *
Tcl_UniCharToUtfDString(
const Tcl_UniChar *uniStr, /* Unicode string to convert to UTF-8. */
- int uniLength, /* Length of Unicode string in Tcl_UniChars
+ size_t uniLength, /* Length of Unicode string in Tcl_UniChars
* (must be >= 0). */
Tcl_DString *dsPtr) /* UTF-8 representation of string is appended
* to this previously initialized DString. */
{
const Tcl_UniChar *w, *wEnd;
char *p, *string;
- int oldLength, len = 1;
+ size_t oldLength;
+ int len = 1;
/*
* UTF-8 string length in bytes will be <= Unicode string length * 4.
@@ -583,7 +584,7 @@ TclUtfToWChar(
Tcl_UniChar *
Tcl_UtfToUniCharDString(
const char *src, /* UTF-8 string to convert to Unicode. */
- int length, /* Length of UTF-8 string in bytes, or -1 for
+ size_t length, /* Length of UTF-8 string in bytes, or -1 for
* strlen(). */
Tcl_DString *dsPtr) /* Unicode representation of string is
* appended to this previously initialized
@@ -591,9 +592,9 @@ Tcl_UtfToUniCharDString(
{
Tcl_UniChar ch = 0, *w, *wString;
const char *p, *end;
- int oldLength;
+ size_t oldLength;
- if (length < 0) {
+ if (length == TCL_AUTO_LENGTH) {
length = strlen(src);
}
@@ -706,9 +707,9 @@ int
Tcl_UtfCharComplete(
const char *src, /* String to check if first few bytes contain
* a complete UTF-8 character. */
- int length) /* Length of above string in bytes. */
+ size_t length) /* Length of above string in bytes. */
{
- return length >= totalBytes[(unsigned char)*src];
+ return length >= totalBytes[(unsigned char)*src];
}
/*
@@ -729,14 +730,14 @@ Tcl_UtfCharComplete(
*---------------------------------------------------------------------------
*/
-int
+size_t
Tcl_NumUtfChars(
register const char *src, /* The UTF-8 string to measure. */
- int length) /* The length of the string in bytes, or -1
+ size_t length) /* The length of the string in bytes, or -1
* for strlen(string). */
{
Tcl_UniChar ch = 0;
- register int i = 0;
+ register size_t i = 0;
/*
* The separate implementations are faster.
@@ -745,12 +746,11 @@ Tcl_NumUtfChars(
* single-byte char case specially.
*/
- if (length < 0) {
+ if (length == TCL_AUTO_LENGTH) {
while (*src != '\0') {
src += TclUtfToUniChar(src, &ch);
i++;
}
- if (i < 0) i = INT_MAX; /* Bug [2738427] */
} else {
register const char *endPtr = src + length - 4;
@@ -794,7 +794,8 @@ Tcl_UtfFindFirst(
const char *src, /* The UTF-8 string to be searched. */
int ch) /* The Unicode character to search for. */
{
- int len, fullchar;
+ size_t len;
+ int fullchar;
Tcl_UniChar find = 0;
while (1) {
@@ -840,7 +841,8 @@ Tcl_UtfFindLast(
const char *src, /* The UTF-8 string to be searched. */
int ch) /* The Unicode character to search for. */
{
- int len, fullchar;
+ size_t len;
+ int fullchar;
Tcl_UniChar find = 0;
const char *last;
@@ -889,7 +891,7 @@ Tcl_UtfNext(
const char *src) /* The current location in the string. */
{
Tcl_UniChar ch = 0;
- int len = TclUtfToUniChar(src, &ch);
+ size_t len = TclUtfToUniChar(src, &ch);
#if TCL_UTF_MAX <= 4
if ((ch >= 0xD800) && (len < 3)) {
@@ -969,15 +971,16 @@ Tcl_UtfPrev(
int
Tcl_UniCharAtIndex(
register const char *src, /* The UTF-8 string to dereference. */
- register int index) /* The position of the desired character. */
+ register size_t index) /* The position of the desired character. */
{
Tcl_UniChar ch = 0;
int fullchar = 0;
#if TCL_UTF_MAX <= 4
- int len = 0;
+ size_t len = 0;
#endif
- while (index-- >= 0) {
+ src += TclUtfToUniChar(src, &ch);
+ while (index--) {
#if TCL_UTF_MAX <= 4
src += (len = TclUtfToUniChar(src, &ch));
#else
@@ -1017,21 +1020,28 @@ Tcl_UniCharAtIndex(
const char *
Tcl_UtfAtIndex(
register const char *src, /* The UTF-8 string. */
- register int index) /* The position of the desired character. */
+ register size_t index) /* The position of the desired character. */
{
Tcl_UniChar ch = 0;
- int len = 0;
+#if TCL_UTF_MAX <= 4
+ size_t len = 0;
+#endif
- while (index-- > 0) {
- len = TclUtfToUniChar(src, &ch);
- src += len;
- }
+ if (index != TCL_INDEX_NONE) {
+ while (index--) {
+#if TCL_UTF_MAX <= 4
+ src += (len = TclUtfToUniChar(src, &ch));
+#else
+ src += TclUtfToUniChar(src, &ch);
+#endif
+ }
#if TCL_UTF_MAX <= 4
if ((ch >= 0xD800) && (len < 3)) {
/* Index points at character following high Surrogate */
src += TclUtfToUniChar(src, &ch);
}
#endif
+ }
return src;
}
@@ -1061,7 +1071,7 @@ Tcl_UtfAtIndex(
*---------------------------------------------------------------------------
*/
-int
+size_t
Tcl_UtfBackslash(
const char *src, /* Points to the backslash character of a
* backslash sequence. */
@@ -1071,8 +1081,7 @@ Tcl_UtfBackslash(
* backslash sequence. */
{
#define LINE_LENGTH 128
- int numRead;
- int result;
+ size_t numRead, result;
result = TclParseBackslash(src, LINE_LENGTH, &numRead, dst);
if (numRead == LINE_LENGTH) {
@@ -1080,7 +1089,7 @@ Tcl_UtfBackslash(
* We ate a whole line. Pay the price of a strlen()
*/
- result = TclParseBackslash(src, (int)strlen(src), &numRead, dst);
+ result = TclParseBackslash(src, strlen(src), &numRead, dst);
}
if (readPtr != NULL) {
*readPtr = numRead;
@@ -1113,7 +1122,7 @@ Tcl_UtfToUpper(
Tcl_UniChar ch = 0;
int upChar;
char *src, *dst;
- int len;
+ size_t len;
/*
* Iterate over the string until we hit the terminating null.
@@ -1175,7 +1184,7 @@ Tcl_UtfToLower(
Tcl_UniChar ch = 0;
int lowChar;
char *src, *dst;
- int len;
+ size_t len;
/*
* Iterate over the string until we hit the terminating null.
@@ -1238,7 +1247,7 @@ Tcl_UtfToTitle(
Tcl_UniChar ch = 0;
int titleChar, lowChar;
char *src, *dst;
- int len;
+ size_t len;
/*
* Capitalize the first character and then lowercase the rest of the
@@ -1315,7 +1324,7 @@ int
TclpUtfNcmp2(
const char *cs, /* UTF string to compare to ct. */
const char *ct, /* UTF string cs is compared to. */
- unsigned long numBytes) /* Number of *bytes* to compare. */
+ size_t numBytes) /* Number of *bytes* to compare. */
{
/*
* We can't simply call 'memcmp(cs, ct, numBytes);' because we need to
@@ -1362,7 +1371,7 @@ int
Tcl_UtfNcmp(
const char *cs, /* UTF string to compare to ct. */
const char *ct, /* UTF string cs is compared to. */
- unsigned long numChars) /* Number of UTF chars to compare. */
+ size_t numChars) /* Number of UTF chars to compare. */
{
Tcl_UniChar ch1 = 0, ch2 = 0;
@@ -1420,7 +1429,7 @@ int
Tcl_UtfNcasecmp(
const char *cs, /* UTF string to compare to ct. */
const char *ct, /* UTF string cs is compared to. */
- unsigned long numChars) /* Number of UTF chars to compare. */
+ size_t numChars) /* Number of UTF chars to compare. */
{
Tcl_UniChar ch1 = 0, ch2 = 0;
@@ -1666,11 +1675,11 @@ Tcl_UniCharToTitle(
*----------------------------------------------------------------------
*/
-int
+size_t
Tcl_UniCharLen(
const Tcl_UniChar *uniStr) /* Unicode string to find length of. */
{
- int len = 0;
+ size_t len = 0;
while (*uniStr != '\0') {
len++;
@@ -1700,7 +1709,7 @@ int
Tcl_UniCharNcmp(
const Tcl_UniChar *ucs, /* Unicode string to compare to uct. */
const Tcl_UniChar *uct, /* Unicode string ucs is compared to. */
- unsigned long numChars) /* Number of unichars to compare. */
+ size_t numChars) /* Number of unichars to compare. */
{
#ifdef WORDS_BIGENDIAN
/*
@@ -1745,7 +1754,7 @@ int
Tcl_UniCharNcasecmp(
const Tcl_UniChar *ucs, /* Unicode string to compare to uct. */
const Tcl_UniChar *uct, /* Unicode string ucs is compared to. */
- unsigned long numChars) /* Number of unichars to compare. */
+ size_t numChars) /* Number of unichars to compare. */
{
for ( ; numChars != 0; numChars--, ucs++, uct++) {
if (*ucs != *uct) {
@@ -2283,10 +2292,10 @@ Tcl_UniCharCaseMatch(
int
TclUniCharMatch(
const Tcl_UniChar *string, /* Unicode String. */
- int strLen, /* Length of String */
+ size_t strLen, /* Length of String */
const Tcl_UniChar *pattern, /* Pattern, which may contain special
* characters. */
- int ptnLen, /* Length of Pattern */
+ size_t ptnLen, /* Length of Pattern */
int nocase) /* 0 for case sensitive, 1 for insensitive */
{
const Tcl_UniChar *stringEnd, *patternEnd;
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index 4387c75..c9eb8d2 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -95,13 +95,6 @@ static ProcessGlobalValue executableName = {
#define CONVERT_ANY 16
/*
- * The following key is used by Tcl_PrintDouble and TclPrecTraceProc to
- * access the precision to be used for double formatting.
- */
-
-static Tcl_ThreadDataKey precisionKey;
-
-/*
* Prototypes for functions defined later in this file.
*/
@@ -116,7 +109,7 @@ static int GetWideForIndex(Tcl_Interp *interp, Tcl_Obj *objPtr,
static int FindElement(Tcl_Interp *interp, const char *string,
int stringLength, const char *typeStr,
const char *typeCode, const char **elementPtr,
- const char **nextPtr, int *sizePtr,
+ const char **nextPtr, size_t *sizePtr,
int *literalPtr);
/*
* The following is the Tcl object type definition for an object that
@@ -394,12 +387,12 @@ static const Tcl_ObjType endOffsetType = {
int
TclMaxListLength(
const char *bytes,
- int numBytes,
+ size_t numBytes,
const char **endPtr)
{
- int count = 0;
+ size_t count = 0;
- if ((numBytes == 0) || ((numBytes == -1) && (*bytes == '\0'))) {
+ if ((numBytes == 0) || ((numBytes == TCL_AUTO_LENGTH) && (*bytes == '\0'))) {
/* Empty string case - quick exit */
goto done;
}
@@ -415,7 +408,7 @@ TclMaxListLength(
*/
while (numBytes) {
- if ((numBytes == -1) && (*bytes == '\0')) {
+ if ((numBytes == TCL_AUTO_LENGTH) && (*bytes == '\0')) {
break;
}
if (TclIsSpaceProc(*bytes)) {
@@ -426,9 +419,9 @@ TclMaxListLength(
count++;
do {
bytes++;
- numBytes -= (numBytes != -1);
+ numBytes -= (numBytes != TCL_AUTO_LENGTH);
} while (numBytes && TclIsSpaceProc(*bytes));
- if ((numBytes == 0) || ((numBytes == -1) && (*bytes == '\0'))) {
+ if ((numBytes == 0) || ((numBytes == TCL_AUTO_LENGTH) && (*bytes == '\0'))) {
break;
}
@@ -437,7 +430,7 @@ TclMaxListLength(
*/
}
bytes++;
- numBytes -= (numBytes != -1);
+ numBytes -= (numBytes != TCL_AUTO_LENGTH);
}
/*
@@ -506,7 +499,7 @@ TclFindElement(
const char **nextPtr, /* Fill in with location of character just
* after all white space following end of
* argument (next arg or end of list). */
- int *sizePtr, /* If non-zero, fill in with size of
+ size_t *sizePtr, /* If non-zero, fill in with size of
* element. */
int *literalPtr) /* If non-zero, fill in with non-zero/zero to
* indicate that the substring of *sizePtr
@@ -535,7 +528,7 @@ TclFindDictElement(
const char **nextPtr, /* Fill in with location of character just
* after all white space following end of
* element (next arg or end of list). */
- int *sizePtr, /* If non-zero, fill in with size of
+ size_t *sizePtr, /* If non-zero, fill in with size of
* element. */
int *literalPtr) /* If non-zero, fill in with non-zero/zero to
* indicate that the substring of *sizePtr
@@ -567,7 +560,7 @@ FindElement(
const char **nextPtr, /* Fill in with location of character just
* after all white space following end of
* argument (next arg or end of list/dict). */
- int *sizePtr, /* If non-zero, fill in with size of
+ size_t *sizePtr, /* If non-zero, fill in with size of
* element. */
int *literalPtr) /* If non-zero, fill in with non-zero/zero to
* indicate that the substring of *sizePtr
@@ -582,7 +575,7 @@ FindElement(
int openBraces = 0; /* Brace nesting level during parse. */
int inQuotes = 0;
int size = 0; /* lint. */
- int numChars;
+ size_t numChars;
int literal = 1;
const char *p2;
@@ -793,20 +786,20 @@ FindElement(
*----------------------------------------------------------------------
*/
-int
+size_t
TclCopyAndCollapse(
- int count, /* Number of byte to copy from src. */
+ size_t count, /* Number of byte to copy from src. */
const char *src, /* Copy from here... */
char *dst) /* ... to here. */
{
- int newCount = 0;
+ size_t newCount = 0;
while (count > 0) {
char c = *src;
if (c == '\\') {
- int numRead;
- int backslashCount = TclParseBackslash(src, count, &numRead, dst);
+ size_t numRead;
+ size_t backslashCount = TclParseBackslash(src, count, &numRead, dst);
dst += backslashCount;
newCount += backslashCount;
@@ -864,7 +857,8 @@ Tcl_SplitList(
{
const char **argv, *end, *element;
char *p;
- int length, size, i, result, elSize;
+ int length, size, i, result;
+ size_t elSize;
/*
* Allocate enough space to work in. A (const char *) for each (possible)
@@ -876,7 +870,7 @@ Tcl_SplitList(
size = TclMaxListLength(list, -1, &end) + 1;
length = end - list;
- argv = ckalloc((size * sizeof(char *)) + length + 1);
+ argv = Tcl_Alloc((size * sizeof(char *)) + length + 1);
for (i = 0, p = ((char *) argv) + size*sizeof(char *);
*list != 0; i++) {
@@ -887,14 +881,14 @@ Tcl_SplitList(
&elSize, &literal);
length -= (list - prevList);
if (result != TCL_OK) {
- ckfree(argv);
+ Tcl_Free((void *)argv);
return result;
}
if (*element == 0) {
break;
}
if (i >= size) {
- ckfree(argv);
+ Tcl_Free((void *)argv);
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"internal error in Tcl_SplitList", -1));
@@ -941,11 +935,11 @@ Tcl_SplitList(
*----------------------------------------------------------------------
*/
-int
+size_t
Tcl_ScanElement(
- register const char *src, /* String to convert to list element. */
- register int *flagPtr) /* Where to store information to guide
- * Tcl_ConvertCountedElement. */
+ const char *src, /* String to convert to list element. */
+ int *flagPtr) /* Where to store information to guide
+ * Tcl_ConvertCountedElement. */
{
return Tcl_ScanCountedElement(src, -1, flagPtr);
}
@@ -973,10 +967,10 @@ Tcl_ScanElement(
*----------------------------------------------------------------------
*/
-int
+size_t
Tcl_ScanCountedElement(
const char *src, /* String to convert to Tcl list element. */
- int length, /* Number of bytes in src, or -1. */
+ size_t length, /* Number of bytes in src, or -1. */
int *flagPtr) /* Where to store information to guide
* Tcl_ConvertElement. */
{
@@ -1017,10 +1011,10 @@ Tcl_ScanCountedElement(
*----------------------------------------------------------------------
*/
-int
+size_t
TclScanElement(
const char *src, /* String to convert to Tcl list element. */
- int length, /* Number of bytes in src, or -1. */
+ size_t length, /* Number of bytes in src, or -1. */
char *flagPtr) /* Where to store information to guide
* Tcl_ConvertElement. */
{
@@ -1033,7 +1027,7 @@ TclScanElement(
int extra = 0; /* Count of number of extra bytes needed for
* formatted element, assuming we use escape
* sequences in formatting. */
- int bytesNeeded; /* Buffer length computed to complete the
+ size_t bytesNeeded; /* Buffer length computed to complete the
* element formatting in the selected mode. */
#if COMPAT
int preferEscape = 0; /* Use preferences to track whether to use */
@@ -1041,7 +1035,7 @@ TclScanElement(
int braceCount = 0; /* Count of all braces '{' '}' seen. */
#endif /* COMPAT */
- if ((p == NULL) || (length == 0) || ((*p == '\0') && (length == -1))) {
+ if ((p == NULL) || (length == 0) || ((*p == '\0') && (length == TCL_AUTO_LENGTH))) {
/*
* Empty string element must be brace quoted.
*/
@@ -1130,7 +1124,7 @@ TclScanElement(
break;
case '\\': /* TYPE_SUBS */
extra++; /* Escape '\' => '\\' */
- if ((length == 1) || ((length == -1) && (p[1] == '\0'))) {
+ if ((length == 1) || ((length == TCL_AUTO_LENGTH) && (p[1] == '\0'))) {
/*
* Final backslash. Cannot format with brace quoting.
*/
@@ -1161,14 +1155,14 @@ TclScanElement(
#endif /* COMPAT */
break;
case '\0': /* TYPE_SUBS */
- if (length == -1) {
+ if (length == TCL_AUTO_LENGTH) {
goto endOfString;
}
/* TODO: Panic on improper encoding? */
break;
}
}
- length -= (length > 0);
+ length -= (length+1 > 1);
p++;
}
@@ -1203,7 +1197,7 @@ TclScanElement(
bytesNeeded++;
}
*flagPtr = CONVERT_ESCAPE;
- goto overflowCheck;
+ return bytesNeeded;
}
if (*flagPtr & CONVERT_ANY) {
/*
@@ -1251,7 +1245,7 @@ TclScanElement(
bytesNeeded += braceCount;
}
*flagPtr = CONVERT_MASK;
- goto overflowCheck;
+ return bytesNeeded;
}
#endif /* COMPAT */
if (*flagPtr & TCL_DONT_USE_BRACES) {
@@ -1277,7 +1271,7 @@ TclScanElement(
bytesNeeded += 2;
}
*flagPtr = CONVERT_BRACE;
- goto overflowCheck;
+ return bytesNeeded;
}
/*
@@ -1292,11 +1286,6 @@ TclScanElement(
bytesNeeded += 2;
}
*flagPtr = CONVERT_NONE;
-
- overflowCheck:
- if (bytesNeeded < 0) {
- Tcl_Panic("TclScanElement: string length overflow");
- }
return bytesNeeded;
}
@@ -1321,11 +1310,11 @@ TclScanElement(
*----------------------------------------------------------------------
*/
-int
+size_t
Tcl_ConvertElement(
- register const char *src, /* Source information for list element. */
- register char *dst, /* Place to put list-ified element. */
- register int flags) /* Flags produced by Tcl_ScanElement. */
+ const char *src, /* Source information for list element. */
+ char *dst, /* Place to put list-ified element. */
+ int flags) /* Flags produced by Tcl_ScanElement. */
{
return Tcl_ConvertCountedElement(src, -1, dst, flags);
}
@@ -1351,14 +1340,14 @@ Tcl_ConvertElement(
*----------------------------------------------------------------------
*/
-int
+size_t
Tcl_ConvertCountedElement(
register const char *src, /* Source information for list element. */
- int length, /* Number of bytes in src, or -1. */
+ size_t length, /* Number of bytes in src, or -1. */
char *dst, /* Place to put list-ified element. */
int flags) /* Flags produced by Tcl_ScanElement. */
{
- int numBytes = TclConvertElement(src, length, dst, flags);
+ size_t numBytes = TclConvertElement(src, length, dst, flags);
dst[numBytes] = '\0';
return numBytes;
}
@@ -1384,10 +1373,10 @@ Tcl_ConvertCountedElement(
*----------------------------------------------------------------------
*/
-int
+size_t
TclConvertElement(
register const char *src, /* Source information for list element. */
- int length, /* Number of bytes in src, or -1. */
+ size_t length, /* Number of bytes in src, or -1. */
char *dst, /* Place to put list-ified element. */
int flags) /* Flags produced by Tcl_ScanElement. */
{
@@ -1406,7 +1395,7 @@ TclConvertElement(
* No matter what the caller demands, empty string must be braced!
*/
- if ((src == NULL) || (length == 0) || (*src == '\0' && length == -1)) {
+ if ((src == NULL) || (length == 0) || (*src == '\0' && length == TCL_AUTO_LENGTH)) {
p[0] = '{';
p[1] = '}';
return 2;
@@ -1422,7 +1411,7 @@ TclConvertElement(
p[1] = '#';
p += 2;
src++;
- length -= (length > 0);
+ length -= (length+1 > 1);
} else {
conversion = CONVERT_BRACE;
}
@@ -1433,7 +1422,7 @@ TclConvertElement(
*/
if (conversion == CONVERT_NONE) {
- if (length == -1) {
+ if (length == TCL_AUTO_LENGTH) {
/* TODO: INT_MAX overflow? */
while (*src) {
*p++ = *src++;
@@ -1452,7 +1441,7 @@ TclConvertElement(
if (conversion == CONVERT_BRACE) {
*p = '{';
p++;
- if (length == -1) {
+ if (length == TCL_AUTO_LENGTH) {
/* TODO: INT_MAX overflow? */
while (*src) {
*p++ = *src++;
@@ -1463,7 +1452,7 @@ TclConvertElement(
}
*p = '}';
p++;
- return p - dst;
+ return (size_t)(p - dst);
}
/* conversion == CONVERT_ESCAPE or CONVERT_MASK */
@@ -1472,7 +1461,7 @@ TclConvertElement(
* Formatted string is original string converted to escape sequences.
*/
- for ( ; length; src++, length -= (length > 0)) {
+ for ( ; length; src++, length -= (length+1 > 1)) {
switch (*src) {
case ']':
case '[':
@@ -1525,8 +1514,8 @@ TclConvertElement(
p++;
continue;
case '\0':
- if (length == -1) {
- return p - dst;
+ if (length == TCL_AUTO_LENGTH) {
+ return (size_t)(p - dst);
}
/*
@@ -1542,7 +1531,7 @@ TclConvertElement(
*p = *src;
p++;
}
- return p - dst;
+ return (size_t)(p - dst);
}
/*
@@ -1572,7 +1561,8 @@ Tcl_Merge(
{
#define LOCAL_SIZE 64
char localFlags[LOCAL_SIZE], *flagPtr = NULL;
- int i, bytesNeeded = 0;
+ int i;
+ size_t bytesNeeded = 0;
char *result, *dst;
/*
@@ -1581,7 +1571,7 @@ Tcl_Merge(
*/
if (argc == 0) {
- result = ckalloc(1);
+ result = Tcl_Alloc(1);
result[0] = '\0';
return result;
}
@@ -1593,17 +1583,11 @@ Tcl_Merge(
if (argc <= LOCAL_SIZE) {
flagPtr = localFlags;
} else {
- flagPtr = ckalloc(argc);
+ flagPtr = Tcl_Alloc(argc);
}
for (i = 0; i < argc; i++) {
flagPtr[i] = ( i ? TCL_DONT_QUOTE_HASH : 0 );
bytesNeeded += TclScanElement(argv[i], -1, &flagPtr[i]);
- if (bytesNeeded < 0) {
- Tcl_Panic("max size for a Tcl value (%d bytes) exceeded", INT_MAX);
- }
- }
- if (bytesNeeded > INT_MAX - argc + 1) {
- Tcl_Panic("max size for a Tcl value (%d bytes) exceeded", INT_MAX);
}
bytesNeeded += argc;
@@ -1611,7 +1595,7 @@ Tcl_Merge(
* Pass two: copy into the result area.
*/
- result = ckalloc(bytesNeeded);
+ result = Tcl_Alloc(bytesNeeded);
dst = result;
for (i = 0; i < argc; i++) {
flagPtr[i] |= ( i ? TCL_DONT_QUOTE_HASH : 0 );
@@ -1622,47 +1606,11 @@ Tcl_Merge(
dst[-1] = 0;
if (flagPtr != localFlags) {
- ckfree(flagPtr);
+ Tcl_Free(flagPtr);
}
return result;
}
-#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
-/*
- *----------------------------------------------------------------------
- *
- * Tcl_Backslash --
- *
- * Figure out how to handle a backslash sequence.
- *
- * Results:
- * The return value is the character that should be substituted in place
- * of the backslash sequence that starts at src. If readPtr isn't NULL
- * then it is filled in with a count of the number of characters in the
- * backslash sequence.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-char
-Tcl_Backslash(
- const char *src, /* Points to the backslash character of a
- * backslash sequence. */
- int *readPtr) /* Fill in with number of characters read from
- * src, unless NULL. */
-{
- char buf[4] = "";
- Tcl_UniChar ch = 0;
-
- Tcl_UtfBackslash(src, readPtr, buf);
- TclUtfToUniChar(buf, &ch);
- return (char) ch;
-}
-#endif /* !TCL_NO_DEPRECATED */
-
/*
*----------------------------------------------------------------------
*
@@ -1716,15 +1664,15 @@ UtfWellFormedEnd(
*----------------------------------------------------------------------
*/
-static inline int
+static inline size_t
TrimRight(
const char *bytes, /* String to be trimmed... */
- int numBytes, /* ...and its length in bytes */
+ size_t numBytes, /* ...and its length in bytes */
const char *trim, /* String of trim characters... */
- int numTrim) /* ...and its length in bytes */
+ size_t numTrim) /* ...and its length in bytes */
{
const char *p = bytes + numBytes;
- int pInc;
+ size_t pInc;
Tcl_UniChar ch1 = 0, ch2 = 0;
/*
@@ -1733,7 +1681,7 @@ TrimRight(
do {
const char *q = trim;
- int bytesLeft = numTrim;
+ size_t bytesLeft = numTrim;
p = Tcl_UtfPrev(p, bytes);
pInc = TclUtfToUniChar(p, &ch1);
@@ -1743,7 +1691,7 @@ TrimRight(
*/
do {
- int qInc = TclUtfToUniChar(q, &ch2);
+ size_t qInc = TclUtfToUniChar(q, &ch2);
if (ch1 == ch2) {
break;
@@ -1766,14 +1714,14 @@ TrimRight(
return numBytes - (p - bytes);
}
-int
+size_t
TclTrimRight(
const char *bytes, /* String to be trimmed... */
- int numBytes, /* ...and its length in bytes */
+ size_t numBytes, /* ...and its length in bytes */
const char *trim, /* String of trim characters... */
- int numTrim) /* ...and its length in bytes */
+ size_t numTrim) /* ...and its length in bytes */
{
- int res;
+ size_t res;
Tcl_DString bytesBuf, trimBuf;
/* Empty strings -> nothing to do */
@@ -1815,12 +1763,12 @@ TclTrimRight(
*----------------------------------------------------------------------
*/
-static inline int
+static inline size_t
TrimLeft(
const char *bytes, /* String to be trimmed... */
- int numBytes, /* ...and its length in bytes */
+ size_t numBytes, /* ...and its length in bytes */
const char *trim, /* String of trim characters... */
- int numTrim) /* ...and its length in bytes */
+ size_t numTrim) /* ...and its length in bytes */
{
const char *p = bytes;
Tcl_UniChar ch1 = 0, ch2 = 0;
@@ -1830,16 +1778,16 @@ TrimLeft(
*/
do {
- int pInc = TclUtfToUniChar(p, &ch1);
+ size_t pInc = TclUtfToUniChar(p, &ch1);
const char *q = trim;
- int bytesLeft = numTrim;
+ size_t bytesLeft = numTrim;
/*
* Inner loop: scan trim string for match to current character.
*/
do {
- int qInc = TclUtfToUniChar(q, &ch2);
+ size_t qInc = TclUtfToUniChar(q, &ch2);
if (ch1 == ch2) {
break;
@@ -1864,14 +1812,14 @@ TrimLeft(
return p - bytes;
}
-int
+size_t
TclTrimLeft(
const char *bytes, /* String to be trimmed... */
- int numBytes, /* ...and its length in bytes */
+ size_t numBytes, /* ...and its length in bytes */
const char *trim, /* String of trim characters... */
- int numTrim) /* ...and its length in bytes */
+ size_t numTrim) /* ...and its length in bytes */
{
- int res;
+ size_t res;
Tcl_DString bytesBuf, trimBuf;
/* Empty strings -> nothing to do */
@@ -1911,15 +1859,15 @@ TclTrimLeft(
*----------------------------------------------------------------------
*/
-int
+size_t
TclTrim(
const char *bytes, /* String to be trimmed... */
- int numBytes, /* ...and its length in bytes */
+ size_t numBytes, /* ...and its length in bytes */
const char *trim, /* String of trim characters... */
- int numTrim, /* ...and its length in bytes */
- int *trimRight) /* Offset from the end of the string. */
+ size_t numTrim, /* ...and its length in bytes */
+ size_t *trimRight) /* Offset from the end of the string. */
{
- int trimLeft;
+ size_t trimLeft;
Tcl_DString bytesBuf, trimBuf;
*trimRight = 0;
@@ -1973,14 +1921,15 @@ TclTrim(
*/
/* The whitespace characters trimmed during [concat] operations */
-#define CONCAT_WS_SIZE (int) (sizeof(CONCAT_TRIM_SET "") - 1)
+#define CONCAT_WS_SIZE (sizeof(CONCAT_TRIM_SET "") - 1)
char *
Tcl_Concat(
int argc, /* Number of strings to concatenate. */
const char *const *argv) /* Array of strings to concatenate. */
{
- int i, needSpace = 0, bytesNeeded = 0;
+ int i;
+ size_t needSpace = 0, bytesNeeded = 0;
char *result, *p;
/*
@@ -1988,7 +1937,7 @@ Tcl_Concat(
*/
if (argc == 0) {
- result = (char *) ckalloc(1);
+ result = (char *) Tcl_Alloc(1);
result[0] = '\0';
return result;
}
@@ -1999,27 +1948,16 @@ Tcl_Concat(
for (i = 0; i < argc; i++) {
bytesNeeded += strlen(argv[i]);
- if (bytesNeeded < 0) {
- Tcl_Panic("Tcl_Concat: max size of Tcl value exceeded");
- }
- }
- if (bytesNeeded + argc - 1 < 0) {
- /*
- * Panic test could be tighter, but not going to bother for this
- * legacy routine.
- */
-
- Tcl_Panic("Tcl_Concat: max size of Tcl value exceeded");
}
/*
* All element bytes + (argc - 1) spaces + 1 terminating NULL.
*/
- result = ckalloc(bytesNeeded + argc);
+ result = Tcl_Alloc(bytesNeeded + argc);
for (p = result, i = 0; i < argc; i++) {
- int triml, trimr, elemLength;
+ size_t triml, trimr, elemLength;
const char *element;
element = argv[i];
@@ -2080,7 +2018,8 @@ Tcl_ConcatObj(
int objc, /* Number of objects to concatenate. */
Tcl_Obj *const objv[]) /* Array of objects to concatenate. */
{
- int i, elemLength, needSpace = 0, bytesNeeded = 0;
+ int i, needSpace = 0;
+ size_t bytesNeeded = 0, elemLength;
const char *element;
Tcl_Obj *objPtr, *resPtr;
@@ -2091,13 +2030,13 @@ Tcl_ConcatObj(
*/
for (i = 0; i < objc; i++) {
- int length;
+ size_t length;
objPtr = objv[i];
if (TclListObjIsCanonical(objPtr)) {
continue;
}
- TclGetStringFromObj(objPtr, &length);
+ (void)TclGetStringFromObj(objPtr, &length);
if (length > 0) {
break;
}
@@ -2136,9 +2075,6 @@ Tcl_ConcatObj(
for (i = 0; i < objc; i++) {
element = TclGetStringFromObj(objv[i], &elemLength);
bytesNeeded += elemLength;
- if (bytesNeeded < 0) {
- break;
- }
}
/*
@@ -2152,7 +2088,7 @@ Tcl_ConcatObj(
Tcl_SetObjLength(resPtr, 0);
for (i = 0; i < objc; i++) {
- int triml, trimr;
+ size_t triml, trimr;
element = TclGetStringFromObj(objv[i], &elemLength);
@@ -2186,35 +2122,6 @@ Tcl_ConcatObj(
return resPtr;
}
-#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
-/*
- *----------------------------------------------------------------------
- *
- * Tcl_StringMatch --
- *
- * See if a particular string matches a particular pattern.
- *
- * Results:
- * The return value is 1 if string matches pattern, and 0 otherwise. The
- * matching operation permits the following special characters in the
- * pattern: *?\[] (see the manual entry for details on what these mean).
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-#undef Tcl_StringMatch
-int
-Tcl_StringMatch(
- const char *str, /* String. */
- const char *pattern) /* Pattern, which may contain special
- * characters. */
-{
- return Tcl_StringCaseMatch(str, pattern, 0);
-}
-#endif /* TCL_NO_DEPRECATED */
/*
*----------------------------------------------------------------------
*
@@ -2470,11 +2377,11 @@ Tcl_StringCaseMatch(
int
TclByteArrayMatch(
const unsigned char *string,/* String. */
- int strLen, /* Length of String */
+ size_t strLen, /* Length of String */
const unsigned char *pattern,
/* Pattern, which may contain special
* characters. */
- int ptnLen, /* Length of Pattern */
+ size_t ptnLen, /* Length of Pattern */
int flags)
{
const unsigned char *stringEnd, *patternEnd;
@@ -2651,7 +2558,8 @@ TclStringMatchObj(
int flags) /* Only TCL_MATCH_NOCASE should be passed, or
* 0. */
{
- int match, length, plen;
+ int match;
+ size_t length = 0, plen = 0;
/*
* Promote based on the type of incoming object.
@@ -2663,15 +2571,15 @@ TclStringMatchObj(
if (TclHasIntRep(strObj, &tclStringType) || (strObj->typePtr == NULL)) {
Tcl_UniChar *udata, *uptn;
- udata = Tcl_GetUnicodeFromObj(strObj, &length);
- uptn = Tcl_GetUnicodeFromObj(ptnObj, &plen);
+ udata = TclGetUnicodeFromObj(strObj, &length);
+ uptn = TclGetUnicodeFromObj(ptnObj, &plen);
match = TclUniCharMatch(udata, length, uptn, plen, flags);
} else if (TclIsPureByteArray(strObj) && TclIsPureByteArray(ptnObj)
&& !flags) {
unsigned char *data, *ptn;
- data = Tcl_GetByteArrayFromObj(strObj, &length);
- ptn = Tcl_GetByteArrayFromObj(ptnObj, &plen);
+ data = TclGetByteArrayFromObj(strObj, &length);
+ ptn = TclGetByteArrayFromObj(ptnObj, &plen);
match = TclByteArrayMatch(data, length, ptn, plen, 0);
} else {
match = Tcl_StringCaseMatch(TclGetString(strObj),
@@ -2729,15 +2637,15 @@ Tcl_DStringInit(
char *
Tcl_DStringAppend(
Tcl_DString *dsPtr, /* Structure describing dynamic string. */
- const char *bytes, /* String to append. If length is -1 then this
- * must be null-terminated. */
- int length) /* Number of bytes from "bytes" to append. If
- * < 0, then append all of bytes, up to null
+ const char *bytes, /* String to append. If length is
+ * TCL_AUTO_LENGTH then this must be null-terminated. */
+ size_t length) /* Number of bytes from "bytes" to append. If
+ * TCL_AUTO_LENGTH, then append all of bytes, up to null
* at end. */
{
- int newSize;
+ size_t newSize;
- if (length < 0) {
+ if (length == TCL_AUTO_LENGTH) {
length = strlen(bytes);
}
newSize = length + dsPtr->length;
@@ -2751,23 +2659,23 @@ Tcl_DStringAppend(
if (newSize >= dsPtr->spaceAvl) {
dsPtr->spaceAvl = newSize * 2;
if (dsPtr->string == dsPtr->staticSpace) {
- char *newString = ckalloc(dsPtr->spaceAvl);
+ char *newString = Tcl_Alloc(dsPtr->spaceAvl);
memcpy(newString, dsPtr->string, dsPtr->length);
dsPtr->string = newString;
} else {
- int offset = -1;
+ size_t index = TCL_INDEX_NONE;
/* See [16896d49fd] */
if (bytes >= dsPtr->string
&& bytes <= dsPtr->string + dsPtr->length) {
- offset = bytes - dsPtr->string;
+ index = bytes - dsPtr->string;
}
- dsPtr->string = ckrealloc(dsPtr->string, dsPtr->spaceAvl);
+ dsPtr->string = Tcl_Realloc(dsPtr->string, dsPtr->spaceAvl);
- if (offset >= 0) {
- bytes = dsPtr->string + offset;
+ if (index != TCL_INDEX_NONE) {
+ bytes = dsPtr->string + index;
}
}
}
@@ -2798,8 +2706,8 @@ TclDStringAppendObj(
Tcl_DString *dsPtr,
Tcl_Obj *objPtr)
{
- int length;
- char *bytes = TclGetStringFromObj(objPtr, &length);
+ size_t length;
+ const char *bytes = TclGetStringFromObj(objPtr, &length);
return Tcl_DStringAppend(dsPtr, bytes, length);
}
@@ -2840,7 +2748,7 @@ Tcl_DStringAppendElement(
char *dst = dsPtr->string + dsPtr->length;
int needSpace = TclNeedSpace(dsPtr->string, dst);
char flags = needSpace ? TCL_DONT_QUOTE_HASH : 0;
- int newSize = dsPtr->length + needSpace
+ size_t newSize = dsPtr->length + needSpace
+ TclScanElement(element, -1, &flags);
/*
@@ -2854,7 +2762,7 @@ Tcl_DStringAppendElement(
if (newSize >= dsPtr->spaceAvl) {
dsPtr->spaceAvl = newSize * 2;
if (dsPtr->string == dsPtr->staticSpace) {
- char *newString = ckalloc(dsPtr->spaceAvl);
+ char *newString = Tcl_Alloc(dsPtr->spaceAvl);
memcpy(newString, dsPtr->string, dsPtr->length);
dsPtr->string = newString;
@@ -2867,7 +2775,7 @@ Tcl_DStringAppendElement(
offset = element - dsPtr->string;
}
- dsPtr->string = ckrealloc(dsPtr->string, dsPtr->spaceAvl);
+ dsPtr->string = Tcl_Realloc(dsPtr->string, dsPtr->spaceAvl);
if (offset >= 0) {
element = dsPtr->string + offset;
@@ -2912,8 +2820,7 @@ Tcl_DStringAppendElement(
*
* Side effects:
* The length of dsPtr is changed to length and a null byte is stored at
- * that position in the string. If length is larger than the space
- * allocated for dsPtr, then a panic occurs.
+ * that position in the string.
*
*----------------------------------------------------------------------
*/
@@ -2921,13 +2828,10 @@ Tcl_DStringAppendElement(
void
Tcl_DStringSetLength(
Tcl_DString *dsPtr, /* Structure describing dynamic string. */
- int length) /* New length for dynamic string. */
+ size_t length) /* New length for dynamic string. */
{
- int newsize;
+ size_t newsize;
- if (length < 0) {
- length = 0;
- }
if (length >= dsPtr->spaceAvl) {
/*
* There are two interesting cases here. In the first case, the user
@@ -2948,12 +2852,12 @@ Tcl_DStringSetLength(
dsPtr->spaceAvl = length + 1;
}
if (dsPtr->string == dsPtr->staticSpace) {
- char *newString = ckalloc(dsPtr->spaceAvl);
+ char *newString = Tcl_Alloc(dsPtr->spaceAvl);
memcpy(newString, dsPtr->string, dsPtr->length);
dsPtr->string = newString;
} else {
- dsPtr->string = ckrealloc(dsPtr->string, dsPtr->spaceAvl);
+ dsPtr->string = Tcl_Realloc(dsPtr->string, dsPtr->spaceAvl);
}
}
dsPtr->length = length;
@@ -2983,7 +2887,7 @@ Tcl_DStringFree(
Tcl_DString *dsPtr) /* Structure describing dynamic string. */
{
if (dsPtr->string != dsPtr->staticSpace) {
- ckfree(dsPtr->string);
+ Tcl_Free(dsPtr->string);
}
dsPtr->string = dsPtr->staticSpace;
dsPtr->length = 0;
@@ -3045,86 +2949,12 @@ Tcl_DStringGetResult(
Tcl_DString *dsPtr) /* Dynamic string that is to become the result
* of interp. */
{
-#ifdef TCL_NO_DEPRECATED
Tcl_Obj *obj = Tcl_GetObjResult(interp);
- const char *bytes = TclGetString(obj);
+ char *bytes = TclGetString(obj);
Tcl_DStringFree(dsPtr);
Tcl_DStringAppend(dsPtr, bytes, obj->length);
Tcl_ResetResult(interp);
-#else
- Interp *iPtr = (Interp *) interp;
-
- if (dsPtr->string != dsPtr->staticSpace) {
- ckfree(dsPtr->string);
- }
-
- /*
- * Do more efficient transfer when we know the result is a Tcl_Obj. When
- * there's no string result, we only have to deal with two cases:
- *
- * 1. When the string rep is the empty string, when we don't copy but
- * instead use the staticSpace in the DString to hold an empty string.
-
- * 2. When the string rep is not there or there's a real string rep, when
- * we use Tcl_GetString to fetch (or generate) the string rep - which
- * we know to have been allocated with ckalloc() - and use it to
- * populate the DString space. Then, we free the internal rep. and set
- * the object's string representation back to the canonical empty
- * string.
- */
-
- if (!iPtr->result[0] && iPtr->objResultPtr
- && !Tcl_IsShared(iPtr->objResultPtr)) {
- if (iPtr->objResultPtr->bytes == &tclEmptyString) {
- dsPtr->string = dsPtr->staticSpace;
- dsPtr->string[0] = 0;
- dsPtr->length = 0;
- dsPtr->spaceAvl = TCL_DSTRING_STATIC_SIZE;
- } else {
- dsPtr->string = TclGetString(iPtr->objResultPtr);
- dsPtr->length = iPtr->objResultPtr->length;
- dsPtr->spaceAvl = dsPtr->length + 1;
- TclFreeIntRep(iPtr->objResultPtr);
- iPtr->objResultPtr->bytes = &tclEmptyString;
- iPtr->objResultPtr->length = 0;
- }
- return;
- }
-
- /*
- * If the string result is empty, move the object result to the string
- * result, then reset the object result.
- */
-
- (void) Tcl_GetStringResult(interp);
-
- dsPtr->length = strlen(iPtr->result);
- if (iPtr->freeProc != NULL) {
- if (iPtr->freeProc == TCL_DYNAMIC) {
- dsPtr->string = iPtr->result;
- dsPtr->spaceAvl = dsPtr->length+1;
- } else {
- dsPtr->string = ckalloc(dsPtr->length+1);
- memcpy(dsPtr->string, iPtr->result, dsPtr->length+1);
- iPtr->freeProc(iPtr->result);
- }
- dsPtr->spaceAvl = dsPtr->length+1;
- iPtr->freeProc = NULL;
- } else {
- if (dsPtr->length < TCL_DSTRING_STATIC_SIZE) {
- dsPtr->string = dsPtr->staticSpace;
- dsPtr->spaceAvl = TCL_DSTRING_STATIC_SIZE;
- } else {
- dsPtr->string = ckalloc(dsPtr->length+1);
- dsPtr->spaceAvl = dsPtr->length + 1;
- }
- memcpy(dsPtr->string, iPtr->result, dsPtr->length+1);
- }
-
- iPtr->result = iPtr->resultSpace;
- iPtr->resultSpace[0] = 0;
-#endif /* !TCL_NO_DEPRECATED */
}
/*
@@ -3250,10 +3080,9 @@ Tcl_DStringEndSublist(
* string using.
*
* Results:
- * The ASCII equivalent of "value" is written at "dst". It is written
- * using the current precision, and it is guaranteed to contain a decimal
- * point or exponent, so that it looks like a floating-point value and
- * not an integer.
+ * The ASCII equivalent of "value" is written at "dst". It is guaranteed
+ * to contain a decimal point or exponent, so that it looks like a
+ * floating-point value and not an integer.
*
* Side effects:
* None.
@@ -3263,9 +3092,7 @@ Tcl_DStringEndSublist(
void
Tcl_PrintDouble(
- Tcl_Interp *interp, /* Interpreter whose tcl_precision variable
- * used to be used to control printing. It's
- * ignored now. */
+ Tcl_Interp *interp, /* Not used */
double value, /* Value to print as string. */
char *dst) /* Where to store converted value; must have
* at least TCL_DOUBLE_SPACE characters. */
@@ -3275,7 +3102,6 @@ Tcl_PrintDouble(
int signum;
char *digits;
char *end;
- int *precisionPtr = Tcl_GetThreadData(&precisionKey, sizeof(int));
/*
* Handle NaN.
@@ -3307,53 +3133,8 @@ Tcl_PrintDouble(
* Ordinary (normal and denormal) values.
*/
- if (*precisionPtr == 0) {
- digits = TclDoubleDigits(value, -1, TCL_DD_SHORTEST,
- &exponent, &signum, &end);
- } else {
- /*
- * There are at least two possible interpretations for tcl_precision.
- *
- * The first is, "choose the decimal representation having
- * $tcl_precision digits of significance that is nearest to the given
- * number, breaking ties by rounding to even, and then trimming
- * trailing zeros." This gives the greatest possible precision in the
- * decimal string, but offers the anomaly that [expr 0.1] will be
- * "0.10000000000000001".
- *
- * The second is "choose the decimal representation having at most
- * $tcl_precision digits of significance that is nearest to the given
- * number. If no such representation converts exactly to the given
- * number, choose the one that is closest, breaking ties by rounding
- * to even. If more than one such representation converts exactly to
- * the given number, choose the shortest, breaking ties in favour of
- * the nearest, breaking remaining ties in favour of the one ending in
- * an even digit."
- *
- * Tcl 8.4 implements the first of these, which gives rise to
- * anomalies in formatting:
- *
- * % expr 0.1
- * 0.10000000000000001
- * % expr 0.01
- * 0.01
- * % expr 1e-7
- * 9.9999999999999995e-08
- *
- * For human readability, it appears better to choose the second rule,
- * and let [expr 0.1] return 0.1. But for 8.4 compatibility, we prefer
- * the first (the recommended zero value for tcl_precision avoids the
- * problem entirely).
- *
- * Uncomment TCL_DD_SHORTEN_FLAG in the next call to prefer the method
- * that allows floating point values to be shortened if it can be done
- * without loss of precision.
- */
-
- digits = TclDoubleDigits(value, *precisionPtr,
- TCL_DD_E_FORMAT /* | TCL_DD_SHORTEN_FLAG */,
- &exponent, &signum, &end);
- }
+ digits = TclDoubleDigits(value, -1, TCL_DD_SHORTEST,
+ &exponent, &signum, &end);
if (signum) {
*dst++ = '-';
}
@@ -3373,16 +3154,7 @@ Tcl_PrintDouble(
}
}
- /*
- * Tcl 8.4 appears to format with at least a two-digit exponent;
- * preserve that behaviour when tcl_precision != 0
- */
-
- if (*precisionPtr == 0) {
- sprintf(dst, "e%+d", exponent);
- } else {
- sprintf(dst, "e%+03d", exponent);
- }
+ sprintf(dst, "e%+d", exponent);
} else {
/*
* F format for others.
@@ -3414,92 +3186,12 @@ Tcl_PrintDouble(
}
*dst++ = '\0';
}
- ckfree(digits);
+ Tcl_Free(digits);
}
/*
*----------------------------------------------------------------------
*
- * TclPrecTraceProc --
- *
- * This function is invoked whenever the variable "tcl_precision" is
- * written.
- *
- * Results:
- * Returns NULL if all went well, or an error message if the new value
- * for the variable doesn't make sense.
- *
- * Side effects:
- * If the new value doesn't make sense then this function undoes the
- * effect of the variable modification. Otherwise it modifies the format
- * string that's used by Tcl_PrintDouble.
- *
- *----------------------------------------------------------------------
- */
-
-#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
- /* ARGSUSED */
-char *
-TclPrecTraceProc(
- ClientData clientData, /* Not used. */
- Tcl_Interp *interp, /* Interpreter containing variable. */
- const char *name1, /* Name of variable. */
- const char *name2, /* Second part of variable name. */
- int flags) /* Information about what happened. */
-{
- Tcl_Obj *value;
- Tcl_WideInt prec;
- int *precisionPtr = Tcl_GetThreadData(&precisionKey, sizeof(int));
-
- /*
- * If the variable is unset, then recreate the trace.
- */
-
- if (flags & TCL_TRACE_UNSETS) {
- if ((flags & TCL_TRACE_DESTROYED) && !Tcl_InterpDeleted(interp)) {
- Tcl_TraceVar2(interp, name1, name2,
- TCL_GLOBAL_ONLY|TCL_TRACE_READS|TCL_TRACE_WRITES
- |TCL_TRACE_UNSETS, TclPrecTraceProc, clientData);
- }
- return NULL;
- }
-
- /*
- * When the variable is read, reset its value from our shared value. This
- * is needed in case the variable was modified in some other interpreter
- * so that this interpreter's value is out of date.
- */
-
-
- if (flags & TCL_TRACE_READS) {
- Tcl_SetVar2Ex(interp, name1, name2, Tcl_NewWideIntObj(*precisionPtr),
- flags & TCL_GLOBAL_ONLY);
- return NULL;
- }
-
- /*
- * The variable is being written. Check the new value and disallow it if
- * it isn't reasonable or if this is a safe interpreter (we don't want
- * safe interpreters messing up the precision of other interpreters).
- */
-
- if (Tcl_IsSafe(interp)) {
- return (char *) "can't modify precision from a safe interpreter";
- }
- value = Tcl_GetVar2Ex(interp, name1, name2, flags & TCL_GLOBAL_ONLY);
- if (value == NULL
- || Tcl_GetWideIntFromObj(NULL, value, &prec) != TCL_OK
- || prec < 0 || prec > TCL_MAX_PREC) {
- return (char *) "improper value for precision";
- }
- *precisionPtr = (int)prec;
- return NULL;
-}
-#endif /* !TCL_NO_DEPRECATED)*/
-
-/*
- *----------------------------------------------------------------------
- *
* TclNeedSpace --
*
* This function checks to see whether it is appropriate to add a space
@@ -3609,15 +3301,14 @@ TclNeedSpace(
*----------------------------------------------------------------------
*/
-int
+size_t
TclFormatInt(
char *buffer, /* Points to the storage into which the
* formatted characters are written. */
Tcl_WideInt n) /* The integer to format. */
{
- Tcl_WideInt intVal;
- int i;
- int numFormatted, j;
+ Tcl_WideInt intVal;
+ size_t i, numFormatted, j;
const char *digits = "0123456789";
/*
@@ -3701,11 +3392,11 @@ TclFormatInt(
static int
GetWideForIndex(
Tcl_Interp *interp, /* Interpreter to use for error reporting. If
- * NULL, then no error message is left after
- * errors. */
+ * NULL, then no error message is left after
+ * errors. */
Tcl_Obj *objPtr, /* Points to the value to be parsed */
size_t endValue, /* The value to be stored at *widePtr if
- * objPtr holds "end".
+ * objPtr holds "end".
* NOTE: this value may be TCL_INDEX_NONE. */
Tcl_WideInt *widePtr) /* Location filled in with a wide integer
* representing an index. */
@@ -3863,7 +3554,6 @@ GetWideForIndex(
if (!strncmp(bytes, "end-", 4)) {
bytes += 4;
}
- TclCheckBadOctal(interp, bytes);
Tcl_SetErrorCode(interp, "TCL", "VALUE", "INDEX", NULL);
}
return TCL_ERROR;
@@ -3874,21 +3564,26 @@ GetWideForIndex(
*
* Tcl_GetIntForIndex --
*
- * This function returns an integer corresponding to the list index held
- * in a Tcl object. The Tcl object's value is expected to be in the
- * format integer([+-]integer)? or the format end([+-]integer)?.
+ * Provides an integer corresponding to the list index held in a Tcl
+ * object. The string value 'objPtr' is expected have the format
+ * integer([+-]integer)? or end([+-]integer)?.
*
- * Results:
- * The return value is normally TCL_OK, which means that the index was
- * successfully stored into the location referenced by "indexPtr". If the
- * Tcl object referenced by "objPtr" has the value "end", the value
- * stored is "endValue". If "objPtr"s values is not of one of the
- * expected formats, TCL_ERROR is returned and, if "interp" is non-NULL,
- * an error message is left in the interpreter's result object.
+ * Value
+ * TCL_OK
*
- * Side effects:
- * The object referenced by "objPtr" might be converted to an integer,
- * wide integer, or end-based-index object.
+ * The index is stored at the address given by by 'indexPtr'. If
+ * 'objPtr' has the value "end", the value stored is 'endValue'.
+ *
+ * TCL_ERROR
+ *
+ * The value of 'objPtr' does not have one of the expected formats. If
+ * 'interp' is non-NULL, an error message is left in the interpreter's
+ * result object.
+ *
+ * Effect
+ *
+ * The object referenced by 'objPtr' is converted, as needed, to an
+ * integer, wide integer, or end-based-index object.
*
*----------------------------------------------------------------------
*/
@@ -3900,22 +3595,24 @@ Tcl_GetIntForIndex(
* errors. */
Tcl_Obj *objPtr, /* Points to an object containing either "end"
* or an integer. */
- int endValue, /* The value to be stored at "indexPtr" if
+ size_t endValue, /* The value to be stored at "indexPtr" if
* "objPtr" holds "end". */
- int *indexPtr) /* Location filled in with an integer
+ size_t *indexPtr) /* Location filled in with an integer
* representing an index. */
{
Tcl_WideInt wide;
+ /* Use platform-related size_t to wide-int to consider negative value
+ * TCL_INDEX_NONE if wide-int and size_t have different dimensions. */
if (GetWideForIndex(interp, objPtr, endValue, &wide) == TCL_ERROR) {
return TCL_ERROR;
}
if (wide < 0) {
- *indexPtr = -1;
- } else if (wide > INT_MAX) {
- *indexPtr = INT_MAX;
+ *indexPtr = TCL_INDEX_NONE;
+ } else if ((Tcl_WideUInt)wide > TCL_INDEX_END) {
+ *indexPtr = TCL_INDEX_END;
} else {
- *indexPtr = (int) wide;
+ *indexPtr = (size_t) wide;
}
return TCL_OK;
}
@@ -3949,7 +3646,7 @@ GetEndOffsetFromObj(
while ((irPtr = TclFetchIntRep(objPtr, &endOffsetType)) == NULL) {
Tcl_ObjIntRep ir;
- int length;
+ size_t length;
const char *bytes = TclGetStringFromObj(objPtr, &length);
if ((length < 3) || (length == 4)) {
@@ -4009,7 +3706,7 @@ GetEndOffsetFromObj(
offset = irPtr->wideValue;
- if (endValue == (size_t)-1) {
+ if (endValue == TCL_INDEX_NONE) {
*widePtr = offset - 1;
} else if (offset < 0) {
/* Different signs, sum cannot overflow */
@@ -4081,8 +3778,8 @@ int
TclIndexEncode(
Tcl_Interp *interp, /* For error reporting, may be NULL */
Tcl_Obj *objPtr, /* Index value to parse */
- int before, /* Value to return for index before beginning */
- int after, /* Value to return for index after end */
+ size_t before, /* Value to return for index before beginning */
+ size_t after, /* Value to return for index after end */
int *indexPtr) /* Where to write the encoded answer, not NULL */
{
ClientData cd;
@@ -4093,7 +3790,7 @@ TclIndexEncode(
/* We parsed a value in the range WIDE_MIN...WIDE_MAX */
wide = (*(Tcl_WideInt *)cd);
integerEncode:
- if (wide < TCL_INDEX_START) {
+ if (wide < 0) {
/* All negative absolute indices are "before the beginning" */
idx = before;
} else if (wide >= INT_MAX) {
@@ -4110,16 +3807,16 @@ TclIndexEncode(
*/
if (wide > 0) {
/*
- * All end+postive or end-negative expressions
+ * All end+positive or end-negative expressions
* always indicate "after the end".
*/
- idx = after;
- } else if (wide < INT_MIN - TCL_INDEX_END) {
+ idx = (int) after;
+ } else if (wide < INT_MIN - (int) TCL_INDEX_END) {
/* These indices always indicate "before the beginning */
- idx = before;
+ idx = (int) before;
} else {
/* Encoded end-positive (or end+negative) are offset */
- idx = (int)wide + TCL_INDEX_END;
+ idx = (int) wide + (int) TCL_INDEX_END;
}
/* TODO: Consider flag to suppress repeated end-offset parse. */
@@ -4153,17 +3850,16 @@ TclIndexEncode(
*----------------------------------------------------------------------
*/
-int
+size_t
TclIndexDecode(
int encoded, /* Value to decode */
- int endValue) /* Meaning of "end" to use, > TCL_INDEX_END */
+ size_t endValue) /* Meaning of "end" to use, > TCL_INDEX_END */
{
- if (encoded > TCL_INDEX_END) {
+ if (encoded > (int)TCL_INDEX_END) {
return encoded;
}
- endValue += encoded - TCL_INDEX_END;
- if (endValue >= 0) {
- return endValue;
+ if (endValue >= TCL_INDEX_END - encoded) {
+ return endValue + encoded - TCL_INDEX_END;
}
return TCL_INDEX_NONE;
}
@@ -4171,73 +3867,6 @@ TclIndexDecode(
/*
*----------------------------------------------------------------------
*
- * TclCheckBadOctal --
- *
- * This function checks for a bad octal value and appends a meaningful
- * error to the interp's result.
- *
- * Results:
- * 1 if the argument was a bad octal, else 0.
- *
- * Side effects:
- * The interpreter's result is modified.
- *
- *----------------------------------------------------------------------
- */
-
-int
-TclCheckBadOctal(
- Tcl_Interp *interp, /* Interpreter to use for error reporting. If
- * NULL, then no error message is left after
- * errors. */
- const char *value) /* String to check. */
-{
- register const char *p = value;
-
- /*
- * A frequent mistake is invalid octal values due to an unwanted leading
- * zero. Try to generate a meaningful error message.
- */
-
- while (TclIsSpaceProc(*p)) {
- p++;
- }
- if (*p == '+' || *p == '-') {
- p++;
- }
- if (*p == '0') {
- if ((p[1] == 'o') || p[1] == 'O') {
- p += 2;
- }
- while (isdigit(UCHAR(*p))) { /* INTL: digit. */
- p++;
- }
- while (TclIsSpaceProc(*p)) {
- p++;
- }
- if (*p == '\0') {
- /*
- * Reached end of string.
- */
-
- if (interp != NULL) {
- /*
- * Don't reset the result here because we want this result to
- * be added to an existing error message as extra info.
- */
-
- Tcl_AppendToObj(Tcl_GetObjResult(interp),
- " (looks like invalid octal number)", -1);
- }
- return 1;
- }
- }
- return 0;
-}
-
-/*
- *----------------------------------------------------------------------
- *
* ClearHash --
*
* Remove all the entries in the hash table *tablePtr.
@@ -4287,7 +3916,7 @@ GetThreadHash(
Tcl_GetThreadData(keyPtr, sizeof(Tcl_HashTable *));
if (NULL == *tablePtrPtr) {
- *tablePtrPtr = ckalloc(sizeof(Tcl_HashTable));
+ *tablePtrPtr = Tcl_Alloc(sizeof(Tcl_HashTable));
Tcl_CreateThreadExitHandler(FreeThreadHash, *tablePtrPtr);
Tcl_InitHashTable(*tablePtrPtr, TCL_ONE_WORD_KEYS);
}
@@ -4316,7 +3945,7 @@ FreeThreadHash(
ClearHash(tablePtr);
Tcl_DeleteHashTable(tablePtr);
- ckfree(tablePtr);
+ Tcl_Free(tablePtr);
}
/*
@@ -4338,7 +3967,7 @@ FreeProcessGlobalValue(
pgvPtr->epoch++;
pgvPtr->numBytes = 0;
- ckfree(pgvPtr->value);
+ Tcl_Free(pgvPtr->value);
pgvPtr->value = NULL;
if (pgvPtr->encoding) {
Tcl_FreeEncoding(pgvPtr->encoding);
@@ -4377,13 +4006,13 @@ TclSetProcessGlobalValue(
pgvPtr->epoch++;
if (NULL != pgvPtr->value) {
- ckfree(pgvPtr->value);
+ Tcl_Free(pgvPtr->value);
} else {
Tcl_CreateExitHandler(FreeProcessGlobalValue, pgvPtr);
}
bytes = TclGetString(newValue);
pgvPtr->numBytes = newValue->length;
- pgvPtr->value = ckalloc(pgvPtr->numBytes + 1);
+ pgvPtr->value = Tcl_Alloc(pgvPtr->numBytes + 1);
memcpy(pgvPtr->value, bytes, pgvPtr->numBytes + 1);
if (pgvPtr->encoding) {
Tcl_FreeEncoding(pgvPtr->encoding);
@@ -4399,7 +4028,7 @@ TclSetProcessGlobalValue(
Tcl_IncrRefCount(newValue);
cacheMap = GetThreadHash(&pgvPtr->key);
ClearHash(cacheMap);
- hPtr = Tcl_CreateHashEntry(cacheMap, (void *)(size_t)(pgvPtr->epoch), &dummy);
+ hPtr = Tcl_CreateHashEntry(cacheMap, (void *)(pgvPtr->epoch), &dummy);
Tcl_SetHashValue(hPtr, newValue);
Tcl_MutexUnlock(&pgvPtr->mutex);
}
@@ -4425,7 +4054,7 @@ TclGetProcessGlobalValue(
Tcl_Obj *value = NULL;
Tcl_HashTable *cacheMap;
Tcl_HashEntry *hPtr;
- unsigned int epoch = pgvPtr->epoch;
+ size_t epoch = pgvPtr->epoch;
if (pgvPtr->encoding) {
Tcl_Encoding current = Tcl_GetEncoding(NULL, NULL);
@@ -4446,8 +4075,8 @@ TclGetProcessGlobalValue(
Tcl_ExternalToUtfDString(current, Tcl_DStringValue(&native),
Tcl_DStringLength(&native), &newValue);
Tcl_DStringFree(&native);
- ckfree(pgvPtr->value);
- pgvPtr->value = ckalloc(Tcl_DStringLength(&newValue) + 1);
+ Tcl_Free(pgvPtr->value);
+ pgvPtr->value = Tcl_Alloc(Tcl_DStringLength(&newValue) + 1);
memcpy(pgvPtr->value, Tcl_DStringValue(&newValue),
Tcl_DStringLength(&newValue) + 1);
Tcl_DStringFree(&newValue);
@@ -4459,7 +4088,7 @@ TclGetProcessGlobalValue(
}
}
cacheMap = GetThreadHash(&pgvPtr->key);
- hPtr = Tcl_FindHashEntry(cacheMap, (void *)(size_t)epoch);
+ hPtr = Tcl_FindHashEntry(cacheMap, (void *) (epoch));
if (NULL == hPtr) {
int dummy;
@@ -4492,7 +4121,7 @@ TclGetProcessGlobalValue(
value = Tcl_NewStringObj(pgvPtr->value, pgvPtr->numBytes);
hPtr = Tcl_CreateHashEntry(cacheMap,
- (void *)(size_t)(pgvPtr->epoch), &dummy);
+ (void *)(pgvPtr->epoch), &dummy);
Tcl_MutexUnlock(&pgvPtr->mutex);
Tcl_SetHashValue(hPtr, value);
Tcl_IncrRefCount(value);
@@ -4587,31 +4216,6 @@ Tcl_GetNameOfExecutable(void)
/*
*----------------------------------------------------------------------
*
- * TclpGetTime --
- *
- * Deprecated synonym for Tcl_GetTime. This function is provided for the
- * benefit of extensions written before Tcl_GetTime was exported from the
- * library.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Stores current time in the buffer designated by "timePtr"
- *
- *----------------------------------------------------------------------
- */
-
-void
-TclpGetTime(
- Tcl_Time *timePtr)
-{
- Tcl_GetTime(timePtr);
-}
-
-/*
- *----------------------------------------------------------------------
- *
* TclGetPlatform --
*
* This is a kludge that allows the test library to get access the
@@ -4656,7 +4260,7 @@ int
TclReToGlob(
Tcl_Interp *interp,
const char *reStr,
- int reStrLen,
+ size_t reStrLen,
Tcl_DString *dsPtr,
int *exactPtr,
int *quantifiersFoundPtr)
diff --git a/generic/tclVar.c b/generic/tclVar.c
index e8ebd3c..f0c4b79c 100644
--- a/generic/tclVar.c
+++ b/generic/tclVar.c
@@ -343,7 +343,7 @@ NotArrayError(
Tcl_Interp *interp,
Tcl_Obj *name)
{
- const char *nameStr = Tcl_GetString(name);
+ const char *nameStr = TclGetString(name);
Tcl_SetObjResult(interp,
Tcl_ObjPrintf("\"%s\" isn't an array", nameStr));
@@ -385,7 +385,7 @@ CleanupVar(
&& (VarHashRefCount(varPtr) == (unsigned)
!TclIsVarDeadHash(varPtr))) {
if (VarHashRefCount(varPtr) == 0) {
- ckfree(varPtr);
+ Tcl_Free(varPtr);
} else {
VarHashDeleteEntry(varPtr);
}
@@ -395,7 +395,7 @@ CleanupVar(
(VarHashRefCount(arrayPtr) == (unsigned)
!TclIsVarDeadHash(arrayPtr))) {
if (VarHashRefCount(arrayPtr) == 0) {
- ckfree(arrayPtr);
+ Tcl_Free(arrayPtr);
} else {
VarHashDeleteEntry(arrayPtr);
}
@@ -665,7 +665,7 @@ TclObjLookupVarEx(
* part1Ptr is possibly an unparsed array element.
*/
- int len;
+ size_t len;
const char *part1 = TclGetStringFromObj(part1Ptr, &len);
if ((len > 1) && (part1[len - 1] == ')')) {
@@ -847,7 +847,8 @@ TclLookupSimpleVar(
* the variable. */
Namespace *varNsPtr, *cxtNsPtr, *dummy1Ptr, *dummy2Ptr;
ResolverScheme *resPtr;
- int isNew, i, result, varLen;
+ int isNew, i, result;
+ size_t varLen;
const char *varName = TclGetStringFromObj(varNamePtr, &varLen);
varPtr = NULL;
@@ -920,12 +921,8 @@ TclLookupSimpleVar(
*indexPtr = -1;
flags = (flags | TCL_GLOBAL_ONLY) & ~TCL_NAMESPACE_ONLY;
} else {
- if (flags & TCL_AVOID_RESOLVERS) {
- flags = (flags | TCL_NAMESPACE_ONLY);
- }
- if (flags & TCL_NAMESPACE_ONLY) {
- *indexPtr = -2;
- }
+ flags = (flags | TCL_NAMESPACE_ONLY);
+ *indexPtr = -2;
}
/*
@@ -981,7 +978,7 @@ TclLookupSimpleVar(
if (localCt > 0) {
Tcl_Obj **objPtrPtr = &varFramePtr->localCachePtr->varName0;
const char *localNameStr;
- int localLen;
+ size_t localLen;
for (i=0 ; i<localCt ; i++, objPtrPtr++) {
register Tcl_Obj *objPtr = *objPtrPtr;
@@ -1000,7 +997,7 @@ TclLookupSimpleVar(
tablePtr = varFramePtr->varTablePtr;
if (create) {
if (tablePtr == NULL) {
- tablePtr = ckalloc(sizeof(TclVarHashTable));
+ tablePtr = Tcl_Alloc(sizeof(TclVarHashTable));
TclInitVarHashTable(tablePtr, NULL);
varFramePtr->varTablePtr = tablePtr;
}
@@ -1148,51 +1145,6 @@ TclLookupArrayElement(
/*
*----------------------------------------------------------------------
*
- * Tcl_GetVar --
- *
- * Return the value of a Tcl variable as a string.
- *
- * Results:
- * The return value points to the current value of varName as a string.
- * If the variable is not defined or can't be read because of a clash in
- * array usage then a NULL pointer is returned and an error message is
- * left in the interp's result if the TCL_LEAVE_ERR_MSG flag is set.
- * Note: the return value is only valid up until the next change to the
- * variable; if you depend on the value lasting longer than that, then
- * make yourself a private copy.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-#ifndef TCL_NO_DEPRECATED
-#undef Tcl_GetVar
-const char *
-Tcl_GetVar(
- Tcl_Interp *interp, /* Command interpreter in which varName is to
- * be looked up. */
- const char *varName, /* Name of a variable in interp. */
- int flags) /* OR-ed combination of TCL_GLOBAL_ONLY,
- * TCL_NAMESPACE_ONLY or TCL_LEAVE_ERR_MSG
- * bits. */
-{
- Tcl_Obj *varNamePtr = Tcl_NewStringObj(varName, -1);
- Tcl_Obj *resultPtr = Tcl_ObjGetVar2(interp, varNamePtr, NULL, flags);
-
- TclDecrRefCount(varNamePtr);
-
- if (resultPtr == NULL) {
- return NULL;
- }
- return TclGetString(resultPtr);
-}
-#endif /* TCL_NO_DEPRECATED */
-
-/*
- *----------------------------------------------------------------------
- *
* Tcl_GetVar2 --
*
* Return the value of a Tcl variable as a string, given a two-part name
@@ -1559,53 +1511,6 @@ Tcl_SetObjCmd(
/*
*----------------------------------------------------------------------
*
- * Tcl_SetVar --
- *
- * Change the value of a variable.
- *
- * Results:
- * Returns a pointer to the malloc'ed string which is the character
- * representation of the variable's new value. The caller must not modify
- * this string. If the write operation was disallowed then NULL is
- * returned; if the TCL_LEAVE_ERR_MSG flag is set, then an explanatory
- * message will be left in the interp's result. Note that the returned
- * string may not be the same as newValue; this is because variable
- * traces may modify the variable's value.
- *
- * Side effects:
- * If varName is defined as a local or global variable in interp, its
- * value is changed to newValue. If varName isn't currently defined, then
- * a new global variable by that name is created.
- *
- *----------------------------------------------------------------------
- */
-
-#ifndef TCL_NO_DEPRECATED
-#undef Tcl_SetVar
-const char *
-Tcl_SetVar(
- Tcl_Interp *interp, /* Command interpreter in which varName is to
- * be looked up. */
- const char *varName, /* Name of a variable in interp. */
- const char *newValue, /* New value for varName. */
- int flags) /* Various flags that tell how to set value:
- * any of TCL_GLOBAL_ONLY, TCL_NAMESPACE_ONLY,
- * TCL_APPEND_VALUE, TCL_LIST_ELEMENT,
- * TCL_LEAVE_ERR_MSG. */
-{
- Tcl_Obj *varValuePtr = Tcl_SetVar2Ex(interp, varName, NULL,
- Tcl_NewStringObj(newValue, -1), flags);
-
- if (varValuePtr == NULL) {
- return NULL;
- }
- return TclGetString(varValuePtr);
-}
-#endif /* TCL_NO_DEPRECATED */
-
-/*
- *----------------------------------------------------------------------
- *
* Tcl_SetVar2 --
*
* Given a two-part variable name, which may refer either to a scalar
@@ -2358,57 +2263,6 @@ TclPtrIncrObjVarIdx(
/*
*----------------------------------------------------------------------
*
- * Tcl_UnsetVar --
- *
- * Delete a variable, so that it may not be accessed anymore.
- *
- * Results:
- * Returns TCL_OK if the variable was successfully deleted, TCL_ERROR if
- * the variable can't be unset. In the event of an error, if the
- * TCL_LEAVE_ERR_MSG flag is set then an error message is left in the
- * interp's result.
- *
- * Side effects:
- * If varName is defined as a local or global variable in interp, it is
- * deleted.
- *
- *----------------------------------------------------------------------
- */
-
-#ifndef TCL_NO_DEPRECATED
-#undef Tcl_UnsetVar
-int
-Tcl_UnsetVar(
- Tcl_Interp *interp, /* Command interpreter in which varName is to
- * be looked up. */
- const char *varName, /* Name of a variable in interp. May be either
- * a scalar name or an array name or an
- * element in an array. */
- int flags) /* OR-ed combination of any of
- * TCL_GLOBAL_ONLY, TCL_NAMESPACE_ONLY or
- * TCL_LEAVE_ERR_MSG. */
-{
- int result;
- Tcl_Obj *varNamePtr;
-
- varNamePtr = Tcl_NewStringObj(varName, -1);
- Tcl_IncrRefCount(varNamePtr);
-
- /*
- * Filter to pass through only the flags this interface supports.
- */
-
- flags &= (TCL_GLOBAL_ONLY|TCL_NAMESPACE_ONLY|TCL_LEAVE_ERR_MSG);
- result = TclObjUnsetVar2(interp, varNamePtr, NULL, flags);
-
- Tcl_DecrRefCount(varNamePtr);
- return result;
-}
-#endif /* TCL_NO_DEPRECATED */
-
-/*
- *----------------------------------------------------------------------
- *
* Tcl_UnsetVar2 --
*
* Delete a variable, given a 2-part name.
@@ -3221,7 +3075,7 @@ ArrayForNRCmd(
* Make a new array search, put it on the stack.
*/
- searchPtr = ckalloc(sizeof(ArraySearch));
+ searchPtr = Tcl_Alloc(sizeof(ArraySearch));
ArrayPopulateSearch(interp, arrayNameObj, varPtr, searchPtr);
/*
@@ -3342,7 +3196,7 @@ ArrayForLoopCallback(
ArrayDoneSearch(iPtr, varPtr, searchPtr);
Tcl_DecrRefCount(searchPtr->name);
- ckfree(searchPtr);
+ Tcl_Free(searchPtr);
}
TclDecrRefCount(varListObj);
@@ -3430,7 +3284,7 @@ ArrayStartSearchCmd(
* Make a new array search with a free name.
*/
- searchPtr = ckalloc(sizeof(ArraySearch));
+ searchPtr = Tcl_Alloc(sizeof(ArraySearch));
ArrayPopulateSearch(interp, objv[1], varPtr, searchPtr);
Tcl_SetObjResult(interp, searchPtr->name);
return TCL_OK;
@@ -3697,7 +3551,7 @@ ArrayDoneSearchCmd(
ArrayDoneSearch(iPtr, varPtr, searchPtr);
Tcl_DecrRefCount(searchPtr->name);
- ckfree(searchPtr);
+ Tcl_Free(searchPtr);
return TCL_OK;
}
@@ -4357,7 +4211,7 @@ ArrayStatsCmd(
return TCL_ERROR;
}
Tcl_SetObjResult(interp, Tcl_NewStringObj(stats, -1));
- ckfree(stats);
+ Tcl_Free(stats);
return TCL_OK;
}
@@ -4817,63 +4671,6 @@ TclPtrObjMakeUpvarIdx(
/*
*----------------------------------------------------------------------
*
- * Tcl_UpVar --
- *
- * This function links one variable to another, just like the "upvar"
- * command.
- *
- * Results:
- * A standard Tcl completion code. If an error occurs then an error
- * message is left in the interp's result.
- *
- * Side effects:
- * The variable in frameName whose name is given by varName becomes
- * accessible under the name localNameStr, so that references to
- * localNameStr are redirected to the other variable like a symbolic
- * link.
- *
- *----------------------------------------------------------------------
- */
-
-#ifndef TCL_NO_DEPRECATED
-#undef Tcl_UpVar
-int
-Tcl_UpVar(
- Tcl_Interp *interp, /* Command interpreter in which varName is to
- * be looked up. */
- const char *frameName, /* Name of the frame containing the source
- * variable, such as "1" or "#0". */
- const char *varName, /* Name of a variable in interp to link to.
- * May be either a scalar name or an element
- * in an array. */
- const char *localNameStr, /* Name of link variable. */
- int flags) /* 0, TCL_GLOBAL_ONLY or TCL_NAMESPACE_ONLY:
- * indicates scope of localNameStr. */
-{
- int result;
- CallFrame *framePtr;
- Tcl_Obj *varNamePtr, *localNamePtr;
-
- if (TclGetFrame(interp, frameName, &framePtr) == -1) {
- return TCL_ERROR;
- }
-
- varNamePtr = Tcl_NewStringObj(varName, -1);
- Tcl_IncrRefCount(varNamePtr);
- localNamePtr = Tcl_NewStringObj(localNameStr, -1);
- Tcl_IncrRefCount(localNamePtr);
-
- result = ObjMakeUpvar(interp, framePtr, varNamePtr, NULL, 0,
- localNamePtr, flags, -1);
- Tcl_DecrRefCount(varNamePtr);
- Tcl_DecrRefCount(localNamePtr);
- return result;
-}
-#endif /* TCL_NO_DEPRECATED */
-
-/*
- *----------------------------------------------------------------------
- *
* Tcl_UpVar2 --
*
* This function links one variable to another, just like the "upvar"
@@ -5422,7 +5219,7 @@ DeleteSearches(
searchPtr = nextPtr) {
nextPtr = searchPtr->nextPtr;
Tcl_DecrRefCount(searchPtr->name);
- ckfree(searchPtr);
+ Tcl_Free(searchPtr);
}
arrayVarPtr->flags &= ~VAR_SEARCH_ACTIVE;
Tcl_DeleteHashEntry(sPtr);
@@ -5998,6 +5795,10 @@ ObjFindNamespaceVar(
* Find the namespace(s) that contain the variable.
*/
+ if (!(flags & TCL_GLOBAL_ONLY)) {
+ flags |= TCL_NAMESPACE_ONLY;
+ }
+
TclGetNamespaceForQualName(interp, name, (Namespace *) contextNsPtr,
flags, &nsPtr[0], &nsPtr[1], &cxtNsPtr, &simpleName);
@@ -6558,11 +6359,11 @@ AllocVarEntry(
Tcl_HashTable *tablePtr, /* Hash table. */
void *keyPtr) /* Key to store in the hash table entry. */
{
- Tcl_Obj *objPtr = keyPtr;
+ Tcl_Obj *objPtr = (Tcl_Obj *)keyPtr;
Tcl_HashEntry *hPtr;
Var *varPtr;
- varPtr = ckalloc(sizeof(VarInHash));
+ varPtr = Tcl_Alloc(sizeof(VarInHash));
varPtr->flags = VAR_IN_HASHTABLE;
varPtr->value.objPtr = NULL;
VarHashRefCount(varPtr) = 1;
@@ -6584,7 +6385,7 @@ FreeVarEntry(
if (TclIsVarUndefined(varPtr) && !TclIsVarTraced(varPtr)
&& (VarHashRefCount(varPtr) == 1)) {
- ckfree(varPtr);
+ Tcl_Free(varPtr);
} else {
VarHashInvalidateEntry(varPtr);
TclSetVarUndefined(varPtr);
@@ -6595,13 +6396,13 @@ FreeVarEntry(
static int
CompareVarKeys(
- void *keyPtr, /* New key to compare. */
+ void *keyPtr, /* New key to compare. */
Tcl_HashEntry *hPtr) /* Existing key to compare. */
{
- Tcl_Obj *objPtr1 = keyPtr;
+ Tcl_Obj *objPtr1 = (Tcl_Obj *)keyPtr;
Tcl_Obj *objPtr2 = hPtr->key.objPtr;
register const char *p1, *p2;
- register int l1, l2;
+ register size_t l1, l2;
/*
* If the object pointers are the same then they match.
@@ -6792,7 +6593,7 @@ void
TclInitArrayVar(
Var *arrayPtr)
{
- ArrayVarHashTable *tablePtr = ckalloc(sizeof(ArrayVarHashTable));
+ ArrayVarHashTable *tablePtr = Tcl_Alloc(sizeof(ArrayVarHashTable));
/*
* Mark the variable as an array.
@@ -6836,7 +6637,7 @@ DeleteArrayVar(
*/
VarHashDeleteTable(arrayPtr->value.tablePtr);
- ckfree(tablePtr);
+ Tcl_Free(tablePtr);
}
/*
diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c
index 6a568fe..99f078c 100644
--- a/generic/tclZipfs.c
+++ b/generic/tclZipfs.c
@@ -458,12 +458,6 @@ static Tcl_ChannelType ZipChannelType = {
NULL, /* Thread action function, NULL'able */
NULL, /* Truncate function, NULL'able */
};
-
-/*
- * Miscellaneous constants.
- */
-
-#define ERROR_LENGTH ((size_t) -1)
/*
*-------------------------------------------------------------------------
@@ -910,12 +904,12 @@ ZipFSCloseArchive(
ZipFile *zf)
{
if (zf->nameLength) {
- ckfree(zf->name);
+ Tcl_Free(zf->name);
}
if (zf->isMemBuffer) {
/* Pointer to memory */
if (zf->ptrToFree) {
- ckfree(zf->ptrToFree);
+ Tcl_Free(zf->ptrToFree);
zf->ptrToFree = NULL;
}
zf->data = NULL;
@@ -938,7 +932,7 @@ ZipFSCloseArchive(
#endif /* _WIN32 */
if (zf->ptrToFree) {
- ckfree(zf->ptrToFree);
+ Tcl_Free(zf->ptrToFree);
zf->ptrToFree = NULL;
}
if (zf->chan) {
@@ -1116,7 +1110,7 @@ ZipFSOpenArchive(
}
if (Tcl_GetChannelHandle(zf->chan, TCL_READABLE, &handle) != TCL_OK) {
zf->length = Tcl_Seek(zf->chan, 0, SEEK_END);
- if (zf->length == ERROR_LENGTH) {
+ if (zf->length == TCL_IO_FAILURE) {
ZIPFS_POSIX_ERROR(interp, "seek error");
goto error;
}
@@ -1132,7 +1126,7 @@ ZipFSOpenArchive(
ZIPFS_POSIX_ERROR(interp, "seek error");
goto error;
}
- zf->ptrToFree = zf->data = attemptckalloc(zf->length);
+ zf->ptrToFree = zf->data = Tcl_AttemptAlloc(zf->length);
if (!zf->ptrToFree) {
ZIPFS_ERROR(interp, "out of memory");
if (interp) {
@@ -1175,7 +1169,7 @@ ZipFSOpenArchive(
}
#else /* !_WIN32 */
zf->length = lseek(PTR2INT(handle), 0, SEEK_END);
- if (zf->length == ERROR_LENGTH || zf->length < ZIP_CENTRAL_END_LEN) {
+ if (zf->length == TCL_IO_FAILURE || zf->length < ZIP_CENTRAL_END_LEN) {
ZIPFS_POSIX_ERROR(interp, "invalid file size");
goto error;
}
@@ -1272,7 +1266,7 @@ ZipFSCatalogFilesystem(
ZipFSCloseArchive(interp, zf0);
return TCL_ERROR;
}
- zf = attemptckalloc(sizeof(ZipFile) + strlen(mountPoint) + 1);
+ zf = Tcl_AttemptAlloc(sizeof(ZipFile) + strlen(mountPoint) + 1);
if (!zf) {
if (interp) {
Tcl_AppendResult(interp, "out of memory", (char *) NULL);
@@ -1289,7 +1283,7 @@ ZipFSCatalogFilesystem(
Tcl_CreateExitHandler(ZipfsExitHandler, (ClientData)zf);
zf->mountPointLen = strlen(zf->mountPoint);
zf->nameLength = strlen(zipname);
- zf->name = ckalloc(zf->nameLength + 1);
+ zf->name = Tcl_Alloc(zf->nameLength + 1);
memcpy(zf->name, zipname, zf->nameLength + 1);
zf->entries = NULL;
zf->topEnts = NULL;
@@ -1308,7 +1302,7 @@ ZipFSCatalogFilesystem(
if (mountPoint[0] != '\0') {
hPtr = Tcl_CreateHashEntry(&ZipFS.fileHash, mountPoint, &isNew);
if (isNew) {
- z = ckalloc(sizeof(ZipEntry));
+ z = Tcl_Alloc(sizeof(ZipEntry));
Tcl_SetHashValue(hPtr, z);
z->tnext = NULL;
@@ -1403,7 +1397,7 @@ ZipFSCatalogFilesystem(
}
Tcl_DStringSetLength(&fpBuf, 0);
fullpath = CanonicalPath(mountPoint, path, &fpBuf, 1);
- z = ckalloc(sizeof(ZipEntry));
+ z = Tcl_Alloc(sizeof(ZipEntry));
z->name = NULL;
z->tnext = NULL;
z->depth = CountSlashes(fullpath);
@@ -1432,7 +1426,7 @@ ZipFSCatalogFilesystem(
hPtr = Tcl_CreateHashEntry(&ZipFS.fileHash, fullpath, &isNew);
if (!isNew) {
/* should not happen but skip it anyway */
- ckfree(z);
+ Tcl_Free(z);
} else {
Tcl_SetHashValue(hPtr, z);
z->name = Tcl_GetHashKey(&ZipFS.fileHash, hPtr);
@@ -1457,7 +1451,7 @@ ZipFSCatalogFilesystem(
if (!isNew) {
break;
}
- zd = ckalloc(sizeof(ZipEntry));
+ zd = Tcl_Alloc(sizeof(ZipEntry));
zd->name = NULL;
zd->tnext = NULL;
zd->depth = CountSlashes(dir);
@@ -1671,7 +1665,7 @@ TclZipfs_Mount(
return TCL_ERROR;
}
}
- zf = attemptckalloc(sizeof(ZipFile) + strlen(mountPoint) + 1);
+ zf = Tcl_AttemptAlloc(sizeof(ZipFile) + strlen(mountPoint) + 1);
if (!zf) {
if (interp) {
Tcl_AppendResult(interp, "out of memory", (char *) NULL);
@@ -1680,15 +1674,15 @@ TclZipfs_Mount(
return TCL_ERROR;
}
if (ZipFSOpenArchive(interp, zipname, 1, zf) != TCL_OK) {
- ckfree(zf);
+ Tcl_Free(zf);
return TCL_ERROR;
}
if (ZipFSCatalogFilesystem(interp, zf, mountPoint, passwd, zipname)
!= TCL_OK) {
- ckfree(zf);
+ Tcl_Free(zf);
return TCL_ERROR;
}
- ckfree(zf);
+ Tcl_Free(zf);
return TCL_OK;
}
@@ -1752,7 +1746,7 @@ TclZipfs_MountBuffer(
* Have both a mount point and data to mount there.
*/
- zf = attemptckalloc(sizeof(ZipFile) + strlen(mountPoint) + 1);
+ zf = Tcl_AttemptAlloc(sizeof(ZipFile) + strlen(mountPoint) + 1);
if (!zf) {
if (interp) {
Tcl_AppendResult(interp, "out of memory", (char *) NULL);
@@ -1763,7 +1757,7 @@ TclZipfs_MountBuffer(
zf->isMemBuffer = 1;
zf->length = datalen;
if (copy) {
- zf->data = attemptckalloc(datalen);
+ zf->data = Tcl_AttemptAlloc(datalen);
if (!zf->data) {
if (interp) {
Tcl_AppendResult(interp, "out of memory", (char *) NULL);
@@ -1783,7 +1777,7 @@ TclZipfs_MountBuffer(
}
result = ZipFSCatalogFilesystem(interp, zf, mountPoint, NULL,
"Memory Buffer");
- ckfree(zf);
+ Tcl_Free(zf);
return result;
}
@@ -1847,13 +1841,13 @@ TclZipfs_Unmount(
Tcl_DeleteHashEntry(hPtr);
}
if (z->data) {
- ckfree(z->data);
+ Tcl_Free(z->data);
}
- ckfree(z);
+ Tcl_Free(z);
}
ZipFSCloseArchive(interp, zf);
Tcl_DeleteExitHandler(ZipfsExitHandler, (ClientData)zf);
- ckfree(zf);
+ Tcl_Free(zf);
unmounted = 1;
done:
Unlock();
@@ -1892,9 +1886,9 @@ ZipFSMountObjCmd(
return TCL_ERROR;
}
- return TclZipfs_Mount(interp, (objc > 1) ? Tcl_GetString(objv[1]) : NULL,
- (objc > 2) ? Tcl_GetString(objv[2]) : NULL,
- (objc > 3) ? Tcl_GetString(objv[3]) : NULL);
+ return TclZipfs_Mount(interp, (objc > 1) ? TclGetString(objv[1]) : NULL,
+ (objc > 2) ? TclGetString(objv[2]) : NULL,
+ (objc > 3) ? TclGetString(objv[3]) : NULL);
}
/*
@@ -1922,7 +1916,7 @@ ZipFSMountBufferObjCmd(
{
const char *mountPoint; /* Mount point path. */
unsigned char *data;
- int length;
+ size_t length = 0;
if (objc > 3) {
Tcl_WrongNumArgs(interp, 1, objv, "?mountpoint? ?data?");
@@ -1937,7 +1931,7 @@ ZipFSMountBufferObjCmd(
return ret;
}
- mountPoint = Tcl_GetString(objv[1]);
+ mountPoint = TclGetString(objv[1]);
if (objc < 3) {
ReadLock();
DescribeMounted(interp, mountPoint);
@@ -1945,7 +1939,7 @@ ZipFSMountBufferObjCmd(
return TCL_OK;
}
- data = Tcl_GetByteArrayFromObj(objv[2], &length);
+ data = TclGetByteArrayFromObj(objv[2], &length);
return TclZipfs_MountBuffer(interp, mountPoint, data, length, 1);
}
@@ -2003,7 +1997,7 @@ ZipFSUnmountObjCmd(
Tcl_WrongNumArgs(interp, 1, objv, "zipfile");
return TCL_ERROR;
}
- return TclZipfs_Unmount(interp, Tcl_GetString(objv[1]));
+ return TclZipfs_Unmount(interp, TclGetString(objv[1]));
}
/*
@@ -2037,7 +2031,7 @@ ZipFSMkKeyObjCmd(
Tcl_WrongNumArgs(interp, 1, objv, "password");
return TCL_ERROR;
}
- pw = Tcl_GetString(objv[1]);
+ pw = TclGetString(objv[1]);
len = strlen(pw);
if (len == 0) {
return TCL_OK;
@@ -2154,7 +2148,7 @@ ZipAddFile(
nbyte = nbytecompr = 0;
while (1) {
len = Tcl_Read(in, buf, bufsize);
- if (len == ERROR_LENGTH) {
+ if (len == TCL_IO_FAILURE) {
if (nbyte == 0 && errno == EISDIR) {
Tcl_Close(interp, in);
return TCL_OK;
@@ -2180,7 +2174,7 @@ ZipAddFile(
memset(buf, '\0', ZIP_LOCAL_HEADER_LEN);
memcpy(buf + ZIP_LOCAL_HEADER_LEN, zpath, zpathlen);
len = zpathlen + ZIP_LOCAL_HEADER_LEN;
- if ((size_t) Tcl_Write(out, buf, len) != len) {
+ if (Tcl_Write(out, buf, len) != len) {
wrerr:
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"write error on %s: %s", path, Tcl_PosixError(interp)));
@@ -2199,7 +2193,7 @@ ZipAddFile(
ZipWriteShort(abuf, 0xffff);
ZipWriteShort(abuf + 2, align - 4);
ZipWriteInt(abuf + 4, 0x03020100);
- if ((size_t) Tcl_Write(out, (const char *) abuf, align) != align) {
+ if (Tcl_Write(out, (const char *) abuf, align) != align) {
goto wrerr;
}
}
@@ -2270,7 +2264,7 @@ ZipAddFile(
}
do {
len = Tcl_Read(in, buf, bufsize);
- if (len == ERROR_LENGTH) {
+ if (len == TCL_IO_FAILURE) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"read error on %s: %s", path, Tcl_PosixError(interp)));
deflateEnd(&stream);
@@ -2301,7 +2295,7 @@ ZipAddFile(
obuf[i] = (char) zencode(keys, crc32tab, obuf[i], tmp);
}
}
- if (olen && ((size_t) Tcl_Write(out, obuf, olen) != olen)) {
+ if (olen && (Tcl_Write(out, obuf, olen) != olen)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"write error: %s", Tcl_PosixError(interp)));
deflateEnd(&stream);
@@ -2331,7 +2325,7 @@ ZipAddFile(
nbytecompr = (passwd ? 12 : 0);
while (1) {
len = Tcl_Read(in, buf, bufsize);
- if (len == ERROR_LENGTH) {
+ if (len == TCL_IO_FAILURE) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"read error on \"%s\": %s",
path, Tcl_PosixError(interp)));
@@ -2348,7 +2342,7 @@ ZipAddFile(
buf[i] = (char) zencode(keys0, crc32tab, buf[i], tmp);
}
}
- if ((size_t) Tcl_Write(out, buf, len) != len) {
+ if (Tcl_Write(out, buf, len) != len) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"write error: %s", Tcl_PosixError(interp)));
Tcl_Close(interp, in);
@@ -2371,7 +2365,7 @@ ZipAddFile(
return TCL_ERROR;
}
- z = ckalloc(sizeof(ZipEntry));
+ z = Tcl_Alloc(sizeof(ZipEntry));
Tcl_SetHashValue(hPtr, z);
z->name = NULL;
z->tnext = NULL;
@@ -2405,14 +2399,14 @@ ZipAddFile(
ZipWriteShort(buf + ZIP_LOCAL_EXTRALEN_OFFS, align);
if (Tcl_Seek(out, pos[0], SEEK_SET) != pos[0]) {
Tcl_DeleteHashEntry(hPtr);
- ckfree(z);
+ Tcl_Free(z);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"seek error: %s", Tcl_PosixError(interp)));
return TCL_ERROR;
}
if (Tcl_Write(out, buf, ZIP_LOCAL_HEADER_LEN) != ZIP_LOCAL_HEADER_LEN) {
Tcl_DeleteHashEntry(hPtr);
- ckfree(z);
+ Tcl_Free(z);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"write error: %s", Tcl_PosixError(interp)));
return TCL_ERROR;
@@ -2420,7 +2414,7 @@ ZipAddFile(
Tcl_Flush(out);
if (Tcl_Seek(out, pos[1], SEEK_SET) != pos[1]) {
Tcl_DeleteHashEntry(hPtr);
- ckfree(z);
+ Tcl_Free(z);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"seek error: %s", Tcl_PosixError(interp)));
return TCL_ERROR;
@@ -2472,7 +2466,7 @@ ZipFSMkZipOrImgObjCmd(
passBuf[0] = 0;
if (objc > (isList ? 3 : 4)) {
- pw = Tcl_GetString(objv[isList ? 3 : 4]);
+ pw = TclGetString(objv[isList ? 3 : 4]);
pwlen = strlen(pw);
if ((pwlen > 255) || strchr(pw, 0xff)) {
Tcl_SetObjResult(interp,
@@ -2516,7 +2510,7 @@ ZipFSMkZipOrImgObjCmd(
Tcl_SetErrorCode(interp, "TCL", "ZIPFS", "EMPTY", NULL);
return TCL_ERROR;
}
- out = Tcl_OpenFileChannel(interp, Tcl_GetString(objv[1]), "wb", 0755);
+ out = Tcl_OpenFileChannel(interp, TclGetString(objv[1]), "wb", 0755);
if (out == NULL) {
Tcl_DecrRefCount(list);
return TCL_ERROR;
@@ -2531,10 +2525,10 @@ ZipFSMkZipOrImgObjCmd(
const char *imgName;
if (isList) {
- imgName = (objc > 4) ? Tcl_GetString(objv[4]) :
+ imgName = (objc > 4) ? TclGetString(objv[4]) :
Tcl_GetNameOfExecutable();
} else {
- imgName = (objc > 5) ? Tcl_GetString(objv[5]) :
+ imgName = (objc > 5) ? TclGetString(objv[5]) :
Tcl_GetNameOfExecutable();
}
if (pwlen) {
@@ -2573,7 +2567,7 @@ ZipFSMkZipOrImgObjCmd(
zf = &zf0;
}
if (isMounted || ZipFSOpenArchive(interp, imgName, 0, zf) == TCL_OK) {
- if ((size_t) Tcl_Write(out, (char *) zf->data,
+ if (Tcl_Write(out, (char *) zf->data,
zf->passOffset) != zf->passOffset) {
memset(passBuf, 0, sizeof(passBuf));
Tcl_DecrRefCount(list);
@@ -2616,7 +2610,7 @@ ZipFSMkZipOrImgObjCmd(
return TCL_ERROR;
}
i = Tcl_Seek(in, 0, SEEK_END);
- if (i == ERROR_LENGTH) {
+ if (i == TCL_IO_FAILURE) {
cperr:
memset(passBuf, 0, sizeof(passBuf));
Tcl_DecrRefCount(list);
@@ -2664,15 +2658,15 @@ ZipFSMkZipOrImgObjCmd(
Tcl_InitHashTable(&fileHash, TCL_STRING_KEYS);
pos[0] = Tcl_Tell(out);
if (!isList && (objc > 3)) {
- strip = Tcl_GetString(objv[3]);
+ strip = TclGetString(objv[3]);
slen = strlen(strip);
}
for (i = 0; i < (size_t) lobjc; i += (isList ? 2 : 1)) {
const char *path, *name;
- path = Tcl_GetString(lobjv[i]);
+ path = TclGetString(lobjv[i]);
if (isList) {
- name = Tcl_GetString(lobjv[i + 1]);
+ name = TclGetString(lobjv[i + 1]);
} else {
name = path;
if (slen > 0) {
@@ -2699,9 +2693,9 @@ ZipFSMkZipOrImgObjCmd(
for (i = 0; i < (size_t) lobjc; i += (isList ? 2 : 1)) {
const char *path, *name;
- path = Tcl_GetString(lobjv[i]);
+ path = TclGetString(lobjv[i]);
if (isList) {
- name = Tcl_GetString(lobjv[i + 1]);
+ name = TclGetString(lobjv[i + 1]);
} else {
name = path;
if (slen > 0) {
@@ -2743,7 +2737,7 @@ ZipFSMkZipOrImgObjCmd(
ZipWriteInt(buf + ZIP_CENTRAL_LOCALHDR_OFFS, z->offset - pos[0]);
if ((Tcl_Write(out, buf,
ZIP_CENTRAL_HEADER_LEN) != ZIP_CENTRAL_HEADER_LEN)
- || ((size_t) Tcl_Write(out, z->name, len) != len)) {
+ || (Tcl_Write(out, z->name, len) != len)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"write error: %s", Tcl_PosixError(interp)));
goto done;
@@ -2778,7 +2772,7 @@ ZipFSMkZipOrImgObjCmd(
for (hPtr = Tcl_FirstHashEntry(&fileHash, &search); hPtr;
hPtr = Tcl_NextHashEntry(&search)) {
z = Tcl_GetHashValue(hPtr);
- ckfree(z);
+ Tcl_Free(z);
Tcl_DeleteHashEntry(hPtr);
}
Tcl_DeleteHashTable(&fileHash);
@@ -2935,11 +2929,11 @@ ZipFSCanonicalObjCmd(
}
Tcl_DStringInit(&dPath);
if (objc == 2) {
- filename = Tcl_GetString(objv[1]);
+ filename = TclGetString(objv[1]);
result = CanonicalPath("", filename, &dPath, 1);
} else if (objc == 3) {
- mntpoint = Tcl_GetString(objv[1]);
- filename = Tcl_GetString(objv[2]);
+ mntpoint = TclGetString(objv[1]);
+ filename = TclGetString(objv[2]);
result = CanonicalPath(mntpoint, filename, &dPath, 1);
} else {
int zipfs = 0;
@@ -2947,8 +2941,8 @@ ZipFSCanonicalObjCmd(
if (Tcl_GetBooleanFromObj(interp, objv[3], &zipfs)) {
return TCL_ERROR;
}
- mntpoint = Tcl_GetString(objv[1]);
- filename = Tcl_GetString(objv[2]);
+ mntpoint = TclGetString(objv[1]);
+ filename = TclGetString(objv[2]);
result = CanonicalPath(mntpoint, filename, &dPath, zipfs);
}
Tcl_SetObjResult(interp, Tcl_NewStringObj(result, -1));
@@ -2993,7 +2987,7 @@ ZipFSExistsObjCmd(
* Prepend ZIPFS_VOLUME to filename, eliding the final /
*/
- filename = Tcl_GetString(objv[1]);
+ filename = TclGetString(objv[1]);
Tcl_DStringInit(&ds);
Tcl_DStringAppend(&ds, ZIPFS_VOLUME, ZIPFS_VOLUME_LEN - 1);
Tcl_DStringAppend(&ds, filename, -1);
@@ -3040,7 +3034,7 @@ ZipFSInfoObjCmd(
Tcl_WrongNumArgs(interp, 1, objv, "filename");
return TCL_ERROR;
}
- filename = Tcl_GetString(objv[1]);
+ filename = TclGetString(objv[1]);
ReadLock();
z = ZipFSLookup(filename);
if (z) {
@@ -3094,13 +3088,13 @@ ZipFSListObjCmd(
return TCL_ERROR;
}
if (objc == 3) {
- int n;
- char *what = Tcl_GetStringFromObj(objv[1], &n);
+ size_t n;
+ char *what = TclGetStringFromObj(objv[1], &n);
if ((n >= 2) && (strncmp(what, "-glob", n) == 0)) {
- pattern = Tcl_GetString(objv[2]);
+ pattern = TclGetString(objv[2]);
} else if ((n >= 2) && (strncmp(what, "-regexp", n) == 0)) {
- regexp = Tcl_RegExpCompile(interp, Tcl_GetString(objv[2]));
+ regexp = Tcl_RegExpCompile(interp, TclGetString(objv[2]));
if (!regexp) {
return TCL_ERROR;
}
@@ -3111,7 +3105,7 @@ ZipFSListObjCmd(
return TCL_ERROR;
}
} else if (objc == 2) {
- pattern = Tcl_GetString(objv[1]);
+ pattern = TclGetString(objv[1]);
}
ReadLock();
if (pattern) {
@@ -3315,7 +3309,7 @@ ZipChannelClose(
ZipChannel *info = instanceData;
if (info->iscompr && info->ubuf) {
- ckfree(info->ubuf);
+ Tcl_Free(info->ubuf);
info->ubuf = NULL;
}
if (info->isEncrypted) {
@@ -3324,11 +3318,11 @@ ZipChannelClose(
}
if (info->isWriting) {
ZipEntry *z = info->zipEntryPtr;
- unsigned char *newdata = attemptckrealloc(info->ubuf, info->numRead);
+ unsigned char *newdata = Tcl_AttemptRealloc(info->ubuf, info->numRead);
if (newdata) {
if (z->data) {
- ckfree(z->data);
+ Tcl_Free(z->data);
}
z->data = newdata;
z->numBytes = z->numCompressedBytes = info->numBytes;
@@ -3339,13 +3333,13 @@ ZipChannelClose(
z->offset = 0;
z->crc32 = 0;
} else {
- ckfree(info->ubuf);
+ Tcl_Free(info->ubuf);
}
}
WriteLock();
info->zipFilePtr->numOpen--;
Unlock();
- ckfree(info);
+ Tcl_Free(info);
return TCL_OK;
}
@@ -3675,7 +3669,7 @@ ZipChannelOpen(
} else {
flags = TCL_WRITABLE;
}
- info = attemptckalloc(sizeof(ZipChannel));
+ info = Tcl_AttemptAlloc(sizeof(ZipChannel));
if (!info) {
ZIPFS_ERROR(interp, "out of memory");
if (interp) {
@@ -3693,13 +3687,13 @@ ZipChannelOpen(
info->maxWrite = ZipFS.wrmax;
info->iscompr = 0;
info->isEncrypted = 0;
- info->ubuf = attemptckalloc(info->maxWrite);
+ info->ubuf = Tcl_AttemptAlloc(info->maxWrite);
if (!info->ubuf) {
merror0:
if (info->ubuf) {
- ckfree(info->ubuf);
+ Tcl_Free(info->ubuf);
}
- ckfree(info);
+ Tcl_Free(info);
ZIPFS_ERROR(interp, "out of memory");
if (interp) {
Tcl_SetErrorCode(interp, "TCL", "MALLOC", NULL);
@@ -3710,7 +3704,7 @@ ZipChannelOpen(
if (trunc) {
info->numBytes = 0;
} else if (z->data) {
- unsigned int j = z->numBytes;
+ size_t j = z->numBytes;
if (j > info->maxWrite) {
j = info->maxWrite;
@@ -3748,10 +3742,10 @@ ZipChannelOpen(
stream.opaque = Z_NULL;
stream.avail_in = z->numCompressedBytes;
if (z->isEncrypted) {
- unsigned int j;
+ size_t j;
stream.avail_in -= 12;
- cbuf = attemptckalloc(stream.avail_in);
+ cbuf = Tcl_AttemptAlloc(stream.avail_in);
if (!cbuf) {
goto merror0;
}
@@ -3774,19 +3768,19 @@ ZipChannelOpen(
|| ((err == Z_OK) && (stream.avail_in == 0))) {
if (cbuf) {
memset(info->keys, 0, sizeof(info->keys));
- ckfree(cbuf);
+ Tcl_Free(cbuf);
}
goto wrapchan;
}
cerror0:
if (cbuf) {
memset(info->keys, 0, sizeof(info->keys));
- ckfree(cbuf);
+ Tcl_Free(cbuf);
}
if (info->ubuf) {
- ckfree(info->ubuf);
+ Tcl_Free(info->ubuf);
}
- ckfree(info);
+ Tcl_Free(info);
ZIPFS_ERROR(interp, "decompression error");
if (interp) {
Tcl_SetErrorCode(interp, "TCL", "ZIPFS", "CORRUPT", NULL);
@@ -3842,7 +3836,7 @@ ZipChannelOpen(
z_stream stream;
int err;
unsigned char *ubuf = NULL;
- unsigned int j;
+ size_t j;
memset(&stream, 0, sizeof(z_stream));
stream.zalloc = Z_NULL;
@@ -3851,7 +3845,7 @@ ZipChannelOpen(
stream.avail_in = z->numCompressedBytes;
if (info->isEncrypted) {
stream.avail_in -= 12;
- ubuf = attemptckalloc(stream.avail_in);
+ ubuf = Tcl_AttemptAlloc(stream.avail_in);
if (!ubuf) {
info->ubuf = NULL;
goto merror;
@@ -3864,15 +3858,15 @@ ZipChannelOpen(
} else {
stream.next_in = info->ubuf;
}
- stream.next_out = info->ubuf = attemptckalloc(info->numBytes);
+ stream.next_out = info->ubuf = Tcl_AttemptAlloc(info->numBytes);
if (!info->ubuf) {
merror:
if (ubuf) {
info->isEncrypted = 0;
memset(info->keys, 0, sizeof(info->keys));
- ckfree(ubuf);
+ Tcl_Free(ubuf);
}
- ckfree(info);
+ Tcl_Free(info);
if (interp) {
Tcl_SetObjResult(interp,
Tcl_NewStringObj("out of memory", -1));
@@ -3891,7 +3885,7 @@ ZipChannelOpen(
if (ubuf) {
info->isEncrypted = 0;
memset(info->keys, 0, sizeof(info->keys));
- ckfree(ubuf);
+ Tcl_Free(ubuf);
}
goto wrapchan;
}
@@ -3899,12 +3893,12 @@ ZipChannelOpen(
if (ubuf) {
info->isEncrypted = 0;
memset(info->keys, 0, sizeof(info->keys));
- ckfree(ubuf);
+ Tcl_Free(ubuf);
}
if (info->ubuf) {
- ckfree(info->ubuf);
+ Tcl_Free(info->ubuf);
}
- ckfree(info);
+ Tcl_Free(info);
ZIPFS_ERROR(interp, "decompression error");
if (interp) {
Tcl_SetErrorCode(interp, "TCL", "ZIPFS", "CORRUPT", NULL);
@@ -3912,7 +3906,7 @@ ZipChannelOpen(
goto error;
} else if (info->isEncrypted) {
unsigned char *ubuf = NULL;
- unsigned int j, len;
+ size_t j, len;
/*
* Decode encrypted but uncompressed file, since we support
@@ -3920,9 +3914,9 @@ ZipChannelOpen(
*/
len = z->numCompressedBytes - 12;
- ubuf = (unsigned char *) attemptckalloc(len);
+ ubuf = (unsigned char *) Tcl_AttemptAlloc(len);
if (ubuf == NULL) {
- ckfree((char *) info);
+ Tcl_Free((char *) info);
if (interp != NULL) {
Tcl_SetObjResult(interp,
Tcl_NewStringObj("out of memory", -1));
@@ -4046,13 +4040,11 @@ ZipFSOpenFileChannelProc(
int mode,
int permissions)
{
- int len;
-
pathPtr = Tcl_FSGetNormalizedPath(NULL, pathPtr);
if (!pathPtr) {
return NULL;
}
- return ZipChannelOpen(interp, Tcl_GetStringFromObj(pathPtr, &len), mode,
+ return ZipChannelOpen(interp, TclGetString(pathPtr), mode,
permissions);
}
@@ -4078,13 +4070,12 @@ ZipFSStatProc(
Tcl_Obj *pathPtr,
Tcl_StatBuf *buf)
{
- int len;
pathPtr = Tcl_FSGetNormalizedPath(NULL, pathPtr);
if (!pathPtr) {
return -1;
}
- return ZipEntryStat(Tcl_GetStringFromObj(pathPtr, &len), buf);
+ return ZipEntryStat(TclGetString(pathPtr), buf);
}
/*
@@ -4109,13 +4100,11 @@ ZipFSAccessProc(
Tcl_Obj *pathPtr,
int mode)
{
- int len;
-
pathPtr = Tcl_FSGetNormalizedPath(NULL, pathPtr);
if (!pathPtr) {
return -1;
}
- return ZipEntryAccess(Tcl_GetStringFromObj(pathPtr, &len), mode);
+ return ZipEntryAccess(TclGetString(pathPtr), mode);
}
/*
@@ -4174,8 +4163,8 @@ ZipFSMatchInDirectoryProc(
Tcl_HashEntry *hPtr;
Tcl_HashSearch search;
Tcl_Obj *normPathPtr = Tcl_FSGetNormalizedPath(NULL, pathPtr);
- int scnt, l, dirOnly = -1, prefixLen, strip = 0;
- size_t len;
+ int scnt, l, dirOnly = -1, strip = 0;
+ size_t len, prefixLen;
char *pat, *prefix, *path;
Tcl_DString dsPref;
@@ -4190,14 +4179,13 @@ ZipFSMatchInDirectoryProc(
* The prefix that gets prepended to results.
*/
- prefix = Tcl_GetStringFromObj(pathPtr, &prefixLen);
+ prefix = TclGetStringFromObj(pathPtr, &prefixLen);
/*
* The (normalized) path we're searching.
*/
- path = Tcl_GetString(normPathPtr);
- len = normPathPtr->length;
+ path = TclGetStringFromObj(normPathPtr, &len);
Tcl_DStringInit(&dsPref);
Tcl_DStringAppend(&dsPref, prefix, prefixLen);
@@ -4296,7 +4284,7 @@ ZipFSMatchInDirectoryProc(
}
l = strlen(pattern);
- pat = ckalloc(len + l + 2);
+ pat = Tcl_Alloc(len + l + 2);
memcpy(pat, path, len);
while ((len > 1) && (pat[len - 1] == '/')) {
--len;
@@ -4328,7 +4316,7 @@ ZipFSMatchInDirectoryProc(
}
}
}
- ckfree(pat);
+ Tcl_Free(pat);
end:
Unlock();
@@ -4369,13 +4357,11 @@ ZipFSPathInFilesystemProc(
return -1;
}
- path = Tcl_GetString(pathPtr);
+ path = TclGetStringFromObj(pathPtr, &len);
if (strncmp(path, ZIPFS_VOLUME, ZIPFS_VOLUME_LEN) != 0) {
return -1;
}
- len = pathPtr->length;
-
ReadLock();
hPtr = Tcl_FindHashEntry(&ZipFS.fileHash, path);
if (hPtr) {
@@ -4494,7 +4480,7 @@ ZipFSFileAttrsGetProc(
Tcl_Obj *pathPtr,
Tcl_Obj **objPtrRef)
{
- int len, ret = TCL_OK;
+ int ret = TCL_OK;
char *path;
ZipEntry *z;
@@ -4502,7 +4488,7 @@ ZipFSFileAttrsGetProc(
if (!pathPtr) {
return -1;
}
- path = Tcl_GetStringFromObj(pathPtr, &len);
+ path = TclGetString(pathPtr);
ReadLock();
z = ZipFSLookup(path);
if (!z) {
@@ -4799,7 +4785,7 @@ TclZipfs_Init(
Tcl_NewStringObj("::tcl::zipfs::find", -1));
Tcl_CreateObjCommand(interp, "::tcl::zipfs::tcl_library_init",
ZipFSTclLibraryObjCmd, NULL, NULL);
- Tcl_PkgProvide(interp, "zipfs", "2.0");
+ Tcl_PkgProvideEx(interp, "zipfs", "2.0", NULL);
}
return TCL_OK;
#else /* !HAVE_ZLIB */
diff --git a/generic/tclZlib.c b/generic/tclZlib.c
index 8dbe807..df0372b 100644
--- a/generic/tclZlib.c
+++ b/generic/tclZlib.c
@@ -64,7 +64,7 @@ typedef struct {
Tcl_Obj *inData, *outData; /* Input / output buffers (lists) */
Tcl_Obj *currentInput; /* Pointer to what is currently being
* inflated. */
- int outPos;
+ size_t outPos;
int mode; /* Either TCL_ZLIB_STREAM_DEFLATE or
* TCL_ZLIB_STREAM_INFLATE. */
int format; /* Flags from the TCL_ZLIB_FORMAT_* */
@@ -178,14 +178,14 @@ static void ConvertError(Tcl_Interp *interp, int code,
uLong adler);
static Tcl_Obj * ConvertErrorToList(int code, uLong adler);
static inline int Deflate(z_streamp strm, void *bufferPtr,
- int bufferSize, int flush, int *writtenPtr);
+ size_t bufferSize, int flush, size_t *writtenPtr);
static void ExtractHeader(gz_header *headerPtr, Tcl_Obj *dictObj);
static int GenerateHeader(Tcl_Interp *interp, Tcl_Obj *dictObj,
GzipHeader *headerPtr, int *extraSizePtr);
static int ZlibPushSubcmd(Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
static inline int ResultCopy(ZlibChannelData *cd, char *buf,
- int toRead);
+ size_t toRead);
static int ResultGenerate(ZlibChannelData *cd, int n, int flush,
int *errorCodePtr);
static Tcl_Channel ZlibStackChannelTransform(Tcl_Interp *interp,
@@ -422,6 +422,7 @@ GenerateHeader(
{
Tcl_Obj *value;
int len, result = TCL_ERROR;
+ size_t length;
Tcl_WideInt wideValue = 0;
const char *valueStr;
Tcl_Encoding latin1enc;
@@ -441,8 +442,8 @@ GenerateHeader(
if (GetValue(interp, dictObj, "comment", &value) != TCL_OK) {
goto error;
} else if (value != NULL) {
- valueStr = TclGetStringFromObj(value, &len);
- Tcl_UtfToExternal(NULL, latin1enc, valueStr, len, 0, NULL,
+ valueStr = TclGetStringFromObj(value, &length);
+ Tcl_UtfToExternal(NULL, latin1enc, valueStr, length, 0, NULL,
headerPtr->nativeCommentBuf, MAX_COMMENT_LEN-1, NULL, &len,
NULL);
headerPtr->nativeCommentBuf[len] = '\0';
@@ -462,8 +463,8 @@ GenerateHeader(
if (GetValue(interp, dictObj, "filename", &value) != TCL_OK) {
goto error;
} else if (value != NULL) {
- valueStr = TclGetStringFromObj(value, &len);
- Tcl_UtfToExternal(NULL, latin1enc, valueStr, len, 0, NULL,
+ valueStr = TclGetStringFromObj(value, &length);
+ Tcl_UtfToExternal(NULL, latin1enc, valueStr, length, 0, NULL,
headerPtr->nativeFilenameBuf, MAXPATHLEN-1, NULL, &len, NULL);
headerPtr->nativeFilenameBuf[len] = '\0';
headerPtr->header.name = (Bytef *) headerPtr->nativeFilenameBuf;
@@ -592,8 +593,8 @@ SetInflateDictionary(
Tcl_Obj *compDictObj)
{
if (compDictObj != NULL) {
- int length;
- unsigned char *bytes = Tcl_GetByteArrayFromObj(compDictObj, &length);
+ size_t length = 0;
+ unsigned char *bytes = TclGetByteArrayFromObj(compDictObj, &length);
return inflateSetDictionary(strm, bytes, length);
}
@@ -606,8 +607,8 @@ SetDeflateDictionary(
Tcl_Obj *compDictObj)
{
if (compDictObj != NULL) {
- int length;
- unsigned char *bytes = Tcl_GetByteArrayFromObj(compDictObj, &length);
+ size_t length = 0;
+ unsigned char *bytes = TclGetByteArrayFromObj(compDictObj, &length);
return deflateSetDictionary(strm, bytes, length);
}
@@ -618,9 +619,9 @@ static inline int
Deflate(
z_streamp strm,
void *bufferPtr,
- int bufferSize,
+ size_t bufferSize,
int flush,
- int *writtenPtr)
+ size_t *writtenPtr)
{
int e;
@@ -637,7 +638,7 @@ static inline void
AppendByteArray(
Tcl_Obj *listObj,
void *buffer,
- int size)
+ size_t size)
{
if (size > 0) {
Tcl_Obj *baObj = Tcl_NewByteArrayObj((unsigned char *) buffer, size);
@@ -699,11 +700,11 @@ Tcl_ZlibStreamInit(
case TCL_ZLIB_FORMAT_GZIP:
wbits = WBITS_GZIP;
if (dictObj) {
- gzHeaderPtr = ckalloc(sizeof(GzipHeader));
+ gzHeaderPtr = Tcl_Alloc(sizeof(GzipHeader));
memset(gzHeaderPtr, 0, sizeof(GzipHeader));
if (GenerateHeader(interp, dictObj, gzHeaderPtr,
NULL) != TCL_OK) {
- ckfree(gzHeaderPtr);
+ Tcl_Free(gzHeaderPtr);
return TCL_ERROR;
}
}
@@ -733,7 +734,7 @@ Tcl_ZlibStreamInit(
break;
case TCL_ZLIB_FORMAT_GZIP:
wbits = WBITS_GZIP;
- gzHeaderPtr = ckalloc(sizeof(GzipHeader));
+ gzHeaderPtr = Tcl_Alloc(sizeof(GzipHeader));
memset(gzHeaderPtr, 0, sizeof(GzipHeader));
gzHeaderPtr->header.name = (Bytef *)
gzHeaderPtr->nativeFilenameBuf;
@@ -759,7 +760,7 @@ Tcl_ZlibStreamInit(
" TCL_ZLIB_STREAM_INFLATE");
}
- zshPtr = ckalloc(sizeof(ZlibStreamHandle));
+ zshPtr = Tcl_Alloc(sizeof(ZlibStreamHandle));
zshPtr->interp = interp;
zshPtr->mode = mode;
zshPtr->format = format;
@@ -859,9 +860,9 @@ Tcl_ZlibStreamInit(
Tcl_DecrRefCount(zshPtr->compDictObj);
}
if (zshPtr->gzHeaderPtr) {
- ckfree(zshPtr->gzHeaderPtr);
+ Tcl_Free(zshPtr->gzHeaderPtr);
}
- ckfree(zshPtr);
+ Tcl_Free(zshPtr);
return TCL_ERROR;
}
@@ -972,10 +973,10 @@ ZlibStreamCleanup(
Tcl_DecrRefCount(zshPtr->compDictObj);
}
if (zshPtr->gzHeaderPtr) {
- ckfree(zshPtr->gzHeaderPtr);
+ Tcl_Free(zshPtr->gzHeaderPtr);
}
- ckfree(zshPtr);
+ Tcl_Free(zshPtr);
}
/*
@@ -1190,7 +1191,8 @@ Tcl_ZlibStreamPut(
{
ZlibStreamHandle *zshPtr = (ZlibStreamHandle *) zshandle;
char *dataTmp = NULL;
- int e, size, outSize, toStore;
+ int e;
+ size_t size = 0, outSize, toStore;
if (zshPtr->streamEnd) {
if (zshPtr->interp) {
@@ -1202,7 +1204,7 @@ Tcl_ZlibStreamPut(
}
if (zshPtr->mode == TCL_ZLIB_STREAM_DEFLATE) {
- zshPtr->stream.next_in = Tcl_GetByteArrayFromObj(data, &size);
+ zshPtr->stream.next_in = TclGetByteArrayFromObj(data, &size);
zshPtr->stream.avail_in = size;
/*
@@ -1233,7 +1235,7 @@ Tcl_ZlibStreamPut(
if (outSize > BUFFER_SIZE_LIMIT) {
outSize = BUFFER_SIZE_LIMIT;
}
- dataTmp = ckalloc(outSize);
+ dataTmp = Tcl_Alloc(outSize);
while (1) {
e = Deflate(&zshPtr->stream, dataTmp, outSize, flush, &toStore);
@@ -1267,7 +1269,7 @@ Tcl_ZlibStreamPut(
if (outSize < BUFFER_SIZE_LIMIT) {
outSize = BUFFER_SIZE_LIMIT;
/* There may be *lots* of data left to output... */
- dataTmp = ckrealloc(dataTmp, outSize);
+ dataTmp = Tcl_Realloc(dataTmp, outSize);
}
}
@@ -1276,7 +1278,7 @@ Tcl_ZlibStreamPut(
*/
AppendByteArray(zshPtr->outData, dataTmp, toStore);
- ckfree(dataTmp);
+ Tcl_Free(dataTmp);
} else {
/*
* This is easy. Just append to the inData list.
@@ -1309,14 +1311,15 @@ int
Tcl_ZlibStreamGet(
Tcl_ZlibStream zshandle, /* As obtained from Tcl_ZlibStreamInit */
Tcl_Obj *data, /* A place to append the data. */
- int count) /* Number of bytes to grab as a maximum, you
+ size_t count) /* Number of bytes to grab as a maximum, you
* may get less! */
{
ZlibStreamHandle *zshPtr = (ZlibStreamHandle *) zshandle;
- int e, i, listLen, itemLen, dataPos = 0;
+ int e, i, listLen;
+ size_t itemLen = 0, dataPos = 0;
Tcl_Obj *itemObj;
unsigned char *dataPtr, *itemPtr;
- int existing;
+ size_t existing = 0;
/*
* Getting beyond the of stream, just return empty string.
@@ -1326,10 +1329,10 @@ Tcl_ZlibStreamGet(
return TCL_OK;
}
- (void) Tcl_GetByteArrayFromObj(data, &existing);
+ (void) TclGetByteArrayFromObj(data, &existing);
if (zshPtr->mode == TCL_ZLIB_STREAM_INFLATE) {
- if (count == -1) {
+ if (count == TCL_AUTO_LENGTH) {
/*
* The only safe thing to do is restict to 65k. We might cause a
* panic for out of memory if we just kept growing the buffer.
@@ -1369,7 +1372,7 @@ Tcl_ZlibStreamGet(
if (Tcl_IsShared(itemObj)) {
itemObj = Tcl_DuplicateObj(itemObj);
}
- itemPtr = Tcl_GetByteArrayFromObj(itemObj, &itemLen);
+ itemPtr = TclGetByteArrayFromObj(itemObj, &itemLen);
Tcl_IncrRefCount(itemObj);
zshPtr->currentInput = itemObj;
zshPtr->stream.next_in = itemPtr;
@@ -1441,7 +1444,7 @@ Tcl_ZlibStreamGet(
if (Tcl_IsShared(itemObj)) {
itemObj = Tcl_DuplicateObj(itemObj);
}
- itemPtr = Tcl_GetByteArrayFromObj(itemObj, &itemLen);
+ itemPtr = TclGetByteArrayFromObj(itemObj, &itemLen);
Tcl_IncrRefCount(itemObj);
zshPtr->currentInput = itemObj;
zshPtr->stream.next_in = itemPtr;
@@ -1486,11 +1489,11 @@ Tcl_ZlibStreamGet(
}
} else {
Tcl_ListObjLength(NULL, zshPtr->outData, &listLen);
- if (count == -1) {
+ if (count == TCL_AUTO_LENGTH) {
count = 0;
for (i=0; i<listLen; i++) {
Tcl_ListObjIndex(NULL, zshPtr->outData, i, &itemObj);
- (void) Tcl_GetByteArrayFromObj(itemObj, &itemLen);
+ (void) TclGetByteArrayFromObj(itemObj, &itemLen);
if (i == 0) {
count += itemLen - zshPtr->outPos;
} else {
@@ -1515,8 +1518,8 @@ Tcl_ZlibStreamGet(
*/
Tcl_ListObjIndex(NULL, zshPtr->outData, 0, &itemObj);
- itemPtr = Tcl_GetByteArrayFromObj(itemObj, &itemLen);
- if (itemLen-zshPtr->outPos >= count-dataPos) {
+ itemPtr = TclGetByteArrayFromObj(itemObj, &itemLen);
+ if (itemLen-zshPtr->outPos + dataPos >= count) {
size_t len = count - dataPos;
memcpy(dataPtr + dataPos, itemPtr + zshPtr->outPos, len);
@@ -1562,7 +1565,8 @@ Tcl_ZlibDeflate(
int level,
Tcl_Obj *gzipHeaderDictObj)
{
- int wbits = 0, inLen = 0, e = 0, extraSize = 0;
+ int wbits = 0, e = 0, extraSize = 0;
+ size_t inLen = 0;
Byte *inData = NULL;
z_stream stream;
GzipHeader header;
@@ -1622,9 +1626,9 @@ Tcl_ZlibDeflate(
* to the deflate command.
*/
- inData = Tcl_GetByteArrayFromObj(data, &inLen);
+ inData = TclGetByteArrayFromObj(data, &inLen);
memset(&stream, 0, sizeof(z_stream));
- stream.avail_in = (uInt) inLen;
+ stream.avail_in = inLen;
stream.next_in = inData;
/*
@@ -1709,10 +1713,11 @@ Tcl_ZlibInflate(
Tcl_Interp *interp,
int format,
Tcl_Obj *data,
- int bufferSize,
+ size_t bufferSize,
Tcl_Obj *gzipHeaderDictObj)
{
- int wbits = 0, inLen = 0, e = 0, newBufferSize;
+ int wbits = 0, e = 0;
+ size_t inLen = 0, newBufferSize;
Byte *inData = NULL, *outData = NULL, *newOutData = NULL;
z_stream stream;
gz_header header, *headerPtr = NULL;
@@ -1752,15 +1757,15 @@ Tcl_ZlibInflate(
if (gzipHeaderDictObj) {
headerPtr = &header;
memset(headerPtr, 0, sizeof(gz_header));
- nameBuf = ckalloc(MAXPATHLEN);
+ nameBuf = Tcl_Alloc(MAXPATHLEN);
header.name = (Bytef *) nameBuf;
header.name_max = MAXPATHLEN - 1;
- commentBuf = ckalloc(MAX_COMMENT_LEN);
+ commentBuf = Tcl_Alloc(MAX_COMMENT_LEN);
header.comment = (Bytef *) commentBuf;
header.comm_max = MAX_COMMENT_LEN - 1;
}
- inData = Tcl_GetByteArrayFromObj(data, &inLen);
+ inData = TclGetByteArrayFromObj(data, &inLen);
if (bufferSize < 1) {
/*
* Start with a buffer (up to) 3 times the size of the input data.
@@ -1778,7 +1783,7 @@ Tcl_ZlibInflate(
TclNewObj(obj);
outData = Tcl_SetByteArrayLength(obj, bufferSize);
memset(&stream, 0, sizeof(z_stream));
- stream.avail_in = (uInt) inLen+1; /* +1 because zlib can "over-request"
+ stream.avail_in = inLen+1; /* +1 because zlib can "over-request"
* input (but ignore it!) */
stream.next_in = inData;
stream.avail_out = bufferSize;
@@ -1861,8 +1866,8 @@ Tcl_ZlibInflate(
ExtractHeader(&header, gzipHeaderDictObj);
SetValue(gzipHeaderDictObj, "size",
Tcl_NewWideIntObj(stream.total_out));
- ckfree(nameBuf);
- ckfree(commentBuf);
+ Tcl_Free(nameBuf);
+ Tcl_Free(commentBuf);
}
Tcl_SetObjResult(interp, obj);
return TCL_OK;
@@ -1871,10 +1876,10 @@ Tcl_ZlibInflate(
TclDecrRefCount(obj);
ConvertError(interp, e, stream.adler);
if (nameBuf) {
- ckfree(nameBuf);
+ Tcl_Free(nameBuf);
}
if (commentBuf) {
- ckfree(commentBuf);
+ Tcl_Free(commentBuf);
}
return TCL_ERROR;
}
@@ -1893,7 +1898,7 @@ unsigned int
Tcl_ZlibCRC32(
unsigned int crc,
const unsigned char *buf,
- int len)
+ size_t len)
{
/* Nothing much to do, just wrap the crc32(). */
return crc32(crc, (Bytef *) buf, len);
@@ -1903,7 +1908,7 @@ unsigned int
Tcl_ZlibAdler32(
unsigned int adler,
const unsigned char *buf,
- int len)
+ size_t len)
{
return adler32(adler, (Bytef *) buf, len);
}
@@ -1925,8 +1930,9 @@ ZlibCmd(
int objc,
Tcl_Obj *const objv[])
{
- int command, dlen, i, option, level = -1;
- unsigned start, buffersize = 0;
+ int command, i, option, level = -1;
+ size_t dlen = 0, start, buffersize = 0;
+ Tcl_WideInt wideLen;
Byte *data;
Tcl_Obj *headerDictObj;
const char *extraInfoStr = NULL;
@@ -1963,7 +1969,7 @@ ZlibCmd(
if (objc < 4) {
start = Tcl_ZlibAdler32(0, NULL, 0);
}
- data = Tcl_GetByteArrayFromObj(objv[2], &dlen);
+ data = TclGetByteArrayFromObj(objv[2], &dlen);
Tcl_SetObjResult(interp, Tcl_NewWideIntObj((Tcl_WideInt)
(uLong) Tcl_ZlibAdler32(start, data, dlen)));
return TCL_OK;
@@ -1980,7 +1986,7 @@ ZlibCmd(
if (objc < 4) {
start = Tcl_ZlibCRC32(0, NULL, 0);
}
- data = Tcl_GetByteArrayFromObj(objv[2], &dlen);
+ data = TclGetByteArrayFromObj(objv[2], &dlen);
Tcl_SetObjResult(interp, Tcl_NewWideIntObj((Tcl_WideInt)
(uLong) Tcl_ZlibCRC32(start, data, dlen)));
return TCL_OK;
@@ -2073,14 +2079,15 @@ ZlibCmd(
return TCL_ERROR;
}
if (objc > 3) {
- if (Tcl_GetIntFromObj(interp, objv[3],
- (int *) &buffersize) != TCL_OK) {
+ if (Tcl_GetWideIntFromObj(interp, objv[3],
+ &wideLen) != TCL_OK) {
return TCL_ERROR;
}
- if (buffersize < MIN_NONSTREAM_BUFFER_SIZE
- || buffersize > MAX_BUFFER_SIZE) {
+ if (wideLen < MIN_NONSTREAM_BUFFER_SIZE
+ || wideLen > MAX_BUFFER_SIZE) {
goto badBuffer;
}
+ buffersize = wideLen;
}
return Tcl_ZlibInflate(interp, TCL_ZLIB_FORMAT_RAW, objv[2],
buffersize, NULL);
@@ -2092,14 +2099,15 @@ ZlibCmd(
return TCL_ERROR;
}
if (objc > 3) {
- if (Tcl_GetIntFromObj(interp, objv[3],
- (int *) &buffersize) != TCL_OK) {
+ if (Tcl_GetWideIntFromObj(interp, objv[3],
+ &wideLen) != TCL_OK) {
return TCL_ERROR;
}
- if (buffersize < MIN_NONSTREAM_BUFFER_SIZE
- || buffersize > MAX_BUFFER_SIZE) {
+ if (wideLen < MIN_NONSTREAM_BUFFER_SIZE
+ || wideLen > MAX_BUFFER_SIZE) {
goto badBuffer;
}
+ buffersize = wideLen;
}
return Tcl_ZlibInflate(interp, TCL_ZLIB_FORMAT_ZLIB, objv[2],
buffersize, NULL);
@@ -2123,14 +2131,15 @@ ZlibCmd(
}
switch (option) {
case 0:
- if (Tcl_GetIntFromObj(interp, objv[i+1],
- (int *) &buffersize) != TCL_OK) {
+ if (Tcl_GetWideIntFromObj(interp, objv[i+1],
+ &wideLen) != TCL_OK) {
return TCL_ERROR;
}
- if (buffersize < MIN_NONSTREAM_BUFFER_SIZE
- || buffersize > MAX_BUFFER_SIZE) {
+ if (wideLen < MIN_NONSTREAM_BUFFER_SIZE
+ || wideLen > MAX_BUFFER_SIZE) {
goto badBuffer;
}
+ buffersize = wideLen;
break;
case 1:
headerVarObj = objv[i+1];
@@ -2733,9 +2742,9 @@ ZlibStreamAddCmd(
*/
if (compDictObj != NULL) {
- int len;
+ size_t len = 0;
- (void) Tcl_GetByteArrayFromObj(compDictObj, &len);
+ (void) TclGetByteArrayFromObj(compDictObj, &len);
if (len == 0) {
compDictObj = NULL;
}
@@ -2837,9 +2846,9 @@ ZlibStreamPutCmd(
*/
if (compDictObj != NULL) {
- int len;
+ size_t len = 0;
- (void) Tcl_GetByteArrayFromObj(compDictObj, &len);
+ (void) TclGetByteArrayFromObj(compDictObj, &len);
if (len == 0) {
compDictObj = NULL;
}
@@ -2898,7 +2907,8 @@ ZlibTransformClose(
Tcl_Interp *interp)
{
ZlibChannelData *cd = instanceData;
- int e, written, result = TCL_OK;
+ int e, result = TCL_OK;
+ size_t written;
/*
* Delete the support timer.
@@ -2962,14 +2972,14 @@ ZlibTransformClose(
Tcl_DStringFree(&cd->decompressed);
if (cd->inBuffer) {
- ckfree(cd->inBuffer);
+ Tcl_Free(cd->inBuffer);
cd->inBuffer = NULL;
}
if (cd->outBuffer) {
- ckfree(cd->outBuffer);
+ Tcl_Free(cd->outBuffer);
cd->outBuffer = NULL;
}
- ckfree(cd);
+ Tcl_Free(cd);
return result;
}
@@ -3035,13 +3045,13 @@ ZlibTransformInput(
* Three cases here:
* 1. Got some data from the underlying channel (readBytes > 0) so
* it should be fed through the decompression engine.
- * 2. Got an error (readBytes < 0) which we should report up except
+ * 2. Got an error (readBytes == -1) which we should report up except
* for the case where we can convert it to a short read.
* 3. Got an end-of-data from EOF or blocking (readBytes == 0). If
* it is EOF, try flushing the data out of the decompressor.
*/
- if (readBytes < 0) {
+ if (readBytes == -1) {
/* See ReflectInput() in tclIORTrans.c */
if (Tcl_InputBlocked(cd->parent) && (gotBytes > 0)) {
@@ -3107,7 +3117,8 @@ ZlibTransformOutput(
ZlibChannelData *cd = instanceData;
Tcl_DriverOutputProc *outProc =
Tcl_ChannelOutputProc(Tcl_GetChannelType(cd->parent));
- int e, produced;
+ int e;
+ size_t produced;
Tcl_Obj *errObj;
if (cd->mode == TCL_ZLIB_STREAM_INFLATE) {
@@ -3169,7 +3180,8 @@ ZlibTransformFlush(
ZlibChannelData *cd,
int flushType)
{
- int e, len;
+ int e;
+ size_t len;
cd->outStream.avail_in = 0;
do {
@@ -3241,7 +3253,7 @@ ZlibTransformSetOption( /* not used */
TclNewStringObj(compDictObj, value, strlen(value));
Tcl_IncrRefCount(compDictObj);
- (void) Tcl_GetByteArrayFromObj(compDictObj, NULL);
+ Tcl_GetByteArrayFromObj(compDictObj, NULL);
if (cd->compDictObj) {
TclDecrRefCount(cd->compDictObj);
}
@@ -3382,16 +3394,16 @@ ZlibTransformGetOption(
Tcl_DStringAppendElement(dsPtr, "-dictionary");
if (cd->compDictObj) {
Tcl_DStringAppendElement(dsPtr,
- Tcl_GetString(cd->compDictObj));
+ TclGetString(cd->compDictObj));
} else {
Tcl_DStringAppendElement(dsPtr, "");
}
} else {
if (cd->compDictObj) {
- int len;
- const char *str = TclGetStringFromObj(cd->compDictObj, &len);
+ size_t length;
+ const char *str = TclGetStringFromObj(cd->compDictObj, &length);
- Tcl_DStringAppend(dsPtr, str, len);
+ Tcl_DStringAppend(dsPtr, str, length);
}
return TCL_OK;
}
@@ -3409,7 +3421,7 @@ ZlibTransformGetOption(
ExtractHeader(&cd->inHeader.header, tmpObj);
if (optionName == NULL) {
Tcl_DStringAppendElement(dsPtr, "-header");
- Tcl_DStringAppendElement(dsPtr, Tcl_GetString(tmpObj));
+ Tcl_DStringAppendElement(dsPtr, TclGetString(tmpObj));
Tcl_DecrRefCount(tmpObj);
} else {
TclDStringAppendObj(dsPtr, tmpObj);
@@ -3592,7 +3604,7 @@ ZlibStackChannelTransform(
* dictionary (not dictObj!) to use if
* necessary. */
{
- ZlibChannelData *cd = ckalloc(sizeof(ZlibChannelData));
+ ZlibChannelData *cd = Tcl_Alloc(sizeof(ZlibChannelData));
Tcl_Channel chan;
int wbits = 0;
@@ -3652,7 +3664,7 @@ ZlibStackChannelTransform(
goto error;
}
cd->inAllocated = DEFAULT_BUFFER_SIZE;
- cd->inBuffer = ckalloc(cd->inAllocated);
+ cd->inBuffer = Tcl_Alloc(cd->inAllocated);
if (cd->flags & IN_HEADER) {
if (inflateGetHeader(&cd->inStream, &cd->inHeader.header) != Z_OK) {
goto error;
@@ -3669,7 +3681,7 @@ ZlibStackChannelTransform(
goto error;
}
cd->outAllocated = DEFAULT_BUFFER_SIZE;
- cd->outBuffer = ckalloc(cd->outAllocated);
+ cd->outBuffer = Tcl_Alloc(cd->outAllocated);
if (cd->flags & OUT_HEADER) {
if (deflateSetHeader(&cd->outStream, &cd->outHeader.header) != Z_OK) {
goto error;
@@ -3696,17 +3708,17 @@ ZlibStackChannelTransform(
error:
if (cd->inBuffer) {
- ckfree(cd->inBuffer);
+ Tcl_Free(cd->inBuffer);
inflateEnd(&cd->inStream);
}
if (cd->outBuffer) {
- ckfree(cd->outBuffer);
+ Tcl_Free(cd->outBuffer);
deflateEnd(&cd->outStream);
}
if (cd->compDictObj) {
Tcl_DecrRefCount(cd->compDictObj);
}
- ckfree(cd);
+ Tcl_Free(cd);
return NULL;
}
@@ -3732,9 +3744,9 @@ static inline int
ResultCopy(
ZlibChannelData *cd, /* The location of the buffer to read from. */
char *buf, /* The buffer to copy into */
- int toRead) /* Number of requested bytes */
+ size_t toRead) /* Number of requested bytes */
{
- int have = Tcl_DStringLength(&cd->decompressed);
+ size_t have = Tcl_DStringLength(&cd->decompressed);
if (have == 0) {
/*
@@ -3920,7 +3932,7 @@ TclZlibInit(
* Formally provide the package as a Tcl built-in.
*/
- return Tcl_PkgProvide(interp, "zlib", TCL_ZLIB_VERSION);
+ return Tcl_PkgProvideEx(interp, "zlib", TCL_ZLIB_VERSION, NULL);
}
/*
@@ -3995,7 +4007,7 @@ int
Tcl_ZlibStreamGet(
Tcl_ZlibStream zshandle,
Tcl_Obj *data,
- int count)
+ size_t count)
{
return TCL_OK;
}
@@ -4020,7 +4032,7 @@ Tcl_ZlibInflate(
Tcl_Interp *interp,
int format,
Tcl_Obj *data,
- int bufferSize,
+ size_t bufferSize,
Tcl_Obj *gzipHeaderDictObj)
{
if (interp) {
@@ -4033,8 +4045,8 @@ Tcl_ZlibInflate(
unsigned int
Tcl_ZlibCRC32(
unsigned int crc,
- const char *buf,
- int len)
+ const unsigned char *buf,
+ size_t len)
{
return 0;
}
@@ -4042,8 +4054,8 @@ Tcl_ZlibCRC32(
unsigned int
Tcl_ZlibAdler32(
unsigned int adler,
- const char *buf,
- int len)
+ const unsigned char *buf,
+ size_t len)
{
return 0;
}
diff --git a/library/http/cookiejar.tcl b/library/http/cookiejar.tcl
index 2eae877..4aea842 100644
--- a/library/http/cookiejar.tcl
+++ b/library/http/cookiejar.tcl
@@ -8,7 +8,7 @@
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
# Dependencies
-package require Tcl 8.6
+package require Tcl 8.6-
package require http 2.8.4
package require sqlite3
package require tcl::idna 1.0
diff --git a/library/init.tcl b/library/init.tcl
index d5b9c03..98ed2f5 100644
--- a/library/init.tcl
+++ b/library/init.tcl
@@ -19,7 +19,7 @@
if {[info commands package] == ""} {
error "version mismatch: library\nscripts expect Tcl version 7.5b1 or later but the loaded version is\nonly [info patchlevel]"
}
-package require -exact Tcl 8.7a2
+package require -exact Tcl 9.0a0
# Compute the auto path to use in this interpreter.
# The values on the path come from several locations:
diff --git a/library/safe.tcl b/library/safe.tcl
index 7b165d2..ef370b5 100644
--- a/library/safe.tcl
+++ b/library/safe.tcl
@@ -113,7 +113,7 @@ proc ::safe::CheckInterp {slave} {
# we had the bad idea to support for the sake of user simplicity in
# create/init but which makes life hard in configure...
# So this will be hopefully written and some integrated with opt1.0
-# (hopefully for tcl8.1 ?)
+# (hopefully for tcl9.0 ?)
proc ::safe::interpConfigure {args} {
switch [llength $args] {
1 {
diff --git a/library/tzdata/SystemV/AST4 b/library/tzdata/SystemV/AST4
deleted file mode 100644
index eced0d2..0000000
--- a/library/tzdata/SystemV/AST4
+++ /dev/null
@@ -1,5 +0,0 @@
-# created by ../tools/tclZIC.tcl - do not edit
-if {![info exists TZData(America/Puerto_Rico)]} {
- LoadTimeZoneFile America/Puerto_Rico
-}
-set TZData(:SystemV/AST4) $TZData(:America/Puerto_Rico)
diff --git a/library/tzdata/SystemV/AST4ADT b/library/tzdata/SystemV/AST4ADT
deleted file mode 100644
index c24308f..0000000
--- a/library/tzdata/SystemV/AST4ADT
+++ /dev/null
@@ -1,5 +0,0 @@
-# created by ../tools/tclZIC.tcl - do not edit
-if {![info exists TZData(America/Halifax)]} {
- LoadTimeZoneFile America/Halifax
-}
-set TZData(:SystemV/AST4ADT) $TZData(:America/Halifax)
diff --git a/library/tzdata/SystemV/CST6 b/library/tzdata/SystemV/CST6
deleted file mode 100644
index d46c015..0000000
--- a/library/tzdata/SystemV/CST6
+++ /dev/null
@@ -1,5 +0,0 @@
-# created by ../tools/tclZIC.tcl - do not edit
-if {![info exists TZData(America/Regina)]} {
- LoadTimeZoneFile America/Regina
-}
-set TZData(:SystemV/CST6) $TZData(:America/Regina)
diff --git a/library/tzdata/SystemV/CST6CDT b/library/tzdata/SystemV/CST6CDT
deleted file mode 100644
index 234af89..0000000
--- a/library/tzdata/SystemV/CST6CDT
+++ /dev/null
@@ -1,5 +0,0 @@
-# created by ../tools/tclZIC.tcl - do not edit
-if {![info exists TZData(America/Chicago)]} {
- LoadTimeZoneFile America/Chicago
-}
-set TZData(:SystemV/CST6CDT) $TZData(:America/Chicago)
diff --git a/library/tzdata/SystemV/EST5 b/library/tzdata/SystemV/EST5
deleted file mode 100644
index 52818c1..0000000
--- a/library/tzdata/SystemV/EST5
+++ /dev/null
@@ -1,5 +0,0 @@
-# created by ../tools/tclZIC.tcl - do not edit
-if {![info exists TZData(America/Indianapolis)]} {
- LoadTimeZoneFile America/Indianapolis
-}
-set TZData(:SystemV/EST5) $TZData(:America/Indianapolis)
diff --git a/library/tzdata/SystemV/EST5EDT b/library/tzdata/SystemV/EST5EDT
deleted file mode 100644
index 6cf2743..0000000
--- a/library/tzdata/SystemV/EST5EDT
+++ /dev/null
@@ -1,5 +0,0 @@
-# created by ../tools/tclZIC.tcl - do not edit
-if {![info exists TZData(America/New_York)]} {
- LoadTimeZoneFile America/New_York
-}
-set TZData(:SystemV/EST5EDT) $TZData(:America/New_York)
diff --git a/library/tzdata/SystemV/HST10 b/library/tzdata/SystemV/HST10
deleted file mode 100644
index a4316af..0000000
--- a/library/tzdata/SystemV/HST10
+++ /dev/null
@@ -1,5 +0,0 @@
-# created by ../tools/tclZIC.tcl - do not edit
-if {![info exists TZData(Pacific/Honolulu)]} {
- LoadTimeZoneFile Pacific/Honolulu
-}
-set TZData(:SystemV/HST10) $TZData(:Pacific/Honolulu)
diff --git a/library/tzdata/SystemV/MST7 b/library/tzdata/SystemV/MST7
deleted file mode 100644
index e67a781..0000000
--- a/library/tzdata/SystemV/MST7
+++ /dev/null
@@ -1,5 +0,0 @@
-# created by ../tools/tclZIC.tcl - do not edit
-if {![info exists TZData(America/Phoenix)]} {
- LoadTimeZoneFile America/Phoenix
-}
-set TZData(:SystemV/MST7) $TZData(:America/Phoenix)
diff --git a/library/tzdata/SystemV/MST7MDT b/library/tzdata/SystemV/MST7MDT
deleted file mode 100644
index fda5bf1..0000000
--- a/library/tzdata/SystemV/MST7MDT
+++ /dev/null
@@ -1,5 +0,0 @@
-# created by ../tools/tclZIC.tcl - do not edit
-if {![info exists TZData(America/Denver)]} {
- LoadTimeZoneFile America/Denver
-}
-set TZData(:SystemV/MST7MDT) $TZData(:America/Denver)
diff --git a/library/tzdata/SystemV/PST8 b/library/tzdata/SystemV/PST8
deleted file mode 100644
index 8e30bb8..0000000
--- a/library/tzdata/SystemV/PST8
+++ /dev/null
@@ -1,5 +0,0 @@
-# created by ../tools/tclZIC.tcl - do not edit
-if {![info exists TZData(Pacific/Pitcairn)]} {
- LoadTimeZoneFile Pacific/Pitcairn
-}
-set TZData(:SystemV/PST8) $TZData(:Pacific/Pitcairn)
diff --git a/library/tzdata/SystemV/PST8PDT b/library/tzdata/SystemV/PST8PDT
deleted file mode 100644
index 8281a9a..0000000
--- a/library/tzdata/SystemV/PST8PDT
+++ /dev/null
@@ -1,5 +0,0 @@
-# created by ../tools/tclZIC.tcl - do not edit
-if {![info exists TZData(America/Los_Angeles)]} {
- LoadTimeZoneFile America/Los_Angeles
-}
-set TZData(:SystemV/PST8PDT) $TZData(:America/Los_Angeles)
diff --git a/library/tzdata/SystemV/YST9 b/library/tzdata/SystemV/YST9
deleted file mode 100644
index 32d3717..0000000
--- a/library/tzdata/SystemV/YST9
+++ /dev/null
@@ -1,5 +0,0 @@
-# created by ../tools/tclZIC.tcl - do not edit
-if {![info exists TZData(Pacific/Gambier)]} {
- LoadTimeZoneFile Pacific/Gambier
-}
-set TZData(:SystemV/YST9) $TZData(:Pacific/Gambier)
diff --git a/library/tzdata/SystemV/YST9YDT b/library/tzdata/SystemV/YST9YDT
deleted file mode 100644
index fba405f..0000000
--- a/library/tzdata/SystemV/YST9YDT
+++ /dev/null
@@ -1,5 +0,0 @@
-# created by ../tools/tclZIC.tcl - do not edit
-if {![info exists TZData(America/Anchorage)]} {
- LoadTimeZoneFile America/Anchorage
-}
-set TZData(:SystemV/YST9YDT) $TZData(:America/Anchorage)
diff --git a/macosx/README b/macosx/README
index 43c9c47..dfc8c11 100644
--- a/macosx/README
+++ b/macosx/README
@@ -113,7 +113,7 @@ The following build configurations are available:
The Xcode projects refer to the toplevel tcl source directory via the
TCL_SRCROOT user build setting, by default this is set to the project-relative
path '../../tcl', if your tcl source directory is named differently, e.g.
-'../../tcl8.7', you need to manually change the TCL_SRCROOT setting by editing
+'../../tcl9.0', you need to manually change the TCL_SRCROOT setting by editing
your ${USER}.pbxuser file (located inside the Tcl.xcodeproj bundle directory)
with a text editor.
@@ -134,9 +134,9 @@ Detailed Instructions for building with macosx/GNUmakefile
- Unpack the Tcl source release archive.
- The following instructions assume the Tcl source tree is named "tcl${ver}",
-(where ${ver} is a shell variable containing the Tcl version number e.g. '8.7').
+(where ${ver} is a shell variable containing the Tcl version number e.g. '9.0').
Setup this shell variable as follows:
- ver="8.7"
+ ver="9.0"
If you are building from CVS, omit this step (CVS source tree names usually do
not contain a version number).
diff --git a/macosx/Tcl-Common.xcconfig b/macosx/Tcl-Common.xcconfig
index 0670479..22c6570 100644
--- a/macosx/Tcl-Common.xcconfig
+++ b/macosx/Tcl-Common.xcconfig
@@ -34,4 +34,4 @@ TCL_CONFIGURE_ARGS = --enable-dtrace
TCL_LIBRARY = $(LIBDIR)/tcl$(VERSION)
TCL_PACKAGE_PATH = "$(LIBDIR)"
TCL_DEFS = HAVE_TCL_CONFIG_H
-VERSION = 8.7
+VERSION = 9.0
diff --git a/macosx/Tcl.xcode/project.pbxproj b/macosx/Tcl.xcode/project.pbxproj
index 5fb9a47..dac7f32 100644
--- a/macosx/Tcl.xcode/project.pbxproj
+++ b/macosx/Tcl.xcode/project.pbxproj
@@ -1338,7 +1338,6 @@
F96D3F3B08F272A8004A47F5 /* dde */,
F96D3F8C08F272A8004A47F5 /* history.tcl */,
F96D3F8D08F272A8004A47F5 /* http */,
- F96D3F9008F272A8004A47F5 /* http1.0 */,
F96D3F9308F272A8004A47F5 /* init.tcl */,
F96D3F9408F272A8004A47F5 /* msgcat */,
F96D401708F272AA004A47F5 /* opt */,
@@ -1372,15 +1371,6 @@
path = http;
sourceTree = "<group>";
};
- F96D3F9008F272A8004A47F5 /* http1.0 */ = {
- isa = PBXGroup;
- children = (
- F96D3F9108F272A8004A47F5 /* http.tcl */,
- F96D3F9208F272A8004A47F5 /* pkgIndex.tcl */,
- );
- path = http1.0;
- sourceTree = "<group>";
- };
F96D3F9408F272A8004A47F5 /* msgcat */ = {
isa = PBXGroup;
children = (
diff --git a/macosx/Tcl.xcodeproj/project.pbxproj b/macosx/Tcl.xcodeproj/project.pbxproj
index 408af36..fb120b0 100644
--- a/macosx/Tcl.xcodeproj/project.pbxproj
+++ b/macosx/Tcl.xcodeproj/project.pbxproj
@@ -1339,7 +1339,6 @@
F96D3F3B08F272A8004A47F5 /* dde */,
F96D3F8C08F272A8004A47F5 /* history.tcl */,
F96D3F8D08F272A8004A47F5 /* http */,
- F96D3F9008F272A8004A47F5 /* http1.0 */,
F96D3F9308F272A8004A47F5 /* init.tcl */,
F96D3F9408F272A8004A47F5 /* msgcat */,
F96D401708F272AA004A47F5 /* opt */,
@@ -1373,15 +1372,6 @@
path = http;
sourceTree = "<group>";
};
- F96D3F9008F272A8004A47F5 /* http1.0 */ = {
- isa = PBXGroup;
- children = (
- F96D3F9108F272A8004A47F5 /* http.tcl */,
- F96D3F9208F272A8004A47F5 /* pkgIndex.tcl */,
- );
- path = http1.0;
- sourceTree = "<group>";
- };
F96D3F9408F272A8004A47F5 /* msgcat */ = {
isa = PBXGroup;
children = (
diff --git a/macosx/tclMacOSXBundle.c b/macosx/tclMacOSXBundle.c
index dad3733..eeaf7b9 100644
--- a/macosx/tclMacOSXBundle.c
+++ b/macosx/tclMacOSXBundle.c
@@ -167,7 +167,7 @@ Tcl_MacOSXOpenBundleResources(
Tcl_Interp *interp,
const char *bundleName,
int hasResourceFile,
- int maxPathLen,
+ size_t maxPathLen,
char *libraryPath)
{
return Tcl_MacOSXOpenVersionedBundleResources(interp, bundleName, NULL,
@@ -201,7 +201,7 @@ Tcl_MacOSXOpenVersionedBundleResources(
const char *bundleName,
const char *bundleVersion,
int hasResourceFile,
- int maxPathLen,
+ size_t maxPathLen,
char *libraryPath)
{
#ifdef HAVE_COREFOUNDATION
diff --git a/macosx/tclMacOSXFCmd.c b/macosx/tclMacOSXFCmd.c
index 7c65088..0f40817 100644
--- a/macosx/tclMacOSXFCmd.c
+++ b/macosx/tclMacOSXFCmd.c
@@ -639,9 +639,10 @@ SetOSTypeFromAny(
int result = TCL_OK;
Tcl_DString ds;
Tcl_Encoding encoding = Tcl_GetEncoding(NULL, "macRoman");
+ size_t length;
- string = TclGetString(objPtr);
- Tcl_UtfToExternalDString(encoding, string, objPtr->length, &ds);
+ string = TclGetStringFromObj(objPtr, &length);
+ Tcl_UtfToExternalDString(encoding, string, length, &ds);
if (Tcl_DStringLength(&ds) > 4) {
if (interp) {
diff --git a/macosx/tclMacOSXNotify.c b/macosx/tclMacOSXNotify.c
index b21130b..aa00475 100644
--- a/macosx/tclMacOSXNotify.c
+++ b/macosx/tclMacOSXNotify.c
@@ -1036,7 +1036,7 @@ Tcl_CreateFileHandler(
}
}
if (filePtr == NULL) {
- filePtr = ckalloc(sizeof(FileHandler));
+ filePtr = Tcl_Alloc(sizeof(FileHandler));
filePtr->fd = fd;
filePtr->readyMask = 0;
filePtr->nextPtr = tsdPtr->firstFileHandlerPtr;
@@ -1164,7 +1164,7 @@ Tcl_DeleteFileHandler(
} else {
prevPtr->nextPtr = filePtr->nextPtr;
}
- ckfree(filePtr);
+ Tcl_Free(filePtr);
}
/*
@@ -1419,7 +1419,7 @@ QueueFileEvents(
*/
if (filePtr->readyMask == 0) {
- FileHandlerEvent *fileEvPtr = ckalloc(sizeof(FileHandlerEvent));
+ FileHandlerEvent *fileEvPtr = Tcl_Alloc(sizeof(FileHandlerEvent));
fileEvPtr->header.proc = FileHandlerEventProc;
fileEvPtr->fd = filePtr->fd;
diff --git a/tests/assemble.test b/tests/assemble.test
index 05c1f9b..8c50500 100644
--- a/tests/assemble.test
+++ b/tests/assemble.test
@@ -532,18 +532,6 @@ test assemble-7.16 {incrStk} {
-result 12
-cleanup {rename x {}}
}
-test assemble-7.17 {land/lor} {
- -body {
- proc x {a b} {
- list \
- [assemble {load a; load b; land}] \
- [assemble {load a; load b; lor}]
- }
- list [x 0 0] [x 0 23] [x 35 0] [x 47 59]
- }
- -result {{0 0} {0 1} {0 1} {1 1}}
- -cleanup {rename x {}}
-}
test assemble-7.18 {lappendArrayStk} {
-body {
proc x {} {
@@ -781,7 +769,7 @@ test assemble-7.43 {uplus} {
}
}
-returnCodes error
- -result {can't use non-numeric floating-point value as operand of "+"}
+ -result {can't use non-numeric floating-point value "NaN" as operand of "+"}
}
test assemble-7.43.1 {tryCvtToNumeric} {
-body {
diff --git a/tests/case.test b/tests/case.test
deleted file mode 100644
index d7558a9..0000000
--- a/tests/case.test
+++ /dev/null
@@ -1,94 +0,0 @@
-# Commands covered: case
-#
-# This file contains a collection of tests for one or more of the Tcl
-# built-in commands. Sourcing this file into Tcl runs the tests and
-# generates output for errors. No output means no errors were found.
-#
-# Copyright (c) 1991-1993 The Regents of the University of California.
-# Copyright (c) 1994 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-
-if {![llength [info commands case]]} {
- # No "case" command? So no need to test
- return
-}
-
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
- namespace import -force ::tcltest::*
-}
-
-test case-1.1 {simple pattern} {
- case a in a {format 1} b {format 2} c {format 3} default {format 4}
-} 1
-test case-1.2 {simple pattern} {
- case b a {format 1} b {format 2} c {format 3} default {format 4}
-} 2
-test case-1.3 {simple pattern} {
- case x in a {format 1} b {format 2} c {format 3} default {format 4}
-} 4
-test case-1.4 {simple pattern} {
- case x a {format 1} b {format 2} c {format 3}
-} {}
-test case-1.5 {simple pattern matches many times} {
- case b a {format 1} b {format 2} b {format 3} b {format 4}
-} 2
-test case-1.6 {fancier pattern} {
- case cx a {format 1} *c {format 2} *x {format 3} default {format 4}
-} 3
-test case-1.7 {list of patterns} {
- case abc in {a b c} {format 1} {def abc ghi} {format 2}
-} 2
-
-test case-2.1 {error in executed command} {
- list [catch {case a in a {error "Just a test"} default {format 1}} msg] \
- $msg $::errorInfo
-} {1 {Just a test} {Just a test
- while executing
-"error "Just a test""
- ("a" arm line 1)
- invoked from within
-"case a in a {error "Just a test"} default {format 1}"}}
-test case-2.2 {error: not enough args} {
- list [catch {case} msg] $msg
-} {1 {wrong # args: should be "case string ?in? ?pattern body ...? ?default body?"}}
-test case-2.3 {error: pattern with no body} {
- list [catch {case a b} msg] $msg
-} {1 {extra case pattern with no body}}
-test case-2.4 {error: pattern with no body} {
- list [catch {case a in b {format 1} c} msg] $msg
-} {1 {extra case pattern with no body}}
-test case-2.5 {error in default command} {
- list [catch {case foo in a {error case1} default {error case2} \
- b {error case 3}} msg] $msg $::errorInfo
-} {1 case2 {case2
- while executing
-"error case2"
- ("default" arm line 1)
- invoked from within
-"case foo in a {error case1} default {error case2} b {error case 3}"}}
-
-test case-3.1 {single-argument form for pattern/command pairs} {
- case b in {
- a {format 1}
- b {format 2}
- default {format 6}
- }
-} {2}
-test case-3.2 {single-argument form for pattern/command pairs} {
- case b {
- a {format 1}
- b {format 2}
- default {format 6}
- }
-} {2}
-test case-3.3 {single-argument form for pattern/command pairs} {
- list [catch {case z in {a 2 b}} msg] $msg
-} {1 {extra case pattern with no body}}
-
-# cleanup
-::tcltest::cleanupTests
-return
diff --git a/tests/cmdAH.test b/tests/cmdAH.test
index b15c77d..588dce1 100644
--- a/tests/cmdAH.test
+++ b/tests/cmdAH.test
@@ -21,10 +21,6 @@ catch [list package require -exact Tcltest [info patchlevel]]
testConstraint testchmod [llength [info commands testchmod]]
testConstraint testsetplatform [llength [info commands testsetplatform]]
testConstraint testvolumetype [llength [info commands testvolumetype]]
-testConstraint time64bit [expr {
- $::tcl_platform(pointerSize) >= 8 ||
- [llength [info command testsize]] && [testsize time_t] >= 8
-}]
testConstraint linkDirectory [expr {
![testConstraint win] ||
($::tcl_platform(osVersion) >= 5.0
@@ -64,8 +60,6 @@ test cmdAH-0.2 {Tcl_BreakObjCmd, success} {
list [catch {break} msg] $msg
} {3 {}}
-# Tcl_CaseObjCmd is tested in case.test
-
test cmdAH-1.1 {Tcl_CatchObjCmd, errors} -returnCodes error -body {
catch
} -result {wrong # args: should be "catch script ?resultVarName? ?optionVarName?"}
@@ -1296,14 +1290,14 @@ test cmdAH-24.14.1 {
} -match regexp -result {could not (?:get modification time|read)} -returnCodes error
# 3155760000 is 64-bit unix time, Wed Jan 01 00:00:00 GMT 2070:
-test cmdAH-24.20.1 {Tcl_FileObjCmd: atime 64-bit time_t, bug [4718b41c56]} -constraints {time64bit} -setup {
+test cmdAH-24.20.1 {Tcl_FileObjCmd: atime 64-bit time_t, bug [4718b41c56]} -setup {
set filename [makeFile "" foo.text]
} -body {
list [file atime $filename 3155760000] [file atime $filename]
} -cleanup {
removeFile $filename
} -result {3155760000 3155760000}
-test cmdAH-24.20.2 {Tcl_FileObjCmd: mtime 64-bit time_t, bug [4718b41c56]} -constraints {time64bit} -setup {
+test cmdAH-24.20.2 {Tcl_FileObjCmd: mtime 64-bit time_t, bug [4718b41c56]} -setup {
set filename [makeFile "" foo.text]
} -body {
list [file mtime $filename 3155760000] [file mtime $filename]
diff --git a/tests/compExpr-old.test b/tests/compExpr-old.test
index e57f799..634bb41 100644
--- a/tests/compExpr-old.test
+++ b/tests/compExpr-old.test
@@ -18,7 +18,6 @@ if {[lsearch [namespace children] ::tcltest] == -1} {
}
::tcltest::loadTestedCommands
-catch [list package require -exact Tcltest [info patchlevel]]
# Big test for correct ordering of data in [expr]
@@ -279,10 +278,10 @@ test compExpr-old-6.8 {CompileBitXorExpr: error compiling bitxor arm} -body {
} -returnCodes error -match glob -result *
test compExpr-old-6.9 {CompileBitXorExpr: runtime error in bitxor arm} {
list [catch {expr {24.0^3}} msg] $msg
-} {1 {can't use floating-point value as operand of "^"}}
+} {1 {can't use floating-point value "24.0" as operand of "^"}}
test compExpr-old-6.10 {CompileBitXorExpr: runtime error in bitxor arm} {
list [catch {expr {"a"^"b"}} msg] $msg
-} {1 {can't use non-numeric string as operand of "^"}}
+} {1 {can't use non-numeric string "a" as operand of "^"}}
test compExpr-old-7.1 {CompileBitAndExpr: just equality expr} {expr 3==2} 0
test compExpr-old-7.2 {CompileBitAndExpr: just equality expr} {expr 2.0==2} 1
@@ -303,10 +302,10 @@ test compExpr-old-7.11 {CompileBitAndExpr: error compiling bitand arm} -body {
} -returnCodes error -match glob -result *
test compExpr-old-7.12 {CompileBitAndExpr: runtime error in bitand arm} {
list [catch {expr {24.0&3}} msg] $msg
-} {1 {can't use floating-point value as operand of "&"}}
+} {1 {can't use floating-point value "24.0" as operand of "&"}}
test compExpr-old-7.13 {CompileBitAndExpr: runtime error in bitand arm} {
list [catch {expr {"a"&"b"}} msg] $msg
-} {1 {can't use non-numeric string as operand of "&"}}
+} {1 {can't use non-numeric string "a" as operand of "&"}}
test compExpr-old-8.1 {CompileEqualityExpr: just relational expr} {expr 3>=2} 1
test compExpr-old-8.2 {CompileEqualityExpr: just relational expr} {expr 2<=2.1} 1
@@ -364,10 +363,10 @@ test compExpr-old-10.9 {CompileShiftExpr: error compiling shift arm} -body {
} -returnCodes error -match glob -result *
test compExpr-old-10.10 {CompileShiftExpr: runtime error} {
list [catch {expr {24.0>>43}} msg] $msg
-} {1 {can't use floating-point value as operand of ">>"}}
+} {1 {can't use floating-point value "24.0" as operand of ">>"}}
test compExpr-old-10.11 {CompileShiftExpr: runtime error} {
list [catch {expr {"a"<<"b"}} msg] $msg
-} {1 {can't use non-numeric string as operand of "<<"}}
+} {1 {can't use non-numeric string "a" as operand of "<<"}}
test compExpr-old-11.1 {CompileAddExpr: just multiply expr} {expr 4*-2} -8
test compExpr-old-11.2 {CompileAddExpr: just multiply expr} {expr 0xff%2} 1
@@ -386,10 +385,10 @@ test compExpr-old-11.9 {CompileAddExpr: error compiling add arm} -body {
} -returnCodes error -match glob -result *
test compExpr-old-11.10 {CompileAddExpr: runtime error} {
list [catch {expr {24.0+"xx"}} msg] $msg
-} {1 {can't use non-numeric string as operand of "+"}}
+} {1 {can't use non-numeric string "xx" as operand of "+"}}
test compExpr-old-11.11 {CompileAddExpr: runtime error} {
list [catch {expr {"a"-"b"}} msg] $msg
-} {1 {can't use non-numeric string as operand of "-"}}
+} {1 {can't use non-numeric string "a" as operand of "-"}}
test compExpr-old-11.12 {CompileAddExpr: runtime error} {
list [catch {expr {3/0}} msg] $msg
} {1 {divide by zero}}
@@ -417,10 +416,10 @@ test compExpr-old-12.9 {CompileMultiplyExpr: error compiling multiply arm} -body
} -returnCodes error -match glob -result *
test compExpr-old-12.10 {CompileMultiplyExpr: runtime error} {
list [catch {expr {24.0*"xx"}} msg] $msg
-} {1 {can't use non-numeric string as operand of "*"}}
+} {1 {can't use non-numeric string "xx" as operand of "*"}}
test compExpr-old-12.11 {CompileMultiplyExpr: runtime error} {
list [catch {expr {"a"/"b"}} msg] $msg
-} {1 {can't use non-numeric string as operand of "/"}}
+} {1 {can't use non-numeric string "a" as operand of "/"}}
test compExpr-old-13.1 {CompileUnaryExpr: unary exprs} {expr -0xff} -255
test compExpr-old-13.2 {CompileUnaryExpr: unary exprs} {expr +0o00123} 83
@@ -438,10 +437,10 @@ test compExpr-old-13.9 {CompileUnaryExpr: error compiling unary expr} -body {
} -returnCodes error -match glob -result *
test compExpr-old-13.10 {CompileUnaryExpr: runtime error} {
list [catch {expr {~"xx"}} msg] $msg
-} {1 {can't use non-numeric string as operand of "~"}}
+} {1 {can't use non-numeric string "xx" as operand of "~"}}
test compExpr-old-13.11 {CompileUnaryExpr: runtime error} {
list [catch {expr ~4.0} msg] $msg
-} {1 {can't use floating-point value as operand of "~"}}
+} {1 {can't use floating-point value "4.0" as operand of "~"}}
test compExpr-old-13.12 {CompileUnaryExpr: just primary expr} {expr 0x123} 291
test compExpr-old-13.13 {CompileUnaryExpr: just primary expr} {
set a 27
@@ -589,6 +588,7 @@ test compExpr-old-15.5 {CompileMathFuncCall: too few arguments} -body {
test compExpr-old-15.6 {CompileMathFuncCall: missing ')'} -body {
expr sin(1
} -returnCodes error -match glob -result *
+
test compExpr-old-16.1 {GetToken: checks whether integer token starting with "0x" (e.g., "0x$") is invalid} {
catch {unset a}
set a(VALUE) ff15
diff --git a/tests/compExpr.test b/tests/compExpr.test
index 3b44af8..a2a021e 100644
--- a/tests/compExpr.test
+++ b/tests/compExpr.test
@@ -14,7 +14,6 @@ if {"::tcltest" ni [namespace children]} {
}
::tcltest::loadTestedCommands
-catch [list package require -exact Tcltest [info patchlevel]]
# Constrain memory leak tests
testConstraint memory [llength [info commands memory]]
diff --git a/tests/compile.test b/tests/compile.test
index fb9a87a..c8d4f02 100644
--- a/tests/compile.test
+++ b/tests/compile.test
@@ -323,7 +323,7 @@ test compile-11.2 {Tcl_Append*: ensure Tcl_ResetResult is used properly} -body {
} -returnCodes error -result {bad index "bogus": must be integer?[+-]integer? or end?[+-]integer?}
test compile-11.3 {Tcl_Append*: ensure Tcl_ResetResult is used properly} -body {
apply {{} { set r [list foobar] ; string index a 0o9 }}
-} -returnCodes error -match glob -result {*invalid octal number*}
+} -returnCodes error -match glob -result {*}
test compile-11.4 {Tcl_Append*: ensure Tcl_ResetResult is used properly} -body {
apply {{} { set r [list foobar] ; array set var {one two many} }}
} -returnCodes error -result {list must have an even number of elements}
diff --git a/tests/execute.test b/tests/execute.test
index 808574b..1d79f23 100644
--- a/tests/execute.test
+++ b/tests/execute.test
@@ -174,7 +174,7 @@ test execute-3.5 {TclExecuteByteCode, INST_ADD, op1 is string double} {testobj}
test execute-3.6 {TclExecuteByteCode, INST_ADD, op1 is non-numeric} {testobj} {
set x [teststringobj set 0 foo]
list [catch {expr {$x + 1}} msg] $msg
-} {1 {can't use non-numeric string as operand of "+"}}
+} {1 {can't use non-numeric string "foo" as operand of "+"}}
test execute-3.7 {TclExecuteByteCode, INST_ADD, op2 is int} {testobj} {
set x [testintobj set 0 1]
expr {1 + $x}
@@ -199,7 +199,7 @@ test execute-3.11 {TclExecuteByteCode, INST_ADD, op2 is string double} {testobj}
test execute-3.12 {TclExecuteByteCode, INST_ADD, op2 is non-numeric} {testobj} {
set x [teststringobj set 0 foo]
list [catch {expr {1 + $x}} msg] $msg
-} {1 {can't use non-numeric string as operand of "+"}}
+} {1 {can't use non-numeric string "foo" as operand of "+"}}
# INST_SUB is partially tested:
test execute-3.13 {TclExecuteByteCode, INST_SUB, op1 is int} {testobj} {
@@ -226,7 +226,7 @@ test execute-3.17 {TclExecuteByteCode, INST_SUB, op1 is string double} {testobj}
test execute-3.18 {TclExecuteByteCode, INST_SUB, op1 is non-numeric} {testobj} {
set x [teststringobj set 0 foo]
list [catch {expr {$x - 1}} msg] $msg
-} {1 {can't use non-numeric string as operand of "-"}}
+} {1 {can't use non-numeric string "foo" as operand of "-"}}
test execute-3.19 {TclExecuteByteCode, INST_SUB, op2 is int} {testobj} {
set x [testintobj set 0 1]
expr {1 - $x}
@@ -251,7 +251,7 @@ test execute-3.23 {TclExecuteByteCode, INST_SUB, op2 is string double} {testobj}
test execute-3.24 {TclExecuteByteCode, INST_SUB, op2 is non-numeric} {testobj} {
set x [teststringobj set 0 foo]
list [catch {expr {1 - $x}} msg] $msg
-} {1 {can't use non-numeric string as operand of "-"}}
+} {1 {can't use non-numeric string "foo" as operand of "-"}}
# INST_MULT is partially tested:
test execute-3.25 {TclExecuteByteCode, INST_MULT, op1 is int} {testobj} {
@@ -278,7 +278,7 @@ test execute-3.29 {TclExecuteByteCode, INST_MULT, op1 is string double} {testobj
test execute-3.30 {TclExecuteByteCode, INST_MULT, op1 is non-numeric} {testobj} {
set x [teststringobj set 1 foo]
list [catch {expr {$x * 1}} msg] $msg
-} {1 {can't use non-numeric string as operand of "*"}}
+} {1 {can't use non-numeric string "foo" as operand of "*"}}
test execute-3.31 {TclExecuteByteCode, INST_MULT, op2 is int} {testobj} {
set x [testintobj set 1 1]
expr {1 * $x}
@@ -303,7 +303,7 @@ test execute-3.35 {TclExecuteByteCode, INST_MULT, op2 is string double} {testobj
test execute-3.36 {TclExecuteByteCode, INST_MULT, op2 is non-numeric} {testobj} {
set x [teststringobj set 1 foo]
list [catch {expr {1 * $x}} msg] $msg
-} {1 {can't use non-numeric string as operand of "*"}}
+} {1 {can't use non-numeric string "foo" as operand of "*"}}
# INST_DIV is partially tested:
test execute-3.37 {TclExecuteByteCode, INST_DIV, op1 is int} {testobj} {
@@ -330,7 +330,7 @@ test execute-3.41 {TclExecuteByteCode, INST_DIV, op1 is string double} {testobj}
test execute-3.42 {TclExecuteByteCode, INST_DIV, op1 is non-numeric} {testobj} {
set x [teststringobj set 1 foo]
list [catch {expr {$x / 1}} msg] $msg
-} {1 {can't use non-numeric string as operand of "/"}}
+} {1 {can't use non-numeric string "foo" as operand of "/"}}
test execute-3.43 {TclExecuteByteCode, INST_DIV, op2 is int} {testobj} {
set x [testintobj set 1 1]
expr {2 / $x}
@@ -355,7 +355,7 @@ test execute-3.47 {TclExecuteByteCode, INST_DIV, op2 is string double} {testobj}
test execute-3.48 {TclExecuteByteCode, INST_DIV, op2 is non-numeric} {testobj} {
set x [teststringobj set 1 foo]
list [catch {expr {1 / $x}} msg] $msg
-} {1 {can't use non-numeric string as operand of "/"}}
+} {1 {can't use non-numeric string "foo" as operand of "/"}}
# INST_UPLUS is partially tested:
test execute-3.49 {TclExecuteByteCode, INST_UPLUS, op is int} {testobj} {
@@ -382,7 +382,7 @@ test execute-3.53 {TclExecuteByteCode, INST_UPLUS, op is string double} {testobj
test execute-3.54 {TclExecuteByteCode, INST_UPLUS, op is non-numeric} {testobj} {
set x [teststringobj set 1 foo]
list [catch {expr {+ $x}} msg] $msg
-} {1 {can't use non-numeric string as operand of "+"}}
+} {1 {can't use non-numeric string "foo" as operand of "+"}}
# INST_UMINUS is partially tested:
test execute-3.55 {TclExecuteByteCode, INST_UMINUS, op is int} {testobj} {
@@ -409,7 +409,7 @@ test execute-3.59 {TclExecuteByteCode, INST_UMINUS, op is string double} {testob
test execute-3.60 {TclExecuteByteCode, INST_UMINUS, op is non-numeric} {testobj} {
set x [teststringobj set 1 foo]
list [catch {expr {- $x}} msg] $msg
-} {1 {can't use non-numeric string as operand of "-"}}
+} {1 {can't use non-numeric string "foo" as operand of "-"}}
# INST_LNOT is partially tested:
test execute-3.61 {TclExecuteByteCode, INST_LNOT, op is int} {testobj} {
@@ -457,11 +457,7 @@ test execute-3.70 {TclExecuteByteCode, INST_LNOT, op is string double} {testobj}
test execute-3.71 {TclExecuteByteCode, INST_LNOT, op is non-numeric} {testobj} {
set x [teststringobj set 1 foo]
list [catch {expr {! $x}} msg] $msg
-} {1 {can't use non-numeric string as operand of "!"}}
-
-# INST_BITNOT not tested
-# INST_CALL_BUILTIN_FUNC1 not tested
-# INST_CALL_FUNC1 not tested
+} {1 {can't use non-numeric string "foo" as operand of "!"}}
# INST_TRY_CVT_TO_NUMERIC is partially tested:
test execute-3.72 {TclExecuteByteCode, INST_TRY_CVT_TO_NUMERIC, op is int} {testobj} {
diff --git a/tests/expr-old.test b/tests/expr-old.test
index 003ee00..0fc13ab 100644
--- a/tests/expr-old.test
+++ b/tests/expr-old.test
@@ -192,34 +192,34 @@ test expr-old-2.38 {floating-point operators} {
test expr-old-3.1 {illegal floating-point operations} {
list [catch {expr ~4.0} msg] $msg
-} {1 {can't use floating-point value as operand of "~"}}
+} {1 {can't use floating-point value "4.0" as operand of "~"}}
test expr-old-3.2 {illegal floating-point operations} {
list [catch {expr 27%4.0} msg] $msg
-} {1 {can't use floating-point value as operand of "%"}}
+} {1 {can't use floating-point value "4.0" as operand of "%"}}
test expr-old-3.3 {illegal floating-point operations} {
list [catch {expr 27.0%4} msg] $msg
-} {1 {can't use floating-point value as operand of "%"}}
+} {1 {can't use floating-point value "27.0" as operand of "%"}}
test expr-old-3.4 {illegal floating-point operations} {
list [catch {expr 1.0<<3} msg] $msg
-} {1 {can't use floating-point value as operand of "<<"}}
+} {1 {can't use floating-point value "1.0" as operand of "<<"}}
test expr-old-3.5 {illegal floating-point operations} {
list [catch {expr 3<<1.0} msg] $msg
-} {1 {can't use floating-point value as operand of "<<"}}
+} {1 {can't use floating-point value "1.0" as operand of "<<"}}
test expr-old-3.6 {illegal floating-point operations} {
list [catch {expr 24.0>>3} msg] $msg
-} {1 {can't use floating-point value as operand of ">>"}}
+} {1 {can't use floating-point value "24.0" as operand of ">>"}}
test expr-old-3.7 {illegal floating-point operations} {
list [catch {expr 24>>3.0} msg] $msg
-} {1 {can't use floating-point value as operand of ">>"}}
+} {1 {can't use floating-point value "3.0" as operand of ">>"}}
test expr-old-3.8 {illegal floating-point operations} {
list [catch {expr 24&3.0} msg] $msg
-} {1 {can't use floating-point value as operand of "&"}}
+} {1 {can't use floating-point value "3.0" as operand of "&"}}
test expr-old-3.9 {illegal floating-point operations} {
list [catch {expr 24.0|3} msg] $msg
-} {1 {can't use floating-point value as operand of "|"}}
+} {1 {can't use floating-point value "24.0" as operand of "|"}}
test expr-old-3.10 {illegal floating-point operations} {
list [catch {expr 24.0^3} msg] $msg
-} {1 {can't use floating-point value as operand of "^"}}
+} {1 {can't use floating-point value "24.0" as operand of "^"}}
# Check the string operators individually.
@@ -260,46 +260,46 @@ test expr-old-4.32 {string operators} {expr {0?"foo":"bar"}} bar
test expr-old-5.1 {illegal string operations} {
list [catch {expr {-"a"}} msg] $msg
-} {1 {can't use non-numeric string as operand of "-"}}
+} {1 {can't use non-numeric string "a" as operand of "-"}}
test expr-old-5.2 {illegal string operations} {
list [catch {expr {+"a"}} msg] $msg
-} {1 {can't use non-numeric string as operand of "+"}}
+} {1 {can't use non-numeric string "a" as operand of "+"}}
test expr-old-5.3 {illegal string operations} {
list [catch {expr {~"a"}} msg] $msg
-} {1 {can't use non-numeric string as operand of "~"}}
+} {1 {can't use non-numeric string "a" as operand of "~"}}
test expr-old-5.4 {illegal string operations} {
list [catch {expr {!"a"}} msg] $msg
-} {1 {can't use non-numeric string as operand of "!"}}
+} {1 {can't use non-numeric string "a" as operand of "!"}}
test expr-old-5.5 {illegal string operations} {
list [catch {expr {"a"*"b"}} msg] $msg
-} {1 {can't use non-numeric string as operand of "*"}}
+} {1 {can't use non-numeric string "a" as operand of "*"}}
test expr-old-5.6 {illegal string operations} {
list [catch {expr {"a"/"b"}} msg] $msg
-} {1 {can't use non-numeric string as operand of "/"}}
+} {1 {can't use non-numeric string "a" as operand of "/"}}
test expr-old-5.7 {illegal string operations} {
list [catch {expr {"a"%"b"}} msg] $msg
-} {1 {can't use non-numeric string as operand of "%"}}
+} {1 {can't use non-numeric string "a" as operand of "%"}}
test expr-old-5.8 {illegal string operations} {
list [catch {expr {"a"+"b"}} msg] $msg
-} {1 {can't use non-numeric string as operand of "+"}}
+} {1 {can't use non-numeric string "a" as operand of "+"}}
test expr-old-5.9 {illegal string operations} {
list [catch {expr {"a"-"b"}} msg] $msg
-} {1 {can't use non-numeric string as operand of "-"}}
+} {1 {can't use non-numeric string "a" as operand of "-"}}
test expr-old-5.10 {illegal string operations} {
list [catch {expr {"a"<<"b"}} msg] $msg
-} {1 {can't use non-numeric string as operand of "<<"}}
+} {1 {can't use non-numeric string "a" as operand of "<<"}}
test expr-old-5.11 {illegal string operations} {
list [catch {expr {"a">>"b"}} msg] $msg
-} {1 {can't use non-numeric string as operand of ">>"}}
+} {1 {can't use non-numeric string "a" as operand of ">>"}}
test expr-old-5.12 {illegal string operations} {
list [catch {expr {"a"&"b"}} msg] $msg
-} {1 {can't use non-numeric string as operand of "&"}}
+} {1 {can't use non-numeric string "a" as operand of "&"}}
test expr-old-5.13 {illegal string operations} {
list [catch {expr {"a"^"b"}} msg] $msg
-} {1 {can't use non-numeric string as operand of "^"}}
+} {1 {can't use non-numeric string "a" as operand of "^"}}
test expr-old-5.14 {illegal string operations} {
list [catch {expr {"a"|"b"}} msg] $msg
-} {1 {can't use non-numeric string as operand of "|"}}
+} {1 {can't use non-numeric string "a" as operand of "|"}}
test expr-old-5.15 {illegal string operations} {
list [catch {expr {"a"&&"b"}} msg] $msg
} {1 {expected boolean value but got "a"}}
@@ -488,7 +488,7 @@ test expr-old-25.20 {type conversions} {expr 10.0} 10.0
test expr-old-26.1 {error conditions} {
list [catch {expr 2+"a"} msg] $msg
-} {1 {can't use non-numeric string as operand of "+"}}
+} {1 {can't use non-numeric string "a" as operand of "+"}}
test expr-old-26.2 {error conditions} -body {
expr 2+4*
} -returnCodes error -match glob -result *
@@ -502,10 +502,10 @@ test expr-old-26.4 {error conditions} {
set a xx
test expr-old-26.5 {error conditions} {
list [catch {expr {2+$a}} msg] $msg
-} {1 {can't use non-numeric string as operand of "+"}}
+} {1 {can't use non-numeric string "xx" as operand of "+"}}
test expr-old-26.6 {error conditions} {
list [catch {expr {2+[set a]}} msg] $msg
-} {1 {can't use non-numeric string as operand of "+"}}
+} {1 {can't use non-numeric string "xx" as operand of "+"}}
test expr-old-26.7 {error conditions} -body {
expr {2+(4}
} -returnCodes error -match glob -result *
@@ -529,7 +529,7 @@ test expr-old-26.12 {error conditions} -body {
} -returnCodes error -match glob -result *
test expr-old-26.13 {error conditions} {
list [catch {expr {"a"/"b"}} msg] $msg
-} {1 {can't use non-numeric string as operand of "/"}}
+} {1 {can't use non-numeric string "a" as operand of "/"}}
test expr-old-26.14 {error conditions} -body {
expr 2:3
} -returnCodes error -match glob -result *
@@ -941,13 +941,14 @@ test expr-old-34.15 {errors in math functions} {
test expr-old-34.16 {errors in math functions} {
expr round(-1.0e30)
} -1000000000000000019884624838656
+
test expr-old-36.1 {ExprLooksLikeInt procedure} -body {
expr 0o289
} -returnCodes error -match glob -result {*invalid octal number*}
test expr-old-36.2 {ExprLooksLikeInt procedure} {
set x 0o289
list [catch {expr {$x+1}} msg] $msg
-} {1 {can't use invalid octal number as operand of "+"}}
+} {1 {can't use non-numeric string "0o289" as operand of "+"}}
test expr-old-36.3 {ExprLooksLikeInt procedure} {
list [catch {expr 0289.1} msg] $msg
} {0 289.1}
@@ -987,11 +988,11 @@ test expr-old-36.11 {ExprLooksLikeInt procedure} {
test expr-old-36.12 {ExprLooksLikeInt procedure} {
set x "10;"
list [catch {expr {$x+1}} msg] $msg
-} {1 {can't use non-numeric string as operand of "+"}}
+} {1 {can't use non-numeric string "10;" as operand of "+"}}
test expr-old-36.13 {ExprLooksLikeInt procedure} {
set x " +"
list [catch {expr {$x+1}} msg] $msg
-} {1 {can't use non-numeric string as operand of "+"}}
+} {1 {can't use non-numeric string " +" as operand of "+"}}
test expr-old-36.14 {ExprLooksLikeInt procedure} {
set x "123456789012345678901234567890 "
expr {$x+1}
@@ -999,7 +1000,7 @@ test expr-old-36.14 {ExprLooksLikeInt procedure} {
test expr-old-36.15 {ExprLooksLikeInt procedure} {
set x "0o99 "
list [catch {expr {$x+1}} msg] $msg
-} {1 {can't use invalid octal number as operand of "+"}}
+} {1 {can't use non-numeric string "0o99 " as operand of "+"}}
test expr-old-36.16 {ExprLooksLikeInt procedure} {
set x " 0xffffffffffffffffffffffffffffffffffffff "
expr {$x+1}
diff --git a/tests/expr.test b/tests/expr.test
index bc01c03..49ca63e 100644
--- a/tests/expr.test
+++ b/tests/expr.test
@@ -16,7 +16,6 @@ if {[lsearch [namespace children] ::tcltest] == -1} {
}
::tcltest::loadTestedCommands
-catch [list package require -exact Tcltest [info patchlevel]]
# Determine if "long int" type is a 32 bit number and if the wide
# type is a 64 bit number on this machine.
@@ -252,7 +251,7 @@ test expr-4.9 {CompileLorExpr: long lor arm} {
} 1
test expr-4.10 {CompileLorExpr: error compiling ! operand} {
list [catch {expr {!"a"}} msg] $msg
-} {1 {can't use non-numeric string as operand of "!"}}
+} {1 {can't use non-numeric string "a" as operand of "!"}}
test expr-4.11 {CompileLorExpr: error compiling land arms} {
list [catch {expr {"a"||0}} msg] $msg
} {1 {expected boolean value but got "a"}}
@@ -299,10 +298,10 @@ test expr-6.8 {CompileBitXorExpr: error compiling bitxor arm} -body {
} -returnCodes error -match glob -result *
test expr-6.9 {CompileBitXorExpr: runtime error in bitxor arm} {
list [catch {expr {24.0^3}} msg] $msg
-} {1 {can't use floating-point value as operand of "^"}}
+} {1 {can't use floating-point value "24.0" as operand of "^"}}
test expr-6.10 {CompileBitXorExpr: runtime error in bitxor arm} {
list [catch {expr {"a"^"b"}} msg] $msg
-} {1 {can't use non-numeric string as operand of "^"}}
+} {1 {can't use non-numeric string "a" as operand of "^"}}
test expr-7.1 {CompileBitAndExpr: just equality expr} {expr 3==2} 0
test expr-7.2 {CompileBitAndExpr: just equality expr} {expr 2.0==2} 1
@@ -323,10 +322,10 @@ test expr-7.11 {CompileBitAndExpr: error compiling bitand arm} -body {
} -returnCodes error -match glob -result *
test expr-7.12 {CompileBitAndExpr: runtime error in bitand arm} {
list [catch {expr {24.0&3}} msg] $msg
-} {1 {can't use floating-point value as operand of "&"}}
+} {1 {can't use floating-point value "24.0" as operand of "&"}}
test expr-7.13 {CompileBitAndExpr: runtime error in bitand arm} {
list [catch {expr {"a"&"b"}} msg] $msg
-} {1 {can't use non-numeric string as operand of "&"}}
+} {1 {can't use non-numeric string "a" as operand of "&"}}
test expr-7.14 {CompileBitAndExpr: equality expr} {expr 3eq2} 0
test expr-7.18 {CompileBitAndExpr: equality expr} {expr {"abc" eq "abd"}} 0
test expr-7.20 {CompileBitAndExpr: error in equality expr} -body {
@@ -468,10 +467,10 @@ test expr-10.9 {CompileShiftExpr: error compiling shift arm} -body {
} -returnCodes error -match glob -result *
test expr-10.10 {CompileShiftExpr: runtime error} {
list [catch {expr {24.0>>43}} msg] $msg
-} {1 {can't use floating-point value as operand of ">>"}}
+} {1 {can't use floating-point value "24.0" as operand of ">>"}}
test expr-10.11 {CompileShiftExpr: runtime error} {
list [catch {expr {"a"<<"b"}} msg] $msg
-} {1 {can't use non-numeric string as operand of "<<"}}
+} {1 {can't use non-numeric string "a" as operand of "<<"}}
test expr-11.1 {CompileAddExpr: just multiply expr} {expr 4*-2} -8
test expr-11.2 {CompileAddExpr: just multiply expr} {expr 0xff%2} 1
@@ -490,10 +489,10 @@ test expr-11.9 {CompileAddExpr: error compiling add arm} -body {
} -returnCodes error -match glob -result *
test expr-11.10 {CompileAddExpr: runtime error} {
list [catch {expr {24.0+"xx"}} msg] $msg
-} {1 {can't use non-numeric string as operand of "+"}}
+} {1 {can't use non-numeric string "xx" as operand of "+"}}
test expr-11.11 {CompileAddExpr: runtime error} {
list [catch {expr {"a"-"b"}} msg] $msg
-} {1 {can't use non-numeric string as operand of "-"}}
+} {1 {can't use non-numeric string "a" as operand of "-"}}
test expr-11.12 {CompileAddExpr: runtime error} {
list [catch {expr {3/0}} msg] $msg
} {1 {divide by zero}}
@@ -521,10 +520,10 @@ test expr-12.9 {CompileMultiplyExpr: error compiling multiply arm} -body {
} -returnCodes error -match glob -result *
test expr-12.10 {CompileMultiplyExpr: runtime error} {
list [catch {expr {24.0*"xx"}} msg] $msg
-} {1 {can't use non-numeric string as operand of "*"}}
+} {1 {can't use non-numeric string "xx" as operand of "*"}}
test expr-12.11 {CompileMultiplyExpr: runtime error} {
list [catch {expr {"a"/"b"}} msg] $msg
-} {1 {can't use non-numeric string as operand of "/"}}
+} {1 {can't use non-numeric string "a" as operand of "/"}}
test expr-13.1 {CompileUnaryExpr: unary exprs} {expr -0xff} -255
test expr-13.2 {CompileUnaryExpr: unary exprs} {expr +0o00123} 83
@@ -541,10 +540,10 @@ test expr-13.9 {CompileUnaryExpr: error compiling unary expr} -body {
} -returnCodes error -match glob -result *
test expr-13.10 {CompileUnaryExpr: runtime error} {
list [catch {expr {~"xx"}} msg] $msg
-} {1 {can't use non-numeric string as operand of "~"}}
+} {1 {can't use non-numeric string "xx" as operand of "~"}}
test expr-13.11 {CompileUnaryExpr: runtime error} {
list [catch {expr ~4.0} msg] $msg
-} {1 {can't use floating-point value as operand of "~"}}
+} {1 {can't use floating-point value "4.0" as operand of "~"}}
test expr-13.12 {CompileUnaryExpr: just primary expr} {expr 0x123} 291
test expr-13.13 {CompileUnaryExpr: just primary expr} {
set a 27
@@ -821,15 +820,15 @@ test expr-21.13 {non-numeric boolean literals} -body {
} -returnCodes error -match glob -result *
test expr-21.14 {non-numeric boolean literals} {
list [catch {expr !"truef"} err] $err
-} {1 {can't use non-numeric string as operand of "!"}}
+} {1 {can't use non-numeric string "truef" as operand of "!"}}
test expr-21.15 {non-numeric boolean variables} {
set v truef
list [catch {expr {!$v}} err] $err
-} {1 {can't use non-numeric string as operand of "!"}}
+} {1 {can't use non-numeric string "truef" as operand of "!"}}
test expr-21.16 {non-numeric boolean variables} {
set v "true "
list [catch {expr {!$v}} err] $err
-} {1 {can't use non-numeric string as operand of "!"}}
+} {1 {can't use non-numeric string "true " as operand of "!"}}
test expr-21.17 {non-numeric boolean variables} {
set v "tru"
list [catch {expr {!$v}} err] $err
@@ -849,23 +848,23 @@ test expr-21.20 {non-numeric boolean variables} {
test expr-21.21 {non-numeric boolean variables} {
set v "o"
list [catch {expr {!$v}} err] $err
-} {1 {can't use non-numeric string as operand of "!"}}
+} {1 {can't use non-numeric string "o" as operand of "!"}}
test expr-21.22 {non-numeric boolean variables} {
set v ""
list [catch {expr {!$v}} err] $err
-} {1 {can't use empty string as operand of "!"}}
+} {1 {can't use non-numeric string "" as operand of "!"}}
# Test for non-numeric float handling.
test expr-22.1 {non-numeric floats} {
list [catch {expr {NaN + 1}} msg] $msg
-} {1 {can't use non-numeric floating-point value as operand of "+"}}
+} {1 {can't use non-numeric floating-point value "NaN" as operand of "+"}}
test expr-22.2 {non-numeric floats} !ieeeFloatingPoint {
list [catch {expr {Inf + 1}} msg] $msg
} {1 {can't use infinite floating-point value as operand of "+"}}
test expr-22.3 {non-numeric floats} {
set nan NaN
list [catch {expr {$nan + 1}} msg] $msg
-} {1 {can't use non-numeric floating-point value as operand of "+"}}
+} {1 {can't use non-numeric floating-point value "NaN" as operand of "+"}}
test expr-22.4 {non-numeric floats} !ieeeFloatingPoint {
set inf Inf
list [catch {expr {$inf + 1}} msg] $msg
@@ -878,7 +877,7 @@ test expr-22.6 {non-numeric floats} !ieeeFloatingPoint {
} {1 {floating-point value too large to represent}}
test expr-22.7 {non-numeric floats} {
list [catch {expr {1 / NaN}} msg] $msg
-} {1 {can't use non-numeric floating-point value as operand of "/"}}
+} {1 {can't use non-numeric floating-point value "NaN" as operand of "/"}}
test expr-22.8 {non-numeric floats} !ieeeFloatingPoint {
list [catch {expr {1 / Inf}} msg] $msg
} {1 {can't use infinite floating-point value as operand of "/"}}
@@ -914,10 +913,10 @@ test expr-23.8 {CompileExponentialExpr: error compiling expo arm} -body {
} -returnCodes error -match glob -result *
test expr-23.9 {CompileExponentialExpr: runtime error} {
list [catch {expr {24.0**"xx"}} msg] $msg
-} {1 {can't use non-numeric string as operand of "**"}}
+} {1 {can't use non-numeric string "xx" as operand of "**"}}
test expr-23.10 {CompileExponentialExpr: runtime error} {
list [catch {expr {"a"**2}} msg] $msg
-} {1 {can't use non-numeric string as operand of "**"}}
+} {1 {can't use non-numeric string "a" as operand of "**"}}
test expr-23.11 {CompileExponentialExpr: runtime error} {
list [catch {expr {0**-1}} msg] $msg
} {1 {exponentiation of zero by negative power}}
diff --git a/tests/format.test b/tests/format.test
index 3640376..75f4e40 100644
--- a/tests/format.test
+++ b/tests/format.test
@@ -80,13 +80,13 @@ test format-1.12 {integer formatting} {
} {101 0 0b101 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000}
test format-1.13 {integer formatting} {
format "%#0d %#0d %#0d %#0d %#0d" 0 6 34 16923 -12 -1
-} {0 0d6 0d34 0d16923 -0d12}
+} {0 6 34 16923 -12}
test format-1.14 {integer formatting} {
format "%#05d %#020d %#020d %#020d %#020d" 0 6 34 16923 -12 -1
-} {00000 0d000000000000000006 0d000000000000000034 0d000000000000016923 -0d00000000000000012}
+} {00000 00000000000000000006 00000000000000000034 00000000000000016923 -0000000000000000012}
test format-1.15 {integer formatting} {
format "%-#05d %-#020d %-#020d %-#020d %-#020d" 0 6 34 16923 -12 -1
-} {00000 0d000000000000000006 0d000000000000000034 0d000000000000016923 -0d00000000000000012}
+} {00000 00000000000000000006 00000000000000000034 00000000000000016923 -0000000000000000012}
test format-2.1 {string formatting} {
diff --git a/tests/get.test b/tests/get.test
index e35b2cc..997906a 100644
--- a/tests/get.test
+++ b/tests/get.test
@@ -98,17 +98,17 @@ test get-3.2 {Tcl_GetDouble(FromObj), bad numbers} {
} {0 1 0 1 1 {expected floating-point number but got "++1.0"} 1 {expected floating-point number but got "+-1.0"} 1 {expected floating-point number but got "-+1.0"} 0 -1 1 {expected floating-point number but got "--1.0"} 1 {expected floating-point number but got "- +1.0"}}
# Bug 7114ac6141
test get-3.3 {tcl_GetInt with iffy numbers} testgetint {
- lmap x {0 " 0" "0 " " 0 " " 0xa " " 007 " " 0o10 " " 0b10 "} {
+ lmap x {0 " 0" "0 " " 0 " " 0xa " " 010 " " 0o10 " " 0b10 "} {
catch {testgetint 44 $x} x
set x
}
-} {44 44 44 44 54 51 52 46}
+} {44 44 44 44 54 54 52 46}
test get-3.4 {Tcl_GetDouble with iffy numbers} testdoubleobj {
- lmap x {0 0.0 " .0" ".0 " " 0e0 " "07" "- 0" "-0" "0o12" "0b10"} {
+ lmap x {0 0.0 " .0" ".0 " " 0e0 " "09" "- 0" "-0" "0o12" "0b10"} {
catch {testdoubleobj set 1 $x} x
set x
}
-} {0.0 0.0 0.0 0.0 0.0 7.0 {expected floating-point number but got "- 0"} 0.0 10.0 2.0}
+} {0.0 0.0 0.0 0.0 0.0 9.0 {expected floating-point number but got "- 0"} 0.0 10.0 2.0}
# cleanup
::tcltest::cleanupTests
diff --git a/tests/lindex.test b/tests/lindex.test
index bb3f005..9de08c1 100644
--- a/tests/lindex.test
+++ b/tests/lindex.test
@@ -70,11 +70,11 @@ test lindex-3.4 {integer 3} testevalex {
test lindex-3.5 {bad octal} -constraints testevalex -body {
set x 0o8
list [catch { testevalex {lindex {a b c} $x} } result] $result
-} -match glob -result {1 {*invalid octal number*}}
+} -match glob -result {1 {*}}
test lindex-3.6 {bad octal} -constraints testevalex -body {
set x -0o9
list [catch { testevalex {lindex {a b c} $x} } result] $result
-} -match glob -result {1 {*invalid octal number*}}
+} -match glob -result {1 {*}}
test lindex-3.7 {indexes don't shimmer wide ints} {
set x [expr {(wide(1)<<31) - 2}]
list $x [lindex {1 2 3} $x] [incr x] [incr x]
@@ -114,11 +114,11 @@ test lindex-4.5 {index = end-3} testevalex {
test lindex-4.6 {bad octal} -constraints testevalex -body {
set x end-0o8
list [catch { testevalex {lindex {a b c} $x} } result] $result
-} -match glob -result {1 {*invalid octal number*}}
+} -match glob -result {1 {*}}
test lindex-4.7 {bad octal} -constraints testevalex -body {
set x end--0o9
list [catch { testevalex {lindex {a b c} $x} } result] $result
-} -match glob -result {1 {*invalid octal number*}}
+} -match glob -result {1 {*}}
test lindex-4.8 {bad integer, not octal} testevalex {
set x end-0a2
list [catch { testevalex {lindex {a b c} $x} } result] $result
@@ -270,11 +270,11 @@ test lindex-11.4 {integer 3} {
test lindex-11.5 {bad octal} -body {
set x 0o8
list [catch { lindex {a b c} $x } result] $result
-} -match glob -result {1 {*invalid octal number*}}
+} -match glob -result {1 {*}}
test lindex-11.6 {bad octal} -body {
set x -0o9
list [catch { lindex {a b c} $x } result] $result
-} -match glob -result {1 {*invalid octal number*}}
+} -match glob -result {1 {*}}
# Indices relative to end
@@ -316,11 +316,11 @@ test lindex-12.5 {index = end-3} {
test lindex-12.6 {bad octal} -body {
set x end-0o8
list [catch { lindex {a b c} $x } result] $result
-} -match glob -result {1 {*invalid octal number*}}
+} -match glob -result {1 {*}}
test lindex-12.7 {bad octal} -body {
set x end--0o9
list [catch { lindex {a b c} $x } result] $result
-} -match glob -result {1 {*invalid octal number*}}
+} -match glob -result {1 {*}}
test lindex-12.8 {bad integer, not octal} {
set x end-0a2
list [catch { lindex {a b c} $x } result] $result
diff --git a/tests/mathop.test b/tests/mathop.test
index 958a56f..04ceaec 100644
--- a/tests/mathop.test
+++ b/tests/mathop.test
@@ -114,22 +114,22 @@ namespace eval ::testmathop {
test mathop-1.10 {compiled +} { + 1 2 3000000000000000000000 } 3000000000000000000003
test mathop-1.11 {compiled +: errors} -returnCodes error -body {
+ x 0
- } -result {can't use non-numeric string as operand of "+"}
+ } -result {can't use non-numeric string "x" as operand of "+"}
test mathop-1.12 {compiled +: errors} -returnCodes error -body {
+ nan 0
- } -result {can't use non-numeric floating-point value as operand of "+"}
+ } -result {can't use non-numeric floating-point value "nan" as operand of "+"}
test mathop-1.13 {compiled +: errors} -returnCodes error -body {
+ 0 x
- } -result {can't use non-numeric string as operand of "+"}
+ } -result {can't use non-numeric string "x" as operand of "+"}
test mathop-1.14 {compiled +: errors} -returnCodes error -body {
+ 0 nan
- } -result {can't use non-numeric floating-point value as operand of "+"}
+ } -result {can't use non-numeric floating-point value "nan" as operand of "+"}
test mathop-1.15 {compiled +: errors} -returnCodes error -body {
+ 0o8 0
- } -result {can't use invalid octal number as operand of "+"}
+ } -result {can't use non-numeric string "0o8" as operand of "+"}
test mathop-1.16 {compiled +: errors} -returnCodes error -body {
+ 0 0o8
- } -result {can't use invalid octal number as operand of "+"}
+ } -result {can't use non-numeric string "0o8" as operand of "+"}
test mathop-1.17 {compiled +: errors} -returnCodes error -body {
+ 0 [error expectedError]
} -result expectedError
@@ -152,22 +152,22 @@ namespace eval ::testmathop {
test mathop-1.28 {interpreted +} { $op 1 2 3000000000000000000000 } 3000000000000000000003
test mathop-1.29 {interpreted +: errors} -returnCodes error -body {
$op x 0
- } -result {can't use non-numeric string as operand of "+"}
+ } -result {can't use non-numeric string "x" as operand of "+"}
test mathop-1.30 {interpreted +: errors} -returnCodes error -body {
$op nan 0
- } -result {can't use non-numeric floating-point value as operand of "+"}
+ } -result {can't use non-numeric floating-point value "nan" as operand of "+"}
test mathop-1.31 {interpreted +: errors} -returnCodes error -body {
$op 0 x
- } -result {can't use non-numeric string as operand of "+"}
+ } -result {can't use non-numeric string "x" as operand of "+"}
test mathop-1.32 {interpreted +: errors} -returnCodes error -body {
$op 0 nan
- } -result {can't use non-numeric floating-point value as operand of "+"}
+ } -result {can't use non-numeric floating-point value "nan" as operand of "+"}
test mathop-1.33 {interpreted +: errors} -returnCodes error -body {
$op 0o8 0
- } -result {can't use invalid octal number as operand of "+"}
+ } -result {can't use non-numeric string "0o8" as operand of "+"}
test mathop-1.34 {interpreted +: errors} -returnCodes error -body {
$op 0 0o8
- } -result {can't use invalid octal number as operand of "+"}
+ } -result {can't use non-numeric string "0o8" as operand of "+"}
test mathop-1.35 {interpreted +: errors} -returnCodes error -body {
$op 0 [error expectedError]
} -result expectedError
@@ -189,22 +189,22 @@ namespace eval ::testmathop {
test mathop-2.10 {compiled *} { * 1 2 3000000000000000000000 } 6000000000000000000000
test mathop-2.11 {compiled *: errors} -returnCodes error -body {
* x 0
- } -result {can't use non-numeric string as operand of "*"}
+ } -result {can't use non-numeric string "x" as operand of "*"}
test mathop-2.12 {compiled *: errors} -returnCodes error -body {
* nan 0
- } -result {can't use non-numeric floating-point value as operand of "*"}
+ } -result {can't use non-numeric floating-point value "nan" as operand of "*"}
test mathop-2.13 {compiled *: errors} -returnCodes error -body {
* 0 x
- } -result {can't use non-numeric string as operand of "*"}
+ } -result {can't use non-numeric string "x" as operand of "*"}
test mathop-2.14 {compiled *: errors} -returnCodes error -body {
* 0 nan
- } -result {can't use non-numeric floating-point value as operand of "*"}
+ } -result {can't use non-numeric floating-point value "nan" as operand of "*"}
test mathop-2.15 {compiled *: errors} -returnCodes error -body {
* 0o8 0
- } -result {can't use invalid octal number as operand of "*"}
+ } -result {can't use non-numeric string "0o8" as operand of "*"}
test mathop-2.16 {compiled *: errors} -returnCodes error -body {
* 0 0o8
- } -result {can't use invalid octal number as operand of "*"}
+ } -result {can't use non-numeric string "0o8" as operand of "*"}
test mathop-2.17 {compiled *: errors} -returnCodes error -body {
* 0 [error expectedError]
} -result expectedError
@@ -227,22 +227,22 @@ namespace eval ::testmathop {
test mathop-2.28 {interpreted *} { $op 1 2 3000000000000000000000 } 6000000000000000000000
test mathop-2.29 {interpreted *: errors} -returnCodes error -body {
$op x 0
- } -result {can't use non-numeric string as operand of "*"}
+ } -result {can't use non-numeric string "x" as operand of "*"}
test mathop-2.30 {interpreted *: errors} -returnCodes error -body {
$op nan 0
- } -result {can't use non-numeric floating-point value as operand of "*"}
+ } -result {can't use non-numeric floating-point value "nan" as operand of "*"}
test mathop-2.31 {interpreted *: errors} -returnCodes error -body {
$op 0 x
- } -result {can't use non-numeric string as operand of "*"}
+ } -result {can't use non-numeric string "x" as operand of "*"}
test mathop-2.32 {interpreted *: errors} -returnCodes error -body {
$op 0 nan
- } -result {can't use non-numeric floating-point value as operand of "*"}
+ } -result {can't use non-numeric floating-point value "nan" as operand of "*"}
test mathop-2.33 {interpreted *: errors} -returnCodes error -body {
$op 0o8 0
- } -result {can't use invalid octal number as operand of "*"}
+ } -result {can't use non-numeric string "0o8" as operand of "*"}
test mathop-2.34 {interpreted *: errors} -returnCodes error -body {
$op 0 0o8
- } -result {can't use invalid octal number as operand of "*"}
+ } -result {can't use non-numeric string "0o8" as operand of "*"}
test mathop-2.35 {interpreted *: errors} -returnCodes error -body {
$op 0 [error expectedError]
} -result expectedError
@@ -261,7 +261,7 @@ namespace eval ::testmathop {
test mathop-3.7 {compiled !} {! 10000000000000000000000000} 0
test mathop-3.8 {compiled !: errors} -body {
! foobar
- } -returnCodes error -result {can't use non-numeric string as operand of "!"}
+ } -returnCodes error -result {can't use non-numeric string "foobar" as operand of "!"}
test mathop-3.9 {compiled !: errors} -body {
! 0 0
} -returnCodes error -result "wrong # args: should be \"! boolean\""
@@ -278,7 +278,7 @@ namespace eval ::testmathop {
test mathop-3.17 {interpreted !} {$op 10000000000000000000000000} 0
test mathop-3.18 {interpreted !: errors} -body {
$op foobar
- } -returnCodes error -result {can't use non-numeric string as operand of "!"}
+ } -returnCodes error -result {can't use non-numeric string "foobar" as operand of "!"}
test mathop-3.19 {interpreted !: errors} -body {
$op 0 0
} -returnCodes error -result "wrong # args: should be \"! boolean\""
@@ -287,10 +287,10 @@ namespace eval ::testmathop {
} -returnCodes error -result "wrong # args: should be \"! boolean\""
test mathop-3.21 {compiled !: error} -returnCodes error -body {
! NaN
- } -result {can't use non-numeric floating-point value as operand of "!"}
+ } -result {can't use non-numeric floating-point value "NaN" as operand of "!"}
test mathop-3.22 {interpreted !: error} -returnCodes error -body {
$op NaN
- } -result {can't use non-numeric floating-point value as operand of "!"}
+ } -result {can't use non-numeric floating-point value "NaN" as operand of "!"}
test mathop-4.1 {compiled ~} {~ 0} -1
test mathop-4.2 {compiled ~} {~ 1} -2
@@ -301,7 +301,7 @@ namespace eval ::testmathop {
test mathop-4.7 {compiled ~} {~ 10000000000000000000000000} -10000000000000000000000001
test mathop-4.8 {compiled ~: errors} -body {
~ foobar
- } -returnCodes error -result {can't use non-numeric string as operand of "~"}
+ } -returnCodes error -result {can't use non-numeric string "foobar" as operand of "~"}
test mathop-4.9 {compiled ~: errors} -body {
~ 0 0
} -returnCodes error -result "wrong # args: should be \"~ integer\""
@@ -310,10 +310,10 @@ namespace eval ::testmathop {
} -returnCodes error -result "wrong # args: should be \"~ integer\""
test mathop-4.11 {compiled ~: errors} -returnCodes error -body {
~ 0.0
- } -result {can't use floating-point value as operand of "~"}
+ } -result {can't use floating-point value "0.0" as operand of "~"}
test mathop-4.12 {compiled ~: errors} -returnCodes error -body {
~ NaN
- } -result {can't use non-numeric floating-point value as operand of "~"}
+ } -result {can't use non-numeric floating-point value "NaN" as operand of "~"}
set op ~
test mathop-4.13 {interpreted ~} {$op 0} -1
test mathop-4.14 {interpreted ~} {$op 1} -2
@@ -324,7 +324,7 @@ namespace eval ::testmathop {
test mathop-4.19 {interpreted ~} {$op 10000000000000000000000000} -10000000000000000000000001
test mathop-4.20 {interpreted ~: errors} -body {
$op foobar
- } -returnCodes error -result {can't use non-numeric string as operand of "~"}
+ } -returnCodes error -result {can't use non-numeric string "foobar" as operand of "~"}
test mathop-4.21 {interpreted ~: errors} -body {
$op 0 0
} -returnCodes error -result "wrong # args: should be \"~ integer\""
@@ -333,10 +333,10 @@ namespace eval ::testmathop {
} -returnCodes error -result "wrong # args: should be \"~ integer\""
test mathop-4.23 {interpreted ~: errors} -returnCodes error -body {
$op 0.0
- } -result {can't use floating-point value as operand of "~"}
+ } -result {can't use floating-point value "0.0" as operand of "~"}
test mathop-4.24 {interpreted ~: errors} -returnCodes error -body {
$op NaN
- } -result {can't use non-numeric floating-point value as operand of "~"}
+ } -result {can't use non-numeric floating-point value "NaN" as operand of "~"}
test mathop-5.1 {compiled eq} {eq {} a} 0
test mathop-5.2 {compiled eq} {eq a a} 1
@@ -377,32 +377,32 @@ namespace eval ::testmathop {
test mathop-6.4 {compiled &} { & 3 7 6 } 2
test mathop-6.5 {compiled &} -returnCodes error -body {
& 1.0 2 3
- } -result {can't use floating-point value as operand of "&"}
+ } -result {can't use floating-point value "1.0" as operand of "&"}
test mathop-6.6 {compiled &} -returnCodes error -body {
& 1 2 3.0
- } -result {can't use floating-point value as operand of "&"}
+ } -result {can't use floating-point value "3.0" as operand of "&"}
test mathop-6.7 {compiled &} { & 100000000002 18 -126 } 2
test mathop-6.8 {compiled &} { & 0xff 0o377 333333333333 } 85
test mathop-6.9 {compiled &} { & 1000000000000000000002 18 -126 } 2
test mathop-6.10 {compiled &} { & 0xff 0o377 3333333333333333333333 } 85
test mathop-6.11 {compiled &: errors} -returnCodes error -body {
& x 0
- } -result {can't use non-numeric string as operand of "&"}
+ } -result {can't use non-numeric string "x" as operand of "&"}
test mathop-6.12 {compiled &: errors} -returnCodes error -body {
& nan 0
- } -result {can't use non-numeric floating-point value as operand of "&"}
+ } -result {can't use non-numeric floating-point value "nan" as operand of "&"}
test mathop-6.13 {compiled &: errors} -returnCodes error -body {
& 0 x
- } -result {can't use non-numeric string as operand of "&"}
+ } -result {can't use non-numeric string "x" as operand of "&"}
test mathop-6.14 {compiled &: errors} -returnCodes error -body {
& 0 nan
- } -result {can't use non-numeric floating-point value as operand of "&"}
+ } -result {can't use non-numeric floating-point value "nan" as operand of "&"}
test mathop-6.15 {compiled &: errors} -returnCodes error -body {
& 0o8 0
- } -result {can't use invalid octal number as operand of "&"}
+ } -result {can't use non-numeric string "0o8" as operand of "&"}
test mathop-6.16 {compiled &: errors} -returnCodes error -body {
& 0 0o8
- } -result {can't use invalid octal number as operand of "&"}
+ } -result {can't use non-numeric string "0o8" as operand of "&"}
test mathop-6.17 {compiled &: errors} -returnCodes error -body {
& 0 [error expectedError]
} -result expectedError
@@ -419,32 +419,32 @@ namespace eval ::testmathop {
test mathop-6.22 {interpreted &} { $op 3 7 6 } 2
test mathop-6.23 {interpreted &} -returnCodes error -body {
$op 1.0 2 3
- } -result {can't use floating-point value as operand of "&"}
+ } -result {can't use floating-point value "1.0" as operand of "&"}
test mathop-6.24 {interpreted &} -returnCodes error -body {
$op 1 2 3.0
- } -result {can't use floating-point value as operand of "&"}
+ } -result {can't use floating-point value "3.0" as operand of "&"}
test mathop-6.25 {interpreted &} { $op 100000000002 18 -126 } 2
test mathop-6.26 {interpreted &} { $op 0xff 0o377 333333333333 } 85
test mathop-6.27 {interpreted &} { $op 1000000000000000000002 18 -126 } 2
test mathop-6.28 {interpreted &} { $op 0xff 0o377 3333333333333333333333 } 85
test mathop-6.29 {interpreted &: errors} -returnCodes error -body {
$op x 0
- } -result {can't use non-numeric string as operand of "&"}
+ } -result {can't use non-numeric string "x" as operand of "&"}
test mathop-6.30 {interpreted &: errors} -returnCodes error -body {
$op nan 0
- } -result {can't use non-numeric floating-point value as operand of "&"}
+ } -result {can't use non-numeric floating-point value "nan" as operand of "&"}
test mathop-6.31 {interpreted &: errors} -returnCodes error -body {
$op 0 x
- } -result {can't use non-numeric string as operand of "&"}
+ } -result {can't use non-numeric string "x" as operand of "&"}
test mathop-6.32 {interpreted &: errors} -returnCodes error -body {
$op 0 nan
- } -result {can't use non-numeric floating-point value as operand of "&"}
+ } -result {can't use non-numeric floating-point value "nan" as operand of "&"}
test mathop-6.33 {interpreted &: errors} -returnCodes error -body {
$op 0o8 0
- } -result {can't use invalid octal number as operand of "&"}
+ } -result {can't use non-numeric string "0o8" as operand of "&"}
test mathop-6.34 {interpreted &: errors} -returnCodes error -body {
$op 0 0o8
- } -result {can't use invalid octal number as operand of "&"}
+ } -result {can't use non-numeric string "0o8" as operand of "&"}
test mathop-6.35 {interpreted &: errors} -returnCodes error -body {
$op 0 [error expectedError]
} -result expectedError
@@ -487,32 +487,32 @@ namespace eval ::testmathop {
test mathop-7.4 {compiled |} { | 3 7 6 } 7
test mathop-7.5 {compiled |} -returnCodes error -body {
| 1.0 2 3
- } -result {can't use floating-point value as operand of "|"}
+ } -result {can't use floating-point value "1.0" as operand of "|"}
test mathop-7.6 {compiled |} -returnCodes error -body {
| 1 2 3.0
- } -result {can't use floating-point value as operand of "|"}
+ } -result {can't use floating-point value "3.0" as operand of "|"}
test mathop-7.7 {compiled |} { | 100000000002 18 -126 } -110
test mathop-7.8 {compiled |} { | 0xff 0o377 333333333333 } 333333333503
test mathop-7.9 {compiled |} { | 1000000000000000000002 18 -126 } -110
test mathop-7.10 {compiled |} { | 0xff 0o377 3333333333333333333333 } 3333333333333333333503
test mathop-7.11 {compiled |: errors} -returnCodes error -body {
| x 0
- } -result {can't use non-numeric string as operand of "|"}
+ } -result {can't use non-numeric string "x" as operand of "|"}
test mathop-7.12 {compiled |: errors} -returnCodes error -body {
| nan 0
- } -result {can't use non-numeric floating-point value as operand of "|"}
+ } -result {can't use non-numeric floating-point value "nan" as operand of "|"}
test mathop-7.13 {compiled |: errors} -returnCodes error -body {
| 0 x
- } -result {can't use non-numeric string as operand of "|"}
+ } -result {can't use non-numeric string "x" as operand of "|"}
test mathop-7.14 {compiled |: errors} -returnCodes error -body {
| 0 nan
- } -result {can't use non-numeric floating-point value as operand of "|"}
+ } -result {can't use non-numeric floating-point value "nan" as operand of "|"}
test mathop-7.15 {compiled |: errors} -returnCodes error -body {
| 0o8 0
- } -result {can't use invalid octal number as operand of "|"}
+ } -result {can't use non-numeric string "0o8" as operand of "|"}
test mathop-7.16 {compiled |: errors} -returnCodes error -body {
| 0 0o8
- } -result {can't use invalid octal number as operand of "|"}
+ } -result {can't use non-numeric string "0o8" as operand of "|"}
test mathop-7.17 {compiled |: errors} -returnCodes error -body {
| 0 [error expectedError]
} -result expectedError
@@ -529,32 +529,32 @@ namespace eval ::testmathop {
test mathop-7.22 {interpreted |} { $op 3 7 6 } 7
test mathop-7.23 {interpreted |} -returnCodes error -body {
$op 1.0 2 3
- } -result {can't use floating-point value as operand of "|"}
+ } -result {can't use floating-point value "1.0" as operand of "|"}
test mathop-7.24 {interpreted |} -returnCodes error -body {
$op 1 2 3.0
- } -result {can't use floating-point value as operand of "|"}
+ } -result {can't use floating-point value "3.0" as operand of "|"}
test mathop-7.25 {interpreted |} { $op 100000000002 18 -126 } -110
test mathop-7.26 {interpreted |} { $op 0xff 0o377 333333333333 } 333333333503
test mathop-7.27 {interpreted |} { $op 1000000000000000000002 18 -126 } -110
test mathop-7.28 {interpreted |} { $op 0xff 0o377 3333333333333333333333 } 3333333333333333333503
test mathop-7.29 {interpreted |: errors} -returnCodes error -body {
$op x 0
- } -result {can't use non-numeric string as operand of "|"}
+ } -result {can't use non-numeric string "x" as operand of "|"}
test mathop-7.30 {interpreted |: errors} -returnCodes error -body {
$op nan 0
- } -result {can't use non-numeric floating-point value as operand of "|"}
+ } -result {can't use non-numeric floating-point value "nan" as operand of "|"}
test mathop-7.31 {interpreted |: errors} -returnCodes error -body {
$op 0 x
- } -result {can't use non-numeric string as operand of "|"}
+ } -result {can't use non-numeric string "x" as operand of "|"}
test mathop-7.32 {interpreted |: errors} -returnCodes error -body {
$op 0 nan
- } -result {can't use non-numeric floating-point value as operand of "|"}
+ } -result {can't use non-numeric floating-point value "nan" as operand of "|"}
test mathop-7.33 {interpreted |: errors} -returnCodes error -body {
$op 0o8 0
- } -result {can't use invalid octal number as operand of "|"}
+ } -result {can't use non-numeric string "0o8" as operand of "|"}
test mathop-7.34 {interpreted |: errors} -returnCodes error -body {
$op 0 0o8
- } -result {can't use invalid octal number as operand of "|"}
+ } -result {can't use non-numeric string "0o8" as operand of "|"}
test mathop-7.35 {interpreted |: errors} -returnCodes error -body {
$op 0 [error expectedError]
} -result expectedError
@@ -597,32 +597,32 @@ namespace eval ::testmathop {
test mathop-8.4 {compiled ^} { ^ 3 7 6 } 2
test mathop-8.5 {compiled ^} -returnCodes error -body {
^ 1.0 2 3
- } -result {can't use floating-point value as operand of "^"}
+ } -result {can't use floating-point value "1.0" as operand of "^"}
test mathop-8.6 {compiled ^} -returnCodes error -body {
^ 1 2 3.0
- } -result {can't use floating-point value as operand of "^"}
+ } -result {can't use floating-point value "3.0" as operand of "^"}
test mathop-8.7 {compiled ^} { ^ 100000000002 18 -126 } -100000000110
test mathop-8.8 {compiled ^} { ^ 0xff 0o377 333333333333 } 333333333333
test mathop-8.9 {compiled ^} { ^ 1000000000000000000002 18 -126 } -1000000000000000000110
test mathop-8.10 {compiled ^} { ^ 0xff 0o377 3333333333333333333333 } 3333333333333333333333
test mathop-8.11 {compiled ^: errors} -returnCodes error -body {
^ x 0
- } -result {can't use non-numeric string as operand of "^"}
+ } -result {can't use non-numeric string "x" as operand of "^"}
test mathop-8.12 {compiled ^: errors} -returnCodes error -body {
^ nan 0
- } -result {can't use non-numeric floating-point value as operand of "^"}
+ } -result {can't use non-numeric floating-point value "nan" as operand of "^"}
test mathop-8.13 {compiled ^: errors} -returnCodes error -body {
^ 0 x
- } -result {can't use non-numeric string as operand of "^"}
+ } -result {can't use non-numeric string "x" as operand of "^"}
test mathop-8.14 {compiled ^: errors} -returnCodes error -body {
^ 0 nan
- } -result {can't use non-numeric floating-point value as operand of "^"}
+ } -result {can't use non-numeric floating-point value "nan" as operand of "^"}
test mathop-8.15 {compiled ^: errors} -returnCodes error -body {
^ 0o8 0
- } -result {can't use invalid octal number as operand of "^"}
+ } -result {can't use non-numeric string "0o8" as operand of "^"}
test mathop-8.16 {compiled ^: errors} -returnCodes error -body {
^ 0 0o8
- } -result {can't use invalid octal number as operand of "^"}
+ } -result {can't use non-numeric string "0o8" as operand of "^"}
test mathop-8.17 {compiled ^: errors} -returnCodes error -body {
^ 0 [error expectedError]
} -result expectedError
@@ -639,32 +639,32 @@ namespace eval ::testmathop {
test mathop-8.22 {interpreted ^} { $op 3 7 6 } 2
test mathop-8.23 {interpreted ^} -returnCodes error -body {
$op 1.0 2 3
- } -result {can't use floating-point value as operand of "^"}
+ } -result {can't use floating-point value "1.0" as operand of "^"}
test mathop-8.24 {interpreted ^} -returnCodes error -body {
$op 1 2 3.0
- } -result {can't use floating-point value as operand of "^"}
+ } -result {can't use floating-point value "3.0" as operand of "^"}
test mathop-8.25 {interpreted ^} { $op 100000000002 18 -126 } -100000000110
test mathop-8.26 {interpreted ^} { $op 0xff 0o377 333333333333 } 333333333333
test mathop-8.27 {interpreted ^} { $op 1000000000000000000002 18 -126 } -1000000000000000000110
test mathop-8.28 {interpreted ^} { $op 0xff 0o377 3333333333333333333333 } 3333333333333333333333
test mathop-8.29 {interpreted ^: errors} -returnCodes error -body {
$op x 0
- } -result {can't use non-numeric string as operand of "^"}
+ } -result {can't use non-numeric string "x" as operand of "^"}
test mathop-8.30 {interpreted ^: errors} -returnCodes error -body {
$op nan 0
- } -result {can't use non-numeric floating-point value as operand of "^"}
+ } -result {can't use non-numeric floating-point value "nan" as operand of "^"}
test mathop-8.31 {interpreted ^: errors} -returnCodes error -body {
$op 0 x
- } -result {can't use non-numeric string as operand of "^"}
+ } -result {can't use non-numeric string "x" as operand of "^"}
test mathop-8.32 {interpreted ^: errors} -returnCodes error -body {
$op 0 nan
- } -result {can't use non-numeric floating-point value as operand of "^"}
+ } -result {can't use non-numeric floating-point value "nan" as operand of "^"}
test mathop-8.33 {interpreted ^: errors} -returnCodes error -body {
$op 0o8 0
- } -result {can't use invalid octal number as operand of "^"}
+ } -result {can't use non-numeric string "0o8" as operand of "^"}
test mathop-8.34 {interpreted ^: errors} -returnCodes error -body {
$op 0 0o8
- } -result {can't use invalid octal number as operand of "^"}
+ } -result {can't use non-numeric string "0o8" as operand of "^"}
test mathop-8.35 {interpreted ^: errors} -returnCodes error -body {
$op 0 [error expectedError]
} -result expectedError
@@ -775,13 +775,13 @@ test mathop-20.6 { one arg, error } {
# skipping - for now, knownbug...
foreach op {+ * / & | ^ **} {
lappend res [TestOp $op {*}$vals]
- lappend exp "can't use non-numeric string as operand of \"$op\"\
+ lappend exp "can't use non-numeric string \"x\" as operand of \"$op\"\
ARITH DOMAIN {non-numeric string}"
}
}
foreach op {+ * / & | ^ **} {
lappend res [TestOp $op NaN 1]
- lappend exp "can't use non-numeric floating-point value as operand of \"$op\"\
+ lappend exp "can't use non-numeric floating-point value \"NaN\" as operand of \"$op\"\
ARITH DOMAIN {non-numeric floating-point value}"
}
expr {$res eq $exp ? 0 : $res}
@@ -850,15 +850,15 @@ test mathop-21.5 { unary ops, bad values } {
set res {}
set exp {}
lappend res [TestOp / x]
- lappend exp "can't use non-numeric string as operand of \"/\" ARITH DOMAIN {non-numeric string}"
+ lappend exp "can't use non-numeric string \"x\" as operand of \"/\" ARITH DOMAIN {non-numeric string}"
lappend res [TestOp - x]
- lappend exp "can't use non-numeric string as operand of \"-\" ARITH DOMAIN {non-numeric string}"
+ lappend exp "can't use non-numeric string \"x\" as operand of \"-\" ARITH DOMAIN {non-numeric string}"
lappend res [TestOp ~ x]
- lappend exp "can't use non-numeric string as operand of \"~\" ARITH DOMAIN {non-numeric string}"
+ lappend exp "can't use non-numeric string \"x\" as operand of \"~\" ARITH DOMAIN {non-numeric string}"
lappend res [TestOp ! x]
- lappend exp "can't use non-numeric string as operand of \"!\" ARITH DOMAIN {non-numeric string}"
+ lappend exp "can't use non-numeric string \"x\" as operand of \"!\" ARITH DOMAIN {non-numeric string}"
lappend res [TestOp ~ 5.0]
- lappend exp "can't use floating-point value as operand of \"~\" ARITH DOMAIN {floating-point value}"
+ lappend exp "can't use floating-point value \"5.0\" as operand of \"~\" ARITH DOMAIN {floating-point value}"
expr {$res eq $exp ? 0 : $res}
} 0
test mathop-21.6 { unary ops, too many } {
@@ -965,9 +965,9 @@ test mathop-22.4 { unary ops, bad values } {
set exp {}
foreach op {& | ^} {
lappend res [TestOp $op x 5]
- lappend exp "can't use non-numeric string as operand of \"$op\" ARITH DOMAIN {non-numeric string}"
+ lappend exp "can't use non-numeric string \"x\" as operand of \"$op\" ARITH DOMAIN {non-numeric string}"
lappend res [TestOp $op 5 x]
- lappend exp "can't use non-numeric string as operand of \"$op\" ARITH DOMAIN {non-numeric string}"
+ lappend exp "can't use non-numeric string \"x\" as operand of \"$op\" ARITH DOMAIN {non-numeric string}"
}
expr {$res eq $exp ? 0 : $res}
} 0
@@ -1080,15 +1080,15 @@ test mathop-24.3 { binary ops, bad values } {
set exp {}
foreach op {% << >>} {
lappend res [TestOp $op x 1]
- lappend exp "can't use non-numeric string as operand of \"$op\" ARITH DOMAIN {non-numeric string}"
+ lappend exp "can't use non-numeric string \"x\" as operand of \"$op\" ARITH DOMAIN {non-numeric string}"
lappend res [TestOp $op 1 x]
- lappend exp "can't use non-numeric string as operand of \"$op\" ARITH DOMAIN {non-numeric string}"
+ lappend exp "can't use non-numeric string \"x\" as operand of \"$op\" ARITH DOMAIN {non-numeric string}"
}
foreach op {% << >>} {
lappend res [TestOp $op 5.0 1]
- lappend exp "can't use floating-point value as operand of \"$op\" ARITH DOMAIN {floating-point value}"
+ lappend exp "can't use floating-point value \"5.0\" as operand of \"$op\" ARITH DOMAIN {floating-point value}"
lappend res [TestOp $op 1 5.0]
- lappend exp "can't use floating-point value as operand of \"$op\" ARITH DOMAIN {floating-point value}"
+ lappend exp "can't use floating-point value \"5.0\" as operand of \"$op\" ARITH DOMAIN {floating-point value}"
}
foreach op {in ni} {
lappend res [TestOp $op 5 "a b \{ c"]
@@ -1266,9 +1266,9 @@ test mathop-25.41 { exp operator errors } {
lappend res [TestOp ** $huge 2.1]
lappend exp "Inf"
lappend res [TestOp ** 2 foo]
- lappend exp "can't use non-numeric string as operand of \"**\" ARITH DOMAIN {non-numeric string}"
+ lappend exp "can't use non-numeric string \"foo\" as operand of \"**\" ARITH DOMAIN {non-numeric string}"
lappend res [TestOp ** foo 2]
- lappend exp "can't use non-numeric string as operand of \"**\" ARITH DOMAIN {non-numeric string}"
+ lappend exp "can't use non-numeric string \"foo\" as operand of \"**\" ARITH DOMAIN {non-numeric string}"
expr {$res eq $exp ? 0 : $res}
} 0
diff --git a/tests/namespace-old.test b/tests/namespace-old.test
index 1d6a805..3f8737b 100644
--- a/tests/namespace-old.test
+++ b/tests/namespace-old.test
@@ -293,12 +293,13 @@ namespace eval test_ns_hier1 {
namespace eval test_ns_hier2a {}
namespace eval test_ns_hier2b {}
}
+# TIP 278: secondary lookup disabled for vars, tests disabled with #
test namespace-old-5.4 {nested namespaces can access global namespace} {
- list [namespace eval test_ns_hier1 {set test_ns_var_global}] \
+ list [namespace eval test_ns_hier1 {#set test_ns_var_global}] \
[namespace eval test_ns_hier1 {test_ns_cmd_global}] \
- [namespace eval test_ns_hier1::test_ns_hier2 {set test_ns_var_global}] \
+ [namespace eval test_ns_hier1::test_ns_hier2 {#set test_ns_var_global}] \
[namespace eval test_ns_hier1::test_ns_hier2 {test_ns_cmd_global}]
-} {{var in ::} {cmd in ::} {var in ::} {cmd in ::}}
+} {{} {cmd in ::} {} {cmd in ::}}
test namespace-old-5.5 {variables in different namespaces don't conflict} {
list [set test_ns_hier1::test_ns_level] \
[set test_ns_hier1::test_ns_hier2::test_ns_level]
@@ -468,11 +469,12 @@ test namespace-old-6.11 {commands affect all parent namespaces} {
}
list [test_ns_cache1::trigger] [test_ns_cache1::test_ns_cache2::trigger]
} {{cache2 version} {cache2 version}}
+# TIP 278: secondary lookup disabled, catch added, result changed from {global version}
test namespace-old-6.12 {define test variables} {
variable test_ns_cache_var "global version"
set trigger {set test_ns_cache_var}
- namespace eval test_ns_cache1 $trigger
-} {global version}
+ list [catch {namespace eval test_ns_cache1 $trigger} msg] $msg
+} {1 {can't read "test_ns_cache_var": no such variable}}
set trigger {set test_ns_cache_var}
test namespace-old-6.13 {one-level check for variable shadowing} {
namespace eval test_ns_cache1 {
@@ -481,22 +483,24 @@ test namespace-old-6.13 {one-level check for variable shadowing} {
namespace eval test_ns_cache1 $trigger
} {cache1 version}
variable ::test_ns_cache_var "global version"
+# TIP 278: secondary lookup disabled, catch added, result changed from {global version}
test namespace-old-6.14 {deleting variables changes variable epoch} {
namespace eval test_ns_cache1 {
variable test_ns_cache_var "cache1 version"
}
list [namespace eval test_ns_cache1 $trigger] \
[namespace eval test_ns_cache1 {unset test_ns_cache_var}] \
- [namespace eval test_ns_cache1 $trigger]
-} {{cache1 version} {} {global version}}
+ [catch {namespace eval test_ns_cache1 $trigger}]
+} {{cache1 version} {} 1}
+# TIP 278: secondary lookup disabled, catch added, result changed
test namespace-old-6.15 {define test namespaces} {
namespace eval test_ns_cache2 {
variable test_ns_cache_var "global cache2 version"
}
set trigger2 {set test_ns_cache2::test_ns_cache_var}
- list [namespace eval test_ns_cache1 $trigger2] \
- [namespace eval test_ns_cache1::test_ns_cache2 $trigger]
-} {{global cache2 version} {global version}}
+ catch {list [namespace eval test_ns_cache1 $trigger2] \
+ [namespace eval test_ns_cache1::test_ns_cache2 $trigger]}
+} 1
set trigger2 {set test_ns_cache2::test_ns_cache_var}
test namespace-old-6.16 {public variables affect all parent namespaces} {
variable test_ns_cache1::test_ns_cache2::test_ns_cache_var "cache2 version"
diff --git a/tests/namespace.test b/tests/namespace.test
index e90c753..bdc3569 100644
--- a/tests/namespace.test
+++ b/tests/namespace.test
@@ -46,9 +46,9 @@ test namespace-2.2 {Tcl_GetCurrentNamespace} {
set l {}
lappend l [namespace current]
namespace eval test_ns_1 {
- lappend l [namespace current]
+ lappend ::l [namespace current]
namespace eval foo {
- lappend l [namespace current]
+ lappend ::l [namespace current]
}
}
lappend l [namespace current]
@@ -646,6 +646,8 @@ test namespace-14.2 {TclGetNamespaceForQualName, invalid absolute names} -setup
[catch {namespace children test_ns_777} msg] $msg
}
} -result {1 {can't read "::test_ns_777::v": no such variable} 1 {namespace "test_ns_777" not found in "::test_ns_1"}}
+
+# TIP 278: secondary lookup disabled, results changed from {10 20}
test namespace-14.3 {TclGetNamespaceForQualName, relative names} -setup {
catch {namespace delete {*}[namespace children :: test_ns_*]}
variable v 10
@@ -657,9 +659,11 @@ test namespace-14.3 {TclGetNamespaceForQualName, relative names} -setup {
}
} -body {
namespace eval test_ns_1 {
- list $v $test_ns_2::v
+ # list $v $test_ns_2::v
+ list [catch {set v} msg] $msg [catch {set test_ns_2::v} msg] $msg
}
-} -result {10 20}
+} -result {1 {can't read "v": no such variable} 0 20}
+
test namespace-14.4 {TclGetNamespaceForQualName, relative ns names looked up only in current ns} {
namespace eval test_ns_1::test_ns_2 {
namespace eval foo {}
@@ -720,15 +724,17 @@ test namespace-14.11 {TclGetNamespaceForQualName, extra ::s are significant for
proc test_ns_1::test_ns_2:: {args} {return "\{\}: $args"}
lappend l [test_ns_1::test_ns_2:: hello]
} -result {1 {invalid command name "test_ns_1::test_ns_2::"} {{}: hello}}
+
+# TIP 278: secondary lookup disabled, added catch, result changed from y
test namespace-14.12 {TclGetNamespaceForQualName, extra ::s are significant for vars} -setup {
catch {namespace delete {*}[namespace children :: test_ns_*]}
} -body {
namespace eval test_ns_1 {
variable {}
- set test_ns_1::(x) y
+ catch {set test_ns_1::(x) y} ::msg
}
- set test_ns_1::(x)
-} -result y
+ list $::msg [catch {set test_ns_1::(x)} msg] $msg
+} -result {{can't set "test_ns_1::(x)": parent namespace doesn't exist} 1 {can't read "test_ns_1::(x)": no such variable}}
test namespace-14.13 {TclGetNamespaceForQualName, namespace other than global ns can't have empty name} -setup {
catch {namespace delete {*}[namespace children :: test_ns_*]}
} -returnCodes error -body {
@@ -901,13 +907,15 @@ test namespace-17.6 {Tcl_FindNamespaceVar, relative name found} -setup {
set x
}
} -result {777}
+
+# TIP 278: secondary lookup disabled, catch added, result changed from 314159
test namespace-17.7 {Tcl_FindNamespaceVar, relative name found} {
namespace eval test_ns_1 {
variable x 777
unset x
- set x ;# must be global x now
+ list [catch {set x} msg] $msg ;# must not be global x now
}
-} {314159}
+} {1 {can't read "x": no such variable}}
test namespace-17.8 {Tcl_FindNamespaceVar, relative name not found} -body {
namespace eval test_ns_1 {
set wuzzat
@@ -919,6 +927,8 @@ test namespace-17.9 {Tcl_FindNamespaceVar, relative name and TCL_GLOBAL_ONLY} {
}
set test_ns_1::a
} {hello}
+
+# TIP 278: secondary lookup disabled, result changed from 1
test namespace-17.10 {Tcl_FindNamespaceVar, interference with cached varNames} -setup {
namespace eval test_ns_1 {}
} -body {
@@ -932,7 +942,7 @@ test namespace-17.10 {Tcl_FindNamespaceVar, interference with cached varNames} -
namespace eval test_ns_1 set a 1
namespace delete test_ns_1
return $a
-} -result 1
+} -result 0
catch {unset a}
catch {unset x}
@@ -1553,6 +1563,8 @@ test namespace-34.6 {NamespaceWhichCmd, -command is default} -setup {
[namespace which ::test_ns_2::cmd2]
}
} -result {::foreach ::test_ns_3::p ::test_ns_3::cmd1 ::test_ns_2::cmd2}
+
+# TIP 278: secondary lookup disabled, catch added, result changed
test namespace-34.7 {NamespaceWhichCmd, variable lookup} -setup {
catch {namespace delete {*}[namespace children test_ns_*]}
namespace eval test_ns_1 {
@@ -1572,12 +1584,12 @@ test namespace-34.7 {NamespaceWhichCmd, variable lookup} -setup {
}
} -body {
namespace eval test_ns_3 {
- list [namespace which -variable env] \
+ list [catch {namespace which -variable env } msg] $msg \
[namespace which -variable v3] \
[namespace which -variable ::test_ns_2::v2] \
[catch {namespace which -variable ::test_ns_2::noSuchVar} msg] $msg
}
-} -result {::env ::test_ns_3::v3 ::test_ns_2::v2 0 {}}
+} -result {0 {} ::test_ns_3::v3 ::test_ns_2::v2 0 {}}
test namespace-35.1 {FreeNsNameInternalRep, resulting ref count > 0} -setup {
catch {namespace delete {*}[namespace children :: test_ns_*]}
diff --git a/tests/parse.test b/tests/parse.test
index 287c392..d36472e 100644
--- a/tests/parse.test
+++ b/tests/parse.test
@@ -376,12 +376,12 @@ test parse-8.8 {Tcl_EvalObjv procedure, async handlers} -constraints {
return "new result"
}
set handler1 [testasync create async1]
- set aresult xxx
- set acode yyy
+ set ::aresult xxx
+ set ::acode yyy
} -cleanup {
testasync delete
} -body {
- list [testevalobjv 0 testasync mark $handler1 original 0] $acode $aresult
+ list [testevalobjv 0 testasync mark $handler1 original 0] $::acode $::aresult
} -result {{new result} 0 original}
test parse-8.9 {Tcl_EvalObjv procedure, exceptional return} testevalobjv {
list [catch {testevalobjv 0 error message} msg] $msg
diff --git a/tests/result.test b/tests/result.test
index 859e546..1eff46e 100644
--- a/tests/result.test
+++ b/tests/result.test
@@ -31,7 +31,7 @@ test result-1.2 {Tcl_SaveInterpResult} {testsaveresult} {
} {append result}
test result-1.3 {Tcl_SaveInterpResult} {testsaveresult} {
testsaveresult dynamic {set x 42} 0
-} {dynamic result presentOrFreed}
+} {dynamic result freed}
test result-1.4 {Tcl_SaveInterpResult} {testsaveresult} {
testsaveresult object {set x 42} 0
} {object result same}
@@ -43,7 +43,7 @@ test result-1.6 {Tcl_SaveInterpResult} {testsaveresult} {
} {42}
test result-1.7 {Tcl_SaveInterpResult} {testsaveresult} {
testsaveresult dynamic {set x 42} 1
-} {42 presentOrFreed}
+} {42 freed}
test result-1.8 {Tcl_SaveInterpResult} {testsaveresult} {
testsaveresult object {set x 42} 1
} {42 different}
diff --git a/tests/string.test b/tests/string.test
index f077164..c54b5ba 100644
--- a/tests/string.test
+++ b/tests/string.test
@@ -495,10 +495,10 @@ test string-5.16.$noComp {string index, bytearray object with string obj shimmer
} 0
test string-5.17.$noComp {string index, bad integer} -body {
list [catch {run {string index "abc" 0o8}} msg] $msg
-} -match glob -result {1 {*invalid octal number*}}
+} -match glob -result {1 {*}}
test string-5.18.$noComp {string index, bad integer} -body {
list [catch {run {string index "abc" end-0o0289}} msg] $msg
-} -match glob -result {1 {*invalid octal number*}}
+} -match glob -result {1 {*}}
test string-5.19.$noComp {string index, bytearray object out of bounds} {
run {string index [binary format I* {0x50515253 0x52}] -1}
} {}
diff --git a/tests/tcltest.test b/tests/tcltest.test
index ca720ee..fb5839b 100644
--- a/tests/tcltest.test
+++ b/tests/tcltest.test
@@ -544,6 +544,7 @@ set notReadableDir [file join [temporaryDirectory] notreadable]
set notWriteableDir [file join [temporaryDirectory] notwriteable]
makeDirectory notreadable
makeDirectory notwriteable
+
switch -- $::tcl_platform(platform) {
unix {
file attributes $notReadableDir -permissions 00333
diff --git a/tests/utf.test b/tests/utf.test
index dc1a435..04580a1 100644
--- a/tests/utf.test
+++ b/tests/utf.test
@@ -108,7 +108,7 @@ test utf-4.2 {Tcl_NumUtfChars: length 1} {testnumutfchars testbytestring} {
testnumutfchars [testbytestring "\xC2\xA2"]
} {1}
test utf-4.3 {Tcl_NumUtfChars: long string} {testnumutfchars testbytestring} {
- testnumutfchars [testbytestring "abc\xC2\xA2\xE4\xB9\x8E\uA2\x4E"]
+ testnumutfchars [testbytestring "abc\xC2\xA2\xE4\xB9\x8E\xA2\x4E"]
} {7}
test utf-4.4 {Tcl_NumUtfChars: #u0000} {testnumutfchars testbytestring} {
testnumutfchars [testbytestring "\xC0\x80"]
@@ -120,7 +120,7 @@ test utf-4.6 {Tcl_NumUtfChars: length 1, calc len} {testnumutfchars testbytestri
testnumutfchars [testbytestring "\xC2\xA2"] 2
} {1}
test utf-4.7 {Tcl_NumUtfChars: long string, calc len} {testnumutfchars testbytestring} {
- testnumutfchars [testbytestring "abc\xC2\xA2\xE4\xB9\x8E\uA2\x4E"] 10
+ testnumutfchars [testbytestring "abc\xC2\xA2\xE4\xB9\x8E\xA2\x4E"] 10
} {7}
test utf-4.8 {Tcl_NumUtfChars: #u0000, calc len} {testnumutfchars testbytestring} {
testnumutfchars [testbytestring "\xC0\x80"] 2
diff --git a/tests/util.test b/tests/util.test
index 053eb0c..8f42047 100644
--- a/tests/util.test
+++ b/tests/util.test
@@ -22,9 +22,6 @@ testConstraint testconcatobj [llength [info commands testconcatobj]]
testConstraint testdoubledigits [llength [info commands testdoubledigits]]
testConstraint testprint [llength [info commands testprint]]
-testConstraint precision [expr {![catch {set saved_precision $::tcl_precision}]}]
-
-
# Big test for correct ordering of data in [expr]
proc testIEEE {} {
@@ -282,7 +279,7 @@ test util-5.17 {Tcl_StringMatch: UTF-8} {
test util-5.18 {Tcl_StringMatch: UTF-8} testbytestring {
# pattern += Tcl_UtfToUniChar(pattern, &endChar);
# proper advance: wrong answer would match on UTF trail byte of \u4e4f
- Wrapper_Tcl_StringMatch {a[a\u4e4fc]c} [testbytestring a\x8fc]
+ Wrapper_Tcl_StringMatch {a[a\u4e4fc]c} [testbytestring a\x8Fc]
} 0
test util-5.19 {Tcl_StringMatch: UTF-8} {
# pattern += Tcl_UtfToUniChar(pattern, &endChar);
@@ -388,38 +385,6 @@ test util-5.51 {Tcl_StringMatch} {
Wrapper_Tcl_StringMatch "" ""
} 1
-test util-6.1 {Tcl_PrintDouble - using tcl_precision} -constraints precision -setup {
- set old_precision $::tcl_precision
- set ::tcl_precision 12
-} -body {
- concat x[expr 1.4]
-} -cleanup {
- set ::tcl_precision $old_precision
-} -result {x1.4}
-test util-6.2 {Tcl_PrintDouble - using tcl_precision} -constraints precision -setup {
- set old_precision $::tcl_precision
- set ::tcl_precision 12
-} -body {
- concat x[expr 1.39999999999]
-} -cleanup {
- set ::tcl_precision $old_precision
-} -result {x1.39999999999}
-test util-6.3 {Tcl_PrintDouble - using tcl_precision} -constraints precision -setup {
- set old_precision $::tcl_precision
- set ::tcl_precision 12
-} -body {
- concat x[expr 1.399999999999]
-} -cleanup {
- set ::tcl_precision $old_precision
-} -result {x1.4}
-test util-6.4 {Tcl_PrintDouble - using tcl_precision} -constraints precision -setup {
- set old_precision $::tcl_precision
- set ::tcl_precision 5
-} -body {
- concat x[expr 1.123412341234]
-} -cleanup {
- set tcl_precision $old_precision
-} -result {x1.1234}
test util-6.5 {Tcl_PrintDouble - make sure there's a decimal point} {
concat x[expr 2.0]
} {x2.0}
@@ -427,50 +392,6 @@ test util-6.6 {Tcl_PrintDouble - make sure there's a decimal point} {
concat x[expr 3.0e98]
} {x3e+98}
-test util-7.1 {TclPrecTraceProc - unset callbacks} -constraints precision -setup {
- set old_precision $::tcl_precision
-} -body {
- set tcl_precision 7
- set x $tcl_precision
- unset tcl_precision
- list $x $tcl_precision
-} -cleanup {
- set ::tcl_precision $old_precision
-} -result {7 7}
-test util-7.2 {TclPrecTraceProc - read traces, sharing among interpreters} -constraints precision -setup {
- set old_precision $::tcl_precision
-} -body {
- set tcl_precision 12
- interp create child
- set x [child eval set tcl_precision]
- child eval {set tcl_precision 6}
- interp delete child
- list $x $tcl_precision
-} -cleanup {
- set ::tcl_precision $old_precision
-} -result {12 6}
-test util-7.3 {TclPrecTraceProc - write traces, safe interpreters} -constraints precision -setup {
- set old_precision $::tcl_precision
-} -body {
- set tcl_precision 12
- interp create -safe child
- set x [child eval {
- list [catch {set tcl_precision 8} msg] $msg
- }]
- interp delete child
- list $x $tcl_precision
-} -cleanup {
- set ::tcl_precision $old_precision
-} -result {{1 {can't set "tcl_precision": can't modify precision from a safe interpreter}} 12}
-test util-7.4 {TclPrecTraceProc - write traces, bogus values} -constraints precision -setup {
- set old_precision $::tcl_precision
-} -body {
- set tcl_precision 12
- list [catch {set tcl_precision abc} msg] $msg $tcl_precision
-} -cleanup {
- set ::tcl_precision $old_precision
-} -result {1 {can't set "tcl_precision": improper value for precision} 12}
-
# This test always succeeded in the C locale anyway...
test util-8.1 {TclNeedSpace - correct UTF8 handling} {
# Bug 411825
@@ -2184,1874 +2105,6 @@ test util-15.8 {smallest normal} {*}{
}
}
-foreach ::tcl_precision {0 12} {
- for {set e -312} {$e < -9} {incr e} {
- test util-16.1.$::tcl_precision.$e {shortening of numbers} \
- "expr 1.1e$e" 1.1e$e
- }
-}
-set tcl_precision 0
-for {set e -9} {$e < -4} {incr e} {
- test util-16.1.$::tcl_precision.$e {shortening of numbers} \
- "expr 1.1e$e" 1.1e$e
-}
-set tcl_precision 12
-for {set e -9} {$e < -4} {incr e} {
- test util-16.1.$::tcl_precision.$e {8.4 compatible formatting of doubles} precision \
- "expr 1.1e$e" 1.1e[format %+03d $e]
-}
-foreach ::tcl_precision {0 12} {
- test util-16.1.$::tcl_precision.-4 {shortening of numbers} \
- {expr 1.1e-4} \
- 0.00011
- test util-16.1.$::tcl_precision.-3 {shortening of numbers} \
- {expr 1.1e-3} \
- 0.0011
- test util-16.1.$::tcl_precision.-2 {shortening of numbers} \
- {expr 1.1e-2} \
- 0.011
- test util-16.1.$::tcl_precision.-1 {shortening of numbers} \
- {expr 1.1e-1} \
- 0.11
- test util-16.1.$::tcl_precision.0 {shortening of numbers} \
- {expr 1.1} \
- 1.1
- for {set e 1} {$e < 17} {incr e} {
- test util-16.1.$::tcl_precision.$e {shortening of numbers} \
- "expr 11[string repeat 0 [expr {$e-1}]].0" \
- 11[string repeat 0 [expr {$e-1}]].0
- }
- for {set e 17} {$e < 309} {incr e} {
- test util-16.1.$::tcl_precision.$e {shortening of numbers} \
- "expr 1.1e$e" 1.1e+$e
- }
-}
-set tcl_precision 17
-test util-16.1.17.-300 {8.4 compatible formatting of doubles} precision \
- {expr 1e-300} \
- 1e-300
-test util-16.1.17.-299 {8.4 compatible formatting of doubles} precision \
- {expr 1e-299} \
- 9.9999999999999999e-300
-test util-16.1.17.-298 {8.4 compatible formatting of doubles} precision \
- {expr 1e-298} \
- 9.9999999999999991e-299
-test util-16.1.17.-297 {8.4 compatible formatting of doubles} precision \
- {expr 1e-297} \
- 1e-297
-test util-16.1.17.-296 {8.4 compatible formatting of doubles} precision \
- {expr 1e-296} \
- 1e-296
-test util-16.1.17.-295 {8.4 compatible formatting of doubles} precision \
- {expr 1e-295} \
- 1.0000000000000001e-295
-test util-16.1.17.-294 {8.4 compatible formatting of doubles} precision \
- {expr 1e-294} \
- 1e-294
-test util-16.1.17.-293 {8.4 compatible formatting of doubles} precision \
- {expr 1e-293} \
- 1.0000000000000001e-293
-test util-16.1.17.-292 {8.4 compatible formatting of doubles} precision \
- {expr 1e-292} \
- 1.0000000000000001e-292
-test util-16.1.17.-291 {8.4 compatible formatting of doubles} precision \
- {expr 1e-291} \
- 9.9999999999999996e-292
-test util-16.1.17.-290 {8.4 compatible formatting of doubles} precision \
- {expr 1e-290} \
- 1.0000000000000001e-290
-test util-16.1.17.-289 {8.4 compatible formatting of doubles} precision \
- {expr 1e-289} \
- 1e-289
-test util-16.1.17.-288 {8.4 compatible formatting of doubles} precision \
- {expr 1e-288} \
- 1.0000000000000001e-288
-test util-16.1.17.-287 {8.4 compatible formatting of doubles} precision \
- {expr 1e-287} \
- 1e-287
-test util-16.1.17.-286 {8.4 compatible formatting of doubles} precision \
- {expr 1e-286} \
- 1.0000000000000001e-286
-test util-16.1.17.-285 {8.4 compatible formatting of doubles} precision \
- {expr 1e-285} \
- 1.0000000000000001e-285
-test util-16.1.17.-284 {8.4 compatible formatting of doubles} precision \
- {expr 1e-284} \
- 1e-284
-test util-16.1.17.-283 {8.4 compatible formatting of doubles} precision \
- {expr 1e-283} \
- 9.9999999999999995e-284
-test util-16.1.17.-282 {8.4 compatible formatting of doubles} precision \
- {expr 1e-282} \
- 1e-282
-test util-16.1.17.-281 {8.4 compatible formatting of doubles} precision \
- {expr 1e-281} \
- 1e-281
-test util-16.1.17.-280 {8.4 compatible formatting of doubles} precision \
- {expr 1e-280} \
- 9.9999999999999996e-281
-test util-16.1.17.-279 {8.4 compatible formatting of doubles} precision \
- {expr 1e-279} \
- 1.0000000000000001e-279
-test util-16.1.17.-278 {8.4 compatible formatting of doubles} precision \
- {expr 1e-278} \
- 9.9999999999999994e-279
-test util-16.1.17.-277 {8.4 compatible formatting of doubles} precision \
- {expr 1e-277} \
- 9.9999999999999997e-278
-test util-16.1.17.-276 {8.4 compatible formatting of doubles} precision \
- {expr 1e-276} \
- 1.0000000000000001e-276
-test util-16.1.17.-275 {8.4 compatible formatting of doubles} precision \
- {expr 1e-275} \
- 9.9999999999999993e-276
-test util-16.1.17.-274 {8.4 compatible formatting of doubles} precision \
- {expr 1e-274} \
- 9.9999999999999997e-275
-test util-16.1.17.-273 {8.4 compatible formatting of doubles} precision \
- {expr 1e-273} \
- 1.0000000000000001e-273
-test util-16.1.17.-272 {8.4 compatible formatting of doubles} precision \
- {expr 1e-272} \
- 9.9999999999999993e-273
-test util-16.1.17.-271 {8.4 compatible formatting of doubles} precision \
- {expr 1e-271} \
- 9.9999999999999996e-272
-test util-16.1.17.-270 {8.4 compatible formatting of doubles} precision \
- {expr 1e-270} \
- 1e-270
-test util-16.1.17.-269 {8.4 compatible formatting of doubles} precision \
- {expr 1e-269} \
- 9.9999999999999996e-270
-test util-16.1.17.-268 {8.4 compatible formatting of doubles} precision \
- {expr 1e-268} \
- 9.9999999999999996e-269
-test util-16.1.17.-267 {8.4 compatible formatting of doubles} precision \
- {expr 1e-267} \
- 9.9999999999999998e-268
-test util-16.1.17.-266 {8.4 compatible formatting of doubles} precision \
- {expr 1e-266} \
- 9.9999999999999998e-267
-test util-16.1.17.-265 {8.4 compatible formatting of doubles} precision \
- {expr 1e-265} \
- 9.9999999999999998e-266
-test util-16.1.17.-264 {8.4 compatible formatting of doubles} precision \
- {expr 1e-264} \
- 1e-264
-test util-16.1.17.-263 {8.4 compatible formatting of doubles} precision \
- {expr 1e-263} \
- 1e-263
-test util-16.1.17.-262 {8.4 compatible formatting of doubles} precision \
- {expr 1e-262} \
- 1e-262
-test util-16.1.17.-261 {8.4 compatible formatting of doubles} precision \
- {expr 1e-261} \
- 9.9999999999999998e-262
-test util-16.1.17.-260 {8.4 compatible formatting of doubles} precision \
- {expr 1e-260} \
- 9.9999999999999996e-261
-test util-16.1.17.-259 {8.4 compatible formatting of doubles} precision \
- {expr 1e-259} \
- 1.0000000000000001e-259
-test util-16.1.17.-258 {8.4 compatible formatting of doubles} precision \
- {expr 1e-258} \
- 9.9999999999999995e-259
-test util-16.1.17.-257 {8.4 compatible formatting of doubles} precision \
- {expr 1e-257} \
- 9.9999999999999998e-258
-test util-16.1.17.-256 {8.4 compatible formatting of doubles} precision \
- {expr 1e-256} \
- 9.9999999999999998e-257
-test util-16.1.17.-255 {8.4 compatible formatting of doubles} precision \
- {expr 1e-255} \
- 1e-255
-test util-16.1.17.-254 {8.4 compatible formatting of doubles} precision \
- {expr 1e-254} \
- 9.9999999999999991e-255
-test util-16.1.17.-253 {8.4 compatible formatting of doubles} precision \
- {expr 1e-253} \
- 1.0000000000000001e-253
-test util-16.1.17.-252 {8.4 compatible formatting of doubles} precision \
- {expr 1e-252} \
- 9.9999999999999994e-253
-test util-16.1.17.-251 {8.4 compatible formatting of doubles} precision \
- {expr 1e-251} \
- 1e-251
-test util-16.1.17.-250 {8.4 compatible formatting of doubles} precision \
- {expr 1e-250} \
- 1.0000000000000001e-250
-test util-16.1.17.-249 {8.4 compatible formatting of doubles} precision \
- {expr 1e-249} \
- 1.0000000000000001e-249
-test util-16.1.17.-248 {8.4 compatible formatting of doubles} precision \
- {expr 1e-248} \
- 9.9999999999999998e-249
-test util-16.1.17.-247 {8.4 compatible formatting of doubles} precision \
- {expr 1e-247} \
- 1e-247
-test util-16.1.17.-246 {8.4 compatible formatting of doubles} precision \
- {expr 1e-246} \
- 9.9999999999999996e-247
-test util-16.1.17.-245 {8.4 compatible formatting of doubles} precision \
- {expr 1e-245} \
- 9.9999999999999993e-246
-test util-16.1.17.-244 {8.4 compatible formatting of doubles} precision \
- {expr 1e-244} \
- 9.9999999999999993e-245
-test util-16.1.17.-243 {8.4 compatible formatting of doubles} precision \
- {expr 1e-243} \
- 1e-243
-test util-16.1.17.-242 {8.4 compatible formatting of doubles} precision \
- {expr 1e-242} \
- 9.9999999999999997e-243
-test util-16.1.17.-241 {8.4 compatible formatting of doubles} precision \
- {expr 1e-241} \
- 9.9999999999999997e-242
-test util-16.1.17.-240 {8.4 compatible formatting of doubles} precision \
- {expr 1e-240} \
- 9.9999999999999997e-241
-test util-16.1.17.-239 {8.4 compatible formatting of doubles} precision \
- {expr 1e-239} \
- 1.0000000000000001e-239
-test util-16.1.17.-238 {8.4 compatible formatting of doubles} precision \
- {expr 1e-238} \
- 9.9999999999999999e-239
-test util-16.1.17.-237 {8.4 compatible formatting of doubles} precision \
- {expr 1e-237} \
- 9.9999999999999999e-238
-test util-16.1.17.-236 {8.4 compatible formatting of doubles} precision \
- {expr 1e-236} \
- 1e-236
-test util-16.1.17.-235 {8.4 compatible formatting of doubles} precision \
- {expr 1e-235} \
- 9.9999999999999996e-236
-test util-16.1.17.-234 {8.4 compatible formatting of doubles} precision \
- {expr 1e-234} \
- 9.9999999999999996e-235
-test util-16.1.17.-233 {8.4 compatible formatting of doubles} precision \
- {expr 1e-233} \
- 9.9999999999999996e-234
-test util-16.1.17.-232 {8.4 compatible formatting of doubles} precision \
- {expr 1e-232} \
- 1e-232
-test util-16.1.17.-231 {8.4 compatible formatting of doubles} precision \
- {expr 1e-231} \
- 9.9999999999999999e-232
-test util-16.1.17.-230 {8.4 compatible formatting of doubles} precision \
- {expr 1e-230} \
- 1e-230
-test util-16.1.17.-229 {8.4 compatible formatting of doubles} precision \
- {expr 1e-229} \
- 1.0000000000000001e-229
-test util-16.1.17.-228 {8.4 compatible formatting of doubles} precision \
- {expr 1e-228} \
- 1e-228
-test util-16.1.17.-227 {8.4 compatible formatting of doubles} precision \
- {expr 1e-227} \
- 9.9999999999999994e-228
-test util-16.1.17.-226 {8.4 compatible formatting of doubles} precision \
- {expr 1e-226} \
- 9.9999999999999992e-227
-test util-16.1.17.-225 {8.4 compatible formatting of doubles} precision \
- {expr 1e-225} \
- 9.9999999999999996e-226
-test util-16.1.17.-224 {8.4 compatible formatting of doubles} precision \
- {expr 1e-224} \
- 1e-224
-test util-16.1.17.-223 {8.4 compatible formatting of doubles} precision \
- {expr 1e-223} \
- 9.9999999999999997e-224
-test util-16.1.17.-222 {8.4 compatible formatting of doubles} precision \
- {expr 1e-222} \
- 1e-222
-test util-16.1.17.-221 {8.4 compatible formatting of doubles} precision \
- {expr 1e-221} \
- 1e-221
-test util-16.1.17.-220 {8.4 compatible formatting of doubles} precision \
- {expr 1e-220} \
- 9.9999999999999999e-221
-test util-16.1.17.-219 {8.4 compatible formatting of doubles} precision \
- {expr 1e-219} \
- 1e-219
-test util-16.1.17.-218 {8.4 compatible formatting of doubles} precision \
- {expr 1e-218} \
- 1e-218
-test util-16.1.17.-217 {8.4 compatible formatting of doubles} precision \
- {expr 1e-217} \
- 1.0000000000000001e-217
-test util-16.1.17.-216 {8.4 compatible formatting of doubles} precision \
- {expr 1e-216} \
- 1e-216
-test util-16.1.17.-215 {8.4 compatible formatting of doubles} precision \
- {expr 1e-215} \
- 1e-215
-test util-16.1.17.-214 {8.4 compatible formatting of doubles} precision \
- {expr 1e-214} \
- 9.9999999999999991e-215
-test util-16.1.17.-213 {8.4 compatible formatting of doubles} precision \
- {expr 1e-213} \
- 9.9999999999999995e-214
-test util-16.1.17.-212 {8.4 compatible formatting of doubles} precision \
- {expr 1e-212} \
- 9.9999999999999995e-213
-test util-16.1.17.-211 {8.4 compatible formatting of doubles} precision \
- {expr 1e-211} \
- 1.0000000000000001e-211
-test util-16.1.17.-210 {8.4 compatible formatting of doubles} precision \
- {expr 1e-210} \
- 1e-210
-test util-16.1.17.-209 {8.4 compatible formatting of doubles} precision \
- {expr 1e-209} \
- 1e-209
-test util-16.1.17.-208 {8.4 compatible formatting of doubles} precision \
- {expr 1e-208} \
- 1.0000000000000001e-208
-test util-16.1.17.-207 {8.4 compatible formatting of doubles} precision \
- {expr 1e-207} \
- 9.9999999999999993e-208
-test util-16.1.17.-206 {8.4 compatible formatting of doubles} precision \
- {expr 1e-206} \
- 1e-206
-test util-16.1.17.-205 {8.4 compatible formatting of doubles} precision \
- {expr 1e-205} \
- 1e-205
-test util-16.1.17.-204 {8.4 compatible formatting of doubles} precision \
- {expr 1e-204} \
- 1e-204
-test util-16.1.17.-203 {8.4 compatible formatting of doubles} precision \
- {expr 1e-203} \
- 1e-203
-test util-16.1.17.-202 {8.4 compatible formatting of doubles} precision \
- {expr 1e-202} \
- 1e-202
-test util-16.1.17.-201 {8.4 compatible formatting of doubles} precision \
- {expr 1e-201} \
- 9.9999999999999995e-202
-test util-16.1.17.-200 {8.4 compatible formatting of doubles} precision \
- {expr 1e-200} \
- 9.9999999999999998e-201
-test util-16.1.17.-199 {8.4 compatible formatting of doubles} precision \
- {expr 1e-199} \
- 9.9999999999999998e-200
-test util-16.1.17.-198 {8.4 compatible formatting of doubles} precision \
- {expr 1e-198} \
- 9.9999999999999991e-199
-test util-16.1.17.-197 {8.4 compatible formatting of doubles} precision \
- {expr 1e-197} \
- 9.9999999999999999e-198
-test util-16.1.17.-196 {8.4 compatible formatting of doubles} precision \
- {expr 1e-196} \
- 1e-196
-test util-16.1.17.-195 {8.4 compatible formatting of doubles} precision \
- {expr 1e-195} \
- 1.0000000000000001e-195
-test util-16.1.17.-194 {8.4 compatible formatting of doubles} precision \
- {expr 1e-194} \
- 1e-194
-test util-16.1.17.-193 {8.4 compatible formatting of doubles} precision \
- {expr 1e-193} \
- 1e-193
-test util-16.1.17.-192 {8.4 compatible formatting of doubles} precision \
- {expr 1e-192} \
- 1.0000000000000001e-192
-test util-16.1.17.-191 {8.4 compatible formatting of doubles} precision \
- {expr 1e-191} \
- 1e-191
-test util-16.1.17.-190 {8.4 compatible formatting of doubles} precision \
- {expr 1e-190} \
- 1e-190
-test util-16.1.17.-189 {8.4 compatible formatting of doubles} precision \
- {expr 1e-189} \
- 1.0000000000000001e-189
-test util-16.1.17.-188 {8.4 compatible formatting of doubles} precision \
- {expr 1e-188} \
- 9.9999999999999995e-189
-test util-16.1.17.-187 {8.4 compatible formatting of doubles} precision \
- {expr 1e-187} \
- 1e-187
-test util-16.1.17.-186 {8.4 compatible formatting of doubles} precision \
- {expr 1e-186} \
- 9.9999999999999991e-187
-test util-16.1.17.-185 {8.4 compatible formatting of doubles} precision \
- {expr 1e-185} \
- 9.9999999999999999e-186
-test util-16.1.17.-184 {8.4 compatible formatting of doubles} precision \
- {expr 1e-184} \
- 1.0000000000000001e-184
-test util-16.1.17.-183 {8.4 compatible formatting of doubles} precision \
- {expr 1e-183} \
- 1e-183
-test util-16.1.17.-182 {8.4 compatible formatting of doubles} precision \
- {expr 1e-182} \
- 1e-182
-test util-16.1.17.-181 {8.4 compatible formatting of doubles} precision \
- {expr 1e-181} \
- 1e-181
-test util-16.1.17.-180 {8.4 compatible formatting of doubles} precision \
- {expr 1e-180} \
- 1e-180
-test util-16.1.17.-179 {8.4 compatible formatting of doubles} precision \
- {expr 1e-179} \
- 1e-179
-test util-16.1.17.-178 {8.4 compatible formatting of doubles} precision \
- {expr 1e-178} \
- 9.9999999999999995e-179
-test util-16.1.17.-177 {8.4 compatible formatting of doubles} precision \
- {expr 1e-177} \
- 9.9999999999999995e-178
-test util-16.1.17.-176 {8.4 compatible formatting of doubles} precision \
- {expr 1e-176} \
- 1e-176
-test util-16.1.17.-175 {8.4 compatible formatting of doubles} precision \
- {expr 1e-175} \
- 1e-175
-test util-16.1.17.-174 {8.4 compatible formatting of doubles} precision \
- {expr 1e-174} \
- 1e-174
-test util-16.1.17.-173 {8.4 compatible formatting of doubles} precision \
- {expr 1e-173} \
- 1e-173
-test util-16.1.17.-172 {8.4 compatible formatting of doubles} precision \
- {expr 1e-172} \
- 1e-172
-test util-16.1.17.-171 {8.4 compatible formatting of doubles} precision \
- {expr 1e-171} \
- 9.9999999999999998e-172
-test util-16.1.17.-170 {8.4 compatible formatting of doubles} precision \
- {expr 1e-170} \
- 9.9999999999999998e-171
-test util-16.1.17.-169 {8.4 compatible formatting of doubles} precision \
- {expr 1e-169} \
- 1e-169
-test util-16.1.17.-168 {8.4 compatible formatting of doubles} precision \
- {expr 1e-168} \
- 1e-168
-test util-16.1.17.-167 {8.4 compatible formatting of doubles} precision \
- {expr 1e-167} \
- 1e-167
-test util-16.1.17.-166 {8.4 compatible formatting of doubles} precision \
- {expr 1e-166} \
- 1e-166
-test util-16.1.17.-165 {8.4 compatible formatting of doubles} precision \
- {expr 1e-165} \
- 1e-165
-test util-16.1.17.-164 {8.4 compatible formatting of doubles} precision \
- {expr 1e-164} \
- 9.9999999999999996e-165
-test util-16.1.17.-163 {8.4 compatible formatting of doubles} precision \
- {expr 1e-163} \
- 9.9999999999999992e-164
-test util-16.1.17.-162 {8.4 compatible formatting of doubles} precision \
- {expr 1e-162} \
- 9.9999999999999995e-163
-test util-16.1.17.-161 {8.4 compatible formatting of doubles} precision \
- {expr 1e-161} \
- 1e-161
-test util-16.1.17.-160 {8.4 compatible formatting of doubles} precision \
- {expr 1e-160} \
- 9.9999999999999999e-161
-test util-16.1.17.-159 {8.4 compatible formatting of doubles} precision \
- {expr 1e-159} \
- 9.9999999999999999e-160
-test util-16.1.17.-158 {8.4 compatible formatting of doubles} precision \
- {expr 1e-158} \
- 1.0000000000000001e-158
-test util-16.1.17.-157 {8.4 compatible formatting of doubles} precision \
- {expr 1e-157} \
- 9.9999999999999994e-158
-test util-16.1.17.-156 {8.4 compatible formatting of doubles} precision \
- {expr 1e-156} \
- 1e-156
-test util-16.1.17.-155 {8.4 compatible formatting of doubles} precision \
- {expr 1e-155} \
- 1e-155
-test util-16.1.17.-154 {8.4 compatible formatting of doubles} precision \
- {expr 1e-154} \
- 9.9999999999999997e-155
-test util-16.1.17.-153 {8.4 compatible formatting of doubles} precision \
- {expr 1e-153} \
- 1e-153
-test util-16.1.17.-152 {8.4 compatible formatting of doubles} precision \
- {expr 1e-152} \
- 1.0000000000000001e-152
-test util-16.1.17.-151 {8.4 compatible formatting of doubles} precision \
- {expr 1e-151} \
- 9.9999999999999994e-152
-test util-16.1.17.-150 {8.4 compatible formatting of doubles} precision \
- {expr 1e-150} \
- 1e-150
-test util-16.1.17.-149 {8.4 compatible formatting of doubles} precision \
- {expr 1e-149} \
- 9.9999999999999998e-150
-test util-16.1.17.-148 {8.4 compatible formatting of doubles} precision \
- {expr 1e-148} \
- 9.9999999999999994e-149
-test util-16.1.17.-147 {8.4 compatible formatting of doubles} precision \
- {expr 1e-147} \
- 9.9999999999999997e-148
-test util-16.1.17.-146 {8.4 compatible formatting of doubles} precision \
- {expr 1e-146} \
- 1e-146
-test util-16.1.17.-145 {8.4 compatible formatting of doubles} precision \
- {expr 1e-145} \
- 9.9999999999999991e-146
-test util-16.1.17.-144 {8.4 compatible formatting of doubles} precision \
- {expr 1e-144} \
- 9.9999999999999995e-145
-test util-16.1.17.-143 {8.4 compatible formatting of doubles} precision \
- {expr 1e-143} \
- 9.9999999999999995e-144
-test util-16.1.17.-142 {8.4 compatible formatting of doubles} precision \
- {expr 1e-142} \
- 1e-142
-test util-16.1.17.-141 {8.4 compatible formatting of doubles} precision \
- {expr 1e-141} \
- 1e-141
-test util-16.1.17.-140 {8.4 compatible formatting of doubles} precision \
- {expr 1e-140} \
- 9.9999999999999998e-141
-test util-16.1.17.-139 {8.4 compatible formatting of doubles} precision \
- {expr 1e-139} \
- 1e-139
-test util-16.1.17.-138 {8.4 compatible formatting of doubles} precision \
- {expr 1e-138} \
- 1.0000000000000001e-138
-test util-16.1.17.-137 {8.4 compatible formatting of doubles} precision \
- {expr 1e-137} \
- 9.9999999999999998e-138
-test util-16.1.17.-136 {8.4 compatible formatting of doubles} precision \
- {expr 1e-136} \
- 1e-136
-test util-16.1.17.-135 {8.4 compatible formatting of doubles} precision \
- {expr 1e-135} \
- 1e-135
-test util-16.1.17.-134 {8.4 compatible formatting of doubles} precision \
- {expr 1e-134} \
- 1e-134
-test util-16.1.17.-133 {8.4 compatible formatting of doubles} precision \
- {expr 1e-133} \
- 1.0000000000000001e-133
-test util-16.1.17.-132 {8.4 compatible formatting of doubles} precision \
- {expr 1e-132} \
- 9.9999999999999999e-133
-test util-16.1.17.-131 {8.4 compatible formatting of doubles} precision \
- {expr 1e-131} \
- 9.9999999999999999e-132
-test util-16.1.17.-130 {8.4 compatible formatting of doubles} precision \
- {expr 1e-130} \
- 1.0000000000000001e-130
-test util-16.1.17.-129 {8.4 compatible formatting of doubles} precision \
- {expr 1e-129} \
- 9.9999999999999993e-130
-test util-16.1.17.-128 {8.4 compatible formatting of doubles} precision \
- {expr 1e-128} \
- 1.0000000000000001e-128
-test util-16.1.17.-127 {8.4 compatible formatting of doubles} precision \
- {expr 1e-127} \
- 1e-127
-test util-16.1.17.-126 {8.4 compatible formatting of doubles} precision \
- {expr 1e-126} \
- 9.9999999999999995e-127
-test util-16.1.17.-125 {8.4 compatible formatting of doubles} precision \
- {expr 1e-125} \
- 1e-125
-test util-16.1.17.-124 {8.4 compatible formatting of doubles} precision \
- {expr 1e-124} \
- 9.9999999999999993e-125
-test util-16.1.17.-123 {8.4 compatible formatting of doubles} precision \
- {expr 1e-123} \
- 1.0000000000000001e-123
-test util-16.1.17.-122 {8.4 compatible formatting of doubles} precision \
- {expr 1e-122} \
- 1.0000000000000001e-122
-test util-16.1.17.-121 {8.4 compatible formatting of doubles} precision \
- {expr 1e-121} \
- 9.9999999999999998e-122
-test util-16.1.17.-120 {8.4 compatible formatting of doubles} precision \
- {expr 1e-120} \
- 9.9999999999999998e-121
-test util-16.1.17.-119 {8.4 compatible formatting of doubles} precision \
- {expr 1e-119} \
- 1e-119
-test util-16.1.17.-118 {8.4 compatible formatting of doubles} precision \
- {expr 1e-118} \
- 9.9999999999999999e-119
-test util-16.1.17.-117 {8.4 compatible formatting of doubles} precision \
- {expr 1e-117} \
- 1e-117
-test util-16.1.17.-116 {8.4 compatible formatting of doubles} precision \
- {expr 1e-116} \
- 9.9999999999999999e-117
-test util-16.1.17.-115 {8.4 compatible formatting of doubles} precision \
- {expr 1e-115} \
- 1.0000000000000001e-115
-test util-16.1.17.-114 {8.4 compatible formatting of doubles} precision \
- {expr 1e-114} \
- 1.0000000000000001e-114
-test util-16.1.17.-113 {8.4 compatible formatting of doubles} precision \
- {expr 1e-113} \
- 9.9999999999999998e-114
-test util-16.1.17.-112 {8.4 compatible formatting of doubles} precision \
- {expr 1e-112} \
- 9.9999999999999995e-113
-test util-16.1.17.-111 {8.4 compatible formatting of doubles} precision \
- {expr 1e-111} \
- 1.0000000000000001e-111
-test util-16.1.17.-110 {8.4 compatible formatting of doubles} precision \
- {expr 1e-110} \
- 1.0000000000000001e-110
-test util-16.1.17.-109 {8.4 compatible formatting of doubles} precision \
- {expr 1e-109} \
- 9.9999999999999999e-110
-test util-16.1.17.-108 {8.4 compatible formatting of doubles} precision \
- {expr 1e-108} \
- 1e-108
-test util-16.1.17.-107 {8.4 compatible formatting of doubles} precision \
- {expr 1e-107} \
- 1e-107
-test util-16.1.17.-106 {8.4 compatible formatting of doubles} precision \
- {expr 1e-106} \
- 9.9999999999999994e-107
-test util-16.1.17.-105 {8.4 compatible formatting of doubles} precision \
- {expr 1e-105} \
- 9.9999999999999997e-106
-test util-16.1.17.-104 {8.4 compatible formatting of doubles} precision \
- {expr 1e-104} \
- 9.9999999999999993e-105
-test util-16.1.17.-103 {8.4 compatible formatting of doubles} precision \
- {expr 1e-103} \
- 9.9999999999999996e-104
-test util-16.1.17.-102 {8.4 compatible formatting of doubles} precision \
- {expr 1e-102} \
- 9.9999999999999993e-103
-test util-16.1.17.-101 {8.4 compatible formatting of doubles} precision \
- {expr 1e-101} \
- 1.0000000000000001e-101
-test util-16.1.17.-100 {8.4 compatible formatting of doubles} precision \
- {expr 1e-100} \
- 1e-100
-test util-16.1.17.-99 {8.4 compatible formatting of doubles} precision \
- {expr 1e-99} \
- 1e-99
-test util-16.1.17.-98 {8.4 compatible formatting of doubles} precision \
- {expr 1e-98} \
- 9.9999999999999994e-99
-test util-16.1.17.-97 {8.4 compatible formatting of doubles} precision \
- {expr 1e-97} \
- 1e-97
-test util-16.1.17.-96 {8.4 compatible formatting of doubles} precision \
- {expr 1e-96} \
- 9.9999999999999991e-97
-test util-16.1.17.-95 {8.4 compatible formatting of doubles} precision \
- {expr 1e-95} \
- 9.9999999999999999e-96
-test util-16.1.17.-94 {8.4 compatible formatting of doubles} precision \
- {expr 1e-94} \
- 9.9999999999999996e-95
-test util-16.1.17.-93 {8.4 compatible formatting of doubles} precision \
- {expr 1e-93} \
- 9.999999999999999e-94
-test util-16.1.17.-92 {8.4 compatible formatting of doubles} precision \
- {expr 1e-92} \
- 9.9999999999999999e-93
-test util-16.1.17.-91 {8.4 compatible formatting of doubles} precision \
- {expr 1e-91} \
- 1e-91
-test util-16.1.17.-90 {8.4 compatible formatting of doubles} precision \
- {expr 1e-90} \
- 9.9999999999999999e-91
-test util-16.1.17.-89 {8.4 compatible formatting of doubles} precision \
- {expr 1e-89} \
- 1e-89
-test util-16.1.17.-88 {8.4 compatible formatting of doubles} precision \
- {expr 1e-88} \
- 9.9999999999999993e-89
-test util-16.1.17.-87 {8.4 compatible formatting of doubles} precision \
- {expr 1e-87} \
- 1e-87
-test util-16.1.17.-86 {8.4 compatible formatting of doubles} precision \
- {expr 1e-86} \
- 1.0000000000000001e-86
-test util-16.1.17.-85 {8.4 compatible formatting of doubles} precision \
- {expr 1e-85} \
- 9.9999999999999998e-86
-test util-16.1.17.-84 {8.4 compatible formatting of doubles} precision \
- {expr 1e-84} \
- 1e-84
-test util-16.1.17.-83 {8.4 compatible formatting of doubles} precision \
- {expr 1e-83} \
- 1e-83
-test util-16.1.17.-82 {8.4 compatible formatting of doubles} precision \
- {expr 1e-82} \
- 9.9999999999999996e-83
-test util-16.1.17.-81 {8.4 compatible formatting of doubles} precision \
- {expr 1e-81} \
- 9.9999999999999996e-82
-test util-16.1.17.-80 {8.4 compatible formatting of doubles} precision \
- {expr 1e-80} \
- 9.9999999999999996e-81
-test util-16.1.17.-79 {8.4 compatible formatting of doubles} precision \
- {expr 1e-79} \
- 1e-79
-test util-16.1.17.-78 {8.4 compatible formatting of doubles} precision \
- {expr 1e-78} \
- 1e-78
-test util-16.1.17.-77 {8.4 compatible formatting of doubles} precision \
- {expr 1e-77} \
- 9.9999999999999993e-78
-test util-16.1.17.-76 {8.4 compatible formatting of doubles} precision \
- {expr 1e-76} \
- 9.9999999999999993e-77
-test util-16.1.17.-75 {8.4 compatible formatting of doubles} precision \
- {expr 1e-75} \
- 9.9999999999999996e-76
-test util-16.1.17.-74 {8.4 compatible formatting of doubles} precision \
- {expr 1e-74} \
- 9.9999999999999996e-75
-test util-16.1.17.-73 {8.4 compatible formatting of doubles} precision \
- {expr 1e-73} \
- 1e-73
-test util-16.1.17.-72 {8.4 compatible formatting of doubles} precision \
- {expr 1e-72} \
- 9.9999999999999997e-73
-test util-16.1.17.-71 {8.4 compatible formatting of doubles} precision \
- {expr 1e-71} \
- 9.9999999999999992e-72
-test util-16.1.17.-70 {8.4 compatible formatting of doubles} precision \
- {expr 1e-70} \
- 1e-70
-test util-16.1.17.-69 {8.4 compatible formatting of doubles} precision \
- {expr 1e-69} \
- 9.9999999999999996e-70
-test util-16.1.17.-68 {8.4 compatible formatting of doubles} precision \
- {expr 1e-68} \
- 1.0000000000000001e-68
-test util-16.1.17.-67 {8.4 compatible formatting of doubles} precision \
- {expr 1e-67} \
- 9.9999999999999994e-68
-test util-16.1.17.-66 {8.4 compatible formatting of doubles} precision \
- {expr 1e-66} \
- 9.9999999999999998e-67
-test util-16.1.17.-65 {8.4 compatible formatting of doubles} precision \
- {expr 1e-65} \
- 9.9999999999999992e-66
-test util-16.1.17.-64 {8.4 compatible formatting of doubles} precision \
- {expr 1e-64} \
- 9.9999999999999997e-65
-test util-16.1.17.-63 {8.4 compatible formatting of doubles} precision \
- {expr 1e-63} \
- 1.0000000000000001e-63
-test util-16.1.17.-62 {8.4 compatible formatting of doubles} precision \
- {expr 1e-62} \
- 1e-62
-test util-16.1.17.-61 {8.4 compatible formatting of doubles} precision \
- {expr 1e-61} \
- 1e-61
-test util-16.1.17.-60 {8.4 compatible formatting of doubles} precision \
- {expr 1e-60} \
- 9.9999999999999997e-61
-test util-16.1.17.-59 {8.4 compatible formatting of doubles} precision \
- {expr 1e-59} \
- 1e-59
-test util-16.1.17.-58 {8.4 compatible formatting of doubles} precision \
- {expr 1e-58} \
- 1e-58
-test util-16.1.17.-57 {8.4 compatible formatting of doubles} precision \
- {expr 1e-57} \
- 9.9999999999999995e-58
-test util-16.1.17.-56 {8.4 compatible formatting of doubles} precision \
- {expr 1e-56} \
- 1e-56
-test util-16.1.17.-55 {8.4 compatible formatting of doubles} precision \
- {expr 1e-55} \
- 9.9999999999999999e-56
-test util-16.1.17.-54 {8.4 compatible formatting of doubles} precision \
- {expr 1e-54} \
- 1e-54
-test util-16.1.17.-53 {8.4 compatible formatting of doubles} precision \
- {expr 1e-53} \
- 1e-53
-test util-16.1.17.-52 {8.4 compatible formatting of doubles} precision \
- {expr 1e-52} \
- 1e-52
-test util-16.1.17.-51 {8.4 compatible formatting of doubles} precision \
- {expr 1e-51} \
- 1e-51
-test util-16.1.17.-50 {8.4 compatible formatting of doubles} precision \
- {expr 1e-50} \
- 1e-50
-test util-16.1.17.-49 {8.4 compatible formatting of doubles} precision \
- {expr 1e-49} \
- 9.9999999999999994e-50
-test util-16.1.17.-48 {8.4 compatible formatting of doubles} precision \
- {expr 1e-48} \
- 9.9999999999999997e-49
-test util-16.1.17.-47 {8.4 compatible formatting of doubles} precision \
- {expr 1e-47} \
- 9.9999999999999997e-48
-test util-16.1.17.-46 {8.4 compatible formatting of doubles} precision \
- {expr 1e-46} \
- 1e-46
-test util-16.1.17.-45 {8.4 compatible formatting of doubles} precision \
- {expr 1e-45} \
- 9.9999999999999998e-46
-test util-16.1.17.-44 {8.4 compatible formatting of doubles} precision \
- {expr 1e-44} \
- 9.9999999999999995e-45
-test util-16.1.17.-43 {8.4 compatible formatting of doubles} precision \
- {expr 1e-43} \
- 1.0000000000000001e-43
-test util-16.1.17.-42 {8.4 compatible formatting of doubles} precision \
- {expr 1e-42} \
- 1e-42
-test util-16.1.17.-41 {8.4 compatible formatting of doubles} precision \
- {expr 1e-41} \
- 1e-41
-test util-16.1.17.-40 {8.4 compatible formatting of doubles} precision \
- {expr 1e-40} \
- 9.9999999999999993e-41
-test util-16.1.17.-39 {8.4 compatible formatting of doubles} precision \
- {expr 1e-39} \
- 9.9999999999999993e-40
-test util-16.1.17.-38 {8.4 compatible formatting of doubles} precision \
- {expr 1e-38} \
- 9.9999999999999996e-39
-test util-16.1.17.-37 {8.4 compatible formatting of doubles} precision \
- {expr 1e-37} \
- 1.0000000000000001e-37
-test util-16.1.17.-36 {8.4 compatible formatting of doubles} precision \
- {expr 1e-36} \
- 9.9999999999999994e-37
-test util-16.1.17.-35 {8.4 compatible formatting of doubles} precision \
- {expr 1e-35} \
- 1e-35
-test util-16.1.17.-34 {8.4 compatible formatting of doubles} precision \
- {expr 1e-34} \
- 9.9999999999999993e-35
-test util-16.1.17.-33 {8.4 compatible formatting of doubles} precision \
- {expr 1e-33} \
- 1.0000000000000001e-33
-test util-16.1.17.-32 {8.4 compatible formatting of doubles} precision \
- {expr 1e-32} \
- 1.0000000000000001e-32
-test util-16.1.17.-31 {8.4 compatible formatting of doubles} precision \
- {expr 1e-31} \
- 1.0000000000000001e-31
-test util-16.1.17.-30 {8.4 compatible formatting of doubles} precision \
- {expr 1e-30} \
- 1.0000000000000001e-30
-test util-16.1.17.-29 {8.4 compatible formatting of doubles} precision \
- {expr 1e-29} \
- 9.9999999999999994e-30
-test util-16.1.17.-28 {8.4 compatible formatting of doubles} precision \
- {expr 1e-28} \
- 9.9999999999999997e-29
-test util-16.1.17.-27 {8.4 compatible formatting of doubles} precision \
- {expr 1e-27} \
- 1e-27
-test util-16.1.17.-26 {8.4 compatible formatting of doubles} precision \
- {expr 1e-26} \
- 1e-26
-test util-16.1.17.-25 {8.4 compatible formatting of doubles} precision \
- {expr 1e-25} \
- 1e-25
-test util-16.1.17.-24 {8.4 compatible formatting of doubles} precision \
- {expr 1e-24} \
- 9.9999999999999992e-25
-test util-16.1.17.-23 {8.4 compatible formatting of doubles} precision \
- {expr 1e-23} \
- 9.9999999999999996e-24
-test util-16.1.17.-22 {8.4 compatible formatting of doubles} precision \
- {expr 1e-22} \
- 1e-22
-test util-16.1.17.-21 {8.4 compatible formatting of doubles} precision \
- {expr 1e-21} \
- 9.9999999999999991e-22
-test util-16.1.17.-20 {8.4 compatible formatting of doubles} precision \
- {expr 1e-20} \
- 9.9999999999999995e-21
-test util-16.1.17.-19 {8.4 compatible formatting of doubles} precision \
- {expr 1e-19} \
- 9.9999999999999998e-20
-test util-16.1.17.-18 {8.4 compatible formatting of doubles} precision \
- {expr 1e-18} \
- 1.0000000000000001e-18
-test util-16.1.17.-17 {8.4 compatible formatting of doubles} precision \
- {expr 1e-17} \
- 1.0000000000000001e-17
-test util-16.1.17.-16 {8.4 compatible formatting of doubles} precision \
- {expr 1e-16} \
- 9.9999999999999998e-17
-test util-16.1.17.-15 {8.4 compatible formatting of doubles} precision \
- {expr 1e-15} \
- 1.0000000000000001e-15
-test util-16.1.17.-14 {8.4 compatible formatting of doubles} precision \
- {expr 1e-14} \
- 1e-14
-test util-16.1.17.-13 {8.4 compatible formatting of doubles} precision \
- {expr 1e-13} \
- 1e-13
-test util-16.1.17.-12 {8.4 compatible formatting of doubles} precision \
- {expr 1e-12} \
- 9.9999999999999998e-13
-test util-16.1.17.-11 {8.4 compatible formatting of doubles} precision \
- {expr 1e-11} \
- 9.9999999999999994e-12
-test util-16.1.17.-10 {8.4 compatible formatting of doubles} precision \
- {expr 1e-10} \
- 1e-10
-test util-16.1.17.-9 {8.4 compatible formatting of doubles} precision \
- {expr 1e-9} \
- 1.0000000000000001e-09
-test util-16.1.17.-8 {8.4 compatible formatting of doubles} precision \
- {expr 1e-8} \
- 1e-08
-test util-16.1.17.-7 {8.4 compatible formatting of doubles} precision \
- {expr 1e-7} \
- 9.9999999999999995e-08
-test util-16.1.17.-6 {8.4 compatible formatting of doubles} precision \
- {expr 1e-6} \
- 9.9999999999999995e-07
-test util-16.1.17.-5 {8.4 compatible formatting of doubles} precision \
- {expr 1e-5} \
- 1.0000000000000001e-05
-test util-16.1.17.-4 {8.4 compatible formatting of doubles} precision \
- {expr 1e-4} \
- 0.0001
-test util-16.1.17.-3 {8.4 compatible formatting of doubles} precision \
- {expr 1e-3} \
- 0.001
-test util-16.1.17.-2 {8.4 compatible formatting of doubles} precision \
- {expr 1e-2} \
- 0.01
-test util-16.1.17.-1 {8.4 compatible formatting of doubles} precision \
- {expr 1e-1} \
- 0.10000000000000001
-test util-16.1.17.0 {8.4 compatible formatting of doubles} precision \
- {expr 1e0} \
- 1.0
-test util-16.1.17.1 {8.4 compatible formatting of doubles} precision \
- {expr 1e1} \
- 10.0
-test util-16.1.17.2 {8.4 compatible formatting of doubles} precision \
- {expr 1e2} \
- 100.0
-test util-16.1.17.3 {8.4 compatible formatting of doubles} precision \
- {expr 1e3} \
- 1000.0
-test util-16.1.17.4 {8.4 compatible formatting of doubles} precision \
- {expr 1e4} \
- 10000.0
-test util-16.1.17.5 {8.4 compatible formatting of doubles} precision \
- {expr 1e5} \
- 100000.0
-test util-16.1.17.6 {8.4 compatible formatting of doubles} precision \
- {expr 1e6} \
- 1000000.0
-test util-16.1.17.7 {8.4 compatible formatting of doubles} precision \
- {expr 1e7} \
- 10000000.0
-test util-16.1.17.8 {8.4 compatible formatting of doubles} precision \
- {expr 1e8} \
- 100000000.0
-test util-16.1.17.9 {8.4 compatible formatting of doubles} precision \
- {expr 1e9} \
- 1000000000.0
-test util-16.1.17.10 {8.4 compatible formatting of doubles} precision \
- {expr 1e10} \
- 10000000000.0
-test util-16.1.17.11 {8.4 compatible formatting of doubles} precision \
- {expr 1e11} \
- 100000000000.0
-test util-16.1.17.12 {8.4 compatible formatting of doubles} precision \
- {expr 1e12} \
- 1000000000000.0
-test util-16.1.17.13 {8.4 compatible formatting of doubles} precision \
- {expr 1e13} \
- 10000000000000.0
-test util-16.1.17.14 {8.4 compatible formatting of doubles} precision \
- {expr 1e14} \
- 100000000000000.0
-test util-16.1.17.15 {8.4 compatible formatting of doubles} precision \
- {expr 1e15} \
- 1000000000000000.0
-test util-16.1.17.16 {8.4 compatible formatting of doubles} precision \
- {expr 1e16} \
- 10000000000000000.0
-test util-16.1.17.17 {8.4 compatible formatting of doubles} precision \
- {expr 1e17} \
- 1e+17
-test util-16.1.17.18 {8.4 compatible formatting of doubles} precision \
- {expr 1e18} \
- 1e+18
-test util-16.1.17.19 {8.4 compatible formatting of doubles} precision \
- {expr 1e19} \
- 1e+19
-test util-16.1.17.20 {8.4 compatible formatting of doubles} precision \
- {expr 1e20} \
- 1e+20
-test util-16.1.17.21 {8.4 compatible formatting of doubles} precision \
- {expr 1e21} \
- 1e+21
-test util-16.1.17.22 {8.4 compatible formatting of doubles} precision \
- {expr 1e22} \
- 1e+22
-test util-16.1.17.23 {8.4 compatible formatting of doubles} precision \
- {expr 1e23} \
- 9.9999999999999992e+22
-test util-16.1.17.24 {8.4 compatible formatting of doubles} precision \
- {expr 1e24} \
- 9.9999999999999998e+23
-test util-16.1.17.25 {8.4 compatible formatting of doubles} precision \
- {expr 1e25} \
- 1.0000000000000001e+25
-test util-16.1.17.26 {8.4 compatible formatting of doubles} precision \
- {expr 1e26} \
- 1e+26
-test util-16.1.17.27 {8.4 compatible formatting of doubles} precision \
- {expr 1e27} \
- 1e+27
-test util-16.1.17.28 {8.4 compatible formatting of doubles} precision \
- {expr 1e28} \
- 9.9999999999999996e+27
-test util-16.1.17.29 {8.4 compatible formatting of doubles} precision \
- {expr 1e29} \
- 9.9999999999999991e+28
-test util-16.1.17.30 {8.4 compatible formatting of doubles} precision \
- {expr 1e30} \
- 1e+30
-test util-16.1.17.31 {8.4 compatible formatting of doubles} precision \
- {expr 1e31} \
- 9.9999999999999996e+30
-test util-16.1.17.32 {8.4 compatible formatting of doubles} precision \
- {expr 1e32} \
- 1.0000000000000001e+32
-test util-16.1.17.33 {8.4 compatible formatting of doubles} precision \
- {expr 1e33} \
- 9.9999999999999995e+32
-test util-16.1.17.34 {8.4 compatible formatting of doubles} precision \
- {expr 1e34} \
- 9.9999999999999995e+33
-test util-16.1.17.35 {8.4 compatible formatting of doubles} precision \
- {expr 1e35} \
- 9.9999999999999997e+34
-test util-16.1.17.36 {8.4 compatible formatting of doubles} precision \
- {expr 1e36} \
- 1e+36
-test util-16.1.17.37 {8.4 compatible formatting of doubles} precision \
- {expr 1e37} \
- 9.9999999999999995e+36
-test util-16.1.17.38 {8.4 compatible formatting of doubles} precision \
- {expr 1e38} \
- 9.9999999999999998e+37
-test util-16.1.17.39 {8.4 compatible formatting of doubles} precision \
- {expr 1e39} \
- 9.9999999999999994e+38
-test util-16.1.17.40 {8.4 compatible formatting of doubles} precision \
- {expr 1e40} \
- 1e+40
-test util-16.1.17.41 {8.4 compatible formatting of doubles} precision \
- {expr 1e41} \
- 1e+41
-test util-16.1.17.42 {8.4 compatible formatting of doubles} precision \
- {expr 1e42} \
- 1e+42
-test util-16.1.17.43 {8.4 compatible formatting of doubles} precision \
- {expr 1e43} \
- 1e+43
-test util-16.1.17.44 {8.4 compatible formatting of doubles} precision \
- {expr 1e44} \
- 1.0000000000000001e+44
-test util-16.1.17.45 {8.4 compatible formatting of doubles} precision \
- {expr 1e45} \
- 9.9999999999999993e+44
-test util-16.1.17.46 {8.4 compatible formatting of doubles} precision \
- {expr 1e46} \
- 9.9999999999999999e+45
-test util-16.1.17.47 {8.4 compatible formatting of doubles} precision \
- {expr 1e47} \
- 1e+47
-test util-16.1.17.48 {8.4 compatible formatting of doubles} precision \
- {expr 1e48} \
- 1e+48
-test util-16.1.17.49 {8.4 compatible formatting of doubles} precision \
- {expr 1e49} \
- 9.9999999999999995e+48
-test util-16.1.17.50 {8.4 compatible formatting of doubles} precision \
- {expr 1e50} \
- 1.0000000000000001e+50
-test util-16.1.17.51 {8.4 compatible formatting of doubles} precision \
- {expr 1e51} \
- 9.9999999999999999e+50
-test util-16.1.17.52 {8.4 compatible formatting of doubles} precision \
- {expr 1e52} \
- 9.9999999999999999e+51
-test util-16.1.17.53 {8.4 compatible formatting of doubles} precision \
- {expr 1e53} \
- 9.9999999999999999e+52
-test util-16.1.17.54 {8.4 compatible formatting of doubles} precision \
- {expr 1e54} \
- 1.0000000000000001e+54
-test util-16.1.17.55 {8.4 compatible formatting of doubles} precision \
- {expr 1e55} \
- 1e+55
-test util-16.1.17.56 {8.4 compatible formatting of doubles} precision \
- {expr 1e56} \
- 1.0000000000000001e+56
-test util-16.1.17.57 {8.4 compatible formatting of doubles} precision \
- {expr 1e57} \
- 1e+57
-test util-16.1.17.58 {8.4 compatible formatting of doubles} precision \
- {expr 1e58} \
- 9.9999999999999994e+57
-test util-16.1.17.59 {8.4 compatible formatting of doubles} precision \
- {expr 1e59} \
- 9.9999999999999997e+58
-test util-16.1.17.60 {8.4 compatible formatting of doubles} precision \
- {expr 1e60} \
- 9.9999999999999995e+59
-test util-16.1.17.61 {8.4 compatible formatting of doubles} precision \
- {expr 1e61} \
- 9.9999999999999995e+60
-test util-16.1.17.62 {8.4 compatible formatting of doubles} precision \
- {expr 1e62} \
- 1e+62
-test util-16.1.17.63 {8.4 compatible formatting of doubles} precision \
- {expr 1e63} \
- 1.0000000000000001e+63
-test util-16.1.17.64 {8.4 compatible formatting of doubles} precision \
- {expr 1e64} \
- 1e+64
-test util-16.1.17.65 {8.4 compatible formatting of doubles} precision \
- {expr 1e65} \
- 9.9999999999999999e+64
-test util-16.1.17.66 {8.4 compatible formatting of doubles} precision \
- {expr 1e66} \
- 9.9999999999999995e+65
-test util-16.1.17.67 {8.4 compatible formatting of doubles} precision \
- {expr 1e67} \
- 9.9999999999999998e+66
-test util-16.1.17.68 {8.4 compatible formatting of doubles} precision \
- {expr 1e68} \
- 9.9999999999999995e+67
-test util-16.1.17.69 {8.4 compatible formatting of doubles} precision \
- {expr 1e69} \
- 1.0000000000000001e+69
-test util-16.1.17.70 {8.4 compatible formatting of doubles} precision \
- {expr 1e70} \
- 1.0000000000000001e+70
-test util-16.1.17.71 {8.4 compatible formatting of doubles} precision \
- {expr 1e71} \
- 1e+71
-test util-16.1.17.72 {8.4 compatible formatting of doubles} precision \
- {expr 1e72} \
- 9.9999999999999994e+71
-test util-16.1.17.73 {8.4 compatible formatting of doubles} precision \
- {expr 1e73} \
- 9.9999999999999998e+72
-test util-16.1.17.74 {8.4 compatible formatting of doubles} precision \
- {expr 1e74} \
- 9.9999999999999995e+73
-test util-16.1.17.75 {8.4 compatible formatting of doubles} precision \
- {expr 1e75} \
- 9.9999999999999993e+74
-test util-16.1.17.76 {8.4 compatible formatting of doubles} precision \
- {expr 1e76} \
- 1e+76
-test util-16.1.17.77 {8.4 compatible formatting of doubles} precision \
- {expr 1e77} \
- 9.9999999999999998e+76
-test util-16.1.17.78 {8.4 compatible formatting of doubles} precision \
- {expr 1e78} \
- 1e+78
-test util-16.1.17.79 {8.4 compatible formatting of doubles} precision \
- {expr 1e79} \
- 9.9999999999999997e+78
-test util-16.1.17.80 {8.4 compatible formatting of doubles} precision \
- {expr 1e80} \
- 1e+80
-test util-16.1.17.81 {8.4 compatible formatting of doubles} precision \
- {expr 1e81} \
- 9.9999999999999992e+80
-test util-16.1.17.82 {8.4 compatible formatting of doubles} precision \
- {expr 1e82} \
- 9.9999999999999996e+81
-test util-16.1.17.83 {8.4 compatible formatting of doubles} precision \
- {expr 1e83} \
- 1e+83
-test util-16.1.17.84 {8.4 compatible formatting of doubles} precision \
- {expr 1e84} \
- 1.0000000000000001e+84
-test util-16.1.17.85 {8.4 compatible formatting of doubles} precision \
- {expr 1e85} \
- 1e+85
-test util-16.1.17.86 {8.4 compatible formatting of doubles} precision \
- {expr 1e86} \
- 1e+86
-test util-16.1.17.87 {8.4 compatible formatting of doubles} precision \
- {expr 1e87} \
- 9.9999999999999996e+86
-test util-16.1.17.88 {8.4 compatible formatting of doubles} precision \
- {expr 1e88} \
- 9.9999999999999996e+87
-test util-16.1.17.89 {8.4 compatible formatting of doubles} precision \
- {expr 1e89} \
- 9.9999999999999999e+88
-test util-16.1.17.90 {8.4 compatible formatting of doubles} precision \
- {expr 1e90} \
- 9.9999999999999997e+89
-test util-16.1.17.91 {8.4 compatible formatting of doubles} precision \
- {expr 1e91} \
- 1.0000000000000001e+91
-test util-16.1.17.92 {8.4 compatible formatting of doubles} precision \
- {expr 1e92} \
- 1e+92
-test util-16.1.17.93 {8.4 compatible formatting of doubles} precision \
- {expr 1e93} \
- 1e+93
-test util-16.1.17.94 {8.4 compatible formatting of doubles} precision \
- {expr 1e94} \
- 1e+94
-test util-16.1.17.95 {8.4 compatible formatting of doubles} precision \
- {expr 1e95} \
- 1e+95
-test util-16.1.17.96 {8.4 compatible formatting of doubles} precision \
- {expr 1e96} \
- 1e+96
-test util-16.1.17.97 {8.4 compatible formatting of doubles} precision \
- {expr 1e97} \
- 1.0000000000000001e+97
-test util-16.1.17.98 {8.4 compatible formatting of doubles} precision \
- {expr 1e98} \
- 1e+98
-test util-16.1.17.99 {8.4 compatible formatting of doubles} precision \
- {expr 1e99} \
- 9.9999999999999997e+98
-test util-16.1.17.100 {8.4 compatible formatting of doubles} precision \
- {expr 1e100} \
- 1e+100
-test util-16.1.17.101 {8.4 compatible formatting of doubles} precision \
- {expr 1e101} \
- 9.9999999999999998e+100
-test util-16.1.17.102 {8.4 compatible formatting of doubles} precision \
- {expr 1e102} \
- 9.9999999999999998e+101
-test util-16.1.17.103 {8.4 compatible formatting of doubles} precision \
- {expr 1e103} \
- 1e+103
-test util-16.1.17.104 {8.4 compatible formatting of doubles} precision \
- {expr 1e104} \
- 1e+104
-test util-16.1.17.105 {8.4 compatible formatting of doubles} precision \
- {expr 1e105} \
- 9.9999999999999994e+104
-test util-16.1.17.106 {8.4 compatible formatting of doubles} precision \
- {expr 1e106} \
- 1.0000000000000001e+106
-test util-16.1.17.107 {8.4 compatible formatting of doubles} precision \
- {expr 1e107} \
- 9.9999999999999997e+106
-test util-16.1.17.108 {8.4 compatible formatting of doubles} precision \
- {expr 1e108} \
- 1e+108
-test util-16.1.17.109 {8.4 compatible formatting of doubles} precision \
- {expr 1e109} \
- 9.9999999999999998e+108
-test util-16.1.17.110 {8.4 compatible formatting of doubles} precision \
- {expr 1e110} \
- 1e+110
-test util-16.1.17.111 {8.4 compatible formatting of doubles} precision \
- {expr 1e111} \
- 9.9999999999999996e+110
-test util-16.1.17.112 {8.4 compatible formatting of doubles} precision \
- {expr 1e112} \
- 9.9999999999999993e+111
-test util-16.1.17.113 {8.4 compatible formatting of doubles} precision \
- {expr 1e113} \
- 1e+113
-test util-16.1.17.114 {8.4 compatible formatting of doubles} precision \
- {expr 1e114} \
- 1e+114
-test util-16.1.17.115 {8.4 compatible formatting of doubles} precision \
- {expr 1e115} \
- 1e+115
-test util-16.1.17.116 {8.4 compatible formatting of doubles} precision \
- {expr 1e116} \
- 1e+116
-test util-16.1.17.117 {8.4 compatible formatting of doubles} precision \
- {expr 1e117} \
- 1.0000000000000001e+117
-test util-16.1.17.118 {8.4 compatible formatting of doubles} precision \
- {expr 1e118} \
- 9.9999999999999997e+117
-test util-16.1.17.119 {8.4 compatible formatting of doubles} precision \
- {expr 1e119} \
- 9.9999999999999994e+118
-test util-16.1.17.120 {8.4 compatible formatting of doubles} precision \
- {expr 1e120} \
- 9.9999999999999998e+119
-test util-16.1.17.121 {8.4 compatible formatting of doubles} precision \
- {expr 1e121} \
- 1e+121
-test util-16.1.17.122 {8.4 compatible formatting of doubles} precision \
- {expr 1e122} \
- 1e+122
-test util-16.1.17.123 {8.4 compatible formatting of doubles} precision \
- {expr 1e123} \
- 9.9999999999999998e+122
-test util-16.1.17.124 {8.4 compatible formatting of doubles} precision \
- {expr 1e124} \
- 9.9999999999999995e+123
-test util-16.1.17.125 {8.4 compatible formatting of doubles} precision \
- {expr 1e125} \
- 9.9999999999999992e+124
-test util-16.1.17.126 {8.4 compatible formatting of doubles} precision \
- {expr 1e126} \
- 9.9999999999999992e+125
-test util-16.1.17.127 {8.4 compatible formatting of doubles} precision \
- {expr 1e127} \
- 9.9999999999999995e+126
-test util-16.1.17.128 {8.4 compatible formatting of doubles} precision \
- {expr 1e128} \
- 1.0000000000000001e+128
-test util-16.1.17.129 {8.4 compatible formatting of doubles} precision \
- {expr 1e129} \
- 1e+129
-test util-16.1.17.130 {8.4 compatible formatting of doubles} precision \
- {expr 1e130} \
- 1.0000000000000001e+130
-test util-16.1.17.131 {8.4 compatible formatting of doubles} precision \
- {expr 1e131} \
- 9.9999999999999991e+130
-test util-16.1.17.132 {8.4 compatible formatting of doubles} precision \
- {expr 1e132} \
- 9.9999999999999999e+131
-test util-16.1.17.133 {8.4 compatible formatting of doubles} precision \
- {expr 1e133} \
- 1e+133
-test util-16.1.17.134 {8.4 compatible formatting of doubles} precision \
- {expr 1e134} \
- 9.9999999999999992e+133
-test util-16.1.17.135 {8.4 compatible formatting of doubles} precision \
- {expr 1e135} \
- 9.9999999999999996e+134
-test util-16.1.17.136 {8.4 compatible formatting of doubles} precision \
- {expr 1e136} \
- 1.0000000000000001e+136
-test util-16.1.17.137 {8.4 compatible formatting of doubles} precision \
- {expr 1e137} \
- 1e+137
-test util-16.1.17.138 {8.4 compatible formatting of doubles} precision \
- {expr 1e138} \
- 1e+138
-test util-16.1.17.139 {8.4 compatible formatting of doubles} precision \
- {expr 1e139} \
- 1e+139
-test util-16.1.17.140 {8.4 compatible formatting of doubles} precision \
- {expr 1e140} \
- 1.0000000000000001e+140
-test util-16.1.17.141 {8.4 compatible formatting of doubles} precision \
- {expr 1e141} \
- 1e+141
-test util-16.1.17.142 {8.4 compatible formatting of doubles} precision \
- {expr 1e142} \
- 1.0000000000000001e+142
-test util-16.1.17.143 {8.4 compatible formatting of doubles} precision \
- {expr 1e143} \
- 1e+143
-test util-16.1.17.144 {8.4 compatible formatting of doubles} precision \
- {expr 1e144} \
- 1e+144
-test util-16.1.17.145 {8.4 compatible formatting of doubles} precision \
- {expr 1e145} \
- 9.9999999999999999e+144
-test util-16.1.17.146 {8.4 compatible formatting of doubles} precision \
- {expr 1e146} \
- 9.9999999999999993e+145
-test util-16.1.17.147 {8.4 compatible formatting of doubles} precision \
- {expr 1e147} \
- 9.9999999999999998e+146
-test util-16.1.17.148 {8.4 compatible formatting of doubles} precision \
- {expr 1e148} \
- 1e+148
-test util-16.1.17.149 {8.4 compatible formatting of doubles} precision \
- {expr 1e149} \
- 1e+149
-test util-16.1.17.150 {8.4 compatible formatting of doubles} precision \
- {expr 1e150} \
- 9.9999999999999998e+149
-test util-16.1.17.151 {8.4 compatible formatting of doubles} precision \
- {expr 1e151} \
- 1e+151
-test util-16.1.17.152 {8.4 compatible formatting of doubles} precision \
- {expr 1e152} \
- 1e+152
-test util-16.1.17.153 {8.4 compatible formatting of doubles} precision \
- {expr 1e153} \
- 1e+153
-test util-16.1.17.154 {8.4 compatible formatting of doubles} precision \
- {expr 1e154} \
- 1e+154
-test util-16.1.17.155 {8.4 compatible formatting of doubles} precision \
- {expr 1e155} \
- 1e+155
-test util-16.1.17.156 {8.4 compatible formatting of doubles} precision \
- {expr 1e156} \
- 9.9999999999999998e+155
-test util-16.1.17.157 {8.4 compatible formatting of doubles} precision \
- {expr 1e157} \
- 9.9999999999999998e+156
-test util-16.1.17.158 {8.4 compatible formatting of doubles} precision \
- {expr 1e158} \
- 9.9999999999999995e+157
-test util-16.1.17.159 {8.4 compatible formatting of doubles} precision \
- {expr 1e159} \
- 9.9999999999999993e+158
-test util-16.1.17.160 {8.4 compatible formatting of doubles} precision \
- {expr 1e160} \
- 1e+160
-test util-16.1.17.161 {8.4 compatible formatting of doubles} precision \
- {expr 1e161} \
- 1e+161
-test util-16.1.17.162 {8.4 compatible formatting of doubles} precision \
- {expr 1e162} \
- 9.9999999999999994e+161
-test util-16.1.17.163 {8.4 compatible formatting of doubles} precision \
- {expr 1e163} \
- 9.9999999999999994e+162
-test util-16.1.17.164 {8.4 compatible formatting of doubles} precision \
- {expr 1e164} \
- 1e+164
-test util-16.1.17.165 {8.4 compatible formatting of doubles} precision \
- {expr 1e165} \
- 9.999999999999999e+164
-test util-16.1.17.166 {8.4 compatible formatting of doubles} precision \
- {expr 1e166} \
- 9.9999999999999994e+165
-test util-16.1.17.167 {8.4 compatible formatting of doubles} precision \
- {expr 1e167} \
- 1e+167
-test util-16.1.17.168 {8.4 compatible formatting of doubles} precision \
- {expr 1e168} \
- 9.9999999999999993e+167
-test util-16.1.17.169 {8.4 compatible formatting of doubles} precision \
- {expr 1e169} \
- 9.9999999999999993e+168
-test util-16.1.17.170 {8.4 compatible formatting of doubles} precision \
- {expr 1e170} \
- 1e+170
-test util-16.1.17.171 {8.4 compatible formatting of doubles} precision \
- {expr 1e171} \
- 9.9999999999999995e+170
-test util-16.1.17.172 {8.4 compatible formatting of doubles} precision \
- {expr 1e172} \
- 1.0000000000000001e+172
-test util-16.1.17.173 {8.4 compatible formatting of doubles} precision \
- {expr 1e173} \
- 1e+173
-test util-16.1.17.174 {8.4 compatible formatting of doubles} precision \
- {expr 1e174} \
- 1.0000000000000001e+174
-test util-16.1.17.175 {8.4 compatible formatting of doubles} precision \
- {expr 1e175} \
- 9.9999999999999994e+174
-test util-16.1.17.176 {8.4 compatible formatting of doubles} precision \
- {expr 1e176} \
- 1e+176
-test util-16.1.17.177 {8.4 compatible formatting of doubles} precision \
- {expr 1e177} \
- 1e+177
-test util-16.1.17.178 {8.4 compatible formatting of doubles} precision \
- {expr 1e178} \
- 1.0000000000000001e+178
-test util-16.1.17.179 {8.4 compatible formatting of doubles} precision \
- {expr 1e179} \
- 9.9999999999999998e+178
-test util-16.1.17.180 {8.4 compatible formatting of doubles} precision \
- {expr 1e180} \
- 1e+180
-test util-16.1.17.181 {8.4 compatible formatting of doubles} precision \
- {expr 1e181} \
- 9.9999999999999992e+180
-test util-16.1.17.182 {8.4 compatible formatting of doubles} precision \
- {expr 1e182} \
- 1.0000000000000001e+182
-test util-16.1.17.183 {8.4 compatible formatting of doubles} precision \
- {expr 1e183} \
- 9.9999999999999995e+182
-test util-16.1.17.184 {8.4 compatible formatting of doubles} precision \
- {expr 1e184} \
- 1e+184
-test util-16.1.17.185 {8.4 compatible formatting of doubles} precision \
- {expr 1e185} \
- 9.9999999999999998e+184
-test util-16.1.17.186 {8.4 compatible formatting of doubles} precision \
- {expr 1e186} \
- 9.9999999999999998e+185
-test util-16.1.17.187 {8.4 compatible formatting of doubles} precision \
- {expr 1e187} \
- 9.9999999999999991e+186
-test util-16.1.17.188 {8.4 compatible formatting of doubles} precision \
- {expr 1e188} \
- 1e+188
-test util-16.1.17.189 {8.4 compatible formatting of doubles} precision \
- {expr 1e189} \
- 1e+189
-test util-16.1.17.190 {8.4 compatible formatting of doubles} precision \
- {expr 1e190} \
- 1.0000000000000001e+190
-test util-16.1.17.191 {8.4 compatible formatting of doubles} precision \
- {expr 1e191} \
- 1.0000000000000001e+191
-test util-16.1.17.192 {8.4 compatible formatting of doubles} precision \
- {expr 1e192} \
- 1e+192
-test util-16.1.17.193 {8.4 compatible formatting of doubles} precision \
- {expr 1e193} \
- 1.0000000000000001e+193
-test util-16.1.17.194 {8.4 compatible formatting of doubles} precision \
- {expr 1e194} \
- 9.9999999999999994e+193
-test util-16.1.17.195 {8.4 compatible formatting of doubles} precision \
- {expr 1e195} \
- 9.9999999999999998e+194
-test util-16.1.17.196 {8.4 compatible formatting of doubles} precision \
- {expr 1e196} \
- 9.9999999999999995e+195
-test util-16.1.17.197 {8.4 compatible formatting of doubles} precision \
- {expr 1e197} \
- 9.9999999999999995e+196
-test util-16.1.17.198 {8.4 compatible formatting of doubles} precision \
- {expr 1e198} \
- 1e+198
-test util-16.1.17.199 {8.4 compatible formatting of doubles} precision \
- {expr 1e199} \
- 1.0000000000000001e+199
-test util-16.1.17.200 {8.4 compatible formatting of doubles} precision \
- {expr 1e200} \
- 9.9999999999999997e+199
-test util-16.1.17.201 {8.4 compatible formatting of doubles} precision \
- {expr 1e201} \
- 1e+201
-test util-16.1.17.202 {8.4 compatible formatting of doubles} precision \
- {expr 1e202} \
- 9.999999999999999e+201
-test util-16.1.17.203 {8.4 compatible formatting of doubles} precision \
- {expr 1e203} \
- 9.9999999999999999e+202
-test util-16.1.17.204 {8.4 compatible formatting of doubles} precision \
- {expr 1e204} \
- 9.9999999999999999e+203
-test util-16.1.17.205 {8.4 compatible formatting of doubles} precision \
- {expr 1e205} \
- 1e+205
-test util-16.1.17.206 {8.4 compatible formatting of doubles} precision \
- {expr 1e206} \
- 1e+206
-test util-16.1.17.207 {8.4 compatible formatting of doubles} precision \
- {expr 1e207} \
- 1e+207
-test util-16.1.17.208 {8.4 compatible formatting of doubles} precision \
- {expr 1e208} \
- 9.9999999999999998e+207
-test util-16.1.17.209 {8.4 compatible formatting of doubles} precision \
- {expr 1e209} \
- 1.0000000000000001e+209
-test util-16.1.17.210 {8.4 compatible formatting of doubles} precision \
- {expr 1e210} \
- 9.9999999999999993e+209
-test util-16.1.17.211 {8.4 compatible formatting of doubles} precision \
- {expr 1e211} \
- 9.9999999999999996e+210
-test util-16.1.17.212 {8.4 compatible formatting of doubles} precision \
- {expr 1e212} \
- 9.9999999999999991e+211
-test util-16.1.17.213 {8.4 compatible formatting of doubles} precision \
- {expr 1e213} \
- 9.9999999999999998e+212
-test util-16.1.17.214 {8.4 compatible formatting of doubles} precision \
- {expr 1e214} \
- 9.9999999999999995e+213
-test util-16.1.17.215 {8.4 compatible formatting of doubles} precision \
- {expr 1e215} \
- 9.9999999999999991e+214
-test util-16.1.17.216 {8.4 compatible formatting of doubles} precision \
- {expr 1e216} \
- 1e+216
-test util-16.1.17.217 {8.4 compatible formatting of doubles} precision \
- {expr 1e217} \
- 9.9999999999999996e+216
-test util-16.1.17.218 {8.4 compatible formatting of doubles} precision \
- {expr 1e218} \
- 1.0000000000000001e+218
-test util-16.1.17.219 {8.4 compatible formatting of doubles} precision \
- {expr 1e219} \
- 9.9999999999999997e+218
-test util-16.1.17.220 {8.4 compatible formatting of doubles} precision \
- {expr 1e220} \
- 1e+220
-test util-16.1.17.221 {8.4 compatible formatting of doubles} precision \
- {expr 1e221} \
- 1e+221
-test util-16.1.17.222 {8.4 compatible formatting of doubles} precision \
- {expr 1e222} \
- 1e+222
-test util-16.1.17.223 {8.4 compatible formatting of doubles} precision \
- {expr 1e223} \
- 1e+223
-test util-16.1.17.224 {8.4 compatible formatting of doubles} precision \
- {expr 1e224} \
- 9.9999999999999997e+223
-test util-16.1.17.225 {8.4 compatible formatting of doubles} precision \
- {expr 1e225} \
- 9.9999999999999993e+224
-test util-16.1.17.226 {8.4 compatible formatting of doubles} precision \
- {expr 1e226} \
- 9.9999999999999996e+225
-test util-16.1.17.227 {8.4 compatible formatting of doubles} precision \
- {expr 1e227} \
- 1.0000000000000001e+227
-test util-16.1.17.228 {8.4 compatible formatting of doubles} precision \
- {expr 1e228} \
- 9.9999999999999992e+227
-test util-16.1.17.229 {8.4 compatible formatting of doubles} precision \
- {expr 1e229} \
- 9.9999999999999999e+228
-test util-16.1.17.230 {8.4 compatible formatting of doubles} precision \
- {expr 1e230} \
- 1.0000000000000001e+230
-test util-16.1.17.231 {8.4 compatible formatting of doubles} precision \
- {expr 1e231} \
- 1.0000000000000001e+231
-test util-16.1.17.232 {8.4 compatible formatting of doubles} precision \
- {expr 1e232} \
- 1.0000000000000001e+232
-test util-16.1.17.233 {8.4 compatible formatting of doubles} precision \
- {expr 1e233} \
- 9.9999999999999997e+232
-test util-16.1.17.234 {8.4 compatible formatting of doubles} precision \
- {expr 1e234} \
- 1e+234
-test util-16.1.17.235 {8.4 compatible formatting of doubles} precision \
- {expr 1e235} \
- 1.0000000000000001e+235
-test util-16.1.17.236 {8.4 compatible formatting of doubles} precision \
- {expr 1e236} \
- 1.0000000000000001e+236
-test util-16.1.17.237 {8.4 compatible formatting of doubles} precision \
- {expr 1e237} \
- 9.9999999999999994e+236
-test util-16.1.17.238 {8.4 compatible formatting of doubles} precision \
- {expr 1e238} \
- 1e+238
-test util-16.1.17.239 {8.4 compatible formatting of doubles} precision \
- {expr 1e239} \
- 9.9999999999999999e+238
-test util-16.1.17.240 {8.4 compatible formatting of doubles} precision \
- {expr 1e240} \
- 1e+240
-test util-16.1.17.241 {8.4 compatible formatting of doubles} precision \
- {expr 1e241} \
- 1.0000000000000001e+241
-test util-16.1.17.242 {8.4 compatible formatting of doubles} precision \
- {expr 1e242} \
- 1.0000000000000001e+242
-test util-16.1.17.243 {8.4 compatible formatting of doubles} precision \
- {expr 1e243} \
- 1.0000000000000001e+243
-test util-16.1.17.244 {8.4 compatible formatting of doubles} precision \
- {expr 1e244} \
- 1.0000000000000001e+244
-test util-16.1.17.245 {8.4 compatible formatting of doubles} precision \
- {expr 1e245} \
- 1e+245
-test util-16.1.17.246 {8.4 compatible formatting of doubles} precision \
- {expr 1e246} \
- 1.0000000000000001e+246
-test util-16.1.17.247 {8.4 compatible formatting of doubles} precision \
- {expr 1e247} \
- 9.9999999999999995e+246
-test util-16.1.17.248 {8.4 compatible formatting of doubles} precision \
- {expr 1e248} \
- 1e+248
-test util-16.1.17.249 {8.4 compatible formatting of doubles} precision \
- {expr 1e249} \
- 9.9999999999999992e+248
-test util-16.1.17.250 {8.4 compatible formatting of doubles} precision \
- {expr 1e250} \
- 9.9999999999999992e+249
-test util-16.1.17.251 {8.4 compatible formatting of doubles} precision \
- {expr 1e251} \
- 1e+251
-test util-16.1.17.252 {8.4 compatible formatting of doubles} precision \
- {expr 1e252} \
- 1.0000000000000001e+252
-test util-16.1.17.253 {8.4 compatible formatting of doubles} precision \
- {expr 1e253} \
- 9.9999999999999994e+252
-test util-16.1.17.254 {8.4 compatible formatting of doubles} precision \
- {expr 1e254} \
- 9.9999999999999994e+253
-test util-16.1.17.255 {8.4 compatible formatting of doubles} precision \
- {expr 1e255} \
- 9.9999999999999999e+254
-test util-16.1.17.256 {8.4 compatible formatting of doubles} precision \
- {expr 1e256} \
- 1e+256
-test util-16.1.17.257 {8.4 compatible formatting of doubles} precision \
- {expr 1e257} \
- 1e+257
-test util-16.1.17.258 {8.4 compatible formatting of doubles} precision \
- {expr 1e258} \
- 1.0000000000000001e+258
-test util-16.1.17.259 {8.4 compatible formatting of doubles} precision \
- {expr 1e259} \
- 9.9999999999999993e+258
-test util-16.1.17.260 {8.4 compatible formatting of doubles} precision \
- {expr 1e260} \
- 1.0000000000000001e+260
-test util-16.1.17.261 {8.4 compatible formatting of doubles} precision \
- {expr 1e261} \
- 9.9999999999999993e+260
-test util-16.1.17.262 {8.4 compatible formatting of doubles} precision \
- {expr 1e262} \
- 1e+262
-test util-16.1.17.263 {8.4 compatible formatting of doubles} precision \
- {expr 1e263} \
- 1e+263
-test util-16.1.17.264 {8.4 compatible formatting of doubles} precision \
- {expr 1e264} \
- 1e+264
-test util-16.1.17.265 {8.4 compatible formatting of doubles} precision \
- {expr 1e265} \
- 1.0000000000000001e+265
-test util-16.1.17.266 {8.4 compatible formatting of doubles} precision \
- {expr 1e266} \
- 1e+266
-test util-16.1.17.267 {8.4 compatible formatting of doubles} precision \
- {expr 1e267} \
- 9.9999999999999997e+266
-test util-16.1.17.268 {8.4 compatible formatting of doubles} precision \
- {expr 1e268} \
- 9.9999999999999997e+267
-test util-16.1.17.269 {8.4 compatible formatting of doubles} precision \
- {expr 1e269} \
- 1e+269
-test util-16.1.17.270 {8.4 compatible formatting of doubles} precision \
- {expr 1e270} \
- 1e+270
-test util-16.1.17.271 {8.4 compatible formatting of doubles} precision \
- {expr 1e271} \
- 9.9999999999999995e+270
-test util-16.1.17.272 {8.4 compatible formatting of doubles} precision \
- {expr 1e272} \
- 1.0000000000000001e+272
-test util-16.1.17.273 {8.4 compatible formatting of doubles} precision \
- {expr 1e273} \
- 9.9999999999999995e+272
-test util-16.1.17.274 {8.4 compatible formatting of doubles} precision \
- {expr 1e274} \
- 9.9999999999999992e+273
-test util-16.1.17.275 {8.4 compatible formatting of doubles} precision \
- {expr 1e275} \
- 9.9999999999999996e+274
-test util-16.1.17.276 {8.4 compatible formatting of doubles} precision \
- {expr 1e276} \
- 1.0000000000000001e+276
-test util-16.1.17.277 {8.4 compatible formatting of doubles} precision \
- {expr 1e277} \
- 1e+277
-test util-16.1.17.278 {8.4 compatible formatting of doubles} precision \
- {expr 1e278} \
- 9.9999999999999996e+277
-test util-16.1.17.279 {8.4 compatible formatting of doubles} precision \
- {expr 1e279} \
- 1.0000000000000001e+279
-test util-16.1.17.280 {8.4 compatible formatting of doubles} precision \
- {expr 1e280} \
- 1e+280
-test util-16.1.17.281 {8.4 compatible formatting of doubles} precision \
- {expr 1e281} \
- 1e+281
-test util-16.1.17.282 {8.4 compatible formatting of doubles} precision \
- {expr 1e282} \
- 1e+282
-test util-16.1.17.283 {8.4 compatible formatting of doubles} precision \
- {expr 1e283} \
- 9.9999999999999996e+282
-test util-16.1.17.284 {8.4 compatible formatting of doubles} precision \
- {expr 1e284} \
- 1.0000000000000001e+284
-test util-16.1.17.285 {8.4 compatible formatting of doubles} precision \
- {expr 1e285} \
- 9.9999999999999998e+284
-test util-16.1.17.286 {8.4 compatible formatting of doubles} precision \
- {expr 1e286} \
- 1e+286
-test util-16.1.17.287 {8.4 compatible formatting of doubles} precision \
- {expr 1e287} \
- 1.0000000000000001e+287
-test util-16.1.17.288 {8.4 compatible formatting of doubles} precision \
- {expr 1e288} \
- 1e+288
-test util-16.1.17.289 {8.4 compatible formatting of doubles} precision \
- {expr 1e289} \
- 1.0000000000000001e+289
-test util-16.1.17.290 {8.4 compatible formatting of doubles} precision \
- {expr 1e290} \
- 1.0000000000000001e+290
-test util-16.1.17.291 {8.4 compatible formatting of doubles} precision \
- {expr 1e291} \
- 9.9999999999999996e+290
-test util-16.1.17.292 {8.4 compatible formatting of doubles} precision \
- {expr 1e292} \
- 1e+292
-test util-16.1.17.293 {8.4 compatible formatting of doubles} precision \
- {expr 1e293} \
- 9.9999999999999992e+292
-test util-16.1.17.294 {8.4 compatible formatting of doubles} precision \
- {expr 1e294} \
- 1.0000000000000001e+294
-test util-16.1.17.295 {8.4 compatible formatting of doubles} precision \
- {expr 1e295} \
- 9.9999999999999998e+294
-test util-16.1.17.296 {8.4 compatible formatting of doubles} precision \
- {expr 1e296} \
- 9.9999999999999998e+295
-test util-16.1.17.297 {8.4 compatible formatting of doubles} precision \
- {expr 1e297} \
- 1e+297
-test util-16.1.17.298 {8.4 compatible formatting of doubles} precision \
- {expr 1e298} \
- 9.9999999999999996e+297
-test util-16.1.17.299 {8.4 compatible formatting of doubles} precision \
- {expr 1e299} \
- 1.0000000000000001e+299
-test util-16.1.17.300 {8.4 compatible formatting of doubles} precision \
- {expr 1e300} \
- 1.0000000000000001e+300
-test util-16.1.17.301 {8.4 compatible formatting of doubles} precision \
- {expr 1e301} \
- 1.0000000000000001e+301
-test util-16.1.17.302 {8.4 compatible formatting of doubles} precision \
- {expr 1e302} \
- 1.0000000000000001e+302
-test util-16.1.17.303 {8.4 compatible formatting of doubles} precision \
- {expr 1e303} \
- 1e+303
-test util-16.1.17.304 {8.4 compatible formatting of doubles} precision \
- {expr 1e304} \
- 9.9999999999999994e+303
-test util-16.1.17.305 {8.4 compatible formatting of doubles} precision \
- {expr 1e305} \
- 9.9999999999999994e+304
-test util-16.1.17.306 {8.4 compatible formatting of doubles} precision \
- {expr 1e306} \
- 1e+306
-test util-16.1.17.307 {8.4 compatible formatting of doubles} precision \
- {expr 1e307} \
- 9.9999999999999999e+306
-
test util-17.1 {bankers' rounding [Bug 3349507]} {ieeeFloatingPoint} {
set r {}
foreach {input} {
@@ -4129,10 +2182,6 @@ test util-18.12 {Tcl_ObjPrintf} {testprint} {
testprint "%I64d %Id" 65537
} {65537 65537}
-if {[catch {set ::tcl_precision $saved_precision}]} {
- unset ::tcl_precision
-}
-
# cleanup
::tcltest::cleanupTests
return
diff --git a/tests/var.test b/tests/var.test
index a5b91f8..59f64ef 100644
--- a/tests/var.test
+++ b/tests/var.test
@@ -269,10 +269,11 @@ test var-3.4 {MakeUpvar, my var has TCL_NAMESPACE_ONLY specified} -setup {
catch {unset ::test_ns_var::vv}
proc p {} {
# create namespace var vv linked to global a
- testupvar 1 a {} vv namespace
+ testupvar 2 a {} vv namespace
}
p
}
+ # Modified: that should create a global var according to the docs!
list $test_ns_var::vv [set test_ns_var::vv 123] $a
} -result {456 123 123}
test var-3.5 {MakeUpvar, no call frame so my var will be in global :: ns} -setup {
@@ -464,7 +465,7 @@ test var-7.5 {Tcl_VariableObjCmd, value for last var is optional} -setup {
set six 666
namespace eval test_ns_var {
variable five 5 six
- lappend a $five
+ lappend ::a $five
}
lappend a $test_ns_var::five \
[set test_ns_var::six 6] [set test_ns_var::six] $six
@@ -491,9 +492,9 @@ test var-7.8 {Tcl_VariableObjCmd, if var already exists and no value is given, l
set a ""
namespace eval test_ns_var {
variable eight 8
- lappend a $eight
+ lappend ::a $eight
variable eight
- lappend a $eight
+ lappend ::a $eight
}
set a
} {8 8}
diff --git a/tests/while-old.test b/tests/while-old.test
index ee17d0b..e33bd0b 100644
--- a/tests/while-old.test
+++ b/tests/while-old.test
@@ -92,7 +92,7 @@ test while-old-4.3 {errors in while loops} {
test while-old-4.4 {errors in while loops} {
set err [catch {while {"a"+"b"} {error "loop aborted"}} msg]
list $err $msg
-} {1 {can't use non-numeric string as operand of "+"}}
+} {1 {can't use non-numeric string "a" as operand of "+"}}
test while-old-4.5 {errors in while loops} {
catch {unset x}
set x 1
diff --git a/tests/while.test b/tests/while.test
index 642ec93..c25b404 100644
--- a/tests/while.test
+++ b/tests/while.test
@@ -32,7 +32,7 @@ test while-1.2 {TclCompileWhileCmd: error in test expression} -body {
} -match glob -result {*"while {$i<} break"}
test while-1.3 {TclCompileWhileCmd: error in test expression} -body {
while {"a"+"b"} {error "loop aborted"}
-} -returnCodes error -result {can't use non-numeric string as operand of "+"}
+} -returnCodes error -result {can't use non-numeric string "a" as operand of "+"}
test while-1.4 {TclCompileWhileCmd: multiline test expr} -body {
set value 1
while {($tcl_platform(platform) != "foobar1") && \
@@ -343,7 +343,7 @@ test while-4.3 {while (not compiled): error in test expression} -body {
test while-4.4 {while (not compiled): error in test expression} -body {
set z while
$z {"a"+"b"} {error "loop aborted"}
-} -returnCodes error -result {can't use non-numeric string as operand of "+"}
+} -returnCodes error -result {can't use non-numeric string "a" as operand of "+"}
test while-4.5 {while (not compiled): multiline test expr} -body {
set value 1
set z while
diff --git a/tools/README b/tools/README
index f4bf627..87a9af4 100644
--- a/tools/README
+++ b/tools/README
@@ -12,7 +12,7 @@ Generating HTML files.
The tcl-tk-man-html.tcl script from Robert Critchlow
generates a nice set of HTML with good cross references.
Use it like
- tclsh tcl-tk-man-html.tcl --htmldir=/tmp/tcl8.2
+ tclsh tcl-tk-man-html.tcl --htmldir=/tmp/tcl9.0
This script is very picky about the organization of man pages,
effectively acting as a style enforcer.
diff --git a/tools/checkLibraryDoc.tcl b/tools/checkLibraryDoc.tcl
index 6d147ac..47063c0 100755
--- a/tools/checkLibraryDoc.tcl
+++ b/tools/checkLibraryDoc.tcl
@@ -3,7 +3,7 @@
# This script attempts to determine what APIs exist in the source base that
# have not been documented. By grepping through all of the doc/*.3 man
# pages, looking for "Pkg_*" (e.g., Tcl_ or Tk_), and comparing this list
-# against the list of Pkg_ APIs found in the source (e.g., tcl8.2/*/*.[ch])
+# against the list of Pkg_ APIs found in the source (e.g., tcl9.0/*/*.[ch])
# we create six lists:
# 1) APIs in Source not in Docs.
# 2) APIs in Docs not in Source.
@@ -50,8 +50,6 @@ set StructList {
Tcl_TimerToken \
Tcl_Token \
Tcl_Trace \
- Tcl_Value \
- Tcl_ValueType \
Tcl_Var \
Tk_3DBorder \
Tk_ArgvInfo \
@@ -106,7 +104,7 @@ proc main {} {
if {($len != 2) && ($len != 3)} {
puts "usage: $argv0 pkgName pkgDir \[outFile\]"
puts " pkgName == Tcl,Tk"
- puts " pkgDir == /home/surles/cvs/tcl8.2"
+ puts " pkgDir == /home/surles/cvs/tcl9.0"
exit 1
}
diff --git a/tools/configure b/tools/configure
index 5903cc8..e125786 100755
--- a/tools/configure
+++ b/tools/configure
@@ -1681,7 +1681,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
# not, assume that its top-level directory is a sibling of ours.
#--------------------------------------------------------------------
-DEF_VER=8.7
+DEF_VER=9.0
# Check whether --with-tcl was given.
diff --git a/tools/configure.ac b/tools/configure.ac
index 3caa141..7950578 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -11,7 +11,7 @@ AC_PREREQ(2.69)
# not, assume that its top-level directory is a sibling of ours.
#--------------------------------------------------------------------
-DEF_VER=8.7
+DEF_VER=9.0
AC_ARG_WITH(tcl, [ --with-tcl=DIR use Tcl $DEF_VER binaries from DIR], TCL_BIN_DIR=$withval, TCL_BIN_DIR=`cd ../../tcl$DEF_VER$TCL_PATCH_LEVEL/unix; pwd`)
if test ! -d $TCL_BIN_DIR; then
diff --git a/tools/encoding/ebcdic.txt b/tools/encoding/ebcdic.txt
index d9fa42e..d9fa42e 100644..100755
--- a/tools/encoding/ebcdic.txt
+++ b/tools/encoding/ebcdic.txt
diff --git a/tools/encoding/tis-620.txt b/tools/encoding/tis-620.txt
index d3656c5..d3656c5 100644..100755
--- a/tools/encoding/tis-620.txt
+++ b/tools/encoding/tis-620.txt
diff --git a/tools/tcl.hpj.in b/tools/tcl.hpj.in
index 08d411d..a3d1a49 100644
--- a/tools/tcl.hpj.in
+++ b/tools/tcl.hpj.in
@@ -5,9 +5,9 @@ HCW=0
LCID=0x409 0x0 0x0 ;English (United States)
REPORT=Yes
TITLE=Tcl/Tk Reference Manual
-CNT=tcl87.cnt
+CNT=tcl90.cnt
COPYRIGHT=Copyright © 2000 Ajuba Solutions
-HLP=tcl87.hlp
+HLP=tcl90.hlp
[FILES]
tcl.rtf
diff --git a/tools/tcltk-man2html.tcl b/tools/tcltk-man2html.tcl
index 517360b..117ba73 100755
--- a/tools/tcltk-man2html.tcl
+++ b/tools/tcltk-man2html.tcl
@@ -4,7 +4,7 @@ if {[catch {package require Tcl 8.6-} msg]} {
puts stderr "ERROR: $msg"
puts stderr "If running this script from 'make html', set the\
NATIVE_TCLSH environment\nvariable to point to an installed\
- tclsh8.7 (or the equivalent tclsh87.exe\non Windows)."
+ tclsh9.0 (or the equivalent tclsh90.exe\non Windows)."
exit 1
}
@@ -22,7 +22,7 @@ if {[catch {package require Tcl 8.6-} msg]} {
# Copyright (c) 1995-1997 Roger E. Critchlow Jr
# Copyright (c) 2004-2010 Donal K. Fellows
-set ::Version "50/8.7"
+set ::Version "50/9.0"
set ::CSSFILE "docs.css"
##
diff --git a/unix/Makefile.in b/unix/Makefile.in
index 0afd069..b9739ce 100644
--- a/unix/Makefile.in
+++ b/unix/Makefile.in
@@ -125,7 +125,7 @@ ENV_FLAGS =
# To enable memory debugging, call configure with --enable-symbols=mem
# Warning: if you enable memory debugging, you must do it *everywhere*,
-# including all the code that calls Tcl, and you must use ckalloc and ckfree
+# including all the code that calls Tcl, and you must use Tcl_Alloc and Tcl_Free
# everywhere instead of malloc and free.
TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@
@@ -925,7 +925,7 @@ install-libraries: libraries
$(INSTALL_DATA_DIR) "$$i"; \
fi; \
done
- @for i in opt0.4 encoding ../tcl8 ../tcl8/8.4 ../tcl8/8.4/platform ../tcl8/8.5 ../tcl8/8.6 ../tcl8/8.7 ; do \
+ @for i in opt0.4 encoding ../tcl9 ../tcl9/9.0 ../tcl9/9.0/platform ; do \
if [ ! -d "$(SCRIPT_INSTALL_DIR)"/$$i ] ; then \
echo "Making directory $(SCRIPT_INSTALL_DIR)/$$i"; \
$(INSTALL_DATA_DIR) "$(SCRIPT_INSTALL_DIR)"/$$i; \
@@ -938,23 +938,23 @@ install-libraries: libraries
done
@echo "Installing package http 2.9.0 as a Tcl Module"
@$(INSTALL_DATA) $(TOP_DIR)/library/http/http.tcl \
- "$(MODULE_INSTALL_DIR)"/tcl8/8.6/http-2.9.0.tm
+ "$(MODULE_INSTALL_DIR)"/tcl9/9.0/http-2.9.0.tm
@echo "Installing package opt0.4 files to $(SCRIPT_INSTALL_DIR)/opt0.4/"
@for i in $(TOP_DIR)/library/opt/*.tcl ; do \
$(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)"/opt0.4; \
done
@echo "Installing package msgcat 1.7.0 as a Tcl Module"
@$(INSTALL_DATA) $(TOP_DIR)/library/msgcat/msgcat.tcl \
- "$(MODULE_INSTALL_DIR)"/tcl8/8.7/msgcat-1.7.0.tm
+ "$(MODULE_INSTALL_DIR)"/tcl9/9.0/msgcat-1.7.0.tm
@echo "Installing package tcltest 2.5.0 as a Tcl Module"
@$(INSTALL_DATA) $(TOP_DIR)/library/tcltest/tcltest.tcl \
- "$(MODULE_INSTALL_DIR)"/tcl8/8.5/tcltest-2.5.0.tm
+ "$(MODULE_INSTALL_DIR)"/tcl9/9.0/tcltest-2.5.0.tm
@echo "Installing package platform 1.0.14 as a Tcl Module"
@$(INSTALL_DATA) $(TOP_DIR)/library/platform/platform.tcl \
- "$(MODULE_INSTALL_DIR)"/tcl8/8.4/platform-1.0.14.tm
+ "$(MODULE_INSTALL_DIR)"/tcl9/9.0/platform-1.0.14.tm
@echo "Installing package platform::shell 1.1.4 as a Tcl Module"
@$(INSTALL_DATA) $(TOP_DIR)/library/platform/shell.tcl \
- "$(MODULE_INSTALL_DIR)"/tcl8/8.4/platform/shell-1.1.4.tm
+ "$(MODULE_INSTALL_DIR)"/tcl9/9.0/platform/shell-1.1.4.tm
@echo "Installing encoding files to $(SCRIPT_INSTALL_DIR)/encoding/"
@for i in $(TOP_DIR)/library/encoding/*.enc ; do \
$(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)"/encoding; \
@@ -2137,6 +2137,8 @@ DISTROOT = /tmp/dist
DISTNAME = tcl${VERSION}${PATCH_LEVEL}
ZIPNAME = tcl${MAJOR_VERSION}${MINOR_VERSION}${PATCH_LEVEL}-src.zip
DISTDIR = $(DISTROOT)/$(DISTNAME)
+DIST_INSTALL_DATA = CPPROG='cp -p' $(INSTALL) -m 644
+DIST_INSTALL_SCRIPT = CPPROG='cp -p' $(INSTALL) -m 755
BUILTIN_PACKAGE_LIST = http opt msgcat reg dde tcltest platform
$(UNIX_DIR)/configure: $(UNIX_DIR)/configure.ac $(UNIX_DIR)/tcl.m4 \
@@ -2150,101 +2152,106 @@ $(UNIX_DIR)/tclConfig.h.in: $(MAC_OSX_DIR)/configure
dist: $(UNIX_DIR)/configure $(UNIX_DIR)/tclConfig.h.in $(UNIX_DIR)/tcl.pc.in \
$(MAC_OSX_DIR)/configure genstubs dist-packages ${NATIVE_TCLSH}
rm -rf $(DISTDIR)
- mkdir -p $(DISTDIR)/unix
- cp -p $(UNIX_DIR)/*.[ch] $(DISTDIR)/unix
- cp $(UNIX_DIR)/Makefile.in $(DISTDIR)/unix
- chmod 664 $(DISTDIR)/unix/Makefile.in
- cp $(UNIX_DIR)/configure $(UNIX_DIR)/configure.ac \
+ $(INSTALL_DATA_DIR) $(DISTDIR)/unix
+ $(DIST_INSTALL_DATA) $(UNIX_DIR)/*.[ch] $(DISTDIR)/unix
+ $(DIST_INSTALL_DATA) $(UNIX_DIR)/Makefile.in $(DISTDIR)/unix
+ $(DIST_INSTALL_DATA) $(UNIX_DIR)/configure.ac \
$(UNIX_DIR)/tcl.m4 $(UNIX_DIR)/aclocal.m4 \
$(UNIX_DIR)/tclConfig.sh.in $(UNIX_DIR)/tclooConfig.sh \
$(UNIX_DIR)/install-sh \
- $(UNIX_DIR)/README $(UNIX_DIR)/ldAix $(UNIX_DIR)/tcl.spec \
+ $(UNIX_DIR)/README $(UNIX_DIR)/tcl.spec \
$(UNIX_DIR)/installManPage $(UNIX_DIR)/tclConfig.h.in \
$(UNIX_DIR)/tcl.pc.in $(DISTDIR)/unix
- chmod 775 $(DISTDIR)/unix/configure $(DISTDIR)/unix/configure.ac
- chmod 775 $(DISTDIR)/unix/ldAix
- @mkdir $(DISTDIR)/generic
- cp -p $(GENERIC_DIR)/*.[cdh] $(DISTDIR)/generic
- cp -p $(GENERIC_DIR)/*.decls $(DISTDIR)/generic
- cp -p $(GENERIC_DIR)/README $(DISTDIR)/generic
- cp -p $(GENERIC_DIR)/tclGetDate.y $(DISTDIR)/generic
- cp -p $(TOP_DIR)/changes $(TOP_DIR)/ChangeLog $(TOP_DIR)/README.md \
+ $(DIST_INSTALL_SCRIPT) $(UNIX_DIR)/configure $(UNIX_DIR)/ldAix $(DISTDIR)/unix
+ $(INSTALL_DATA_DIR) $(DISTDIR)/generic
+ $(DIST_INSTALL_DATA) $(GENERIC_DIR)/*.[cdh] $(DISTDIR)/generic
+ $(DIST_INSTALL_DATA) $(GENERIC_DIR)/*.decls $(DISTDIR)/generic
+ $(DIST_INSTALL_DATA) $(GENERIC_DIR)/README $(DISTDIR)/generic
+ $(DIST_INSTALL_DATA) $(GENERIC_DIR)/tclGetDate.y $(DISTDIR)/generic
+ $(DIST_INSTALL_DATA) $(TOP_DIR)/changes $(TOP_DIR)/ChangeLog $(TOP_DIR)/README.md \
$(TOP_DIR)/ChangeLog.[12]??? $(TOP_DIR)/license.terms \
$(DISTDIR)
- @mkdir $(DISTDIR)/library
- cp -p $(TOP_DIR)/license.terms $(TOP_DIR)/library/*.tcl \
+ $(INSTALL_DATA_DIR) $(DISTDIR)/library
+ $(DIST_INSTALL_DATA) $(TOP_DIR)/license.terms $(TOP_DIR)/library/*.tcl \
$(TOP_DIR)/library/tclIndex $(DISTDIR)/library
@for i in $(BUILTIN_PACKAGE_LIST) ; do \
- mkdir $(DISTDIR)/library/$$i;\
- cp -p $(TOP_DIR)/library/$$i/*.tcl $(DISTDIR)/library/$$i; \
+ $(INSTALL_DATA_DIR) $(DISTDIR)/library/$$i;\
+ $(DIST_INSTALL_DATA) $(TOP_DIR)/library/$$i/*.tcl $(DISTDIR)/library/$$i; \
done
- @mkdir $(DISTDIR)/library/encoding
- cp -p $(TOP_DIR)/library/encoding/*.enc $(DISTDIR)/library/encoding
- @mkdir $(DISTDIR)/library/msgs
- cp -p $(TOP_DIR)/library/msgs/*.msg $(DISTDIR)/library/msgs
+ $(INSTALL_DATA_DIR) $(DISTDIR)/library/encoding
+ $(DIST_INSTALL_DATA) $(TOP_DIR)/library/encoding/*.enc $(DISTDIR)/library/encoding
+ $(INSTALL_DATA_DIR) $(DISTDIR)/library/msgs
+ $(DIST_INSTALL_DATA) $(TOP_DIR)/library/msgs/*.msg $(DISTDIR)/library/msgs
@echo cp -r $(TOP_DIR)/library/tzdata $(DISTDIR)/library/tzdata
@( cd $(TOP_DIR); find library/tzdata -type f -print ) \
| ( cd $(TOP_DIR) ; xargs tar cf - ) \
| ( cd $(DISTDIR) ; tar xfp - )
- @mkdir $(DISTDIR)/doc
- cp -p $(TOP_DIR)/license.terms $(TOP_DIR)/doc/*.[13n] \
+ $(INSTALL_DATA_DIR) $(DISTDIR)/doc
+ $(DIST_INSTALL_DATA) $(TOP_DIR)/license.terms $(TOP_DIR)/doc/*.[13n] \
$(TOP_DIR)/doc/man.macros $(DISTDIR)/doc
- @mkdir $(DISTDIR)/compat
- cp -p $(TOP_DIR)/license.terms $(COMPAT_DIR)/*.[ch] \
+ $(INSTALL_DATA_DIR) $(DISTDIR)/compat
+ $(DIST_INSTALL_DATA) $(TOP_DIR)/license.terms $(COMPAT_DIR)/*.[ch] \
$(COMPAT_DIR)/README $(DISTDIR)/compat
- @mkdir $(DISTDIR)/compat/zlib
+ $(INSTALL_DATA_DIR) $(DISTDIR)/compat/zlib
@echo cp -r $(COMPAT_DIR)/zlib $(DISTDIR)/compat/zlib
@( cd $(COMPAT_DIR)/zlib; find . -type f -print ) \
| ( cd $(COMPAT_DIR)/zlib ; xargs tar cf - ) \
| ( cd $(DISTDIR)/compat/zlib ; tar xfp - )
- @mkdir $(DISTDIR)/tests
- cp -p $(TOP_DIR)/license.terms $(DISTDIR)/tests
- cp -p $(TOP_DIR)/tests/*.test $(TOP_DIR)/tests/README \
+ $(INSTALL_DATA_DIR) $(DISTDIR)/tests
+ $(DIST_INSTALL_DATA) $(TOP_DIR)/license.terms $(DISTDIR)/tests
+ $(DIST_INSTALL_DATA) $(TOP_DIR)/tests/*.test $(TOP_DIR)/tests/README \
$(TOP_DIR)/tests/httpd $(TOP_DIR)/tests/*.tcl \
$(DISTDIR)/tests
- @mkdir $(DISTDIR)/win
- cp $(TOP_DIR)/win/Makefile.in $(DISTDIR)/win
- cp $(TOP_DIR)/win/configure.ac $(TOP_DIR)/win/configure \
+ $(INSTALL_DATA_DIR) $(DISTDIR)/win
+ $(DIST_INSTALL_DATA) $(TOP_DIR)/win/Makefile.in $(DISTDIR)/win
+ $(DIST_INSTALL_DATA) $(TOP_DIR)/win/configure.ac \
$(TOP_DIR)/win/tclConfig.sh.in $(TOP_DIR)/win/tclooConfig.sh \
$(TOP_DIR)/win/tcl.m4 $(TOP_DIR)/win/aclocal.m4 \
$(TOP_DIR)/win/tclsh.exe.manifest.in \
$(DISTDIR)/win
- cp -p $(TOP_DIR)/win/*.[ch] $(TOP_DIR)/win/*.ico $(TOP_DIR)/win/*.rc \
+ $(DIST_INSTALL_SCRIPT) $(TOP_DIR)/win/configure $(DISTDIR)/win
+ $(DIST_INSTALL_DATA) $(TOP_DIR)/win/*.[ch] $(TOP_DIR)/win/*.ico $(TOP_DIR)/win/*.rc \
$(DISTDIR)/win
- cp -p $(TOP_DIR)/win/*.bat $(DISTDIR)/win
- cp -p $(TOP_DIR)/win/*.vc $(DISTDIR)/win
- cp -p $(TOP_DIR)/win/tcl.hpj.in $(DISTDIR)/win
- cp -p $(TOP_DIR)/win/tcl.ds* $(DISTDIR)/win
- cp -p $(TOP_DIR)/win/README $(DISTDIR)/win
- cp -p $(TOP_DIR)/license.terms $(DISTDIR)/win
- @mkdir $(DISTDIR)/macosx
- cp -p $(MAC_OSX_DIR)/GNUmakefile $(MAC_OSX_DIR)/README \
+ $(DIST_INSTALL_DATA) $(TOP_DIR)/win/*.bat $(DISTDIR)/win
+ $(DIST_INSTALL_DATA) $(TOP_DIR)/win/*.vc $(DISTDIR)/win
+ $(DIST_INSTALL_DATA) $(TOP_DIR)/win/tcl.hpj.in $(DISTDIR)/win
+ $(DIST_INSTALL_DATA) $(TOP_DIR)/win/tcl.ds* $(DISTDIR)/win
+ $(DIST_INSTALL_DATA) $(TOP_DIR)/win/README $(DISTDIR)/win
+ $(DIST_INSTALL_DATA) $(TOP_DIR)/license.terms $(DISTDIR)/win
+ $(INSTALL_DATA_DIR) $(DISTDIR)/macosx
+ $(DIST_INSTALL_DATA) $(MAC_OSX_DIR)/GNUmakefile $(MAC_OSX_DIR)/README \
$(MAC_OSX_DIR)/*.c $(MAC_OSX_DIR)/*.in \
$(MAC_OSX_DIR)/*.ac $(MAC_OSX_DIR)/*.xcconfig \
- $(MAC_OSX_DIR)/configure $(DISTDIR)/macosx
- cp -p $(TOP_DIR)/license.terms $(DISTDIR)/macosx
- @mkdir $(DISTDIR)/macosx/Tcl.xcode
- cp -p $(MAC_OSX_DIR)/Tcl.xcode/project.pbxproj \
+ $(DISTDIR)/macosx
+ $(DIST_INSTALL_SCRIPT) $(MAC_OSX_DIR)/configure $(DISTDIR)/macosx
+ $(DIST_INSTALL_DATA) $(TOP_DIR)/license.terms $(DISTDIR)/macosx
+ $(INSTALL_DATA_DIR) $(DISTDIR)/macosx/Tcl.xcode
+ $(DIST_INSTALL_DATA) $(MAC_OSX_DIR)/Tcl.xcode/project.pbxproj \
$(MAC_OSX_DIR)/Tcl.xcode/default.pbxuser \
$(DISTDIR)/macosx/Tcl.xcode
- @mkdir $(DISTDIR)/macosx/Tcl.xcodeproj
- cp -p $(MAC_OSX_DIR)/Tcl.xcodeproj/project.pbxproj \
+ $(INSTALL_DATA_DIR) $(DISTDIR)/macosx/Tcl.xcodeproj
+ $(DIST_INSTALL_DATA) $(MAC_OSX_DIR)/Tcl.xcodeproj/project.pbxproj \
$(MAC_OSX_DIR)/Tcl.xcodeproj/default.pbxuser \
$(DISTDIR)/macosx/Tcl.xcodeproj
- @mkdir $(DISTDIR)/unix/dltest
- cp -p $(UNIX_DIR)/dltest/*.c $(UNIX_DIR)/dltest/Makefile.in \
+ $(INSTALL_DATA_DIR) $(DISTDIR)/unix/dltest
+ $(DIST_INSTALL_DATA) $(UNIX_DIR)/dltest/*.c $(UNIX_DIR)/dltest/Makefile.in \
$(UNIX_DIR)/dltest/README $(DISTDIR)/unix/dltest
- @mkdir $(DISTDIR)/tools
- cp -p $(TOOL_DIR)/Makefile.in $(TOOL_DIR)/README \
+ $(INSTALL_DATA_DIR) $(DISTDIR)/tools
+ $(DIST_INSTALL_DATA) $(TOOL_DIR)/Makefile.in $(TOOL_DIR)/README \
$(TOOL_DIR)/configure $(TOOL_DIR)/configure.ac \
$(TOOL_DIR)/*.tcl $(TOOL_DIR)/man2tcl.c \
$(TOOL_DIR)/*.bmp $(TOOL_DIR)/tcl.hpj.in \
$(DISTDIR)/tools
- @mkdir $(DISTDIR)/libtommath
- cp -p $(TOMMATH_SRCS) $(TOMMATH_DIR)/*.h $(DISTDIR)/libtommath
- @mkdir $(DISTDIR)/pkgs
- cp $(TOP_DIR)/pkgs/README $(DISTDIR)/pkgs
- cp $(TOP_DIR)/pkgs/package.list.txt $(DISTDIR)/pkgs
+ chmod 755 $(DISTDIR)/tools/checkLibraryDoc.tcl \
+ $(DISTDIR)/tools/configure $(DISTDIR)/tools/findBadExternals.tcl \
+ $(DISTDIR)/tools/fix_tommath_h.tcl $(DISTDIR)/tools/loadICU.tcl \
+ $(DISTDIR)/tools/makeTestCases.tcl $(DISTDIR)/tools/tclZIC.tcl \
+ $(DISTDIR)/tools/tcltk-man2html.tcl
+ $(INSTALL_DATA_DIR) $(DISTDIR)/libtommath
+ $(DIST_INSTALL_DATA) $(TOMMATH_SRCS) $(TOMMATH_DIR)/*.h $(DISTDIR)/libtommath
+ $(INSTALL_DATA_DIR) $(DISTDIR)/pkgs
+ $(DIST_INSTALL_DATA) $(TOP_DIR)/pkgs/README $(DISTDIR)/pkgs
+ $(DIST_INSTALL_DATA) $(TOP_DIR)/pkgs/package.list.txt $(DISTDIR)/pkgs
for i in `ls $(DISTROOT)/pkgs/*.tar.gz 2> /dev/null` ; do \
tar -C $(DISTDIR)/pkgs -xzf "$$i"; \
done
@@ -2259,7 +2266,7 @@ alldist: dist
#--------------------------------------------------------------------------
# This target creates the HTML folder for Tcl & Tk and places it in
# DISTDIR/html. It uses the tcltk-man2html.tcl tool from the Tcl group's tool
-# workspace. It depends on the Tcl & Tk being in directories called tcl8.* &
+# workspace. It depends on the Tcl & Tk being in directories called tcl9.* &
# tk8.* up two directories from the TOOL_DIR.
#
# Note that for platforms where this is important, it is more common to use a
diff --git a/unix/config.status.lineno b/unix/config.status.lineno
deleted file mode 100755
index 12d4f40..0000000
--- a/unix/config.status.lineno
+++ /dev/null
@@ -1,920 +0,0 @@
-#! /bin/bash
-# Generated by configure.
-# Run this file to recreate the current configuration.
-# Compiler output produced by configure, useful for debugging
-# configure, is in config.log if it exists.
-
-debug=false
-ac_cs_recheck=false
-ac_cs_silent=false
-SHELL=${CONFIG_SHELL-/bin/bash}
-## --------------------- ##
-## M4sh Initialization. ##
-## --------------------- ##
-
-# Be Bourne compatible
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
- emulate sh
- NULLCMD=:
- # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
- # is contrary to our usage. Disable this feature.
- alias -g '${1+"$@"}'='"$@"'
-elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
- set -o posix
-fi
-DUALCASE=1; export DUALCASE # for MKS sh
-
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
- as_unset=unset
-else
- as_unset=false
-fi
-
-
-# Work around bugs in pre-3.0 UWIN ksh.
-$as_unset ENV MAIL MAILPATH
-PS1='$ '
-PS2='> '
-PS4='+ '
-
-# NLS nuisances.
-for as_var in \
- LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
- LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
- LC_TELEPHONE LC_TIME
-do
- if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
- eval $as_var=C; export $as_var
- else
- $as_unset $as_var
- fi
-done
-
-# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
- as_basename=basename
-else
- as_basename=false
-fi
-
-
-# Name of the executable.
-as_me=`$as_basename "$0" ||
-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
- X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)$' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X/"$0" |
- sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
- /^X\/\(\/\/\)$/{ s//\1/; q; }
- /^X\/\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
-
-
-# PATH needs CR, and LINENO needs CR and PATH.
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- echo "#! /bin/sh" >conf$$.sh
- echo "exit 0" >>conf$$.sh
- chmod +x conf$$.sh
- if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
- PATH_SEPARATOR=';'
- else
- PATH_SEPARATOR=:
- fi
- rm -f conf$$.sh
-fi
-
-
- as_lineno_1=103
- as_lineno_2=104
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" || {
- # Find who we are. Look in the path if we contain no path at all
- # relative or not.
- case $0 in
- *[\\/]* ) as_myself=$0 ;;
- *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
-
- ;;
- esac
- # We did not find ourselves, most probably we were run as `sh COMMAND'
- # in which case we are not to be found in the path.
- if test "x$as_myself" = x; then
- as_myself=$0
- fi
- if test ! -f "$as_myself"; then
- { { echo "$as_me:128: error: cannot find myself; rerun with an absolute path" >&5
-echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
- { (exit 1); exit 1; }; }
- fi
- case $CONFIG_SHELL in
- '')
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for as_base in sh bash ksh sh5; do
- case $as_dir in
- /*)
- if ("$as_dir/$as_base" -c '
- as_lineno_1=143
- as_lineno_2=144
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
- $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
- $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
- CONFIG_SHELL=$as_dir/$as_base
- export CONFIG_SHELL
- exec "$CONFIG_SHELL" "$0" ${1+"$@"}
- fi;;
- esac
- done
-done
-;;
- esac
-
- # Create $as_me.lineno as a copy of $as_myself, but with 160
- # uniformly replaced by the line number. The first 'sed' inserts a
- # line-number line before each line; the second 'sed' does the real
- # work. The second script uses 'N' to pair each line-number line
- # with the numbered line, and appends trailing '-' during
- # substitution so that 165 is not a special case at line end.
- # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
- # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
- sed '=' <$as_myself |
- sed '
- N
- s,$,-,
- : loop
- s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
- t loop
- s,-$,,
- s,^['$as_cr_digits']*\n,,
- ' >$as_me.lineno &&
- chmod +x $as_me.lineno ||
- { { echo "$as_me:179: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
-echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
- { (exit 1); exit 1; }; }
-
- # Don't try to exec as it changes $[0], causing all sort of problems
- # (the dirname of $[0] is not the place where we might find the
- # original and so on. Autoconf is especially sensible to this).
- . ./$as_me.lineno
- # Exit status is that of the last command.
- exit
-}
-
-
-case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
- *c*,-n*) ECHO_N= ECHO_C='
-' ECHO_T=' ' ;;
- *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
- *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
-esac
-
-if expr a : '\(a\)' >/dev/null 2>&1; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-rm -f conf$$ conf$$.exe conf$$.file
-echo >conf$$.file
-if ln -s conf$$.file conf$$ 2>/dev/null; then
- # We could just check for DJGPP; but this test a) works b) is more generic
- # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
- if test -f conf$$.exe; then
- # Don't use ln at all; we don't have any links
- as_ln_s='cp -p'
- else
- as_ln_s='ln -s'
- fi
-elif ln conf$$.file conf$$ 2>/dev/null; then
- as_ln_s=ln
-else
- as_ln_s='cp -p'
-fi
-rm -f conf$$ conf$$.exe conf$$.file
-
-if mkdir -p . 2>/dev/null; then
- as_mkdir_p=:
-else
- test -d ./-p && rmdir ./-p
- as_mkdir_p=false
-fi
-
-as_executable_p="test -f"
-
-# Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
-
-# Sed expression to map a string onto a valid variable name.
-as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-
-
-# IFS
-# We need space, tab and new line, in precisely that order.
-as_nl='
-'
-IFS=" $as_nl"
-
-# CDPATH.
-$as_unset CDPATH
-
-exec 6>&1
-
-# Open the log real soon, to keep \$[0] and so on meaningful, and to
-# report actual input values of CONFIG_FILES etc. instead of their
-# values after options handling. Logging --version etc. is OK.
-exec 5>>config.log
-{
- echo
- sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
-## Running $as_me. ##
-_ASBOX
-} >&5
-cat >&5 <<_CSEOF
-
-This file was extended by tcl $as_me 8.6, which was
-generated by GNU Autoconf 2.59. Invocation command line was
-
- CONFIG_FILES = $CONFIG_FILES
- CONFIG_HEADERS = $CONFIG_HEADERS
- CONFIG_LINKS = $CONFIG_LINKS
- CONFIG_COMMANDS = $CONFIG_COMMANDS
- $ $0 $@
-
-_CSEOF
-echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
-echo >&5
-config_files=" Makefile:../unix/Makefile.in dltest/Makefile:../unix/dltest/Makefile.in tclConfig.sh:../unix/tclConfig.sh.in tcl.pc:../unix/tcl.pc.in"
-
-ac_cs_usage="\
-\`$as_me' instantiates files from templates according to the
-current configuration.
-
-Usage: $0 [OPTIONS] [FILE]...
-
- -h, --help print this help, then exit
- -V, --version print version number, then exit
- -q, --quiet do not print progress messages
- -d, --debug don't remove temporary files
- --recheck update $as_me by reconfiguring in the same conditions
- --file=FILE[:TEMPLATE]
- instantiate the configuration file FILE
-
-Configuration files:
-$config_files
-
-Configuration commands:
-$config_commands
-
-Report bugs to <bug-autoconf@gnu.org>."
-ac_cs_version="\
-tcl config.status 8.6
-configured by ./configure, generated by GNU Autoconf 2.59,
- with options \"'--prefix=/home/jima/space/ins/lin64/dynamic/main'\"
-
-Copyright (C) 2003 Free Software Foundation, Inc.
-This config.status script is free software; the Free Software Foundation
-gives unlimited permission to copy, distribute and modify it."
-srcdir=/home/jima/space/bui/lin64/dynamic/main/tcl/unix
-# If no file are specified by the user, then we need to provide default
-# value. By we need to know if files were specified by the user.
-ac_need_defaults=:
-while test $# != 0
-do
- case $1 in
- --*=*)
- ac_option=`expr "x$1" : 'x\([^=]*\)='`
- ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
- ac_shift=:
- ;;
- -*)
- ac_option=$1
- ac_optarg=$2
- ac_shift=shift
- ;;
- *) # This is not an option, so the user has probably given explicit
- # arguments.
- ac_option=$1
- ac_need_defaults=false;;
- esac
-
- case $ac_option in
- # Handling of the options.
- -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- ac_cs_recheck=: ;;
- --version | --vers* | -V )
- echo "$ac_cs_version"; exit 0 ;;
- --he | --h)
- # Conflict between --help and --header
- { { echo "$as_me:336: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&5
-echo "$as_me: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&2;}
- { (exit 1); exit 1; }; };;
- --help | --hel | -h )
- echo "$ac_cs_usage"; exit 0 ;;
- --debug | --d* | -d )
- debug=: ;;
- --file | --fil | --fi | --f )
- $ac_shift
- CONFIG_FILES="$CONFIG_FILES $ac_optarg"
- ac_need_defaults=false;;
- --header | --heade | --head | --hea )
- $ac_shift
- CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
- ac_need_defaults=false;;
- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
- | -silent | --silent | --silen | --sile | --sil | --si | --s)
- ac_cs_silent=: ;;
-
- # This is an error.
- -*) { { echo "$as_me:358: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&5
-echo "$as_me: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&2;}
- { (exit 1); exit 1; }; } ;;
-
- *) ac_config_targets="$ac_config_targets $1" ;;
-
- esac
- shift
-done
-
-ac_configure_extra_args=
-
-if $ac_cs_silent; then
- exec 6>/dev/null
- ac_configure_extra_args="$ac_configure_extra_args --silent"
-fi
-
-if $ac_cs_recheck; then
- echo "running /bin/bash ./configure " '--prefix=/home/jima/space/ins/lin64/dynamic/main' $ac_configure_extra_args " --no-create --no-recursion" >&6
- exec /bin/bash ./configure '--prefix=/home/jima/space/ins/lin64/dynamic/main' $ac_configure_extra_args --no-create --no-recursion
-fi
-
-#
-# INIT-COMMANDS section.
-#
-
-VERSION=8.6
-
-for ac_config_target in $ac_config_targets
-do
- case "$ac_config_target" in
- # Handling of arguments.
- "Tcl-Info.plist" ) CONFIG_FILES="$CONFIG_FILES Tcl-Info.plist:../macosx/Tcl-Info.plist.in" ;;
- "Tclsh-Info.plist" ) CONFIG_FILES="$CONFIG_FILES Tclsh-Info.plist:../macosx/Tclsh-Info.plist.in" ;;
- "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile:../unix/Makefile.in" ;;
- "dltest/Makefile" ) CONFIG_FILES="$CONFIG_FILES dltest/Makefile:../unix/dltest/Makefile.in" ;;
- "tclConfig.sh" ) CONFIG_FILES="$CONFIG_FILES tclConfig.sh:../unix/tclConfig.sh.in" ;;
- "tcl.pc" ) CONFIG_FILES="$CONFIG_FILES tcl.pc:../unix/tcl.pc.in" ;;
- "Tcl.framework" ) CONFIG_COMMANDS="$CONFIG_COMMANDS Tcl.framework" ;;
- *) { { echo "$as_me:399: error: invalid argument: $ac_config_target" >&5
-echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
- { (exit 1); exit 1; }; };;
- esac
-done
-
-# If the user did not use the arguments to specify the items to instantiate,
-# then the envvar interface is used. Set only those that are not.
-# We use the long form for the default assignment because of an extremely
-# bizarre bug on SunOS 4.1.3.
-if $ac_need_defaults; then
- test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
- test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
-fi
-
-# Have a temporary directory for convenience. Make it in the build tree
-# simply because there is no reason to put it here, and in addition,
-# creating and moving files from /tmp can sometimes cause problems.
-# Create a temporary directory, and hook for its removal unless debugging.
-$debug ||
-{
- trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
- trap '{ (exit 1); exit 1; }' 1 2 13 15
-}
-
-# Create a (secure) tmp directory for tmp files.
-
-{
- tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
- test -n "$tmp" && test -d "$tmp"
-} ||
-{
- tmp=./confstat$$-$RANDOM
- (umask 077 && mkdir $tmp)
-} ||
-{
- echo "$me: cannot create a temporary directory in ." >&2
- { (exit 1); exit 1; }
-}
-
-
-#
-# CONFIG_FILES section.
-#
-
-# No need to generate the scripts if there are no CONFIG_FILES.
-# This happens for instance when ./config.status config.h
-if test -n "$CONFIG_FILES"; then
- # Protect against being on the right side of a sed subst in config.status.
- sed 's/,@/@@/; s/@,/@@/; s/,;t t$/@;t t/; /@;t t$/s/[\\&,]/\\&/g;
- s/@@/,@/; s/@@/@,/; s/@;t t$/,;t t/' >$tmp/subs.sed <<\CEOF
-s,@SHELL@,/bin/bash,;t t
-s,@PATH_SEPARATOR@,:,;t t
-s,@PACKAGE_NAME@,tcl,;t t
-s,@PACKAGE_TARNAME@,tcl,;t t
-s,@PACKAGE_VERSION@,8.6,;t t
-s,@PACKAGE_STRING@,tcl 8.6,;t t
-s,@PACKAGE_BUGREPORT@,,;t t
-s,@exec_prefix@,/home/jima/space/ins/lin64/dynamic/main,;t t
-s,@prefix@,/home/jima/space/ins/lin64/dynamic/main,;t t
-s,@program_transform_name@,s,x,x,,;t t
-s,@bindir@,${exec_prefix}/bin,;t t
-s,@sbindir@,${exec_prefix}/sbin,;t t
-s,@libexecdir@,${exec_prefix}/libexec,;t t
-s,@datadir@,${prefix}/share,;t t
-s,@sysconfdir@,${prefix}/etc,;t t
-s,@sharedstatedir@,${prefix}/com,;t t
-s,@localstatedir@,${prefix}/var,;t t
-s,@libdir@,/home/jima/space/ins/lin64/dynamic/main/lib,;t t
-s,@includedir@,${prefix}/include,;t t
-s,@oldincludedir@,/usr/include,;t t
-s,@infodir@,${prefix}/info,;t t
-s,@mandir@,${prefix}/man,;t t
-s,@build_alias@,,;t t
-s,@host_alias@,,;t t
-s,@target_alias@,,;t t
-s,@DEFS@,-DPACKAGE_NAME=\"tcl\" -DPACKAGE_TARNAME=\"tcl\" -DPACKAGE_VERSION=\"8.6\" -DPACKAGE_STRING=\"tcl\ 8.6\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_PARAM_H=1 -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -D_THREAD_SAFE=1 -DHAVE_PTHREAD_ATTR_SETSTACKSIZE=1 -DHAVE_PTHREAD_ATFORK=1 -DTCL_THREADS=1 -DTCL_CFGVAL_ENCODING=\"iso8859-1\" -DHAVE_ZLIB=1 -DMODULE_SCOPE=extern\ __attribute__\(\(__visibility__\(\"hidden\"\)\)\) -DHAVE_HIDDEN=1 -DHAVE_CAST_TO_UNION=1 -DTCL_SHLIB_EXT=\".so\" -DNDEBUG=1 -DTCL_CFG_OPTIMIZED=1 -DTCL_TOMMATH=1 -DMP_PREC=4 -D_LARGEFILE64_SOURCE=1 -DTCL_WIDE_INT_IS_LONG=1 -DHAVE_GETCWD=1 -DHAVE_MKSTEMP=1 -DHAVE_OPENDIR=1 -DHAVE_STRTOL=1 -DHAVE_WAITPID=1 -DHAVE_GETNAMEINFO=1 -DHAVE_GETADDRINFO=1 -DHAVE_FREEADDRINFO=1 -DHAVE_GAI_STRERROR=1 -DHAVE_STRUCT_ADDRINFO=1 -DHAVE_STRUCT_IN6_ADDR=1 -DHAVE_STRUCT_SOCKADDR_IN6=1 -DHAVE_STRUCT_SOCKADDR_STORAGE=1 -DHAVE_GETPWUID_R_5=1 -DHAVE_GETPWUID_R=1 -DHAVE_GETPWNAM_R_5=1 -DHAVE_GETPWNAM_R=1 -DHAVE_GETGRGID_R_5=1 -DHAVE_GETGRGID_R=1 -DHAVE_GETGRNAM_R_5=1 -DHAVE_GETGRNAM_R=1 -DHAVE_GETHOSTBYNAME_R_6=1 -DHAVE_GETHOSTBYNAME_R=1 -DHAVE_GETHOSTBYADDR_R_8=1 -DHAVE_GETHOSTBYADDR_R=1 -DHAVE_TERMIOS_H=1 -DHAVE_SYS_IOCTL_H=1 -DHAVE_SYS_TIME_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_GMTIME_R=1 -DHAVE_LOCALTIME_R=1 -DHAVE_MKTIME=1 -DHAVE_TM_GMTOFF=1 -DHAVE_TIMEZONE_VAR=1 -DHAVE_STRUCT_STAT_ST_BLOCKS=1 -DHAVE_STRUCT_STAT_ST_BLKSIZE=1 -DHAVE_BLKCNT_T=1 -DHAVE_INTPTR_T=1 -DHAVE_UINTPTR_T=1 -DNO_UNION_WAIT=1 -DHAVE_SIGNED_CHAR=1 -DHAVE_LANGINFO=1 -DHAVE_MKSTEMPS=1 -DHAVE_FTS=1 -DHAVE_SYS_IOCTL_H=1 -DTCL_UNLOAD_DLLS=1 -DHAVE_CPUID=1 ,;t t
-s,@ECHO_C@,,;t t
-s,@ECHO_N@,-n,;t t
-s,@ECHO_T@,,;t t
-s,@LIBS@,-lz -lpthread,;t t
-s,@MAN_FLAGS@,,;t t
-s,@CC@,gcc,;t t
-s,@CFLAGS@, -pipe ,;t t
-s,@LDFLAGS@, -Wl,--export-dynamic ,;t t
-s,@CPPFLAGS@,,;t t
-s,@ac_ct_CC@,gcc,;t t
-s,@EXEEXT@,,;t t
-s,@OBJEXT@,o,;t t
-s,@CPP@,gcc -E,;t t
-s,@EGREP@,grep -E,;t t
-s,@TCL_THREADS@,1,;t t
-s,@TCLSH_PROG@,/home/jima/space/ins/lin64/dynamic/main/bin/tclsh8.6,;t t
-s,@ZLIB_OBJS@,,;t t
-s,@ZLIB_SRCS@,,;t t
-s,@ZLIB_INCLUDE@,,;t t
-s,@RANLIB@,ranlib,;t t
-s,@ac_ct_RANLIB@,ranlib,;t t
-s,@AR@,ar,;t t
-s,@ac_ct_AR@,ar,;t t
-s,@LIBOBJS@,,;t t
-s,@TCL_LIBS@,-ldl -lz -lpthread -lieee -lm,;t t
-s,@DL_LIBS@,-ldl,;t t
-s,@DL_OBJS@,tclLoadDl.o,;t t
-s,@PLAT_OBJS@,,;t t
-s,@PLAT_SRCS@,,;t t
-s,@LDAIX_SRC@,,;t t
-s,@CFLAGS_DEBUG@,-g,;t t
-s,@CFLAGS_OPTIMIZE@,-O2,;t t
-s,@CFLAGS_WARNING@,-Wall,;t t
-s,@LDFLAGS_DEBUG@,,;t t
-s,@LDFLAGS_OPTIMIZE@,,;t t
-s,@CC_SEARCH_FLAGS@,-Wl,-rpath,${LIB_RUNTIME_DIR},;t t
-s,@LD_SEARCH_FLAGS@,-Wl,-rpath,${LIB_RUNTIME_DIR},;t t
-s,@STLIB_LD@,${AR} cr,;t t
-s,@SHLIB_LD@,${CC} ${CFLAGS} ${LDFLAGS} -shared,;t t
-s,@TCL_SHLIB_LD_EXTRAS@,,;t t
-s,@TK_SHLIB_LD_EXTRAS@,,;t t
-s,@SHLIB_LD_LIBS@,${LIBS},;t t
-s,@SHLIB_CFLAGS@,-fPIC,;t t
-s,@SHLIB_SUFFIX@,.so,;t t
-s,@MAKE_LIB@,${SHLIB_LD} -o $@ ${OBJS} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS},;t t
-s,@MAKE_STUB_LIB@,${STLIB_LD} $@ ${STUB_LIB_OBJS} ; ${RANLIB} $@,;t t
-s,@INSTALL_LIB@,$(INSTALL_LIBRARY) $(LIB_FILE) "$(LIB_INSTALL_DIR)/$(LIB_FILE)",;t t
-s,@DLL_INSTALL_DIR@,$(LIB_INSTALL_DIR),;t t
-s,@INSTALL_STUB_LIB@,$(INSTALL_LIBRARY) $(STUB_LIB_FILE) "$(LIB_INSTALL_DIR)/$(STUB_LIB_FILE)",;t t
-s,@CFLAGS_DEFAULT@,$(CFLAGS_OPTIMIZE),;t t
-s,@LDFLAGS_DEFAULT@,$(LDFLAGS_OPTIMIZE),;t t
-s,@DTRACE@,,;t t
-s,@TCL_VERSION@,8.6,;t t
-s,@TCL_MAJOR_VERSION@,8,;t t
-s,@TCL_MINOR_VERSION@,6,;t t
-s,@TCL_PATCH_LEVEL@,.8,;t t
-s,@TCL_YEAR@,,;t t
-s,@PKG_CFG_ARGS@,'--prefix=/home/jima/space/ins/lin64/dynamic/main' ,;t t
-s,@TCL_LIB_FILE@,libtcl8.6.so,;t t
-s,@TCL_LIB_FLAG@,-ltcl8.6,;t t
-s,@TCL_LIB_SPEC@,-L/home/jima/space/ins/lin64/dynamic/main/lib -ltcl8.6,;t t
-s,@TCL_STUB_LIB_FILE@,libtclstub8.6.a,;t t
-s,@TCL_STUB_LIB_FLAG@,-ltclstub8.6,;t t
-s,@TCL_STUB_LIB_SPEC@,-L/home/jima/space/ins/lin64/dynamic/main/lib -ltclstub8.6,;t t
-s,@TCL_STUB_LIB_PATH@,/home/jima/space/ins/lin64/dynamic/main/lib/libtclstub8.6.a,;t t
-s,@TCL_INCLUDE_SPEC@,-I/home/jima/space/ins/lin64/dynamic/main/include,;t t
-s,@TCL_BUILD_STUB_LIB_SPEC@,-L/home/jima/space/bui/lin64/dynamic/main/tcl/unix -ltclstub8.6,;t t
-s,@TCL_BUILD_STUB_LIB_PATH@,/home/jima/space/bui/lin64/dynamic/main/tcl/unix/libtclstub8.6.a,;t t
-s,@TCL_SRC_DIR@,/home/jima/space/bui/lin64/dynamic/main/tcl,;t t
-s,@CFG_TCL_SHARED_LIB_SUFFIX@,${VERSION}.so,;t t
-s,@CFG_TCL_UNSHARED_LIB_SUFFIX@,${VERSION}.a,;t t
-s,@TCL_SHARED_BUILD@,1,;t t
-s,@LD_LIBRARY_PATH_VAR@,LD_LIBRARY_PATH,;t t
-s,@TCL_BUILD_LIB_SPEC@,-L/home/jima/space/bui/lin64/dynamic/main/tcl/unix -ltcl8.6,;t t
-s,@TCL_LIB_VERSIONS_OK@,ok,;t t
-s,@TCL_SHARED_LIB_SUFFIX@,${VERSION}${SHLIB_SUFFIX},;t t
-s,@TCL_UNSHARED_LIB_SUFFIX@,${VERSION}.a,;t t
-s,@TCL_HAS_LONGLONG@,,;t t
-s,@INSTALL_TZDATA@,,;t t
-s,@DTRACE_SRC@,,;t t
-s,@DTRACE_HDR@,,;t t
-s,@DTRACE_OBJ@,,;t t
-s,@MAKEFILE_SHELL@,/bin/sh,;t t
-s,@BUILD_DLTEST@,$(DLTEST_TARGETS),;t t
-s,@TCL_PACKAGE_PATH@,/home/jima/space/ins/lin64/dynamic/main/lib ,;t t
-s,@TCL_MODULE_PATH@,,;t t
-s,@TCL_LIBRARY@,$(prefix)/lib/tcl$(VERSION),;t t
-s,@PRIVATE_INCLUDE_DIR@,$(includedir),;t t
-s,@HTML_DIR@,$(DISTDIR)/html,;t t
-s,@PACKAGE_DIR@,/home/jima/space/ins/lin64/dynamic/main/lib,;t t
-s,@EXTRA_CC_SWITCHES@,,;t t
-s,@EXTRA_APP_CC_SWITCHES@,,;t t
-s,@EXTRA_INSTALL@,,;t t
-s,@EXTRA_INSTALL_BINARIES@,@:,;t t
-s,@EXTRA_BUILD_HTML@,@:,;t t
-s,@EXTRA_TCLSH_LIBS@,,;t t
-s,@DLTEST_LD@,${SHLIB_LD},;t t
-s,@DLTEST_SUFFIX@,,;t t
-CEOF
-
- # Split the substitutions into bite-sized pieces for seds with
- # small command number limits, like on Digital OSF/1 and HP-UX.
- ac_max_sed_lines=48
- ac_sed_frag=1 # Number of current file.
- ac_beg=1 # First line for current file.
- ac_end=$ac_max_sed_lines # Line after last line for current file.
- ac_more_lines=:
- ac_sed_cmds=
- while $ac_more_lines; do
- if test $ac_beg -gt 1; then
- sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
- else
- sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
- fi
- if test ! -s $tmp/subs.frag; then
- ac_more_lines=false
- else
- # The purpose of the label and of the branching condition is to
- # speed up the sed processing (if there are no `@' at all, there
- # is no need to browse any of the substitutions).
- # These are the two extra sed commands mentioned above.
- (echo ':t
- /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
- else
- ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
- fi
- ac_sed_frag=`expr $ac_sed_frag + 1`
- ac_beg=$ac_end
- ac_end=`expr $ac_end + $ac_max_sed_lines`
- fi
- done
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds=cat
- fi
-fi # test -n "$CONFIG_FILES"
-
-for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case $ac_file in
- - | *:- | *:-:* ) # input from stdin
- cat >$tmp/stdin
- ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
- *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
- * ) ac_file_in=$ac_file.in ;;
- esac
-
- # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
- ac_dir=`(dirname "$ac_file") 2>/dev/null ||
-$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$ac_file" : 'X\(//\)[^/]' \| \
- X"$ac_file" : 'X\(//\)$' \| \
- X"$ac_file" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$ac_file" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- { if $as_mkdir_p; then
- mkdir -p "$ac_dir"
- else
- as_dir="$ac_dir"
- as_dirs=
- while test ! -d "$as_dir"; do
- as_dirs="$as_dir $as_dirs"
- as_dir=`(dirname "$as_dir") 2>/dev/null ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$as_dir" : 'X\(//\)[^/]' \| \
- X"$as_dir" : 'X\(//\)$' \| \
- X"$as_dir" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$as_dir" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- done
- test ! -n "$as_dirs" || mkdir $as_dirs
- fi || { { echo "$as_me:660: error: cannot create directory \"$ac_dir\"" >&5
-echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
- { (exit 1); exit 1; }; }; }
-
- ac_builddir=.
-
-if test "$ac_dir" != .; then
- ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
- # A "../" for each directory in $ac_dir_suffix.
- ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
-else
- ac_dir_suffix= ac_top_builddir=
-fi
-
-case $srcdir in
- .) # No --srcdir option. We are building in place.
- ac_srcdir=.
- if test -z "$ac_top_builddir"; then
- ac_top_srcdir=.
- else
- ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
- fi ;;
- [\\/]* | ?:[\\/]* ) # Absolute path.
- ac_srcdir=$srcdir$ac_dir_suffix;
- ac_top_srcdir=$srcdir ;;
- *) # Relative path.
- ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_top_builddir$srcdir ;;
-esac
-
-# Do not use `cd foo && pwd` to compute absolute paths, because
-# the directories may not exist.
-case `pwd` in
-.) ac_abs_builddir="$ac_dir";;
-*)
- case "$ac_dir" in
- .) ac_abs_builddir=`pwd`;;
- [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
- *) ac_abs_builddir=`pwd`/"$ac_dir";;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_builddir=${ac_top_builddir}.;;
-*)
- case ${ac_top_builddir}. in
- .) ac_abs_top_builddir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
- *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_srcdir=$ac_srcdir;;
-*)
- case $ac_srcdir in
- .) ac_abs_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
- *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_srcdir=$ac_top_srcdir;;
-*)
- case $ac_top_srcdir in
- .) ac_abs_top_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
- *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
- esac;;
-esac
-
-
-
- if test x"$ac_file" != x-; then
- { echo "$as_me:732: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
- rm -f "$ac_file"
- fi
- # Let's still pretend it is `configure' which instantiates (i.e., don't
- # use $as_me), people would be surprised to read:
- # /* config.h. Generated by config.status. */
- if test x"$ac_file" = x-; then
- configure_input=
- else
- configure_input="$ac_file. "
- fi
- configure_input=$configure_input"Generated from `echo $ac_file_in |
- sed 's,.*/,,'` by configure."
-
- # First look for the input files in the build tree, otherwise in the
- # src tree.
- ac_file_inputs=`IFS=:
- for f in $ac_file_in; do
- case $f in
- -) echo $tmp/stdin ;;
- [\\/$]*)
- # Absolute (can't be DOS-style, as IFS=:)
- test -f "$f" || { { echo "$as_me:755: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
- { (exit 1); exit 1; }; }
- echo "$f";;
- *) # Relative
- if test -f "$f"; then
- # Build tree
- echo "$f"
- elif test -f "$srcdir/$f"; then
- # Source tree
- echo "$srcdir/$f"
- else
- # /dev/null tree
- { { echo "$as_me:768: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
- { (exit 1); exit 1; }; }
- fi;;
- esac
- done` || { (exit 1); exit 1; }
- sed "
-
-:t
-/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
-s,@configure_input@,$configure_input,;t t
-s,@srcdir@,$ac_srcdir,;t t
-s,@abs_srcdir@,$ac_abs_srcdir,;t t
-s,@top_srcdir@,$ac_top_srcdir,;t t
-s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
-s,@builddir@,$ac_builddir,;t t
-s,@abs_builddir@,$ac_abs_builddir,;t t
-s,@top_builddir@,$ac_top_builddir,;t t
-s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
-" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
- rm -f $tmp/stdin
- if test x"$ac_file" != x-; then
- mv $tmp/out $ac_file
- else
- cat $tmp/out
- rm -f $tmp/out
- fi
-
-done
-
-#
-# CONFIG_COMMANDS section.
-#
-for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue
- ac_dest=`echo "$ac_file" | sed 's,:.*,,'`
- ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'`
- ac_dir=`(dirname "$ac_dest") 2>/dev/null ||
-$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$ac_dest" : 'X\(//\)[^/]' \| \
- X"$ac_dest" : 'X\(//\)$' \| \
- X"$ac_dest" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$ac_dest" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- { if $as_mkdir_p; then
- mkdir -p "$ac_dir"
- else
- as_dir="$ac_dir"
- as_dirs=
- while test ! -d "$as_dir"; do
- as_dirs="$as_dir $as_dirs"
- as_dir=`(dirname "$as_dir") 2>/dev/null ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$as_dir" : 'X\(//\)[^/]' \| \
- X"$as_dir" : 'X\(//\)$' \| \
- X"$as_dir" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$as_dir" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- done
- test ! -n "$as_dirs" || mkdir $as_dirs
- fi || { { echo "$as_me:837: error: cannot create directory \"$ac_dir\"" >&5
-echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
- { (exit 1); exit 1; }; }; }
-
- ac_builddir=.
-
-if test "$ac_dir" != .; then
- ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
- # A "../" for each directory in $ac_dir_suffix.
- ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
-else
- ac_dir_suffix= ac_top_builddir=
-fi
-
-case $srcdir in
- .) # No --srcdir option. We are building in place.
- ac_srcdir=.
- if test -z "$ac_top_builddir"; then
- ac_top_srcdir=.
- else
- ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
- fi ;;
- [\\/]* | ?:[\\/]* ) # Absolute path.
- ac_srcdir=$srcdir$ac_dir_suffix;
- ac_top_srcdir=$srcdir ;;
- *) # Relative path.
- ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_top_builddir$srcdir ;;
-esac
-
-# Do not use `cd foo && pwd` to compute absolute paths, because
-# the directories may not exist.
-case `pwd` in
-.) ac_abs_builddir="$ac_dir";;
-*)
- case "$ac_dir" in
- .) ac_abs_builddir=`pwd`;;
- [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
- *) ac_abs_builddir=`pwd`/"$ac_dir";;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_builddir=${ac_top_builddir}.;;
-*)
- case ${ac_top_builddir}. in
- .) ac_abs_top_builddir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
- *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_srcdir=$ac_srcdir;;
-*)
- case $ac_srcdir in
- .) ac_abs_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
- *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_srcdir=$ac_top_srcdir;;
-*)
- case $ac_top_srcdir in
- .) ac_abs_top_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
- *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
- esac;;
-esac
-
-
- { echo "$as_me:907: executing $ac_dest commands" >&5
-echo "$as_me: executing $ac_dest commands" >&6;}
- case $ac_dest in
- Tcl.framework ) n=Tcl &&
- f=$n.framework && v=Versions/$VERSION &&
- rm -rf $f && mkdir -p $f/$v/Resources &&
- ln -s $v/$n $v/Resources $f && ln -s ../../../$n $f/$v &&
- ln -s ../../../../$n-Info.plist $f/$v/Resources/Info.plist &&
- unset n f v
- ;;
- esac
-done
-
-{ (exit 0); exit 0; }
diff --git a/unix/configure b/unix/configure
index bf00034..e83f47d 100755
--- a/unix/configure
+++ b/unix/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for tcl 8.7.
+# Generated by GNU Autoconf 2.69 for tcl 9.0.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -577,8 +577,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='tcl'
PACKAGE_TARNAME='tcl'
-PACKAGE_VERSION='8.7'
-PACKAGE_STRING='tcl 8.7'
+PACKAGE_VERSION='9.0'
+PACKAGE_STRING='tcl 9.0'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@@ -1330,7 +1330,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures tcl 8.7 to adapt to many kinds of systems.
+\`configure' configures tcl 9.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1391,7 +1391,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of tcl 8.7:";;
+ short | recursive ) echo "Configuration of tcl 9.0:";;
esac
cat <<\_ACEOF
@@ -1505,7 +1505,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-tcl configure 8.7
+tcl configure 9.0
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2027,7 +2027,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by tcl $as_me 8.7, which was
+It was created by tcl $as_me 9.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2379,10 +2379,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
-TCL_VERSION=8.7
-TCL_MAJOR_VERSION=8
-TCL_MINOR_VERSION=7
-TCL_PATCH_LEVEL="a2"
+TCL_VERSION=9.0
+TCL_MAJOR_VERSION=9
+TCL_MINOR_VERSION=0
+TCL_PATCH_LEVEL="a0"
VERSION=${TCL_VERSION}
EXTRA_INSTALL_BINARIES=${EXTRA_INSTALL_BINARIES:-"@:"}
@@ -10957,7 +10957,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by tcl $as_me 8.7, which was
+This file was extended by tcl $as_me 9.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -11014,7 +11014,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-tcl config.status 8.7
+tcl config.status 9.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/unix/configure.ac b/unix/configure.ac
index ea4526c..c41cf73 100644
--- a/unix/configure.ac
+++ b/unix/configure.ac
@@ -3,7 +3,7 @@ dnl This file is an input file used by the GNU "autoconf" program to
dnl generate the file "configure", which is run during Tcl installation
dnl to configure the system for the local environment.
-AC_INIT([tcl],[8.7])
+AC_INIT([tcl],[9.0])
AC_PREREQ(2.69)
dnl This is only used when included from macosx/configure.ac
@@ -22,10 +22,10 @@ m4_ifdef([SC_USE_CONFIG_HEADERS], [
#endif /* _TCLCONFIG */])
])
-TCL_VERSION=8.7
-TCL_MAJOR_VERSION=8
-TCL_MINOR_VERSION=7
-TCL_PATCH_LEVEL="a2"
+TCL_VERSION=9.0
+TCL_MAJOR_VERSION=9
+TCL_MINOR_VERSION=0
+TCL_PATCH_LEVEL="a0"
VERSION=${TCL_VERSION}
EXTRA_INSTALL_BINARIES=${EXTRA_INSTALL_BINARIES:-"@:"}
diff --git a/unix/tcl.m4 b/unix/tcl.m4
index 70303ce..7b62044 100644
--- a/unix/tcl.m4
+++ b/unix/tcl.m4
@@ -96,8 +96,8 @@ AC_DEFUN([SC_PATH_TCLCONFIG], [
`ls -d /usr/pkg/lib 2>/dev/null` \
`ls -d /usr/lib 2>/dev/null` \
`ls -d /usr/lib64 2>/dev/null` \
- `ls -d /usr/local/lib/tcl8.7 2>/dev/null` \
- `ls -d /usr/local/lib/tcl/tcl8.7 2>/dev/null` \
+ `ls -d /usr/local/lib/tcl9.0 2>/dev/null` \
+ `ls -d /usr/local/lib/tcl/tcl9.0 2>/dev/null` \
; do
if test -f "$i/tclConfig.sh" ; then
ac_cv_c_tclconfig="`(cd $i; pwd)`"
@@ -229,8 +229,8 @@ AC_DEFUN([SC_PATH_TKCONFIG], [
`ls -d /usr/pkg/lib 2>/dev/null` \
`ls -d /usr/lib 2>/dev/null` \
`ls -d /usr/lib64 2>/dev/null` \
- `ls -d /usr/local/lib/tk8.7 2>/dev/null` \
- `ls -d /usr/local/lib/tcl/tk8.7 2>/dev/null` \
+ `ls -d /usr/local/lib/tk9.0 2>/dev/null` \
+ `ls -d /usr/local/lib/tcl/tk9.0 2>/dev/null` \
; do
if test -f "$i/tkConfig.sh" ; then
ac_cv_c_tkconfig="`(cd $i; pwd)`"
diff --git a/unix/tcl.spec b/unix/tcl.spec
index 265e4df..0858ee7 100644
--- a/unix/tcl.spec
+++ b/unix/tcl.spec
@@ -4,7 +4,7 @@
Name: tcl
Summary: Tcl scripting language development environment
-Version: 8.7a2
+Version: 9.0a0
Release: 2
License: BSD
Group: Development/Languages
diff --git a/unix/tclEpollNotfy.c b/unix/tclEpollNotfy.c
index 4961ef5..4d75781 100644
--- a/unix/tclEpollNotfy.c
+++ b/unix/tclEpollNotfy.c
@@ -238,7 +238,7 @@ PlatformEventsControl(
newEvent.events |= EPOLLOUT;
}
if (isNew) {
- newPedPtr = ckalloc(sizeof(*newPedPtr));
+ newPedPtr = Tcl_Alloc(sizeof(*newPedPtr));
newPedPtr->filePtr = filePtr;
newPedPtr->tsdPtr = tsdPtr;
filePtr->pedPtr = newPedPtr;
@@ -318,14 +318,14 @@ PlatformEventsFinalize(
tsdPtr->triggerPipe[1] = -1;
}
#endif /* HAVE_EVENTFD */
- ckfree(tsdPtr->triggerFilePtr->pedPtr);
- ckfree(tsdPtr->triggerFilePtr);
+ Tcl_Free(tsdPtr->triggerFilePtr->pedPtr);
+ Tcl_Free(tsdPtr->triggerFilePtr);
if (tsdPtr->eventsFd > 0) {
close(tsdPtr->eventsFd);
tsdPtr->eventsFd = 0;
}
if (tsdPtr->readyEvents) {
- ckfree(tsdPtr->readyEvents);
+ Tcl_Free(tsdPtr->readyEvents);
tsdPtr->maxReadyEvents = 0;
}
pthread_mutex_unlock(&tsdPtr->notifierMutex);
@@ -370,7 +370,7 @@ PlatformEventsInit(void)
if (errno) {
Tcl_Panic("Tcl_InitNotifier: %s", "could not create mutex");
}
- filePtr = ckalloc(sizeof(*filePtr));
+ filePtr = Tcl_Alloc(sizeof(*filePtr));
#ifdef HAVE_EVENTFD
tsdPtr->triggerEventFd = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK);
if (tsdPtr->triggerEventFd <= 0) {
@@ -391,7 +391,7 @@ PlatformEventsInit(void)
PlatformEventsControl(filePtr, tsdPtr, EPOLL_CTL_ADD, 1);
if (!tsdPtr->readyEvents) {
tsdPtr->maxReadyEvents = 512;
- tsdPtr->readyEvents = ckalloc(
+ tsdPtr->readyEvents = Tcl_Alloc(
tsdPtr->maxReadyEvents * sizeof(tsdPtr->readyEvents[0]));
}
LIST_INIT(&tsdPtr->firstReadyFileHandlerPtr);
@@ -550,7 +550,7 @@ Tcl_CreateFileHandler(
}
}
if (filePtr == NULL) {
- filePtr = ckalloc(sizeof(FileHandler));
+ filePtr = Tcl_Alloc(sizeof(FileHandler));
filePtr->fd = fd;
filePtr->readyMask = 0;
filePtr->nextPtr = tsdPtr->firstFileHandlerPtr;
@@ -620,7 +620,7 @@ Tcl_DeleteFileHandler(
PlatformEventsControl(filePtr, tsdPtr, EPOLL_CTL_DEL, 0);
if (filePtr->pedPtr) {
- ckfree(filePtr->pedPtr);
+ Tcl_Free(filePtr->pedPtr);
}
/*
@@ -632,7 +632,7 @@ Tcl_DeleteFileHandler(
} else {
prevPtr->nextPtr = filePtr->nextPtr;
}
- ckfree(filePtr);
+ Tcl_Free(filePtr);
}
}
@@ -734,7 +734,7 @@ Tcl_WaitForEvent(
if (filePtr->readyMask == 0) {
FileHandlerEvent *fileEvPtr =
- ckalloc(sizeof(FileHandlerEvent));
+ Tcl_Alloc(sizeof(FileHandlerEvent));
fileEvPtr->header.proc = FileHandlerEventProc;
fileEvPtr->fd = filePtr->fd;
@@ -811,7 +811,7 @@ Tcl_WaitForEvent(
if (filePtr->readyMask == 0) {
FileHandlerEvent *fileEvPtr =
- ckalloc(sizeof(FileHandlerEvent));
+ Tcl_Alloc(sizeof(FileHandlerEvent));
fileEvPtr->header.proc = FileHandlerEventProc;
fileEvPtr->fd = filePtr->fd;
diff --git a/unix/tclKqueueNotfy.c b/unix/tclKqueueNotfy.c
index 99d794e..bbb8061 100644
--- a/unix/tclKqueueNotfy.c
+++ b/unix/tclKqueueNotfy.c
@@ -222,7 +222,7 @@ PlatformEventsControl(
struct stat fdStat;
if (isNew) {
- newPedPtr = ckalloc(sizeof(*newPedPtr));
+ newPedPtr = Tcl_Alloc(sizeof(*newPedPtr));
newPedPtr->filePtr = filePtr;
newPedPtr->tsdPtr = tsdPtr;
filePtr->pedPtr = newPedPtr;
@@ -344,7 +344,7 @@ PlatformEventsFinalize(
tsdPtr->eventsFd = 0;
}
if (tsdPtr->readyEvents) {
- ckfree(tsdPtr->readyEvents);
+ Tcl_Free(tsdPtr->readyEvents);
tsdPtr->maxReadyEvents = 0;
}
pthread_mutex_unlock(&tsdPtr->notifierMutex);
@@ -409,13 +409,13 @@ PlatformEventsInit(void)
} else if (fcntl(tsdPtr->eventsFd, F_SETFD, FD_CLOEXEC) == -1) {
Tcl_Panic("fcntl: %s", strerror(errno));
}
- filePtr = ckalloc(sizeof(*filePtr));
+ filePtr = Tcl_Alloc(sizeof(*filePtr));
filePtr->fd = tsdPtr->triggerPipe[0];
filePtr->mask = TCL_READABLE;
PlatformEventsControl(filePtr, tsdPtr, EV_ADD, 1);
if (!tsdPtr->readyEvents) {
tsdPtr->maxReadyEvents = 512;
- tsdPtr->readyEvents = ckalloc(
+ tsdPtr->readyEvents = Tcl_Alloc(
tsdPtr->maxReadyEvents * sizeof(tsdPtr->readyEvents[0]));
}
LIST_INIT(&tsdPtr->firstReadyFileHandlerPtr);
@@ -580,7 +580,7 @@ Tcl_CreateFileHandler(
}
}
if (filePtr == NULL) {
- filePtr = ckalloc(sizeof(FileHandler));
+ filePtr = Tcl_Alloc(sizeof(FileHandler));
filePtr->fd = fd;
filePtr->readyMask = 0;
filePtr->nextPtr = tsdPtr->firstFileHandlerPtr;
@@ -649,7 +649,7 @@ Tcl_DeleteFileHandler(
PlatformEventsControl(filePtr, tsdPtr, EV_DELETE, 0);
if (filePtr->pedPtr) {
- ckfree(filePtr->pedPtr);
+ Tcl_Free(filePtr->pedPtr);
}
/*
@@ -661,7 +661,7 @@ Tcl_DeleteFileHandler(
} else {
prevPtr->nextPtr = filePtr->nextPtr;
}
- ckfree(filePtr);
+ Tcl_Free(filePtr);
}
}
@@ -769,7 +769,7 @@ Tcl_WaitForEvent(
if (filePtr->readyMask == 0) {
FileHandlerEvent *fileEvPtr =
- ckalloc(sizeof(FileHandlerEvent));
+ Tcl_Alloc(sizeof(FileHandlerEvent));
fileEvPtr->header.proc = FileHandlerEventProc;
fileEvPtr->fd = filePtr->fd;
@@ -829,7 +829,7 @@ Tcl_WaitForEvent(
if (filePtr->readyMask == 0) {
FileHandlerEvent *fileEvPtr =
- ckalloc(sizeof(FileHandlerEvent));
+ Tcl_Alloc(sizeof(FileHandlerEvent));
fileEvPtr->header.proc = FileHandlerEventProc;
fileEvPtr->fd = filePtr->fd;
diff --git a/unix/tclLoadDl.c b/unix/tclLoadDl.c
index aec071c..8a801c9 100644
--- a/unix/tclLoadDl.c
+++ b/unix/tclLoadDl.c
@@ -106,7 +106,7 @@ TclpDlopen(
*/
Tcl_DString ds;
- const char *fileName = Tcl_GetString(pathPtr);
+ const char *fileName = TclGetString(pathPtr);
native = Tcl_UtfToExternalDString(NULL, fileName, -1, &ds);
/*
@@ -127,11 +127,11 @@ TclpDlopen(
if (interp) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"couldn't load file \"%s\": %s",
- Tcl_GetString(pathPtr), errorStr));
+ TclGetString(pathPtr), errorStr));
}
return TCL_ERROR;
}
- newHandle = ckalloc(sizeof(*newHandle));
+ newHandle = Tcl_Alloc(sizeof(*newHandle));
newHandle->clientData = handle;
newHandle->findSymbolProcPtr = &FindSymbol;
newHandle->unloadFileProcPtr = &UnloadFile;
@@ -232,7 +232,7 @@ UnloadFile(
void *handle = loadHandle->clientData;
dlclose(handle);
- ckfree(loadHandle);
+ Tcl_Free(loadHandle);
}
/*
diff --git a/unix/tclLoadDyld.c b/unix/tclLoadDyld.c
index e998bf9..af24841 100644
--- a/unix/tclLoadDyld.c
+++ b/unix/tclLoadDyld.c
@@ -184,7 +184,7 @@ TclpDlopen(
*/
nativePath = Tcl_FSGetNativePath(pathPtr);
- nativeFileName = Tcl_UtfToExternalDString(NULL, Tcl_GetString(pathPtr),
+ nativeFileName = Tcl_UtfToExternalDString(NULL, TclGetString(pathPtr),
-1, &ds);
#if TCL_DYLD_USE_DLFCN
@@ -258,7 +258,7 @@ TclpDlopen(
module = NSLinkModule(dyldObjFileImage, nativePath, nsflags);
NSDestroyObjectFileImage(dyldObjFileImage);
if (module) {
- modulePtr = ckalloc(sizeof(Tcl_DyldModuleHandle));
+ modulePtr = Tcl_Alloc(sizeof(Tcl_DyldModuleHandle));
modulePtr->module = module;
modulePtr->nextPtr = NULL;
} else {
@@ -278,13 +278,13 @@ TclpDlopen(
|| dyldLibHeader || modulePtr
#endif /* TCL_DYLD_USE_NSMODULE */
) {
- dyldLoadHandle = ckalloc(sizeof(Tcl_DyldLoadHandle));
+ dyldLoadHandle = Tcl_Alloc(sizeof(Tcl_DyldLoadHandle));
dyldLoadHandle->dlHandle = dlHandle;
#if TCL_DYLD_USE_NSMODULE || defined(TCL_LOAD_FROM_MEMORY)
dyldLoadHandle->dyldLibHeader = dyldLibHeader;
dyldLoadHandle->modulePtr = modulePtr;
#endif /* TCL_DYLD_USE_NSMODULE || TCL_LOAD_FROM_MEMORY */
- newHandle = ckalloc(sizeof(*newHandle));
+ newHandle = Tcl_Alloc(sizeof(*newHandle));
newHandle->clientData = dyldLoadHandle;
newHandle->findSymbolProcPtr = &FindSymbol;
newHandle->unloadFileProcPtr = &UnloadFile;
@@ -381,7 +381,7 @@ FindSymbol(
modulePtr = modulePtr->nextPtr;
}
if (modulePtr == NULL) {
- modulePtr = ckalloc(sizeof(Tcl_DyldModuleHandle));
+ modulePtr = Tcl_Alloc(sizeof(Tcl_DyldModuleHandle));
modulePtr->module = module;
modulePtr->nextPtr = dyldLoadHandle->modulePtr;
dyldLoadHandle->modulePtr = modulePtr;
@@ -456,12 +456,12 @@ UnloadFile(
(void) NSUnLinkModule(modulePtr->module,
NSUNLINKMODULE_OPTION_RESET_LAZY_REFERENCES);
modulePtr = modulePtr->nextPtr;
- ckfree(ptr);
+ Tcl_Free(ptr);
}
#endif /* TCL_DYLD_USE_NSMODULE */
}
- ckfree(dyldLoadHandle);
- ckfree(loadHandle);
+ Tcl_Free(dyldLoadHandle);
+ Tcl_Free(loadHandle);
}
/*
@@ -693,14 +693,14 @@ TclpLoadMemory(
* Stash the module reference within the load handle we create and return.
*/
- modulePtr = ckalloc(sizeof(Tcl_DyldModuleHandle));
+ modulePtr = Tcl_Alloc(sizeof(Tcl_DyldModuleHandle));
modulePtr->module = module;
modulePtr->nextPtr = NULL;
- dyldLoadHandle = ckalloc(sizeof(Tcl_DyldLoadHandle));
+ dyldLoadHandle = Tcl_Alloc(sizeof(Tcl_DyldLoadHandle));
dyldLoadHandle->dlHandle = NULL;
dyldLoadHandle->dyldLibHeader = NULL;
dyldLoadHandle->modulePtr = modulePtr;
- newHandle = ckalloc(sizeof(*newHandle));
+ newHandle = Tcl_Alloc(sizeof(*newHandle));
newHandle->clientData = dyldLoadHandle;
newHandle->findSymbolProcPtr = &FindSymbol;
newHandle->unloadFileProcPtr = &UnloadFile;
diff --git a/unix/tclLoadNext.c b/unix/tclLoadNext.c
index eb0affa..393bfc5 100644
--- a/unix/tclLoadNext.c
+++ b/unix/tclLoadNext.c
@@ -61,7 +61,7 @@ TclpDlopen(
NXStream *errorStream = NXOpenMemory(0,0,NX_READWRITE);
- fileName = Tcl_GetString(pathPtr);
+ fileName = TclGetString(pathPtr);
/*
* First try the full path the user gave us. This is particularly
@@ -101,7 +101,7 @@ TclpDlopen(
}
NXCloseMemory(errorStream, NX_FREEBUFFER);
- newHandle = ckalloc(sizeof(Tcl_LoadHandle));
+ newHandle = Tcl_Alloc(sizeof(Tcl_LoadHandle));
newHandle->clientData = INT2PTR(1);
newHandle->findSymbolProcPtr = &FindSymbol;
newHandle->unloadFileProcPtr = &UnloadFile;
@@ -175,7 +175,7 @@ UnloadFile(
* TclpDlopen(). The loadHandle is a token
* that represents the loaded file. */
{
- ckfree(loadHandle);
+ Tcl_Free(loadHandle);
}
/*
diff --git a/unix/tclLoadOSF.c b/unix/tclLoadOSF.c
index 377ed28..f67725f 100644
--- a/unix/tclLoadOSF.c
+++ b/unix/tclLoadOSF.c
@@ -79,7 +79,7 @@ TclpDlopen(
Tcl_LoadHandle newHandle;
ldr_module_t lm;
char *pkg;
- char *fileName = Tcl_GetString(pathPtr);
+ char *fileName = TclGetString(pathPtr);
const char *native;
/*
@@ -128,7 +128,7 @@ TclpDlopen(
} else {
pkg++;
}
- newHandle = ckalloc(sizeof(*newHandle));
+ newHandle = Tcl_Alloc(sizeof(*newHandle));
newHandle->clientData = pkg;
newHandle->findSymbolProcPtr = &FindSymbol;
newHandle->unloadFileProcPtr = &UnloadFile;
@@ -193,7 +193,7 @@ UnloadFile(
* TclpDlopen(). The loadHandle is a token
* that represents the loaded file. */
{
- ckfree(loadHandle);
+ Tcl_Free(loadHandle);
}
/*
diff --git a/unix/tclLoadShl.c b/unix/tclLoadShl.c
index 4be3d7b..fc5f27c 100644
--- a/unix/tclLoadShl.c
+++ b/unix/tclLoadShl.c
@@ -57,7 +57,7 @@ TclpDlopen(
shl_t handle;
Tcl_LoadHandle newHandle;
const char *native;
- char *fileName = Tcl_GetString(pathPtr);
+ char *fileName = TclGetString(pathPtr);
/*
* The flags below used to be BIND_IMMEDIATE; they were changed at the
@@ -97,7 +97,7 @@ TclpDlopen(
fileName, Tcl_PosixError(interp)));
return TCL_ERROR;
}
- newHandle = ckalloc(sizeof(*newHandle));
+ newHandle = Tcl_Alloc(sizeof(*newHandle));
newHandle->clientData = handle;
newHandle->findSymbolProcPtr = &FindSymbol;
newHandle->unloadFileProcPtr = *unloadProcPtr = &UnloadFile;
@@ -182,7 +182,7 @@ UnloadFile(
shl_t handle = (shl_t) loadHandle->clientData;
shl_unload(handle);
- ckfree(loadHandle);
+ Tcl_Free(loadHandle);
}
/*
diff --git a/unix/tclSelectNotfy.c b/unix/tclSelectNotfy.c
index a0dea57..f77379b 100644
--- a/unix/tclSelectNotfy.c
+++ b/unix/tclSelectNotfy.c
@@ -464,7 +464,7 @@ Tcl_CreateFileHandler(
}
}
if (filePtr == NULL) {
- filePtr = ckalloc(sizeof(FileHandler));
+ filePtr = Tcl_Alloc(sizeof(FileHandler));
filePtr->fd = fd;
filePtr->readyMask = 0;
filePtr->nextPtr = tsdPtr->firstFileHandlerPtr;
@@ -583,7 +583,7 @@ Tcl_DeleteFileHandler(
} else {
prevPtr->nextPtr = filePtr->nextPtr;
}
- ckfree(filePtr);
+ Tcl_Free(filePtr);
}
}
@@ -877,7 +877,7 @@ Tcl_WaitForEvent(
if (filePtr->readyMask == 0) {
FileHandlerEvent *fileEvPtr =
- ckalloc(sizeof(FileHandlerEvent));
+ Tcl_Alloc(sizeof(FileHandlerEvent));
fileEvPtr->header.proc = FileHandlerEventProc;
fileEvPtr->fd = filePtr->fd;
diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c
index be49c95..c1b9f01 100644
--- a/unix/tclUnixChan.c
+++ b/unix/tclUnixChan.c
@@ -277,7 +277,7 @@ FileInputProc(
* nonblocking, the read will never block.
*/
- bytesRead = read(fsPtr->fd, buf, (size_t) toRead);
+ bytesRead = read(fsPtr->fd, buf, toRead);
if (bytesRead > -1) {
return bytesRead;
}
@@ -324,7 +324,7 @@ FileOutputProc(
return 0;
}
- written = write(fsPtr->fd, buf, (size_t) toWrite);
+ written = write(fsPtr->fd, buf, toWrite);
if (written > -1) {
return written;
}
@@ -370,7 +370,7 @@ FileCloseProc(
errorCode = errno;
}
}
- ckfree(fsPtr);
+ Tcl_Free(fsPtr);
return errorCode;
}
@@ -645,7 +645,7 @@ TtySetOptionProc(
const char *value) /* New value for option. */
{
TtyState *fsPtr = instanceData;
- unsigned int len, vlen;
+ size_t len, vlen;
TtyAttrs tty;
int argc;
const char **argv;
@@ -730,7 +730,7 @@ TtySetOptionProc(
" two elements with each a single 8-bit character", -1));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "XCHAR", NULL);
}
- ckfree(argv);
+ Tcl_Free(argv);
return TCL_ERROR;
}
@@ -753,7 +753,7 @@ TtySetOptionProc(
}
iostate.c_cc[VSTOP] = character;
}
- ckfree(argv);
+ Tcl_Free(argv);
tcsetattr(fsPtr->fileState.fd, TCSADRAIN, &iostate);
return TCL_OK;
@@ -795,14 +795,14 @@ TtySetOptionProc(
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "FCONFIGURE",
"VALUE", NULL);
}
- ckfree(argv);
+ Tcl_Free(argv);
return TCL_ERROR;
}
ioctl(fsPtr->fileState.fd, TIOCMGET, &control);
for (i = 0; i < argc-1; i += 2) {
if (Tcl_GetBoolean(interp, argv[i+1], &flag) == TCL_ERROR) {
- ckfree(argv);
+ Tcl_Free(argv);
return TCL_ERROR;
}
if (Tcl_UtfNcasecmp(argv[i], "DTR", strlen(argv[i])) == 0) {
@@ -826,7 +826,7 @@ TtySetOptionProc(
}
#else /* TIOCSBRK & TIOCCBRK */
UNSUPPORTED_OPTION("-ttycontrol BREAK");
- ckfree(argv);
+ Tcl_Free(argv);
return TCL_ERROR;
#endif /* TIOCSBRK & TIOCCBRK */
} else {
@@ -837,13 +837,13 @@ TtySetOptionProc(
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "FCONFIGURE",
"VALUE", NULL);
}
- ckfree(argv);
+ Tcl_Free(argv);
return TCL_ERROR;
}
} /* -ttycontrol options loop */
ioctl(fsPtr->fileState.fd, TIOCMSET, &control);
- ckfree(argv);
+ Tcl_Free(argv);
return TCL_OK;
#else /* TIOCMGET&TIOCMSET */
UNSUPPORTED_OPTION("-ttycontrol");
@@ -984,7 +984,7 @@ TtyGetOptionProc(
Tcl_DString *dsPtr) /* Where to store value(s). */
{
TtyState *fsPtr = instanceData;
- unsigned int len;
+ size_t len;
char buf[3*TCL_INTEGER_SPACE + 16];
int valid = 0; /* Flag if valid option parsed. */
struct termios iostate;
@@ -1712,7 +1712,7 @@ TclpOpenFileChannel(
sprintf(channelName, "file%d", fd);
}
- fsPtr = ckalloc(sizeof(TtyState));
+ fsPtr = Tcl_Alloc(sizeof(TtyState));
fsPtr->fileState.validMask = channelPermissions | TCL_EXCEPTION;
fsPtr->fileState.fd = fd;
#ifdef SUPPORTS_TTY
@@ -1771,32 +1771,37 @@ Tcl_MakeFileChannel(
char channelName[16 + TCL_INTEGER_SPACE];
int fd = PTR2INT(handle);
const Tcl_ChannelType *channelTypePtr;
- struct sockaddr sockaddr;
- socklen_t sockaddrLen = sizeof(sockaddr);
+ struct stat buf;
if (mode == 0) {
return NULL;
}
- sockaddr.sa_family = AF_UNSPEC;
-
#ifdef SUPPORTS_TTY
if (isatty(fd)) {
channelTypePtr = &ttyChannelType;
sprintf(channelName, "serial%d", fd);
} else
#endif /* SUPPORTS_TTY */
- if ((getsockname(fd, (struct sockaddr *) &sockaddr, &sockaddrLen) == 0)
- && (sockaddrLen > 0)
- && (sockaddr.sa_family == AF_INET
- || sockaddr.sa_family == AF_INET6)) {
- return TclpMakeTcpClientChannelMode(INT2PTR(fd), mode);
+ if (fstat(fd, &buf) == 0 && S_ISSOCK(buf.st_mode)) {
+ struct sockaddr sockaddr;
+ socklen_t sockaddrLen = sizeof(sockaddr);
+
+ sockaddr.sa_family = AF_UNSPEC;
+ if ((getsockname(fd, (struct sockaddr *)&sockaddr, &sockaddrLen) == 0)
+ && (sockaddrLen > 0)
+ && (sockaddr.sa_family == AF_INET
+ || sockaddr.sa_family == AF_INET6)) {
+ return TclpMakeTcpClientChannelMode(INT2PTR(fd), mode);
+ }
+ goto normalChannelAfterAll;
} else {
+ normalChannelAfterAll:
channelTypePtr = &fileChannelType;
sprintf(channelName, "file%d", fd);
}
- fsPtr = ckalloc(sizeof(TtyState));
+ fsPtr = Tcl_Alloc(sizeof(TtyState));
fsPtr->fileState.fd = fd;
fsPtr->fileState.validMask = mode | TCL_EXCEPTION;
fsPtr->fileState.channel = Tcl_CreateChannel(channelTypePtr, channelName,
diff --git a/unix/tclUnixCompat.c b/unix/tclUnixCompat.c
index e0a826c..9b8acc9 100644
--- a/unix/tclUnixCompat.c
+++ b/unix/tclUnixCompat.c
@@ -8,8 +8,6 @@
*/
#include "tclInt.h"
-#include <pwd.h>
-#include <grp.h>
#include <errno.h>
#include <string.h>
@@ -201,7 +199,7 @@ TclpGetPwNam(
if (tsdPtr->pbuflen < 1) {
tsdPtr->pbuflen = 1024;
}
- tsdPtr->pbuf = ckalloc(tsdPtr->pbuflen);
+ tsdPtr->pbuf = Tcl_Alloc(tsdPtr->pbuflen);
Tcl_CreateThreadExitHandler(FreePwBuf, NULL);
}
while (1) {
@@ -214,7 +212,7 @@ TclpGetPwNam(
return NULL;
}
tsdPtr->pbuflen *= 2;
- tsdPtr->pbuf = ckrealloc(tsdPtr->pbuf, tsdPtr->pbuflen);
+ tsdPtr->pbuf = Tcl_Realloc(tsdPtr->pbuf, tsdPtr->pbuflen);
}
return (pwPtr != NULL ? &tsdPtr->pwd : NULL);
@@ -281,7 +279,7 @@ TclpGetPwUid(
if (tsdPtr->pbuflen < 1) {
tsdPtr->pbuflen = 1024;
}
- tsdPtr->pbuf = ckalloc(tsdPtr->pbuflen);
+ tsdPtr->pbuf = Tcl_Alloc(tsdPtr->pbuflen);
Tcl_CreateThreadExitHandler(FreePwBuf, NULL);
}
while (1) {
@@ -294,7 +292,7 @@ TclpGetPwUid(
return NULL;
}
tsdPtr->pbuflen *= 2;
- tsdPtr->pbuf = ckrealloc(tsdPtr->pbuf, tsdPtr->pbuflen);
+ tsdPtr->pbuf = Tcl_Realloc(tsdPtr->pbuf, tsdPtr->pbuflen);
}
return (pwPtr != NULL ? &tsdPtr->pwd : NULL);
@@ -340,7 +338,7 @@ FreePwBuf(
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
- ckfree(tsdPtr->pbuf);
+ Tcl_Free(tsdPtr->pbuf);
}
#endif /* NEED_PW_CLEANER */
@@ -384,7 +382,7 @@ TclpGetGrNam(
if (tsdPtr->gbuflen < 1) {
tsdPtr->gbuflen = 1024;
}
- tsdPtr->gbuf = ckalloc(tsdPtr->gbuflen);
+ tsdPtr->gbuf = Tcl_Alloc(tsdPtr->gbuflen);
Tcl_CreateThreadExitHandler(FreeGrBuf, NULL);
}
while (1) {
@@ -397,7 +395,7 @@ TclpGetGrNam(
return NULL;
}
tsdPtr->gbuflen *= 2;
- tsdPtr->gbuf = ckrealloc(tsdPtr->gbuf, tsdPtr->gbuflen);
+ tsdPtr->gbuf = Tcl_Realloc(tsdPtr->gbuf, tsdPtr->gbuflen);
}
return (grPtr != NULL ? &tsdPtr->grp : NULL);
@@ -464,7 +462,7 @@ TclpGetGrGid(
if (tsdPtr->gbuflen < 1) {
tsdPtr->gbuflen = 1024;
}
- tsdPtr->gbuf = ckalloc(tsdPtr->gbuflen);
+ tsdPtr->gbuf = Tcl_Alloc(tsdPtr->gbuflen);
Tcl_CreateThreadExitHandler(FreeGrBuf, NULL);
}
while (1) {
@@ -477,7 +475,7 @@ TclpGetGrGid(
return NULL;
}
tsdPtr->gbuflen *= 2;
- tsdPtr->gbuf = ckrealloc(tsdPtr->gbuf, tsdPtr->gbuflen);
+ tsdPtr->gbuf = Tcl_Realloc(tsdPtr->gbuf, tsdPtr->gbuflen);
}
return (grPtr != NULL ? &tsdPtr->grp : NULL);
@@ -523,7 +521,7 @@ FreeGrBuf(
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
- ckfree(tsdPtr->gbuf);
+ Tcl_Free(tsdPtr->gbuf);
}
#endif /* NEED_GR_CLEANER */
diff --git a/unix/tclUnixFCmd.c b/unix/tclUnixFCmd.c
index b214627..db49024 100644
--- a/unix/tclUnixFCmd.c
+++ b/unix/tclUnixFCmd.c
@@ -41,8 +41,6 @@
*/
#include "tclInt.h"
-#include <utime.h>
-#include <grp.h>
#ifndef HAVE_STRUCT_STAT_ST_BLKSIZE
#ifndef NO_FSTATFS
#include <sys/statfs.h>
@@ -554,7 +552,7 @@ TclUnixCopyFile(
int dontCopyAtts) /* If flag set, don't copy attributes. */
{
int srcFd, dstFd;
- unsigned blockSize; /* Optimal I/O blocksize for filesystem */
+ size_t blockSize; /* Optimal I/O blocksize for filesystem */
char *buffer; /* Data buffer for copy */
size_t nread;
@@ -610,21 +608,21 @@ TclUnixCopyFile(
if (blockSize <= 0) {
blockSize = DEFAULT_COPY_BLOCK_SIZE;
}
- buffer = ckalloc(blockSize);
+ buffer = Tcl_Alloc(blockSize);
while (1) {
- nread = (size_t) read(srcFd, buffer, blockSize);
- if ((nread == (size_t) -1) || (nread == 0)) {
+ nread = read(srcFd, buffer, blockSize);
+ if ((nread == TCL_IO_FAILURE) || (nread == 0)) {
break;
}
if ((size_t) write(dstFd, buffer, nread) != nread) {
- nread = (size_t) -1;
+ nread = TCL_IO_FAILURE;
break;
}
}
- ckfree(buffer);
+ Tcl_Free(buffer);
close(srcFd);
- if ((close(dstFd) != 0) || (nread == (size_t) -1)) {
+ if ((close(dstFd) != 0) || (nread == TCL_IO_FAILURE)) {
unlink(dst); /* INTL: Native. */
return TCL_ERROR;
}
@@ -960,8 +958,8 @@ TraverseUnixTree(
{
Tcl_StatBuf statBuf;
const char *source, *errfile;
- int result, sourceLen;
- int targetLen;
+ int result;
+ size_t targetLen, sourceLen;
#ifndef HAVE_FTS
int numProcessed = 0;
Tcl_DirEntry *dirEntPtr;
@@ -1507,10 +1505,11 @@ SetGroupAttribute(
Tcl_DString ds;
struct group *groupPtr = NULL;
const char *string;
+ size_t length;
- string = TclGetString(attributePtr);
+ string = TclGetStringFromObj(attributePtr, &length);
- native = Tcl_UtfToExternalDString(NULL, string, attributePtr->length, &ds);
+ native = Tcl_UtfToExternalDString(NULL, string, length, &ds);
groupPtr = TclpGetGrNam(native); /* INTL: Native. */
Tcl_DStringFree(&ds);
@@ -1573,10 +1572,11 @@ SetOwnerAttribute(
Tcl_DString ds;
struct passwd *pwPtr = NULL;
const char *string;
+ size_t length;
- string = TclGetString(attributePtr);
+ string = TclGetStringFromObj(attributePtr, &length);
- native = Tcl_UtfToExternalDString(NULL, string, attributePtr->length, &ds);
+ native = Tcl_UtfToExternalDString(NULL, string, length, &ds);
pwPtr = TclpGetPwNam(native); /* INTL: Native. */
Tcl_DStringFree(&ds);
@@ -1945,8 +1945,8 @@ TclpObjNormalizePath(
{
const char *currentPathEndPosition;
char cur;
- const char *path = TclGetString(pathPtr);
- size_t pathLen = pathPtr->length;
+ size_t pathLen;
+ const char *path = TclGetStringFromObj(pathPtr, &pathLen);
Tcl_DString ds;
const char *nativePath;
#ifndef NO_REALPATH
@@ -2054,7 +2054,7 @@ TclpObjNormalizePath(
nativePath = Tcl_UtfToExternalDString(NULL, path,nextCheckpoint, &ds);
if (Realpath(nativePath, normPath) != NULL) {
- int newNormLen;
+ size_t newNormLen;
wholeStringOk:
newNormLen = strlen(normPath);
@@ -2088,7 +2088,7 @@ TclpObjNormalizePath(
*/
Tcl_DStringFree(&ds);
- Tcl_ExternalToUtfDString(NULL, normPath, (int) newNormLen, &ds);
+ Tcl_ExternalToUtfDString(NULL, normPath, newNormLen, &ds);
if (path[nextCheckpoint] != '\0') {
/*
@@ -2176,14 +2176,15 @@ TclUnixOpenTemporaryFile(
Tcl_DString template, tmp;
const char *string;
int fd;
+ size_t length;
/*
* We should also check against making more then TMP_MAX of these.
*/
if (dirObj) {
- string = TclGetString(dirObj);
- Tcl_UtfToExternalDString(NULL, string, dirObj->length, &template);
+ string = TclGetStringFromObj(dirObj, &length);
+ Tcl_UtfToExternalDString(NULL, string, length, &template);
} else {
Tcl_DStringInit(&template);
Tcl_DStringAppend(&template, DefaultTempDir(), -1); /* INTL: native */
@@ -2192,8 +2193,8 @@ TclUnixOpenTemporaryFile(
TclDStringAppendLiteral(&template, "/");
if (basenameObj) {
- string = TclGetString(basenameObj);
- Tcl_UtfToExternalDString(NULL, string, basenameObj->length, &tmp);
+ string = TclGetStringFromObj(basenameObj, &length);
+ Tcl_UtfToExternalDString(NULL, string, length, &tmp);
TclDStringAppendDString(&template, &tmp);
Tcl_DStringFree(&tmp);
} else {
@@ -2204,8 +2205,8 @@ TclUnixOpenTemporaryFile(
#ifdef HAVE_MKSTEMPS
if (extensionObj) {
- string = TclGetString(extensionObj);
- Tcl_UtfToExternalDString(NULL, string, extensionObj->length, &tmp);
+ string = TclGetStringFromObj(extensionObj, &length);
+ Tcl_UtfToExternalDString(NULL, string, length, &tmp);
TclDStringAppendDString(&template, &tmp);
fd = mkstemps(Tcl_DStringValue(&template), Tcl_DStringLength(&tmp));
Tcl_DStringFree(&tmp);
@@ -2369,12 +2370,12 @@ static WCHAR *
winPathFromObj(
Tcl_Obj *fileName)
{
- int size;
+ size_t size;
const char *native = Tcl_FSGetNativePath(fileName);
WCHAR *winPath;
size = cygwin_conv_path(1, native, NULL, 0);
- winPath = ckalloc(size);
+ winPath = Tcl_Alloc(size);
cygwin_conv_path(1, native, winPath, size);
return winPath;
@@ -2412,7 +2413,7 @@ GetUnixFileAttributes(
WCHAR *winPath = winPathFromObj(fileName);
fileAttributes = GetFileAttributesW(winPath);
- ckfree(winPath);
+ Tcl_Free(winPath);
if (fileAttributes == -1) {
StatError(interp, fileName);
@@ -2459,7 +2460,7 @@ SetUnixFileAttributes(
fileAttributes = old = GetFileAttributesW(winPath);
if (fileAttributes == -1) {
- ckfree(winPath);
+ Tcl_Free(winPath);
StatError(interp, fileName);
return TCL_ERROR;
}
@@ -2472,12 +2473,12 @@ SetUnixFileAttributes(
if ((fileAttributes != old)
&& !SetFileAttributesW(winPath, fileAttributes)) {
- ckfree(winPath);
+ Tcl_Free(winPath);
StatError(interp, fileName);
return TCL_ERROR;
}
- ckfree(winPath);
+ Tcl_Free(winPath);
return TCL_OK;
}
#elif defined(HAVE_CHFLAGS) && defined(UF_IMMUTABLE)
diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c
index bf033d2..352c04e 100644
--- a/unix/tclUnixFile.c
+++ b/unix/tclUnixFile.c
@@ -41,7 +41,7 @@ TclpFindExecutable(
{
Tcl_Encoding encoding;
#ifdef __CYGWIN__
- int length;
+ size_t length;
char buf[PATH_MAX * 2];
char name[PATH_MAX * TCL_UTF_MAX + 1];
GetModuleFileNameW(NULL, buf, PATH_MAX);
@@ -269,8 +269,7 @@ TclpMatchInDirectory(
Tcl_DString dsOrig; /* utf-8 encoding of dir */
Tcl_DStringInit(&dsOrig);
- dirName = TclGetString(fileNamePtr);
- dirLength = fileNamePtr->length;
+ dirName = TclGetStringFromObj(fileNamePtr, &dirLength);
Tcl_DStringAppend(&dsOrig, dirName, dirLength);
/*
@@ -720,7 +719,7 @@ TclpGetNativeCwd(
#endif /* USEGETWD */
if ((clientData == NULL) || strcmp(buffer, (const char *) clientData)) {
- char *newCd = ckalloc(strlen(buffer) + 1);
+ char *newCd = Tcl_Alloc(strlen(buffer) + 1);
strcpy(newCd, buffer);
return newCd;
@@ -940,6 +939,7 @@ TclpObjLink(
if (linkAction & TCL_CREATE_SYMBOLIC_LINK) {
Tcl_DString ds;
Tcl_Obj *transPtr;
+ size_t length;
/*
* Now we don't want to link to the absolute, normalized path.
@@ -951,8 +951,8 @@ TclpObjLink(
if (transPtr == NULL) {
return NULL;
}
- target = TclGetString(transPtr);
- target = Tcl_UtfToExternalDString(NULL, target, transPtr->length, &ds);
+ target = TclGetStringFromObj(transPtr, &length);
+ target = Tcl_UtfToExternalDString(NULL, target, length, &ds);
Tcl_DecrRefCount(transPtr);
if (symlink(target, src) != 0) {
@@ -1105,8 +1105,7 @@ TclNativeCreateNativeRep(
Tcl_IncrRefCount(validPathPtr);
}
- str = TclGetString(validPathPtr);
- len = validPathPtr->length;
+ str = TclGetStringFromObj(validPathPtr, &len);
Tcl_UtfToExternalDString(NULL, str, len, &ds);
len = Tcl_DStringLength(&ds) + sizeof(char);
if (strlen(Tcl_DStringValue(&ds)) < len - sizeof(char)) {
@@ -1116,7 +1115,7 @@ TclNativeCreateNativeRep(
return NULL;
}
Tcl_DecrRefCount(validPathPtr);
- nativePathPtr = ckalloc(len);
+ nativePathPtr = Tcl_Alloc(len);
memcpy(nativePathPtr, Tcl_DStringValue(&ds), len);
Tcl_DStringFree(&ds);
@@ -1157,7 +1156,7 @@ TclNativeDupInternalRep(
len = (strlen((const char*) clientData) + 1) * sizeof(char);
- copy = ckalloc(len);
+ copy = Tcl_Alloc(len);
memcpy(copy, clientData, len);
return copy;
}
diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c
index eec0fd9..2db1863 100644
--- a/unix/tclUnixInit.c
+++ b/unix/tclUnixInit.c
@@ -446,7 +446,7 @@ TclpInitPlatform(void)
void
TclpInitLibraryPath(
char **valuePtr,
- unsigned int *lengthPtr,
+ size_t *lengthPtr,
Tcl_Encoding *encodingPtr)
{
#define LIBRARY_SIZE 32
@@ -503,7 +503,7 @@ TclpInitLibraryPath(
str = Tcl_JoinPath(pathc, pathv, &ds);
Tcl_ListObjAppendElement(NULL, pathPtr, TclDStringToObj(&ds));
}
- ckfree(pathv);
+ Tcl_Free(pathv);
}
/*
@@ -535,9 +535,8 @@ TclpInitLibraryPath(
Tcl_DStringFree(&buffer);
*encodingPtr = Tcl_GetEncoding(NULL, NULL);
- str = TclGetString(pathPtr);
- *lengthPtr = pathPtr->length;
- *valuePtr = ckalloc(*lengthPtr + 1);
+ str = TclGetStringFromObj(pathPtr, lengthPtr);
+ *valuePtr = Tcl_Alloc(*lengthPtr + 1);
memcpy(*valuePtr, str, *lengthPtr + 1);
Tcl_DecrRefCount(pathPtr);
}
@@ -979,7 +978,7 @@ TclpSetVariables(
*
* Results:
* The return value is the index in environ of an entry with the name
- * "name", or -1 if there is no such entry. The integer at *lengthPtr is
+ * "name", or TCL_IO_FAILURE if there is no such entry. The integer at *lengthPtr is
* filled in with the length of name (if a matching entry is found) or
* the length of the environ array (if no matching entry is found).
*
@@ -989,16 +988,16 @@ TclpSetVariables(
*----------------------------------------------------------------------
*/
-int
+size_t
TclpFindVariable(
const char *name, /* Name of desired environment variable
* (native). */
- int *lengthPtr) /* Used to return length of name (for
+ size_t *lengthPtr) /* Used to return length of name (for
* successful searches) or number of non-NULL
* entries in environ (for unsuccessful
* searches). */
{
- int i, result = -1;
+ size_t i, result = TCL_IO_FAILURE;
const char *env, *p1, *p2;
Tcl_DString envString;
diff --git a/unix/tclUnixPipe.c b/unix/tclUnixPipe.c
index 93faec8..dfeee0c 100644
--- a/unix/tclUnixPipe.c
+++ b/unix/tclUnixPipe.c
@@ -524,7 +524,7 @@ TclpCreateProcess(
errPipeOut = NULL;
fd = GetFd(errPipeIn);
- count = read(fd, errSpace, (size_t) (sizeof(errSpace) - 1));
+ count = read(fd, errSpace, sizeof(errSpace) - 1);
if (count > 0) {
char *end;
@@ -744,7 +744,7 @@ TclpCreateCommandChannel(
{
char channelName[16 + TCL_INTEGER_SPACE];
int channelId;
- PipeState *statePtr = ckalloc(sizeof(PipeState));
+ PipeState *statePtr = Tcl_Alloc(sizeof(PipeState));
int mode;
statePtr->inFile = readFile;
@@ -878,7 +878,7 @@ TclGetAndDetachPids(
}
Tcl_SetObjResult(interp, pidsObj);
if (pipePtr->numPids > 0) {
- ckfree(pipePtr->pidPtr);
+ Tcl_Free(pipePtr->pidPtr);
pipePtr->numPids = 0;
}
}
@@ -1009,9 +1009,9 @@ PipeClose2Proc(
}
if (pipePtr->numPids != 0) {
- ckfree(pipePtr->pidPtr);
+ Tcl_Free(pipePtr->pidPtr);
}
- ckfree(pipePtr);
+ Tcl_Free(pipePtr);
if (errorCode == 0) {
return result;
}
@@ -1059,7 +1059,7 @@ PipeInputProc(
*/
do {
- bytesRead = read(GetFd(psPtr->inFile), buf, (size_t) toRead);
+ bytesRead = read(GetFd(psPtr->inFile), buf, toRead);
} while ((bytesRead < 0) && (errno == EINTR));
if (bytesRead < 0) {
@@ -1105,7 +1105,7 @@ PipeOutputProc(
*/
do {
- written = write(GetFd(psPtr->outFile), buf, (size_t) toWrite);
+ written = write(GetFd(psPtr->outFile), buf, toWrite);
} while ((written < 0) && (errno == EINTR));
if (written < 0) {
@@ -1274,7 +1274,7 @@ Tcl_PidObjCmd(
* Get the channel and make sure that it refers to a pipe.
*/
- chan = Tcl_GetChannel(interp, Tcl_GetString(objv[1]), NULL);
+ chan = Tcl_GetChannel(interp, TclGetString(objv[1]), NULL);
if (chan == NULL) {
return TCL_ERROR;
}
diff --git a/unix/tclUnixPort.h b/unix/tclUnixPort.h
index c982585..527f662 100644
--- a/unix/tclUnixPort.h
+++ b/unix/tclUnixPort.h
@@ -671,9 +671,9 @@ typedef int socklen_t;
*---------------------------------------------------------------------------
*/
-#define TclpSysAlloc(size, isBin) malloc((size_t)(size))
-#define TclpSysFree(ptr) free((char *)(ptr))
-#define TclpSysRealloc(ptr, size) realloc((char *)(ptr), (size_t)(size))
+#define TclpSysAlloc(size) malloc(size)
+#define TclpSysFree(ptr) free(ptr)
+#define TclpSysRealloc(ptr, size) realloc(ptr, size)
/*
*---------------------------------------------------------------------------
diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c
index 62e4756..09ed008 100644
--- a/unix/tclUnixSock.c
+++ b/unix/tclUnixSock.c
@@ -217,7 +217,7 @@ printaddrinfo(
static void
InitializeHostName(
char **valuePtr,
- unsigned int *lengthPtr,
+ size_t *lengthPtr,
Tcl_Encoding *encodingPtr)
{
const char *native = NULL;
@@ -239,12 +239,12 @@ InitializeHostName(
char *dot = strchr(u.nodename, '.');
if (dot != NULL) {
- char *node = ckalloc(dot - u.nodename + 1);
+ char *node = Tcl_Alloc(dot - u.nodename + 1);
memcpy(node, u.nodename, dot - u.nodename);
node[dot - u.nodename] = '\0';
hp = TclpGetHostByName(node);
- ckfree(node);
+ Tcl_Free(node);
}
}
if (hp != NULL) {
@@ -283,11 +283,11 @@ InitializeHostName(
*encodingPtr = Tcl_GetEncoding(NULL, NULL);
if (native) {
*lengthPtr = strlen(native);
- *valuePtr = ckalloc(*lengthPtr + 1);
+ *valuePtr = Tcl_Alloc(*lengthPtr + 1);
memcpy(*valuePtr, native, *lengthPtr + 1);
} else {
*lengthPtr = 0;
- *valuePtr = ckalloc(1);
+ *valuePtr = Tcl_Alloc(1);
*valuePtr[0] = '\0';
}
}
@@ -313,7 +313,8 @@ InitializeHostName(
const char *
Tcl_GetHostName(void)
{
- return Tcl_GetString(TclGetProcessGlobalValue(&hostName));
+ Tcl_Obj *tclObj = TclGetProcessGlobalValue(&hostName);
+ return TclGetString(tclObj);
}
/*
@@ -540,7 +541,7 @@ TcpInputProc(
if (WaitForConnect(statePtr, errorCodePtr) != 0) {
return -1;
}
- bytesRead = recv(statePtr->fds.fd, buf, (size_t) bufSize, 0);
+ bytesRead = recv(statePtr->fds.fd, buf, bufSize, 0);
if (bytesRead > -1) {
return bytesRead;
}
@@ -590,7 +591,7 @@ TcpOutputProc(
if (WaitForConnect(statePtr, errorCodePtr) != 0) {
return -1;
}
- written = send(statePtr->fds.fd, buf, (size_t) toWrite, 0);
+ written = send(statePtr->fds.fd, buf, toWrite, 0);
if (written > -1) {
return written;
@@ -649,7 +650,7 @@ TcpCloseProc(
while (fds != NULL) {
TcpFdList *next = fds->next;
- ckfree(fds);
+ Tcl_Free(fds);
fds = next;
}
if (statePtr->addrlist != NULL) {
@@ -658,7 +659,7 @@ TcpCloseProc(
if (statePtr->myaddrlist != NULL) {
freeaddrinfo(statePtr->myaddrlist);
}
- ckfree(statePtr);
+ Tcl_Free(statePtr);
return errorCode;
}
@@ -1399,7 +1400,7 @@ Tcl_OpenTcpClient(
* Allocate a new TcpState for this socket.
*/
- statePtr = ckalloc(sizeof(TcpState));
+ statePtr = Tcl_Alloc(sizeof(TcpState));
memset(statePtr, 0, sizeof(TcpState));
statePtr->flags = async ? TCP_ASYNC_CONNECT : 0;
statePtr->cachedBlocking = TCL_MODE_BLOCKING;
@@ -1478,7 +1479,7 @@ TclpMakeTcpClientChannelMode(
TcpState *statePtr;
char channelName[SOCK_CHAN_LENGTH];
- statePtr = ckalloc(sizeof(TcpState));
+ statePtr = Tcl_Alloc(sizeof(TcpState));
memset(statePtr, 0, sizeof(TcpState));
statePtr->fds.fd = PTR2INT(sock);
statePtr->flags = 0;
@@ -1701,14 +1702,14 @@ Tcl_OpenTcpServerEx(
* Allocate a new TcpState for this socket.
*/
- statePtr = ckalloc(sizeof(TcpState));
+ statePtr = Tcl_Alloc(sizeof(TcpState));
memset(statePtr, 0, sizeof(TcpState));
statePtr->acceptProc = acceptProc;
statePtr->acceptProcData = acceptProcData;
sprintf(channelName, SOCK_TEMPLATE, (long) statePtr);
newfds = &statePtr->fds;
} else {
- newfds = ckalloc(sizeof(TcpFdList));
+ newfds = Tcl_Alloc(sizeof(TcpFdList));
memset(newfds, (int) 0, sizeof(TcpFdList));
fds->next = newfds;
}
@@ -1793,7 +1794,7 @@ TcpAccept(
(void) fcntl(newsock, F_SETFD, FD_CLOEXEC);
- newSockState = ckalloc(sizeof(TcpState));
+ newSockState = Tcl_Alloc(sizeof(TcpState));
memset(newSockState, 0, sizeof(TcpState));
newSockState->flags = 0;
newSockState->fds.fd = newsock;
diff --git a/unix/tclUnixThrd.c b/unix/tclUnixThrd.c
index 35eca8d..afb8b1c 100644
--- a/unix/tclUnixThrd.c
+++ b/unix/tclUnixThrd.c
@@ -160,14 +160,6 @@ PCondTimedWait(
}
#endif /* HAVE_PTHREAD_MUTEX_RECURSIVE */
-#ifndef TCL_NO_DEPRECATED
-typedef struct {
- char nabuf[16];
-} ThreadSpecificData;
-
-static Tcl_ThreadDataKey dataKey;
-#endif /* TCL_NO_DEPRECATED */
-
/*
* masterLock is used to serialize creation of mutexes, condition variables,
* and thread local storage. This is the only place that can count on the
@@ -222,7 +214,7 @@ TclpThreadCreate(
Tcl_ThreadId *idPtr, /* Return, the ID of the thread */
Tcl_ThreadCreateProc *proc, /* Main() function of the thread */
ClientData clientData, /* The one argument to Main() */
- int stackSize, /* Size of stack for the new thread */
+ size_t stackSize, /* Size of stack for the new thread */
int flags) /* Flags controlling behaviour of the new
* thread. */
{
@@ -236,7 +228,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 {
/*
@@ -577,7 +569,7 @@ Tcl_MutexLock(
* Double inside master lock check to avoid a race condition.
*/
- pmutexPtr = ckalloc(sizeof(PMutex));
+ pmutexPtr = Tcl_Alloc(sizeof(PMutex));
PMutexInit(pmutexPtr);
*mutexPtr = (Tcl_Mutex) pmutexPtr;
TclRememberMutex(mutexPtr);
@@ -641,7 +633,7 @@ TclpFinalizeMutex(
if (pmutexPtr != NULL) {
PMutexDestroy(pmutexPtr);
- ckfree(pmutexPtr);
+ Tcl_Free(pmutexPtr);
*mutexPtr = NULL;
}
}
@@ -687,7 +679,7 @@ Tcl_ConditionWait(
*/
if (*condPtr == NULL) {
- pcondPtr = ckalloc(sizeof(pthread_cond_t));
+ pcondPtr = Tcl_Alloc(sizeof(pthread_cond_t));
pthread_cond_init(pcondPtr, NULL);
*condPtr = (Tcl_Condition) pcondPtr;
TclRememberCondition(condPtr);
@@ -775,59 +767,11 @@ TclpFinalizeCondition(
if (pcondPtr != NULL) {
pthread_cond_destroy(pcondPtr);
- ckfree(pcondPtr);
+ Tcl_Free(pcondPtr);
*condPtr = NULL;
}
}
-#endif /* TCL_THREADS */
-
-/*
- *----------------------------------------------------------------------
- *
- * TclpReaddir, TclpInetNtoa --
- *
- * These procedures replace core C versions to be used in a threaded
- * environment.
- *
- * Results:
- * See documentation of C functions.
- *
- * Side effects:
- * See documentation of C functions.
- *
- * Notes:
- * TclpReaddir is no longer used by the core (see 1095909), but it
- * appears in the internal stubs table (see #589526).
- *
- *----------------------------------------------------------------------
- */
-
-#ifndef TCL_NO_DEPRECATED
-Tcl_DirEntry *
-TclpReaddir(
- TclDIR * dir)
-{
- return TclOSreaddir(dir);
-}
-
-#undef TclpInetNtoa
-char *
-TclpInetNtoa(
- struct in_addr addr)
-{
-#if TCL_THREADS
- ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
- unsigned char *b = (unsigned char*) &addr.s_addr;
-
- sprintf(tsdPtr->nabuf, "%u.%u.%u.%u", b[0], b[1], b[2], b[3]);
- return tsdPtr->nabuf;
-#else
- return inet_ntoa(addr);
-#endif
-}
-#endif /* TCL_NO_DEPRECATED */
-#if TCL_THREADS
/*
* Additions by AOL for specialized thread memory allocator.
*/
@@ -917,7 +861,7 @@ TclpThreadCreateKey(void)
{
pthread_key_t *ptkeyPtr;
- ptkeyPtr = TclpSysAlloc(sizeof(pthread_key_t), 0);
+ ptkeyPtr = TclpSysAlloc(sizeof(pthread_key_t));
if (NULL == ptkeyPtr) {
Tcl_Panic("unable to allocate thread key!");
}
diff --git a/unix/tclUnixTime.c b/unix/tclUnixTime.c
index 51d486e..7e43720 100644
--- a/unix/tclUnixTime.c
+++ b/unix/tclUnixTime.c
@@ -16,37 +16,9 @@
#endif
/*
- * TclpGetDate is coded to return a pointer to a 'struct tm'. For thread
- * safety, this structure must be in thread-specific data. The 'tmKey'
- * variable is the key to this buffer.
- */
-
-#ifndef TCL_NO_DEPRECATED
-static Tcl_ThreadDataKey tmKey;
-typedef struct {
- struct tm gmtime_buf;
- struct tm localtime_buf;
-} ThreadSpecificData;
-
-/*
- * If we fall back on the thread-unsafe versions of gmtime and localtime, use
- * this mutex to try to protect them.
- */
-
-TCL_DECLARE_MUTEX(tmMutex)
-
-static char *lastTZ = NULL; /* Holds the last setting of the TZ
- * environment variable, or an empty string if
- * the variable was not set. */
-
-/*
* Static functions declared in this file.
*/
-static void SetTZIfNecessary(void);
-static void CleanupMemory(ClientData clientData);
-#endif /* TCL_NO_DEPRECATED */
-
static void NativeScaleTime(Tcl_Time *timebuf,
ClientData clientData);
static void NativeGetTime(Tcl_Time *timebuf,
@@ -77,7 +49,7 @@ ClientData tclTimeClientData = NULL;
*----------------------------------------------------------------------
*/
-unsigned long
+Tcl_WideUInt
TclpGetSeconds(void)
{
return time(NULL);
@@ -128,30 +100,30 @@ TclpGetMicroseconds(void)
*----------------------------------------------------------------------
*/
-unsigned long
+Tcl_WideUInt
TclpGetClicks(void)
{
- unsigned long now;
+ Tcl_WideUInt now;
#ifdef NO_GETTOD
if (tclGetTimeProcPtr != NativeGetTime) {
Tcl_Time time;
tclGetTimeProcPtr(&time, tclTimeClientData);
- now = time.sec*1000000 + time.usec;
+ now = (Tcl_WideUInt)time.sec*1000000 + time.usec;
} else {
/*
* A semi-NativeGetTime, specialized to clicks.
*/
struct tms dummy;
- now = (unsigned long) times(&dummy);
+ now = (Tcl_WideUInt) times(&dummy);
}
#else
Tcl_Time time;
tclGetTimeProcPtr(&time, tclTimeClientData);
- now = time.sec*1000000 + time.usec;
+ now = (Tcl_WideUInt)time.sec*1000000 + time.usec;
#endif
return now;
@@ -164,9 +136,9 @@ TclpGetClicks(void)
* TclpGetWideClicks --
*
* This procedure returns a WideInt value that represents the highest
- * resolution clock available on the system. There are no garantees on
+ * resolution clock available on the system. There are no guarantees on
* what the resolution will be. In Tcl we will call this value a "click".
- * The start time is also system dependant.
+ * The start time is also system dependent.
*
* Results:
* Number of WideInt clicks from some start time.
@@ -321,116 +293,6 @@ Tcl_GetTime(
/*
*----------------------------------------------------------------------
*
- * TclpGetDate --
- *
- * This function converts between seconds and struct tm. If useGMT is
- * true, then the returned date will be in Greenwich Mean Time (GMT).
- * Otherwise, it will be in the local time zone.
- *
- * Results:
- * Returns a static tm structure.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-#ifndef TCL_NO_DEPRECATED
-struct tm *
-TclpGetDate(
- const time_t *time,
- int useGMT)
-{
- if (useGMT) {
- return TclpGmtime(time);
- } else {
- return TclpLocaltime(time);
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TclpGmtime --
- *
- * Wrapper around the 'gmtime' library function to make it thread safe.
- *
- * Results:
- * Returns a pointer to a 'struct tm' in thread-specific data.
- *
- * Side effects:
- * Invokes gmtime or gmtime_r as appropriate.
- *
- *----------------------------------------------------------------------
- */
-
-struct tm *
-TclpGmtime(
- const time_t *timePtr) /* Pointer to the number of seconds since the
- * local system's epoch */
-{
- /*
- * Get a thread-local buffer to hold the returned time.
- */
-
- ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&tmKey);
-
-#ifdef HAVE_GMTIME_R
- gmtime_r(timePtr, &tsdPtr->gmtime_buf);
-#else
- Tcl_MutexLock(&tmMutex);
- memcpy(&tsdPtr->gmtime_buf, gmtime(timePtr), sizeof(struct tm));
- Tcl_MutexUnlock(&tmMutex);
-#endif
-
- return &tsdPtr->gmtime_buf;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TclpLocaltime --
- *
- * Wrapper around the 'localtime' library function to make it thread
- * safe.
- *
- * Results:
- * Returns a pointer to a 'struct tm' in thread-specific data.
- *
- * Side effects:
- * Invokes localtime or localtime_r as appropriate.
- *
- *----------------------------------------------------------------------
- */
-
-struct tm *
-TclpLocaltime(
- const time_t *timePtr) /* Pointer to the number of seconds since the
- * local system's epoch */
-{
- /*
- * Get a thread-local buffer to hold the returned time.
- */
-
- ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&tmKey);
-
- SetTZIfNecessary();
-#ifdef HAVE_LOCALTIME_R
- localtime_r(timePtr, &tsdPtr->localtime_buf);
-#else
- Tcl_MutexLock(&tmMutex);
- memcpy(&tsdPtr->localtime_buf, localtime(timePtr), sizeof(struct tm));
- Tcl_MutexUnlock(&tmMutex);
-#endif
-
- return &tsdPtr->localtime_buf;
-}
-#endif /* TCL_NO_DEPRECATED */
-
-/*
- *----------------------------------------------------------------------
- *
* Tcl_SetTimeProc --
*
* TIP #233 (Virtualized Time): Registers two handlers for the
@@ -542,72 +404,6 @@ NativeGetTime(
timePtr->sec = tv.tv_sec;
timePtr->usec = tv.tv_usec;
}
-/*
- *----------------------------------------------------------------------
- *
- * SetTZIfNecessary --
- *
- * Determines whether a call to 'tzset' is needed prior to the next call
- * to 'localtime' or examination of the 'timezone' variable.
- *
- * Results:
- * None.
- *
- * Side effects:
- * If 'tzset' has never been called in the current process, or if the
- * value of the environment variable TZ has changed since the last call
- * to 'tzset', then 'tzset' is called again.
- *
- *----------------------------------------------------------------------
- */
-
-#ifndef TCL_NO_DEPRECATED
-static void
-SetTZIfNecessary(void)
-{
- const char *newTZ = getenv("TZ");
-
- Tcl_MutexLock(&tmMutex);
- if (newTZ == NULL) {
- newTZ = "";
- }
- if (lastTZ == NULL || strcmp(lastTZ, newTZ)) {
- tzset();
- if (lastTZ == NULL) {
- Tcl_CreateExitHandler(CleanupMemory, NULL);
- } else {
- ckfree(lastTZ);
- }
- lastTZ = ckalloc(strlen(newTZ) + 1);
- strcpy(lastTZ, newTZ);
- }
- Tcl_MutexUnlock(&tmMutex);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * CleanupMemory --
- *
- * Releases the private copy of the TZ environment variable upon exit
- * from Tcl.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Frees allocated memory.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-CleanupMemory(
- ClientData ignored)
-{
- ckfree(lastTZ);
-}
-#endif /* TCL_NO_DEPRECATED */
/*
* Local Variables:
diff --git a/unix/tclXtNotify.c b/unix/tclXtNotify.c
index 26db9f2..56fe840 100644
--- a/unix/tclXtNotify.c
+++ b/unix/tclXtNotify.c
@@ -268,7 +268,7 @@ static void
SetTimer(
const Tcl_Time *timePtr) /* Timeout value, may be NULL. */
{
- long timeout;
+ unsigned long timeout;
if (!initialized) {
InitNotifier();
@@ -281,7 +281,7 @@ SetTimer(
if (timePtr) {
timeout = timePtr->sec * 1000 + timePtr->usec / 1000;
notifier.currentTimeout = XtAppAddTimeOut(notifier.appContext,
- (unsigned long) timeout, TimerProc, NULL);
+ timeout, TimerProc, NULL);
} else {
notifier.currentTimeout = 0;
}
@@ -359,7 +359,7 @@ CreateFileHandler(
}
}
if (filePtr == NULL) {
- filePtr = ckalloc(sizeof(FileHandler));
+ filePtr = Tcl_Alloc(sizeof(FileHandler));
filePtr->fd = fd;
filePtr->read = 0;
filePtr->write = 0;
@@ -470,7 +470,7 @@ DeleteFileHandler(
if (filePtr->mask & TCL_EXCEPTION) {
XtRemoveInput(filePtr->except);
}
- ckfree(filePtr);
+ Tcl_Free(filePtr);
}
/*
@@ -525,7 +525,7 @@ FileProc(
*/
filePtr->readyMask |= mask;
- fileEvPtr = ckalloc(sizeof(FileHandlerEvent));
+ fileEvPtr = Tcl_Alloc(sizeof(FileHandlerEvent));
fileEvPtr->header.proc = FileHandlerEventProc;
fileEvPtr->fd = filePtr->fd;
Tcl_QueueEvent((Tcl_Event *) fileEvPtr, TCL_QUEUE_TAIL);
diff --git a/win/Makefile.in b/win/Makefile.in
index af2b6e3..e1dc5d9 100644
--- a/win/Makefile.in
+++ b/win/Makefile.in
@@ -837,7 +837,7 @@ install-libraries: libraries install-tzdata install-msgs
else true; \
fi; \
done;
- @for i in opt0.4 encoding ../tcl8 ../tcl8/8.4 ../tcl8/8.4/platform ../tcl8/8.5 ../tcl8/8.6 ../tcl8/8.7; \
+ @for i in opt0.4 encoding ../tcl9 ../tcl9/9.0 ../tcl9/9.0/platform; \
do \
if [ ! -d $(SCRIPT_INSTALL_DIR)/$$i ] ; then \
echo "Making directory $(SCRIPT_INSTALL_DIR)/$$i"; \
@@ -851,20 +851,20 @@ install-libraries: libraries install-tzdata install-msgs
$(COPY) "$$i" "$(SCRIPT_INSTALL_DIR)"; \
done;
@echo "Installing package http 2.9.0 as a Tcl Module";
- @$(COPY) $(ROOT_DIR)/library/http/http.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.6/http-2.9.0.tm;
+ @$(COPY) $(ROOT_DIR)/library/http/http.tcl $(SCRIPT_INSTALL_DIR)/../tcl9/9.0/http-2.9.0.tm;
@echo "Installing library opt0.4 directory";
@for j in $(ROOT_DIR)/library/opt/*.tcl; \
do \
$(COPY) "$$j" "$(SCRIPT_INSTALL_DIR)/opt0.4"; \
done;
@echo "Installing package msgcat 1.7.0 as a Tcl Module";
- @$(COPY) $(ROOT_DIR)/library/msgcat/msgcat.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.7/msgcat-1.7.0.tm;
+ @$(COPY) $(ROOT_DIR)/library/msgcat/msgcat.tcl $(SCRIPT_INSTALL_DIR)/../tcl9/9.0/msgcat-1.7.0.tm;
@echo "Installing package tcltest 2.4.0 as a Tcl Module";
- @$(COPY) $(ROOT_DIR)/library/tcltest/tcltest.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.5/tcltest-2.4.0.tm;
+ @$(COPY) $(ROOT_DIR)/library/tcltest/tcltest.tcl $(SCRIPT_INSTALL_DIR)/../tcl9/9.0/tcltest-2.4.0.tm;
@echo "Installing package platform 1.0.14 as a Tcl Module";
- @$(COPY) $(ROOT_DIR)/library/platform/platform.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.4/platform-1.0.14.tm;
+ @$(COPY) $(ROOT_DIR)/library/platform/platform.tcl $(SCRIPT_INSTALL_DIR)/../tcl9/9.0/platform-1.0.14.tm;
@echo "Installing package platform::shell 1.1.4 as a Tcl Module";
- @$(COPY) $(ROOT_DIR)/library/platform/shell.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.4/platform/shell-1.1.4.tm;
+ @$(COPY) $(ROOT_DIR)/library/platform/shell.tcl $(SCRIPT_INSTALL_DIR)/../tcl9/9.0/platform/shell-1.1.4.tm;
@echo "Installing encodings";
@for i in $(ROOT_DIR)/library/encoding/*.enc ; do \
$(COPY) "$$i" "$(SCRIPT_INSTALL_DIR)/encoding"; \
@@ -1070,7 +1070,7 @@ genstubs:
#
# This target creates the HTML folder for Tcl & Tk and places it in
# DISTDIR/html. It uses the tcltk-man2html.tcl tool from the Tcl group's tool
-# workspace. It depends on the Tcl & Tk being in directories called tcl8.* &
+# workspace. It depends on the Tcl & Tk being in directories called tcl9.* &
# tk8.* up two directories from the TOOL_DIR.
#
diff --git a/win/README b/win/README
index 972923c..022dc11 100644
--- a/win/README
+++ b/win/README
@@ -1,4 +1,4 @@
-Tcl 8.7 for Windows
+Tcl 9.0 for Windows
1. Introduction
---------------
@@ -16,7 +16,7 @@ The information in this file is maintained on the web at:
In order to compile Tcl for Windows, you need the following:
- Tcl 8.7 Source Distribution (plus any patches)
+ Tcl 9.0 Source Distribution (plus any patches)
and
@@ -79,9 +79,9 @@ Use the Makefile "install" target to install Tcl. It will install it
according to the prefix options you provided in the correct directory
structure.
-Note that in order to run tclsh87.exe, you must ensure that tcl87.dll is
+Note that in order to run tclsh90.exe, you must ensure that tcl90.dll is
on your path, in the system directory, or in the directory containing
-tclsh87.exe.
+tclsh90.exe.
Note: Tcl no longer provides support for Win32s.
diff --git a/win/configure b/win/configure
index b0e1d5a..1c08bd9 100755
--- a/win/configure
+++ b/win/configure
@@ -778,7 +778,6 @@ ac_user_opts='
enable_option_checking
with_encoding
enable_shared
-enable_time64bit
enable_64bit
enable_zipfs
enable_symbols
@@ -1401,7 +1400,6 @@ Optional Features:
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-shared build and link with shared libraries (default: on)
- --enable-time64bit force 64-bit time_t for 32-bit build (default: off)
--enable-64bit enable 64bit support (where applicable)
--enable-zipfs build with Zipfs support (default: on)
--enable-symbols build with debugging symbols (default: off)
@@ -2109,10 +2107,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
# /bin/sh. The bash shell seems to suffer from some strange failures.
SHELL=/bin/sh
-TCL_VERSION=8.7
-TCL_MAJOR_VERSION=8
-TCL_MINOR_VERSION=7
-TCL_PATCH_LEVEL="a2"
+TCL_VERSION=9.0
+TCL_MAJOR_VERSION=9
+TCL_MINOR_VERSION=0
+TCL_PATCH_LEVEL="a0"
VER=$TCL_MAJOR_VERSION$TCL_MINOR_VERSION
TCL_DDE_VERSION=1.4
@@ -3751,25 +3749,6 @@ $as_echo "#define STATIC_BUILD 1" >>confdefs.h
#--------------------------------------------------------------------
-# Check whether --enable-time64bit was given.
-#--------------------------------------------------------------------
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking force of 64-bit time_t" >&5
-$as_echo_n "checking force of 64-bit time_t... " >&6; }
-# Check whether --enable-time64bit was given.
-if test "${enable_time64bit+set}" = set; then :
- enableval=$enable_time64bit; tcl_ok=$enableval
-else
- tcl_ok=no
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: \"$tcl_ok\"" >&5
-$as_echo "\"$tcl_ok\"" >&6; }
-if test "$tcl_ok" = "yes"; then
- CFLAGS="${CFLAGS} -D_USE_64BIT_TIME_T"
-fi
-
-#--------------------------------------------------------------------
# The statements below define a collection of compile flags. This
# macro depends on the value of SHARED_BUILD, and should be called
# after SC_ENABLE_SHARED checks the configure switches.
diff --git a/win/configure.ac b/win/configure.ac
index 82d713a..985aa0a 100644
--- a/win/configure.ac
+++ b/win/configure.ac
@@ -11,10 +11,10 @@ AC_PREREQ(2.69)
# /bin/sh. The bash shell seems to suffer from some strange failures.
SHELL=/bin/sh
-TCL_VERSION=8.7
-TCL_MAJOR_VERSION=8
-TCL_MINOR_VERSION=7
-TCL_PATCH_LEVEL="a2"
+TCL_VERSION=9.0
+TCL_MAJOR_VERSION=9
+TCL_MINOR_VERSION=0
+TCL_PATCH_LEVEL="a0"
VER=$TCL_MAJOR_VERSION$TCL_MINOR_VERSION
TCL_DDE_VERSION=1.4
@@ -92,20 +92,6 @@ SC_TCL_CFG_ENCODING
SC_ENABLE_SHARED
#--------------------------------------------------------------------
-# Check whether --enable-time64bit was given.
-#--------------------------------------------------------------------
-
-AC_MSG_CHECKING([force of 64-bit time_t])
-AC_ARG_ENABLE(time64bit,
- AC_HELP_STRING([--enable-time64bit],
- [force 64-bit time_t for 32-bit build (default: off)]),
- [tcl_ok=$enableval], [tcl_ok=no])
-AC_MSG_RESULT("$tcl_ok")
-if test "$tcl_ok" = "yes"; then
- CFLAGS="${CFLAGS} -D_USE_64BIT_TIME_T"
-fi
-
-#--------------------------------------------------------------------
# The statements below define a collection of compile flags. This
# macro depends on the value of SHARED_BUILD, and should be called
# after SC_ENABLE_SHARED checks the configure switches.
diff --git a/win/makefile.vc b/win/makefile.vc
index c2343a0..959fd64 100644
--- a/win/makefile.vc
+++ b/win/makefile.vc
@@ -52,7 +52,7 @@
# turn on the 64-bit compiler, if your SDK has it.
#
# Basic macros and options usable on the commandline (see rules.vc for more info):
-# OPTS=msvcrt,static,staticpkg,symbols,profile,unchecked,time64bit,utfmax,none
+# OPTS=msvcrt,static,staticpkg,symbols,profile,unchecked,utfmax,none
# Sets special options for the core. The default is for none.
# Any combination of the above may be used (comma separated).
# 'none' will over-ride everything to nothing.
@@ -72,8 +72,6 @@
# unchecked = Allows a symbols build to not use the debug
# enabled runtime (msvcrt.dll not msvcrtd.dll
# or libcmt.lib not libcmtd.lib).
-# time64bit = Forces a build using 64-bit time_t for 32-bit build
-# (CRT library should support this).
# utfmax = Forces Tcl_UniChar to be a 32-bit quantity in stead
# of 16-bits
#
@@ -892,20 +890,12 @@ install-binaries:
install-libraries: tclConfig tcl-nmake install-msgs install-tzdata
@if not exist "$(SCRIPT_INSTALL_DIR)" \
$(MKDIR) "$(SCRIPT_INSTALL_DIR)"
- @if not exist "$(SCRIPT_INSTALL_DIR)\..\tcl8" \
- $(MKDIR) "$(SCRIPT_INSTALL_DIR)\..\tcl8"
- @if not exist "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.4" \
- $(MKDIR) "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.4"
- @if not exist "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.4\platform" \
- $(MKDIR) "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.4\platform"
- @if not exist "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.5" \
- $(MKDIR) "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.5"
- @if not exist "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.6" \
- $(MKDIR) "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.6"
- @if not exist "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.7" \
- $(MKDIR) "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.7"
- @if not exist "$(LIB_INSTALL_DIR)\nmake" \
- $(MKDIR) "$(LIB_INSTALL_DIR)\nmake"
+ @if not exist "$(SCRIPT_INSTALL_DIR)\..\tcl9$(NULL)" \
+ $(MKDIR) "$(SCRIPT_INSTALL_DIR)\..\tcl9"
+ @if not exist "$(SCRIPT_INSTALL_DIR)\..\tcl9\9.0$(NULL)" \
+ $(MKDIR) "$(SCRIPT_INSTALL_DIR)\..\tcl9\9.0"
+ @if not exist "$(SCRIPT_INSTALL_DIR)\..\tcl9\9.0\platform$(NULL)" \
+ $(MKDIR) "$(SCRIPT_INSTALL_DIR)\..\tcl9\9.0\platform"
@echo Installing header files
@$(CPY) "$(GENERICDIR)\tcl.h" "$(INCLUDE_INSTALL_DIR)\"
@$(CPY) "$(GENERICDIR)\tclDecls.h" "$(INCLUDE_INSTALL_DIR)\"
@@ -938,19 +928,19 @@ install-libraries: tclConfig tcl-nmake install-msgs install-tzdata
"$(SCRIPT_INSTALL_DIR)\opt0.4\"
@echo Installing package http $(PKG_HTTP_VER) as a Tcl Module
@$(COPY) "$(ROOT)\library\http\http.tcl" \
- "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.6\http-$(PKG_HTTP_VER).tm"
+ "$(SCRIPT_INSTALL_DIR)\..\tcl9\9.0\http-$(PKG_HTTP_VER).tm"
@echo Installing package msgcat $(PKG_MSGCAT_VER) as a Tcl Module
@$(COPY) "$(ROOT)\library\msgcat\msgcat.tcl" \
- "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.7\msgcat-$(PKG_MSGCAT_VER).tm"
+ "$(SCRIPT_INSTALL_DIR)\..\tcl9\9.0\msgcat-$(PKG_MSGCAT_VER).tm"
@echo Installing package tcltest $(PKG_TCLTEST_VER) as a Tcl Module
@$(COPY) "$(ROOT)\library\tcltest\tcltest.tcl" \
- "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.5\tcltest-$(PKG_TCLTEST_VER).tm"
+ "$(SCRIPT_INSTALL_DIR)\..\tcl9\9.0\tcltest-$(PKG_TCLTEST_VER).tm"
@echo Installing package platform $(PKG_PLATFORM_VER) as a Tcl Module
@$(COPY) "$(ROOT)\library\platform\platform.tcl" \
- "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.4\platform-$(PKG_PLATFORM_VER).tm"
+ "$(SCRIPT_INSTALL_DIR)\..\tcl9\9.0\platform-$(PKG_PLATFORM_VER).tm"
@echo Installing package platform::shell $(PKG_SHELL_VER) as a Tcl Module
@$(COPY) "$(ROOT)\library\platform\shell.tcl" \
- "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.4\platform\shell-$(PKG_SHELL_VER).tm"
+ "$(SCRIPT_INSTALL_DIR)\..\tcl9\9.0\platform\shell-$(PKG_SHELL_VER).tm"
@echo Installing $(TCLDDELIBNAME)
!if $(STATIC_BUILD)
!if !$(TCL_USE_STATIC_PACKAGES)
diff --git a/win/rules.vc b/win/rules.vc
index 3fa0704..89d7a94 100644
--- a/win/rules.vc
+++ b/win/rules.vc
@@ -686,8 +686,6 @@ LINKERFLAGS = $(LINKERFLAGS) -ltcg
# USE_STUBS - 1 -> compile to use stubs interfaces, 0 -> direct linking
# CONFIG_CHECK - 1 -> check current build configuration against Tcl
# configuration (ignored for Tcl itself)
-# _USE_64BIT_TIME_T - forces a build using 64-bit time_t for 32-bit build
-# (CRT library should support this)
# TCL_UTF_MAX=6 - forces a build using 32-bit Tcl_UniChar in stead of 16-bit.
# Further, LINKERFLAGS are modified based on above.
@@ -748,11 +746,6 @@ TCL_USE_STATIC_PACKAGES = 1
TCL_USE_STATIC_PACKAGES = 0
!endif
-!if [nmakehlp -f $(OPTS) "time64bit"]
-!message *** Force 64-bit time_t
-_USE_64BIT_TIME_T = 1
-!endif
-
!if [nmakehlp -f $(OPTS) "utfmax"]
!message *** Force 32-bit Tcl_UniChar
TCL_UTF_MAX = 6
@@ -1318,9 +1311,6 @@ OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_DO64BIT
OPTDEFINES = $(OPTDEFINES) -DNO_STRTOI64
!endif
-!if "$(_USE_64BIT_TIME_T)" == "1"
-OPTDEFINES = $(OPTDEFINES) -D_USE_64BIT_TIME_T
-!endif
!if "$(TCL_UTF_MAX)" == "6"
OPTDEFINES = $(OPTDEFINES) -DTCL_UTF_MAX=6
!endif
diff --git a/win/tcl.dsp b/win/tcl.dsp
index 065d598..277bb4e 100644
--- a/win/tcl.dsp
+++ b/win/tcl.dsp
@@ -36,7 +36,7 @@ CFG=tcl - Win32 Debug Static
# PROP BASE Intermediate_Dir "Release\tcl_Dynamic"
# PROP BASE Cmd_Line "nmake -nologo -f makefile.vc OPTS=none MSVCDIR=IDE"
# PROP BASE Rebuild_Opt "-a"
-# PROP BASE Target_File "Release\tclsh87.exe"
+# PROP BASE Target_File "Release\tclsh90.exe"
# PROP BASE Bsc_Name ""
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
@@ -45,7 +45,7 @@ CFG=tcl - Win32 Debug Static
# PROP Intermediate_Dir "Release\tcl_Dynamic"
# PROP Cmd_Line "nmake -nologo -f makefile.vc OPTS=threads MSVCDIR=IDE"
# PROP Rebuild_Opt "clean release"
-# PROP Target_File "Release\tclsh87t.exe"
+# PROP Target_File "Release\tclsh90t.exe"
# PROP Bsc_Name ""
# PROP Target_Dir ""
@@ -57,7 +57,7 @@ CFG=tcl - Win32 Debug Static
# PROP BASE Intermediate_Dir "Debug\tcl_Dynamic"
# PROP BASE Cmd_Line "nmake -nologo -f makefile.vc OPTS=symbols MSVCDIR=IDE"
# PROP BASE Rebuild_Opt "-a"
-# PROP BASE Target_File "Debug\tclsh87g.exe"
+# PROP BASE Target_File "Debug\tclsh90g.exe"
# PROP BASE Bsc_Name ""
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
@@ -66,7 +66,7 @@ CFG=tcl - Win32 Debug Static
# PROP Intermediate_Dir "Debug\tcl_Dynamic"
# PROP Cmd_Line "nmake -nologo -f makefile.vc OPTS=threads,symbols MSVCDIR=IDE"
# PROP Rebuild_Opt "clean release"
-# PROP Target_File "Debug\tclsh87tg.exe"
+# PROP Target_File "Debug\tclsh90tg.exe"
# PROP Bsc_Name ""
# PROP Target_Dir ""
@@ -78,7 +78,7 @@ CFG=tcl - Win32 Debug Static
# PROP BASE Intermediate_Dir "Debug\tcl_Static"
# PROP BASE Cmd_Line "nmake -nologo -f makefile.vc OPTS=symbols,static MSVCDIR=IDE"
# PROP BASE Rebuild_Opt "-a"
-# PROP BASE Target_File "Debug\tclsh87sg.exe"
+# PROP BASE Target_File "Debug\tclsh90sg.exe"
# PROP BASE Bsc_Name ""
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
@@ -87,7 +87,7 @@ CFG=tcl - Win32 Debug Static
# PROP Intermediate_Dir "Debug\tcl_Static"
# PROP Cmd_Line "nmake -nologo -f makefile.vc OPTS=symbols,static MSVCDIR=IDE"
# PROP Rebuild_Opt "-a"
-# PROP Target_File "Debug\tclsh87sg.exe"
+# PROP Target_File "Debug\tclsh90sg.exe"
# PROP Bsc_Name ""
# PROP Target_Dir ""
@@ -99,7 +99,7 @@ CFG=tcl - Win32 Debug Static
# PROP BASE Intermediate_Dir "Release\tcl_Static"
# PROP BASE Cmd_Line "nmake -nologo -f makefile.vc OPTS=static MSVCDIR=IDE"
# PROP BASE Rebuild_Opt "-a"
-# PROP BASE Target_File "Release\tclsh87s.exe"
+# PROP BASE Target_File "Release\tclsh90s.exe"
# PROP BASE Bsc_Name ""
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
@@ -108,7 +108,7 @@ CFG=tcl - Win32 Debug Static
# PROP Intermediate_Dir "Release\tcl_Static"
# PROP Cmd_Line "nmake -nologo -f makefile.vc OPTS=static MSVCDIR=IDE"
# PROP Rebuild_Opt "-a"
-# PROP Target_File "Release\tclsh87s.exe"
+# PROP Target_File "Release\tclsh90s.exe"
# PROP Bsc_Name ""
# PROP Target_Dir ""
diff --git a/win/tcl.hpj.in b/win/tcl.hpj.in
index 08d411d..a3d1a49 100644
--- a/win/tcl.hpj.in
+++ b/win/tcl.hpj.in
@@ -5,9 +5,9 @@ HCW=0
LCID=0x409 0x0 0x0 ;English (United States)
REPORT=Yes
TITLE=Tcl/Tk Reference Manual
-CNT=tcl87.cnt
+CNT=tcl90.cnt
COPYRIGHT=Copyright © 2000 Ajuba Solutions
-HLP=tcl87.hlp
+HLP=tcl90.hlp
[FILES]
tcl.rtf
diff --git a/win/tcl.m4 b/win/tcl.m4
index c0dd539..4827905 100644
--- a/win/tcl.m4
+++ b/win/tcl.m4
@@ -993,13 +993,13 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
#------------------------------------------------------------------------
AC_DEFUN([SC_WITH_TCL], [
- if test -d ../../tcl8.7$1/win; then
- TCL_BIN_DEFAULT=../../tcl8.7$1/win
+ if test -d ../../tcl9.0$1/win; then
+ TCL_BIN_DEFAULT=../../tcl9.0$1/win
else
- TCL_BIN_DEFAULT=../../tcl8.7/win
+ TCL_BIN_DEFAULT=../../tcl9.0/win
fi
- AC_ARG_WITH(tcl, [ --with-tcl=DIR use Tcl 8.7 binaries from DIR],
+ AC_ARG_WITH(tcl, [ --with-tcl=DIR use Tcl 9.0 binaries from DIR],
TCL_BIN_DIR=$withval, TCL_BIN_DIR=`cd $TCL_BIN_DEFAULT; pwd`)
if test ! -d $TCL_BIN_DIR; then
AC_MSG_ERROR(Tcl directory $TCL_BIN_DIR does not exist)
diff --git a/win/tclAppInit.c b/win/tclAppInit.c
index fa27756..3292335 100644
--- a/win/tclAppInit.c
+++ b/win/tclAppInit.c
@@ -267,11 +267,10 @@ setargv(
}
}
- /* Make sure we don't call ckalloc through the (not yet initialized) stub table */
+ /* Make sure we don't call Tcl_Alloc through the (not yet initialized) stub table */
# undef Tcl_Alloc
-# undef Tcl_DbCkalloc
- argSpace = ckalloc(size * sizeof(char *)
+ argSpace = Tcl_Alloc(size * sizeof(char *)
+ (_tcslen(cmdLine) * sizeof(TCHAR)) + sizeof(TCHAR));
argv = (TCHAR **) argSpace;
argSpace += size * (sizeof(char *)/sizeof(TCHAR));
diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c
index 9e5885c..4fc97db 100644
--- a/win/tclWin32Dll.c
+++ b/win/tclWin32Dll.c
@@ -255,8 +255,8 @@ TclWinEncodingsCleanup(void)
dlIter = driveLetterLookup;
while (dlIter != NULL) {
dlIter2 = dlIter->nextPtr;
- ckfree(dlIter->volumeName);
- ckfree(dlIter);
+ Tcl_Free(dlIter->volumeName);
+ Tcl_Free(dlIter);
dlIter = dlIter2;
}
Tcl_MutexUnlock(&mountPointMap);
@@ -349,8 +349,8 @@ TclWinDriveLetterForVolMountPoint(
* Now dlPtr2 points to the structure to free.
*/
- ckfree(dlPtr2->volumeName);
- ckfree(dlPtr2);
+ Tcl_Free(dlPtr2->volumeName);
+ Tcl_Free(dlPtr2);
/*
* Restart the loop - we could try to be clever and continue half
@@ -385,7 +385,7 @@ TclWinDriveLetterForVolMountPoint(
}
}
if (!alreadyStored) {
- dlPtr2 = ckalloc(sizeof(MountPointMap));
+ dlPtr2 = Tcl_Alloc(sizeof(MountPointMap));
dlPtr2->volumeName = TclNativeDupInternalRep(Target);
dlPtr2->driveLetter = (char) drive[0];
dlPtr2->nextPtr = driveLetterLookup;
@@ -411,7 +411,7 @@ TclWinDriveLetterForVolMountPoint(
* that fact and store '-1' so we don't have to look it up each time.
*/
- dlPtr2 = ckalloc(sizeof(MountPointMap));
+ dlPtr2 = Tcl_Alloc(sizeof(MountPointMap));
dlPtr2->volumeName = TclNativeDupInternalRep((ClientData) mountPoint);
dlPtr2->driveLetter = -1;
dlPtr2->nextPtr = driveLetterLookup;
@@ -466,8 +466,8 @@ TclWinDriveLetterForVolMountPoint(
WCHAR *
Tcl_WinUtfToTChar(
const char *string, /* Source string in UTF-8. */
- int len, /* Source string length in bytes, or -1 for
- * strlen(). */
+ size_t len, /* Source string length in bytes, or -1
+ * for strlen(). */
Tcl_DString *dsPtr) /* Uninitialized or free DString in which the
* converted string is stored. */
{
@@ -481,8 +481,8 @@ Tcl_WinUtfToTChar(
char *
Tcl_WinTCharToUtf(
const WCHAR *string, /* Source string in Unicode. */
- int len, /* Source string length in bytes, or -1 for
- * platform-specific string length. */
+ size_t len, /* Source string length in bytes, or -1
+ * for platform-specific string length. */
Tcl_DString *dsPtr) /* Uninitialized or free DString in which the
* converted string is stored. */
{
@@ -490,7 +490,7 @@ Tcl_WinTCharToUtf(
if (!string) {
return NULL;
}
- if (len < 0) {
+ if (len == TCL_AUTO_LENGTH) {
len = wcslen((WCHAR *)string);
} else {
len /= 2;
diff --git a/win/tclWinChan.c b/win/tclWinChan.c
index 3b6e4e4..1f9c757 100644
--- a/win/tclWinChan.c
+++ b/win/tclWinChan.c
@@ -267,7 +267,7 @@ FileCheckProc(
infoPtr = infoPtr->nextPtr) {
if (infoPtr->watchMask && !TEST_FLAG(infoPtr->flags, FILE_PENDING)) {
SET_FLAG(infoPtr->flags, FILE_PENDING);
- evPtr = ckalloc(sizeof(FileEvent));
+ evPtr = Tcl_Alloc(sizeof(FileEvent));
evPtr->header.proc = FileEventProc;
evPtr->infoPtr = infoPtr;
Tcl_QueueEvent((Tcl_Event *) evPtr, TCL_QUEUE_TAIL);
@@ -434,7 +434,7 @@ FileCloseProc(
break;
}
}
- ckfree(fileInfoPtr);
+ Tcl_Free(fileInfoPtr);
return errorCode;
}
@@ -1365,7 +1365,7 @@ TclWinOpenFileChannel(
}
}
- infoPtr = ckalloc(sizeof(FileInfo));
+ infoPtr = Tcl_Alloc(sizeof(FileInfo));
/*
* TIP #218. Removed the code inserting the new structure into the global
diff --git a/win/tclWinConsole.c b/win/tclWinConsole.c
index 3668ae3..177837a 100644
--- a/win/tclWinConsole.c
+++ b/win/tclWinConsole.c
@@ -462,7 +462,7 @@ ConsoleCheckProc(
}
if (needEvent) {
- ConsoleEvent *evPtr = ckalloc(sizeof(ConsoleEvent));
+ ConsoleEvent *evPtr = Tcl_Alloc(sizeof(ConsoleEvent));
infoPtr->flags |= CONSOLE_PENDING;
evPtr->header.proc = ConsoleEventProc;
@@ -617,10 +617,10 @@ ConsoleCloseProc(
}
}
if (consolePtr->writeBuf != NULL) {
- ckfree(consolePtr->writeBuf);
+ Tcl_Free(consolePtr->writeBuf);
consolePtr->writeBuf = 0;
}
- ckfree(consolePtr);
+ Tcl_Free(consolePtr);
return errorCode;
}
@@ -784,10 +784,10 @@ ConsoleOutputProc(
*/
if (infoPtr->writeBuf) {
- ckfree(infoPtr->writeBuf);
+ Tcl_Free(infoPtr->writeBuf);
}
infoPtr->writeBufLen = toWrite;
- infoPtr->writeBuf = ckalloc(toWrite);
+ infoPtr->writeBuf = Tcl_Alloc(toWrite);
}
memcpy(infoPtr->writeBuf, buf, toWrite);
infoPtr->toWrite = toWrite;
@@ -1321,7 +1321,7 @@ TclWinOpenConsoleChannel(
* See if a channel with this handle already exists.
*/
- infoPtr = ckalloc(sizeof(ConsoleInfo));
+ infoPtr = Tcl_Alloc(sizeof(ConsoleInfo));
memset(infoPtr, 0, sizeof(ConsoleInfo));
infoPtr->validMask = permissions;
diff --git a/win/tclWinError.c b/win/tclWinError.c
index 18f290f..fc07b3e 100644
--- a/win/tclWinError.c
+++ b/win/tclWinError.c
@@ -381,7 +381,7 @@ TclWinConvertError(
*----------------------------------------------------------------------
*/
-TCL_NORETURN void
+void
tclWinDebugPanic(
const char *format, ...)
{
@@ -413,12 +413,6 @@ tclWinDebugPanic(
fprintf(stderr, "\n");
fflush(stderr);
}
-# if defined(__GNUC__)
- __builtin_trap();
-# else
- DebugBreak();
-# endif
- abort();
}
#endif
/*
diff --git a/win/tclWinFCmd.c b/win/tclWinFCmd.c
index 78489ca..6780328 100644
--- a/win/tclWinFCmd.c
+++ b/win/tclWinFCmd.c
@@ -376,8 +376,8 @@ DoRenameFile(
Tcl_SetErrno(EXDEV);
}
- ckfree(srcArgv);
- ckfree(dstArgv);
+ Tcl_Free((void *)srcArgv);
+ Tcl_Free((void *)dstArgv);
}
/*
@@ -911,8 +911,8 @@ TclpObjCopyDirectory(
return TCL_ERROR;
}
- Tcl_WinUtfToTChar(Tcl_GetString(normSrcPtr), -1, &srcString);
- Tcl_WinUtfToTChar(Tcl_GetString(normDestPtr), -1, &dstString);
+ Tcl_WinUtfToTChar(TclGetString(normSrcPtr), -1, &srcString);
+ Tcl_WinUtfToTChar(TclGetString(normDestPtr), -1, &dstString);
ret = TraverseWinTree(TraversalCopy, &srcString, &dstString, &ds);
@@ -984,7 +984,7 @@ TclpObjRemoveDirectory(
if (normPtr == NULL) {
return TCL_ERROR;
}
- Tcl_WinUtfToTChar(Tcl_GetString(normPtr), -1, &native);
+ Tcl_WinUtfToTChar(TclGetString(normPtr), -1, &native);
ret = DoRemoveDirectory(&native, recursive, &ds);
Tcl_DStringFree(&native);
} else {
@@ -1524,7 +1524,7 @@ GetWinFileAttributes(
* We test for, and fix that case, here.
*/
- int len;
+ size_t len;
const char *str = TclGetStringFromObj(fileName, &len);
if (len < 4) {
@@ -1586,6 +1586,7 @@ ConvertFileNameFormat(
{
int pathc, i;
Tcl_Obj *splitPath;
+ size_t length;
splitPath = Tcl_FSSplitPath(fileName, &pathc);
@@ -1593,7 +1594,7 @@ ConvertFileNameFormat(
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"could not read \"%s\": no such file or directory",
- Tcl_GetString(fileName)));
+ TclGetString(fileName)));
errno = ENOENT;
Tcl_PosixError(interp);
}
@@ -1610,7 +1611,6 @@ ConvertFileNameFormat(
for (i = 0; i < pathc; i++) {
Tcl_Obj *elt;
char *pathv;
- int length;
Tcl_ListObjIndex(NULL, splitPath, i, &elt);
@@ -1884,7 +1884,7 @@ CannotSetAttribute(
{
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"cannot set attribute \"%s\" for file \"%s\": attribute is readonly",
- tclpFileAttrStrings[objIndex], Tcl_GetString(fileName)));
+ tclpFileAttrStrings[objIndex], TclGetString(fileName)));
errno = EINVAL;
Tcl_PosixError(interp);
return TCL_ERROR;
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index 1c4379a..14c4378 100644
--- a/win/tclWinFile.c
+++ b/win/tclWinFile.c
@@ -149,8 +149,8 @@ typedef struct {
* Other typedefs required by this code.
*/
-static time_t ToCTime(FILETIME fileTime);
-static void FromCTime(time_t posixTime, FILETIME *fileTime);
+static __time64_t ToCTime(FILETIME fileTime);
+static void FromCTime(__time64_t posixTime, FILETIME *fileTime);
/*
* Declarations for local functions defined in this file:
@@ -177,7 +177,7 @@ static int WinLink(const WCHAR *LinkSource,
const WCHAR *LinkTarget, int linkAction);
static int WinSymLinkDirectory(const WCHAR *LinkDirectory,
const WCHAR *LinkTarget);
-MODULE_SCOPE TCL_NORETURN void tclWinDebugPanic(const char *format, ...);
+MODULE_SCOPE void tclWinDebugPanic(const char *format, ...);
/*
*--------------------------------------------------------------------
@@ -802,7 +802,7 @@ NativeWriteReparse(
*----------------------------------------------------------------------
*/
-TCL_NORETURN void
+void
tclWinDebugPanic(
const char *format, ...)
{
@@ -832,16 +832,6 @@ tclWinDebugPanic(
MessageBoxW(NULL, msgString, L"Fatal Error",
MB_ICONSTOP | MB_OK | MB_TASKMODAL | MB_SETFOREGROUND);
}
-#if defined(__GNUC__)
- __builtin_trap();
-#elif defined(_WIN64)
- __debugbreak();
-#elif defined(_MSC_VER) && defined (_M_IX86)
- _asm {int 3}
-#else
- DebugBreak();
-#endif
- abort();
}
/*
@@ -869,16 +859,6 @@ TclpFindExecutable(
WCHAR wName[MAX_PATH];
char name[MAX_PATH * 3];
- /*
- * Under Windows we ignore argv0, and return the path for the file used to
- * create this process. Only if it is NULL, install a new panic handler.
- */
-
- if (argv0 == NULL) {
-# undef Tcl_SetPanicProc
- Tcl_SetPanicProc(tclWinDebugPanic);
- }
-
GetModuleFileNameW(NULL, wName, MAX_PATH);
WideCharToMultiByte(CP_UTF8, 0, wName, -1, name, sizeof(name), NULL, NULL);
TclWinNoBackslash(name);
@@ -932,10 +912,10 @@ TclpMatchInDirectory(
* Match a single file directly.
*/
- int len;
DWORD attr;
WIN32_FILE_ATTRIBUTE_DATA data;
- const char *str = TclGetStringFromObj(norm, &len);
+ size_t length = 0;
+ const char *str = TclGetStringFromObj(norm, &length);
native = Tcl_FSGetNativePath(pathPtr);
@@ -945,7 +925,7 @@ TclpMatchInDirectory(
}
attr = data.dwFileAttributes;
- if (NativeMatchType(WinIsDrive(str,len), attr, native, types)) {
+ if (NativeMatchType(WinIsDrive(str, length), attr, native, types)) {
Tcl_ListObjAppendElement(interp, resultPtr, pathPtr);
}
}
@@ -956,7 +936,7 @@ TclpMatchInDirectory(
WIN32_FIND_DATA data;
const char *dirName; /* UTF-8 dir name, later with pattern
* appended. */
- int dirLength;
+ size_t dirLength;
int matchSpecialDots;
Tcl_DString ds; /* Native encoding of dir, also used
* temporarily for other things. */
@@ -2285,7 +2265,7 @@ NativeStatMode(
*
* ToCTime --
*
- * Converts a Windows FILETIME to a time_t in UTC.
+ * Converts a Windows FILETIME to a __time64_t in UTC.
*
* Results:
* Returns the count of seconds from the Posix epoch.
@@ -2293,7 +2273,7 @@ NativeStatMode(
*------------------------------------------------------------------------
*/
-static time_t
+static __time64_t
ToCTime(
FILETIME fileTime) /* UTC time */
{
@@ -2302,7 +2282,7 @@ ToCTime(
convertedTime.LowPart = fileTime.dwLowDateTime;
convertedTime.HighPart = (LONG) fileTime.dwHighDateTime;
- return (time_t) ((convertedTime.QuadPart -
+ return (__time64_t) ((convertedTime.QuadPart -
(Tcl_WideInt) POSIX_EPOCH_AS_FILETIME) / (Tcl_WideInt) 10000000);
}
@@ -2311,7 +2291,7 @@ ToCTime(
*
* FromCTime --
*
- * Converts a time_t to a Windows FILETIME
+ * Converts a __time64_t to a Windows FILETIME
*
* Results:
* Returns the count of 100-ns ticks seconds from the Windows epoch.
@@ -2321,7 +2301,7 @@ ToCTime(
static void
FromCTime(
- time_t posixTime,
+ __time64_t posixTime,
FILETIME *fileTime) /* UTC Time */
{
LARGE_INTEGER convertedTime;
@@ -2468,7 +2448,7 @@ TclpFilesystemPathType(
if (normPath == NULL) {
return NULL;
}
- path = Tcl_GetString(normPath);
+ path = TclGetString(normPath);
if (path == NULL) {
return NULL;
}
@@ -2546,7 +2526,7 @@ TclpObjNormalizePath(
Tcl_DString ds; /* Some workspace. */
Tcl_DStringInit(&dsNorm);
- path = Tcl_GetString(pathPtr);
+ path = TclGetString(pathPtr);
currentPathEndPosition = path + nextCheckpoint;
if (*currentPathEndPosition == '/') {
@@ -2641,12 +2621,12 @@ TclpObjNormalizePath(
* Convert link to forward slashes.
*/
- for (path = Tcl_GetString(to); *path != 0; path++) {
+ for (path = TclGetString(to); *path != 0; path++) {
if (*path == '\\') {
*path = '/';
}
}
- path = Tcl_GetString(to);
+ path = TclGetString(to);
currentPathEndPosition = path + nextCheckpoint;
if (temp != NULL) {
Tcl_DecrRefCount(temp);
@@ -2802,15 +2782,15 @@ TclpObjNormalizePath(
* Not the end of the string.
*/
- int len;
char *path;
Tcl_Obj *tmpPathPtr;
+ size_t length;
tmpPathPtr = Tcl_NewStringObj(Tcl_DStringValue(&ds),
nextCheckpoint);
Tcl_AppendToObj(tmpPathPtr, lastValidPathEnd, -1);
- path = TclGetStringFromObj(tmpPathPtr, &len);
- Tcl_SetStringObj(pathPtr, path, len);
+ path = TclGetStringFromObj(tmpPathPtr, &length);
+ Tcl_SetStringObj(pathPtr, path, length);
Tcl_DecrRefCount(tmpPathPtr);
} else {
/*
@@ -2878,7 +2858,7 @@ TclWinVolumeRelativeNormalize(
* current volume.
*/
- const char *drive = Tcl_GetString(useThisCwd);
+ const char *drive = TclGetString(useThisCwd);
absolutePath = Tcl_NewStringObj(drive,2);
Tcl_AppendToObj(absolutePath, path, -1);
@@ -2893,7 +2873,7 @@ TclWinVolumeRelativeNormalize(
* also on drive C.
*/
- int cwdLen;
+ size_t cwdLen;
const char *drive = TclGetStringFromObj(useThisCwd, &cwdLen);
char drive_cur = path[0];
@@ -2967,7 +2947,7 @@ TclpNativeToNormalized(
{
Tcl_DString ds;
Tcl_Obj *objPtr;
- int len;
+ size_t len;
char *copy, *p;
Tcl_WinTCharToUtf((const WCHAR *) clientData, -1, &ds);
@@ -3029,7 +3009,7 @@ TclNativeCreateNativeRep(
WCHAR *nativePathPtr = NULL;
const char *str;
Tcl_Obj *validPathPtr;
- int len;
+ size_t len;
WCHAR *wp;
if (TclFSCwdIsNative()) {
@@ -3066,9 +3046,9 @@ TclNativeCreateNativeRep(
Tcl_IncrRefCount(validPathPtr);
}
- str = Tcl_GetStringFromObj(validPathPtr, &len);
+ str = TclGetStringFromObj(validPathPtr, &len);
- if (strlen(str) != (size_t) len) {
+ if (strlen(str) != len) {
/*
* String contains NUL-bytes. This is invalid.
*/
@@ -3097,7 +3077,7 @@ TclNativeCreateNativeRep(
* Overallocate 6 chars, making some room for extended paths
*/
- wp = nativePathPtr = ckalloc((len + 6) * sizeof(WCHAR));
+ wp = nativePathPtr = Tcl_Alloc((len + 6) * sizeof(WCHAR));
if (nativePathPtr==0) {
goto done;
}
@@ -3195,7 +3175,7 @@ TclNativeDupInternalRep(
len = sizeof(WCHAR) * (wcslen((const WCHAR *) clientData) + 1);
- copy = ckalloc(len);
+ copy = Tcl_Alloc(len);
memcpy(copy, clientData, len);
return copy;
}
@@ -3311,7 +3291,7 @@ TclWinFileOwned(
bufsz = 0;
GetTokenInformation(token, TokenUser, NULL, 0, &bufsz);
if (bufsz) {
- buf = ckalloc(bufsz);
+ buf = Tcl_Alloc(bufsz);
if (GetTokenInformation(token, TokenUser, buf, bufsz, &bufsz)) {
owned = EqualSid(ownerSid, ((PTOKEN_USER) buf)->User.Sid);
}
@@ -3327,7 +3307,7 @@ TclWinFileOwned(
LocalFree(secd); /* Also frees ownerSid */
}
if (buf) {
- ckfree(buf);
+ Tcl_Free(buf);
}
return (owned != 0); /* Convert non-0 to 1 */
diff --git a/win/tclWinInit.c b/win/tclWinInit.c
index e82d74b..eac4887 100644
--- a/win/tclWinInit.c
+++ b/win/tclWinInit.c
@@ -181,14 +181,14 @@ TclpInitPlatform(void)
void
TclpInitLibraryPath(
char **valuePtr,
- unsigned int *lengthPtr,
+ size_t *lengthPtr,
Tcl_Encoding *encodingPtr)
{
#define LIBRARY_SIZE 64
Tcl_Obj *pathPtr;
char installLib[LIBRARY_SIZE];
const char *bytes;
- int length;
+ size_t length;
pathPtr = Tcl_NewObj();
@@ -226,7 +226,7 @@ TclpInitLibraryPath(
*encodingPtr = NULL;
bytes = TclGetStringFromObj(pathPtr, &length);
*lengthPtr = length++;
- *valuePtr = ckalloc(length);
+ *valuePtr = Tcl_Alloc(length);
memcpy(*valuePtr, bytes, length);
Tcl_DecrRefCount(pathPtr);
}
@@ -317,7 +317,7 @@ AppendEnvironment(
objPtr = Tcl_NewStringObj(buf, -1);
}
Tcl_ListObjAppendElement(NULL, pathPtr, objPtr);
- ckfree(pathv);
+ Tcl_Free((void *)pathv);
}
}
@@ -341,7 +341,7 @@ AppendEnvironment(
static void
InitializeDefaultLibraryDir(
char **valuePtr,
- unsigned int *lengthPtr,
+ size_t *lengthPtr,
Tcl_Encoding *encodingPtr)
{
HMODULE hModule = TclWinGetTclInstance();
@@ -363,7 +363,7 @@ InitializeDefaultLibraryDir(
TclWinNoBackslash(name);
sprintf(end + 1, "lib/tcl%s", TCL_VERSION);
*lengthPtr = strlen(name);
- *valuePtr = ckalloc(*lengthPtr + 1);
+ *valuePtr = Tcl_Alloc(*lengthPtr + 1);
*encodingPtr = NULL;
memcpy(*valuePtr, name, *lengthPtr + 1);
}
@@ -389,7 +389,7 @@ InitializeDefaultLibraryDir(
static void
InitializeSourceLibraryDir(
char **valuePtr,
- unsigned int *lengthPtr,
+ size_t *lengthPtr,
Tcl_Encoding *encodingPtr)
{
HMODULE hModule = TclWinGetTclInstance();
@@ -411,7 +411,7 @@ InitializeSourceLibraryDir(
TclWinNoBackslash(name);
sprintf(end + 1, "../library");
*lengthPtr = strlen(name);
- *valuePtr = ckalloc(*lengthPtr + 1);
+ *valuePtr = Tcl_Alloc(*lengthPtr + 1);
*encodingPtr = NULL;
memcpy(*valuePtr, name, *lengthPtr + 1);
}
@@ -608,9 +608,10 @@ TclpSetVariables(
*
* Results:
* The return value is the index in environ of an entry with the name
- * "name", or -1 if there is no such entry. The integer at *lengthPtr is
- * filled in with the length of name (if a matching entry is found) or
- * the length of the environ array (if no matching entry is found).
+ * "name", or TCL_IO_FAILURE if there is no such entry. The integer
+ * at *lengthPtr is filled in with the length of name (if a matching
+ * entry is found) or the length of the environ array (if no
+ * matching entry is found).
*
* Side effects:
* None.
@@ -618,16 +619,16 @@ TclpSetVariables(
*----------------------------------------------------------------------
*/
-int
+size_t
TclpFindVariable(
const char *name, /* Name of desired environment variable
* (UTF-8). */
- int *lengthPtr) /* Used to return length of name (for
+ size_t *lengthPtr) /* Used to return length of name (for
* successful searches) or number of non-NULL
* entries in environ (for unsuccessful
* searches). */
{
- int i, length, result = -1;
+ size_t i, length, result = TCL_IO_FAILURE;
const char *env, *p1, *p2;
char *envUpper, *nameUpper;
Tcl_DString envString;
@@ -637,7 +638,7 @@ TclpFindVariable(
*/
length = strlen(name);
- nameUpper = ckalloc(length + 1);
+ nameUpper = Tcl_Alloc(length + 1);
memcpy(nameUpper, name, length+1);
Tcl_UtfToUpper(nameUpper);
@@ -654,7 +655,7 @@ TclpFindVariable(
if (p1 == NULL) {
continue;
}
- length = (int) (p1 - envUpper);
+ length = p1 - envUpper;
Tcl_DStringSetLength(&envString, length+1);
Tcl_UtfToUpper(envUpper);
@@ -676,7 +677,7 @@ TclpFindVariable(
done:
Tcl_DStringFree(&envString);
- ckfree(nameUpper);
+ Tcl_Free(nameUpper);
return result;
}
diff --git a/win/tclWinInt.h b/win/tclWinInt.h
index 07c1b9e..f019744 100644
--- a/win/tclWinInt.h
+++ b/win/tclWinInt.h
@@ -85,12 +85,12 @@ typedef struct TclPipeThreadInfo {
* to do read/write operation. Additionally
* used as signal to stop (state set to -1) */
volatile LONG state; /* Indicates current state of the thread */
- ClientData clientData; /* Referenced data of the main thread */
+ void *clientData; /* Referenced data of the main thread */
HANDLE evWakeUp; /* Optional wake-up event worker set by shutdown */
} TclPipeThreadInfo;
-/* If pipe-workers will use some tcl subsystem, we can use ckalloc without
+/* If pipe-workers will use some tcl subsystem, we can use Tcl_Alloc without
* more overhead for finalize thread (should be executed anyway)
*
* #define _PTI_USE_CKALLOC 1
@@ -112,7 +112,7 @@ typedef struct TclPipeThreadInfo {
MODULE_SCOPE
TclPipeThreadInfo * TclPipeThreadCreateTI(TclPipeThreadInfo **pipeTIPtr,
- ClientData clientData, HANDLE wakeEvent);
+ void *clientData, HANDLE wakeEvent);
MODULE_SCOPE int TclPipeThreadWaitForSignal(TclPipeThreadInfo **pipeTIPtr);
static inline void
diff --git a/win/tclWinLoad.c b/win/tclWinLoad.c
index dc673d2..be6299c 100644
--- a/win/tclWinLoad.c
+++ b/win/tclWinLoad.c
@@ -95,7 +95,7 @@ TclpDlopen(
firstError = (nativeName == NULL) ?
ERROR_MOD_NOT_FOUND : GetLastError();
- nativeName = Tcl_WinUtfToTChar(Tcl_GetString(pathPtr), -1, &ds);
+ nativeName = Tcl_WinUtfToTChar(TclGetString(pathPtr), -1, &ds);
hInstance = LoadLibraryEx(nativeName, NULL,
LOAD_WITH_ALTERED_SEARCH_PATH);
Tcl_DStringFree(&ds);
@@ -117,7 +117,7 @@ TclpDlopen(
lastError = firstError;
errMsg = Tcl_ObjPrintf("couldn't load library \"%s\": ",
- Tcl_GetString(pathPtr));
+ TclGetString(pathPtr));
/*
* Check for possible DLL errors. This doesn't work quite right,
@@ -170,7 +170,7 @@ TclpDlopen(
* Succeded; package everything up for Tcl.
*/
- handlePtr = ckalloc(sizeof(struct Tcl_LoadHandle_));
+ handlePtr = Tcl_Alloc(sizeof(struct Tcl_LoadHandle_));
handlePtr->clientData = (ClientData) hInstance;
handlePtr->findSymbolProcPtr = &FindSymbol;
handlePtr->unloadFileProcPtr = &UnloadFile;
@@ -255,7 +255,7 @@ UnloadFile(
HINSTANCE hInstance = (HINSTANCE) loadHandle->clientData;
FreeLibrary(hInstance);
- ckfree(loadHandle);
+ Tcl_Free(loadHandle);
}
/*
@@ -416,7 +416,7 @@ InitDLLDirectoryName(void)
*/
copyToGlobalBuffer:
- dllDirectoryName = ckalloc((nameLen+1) * sizeof(WCHAR));
+ dllDirectoryName = Tcl_Alloc((nameLen+1) * sizeof(WCHAR));
wcscpy(dllDirectoryName, name);
return TCL_OK;
}
diff --git a/win/tclWinPanic.c b/win/tclWinPanic.c
index fbd3e46..85945e3 100644
--- a/win/tclWinPanic.c
+++ b/win/tclWinPanic.c
@@ -1,4 +1,4 @@
-/*
+ /*
* tclWinPanic.c --
*
* Contains the Windows-specific command-line panic proc.
@@ -28,7 +28,7 @@
*----------------------------------------------------------------------
*/
-void
+TCL_NORETURN1 void
Tcl_ConsolePanic(
const char *format, ...)
{
diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c
index a001816..6d8d4aa 100644
--- a/win/tclWinPipe.c
+++ b/win/tclWinPipe.c
@@ -61,7 +61,7 @@ typedef struct {
typedef struct ProcInfo {
HANDLE hProcess;
- DWORD dwProcessId;
+ size_t dwProcessId;
struct ProcInfo *nextPtr;
} ProcInfo;
@@ -402,7 +402,7 @@ PipeCheckProc(
if (needEvent) {
infoPtr->flags |= PIPE_PENDING;
- evPtr = ckalloc(sizeof(PipeEvent));
+ evPtr = Tcl_Alloc(sizeof(PipeEvent));
evPtr->header.proc = PipeEventProc;
evPtr->infoPtr = infoPtr;
Tcl_QueueEvent((Tcl_Event *) evPtr, TCL_QUEUE_TAIL);
@@ -433,7 +433,7 @@ TclWinMakeFile(
{
WinFile *filePtr;
- filePtr = ckalloc(sizeof(WinFile));
+ filePtr = Tcl_Alloc(sizeof(WinFile));
filePtr->type = WIN_FILE;
filePtr->handle = handle;
@@ -825,7 +825,7 @@ TclpCloseFile(
if (filePtr->handle != NULL &&
CloseHandle(filePtr->handle) == FALSE) {
TclWinConvertError(GetLastError());
- ckfree(filePtr);
+ Tcl_Free(filePtr);
return -1;
}
}
@@ -835,7 +835,7 @@ TclpCloseFile(
Tcl_Panic("TclpCloseFile: unexpected file type");
}
- ckfree(filePtr);
+ Tcl_Free(filePtr);
return 0;
}
@@ -850,7 +850,7 @@ TclpCloseFile(
* Results:
* Returns the process id for the child process. If the pid was not known
* by Tcl, either because the pid was not created by Tcl or the child
- * process has already been reaped, -1 is returned.
+ * process has already been reaped, TCL_IO_FAILURE is returned.
*
* Side effects:
* None.
@@ -858,7 +858,7 @@ TclpCloseFile(
*--------------------------------------------------------------------------
*/
-int
+size_t
TclpGetPid(
Tcl_Pid pid) /* The HANDLE of the child process. */
{
@@ -868,13 +868,13 @@ TclpGetPid(
Tcl_MutexLock(&pipeMutex);
for (infoPtr = procList; infoPtr != NULL; infoPtr = infoPtr->nextPtr) {
- if (infoPtr->dwProcessId == (DWORD) (size_t) pid) {
+ if (infoPtr->dwProcessId == (size_t) pid) {
Tcl_MutexUnlock(&pipeMutex);
return infoPtr->dwProcessId;
}
}
Tcl_MutexUnlock(&pipeMutex);
- return (unsigned long) -1;
+ return TCL_IO_FAILURE;
}
/*
@@ -1758,7 +1758,7 @@ TclpCreateCommandChannel(
Tcl_Pid *pidPtr) /* An array of process identifiers. */
{
char channelName[16 + TCL_INTEGER_SPACE];
- PipeInfo *infoPtr = ckalloc(sizeof(PipeInfo));
+ PipeInfo *infoPtr = Tcl_Alloc(sizeof(PipeInfo));
PipeInit();
@@ -1916,13 +1916,13 @@ TclGetAndDetachPids(
TclNewObj(pidsObj);
for (i = 0; i < pipePtr->numPids; i++) {
Tcl_ListObjAppendElement(NULL, pidsObj,
- Tcl_NewWideIntObj((unsigned)
+ Tcl_NewWideIntObj(
TclpGetPid(pipePtr->pidPtr[i])));
Tcl_DetachPids(1, &pipePtr->pidPtr[i]);
}
Tcl_SetObjResult(interp, pidsObj);
if (pipePtr->numPids > 0) {
- ckfree(pipePtr->pidPtr);
+ Tcl_Free(pipePtr->pidPtr);
pipePtr->numPids = 0;
}
}
@@ -2109,7 +2109,7 @@ PipeClose2Proc(
errChan = Tcl_MakeFileChannel((ClientData) filePtr->handle,
TCL_READABLE);
- ckfree(filePtr);
+ Tcl_Free(filePtr);
} else {
errChan = NULL;
}
@@ -2119,14 +2119,14 @@ PipeClose2Proc(
}
if (pipePtr->numPids > 0) {
- ckfree(pipePtr->pidPtr);
+ Tcl_Free(pipePtr->pidPtr);
}
if (pipePtr->writeBuf != NULL) {
- ckfree(pipePtr->writeBuf);
+ Tcl_Free(pipePtr->writeBuf);
}
- ckfree(pipePtr);
+ Tcl_Free(pipePtr);
if (errorCode == 0) {
return result;
@@ -2295,10 +2295,10 @@ PipeOutputProc(
*/
if (infoPtr->writeBuf) {
- ckfree(infoPtr->writeBuf);
+ Tcl_Free(infoPtr->writeBuf);
}
infoPtr->writeBufLen = toWrite;
- infoPtr->writeBuf = ckalloc(toWrite);
+ infoPtr->writeBuf = Tcl_Alloc(toWrite);
}
memcpy(infoPtr->writeBuf, buf, toWrite);
infoPtr->toWrite = toWrite;
@@ -2560,7 +2560,7 @@ Tcl_WaitPid(
prevPtrPtr = &procList;
for (infoPtr = procList; infoPtr != NULL;
prevPtrPtr = &infoPtr->nextPtr, infoPtr = infoPtr->nextPtr) {
- if (infoPtr->dwProcessId == (DWORD) (size_t) pid) {
+ if (infoPtr->dwProcessId == (size_t) pid) {
*prevPtrPtr = infoPtr->nextPtr;
break;
}
@@ -2678,7 +2678,7 @@ Tcl_WaitPid(
*/
CloseHandle(infoPtr->hProcess);
- ckfree(infoPtr);
+ Tcl_Free(infoPtr);
return result;
}
@@ -2704,9 +2704,9 @@ Tcl_WaitPid(
void
TclWinAddProcess(
void *hProcess, /* Handle to process */
- unsigned long id) /* Global process identifier */
+ size_t id) /* Global process identifier */
{
- ProcInfo *procPtr = ckalloc(sizeof(ProcInfo));
+ ProcInfo *procPtr = Tcl_Alloc(sizeof(ProcInfo));
PipeInit();
@@ -2756,7 +2756,7 @@ Tcl_PidObjCmd(
if (objc == 1) {
Tcl_SetObjResult(interp, Tcl_NewWideIntObj((unsigned) getpid()));
} else {
- chan = Tcl_GetChannel(interp, Tcl_GetString(objv[1]),
+ chan = Tcl_GetChannel(interp, TclGetString(objv[1]),
NULL);
if (chan == (Tcl_Channel) NULL) {
return TCL_ERROR;
@@ -3193,7 +3193,8 @@ TclpOpenTemporaryFile(
char *namePtr;
HANDLE handle;
DWORD flags = FILE_ATTRIBUTE_TEMPORARY;
- int length, counter, counter2;
+ size_t length;
+ int counter, counter2;
Tcl_DString buf;
if (!resultingNameObj) {
@@ -3281,7 +3282,7 @@ TclPipeThreadCreateTI(
#ifndef _PTI_USE_CKALLOC
pipeTI = malloc(sizeof(TclPipeThreadInfo));
#else
- pipeTI = ckalloc(sizeof(TclPipeThreadInfo));
+ pipeTI = Tcl_Alloc(sizeof(TclPipeThreadInfo));
#endif /* !_PTI_USE_CKALLOC */
pipeTI->evControl = CreateEvent(NULL, FALSE, FALSE, NULL);
pipeTI->state = PTI_STATE_IDLE;
@@ -3643,7 +3644,7 @@ TclPipeThreadStop(
#ifndef _PTI_USE_CKALLOC
free(pipeTI);
#else
- ckfree(pipeTI);
+ Tcl_Free(pipeTI);
#endif /* !_PTI_USE_CKALLOC */
}
}
@@ -3693,7 +3694,7 @@ TclPipeThreadExit(
#ifndef _PTI_USE_CKALLOC
free(pipeTI);
#else
- ckfree(pipeTI);
+ Tcl_Free(pipeTI);
/* be sure all subsystems used are finalized */
Tcl_FinalizeThread();
#endif /* !_PTI_USE_CKALLOC */
diff --git a/win/tclWinPort.h b/win/tclWinPort.h
index 3f8b546..5bcf76c 100644
--- a/win/tclWinPort.h
+++ b/win/tclWinPort.h
@@ -14,20 +14,14 @@
#ifndef _TCLWINPORT
#define _TCLWINPORT
-/* define _USE_64BIT_TIME_T (or make/configure option time64bit) to force 64-bit time_t */
-#if defined(_USE_64BIT_TIME_T)
-#define __MINGW_USE_VC2005_COMPAT
-#endif
-
-#if !defined(_WIN64) && !defined(__MINGW_USE_VC2005_COMPAT) && defined(BUILD_tcl)
-/* See [Bug 3354324]: file mtime sets wrong time */
-# define _USE_32BIT_TIME_T
+#if !defined(_WIN64) && defined(BUILD_tcl)
+# define __MINGW_USE_VC2005_COMPAT
#endif
/*
* We must specify the lower version we intend to support.
*
- * WINVER = 0x0500 means Windows 2000 and above
+ * WINVER = 0x0501 means Windows XP and above
*/
#ifndef WINVER
@@ -533,7 +527,7 @@ typedef DWORD_PTR * PDWORD_PTR;
* use by tclAlloc.c.
*/
-#define TclpSysAlloc(size, isBin) ((void*)HeapAlloc(GetProcessHeap(), \
+#define TclpSysAlloc(size) ((void*)HeapAlloc(GetProcessHeap(), \
(DWORD)0, (DWORD)size))
#define TclpSysFree(ptr) (HeapFree(GetProcessHeap(), \
(DWORD)0, (HGLOBAL)ptr))
@@ -549,7 +543,7 @@ typedef DWORD_PTR * PDWORD_PTR;
* address platform-specific issues.
*/
-#define TclpReleaseFile(file) ckfree(file)
+#define TclpReleaseFile(file) Tcl_Free(file)
/*
* The following macros and declarations wrap the C runtime library
@@ -566,7 +560,4 @@ typedef DWORD_PTR * PDWORD_PTR;
# define LABEL_SECURITY_INFORMATION (0x00000010L)
#endif
-#define Tcl_DirEntry void
-#define TclDIR void
-
#endif /* _TCLWINPORT */
diff --git a/win/tclWinSerial.c b/win/tclWinSerial.c
index 934ee0e..9f559e6 100644
--- a/win/tclWinSerial.c
+++ b/win/tclWinSerial.c
@@ -531,7 +531,7 @@ SerialCheckProc(
if (needEvent) {
infoPtr->flags |= SERIAL_PENDING;
- evPtr = ckalloc(sizeof(SerialEvent));
+ evPtr = Tcl_Alloc(sizeof(SerialEvent));
evPtr->header.proc = SerialEventProc;
evPtr->infoPtr = infoPtr;
Tcl_QueueEvent((Tcl_Event *) evPtr, TCL_QUEUE_TAIL);
@@ -662,10 +662,10 @@ SerialCloseProc(
*/
if (serialPtr->writeBuf != NULL) {
- ckfree(serialPtr->writeBuf);
+ Tcl_Free(serialPtr->writeBuf);
serialPtr->writeBuf = NULL;
}
- ckfree(serialPtr);
+ Tcl_Free(serialPtr);
if (errorCode == 0) {
return result;
@@ -1027,10 +1027,10 @@ SerialOutputProc(
*/
if (infoPtr->writeBuf) {
- ckfree(infoPtr->writeBuf);
+ Tcl_Free(infoPtr->writeBuf);
}
infoPtr->writeBufLen = toWrite;
- infoPtr->writeBuf = ckalloc(toWrite);
+ infoPtr->writeBuf = Tcl_Alloc(toWrite);
}
memcpy(infoPtr->writeBuf, buf, toWrite);
infoPtr->toWrite = toWrite;
@@ -1447,7 +1447,7 @@ TclWinOpenSerialChannel(
SerialInit();
- infoPtr = ckalloc(sizeof(SerialInfo));
+ infoPtr = Tcl_Alloc(sizeof(SerialInfo));
memset(infoPtr, 0, sizeof(SerialInfo));
infoPtr->validMask = permissions;
@@ -1773,7 +1773,7 @@ SerialSetOptionProc(
" two elements with each a single 8-bit character", -1));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "XCHAR", NULL);
}
- ckfree(argv);
+ Tcl_Free((void *)argv);
return TCL_ERROR;
}
@@ -1804,7 +1804,7 @@ SerialSetOptionProc(
}
dcb.XoffChar = (char) character;
}
- ckfree(argv);
+ Tcl_Free((void *)argv);
if (!SetCommState(infoPtr->handle, &dcb)) {
goto setStateFailed;
@@ -1829,7 +1829,7 @@ SerialSetOptionProc(
"a list of signal,value pairs", value));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "TTYCONTROL", NULL);
}
- ckfree(argv);
+ Tcl_Free((void *)argv);
return TCL_ERROR;
}
@@ -1887,7 +1887,7 @@ SerialSetOptionProc(
}
}
- ckfree(argv);
+ Tcl_Free((void *)argv);
return result;
}
@@ -1913,7 +1913,7 @@ SerialSetOptionProc(
inSize = atoi(argv[0]);
outSize = atoi(argv[1]);
}
- ckfree(argv);
+ Tcl_Free((void *)argv);
if ((argc < 1) || (argc > 2) || (inSize <= 0) || (outSize <= 0)) {
if (interp != NULL) {
diff --git a/win/tclWinSock.c b/win/tclWinSock.c
index d52edc3..5cb19e9 100644
--- a/win/tclWinSock.c
+++ b/win/tclWinSock.c
@@ -360,7 +360,7 @@ printaddrinfolist(
void
InitializeHostName(
char **valuePtr,
- unsigned int *lengthPtr,
+ size_t *lengthPtr,
Tcl_Encoding *encodingPtr)
{
WCHAR tbuf[MAX_COMPUTERNAME_LENGTH + 1];
@@ -397,7 +397,7 @@ InitializeHostName(
*encodingPtr = Tcl_GetEncoding(NULL, "utf-8");
*lengthPtr = Tcl_DStringLength(&ds);
- *valuePtr = ckalloc(*lengthPtr + 1);
+ *valuePtr = Tcl_Alloc(*lengthPtr + 1);
memcpy(*valuePtr, Tcl_DStringValue(&ds), *lengthPtr + 1);
Tcl_DStringFree(&ds);
}
@@ -1066,7 +1066,7 @@ TcpCloseProc(
TclWinConvertError((DWORD) WSAGetLastError());
errorCode = Tcl_GetErrno();
}
- ckfree(thisfd);
+ Tcl_Free(thisfd);
}
}
@@ -1108,7 +1108,7 @@ TcpCloseProc(
* fear of damaging the list.
*/
- ckfree(statePtr);
+ Tcl_Free(statePtr);
return errorCode;
}
@@ -2722,7 +2722,7 @@ SocketCheckProc(
statePtr->watchEvents | FD_CONNECT | FD_ACCEPT)
&& !GOT_BITS(statePtr->flags, SOCKET_PENDING)) {
SET_BITS(statePtr->flags, SOCKET_PENDING);
- evPtr = ckalloc(sizeof(SocketEvent));
+ evPtr = Tcl_Alloc(sizeof(SocketEvent));
evPtr->header.proc = SocketEventProc;
evPtr->socket = statePtr->sockets->fd;
Tcl_QueueEvent((Tcl_Event *) evPtr, TCL_QUEUE_TAIL);
@@ -2997,7 +2997,7 @@ AddSocketInfoFd(
* Add the first FD.
*/
- statePtr->sockets = ckalloc(sizeof(TcpFdList));
+ statePtr->sockets = Tcl_Alloc(sizeof(TcpFdList));
fds = statePtr->sockets;
} else {
/*
@@ -3008,7 +3008,7 @@ AddSocketInfoFd(
fds = fds->next;
}
- fds->next = ckalloc(sizeof(TcpFdList));
+ fds->next = Tcl_Alloc(sizeof(TcpFdList));
fds = fds->next;
}
@@ -3041,7 +3041,7 @@ AddSocketInfoFd(
static TcpState *
NewSocketInfo(SOCKET socket)
{
- TcpState *statePtr = ckalloc(sizeof(TcpState));
+ TcpState *statePtr = Tcl_Alloc(sizeof(TcpState));
memset(statePtr, 0, sizeof(TcpState));
@@ -3404,68 +3404,6 @@ FindFDInList(
/*
*----------------------------------------------------------------------
*
- * TclWinGetSockOpt, et al. --
- *
- * Those functions are historically exported by the stubs table and
- * just use the original system calls now.
- *
- * Warning:
- * Those functions are depreciated and will be removed with TCL 9.0.
- *
- * Results:
- * As defined for each function.
- *
- * Side effects:
- * As defined for each function.
- *
- *----------------------------------------------------------------------
- */
-
-#ifndef TCL_NO_DEPRECATED
-#undef TclWinGetSockOpt
-int
-TclWinGetSockOpt(
- SOCKET s,
- int level,
- int optname,
- char *optval,
- int *optlen)
-{
-
- return getsockopt(s, level, optname, optval, optlen);
-}
-#undef TclWinSetSockOpt
-int
-TclWinSetSockOpt(
- SOCKET s,
- int level,
- int optname,
- const char *optval,
- int optlen)
-{
- return setsockopt(s, level, optname, optval, optlen);
-}
-
-#undef TclpInetNtoa
-char *
-TclpInetNtoa(
- struct in_addr addr)
-{
- return inet_ntoa(addr);
-}
-#undef TclWinGetServByName
-struct servent *
-TclWinGetServByName(
- const char *name,
- const char *proto)
-{
- return getservbyname(name, proto);
-}
-#endif /* TCL_NO_DEPRECATED */
-
-/*
- *----------------------------------------------------------------------
- *
* TcpThreadActionProc --
*
* Insert or remove any thread local refs to this channel.
diff --git a/win/tclWinTest.c b/win/tclWinTest.c
index c06f10a..56aedbc 100644
--- a/win/tclWinTest.c
+++ b/win/tclWinTest.c
@@ -41,8 +41,6 @@ static int TestwinclockCmd(ClientData dummy, Tcl_Interp* interp,
int objc, Tcl_Obj *const objv[]);
static int TestwinsleepCmd(ClientData dummy, Tcl_Interp* interp,
int objc, Tcl_Obj *const objv[]);
-static int TestSizeCmd(ClientData dummy, Tcl_Interp* interp,
- int objc, Tcl_Obj *const objv[]);
static Tcl_ObjCmdProc TestExceptionCmd;
static int TestplatformChmod(const char *nativePath, int pmode);
static int TestchmodCmd(ClientData dummy, Tcl_Interp* interp,
@@ -80,7 +78,6 @@ TclplatformtestInit(
Tcl_CreateObjCommand(interp, "testwinclock", TestwinclockCmd, NULL, NULL);
Tcl_CreateObjCommand(interp, "testwinsleep", TestwinsleepCmd, NULL, NULL);
Tcl_CreateObjCommand(interp, "testexcept", TestExceptionCmd, NULL, NULL);
- Tcl_CreateObjCommand(interp, "testsize", TestSizeCmd, NULL, NULL);
return TCL_OK;
}
@@ -313,26 +310,6 @@ TestwinsleepCmd(
return TCL_OK;
}
-static int
-TestSizeCmd(
- ClientData clientData, /* Unused */
- Tcl_Interp* interp, /* Tcl interpreter */
- int objc, /* Parameter count */
- Tcl_Obj *const * objv) /* Parameter vector */
-{
- if (objc != 2) {
- goto syntax;
- }
- if (strcmp(Tcl_GetString(objv[1]), "time_t") == 0) {
- Tcl_SetObjResult(interp, Tcl_NewWideIntObj(sizeof(time_t)));
- return TCL_OK;
- }
-
-syntax:
- Tcl_WrongNumArgs(interp, 1, objv, "time_t");
- return TCL_ERROR;
-}
-
/*
*----------------------------------------------------------------------
*
@@ -488,7 +465,7 @@ TestplatformChmod(
goto done;
}
- secDesc = ckalloc(secDescLen);
+ secDesc = Tcl_Alloc(secDescLen);
if (!GetFileSecurityA(nativePath, infoBits,
(PSECURITY_DESCRIPTOR) secDesc, secDescLen, &secDescLen2)
|| (secDescLen < secDescLen2)) {
@@ -500,7 +477,7 @@ TestplatformChmod(
* Get the World SID.
*/
- userSid = ckalloc(GetSidLengthRequired((UCHAR) 1));
+ userSid = Tcl_Alloc(GetSidLengthRequired((UCHAR) 1));
InitializeSid(userSid, &userSidAuthority, (BYTE) 1);
*(GetSidSubAuthority(userSid, 0)) = SECURITY_WORLD_RID;
@@ -526,7 +503,7 @@ TestplatformChmod(
newAclSize = ACLSize.AclBytesInUse + sizeof(ACCESS_DENIED_ACE)
+ GetLengthSid(userSid) - sizeof(DWORD);
- newAcl = ckalloc(newAclSize);
+ newAcl = Tcl_Alloc(newAclSize);
/*
* Initialize the new ACL.
@@ -603,16 +580,16 @@ TestplatformChmod(
done:
if (secDesc) {
- ckfree(secDesc);
+ Tcl_Free(secDesc);
}
if (newAcl) {
- ckfree(newAcl);
+ Tcl_Free(newAcl);
}
if (userSid) {
- ckfree(userSid);
+ Tcl_Free(userSid);
}
if (userDomain) {
- ckfree(userDomain);
+ Tcl_Free(userDomain);
}
if (res != 0) {
diff --git a/win/tclWinThrd.c b/win/tclWinThrd.c
index d169ebb..199d685 100644
--- a/win/tclWinThrd.c
+++ b/win/tclWinThrd.c
@@ -178,7 +178,7 @@ TclWinThreadStart(
lpOrigStartAddress = winThreadPtr->lpStartAddress;
lpOrigParameter = winThreadPtr->lpParameter;
- ckfree(winThreadPtr);
+ Tcl_Free(winThreadPtr);
return lpOrigStartAddress(lpOrigParameter);
}
@@ -204,14 +204,14 @@ TclpThreadCreate(
Tcl_ThreadId *idPtr, /* Return, the ID of the thread. */
Tcl_ThreadCreateProc *proc, /* Main() function of the thread. */
ClientData clientData, /* The one argument to Main(). */
- int stackSize, /* Size of stack for the new thread. */
+ size_t stackSize, /* Size of stack for the new thread. */
int flags) /* Flags controlling behaviour of the new
* thread. */
{
WinThread *winThreadPtr; /* Per-thread startup info */
HANDLE tHandle;
- winThreadPtr = (WinThread *)ckalloc(sizeof(WinThread));
+ winThreadPtr = (WinThread *)Tcl_Alloc(sizeof(WinThread));
winThreadPtr->lpStartAddress = (LPTHREAD_START_ROUTINE) proc;
winThreadPtr->lpParameter = clientData;
winThreadPtr->fpControl = _controlfp(0, 0);
@@ -568,7 +568,7 @@ Tcl_MutexLock(
*/
if (*mutexPtr == NULL) {
- csPtr = ckalloc(sizeof(CRITICAL_SECTION));
+ csPtr = Tcl_Alloc(sizeof(CRITICAL_SECTION));
InitializeCriticalSection(csPtr);
*mutexPtr = (Tcl_Mutex)csPtr;
TclRememberMutex(mutexPtr);
@@ -629,7 +629,7 @@ TclpFinalizeMutex(
if (csPtr != NULL) {
DeleteCriticalSection(csPtr);
- ckfree(csPtr);
+ Tcl_Free(csPtr);
*mutexPtr = NULL;
}
}
@@ -711,7 +711,7 @@ Tcl_ConditionWait(
*/
if (*condPtr == NULL) {
- winCondPtr = ckalloc(sizeof(WinCondition));
+ winCondPtr = Tcl_Alloc(sizeof(WinCondition));
InitializeCriticalSection(&winCondPtr->condLock);
winCondPtr->firstPtr = NULL;
winCondPtr->lastPtr = NULL;
@@ -922,7 +922,7 @@ TclpFinalizeCondition(
if (winCondPtr != NULL) {
DeleteCriticalSection(&winCondPtr->condLock);
- ckfree(winCondPtr);
+ Tcl_Free(winCondPtr);
*condPtr = NULL;
}
}
@@ -1037,7 +1037,7 @@ TclpThreadCreateKey(void)
{
DWORD *key;
- key = TclpSysAlloc(sizeof *key, 0);
+ key = TclpSysAlloc(sizeof *key);
if (key == NULL) {
Tcl_Panic("unable to allocate thread key!");
}
diff --git a/win/tclWinTime.c b/win/tclWinTime.c
index f103a4f..07498b0 100644
--- a/win/tclWinTime.c
+++ b/win/tclWinTime.c
@@ -12,10 +12,6 @@
#include "tclInt.h"
-#define SECSPERDAY (60L * 60L * 24L)
-#define SECSPERYEAR (SECSPERDAY * 365L)
-#define SECSPER4YEAR (SECSPERYEAR * 4L + SECSPERDAY)
-
/*
* Number of samples over which to estimate the performance counter.
*/
@@ -23,27 +19,6 @@
#define SAMPLES 64
/*
- * The following arrays contain the day of year for the last day of each
- * month, where index 1 is January.
- */
-
-#ifndef TCL_NO_DEPRECATED
-static const int normalDays[] = {
- -1, 30, 58, 89, 119, 150, 180, 211, 242, 272, 303, 333, 364
-};
-
-static const int leapDays[] = {
- -1, 30, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365
-};
-
-typedef struct {
- char tzName[64]; /* Time zone name */
- struct tm tm; /* time information */
-} ThreadSpecificData;
-static Tcl_ThreadDataKey dataKey;
-#endif /* TCL_NO_DEPRECATED */
-
-/*
* Data for managing high-resolution timers.
*/
@@ -131,9 +106,6 @@ static struct {
* Declarations for functions defined later in this file.
*/
-#ifndef TCL_NO_DEPRECATED
-static struct tm * ComputeGMT(const time_t *tp);
-#endif /* TCL_NO_DEPRECATED */
static void StopCalibration(ClientData clientData);
static DWORD WINAPI CalibrationThread(LPVOID arg);
static void UpdateTimeEachSecond(void);
@@ -172,7 +144,7 @@ ClientData tclTimeClientData = NULL;
*----------------------------------------------------------------------
*/
-unsigned long
+Tcl_WideUInt
TclpGetSeconds(void)
{
Tcl_WideInt usecSincePosixEpoch;
@@ -209,7 +181,7 @@ TclpGetSeconds(void)
*----------------------------------------------------------------------
*/
-unsigned long
+Tcl_WideUInt
TclpGetClicks(void)
{
Tcl_WideInt usecSincePosixEpoch;
@@ -218,7 +190,7 @@ TclpGetClicks(void)
if ( tclGetTimeProcPtr == NativeGetTime
&& (usecSincePosixEpoch = NativeGetMicroseconds())
) {
- return (unsigned long)usecSincePosixEpoch;
+ return (Tcl_WideUInt)usecSincePosixEpoch;
} else {
/*
* Use the Tcl_GetTime abstraction to get the time in microseconds, as
@@ -228,7 +200,7 @@ TclpGetClicks(void)
Tcl_Time now; /* Current Tcl time */
tclGetTimeProcPtr(&now, tclTimeClientData); /* Tcl_GetTime inlined */
- return (unsigned long)(now.sec * 1000000) + now.usec;
+ return (Tcl_WideUInt)(now.sec * 1000000) + now.usec;
}
}
@@ -711,238 +683,6 @@ StopCalibration(
/*
*----------------------------------------------------------------------
*
- * TclpGetDate --
- *
- * This function converts between seconds and struct tm. If useGMT is
- * true, then the returned date will be in Greenwich Mean Time (GMT).
- * Otherwise, it will be in the local time zone.
- *
- * Results:
- * Returns a static tm structure.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-#ifndef TCL_NO_DEPRECATED
-struct tm *
-TclpGetDate(
- const time_t *t,
- int useGMT)
-{
- struct tm *tmPtr;
- time_t time;
-
- if (!useGMT) {
-#if defined(_MSC_VER) && (_MSC_VER >= 1900)
-# undef timezone /* prevent conflict with timezone() function */
- long timezone = 0;
-#endif
-
- tzset();
-
- /*
- * If we are in the valid range, let the C run-time library handle it.
- * Otherwise we need to fake it. Note that this algorithm ignores
- * daylight savings time before the epoch.
- */
-
- /*
- * Hm, Borland's localtime manages to return NULL under certain
- * circumstances (e.g. wintime.test, test 1.2). Nobody tests for this,
- * since 'localtime' isn't supposed to do this, possibly leading to
- * crashes.
- *
- * Patch: We only call this function if we are at least one day into
- * the epoch, else we handle it ourselves (like we do for times < 0).
- * H. Giese, June 2003
- */
-
-#ifdef __BORLANDC__
-#define LOCALTIME_VALIDITY_BOUNDARY SECSPERDAY
-#else
-#define LOCALTIME_VALIDITY_BOUNDARY 0
-#endif
-
- if (*t >= LOCALTIME_VALIDITY_BOUNDARY) {
- return TclpLocaltime(t);
- }
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1900)
- _get_timezone(&timezone);
-#endif
-
- time = *t - timezone;
-
- /*
- * If we aren't near to overflowing the long, just add the bias and
- * use the normal calculation. Otherwise we will need to adjust the
- * result at the end.
- */
-
- if (*t < (LONG_MAX - 2*SECSPERDAY) && *t > (LONG_MIN + 2*SECSPERDAY)) {
- tmPtr = ComputeGMT(&time);
- } else {
- tmPtr = ComputeGMT(t);
-
- tzset();
-
- /*
- * Add the bias directly to the tm structure to avoid overflow.
- * Propagate seconds overflow into minutes, hours and days.
- */
-
- time = tmPtr->tm_sec - timezone;
- tmPtr->tm_sec = (int)(time % 60);
- if (tmPtr->tm_sec < 0) {
- tmPtr->tm_sec += 60;
- time -= 60;
- }
-
- time = tmPtr->tm_min + time/60;
- tmPtr->tm_min = (int)(time % 60);
- if (tmPtr->tm_min < 0) {
- tmPtr->tm_min += 60;
- time -= 60;
- }
-
- time = tmPtr->tm_hour + time/60;
- tmPtr->tm_hour = (int)(time % 24);
- if (tmPtr->tm_hour < 0) {
- tmPtr->tm_hour += 24;
- time -= 24;
- }
-
- time /= 24;
- tmPtr->tm_mday += (int)time;
- tmPtr->tm_yday += (int)time;
- tmPtr->tm_wday = (tmPtr->tm_wday + (int)time) % 7;
- }
- } else {
- tmPtr = ComputeGMT(t);
- }
- return tmPtr;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * ComputeGMT --
- *
- * This function computes GMT given the number of seconds since the epoch
- * (midnight Jan 1 1970).
- *
- * Results:
- * Returns a (per thread) statically allocated struct tm.
- *
- * Side effects:
- * Updates the values of the static struct tm.
- *
- *----------------------------------------------------------------------
- */
-
-static struct tm *
-ComputeGMT(
- const time_t *tp)
-{
- struct tm *tmPtr;
- long tmp, rem;
- int isLeap;
- const int *days;
- ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
-
- tmPtr = &tsdPtr->tm;
-
- /*
- * Compute the 4 year span containing the specified time.
- */
-
- tmp = (long)(*tp / SECSPER4YEAR);
- rem = (long)(*tp % SECSPER4YEAR);
-
- /*
- * Correct for weird mod semantics so the remainder is always positive.
- */
-
- if (rem < 0) {
- tmp--;
- rem += SECSPER4YEAR;
- }
-
- /*
- * Compute the year after 1900 by taking the 4 year span and adjusting for
- * the remainder. This works because 2000 is a leap year, and 1900/2100
- * are out of the range.
- */
-
- tmp = (tmp * 4) + 70;
- isLeap = 0;
- if (rem >= SECSPERYEAR) { /* 1971, etc. */
- tmp++;
- rem -= SECSPERYEAR;
- if (rem >= SECSPERYEAR) { /* 1972, etc. */
- tmp++;
- rem -= SECSPERYEAR;
- if (rem >= SECSPERYEAR + SECSPERDAY) { /* 1973, etc. */
- tmp++;
- rem -= SECSPERYEAR + SECSPERDAY;
- } else {
- isLeap = 1;
- }
- }
- }
- tmPtr->tm_year = tmp;
-
- /*
- * Compute the day of year and leave the seconds in the current day in the
- * remainder.
- */
-
- tmPtr->tm_yday = rem / SECSPERDAY;
- rem %= SECSPERDAY;
-
- /*
- * Compute the time of day.
- */
-
- tmPtr->tm_hour = rem / 3600;
- rem %= 3600;
- tmPtr->tm_min = rem / 60;
- tmPtr->tm_sec = rem % 60;
-
- /*
- * Compute the month and day of month.
- */
-
- days = (isLeap) ? leapDays : normalDays;
- for (tmp = 1; days[tmp] < tmPtr->tm_yday; tmp++) {
- /* empty body */
- }
- tmPtr->tm_mon = --tmp;
- tmPtr->tm_mday = tmPtr->tm_yday - days[tmp];
-
- /*
- * Compute day of week. Epoch started on a Thursday.
- */
-
- tmPtr->tm_wday = (long)(*tp / SECSPERDAY) + 4;
- if ((*tp % SECSPERDAY) < 0) {
- tmPtr->tm_wday--;
- }
- tmPtr->tm_wday %= 7;
- if (tmPtr->tm_wday < 0) {
- tmPtr->tm_wday += 7;
- }
-
- return tmPtr;
-}
-#endif /* TCL_NO_DEPRECATED */
-
-/*
- *----------------------------------------------------------------------
- *
* CalibrationThread --
*
* Thread that manages calibration of the hi-resolution time derived from
@@ -1332,69 +1072,6 @@ AccumulateSample(
/*
*----------------------------------------------------------------------
*
- * TclpGmtime --
- *
- * Wrapper around the 'gmtime' library function to make it thread safe.
- *
- * Results:
- * Returns a pointer to a 'struct tm' in thread-specific data.
- *
- * Side effects:
- * Invokes gmtime or gmtime_r as appropriate.
- *
- *----------------------------------------------------------------------
- */
-
-#ifndef TCL_NO_DEPRECATED
-struct tm *
-TclpGmtime(
- const time_t *timePtr) /* Pointer to the number of seconds since the
- * local system's epoch */
-{
- /*
- * The MS implementation of gmtime is thread safe because it returns the
- * time in a block of thread-local storage, and Windows does not provide a
- * Posix gmtime_r function.
- */
-
- return gmtime(timePtr);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TclpLocaltime --
- *
- * Wrapper around the 'localtime' library function to make it thread
- * safe.
- *
- * Results:
- * Returns a pointer to a 'struct tm' in thread-specific data.
- *
- * Side effects:
- * Invokes localtime or localtime_r as appropriate.
- *
- *----------------------------------------------------------------------
- */
-
-struct tm *
-TclpLocaltime(
- const time_t *timePtr) /* Pointer to the number of seconds since the
- * local system's epoch */
-{
- /*
- * The MS implementation of localtime is thread safe because it returns
- * the time in a block of thread-local storage, and Windows does not
- * provide a Posix localtime_r function.
- */
-
- return localtime(timePtr);
-}
-#endif /* TCL_NO_DEPRECATED */
-
-/*
- *----------------------------------------------------------------------
- *
* Tcl_SetTimeProc --
*
* TIP #233 (Virtualized Time): Registers two handlers for the