Compare commits

..
315 changed files with 48220 additions and 12854 deletions
+1 -7
View File
@@ -1,11 +1,5 @@
name: Linux
on:
push:
branches:
- "main"
- "core-8-branch"
tags:
- "core-**"
on: [push]
permissions:
contents: read
jobs:
+4 -10
View File
@@ -1,11 +1,5 @@
name: macOS
on:
push:
branches:
- "main"
- "core-8-branch"
tags:
- "core-**"
on: [push]
permissions:
contents: read
jobs:
@@ -25,7 +19,7 @@ jobs:
- name: Build
run: make all
env:
CFLAGS: -arch x86_64 -arch arm64
CFLAGS: -arch x86_64 -arch arm64e
- name: Run Tests
run: make test styles=develop
env:
@@ -57,13 +51,13 @@ jobs:
# Note that macOS is always a 64 bit platform
run: ./configure --enable-dtrace --enable-framework ${CFGOPT} "--prefix=$HOME/install" || (cat config.log && exit 1)
env:
CFLAGS: -arch x86_64 -arch arm64
CFLAGS: -arch x86_64 -arch arm64e
CFGOPT: ${{ matrix.cfgopt }}
- name: Build
run: |
make all tcltest
env:
CFLAGS: -arch x86_64 -arch arm64
CFLAGS: -arch x86_64 -arch arm64e
- name: Run Tests
run: |
make test
+2 -8
View File
@@ -1,11 +1,5 @@
name: Build Binaries
on:
push:
branches:
- "main"
- "core-8-branch"
tags:
- "core-**"
on: [push]
permissions:
contents: read
jobs:
@@ -68,7 +62,7 @@ jobs:
sudo chmod a+x /usr/local/bin/macher
echo "VER_PATH=$(cd tools; pwd)/addVerToFile.tcl" >> $GITHUB_ENV
echo "CREATE_DMG=$(cd create-dmg;pwd)/create-dmg" >> $GITHUB_ENV
echo "CFLAGS=-arch x86_64 -arch arm64" >> $GITHUB_ENV
echo "CFLAGS=-arch x86_64 -arch arm64e" >> $GITHUB_ENV
- name: Configure
run: ./configure --disable-symbols --disable-shared --enable-zipfs
working-directory: unix
+1 -7
View File
@@ -1,11 +1,5 @@
name: Windows
on:
push:
branches:
- "main"
- "core-8-branch"
tags:
- "core-**"
on: [push]
permissions:
contents: read
env:
+8856
View File
File diff suppressed because it is too large Load Diff
+2634
View File
File diff suppressed because it is too large Load Diff
+2539
View File
File diff suppressed because it is too large Load Diff
+3629
View File
File diff suppressed because it is too large Load Diff
+4741
View File
File diff suppressed because it is too large Load Diff
+3349
View File
File diff suppressed because it is too large Load Diff
+4619
View File
File diff suppressed because it is too large Load Diff
+3822
View File
File diff suppressed because it is too large Load Diff
+5921
View File
File diff suppressed because it is too large Load Diff
+3796
View File
File diff suppressed because it is too large Load Diff
+53 -49
View File
@@ -2486,7 +2486,7 @@ interpreter. (JL)
installing and requesting security policies, purely in Tcl code. Overloads
the package command to also allow an interpreter to "require" a policy. The
following new library commands are provided:
tcl_safeCreateInterp -- creates a slave and initializes the
tcl_safeCreateInterp -- creates a slave an initializes the
policy mechanism.
tcl_safeInitInterp -- initializes an existing slave with the
policy mechanism.
@@ -3028,7 +3028,7 @@ in case of errors is required for proper cleanup by the user of fcopy. (BW)
x eval rename foo blotz
x alias foo {}
The problem was that the interp code was not using the actual current name
of the command to be deleted as a result of unaliasing foo. (JL)
of the command to be deleted as a result of un-aliasing foo. (JL)
6/19/97 (feature change) Pass interp down to the ChannelOption and
driver specific calls so system errors can be differentiated from syntax
@@ -4167,7 +4167,7 @@ Only.) This fix included:
the location of the encoding files and libraries. This fix included:
- Adding the TclSetPerInitScript routine.
- Modifying the Tcl_Init routines to evaluate the non-NULL
preinit script.
pre-init script.
- Adding the Tcl_SetdefaultEncodingDir and Tcl_GetDefaultEncodingDir
routines.
- Modifying the TclpInitLibrary routines to append the default
@@ -4650,7 +4650,7 @@ threading may still cause problems on AIX. (hobbs)
9/21/99 (bug fix) fixed bug when setting array in non-existent
namespace. [Bug: 2613] (hobbs)
--- Released 8.2.1, October 04, 1999
--- Released 8.2.1, October 04, 1999 --- See ChangeLog for details ---
10/30/99 (feature enhancement) new regexp engine from Henry Spencer
was patched in - should greatly reduce stack space usage. (spencer)
@@ -4680,7 +4680,7 @@ when indexing into one (test case string-5.16) [Bug: 2871] (hobbs)
10/30/99 (bug fix) fixes for mac UTF filename handling (ingham)
--- Released 8.2.2, November 04, 1999
--- Released 8.2.2, November 04, 1999 --- See ChangeLog for details ---
11/19/99 (feature enhancement) bug fixes for http package as well as
patch required by TLS (SSL) extension that adds http::(un)register
@@ -4705,7 +4705,7 @@ atexit handlers.
12/07/99 (bug fix) fixes for 'expr + {[incr]}' and 'expr + {[error]}'
cases (different causes).
--- Released 8.2.3, December 16, 1999
--- Released 8.2.3, December 16, 1999 --- See ChangeLog for details ---
1999-09-14 (feature enhancement) added -start switch to regexp and regsub.
@@ -4762,7 +4762,7 @@ ExitThread to _endthreadex to prevent 4K mem leak (gravereaux)
1999-12-21 (bug fix) changed thread ids to longs (for 64bit systems)
--- Released 8.3b1, December 22, 1999
--- Released 8.3b1, December 22, 1999 --- See ChangeLog for details ---
2000-01-10 (feature enhancement) clock scan now supports the common
ISO 8601 date/time formats. See docs for details. (melski)
@@ -4788,7 +4788,7 @@ symbolicly (like chmod) in [file attributes $file -permissions ...] (schoebel)
2000-01-13 (bug fix) fixed lsort -dictionary problem when sorting
characters between 'Z' and 'a' (flawed upper/lower comparison logic) (melski)
--- Released 8.3b2, January 13, 2000
--- Released 8.3b2, January 13, 2000 --- See ChangeLog for details ---
2000-01-14 (feature enhancement) clock format %Q added, clock scan updated
@@ -4827,7 +4827,7 @@ mac panic from an error when closing an async socket (steffen, ingham)
2000-02-10 (feature enhancement) improved error reporting for failed
loads on Windows (dejong, hobbs)
--- Released 8.3.0, February 10, 2000
--- Released 8.3.0, February 10, 2000 --- See ChangeLog for details ---
2000-03 (bug fixes, feature enhancement) overhaul of http package for
proper handling of async callbacks (new options), version is now at 2.3
@@ -4870,7 +4870,7 @@ tclLoadDyld.c dl type. (sanchez)
2000-04-24 (bug fix) fixed hang in threaded Unix case when backgrounded
exec process was running (dejong)
--- Released 8.3.1, April 26, 2000
--- Released 8.3.1, April 26, 2000 --- See ChangeLog for details ---
2000-04-26 (doc fix) updated/added documentation for many API's and
commands (melski)
@@ -4920,7 +4920,7 @@ pattern matching for [array names] (gazetta)
2000-05-31 (feature enhancement) added -nocomplain and -- flags to
[unset] to allow for silent unset operation (hobbs)
--- Released 8.4a1, June 6, 2000
--- Released 8.4a1, June 6, 2000 --- See ChangeLog for details ---
2000-05-29 (bug fix) corrected resource cleanup in http error cases.
Improved handling of error cases in http. (tamhankar)
@@ -4959,7 +4959,7 @@ sections. (english)
2000-08-07 (bug fix) new man pages memory.n, TCL_MEM_DEBUG.3, Init.3 and
DumpActiveMemory.3. (melski)
--- Released 8.3.2, August 9, 2000
--- Released 8.3.2, August 9, 2000 --- See ChangeLog for details ---
2000-06 thru 2000-11 (build improvements) Added support for mingw (gcc on
Windows), AIX-5 and Win64 builds (dejong, hobbs)
@@ -5018,7 +5018,7 @@ environment (gravereaux)
2000-11-03 (new feature) Tcl_SetMainLoop enables defining an event loop for
tclsh. This enables Tk as a truly loadable package. (hobbs)
--- Released 8.4a2, November 3, 2000
--- Released 8.4a2, November 3, 2000 --- See ChangeLog for details ---
2000-09-27 (bug fix) fixed a bug introduced by a partial fix in 8.3.2 that
didn't set nonBlocking correctly when resetting the flags for the write
@@ -5076,7 +5076,7 @@ Update of READMEs.
Corrected IRIX-5* configure (english). Added support for AIX-5 (hobbs).
Added support for Win64 (hobbs).
--- Released 8.3.3, April 6, 2001
--- Released 8.3.3, April 6, 2001 --- See ChangeLog for details ---
2000-11-23 (new feature)[TIP 7] higher resolution timer on Windows (kenny)
@@ -5150,7 +5150,7 @@ system. This includes the addition of 'file normalize', 'file system',
* corrected several minor errors noted by Purify (hobbs)
--- Released 8.4a3, August 6, 2001
--- Released 8.4a3, August 6, 2001 --- See ChangeLog for details ---
2001-06-27 (bug fix)[217987] corrected backslash substitution of non-ASCII
characters. (hobbs, riefenstahl)
@@ -5256,7 +5256,7 @@ bundles to standard .dylib dynamic libraries like on other unices.
2001-10-18 (bug fix) corrected off-by-one-day error in clock scan with
relative months and years during swing hours. (lavana)
--- Released 8.3.4, October 19, 2001
--- Released 8.3.4, October 19, 2001 --- See ChangeLog for details ---
2001-08-21 (bug fix)[219184] overagressive compilation of [catch] (sofer)
@@ -5282,6 +5282,8 @@ compiles to 0 bytecodes (sofer)
2001-09-13 (new feature)[TIP 56] Tcl_EvalTokensStandard API (sofer)
2001-09-13 (new feature) Old ChangeLog entries => ChangeLog.1999 (hobbs)
2001-09-17 (new feature) compiling with TCL_COMPILE_DEBUG now required to
enable all compile and execution tracing (sofer)
*** POTENTIAL INCOMPATIBILITY ***
@@ -5366,6 +5368,8 @@ of the Host: header value
2002-01-25 (new feature)[496733] socket options -eofchar and -translation
return read-only values (dejong)
2002-01-28 (new feature) Old ChangeLog entries => ChangeLog.20900 (hobbs)
2002-01-28 (performance enhancement) bytecompiled [regexp] for trivial cases
that amount to string matching. Also -nocase and --. (hobbs)
@@ -5390,7 +5394,7 @@ errored out. (kupries, sofer)
2002-02-15 (new feature)[TIP 72] support for 64-bit integer values on
32-bit platforms and ability to work with >2GiB files. Extends many
commands. See TIP for details.
commands. See ChangeLog and TIP for details.
*** POTENTIAL INCOMPATIBILITY ***
2002-02-22 (bug fix)[476537] Fix panic when loading shared library without
@@ -5431,7 +5435,7 @@ of prior Tcl releases. Others will need to be reconciled.
related to the handling of iso2022 text and finalization of escape-based
encodings. (taguchi, takahashi, hobbs)
--- Released 8.4a4, March 5, 2002
--- Released 8.4a4, March 5, 2002 --- See ChangeLog for details ---
2002-03-06 (new feature)[TIP 80] expanded [lsearch] options (wilkason, fellows)
@@ -5541,7 +5545,7 @@ options to configure (max)
2002-07-03 (bug fix)[577015] [catch] catches even compile errors (sofer)
--- Released 8.4b1, July 5, 2002
--- Released 8.4b1, July 5, 2002 --- See ChangeLog for details ---
2002-07-08 (bug fix) restored compatibility of [viewFile] in tcltest (porter)
@@ -5579,7 +5583,7 @@ options to configure (max)
Many internal bugs fixed.
Considerable cleanup of the test suite.
--- Released 8.4b2, August 9, 2002
--- Released 8.4b2, August 9, 2002 --- See ChangeLog for details ---
2002-08-20 (new feature) --enable-memdebug configure option (kupries)
@@ -5594,7 +5598,7 @@ Considerable cleanup of the test suite.
2002-09-02 (platfrom support) 64-bit compile on HP-11 (martin)
--- Released 8.4.0, September 10, 2002
--- Released 8.4.0, September 10, 2002 --- See ChangeLog for details ---
2002-09-18 (platform support) Updated support for compiling with Cygwin and
either mingw or gcc. (khan, howell, dejong)
@@ -5657,7 +5661,7 @@ dirs to tcl_pkgPath: @executable_path/../Frameworks and
@executable_path/../PrivateFrameworks (if they exist), as well as the dirs
in DYLD_FRAMEWORK_PATH (if set). (steffen)
--- Released 8.4.1, October 22, 2002
--- Released 8.4.1, October 22, 2002 --- See ChangeLog for details ---
2002-10-28 (bug fix)[627660] [package unknown] chaining for platform specifics
@@ -5750,7 +5754,7 @@ packages in multiple interps.
2003-02-27 (bug fix)[694232] stop [lsearch -start 0 {} x] segfault
--- Released 8.4.2, March 3, 2003
--- Released 8.4.2, March 3, 2003 --- See ChangeLog for details ---
2003-03-06 (bug fix)[699042] Correct case-insensitive unicode string
comparison in Tcl_UniCharNcasecmp
@@ -5832,7 +5836,7 @@ encoding for the original. Most uses of gb2312 really mean euc-cn.
2003-05-14 (bug fix)[736421] Corrected another putenv() copy behavior
problem when compiling on Windows and using Microsoft's runtime.
--- Released 8.4.3, May 20, 2003
--- Released 8.4.3, May 20, 2003 --- See ChangeLog for details ---
2003-05-23 (bug fix)[726018] reverted internals change to the
'cmdName' Tcl_ObjType that broke several extensions (TclBlend, e4graph...)
@@ -5873,7 +5877,7 @@ Improved documentation, new tests, and some code cleanup.
[655300, 720634, 735364, 748700, 756112, 756744, 756951, 758488, 760768,
763312, 769895, 771539, 771840, 771947, 771949, 772333]
--- Released 8.4.4, July 22, 2003
--- Released 8.4.4, July 22, 2003 --- See ChangeLog for details ---
2003-07-23 (bug fix)[775976] fix registry compilation for VC7.
@@ -5919,7 +5923,7 @@ asked for writable events by the generic layer.
2003-11-17 (bug fix)[230589, 504785, 505048, 703709, 840258] fixes to
various odd regexp "can't happen" bugs.
--- Released 8.4.5, November 20, 2003
--- Released 8.4.5, November 20, 2003 --- See ChangeLog for details ---
2003-12-02 (bug fix)[851747] object sharing fix in [binary scan]
@@ -5956,7 +5960,7 @@ various odd regexp "can't happen" bugs.
2004-03-01 (platform support)[218561] Allow 64-bit configure on IRIX64-6.5*
--- Released 8.4.6, March 1, 2004
--- Released 8.4.6, March 1, 2004 --- See ChangeLog for details ---
Changes to 8.5a1 include all changes to the 8.4 line through 8.4.6,
plus the following, which focuses on the high-level feature changes
@@ -6042,7 +6046,7 @@ in this changeset (new minor version) rather than bug fixes:
* [TIP #157] leading {expand} syntax on words to cause argument expansion.
This is a safer/cleaner alternative to the use of 'eval'.
--- Released 8.5a1, March 3, 2004
--- Released 8.5a1, March 3, 2004 --- See ChangeLog for details ---
2004-03-04 (new feature) registry package is [unload]able (thoyts)
=> registry 1.1.4
@@ -6066,7 +6070,7 @@ each command/interp validity before executing. (sofer)
2004-04-06 (clean up) refactored Tcl header file #include order. Might
create need for changes in extensions that #include private headers.
Changed source code files should work with older Tcl as well.
Changed source code files should work with older Tcl as well. See ChangeLog.
*** POTENTIAL INCOMPATIBILITY ***
2004-04-07 (bug fix)[920667] install into any Unicode path on Win (hobbs)
@@ -6342,7 +6346,7 @@ Doc improvements [759545,926590,935853,1017072,1018486,1022527,1027849,
1032243,1047928,1048005,1058446,1062647,1065732,1073334,etc.]
Test suite expansion [1036649,1001997,etc.]
--- Released 8.5a2, December 7, 2004
--- Released 8.5a2, December 7, 2004 --- See ChangeLog for details ---
2004-12-13 (bug fix)[1083082] encoding memory leaks (ade,porter)
@@ -6486,7 +6490,7 @@ Can support [load] from memory as well (steffen)
Documentation improvements [1075433,1085127,1117017,1124160,1149605,etc.]
--- Released 8.5a3, June 4, 2005
--- Released 8.5a3, June 4, 2005 --- See ChangeLog for details ---
2005-06-06 (bug fix)[1213678] Windows/gcc: crash in stack.test (kenny)
@@ -6737,7 +6741,7 @@ removed (steffen)
Documentation improvements [1211078,1190891,1292427,1277503,1104682,1359183,
1415725,666770]
--- Released 8.5a4, April 27, 2006
--- Released 8.5a4, April 27, 2006 --- See ChangeLog for details ---
2006-05-04 (bug fix)[1480509] srand() accept wide input (porter,afredd)
@@ -6833,7 +6837,7 @@ URL validity checking against RFC 2986 (hobbs)
2006-10-13 (platform support) get stack size on Darwin (steffen)
--- Released 8.5a5, October 20, 2006
--- Released 8.5a5, October 20, 2006 --- See ChangeLog for details ---
2006-10-20 (configure change) Added autodetection for OS-supplied timezone
files (max)
@@ -6915,7 +6919,7 @@ upvar and namespace upvar (sofer)
2007-04-23 (bug fix) fts_open() crash on 64bit Darwin 8 or earlier (steffen)
--- Released 8.5a6, April 25, 2007
--- Released 8.5a6, April 25, 2007 --- See ChangeLog for details ---
2007-04-30 (bug fix)[1705778] many valgrind-detected leaks corrected
@@ -6973,7 +6977,7 @@ of traced command do not fire (sofer)
2007-08-16 (bug fix)[1773040] ::errorInfo trace crash (janssen,porter)
2007-08-16 (performance)[1564517] precompile constant expressions (porter)
2007-08-16 (performance)[1564517] pre-compile constant expressions (porter)
2007-08-21 (bug fix)[1775878] 'puts \' in interactive tclsh failed to move to
prompt for continuation line (porter)
@@ -7018,7 +7022,7 @@ project for Xcode 3.0 (steffen)
(bug fix)[1066755] Several stack efficiency efforts increases recursion limit
on Windows to be larger than the default [interp recursionlimit] value
--- Released 8.5b1, September 26, 2007
--- Released 8.5b1, September 26, 2007 --- See ChangeLog for details ---
2007-10-02 (bug fix)[1806422] proper [tcl::tm::path] autoload (porter)
@@ -7030,7 +7034,7 @@ on Windows to be larger than the default [interp recursionlimit] value
2007-10-25 (bug fix)[1726873] intermittent crash in threads (vasiljevic)
--- Released 8.5b2, October 26, 2007
--- Released 8.5b2, October 26, 2007 --- See ChangeLog for details ---
2007-10-27 (bug fix)[1821159] fixed broken compile on x86_64 (sofer)
@@ -7066,7 +7070,7 @@ on Windows to be larger than the default [interp recursionlimit] value
Many significant documentation improvements (fellows, sofer)
--- Released 8.5b3, November 19, 2007
--- Released 8.5b3, November 19, 2007 --- See ChangeLog for details ---
2007-11-20 (enhancement) string rep of dict has stable order (fellows)
@@ -7100,7 +7104,7 @@ over-consumption of resources (drewry,lane,ormandy,fellows)
Several documentation and release notes improvements
--- Released 8.5.0, December 20, 2007
--- Released 8.5.0, December 20, 2007 --- See ChangeLog for details ---
2007-12-23 (bug fix)[1857126] restore backref support to regexps (hobbs)
@@ -7122,7 +7126,7 @@ Several documentation and release notes improvements
Several documentation and release notes improvements
--- Released 8.5.1, February 5, 2008
--- Released 8.5.1, February 5, 2008 --- See ChangeLog for details ---
2008-02-06 (enhancement) [clock format] performance (kenny)
@@ -7183,7 +7187,7 @@ variables without "." added to customization hooks (kupries)
2008-03-27 clock tzdata updated to Olson's tzdata2008b (kenny)
--- Released 8.5.2, March 28, 2008
--- Released 8.5.2, March 28, 2008 --- See ChangeLog for details ---
2008-03-30 (bug fix)[1783544] more robust TclIsNaN() (kenny,teterin)
@@ -7238,7 +7242,7 @@ variables without "." added to customization hooks (kupries)
2008-06-25 (bug fix)[1999119] Support TM packages in Safe Base (kupries)
--- Released 8.6a1, June 25, 2008
--- Released 8.6a1, June 25, 2008 --- See ChangeLog for details ---
2008-06-29 (bug fix)[2004480] plug memory leaks (ade,porter,steffen)
@@ -7291,7 +7295,7 @@ in a deleted interp. (porter)
2008-08-21 (bug fix)[2065115] Restored ***= regexp functioning (hobbs,porter)
--- Released 8.6a2, August 25, 2008
--- Released 8.6a2, August 25, 2008 --- See ChangeLog for details ---
2008-08-29 (bug fix)[2082299] Install TclOO header files (fellows)
@@ -7372,7 +7376,7 @@ Tcl_FSFileAttrStringsProc prototype. (nijtmans)
2008-10-10 (bug fix)[2155658] crash in oo method export (fellows)
--- Released 8.6a3, October 10, 2008
--- Released 8.6a3, October 10, 2008 --- See ChangeLog for details ---
2008-10-13 (bug fix) Fix ability to join threads on 64-bit Windows (thoyts)
@@ -7442,7 +7446,7 @@ evaluation in extensions (sofer,kenny)
2008-12-18 (bug fix)[2444274] panic in long commands from {*} (goth,porter)
--- Released 8.6b1, December 19, 2008
--- Released 8.6b1, December 19, 2008 --- See ChangeLog for details ---
2008-12-27 [TIP 234] Tcl_Zlib* interface revisions (fellows)
*** INCOMPATIBILITY with interface of 8.6b1 ***
@@ -7950,7 +7954,7 @@ memory with buffer backup (ferrieux)
Many more Tcl built-in command errors now set an -errorcode.
--- Released 8.6b2, August 8, 2011
--- Released 8.6b2, August 8, 2011 --- See ChangeLog for details ---
2011-07-02 (bug fix)[3349507] correct double(1[string repeat 0 23]) (kenny)
@@ -8111,7 +8115,7 @@ Many revisions to better support a Cygwin environment (nijtmans)
Dropped support for OS X versions less than 10.4 (Tiger) (fellows)
--- Released 8.6b3, September 18, 2012
--- Released 8.6b3, September 18, 2012 --- See ChangeLog for details ---
2012-09-20 (enhancement) full Unicode support (nijtmans)
=> dde 1.4.0
@@ -8158,7 +8162,7 @@ Dropped support for OS X versions less than 10.4 (Tiger) (fellows)
2012-12-13 (bug fix) crash: [zlib gunzip $data -header noSuchNs::var] (porter)
--- Released 8.6.0, December 20, 2012
--- Released 8.6.0, December 20, 2012 --- See ChangeLog for details ---
2012-12-22 (bug fix)[3598150] DString to Tcl_Obj memleak (afredd)
@@ -8681,7 +8685,7 @@ improvements to regexp engine from Postgres (lane,porter,fellows,seltenreich)
2016-07-08 (bug)[a47641] [file normalize] & Windows junctions (nadkarni)
2016-07-09 [ae61a6] [file] handling of Win hard-coded names (CON) (nadkarni)
2016-07-09 [ae61a6] [file] handling of Win hardcoded names (CON) (nadkarni)
*** POTENTIAL INCOMPATIBILITY ***
2016-07-09 [3613671] [file owned] (more) useful on Win (nadkarni)
+1 -1
View File
@@ -28,7 +28,7 @@ opendir(
if ((fd = open(myname, 0, 0)) == -1) {
return NULL;
}
dirp = (DIR *) attemptckalloc(sizeof(DIR));
dirp = (DIR *) ckalloc(sizeof(DIR));
if (dirp == NULL) {
/* unreachable? */
close(fd);
+1 -5
View File
@@ -156,11 +156,7 @@ waitpid(
goto waitAgain;
}
}
waitPtr = (WaitInfo *) attemptckalloc(sizeof(WaitInfo));
if (!waitPtr) {
errno = ENOMEM;
return -1;
}
waitPtr = (WaitInfo *) ckalloc(sizeof(WaitInfo));
waitPtr->pid = result;
waitPtr->status = status;
waitPtr->nextPtr = deadList;
+2 -5
View File
@@ -66,9 +66,6 @@
#ifdef _WIN32
#define USEWIN32IOAPI
#include "iowin32.h"
# if defined(_MSC_VER)
# define snprintf _snprintf
# endif
#endif
@@ -368,7 +365,7 @@ void addFileToZip(zipFile zf, const char *filenameinzip, const char *password, i
void addPathToZip(zipFile zf, const char *filenameinzip, const char *password, int opt_exclude_path,int opt_compress_level) {
tinydir_dir dir;
int i;
char newname[MAXFILENAME+1+MAXFILENAME+1];
char newname[512];
tinydir_open_sorted(&dir, filenameinzip);
@@ -378,7 +375,7 @@ void addPathToZip(zipFile zf, const char *filenameinzip, const char *password, i
tinydir_readfile_n(&dir, &file, i);
if(strcmp(file.name,".")==0) continue;
if(strcmp(file.name,"..")==0) continue;
snprintf(newname, sizeof(newname), "%.*s/%.*s", MAXFILENAME, dir.path, MAXFILENAME, file.name);
sprintf(newname,"%s/%s",dir.path,file.name);
if (file.is_dir)
{
addPathToZip(zf,newname,password,opt_exclude_path,opt_compress_level);
+3 -3
View File
@@ -43,7 +43,7 @@ overwritten by a byte-array value. For \fBTcl_GetBytesFromObj\fR,
to the value from which to extract an array of bytes.
.AP Tcl_Interp *interp in
Interpreter to use for error reporting.
.AP "ptrdiff_t | int" *numBytesPtr out
.AP "size_t | int" *numBytesPtr out
Points to space where the number of bytes in the array may be written.
Caller may pass NULL when it does not need this information.
.BE
@@ -154,10 +154,10 @@ and any string representation is invalidated.
On success, both \fBTcl_GetBytesFromObj\fR and \fBTcl_GetByteArrayFromObj\fR
write the number of bytes in the byte-array value of \fIobjPtr\fR
to the space pointed to by \fInumBytesPtr\fR. This space may be of type
\fBptrdiff_t\fR or of type \fBint\fR. In Tcl 8, the largest number of
\fBsize_t\fR or of type \fBint\fR. In Tcl 8, the largest number of
bytes possible is \fBINT_MAX\fR, so either type can receive the value.
In codebases meant to migrate to Tcl 9, the option to write to a space
of type \fBptrdiff_t\fR may aid in the migration.
of type \fBsize_t\fR may aid in the migration.
.PP
\fBTcl_SetByteArrayLength\fR enables a caller to change the size of a
byte-array in the internal representation of an unshared \fIobjPtr\fR to
+2 -2
View File
@@ -26,7 +26,7 @@ Error message to use in the cancellation, or NULL to use a default message. If
not NULL, this object will have its reference count decremented before
\fBTcl_CancelEval\fR returns.
.AP int flags in
OR'ed combination of flag bits that specify additional options.
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.
@@ -47,7 +47,7 @@ Extensions can use this function to check to see if they should abort a long
running command. This function is thread sensitive and may only be called
from the thread the interpreter was created in.
.SS "FLAG BITS"
Any OR'ed combination of the following values may be used for the
Any ORed combination of the following values may be used for the
\fIflags\fR argument to procedures such as \fBTcl_CancelEval\fR:
.TP 20
\fBTCL_CANCEL_UNWIND\fR
+1 -1
View File
@@ -187,7 +187,7 @@ except its \fIproc2\fR argument is of type \fBTcl_ObjCmdProc2\fR.
typedef int \fBTcl_ObjCmdProc2\fR(
ClientData \fIclientData\fR,
Tcl_Interp *\fIinterp\fR,
ptrdiff_t \fIobjc\fR,
size_t \fIobjc\fR,
Tcl_Obj *const \fIobjv\fR[]);
.CE
.PP
+2 -2
View File
@@ -88,10 +88,10 @@ typedef int \fBTcl_CmdObjTraceProc\fR(
typedef int \fBTcl_CmdObjTraceProc2\fR(
\fBvoid *\fR \fIclientData\fR,
\fBTcl_Interp\fR* \fIinterp\fR,
ptrdiff_t \fIlevel\fR,
size_t \fIlevel\fR,
const char *\fIcommand\fR,
\fBTcl_Command\fR \fIcommandToken\fR,
ptrdiff_t \fIobjc\fR,
size_t \fIobjc\fR,
\fBTcl_Obj\fR *const \fIobjv\fR[]);
.CE
.PP
+24 -59
View File
@@ -8,7 +8,7 @@
.so man.macros
.BS
.SH NAME
Tcl_GetEncoding, Tcl_FreeEncoding, Tcl_GetEncodingFromObj, Tcl_ExternalToUtfDString, Tcl_ExternalToUtfDStringEx, Tcl_ExternalToUtf, Tcl_UtfToExternalDString, Tcl_UtfToExternalDStringEx, Tcl_UtfToExternal, 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_GetEncodingName, Tcl_SetSystemEncoding, Tcl_GetEncodingNameFromEnvironment, Tcl_GetEncodingNames, Tcl_CreateEncoding, Tcl_GetEncodingSearchPath, Tcl_SetEncodingSearchPath, Tcl_GetDefaultEncodingDir, Tcl_SetDefaultEncodingDir \- procedures for creating and using encodings
.SH SYNOPSIS
.nf
\fB#include <tcl.h>\fR
@@ -26,13 +26,13 @@ char *
\fBTcl_ExternalToUtfDString\fR(\fIencoding, src, srcLen, dstPtr\fR)
.sp
int
\fBTcl_ExternalToUtfDStringEx\fR(\fIinterp, encoding, src, srcLen, flags, dstPtr, errorIdxPtr\fR)
\fBTcl_ExternalToUtfDStringEx\fR(\fIencoding, src, srcLen, flags, dstPtr\fR)
.sp
char *
\fBTcl_UtfToExternalDString\fR(\fIencoding, src, srcLen, dstPtr\fR)
.sp
int
\fBTcl_UtfToExternalDStringEx\fR(\fIinterp, encoding, src, srcLen, flags, dstPtr, errorIdxPtr\fR)
\fBTcl_UtfToExternalDStringEx\fR(\fIencoding, src, srcLen, flags, dstPtr\fR)
.sp
int
\fBTcl_ExternalToUtf\fR(\fIinterp, encoding, src, srcLen, flags, statePtr,
@@ -105,7 +105,7 @@ encoding-specific length of the string is used.
Pointer to an uninitialized or free \fBTcl_DString\fR in which the converted
result will be stored.
.AP int flags in
This is a bit mask passed in to control the operation of the encoding functions.
Various flag bits OR-ed together.
\fBTCL_ENCODING_START\fR signifies that the
source buffer is the first block in a (potentially multi-block) input
stream, telling the conversion routine to reset to an initial state and
@@ -113,15 +113,16 @@ perform any initialization that needs to occur before the first byte is
converted. \fBTCL_ENCODING_END\fR signifies that the source buffer is the last
block in a (potentially multi-block) input stream, telling the conversion
routine to perform any finalization that needs to occur after the last
byte is converted and then to reset to an initial state. The
\fBTCL_PROFILE_*\fR bits defined in the \fBPROFILES\fR section below
control the encoding profile to be used for dealing with invalid data or
other errors in the encoding transform.
\fBTCL_ENCODING_STOPONERROR\fR is present for backward compatibility with
Tcl 8.6 and forces the encoding profile to \fBstrict\fR.
Some flags bits may not be usable with some functions as noted in the
function descriptions below.
byte is converted and then to reset to an initial state.
\fBTCL_ENCODING_STOPONERROR\fR signifies that the conversion routine should
return immediately upon reading a source character that does not exist in
the target encoding; otherwise a default fallback character will
automatically be substituted. The flag \fBTCL_ENCODING_STRICT\fR makes the
encoder/decoder more strict in what it considers to be an invalid byte
sequence. The flag \fBTCL_ENCODING_NOCOMPLAIN\fR has
no effect, it is reserved for Tcl 9.0. The flag \fBTCL_ENCODING_MODIFIED\fR makes
\fBTcl_UtfToExternalDStringEx\fR and \fBTcl_UtfToExternal\fR produce the
byte sequence \exC0\ex80 in stead of \ex00, for the utf-8/cesu-8 encoders.
.AP Tcl_EncodingState *statePtr in/out
Used when converting a (generally long or indefinite length) byte stream
in a piece-by-piece fashion. The conversion routine stores its current
@@ -147,9 +148,6 @@ buffer as a result of the conversion. May be NULL.
.AP int *dstCharsPtr out
Filled with the number of characters that correspond to the number of bytes
stored in the output buffer. May be NULL.
.AP Tcl_Size *errorIdxPtr out
Filled with the index of the byte or character that caused the encoding transform
to fail. May be NULL.
.AP Tcl_DString *bufPtr out
Storage for the prescribed system encoding name.
.AP "const Tcl_EncodingType" *typePtr in
@@ -224,27 +222,10 @@ When converting, if any of the characters in the source buffer cannot be
represented in the target encoding, a default fallback character will be
used. The return value is a pointer to the value stored in the DString.
.PP
\fBTcl_ExternalToUtfDStringEx\fR is a more flexible version of older
\fBTcl_ExternalToUtfDString\fR function. It takes three additional parameters,
\fBinterp\fR, \fBflags\fR and \fBerrorIdxPtr\fR. The \fBflags\fR parameter may
be used to specify the profile to be used for the transform. The
\fBTCL_ENCODING_START\fR and \fBTCL_ENCODING_END\fR bits in \fBflags\fR are
ignored as the function assumes the entire source string to be decoded is passed
into the function. On success, the function returns \fBTCL_ERROR\fR with the
converted string stored in \fB*dstPtr\fR. For errors other than conversion
errors, such as invalid flags, the function returns \fBTCL_OK\fR with an error
message in \fBinterp\fR if it is not NULL.
.PP
For conversion errors, \fBTcl_ExternalToUtfDStringEx\fR returns one
of the \fBTCL_CONVERT_*\fR errors listed below for \fBTcl_ExternalToUtf\fR.
When one of these conversion errors is returned, an error message is
stored in \fBinterp\fR only if \fBerrorIdxPtr\fR is NULL. Otherwise, no error message
is stored as the function expects the caller is interested whatever is
decoded to that point and not treating this as an immediate error condition.
The index of the error location is stored in \fB*errorIdxPtr\fR.
.PP
The caller must call \fBTcl_DStringFree\fR to free up the \fB*dstPtr\fR resources
irrespective of the return value from the function.
\fBTcl_ExternalToUtfDStringEx\fR is the same as \fBTcl_ExternalToUtfDString\fR,
but it has an additional flags parameter. The return value is the index of
the first byte in the input string causing a conversion error.
Or TCL_INDEX_NONE if all is OK.
.PP
\fBTcl_ExternalToUtf\fR converts a source buffer \fIsrc\fR from the specified
\fIencoding\fR into UTF-8. Up to \fIsrcLen\fR bytes are converted from the
@@ -267,12 +248,12 @@ the unconverted bytes that remained in \fIsrc\fR plus some further bytes
from the source stream to properly convert the formerly split-up multibyte
sequence.
.IP \fBTCL_CONVERT_SYNTAX\fR 29
The source buffer contained an invalid byte or character sequence. This may occur
The source buffer contained an invalid character sequence. This may occur
if the input stream has been damaged or if the input encoding method was
misidentified.
.IP \fBTCL_CONVERT_UNKNOWN\fR 29
The source buffer contained a character that could not be represented in
the target encoding.
the target encoding and \fBTCL_ENCODING_STOPONERROR\fR was specified.
.RE
.LP
\fBTcl_UtfToExternalDString\fR converts a source buffer \fIsrc\fR from UTF-8
@@ -284,14 +265,10 @@ characters in the source buffer cannot be represented in the target
encoding, a default fallback character will be used. The return value is
a pointer to the value stored in the DString.
.PP
\fBTcl_UtfToExternalDStringEx\fR is an enhanced version of
\fBTcl_UtfToExternalDString\fR that transforms UTF-8 encoded source data to a specified
\fIencoding\fR. Except for the direction of the transform, the parameters and
return values are identical to those of \fBTcl_ExternalToUtfDStringEx\fR. See
that function above for details about the same.
Irrespective of the return code from the function, the caller must free
resources associated with \fB*dstPtr\fR when the function returns.
\fBTcl_UtfToExternalDStringEx\fR is the same as \fBTcl_UtfToExternalDString\fR,
but it has an additional flags parameter. The return value is the index of
the first byte of an utf-8 byte-sequence in the input string causing a
conversion error. Or TCL_INDEX_NONE if all is OK.
.PP
\fBTcl_UtfToExternal\fR converts a source buffer \fIsrc\fR from UTF-8 into
the specified \fIencoding\fR. Up to \fIsrcLen\fR bytes are converted from
@@ -615,18 +592,6 @@ to the object, it will be deleted.
.PP
\fBTcl_GetEncodingSearchPath\fR returns an object with a reference count of at
least 1.
.SH "PROFILES"
Encoding profiles define the manner in which errors in the encoding transforms
are handled by the encoding functions. An application can specify the profile
to be used by OR-ing the \fBflags\fR parameter passed to the function
with at most one of \fBTCL_ENCODING_PROFILE_TCL8\fR,
\fBTCL_ENCODING_PROFILE_STRICT\fR or \fBTCL_ENCODING_PROFILE_REPLACE\fR.
These correspond to the \fBtcl8\fR, \fBstrict\fR and \fBreplace\fR profiles
respectively. If none are specified, a version-dependent default profile is used.
For Tcl 8.7, the default profile is \fBtcl8\fR.
.PP
For details about profiles, see the \fBPROFILES\fR section in
the documentation of the \fBencoding\fR command.
.SH "SEE ALSO"
encoding(n)
.SH KEYWORDS
+2 -2
View File
@@ -69,14 +69,14 @@ The name of the ensemble command to be created.
The namespace to which the ensemble command is to be bound, or NULL
for the current namespace.
.AP int ensFlags in
An OR'ed set of flag bits describing the basic configuration of the
An ORed set of flag bits describing the basic configuration of the
ensemble. Currently only one bit has meaning, \fBTCL_ENSEMBLE_PREFIX\fR,
which is present when the ensemble command should also match
unambiguous prefixes of subcommands.
.AP Tcl_Obj *cmdNameObj in
A value holding the name of the ensemble command to look up.
.AP int flags in
An OR'ed set of flag bits controlling the behavior of
An ORed set of flag bits controlling the behavior of
\fBTcl_FindEnsemble\fR. Currently only \fBTCL_LEAVE_ERR_MSG\fR is supported.
.AP Tcl_Command token in
A normal command token that refers to an ensemble command, or which
+3 -3
View File
@@ -49,7 +49,7 @@ modified to hold the result or error message from the script.
.AP Tcl_Obj *objPtr in
A Tcl value containing the script to execute.
.AP int flags in
OR'ed combination of flag bits that specify additional options.
ORed combination of flag bits that specify additional options.
\fBTCL_EVAL_GLOBAL\fR and \fBTCL_EVAL_DIRECT\fR are currently supported.
.AP "const char" *fileName in
Name of a file containing a Tcl script.
@@ -107,7 +107,7 @@ in code for string comparison, you can use
which will be safely substituted by the Tcl interpreter into
.QW ^Z .
.PP
\fBTcl_EvalObjv\fR executes a single preparsed command instead of a
\fBTcl_EvalObjv\fR executes a single pre-parsed command instead of a
script. The \fIobjc\fR and \fIobjv\fR arguments contain the values
of the words for the Tcl command, one word in each value in
\fIobjv\fR. \fBTcl_EvalObjv\fR evaluates the command and returns
@@ -159,7 +159,7 @@ in practice. This function is deprecated and will be removed in Tcl 9.0.
.SH "FLAG BITS"
.PP
Any OR'ed combination of the following values may be used for the
Any ORed combination of the following values may be used for the
\fIflags\fR argument to procedures such as \fBTcl_EvalObjEx\fR:
.TP 23
\fBTCL_EVAL_DIRECT\fR
+2 -2
View File
@@ -233,7 +233,7 @@ The value to set in the operation.
.AP Tcl_Obj **objPtrRef out
Filled with a value containing the result of the operation.
.AP Tcl_Obj *resultPtr out
Preallocated value in which to store (using
Pre-allocated value in which to store (using
\fBTcl_ListObjAppendElement\fR) the list of
files or directories which are successfully matched.
.AP int mode in
@@ -483,7 +483,7 @@ is a Tcl_Obj specifying the contents of the symbolic link given by
by the caller, which should call \fBTcl_DecrRefCount\fR when the result is no
longer needed. If the \fItoPtr\fR is not NULL, Tcl should create a link
of one of the types passed in in the \fIlinkAction\fR flag. This flag is
an OR'ed combination of \fBTCL_CREATE_SYMBOLIC_LINK\fR and \fBTCL_CREATE_HARD_LINK\fR.
an ORed combination of \fBTCL_CREATE_SYMBOLIC_LINK\fR and \fBTCL_CREATE_HARD_LINK\fR.
Where a choice exists (i.e.\ more than one flag is passed in), the Tcl
convention is to prefer symbolic links. When a link is successfully
created, the return value should be \fItoPtr\fR (which is therefore
+1 -1
View File
@@ -133,7 +133,7 @@ is true.
.PP
\fBTcl_Import\fR imports commands matching a pattern into a
namespace. Note that the pattern must include the name of the
namespace to import from. This function returns TCL_ERROR if
namespace to import from. This function returns an error if
an attempt to import a command over an existing command is made,
unless the \fIallowOverwrite\fR flag has been set.
.PP
+1 -1
View File
@@ -27,7 +27,7 @@ When non-NULL, error information is recorded here when the value is not
in any of the numeric formats recognized by Tcl.
.AP "const char" *bytes in
Points to first byte of the string value to be examined.
.AP ptrdiff_t numBytes in
.AP size_t numBytes in
The number of bytes, starting at \fIbytes\fR, that should be examined.
If the value \fBTCL_INDEX_NONE\fR is provided, then all bytes should
be examined until the first \fBNUL\fR byte terminates examination.
+1 -1
View File
@@ -599,7 +599,7 @@ their possible values are described in the manual entry for the Tcl
\fBfconfigure\fR command. Other options can be added by each channel type.
These channel type specific options are described in the manual entry for
the Tcl command that creates a channel of that type; for example, the
additional options for TCP-based channels are described in the manual entry
additional options for TCP based channels are described in the manual entry
for the Tcl \fBsocket\fR command.
The procedure normally returns \fBTCL_OK\fR. If an error occurs, it returns
\fBTCL_ERROR\fR and calls \fBTcl_SetErrno\fR to store an appropriate POSIX
+9 -9
View File
@@ -250,18 +250,18 @@ and \fBTcl_ObjGetVar2\fR is (if non-NULL) a value with a reference of at least
operated upon.
.PP
The \fInewValuePtr\fR argument to \fBTcl_SetVar2Ex\fR and \fBTcl_ObjSetVar2\fR
may be an arbitrary reference count value. Its reference count is
incremented on success. On failure, if its reference count is zero, it is
decremented and freed so the caller need do nothing with it.
may be an arbitrary reference count value; its reference count will be
incremented on success. However, it is recommended to not use a zero reference
count value, as that makes correct handling of the error case tricky.
.PP
The \fIpart1Ptr\fR argument to \fBTcl_ObjSetVar2\fR and \fBTcl_ObjGetVar2\fR can
have any reference count. These functions never modify it.
The \fIpart1\fR argument to \fBTcl_ObjSetVar2\fR and \fBTcl_ObjGetVar2\fR can
have any reference count; these functions never modify it. It is recommended
to not use a zero reference count for this argument.
.PP
The \fIpart2Ptr\fR argument to \fBTcl_ObjSetVar2\fR and \fBTcl_ObjGetVar2\fR, if
The \fIpart2\fR argument to \fBTcl_ObjSetVar2\fR and \fBTcl_ObjGetVar2\fR, if
non-NULL, should not have a zero reference count as these functions may
retain a reference to it, particularly when it is used to create an array
element that did not previously exist, and decrementing the reference count
later would leave them pointing to a freed Tcl_Obj.
retain a reference to it (particularly when it is used to create an array
element that did not previously exist).
.SH "SEE ALSO"
Tcl_GetObjResult, Tcl_GetStringResult, Tcl_TraceVar
+1 -1
View File
@@ -24,7 +24,7 @@ message.
.AP Tcl_Obj *objPtr in
A Tcl value containing the string to perform substitutions on.
.AP int flags in
OR'ed combination of flag bits that specify which substitutions to
ORed combination of flag bits that specify which substitutions to
perform. The flags \fBTCL_SUBST_COMMANDS\fR,
\fBTCL_SUBST_VARIABLES\fR and \fBTCL_SUBST_BACKSLASHES\fR are
currently supported, and \fBTCL_SUBST_ALL\fR is provided as a
+200 -124
View File
@@ -1,7 +1,6 @@
'\"
'\" Copyright (c) 1993 The Regents of the University of California.
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
'\" Copyright (c) 2023 Nathan Coulter
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -17,152 +16,176 @@ Summary of Tcl language syntax.
.SH DESCRIPTION
.PP
The following rules define the syntax and semantics of the Tcl language:
.
.IP "[1] \fBScript.\fR"
A script is composed of zero or more commands delimited by semi-colons or
newlines.
.IP "[2] \fBCommand.\fR"
A command is composed of zero or more words delimited by whitespace. The
replacement for a substitution is included verbatim in the word. For example, a
space in the replacement is included in the word rather than becoming a
delimiter, and \fI\\\\\fR becomes a single backslash in the word. Each word is
processed from left to right and each substitution is performed as soon as it
is complete.
For example, the command
.RS
.PP
.CS
set y [set x 0][incr x][incr x]
.CE
.PP
is composed of three words, and sets the value of \fIy\fR to \fI012\fR.
.PP
If hash
.PQ #
is the first character of what would otherwise be the first word of a command,
all characters up to the next newline are ignored.
.RE
.
.IP "[3] \fBBraced word.\fR"
If a word is enclosed in braces
.PQ {
and
.PQ } ""
, the braces are removed and the enclosed characters become the word. No
substitutions are performed. Nested pairs of braces may occur within the word.
A brace preceded by an odd number of backslashes is not considered part of a
pair, and neither brace nor the backslashes are removed from the word.
.
.IP "[4] \fBQuoted word.\fR"
If a word is enclosed in double quotes
.IP "[1] \fBCommands.\fR"
A Tcl script is a string containing one or more commands.
Semi-colons and newlines are command separators unless quoted as
described below.
Close brackets are command terminators during command substitution
(see below) unless quoted.
.IP "[2] \fBEvaluation.\fR"
A command is evaluated in two steps.
First, the Tcl interpreter breaks the command into \fIwords\fR
and performs substitutions as described below.
These substitutions are performed in the same way for all
commands.
Secondly, the first word is used to locate a routine to
carry out the command, and the remaining words of the command are
passed to that routine.
The routine is free to interpret each of its words
in any way it likes, such as an integer, variable name, list,
or Tcl script.
Different commands interpret their words differently.
.IP "[3] \fBWords.\fR"
Words of a command are separated by white space (except for
newlines, which are command separators).
.IP "[4] \fBDouble quotes.\fR"
If the first character of a word is double-quote
.PQ \N'34'
, the double quotes are removed and the enclosed characters become the word.
Substitutions are performed.
.
.IP "[5] \fBList.\fR"
A list has the form of a single command. Newline is whitespace, and semicolon
has no special interpretation. There is no script evaluation so there is no
argument expansion, variable substitution, or command substitution: Dollar-sign
and open bracket have no special interpretation, and what would be argument
expansion in a script is invalid in a list.
.
.IP "[6] \fBArgument expansion.\fR"
If
then the word is terminated by the next double-quote character.
If semi-colons, close brackets, or white space characters
(including newlines) appear between the quotes then they are treated
as ordinary characters and included in the word.
Command substitution, variable substitution, and backslash substitution
are performed on the characters between the quotes as described below.
The double-quotes are not retained as part of the word.
.IP "[5] \fBArgument expansion.\fR"
If a word starts with the string
.QW {*}
prefixes a word, it is removed. After any remaining enclosing braces or quotes
are processed and applicable substitutions performed, the word, which must
be a list, is removed from the command, and in its place each word in the
list becomes an additional word in the command. For example,
.CS
cmd a {*}{b [c]} d {*}{$e f {g h}}
.CE
followed by a non-whitespace character, then the leading
.QW {*}
is removed and the rest of the word is parsed and substituted as any other
word. After substitution, the word is parsed as a list (without command or
variable substitutions; backslash substitutions are performed as is normal for
a list and individual internal words may be surrounded by either braces or
double-quote characters), and its words are added to the command being
substituted. For instance,
.QW "cmd a {*}{b [c]} d {*}{$e f {g h}}"
is equivalent to
.CS
cmd a b {[c]} d {$e} f {g h} .
.CE
.
.IP "[7] \fBEvaluation.\fR"
To evaluate a script, an interpreter evaluates each successive command. The
first word identifies a procedure, and the remaining words are passed to that
procedure for further evaluation. The procedure interprets each argument in
its own way, e.g. as an integer, variable name, list, mathematical expression,
script, or in some other arbitrary way. The result of the last command is the
result of the script.
.
.IP "[8] \fBCommand substitution.\fR"
Each pair of brackets
.QW "cmd a b {[c]} d {$e} f {g h}" .
.IP "[6] \fBBraces.\fR"
If the first character of a word is an open brace
.PQ {
and rule [5] does not apply, then
the word is terminated by the matching close brace
.PQ } "" .
Braces nest within the word: for each additional open
brace there must be an additional close brace (however,
if an open brace or close brace within the word is
quoted with a backslash then it is not counted in locating the
matching close brace).
No substitutions are performed on the characters between the
braces except for backslash-newline substitutions described
below, nor do semi-colons, newlines, close brackets,
or white space receive any special interpretation.
The word will consist of exactly the characters between the
outer braces, not including the braces themselves.
.IP "[7] \fBCommand substitution.\fR"
If a word contains an open bracket
.PQ [
and
.PQ ] ""
encloses a script and is replaced by the result of that script.
.IP "[9] \fBVariable substitution.\fR"
Each of the following forms begins with dollar sign
then Tcl performs \fIcommand substitution\fR.
To do this it invokes the Tcl interpreter recursively to process
the characters following the open bracket as a Tcl script.
The script may contain any number of commands and must be terminated
by a close bracket
.PQ ] "" .
The result of the script (i.e. the result of its last command) is
substituted into the word in place of the brackets and all of the
characters between them.
There may be any number of command substitutions in a single word.
Command substitution is not performed on words enclosed in braces.
.IP "[8] \fBVariable substitution.\fR"
If a word contains a dollar-sign
.PQ $
and is replaced by the value of the identified variable. \fIname\fR names the
variable and is composed of ASCII letters (\fBA\fR\(en\fBZ\fR and
\fBa\fR\(en\fBz\fR), digits (\fB0\fR\(en\fB9\fR), underscores, or namespace
delimiters (two or more colons). \fIindex\fR is the name of an individual
variable within an array variable, and may be empty.
followed by one of the forms
described below, then Tcl performs \fIvariable
substitution\fR: the dollar-sign and the following characters are
replaced in the word by the value of a variable.
Variable substitution may take any of the following forms:
.RS
.TP 15
\fB$\fIname\fR
.
\fIname\fR may not be empty.
\fIName\fR is the name of a scalar variable; the name is a sequence
of one or more characters that are a letter, digit, underscore,
or namespace separators (two or more colons).
Letters and digits are \fIonly\fR the standard ASCII ones (\fB0\fR\(en\fB9\fR,
\fBA\fR\(en\fBZ\fR and \fBa\fR\(en\fBz\fR).
.TP 15
\fB$\fIname\fB(\fIindex\fB)\fR
.
\fIname\fR may be empty. Substitutions are performed on \fIindex\fR.
\fIName\fR gives the name of an array variable and \fIindex\fR gives
the name of an element within that array.
\fIName\fR must contain only letters, digits, underscores, and
namespace separators, and may be an empty string.
Letters and digits are \fIonly\fR the standard ASCII ones (\fB0\fR\(en\fB9\fR,
\fBA\fR\(en\fBZ\fR and \fBa\fR\(en\fBz\fR).
Command substitutions, variable substitutions, and backslash
substitutions are performed on the characters of \fIindex\fR.
.TP 15
\fB${\fIname\fB}\fR
\fIname\fR may be empty.
.TP 15
\fB${\fIname(index)\fB}\fR
.
\fIname\fR may be empty. No substitutions are performed.
\fIName\fR is the name of a scalar variable or array element. It may contain
any characters whatsoever except for close braces. It indicates an array
element if \fIname\fR is in the form
.QW \fIarrayName\fB(\fIindex\fB)\fR
where \fIarrayName\fR does not contain any open parenthesis characters,
.QW \fB(\fR ,
or close brace characters,
.QW \fB}\fR ,
and \fIindex\fR can be any sequence of characters except for close brace
characters. No further
substitutions are performed during the parsing of \fIname\fR.
.PP
There may be any number of variable substitutions in a single word.
Variable substitution is not performed on words enclosed in braces.
.PP
Note that variables may contain character sequences other than those listed
above, but in that case other mechanisms must be used to access them (e.g.,
via the \fBset\fR command's single-argument form).
.RE
Variables that are not accessible through one of the forms above may be
accessed through other mechanisms, e.g. the \fBset\fR command.
.IP "[10] \fBBackslash substitution.\fR"
Each backslash
.IP "[9] \fBBackslash substitution.\fR"
If a backslash
.PQ \e
that is not part of one of the forms listed below is removed, and the next
character is included in the word verbatim, which allows the inclusion of
characters that would normally be interpreted, namely whitespace, braces,
brackets, double quote, dollar sign, and backslash. The following sequences
are replaced as described:
.RS
.RS
appears within a word then \fIbackslash substitution\fR occurs.
In all cases but those described below the backslash is dropped and
the following character is treated as an ordinary
character and included in the word.
This allows characters such as double quotes, close brackets,
and dollar signs to be included in words without triggering
special processing.
The following table lists the backslash sequences that are
handled specially, along with the value that replaces each sequence.
.RS
.TP 7
\e\fBa\fR
Audible alert (bell) (U+7).
Audible alert (bell) (Unicode U+000007).
.TP 7
\e\fBb\fR
Backspace (U+8).
Backspace (Unicode U+000008).
.TP 7
\e\fBf\fR
Form feed (U+C).
Form feed (Unicode U+00000C).
.TP 7
\e\fBn\fR
Newline (U+A).
Newline (Unicode U+00000A).
.TP 7
\e\fBr\fR
Carriage-return (U+D).
Carriage-return (Unicode U+00000D).
.TP 7
\e\fBt\fR
Tab (U+9).
Tab (Unicode U+000009).
.TP 7
\e\fBv\fR
Vertical tab (U+B).
Vertical tab (Unicode U+00000B).
.TP 7
\e\fB<newline>\fIwhiteSpace\fR
.
Newline preceded by an odd number of backslashes, along with the consecutive
spaces and tabs that immediately follow it, is replaced by a single space.
Because this happens before the command is split into words, it occurs even
within braced words, and if the resulting space may subsequently be treated as
a word delimiter.
A single space character replaces the backslash, newline, and all spaces
and tabs after the newline. This backslash sequence is unique in that it
is replaced in a separate pre-pass before the command is actually parsed.
This means that it will be replaced even when it occurs between braces,
and the resulting space will be treated as a word separator if it is not
in braces or quotes.
.TP 7
\e\e
Backslash
@@ -170,30 +193,83 @@ Backslash
.TP 7
\e\fIooo\fR
.
Up to three octal digits form an eight-bit value for a Unicode character in the
range \fI0\fR\(en\fI377\fR, i.e. U+0\(enU+FF. Only the digits that result in a
number in this range are consumed.
The digits \fIooo\fR (one, two, or three of them) give a eight-bit octal
value for the Unicode character that will be inserted, in the range
\fI000\fR\(en\fI377\fR (i.e., the range U+000000\(enU+0000FF).
The parser will stop just before this range overflows, or when
the maximum of three digits is reached. The upper bits of the Unicode
character will be 0.
.TP 7
\e\fBx\fIhh\fR
.
Up to two hexadecimal digits form an eight-bit value for a Unicode character in
the range \fI0\fR\(en\fIFF\fR.
The hexadecimal digits \fIhh\fR (one or two of them) give an eight-bit
hexadecimal value for the Unicode character that will be inserted. The upper
bits of the Unicode character will be 0 (i.e., the character will be in the
range U+000000\(enU+0000FF).
.TP 7
\e\fBu\fIhhhh\fR
.
Up to four hexadecimal digits form a 16-bit value for a Unicode character in
the range \fI0\fR\(en\fIFFFF\fR.
The hexadecimal digits \fIhhhh\fR (one, two, three, or four of them) give a
sixteen-bit hexadecimal value for the Unicode character that will be
inserted. The upper bits of the Unicode character will be 0 (i.e., the
character will be in the range U+000000\(enU+00FFFF).
.TP 7
\e\fBU\fIhhhhhhhh\fR
.
Up to eight hexadecimal digits form a 21-bit value for a Unicode character in
the range \fI0\fR\(en\fI10FFFF\fR. Only the digits that result in a number in
this range are consumed.
.RE
The hexadecimal digits \fIhhhhhhhh\fR (one up to eight of them) give a
twenty-one-bit hexadecimal value for the Unicode character that will be
inserted, in the range U+000000\(enU+10FFFF. The parser will stop just
before this range overflows, or when the maximum of eight digits
is reached. The upper bits of the Unicode character will be 0.
.RS
.PP
The range U+00D800\(enU+00DFFF is reserved for surrogates, which
are illegal on their own. Therefore, such sequences will result in
the replacement character U+FFFD. Surrogate pairs should be
encoded as single \e\fBU\fIhhhhhhhh\fR character.
.RE
.PP
Backslash substitution is not performed on words enclosed in braces,
except for backslash-newline as described above.
.RE
.
.IP "[10] \fBComments.\fR"
If a hash character
.PQ #
appears at a point where Tcl is
expecting the first character of the first word of a command,
then the hash character and the characters that follow it, up
through the next newline, are treated as a comment and ignored.
The comment character only has significance when it appears
at the beginning of a command.
.IP "[11] \fBOrder of substitution.\fR"
Each character is processed exactly once by the Tcl interpreter
as part of creating the words of a command.
For example, if variable substitution occurs then no further
substitutions are performed on the value of the variable; the
value is inserted into the word verbatim.
If command substitution occurs then the nested command is
processed entirely by the recursive call to the Tcl interpreter;
no substitutions are performed before making the recursive
call and no additional substitutions are performed on the result
of the nested script.
.RS
.PP
Substitutions take place from left to right, and each substitution is
evaluated completely before attempting to evaluate the next. Thus, a
sequence like
.PP
.CS
set y [set x 0][incr x][incr x]
.CE
.PP
will always set the variable \fIy\fR to the value, \fI012\fR.
.RE
.IP "[12] \fBSubstitution and word boundaries.\fR"
Substitutions do not affect the word boundaries of a command,
except for argument expansion as specified in rule [5].
For example, during variable substitution the entire value of
the variable becomes part of a single word, even if the variable's
value contains spaces.
.SH KEYWORDS
backslash, command, comment, script, substitution, variable
'\" Local Variables:
-10
View File
@@ -156,16 +156,6 @@ applied to input only.
The default value is the empty string, except that under Windows the default
value for reading is Control-z (\ex1A). The acceptable range is \ex01 -
\ex7f. A value outside this range results in an error.
.VS "TCL8.7 TIP656"
.TP
\fB\-profile\fR \fIprofile\fR
.
Specifies the encoding profile to be used on the channel. The encoding
transforms in use for the channel's input and output will then be subject to the
rules of that profile. Any failures will result in a channel error. See
\fBPROFILES\fR in the \fBencoding(n)\fR documentation for details about encoding
profiles.
.VE "TCL8.7 TIP656"
.TP
\fB\-translation\fR \fItranslation\fR
.TP
-333
View File
@@ -1,333 +0,0 @@
'\"
'\" Copyright © 2019 Donal K. Fellows
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
.TH configurable n 0.1 TclOO "TclOO Commands"
.so man.macros
.BS
'\" Note: do not modify the .SH NAME line immediately below!
.SH NAME
oo::configurable, configure, property \- class that makes configurable classes and objects, and supports making configurable properties
.SH SYNOPSIS
.nf
package require TclOO
\fBoo::configurable create \fIclass\fR ?\fIdefinitionScript\fR?
\fBoo::define \fIclass\fB {\fR
\fBproperty \fIpropName\fR ?\fIoptions...\fR? ?\fIpropName\fR ?\fIoptions...\fR?...?
\fB}\fR
\fBoo::objdefine \fIobject\fB {\fR
\fBproperty \fIpropName\fR ?\fIoptions...\fR? ?\fIpropName\fR ?\fIoptions...\fR?...?
\fB}\fR
\fIobjectName \fBconfigure\fR
\fIobjectName \fBconfigure\fR \fI\-prop\fR
\fIobjectName \fBconfigure\fR \fI\-prop value\fR ?\fI\-prop value\fR...
.fi
.SH "CLASS HIERARCHY"
.nf
\fBoo::object\fR
\(-> \fBoo::class\fR
\(-> \fBoo::configurable\fR
\fBoo::object\fR
\(-> \fBoo::class\fR
\(-> \fBoo::configurablesupport::configurable\fR
.fi
.BE
.SH DESCRIPTION
.PP
Configurable objects are objects that support being configured with a
\fBconfigure\fR method. Each of the configurable entities of the object is
known as a property of the object. Properties may be defined on classes or
instances; when configuring an object, any of the properties defined by its
classes (direct or indirect) or by the instance itself may be configured.
.PP
The \fBoo::configurable\fR metaclass installs basic support for making
configurable objects into a class. This consists of making a \fBproperty\fR
definition command available in definition scripts for the class and instances
(e.g., from the class's constructor, within \fBoo::define\fR and within
\fBoo::objdefine\fR) and making a \fBconfigure\fR method available within the
instances.
.SS "CONFIGURE METHOD"
.PP
The behavior of the \fBconfigure\fR method is modelled after the
\fBfconfigure\fR/\fBchan configure\fR command.
.PP
If passed no additional arguments, the \fBconfigure\fR method returns an
alphabetically sorted dictionary of all \fIreadable\fR and \fIread-write\fR
properties and their current values.
.PP
If passed a single additional argument, that argument to the \fBconfigure\fR
method must be the name of a property to read (or an unambiguous prefix
thereof); its value is returned.
.PP
Otherwise, if passed an even number of arguments then each pair of arguments
specifies a property name (or an unambiguous prefix thereof) and the value to
set it to. The properties will be set in the order specified, including
duplicates. If the setting of any property fails, the overall \fBconfigure\fR
method fails, the preceding pairs (if any) will continue to have been applied,
and the succeeding pairs (if any) will be not applied. On success, the result
of the \fBconfigure\fR method in this mode operation will be an empty string.
.SS "PROPERTY DEFINITIONS"
.PP
When a class has been manufactured by the \fBoo::configurable\fR metaclass (or
one of its subclasses), it gains an extra definition, \fBproperty\fR. The
\fBproperty\fR definition defines one or more properties that will be exposed
by the class's instances.
.PP
The \fBproperty\fR command takes the name of a property to define first,
\fIwithout a leading hyphen\fR, followed by a number of option-value pairs
that modify the basic behavior of the property. This can then be followed by
an arbitrary number of other property definitions. The supported options are:
.TP
\fB\-get \fIgetterScript\fR
.
This defines the implementation of how to read from the property; the
\fIgetterScript\fR will become the body of a method (taking no arguments)
defined on the class, if the kind of the property is such that the property
can be read from. The method will be named
\fB<ReadProp-\fIpropertyName\fB>\fR, and will default to being a simple read
of the instance variable with the same name as the property (e.g.,
.QW "\fBproperty\fR xyz"
will result in a method
.QW <ReadProp-xyz>
being created).
.TP
\fB\-kind \fIpropertyKind\fR
.
This defines what sort of property is being created. The \fIpropertyKind\fR
must be exactly one of \fBreadable\fR, \fBwritable\fR, or \fBreadwrite\fR
(which is the default) which will make the property read-only, write-only or
read-write, respectively. Read-only properties can only ever be read from,
write-only properties can only ever be written to, and read-write properties
can be both read and written.
.RS
.PP
Note that write-only properties are not particularly discoverable as they are
never reported by the \fBconfigure\fR method other than by error messages when
attempting to write to a property that does not exist.
.RE
.TP
\fB\-set \fIsetterScript\fR
.
This defines the implementation of how to write to the property; the
\fIsetterScript\fR will become the body of a method taking a single argument,
\fIvalue\fR, defined on the class, if the kind of the property is such that
the property can be written to. The method will be named
\fB<WriteProp-\fIpropertyName\fB>\fR, and will default to being a simple write
of the instance variable with the same name as the property (e.g.,
.QW "\fBproperty\fR xyz"
will result in a method
.QW <WriteProp-xyz>
being created).
.PP
Instances of the class that was created by \fBoo::configurable\fR will also
support \fBproperty\fR definitions; the semantics will be exactly as above
except that the properties will be defined on the instance alone.
.PP
Note that the property implementation methods that \fBproperty\fR defines
should not be private, as this makes them inaccessible from the implementation
of \fBconfigure\fR (by design; the property configuration mechanism is
intended for use mainly from outside a class, whereas a class may access
variables directly). The variables accessed by the default implementations of
the properties \fImay\fR be private, if so declared.
.SH "ADVANCED USAGE"
.PP
The configurable class system is comprised of several pieces. The
\fBoo::configurable\fR metaclass works by mixing in a class and setting
definition namespaces during object creation that provide the other bits and
pieces of machinery. The key pieces of the implementation are enumerated here
so that they can be used by other code:
.TP
\fBoo::configuresupport::configurable\fR
.
This is a class that provids the implementation of the \fBconfigure\fR method
(described above in \fBCONFIGURE METHOD\fR).
.TP
\fBoo::configuresupport::configurableclass\fR
.
This is a namespace that contains the definition dialect that provides the
\fBproperty\fR declaration for use in classes (i.e., via \fBoo::define\fR, and
class constructors under normal circumstances), as described above in
\fBPROPERTY DEFINITIONS\fR. It \fBnamespace export\fRs its \fBproperty\fR
command so that it may be used easily in user definition dialects.
.TP
\fBoo::configuresupport::configurableobject\fR
.
This is a namespace that contains the definition dialect that provides the
\fBproperty\fR declaration for use in instance objects (i.e., via
\fBoo::objdefine\fR, and the \fBself\fR declaration in \fBoo::define\fR), as
described above in \fBPROPERTY DEFINITIONS\fR. It \fBnamespace export\fRs its
\fBproperty\fR command so that it may be used easily in user definition
dialects.
.PP
The underlying property discovery mechanism relies on four slots (see
\fBoo::define\fR for what that implies) that list the properties that can be
configured. These slots do not themselves impose any semantics on what the
slots mean other than that they have unique names, no important order, can be
inherited and discovered on classes and instances.
.PP
These slots, and their intended semantics, are:
.TP
\fBoo::configuresupport::readableproperties\fR
.
The set of properties of a class (not including those from its superclasses)
that may be read from when configuring an instance of the class. This slot can
also be read with the \fBinfo class properties\fR command.
.TP
\fBoo::configuresupport::writableproperties\fR
.
The set of properties of a class (not including those from its superclasses)
that may be written to when configuring an instance of the class. This slot
can also be read with the \fBinfo class properties\fR command.
.TP
\fBoo::configuresupport::objreadableproperties\fR
.
The set of properties of an object instance (not including those from its
classes) that may be read from when configuring the object. This slot can
also be read with the \fBinfo object properties\fR command.
.TP
\fBoo::configuresupport::objwritableproperties\fR
.
The set of properties of an object instance (not including those from its
classes) that may be written to when configuring the object. This slot can
also be read with the \fBinfo object properties\fR command.
.PP
Note that though these are slots, they are \fInot\fR in the standard
\fBoo::define\fR or \fBoo::objdefine\fR namespaces; in order to use them
inside a definition script, they need to be referred to by full name. This is
because they are intended to be building bricks of configurable property
system, and not directly used by normal user code.
.SS "IMPLEMENTATION NOTE"
.PP
The implementation of the \fBconfigure\fR method uses
\fBinfo object properties\fR with the \fB\-all\fR option to discover what
properties it may manipulate.
.SH EXAMPLES
.PP
Here we create a simple configurable class and demonstrate how it can be
configured:
.PP
.CS
\fBoo::configurable\fR create Point {
\fBproperty\fR x y
constructor args {
my \fBconfigure\fR -x 0 -y 0 {*}$args
}
variable x y
method print {} {
puts "x=$x, y=$y"
}
}
set pt [Point new -x 27]
$pt print; \fI# x=27, y=0\fR
$pt \fBconfigure\fR -y 42
$pt print; \fI# x=27, y=42\fR
puts "distance from origin: [expr {
hypot([$pt \fBconfigure\fR -x], [$pt \fBconfigure\fR -y])
}]"; \fI# distance from origin: 49.92995093127971\fR
puts [$pt \fBconfigure\fR]
\fI# -x 27 -y 42\fR
.CE
.PP
Such a configurable class can be extended by subclassing, though the subclass
needs to also be created by \fBoo::configurable\fR if it will use the
\fBproperty\fR definition:
.PP
.CS
\fBoo::configurable\fR create Point3D {
superclass Point
\fBproperty\fR z
constructor args {
next -z 0 {*}$args
}
}
set pt2 [Point3D new -x 2 -y 3 -z 4]
puts [$pt2 \fBconfigure\fR]
\fI# -x 2 -y 3 -z 4\fR
.CE
.PP
Once you have a configurable class, you can also add instance properties to
it. (The backing variables for all properties start unset.) Note below that we
are using an unambiguous prefix of a property name when setting it; this is
supported for all properties though full names are normally recommended
because subclasses will not make an unambiguous prefix become ambiguous in
that case.
.PP
.CS
oo::objdefine $pt {
\fBproperty\fR color
}
$pt \fBconfigure\fR -c bisque
puts [$pt \fBconfigure\fR]
\fI# -color bisque -x 27 -y 42\fR
.CE
.PP
You can also do derived properties by making them read-only and supplying a
script that computes them.
.PP
.CS
\fBoo::configurable\fR create PointMk2 {
\fBproperty\fR x y
\fBproperty\fR distance -kind readable -get {
return [expr {hypot($x, $y)}]
}
variable x y
constructor args {
my \fBconfigure\fR -x 0 -y 0 {*}$args
}
}
set pt3 [PointMk2 new -x 3 -y 4]
puts [$pt3 \fBconfigure\fR -distance]
\fI# 5.0\fR
$pt3 \fBconfigure\fR -distance 10
\fI# ERROR: bad property "-distance": must be -x or -y\fR
.CE
.PP
Setters are used to validate the type of a property:
.PP
.CS
\fBoo::configurable\fR create PointMk3 {
\fBproperty\fR x -set {
if {![string is double -strict $value]} {
error "-x property must be a number"
}
set x $value
}
\fBproperty\fR y -set {
if {![string is double -strict $value]} {
error "-y property must be a number"
}
set y $value
}
variable x y
constructor args {
my \fBconfigure\fR -x 0 -y 0 {*}$args
}
}
set pt4 [PointMk3 new]
puts [$pt4 \fBconfigure\fR]
\fI# -x 0 -y 0\fR
$pt4 \fBconfigure\fR -x 3 -y 4
puts [$pt4 \fBconfigure\fR]
\fI# -x 3 -y 4\fR
$pt4 \fBconfigure\fR -x "obviously not a number"
\fI# ERROR: -x property must be a number\fR
.CE
.SH "SEE ALSO"
info(n), oo::class(n), oo::define(n)
.SH KEYWORDS
class, object, properties, configuration
.\" Local variables:
.\" mode: nroff
.\" fill-column: 78
.\" End:
-6
View File
@@ -493,12 +493,6 @@ the slot:
.
This appends the given \fImember\fR elements to the slot definition.
.TP
\fIslot\fR \fB\-appendifnew\fR ?\fImember ...\fR?
.VS TIP558
This appends the given \fImember\fR elements to the slot definition if they
do not already exist.
.VE TIP558
.TP
\fIslot\fR \fB\-clear\fR
.
This sets the slot definition to the empty list.
+129 -152
View File
@@ -8,196 +8,173 @@
.so man.macros
.BS
.SH NAME
encoding \- Work with encodings
encoding \- Manipulate encodings
.SH SYNOPSIS
\fBencoding \fIoperation\fR ?\fIarg arg ...\fR?
\fBencoding \fIoption\fR ?\fIarg arg ...\fR?
.BE
.SH INTRODUCTION
.PP
In Tcl every string is composed of Unicode values. Text may be encoded into an
encoding such as cp1252, iso8859-1, Shitf\-JIS, utf-8, utf-16, etc. Not every
Unicode vealue is encodable in every encoding, and some encodings can encode
values that are not available in Unicode.
Strings in Tcl are logically a sequence of Unicode characters.
These strings are represented in memory as a sequence of bytes that
may be in one of several encodings: modified UTF\-8 (which uses 1 to 4
bytes per character), or a custom encoding start as 8 bit binary data.
.PP
Even though Unicode is for encoding the written texts of human languages, any
sequence of bytes can be encoded as the first 255 Unicode values. iso8859-1 an
encoding for a subset of Unicode in which each byte is a Unicode value of 255
or less. Thus, any sequence of bytes can be considered to be a Unicode string
encoded in iso8859-1. To work with binary data in Tcl, decode it from
iso8859-1 when reading it in, and encode it into iso8859-1 when writing it out,
ensuring that each character in the string has a value of 255 or less.
Decoding such a string does nothing, and encoding encoding such a string also
does nothing.
.PP
For example, the following is true:
.CS
set text {In Tcl binary data is treated as Unicode text and it just works.}
set encoded [encoding convertto iso8859-1 $text]
expr {$text eq $encoded}; #-> 1
.CE
The following is also true:
.CS
set decoded [encoding convertfrom iso8859-1 $text]
expr {$text eq $decoded}; #-> 1
.CE
Different operating system interfaces or applications may generate
strings in other encodings such as Shift\-JIS. The \fBencoding\fR
command helps to bridge the gap between Unicode and these other
formats.
.SH DESCRIPTION
.PP
Performs one of the following encoding \fIoperations\fR:
Performs one of several encoding related operations, depending on
\fIoption\fR. The legal \fIoption\fRs are:
.TP
\fBencoding convertfrom\fR ?\fIencoding\fR? \fIdata\fR
.TP
\fBencoding convertfrom\fR ?\fB-profile \fIprofile\fR? ?\fB-failindex var\fR? \fIencoding\fR \fIdata\fR
\fBencoding convertfrom\fR ?\fB-strict\fR? ?\fB-failindex var\fR? ?\fIencoding\fR? \fIdata\fR
\fBencoding convertfrom\fR \fB-nocomplain\fR ?\fIencoding\fR? \fIdata\fR
.
Decodes \fIdata\fR encoded in \fIencoding\fR. If \fIencoding\fR is not
specified the current system encoding is used.
.VS "TCL8.7 TIP607, TIP656"
\fB-profile\fR determines how invalid data for the encoding are handled. See
the \fBPROFILES\fR section below for details. Returns an error if decoding
fails. However, if \fB-failindex\fR given, returns the result of the
conversion up to the point of termination, and stores in \fBvar\fR the index of
the character that could not be converted. If no errors are encountered the
entire result of the conversion is returned and the value \fB-1\fR is stored in
\fBvar\fR.
.VE "TCL8.7 TIP607, TIP656"
Convert \fIdata\fR to a Unicode string from the specified \fIencoding\fR. The
characters in \fIdata\fR are 8 bit binary data. The resulting
sequence of bytes is a string created by applying the given \fIencoding\fR
to the data. If \fIencoding\fR is not specified, the current
system encoding is used. If at least one of \fB-strict\fR/\fB-failindex var\fR/\fB-nocomplain\fR
is provided, this makes the \fIencoding\fR argument mandatory.
.VS "TCL8.7 TIP346, TIP607, TIP601"
.PP
.RS
The command does not fail on encoding errors. Instead, any not convertable bytes
(like incomplete UTF-8 sequences, see example below) are put as byte values into
the output stream.
.PP
If the option \fB-failindex\fR with a variable name is given, the error reporting
is changed in the following manner:
in case of a conversion error, the position of the input byte causing the error
is returned in the given variable. The return value of the command are the
converted characters until the first error position.
In case of no error, the value \fI-1\fR is written to the variable. This option
may not be used together with \fB-nocomplain\fR.
.PP
The option \fB-nocomplain\fR has no effect and is available for compatibility with
TCL 9. In TCL 9, the encoding command fails with an error on any encoding issue.
This switch restores the TCL8.7 behaviour.
.PP
The \fB-strict\fR option follows more strict rules in conversion. For the \fButf-8\fR
encoder, it disallows invalid byte sequences and surrogates (which -
otherwise - are just passed through). This option may not be used together
with \fB-nocomplain\fR.
.VE "TCL8.7 TIP346, TIP607, TIP601"
.RE
.TP
\fBencoding convertto\fR ?\fIencoding\fR? \fIdata\fR
.TP
\fBencoding convertto\fR ?\fB-profile \fIprofile\fR? ?\fB-failindex var\fR? \fIencoding\fR \fIdata\fR
\fBencoding convertto\fR ?\fB-strict\fR? ?\fB-failindex var\fR? ?\fIencoding\fR? \fIdata\fR
\fBencoding convertto\fR \fB-nocomplain\fR ?\fIencoding\fR? \fIdata\fR
.
Converts \fIstring\fR to \fIencoding\fR. If \fIencoding\fR is not given, the
current system encoding is used.
.VS "TCL8.7 TIP607, TIP656"
See \fBencoding convertfrom\fR for the meaning of \fB-profile\fR and \fB-failindex\fR.
.VE "TCL8.7 TIP607, TIP656"
Convert \fIstring\fR from Unicode to the specified \fIencoding\fR.
The result is a sequence of bytes that represents the converted
string. Each byte is stored in the lower 8-bits of a Unicode
character (indeed, the resulting string is a binary string as far as
Tcl is concerned, at least initially). If \fIencoding\fR is not
specified, the current system encoding is used. If at least one of
\fB-strict\fR/\fB-failindex var\fR/\fB-nocomplain\fR
is provided, this makes the \fIencoding\fR argument mandatory.
.VS "TCL8.7 TIP346, TIP607, TIP601"
.PP
.RS
The command does not fail on encoding errors. Instead, the replacement character
\fB?\fR is output for any not representable character (like the dot \fB\\U2022\fR
in \fBiso-8859-1\fR encoding, see example below).
.PP
If the option \fB-failindex\fR with a variable name is given, the error reporting
is changed in the following manner:
in case of a conversion error, the position of the input character causing the error
is returned in the given variable. The return value of the command are the
converted bytes until the first error position. No error condition is raised.
In case of no error, the value \fI-1\fR is written to the variable. This option
may not be used together with \fB-nocomplain\fR.
.PP
The option \fB-nocomplain\fR has no effect and is available for compatibility with
TCL 9. In TCL 9, the encoding command fails with an error on any encoding issue.
This switch restores the TCL8.7 behaviour.
.PP
The \fB-strict\fR option follows more strict rules in conversion. For the \fButf-8\fR
encoder, it disallows surrogates (which - otherwise - are just passed through). This
option may not be used together with \fB-nocomplain\fR.
.VE "TCL8.7 TIP346, TIP607, TIP601"
.RE
.TP
\fBencoding dirs\fR ?\fIdirectoryList\fR?
.
Sets the search path for \fB*.enc\fR encoding data files to the list of
directories given by \fIdirectoryList\fR. If \fIdirectoryList\fR is not given,
returns the current list of directories that make up the search path. It is
not an error for an item in \fIdirectoryList\fR to not refer to a readable,
searchable directory.
Tcl can load encoding data files from the file system that describe
additional encodings for it to work with. This command sets the search
path for \fB*.enc\fR encoding data files to the list of directories
\fIdirectoryList\fR. If \fIdirectoryList\fR is omitted then the
command returns the current list of directories that make up the
search path. It is an error for \fIdirectoryList\fR to not be a valid
list. If, when a search for an encoding data file is happening, an
element in \fIdirectoryList\fR does not refer to a readable,
searchable directory, that element is ignored.
.TP
\fBencoding names\fR
.
Returns a list of the names of available encodings.
Returns a list containing the names of all of the encodings that are
currently available.
The encodings
.QW utf-8
and
.QW iso8859-1
are guaranteed to be present in the list.
.VS "TCL8.7 TIP656"
.TP
\fBencoding profiles\fR
Returns a list of names of available encoding profiles. See \fBPROFILES\fR
below.
.VE "TCL8.7 TIP656"
.TP
\fBencoding system\fR ?\fIencoding\fR?
.
Sets the system encoding to \fIencoding\fR. If \fIencoding\fR is not given,
returns the current system encoding. The system encoding is used to pass
strings to system calls.
.\" Do not put .VS on whole section as that messes up the bullet list alignment
.SH PROFILES
Set the system encoding to \fIencoding\fR. If \fIencoding\fR is
omitted then the command returns the current system encoding. The
system encoding is used whenever Tcl passes strings to system calls.
.SH EXAMPLE
.PP
.VS "TCL8.7 TIP656"
Each \fIprofile\fR is a distinct strategy for dealing with invalid data for an
encoding.
.PP
The following profiles are currently implemented.
.VS "TCL8.7 TIP656"
.TP
\fBtcl8\fR
.
The default profile. Provides for behaviour identical to that of Tcl 8.6: When
decoding, for encodings \fBother than utf-8\fR, each invalid byte is interpreted
as the Unicode value given by that one byte. For example, the byte 0x80, which
is invalid in the ASCII encoding would be mapped to the Unicode value U+0080.
For \fButf-8\fR, each invalid byte that is a valid CP1252 character is
interpreted as the Unicode value for that character, while each byte that is
not is treated as the Unicode value given by that one byte. For example, byte
0x80 is defined by CP1252 and is therefore mapped to its Unicode equivalent
U+20AC while byte 0x81 which is not defined by CP1252 is mapped to U+0081. As
an additional special case, the sequence 0xC0 0x80 is mapped to U+0000.
When encoding, each character that cannot be represented in the encoding is
replaced by an encoding-dependent character, usually the question mark \fB?\fR.
.TP
\fBstrict\fR
.
The operation fails when invalid data for the encoding are encountered.
.TP
\fBreplace\fR
.
When decoding, invalid bytes are replaced by U+FFFD, the Unicode REPLACEMENT
CHARACTER.
When encoding, Unicode values that cannot be represented in the target encoding
are transformed to an encoding-specific fallback character, U+FFFD REPLACEMENT
CHARACTER for UTF targets, and generally `?` for other encodings.
.VE "TCL8.7 TIP656"
.SH EXAMPLES
.PP
These examples use the utility proc below that prints the Unicode value for
each character in a string.
Example 1: convert a byte sequence in Japanese euc-jp encoding to a TCL string:
.PP
.CS
proc codepoints s {join [lmap c [split $s {}] {
string cat U+ [format %.6X [scan $c %c]]}]
}
set s [\fBencoding convertfrom\fR euc-jp "\exA4\exCF"]
.CE
.PP
Example 1: Convert from euc-jp:
.PP
.CS
% codepoints [\fBencoding convertfrom\fR euc-jp \exA4\exCF]
U+00306F
.CE
.PP
The result is the Unicode value
The result is the unicode codepoint:
.QW "\eu306F" ,
which is the Hiragana letter HA.
.VS "TCL8.7 TIP607, TIP656"
.VS "TCL8.7 TIP346, TIP607, TIP601"
.PP
Example 2: Error handling based on profiles:
.PP
The letter \fBA\fR is Unicode character U+0041 and the byte "\ex80" is invalid
in ASCII encoding.
Example 2: detect the error location in an incomplete UTF-8 sequence:
.PP
.CS
% codepoints [encoding convertfrom -profile tcl8 ascii A\ex80]
U+000041 U+000080
% codepoints [encoding convertfrom -profile replace ascii A\ex80]
U+000041 U+00FFFD
% codepoints [encoding convertfrom -profile strict ascii A\ex80]
unexpected byte sequence starting at index 1: '\ex80'
.CE
.PP
Example 3: Get partial data and the error location:
.PP
.CS
% codepoints [encoding convertfrom -profile strict -failindex idx ascii AB\ex80]
U+000041 U+000042
% set idx
2
.CE
.PP
Example 4: Encode a character that is not representable in ISO8859-1:
.PP
.CS
% encoding convertto iso8859-1 A\eu0141
A?
% encoding convertto -profile strict iso8859-1 A\eu0141
unexpected character at index 1: 'U+000141'
% encoding convertto -profile strict -failindex idx iso8859-1 A\eu0141
% set s [\fBencoding convertfrom\fR -failindex i utf-8 "A\exC3"]
A
% set idx
% set i
1
.CE
.VE "TCL8.7 TIP607, TIP656"
.PP
Example 3: return the incomplete UTF-8 sequence by raw bytes:
.PP
.CS
% set s [\fBencoding convertfrom\fR -nocomplain utf-8 "A\exC3"]
.CE
The result is "A" followed by the byte \exC3. The option \fB-nocomplain\fR
has no effect, but assures to get the same result with TCL9.
.PP
Example 4: detect the error location while transforming to ISO8859-1
(ISO-Latin 1):
.PP
.CS
% set s [\fBencoding convertto\fR -failindex i utf-8 "A\eu0141"]
A
% set i
1
.CE
.PP
Example 5: replace a not representable character by the replacement character:
.PP
.CS
% set s [\fBencoding convertto\fR -nocomplain utf-8 "A\eu0141"]
A?
.CE
The option \fB-nocomplain\fR has no effect, but assures to get the same result
with TCL9.
.VE "TCL8.7 TIP346, TIP607, TIP601"
.PP
.SH "SEE ALSO"
Tcl_GetEncoding(3), fconfigure(n)
+27 -12
View File
@@ -113,8 +113,8 @@ If \fIchar\fR is the empty string, then there is no special end of file
character marker. For read-write channels, a two-element list specifies
the end of file marker for input and output, respectively. As a
convenience, when setting the end-of-file character for a read-write
channel you can specify a single value that will apply to reading
only. When querying the end-of-file character of a read-write
channel you can specify a single value that will apply to both reading
and writing. When querying the end-of-file character of a read-write
channel, a two-element list will always be returned. The default value
for \fB\-eofchar\fR is the empty string in all cases except for files
under Windows. In that case the \fB\-eofchar\fR is Control-z (\ex1A) for
@@ -122,16 +122,31 @@ reading and the empty string for writing.
The acceptable range for \fB\-eofchar\fR values is \ex01 - \ex7F;
attempting to set \fB\-eofchar\fR to a value outside of this range will
generate an error.
.VS "TCL8.7 TIP656"
.VS "TCL8.7 TIP633"
.TP
\fB\-profile\fR \fIprofile\fR
\fB\-nocomplainencoding\fR \fIbool\fR
.
Specifies the encoding profile to be used on the channel. The encoding
transforms in use for the channel's input and output will then be subject to the
rules of that profile. Any failures will result in a channel error. See
\fBPROFILES\fR in the \fBencoding(n)\fR documentation for details about encoding
profiles.
.VE "TCL8.7 TIP656"
Reporting mode of encoding errors.
If set to a \fItrue\fR value, encoding errors are resolved by a replacement
character (output) or verbatim bytes (input). No error is thrown.
This is the only available mode in Tcl 8.7.
.RS
.PP
Starting from TCL 9.0, this value may be set to a \fIfalse\fR value to throw errors
in case of encoding errors.
.RE
.VE "TCL8.7 TIP633"
.VS "TCL8.7 TIP346"
.TP
\fB\-strictencoding\fR \fIbool\fR
.
Activate additional stricter encoding application rules.
Default value is \fIfalse\fR.
.RS
.PP
See the \fI\-strict\fR option of the \fBencoding\fR command for more information.
.VE "TCL8.7 TIP346"
.RE
.TP
\fB\-translation\fR \fImode\fR
.TP
@@ -288,11 +303,11 @@ set data [read $f $numDataBytes]
close $f
.CE
.SH "SEE ALSO"
close(n), encoding(n), flush(n), gets(n), open(n), puts(n), read(n), socket(n),
close(n), flush(n), gets(n), open(n), puts(n), read(n), socket(n),
Tcl_StandardChannels(3)
.SH KEYWORDS
blocking, buffering, carriage return, end of line, flushing, linemode,
newline, nonblocking, platform, profile, translation, encoding, filter, byte array,
newline, nonblocking, platform, translation, encoding, filter, byte array,
binary
'\" Local Variables:
'\" mode: nroff
+2 -3
View File
@@ -26,9 +26,8 @@ network sockets.
The \fBfcopy\fR
command transfers data from \fIinchan\fR until end of file
or \fIsize\fR bytes or characters have been
transferred; \fIsize\fR is in bytes if the input channel is in binary mode,
or if the two channels are using the same encoding and -strict is not specified.
Otherwise, size is in characters.
transferred; \fIsize\fR is in bytes if the two channels are using the
same encoding, and is in characters otherwise.
If no \fB\-size\fR argument is given,
then the copy goes until end of file.
All the data read from \fIinchan\fR is copied to \fIoutchan\fR.
+1 -48
View File
@@ -172,7 +172,7 @@ The body of a script provided to \fBeval\fR or \fBuplevel\fR.
.TP
\fBprecompiled\fR\0\0\0\0\0\0\0\0
.
A precompiled script (loadable by the package
A pre-compiled script (loadable by the package
\fBtbcload\fR), and no further information is available.
.RE
.TP
@@ -490,29 +490,6 @@ be discovered with \fBinfo class forward\fR.
This subcommand returns a list of all classes that have been mixed into the
class named \fIclass\fR.
.TP
\fBinfo class properties\fI class\fR ?\fIoptions...\fR
.VS "TIP 558"
This subcommand returns a sorted list of properties defined on the class named
\fIclass\fR. The \fIoptions\fR define exactly which properties are returned:
.RS
.TP
\fB\-all\fR
.
With this option, the properties from the superclasses and mixins of the class
are also returned.
.TP
\fB\-readable\fR
.
This option (the default behavior) asks for the readable properties to be
returned. Only readable or writable properties are returned, not both.
.TP
\fB\-writable\fR
.
This option asks for the writable properties to be returned. Only readable or
writable properties are returned, not both.
.RE
.VE "TIP 558"
.TP
\fBinfo class subclasses\fI class\fR ?\fIpattern\fR?
.
This subcommand returns a list of direct subclasses of class \fIclass\fR. If
@@ -702,30 +679,6 @@ object named \fIobject\fR.
This subcommand returns the name of the internal namespace of the object named
\fIobject\fR.
.TP
\fBinfo object properties\fI object\fR ?\fIoptions...\fR
.VS "TIP 558"
This subcommand returns a sorted list of properties defined on the object
named \fIobject\fR. The \fIoptions\fR define exactly which properties are
returned:
.RS
.TP
\fB\-all\fR
.
With this option, the properties from the class, superclasses and mixins of
the object are also returned.
.TP
\fB\-readable\fR
.
This option (the default behavior) asks for the readable properties to be
returned. Only readable or writable properties are returned, not both.
.TP
\fB\-writable\fR
.
This option asks for the writable properties to be returned. Only readable or
writable properties are returned, not both.
.RE
.VE "TIP 558"
.TP
\fBinfo object variables\fI object\fRR ?\fB\-private\fR?
.
This subcommand returns a list of all variables that have been declared for
+1 -1
View File
@@ -41,7 +41,7 @@ of packets and bytes allocated.
.TP
\fBmemory init \fR[\fBon\fR|\fBoff\fR]
.
Turn on or off the preinitialization of all allocated memory
Turn on or off the pre-initialization of all allocated memory
with bogus bytes. Useful for detecting the use of uninitialized
values.
.TP
+1 -1
View File
@@ -161,7 +161,7 @@ this command first finds the matching exported commands.
It then checks whether any of those commands
were previously imported by the current namespace.
If so, this command deletes the corresponding imported commands.
In effect, this undoes the action of a \fBnamespace import\fR command.
In effect, this un-does the action of a \fBnamespace import\fR command.
.TP
\fBnamespace import \fR?\fB\-force\fR? ?\fIpattern\fR \fIpattern ...\fR?
.
+1 -1
View File
@@ -96,7 +96,7 @@ forward to the proper implementation of the method (which it does by invoking
the \fBnext\fR command as filters are inserted into the front of the method
call chain) and is responsible for returning the result of \fBnext\fR.
.PP
Filters are invoked when processing an invocation of the \fBunknown\fR
Filters are invoked when processing an invokation of the \fBunknown\fR
method because of a failure to locate a method implementation, but \fInot\fR
when invoking either constructors or destructors. (Note however that the
\fBdestroy\fR method is a conventional method, and filters are invoked as
+1 -1
View File
@@ -108,7 +108,7 @@ it immediately upon \fBpackage require\fR. This is not compatible with
the use of \fIauto_reset\fR, and therefore its use is discouraged.
.TP 15
\fB\-load \fIpkgPat\fR
The index process will preload any packages that exist in the
The index process will pre-load any packages that exist in the
current interpreter and match \fIpkgPat\fR into the child interpreter used to
generate the index. The pattern match uses string match rules, but without
making case distinctions.
+2 -2
View File
@@ -53,8 +53,8 @@ here, then the \fBfinalize\fR subcommand will not be called.
.PP
The \fImode\fR argument tells the handler whether the channel was
opened for reading, writing, or both. It is a list containing any of
the strings \fBread\fR or \fBwrite\fR. The list may be empty, but
will usually contain at least one element.
the strings \fBread\fR or \fBwrite\fR. The list will always
contain at least one element.
.PP
The subcommand must throw an error if the chosen mode is not
supported by the \fIcmdPrefix\fR.
+2 -2
View File
@@ -625,14 +625,14 @@ the test suite is being run on a Unix platform.
.PP
Each \fBtest\fR should include whatever \fB\-constraints\fR are
required to constrain it to run only where appropriate. Several
constraints are predefined in the \fBtcltest\fR package, listed
constraints are pre-defined in the \fBtcltest\fR package, listed
below. The registration of user-defined constraints is performed
by the \fBtestConstraint\fR command. User-defined constraints
may appear within a test file, or within the script specified
by the \fBconfigure \-load\fR or \fBconfigure \-loadfile\fR
options.
.PP
The following is a list of constraints predefined by the
The following is a list of constraints pre-defined by the
\fBtcltest\fR package itself:
.TP
\fIsingleTestInterp\fR
+5 -5
View File
@@ -487,7 +487,7 @@ freearc(
/*
* changearctarget - flip an arc to have a different to state
*
* Caller must have verified that there is no preexisting duplicate arc.
* Caller must have verified that there is no pre-existing duplicate arc.
*
* Note that because we store arcs in their from state, we can't easily have
* a similar changearcsource function.
@@ -1515,7 +1515,7 @@ pullback(
* Returns 1 if successful (which it always is unless the source is the
* start state or we have an internal error), 0 if nothing happened.
*
* A significant property of this function is that it deletes no preexisting
* A significant property of this function is that it deletes no pre-existing
* states, and no outarcs of the constraint's from state other than the given
* constraint arc. This makes the loops in pullback() safe, at the cost that
* we may leave useless states behind. Therefore, we leave it to pullback()
@@ -1694,7 +1694,7 @@ pushfwd(
* Returns 1 if successful (which it always is unless the destination is the
* post state or we have an internal error), 0 if nothing happened.
*
* A significant property of this function is that it deletes no preexisting
* A significant property of this function is that it deletes no pre-existing
* states, and no inarcs of the constraint's to state other than the given
* constraint arc. This makes the loops in pushfwd() safe, at the cost that
* we may leave useless states behind. Therefore, we leave it to pushfwd()
@@ -2467,7 +2467,7 @@ breakconstraintloop(struct nfa * nfa, struct state * sinitial)
* have multiple redundant arc pathways). Each donemap is a char array
* indexed by state number. The donemaps are all of the same size "nstates",
* which is nfa->nstates as of the start of the recursion. This is enough to
* have entries for all preexisting states, but *not* entries for clone
* have entries for all pre-existing states, but *not* entries for clone
* states created during the recursion. That's okay since we have no need to
* mark those.
*
@@ -2774,7 +2774,7 @@ markcanreach(
- analyze - ascertain potentially-useful facts about an optimized NFA
^ static long analyze(struct nfa *);
*/
static long /* re_info bits to be OR'ed in */
static long /* re_info bits to be ORed in */
analyze(
struct nfa *nfa)
{
+2 -2
View File
@@ -2185,9 +2185,9 @@ stid(
return "unable";
}
if (t->id != 0) {
snprintf(buf, bufsize, "%d", t->id);
sprintf(buf, "%d", t->id);
} else {
snprintf(buf, bufsize, "%p", t);
sprintf(buf, "%p", t);
}
return buf;
}
+3 -3
View File
@@ -73,7 +73,7 @@ regerror(
break;
}
}
snprintf(convbuf, sizeof(convbuf), "%d", r->code); /* -1 for unknown */
sprintf(convbuf, "%d", r->code); /* -1 for unknown */
msg = convbuf;
break;
case REG_ITOA: /* Convert number to name */
@@ -86,7 +86,7 @@ regerror(
if (r->code >= 0) {
msg = r->name;
} else { /* Unknown; tell him the number */
snprintf(convbuf, sizeof(convbuf), "REG_%u", (unsigned)icode);
sprintf(convbuf, "REG_%u", (unsigned)icode);
msg = convbuf;
}
break;
@@ -99,7 +99,7 @@ regerror(
if (r->code >= 0) {
msg = r->explain;
} else { /* Unknown; say so */
snprintf(convbuf, sizeof(convbuf), unk, code);
sprintf(convbuf, unk, code);
msg = convbuf;
}
break;
+2 -2
View File
@@ -258,10 +258,10 @@ struct state {
};
struct nfa {
struct state *pre; /* preinitial state */
struct state *pre; /* pre-initial state */
struct state *init; /* initial state */
struct state *final; /* final state */
struct state *post; /* postfinal state */
struct state *post; /* post-final state */
int nstates; /* for numbering states */
struct state *states; /* state-chain header */
struct state *slast; /* tail of the chain */
+26 -30
View File
@@ -59,7 +59,7 @@ declare 8 {
const char *file, int line)
}
# Tcl_CreateFileHandler and Tcl_DeleteFileHandler are only available on Unix,
# Tcl_CreateFileHandler and Tcl_DeleteFileHandler are only available on unix,
# but they are part of the old generic interface, so we include them here for
# compatibility reasons.
@@ -1159,7 +1159,7 @@ declare 323 {
int Tcl_UniCharToUpper(int ch)
}
declare 324 {
Tcl_Size Tcl_UniCharToUtf(int ch, char *buf)
int Tcl_UniCharToUtf(int ch, char *buf)
}
declare 325 {
const char *Tcl_UtfAtIndex(const char *src, Tcl_Size index)
@@ -1193,16 +1193,16 @@ declare 333 {
const char *src, Tcl_Size srcLen, Tcl_DString *dsPtr)
}
declare 334 {
Tcl_Size Tcl_UtfToLower(char *src)
int Tcl_UtfToLower(char *src)
}
declare 335 {
Tcl_Size Tcl_UtfToTitle(char *src)
int Tcl_UtfToTitle(char *src)
}
declare 336 {
Tcl_Size Tcl_UtfToChar16(const char *src, unsigned short *chPtr)
int Tcl_UtfToChar16(const char *src, unsigned short *chPtr)
}
declare 337 {
Tcl_Size Tcl_UtfToUpper(char *src)
int Tcl_UtfToUpper(char *src)
}
declare 338 {
Tcl_Size Tcl_WriteChars(Tcl_Channel chan, const char *src, Tcl_Size srcLen)
@@ -2395,7 +2395,7 @@ declare 645 {
# TIP #548
declare 646 {
Tcl_Size Tcl_UtfToUniChar(const char *src, int *chPtr)
int Tcl_UtfToUniChar(const char *src, int *chPtr)
}
declare 647 {
char *Tcl_UniCharToUtfDString(const int *uniStr,
@@ -2413,19 +2413,19 @@ declare 649 {
}
declare 650 {
unsigned char *Tcl_GetBytesFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr,
void *numBytesPtr)
size_t *numBytesPtr)
}
# TIP #481
declare 651 {
char *TclGetStringFromObj(Tcl_Obj *objPtr, void *lengthPtr)
char *TclGetStringFromObj(Tcl_Obj *objPtr, size_t *lengthPtr)
}
declare 652 {
unsigned short *TclGetUnicodeFromObj(Tcl_Obj *objPtr, void *lengthPtr)
unsigned short *TclGetUnicodeFromObj(Tcl_Obj *objPtr, size_t *lengthPtr)
}
# Only available in Tcl 8.x, NULL in Tcl 9.0
declare 653 {
unsigned char *TclGetByteArrayFromObj(Tcl_Obj *objPtr, void *numBytesPtr)
unsigned char *TclGetByteArrayFromObj(Tcl_Obj *objPtr, size_t *numBytesPtr)
}
# TIP #575
@@ -2441,17 +2441,13 @@ declare 656 {
declare 657 {
int Tcl_UniCharIsUnicode(int ch)
}
# TIP 656
declare 658 {
int Tcl_ExternalToUtfDStringEx(Tcl_Interp *interp, Tcl_Encoding encoding,
const char *src, Tcl_Size srcLen, int flags, Tcl_DString *dsPtr,
Tcl_Size *errorLocationPtr)
Tcl_Size Tcl_ExternalToUtfDStringEx(Tcl_Encoding encoding,
const char *src, Tcl_Size srcLen, int flags, Tcl_DString *dsPtr)
}
declare 659 {
int Tcl_UtfToExternalDStringEx(Tcl_Interp *interp, Tcl_Encoding encoding,
const char *src, Tcl_Size srcLen, int flags, Tcl_DString *dsPtr,
Tcl_Size *errorLocationPtr)
Tcl_Size Tcl_UtfToExternalDStringEx(Tcl_Encoding encoding,
const char *src, Tcl_Size srcLen, int flags, Tcl_DString *dsPtr)
}
# TIP #511
@@ -2462,28 +2458,28 @@ declare 660 {
# TIP #616
declare 661 {
int TclListObjGetElements(Tcl_Interp *interp, Tcl_Obj *listPtr,
void *objcPtr, Tcl_Obj ***objvPtr)
size_t *objcPtr, Tcl_Obj ***objvPtr)
}
declare 662 {
int TclListObjLength(Tcl_Interp *interp, Tcl_Obj *listPtr,
void *lengthPtr)
size_t *lengthPtr)
}
declare 663 {
int TclDictObjSize(Tcl_Interp *interp, Tcl_Obj *dictPtr, void *sizePtr)
int TclDictObjSize(Tcl_Interp *interp, Tcl_Obj *dictPtr, size_t *sizePtr)
}
declare 664 {
int TclSplitList(Tcl_Interp *interp, const char *listStr, void *argcPtr,
int TclSplitList(Tcl_Interp *interp, const char *listStr, size_t *argcPtr,
const char ***argvPtr)
}
declare 665 {
void TclSplitPath(const char *path, void *argcPtr, const char ***argvPtr)
void TclSplitPath(const char *path, size_t *argcPtr, const char ***argvPtr)
}
declare 666 {
Tcl_Obj *TclFSSplitPath(Tcl_Obj *pathPtr, void *lenPtr)
Tcl_Obj *TclFSSplitPath(Tcl_Obj *pathPtr, size_t *lenPtr)
}
declare 667 {
int TclParseArgsObjv(Tcl_Interp *interp, const Tcl_ArgvInfo *argTable,
void *objcPtr, Tcl_Obj *const *objv, Tcl_Obj ***remObjv)
size_t *objcPtr, Tcl_Obj *const *objv, Tcl_Obj ***remObjv)
}
# TIP #617
@@ -2533,7 +2529,7 @@ declare 678 {
}
declare 679 {
int Tcl_NRCallObjProc2(Tcl_Interp *interp, Tcl_ObjCmdProc2 *objProc2,
void *clientData, ptrdiff_t objc, Tcl_Obj *const objv[])
void *clientData, size_t objc, Tcl_Obj *const objv[])
}
# TIP #638.
@@ -2542,7 +2538,7 @@ declare 680 {
void **clientDataPtr, int *typePtr)
}
declare 681 {
int Tcl_GetNumber(Tcl_Interp *interp, const char *bytes, ptrdiff_t numBytes,
int Tcl_GetNumber(Tcl_Interp *interp, const char *bytes, size_t numBytes,
void **clientDataPtr, int *typePtr)
}
@@ -2569,7 +2565,7 @@ declare 685 {
# ----- BASELINE -- FOR -- 8.7.0 / 9.0.0 ----- #
declare 688 {
declare 687 {
void TclUnusedStubEntry(void)
}
@@ -2610,7 +2606,7 @@ declare 0 macosx {
declare 1 macosx {
int Tcl_MacOSXOpenVersionedBundleResources(Tcl_Interp *interp,
const char *bundleName, const char *bundleVersion,
int hasResourceFile, Tcl_Size maxPathLen, char *libraryPath)
int hasResourceFile, int maxPathLen, char *libraryPath)
}
declare 2 macosx {
void Tcl_MacOSXNotifierAddRunLoopMode(const void *runLoopMode)
+45 -96
View File
@@ -123,7 +123,6 @@ extern "C" {
*/
#include <stdio.h>
#include <stddef.h>
/*
*----------------------------------------------------------------------------
@@ -137,7 +136,7 @@ extern "C" {
*/
#include <stdarg.h>
#ifndef TCL_NO_DEPRECATED
#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)
@@ -257,7 +256,7 @@ extern "C" {
* New code should use prototypes.
*/
#ifndef TCL_NO_DEPRECATED
#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
# undef _ANSI_ARGS_
# define _ANSI_ARGS_(x) x
@@ -300,7 +299,7 @@ extern "C" {
* VOID. This block is skipped under Cygwin and Mingw.
*/
#ifndef TCL_NO_DEPRECATED
#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
#if defined(_WIN32) && !defined(HAVE_WINNT_IGNORE_VOID)
#ifndef VOID
#define VOID void
@@ -318,7 +317,7 @@ typedef long LONG;
#ifndef __VXWORKS__
# define VOID void
#endif
#endif /* !TCL_NO_DEPRECATED */
#endif /* !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 */
/*
* Miscellaneous declarations.
@@ -400,30 +399,16 @@ typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt;
# define TCL_Z_MODIFIER ""
# endif
#endif /* !TCL_Z_MODIFIER */
#ifndef TCL_T_MODIFIER
# if defined(__GNUC__) && !defined(_WIN32)
# define TCL_T_MODIFIER "t"
# elif defined(_WIN64)
# define TCL_T_MODIFIER TCL_LL_MODIFIER
# else
# define TCL_T_MODIFIER TCL_Z_MODIFIER
# endif
#endif /* !TCL_T_MODIFIER */
#define Tcl_WideAsLong(val) ((long)((Tcl_WideInt)(val)))
#define Tcl_LongAsWide(val) ((Tcl_WideInt)((long)(val)))
#define Tcl_WideAsDouble(val) ((double)((Tcl_WideInt)(val)))
#define Tcl_DoubleAsWide(val) ((Tcl_WideInt)((double)(val)))
#if TCL_MAJOR_VERSION < 9
typedef int Tcl_Size;
# define TCL_SIZE_MAX INT_MAX
# define TCL_SIZE_MODIFIER ""
#if TCL_MAJOR_VERSION > 8
typedef size_t Tcl_Size;
#else
typedef ptrdiff_t Tcl_Size;
# define TCL_SIZE_MAX PTRDIFF_MAX
# define TCL_SIZE_MODIFIER TCL_T_MODIFIER
#endif /* TCL_MAJOR_VERSION */
typedef int Tcl_Size;
#endif
#ifdef _WIN32
# if TCL_MAJOR_VERSION > 8 || defined(_WIN64) || defined(_USE_64BIT_TIME_T)
@@ -476,7 +461,7 @@ typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt;
*/
typedef struct Tcl_Interp
#ifndef TCL_NO_DEPRECATED
#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
{
/* TIP #330: Strongly discourage extensions from using the string
* result. */
@@ -584,28 +569,19 @@ typedef void (Tcl_ThreadCreateProc) (void *clientData);
*/
typedef struct Tcl_RegExpIndices {
#if TCL_MAJOR_VERSION > 8
Tcl_Size start; /* Character offset of first character in
long start; /* Character offset of first character in
* match. */
Tcl_Size end; /* Character offset of first character after
long end; /* Character offset of first character after
* the match. */
#else
long start;
long end;
#endif
} Tcl_RegExpIndices;
typedef struct Tcl_RegExpInfo {
Tcl_Size nsubs; /* Number of subexpressions in the compiled
int nsubs; /* Number of subexpressions in the compiled
* expression. */
Tcl_RegExpIndices *matches; /* Array of nsubs match offset pairs. */
#if TCL_MAJOR_VERSION > 8
Tcl_Size extendStart; /* The offset at which a subsequent match
long extendStart; /* The offset at which a subsequent match
* might begin. */
#else
long extendStart;
long reserved; /* Reserved for later use. */
#endif
} Tcl_RegExpInfo;
/*
@@ -643,7 +619,7 @@ typedef struct stat *Tcl_OldStat_;
#define TCL_BREAK 3
#define TCL_CONTINUE 4
#ifndef TCL_NO_DEPRECATED
#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
#define TCL_RESULT_SIZE 200
#endif
@@ -661,7 +637,7 @@ typedef struct stat *Tcl_OldStat_;
* Argument descriptors for math function callbacks in expressions:
*/
#ifndef TCL_NO_DEPRECATED
#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
typedef enum {
TCL_INT, TCL_DOUBLE, TCL_EITHER, TCL_WIDE_INT
} Tcl_ValueType;
@@ -705,7 +681,7 @@ 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 int (Tcl_CmdObjTraceProc2) (void *clientData, Tcl_Interp *interp,
ptrdiff_t level, const char *command, Tcl_Command commandInfo, ptrdiff_t objc,
size_t level, const char *command, Tcl_Command commandInfo, size_t objc,
struct Tcl_Obj *const *objv);
typedef void (Tcl_CmdObjTraceDeleteProc) (void *clientData);
typedef void (Tcl_DupInternalRepProc) (struct Tcl_Obj *srcPtr,
@@ -732,7 +708,7 @@ 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_ObjCmdProc2) (void *clientData, Tcl_Interp *interp,
ptrdiff_t objc, struct Tcl_Obj *const *objv);
size_t objc, struct Tcl_Obj *const *objv);
typedef int (Tcl_LibraryInitProc) (Tcl_Interp *interp);
typedef int (Tcl_LibraryUnloadProc) (Tcl_Interp *interp, int flags);
typedef void (Tcl_PanicProc) (const char *format, ...);
@@ -981,9 +957,9 @@ typedef struct Tcl_DString {
#define Tcl_DStringLength(dsPtr) ((dsPtr)->length)
#define Tcl_DStringValue(dsPtr) ((dsPtr)->string)
#ifndef TCL_NO_DEPRECATED
#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
# define Tcl_DStringTrunc Tcl_DStringSetLength
#endif
#endif /* !TCL_NO_DEPRECATED */
/*
* Definitions for the maximum number of digits of precision that may be
@@ -1105,7 +1081,7 @@ typedef struct Tcl_DString {
#define TCL_TRACE_UNSETS 0x40
#define TCL_TRACE_DESTROYED 0x80
#ifndef TCL_NO_DEPRECATED
#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
#define TCL_INTERP_DESTROYED 0x100
#endif
@@ -1143,9 +1119,9 @@ typedef struct Tcl_DString {
* give the flag)
*/
#ifndef TCL_NO_DEPRECATED
#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
# define TCL_PARSE_PART1 0x400
#endif
#endif /* !TCL_NO_DEPRECATED */
/*
* Types for linked variables:
@@ -1303,15 +1279,10 @@ struct Tcl_HashTable {
* table. */
Tcl_Size rebuildSize; /* Enlarge table when numEntries gets to be
* this large. */
#if TCL_MAJOR_VERSION > 8
size_t mask; /* Mask value used in hashing function. */
#endif
int downShift; /* Shift count used in hashing function.
* Designed to use high-order bits of
* randomized keys. */
#if TCL_MAJOR_VERSION < 9
int mask; /* Mask value used in hashing function. */
#endif
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
@@ -1477,11 +1448,7 @@ typedef void (Tcl_ScaleTimeProc) (Tcl_Time *timebuf, void *clientData);
* interface.
*/
#if TCL_MAJOR_VERSION > 8
# define TCL_CLOSE2PROC NULL
#else
# define TCL_CLOSE2PROC ((Tcl_DriverCloseProc *)(void *)(size_t)1)
#endif
#define TCL_CLOSE2PROC ((Tcl_DriverCloseProc *) 1)
/*
* Channel version tag. This was introduced in 8.3.2/8.4.
@@ -2056,12 +2023,6 @@ typedef struct Tcl_Parse {
* *tokenPtr. */
int errorType; /* One of the parsing error types defined
* above. */
#if TCL_MAJOR_VERSION > 8
int incomplete; /* This field is set to 1 by Tcl_ParseCommand
* if the command appears to be incomplete.
* This information is used by
* Tcl_CommandComplete. */
#endif
/*
* The fields below are intended only for the private use of the parser.
@@ -2080,9 +2041,10 @@ typedef struct Tcl_Parse {
* beginning of region where the error
* occurred (e.g. the open brace if the close
* brace is missing). */
#if TCL_MAJOR_VERSION < 9
int incomplete;
#endif
int incomplete; /* This field is set to 1 by Tcl_ParseCommand
* if the command appears to be incomplete.
* This information is used by
* Tcl_CommandComplete. */
Tcl_Token staticTokens[NUM_STATIC_TOKENS];
/* Initial space for tokens for command. This
* space should be large enough to accommodate
@@ -2161,12 +2123,18 @@ typedef struct Tcl_EncodingType {
* content. Otherwise, the number of chars
* produced is controlled only by other limiting
* factors.
* TCL_ENCODING_PROFILE_* - Mutually exclusive encoding profile ids. Note
* these are bit masks.
*
* NOTE: THESE BIT DEFINITIONS SHOULD NOT OVERLAP WITH INTERNAL USE BITS
* DEFINED IN tclEncoding.c (ENCODING_INPUT et al). Be cognizant of this
* when adding bits.
* TCL_ENCODING_MODIFIED - Convert NULL bytes to \xC0\x80 in stead of
* 0x00. Only valid for "utf-8" and "cesu-8".
* This flag is implicit for external -> internal conversions,
* optional for internal -> external conversions.
* TCL_ENCODING_NOCOMPLAIN - If set, the converter
* substitutes the problematic character(s) with
* one or more "close" characters in the
* destination buffer and then continues to
* convert the source. If clear, the converter returns
* immediately upon encountering an invalid byte sequence
* or a source character that has no mapping in the
* target encoding. Only for Tcl 9.x.
*/
#define TCL_ENCODING_START 0x01
@@ -2174,17 +2142,9 @@ typedef struct Tcl_EncodingType {
#define TCL_ENCODING_STOPONERROR 0x04
#define TCL_ENCODING_NO_TERMINATE 0x08
#define TCL_ENCODING_CHAR_LIMIT 0x10
/* Internal use bits, do not define bits in this space. See above comment */
#define TCL_ENCODING_INTERNAL_USE_MASK 0xFF00
/*
* Reserve top byte for profile values (disjoint, not a mask). In case of
* changes, ensure ENCODING_PROFILE_* macros in tclInt.h are modified if
* necessary.
*/
#define TCL_ENCODING_PROFILE_TCL8 0x01000000
#define TCL_ENCODING_PROFILE_STRICT 0x02000000
#define TCL_ENCODING_PROFILE_REPLACE 0x03000000
#define TCL_ENCODING_PROFILE_DEFAULT TCL_ENCODING_PROFILE_TCL8
#define TCL_ENCODING_MODIFIED 0x20
#define TCL_ENCODING_NOCOMPLAIN 0x40
#define TCL_ENCODING_STRICT 0x44
/*
* The following definitions are the error codes returned by the conversion
@@ -2437,11 +2397,7 @@ typedef int (Tcl_NRPostProc) (void *data[], Tcl_Interp *interp,
* stubs tables.
*/
#if TCL_MAJOR_VERSION > 8
# define TCL_STUB_MAGIC ((int) 0xFCA3BACB + (int) sizeof(void *))
#else
# define TCL_STUB_MAGIC ((int) 0xFCA3BACF)
#endif
#define TCL_STUB_MAGIC ((int) 0xFCA3BACF)
/*
* The following function is required to be defined in all stubs aware
@@ -2461,17 +2417,10 @@ const char * TclTomMathInitializeStubs(Tcl_Interp *interp,
#endif
#ifdef USE_TCL_STUBS
# if TCL_UTF_MAX < 4
# define Tcl_InitStubs(interp, version, exact) \
(Tcl_InitStubs)(interp, version, \
(exact)|(TCL_MAJOR_VERSION<<8)|(TCL_MINOR_VERSION<<16), \
TCL_STUB_MAGIC)
# else
# define Tcl_InitStubs(interp, version, exact) \
(Tcl_InitStubs)(interp, TCL_PATCH_LEVEL, \
(exact)|(TCL_MAJOR_VERSION<<8)|(TCL_MINOR_VERSION<<16), \
TCL_STUB_MAGIC)
# endif
#else
# define Tcl_InitStubs(interp, version, exact) \
Tcl_PkgInitStubsCheck(interp, version, \
@@ -2663,7 +2612,7 @@ EXTERN const char *TclZipfs_AppHook(int *argc, char ***argv);
* Deprecated Tcl functions:
*/
#ifndef TCL_NO_DEPRECATED
#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.
+3 -3
View File
@@ -116,7 +116,7 @@ static struct block bigBlocks={ /* Big blocks aren't suballocated. */
/*
* The allocator is protected by a special mutex that must be explicitly
* initialized. Furthermore, because Tcl_Alloc may be used before anything else
* initialized. Futhermore, because Tcl_Alloc may be used before anything else
* in Tcl, we make this module self-initializing after all with the allocInit
* variable.
*/
@@ -511,7 +511,7 @@ TclpFree(
void *
TclpRealloc(
void *oldPtr, /* Pointer to alloc'ed block. */
void *oldPtr, /* Pointer to alloced block. */
unsigned int numBytes) /* New size of memory. */
{
int i;
@@ -610,7 +610,7 @@ TclpRealloc(
}
/*
* No need to copy. It fits as-is.
* Ok, we don't have to copy, it fits as-is
*/
#ifndef NDEBUG
+1 -1
View File
@@ -349,7 +349,7 @@ TclNewArithSeriesObj(
}
}
if (len > TCL_SIZE_MAX) {
if (TCL_MAJOR_VERSION < 9 && len > ListSizeT_MAX) {
Tcl_SetObjResult(
interp,
Tcl_NewStringObj("max length of a Tcl list exceeded", -1));
+19 -21
View File
@@ -1053,7 +1053,7 @@ Tcl_CreateInterp(void)
/*
* Create the core commands. Do it here, rather than calling
* Tcl_CreateCommand, because it's faster (there's no need to check for a
* preexisting command by the same name). If a command has a Tcl_CmdProc
* pre-existing command by the same name). If a command has a Tcl_CmdProc
* but no Tcl_ObjCmdProc, set the Tcl_ObjCmdProc to
* TclInvokeStringCommand. This is an object-based wrapper function that
* extracts strings, calls the string function, and creates an object for
@@ -1533,7 +1533,7 @@ Tcl_CallWhenDeleted(
AssocData *dPtr = (AssocData *)ckalloc(sizeof(AssocData));
Tcl_HashEntry *hPtr;
snprintf(buffer, sizeof(buffer), "Assoc Data Key #%d", *assocDataCounterPtr);
sprintf(buffer, "Assoc Data Key #%d", *assocDataCounterPtr);
(*assocDataCounterPtr)++;
if (iPtr->assocData == NULL) {
@@ -2253,15 +2253,15 @@ Tcl_HideCommand(
}
/*
* NB: This code is currently 'like' a rename to a special separate name
* NB: This code is currently 'like' a rename to a specialy set apart name
* table. Changes here and in TclRenameCommand must be kept in synch until
* the common parts are actually factorized out.
*/
/*
* Remove the hash entry for the command from the interpreter command
* table. This is like deleting the command, so bump its command epoch
* to invalidate any cached references that point to the command.
* table. This is like deleting the command, so bump its command epoch;
* this invalidates any cached references that point to the command.
*/
if (cmdPtr->hPtr != NULL) {
@@ -2382,7 +2382,7 @@ Tcl_ExposeCommand(
if (cmdPtr->nsPtr != iPtr->globalNsPtr) {
/*
* This case is theoretically impossible, we might rather Tcl_Panic
* This case is theoritically impossible, we might rather Tcl_Panic
* than 'nicely' erroring out ?
*/
@@ -2488,7 +2488,7 @@ Tcl_ExposeCommand(
* In the future, when cmdName is seen as the name of a command by
* Tcl_Eval, proc will be called. To support the bytecode interpreter,
* the command is created with a wrapper Tcl_ObjCmdProc
* (TclInvokeStringCommand) that eventually calls proc. When the command
* (TclInvokeStringCommand) that eventially calls proc. When the command
* is deleted from the table, deleteProc will be called. See the manual
* entry for details on the calling sequence.
*
@@ -3939,7 +3939,7 @@ CallCommandTraces(
* The value given for the code argument.
*
* Side effects:
* Transfers a message from the cancellation message to the interpreter.
* Transfers a message from the cancelation message to the interpreter.
*
*----------------------------------------------------------------------
*/
@@ -4048,7 +4048,7 @@ TclCleanupCommand(
* 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,
* redefining a non-builtin function will force existing code to be
* redefioning a non-builtin function will force existing code to be
* invalidated if the number of arguments has changed.
*
*----------------------------------------------------------------------
@@ -4060,7 +4060,7 @@ Tcl_CreateMathFunc(
Tcl_Interp *interp, /* Interpreter in which function is to be
* available. */
const char *name, /* Name of function (e.g. "sin"). */
int numArgs, /* Number of arguments required by
int numArgs, /* Nnumber of arguments required by
* function. */
Tcl_ValueType *argTypes, /* Array of types acceptable for each
* argument. */
@@ -5249,7 +5249,7 @@ TEOV_NotFound(
/*
* Get the list of words for the unknown handler and allocate enough space
* to hold both the handler prefix and all words of the command invocation
* to hold both the handler prefix and all words of the command invokation
* itself.
*/
@@ -5594,7 +5594,7 @@ TclEvalEx(
* TclSubstTokens(), to properly handle
* [...]-nested commands. The 'outerScript'
* refers to the most-outer script containing
* the embedded command, which is referred to
* the embedded command, which is refered to
* by 'script'. The 'clNextOuter' refers to
* the current entry in the table of
* continuation lines in this "main script",
@@ -6160,8 +6160,8 @@ TclArgumentEnter(
/*
* Ignore argument words without line information (= dynamic). If they
* are variables they may have location information associated with
* that, either through globally recorded 'set' invocations, or
* literals in bytecode. Either way there is no need to record
* that, either through globally recorded 'set' invokations, or
* literals in bytecode. Eitehr way there is no need to record
* something here.
*/
@@ -6891,7 +6891,7 @@ ProcessUnexpectedResult(
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"command returned bad code: %d", returnCode));
}
snprintf(buf, sizeof(buf), "%d", returnCode);
sprintf(buf, "%d", returnCode);
Tcl_SetErrorCode(interp, "TCL", "UNEXPECTED_RESULT_CODE", buf, NULL);
}
@@ -7605,7 +7605,7 @@ int
Tcl_SetRecursionLimit(
Tcl_Interp *interp, /* Interpreter whose nesting limit is to be
* set. */
int depth) /* New value for maximum depth. */
int depth) /* New value for maximimum depth. */
{
Interp *iPtr = (Interp *) interp;
int old;
@@ -9192,10 +9192,10 @@ Tcl_NRCallObjProc2(
Tcl_Interp *interp,
Tcl_ObjCmdProc2 *objProc,
void *clientData,
ptrdiff_t objc,
size_t objc,
Tcl_Obj *const objv[])
{
if ((size_t)objc > INT_MAX) {
if (objc > INT_MAX) {
Tcl_WrongNumArgs(interp, 1, objv, "?args?");
return TCL_ERROR;
}
@@ -9716,7 +9716,6 @@ TclNRYieldToObjCmd(
*/
iPtr->execEnvPtr = corPtr->callerEEPtr;
/* Not calling Tcl_IncrRefCount(listPtr) here because listPtr is private */
TclSetTailcall(interp, listPtr);
corPtr->yieldPtr = listPtr;
iPtr->execEnvPtr = corPtr->eePtr;
@@ -9919,8 +9918,8 @@ TclNRCoroutineActivateCallback(
if (corPtr->yieldPtr) {
for (runPtr = TOP_CB(interp); runPtr; runPtr = runPtr->nextPtr) {
if (runPtr->data[1] == corPtr->yieldPtr) {
Tcl_DecrRefCount((Tcl_Obj *)runPtr->data[1]);
runPtr->data[1] = NULL;
Tcl_DecrRefCount(corPtr->yieldPtr);
corPtr->yieldPtr = NULL;
break;
}
@@ -10521,7 +10520,6 @@ TclNRCoroutineObjCmd(
corPtr->running.lineLABCPtr = corPtr->lineLABCPtr;
corPtr->stackLevel = NULL;
corPtr->auxNumLevels = 0;
corPtr->yieldPtr = NULL;
/*
* Create the coro's execEnv, switch to it to push the exit and coro
+12 -12
View File
@@ -2,7 +2,7 @@
* tclBinary.c --
*
* This file contains the implementation of the "binary" Tcl built-in
* command and the Tcl binary data object.
* command and the Tcl value internal representation for binary data.
*
* Copyright © 1997 Sun Microsystems, Inc.
* Copyright © 1998-1999 Scriptics Corporation.
@@ -26,7 +26,7 @@
#define BINARY_NOCOUNT -2 /* No count was specified in format. */
/*
* The following flags may be OR'ed together and returned by GetFormatSpec
* The following flags may be ORed together and returned by GetFormatSpec
*/
#define BINARY_SIGNED 0 /* Field to be read as signed data */
@@ -37,7 +37,7 @@
* placed in the object cache by 'binary scan' before it bails out and
* switches back to Plan A (creating a new object for each value.)
* Theoretically, it would be possible to keep the cache about for the values
* that are already in it, but that makes the code slower in practice when
* that are already in it, but that makes the code slower in practise when
* overflow happens, and makes little odds the rest of the time (as measured
* on my machine.) It is also slower (on the sample I tried at least) to grow
* the cache to hold all items we might want to put in it; presumably the
@@ -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,
Tcl_Size *countPtr, int *flagsPtr);
int *countPtr, int *flagsPtr);
static Tcl_Obj * ScanNumber(unsigned char *buffer, int type,
int flags, Tcl_HashTable **numberCachePtr);
static int SetByteArrayFromAny(Tcl_Interp *interp,
@@ -143,7 +143,7 @@ static const EnsembleImplMap decodeMap[] = {
};
/*
* The following Tcl_ObjType represents an array of bytes. The intent is to
* The following object types represent an array of bytes. The intent is to
* allow arbitrary binary data to pass through Tcl as a Tcl value without loss
* or damage. Such values are useful for things like encoded strings or Tk
* images to name just two.
@@ -457,7 +457,7 @@ unsigned char *
Tcl_GetBytesFromObj(
Tcl_Interp *interp, /* For error reporting */
Tcl_Obj *objPtr, /* Value to extract from */
void *numBytesPtr) /* If non-NULL, write the number of bytes
size_t *numBytesPtr) /* If non-NULL, write the number of bytes
* in the array here */
{
ByteArray *baPtr;
@@ -487,7 +487,7 @@ Tcl_GetBytesFromObj(
baPtr = GET_BYTEARRAY(irPtr);
if (numBytesPtr != NULL) {
*(ptrdiff_t *)numBytesPtr = baPtr->used;
*numBytesPtr = baPtr->used;
}
return baPtr->bytes;
}
@@ -539,7 +539,7 @@ Tcl_GetByteArrayFromObj(
unsigned char *
TclGetByteArrayFromObj(
Tcl_Obj *objPtr, /* The ByteArray object. */
void *numBytesPtr) /* If non-NULL, write the number of bytes
size_t *numBytesPtr) /* If non-NULL, write the number of bytes
* in the array here */
{
ByteArray *baPtr;
@@ -556,8 +556,8 @@ TclGetByteArrayFromObj(
baPtr = GET_BYTEARRAY(irPtr);
if (numBytesPtr != NULL) {
/* Make sure we return a value between 0 and UINT_MAX-1, or (ptrdiff_t)-1 */
*(ptrdiff_t *)numBytesPtr = ((ptrdiff_t)(unsigned int)(baPtr->used + 1)) - 1;
/* Make sure we return a value between 0 and UINT_MAX-1, or (size_t)-1 */
*numBytesPtr = ((size_t)(unsigned int)(baPtr->used + 1)) - 1;
}
return baPtr->bytes;
}
@@ -1194,7 +1194,7 @@ BinaryFormatCmd(
}
/*
* Prepare the result object by preallocating the calculated number of
* Prepare the result object by preallocating the caclulated number of
* bytes and filling with nulls.
*/
@@ -1950,7 +1950,7 @@ GetFormatSpec(
*
* This routine determines, if bytes of a number need to be re-ordered,
* and returns a numeric code indicating the re-ordering to be done.
* This depends on the endianness of the machine and the desired format.
* This depends on the endiannes of the machine and the desired format.
* It is in effect a table (whose contents depend on the endianness of
* the system) describing whether a value needs reversing or not. Anyone
* porting the code to a big-endian platform should take care to make
+1 -1
View File
@@ -172,7 +172,7 @@ TclDumpMemoryInfo(
if (clientData == NULL) {
return 0;
}
snprintf(buf, sizeof(buf),
sprintf(buf,
"total mallocs %10" TCL_Z_MODIFIER "u\n"
"total frees %10" TCL_Z_MODIFIER "u\n"
"current packets allocated %10" TCL_Z_MODIFIER "u\n"
+4 -4
View File
@@ -1086,12 +1086,12 @@ ConvertUTCToLocalUsingC(
} else {
*buffer = '+';
}
snprintf(buffer+1, sizeof(buffer) - 1, "%02d", diff / 3600);
sprintf(buffer+1, "%02d", diff / 3600);
diff %= 3600;
snprintf(buffer+3, sizeof(buffer) - 3, "%02d", diff / 60);
sprintf(buffer+3, "%02d", diff / 60);
diff %= 60;
if (diff > 0) {
snprintf(buffer+5, sizeof(buffer) - 5, "%02d", diff);
sprintf(buffer+5, "%02d", diff);
}
fields->tzName = Tcl_NewStringObj(buffer, -1);
Tcl_IncrRefCount(fields->tzName);
@@ -1918,7 +1918,7 @@ ClockParseformatargsObjCmd(
if (Tcl_GetIndexFromObj(interp, objv[i], options, "option", 0,
&optionIndex) != TCL_OK) {
Tcl_SetErrorCode(interp, "CLOCK", "badOption",
TclGetString(objv[i]), NULL);
Tcl_GetString(objv[i]), NULL);
return TCL_ERROR;
}
switch (optionIndex) {
+215 -233
View File
@@ -51,7 +51,6 @@ static Tcl_ObjCmdProc EncodingConvertfromObjCmd;
static Tcl_ObjCmdProc EncodingConverttoObjCmd;
static Tcl_ObjCmdProc EncodingDirsObjCmd;
static Tcl_ObjCmdProc EncodingNamesObjCmd;
static Tcl_ObjCmdProc EncodingProfilesObjCmd;
static Tcl_ObjCmdProc EncodingSystemObjCmd;
static inline int ForeachAssignments(Tcl_Interp *interp,
struct ForeachState *statePtr);
@@ -520,7 +519,6 @@ TclInitEncodingCmd(
{"convertto", EncodingConverttoObjCmd, TclCompileBasic1To3ArgCmd, NULL, NULL, 0},
{"dirs", EncodingDirsObjCmd, TclCompileBasic0Or1ArgCmd, NULL, NULL, 1},
{"names", EncodingNamesObjCmd, TclCompileBasic0ArgCmd, NULL, NULL, 0},
{"profiles", EncodingProfilesObjCmd, TclCompileBasic0ArgCmd, NULL, NULL, 0},
{"system", EncodingSystemObjCmd, TclCompileBasic0Or1ArgCmd, NULL, NULL, 1},
{NULL, NULL, NULL, NULL, NULL, 0}
};
@@ -528,112 +526,6 @@ TclInitEncodingCmd(
return TclMakeEnsemble(interp, "encoding", encodingImplMap);
}
/*
*------------------------------------------------------------------------
*
* EncodingConvertParseOptions --
*
* Common routine for parsing arguments passed to encoding convertfrom
* and encoding convertto.
*
* Results:
* TCL_OK or TCL_ERROR.
*
* Side effects:
* On success,
* - *encPtr is set to the encoding. Must be freed with Tcl_FreeEncoding
* if non-NULL
* - *dataObjPtr is set to the Tcl_Obj containing the data to encode or
* decode
* - *profilePtr is set to encoding error handling profile
* - *failVarPtr is set to -failindex option value or NULL
* On error, all of the above are uninitialized.
*
*------------------------------------------------------------------------
*/
static int
EncodingConvertParseOptions (
Tcl_Interp *interp, /* For error messages. May be NULL */
int objc, /* Number of arguments */
Tcl_Obj *const objv[], /* Argument objects as passed to command. */
Tcl_Encoding *encPtr, /* Where to store the encoding */
Tcl_Obj **dataObjPtr, /* Where to store ptr to Tcl_Obj containing data */
int *profilePtr, /* Bit mask of encoding option profile */
Tcl_Obj **failVarPtr /* Where to store -failindex option value */
)
{
static const char *const options[] = {"-profile", "-failindex", NULL};
enum convertfromOptions { PROFILE, FAILINDEX } optIndex;
Tcl_Encoding encoding;
Tcl_Obj *dataObj;
Tcl_Obj *failVarObj;
int profile = TCL_ENCODING_PROFILE_TCL8;
/*
* Possible combinations:
* 1) data -> objc = 2
* 2) ?options? encoding data -> objc >= 3
* It is intentional that specifying option forces encoding to be
* specified. Less prone to user error. This should have always been
* the case even in 8.6 imho where there were no options (ie (1)
* should never have been allowed)
*/
if (objc == 1) {
numArgsError: /* ONLY jump here if nothing needs to be freed!!! */
Tcl_WrongNumArgs(interp,
1,
objv,
"?-profile profile? ?-failindex var? encoding data");
((Interp *)interp)->flags |= INTERP_ALTERNATE_WRONG_ARGS;
Tcl_WrongNumArgs(interp, 1, objv, "data");
return TCL_ERROR;
}
failVarObj = NULL;
if (objc == 2) {
encoding = Tcl_GetEncoding(interp, NULL);
dataObj = objv[1];
} else {
int argIndex;
for (argIndex = 1; argIndex < (objc-2); ++argIndex) {
if (Tcl_GetIndexFromObj(
interp, objv[argIndex], options, "option", 0, &optIndex)
!= TCL_OK) {
return TCL_ERROR;
}
if (++argIndex == (objc - 2)) {
goto numArgsError;
}
switch (optIndex) {
case PROFILE:
if (TclEncodingProfileNameToId(interp,
TclGetString(objv[argIndex]),
&profile) != TCL_OK) {
return TCL_ERROR;
}
break;
case FAILINDEX:
failVarObj = objv[argIndex];
break;
}
}
/* Get encoding after opts so no need to free it on option error */
if (Tcl_GetEncodingFromObj(interp, objv[objc - 2], &encoding)
!= TCL_OK) {
return TCL_ERROR;
}
dataObj = objv[objc - 1];
}
*encPtr = encoding;
*dataObjPtr = dataObj;
*profilePtr = profile;
*failVarPtr = failVarObj;
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
@@ -660,72 +552,126 @@ EncodingConvertfromObjCmd(
Tcl_Encoding encoding; /* Encoding to use */
int length; /* Length of the byte array being converted */
const char *bytesPtr; /* Pointer to the first byte of the array */
int flags;
#if TCL_MAJOR_VERSION > 8 || defined(TCL_NO_DEPRECATED)
int flags = TCL_ENCODING_STOPONERROR;
#else
int flags = TCL_ENCODING_NOCOMPLAIN;
#endif
int result;
Tcl_Obj *failVarObj;
Tcl_Size errorLocation;
Tcl_Obj *failVarObj = NULL;
/*
* Decode parameters:
* Possible combinations:
* 1) data -> objc = 2
* 2) encoding data -> objc = 3
* 3) -nocomplain encoding data -> objc = 4
* 4) -strict -failindex val encoding data -> objc = 6
* 5) -strict encoding data -> objc = 4
* 6) -failindex val encoding data -> objc = 5
* 7) -failindex val -strict encoding data -> objc = 6
*/
if (EncodingConvertParseOptions(
interp, objc, objv, &encoding, &data, &flags, &failVarObj)
!= TCL_OK) {
if (objc == 2) {
encoding = Tcl_GetEncoding(interp, NULL);
data = objv[1];
} else if (objc == 3) {
if (Tcl_GetEncodingFromObj(interp, objv[1], &encoding) != TCL_OK) {
return TCL_ERROR;
}
data = objv[2];
} else if (objc > 3 && objc < 7) {
int objcUnprocessed = objc;
data = objv[objc - 1];
bytesPtr = Tcl_GetString(objv[1]);
if (bytesPtr[0] == '-' && bytesPtr[1] == 'n'
&& !strncmp(bytesPtr, "-nocomplain", strlen(bytesPtr))) {
flags = TCL_ENCODING_NOCOMPLAIN;
objcUnprocessed--;
} else if (bytesPtr[0] == '-' && bytesPtr[1] == 's'
&& !strncmp(bytesPtr, "-strict", strlen(bytesPtr))) {
flags = TCL_ENCODING_STRICT;
objcUnprocessed--;
bytesPtr = Tcl_GetString(objv[2]);
if (bytesPtr[0] == '-' && bytesPtr[1] == 'f'
&& !strncmp(bytesPtr, "-failindex", strlen(bytesPtr))) {
/* at least three additional arguments needed */
if (objc < 6) {
goto encConvFromError;
}
failVarObj = objv[3];
objcUnprocessed -= 2;
}
} else if (bytesPtr[0] == '-' && bytesPtr[1] == 'f'
&& !strncmp(bytesPtr, "-failindex", strlen(bytesPtr))) {
/* at least three additional arguments needed */
if (objc < 5) {
goto encConvFromError;
}
failVarObj = objv[2];
flags = ENCODING_FAILINDEX;
objcUnprocessed -= 2;
bytesPtr = Tcl_GetString(objv[3]);
if (bytesPtr[0] == '-' && bytesPtr[1] == 's'
&& !strncmp(bytesPtr, "-strict", strlen(bytesPtr))) {
flags = TCL_ENCODING_STRICT;
objcUnprocessed --;
}
}
switch (objcUnprocessed) {
case 3:
if (Tcl_GetEncodingFromObj(interp, objv[objc - 2], &encoding) != TCL_OK) {
return TCL_ERROR;
}
break;
case 2:
encoding = Tcl_GetEncoding(interp, NULL);
break;
default:
goto encConvFromError;
}
} else {
encConvFromError:
Tcl_WrongNumArgs(interp, 1, objv, "?-strict? ?-failindex var? ?encoding? data");
((Interp *) interp)->flags |= INTERP_ALTERNATE_WRONG_ARGS;
Tcl_WrongNumArgs(interp, 1, objv, "-nocomplain ?encoding? data");
return TCL_ERROR;
}
/*
* Convert the string into a byte array in 'ds'.
* Convert the string into a byte array in 'ds'
*/
#if !defined(TCL_NO_DEPRECATED) && (TCL_MAJOR_VERSION < 9)
if (ENCODING_PROFILE_GET(flags) == TCL_ENCODING_PROFILE_TCL8) {
/* Permits high bits to be non-0 in byte array (Tcl 8 style) */
if (!(flags & TCL_ENCODING_STOPONERROR)) {
bytesPtr = (char *) Tcl_GetByteArrayFromObj(data, &length);
} else
#endif
bytesPtr = (char *) TclGetBytesFromObj(interp, data, &length);
bytesPtr = (char *) TclGetBytesFromObj(interp, data, &length);
if (bytesPtr == NULL) {
return TCL_ERROR;
}
result = Tcl_ExternalToUtfDStringEx(interp, encoding, bytesPtr, length, flags,
&ds, failVarObj ? &errorLocation : NULL);
/* NOTE: ds must be freed beyond this point even on error */
switch (result) {
case TCL_OK:
errorLocation = TCL_INDEX_NONE;
break;
case TCL_ERROR:
/* Error in parameters. Should not happen. interp will have error */
Tcl_DStringFree(&ds);
return TCL_ERROR;
default:
/*
* One of the TCL_CONVERT_* errors. If we were not interested in the
* error location, interp result would already have been filled in
* and we can just return the error. Otherwise, we have to return
* what could be decoded and the returned error location.
*/
if (failVarObj == NULL) {
Tcl_DStringFree(&ds);
return TCL_ERROR;
}
break;
}
/*
* TCL_OK or a TCL_CONVERT_* error where the caller wants back as much
* data as was converted.
*/
if (failVarObj) {
Tcl_Obj *failIndex;
TclNewIndexObj(failIndex, errorLocation);
if (Tcl_ObjSetVar2(interp,
failVarObj,
NULL,
failIndex,
TCL_LEAVE_ERR_MSG) == NULL) {
result = Tcl_ExternalToUtfDStringEx(encoding, bytesPtr, length,
flags, &ds);
if ((!(flags & TCL_ENCODING_NOCOMPLAIN) || ((flags & TCL_ENCODING_STRICT) == TCL_ENCODING_STRICT)) && (result != TCL_INDEX_NONE)) {
if (failVarObj != NULL) {
if (Tcl_ObjSetVar2(interp, failVarObj, NULL, Tcl_NewWideIntObj(result), TCL_LEAVE_ERR_MSG) == NULL) {
return TCL_ERROR;
}
} else {
char buf[TCL_INTEGER_SPACE];
sprintf(buf, "%u", result);
Tcl_SetObjResult(interp, Tcl_ObjPrintf("unexpected byte sequence starting at index %"
"u: '\\x%X'", result, UCHAR(bytesPtr[result])));
Tcl_SetErrorCode(interp, "TCL", "ENCODING", "ILLEGALSEQUENCE",
buf, NULL);
Tcl_DStringFree(&ds);
return TCL_ERROR;
}
} else if (failVarObj != NULL) {
if (Tcl_ObjSetVar2(interp, failVarObj, NULL, Tcl_NewIntObj(-1), TCL_LEAVE_ERR_MSG) == NULL) {
return TCL_ERROR;
}
}
/*
* Note that we cannot use Tcl_DStringResult here because it will
* truncate the string at the first null byte.
@@ -733,7 +679,9 @@ EncodingConvertfromObjCmd(
Tcl_SetObjResult(interp, Tcl_DStringToObj(&ds));
/* We're done with the encoding */
/*
* We're done with the encoding
*/
Tcl_FreeEncoding(encoding);
return TCL_OK;
@@ -767,13 +715,89 @@ EncodingConverttoObjCmd(
int length; /* Length of the string being converted */
const char *stringPtr; /* Pointer to the first byte of the string */
int result;
int flags;
Tcl_Obj *failVarObj;
Tcl_Size errorLocation;
#if TCL_MAJOR_VERSION > 8 || defined(TCL_NO_DEPRECATED)
int flags = TCL_ENCODING_STOPONERROR;
#else
int flags = TCL_ENCODING_NOCOMPLAIN;
#endif
Tcl_Obj *failVarObj = NULL;
/*
* Decode parameters:
* Possible combinations:
* 1) data -> objc = 2
* 2) encoding data -> objc = 3
* 3) -nocomplain encoding data -> objc = 4
* 4) -strict -failindex val encoding data -> objc = 6
* 5) -strict encoding data -> objc = 4
* 6) -failindex val encoding data -> objc = 5
* 7) -failindex val -strict encoding data -> objc = 6
*/
if (objc == 2) {
encoding = Tcl_GetEncoding(interp, NULL);
data = objv[1];
} else if (objc == 3) {
if (Tcl_GetEncodingFromObj(interp, objv[1], &encoding) != TCL_OK) {
return TCL_ERROR;
}
data = objv[2];
} else if (objc > 3 && objc < 7) {
int objcUnprocessed = objc;
data = objv[objc - 1];
stringPtr = Tcl_GetString(objv[1]);
if (stringPtr[0] == '-' && stringPtr[1] == 'n'
&& !strncmp(stringPtr, "-nocomplain", strlen(stringPtr))) {
flags = TCL_ENCODING_NOCOMPLAIN;
objcUnprocessed--;
} else if (stringPtr[0] == '-' && stringPtr[1] == 's'
&& !strncmp(stringPtr, "-strict", strlen(stringPtr))) {
flags = TCL_ENCODING_STRICT;
objcUnprocessed--;
stringPtr = Tcl_GetString(objv[2]);
if (stringPtr[0] == '-' && stringPtr[1] == 'f'
&& !strncmp(stringPtr, "-failindex", strlen(stringPtr))) {
/* at least three additional arguments needed */
if (objc < 6) {
goto encConvToError;
}
failVarObj = objv[3];
objcUnprocessed -= 2;
}
} else if (stringPtr[0] == '-' && stringPtr[1] == 'f'
&& !strncmp(stringPtr, "-failindex", strlen(stringPtr))) {
/* at least three additional arguments needed */
if (objc < 5) {
goto encConvToError;
}
failVarObj = objv[2];
flags = TCL_ENCODING_STOPONERROR;
objcUnprocessed -= 2;
stringPtr = Tcl_GetString(objv[3]);
if (stringPtr[0] == '-' && stringPtr[1] == 's'
&& !strncmp(stringPtr, "-strict", strlen(stringPtr))) {
flags = TCL_ENCODING_STRICT;
objcUnprocessed --;
}
}
switch (objcUnprocessed) {
case 3:
if (Tcl_GetEncodingFromObj(interp, objv[objc - 2], &encoding) != TCL_OK) {
return TCL_ERROR;
}
break;
case 2:
encoding = Tcl_GetEncoding(interp, NULL);
break;
default:
goto encConvToError;
}
} else {
encConvToError:
Tcl_WrongNumArgs(interp, 1, objv, "?-strict? ?-failindex var? ?encoding? data");
((Interp *) interp)->flags |= INTERP_ALTERNATE_WRONG_ARGS;
Tcl_WrongNumArgs(interp, 1, objv, "-nocomplain ?encoding? data");
if (EncodingConvertParseOptions(
interp, objc, objv, &encoding, &data, &flags, &failVarObj)
!= TCL_OK) {
return TCL_ERROR;
}
@@ -782,54 +806,40 @@ EncodingConverttoObjCmd(
*/
stringPtr = TclGetStringFromObj(data, &length);
result = Tcl_UtfToExternalDStringEx(interp, encoding, stringPtr, length, flags,
&ds, failVarObj ? &errorLocation : NULL);
/* NOTE: ds must be freed beyond this point even on error */
switch (result) {
case TCL_OK:
errorLocation = TCL_INDEX_NONE;
break;
case TCL_ERROR:
/* Error in parameters. Should not happen. interp will have error */
Tcl_DStringFree(&ds);
return TCL_ERROR;
default:
/*
* One of the TCL_CONVERT_* errors. If we were not interested in the
* error location, interp result would already have been filled in
* and we can just return the error. Otherwise, we have to return
* what could be decoded and the returned error location.
*/
if (failVarObj == NULL) {
Tcl_DStringFree(&ds);
return TCL_ERROR;
}
break;
}
/*
* TCL_OK or a TCL_CONVERT_* error where the caller wants back as much
* data as was converted.
*/
if (failVarObj) {
Tcl_Obj *failIndex;
TclNewIndexObj(failIndex, errorLocation);
if (Tcl_ObjSetVar2(interp,
failVarObj,
NULL,
failIndex,
TCL_LEAVE_ERR_MSG) == NULL) {
result = Tcl_UtfToExternalDStringEx(encoding, stringPtr, length,
flags, &ds);
if ((!(flags & TCL_ENCODING_NOCOMPLAIN) || ((flags & TCL_ENCODING_STRICT) == TCL_ENCODING_STRICT)) && (result != TCL_INDEX_NONE)) {
if (failVarObj != NULL) {
/* I hope, wide int will cover size_t data type */
if (Tcl_ObjSetVar2(interp, failVarObj, NULL, Tcl_NewWideIntObj(result), TCL_LEAVE_ERR_MSG) == NULL) {
return TCL_ERROR;
}
} else {
size_t pos = Tcl_NumUtfChars(stringPtr, result);
int ucs4;
char buf[TCL_INTEGER_SPACE];
TclUtfToUCS4(&stringPtr[result], &ucs4);
sprintf(buf, "%u", result);
Tcl_SetObjResult(interp, Tcl_ObjPrintf("unexpected character at index %"
TCL_Z_MODIFIER "u: 'U+%06X'", pos, ucs4));
Tcl_SetErrorCode(interp, "TCL", "ENCODING", "ILLEGALSEQUENCE",
buf, NULL);
Tcl_DStringFree(&ds);
return TCL_ERROR;
}
} else if (failVarObj != NULL) {
if (Tcl_ObjSetVar2(interp, failVarObj, NULL, Tcl_NewIntObj(-1), TCL_LEAVE_ERR_MSG) == NULL) {
return TCL_ERROR;
}
}
Tcl_SetObjResult(interp,
Tcl_NewByteArrayObj((unsigned char*) Tcl_DStringValue(&ds),
Tcl_DStringLength(&ds)));
Tcl_DStringFree(&ds);
/* We're done with the encoding */
/*
* We're done with the encoding
*/
Tcl_FreeEncoding(encoding);
return TCL_OK;
@@ -911,34 +921,6 @@ EncodingNamesObjCmd(
return TCL_OK;
}
/*
*-----------------------------------------------------------------------------
*
* EncodingProfilesObjCmd --
*
* This command returns a list of the available encoding profiles
*
* Results:
* Returns a standard Tcl result
*
*-----------------------------------------------------------------------------
*/
int
EncodingProfilesObjCmd(
TCL_UNUSED(void *),
Tcl_Interp* interp, /* Tcl interpreter */
int objc, /* Number of command line args */
Tcl_Obj* const objv[]) /* Vector of command line args */
{
if (objc > 1) {
Tcl_WrongNumArgs(interp, 1, objv, NULL);
return TCL_ERROR;
}
TclGetEncodingProfiles(interp);
return TCL_OK;
}
/*
*-----------------------------------------------------------------------------
*
@@ -2054,7 +2036,7 @@ PathFilesystemCmd(
if (fsInfo == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj("unrecognised path", -1));
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "FILESYSTEM",
TclGetString(objv[1]), NULL);
Tcl_GetString(objv[1]), NULL);
return TCL_ERROR;
}
Tcl_SetObjResult(interp, fsInfo);
@@ -2306,7 +2288,7 @@ FilesystemSeparatorCmd(
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"unrecognised path", -1));
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "FILESYSTEM",
TclGetString(objv[1]), NULL);
Tcl_GetString(objv[1]), NULL);
return TCL_ERROR;
}
Tcl_SetObjResult(interp, separatorObj);
@@ -2949,7 +2931,7 @@ EachloopCmd(
result = TCL_ERROR;
goto done;
}
/* Don't compute values here, wait until the last moment */
/* Don't compute values here, wait until the last momement */
statePtr->argcList[i] = TclArithSeriesObjLength(statePtr->aCopyList[i]);
} else {
/* List values */
+45 -67
View File
@@ -39,7 +39,7 @@ typedef struct SortElement {
} collationKey;
union { /* Object being sorted, or its index. */
Tcl_Obj *objPtr;
Tcl_Size index;
int index;
} payload;
struct SortElement *nextPtr;/* Next element in the list, or NULL for end
* of list. */
@@ -51,6 +51,7 @@ typedef struct SortElement {
*/
typedef int (*SortStrCmpFn_t) (const char *, const char *);
typedef int (*SortMemCmpFn_t) (const void *, const void *, size_t);
/*
* The "lsort" command needs to pass certain information down to the function
@@ -64,7 +65,7 @@ typedef struct {
int sortMode; /* The sort mode. One of SORTMODE_* values
* defined below. */
Tcl_Obj *compareCmdPtr; /* The Tcl comparison command when sortMode is
* SORTMODE_COMMAND. Preinitialized to hold
* SORTMODE_COMMAND. Pre-initialized to hold
* base of command. */
int *indexv; /* If the -index option was specified, this
* holds an encoding of the indexes contained
@@ -73,7 +74,7 @@ typedef struct {
* NULL if no indexes supplied, and points to
* singleIndex field when only one
* supplied. */
Tcl_Size indexc; /* Number of indexes in indexv array. */
int indexc; /* Number of indexes in indexv array. */
int singleIndex; /* Static space for common index case. */
int unique;
int numElements;
@@ -540,7 +541,7 @@ InfoBodyCmd(
Interp *iPtr = (Interp *) interp;
const char *name, *bytes;
Proc *procPtr;
Tcl_Size numBytes;
int numBytes;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "procname");
@@ -650,7 +651,7 @@ InfoCommandsCmd(
Tcl_Obj *listPtr, *elemObjPtr;
int specificNsInPattern = 0;/* Init. to avoid compiler warning. */
Tcl_Command cmd;
Tcl_Size i;
int i;
/*
* Get the pattern and find the "effective namespace" in which to list
@@ -1396,7 +1397,7 @@ TclInfoFrame(
ADD_PAIR("proc", procNameObj);
} else if (procPtr->cmdPtr->clientData) {
ExtraFrameInfo *efiPtr = (ExtraFrameInfo *)procPtr->cmdPtr->clientData;
Tcl_Size i;
int i;
/*
* This is a non-standard command. Luckily, it's told us how to
@@ -2201,8 +2202,7 @@ Tcl_JoinObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* The argument objects. */
{
Tcl_Size length, listLen;
int isArithSeries = 0;
int length, listLen, isArithSeries = 0;
Tcl_Obj *resObjPtr = NULL, *joinObjPtr, **elemPtrs;
if ((objc < 2) || (objc > 3)) {
@@ -2250,7 +2250,7 @@ Tcl_JoinObjCmd(
if (length == 0) {
resObjPtr = TclStringCat(interp, listLen, elemPtrs, 0);
} else {
Tcl_Size i;
int i;
TclNewObj(resObjPtr);
if (isArithSeries) {
@@ -2325,8 +2325,7 @@ Tcl_LassignObjCmd(
{
Tcl_Obj *listCopyPtr;
Tcl_Obj **listObjv; /* The contents of the list. */
Tcl_Size listObjc; /* The length of the list. */
Tcl_Size origListObjc; /* Original length */
int listObjc; /* The length of the list. */
int code = TCL_OK;
if (objc < 2) {
@@ -2338,10 +2337,8 @@ Tcl_LassignObjCmd(
if (listCopyPtr == NULL) {
return TCL_ERROR;
}
Tcl_IncrRefCount(listCopyPtr); /* Important! fs */
TclListObjGetElementsM(NULL, listCopyPtr, &listObjc, &listObjv);
origListObjc = listObjc;
objc -= 2;
objv += 2;
@@ -2369,13 +2366,7 @@ Tcl_LassignObjCmd(
}
if (code == TCL_OK && listObjc > 0) {
Tcl_Obj *resultObjPtr = TclListObjRange(
interp, listCopyPtr, origListObjc - listObjc, origListObjc - 1);
if (resultObjPtr == NULL) {
code = TCL_ERROR;
} else {
Tcl_SetObjResult(interp, resultObjPtr);
}
Tcl_SetObjResult(interp, Tcl_NewListObj(listObjc, listObjv));
}
Tcl_DecrRefCount(listCopyPtr);
@@ -2465,8 +2456,7 @@ Tcl_LinsertObjCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tcl_Obj *listPtr;
Tcl_Size len, index;
int result;
int index, len, result;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 1, objv, "list index ?element ...?");
@@ -2584,8 +2574,7 @@ Tcl_LlengthObjCmd(
Tcl_Obj *const objv[])
/* Argument objects. */
{
Tcl_Size listLen;
int result;
int listLen, result;
Tcl_Obj *objPtr;
if (objc != 2) {
@@ -2633,8 +2622,7 @@ Tcl_LpopObjCmd(
Tcl_Obj *const objv[])
/* Argument objects. */
{
Tcl_Size listLen;
int result;
int listLen, result;
Tcl_Obj *elemPtr, *stored;
Tcl_Obj *listPtr, **elemPtrs;
@@ -2735,8 +2723,7 @@ Tcl_LrangeObjCmd(
Tcl_Obj *const objv[])
/* Argument objects. */
{
int result;
Tcl_Size listLen, first, last;
int listLen, first, last, result;
if (objc != 4) {
Tcl_WrongNumArgs(interp, 1, objv, "list first last");
return TCL_ERROR;
@@ -2768,11 +2755,7 @@ Tcl_LrangeObjCmd(
return TCL_ERROR;
}
} else {
Tcl_Obj *resultObj = TclListObjRange(interp, objv[1], first, last);
if (resultObj == NULL) {
return TCL_ERROR;
}
Tcl_SetObjResult(interp, resultObj);
Tcl_SetObjResult(interp, TclListObjRange(objv[1], first, last));
}
return TCL_OK;
}
@@ -2799,8 +2782,8 @@ LremoveIndexCompare(
const void *el1Ptr,
const void *el2Ptr)
{
Tcl_Size idx1 = *((const Tcl_Size *) el1Ptr);
Tcl_Size idx2 = *((const Tcl_Size *) el2Ptr);
int idx1 = *((const int *) el1Ptr);
int idx2 = *((const int *) el2Ptr);
/*
* This will put the larger element first.
@@ -2816,8 +2799,8 @@ Tcl_LremoveObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tcl_Size i, idxc, prevIdx, first, num;
Tcl_Size *idxv, listLen;
int i, idxc, listLen, prevIdx, first, num;
int *idxv;
Tcl_Obj *listObj;
/*
@@ -2839,7 +2822,7 @@ Tcl_LremoveObjCmd(
Tcl_SetObjResult(interp, listObj);
return TCL_OK;
}
idxv = (Tcl_Size *)Tcl_Alloc((objc - 2) * sizeof(*idxv));
idxv = (int *)ckalloc((objc - 2) * sizeof(int));
for (i = 2; i < objc; i++) {
if (TclGetIntForIndexM(interp, objv[i], /*endValue*/ listLen - 1,
&idxv[i - 2]) != TCL_OK) {
@@ -2854,7 +2837,7 @@ Tcl_LremoveObjCmd(
*/
if (idxc > 1) {
qsort(idxv, idxc, sizeof(*idxv), LremoveIndexCompare);
qsort(idxv, idxc, sizeof(int), LremoveIndexCompare);
}
/*
@@ -2867,7 +2850,7 @@ Tcl_LremoveObjCmd(
num = 0;
first = listLen;
for (i = 0, prevIdx = -1 ; i < idxc ; i++) {
Tcl_Size idx = idxv[i];
int idx = idxv[i];
/*
* Repeated index and sanity check.
@@ -2936,8 +2919,7 @@ Tcl_LrepeatObjCmd(
Tcl_Obj *const objv[])
/* The argument objects. */
{
Tcl_WideInt elementCount, i;
Tcl_Size totalElems;
int elementCount, i, totalElems;
Tcl_Obj *listPtr, **dataArray = NULL;
/*
@@ -2949,12 +2931,12 @@ Tcl_LrepeatObjCmd(
Tcl_WrongNumArgs(interp, 1, objv, "count ?value ...?");
return TCL_ERROR;
}
if (TCL_OK != TclGetWideIntFromObj(interp, objv[1], &elementCount)) {
if (TCL_OK != TclGetIntFromObj(interp, objv[1], &elementCount)) {
return TCL_ERROR;
}
if (elementCount < 0) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"bad count \"%" TCL_LL_MODIFIER "d\": must be integer >= 0", elementCount));
"bad count \"%d\": must be integer >= 0", elementCount));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LREPEAT", "NEGARG",
NULL);
return TCL_ERROR;
@@ -3011,7 +2993,7 @@ Tcl_LrepeatObjCmd(
dataArray[i] = tmpPtr;
}
} else {
Tcl_Size j, k = 0;
int j, k = 0;
for (i=0 ; i<elementCount ; i++) {
for (j=0 ; j<objc ; j++) {
@@ -3051,8 +3033,8 @@ Tcl_LreplaceObjCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tcl_Obj *listPtr;
Tcl_Size numToDelete, listLen, first, last;
int result;
int first, last;
int listLen, numToDelete, result;
if (objc < 4) {
Tcl_WrongNumArgs(interp, 1, objv,
@@ -3152,7 +3134,7 @@ Tcl_LreverseObjCmd(
Tcl_Obj *const objv[]) /* Argument values. */
{
Tcl_Obj **elemv;
Tcl_Size elemc, i, j;
int elemc, i, j;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "list");
@@ -3257,12 +3239,11 @@ Tcl_LsearchObjCmd(
Tcl_Obj *const objv[]) /* Argument values. */
{
const char *bytes, *patternBytes;
int match, result=TCL_OK, bisect;
Tcl_Size i, length, listc, elemLen, start, index;
Tcl_Size groupSize, groupOffset, lower, upper;
int i, match, index, result=TCL_OK, listc, bisect;
int length, elemLen, start, groupSize, groupOffset, lower, upper;
int allocatedIndexVector = 0;
int dataType, isIncreasing;
Tcl_WideInt patWide, objWide, wide;
Tcl_WideInt patWide, objWide;
int allMatches, inlineReturn, negatedMatch, returnSubindices, noCase;
double patDouble, objDouble;
SortInfo sortInfo;
@@ -3418,24 +3399,23 @@ Tcl_LsearchObjCmd(
result = TCL_ERROR;
goto done;
}
if (Tcl_GetWideIntFromObj(interp, objv[i+1], &wide) != TCL_OK) {
if (Tcl_GetIntFromObj(interp, objv[i+1], &groupSize) != TCL_OK) {
result = TCL_ERROR;
goto done;
}
if ((wide < 1) || (wide > LIST_MAX)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"stride length must be between 1 and %d", LIST_MAX));
if (groupSize < 1) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"stride length must be at least 1", -1));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LSEARCH",
"BADSTRIDE", NULL);
result = TCL_ERROR;
goto done;
}
groupSize = wide;
i++;
break;
case LSEARCH_INDEX: { /* -index */
Tcl_Obj **indices;
Tcl_Size j;
int j;
if (allocatedIndexVector) {
TclStackFree(interp, sortInfo.indexv);
@@ -4505,7 +4485,6 @@ Tcl_LsortObjCmd(
int group, groupSize, groupOffset, idx, allocatedIndexVector = 0;
Tcl_Obj *resultPtr, *cmdPtr, **listObjPtrs, *listObj, *indexPtr;
size_t elmArrSize;
Tcl_WideInt wide;
SortElement *elementArray = NULL, *elementPtr;
SortInfo sortInfo; /* Information about this sort that needs to
* be passed to the comparison function. */
@@ -4655,19 +4634,18 @@ Tcl_LsortObjCmd(
sortInfo.resultCode = TCL_ERROR;
goto done;
}
if (Tcl_GetWideIntFromObj(interp, objv[i+1], &wide) != TCL_OK) {
if (Tcl_GetIntFromObj(interp, objv[i+1], &groupSize) != TCL_OK) {
sortInfo.resultCode = TCL_ERROR;
goto done;
}
if ((wide < 2) || (wide > LIST_MAX)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"stride length must be between 2 and %d", LIST_MAX));
if (groupSize < 2) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"stride length must be at least 2", -1));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LSORT",
"BADSTRIDE", NULL);
sortInfo.resultCode = TCL_ERROR;
goto done;
}
groupSize = wide;
group = 1;
i++;
break;
@@ -4905,7 +4883,7 @@ Tcl_LsortObjCmd(
}
/*
* Merge this element in the preexisting sublists (and merge together
* Merge this element in the pre-existing sublists (and merge together
* sublists when we have two of the same size).
*/
@@ -5222,7 +5200,7 @@ MergeLists(
* ordering between two elements.
*
* Results:
* A negative results means the first element comes before the
* A negative results means the the first element comes before the
* second, and a positive results means that the second element should
* come first. A result of zero means the two elements are equal and it
* doesn't matter which comes first.
@@ -5424,7 +5402,7 @@ DictionaryCompare(
/*
* Convert both chars to lower for the comparison, because
* dictionary sorts are case-insensitive. Covert to lower, not
* dictionary sorts are case insensitve. Covert to lower, not
* upper, so chars between Z and a will sort before A (where most
* other interesting punctuations occur).
*/
+7 -7
View File
@@ -427,7 +427,7 @@ Tcl_RegexpObjCmd(
* match. We always increment the offset by at least one to prevent
* endless looping (as in the case: regexp -all {a*} a). Otherwise,
* when we match the NULL string at the end of the input string, we
* will loop indefinitely (because the length of the match is 0, so
* will loop indefinately (because the length of the match is 0, so
* offset never changes).
*/
@@ -1239,7 +1239,7 @@ Tcl_SplitObjCmd(
/*
* Handle the special case of splitting on a single character. This is
* only true for the one-char ASCII case, as one Unicode char is > 1
* only true for the one-char ASCII case, as one unicode char is > 1
* byte in length.
*/
@@ -1588,7 +1588,7 @@ StringIsCmd(
/*
* We get the objPtr so that we can short-cut for some classes by checking
* the object type (int and double), but we need the string otherwise,
* because we don't want any conversion of type occurring (as, for example,
* because we don't want any conversion of type occuring (as, for example,
* Tcl_Get*FromObj would do).
*/
@@ -2122,7 +2122,7 @@ StringMapCmd(
int *mapLens, *u2lc = NULL;
/*
* Precompute pointers to the Unicode string and length. This saves us
* Precompute pointers to the unicode string and length. This saves us
* repeated function calls later, significantly speeding up the
* algorithm. We only need the lowercase first char in the nocase
* case.
@@ -2171,7 +2171,7 @@ StringMapCmd(
ustring1 = p - 1;
/*
* Append the map value to the Unicode string.
* Append the map value to the unicode string.
*/
TclAppendUnicodeToObj(resultPtr,
@@ -4793,7 +4793,7 @@ TclNRTryObjCmd(
if (TclListObjLengthM(NULL, objv[i+1], &dummy) != TCL_OK) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"bad prefix '%s': must be a list",
TclGetString(objv[i+1])));
Tcl_GetString(objv[i+1])));
Tcl_DecrRefCount(handlersObj);
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "TRY", "TRAP",
"EXNFORMAT", NULL);
@@ -5333,7 +5333,7 @@ TclListLines(
Tcl_Obj *const *elems) /* The list elems as Tcl_Obj*, in need of
* derived continuation data */
{
const char *listStr = TclGetString(listObj);
const char *listStr = Tcl_GetString(listObj);
const char *listHead = listStr;
int i, length = strlen(listStr);
const char *element = NULL, *next = NULL;
+10 -10
View File
@@ -230,7 +230,7 @@ TclCompileAppendCmd(
*
* TclCompileArray*Cmd --
*
* Functions called to compile "array" subcommands.
* Functions called to compile "array" sucommands.
*
* Results:
* All return TCL_OK for a successful compile, and TCL_ERROR to defer
@@ -634,7 +634,7 @@ TclCompileCatchCmd(
* catch range so that errors in the substitution are not caught.
* [Bug 219184]
* The reason for duplicating the script is that EVAL_STK would otherwise
* begin by underflowing the stack below the mark set by BEGIN_CATCH4.
* begin by undeflowing the stack below the mark set by BEGIN_CATCH4.
*/
range = TclCreateExceptRange(CATCH_EXCEPTION_RANGE, envPtr);
@@ -982,7 +982,7 @@ TclCompileContinueCmd(
*
* TclCompileDict*Cmd --
*
* Functions called to compile "dict" subcommands.
* Functions called to compile "dict" sucommands.
*
* Results:
* All return TCL_OK for a successful compile, and TCL_ERROR to defer
@@ -1686,7 +1686,7 @@ CompileDictEachCmd(
/*
* Error handler "finally" clause, which force-terminates the iteration
* and re-throws the error.
* and rethrows the error.
*/
TclAdjustStackDepth(-1, envPtr);
@@ -1858,7 +1858,7 @@ TclCompileDictUpdateCmd(
/*
* Termination code for non-ok returns: stash the result and return
* options in the stack, bring up the key list, finish the update code,
* and finally return with the caught return data
* and finally return with the catched return data
*/
ExceptionRangeTarget(envPtr, range, catchOffset);
@@ -1904,7 +1904,7 @@ TclCompileDictAppendCmd(
/*
* There must be at least two argument after the command. And we impose an
* (arbitrary) safe limit; anyone exceeding it should stop worrying about
* (arbirary) safe limit; anyone exceeding it should stop worrying about
* speed quite so much. ;-)
*/
@@ -3187,7 +3187,7 @@ TclCompileFormatCmd(
* the format is broken). Do the format now.
*/
tmpObj = Tcl_Format(interp, TclGetString(formatObj),
tmpObj = Tcl_Format(interp, Tcl_GetString(formatObj),
parsePtr->numWords-2, objv);
for (; --i>=0 ;) {
Tcl_DecrRefCount(objv[i]);
@@ -3231,7 +3231,7 @@ TclCompileFormatCmd(
* Now scan through and check for non-%s and non-%% substitutions.
*/
for (bytes = TclGetString(formatObj) ; *bytes ; bytes++) {
for (bytes = Tcl_GetString(formatObj) ; *bytes ; bytes++) {
if (*bytes == '%') {
bytes++;
if (*bytes == 's') {
@@ -3264,7 +3264,7 @@ TclCompileFormatCmd(
i = 0; /* The count of things to concat. */
j = 2; /* The index into the argument tokens, for
* TIP#280 handling. */
start = TclGetString(formatObj);
start = Tcl_GetString(formatObj);
/* The start of the currently-scanned literal
* in the format string. */
TclNewObj(tmpObj); /* The buffer used to accumulate the literal
@@ -3342,7 +3342,7 @@ TclCompileFormatCmd(
* then return -1.
*
* Side effects:
* May add an entry into the table of compiled locals.
* May add an entery into the table of compiled locals.
*
*----------------------------------------------------------------------
*/
+3 -3
View File
@@ -416,7 +416,7 @@ TclCompileIfCmd(
if (TclFixupForwardJumpToHere(envPtr,
jumpEndFixupArray.fixup + jumpIndex, 127)) {
/*
* Adjust the immediately preceding "ifFalse" jump. We moved it's
* Adjust the immediately preceeding "ifFalse" jump. We moved it's
* target (just after this jump) down three bytes.
*/
@@ -619,8 +619,8 @@ TclCompileInfoCommandsCmd(
Tcl_DecrRefCount(objPtr);
/*
* Confirmed as a literal that will not frighten the horses. Compile.
* The result must be made into a list.
* Confirmed as a literal that will not frighten the horses. Compile. Note
* that the result needs to be list-ified.
*/
/* TODO: Just push the known value */
+8 -8
View File
@@ -892,7 +892,7 @@ TclCompileStringLenCmd(
char buf[TCL_INTEGER_SPACE];
int len = TclGetCharLength(objPtr);
len = snprintf(buf, sizeof(buf), "%d", len);
len = sprintf(buf, "%d", len);
PushLiteral(envPtr, buf, len);
} else {
SetLineInformation(1);
@@ -2374,7 +2374,7 @@ IssueSwitchJumpTable(
* Compile the switch by using a jump table, which is basically a
* hashtable that maps from literal values to match against to the offset
* (relative to the INST_JUMP_TABLE instruction) to jump to. The jump
* table itself is independent of any invocation of the bytecode, and as
* table itself is independent of any invokation of the bytecode, and as
* such is stored in an auxData block.
*
* Start by allocating the jump table itself, plus some workspace.
@@ -2661,7 +2661,7 @@ TclCompileTailcallCmd(
Tcl_Token *tokenPtr = parsePtr->tokenPtr;
int i;
if (parsePtr->numWords < 2 || parsePtr->numWords >= 256
if (parsePtr->numWords < 2 || parsePtr->numWords > 256
|| envPtr->procPtr == NULL) {
return TCL_ERROR;
}
@@ -3114,7 +3114,7 @@ IssueTryClausesInstructions(
for (i=0 ; i<numHandlers ; i++) {
noError[i] = -1;
snprintf(buf, sizeof(buf), "%d", matchCodes[i]);
sprintf(buf, "%d", matchCodes[i]);
OP( DUP);
PushLiteral(envPtr, buf, strlen(buf));
OP( EQ);
@@ -3326,7 +3326,7 @@ IssueTryClausesFinallyInstructions(
int noTrapError, trapError;
const char *p;
snprintf(buf, sizeof(buf), "%d", matchCodes[i]);
sprintf(buf, "%d", matchCodes[i]);
OP( DUP);
PushLiteral(envPtr, buf, strlen(buf));
OP( EQ);
@@ -4076,7 +4076,7 @@ CompileAssociativeBinaryOpCmd(
if (words > 3) {
/*
* Reverse order of arguments to get precise agreement with [expr] in
* calculations, including roundoff errors.
* calcuations, including roundoff errors.
*/
OP4( REVERSE, words-1);
@@ -4527,7 +4527,7 @@ TclCompileMinusOpCmd(
/*
* Reverse order of arguments to get precise agreement with [expr] in
* calculations, including roundoff errors.
* calcuations, including roundoff errors.
*/
TclEmitInstInt4(INST_REVERSE, words-1, envPtr);
@@ -4571,7 +4571,7 @@ TclCompileDivOpCmd(
/*
* Reverse order of arguments to get precise agreement with [expr] in
* calculations, including roundoff errors.
* calcuations, including roundoff errors.
*/
TclEmitInstInt4(INST_REVERSE, words-1, envPtr);
+7 -7
View File
@@ -96,7 +96,7 @@ enum OperandTypes {
*
* The lexeme field is filled in with the lexeme of the operator that is
* returned by the ParseLexeme() routine. Only lexemes for unary and binary
* operators get stored in an OpNode. Other lexmes get different treatment.
* operators get stored in an OpNode. Other lexmes get different treatement.
*
* The precedence field provides a place to store the precedence of the
* operator, so it need not be looked up again and again.
@@ -157,7 +157,7 @@ enum Marks {
* BINARY_PLUS according to context. */
#define MINUS 2 /* Ambiguous. Resolves to UNARY_MINUS or
* BINARY_MINUS according to context. */
#define BAREWORD 3 /* Ambiguous. Resolves to BOOLEAN or to
#define BAREWORD 3 /* Ambigous. Resolves to BOOLEAN or to
* FUNCTION or a parse error according to
* context and value. */
#define INCOMPLETE 4 /* A parse error. Used only when the single
@@ -576,7 +576,7 @@ ParseExpr(
* we build the parse tree. */
unsigned int nodesAvailable = 64; /* Initial size of the storage array. This
* value establishes a minimum tree memory
* cost of only about 1 kilobyte, and is large
* cost of only about 1 kibyte, and is large
* enough for most expressions to parse with
* no need for array growth and
* reallocation. */
@@ -1912,7 +1912,7 @@ Tcl_ParseExpr(
* Returns the number of bytes scanned to produce the lexeme.
*
* Side effects:
* Code identifying lexeme parsed is written to *lexemePtr.
* Code identifying lexeme parsed is writen to *lexemePtr.
*
*----------------------------------------------------------------------
*/
@@ -2091,9 +2091,9 @@ ParseLexeme(
if (end < start + numBytes && !TclIsBareword(*end)) {
number:
TclInitStringRep(literal, start, end-start);
*lexemePtr = NUMBER;
if (literalPtr) {
TclInitStringRep(literal, start, end-start);
*literalPtr = literal;
} else {
Tcl_DecrRefCount(literal);
@@ -2165,7 +2165,7 @@ ParseLexeme(
}
*lexemePtr = BAREWORD;
if (literalPtr) {
Tcl_SetStringObj(literal, start, end-start);
Tcl_SetStringObj(literal, start, (int) (end-start));
*literalPtr = literal;
} else {
Tcl_DecrRefCount(literal);
@@ -2565,7 +2565,7 @@ CompileExprTree(
Tcl_Obj *tableValue;
int numBytes;
const char *bytes
= TclGetStringFromObj(objPtr, &numBytes);
= Tcl_GetStringFromObj(objPtr, &numBytes);
idx = TclRegisterLiteral(envPtr, bytes, numBytes, 0);
tableValue = TclFetchLiteral(envPtr, idx);
+3 -3
View File
@@ -2053,7 +2053,7 @@ CompileCommandTokens(
assert (parsePtr->numWords > 0);
/* Precompile */
/* Pre-Compile */
TclNewObj(cmdObj);
envPtr->numCommands++;
@@ -2423,9 +2423,9 @@ TclCompileTokens(
int depth = TclGetStackDepth(envPtr);
/*
* If this is actually a literal, handle continuation lines by
* if this is actually a literal, handle continuation lines by
* preallocating a small table to store the locations of any continuation
* lines found in this literal. The table is extended if needed.
* lines we find in this literal. The table is extended if needed.
*
* Note: In contrast with the analagous code in 'TclSubstTokens()' the
* 'adjust' variable seems unneeded here. The code which merges
+2 -2
View File
@@ -434,7 +434,7 @@ typedef struct ByteCode {
* active. This structure can be freed when
* refCount becomes zero. */
unsigned int flags; /* flags describing state for the codebyte.
* this variable holds OR'ed values from the
* this variable holds ORed values from the
* TCL_BYTECODE_ masks defined above */
const char *source; /* The source string from which this ByteCode
* was compiled. Note that this pointer is not
@@ -1826,7 +1826,7 @@ MODULE_SCOPE void TclDTraceInfo(Tcl_Obj *info, const char **args, int *argsi);
FILE *tclDTraceDebugLog = NULL; \
void TclDTraceOpenDebugLog(void) { \
char n[35]; \
snprintf(n, sizeof(n), "/tmp/tclDTraceDebug-%" TCL_Z_MODIFIER "u.log", \
sprintf(n, "/tmp/tclDTraceDebug-%" TCL_Z_MODIFIER "u.log", \
(size_t) getpid()); \
tclDTraceDebugLog = fopen(n, "a"); \
}
+1 -1
View File
@@ -181,7 +181,7 @@ Tcl_RegisterConfig(
* configuration information embedded into a library.
*
* Results:
* A standard Tcl result.
* A standard tcl result.
*
* Side effects:
* See the manual for what this command does.
+2 -2
View File
@@ -2425,7 +2425,7 @@ static const TABLE TimezoneTable[] = {
{ "ist", tZONE, -HOUR(11/2) }, /* Indian Standard */
{ "zp6", tZONE, -HOUR( 6) }, /* USSR Zone 5 */
#if 0
/* For completeness. NST is also Newfoundland Standard, and SST is
/* For completeness. NST is also Newfoundland Stanard, nad SST is
* also Swedish Summer. */
{ "nst", tZONE, -HOUR(13/2) }, /* North Sumatra */
{ "sst", tZONE, -HOUR( 7) }, /* South Sumatra, USSR Zone 6 */
@@ -2760,7 +2760,7 @@ TclClockOldscanObjCmd(
return TCL_ERROR;
}
yyInput = TclGetString( objv[1] );
yyInput = Tcl_GetString( objv[1] );
dateInfo.dateStart = yyInput;
yyHaveDate = 0;
+82 -90
View File
@@ -1007,7 +1007,7 @@ EXTERN int Tcl_UniCharToTitle(int ch);
/* 323 */
EXTERN int Tcl_UniCharToUpper(int ch);
/* 324 */
EXTERN Tcl_Size Tcl_UniCharToUtf(int ch, char *buf);
EXTERN int Tcl_UniCharToUtf(int ch, char *buf);
/* 325 */
EXTERN const char * Tcl_UtfAtIndex(const char *src, Tcl_Size index);
/* 326 */
@@ -1035,14 +1035,14 @@ EXTERN char * Tcl_UtfToExternalDString(Tcl_Encoding encoding,
const char *src, Tcl_Size srcLen,
Tcl_DString *dsPtr);
/* 334 */
EXTERN Tcl_Size Tcl_UtfToLower(char *src);
EXTERN int Tcl_UtfToLower(char *src);
/* 335 */
EXTERN Tcl_Size Tcl_UtfToTitle(char *src);
EXTERN int Tcl_UtfToTitle(char *src);
/* 336 */
EXTERN Tcl_Size Tcl_UtfToChar16(const char *src,
EXTERN int Tcl_UtfToChar16(const char *src,
unsigned short *chPtr);
/* 337 */
EXTERN Tcl_Size Tcl_UtfToUpper(char *src);
EXTERN int Tcl_UtfToUpper(char *src);
/* 338 */
EXTERN Tcl_Size Tcl_WriteChars(Tcl_Channel chan, const char *src,
Tcl_Size srcLen);
@@ -1924,7 +1924,7 @@ EXTERN int Tcl_GetIntForIndex(Tcl_Interp *interp,
Tcl_Obj *objPtr, Tcl_Size endValue,
Tcl_Size *indexPtr);
/* 646 */
EXTERN Tcl_Size Tcl_UtfToUniChar(const char *src, int *chPtr);
EXTERN int Tcl_UtfToUniChar(const char *src, int *chPtr);
/* 647 */
EXTERN char * Tcl_UniCharToUtfDString(const int *uniStr,
Tcl_Size uniLength, Tcl_DString *dsPtr);
@@ -1936,15 +1936,16 @@ EXTERN unsigned char * TclGetBytesFromObj(Tcl_Interp *interp,
Tcl_Obj *objPtr, int *numBytesPtr);
/* 650 */
EXTERN unsigned char * Tcl_GetBytesFromObj(Tcl_Interp *interp,
Tcl_Obj *objPtr, void *numBytesPtr);
Tcl_Obj *objPtr, size_t *numBytesPtr);
/* 651 */
EXTERN char * TclGetStringFromObj(Tcl_Obj *objPtr, void *lengthPtr);
EXTERN char * TclGetStringFromObj(Tcl_Obj *objPtr,
size_t *lengthPtr);
/* 652 */
EXTERN unsigned short * TclGetUnicodeFromObj(Tcl_Obj *objPtr,
void *lengthPtr);
size_t *lengthPtr);
/* 653 */
EXTERN unsigned char * TclGetByteArrayFromObj(Tcl_Obj *objPtr,
void *numBytesPtr);
size_t *numBytesPtr);
/* 654 */
EXTERN int Tcl_UtfCharComplete(const char *src, Tcl_Size length);
/* 655 */
@@ -1954,42 +1955,39 @@ EXTERN const char * Tcl_UtfPrev(const char *src, const char *start);
/* 657 */
EXTERN int Tcl_UniCharIsUnicode(int ch);
/* 658 */
EXTERN int Tcl_ExternalToUtfDStringEx(Tcl_Interp *interp,
Tcl_Encoding encoding, const char *src,
Tcl_Size srcLen, int flags,
Tcl_DString *dsPtr,
Tcl_Size *errorLocationPtr);
EXTERN Tcl_Size Tcl_ExternalToUtfDStringEx(Tcl_Encoding encoding,
const char *src, Tcl_Size srcLen, int flags,
Tcl_DString *dsPtr);
/* 659 */
EXTERN int Tcl_UtfToExternalDStringEx(Tcl_Interp *interp,
Tcl_Encoding encoding, const char *src,
Tcl_Size srcLen, int flags,
Tcl_DString *dsPtr,
Tcl_Size *errorLocationPtr);
EXTERN Tcl_Size Tcl_UtfToExternalDStringEx(Tcl_Encoding encoding,
const char *src, Tcl_Size srcLen, int flags,
Tcl_DString *dsPtr);
/* 660 */
EXTERN int Tcl_AsyncMarkFromSignal(Tcl_AsyncHandler async,
int sigNumber);
/* 661 */
EXTERN int TclListObjGetElements(Tcl_Interp *interp,
Tcl_Obj *listPtr, void *objcPtr,
Tcl_Obj *listPtr, size_t *objcPtr,
Tcl_Obj ***objvPtr);
/* 662 */
EXTERN int TclListObjLength(Tcl_Interp *interp,
Tcl_Obj *listPtr, void *lengthPtr);
Tcl_Obj *listPtr, size_t *lengthPtr);
/* 663 */
EXTERN int TclDictObjSize(Tcl_Interp *interp, Tcl_Obj *dictPtr,
void *sizePtr);
size_t *sizePtr);
/* 664 */
EXTERN int TclSplitList(Tcl_Interp *interp, const char *listStr,
void *argcPtr, const char ***argvPtr);
size_t *argcPtr, const char ***argvPtr);
/* 665 */
EXTERN void TclSplitPath(const char *path, void *argcPtr,
EXTERN void TclSplitPath(const char *path, size_t *argcPtr,
const char ***argvPtr);
/* 666 */
EXTERN Tcl_Obj * TclFSSplitPath(Tcl_Obj *pathPtr, void *lenPtr);
EXTERN Tcl_Obj * TclFSSplitPath(Tcl_Obj *pathPtr, size_t *lenPtr);
/* 667 */
EXTERN int TclParseArgsObjv(Tcl_Interp *interp,
const Tcl_ArgvInfo *argTable, void *objcPtr,
Tcl_Obj *const *objv, Tcl_Obj ***remObjv);
const Tcl_ArgvInfo *argTable,
size_t *objcPtr, Tcl_Obj *const *objv,
Tcl_Obj ***remObjv);
/* 668 */
EXTERN Tcl_Size Tcl_UniCharLen(const int *uniStr);
/* 669 */
@@ -2028,14 +2026,14 @@ EXTERN Tcl_Command Tcl_NRCreateCommand2(Tcl_Interp *interp,
/* 679 */
EXTERN int Tcl_NRCallObjProc2(Tcl_Interp *interp,
Tcl_ObjCmdProc2 *objProc2, void *clientData,
ptrdiff_t objc, Tcl_Obj *const objv[]);
size_t objc, Tcl_Obj *const objv[]);
/* 680 */
EXTERN int Tcl_GetNumberFromObj(Tcl_Interp *interp,
Tcl_Obj *objPtr, void **clientDataPtr,
int *typePtr);
/* 681 */
EXTERN int Tcl_GetNumber(Tcl_Interp *interp, const char *bytes,
ptrdiff_t numBytes, void **clientDataPtr,
size_t numBytes, void **clientDataPtr,
int *typePtr);
/* 682 */
EXTERN int Tcl_RemoveChannelMode(Tcl_Interp *interp,
@@ -2048,8 +2046,7 @@ EXTERN int Tcl_GetWideUIntFromObj(Tcl_Interp *interp,
/* 685 */
EXTERN Tcl_Obj * Tcl_DStringToObj(Tcl_DString *dsPtr);
/* Slot 686 is reserved */
/* Slot 687 is reserved */
/* 688 */
/* 687 */
EXTERN void TclUnusedStubEntry(void);
typedef struct {
@@ -2410,7 +2407,7 @@ typedef struct TclStubs {
int (*tcl_UniCharToLower) (int ch); /* 321 */
int (*tcl_UniCharToTitle) (int ch); /* 322 */
int (*tcl_UniCharToUpper) (int ch); /* 323 */
Tcl_Size (*tcl_UniCharToUtf) (int ch, char *buf); /* 324 */
int (*tcl_UniCharToUtf) (int ch, char *buf); /* 324 */
const char * (*tcl_UtfAtIndex) (const char *src, Tcl_Size index); /* 325 */
int (*tclUtfCharComplete) (const char *src, Tcl_Size length); /* 326 */
Tcl_Size (*tcl_UtfBackslash) (const char *src, int *readPtr, char *dst); /* 327 */
@@ -2420,10 +2417,10 @@ typedef struct TclStubs {
const char * (*tclUtfPrev) (const char *src, const char *start); /* 331 */
int (*tcl_UtfToExternal) (Tcl_Interp *interp, Tcl_Encoding encoding, const char *src, Tcl_Size srcLen, int flags, Tcl_EncodingState *statePtr, char *dst, Tcl_Size dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr); /* 332 */
char * (*tcl_UtfToExternalDString) (Tcl_Encoding encoding, const char *src, Tcl_Size srcLen, Tcl_DString *dsPtr); /* 333 */
Tcl_Size (*tcl_UtfToLower) (char *src); /* 334 */
Tcl_Size (*tcl_UtfToTitle) (char *src); /* 335 */
Tcl_Size (*tcl_UtfToChar16) (const char *src, unsigned short *chPtr); /* 336 */
Tcl_Size (*tcl_UtfToUpper) (char *src); /* 337 */
int (*tcl_UtfToLower) (char *src); /* 334 */
int (*tcl_UtfToTitle) (char *src); /* 335 */
int (*tcl_UtfToChar16) (const char *src, unsigned short *chPtr); /* 336 */
int (*tcl_UtfToUpper) (char *src); /* 337 */
Tcl_Size (*tcl_WriteChars) (Tcl_Channel chan, const char *src, Tcl_Size srcLen); /* 338 */
Tcl_Size (*tcl_WriteObj) (Tcl_Channel chan, Tcl_Obj *objPtr); /* 339 */
char * (*tcl_GetString) (Tcl_Obj *objPtr); /* 340 */
@@ -2732,28 +2729,28 @@ typedef struct TclStubs {
int (*tcl_IsShared) (Tcl_Obj *objPtr); /* 643 */
int (*tcl_LinkArray) (Tcl_Interp *interp, const char *varName, void *addr, int type, Tcl_Size size); /* 644 */
int (*tcl_GetIntForIndex) (Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_Size endValue, Tcl_Size *indexPtr); /* 645 */
Tcl_Size (*tcl_UtfToUniChar) (const char *src, int *chPtr); /* 646 */
int (*tcl_UtfToUniChar) (const char *src, int *chPtr); /* 646 */
char * (*tcl_UniCharToUtfDString) (const int *uniStr, Tcl_Size uniLength, Tcl_DString *dsPtr); /* 647 */
int * (*tcl_UtfToUniCharDString) (const char *src, Tcl_Size length, Tcl_DString *dsPtr); /* 648 */
unsigned char * (*tclGetBytesFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *numBytesPtr); /* 649 */
unsigned char * (*tcl_GetBytesFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, void *numBytesPtr); /* 650 */
char * (*tclGetStringFromObj) (Tcl_Obj *objPtr, void *lengthPtr); /* 651 */
unsigned short * (*tclGetUnicodeFromObj) (Tcl_Obj *objPtr, void *lengthPtr); /* 652 */
unsigned char * (*tclGetByteArrayFromObj) (Tcl_Obj *objPtr, void *numBytesPtr); /* 653 */
unsigned char * (*tcl_GetBytesFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, size_t *numBytesPtr); /* 650 */
char * (*tclGetStringFromObj) (Tcl_Obj *objPtr, size_t *lengthPtr); /* 651 */
unsigned short * (*tclGetUnicodeFromObj) (Tcl_Obj *objPtr, size_t *lengthPtr); /* 652 */
unsigned char * (*tclGetByteArrayFromObj) (Tcl_Obj *objPtr, size_t *numBytesPtr); /* 653 */
int (*tcl_UtfCharComplete) (const char *src, Tcl_Size length); /* 654 */
const char * (*tcl_UtfNext) (const char *src); /* 655 */
const char * (*tcl_UtfPrev) (const char *src, const char *start); /* 656 */
int (*tcl_UniCharIsUnicode) (int ch); /* 657 */
int (*tcl_ExternalToUtfDStringEx) (Tcl_Interp *interp, Tcl_Encoding encoding, const char *src, Tcl_Size srcLen, int flags, Tcl_DString *dsPtr, Tcl_Size *errorLocationPtr); /* 658 */
int (*tcl_UtfToExternalDStringEx) (Tcl_Interp *interp, Tcl_Encoding encoding, const char *src, Tcl_Size srcLen, int flags, Tcl_DString *dsPtr, Tcl_Size *errorLocationPtr); /* 659 */
Tcl_Size (*tcl_ExternalToUtfDStringEx) (Tcl_Encoding encoding, const char *src, Tcl_Size srcLen, int flags, Tcl_DString *dsPtr); /* 658 */
Tcl_Size (*tcl_UtfToExternalDStringEx) (Tcl_Encoding encoding, const char *src, Tcl_Size srcLen, int flags, Tcl_DString *dsPtr); /* 659 */
int (*tcl_AsyncMarkFromSignal) (Tcl_AsyncHandler async, int sigNumber); /* 660 */
int (*tclListObjGetElements) (Tcl_Interp *interp, Tcl_Obj *listPtr, void *objcPtr, Tcl_Obj ***objvPtr); /* 661 */
int (*tclListObjLength) (Tcl_Interp *interp, Tcl_Obj *listPtr, void *lengthPtr); /* 662 */
int (*tclDictObjSize) (Tcl_Interp *interp, Tcl_Obj *dictPtr, void *sizePtr); /* 663 */
int (*tclSplitList) (Tcl_Interp *interp, const char *listStr, void *argcPtr, const char ***argvPtr); /* 664 */
void (*tclSplitPath) (const char *path, void *argcPtr, const char ***argvPtr); /* 665 */
Tcl_Obj * (*tclFSSplitPath) (Tcl_Obj *pathPtr, void *lenPtr); /* 666 */
int (*tclParseArgsObjv) (Tcl_Interp *interp, const Tcl_ArgvInfo *argTable, void *objcPtr, Tcl_Obj *const *objv, Tcl_Obj ***remObjv); /* 667 */
int (*tclListObjGetElements) (Tcl_Interp *interp, Tcl_Obj *listPtr, size_t *objcPtr, Tcl_Obj ***objvPtr); /* 661 */
int (*tclListObjLength) (Tcl_Interp *interp, Tcl_Obj *listPtr, size_t *lengthPtr); /* 662 */
int (*tclDictObjSize) (Tcl_Interp *interp, Tcl_Obj *dictPtr, size_t *sizePtr); /* 663 */
int (*tclSplitList) (Tcl_Interp *interp, const char *listStr, size_t *argcPtr, const char ***argvPtr); /* 664 */
void (*tclSplitPath) (const char *path, size_t *argcPtr, const char ***argvPtr); /* 665 */
Tcl_Obj * (*tclFSSplitPath) (Tcl_Obj *pathPtr, size_t *lenPtr); /* 666 */
int (*tclParseArgsObjv) (Tcl_Interp *interp, const Tcl_ArgvInfo *argTable, size_t *objcPtr, Tcl_Obj *const *objv, Tcl_Obj ***remObjv); /* 667 */
Tcl_Size (*tcl_UniCharLen) (const int *uniStr); /* 668 */
Tcl_Size (*tclNumUtfChars) (const char *src, Tcl_Size length); /* 669 */
Tcl_Size (*tclGetCharLength) (Tcl_Obj *objPtr); /* 670 */
@@ -2765,16 +2762,15 @@ typedef struct TclStubs {
Tcl_Command (*tcl_CreateObjCommand2) (Tcl_Interp *interp, const char *cmdName, Tcl_ObjCmdProc2 *proc2, void *clientData, Tcl_CmdDeleteProc *deleteProc); /* 676 */
Tcl_Trace (*tcl_CreateObjTrace2) (Tcl_Interp *interp, Tcl_Size level, int flags, Tcl_CmdObjTraceProc2 *objProc2, void *clientData, Tcl_CmdObjTraceDeleteProc *delProc); /* 677 */
Tcl_Command (*tcl_NRCreateCommand2) (Tcl_Interp *interp, const char *cmdName, Tcl_ObjCmdProc2 *proc, Tcl_ObjCmdProc2 *nreProc2, void *clientData, Tcl_CmdDeleteProc *deleteProc); /* 678 */
int (*tcl_NRCallObjProc2) (Tcl_Interp *interp, Tcl_ObjCmdProc2 *objProc2, void *clientData, ptrdiff_t objc, Tcl_Obj *const objv[]); /* 679 */
int (*tcl_NRCallObjProc2) (Tcl_Interp *interp, Tcl_ObjCmdProc2 *objProc2, void *clientData, size_t objc, Tcl_Obj *const objv[]); /* 679 */
int (*tcl_GetNumberFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, void **clientDataPtr, int *typePtr); /* 680 */
int (*tcl_GetNumber) (Tcl_Interp *interp, const char *bytes, ptrdiff_t numBytes, void **clientDataPtr, int *typePtr); /* 681 */
int (*tcl_GetNumber) (Tcl_Interp *interp, const char *bytes, size_t numBytes, void **clientDataPtr, int *typePtr); /* 681 */
int (*tcl_RemoveChannelMode) (Tcl_Interp *interp, Tcl_Channel chan, int mode); /* 682 */
Tcl_Size (*tcl_GetEncodingNulLength) (Tcl_Encoding encoding); /* 683 */
int (*tcl_GetWideUIntFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_WideUInt *uwidePtr); /* 684 */
Tcl_Obj * (*tcl_DStringToObj) (Tcl_DString *dsPtr); /* 685 */
void (*reserved686)(void);
void (*reserved687)(void);
void (*tclUnusedStubEntry) (void); /* 688 */
void (*tclUnusedStubEntry) (void); /* 687 */
} TclStubs;
extern const TclStubs *tclStubsPtr;
@@ -4178,9 +4174,8 @@ extern const TclStubs *tclStubsPtr;
#define Tcl_DStringToObj \
(tclStubsPtr->tcl_DStringToObj) /* 685 */
/* Slot 686 is reserved */
/* Slot 687 is reserved */
#define TclUnusedStubEntry \
(tclStubsPtr->tclUnusedStubEntry) /* 688 */
(tclStubsPtr->tclUnusedStubEntry) /* 687 */
#endif /* defined(USE_TCL_STUBS) */
@@ -4212,7 +4207,7 @@ extern const TclStubs *tclStubsPtr;
# define Tcl_SetPanicProc(arg) ((void)((Tcl_SetPanicProc)(arg)))
# endif
# define Tcl_MainEx Tcl_MainExW
EXTERN void Tcl_MainExW(Tcl_Size argc, wchar_t **argv,
EXTERN void Tcl_MainExW(int argc, wchar_t **argv,
Tcl_AppInitProc *appInitProc, Tcl_Interp *interp);
#elif !defined(TCL_NO_DEPRECATED)
# define Tcl_FindExecutable(arg) ((void)((Tcl_FindExecutable)(arg)))
@@ -4322,14 +4317,14 @@ extern const TclStubs *tclStubsPtr;
/* Handle Win64 tk.dll being loaded in Cygwin64. */
# define Tcl_GetTime(t) \
do { \
struct { \
union { \
Tcl_Time now; \
long long reserved; \
} _t; \
_t.reserved = -1; \
tclStubsPtr->tcl_GetTime((&_t.now)); \
if (_t.reserved != -1) { \
_t.now.usec = (long) _t.reserved; \
_t.now.usec = _t.reserved; \
} \
*(t) = _t.now; \
} while (0)
@@ -4367,11 +4362,11 @@ extern const TclStubs *tclStubsPtr;
# 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))(void *)tclStubsPtr->tcl_UtfNcmp)(s1,s2,(unsigned int)(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))(void *)tclStubsPtr->tcl_UtfNcasecmp)(s1,s2,(unsigned int)(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))(void *)tclStubsPtr->tcl_UniCharNcasecmp)(ucs,uct,(unsigned int)(n))
((int(*)(const Tcl_UniChar*,const Tcl_UniChar*,unsigned int))tclStubsPtr->tcl_UniCharNcasecmp)(ucs,uct,(unsigned int)(n))
# endif
#endif
@@ -4392,7 +4387,7 @@ extern const TclStubs *tclStubsPtr;
#endif
#if defined(USE_TCL_STUBS)
#define Tcl_GetBytesFromObj(interp, objPtr, sizePtr) \
(sizeof(*(sizePtr)) <= sizeof(int) ? tclStubsPtr->tclGetBytesFromObj(interp, objPtr, (int *)(sizePtr)) : tclStubsPtr->tcl_GetBytesFromObj(interp, objPtr, (sizePtr)))
(sizeof(*(sizePtr)) <= sizeof(int) ? tclStubsPtr->tclGetBytesFromObj(interp, objPtr, (int *)(sizePtr)) : tclStubsPtr->tcl_GetBytesFromObj(interp, objPtr, (size_t *)(sizePtr)))
#define Tcl_GetIndexFromObjStruct(interp, objPtr, tablePtr, offset, msg, flags, indexPtr) \
(tclStubsPtr->tcl_GetIndexFromObjStruct((interp), (objPtr), (tablePtr), (offset), (msg), (flags)|(int)(sizeof(*(indexPtr))<<1), (indexPtr)))
#define Tcl_GetBooleanFromObj(interp, objPtr, boolPtr) \
@@ -4403,15 +4398,15 @@ extern const TclStubs *tclStubsPtr;
Tcl_GetBool(interp, src, (TCL_NULL_OK-2)&(int)sizeof((*(boolPtr))), (char *)(boolPtr)))
#ifdef TCL_NO_DEPRECATED
#define Tcl_GetStringFromObj(objPtr, sizePtr) \
(sizeof(*(sizePtr)) <= sizeof(int) ? tclStubsPtr->tcl_GetStringFromObj(objPtr, (int *)(sizePtr)) : tclStubsPtr->tclGetStringFromObj(objPtr, (sizePtr)))
(sizeof(*(sizePtr)) <= sizeof(int) ? tclStubsPtr->tcl_GetStringFromObj(objPtr, (int *)(sizePtr)) : tclStubsPtr->tclGetStringFromObj(objPtr, (size_t *)(sizePtr)))
#define Tcl_GetByteArrayFromObj(objPtr, sizePtr) \
(sizeof(*(sizePtr)) <= sizeof(int) ? tclStubsPtr->tcl_GetByteArrayFromObj(objPtr, (int *)(sizePtr)) : tclStubsPtr->tclGetByteArrayFromObj(objPtr, (sizePtr)))
(sizeof(*(sizePtr)) <= sizeof(int) ? tclStubsPtr->tcl_GetByteArrayFromObj(objPtr, (int *)(sizePtr)) : tclStubsPtr->tclGetByteArrayFromObj(objPtr, (size_t *)(sizePtr)))
#define Tcl_GetUnicodeFromObj(objPtr, sizePtr) \
(sizeof(*(sizePtr)) <= sizeof(int) ? tclStubsPtr->tcl_GetUnicodeFromObj(objPtr, (int *)(sizePtr)) : tclStubsPtr->tclGetUnicodeFromObj(objPtr, (sizePtr)))
(sizeof(*(sizePtr)) <= sizeof(int) ? tclStubsPtr->tcl_GetUnicodeFromObj(objPtr, (int *)(sizePtr)) : tclStubsPtr->tclGetUnicodeFromObj(objPtr, (size_t *)(sizePtr)))
#endif
#else
#define Tcl_GetBytesFromObj(interp, objPtr, sizePtr) \
(sizeof(*(sizePtr)) <= sizeof(int) ? (TclGetBytesFromObj)(interp, objPtr, (int *)(sizePtr)) : (Tcl_GetBytesFromObj)(interp, objPtr, (sizePtr)))
(sizeof(*(sizePtr)) <= sizeof(int) ? (TclGetBytesFromObj)(interp, objPtr, (int *)(sizePtr)) : (Tcl_GetBytesFromObj)(interp, objPtr, (size_t *)(sizePtr)))
#define Tcl_GetIndexFromObjStruct(interp, objPtr, tablePtr, offset, msg, flags, indexPtr) \
((Tcl_GetIndexFromObjStruct)((interp), (objPtr), (tablePtr), (offset), (msg), (flags)|(int)(sizeof(*(indexPtr))<<1), (indexPtr)))
#define Tcl_GetBooleanFromObj(interp, objPtr, boolPtr) \
@@ -4422,11 +4417,11 @@ extern const TclStubs *tclStubsPtr;
Tcl_GetBool(interp, src, (TCL_NULL_OK-2)&(int)sizeof((*(boolPtr))), (char *)(boolPtr)))
#ifdef TCL_NO_DEPRECATED
#define Tcl_GetStringFromObj(objPtr, sizePtr) \
(sizeof(*(sizePtr)) <= sizeof(int) ? (Tcl_GetStringFromObj)(objPtr, (int *)(sizePtr)) : (TclGetStringFromObj)(objPtr, (sizePtr)))
(sizeof(*(sizePtr)) <= sizeof(int) ? (Tcl_GetStringFromObj)(objPtr, (int *)(sizePtr)) : (TclGetStringFromObj)(objPtr, (size_t *)(sizePtr)))
#define Tcl_GetByteArrayFromObj(objPtr, sizePtr) \
(sizeof(*(sizePtr)) <= sizeof(int) ? (Tcl_GetByteArrayFromObj)(objPtr, (int *)(sizePtr)) : TclGetByteArrayFromObj(objPtr, (sizePtr)))
(sizeof(*(sizePtr)) <= sizeof(int) ? (Tcl_GetByteArrayFromObj)(objPtr, (int *)(sizePtr)) : TclGetByteArrayFromObj(objPtr, (size_t *)(sizePtr)))
#define Tcl_GetUnicodeFromObj(objPtr, sizePtr) \
(sizeof(*(sizePtr)) <= sizeof(int) ? (Tcl_GetUnicodeFromObj)(objPtr, (int *)(sizePtr)) : TclGetUnicodeFromObj(objPtr, (sizePtr)))
(sizeof(*(sizePtr)) <= sizeof(int) ? (Tcl_GetUnicodeFromObj)(objPtr, (int *)(sizePtr)) : TclGetUnicodeFromObj(objPtr, (size_t *)(sizePtr)))
#endif
#endif
@@ -4483,33 +4478,33 @@ extern const TclStubs *tclStubsPtr;
# undef Tcl_ListObjGetElements
# define Tcl_ListObjGetElements(interp, listPtr, objcPtr, objvPtr) (sizeof(*(objcPtr)) == sizeof(int) \
? tclStubsPtr->tcl_ListObjGetElements((interp), (listPtr), (int *)(void *)(objcPtr), (objvPtr)) \
: tclStubsPtr->tclListObjGetElements((interp), (listPtr), (objcPtr), (objvPtr)))
: tclStubsPtr->tclListObjGetElements((interp), (listPtr), (size_t *)(void *)(objcPtr), (objvPtr)))
# undef Tcl_ListObjLength
# define Tcl_ListObjLength(interp, listPtr, lengthPtr) (sizeof(*(lengthPtr)) == sizeof(int) \
? tclStubsPtr->tcl_ListObjLength((interp), (listPtr), (int *)(void *)(lengthPtr)) \
: tclStubsPtr->tclListObjLength((interp), (listPtr), (lengthPtr)))
: tclStubsPtr->tclListObjLength((interp), (listPtr), (size_t *)(void *)(lengthPtr)))
# undef Tcl_DictObjSize
# define Tcl_DictObjSize(interp, dictPtr, sizePtr) (sizeof(*(sizePtr)) == sizeof(int) \
? tclStubsPtr->tcl_DictObjSize((interp), (dictPtr), (int *)(void *)(sizePtr)) \
: tclStubsPtr->tclDictObjSize((interp), (dictPtr), (sizePtr)))
: tclStubsPtr->tclDictObjSize((interp), (dictPtr), (size_t *)(void *)(sizePtr)))
# undef Tcl_SplitList
# define Tcl_SplitList(interp, listStr, argcPtr, argvPtr) (sizeof(*(argcPtr)) == sizeof(int) \
? tclStubsPtr->tcl_SplitList((interp), (listStr), (int *)(void *)(argcPtr), (argvPtr)) \
: tclStubsPtr->tclSplitList((interp), (listStr), (argcPtr), (argvPtr)))
: tclStubsPtr->tclSplitList((interp), (listStr), (size_t *)(void *)(argcPtr), (argvPtr)))
# undef Tcl_SplitPath
# define Tcl_SplitPath(path, argcPtr, argvPtr) (sizeof(*(argcPtr)) == sizeof(int) \
? tclStubsPtr->tcl_SplitPath((path), (int *)(void *)(argcPtr), (argvPtr)) \
: tclStubsPtr->tclSplitPath((path), (argcPtr), (argvPtr)))
: tclStubsPtr->tclSplitPath((path), (size_t *)(void *)(argcPtr), (argvPtr)))
# undef Tcl_FSSplitPath
# define Tcl_FSSplitPath(pathPtr, lenPtr) (sizeof(*(lenPtr)) == sizeof(int) \
? tclStubsPtr->tcl_FSSplitPath((pathPtr), (int *)(void *)(lenPtr)) \
: tclStubsPtr->tclFSSplitPath((pathPtr), (lenPtr)))
: tclStubsPtr->tclFSSplitPath((pathPtr), (size_t *)(void *)(lenPtr)))
# undef Tcl_ParseArgsObjv
# define Tcl_ParseArgsObjv(interp, argTable, objcPtr, objv, remObjv) (sizeof(*(objcPtr)) == sizeof(int) \
? tclStubsPtr->tcl_ParseArgsObjv((interp), (argTable), (int *)(void *)(objcPtr), (objv), (remObjv)) \
: tclStubsPtr->tclParseArgsObjv((interp), (argTable), (objcPtr), (objv), (remObjv)))
: tclStubsPtr->tclParseArgsObjv((interp), (argTable), (size_t *)(void *)(objcPtr), (objv), (remObjv)))
#endif /* TCL_NO_DEPRECATED */
#else /* !defined(USE_TCL_STUBS) */
#else
# define Tcl_WCharToUtfDString (sizeof(wchar_t) != sizeof(short) \
? (char *(*)(const wchar_t *, Tcl_Size, Tcl_DString *))Tcl_UniCharToUtfDString \
: (char *(*)(const wchar_t *, Tcl_Size, Tcl_DString *))Tcl_Char16ToUtfDString)
@@ -4525,27 +4520,27 @@ extern const TclStubs *tclStubsPtr;
#ifdef TCL_NO_DEPRECATED
# define Tcl_ListObjGetElements(interp, listPtr, objcPtr, objvPtr) (sizeof(*(objcPtr)) == sizeof(int) \
? (Tcl_ListObjGetElements)((interp), (listPtr), (int *)(void *)(objcPtr), (objvPtr)) \
: TclListObjGetElements((interp), (listPtr), (objcPtr), (objvPtr)))
: TclListObjGetElements((interp), (listPtr), (size_t *)(void *)(objcPtr), (objvPtr)))
# define Tcl_ListObjLength(interp, listPtr, lengthPtr) (sizeof(*(lengthPtr)) == sizeof(int) \
? (Tcl_ListObjLength)((interp), (listPtr), (int *)(void *)(lengthPtr)) \
: TclListObjLength((interp), (listPtr), (lengthPtr)))
: TclListObjLength((interp), (listPtr), (size_t *)(void *)(lengthPtr)))
# define Tcl_DictObjSize(interp, dictPtr, sizePtr) (sizeof(*(sizePtr)) == sizeof(int) \
? (Tcl_DictObjSize)((interp), (dictPtr), (int *)(void *)(sizePtr)) \
: TclDictObjSize((interp), (dictPtr), (sizePtr)))
: TclDictObjSize((interp), (dictPtr), (size_t *)(void *)(sizePtr)))
# define Tcl_SplitList(interp, listStr, argcPtr, argvPtr) (sizeof(*(argcPtr)) == sizeof(int) \
? (Tcl_SplitList)((interp), (listStr), (int *)(void *)(argcPtr), (argvPtr)) \
: TclSplitList((interp), (listStr), (argcPtr), (argvPtr)))
: TclSplitList((interp), (listStr), (size_t *)(void *)(argcPtr), (argvPtr)))
# define Tcl_SplitPath(path, argcPtr, argvPtr) (sizeof(*(argcPtr)) == sizeof(int) \
? (Tcl_SplitPath)((path), (int *)(void *)(argcPtr), (argvPtr)) \
: TclSplitPath((path), (argcPtr), (argvPtr)))
: TclSplitPath((path), (size_t *)(void *)(argcPtr), (argvPtr)))
# define Tcl_FSSplitPath(pathPtr, lenPtr) (sizeof(*(lenPtr)) == sizeof(int) \
? (Tcl_FSSplitPath)((pathPtr), (int *)(void *)(lenPtr)) \
: TclFSSplitPath((pathPtr), (lenPtr)))
: TclFSSplitPath((pathPtr), (size_t *)(void *)(lenPtr)))
# define Tcl_ParseArgsObjv(interp, argTable, objcPtr, objv, remObjv) (sizeof(*(objcPtr)) == sizeof(int) \
? (Tcl_ParseArgsObjv)((interp), (argTable), (int *)(void *)(objcPtr), (objv), (remObjv)) \
: TclParseArgsObjv((interp), (argTable), (objcPtr), (objv), (remObjv)))
: TclParseArgsObjv((interp), (argTable), (size_t *)(void *)(objcPtr), (objv), (remObjv)))
#endif /* TCL_NO_DEPRECATED */
#endif /* defined(USE_TCL_STUBS) */
#endif
/*
* Deprecated Tcl procedures:
@@ -4581,7 +4576,4 @@ extern const TclStubs *tclStubsPtr;
#define Tcl_GetSlave Tcl_GetChild
#define Tcl_GetMaster Tcl_GetParent
/* TIP #660 */
#define Tcl_GetSizeIntFromObj Tcl_GetIntFromObj
#endif /* _TCLDECLS */
+8 -8
View File
@@ -635,7 +635,7 @@ SetDictFromAny(
* convert back.
*/
(void) TclGetString(objPtr);
(void) Tcl_GetString(objPtr);
TclDecrRefCount(discardedValue);
}
@@ -778,7 +778,7 @@ GetDictFromObj(
* the chain fields of the dictionaries (for easy invalidation of string
* representations using InvalidateDictChain). If the flags argument has
* the DICT_PATH_CREATE bits set (and not the DICT_PATH_EXISTS bit),
* non-extant keys will be inserted with a value of an empty
* non-existant keys will be inserted with a value of an empty
* dictionary, resulting in the path being built.
*
*----------------------------------------------------------------------
@@ -871,7 +871,7 @@ TclTraceDictPath(
*
* InvalidateDictChain --
*
* Go through a dictionary chain (built by an updating invocation of
* Go through a dictionary chain (built by an updating invokation of
* TclTraceDictPath) and invalidate the string representations of all the
* dictionaries on the chain.
*
@@ -1197,7 +1197,7 @@ Tcl_DictObjNext(
ChainEntry *cPtr;
/*
* If the search is done; we do no work.
* If the searh is done; we do no work.
*/
if (!searchPtr->epoch) {
@@ -3308,7 +3308,7 @@ DictUpdateCmd(
}
if (objPtr == NULL) {
/* ??? */
Tcl_UnsetVar2(interp, TclGetString(objv[i+1]), NULL, 0);
Tcl_UnsetVar2(interp, Tcl_GetString(objv[i+1]), NULL, 0);
} else if (Tcl_ObjSetVar2(interp, objv[i+1], NULL, objPtr,
TCL_LEAVE_ERR_MSG) == NULL) {
TclDecrRefCount(dictPtr);
@@ -3683,9 +3683,9 @@ TclDictWithFinish(
if (pathc > 0) {
/*
* Want to get to the dictionary which we will update; need to do
* prepare-for-update unsharing along the path *but* avoid generating
* an error on a non-extant path (we'll treat that the same as a
* non-extant variable. Luckily, the unsharing operation isn't
* prepare-for-update de-sharing along the path *but* avoid generating
* an error on a non-existant path (we'll treat that the same as a
* non-existant variable. Luckily, the de-sharing operation isn't
* deeply damaging if we don't go on to update; it's just less than
* perfectly efficient (but no memory should be leaked).
*/
+8 -8
View File
@@ -286,7 +286,7 @@ DisassembleByteCodeObj(
GetLocationInformation(codePtr->procPtr, &fileObj, &line);
if (line >= 0 && fileObj != NULL) {
Tcl_AppendPrintfToObj(bufferObj, "\n File \"%s\" Line %d",
TclGetString(fileObj), line);
Tcl_GetString(fileObj), line);
}
Tcl_AppendPrintfToObj(bufferObj,
"\n Cmds %d, src %d, inst %d, litObjs %u, aux %d, stkDepth %u, code/src %.2f\n",
@@ -571,22 +571,22 @@ FormatInstruction(
case OPERAND_UINT4:
opnd = TclGetUInt4AtPtr(pc+numBytes); numBytes += 4;
if (opCode == INST_START_CMD) {
snprintf(suffixBuffer+strlen(suffixBuffer), sizeof(suffixBuffer) - strlen(suffixBuffer),
sprintf(suffixBuffer+strlen(suffixBuffer),
", %u cmds start here", opnd);
}
Tcl_AppendPrintfToObj(bufferObj, "%u ", (unsigned) opnd);
break;
case OPERAND_OFFSET1:
opnd = TclGetInt1AtPtr(pc+numBytes); numBytes++;
snprintf(suffixBuffer, sizeof(suffixBuffer), "pc %u", pcOffset+opnd);
sprintf(suffixBuffer, "pc %u", pcOffset+opnd);
Tcl_AppendPrintfToObj(bufferObj, "%+d ", opnd);
break;
case OPERAND_OFFSET4:
opnd = TclGetInt4AtPtr(pc+numBytes); numBytes += 4;
if (opCode == INST_START_CMD) {
snprintf(suffixBuffer, sizeof(suffixBuffer), "next cmd at pc %u", pcOffset+opnd);
sprintf(suffixBuffer, "next cmd at pc %u", pcOffset+opnd);
} else {
snprintf(suffixBuffer, sizeof(suffixBuffer), "pc %u", pcOffset+opnd);
sprintf(suffixBuffer, "pc %u", pcOffset+opnd);
}
Tcl_AppendPrintfToObj(bufferObj, "%+d ", opnd);
break;
@@ -632,9 +632,9 @@ FormatInstruction(
localPtr = localPtr->nextPtr;
}
if (TclIsVarTemporary(localPtr)) {
snprintf(suffixBuffer, sizeof(suffixBuffer), "temp var %u", (unsigned) opnd);
sprintf(suffixBuffer, "temp var %u", (unsigned) opnd);
} else {
snprintf(suffixBuffer, sizeof(suffixBuffer), "var ");
sprintf(suffixBuffer, "var ");
suffixSrc = localPtr->name;
}
}
@@ -836,7 +836,7 @@ UpdateStringOfInstName(
if (inst > LAST_INST_OPCODE) {
dst = Tcl_InitStringRep(objPtr, NULL, TCL_INTEGER_SPACE + 5);
TclOOM(dst, TCL_INTEGER_SPACE + 5);
snprintf(dst, TCL_INTEGER_SPACE + 5, "inst_%" TCL_Z_MODIFIER "u", inst);
sprintf(dst, "inst_%" TCL_Z_MODIFIER "u", inst);
(void) Tcl_InitStringRep(objPtr, NULL, strlen(dst));
} else {
const char *s = tclInstructionTable[inst].name;
+190 -696
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1888,7 +1888,7 @@ NsEnsembleImplementationCmdNR(
*
* ((Q: That's not true if the -map option is used, is it?))
*
* but don't do that because caching of the command object should help.
* but don't do that because cacheing of the command object should help.
*/
{
+1 -1
View File
@@ -411,7 +411,7 @@ Tcl_PutEnv(
}
/*
* First convert the native string to Utf. Then separate the string into
* First convert the native string to UTF. Then separate the string into
* name and value parts, and call TclSetEnv to do all of the real work.
*/
+4 -4
View File
@@ -599,7 +599,7 @@ TclGetBgErrorHandler(
*
* This function is associated with the "tclBgError" assoc data for an
* interpreter; it is invoked when the interpreter is deleted in order to
* free the information associated with any pending error reports.
* free the information assoicated with any pending error reports.
*
* Results:
* None.
@@ -967,7 +967,7 @@ Tcl_Exit(
/*
* Warning: this function SHOULD NOT return, as there is code that depends
* on Tcl_Exit never returning. In fact, we will Tcl_Panic if anyone
* returns, so critical is this dependency.
* returns, so critical is this dependcy.
*
* If subsystems are not (yet) initialized, proper Tcl-finalization is
* impossible, so fallback to system exit, see bug-[f8a33ce3db5d8cc2].
@@ -1132,7 +1132,7 @@ Tcl_InitSubsystems(void)
if (subsystemsInitialized == 0) {
/*
* Double check inside the mutex. There are definitely calls back into
* Double check inside the mutex. There are definitly calls back into
* this routine from some of the functions below.
*/
@@ -1522,7 +1522,7 @@ Tcl_VwaitObjCmd(
OPT_TIMEOUT, OPT_VARIABLE, OPT_WRITABLE, OPT_LAST
} index;
if ((objc == 2) && (strcmp(TclGetString(objv[1]), "--") != 0)) {
if ((objc == 2) && (strcmp(Tcl_GetString(objv[1]), "--") != 0)) {
/*
* Legacy "vwait" syntax, skip option handling.
*/
+19 -15
View File
@@ -1690,7 +1690,7 @@ TclCompileObj(
* Future optimizations ...
* (1) Save the location data (ExtCmdLoc) keyed by start line. In that
* case we recompile once per location of the literal, but not
* continuously, because the moment we have all locations we do not
* continously, because the moment we have all locations we do not
* need to recompile any longer.
*
* (2) Alternative: Do not recompile, tell the execution engine the
@@ -1788,7 +1788,7 @@ TclCompileObj(
*
* TclIncrObj --
*
* Increment an integral value in a Tcl_Obj by an integral value held
* Increment an integeral value in a Tcl_Obj by an integeral value held
* in another Tcl_Obj. Caller is responsible for making sure we can
* update the first object.
*
@@ -1798,7 +1798,7 @@ TclCompileObj(
* of course).
*
* Side effects:
* valuePtr gets the new incremented value.
* valuePtr gets the new incrmented value.
*
*----------------------------------------------------------------------
*/
@@ -2503,8 +2503,8 @@ TEBCresume(
* 'yieldParameter').
*/
iPtr->execEnvPtr = corPtr->callerEEPtr;
Tcl_IncrRefCount(valuePtr);
iPtr->execEnvPtr = corPtr->callerEEPtr;
TclSetTailcall(interp, valuePtr);
corPtr->yieldPtr = valuePtr;
iPtr->execEnvPtr = corPtr->eePtr;
@@ -3585,8 +3585,10 @@ TEBCresume(
}
}
DECACHE_STACK_INFO();
Tcl_IncrRefCount(valueToAssign);
objResultPtr = TclPtrSetVarIdx(interp, varPtr, arrayPtr, part1Ptr,
part2Ptr, valueToAssign, TCL_LEAVE_ERR_MSG, opnd);
TclDecrRefCount(valueToAssign);
CACHE_STACK_INFO();
if (!objResultPtr) {
errorInLappendListPtr:
@@ -3604,7 +3606,7 @@ TEBCresume(
* Start of INST_INCR instructions.
*
* WARNING: more 'goto' here than your doctor recommended! The different
* instructions set the value of some variables and then jump to some
* instructions set the value of some variables and then jump to somme
* common execution code.
*/
@@ -3788,7 +3790,7 @@ TEBCresume(
arrayPtr = NULL;
part1Ptr = part2Ptr = NULL;
cleanup = 0;
TRACE(("%u %s => ", opnd, TclGetString(incrPtr)));
TRACE(("%u %s => ", opnd, Tcl_GetString(incrPtr)));
doIncrVar:
if (TclIsVarDirectModifyable2(varPtr, arrayPtr)) {
@@ -5154,12 +5156,12 @@ TEBCresume(
if (TclHasInternalRep(valuePtr,&tclArithSeriesType)) {
objResultPtr = TclArithSeriesObjRange(interp, valuePtr, fromIdx, toIdx);
if (objResultPtr == NULL) {
TRACE_ERROR(interp);
goto gotError;
}
} else {
objResultPtr = TclListObjRange(interp, valuePtr, fromIdx, toIdx);
}
if (objResultPtr == NULL) {
TRACE_ERROR(interp);
goto gotError;
objResultPtr = TclListObjRange(valuePtr, fromIdx, toIdx);
}
TRACE_APPEND(("\"%.30s\"", O2S(objResultPtr)));
@@ -5279,7 +5281,8 @@ TEBCresume(
}
if (fromIdx == TCL_INDEX_NONE) {
fromIdx = 0;
} else if (fromIdx > length) {
}
else if (fromIdx > length) {
fromIdx = length;
}
numToDelete = 0;
@@ -5316,7 +5319,8 @@ TEBCresume(
}
TRACE_APPEND(("\"%.30s\"\n", O2S(objResultPtr)));
NEXT_INST_V(6, opnd, 1);
} else {
}
else {
if (Tcl_ListObjReplace(interp,
valuePtr,
fromIdx,
@@ -5462,7 +5466,7 @@ TEBCresume(
TRACE(("\"%.20s\" %.20s => ", O2S(valuePtr), O2S(value2Ptr)));
/*
* Get char length to calculate what 'end' means.
* Get char length to calulate what 'end' means.
*/
length = TclGetCharLength(valuePtr);
@@ -7446,7 +7450,7 @@ TEBCresume(
O2S(OBJ_UNDER_TOS), O2S(OBJ_AT_TOS), done));
/*
* The INST_DICT_FIRST and INST_DICT_NEXT instructions are always
* The INST_DICT_FIRST and INST_DICT_NEXT instructsions are always
* followed by a conditional jump, so we can take advantage of this to
* do some peephole optimization (note that we're careful to not close
* out someone doing something else).
+3 -3
View File
@@ -425,7 +425,7 @@ TclFileDeleteCmd(
if (result != TCL_OK) {
if (errfile == NULL) {
/*
* We try to accommodate poor error results from our Tcl_FS calls.
* We try to accomodate poor error results from our Tcl_FS calls.
*/
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
@@ -1220,7 +1220,7 @@ TclFileLinkCmd(
if (contents == NULL) {
/*
* We handle three common error cases specially, and for all other
* errors, we use the standard Posix error message.
* errors, we use the standard posix error message.
*/
if (errno == EEXIST) {
@@ -1679,7 +1679,7 @@ TclFileHomeCmd(
Tcl_WrongNumArgs(interp, 1, objv, "?user?");
return TCL_ERROR;
}
homeDirObj = TclGetHomeDirObj(interp, objc == 1 ? NULL : TclGetString(objv[1]));
homeDirObj = TclGetHomeDirObj(interp, objc == 1 ? NULL : Tcl_GetString(objv[1]));
if (homeDirObj == NULL) {
return TCL_ERROR;
}
+5 -5
View File
@@ -100,7 +100,7 @@ SetResultLength(
* Results:
* Returns the position in the path immediately after the root including
* any trailing slashes. Appends a cleaned up version of the root to the
* Tcl_DString at the specified offset.
* Tcl_DString at the specified offest.
*
* Side effects:
* Modifies the specified Tcl_DString.
@@ -502,11 +502,11 @@ TclpNativeSplitPath(
switch (tclPlatform) {
case TCL_PLATFORM_UNIX:
resultPtr = SplitUnixPath(TclGetString(pathPtr));
resultPtr = SplitUnixPath(Tcl_GetString(pathPtr));
break;
case TCL_PLATFORM_WINDOWS:
resultPtr = SplitWinPath(TclGetString(pathPtr));
resultPtr = SplitWinPath(Tcl_GetString(pathPtr));
break;
}
@@ -919,7 +919,7 @@ TclpNativeJoinPath(
*/
Tcl_SetObjLength(prefix, length + (int) strlen(p));
dest = TclGetString(prefix) + length;
dest = Tcl_GetString(prefix) + length;
for (; *p != '\0'; p++) {
if ((*p == '/') || (*p == '\\')) {
while ((p[1] == '/') || (p[1] == '\\')) {
@@ -1900,7 +1900,7 @@ TclGlob(
* To process a [glob] invocation, this function may be called multiple
* times. Each time, the previously discovered filenames are in the
* interpreter result. We stash that away here so the result is free for
* error messages.
* error messsages.
*/
savedResultObj = Tcl_GetObjResult(interp);
+1 -1
View File
@@ -976,7 +976,7 @@ TclClockOldscanObjCmd(
return TCL_ERROR;
}
yyInput = TclGetString( objv[1] );
yyInput = Tcl_GetString( objv[1] );
dateInfo.dateStart = yyInput;
yyHaveDate = 0;
+4 -4
View File
@@ -649,18 +649,18 @@ Tcl_HashStats(
*/
result = (char *)ckalloc((NUM_COUNTERS * 60) + 300);
snprintf(result, 60, "%u entries in table, %u buckets\n",
sprintf(result, "%u entries in table, %u buckets\n",
tablePtr->numEntries, tablePtr->numBuckets);
p = result + strlen(result);
for (i = 0; i < NUM_COUNTERS; i++) {
snprintf(p, 60, "number of buckets with %u entries: %u\n",
sprintf(p, "number of buckets with %u entries: %u\n",
i, count[i]);
p += strlen(p);
}
snprintf(p, 60, "number of buckets with %u or more entries: %u\n",
sprintf(p, "number of buckets with %u or more entries: %u\n",
NUM_COUNTERS, overflow);
p += strlen(p);
snprintf(p, 60, "average search distance for entry: %.1f", average);
sprintf(p, "average search distance for entry: %.1f", average);
return result;
}
+2 -3
View File
@@ -58,9 +58,8 @@ Tcl_RecordAndEval(
const char *cmd, /* Command to record. */
int flags) /* Additional flags. TCL_NO_EVAL means only
* record: don't execute command.
* TCL_EVAL_GLOBAL means evaluate the script
* in global variable context instead of the
* current procedure. */
* TCL_EVAL_GLOBAL means use Tcl_GlobalEval
* instead of Tcl_Eval. */
{
Tcl_Obj *cmdPtr;
int result;
+267 -273
View File
File diff suppressed because it is too large Load Diff
+9 -7
View File
@@ -45,7 +45,7 @@ typedef struct ChannelBuffer {
struct ChannelBuffer *nextPtr;
/* Next buffer in chain. */
char buf[TCLFLEXARRAY]; /* Placeholder for real buffer. The real
* buffer occupies this space + bufSize-1
* buffer occuppies this space + bufSize-1
* bytes. This must be the last field in the
* structure. */
} ChannelBuffer;
@@ -129,7 +129,7 @@ typedef struct ChannelState {
char *channelName; /* The name of the channel instance in Tcl
* commands. Storage is owned by the generic
* IO code, is dynamically allocated. */
int flags; /* OR'ed combination of the flags defined
int flags; /* ORed combination of the flags defined
* below. */
Tcl_Encoding encoding; /* Encoding to apply when reading or writing
* data on this channel. NULL means no
@@ -188,9 +188,6 @@ typedef struct ChannelState {
* handlers ("fileevent") on this channel. */
Tcl_Size bufSize; /* What size buffers to allocate? */
Tcl_TimerToken timer; /* Handle to wakeup timer for this channel. */
Channel *timerChanPtr; /* Needed in order to decrement the refCount of
the right channel when the timer is
deleted. */
struct CopyState *csPtrR; /* State of background copy for which channel
* is input, or NULL. */
struct CopyState *csPtrW; /* State of background copy for which channel
@@ -209,7 +206,7 @@ typedef struct ChannelState {
* TIP #219 ... Info for the I/O system ...
* Error message set by channel drivers, for the propagation of arbitrary
* Tcl errors. This information, if present (chanMsg not NULL), takes
* precedence over a Posix error code returned by a channel operation.
* precedence over a posix error code returned by a channel operation.
*/
Tcl_Obj* chanMsg;
@@ -224,7 +221,7 @@ typedef struct ChannelState {
} ChannelState;
/*
* Values for the flags field in Channel. Any OR'ed combination of the
* Values for the flags field in Channel. Any ORed combination of the
* following flags can be stored in the field. These flags record various
* options and state bits about the channel. In addition to the flags below,
* the channel can also have TCL_READABLE (1<<1) and TCL_WRITABLE (1<<2) set.
@@ -278,11 +275,16 @@ typedef struct ChannelState {
* encountered an encoding error */
#define CHANNEL_RAW_MODE (1<<16) /* When set, notes that the Raw API is
* being used. */
#define CHANNEL_ENCODING_NOCOMPLAIN (1<<17) /* set if option
* -nocomplainencoding is set to 1 */
#define CHANNEL_ENCODING_STRICT (1<<18) /* set if option
* -strictencoding is set to 1 */
#define CHANNEL_INCLOSE (1<<19) /* Channel is currently being closed.
* Its structures are still live and
* usable, but it may not be closed
* again from within the close
* handler. */
#define ENCODING_FAILINDEX (1<<20) /* Internal flag, fail on Invalid bytes only */
#define CHANNEL_CLOSEDWRITE (1<<21) /* Channel write side has been closed.
* No further Tcl-level write IO on
* the channel is allowed. */
+2 -2
View File
@@ -1033,7 +1033,7 @@ Tcl_ExecObjCmd(
*
* Side effects:
* Sets interp's result to boolean true or false depending on whether the
* preceding input operation on the channel would have blocked.
* preceeding input operation on the channel would have blocked.
*
*---------------------------------------------------------------------------
*/
@@ -1485,7 +1485,7 @@ Tcl_SocketObjCmd(
TclInitSockets();
for (a = 1; a < objc; a++) {
const char *arg = TclGetString(objv[a]);
const char *arg = Tcl_GetString(objv[a]);
if (arg[0] != '-') {
break;
+7 -7
View File
@@ -409,7 +409,7 @@ ExecuteCallback(
/*
* Use a byte-array to prevent the misinterpretation of binary data coming
* through as Utf while at the tcl level.
* through as UTF while at the tcl level.
*/
Tcl_ListObjAppendElement(NULL, command, Tcl_NewByteArrayObj(buf, bufLen));
@@ -417,7 +417,7 @@ ExecuteCallback(
/*
* Step 2, execute the command at the global level of the interpreter used
* to create the transformation. Destroy the command afterward. If an
* error occurred and the current interpreter is defined and not equal to
* error occured and the current interpreter is defined and not equal to
* the interpreter for the callback, then copy the error message into
* current interpreter. Don't copy if in preservation mode.
*/
@@ -568,7 +568,7 @@ TransformCloseProc(
* Now flush data waiting in internal buffers to output and input. The
* input must be done despite the fact that there is no real receiver for
* it anymore. But the scripts might have sideeffects other parts of the
* system rely on (f.e. signalling the close to interested parties).
* system rely on (f.e. signaling the close to interested parties).
*/
PreserveData(dataPtr);
@@ -1104,7 +1104,7 @@ TransformWatchProc(
Tcl_Channel downChan;
/*
* The caller expressed interest in events occurring for this channel. We
* The caller expressed interest in events occuring for this channel. We
* are forwarding the call to the underlying channel now.
*/
@@ -1211,12 +1211,12 @@ static int
TransformNotifyProc(
ClientData clientData, /* The state of the notified
* transformation. */
int mask) /* The mask of occurring events. */
int mask) /* The mask of occuring events. */
{
TransformChannelData *dataPtr = (TransformChannelData *)clientData;
/*
* An event occurred in the underlying channel. This transformation doesn't
* An event occured in the underlying channel. This transformation doesn't
* process such events thus returns the incoming mask unchanged.
*/
@@ -1306,7 +1306,7 @@ ResultClear(
* ResultInit --
*
* Initializes the specified buffer structure. The structure will contain
* valid information for an empty buffer.
* valid information for an emtpy buffer.
*
* Side effects:
* See above.
+25 -26
View File
@@ -10,7 +10,7 @@
*
* See TIP #219 for the specification of this functionality.
*
* Copyright © 2004-2005 ActiveState, a division of Sophos
* Copyright © 2004-2005 ActiveState, a divison of Sophos
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -139,7 +139,7 @@ typedef struct {
* data in buffers is flushed out through the generation of fake file
* events.
*
* See 'refchan', 'memchan', etc.
* See 'rechan', 'memchan', etc.
*
* A timer is used here as well in order to ensure at least on pass through
* the event loop when a channel becomes ready. See issues 67a5eabbd3d1 and
@@ -148,7 +148,7 @@ typedef struct {
} ReflectedChannel;
/*
* Structure of the table mapping from channel handles to reflected
* Structure of the table maping from channel handles to reflected
* channels. Each interpreter which has the handler command for one or more
* reflected channels records them in such a table, so that 'chan postevent'
* is able to find them even if the actual channel was moved to a different
@@ -556,7 +556,7 @@ TclChanCreateObjCmd(
/*
* First argument is a list of modes. Allowed entries are "read", "write".
* Empty list is uncommon, but allowed. Abbreviations are ok.
* Expect at least one list element. Abbreviations are ok.
*/
modeObj = objv[MODE];
@@ -897,8 +897,8 @@ TclChanPostEventObjCmd(
* handles of reflected channels, and only of such whose handler is
* defined in this interpreter.
*
* We keep the old checks for both, for paranoia, but abort now instead of
* throwing errors, as failure now means that our internal data structures
* We keep the old checks for both, for paranioa, but abort now instead of
* throwing errors, as failure now means that our internal datastructures
* have gone seriously haywire.
*/
@@ -932,11 +932,6 @@ TclChanPostEventObjCmd(
if (EncodeEventMask(interp, "event", objv[EVENT], &events) != TCL_OK) {
return TCL_ERROR;
}
if (events == 0) {
Tcl_SetObjResult(interp,
Tcl_NewStringObj("bad event list: is empty", -1));
return TCL_ERROR;
}
/*
* Check that the channel is actually interested in the provided events.
@@ -1073,7 +1068,7 @@ UnmarshallErrorResult(
* Syntax = (option value)... ?message?
*
* Bad syntax causes a panic. This is OK because the other side uses
* Tcl_GetReturnOptions and list construction functions to marshal the
* Tcl_GetReturnOptions and list construction functions to marshall the
* information; if we panic here, something has gone badly wrong already.
*/
@@ -1164,7 +1159,7 @@ TclChanCaughtErrorBypass(
* driver-specific instance data.
*
* Results:
* A Posix error.
* A posix error.
*
* Side effects:
* Releases memory. Arbitrary, as it calls upon a script.
@@ -1745,7 +1740,7 @@ ReflectWatch(
* is required of it.
*
* Results:
* A Posix error number.
* A posix error number.
*
* Side effects:
* Allocates memory. Arbitrary, as it calls upon a script.
@@ -2142,10 +2137,10 @@ ReflectTruncate(
* EncodeEventMask --
*
* This function takes a list of event items and constructs the
* equivalent internal bitmask. The list may be empty but will usually
* contain at least one element. Valid elements are "read", "write", or
* any unique abbreviation of them. Note that the bitmask is not changed
* if problems are encountered.
* equivalent internal bitmask. The list must contain at least one
* element. Elements are "read", "write", or any unique abbreviation of
* them. Note that the bitmask is not changed if problems are
* encountered.
*
* Results:
* A standard Tcl error code. A bitmask where TCL_READABLE and/or
@@ -2175,6 +2170,12 @@ EncodeEventMask(
return TCL_ERROR;
}
if (listc < 1) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"bad %s list: is empty", objName));
return TCL_ERROR;
}
events = 0;
while (listc > 0) {
if (Tcl_GetIndexFromObj(interp, listv[listc-1], eventOptions,
@@ -2311,7 +2312,7 @@ NewReflectedChannel(
* refcount of the returned object is -- zero --.
*
* Side effects:
* May allocate memory. Mutex-protected critical section locks out other
* May allocate memory. Mutex protected critical section locks out other
* threads for a short time.
*
*----------------------------------------------------------------------
@@ -2365,7 +2366,7 @@ FreeReflectedChannel(
* InvokeTclMethod --
*
* This function is used to invoke the Tcl level of a reflected channel.
* It handles all the command assembly, invocation, and generic state and
* It handles all the command assembly, invokation, and generic state and
* result mgmt. It does *not* handle thread redirection; that is the
* responsibility of clients of this function.
*
@@ -2393,8 +2394,8 @@ InvokeTclMethod(
{
Tcl_Obj *methObj = NULL; /* Method name in object form */
Tcl_InterpState sr; /* State of handler interp */
int result; /* Result code of method invocation */
Tcl_Obj *resObj = NULL; /* Result of method invocation. */
int result; /* Result code of method invokation */
Tcl_Obj *resObj = NULL; /* Result of method invokation. */
Tcl_Obj *cmd;
if (rcPtr->dead) {
@@ -2613,7 +2614,7 @@ GetReflectedChannelMap(
*
* Side effects:
* Deletes the hash table of channels. May close channels. May flush
* output on closed channels. Removes any channelEvent handlers that were
* output on closed channels. Removes any channeEvent handlers that were
* registered in this interpreter.
*
*----------------------------------------------------------------------
@@ -2829,7 +2830,6 @@ DeleteThreadReflectedChannelMap(
Tcl_ThreadId self = Tcl_GetCurrentThread();
ReflectedChannelMap *rcmPtr; /* The map */
ForwardingResult *resultPtr;
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
/*
* The origin thread for one or more reflected channels is gone.
@@ -2909,7 +2909,6 @@ DeleteThreadReflectedChannelMap(
*/
rcmPtr = GetThreadReflectedChannelMap();
tsdPtr->rcmPtr = NULL;
for (hPtr = Tcl_FirstHashEntry(&rcmPtr->map, &hSearch);
hPtr != NULL;
hPtr = Tcl_FirstHashEntry(&rcmPtr->map, &hSearch)) {
@@ -3343,7 +3342,7 @@ ForwardProc(
*/
char *buf = (char *)ckalloc(200);
snprintf(buf, 200,
sprintf(buf,
"{Expected list with even number of elements, got %d %s instead}",
listc, (listc == 1 ? "element" : "elements"));
+13 -13
View File
@@ -642,7 +642,7 @@ TclChanPushObjCmd(
/*
* Mode tell us what the parent channel supports. The methods tell us what
* the handler supports. We remove the non-supported bits from the mode
* and check that the channel is not completely inaccessible. Afterward the
* and check that the channel is not completely inacessible. Afterward the
* mode tells us which methods are still required, and these methods will
* also be supported by the handler, by design of the check.
*/
@@ -874,7 +874,7 @@ UnmarshallErrorResult(
* driver specific instance data.
*
* Results:
* A Posix error.
* A posix error.
*
* Side effects:
* Releases memory. Arbitrary, as it calls upon a script.
@@ -993,7 +993,7 @@ ReflectClose(
#endif /* TCL_THREADS */
/*
* Do the actual invocation of "finalize" now; we're in the right thread.
* Do the actual invokation of "finalize" now; we're in the right thread.
*/
result = InvokeTclMethod(rtPtr, "finalize", NULL, NULL, &resObj);
@@ -1488,7 +1488,7 @@ ReflectWatch(
* is required of it.
*
* Results:
* A Posix error number.
* A posix error number.
*
* Side effects:
* Allocates memory. Arbitrary, as it calls upon a script.
@@ -1575,7 +1575,7 @@ static int
ReflectGetOption(
void *clientData, /* Channel to query */
Tcl_Interp *interp, /* Interpreter to leave error messages in */
const char *optionName, /* Name of requested option */
const char *optionName, /* Name of reuqested option */
Tcl_DString *dsPtr) /* String to place the result into */
{
ReflectedTransform *rtPtr = (ReflectedTransform *)clientData;
@@ -1630,7 +1630,7 @@ ReflectHandle(
/*
* Transformations have no handle of their own. As such we simply query
* the parent channel for it. This way the query will ripple down through
* the parent channel for it. This way the qery will ripple down through
* all transformations until reaches the base channel. Which then returns
* its handle, or fails. The former will then ripple up the stack.
*
@@ -1664,7 +1664,7 @@ ReflectNotify(
ReflectedTransform *rtPtr = (ReflectedTransform *)clientData;
/*
* An event occurred in the underlying channel.
* An event occured in the underlying channel.
*
* We delete our timer. It was not fired, yet we are here, so the channel
* below generated such an event and we don't have to. The renewal of the
@@ -1927,7 +1927,7 @@ FreeReflectedTransform(
* InvokeTclMethod --
*
* This function is used to invoke the Tcl level of a reflected channel.
* It handles all the command assembly, invocation, and generic state and
* It handles all the command assembly, invokation, and generic state and
* result mgmt. It does *not* handle thread redirection; that is the
* responsibility of clients of this function.
*
@@ -1959,8 +1959,8 @@ InvokeTclMethod(
int cmdc; /* #words in constructed command */
Tcl_Obj *methObj = NULL; /* Method name in object form */
Tcl_InterpState sr; /* State of handler interp */
int result; /* Result code of method invocation */
Tcl_Obj *resObj = NULL; /* Result of method invocation. */
int result; /* Result code of method invokation */
Tcl_Obj *resObj = NULL; /* Result of method invokation. */
if (rtPtr->dead) {
/*
@@ -1984,7 +1984,7 @@ InvokeTclMethod(
*/
/*
* Insert method into the preallocated area, after the command prefix,
* Insert method into the pre-allocated area, after the command prefix,
* before the channel id.
*/
@@ -2011,7 +2011,7 @@ InvokeTclMethod(
}
/*
* And run the handler... This is done in a manner which leaves any
* And run the handler... This is done in auch a manner which leaves any
* existing state intact.
*/
@@ -2913,7 +2913,7 @@ TimerRun(
* ResultInit --
*
* Initializes the specified buffer structure. The structure will contain
* valid information for an empty buffer.
* valid information for an emtpy buffer.
*
* Side effects:
* See above.
+6 -5
View File
@@ -178,7 +178,7 @@ const Tcl_Filesystem tclNativeFilesystem = {
/*
* An initial record in the linked list for the native filesystem. Remains at
* the tail of the list and is never freed. Currently the native filesystem is
* hard-coded. It may make sense to modify this to accommodate unconventional
* hard-coded. It may make sense to modify this to accomodate unconventional
* uses of Tcl that provide no native filesystem.
*/
@@ -293,7 +293,7 @@ Tcl_Stat(
#endif /* !TCL_WIDE_INT_IS_LONG */
/*
* Copy across all supported fields, with possible type coercion on
* Copy across all supported fields, with possible type coercions on
* those fields that change between the normal and lf64 versions of
* the stat structure (on Solaris at least). This is slow when the
* structure sizes coincide, but that's what you get for using an
@@ -1304,7 +1304,7 @@ Tcl_FSData(
* None (beyond the memory allocation for the result).
*
* Special notes:
* If the filesystem-specific normalizePathProcs can reintroduce ../, ./
* If the filesystem-specific normalizePathProcs can re-introduce ../, ./
* components into the pathname, this function does not return the correct
* result. This may be possible with symbolic links on unix.
*
@@ -1338,7 +1338,7 @@ TclFSNormalizeToUniquePath(
* We check these first to avoid useless calls to the native filesystem's
* normalizePathProc.
*/
path = TclGetStringFromObj(pathPtr, &i);
path = Tcl_GetStringFromObj(pathPtr, &i);
if ( (i >= 3) && ( (path[0] == '/' && path[1] == '/')
|| (path[0] == '\\' && path[1] == '\\') ) ) {
@@ -2062,7 +2062,8 @@ Tcl_PosixError(
* Tcl_FSStat --
* Calls 'statProc' of the filesystem corresponding to pathPtr.
*
* Replaces the standard library "stat" routine.
* Replaces the standard library routines stat.
*
*
* Results:
* See stat documentation.
+31 -34
View File
@@ -54,8 +54,8 @@ static const Tcl_ObjType indexType = {
typedef struct {
void *tablePtr; /* Pointer to the table of strings */
Tcl_Size offset; /* Offset between table entries */
Tcl_Size index; /* Selected index into table. */
int offset; /* Offset between table entries */
int index; /* Selected index into table. */
} IndexRep;
/*
@@ -175,14 +175,13 @@ GetIndexFromObjList(
int *indexPtr) /* Place to store resulting integer index. */
{
Tcl_Size objc, t;
int result;
int objc, result, t;
Tcl_Obj **objv;
const char **tablePtr;
/*
* Use Tcl_GetIndexFromObjStruct to do the work to avoid duplicating most
* of the code there. This is a bit inefficient but simpler.
* of the code there. This is a bit ineffiecient but simpler.
*/
result = TclListObjGetElementsM(interp, tableObjPtr, &objc, &objv);
@@ -261,7 +260,7 @@ Tcl_GetIndexFromObjStruct(
int flags, /* 0, TCL_EXACT, TCL_NULL_OK or TCL_INDEX_TEMP_TABLE */
void *indexPtr) /* Place to store resulting index. */
{
Tcl_Size index, idx, numAbbrev;
int index, idx, numAbbrev;
const char *key, *p1;
const char *p2;
const char *const *entryPtr;
@@ -296,7 +295,7 @@ Tcl_GetIndexFromObjStruct(
*/
key = objPtr ? TclGetString(objPtr) : "";
index = TCL_INDEX_NONE;
index = -1;
numAbbrev = 0;
if (!*key && (flags & TCL_NULL_OK)) {
@@ -569,8 +568,8 @@ PrefixMatchObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
int flags = 0, result, index, i;
Tcl_Size dummyLength, errorLength;
int flags = 0, result, index;
int dummyLength, i, errorLength;
Tcl_Obj *errorPtr = NULL;
const char *message = "option";
Tcl_Obj *tablePtr, *objPtr, *resultPtr;
@@ -598,7 +597,7 @@ PrefixMatchObjCmd(
case PRFMATCH_MESSAGE:
if (i > objc-4) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"missing value for -message", TCL_INDEX_NONE));
"missing value for -message", -1));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "NOARG", NULL);
return TCL_ERROR;
}
@@ -608,7 +607,7 @@ PrefixMatchObjCmd(
case PRFMATCH_ERROR:
if (i > objc-4) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"missing value for -error", TCL_INDEX_NONE));
"missing value for -error", -1));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "NOARG", NULL);
return TCL_ERROR;
}
@@ -693,8 +692,7 @@ PrefixAllObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
int result;
Tcl_Size length, elemLength, tableObjc, t;
int tableObjc, result, t, length, elemLength;
const char *string, *elemString;
Tcl_Obj **tableObjv, *resultPtr;
@@ -751,8 +749,7 @@ PrefixLongestObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
int result;
Tcl_Size i, length, elemLength, resultLength, tableObjc, t;
int tableObjc, result, i, t, length, elemLength, resultLength;
const char *string, *elemString, *resultString;
Tcl_Obj **tableObjv;
@@ -867,7 +864,7 @@ PrefixLongestObjCmd(
void
Tcl_WrongNumArgs(
Tcl_Interp *interp, /* Current interpreter. */
Tcl_Size objc, /* Number of arguments to print from objv. */
int objc, /* Number of arguments to print from objv. */
Tcl_Obj *const objv[], /* Initial argument objects, which should be
* included in the error message. */
const char *message) /* Error message to print after the leading
@@ -875,7 +872,7 @@ Tcl_WrongNumArgs(
* NULL. */
{
Tcl_Obj *objPtr;
Tcl_Size i, len, elemLen;
int i, len, elemLen;
char flags;
Interp *iPtr = (Interp *)interp;
const char *elementStr;
@@ -907,9 +904,9 @@ Tcl_WrongNumArgs(
if (iPtr->flags & INTERP_ALTERNATE_WRONG_ARGS) {
iPtr->flags &= ~INTERP_ALTERNATE_WRONG_ARGS;
Tcl_AppendObjToObj(objPtr, Tcl_GetObjResult(interp));
Tcl_AppendToObj(objPtr, " or \"", TCL_INDEX_NONE);
Tcl_AppendToObj(objPtr, " or \"", -1);
} else {
Tcl_AppendToObj(objPtr, "wrong # args: should be \"", TCL_INDEX_NONE);
Tcl_AppendToObj(objPtr, "wrong # args: should be \"", -1);
}
/*
@@ -918,8 +915,8 @@ Tcl_WrongNumArgs(
*/
if (iPtr->ensembleRewrite.sourceObjs != NULL) {
Tcl_Size toSkip = iPtr->ensembleRewrite.numInsertedObjs;
Tcl_Size toPrint = iPtr->ensembleRewrite.numRemovedObjs;
int toSkip = iPtr->ensembleRewrite.numInsertedObjs;
int toPrint = iPtr->ensembleRewrite.numRemovedObjs;
Tcl_Obj *const *origObjv = TclEnsembleGetRewriteValues(interp);
/*
@@ -941,7 +938,7 @@ Tcl_WrongNumArgs(
objc -= toSkip;
/*
* Assume no object is of index type.
* We assume no object is of index type.
*/
for (i=0 ; i<toPrint ; i++) {
@@ -979,7 +976,7 @@ Tcl_WrongNumArgs(
* moderately complex condition here).
*/
if (i + 1 < toPrint || objc!=0 || message!=NULL) {
if (i<toPrint-1 || objc!=0 || message!=NULL) {
Tcl_AppendStringsToObj(objPtr, " ", NULL);
}
}
@@ -993,7 +990,7 @@ Tcl_WrongNumArgs(
addNormalArgumentsToMessage:
for (i = 0; i < objc; i++) {
/*
* If the object is an index type, use the index table which allows for
* If the object is an index type use the index table which allows for
* the correct error message even if the subcommand was abbreviated.
* Otherwise, just use the string rep.
*/
@@ -1031,7 +1028,7 @@ Tcl_WrongNumArgs(
* (either another element from objv, or the message string).
*/
if (i + 1 < objc || message!=NULL) {
if (i<objc-1 || message!=NULL) {
Tcl_AppendStringsToObj(objPtr, " ", NULL);
}
}
@@ -1091,7 +1088,7 @@ Tcl_ParseArgsObjv(
Tcl_Obj **leftovers; /* Array to write back to remObjv on
* successful exit. Will include the name of
* the command. */
Tcl_Size nrem; /* Size of leftovers.*/
int nrem; /* Size of leftovers.*/
const Tcl_ArgvInfo *infoPtr;
/* Pointer to the current entry in the table
* of argument descriptions. */
@@ -1103,13 +1100,13 @@ Tcl_ParseArgsObjv(
* quick check for matching; use 2nd char.
* because first char. will almost always be
* '-'). */
Tcl_Size srcIndex; /* Location from which to read next argument
int srcIndex; /* Location from which to read next argument
* from objv. */
Tcl_Size dstIndex; /* Used to keep track of current arguments
int dstIndex; /* Used to keep track of current arguments
* being processed, primarily for error
* reporting. */
Tcl_Size objc; /* # arguments in objv still to process. */
Tcl_Size length; /* Number of characters in current argument */
int objc; /* # arguments in objv still to process. */
int length; /* Number of characters in current argument */
if (remObjv != NULL) {
/*
@@ -1146,7 +1143,7 @@ Tcl_ParseArgsObjv(
}
/*
* Loop through the argument descriptors searching for one with the
* Loop throught the argument descriptors searching for one with the
* matching key string. If found, leave a pointer to it in matchPtr.
*/
@@ -1360,7 +1357,7 @@ PrintUsage(
width = 4;
for (infoPtr = argTable; infoPtr->type != TCL_ARGV_END; infoPtr++) {
Tcl_Size length;
int length;
if (infoPtr->keyStr == NULL) {
continue;
@@ -1375,7 +1372,7 @@ PrintUsage(
* Now add the option information, with pretty-printing.
*/
msg = Tcl_NewStringObj("Command-specific options:", TCL_INDEX_NONE);
msg = Tcl_NewStringObj("Command-specific options:", -1);
for (infoPtr = argTable; infoPtr->type != TCL_ARGV_END; infoPtr++) {
if ((infoPtr->type == TCL_ARGV_HELP) && (infoPtr->keyStr == NULL)) {
Tcl_AppendPrintfToObj(msg, "\n%s", infoPtr->helpStr);
@@ -1391,7 +1388,7 @@ PrintUsage(
}
numSpaces -= NUM_SPACES;
}
Tcl_AppendToObj(msg, infoPtr->helpStr, TCL_INDEX_NONE);
Tcl_AppendToObj(msg, infoPtr->helpStr, -1);
switch (infoPtr->type) {
case TCL_ARGV_INT:
Tcl_AppendPrintfToObj(msg, "\n\t\tDefault value: %d",
+1 -1
View File
@@ -184,7 +184,7 @@ declare 77 {deprecated {}} {
void TclpGetTime(Tcl_Time *time)
}
declare 81 {
void *TclpRealloc(void *ptr, TCL_HASH_TYPE size)
void *TclpRealloc(void *ptr, unsigned int size)
}
declare 88 {deprecated {}} {
char *TclPrecTraceProc(void *clientData, Tcl_Interp *interp,
+95 -116
View File
@@ -138,7 +138,6 @@
#if defined(_WIN32) && defined(_MSC_VER)
# define vsnprintf _vsnprintf
# define snprintf _snprintf
#endif
#if !defined(TCL_THREADS)
@@ -232,9 +231,9 @@ typedef struct Tcl_Ensemble Tcl_Ensemble;
typedef struct NamespacePathEntry NamespacePathEntry;
/*
* Special hashtable for variables: This is just a Tcl_HashTable with a nsPtr
* field added at the end, so that variables can find their namespace
* without having to copy a pointer in their struct by accessing them via
* Special hashtable for variables: this is just a Tcl_HashTable with an nsPtr
* field added at the end: in this way variables can find their namespace
* without having to copy a pointer in their struct: they can access it via
* their hPtr->tablePtr.
*/
@@ -482,7 +481,7 @@ typedef struct EnsembleConfig {
* all lists, and cannot be found by scanning
* the list from the namespace's ensemble
* field. */
int flags; /* OR'ed combo of TCL_ENSEMBLE_PREFIX,
int flags; /* ORed combo of TCL_ENSEMBLE_PREFIX,
* ENSEMBLE_DEAD and ENSEMBLE_COMPILE. */
/* OBJECT FIELDS FOR ENSEMBLE CONFIGURATION */
@@ -509,7 +508,7 @@ typedef struct EnsembleConfig {
* results passed directly back to the caller
* (including the error code) unless the code
* is TCL_CONTINUE in which case the
* subcommand will be re-parsed by the ensemble
* subcommand will be reparsed by the ensemble
* core, presumably because the ensemble
* itself has been updated. */
Tcl_Obj *parameterList; /* List of ensemble parameter names. */
@@ -653,7 +652,7 @@ typedef struct VarInHash {
Tcl_HashEntry entry; /* The hash table entry that refers to this
* variable. This is used to find the name of
* the variable and to delete it from its
* hash table if it is no longer needed. It
* hashtable if it is no longer needed. It
* also holds the variable's name. */
} VarInHash;
@@ -664,7 +663,7 @@ typedef struct VarInHash {
*
* VAR_ARRAY - 1 means this is an array variable rather than
* a scalar variable or link. The "tablePtr"
* field points to the array's hash table for its
* field points to the array's hashtable for its
* elements.
* VAR_LINK - 1 means this Var structure contains a pointer
* to another Var structure that either has the
@@ -677,12 +676,12 @@ typedef struct VarInHash {
* Flags that indicate the type and status of storage; none is set for
* compiled local variables (Var structs).
*
* VAR_IN_HASHTABLE - 1 means this variable is in a hash table and
* the Var structure is malloc'ed. 0 if it is a
* VAR_IN_HASHTABLE - 1 means this variable is in a hashtable and
* the Var structure is malloced. 0 if it is a
* local variable that was assigned a slot in a
* procedure frame by the compiler so the Var
* storage is part of the call frame.
* VAR_DEAD_HASH 1 means that this var's entry in the hash table
* VAR_DEAD_HASH 1 means that this var's entry in the hashtable
* has already been deleted.
* VAR_ARRAY_ELEMENT - 1 means that this variable is an array
* element, so it is not legal for it to be an
@@ -881,22 +880,19 @@ typedef struct VarInHash {
* Macros for direct variable access by TEBC.
*/
#define TclIsVarTricky(varPtr,trickyFlags) \
((varPtr)->flags & (VAR_ARRAY|VAR_LINK|trickyFlags))
#define TclIsVarDirectReadable(varPtr) \
( (!TclIsVarTricky(varPtr,VAR_TRACED_READ)) \
&& (varPtr)->value.objPtr)
#define TclIsVarDirectReadable(varPtr) \
( !((varPtr)->flags & (VAR_ARRAY|VAR_LINK|VAR_TRACED_READ)) \
&& (varPtr)->value.objPtr)
#define TclIsVarDirectWritable(varPtr) \
(!TclIsVarTricky(varPtr,VAR_TRACED_WRITE|VAR_DEAD_HASH))
!((varPtr)->flags & (VAR_ARRAY|VAR_LINK|VAR_TRACED_WRITE|VAR_DEAD_HASH))
#define TclIsVarDirectUnsettable(varPtr) \
(!TclIsVarTricky(varPtr,VAR_TRACED_READ|VAR_TRACED_WRITE|VAR_TRACED_UNSET|VAR_DEAD_HASH))
!((varPtr)->flags & (VAR_ARRAY|VAR_LINK|VAR_TRACED_READ|VAR_TRACED_WRITE|VAR_TRACED_UNSET|VAR_DEAD_HASH))
#define TclIsVarDirectModifyable(varPtr) \
( (!TclIsVarTricky(varPtr,VAR_TRACED_READ|VAR_TRACED_WRITE)) \
&& (varPtr)->value.objPtr)
( !((varPtr)->flags & (VAR_ARRAY|VAR_LINK|VAR_TRACED_READ|VAR_TRACED_WRITE)) \
&& (varPtr)->value.objPtr)
#define TclIsVarDirectReadable2(varPtr, arrayPtr) \
(TclIsVarDirectReadable(varPtr) &&\
@@ -1280,7 +1276,7 @@ typedef struct CFWordBC {
struct CFWordBC *prevPtr; /* Previous entry in stack for same Tcl_Obj. */
struct CFWordBC *nextPtr; /* Next entry for same command call. See
* CmdFrame litarg field for the list start. */
Tcl_Obj *obj; /* Back reference to hash table key */
Tcl_Obj *obj; /* Back reference to hashtable key */
} CFWordBC;
/*
@@ -1294,7 +1290,7 @@ typedef struct CFWordBC {
*
* These structures are allocated and filled by both the function
* TclSubstTokens() in the file "tclParse.c" and its caller TclEvalEx() in the
* file "tclBasic.c", and stored in the thread-global hash table "lineCLPtr" in
* file "tclBasic.c", and stored in the thread-global hashtable "lineCLPtr" in
* file "tclObj.c". They are used by the functions TclSetByteCodeFromAny() and
* TclCompileScript(), both found in the file "tclCompile.c". Their memory is
* released by the function TclFreeObj(), in the file "tclObj.c", and also by
@@ -2443,6 +2439,16 @@ typedef enum TclEolTranslation {
#define TCL_INVOKE_NO_UNKNOWN (1<<1)
#define TCL_INVOKE_NO_TRACEBACK (1<<2)
#if TCL_MAJOR_VERSION > 8
/*
* SSIZE_MAX, NOT SIZE_MAX as negative differences need to be expressed
* between values of the Tcl_Size type so limit the range to signed
*/
# define ListSizeT_MAX ((Tcl_Size)PTRDIFF_MAX)
#else
# define ListSizeT_MAX INT_MAX
#endif
/*
* ListStore --
*
@@ -2483,11 +2489,11 @@ typedef struct ListStore {
/* Max number of elements that can be contained in a list */
#define LIST_MAX \
((Tcl_Size)(((size_t)TCL_SIZE_MAX - offsetof(ListStore, slots)) \
((Tcl_Size)(((size_t)ListSizeT_MAX - offsetof(ListStore, slots)) \
/ sizeof(Tcl_Obj *)))
/* Memory size needed for a ListStore to hold numSlots_ elements */
#define LIST_SIZE(numSlots_) \
((Tcl_Size)(offsetof(ListStore, slots) + ((numSlots_) * sizeof(Tcl_Obj *))))
((int)(offsetof(ListStore, slots) + ((numSlots_) * sizeof(Tcl_Obj *))))
/*
* ListSpan --
@@ -2576,7 +2582,6 @@ typedef struct ListRep {
(((objv_) = &ListObjStorePtr(listObj_)->slots[ListObjStart(listObj_)]), \
(ListObjLength(listObj_, (objc_))))
/*
* Returns 1/0 whether the internal representation (not the Tcl_Obj itself)
* is shared. Note by intent this only checks for sharing of ListStore,
@@ -2863,22 +2868,6 @@ typedef struct ProcessGlobalValue {
#define TCL_PARSE_NO_UNDERSCORE 128
/* Reject underscore digit separator */
/*
*----------------------------------------------------------------------
* Internal convenience macros for manipulating encoding flags. See
* TCL_ENCODING_PROFILE_* in tcl.h
*----------------------------------------------------------------------
*/
#define ENCODING_PROFILE_MASK 0xFF000000
#define ENCODING_PROFILE_GET(flags_) ((flags_) & ENCODING_PROFILE_MASK)
#define ENCODING_PROFILE_SET(flags_, profile_) \
do { \
(flags_) &= ~ENCODING_PROFILE_MASK; \
(flags_) |= profile_; \
} while (0)
/*
*----------------------------------------------------------------
* Variables shared among Tcl modules but not used by the outside world.
@@ -2890,19 +2879,7 @@ MODULE_SCOPE int tclFindExecutableSearchDone;
MODULE_SCOPE char *tclMemDumpFileName;
MODULE_SCOPE TclPlatformType tclPlatform;
/*
* Declarations related to internal encoding functions.
*/
MODULE_SCOPE Tcl_Encoding tclIdentityEncoding;
MODULE_SCOPE int
TclEncodingProfileNameToId(Tcl_Interp *interp,
const char *profileName,
int *profilePtr);
MODULE_SCOPE const char *TclEncodingProfileIdToName(Tcl_Interp *interp,
int profileId);
MODULE_SCOPE int TclEncodingSetProfileFlags(int flags);
MODULE_SCOPE void TclGetEncodingProfiles(Tcl_Interp *interp);
/*
* TIP #233 (Virtualized Time)
@@ -3069,12 +3046,12 @@ struct Tcl_LoadHandle_ {
*/
MODULE_SCOPE void TclAppendBytesToByteArray(Tcl_Obj *objPtr,
const unsigned char *bytes, Tcl_Size len);
const unsigned char *bytes, int len);
MODULE_SCOPE int TclNREvalCmd(Tcl_Interp *interp, Tcl_Obj *objPtr,
int flags);
MODULE_SCOPE void TclAdvanceContinuations(Tcl_Size *line, int **next,
MODULE_SCOPE void TclAdvanceContinuations(int *line, int **next,
int loc);
MODULE_SCOPE void TclAdvanceLines(Tcl_Size *line, const char *start,
MODULE_SCOPE void TclAdvanceLines(int *line, const char *start,
const char *end);
MODULE_SCOPE void TclArgumentEnter(Tcl_Interp *interp,
Tcl_Obj *objv[], int objc, CmdFrame *cf);
@@ -3082,7 +3059,7 @@ 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, Tcl_Size pc);
void *codePtr, CmdFrame *cfPtr, int cmd, int pc);
MODULE_SCOPE void TclArgumentBCRelease(Tcl_Interp *interp,
CmdFrame *cfPtr);
MODULE_SCOPE void TclArgumentGet(Tcl_Interp *interp, Tcl_Obj *obj,
@@ -3092,8 +3069,8 @@ MODULE_SCOPE int TclAsyncNotifier(int sigNumber, Tcl_ThreadId threadId,
MODULE_SCOPE void TclAsyncMarkFromNotifier(void);
MODULE_SCOPE double TclBignumToDouble(const void *bignum);
MODULE_SCOPE int TclByteArrayMatch(const unsigned char *string,
Tcl_Size strLen, const unsigned char *pattern,
Tcl_Size ptnLen, int flags);
int strLen, const unsigned char *pattern,
int ptnLen, int flags);
MODULE_SCOPE double TclCeil(const void *a);
MODULE_SCOPE void TclChannelPreserve(Tcl_Channel chan);
MODULE_SCOPE void TclChannelRelease(Tcl_Channel chan);
@@ -3108,14 +3085,14 @@ MODULE_SCOPE Tcl_ObjCmdProc TclChannelNamesCmd;
MODULE_SCOPE Tcl_NRPostProc TclClearRootEnsemble;
MODULE_SCOPE int TclCompareTwoNumbers(Tcl_Obj *valuePtr,
Tcl_Obj *value2Ptr);
MODULE_SCOPE ContLineLoc *TclContinuationsEnter(Tcl_Obj *objPtr, Tcl_Size num,
MODULE_SCOPE ContLineLoc *TclContinuationsEnter(Tcl_Obj *objPtr, int num,
int *loc);
MODULE_SCOPE void TclContinuationsEnterDerived(Tcl_Obj *objPtr,
int start, int *clNext);
MODULE_SCOPE ContLineLoc *TclContinuationsGet(Tcl_Obj *objPtr);
MODULE_SCOPE void TclContinuationsCopy(Tcl_Obj *objPtr,
Tcl_Obj *originObjPtr);
MODULE_SCOPE Tcl_Size TclConvertElement(const char *src, Tcl_Size length,
MODULE_SCOPE int TclConvertElement(const char *src, int length,
char *dst, int flags);
MODULE_SCOPE Tcl_Command TclCreateObjCommandInNs(Tcl_Interp *interp,
const char *cmdName, Tcl_Namespace *nsPtr,
@@ -3127,12 +3104,12 @@ MODULE_SCOPE Tcl_Command TclCreateEnsembleInNs(Tcl_Interp *interp,
MODULE_SCOPE void TclDeleteNamespaceVars(Namespace *nsPtr);
MODULE_SCOPE void TclDeleteNamespaceChildren(Namespace *nsPtr);
MODULE_SCOPE int TclFindDictElement(Tcl_Interp *interp,
const char *dict, Tcl_Size dictLength,
const char *dict, int dictLength,
const char **elementPtr, const char **nextPtr,
Tcl_Size *sizePtr, int *literalPtr);
int *sizePtr, int *literalPtr);
/* TIP #280 - Modified token based evaluation, with line information. */
MODULE_SCOPE int TclEvalEx(Tcl_Interp *interp, const char *script,
Tcl_Size numBytes, int flags, Tcl_Size line,
int numBytes, int flags, int line,
int *clNextOuter, const char *outerScript);
MODULE_SCOPE Tcl_ObjCmdProc TclFileAttrsCmd;
MODULE_SCOPE Tcl_ObjCmdProc TclFileCopyCmd;
@@ -3154,7 +3131,7 @@ MODULE_SCOPE char * TclDStringAppendObj(Tcl_DString *dsPtr,
MODULE_SCOPE char * TclDStringAppendDString(Tcl_DString *dsPtr,
Tcl_DString *toAppendPtr);
MODULE_SCOPE Tcl_Obj *const *TclFetchEnsembleRoot(Tcl_Interp *interp,
Tcl_Obj *const *objv, Tcl_Size objc, Tcl_Size *objcPtr);
Tcl_Obj *const *objv, int objc, int *objcPtr);
MODULE_SCOPE Tcl_Obj *const *TclEnsembleGetRewriteValues(Tcl_Interp *interp);
MODULE_SCOPE Tcl_Namespace *TclEnsureNamespace(Tcl_Interp *interp,
Tcl_Namespace *namespacePtr);
@@ -3238,7 +3215,7 @@ MODULE_SCOPE void TclInitObjSubsystem(void);
MODULE_SCOPE int TclInterpReady(Tcl_Interp *interp);
MODULE_SCOPE int TclIsDigitProc(int byte);
MODULE_SCOPE int TclIsBareword(int byte);
MODULE_SCOPE Tcl_Obj * TclJoinPath(Tcl_Size elements, Tcl_Obj * const objv[],
MODULE_SCOPE Tcl_Obj * TclJoinPath(int elements, Tcl_Obj * const objv[],
int forceRelative);
MODULE_SCOPE int MakeTildeRelativePath(Tcl_Interp *interp, const char *user,
const char *subPath, Tcl_DString *dsPtr);
@@ -3251,25 +3228,25 @@ MODULE_SCOPE void TclLimitRemoveAllHandlers(Tcl_Interp *interp);
MODULE_SCOPE Tcl_Obj * TclLindexList(Tcl_Interp *interp,
Tcl_Obj *listPtr, Tcl_Obj *argPtr);
MODULE_SCOPE Tcl_Obj * TclLindexFlat(Tcl_Interp *interp, Tcl_Obj *listPtr,
Tcl_Size indexCount, Tcl_Obj *const indexArray[]);
int indexCount, Tcl_Obj *const indexArray[]);
/* TIP #280 */
MODULE_SCOPE void TclListLines(Tcl_Obj *listObj, Tcl_Size line, int n,
MODULE_SCOPE void TclListLines(Tcl_Obj *listObj, int line, int n,
int *lines, Tcl_Obj *const *elems);
MODULE_SCOPE Tcl_Obj * TclListObjCopy(Tcl_Interp *interp, Tcl_Obj *listPtr);
MODULE_SCOPE int TclListObjAppendElements(Tcl_Interp *interp,
Tcl_Obj *toObj, Tcl_Size elemCount,
Tcl_Obj *toObj, int elemCount,
Tcl_Obj *const elemObjv[]);
MODULE_SCOPE Tcl_Obj * TclListObjRange(Tcl_Interp *interp, Tcl_Obj *listPtr,
Tcl_Size fromIdx, Tcl_Size toIdx);
MODULE_SCOPE Tcl_Obj * TclListObjRange(Tcl_Obj *listPtr, int fromIdx,
int toIdx);
MODULE_SCOPE Tcl_Obj * TclLsetList(Tcl_Interp *interp, Tcl_Obj *listPtr,
Tcl_Obj *indexPtr, Tcl_Obj *valuePtr);
MODULE_SCOPE Tcl_Obj * TclLsetFlat(Tcl_Interp *interp, Tcl_Obj *listPtr,
Tcl_Size indexCount, Tcl_Obj *const indexArray[],
int indexCount, Tcl_Obj *const indexArray[],
Tcl_Obj *valuePtr);
MODULE_SCOPE Tcl_Command TclMakeEnsemble(Tcl_Interp *interp, const char *name,
const EnsembleImplMap map[]);
MODULE_SCOPE int TclMakeSafe(Tcl_Interp *interp);
MODULE_SCOPE Tcl_Size TclMaxListLength(const char *bytes, Tcl_Size numBytes,
MODULE_SCOPE int TclMaxListLength(const char *bytes, int numBytes,
const char **endPtr);
MODULE_SCOPE int TclMergeReturnOptions(Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[], Tcl_Obj **optionsPtrPtr,
@@ -3287,15 +3264,15 @@ 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,
Tcl_Size numBytes, Tcl_Size *readPtr, char *dst);
MODULE_SCOPE int TclParseHex(const char *src, Tcl_Size numBytes,
int numBytes, int *readPtr, char *dst);
MODULE_SCOPE int TclParseHex(const char *src, int numBytes,
int *resultPtr);
MODULE_SCOPE int TclParseNumber(Tcl_Interp *interp, Tcl_Obj *objPtr,
const char *expected, const char *bytes,
Tcl_Size numBytes, const char **endPtrPtr, int flags);
int numBytes, const char **endPtrPtr, int flags);
MODULE_SCOPE void TclParseInit(Tcl_Interp *interp, const char *string,
Tcl_Size numBytes, Tcl_Parse *parsePtr);
MODULE_SCOPE Tcl_Size TclParseAllWhiteSpace(const char *src, Tcl_Size numBytes);
int numBytes, Tcl_Parse *parsePtr);
MODULE_SCOPE int TclParseAllWhiteSpace(const char *src, int 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);
@@ -3303,7 +3280,7 @@ 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,
Tcl_Size len);
int len);
MODULE_SCOPE void TclpAlertNotifier(void *clientData);
MODULE_SCOPE void *TclpNotifierData(void);
MODULE_SCOPE void TclpServiceModeHook(int mode);
@@ -3330,7 +3307,7 @@ MODULE_SCOPE int TclCreateSocketAddress(Tcl_Interp *interp,
MODULE_SCOPE int TclpThreadCreate(Tcl_ThreadId *idPtr,
Tcl_ThreadCreateProc *proc, void *clientData,
int stackSize, int flags);
MODULE_SCOPE Tcl_Size TclpFindVariable(const char *name, Tcl_Size *lengthPtr);
MODULE_SCOPE int TclpFindVariable(const char *name, int *lengthPtr);
MODULE_SCOPE void TclpInitLibraryPath(char **valuePtr,
TCL_HASH_TYPE *lengthPtr, Tcl_Encoding *encodingPtr);
MODULE_SCOPE void TclpInitLock(void);
@@ -3345,15 +3322,15 @@ MODULE_SCOPE int TclpMatchFiles(Tcl_Interp *interp, char *separators,
MODULE_SCOPE int TclpObjNormalizePath(Tcl_Interp *interp,
Tcl_Obj *pathPtr, int nextCheckpoint);
MODULE_SCOPE void TclpNativeJoinPath(Tcl_Obj *prefix, const char *joining);
MODULE_SCOPE Tcl_Obj * TclpNativeSplitPath(Tcl_Obj *pathPtr, Tcl_Size *lenPtr);
MODULE_SCOPE Tcl_Obj * TclpNativeSplitPath(Tcl_Obj *pathPtr, int *lenPtr);
MODULE_SCOPE Tcl_PathType TclpGetNativePathType(Tcl_Obj *pathPtr,
Tcl_Size *driveNameLengthPtr, Tcl_Obj **driveNameRef);
int *driveNameLengthPtr, Tcl_Obj **driveNameRef);
MODULE_SCOPE int TclCrossFilesystemCopy(Tcl_Interp *interp,
Tcl_Obj *source, Tcl_Obj *target);
MODULE_SCOPE int TclpMatchInDirectory(Tcl_Interp *interp,
Tcl_Obj *resultPtr, Tcl_Obj *pathPtr,
const char *pattern, Tcl_GlobTypeData *types);
MODULE_SCOPE void *TclpGetNativeCwd(void *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);
@@ -3378,9 +3355,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,
Tcl_Size reStrLen, Tcl_DString *dsPtr, int *flagsPtr,
int reStrLen, Tcl_DString *dsPtr, int *flagsPtr,
int *quantifiersFoundPtr);
MODULE_SCOPE TCL_HASH_TYPE TclScanElement(const char *string, Tcl_Size length,
MODULE_SCOPE TCL_HASH_TYPE TclScanElement(const char *string, int length,
char *flagPtr);
MODULE_SCOPE void TclSetBgErrorHandler(Tcl_Interp *interp,
Tcl_Obj *cmdPrefix);
@@ -3395,37 +3372,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, Tcl_Size objc, Tcl_Size subIdx,
Tcl_Obj *const *objv, int objc, int subIdx,
Tcl_Obj *bad, Tcl_Obj *fix);
MODULE_SCOPE void * TclStackRealloc(Tcl_Interp *interp, void *ptr,
Tcl_Size numBytes);
int 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, Tcl_Size reqlength);
int checkEq, int nocase, int reqlength);
MODULE_SCOPE int TclStringCmpOpts(Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[], int *nocase,
Tcl_Size *reqlength);
MODULE_SCOPE int TclStringMatch(const char *str, Tcl_Size strLen,
int *reqlength);
MODULE_SCOPE int TclStringMatch(const char *str, int 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,
Tcl_Size numBytes, int flags, Tcl_Size line,
int numBytes, int flags, int line,
struct CompileEnv *envPtr);
MODULE_SCOPE int TclSubstOptions(Tcl_Interp *interp, Tcl_Size numOpts,
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,
Tcl_Size numBytes, int flags, Tcl_Parse *parsePtr,
int numBytes, int flags, Tcl_Parse *parsePtr,
Tcl_InterpState *statePtr);
MODULE_SCOPE int TclSubstTokens(Tcl_Interp *interp, Tcl_Token *tokenPtr,
Tcl_Size count, int *tokensLeftPtr, Tcl_Size line,
int count, int *tokensLeftPtr, int line,
int *clNextOuter, const char *outerScript);
MODULE_SCOPE Tcl_Size TclTrim(const char *bytes, Tcl_Size numBytes,
const char *trim, Tcl_Size numTrim, Tcl_Size *trimRight);
MODULE_SCOPE Tcl_Size TclTrimLeft(const char *bytes, Tcl_Size numBytes,
const char *trim, Tcl_Size numTrim);
MODULE_SCOPE Tcl_Size TclTrimRight(const char *bytes, Tcl_Size numBytes,
const char *trim, Tcl_Size numTrim);
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 const char*TclGetCommandTypeName(Tcl_Command command);
MODULE_SCOPE void TclRegisterCommandTypeName(
Tcl_ObjCmdProc *implementationProc,
@@ -3479,7 +3456,7 @@ MODULE_SCOPE void TclpThreadDeleteKey(void *keyPtr);
MODULE_SCOPE void TclpThreadSetGlobalTSD(void *tsdKeyPtr, void *ptr);
MODULE_SCOPE void * TclpThreadGetGlobalTSD(void *tsdKeyPtr);
MODULE_SCOPE void TclErrorStackResetIf(Tcl_Interp *interp,
const char *msg, Tcl_Size length);
const char *msg, int length);
/* Tip 430 */
MODULE_SCOPE int TclZipfs_Init(Tcl_Interp *interp);
@@ -3569,7 +3546,7 @@ MODULE_SCOPE int TclDictWithFinish(Tcl_Interp *interp, Var *varPtr,
Tcl_Obj *part2Ptr, int index, int pathc,
Tcl_Obj *const pathv[], Tcl_Obj *keysPtr);
MODULE_SCOPE Tcl_Obj * TclDictWithInit(Tcl_Interp *interp, Tcl_Obj *dictPtr,
Tcl_Size pathc, Tcl_Obj *const pathv[]);
int pathc, Tcl_Obj *const pathv[]);
MODULE_SCOPE Tcl_ObjCmdProc Tcl_DisassembleObjCmd;
/* Assemble command function */
@@ -4092,16 +4069,16 @@ MODULE_SCOPE int TclCompileAssembleCmd(Tcl_Interp *interp,
* candidates for public interface.
*/
MODULE_SCOPE Tcl_Obj * TclStringCat(Tcl_Interp *interp, Tcl_Size objc,
MODULE_SCOPE Tcl_Obj * TclStringCat(Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[], int flags);
MODULE_SCOPE Tcl_Obj * TclStringFirst(Tcl_Obj *needle, Tcl_Obj *haystack,
Tcl_Size start);
int start);
MODULE_SCOPE Tcl_Obj * TclStringLast(Tcl_Obj *needle, Tcl_Obj *haystack,
Tcl_Size last);
int last);
MODULE_SCOPE Tcl_Obj * TclStringRepeat(Tcl_Interp *interp, Tcl_Obj *objPtr,
Tcl_Size count, int flags);
int count, int flags);
MODULE_SCOPE Tcl_Obj * TclStringReplace(Tcl_Interp *interp, Tcl_Obj *objPtr,
Tcl_Size first, Tcl_Size count, Tcl_Obj *insertPtr,
int first, int count, Tcl_Obj *insertPtr,
int flags);
MODULE_SCOPE Tcl_Obj * TclStringReverse(Tcl_Obj *objPtr, int flags);
@@ -4216,7 +4193,7 @@ 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 Tcl_Size TclIndexDecode(int encoded, Tcl_Size endValue);
MODULE_SCOPE int TclIndexDecode(int encoded, int endValue);
/* Constants used in index value encoding routines. */
#define TCL_INDEX_END ((Tcl_Size)-2)
@@ -4469,6 +4446,9 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file,
# define TclDecrRefCount(objPtr) \
Tcl_DbDecrRefCount(objPtr, __FILE__, __LINE__)
# define TclNewListObjDirect(objc, objv) \
TclDbNewListObjDirect(objc, objv, __FILE__, __LINE__)
#undef USE_THREAD_ALLOC
#endif /* TCL_MEM_DEBUG */
@@ -4807,8 +4787,6 @@ MODULE_SCOPE Tcl_LibraryInitProc TclThread_Init;
MODULE_SCOPE Tcl_LibraryInitProc Procbodytest_Init;
MODULE_SCOPE Tcl_LibraryInitProc Procbodytest_SafeInit;
/*
*----------------------------------------------------------------
* Macro used by the Tcl core to check whether a pattern has any characters
@@ -5193,7 +5171,7 @@ typedef struct NRE_callback {
#define TCLNR_FREE(interp, ptr) TclSmallFreeEx((interp), (ptr))
#else
#define TCLNR_ALLOC(interp, ptr) \
((ptr) = (void *)ckalloc(sizeof(NRE_callback)))
((ptr) = ((void *)ckalloc(sizeof(NRE_callback))))
#define TCLNR_FREE(interp, ptr) ckfree(ptr)
#endif
@@ -5206,10 +5184,11 @@ typedef struct NRE_callback {
#include "tclIntDecls.h"
#include "tclIntPlatDecls.h"
#if !defined(USE_TCL_STUBS) && !defined(TCL_MEM_DEBUG)
#define Tcl_AttemptAlloc TclpAlloc
#define Tcl_AttemptRealloc TclpRealloc
#define Tcl_Free TclpFree
#define Tcl_AttemptAlloc(size) TclpAlloc(size)
#define Tcl_AttemptRealloc(ptr, size) TclpRealloc((ptr), (size))
#define Tcl_Free(ptr) TclpFree(ptr)
#endif
/*
@@ -5241,7 +5220,7 @@ MODULE_SCOPE size_t TclEnvEpoch; /* Epoch of the tcl environment
* (if changed with tcl-env). */
#endif /* _TCLINT */
/*
* Local Variables:
* mode: c
+2 -2
View File
@@ -227,7 +227,7 @@ void TclpGetTime(Tcl_Time *time);
/* Slot 79 is reserved */
/* Slot 80 is reserved */
/* 81 */
EXTERN void * TclpRealloc(void *ptr, TCL_HASH_TYPE size);
EXTERN void * TclpRealloc(void *ptr, unsigned int size);
/* Slot 82 is reserved */
/* Slot 83 is reserved */
/* Slot 84 is reserved */
@@ -751,7 +751,7 @@ typedef struct TclIntStubs {
void (*reserved78)(void);
void (*reserved79)(void);
void (*reserved80)(void);
void * (*tclpRealloc) (void *ptr, TCL_HASH_TYPE size); /* 81 */
void * (*tclpRealloc) (void *ptr, unsigned int size); /* 81 */
void (*reserved82)(void);
void (*reserved83)(void);
void (*reserved84)(void);
+1 -1
View File
@@ -580,7 +580,7 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr;
#undef TclpCreateTempFile_
#undef TclUnixWaitForFile_
#ifndef MAC_OSX_TCL /* not accessible on Win32/UNIX */
#ifndef MAC_OSX_TCL /* not accessable on Win32/UNIX */
#undef TclMacOSXGetFileAttribute /* 15 */
#undef TclMacOSXSetFileAttribute /* 16 */
#undef TclMacOSXCopyFileAttributes /* 17 */
+6 -6
View File
@@ -61,7 +61,7 @@ typedef struct Alias {
Tcl_Obj *objPtr; /* The first actual prefix object - the target
* command name; this has to be at the end of
* the structure, which will be extended to
* accommodate the remaining objects in the
* accomodate the remaining objects in the
* prefix. */
} Alias;
@@ -198,7 +198,7 @@ struct LimitHandler {
/*
* Values for the LimitHandler flags field.
* LIMIT_HANDLER_ACTIVE - Whether the handler is currently being
* processed; handlers are never to be reentered.
* processed; handlers are never to be entered reentrantly.
* LIMIT_HANDLER_DELETED - Whether the handler has been deleted. This
* should not normally be observed because when a handler is
* deleted it is also spliced out of the list of handlers, but
@@ -827,7 +827,7 @@ NRInterpCmd(
for (i = 0; ; i++) {
Tcl_CmdInfo cmdInfo;
snprintf(buf, sizeof(buf), "interp%d", i);
sprintf(buf, "interp%d", i);
if (Tcl_GetCommandInfo(interp, buf, &cmdInfo) == 0) {
break;
}
@@ -1111,7 +1111,7 @@ NRInterpCmd(
if (hPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"alias \"%s\" in path \"%s\" not found",
aliasName, TclGetString(objv[2])));
aliasName, Tcl_GetString(objv[2])));
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "ALIAS", aliasName,
NULL);
return TCL_ERROR;
@@ -3320,7 +3320,7 @@ TclMakeSafe(
Tcl_UnsetVar2(interp, "tcl_platform", "user", TCL_GLOBAL_ONLY);
/*
* Unset path information variables (the only one remaining is [info
* Unset path informations variables (the only one remaining is [info
* nameofexecutable])
*/
@@ -4284,7 +4284,7 @@ CallScriptLimitCallback(
* None.
*
* Side effects:
* A limit callback implemented as an invocation of a Tcl script in
* A limit callback implemented as an invokation of a Tcl script in
* another interpreter is either installed or removed.
*
*----------------------------------------------------------------------
+1 -1
View File
@@ -830,7 +830,7 @@ LinkTraceProc(
/*
* For writes, first make sure that the variable is writable. Then convert
* the Tcl value to C if possible. If the variable isn't writable or can't
* be converted, then restore the variable's old value and return an
* be converted, then restore the varaible's old value and return an
* error. Another tricky thing: we have to save and restore the interp's
* result, since the variable access could occur when the result has been
* partially set.
+49 -55
View File
@@ -1602,7 +1602,6 @@ ListRepRange(
Tcl_Obj *
TclListObjRange(
Tcl_Interp *interp, /* May be NULL. Used for error messages */
Tcl_Obj *listObj, /* List object to take a range from. */
Tcl_Size rangeStart, /* Index of first element to include. */
Tcl_Size rangeEnd) /* Index of last element to include. */
@@ -1611,7 +1610,7 @@ TclListObjRange(
ListRep resultRep;
int isShared;
if (TclListObjGetRep(interp, listObj, &listRep) != TCL_OK)
if (TclListObjGetRep(NULL, listObj, &listRep) != TCL_OK)
return NULL;
isShared = Tcl_IsShared(listObj);
@@ -1879,27 +1878,24 @@ Tcl_ListObjAppendList(
*
* Tcl_ListObjAppendElement --
*
* Like 'Tcl_ListObjAppendList', but Appends a single value to a list.
* This function is a special purpose version of Tcl_ListObjAppendList:
* it appends a single object referenced by elemObj to the list object
* referenced by toObj. If toObj is not already a list object, an
* attempt will be made to convert it to one.
*
* Value
* Results:
* The return value is normally TCL_OK; in this case elemObj is added to
* the end of toObj's list. If toObj 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.
*
* 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 array of element pointers
* in 'listObj' to grow. Any preexisting string representation of
* 'listPtr' is invalidated.
* Side effects:
* The ref count of elemObj is incremented since the list now refers to
* it. toObj will be converted, if necessary, to a list object. Also,
* appending the new element may cause listObj's array of element
* pointers to grow. toObj's old string representation, if any, is
* invalidated.
*
*----------------------------------------------------------------------
*/
@@ -1921,27 +1917,23 @@ Tcl_ListObjAppendElement(
*
* Tcl_ListObjIndex --
*
* Retrieve a pointer to the element of 'listPtr' at 'index'. The index
* of the first element is 0.
* 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.
*
* Value
* 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.
*
* 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 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.
* Side effects:
* listPtr will be converted, if necessary, to a list object.
*
*----------------------------------------------------------------------
*/
@@ -2101,12 +2093,12 @@ Tcl_ListObjReplace(
}
if (numToDelete < 0) {
numToDelete = 0;
} else if (first > LIST_MAX - numToDelete /* Handle integer overflow */
} else if (first > ListSizeT_MAX - numToDelete /* Handle integer overflow */
|| origListLen < first + numToDelete) {
numToDelete = origListLen - first;
}
if (numToInsert > LIST_MAX - (origListLen - numToDelete)) {
if (numToInsert > ListSizeT_MAX - (origListLen - numToDelete)) {
return ListLimitExceededError(interp);
}
@@ -2343,7 +2335,7 @@ Tcl_ListObjReplace(
*/
/*
* Calculate shifts if necessary to accommodate insertions.
* Calculate shifts if necessary to accomodate insertions.
* NOTE: all indices are relative to listObjs which is not necessarily the
* start of the ListStore storage area.
*
@@ -2567,7 +2559,7 @@ TclLindexList(
* see TIP#22 and TIP#33 for the details.
*/
if (!TclHasInternalRep(argObj, &tclListType)
&& TclGetIntForIndexM(NULL, argObj, TCL_SIZE_MAX - 1, &index)
&& TclGetIntForIndexM(NULL, argObj, ListSizeT_MAX - 1, &index)
== TCL_OK) {
/*
* argPtr designates a single index.
@@ -2693,7 +2685,7 @@ TclLindexFlat(
while (++i < indexCount) {
if (TclGetIntForIndexM(
interp, indexArray[i], TCL_SIZE_MAX - 1, &index)
interp, indexArray[i], ListSizeT_MAX - 1, &index)
!= TCL_OK) {
Tcl_DecrRefCount(sublistCopy);
return NULL;
@@ -2758,7 +2750,7 @@ TclLsetList(
*/
if (!TclHasInternalRep(indexArgObj, &tclListType)
&& TclGetIntForIndexM(NULL, indexArgObj, TCL_SIZE_MAX - 1, &index)
&& TclGetIntForIndexM(NULL, indexArgObj, ListSizeT_MAX - 1, &index)
== TCL_OK) {
/* indexArgPtr designates a single index. */
/* T:listrep-1.{2.1,12.1,15.1,19.1},2.{2.3,9.3,10.1,13.1,16.1}, 3.{4,5,6}.3 */
@@ -2777,7 +2769,7 @@ TclLsetList(
ListObjGetElements(indexListCopy, indexCount, indices);
/*
* Let TclLsetFlat perform the actual lset operation.
* Let TclLsetFlat handle the actual lset'ting.
*/
retValueObj = TclLsetFlat(interp, listObj, indexCount, indices, valueObj);
@@ -3406,16 +3398,18 @@ fail:
*
* UpdateStringOfList --
*
* Update the string representation for a list object.
* 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.
*
* Any previously-existing string representation is not invalidated, so
* storage is lost if this has not been taken care of.
* Results:
* None.
*
* 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.
* 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.
*
*----------------------------------------------------------------------
*/
+6 -6
View File
@@ -400,7 +400,7 @@ TclRegisterLiteral(
int flags) /* If LITERAL_ON_HEAP then the caller already
* malloc'd bytes and ownership is passed to
* this function. If LITERAL_CMD_NAME then
* the literal should not be shared across
* the literal should not be shared accross
* namespaces. */
{
CompileEnv *envPtr = (CompileEnv *)ePtr;
@@ -444,7 +444,7 @@ TclRegisterLiteral(
/*
* The literal is new to this CompileEnv. If it is a command name, avoid
* sharing it across namespaces, and try not to share it with non-cmd
* sharing it accross namespaces, and try not to share it with non-cmd
* literals. Note that FQ command names can be shared, so that we register
* the namespace as the interp's global NS.
*/
@@ -1134,18 +1134,18 @@ TclLiteralStats(
*/
result = (char *)ckalloc(NUM_COUNTERS*60 + 300);
snprintf(result, 60, "%d entries in table, %d buckets\n",
sprintf(result, "%d entries in table, %d buckets\n",
tablePtr->numEntries, tablePtr->numBuckets);
p = result + strlen(result);
for (i=0 ; i<NUM_COUNTERS ; i++) {
snprintf(p, 60, "number of buckets with %" TCL_Z_MODIFIER "u entries: %" TCL_Z_MODIFIER "u\n",
sprintf(p, "number of buckets with %" TCL_Z_MODIFIER "u entries: %" TCL_Z_MODIFIER "u\n",
i, count[i]);
p += strlen(p);
}
snprintf(p, 60, "number of buckets with %d or more entries: %d\n",
sprintf(p, "number of buckets with %d or more entries: %d\n",
NUM_COUNTERS, overflow);
p += strlen(p);
snprintf(p, 60, "average search distance for entry: %.1f", average);
sprintf(p, "average search distance for entry: %.1f", average);
return result;
}
#endif /*TCL_COMPILE_STATS*/
+3 -5
View File
@@ -417,8 +417,6 @@ Tcl_PopCallFrame(
framePtr->nsPtr = NULL;
if (framePtr->tailcallPtr) {
/* Reusing the existing reference count from framePtr->tailcallPtr, so
* no need to Tcl_IncrRefCount(framePtr->tailcallPtr)*/
TclSetTailcall(interp, framePtr->tailcallPtr);
}
}
@@ -4209,7 +4207,7 @@ UnlinkNsPath(
* Side effects:
* Increments the command reference epoch in each namespace whose path
* includes the given namespace. This causes any cached resolved names
* whose root caching context starts at that namespace to be recomputed
* whose root cacheing context starts at that namespace to be recomputed
* the next time they are used.
*
*----------------------------------------------------------------------
@@ -4282,7 +4280,7 @@ NamespaceQualifiersCmd(
if ((*p == ':') && (p > name) && (*(p-1) == ':')) {
p -= 2; /* Back up over the :: */
while ((p >= name) && (*p == ':')) {
p--; /* Back up over the preceding : */
p--; /* Back up over the preceeding : */
}
break;
}
@@ -4561,7 +4559,7 @@ NamespaceTailCmd(
*
* Side effects:
* Creates new variables in the current scope, linked to the
* corresponding variables in the stipulated namespace. If anything goes
* corresponding variables in the stipulated nmamespace. If anything goes
* wrong, the result is an error message.
*
*----------------------------------------------------------------------
+6 -6
View File
@@ -1027,12 +1027,12 @@ Tcl_DoOneEvent(
}
/*
* If Tcl_WaitForEvent has returned 1, indicating that one system event
* has been dispatched (and thus that some Tcl code might have been
* indirectly executed), we break out of the loop in order, e.g. to
* give vwait a chance to determine whether that system event had the
* side effect of changing the variable (so the vwait can return and
* unwind properly).
* If Tcl_WaitForEvent has returned 1, indicating that one system
* event has been dispatched (and thus that some Tcl code might have
* been indirectly executed), we break out of the loop. We do this to
* give VwaitCmd for instance a chance to check if that system event
* had the side effect of changing the variable (so the vwait can
* return and unwind properly).
*
* NB: We will process idle events if any first, because otherwise we
* might never do the idle events if the notifier always gets
+6 -53
View File
@@ -3,7 +3,7 @@
*
* This file contains the object-system core (NB: not Tcl_Obj, but ::oo)
*
* Copyright © 2005-2019 Donal K. Fellows
* Copyright © 2005-2012 Donal K. Fellows
* Copyright © 2017 Nathan Coulter
*
* See the file "license.terms" for information on usage and redistribution of
@@ -327,7 +327,6 @@ InitFoundation(
DeletedObjdefNamespace);
fPtr->helpersNs = Tcl_CreateNamespace(interp, "::oo::Helpers", fPtr,
DeletedHelpersNamespace);
Tcl_CreateNamespace(interp, "::oo::configuresupport", NULL, NULL);
fPtr->epoch = 0;
fPtr->tsdPtr = tsdPtr;
TclNewLiteralStringObj(fPtr->unknownMethodNameObj, "unknown");
@@ -655,7 +654,7 @@ AllocObject(
while (1) {
char objName[10 + TCL_INTEGER_SPACE];
snprintf(objName, sizeof(objName), "::oo::Obj%d", ++fPtr->tsdPtr->nsCount);
sprintf(objName, "::oo::Obj%d", ++fPtr->tsdPtr->nsCount);
oPtr->namespacePtr = Tcl_CreateNamespace(interp, objName, oPtr, NULL);
if (oPtr->namespacePtr != NULL) {
creationEpoch = fPtr->tsdPtr->nsCount;
@@ -965,7 +964,7 @@ TclOOReleaseClassContents(
Class *clsPtr = oPtr->classPtr, *tmpClsPtr;
Method *mPtr;
Foundation *fPtr = oPtr->fPtr;
Tcl_Obj *variableObj, *propertyObj;
Tcl_Obj *variableObj;
PrivateVariableMapping *privateVariable;
/*
@@ -1018,29 +1017,6 @@ TclOOReleaseClassContents(
clsPtr->classChainCache = NULL;
}
/*
* Squelch the property lists.
*/
if (clsPtr->properties.allReadableCache) {
Tcl_DecrRefCount(clsPtr->properties.allReadableCache);
}
if (clsPtr->properties.allWritableCache) {
Tcl_DecrRefCount(clsPtr->properties.allWritableCache);
}
if (clsPtr->properties.readable.num) {
FOREACH(propertyObj, clsPtr->properties.readable) {
Tcl_DecrRefCount(propertyObj);
}
ckfree(clsPtr->properties.readable.list);
}
if (clsPtr->properties.writable.num) {
FOREACH(propertyObj, clsPtr->properties.writable) {
Tcl_DecrRefCount(propertyObj);
}
ckfree(clsPtr->properties.writable.list);
}
/*
* Squelch our filter list.
*/
@@ -1142,7 +1118,7 @@ ObjectNamespaceDeleted(
FOREACH_HASH_DECLS;
Class *mixinPtr;
Method *mPtr;
Tcl_Obj *filterObj, *variableObj, *propertyObj;
Tcl_Obj *filterObj, *variableObj;
PrivateVariableMapping *privateVariable;
Tcl_Interp *interp = oPtr->fPtr->interp;
int i;
@@ -1158,7 +1134,7 @@ ObjectNamespaceDeleted(
/*
* One rule for the teardown routines is that if an object is in the
* process of being deleted, nothing else may modify its bookkeeping
* process of being deleted, nothing else may modify its bookeeping
* records. This is the flag that
*/
@@ -1211,7 +1187,7 @@ ObjectNamespaceDeleted(
if (((Command *) oPtr->command)->flags && CMD_DYING) {
/*
* Something has already started the command deletion process. We can
* go ahead and clean up the namespace,
* go ahead and clean up the the namespace,
*/
} else {
/*
@@ -1295,29 +1271,6 @@ ObjectNamespaceDeleted(
oPtr->metadataPtr = NULL;
}
/*
* Squelch the property lists.
*/
if (oPtr->properties.allReadableCache) {
Tcl_DecrRefCount(oPtr->properties.allReadableCache);
}
if (oPtr->properties.allWritableCache) {
Tcl_DecrRefCount(oPtr->properties.allWritableCache);
}
if (oPtr->properties.readable.num) {
FOREACH(propertyObj, oPtr->properties.readable) {
Tcl_DecrRefCount(propertyObj);
}
ckfree(oPtr->properties.readable.list);
}
if (oPtr->properties.writable.num) {
FOREACH(propertyObj, oPtr->properties.writable) {
Tcl_DecrRefCount(propertyObj);
}
ckfree(oPtr->properties.writable.list);
}
/*
* Because an object can be a class that is an instance of itself, the
* class object's class structure should only be cleaned after most of

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