Compare commits

...
Author SHA1 Message Date
dgp 5893756a8c Revise writing to binary channels so that non-byte characters get replaced
with a replacement character ("?" for iso8859-1).
2020-03-30 20:59:03 +00:00
dgp 26bd764323 Merge 8.6; revise to use TclGetBytesFromObj. 2020-03-30 15:51:00 +00:00
dgp 68a12bf6aa Optimize [binary decode hex] to process bytearray without string generation
when it can.
2020-03-30 15:48:17 +00:00
jan.nijtmans 60d0ed0069 Initialize Tcl_UniChar's, in case we are handling surrogates (however unlikely). 2020-03-30 15:27:43 +00:00
dgp 8139a8a595 Merge 8.6, revise to use TclGetBytesFromObj. 2020-03-30 15:13:53 +00:00
dgp 987ffc2687 Optimize [binary decode uuencode] to process bytearray without string
generation when it can.
2020-03-30 15:09:40 +00:00
jan.nijtmans bcfc4a29c5 Merge 8.6 2020-03-30 13:00:44 +00:00
jan.nijtmans 1d7fa6b53d genStubs.tcl: Only do an "append line" when there really is something to be done. 2020-03-30 12:59:29 +00:00
jan.nijtmans aa371355b1 Optimize TclStringFirst/TclStringLast: Let it return a Tcl_Obj * in stead of an int, so its callers don't need to do the conversion any more. 2020-03-30 11:37:54 +00:00
jan.nijtmans 4cbd0649ef Merge 8.6 2020-03-30 10:30:30 +00:00
jan.nijtmans 97ab1046f9 tcltest.tcl: Only adapt "filesMade" variable if the file to be removed is actually found.
tcltest 2.5.2 -> 2.5.3
2020-03-30 10:25:44 +00:00
dgp 7a81cc7b2b merge 8.6 2020-03-28 19:39:42 +00:00
dgp e7e6720ba4 Add a test for fixed bug. 2020-03-28 19:25:54 +00:00
dgp a32dffe303 [8edfcedfa0] [binary encode base64] build a string instead of a bytearray
whenever it might be required to get the right result.
2020-03-28 19:21:56 +00:00
dgp 65c57e8170 Make sure maxlen value does not rely on ordering of options. 2020-03-28 18:52:16 +00:00
dgp beae292420 Revise comment that was a plain lie. 2020-03-28 18:28:42 +00:00
dgp 65c59cb146 Missing error codes from decoder routines. 2020-03-28 18:23:43 +00:00
dgp 29cb05c855 Optimize base64 decoder to work on bytearrays without string generation. 2020-03-28 17:35:23 +00:00
dgp f5621cf853 merge 8.6 2020-03-28 16:33:50 +00:00
dgp c619f65f15 [ffeb2097af] Restore the standard and original practice of ignoring invalid
characters when decoding base64. Error only in -strict mode. See RFC 2045.
2020-03-28 15:35:12 +00:00
dgp 3cd192c81c Further improvement. Report invalid multi-byte characters accurately. 2020-03-27 21:52:42 +00:00
dgp 74657995c7 Improve error reporting. If codepoint looks negative, bad char is reported
as REPLACEMENT CHARACTER, which is wrong, therefore not helpful.
2020-03-27 21:21:28 +00:00
jan.nijtmans a30671934a Merge 8.6 2020-03-27 21:06:19 +00:00
jan.nijtmans 250116c887 Fix [767e070d35]: Tcl_GetRange and Tcl_GetUniChar do not validate index inputs. Backported from 8.7 (where it already was fixed as part of TIP #542 implementation) 2020-03-27 20:58:33 +00:00
dgp 2b68efb386 Repair bad test labels. 2020-03-27 18:02:02 +00:00
jan.nijtmans afa1204d07 Merge 8.6 2020-03-27 16:28:03 +00:00
jan.nijtmans 0a00f85f84 Looks like this little hack is no longer necessary on current 32-bit Cygwin. 2020-03-27 16:24:30 +00:00
jan.nijtmans 82b83bb7a6 Merge 8.6 2020-03-27 12:06:38 +00:00
jan.nijtmans 5c2d281edc Fix harmless gcc warning, when compiling on Linux 2020-03-27 12:05:39 +00:00
jan.nijtmans 9a007031fa Fix [767e070d35]: Tcl_GetRange and Tcl_GetUniChar do not validate index inputs 2020-03-27 10:33:08 +00:00
jan.nijtmans 841855aced Merge 8.6 2020-03-25 17:06:52 +00:00
jan.nijtmans 4005a8776e Little typo 2020-03-25 17:06:03 +00:00
jan.nijtmans b86333ba01 Merge 8.6 2020-03-25 15:03:06 +00:00
jan.nijtmans 6f438769bc Follow-up to [a9f61c48906b66f8]: Fill UNIX TclIntPlatDecls stub entry 5 with same entry from win32. Can be simplified further in 8.7/9.0. 2020-03-25 14:48:44 +00:00
jan.nijtmans 652e994c73 Merge 8.6 2020-03-24 13:34:44 +00:00
jan.nijtmans 9acd2dacaa Spurious test-failure on Travis OSX 2020-03-24 13:31:42 +00:00
jan.nijtmans 3f3b063fc1 Merge 8.6. If compiled with -DTCL_NO_DEPRECATED, remove Tcl_MacOSXOpenBundleResources() completely 2020-03-24 10:59:21 +00:00
jan.nijtmans 6a93c7f370 MacOS: Make Tcl_MacOSXOpenBundleResources() a macro calling Tcl_MacOSXOpenVersionedBundleResources: One more stub entry which can be removed in Tcl 9.0 2020-03-24 10:42:49 +00:00
jan.nijtmans 26039c20d8 Fill UNIX TclIntPlatDecls stub entries 15 up to 19 and 22 with same functions as for win32. Not used in 8.6 yet.
This is a step on the way, making the TclIntPlatDecls stub table the same for all platforms in 9.0
2020-03-24 10:34:48 +00:00
jan.nijtmans e1c726c819 Merge 8.6 2020-03-22 21:24:31 +00:00
jan.nijtmans 833501b319 Even more uppercase HEX representations in source-code 2020-03-22 21:16:21 +00:00
jan.nijtmans a6d6075761 Resolve gcc compiler warnings, only on 32-bit builds (gcc-7) 2020-03-20 17:16:28 +00:00
dgp bb70971aa9 Improve the standard error message for nonbyte arguments. 2020-03-18 20:48:32 +00:00
jan.nijtmans 176431f584 Merge 8.6 2020-03-18 13:54:06 +00:00
jan.nijtmans af7fa225c1 More uppercase HEX representations in source-code. 2020-03-18 12:51:30 +00:00
jan.nijtmans ae243c85b7 Merge 8.6 2020-03-17 16:45:47 +00:00
jan.nijtmans 27c27e941a Merge 8.5. Mainly add Unicode 13 new plane 3 characters to the internal Unicode tables. Not used in 8.6 yet. 2020-03-17 16:35:51 +00:00
jan.nijtmans 50eee151a9 Unicode 13 has a new range of characters from 0x30000 to 0x3134A, so generate those in the tables too.
Add one reserved stub entry (Backported from 8.6)
2020-03-17 16:19:17 +00:00
dgp cb291b4c47 a few more 2020-03-17 01:03:05 +00:00
dgp dc763386a9 TIP 569 - remove lint comments 2020-03-17 01:01:25 +00:00
jan.nijtmans 23bd4dbf08 merge-mark 2020-03-15 22:24:01 +00:00
jan.nijtmans 07cfb2190f Add one more reserved stub entry, most likely will be Tcl_GetBytesFromObj() in Tcl 8.7. 2020-03-15 22:21:27 +00:00
jan.nijtmans 27ee10bdf0 Merge 8.6. Also fix build with -DTCL_NO_DEPRECATED (which was also the cause of the "master" build failure) 2020-03-15 12:11:51 +00:00
jan.nijtmans 13be49f585 Make ourEnviron type (techar **) not (char **), so we need less type-casts. 2020-03-15 12:03:21 +00:00
jan.nijtmans ad02769933 Merge 8.6 2020-03-14 22:07:25 +00:00
jan.nijtmans bb05d544ee Fix one wrong type-cast (only causing warning, nothing serious) 2020-03-14 22:06:08 +00:00
jan.nijtmans 6751485187 Merge 8.6 2020-03-14 21:52:01 +00:00
jan.nijtmans 7070324787 Convert many test-cases to modern test syntax 2020-03-14 21:21:10 +00:00
jan.nijtmans 9b8409d9e9 Fix [8f89e2e059aafa1c]: Windows: environment is not reflected properly (special characters). Thanks to sebres for patch and test-case! 2020-03-14 21:02:12 +00:00
dgp e3e05a2cf9 Need declaration too. 2020-03-13 18:55:10 +00:00
dgp fdfd0ad0b6 New internal routine TclGetBytesFromObj().
Aimed to become public, see TIP 568 in progress.
2020-03-13 18:32:45 +00:00
jan.nijtmans 91484ba1c9 Merge 8.6.
Code review: Tcl 8.6 doesn't (need to) build with -DUNICODE -D_UNICODE any more, so things can be simplified. Good work, thanks!
2020-03-13 14:45:34 +00:00
sebres 72a735d089 fix back-ported from tclSE (with several modifications due to conflicts and compat reasons) 2020-03-13 13:08:15 +00:00
sebres 86581b5325 env.test: added test for windows illustrating bug [8f89e2e059] - loss of multi-byte chars in environment if single-byte system encoding used 2020-03-13 13:06:53 +00:00
jan.nijtmans f7550ff059 Merge 8.6 2020-03-13 11:03:14 +00:00
jan.nijtmans 068df4904b reformat assemble-15.* test-cases 2020-03-13 11:01:34 +00:00
dgp 442f4cfd68 Minimal fix for crash bug. 2020-03-12 20:54:09 +00:00
dgp bebe16e96c Merge new tests. Reveals crash in Tcl 8.7 implementation. 2020-03-12 17:38:30 +00:00
dgp 5d52fb6a3f Renumber tests to account for later releases. 2020-03-12 17:37:16 +00:00
dgp 46e5b17ffb Add some testing of Tcl_SetByteArrayLength(). 2020-03-12 17:29:33 +00:00
sebres e13a8e77f2 fixes segfault [234d6c811d]: "lpop" on empty list variable without index + new test case 2020-03-11 15:51:06 +00:00
sebres 7cf28a1e23 close [234d6c811d]: fixed segfault on empty list variable by "lpop" without index 2020-03-11 15:48:07 +00:00
sebres 14fd6b059e lpop.test: added test illustrating segfault in [234d6c811d] (and small review - stability of tests depending on outside circumstances, e. g. in case of -singleproc) 2020-03-11 15:33:28 +00:00
jan.nijtmans f13b7726c4 Fix Windows build, broken by [d5175f6050e308f4] 2020-03-10 13:51:25 +00:00
dgp 065483ce8b Mac fix 2020-03-09 16:24:52 +00:00
dgp 683144e7f0 TCL_UNUSED for win sources. 2020-03-09 16:13:11 +00:00
dgp 8816b1a873 TCL_UNUSED in the unix sources. 2020-03-09 15:45:52 +00:00
dgp 1baa16d30d need internal header now. 2020-03-09 14:43:18 +00:00
dgp bd4dfc850e Bring TCL_UNUSED to macosx sources. 2020-03-09 14:40:27 +00:00
dgp a5406cf5c0 more 2020-03-09 14:34:27 +00:00
dgp a8870a4fae More 2020-03-09 13:15:02 +00:00
jan.nijtmans 4f3c0fa94f Use more uppercase hex (e.g. 0xFF) in stead of lowercase (0xff) consistantly. 2020-03-09 12:49:41 +00:00
dgp 42e6e9b167 More TCL_UNUSED 2020-03-09 12:31:47 +00:00
dgp 085094bd87 More TCL_UNUSED. 2020-03-08 13:58:07 +00:00
jan.nijtmans 89b0bdb882 Move TCL_UNUSED to tclInt.h, so we can still deprecate JOIN() 2020-03-07 18:25:27 +00:00
jan.nijtmans 467d03dbc9 Change (interal) function signature of TclpAlloc/TclpRealloc/TclpFree, using (void *) in stead of (char *) 2020-03-07 15:55:35 +00:00
dgp b8ffa18096 Unused arguments in the OO source code files. 2020-03-07 00:41:42 +00:00
dgp fa6d9198c0 more 2020-03-06 23:44:14 +00:00
dgp 81e31a16d8 More unused arguments through the IO code. 2020-03-06 21:22:28 +00:00
dgp a619fad748 more 2020-03-06 20:57:28 +00:00
dgp d599e21dbc more unused arguments 2020-03-06 20:46:51 +00:00
dgp b996359ed1 merge 8.6 2020-03-06 20:34:25 +00:00
dgp 2cd124a28e Remove SetIndexFromAny(), a useless routine that can only be reached via
unsupported shenanigans.
2020-03-06 20:32:47 +00:00
dgp b88a8f3dd9 more 2020-03-06 20:23:01 +00:00
dgp 9bfe372421 more 2020-03-06 20:15:24 +00:00
dgp e72ebf58a1 (no comment) 2020-03-06 20:01:56 +00:00
dgp 3f741fda03 (no comment) 2020-03-06 19:58:14 +00:00
dgp e870d650fd more unused arguments 2020-03-06 19:29:59 +00:00
dgp 3db7dab605 more of the same 2020-03-06 18:31:49 +00:00
dgp e84e229fd5 More TCL_UNUSED(). 2020-03-06 18:02:25 +00:00
dgp c0a030fa0b More TCL_UNUSED deployment 2020-03-06 16:42:07 +00:00
dgp 62a2883b43 More TCL_UNUSED deployment. 2020-03-06 14:41:02 +00:00
dgp d38d34e937 Untangle some MEM_DEBUG ifdeffery. 2020-03-06 13:55:07 +00:00
dgp 39956f875b More deployment of TCL_UNUSED. (Travis appears happy with it). 2020-03-06 13:45:00 +00:00
dgp 02ceb3f3a4 Have to move the JOIN() macro out of deprecation for this TCL_UNUSED.
Alternatives welcome.
2020-03-05 19:17:34 +00:00
dgp 39cde7c069 Merge TCL_UNUSED to dev branches for full Travis testing as a tool to arrest
the undesirable explosion of "(void)dummy" through the codebase.
2020-03-05 19:09:15 +00:00
jan.nijtmans f5a3d0b135 Merge 8.6 2020-03-05 14:42:36 +00:00
jan.nijtmans 9cc797aba7 Update to Unicode-13 2020-03-05 14:39:23 +00:00
jan.nijtmans 36d1b8447c Update all internal tables to Unicode 13.
(while on it) sync tclWinDdde.c and tclWinReg.c, making it 100% identical to other branches.
2020-03-05 14:03:59 +00:00
jan.nijtmans 6daca5d73a Merge 8.6 2020-03-05 11:48:21 +00:00
jan.nijtmans 38aabeeca8 Move setting of interpreter error-message from tclUnixSock.c to tclIO.c, since the same should be done for all channel types. (Thanks, Don, for noticing this!)
Also, ENOTCONN for a half-close should not be fatal, just a EINVAL, when doing it as part of a full close. See: [65c9cd1534]
2020-03-05 11:32:43 +00:00
dgp 0bee61f5cd merge 8.6 2020-03-04 21:00:44 +00:00
dgp dd7b6e2245 The close routines of the "tcp" channel type were failing to record error
messages and error codes.
2020-03-04 20:50:38 +00:00
jan.nijtmans 9d172afc1b Merge 8.6 2020-03-04 16:17:26 +00:00
jan.nijtmans 167bc4d8e7 Some more gcc(-9) warnings 2020-03-04 16:16:30 +00:00
jan.nijtmans 1ad756567b Merge 8.6 2020-03-04 15:55:38 +00:00
jan.nijtmans 3e92ec87df Fix some gcc(-9) warnings caused by -Wcast-function-type 2020-03-04 15:52:50 +00:00
jan.nijtmans f67e087180 Merge 8.6 2020-03-04 13:59:36 +00:00
jan.nijtmans 8defb7d10b Implement WideSeekProc() for all channels which have a SeekProc(). Implement Close2Proc() for all channels, as minimal wrapper around CloseProc().
Backported (with comments) and adapted from core-8-branch.
2020-03-04 13:42:42 +00:00
dgp 71e8c4c72b Create a new macro to deal with unused arguments so we can silence compiler
warnings without the need of an explosion of noise lines "(void)dummy"
2020-03-02 17:08:01 +00:00
jan.nijtmans ac5f46d270 Don't generate "deprecated" warning for Tcl_Close(), since only the stub entry is deprecated. Will be replaced by macro. 2020-03-02 11:30:05 +00:00
jan.nijtmans 520e0c9938 Better error-message in case of "index out of range", mentioning the actual index which was out of range. Also, use the same error-code, because the underlying cause is all the same. 2020-02-29 21:42:18 +00:00
jan.nijtmans 4cca9ff9e3 Minor TIP #562 fix: Missing #endif, results in (harmless) compiler warning when compiling with -DTCL_NO_DEPRECATED. 2020-02-28 14:23:34 +00:00
jan.nijtmans 57b1d9531c Implement TIP #562: Deprecate channel types 1-4 2020-02-28 13:13:07 +00:00
jan.nijtmans 52e543c569 Implement TIP #557: C++ support for Tcl 2020-02-28 12:06:07 +00:00
jan.nijtmans f9ddbba3d6 Merge 8.6 2020-02-26 14:05:44 +00:00
jan.nijtmans a4154b246b Resolve a number of shadowed variables (discovered by compiling with -Wshadow) 2020-02-26 13:45:40 +00:00
jan.nijtmans 24a416ad38 Merge 8.7 2020-02-26 10:58:01 +00:00
jan.nijtmans 5c61b2bbdc Merge 8.6 2020-02-26 08:04:34 +00:00
jan.nijtmans 14276a3feb Make tclWinDde.c compilable with C++ compiler. dde -> 1.4.3
Make tclWinReg.c compilable with C++ compiler. registry -> 1.3.5
2020-02-26 07:58:38 +00:00
jan.nijtmans 9eeda3feb2 Make tclWinDde.c compilable with C++ compiler. dde -> 1.4.3
Make tclWinReg.c compilable with C++ compiler. registry -> 1.3.5
2020-02-26 07:51:52 +00:00
dkf 1eeefb073a Ensure that we release the correct references when an error occurs during setting a class's superclasses 2020-02-25 15:07:51 +00:00
jan.nijtmans f0ead2e309 merge-mark 2020-02-24 13:16:53 +00:00
jan.nijtmans 0c37363fff Correct ANSI prototype of TclNokia770Doubles() 2020-02-24 13:07:13 +00:00
jan.nijtmans c7814dd59f Merge 8.6 2020-02-24 12:18:31 +00:00
jan.nijtmans 730152b608 Merge 8.5 2020-02-24 12:01:04 +00:00
jan.nijtmans 904ba06b0a Add -Wpointer-arith warning to C-compile. Fix gcc(-9) warning. 2020-02-24 11:07:18 +00:00
dkf fc3487d2b2 typo fix 2020-02-22 12:34:14 +00:00
jan.nijtmans 5eb39e3973 Fix [da235271f1]: [info hostname] on Windows is limited to max NetBIOS name length 2020-02-21 09:25:03 +00:00
jan.nijtmans 5c1a56d36b Merge 8.6 2020-02-21 08:52:54 +00:00
jan.nijtmans 1fb8e115c4 Restore compatibility with older (mingw) Makefiles. Fix for [4b5deacc70]: undefined reference to `Tcl_SetStartupScript'. 2020-02-21 08:46:15 +00:00
sebres e2bcebca79 merge 8.5 2020-02-17 14:52:54 +00:00
sebres 471091f55a windows: avoid create of legacy error-vars on init phase (in fresh created interpreter) - no tcl_pkgPath variable on windows 2020-02-17 14:50:45 +00:00
jan.nijtmans 958180f361 Merge-mark 2020-02-14 09:23:42 +00:00
jan.nijtmans 5c380477df (cherry-pick): Fix travis build, due to the change of Windows image. 2020-02-14 09:21:44 +00:00
jan.nijtmans 8c3eb78cf7 Merge 8.7 2020-02-13 22:06:10 +00:00
jan.nijtmans 541f9afd42 Merge 8.7 2020-02-12 13:26:52 +00:00
jan.nijtmans e7306ac7d8 Merge 8.7 2020-02-12 13:25:11 +00:00
jan.nijtmans 73cc9cd62f Merge 8.6 2020-02-12 13:18:27 +00:00
jan.nijtmans c11eec4d5d Fix travis build, due to the change of Windows image. 2020-02-12 13:12:08 +00:00
jan.nijtmans 0f3e54cedb Move build from xenial to bionic. Add Xcode11.3 build for MacOS (now that we are on it anyway) 2020-02-11 16:38:45 +00:00
jan.nijtmans 2a89abd783 Attempt to fix travis build. See: [https://travis-ci.community/t/vcvarsall-bat-freezes-on-new-1809-based-windows-images/7098] 2020-02-11 15:59:38 +00:00
jan.nijtmans 45f6edc21e Update all tables to [http://unicode.org/versions/Unicode13.0.0/|Unicode 13] (to be released March 10, 2020) 2020-02-11 13:31:32 +00:00
jan.nijtmans 55b841549a merge-mark 2020-02-05 16:41:25 +00:00
jan.nijtmans b1791f0b92 (cherry-pick): It appears that inttypes.h was introduced in Visual Studio 2013 2020-02-05 16:40:19 +00:00
jan.nijtmans 517974e23b Merge 8.6 2020-02-04 11:04:28 +00:00
jan.nijtmans 6f55ec4986 Clean up some usage of DBGX: It isn't used any more on UNIX 2020-02-04 11:03:12 +00:00
jan.nijtmans 225b4e7cc0 It appears that inttypes.h was introduced in Visual Studio 2013 2020-02-04 08:28:07 +00:00
jan.nijtmans f2ae531f0f Oopsee 2020-02-02 22:17:50 +00:00
jan.nijtmans 4c9136763a Deprecate Tcl_Close() stub entry as well 2020-02-02 22:11:38 +00:00
jan.nijtmans 4ee1ddaeaa TclInitBignumFromWide(U)Int is not used any more. 2020-02-02 16:26:36 +00:00
jan.nijtmans f06c1e0ba4 Fix conflict between (unpatched) tommath.h and tcl.h. See also [https://github.com/libtom/libtommath/pull/473] 2020-02-02 15:24:58 +00:00
jan.nijtmans bfad7e731e Make Tcl_ChannelCloseProc() deprecated too. Implement close2Proc and wideSeekProc for all internal channel types. 2020-01-31 14:58:07 +00:00
jan.nijtmans ff4989d192 Merge 8.7 2020-01-31 08:00:22 +00:00
jan.nijtmans cac60f04fc Add 64-bit seek to the ZipChannel 2020-01-31 07:54:59 +00:00
jan.nijtmans 75b437e696 Merge 8.7 2020-01-30 16:08:14 +00:00
sebres 944694962a merge 8.6 2020-01-30 15:44:23 +00:00
sebres 61962d02f5 merge 8.5 2020-01-30 15:39:56 +00:00
sebres f05d9af86d introduces new command and constraint testWithLimit (as include tests/internals.tcl) that can be used to test a code under restricted circumstances (e.g. limited address space) 2020-01-30 15:32:51 +00:00
jan.nijtmans c8c1298bb3 Merge 8.6 2020-01-30 13:54:01 +00:00
jan.nijtmans f58b90fb02 Reset WSAGetLastError()/errno always, even when this error is not reported due to the earlier error. 2020-01-30 13:52:58 +00:00
jan.nijtmans 64fdac4aec Merge 8.6 2020-01-30 13:21:38 +00:00
jan.nijtmans ee66478056 Simplify the use of HaveVersion() in Channel handling. Nothing functional, only code clean-up. 2020-01-30 13:04:12 +00:00
jan.nijtmans 56f2fc4f04 According to the [https://core.tcl-lang.org/tcl/artifact?udc=1&ln=469-471&name=5ac7827cd282bbda|documentation], close2Proc(...., 0) should operate the same as closeProc(). Fix the UNIX/Windows socket channels to behave like that. 2020-01-30 13:00:12 +00:00
sebres 782689d5eb small amend (comments only) 2020-01-29 17:02:16 +00:00
sebres 57321fa4a4 better test covering [5d989f9ba3] - limiting AS considers normal memory usage of process;
prepared for new common test-facility (test-with-limit) for resticted execution
2020-01-29 16:50:56 +00:00
jan.nijtmans f85de8a933 Deprecate channel types 1-4 2020-01-29 15:52:02 +00:00
jan.nijtmans 667676a551 Fix compiler warnings on Cygwin when using -DTCL_NO_DEPRECATED
Use TCL_CHANNEL_VERSION_5 in stead of TCL_CHANNEL_VERSION_3 in tclZlib.c
2020-01-29 13:02:06 +00:00
jan.nijtmans 7c48658c9f Fix install-libraries-zipfs-static target: On Windows INSTALL_DATA makes no sense. Reported by René Zaumseil. Thanks! 2020-01-27 10:31:36 +00:00
jan.nijtmans bfed58b030 TIP #559 follow-up: Make sure that if Tcl_FreeResult() is used in an extension compiled with -DTCL_NO_DEPRECATED, this results in a link error.
Do the same with deprecated funcions from other TIP's.
2020-01-25 14:51:08 +00:00
dgp e6800a165c Implement TIP 559 2020-01-24 16:44:25 +00:00
apnadkarni b20939682d Fix See also links in list commands 2020-01-23 15:40:08 +00:00
jan.nijtmans 05776cbb41 Merge 8.6 2020-01-23 13:14:09 +00:00
jan.nijtmans 92c8a53689 Better error-handling in some libtommath calls. 2020-01-23 12:55:41 +00:00
jan.nijtmans c15121ae96 Add error-handling to all libtommath function calls. Most likely not perfect (open for further improvements/review), but for sure better than no error-handling at all. 2020-01-23 10:33:37 +00:00
jan.nijtmans b9f442e8b2 Merge 8.6 2020-01-23 09:46:18 +00:00
jan.nijtmans ff928c6450 Merge 8.5 2020-01-23 08:33:22 +00:00
jan.nijtmans ad096310ec Last unused internal stub entry from 258 to 259. 2020-01-23 08:29:26 +00:00
jan.nijtmans e03aa95407 Merge 8.7. All calls using MP_WUR handled now. 2020-01-22 09:26:00 +00:00
dgp 5dab8a0c6b Implement TIP 543 2020-01-21 22:00:20 +00:00
jan.nijtmans 05ed23d325 Merge 8.7, more WIP 2020-01-21 16:05:02 +00:00
jan.nijtmans 220ee76c14 merge-mark 2020-01-21 08:49:21 +00:00
jan.nijtmans 0f71efe445 Don't run stack-3.1 test on OSX, it fail regulary. Don't really bother for Tcl 8.5 any more. 2020-01-21 08:48:17 +00:00
jan.nijtmans 7eeeb51309 Merge-mark 2020-01-20 15:28:38 +00:00
jan.nijtmans e403afa147 Now that TIP #538 is integrated, make rules.vc work for both 8.6 and 8.7 without changes. 2020-01-20 15:27:47 +00:00
jan.nijtmans a3906f4953 Don't deprecate Tcl_NewUnicodeObj/Tcl_SetUnicodeObj/Tcl_GetUnicodeFromObj, since that's not according to TIP #542. (Those are only deprecated when using TCL_UTF_MAX=4, not in the general case) 2020-01-20 14:35:25 +00:00
jan.nijtmans 12d3b15f30 Implementation of TIP #542: Support for switchable Full Unicode support 2020-01-20 12:18:34 +00:00
sebres 668c35bfc2 merge 8.6 2020-01-17 17:15:37 +00:00
sebres 33c6ac50b3 merge 8.5 (closes [5d989f9ba3]: avoid segfault by OOM if too many items to sort) 2020-01-17 17:08:18 +00:00
sebres a3728e6d82 small amend (skip messages, avoid output on interactive shell) 2020-01-17 16:40:37 +00:00
sebres 35ec25a6cf closes [5d989f9ba3]: avoid segfault by OOM if too many items to sort (would throw an error instead, and use system alloc for long elementArray due to size_t);
added test cases covering that (in child process with limited address space, if "prlimit" available)
2020-01-17 16:12:06 +00:00
dgp eb5163d9e8 merge 8.7 2020-01-17 15:37:22 +00:00
jan.nijtmans 3262fa4d4e Merge 8.7, more WIP 2020-01-17 10:43:44 +00:00
jan.nijtmans 37ad5db296 Merge 8.6 2020-01-17 08:54:21 +00:00
jan.nijtmans 9169847966 Fix [8cd2fe7474]: "unload" command Bug (when handling multiple libs) 2020-01-17 08:53:29 +00:00
jan.nijtmans eb08a10e38 Fix [8cd2fe7474]: "unload" command Bug (when handling multiple libs) 2020-01-17 08:51:38 +00:00
jan.nijtmans d59509dee2 Proposed fix for [8cd2fe7474]: "unload" command Bug (when handling multiple libs) 2020-01-16 14:16:48 +00:00
jan.nijtmans e446f6c309 Merge 8.7 2020-01-15 15:29:54 +00:00
jan.nijtmans 3101fc1da1 Merge-mark 8.6. Remove a few "break"'s added in the previous commit, because they are redundant. 2020-01-15 10:21:02 +00:00
jan.nijtmans 9a78221b8d A few more "break" statements, so any compiler knows these are no FALLTHROUGH situations. 2020-01-15 10:07:46 +00:00
jan.nijtmans 939c35f568 A few more "break" statements, so any compiler knows these are no FALLTHROUGH situations. 2020-01-14 09:09:50 +00:00
jan.nijtmans c6135def08 Attempt to resolve a conflict between (unmodified) tommath.h and tcl.h in the definition of mp_int. See: [https://github.com/libtom/libtommath/pull/473] 2020-01-13 21:46:18 +00:00
dgp 9b0b0dc37d Implement TIP 559 (deprecation part). 2020-01-13 17:00:21 +00:00
jan.nijtmans 41e035d59b Merge 8.6 2020-01-13 15:20:03 +00:00
jan.nijtmans 46a6094df7 Fix [cff53cf7d0]: Failed test oo-0.9 in file oo.test in Tcl8.6.10 2020-01-13 15:19:08 +00:00
jan.nijtmans a8e3a2a3a8 Merge 8.6 2020-01-13 12:47:13 +00:00
jan.nijtmans 6a4eb9df57 Add ${LDFLAGS} to MAKE_LIB. This handles the possibility of adding LDFLAGS=?? on the "configure" commandline. Suggested by Pietro Cerutti. Thanks! 2020-01-13 12:17:09 +00:00
jan.nijtmans f468073bd5 Merge 8.6 2020-01-13 10:44:25 +00:00
jan.nijtmans 997e0f3505 Fix [0b9332722a]: Support utf-8 on Windows console 2020-01-13 10:01:30 +00:00
jan.nijtmans f3070aa2fc Silence some gcc-9 compiler warnings. 2020-01-13 10:00:03 +00:00
dgp 31f988f9c8 merge 8.7 2020-01-10 17:40:34 +00:00
jan.nijtmans 8c3314fad9 More WIP 2020-01-10 16:00:03 +00:00
jan.nijtmans 2d27c96b7e tommath_private.h : Remove special C4146 handling: already done in tclWinPort.h too.
tcl.pc.in:  Make sure that libtommath >= 1.2.0
2020-01-10 15:18:36 +00:00
jan.nijtmans f608fa90db Put "-ltommath" in $MATH_LIBS in stead of $LIBS, so it won't be used by other checks in the configure script. Suggested by Pietro Cerutti. 2020-01-09 09:27:09 +00:00
jan.nijtmans 07829dc8b9 Put "-ltommath" in $MATH_LIBS in stead of $LIBS, so it won't be used by other checks in the configure script. Suggested by Pietro Cerutti. 2020-01-09 09:25:56 +00:00
jan.nijtmans cc211af4ea Start handling WUR (Warn Unused Result) in all tommath calls. WIP, not complete yet. 2020-01-09 09:20:57 +00:00
dgp f7076c6ce8 merge 8.7 2020-01-08 23:00:06 +00:00
dgp 8ef7bd41b6 Improvements to doc changes from TIPs 422 and 512. 2020-01-08 22:25:36 +00:00
dgp 0d799f84b3 s/in stead/instead/ 2020-01-08 21:40:10 +00:00
dgp d1f6dc44aa s/in stead/instead/ 2020-01-08 21:39:12 +00:00
dgp 6804338322 merge 8.6 2020-01-08 21:10:10 +00:00
dgp 780f439396 Remove another mention of interp->result. 2020-01-08 16:53:25 +00:00
dgp 0215962576 Revise documentation that refers to direct access to interp->result. 2020-01-08 14:23:06 +00:00
jan.nijtmans 0c195b760a Merge 8.6 2020-01-08 13:16:49 +00:00
jan.nijtmans 0df818c01f Use _copysign on Windows always (available from float.h). Use mp_iszero() whenever appropriate. 2020-01-08 12:51:29 +00:00
jan.nijtmans 3b3abe0ce1 Code cleanup (mostly comments, backported from 8.6). 2020-01-08 11:53:03 +00:00
jan.nijtmans 4afa382971 Merge 8.7 2020-01-07 15:44:16 +00:00
jan.nijtmans 0ba9e042a2 Merge 8.7 2020-01-07 15:22:06 +00:00
jan.nijtmans 14b5289e4a Merge 8.7 2020-01-07 15:20:49 +00:00
jan.nijtmans 49a7184962 Don't use "operator" as variable name, as it is a keyword in C++.
Add some break statements, so Tcl can be compiled warning-free with gcc-7's -Wimplicit-fallthrough
A few better indications of unused (dummy) functions parameters.
2020-01-07 14:42:15 +00:00
jan.nijtmans 7c23c57789 Some eol whitespace eliminations 2020-01-07 14:32:16 +00:00
jan.nijtmans 7d90738e3a One more place where the (deprecated) "unicode" encoding was still used. 2020-01-07 12:18:51 +00:00
jan.nijtmans d92cffaa0c Remove type-casts in many Tcl_LinkVar() calls, which is no longer necessary since 8.7.
Small missing piece in Tcl_LinkArray() implementation, handling (unsigned) longs on 64-bit platforms.
2020-01-07 09:24:19 +00:00
jan.nijtmans 0bf39185fb Fix test encoding-28.0, adapting for the correct number of available encodings 2020-01-07 08:35:34 +00:00
dgp 1923110631 one more 2020-01-06 20:24:25 +00:00
dgp c187695b61 Bring docs up to date with TIP 330 and TIP 336 changes already in Tcl 8.7 2020-01-06 20:12:32 +00:00
dgp edcdd9afe1 Missing bit of interp->result deprecation. 2020-01-06 18:07:43 +00:00
dgp f140e958c5 Remove "new in 8.6" marks from the docs in the 8.7 branch. 2020-01-06 17:26:05 +00:00
dgp b0db0ad956 remove 'new in 8.5' marks in docs 2020-01-06 17:17:58 +00:00
dgp 6dcb4cb65c Remove the "new in 8.5" markings from the 8.6 branch of docs. 2020-01-06 17:17:11 +00:00
jan.nijtmans 4c14bc7964 Fix typo: "==" -> "=" 2020-01-06 11:02:12 +00:00
jan.nijtmans b81709b80a Merge 8.7.
Don't think that ${LDFLAGS} should be part of MATH_LIBS: that should be arranged correctly in the Makefile by providing both LDFLAGS and MATH_LIBS to the command line.
2020-01-06 10:57:58 +00:00
jan.nijtmans 16deae9be1 Merge-mark 2020-01-06 10:50:18 +00:00
jan.nijtmans 8d01cecc9a (cherry-pick): Fix issue [9128866ec8448752] by adding Line Feed character to tis-620.enc. 2020-01-06 10:48:04 +00:00
jan.nijtmans 4bea353255 Merge 8.6 2020-01-06 10:40:14 +00:00
jan.nijtmans 2595be3dfe Merge 8.5 2020-01-06 10:34:16 +00:00
jan.nijtmans 1ccdd5f186 Don't assume/set LDFLAGS being "", it could be set on the "configure" command-line.
Remove "test-packages" test-target (which doesn't exist), but add "test-tcl" being the same as "test".
2020-01-06 10:28:28 +00:00
dgp b60f173c37 Tcl_TransferResult was new in 8.6, so mark the man page with that version. 2020-01-05 19:41:04 +00:00
dgp 3dae54c810 formatting typo and rewrite 2020-01-05 19:18:30 +00:00
dgp 5f46a6c4a7 Rewrite: lead paragraph with name of documented routine. 2020-01-05 19:16:33 +00:00
dgp a75f6ac8ce Fix documentation, comments, and argument names of Tcl_TransferResult(). 2020-01-05 19:03:12 +00:00
pooryorick ac2be8e353 Add a test for issue [9128866ec8], encoding fails to load 2020-01-04 17:21:53 +00:00
pooryorick 0cd25f6ca2 merge 8.6 2020-01-04 14:51:40 +00:00
pooryorick b873f56401 Fix issue [9128866ec8448752] by adding Line Feed character to tis-620.enc. 2020-01-04 14:34:36 +00:00
fvogel 0188ad7082 Restore the build by providing a copysign replacement for old MSVC versions. 2020-01-02 21:00:22 +00:00
fvogel 019eea55c0 Restore the build by providing a copysign replacement for old MSVC versions. 2020-01-02 20:56:46 +00:00
fvogel 158c112e03 Restore the build by providing a copysign replacement for old MSVC versions. 2020-01-02 20:56:20 +00:00
dgp 341619118a merge 8.7 2019-12-30 21:25:43 +00:00
dkf 30d15963da Fixed index line 2019-12-30 16:24:29 +00:00
gahr c24a2bec01 Regenerate configure 2019-12-30 13:49:39 +00:00
gahr 54e9b9d2b3 Fix equality check, reported by Emiliano 2019-12-30 13:48:44 +00:00
gahr 61ddd431ca Include LDFLAGS in TCL_LIB, since that's where MATH_LIBS come in 2019-12-27 12:53:48 +00:00
gahr a5fd8b5d9c Regenerate configure 2019-12-27 12:13:15 +00:00
gahr 70b0310ff7 Make sure LDFLAGS are propagated to MAKE_LIB 2019-12-27 12:12:15 +00:00
gahr 54aabbf053 Use AC_CHECK_LIB and put ltommath in MATH_LIBS to avoid polluting LIBS 2019-12-27 12:11:38 +00:00
Kevin B Kenny ccc57bc577 Merge Tcl 8.6 changes to deal with integer overflow in the exponent, and floating point overflow in the significand, of floating point input conversion (Bug [1de6b0629e] 2019-12-27 00:23:49 +00:00
Kevin B Kenny 8140d238ea Merge Tcl 8.5 changes to deal with integer overflow in the exponent, and floating point overflow in the significand, of floating point input conversion (Bug [1de6b0629e] 2019-12-27 00:12:58 +00:00
Kevin B Kenny f7d1daa7fd Merge changes to deal with integer overflow in the exponent, and floating point overflow in the significand, of floating point input conversion (Bug [1de6b0629e] 2019-12-27 00:03:41 +00:00
Kevin B Kenny ba0a3a3dd2 Add test cases that used to cause floating point overflow in computing the correction term in floating point input conversion. Fix exponent overflow in floating point input conversion, and floating-point overflow in the significand in input conversion. 2019-12-26 23:54:03 +00:00
jan.nijtmans 032451725b Add FALLTHRU markers, eliminating gcc warning using -Wextra 2019-12-24 15:04:57 +00:00
jan.nijtmans 3254602d80 Attempt to improve support for external libtommath 2019-12-24 14:23:42 +00:00
jan.nijtmans 51bf99fdf5 More progress in making clang build on Cygwin warning-free 2019-12-24 13:52:05 +00:00
jan.nijtmans 0f7dc05b52 Make definition of struct mp_int EXACTLY the same as the one in the (modified) tommath.h 2019-12-24 13:51:22 +00:00
jan.nijtmans 2d00a8c17e Put our own included (-I) directories before directories coming in though CFLAGS, so building with external libraries (like libtommath) doesn't possibly corrupt our own build. Reported by Pietro Cerutti 2019-12-24 10:05:40 +00:00
jan.nijtmans cf8d2f27eb Merge 8.6 2019-12-23 13:42:55 +00:00
jan.nijtmans 86e6d287a0 Fix for building Cygwin using Clang. 2019-12-23 13:38:20 +00:00
jan.nijtmans ce2dc4a07d Merge 8.6 2019-12-23 11:27:22 +00:00
jan.nijtmans 1e7fb75229 Workaround for [ce3b9f2b04]: compilation errors with clang (windows msys2) 2019-12-23 11:26:31 +00:00
dgp 63253bc07d Fix parsing bug when (numSigDigs == 0). 2019-12-23 00:54:44 +00:00
dgp 38d9207627 Assign a double literal to a double variable. No point in requiring conversion. 2019-12-22 23:48:00 +00:00
dgp e52a22ff57 Tests for another parsing bug. 2019-12-22 18:44:45 +00:00
jan.nijtmans 7b099b30d8 Merge 8.6 2019-12-22 14:55:25 +00:00
jan.nijtmans 834ee2dd0d Minor optimization in TclFormatInt: No need to check for "0" as special value. No need to include final NULL-byte in character-reversion operation, as we already known the NULL-byte will come last. 2019-12-22 14:52:33 +00:00
dgp 1f81e5eb51 Tests demonstrating the number parsing overflow bugs. 2019-12-21 14:19:08 +00:00
jan.nijtmans f3e5dd7a04 Prevent double definition of MODULE_SCOPE on Darwin 2019-12-20 16:13:36 +00:00
jan.nijtmans bb09dba8c0 Fix 2 unused arguments with USE_DTRACE 2019-12-20 16:11:54 +00:00
jan.nijtmans 8e18ac6cf7 Update travis build fro xcode11 to xcode11.3 as highest platform 2019-12-20 15:23:26 +00:00
jan.nijtmans 4f37c25271 Two more unused arguments.
Merge 8.7
2019-12-20 14:23:11 +00:00
jan.nijtmans 14a974e2d0 Merge 8.7. Exclude 4 test-cases in TCL_NO_DEPRECATED mode, because they are not supposed to work then 2019-12-19 22:26:37 +00:00
jan.nijtmans 2a08be49c2 Merge 8.6 2019-12-19 22:12:19 +00:00
jan.nijtmans 588a92ec6b Merge 8.5 2019-12-19 22:11:01 +00:00
jan.nijtmans 6fa04d74e0 Add type-cast, making sure that the unary minus is handled correctly on any compiler 2019-12-19 22:09:46 +00:00
jan.nijtmans 2c3a603e13 Merge 8.6 2019-12-19 22:04:09 +00:00
jan.nijtmans a0f11eae42 Merge 8.5 2019-12-19 21:31:05 +00:00
jan.nijtmans 88e4842dfe Put back 4 test-cases as they were in core-8-branch, but only for TCL_UTF_MAX=3 2019-12-17 23:14:53 +00:00
jan.nijtmans 3a7b07be0d Better fix for [3390638]: making the intVal variable unsigned prevents the need for using sprintf() altogether. 2019-12-16 10:09:40 +00:00
jan.nijtmans dbd3d4eff0 Only use OPTS=msvcrt in combination with "static", otherwise it's a NOOP. Disable pragma warning:C4146 (backported from 8.6), since it only gives misleading warnings. 2019-12-16 10:08:07 +00:00
jan.nijtmans 899310175d Merge 8.7 2019-12-14 17:46:34 +00:00
jan.nijtmans 4e6d44d0e6 Merge 8.6 2019-12-14 17:43:22 +00:00
jan.nijtmans ea5ed28162 Make win/configure work with CC=g++ (doesn't actually work with Tcl and Tk yet) 2019-12-14 17:36:09 +00:00
jan.nijtmans 72b3895d8b Merge 8.7 2019-12-14 14:08:54 +00:00
jan.nijtmans 112bcf743a merge-mark 2019-12-13 22:20:32 +00:00
jan.nijtmans 59f4600ec3 One #undef too much 2019-12-13 22:18:40 +00:00
jan.nijtmans 89e6e17872 Merge 8.7 and (hopefully) fix Travis build with C++ 2019-12-13 22:12:32 +00:00
jan.nijtmans de326e5c5e Don't export mp_sqr() directly from libtcl 2019-12-13 21:48:15 +00:00
jan.nijtmans 230886d1fe Merge 8.7 2019-12-13 21:27:52 +00:00
jan.nijtmans 9eeefad066 Optimize mp_mul for the case a==b 2019-12-13 21:16:44 +00:00
jan.nijtmans 8ddd0ca822 Merge 8.7 2019-12-13 15:41:16 +00:00
jan.nijtmans e438829082 Merge 8.7 2019-12-13 15:39:23 +00:00
jan.nijtmans 4cef9fbbe2 merge-mark 2019-12-13 15:13:15 +00:00
jan.nijtmans 3fb9396959 Fix Travis build for MSVC Debug mode 2019-12-13 15:12:29 +00:00
jan.nijtmans 6fdc83ae14 Implement TIP's #538: Externalize libtommath 2019-12-13 11:05:43 +00:00
jan.nijtmans db35fe50e9 Little code tweaks, regarding the use of TCL_UTF_MAX or wchar_t. 2019-12-12 21:38:46 +00:00
jan.nijtmans 9ef936369e merge-mark 2019-12-12 21:05:16 +00:00
jan.nijtmans 3701dc242d Add 3 (libtommath) functions to the stub table. Will be added to 8.7 too, through TIP #538 2019-12-12 21:02:48 +00:00
jan.nijtmans 94e8f63367 Merge 8.7. Add C++ entries for Windows to Travis build. 2019-12-12 16:14:05 +00:00
jan.nijtmans f70589ae3e Add many missing constraints 2019-12-12 13:12:29 +00:00
jan.nijtmans 368faf4c43 Update win/tcl.m4, for use with C++ 2019-12-12 13:11:09 +00:00
jan.nijtmans e3f42b0c1a Little doc tweak 2019-12-12 08:23:58 +00:00
jan.nijtmans 74f50a92f3 Merge 8.7 2019-12-11 15:53:07 +00:00
jan.nijtmans f8474f319c Implement "panic" as described in the TIP 2019-12-11 12:41:00 +00:00
jan.nijtmans 81d54e6432 Merge 8.7 2019-12-11 08:55:48 +00:00
jan.nijtmans 1d6a94f9f8 Fix bug in tclEncoding.c, only manifesting in testcase encoding-15.4 for TCL_UTF_MAX=6. (knownBug, fixed now) 2019-12-11 08:52:58 +00:00
jan.nijtmans 86c130f239 Merge 8.6 2019-12-10 13:42:52 +00:00
jan.nijtmans db4a693d72 Fix [5f236bc67a]: valgrind report for Tcl_UniCharToUtf. Also add test-cases for more corner-cases. 2019-12-10 13:16:48 +00:00
sebres 4a214309b2 merge 8.6 2019-12-10 13:15:48 +00:00
sebres 5caaa0f557 amend to [2cf1202807]: find the hooks in tcltest namespace only 2019-12-10 12:45:09 +00:00
jan.nijtmans a7212b0557 Undo accidental change in [343273c9de4fd4f1] 2019-12-09 22:48:56 +00:00
jan.nijtmans 216a1d1937 Attempt to fix [5f236bc67a]: valgrind report for Tcl_UniCharToUtf 2019-12-09 19:36:21 +00:00
sebres 19e564ab89 remove unneeded import (for >= 8.7) 2019-12-09 11:42:57 +00:00
jan.nijtmans 54b0e77083 Merge 8.6 2019-12-09 11:31:25 +00:00
sebres c66173309f merge 8.5 (timing issue avoidance, skip test in runtime feature) 2019-12-09 10:40:04 +00:00
sebres f9490c56c6 small amend (whitespace, no functional) 2019-12-09 10:30:19 +00:00
sebres c8634b0b9e tcltest: hook enhancements rewritten backwards compatible now, reverts [0067db1bbf], [0f3d6f90f0], [b8be012969], [375a566d22] 2019-12-09 10:26:23 +00:00
jan.nijtmans 37f6a196c5 Fix [abd4abedd2]: Failed to build tk 8.6.10 with cross compile 2019-12-09 10:02:20 +00:00
jan.nijtmans fea9c41d92 Add special handling of lower surrogate to UtfToUtfProc(), so valgrind should't complain in that situation. With new test-cases covering that. 2019-12-09 09:59:02 +00:00
jan.nijtmans 1121106257 Merge 8.7 2019-12-08 16:58:26 +00:00
jan.nijtmans 743e03cf5e Merge 8.7 2019-12-08 16:55:03 +00:00
jan.nijtmans 39bf69006a Merge 8.6Merge 8.6 2019-12-08 16:49:34 +00:00
jan.nijtmans d67affb100 Fix Valgrind problem reported as follow-up in [fc4393e9b0]. Since it happens only for TCL_UTF_MAX>3 it's not actully a 'bug' in 8.6, but it might be a corner-case not handled well in 8.7 2019-12-08 16:33:18 +00:00
jan.nijtmans 6d5473da30 merge-mark 2019-12-07 18:25:58 +00:00
jan.nijtmans bf4f51ce78 Fix 2 test-cases, which were failing when TCL_UTF_MAX=6. Add UTF_MAX=6 UNIX build to Travis as proof that now all test-cases pass for UTF_MAX=6 (still not officially supported) 2019-12-07 18:23:41 +00:00
sebres 74b0c7c91a rewrite of [dff608952b]: skip tests if there is really a timing issue (and implements new feature ::tcltest::Skip which allows conditionally skipping of tests at runtime) 2019-12-06 16:42:19 +00:00
jan.nijtmans 364ba5e8b9 Exclude some test-cases with possible timing problems on Windows. Double ;; in generic/tclTimer.c 2019-12-06 14:51:39 +00:00
jan.nijtmans 5aef84d1f4 Merge 8.6 2019-12-06 14:38:28 +00:00
jan.nijtmans f67bef714e Unnecessary double ;; in tclTimer.c. Update compat/zlib to exactly the same content as in the core-8-branch branch. 2019-12-06 14:35:10 +00:00
jan.nijtmans e2ecc3c090 merge-mark 2019-12-06 13:47:34 +00:00
jan.nijtmans a84aa656ee Fix some test-cases when Tcl is compiled with -DTCL_UTF_MAX=6. Not officially supported but used by Androwish. The test-cases prove that "unicode" should be UTF-16 actually for all TCL_UTF_MAX values. 2019-12-06 13:43:25 +00:00
jan.nijtmans 7d17ab9a13 Merge 8.6 2019-12-04 13:26:53 +00:00
jan.nijtmans 0acc700234 Add builds using TCL_UTF_MAX=4 on Windows. Not officially supported, but used by Androwish. Also alphabetise some options in win/makefile.vc and win/rules.vc 2019-12-04 12:54:39 +00:00
jan.nijtmans d02ab64fa2 Use the right encoding when converting (Unicode) messages regarding socket errors on Windows. Some code cleanup in win/tclWinfile.c. 2019-12-04 12:53:25 +00:00
jan.nijtmans 29b775c36a Remove Travis's Clang builds using TCL_UTF_MAX!=4. Too little difference with the corresponding GCC builds to be useful. 2019-12-03 19:30:19 +00:00
jan.nijtmans 40938f72a2 Add build using gcc and TCL_UTF_MAX=4 to Travis build. Not officially supported but used by Androwish. Remove "threads" designator on Windows, since it's already default. 2019-12-03 19:24:05 +00:00
jan.nijtmans 4a5f73e338 Merge 8.7 2019-12-03 16:13:29 +00:00
jan.nijtmans d8fd9552b5 Merge 8.7 2019-12-03 16:12:14 +00:00
jan.nijtmans 28d5df364e Merge 8.6 2019-12-03 13:21:32 +00:00
jan.nijtmans 678d2103f9 Fix encoding-15.6 testacase for TCL_UTF_MAX=6, due to changes escape sequences for upper/lower surrogate combination. 2019-12-03 13:20:47 +00:00
jan.nijtmans c4990c8bf6 Merge 8.6 2019-12-03 12:58:25 +00:00
jan.nijtmans 9e0083e9f0 Fix [3cd9bea1e6]: check-in [43032d7ba3] potential problems. Also don't allow surrogates in \U?????? syntax. 2019-12-03 12:27:42 +00:00
pooryorick 3c7bb58fb9 merge 8.6 2019-12-02 22:07:33 +00:00
pooryorick 36f4518f89 Add tcltest::CleanupTest to make it easier to customize behaviour. 2019-12-02 22:04:41 +00:00
jan.nijtmans cfb43a5a2c Merge 8.6 2019-12-02 20:48:35 +00:00
jan.nijtmans 4f6ea8aef9 If TCL_UTF_MAX>=4, make Tcl_ParseBackslash combine two surrogates so they appear as one 4-byte UTF-8 byte sequence from the start. Add test-case for this. 2019-12-02 20:26:58 +00:00
dgp a42ecfa12e Bump to 8.7a4 to distinguish development from 8.7a3 release. 2019-12-02 18:15:07 +00:00
jan.nijtmans eadbf37f4e Fix [a46a49b90f]: tests http-cookiejar-1.[12] fail 2019-12-02 13:28:46 +00:00
jan.nijtmans 8e1f9bb6d1 Eliminate excess eol-spacing 2019-12-02 10:58:19 +00:00
jan.nijtmans a86677ebd5 Merge 8.6 2019-12-02 10:52:45 +00:00
jan.nijtmans 90493b4012 Renumber tcltest from 2.5.1 -> 2.5.2, already for next release. 2019-12-02 10:49:11 +00:00
jan.nijtmans d6a3244d18 More eol-spacing 2019-12-02 10:48:01 +00:00
jan.nijtmans f7e46677b5 Eliminate unneccessary eol-spacing from documentation. 2019-12-02 10:47:00 +00:00
jan.nijtmans db669f381b Fix make install on Ubuntu (and - most likely - other platforms) 2019-12-01 21:25:32 +00:00
jan.nijtmans 6cc489aa4f Merge 8.7 2019-12-01 20:04:10 +00:00
pooryorick 506589f483 Add tcltest::EvalTest to make it easier to customize behaviour. 2019-12-01 19:45:54 +00:00
jan.nijtmans bd7870ec5f Fix executable flag 2019-12-01 17:52:17 +00:00
pooryorick 7363d850a9 merge 8.6 2019-12-01 13:52:06 +00:00
pooryorick d138d28133 Fix tcltest::SetupTest added in previous commit. 2019-12-01 13:48:48 +00:00
pooryorick af1ecf410e merge 8.6 2019-12-01 12:16:04 +00:00
pooryorick 3435c9713f add tcltest::SetupTest to make it easier to customize the -setup step of a test 2019-12-01 11:59:41 +00:00
jan.nijtmans 09abed41d6 merge-mark 2019-11-29 12:29:18 +00:00
jan.nijtmans 332401e645 Add some new test-cases involving e.g. Unicode 11. Backported from Tcl 8.7a3 2019-11-29 12:27:00 +00:00
jan.nijtmans 9eaa827e59 Merge 8.7 2019-11-26 22:49:05 +00:00
jan.nijtmans 29db2a6761 Some code cleanup. Build with zlib dll on Win32 when using makefile.vc (shared-build only) 2019-11-18 14:40:54 +00:00
jan.nijtmans f02189588a Merge 8.7. Unbreak travis build with TCL_UTF_MAX=3 2019-11-17 13:39:46 +00:00
jan.nijtmans 84987939c7 Merge 8.7 2019-11-15 15:19:56 +00:00
jan.nijtmans e9559b5cc0 Merge 8.7 2019-11-13 16:11:37 +00:00
jan.nijtmans 6ce8973116 Merge 8.7 2019-11-11 16:19:46 +00:00
jan.nijtmans d33f396b99 Merge 8.7 2019-11-09 20:39:06 +00:00
jan.nijtmans d6d77a73be Merge 8.7 2019-11-07 15:39:37 +00:00
jan.nijtmans 9348f23012 Fix tclScan.c, not generating a string representation any more with unsigned wideints 2019-11-06 12:34:27 +00:00
jan.nijtmans 2b84291424 Merge 8.7 2019-11-04 12:10:54 +00:00
jan.nijtmans 55e2ef9b31 Merge 8.7 2019-11-04 12:10:19 +00:00
jan.nijtmans c8444b192d Merge 8.7 2019-10-28 16:49:32 +00:00
jan.nijtmans efe1dce70b Merge 8.7 2019-10-25 20:32:26 +00:00
jan.nijtmans 25eedf811a Merge 8.7 2019-10-24 15:34:30 +00:00
jan.nijtmans f73034b8e3 Merge 8.7 2019-10-06 20:39:03 +00:00
jan.nijtmans 3d55f5f6f0 Merge 8.7 2019-10-02 21:40:45 +00:00
jan.nijtmans c4606765eb Merge 8.7 2019-10-01 19:32:32 +00:00
jan.nijtmans 97294cb6f5 Merge 8.7 2019-09-25 15:06:25 +00:00
jan.nijtmans 2c327304a1 Merge 8.7 2019-09-25 13:42:11 +00:00
jan.nijtmans e1febe2aac merge-mark 2019-09-20 21:28:03 +00:00
jan.nijtmans 865ea5e678 More Win32 API impovals. 2019-09-20 13:53:39 +00:00
jan.nijtmans 775e9aac00 Merge 8.7 2019-09-19 18:27:06 +00:00
jan.nijtmans 0ff016021c Make less dependent on UNICODE definition 2019-09-18 09:33:43 +00:00
jan.nijtmans d8577f3bd9 Merge 8.7 2019-09-17 11:39:21 +00:00
jan.nijtmans c9396a84a8 Merge 8.7 2019-09-14 21:52:20 +00:00
jan.nijtmans 96c82a32e1 Mark more function paramaters as unused. Now Tcl compiles fully (on UNIX and Windows) without -Wunused-parameters warnings 2019-09-05 15:14:29 +00:00
jan.nijtmans 2d7fb3bc20 interp is not dummy any-more 2019-09-04 22:11:48 +00:00
jan.nijtmans 2cd19c4e6b Bring back Tcl_UntraceVar 2019-09-04 22:08:23 +00:00
jan.nijtmans ed985943f3 Handle "Unload" as well 2019-09-04 21:19:59 +00:00
jan.nijtmans 6506055954 (experiment) Allow C++ symbols to be found in loaded extensions 2019-09-04 20:51:06 +00:00
jan.nijtmans 8c60b1157a Mark more unused parameters 2019-09-03 20:32:33 +00:00
jan.nijtmans 97cf6a1aff Merge tip-548 2019-09-03 14:55:19 +00:00
jan.nijtmans b5f118d875 Merge tip-548. A few more fixes, trying to make the Travis build work (finally) 2019-09-02 12:27:10 +00:00
jan.nijtmans 876a5d6782 Let's try a real C++ build with Travis on Linux 2019-08-30 15:21:28 +00:00
jan.nijtmans 4187ab8e37 Merge tip-548 2019-08-29 13:28:32 +00:00
jan.nijtmans 4796062aab Merge tip-548 2019-08-15 15:20:29 +00:00
jan.nijtmans 261bde3156 Eliminate dependency in test-suite on Unicode functions. Merge tip-548. Fix build with -DTCL_NO_DEPRECATED 2019-08-13 21:00:28 +00:00
jan.nijtmans 4b48c76e1c default TCL_UTF_MAX should still be 3 2019-08-12 20:49:50 +00:00
jan.nijtmans 92c04315ff Forgot some changes from tip-548 2019-08-12 20:47:01 +00:00
jan.nijtmans 8ddf96d852 Merge branch tip-548. No longer define addtional stub-entries for functions that will be removed (because of deprecation) anyway 2019-08-12 20:38:09 +00:00
jan.nijtmans 7934f521d7 Merge tip-548 2019-08-11 21:33:32 +00:00
jan.nijtmans ee3826893d Merge tip-548 (since using the *WChar* functions leads to less type-casts in c++)
Als finish implementaton for MacOSX
2019-08-03 20:25:14 +00:00
jan.nijtmans 2b096ec26d Merge tip-548 2019-08-02 15:03:45 +00:00
jan.nijtmans 474d95712e Merge 8.7. Continue implementation for win32 2019-08-02 12:15:23 +00:00
jan.nijtmans 972ac8cc9d Protect Tcl_AToB() functions against NULL input 2019-08-01 21:55:52 +00:00
jan.nijtmans 203f7657fe wrong length in tclMain.c, and wrong #endif 2019-08-01 21:47:01 +00:00
jan.nijtmans 5c8bbdd6d9 Merge tip-548 2019-08-01 21:35:37 +00:00
jan.nijtmans 74f9c831ac Merge tip-548 2019-08-01 11:55:40 +00:00
jan.nijtmans 2a3d586a79 Merge 8.7, and continue implementation. Almost done 2019-07-10 05:51:56 +00:00
jan.nijtmans d409a29e57 Experiment: compile Tcl with C++ compiler. WIP 2019-07-04 06:54:24 +00:00
jan.nijtmans a2d61902c5 Merge tip-548 2019-06-29 14:35:51 +00:00
jan.nijtmans 3d185e117d Merge tip-548 2019-06-29 07:19:50 +00:00
jan.nijtmans 379b57abd7 Merge tip-548 2019-06-27 10:49:29 +00:00
jan.nijtmans 218593d964 Merge tip-548 2019-06-26 21:25:54 +00:00
jan.nijtmans d64f20cebe Merge tip-548 2019-06-09 21:18:35 +00:00
jan.nijtmans e2abfe30a7 Merge tip-548 branch. 2019-06-03 21:20:07 +00:00
jan.nijtmans 83661bdca4 Merge tip-547 2019-05-31 23:35:20 +00:00
jan.nijtmans 58260d444e More simplifications, taking deprecations into account 2019-05-22 21:50:14 +00:00
jan.nijtmans ea5190faaa Merge 8.7 2019-05-22 07:33:13 +00:00
jan.nijtmans d063a23455 More WIP: eliminate all usage of (platform-specific) Tcl_WinTCharToUtf()/Tcl_WinUtfToTChar() to its proposed portable replacements: Tcl_Utf16ToUtfDString()/Tcl_UtfToUtf16DString()
This allows for Tcl_WinTCharToUtf()/Tcl_WinUtfToTChar() to be declared deprecated.
2019-05-22 07:32:37 +00:00
jan.nijtmans f51c5464dc Merge 8.7 2019-05-17 14:22:50 +00:00
jan.nijtmans 3a37a573a2 Merge 8.7 2019-05-13 21:55:28 +00:00
dgp 7278c6fb2c Complete doc changes for TIP 543 in Tcl 8.7 2019-05-11 14:43:06 +00:00
dgp 0c863ddec8 Start of TIP 543 implementation. 2019-05-10 20:30:41 +00:00
jan.nijtmans 7b90ffbb48 merge 8.7 2019-05-10 07:46:32 +00:00
jan.nijtmans f9eb1833d2 Merge 8.7 2019-04-03 19:52:38 +00:00
jan.nijtmans d1a1ae5194 Merge 8.7 2019-03-28 22:49:59 +00:00
jan.nijtmans 388ed8fba7 Merge 8.7 2019-03-24 13:05:07 +00:00
jan.nijtmans ebd469c2a8 Merge 8.7. Also fix invalid reference to TclUtfToWChar, causing build failure 2019-03-21 20:28:49 +00:00
jan.nijtmans d8c1fbed81 Merge 8.7 2019-03-20 22:54:13 +00:00
jan.nijtmans 301062d3fb Add 4 new encodings, and add documentation. 2019-03-18 20:07:15 +00:00
jan.nijtmans 6d0e92b89e More WIP. Seems to be *almost* working. 2019-03-17 22:01:42 +00:00
jan.nijtmans bc2c8431fc Merge 8.7
Move up some stub entries related to Tcl_UniChar
Use TCL_UTF_MAX=4 for full Unicode in stead of TCL_UTF_MAX=6 (TCL_UTF_MAX: 3 is default)
2019-03-16 21:10:20 +00:00
jan.nijtmans 842878d2d0 Merge 8.7.
Fix 2 test-cases which were failing for TCL_UTF_MAX=6
2019-03-14 20:59:28 +00:00
jan.nijtmans da96c53041 Even better support for -DTCL_UTF_MAX=6. Ongoing improvements (TIP being planned) 2019-03-12 20:39:42 +00:00
259 changed files with 8755 additions and 8133 deletions
+78 -92
View File
@@ -6,49 +6,50 @@ matrix:
# Testing on Linux with various compilers
- name: "Linux/GCC/Shared"
os: linux
dist: xenial
dist: bionic
compiler: gcc
env:
- BUILD_DIR=unix
- name: "Linux/GCC/Shared: UTF_MAX=6"
- name: "Linux/GCC/Shared: UTF_MAX=4"
os: linux
dist: xenial
dist: bionic
compiler: gcc
env:
- BUILD_DIR=unix
- CFGOPT=CFLAGS=-DTCL_UTF_MAX=6
- name: "Linux/GCC/Shared: UTF_MAX=3"
os: linux
dist: xenial
compiler: gcc
env:
- BUILD_DIR=unix
- CFGOPT=CFLAGS=-DTCL_UTF_MAX=3
- CFGOPT=CFLAGS=-DTCL_UTF_MAX=4
- name: "Linux/GCC/Shared: NO_DEPRECATED"
os: linux
dist: xenial
dist: bionic
compiler: gcc
env:
- BUILD_DIR=unix
- CFGOPT="CFLAGS=-DTCL_NO_DEPRECATED=1"
- name: "Linux/GCC/Static"
os: linux
dist: xenial
dist: bionic
compiler: gcc
env:
- CFGOPT="--disable-shared"
- BUILD_DIR=unix
- name: "Linux/GCC/Debug"
os: linux
dist: xenial
dist: bionic
compiler: gcc
env:
- BUILD_DIR=unix
- CFGOPT="--enable-symbols"
# C++ build.
- name: "Linux/G++/Shared"
os: linux
dist: bionic
compiler: g++
env:
- BUILD_DIR=unix
- CFGOPT="CC=g++ CFLAGS=-Dregister=dont+use+register"
# Older versions of GCC...
- name: "Linux/GCC 7/Shared"
os: linux
dist: xenial
dist: bionic
compiler: gcc-7
addons:
apt:
@@ -60,7 +61,7 @@ matrix:
- BUILD_DIR=unix
- name: "Linux/GCC 6/Shared"
os: linux
dist: xenial
dist: bionic
compiler: gcc-6
addons:
apt:
@@ -72,7 +73,7 @@ matrix:
- BUILD_DIR=unix
- name: "Linux/GCC 5/Shared"
os: linux
dist: xenial
dist: bionic
compiler: gcc-5
addons:
apt:
@@ -82,39 +83,13 @@ matrix:
- g++-5
env:
- BUILD_DIR=unix
- name: "Linux/GCC 4.9/Shared"
os: linux
dist: xenial
compiler: gcc-4.9
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.9
env:
- BUILD_DIR=unix
# Clang
- name: "Linux/Clang/Shared"
os: linux
dist: xenial
dist: bionic
compiler: clang
env:
- BUILD_DIR=unix
- name: "Linux/Clang/Shared: UTF_MAX=6"
os: linux
dist: xenial
compiler: clang
env:
- BUILD_DIR=unix
- CFGOPT=CFLAGS=-DTCL_UTF_MAX=6
- name: "Linux/Clang/Shared: UTF_MAX=3"
os: linux
dist: xenial
compiler: clang
env:
- BUILD_DIR=unix
- CFGOPT=CFLAGS=-DTCL_UTF_MAX=3
- name: "Linux/Clang/Shared:NO_DEPRECATED"
os: linux
dist: xenial
@@ -124,27 +99,27 @@ matrix:
- CFGOPT="CFLAGS=-DTCL_NO_DEPRECATED=1"
- name: "Linux/Clang/Static"
os: linux
dist: xenial
dist: bionic
compiler: clang
env:
- CFGOPT="--disable-shared"
- BUILD_DIR=unix
- name: "Linux/Clang/Debug"
os: linux
dist: xenial
dist: bionic
compiler: clang
env:
- BUILD_DIR=unix
- CFGOPT="--enable-symbols"
# Testing on Mac, various styles
- name: "macOS/Xcode 11/Shared/Unix-like"
- name: "macOS/Xcode 11.3/Shared/Unix-like"
os: osx
osx_image: xcode11
osx_image: xcode11.3
env:
- BUILD_DIR=unix
- name: "macOS/Xcode 11/Shared"
- name: "macOS/Xcode 11.3/Shared"
os: osx
osx_image: xcode11
osx_image: xcode11.3
env:
- BUILD_DIR=macosx
install: []
@@ -156,6 +131,13 @@ matrix:
homebrew:
packages:
- libtommath
- name: "macOS/Xcode 11/Shared"
os: osx
osx_image: xcode11
env:
- BUILD_DIR=macosx
install: []
script: *mactest
- name: "macOS/Xcode 10/Shared"
os: osx
osx_image: xcode10.3
@@ -193,7 +175,7 @@ matrix:
# Doesn't run tests because wine is only an imperfect Windows emulation
- name: "Linux-cross-Windows/GCC/Shared/no test"
os: linux
dist: xenial
dist: bionic
compiler: x86_64-w64-mingw32-gcc
addons:
apt:
@@ -214,7 +196,7 @@ matrix:
# Doesn't run tests because wine is only an imperfect Windows emulation
- name: "Linux-cross-Windows-32/GCC/Shared/no test"
os: linux
dist: xenial
dist: bionic
compiler: i686-w64-mingw32-gcc
addons:
apt:
@@ -240,17 +222,17 @@ matrix:
- cd ${BUILD_DIR}
install: []
script:
- cmd.exe /C 'vcvarsall.bat x64 && nmake -f makefile.vc all tcltest'
- cmd.exe /C 'vcvarsall.bat x64 && nmake -f makefile.vc test'
- name: "Windows/MSVC/Shared: UTF_MAX=6"
- cmd.exe //C vcvarsall.bat x64 '&&' nmake '-f' makefile.vc all tcltest
- cmd.exe //C vcvarsall.bat x64 '&&' nmake '-f' makefile.vc test
- name: "Windows/MSVC/Shared: UTF_MAX=4"
os: windows
compiler: cl
env: *vcenv
before_install: *vcpreinst
install: []
script:
- cmd.exe /C 'vcvarsall.bat x64 && nmake OPTS=utfmax -f makefile.vc all tcltest'
- cmd.exe /C 'vcvarsall.bat x64 && nmake OPTS=utfmax -f makefile.vc test'
- cmd.exe //C vcvarsall.bat x64 '&&' nmake 'OPTS=utfmax' '-f' makefile.vc all tcltest
- cmd.exe //C vcvarsall.bat x64 '&&' nmake 'OPTS=utfmax' '-f' makefile.vc test
- name: "Windows/MSVC/Shared: NO_DEPRECATED"
os: windows
compiler: cl
@@ -258,8 +240,8 @@ matrix:
before_install: *vcpreinst
install: []
script:
- cmd.exe /C 'vcvarsall.bat x64 && nmake OPTS=nodep -f makefile.vc all tcltest'
- cmd.exe /C 'vcvarsall.bat x64 && nmake OPTS=nodep -f makefile.vc test'
- cmd.exe //C vcvarsall.bat x64 '&&' nmake 'OPTS=nodep' '-f' makefile.vc all tcltest
- cmd.exe //C vcvarsall.bat x64 '&&' nmake 'OPTS=nodep' '-f' makefile.vc test
- name: "Windows/MSVC/Static"
os: windows
compiler: cl
@@ -267,8 +249,8 @@ matrix:
before_install: *vcpreinst
install: []
script:
- cmd.exe /C 'vcvarsall.bat x64 && nmake OPTS=static -f makefile.vc all tcltest'
- cmd.exe /C 'vcvarsall.bat x64 && nmake OPTS=static -f makefile.vc test'
- cmd.exe //C vcvarsall.bat x64 '&&' nmake 'OPTS=static,msvcrt' '-f' makefile.vc all tcltest
- cmd.exe //C vcvarsall.bat x64 '&&' nmake 'OPTS=static,msvcrt' '-f' makefile.vc test
- name: "Windows/MSVC/Debug"
os: windows
compiler: cl
@@ -276,8 +258,8 @@ matrix:
before_install: *vcpreinst
install: []
script:
- cmd.exe /C 'vcvarsall.bat x64 && nmake OPTS=symbols -f makefile.vc all tcltest'
- cmd.exe /C 'vcvarsall.bat x64 && nmake OPTS=symbols -f makefile.vc test'
- cmd.exe //C vcvarsall.bat x64 '&&' nmake 'OPTS=symbols' '-f' makefile.vc all tcltest
- cmd.exe //C vcvarsall.bat x64 '&&' nmake 'OPTS=symbols' '-f' makefile.vc test
# Test on Windows with MSVC native (32-bit)
- name: "Windows/MSVC-x86/Shared"
os: windows
@@ -286,17 +268,17 @@ matrix:
before_install: *vcpreinst
install: []
script:
- cmd.exe /C 'vcvarsall.bat x86 && nmake -f makefile.vc all tcltest'
- cmd.exe /C 'vcvarsall.bat x86 && nmake -f makefile.vc test'
- name: "Windows/MSVC-x86/Shared: UTF_MAX=6"
- cmd.exe //C vcvarsall.bat x86 '&&' nmake '-f' makefile.vc all tcltest
- cmd.exe //C vcvarsall.bat x86 '&&' nmake '-f' makefile.vc test
- name: "Windows/MSVC-x86/Shared: UTF_MAX=4"
os: windows
compiler: cl
env: *vcenv
before_install: *vcpreinst
install: []
script:
- cmd.exe /C 'vcvarsall.bat x86 && nmake OPTS=utfmax -f makefile.vc all tcltest'
- cmd.exe /C 'vcvarsall.bat x86 && nmake OPTS=utfmax -f makefile.vc test'
- cmd.exe //C vcvarsall.bat x86 '&&' nmake 'OPTS=utfmax' '-f' makefile.vc all tcltest
- cmd.exe //C vcvarsall.bat x86 '&&' nmake 'OPTS=utfmax' '-f' makefile.vc test
- name: "Windows/MSVC-x86/Shared: NO_DEPRECATED"
os: windows
compiler: cl
@@ -304,8 +286,8 @@ matrix:
before_install: *vcpreinst
install: []
script:
- cmd.exe /C 'vcvarsall.bat x86 && nmake OPTS=nodep -f makefile.vc all tcltest'
- cmd.exe /C 'vcvarsall.bat x86 && nmake OPTS=nodep -f makefile.vc test'
- cmd.exe //C vcvarsall.bat x86 '&&' nmake 'OPTS=nodep' '-f' makefile.vc all tcltest
- cmd.exe //C vcvarsall.bat x86 '&&' nmake 'OPTS=nodep' '-f' makefile.vc test
- name: "Windows/MSVC-x86/Static"
os: windows
compiler: cl
@@ -313,8 +295,8 @@ matrix:
before_install: *vcpreinst
install: []
script:
- cmd.exe /C 'vcvarsall.bat x86 && nmake OPTS=static -f makefile.vc all tcltest'
- cmd.exe /C 'vcvarsall.bat x86 && nmake OPTS=static -f makefile.vc test'
- cmd.exe //C vcvarsall.bat x86 '&&' nmake 'OPTS=static,msvcrt' '-f' makefile.vc all tcltest
- cmd.exe //C vcvarsall.bat x86 '&&' nmake 'OPTS=static,msvcrt' '-f' makefile.vc test
- name: "Windows/MSVC-x86/Debug"
os: windows
compiler: cl
@@ -322,8 +304,8 @@ matrix:
before_install: *vcpreinst
install: []
script:
- cmd.exe /C 'vcvarsall.bat x86 && nmake OPTS=symbols -f makefile.vc all tcltest'
- cmd.exe /C 'vcvarsall.bat x86 && nmake OPTS=symbols -f makefile.vc test'
- cmd.exe //C vcvarsall.bat x86 '&&' nmake 'OPTS=symbols' '-f' makefile.vc all tcltest
- cmd.exe //C vcvarsall.bat x86 '&&' nmake 'OPTS=symbols' '-f' makefile.vc test
# Test on Windows with GCC native
- name: "Windows/GCC/Shared"
os: windows
@@ -334,19 +316,12 @@ matrix:
before_install: &makepreinst
- choco install -y make zip
- cd ${BUILD_DIR}
- name: "Windows/GCC/Shared: UTF_MAX=6"
- name: "Windows/GCC/Shared: UTF_MAX=4"
os: windows
compiler: gcc
env:
- BUILD_DIR=win
- CFGOPT="--enable-64bit CFLAGS=-DTCL_UTF_MAX=6"
before_install: *makepreinst
- name: "Windows/GCC/Shared: UTF_MAX=3"
os: windows
compiler: gcc
env:
- BUILD_DIR=win
- CFGOPT="--enable-64bit CFLAGS=-DTCL_UTF_MAX=3"
- CFGOPT="--enable-64bit CFLAGS=-DTCL_UTF_MAX=4"
before_install: *makepreinst
- name: "Windows/GCC/Shared: NO_DEPRECATED"
os: windows
@@ -355,6 +330,15 @@ matrix:
- BUILD_DIR=win
- CFGOPT="--enable-64bit CFLAGS=-DTCL_NO_DEPRECATED=1"
before_install: *makepreinst
- name: "Windows/G++/Shared"
os: windows
compiler: g++
env:
- BUILD_DIR=win
- CFGOPT="CC=g++ --enable-64bit"
before_install: *makepreinst
script:
- make all tcltest
- name: "Windows/GCC/Static"
os: windows
compiler: gcc
@@ -376,19 +360,12 @@ matrix:
env:
- BUILD_DIR=win
before_install: *makepreinst
- name: "Windows/GCC-x86/Shared: UTF_MAX=6"
- name: "Windows/GCC-x86/Shared: UTF_MAX=4"
os: windows
compiler: gcc
env:
- BUILD_DIR=win
- CFGOPT="CFLAGS=-DTCL_UTF_MAX=6"
before_install: *makepreinst
- name: "Windows/GCC-x86/Shared: UTF_MAX=3"
os: windows
compiler: gcc
env:
- BUILD_DIR=win
- CFGOPT="CFLAGS=-DTCL_UTF_MAX=3"
- CFGOPT="CFLAGS=-DTCL_UTF_MAX=4"
before_install: *makepreinst
- name: "Windows/GCC-x86/Shared: NO_DEPRECATED"
os: windows
@@ -397,6 +374,15 @@ matrix:
- BUILD_DIR=win
- CFGOPT="CFLAGS=-DTCL_NO_DEPRECATED=1"
before_install: *makepreinst
- name: "Windows/G++-x86/Shared"
os: windows
compiler: g++
env:
- BUILD_DIR=win
- CFGOPT="CC=g++"
before_install: *makepreinst
script:
- make all tcltest
- name: "Windows/GCC-x86/Static"
os: windows
compiler: gcc
+1 -1
View File
@@ -1847,7 +1847,7 @@ a better first place to look now.
* tools/uniClass.tcl: [FRQ 3473670]: Various Unicode-related
* tools/uniParse.tcl: speedups/robustness. Enhanced tools to be
* generic/tclUniData.c: able to handle characters > 0xffff. Done in
* generic/tclUniData.c: able to handle characters > 0xFFFF. Done in
* generic/tclUtf.c: all branches in order to simplify merges for
* generic/regc_locale.c: new Unicode versions (such as 6.1)
+1 -1
View File
@@ -2913,7 +2913,7 @@
* generic/tclCompCmds.c: Updated callers to call new routine.
* generic/tclDictObj.c: Updated callers to call new routine.
* tests/obj.test: Corrected bad tests that actually expected
values like "47" and "0xac" to be accepted as booleans.
values like "47" and "0xAC" to be accepted as booleans.
* generic/tclLiteral.c: Disabled the code that forces some literals
into the "int" Tcl_ObjType during registration. We can re-enable it if
+1 -1
View File
@@ -1,6 +1,6 @@
# README: Tcl
This is the **Tcl 8.7a2** source distribution.
This is the **Tcl 8.7a4** source distribution.
You can get any source release of Tcl from [our distribution
site](https://sourceforge.net/projects/tcl/files/Tcl/).
+3 -3
View File
@@ -2307,7 +2307,7 @@ to the standard channel, do not increment the refcount. The channel can
be NULL if there is for example no standard input. (JL)
9/6/96 (portability improvement) Changed parsing of backslash sequences
like \n to translate directly to absolute values like 0xa instead of
like \n to translate directly to absolute values like 0xA instead of
letting the compiler do the translation. This guarantees that the
translation is done the same everywhere. (JO)
@@ -9024,11 +9024,11 @@ in this changeset (new minor version) rather than bug fixes:
2018-02-14 [TIP 476] Scan/Printf consistency (nijtmans)
2018-03-05 [TIP 351] [lsearch] striding
2018-03-05 [TIP 351] [lsearch] striding
2018-03-05 [TIPs 330,336] tighten access to Interp fields (porter)
2018-03-12 [TIP 462] [::tcl::process]
2018-03-12 [TIP 462] [::tcl::process]
2018-03-12 [TIP 490] add oo support for msgcat => msgcat 1.7.0 (oehlmann)
+1 -1
View File
@@ -218,7 +218,7 @@ fake_getaddrinfo(const char *hostname, const char *servname,
}
if (!hostname) {
*res = malloc_ai(port, htonl(0x7f000001), hints);
*res = malloc_ai(port, htonl(0x7F000001), hints);
if (*res == NULL)
return (EAI_MEMORY);
return (0);
+1 -1
View File
@@ -53,7 +53,7 @@ strtol(
*/
p = string;
while (TclIsSpaceProc(*p)) {
while (isspace(UCHAR(*p))) {
p += 1;
}
+1 -1
View File
@@ -74,7 +74,7 @@ strtoul(
*/
p = string;
while (TclIsSpaceProc(*p)) {
while (isspace(UCHAR(*p))) {
p += 1;
}
if (*p == '-') {
+1
View File
@@ -43,6 +43,7 @@ static int decrypt_byte(unsigned long* pkeys, const z_crc_t* pcrc_32_tab)
unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an
* unpredictable manner on 16-bit systems; not a problem
* with any known compiler so far, though */
(void)pcrc_32_tab;
temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2;
return (int)(((temp * (temp ^ 1)) >> 8) & 0xff);
+3
View File
@@ -247,6 +247,9 @@ record instead of a value. Otherwise, it is similar to
.PP
\fBTcl_SetErrorCodeVA\fR is the same as \fBTcl_SetErrorCode\fR except that
instead of taking a variable number of arguments it takes an argument list.
Interfaces using argument lists have been found to be nonportable in practice.
This function is deprecated and will be removed in Tcl 9.0.
.PP
The procedure \fBTcl_GetErrorLine\fR is used to read the integer value
of the \fB\-errorline\fR return option without the overhead of a full
+2 -2
View File
@@ -648,8 +648,8 @@ It should call \fBTcl_BadChannelOption\fR which itself returns
unrecognized.
If \fInewValue\fR specifies a value for the option that
is not supported or if a system call error occurs,
the function should leave an error message in the
\fIresult\fR field of \fIinterp\fR if \fIinterp\fR is not NULL. The
the function should leave an error message in the result
of \fIinterp\fR if \fIinterp\fR is not NULL. The
function should also call \fBTcl_SetErrno\fR to store an appropriate POSIX
error code.
.PP
-6
View File
@@ -22,10 +22,8 @@ Tcl_Interp *
int
\fBTcl_InterpDeleted\fR(\fIinterp\fR)
.sp
.VS 8.6
int
\fBTcl_InterpActive\fR(\fIinterp\fR)
.VE 8.6
.SH ARGUMENTS
.AS Tcl_Interp *interp
.AP Tcl_Interp *interp in
@@ -70,14 +68,12 @@ deleted and when the whole interpreter is being deleted. In the former case
the callback may recreate the data being deleted, but this would lead to an
infinite loop if the interpreter were being deleted.
.PP
.VS 8.6
\fBTcl_InterpActive\fR is useful for determining whether there is any
execution of scripts ongoing in an interpreter, which is a useful piece of
information when Tcl is embedded in a garbage-collected environment and it
becomes necessary to determine whether the interpreter is a candidate for
deletion. The function returns a true value if the interpreter has at least
one active execution running inside it, and a false value otherwise.
.VE 8.6
.SH "INTERPRETERS AND MEMORY MANAGEMENT"
.PP
\fBTcl_DeleteInterp\fR can be called at any time on an interpreter that may
@@ -138,12 +134,10 @@ All uses of interpreters in Tcl and Tk have already been protected.
Extension writers should ensure that their code also properly protects any
additional interpreters used, as described above.
.PP
.VS 8.6
Note that the protection mechanisms do not work well with conventional garbage
collection systems. When in such a managed environment, \fBTcl_InterpActive\fR
should be used to determine when an interpreter is a candidate for deletion
due to inactivity.
.VE 8.6
.SH "SEE ALSO"
Tcl_Preserve(3), Tcl_Release(3)
.SH KEYWORDS
+17 -17
View File
@@ -119,7 +119,7 @@ in a hierarchical relationship, and the management of aliases, commands
that when invoked in one interpreter execute a command in another
interpreter. The return value for those procedures that return an \fBint\fR
is either \fBTCL_OK\fR or \fBTCL_ERROR\fR. If \fBTCL_ERROR\fR is returned
then the \fBresult\fR field of the interpreter contains an error message.
then the interpreter's result contains an error message.
.PP
\fBTcl_CreateSlave\fR creates a new interpreter as a slave of \fIinterp\fR.
It also creates a slave command named \fIslaveName\fR in \fIinterp\fR which
@@ -158,12 +158,12 @@ If no such slave interpreter exists, \fBNULL\fR is returned.
\fIinterp\fR. If \fIinterp\fR has no master (it is a
top-level interpreter) then \fBNULL\fR is returned.
.PP
\fBTcl_GetInterpPath\fR sets the \fIresult\fR field in \fIaskingInterp\fR
to the relative path between \fIaskingInterp\fR and \fIslaveInterp\fR;
\fBTcl_GetInterpPath\fR stores in the result of \fIaskingInterp\fR
the relative path between \fIaskingInterp\fR and \fIslaveInterp\fR;
\fIslaveInterp\fR must be a slave of \fIaskingInterp\fR. If the computation
of the relative path succeeds, \fBTCL_OK\fR is returned, else
\fBTCL_ERROR\fR is returned and the \fIresult\fR field in
\fIaskingInterp\fR contains the error message.
\fBTCL_ERROR\fR is returned and an error message is stored as the
result of \fIaskingInterp\fR.
.PP
\fBTcl_CreateAlias\fR creates a command named \fIslaveCmd\fR in
\fIslaveInterp\fR that when invoked, will cause the command \fItargetCmd\fR
@@ -198,33 +198,33 @@ the set of hidden commands to the set of exposed commands, putting
it under the name
\fIcmdName\fR.
\fIHiddenCmdName\fR must be the name of an existing hidden
command, or the operation will return \fBTCL_ERROR\fR and leave an error
message in the \fIresult\fR field in \fIinterp\fR.
command, or the operation will return \fBTCL_ERROR\fR and
leave an error message as the result of \fIinterp\fR.
If an exposed command named \fIcmdName\fR already exists,
the operation returns \fBTCL_ERROR\fR and leaves an error message in the
value result of \fIinterp\fR.
the operation returns \fBTCL_ERROR\fR and leaves an error message as
the result of \fIinterp\fR.
If the operation succeeds, it returns \fBTCL_OK\fR.
After executing this command, attempts to use \fIcmdName\fR in a call to
\fBTcl_Eval\fR or with the Tcl \fBeval\fR command will again succeed.
After executing this command, attempts to use \fIcmdName\fR in any
script evaluation mechanism will again succeed.
.PP
\fBTcl_HideCommand\fR moves the command named \fIcmdName\fR from the set of
exposed commands to the set of hidden commands, under the name
\fIhiddenCmdName\fR.
\fICmdName\fR must be the name of an existing exposed
command, or the operation will return \fBTCL_ERROR\fR and leave an error
message in the value result of \fIinterp\fR.
message as the result of \fIinterp\fR.
Currently both \fIcmdName\fR and \fIhiddenCmdName\fR must not contain
namespace qualifiers, or the operation will return \fBTCL_ERROR\fR and
leave an error message in the value result of \fIinterp\fR.
leave an error message as the result of \fIinterp\fR.
The \fICmdName\fR will be looked up in the global namespace, and not
relative to the current namespace, even if the current namespace is not the
global one.
If a hidden command whose name is \fIhiddenCmdName\fR already
exists, the operation also returns \fBTCL_ERROR\fR and the \fIresult\fR
field in \fIinterp\fR contains an error message.
exists, the operation also returns \fBTCL_ERROR\fR and an error
message is left as the result of \fIinterp\fR.
If the operation succeeds, it returns \fBTCL_OK\fR.
After executing this command, attempts to use \fIcmdName\fR in a call to
\fBTcl_Eval\fR or with the Tcl \fBeval\fR command will fail.
After executing this command, attempts to use \fIcmdName\fR in
any script evaluation mechanism will fail.
.PP
For a description of the Tcl interface to multiple interpreters, see
\fIinterp(n)\fR.
-4
View File
@@ -36,13 +36,11 @@ int
int
\fBTcl_SetEnsembleMappingDict\fR(\fIinterp, token, dictObj\fR)
.sp
.VS 8.6
int
\fBTcl_GetEnsembleParameterList\fR(\fIinterp, token, listObjPtr\fR)
.sp
int
\fBTcl_SetEnsembleParameterList\fR(\fIinterp, token, listObj\fR)
.VE 8.6
.sp
int
\fBTcl_GetEnsembleSubcommandList\fR(\fIinterp, token, listObjPtr\fR)
@@ -163,7 +161,6 @@ All command names in prefixes set via \fBTcl_SetEnsembleMappingDict\fR
must be fully qualified.
.TP
\fBformal pre-subcommand parameter list\fR (read-write)
.VS 8.6
A list of formal parameter names (the names only being used when generating
error messages) that come at invocation of the ensemble between the name of
the ensemble and the subcommand argument. NULL (the default) is equivalent to
@@ -174,7 +171,6 @@ respectively. The result of both of those functions is a Tcl result code
ensemble) and the
dictionary obtained from \fBTcl_GetEnsembleParameterList\fR should always be
treated as immutable even if it is unshared.
.VE 8.6
.TP
\fBsubcommand list\fR (read-write)
.
+3 -2
View File
@@ -150,13 +150,14 @@ equivalent to using the \fBTCL_EVAL_GLOBAL\fR flag (see below).
of any length, concatenates them into a single string,
then calls \fBTcl_Eval\fR to execute that string as a Tcl command.
It returns the result of the command and also modifies
\fIinterp->result\fR in the same way as \fBTcl_Eval\fR.
the interpreter result in the same way as \fBTcl_Eval\fR.
The last argument to \fBTcl_VarEval\fR must be NULL to indicate the end
of arguments. \fBTcl_VarEval\fR is now deprecated.
.PP
\fBTcl_VarEvalVA\fR is the same as \fBTcl_VarEval\fR except that
instead of taking a variable number of arguments it takes an argument
list. Like \fBTcl_VarEval\fR, \fBTcl_VarEvalVA\fR is deprecated.
list. Interfaces using argument lists have been found to be nonportable
in practice. This function is deprecated and will be removed in Tcl 9.0.
.SH "FLAG BITS"
.PP
-10
View File
@@ -63,10 +63,8 @@ int
\fBTcl_FSLoadFile\fR(\fIinterp, pathPtr, sym1, sym2, proc1Ptr, proc2Ptr,
loadHandlePtr, unloadProcPtr\fR)
.sp
.VS 8.6
int
\fBTcl_FSUnloadFile\fR(\fIinterp, loadHandle\fR)
.VE 8.6
.sp
int
\fBTcl_FSMatchInDirectory\fR(\fIinterp, resultPtr, pathPtr, pattern, types\fR)
@@ -146,7 +144,6 @@ Tcl_Obj *
Tcl_StatBuf *
\fBTcl_AllocStatBuf\fR()
.sp
.VS 8.6
Tcl_WideInt
\fBTcl_GetAccessTimeFromStat\fR(\fIstatPtr\fR)
.sp
@@ -185,7 +182,6 @@ Tcl_WideUInt
.sp
int
\fBTcl_GetUserIdFromStat\fR(\fIstatPtr\fR)
.VE 8.6
.SH ARGUMENTS
.AS Tcl_GlobTypeData **srcPathPtr out
.AP "const Tcl_Filesystem" *fsPtr in
@@ -444,20 +440,16 @@ belongs will be called. If that filesystem does not implement this
function (most virtual filesystems will not, because of OS limitations
in dynamically loading binary code), Tcl will attempt to copy the file
to a temporary directory and load that temporary file.
.VS 8.6
\fBTcl_FSUnloadFile\fR reverses the operation, asking for the library
indicated by the \fIloadHandle\fR to be removed from the process. Note that,
unlike with the \fBunload\fR command, this does not give the library any
opportunity to clean up.
.VE 8.6
.PP
Both the above functions return a standard Tcl completion code. If an error
occurs, an error message is left in the \fIinterp\fR's result.
.PP
.VS 8.6
The token provided via the variable indicated by \fIloadHandlePtr\fR may be
used with \fBTcl_FindSymbol\fR.
.VE 8.6
.PP
\fBTcl_FSMatchInDirectory\fR is used by the globbing code to search a
directory for all files which match a given pattern. The appropriate
@@ -795,7 +787,6 @@ may be deallocated by being passed to \fBckfree\fR). This allows extensions to
invoke \fBTcl_FSStat\fR and \fBTcl_FSLstat\fR without being dependent on the
size of the buffer. That in turn depends on the flags used to build Tcl.
.PP
.VS 8.6
The portable fields of a \fITcl_StatBuf\fR may be read using the following
functions, each of which returns the value of the corresponding field listed
in the table below. Note that on some platforms there may be other fields in
@@ -819,7 +810,6 @@ for a full description of these fields.
\fBTcl_GetBlocksFromStat\fR st_blocks
\fBTcl_GetBlockSizeFromStat\fR st_blksize
.DE
.VE 8.6
.SH "THE VIRTUAL FILESYSTEM API"
.PP
A filesystem provides a \fBTcl_Filesystem\fR structure that contains
+13 -106
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
.TH Tcl_Interp 3 7.5 Tcl "Tcl Library Procedures"
.TH Tcl_Interp 3 8.7 Tcl "Tcl Library Procedures"
.so man.macros
.BS
.SH NAME
@@ -15,9 +15,9 @@ Tcl_Interp \- client-visible fields of interpreter structures
\fB#include <tcl.h>\fR
.sp
typedef struct {
char *\fIresult\fR;
Tcl_FreeProc *\fIfreeProc\fR;
int \fIerrorLine\fR;
char *\fIresult\fR; /* NO LONGER AVAILABLE */
Tcl_FreeProc *\fIfreeProc\fR; /* NO LONGER AVAILABLE */
int \fIerrorLine\fR; /* NO LONGER AVAILABLE */
} \fBTcl_Interp\fR;
typedef void \fBTcl_FreeProc\fR(
@@ -25,110 +25,17 @@ typedef void \fBTcl_FreeProc\fR(
.BE
.SH DESCRIPTION
.PP
The \fBTcl_CreateInterp\fR procedure returns a pointer to a Tcl_Interp
The \fBTcl_CreateInterp\fR procedure returns a pointer to a \fBTcl_Interp\fR
structure. Callers of \fBTcl_CreateInterp\fR should use this pointer
as an opaque token, suitable for nothing other than passing back to
other routines in the Tcl interface. Accessing fields directly through
the pointer as described below is no longer supported. The supported
public routines \fBTcl_SetResult\fR, \fBTcl_GetResult\fR,
\fBTcl_SetErrorLine\fR, \fBTcl_GetErrorLine\fR must be used instead.
other routines in the Tcl interface from the same thread that called
\fBTcl_CreateInterp\fR. The \fBTcl_Interp\fR struct no longer has any
supported client-visible fields. Supported public routines such as
\fBTcl_SetResult\fR, \fBTcl_GetResult\fR, \fBTcl_SetErrorLine\fR,
\fBTcl_GetErrorLine\fR must be used instead.
.PP
For legacy programs and extensions no longer being maintained, compiles
against the Tcl 8.6 header files are only possible with the compiler
directives
.CS
#define USE_INTERP_RESULT
.CE
and/or
.CS
#define USE_INTERP_ERRORLINE
.CE
depending on which fields of the \fBTcl_Interp\fR struct are accessed.
These directives may be embedded in code or supplied via compiler options.
.PP
The \fIresult\fR and \fIfreeProc\fR fields are used to return
results or error messages from commands.
This information is returned by command procedures back to \fBTcl_Eval\fR,
and by \fBTcl_Eval\fR back to its callers.
The \fIresult\fR field points to the string that represents the
result or error message, and the \fIfreeProc\fR field tells how
to dispose of the storage for the string when it is not needed anymore.
The easiest way for command procedures to manipulate these
fields is to call procedures like \fBTcl_SetResult\fR
or \fBTcl_AppendResult\fR; they
will hide all the details of managing the fields.
The description below is for those procedures that manipulate the
fields directly.
.PP
Whenever a command procedure returns, it must ensure
that the \fIresult\fR field of its interpreter points to the string
being returned by the command.
The \fIresult\fR field must always point to a valid string.
If a command wishes to return no result then \fIinterp->result\fR
should point to an empty string.
Normally, results are assumed to be statically allocated,
which means that the contents will not change before the next time
\fBTcl_Eval\fR is called or some other command procedure is invoked.
In this case, the \fIfreeProc\fR field must be zero.
Alternatively, a command procedure may dynamically
allocate its return value (e.g. using \fBTcl_Alloc\fR)
and store a pointer to it in \fIinterp->result\fR.
In this case, the command procedure must also set \fIinterp->freeProc\fR
to the address of a procedure that can free the value, or \fBTCL_DYNAMIC\fR
if the storage was allocated directly by Tcl or by a call to
\fBTcl_Alloc\fR.
If \fIinterp->freeProc\fR is non-zero, then Tcl will call \fIfreeProc\fR
to free the space pointed to by \fIinterp->result\fR before it
invokes the next command.
If a client procedure overwrites \fIinterp->result\fR when
\fIinterp->freeProc\fR is non-zero, then it is responsible for calling
\fIfreeProc\fR to free the old \fIinterp->result\fR (the \fBTcl_FreeResult\fR
macro should be used for this purpose).
.PP
\fIFreeProc\fR should have arguments and result that match the
\fBTcl_FreeProc\fR declaration above: it receives a single
argument which is a pointer to the result value to free.
In most applications \fBTCL_DYNAMIC\fR is the only non-zero value ever
used for \fIfreeProc\fR.
However, an application may store a different procedure address
in \fIfreeProc\fR in order to use an alternate memory allocator
or in order to do other cleanup when the result memory is freed.
.PP
As part of processing each command, \fBTcl_Eval\fR initializes
\fIinterp->result\fR
and \fIinterp->freeProc\fR just before calling the command procedure for
the command. The \fIfreeProc\fR field will be initialized to zero,
and \fIinterp->result\fR will point to an empty string. Commands that
do not return any value can simply leave the fields alone.
Furthermore, the empty string pointed to by \fIresult\fR is actually
part of an array of approximately 200 characters.
If a command wishes to return a short string, it can simply copy
it to the area pointed to by \fIinterp->result\fR. Or, it can use
the sprintf procedure to generate a short result string at the location
pointed to by \fIinterp->result\fR.
.PP
It is a general convention in Tcl-based applications that the result
of an interpreter is normally in the initialized state described
in the previous paragraph.
Procedures that manipulate an interpreter's result (e.g. by
returning an error) will generally assume that the result
has been initialized when the procedure is called.
If such a procedure is to be called after the result has been
changed, then \fBTcl_ResetResult\fR should be called first to
reset the result to its initialized state. The direct use of
\fIinterp->result\fR is strongly deprecated (see \fBTcl_SetResult\fR).
.PP
The \fIerrorLine\fR
field is valid only after \fBTcl_Eval\fR returns
a \fBTCL_ERROR\fR return code. In this situation the \fIerrorLine\fR
field identifies the line number of the command being executed when
the error occurred. The line numbers are relative to the command
being executed: 1 means the first line of the command passed to
\fBTcl_Eval\fR, 2 means the second line, and so on.
The \fIerrorLine\fR field is typically used in conjunction with
\fBTcl_AddErrorInfo\fR to report information about where an error
occurred.
\fIErrorLine\fR should not normally be modified except by \fBTcl_Eval\fR.
Any legacy programs and extensions trying to access the fields above
in their source code will need conversion to compile for Tcl 8.7 and later.
.SH KEYWORDS
free, initialized, interpreter, malloc, result
interpreter, result
+12 -12
View File
@@ -96,7 +96,7 @@ Any value written into the Tcl variable must have a proper integer
form acceptable to \fBTcl_GetIntFromObj\fR; attempts to write
non-integer values into \fIvarName\fR will be rejected with
Tcl errors. Incomplete integer representations (like the empty
string, '+', '-' or the hex/octal/binary prefix) are accepted
string, '+', '-' or the hex/octal/decimal/binary prefix) are accepted
as if they are valid too.
.TP
\fBTCL_LINK_UINT\fR
@@ -107,7 +107,7 @@ integer form acceptable to \fBTcl_GetWideIntFromObj\fR and in the
platform's defined range for the \fBunsigned int\fR type; attempts to
write non-integer values (or values outside the range) into
\fIvarName\fR will be rejected with Tcl errors. Incomplete integer
representations (like the empty string, '+', '-' or the hex/octal/binary
representations (like the empty string, '+', '-' or the hex/octal/decimal/binary
prefix) are accepted as if they are valid too.
.TP
\fBTCL_LINK_CHAR\fR
@@ -118,7 +118,7 @@ form acceptable to \fBTcl_GetIntFromObj\fR and be in the range of the
\fBchar\fR datatype; attempts to write non-integer or out-of-range
values into \fIvarName\fR will be rejected with Tcl errors. Incomplete
integer representations (like the empty string, '+', '-' or the
hex/octal/binary prefix) are accepted as if they are valid too.
hex/octal/decimal/binary prefix) are accepted as if they are valid too.
.RS
.PP
.VS "TIP 312"
@@ -141,7 +141,7 @@ integer form acceptable to \fBTcl_GetIntFromObj\fR and in the
platform's defined range for the \fBunsigned char\fR type; attempts to
write non-integer values (or values outside the range) into
\fIvarName\fR will be rejected with Tcl errors. Incomplete integer
representations (like the empty string, '+', '-' or the hex/octal/binary
representations (like the empty string, '+', '-' or the hex/octal/decimal/binary
prefix) are accepted as if they are valid too.
.RS
.PP
@@ -166,7 +166,7 @@ form acceptable to \fBTcl_GetIntFromObj\fR and be in the range of the
\fBshort\fR datatype; attempts to write non-integer or out-of-range
values into \fIvarName\fR will be rejected with Tcl errors. Incomplete
integer representations (like the empty string, '+', '-' or the
hex/octal/binary prefix) are accepted as if they are valid too.
hex/octal/decimal/binary prefix) are accepted as if they are valid too.
.TP
\fBTCL_LINK_USHORT\fR
.
@@ -176,7 +176,7 @@ integer form acceptable to \fBTcl_GetIntFromObj\fR and in the
platform's defined range for the \fBunsigned short\fR type; attempts to
write non-integer values (or values outside the range) into
\fIvarName\fR will be rejected with Tcl errors. Incomplete integer
representations (like the empty string, '+', '-' or the hex/octal/binary
representations (like the empty string, '+', '-' or the hex/octal/decimal/binary
prefix) are accepted as if they are valid too.
.TP
\fBTCL_LINK_LONG\fR
@@ -187,7 +187,7 @@ form acceptable to \fBTcl_GetLongFromObj\fR; attempts to write
non-integer or out-of-range
values into \fIvarName\fR will be rejected with Tcl errors. Incomplete
integer representations (like the empty string, '+', '-' or the
hex/octal/binary prefix) are accepted as if they are valid too.
hex/octal/decimal/binary prefix) are accepted as if they are valid too.
.TP
\fBTCL_LINK_ULONG\fR
.
@@ -197,7 +197,7 @@ integer form acceptable to \fBTcl_GetWideIntFromObj\fR and in the
platform's defined range for the \fBunsigned long\fR type; attempts to
write non-integer values (or values outside the range) into
\fIvarName\fR will be rejected with Tcl errors. Incomplete integer
representations (like the empty string, '+', '-' or the hex/octal/binary
representations (like the empty string, '+', '-' or the hex/octal/decimal/binary
prefix) are accepted as if they are valid too.
.TP
\fBTCL_LINK_DOUBLE\fR
@@ -207,7 +207,7 @@ Any value written into the Tcl variable must have a proper real
form acceptable to \fBTcl_GetDoubleFromObj\fR; attempts to write
non-real values into \fIvarName\fR will be rejected with
Tcl errors. Incomplete integer or real representations (like the
empty string, '.', '+', '-' or the hex/octal/binary prefix) are
empty string, '.', '+', '-' or the hex/octal/decimal/binary prefix) are
accepted as if they are valid too.
.TP
\fBTCL_LINK_FLOAT\fR
@@ -219,7 +219,7 @@ range acceptable for a \fBfloat\fR; attempts to
write non-real values (or values outside the range) into
\fIvarName\fR will be rejected with Tcl errors. Incomplete integer
or real representations (like the empty string, '.', '+', '-' or
the hex/octal/binary prefix) are accepted as if they are valid too.
the hex/octal/decimal/binary prefix) are accepted as if they are valid too.
.TP
\fBTCL_LINK_WIDE_INT\fR
.
@@ -230,7 +230,7 @@ Any value written into the Tcl variable must have a proper integer
form acceptable to \fBTcl_GetWideIntFromObj\fR; attempts to write
non-integer values into \fIvarName\fR will be rejected with
Tcl errors. Incomplete integer representations (like the empty
string, '+', '-' or the hex/octal/binary prefix) are accepted
string, '+', '-' or the hex/octal/decimal/binary prefix) are accepted
as if they are valid too.
.TP
\fBTCL_LINK_WIDE_UINT\fR
@@ -244,7 +244,7 @@ cast to unsigned);
.\" FIXME! Use bignums instead.
attempts to write non-integer values into \fIvarName\fR will be
rejected with Tcl errors. Incomplete integer representations (like
the empty string, '+', '-' or the hex/octal/binary prefix) are accepted
the empty string, '+', '-' or the hex/octal/decimal/binary prefix) are accepted
as if they are valid too.
.TP
\fBTCL_LINK_BOOLEAN\fR
-2
View File
@@ -85,14 +85,12 @@ unless \fIinterp\fR is NULL.
Otherwise, it returns \fBTCL_OK\fR.
Passing a NULL \fIinterp\fR allows this procedure to be used
as a test whether the conversion can be done (and in fact was done).
.VS 8.5
.PP
In many cases, the \fItypePtr->setFromAnyProc\fR routine will
set \fIobjPtr->typePtr\fR to the argument value \fItypePtr\fR,
but that is no longer guaranteed. The \fIsetFromAnyProc\fR is
free to set the internal representation for \fIobjPtr\fR to make
use of another related Tcl_ObjType, if it sees fit.
.VE 8.5
.SH "THE TCL_OBJTYPE STRUCTURE"
.PP
Extension writers can define new value types by defining four
+7 -6
View File
@@ -53,13 +53,13 @@ In a freshly loaded Tcl library, \fBTcl_Panic\fR prints the formatted
error message to the standard error file of the process, and then
calls \fBabort\fR to terminate the process. \fBTcl_Panic\fR does not
return. On Windows, when a debugger is running, the formatted error
message is sent to the debugger in stead. If the windows executable
message is sent to the debugger instead. If the windows executable
does not have a stderr channel (e.g. \fBwish.exe\fR), then a
system dialog box is used to display the panic message.
.PP
If your application doesn't use \fBTcl_Main\fR or \fBTk_Main\fR
and you want to implicitly use the stderr channel of your
application's C runtime (in stead of the stderr channel of the
application's C runtime (instead of the stderr channel of the
C runtime used by Tcl), you can call \fBTcl_SetPanicProc\fR
with \fBTcl_ConsolePanic\fR as its argument. On platforms which
only have one C runtime (almost all platforms except Windows)
@@ -86,6 +86,9 @@ The typical use of \fBTcl_SetPanicProc\fR arranges for the error message
to be displayed or reported in a manner more suitable for the
application or the platform.
.PP
\fBTcl_SetPanicProc\fR can not be used in stub-enabled extensions. Its symbol
entry in the stub table is deprecated and it will be removed in Tcl 9.0.
.PP
Although the primary callers of \fBTcl_Panic\fR are the procedures of
the Tcl library, \fBTcl_Panic\fR is a public function and may be called
by any extension or application that wishes to abort the process and
@@ -93,11 +96,9 @@ have a panic message displayed the same way that panic messages from Tcl
will be displayed.
.PP
\fBTcl_PanicVA\fR is the same as \fBTcl_Panic\fR except that instead of
taking a variable number of arguments it takes an argument list. This
taking a variable number of arguments it takes an argument list. Interfaces
using argument lists have been found to be nonportable in practice. This
function is deprecated and will be removed in Tcl 9.0.
.PP
This function can not be used in stub-enabled extensions. Its symbol
entry in the stub table is deprecated and it will be removed in Tcl 9.0.
.SH "SEE ALSO"
abort(3), printf(3), exec(n), format(n)
.SH KEYWORDS
+1 -1
View File
@@ -302,7 +302,7 @@ The \fInumComponents\fR field is always 0.
.TP
\fBTCL_TOKEN_BS\fR
.
The token describes a backslash sequence such as \fB\en\fR or \fB\e0xa3\fR.
The token describes a backslash sequence such as \fB\en\fR or \fB\e0xA3\fR.
The \fInumComponents\fR field is always 0.
.TP
\fBTCL_TOKEN_COMMAND\fR
+19 -28
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
.TH Tcl_SetResult 3 8.0 Tcl "Tcl Library Procedures"
.TH Tcl_SetResult 3 8.7 Tcl "Tcl Library Procedures"
.so man.macros
.BS
.SH NAME
@@ -30,9 +30,7 @@ const char *
.sp
\fBTcl_ResetResult\fR(\fIinterp\fR)
.sp
.VS 8.6
\fBTcl_TransferResult\fR(\fIsourceInterp, result, targetInterp\fR)
.VE 8.6
\fBTcl_TransferResult\fR(\fIsourceInterp, code, targetInterp\fR)
.sp
\fBTcl_AppendElement\fR(\fIinterp, element\fR)
.sp
@@ -57,18 +55,11 @@ Address of procedure to call to release storage at
An argument list which must have been initialized using
\fBva_start\fR, and cleared using \fBva_end\fR.
.AP Tcl_Interp *sourceInterp in
.VS 8.6
Interpreter that the result and error information should be copied from.
.VE 8.6
Interpreter that the result and return options should be transferred from.
.AP Tcl_Interp *targetInterp in
.VS 8.6
Interpreter that the result and error information should be copied to.
.VE 8.6
.AP int result in
.VS 8.6
If \fBTCL_OK\fR, only copy the result. If \fBTCL_ERROR\fR, copy the error
information as well.
.VE 8.6
Interpreter that the result and return options should be transferred to.
.AP int code in
Return code value that controls transfer of return options.
.BE
.SH DESCRIPTION
.PP
@@ -154,13 +145,17 @@ call; the last argument in the list must be a NULL pointer.
.PP
\fBTcl_AppendResultVA\fR is the same as \fBTcl_AppendResult\fR except that
instead of taking a variable number of arguments it takes an argument list.
Interfaces using argument lists have been found to be nonportable in practice.
This function is deprecated and will be removed in Tcl 9.0.
.PP
.VS 8.6
\fBTcl_TransferResult\fR moves a result from one interpreter to another,
optionally (dependent on the \fIresult\fR parameter) including the error
information dictionary as well. The interpreters must be in the same thread.
The source interpreter will have its result reset by this operation.
.VE 8.6
\fBTcl_TransferResult\fR transfers interpreter state from \fIsourceInterp\fR
to \fItargetInterp\fR. The two interpreters must have been created in the
same thread. If \fIsourceInterp\fR and \fItargetInterp\fR are the same,
nothing is done. Otherwise, \fBTcl_TransferResult\fR moves the result
from \fIsourceInterp\fR to \fItargetInterp\fR, and resets the result
in \fIsourceInterp\fR. It also moves the return options dictionary as
controlled by the return code value \fIcode\fR in the same manner
as \fBTcl_GetReturnOptions\fR.
.SH "DEPRECATED INTERFACES"
.SS "OLD STRING PROCEDURES"
.PP
@@ -202,14 +197,9 @@ is about to replace one result value with another.
It used to be legal for programs to
directly read and write \fIinterp->result\fR
to manipulate the interpreter result. The Tcl headers no longer
permit this access by default, and C code still doing this must
permit this access. C code still doing this must
be updated to use supported routines \fBTcl_GetObjResult\fR,
\fBTcl_GetStringResult\fR, \fBTcl_SetObjResult\fR, and \fBTcl_SetResult\fR.
As a migration aid, access can be restored with the compiler directive
.CS
#define USE_INTERP_RESULT
.CE
but this is meant only to offer life support to otherwise dead code.
.SH "THE TCL_FREEPROC ARGUMENT TO TCL_SETRESULT"
.PP
\fBTcl_SetResult\fR's \fIfreeProc\fR argument specifies how
@@ -250,6 +240,7 @@ typedef void \fBTcl_FreeProc\fR(
When \fIfreeProc\fR is called, its \fIblockPtr\fR will be set to
the value of \fIresult\fR passed to \fBTcl_SetResult\fR.
.SH "SEE ALSO"
Tcl_AddErrorInfo, Tcl_CreateObjCommand, Tcl_SetErrorCode, Tcl_Interp
Tcl_AddErrorInfo, Tcl_CreateObjCommand, Tcl_SetErrorCode, Tcl_Interp,
Tcl_GetReturnOptions
.SH KEYWORDS
append, command, element, list, value, result, return value, interpreter
+1 -1
View File
@@ -65,7 +65,7 @@ error message. The result or error from the initialization procedure will
be returned as the result of the \fBload\fR command that caused the
initialization procedure to be invoked.
.PP
This function can not be used in stub-enabled extensions. Its symbol
\fBTcl_StaticPackage\fR can not be used in stub-enabled extensions. Its symbol
entry in the stub table is deprecated and it will be removed in Tcl 9.0.
.SH KEYWORDS
initialization procedure, package, static linking
+3 -1
View File
@@ -249,7 +249,9 @@ must be a NULL pointer to indicate the end of the list.
.PP
\fBTcl_AppendStringsToObjVA\fR is the same as \fBTcl_AppendStringsToObj\fR
except that instead of taking a variable number of arguments it takes an
argument list.
argument list. Interfaces using argument lists have been found to be
nonportable in practice. This function is deprecated and will be removed
in Tcl 9.0.
.PP
\fBTcl_AppendLimitedToObj\fR is similar to \fBTcl_AppendToObj\fR
except that it imposes a limit on how many bytes are appended.
+1 -1
View File
@@ -190,7 +190,7 @@ procedure (if any) returns. In non-interactive mode, after
procedure (if any) returns, \fBTcl_Main\fR will also evaluate
the \fBexit\fR command.
.PP
This function can not be used in stub-enabled extensions.
\fBTcl_Main\fR can not be used in stub-enabled extensions.
.SH "SEE ALSO"
tclsh(1), Tcl_GetStdChannel(3), Tcl_StandardChannels(3), Tcl_AppInit(3),
exit(n), encoding(n)
+11 -22
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
.TH Tcl_TraceVar 3 7.4 Tcl "Tcl Library Procedures"
.TH Tcl_TraceVar 3 8.7 Tcl "Tcl Library Procedures"
.so man.macros
.BS
.SH NAME
@@ -95,7 +95,7 @@ Invoke \fIproc\fR whenever an attempt is made to modify the variable.
Invoke \fIproc\fR whenever the variable is unset.
A variable may be unset either explicitly by an \fBunset\fR command,
or implicitly when a procedure returns (its local variables are
automatically unset) or when the interpreter is deleted (all
automatically unset) or when the interpreter or namespace is deleted (all
variables are automatically unset).
.TP
\fBTCL_TRACE_ARRAY\fR
@@ -160,10 +160,6 @@ The bit \fBTCL_TRACE_DESTROYED\fR will be set in \fIflags\fR if the trace is
about to be destroyed; this information may be useful to \fIproc\fR
so that it can clean up its own internal data structures (see
the section \fBTCL_TRACE_DESTROYED\fR below for more details).
Lastly, the bit \fBTCL_INTERP_DESTROYED\fR will be set if the entire
interpreter is being destroyed.
When this bit is set, \fIproc\fR must be especially careful in
the things it does (see the section \fBTCL_INTERP_DESTROYED\fR below).
The trace procedure's return value should normally be NULL; see
\fBERROR RETURNS\fR below for information on other possibilities.
.PP
@@ -330,6 +326,15 @@ During unset traces, the return value is ignored and all relevant
trace procedures will always be invoked.
.SH "RESTRICTIONS"
.PP
Because operations on variables may take place as part of the deletion
of the interp that contains them, \fIproc\fR must be careful about checking
what the \fIinterp\fR parameter can be used to do.
The routine \fBTcl_InterpDeleted\fR is an important tool for this.
When \fBTcl_InterpDeleted\fR returns 1, \fIproc\fR will not be able
to invoke any scripts in \fIinterp\fR. You may encounter old code using
a deprecated flag value \fBTCL_INTERP_DESTROYED\fR to signal this
condition, but any supported code should be converted to stop using it.
.PP
A trace procedure can be called at any time, even when there
are partially formed results stored in the interpreter. If
the trace procedure does anything that could damage this result (such
@@ -354,24 +359,8 @@ Traces on a variable are always removed whenever the variable
is deleted; the only time \fBTCL_TRACE_DESTROYED\fR is not set is for
a whole-array trace invoked when only a single element of an
array is unset.
.SH "TCL_INTERP_DESTROYED"
.PP
When an interpreter is destroyed, unset traces are called for
all of its variables.
The \fBTCL_INTERP_DESTROYED\fR bit will be set in the \fIflags\fR
argument passed to the trace procedures.
Trace procedures must be extremely careful in what they do if
the \fBTCL_INTERP_DESTROYED\fR bit is set.
It is not safe for the procedures to invoke any Tcl procedures
on the interpreter, since its state is partially deleted.
All that trace procedures should do under these circumstances is
to clean up and free their own internal data structures.
.SH BUGS
.PP
Tcl does not do any error checking to prevent trace procedures
from misusing the interpreter during traces with \fBTCL_INTERP_DESTROYED\fR
set.
.PP
Array traces are not yet integrated with the Tcl \fBinfo exists\fR command,
nor is there Tcl-level access to array traces.
.SH "SEE ALSO"
+10 -4
View File
@@ -8,7 +8,7 @@
.so man.macros
.BS
.SH NAME
Tcl_UniChar, Tcl_UniCharToUtf, Tcl_UtfToUniChar, Tcl_UtfToChar16, Tcl_UtfToWChar, Tcl_UniCharToUtfDString, Tcl_UtfToUniCharDString, Tcl_WCharToUtfDString, Tcl_UtfToWCharDString, Tcl_Char16ToUtfDString, Tcl_UtfToChar16DString, Tcl_UniCharLen, Tcl_UniCharNcmp, Tcl_UniCharNcasecmp, Tcl_UniCharCaseMatch, Tcl_UtfNcmp, Tcl_UtfNcasecmp, Tcl_UtfCharComplete, Tcl_NumUtfChars, Tcl_UtfFindFirst, Tcl_UtfFindLast, Tcl_UtfNext, Tcl_UtfPrev, Tcl_UniCharAtIndex, Tcl_UtfAtIndex, Tcl_UtfBackslash \- routines for manipulating UTF-8 strings
Tcl_UniChar, Tcl_UniCharToUtf, Tcl_UtfToUniChar, Tcl_UtfToChar16, Tcl_UtfToWChar, Tcl_UniCharToUtfDString, Tcl_UtfToUniCharDString, Tcl_Char16ToUtfDString, Tcl_UtfToWCharDString, Tcl_UtfToChar16DString, Tcl_UniCharLen, Tcl_UniCharNcmp, Tcl_UniCharNcasecmp, Tcl_UniCharCaseMatch, Tcl_UtfNcmp, Tcl_UtfNcasecmp, Tcl_UtfCharComplete, Tcl_NumUtfChars, Tcl_UtfFindFirst, Tcl_UtfFindLast, Tcl_UtfNext, Tcl_UtfPrev, Tcl_UniCharAtIndex, Tcl_UtfAtIndex, Tcl_UtfBackslash \- routines for manipulating UTF-8 strings
.SH SYNOPSIS
.nf
\fB#include <tcl.h>\fR
@@ -120,6 +120,12 @@ A null-terminated Unicode string.
A null-terminated UTF-16 string.
.AP "const wchar_t" *wStr in
A null-terminated wchar_t string.
.AP "const unsigned short" *utf16s in
A null-terminated utf-16 string.
.AP "const unsigned short" *utf16t in
A null-terminated utf-16 string.
.AP "const unsigned short" *utf16Pattern in
A null-terminated utf-16 string.
.AP int length in
The length of the UTF-8 string in bytes (not UTF-8 characters). If
negative, all bytes up to the first null byte are used.
@@ -148,11 +154,11 @@ case-insensitive (1).
.PP
These routines convert between UTF-8 strings and Unicode/Utf-16 characters.
A UTF-8 character is a Unicode character represented as a varying-length
sequence of up to \fBTCL_UTF_MAX\fR bytes. A multibyte UTF-8 sequence
sequence of up to \fB4\fR bytes. A multibyte UTF-8 sequence
consists of a lead byte followed by some number of trail bytes.
.PP
\fBTCL_UTF_MAX\fR is the maximum number of bytes that it takes to
represent one Unicode character in the UTF-8 representation.
\fBTCL_UTF_MAX\fR is the maximum number of bytes that \fBTcl_UtfToUniChar\fR
can consume in a single call.
.PP
\fBTcl_UniCharToUtf\fR stores the character \fIch\fR as a UTF-8 string
in starting at \fIbuf\fR. The return value is the number of bytes stored
+7 -4
View File
@@ -73,7 +73,9 @@ During decoding, the following options are supported:
.TP
\fB\-strict\fR
.
Instructs the decoder to throw an error if it encounters whitespace characters. Otherwise it ignores them.
Instructs the decoder to throw an error if it encounters any characters
that are not strictly part of the encoding itself. Otherwise it ignores them.
RFC 2045 calls for base64 decoders to be non-strict.
.RE
.TP
\fBhex\fR
@@ -87,7 +89,8 @@ options are supported:
.TP
\fB\-strict\fR
.
Instructs the decoder to throw an error if it encounters whitespace characters. Otherwise it ignores them.
Instructs the decoder to throw an error if it encounters whitespace characters.
Otherwise it ignores them.
.RE
.TP
\fBuuencode\fR
@@ -117,8 +120,8 @@ During decoding, the following options are supported:
.TP
\fB\-strict\fR
.
Instructs the decoder to throw an error if it encounters unexpected whitespace
characters. Otherwise it ignores them.
Instructs the decoder to throw an error if it encounters unexpected
whitespace characters. Otherwise it ignores them.
.PP
Note that neither the encoder nor the decoder handle the header and footer of
the uuencode format.
-6
View File
@@ -56,9 +56,7 @@ When the return code from evaluation of \fIscript\fR is
\fBTCL_ERROR\fR, four additional entries are defined in the dictionary
of return options stored in \fIoptionsVarName\fR: \fB\-errorinfo\fR,
\fB\-errorcode\fR, \fB\-errorline\fR, and
.VS 8.6
\fB\-errorstack\fR.
.VE 8.6
The value of the \fB\-errorinfo\fR entry is a formatted stack trace containing
more information about the context in which the error happened. The formatted
stack trace is meant to be read by a person. The value of the
@@ -67,7 +65,6 @@ list. The \fB\-errorcode\fR value is meant to be further processed by
programs, and may not be particularly readable by people. The value of the
\fB\-errorline\fR entry is an integer indicating which line of \fIscript\fR
was being evaluated when the error occurred.
.VS 8.6
The value of the \fB\-errorstack\fR entry is an
even-sized list made of token-parameter pairs accumulated while
unwinding the stack. The token may be
@@ -87,14 +84,11 @@ the static text of the calling sites, and
.IP [3]
it is coarser-grained, with only one element per stack frame (like procs; no
separate elements for \fBforeach\fR constructs for example).
.VE 8.6
.PP
The values of the \fB\-errorinfo\fR and \fB\-errorcode\fR entries of
the most recent error are also available as values of the global
variables \fB::errorInfo\fR and \fB::errorCode\fR respectively.
.VS 8.6
The value of the \fB\-errorstack\fR entry surfaces as \fBinfo errorstack\fR.
.VE 8.6
.PP
Tcl packages may provide commands that set other entries in the
dictionary of return options, and the \fBreturn\fR command may be
-10
View File
@@ -35,7 +35,6 @@ turned on by default.
.
Close and destroy the channel called \fIchannelId\fR. Note that this
deletes all existing file-events registered on the channel.
.VS 8.6
If the \fIdirection\fR argument (which must be \fBread\fR or \fBwrite\fR or
any unique abbreviation of them) is present, the channel will only be
half-closed, so that it can go from being read-write to write-only or
@@ -45,7 +44,6 @@ write-only channels. Without the \fIdirection\fR argument, the channel is
closed for both reading and writing (but only if those directions are
currently open). It is an error to close a read-only channel for writing, or a
write-only channel for reading.
.VE 8.6
.RS
.PP
As part of closing the channel, all buffered output is flushed to the
@@ -83,12 +81,10 @@ an error occurs while flushing output. If a command in a command
pipeline created with \fBopen\fR returns an error, \fBchan close\fR
generates an error (similar to the \fBexec\fR command.)
.PP
.VS 8.6
Note that half-closes of sockets and command pipelines can have important side
effects because they result in a shutdown() or close() of the underlying
system resource, which can change how other processes or systems respond to
the Tcl program.
.VE 8.6
.RE
.TP
\fBchan configure \fIchannelId\fR ?\fIoptionName\fR? ?\fIvalue\fR? ?\fIoptionName value\fR?...
@@ -540,7 +536,6 @@ an extremely long line that exceeds the available memory to buffer it).
Returns -1 if the channel was not opened for the mode in question.
.TP
\fBchan pipe\fR
.VS 8.6
Creates a standalone pipe whose read- and write-side channels are
returned as a 2-element list, the first element being the read side and
the second the write side. Can be useful e.g. to redirect
@@ -561,16 +556,13 @@ is most likely to show up when using pipelines for testing; care should be
taken to ensure that deadlocks do not occur and that potential short reads are
allowed for.
.RE
.VE 8.6
.TP
\fBchan pop \fIchannelId\fR
.VS 8.6
Removes the topmost transformation from the channel \fIchannelId\fR, if there
is any. If there are no transformations added to \fIchannelId\fR, this is
equivalent to \fBchan close\fR of that channel. The result is normally the
empty string, but can be an error in some situations (i.e. where the
underlying system stream is closed and that results in an error).
.VE 8.6
.TP
\fBchan postevent \fIchannelId eventSpec\fR
.
@@ -609,7 +601,6 @@ executed in the interpreter that set them up.
.RE
.TP
\fBchan push \fIchannelId cmdPrefix\fR
.VS 8.6
Adds a new transformation on top of the channel \fIchannelId\fR. The
\fIcmdPrefix\fR argument describes a list of one or more words which represent
a handler that will be used to implement the transformation. The command
@@ -618,7 +609,6 @@ The result of this subcommand is a handle to the transformation. Note that it
is important to make sure that the transformation is capable of supporting the
channel mode that it is used with or this can make the channel neither
readable nor writable.
.VE 8.6
.TP
\fBchan puts\fR ?\fB\-nonewline\fR? ?\fIchannelId\fR? \fIstring\fR
.
-4
View File
@@ -49,16 +49,13 @@ When the last interpreter in which the channel is registered invokes
.PP
Channels are automatically closed when an interpreter is destroyed and
when the process exits.
.VS 8.6
From 8.6 on (TIP#398), nonblocking channels are no longer switched to blocking mode when exiting; this guarantees a timely exit even when the peer or a communication channel is stalled. To ensure proper flushing of stalled nonblocking channels on exit, one must now either (a) actively switch them back to blocking or (b) use the environment variable TCL_FLUSH_NONBLOCKING_ON_EXIT, which when set and not equal to "0" restores the previous behavior.
.VE 8.6
.PP
The command returns an empty string, and may generate an error if
an error occurs while flushing output. If a command in a command
pipeline created with \fBopen\fR returns an error, \fBclose\fR
generates an error (similar to the \fBexec\fR command.)
.PP
.VS 8.6
The two-argument form is a
.QW "half-close" :
given a bidirectional channel like a
@@ -80,7 +77,6 @@ abnormal exit error.
.PP
Currently only sockets and command pipelines support half-close. A future
extension will allow reflected and stacked channels to do so.
.VE 8.6
.SH EXAMPLE
.PP
This illustrates how you can use Tcl to ensure that files get closed
+1 -1
View File
@@ -9,7 +9,7 @@
.BS
'\" Note: do not modify the .SH NAME line immediately below!
.SH NAME
coroutine, yield, yieldto \- Create and produce values from coroutines
coroutine, yield, yieldto, coroinject, coroprobe \- Create and produce values from coroutines
.SH SYNOPSIS
.nf
\fBcoroutine \fIname command\fR ?\fIarg...\fR?
-6
View File
@@ -17,11 +17,9 @@ dde \- Execute a Dynamic Data Exchange command
.sp
\fBdde servername\fR ?\fB\-force\fR? ?\fB\-handler \fIproc\fR? ?\fB\-\|\-\fR? ?\fItopic\fR?
.sp
.VS 8.6
\fBdde execute\fR ?\fB\-async\fR? ?\fB\-binary\fR? \fIservice topic data\fR
.sp
\fBdde poke\fR ?\fB\-binary\fR? \fIservice topic item data\fR
.VE 8.6
.sp
\fBdde request\fR ?\fB\-binary\fR? \fIservice topic item\fR
.sp
@@ -82,13 +80,11 @@ script is run in the application. The \fB\-async\fR option requests
asynchronous invocation. The command returns an error message if the
script did not run, unless the \fB\-async\fR flag was used, in which case
the command returns immediately with no error.
.VS 8.6
Without the \fB\-binary\fR option all data will be sent in unicode. For
dde clients which don't implement the CF_UNICODE clipboard format, this
will automatically be translated to the system encoding. You can use
the \fB\-binary\fR option in combination with the result of
\fBencoding convertto\fR to send data in any other encoding.
.VE 8.6
.TP
\fBdde poke\fR ?\fB\-binary\fR? \fIservice topic item data\fR
.
@@ -99,13 +95,11 @@ specific but can be a command to the server or the name of a file to work
on. The \fIitem\fR is also application specific and is often not used, but
it must always be non-null. The \fIdata\fR field is given to the remote
application.
.VS 8.6
Without the \fB\-binary\fR option all data will be sent in unicode. For
dde clients which don't implement the CF_UNICODE clipboard format, this
will automatically be translated to the system encoding. You can use
the \fB\-binary\fR option in combination with the result of
\fBencoding convertto\fR to send data in any other encoding.
.VE 8.6
.TP
\fBdde request\fR ?\fB\-binary\fR? \fIservice topic item\fR
.
-4
View File
@@ -54,10 +54,8 @@ type (which may be abbreviated.) Supported filter types are:
.RS
.TP
\fBdict filter \fIdictionaryValue \fBkey\fR ?\fIglobPattern ...\fR?
.VS 8.6
The key rule only matches those key/value pairs whose keys match any
of the given patterns (in the style of \fBstring match\fR.)
.VE 8.6
.TP
\fBdict filter \fIdictionaryValue \fBscript {\fIkeyVariable valueVariable\fB} \fIscript\fR
.
@@ -74,10 +72,8 @@ result. The key/value pairs are tested in the order in which the keys
were inserted into the dictionary.
.TP
\fBdict filter \fIdictionaryValue \fBvalue \fR?\fIglobPattern ...\fR?
.VS 8.6
The value rule only matches those key/value pairs whose values match any
of the given patterns (in the style of \fBstring match\fR.)
.VE 8.6
.RE
.TP
\fBdict for {\fIkeyVariable valueVariable\fB} \fIdictionaryValue body\fR
-2
View File
@@ -338,7 +338,6 @@ if {[catch {\fBexec\fR grep foo bar.txt} results options]} {
}
}
.CE
.VS 8.6
.PP
This is more easily written using the \fBtry\fR command, as that makes
it simpler to trap specific types of errors. This is
@@ -352,7 +351,6 @@ try {
set status [lindex [dict get $options -errorcode] 2]
}
.CE
.VE 8.6
.SS "WORKING WITH QUOTED ARGUMENTS"
.PP
When translating a command from a Unix shell invocation, care should
-2
View File
@@ -465,7 +465,6 @@ between platforms:
.TP
\fBfile tempfile\fR ?\fInameVar\fR? ?\fItemplate\fR?
'\" TIP #210
.VS 8.6
Creates a temporary file and returns a read-write channel opened on that file.
If the \fInameVar\fR is given, it specifies a variable that the name of the
temporary file will be written into; if absent, Tcl will attempt to arrange
@@ -480,7 +479,6 @@ Note that temporary files are \fIonly\fR ever created on the native
filesystem. As such, they can be relied upon to be used with operating-system
native APIs and external programs that require a filename.
.RE
.VE 8.6
.TP
\fBfile type \fIname\fR
.
-2
View File
@@ -154,7 +154,6 @@ what to set the interpreter's background exception handler to. See the
\fBBACKGROUND EXCEPTION HANDLING\fR section for more details.
.TP
\fBinterp\fR \fBcancel \fR?\fB\-unwind\fR? ?\fB\-\|\-\fR? ?\fIpath\fR? ?\fIresult\fR?
.VS 8.6
Cancels the script being evaluated in the interpreter identified by
\fIpath\fR. Without the \fB\-unwind\fR switch the evaluation stack for
the interpreter is unwound until an enclosing catch command is found or
@@ -167,7 +166,6 @@ switches; it may be needed if \fIpath\fR is an unusual value such
as \fB\-safe\fR. If \fIresult\fR is present, it will be used as the
error message string; otherwise, a default error message string will be
used.
.VE 8.6
.TP
\fBinterp\fR \fBcreate \fR?\fB\-safe\fR? ?\fB\-\|\-\fR? ?\fIpath\fR?
.
+3 -2
View File
@@ -49,8 +49,9 @@ Using \fBlappend\fR to build up a list of numbers.
1 2 3 4 5
.CE
.SH "SEE ALSO"
list(n), lindex(n), linsert(n), llength(n), lset(n),
lsort(n), lrange(n)
list(n), lassign(n), lindex(n), linsert(n), llength(n),
lmap(n), lpop(n), lrange(n), lremove(n), lrepeat(n), lreplace(n),
lreverse(n), lsearch(n), lset(n), lsort(n)
.SH KEYWORDS
append, element, list, variable
.\" Local variables:
+3 -1
View File
@@ -52,7 +52,9 @@ command in many shell languages like this:
set ::argv [\fBlassign\fR $::argv argumentToReadOff]
.CE
.SH "SEE ALSO"
lindex(n), list(n), lrange(n), lset(n), set(n)
list(n), lappend(n), lindex(n), linsert(n), llength(n),
lmap(n), lpop(n), lrange(n), lremove(n), lrepeat(n), lreplace(n),
lreverse(n), lsearch(n), lset(n), lsort(n)
.SH KEYWORDS
assign, element, list, multiple, set, variable
'\"Local Variables:
+3 -2
View File
@@ -115,8 +115,9 @@ set idx 3
\fI\(-> f\fR
.CE
.SH "SEE ALSO"
list(n), lappend(n), linsert(n), llength(n), lsearch(n),
lset(n), lsort(n), lrange(n), lreplace(n),
list(n), lappend(n), lassign(n), linsert(n), llength(n),
lmap(n), lpop(n), lrange(n), lremove(n), lrepeat(n), lreplace(n),
lreverse(n), lsearch(n), lset(n), lsort(n),
string(n)
.SH KEYWORDS
element, index, list
+3 -2
View File
@@ -45,8 +45,9 @@ set newList [\fBlinsert\fR $midList end-1 lazy]
set newerList [\fBlinsert\fR [\fBlinsert\fR $oldList end-1 quick] 1 lazy]
.CE
.SH "SEE ALSO"
list(n), lappend(n), lindex(n), llength(n), lsearch(n),
lset(n), lsort(n), lrange(n), lreplace(n),
list(n), lappend(n), lassign(n), lindex(n), llength(n),
lmap(n), lpop(n), lrange(n), lremove(n), lrepeat(n), lreplace(n),
lreverse(n), lsearch(n), lset(n), lsort(n),
string(n)
.SH KEYWORDS
element, insert, list
+3 -3
View File
@@ -46,9 +46,9 @@ while \fBconcat\fR with the same arguments will return
\fBa b c d e f {g h}\fR
.CE
.SH "SEE ALSO"
lappend(n), lindex(n), linsert(n), llength(n), lrange(n),
lrepeat(n),
lreplace(n), lsearch(n), lset(n), lsort(n)
lappend(n), lassign(n), lindex(n), linsert(n), llength(n),
lmap(n), lpop(n), lrange(n), lremove(n), lrepeat(n), lreplace(n),
lreverse(n), lsearch(n), lset(n), lsort(n)
.SH KEYWORDS
element, list, quoting
'\"Local Variables:
+3 -2
View File
@@ -49,8 +49,9 @@ An empty list is not necessarily an empty string:
1,0
.CE
.SH "SEE ALSO"
list(n), lappend(n), lindex(n), linsert(n), lsearch(n),
lset(n), lsort(n), lrange(n), lreplace(n)
list(n), lappend(n), lassign(n), lindex(n), linsert(n),
lmap(n), lpop(n), lrange(n), lremove(n), lrepeat(n), lreplace(n),
lreverse(n), lsearch(n), lset(n), lsort(n)
.SH KEYWORDS
element, list, length
'\" Local Variables:
+4 -1
View File
@@ -77,7 +77,10 @@ set prefix [\fBlmap\fR x $values {expr {
# The value of prefix is "8 7 6 5 4"
.CE
.SH "SEE ALSO"
break(n), continue(n), for(n), foreach(n), while(n)
break(n), continue(n), for(n), foreach(n), while(n),
list(n), lappend(n), lassign(n), lindex(n), linsert(n), llength(n),
lpop(n), lrange(n), lremove(n), lrepeat(n), lreplace(n),
lreverse(n), lsearch(n), lset(n), lsort(n)
.SH KEYWORDS
foreach, iteration, list, loop, map
'\" Local Variables:
+3 -2
View File
@@ -86,8 +86,9 @@ The indicated value becomes the new value of \fIx\fR.
\fI\(-> {{a b} {c d}} {{e f} h}\fR
.CE
.SH "SEE ALSO"
list(n), lappend(n), lindex(n), linsert(n), llength(n), lsearch(n),
lsort(n), lrange(n), lreplace(n), lset(n)
list(n), lappend(n), lassign(n), lindex(n), linsert(n), llength(n),
lmap(n), lrange(n), lremove(n), lrepeat(n), lreplace(n),
lreverse(n), lsearch(n), lset(n), lsort(n),
string(n)
.SH KEYWORDS
element, index, list, remove, pop, stack, queue
+3 -2
View File
@@ -71,8 +71,9 @@ elements to
{elements to}
.CE
.SH "SEE ALSO"
list(n), lappend(n), lindex(n), linsert(n), llength(n), lsearch(n),
lset(n), lremove(n), lreplace(n), lsort(n),
list(n), lappend(n), lassign(n), lindex(n), linsert(n), llength(n),
lmap(n), lpop(n), lremove(n), lrepeat(n), lreplace(n),
lreverse(n), lsearch(n), lset(n), lsort(n),
string(n)
.SH KEYWORDS
element, list, range, sublist
+3 -1
View File
@@ -46,7 +46,9 @@ Removing the same element indicated in two different ways:
a b d e
.CE
.SH "SEE ALSO"
list(n), lrange(n), lsearch(n), lsearch(n)
list(n), lappend(n), lassign(n), lindex(n), linsert(n), llength(n),
lmap(n), lpop(n), lrange(n), lrepeat(n), lreplace(n),
lreverse(n), lsearch(n), lset(n), lsort(n)
.SH KEYWORDS
element, list, remove
.\" Local variables:
+3 -1
View File
@@ -32,7 +32,9 @@ is identical to \fBlist element ...\fR.
\fI\(-> {a a} b c {a a} b c {a a} b c\fR
.CE
.SH "SEE ALSO"
list(n), lappend(n), linsert(n), llength(n), lset(n)
list(n), lappend(n), lassign(n), lindex(n), linsert(n), llength(n),
lmap(n), lpop(n), lrange(n), lremove(n), lreplace(n),
lreverse(n), lsearch(n), lset(n), lsort(n)
.SH KEYWORDS
element, index, list
'\" Local Variables:
+3 -2
View File
@@ -95,8 +95,9 @@ a b c d e f g h i
.CE
.VE TIP505
.SH "SEE ALSO"
list(n), lappend(n), lindex(n), linsert(n), llength(n), lsearch(n),
lset(n), lrange(n), lremove(n), lsort(n),
list(n), lappend(n), lassign(n), lindex(n), linsert(n), llength(n),
lmap(n), lpop(n), lrange(n), lremove(n), lrepeat(n),
lreverse(n), lsearch(n), lset(n), lsort(n),
string(n)
.SH KEYWORDS
element, list, replace
+3 -2
View File
@@ -25,8 +25,9 @@ input list, \fIlist\fR, except with the elements in the reverse order.
\fI\(-> f e {c d} b a\fR
.CE
.SH "SEE ALSO"
list(n), lsearch(n), lsort(n)
list(n), lappend(n), lassign(n), lindex(n), linsert(n), llength(n),
lmap(n), lpop(n), lrange(n), lremove(n), lrepeat(n), lreplace(n),
lsearch(n), lset(n), lsort(n)
.SH KEYWORDS
element, list, reverse
'\" Local Variables:
+4 -4
View File
@@ -134,7 +134,6 @@ The list elements are sorted in increasing order. This option is only
meaningful when used with \fB\-sorted\fR.
.TP
\fB\-bisect\fR
.VS 8.6
Inexact search when the list elements are in sorted order. For an increasing
list the last index where the element is less than or equal to the pattern
is returned. For a decreasing list the last index where the element is greater
@@ -142,7 +141,6 @@ than or equal to the pattern is returned. If the pattern is before the first
element or the list is empty, -1 is returned.
This option implies \fB\-sorted\fR and cannot be used with either \fB\-all\fR
or \fB\-not\fR.
.VE 8.6
.SS "NESTED LIST OPTIONS"
.PP
These options are used to search lists of lists. They may be used
@@ -229,8 +227,10 @@ The same thing for a flattened list:
\fI\(-> {a abc b bcd}\fR
.CE
.SH "SEE ALSO"
foreach(n), list(n), lappend(n), lindex(n), linsert(n), llength(n),
lset(n), lsort(n), lrange(n), lreplace(n),
foreach(n),
list(n), lappend(n), lassign(n), lindex(n), linsert(n), llength(n),
lmap(n), lpop(n), lrange(n), lremove(n), lrepeat(n), lreplace(n),
lreverse(n), lset(n), lsort(n),
string(n)
.SH KEYWORDS
binary search, linear search,
+3 -2
View File
@@ -136,8 +136,9 @@ The indicated return value also becomes the new value of \fIx\fR.
\fI\(-> {{a b} {c d}} {{e f} {j h}}\fR
.CE
.SH "SEE ALSO"
list(n), lappend(n), lindex(n), linsert(n), llength(n), lsearch(n),
lsort(n), lrange(n), lreplace(n),
list(n), lappend(n), lassign(n), lindex(n), linsert(n), llength(n),
lmap(n), lpop(n), lrange(n), lremove(n), lrepeat(n), lreplace(n),
lreverse(n), lsearch(n), lsort(n)
string(n)
.SH KEYWORDS
element, index, list, replace, set
+3 -4
View File
@@ -221,7 +221,6 @@ Sorting using indices:
{e 1} {d 2} { c 3} {b 4} {a 5}
.CE
.PP
.VS 8.6
Sorting a dictionary:
.PP
.CS
@@ -239,7 +238,6 @@ Sorting using striding and multiple indices:
{{Bob Smith} 25 Audi {Jane Doe} 40 Ford}
{{Jane Doe} 40 Ford {Bob Smith} 25 Audi}
.CE
.VE 8.6
.PP
Stripping duplicate values using sorting:
.PP
@@ -266,8 +264,9 @@ More complex sorting using a comparison function:
{1 dingo} {2 banana} {0x2 carrot} {3 apple}
.CE
.SH "SEE ALSO"
list(n), lappend(n), lindex(n), linsert(n), llength(n), lsearch(n),
lset(n), lrange(n), lreplace(n)
list(n), lappend(n), lassign(n), lindex(n), linsert(n), llength(n),
lmap(n), lpop(n), lrange(n), lremove(n), lrepeat(n), lreplace(n),
lreverse(n), lsearch(n), lset(n)
.SH KEYWORDS
element, list, order, sort
'\" Local Variables:
+1 -1
View File
@@ -23,7 +23,7 @@ package require TclOO
The \fBmy\fR command is used to allow methods of objects to invoke methods
of the object (or its class),
.VS TIP478
and he \fBmyclass\fR command is used to allow methods of objects to invoke
and the \fBmyclass\fR command is used to allow methods of objects to invoke
methods of the current class of the object \fIas an object\fR.
.VE TIP478
In particular, the set of valid values for
-4
View File
@@ -788,12 +788,10 @@ name. Note that when this option is non-empty and the
will be exactly those words that have mappings in the dictionary.
.TP
\fB\-parameters\fR
.VS 8.6
This option gives a list of named arguments (the names being used during
generation of error messages) that are passed by the caller of the ensemble
between the name of the ensemble and the subcommand argument. By default, it
is the empty list.
.VE 8.6
.TP
\fB\-prefixes\fR
.
@@ -943,7 +941,6 @@ Remove all imported commands from the current namespace:
namespace forget {*}[namespace import]
.CE
.PP
.VS 8.6
Create an ensemble for simple working with numbers, using the
\fB\-parameters\fR option to allow the operator to be put between the first
and second arguments.
@@ -959,7 +956,6 @@ and second arguments.
# In use, the ensemble works like this:
puts [do 1 plus [do 9 minus 7]]
.CE
.VE 8.6
.SH "SEE ALSO"
interp(n), upvar(n), variable(n)
.SH KEYWORDS
-2
View File
@@ -44,13 +44,11 @@ one of \fBHKEY_LOCAL_MACHINE\fR, \fBHKEY_USERS\fR,
\fBHKEY_DYN_DATA\fR. The \fIkeypath\fR can be one or more
registry key names separated by backslash (\fB\e\fR) characters.
.PP
.VS 8.6
The optional \fI\-mode\fR argument indicates which registry to work
with; when it is \fB\-32bit\fR the 32-bit registry will be used, and
when it is \fB\-64bit\fR the 64-bit registry will be used. If this
argument is omitted, the system's default registry will be the subject
of the requested operation.
.VE 8.6
.PP
\fIOption\fR indicates what to do with the registry key name. Any
unique abbreviation for \fIoption\fR is acceptable. The valid options
-2
View File
@@ -137,7 +137,6 @@ by the \fBcatch\fR command (or from the copy of that information
stored in the global variable \fBerrorInfo\fR).
.TP
\fB\-errorstack \fIlist\fR
.VS 8.6
The \fB\-errorstack\fR option receives special treatment only when the value
of the \fB\-code\fR option is \fBTCL_ERROR\fR. Then \fIlist\fR is the initial
error stack, recording actual argument values passed to each proc level. The error stack will
@@ -152,7 +151,6 @@ the procedure. Typically the \fIlist\fR value is supplied from
the value of \fB\-errorstack\fR in a return options dictionary captured
by the \fBcatch\fR command (or from the copy of that information from
\fBinfo errorstack\fR).
.VE 8.6
.TP
\fB\-level \fIlevel\fR
.
-2
View File
@@ -322,11 +322,9 @@ The version number for the operating system running on this machine.
On UNIX machines, this is the value returned by \fBuname -r\fR.
.TP
\fBpathSeparator\fR
.VS 8.6
'\" Defined by TIP #315
The character that should be used to \fBsplit\fR PATH-like environment
variables into their corresponding list of directory names.
.VE 8.6
.TP
\fBplatform\fR
.
+1 -1
View File
@@ -83,7 +83,7 @@ example, the Tcl 8.7.2 release would be searched for in a file
\fBlibtcl_8_7_2.zip\fR.) That archive, if located, is also mounted read-only.
.PP
On Windows, \fBTclZipfs_AppHook\fR has a slightly different signature, since
it uses WCHAR in stead of char. As a result, it requires your application to
it uses WCHAR instead of char. As a result, it requires your application to
be compiled with the UNICODE preprocessor symbol defined (e.g., via the
\fB-DUNICODE\fR compiler flag).
.PP
+9 -9
View File
@@ -259,15 +259,15 @@ static const chr brbacks[] = { /* \s within brackets */
#define PUNCT_CONN \
CHR('_'), \
0x203f /* UNDERTIE */, \
0x203F /* UNDERTIE */, \
0x2040 /* CHARACTER TIE */,\
0x2054 /* INVERTED UNDERTIE */,\
0xfe33 /* PRESENTATION FORM FOR VERTICAL LOW LINE */, \
0xfe34 /* PRESENTATION FORM FOR VERTICAL WAVY LOW LINE */, \
0xfe4d /* DASHED LOW LINE */, \
0xfe4e /* CENTRELINE LOW LINE */, \
0xfe4f /* WAVY LOW LINE */, \
0xff3f /* FULLWIDTH LOW LINE */
0xFE33 /* PRESENTATION FORM FOR VERTICAL LOW LINE */, \
0xFE34 /* PRESENTATION FORM FOR VERTICAL WAVY LOW LINE */, \
0xFE4D /* DASHED LOW LINE */, \
0xFE4E /* CENTRELINE LOW LINE */, \
0xFE4F /* WAVY LOW LINE */, \
0xFF3F /* FULLWIDTH LOW LINE */
static const chr backw[] = { /* \w */
CHR('['), CHR('['), CHR(':'),
@@ -914,7 +914,7 @@ lexescape(
if (ISERR()) {
FAILW(REG_EESCAPE);
}
if (c > 0xff) {
if (c > 0xFF) {
/* out of range, so we handled one digit too much */
v->now--;
c >>= 3;
@@ -948,7 +948,7 @@ lexdigits(
n = 0;
for (len = 0; len < maxlen && !ATEOS(); len++) {
if (n > 0x10fff) {
if (n > 0x10FFF) {
/* Stop when continuing would otherwise overflow */
break;
}
+535 -528
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -808,7 +808,7 @@ parseqatom(
atom = NULL;
assert(lp->nouts == 0); /* must string new code */
assert(rp->nins == 0); /* between lp and rp */
subno = 0; /* just to shut lint up */
subno = 0;
/*
* An atom or constraint...
+3 -3
View File
@@ -88,14 +88,14 @@ typedef int celt; /* Type to hold chr, or NOCELT */
#define NOCELT (-1) /* Celt value which is not valid chr */
#define CHR(c) (UCHAR(c)) /* Turn char literal into chr literal */
#define DIGITVAL(c) ((c)-'0') /* Turn chr digit into its value */
#if TCL_UTF_MAX > 4
#if TCL_UTF_MAX > 3
#define CHRBITS 32 /* Bits in a chr; must not use sizeof */
#define CHR_MIN 0x00000000 /* Smallest and largest chr; the value */
#define CHR_MAX 0x10ffff /* CHR_MAX-CHR_MIN+1 should fit in uchr */
#define CHR_MAX 0x10FFFF /* CHR_MAX-CHR_MIN+1 should fit in uchr */
#else
#define CHRBITS 16 /* Bits in a chr; must not use sizeof */
#define CHR_MIN 0x0000 /* Smallest and largest chr; the value */
#define CHR_MAX 0xffff /* CHR_MAX-CHR_MIN+1 should fit in uchr */
#define CHR_MAX 0xFFFF /* CHR_MAX-CHR_MIN+1 should fit in uchr */
#endif
/*
-1
View File
@@ -54,7 +54,6 @@ static const struct rerr {
/*
- regerror - the interface to error numbers
*/
/* ARGSUSED */
size_t /* Actual space needed (including NUL) */
regerror(
int code, /* Error code, or REG_ATOI or REG_ITOA */
+2 -2
View File
@@ -74,7 +74,7 @@
#define DUPMAX _POSIX2_RE_DUP_MAX
#define DUPINF (DUPMAX+1)
#define REMAGIC 0xfed7 /* magic number for main struct */
#define REMAGIC 0xFED7 /* magic number for main struct */
/*
* debugging facilities
@@ -390,7 +390,7 @@ struct fns {
struct guts {
int magic;
#define GUTSMAGIC 0xfed9
#define GUTSMAGIC 0xFED9
int cflags; /* copy of compile flags */
long info; /* copy of re_info */
size_t nsub; /* copy of re_nsub */
+16 -16
View File
@@ -523,7 +523,7 @@ declare 145 {
declare 146 {
int Tcl_Flush(Tcl_Channel chan)
}
declare 147 {
declare 147 {deprecated {see TIP #559. Use Tcl_ResetResult}} {
void Tcl_FreeResult(Tcl_Interp *interp)
}
declare 148 {
@@ -595,7 +595,7 @@ declare 166 {
}
# Tcl_GetOpenFile is only available on unix, but it is a part of the old
# generic interface, so we inlcude it here for compatibility reasons.
# generic interface, so we include it here for compatibility reasons.
declare 167 unix {
int Tcl_GetOpenFile(Tcl_Interp *interp, const char *chanID, int forWriting,
@@ -1244,10 +1244,10 @@ declare 350 {
declare 351 {
int Tcl_UniCharIsWordChar(int ch)
}
declare 352 {
declare 352 {deprecated {Use Tcl_GetCharLength}} {
int Tcl_UniCharLen(const Tcl_UniChar *uniStr)
}
declare 353 {
declare 353 {deprecated {Use Tcl_UtfNcmp}} {
int Tcl_UniCharNcmp(const Tcl_UniChar *ucs, const Tcl_UniChar *uct,
unsigned long numChars)
}
@@ -1356,7 +1356,7 @@ declare 382 {deprecated {No longer in use, changed to macro}} {
declare 383 {
Tcl_Obj *Tcl_GetRange(Tcl_Obj *objPtr, int first, int last)
}
declare 384 {
declare 384 {deprecated {Use Tcl_AppendStringsToObj}} {
void Tcl_AppendUnicodeToObj(Tcl_Obj *objPtr, const Tcl_UniChar *unicode,
int length)
}
@@ -1415,7 +1415,7 @@ declare 400 {
Tcl_DriverBlockModeProc *Tcl_ChannelBlockModeProc(
const Tcl_ChannelType *chanTypePtr)
}
declare 401 {
declare 401 {deprecated {Use Tcl_ChannelClose2Proc}} {
Tcl_DriverCloseProc *Tcl_ChannelCloseProc(
const Tcl_ChannelType *chanTypePtr)
}
@@ -1431,7 +1431,7 @@ declare 404 {
Tcl_DriverOutputProc *Tcl_ChannelOutputProc(
const Tcl_ChannelType *chanTypePtr)
}
declare 405 {
declare 405 {deprecated {Use Tcl_ChannelWideSeekProc}} {
Tcl_DriverSeekProc *Tcl_ChannelSeekProc(
const Tcl_ChannelType *chanTypePtr)
}
@@ -1482,11 +1482,11 @@ declare 417 {
declare 418 {
int Tcl_IsChannelExisting(const char *channelName)
}
declare 419 {
declare 419 {deprecated {Use Tcl_UtfNcasecmp}} {
int Tcl_UniCharNcasecmp(const Tcl_UniChar *ucs, const Tcl_UniChar *uct,
unsigned long numChars)
}
declare 420 {
declare 420 {deprecated {Use Tcl_StringCaseMatch}} {
int Tcl_UniCharCaseMatch(const Tcl_UniChar *uniStr,
const Tcl_UniChar *uniPattern, int nocase)
}
@@ -2009,19 +2009,19 @@ declare 554 {
# TIP#237 (arbitrary-precision integers) kbk
declare 555 {
Tcl_Obj *Tcl_NewBignumObj(mp_int *value)
Tcl_Obj *Tcl_NewBignumObj(void *value)
}
declare 556 {
Tcl_Obj *Tcl_DbNewBignumObj(mp_int *value, const char *file, int line)
Tcl_Obj *Tcl_DbNewBignumObj(void *value, const char *file, int line)
}
declare 557 {
void Tcl_SetBignumObj(Tcl_Obj *obj, mp_int *value)
void Tcl_SetBignumObj(Tcl_Obj *obj, void *value)
}
declare 558 {
int Tcl_GetBignumFromObj(Tcl_Interp *interp, Tcl_Obj *obj, mp_int *value)
int Tcl_GetBignumFromObj(Tcl_Interp *interp, Tcl_Obj *obj, void *value)
}
declare 559 {
int Tcl_TakeBignumFromObj(Tcl_Interp *interp, Tcl_Obj *obj, mp_int *value)
int Tcl_TakeBignumFromObj(Tcl_Interp *interp, Tcl_Obj *obj, void *value)
}
# TIP #208 ('chan' command) jeffh
@@ -2050,7 +2050,7 @@ declare 565 {
# TIP #237 (additional conversion functions for bignum support) kbk/dgp
declare 566 {
int Tcl_InitBignumFromDouble(Tcl_Interp *interp, double initval,
mp_int *toInit)
void *toInit)
}
# TIP#181 (namespace unknown command) dgp for Neil Madden
@@ -2221,7 +2221,7 @@ declare 606 {
# TIP#307 (move results between interpreters) dkf
declare 607 {
void Tcl_TransferResult(Tcl_Interp *sourceInterp, int result,
void Tcl_TransferResult(Tcl_Interp *sourceInterp, int code,
Tcl_Interp *targetInterp)
}
+33 -21
View File
@@ -51,10 +51,10 @@ extern "C" {
#define TCL_MAJOR_VERSION 8
#define TCL_MINOR_VERSION 7
#define TCL_RELEASE_LEVEL TCL_ALPHA_RELEASE
#define TCL_RELEASE_SERIAL 3
#define TCL_RELEASE_SERIAL 4
#define TCL_VERSION "8.7"
#define TCL_PATCH_LEVEL "8.7a3"
#define TCL_PATCH_LEVEL "8.7a4"
#if !defined(TCL_NO_DEPRECATED) || defined(RC_INVOKED)
/*
@@ -361,7 +361,7 @@ typedef long LONG;
*/
#if !defined(TCL_WIDE_INT_TYPE)&&!defined(TCL_WIDE_INT_IS_LONG)
# if defined(_WIN32)
# if defined(_MSC_VER) || defined(_WIN32)
# define TCL_WIDE_INT_TYPE __int64
# define TCL_LL_MODIFIER "I64"
# if defined(_WIN64)
@@ -1031,7 +1031,11 @@ typedef struct Tcl_DString {
#define TCL_TRACE_WRITES 0x20
#define TCL_TRACE_UNSETS 0x40
#define TCL_TRACE_DESTROYED 0x80
#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
#define TCL_INTERP_DESTROYED 0x100
#endif
#define TCL_LEAVE_ERR_MSG 0x200
#define TCL_TRACE_ARRAY 0x800
#ifndef TCL_REMOVE_OBSOLETE_TRACES
@@ -1396,10 +1400,12 @@ typedef void (Tcl_ScaleTimeProc) (Tcl_Time *timebuf, ClientData clientData);
* Channel version tag. This was introduced in 8.3.2/8.4.
*/
#ifndef TCL_NO_DEPRECATED
#define TCL_CHANNEL_VERSION_1 ((Tcl_ChannelTypeVersion) 0x1)
#define TCL_CHANNEL_VERSION_2 ((Tcl_ChannelTypeVersion) 0x2)
#define TCL_CHANNEL_VERSION_3 ((Tcl_ChannelTypeVersion) 0x3)
#define TCL_CHANNEL_VERSION_4 ((Tcl_ChannelTypeVersion) 0x4)
#endif
#define TCL_CHANNEL_VERSION_5 ((Tcl_ChannelTypeVersion) 0x5)
/*
@@ -1468,7 +1474,7 @@ typedef struct Tcl_ChannelType {
/* Version of the channel type. */
Tcl_DriverCloseProc *closeProc;
/* Function to call to close the channel, or
* TCL_CLOSE2PROC if the close2Proc should be
* NULL or TCL_CLOSE2PROC if the close2Proc should be
* used instead. */
Tcl_DriverInputProc *inputProc;
/* Function to call for input on channel. */
@@ -2106,16 +2112,15 @@ typedef struct Tcl_EncodingType {
/*
* The maximum number of bytes that are necessary to represent a single
* Unicode character in UTF-8. The valid values are 4 and 6
* (or perhaps 1 if we want to support a non-unicode enabled core). If 4,
* then Tcl_UniChar must be 2-bytes in size (UCS-2) (the default). If 6,
* Unicode character in UTF-8. The valid values are 3 and 4
* (or perhaps 1 if we want to support a non-unicode enabled core). If 3,
* then Tcl_UniChar must be 2-bytes in size (UCS-2) (the default). If > 3,
* then Tcl_UniChar must be 4-bytes in size (UCS-4). At this time UCS-2 mode
* is the default and recommended mode. UCS-4 is experimental and not
* recommended. It works for the core, but most extensions expect UCS-2.
* is the default and recommended mode.
*/
#ifndef TCL_UTF_MAX
#define TCL_UTF_MAX 4
#define TCL_UTF_MAX 3
#endif
/*
@@ -2123,15 +2128,11 @@ typedef struct Tcl_EncodingType {
* reflected in regcustom.h.
*/
#if TCL_UTF_MAX > 4
#if TCL_UTF_MAX > 3
/*
* int isn't 100% accurate as it should be a strict 4-byte value
* (perhaps wchar_t). 64-bit systems may have troubles. The size of this
* value must be reflected correctly in regcustom.h and
* in tclEncoding.c.
* XXX: Tcl is currently UCS-2 and planning UTF-16 for the Unicode
* XXX: string rep that Tcl_UniChar represents. Changing the size
* XXX: of Tcl_UniChar is /not/ supported.
* (perhaps wchar_t). ILP64/SILP64 systems may have troubles. The
* size of this value must be reflected correctly in regcustom.h.
*/
typedef int Tcl_UniChar;
#else
@@ -2168,13 +2169,24 @@ typedef struct Tcl_Config {
typedef void (Tcl_LimitHandlerProc) (ClientData clientData, Tcl_Interp *interp);
typedef void (Tcl_LimitHandlerDeleteProc) (ClientData clientData);
#if 0
/*
*----------------------------------------------------------------------------
* Override definitions for libtommath.
* We would like to provide an anonymous structure "mp_int" here, which is
* compatible with libtommath's "mp_int", but without duplicating anything
* from <tommath.h> or including <tommath.h> here. But the libtommath project
* didn't honor our request. See: <https://github.com/libtom/libtommath/pull/473>
*
* That's why this part is commented out, and we are using (void *) in
* various API's in stead of the more correct (mp_int *).
*/
typedef struct mp_int mp_int;
#ifndef MP_INT_DECLARED
#define MP_INT_DECLARED
typedef struct mp_int mp_int;
#endif
#endif
/*
*----------------------------------------------------------------------------
@@ -2309,10 +2321,10 @@ typedef int (Tcl_NRPostProc) (ClientData data[], Tcl_Interp *interp,
/*
*----------------------------------------------------------------------------
* The following constant is used to test for older versions of Tcl in the
* stubs tables. If TCL_UTF_MAX>4 use a different value.
* stubs tables.
*/
#define TCL_STUB_MAGIC ((int) 0xFCA3BACF + (TCL_UTF_MAX>4))
#define TCL_STUB_MAGIC ((int) 0xFCA3BACF)
/*
* The following function is required to be defined in all stubs aware
+16 -16
View File
@@ -68,7 +68,7 @@ union overhead {
};
#define MAGIC 0xef /* magic # on accounting info */
#define MAGIC 0xEF /* magic # on accounting info */
#define RMAGIC 0x5555 /* magic # on range info */
#ifndef NDEBUG
@@ -249,7 +249,7 @@ TclFinalizeAllocSubsystem(void)
*----------------------------------------------------------------------
*/
char *
void *
TclpAlloc(
unsigned int numBytes) /* Number of bytes to allocate. */
{
@@ -288,7 +288,7 @@ TclpAlloc(
overPtr = (union overhead *) (bigBlockPtr + 1);
overPtr->overMagic0 = overPtr->overMagic1 = MAGIC;
overPtr->bucketIndex = 0xff;
overPtr->bucketIndex = 0xFF;
#ifdef MSTATS
numMallocs[NBUCKETS]++;
#endif
@@ -446,7 +446,7 @@ MoreCore(
void
TclpFree(
char *oldPtr) /* Pointer to memory to free. */
void *oldPtr) /* Pointer to memory to free. */
{
size_t size;
union overhead *overPtr;
@@ -469,7 +469,7 @@ TclpFree(
RANGE_ASSERT(overPtr->rangeCheckMagic == RMAGIC);
RANGE_ASSERT(BLOCK_END(overPtr) == RMAGIC);
size = overPtr->bucketIndex;
if (size == 0xff) {
if (size == 0xFF) {
#ifdef MSTATS
numMallocs[NBUCKETS]--;
#endif
@@ -509,9 +509,9 @@ TclpFree(
*----------------------------------------------------------------------
*/
char *
void *
TclpRealloc(
char *oldPtr, /* Pointer to alloced block. */
void *oldPtr, /* Pointer to alloced block. */
unsigned int numBytes) /* New size of memory. */
{
int i;
@@ -543,7 +543,7 @@ TclpRealloc(
* If the block isn't in a bin, just realloc it.
*/
if (i == 0xff) {
if (i == 0xFF) {
struct block *prevPtr, *nextPtr;
bigBlockPtr = (struct block *) overPtr - 1;
prevPtr = bigBlockPtr->prevPtr;
@@ -581,7 +581,7 @@ TclpRealloc(
#endif
Tcl_MutexUnlock(allocMutexPtr);
return (char *)(overPtr+1);
return (void *)(overPtr+1);
}
maxSize = 1 << (i+3);
expensive = 0;
@@ -592,7 +592,7 @@ TclpRealloc(
}
if (expensive) {
char *newPtr;
void *newPtr;
Tcl_MutexUnlock(allocMutexPtr);
@@ -692,11 +692,11 @@ mstats(
*----------------------------------------------------------------------
*/
char *
void *
TclpAlloc(
unsigned int numBytes) /* Number of bytes to allocate. */
{
return (char *) malloc(numBytes);
return malloc(numBytes);
}
/*
@@ -717,7 +717,7 @@ TclpAlloc(
void
TclpFree(
char *oldPtr) /* Pointer to memory to free. */
void *oldPtr) /* Pointer to memory to free. */
{
free(oldPtr);
return;
@@ -739,12 +739,12 @@ TclpFree(
*----------------------------------------------------------------------
*/
char *
void *
TclpRealloc(
char *oldPtr, /* Pointer to alloced block. */
void *oldPtr, /* Pointer to alloced block. */
unsigned int numBytes) /* New size of memory. */
{
return (char *) realloc(oldPtr, numBytes);
return realloc(oldPtr, numBytes);
}
#endif /* !USE_TCLALLOC */
+15 -22
View File
@@ -676,7 +676,7 @@ BBEmitOpcode(
/* Compilation environment */
BasicBlock* bbPtr = assemEnvPtr->curr_bb;
/* Current basic block */
int op = TalInstructionTable[tblIdx].tclInstCode & 0xff;
int op = TalInstructionTable[tblIdx].tclInstCode & 0xFF;
/*
* If this is the first instruction in a basic block, record its line
@@ -738,13 +738,13 @@ BBEmitInst1or4(
/* Current basic block */
int op = TalInstructionTable[tblIdx].tclInstCode;
if (param <= 0xff) {
if (param <= 0xFF) {
op >>= 8;
} else {
op &= 0xff;
op &= 0xFF;
}
TclEmitInt1(op, envPtr);
if (param <= 0xff) {
if (param <= 0xFF) {
TclEmitInt1(param, envPtr);
} else {
TclEmitInt4(param, envPtr);
@@ -772,7 +772,7 @@ BBEmitInst1or4(
int
Tcl_AssembleObjCmd(
ClientData dummy, /* Not used. */
ClientData clientData, /* clientData */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -782,12 +782,12 @@ Tcl_AssembleObjCmd(
* because there needs to be one in place to execute bytecode.
*/
return Tcl_NRCallObjProc(interp, TclNRAssembleObjCmd, dummy, objc, objv);
return Tcl_NRCallObjProc(interp, TclNRAssembleObjCmd, clientData, objc, objv);
}
int
TclNRAssembleObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -796,7 +796,6 @@ TclNRAssembleObjCmd(
Tcl_Obj* backtrace; /* Object where extra error information is
* constructed. */
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "bytecodeList");
return TCL_ERROR;
@@ -961,8 +960,7 @@ TclCompileAssembleCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr; /* Token in the input script */
@@ -970,7 +968,6 @@ TclCompileAssembleCmd(
int numCommands = envPtr->numCommands;
int offset = envPtr->codeNext - envPtr->codeStart;
int depth = envPtr->currStackDepth;
(void)cmdPtr;
/*
* Make sure that the command has a single arg that is a simple word.
*/
@@ -1709,9 +1706,7 @@ AssembleOneLine(
goto cleanup;
}
{
int flags = TCL_REG_ADVANCED | (opnd ? TCL_REG_NOCASE : 0);
BBEmitInstInt1(assemEnvPtr, tblIdx, flags, 0);
BBEmitInstInt1(assemEnvPtr, tblIdx, TCL_REG_ADVANCED | (opnd ? TCL_REG_NOCASE : 0), 0);
}
break;
@@ -2238,7 +2233,7 @@ GetIntegerOperand(
* TCL_ERROR (with an appropriate error message) if the parse fails.
*
* Side effects:
* Stores the list index at '*index'. Values between -1 and 0x7fffffff
* Stores the list index at '*index'. Values between -1 and 0x7FFFFFFF
* have their natural meaning; values between -2 and -0x80000000
* represent 'end-2-N'.
*
@@ -2401,7 +2396,7 @@ CheckOneByte(
{
Tcl_Obj* result; /* Error message */
if (value < 0 || value > 0xff) {
if (value < 0 || value > 0xFF) {
result = Tcl_NewStringObj("operand does not fit in one byte", -1);
Tcl_SetObjResult(interp, result);
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "1BYTE", NULL);
@@ -2436,7 +2431,7 @@ CheckSignedOneByte(
{
Tcl_Obj* result; /* Error message */
if (value > 0x7f || value < -0x80) {
if (value > 0x7F || value < -0x80) {
result = Tcl_NewStringObj("operand does not fit in one byte", -1);
Tcl_SetObjResult(interp, result);
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "1BYTE", NULL);
@@ -2850,7 +2845,7 @@ CalculateJumpRelocations(
if (bbPtr->flags & BB_JUMP1) {
offset = jumpTarget->startOffset
- (bbPtr->jumpOffset + motion);
if (offset < -0x80 || offset > 0x7f) {
if (offset < -0x80 || offset > 0x7F) {
opcode = TclGetUInt1AtPtr(envPtr->codeStart
+ bbPtr->jumpOffset);
++opcode;
@@ -4316,11 +4311,9 @@ AddBasicBlockRangeToErrorInfo(
static void
DupAssembleCodeInternalRep(
Tcl_Obj *srcPtr,
Tcl_Obj *copyPtr)
TCL_UNUSED(Tcl_Obj *),
TCL_UNUSED(Tcl_Obj *))
{
(void)srcPtr;
(void)copyPtr;
return;
}
+215 -193
View File
File diff suppressed because it is too large Load Diff
+235 -113
View File
@@ -267,6 +267,9 @@ const Tcl_ObjType tclByteArrayType = {
*/
typedef struct ByteArray {
unsigned int bad; /* Index of the character that is a nonbyte.
* If all characters are bytes, bad = used,
* though then we should never read it. */
unsigned int used; /* The number of bytes used in the byte
* array. */
unsigned int allocated; /* The amount of space actually allocated
@@ -352,6 +355,7 @@ Tcl_NewByteArrayObj(
*----------------------------------------------------------------------
*/
#ifdef TCL_MEM_DEBUG
Tcl_Obj *
Tcl_DbNewByteArrayObj(
const unsigned char *bytes, /* The array of bytes used to initialize the
@@ -363,16 +367,25 @@ Tcl_DbNewByteArrayObj(
int line) /* Line number in the source file; used for
* debugging. */
{
#ifdef TCL_MEM_DEBUG
Tcl_Obj *objPtr;
TclDbNewObj(objPtr, file, line);
Tcl_SetByteArrayObj(objPtr, bytes, length);
return objPtr;
#else /* if not TCL_MEM_DEBUG */
return Tcl_NewByteArrayObj(bytes, length);
#endif /* TCL_MEM_DEBUG */
}
#else /* if not TCL_MEM_DEBUG */
Tcl_Obj *
Tcl_DbNewByteArrayObj(
const unsigned char *bytes, /* The array of bytes used to initialize the
* new object. */
int length, /* Length of the array of bytes, which must be
* >= 0. */
TCL_UNUSED(const char *) /*file*/,
TCL_UNUSED(int) /*line*/)
{
return Tcl_NewByteArrayObj(bytes, length);
}
#endif /* TCL_MEM_DEBUG */
/*
*---------------------------------------------------------------------------
@@ -411,7 +424,8 @@ Tcl_SetByteArrayObj(
if (length < 0) {
length = 0;
}
byteArrayPtr = ckalloc(BYTEARRAY_SIZE(length));
byteArrayPtr = (ByteArray *)ckalloc(BYTEARRAY_SIZE(length));
byteArrayPtr->bad = length;
byteArrayPtr->used = length;
byteArrayPtr->allocated = length;
@@ -423,6 +437,62 @@ Tcl_SetByteArrayObj(
Tcl_StoreIntRep(objPtr, &properByteArrayType, &ir);
}
/*
*----------------------------------------------------------------------
*
* TclGetBytesFromObj --
*
* Attempt to extract the value from objPtr in the representation
* of a byte sequence. On success return the extracted byte sequence.
* On failures, return NULL and record error message and code in
* interp (if not NULL).
*
* Results:
* Pointer to array of bytes, or NULL. representing the ByteArray object.
* Writes number of bytes in array to *lengthPtr.
*
*----------------------------------------------------------------------
*/
unsigned char *
TclGetBytesFromObj(
Tcl_Interp *interp, /* For error reporting */
Tcl_Obj *objPtr, /* Value to extract from */
int *lengthPtr) /* If non-NULL, filled with length of the
* array of bytes in the ByteArray object. */
{
ByteArray *baPtr;
const Tcl_ObjIntRep *irPtr = TclFetchIntRep(objPtr, &properByteArrayType);
if (irPtr == NULL) {
SetByteArrayFromAny(NULL, objPtr);
irPtr = TclFetchIntRep(objPtr, &properByteArrayType);
if (irPtr == NULL) {
if (interp) {
const char *nonbyte;
Tcl_UniChar ch;
irPtr = TclFetchIntRep(objPtr, &tclByteArrayType);
baPtr = GET_BYTEARRAY(irPtr);
nonbyte = Tcl_UtfAtIndex(Tcl_GetString(objPtr), baPtr->bad);
Tcl_UtfToUniChar(nonbyte, &ch);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"expected byte sequence but character %d "
"was '%1s' (U+%04X)", baPtr->bad, nonbyte, ch));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "BYTES", NULL);
}
return NULL;
}
}
baPtr = GET_BYTEARRAY(irPtr);
if (lengthPtr != NULL) {
*lengthPtr = baPtr->used;
}
return baPtr->bytes;
}
/*
*----------------------------------------------------------------------
*
@@ -448,18 +518,16 @@ Tcl_GetByteArrayFromObj(
* array of bytes in the ByteArray object. */
{
ByteArray *baPtr;
const Tcl_ObjIntRep *irPtr = TclFetchIntRep(objPtr, &properByteArrayType);
const Tcl_ObjIntRep *irPtr;
unsigned char *result = TclGetBytesFromObj(NULL, objPtr, lengthPtr);
if (irPtr == NULL) {
irPtr = TclFetchIntRep(objPtr, &tclByteArrayType);
if (irPtr == NULL) {
SetByteArrayFromAny(NULL, objPtr);
irPtr = TclFetchIntRep(objPtr, &properByteArrayType);
if (irPtr == NULL) {
irPtr = TclFetchIntRep(objPtr, &tclByteArrayType);
}
}
if (result) {
return result;
}
irPtr = TclFetchIntRep(objPtr, &tclByteArrayType);
assert(irPtr != NULL);
baPtr = GET_BYTEARRAY(irPtr);
if (lengthPtr != NULL) {
@@ -520,11 +588,13 @@ Tcl_SetByteArrayLength(
byteArrayPtr = GET_BYTEARRAY(irPtr);
if (newLength > byteArrayPtr->allocated) {
byteArrayPtr = ckrealloc(byteArrayPtr, BYTEARRAY_SIZE(newLength));
byteArrayPtr = (ByteArray *)ckrealloc(byteArrayPtr, BYTEARRAY_SIZE(newLength));
byteArrayPtr->allocated = newLength;
SET_BYTEARRAY(irPtr, byteArrayPtr);
}
TclInvalidateStringRep(objPtr);
objPtr->typePtr = &properByteArrayType;
byteArrayPtr->bad = newLength;
byteArrayPtr->used = newLength;
return byteArrayPtr->bytes;
}
@@ -547,11 +617,10 @@ Tcl_SetByteArrayLength(
static int
SetByteArrayFromAny(
Tcl_Interp *interp, /* Not used. */
TCL_UNUSED(Tcl_Interp *),
Tcl_Obj *objPtr) /* The object to convert to type ByteArray. */
{
size_t length;
int improper = 0;
size_t length, bad;
const char *src, *srcEnd;
unsigned char *dst;
Tcl_UniChar ch = 0;
@@ -566,22 +635,30 @@ SetByteArrayFromAny(
}
src = TclGetString(objPtr);
length = objPtr->length;
length = bad = objPtr->length;
srcEnd = src + length;
byteArrayPtr = ckalloc(BYTEARRAY_SIZE(length));
byteArrayPtr = (ByteArray *)ckalloc(BYTEARRAY_SIZE(length));
for (dst = byteArrayPtr->bytes; src < srcEnd; ) {
src += TclUtfToUniChar(src, &ch);
improper = improper || (ch > 255);
if ((bad == length) && (ch > 255)) {
bad = dst - byteArrayPtr->bytes;
}
*dst++ = UCHAR(ch);
}
byteArrayPtr->used = dst - byteArrayPtr->bytes;
byteArrayPtr->allocated = length;
SET_BYTEARRAY(&ir, byteArrayPtr);
Tcl_StoreIntRep(objPtr,
improper ? &tclByteArrayType : &properByteArrayType, &ir);
byteArrayPtr->allocated = length;
byteArrayPtr->used = dst - byteArrayPtr->bytes;
if (bad == length) {
byteArrayPtr->bad = byteArrayPtr->used;
Tcl_StoreIntRep(objPtr, &properByteArrayType, &ir);
} else {
byteArrayPtr->bad = bad;
Tcl_StoreIntRep(objPtr, &tclByteArrayType, &ir);
}
return TCL_OK;
}
@@ -645,7 +722,8 @@ DupByteArrayInternalRep(
srcArrayPtr = GET_BYTEARRAY(TclFetchIntRep(srcPtr, &tclByteArrayType));
length = srcArrayPtr->used;
copyArrayPtr = ckalloc(BYTEARRAY_SIZE(length));
copyArrayPtr = (ByteArray *)ckalloc(BYTEARRAY_SIZE(length));
copyArrayPtr->bad = srcArrayPtr->bad;
copyArrayPtr->used = length;
copyArrayPtr->allocated = length;
memcpy(copyArrayPtr->bytes, srcArrayPtr->bytes, length);
@@ -666,7 +744,8 @@ DupProperByteArrayInternalRep(
srcArrayPtr = GET_BYTEARRAY(TclFetchIntRep(srcPtr, &properByteArrayType));
length = srcArrayPtr->used;
copyArrayPtr = ckalloc(BYTEARRAY_SIZE(length));
copyArrayPtr = (ByteArray *)ckalloc(BYTEARRAY_SIZE(length));
copyArrayPtr->bad = length;
copyArrayPtr->used = length;
copyArrayPtr->allocated = length;
memcpy(copyArrayPtr->bytes, srcArrayPtr->bytes, length);
@@ -809,7 +888,7 @@ TclAppendBytesToByteArray(
*/
attempt = 2 * needed;
ptr = attemptckrealloc(byteArrayPtr, BYTEARRAY_SIZE(attempt));
ptr = (ByteArray *)attemptckrealloc(byteArrayPtr, BYTEARRAY_SIZE(attempt));
}
if (ptr == NULL) {
/*
@@ -821,7 +900,7 @@ TclAppendBytesToByteArray(
int growth = (int) ((extra > limit) ? limit : extra);
attempt = needed + growth;
ptr = attemptckrealloc(byteArrayPtr, BYTEARRAY_SIZE(attempt));
ptr = (ByteArray *)attemptckrealloc(byteArrayPtr, BYTEARRAY_SIZE(attempt));
}
if (ptr == NULL) {
/*
@@ -829,7 +908,7 @@ TclAppendBytesToByteArray(
*/
attempt = needed;
ptr = ckrealloc(byteArrayPtr, BYTEARRAY_SIZE(attempt));
ptr = (ByteArray *)ckrealloc(byteArrayPtr, BYTEARRAY_SIZE(attempt));
}
byteArrayPtr = ptr;
byteArrayPtr->allocated = attempt;
@@ -841,6 +920,7 @@ TclAppendBytesToByteArray(
}
byteArrayPtr->used += length;
TclInvalidateStringRep(objPtr);
objPtr->typePtr = &properByteArrayType;
}
/*
@@ -890,7 +970,7 @@ TclInitBinaryCmd(
static int
BinaryFormatCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1224,7 +1304,7 @@ BinaryFormatCmd(
if (c > 16) {
c += ('A' - 'a');
}
value |= (c & 0xf);
value |= (c & 0xF);
if (offset % 2) {
*cursor++ = (char) value;
value = 0;
@@ -1246,9 +1326,9 @@ BinaryFormatCmd(
if (c > 16) {
c += ('A' - 'a');
}
value |= ((c << 4) & 0xf0);
value |= ((c << 4) & 0xF0);
if (offset % 2) {
*cursor++ = UCHAR(value & 0xff);
*cursor++ = UCHAR(value & 0xFF);
value = 0;
}
}
@@ -1363,7 +1443,7 @@ BinaryFormatCmd(
badField:
{
Tcl_UniChar ch = 0;
char buf[TCL_UTF_MAX + 1] = "";
char buf[5] = "";
TclUtfToUniChar(errorString, &ch);
buf[Tcl_UniCharToUtf(ch, buf)] = '\0';
@@ -1395,7 +1475,7 @@ BinaryFormatCmd(
int
BinaryScanCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1413,9 +1493,8 @@ BinaryScanCmd(
unsigned char *buffer; /* Start of result buffer. */
const char *errorString;
const char *str;
int offset, size, length;
int offset, size, length, i;
int i;
Tcl_Obj *valuePtr, *elementPtr;
Tcl_HashTable numberCacheHash;
Tcl_HashTable *numberCachePtr;
@@ -1582,7 +1661,7 @@ BinaryScanCmd(
} else {
value = *src++;
}
*dest++ = hexdigit[value & 0xf];
*dest++ = hexdigit[value & 0xF];
}
} else {
for (i = 0; i < count; i++) {
@@ -1591,7 +1670,7 @@ BinaryScanCmd(
} else {
value = *src++;
}
*dest++ = hexdigit[(value >> 4) & 0xf];
*dest++ = hexdigit[(value >> 4) & 0xF];
}
}
@@ -1733,7 +1812,7 @@ BinaryScanCmd(
badField:
{
Tcl_UniChar ch = 0;
char buf[TCL_UTF_MAX + 1] = "";
char buf[5] = "";
TclUtfToUniChar(errorString, &ch);
buf[Tcl_UniCharToUtf(ch, buf)] = '\0';
@@ -1946,8 +2025,8 @@ CopyNumber(
memcpy(to, from, length);
break;
case 1: {
const unsigned char *fromPtr = from;
unsigned char *toPtr = to;
const unsigned char *fromPtr = (const unsigned char *)from;
unsigned char *toPtr = (unsigned char *)to;
switch (length) {
case 4:
@@ -1970,8 +2049,8 @@ CopyNumber(
break;
}
case 2: {
const unsigned char *fromPtr = from;
unsigned char *toPtr = to;
const unsigned char *fromPtr = (const unsigned char *)from;
unsigned char *toPtr = (unsigned char *)to;
toPtr[0] = fromPtr[4];
toPtr[1] = fromPtr[5];
@@ -1984,8 +2063,8 @@ CopyNumber(
break;
}
case 3: {
const unsigned char *fromPtr = from;
unsigned char *toPtr = to;
const unsigned char *fromPtr = (const unsigned char *)from;
unsigned char *toPtr = (unsigned char *)to;
toPtr[0] = fromPtr[3];
toPtr[1] = fromPtr[2];
@@ -2294,7 +2373,7 @@ ScanNumber(
hPtr = Tcl_CreateHashEntry(tablePtr, INT2PTR(value), &isNew);
if (!isNew) {
return Tcl_GetHashValue(hPtr);
return (Tcl_Obj *)Tcl_GetHashValue(hPtr);
}
if (tablePtr->numEntries <= BINARY_SCAN_MAX_CACHE) {
Tcl_Obj *objPtr = Tcl_NewWideIntObj(value);
@@ -2417,7 +2496,7 @@ DeleteScanNumberCache(
hEntry = Tcl_FirstHashEntry(numberCachePtr, &search);
while (hEntry != NULL) {
Tcl_Obj *value = Tcl_GetHashValue(hEntry);
Tcl_Obj *value = (Tcl_Obj *)Tcl_GetHashValue(hEntry);
if (value != NULL) {
Tcl_DecrRefCount(value);
@@ -2463,7 +2542,7 @@ DeleteScanNumberCache(
static int
BinaryEncodeHex(
ClientData clientData,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -2482,8 +2561,8 @@ BinaryEncodeHex(
data = Tcl_GetByteArrayFromObj(objv[1], &count);
cursor = Tcl_SetByteArrayLength(resultObj, count * 2);
for (offset = 0; offset < count; ++offset) {
*cursor++ = HexDigits[(data[offset] >> 4) & 0x0f];
*cursor++ = HexDigits[data[offset] & 0x0f];
*cursor++ = HexDigits[(data[offset] >> 4) & 0x0F];
*cursor++ = HexDigits[data[offset] & 0x0F];
}
Tcl_SetObjResult(interp, resultObj);
return TCL_OK;
@@ -2507,7 +2586,7 @@ BinaryEncodeHex(
static int
BinaryDecodeHex(
ClientData clientData,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -2515,7 +2594,8 @@ BinaryDecodeHex(
Tcl_Obj *resultObj = NULL;
unsigned char *data, *datastart, *dataend;
unsigned char *begin, *cursor, c;
int i, index, value, size, count = 0, cut = 0, strict = 0;
int i, index, value, size, pure = 1, count = 0, cut = 0, strict = 0;
Tcl_UniChar ch = 0;
enum {OPT_STRICT };
static const char *const optStrings[] = { "-strict", NULL };
@@ -2536,8 +2616,12 @@ BinaryDecodeHex(
}
TclNewObj(resultObj);
datastart = data = (unsigned char *)
TclGetStringFromObj(objv[objc - 1], &count);
data = TclGetBytesFromObj(NULL, objv[objc - 1], &count);
if (data == NULL) {
pure = 0;
data = (unsigned char *) TclGetStringFromObj(objv[objc - 1], &count);
}
datastart = data;
dataend = data + count;
size = (count + 1) / 2;
begin = cursor = Tcl_SetByteArrayLength(resultObj, size);
@@ -2566,7 +2650,7 @@ BinaryDecodeHex(
if (c > 16) {
c += ('A' - 'a');
}
value |= c & 0xf;
value |= c & 0xF;
}
if (i < 2) {
cut++;
@@ -2582,10 +2666,16 @@ BinaryDecodeHex(
return TCL_OK;
badChar:
if (pure) {
ch = c;
} else {
TclUtfToUniChar((const char *)(data - 1), &ch);
}
TclDecrRefCount(resultObj);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"invalid hexadecimal digit \"%c\" at position %d",
c, (int) (data - datastart - 1)));
ch, (int) (data - datastart - 1)));
Tcl_SetErrorCode(interp, "TCL", "BINARY", "DECODE", "INVALID", NULL);
return TCL_ERROR;
}
@@ -2594,16 +2684,10 @@ BinaryDecodeHex(
*
* BinaryEncode64 --
*
* This implements a generic 6 bit binary encoding. Input is broken into
* 6 bit chunks and a lookup table passed in via clientData is used to
* turn these values into output characters. This is used to implement
* base64 binary encodings.
* This procedure implements the "binary encode base64" Tcl command.
*
* Results:
* Interp result set to an encoded byte array object
*
* Side effects:
* None
* The base64 encoded value prescribed by the input arguments.
*
*----------------------------------------------------------------------
*/
@@ -2626,17 +2710,17 @@ BinaryDecodeHex(
static int
BinaryEncode64(
ClientData clientData,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
Tcl_Obj *resultObj;
unsigned char *data, *cursor, *limit;
unsigned char *data, *limit;
int maxlen = 0;
const char *wrapchar = "\n";
int wrapcharlen = 1;
int offset, i, index, size, outindex = 0, count = 0;
int offset, i, index, size, outindex = 0, count = 0, purewrap = 1;
enum { OPT_MAXLEN, OPT_WRAPCHAR };
static const char *const optStrings[] = { "-maxlen", "-wrapchar", NULL };
@@ -2664,17 +2748,24 @@ BinaryEncode64(
}
break;
case OPT_WRAPCHAR:
wrapchar = TclGetStringFromObj(objv[i + 1], &wrapcharlen);
if (wrapcharlen == 0) {
maxlen = 0;
wrapchar = (const char *)TclGetBytesFromObj(NULL,
objv[i + 1], &wrapcharlen);
if (wrapchar == NULL) {
purewrap = 0;
wrapchar = TclGetStringFromObj(objv[i + 1], &wrapcharlen);
}
break;
}
}
if (wrapcharlen == 0) {
maxlen = 0;
}
resultObj = Tcl_NewObj();
data = Tcl_GetByteArrayFromObj(objv[objc - 1], &count);
if (count > 0) {
unsigned char *cursor = NULL;
size = (((count * 4) / 3) + 3) & ~3; /* ensure 4 byte chunks */
if (maxlen > 0 && size > maxlen) {
int adjusted = size + (wrapcharlen * (size / maxlen));
@@ -2683,8 +2774,17 @@ BinaryEncode64(
adjusted -= wrapcharlen;
}
size = adjusted;
if (purewrap == 0) {
/* Wrapchar is (possibly) non-byte, so build result as
* general string, not bytearray */
Tcl_SetObjLength(resultObj, size);
cursor = (unsigned char *) TclGetString(resultObj);
}
}
if (cursor == NULL) {
cursor = Tcl_SetByteArrayLength(resultObj, size);
}
cursor = Tcl_SetByteArrayLength(resultObj, size);
limit = cursor + size;
for (offset = 0; offset < count; offset += 3) {
unsigned char d[3] = {0, 0, 0};
@@ -2695,12 +2795,12 @@ BinaryEncode64(
OUTPUT(B64Digits[d[0] >> 2]);
OUTPUT(B64Digits[((d[0] & 0x03) << 4) | (d[1] >> 4)]);
if (offset + 1 < count) {
OUTPUT(B64Digits[((d[1] & 0x0f) << 2) | (d[2] >> 6)]);
OUTPUT(B64Digits[((d[1] & 0x0F) << 2) | (d[2] >> 6)]);
} else {
OUTPUT(B64Digits[64]);
}
if (offset+2 < count) {
OUTPUT(B64Digits[d[2] & 0x3f]);
OUTPUT(B64Digits[d[2] & 0x3F]);
} else {
OUTPUT(B64Digits[64]);
}
@@ -2732,7 +2832,7 @@ BinaryEncode64(
static int
BinaryEncodeUu(
ClientData clientData,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -2809,12 +2909,12 @@ BinaryEncodeUu(
n <<= 8;
n |= data[offset++];
for (bits += 8; bits > 6 ; bits -= 6) {
*cursor++ = UueDigits[(n >> (bits - 6)) & 0x3f];
*cursor++ = UueDigits[(n >> (bits - 6)) & 0x3F];
}
}
if (bits > 0) {
n <<= 8;
*cursor++ = UueDigits[(n >> (bits + 2)) & 0x3f];
*cursor++ = UueDigits[(n >> (bits + 2)) & 0x3F];
bits = 0;
}
for (j = 0 ; j < wrapcharlen ; ++j) {
@@ -2849,7 +2949,7 @@ BinaryEncodeUu(
static int
BinaryDecodeUu(
ClientData clientData,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -2857,8 +2957,9 @@ BinaryDecodeUu(
Tcl_Obj *resultObj = NULL;
unsigned char *data, *datastart, *dataend;
unsigned char *begin, *cursor;
int i, index, size, count = 0, strict = 0, lineLen;
int i, index, size, pure = 1, count = 0, strict = 0, lineLen;
unsigned char c;
Tcl_UniChar ch = 0;
enum { OPT_STRICT };
static const char *const optStrings[] = { "-strict", NULL };
@@ -2879,8 +2980,12 @@ BinaryDecodeUu(
}
TclNewObj(resultObj);
datastart = data = (unsigned char *)
TclGetStringFromObj(objv[objc - 1], &count);
data = TclGetBytesFromObj(NULL, objv[objc - 1], &count);
if (data == NULL) {
pure = 0;
data = (unsigned char *) TclGetStringFromObj(objv[objc - 1], &count);
}
datastart = data;
dataend = data + count;
size = ((count + 3) & ~3) * 3 / 4;
begin = cursor = Tcl_SetByteArrayLength(resultObj, size);
@@ -2905,7 +3010,7 @@ BinaryDecodeUu(
i--;
continue;
}
lineLen = (c - 32) & 0x3f;
lineLen = (c - 32) & 0x3F;
}
/*
@@ -2934,14 +3039,14 @@ BinaryDecodeUu(
*/
if (lineLen > 0) {
*cursor++ = (((d[0] - 0x20) & 0x3f) << 2)
| (((d[1] - 0x20) & 0x3f) >> 4);
*cursor++ = (((d[0] - 0x20) & 0x3F) << 2)
| (((d[1] - 0x20) & 0x3F) >> 4);
if (--lineLen > 0) {
*cursor++ = (((d[1] - 0x20) & 0x3f) << 4)
| (((d[2] - 0x20) & 0x3f) >> 2);
*cursor++ = (((d[1] - 0x20) & 0x3F) << 4)
| (((d[2] - 0x20) & 0x3F) >> 2);
if (--lineLen > 0) {
*cursor++ = (((d[2] - 0x20) & 0x3f) << 6)
| (((d[3] - 0x20) & 0x3f));
*cursor++ = (((d[2] - 0x20) & 0x3F) << 6)
| (((d[3] - 0x20) & 0x3F));
lineLen--;
}
}
@@ -2986,9 +3091,14 @@ BinaryDecodeUu(
return TCL_ERROR;
badUu:
if (pure) {
ch = c;
} else {
TclUtfToUniChar((const char *)(data - 1), &ch);
}
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"invalid uuencode character \"%c\" at position %d",
c, (int) (data - datastart - 1)));
ch, (int) (data - datastart - 1)));
Tcl_SetErrorCode(interp, "TCL", "BINARY", "DECODE", "INVALID", NULL);
TclDecrRefCount(resultObj);
return TCL_ERROR;
@@ -3012,7 +3122,7 @@ BinaryDecodeUu(
static int
BinaryDecode64(
ClientData clientData,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -3021,8 +3131,9 @@ BinaryDecode64(
unsigned char *data, *datastart, *dataend, c = '\0';
unsigned char *begin = NULL;
unsigned char *cursor = NULL;
int strict = 0;
int pure = 1, strict = 0;
int i, index, size, cut = 0, count = 0;
Tcl_UniChar ch = 0;
enum { OPT_STRICT };
static const char *const optStrings[] = { "-strict", NULL };
@@ -3043,8 +3154,12 @@ BinaryDecode64(
}
TclNewObj(resultObj);
datastart = data = (unsigned char *)
TclGetStringFromObj(objv[objc - 1], &count);
data = TclGetBytesFromObj(NULL, objv[objc - 1], &count);
if (data == NULL) {
pure = 0;
data = (unsigned char *) TclGetStringFromObj(objv[objc - 1], &count);
}
datastart = data;
dataend = data + count;
size = ((count + 3) & ~3) * 3 / 4;
begin = cursor = Tcl_SetByteArrayLength(resultObj, size);
@@ -3094,21 +3209,21 @@ BinaryDecode64(
if (c == '=' && i > 1) {
value <<= 6;
cut++;
} else if (!strict && TclIsSpaceProc(c)) {
} else if (!strict) {
i--;
} else {
goto bad64;
}
} else if (c >= 'A' && c <= 'Z') {
value = (value << 6) | ((c - 'A') & 0x3f);
value = (value << 6) | ((c - 'A') & 0x3F);
} else if (c >= 'a' && c <= 'z') {
value = (value << 6) | ((c - 'a' + 26) & 0x3f);
value = (value << 6) | ((c - 'a' + 26) & 0x3F);
} else if (c >= '0' && c <= '9') {
value = (value << 6) | ((c - '0' + 52) & 0x3f);
value = (value << 6) | ((c - '0' + 52) & 0x3F);
} else if (c == '+') {
value = (value << 6) | 0x3e;
value = (value << 6) | 0x3E;
} else if (c == '/') {
value = (value << 6) | 0x3f;
value = (value << 6) | 0x3F;
} else if (c == '=' && (!strict || i > 1)) {
/*
* "=" and "a=" is rather bad64 error case in strict mode.
@@ -3118,15 +3233,15 @@ BinaryDecode64(
if (i) {
cut++;
}
} else if (strict || !TclIsSpaceProc(c)) {
} else if (strict) {
goto bad64;
} else {
i--;
}
}
*cursor++ = UCHAR((value >> 16) & 0xff);
*cursor++ = UCHAR((value >> 8) & 0xff);
*cursor++ = UCHAR(value & 0xff);
*cursor++ = UCHAR((value >> 16) & 0xFF);
*cursor++ = UCHAR((value >> 8) & 0xFF);
*cursor++ = UCHAR(value & 0xFF);
/*
* Since = is only valid within the final block, if it was encountered
@@ -3138,11 +3253,6 @@ BinaryDecode64(
if (strict) {
goto bad64;
}
for (; data < dataend; data++) {
if (!TclIsSpaceProc(*data)) {
goto bad64;
}
}
}
}
Tcl_SetByteArrayLength(resultObj, cursor - begin - cut);
@@ -3150,9 +3260,21 @@ BinaryDecode64(
return TCL_OK;
bad64:
if (pure) {
ch = c;
} else {
/* The decoder is byte-oriented. If we saw a byte that's not a
* valid member of the base64 alphabet, it could be the lead byte
* of a multi-byte character. */
/* Safe because we know data is NUL-terminated */
TclUtfToUniChar((const char *)(data - 1), &ch);
}
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"invalid base64 character \"%c\" at position %d",
(char) c, (int) (data - datastart - 1)));
"invalid base64 character \"%c\" at position %d", ch,
(int) (data - datastart - 1)));
Tcl_SetErrorCode(interp, "TCL", "BINARY", "DECODE", "INVALID", NULL);
TclDecrRefCount(resultObj);
return TCL_ERROR;
}
+29 -63
View File
@@ -246,7 +246,7 @@ ValidateMemory(
if (byte != GUARD_VALUE) {
guard_failed = TRUE;
fflush(stdout);
byte &= 0xff;
byte &= 0xFF;
fprintf(stderr, "low guard byte %d is 0x%x \t%c\n", (int)idx, byte,
(isprint(UCHAR(byte)) ? byte : ' ')); /* INTL: bytes */
}
@@ -267,7 +267,7 @@ ValidateMemory(
if (byte != GUARD_VALUE) {
guard_failed = TRUE;
fflush(stdout);
byte &= 0xff;
byte &= 0xFF;
fprintf(stderr, "hi guard byte %d is 0x%x \t%c\n", (int)idx, byte,
(isprint(UCHAR(byte)) ? byte : ' ')); /* INTL: bytes */
}
@@ -633,7 +633,7 @@ Tcl_DbCkfree(
if (memp->tagPtr != NULL) {
if ((memp->tagPtr->refCount-- <= 1) && (curTagPtr != memp->tagPtr)) {
TclpFree((char *) memp->tagPtr);
TclpFree(memp->tagPtr);
}
}
@@ -650,7 +650,7 @@ Tcl_DbCkfree(
if (allocHead == memp) {
allocHead = memp->flink;
}
TclpFree((char *) memp);
TclpFree(memp);
Tcl_MutexUnlock(ckallocMutexPtr);
}
@@ -808,13 +808,12 @@ Tcl_AttemptRealloc(
*
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static int
MemoryCmd(
ClientData clientData,
Tcl_Interp *interp,
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Obj values of arguments. */
Tcl_Obj *const objv[]) /* Obj values of arguments. */
{
const char *fileName;
FILE *fileP;
@@ -914,7 +913,7 @@ MemoryCmd(
return TCL_ERROR;
}
if ((curTagPtr != NULL) && (curTagPtr->refCount == 0)) {
TclpFree((char *) curTagPtr);
TclpFree(curTagPtr);
}
len = strlen(TclGetString(objv[2]));
curTagPtr = (MemTag *) TclpAlloc(TAG_SIZE(len));
@@ -987,10 +986,10 @@ static int CheckmemCmd(ClientData clientData,
static int
CheckmemCmd(
ClientData clientData, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Interpreter for evaluation. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Obj values of arguments. */
Tcl_Obj *const objv[]) /* Obj values of arguments. */
{
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "fileName");
@@ -1052,9 +1051,7 @@ char *
Tcl_Alloc(
unsigned int size)
{
char *result;
result = TclpAlloc(size);
char *result = (char *)TclpAlloc(size);
/*
* Most systems will not alloc(0), instead bumping it to one so that NULL
@@ -1078,9 +1075,7 @@ Tcl_DbCkalloc(
const char *file,
int line)
{
char *result;
result = (char *) TclpAlloc(size);
char *result = (char *)TclpAlloc(size);
if ((result == NULL) && size) {
fflush(stdout);
@@ -1104,24 +1099,16 @@ char *
Tcl_AttemptAlloc(
unsigned int size)
{
char *result;
result = TclpAlloc(size);
return result;
return (char *)TclpAlloc(size);
}
char *
Tcl_AttemptDbCkalloc(
unsigned int size,
const char *file,
int line)
TCL_UNUSED(const char *) /*file*/,
TCL_UNUSED(int) /*line*/)
{
char *result;
(void)file;
(void)line;
result = (char *) TclpAlloc(size);
return result;
return (char *)TclpAlloc(size);
}
/*
@@ -1140,9 +1127,7 @@ Tcl_Realloc(
char *ptr,
unsigned int size)
{
char *result;
result = TclpRealloc(ptr, size);
char *result = (char *)TclpRealloc(ptr, size);
if ((result == NULL) && size) {
Tcl_Panic("unable to realloc %u bytes", size);
@@ -1157,9 +1142,7 @@ Tcl_DbCkrealloc(
const char *file,
int line)
{
char *result;
result = (char *) TclpRealloc(ptr, size);
char *result = (char *)TclpRealloc(ptr, size);
if ((result == NULL) && size) {
fflush(stdout);
@@ -1184,25 +1167,17 @@ Tcl_AttemptRealloc(
char *ptr,
unsigned int size)
{
char *result;
result = TclpRealloc(ptr, size);
return result;
return (char *)TclpRealloc(ptr, size);
}
char *
Tcl_AttemptDbCkrealloc(
char *ptr,
unsigned int size,
const char *file,
int line)
TCL_UNUSED(const char *) /*file*/,
TCL_UNUSED(int) /*line*/)
{
char *result;
(void)file;
(void)line;
result = (char *) TclpRealloc(ptr, size);
return result;
return (char *)TclpRealloc(ptr, size);
}
/*
@@ -1227,11 +1202,9 @@ Tcl_Free(
void
Tcl_DbCkfree(
char *ptr,
const char *file,
int line)
TCL_UNUSED(const char *) /*file*/,
TCL_UNUSED(int) /*line*/)
{
(void)file;
(void)line;
TclpFree(ptr);
}
@@ -1245,38 +1218,31 @@ Tcl_DbCkfree(
*
*----------------------------------------------------------------------
*/
/* ARGSUSED */
void
Tcl_InitMemory(
Tcl_Interp *interp)
TCL_UNUSED(Tcl_Interp *) /*interp*/)
{
(void)interp;
}
int
Tcl_DumpActiveMemory(
const char *fileName)
TCL_UNUSED(const char *) /*fileName*/)
{
(void)fileName;
return TCL_OK;
}
void
Tcl_ValidateAllMemory(
const char *file,
int line)
TCL_UNUSED(const char *) /*file*/,
TCL_UNUSED(int) /*line*/)
{
(void)file;
(void)line;
}
int
TclDumpMemoryInfo(
ClientData clientData,
int flags)
TCL_UNUSED(ClientData),
TCL_UNUSED(int) /*flags*/)
{
(void)clientData;
(void)flags;
return 1;
}
@@ -1314,7 +1280,7 @@ TclFinalizeMemorySubsystem(void)
Tcl_MutexLock(ckallocMutexPtr);
if (curTagPtr != NULL) {
TclpFree((char *) curTagPtr);
TclpFree(curTagPtr);
curTagPtr = NULL;
}
allocHead = NULL;
+64 -69
View File
@@ -109,7 +109,7 @@ typedef struct TclDateFields {
* Greenwich */
Tcl_Obj *tzName; /* Time zone name */
int julianDay; /* Julian Day Number in local time zone */
enum {BCE=1, CE=0} era; /* Era */
int isBce; /* 1 if BCE */
int gregorian; /* Flag == 1 if the date is Gregorian */
int year; /* Year of the era */
int dayOfYear; /* Day of the year (1 January == 1) */
@@ -275,9 +275,9 @@ TclClockInit(
* Create the client data, which is a refcounted literal pool.
*/
data = ckalloc(sizeof(ClockClientData));
data = (ClockClientData *)ckalloc(sizeof(ClockClientData));
data->refCount = 0;
data->literals = ckalloc(LIT__END * sizeof(Tcl_Obj*));
data->literals = (Tcl_Obj **)ckalloc(LIT__END * sizeof(Tcl_Obj*));
for (i = 0; i < LIT__END; ++i) {
data->literals[i] = Tcl_NewStringObj(literals[i], -1);
Tcl_IncrRefCount(data->literals[i]);
@@ -336,8 +336,8 @@ ClockConvertlocaltoutcObjCmd(
int objc, /* Parameter count */
Tcl_Obj *const *objv) /* Parameter vector */
{
ClockClientData *data = clientData;
Tcl_Obj *const *literals = data->literals;
ClockClientData *data = (ClockClientData *)clientData;
Tcl_Obj *const *lit = data->literals;
Tcl_Obj *secondsObj;
Tcl_Obj *dict;
int changeover;
@@ -354,7 +354,7 @@ ClockConvertlocaltoutcObjCmd(
return TCL_ERROR;
}
dict = objv[1];
if (Tcl_DictObjGet(interp, dict, literals[LIT_LOCALSECONDS],
if (Tcl_DictObjGet(interp, dict, lit[LIT_LOCALSECONDS],
&secondsObj)!= TCL_OK) {
return TCL_ERROR;
}
@@ -380,7 +380,7 @@ ClockConvertlocaltoutcObjCmd(
created = 1;
Tcl_IncrRefCount(dict);
}
status = Tcl_DictObjPut(interp, dict, literals[LIT_SECONDS],
status = Tcl_DictObjPut(interp, dict, lit[LIT_SECONDS],
Tcl_NewWideIntObj(fields.seconds));
if (status == TCL_OK) {
Tcl_SetObjResult(interp, dict);
@@ -430,8 +430,8 @@ ClockGetdatefieldsObjCmd(
{
TclDateFields fields;
Tcl_Obj *dict;
ClockClientData *data = clientData;
Tcl_Obj *const *literals = data->literals;
ClockClientData *data = (ClockClientData *)clientData;
Tcl_Obj *const *lit = data->literals;
int changeover;
/*
@@ -453,7 +453,7 @@ ClockGetdatefieldsObjCmd(
*/
if (TclHasIntRep(objv[1], &tclBignumType)) {
Tcl_SetObjResult(interp, literals[LIT_INTEGER_VALUE_TOO_LARGE]);
Tcl_SetObjResult(interp, lit[LIT_INTEGER_VALUE_TOO_LARGE]);
return TCL_ERROR;
}
@@ -481,33 +481,33 @@ ClockGetdatefieldsObjCmd(
GetYearWeekDay(&fields, changeover);
dict = Tcl_NewDictObj();
Tcl_DictObjPut(NULL, dict, literals[LIT_LOCALSECONDS],
Tcl_DictObjPut(NULL, dict, lit[LIT_LOCALSECONDS],
Tcl_NewWideIntObj(fields.localSeconds));
Tcl_DictObjPut(NULL, dict, literals[LIT_SECONDS],
Tcl_DictObjPut(NULL, dict, lit[LIT_SECONDS],
Tcl_NewWideIntObj(fields.seconds));
Tcl_DictObjPut(NULL, dict, literals[LIT_TZNAME], fields.tzName);
Tcl_DictObjPut(NULL, dict, lit[LIT_TZNAME], fields.tzName);
Tcl_DecrRefCount(fields.tzName);
Tcl_DictObjPut(NULL, dict, literals[LIT_TZOFFSET],
Tcl_DictObjPut(NULL, dict, lit[LIT_TZOFFSET],
Tcl_NewWideIntObj(fields.tzOffset));
Tcl_DictObjPut(NULL, dict, literals[LIT_JULIANDAY],
Tcl_DictObjPut(NULL, dict, lit[LIT_JULIANDAY],
Tcl_NewWideIntObj(fields.julianDay));
Tcl_DictObjPut(NULL, dict, literals[LIT_GREGORIAN],
Tcl_DictObjPut(NULL, dict, lit[LIT_GREGORIAN],
Tcl_NewWideIntObj(fields.gregorian));
Tcl_DictObjPut(NULL, dict, literals[LIT_ERA],
literals[fields.era ? LIT_BCE : LIT_CE]);
Tcl_DictObjPut(NULL, dict, literals[LIT_YEAR],
Tcl_DictObjPut(NULL, dict, lit[LIT_ERA],
lit[fields.isBce ? LIT_BCE : LIT_CE]);
Tcl_DictObjPut(NULL, dict, lit[LIT_YEAR],
Tcl_NewWideIntObj(fields.year));
Tcl_DictObjPut(NULL, dict, literals[LIT_DAYOFYEAR],
Tcl_DictObjPut(NULL, dict, lit[LIT_DAYOFYEAR],
Tcl_NewWideIntObj(fields.dayOfYear));
Tcl_DictObjPut(NULL, dict, literals[LIT_MONTH],
Tcl_DictObjPut(NULL, dict, lit[LIT_MONTH],
Tcl_NewWideIntObj(fields.month));
Tcl_DictObjPut(NULL, dict, literals[LIT_DAYOFMONTH],
Tcl_DictObjPut(NULL, dict, lit[LIT_DAYOFMONTH],
Tcl_NewWideIntObj(fields.dayOfMonth));
Tcl_DictObjPut(NULL, dict, literals[LIT_ISO8601YEAR],
Tcl_DictObjPut(NULL, dict, lit[LIT_ISO8601YEAR],
Tcl_NewWideIntObj(fields.iso8601Year));
Tcl_DictObjPut(NULL, dict, literals[LIT_ISO8601WEEK],
Tcl_DictObjPut(NULL, dict, lit[LIT_ISO8601WEEK],
Tcl_NewWideIntObj(fields.iso8601Week));
Tcl_DictObjPut(NULL, dict, literals[LIT_DAYOFWEEK],
Tcl_DictObjPut(NULL, dict, lit[LIT_DAYOFWEEK],
Tcl_NewWideIntObj(fields.dayOfWeek));
Tcl_SetObjResult(interp, dict);
@@ -584,12 +584,12 @@ ClockGetjuliandayfromerayearmonthdayObjCmd(
{
TclDateFields fields;
Tcl_Obj *dict;
ClockClientData *data = clientData;
Tcl_Obj *const *literals = data->literals;
ClockClientData *data = (ClockClientData *)clientData;
Tcl_Obj *const *lit = data->literals;
int changeover;
int copied = 0;
int status;
int era = 0;
int isBce = 0;
/*
* Check params.
@@ -600,17 +600,17 @@ ClockGetjuliandayfromerayearmonthdayObjCmd(
return TCL_ERROR;
}
dict = objv[1];
if (FetchEraField(interp, dict, literals[LIT_ERA], &era) != TCL_OK
|| FetchIntField(interp, dict, literals[LIT_YEAR], &fields.year)
if (FetchEraField(interp, dict, lit[LIT_ERA], &isBce) != TCL_OK
|| FetchIntField(interp, dict, lit[LIT_YEAR], &fields.year)
!= TCL_OK
|| FetchIntField(interp, dict, literals[LIT_MONTH], &fields.month)
|| FetchIntField(interp, dict, lit[LIT_MONTH], &fields.month)
!= TCL_OK
|| FetchIntField(interp, dict, literals[LIT_DAYOFMONTH],
|| FetchIntField(interp, dict, lit[LIT_DAYOFMONTH],
&fields.dayOfMonth) != TCL_OK
|| TclGetIntFromObj(interp, objv[2], &changeover) != TCL_OK) {
return TCL_ERROR;
}
fields.era = era;
fields.isBce = isBce;
/*
* Get Julian day.
@@ -627,7 +627,7 @@ ClockGetjuliandayfromerayearmonthdayObjCmd(
Tcl_IncrRefCount(dict);
copied = 1;
}
status = Tcl_DictObjPut(interp, dict, literals[LIT_JULIANDAY],
status = Tcl_DictObjPut(interp, dict, lit[LIT_JULIANDAY],
Tcl_NewWideIntObj(fields.julianDay));
if (status == TCL_OK) {
Tcl_SetObjResult(interp, dict);
@@ -668,12 +668,12 @@ ClockGetjuliandayfromerayearweekdayObjCmd(
{
TclDateFields fields;
Tcl_Obj *dict;
ClockClientData *data = clientData;
Tcl_Obj *const *literals = data->literals;
ClockClientData *data = (ClockClientData *)clientData;
Tcl_Obj *const *lit = data->literals;
int changeover;
int copied = 0;
int status;
int era = 0;
int isBce = 0;
/*
* Check params.
@@ -684,17 +684,17 @@ ClockGetjuliandayfromerayearweekdayObjCmd(
return TCL_ERROR;
}
dict = objv[1];
if (FetchEraField(interp, dict, literals[LIT_ERA], &era) != TCL_OK
|| FetchIntField(interp, dict, literals[LIT_ISO8601YEAR],
if (FetchEraField(interp, dict, lit[LIT_ERA], &isBce) != TCL_OK
|| FetchIntField(interp, dict, lit[LIT_ISO8601YEAR],
&fields.iso8601Year) != TCL_OK
|| FetchIntField(interp, dict, literals[LIT_ISO8601WEEK],
|| FetchIntField(interp, dict, lit[LIT_ISO8601WEEK],
&fields.iso8601Week) != TCL_OK
|| FetchIntField(interp, dict, literals[LIT_DAYOFWEEK],
|| FetchIntField(interp, dict, lit[LIT_DAYOFWEEK],
&fields.dayOfWeek) != TCL_OK
|| TclGetIntFromObj(interp, objv[2], &changeover) != TCL_OK) {
return TCL_ERROR;
}
fields.era = era;
fields.isBce = isBce;
/*
* Get Julian day.
@@ -711,7 +711,7 @@ ClockGetjuliandayfromerayearweekdayObjCmd(
Tcl_IncrRefCount(dict);
copied = 1;
}
status = Tcl_DictObjPut(interp, dict, literals[LIT_JULIANDAY],
status = Tcl_DictObjPut(interp, dict, lit[LIT_JULIANDAY],
Tcl_NewWideIntObj(fields.julianDay));
if (status == TCL_OK) {
Tcl_SetObjResult(interp, dict);
@@ -1052,7 +1052,7 @@ ConvertUTCToLocalUsingC(
time_t tock;
struct tm *timeVal; /* Time after conversion */
int diff; /* Time zone diff local-Greenwich */
char buffer[8]; /* Buffer for time zone name */
char buffer[16]; /* Buffer for time zone name */
/*
* Use 'localtime' to determine local year, month, day, time of day.
@@ -1079,7 +1079,7 @@ ConvertUTCToLocalUsingC(
* Fill in the date in 'fields' and use it to derive Julian Day.
*/
fields->era = CE;
fields->isBce = 0;
fields->year = timeVal->tm_year + 1900;
fields->month = timeVal->tm_mon + 1;
fields->dayOfMonth = timeVal->tm_mday;
@@ -1217,7 +1217,7 @@ GetYearWeekDay(
temp.julianDay = fields->julianDay - 3;
GetGregorianEraYearDay(&temp, changeover);
if (temp.era == BCE) {
if (temp.isBce) {
temp.iso8601Year = temp.year - 1;
} else {
temp.iso8601Year = temp.year + 1;
@@ -1233,7 +1233,7 @@ GetYearWeekDay(
*/
if (fields->julianDay < temp.julianDay) {
if (temp.era == BCE) {
if (temp.isBce) {
temp.iso8601Year += 1;
} else {
temp.iso8601Year -= 1;
@@ -1359,10 +1359,10 @@ GetGregorianEraYearDay(
*/
if (year <= 0) {
fields->era = BCE;
fields->isBce = 1;
fields->year = 1 - year;
} else {
fields->era = CE;
fields->isBce = 0;
fields->year = year;
}
fields->dayOfYear = day + 1;
@@ -1430,7 +1430,7 @@ GetJulianDayFromEraYearWeekDay(
* Find January 4 in the ISO8601 year, which will always be in week 1.
*/
firstWeek.era = fields->era;
firstWeek.isBce = fields->isBce;
firstWeek.year = fields->iso8601Year;
firstWeek.month = 1;
firstWeek.dayOfMonth = 4;
@@ -1474,7 +1474,7 @@ GetJulianDayFromEraYearMonthDay(
{
int year, ym1, month, mm1, q, r, ym1o4, ym1o100, ym1o400;
if (fields->era == BCE) {
if (fields->isBce) {
year = 1 - fields->year;
} else {
year = fields->year;
@@ -1502,10 +1502,10 @@ GetJulianDayFromEraYearMonthDay(
fields->gregorian = 1;
if (year < 1) {
fields->era = BCE;
fields->isBce = 1;
fields->year = 1-year;
} else {
fields->era = CE;
fields->isBce = 0;
fields->year = year;
}
@@ -1580,7 +1580,7 @@ IsGregorianLeapYear(
{
int year = fields->year;
if (fields->era == BCE) {
if (fields->isBce) {
year = 1 - year;
}
if (year%4 != 0) {
@@ -1645,14 +1645,13 @@ WeekdayOnOrBefore(
int
ClockGetenvObjCmd(
ClientData clientData,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
const char *varName;
const char *varValue;
(void)clientData;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "name");
@@ -1693,7 +1692,7 @@ ThreadSafeLocalTime(
* Get a thread-local buffer to hold the returned time.
*/
struct tm *tmPtr = Tcl_GetThreadData(&tmKey, sizeof(struct tm));
struct tm *tmPtr = (struct tm *)Tcl_GetThreadData(&tmKey, sizeof(struct tm));
#ifdef HAVE_LOCALTIME_R
localtime_r(timePtr, tmPtr);
#else
@@ -1731,7 +1730,7 @@ ThreadSafeLocalTime(
int
ClockClicksObjCmd(
ClientData clientData, /* Client data is unused */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Tcl interpreter */
int objc, /* Parameter count */
Tcl_Obj *const *objv) /* Parameter values */
@@ -1745,7 +1744,6 @@ ClockClicksObjCmd(
int index = CLICKS_NATIVE;
Tcl_Time now;
Tcl_WideInt clicks = 0;
(void)clientData;
switch (objc) {
case 1:
@@ -1802,13 +1800,12 @@ ClockClicksObjCmd(
int
ClockMillisecondsObjCmd(
ClientData clientData, /* Client data is unused */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Tcl interpreter */
int objc, /* Parameter count */
Tcl_Obj *const *objv) /* Parameter values */
{
Tcl_Time now;
(void)clientData;
if (objc != 1) {
Tcl_WrongNumArgs(interp, 1, objv, NULL);
@@ -1840,12 +1837,11 @@ ClockMillisecondsObjCmd(
int
ClockMicrosecondsObjCmd(
ClientData clientData, /* Client data is unused */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Tcl interpreter */
int objc, /* Parameter count */
Tcl_Obj *const *objv) /* Parameter values */
{
(void)clientData;
if (objc != 1) {
Tcl_WrongNumArgs(interp, 1, objv, NULL);
return TCL_ERROR;
@@ -1879,7 +1875,7 @@ ClockParseformatargsObjCmd(
int objc, /* Parameter count */
Tcl_Obj *const objv[]) /* Parameter vector */
{
ClockClientData *dataPtr = clientData;
ClockClientData *dataPtr = (ClockClientData *)clientData;
Tcl_Obj **litPtr = dataPtr->literals;
Tcl_Obj *results[3]; /* Format, locale and timezone */
#define formatObj results[0]
@@ -1992,13 +1988,12 @@ ClockParseformatargsObjCmd(
int
ClockSecondsObjCmd(
ClientData clientData, /* Client data is unused */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Tcl interpreter */
int objc, /* Parameter count */
Tcl_Obj *const *objv) /* Parameter values */
{
Tcl_Time now;
(void)clientData;
if (objc != 1) {
Tcl_WrongNumArgs(interp, 1, objv, NULL);
@@ -2029,7 +2024,7 @@ ClockSecondsObjCmd(
static void
TzsetIfNecessary(void)
{
static char* tzWas = INT2PTR(-1); /* Previous value of TZ, protected by
static char* tzWas = (char *)INT2PTR(-1); /* Previous value of TZ, protected by
* clockMutex. */
const char *tzIsNow; /* Current value of TZ */
@@ -2041,7 +2036,7 @@ TzsetIfNecessary(void)
if (tzWas != NULL && tzWas != INT2PTR(-1)) {
ckfree(tzWas);
}
tzWas = ckalloc(strlen(tzIsNow) + 1);
tzWas = (char *)ckalloc(strlen(tzIsNow) + 1);
strcpy(tzWas, tzIsNow);
} else if (tzIsNow == NULL && tzWas != NULL) {
tzset();
@@ -2069,7 +2064,7 @@ static void
ClockDeleteCmdProc(
ClientData clientData) /* Opaque pointer to the client data */
{
ClockClientData *data = clientData;
ClockClientData *data = (ClockClientData *)clientData;
int i;
if (data->refCount-- <= 1) {
+83 -105
View File
@@ -45,21 +45,11 @@ struct ForeachState {
static int CheckAccess(Tcl_Interp *interp, Tcl_Obj *pathPtr,
int mode);
static int EncodingConvertfromObjCmd(ClientData dummy,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
static int EncodingConverttoObjCmd(ClientData dummy,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
static int EncodingDirsObjCmd(ClientData dummy,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
static int EncodingNamesObjCmd(ClientData dummy,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
static int EncodingSystemObjCmd(ClientData dummy,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
static Tcl_ObjCmdProc EncodingConvertfromObjCmd;
static Tcl_ObjCmdProc EncodingConverttoObjCmd;
static Tcl_ObjCmdProc EncodingDirsObjCmd;
static Tcl_ObjCmdProc EncodingNamesObjCmd;
static Tcl_ObjCmdProc EncodingSystemObjCmd;
static inline int ForeachAssignments(Tcl_Interp *interp,
struct ForeachState *statePtr);
static inline void ForeachCleanup(Tcl_Interp *interp,
@@ -127,10 +117,9 @@ static Tcl_ObjCmdProc PathTypeCmd;
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_BreakObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -160,10 +149,9 @@ Tcl_BreakObjCmd(
*----------------------------------------------------------------------
*/
#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
/* ARGSUSED */
int
Tcl_CaseObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -296,20 +284,19 @@ Tcl_CaseObjCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_CatchObjCmd(
ClientData dummy, /* Not used. */
ClientData clientData,
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
return Tcl_NRCallObjProc(interp, TclNRCatchObjCmd, dummy, objc, objv);
return Tcl_NRCallObjProc(interp, TclNRCatchObjCmd, clientData, objc, objv);
}
int
TclNRCatchObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -349,8 +336,8 @@ CatchObjCmdCallback(
{
Interp *iPtr = (Interp *) interp;
int objc = PTR2INT(data[0]);
Tcl_Obj *varNamePtr = data[1];
Tcl_Obj *optionVarNamePtr = data[2];
Tcl_Obj *varNamePtr = (Tcl_Obj *)data[1];
Tcl_Obj *optionVarNamePtr = (Tcl_Obj *)data[2];
int rewind = iPtr->execEnvPtr->rewind;
/*
@@ -402,10 +389,9 @@ CatchObjCmdCallback(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_CdObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -458,10 +444,9 @@ Tcl_CdObjCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_ConcatObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -493,10 +478,9 @@ Tcl_ConcatObjCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_ContinueObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -556,7 +540,7 @@ TclInitEncodingCmd(
int
EncodingConvertfromObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -618,7 +602,7 @@ EncodingConvertfromObjCmd(
int
EncodingConverttoObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -682,7 +666,7 @@ EncodingConverttoObjCmd(
int
EncodingDirsObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -725,10 +709,11 @@ EncodingDirsObjCmd(
*/
int
EncodingNamesObjCmd(ClientData dummy, /* Unused */
Tcl_Interp* interp, /* Tcl interpreter */
int objc, /* Number of command line args */
Tcl_Obj* const objv[]) /* Vector of command line args */
EncodingNamesObjCmd(
TCL_UNUSED(ClientData),
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);
@@ -755,10 +740,11 @@ EncodingNamesObjCmd(ClientData dummy, /* Unused */
*/
int
EncodingSystemObjCmd(ClientData dummy, /* Unused */
Tcl_Interp* interp, /* Tcl interpreter */
int objc, /* Number of command line args */
Tcl_Obj* const objv[]) /* Vector of command line args */
EncodingSystemObjCmd(
TCL_UNUSED(ClientData),
Tcl_Interp* interp, /* Tcl interpreter */
int objc, /* Number of command line args */
Tcl_Obj* const objv[]) /* Vector of command line args */
{
if (objc > 2) {
Tcl_WrongNumArgs(interp, 1, objv, "?encoding?");
@@ -790,10 +776,9 @@ EncodingSystemObjCmd(ClientData dummy, /* Unused */
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_ErrorObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -840,10 +825,9 @@ Tcl_ErrorObjCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static int
EvalCmdErrMsg(
ClientData data[],
TCL_UNUSED(ClientData *),
Tcl_Interp *interp,
int result)
{
@@ -856,17 +840,17 @@ EvalCmdErrMsg(
int
Tcl_EvalObjCmd(
ClientData dummy, /* Not used. */
ClientData clientData,
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
return Tcl_NRCallObjProc(interp, TclNREvalObjCmd, dummy, objc, objv);
return Tcl_NRCallObjProc(interp, TclNREvalObjCmd, clientData, objc, objv);
}
int
TclNREvalObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -923,10 +907,9 @@ TclNREvalObjCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_ExitObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -944,7 +927,6 @@ Tcl_ExitObjCmd(
return TCL_ERROR;
}
Tcl_Exit((int)value);
/*NOTREACHED*/
return TCL_OK; /* Better not ever reach this! */
}
@@ -972,20 +954,19 @@ Tcl_ExitObjCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_ExprObjCmd(
ClientData dummy, /* Not used. */
ClientData clientData,
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
return Tcl_NRCallObjProc(interp, TclNRExprObjCmd, dummy, objc, objv);
return Tcl_NRCallObjProc(interp, TclNRExprObjCmd, clientData, objc, objv);
}
int
TclNRExprObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1016,8 +997,8 @@ ExprCallback(
Tcl_Interp *interp,
int result)
{
Tcl_Obj *resultPtr = data[0];
Tcl_Obj *objPtr = data[1];
Tcl_Obj *resultPtr = (Tcl_Obj *)data[0];
Tcl_Obj *objPtr = (Tcl_Obj *)data[1];
if (objPtr != NULL) {
Tcl_DecrRefCount(objPtr);
@@ -1121,7 +1102,7 @@ TclInitFileCmd(
static int
FileAttrAccessTimeCmd(
ClientData clientData,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1203,7 +1184,7 @@ FileAttrAccessTimeCmd(
static int
FileAttrModifyTimeCmd(
ClientData clientData,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1282,7 +1263,7 @@ FileAttrModifyTimeCmd(
static int
FileAttrLinkStatCmd(
ClientData clientData,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1318,7 +1299,7 @@ FileAttrLinkStatCmd(
static int
FileAttrStatCmd(
ClientData clientData,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1354,7 +1335,7 @@ FileAttrStatCmd(
static int
FileAttrTypeCmd(
ClientData clientData,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1392,7 +1373,7 @@ FileAttrTypeCmd(
static int
FileAttrSizeCmd(
ClientData clientData,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1429,7 +1410,7 @@ FileAttrSizeCmd(
static int
FileAttrIsDirectoryCmd(
ClientData clientData,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1467,7 +1448,7 @@ FileAttrIsDirectoryCmd(
static int
FileAttrIsExecutableCmd(
ClientData clientData,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1498,7 +1479,7 @@ FileAttrIsExecutableCmd(
static int
FileAttrIsExistingCmd(
ClientData clientData,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1529,7 +1510,7 @@ FileAttrIsExistingCmd(
static int
FileAttrIsFileCmd(
ClientData clientData,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1567,7 +1548,7 @@ FileAttrIsFileCmd(
static int
FileAttrIsOwnedCmd(
ClientData clientData,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1614,7 +1595,7 @@ FileAttrIsOwnedCmd(
static int
FileAttrIsReadableCmd(
ClientData clientData,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1645,7 +1626,7 @@ FileAttrIsReadableCmd(
static int
FileAttrIsWritableCmd(
ClientData clientData,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1676,7 +1657,7 @@ FileAttrIsWritableCmd(
static int
PathDirNameCmd(
ClientData clientData,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1715,7 +1696,7 @@ PathDirNameCmd(
static int
PathExtensionCmd(
ClientData clientData,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1754,7 +1735,7 @@ PathExtensionCmd(
static int
PathRootNameCmd(
ClientData clientData,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1793,7 +1774,7 @@ PathRootNameCmd(
static int
PathTailCmd(
ClientData clientData,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1832,7 +1813,7 @@ PathTailCmd(
static int
PathFilesystemCmd(
ClientData clientData,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1873,7 +1854,7 @@ PathFilesystemCmd(
static int
PathJoinCmd(
ClientData clientData,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1905,7 +1886,7 @@ PathJoinCmd(
static int
PathNativeNameCmd(
ClientData clientData,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1942,7 +1923,7 @@ PathNativeNameCmd(
static int
PathNormalizeCmd(
ClientData clientData,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1980,7 +1961,7 @@ PathNormalizeCmd(
static int
PathSplitCmd(
ClientData clientData,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -2023,7 +2004,7 @@ PathSplitCmd(
static int
PathTypeCmd(
ClientData clientData,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -2071,7 +2052,7 @@ PathTypeCmd(
static int
FilesystemSeparatorCmd(
ClientData clientData,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -2081,7 +2062,7 @@ FilesystemSeparatorCmd(
return TCL_ERROR;
}
if (objc == 1) {
const char *separator = NULL; /* lint */
const char *separator = NULL;
switch (tclPlatform) {
case TCL_PLATFORM_UNIX:
@@ -2126,7 +2107,7 @@ FilesystemSeparatorCmd(
static int
FilesystemVolumesCmd(
ClientData clientData,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -2384,20 +2365,19 @@ GetTypeFromMode(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_ForObjCmd(
ClientData dummy, /* Not used. */
ClientData clientData,
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
return Tcl_NRCallObjProc(interp, TclNRForObjCmd, dummy, objc, objv);
return Tcl_NRCallObjProc(interp, TclNRForObjCmd, clientData, objc, objv);
}
int
TclNRForObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -2432,7 +2412,7 @@ ForSetupCallback(
Tcl_Interp *interp,
int result)
{
ForIterData *iterPtr = data[0];
ForIterData *iterPtr = (ForIterData *)data[0];
if (result != TCL_OK) {
if (result == TCL_ERROR) {
@@ -2451,7 +2431,7 @@ TclNRForIterCallback(
Tcl_Interp *interp,
int result)
{
ForIterData *iterPtr = data[0];
ForIterData *iterPtr = (ForIterData *)data[0];
Tcl_Obj *boolObj;
switch (result) {
@@ -2487,8 +2467,8 @@ ForCondCallback(
int result)
{
Interp *iPtr = (Interp *) interp;
ForIterData *iterPtr = data[0];
Tcl_Obj *boolObj = data[1];
ForIterData *iterPtr = (ForIterData *)data[0];
Tcl_Obj *boolObj = (Tcl_Obj *)data[1];
int value;
if (result != TCL_OK) {
@@ -2525,7 +2505,7 @@ ForNextCallback(
int result)
{
Interp *iPtr = (Interp *) interp;
ForIterData *iterPtr = data[0];
ForIterData *iterPtr = (ForIterData *)data[0];
Tcl_Obj *next = iterPtr->next;
if ((result == TCL_OK) || (result == TCL_CONTINUE)) {
@@ -2549,7 +2529,7 @@ ForPostNextCallback(
Tcl_Interp *interp,
int result)
{
ForIterData *iterPtr = data[0];
ForIterData *iterPtr = (ForIterData *)data[0];
if ((result != TCL_BREAK) && (result != TCL_OK)) {
if (result == TCL_ERROR) {
@@ -2579,20 +2559,19 @@ ForPostNextCallback(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_ForeachObjCmd(
ClientData dummy, /* Not used. */
ClientData clientData,
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
return Tcl_NRCallObjProc(interp, TclNRForeachCmd, dummy, objc, objv);
return Tcl_NRCallObjProc(interp, TclNRForeachCmd, clientData, objc, objv);
}
int
TclNRForeachCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -2602,17 +2581,17 @@ TclNRForeachCmd(
int
Tcl_LmapObjCmd(
ClientData dummy, /* Not used. */
ClientData clientData,
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
return Tcl_NRCallObjProc(interp, TclNRLmapCmd, dummy, objc, objv);
return Tcl_NRCallObjProc(interp, TclNRLmapCmd, clientData, objc, objv);
}
int
TclNRLmapCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -2654,7 +2633,7 @@ EachloopCmd(
* allocation for better performance.
*/
statePtr = TclStackAlloc(interp,
statePtr = (struct ForeachState *)TclStackAlloc(interp,
sizeof(struct ForeachState) + 3 * numLists * sizeof(int)
+ 2 * numLists * (sizeof(Tcl_Obj **) + sizeof(Tcl_Obj *)));
memset(statePtr, 0,
@@ -2755,7 +2734,7 @@ ForeachLoopStep(
Tcl_Interp *interp,
int result)
{
struct ForeachState *statePtr = data[0];
struct ForeachState *statePtr = (struct ForeachState *)data[0];
/*
* Process the result code from this run of the [foreach] body. Note that
@@ -2897,10 +2876,9 @@ ForeachCleanup(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_FormatObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
+118 -113
View File
@@ -99,49 +99,28 @@ typedef struct {
static int DictionaryCompare(const char *left, const char *right);
static Tcl_NRPostProc IfConditionCallback;
static int InfoArgsCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int InfoBodyCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int InfoCmdCountCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int InfoCommandsCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int InfoCompleteCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int InfoDefaultCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static Tcl_ObjCmdProc InfoArgsCmd;
static Tcl_ObjCmdProc InfoBodyCmd;
static Tcl_ObjCmdProc InfoCmdCountCmd;
static Tcl_ObjCmdProc InfoCommandsCmd;
static Tcl_ObjCmdProc InfoCompleteCmd;
static Tcl_ObjCmdProc InfoDefaultCmd;
/* TIP #348 - New 'info' subcommand 'errorstack' */
static int InfoErrorStackCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static Tcl_ObjCmdProc InfoErrorStackCmd;
/* TIP #280 - New 'info' subcommand 'frame' */
static int InfoFrameCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int InfoFunctionsCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int InfoHostnameCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int InfoLevelCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int InfoLibraryCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int InfoLoadedCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int InfoNameOfExecutableCmd(ClientData dummy,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
static int InfoPatchLevelCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int InfoProcsCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int InfoScriptCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int InfoSharedlibCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int InfoCmdTypeCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int InfoTclVersionCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static Tcl_ObjCmdProc InfoFrameCmd;
static Tcl_ObjCmdProc InfoFunctionsCmd;
static Tcl_ObjCmdProc InfoHostnameCmd;
static Tcl_ObjCmdProc InfoLevelCmd;
static Tcl_ObjCmdProc InfoLibraryCmd;
static Tcl_ObjCmdProc InfoLoadedCmd;
static Tcl_ObjCmdProc InfoNameOfExecutableCmd;
static Tcl_ObjCmdProc InfoPatchLevelCmd;
static Tcl_ObjCmdProc InfoProcsCmd;
static Tcl_ObjCmdProc InfoScriptCmd;
static Tcl_ObjCmdProc InfoSharedlibCmd;
static Tcl_ObjCmdProc InfoCmdTypeCmd;
static Tcl_ObjCmdProc InfoTclVersionCmd;
static SortElement * MergeLists(SortElement *leftPtr, SortElement *rightPtr,
SortInfo *infoPtr);
static int SortCompare(SortElement *firstPtr, SortElement *second,
@@ -206,17 +185,17 @@ static const EnsembleImplMap defaultInfoMap[] = {
int
Tcl_IfObjCmd(
ClientData dummy, /* Not used. */
ClientData clientData,
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
return Tcl_NRCallObjProc(interp, TclNRIfObjCmd, dummy, objc, objv);
return Tcl_NRCallObjProc(interp, TclNRIfObjCmd, clientData, objc, objv);
}
int
TclNRIfObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -251,9 +230,9 @@ IfConditionCallback(
{
Interp *iPtr = (Interp *) interp;
int objc = PTR2INT(data[0]);
Tcl_Obj *const *objv = data[1];
Tcl_Obj *const *objv = (Tcl_Obj *const *)data[1];
int i = PTR2INT(data[2]);
Tcl_Obj *boolObj = data[3];
Tcl_Obj *boolObj = (Tcl_Obj *)data[3];
int value, thenScriptIndex = 0;
const char *clause;
@@ -389,7 +368,7 @@ IfConditionCallback(
int
Tcl_IncrObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -470,7 +449,7 @@ TclInitInfoCmd(
static int
InfoArgsCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -533,7 +512,7 @@ InfoArgsCmd(
static int
InfoBodyCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -594,7 +573,7 @@ InfoBodyCmd(
static int
InfoCmdCountCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -636,7 +615,7 @@ InfoCmdCountCmd(
static int
InfoCommandsCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -711,11 +690,11 @@ InfoCommandsCmd(
entryPtr = Tcl_FindHashEntry(&nsPtr->cmdTable, simplePattern);
if (entryPtr != NULL) {
if (specificNsInPattern) {
cmd = Tcl_GetHashValue(entryPtr);
cmd = (Tcl_Command)Tcl_GetHashValue(entryPtr);
elemObjPtr = Tcl_NewObj();
Tcl_GetCommandFullName(interp, cmd, elemObjPtr);
} else {
cmdName = Tcl_GetHashKey(&nsPtr->cmdTable, entryPtr);
cmdName = (const char *)Tcl_GetHashKey(&nsPtr->cmdTable, entryPtr);
elemObjPtr = Tcl_NewStringObj(cmdName, -1);
}
Tcl_ListObjAppendElement(interp, listPtr, elemObjPtr);
@@ -742,7 +721,7 @@ InfoCommandsCmd(
entryPtr = Tcl_FindHashEntry(tablePtr, simplePattern);
}
if (entryPtr != NULL) {
cmdName = Tcl_GetHashKey(tablePtr, entryPtr);
cmdName = (const char *)Tcl_GetHashKey(tablePtr, entryPtr);
Tcl_ListObjAppendElement(interp, listPtr,
Tcl_NewStringObj(cmdName, -1));
Tcl_SetObjResult(interp, listPtr);
@@ -758,11 +737,11 @@ InfoCommandsCmd(
entryPtr = Tcl_FirstHashEntry(&nsPtr->cmdTable, &search);
while (entryPtr != NULL) {
cmdName = Tcl_GetHashKey(&nsPtr->cmdTable, entryPtr);
cmdName = (const char *)Tcl_GetHashKey(&nsPtr->cmdTable, entryPtr);
if ((simplePattern == NULL)
|| Tcl_StringMatch(cmdName, simplePattern)) {
if (specificNsInPattern) {
cmd = Tcl_GetHashValue(entryPtr);
cmd = (Tcl_Command)Tcl_GetHashValue(entryPtr);
elemObjPtr = Tcl_NewObj();
Tcl_GetCommandFullName(interp, cmd, elemObjPtr);
} else {
@@ -784,7 +763,7 @@ InfoCommandsCmd(
if ((nsPtr != globalNsPtr) && !specificNsInPattern) {
entryPtr = Tcl_FirstHashEntry(&globalNsPtr->cmdTable, &search);
while (entryPtr != NULL) {
cmdName = Tcl_GetHashKey(&globalNsPtr->cmdTable, entryPtr);
cmdName = (const char *)Tcl_GetHashKey(&globalNsPtr->cmdTable, entryPtr);
if ((simplePattern == NULL)
|| Tcl_StringMatch(cmdName, simplePattern)) {
if (Tcl_FindHashEntry(&nsPtr->cmdTable,cmdName) == NULL) {
@@ -815,7 +794,7 @@ InfoCommandsCmd(
entryPtr = Tcl_FirstHashEntry(&nsPtr->cmdTable, &search);
while (entryPtr != NULL) {
cmdName = Tcl_GetHashKey(&nsPtr->cmdTable, entryPtr);
cmdName = (const char *)Tcl_GetHashKey(&nsPtr->cmdTable, entryPtr);
if ((simplePattern == NULL)
|| Tcl_StringMatch(cmdName, simplePattern)) {
elemObjPtr = Tcl_NewStringObj(cmdName, -1);
@@ -841,7 +820,7 @@ InfoCommandsCmd(
}
entryPtr = Tcl_FirstHashEntry(&pathNsPtr->cmdTable, &search);
while (entryPtr != NULL) {
cmdName = Tcl_GetHashKey(&pathNsPtr->cmdTable, entryPtr);
cmdName = (const char *)Tcl_GetHashKey(&pathNsPtr->cmdTable, entryPtr);
if ((simplePattern == NULL)
|| Tcl_StringMatch(cmdName, simplePattern)) {
elemObjPtr = Tcl_NewStringObj(cmdName, -1);
@@ -868,7 +847,7 @@ InfoCommandsCmd(
if (!foundGlobal) {
entryPtr = Tcl_FirstHashEntry(&globalNsPtr->cmdTable, &search);
while (entryPtr != NULL) {
cmdName = Tcl_GetHashKey(&globalNsPtr->cmdTable, entryPtr);
cmdName = (const char *)Tcl_GetHashKey(&globalNsPtr->cmdTable, entryPtr);
if ((simplePattern == NULL)
|| Tcl_StringMatch(cmdName, simplePattern)) {
elemObjPtr = Tcl_NewStringObj(cmdName, -1);
@@ -913,7 +892,7 @@ InfoCommandsCmd(
static int
InfoCompleteCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -950,7 +929,7 @@ InfoCompleteCmd(
static int
InfoDefaultCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1032,7 +1011,7 @@ InfoDefaultCmd(
static int
InfoErrorStackCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1081,7 +1060,7 @@ InfoErrorStackCmd(
int
TclInfoExistsCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1126,7 +1105,7 @@ TclInfoExistsCmd(
static int
InfoFrameCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1313,7 +1292,7 @@ TclInfoFrame(
* Execution of bytecode. Talk to the BC engine to fill out the frame.
*/
CmdFrame *fPtr = TclStackAlloc(interp, sizeof(CmdFrame));
CmdFrame *fPtr = (CmdFrame *)TclStackAlloc(interp, sizeof(CmdFrame));
*fPtr = *framePtr;
@@ -1395,7 +1374,7 @@ TclInfoFrame(
procNameObj);
ADD_PAIR("proc", procNameObj);
} else if (procPtr->cmdPtr->clientData) {
ExtraFrameInfo *efiPtr = procPtr->cmdPtr->clientData;
ExtraFrameInfo *efiPtr = (ExtraFrameInfo *)procPtr->cmdPtr->clientData;
int i;
/*
@@ -1409,7 +1388,7 @@ TclInfoFrame(
lv[lc++] =
efiPtr->fields[i].proc(efiPtr->fields[i].clientData);
} else {
lv[lc++] = efiPtr->fields[i].clientData;
lv[lc++] = (Tcl_Obj *)efiPtr->fields[i].clientData;
}
}
}
@@ -1466,7 +1445,7 @@ TclInfoFrame(
static int
InfoFunctionsCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1531,7 +1510,7 @@ InfoFunctionsCmd(
static int
InfoHostnameCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1577,7 +1556,7 @@ InfoHostnameCmd(
static int
InfoLevelCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1651,7 +1630,7 @@ InfoLevelCmd(
static int
InfoLibraryCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1698,7 +1677,7 @@ InfoLibraryCmd(
static int
InfoLoadedCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1746,7 +1725,7 @@ InfoLoadedCmd(
static int
InfoNameOfExecutableCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1782,7 +1761,7 @@ InfoNameOfExecutableCmd(
static int
InfoPatchLevelCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1829,7 +1808,7 @@ InfoPatchLevelCmd(
static int
InfoProcsCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1895,7 +1874,7 @@ InfoProcsCmd(
if (simplePattern != NULL && TclMatchIsTrivial(simplePattern)) {
entryPtr = Tcl_FindHashEntry(&nsPtr->cmdTable, simplePattern);
if (entryPtr != NULL) {
cmdPtr = Tcl_GetHashValue(entryPtr);
cmdPtr = (Command *)Tcl_GetHashValue(entryPtr);
if (!TclIsProc(cmdPtr)) {
realCmdPtr = (Command *)
@@ -1920,10 +1899,10 @@ InfoProcsCmd(
{
entryPtr = Tcl_FirstHashEntry(&nsPtr->cmdTable, &search);
while (entryPtr != NULL) {
cmdName = Tcl_GetHashKey(&nsPtr->cmdTable, entryPtr);
cmdName = (const char *)Tcl_GetHashKey(&nsPtr->cmdTable, entryPtr);
if ((simplePattern == NULL)
|| Tcl_StringMatch(cmdName, simplePattern)) {
cmdPtr = Tcl_GetHashValue(entryPtr);
cmdPtr = (Command *)Tcl_GetHashValue(entryPtr);
if (!TclIsProc(cmdPtr)) {
realCmdPtr = (Command *)
@@ -1966,11 +1945,11 @@ InfoProcsCmd(
if ((nsPtr != globalNsPtr) && !specificNsInPattern) {
entryPtr = Tcl_FirstHashEntry(&globalNsPtr->cmdTable, &search);
while (entryPtr != NULL) {
cmdName = Tcl_GetHashKey(&globalNsPtr->cmdTable, entryPtr);
cmdName = (const char *)Tcl_GetHashKey(&globalNsPtr->cmdTable, entryPtr);
if ((simplePattern == NULL)
|| Tcl_StringMatch(cmdName, simplePattern)) {
if (Tcl_FindHashEntry(&nsPtr->cmdTable,cmdName) == NULL) {
cmdPtr = Tcl_GetHashValue(entryPtr);
cmdPtr = (Command *)Tcl_GetHashValue(entryPtr);
realCmdPtr = (Command *) TclGetOriginalCommand(
(Tcl_Command) cmdPtr);
@@ -2016,12 +1995,13 @@ InfoProcsCmd(
static int
InfoScriptCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Interp *iPtr = (Interp *) interp;
if ((objc != 1) && (objc != 2)) {
Tcl_WrongNumArgs(interp, 1, objv, "?filename?");
return TCL_ERROR;
@@ -2063,7 +2043,7 @@ InfoScriptCmd(
static int
InfoSharedlibCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -2101,7 +2081,7 @@ InfoSharedlibCmd(
static int
InfoTclVersionCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -2144,7 +2124,7 @@ InfoTclVersionCmd(
static int
InfoCmdTypeCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -2195,7 +2175,7 @@ InfoCmdTypeCmd(
int
Tcl_JoinObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* The argument objects. */
@@ -2280,7 +2260,7 @@ Tcl_JoinObjCmd(
int
Tcl_LassignObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -2354,12 +2334,11 @@ Tcl_LassignObjCmd(
int
Tcl_LindexObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tcl_Obj *elemPtr; /* Pointer to the element being extracted. */
if (objc < 2) {
@@ -2413,7 +2392,7 @@ Tcl_LindexObjCmd(
int
Tcl_LinsertObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -2495,7 +2474,7 @@ Tcl_LinsertObjCmd(
int
Tcl_ListObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[])
@@ -2531,7 +2510,7 @@ Tcl_ListObjCmd(
int
Tcl_LlengthObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[])
@@ -2577,7 +2556,7 @@ Tcl_LlengthObjCmd(
int
Tcl_LpopObjCmd(
ClientData notUsed, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[])
@@ -2608,6 +2587,14 @@ Tcl_LpopObjCmd(
*/
if (objc == 2) {
if (!listLen) {
/* empty list, throw the same error as with index "end" */
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"index \"end\" out of range", -1));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "INDEX"
"OUTOFRANGE", NULL);
return TCL_ERROR;
}
elemPtr = elemPtrs[listLen - 1];
Tcl_IncrRefCount(elemPtr);
} else {
@@ -2670,7 +2657,7 @@ Tcl_LpopObjCmd(
int
Tcl_LrangeObjCmd(
ClientData notUsed, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[])
@@ -2738,7 +2725,7 @@ LremoveIndexCompare(
int
Tcl_LremoveObjCmd(
ClientData notUsed, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -2766,7 +2753,7 @@ Tcl_LremoveObjCmd(
Tcl_SetObjResult(interp, listObj);
return TCL_OK;
}
idxv = ckalloc((objc - 2) * sizeof(int));
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) {
@@ -2857,7 +2844,7 @@ Tcl_LremoveObjCmd(
int
Tcl_LrepeatObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[])
@@ -2966,7 +2953,7 @@ Tcl_LrepeatObjCmd(
int
Tcl_LreplaceObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -3067,7 +3054,7 @@ Tcl_LreplaceObjCmd(
int
Tcl_LreverseObjCmd(
ClientData clientData, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument values. */
@@ -3146,7 +3133,7 @@ Tcl_LreverseObjCmd(
int
Tcl_LsearchObjCmd(
ClientData clientData, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument values. */
@@ -3362,7 +3349,7 @@ Tcl_LsearchObjCmd(
sortInfo.indexv = &sortInfo.singleIndex;
break;
default:
sortInfo.indexv =
sortInfo.indexv = (int *)
TclStackAlloc(interp, sizeof(int) * sortInfo.indexc);
allocatedIndexVector = 1; /* Cannot use indexc field, as it
* might be decreased by 1 later. */
@@ -3382,8 +3369,8 @@ Tcl_LsearchObjCmd(
}
if (encoded == (int)TCL_INDEX_NONE) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"index \"%s\" cannot select an element "
"from any list", TclGetString(indices[j])));
"index \"%s\" out of range",
TclGetString(indices[j])));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "INDEX"
"OUTOFRANGE", NULL);
result = TCL_ERROR;
@@ -3898,7 +3885,7 @@ Tcl_LsearchObjCmd(
int
Tcl_LsetObjCmd(
ClientData clientData, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument values. */
@@ -3983,7 +3970,7 @@ Tcl_LsetObjCmd(
int
Tcl_LsortObjCmd(
ClientData clientData, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument values. */
@@ -3992,9 +3979,11 @@ Tcl_LsortObjCmd(
int sortMode = SORTMODE_ASCII;
int group, groupSize, groupOffset, idx, allocatedIndexVector = 0;
Tcl_Obj *resultPtr, *cmdPtr, **listObjPtrs, *listObj, *indexPtr;
size_t elmArrSize;
SortElement *elementArray = NULL, *elementPtr;
SortInfo sortInfo; /* Information about this sort that needs to
* be passed to the comparison function. */
# define MAXCALLOC 1024000
# define NUM_LISTS 30
SortElement *subList[NUM_LISTS+1];
/* This array holds pointers to temporary
@@ -4067,7 +4056,7 @@ Tcl_LsortObjCmd(
sortInfo.isIncreasing = 1;
break;
case LSORT_INDEX: {
int indexc;
int sortindex;
Tcl_Obj **indexv;
if (i == objc-2) {
@@ -4078,7 +4067,7 @@ Tcl_LsortObjCmd(
sortInfo.resultCode = TCL_ERROR;
goto done;
}
if (TclListObjGetElements(interp, objv[i+1], &indexc,
if (TclListObjGetElements(interp, objv[i+1], &sortindex,
&indexv) != TCL_OK) {
sortInfo.resultCode = TCL_ERROR;
goto done;
@@ -4092,15 +4081,15 @@ Tcl_LsortObjCmd(
* options is done.
*/
for (j=0 ; j<indexc ; j++) {
for (j=0 ; j<sortindex ; j++) {
int encoded = 0;
int result = TclIndexEncode(interp, indexv[j],
TCL_INDEX_NONE, TCL_INDEX_NONE, &encoded);
if ((result == TCL_OK) && (encoded == (int)TCL_INDEX_NONE)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"index \"%s\" cannot select an element "
"from any list", TclGetString(indexv[j])));
"index \"%s\" out of range",
TclGetString(indexv[j])));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "INDEX"
"OUTOFRANGE", NULL);
result = TCL_ERROR;
@@ -4179,7 +4168,7 @@ Tcl_LsortObjCmd(
sortInfo.indexv = &sortInfo.singleIndex;
break;
default:
sortInfo.indexv =
sortInfo.indexv = (int *)
TclStackAlloc(interp, sizeof(int) * sortInfo.indexc);
allocatedIndexVector = 1; /* Cannot use indexc field, as it
* might be decreased by 1 later. */
@@ -4317,7 +4306,19 @@ Tcl_LsortObjCmd(
* begins sorting it into the sublists as it appears.
*/
elementArray = ckalloc(length * sizeof(SortElement));
elmArrSize = length * sizeof(SortElement);
if (elmArrSize <= MAXCALLOC) {
elementArray = (SortElement *)ckalloc(elmArrSize);
} else {
elementArray = (SortElement *)malloc(elmArrSize);
}
if (!elementArray) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"no enough memory to proccess sort of %d items", length));
Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL);
sortInfo.resultCode = TCL_ERROR;
goto done;
}
for (i=0; i < length; i++) {
idx = groupSize * i + groupOffset;
@@ -4450,7 +4451,11 @@ Tcl_LsortObjCmd(
TclStackFree(interp, sortInfo.indexv);
}
if (elementArray) {
ckfree(elementArray);
if (elmArrSize <= MAXCALLOC) {
ckfree((char *)elementArray);
} else {
free((char *)elementArray);
}
}
return sortInfo.resultCode;
}
+82 -84
View File
@@ -82,7 +82,7 @@ const char tclDefaultTrimSet[] =
int
Tcl_PwdObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -122,7 +122,7 @@ Tcl_PwdObjCmd(
int
Tcl_RegexpObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -482,7 +482,7 @@ Tcl_RegexpObjCmd(
int
Tcl_RegsubObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -778,7 +778,7 @@ Tcl_RegsubObjCmd(
Tcl_ListObjGetElements(interp, subPtr, &numParts, &parts);
numArgs = numParts + info.nsubs + 1;
args = ckalloc(sizeof(Tcl_Obj*) * numArgs);
args = (Tcl_Obj **)ckalloc(sizeof(Tcl_Obj*) * numArgs);
memcpy(args, parts, sizeof(Tcl_Obj*) * numParts);
for (idx = 0 ; idx <= info.nsubs ; idx++) {
@@ -1002,7 +1002,7 @@ Tcl_RegsubObjCmd(
int
Tcl_RenameObjCmd(
ClientData dummy, /* Arbitrary value passed to the command. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1038,7 +1038,7 @@ Tcl_RenameObjCmd(
int
Tcl_ReturnObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1085,17 +1085,17 @@ Tcl_ReturnObjCmd(
int
Tcl_SourceObjCmd(
ClientData dummy, /* Not used. */
ClientData clientData,
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
return Tcl_NRCallObjProc(interp, TclNRSourceObjCmd, dummy, objc, objv);
return Tcl_NRCallObjProc(interp, TclNRSourceObjCmd, clientData, objc, objv);
}
int
TclNRSourceObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1136,7 +1136,7 @@ TclNRSourceObjCmd(
"option", TCL_EXACT, &index)) {
return TCL_ERROR;
}
pkgFiles = Tcl_GetAssocData(interp, "tclPkgFiles", NULL);
pkgFiles = (void **)Tcl_GetAssocData(interp, "tclPkgFiles", NULL);
/* Make sure that during the following TclNREvalFile no filenames
* are recorded for inclusion in the "package files" command */
names = *pkgFiles;
@@ -1169,7 +1169,7 @@ TclNRSourceObjCmd(
int
Tcl_SplitObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1221,10 +1221,10 @@ Tcl_SplitObjCmd(
len = TclUtfToUniChar(stringPtr, &ch);
fullchar = ch;
#if TCL_UTF_MAX <= 4
#if TCL_UTF_MAX <= 3
if ((ch >= 0xD800) && (len < 3)) {
len += TclUtfToUniChar(stringPtr + len, &ch);
fullchar = (((fullchar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000;
fullchar = (((fullchar & 0x3FF) << 10) | (ch & 0x3FF)) + 0x10000;
}
#endif
@@ -1243,14 +1243,14 @@ Tcl_SplitObjCmd(
Tcl_SetHashValue(hPtr, objPtr);
} else {
objPtr = Tcl_GetHashValue(hPtr);
objPtr = (Tcl_Obj *)Tcl_GetHashValue(hPtr);
}
Tcl_ListObjAppendElement(NULL, listPtr, objPtr);
}
Tcl_DeleteHashTable(&charReuseTable);
} else if (splitCharLen == 1) {
char *p;
const char *p;
/*
* Handle the special case of splitting on a single character. This is
@@ -1317,7 +1317,7 @@ Tcl_SplitObjCmd(
static int
StringFirstCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1337,8 +1337,7 @@ StringFirstCmd(
return TCL_ERROR;
}
}
Tcl_SetObjResult(interp, Tcl_NewWideIntObj(TclStringFirst(objv[1],
objv[2], start)));
Tcl_SetObjResult(interp, TclStringFirst(objv[1], objv[2], start));
return TCL_OK;
}
@@ -1362,7 +1361,7 @@ StringFirstCmd(
static int
StringLastCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1382,8 +1381,7 @@ StringLastCmd(
return TCL_ERROR;
}
}
Tcl_SetObjResult(interp, Tcl_NewWideIntObj(TclStringLast(objv[1],
objv[2], last)));
Tcl_SetObjResult(interp, TclStringLast(objv[1], objv[2], last));
return TCL_OK;
}
@@ -1407,7 +1405,7 @@ StringLastCmd(
static int
StringIndexCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1477,7 +1475,7 @@ StringIndexCmd(
static int
StringInsertCmd(
ClientData dummy, /* Not used */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter */
int objc, /* Number of arguments */
Tcl_Obj *const objv[]) /* Argument objects */
@@ -1534,7 +1532,7 @@ StringInsertCmd(
static int
StringIsCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1911,10 +1909,10 @@ StringIsCmd(
int fullchar;
length2 = TclUtfToUniChar(string1, &ch);
fullchar = ch;
#if TCL_UTF_MAX <= 4
#if TCL_UTF_MAX <= 3
if ((ch >= 0xD800) && (length2 < 3)) {
length2 += TclUtfToUniChar(string1 + length2, &ch);
fullchar = (((fullchar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000;
fullchar = (((fullchar & 0x3FF) << 10) | (ch & 0x3FF)) + 0x10000;
}
#endif
if (!chcomp(fullchar)) {
@@ -1973,7 +1971,7 @@ UniCharIsHexDigit(
static int
StringMapCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -2037,7 +2035,7 @@ StringMapCmd(
* adapt this code...
*/
mapElemv = TclStackAlloc(interp, sizeof(Tcl_Obj *) * mapElemc);
mapElemv = (Tcl_Obj **)TclStackAlloc(interp, sizeof(Tcl_Obj *) * mapElemc);
Tcl_DictObjFirst(interp, objv[objc-2], &search, mapElemv+0,
mapElemv+1, &done);
for (i=2 ; i<mapElemc ; i+=2) {
@@ -2148,10 +2146,10 @@ StringMapCmd(
* case.
*/
mapStrings = TclStackAlloc(interp, mapElemc*2*sizeof(Tcl_UniChar *));
mapLens = TclStackAlloc(interp, mapElemc * 2 * sizeof(int));
mapStrings = (Tcl_UniChar **)TclStackAlloc(interp, mapElemc*2*sizeof(Tcl_UniChar *));
mapLens = (int *)TclStackAlloc(interp, mapElemc * 2 * sizeof(int));
if (nocase) {
u2lc = TclStackAlloc(interp, mapElemc * sizeof(int));
u2lc = (int *)TclStackAlloc(interp, mapElemc * sizeof(int));
}
for (index = 0; index < mapElemc; index++) {
mapStrings[index] = Tcl_GetUnicodeFromObj(mapElemv[index],
@@ -2244,7 +2242,7 @@ StringMapCmd(
static int
StringMatchCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -2296,7 +2294,7 @@ StringMatchCmd(
static int
StringRangeCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -2352,7 +2350,7 @@ StringRangeCmd(
static int
StringReptCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -2408,7 +2406,7 @@ StringReptCmd(
static int
StringRplcCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -2484,7 +2482,7 @@ StringRplcCmd(
static int
StringRevCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -2519,7 +2517,7 @@ StringRevCmd(
static int
StringStartCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -2580,7 +2578,7 @@ StringStartCmd(
static int
StringEndCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -2642,7 +2640,7 @@ StringEndCmd(
static int
StringEqualCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -2717,7 +2715,7 @@ StringEqualCmd(
static int
StringCmpCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -2805,7 +2803,7 @@ TclStringCmpOpts(
static int
StringCatCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -2850,7 +2848,7 @@ StringCatCmd(
*/
static int
StringBytesCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -2887,7 +2885,7 @@ StringBytesCmd(
static int
StringLenCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -2921,7 +2919,7 @@ StringLenCmd(
static int
StringLowerCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -3006,7 +3004,7 @@ StringLowerCmd(
static int
StringUpperCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -3091,7 +3089,7 @@ StringUpperCmd(
static int
StringTitleCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -3176,7 +3174,7 @@ StringTitleCmd(
static int
StringTrimCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -3223,7 +3221,7 @@ StringTrimCmd(
static int
StringTrimLCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -3269,7 +3267,7 @@ StringTrimLCmd(
static int
StringTrimRCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -3412,17 +3410,17 @@ TclSubstOptions(
int
Tcl_SubstObjCmd(
ClientData dummy, /* Not used. */
ClientData clientData,
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
return Tcl_NRCallObjProc(interp, TclNRSubstObjCmd, dummy, objc, objv);
return Tcl_NRCallObjProc(interp, TclNRSubstObjCmd, clientData, objc, objv);
}
int
TclNRSubstObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -3460,16 +3458,16 @@ TclNRSubstObjCmd(
int
Tcl_SwitchObjCmd(
ClientData dummy, /* Not used. */
ClientData clientData,
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
return Tcl_NRCallObjProc(interp, TclNRSwitchObjCmd, dummy, objc, objv);
return Tcl_NRCallObjProc(interp, TclNRSwitchObjCmd, clientData, objc, objv);
}
int
TclNRSwitchObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -3852,7 +3850,7 @@ TclNRSwitchObjCmd(
*/
matchFound:
ctxPtr = TclStackAlloc(interp, sizeof(CmdFrame));
ctxPtr = (CmdFrame *)TclStackAlloc(interp, sizeof(CmdFrame));
*ctxPtr = *iPtr->cmdFramePtr;
if (splitObjs) {
@@ -3882,7 +3880,7 @@ TclNRSwitchObjCmd(
if (ctxPtr->type == TCL_LOCATION_SOURCE && ctxPtr->line[bidx] >= 0) {
int bline = ctxPtr->line[bidx];
ctxPtr->line = ckalloc(objc * sizeof(int));
ctxPtr->line = (int *)ckalloc(objc * sizeof(int));
ctxPtr->nline = objc;
TclListLines(blist, bline, objc, ctxPtr->line, objv);
} else {
@@ -3896,7 +3894,7 @@ TclNRSwitchObjCmd(
int k;
ctxPtr->line = ckalloc(objc * sizeof(int));
ctxPtr->line = (int *)ckalloc(objc * sizeof(int));
ctxPtr->nline = objc;
for (k=0; k < objc; k++) {
ctxPtr->line[k] = -1;
@@ -3936,9 +3934,9 @@ SwitchPostProc(
/* Unpack the preserved data */
int splitObjs = PTR2INT(data[0]);
CmdFrame *ctxPtr = data[1];
CmdFrame *ctxPtr = (CmdFrame *)data[1];
int pc = PTR2INT(data[2]);
const char *pattern = data[3];
const char *pattern = (const char *)data[3];
int patternLength = strlen(pattern);
/*
@@ -3990,10 +3988,9 @@ SwitchPostProc(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_ThrowObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -4055,7 +4052,7 @@ Tcl_ThrowObjCmd(
int
Tcl_TimeObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -4153,7 +4150,7 @@ Tcl_TimeObjCmd(
int
Tcl_TimeRateObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -4696,17 +4693,17 @@ Tcl_TimeRateObjCmd(
int
Tcl_TryObjCmd(
ClientData dummy, /* Not used. */
ClientData clientData,
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
return Tcl_NRCallObjProc(interp, TclNRTryObjCmd, dummy, objc, objv);
return Tcl_NRCallObjProc(interp, TclNRTryObjCmd, clientData, objc, objv);
}
int
TclNRTryObjCmd(
ClientData clientData, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -4909,12 +4906,12 @@ TryPostBody(
int result)
{
Tcl_Obj *resultObj, *options, *handlersObj, *finallyObj, *cmdObj, **objv;
int i, dummy, code, objc;
int i, code, objc;
int numHandlers = 0;
handlersObj = data[0];
finallyObj = data[1];
objv = data[2];
handlersObj = (Tcl_Obj *)data[0];
finallyObj = (Tcl_Obj *)data[1];
objv = (Tcl_Obj **)data[2];
objc = PTR2INT(data[3]);
cmdObj = objv[0];
@@ -4960,8 +4957,9 @@ TryPostBody(
Tcl_ListObjGetElements(NULL, handlersObj, &numHandlers, &handlers);
for (i=0 ; i<numHandlers ; i++) {
Tcl_Obj *handlerBodyObj;
int numElems = 0;
Tcl_ListObjGetElements(NULL, handlers[i], &dummy, &info);
Tcl_ListObjGetElements(NULL, handlers[i], &numElems, &info);
if (!found) {
Tcl_GetIntFromObj(NULL, info[1], &code);
if (code != result) {
@@ -5023,8 +5021,8 @@ TryPostBody(
Tcl_ResetResult(interp);
result = TCL_ERROR;
Tcl_ListObjLength(NULL, info[3], &dummy);
if (dummy > 0) {
Tcl_ListObjLength(NULL, info[3], &numElems);
if (numElems> 0) {
Tcl_Obj *varName;
Tcl_ListObjIndex(NULL, info[3], 0, &varName);
@@ -5034,7 +5032,7 @@ TryPostBody(
goto handlerFailed;
}
Tcl_DecrRefCount(resultObj);
if (dummy > 1) {
if (numElems> 1) {
Tcl_ListObjIndex(NULL, info[3], 1, &varName);
if (Tcl_ObjSetVar2(interp, varName, NULL, options,
TCL_LEAVE_ERR_MSG) == NULL) {
@@ -5127,9 +5125,9 @@ TryPostHandler(
Tcl_Obj *finallyObj;
int finally;
objv = data[0];
options = data[1];
handlerKindObj = data[2];
objv = (Tcl_Obj **)data[0];
options = (Tcl_Obj *)data[1];
handlerKindObj = (Tcl_Obj *)data[2];
finally = PTR2INT(data[3]);
cmdObj = objv[0];
@@ -5211,9 +5209,9 @@ TryPostFinal(
{
Tcl_Obj *resultObj, *options, *cmdObj;
resultObj = data[0];
options = data[1];
cmdObj = data[2];
resultObj = (Tcl_Obj *)data[0];
options = (Tcl_Obj *)data[1];
cmdObj = (Tcl_Obj *)data[2];
/*
* If the result wasn't OK, we need to adjust the result options.
@@ -5272,17 +5270,17 @@ TryPostFinal(
int
Tcl_WhileObjCmd(
ClientData dummy, /* Not used. */
ClientData clientData,
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
return Tcl_NRCallObjProc(interp, TclNRWhileObjCmd, dummy, objc, objv);
return Tcl_NRCallObjProc(interp, TclNRWhileObjCmd, clientData, objc, objv);
}
int
TclNRWhileObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
+63 -90
View File
@@ -21,28 +21,16 @@
* Prototypes for procedures defined later in this file:
*/
static ClientData DupDictUpdateInfo(ClientData clientData);
static void FreeDictUpdateInfo(ClientData clientData);
static void PrintDictUpdateInfo(ClientData clientData,
Tcl_Obj *appendObj, ByteCode *codePtr,
unsigned int pcOffset);
static void DisassembleDictUpdateInfo(ClientData clientData,
Tcl_Obj *dictObj, ByteCode *codePtr,
unsigned int pcOffset);
static ClientData DupForeachInfo(ClientData clientData);
static void FreeForeachInfo(ClientData clientData);
static void PrintForeachInfo(ClientData clientData,
Tcl_Obj *appendObj, ByteCode *codePtr,
unsigned int pcOffset);
static void DisassembleForeachInfo(ClientData clientData,
Tcl_Obj *dictObj, ByteCode *codePtr,
unsigned int pcOffset);
static void PrintNewForeachInfo(ClientData clientData,
Tcl_Obj *appendObj, ByteCode *codePtr,
unsigned int pcOffset);
static void DisassembleNewForeachInfo(ClientData clientData,
Tcl_Obj *dictObj, ByteCode *codePtr,
unsigned int pcOffset);
static AuxDataDupProc DupDictUpdateInfo;
static AuxDataFreeProc FreeDictUpdateInfo;
static AuxDataPrintProc PrintDictUpdateInfo;
static AuxDataPrintProc DisassembleDictUpdateInfo;
static AuxDataDupProc DupForeachInfo;
static AuxDataFreeProc FreeForeachInfo;
static AuxDataPrintProc PrintForeachInfo;
static AuxDataPrintProc DisassembleForeachInfo;
static AuxDataPrintProc PrintNewForeachInfo;
static AuxDataPrintProc DisassembleNewForeachInfo;
static int CompileEachloopCmd(Tcl_Interp *interp,
Tcl_Parse *parsePtr, Command *cmdPtr,
CompileEnv *envPtr, int collect);
@@ -260,8 +248,7 @@ TclCompileArrayExistsCmd(
Tcl_Interp *interp, /* Used for looking up stuff. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
@@ -403,9 +390,9 @@ TclCompileArraySetCmd(
keyVar = AnonymousLocal(envPtr);
valVar = AnonymousLocal(envPtr);
infoPtr = ckalloc(sizeof(ForeachInfo));
infoPtr = (ForeachInfo *)ckalloc(sizeof(ForeachInfo));
infoPtr->numLists = 1;
infoPtr->varLists[0] = ckalloc(sizeof(ForeachVarList) + sizeof(int));
infoPtr->varLists[0] = (ForeachVarList *)ckalloc(sizeof(ForeachVarList) + sizeof(int));
infoPtr->varLists[0]->numVars = 2;
infoPtr->varLists[0]->varIndexes[0] = keyVar;
infoPtr->varLists[0]->varIndexes[1] = valVar;
@@ -522,11 +509,10 @@ TclCompileArrayUnsetCmd(
int
TclCompileBreakCmd(
Tcl_Interp *interp, /* Used for error reporting. */
TCL_UNUSED(Tcl_Interp *),
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
ExceptionRange *rangePtr;
@@ -583,8 +569,7 @@ TclCompileCatchCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
JumpFixup jumpFixup;
@@ -765,11 +750,10 @@ TclCompileCatchCmd(
int
TclCompileClockClicksCmd(
Tcl_Interp* interp, /* Tcl interpreter */
TCL_UNUSED(Tcl_Interp *),
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token* tokenPtr;
@@ -829,7 +813,7 @@ TclCompileClockClicksCmd(
int
TclCompileClockReadingCmd(
Tcl_Interp* interp, /* Tcl interpreter */
TCL_UNUSED(Tcl_Interp *),
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
@@ -868,8 +852,7 @@ TclCompileConcatCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
@@ -952,11 +935,10 @@ TclCompileConcatCmd(
int
TclCompileContinueCmd(
Tcl_Interp *interp, /* Used for error reporting. */
TCL_UNUSED(Tcl_Interp *),
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
ExceptionRange *rangePtr;
@@ -1018,8 +1000,7 @@ TclCompileDictSetCmd(
Tcl_Interp *interp, /* Used for looking up stuff. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr;
@@ -1144,8 +1125,7 @@ TclCompileDictGetCmd(
Tcl_Interp *interp, /* Used for looking up stuff. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr;
@@ -1181,8 +1161,7 @@ TclCompileDictGetWithDefaultCmd(
Tcl_Interp *interp, /* Used for looking up stuff. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr;
@@ -1213,8 +1192,7 @@ TclCompileDictExistsCmd(
Tcl_Interp *interp, /* Used for looking up stuff. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr;
@@ -1811,9 +1789,9 @@ TclCompileDictUpdateCmd(
* that are to be used.
*/
duiPtr = ckalloc(sizeof(DictUpdateInfo) + sizeof(int) * (numVars - 1));
duiPtr = (DictUpdateInfo *)ckalloc(sizeof(DictUpdateInfo) + sizeof(int) * (numVars - 1));
duiPtr->length = numVars;
keyTokenPtrs = TclStackAlloc(interp, sizeof(Tcl_Token *) * numVars);
keyTokenPtrs = (Tcl_Token **)TclStackAlloc(interp, sizeof(Tcl_Token *) * numVars);
tokenPtr = TokenAfter(dictVarTokenPtr);
for (i=0 ; i<numVars ; i++) {
@@ -2290,11 +2268,11 @@ DupDictUpdateInfo(
ClientData clientData)
{
DictUpdateInfo *dui1Ptr, *dui2Ptr;
unsigned len;
size_t len;
dui1Ptr = clientData;
dui1Ptr = (DictUpdateInfo *)clientData;
len = sizeof(DictUpdateInfo) + sizeof(int) * (dui1Ptr->length - 1);
dui2Ptr = ckalloc(len);
dui2Ptr = (DictUpdateInfo *)ckalloc(len);
memcpy(dui2Ptr, dui1Ptr, len);
return dui2Ptr;
}
@@ -2310,10 +2288,10 @@ static void
PrintDictUpdateInfo(
ClientData clientData,
Tcl_Obj *appendObj,
ByteCode *codePtr,
unsigned int pcOffset)
TCL_UNUSED(ByteCode *),
TCL_UNUSED(unsigned int))
{
DictUpdateInfo *duiPtr = clientData;
DictUpdateInfo *duiPtr = (DictUpdateInfo *)clientData;
int i;
for (i=0 ; i<duiPtr->length ; i++) {
@@ -2328,10 +2306,10 @@ static void
DisassembleDictUpdateInfo(
ClientData clientData,
Tcl_Obj *dictObj,
ByteCode *codePtr,
unsigned int pcOffset)
TCL_UNUSED(ByteCode *),
TCL_UNUSED(unsigned int))
{
DictUpdateInfo *duiPtr = clientData;
DictUpdateInfo *duiPtr = (DictUpdateInfo *)clientData;
int i;
Tcl_Obj *variables = Tcl_NewObj();
@@ -2366,8 +2344,7 @@ TclCompileErrorCmd(
Tcl_Interp *interp, /* Used for context. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
/*
@@ -2440,8 +2417,7 @@ TclCompileExprCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *firstWordPtr;
@@ -2485,8 +2461,7 @@ TclCompileForCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *startTokenPtr, *testTokenPtr, *nextTokenPtr, *bodyTokenPtr;
@@ -2696,8 +2671,7 @@ CompileEachloopCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr, /* Holds resulting instructions. */
int collect) /* Select collecting or accumulating mode
* (TCL_EACH_*) */
@@ -2747,7 +2721,7 @@ CompileEachloopCmd(
*/
numLists = (numWords - 2)/2;
infoPtr = ckalloc(sizeof(ForeachInfo)
infoPtr = (ForeachInfo *)ckalloc(sizeof(ForeachInfo)
+ (numLists - 1) * sizeof(ForeachVarList *));
infoPtr->numLists = 0; /* Count this up as we go */
@@ -2781,7 +2755,7 @@ CompileEachloopCmd(
goto done;
}
varListPtr = ckalloc(sizeof(ForeachVarList)
varListPtr = (ForeachVarList *)ckalloc(sizeof(ForeachVarList)
+ (numVars - 1) * sizeof(int));
varListPtr->numVars = numVars;
infoPtr->varLists[i/2] = varListPtr;
@@ -2912,12 +2886,12 @@ DupForeachInfo(
ClientData clientData) /* The foreach command's compilation auxiliary
* data to duplicate. */
{
ForeachInfo *srcPtr = clientData;
ForeachInfo *srcPtr = (ForeachInfo *)clientData;
ForeachInfo *dupPtr;
ForeachVarList *srcListPtr, *dupListPtr;
int numVars, i, j, numLists = srcPtr->numLists;
dupPtr = ckalloc(sizeof(ForeachInfo)
dupPtr = (ForeachInfo *)ckalloc(sizeof(ForeachInfo)
+ numLists * sizeof(ForeachVarList *));
dupPtr->numLists = numLists;
dupPtr->firstValueTemp = srcPtr->firstValueTemp;
@@ -2926,7 +2900,7 @@ DupForeachInfo(
for (i = 0; i < numLists; i++) {
srcListPtr = srcPtr->varLists[i];
numVars = srcListPtr->numVars;
dupListPtr = ckalloc(sizeof(ForeachVarList)
dupListPtr = (ForeachVarList *)ckalloc(sizeof(ForeachVarList)
+ numVars * sizeof(int));
dupListPtr->numVars = numVars;
for (j = 0; j < numVars; j++) {
@@ -2961,7 +2935,7 @@ FreeForeachInfo(
ClientData clientData) /* The foreach command's compilation auxiliary
* data to free. */
{
ForeachInfo *infoPtr = clientData;
ForeachInfo *infoPtr = (ForeachInfo *)clientData;
ForeachVarList *listPtr;
int numLists = infoPtr->numLists;
int i;
@@ -2994,10 +2968,10 @@ static void
PrintForeachInfo(
ClientData clientData,
Tcl_Obj *appendObj,
ByteCode *codePtr,
unsigned int pcOffset)
TCL_UNUSED(ByteCode *),
TCL_UNUSED(unsigned int))
{
ForeachInfo *infoPtr = clientData;
ForeachInfo *infoPtr = (ForeachInfo *)clientData;
ForeachVarList *varsPtr;
int i, j;
@@ -3034,10 +3008,10 @@ static void
PrintNewForeachInfo(
ClientData clientData,
Tcl_Obj *appendObj,
ByteCode *codePtr,
unsigned int pcOffset)
TCL_UNUSED(ByteCode *),
TCL_UNUSED(unsigned int))
{
ForeachInfo *infoPtr = clientData;
ForeachInfo *infoPtr = (ForeachInfo *)clientData;
ForeachVarList *varsPtr;
int i, j;
@@ -3064,10 +3038,10 @@ static void
DisassembleForeachInfo(
ClientData clientData,
Tcl_Obj *dictObj,
ByteCode *codePtr,
unsigned int pcOffset)
TCL_UNUSED(ByteCode *),
TCL_UNUSED(unsigned int))
{
ForeachInfo *infoPtr = clientData;
ForeachInfo *infoPtr = (ForeachInfo *)clientData;
ForeachVarList *varsPtr;
int i, j;
Tcl_Obj *objPtr, *innerPtr;
@@ -3111,10 +3085,10 @@ static void
DisassembleNewForeachInfo(
ClientData clientData,
Tcl_Obj *dictObj,
ByteCode *codePtr,
unsigned int pcOffset)
TCL_UNUSED(ByteCode *),
TCL_UNUSED(unsigned int))
{
ForeachInfo *infoPtr = clientData;
ForeachInfo *infoPtr = (ForeachInfo *)clientData;
ForeachVarList *varsPtr;
int i, j;
Tcl_Obj *objPtr, *innerPtr;
@@ -3167,8 +3141,7 @@ TclCompileFormatCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
@@ -3198,7 +3171,7 @@ TclCompileFormatCmd(
return TCL_ERROR;
}
objv = ckalloc((parsePtr->numWords-2) * sizeof(Tcl_Obj *));
objv = (Tcl_Obj **)ckalloc((parsePtr->numWords-2) * sizeof(Tcl_Obj *));
for (i=0 ; i+2 < parsePtr->numWords ; i++) {
tokenPtr = TokenAfter(tokenPtr);
objv[i] = Tcl_NewObj();
@@ -3492,7 +3465,7 @@ TclPushVarName(
* assemble the corresponding token.
*/
elemTokenPtr = TclStackAlloc(interp, sizeof(Tcl_Token));
elemTokenPtr = (Tcl_Token *)TclStackAlloc(interp, sizeof(Tcl_Token));
allocedTokens = 1;
elemTokenPtr->type = TCL_TOKEN_TEXT;
elemTokenPtr->start = elName;
@@ -3547,7 +3520,7 @@ TclPushVarName(
* token.
*/
elemTokenPtr = TclStackAlloc(interp, n * sizeof(Tcl_Token));
elemTokenPtr = (Tcl_Token *)TclStackAlloc(interp, n * sizeof(Tcl_Token));
allocedTokens = 1;
elemTokenPtr->type = TCL_TOKEN_TEXT;
elemTokenPtr->start = elName;
+38 -71
View File
@@ -86,8 +86,7 @@ TclCompileGlobalCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *varTokenPtr;
@@ -168,8 +167,7 @@ TclCompileIfCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
JumpFixupArray jumpFalseFixupArray;
@@ -471,8 +469,7 @@ TclCompileIncrCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *varTokenPtr, *incrTokenPtr;
@@ -640,11 +637,10 @@ TclCompileInfoCommandsCmd(
int
TclCompileInfoCoroutineCmd(
Tcl_Interp *interp, /* Used for error reporting. */
TCL_UNUSED(Tcl_Interp *),
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
/*
@@ -668,8 +664,7 @@ TclCompileInfoExistsCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr;
@@ -717,8 +712,7 @@ TclCompileInfoLevelCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
/*
@@ -752,8 +746,7 @@ TclCompileInfoObjectClassCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
DefineLineInformation; /* TIP #280 */
@@ -772,8 +765,7 @@ TclCompileInfoObjectIsACmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
DefineLineInformation; /* TIP #280 */
@@ -808,8 +800,7 @@ TclCompileInfoObjectNamespaceCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
DefineLineInformation; /* TIP #280 */
@@ -846,8 +837,7 @@ TclCompileLappendCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *varTokenPtr, *valueTokenPtr;
@@ -962,8 +952,7 @@ TclCompileLassignCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr;
@@ -1066,8 +1055,7 @@ TclCompileLindexCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *idxTokenPtr, *valTokenPtr;
@@ -1157,8 +1145,7 @@ TclCompileListCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
@@ -1271,8 +1258,7 @@ TclCompileLlengthCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *varTokenPtr;
@@ -1304,8 +1290,7 @@ TclCompileLrangeCmd(
Tcl_Interp *interp, /* Tcl interpreter for context. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the
* command. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds the resulting instructions. */
{
Tcl_Token *tokenPtr, *listTokenPtr;
@@ -1365,8 +1350,7 @@ TclCompileLinsertCmd(
Tcl_Interp *interp, /* Tcl interpreter for context. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the
* command. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds the resulting instructions. */
{
Tcl_Token *tokenPtr, *listTokenPtr;
@@ -1468,8 +1452,7 @@ TclCompileLreplaceCmd(
Tcl_Interp *interp, /* Tcl interpreter for context. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the
* command. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds the resulting instructions. */
{
Tcl_Token *tokenPtr, *listTokenPtr;
@@ -1632,8 +1615,7 @@ TclCompileLsetCmd(
Tcl_Interp *interp, /* Tcl interpreter for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the
* command. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds the resulting instructions. */
{
int tempDepth; /* Depth used for emitting one part of the
@@ -1776,11 +1758,10 @@ TclCompileLsetCmd(
int
TclCompileNamespaceCurrentCmd(
Tcl_Interp *interp, /* Used for error reporting. */
TCL_UNUSED(Tcl_Interp *),
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
/*
@@ -1804,8 +1785,7 @@ TclCompileNamespaceCodeCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr;
@@ -1854,8 +1834,7 @@ TclCompileNamespaceOriginCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr;
@@ -1876,8 +1855,7 @@ TclCompileNamespaceQualifiersCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr);
@@ -1912,8 +1890,7 @@ TclCompileNamespaceTailCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr);
@@ -1949,8 +1926,7 @@ TclCompileNamespaceUpvarCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr, *otherTokenPtr, *localTokenPtr;
@@ -2010,8 +1986,7 @@ TclCompileNamespaceWhichCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
@@ -2074,8 +2049,7 @@ TclCompileRegexpCmd(
Tcl_Interp *interp, /* Tcl interpreter for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the
* command. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds the resulting instructions. */
{
Tcl_Token *varTokenPtr; /* Pointer to the Tcl_Token representing the
@@ -2239,8 +2213,7 @@ TclCompileRegsubCmd(
Tcl_Interp *interp, /* Tcl interpreter for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the
* command. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds the resulting instructions. */
{
/*
@@ -2414,8 +2387,7 @@ TclCompileReturnCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
/*
@@ -2455,7 +2427,7 @@ TclCompileReturnCmd(
* Allocate some working space.
*/
objv = TclStackAlloc(interp, numOptionWords * sizeof(Tcl_Obj *));
objv = (Tcl_Obj **)TclStackAlloc(interp, numOptionWords * sizeof(Tcl_Obj *));
/*
* Scan through the return options. If any are unknown at compile time,
@@ -2666,8 +2638,7 @@ TclCompileUpvarCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr, *otherTokenPtr, *localTokenPtr;
@@ -2773,8 +2744,7 @@ TclCompileVariableCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *varTokenPtr, *valueTokenPtr;
@@ -2855,7 +2825,7 @@ TclCompileVariableCmd(
static int
IndexTailVarIfKnown(
Tcl_Interp *interp,
TCL_UNUSED(Tcl_Interp *),
Tcl_Token *varTokenPtr, /* Token representing the variable name */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
@@ -2947,8 +2917,7 @@ TclCompileObjectNextCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
@@ -2972,8 +2941,7 @@ TclCompileObjectNextToCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
@@ -2994,11 +2962,10 @@ TclCompileObjectNextToCmd(
int
TclCompileObjectSelfCmd(
Tcl_Interp *interp, /* Used for error reporting. */
TCL_UNUSED(Tcl_Interp *),
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
/*
+96 -152
View File
@@ -23,14 +23,10 @@
* Prototypes for procedures defined later in this file:
*/
static ClientData DupJumptableInfo(ClientData clientData);
static void FreeJumptableInfo(ClientData clientData);
static void PrintJumptableInfo(ClientData clientData,
Tcl_Obj *appendObj, ByteCode *codePtr,
unsigned int pcOffset);
static void DisassembleJumptableInfo(ClientData clientData,
Tcl_Obj *dictObj, ByteCode *codePtr,
unsigned int pcOffset);
static AuxDataDupProc DupJumptableInfo;
static AuxDataFreeProc FreeJumptableInfo;
static AuxDataPrintProc PrintJumptableInfo;
static AuxDataPrintProc DisassembleJumptableInfo;
static int CompileAssociativeBinaryOpCmd(Tcl_Interp *interp,
Tcl_Parse *parsePtr, const char *identity,
int instruction, CompileEnv *envPtr);
@@ -45,13 +41,12 @@ static int CompileUnaryOpCmd(Tcl_Interp *interp,
CompileEnv *envPtr);
static void IssueSwitchChainedTests(Tcl_Interp *interp,
CompileEnv *envPtr, int mode, int noCase,
int valueIndex, int numWords,
Tcl_Token **bodyToken, int *bodyLines,
int **bodyNext);
static void IssueSwitchJumpTable(Tcl_Interp *interp,
CompileEnv *envPtr, int valueIndex,
int numWords, Tcl_Token **bodyToken,
int *bodyLines, int **bodyContLines);
int *bodyLines, int **bodyNext);
static void IssueSwitchJumpTable(Tcl_Interp *interp,
CompileEnv *envPtr, int numWords,
Tcl_Token **bodyToken, int *bodyLines,
int **bodyContLines);
static int IssueTryClausesInstructions(Tcl_Interp *interp,
CompileEnv *envPtr, Tcl_Token *bodyToken,
int numHandlers, int *matchCodes,
@@ -131,8 +126,7 @@ TclCompileSetCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *varTokenPtr, *valueTokenPtr;
@@ -225,8 +219,7 @@ TclCompileStringCatCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
int i, numWords = parsePtr->numWords, numArgs;
@@ -297,8 +290,7 @@ TclCompileStringCmpCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
@@ -329,8 +321,7 @@ TclCompileStringEqualCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
@@ -361,8 +352,7 @@ TclCompileStringFirstCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
@@ -393,8 +383,7 @@ TclCompileStringLastCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
@@ -425,8 +414,7 @@ TclCompileStringIndexCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
@@ -453,8 +441,7 @@ TclCompileStringInsertCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr;
@@ -694,6 +681,7 @@ TclCompileStringIsCmd(
OP( LNOT);
return TCL_OK;
}
break;
case STR_IS_DOUBLE: {
int satisfied, isEmpty;
@@ -878,8 +866,7 @@ TclCompileStringLenCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
@@ -981,8 +968,7 @@ TclCompileStringRangeCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
@@ -1057,8 +1043,7 @@ TclCompileStringReplaceCmd(
Tcl_Interp *interp, /* Tcl interpreter for context. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the
* command. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds the resulting instructions. */
{
Tcl_Token *tokenPtr, *valueTokenPtr;
@@ -1256,8 +1241,7 @@ TclCompileStringTrimLCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
@@ -1284,8 +1268,7 @@ TclCompileStringTrimRCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
@@ -1312,8 +1295,7 @@ TclCompileStringTrimCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
@@ -1461,8 +1443,7 @@ TclCompileSubstCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
int numArgs = parsePtr->numWords - 1;
@@ -1477,7 +1458,7 @@ TclCompileSubstCmd(
return TCL_ERROR;
}
objv = TclStackAlloc(interp, /*numArgs*/ numOpts * sizeof(Tcl_Obj *));
objv = (Tcl_Obj **)TclStackAlloc(interp, /*numArgs*/ numOpts * sizeof(Tcl_Obj *));
for (objc = 0; objc < /*numArgs*/ numOpts; objc++) {
objv[objc] = Tcl_NewObj();
@@ -1794,8 +1775,7 @@ TclCompileSwitchCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr; /* Pointer to tokens in command. */
@@ -1970,10 +1950,10 @@ TclCompileSwitchCmd(
if (maxLen < 2) {
return TCL_ERROR;
}
bodyTokenArray = ckalloc(sizeof(Tcl_Token) * maxLen);
bodyToken = ckalloc(sizeof(Tcl_Token *) * maxLen);
bodyLines = ckalloc(sizeof(int) * maxLen);
bodyContLines = ckalloc(sizeof(int*) * maxLen);
bodyTokenArray = (Tcl_Token *)ckalloc(sizeof(Tcl_Token) * maxLen);
bodyToken = (Tcl_Token **)ckalloc(sizeof(Tcl_Token *) * maxLen);
bodyLines = (int *)ckalloc(sizeof(int) * maxLen);
bodyContLines = (int **)ckalloc(sizeof(int*) * maxLen);
bline = mapPtr->loc[eclIndex].line[valueIndex+1];
numWords = 0;
@@ -2032,9 +2012,9 @@ TclCompileSwitchCmd(
* Multi-word definition of patterns & actions.
*/
bodyToken = ckalloc(sizeof(Tcl_Token *) * numWords);
bodyLines = ckalloc(sizeof(int) * numWords);
bodyContLines = ckalloc(sizeof(int*) * numWords);
bodyToken = (Tcl_Token **)ckalloc(sizeof(Tcl_Token *) * numWords);
bodyLines = (int *)ckalloc(sizeof(int) * numWords);
bodyContLines = (int **)ckalloc(sizeof(int*) * numWords);
bodyTokenArray = NULL;
for (i=0 ; i<numWords ; i++) {
/*
@@ -2080,10 +2060,10 @@ TclCompileSwitchCmd(
CompileWord(envPtr, valueTokenPtr, interp, valueIndex);
if (mode == Switch_Exact) {
IssueSwitchJumpTable(interp, envPtr, valueIndex, numWords, bodyToken,
IssueSwitchJumpTable(interp, envPtr, numWords, bodyToken,
bodyLines, bodyContLines);
} else {
IssueSwitchChainedTests(interp, envPtr, mode, noCase, valueIndex,
IssueSwitchChainedTests(interp, envPtr, mode, noCase,
numWords, bodyToken, bodyLines, bodyContLines);
}
result = TCL_OK;
@@ -2124,7 +2104,6 @@ IssueSwitchChainedTests(
CompileEnv *envPtr, /* Holds resulting instructions. */
int mode, /* Exact, Glob or Regexp */
int noCase, /* Case-insensitivity flag. */
int valueIndex, /* The value to match against. */
int numBodyTokens, /* Number of tokens describing things the
* switch can match against and bodies to
* execute when the match succeeds. */
@@ -2154,8 +2133,8 @@ IssueSwitchChainedTests(
contFixIndex = -1;
contFixCount = 0;
fixupArray = TclStackAlloc(interp, sizeof(JumpFixup) * numBodyTokens);
fixupTargetArray = TclStackAlloc(interp, sizeof(int) * numBodyTokens);
fixupArray = (JumpFixup *)TclStackAlloc(interp, sizeof(JumpFixup) * numBodyTokens);
fixupTargetArray = (unsigned int *)TclStackAlloc(interp, sizeof(int) * numBodyTokens);
memset(fixupTargetArray, 0, numBodyTokens * sizeof(int));
fixupCount = 0;
foundDefault = 0;
@@ -2373,7 +2352,6 @@ static void
IssueSwitchJumpTable(
Tcl_Interp *interp, /* Context for compiling script bodies. */
CompileEnv *envPtr, /* Holds resulting instructions. */
int valueIndex, /* The value to match against. */
int numBodyTokens, /* Number of tokens describing things the
* switch can match against and bodies to
* execute when the match succeeds. */
@@ -2398,10 +2376,10 @@ IssueSwitchJumpTable(
* Start by allocating the jump table itself, plus some workspace.
*/
jtPtr = ckalloc(sizeof(JumptableInfo));
jtPtr = (JumptableInfo *)ckalloc(sizeof(JumptableInfo));
Tcl_InitHashTable(&jtPtr->hashTable, TCL_STRING_KEYS);
infoIndex = TclCreateAuxData(jtPtr, &tclJumptableInfoType, envPtr);
finalFixups = TclStackAlloc(interp, sizeof(int) * (numBodyTokens/2));
finalFixups = (int *)TclStackAlloc(interp, sizeof(int) * (numBodyTokens/2));
foundDefault = 0;
mustGenerate = 1;
@@ -2569,8 +2547,8 @@ static ClientData
DupJumptableInfo(
ClientData clientData)
{
JumptableInfo *jtPtr = clientData;
JumptableInfo *newJtPtr = ckalloc(sizeof(JumptableInfo));
JumptableInfo *jtPtr = (JumptableInfo *)clientData;
JumptableInfo *newJtPtr = (JumptableInfo *)ckalloc(sizeof(JumptableInfo));
Tcl_HashEntry *hPtr, *newHPtr;
Tcl_HashSearch search;
int isNew;
@@ -2589,7 +2567,7 @@ static void
FreeJumptableInfo(
ClientData clientData)
{
JumptableInfo *jtPtr = clientData;
JumptableInfo *jtPtr = (JumptableInfo *)clientData;
Tcl_DeleteHashTable(&jtPtr->hashTable);
ckfree(jtPtr);
@@ -2599,10 +2577,10 @@ static void
PrintJumptableInfo(
ClientData clientData,
Tcl_Obj *appendObj,
ByteCode *codePtr,
TCL_UNUSED(ByteCode *),
unsigned int pcOffset)
{
JumptableInfo *jtPtr = clientData;
JumptableInfo *jtPtr = (JumptableInfo *)clientData;
Tcl_HashEntry *hPtr;
Tcl_HashSearch search;
const char *keyPtr;
@@ -2610,7 +2588,7 @@ PrintJumptableInfo(
hPtr = Tcl_FirstHashEntry(&jtPtr->hashTable, &search);
for (; hPtr ; hPtr = Tcl_NextHashEntry(&search)) {
keyPtr = Tcl_GetHashKey(&jtPtr->hashTable, hPtr);
keyPtr = (const char *)Tcl_GetHashKey(&jtPtr->hashTable, hPtr);
offset = PTR2INT(Tcl_GetHashValue(hPtr));
if (i++) {
@@ -2628,10 +2606,10 @@ static void
DisassembleJumptableInfo(
ClientData clientData,
Tcl_Obj *dictObj,
ByteCode *codePtr,
unsigned int pcOffset)
TCL_UNUSED(ByteCode *),
TCL_UNUSED(unsigned int))
{
JumptableInfo *jtPtr = clientData;
JumptableInfo *jtPtr = (JumptableInfo *)clientData;
Tcl_Obj *mapping = Tcl_NewObj();
Tcl_HashEntry *hPtr;
Tcl_HashSearch search;
@@ -2640,7 +2618,7 @@ DisassembleJumptableInfo(
hPtr = Tcl_FirstHashEntry(&jtPtr->hashTable, &search);
for (; hPtr ; hPtr = Tcl_NextHashEntry(&search)) {
keyPtr = Tcl_GetHashKey(&jtPtr->hashTable, hPtr);
keyPtr = (const char *)Tcl_GetHashKey(&jtPtr->hashTable, hPtr);
offset = PTR2INT(Tcl_GetHashValue(hPtr));
Tcl_DictObjPut(NULL, mapping, Tcl_NewStringObj(keyPtr, -1),
Tcl_NewIntObj(offset));
@@ -2671,8 +2649,7 @@ TclCompileTailcallCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
@@ -2718,8 +2695,7 @@ TclCompileThrowCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
@@ -2822,8 +2798,7 @@ TclCompileTryCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
int numWords = parsePtr->numWords, numHandlers, result = TCL_ERROR;
@@ -2859,12 +2834,12 @@ TclCompileTryCmd(
numHandlers = numWords >> 2;
numWords -= numHandlers * 4;
if (numHandlers > 0) {
handlerTokens = TclStackAlloc(interp, sizeof(Tcl_Token*)*numHandlers);
matchClauses = TclStackAlloc(interp, sizeof(Tcl_Obj *) * numHandlers);
handlerTokens = (Tcl_Token**)TclStackAlloc(interp, sizeof(Tcl_Token*)*numHandlers);
matchClauses = (Tcl_Obj **)TclStackAlloc(interp, sizeof(Tcl_Obj *) * numHandlers);
memset(matchClauses, 0, sizeof(Tcl_Obj *) * numHandlers);
matchCodes = TclStackAlloc(interp, sizeof(int) * numHandlers);
resultVarIndices = TclStackAlloc(interp, sizeof(int) * numHandlers);
optionVarIndices = TclStackAlloc(interp, sizeof(int) * numHandlers);
matchCodes = (int *)TclStackAlloc(interp, sizeof(int) * numHandlers);
resultVarIndices = (int *)TclStackAlloc(interp, sizeof(int) * numHandlers);
optionVarIndices = (int *)TclStackAlloc(interp, sizeof(int) * numHandlers);
for (i=0 ; i<numHandlers ; i++) {
Tcl_Obj *tmpObj, **objv;
@@ -3125,9 +3100,9 @@ IssueTryClausesInstructions(
* Slight overallocation, but reduces size of this function.
*/
addrsToFix = TclStackAlloc(interp, sizeof(int)*numHandlers);
forwardsToFix = TclStackAlloc(interp, sizeof(int)*numHandlers);
noError = TclStackAlloc(interp, sizeof(int)*numHandlers);
addrsToFix = (int *)TclStackAlloc(interp, sizeof(int)*numHandlers);
forwardsToFix = (int *)TclStackAlloc(interp, sizeof(int)*numHandlers);
noError = (int *)TclStackAlloc(interp, sizeof(int)*numHandlers);
for (i=0 ; i<numHandlers ; i++) {
noError[i] = -1;
@@ -3154,7 +3129,7 @@ IssueTryClausesInstructions(
OP( STR_EQ);
JUMP4( JUMP_FALSE, notECJumpSource);
} else {
notECJumpSource = -1; /* LINT */
notECJumpSource = -1;
}
OP( POP);
@@ -3336,8 +3311,8 @@ IssueTryClausesFinallyInstructions(
* Slight overallocation, but reduces size of this function.
*/
addrsToFix = TclStackAlloc(interp, sizeof(int)*numHandlers);
forwardsToFix = TclStackAlloc(interp, sizeof(int)*numHandlers);
addrsToFix = (int *)TclStackAlloc(interp, sizeof(int)*numHandlers);
forwardsToFix = (int *)TclStackAlloc(interp, sizeof(int)*numHandlers);
for (i=0 ; i<numHandlers ; i++) {
int noTrapError, trapError;
@@ -3365,7 +3340,7 @@ IssueTryClausesFinallyInstructions(
OP( STR_EQ);
JUMP4( JUMP_FALSE, notECJumpSource);
} else {
notECJumpSource = -1; /* LINT */
notECJumpSource = -1;
}
OP( POP);
@@ -3632,8 +3607,7 @@ TclCompileUnsetCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *varTokenPtr;
@@ -3770,8 +3744,7 @@ TclCompileWhileCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *testTokenPtr, *bodyTokenPtr;
@@ -3948,8 +3921,7 @@ TclCompileYieldCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
if (parsePtr->numWords < 1 || parsePtr->numWords > 2) {
@@ -3991,8 +3963,7 @@ TclCompileYieldToCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
@@ -4241,8 +4212,7 @@ int
TclCompileInvertOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
return CompileUnaryOpCmd(interp, parsePtr, INST_BITNOT, envPtr);
@@ -4252,8 +4222,7 @@ int
TclCompileNotOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
return CompileUnaryOpCmd(interp, parsePtr, INST_LNOT, envPtr);
@@ -4263,8 +4232,7 @@ int
TclCompileAddOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
return CompileAssociativeBinaryOpCmd(interp, parsePtr, "0", INST_ADD,
@@ -4275,8 +4243,7 @@ int
TclCompileMulOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
return CompileAssociativeBinaryOpCmd(interp, parsePtr, "1", INST_MULT,
@@ -4287,8 +4254,7 @@ int
TclCompileAndOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
return CompileAssociativeBinaryOpCmd(interp, parsePtr, "-1", INST_BITAND,
@@ -4299,8 +4265,7 @@ int
TclCompileOrOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
return CompileAssociativeBinaryOpCmd(interp, parsePtr, "0", INST_BITOR,
@@ -4311,8 +4276,7 @@ int
TclCompileXorOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
return CompileAssociativeBinaryOpCmd(interp, parsePtr, "0", INST_BITXOR,
@@ -4323,8 +4287,7 @@ int
TclCompilePowOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
/*
@@ -4354,8 +4317,7 @@ int
TclCompileLshiftOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
return CompileStrictlyBinaryOpCmd(interp, parsePtr, INST_LSHIFT, envPtr);
@@ -4365,8 +4327,7 @@ int
TclCompileRshiftOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
return CompileStrictlyBinaryOpCmd(interp, parsePtr, INST_RSHIFT, envPtr);
@@ -4376,8 +4337,7 @@ int
TclCompileModOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
return CompileStrictlyBinaryOpCmd(interp, parsePtr, INST_MOD, envPtr);
@@ -4387,8 +4347,7 @@ int
TclCompileNeqOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
return CompileStrictlyBinaryOpCmd(interp, parsePtr, INST_NEQ, envPtr);
@@ -4398,8 +4357,7 @@ int
TclCompileStrneqOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
return CompileStrictlyBinaryOpCmd(interp, parsePtr, INST_STR_NEQ, envPtr);
@@ -4409,8 +4367,7 @@ int
TclCompileInOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
return CompileStrictlyBinaryOpCmd(interp, parsePtr, INST_LIST_IN, envPtr);
@@ -4420,8 +4377,7 @@ int
TclCompileNiOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
return CompileStrictlyBinaryOpCmd(interp, parsePtr, INST_LIST_NOT_IN,
@@ -4432,8 +4388,7 @@ int
TclCompileLessOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
return CompileComparisonOpCmd(interp, parsePtr, INST_LT, envPtr);
@@ -4443,8 +4398,7 @@ int
TclCompileLeqOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
return CompileComparisonOpCmd(interp, parsePtr, INST_LE, envPtr);
@@ -4454,8 +4408,7 @@ int
TclCompileGreaterOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
return CompileComparisonOpCmd(interp, parsePtr, INST_GT, envPtr);
@@ -4465,8 +4418,7 @@ int
TclCompileGeqOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
return CompileComparisonOpCmd(interp, parsePtr, INST_GE, envPtr);
@@ -4476,8 +4428,7 @@ int
TclCompileEqOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
return CompileComparisonOpCmd(interp, parsePtr, INST_EQ, envPtr);
@@ -4487,8 +4438,7 @@ int
TclCompileStreqOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
return CompileComparisonOpCmd(interp, parsePtr, INST_STR_EQ, envPtr);
@@ -4498,8 +4448,7 @@ int
TclCompileStrLtOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
return CompileComparisonOpCmd(interp, parsePtr, INST_STR_LT, envPtr);
@@ -4509,8 +4458,7 @@ int
TclCompileStrLeOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
return CompileComparisonOpCmd(interp, parsePtr, INST_STR_LE, envPtr);
@@ -4520,8 +4468,7 @@ int
TclCompileStrGtOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
return CompileComparisonOpCmd(interp, parsePtr, INST_STR_GT, envPtr);
@@ -4531,8 +4478,7 @@ int
TclCompileStrGeOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
return CompileComparisonOpCmd(interp, parsePtr, INST_STR_GE, envPtr);
@@ -4542,8 +4488,7 @@ int
TclCompileMinusOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
Tcl_Token *tokenPtr = parsePtr->tokenPtr;
@@ -4588,8 +4533,7 @@ int
TclCompileDivOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
Tcl_Token *tokenPtr = parsePtr->tokenPtr;
+16 -16
View File
@@ -631,7 +631,7 @@ ParseExpr(
TclParseInit(interp, start, numBytes, parsePtr);
nodes = attemptckalloc(nodesAvailable * sizeof(OpNode));
nodes = (OpNode *)attemptckalloc(nodesAvailable * sizeof(OpNode));
if (nodes == NULL) {
TclNewLiteralStringObj(msg, "not enough memory to parse expression");
errCode = "NOMEM";
@@ -675,7 +675,7 @@ ParseExpr(
do {
if (size <= UINT_MAX/sizeof(OpNode)) {
newPtr = attemptckrealloc(nodes, size * sizeof(OpNode));
newPtr = (OpNode *)attemptckrealloc(nodes, size * sizeof(OpNode));
}
} while ((newPtr == NULL)
&& ((size -= (size - nodesUsed) / 2) > nodesUsed));
@@ -919,7 +919,7 @@ ParseExpr(
break;
case SCRIPT: {
Tcl_Parse *nestedPtr =
Tcl_Parse *nestedPtr = (Tcl_Parse *)
TclStackAlloc(interp, sizeof(Tcl_Parse));
tokenPtr = parsePtr->tokenPtr + parsePtr->numTokens;
@@ -1838,7 +1838,7 @@ Tcl_ParseExpr(
OpNode *opTree = NULL; /* Will point to the tree of operators. */
Tcl_Obj *litList = Tcl_NewObj(); /* List to hold the literals. */
Tcl_Obj *funcList = Tcl_NewObj(); /* List to hold the functon names. */
Tcl_Parse *exprParsePtr = TclStackAlloc(interp, sizeof(Tcl_Parse));
Tcl_Parse *exprParsePtr = (Tcl_Parse *)TclStackAlloc(interp, sizeof(Tcl_Parse));
/* Holds the Tcl_Tokens of substitutions. */
if (numBytes < 0) {
@@ -2156,7 +2156,7 @@ TclCompileExpr(
OpNode *opTree = NULL; /* Will point to the tree of operators */
Tcl_Obj *litList = Tcl_NewObj(); /* List to hold the literals */
Tcl_Obj *funcList = Tcl_NewObj(); /* List to hold the functon names*/
Tcl_Parse *parsePtr = TclStackAlloc(interp, sizeof(Tcl_Parse));
Tcl_Parse *parsePtr = (Tcl_Parse *)TclStackAlloc(interp, sizeof(Tcl_Parse));
/* Holds the Tcl_Tokens of substitutions */
int code = ParseExpr(interp, script, numBytes, &opTree, litList,
@@ -2226,7 +2226,7 @@ ExecConstantExprTree(
* bytecode, so there's no need to tend to TIP 280 issues.
*/
envPtr = TclStackAlloc(interp, sizeof(CompileEnv));
envPtr = (CompileEnv *)TclStackAlloc(interp, sizeof(CompileEnv));
TclInitCompileEnv(interp, envPtr, NULL, 0, NULL, 0);
CompileExprTree(interp, nodes, index, litObjvPtr, NULL, NULL, envPtr,
0 /* optimize */);
@@ -2321,13 +2321,13 @@ CompileExprTree(
break;
}
case QUESTION:
newJump = TclStackAlloc(interp, sizeof(JumpList));
newJump = (JumpList *)TclStackAlloc(interp, sizeof(JumpList));
newJump->next = jumpPtr;
jumpPtr = newJump;
TclEmitForwardJump(envPtr, TCL_FALSE_JUMP, &jumpPtr->jump);
break;
case COLON:
newJump = TclStackAlloc(interp, sizeof(JumpList));
newJump = (JumpList *)TclStackAlloc(interp, sizeof(JumpList));
newJump->next = jumpPtr;
jumpPtr = newJump;
TclEmitForwardJump(envPtr, TCL_UNCONDITIONAL_JUMP,
@@ -2340,7 +2340,7 @@ CompileExprTree(
break;
case AND:
case OR:
newJump = TclStackAlloc(interp, sizeof(JumpList));
newJump = (JumpList *)TclStackAlloc(interp, sizeof(JumpList));
newJump->next = jumpPtr;
jumpPtr = newJump;
TclEmitForwardJump(envPtr, (nodePtr->lexeme == AND)
@@ -2573,7 +2573,7 @@ TclSingleOpCmd(
int objc,
Tcl_Obj *const objv[])
{
TclOpCmdClientData *occdPtr = clientData;
TclOpCmdClientData *occdPtr = (TclOpCmdClientData *)clientData;
unsigned char lexeme;
OpNode nodes[2];
Tcl_Obj *const *litObjv = objv + 1;
@@ -2631,10 +2631,10 @@ TclSortingOpCmd(
if (objc < 3) {
Tcl_SetObjResult(interp, Tcl_NewBooleanObj(1));
} else {
TclOpCmdClientData *occdPtr = clientData;
Tcl_Obj **litObjv = TclStackAlloc(interp,
TclOpCmdClientData *occdPtr = (TclOpCmdClientData *)clientData;
Tcl_Obj **litObjv = (Tcl_Obj **)TclStackAlloc(interp,
2 * (objc-2) * sizeof(Tcl_Obj *));
OpNode *nodes = TclStackAlloc(interp, 2 * (objc-2) * sizeof(OpNode));
OpNode *nodes = (OpNode *)TclStackAlloc(interp, 2 * (objc-2) * sizeof(OpNode));
unsigned char lexeme;
int i, lastAnd = 1;
Tcl_Obj *const *litObjPtrPtr = litObjv;
@@ -2706,7 +2706,7 @@ TclVariadicOpCmd(
int objc,
Tcl_Obj *const objv[])
{
TclOpCmdClientData *occdPtr = clientData;
TclOpCmdClientData *occdPtr = (TclOpCmdClientData *)clientData;
unsigned char lexeme;
int code;
@@ -2761,7 +2761,7 @@ TclVariadicOpCmd(
return code;
} else {
Tcl_Obj *const *litObjv = objv + 1;
OpNode *nodes = TclStackAlloc(interp, (objc-1) * sizeof(OpNode));
OpNode *nodes = (OpNode *)TclStackAlloc(interp, (objc-1) * sizeof(OpNode));
int i, lastOp = OT_LITERAL;
nodes[0].lexeme = START;
@@ -2825,7 +2825,7 @@ TclNoIdentOpCmd(
int objc,
Tcl_Obj *const objv[])
{
TclOpCmdClientData *occdPtr = clientData;
TclOpCmdClientData *occdPtr = (TclOpCmdClientData *)clientData;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, occdPtr->expected);
+37 -41
View File
@@ -697,8 +697,7 @@ static void EnterCmdStartData(CompileEnv *envPtr,
static void FreeByteCodeInternalRep(Tcl_Obj *objPtr);
static void FreeSubstCodeInternalRep(Tcl_Obj *objPtr);
static int GetCmdLocEncodingSize(CompileEnv *envPtr);
static int IsCompactibleCompileEnv(Tcl_Interp *interp,
CompileEnv *envPtr);
static int IsCompactibleCompileEnv(CompileEnv *envPtr);
static void PreventCycle(Tcl_Obj *objPtr, CompileEnv *envPtr);
#ifdef TCL_COMPILE_STATS
static void RecordByteCodeStats(ByteCode *codePtr);
@@ -712,7 +711,7 @@ static void StartExpanding(CompileEnv *envPtr);
* commands.
*/
static void EnterCmdWordData(ExtCmdLoc *eclPtr, int srcOffset,
Tcl_Token *tokenPtr, const char *cmd, int len,
Tcl_Token *tokenPtr, const char *cmd,
int numWords, int line, int *clNext, int **lines,
CompileEnv *envPtr);
static void ReleaseCmdWordData(ExtCmdLoc *eclPtr);
@@ -797,7 +796,7 @@ TclSetByteCodeFromAny(
#ifdef TCL_COMPILE_DEBUG
if (!traceInitialized) {
if (Tcl_LinkVar(interp, "tcl_traceCompile",
(char *) &tclTraceCompile, TCL_LINK_INT) != TCL_OK) {
&tclTraceCompile, TCL_LINK_INT) != TCL_OK) {
Tcl_Panic("SetByteCodeFromAny: unable to create link for tcl_traceCompile variable");
}
traceInitialized = 1;
@@ -851,7 +850,7 @@ TclSetByteCodeFromAny(
if (Tcl_GetMaster(interp) == NULL &&
!Tcl_LimitTypeEnabled(interp, TCL_LIMIT_COMMANDS|TCL_LIMIT_TIME)
&& IsCompactibleCompileEnv(interp, &compEnv)) {
&& IsCompactibleCompileEnv(&compEnv)) {
TclFreeCompileEnv(&compEnv);
iPtr->compiledProcPtr = procPtr;
TclInitCompileEnv(interp, &compEnv, stringPtr, length,
@@ -962,8 +961,8 @@ SetByteCodeFromAny(
static void
DupByteCodeInternalRep(
Tcl_Obj *srcPtr, /* Object with internal rep to copy. */
Tcl_Obj *copyPtr) /* Object with internal rep to set. */
TCL_UNUSED(Tcl_Obj *) /*srcPtr*/,
TCL_UNUSED(Tcl_Obj *) /*copyPtr*/)
{
return;
}
@@ -1148,7 +1147,7 @@ CleanupByteCode(
(char *) codePtr);
if (hePtr) {
ReleaseCmdWordData(Tcl_GetHashValue(hePtr));
ReleaseCmdWordData((ExtCmdLoc *)Tcl_GetHashValue(hePtr));
Tcl_DeleteHashEntry(hePtr);
}
}
@@ -1174,7 +1173,6 @@ CleanupByteCode(
static int
IsCompactibleCompileEnv(
Tcl_Interp *interp,
CompileEnv *envPtr)
{
unsigned char *pc;
@@ -1498,7 +1496,7 @@ TclInitCompileEnv(
* non-compiling evaluator
*/
envPtr->extCmdMapPtr = ckalloc(sizeof(ExtCmdLoc));
envPtr->extCmdMapPtr = (ExtCmdLoc *)ckalloc(sizeof(ExtCmdLoc));
envPtr->extCmdMapPtr->loc = NULL;
envPtr->extCmdMapPtr->nloc = 0;
envPtr->extCmdMapPtr->nuloc = 0;
@@ -1554,7 +1552,7 @@ TclInitCompileEnv(
* ...) which may make change the type as well.
*/
CmdFrame *ctxPtr = TclStackAlloc(interp, sizeof(CmdFrame));
CmdFrame *ctxPtr = (CmdFrame *)TclStackAlloc(interp, sizeof(CmdFrame));
int pc = 0;
*ctxPtr = *invoker;
@@ -2065,7 +2063,7 @@ CompileCommandTokens(
EnterCmdWordData(eclPtr, parsePtr->commandStart - envPtr->source,
parsePtr->tokenPtr, parsePtr->commandStart,
parsePtr->commandSize, parsePtr->numWords, cmdLine,
parsePtr->numWords, cmdLine,
clNext, &wlines, envPtr);
wlineat = eclPtr->nuloc - 1;
@@ -2187,7 +2185,7 @@ TclCompileScript(
* many nested compilations (body enclosed in body) can cause abnormal
* program termination with a stack overflow exception, bug [fec0c17d39].
*/
Tcl_Parse *parsePtr = ckalloc(sizeof(Tcl_Parse));
Tcl_Parse *parsePtr = (Tcl_Parse *)ckalloc(sizeof(Tcl_Parse));
do {
const char *next;
@@ -2445,7 +2443,7 @@ TclCompileTokens(
if (isLiteral) {
maxNumCL = NUM_STATIC_POS;
clPosition = ckalloc(maxNumCL * sizeof(int));
clPosition = (int *)ckalloc(maxNumCL * sizeof(int));
}
adjust = 0;
@@ -2486,7 +2484,7 @@ TclCompileTokens(
if (numCL >= maxNumCL) {
maxNumCL *= 2;
clPosition = ckrealloc(clPosition,
clPosition = (int *)ckrealloc(clPosition,
maxNumCL * sizeof(int));
}
clPosition[numCL] = clPos;
@@ -2737,8 +2735,7 @@ TclCompileNoOp(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr;
@@ -2860,7 +2857,7 @@ TclInitByteCode(
namespacePtr = envPtr->iPtr->globalNsPtr;
}
p = ckalloc(structureSize);
p = (unsigned char *)ckalloc(structureSize);
codePtr = (ByteCode *) p;
codePtr->interpHandle = TclHandlePreserve(iPtr->handle);
codePtr->compileEpoch = iPtr->compileEpoch;
@@ -3073,7 +3070,7 @@ TclFindCompiledLocal(
if (create || (name == NULL)) {
localVar = procPtr->numCompiledLocals;
localPtr = ckalloc(offsetof(CompiledLocal, name) + nameBytes + 1);
localPtr = (CompiledLocal *)ckalloc(offsetof(CompiledLocal, name) + nameBytes + 1);
if (procPtr->firstLocalPtr == NULL) {
procPtr->firstLocalPtr = procPtr->lastLocalPtr = localPtr;
} else {
@@ -3123,7 +3120,7 @@ TclExpandCodeArray(
void *envArgPtr) /* Points to the CompileEnv whose code array
* must be enlarged. */
{
CompileEnv *envPtr = envArgPtr;
CompileEnv *envPtr = (CompileEnv *)envArgPtr;
/* The CompileEnv containing the code array to
* be doubled in size. */
@@ -3137,14 +3134,14 @@ TclExpandCodeArray(
size_t newBytes = 2 * (envPtr->codeEnd - envPtr->codeStart);
if (envPtr->mallocedCodeArray) {
envPtr->codeStart = ckrealloc(envPtr->codeStart, newBytes);
envPtr->codeStart = (unsigned char *)ckrealloc(envPtr->codeStart, newBytes);
} else {
/*
* envPtr->codeStart isn't a ckalloc'd pointer, so we must code a
* ckrealloc equivalent for ourselves.
*/
unsigned char *newPtr = ckalloc(newBytes);
unsigned char *newPtr = (unsigned char *)ckalloc(newBytes);
memcpy(newPtr, envPtr->codeStart, currBytes);
envPtr->codeStart = newPtr;
@@ -3204,14 +3201,14 @@ EnterCmdStartData(
size_t newBytes = newElems * sizeof(CmdLocation);
if (envPtr->mallocedCmdMap) {
envPtr->cmdMapPtr = ckrealloc(envPtr->cmdMapPtr, newBytes);
envPtr->cmdMapPtr = (CmdLocation *)ckrealloc(envPtr->cmdMapPtr, newBytes);
} else {
/*
* envPtr->cmdMapPtr isn't a ckalloc'd pointer, so we must code a
* ckrealloc equivalent for ourselves.
*/
CmdLocation *newPtr = ckalloc(newBytes);
CmdLocation *newPtr = (CmdLocation *)ckalloc(newBytes);
memcpy(newPtr, envPtr->cmdMapPtr, currBytes);
envPtr->cmdMapPtr = newPtr;
@@ -3308,7 +3305,6 @@ EnterCmdWordData(
int srcOffset, /* Offset of first char of the command. */
Tcl_Token *tokenPtr,
const char *cmd,
int len,
int numWords,
int line,
int *clNext,
@@ -3330,16 +3326,16 @@ EnterCmdWordData(
size_t newElems = (currElems ? 2*currElems : 1);
size_t newBytes = newElems * sizeof(ECL);
eclPtr->loc = ckrealloc(eclPtr->loc, newBytes);
eclPtr->loc = (ECL *)ckrealloc(eclPtr->loc, newBytes);
eclPtr->nloc = newElems;
}
ePtr = &eclPtr->loc[eclPtr->nuloc];
ePtr->srcOffset = srcOffset;
ePtr->line = ckalloc(numWords * sizeof(int));
ePtr->next = ckalloc(numWords * sizeof(int *));
ePtr->line = (int *)ckalloc(numWords * sizeof(int));
ePtr->next = (int **)ckalloc(numWords * sizeof(int *));
ePtr->nline = numWords;
wwlines = ckalloc(numWords * sizeof(int));
wwlines = (int *)ckalloc(numWords * sizeof(int));
last = cmd;
wordLine = line;
@@ -3408,17 +3404,17 @@ TclCreateExceptRange(
if (envPtr->mallocedExceptArray) {
envPtr->exceptArrayPtr =
ckrealloc(envPtr->exceptArrayPtr, newBytes);
(ExceptionRange *)ckrealloc(envPtr->exceptArrayPtr, newBytes);
envPtr->exceptAuxArrayPtr =
ckrealloc(envPtr->exceptAuxArrayPtr, newBytes2);
(ExceptionAux *)ckrealloc(envPtr->exceptAuxArrayPtr, newBytes2);
} else {
/*
* envPtr->exceptArrayPtr isn't a ckalloc'd pointer, so we must
* code a ckrealloc equivalent for ourselves.
*/
ExceptionRange *newPtr = ckalloc(newBytes);
ExceptionAux *newPtr2 = ckalloc(newBytes2);
ExceptionRange *newPtr = (ExceptionRange *)ckalloc(newBytes);
ExceptionAux *newPtr2 = (ExceptionAux *)ckalloc(newBytes2);
memcpy(newPtr, envPtr->exceptArrayPtr, currBytes);
memcpy(newPtr2, envPtr->exceptAuxArrayPtr, currBytes2);
@@ -3521,11 +3517,11 @@ TclAddLoopBreakFixup(
auxPtr->allocBreakTargets *= 2;
auxPtr->allocBreakTargets += 2;
if (auxPtr->breakTargets) {
auxPtr->breakTargets = ckrealloc(auxPtr->breakTargets,
auxPtr->breakTargets = (unsigned int *)ckrealloc(auxPtr->breakTargets,
sizeof(int) * auxPtr->allocBreakTargets);
} else {
auxPtr->breakTargets =
ckalloc(sizeof(int) * auxPtr->allocBreakTargets);
(unsigned int *)ckalloc(sizeof(int) * auxPtr->allocBreakTargets);
}
}
auxPtr->breakTargets[auxPtr->numBreakTargets - 1] = CurrentOffset(envPtr);
@@ -3547,11 +3543,11 @@ TclAddLoopContinueFixup(
auxPtr->allocContinueTargets *= 2;
auxPtr->allocContinueTargets += 2;
if (auxPtr->continueTargets) {
auxPtr->continueTargets = ckrealloc(auxPtr->continueTargets,
auxPtr->continueTargets = (unsigned int *)ckrealloc(auxPtr->continueTargets,
sizeof(int) * auxPtr->allocContinueTargets);
} else {
auxPtr->continueTargets =
ckalloc(sizeof(int) * auxPtr->allocContinueTargets);
(unsigned int *)ckalloc(sizeof(int) * auxPtr->allocContinueTargets);
}
}
auxPtr->continueTargets[auxPtr->numContinueTargets - 1] =
@@ -3774,14 +3770,14 @@ TclCreateAuxData(
if (envPtr->mallocedAuxDataArray) {
envPtr->auxDataArrayPtr =
ckrealloc(envPtr->auxDataArrayPtr, newBytes);
(AuxData *)ckrealloc(envPtr->auxDataArrayPtr, newBytes);
} else {
/*
* envPtr->auxDataArrayPtr isn't a ckalloc'd pointer, so we must
* code a ckrealloc equivalent for ourselves.
*/
AuxData *newPtr = ckalloc(newBytes);
AuxData *newPtr = (AuxData *)ckalloc(newBytes);
memcpy(newPtr, envPtr->auxDataArrayPtr, currBytes);
envPtr->auxDataArrayPtr = newPtr;
@@ -3863,14 +3859,14 @@ TclExpandJumpFixupArray(
size_t newBytes = newElems * sizeof(JumpFixup);
if (fixupArrayPtr->mallocedArray) {
fixupArrayPtr->fixup = ckrealloc(fixupArrayPtr->fixup, newBytes);
fixupArrayPtr->fixup = (JumpFixup *)ckrealloc(fixupArrayPtr->fixup, newBytes);
} else {
/*
* fixupArrayPtr->fixup isn't a ckalloc'd pointer, so we must code a
* ckrealloc equivalent for ourselves.
*/
JumpFixup *newPtr = ckalloc(newBytes);
JumpFixup *newPtr = (JumpFixup *)ckalloc(newBytes);
memcpy(newPtr, fixupArrayPtr->fixup, currBytes);
fixupArrayPtr->fixup = newPtr;
+10 -15
View File
@@ -41,13 +41,10 @@ typedef struct QCCD {
* Static functions in this file:
*/
static int QueryConfigObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
struct Tcl_Obj *const *objv);
static void QueryConfigDelete(ClientData clientData);
static Tcl_ObjCmdProc QueryConfigObjCmd;
static Tcl_CmdDeleteProc QueryConfigDelete;
static Tcl_InterpDeleteProc ConfigDictDeleteProc;
static Tcl_Obj * GetConfigDict(Tcl_Interp *interp);
static void ConfigDictDeleteProc(ClientData clientData,
Tcl_Interp *interp);
/*
*----------------------------------------------------------------------
@@ -79,11 +76,11 @@ Tcl_RegisterConfig(
Tcl_Obj *pDB, *pkgDict;
Tcl_DString cmdName;
const Tcl_Config *cfg;
QCCD *cdPtr = ckalloc(sizeof(QCCD));
QCCD *cdPtr = (QCCD *)ckalloc(sizeof(QCCD));
cdPtr->interp = interp;
if (valEncoding) {
cdPtr->encoding = ckalloc(strlen(valEncoding)+1);
cdPtr->encoding = (char *)ckalloc(strlen(valEncoding)+1);
strcpy(cdPtr->encoding, valEncoding);
} else {
cdPtr->encoding = NULL;
@@ -199,7 +196,7 @@ QueryConfigObjCmd(
int objc,
struct Tcl_Obj *const *objv)
{
QCCD *cdPtr = clientData;
QCCD *cdPtr = (QCCD *)clientData;
Tcl_Obj *pkgName = cdPtr->pkg;
Tcl_Obj *pDB, *pkgDict, *val, *listPtr;
int n, index;
@@ -326,7 +323,7 @@ static void
QueryConfigDelete(
ClientData clientData)
{
QCCD *cdPtr = clientData;
QCCD *cdPtr = (QCCD *)clientData;
Tcl_Obj *pkgName = cdPtr->pkg;
Tcl_Obj *pDB = GetConfigDict(cdPtr->interp);
@@ -359,7 +356,7 @@ static Tcl_Obj *
GetConfigDict(
Tcl_Interp *interp)
{
Tcl_Obj *pDB = Tcl_GetAssocData(interp, ASSOC_KEY, NULL);
Tcl_Obj *pDB = (Tcl_Obj *)Tcl_GetAssocData(interp, ASSOC_KEY, NULL);
if (pDB == NULL) {
pDB = Tcl_NewDictObj();
@@ -392,11 +389,9 @@ GetConfigDict(
static void
ConfigDictDeleteProc(
ClientData clientData, /* Pointer to Tcl_Obj. */
Tcl_Interp *interp) /* Interpreter being deleted. */
TCL_UNUSED(Tcl_Interp *))
{
Tcl_Obj *pDB = clientData;
Tcl_DecrRefCount(pDB);
Tcl_DecrRefCount((Tcl_Obj *)clientData);
}
/*
+2 -2
View File
@@ -2744,7 +2744,7 @@ TclDatelex(
int
TclClockOldscanObjCmd(
void *clientData, /* Unused */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Tcl interpreter */
int objc, /* Count of paraneters */
Tcl_Obj *const *objv) /* Parameters */
@@ -2858,7 +2858,7 @@ TclClockOldscanObjCmd(
if (yyHaveTime) {
Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj((int)
ToSeconds(yyHour, yyMinutes, yySeconds, yyMeridian)));
ToSeconds(yyHour, yyMinutes, yySeconds, (MERIDIAN)yyMeridian)));
} else {
Tcl_ListObjAppendElement(interp, result, Tcl_NewObj());
}
+62 -34
View File
@@ -478,7 +478,8 @@ EXTERN Tcl_HashEntry * Tcl_FirstHashEntry(Tcl_HashTable *tablePtr,
/* 146 */
EXTERN int Tcl_Flush(Tcl_Channel chan);
/* 147 */
EXTERN void Tcl_FreeResult(Tcl_Interp *interp);
TCL_DEPRECATED("see TIP #559. Use Tcl_ResetResult")
void Tcl_FreeResult(Tcl_Interp *interp);
/* 148 */
EXTERN int Tcl_GetAlias(Tcl_Interp *interp,
const char *slaveCmd,
@@ -1063,9 +1064,11 @@ EXTERN int Tcl_UniCharIsUpper(int ch);
/* 351 */
EXTERN int Tcl_UniCharIsWordChar(int ch);
/* 352 */
EXTERN int Tcl_UniCharLen(const Tcl_UniChar *uniStr);
TCL_DEPRECATED("Use Tcl_GetCharLength")
int Tcl_UniCharLen(const Tcl_UniChar *uniStr);
/* 353 */
EXTERN int Tcl_UniCharNcmp(const Tcl_UniChar *ucs,
TCL_DEPRECATED("Use Tcl_UtfNcmp")
int Tcl_UniCharNcmp(const Tcl_UniChar *ucs,
const Tcl_UniChar *uct,
unsigned long numChars);
/* 354 */
@@ -1156,7 +1159,8 @@ Tcl_UniChar * Tcl_GetUnicode(Tcl_Obj *objPtr);
/* 383 */
EXTERN Tcl_Obj * Tcl_GetRange(Tcl_Obj *objPtr, int first, int last);
/* 384 */
EXTERN void Tcl_AppendUnicodeToObj(Tcl_Obj *objPtr,
TCL_DEPRECATED("Use Tcl_AppendStringsToObj")
void Tcl_AppendUnicodeToObj(Tcl_Obj *objPtr,
const Tcl_UniChar *unicode, int length);
/* 385 */
EXTERN int Tcl_RegExpMatchObj(Tcl_Interp *interp,
@@ -1202,7 +1206,8 @@ EXTERN Tcl_ChannelTypeVersion Tcl_ChannelVersion(
EXTERN Tcl_DriverBlockModeProc * Tcl_ChannelBlockModeProc(
const Tcl_ChannelType *chanTypePtr);
/* 401 */
EXTERN Tcl_DriverCloseProc * Tcl_ChannelCloseProc(
TCL_DEPRECATED("Use Tcl_ChannelClose2Proc")
Tcl_DriverCloseProc * Tcl_ChannelCloseProc(
const Tcl_ChannelType *chanTypePtr);
/* 402 */
EXTERN Tcl_DriverClose2Proc * Tcl_ChannelClose2Proc(
@@ -1214,7 +1219,8 @@ EXTERN Tcl_DriverInputProc * Tcl_ChannelInputProc(
EXTERN Tcl_DriverOutputProc * Tcl_ChannelOutputProc(
const Tcl_ChannelType *chanTypePtr);
/* 405 */
EXTERN Tcl_DriverSeekProc * Tcl_ChannelSeekProc(
TCL_DEPRECATED("Use Tcl_ChannelWideSeekProc")
Tcl_DriverSeekProc * Tcl_ChannelSeekProc(
const Tcl_ChannelType *chanTypePtr);
/* 406 */
EXTERN Tcl_DriverSetOptionProc * Tcl_ChannelSetOptionProc(
@@ -1250,11 +1256,13 @@ EXTERN void Tcl_ClearChannelHandlers(Tcl_Channel channel);
/* 418 */
EXTERN int Tcl_IsChannelExisting(const char *channelName);
/* 419 */
EXTERN int Tcl_UniCharNcasecmp(const Tcl_UniChar *ucs,
TCL_DEPRECATED("Use Tcl_UtfNcasecmp")
int Tcl_UniCharNcasecmp(const Tcl_UniChar *ucs,
const Tcl_UniChar *uct,
unsigned long numChars);
/* 420 */
EXTERN int Tcl_UniCharCaseMatch(const Tcl_UniChar *uniStr,
TCL_DEPRECATED("Use Tcl_StringCaseMatch")
int Tcl_UniCharCaseMatch(const Tcl_UniChar *uniStr,
const Tcl_UniChar *uniPattern, int nocase);
/* 421 */
EXTERN Tcl_HashEntry * Tcl_FindHashEntry(Tcl_HashTable *tablePtr,
@@ -1644,18 +1652,18 @@ EXTERN void Tcl_QueryTimeProc(Tcl_GetTimeProc **getProc,
EXTERN Tcl_DriverThreadActionProc * Tcl_ChannelThreadActionProc(
const Tcl_ChannelType *chanTypePtr);
/* 555 */
EXTERN Tcl_Obj * Tcl_NewBignumObj(mp_int *value);
EXTERN Tcl_Obj * Tcl_NewBignumObj(void *value);
/* 556 */
EXTERN Tcl_Obj * Tcl_DbNewBignumObj(mp_int *value, const char *file,
EXTERN Tcl_Obj * Tcl_DbNewBignumObj(void *value, const char *file,
int line);
/* 557 */
EXTERN void Tcl_SetBignumObj(Tcl_Obj *obj, mp_int *value);
EXTERN void Tcl_SetBignumObj(Tcl_Obj *obj, void *value);
/* 558 */
EXTERN int Tcl_GetBignumFromObj(Tcl_Interp *interp,
Tcl_Obj *obj, mp_int *value);
Tcl_Obj *obj, void *value);
/* 559 */
EXTERN int Tcl_TakeBignumFromObj(Tcl_Interp *interp,
Tcl_Obj *obj, mp_int *value);
Tcl_Obj *obj, void *value);
/* 560 */
EXTERN int Tcl_TruncateChannel(Tcl_Channel chan,
Tcl_WideInt length);
@@ -1674,7 +1682,7 @@ EXTERN void Tcl_SetChannelError(Tcl_Channel chan, Tcl_Obj *msg);
EXTERN void Tcl_GetChannelError(Tcl_Channel chan, Tcl_Obj **msg);
/* 566 */
EXTERN int Tcl_InitBignumFromDouble(Tcl_Interp *interp,
double initval, mp_int *toInit);
double initval, void *toInit);
/* 567 */
EXTERN Tcl_Obj * Tcl_GetNamespaceUnknownHandler(Tcl_Interp *interp,
Tcl_Namespace *nsPtr);
@@ -1792,7 +1800,7 @@ EXTERN int Tcl_GetErrorLine(Tcl_Interp *interp);
EXTERN void Tcl_SetErrorLine(Tcl_Interp *interp, int lineNum);
/* 607 */
EXTERN void Tcl_TransferResult(Tcl_Interp *sourceInterp,
int result, Tcl_Interp *targetInterp);
int code, Tcl_Interp *targetInterp);
/* 608 */
EXTERN int Tcl_InterpActive(Tcl_Interp *interp);
/* 609 */
@@ -2087,7 +2095,7 @@ typedef struct TclStubs {
TCL_DEPRECATED_API("Don't use this function in a stub-enabled extension") void (*tcl_FindExecutable) (const char *argv0); /* 144 */
Tcl_HashEntry * (*tcl_FirstHashEntry) (Tcl_HashTable *tablePtr, Tcl_HashSearch *searchPtr); /* 145 */
int (*tcl_Flush) (Tcl_Channel chan); /* 146 */
void (*tcl_FreeResult) (Tcl_Interp *interp); /* 147 */
TCL_DEPRECATED_API("see TIP #559. Use Tcl_ResetResult") void (*tcl_FreeResult) (Tcl_Interp *interp); /* 147 */
int (*tcl_GetAlias) (Tcl_Interp *interp, const char *slaveCmd, Tcl_Interp **targetInterpPtr, const char **targetCmdPtr, int *argcPtr, const char ***argvPtr); /* 148 */
int (*tcl_GetAliasObj) (Tcl_Interp *interp, const char *slaveCmd, Tcl_Interp **targetInterpPtr, const char **targetCmdPtr, int *objcPtr, Tcl_Obj ***objv); /* 149 */
ClientData (*tcl_GetAssocData) (Tcl_Interp *interp, const char *name, Tcl_InterpDeleteProc **procPtr); /* 150 */
@@ -2300,8 +2308,8 @@ typedef struct TclStubs {
int (*tcl_UniCharIsSpace) (int ch); /* 349 */
int (*tcl_UniCharIsUpper) (int ch); /* 350 */
int (*tcl_UniCharIsWordChar) (int ch); /* 351 */
int (*tcl_UniCharLen) (const Tcl_UniChar *uniStr); /* 352 */
int (*tcl_UniCharNcmp) (const Tcl_UniChar *ucs, const Tcl_UniChar *uct, unsigned long numChars); /* 353 */
TCL_DEPRECATED_API("Use Tcl_GetCharLength") int (*tcl_UniCharLen) (const Tcl_UniChar *uniStr); /* 352 */
TCL_DEPRECATED_API("Use Tcl_UtfNcmp") int (*tcl_UniCharNcmp) (const Tcl_UniChar *ucs, const Tcl_UniChar *uct, unsigned long numChars); /* 353 */
char * (*tcl_Char16ToUtfDString) (const unsigned short *uniStr, int uniLength, Tcl_DString *dsPtr); /* 354 */
unsigned short * (*tcl_UtfToChar16DString) (const char *src, int length, Tcl_DString *dsPtr); /* 355 */
Tcl_RegExp (*tcl_GetRegExpFromObj) (Tcl_Interp *interp, Tcl_Obj *patObj, int flags); /* 356 */
@@ -2332,7 +2340,7 @@ typedef struct TclStubs {
int (*tcl_GetUniChar) (Tcl_Obj *objPtr, int index); /* 381 */
TCL_DEPRECATED_API("No longer in use, changed to macro") Tcl_UniChar * (*tcl_GetUnicode) (Tcl_Obj *objPtr); /* 382 */
Tcl_Obj * (*tcl_GetRange) (Tcl_Obj *objPtr, int first, int last); /* 383 */
void (*tcl_AppendUnicodeToObj) (Tcl_Obj *objPtr, const Tcl_UniChar *unicode, int length); /* 384 */
TCL_DEPRECATED_API("Use Tcl_AppendStringsToObj") void (*tcl_AppendUnicodeToObj) (Tcl_Obj *objPtr, const Tcl_UniChar *unicode, int length); /* 384 */
int (*tcl_RegExpMatchObj) (Tcl_Interp *interp, Tcl_Obj *textObj, Tcl_Obj *patternObj); /* 385 */
void (*tcl_SetNotifier) (Tcl_NotifierProcs *notifierProcPtr); /* 386 */
Tcl_Mutex * (*tcl_GetAllocMutex) (void); /* 387 */
@@ -2349,11 +2357,11 @@ typedef struct TclStubs {
const char * (*tcl_ChannelName) (const Tcl_ChannelType *chanTypePtr); /* 398 */
Tcl_ChannelTypeVersion (*tcl_ChannelVersion) (const Tcl_ChannelType *chanTypePtr); /* 399 */
Tcl_DriverBlockModeProc * (*tcl_ChannelBlockModeProc) (const Tcl_ChannelType *chanTypePtr); /* 400 */
Tcl_DriverCloseProc * (*tcl_ChannelCloseProc) (const Tcl_ChannelType *chanTypePtr); /* 401 */
TCL_DEPRECATED_API("Use Tcl_ChannelClose2Proc") Tcl_DriverCloseProc * (*tcl_ChannelCloseProc) (const Tcl_ChannelType *chanTypePtr); /* 401 */
Tcl_DriverClose2Proc * (*tcl_ChannelClose2Proc) (const Tcl_ChannelType *chanTypePtr); /* 402 */
Tcl_DriverInputProc * (*tcl_ChannelInputProc) (const Tcl_ChannelType *chanTypePtr); /* 403 */
Tcl_DriverOutputProc * (*tcl_ChannelOutputProc) (const Tcl_ChannelType *chanTypePtr); /* 404 */
Tcl_DriverSeekProc * (*tcl_ChannelSeekProc) (const Tcl_ChannelType *chanTypePtr); /* 405 */
TCL_DEPRECATED_API("Use Tcl_ChannelWideSeekProc") Tcl_DriverSeekProc * (*tcl_ChannelSeekProc) (const Tcl_ChannelType *chanTypePtr); /* 405 */
Tcl_DriverSetOptionProc * (*tcl_ChannelSetOptionProc) (const Tcl_ChannelType *chanTypePtr); /* 406 */
Tcl_DriverGetOptionProc * (*tcl_ChannelGetOptionProc) (const Tcl_ChannelType *chanTypePtr); /* 407 */
Tcl_DriverWatchProc * (*tcl_ChannelWatchProc) (const Tcl_ChannelType *chanTypePtr); /* 408 */
@@ -2367,8 +2375,8 @@ typedef struct TclStubs {
void (*tcl_SpliceChannel) (Tcl_Channel channel); /* 416 */
void (*tcl_ClearChannelHandlers) (Tcl_Channel channel); /* 417 */
int (*tcl_IsChannelExisting) (const char *channelName); /* 418 */
int (*tcl_UniCharNcasecmp) (const Tcl_UniChar *ucs, const Tcl_UniChar *uct, unsigned long numChars); /* 419 */
int (*tcl_UniCharCaseMatch) (const Tcl_UniChar *uniStr, const Tcl_UniChar *uniPattern, int nocase); /* 420 */
TCL_DEPRECATED_API("Use Tcl_UtfNcasecmp") int (*tcl_UniCharNcasecmp) (const Tcl_UniChar *ucs, const Tcl_UniChar *uct, unsigned long numChars); /* 419 */
TCL_DEPRECATED_API("Use Tcl_StringCaseMatch") int (*tcl_UniCharCaseMatch) (const Tcl_UniChar *uniStr, const Tcl_UniChar *uniPattern, int nocase); /* 420 */
Tcl_HashEntry * (*tcl_FindHashEntry) (Tcl_HashTable *tablePtr, const void *key); /* 421 */
Tcl_HashEntry * (*tcl_CreateHashEntry) (Tcl_HashTable *tablePtr, const void *key, int *newPtr); /* 422 */
void (*tcl_InitCustomHashTable) (Tcl_HashTable *tablePtr, int keyType, const Tcl_HashKeyType *typePtr); /* 423 */
@@ -2503,18 +2511,18 @@ typedef struct TclStubs {
void (*tcl_SetTimeProc) (Tcl_GetTimeProc *getProc, Tcl_ScaleTimeProc *scaleProc, ClientData clientData); /* 552 */
void (*tcl_QueryTimeProc) (Tcl_GetTimeProc **getProc, Tcl_ScaleTimeProc **scaleProc, ClientData *clientData); /* 553 */
Tcl_DriverThreadActionProc * (*tcl_ChannelThreadActionProc) (const Tcl_ChannelType *chanTypePtr); /* 554 */
Tcl_Obj * (*tcl_NewBignumObj) (mp_int *value); /* 555 */
Tcl_Obj * (*tcl_DbNewBignumObj) (mp_int *value, const char *file, int line); /* 556 */
void (*tcl_SetBignumObj) (Tcl_Obj *obj, mp_int *value); /* 557 */
int (*tcl_GetBignumFromObj) (Tcl_Interp *interp, Tcl_Obj *obj, mp_int *value); /* 558 */
int (*tcl_TakeBignumFromObj) (Tcl_Interp *interp, Tcl_Obj *obj, mp_int *value); /* 559 */
Tcl_Obj * (*tcl_NewBignumObj) (void *value); /* 555 */
Tcl_Obj * (*tcl_DbNewBignumObj) (void *value, const char *file, int line); /* 556 */
void (*tcl_SetBignumObj) (Tcl_Obj *obj, void *value); /* 557 */
int (*tcl_GetBignumFromObj) (Tcl_Interp *interp, Tcl_Obj *obj, void *value); /* 558 */
int (*tcl_TakeBignumFromObj) (Tcl_Interp *interp, Tcl_Obj *obj, void *value); /* 559 */
int (*tcl_TruncateChannel) (Tcl_Channel chan, Tcl_WideInt length); /* 560 */
Tcl_DriverTruncateProc * (*tcl_ChannelTruncateProc) (const Tcl_ChannelType *chanTypePtr); /* 561 */
void (*tcl_SetChannelErrorInterp) (Tcl_Interp *interp, Tcl_Obj *msg); /* 562 */
void (*tcl_GetChannelErrorInterp) (Tcl_Interp *interp, Tcl_Obj **msg); /* 563 */
void (*tcl_SetChannelError) (Tcl_Channel chan, Tcl_Obj *msg); /* 564 */
void (*tcl_GetChannelError) (Tcl_Channel chan, Tcl_Obj **msg); /* 565 */
int (*tcl_InitBignumFromDouble) (Tcl_Interp *interp, double initval, mp_int *toInit); /* 566 */
int (*tcl_InitBignumFromDouble) (Tcl_Interp *interp, double initval, void *toInit); /* 566 */
Tcl_Obj * (*tcl_GetNamespaceUnknownHandler) (Tcl_Interp *interp, Tcl_Namespace *nsPtr); /* 567 */
int (*tcl_SetNamespaceUnknownHandler) (Tcl_Interp *interp, Tcl_Namespace *nsPtr, Tcl_Obj *handlerPtr); /* 568 */
int (*tcl_GetEncodingFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_Encoding *encodingPtr); /* 569 */
@@ -2555,7 +2563,7 @@ typedef struct TclStubs {
int (*tcl_ParseArgsObjv) (Tcl_Interp *interp, const Tcl_ArgvInfo *argTable, int *objcPtr, Tcl_Obj *const *objv, Tcl_Obj ***remObjv); /* 604 */
int (*tcl_GetErrorLine) (Tcl_Interp *interp); /* 605 */
void (*tcl_SetErrorLine) (Tcl_Interp *interp, int lineNum); /* 606 */
void (*tcl_TransferResult) (Tcl_Interp *sourceInterp, int result, Tcl_Interp *targetInterp); /* 607 */
void (*tcl_TransferResult) (Tcl_Interp *sourceInterp, int code, Tcl_Interp *targetInterp); /* 607 */
int (*tcl_InterpActive) (Tcl_Interp *interp); /* 608 */
void (*tcl_BackgroundException) (Tcl_Interp *interp, int code); /* 609 */
int (*tcl_ZlibDeflate) (Tcl_Interp *interp, int format, Tcl_Obj *data, int level, Tcl_Obj *gzipHeaderDictObj); /* 610 */
@@ -4009,7 +4017,22 @@ extern const TclStubs *tclStubsPtr;
#define Tcl_AddObjErrorInfo(interp, message, length) \
Tcl_AppendObjToErrorInfo(interp, Tcl_NewStringObj(message, length))
#ifdef TCL_NO_DEPRECATED
#undef Tcl_FreeResult
#undef Tcl_AppendResultVA
#undef Tcl_AppendStringsToObjVA
#undef Tcl_SetErrorCodeVA
#undef Tcl_VarEvalVA
#undef Tcl_PanicVA
#undef Tcl_GetStringResult
#undef Tcl_GetDefaultEncodingDir
#undef Tcl_SetDefaultEncodingDir
#undef Tcl_UniCharLen
#undef Tcl_UniCharNcmp
#undef Tcl_EvalTokens
#undef Tcl_UniCharNcasecmp
#undef Tcl_UniCharCaseMatch
#undef Tcl_GetMathFuncInfo
#undef Tcl_ListMathFuncs
#define Tcl_GetStringResult(interp) Tcl_GetString(Tcl_GetObjResult(interp))
#undef Tcl_Eval
#define Tcl_Eval(interp, objPtr) \
@@ -4037,14 +4060,14 @@ extern const TclStubs *tclStubsPtr;
#undef Tcl_SetResult
#define Tcl_SetResult(interp, result, freeProc) \
do { \
char *__result = result; \
const char *__result = result; \
Tcl_FreeProc *__freeProc = freeProc; \
Tcl_SetObjResult(interp, Tcl_NewStringObj(__result, -1)); \
if (__result != NULL && __freeProc != NULL && __freeProc != TCL_VOLATILE) { \
if (__freeProc == TCL_DYNAMIC) { \
ckfree(__result); \
ckfree((char *)__result); \
} else { \
(*__freeProc)(__result); \
(*__freeProc)((char *)__result); \
} \
} \
} while(0)
@@ -4109,7 +4132,7 @@ extern const TclStubs *tclStubsPtr;
#undef Tcl_StringMatch
#define Tcl_StringMatch(str, pattern) Tcl_StringCaseMatch((str), (pattern), 0)
#if TCL_UTF_MAX <= 4
#if TCL_UTF_MAX <= 3
# undef Tcl_UniCharToUtfDString
# define Tcl_UniCharToUtfDString Tcl_Char16ToUtfDString
# undef Tcl_UtfToUniCharDString
@@ -4150,4 +4173,9 @@ extern const TclStubs *tclStubsPtr;
#define Tcl_GlobalEvalObj(interp, objPtr) \
Tcl_EvalObjEx(interp, objPtr, TCL_EVAL_GLOBAL)
#if defined(TCL_NO_DEPRECATED) && defined(USE_TCL_STUBS)
#undef Tcl_Close
#define Tcl_Close(interp, chan) Tcl_CloseEx(interp, chan, 0)
#endif
#endif /* _TCLDECLS */
+109 -121
View File
@@ -23,62 +23,44 @@ struct Dict;
* Prototypes for functions defined later in this file:
*/
static void DeleteDict(struct Dict *dict);
static int DictAppendCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const *objv);
static int DictCreateCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const *objv);
static int DictExistsCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const *objv);
static int DictFilterCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const *objv);
static int DictGetCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const *objv);
static int DictGetDefCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const *objv);
static int DictIncrCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const *objv);
static int DictInfoCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const *objv);
static int DictKeysCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const *objv);
static int DictLappendCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const *objv);
static int DictMergeCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const *objv);
static int DictRemoveCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const *objv);
static int DictReplaceCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const *objv);
static int DictSetCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const *objv);
static int DictSizeCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const *objv);
static int DictUnsetCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const *objv);
static int DictUpdateCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const *objv);
static int DictValuesCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const *objv);
static int DictWithCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const *objv);
static void DupDictInternalRep(Tcl_Obj *srcPtr, Tcl_Obj *copyPtr);
static void FreeDictInternalRep(Tcl_Obj *dictPtr);
static void InvalidateDictChain(Tcl_Obj *dictObj);
static int SetDictFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr);
static void UpdateStringOfDict(Tcl_Obj *dictPtr);
static Tcl_HashEntry * AllocChainEntry(Tcl_HashTable *tablePtr,void *keyPtr);
static inline void InitChainTable(struct Dict *dict);
static inline void DeleteChainTable(struct Dict *dict);
static inline Tcl_HashEntry *CreateChainEntry(struct Dict *dict,
Tcl_Obj *keyPtr, int *newPtr);
static inline int DeleteChainEntry(struct Dict *dict, Tcl_Obj *keyPtr);
static Tcl_NRPostProc FinalizeDictUpdate;
static Tcl_NRPostProc FinalizeDictWith;
static Tcl_ObjCmdProc DictForNRCmd;
static Tcl_ObjCmdProc DictMapNRCmd;
static Tcl_NRPostProc DictForLoopCallback;
static Tcl_NRPostProc DictMapLoopCallback;
static void DeleteDict(struct Dict *dict);
static Tcl_ObjCmdProc DictAppendCmd;
static Tcl_ObjCmdProc DictCreateCmd;
static Tcl_ObjCmdProc DictExistsCmd;
static Tcl_ObjCmdProc DictFilterCmd;
static Tcl_ObjCmdProc DictGetCmd;
static Tcl_ObjCmdProc DictGetDefCmd;
static Tcl_ObjCmdProc DictIncrCmd;
static Tcl_ObjCmdProc DictInfoCmd;
static Tcl_ObjCmdProc DictKeysCmd;
static Tcl_ObjCmdProc DictLappendCmd;
static Tcl_ObjCmdProc DictMergeCmd;
static Tcl_ObjCmdProc DictRemoveCmd;
static Tcl_ObjCmdProc DictReplaceCmd;
static Tcl_ObjCmdProc DictSetCmd;
static Tcl_ObjCmdProc DictSizeCmd;
static Tcl_ObjCmdProc DictUnsetCmd;
static Tcl_ObjCmdProc DictUpdateCmd;
static Tcl_ObjCmdProc DictValuesCmd;
static Tcl_ObjCmdProc DictWithCmd;
static Tcl_DupInternalRepProc DupDictInternalRep;
static Tcl_FreeInternalRepProc FreeDictInternalRep;
static void InvalidateDictChain(Tcl_Obj *dictObj);
static Tcl_SetFromAnyProc SetDictFromAny;
static Tcl_UpdateStringProc UpdateStringOfDict;
static Tcl_AllocHashEntryProc AllocChainEntry;
static inline void InitChainTable(struct Dict *dict);
static inline void DeleteChainTable(struct Dict *dict);
static inline Tcl_HashEntry * CreateChainEntry(struct Dict *dict,
Tcl_Obj *keyPtr, int *newPtr);
static inline int DeleteChainEntry(struct Dict *dict,
Tcl_Obj *keyPtr);
static Tcl_NRPostProc FinalizeDictUpdate;
static Tcl_NRPostProc FinalizeDictWith;
static Tcl_ObjCmdProc DictForNRCmd;
static Tcl_ObjCmdProc DictMapNRCmd;
static Tcl_NRPostProc DictForLoopCallback;
static Tcl_NRPostProc DictMapLoopCallback;
/*
* Table of dict subcommand names and implementations.
@@ -179,7 +161,7 @@ const Tcl_ObjType tclDictType = {
do { \
const Tcl_ObjIntRep *irPtr; \
irPtr = TclFetchIntRep((objPtr), &tclDictType); \
(dictRepPtr) = irPtr ? irPtr->twoPtrValue.ptr1 : NULL; \
(dictRepPtr) = irPtr ? (Dict *)irPtr->twoPtrValue.ptr1 : NULL; \
} while (0)
/*
@@ -240,13 +222,13 @@ typedef struct {
static Tcl_HashEntry *
AllocChainEntry(
Tcl_HashTable *tablePtr,
TCL_UNUSED(Tcl_HashTable *),
void *keyPtr)
{
Tcl_Obj *objPtr = keyPtr;
Tcl_Obj *objPtr = (Tcl_Obj *)keyPtr;
ChainEntry *cPtr;
cPtr = ckalloc(sizeof(ChainEntry));
cPtr = (ChainEntry *)ckalloc(sizeof(ChainEntry));
cPtr->entry.key.objPtr = objPtr;
Tcl_IncrRefCount(objPtr);
cPtr->entry.clientData = NULL;
@@ -279,7 +261,7 @@ DeleteChainTable(
ChainEntry *cPtr;
for (cPtr=dict->entryChainHead ; cPtr!=NULL ; cPtr=cPtr->nextPtr) {
Tcl_Obj *valuePtr = Tcl_GetHashValue(&cPtr->entry);
Tcl_Obj *valuePtr = (Tcl_Obj *)Tcl_GetHashValue(&cPtr->entry);
TclDecrRefCount(valuePtr);
}
@@ -326,7 +308,7 @@ DeleteChainEntry(
if (cPtr == NULL) {
return 0;
} else {
Tcl_Obj *valuePtr = Tcl_GetHashValue(&cPtr->entry);
Tcl_Obj *valuePtr = (Tcl_Obj *)Tcl_GetHashValue(&cPtr->entry);
TclDecrRefCount(valuePtr);
}
@@ -377,7 +359,7 @@ DupDictInternalRep(
Tcl_Obj *srcPtr,
Tcl_Obj *copyPtr)
{
Dict *oldDict, *newDict = ckalloc(sizeof(Dict));
Dict *oldDict, *newDict = (Dict *)ckalloc(sizeof(Dict));
ChainEntry *cPtr;
DictGetIntRep(srcPtr, oldDict);
@@ -388,8 +370,8 @@ DupDictInternalRep(
InitChainTable(newDict);
for (cPtr=oldDict->entryChainHead ; cPtr!=NULL ; cPtr=cPtr->nextPtr) {
Tcl_Obj *key = Tcl_GetHashKey(&oldDict->table, &cPtr->entry);
Tcl_Obj *valuePtr = Tcl_GetHashValue(&cPtr->entry);
Tcl_Obj *key = (Tcl_Obj *)Tcl_GetHashKey(&oldDict->table, &cPtr->entry);
Tcl_Obj *valuePtr = (Tcl_Obj *)Tcl_GetHashValue(&cPtr->entry);
int n;
Tcl_HashEntry *hPtr = CreateChainEntry(newDict, key, &n);
@@ -536,7 +518,7 @@ UpdateStringOfDict(
if (numElems <= LOCAL_SIZE) {
flagPtr = localFlags;
} else {
flagPtr = ckalloc(numElems);
flagPtr = (char *)ckalloc(numElems);
}
for (i=0,cPtr=dict->entryChainHead; i<numElems; i+=2,cPtr=cPtr->nextPtr) {
/*
@@ -545,7 +527,7 @@ UpdateStringOfDict(
*/
flagPtr[i] = ( i ? TCL_DONT_QUOTE_HASH : 0 );
keyPtr = Tcl_GetHashKey(&dict->table, &cPtr->entry);
keyPtr = (Tcl_Obj *)Tcl_GetHashKey(&dict->table, &cPtr->entry);
elem = TclGetStringFromObj(keyPtr, &length);
bytesNeeded += TclScanElement(elem, length, flagPtr+i);
if (bytesNeeded < 0) {
@@ -553,7 +535,7 @@ UpdateStringOfDict(
}
flagPtr[i+1] = TCL_DONT_QUOTE_HASH;
valuePtr = Tcl_GetHashValue(&cPtr->entry);
valuePtr = (Tcl_Obj *)Tcl_GetHashValue(&cPtr->entry);
elem = TclGetStringFromObj(valuePtr, &length);
bytesNeeded += TclScanElement(elem, length, flagPtr+i+1);
if (bytesNeeded < 0) {
@@ -573,13 +555,13 @@ UpdateStringOfDict(
TclOOM(dst, bytesNeeded);
for (i=0,cPtr=dict->entryChainHead; i<numElems; i+=2,cPtr=cPtr->nextPtr) {
flagPtr[i] |= ( i ? TCL_DONT_QUOTE_HASH : 0 );
keyPtr = Tcl_GetHashKey(&dict->table, &cPtr->entry);
keyPtr = (Tcl_Obj *)Tcl_GetHashKey(&dict->table, &cPtr->entry);
elem = TclGetStringFromObj(keyPtr, &length);
dst += TclConvertElement(elem, length, dst, flagPtr[i]);
*dst++ = ' ';
flagPtr[i+1] |= TCL_DONT_QUOTE_HASH;
valuePtr = Tcl_GetHashValue(&cPtr->entry);
valuePtr = (Tcl_Obj *)Tcl_GetHashValue(&cPtr->entry);
elem = TclGetStringFromObj(valuePtr, &length);
dst += TclConvertElement(elem, length, dst, flagPtr[i+1]);
*dst++ = ' ';
@@ -618,7 +600,7 @@ SetDictFromAny(
{
Tcl_HashEntry *hPtr;
int isNew;
Dict *dict = ckalloc(sizeof(Dict));
Dict *dict = (Dict *)ckalloc(sizeof(Dict));
InitChainTable(dict);
@@ -643,7 +625,7 @@ SetDictFromAny(
/* Store key and value in the hash table we're building. */
hPtr = CreateChainEntry(dict, objv[i], &isNew);
if (!isNew) {
Tcl_Obj *discardedValue = Tcl_GetHashValue(hPtr);
Tcl_Obj *discardedValue = (Tcl_Obj *)Tcl_GetHashValue(hPtr);
/*
* Not really a well-formed dictionary as there are duplicate
@@ -716,7 +698,7 @@ SetDictFromAny(
/* Store key and value in the hash table we're building. */
hPtr = CreateChainEntry(dict, keyPtr, &isNew);
if (!isNew) {
Tcl_Obj *discardedValue = Tcl_GetHashValue(hPtr);
Tcl_Obj *discardedValue = (Tcl_Obj *)Tcl_GetHashValue(hPtr);
TclDecrRefCount(keyPtr);
TclDecrRefCount(discardedValue);
@@ -851,7 +833,7 @@ TclTraceDictPath(
Tcl_IncrRefCount(tmpObj);
Tcl_SetHashValue(hPtr, tmpObj);
} else {
tmpObj = Tcl_GetHashValue(hPtr);
tmpObj = (Tcl_Obj *)Tcl_GetHashValue(hPtr);
DictGetIntRep(tmpObj, newDict);
@@ -972,7 +954,7 @@ Tcl_DictObjPut(
DictSetIntRep(dictPtr, dict);
Tcl_IncrRefCount(valuePtr);
if (!isNew) {
Tcl_Obj *oldValuePtr = Tcl_GetHashValue(hPtr);
Tcl_Obj *oldValuePtr = (Tcl_Obj *)Tcl_GetHashValue(hPtr);
TclDecrRefCount(oldValuePtr);
}
@@ -1021,7 +1003,7 @@ Tcl_DictObjGet(
if (hPtr == NULL) {
*valuePtrPtr = NULL;
} else {
*valuePtrPtr = Tcl_GetHashValue(hPtr);
*valuePtrPtr = (Tcl_Obj *)Tcl_GetHashValue(hPtr);
}
return TCL_OK;
}
@@ -1162,10 +1144,10 @@ Tcl_DictObjFirst(
searchPtr->next = cPtr->nextPtr;
dict->refCount++;
if (keyPtrPtr != NULL) {
*keyPtrPtr = Tcl_GetHashKey(&dict->table, &cPtr->entry);
*keyPtrPtr = (Tcl_Obj *)Tcl_GetHashKey(&dict->table, &cPtr->entry);
}
if (valuePtrPtr != NULL) {
*valuePtrPtr = Tcl_GetHashValue(&cPtr->entry);
*valuePtrPtr = (Tcl_Obj *)Tcl_GetHashValue(&cPtr->entry);
}
}
return TCL_OK;
@@ -1228,7 +1210,7 @@ Tcl_DictObjNext(
Tcl_Panic("concurrent dictionary modification and search");
}
cPtr = searchPtr->next;
cPtr = (ChainEntry *)searchPtr->next;
if (cPtr == NULL) {
Tcl_DictObjDone(searchPtr);
*donePtr = 1;
@@ -1238,11 +1220,11 @@ Tcl_DictObjNext(
searchPtr->next = cPtr->nextPtr;
*donePtr = 0;
if (keyPtrPtr != NULL) {
*keyPtrPtr = Tcl_GetHashKey(
*keyPtrPtr = (Tcl_Obj *)Tcl_GetHashKey(
&((Dict *)searchPtr->dictionaryPtr)->table, &cPtr->entry);
}
if (valuePtrPtr != NULL) {
*valuePtrPtr = Tcl_GetHashValue(&cPtr->entry);
*valuePtrPtr = (Tcl_Obj *)Tcl_GetHashValue(&cPtr->entry);
}
}
@@ -1329,7 +1311,7 @@ Tcl_DictObjPutKeyList(
hPtr = CreateChainEntry(dict, keyv[keyc-1], &isNew);
Tcl_IncrRefCount(valuePtr);
if (!isNew) {
Tcl_Obj *oldValuePtr = Tcl_GetHashValue(hPtr);
Tcl_Obj *oldValuePtr = (Tcl_Obj *)Tcl_GetHashValue(hPtr);
TclDecrRefCount(oldValuePtr);
}
@@ -1424,7 +1406,7 @@ Tcl_NewDictObj(void)
TclNewObj(dictPtr);
TclInvalidateStringRep(dictPtr);
dict = ckalloc(sizeof(Dict));
dict = (Dict *)ckalloc(sizeof(Dict));
InitChainTable(dict);
dict->epoch = 1;
dict->chain = NULL;
@@ -1461,28 +1443,34 @@ Tcl_NewDictObj(void)
*----------------------------------------------------------------------
*/
#ifdef TCL_MEM_DEBUG
Tcl_Obj *
Tcl_DbNewDictObj(
const char *file,
int line)
{
#ifdef TCL_MEM_DEBUG
Tcl_Obj *dictPtr;
Dict *dict;
TclDbNewObj(dictPtr, file, line);
TclInvalidateStringRep(dictPtr);
dict = ckalloc(sizeof(Dict));
dict = (Dict *)ckalloc(sizeof(Dict));
InitChainTable(dict);
dict->epoch = 1;
dict->chain = NULL;
dict->refCount = 1;
DictSetIntRep(dictPtr, dict);
return dictPtr;
#else /* !TCL_MEM_DEBUG */
return Tcl_NewDictObj();
#endif
}
#else /* !TCL_MEM_DEBUG */
Tcl_Obj *
Tcl_DbNewDictObj(
TCL_UNUSED(const char *) /*file*/,
TCL_UNUSED(int) /*line*/)
{
return Tcl_NewDictObj();
}
#endif
/***** START OF FUNCTIONS IMPLEMENTING TCL COMMANDS *****/
@@ -1506,7 +1494,7 @@ Tcl_DbNewDictObj(
static int
DictCreateCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -1556,7 +1544,7 @@ DictCreateCmd(
static int
DictGetCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -1649,7 +1637,7 @@ DictGetCmd(
static int
DictGetDefCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -1714,7 +1702,7 @@ DictGetDefCmd(
static int
DictReplaceCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -1762,7 +1750,7 @@ DictReplaceCmd(
static int
DictRemoveCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -1810,7 +1798,7 @@ DictRemoveCmd(
static int
DictMergeCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -1897,7 +1885,7 @@ DictMergeCmd(
static int
DictKeysCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -1976,7 +1964,7 @@ DictKeysCmd(
static int
DictValuesCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -2036,7 +2024,7 @@ DictValuesCmd(
static int
DictSizeCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -2074,7 +2062,7 @@ DictSizeCmd(
static int
DictExistsCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -2116,7 +2104,7 @@ DictExistsCmd(
static int
DictInfoCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -2160,7 +2148,7 @@ DictInfoCmd(
static int
DictIncrCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -2280,7 +2268,7 @@ DictIncrCmd(
static int
DictLappendCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -2367,7 +2355,7 @@ DictLappendCmd(
static int
DictAppendCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -2469,7 +2457,7 @@ DictAppendCmd(
static int
DictForNRCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -2499,7 +2487,7 @@ DictForNRCmd(
Tcl_SetErrorCode(interp, "TCL", "SYNTAX", "dict", "for", NULL);
return TCL_ERROR;
}
searchPtr = TclStackAlloc(interp, sizeof(Tcl_DictSearch));
searchPtr = (Tcl_DictSearch *)TclStackAlloc(interp, sizeof(Tcl_DictSearch));
if (Tcl_DictObjFirst(interp, objv[2], searchPtr, &keyObj, &valueObj,
&done) != TCL_OK) {
TclStackFree(interp, searchPtr);
@@ -2569,10 +2557,10 @@ DictForLoopCallback(
int result)
{
Interp *iPtr = (Interp *) interp;
Tcl_DictSearch *searchPtr = data[0];
Tcl_Obj *keyVarObj = data[1];
Tcl_Obj *valueVarObj = data[2];
Tcl_Obj *scriptObj = data[3];
Tcl_DictSearch *searchPtr = (Tcl_DictSearch *)data[0];
Tcl_Obj *keyVarObj = (Tcl_Obj *)data[1];
Tcl_Obj *valueVarObj = (Tcl_Obj *)data[2];
Tcl_Obj *scriptObj = (Tcl_Obj *)data[3];
Tcl_Obj *keyObj, *valueObj;
int done;
@@ -2664,7 +2652,7 @@ DictForLoopCallback(
static int
DictMapNRCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -2693,7 +2681,7 @@ DictMapNRCmd(
Tcl_SetErrorCode(interp, "TCL", "SYNTAX", "dict", "map", NULL);
return TCL_ERROR;
}
storagePtr = TclStackAlloc(interp, sizeof(DictMapStorage));
storagePtr = (DictMapStorage *)TclStackAlloc(interp, sizeof(DictMapStorage));
if (Tcl_DictObjFirst(interp, objv[2], &storagePtr->search, &keyObj,
&valueObj, &done) != TCL_OK) {
TclStackFree(interp, storagePtr);
@@ -2773,7 +2761,7 @@ DictMapLoopCallback(
int result)
{
Interp *iPtr = (Interp *) interp;
DictMapStorage *storagePtr = data[0];
DictMapStorage *storagePtr = (DictMapStorage *)data[0];
Tcl_Obj *keyObj, *valueObj;
int done;
@@ -2876,7 +2864,7 @@ DictMapLoopCallback(
static int
DictSetCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -2936,7 +2924,7 @@ DictSetCmd(
static int
DictUnsetCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -2995,7 +2983,7 @@ DictUnsetCmd(
static int
DictFilterCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -3280,7 +3268,7 @@ DictFilterCmd(
static int
DictUpdateCmd(
ClientData clientData,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -3341,8 +3329,8 @@ FinalizeDictUpdate(
Tcl_Obj *dictPtr, *objPtr, **objv;
Tcl_InterpState state;
int i, objc;
Tcl_Obj *varName = data[0];
Tcl_Obj *argsObj = data[1];
Tcl_Obj *varName = (Tcl_Obj *)data[0];
Tcl_Obj *argsObj = (Tcl_Obj *)data[1];
/*
* ErrorInfo handling.
@@ -3438,7 +3426,7 @@ FinalizeDictUpdate(
static int
DictWithCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -3492,9 +3480,9 @@ FinalizeDictWith(
Tcl_Obj **pathv;
int pathc;
Tcl_InterpState state;
Tcl_Obj *varName = data[0];
Tcl_Obj *keysPtr = data[1];
Tcl_Obj *pathPtr = data[2];
Tcl_Obj *varName = (Tcl_Obj *)data[0];
Tcl_Obj *keysPtr = (Tcl_Obj *)data[1];
Tcl_Obj *pathPtr = (Tcl_Obj *)data[2];
Var *varPtr, *arrayPtr;
if (result == TCL_ERROR) {
+13 -18
View File
@@ -21,10 +21,8 @@
* Prototypes for procedures defined later in this file:
*/
static Tcl_Obj * DisassembleByteCodeAsDicts(Tcl_Interp *interp,
Tcl_Obj *objPtr);
static Tcl_Obj * DisassembleByteCodeObj(Tcl_Interp *interp,
Tcl_Obj *objPtr);
static Tcl_Obj * DisassembleByteCodeAsDicts(Tcl_Obj *objPtr);
static Tcl_Obj * DisassembleByteCodeObj(Tcl_Obj *objPtr);
static int FormatInstruction(ByteCode *codePtr,
const unsigned char *pc, Tcl_Obj *bufferObj);
static void GetLocationInformation(Proc *procPtr,
@@ -132,10 +130,10 @@ GetLocationInformation(
void
TclPrintByteCodeObj(
Tcl_Interp *interp, /* Used only for getting location info. */
TCL_UNUSED(Tcl_Interp *), /* Stuck with this in internal stubs */
Tcl_Obj *objPtr) /* The bytecode object to disassemble. */
{
Tcl_Obj *bufPtr = DisassembleByteCodeObj(interp, objPtr);
Tcl_Obj *bufPtr = DisassembleByteCodeObj(objPtr);
fprintf(stdout, "\n%s", TclGetString(bufPtr));
Tcl_DecrRefCount(bufPtr);
@@ -251,7 +249,6 @@ TclPrintSource(
static Tcl_Obj *
DisassembleByteCodeObj(
Tcl_Interp *interp,
Tcl_Obj *objPtr) /* The bytecode object to disassemble. */
{
ByteCode *codePtr;
@@ -903,24 +900,24 @@ PrintSourceToObj(
i += 2;
continue;
default:
#if TCL_UTF_MAX > 4
if (ch > 0xffff) {
#if TCL_UTF_MAX > 3
if (ch > 0xFFFF) {
Tcl_AppendPrintfToObj(appendObj, "\\U%08x", ch);
i += 10;
} else
#else
/* If len == 0, this means we have a char > 0xffff, resulting in
/* If len == 0, this means we have a char > 0xFFFF, resulting in
* TclUtfToUniChar producing a surrogate pair. We want to output
* this pair as a single Unicode character.
*/
if (len == 0) {
int upper = ((ch & 0x3ff) + 1) << 10;
int upper = ((ch & 0x3FF) + 1) << 10;
len = TclUtfToUniChar(p, &ch);
Tcl_AppendPrintfToObj(appendObj, "\\U%08x", upper + (ch & 0x3ff));
Tcl_AppendPrintfToObj(appendObj, "\\U%08x", upper + (ch & 0x3FF));
i += 10;
} else
#endif
if (ch < 0x20 || ch >= 0x7f) {
if (ch < 0x20 || ch >= 0x7F) {
Tcl_AppendPrintfToObj(appendObj, "\\u%04x", ch);
i += 6;
} else {
@@ -952,8 +949,6 @@ PrintSourceToObj(
static Tcl_Obj *
DisassembleByteCodeAsDicts(
Tcl_Interp *interp, /* Used for looking up the CmdFrame for the
* procedure, if one exists. */
Tcl_Obj *objPtr) /* The bytecode-holding value to take apart */
{
ByteCode *codePtr;
@@ -1577,7 +1572,7 @@ Tcl_DisassembleObjCmd(
TclGetString(objv[3]), NULL);
return TCL_ERROR;
}
procPtr = TclOOGetProcFromMethod(Tcl_GetHashValue(hPtr));
procPtr = TclOOGetProcFromMethod((Method *)Tcl_GetHashValue(hPtr));
if (procPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"body not available for this kind of method", -1));
@@ -1624,10 +1619,10 @@ Tcl_DisassembleObjCmd(
}
if (clientData) {
Tcl_SetObjResult(interp,
DisassembleByteCodeAsDicts(interp, codeObjPtr));
DisassembleByteCodeAsDicts(codeObjPtr));
} else {
Tcl_SetObjResult(interp,
DisassembleByteCodeObj(interp, codeObjPtr));
DisassembleByteCodeObj(codeObjPtr));
}
return TCL_OK;
}
+109 -182
View File
@@ -195,85 +195,41 @@ static unsigned short emptyPage[256];
* Functions used only in this module.
*/
static int BinaryProc(ClientData clientData,
const char *src, int srcLen, int flags,
Tcl_EncodingState *statePtr, char *dst, int dstLen,
int *srcReadPtr, int *dstWrotePtr,
int *dstCharsPtr);
static void DupEncodingIntRep(Tcl_Obj *srcPtr, Tcl_Obj *dupPtr);
static void EscapeFreeProc(ClientData clientData);
static int EscapeFromUtfProc(ClientData clientData,
const char *src, int srcLen, int flags,
Tcl_EncodingState *statePtr, char *dst, int dstLen,
int *srcReadPtr, int *dstWrotePtr,
int *dstCharsPtr);
static int EscapeToUtfProc(ClientData clientData,
const char *src, int srcLen, int flags,
Tcl_EncodingState *statePtr, char *dst, int dstLen,
int *srcReadPtr, int *dstWrotePtr,
int *dstCharsPtr);
static void FillEncodingFileMap(void);
static void FreeEncoding(Tcl_Encoding encoding);
static void FreeEncodingIntRep(Tcl_Obj *objPtr);
static Encoding * GetTableEncoding(EscapeEncodingData *dataPtr,
int state);
static Tcl_Encoding LoadEncodingFile(Tcl_Interp *interp, const char *name);
static Tcl_Encoding LoadTableEncoding(const char *name, int type,
Tcl_Channel chan);
static Tcl_Encoding LoadEscapeEncoding(const char *name, Tcl_Channel chan);
static Tcl_Channel OpenEncodingFileChannel(Tcl_Interp *interp,
const char *name);
static void TableFreeProc(ClientData clientData);
static int TableFromUtfProc(ClientData clientData,
const char *src, int srcLen, int flags,
Tcl_EncodingState *statePtr, char *dst, int dstLen,
int *srcReadPtr, int *dstWrotePtr,
int *dstCharsPtr);
static int TableToUtfProc(ClientData clientData, const char *src,
int srcLen, int flags, Tcl_EncodingState *statePtr,
char *dst, int dstLen, int *srcReadPtr,
int *dstWrotePtr, int *dstCharsPtr);
static size_t unilen(const char *src);
static int Utf16ToUtfProc(ClientData clientData,
const char *src, int srcLen, int flags,
Tcl_EncodingState *statePtr, char *dst, int dstLen,
int *srcReadPtr, int *dstWrotePtr,
int *dstCharsPtr);
static int UtfToUtf16Proc(ClientData clientData,
const char *src, int srcLen, int flags,
Tcl_EncodingState *statePtr, char *dst, int dstLen,
int *srcReadPtr, int *dstWrotePtr,
int *dstCharsPtr);
static int UtfToUcs2Proc(ClientData clientData,
const char *src, int srcLen, int flags,
Tcl_EncodingState *statePtr, char *dst, int dstLen,
int *srcReadPtr, int *dstWrotePtr,
int *dstCharsPtr);
static int UtfToUtfProc(ClientData clientData,
const char *src, int srcLen, int flags,
Tcl_EncodingState *statePtr, char *dst, int dstLen,
int *srcReadPtr, int *dstWrotePtr,
int *dstCharsPtr, int pureNullMode);
static int UtfIntToUtfExtProc(ClientData clientData,
const char *src, int srcLen, int flags,
Tcl_EncodingState *statePtr, char *dst, int dstLen,
int *srcReadPtr, int *dstWrotePtr,
int *dstCharsPtr);
static int UtfExtToUtfIntProc(ClientData clientData,
const char *src, int srcLen, int flags,
Tcl_EncodingState *statePtr, char *dst, int dstLen,
int *srcReadPtr, int *dstWrotePtr,
int *dstCharsPtr);
static int Iso88591FromUtfProc(ClientData clientData,
const char *src, int srcLen, int flags,
Tcl_EncodingState *statePtr, char *dst, int dstLen,
int *srcReadPtr, int *dstWrotePtr,
int *dstCharsPtr);
static int Iso88591ToUtfProc(ClientData clientData,
const char *src, int srcLen, int flags,
Tcl_EncodingState *statePtr, char *dst,
int dstLen, int *srcReadPtr, int *dstWrotePtr,
int *dstCharsPtr);
static Tcl_EncodingConvertProc BinaryProc;
static Tcl_DupInternalRepProc DupEncodingIntRep;
static Tcl_EncodingFreeProc EscapeFreeProc;
static Tcl_EncodingConvertProc EscapeFromUtfProc;
static Tcl_EncodingConvertProc EscapeToUtfProc;
static void FillEncodingFileMap(void);
static void FreeEncoding(Tcl_Encoding encoding);
static Tcl_FreeInternalRepProc FreeEncodingIntRep;
static Encoding * GetTableEncoding(EscapeEncodingData *dataPtr,
int state);
static Tcl_Encoding LoadEncodingFile(Tcl_Interp *interp,
const char *name);
static Tcl_Encoding LoadTableEncoding(const char *name, int type,
Tcl_Channel chan);
static Tcl_Encoding LoadEscapeEncoding(const char *name,
Tcl_Channel chan);
static Tcl_Channel OpenEncodingFileChannel(Tcl_Interp *interp,
const char *name);
static Tcl_EncodingFreeProc TableFreeProc;
static Tcl_EncodingConvertProc TableFromUtfProc;
static Tcl_EncodingConvertProc TableToUtfProc;
static size_t unilen(const char *src);
static Tcl_EncodingConvertProc Utf16ToUtfProc;
static Tcl_EncodingConvertProc UtfToUtf16Proc;
static Tcl_EncodingConvertProc UtfToUcs2Proc;
static int UtfToUtfProc(ClientData clientData,
const char *src, int srcLen, int flags,
Tcl_EncodingState *statePtr, char *dst,
int dstLen, int *srcReadPtr,
int *dstWrotePtr, int *dstCharsPtr,
int pureNullMode);
static Tcl_EncodingConvertProc UtfIntToUtfExtProc;
static Tcl_EncodingConvertProc UtfExtToUtfIntProc;
static Tcl_EncodingConvertProc Iso88591FromUtfProc;
static Tcl_EncodingConvertProc Iso88591ToUtfProc;
/*
* A Tcl_ObjType for holding a cached Tcl_Encoding in the twoPtrValue.ptr1 field
@@ -296,7 +252,7 @@ static const Tcl_ObjType encodingType = {
do { \
const Tcl_ObjIntRep *irPtr; \
irPtr = TclFetchIntRep ((objPtr), &encodingType); \
(encoding) = irPtr ? irPtr->twoPtrValue.ptr1 : NULL; \
(encoding) = irPtr ? (Tcl_Encoding)irPtr->twoPtrValue.ptr1 : NULL; \
} while (0)
@@ -622,13 +578,13 @@ TclInitEncodingSubsystem(void)
type.freeProc = NULL;
type.nullSize = 2;
type.encodingName = "utf-16le";
type.clientData = INT2PTR(1);;
type.clientData = INT2PTR(1);
Tcl_CreateEncoding(&type);
type.encodingName = "utf-16be";
type.clientData = INT2PTR(0);
Tcl_CreateEncoding(&type);
type.encodingName = "utf-16";
type.clientData = INT2PTR(isLe.c);;
type.clientData = INT2PTR(isLe.c);
Tcl_CreateEncoding(&type);
#ifndef TCL_NO_DEPRECATED
@@ -643,14 +599,14 @@ TclInitEncodingSubsystem(void)
* code to duplicate the structure of a table encoding here.
*/
dataPtr = ckalloc(sizeof(TableEncodingData));
dataPtr = (TableEncodingData *)ckalloc(sizeof(TableEncodingData));
memset(dataPtr, 0, sizeof(TableEncodingData));
dataPtr->fallback = '?';
size = 256*(sizeof(unsigned short *) + sizeof(unsigned short));
dataPtr->toUnicode = ckalloc(size);
dataPtr->toUnicode = (unsigned short **)ckalloc(size);
memset(dataPtr->toUnicode, 0, size);
dataPtr->fromUnicode = ckalloc(size);
dataPtr->fromUnicode = (unsigned short **)ckalloc(size);
memset(dataPtr->fromUnicode, 0, size);
dataPtr->toUnicode[0] = (unsigned short *) (dataPtr->toUnicode + 256);
@@ -716,7 +672,7 @@ TclFinalizeEncodingSubsystem(void)
* cleaned up.
*/
FreeEncoding(Tcl_GetHashValue(hPtr));
FreeEncoding((Tcl_Encoding)Tcl_GetHashValue(hPtr));
hPtr = Tcl_FirstHashEntry(&encodingTable, &search);
}
@@ -827,7 +783,7 @@ Tcl_GetEncoding(
hPtr = Tcl_FindHashEntry(&encodingTable, name);
if (hPtr != NULL) {
encodingPtr = Tcl_GetHashValue(hPtr);
encodingPtr = (Encoding *)Tcl_GetHashValue(hPtr);
encodingPtr->refCount++;
Tcl_MutexUnlock(&encodingMutex);
return (Tcl_Encoding) encodingPtr;
@@ -972,7 +928,7 @@ Tcl_GetEncodingNames(
Tcl_MutexLock(&encodingMutex);
for (hPtr = Tcl_FirstHashEntry(&encodingTable, &search); hPtr != NULL;
hPtr = Tcl_NextHashEntry(&search)) {
Encoding *encodingPtr = Tcl_GetHashValue(hPtr);
Encoding *encodingPtr = (Encoding *)Tcl_GetHashValue(hPtr);
Tcl_CreateHashEntry(&table,
Tcl_NewStringObj(encodingPtr->name, -1), &dummy);
@@ -1089,7 +1045,7 @@ Tcl_CreateEncoding(
const Tcl_EncodingType *typePtr)
/* The encoding type. */
{
Encoding *encodingPtr = ckalloc(sizeof(Encoding));
Encoding *encodingPtr = (Encoding *)ckalloc(sizeof(Encoding));
encodingPtr->name = NULL;
encodingPtr->toUtfProc = typePtr->toUtfProc;
encodingPtr->fromUtfProc = typePtr->fromUtfProc;
@@ -1117,11 +1073,11 @@ Tcl_CreateEncoding(
* reference goes away.
*/
Encoding *replaceMe = Tcl_GetHashValue(hPtr);
Encoding *replaceMe = (Encoding *)Tcl_GetHashValue(hPtr);
replaceMe->hPtr = NULL;
}
name = ckalloc(strlen(typePtr->encodingName) + 1);
name = (char *)ckalloc(strlen(typePtr->encodingName) + 1);
encodingPtr->name = strcpy(name, typePtr->encodingName);
encodingPtr->hPtr = hPtr;
Tcl_SetHashValue(hPtr, encodingPtr);
@@ -1226,7 +1182,7 @@ Tcl_ExternalToUtfDString(
int
Tcl_ExternalToUtf(
Tcl_Interp *interp, /* Interp for error return, if not NULL. */
TCL_UNUSED(Tcl_Interp *), /* TODO: Re-examine this. */
Tcl_Encoding encoding, /* The encoding for the source string, or NULL
* for the default system encoding. */
const char *src, /* Source string in specified encoding. */
@@ -1417,7 +1373,7 @@ Tcl_UtfToExternalDString(
int
Tcl_UtfToExternal(
Tcl_Interp *interp, /* Interp for error return, if not NULL. */
TCL_UNUSED(Tcl_Interp *), /* TODO: Re-examine this. */
Tcl_Encoding encoding, /* The encoding for the converted string, or
* NULL for the default system encoding. */
const char *src, /* Source string in UTF-8. */
@@ -1788,7 +1744,7 @@ LoadTableEncoding(
#undef PAGESIZE
#define PAGESIZE (256 * sizeof(unsigned short))
dataPtr = ckalloc(sizeof(TableEncodingData));
dataPtr = (TableEncodingData *)ckalloc(sizeof(TableEncodingData));
memset(dataPtr, 0, sizeof(TableEncodingData));
dataPtr->fallback = fallback;
@@ -1800,7 +1756,7 @@ LoadTableEncoding(
*/
size = 256 * sizeof(unsigned short *) + numPages * PAGESIZE;
dataPtr->toUnicode = ckalloc(size);
dataPtr->toUnicode = (unsigned short **)ckalloc(size);
memset(dataPtr->toUnicode, 0, size);
pageMemPtr = (unsigned short *) (dataPtr->toUnicode + 256);
@@ -1819,7 +1775,7 @@ LoadTableEncoding(
dataPtr->toUnicode[hi] = pageMemPtr;
p += 2;
for (lo = 0; lo < 256; lo++) {
if ((lo & 0x0f) == 0) {
if ((lo & 0x0F) == 0) {
p++;
}
ch = (staticHex[UCHAR(p[0])] << 12) + (staticHex[UCHAR(p[1])] << 8)
@@ -1861,7 +1817,7 @@ LoadTableEncoding(
}
}
size = 256 * sizeof(unsigned short *) + numPages * PAGESIZE;
dataPtr->fromUnicode = ckalloc(size);
dataPtr->fromUnicode = (unsigned short **)ckalloc(size);
memset(dataPtr->fromUnicode, 0, size);
pageMemPtr = (unsigned short *) (dataPtr->fromUnicode + 256);
@@ -1880,7 +1836,7 @@ LoadTableEncoding(
pageMemPtr += 256;
dataPtr->fromUnicode[ch >> 8] = page;
}
page[ch & 0xff] = (unsigned short) ((hi << 8) + lo);
page[ch & 0xFF] = (unsigned short) ((hi << 8) + lo);
}
}
}
@@ -1893,8 +1849,8 @@ LoadTableEncoding(
*/
if (dataPtr->fromUnicode[0] != NULL) {
if (dataPtr->fromUnicode[0]['\\'] == '\0') {
dataPtr->fromUnicode[0]['\\'] = '\\';
if (dataPtr->fromUnicode[0][(int)'\\'] == '\0') {
dataPtr->fromUnicode[0][(int)'\\'] = '\\';
}
}
}
@@ -1986,7 +1942,7 @@ LoadTableEncoding(
if (from == 0) {
continue;
}
dataPtr->fromUnicode[from >> 8][from & 0xff] = to;
dataPtr->fromUnicode[from >> 8][from & 0xFF] = to;
}
}
doneParse:
@@ -2099,7 +2055,7 @@ LoadEscapeEncoding(
size = sizeof(EscapeEncodingData) - sizeof(EscapeSubTable)
+ Tcl_DStringLength(&escapeData);
dataPtr = ckalloc(size);
dataPtr = (EscapeEncodingData *)ckalloc(size);
dataPtr->initLen = strlen(init);
memcpy(dataPtr->init, init, dataPtr->initLen + 1);
dataPtr->finalLen = strlen(final);
@@ -2155,15 +2111,11 @@ LoadEscapeEncoding(
static int
BinaryProc(
ClientData clientData, /* Not used. */
TCL_UNUSED(ClientData),
const char *src, /* Source string (unknown encoding). */
int srcLen, /* Source string length in bytes. */
int flags, /* Conversion control flags. */
Tcl_EncodingState *statePtr,/* Place for conversion routine to store state
* information used during a piecewise
* conversion. Contents of statePtr are
* initialized and/or reset by conversion
* routine under control of flags argument. */
TCL_UNUSED(Tcl_EncodingState *),
char *dst, /* Output buffer in which converted string is
* stored. */
int dstLen, /* The maximum length of output buffer in
@@ -2205,7 +2157,7 @@ BinaryProc(
* UtfIntToUtfExtProc --
*
* Convert from UTF-8 to UTF-8. While converting null-bytes from the
* Tcl's internal representation (0xc0, 0x80) to the official
* Tcl's internal representation (0xC0, 0x80) to the official
* representation (0x00). See UtfToUtfProc for details.
*
* Results:
@@ -2219,7 +2171,7 @@ BinaryProc(
static int
UtfIntToUtfExtProc(
ClientData clientData, /* Not used. */
ClientData clientData,
const char *src, /* Source string in UTF-8. */
int srcLen, /* Source string length in bytes. */
int flags, /* Conversion control flags. */
@@ -2254,7 +2206,7 @@ UtfIntToUtfExtProc(
* UtfExtToUtfIntProc --
*
* Convert from UTF-8 to UTF-8 while converting null-bytes from the
* official representation (0x00) to Tcl's internal representation (0xc0,
* official representation (0x00) to Tcl's internal representation (0xC0,
* 0x80). See UtfToUtfProc for details.
*
* Results:
@@ -2268,7 +2220,7 @@ UtfIntToUtfExtProc(
static int
UtfExtToUtfIntProc(
ClientData clientData, /* Not used. */
ClientData clientData,
const char *src, /* Source string in UTF-8. */
int srcLen, /* Source string length in bytes. */
int flags, /* Conversion control flags. */
@@ -2317,7 +2269,7 @@ UtfExtToUtfIntProc(
static int
UtfToUtfProc(
ClientData clientData, /* Not used. */
TCL_UNUSED(ClientData),
const char *src, /* Source string in UTF-8. */
int srcLen, /* Source string length in bytes. */
int flags, /* Conversion control flags. */
@@ -2385,14 +2337,14 @@ UtfToUtfProc(
if (UCHAR(*src) < 0x80 && !(UCHAR(*src) == 0 && pureNullMode == 0)) {
/*
* Copy 7bit characters, but skip null-bytes when we are in input
* mode, so that they get converted to 0xc080.
* mode, so that they get converted to 0xC080.
*/
*dst++ = *src++;
} else if (pureNullMode == 1 && UCHAR(*src) == 0xc0 &&
} else if (pureNullMode == 1 && UCHAR(*src) == 0xC0 &&
(src + 1 < srcEnd) && UCHAR(*(src+1)) == 0x80) {
/*
* Convert 0xc080 to real nulls when we are in output mode.
* Convert 0xC080 to real nulls when we are in output mode.
*/
*dst++ = 0;
@@ -2409,18 +2361,19 @@ UtfToUtfProc(
dst += Tcl_UniCharToUtf(*chPtr, dst);
} else {
src += TclUtfToUniChar(src, chPtr);
if ((*chPtr & 0xFC00) == 0xD800) {
/* A high surrogate character is detected, handle especially */
if ((*chPtr | 0x7FF) == 0xDFFF) {
/* A surrogate character is detected, handle especially */
Tcl_UniChar low = *chPtr;
if (src <= srcEnd-3) {
Tcl_UtfToUniChar(src, &low);
}
if ((low & 0xFC00) != 0xDC00) {
size_t len = (src <= srcEnd-3) ? Tcl_UtfToUniChar(src, &low) : 0;
if (((low | 0x3FF) != 0xDFFF) || (*chPtr & 0x400)) {
*dst++ = (char) (((*chPtr >> 12) | 0xE0) & 0xEF);
*dst++ = (char) (((*chPtr >> 6) | 0x80) & 0xBF);
*dst++ = (char) ((*chPtr | 0x80) & 0xBF);
continue;
}
src += len;
dst += Tcl_UniCharToUtf(*chPtr, dst);
*chPtr = low;
}
dst += Tcl_UniCharToUtf(*chPtr, dst);
}
@@ -2454,11 +2407,7 @@ Utf16ToUtfProc(
const char *src, /* Source string in Unicode. */
int srcLen, /* Source string length in bytes. */
int flags, /* Conversion control flags. */
Tcl_EncodingState *statePtr,/* Place for conversion routine to store state
* information used during a piecewise
* conversion. Contents of statePtr are
* initialized and/or reset by conversion
* routine under control of flags argument. */
TCL_UNUSED(Tcl_EncodingState *),
char *dst, /* Output buffer in which converted string is
* stored. */
int dstLen, /* The maximum length of output buffer in
@@ -2614,7 +2563,7 @@ UtfToUtf16Proc(
*/
if (clientData) {
#if TCL_UTF_MAX > 4
#if TCL_UTF_MAX > 3
if (*chPtr <= 0xFFFF) {
*dst++ = (*chPtr & 0xFF);
*dst++ = (*chPtr >> 8);
@@ -2629,7 +2578,7 @@ UtfToUtf16Proc(
*dst++ = (*chPtr >> 8);
#endif
} else {
#if TCL_UTF_MAX > 4
#if TCL_UTF_MAX > 3
if (*chPtr <= 0xFFFF) {
*dst++ = (*chPtr >> 8);
*dst++ = (*chPtr & 0xFF);
@@ -2673,11 +2622,7 @@ UtfToUcs2Proc(
const char *src, /* Source string in UTF-8. */
int srcLen, /* Source string length in bytes. */
int flags, /* Conversion control flags. */
Tcl_EncodingState *statePtr,/* Place for conversion routine to store state
* information used during a piecewise
* conversion. Contents of statePtr are
* initialized and/or reset by conversion
* routine under control of flags argument. */
TCL_UNUSED(Tcl_EncodingState *),
char *dst, /* Output buffer in which converted string is
* stored. */
int dstLen, /* The maximum length of output buffer in
@@ -2696,7 +2641,7 @@ UtfToUcs2Proc(
{
const char *srcStart, *srcEnd, *srcClose, *dstStart, *dstEnd;
int result, numChars;
#if TCL_UTF_MAX <= 4
#if TCL_UTF_MAX <= 3
int len;
#endif
Tcl_UniChar ch = 0;
@@ -2726,7 +2671,7 @@ UtfToUcs2Proc(
result = TCL_CONVERT_NOSPACE;
break;
}
#if TCL_UTF_MAX <= 4
#if TCL_UTF_MAX <= 3
src += (len = TclUtfToUniChar(src, &ch));
if ((ch >= 0xD800) && (len < 3)) {
src += TclUtfToUniChar(src, &ch);
@@ -2782,11 +2727,7 @@ TableToUtfProc(
const char *src, /* Source string in specified encoding. */
int srcLen, /* Source string length in bytes. */
int flags, /* Conversion control flags. */
Tcl_EncodingState *statePtr,/* Place for conversion routine to store state
* information used during a piecewise
* conversion. Contents of statePtr are
* initialized and/or reset by conversion
* routine under control of flags argument. */
TCL_UNUSED(Tcl_EncodingState *),
char *dst, /* Output buffer in which converted string is
* stored. */
int dstLen, /* The maximum length of output buffer in
@@ -2809,7 +2750,7 @@ TableToUtfProc(
Tcl_UniChar ch = 0;
const unsigned short *const *toUnicode;
const unsigned short *pageZero;
TableEncodingData *dataPtr = clientData;
TableEncodingData *dataPtr = (TableEncodingData *)clientData;
if (flags & TCL_ENCODING_CHAR_LIMIT) {
charLimit = *dstCharsPtr;
@@ -2895,11 +2836,7 @@ TableFromUtfProc(
const char *src, /* Source string in UTF-8. */
int srcLen, /* Source string length in bytes. */
int flags, /* Conversion control flags. */
Tcl_EncodingState *statePtr,/* Place for conversion routine to store state
* information used during a piecewise
* conversion. Contents of statePtr are
* initialized and/or reset by conversion
* routine under control of flags argument. */
TCL_UNUSED(Tcl_EncodingState *),
char *dst, /* Output buffer in which converted string is
* stored. */
int dstLen, /* The maximum length of output buffer in
@@ -2920,7 +2857,7 @@ TableFromUtfProc(
const char *dstStart, *dstEnd, *prefixBytes;
Tcl_UniChar ch = 0;
int result, len, word, numChars;
TableEncodingData *dataPtr = clientData;
TableEncodingData *dataPtr = (TableEncodingData *)clientData;
const unsigned short *const *fromUnicode;
result = TCL_OK;
@@ -2950,13 +2887,13 @@ TableFromUtfProc(
}
len = TclUtfToUniChar(src, &ch);
#if TCL_UTF_MAX > 4
#if TCL_UTF_MAX > 3
/*
* This prevents a crash condition. More evaluation is required for
* full support of int Tcl_UniChar. [Bug 1004065]
*/
if (ch & 0xffff0000) {
if (ch & 0xFFFF0000) {
word = 0;
} else
#else
@@ -2964,7 +2901,7 @@ TableFromUtfProc(
word = 0;
} else
#endif
word = fromUnicode[(ch >> 8)][ch & 0xff];
word = fromUnicode[(ch >> 8)][ch & 0xFF];
if ((word == 0) && (ch != 0)) {
if (flags & TCL_ENCODING_STOPONERROR) {
@@ -3016,15 +2953,11 @@ TableFromUtfProc(
static int
Iso88591ToUtfProc(
ClientData clientData, /* Ignored. */
TCL_UNUSED(ClientData),
const char *src, /* Source string in specified encoding. */
int srcLen, /* Source string length in bytes. */
int flags, /* Conversion control flags. */
Tcl_EncodingState *statePtr,/* Place for conversion routine to store state
* information used during a piecewise
* conversion. Contents of statePtr are
* initialized and/or reset by conversion
* routine under control of flags argument. */
TCL_UNUSED(Tcl_EncodingState *),
char *dst, /* Output buffer in which converted string is
* stored. */
int dstLen, /* The maximum length of output buffer in
@@ -3100,15 +3033,11 @@ Iso88591ToUtfProc(
static int
Iso88591FromUtfProc(
ClientData clientData, /* Ignored. */
TCL_UNUSED(ClientData),
const char *src, /* Source string in UTF-8. */
int srcLen, /* Source string length in bytes. */
int flags, /* Conversion control flags. */
Tcl_EncodingState *statePtr,/* Place for conversion routine to store state
* information used during a piecewise
* conversion. Contents of statePtr are
* initialized and/or reset by conversion
* routine under control of flags argument. */
TCL_UNUSED(Tcl_EncodingState *),
char *dst, /* Output buffer in which converted string is
* stored. */
int dstLen, /* The maximum length of output buffer in
@@ -3127,11 +3056,9 @@ Iso88591FromUtfProc(
{
const char *srcStart, *srcEnd, *srcClose;
const char *dstStart, *dstEnd;
int result, numChars;
int result = TCL_OK, numChars;
Tcl_UniChar ch = 0;
result = TCL_OK;
srcStart = src;
srcEnd = src + srcLen;
srcClose = srcEnd;
@@ -3160,8 +3087,8 @@ Iso88591FromUtfProc(
* Check for illegal characters.
*/
if (ch > 0xff
#if TCL_UTF_MAX <= 4
if (ch > 0xFF
#if TCL_UTF_MAX <= 3
|| ((ch >= 0xD800) && (len < 3))
#endif
) {
@@ -3169,7 +3096,7 @@ Iso88591FromUtfProc(
result = TCL_CONVERT_UNKNOWN;
break;
}
#if TCL_UTF_MAX <= 4
#if TCL_UTF_MAX <= 3
if ((ch >= 0xD800) && (len < 3)) len = 4;
#endif
/*
@@ -3215,7 +3142,7 @@ TableFreeProc(
ClientData clientData) /* TableEncodingData that specifies
* encoding. */
{
TableEncodingData *dataPtr = clientData;
TableEncodingData *dataPtr = (TableEncodingData *)clientData;
/*
* Make sure we aren't freeing twice on shutdown. [Bug 219314]
@@ -3273,7 +3200,7 @@ EscapeToUtfProc(
* correspond to the bytes stored in the
* output buffer. */
{
EscapeEncodingData *dataPtr = clientData;
EscapeEncodingData *dataPtr = (EscapeEncodingData *)clientData;
const char *prefixBytes, *tablePrefixBytes, *srcStart, *srcEnd;
const unsigned short *const *tableToUnicode;
const Encoding *encodingPtr;
@@ -3284,8 +3211,8 @@ EscapeToUtfProc(
charLimit = *dstCharsPtr;
}
result = TCL_OK;
tablePrefixBytes = NULL; /* lint. */
tableToUnicode = NULL; /* lint. */
tablePrefixBytes = NULL;
tableToUnicode = NULL;
prefixBytes = dataPtr->prefixBytes;
encodingPtr = NULL;
@@ -3409,7 +3336,7 @@ EscapeToUtfProc(
TableEncodingData *tableDataPtr;
encodingPtr = GetTableEncoding(dataPtr, state);
tableDataPtr = encodingPtr->clientData;
tableDataPtr = (TableEncodingData *)encodingPtr->clientData;
tablePrefixBytes = tableDataPtr->prefixBytes;
tableToUnicode = (const unsigned short *const*)
tableDataPtr->toUnicode;
@@ -3487,7 +3414,7 @@ EscapeFromUtfProc(
* correspond to the bytes stored in the
* output buffer. */
{
EscapeEncodingData *dataPtr = clientData;
EscapeEncodingData *dataPtr = (EscapeEncodingData *)clientData;
const Encoding *encodingPtr;
const char *srcStart, *srcEnd, *srcClose;
const char *dstStart, *dstEnd;
@@ -3528,7 +3455,7 @@ EscapeFromUtfProc(
}
encodingPtr = GetTableEncoding(dataPtr, state);
tableDataPtr = encodingPtr->clientData;
tableDataPtr = (const TableEncodingData *)encodingPtr->clientData;
tablePrefixBytes = tableDataPtr->prefixBytes;
tableFromUnicode = (const unsigned short *const *)
tableDataPtr->fromUnicode;
@@ -3547,7 +3474,7 @@ EscapeFromUtfProc(
break;
}
len = TclUtfToUniChar(src, &ch);
word = tableFromUnicode[(ch >> 8)][ch & 0xff];
word = tableFromUnicode[(ch >> 8)][ch & 0xFF];
if ((word == 0) && (ch != 0)) {
int oldState;
@@ -3556,8 +3483,8 @@ EscapeFromUtfProc(
oldState = state;
for (state = 0; state < dataPtr->numSubTables; state++) {
encodingPtr = GetTableEncoding(dataPtr, state);
tableDataPtr = encodingPtr->clientData;
word = tableDataPtr->fromUnicode[(ch >> 8)][ch & 0xff];
tableDataPtr = (const TableEncodingData *)encodingPtr->clientData;
word = tableDataPtr->fromUnicode[(ch >> 8)][ch & 0xFF];
if (word != 0) {
break;
}
@@ -3570,7 +3497,7 @@ EscapeFromUtfProc(
break;
}
encodingPtr = GetTableEncoding(dataPtr, state);
tableDataPtr = encodingPtr->clientData;
tableDataPtr = (const TableEncodingData *)encodingPtr->clientData;
word = tableDataPtr->fallback;
}
@@ -3676,7 +3603,7 @@ EscapeFreeProc(
ClientData clientData) /* EscapeEncodingData that specifies
* encoding. */
{
EscapeEncodingData *dataPtr = clientData;
EscapeEncodingData *dataPtr = (EscapeEncodingData *)clientData;
EscapeSubTable *subTablePtr;
int i;
@@ -3841,7 +3768,7 @@ InitializeEncodingSearchPath(
bytes = TclGetString(searchPathObj);
*lengthPtr = searchPathObj->length;
*valuePtr = ckalloc(*lengthPtr + 1);
*valuePtr = (char *)ckalloc(*lengthPtr + 1);
memcpy(*valuePtr, bytes, *lengthPtr + 1);
Tcl_DecrRefCount(searchPathObj);
}
+29 -29
View File
@@ -96,7 +96,7 @@ static const Tcl_ObjType ensembleCmdType = {
do { \
const Tcl_ObjIntRep *irPtr; \
irPtr = TclFetchIntRep((objPtr), &ensembleCmdType); \
(ecRepPtr) = irPtr ? irPtr->twoPtrValue.ptr1 : NULL; \
(ecRepPtr) = irPtr ? (EnsembleCmdRep *)irPtr->twoPtrValue.ptr1 : NULL; \
} while (0)
/*
@@ -151,7 +151,7 @@ NewNsObj(
int
TclNamespaceEnsembleCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -675,7 +675,7 @@ TclCreateEnsembleInNs(
EnsembleConfig *ensemblePtr;
Tcl_Command token;
ensemblePtr = ckalloc(sizeof(EnsembleConfig));
ensemblePtr = (EnsembleConfig *)ckalloc(sizeof(EnsembleConfig));
token = TclNRCreateCommandInNs(interp, name,
(Tcl_Namespace *) nameNsPtr, TclEnsembleImplementationCmd,
NsEnsembleImplementationCmdNR, ensemblePtr, DeleteEnsembleConfig);
@@ -798,7 +798,7 @@ Tcl_SetEnsembleSubcommandList(
}
}
ensemblePtr = cmdPtr->objClientData;
ensemblePtr = (EnsembleConfig *)cmdPtr->objClientData;
oldList = ensemblePtr->subcmdList;
ensemblePtr->subcmdList = subcmdList;
if (subcmdList != NULL) {
@@ -874,7 +874,7 @@ Tcl_SetEnsembleParameterList(
}
}
ensemblePtr = cmdPtr->objClientData;
ensemblePtr = (EnsembleConfig *)cmdPtr->objClientData;
oldList = ensemblePtr->parameterList;
ensemblePtr->parameterList = paramList;
if (paramList != NULL) {
@@ -974,7 +974,7 @@ Tcl_SetEnsembleMappingDict(
}
}
ensemblePtr = cmdPtr->objClientData;
ensemblePtr = (EnsembleConfig *)cmdPtr->objClientData;
oldDict = ensemblePtr->subcommandDict;
ensemblePtr->subcommandDict = mapDict;
if (mapDict != NULL) {
@@ -1049,7 +1049,7 @@ Tcl_SetEnsembleUnknownHandler(
}
}
ensemblePtr = cmdPtr->objClientData;
ensemblePtr = (EnsembleConfig *)cmdPtr->objClientData;
oldList = ensemblePtr->unknownHandler;
ensemblePtr->unknownHandler = unknownList;
if (unknownList != NULL) {
@@ -1105,7 +1105,7 @@ Tcl_SetEnsembleFlags(
return TCL_ERROR;
}
ensemblePtr = cmdPtr->objClientData;
ensemblePtr = (EnsembleConfig *)cmdPtr->objClientData;
wasCompiled = ensemblePtr->flags & ENSEMBLE_COMPILE;
/*
@@ -1183,7 +1183,7 @@ Tcl_GetEnsembleSubcommandList(
return TCL_ERROR;
}
ensemblePtr = cmdPtr->objClientData;
ensemblePtr = (EnsembleConfig *)cmdPtr->objClientData;
*subcmdListPtr = ensemblePtr->subcmdList;
return TCL_OK;
}
@@ -1225,7 +1225,7 @@ Tcl_GetEnsembleParameterList(
return TCL_ERROR;
}
ensemblePtr = cmdPtr->objClientData;
ensemblePtr = (EnsembleConfig *)cmdPtr->objClientData;
*paramListPtr = ensemblePtr->parameterList;
return TCL_OK;
}
@@ -1267,7 +1267,7 @@ Tcl_GetEnsembleMappingDict(
return TCL_ERROR;
}
ensemblePtr = cmdPtr->objClientData;
ensemblePtr = (EnsembleConfig *)cmdPtr->objClientData;
*mapDictPtr = ensemblePtr->subcommandDict;
return TCL_OK;
}
@@ -1308,7 +1308,7 @@ Tcl_GetEnsembleUnknownHandler(
return TCL_ERROR;
}
ensemblePtr = cmdPtr->objClientData;
ensemblePtr = (EnsembleConfig *)cmdPtr->objClientData;
*unknownListPtr = ensemblePtr->unknownHandler;
return TCL_OK;
}
@@ -1349,7 +1349,7 @@ Tcl_GetEnsembleFlags(
return TCL_ERROR;
}
ensemblePtr = cmdPtr->objClientData;
ensemblePtr = (EnsembleConfig *)cmdPtr->objClientData;
*flagsPtr = ensemblePtr->flags;
return TCL_OK;
}
@@ -1390,7 +1390,7 @@ Tcl_GetEnsembleNamespace(
return TCL_ERROR;
}
ensemblePtr = cmdPtr->objClientData;
ensemblePtr = (EnsembleConfig *)cmdPtr->objClientData;
*namespacePtrPtr = (Tcl_Namespace *) ensemblePtr->nsPtr;
return TCL_OK;
}
@@ -1690,7 +1690,7 @@ NsEnsembleImplementationCmdNR(
int objc,
Tcl_Obj *const objv[])
{
EnsembleConfig *ensemblePtr = clientData;
EnsembleConfig *ensemblePtr = (EnsembleConfig *)clientData;
/* The ensemble itself. */
Tcl_Obj *prefixObj; /* An object containing the prefix words of
* the command that implements the
@@ -1763,7 +1763,7 @@ NsEnsembleImplementationCmdNR(
if (ensembleCmd) {
if (ensembleCmd->epoch == ensemblePtr->epoch &&
ensembleCmd->token == (Command *)ensemblePtr->token) {
prefixObj = Tcl_GetHashValue(ensembleCmd->hPtr);
prefixObj = (Tcl_Obj *)Tcl_GetHashValue(ensembleCmd->hPtr);
Tcl_IncrRefCount(prefixObj);
if (ensembleCmd->fix) {
TclSpellFix(interp, objv, objc, subIdx, subObj, ensembleCmd->fix);
@@ -1866,7 +1866,7 @@ NsEnsembleImplementationCmdNR(
TclSpellFix(interp, objv, objc, subIdx, subObj, fix);
}
prefixObj = Tcl_GetHashValue(hPtr);
prefixObj = (Tcl_Obj *)Tcl_GetHashValue(hPtr);
Tcl_IncrRefCount(prefixObj);
runResultingSubcommand:
@@ -1987,7 +1987,7 @@ NsEnsembleImplementationCmdNR(
int
TclClearRootEnsemble(
ClientData data[],
TCL_UNUSED(ClientData *),
Tcl_Interp *interp,
int result)
{
@@ -2094,7 +2094,7 @@ TclResetRewriteEnsemble(
static int
FreeER(
ClientData data[],
Tcl_Interp *interp,
TCL_UNUSED(Tcl_Interp *),
int result)
{
Tcl_Obj **tmp = (Tcl_Obj **) data[0];
@@ -2176,9 +2176,9 @@ TclSpellFix(
if (search[0] == NULL) {
store = (Tcl_Obj **) search[2];
} else {
Tcl_Obj **tmp = ckalloc(3 * sizeof(Tcl_Obj *));
Tcl_Obj **tmp = (Tcl_Obj **)ckalloc(3 * sizeof(Tcl_Obj *));
store = ckalloc(size * sizeof(Tcl_Obj *));
store = (Tcl_Obj **)ckalloc(size * sizeof(Tcl_Obj *));
memcpy(store, iPtr->ensembleRewrite.sourceObjs,
size * sizeof(Tcl_Obj *));
@@ -2418,7 +2418,7 @@ MakeCachedEnsembleCommand(
* our own.
*/
ensembleCmd = ckalloc(sizeof(EnsembleCmdRep));
ensembleCmd = (EnsembleCmdRep *)ckalloc(sizeof(EnsembleCmdRep));
ECRSetIntRep(objPtr, ensembleCmd);
}
@@ -2467,7 +2467,7 @@ ClearTable(
Tcl_HashEntry *hPtr = Tcl_FirstHashEntry(hash, &search);
while (hPtr != NULL) {
Tcl_Obj *prefixObj = Tcl_GetHashValue(hPtr);
Tcl_Obj *prefixObj = (Tcl_Obj *)Tcl_GetHashValue(hPtr);
Tcl_DecrRefCount(prefixObj);
hPtr = Tcl_NextHashEntry(&search);
}
@@ -2480,7 +2480,7 @@ static void
DeleteEnsembleConfig(
ClientData clientData)
{
EnsembleConfig *ensemblePtr = clientData;
EnsembleConfig *ensemblePtr = (EnsembleConfig *)clientData;
Namespace *nsPtr = ensemblePtr->nsPtr;
/*
@@ -2691,7 +2691,7 @@ BuildEnsembleConfig(
hPtr = Tcl_FirstHashEntry(&ensemblePtr->nsPtr->cmdTable, &search);
for (; hPtr!= NULL ; hPtr=Tcl_NextHashEntry(&search)) {
char *nsCmdName = /* Name of command in namespace. */
Tcl_GetHashKey(&ensemblePtr->nsPtr->cmdTable, hPtr);
(char *)Tcl_GetHashKey(&ensemblePtr->nsPtr->cmdTable, hPtr);
for (i=0 ; i<ensemblePtr->nsPtr->numExportPatterns ; i++) {
if (Tcl_StringMatch(nsCmdName,
@@ -2740,7 +2740,7 @@ BuildEnsembleConfig(
*/
ensemblePtr->subcommandArrayPtr =
ckalloc(sizeof(char *) * hash->numEntries);
(char **)ckalloc(sizeof(char *) * hash->numEntries);
/*
* Fill array from both ends as this makes us less likely to end up with
@@ -2764,12 +2764,12 @@ BuildEnsembleConfig(
j = hash->numEntries;
hPtr = Tcl_FirstHashEntry(hash, &search);
while (hPtr != NULL) {
ensemblePtr->subcommandArrayPtr[i++] = Tcl_GetHashKey(hash, hPtr);
ensemblePtr->subcommandArrayPtr[i++] = (char *)Tcl_GetHashKey(hash, hPtr);
hPtr = Tcl_NextHashEntry(&search);
if (hPtr == NULL) {
break;
}
ensemblePtr->subcommandArrayPtr[--j] = Tcl_GetHashKey(hash, hPtr);
ensemblePtr->subcommandArrayPtr[--j] = (char *)Tcl_GetHashKey(hash, hPtr);
hPtr = Tcl_NextHashEntry(&search);
}
if (hash->numEntries > 1) {
@@ -2861,7 +2861,7 @@ DupEnsembleCmdRep(
Tcl_Obj *copyPtr)
{
EnsembleCmdRep *ensembleCmd;
EnsembleCmdRep *ensembleCopy = ckalloc(sizeof(EnsembleCmdRep));
EnsembleCmdRep *ensembleCopy = (EnsembleCmdRep *)ckalloc(sizeof(EnsembleCmdRep));
ECRGetIntRep(objPtr, ensembleCmd);
ECRSetIntRep(copyPtr, ensembleCopy);
+55 -35
View File
@@ -17,12 +17,31 @@
TCL_DECLARE_MUTEX(envMutex) /* To serialize access to environ. */
#if defined(_WIN32)
# define tenviron _wenviron
# define tenviron2utfdstr(string, len, dsPtr) (Tcl_DStringInit(dsPtr), \
(char *)Tcl_Char16ToUtfDString((const unsigned short *)(string), ((((len) + 2) >> 1) - 1), (dsPtr)))
# define utf2tenvirondstr(string, len, dsPtr) (Tcl_DStringInit(dsPtr), \
(const WCHAR *)Tcl_UtfToChar16DString((string), (len), (dsPtr)))
# define techar WCHAR
# ifdef USE_PUTENV
# define putenv(env) _wputenv((const wchar_t *)env)
# endif
#else
# define tenviron environ
# define tenviron2utfdstr(tenvstr, len, dstr) \
Tcl_ExternalToUtfDString(NULL, tenvstr, len, dstr)
# define utf2tenvirondstr(str, len, dstr) \
Tcl_UtfToExternalDString(NULL, str, len, dstr)
# define techar char
#endif
static struct {
int cacheSize; /* Number of env strings in cache. */
char **cache; /* Array containing all of the environment
* strings that Tcl has allocated. */
#ifndef USE_PUTENV
char **ourEnviron; /* Cache of the array that we allocate. We
techar **ourEnviron; /* Cache of the array that we allocate. We
* need to track this in case another
* subsystem swaps around the environ array
* like we do. */
@@ -34,6 +53,8 @@ static struct {
#endif
} env;
#define tNTL sizeof(techar)
/*
* Declarations for local functions defined in this file:
*/
@@ -113,17 +134,17 @@ TclSetupEnv(
* will hold just the parts to remove.
*/
if (environ[0] != NULL) {
if (tenviron[0] != NULL) {
int i;
Tcl_MutexLock(&envMutex);
for (i = 0; environ[i] != NULL; i++) {
for (i = 0; tenviron[i] != NULL; i++) {
Tcl_Obj *obj1, *obj2;
const char *p1;
char *p2;
p1 = Tcl_ExternalToUtfDString(NULL, environ[i], -1, &envString);
p2 = strchr(p1, '=');
p1 = tenviron2utfdstr(tenviron[i], -1, &envString);
p2 = (char *)strchr(p1, '=');
if (p2 == NULL) {
/*
* This condition seem to happen occasionally under some
@@ -172,7 +193,7 @@ TclSetupEnv(
for (hPtr=Tcl_FirstHashEntry(&namesHash, &search); hPtr!=NULL;
hPtr=Tcl_NextHashEntry(&search)) {
Tcl_Obj *elemName = Tcl_GetHashValue(hPtr);
Tcl_Obj *elemName = (Tcl_Obj *)Tcl_GetHashValue(hPtr);
TclObjUnsetVar2(interp, varNamePtr, elemName, TCL_GLOBAL_ONLY);
}
@@ -219,7 +240,7 @@ TclSetEnv(
unsigned nameLength, valueLength;
int index, length;
char *p, *oldValue;
const char *p2;
const techar *p2;
/*
* Figure out where the entry is going to go. If the name doesn't already
@@ -238,23 +259,23 @@ TclSetEnv(
* environment is the one we allocated. [Bug 979640]
*/
if ((env.ourEnviron != environ) || (length+2 > env.ourEnvironSize)) {
char **newEnviron = ckalloc((length + 5) * sizeof(char *));
if ((env.ourEnviron != tenviron) || (length+2 > env.ourEnvironSize)) {
techar **newEnviron = (techar **)ckalloc((length + 5) * sizeof(techar *));
memcpy(newEnviron, environ, length * sizeof(char *));
memcpy(newEnviron, tenviron, length * sizeof(techar *));
if ((env.ourEnvironSize != 0) && (env.ourEnviron != NULL)) {
ckfree(env.ourEnviron);
}
environ = env.ourEnviron = newEnviron;
tenviron = (env.ourEnviron = newEnviron);
env.ourEnvironSize = length + 5;
}
index = length;
environ[index + 1] = NULL;
tenviron[index + 1] = NULL;
#endif /* USE_PUTENV */
oldValue = NULL;
nameLength = strlen(name);
} else {
const char *env;
const char *oldEnv;
/*
* Compare the new value to the existing value. If they're the same
@@ -264,15 +285,15 @@ TclSetEnv(
* interpreters.
*/
env = Tcl_ExternalToUtfDString(NULL, environ[index], -1, &envString);
if (strcmp(value, env + (length + 1)) == 0) {
oldEnv = tenviron2utfdstr(tenviron[index], -1, &envString);
if (strcmp(value, oldEnv + (length + 1)) == 0) {
Tcl_DStringFree(&envString);
Tcl_MutexUnlock(&envMutex);
return;
}
Tcl_DStringFree(&envString);
oldValue = environ[index];
oldValue = (char *)tenviron[index];
nameLength = length;
}
@@ -283,18 +304,18 @@ TclSetEnv(
*/
valueLength = strlen(value);
p = ckalloc(nameLength + valueLength + 2);
p = (char *)ckalloc(nameLength + valueLength + 2);
memcpy(p, name, nameLength);
p[nameLength] = '=';
memcpy(p+nameLength+1, value, valueLength+1);
p2 = Tcl_UtfToExternalDString(NULL, p, -1, &envString);
p2 = utf2tenvirondstr(p, -1, &envString);
/*
* Copy the native string to heap memory.
*/
p = ckrealloc(p, Tcl_DStringLength(&envString) + 1);
memcpy(p, p2, Tcl_DStringLength(&envString) + 1);
p = (char *)ckrealloc(p, Tcl_DStringLength(&envString) + tNTL);
memcpy(p, p2, Tcl_DStringLength(&envString) + tNTL);
Tcl_DStringFree(&envString);
#ifdef USE_PUTENV
@@ -305,7 +326,7 @@ TclSetEnv(
putenv(p);
index = TclpFindVariable(name, &length);
#else
environ[index] = p;
tenviron[index] = (techar *)p;
#endif /* USE_PUTENV */
/*
@@ -314,7 +335,7 @@ TclSetEnv(
* string in the cache.
*/
if ((index != -1) && (environ[index] == p)) {
if ((index != -1) && (tenviron[index] == (techar *)p)) {
ReplaceString(oldValue, p);
#ifdef HAVE_PUTENV_THAT_COPIES
} else {
@@ -379,7 +400,7 @@ Tcl_PutEnv(
*/
name = Tcl_ExternalToUtfDString(NULL, assignment, -1, &nameString);
value = strchr(name, '=');
value = (char *)strchr(name, '=');
if ((value != NULL) && (value != name)) {
value[0] = '\0';
@@ -440,7 +461,7 @@ TclUnsetEnv(
* Remember the old value so we can free it if Tcl created the string.
*/
oldValue = environ[index];
oldValue = (char *)tenviron[index];
/*
* Update the system environment. This must be done before we update the
@@ -454,20 +475,20 @@ TclUnsetEnv(
*/
#if defined(_WIN32)
string = ckalloc(length + 2);
string = (char *)ckalloc(length + 2);
memcpy(string, name, length);
string[length] = '=';
string[length+1] = '\0';
#else
string = ckalloc(length + 1);
string = (char *)ckalloc(length + 1);
memcpy(string, name, length);
string[length] = '\0';
#endif /* _WIN32 */
Tcl_UtfToExternalDString(NULL, string, -1, &envString);
string = ckrealloc(string, Tcl_DStringLength(&envString) + 1);
utf2tenvirondstr(string, -1, &envString);
string = (char *)ckrealloc(string, Tcl_DStringLength(&envString) + tNTL);
memcpy(string, Tcl_DStringValue(&envString),
Tcl_DStringLength(&envString)+1);
Tcl_DStringLength(&envString) + tNTL);
Tcl_DStringFree(&envString);
putenv(string);
@@ -478,7 +499,7 @@ TclUnsetEnv(
* string in the cache.
*/
if (environ[index] == string) {
if (tenviron[index] == (techar *)string) {
ReplaceString(oldValue, string);
#ifdef HAVE_PUTENV_THAT_COPIES
} else {
@@ -490,7 +511,7 @@ TclUnsetEnv(
#endif /* HAVE_PUTENV_THAT_COPIES */
}
#else /* !USE_PUTENV_FOR_UNSET */
for (envPtr = environ+index+1; ; envPtr++) {
for (envPtr = (char **)(tenviron+index+1); ; envPtr++) {
envPtr[-1] = *envPtr;
if (*envPtr == NULL) {
break;
@@ -539,7 +560,7 @@ TclGetEnv(
if (index != -1) {
Tcl_DString envStr;
result = Tcl_ExternalToUtfDString(NULL, environ[index], -1, &envStr);
result = tenviron2utfdstr(tenviron[index], -1, &envStr);
result += length;
if (*result == '=') {
result++;
@@ -576,10 +597,9 @@ TclGetEnv(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static char *
EnvTraceProc(
ClientData clientData, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Interpreter whose "env" variable is being
* modified. */
const char *name1, /* Better be "env". */
@@ -701,7 +721,7 @@ ReplaceString(
const int growth = 5;
env.cache = ckrealloc(env.cache,
env.cache = (char **)ckrealloc(env.cache,
(env.cacheSize + growth) * sizeof(char *));
env.cache[env.cacheSize] = newStr;
(void) memset(env.cache+env.cacheSize+1, 0,
+41 -44
View File
@@ -55,7 +55,7 @@ typedef struct {
typedef struct ExitHandler {
Tcl_ExitProc *proc; /* Function to call when process exits. */
ClientData clientData; /* One word of information to pass to proc. */
void *clientData; /* One word of information to pass to proc. */
struct ExitHandler *nextPtr;/* Next in list of all exit handlers for this
* application, or NULL for end of list. */
} ExitHandler;
@@ -103,19 +103,19 @@ static Tcl_ThreadDataKey dataKey;
#if TCL_THREADS
typedef struct {
Tcl_ThreadCreateProc *proc; /* Main() function of the thread */
ClientData clientData; /* The one argument to Main() */
void *clientData; /* The one argument to Main() */
} ThreadClientData;
static Tcl_ThreadCreateType NewThreadProc(ClientData clientData);
static Tcl_ThreadCreateType NewThreadProc(void *clientData);
#endif /* TCL_THREADS */
/*
* Prototypes for functions referenced only in this file:
*/
static void BgErrorDeleteProc(ClientData clientData,
static void BgErrorDeleteProc(void *clientData,
Tcl_Interp *interp);
static void HandleBgErrors(ClientData clientData);
static char * VwaitVarProc(ClientData clientData,
static void HandleBgErrors(void *clientData);
static char * VwaitVarProc(void *clientData,
Tcl_Interp *interp, const char *name1,
const char *name2, int flags);
static void InvokeExitHandlers(void);
@@ -163,7 +163,7 @@ Tcl_BackgroundException(
return;
}
errPtr = ckalloc(sizeof(BgError));
errPtr = (BgError*)ckalloc(sizeof(BgError));
errPtr->errorMsg = Tcl_GetObjResult(interp);
Tcl_IncrRefCount(errPtr->errorMsg);
errPtr->returnOpts = Tcl_GetReturnOptions(interp, code);
@@ -171,7 +171,7 @@ Tcl_BackgroundException(
errPtr->nextPtr = NULL;
(void) TclGetBgErrorHandler(interp);
assocPtr = Tcl_GetAssocData(interp, "tclBgError", NULL);
assocPtr = (ErrAssocData *)Tcl_GetAssocData(interp, "tclBgError", NULL);
if (assocPtr->firstBgPtr == NULL) {
assocPtr->firstBgPtr = errPtr;
Tcl_DoWhenIdle(HandleBgErrors, assocPtr);
@@ -201,9 +201,9 @@ Tcl_BackgroundException(
static void
HandleBgErrors(
ClientData clientData) /* Pointer to ErrAssocData structure. */
void *clientData) /* Pointer to ErrAssocData structure. */
{
ErrAssocData *assocPtr = clientData;
ErrAssocData *assocPtr = (ErrAssocData *)clientData;
Tcl_Interp *interp = assocPtr->interp;
BgError *errPtr;
@@ -230,7 +230,7 @@ HandleBgErrors(
errPtr = assocPtr->firstBgPtr;
Tcl_ListObjGetElements(NULL, copyObj, &prefixObjc, &prefixObjv);
tempObjv = ckalloc((prefixObjc+2) * sizeof(Tcl_Obj *));
tempObjv = (Tcl_Obj**)ckalloc((prefixObjc+2) * sizeof(Tcl_Obj *));
memcpy(tempObjv, prefixObjv, prefixObjc*sizeof(Tcl_Obj *));
tempObjv[prefixObjc] = errPtr->errorMsg;
tempObjv[prefixObjc+1] = errPtr->returnOpts;
@@ -311,7 +311,7 @@ HandleBgErrors(
int
TclDefaultBgErrorHandlerObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -518,7 +518,7 @@ TclSetBgErrorHandler(
Tcl_Interp *interp,
Tcl_Obj *cmdPrefix)
{
ErrAssocData *assocPtr = Tcl_GetAssocData(interp, "tclBgError", NULL);
ErrAssocData *assocPtr = (ErrAssocData *)Tcl_GetAssocData(interp, "tclBgError", NULL);
if (cmdPrefix == NULL) {
Tcl_Panic("TclSetBgErrorHandler: NULL cmdPrefix argument");
@@ -528,7 +528,7 @@ TclSetBgErrorHandler(
* First access: initialize.
*/
assocPtr = ckalloc(sizeof(ErrAssocData));
assocPtr = (ErrAssocData*)ckalloc(sizeof(ErrAssocData));
assocPtr->interp = interp;
assocPtr->cmdPrefix = NULL;
assocPtr->firstBgPtr = NULL;
@@ -563,14 +563,14 @@ Tcl_Obj *
TclGetBgErrorHandler(
Tcl_Interp *interp)
{
ErrAssocData *assocPtr = Tcl_GetAssocData(interp, "tclBgError", NULL);
ErrAssocData *assocPtr = (ErrAssocData *)Tcl_GetAssocData(interp, "tclBgError", NULL);
if (assocPtr == NULL) {
Tcl_Obj *bgerrorObj;
TclNewLiteralStringObj(bgerrorObj, "::tcl::Bgerror");
TclSetBgErrorHandler(interp, bgerrorObj);
assocPtr = Tcl_GetAssocData(interp, "tclBgError", NULL);
assocPtr = (ErrAssocData *)Tcl_GetAssocData(interp, "tclBgError", NULL);
}
return assocPtr->cmdPrefix;
}
@@ -596,10 +596,10 @@ TclGetBgErrorHandler(
static void
BgErrorDeleteProc(
ClientData clientData, /* Pointer to ErrAssocData structure. */
Tcl_Interp *interp) /* Interpreter being deleted. */
void *clientData, /* Pointer to ErrAssocData structure. */
TCL_UNUSED(Tcl_Interp *))
{
ErrAssocData *assocPtr = clientData;
ErrAssocData *assocPtr = (ErrAssocData *)clientData;
BgError *errPtr;
while (assocPtr->firstBgPtr != NULL) {
@@ -635,9 +635,9 @@ BgErrorDeleteProc(
void
Tcl_CreateExitHandler(
Tcl_ExitProc *proc, /* Function to invoke. */
ClientData clientData) /* Arbitrary value to pass to proc. */
void *clientData) /* Arbitrary value to pass to proc. */
{
ExitHandler *exitPtr = ckalloc(sizeof(ExitHandler));
ExitHandler *exitPtr = (ExitHandler*)ckalloc(sizeof(ExitHandler));
exitPtr->proc = proc;
exitPtr->clientData = clientData;
@@ -668,9 +668,9 @@ Tcl_CreateExitHandler(
void
TclCreateLateExitHandler(
Tcl_ExitProc *proc, /* Function to invoke. */
ClientData clientData) /* Arbitrary value to pass to proc. */
void *clientData) /* Arbitrary value to pass to proc. */
{
ExitHandler *exitPtr = ckalloc(sizeof(ExitHandler));
ExitHandler *exitPtr = (ExitHandler*)ckalloc(sizeof(ExitHandler));
exitPtr->proc = proc;
exitPtr->clientData = clientData;
@@ -701,7 +701,7 @@ TclCreateLateExitHandler(
void
Tcl_DeleteExitHandler(
Tcl_ExitProc *proc, /* Function that was previously registered. */
ClientData clientData) /* Arbitrary value to pass to proc. */
void *clientData) /* Arbitrary value to pass to proc. */
{
ExitHandler *exitPtr, *prevPtr;
@@ -744,7 +744,7 @@ Tcl_DeleteExitHandler(
void
TclDeleteLateExitHandler(
Tcl_ExitProc *proc, /* Function that was previously registered. */
ClientData clientData) /* Arbitrary value to pass to proc. */
void *clientData) /* Arbitrary value to pass to proc. */
{
ExitHandler *exitPtr, *prevPtr;
@@ -787,12 +787,12 @@ TclDeleteLateExitHandler(
void
Tcl_CreateThreadExitHandler(
Tcl_ExitProc *proc, /* Function to invoke. */
ClientData clientData) /* Arbitrary value to pass to proc. */
void *clientData) /* Arbitrary value to pass to proc. */
{
ExitHandler *exitPtr;
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
exitPtr = ckalloc(sizeof(ExitHandler));
exitPtr = (ExitHandler*)ckalloc(sizeof(ExitHandler));
exitPtr->proc = proc;
exitPtr->clientData = clientData;
exitPtr->nextPtr = tsdPtr->firstExitPtr;
@@ -820,7 +820,7 @@ Tcl_CreateThreadExitHandler(
void
Tcl_DeleteThreadExitHandler(
Tcl_ExitProc *proc, /* Function that was previously registered. */
ClientData clientData) /* Arbitrary value to pass to proc. */
void *clientData) /* Arbitrary value to pass to proc. */
{
ExitHandler *exitPtr, *prevPtr;
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
@@ -1296,7 +1296,7 @@ FinalizeThread(
* initialized already.
*/
tsdPtr = TclThreadDataKeyGet(&dataKey);
tsdPtr = (ThreadSpecificData*)TclThreadDataKeyGet(&dataKey);
if (tsdPtr != NULL) {
tsdPtr->inExit = 1;
@@ -1371,7 +1371,7 @@ TclInExit(void)
int
TclInThreadExit(void)
{
ThreadSpecificData *tsdPtr = TclThreadDataKeyGet(&dataKey);
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)TclThreadDataKeyGet(&dataKey);
if (tsdPtr == NULL) {
return 0;
@@ -1396,10 +1396,9 @@ TclInThreadExit(void)
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_VwaitObjCmd(
ClientData clientData, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1460,19 +1459,18 @@ Tcl_VwaitObjCmd(
return TCL_OK;
}
/* ARGSUSED */
static char *
VwaitVarProc(
ClientData clientData, /* Pointer to integer to set to 1. */
void *clientData, /* Pointer to integer to set to 1. */
Tcl_Interp *interp, /* Interpreter containing variable. */
const char *name1, /* Name of variable. */
const char *name2, /* Second part of variable name. */
int flags) /* Information about what happened. */
TCL_UNUSED(int) /*flags*/) /* Information about what happened. */
{
int *donePtr = clientData;
int *donePtr = (int *)clientData;
*donePtr = 1;
Tcl_UntraceVar(interp, name1, TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
Tcl_UntraceVar2(interp, name1, name2, TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
VwaitVarProc, clientData);
return NULL;
}
@@ -1494,10 +1492,9 @@ VwaitVarProc(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_UpdateObjCmd(
ClientData clientData, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1565,10 +1562,10 @@ Tcl_UpdateObjCmd(
static Tcl_ThreadCreateType
NewThreadProc(
ClientData clientData)
void *clientData)
{
ThreadClientData *cdPtr = clientData;
ClientData threadClientData;
ThreadClientData *cdPtr = (ThreadClientData *)clientData;
void *threadClientData;
Tcl_ThreadCreateProc *threadProc;
threadProc = cdPtr->proc;
@@ -1604,13 +1601,13 @@ int
Tcl_CreateThread(
Tcl_ThreadId *idPtr, /* Return, the ID of the thread */
Tcl_ThreadCreateProc *proc, /* Main() function of the thread */
ClientData clientData, /* The one argument to Main() */
void *clientData, /* The one argument to Main() */
int stackSize, /* Size of stack for the new thread */
int flags) /* Flags controlling behaviour of the new
* thread. */
{
#if TCL_THREADS
ThreadClientData *cdPtr = ckalloc(sizeof(ThreadClientData));
ThreadClientData *cdPtr = (ThreadClientData *)ckalloc(sizeof(ThreadClientData));
int result;
cdPtr->proc = proc;
+223 -108
View File
@@ -202,7 +202,7 @@ typedef struct TEBCdata {
#define POP_TAUX_OBJ() \
do { \
tmpPtr = auxObjList; \
auxObjList = tmpPtr->internalRep.twoPtrValue.ptr1; \
auxObjList = (Tcl_Obj *)tmpPtr->internalRep.twoPtrValue.ptr1; \
Tcl_DecrRefCount(tmpPtr); \
} while (0)
@@ -317,12 +317,16 @@ VarHashCreateVar(
switch (*pc) { \
case INST_JUMP_FALSE1: \
NEXT_INST_F(((condition)? 2 : TclGetInt1AtPtr(pc+1)), (cleanup), 0); \
break; \
case INST_JUMP_TRUE1: \
NEXT_INST_F(((condition)? TclGetInt1AtPtr(pc+1) : 2), (cleanup), 0); \
break; \
case INST_JUMP_FALSE4: \
NEXT_INST_F(((condition)? 5 : TclGetInt4AtPtr(pc+1)), (cleanup), 0); \
break; \
case INST_JUMP_TRUE4: \
NEXT_INST_F(((condition)? TclGetInt4AtPtr(pc+1) : 5), (cleanup), 0); \
break; \
default: \
if ((condition) < 0) { \
TclNewIntObj(objResultPtr, -1); \
@@ -330,6 +334,7 @@ VarHashCreateVar(
objResultPtr = TCONST((condition) > 0); \
} \
NEXT_INST_F(0, (cleanup), 1); \
break; \
} \
} while (0)
#define JUMP_PEEPHOLE_V(condition, pcAdjustment, cleanup) \
@@ -338,12 +343,16 @@ VarHashCreateVar(
switch (*pc) { \
case INST_JUMP_FALSE1: \
NEXT_INST_V(((condition)? 2 : TclGetInt1AtPtr(pc+1)), (cleanup), 0); \
break; \
case INST_JUMP_TRUE1: \
NEXT_INST_V(((condition)? TclGetInt1AtPtr(pc+1) : 2), (cleanup), 0); \
break; \
case INST_JUMP_FALSE4: \
NEXT_INST_V(((condition)? 5 : TclGetInt4AtPtr(pc+1)), (cleanup), 0); \
break; \
case INST_JUMP_TRUE4: \
NEXT_INST_V(((condition)? TclGetInt4AtPtr(pc+1) : 5), (cleanup), 0); \
break; \
default: \
if ((condition) < 0) { \
TclNewIntObj(objResultPtr, -1); \
@@ -351,6 +360,7 @@ VarHashCreateVar(
objResultPtr = TCONST((condition) > 0); \
} \
NEXT_INST_V(0, (cleanup), 1); \
break; \
} \
} while (0)
#else /* TCL_COMPILE_DEBUG */
@@ -652,6 +662,7 @@ static const size_t Exp64ValueSize = sizeof(Exp64Value) / sizeof(Tcl_WideInt);
#define DIVIDED_BY_ZERO ((Tcl_Obj *) -1)
#define EXPONENT_OF_ZERO ((Tcl_Obj *) -2)
#define GENERAL_ARITHMETIC_ERROR ((Tcl_Obj *) -3)
#define OUT_OF_MEMORY ((Tcl_Obj *) -4)
/*
* Declarations for local procedures to this file:
@@ -758,11 +769,11 @@ ReleaseDictIterator(
* that we were holding.
*/
searchPtr = irPtr->twoPtrValue.ptr1;
searchPtr = (Tcl_DictSearch *)irPtr->twoPtrValue.ptr1;
Tcl_DictObjDone(searchPtr);
ckfree(searchPtr);
dictPtr = irPtr->twoPtrValue.ptr2;
dictPtr = (Tcl_Obj *)irPtr->twoPtrValue.ptr2;
TclDecrRefCount(dictPtr);
}
@@ -787,6 +798,7 @@ ReleaseDictIterator(
*----------------------------------------------------------------------
*/
#if defined(TCL_COMPILE_STATS) || defined(TCL_COMPILE_DEBUG)
static void
InitByteCodeExecution(
Tcl_Interp *interp) /* Interpreter for which the Tcl variable
@@ -794,7 +806,7 @@ InitByteCodeExecution(
* instruction tracing. */
{
#ifdef TCL_COMPILE_DEBUG
if (Tcl_LinkVar(interp, "tcl_traceExec", (char *) &tclTraceExec,
if (Tcl_LinkVar(interp, "tcl_traceExec", &tclTraceExec,
TCL_LINK_INT) != TCL_OK) {
Tcl_Panic("InitByteCodeExecution: can't create link for tcl_traceExec variable");
}
@@ -803,6 +815,15 @@ InitByteCodeExecution(
Tcl_CreateObjCommand(interp, "evalstats", EvalStatsCmd, NULL, NULL);
#endif /* TCL_COMPILE_STATS */
}
#else
static void
InitByteCodeExecution(
TCL_UNUSED(Tcl_Interp *))
{
}
#endif
/*
*----------------------------------------------------------------------
@@ -833,8 +854,8 @@ TclCreateExecEnv(
int size) /* The initial stack size, in number of words
* [sizeof(Tcl_Obj*)] */
{
ExecEnv *eePtr = ckalloc(sizeof(ExecEnv));
ExecStack *esPtr = ckalloc(sizeof(ExecStack)
ExecEnv *eePtr = (ExecEnv *)ckalloc(sizeof(ExecEnv));
ExecStack *esPtr = (ExecStack *)ckalloc(sizeof(ExecStack)
+ (size_t) (size-1) * sizeof(Tcl_Obj *));
eePtr->execStackPtr = esPtr;
@@ -1103,7 +1124,7 @@ GrowEvaluationStack(
newBytes = sizeof(ExecStack) + (newElems-1) * sizeof(Tcl_Obj *);
oldPtr = esPtr;
esPtr = ckalloc(newBytes);
esPtr = (ExecStack *)ckalloc(newBytes);
oldPtr->nextPtr = esPtr;
esPtr->prevPtr = oldPtr;
@@ -1345,11 +1366,11 @@ Tcl_ExprObj(
static int
CopyCallback(
ClientData data[],
Tcl_Interp *interp,
TCL_UNUSED(Tcl_Interp *),
int result)
{
Tcl_Obj **resultPtrPtr = data[0];
Tcl_Obj *resultPtr = data[1];
Tcl_Obj **resultPtrPtr = (Tcl_Obj **)data[0];
Tcl_Obj *resultPtr = (Tcl_Obj *)data[1];
if (result == TCL_OK) {
*resultPtrPtr = resultPtr;
@@ -1406,8 +1427,8 @@ ExprObjCallback(
Tcl_Interp *interp,
int result)
{
Tcl_InterpState state = data[0];
Tcl_Obj *resultPtr = data[1];
Tcl_InterpState state = (Tcl_InterpState)data[0];
Tcl_Obj *resultPtr = (Tcl_Obj *)data[1];
if (result == TCL_OK) {
TclSetDuplicateObj(resultPtr, Tcl_GetObjResult(interp));
@@ -1540,8 +1561,8 @@ CompileExprObj(
static void
DupExprCodeInternalRep(
Tcl_Obj *srcPtr,
Tcl_Obj *copyPtr)
TCL_UNUSED(Tcl_Obj *),
TCL_UNUSED(Tcl_Obj *))
{
return;
}
@@ -1693,9 +1714,9 @@ TclCompileObj(
return codePtr;
}
eclPtr = Tcl_GetHashValue(hePtr);
eclPtr = (ExtCmdLoc *)Tcl_GetHashValue(hePtr);
redo = 0;
ctxCopyPtr = TclStackAlloc(interp, sizeof(CmdFrame));
ctxCopyPtr = (CmdFrame *)TclStackAlloc(interp, sizeof(CmdFrame));
*ctxCopyPtr = *invoker;
if (invoker->type == TCL_LOCATION_BC) {
@@ -1791,6 +1812,7 @@ TclIncrObj(
ClientData ptr1, ptr2;
int type1, type2;
mp_int value, incr;
mp_err err;
if (Tcl_IsShared(valuePtr)) {
Tcl_Panic("%s called with shared object", "TclIncrObj");
@@ -1849,8 +1871,11 @@ TclIncrObj(
Tcl_TakeBignumFromObj(interp, valuePtr, &value);
Tcl_GetBignumFromObj(interp, incrPtr, &incr);
mp_add(&value, &incr, &value);
err = mp_add(&value, &incr, &value);
mp_clear(&incr);
if (err != MP_OKAY) {
return TCL_ERROR;
}
Tcl_SetBignumObj(valuePtr, &value);
return TCL_OK;
}
@@ -2046,7 +2071,7 @@ TEBCresume(
* used too frequently
*/
TEBCdata *TD = data[0];
TEBCdata *TD = (TEBCdata *)data[0];
#define auxObjList (TD->auxObjList)
#define catchTop (TD->catchTop)
#define codePtr (TD->codePtr)
@@ -2058,7 +2083,7 @@ TEBCresume(
Tcl_Obj **tosPtr; /* Cached pointer to top of evaluation
* stack. */
const unsigned char *pc = data[1];
const unsigned char *pc = (const unsigned char *)data[1];
/* The current program counter. */
unsigned char inst; /* The currently running instruction */
@@ -2571,23 +2596,27 @@ TEBCresume(
objResultPtr = codePtr->objArrayPtr[TclGetUInt4AtPtr(pc+1)];
TRACE_WITH_OBJ(("%u => ", TclGetUInt4AtPtr(pc+1)), objResultPtr);
NEXT_INST_F(5, 0, 1);
break;
case INST_POP:
TRACE_WITH_OBJ(("=> discarding "), OBJ_AT_TOS);
objPtr = POP_OBJECT();
TclDecrRefCount(objPtr);
NEXT_INST_F(1, 0, 0);
break;
case INST_DUP:
objResultPtr = OBJ_AT_TOS;
TRACE_WITH_OBJ(("=> "), objResultPtr);
NEXT_INST_F(1, 0, 1);
break;
case INST_OVER:
opnd = TclGetUInt4AtPtr(pc+1);
objResultPtr = OBJ_AT_DEPTH(opnd);
TRACE_WITH_OBJ(("%u => ", opnd), objResultPtr);
NEXT_INST_F(5, 0, 1);
break;
case INST_REVERSE: {
Tcl_Obj **a, **b;
@@ -2604,6 +2633,7 @@ TEBCresume(
TRACE(("%u => OK\n", opnd));
NEXT_INST_F(5, 0, 0);
}
break;
case INST_STR_CONCAT1:
@@ -2617,6 +2647,7 @@ TEBCresume(
TRACE_WITH_OBJ(("%u => ", opnd), objResultPtr);
NEXT_INST_V(2, opnd, 1);
break;
case INST_CONCAT_STK:
/*
@@ -2628,6 +2659,7 @@ TEBCresume(
objResultPtr = Tcl_ConcatObj(opnd, &OBJ_AT_DEPTH(opnd-1));
TRACE_WITH_OBJ(("%u => ", opnd), objResultPtr);
NEXT_INST_V(5, opnd, 1);
break;
case INST_EXPAND_START:
/*
@@ -2649,6 +2681,7 @@ TEBCresume(
PUSH_TAUX_OBJ(objPtr);
TRACE(("=> mark depth as %d\n", (int) CURR_DEPTH));
NEXT_INST_F(1, 0, 0);
break;
case INST_EXPAND_DROP:
/*
@@ -2727,6 +2760,7 @@ TEBCresume(
Tcl_DecrRefCount(objPtr);
NEXT_INST_F(5, 0, 0);
}
break;
case INST_EXPR_STK: {
ByteCode *newCodePtr;
@@ -2774,6 +2808,7 @@ TEBCresume(
TclNewObj(objResultPtr);
NEXT_INST_F(1, 0, 1);
break;
case INST_INVOKE_STK4:
objc = TclGetUInt4AtPtr(pc+1);
@@ -4025,6 +4060,7 @@ TEBCresume(
}
NEXT_INST_F(5, 0, 0);
}
break;
/*
* End of INST_UNSET instructions.
@@ -4242,6 +4278,7 @@ TEBCresume(
TRACE_APPEND(("link made\n"));
NEXT_INST_F(5, 1, 0);
}
break;
/*
* End of variable linking instructions.
@@ -4253,6 +4290,7 @@ TEBCresume(
TRACE(("%d => new pc %u\n", opnd,
(unsigned)(pc + opnd - codePtr->codeStart)));
NEXT_INST_F(opnd, 0, 0);
break;
case INST_JUMP4:
opnd = TclGetInt4AtPtr(pc+1);
@@ -4315,6 +4353,7 @@ TEBCresume(
#endif
NEXT_INST_F(jmpOffset[b], 1, 0);
}
break;
case INST_JUMP_TABLE: {
Tcl_HashEntry *hPtr;
@@ -4340,6 +4379,7 @@ TEBCresume(
NEXT_INST_F(5, 1, 0);
}
}
break;
/*
* These two instructions are now redundant: the complete logic of the LOR
@@ -4384,6 +4424,7 @@ TEBCresume(
TRACE(("%.20s %.20s => %d\n", O2S(valuePtr),O2S(value2Ptr),iResult));
NEXT_INST_F(1, 2, 1);
}
break;
/*
* -----------------------------------------------------------------
@@ -4402,6 +4443,7 @@ TEBCresume(
TRACE_WITH_OBJ(("=> "), objResultPtr);
NEXT_INST_F(1, 0, 1);
}
break;
case INST_COROUTINE_NAME: {
CoroutineData *corPtr = iPtr->execEnvPtr->corPtr;
@@ -4413,10 +4455,12 @@ TEBCresume(
TRACE_WITH_OBJ(("=> "), objResultPtr);
NEXT_INST_F(1, 0, 1);
}
break;
case INST_INFO_LEVEL_NUM:
TclNewIntObj(objResultPtr, iPtr->varFramePtr->level);
TRACE_WITH_OBJ(("=> "), objResultPtr);
NEXT_INST_F(1, 0, 1);
break;
case INST_INFO_LEVEL_ARGS: {
int level;
CallFrame *framePtr = iPtr->varFramePtr;
@@ -4507,7 +4551,7 @@ TEBCresume(
CACHE_STACK_INFO();
goto gotError;
}
contextPtr = framePtr->clientData;
contextPtr = (CallContext *)framePtr->clientData;
/*
* Call out to get the name; it's expensive to compute but cached.
@@ -4535,7 +4579,7 @@ TEBCresume(
CACHE_STACK_INFO();
goto gotError;
}
contextPtr = framePtr->clientData;
contextPtr = (CallContext *)framePtr->clientData;
oPtr = (Object *) Tcl_GetObjectFromObj(interp, valuePtr);
if (oPtr == NULL) {
@@ -4634,7 +4678,7 @@ TEBCresume(
CACHE_STACK_INFO();
goto gotError;
}
contextPtr = framePtr->clientData;
contextPtr = (CallContext *)framePtr->clientData;
newDepth = contextPtr->index + 1;
if (newDepth >= contextPtr->callPtr->numChain) {
@@ -5478,19 +5522,17 @@ TEBCresume(
NEXT_INST_V(1, 3, 1);
case INST_STR_FIND:
match = TclStringFirst(OBJ_UNDER_TOS, OBJ_AT_TOS, 0);
objResultPtr = TclStringFirst(OBJ_UNDER_TOS, OBJ_AT_TOS, 0);
TRACE(("%.20s %.20s => %d\n",
O2S(OBJ_UNDER_TOS), O2S(OBJ_AT_TOS), match));
TclNewIntObj(objResultPtr, match);
O2S(OBJ_UNDER_TOS), O2S(OBJ_AT_TOS), O2S(objResultPtr)));
NEXT_INST_F(1, 2, 1);
case INST_STR_FIND_LAST:
match = TclStringLast(OBJ_UNDER_TOS, OBJ_AT_TOS, INT_MAX - 1);
objResultPtr = TclStringLast(OBJ_UNDER_TOS, OBJ_AT_TOS, INT_MAX - 1);
TRACE(("%.20s %.20s => %d\n",
O2S(OBJ_UNDER_TOS), O2S(OBJ_AT_TOS), match));
TclNewIntObj(objResultPtr, match);
O2S(OBJ_UNDER_TOS), O2S(OBJ_AT_TOS), O2S(objResultPtr)));
NEXT_INST_F(1, 2, 1);
case INST_STR_CLASS:
@@ -5838,6 +5880,7 @@ TEBCresume(
wResult = w1 - w2*wResult;
goto wideResultOfArithmetic;
}
break;
case INST_RSHIFT:
if (w2 < 0) {
@@ -5886,6 +5929,7 @@ TEBCresume(
wResult = w1 >> ((int) w2);
goto wideResultOfArithmetic;
}
break;
case INST_LSHIFT:
if (w2 < 0) {
@@ -6075,6 +6119,7 @@ TEBCresume(
TclSetIntObj(valuePtr, wResult);
TRACE(("%s\n", O2S(valuePtr)));
NEXT_INST_F(1, 1, 0);
break;
case INST_DIV:
if (w2 == 0) {
@@ -6132,6 +6177,9 @@ TEBCresume(
} else if (objResultPtr == GENERAL_ARITHMETIC_ERROR) {
TRACE_ERROR(interp);
goto gotError;
} else if (objResultPtr == OUT_OF_MEMORY) {
TRACE_APPEND(("OUT OF MEMORY\n"));
goto outOfMemory;
} else if (objResultPtr == NULL) {
TRACE_APPEND(("%s\n", O2S(valuePtr)));
NEXT_INST_F(1, 1, 0);
@@ -6214,6 +6262,7 @@ TEBCresume(
/* -NaN => NaN */
TRACE_APPEND(("%s\n", O2S(valuePtr)));
NEXT_INST_F(1, 0, 0);
break;
case TCL_NUMBER_INT:
w1 = *((const Tcl_WideInt *) ptr1);
if (w1 != WIDE_MIN) {
@@ -6322,6 +6371,7 @@ TEBCresume(
TRACE_APPEND(("numeric, same Tcl_Obj\n"));
NEXT_INST_F(1, 0, 0);
}
break;
/*
* End of numeric operator instructions.
@@ -6338,6 +6388,7 @@ TEBCresume(
}
TRACE_WITH_OBJ(("\"%.30s\" => ", O2S(valuePtr)), objResultPtr);
NEXT_INST_F(1, 0, 1);
break;
case INST_BREAK:
/*
@@ -6378,7 +6429,7 @@ TEBCresume(
*/
opnd = TclGetUInt4AtPtr(pc+1);
infoPtr = codePtr->auxDataArrayPtr[opnd].clientData;
infoPtr = (ForeachInfo *)codePtr->auxDataArrayPtr[opnd].clientData;
iterTmpIndex = infoPtr->loopCtTemp;
iterVarPtr = LOCAL(iterTmpIndex);
oldValuePtr = iterVarPtr->value.objPtr;
@@ -6412,7 +6463,7 @@ TEBCresume(
opnd = TclGetUInt4AtPtr(pc+1);
TRACE(("%u => ", opnd));
infoPtr = codePtr->auxDataArrayPtr[opnd].clientData;
infoPtr = (ForeachInfo *)codePtr->auxDataArrayPtr[opnd].clientData;
numLists = infoPtr->numLists;
/*
@@ -6542,7 +6593,7 @@ TEBCresume(
*/
opnd = TclGetUInt4AtPtr(pc+1);
infoPtr = codePtr->auxDataArrayPtr[opnd].clientData;
infoPtr = (ForeachInfo *)codePtr->auxDataArrayPtr[opnd].clientData;
numLists = infoPtr->numLists;
TRACE(("%u => ", opnd));
@@ -6610,7 +6661,7 @@ TEBCresume(
*/
tmpPtr = OBJ_AT_TOS;
infoPtr = tmpPtr->internalRep.twoPtrValue.ptr1;
infoPtr = (ForeachInfo *)tmpPtr->internalRep.twoPtrValue.ptr1;
numLists = infoPtr->numLists;
TRACE(("=> "));
@@ -6694,7 +6745,7 @@ TEBCresume(
case INST_FOREACH_END:
/* THIS INSTRUCTION IS ONLY CALLED AS A BREAK TARGET */
tmpPtr = OBJ_AT_TOS;
infoPtr = tmpPtr->internalRep.twoPtrValue.ptr1;
infoPtr = (ForeachInfo *)tmpPtr->internalRep.twoPtrValue.ptr1;
numLists = infoPtr->numLists;
TRACE(("=> loop terminated\n"));
NEXT_INST_V(1, numLists+2, 0);
@@ -6711,7 +6762,7 @@ TEBCresume(
*/
tmpPtr = OBJ_AT_DEPTH(1);
infoPtr = tmpPtr->internalRep.twoPtrValue.ptr1;
infoPtr = (ForeachInfo *)tmpPtr->internalRep.twoPtrValue.ptr1;
numLists = infoPtr->numLists;
TRACE_APPEND(("=> appending to list at depth %d\n", 3 + numLists));
@@ -6719,6 +6770,7 @@ TEBCresume(
Tcl_ListObjAppendElement(NULL, objPtr, OBJ_AT_TOS);
NEXT_INST_F(1, 1, 0);
}
break;
case INST_BEGIN_CATCH4:
/*
@@ -6732,6 +6784,7 @@ TEBCresume(
TclGetUInt4AtPtr(pc+1), (int) (catchTop - initCatchTop - 1),
(int) CURR_DEPTH));
NEXT_INST_F(5, 0, 0);
break;
case INST_END_CATCH:
catchTop--;
@@ -6741,6 +6794,7 @@ TEBCresume(
result = TCL_OK;
TRACE(("=> catchTop=%d\n", (int) (catchTop - initCatchTop - 1)));
NEXT_INST_F(1, 0, 0);
break;
case INST_PUSH_RESULT:
objResultPtr = Tcl_GetObjResult(interp);
@@ -6754,11 +6808,13 @@ TEBCresume(
Tcl_IncrRefCount(objPtr);
iPtr->objResultPtr = objPtr;
NEXT_INST_F(1, 0, -1);
break;
case INST_PUSH_RETURN_CODE:
TclNewIntObj(objResultPtr, result);
TRACE(("=> %u\n", result));
NEXT_INST_F(1, 0, 1);
break;
case INST_PUSH_RETURN_OPTIONS:
DECACHE_STACK_INFO();
@@ -6766,6 +6822,7 @@ TEBCresume(
CACHE_STACK_INFO();
TRACE_WITH_OBJ(("=> "), objResultPtr);
NEXT_INST_F(1, 0, 1);
break;
case INST_RETURN_CODE_BRANCH: {
int code;
@@ -6805,6 +6862,7 @@ TEBCresume(
}
TRACE_APPEND(("OK\n"));
NEXT_INST_F(1, 1, 0);
break;
case INST_DICT_EXISTS: {
int found;
@@ -7151,7 +7209,7 @@ TEBCresume(
opnd = TclGetUInt4AtPtr(pc+1);
TRACE(("%u => ", opnd));
dictPtr = POP_OBJECT();
searchPtr = ckalloc(sizeof(Tcl_DictSearch));
searchPtr = (Tcl_DictSearch *)ckalloc(sizeof(Tcl_DictSearch));
if (Tcl_DictObjFirst(interp, dictPtr, searchPtr, &keyPtr,
&valuePtr, &done) != TCL_OK) {
@@ -7193,7 +7251,7 @@ TEBCresume(
if (statePtr &&
(irPtr = TclFetchIntRep(statePtr, &dictIteratorType))) {
searchPtr = irPtr->twoPtrValue.ptr1;
searchPtr = (Tcl_DictSearch *)irPtr->twoPtrValue.ptr1;
Tcl_DictObjNext(searchPtr, &keyPtr, &valuePtr, &done);
} else {
Tcl_Panic("mis-issued dictNext!");
@@ -7225,7 +7283,7 @@ TEBCresume(
opnd2 = TclGetUInt4AtPtr(pc+5);
TRACE(("%u => ", opnd));
varPtr = LOCAL(opnd);
duiPtr = codePtr->auxDataArrayPtr[opnd2].clientData;
duiPtr = (DictUpdateInfo *)codePtr->auxDataArrayPtr[opnd2].clientData;
while (TclIsVarLink(varPtr)) {
varPtr = varPtr->value.linkPtr;
}
@@ -7285,7 +7343,7 @@ TEBCresume(
opnd2 = TclGetUInt4AtPtr(pc+5);
TRACE(("%u => ", opnd));
varPtr = LOCAL(opnd);
duiPtr = codePtr->auxDataArrayPtr[opnd2].clientData;
duiPtr = (DictUpdateInfo *)codePtr->auxDataArrayPtr[opnd2].clientData;
while (TclIsVarLink(varPtr)) {
varPtr = varPtr->value.linkPtr;
}
@@ -7428,6 +7486,7 @@ TEBCresume(
TRACE_APPEND(("OK\n"));
NEXT_INST_F(5, 2, 0);
}
break;
/*
* End of dictionary-related instructions.
@@ -7465,6 +7524,7 @@ TEBCresume(
TRACE_WITH_OBJ(("=> "), objResultPtr);
NEXT_INST_F(2, 0, 1);
}
break;
default:
Tcl_Panic("TclNRExecuteByteCode: unrecognized opCode %u", *pc);
@@ -7572,6 +7632,13 @@ TEBCresume(
CACHE_STACK_INFO();
goto gotError;
outOfMemory:
Tcl_SetObjResult(interp, Tcl_NewStringObj("out of memory", -1));
DECACHE_STACK_INFO();
Tcl_SetErrorCode(interp, "ARITH", "OUTOFMEMORY", "out of memory", NULL);
CACHE_STACK_INFO();
goto gotError;
/*
* Exponentiation of zero by negative number in an expression. Control
* only reaches this point by "goto exponOfZero".
@@ -7817,13 +7884,13 @@ FinalizeOONext(
int result)
{
Interp *iPtr = (Interp *) interp;
CallContext *contextPtr = data[1];
CallContext *contextPtr = (CallContext *)data[1];
/*
* Reset the variable lookup frame.
*/
iPtr->varFramePtr = data[0];
iPtr->varFramePtr = (CallFrame *)data[0];
/*
* Restore the call chain context index as we've finished the inner invoke
@@ -7843,13 +7910,13 @@ FinalizeOONextFilter(
int result)
{
Interp *iPtr = (Interp *) interp;
CallContext *contextPtr = data[1];
CallContext *contextPtr = (CallContext *)data[1];
/*
* Reset the variable lookup frame.
*/
iPtr->varFramePtr = data[0];
iPtr->varFramePtr = (CallFrame *)data[0];
/*
* Restore the call chain context index as we've finished the inner invoke
@@ -8011,6 +8078,7 @@ ExecuteExtendedBinaryMathOp(
Tcl_Obj *objResultPtr;
int invalid, zero;
long shift;
mp_err err;
(void) GetNumberFromObj(NULL, valuePtr, &ptr1, &type1);
(void) GetNumberFromObj(NULL, value2Ptr, &ptr2, &type2);
@@ -8072,9 +8140,14 @@ ExecuteExtendedBinaryMathOp(
* Arguments are opposite sign; remainder is sum.
*/
mp_init_i64(&big1, w1);
mp_add(&big2, &big1, &big2);
mp_clear(&big1);
err = mp_init_i64(&big1, w1);
if (err == MP_OKAY) {
err = mp_add(&big2, &big1, &big2);
mp_clear(&big1);
}
if (err != MP_OKAY) {
return OUT_OF_MEMORY;
}
BIG_RESULT(&big2);
}
@@ -8087,21 +8160,27 @@ ExecuteExtendedBinaryMathOp(
}
Tcl_GetBignumFromObj(NULL, valuePtr, &big1);
Tcl_GetBignumFromObj(NULL, value2Ptr, &big2);
mp_init(&bigResult);
mp_init(&bigRemainder);
mp_div(&big1, &big2, &bigResult, &bigRemainder);
if ((bigRemainder.used != 0) && (bigRemainder.sign != big2.sign)) {
err = mp_init_multi(&bigResult, &bigRemainder, NULL);
if (err == MP_OKAY) {
err = mp_div(&big1, &big2, &bigResult, &bigRemainder);
}
if ((err == MP_OKAY) && !mp_iszero(&bigRemainder) && (bigRemainder.sign != big2.sign)) {
/*
* Convert to Tcl's integer division rules.
*/
mp_sub_d(&bigResult, 1, &bigResult);
mp_add(&bigRemainder, &big2, &bigRemainder);
if ((mp_sub_d(&bigResult, 1, &bigResult) != MP_OKAY)
|| (mp_add(&bigRemainder, &big2, &bigRemainder) != MP_OKAY)) {
return OUT_OF_MEMORY;
}
}
mp_copy(&bigRemainder, &bigResult);
err = mp_copy(&bigRemainder, &bigResult);
mp_clear(&bigRemainder);
mp_clear(&big1);
mp_clear(&big2);
if (err != MP_OKAY) {
return OUT_OF_MEMORY;
}
BIG_RESULT(&bigResult);
case INST_LSHIFT:
@@ -8227,11 +8306,16 @@ ExecuteExtendedBinaryMathOp(
Tcl_TakeBignumFromObj(NULL, valuePtr, &big1);
mp_init(&bigResult);
if (opcode == INST_LSHIFT) {
mp_mul_2d(&big1, shift, &bigResult);
} else {
mp_signed_rsh(&big1, shift, &bigResult);
err = mp_init(&bigResult);
if (err == MP_OKAY) {
if (opcode == INST_LSHIFT) {
err = mp_mul_2d(&big1, shift, &bigResult);
} else {
err = mp_signed_rsh(&big1, shift, &bigResult);
}
}
if (err != MP_OKAY) {
return OUT_OF_MEMORY;
}
mp_clear(&big1);
BIG_RESULT(&bigResult);
@@ -8244,20 +8328,25 @@ ExecuteExtendedBinaryMathOp(
Tcl_TakeBignumFromObj(NULL, valuePtr, &big1);
Tcl_TakeBignumFromObj(NULL, value2Ptr, &big2);
mp_init(&bigResult);
err = mp_init(&bigResult);
switch (opcode) {
case INST_BITAND:
mp_and(&big1, &big2, &bigResult);
break;
if (err == MP_OKAY) {
switch (opcode) {
case INST_BITAND:
err = mp_and(&big1, &big2, &bigResult);
break;
case INST_BITOR:
mp_or(&big1, &big2, &bigResult);
break;
case INST_BITOR:
err = mp_or(&big1, &big2, &bigResult);
break;
case INST_BITXOR:
mp_xor(&big1, &big2, &bigResult);
break;
case INST_BITXOR:
err = mp_xor(&big1, &big2, &bigResult);
break;
}
}
if (err != MP_OKAY) {
return OUT_OF_MEMORY;
}
mp_clear(&big1);
@@ -8320,8 +8409,8 @@ ExecuteExtendedBinaryMathOp(
} else {
Tcl_TakeBignumFromObj(NULL, value2Ptr, &big2);
negativeExponent = mp_isneg(&big2);
mp_mod_2d(&big2, 1, &big2);
oddExponent = big2.used != 0;
err = mp_mod_2d(&big2, 1, &big2);
oddExponent = (err == MP_OKAY) && !mp_iszero(&big2);
mp_clear(&big2);
}
@@ -8385,7 +8474,7 @@ ExecuteExtendedBinaryMathOp(
/*
* We refuse to accept exponent arguments that exceed one mp_digit
* which means the max exponent value is 2**28-1 = 0x0fffffff =
* which means the max exponent value is 2**28-1 = 0x0FFFFFFF =
* 268435455, which fits into a signed 32 bit int which is within the
* range of the long int type. This means any numeric Tcl_Obj value
* not using TCL_NUMBER_INT type must hold a value larger than we
@@ -8478,8 +8567,13 @@ ExecuteExtendedBinaryMathOp(
return GENERAL_ARITHMETIC_ERROR;
}
Tcl_TakeBignumFromObj(NULL, valuePtr, &big1);
mp_init(&bigResult);
mp_expt_u32(&big1, (unsigned int)w2, &bigResult);
err = mp_init(&bigResult);
if (err == MP_OKAY) {
err = mp_expt_u32(&big1, (unsigned int)w2, &bigResult);
}
if (err != MP_OKAY) {
return OUT_OF_MEMORY;
}
mp_clear(&big1);
BIG_RESULT(&bigResult);
}
@@ -8626,38 +8720,44 @@ ExecuteExtendedBinaryMathOp(
overflowBasic:
Tcl_TakeBignumFromObj(NULL, valuePtr, &big1);
Tcl_TakeBignumFromObj(NULL, value2Ptr, &big2);
mp_init(&bigResult);
err = mp_init(&bigResult);
if (err == MP_OKAY) {
switch (opcode) {
case INST_ADD:
mp_add(&big1, &big2, &bigResult);
break;
err = mp_add(&big1, &big2, &bigResult);
break;
case INST_SUB:
mp_sub(&big1, &big2, &bigResult);
break;
err = mp_sub(&big1, &big2, &bigResult);
break;
case INST_MULT:
mp_mul(&big1, &big2, &bigResult);
break;
err = mp_mul(&big1, &big2, &bigResult);
break;
case INST_DIV:
if (big2.used == 0) {
mp_clear(&big1);
mp_clear(&big2);
mp_clear(&bigResult);
return DIVIDED_BY_ZERO;
}
mp_init(&bigRemainder);
mp_div(&big1, &big2, &bigResult, &bigRemainder);
/* TODO: internals intrusion */
if ((bigRemainder.used != 0)
&& (bigRemainder.sign != big2.sign)) {
/*
* Convert to Tcl's integer division rules.
*/
if (mp_iszero(&big2)) {
mp_clear(&big1);
mp_clear(&big2);
mp_clear(&bigResult);
return DIVIDED_BY_ZERO;
}
err = mp_init(&bigRemainder);
if (err == MP_OKAY) {
err = mp_div(&big1, &big2, &bigResult, &bigRemainder);
}
/* TODO: internals intrusion */
if (!mp_iszero(&bigRemainder)
&& (bigRemainder.sign != big2.sign)) {
/*
* Convert to Tcl's integer division rules.
*/
mp_sub_d(&bigResult, 1, &bigResult);
mp_add(&bigRemainder, &big2, &bigRemainder);
err = mp_sub_d(&bigResult, 1, &bigResult);
if (err == MP_OKAY) {
err = mp_add(&bigRemainder, &big2, &bigRemainder);
}
}
mp_clear(&bigRemainder);
break;
}
mp_clear(&bigRemainder);
break;
}
mp_clear(&big1);
mp_clear(&big2);
@@ -8678,6 +8778,7 @@ ExecuteExtendedUnaryMathOp(
Tcl_WideInt w;
mp_int big;
Tcl_Obj *objResultPtr;
mp_err err = MP_OKAY;
(void) GetNumberFromObj(NULL, valuePtr, &ptr, &type);
@@ -8689,8 +8790,13 @@ ExecuteExtendedUnaryMathOp(
}
Tcl_TakeBignumFromObj(NULL, valuePtr, &big);
/* ~a = - a - 1 */
(void)mp_neg(&big, &big);
mp_sub_d(&big, 1, &big);
err = mp_neg(&big, &big);
if (err == MP_OKAY) {
err = mp_sub_d(&big, 1, &big);
}
if (err != MP_OKAY) {
return OUT_OF_MEMORY;
}
BIG_RESULT(&big);
case INST_UMINUS:
switch (type) {
@@ -8701,12 +8807,18 @@ ExecuteExtendedUnaryMathOp(
if (w != WIDE_MIN) {
WIDE_RESULT(-w);
}
mp_init_i64(&big, w);
err = mp_init_i64(&big, w);
if (err != MP_OKAY) {
return OUT_OF_MEMORY;
}
break;
default:
Tcl_TakeBignumFromObj(NULL, valuePtr, &big);
}
(void)mp_neg(&big, &big);
err = mp_neg(&big, &big);
if (err != MP_OKAY) {
return OUT_OF_MEMORY;
}
BIG_RESULT(&big);
}
@@ -8802,6 +8914,7 @@ TclCompareTwoNumbers(
mp_clear(&big2);
return compare;
}
break;
case TCL_NUMBER_DOUBLE:
d1 = *((const double *)ptr1);
@@ -8848,6 +8961,7 @@ TclCompareTwoNumbers(
Tcl_InitBignumFromDouble(NULL, d1, &big1);
goto bigCompare;
}
break;
case TCL_NUMBER_BIG:
Tcl_TakeBignumFromObj(NULL, valuePtr, &big1);
@@ -8884,10 +8998,11 @@ TclCompareTwoNumbers(
mp_clear(&big2);
return compare;
}
break;
default:
Tcl_Panic("unexpected number type");
return TCL_ERROR;
}
return TCL_ERROR;
}
#ifdef TCL_COMPILE_DEBUG
@@ -9056,12 +9171,12 @@ IllegalExprOperandType(
ClientData ptr;
int type;
const unsigned char opcode = *pc;
const char *description, *operator = "unknown";
const char *description, *op = "unknown";
if (opcode == INST_EXPON) {
operator = "**";
op = "**";
} else if (opcode <= INST_LNOT) {
operator = operatorStrings[opcode - INST_LOR];
op = operatorStrings[opcode - INST_LOR];
}
if (GetNumberFromObj(NULL, opndPtr, &ptr, &type) != TCL_OK) {
@@ -9085,7 +9200,7 @@ IllegalExprOperandType(
}
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't use %s as operand of \"%s\"", description, operator));
"can't use %s as operand of \"%s\"", description, op));
Tcl_SetErrorCode(interp, "ARITH", "DOMAIN", description, NULL);
}
@@ -9172,7 +9287,7 @@ TclGetSrcInfoForPc(
}
srcOffset = cfPtr->cmd - codePtr->source;
eclPtr = Tcl_GetHashValue(hePtr);
eclPtr = (ExtCmdLoc *)Tcl_GetHashValue(hePtr);
for (i=0; i < eclPtr->nuloc; i++) {
if (eclPtr->loc[i].srcOffset == srcOffset) {
+9 -9
View File
@@ -47,7 +47,7 @@ static int FileForceOption(Tcl_Interp *interp,
int
TclFileRenameCmd(
ClientData clientData, /* Unused */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Interp for error reporting or recursive
* calls in the case of a tricky rename. */
int objc, /* Number of arguments. */
@@ -76,7 +76,7 @@ TclFileRenameCmd(
int
TclFileCopyCmd(
ClientData clientData, /* Unused */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Used for error reporting or recursive calls
* in the case of a tricky copy. */
int objc, /* Number of arguments. */
@@ -214,7 +214,7 @@ FileCopyRename(
int
TclFileMakeDirsCmd(
ClientData clientData, /* Unused */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Used for error reporting. */
int objc, /* Number of arguments */
Tcl_Obj *const objv[]) /* Argument strings passed to Tcl_FileCmd. */
@@ -338,7 +338,7 @@ TclFileMakeDirsCmd(
int
TclFileDeleteCmd(
ClientData clientData, /* Unused */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Used for error reporting */
int objc, /* Number of arguments */
Tcl_Obj *const objv[]) /* Argument strings passed to Tcl_FileCmd. */
@@ -946,7 +946,7 @@ FileBasename(
int
TclFileAttrsCmd(
ClientData clientData, /* Unused */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* The interpreter for error reporting. */
int objc, /* Number of command line arguments. */
Tcl_Obj *const objv[]) /* The command line objects. */
@@ -1162,7 +1162,7 @@ TclFileAttrsCmd(
int
TclFileLinkCmd(
ClientData clientData,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1313,7 +1313,7 @@ TclFileLinkCmd(
int
TclFileReadLinkCmd(
ClientData clientData,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1364,7 +1364,7 @@ TclFileReadLinkCmd(
int
TclFileTemporaryCmd(
ClientData clientData,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1523,7 +1523,7 @@ TclFileTemporaryCmd(
int
TclFileTempDirCmd(
ClientData clientData,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
+14 -11
View File
@@ -587,7 +587,7 @@ Tcl_SplitPath(
* plus the argv pointers and the terminating NULL pointer.
*/
*argvPtr = ckalloc((((*argcPtr) + 1) * sizeof(char *)) + size);
*argvPtr = (const char **)ckalloc((((*argcPtr) + 1) * sizeof(char *)) + size);
/*
* Position p after the last argv pointer and copy the contents of the
@@ -821,7 +821,7 @@ Tcl_FSJoinToPath(
return TclJoinPath(2, pair, 0);
} else {
int elemc = objc + 1;
Tcl_Obj *ret, **elemv = ckalloc(elemc*sizeof(Tcl_Obj *));
Tcl_Obj *ret, **elemv = (Tcl_Obj**)ckalloc(elemc*sizeof(Tcl_Obj *));
elemv[0] = pathPtr;
memcpy(elemv+1, objv, objc*sizeof(Tcl_Obj *));
@@ -1217,10 +1217,9 @@ DoTildeSubst(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_GlobObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1344,7 +1343,7 @@ Tcl_GlobObjCmd(
return TCL_ERROR;
}
separators = NULL; /* lint. */
separators = NULL;
switch (tclPlatform) {
case TCL_PLATFORM_UNIX:
separators = "/";
@@ -1449,7 +1448,7 @@ Tcl_GlobObjCmd(
if (length <= 0) {
goto skipTypes;
}
globTypes = TclStackAlloc(interp, sizeof(Tcl_GlobTypeData));
globTypes = (Tcl_GlobTypeData *)TclStackAlloc(interp, sizeof(Tcl_GlobTypeData));
globTypes->type = 0;
globTypes->perm = 0;
globTypes->macType = NULL;
@@ -1704,7 +1703,6 @@ Tcl_GlobObjCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
TclGlob(
Tcl_Interp *interp, /* Interpreter for returning error message or
@@ -1723,7 +1721,7 @@ TclGlob(
int result;
Tcl_Obj *filenamesObj, *savedResultObj;
separators = NULL; /* lint. */
separators = NULL;
switch (tclPlatform) {
case TCL_PLATFORM_UNIX:
separators = "/";
@@ -2522,7 +2520,7 @@ DoGlob(
Tcl_StatBuf *
Tcl_AllocStatBuf(void)
{
return ckalloc(sizeof(Tcl_StatBuf));
return (Tcl_StatBuf *)ckalloc(sizeof(Tcl_StatBuf));
}
/*
@@ -2633,20 +2631,25 @@ Tcl_GetBlocksFromStat(
#endif
}
#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
unsigned
Tcl_GetBlockSizeFromStat(
const Tcl_StatBuf *statPtr)
{
#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
return statPtr->st_blksize;
}
#else
unsigned
Tcl_GetBlockSizeFromStat(
TCL_UNUSED(const Tcl_StatBuf *))
{
/*
* Not a great guess, but will do...
*/
return GUESSED_BLOCK_SIZE;
#endif
}
#endif
/*
* Local Variables:
+3 -2
View File
@@ -960,7 +960,7 @@ TclDatelex(
int
TclClockOldscanObjCmd(
void *clientData, /* Unused */
void *dummy, /* Unused */
Tcl_Interp *interp, /* Tcl interpreter */
int objc, /* Count of paraneters */
Tcl_Obj *const *objv) /* Parameters */
@@ -970,6 +970,7 @@ TclClockOldscanObjCmd(
DateInfo dateInfo;
DateInfo* info = &dateInfo;
int status;
(void)dummy;
if (objc != 5) {
Tcl_WrongNumArgs(interp, 1, objv,
@@ -1074,7 +1075,7 @@ TclClockOldscanObjCmd(
if (yyHaveTime) {
Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj((int)
ToSeconds(yyHour, yyMinutes, yySeconds, yyMeridian)));
ToSeconds(yyHour, yyMinutes, yySeconds, (MERIDIAN)yyMeridian)));
} else {
Tcl_ListObjAppendElement(interp, result, Tcl_NewObj());
}
+20 -24
View File
@@ -219,7 +219,7 @@ Tcl_FindHashEntry(
Tcl_HashTable *tablePtr, /* Table in which to lookup entry. */
const void *key) /* Key to use to find matching entry. */
{
return (*((tablePtr)->findProc))(tablePtr, key);
return (*((tablePtr)->findProc))(tablePtr, (const char *)key);
}
static Tcl_HashEntry *
@@ -260,7 +260,7 @@ Tcl_CreateHashEntry(
int *newPtr) /* Store info here telling whether a new entry
* was created. */
{
return (*((tablePtr)->createProc))(tablePtr, key, newPtr);
return (*((tablePtr)->createProc))(tablePtr, (const char *)key, newPtr);
}
static Tcl_HashEntry *
@@ -348,7 +348,7 @@ CreateHashEntry(
if (typePtr->allocEntryProc) {
hPtr = typePtr->allocEntryProc(tablePtr, (void *) key);
} else {
hPtr = ckalloc(sizeof(Tcl_HashEntry));
hPtr = (Tcl_HashEntry *)ckalloc(sizeof(Tcl_HashEntry));
hPtr->key.oneWordValue = (char *) key;
hPtr->clientData = 0;
}
@@ -648,7 +648,7 @@ Tcl_HashStats(
* Print out the histogram and a few other pieces of information.
*/
result = ckalloc((NUM_COUNTERS * 60) + 300);
result = (char *)ckalloc((NUM_COUNTERS * 60) + 300);
sprintf(result, "%d entries in table, %d buckets\n",
tablePtr->numEntries, tablePtr->numBuckets);
p = result + strlen(result);
@@ -697,7 +697,7 @@ AllocArrayEntry(
if (size < sizeof(Tcl_HashEntry)) {
size = sizeof(Tcl_HashEntry);
}
hPtr = ckalloc(size);
hPtr = (Tcl_HashEntry *)ckalloc(size);
for (iPtr1 = array, iPtr2 = hPtr->key.words;
count > 0; count--, iPtr1++, iPtr2++) {
@@ -770,14 +770,14 @@ HashArrayKey(
void *keyPtr) /* Key from which to compute hash value. */
{
const int *array = (const int *) keyPtr;
unsigned int result;
TCL_HASH_TYPE result;
int count;
for (result = 0, count = tablePtr->keyType; count > 0;
count--, array++) {
result += *array;
}
return (TCL_HASH_TYPE) result;
return result;
}
/*
@@ -798,18 +798,18 @@ HashArrayKey(
static Tcl_HashEntry *
AllocStringEntry(
Tcl_HashTable *tablePtr, /* Hash table. */
TCL_UNUSED(Tcl_HashTable *),
void *keyPtr) /* Key to store in the hash table entry. */
{
const char *string = (const char *) keyPtr;
Tcl_HashEntry *hPtr;
unsigned int size, allocsize;
size_t size, allocsize;
allocsize = size = strlen(string) + 1;
if (size < sizeof(hPtr->key)) {
allocsize = sizeof(hPtr->key);
}
hPtr = ckalloc(offsetof(Tcl_HashEntry, key) + allocsize);
hPtr = (Tcl_HashEntry *)ckalloc(offsetof(Tcl_HashEntry, key) + allocsize);
memset(hPtr, 0, sizeof(Tcl_HashEntry) + allocsize - sizeof(hPtr->key));
memcpy(hPtr->key.string, string, size);
hPtr->clientData = 0;
@@ -863,11 +863,11 @@ CompareStringKeys(
static TCL_HASH_TYPE
HashStringKey(
Tcl_HashTable *tablePtr, /* Hash table. */
TCL_UNUSED(Tcl_HashTable *),
void *keyPtr) /* Key from which to compute hash value. */
{
const char *string = keyPtr;
unsigned int result;
const char *string = (const char *)keyPtr;
TCL_HASH_TYPE result;
char c;
/*
@@ -907,7 +907,7 @@ HashStringKey(
result += (result << 3) + UCHAR(c);
}
}
return (TCL_HASH_TYPE) result;
return result;
}
/*
@@ -927,11 +927,10 @@ HashStringKey(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static Tcl_HashEntry *
BogusFind(
Tcl_HashTable *tablePtr, /* Table in which to lookup entry. */
const char *key) /* Key to use to find matching entry. */
TCL_UNUSED(Tcl_HashTable *),
TCL_UNUSED(const char *))
{
Tcl_Panic("called %s on deleted table", "Tcl_FindHashEntry");
return NULL;
@@ -954,14 +953,11 @@ BogusFind(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static Tcl_HashEntry *
BogusCreate(
Tcl_HashTable *tablePtr, /* Table in which to lookup entry. */
const char *key, /* Key to use to find or create matching
* entry. */
int *newPtr) /* Store info here telling whether a new entry
* was created. */
TCL_UNUSED(Tcl_HashTable *),
TCL_UNUSED(const char *),
TCL_UNUSED(int *))
{
Tcl_Panic("called %s on deleted table", "Tcl_CreateHashEntry");
return NULL;
@@ -1023,7 +1019,7 @@ RebuildTable(
tablePtr->numBuckets * sizeof(Tcl_HashEntry *), 0);
} else {
tablePtr->buckets =
ckalloc(tablePtr->numBuckets * sizeof(Tcl_HashEntry *));
(Tcl_HashEntry **)ckalloc(tablePtr->numBuckets * sizeof(Tcl_HashEntry *));
}
for (count = tablePtr->numBuckets, newChainPtr = tablePtr->buckets;
count > 0; count--, newChainPtr++) {
+4 -4
View File
@@ -130,14 +130,14 @@ Tcl_RecordAndEvalObj(
int result, call = 1;
Tcl_CmdInfo info;
HistoryObjs *histObjsPtr =
Tcl_GetAssocData(interp, HISTORY_OBJS_KEY, NULL);
(HistoryObjs *)Tcl_GetAssocData(interp, HISTORY_OBJS_KEY, NULL);
/*
* Create the references to the [::history add] command if necessary.
*/
if (histObjsPtr == NULL) {
histObjsPtr = ckalloc(sizeof(HistoryObjs));
histObjsPtr = (HistoryObjs *)ckalloc(sizeof(HistoryObjs));
TclNewLiteralStringObj(histObjsPtr->historyObj, "::history");
TclNewLiteralStringObj(histObjsPtr->addObj, "add");
Tcl_IncrRefCount(histObjsPtr->historyObj);
@@ -211,9 +211,9 @@ Tcl_RecordAndEvalObj(
static void
DeleteHistoryObjs(
ClientData clientData,
Tcl_Interp *interp)
TCL_UNUSED(Tcl_Interp *))
{
HistoryObjs *histObjsPtr = clientData;
HistoryObjs *histObjsPtr = (HistoryObjs *)clientData;
TclDecrRefCount(histObjsPtr->historyObj);
TclDecrRefCount(histObjsPtr->addObj);
+241 -212
View File
File diff suppressed because it is too large Load Diff
+38 -56
View File
@@ -36,18 +36,14 @@ static Tcl_ThreadDataKey dataKey;
* Static functions for this file:
*/
static void FinalizeIOCmdTSD(ClientData clientData);
static Tcl_TcpAcceptProc AcceptCallbackProc;
static int ChanPendingObjCmd(ClientData unused,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
static int ChanTruncateObjCmd(ClientData dummy,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
static void RegisterTcpServerInterpCleanup(Tcl_Interp *interp,
AcceptCallback *acceptCallbackPtr);
static void TcpAcceptCallbacksDeleteProc(ClientData clientData,
Tcl_Interp *interp);
static Tcl_ExitProc FinalizeIOCmdTSD;
static Tcl_TcpAcceptProc AcceptCallbackProc;
static Tcl_ObjCmdProc ChanPendingObjCmd;
static Tcl_ObjCmdProc ChanTruncateObjCmd;
static void RegisterTcpServerInterpCleanup(
Tcl_Interp *interp,
AcceptCallback *acceptCallbackPtr);
static Tcl_InterpDeleteProc TcpAcceptCallbacksDeleteProc;
static void TcpServerCloseProc(ClientData callbackData);
static void UnregisterTcpServerInterpCleanupProc(
Tcl_Interp *interp,
@@ -71,7 +67,7 @@ static void UnregisterTcpServerInterpCleanupProc(
static void
FinalizeIOCmdTSD(
ClientData clientData) /* Not used. */
TCL_UNUSED(ClientData))
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
@@ -99,10 +95,9 @@ FinalizeIOCmdTSD(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_PutsObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -226,10 +221,9 @@ Tcl_PutsObjCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_FlushObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -291,10 +285,9 @@ Tcl_FlushObjCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_GetsObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -376,10 +369,9 @@ Tcl_GetsObjCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_ReadObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -520,10 +512,9 @@ Tcl_ReadObjCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_SeekObjCmd(
ClientData clientData, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -596,10 +587,9 @@ Tcl_SeekObjCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_TellObjCmd(
ClientData clientData, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -659,10 +649,9 @@ Tcl_TellObjCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_CloseObjCmd(
ClientData clientData, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -711,7 +700,7 @@ Tcl_CloseObjCmd(
/*
* Special handling is needed if and only if the channel mode supports
* more than the direction to close. Because if the close the last
* direction suppported we can and will go through the regular
* direction supported we can and will go through the regular
* process.
*/
@@ -768,10 +757,9 @@ Tcl_CloseObjCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_FconfigureObjCmd(
ClientData clientData, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -844,10 +832,9 @@ Tcl_FconfigureObjCmd(
*---------------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_EofObjCmd(
ClientData unused, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -884,10 +871,9 @@ Tcl_EofObjCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_ExecObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -952,7 +938,7 @@ Tcl_ExecObjCmd(
*/
argc = objc - skip;
argv = TclStackAlloc(interp, (argc + 1) * sizeof(char *));
argv = (const char **)TclStackAlloc(interp, (argc + 1) * sizeof(char *));
/*
* Copy the string conversions of each (post option) object into the
@@ -1052,10 +1038,9 @@ Tcl_ExecObjCmd(
*---------------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_FblockedObjCmd(
ClientData unused, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1099,10 +1084,9 @@ Tcl_FblockedObjCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_OpenObjCmd(
ClientData notUsed, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1223,20 +1207,19 @@ Tcl_OpenObjCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static void
TcpAcceptCallbacksDeleteProc(
ClientData clientData, /* Data which was passed when the assocdata
* was registered. */
Tcl_Interp *interp) /* Interpreter being deleted - not used. */
TCL_UNUSED(Tcl_Interp *))
{
Tcl_HashTable *hTblPtr = clientData;
Tcl_HashTable *hTblPtr = (Tcl_HashTable *)clientData;
Tcl_HashEntry *hPtr;
Tcl_HashSearch hSearch;
for (hPtr = Tcl_FirstHashEntry(hTblPtr, &hSearch);
hPtr != NULL; hPtr = Tcl_NextHashEntry(&hSearch)) {
AcceptCallback *acceptCallbackPtr = Tcl_GetHashValue(hPtr);
AcceptCallback *acceptCallbackPtr = (AcceptCallback *)Tcl_GetHashValue(hPtr);
acceptCallbackPtr->interp = NULL;
}
@@ -1278,10 +1261,10 @@ RegisterTcpServerInterpCleanup(
Tcl_HashEntry *hPtr; /* Entry for this record. */
int isNew; /* Is the entry new? */
hTblPtr = Tcl_GetAssocData(interp, "tclTCPAcceptCallbacks", NULL);
hTblPtr = (Tcl_HashTable *)Tcl_GetAssocData(interp, "tclTCPAcceptCallbacks", NULL);
if (hTblPtr == NULL) {
hTblPtr = ckalloc(sizeof(Tcl_HashTable));
hTblPtr = (Tcl_HashTable *)ckalloc(sizeof(Tcl_HashTable));
Tcl_InitHashTable(hTblPtr, TCL_ONE_WORD_KEYS);
Tcl_SetAssocData(interp, "tclTCPAcceptCallbacks",
TcpAcceptCallbacksDeleteProc, hTblPtr);
@@ -1324,7 +1307,7 @@ UnregisterTcpServerInterpCleanupProc(
Tcl_HashTable *hTblPtr;
Tcl_HashEntry *hPtr;
hTblPtr = Tcl_GetAssocData(interp, "tclTCPAcceptCallbacks", NULL);
hTblPtr = (Tcl_HashTable *)Tcl_GetAssocData(interp, "tclTCPAcceptCallbacks", NULL);
if (hTblPtr == NULL) {
return;
}
@@ -1362,7 +1345,7 @@ AcceptCallbackProc(
char *address, /* Address of client that was accepted. */
int port) /* Port of client that was accepted. */
{
AcceptCallback *acceptCallbackPtr = callbackData;
AcceptCallback *acceptCallbackPtr = (AcceptCallback *)callbackData;
/*
* Check if the callback is still valid; the interpreter may have gone
@@ -1448,7 +1431,7 @@ TcpServerCloseProc(
ClientData callbackData) /* The data passed in the call to
* Tcl_CreateCloseHandler. */
{
AcceptCallback *acceptCallbackPtr = callbackData;
AcceptCallback *acceptCallbackPtr = (AcceptCallback *)callbackData;
/* The actual data. */
if (acceptCallbackPtr->interp != NULL) {
@@ -1478,7 +1461,7 @@ TcpServerCloseProc(
int
Tcl_SocketObjCmd(
ClientData notUsed, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1652,7 +1635,7 @@ Tcl_SocketObjCmd(
port = TclGetString(objv[a]);
if (server) {
AcceptCallback *acceptCallbackPtr = ckalloc(sizeof(AcceptCallback));
AcceptCallback *acceptCallbackPtr = (AcceptCallback *)ckalloc(sizeof(AcceptCallback));
Tcl_IncrRefCount(script);
acceptCallbackPtr->script = script;
@@ -1720,7 +1703,7 @@ Tcl_SocketObjCmd(
int
Tcl_FcopyObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1813,10 +1796,9 @@ Tcl_FcopyObjCmd(
*---------------------------------------------------------------------------
*/
/* ARGSUSED */
static int
ChanPendingObjCmd(
ClientData unused, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1878,7 +1860,7 @@ ChanPendingObjCmd(
static int
ChanTruncateObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1951,7 +1933,7 @@ ChanTruncateObjCmd(
static int
ChanPipeObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -2002,7 +1984,7 @@ ChanPipeObjCmd(
int
TclChannelNamesCmd(
ClientData clientData,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
+60 -38
View File
@@ -22,13 +22,15 @@
static int TransformBlockModeProc(ClientData instanceData,
int mode);
static int TransformCloseProc(ClientData instanceData,
Tcl_Interp *interp);
Tcl_Interp *interp, int flags);
static int TransformInputProc(ClientData instanceData, char *buf,
int toRead, int *errorCodePtr);
static int TransformOutputProc(ClientData instanceData,
const char *buf, int toWrite, int *errorCodePtr);
#ifndef TCL_NO_DEPRECATED
static int TransformSeekProc(ClientData instanceData, long offset,
int mode, int *errorCodePtr);
#endif
static int TransformSetOptionProc(ClientData instanceData,
Tcl_Interp *interp, const char *optionName,
const char *value);
@@ -119,15 +121,19 @@ static inline void ResultAdd(ResultBuffer *r, unsigned char *buf,
static const Tcl_ChannelType transformChannelType = {
"transform", /* Type name. */
TCL_CHANNEL_VERSION_5, /* v5 channel */
TransformCloseProc, /* Close proc. */
TCL_CLOSE2PROC, /* Close proc. */
TransformInputProc, /* Input proc. */
TransformOutputProc, /* Output proc. */
#ifndef TCL_NO_DEPRECATED
TransformSeekProc, /* Seek proc. */
#else
NULL, /* Seek proc. */
#endif
TransformSetOptionProc, /* Set option proc. */
TransformGetOptionProc, /* Get option proc. */
TransformWatchProc, /* Initialize notifier. */
TransformGetFileHandleProc, /* Get OS handles out of channel. */
NULL, /* close2proc */
TransformCloseProc, /* close2proc */
TransformBlockModeProc, /* Set blocking/nonblocking mode.*/
NULL, /* Flush proc. */
TransformNotifyProc, /* Handling of events bubbling up. */
@@ -251,7 +257,6 @@ ReleaseData(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
TclChannelTransform(
Tcl_Interp *interp, /* Interpreter for result. */
@@ -287,7 +292,7 @@ TclChannelTransform(
* regime of the underlying channel and to use the same for us too.
*/
dataPtr = ckalloc(sizeof(TransformChannelData));
dataPtr = (TransformChannelData *)ckalloc(sizeof(TransformChannelData));
dataPtr->refCount = 1;
Tcl_DStringInit(&ds);
@@ -503,7 +508,7 @@ TransformBlockModeProc(
ClientData instanceData, /* State of transformation. */
int mode) /* New blocking mode. */
{
TransformChannelData *dataPtr = instanceData;
TransformChannelData *dataPtr = (TransformChannelData *)instanceData;
if (mode == TCL_MODE_NONBLOCKING) {
dataPtr->flags |= CHANNEL_ASYNC;
@@ -533,9 +538,14 @@ TransformBlockModeProc(
static int
TransformCloseProc(
ClientData instanceData,
Tcl_Interp *interp)
Tcl_Interp *interp,
int flags)
{
TransformChannelData *dataPtr = instanceData;
TransformChannelData *dataPtr = (TransformChannelData *)instanceData;
if ((flags & (TCL_CLOSE_READ | TCL_CLOSE_WRITE)) != 0) {
return EINVAL;
}
/*
* Important: In this procedure 'dataPtr->self' already points to the
@@ -616,7 +626,7 @@ TransformInputProc(
int toRead,
int *errorCodePtr)
{
TransformChannelData *dataPtr = instanceData;
TransformChannelData *dataPtr = (TransformChannelData *)instanceData;
int gotBytes, read, copied;
Tcl_Channel downChan;
@@ -783,7 +793,7 @@ TransformOutputProc(
int toWrite,
int *errorCodePtr)
{
TransformChannelData *dataPtr = instanceData;
TransformChannelData *dataPtr = (TransformChannelData *)instanceData;
/*
* Should assert(dataPtr->mode & TCL_WRITABLE);
@@ -828,6 +838,7 @@ TransformOutputProc(
*----------------------------------------------------------------------
*/
#ifndef TCL_NO_DEPRECATED
static int
TransformSeekProc(
ClientData instanceData, /* The channel to manipulate. */
@@ -835,7 +846,7 @@ TransformSeekProc(
int mode, /* How to move. */
int *errorCodePtr) /* Location of error flag. */
{
TransformChannelData *dataPtr = instanceData;
TransformChannelData *dataPtr = (TransformChannelData *)instanceData;
Tcl_Channel parent = Tcl_GetStackedChannel(dataPtr->self);
const Tcl_ChannelType *parentType = Tcl_GetChannelType(parent);
Tcl_DriverSeekProc *parentSeekProc = Tcl_ChannelSeekProc(parentType);
@@ -874,6 +885,7 @@ TransformSeekProc(
return parentSeekProc(Tcl_GetChannelInstanceData(parent), offset, mode,
errorCodePtr);
}
#endif
/*
*----------------------------------------------------------------------
@@ -902,10 +914,12 @@ TransformWideSeekProc(
int mode, /* How to move. */
int *errorCodePtr) /* Location of error flag. */
{
TransformChannelData *dataPtr = instanceData;
TransformChannelData *dataPtr = (TransformChannelData *)instanceData;
Tcl_Channel parent = Tcl_GetStackedChannel(dataPtr->self);
const Tcl_ChannelType *parentType = Tcl_GetChannelType(parent);
#ifndef TCL_NO_DEPRECATED
Tcl_DriverSeekProc *parentSeekProc = Tcl_ChannelSeekProc(parentType);
#endif
Tcl_DriverWideSeekProc *parentWideSeekProc =
Tcl_ChannelWideSeekProc(parentType);
ClientData parentData = Tcl_GetChannelInstanceData(parent);
@@ -918,9 +932,14 @@ TransformWideSeekProc(
if (parentWideSeekProc != NULL) {
return parentWideSeekProc(parentData, offset, mode, errorCodePtr);
#ifndef TCL_NO_DEPRECATED
} else if (parentSeekProc) {
return parentSeekProc(parentData, 0, mode, errorCodePtr);
#endif
} else {
*errorCodePtr = EINVAL;
return -1;
}
return parentSeekProc(parentData, 0, mode, errorCodePtr);
}
/*
@@ -948,25 +967,29 @@ TransformWideSeekProc(
* If we have a wide seek capability, we should stick with that.
*/
if (parentWideSeekProc != NULL) {
return parentWideSeekProc(parentData, offset, mode, errorCodePtr);
}
if (parentWideSeekProc == NULL) {
/*
* We're transferring to narrow seeks at this point; this is a bit complex
* because we have to check whether the seek is possible first (i.e.
* whether we are losing information in truncating the bits of the
* offset). Luckily, there's a defined error for what happens when trying
* to go out of the representable range.
*/
/*
* We're transferring to narrow seeks at this point; this is a bit complex
* because we have to check whether the seek is possible first (i.e.
* whether we are losing information in truncating the bits of the
* offset). Luckily, there's a defined error for what happens when trying
* to go out of the representable range.
*/
#ifndef TCL_NO_DEPRECATED
if (offset<LONG_MIN || offset>LONG_MAX) {
*errorCodePtr = EOVERFLOW;
return -1;
}
if (offset<LONG_MIN || offset>LONG_MAX) {
*errorCodePtr = EOVERFLOW;
return parentSeekProc(parentData, offset,
mode, errorCodePtr);
#else
*errorCodePtr = EINVAL;
return -1;
#endif
}
return parentSeekProc(parentData, offset,
mode, errorCodePtr);
return parentWideSeekProc(parentData, offset, mode, errorCodePtr);
}
/*
@@ -994,7 +1017,7 @@ TransformSetOptionProc(
const char *optionName,
const char *value)
{
TransformChannelData *dataPtr = instanceData;
TransformChannelData *dataPtr = (TransformChannelData *)instanceData;
Tcl_Channel downChan = Tcl_GetStackedChannel(dataPtr->self);
Tcl_DriverSetOptionProc *setOptionProc;
@@ -1032,7 +1055,7 @@ TransformGetOptionProc(
const char *optionName,
Tcl_DString *dsPtr)
{
TransformChannelData *dataPtr = instanceData;
TransformChannelData *dataPtr = (TransformChannelData *)instanceData;
Tcl_Channel downChan = Tcl_GetStackedChannel(dataPtr->self);
Tcl_DriverGetOptionProc *getOptionProc;
@@ -1072,13 +1095,12 @@ TransformGetOptionProc(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static void
TransformWatchProc(
ClientData instanceData, /* Channel to watch. */
int mask) /* Events of interest. */
{
TransformChannelData *dataPtr = instanceData;
TransformChannelData *dataPtr = (TransformChannelData *)instanceData;
Tcl_Channel downChan;
/*
@@ -1157,7 +1179,7 @@ TransformGetFileHandleProc(
int direction, /* Direction of interest. */
ClientData *handlePtr) /* Place to store the handle into. */
{
TransformChannelData *dataPtr = instanceData;
TransformChannelData *dataPtr = (TransformChannelData *)instanceData;
/*
* Return the handle belonging to parent channel. IOW, pass the request
@@ -1191,7 +1213,7 @@ TransformNotifyProc(
* transformation. */
int mask) /* The mask of occuring events. */
{
TransformChannelData *dataPtr = clientData;
TransformChannelData *dataPtr = (TransformChannelData *)clientData;
/*
* An event occured in the underlying channel. This transformation doesn't
@@ -1234,7 +1256,7 @@ static void
TransformChannelHandlerTimer(
ClientData clientData) /* Transformation to query. */
{
TransformChannelData *dataPtr = clientData;
TransformChannelData *dataPtr = (TransformChannelData *)clientData;
dataPtr->timer = NULL;
if (!(dataPtr->watchMask&TCL_READABLE) || ResultEmpty(&dataPtr->result)) {
@@ -1416,10 +1438,10 @@ ResultAdd(
if (r->allocated == 0) {
r->allocated = toWrite + INCREMENT;
r->buf = ckalloc(r->allocated);
r->buf = (unsigned char *)ckalloc(r->allocated);
} else {
r->allocated += toWrite + INCREMENT;
r->buf = ckrealloc(r->buf, r->allocated);
r->buf = (unsigned char *)ckrealloc(r->buf, r->allocated);
}
}
+69 -56
View File
@@ -32,7 +32,7 @@
*/
static int ReflectClose(ClientData clientData,
Tcl_Interp *interp);
Tcl_Interp *interp, int flags);
static int ReflectInput(ClientData clientData, char *buf,
int toRead, int *errorCodePtr);
static int ReflectOutput(ClientData clientData, const char *buf,
@@ -46,8 +46,10 @@ static int ReflectEventDelete(Tcl_Event *ev, ClientData cd);
#endif
static Tcl_WideInt ReflectSeekWide(ClientData clientData,
Tcl_WideInt offset, int mode, int *errorCodePtr);
#ifndef TCL_NO_DEPRECATED
static int ReflectSeek(ClientData clientData, long offset,
int mode, int *errorCodePtr);
#endif
static int ReflectGetOption(ClientData clientData,
Tcl_Interp *interp, const char *optionName,
Tcl_DString *dsPtr);
@@ -65,15 +67,19 @@ static void TimerRunWrite(ClientData clientData);
static const Tcl_ChannelType tclRChannelType = {
"tclrchannel", /* Type name. */
TCL_CHANNEL_VERSION_5, /* v5 channel */
ReflectClose, /* Close channel, clean instance data */
TCL_CLOSE2PROC, /* Close channel, clean instance data */
ReflectInput, /* Handle read request */
ReflectOutput, /* Handle write request */
#ifndef TCL_NO_DEPRECATED
ReflectSeek, /* Move location of access point. NULL'able */
#else
NULL,
#endif
ReflectSetOption, /* Set options. NULL'able */
ReflectGetOption, /* Get options. NULL'able */
ReflectWatch, /* Initialize notifier */
NULL, /* Get OS handle from the channel. NULL'able */
NULL, /* No close2 support. NULL'able */
ReflectClose, /* No close2 support. NULL'able */
ReflectBlock, /* Set blocking/nonblocking. NULL'able */
NULL, /* Flush channel. Not used by core. NULL'able */
NULL, /* Handle events. NULL'able */
@@ -81,7 +87,7 @@ static const Tcl_ChannelType tclRChannelType = {
#if TCL_THREADS
ReflectThread, /* thread action, tracking owner */
#else
NULL, /* thread action */
NULL, /* thread action */
#endif
NULL /* truncate */
};
@@ -419,7 +425,7 @@ static void SrcExitProc(ClientData clientData);
static void ForwardSetObjError(ForwardParam *p, Tcl_Obj *objPtr);
static ReflectedChannelMap * GetThreadReflectedChannelMap(void);
static void DeleteThreadReflectedChannelMap(ClientData clientData);
static Tcl_ExitProc DeleteThreadReflectedChannelMap;
#endif /* TCL_THREADS */
@@ -446,8 +452,7 @@ static int InvokeTclMethod(ReflectedChannel *rcPtr,
Tcl_Obj *argTwoObj, Tcl_Obj **resultObjPtr);
static ReflectedChannelMap * GetReflectedChannelMap(Tcl_Interp *interp);
static void DeleteReflectedChannelMap(ClientData clientData,
Tcl_Interp *interp);
static Tcl_InterpDeleteProc DeleteReflectedChannelMap;
static int ErrnoReturn(ReflectedChannel *rcPtr, Tcl_Obj *resObj);
static void MarkDead(ReflectedChannel *rcPtr);
@@ -492,7 +497,7 @@ static const char *msg_dstlost = "-code 1 -level 0 -errorcode NONE -errorinfo
int
TclChanCreateObjCmd(
ClientData clientData,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -681,7 +686,7 @@ TclChanCreateObjCmd(
* as the actual channel type.
*/
Tcl_ChannelType *clonePtr = ckalloc(sizeof(Tcl_ChannelType));
Tcl_ChannelType *clonePtr = (Tcl_ChannelType *)ckalloc(sizeof(Tcl_ChannelType));
memcpy(clonePtr, &tclRChannelType, sizeof(Tcl_ChannelType));
@@ -696,7 +701,9 @@ TclChanCreateObjCmd(
clonePtr->blockModeProc = NULL;
}
if (!(methods & FLAG(METH_SEEK))) {
#ifndef TCL_NO_DEPRECATED
clonePtr->seekProc = NULL;
#endif
clonePtr->wideSeekProc = NULL;
}
@@ -771,7 +778,7 @@ typedef struct {
static int
ReflectEventRun(
Tcl_Event *ev,
int flags)
TCL_UNUSED(int) /*flags*/)
{
/* OWNER thread
*
@@ -809,7 +816,7 @@ ReflectEventDelete(
int
TclChanPostEventObjCmd(
ClientData clientData,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -882,7 +889,7 @@ TclChanPostEventObjCmd(
* have gone seriously haywire.
*/
chan = Tcl_GetHashValue(hPtr);
chan = (Tcl_Channel)Tcl_GetHashValue(hPtr);
chanTypePtr = Tcl_GetChannelType(chan);
/*
@@ -898,7 +905,7 @@ TclChanPostEventObjCmd(
Tcl_Panic("TclChanPostEventObjCmd: channel is not a reflected channel");
}
rcPtr = Tcl_GetChannelInstanceData(chan);
rcPtr = (ReflectedChannel *)Tcl_GetChannelInstanceData(chan);
if (rcPtr->interp != interp) {
Tcl_Panic("TclChanPostEventObjCmd: postevent accepted for call from outside interpreter");
@@ -945,7 +952,7 @@ TclChanPostEventObjCmd(
}
#if TCL_THREADS
} else {
ReflectEvent *ev = ckalloc(sizeof(ReflectEvent));
ReflectEvent *ev = (ReflectEvent *)ckalloc(sizeof(ReflectEvent));
ev->header.proc = ReflectEventRun;
ev->events = events;
@@ -994,7 +1001,7 @@ static void
TimerRunRead(
ClientData clientData)
{
ReflectedChannel *rcPtr = clientData;
ReflectedChannel *rcPtr = (ReflectedChannel *)clientData;
rcPtr->readTimer = NULL;
Tcl_NotifyChannel(rcPtr->chan, TCL_READABLE);
}
@@ -1003,7 +1010,7 @@ static void
TimerRunWrite(
ClientData clientData)
{
ReflectedChannel *rcPtr = clientData;
ReflectedChannel *rcPtr = (ReflectedChannel *)clientData;
rcPtr->writeTimer = NULL;
Tcl_NotifyChannel(rcPtr->chan, TCL_WRITABLE);
}
@@ -1150,9 +1157,10 @@ TclChanCaughtErrorBypass(
static int
ReflectClose(
ClientData clientData,
Tcl_Interp *interp)
Tcl_Interp *interp,
int flags)
{
ReflectedChannel *rcPtr = clientData;
ReflectedChannel *rcPtr = (ReflectedChannel *)clientData;
int result; /* Result code for 'close' */
Tcl_Obj *resObj; /* Result data for 'close' */
ReflectedChannelMap *rcmPtr;/* Map of reflected channels with handlers in
@@ -1160,6 +1168,10 @@ ReflectClose(
Tcl_HashEntry *hPtr; /* Entry in the above map */
const Tcl_ChannelType *tctPtr;
if ((flags & (TCL_CLOSE_READ | TCL_CLOSE_WRITE)) != 0) {
return EINVAL;
}
if (TclInThreadExit()) {
/*
* This call comes from TclFinalizeIOSystem. There are no
@@ -1309,7 +1321,7 @@ ReflectInput(
int toRead,
int *errorCodePtr)
{
ReflectedChannel *rcPtr = clientData;
ReflectedChannel *rcPtr = (ReflectedChannel *)clientData;
Tcl_Obj *toReadObj;
int bytec; /* Number of returned bytes */
unsigned char *bytev; /* Array of returned bytes */
@@ -1331,8 +1343,8 @@ ReflectInput(
if (p.base.code != TCL_OK) {
if (p.base.code < 0) {
/*
* No error message, this is an errno signal.
*/
* No error message, this is an errno signal.
*/
*errorCodePtr = -p.base.code;
} else {
@@ -1416,7 +1428,7 @@ ReflectOutput(
int toWrite,
int *errorCodePtr)
{
ReflectedChannel *rcPtr = clientData;
ReflectedChannel *rcPtr = (ReflectedChannel *)clientData;
Tcl_Obj *bufObj;
Tcl_Obj *resObj; /* Result data for 'write' */
int written;
@@ -1437,8 +1449,8 @@ ReflectOutput(
if (p.base.code != TCL_OK) {
if (p.base.code < 0) {
/*
* No error message, this is an errno signal.
*/
* No error message, this is an errno signal.
*/
*errorCodePtr = -p.base.code;
} else {
@@ -1545,7 +1557,7 @@ ReflectSeekWide(
int seekMode,
int *errorCodePtr)
{
ReflectedChannel *rcPtr = clientData;
ReflectedChannel *rcPtr = (ReflectedChannel *)clientData;
Tcl_Obj *offObj, *baseObj;
Tcl_Obj *resObj; /* Result for 'seek' */
Tcl_WideInt newLoc;
@@ -1614,6 +1626,7 @@ ReflectSeekWide(
goto stop;
}
#ifndef TCL_NO_DEPRECATED
static int
ReflectSeek(
ClientData clientData,
@@ -1631,6 +1644,7 @@ ReflectSeek(
return ReflectSeekWide(clientData, offset, seekMode,
errorCodePtr);
}
#endif
/*
*----------------------------------------------------------------------
@@ -1654,7 +1668,7 @@ ReflectWatch(
ClientData clientData,
int mask)
{
ReflectedChannel *rcPtr = clientData;
ReflectedChannel *rcPtr = (ReflectedChannel *)clientData;
Tcl_Obj *maskObj;
/*
@@ -1726,7 +1740,7 @@ ReflectBlock(
ClientData clientData,
int nonblocking)
{
ReflectedChannel *rcPtr = clientData;
ReflectedChannel *rcPtr = (ReflectedChannel *)clientData;
Tcl_Obj *blockObj;
int errorNum; /* EINVAL or EOK (success). */
Tcl_Obj *resObj; /* Result data for 'blocking' */
@@ -1793,7 +1807,7 @@ ReflectThread(
ClientData clientData,
int action)
{
ReflectedChannel *rcPtr = clientData;
ReflectedChannel *rcPtr = (ReflectedChannel *)clientData;
switch (action) {
case TCL_CHANNEL_THREAD_INSERT:
@@ -1832,7 +1846,7 @@ ReflectSetOption(
const char *optionName, /* Name of requested option */
const char *newValue) /* The new value */
{
ReflectedChannel *rcPtr = clientData;
ReflectedChannel *rcPtr = (ReflectedChannel *)clientData;
Tcl_Obj *optionObj, *valueObj;
int result; /* Result code for 'configure' */
Tcl_Obj *resObj; /* Result data for 'configure' */
@@ -1909,7 +1923,7 @@ ReflectGetOption(
* The bypass functions are not required.
*/
ReflectedChannel *rcPtr = clientData;
ReflectedChannel *rcPtr = (ReflectedChannel *)clientData;
Tcl_Obj *optionObj;
Tcl_Obj *resObj; /* Result data for 'configure' */
int listc, result = TCL_OK;
@@ -1922,7 +1936,7 @@ ReflectGetOption(
#if TCL_THREADS
if (rcPtr->thread != Tcl_GetCurrentThread()) {
int opcode;
ForwardedOperation opcode;
ForwardParam p;
p.getOpt.name = optionName;
@@ -2174,9 +2188,9 @@ NewReflectedChannel(
Tcl_Obj *handleObj)
{
ReflectedChannel *rcPtr;
MethodName mn = METH_BLOCKING;
int mn = 0;
rcPtr = ckalloc(sizeof(ReflectedChannel));
rcPtr = (ReflectedChannel *)ckalloc(sizeof(ReflectedChannel));
/* rcPtr->chan: Assigned by caller. Dummy data here. */
@@ -2195,7 +2209,7 @@ NewReflectedChannel(
rcPtr->cmd = TclListObjCopy(NULL, cmdpfxObj);
Tcl_IncrRefCount(rcPtr->cmd);
rcPtr->methods = Tcl_NewListObj(METH_WRITE + 1, NULL);
while (mn <= METH_WRITE) {
while (mn <= (int)METH_WRITE) {
Tcl_ListObjAppendElement(NULL, rcPtr->methods,
Tcl_NewStringObj(methodNames[mn++], -1));
}
@@ -2496,13 +2510,12 @@ static ReflectedChannelMap *
GetReflectedChannelMap(
Tcl_Interp *interp)
{
ReflectedChannelMap *rcmPtr = Tcl_GetAssocData(interp, RCMKEY, NULL);
ReflectedChannelMap *rcmPtr = (ReflectedChannelMap *)Tcl_GetAssocData(interp, RCMKEY, NULL);
if (rcmPtr == NULL) {
rcmPtr = ckalloc(sizeof(ReflectedChannelMap));
rcmPtr = (ReflectedChannelMap *)ckalloc(sizeof(ReflectedChannelMap));
Tcl_InitHashTable(&rcmPtr->map, TCL_STRING_KEYS);
Tcl_SetAssocData(interp, RCMKEY,
(Tcl_InterpDeleteProc *) DeleteReflectedChannelMap, rcmPtr);
Tcl_SetAssocData(interp, RCMKEY, DeleteReflectedChannelMap, rcmPtr);
}
return rcmPtr;
}
@@ -2554,7 +2567,7 @@ DeleteReflectedChannelMap(
ClientData clientData, /* The per-interpreter data structure. */
Tcl_Interp *interp) /* The interpreter being deleted. */
{
ReflectedChannelMap *rcmPtr = clientData;
ReflectedChannelMap *rcmPtr = (ReflectedChannelMap *)clientData;
/* The map */
Tcl_HashSearch hSearch; /* Search variable. */
Tcl_HashEntry *hPtr; /* Search variable. */
@@ -2581,8 +2594,8 @@ DeleteReflectedChannelMap(
for (hPtr = Tcl_FirstHashEntry(&rcmPtr->map, &hSearch);
hPtr != NULL;
hPtr = Tcl_FirstHashEntry(&rcmPtr->map, &hSearch)) {
chan = Tcl_GetHashValue(hPtr);
rcPtr = Tcl_GetChannelInstanceData(chan);
chan = (Tcl_Channel)Tcl_GetHashValue(hPtr);
rcPtr = (ReflectedChannel *)Tcl_GetChannelInstanceData(chan);
MarkDead(rcPtr);
Tcl_DeleteHashEntry(hPtr);
@@ -2627,8 +2640,8 @@ DeleteReflectedChannelMap(
evPtr = resultPtr->evPtr;
/*
* Basic crash safety until this routine can get revised [3411310]
*/
* Basic crash safety until this routine can get revised [3411310]
*/
if (evPtr == NULL) {
continue;
@@ -2659,8 +2672,8 @@ DeleteReflectedChannelMap(
for (hPtr = Tcl_FirstHashEntry(&rcmPtr->map, &hSearch);
hPtr != NULL;
hPtr = Tcl_NextHashEntry(&hSearch)) {
chan = Tcl_GetHashValue(hPtr);
rcPtr = Tcl_GetChannelInstanceData(chan);
chan = (Tcl_Channel)Tcl_GetHashValue(hPtr);
rcPtr = (ReflectedChannel *)Tcl_GetChannelInstanceData(chan);
if (rcPtr->interp != interp) {
/*
@@ -2700,7 +2713,7 @@ GetThreadReflectedChannelMap(void)
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
if (!tsdPtr->rcmPtr) {
tsdPtr->rcmPtr = ckalloc(sizeof(ReflectedChannelMap));
tsdPtr->rcmPtr = (ReflectedChannelMap *)ckalloc(sizeof(ReflectedChannelMap));
Tcl_InitHashTable(&tsdPtr->rcmPtr->map, TCL_STRING_KEYS);
Tcl_CreateThreadExitHandler(DeleteThreadReflectedChannelMap, NULL);
}
@@ -2728,7 +2741,7 @@ GetThreadReflectedChannelMap(void)
static void
DeleteThreadReflectedChannelMap(
ClientData clientData) /* The per-thread data structure. */
TCL_UNUSED(ClientData))
{
Tcl_HashSearch hSearch; /* Search variable. */
Tcl_HashEntry *hPtr; /* Search variable. */
@@ -2777,8 +2790,8 @@ DeleteThreadReflectedChannelMap(
evPtr = resultPtr->evPtr;
/*
* Basic crash safety until this routine can get revised [3411310]
*/
* Basic crash safety until this routine can get revised [3411310]
*/
if (evPtr == NULL ) {
continue;
@@ -2817,8 +2830,8 @@ DeleteThreadReflectedChannelMap(
for (hPtr = Tcl_FirstHashEntry(&rcmPtr->map, &hSearch);
hPtr != NULL;
hPtr = Tcl_FirstHashEntry(&rcmPtr->map, &hSearch)) {
Tcl_Channel chan = Tcl_GetHashValue(hPtr);
ReflectedChannel *rcPtr = Tcl_GetChannelInstanceData(chan);
Tcl_Channel chan = (Tcl_Channel)Tcl_GetHashValue(hPtr);
ReflectedChannel *rcPtr = (ReflectedChannel *)Tcl_GetChannelInstanceData(chan);
MarkDead(rcPtr);
Tcl_DeleteHashEntry(hPtr);
@@ -2863,8 +2876,8 @@ ForwardOpToHandlerThread(
* Create and initialize the event and data structures.
*/
evPtr = ckalloc(sizeof(ForwardingEvent));
resultPtr = ckalloc(sizeof(ForwardingResult));
evPtr = (ForwardingEvent *)ckalloc(sizeof(ForwardingEvent));
resultPtr = (ForwardingResult *)ckalloc(sizeof(ForwardingResult));
evPtr->event.proc = ForwardProc;
evPtr->resultPtr = resultPtr;
@@ -2952,7 +2965,7 @@ ForwardOpToHandlerThread(
static int
ForwardProc(
Tcl_Event *evGPtr,
int mask)
TCL_UNUSED(int) /* mask */)
{
/*
* HANDLER thread.
@@ -3241,7 +3254,7 @@ ForwardProc(
* Odd number of elements is wrong. [x].
*/
char *buf = ckalloc(200);
char *buf = (char *)ckalloc(200);
sprintf(buf,
"{Expected list with even number of elements, got %d %s instead}",
listc, (listc == 1 ? "element" : "elements"));
@@ -3298,7 +3311,7 @@ static void
SrcExitProc(
ClientData clientData)
{
ForwardingEvent *evPtr = clientData;
ForwardingEvent *evPtr = (ForwardingEvent *)clientData;
ForwardingResult *resultPtr;
ForwardParam *paramPtr;

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