Compare commits

...
Author SHA1 Message Date
jan.nijtmans 5e7a3f6899 Eliminate TCL_SIZE_CMP() for now, not a good idea for Tcl 9.0 2023-04-06 09:52:56 +00:00
jan.nijtmans ba612dd4f8 Merge 9.0 2023-04-04 22:49:16 +00:00
jan.nijtmans 096c6ef84f Fix [6390566ecd]: Testcase cmdAH-4.3.13.00DC0000.tail.utf-32.tcl8.a fails sometimes 2023-04-04 22:47:27 +00:00
jan.nijtmans 4312e760d0 Merge 9.0 2023-04-04 22:10:45 +00:00
jan.nijtmans 2948220674 Accidental rename from TCL_8_COMPAT to TCL_SIGNED_SIZE in previous commit, so undo that 2023-04-04 21:58:38 +00:00
jan.nijtmans e5aed17b9d Merge 8.7 2023-04-04 21:55:41 +00:00
jan.nijtmans d206ee3c75 Starting with [51d813943bcaf835], chan-io-52.10 and io-52.10 are failing on the Windows (with Visual Studio) environment. For now, disable the testcases. 2023-04-04 21:54:35 +00:00
jan.nijtmans ef765324c9 TIP #628 addendum (various fixes to improve handling of 8.7 <-> 9.0 header differences) 2023-04-04 21:49:30 +00:00
jan.nijtmans e8ada42c8d more progress 2023-04-04 20:50:39 +00:00
pooryorick 8528cc5323 Fix for [9ca87e6286262a62], sync fcopy buffers input in ReadChars(). 2023-04-04 16:26:18 +00:00
pooryorick e1420101e1 Fix for [fa3d9fd818fa0072], [fcopy $chan1 $chan2 -size $size] is not [puts
-nonewline $chan2 [read $chan1 -size $size].
2023-04-03 21:20:28 +00:00
pooryorick 5d3ba90d87 Fix for [fa3d9fd818fa0072], [fcopy $chan1 $chan2 -size $size] is not [puts
-nonewline $chan2 [read $chan1 -size $size].
2023-04-03 20:58:46 +00:00
pooryorick 530c3b8f01 Fix typo in test io-53.12.1. 2023-04-03 19:58:42 +00:00
pooryorick 1203f8d384 Fix typo in previous commit. 2023-04-03 19:56:56 +00:00
pooryorick 1215212601 Fix for [9ca87e6286262a62], sync fcopy buffers input in ReadChars(). 2023-04-03 17:13:19 +00:00
pooryorick 3e6eaa5776 Fix for [9ca87e6286262a62], sync fcopy buffers input in ReadChars(). 2023-04-03 17:12:11 +00:00
pooryorick 465fa239eb Failing test for [9ca87e6286262a62f], Sync fcopy buffers input in ReadChars(). 2023-04-03 16:37:27 +00:00
jan.nijtmans 169cbd38fe Merge 9.0. Add some more utility macro's 2023-04-02 21:49:09 +00:00
apnadkarni 5e5a852fe0 Bug [7e3f26c748] - TCL_MEM_DEBUG false positive 2023-04-02 13:23:33 +00:00
jan.nijtmans 17d857c579 Merge 8.7 2023-04-01 14:55:36 +00:00
jan.nijtmans 81999e0554 Add -Wall -Wextra -Wc++-compat -Wconversion -Werror to CFLAGS in unix/dltest/Makefile.in, and minimal changes to make it work warning-free. Fix indenting 2023-04-01 14:52:08 +00:00
jan.nijtmans ce04b407d9 Merge 8.7. Code cleanup in dltest packages 2023-04-01 08:16:03 +00:00
jan.nijtmans 0726ae90db New "pkgt" for testing TIP #627 2023-04-01 07:45:22 +00:00
jan.nijtmans 7d1613ac75 Improve tcltest package: Don't use 'scan' for printable characters, and don't print lf as \x0A any more (as in Tcl 8.6) 2023-04-01 07:27:28 +00:00
jan.nijtmans b6a444f634 merge-mark 2023-03-31 21:41:58 +00:00
jan.nijtmans 21c787abd0 Restore iogt-2.3 expectation expectation to what it was in Tcl 8.6 (due to previous bug-fix) 2023-03-31 21:41:03 +00:00
jan.nijtmans efc68f3008 adapt iogt-2.3 expectation 2023-03-31 21:25:26 +00:00
jan.nijtmans 0fd5957429 Rebase to latest trunk. More progress 2023-03-31 21:02:23 +00:00
jan.nijtmans 9a89f0e222 merge-mark 2023-03-31 19:25:52 +00:00
jan.nijtmans fc78297f13 Backport CHANNEL_PROFILE_GET() usage fix from 9.0 2023-03-31 19:24:35 +00:00
jan.nijtmans c5d4ce7c51 Correct other CHANNEL_PROFILE_GET() usage as well, which had the same error. Further on: 1) profile in inputEncodingFlags is always equal to profile in outputEncodingFlags, so we only have to test one of them
2) We copy from inputchannel to outputchannel, so we - really - only have to test inStatePtr->inputEncodingFlags and outStatePtr->outputEncodingFlags. 3) In Tcl 9 we only want to set sameencoding when both channels are in tcl8 mode
2023-03-31 19:14:05 +00:00
pooryorick 90f77cbdf1 Fix TclCopyChannel() incorrect use of CHANNEL_PROFILE_GET(). 2023-03-31 18:56:33 +00:00
jan.nijtmans 3eb5ddf1da Merge 8.7 2023-03-31 11:16:20 +00:00
jan.nijtmans cc936d0713 Merge 8.6 2023-03-31 11:06:35 +00:00
jan.nijtmans 6bdd668a7c Update to tzdata 2023c (which is identical to 2023a, due to the summertime situation in Libanon) 2023-03-31 07:57:12 +00:00
jan.nijtmans 726c679083 Rename TclWinOpenFileChannel to OpenFileChannel, because it's static now. 2023-03-31 07:49:39 +00:00
jan.nijtmans feac96c8b3 Merge 8.7 2023-03-30 22:22:32 +00:00
jan.nijtmans ed24f448c7 One more snprintf 2023-03-30 22:06:00 +00:00
jan.nijtmans dc5930bc81 Merge 8.6 2023-03-30 22:02:55 +00:00
jan.nijtmans 1861455786 Fix [0cb3554903]: macOS 13 SDK deprecates sprintf() 2023-03-30 21:20:30 +00:00
jan.nijtmans 191fecdc87 Fix [0cb3554903]: macOS 13 SDK deprecates sprintf(). But better not use it on other platforms either. 2023-03-30 15:19:44 +00:00
max 67ced52076 Merge 8.7: Allow empty mode list in [chan create]. 2023-03-30 09:23:44 +00:00
max f8b9e919c9 Merge 8.6: Allow empty mode list in [chan create]. 2023-03-30 09:13:22 +00:00
max 784535a35c Allow empty mode list in [chan create], so that refchans are able to mimic the behavior of channels created by [socket -server]. 2023-03-30 08:46:27 +00:00
dgp 5b6755494d test hygiene. Match [removeFile] arguments to [makeFile] to fix debug alerts. 2023-03-29 15:06:48 +00:00
jan.nijtmans 7d527f91fd Merge 8.7. Some size_t -> Tcl_Size in internal header files 2023-03-29 08:54:52 +00:00
jan.nijtmans ef16c107bf typo 2023-03-29 08:32:52 +00:00
pooryorick 24d6b91453 Replace bit twiddling with clear expression. 2023-03-29 06:16:03 +00:00
pooryorick ef52a3851a Remove the last occurrences of TCL_ENCODING_NOCOMPLAIN. 2023-03-28 19:30:58 +00:00
pooryorick 9576a35d02 Combine two branches in write(). 2023-03-28 19:29:21 +00:00
jan.nijtmans 4d14a84353 Minor fix in winConsole.test 2023-03-28 16:03:42 +00:00
jan.nijtmans 7854b03fa2 Fix iocmd-12.11 testcase 2023-03-28 15:50:31 +00:00
jan.nijtmans 2445b5d59b Merge 8.7 2023-03-28 07:15:41 +00:00
jan.nijtmans dca79c0aca Fix [fa128568a5]: EOVERFLOW does not necessarily mean "file too big". Synchronize many error-messages with what Linux gives nowadays. 2023-03-28 07:14:35 +00:00
apnadkarni 9d87e5b616 Merge 8.7. POSIX errors update and minizip fix 2023-03-28 05:13:26 +00:00
apnadkarni 02ed0444e9 Merge 8.6. POSIX errors update and minizip fix 2023-03-28 05:02:08 +00:00
apnadkarni 2616ef0ef1 Fix irritating gcc warning for minizip 2023-03-28 04:47:00 +00:00
jan.nijtmans 82098d2dca Fix some typo's in POSIX error-messages, and add missing ones (ESTRPIPE, ERESTART, ENOSHARE, ENOMEDIUM, ENMFILE, EMEDIUMTYPE, EFTYPE, ECASECLASH) 2023-03-27 20:56:28 +00:00
jan.nijtmans 91fa419271 More text fixes 2023-03-27 20:24:09 +00:00
pooryorick 0899e9d020 Remove unneeded parts from test in fileName.test. 2023-03-27 20:08:21 +00:00
pooryorick bc060f980c Remove unneeded parts from test in fileName.test. 2023-03-27 19:56:36 +00:00
dgp 7f39dac888 test hygiene cleaning up created files. 2023-03-27 17:23:48 +00:00
jan.nijtmans f3e40e67d4 Merge 8.7 2023-03-27 14:44:28 +00:00
jan.nijtmans ac324e9b0b spacing 2023-03-27 14:42:18 +00:00
pooryorick 5ffb8a5035 Make the documentation of [encoding] more concise and readable. 2023-03-27 12:16:36 +00:00
pooryorick 3faf228237 Make the documentation of [encoding] more concise and readable. 2023-03-27 12:14:03 +00:00
jan.nijtmans e0df4408c7 Merge 8.7 2023-03-27 11:49:53 +00:00
jan.nijtmans d531e7af51 Merge 8.7 2023-03-27 11:43:02 +00:00
jan.nijtmans 2524a62bb6 More (internal) usage of TclGetString() and TclGetStringFromObj() macro's 2023-03-27 11:35:58 +00:00
pooryorick 587c1ebdba Avoid msvc "illegal indirection" error. 2023-03-27 11:14:50 +00:00
pooryorick b026d900d3 Avoid msvc "illegal indirection" error. 2023-03-27 11:13:17 +00:00
jan.nijtmans e1fdad425a Merge 8.7. Go back to lowercase for POSIX err-messages 2023-03-27 09:59:14 +00:00
pooryorick 49b6ecfb4e Fix some formatting errors. 2023-03-26 22:29:05 +00:00
pooryorick 38a87927cf Update reference-counting advice for Tcl_ObjSetVar2 and friends. 2023-03-26 22:18:05 +00:00
jan.nijtmans 1df3dc0ae2 Merge 8.7 2023-03-26 21:46:40 +00:00
pooryorick cc28ac83dd Mark: Valgrind reports no leaks. 2023-03-26 20:04:26 +00:00
pooryorick 7a84646588 Fix memory leak in Tcl_JoinObjCmd(). 2023-03-26 19:14:36 +00:00
jan.nijtmans d2fc2aa765 Sync all error-messages with modern Linux 2023-03-26 18:41:13 +00:00
jan.nijtmans 83740bf7d7 Merge 8.7 2023-03-26 17:22:02 +00:00
jan.nijtmans ad4011e1c8 Merge 8.6 2023-03-26 17:18:32 +00:00
jan.nijtmans e18f327808 Update to tzdata 2023b 2023-03-26 17:13:55 +00:00
pooryorick 30428a50c8 Merge-mark: Valgrind reports no memory leaks. 2023-03-26 16:42:41 +00:00
pooryorick 1df48c6782 Fix for [6d4e9d1af5bf5b7d]: Memory leak: SetFsPathFromAny, assisted by the
global literal table, causes a Tcl_Obj to reference itself.
2023-03-26 15:35:10 +00:00
pooryorick 0fd20aeeaa Fix for [6d4e9d1af5bf5b7d]: Memory leak: SetFsPathFromAny, assisted by the global
literal table, causes a Tcl_Obj to reference itself.
2023-03-26 15:07:56 +00:00
pooryorick 2002e0f0f0 Fix for [6d4e9d1af5bf5b7d]: Memory leak: SetFsPathFromAny, assisted by the
global literal table, causes a Tcl_Obj to reference itself.
2023-03-26 15:02:55 +00:00
pooryorick 2122f0eb09 Failing test for [6d4e9d1af5bf5b7d]. 2023-03-26 14:55:23 +00:00
jan.nijtmans 5c40bd9a6c Experimental fix for [fa128568a5]: EOVERFLOW does not necessarily mean "file too big"
Let's synchronize the POSIX error-messages with what Linux gives nowadays.
2023-03-25 20:00:58 +00:00
jan.nijtmans fc30e5e704 Merge 8.7 2023-03-24 21:09:33 +00:00
jan.nijtmans 414896d31f Fix [68417a8bb3]: No result/LF printed for 64-bit integer type check 2023-03-24 21:08:11 +00:00
jan.nijtmans f49e4099fe Merge 8.7 2023-03-24 20:58:04 +00:00
jan.nijtmans 220282500b Merge 8.6 2023-03-24 20:47:40 +00:00
jan.nijtmans e27c66d81a Fix [15e74a2fe6]: Fix various typos 2023-03-24 20:19:49 +00:00
dgp de08e1a143 duplicate test name 2023-03-24 16:49:17 +00:00
jan.nijtmans b0a23df7d6 Merge "unchained" branch, since all it does is add a little valgrind stuff to Makefile.in.
Hopefully this will stop Nathan's useless single-commit merges (his way there would be 32 more merges left to go)
2023-03-23 16:02:33 +00:00
jan.nijtmans ae9ebe2176 Merge 8.7 2023-03-23 15:55:22 +00:00
jan.nijtmans b726273bbe Merge 8.6 2023-03-23 15:54:27 +00:00
jan.nijtmans 5e0c34678e Resolve C warnings on 32-bit platforms. More code cleanup. 2023-03-23 15:48:54 +00:00
Konrad Schwarz 3985945f96 Merge-mark 2023-03-23 07:28:41 +00:00
jan.nijtmans ed66664f84 fix for [f3cb2a32d6] Add initialization to allocation of string rep buffer to resolve valgrind reports on use of uninitialized memory 2023-03-23 07:27:28 +00:00
pooryorick a51afb0e46 Merge trunk 4dca8eb033: Make "tcltest" package use "-profile tcl8" internally,
irrespective of what the default profile is.
2023-03-22 21:39:54 +00:00
pooryorick da0251a1f4 Merge trunk b10e2b66a9: Manpage fixes. 2023-03-22 21:38:41 +00:00
pooryorick 4576880f96 Merge trunk 9aa2b65a57: TIP 656 manpages. 2023-03-22 21:37:45 +00:00
pooryorick 10423ea0ca Merge trunk 49a4c8f8fb: TIP 656 implementation. 2023-03-22 21:36:46 +00:00
pooryorick 25a166a77a Merge trunk 31788d9a4b: arm64e -> arm64, since arm64e is not available yet on
MacOS (Thanks to Stefan Sobernig).
2023-03-22 21:24:16 +00:00
pooryorick 99a897fb41 Merge trunk 5ecd70c8ce: Unbreak build, and minor cleanup. 2023-03-22 21:21:46 +00:00
pooryorick 40a90d5fce Merge trunk 43584b2ac9: If TCL_UTF_MAX=4, don't set 'exact' to 1. 2023-03-22 21:19:31 +00:00
jan.nijtmans e66310792a Merge 9.0 2023-03-22 21:15:16 +00:00
pooryorick 9837f0e993 Merge trunk 9e266d00f2: Empty 2023-03-22 21:14:38 +00:00
pooryorick 3f624f6af0 Merge core-8-branch 7f5879e9cb: Fix (minor) warning on 32-bit platforms. 2023-03-22 21:13:13 +00:00
jan.nijtmans 4dcd70c967 Remove knownProfileBug constraint: this is already fixed 2023-03-22 21:11:12 +00:00
pooryorick 9d432523a6 Merge core-8-branch 3082cb9e80: Make valgrind_foreach target in Makefile.in
properly handle interrupted tests.
2023-03-22 20:26:05 +00:00
pooryorick 7f3849495a Merge core-8-branch 7fde86610c: New script used in the "valgrind_each" target
in Makefile.in.
2023-03-22 20:15:47 +00:00
jan.nijtmans d984134999 Merge 9.0 2023-03-22 20:13:09 +00:00
jan.nijtmans 17937238e2 One missing int -> Tcl_Size change 2023-03-22 20:09:09 +00:00
jan.nijtmans f4a64c89a2 Forgot one line in previous commit, and indenting 2023-03-22 19:30:02 +00:00
jan.nijtmans 6fec8f2b6c Let's get in the 'readability' changes from the 'unchained' branch, without the need for all those partial merges. 2023-03-22 18:13:29 +00:00
jan.nijtmans 1451fc7537 Merge 8.7 2023-03-22 18:00:15 +00:00
jan.nijtmans c103cb5d10 Merge 8.6 2023-03-22 17:57:39 +00:00
pooryorick 178c9d17be Merge trunk 6ef2153f20: Minor cleanup (Thanks, Gustaf!). 2023-03-22 17:54:26 +00:00
pooryorick a4b2c694ce Merge trunk c1e45151b3: Remove _LARGEFILE_SOURCE64 usage. See [d690400d07]. 2023-03-22 17:53:28 +00:00
pooryorick ff8b3d5c27 Merge trunk d04c1efe83: Merge in constraint spelling fix. Keep it in case the knownBug constraint is ever removed. 2023-03-22 17:51:31 +00:00
jan.nijtmans dedbaf0009 Fix [0265750233]: invalid read in cmdAH-4.3.13.C1.solo.utf-8.tcl8 2023-03-22 17:50:05 +00:00
pooryorick 511ae7efcb Merge trunk a76dee9eb4: Further fix for issue [ea69b0258a9833cb], crash when
using a channel transformation on TCP client socket.
2023-03-22 17:24:22 +00:00
pooryorick 5aedb72b9c Merge trunk a19e2f0c0b: ckfree -> Tcl_Free 2023-03-22 17:17:47 +00:00
pooryorick 364b4e65bf Merge trunk 30ba320f81: Since "unicode" is deprecated, use "utf-16" in
testcases. Otherwise -DTCL_NO_DEPRECATED build fails.
2023-03-22 17:16:42 +00:00
pooryorick e038969b66 Merge trunk 62058cafe0: Fix for issue [ea69b0258a9833cb], crash when using a
channel transformation on TCP client socket.
2023-03-22 17:15:26 +00:00
pooryorick 46d59bb7db Merge trunk 5c6fa768fe: Merge 8.6: Bug [183a1adcc0]. Buffer overflow in
Tcl_UtfToExternal.
2023-03-22 17:13:41 +00:00
pooryorick 30cce986ca Merge trunk 9db02d187b: 2 more testcases, proving utf-32 handling of surrogates
(actually: not handling!) is OK.
2023-03-22 17:11:37 +00:00
pooryorick 4fdc61a1f6 Merge trunk 6fb14ee3e: Minor bug-fix for utf-32: Only throw exception for
codepoints > +U10FFFF if "-strict" is specified. Otherwise replace with 0xFFF.
2023-03-22 17:10:54 +00:00
pooryorick 120806ee03 Merge trunk 286d6e9ab0: Fix [db7a085bd9]: encoding convertfrom -strict utf-16
accepts partial surrogates.
2023-03-22 17:09:51 +00:00
pooryorick bc309ba006 Merge trunk 8e467866ef: Forgot that \x00 is not printable anyway. 2023-03-22 17:08:35 +00:00
pooryorick 629aea4b6a Merge trunk 1bf875b575: Always output 2 hex characters in "unexpected byte sequence" exception message.
make testcases io-38.3/chan-io-38.3 independant from system encoding.
Bump version of tcltest to 2.5.6
2023-03-22 17:07:18 +00:00
pooryorick 5df2af1808 Merge trunk a0abb8bdc5: Make test less fragile to changing set of options. 2023-03-22 17:02:17 +00:00
pooryorick f8a7412ae3 Merge trunk bb76745df2: Fix cmdAH-4.3.13.00D80000.solo.utf-32le.tcl8.a testcase
from tip-656-tcl9 branch, when TCL_UTF_MAX=3.
2023-03-22 17:01:25 +00:00
pooryorick eaad662c18 Merge trunk 64c58db9fc: Adapt 2 testcases (io-39.16/io-39.16a), showing that
"-encoding" can be shortened to "-en", but not to "-e" (because there is
-eofchar too).
2023-03-22 16:58:45 +00:00
pooryorick ccf567f6a8 Merge trunk a52ac1d5fa: winFCmd-1.24 differs in error code on Win 11. 2023-03-22 16:57:08 +00:00
pooryorick 796370fa55 Merge trunk 13b04d4d60: Add "notWsl" test constraints. Clean up many testcases. 2023-03-22 16:56:08 +00:00
pooryorick 96b80a42ae Merge trunk 837dbec7cc: More -Wconversion warning fixes. 2023-03-22 16:55:24 +00:00
pooryorick 479247a5f0 Merge trunk 82bf22dad8: Add "teststringobj newunicode". Not used in testcases yet. 2023-03-22 16:53:56 +00:00
pooryorick e882c87033 Merge trunk 1997f71246: Fix [b4af93cd9f]: uninitialized bytes in http11-1.13.0. 2023-03-22 16:51:17 +00:00
pooryorick 2239eb3a90 Merge trunk fe9c231f48: Fix a few -Wconversion warnings. 2023-03-22 16:50:06 +00:00
pooryorick ce1b091802 Merge trunk 24072d92fc: testchmod fix. 2023-03-22 16:48:11 +00:00
jan.nijtmans 636a6d0ea9 Proposed fix for [0265750233]: invalid read in cmdAH-4.3.13.C1.solo.utf-8.tcl8. 2023-03-22 16:36:22 +00:00
pooryorick ce9c1b59e5 Merge trunk 04077c7b2e: Fix [95e287b956]: uninit value use in stringObj-4.2. 2023-03-22 14:11:19 +00:00
pooryorick d462ed2dd9 Merge trunk 2c4994d39e: ckfree() -> Tcl_Free(). 2023-03-22 14:09:11 +00:00
pooryorick 2a7d240b80 Merge trunk 37fc768d3: Tcl_WinTCharToUtf() is deprecated, so use Tcl_WCharToUtfDString() instead. 2023-03-22 14:08:41 +00:00
pooryorick ec7356be4c Merge trunk 9e195dccd7: Add new valgrind suppression items. 2023-03-22 14:07:38 +00:00
pooryorick 631b9cae2e Merge trunk 6b8ecafc24: A better fix for Valgrind "still reachable" report in TestcmdtokenCmd(). 2023-03-22 14:07:00 +00:00
pooryorick 88caedc3ce Merge trunk 1ad5d08ee8: Another round of -1 -> TCL_INDEX_NONE. 2023-03-22 13:59:58 +00:00
pooryorick dc7946e162 Merge trunk 7a2fc29ce0: More -1 -> TCL_INDEX_NONE. 2023-03-22 13:57:13 +00:00
pooryorick e21761aab7 Merge trunk adb38c336f: Make dltest/pkg*.c simple example how to use Tcl_Size
with Tcl_GetStringFromObj().
2023-03-22 13:55:33 +00:00
pooryorick a19bc41c3a Merge trunk aceb89781d: Protect zlib errors with check for null interp. 2023-03-22 13:54:50 +00:00
pooryorick a78ce452f2 Merge trunk: Test constraint notInCIenv no longer necessary (due to previous
fix).
2023-03-22 13:53:41 +00:00
pooryorick 438dbba007 Merge trunk: Fix [1b8df10110]: Tcl_GetTime returns wrong usec value on Windows. 2023-03-22 13:52:53 +00:00
pooryorick 6c33026c8c Merge trunk 91247f5ef8: Adapt type-casts to Tcl 9.0 signature of
Tcl_Free/Tcl_Realloc/Tcl_AttemptRealloc.
2023-03-22 13:51:45 +00:00
pooryorick 0fc4d3ef81 Merge trunk c1e87a7fe5: ckfree() shouldn't be used in Tcl 9 core code any more. 2023-03-22 13:50:49 +00:00
pooryorick bb933cb954 Merge trunk: Fix Valgrind "still reachable" report in TestcmdtokenCmd(). 2023-03-22 13:50:02 +00:00
pooryorick b523637e3b Merge trunk: Fix bug [9a978f8323], large reads > 2GB. 2023-03-22 13:48:45 +00:00
pooryorick ae0f696f21 Merge trunk: Disable more file permissions tests for WSL (not supported in
WSL/NTFS).
2023-03-22 13:46:42 +00:00
pooryorick e1e66d9209 Disable file permission tests under WSL as WSL does not support Unix file attrs
without special config.
2023-03-22 13:45:16 +00:00
pooryorick 84ad8e1eae Fix msvc build (with OPTS=symbols) 2023-03-22 13:44:15 +00:00
pooryorick 8602bafbb8 Merge trunk: Fix [f8ef6b3670] crash. TclpSysAlloc macro was truncating size
request to 32 bits on Windows.
2023-03-22 13:33:18 +00:00
pooryorick b12a433518 Merge trunk: Put back testcase io-52.20, and re-fix [4a7397e0b3]. 2023-03-22 13:31:32 +00:00
pooryorick 8f8776b56b Merge trunk: Add missing ')'. 2023-03-22 13:30:32 +00:00
pooryorick 12fbbf9df9 Merge trunk: Restore previous behavior for non-blocking mode, as for this mode
the semantics of [read]/[gets] were not broken. This was the 'some agreement'.
The change in line 8286 is necessary for both blocking and non-blocking mode:
Whenver the encoding change we need to reset the CHANNEL_ENCODING_ERROR flag.
2023-03-22 13:22:17 +00:00
pooryorick 7a69ce0ac4 Reverted [d156af9fb76dd2f4] and removed tests io-52.20 io-75.6 io-75.7, as this
commit, intended to fix issue [b8f575aa2398b0e4], breaks the semantics of
[read] and [gets]. Such a change would require an accepted TIP. See
[b8f575aa2398b0e4] for further discussion.
2023-03-22 13:16:33 +00:00
pooryorick 7b07b1df54 Merge 8.7. And fix Tcl_UtfToExternal()/Tcl_ExternalToUtf() (at least - suffucient for tclZlib.c), such that it now returns an error when src and dst *both* exceed INT_MAX. To be discussed further. 2023-03-22 13:14:39 +00:00
pooryorick a182a5bf20 Merge bug-fb368527ae. Bug [fb368527ae] Large string truncation 2023-03-22 13:13:13 +00:00
pooryorick 097fff3b0d Merge trunk: Make the descriptions in doc/Tcl.n more concise and intuitive. 2023-03-22 13:10:21 +00:00
pooryorick 574c6392d0 Merge trunk: Fix formatting issue in Tcl.n 2023-03-22 13:09:34 +00:00
pooryorick b14bccc65d Merge trunk: In case of combining TIP #494 (TCL_8_COMPAT) and #628 (building for Tcl 8.7
with 9.0 headers), ignore TCL_8_COMPAT macro. More Tcl_Size usage.
2023-03-22 13:07:50 +00:00
pooryorick ac8cf85039 Merge trunk: Fix [3d01d51bc4]: Tcl 9: Cannot write large strings to file. Also
some size_t -> Tcl_Size changes.
2023-03-22 13:06:58 +00:00
pooryorick 85461b74b3 Merge trunk: Fix [46dda6fc29] - trace crash caused by TclScanElement 2023-03-22 13:05:49 +00:00
pooryorick 30e195d456 Merge trunk: Fix [1d074b177a]. Failure to read .tclshrc 2023-03-22 13:04:46 +00:00
pooryorick a23d9c4dac Merge trunk: int -> Tcl_Size in tclEncoding.c 2023-03-22 13:03:21 +00:00
pooryorick 965d3fae6a Merge trunk: Fix [4bea02e811]: encoding convertfrom -strict ascii \x7f
generates exception Many other encodings had the same problem, and also the
reverse happened: encodings which should throw an exception with -strict but
didn't (within range 0x80-0x9F).
2023-03-22 13:01:17 +00:00
pooryorick 8088657ecc Merge trunk: Fix [d19fe0a5b]: Handling incomplete byte sequences for
utf-16/utf-32.
2023-03-22 12:35:24 +00:00
pooryorick b2f6161a18 Merge trunk: -strict for ucs-2. 2023-03-22 12:28:43 +00:00
pooryorick c258128087 Merge trunk: Fix for [885c86a9a0]: convertfrom utf8 breaks for 4 byte utf encodings. 2023-03-22 12:26:41 +00:00
pooryorick 1a13ddd24b Merge trunk: Final part of [10c2c17c32]: UTF-LE32 encoder mapping of
surrogates. Problem was in testcase, not in actual code.
2023-03-22 12:25:33 +00:00
pooryorick aeafdad0a9 Merge trunk 6ca5a8a9cd: encoding convertfrom -failindex, -strict for cesu-8. 2023-03-22 12:24:39 +00:00
pooryorick ae0658c370 Merge trunk e90924bb13: Test-case only. 2023-03-22 12:20:42 +00:00
pooryorick 3c37f824cc Merge trunk de933019a1: Fix for [bd1a60eb9c]: convertfrom utf-8 strict mode
allows surrogates in input sequence.
2023-03-22 12:19:26 +00:00
pooryorick cb4d5ce631 Merge trunk a155df4adc: (new) testcase encoding-16.15 as "knownBug": still needs a fix. 2023-03-22 12:12:14 +00:00
pooryorick 167878d3af Merge Trunk 2d036d968c: Proposed fix (and testcases) for [4a7397e0b3]: Tcl 9: fcopy with -strictencoding 1 UTF-8 channels 2023-03-22 12:02:44 +00:00
jan.nijtmans 32860a2742 Merge 8.7 2023-03-22 12:02:09 +00:00
jan.nijtmans f1fafe7c16 Move (TCL_ENCODING_PROFILE_MASK|GET|SET) from tcl.h to tclIO.h, since those are not public. Some formatting. 2023-03-22 11:44:33 +00:00
jan.nijtmans c9bc915417 Merge 8.7 2023-03-22 10:02:28 +00:00
pooryorick 79bc1e0416 Merge trunk e851055acb: Fix documentation on "encoding" command. 2023-03-22 09:50:03 +00:00
jan.nijtmans 44357a2534 code cleanup: use more *SURROGATE() macro's 2023-03-22 09:41:00 +00:00
jan.nijtmans 1e95b894cf merge-mark 2023-03-22 08:34:09 +00:00
jan.nijtmans 133af7524b Since TCL_ENCODING_PROFILE_DEFAULT == TCL_ENCODING_PROFILE_TCL8 (on Tcl 8), we can simplify. 2023-03-22 08:32:10 +00:00
pooryorick e0d5199463 Merge trunk c093f8b044: Renumber testscase. 2023-03-22 06:43:19 +00:00
apnadkarni e7c416995e Fix longIs64Bit->has64BitLengths else test will not run on 64-bit Wind 2023-03-22 02:39:10 +00:00
pooryorick ac8ac73e77 Remove unneeded Tcl_IncrRefCount and TclDecrRefCount. TclPtrSetVarIdx takes
ownership of newValuePtr if its refCount is 0, and either stores or frees it.
2023-03-21 23:55:12 +00:00
pooryorick 0fcb3ce5dc Remove unneeded Tcl_IncrRefCount and TclDecrRefCount. TclPtrSetVarIdx takes
ownership of newValuePtr if its refCount is 0, and either stores or frees it.
2023-03-21 23:49:01 +00:00
jan.nijtmans 4f5ae9bf24 Merge 8.7 2023-03-21 16:54:19 +00:00
jan.nijtmans 9152d5eec0 Fix [1bedc53c8c]: synchronous [read] with -strictencoding does not produce an error on invalid input 2023-03-21 16:28:57 +00:00
jan.nijtmans d63d524e1d Fix indenting. More use of TCL_INDEX_NONE 2023-03-21 16:26:30 +00:00
jan.nijtmans 48dcbfcc5b Some test-cases, which test for partial read without throwing EILSEQ immediately, only work with ""-blocking 0". That's expected. 2023-03-21 11:11:02 +00:00
jan.nijtmans afdd59e358 Merge 8.7 2023-03-21 08:45:56 +00:00
jan.nijtmans 8f3fb2f85e Fix [154ed7ce56]: Tcl 9: [gets] on -strictencoding 1 configured channel 2023-03-21 08:44:37 +00:00
jan.nijtmans 6ff9d841db Missing backslashes in macro def 2023-03-21 08:40:08 +00:00
jan.nijtmans f5c47e4402 Proposed fix for [1bedc53c8c]: synchronous [read] with -strictencoding does not produce an error on invalid input 2023-03-20 23:17:11 +00:00
jan.nijtmans 4ea926a40b Proposed fix for [154ed7ce56]: Tcl 9: [gets] on -strictencoding 1 configured channel.
Extracted from TIP #657 branch (better keeping bug-fix separate from enhancements)
2023-03-20 22:53:33 +00:00
jan.nijtmans 28add0c150 More TclNewIndexObj() usages (for values between -1 and SIZE_MAX-1) 2023-03-20 21:06:09 +00:00
dgp 88f1825232 Candidate fix for [f3cb2a32d6]
Add initialization to allocation of string rep buffer to resolve valgrind
reports on use of uninitialized memory
2023-03-20 18:45:28 +00:00
dgp 8133df3b6d Duplicate test name 2023-03-20 16:39:06 +00:00
jan.nijtmans 8b0dc386ba Merge 8.7 2023-03-20 14:19:35 +00:00
jan.nijtmans 5319a7d93f Fix [bdcb5126c0]: Failed assertion in test chan-io-7.3 2023-03-20 14:18:47 +00:00
jan.nijtmans cc2747afa8 Add longIs64bit constraint to lseq-4.4 (because this isn't expected to work on 32-bit platforms). Remove some unused constraints. 2023-03-20 12:08:58 +00:00
jan.nijtmans d103b73dba Fix [5ae5ffc3f4]: Problem with -failindex on 32-bit platform 2023-03-20 11:42:19 +00:00
jan.nijtmans b273a9c1d4 Use TclNewIndexObj() in stead of Tcl_NewWideIntObj(), which - actually - does the same but better for debugging. 2023-03-20 11:40:25 +00:00
jan.nijtmans 2475fa8cb8 Merge 8.7 2023-03-20 11:31:14 +00:00
jan.nijtmans 5d63902332 Fix [d7fd37ebd9]: handling leftover prefix in table encoding 2023-03-20 11:29:49 +00:00
apnadkarni 921b0dfdea Merge 8.7 - Fix http11 test hang 2023-03-20 02:38:36 +00:00
apnadkarni 75664c655d Fix http11 test hang caused by trailing brace in previous commit 2023-03-20 02:36:36 +00:00
jan.nijtmans 2d9a47cff1 Possible fix for [d7fd37ebd9]: handling leftover prefix in table encoding 2023-03-19 21:51:50 +00:00
jan.nijtmans 1876fe215d Another fix: don't access (w) twice 2023-03-19 13:34:04 +00:00
jan.nijtmans 78c295898e Doesn't look like a mem-leak: It appears that Tcl_ObjSetVar2() already handles that. 2023-03-19 13:32:46 +00:00
jan.nijtmans 449998d358 Proposed fix for [5ae5ffc3f4]: Problem with -failindex on 32-bit platform. This also fixes a memory-leak. 2023-03-19 13:23:03 +00:00
jan.nijtmans 203f1d691d Merge 8.7 2023-03-19 11:58:07 +00:00
jan.nijtmans 800d78f04d Don't let httpd11 depend on the system encoding any more: All text files are now stored in utf-8. 2023-03-19 11:56:58 +00:00
jan.nijtmans 8e6d7429e9 Merge 8.7 2023-03-19 11:45:22 +00:00
jan.nijtmans 291ff6db1b Remove unneeded backslash 2023-03-19 11:44:38 +00:00
jan.nijtmans d5ac687adb Merge 8.7 2023-03-18 09:08:35 +00:00
jan.nijtmans 7834acd2e4 one too much "-profile tcl8" 2023-03-18 09:07:20 +00:00
jan.nijtmans 5e2a39d626 Make http package use "-profile tcl8", irrespective of the default profile in Tcl, until decided differently 2023-03-18 09:02:15 +00:00
jan.nijtmans cb121886a4 Merge 8.7 2023-03-18 08:52:25 +00:00
jan.nijtmans 278b807336 Make "tcltest" package use "-profile tcl8" internally, irrespective of what the default profile is 2023-03-18 08:50:34 +00:00
jan.nijtmans 036b676c8b Merge 8.7 2023-03-18 08:45:55 +00:00
jan.nijtmans 5fbaf44ecf Manpage fixes 2023-03-18 08:42:39 +00:00
apnadkarni 43218725b3 Merge 8.7 - TIP 656 manpages 2023-03-18 04:28:49 +00:00
apnadkarni c6b740609a Update manpages for TIP 656 2023-03-18 04:10:47 +00:00
apnadkarni 64c45c10a9 Merge mark post-656 2023-03-18 03:37:24 +00:00
apnadkarni 1a75f270bd TIP 656 accepted 2023-03-18 03:35:02 +00:00
apnadkarni e89caee68c TIP 656 accepted 2023-03-18 03:18:13 +00:00
apnadkarni b90a2e051c Merge trunk 2023-03-18 02:59:14 +00:00
apnadkarni 6134622b61 Merge 8.7 2023-03-18 02:36:42 +00:00
jan.nijtmans 4ce715f36a Merge 8.7 2023-03-17 20:11:26 +00:00
jan.nijtmans bdad96ab69 Few more arm64e -> arm64 2023-03-17 20:10:29 +00:00
jan.nijtmans c0a02fd487 Merge 8.6 2023-03-17 20:09:18 +00:00
jan.nijtmans 453c27a88e arm64e -> arm64, since arm64e is not available yet on MacOS (Thanks to Stefan Sobernig) 2023-03-17 20:04:48 +00:00
jan.nijtmans ac93862047 Merge 8.7 2023-03-17 19:43:07 +00:00
jan.nijtmans 2d75729976 Merge 8.7 2023-03-17 16:15:16 +00:00
jan.nijtmans e9ccf557eb Fix [6390566ecd]: Testcase cmdAH-4.3.13.00DC0000.tail.utf-32.tcl8.a fails sometimes 2023-03-17 16:12:23 +00:00
dgp 5b8c37d24f merge 8.6 2023-03-17 14:38:16 +00:00
dgp 13b1529c7b Clean up after events to avoid errors in later tests that use an event loop. 2023-03-17 14:22:44 +00:00
dgp 1ee3af2d3d merge mark 2023-03-17 12:40:12 +00:00
dgp 87b6456684 unbreak the build 2023-03-17 12:35:51 +00:00
jan.nijtmans 4f2de3dfc9 merge-mark 2023-03-17 08:25:56 +00:00
jan.nijtmans 4aa63fcc25 Don't return from a void function 2023-03-17 08:24:59 +00:00
pooryorick 72deb9db89 Merge-Mark. 2023-03-17 08:13:44 +00:00
jan.nijtmans 3d439d74da Merge-mark 2023-03-17 08:06:13 +00:00
jan.nijtmans 9c8a1292c0 Don't introduce size_t in a header-file which didn't use it before. Make more clear that those are unsupported internal functions. 2023-03-17 07:57:14 +00:00
jan.nijtmans d81f257f99 Merge 8.7 2023-03-16 20:16:08 +00:00
jan.nijtmans 3129864cc2 If TCL_UTF_MAX=4, don't set 'exact' to 1 2023-03-16 20:12:23 +00:00
apnadkarni aa14feed8b Missed two tests. Blast it :-( 2023-03-16 18:15:46 +00:00
apnadkarni e7fc2e1e1d Merge 9.0 2023-03-16 18:11:08 +00:00
apnadkarni 527e79c3a8 Fix passing of encoding state in testencoding Tcl_UtfToExternal 2023-03-16 17:54:12 +00:00
apnadkarni 5655318f50 Merge 8.7 2023-03-16 17:29:12 +00:00
apnadkarni 05262be331 Update manpages in anticipation of TIP 656 2023-03-16 16:24:04 +00:00
jan.nijtmans 88f9f54d4c Merge 8.7 2023-03-16 15:38:40 +00:00
jan.nijtmans ae0471127e Prevent extensions compiled with TCL_UTF_MAX=4 (See [https://core.tcl-lang.org/tips/doc/trunk/tip/542.md|TIP #542]) from running in Tcl 8.6. 2023-03-16 15:36:55 +00:00
jan.nijtmans 1a6f1d5c40 Add some undocumented stub functions. Those can prevent a crash like [http://paste.tclers.tk/5763|this] example, when compiled with 8.7 headers but running it in Tcl 8.6. 2023-03-16 15:12:17 +00:00
jan.nijtmans 1eefaec471 Minor cleanup (Thanks, Gustaf!) 2023-03-16 11:38:20 +00:00
jan.nijtmans e019e5bd1d Fix (minor) warning on 32-bit platforms 2023-03-16 11:29:14 +00:00
jan.nijtmans 93ce80a916 unicode -> utf-16. Remove some unneeded encodingProfileTodo constraints 2023-03-16 10:00:26 +00:00
pooryorick 5846b1666f Make valgrind_foreach target in Makefile.in properly handle interrupted tests. 2023-03-16 08:15:03 +00:00
apnadkarni 4d978a00ed Change -encodingprofile to -profile 2023-03-16 03:48:45 +00:00
apnadkarni a3c59e320d Change -encodingprofile to -profile 2023-03-16 03:08:12 +00:00
pooryorick 70cf69246f New script used in the "valgrind_each" target in Makefile.in 2023-03-15 20:13:22 +00:00
jan.nijtmans 6f4eba042c Merge 8.7 2023-03-15 16:24:16 +00:00
jan.nijtmans 7543a1313f Merge 8.6 2023-03-15 16:23:22 +00:00
jan.nijtmans e0e09638fe Remove _LARGEFILE_SOURCE64 usage. See [d690400d07] 2023-03-15 16:21:53 +00:00
dgp a0be72dbca merge 8.7 2023-03-15 13:41:05 +00:00
dgp 6d3b66ad23 Merge in constraint spelling fix. Keep it in case the knownBug constraint is ever removed. 2023-03-15 13:28:55 +00:00
dgp 6bd8763c2d Misspelled constraint created testing noise. 2023-03-15 12:53:03 +00:00
pooryorick f378b48b06 Further fix for issue [ea69b0258a9833cb], crash when using a channel transformation on TCP client socket. 2023-03-15 11:37:13 +00:00
jan.nijtmans 23a421a9c1 Merge-mark. @nathan, please do forward merges from core-8-6-branch -> core-8-branch -> trunk. Fossil is not so intelligent, figuring out what's happening here. 2023-03-15 09:32:02 +00:00
pooryorick ba737587a8 Further fix for issue [ea69b0258a9833cb], crash when using a channel transformation on TCP client socket. 2023-03-15 09:25:15 +00:00
jan.nijtmans ea9a0277a2 ckfree -> Tcl_Free 2023-03-15 09:11:22 +00:00
pooryorick 6ded4b92be Further fix for issue [ea69b0258a9833cb], crash when using a channel transformation on TCP client socket. 2023-03-15 08:42:11 +00:00
pooryorick 6cf4a0dea3 Merge core-8-branch. 2023-03-14 20:37:45 +00:00
pooryorick fdcb9621bb Further fix for issue [ea69b0258a9833cb], crash when using a channel
transformation on TCP client socket.
2023-03-14 20:30:34 +00:00
pooryorick 3aef0c58f9 Further fix for issue [ea69b0258a9833cb], crash when using a channel transformation on TCP client socket. 2023-03-14 20:27:04 +00:00
apnadkarni c5d0535121 Merge 9.0. Also fix replace profile handling of orphan surrogates 2023-03-14 17:23:47 +00:00
apnadkarni 87b3bcc550 Merge 8.7 2023-03-14 15:34:42 +00:00
jan.nijtmans 76526242c0 Merge 8.7 2023-03-14 10:33:43 +00:00
jan.nijtmans b05b4cf948 Since "unicode" is deprecated, use "utf-16" in testcases. Otherwise -DTCL_NO_DEPRECATED build fails. 2023-03-14 10:30:59 +00:00
jan.nijtmans 18a99f2522 Add "ucs-2" constraint to encoding-bug-183a1adcc0-5 testcase, otherwise it fails with TCL_UTF_MAX>3.
Broken by [47857515422b8519|this] commit
2023-03-14 10:05:24 +00:00
pooryorick 4c26d23f06 Fix for issue [ea69b0258a9833cb], crash when using a channel transformation
on TCP client socket.
2023-03-13 20:57:59 +00:00
pooryorick 953a44bc6e Fix for issue [ea69b0258a9833cb], crash when using a channel transformation on
TCP client socket.
2023-03-13 19:19:32 +00:00
pooryorick 5094fb7825 Fix for issue [ea69b0258a9833cb], crash when using a channel transformation on
TCP client socket.
2023-03-13 19:07:25 +00:00
apnadkarni 95158a2d57 Fix passing of encoding state in testencoding Tcl_UtfToExternal 2023-03-13 16:32:55 +00:00
apnadkarni 5c3377f2e1 Merge 8.7: Bug [183a1adcc0]. Buffer overflow in Tcl_UtfToExternal 2023-03-13 15:59:11 +00:00
apnadkarni d53dfb14c7 Merge 8.6: Bug [183a1adcc0]. Buffer overflow in Tcl_UtfToExternal 2023-03-13 15:34:22 +00:00
apnadkarni 6d74232282 Bug [183a1adcc0]. Buffer overflow in Tcl_UtfToExternal 2023-03-13 13:44:35 +00:00
pooryorick df8a3a6ea4 Fix for issue [ea69b0258a9833cb], crash when using a channel transformation on
TCP client socket.
2023-03-13 13:36:52 +00:00
pooryorick 967e55306e Fix for issue [ea69b0258a9833cb], crash when using a channel transformation on
TCP client socket.
2023-03-13 12:22:06 +00:00
apnadkarni 844792f3bb Cherrypick yip-656. Start on Tcl_ExternalToUtf/Tcl_UtfToExternal tests 2023-03-12 17:10:51 +00:00
apnadkarni 22239fb7d2 Start on Tcl_ExternalToUtf/Tcl_UtfToExternal tests 2023-03-12 16:47:08 +00:00
jan.nijtmans ab2c6de1ed merge-mark 2023-03-12 16:38:13 +00:00
jan.nijtmans 131176ce2f Backport [6fb14ee3e876978c]. Add testcases 2023-03-12 16:37:12 +00:00
jan.nijtmans aee8588fbc 2 more testcases, proving utf-32 handling of surrogates (actually: not handling!) is OK 2023-03-12 16:23:33 +00:00
jan.nijtmans eeee744ee2 Minor bug-fix for utf-32: Only throw exception for codepoints > +U10FFFF if "-strict" is specified. Otherwise replace with 0xFFFD 2023-03-12 16:10:52 +00:00
jan.nijtmans 63b29d841b Merge 8.7 2023-03-12 12:59:28 +00:00
jan.nijtmans 77e951f2b8 Fix [db7a085bd9]: encoding convertfrom -strict utf-16 accepts partial surrogates 2023-03-12 12:37:29 +00:00
jan.nijtmans 9fb3d5754a Merge 9.0. Also ckalloc -> Tcl_Alloc and ckfree -> Tcl_Free 2023-03-12 12:00:49 +00:00
jan.nijtmans a16eb9ac30 Merge 8.7 2023-03-12 11:34:03 +00:00
jan.nijtmans 8bf2e2ace2 Forgot that \x00 is not printable anyway 2023-03-12 11:32:52 +00:00
jan.nijtmans ed8932a4eb Merge 8.7 2023-03-12 11:28:00 +00:00
jan.nijtmans b7f151f126 Make test-output more readable when it contains non-printable characters (stolen from TIP #656 impl, thanks Ashok!)
tcltest -> 2.5.6
2023-03-12 11:24:24 +00:00
jan.nijtmans 8c5fc11b5a Always output 2 hex characters in "unexpected byte sequence" exception message.
make testcases io-38.3/chan-io-38.3 independant from system encoding
2023-03-12 10:49:18 +00:00
jan.nijtmans 1889ded114 Proposed fix for [db7a085bd9]: encoding convertfrom -strict utf-16 accepts partial surrogates. TODO: testcases, and implement for 8.7 too 2023-03-11 22:00:29 +00:00
apnadkarni 5533596329 Add testencoding Tcl_ExternalToUtf/Tcl_UtfToExternal for raw testing of corresponding C functions 2023-03-11 16:47:42 +00:00
apnadkarni 6f85588bab Add testencoding Tcl_ExternalToUtf/Tcl_UtfToExternal for raw testing of corresponding C functions 2023-03-11 16:43:36 +00:00
apnadkarni 93160df498 Merged 9.0. Note knownProfileBug constraint which mark questionable tests to be resolved later. 2023-03-10 15:29:36 +00:00
dgp 21388fa31e merge 8.7 2023-03-10 13:45:01 +00:00
dgp 0951d3f692 merge 8.6 2023-03-10 13:33:19 +00:00
dgp 93bf87ed85 Make test less fragile to changing set of options. 2023-03-10 13:32:47 +00:00
apnadkarni d06a38ae5d Merge 8.7 2023-03-10 09:53:32 +00:00
apnadkarni e9b9864f56 Fix parsing of fconfigure set -encoding* options 2023-03-10 07:37:55 +00:00
jan.nijtmans 494b4c8127 Fix cmdAH-4.3.13.00D80000.solo.utf-32le.tcl8.a testcase from tip-656-tcl9 branch, when TCL_UTF_MAX=3 2023-03-09 20:55:43 +00:00
apnadkarni 56f5c7751c Fix SetChannelOption parsing of -encoding* to match GetChannelOption 2023-03-09 10:47:12 +00:00
jan.nijtmans bd3a6be21b Merge 8.7 2023-03-09 10:22:55 +00:00
jan.nijtmans 962d8aed89 Merge 8.6 2023-03-09 10:21:54 +00:00
jan.nijtmans 5b0be62536 Adapt 2 testcases (io-39.16/io-39.16a), showing that "-encoding" can be shortened to "-en", but not to "-e" (because there is -eofchar too) 2023-03-09 10:08:02 +00:00
jan.nijtmans a1fb554585 Fix tests/tcltest.test testcases (missing "namespace import") 2023-03-09 09:39:59 +00:00
apnadkarni 552d2bb53f Merge 8.7 - winFCmd-1.24 differs in error code on Win 11 2023-03-09 02:52:51 +00:00
apnadkarni 1b7f525ec7 Merge 8.6 - winFCmd-1.24 differs in error code on Win 11 2023-03-09 02:50:32 +00:00
apnadkarni 38555b60a2 winFCmd-1.24 has different error code on Win 11 2023-03-09 02:47:53 +00:00
jan.nijtmans 9f1cf8d5ef Merge 8.7 2023-03-08 20:40:23 +00:00
jan.nijtmans 23becaa71a Merge 9.0 2023-03-08 20:37:56 +00:00
jan.nijtmans c3da6c8fed Merge core-8-branch 2023-03-08 20:16:32 +00:00
jan.nijtmans 468e5148b3 Merge 8.6 2023-03-08 20:15:43 +00:00
jan.nijtmans 7ed7017d94 Add "notWsl" test constraints. Clean up many testcases 2023-03-08 19:58:08 +00:00
jan.nijtmans 10f4d4565d More -Wconversion warning fixes 2023-03-08 15:01:20 +00:00
jan.nijtmans fa28b1f243 Merge 8.7 2023-03-08 11:12:04 +00:00
jan.nijtmans 3203978c65 Add "teststringobj newunicode". Not used in testcases yet. 2023-03-08 11:02:27 +00:00
jan.nijtmans ebfa9b6f2d ckalloc -> Tcl_Alloc and ckfree -> Tcl_Free 2023-03-08 09:36:14 +00:00
jan.nijtmans 8dbd350305 Merge 8.7 2023-03-07 20:14:23 +00:00
jan.nijtmans 73229a7e53 Merge 9.0 2023-03-07 20:13:24 +00:00
jan.nijtmans 9aea48988c Merge 8.7 2023-03-07 20:10:15 +00:00
jan.nijtmans 0e0d74624b Fix [b4af93cd9f]: uninitialized bytes in http11-1.13.0 2023-03-07 20:09:30 +00:00
jan.nijtmans fffb0bdce5 Merge 8.7 2023-03-07 18:23:15 +00:00
jan.nijtmans 82acd6a35a Merge 8.6 2023-03-07 18:14:39 +00:00
jan.nijtmans 5cf1eed910 Fix a few -Wconversion warnings 2023-03-07 17:56:45 +00:00
apnadkarni 8c5476848a Merge 8.7 - testchmod fixes 2023-03-07 12:53:58 +00:00
apnadkarni 4df874dd7f Merge 8.6 - testchmod fixes 2023-03-07 12:28:40 +00:00
apnadkarni 906268caa7 Merge testchmod fix 2023-03-07 10:46:31 +00:00
jan.nijtmans 1ae5fd8198 Merge 8.7 2023-03-07 07:41:26 +00:00
jan.nijtmans 01d6e02666 Merge 8.6 2023-03-07 07:34:21 +00:00
jan.nijtmans e10915b565 Fix [95e287b956]: uninit value use in stringObj-4.2 2023-03-07 07:23:10 +00:00
jan.nijtmans 03618f8c95 merge-mark 2023-03-07 07:06:51 +00:00
jan.nijtmans 071917e1b2 Fix [f3cb2a32d6]: uninitialized value in format-2.18. Also remove repeated call to Tcl_DStringInit() 2023-03-07 07:03:36 +00:00
apnadkarni 1f6cec5ff3 Fix testchmod and associated tests that always failed on Windows 2023-03-07 02:52:26 +00:00
apnadkarni fe7ee54772 Create new branch named "bug-win-testchmod" 2023-03-07 02:27:43 +00:00
jan.nijtmans f5ba8a8478 Proposed fix for [95e287b956]: uninit value use in stringObj-4.2 2023-03-06 21:01:45 +00:00
jan.nijtmans f4450abcf9 Proposed fix for [f3cb2a32d6]: uninitialized value in format-2.18 2023-03-06 19:58:53 +00:00
dgp 5e095a3a4d [b4af93cd9f] Proposed fix from apnadkarni. It works! 2023-03-06 18:17:19 +00:00
jan.nijtmans 3eb68691b8 ckfree() -> Tcl_Free() 2023-03-06 10:30:41 +00:00
jan.nijtmans f0e415c1e1 Merge 8.7 2023-03-06 10:28:47 +00:00
jan.nijtmans cfa443421b Tcl_WinTCharToUtf() is deprecated, so use Tcl_WCharToUtfDString() in stead. 2023-03-06 10:24:15 +00:00
pooryorick 296e4767ea Add new valgrind suppression items. 2023-03-06 07:00:48 +00:00
pooryorick fa795b478a Add new valgrind suppression items. 2023-03-06 06:59:52 +00:00
pooryorick 40e214cd76 Add new valgrind suppression items. 2023-03-06 06:58:13 +00:00
jan.nijtmans 7ec4501d37 Merge 8.7 2023-03-05 21:27:49 +00:00
jan.nijtmans 9e0cc9d630 Merge-mark (but also remove some lost spacing) 2023-03-05 21:16:33 +00:00
jan.nijtmans 9d2cc36a0e Fix [57bfcf43dd]: Remove unreachable code in Tcl_SetWideIntObj() 2023-03-05 21:09:46 +00:00
jan.nijtmans e4e1062338 Another round of -1 -> TCL_INDEX_NONE 2023-03-05 19:57:48 +00:00
apnadkarni 0968aa6de7 Merge 8.7: Bug [9c5a00c69d]. Fix ~user on Windows 2023-03-05 11:42:31 +00:00
pooryorick f736bb9d86 A better fix for Valgrind "still reachable" report in TestcmdtokenCmd(). 2023-03-05 11:39:36 +00:00
apnadkarni 6e7d72c158 Merge 8.6: Bug [9c5a00c69d]. Fix ~user on Windows 2023-03-05 11:09:10 +00:00
apnadkarni 1f7d2aae34 Bug [9c5a00c69d]. Fix ~user on Windows 2023-03-05 09:57:29 +00:00
pooryorick 76edd58c3e A better fix for Valgrind "still reachable" report in TestcmdtokenCmd(). 2023-03-05 07:11:15 +00:00
jan.nijtmans 923ff1e3ca More -1 -> TCL_INDEX_NONE 2023-03-05 00:26:54 +00:00
jan.nijtmans 33d81b98be Make dltest/pkg*.c simple example how to use Tcl_Size with Tcl_GetStringFromObj() 2023-03-04 18:12:49 +00:00
apnadkarni 234394e2df Merge 8.7 - Protect zlib errors with check for null interp 2023-03-04 16:33:36 +00:00
apnadkarni 7b3ef36925 Protect zlib errors with check for null interp 2023-03-04 16:26:00 +00:00
apnadkarni c862e57095 Add test for [9c5a00c69d], tilde expansion of ~user 2023-03-04 15:11:01 +00:00
apnadkarni 0229ba1283 Bug [9c5a00c69d]. Tilde expansion on Windows 2023-03-04 12:13:31 +00:00
jan.nijtmans 4e84e02684 Merge 8.7 2023-03-04 10:20:34 +00:00
jan.nijtmans 80b392ba8e Merge 8.6 2023-03-04 10:19:44 +00:00
jan.nijtmans e13edcba86 Test constraint notInCIenv no longer necessary (due to previous fix) 2023-03-04 10:18:41 +00:00
jan.nijtmans e95b015990 Merge 8.7 2023-03-04 10:13:19 +00:00
jan.nijtmans aebb7627f5 Merge 8.6 2023-03-04 10:09:21 +00:00
jan.nijtmans 6285c13367 Fix [1b8df10110]: Tcl_GetTime returns wrong usec value on Windows 2023-03-04 10:08:18 +00:00
jan.nijtmans 8f18e27691 Adapt type-casts to Tcl 9.0 signature of Tcl_Free/Tcl_Realloc/Tcl_AttemptRealloc 2023-03-03 13:04:11 +00:00
jan.nijtmans 7f3d1257ff ckfree() shouldn't be used in Tcl 9 core code any more 2023-03-03 13:03:02 +00:00
pooryorick e7b37f1737 Fix Valgrind "still reachable" report in TestcmdtokenCmd(). 2023-03-03 12:39:09 +00:00
pooryorick 18385b8363 Fix Valgrind "still reachable" report in TestcmdtokenCmd(). 2023-03-03 12:17:15 +00:00
pooryorick d3aa6839f4 Fix Valgrind "still reachable" report in TestcmdtokenCmd(). 2023-03-03 12:15:11 +00:00
apnadkarni cb3d36ad5a Bug [9a978f8323]: Fix large reads > 2GB 2023-03-03 10:47:51 +00:00
apnadkarni f4618fc2d9 Merge 9.0 - disable file perms tests on wsl 2023-03-02 08:00:48 +00:00
apnadkarni 1ad16ea481 Merge 8.7 - disable tests on WSL 2023-03-02 07:46:17 +00:00
apnadkarni b464703493 Merge 8.7: Disable more file permissions tests for WSL (not supported in WSL/NTFS) 2023-03-02 07:32:04 +00:00
apnadkarni 4d67456953 Disable more file permissions tests for WSL (not supported in WSL/NTFS) 2023-03-02 07:08:48 +00:00
apnadkarni 44fdf09f7b Bug [e778e3f804]. Fix error message for invalid profile name. 2023-03-02 06:41:39 +00:00
apnadkarni ad8dae7587 Bug [e778e3f804]. Fix error message for invalid profile name. 2023-03-02 06:29:10 +00:00
apnadkarni 806babb932 Add encoding test vector files 2023-03-02 04:48:00 +00:00
apnadkarni f736321295 Cherrypick [13537afd1b] - eliminate TCL_ENCODING_MODIFIED 2023-03-02 04:35:44 +00:00
apnadkarni b2cdedcec2 Eliminate TCL_ENCODING_MODIFIED flag 2023-03-02 04:16:44 +00:00
apnadkarni a0beeb8a76 Fix Tcl_UtfToExternalDStringEx call in macos code 2023-03-01 15:39:06 +00:00
apnadkarni 1d9ebbc740 Merge mark with core-8-branch 2023-03-01 14:57:20 +00:00
apnadkarni 5a3e0c869e Cherrypick [f1dd5f1cc7]: constrain tests not supported on WSL 2023-03-01 14:55:13 +00:00
apnadkarni 64e7f77040 Disable file permission tests under WSL as WSL does not support Unix file attrs without special config 2023-03-01 13:58:52 +00:00
apnadkarni cc5dd09db3 Merge trunk 2023-03-01 13:41:44 +00:00
apnadkarni 30a9b333ba Bug [9a978f8323]: crash reading large files 2023-03-01 13:18:17 +00:00
jan.nijtmans 261c174d97 Fix msvc build (with OPTS=symbols) 2023-03-01 11:06:17 +00:00
apnadkarni 0f06bb38e8 Merge 9.0. TclpSysalloc fix. 2023-03-01 08:01:51 +00:00
apnadkarni a6b4ef3d29 Fix [f8ef6b3670] crash. TclpSysAlloc macro was truncating size request to 32 bits on Windows. 2023-03-01 07:56:03 +00:00
apnadkarni 9522e37880 Merge 9.0 2023-03-01 07:19:07 +00:00
apnadkarni 00e1068c03 Cherrypick [070225e33d]. Move setting of profile flags to lower level functions in case they are called directly 2023-02-28 17:16:25 +00:00
apnadkarni 74b7d6bc14 Merge 8.7 2023-02-28 15:39:09 +00:00
apnadkarni 3d177bd8b5 int -> Tcl_Size to match TIP 2023-02-28 14:08:19 +00:00
jan.nijtmans 62d9150ef5 Merge 8.7 2023-02-28 13:36:00 +00:00
jan.nijtmans 4227ef37bb Put back testcase io-52.20, and re-fix [4a7397e0b3] 2023-02-28 13:33:04 +00:00
apnadkarni 1652c942d8 Merge 8.7 2023-02-28 13:25:34 +00:00
apnadkarni 5d56a5b435 Merge 8.7 2023-02-28 13:24:18 +00:00
jan.nijtmans 7c9fe49b51 Merge 8.7 2023-02-28 12:45:06 +00:00
jan.nijtmans bb80189110 Missing ')' 2023-02-28 12:43:53 +00:00
apnadkarni 1eac8ab060 Move setting of profile in flags parameter to lower level functions in case they are called directly 2023-02-28 12:25:34 +00:00
jan.nijtmans 1923d22832 Merge 8.7 2023-02-28 12:20:34 +00:00
jan.nijtmans 70e40dd53d Restore previous behavior for non-blocking mode, as for this mode the semantics of [read]/[gets] were not broken. This was the 'some agreement'.
The change in line 8286 is necessary for both blocking and non-blocking mode: Whenver the encoding change we need to reset the CHANNEL_ENCODING_ERROR flag.
2023-02-28 12:16:10 +00:00
pooryorick 7661972907 Reverted [d156af9fb76dd2f4] and removed tests io-52.20 io-75.6 io-75.7, as this
commit, intended to fix issue [b8f575aa2398b0e4], breaks the semantics of
[read] and [gets].  Such a change would require an accepted TIP. See [b8f575aa2398b0e4] for further discussion.

jn: @pouryorick See [b8f575aa2398b0e4] for the reason why this commit is not appropriate: It gets core-8-branch back in the buggy state it was, without even providing a real solution everyone agrees on. You shouldn't revert my patch just because I reverted yours.

pooryorick:  As I explained, the reason for this reversion is that it hard-codes an unapproved change in the semantics of [read] and [gets] into the test suite.  Jan, your statement that it's a "revenge" reversion is false.  I spent a month trying to find some alternative to this reversion before actually performing it.  A commit that codifes in its tests changes in semantcs to [read]/[gets] simply shouldn't be on core-8-branch.
2023-02-28 11:57:03 +00:00
pooryorick bb2f06fc73 Reverted [d156af9fb76dd2f4] and removed tests io-52.20 io-75.6 io-75.7, as this
commit, intended to fix issue [b8f575aa2398b0e4], breaks the semantics of
[read] and [gets].  Such a change would require an accepted TIP. See [b8f575aa2398b0e4] for further discussion.

jn: @pouryorick See [b8f575aa2398b0e4] for the reason why this commit is not appropriate: It gets core-8-branch back in the buggy state it was, without even providing a real solution everyone agrees on. You shouldn't revert my patch just because I reverted yours.

pooryorick:  As I explained, the reason for this reversion is that it hard-codes an unapproved change in the semantics of [read] and [gets] into the test suite.  Jan, your statement that it's a "revenge" reversion is false.  I spent a month trying to find some alternative to this reversion before actually performing it.  A commit that codifes in its tests changes in semantcs to [read]/[gets] simply shouldn't be on core-8-branch.
2023-02-28 11:42:15 +00:00
jan.nijtmans fadb24f26a Merge 8.7. And fix Tcl_UtfToExternal()/Tcl_ExternalToUtf() (at least - sufficient for tclZlib.c), such that it now returns an error when src and dst *both* exceed INT_MAX. To be discussed further. 2023-02-28 11:00:44 +00:00
jan.nijtmans 5d8ae9bf17 Merge 8.6 2023-02-28 10:36:25 +00:00
apnadkarni 8e139e5cd7 Merge bug-fb368527ae. Bug [fb368527ae] Large string truncation 2023-02-28 10:28:28 +00:00
jan.nijtmans da55e192ba Fix [f9eafc3886]: Error handling in zlib comment/filename 2023-02-28 10:18:28 +00:00
pooryorick 57d266423a Make the descriptions in doc/Tcl.n more concise and intuitive. 2023-02-28 10:13:25 +00:00
pooryorick d29598480f Make the descriptions in doc/Tcl.n more concise and intuitive. 2023-02-28 10:06:22 +00:00
pooryorick 7d6cf09e02 Make the descriptions in doc/Tcl.n more concise and intuitive. 2023-02-28 10:04:49 +00:00
pooryorick 8b417f0e1e Fix formatting issue in Tcl.n 2023-02-28 09:59:29 +00:00
pooryorick e743d3e487 Fix formatting issue in Tcl.n 2023-02-28 09:57:22 +00:00
jan.nijtmans b914843dfc merge-mark 2023-02-28 07:49:13 +00:00
jan.nijtmans a947270ff7 In case of combining TIP #494 (TCL_8_COMPAT) and #628 (building for Tcl 8.7 with 9.0 headers), ignore TCL_8_COMPAT macro. More Tcl_Size usage. 2023-02-28 07:45:27 +00:00
jan.nijtmans a1fe72fa4a Fix testcases 2023-02-27 20:50:33 +00:00
jan.nijtmans 2c3a9f451b Experiment: Use -DTCL_SIGNED_SIZE to switch Tcl_Size from size_t to ptrdiff_t 2023-02-27 20:36:53 +00:00
apnadkarni 85bf0db1e8 Fix crash. int->size_t needs +1 in comparisons. 2023-02-27 12:31:49 +00:00
jan.nijtmans c6bb33407a Fix [3d01d51bc4]: Tcl 9: Cannot write large strings to file. Also some size_t -> Tcl_Size changes. 2023-02-27 11:59:54 +00:00
apnadkarni e2d89615d5 Tests for encoding strings > 4GB (under perf constraint) 2023-02-27 04:15:07 +00:00
apnadkarni ed360ca42f Add perf constraint to large io tests to prevent memory faults on systems with limited memory 2023-02-27 03:13:38 +00:00
jan.nijtmans 6b172a2131 fill in bug ticket-nr 2023-02-26 21:37:15 +00:00
jan.nijtmans e7b8b9d2dd Proposed fix for [f9eafc3886]: Error handling in zlib comment/filename. With testcases 2023-02-26 20:12:43 +00:00
jan.nijtmans 152d7203ac Handle Tcl_UtfToExternal error in tclZlib.c 2023-02-26 17:19:07 +00:00
jan.nijtmans baf9b5e9bb Handle statePtr != NULL as well 2023-02-26 16:54:02 +00:00
jan.nijtmans cbda5cb9b2 Make Tcl_UtfToExternal()/Tcl_ExternalToUtf() report the error, if srcLen and dstLen are both > INT_MAX and therefore not all characters can be handled by this function. 2023-02-26 16:41:06 +00:00
jan.nijtmans 6ab1efe806 merge-mark 2023-02-26 16:04:57 +00:00
jan.nijtmans 08a6b105e5 Merge 8.6 2023-02-26 16:04:03 +00:00
jan.nijtmans 8fdf20ec2b More dstring testcases, extracted from [46dda6fc29] 2023-02-26 16:01:29 +00:00
apnadkarni 4e6558b44a Fix [46dda6fc29] - trace crash caused by TclScanElement 2023-02-26 15:42:37 +00:00
jan.nijtmans 5ffda39949 Move the "srcLen -= srcChunkRead;" past the "if ((result != TCL_CONVERT_NOSPACE)..." (where it originally was), since this isn't needed if the loop ends anyway. 2023-02-26 12:56:18 +00:00
jan.nijtmans 79cbdf745a (size_t) -1 -> TCL_INDEX_NONE 2023-02-26 12:27:43 +00:00
apnadkarni deec081e74 Also fix [90ff9b7f73] - writes of exactly 4294967295 bytes 2023-02-26 07:15:06 +00:00
apnadkarni 2fb6b99620 Minor refactor, add tests 2023-02-26 06:26:01 +00:00
apnadkarni 7b0b2ebd37 Fix large writes to file. Need to break into INT_MAX size chunks. 2023-02-25 17:23:42 +00:00
apnadkarni 2a5b403768 Experimental fix for [fb368527ae] - length truncation 2023-02-25 16:29:09 +00:00
apnadkarni aa2b48262b Fix and tests for [46dda6fc29] 2023-02-25 09:26:06 +00:00
apnadkarni a826e66f11 Add tests for Bug [46dda6fc29] 2023-02-25 08:58:31 +00:00
apnadkarni 8390c51fca Fix [1d074b177a]. Failure to read .tclshrc 2023-02-25 07:35:21 +00:00
apnadkarni 4207c3d5c3 Tests pass modulo couple of differences in Tcl 8 and 9 default behavior to be discussed (tickets logged) 2023-02-25 06:13:21 +00:00
apnadkarni f0f2ee57f9 Compiles and runs. Tests still to be ported. 2023-02-25 03:03:46 +00:00
apnadkarni 50cafc9f13 Create new branch named "tip-656-tcl9" 2023-02-24 13:37:45 +00:00
apnadkarni 58db3d68eb Add teststringobj newunicode command to test invalid input to Tcl_NewUnicodeObj 2023-02-24 13:34:15 +00:00
apnadkarni 99a24e7883 Raise error on invalid flags 2023-02-24 10:32:37 +00:00
apnadkarni 76adf3151b Merge 8.7 2023-02-24 09:57:07 +00:00
apnadkarni 854369a67c Factor out encoding test vectors into separate file so they can be used for file IO tests 2023-02-24 09:35:09 +00:00
jan.nijtmans d5e9da898f Merge 8.7 2023-02-24 08:33:24 +00:00
jan.nijtmans 1c3c25097b int -> Tcl_Size in tclEncoding.c (making the diff between Tcl 8.7 and 9.0 smaller) 2023-02-24 08:25:27 +00:00
apnadkarni 485bc2fd88 Bug [40c61a5d10]. Fix syntax error message. 2023-02-24 03:35:31 +00:00
apnadkarni fe5707421f Merge [bug-dab7fd5973]. Pick up memory leak fix from 8.7. Thanks, Jan 2023-02-24 03:10:16 +00:00
jan.nijtmans 6caf484379 -strictencoding 1 -> -encodingprofile strict (since the testcases placed back in previous commit didn't have that yet) 2023-02-23 21:31:04 +00:00
jan.nijtmans 10c559acbf Remove left-over traces of [0a74820b6d], which was merged into the apn-encoding-profile and landed into tip-656. This commit was merged premature into core-8-branch, leaving a [dab7fd5973|memory leak] 2023-02-23 21:20:21 +00:00
apnadkarni 186cc71273 Had forgotten to remove disabled code 2023-02-23 13:24:58 +00:00
apnadkarni da915fdadf New signature for Tcl_ExternalToUtfDStringEx and Tcl_UtfToExternalDStringEx as per TIP 656 2023-02-23 13:19:45 +00:00
apnadkarni e469cdf190 Merge 8.7 2023-02-23 11:22:22 +00:00
jan.nijtmans 190f9219d5 Merge 8.7 2023-02-23 11:02:00 +00:00
jan.nijtmans 956059093c Fix [4bea02e811]: encoding convertfrom -strict ascii \x7f generates exception
Many other encodings had the same problem, and also the reverse happened: encodings which should throw an exception with -strict but didn't (within range 0x80-0x9F)
2023-02-23 11:00:48 +00:00
jan.nijtmans ce349b05df merge-mark 2023-02-23 10:45:56 +00:00
jan.nijtmans bf7b1adb89 See [d19fe0a5b] for follow-up to previous commit 2023-02-23 10:44:56 +00:00
apnadkarni d1920b380d Fix gcc warnings and encoding error message (bug [40c61a5d10]) 2023-02-23 10:22:58 +00:00
jan.nijtmans 9ae7f4dc4f merge-mark 2023-02-22 20:46:01 +00:00
jan.nijtmans 1d76ffb03b minor bug-fix in utf-16/utf-32: 2 testcases failed in Tcl 9 compatibility mode (-DTCL_NO_DEPRECATED) 2023-02-22 20:44:13 +00:00
jan.nijtmans 7c6f71019a Merge 8.7 2023-02-22 20:27:34 +00:00
jan.nijtmans 8f37d5c24e Merge 8.6 2023-02-22 17:56:42 +00:00
jan.nijtmans c3e063b0aa Fix [d19fe0a5b]: Handling incomplete byte sequences for utf-16/utf-32 2023-02-22 17:34:22 +00:00
apnadkarni 320eaab501 Merge 8.7 2023-02-22 15:28:00 +00:00
apnadkarni 2935048126 Add ICU tests for unmapped characters. 2023-02-22 13:42:55 +00:00
jan.nijtmans 12345dfed8 re-generate macDingbats.enc, so it can now throw exceptions for the range 0x8E-0x9F 2023-02-22 13:34:04 +00:00
jan.nijtmans 78db448fff Make txt2enc smarter, so we don't have to add DELETE any more in all original tables, better keep them as-is. 2023-02-22 13:31:41 +00:00
jan.nijtmans 58f1209a70 Merge 8.7. Adapt more testcases not to depend on the system encoding any more 2023-02-22 13:03:31 +00:00
jan.nijtmans e106525498 Merge 8.7 2023-02-22 07:48:10 +00:00
jan.nijtmans f0284298ad Fix [5607d6482c]: strict ucs-2 never implemented (TIP #346/#656) 2023-02-22 07:28:27 +00:00
jan.nijtmans 03a9d6928d Merge 8.6 2023-02-22 07:24:42 +00:00
jan.nijtmans 5219c94af5 Fix [534172ff5b]: Crash in DeleteReflectedChannelMap (introduced via tcllib 1.21) 2023-02-22 07:21:15 +00:00
jan.nijtmans a970bffd00 Add 0x7F: DELETE to more mac* encodings (so re-generating doesn't remove it again) 2023-02-21 23:22:45 +00:00
jan.nijtmans f95599f4d4 More encoding fixes, e.g. range 0x80-0x9F for dingbats and symbol. Remove "-m" option from txt2enc.c tool, since the same is already handled in the table encoding code in Tcl itself. This was wat prevent Tcl to handle throwing exceptions correctly 2023-02-21 23:16:14 +00:00
jan.nijtmans c606ae1574 Proposed fix for [d19fe0a5b]: Handling incomplete byte sequences for utf-16/utf-32 2023-02-21 17:50:36 +00:00
apnadkarni 9b8fa27457 Rework ICU tests to check validity of whole charmap in one test, else too many tests. 2023-02-21 17:27:16 +00:00
jan.nijtmans 42956f6f09 Some test-cases start failing in 9.0-compatibility-mode (-DTCL_NO_DEPRECATED), if the system encoding is one with gaps. So, better use iso8859-1 for those testcases 2023-02-21 16:58:13 +00:00
jan.nijtmans 417f868693 Proposed fix for [534172ff5b]: Crash in DeleteReflectedChannelMap (introduced via tcllib 1.21) 2023-02-21 16:09:18 +00:00
apnadkarni 4d644dfb73 Generate test data from ICU UCM data files. SBCS only for now 2023-02-21 16:03:18 +00:00
jan.nijtmans 3315012c95 re-generated 8 more encodings 2023-02-20 21:43:29 +00:00
jan.nijtmans 8660fd1af2 Two more files, re-generated 2023-02-20 20:52:06 +00:00
jan.nijtmans 280034d2ab Proposed fix for [4bea02e811]: encoding convertfrom -strict ascii \x7f generates exception 2023-02-20 20:41:00 +00:00
apnadkarni fa9ac8a850 Fix replace profile handling of truncated surrogates 2023-02-20 15:41:15 +00:00
apnadkarni 41af9f9e84 Add UTF16 and UTF32 tests 2023-02-20 15:08:58 +00:00
jan.nijtmans 23d9ca0ec4 Proposed fix for [5607d6482c]: strict ucs-2 never implemented (TIP #346/#656) 2023-02-19 11:41:44 +00:00
apnadkarni 9f595d2fa3 Remove knownBug test constraints now that fix has been merged from core-8-branch 2023-02-19 07:40:29 +00:00
apnadkarni 41c5d1cd91 Minor refactoring/fixes after merge 2023-02-18 17:41:44 +00:00
apnadkarni 933e1c8e0c Merge 8.7 to pick up UTF-8 encoding fix 2023-02-18 17:34:25 +00:00
apnadkarni 3d2dc70845 Done with invalid utf-8 table 2023-02-18 16:25:57 +00:00
jan.nijtmans 0892c6f37c Merge 8.7 2023-02-17 19:15:28 +00:00
jan.nijtmans c731ca1ffd Fix for [885c86a9a0]: convertfrom utf8 breaks for 4 byte utf encodings 2023-02-17 19:14:42 +00:00
apnadkarni fdbb12eced Part way through utf-8 test equivalence classes 2023-02-17 18:59:28 +00:00
apnadkarni 359092510b Merge 8.7 2023-02-17 11:08:17 +00:00
jan.nijtmans 45796af99d complete fix 2023-02-16 21:50:53 +00:00
jan.nijtmans 6bcdbfbf84 Merge 8.7 2023-02-16 21:41:49 +00:00
jan.nijtmans 6d674a96a1 Final part of [10c2c17c32]: UTF-LE32 encoder mapping of surrogates. Problem was in testcase, not in actual code 2023-02-16 21:29:07 +00:00
jan.nijtmans a3f58db271 Merge 8.7 2023-02-16 21:14:24 +00:00
jan.nijtmans 2c3252bc5c Fix [5e6ae6e05e]: Implement -strict correctly for cesu-8 2023-02-16 21:03:48 +00:00
jan.nijtmans d790e81db2 Fix [33ab6d08eb]: Inconsistent behavior with encoding convertfrom -failindex 2023-02-16 20:57:47 +00:00
apnadkarni 684cbb8f5c Bit more work on encoding test framework. Long way to go. 2023-02-16 17:15:35 +00:00
jan.nijtmans 0563a78902 Fix [5e6ae6e05e]: Implement -strict correctly for cesu-8 2023-02-16 16:59:10 +00:00
jan.nijtmans 5053891183 Try to fix [885c86a9a0]. Doesn't work completely yet. 2023-02-16 07:59:09 +00:00
jan.nijtmans f06c5e7af1 Fix for [33ab6d08eb]: Inconsistent behavior with encoding convertfrom -failindex 2023-02-15 20:26:10 +00:00
apnadkarni 96e60d29b7 Start on expanding encoding tests 2023-02-15 17:27:55 +00:00
jan.nijtmans 7fb1760f42 Merge 8.7. Test-case only 2023-02-15 07:30:03 +00:00
jan.nijtmans 4c2d834fca Ticket [10c2c17c32] follow-up. One output char too much with -failindex. 2023-02-15 07:21:55 +00:00
apnadkarni 6aed3e7d30 Merge 8.7 2023-02-15 05:24:48 +00:00
jan.nijtmans fb260e8382 Merge 8.7 2023-02-14 22:06:32 +00:00
jan.nijtmans 5040a69c28 Fix for [bd1a60eb9c]: convertfrom utf-8 strict mode allows surrogates in input sequence 2023-02-14 21:42:01 +00:00
jan.nijtmans 38df355850 Complete fix for [bd1a60eb9c]. Also fix a bug in the tableencoding. With testcases. 2023-02-14 20:50:26 +00:00
apnadkarni 891d60a9ad Remove obsolete comment 2023-02-14 11:56:49 +00:00
apnadkarni a750ed2c24 Fix uniqueness parsing fconfigure -encoding / -encodingprofile options 2023-02-14 11:39:35 +00:00
apnadkarni 85320f8fd0 Bug [bd1a60eb9c]. Eliminate TCL_ENCODING_UTF. 2023-02-14 11:37:35 +00:00
jan.nijtmans 2974b57279 Make a start fixing [bd1a60eb9c]. WIP 2023-02-14 07:29:36 +00:00
jan.nijtmans 0c306c8f81 Merge 8.7. Mark (new) testcase encoding-16.15 as "knownBug": still needs a fix. 2023-02-13 10:12:45 +00:00
jan.nijtmans 05f4bc701f Fix for [10c2c17c32]: UTF-LE32 encoder mapping of surrogates. With testcases (both for utf-32 and utf-16, which had the same bug) 2023-02-13 08:39:29 +00:00
apnadkarni 86d84d444c Tentative fix for [bd1a60eb9] - surrogates in strict utf-8 2023-02-12 17:34:58 +00:00
apnadkarni 0c764d2b03 Minor fixes and tests 2023-02-12 16:56:17 +00:00
apnadkarni bf448a6421 Added 'encoding profiles' 2023-02-12 11:04:16 +00:00
apnadkarni b5095134df Minor readability changes 2023-02-12 06:15:59 +00:00
jan.nijtmans bfaa709c2e Merge 8.7 2023-02-12 01:00:58 +00:00
jan.nijtmans 3954b7c2a3 Proposed fix (and testcases) for [4a7397e0b3]: Tcl 9: fcopy with -strictencoding 1 UTF-8 channels 2023-02-12 00:49:22 +00:00
apnadkarni 727887b6dc Partial implementation of replace profile 2023-02-11 17:38:07 +00:00
apnadkarni c2f0e2f8da Eliminate TCL_ENCODING_{STRICT,NOCOMPLAIN} 2023-02-11 01:51:32 +00:00
jan.nijtmans bab9170bdc Proposed fix (and testcases) for [4a7397e0b3]: Tcl 9: fcopy with -strictencoding 1 UTF-8 channels 2023-02-10 20:22:07 +00:00
apnadkarni e26214c287 Phase out (almost) STRICT and NOCOMPLAIN flags. 2023-02-10 17:07:12 +00:00
jan.nijtmans fd83fb931e Add 4 more testcases, showing that the same bug is present in utf-16 as well. Also fix the bug (really, now!) 2023-02-09 19:52:00 +00:00
apnadkarni 9d1ba01f11 Modify encoding C API to use profiles (in progress) 2023-02-09 17:04:33 +00:00
apnadkarni d46a244159 Add equivalent tests from ff630bf370 2023-02-09 17:03:31 +00:00
jan.nijtmans b185a55c3b Add 4 testcases, showing that the bug fix introduces another (minor) problem. To be fixed soon 2023-02-09 07:55:29 +00:00
apnadkarni 4294befd8b Do not have -failindex imply -strict 2023-02-09 07:27:43 +00:00
apnadkarni d04dfba748 Merge bug-10c2c17c32 2023-02-09 06:56:39 +00:00
apnadkarni 615082f1fa Merge core-8-branch 2023-02-07 17:10:07 +00:00
apnadkarni b741dab392 Fix tcltest to not exit on encoding errors when printing to stdout 2023-02-07 11:25:22 +00:00
apnadkarni e0ee29b9b6 Refactor encoding tests for broader coverage and easier test case management 2023-02-07 11:23:52 +00:00
apnadkarni 694ae19131 Fix call to EncodingConvertParseOption for decoding 2023-02-07 11:22:08 +00:00
jan.nijtmans f5f5ff4257 Proposed fix for [10c2c17c32]: UTF-LE32 encoder mapping of surrogates. TODO: testcase 2023-02-06 22:43:30 +00:00
pooryorick 597d3b9e7b Fix for [b8f575aa2398b0e4] and [154ed7ce564a7b4c], double-[read]/[gets]
problem. Partial-read functionality commented out.
2023-02-04 14:10:40 +00:00
pooryorick f238eb1dbc Fix test io-75.14. 2023-02-04 00:28:12 +00:00
pooryorick 4b5b655e61 Fix for [b8f575aa2398b0e4] and [154ed7ce564a7b4c], double-[read]/[gets]
problem. Partial-read functionality commented out.

jn: First, see broken build [https://github.com/tcltk/tcl/actions/runs/4082362246/jobs/7036637005|here]. Second: Moving this to core-8-branch is getting TIP #653 into 8.7 without being voted upon. It's simply not ready.

pooryorick:  That second statement is false. The parts of this fix that implement TIP #653 are specifically commented out.
2023-02-03 22:15:25 +00:00
pooryorick 52fc9a970c Fix for [b8f575aa2398b0e4] and [154ed7ce564a7b4c], double-[read]/[gets]
problem.  Partial-read functionality commented out.
2023-02-02 22:51:26 +00:00
apnadkarni 100d8ce724 Update tests to use -encodingprofile 2023-02-02 16:43:12 +00:00
apnadkarni e31133e3b0 Change encoding error options to fconfigure to encoding profiles 2023-02-02 15:37:21 +00:00
apnadkarni 26e89b4b3c Use common option parsing for ConvertfromObjCmd. Fix test error messages. 2023-02-02 12:23:37 +00:00
apnadkarni 637e7224c9 Replace encoding -strict etc. with -profile 2023-02-02 11:52:31 +00:00
jan.nijtmans c529405c65 Merge 8.7 2023-02-02 07:17:06 +00:00
jan.nijtmans de0a637d7c Fix documentation on "encoding" command 2023-02-02 07:12:34 +00:00
jan.nijtmans 536651d954 Merge 8.7 2023-02-01 23:02:16 +00:00
jan.nijtmans b9c893dbc9 Renumber testscase, sync with Tcl 9.0 2023-02-01 21:01:51 +00:00
jan.nijtmans 6b6d121149 merge-mark 2023-02-01 08:13:06 +00:00
jan.nijtmans 3eaad4bbc9 (cherry-pick) Make Tcl_UniCharToUtf more readable and add test to exercise surrogate handling. (test-case was still missing, which cannot be used in Tcl 8.6) 2023-02-01 08:10:12 +00:00
jan.nijtmans 44dd5d86bc merge-mark 2023-02-01 07:33:13 +00:00
jan.nijtmans 537c8e77ba (cherry-pick) Make Tcl_UniCharToUtf more readable and add test to exercise surrogate handling. 2023-02-01 07:32:14 +00:00
jan.nijtmans 5866ef6d2a (Cherry-pick) Make Tcl_UniCharToUtf more readable. 2023-02-01 07:29:48 +00:00
pooryorick f365be7f4d Merge trunk. 2023-02-01 00:34:50 +00:00
pooryorick 0184ebda4f Make Tcl_UniCharToUtf more readable and add test to exercise surrogate
handling.
2023-01-31 23:04:56 +00:00
pooryorick 078a694834 Fix error introduced in [3e5e37f83b058f3d] for Tcl_UniCharToUtf, and add test. 2023-01-31 22:15:02 +00:00
jan.nijtmans e5272c9be6 Remove incorrect comment. See: [https://www.magicsplat.com/tcl9/tcl9unicode.html#surrogates-as-literals]. Thanks, Ashok, for noticing this! 2023-01-31 17:34:05 +00:00
jan.nijtmans 596e33bb9e Remove incorrect comment. See: [https://www.magicsplat.com/tcl9/tcl9unicode.html#surrogates-as-literals]. Thanks, Ashok, for noticing this! 2023-01-31 17:30:59 +00:00
jan.nijtmans 081c085c0f merge-mark 2023-01-31 08:14:00 +00:00
jan.nijtmans 64e3a23bfd SetFlag -> GotFlag (since SetFlag always returns 1, this is nonsence in an if() statement). Also add test-case, showing that it was actually wrong, in behavior too. 2023-01-31 07:49:16 +00:00
pooryorick 0219b700b1 Update code comments for Tcl_UniCharToUtf(). 2023-01-30 19:37:35 +00:00
pooryorick a70ce8697c Make Tcl_UniCharToUtf() more readable. 2023-01-30 19:14:05 +00:00
pooryorick 7a5be2cdbd A branch of Tcl that does not look backwards. 2023-01-30 19:11:18 +00:00
dgp 58446472bb merge 8.7 2023-01-30 15:57:39 +00:00
dgp d3dae9eba4 silence compiler warning 2023-01-30 15:37:41 +00:00
pooryorick 8c0f76a7de A few more readability changes to Tcl_UniCharToUtf()
jn: Please, don't do that here. Tcl_UniCharToUtf() is shared between 8.6, 8.7 and 9.0. So if you want to make it easier to read, it should be done on all 3 branches. I know you only care about "trunk", but it makes maintenance on 8.6/8.7/9.0 harder than it already is. I don't want to spend time on reviewing such kind of changes, and no-one else is doing it. Thanks for understanding (I hope)!
2023-01-30 11:59:41 +00:00
pooryorick 4d235ca93a Make Tcl_UniCharToUtf() a little easier to read. 2023-01-30 11:22:28 +00:00
jan.nijtmans 5b86b255d4 Another situation where TCL_COMBINE handling gives a strange result (utf-32 encoder) 2023-01-28 20:50:36 +00:00
jan.nijtmans 468b1a4346 Fix "format %c 0x10000041", should give the same answer as in Tcl 8.6 (Handling of TCL_COMBINE flag should not be visible at script level) 2023-01-28 18:50:32 +00:00
pooryorick 7f87f0f8ea Add some comments and tidy code. 2023-01-27 19:15:09 +00:00
jan.nijtmans 5d13f6b527 Merge 8.7 2023-01-27 15:10:36 +00:00
jan.nijtmans 0318ff75d9 Fix off-by-one error in tclCmdAH.c, with testcases showing that it works now. 2023-01-27 14:48:37 +00:00
jan.nijtmans 06de3a9ba1 new testcase encoding-18.1. Testcase cleanup 2023-01-27 14:23:08 +00:00
jan.nijtmans d838764849 Update fcopy documentation regarding -size argument 2023-01-27 08:20:57 +00:00
jan.nijtmans 8ea5f2cfce Update fcopy documentation regarding -size argument 2023-01-27 08:17:34 +00:00
pooryorick 23e46e5885 Merge 8.7 2023-01-27 00:46:36 +00:00
pooryorick d271c9f407 Fix for [ee08ed090b0a5408], sporadic segmentation fault in
coroutine.test/coroutine-7.4.
2023-01-26 23:55:30 +00:00
pooryorick 7426076e0f Test TableFromUtfProc() with strict handling of encoding errors. 2023-01-25 10:02:27 +00:00
pooryorick ca4e244cca Test TableFromUtfProc() with strict handling of encoding errors. 2023-01-25 02:52:24 +00:00
jan.nijtmans 97041036d3 Merge 8.7 2023-01-24 20:05:00 +00:00
jan.nijtmans 1dd572d476 First part of fix for [4a7397e0b3]. Not complete yet. 2023-01-24 20:00:22 +00:00
jan.nijtmans 20ace1aa6c Merge 9.0 2023-01-24 09:30:00 +00:00
jan.nijtmans ef42e37c44 Merge-mark. Fix testConstraint utf32 (in tests/string.test) 2023-01-23 20:51:36 +00:00
jan.nijtmans 42b0b497a1 Merge-mark 2023-01-23 20:08:40 +00:00
jan.nijtmans 46dcc60e41 Better error-message for previous commit. Some more code-cleanup, backported from 8.7 2023-01-23 19:18:39 +00:00
jan.nijtmans c5f7f66ceb Merge 8.7 2023-01-22 23:35:38 +00:00
jan.nijtmans b31d886479 Merge-mark 2023-01-22 23:03:09 +00:00
jan.nijtmans c08798d0f4 Fix [3e8074aea7]: [interp limit time -seconds] has a y2k38 problem 2023-01-22 22:53:36 +00:00
jan.nijtmans 04eb2cc696 Allow "-strict" and "-failindex" to be used together in "encoding convertfrom|convertto". As requested in ticket [a31caff057] 2023-01-22 22:51:41 +00:00
Kevin B Kenny 2b516939bd Merge 8.7 (Bug [e3dcab1d14]) 2023-01-22 02:02:37 +00:00
Kevin B Kenny 47b385e3db Bug [e3dcab1d14] - merge fix from 8.6 2023-01-22 01:55:54 +00:00
Kevin B Kenny 4ef7c0c4b8 Missed one more off-by-one error, also, tests misnumbered for merge forward. 2023-01-22 01:48:02 +00:00
Kevin B Kenny 119519c4df Remove unneeded hard-coded array size 2023-01-22 01:37:07 +00:00
Kevin B Kenny 52948a790c Bug [e3dcab1d14] fix 2023-01-22 01:33:44 +00:00
jan.nijtmans 792c57a7fb Make documentation conform to implementation in this branch 2023-01-20 20:59:22 +00:00
jan.nijtmans 073e6715d1 Better error-message 2023-01-20 16:51:50 +00:00
jan.nijtmans c611835152 Proposed fix for [3e8074aea7]: [interp limit time -seconds] has a y2k38 problem 2023-01-19 21:36:05 +00:00
jan.nijtmans 22657ad365 New proposal: Allow "-strict" immediately before or after "-failindex var". 2023-01-19 17:01:40 +00:00
jan.nijtmans 02838226fe Merge 8.7 2023-01-19 15:50:49 +00:00
jan.nijtmans 1c6b1c9e6c Merge 8.7 2023-01-19 15:00:07 +00:00
jan.nijtmans 6c8d9886b5 Fix [https://core.tcl-lang.org/tk/tktview?name=370b1ff03e|370b1ff03e]: Wrong Tk_MeasureChars result when linking with Tcl 9 (--disable-xft only)
This turned out to be an error in Tcl 8.7, after all. Since some test-cases depend on the replacement behavior on Tcl 8.6, we need to add "-nocomplainencoding" to make it work in Tcl 9.0.
2023-01-19 14:19:00 +00:00
jan.nijtmans 45bfcbb267 Merge 8.7 2023-01-18 17:06:05 +00:00
jan.nijtmans c18f5f7f8c Merge 8.6 2023-01-18 16:54:07 +00:00
jan.nijtmans 31226696c3 Some test-cases need -nocomplainencoding 1, because they use the fallback behavior. 2023-01-18 14:10:09 +00:00
jan.nijtmans 5d50502a29 Forget about TCL_ENCODING_HACK_FLAG, this should be the fix. Testing ... 2023-01-18 13:26:15 +00:00
jan.nijtmans 925f00c5ca Use TCL_ENCODING_HACK_FLAG in TableFromUtfProc too 2023-01-17 14:15:39 +00:00
jan.nijtmans 5c38cce8df Merge trunk. Make test-cases pass (again). This might indicate a bug in utf-8 decoder, but that will be handled separately. 2023-01-17 13:42:59 +00:00
jan.nijtmans 6efbc1b278 merge-mark 2023-01-16 23:03:41 +00:00
jan.nijtmans 40b6b98401 Merge 8.7 2023-01-16 13:11:01 +00:00
jan.nijtmans 5021d1c11f New flag TCL_ENCODING_HACK_FLAG to control the behaviour. (This is NOT the way to do it, but it's only meant for experimenting) 2023-01-16 13:10:07 +00:00
jan.nijtmans ca87000eac merge-mark 2023-01-16 10:07:31 +00:00
jan.nijtmans 56bcf3dcbe Merge 8.7 2023-01-15 20:56:58 +00:00
jan.nijtmans 7faef9ce70 Update documentation, matching current implementation 2023-01-15 19:45:54 +00:00
pooryorick 81262438a7 Fix issue [8f7fdea2d], string-2.20.1 fails on big endian, and also fix issues in TclStringCmp when checkEq is 1. 2023-01-15 19:26:36 +00:00
jan.nijtmans b9537d1098 Merge 9.0 2023-01-14 23:41:10 +00:00
jan.nijtmans 25f6837582 Same change for "encoding convertto" 2023-01-14 22:57:15 +00:00
jan.nijtmans 5aef206d2d Proposed fix for [a31caff057]: encoding command does not allow -strict to be used with -failindex 2023-01-14 22:20:53 +00:00
pooryorick 24656c2805 Properly quote contents of Make variables to pass through gdb.run file. 2023-01-14 22:07:21 +00:00
jan.nijtmans 33f4149ee5 Fix for [https://core.tcl-lang.org/tk/tktview?name=370b1ff03e|370b1ff03e]. Not complete/correct yet, since this backouts the fix for [4dbfa46caa] 2023-01-08 22:47:45 +00:00
pooryorick 805fa175fc For [read] and [gets] encoding errors, use "-result read" in return options
dictionary instead of just "-result".
2023-01-08 10:07:46 +00:00
jan.nijtmans 95e7615fc4 Merge 8.7 2023-01-06 17:35:08 +00:00
jan.nijtmans ba6fe47daa Merge 8.6 2023-01-06 17:33:59 +00:00
jan.nijtmans cf560b3fb9 Fix [0f19edcb78]: Windows 11 not reported in tcl_platform(osVersion) 2023-01-06 17:32:06 +00:00
jan.nijtmans 507af3b425 Merge 8.6 2023-01-06 17:11:20 +00:00
jan.nijtmans 72eb4e4229 Fix [ad393071c2]: Use different LD_LIBRARY_PATH_VAR on macOS 2023-01-06 16:56:14 +00:00
jan.nijtmans ce9fb3bcfb Fix [0f19edcb78]: Windows 11 not reported in tcl_platform(osVersion) 2023-01-04 23:21:16 +00:00
pooryorick 985ea00b16 Merge py-b8f575aa23: Fix for [154ed7ce56], Tcl 9: [gets] on -strictencoding 1 configured channel. 2023-01-02 23:12:02 +00:00
jan.nijtmans 8494cde084 Merge 8.7 2023-01-01 23:37:48 +00:00
jan.nijtmans 9ab6f4a7c5 Merge 8.6 2023-01-01 23:36:02 +00:00
jan.nijtmans 7be69be5fe Fix [8e811bc1f1]: Wrong formatting of arguments in man page 2023-01-01 23:32:10 +00:00
pooryorick 3919b0a0b4 Add test for [gets] in non-strict mode after an encoding error. 2022-12-30 21:53:47 +00:00
pooryorick 63e04b3c2d New test, io-12.9.strict, for issue report [1bedc53c8cb878f0]. 2022-12-30 21:05:56 +00:00
pooryorick a801c2d474 Fix DoReadChars() to correctly discard encoding errors after eofchar has been seen, and add new test, io-75.8.invalid. 2022-12-30 20:27:47 +00:00
pooryorick 3b45005127 Arrange new code in DoReadChars to ensure that final steps are always taken. 2022-12-29 22:59:10 +00:00
fvogel 23d30205a5 Instead of fiddling with html tags, simply enlarge a bit the width in the CSS stylesheet. 2022-12-29 17:04:43 +00:00
pooryorick 0f0fc59c9f merge py-b8f575aa23 after updating fix so that all tests pass.
jn: let's wait for more review, since test-cases were modified. This is more than only a bug-fix
2022-12-28 22:58:53 +00:00
pooryorick f2cc84c99a Update fix so that the two failing tests, iocmd-23.8 and iortrans-4.7 now pass. 2022-12-28 22:46:37 +00:00
fvogel dbd4edc3d5 Fix [8e811bc1f1]: Wrong formatting of arguments in man page 2022-12-28 20:39:17 +00:00
pooryorick 4a8b2cf10f A better fix for [b8f575aa23], as it maintains the expectation that synchronous
[read] results in an error when invalid data is encountered.

someone other than pooryorick:  Pushed this check-in back on to a review branch.  It needs more baking/review.
As is, it makes two tests fail, and it introduces a new element "-result" to
the return options dictionary.
2022-12-28 12:07:18 +00:00
jan.nijtmans a1de562f5c First part of fix for [4a7397e0b3]: Take flags into account when deciding to do a binary fcopy or not. TODO: Handle generating an exception 2022-12-24 14:36:57 +00:00
jan.nijtmans 6a1c2d8f52 Merge 8.7 2022-12-21 21:43:59 +00:00
jan.nijtmans ecaf98ffad Make two more functions static 2022-12-21 21:07:33 +00:00
jan.nijtmans a01390fa0b Add 'interp' argument to some arith functions, for better error-handling 2022-12-21 20:43:53 +00:00
jan.nijtmans 1faa0cca77 Merge 8.7 2022-12-21 13:19:16 +00:00
jan.nijtmans e872538a2e Tweaks to dde and registry extension, so they "load" without 3th argument in Tcl 8.6 too. 2022-12-21 13:15:54 +00:00
jan.nijtmans 7561bdb176 Merge 8.7 2022-12-20 09:42:26 +00:00
jan.nijtmans ac4faee232 Fix [17a1cb8d6e2a51bd]. From now on, noncharacters are no longer rejected in -strict mode 2022-12-20 09:32:22 +00:00
jan.nijtmans af98d8fa20 Remove all checks for noncharacters 2022-12-19 22:19:59 +00:00
jan.nijtmans d61473e631 Merge 8.7 2022-12-19 15:44:27 +00:00
jan.nijtmans 5db223f8ec Add two testcases, showing how we can distinguish Invalid Byte sequences, Surrogates, and Noncharacters when an exception occurred. 2022-12-19 15:43:22 +00:00
jan.nijtmans 9dabd6f1ac When changing the -nocomplainencoding or -strictencoding settings of a channel, reset the CHANNEL_NEED_MORE_DATA and CHANNEL_ENCODING_ERROR flags, so we can continue reading the channel and find out what's going on. 2022-12-19 15:40:40 +00:00
jan.nijtmans 002511bea4 MODULE_SCOPE TclLengthOne (in stead of 2 separate static functions doing the same) 2022-12-18 18:08:38 +00:00
jan.nijtmans 8b3ccee931 Merge 8.7 2022-12-16 15:31:52 +00:00
jan.nijtmans 553147da53 Merge 8.6 2022-12-16 15:31:02 +00:00
jan.nijtmans c05419204a Update tclConfig.h.in 2022-12-16 15:26:40 +00:00
jan.nijtmans 42eb37a48c Merge 8.7 2022-12-16 15:19:30 +00:00
jan.nijtmans b82707b4a1 Merge 8.6 2022-12-16 15:18:19 +00:00
jan.nijtmans 2031d40f81 Add checks to the configure script for mknod, tcdrain and uname, for systems (like VxWorks) which don't have it. See [aa4d088e5d] 2022-12-16 15:16:56 +00:00
jan.nijtmans d748e3debf merge-mark 2022-12-16 12:19:52 +00:00
jan.nijtmans 0846deb770 merge-mark 2022-12-16 12:19:02 +00:00
jan.nijtmans f632ecb406 Now that 32-bit cygwin is dead, eliminate the need for --enable-64bit in a Cygwin build 2022-12-16 12:16:54 +00:00
jan.nijtmans 5d7537b823 Merge 8.7 2022-12-16 10:25:02 +00:00
jan.nijtmans fd98096770 Addendum to [https://core.tcl-lang.org/tips/doc/trunk/tip/601.md|TIP #601]. Add check for characters > U+10FFFF in utf-32. Since utf-8 cannot handle that, either replace it with the replacement character (-nocomplain) or throw an exception (-strict). 2022-12-16 10:23:56 +00:00
jan.nijtmans 4cca4b0b1c Merge 8.7 2022-12-16 09:50:33 +00:00
jan.nijtmans edee881fb2 Follow-up for [084ab982fe]: Use -strict to disable noncharacters. This change was only done for utf-8, but the same change should be done for utf-16 and utf-32 too 2022-12-16 09:40:03 +00:00
jan.nijtmans d762cb9331 Merge 8.7 2022-12-16 09:28:11 +00:00
jan.nijtmans a06b13bb4a Merge 8.7 2022-12-16 09:27:14 +00:00
jan.nijtmans c78879e707 Adapt iocmd-8.* testcases to change in previous commit 2022-12-16 09:25:54 +00:00
jan.nijtmans 94c928a859 Add testcase 2022-12-16 08:15:02 +00:00
jan.nijtmans 9faf91402b Make -strict work the same for UTF-16 as for UTF-8 2022-12-15 23:59:48 +00:00
jan.nijtmans 10775523d9 Merge 8.7 2022-12-15 14:39:26 +00:00
jan.nijtmans 7b36aa11b6 Fix Tcl_BadChannelOption(), new -nocomplainencoding and -strictencoding options were still missing (reported by Rolf Ade, thanks!) 2022-12-15 14:38:24 +00:00
jan.nijtmans 532559323e Merge 8.7 2022-12-13 07:44:12 +00:00
jan.nijtmans 2e1db6850f Clarify what "-strict" means for the utf-8 encoder, making it clear that this is not the same as "strict" in python 2022-12-13 07:42:17 +00:00
apnadkarni d9baa9e3de Merge 8.7 - change copyright in Windows build to UCal. 2022-12-12 06:11:22 +00:00
apnadkarni 53b2a5fdf9 Merge 8.6 - change copyright in Windows build to UCal. 2022-12-12 06:09:50 +00:00
apnadkarni 89be5d2d3d Change copyright in Windows rc from Activestate to UCal and others to match license. 2022-12-12 06:08:21 +00:00
jan.nijtmans 3251fdbab4 Merge 8.7 2022-12-11 18:16:16 +00:00
jan.nijtmans 196f704d08 More io test-cases. Mostly backported (and modified) from 9.0 2022-12-11 17:57:55 +00:00
jan.nijtmans 3b293d276c Merge 8.7 2022-12-09 23:27:19 +00:00
jan.nijtmans 4aa0db664d Fix [b8f575aa23]: eof erroneously flagged with not reported encoding read error 2022-12-09 23:23:24 +00:00
jan.nijtmans b81e0a5459 Merge 8.7. Adapt testcase, showing that after an encoding error we can change encoding and continue reading 2022-12-09 22:27:50 +00:00
jan.nijtmans 4f69a6f297 Fix compilation with tcc. Thanks, Cyan Ogilvie for the report 2022-12-09 19:55:38 +00:00
jan.nijtmans ae31cee4ae Add 2 unit-tests, for the 2 cornercases mentioned in the TIP. This shows that the fix works as expected 2022-12-09 14:53:25 +00:00
jan.nijtmans 768fa22c43 Partial solution for [b8f575aa23]. Still missing: 1) testcases. 2) What if both EOF and ENCODING_ERROR happens (because there is both an eofchar and an invalid byte in the stream) 2022-12-09 10:22:11 +00:00
jan.nijtmans 1a21edb592 Eliminate TclArithSeriesObjLength and TclArithSeriesObjStep from tclArithSeries.h: they can be static internal. 2022-12-08 17:17:48 +00:00
jan.nijtmans 62c5b0bfb7 Merge 8.7 2022-12-05 23:49:03 +00:00
jan.nijtmans a58f5f14b0 Merge 8.6 2022-12-05 23:31:44 +00:00
jan.nijtmans 7b53037339 dev_t -> unsigned for Cygwin in tcl.h, so we don't need sys/types.h any more. There's no gap in Tcl_StatBuf for 64-bit Cygwin 2022-12-05 23:05:25 +00:00
jan.nijtmans b8c736d82c Merge 8.7 2022-12-05 15:42:06 +00:00
jan.nijtmans d8d1a902ef There's no gap on Cygwin any more 2022-12-05 15:39:50 +00:00
jan.nijtmans ba427c0bc2 Merge 8.7 2022-12-05 15:35:05 +00:00
jan.nijtmans b1af92a6e9 On Cygwin, dev_t == unsigned, and long long == long 2022-12-05 15:33:57 +00:00
jan.nijtmans b58aa65f02 Merge 8.7 2022-12-05 13:11:31 +00:00
jan.nijtmans f029161eb7 Eliminate (gcc) warning in tclTest.c 2022-12-05 13:10:20 +00:00
jan.nijtmans 635dd1a696 Fix utf32 lables in testcases (some not necessary any more, one missing), indicating differences between Tcl 8.x and 9.0 2022-12-02 11:27:10 +00:00
jan.nijtmans 25b3cffdd2 Oops, that's the wrong one ... 2022-12-02 08:35:05 +00:00
jan.nijtmans ae11579286 Make options -nocomplain and -strictencoding truly independant. Leftover from initial implementation. Noted by Rolf Ade (thanks!) 2022-12-02 08:19:36 +00:00
jan.nijtmans 975b7c5dcb Merge 8.7 2022-12-01 17:36:04 +00:00
jan.nijtmans ef8a00717e Merge 8.6 2022-12-01 17:33:29 +00:00
jan.nijtmans b3838ea445 Backport TIP #402: General Platform UNC Support from 8.7, but only for Cygwin and QNX. This was already partially present, but was never completed. 2022-12-01 17:27:03 +00:00
jan.nijtmans 36c94773b4 Handle "deprecated" condition correctly in test-cases 2022-12-01 10:18:35 +00:00
jan.nijtmans fdb4ca1567 Merge 8.7 2022-11-30 21:46:57 +00:00
jan.nijtmans 6c7ad3b118 Let Tcl_GetEncodingNulLength() return size_t on 9.0, for consisancy with other API's. No change on 8.7 2022-11-30 21:16:15 +00:00
jan.nijtmans 4d23589861 Merge 8.7. This also fixes [133456085a] 2022-11-30 11:11:28 +00:00
jan.nijtmans a7d6b92abf Fix for [084ab982fe]: Use -strict to disable noncharacte 2022-11-30 10:48:40 +00:00
jan.nijtmans 5cb9dc5ddc Stop shimmering for "llength". Internal optimization (but using TIP #644) 2022-11-30 10:36:06 +00:00
jan.nijtmans c157333a7d Merge 8.7 2022-11-30 08:16:52 +00:00
jan.nijtmans f9ded1a928 Merge 8.7 2022-11-30 08:15:59 +00:00
jan.nijtmans 99e3536c5d Update to tzdata 2022g 2022-11-30 08:14:36 +00:00
jan.nijtmans 521b3bfb0e Update to tzdata 2022g 2022-11-30 08:12:16 +00:00
jan.nijtmans 111352203a merge-mark 2022-11-29 20:59:36 +00:00
jan.nijtmans a744c509d4 Remove ARGSUSED. More type-casts 2022-11-29 20:54:20 +00:00
jan.nijtmans e648065fe1 Merge 8.7 2022-11-29 16:07:45 +00:00
jan.nijtmans 6d6996d99f make Windows dde (-> 1.4.5) and registry (-> 1.3.7) extensions ready for the Tcl 9.0 era. 2022-11-29 16:05:33 +00:00
jan.nijtmans 4813d492ca Proposed fix for [084ab982fe]: Use -strict to disable noncharacters 2022-11-29 14:51:03 +00:00
jan.nijtmans 426dd171f6 Merge 8.7 2022-11-29 10:35:23 +00:00
jan.nijtmans 11af978f51 Merge 8.6 2022-11-29 10:33:42 +00:00
jan.nijtmans cdb467ed61 Update all "8.5" versions in Tcl_InitStubs() to "8.5-", since they can be compiled for Tcl 9.0 as well. 2022-11-29 10:30:41 +00:00
jan.nijtmans 8b03ef0b29 Merge 8.7 2022-11-28 23:44:33 +00:00
jan.nijtmans 71b0ad990c Reduce shimmering: If a conclusion can be drawn about the number of list elements, don't get the elements before the list length is checked 2022-11-28 23:16:31 +00:00
jan.nijtmans dabfa1a053 Merge 9.0. New macro ABSTRACTLIST_PROC 2022-11-28 15:58:49 +00:00
jan.nijtmans 8f6442b0c9 Merge 8.7 2022-11-28 15:08:04 +00:00
jan.nijtmans da196c3345 No reservation for TIP #648 any more in stub table. 2022-11-28 12:58:18 +00:00
jan.nijtmans 85f19595dc Merge 8.7 2022-11-28 12:34:28 +00:00
jan.nijtmans 18f90309e4 Use Tcl_Size for ArithSeries.len 2022-11-28 12:06:41 +00:00
jan.nijtmans 82fb7b1d55 size_t result for lengthProc. More usage of Tcl_GetWideUIntFromObj 2022-11-27 23:37:32 +00:00
jan.nijtmans 513b2d5031 HAS_ABSTRACTLIST_PROC 2022-11-26 23:57:26 +00:00
jan.nijtmans bfe8928bed Merge 9.0 2022-11-25 23:38:50 +00:00
jan.nijtmans ba490472b5 Remove "knownBug" constraint: no longer necessary 2022-11-25 22:40:47 +00:00
jan.nijtmans d0d0e3642f Merge 8.7 2022-11-25 22:08:19 +00:00
jan.nijtmans bc23abb929 (partial) fix for [6978c01b65] 2022-11-25 22:00:10 +00:00
jan.nijtmans 481aa42029 Merge 8.7 2022-11-25 16:26:04 +00:00
jan.nijtmans b816a585c0 Tcl_NewDoubleObj -> TclNewDoubleObj and Tcl_NewWideIntObj -> TclNewIntObj (and similar). Gives more info when debugging 2022-11-25 16:11:38 +00:00
jan.nijtmans 7bf0253a43 Merge 9.0 2022-11-25 10:16:35 +00:00
jan.nijtmans 73116e2c54 one more int -> size_t 2022-11-25 10:12:32 +00:00
jan.nijtmans 66e2117d20 Unbreak Windows build. More int -> size_t, being able to handle longer strings 2022-11-25 10:01:00 +00:00
jan.nijtmans 0bc6d7d341 merge-mark 2022-11-25 08:32:31 +00:00
jan.nijtmans d6fedf7854 Document some more differences between Tcl 8.7 and 9.0 in tcl.h 2022-11-25 08:31:21 +00:00
jan.nijtmans 191fa0458a Handle closeProc == NULL the same as closeProc == TCL_CLOSE2PROC in stead of panicing. Backported from 8.7 (undocumented feature) 2022-11-25 08:29:06 +00:00
jan.nijtmans 21920649b5 Move Tcl_Size definition earlier in tcl.h 2022-11-24 21:04:48 +00:00
jan.nijtmans 9faff5cc94 Merge 8.7 2022-11-24 17:44:02 +00:00
jan.nijtmans a4ac44fccc Fix gcc warning, seen on Ubuntu with select notifier 2022-11-24 17:43:12 +00:00
jan.nijtmans 3795a0f7dc Merge 8.7 2022-11-24 17:41:44 +00:00
jan.nijtmans ec4cf7a995 Use some more TCL_INDEX_NONE and Tcl_Size 2022-11-24 16:16:53 +00:00
jan.nijtmans ddf4a5f158 Use Tcl_GetByteArrayFromObj(... in stead of Tcl_GetBytesFromObj(NULL,.... Add some more error-checking for invalid byte-arrays 2022-11-24 14:05:58 +00:00
jan.nijtmans 2a569c94ef Since Tcl 9.0 throws exceptions on an illegal byte sequence (no longer simply truncates it), adapt test-case for that 2022-11-24 10:17:51 +00:00
jan.nijtmans 6932d0c2d0 Fix [da63e4c1e]: Crash in Tcl_WriteChars(). Make everything compile (again) with a C++ compiler. 2022-11-23 21:03:13 +00:00
jan.nijtmans 9c802c440b Writing characters > \xFF to a binary channel is deprecated, this will start throwing an exception in Tcl 9.0 2022-11-23 20:42:38 +00:00
jan.nijtmans e4f687d978 -1 -> TCL_INDEX_NONE 2022-11-23 20:41:34 +00:00
jan.nijtmans 826db93d76 Internal abstract list, don't let "llength" shimmer any more. 2022-11-23 17:04:18 +00:00
jan.nijtmans d8dac38437 Proposed fix for [da63e4c1e]. First version, not 100% as expected yet. 2022-11-23 15:21:29 +00:00
jan.nijtmans b432766202 Make "read" throwing a "illegal byte sequence" exception. Doesn't work for "gets" yet. 2022-11-23 12:15:24 +00:00
jan.nijtmans 52aada907a Merge 8.7 2022-11-23 09:26:06 +00:00
jan.nijtmans 5b4f454e1c Change assert, since the new flag CHANNEL_ENCODING_ERROR could be set as well 2022-11-23 09:24:06 +00:00
jan.nijtmans 42dae31b61 merge-mark 2022-11-23 07:43:17 +00:00
jan.nijtmans 86f51a0a0b Add mp_pack, mp_pack_count and mp_unpack to the libtommath stub table. Not used by Tcl, but can be used by extensions (backported from 8.7) 2022-11-23 07:38:49 +00:00
jan.nijtmans 7129a50b10 Re-generate configure scripts (with correct autoconf version) 2022-11-23 07:36:49 +00:00
jan.nijtmans e57b9fe9c3 Merge 8.7 2022-11-23 00:34:36 +00:00
jan.nijtmans 13eb211d5a leave unixInit-3.2 as-is 2022-11-23 00:19:46 +00:00
jan.nijtmans e37308d78c Merge 8.7 2022-11-23 00:09:05 +00:00
jan.nijtmans b5e5883c33 Progress in fixing [6978c01b65]. Not complete yet 2022-11-22 23:58:31 +00:00
dgp 096106f202 merge 8.7 2022-11-22 23:26:44 +00:00
dgp ff294480b9 merge 8.6 2022-11-22 23:25:57 +00:00
dgp 02892b17b9 merge release 2022-11-22 22:48:05 +00:00
jan.nijtmans d942525e22 Better -strict checking, with testcases 2022-11-22 22:25:46 +00:00
jan.nijtmans 976fff1b3a merge-mark 2022-11-22 20:12:49 +00:00
jan.nijtmans 95cac7dd26 Merge 8.5 2022-11-22 20:11:58 +00:00
jan.nijtmans eddb2b2801 Unused stub entries up to Tcl_DStringToObj() (for Tcl 8.7/9.0) 2022-11-22 20:08:07 +00:00
jan.nijtmans ef78b1558f Merge 8.7 2022-11-21 23:54:42 +00:00
jan.nijtmans c1e4942181 TIP #650: New function Tcl_GetWideUIntFromObj() 2022-11-21 23:54:06 +00:00
jan.nijtmans b1432e6e0d Mark unixInit-3.2 as "knownBug". See [fccb9f322f] 2022-11-21 23:52:36 +00:00
jan.nijtmans 948fd24ddb Remove TCL_OUT_LINE_COMPILE in favour of TCL_ERROR 2022-11-21 23:28:57 +00:00
jan.nijtmans 0fd21c5dd0 TCL_OUT_LINE_COMPILE is deprecated 2022-11-21 23:22:03 +00:00
jan.nijtmans 8a4e71640b Merge 8.7. More utf-8 checks with --strict 2022-11-21 22:01:54 +00:00
dgp 338c669267 improve accuracy of a changes line 2022-11-21 17:37:38 +00:00
jan.nijtmans 654f4d3b58 Merge 8.7 2022-11-21 16:20:09 +00:00
jan.nijtmans 23ef10a6a4 There is no guarantee that sizeof(Tcl_WideInt) == sizeof(double), so the offset of 'isDouble' in the struct could vary between ArithSeries and ArithSeriesDbl. Solution: put those fields last 2022-11-21 16:18:56 +00:00
jan.nijtmans 91e64fb475 indenting 2022-11-20 23:27:09 +00:00
jan.nijtmans e9cf2c8707 Merge 8.7 2022-11-20 23:22:26 +00:00
dgp e82a18be40 merge 8.7 2022-11-20 22:37:42 +00:00
dgp 49cb764a5a In most testing scenarios, the TCL_LIBRARY variable is masking a bug
in system encoding discovery.  Adapted test unixInit-3.2 to stop shielding
this problem from view.
2022-11-20 22:08:19 +00:00
dgp 8f9ddfae66 missing constraints 2022-11-20 21:39:43 +00:00
jan.nijtmans a53281f50b Rebase to latest 8.7 2022-11-20 20:14:07 +00:00
jan.nijtmans 2ba1a5f081 merge-mark 2022-11-20 19:35:01 +00:00
jan.nijtmans bfdd211de9 Don't use "package require tcltests" any more, as in other tests 2022-11-20 19:33:00 +00:00
jan.nijtmans b71ebc2746 Constraints http2.9.x make no sense, when testing http2.10 2022-11-20 19:29:53 +00:00
dgp f39cef2590 close fork 2022-11-20 19:18:51 +00:00
dgp 4e1d89f819 merge 8.6 2022-11-20 19:10:17 +00:00
jan.nijtmans a1a443ef1d Merge 8.7 2022-11-20 17:51:42 +00:00
jan.nijtmans 66386bc18b Merge 8.6. TIP #651 implementation (since there are already 2 YES votes, no NO votes expected) 2022-11-20 17:38:12 +00:00
dgp 0666836834 bump release date 2022-11-20 15:34:08 +00:00
dgp 0c93e6a978 merge 8.6 2022-11-20 14:22:33 +00:00
dgp 124340611e Newest tests must have most recent releases of http to pass. 2022-11-20 14:16:36 +00:00
jan.nijtmans 43d67c651c Merge 8.7 2022-11-19 16:22:24 +00:00
jan.nijtmans 797aa89a30 Merge 8.7 2022-11-19 16:12:56 +00:00
jan.nijtmans 90d13253bd Revert [52a52a65f0]. There appears to be a problem with the mp_pack function on Windows 2022-11-19 16:07:51 +00:00
jan.nijtmans 1c1ee1c59d Backout [52a52a65f0], let's see if this fixes the Windows crash 2022-11-18 21:43:40 +00:00
jan.nijtmans 0bcca87681 Backout [52a52a65f0], let's see if this fixes the Windows crash 2022-11-18 20:26:52 +00:00
jan.nijtmans 4245f0e5a3 merge-mark 2022-11-18 19:54:45 +00:00
jan.nijtmans 90a23f176d Fix [https://core.tcl-lang.org/thread/tktview?name=16bf24d70b|16bf24d70b]: Installed Thread for Tcl 8.7 breaks availability of Thread in 8.6 2022-11-18 19:43:09 +00:00
jan.nijtmans 2e64df7857 Merge 8.7 2022-11-18 19:18:12 +00:00
jan.nijtmans 78bce4ec93 Fix [bec4219123]: test utf-4.12 fails in custom builds 2022-11-18 19:17:32 +00:00
dgp 10a5b6e4c7 merge 8.6 2022-11-18 18:30:56 +00:00
dgp 3e4ac217aa Bring back the common facilities of the tcltests "package", but use a less
fragile method to gain access to them.
2022-11-18 17:53:54 +00:00
jan.nijtmans ae54d4dd89 Another bug in TIP #628: dde and registry extensions didn't really load in tclsh8.7. One reason: handle TclpReaddir correctly in tcl8 compatibility mode 2022-11-18 16:24:27 +00:00
dgp 2eebbe64ab merge 8.6 2022-11-18 15:30:50 +00:00
jan.nijtmans a65db858ff Fix bug in TIP #628: Tcl 8.x version of registry/dde dll was not correct 2022-11-18 15:24:44 +00:00
jan.nijtmans dc6366fef8 TIP #644: Make Tcl_ObjType extensible 2022-11-17 20:29:59 +00:00
jan.nijtmans b669079dd6 Add dummy TCL_OBJTYPE_V0 #define. Minimal no-op backport of TIP #644 2022-11-17 20:24:20 +00:00
jan.nijtmans 0824522016 Merge 8.7 2022-11-17 11:20:03 +00:00
jan.nijtmans 8b9fe0fa53 doc update 2022-11-17 11:18:51 +00:00
apnadkarni e0becc6161 TIP 651 implementation 2022-11-17 04:54:02 +00:00
apnadkarni 2a62e1f0dd Merge 8.7 - reserve stub entry 687 2022-11-17 03:54:14 +00:00
apnadkarni 00c7d174e4 Reserve stub entry 687 for TIP #651 2022-11-17 03:52:45 +00:00
jan.nijtmans 197060f097 one more (Tcl_UniCharToUtf), and adapt documentation 2022-11-16 20:52:30 +00:00
jan.nijtmans f9c4e3a8b2 Change 5 functions signatures from int -> size_t. Those should have been part of TIP #494 (Thanks, Gustaf!) 2022-11-16 20:39:34 +00:00
jan.nijtmans 640c0098d1 Merge 8.7 2022-11-16 09:43:42 +00:00
jan.nijtmans c432e303c0 http 2.10a4 -> 2.10b1, for upcoming release 2022-11-16 09:37:42 +00:00
jan.nijtmans a6680c4b9f Merge 8.7 2022-11-15 22:15:47 +00:00
jan.nijtmans bc7b50deb0 Make httpd11.tcl work with Tcl 8.6 too 2022-11-15 22:09:09 +00:00
jan.nijtmans b3caf035b4 Merge 8.7 2022-11-15 14:39:11 +00:00
jan.nijtmans 5f892535a1 Merge 8.7 2022-11-15 14:36:58 +00:00
jan.nijtmans 9d2a40a826 Reserve stub entries 684/685 for TIP #648 and 686 for TIP #650 2022-11-15 14:36:01 +00:00
jan.nijtmans d13a3cd502 New function Tcl_GetWideUIntFromObj 2022-11-15 14:03:34 +00:00
jan.nijtmans 1412e9b9f0 Merge 8.7 2022-11-15 13:31:35 +00:00
jan.nijtmans 870cb82c96 Change all mp_to_ubin() usages to mp_pack(). It makes the code much more clear 2022-11-15 13:06:59 +00:00
jan.nijtmans 386c7ea2d3 Since this FIXME! is already fixed, adapt documentation 2022-11-15 11:24:44 +00:00
jan.nijtmans c381a17784 Merge 8.7 2022-11-15 11:04:26 +00:00
jan.nijtmans 79f559fdb5 Add mp_pack to the libtommath stub-table: it's easier to work with than mp_to_ubin 2022-11-15 10:57:59 +00:00
dgp 1a3ade0a6f merge 8.6 2022-11-14 17:24:56 +00:00
dgp 2a1443e0e0 Test suite hygiene
- Several tests missing the "testdstring" constraint
  - [package require tcltests] is fragile, and almost all test files that
    had it were not making use of anything it provides.  Removed.
2022-11-14 17:23:52 +00:00
jan.nijtmans 369b286297 Merge 8.7 2022-11-13 21:26:11 +00:00
jan.nijtmans 14225bf184 fix filename 2022-11-13 21:25:31 +00:00
dgp 7c58993680 update target release date 2022-11-09 13:15:55 +00:00
dgp c837d06e2b merge 8.6 2022-11-01 14:17:55 +00:00
dgp d3cc950d62 merge 8.6 2022-10-28 15:19:56 +00:00
dgp 949e577fe0 merge 8.6 2022-10-27 14:35:43 +00:00
dgp 237a5ad333 merge 8.6 2022-10-27 14:10:59 +00:00
dgp 6e31c76fb5 merge 8.6 2022-10-27 00:21:08 +00:00
dgp a77ee23ce2 merge 8.6 2022-10-22 11:53:32 +00:00
jan.nijtmans 0d62ec8715 Merge 8.7 2022-10-20 15:21:13 +00:00
dgp 4d0d124928 merge 8.6 2022-10-19 16:29:21 +00:00
dgp c84fb00aed Draft updates to changes file for 8.6.13 release. 2022-10-18 19:37:44 +00:00
dgp d04ef78cd6 merge 8.6 2022-10-17 17:55:38 +00:00
jan.nijtmans 7e5d03d4cc Merge 8.7 2022-10-13 10:40:23 +00:00
dgp 18aaf57faf merge 8.6 2022-10-11 18:26:51 +00:00
jan.nijtmans b17bb4724c Making a start fixing [6978c01b65]: Channel encoding difference 8.6 <-> 9.0 2022-10-11 06:22:10 +00:00
dgp d516bc4611 merge 8.6 2022-09-26 12:44:22 +00:00
dgp 55a1074384 merge 8.6 2022-09-22 20:28:29 +00:00
dgp 54c6432df5 merge 8.6 2022-09-22 13:28:47 +00:00
dgp 170a21862b merge 8.6 2022-09-21 19:12:53 +00:00
dgp 3116cddfd5 merge 8.6 2022-09-21 13:22:05 +00:00
dgp f5300c9a09 merge 8.6 2022-09-16 12:18:03 +00:00
dgp fe7a8b7742 merge 8.6 2022-09-14 11:30:32 +00:00
dgp 60d91fb699 merge 8.6 2022-09-13 12:24:46 +00:00
dgp b2fe600f53 merge 8.6 2022-09-11 20:12:55 +00:00
dgp fbd6220149 merge 8.6 2022-09-07 13:59:47 +00:00
dgp 63505a86ca merge 8.6 2022-08-22 13:56:15 +00:00
dgp 9c7a5755f2 merge 8.6 2022-08-08 12:41:18 +00:00
dgp 7c1a9c588c merge 8.6 2022-07-25 13:10:16 +00:00
dgp 707c03da77 merge 8.6 2022-07-21 12:58:09 +00:00
dgp 599cd8496e merge 8.6 2022-07-18 15:35:03 +00:00
dgp 527f510103 merge 8.6 2022-07-12 20:33:24 +00:00
dgp 02669f7c03 merge 8.6 2022-06-15 12:46:04 +00:00
dgp 9b1a7da59b Bump to 8.6.13 for release 2022-06-06 16:51:24 +00:00
281 changed files with 12201 additions and 6027 deletions
+3 -3
View File
@@ -19,7 +19,7 @@ jobs:
- name: Build
run: make all
env:
CFLAGS: -arch x86_64 -arch arm64e
CFLAGS: -arch x86_64 -arch arm64
- name: Run Tests
run: make test styles=develop
env:
@@ -51,13 +51,13 @@ jobs:
# Note that macOS is always a 64 bit platform
run: ./configure --enable-dtrace --enable-framework ${CFGOPT} "--prefix=$HOME/install" || (cat config.log && exit 1)
env:
CFLAGS: -arch x86_64 -arch arm64e
CFLAGS: -arch x86_64 -arch arm64
CFGOPT: ${{ matrix.cfgopt }}
- name: Build
run: |
make all tcltest
env:
CFLAGS: -arch x86_64 -arch arm64e
CFLAGS: -arch x86_64 -arch arm64
- name: Run Tests
run: |
make test
+1 -1
View File
@@ -62,7 +62,7 @@ jobs:
sudo chmod a+x /usr/local/bin/macher
echo "VER_PATH=$(cd tools; pwd)/addVerToFile.tcl" >> $GITHUB_ENV
echo "CREATE_DMG=$(cd create-dmg;pwd)/create-dmg" >> $GITHUB_ENV
echo "CFLAGS=-arch x86_64 -arch arm64e" >> $GITHUB_ENV
echo "CFLAGS=-arch x86_64 -arch arm64" >> $GITHUB_ENV
- name: Configure
run: ./configure --disable-symbols --disable-shared --enable-zipfs
working-directory: unix
+2 -2
View File
@@ -2331,7 +2331,7 @@
argument, the Tcl_Interp struct loses its termOffset field and the
TCL_BRACKET_TERM flag in the evalFlags field, all of which were only
used (indirectly) by Tcl_SubstObj(). Tests subst-8.7,8.8,11.4,11.5
modified to accomodate the only behavior change: reporting of parse
modified to accommodate the only behavior change: reporting of parse
errors now takes precedence over [return] and [continue] exceptions.
All other behavior should remain compatible. [RFE 536831,684982] [Bug
685106]
@@ -2571,7 +2571,7 @@
2003-02-25 Don Porter <dgp@users.sourceforge.net>
* doc/pkgMkIndex.n: Modified [pkg_mkIndex] to use -nocase matching
* library/package.tcl: of -load patterns, to better accomodate common
* library/package.tcl: of -load patterns, to better accommodate common
user errors due to confusion between [package names] names and [info
loaded] names.
+52 -1
View File
@@ -2486,7 +2486,7 @@ interpreter. (JL)
installing and requesting security policies, purely in Tcl code. Overloads
the package command to also allow an interpreter to "require" a policy. The
following new library commands are provided:
tcl_safeCreateInterp -- creates a slave an initializes the
tcl_safeCreateInterp -- creates a slave and initializes the
policy mechanism.
tcl_safeInitInterp -- initializes an existing slave with the
policy mechanism.
@@ -9413,3 +9413,54 @@ Many internal changes to broaden support for sizes beyond 32-bits.
2021-10-27 tzdata updated to Olson's tzdata2021e (nijtmans)
- Released 8.6.12, Nov 5, 2021 - details at https://core.tcl-lang.org/tcl/ -
2021-12-08 (update) tcltest package to version 2.5.4
2022-01-13 (bug)[26f132] Crash when sizeof(int) < sizeof(void *) (Plan 9 port)
2022-01-19 (TIP 623)[e9a271] Tcl_GetRange index args < 0 (petasis,nijtmans)
2022-03-08 (bug) test string-5.22 (porter)
2022-03-11 (bug)[8a7ec8] fat binary compile on Mac M1 (davis, nijtmans)
2022-04-04 (bug)[e5ed1b] numeric IPv6 in URLs (nijtmans)
=> http 2.9.6
2022-04-26 (bug)[27520c] test error-9.6 (goth,sebres)
2022-05-04 (bug)[8eb64b] http package tolerant again invalid reply header
2022-05-11 (bug)[6898f9] http package failed detection of shiftjis charset
2022-05-25 (bug)[76ad7a] tests string-6.13[23] (mistachkin, nijtmans)
2022-06-20 (bug)[55bf73] Avoid connection reuse after response code 101.
=> http 2.9.8
2022-07-22 (bug)[713653] FP rounding exposed by x86 musl (rubicon,sebres)
2022-07-22 More portable notation of microseconds in verbose output (sebres)
=> tcltest 2.5.5
2022-07-27 (bug)[b3977d] Process CR-LF split across packets (nadkarni,sebres)
2022-07-29 (bug)[4eb3a1] crash due to undetected bytecode invalidity (nadkarni)
2022-08-23 (new)[371080] Portability to CHERI-enabled Morello processor (jrtc27)
2022-09-06 (bug)[55a02f] Fallback init env(HOME) from USERPROFILE (nadkarni)
2022-09-13 (bug)[1073da] crash writing invalid utf-8 (nijtmans)
2022-09-14 (new) Update to Unicode-15 (nijtmans)
2022-10-14 tzdata updated to Olson's tzdata2022e (nijtmans)
Update bundled zlib to 1.2.13
Update bundled libtommath
Many code fixes to avoid overflow or undefined behavior. Thanks chrstphrchvz.
- Released 8.6.13, Nov 22, 2022 - details at https://core.tcl-lang.org/tcl/ -
+5 -2
View File
@@ -66,6 +66,9 @@
#ifdef _WIN32
#define USEWIN32IOAPI
#include "iowin32.h"
# if defined(_MSC_VER)
# define snprintf _snprintf
# endif
#endif
@@ -365,7 +368,7 @@ void addFileToZip(zipFile zf, const char *filenameinzip, const char *password, i
void addPathToZip(zipFile zf, const char *filenameinzip, const char *password, int opt_exclude_path,int opt_compress_level) {
tinydir_dir dir;
int i;
char newname[512];
char newname[MAXFILENAME+1+MAXFILENAME+1];
tinydir_open_sorted(&dir, filenameinzip);
@@ -375,7 +378,7 @@ void addPathToZip(zipFile zf, const char *filenameinzip, const char *password, i
tinydir_readfile_n(&dir, &file, i);
if(strcmp(file.name,".")==0) continue;
if(strcmp(file.name,"..")==0) continue;
sprintf(newname,"%s/%s",dir.path,file.name);
snprintf(newname, sizeof(newname), "%.*s/%.*s", MAXFILENAME, dir.path, MAXFILENAME, file.name);
if (file.is_dir)
{
addPathToZip(zf,newname,password,opt_exclude_path,opt_compress_level);
+17
View File
@@ -39,6 +39,10 @@ char *
\fBTcl_DStringResult\fR(\fIinterp, dsPtr\fR)
.sp
\fBTcl_DStringGetResult\fR(\fIinterp, dsPtr\fR)
.sp
Tcl_Obj *
\fBTcl_DStringToObj\fR(\fIdsPtr\fR)
.sp
.SH ARGUMENTS
.AS Tcl_DString newLength in/out
.AP Tcl_DString *dsPtr in/out
@@ -136,12 +140,25 @@ a pointer from \fIdsPtr\fR to the interpreter's result.
This saves the cost of allocating new memory and copying the string.
\fBTcl_DStringResult\fR also reinitializes the dynamic string to
an empty string.
Since the dynamic string is reinitialized, there is no need to
further call \fBTcl_DStringFree\fR on it and it can be reused without
calling \fBTcl_DStringInit\fR.
.PP
\fBTcl_DStringGetResult\fR does the opposite of \fBTcl_DStringResult\fR.
It sets the value of \fIdsPtr\fR to the result of \fIinterp\fR and
it clears \fIinterp\fR's result.
If possible it does this by moving a pointer rather than by copying
the string.
.PP
\fBTcl_DStringToObj\fR returns a \fBTcl_Obj\fR containing the value of
the dynamic string given by \fIdsPtr\fR. It does this by moving
a pointer from \fIdsPtr\fR to a newly allocated \fBTcl_Obj\fR
and reinitializing to dynamic string to an empty string.
This saves the cost of allocating new memory and copying the string.
Since the dynamic string is reinitialized, there is no need to
further call \fBTcl_DStringFree\fR on it and it can be reused without
calling \fBTcl_DStringInit\fR.
The returned \fBTcl_Obj\fR has a reference count of 0.
.SH KEYWORDS
append, dynamic string, free, result
+61 -26
View File
@@ -8,7 +8,7 @@
.so man.macros
.BS
.SH NAME
Tcl_GetEncoding, Tcl_FreeEncoding, Tcl_GetEncodingFromObj, Tcl_ExternalToUtfDString, Tcl_ExternalToUtf, Tcl_UtfToExternalDString, Tcl_UtfToExternal, Tcl_GetEncodingName, Tcl_SetSystemEncoding, Tcl_GetEncodingNameFromEnvironment, Tcl_GetEncodingNames, Tcl_CreateEncoding, Tcl_GetEncodingSearchPath, Tcl_SetEncodingSearchPath \- procedures for creating and using encodings
Tcl_GetEncoding, Tcl_FreeEncoding, Tcl_GetEncodingFromObj, Tcl_ExternalToUtfDString, Tcl_ExternalToUtfDStringEx, Tcl_ExternalToUtf, Tcl_UtfToExternalDString, Tcl_UtfToExternalDStringEx, Tcl_UtfToExternal, Tcl_GetEncodingName, Tcl_SetSystemEncoding, Tcl_GetEncodingNameFromEnvironment, Tcl_GetEncodingNames, Tcl_CreateEncoding, Tcl_GetEncodingSearchPath, Tcl_SetEncodingSearchPath \- procedures for creating and using encodings
.SH SYNOPSIS
.nf
\fB#include <tcl.h>\fR
@@ -26,13 +26,13 @@ char *
\fBTcl_ExternalToUtfDString\fR(\fIencoding, src, srcLen, dstPtr\fR)
.sp
size_t
\fBTcl_ExternalToUtfDStringEx\fR(\fIencoding, src, srcLen, flags, dstPtr\fR)
\fBTcl_ExternalToUtfDStringEx\fR(\fIinterp, encoding, src, srcLen, flags, dstPtr, errorIdxPtr\fR)
.sp
char *
\fBTcl_UtfToExternalDString\fR(\fIencoding, src, srcLen, dstPtr\fR)
.sp
size_t
\fBTcl_UtfToExternalDStringEx\fR(\fIencoding, src, srcLen, flags, dstPtr\fR)
\fBTcl_UtfToExternalDStringEx\fR(\fIinterp, encoding, src, srcLen, flags, dstPtr, errorIdxPtr\fR)
.sp
int
\fBTcl_ExternalToUtf\fR(\fIinterp, encoding, src, srcLen, flags, statePtr,
@@ -45,7 +45,7 @@ int
const char *
\fBTcl_GetEncodingName\fR(\fIencoding\fR)
.sp
int
size_t
\fBTcl_GetEncodingNulLength\fR(\fIencoding\fR)
.sp
int
@@ -93,7 +93,7 @@ encoding-specific length of the string is used.
Pointer to an uninitialized or free \fBTcl_DString\fR in which the converted
result will be stored.
.AP int flags in
Various flag bits OR-ed together.
This is a bit mask passed in to control the operation of the encoding functions.
\fBTCL_ENCODING_START\fR signifies that the
source buffer is the first block in a (potentially multi-block) input
stream, telling the conversion routine to reset to an initial state and
@@ -101,16 +101,15 @@ perform any initialization that needs to occur before the first byte is
converted. \fBTCL_ENCODING_END\fR signifies that the source buffer is the last
block in a (potentially multi-block) input stream, telling the conversion
routine to perform any finalization that needs to occur after the last
byte is converted and then to reset to an initial state.
\fBTCL_ENCODING_NOCOMPLAIN\fR signifies that the conversion routine should
not return immediately upon reading a source character that does not exist in
the target encoding, but it will substitute a default fallback character for
all of such characters. The flag \fBTCL_ENCODING_STOPONERROR\fR has no effect,
it only has meaning in Tcl 8.x. The flag \fBTCL_ENCODING_STRICT\fR makes the
encoder/decoder more strict in what it considers to be an invalid byte
sequence. The flag \fBTCL_ENCODING_MODIFIED\fR makes
\fBTcl_UtfToExternalDStringEx\fR and \fBTcl_UtfToExternal\fR produce the byte
sequence \exC0\ex80 in stead of \ex00, for the utf-8/cesu-8 encoders.
byte is converted and then to reset to an initial state. The
\fBTCL_PROFILE_*\fR bits defined in the \fBPROFILES\fR section below
control the encoding profile to be used for dealing with invalid data or
other errors in the encoding transform.
\fBTCL_ENCODING_STOPONERROR\fR is present for backward compatibility with
Tcl 8.6 and forces the encoding profile to \fBstrict\fR.
Some flags bits may not be usable with some functions as noted in the
function descriptions below.
.AP Tcl_EncodingState *statePtr in/out
Used when converting a (generally long or indefinite length) byte stream
in a piece-by-piece fashion. The conversion routine stores its current
@@ -136,6 +135,9 @@ buffer as a result of the conversion. May be NULL.
.AP int *dstCharsPtr out
Filled with the number of characters that correspond to the number of bytes
stored in the output buffer. May be NULL.
.AP Tcl_Size *errorIdxPtr out
Filled with the index of the byte or character that caused the encoding transform
to fail. May be NULL.
.AP Tcl_DString *bufPtr out
Storage for the prescribed system encoding name.
.AP "const Tcl_EncodingType" *typePtr in
@@ -210,10 +212,27 @@ When converting, if any of the characters in the source buffer cannot be
represented in the target encoding, a default fallback character will be
used. The return value is a pointer to the value stored in the DString.
.PP
\fBTcl_ExternalToUtfDStringEx\fR is the same as \fBTcl_ExternalToUtfDString\fR,
but it has an additional flags parameter. The return value is the index of
the first byte in the input string causing a conversion error.
Or TCL_INDEX_NONE if all is OK.
\fBTcl_ExternalToUtfDStringEx\fR is a more flexible version of older
\fBTcl_ExternalToUtfDString\fR function. It takes three additional parameters,
\fBinterp\fR, \fBflags\fR and \fBerrorIdxPtr\fR. The \fBflags\fR parameter may
be used to specify the profile to be used for the transform. The
\fBTCL_ENCODING_START\fR and \fBTCL_ENCODING_END\fR bits in \fBflags\fR are
ignored as the function assumes the entire source string to be decoded is passed
into the function. On success, the function returns \fBTCL_ERROR\fR with the
converted string stored in \fB*dstPtr\fR. For errors other than conversion
errors, such as invalid flags, the function returns \fBTCL_OK\fR with an error
message in \fBinterp\fR if it is not NULL.
.PP
For conversion errors, \fBTcl_ExternalToUtfDStringEx\fR returns one
of the \fBTCL_CONVERT_*\fR errors listed below for \fBTcl_ExternalToUtf\fR.
When one of these conversion errors is returned, an error message is
stored in \fBinterp\fR only if \fBerrorIdxPtr\fR is NULL. Otherwise, no error message
is stored as the function expects the caller is interested whatever is
decoded to that point and not treating this as an immediate error condition.
The index of the error location is stored in \fB*errorIdxPtr\fR.
.PP
The caller must call \fBTcl_DStringFree\fR to free up the \fB*dstPtr\fR resources
irrespective of the return value from the function.
.PP
\fBTcl_ExternalToUtf\fR converts a source buffer \fIsrc\fR from the specified
\fIencoding\fR into UTF-8. Up to \fIsrcLen\fR bytes are converted from the
@@ -236,12 +255,12 @@ the unconverted bytes that remained in \fIsrc\fR plus some further bytes
from the source stream to properly convert the formerly split-up multibyte
sequence.
.IP \fBTCL_CONVERT_SYNTAX\fR 29
The source buffer contained an invalid character sequence. This may occur
The source buffer contained an invalid byte or character sequence. This may occur
if the input stream has been damaged or if the input encoding method was
misidentified.
.IP \fBTCL_CONVERT_UNKNOWN\fR 29
The source buffer contained a character that could not be represented in
the target encoding and \fBTCL_ENCODING_NOCOMPLAIN\fR was not specified.
the target encoding.
.RE
.LP
\fBTcl_UtfToExternalDString\fR converts a source buffer \fIsrc\fR from UTF-8
@@ -253,10 +272,14 @@ characters in the source buffer cannot be represented in the target
encoding, a default fallback character will be used. The return value is
a pointer to the value stored in the DString.
.PP
\fBTcl_UtfToExternalDStringEx\fR is the same as \fBTcl_UtfToExternalDString\fR,
but it has an additional flags parameter. The return value is the index of
the first byte of an utf-8 byte-sequence in the input string causing a
conversion error. Or TCL_INDEX_NONE if all is OK.
\fBTcl_UtfToExternalDStringEx\fR is an enhanced version of
\fBTcl_UtfToExternalDString\fR that transforms UTF-8 encoded source data to a specified
\fIencoding\fR. Except for the direction of the transform, the parameters and
return values are identical to those of \fBTcl_ExternalToUtfDStringEx\fR. See
that function above for details about the same.
Irrespective of the return code from the function, the caller must free
resources associated with \fB*dstPtr\fR when the function returns.
.PP
\fBTcl_UtfToExternal\fR converts a source buffer \fIsrc\fR from UTF-8 into
the specified \fIencoding\fR. Up to \fIsrcLen\fR bytes are converted from
@@ -324,7 +347,7 @@ typedef struct Tcl_EncodingType {
Tcl_EncodingConvertProc *\fIfromUtfProc\fR;
Tcl_EncodingFreeProc *\fIfreeProc\fR;
void *\fIclientData\fR;
int \fInullSize\fR;
size_t \fInullSize\fR;
} \fBTcl_EncodingType\fR;
.CE
.PP
@@ -559,6 +582,18 @@ to the object, it will be deleted.
.PP
\fBTcl_GetEncodingSearchPath\fR returns an object with a reference count of at
least 1.
.SH "PROFILES"
Encoding profiles define the manner in which errors in the encoding transforms
are handled by the encoding functions. An application can specify the profile
to be used by OR-ing the \fBflags\fR parameter passed to the function
with at most one of \fBTCL_ENCODING_PROFILE_TCL8\fR,
\fBTCL_ENCODING_PROFILE_STRICT\fR or \fBTCL_ENCODING_PROFILE_REPLACE\fR.
These correspond to the \fBtcl8\fR, \fBstrict\fR and \fBreplace\fR profiles
respectively. If none are specified, a version-dependent default profile is used.
For Tcl 8.7, the default profile is \fBtcl8\fR.
.PP
For details about profiles, see the \fBPROFILES\fR section in
the documentation of the \fBencoding\fR command.
.SH "SEE ALSO"
encoding(n)
.SH KEYWORDS
+6 -1
View File
@@ -8,7 +8,7 @@
.so man.macros
.BS
.SH NAME
Tcl_NewIntObj, Tcl_NewLongObj, Tcl_NewWideIntObj, Tcl_SetIntObj, Tcl_SetLongObj, Tcl_SetWideIntObj, Tcl_GetIntFromObj, Tcl_GetIntForIndex, Tcl_GetLongFromObj, Tcl_GetWideIntFromObj, Tcl_NewBignumObj, Tcl_SetBignumObj, Tcl_GetBignumFromObj, Tcl_TakeBignumFromObj \- manipulate Tcl values as integers
Tcl_NewIntObj, Tcl_NewLongObj, Tcl_NewWideIntObj, Tcl_SetIntObj, Tcl_SetLongObj, Tcl_SetWideIntObj, Tcl_GetIntFromObj, Tcl_GetIntForIndex, Tcl_GetLongFromObj, Tcl_GetWideIntFromObj, Tcl_GetWideUIntFromObj, Tcl_NewBignumObj, Tcl_SetBignumObj, Tcl_GetBignumFromObj, Tcl_TakeBignumFromObj \- manipulate Tcl values as integers
.SH SYNOPSIS
.nf
\fB#include <tcl.h>\fR
@@ -40,6 +40,9 @@ int
int
\fBTcl_GetWideIntFromObj\fR(\fIinterp, objPtr, widePtr\fR)
.sp
int
\fBTcl_GetWideUIntFromObj\fR(\fIinterp, objPtr, uwidePtr\fR)
.sp
.sp
\fB#include <tclTomMath.h>\fR
.sp
@@ -84,6 +87,8 @@ Points to place to store the long integer value retrieved from \fIobjPtr\fR.
Points to place to store the size_t value retrieved from \fIobjPtr\fR.
.AP Tcl_WideInt *widePtr out
Points to place to store the wide integer value retrieved from \fIobjPtr\fR.
.AP Tcl_WideUInt *uwidePtr out
Points to place to store the unsigned wide integer value retrieved from \fIobjPtr\fR.
.AP mp_int *bigValue in/out
Points to a multi-precision integer structure declared by the LibTomMath
library.
+1 -3
View File
@@ -239,9 +239,7 @@ The C variable, or each element of the C array, is of type \fBTcl_WideUInt\fR
(which is an unsigned integer type at least 64-bits wide on all platforms that
can support it.)
Any value written into the Tcl variable must have a proper unsigned
integer form acceptable to \fBTcl_GetWideIntFromObj\fR (it will be
cast to unsigned);
.\" FIXME! Use bignums instead.
wideinteger form acceptable to \fBTcl_GetWideUIntFromObj\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/decimal/binary prefix) are accepted
+12 -12
View File
@@ -406,10 +406,10 @@ to UTF-8 based on the channel's encoding and storing the produced data in
\fIreadObjPtr\fR's string representation. The return value of
\fBTcl_ReadChars\fR is the number of characters, up to \fIcharsToRead\fR,
that were stored in \fIreadObjPtr\fR. If an error occurs while reading, the
return value is \-1 and \fBTcl_ReadChars\fR records a POSIX error code that
return value is TCL_INDEX_NONE and \fBTcl_ReadChars\fR records a POSIX error code that
can be retrieved with \fBTcl_GetErrno\fR.
.PP
Setting \fIcharsToRead\fR to \fB\-1\fR will cause the command to read
Setting \fIcharsToRead\fR to TCL_INDEX_NONE will cause the command to read
all characters currently available (non-blocking) or everything until
eof (blocking mode).
.PP
@@ -471,14 +471,14 @@ character(s) are read and discarded.
.PP
If a line was successfully read, the return value is greater than or equal
to zero and indicates the number of bytes stored in \fIlineObjPtr\fR. If an
error occurs, \fBTcl_GetsObj\fR returns \-1 and records a POSIX error code
error occurs, \fBTcl_GetsObj\fR returns TCL_INDEX_NONE and records a POSIX error code
that can be retrieved with \fBTcl_GetErrno\fR. \fBTcl_GetsObj\fR also
returns \-1 if the end of the file is reached; the \fBTcl_Eof\fR procedure
returns TCL_INDEX_NONE if the end of the file is reached; the \fBTcl_Eof\fR procedure
can be used to distinguish an error from an end-of-file condition.
.PP
If the channel is in nonblocking mode, the return value can also be \-1 if
no data was available or the data that was available did not contain an
end-of-line character. When \-1 is returned, the \fBTcl_InputBlocked\fR
If the channel is in nonblocking mode, the return value can also be TCL_INDEX_NONE
if no data was available or the data that was available did not contain an
end-of-line character. When TCL_INDEX_NONE is returned, the \fBTcl_InputBlocked\fR
procedure may be invoked to determine if the channel is blocked because
of input unavailability.
.PP
@@ -496,7 +496,7 @@ head of the queue. If \fIchannel\fR has a
.QW sticky
EOF set, no data will be
added to the input queue. \fBTcl_Ungets\fR returns \fIinputLen\fR or
\-1 if an error occurs.
TCL_INDEX_NONE if an error occurs.
.SH "TCL_WRITECHARS, TCL_WRITEOBJ, AND TCL_WRITE"
.PP
\fBTcl_WriteChars\fR accepts \fIbytesToWrite\fR bytes of character data at
@@ -513,10 +513,10 @@ to appear as soon as a complete line is accepted for output, set the
\fB\-buffering\fR option on the channel to \fBline\fR mode.
.PP
The return value of \fBTcl_WriteChars\fR is a count of how many bytes were
accepted for output to the channel. This is either greater than zero to
indicate success or \-1 to indicate that an error occurred. If an error
occurs, \fBTcl_WriteChars\fR records a POSIX error code that may be
retrieved with \fBTcl_GetErrno\fR.
accepted for output to the channel. This is either TCL_INDEX_NONE to
indicate that an error occurred or another number greater than
zero to indicate success. If an error occurs, \fBTcl_WriteChars\fR records
a POSIX error code that may be retrieved with \fBTcl_GetErrno\fR.
.PP
Newline characters in the output data are translated to platform-specific
end-of-line sequences according to the \fB\-translation\fR option for the
+9 -9
View File
@@ -250,18 +250,18 @@ and \fBTcl_ObjGetVar2\fR is (if non-NULL) a value with a reference of at least
operated upon.
.PP
The \fInewValuePtr\fR argument to \fBTcl_SetVar2Ex\fR and \fBTcl_ObjSetVar2\fR
may be an arbitrary reference count value; its reference count will be
incremented on success. However, it is recommended to not use a zero reference
count value, as that makes correct handling of the error case tricky.
may be an arbitrary reference count value. Its reference count is
incremented on success. On failure, if its reference count is zero, it is
decremented and freed so the caller need do nothing with it.
.PP
The \fIpart1\fR argument to \fBTcl_ObjSetVar2\fR and \fBTcl_ObjGetVar2\fR can
have any reference count; these functions never modify it. It is recommended
to not use a zero reference count for this argument.
The \fIpart1Ptr\fR argument to \fBTcl_ObjSetVar2\fR and \fBTcl_ObjGetVar2\fR can
have any reference count. These functions never modify it.
.PP
The \fIpart2\fR argument to \fBTcl_ObjSetVar2\fR and \fBTcl_ObjGetVar2\fR, if
The \fIpart2Ptr\fR argument to \fBTcl_ObjSetVar2\fR and \fBTcl_ObjGetVar2\fR, if
non-NULL, should not have a zero reference count as these functions may
retain a reference to it (particularly when it is used to create an array
element that did not previously exist).
retain a reference to it, particularly when it is used to create an array
element that did not previously exist, and decrementing the reference count
later would leave them pointing to a freed Tcl_Obj.
.SH "SEE ALSO"
Tcl_GetObjResult, Tcl_GetStringResult, Tcl_TraceVar
+126 -202
View File
@@ -1,6 +1,7 @@
'\"
'\" Copyright (c) 1993 The Regents of the University of California.
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
'\" Copyright (c) 2023 Nathan Coulter
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -16,176 +17,152 @@ Summary of Tcl language syntax.
.SH DESCRIPTION
.PP
The following rules define the syntax and semantics of the Tcl language:
.IP "[1] \fBCommands.\fR"
A Tcl script is a string containing one or more commands.
Semi-colons and newlines are command separators unless quoted as
described below.
Close brackets are command terminators during command substitution
(see below) unless quoted.
.IP "[2] \fBEvaluation.\fR"
A command is evaluated in two steps.
First, the Tcl interpreter breaks the command into \fIwords\fR
and performs substitutions as described below.
These substitutions are performed in the same way for all
commands.
Secondly, the first word is used to locate a routine to
carry out the command, and the remaining words of the command are
passed to that routine.
The routine is free to interpret each of its words
in any way it likes, such as an integer, variable name, list,
or Tcl script.
Different commands interpret their words differently.
.IP "[3] \fBWords.\fR"
Words of a command are separated by white space (except for
newlines, which are command separators).
.IP "[4] \fBDouble quotes.\fR"
If the first character of a word is double-quote
.PQ \N'34'
then the word is terminated by the next double-quote character.
If semi-colons, close brackets, or white space characters
(including newlines) appear between the quotes then they are treated
as ordinary characters and included in the word.
Command substitution, variable substitution, and backslash substitution
are performed on the characters between the quotes as described below.
The double-quotes are not retained as part of the word.
.IP "[5] \fBArgument expansion.\fR"
If a word starts with the string
.QW {*}
followed by a non-whitespace character, then the leading
.QW {*}
is removed and the rest of the word is parsed and substituted as any other
word. After substitution, the word is parsed as a list (without command or
variable substitutions; backslash substitutions are performed as is normal for
a list and individual internal words may be surrounded by either braces or
double-quote characters), and its words are added to the command being
substituted. For instance,
.QW "cmd a {*}{b [c]} d {*}{$e f {g h}}"
is equivalent to
.QW "cmd a b {[c]} d {$e} f {g h}" .
.IP "[6] \fBBraces.\fR"
If the first character of a word is an open brace
.
.IP "[1] \fBScript.\fR"
A script is composed of zero or more commands delimited by semi-colons or
newlines.
.IP "[2] \fBCommand.\fR"
A command is composed of zero or more words delimited by whitespace. The
replacement for a substitution is included verbatim in the word. For example, a
space in the replacement is included in the word rather than becoming a
delimiter, and \fI\\\\\fR becomes a single backslash in the word. Each word is
processed from left to right and each substitution is performed as soon as it
is complete.
For example, the command
.RS
.PP
.CS
set y [set x 0][incr x][incr x]
.CE
.PP
is composed of three words, and sets the value of \fIy\fR to \fI012\fR.
.PP
If hash
.PQ #
is the first character of what would otherwise be the first word of a command,
all characters up to the next newline are ignored.
.RE
.
.IP "[3] \fBBraced word.\fR"
If a word is enclosed in braces
.PQ {
and rule [5] does not apply, then
the word is terminated by the matching close brace
.PQ } "" .
Braces nest within the word: for each additional open
brace there must be an additional close brace (however,
if an open brace or close brace within the word is
quoted with a backslash then it is not counted in locating the
matching close brace).
No substitutions are performed on the characters between the
braces except for backslash-newline substitutions described
below, nor do semi-colons, newlines, close brackets,
or white space receive any special interpretation.
The word will consist of exactly the characters between the
outer braces, not including the braces themselves.
.IP "[7] \fBCommand substitution.\fR"
If a word contains an open bracket
and
.PQ } ""
, the braces are removed and the enclosed characters become the word. No
substitutions are performed. Nested pairs of braces may occur within the word.
A brace preceded by an odd number of backslashes is not considered part of a
pair, and neither brace nor the backslashes are removed from the word.
.
.IP "[4] \fBQuoted word.\fR"
If a word is enclosed in double quotes
.PQ \N'34'
, the double quotes are removed and the enclosed characters become the word.
Substitutions are performed.
.
.IP "[5] \fBList.\fR"
A list has the form of a single command. Newline is whitespace, and semicolon
has no special interpretation. There is no script evaluation so there is no
argument expansion, variable substitution, or command substitution: Dollar-sign
and open bracket have no special interpretation, and what would be argument
expansion in a script is invalid in a list.
.
.IP "[6] \fBArgument expansion.\fR"
If
.QW {*}
prefixes a word, it is removed. After any remaining enclosing braces or quotes
are processed and applicable substitutions performed, the word, which must
be a list, is removed from the command, and in its place each word in the
list becomes an additional word in the command. For example,
.CS
cmd a {*}{b [c]} d {*}{$e f {g h}}
.CE
is equivalent to
.CS
cmd a b {[c]} d {$e} f {g h} .
.CE
.
.IP "[7] \fBEvaluation.\fR"
To evaluate a script, an interpreter evaluates each successive command. The
first word identifies a procedure, and the remaining words are passed to that
procedure for further evaluation. The procedure interprets each argument in
its own way, e.g. as an integer, variable name, list, mathematical expression,
script, or in some other arbitrary way. The result of the last command is the
result of the script.
.
.IP "[8] \fBCommand substitution.\fR"
Each pair of brackets
.PQ [
then Tcl performs \fIcommand substitution\fR.
To do this it invokes the Tcl interpreter recursively to process
the characters following the open bracket as a Tcl script.
The script may contain any number of commands and must be terminated
by a close bracket
.PQ ] "" .
The result of the script (i.e. the result of its last command) is
substituted into the word in place of the brackets and all of the
characters between them.
There may be any number of command substitutions in a single word.
Command substitution is not performed on words enclosed in braces.
.IP "[8] \fBVariable substitution.\fR"
If a word contains a dollar-sign
and
.PQ ] ""
encloses a script and is replaced by the result of that script.
.IP "[9] \fBVariable substitution.\fR"
Each of the following forms begins with dollar sign
.PQ $
followed by one of the forms
described below, then Tcl performs \fIvariable
substitution\fR: the dollar-sign and the following characters are
replaced in the word by the value of a variable.
Variable substitution may take any of the following forms:
and is replaced by the value of the identified variable. \fIname\fR names the
variable and is composed of ASCII letters (\fBA\fR\(en\fBZ\fR and
\fBa\fR\(en\fBz\fR), digits (\fB0\fR\(en\fB9\fR), underscores, or namespace
delimiters (two or more colons). \fIindex\fR is the name of an individual
variable within an array variable, and may be empty.
.RS
.TP 15
\fB$\fIname\fR
.
\fIName\fR is the name of a scalar variable; the name is a sequence
of one or more characters that are a letter, digit, underscore,
or namespace separators (two or more colons).
Letters and digits are \fIonly\fR the standard ASCII ones (\fB0\fR\(en\fB9\fR,
\fBA\fR\(en\fBZ\fR and \fBa\fR\(en\fBz\fR).
\fIname\fR may not be empty.
.TP 15
\fB$\fIname\fB(\fIindex\fB)\fR
.
\fIName\fR gives the name of an array variable and \fIindex\fR gives
the name of an element within that array.
\fIName\fR must contain only letters, digits, underscores, and
namespace separators, and may be an empty string.
Letters and digits are \fIonly\fR the standard ASCII ones (\fB0\fR\(en\fB9\fR,
\fBA\fR\(en\fBZ\fR and \fBa\fR\(en\fBz\fR).
Command substitutions, variable substitutions, and backslash
substitutions are performed on the characters of \fIindex\fR.
\fIname\fR may be empty. Substitutions are performed on \fIindex\fR.
.TP 15
\fB${\fIname\fB}\fR
\fIname\fR may be empty.
.TP 15
\fB${\fIname(index)\fB}\fR
.
\fIName\fR is the name of a scalar variable or array element. It may contain
any characters whatsoever except for close braces. It indicates an array
element if \fIname\fR is in the form
.QW \fIarrayName\fB(\fIindex\fB)\fR
where \fIarrayName\fR does not contain any open parenthesis characters,
.QW \fB(\fR ,
or close brace characters,
.QW \fB}\fR ,
and \fIindex\fR can be any sequence of characters except for close brace
characters. No further
substitutions are performed during the parsing of \fIname\fR.
.PP
There may be any number of variable substitutions in a single word.
Variable substitution is not performed on words enclosed in braces.
.PP
Note that variables may contain character sequences other than those listed
above, but in that case other mechanisms must be used to access them (e.g.,
via the \fBset\fR command's single-argument form).
\fIname\fR may be empty. No substitutions are performed.
.RE
.IP "[9] \fBBackslash substitution.\fR"
If a backslash
Variables that are not accessible through one of the forms above may be
accessed through other mechanisms, e.g. the \fBset\fR command.
.IP "[10] \fBBackslash substitution.\fR"
Each backslash
.PQ \e
appears within a word then \fIbackslash substitution\fR occurs.
In all cases but those described below the backslash is dropped and
the following character is treated as an ordinary
character and included in the word.
This allows characters such as double quotes, close brackets,
and dollar signs to be included in words without triggering
special processing.
The following table lists the backslash sequences that are
handled specially, along with the value that replaces each sequence.
that is not part of one of the forms listed below is removed, and the next
character is included in the word verbatim, which allows the inclusion of
characters that would normally be interpreted, namely whitespace, braces,
brackets, double quote, dollar sign, and backslash. The following sequences
are replaced as described:
.RS
.RS
.RS
.TP 7
\e\fBa\fR
Audible alert (bell) (Unicode U+000007).
Audible alert (bell) (U+7).
.TP 7
\e\fBb\fR
Backspace (Unicode U+000008).
Backspace (U+8).
.TP 7
\e\fBf\fR
Form feed (Unicode U+00000C).
Form feed (U+C).
.TP 7
\e\fBn\fR
Newline (Unicode U+00000A).
Newline (U+A).
.TP 7
\e\fBr\fR
Carriage-return (Unicode U+00000D).
Carriage-return (U+D).
.TP 7
\e\fBt\fR
Tab (Unicode U+000009).
Tab (U+9).
.TP 7
\e\fBv\fR
Vertical tab (Unicode U+00000B).
Vertical tab (U+B).
.TP 7
\e\fB<newline>\fIwhiteSpace\fR
.
A single space character replaces the backslash, newline, and all spaces
and tabs after the newline. This backslash sequence is unique in that it
is replaced in a separate pre-pass before the command is actually parsed.
This means that it will be replaced even when it occurs between braces,
and the resulting space will be treated as a word separator if it is not
in braces or quotes.
Newline preceded by an odd number of backslashes, along with the consecutive
spaces and tabs that immediately follow it, is replaced by a single space.
Because this happens before the command is split into words, it occurs even
within braced words, and if the resulting space may subsequently be treated as
a word delimiter.
.TP 7
\e\e
Backslash
@@ -193,83 +170,30 @@ Backslash
.TP 7
\e\fIooo\fR
.
The digits \fIooo\fR (one, two, or three of them) give a eight-bit octal
value for the Unicode character that will be inserted, in the range
\fI000\fR\(en\fI377\fR (i.e., the range U+000000\(enU+0000FF).
The parser will stop just before this range overflows, or when
the maximum of three digits is reached. The upper bits of the Unicode
character will be 0.
Up to three octal digits form an eight-bit value for a Unicode character in the
range \fI0\fR\(en\fI377\fR, i.e. U+0\(enU+FF. Only the digits that result in a
number in this range are consumed.
.TP 7
\e\fBx\fIhh\fR
.
The hexadecimal digits \fIhh\fR (one or two of them) give an eight-bit
hexadecimal value for the Unicode character that will be inserted. The upper
bits of the Unicode character will be 0 (i.e., the character will be in the
range U+000000\(enU+0000FF).
Up to two hexadecimal digits form an eight-bit value for a Unicode character in
the range \fI0\fR\(en\fIFF\fR.
.TP 7
\e\fBu\fIhhhh\fR
.
The hexadecimal digits \fIhhhh\fR (one, two, three, or four of them) give a
sixteen-bit hexadecimal value for the Unicode character that will be
inserted. The upper bits of the Unicode character will be 0 (i.e., the
character will be in the range U+000000\(enU+00FFFF).
Up to four hexadecimal digits form a 16-bit value for a Unicode character in
the range \fI0\fR\(en\fIFFFF\fR.
.TP 7
\e\fBU\fIhhhhhhhh\fR
.
The hexadecimal digits \fIhhhhhhhh\fR (one up to eight of them) give a
twenty-one-bit hexadecimal value for the Unicode character that will be
inserted, in the range U+000000\(enU+10FFFF. The parser will stop just
before this range overflows, or when the maximum of eight digits
is reached. The upper bits of the Unicode character will be 0.
.RS
.PP
The range U+00D800\(enU+00DFFF is reserved for surrogates, which
are illegal on their own. Therefore, such sequences will result in
the replacement character U+FFFD. Surrogate pairs should be
encoded as single \e\fBU\fIhhhhhhhh\fR character.
Up to eight hexadecimal digits form a 21-bit value for a Unicode character in
the range \fI0\fR\(en\fI10FFFF\fR. Only the digits that result in a number in
this range are consumed.
.RE
.RE
.PP
Backslash substitution is not performed on words enclosed in braces,
except for backslash-newline as described above.
.RE
.IP "[10] \fBComments.\fR"
If a hash character
.PQ #
appears at a point where Tcl is
expecting the first character of the first word of a command,
then the hash character and the characters that follow it, up
through the next newline, are treated as a comment and ignored.
The comment character only has significance when it appears
at the beginning of a command.
.IP "[11] \fBOrder of substitution.\fR"
Each character is processed exactly once by the Tcl interpreter
as part of creating the words of a command.
For example, if variable substitution occurs then no further
substitutions are performed on the value of the variable; the
value is inserted into the word verbatim.
If command substitution occurs then the nested command is
processed entirely by the recursive call to the Tcl interpreter;
no substitutions are performed before making the recursive
call and no additional substitutions are performed on the result
of the nested script.
.RS
.PP
Substitutions take place from left to right, and each substitution is
evaluated completely before attempting to evaluate the next. Thus, a
sequence like
.PP
.CS
set y [set x 0][incr x][incr x]
.CE
.PP
will always set the variable \fIy\fR to the value, \fI012\fR.
.RE
.IP "[12] \fBSubstitution and word boundaries.\fR"
Substitutions do not affect the word boundaries of a command,
except for argument expansion as specified in rule [5].
For example, during variable substitution the entire value of
the variable becomes part of a single word, even if the variable's
value contains spaces.
.
.SH KEYWORDS
backslash, command, comment, script, substitution, variable
'\" Local Variables:
+3 -3
View File
@@ -22,13 +22,13 @@ int
int
\fBTcl_UniCharToTitle\fR(\fIch\fR)
.sp
int
size_t
\fBTcl_UtfToUpper\fR(\fIstr\fR)
.sp
int
size_t
\fBTcl_UtfToLower\fR(\fIstr\fR)
.sp
int
size_t
\fBTcl_UtfToTitle\fR(\fIstr\fR)
.SH ARGUMENTS
.AS char *str in/out
+4 -4
View File
@@ -15,16 +15,16 @@ Tcl_UniChar, Tcl_UniCharToUtf, Tcl_UtfToUniChar, Tcl_UtfToChar16, Tcl_UtfToWChar
.sp
typedef ... \fBTcl_UniChar\fR;
.sp
int
size_t
\fBTcl_UniCharToUtf\fR(\fIch, buf\fR)
.sp
int
size_t
\fBTcl_UtfToUniChar\fR(\fIsrc, chPtr\fR)
.sp
int
size_t
\fBTcl_UtfToChar16\fR(\fIsrc, uPtr\fR)
.sp
int
size_t
\fBTcl_UtfToWChar\fR(\fIsrc, wPtr\fR)
.sp
char *
+116 -37
View File
@@ -150,6 +150,16 @@ the end of the data.
The default value is the empty string. The acceptable range is \ex01 -
\ex7f. A value outside this range results in an error.
.VS "TCL8.7 TIP656"
.TP
\fB\-profile\fR \fIprofile\fR
.
Specifies the encoding profile to be used on the channel. The encoding
transforms in use for the channel's input and output will then be subject to the
rules of that profile. Any failures will result in a channel error. See
\fBPROFILES\fR in the \fBencoding(n)\fR documentation for details about encoding
profiles.
.VE "TCL8.7 TIP656"
.TP
\fB\-translation\fR \fItranslation\fR
.TP
@@ -216,50 +226,119 @@ typically used on UNIX platforms,
.TP
\fBchan copy \fIinputChan outputChan\fR ?\fB\-size \fIsize\fR? ?\fB\-command \fIcallback\fR?
.
Copies data from \fIinputChan\fR to \fIoutputChan\fR, leveraging internal
buffers to avoid extra copies and to avoid buffering too much data in main
memory when copying large files to slow destinations like network sockets.
Reads characters from \fIinputChan\fR and writes them to \fIoutputChan\fR until
all characters are copied, blocking until the copy is complete and returning
the number of characters copied. Leverages internal buffers to avoid extra
copies and to avoid buffering too much data in main memory when copying large
files to slow destinations like network sockets.
.RS
.PP
If \fB\-size\fR is given, the size is in bytes if the two channels have the
same encoding and in characters otherwise, and only that amount is copied.
Otherwise, all data until the end of the file is copied.
\fBchan copy\fR blocks until the copy is complete and returns the number of
bytes or characters written to \fIoutputChan\fR.
\fB\-size\fR limits the number of characters copied.
.PP
If \fB\-command\fR is given, \fBchan copy\fR returns immediately, the copy is
carried out in the background, and then \fIcallback\fR is called with the
number of bytes written to \fIoutputChan\fR as its first argument, and the
error message for any error that occurred as its second argument.
\fIinputChan\fR and \fIoutputChan\fR are automatically configured for
non-blocking mode if needed. Background copying only works correctly if the
event loop is active, e.g. via \fBvwait\fR or Tk.
If \fB\-command\fR is gviven, \fBchan copy\fR returns immediately, works in the
background, and calls \fIcallback\fR when the copy completes, providing as an
additional argument the number of characters written to \fIoutputChan\fR. If
an error occurres during the background copy, another argument provides message
for the error. \fIinputChan\fR and \fIoutputChan\fR are automatically
configured for non-blocking mode if needed. Background copying only works
correctly if events are being processed, e.g. via \fBvwait\fR or Tk.
.PP
During a background copy no other read or write operation may be performed on
\fIinputChan\fR or \fIoutputChan\fR. If either \fIinputChan\fR or
\fIoutputChan\fR is closed while the copy is in progress copying ceases and
\fBno\fR callback is made. If \fIinputChan\fR is closed all data already queued
is written to \fIoutputChan\fR.
During a background copy no other read operation may be performed on
\fIinputChan\fR, and no write operation may be performed on
\fIoutputChan\fR. However, write operations may by performed on
\fIinputChan\fR and read operations may be performed on \fIoutputChan\fR, as
exhibited by the bidirectional copy example below.
.PP
The should be no event handler established for \fIinputChan\fR because it may
become readable during a background copy. An attempt to read or write
from within an event handler results result in the error, "channel busy".
If either \fIinputChan\fR or \fIoutputChan\fR is closed while the copy is in
progress, copying ceases and \fBno\fR callback is made. If \fIinputChan\fR is
closed all data already queued is written to \fIoutputChan\fR.
.PP
Due to end-of-line translation the number of bytes read from \fIinputChan\fR
may be different than the number of bytes written to \fIoutputChan\fR. Only
the number of bytes written to \fIoutputChan\fR is reported.
There should be no event handler established for \fIinputChan\fR because it
may become readable during a background copy. An attempt to read or write from
within an event handler results result in the error, "channel busy". Any
wrong-sided I/O attempted (by a \fBfileevent\fR handler or otherwise) results
in a
.QW "channel busy"
error.
.PP
\fBChan copy\fR reads the data according to the \fB\-encoding\fR,
\fB\-translation\fR, and \fB\-eofchar\fR of the source and writes to the
destination according to the configuration for that channel. If the encoding
and translation of both channels is \fBbinary\fR and the \fB\-eofchar\fR of
both channels is the empty string, an identical copy is made. If only the
encoding of the destination is \fBbinary\fR, Tcl's internal modified UTF-8
representation of the characters read from the source is written to the
destination. If only the encoding of the source is \fBbinary\fR, each byte read
becomes one Unicode character in the range of 0 to 255, and that character is
subject to the encoding and translation of the destination as it is written.
.PP
.IP \fBEXAMPLES\fR
.PP
The first example transfers the contents of one channel exactly to
another. Note that when copying one file to another, it is better to
use \fBfile copy\fR which also copies file metadata (e.g. the file
access permissions) where possible.
.PP
.CS
fconfigure $in -translation binary
fconfigure $out -translation binary
\fBfcopy\fR $in $out
.CE
.PP
This second example shows how the callback gets
passed the number of bytes transferred.
It also uses vwait to put the application into the event loop.
Of course, this simplified example could be done without the command
callback.
.PP
.CS
proc Cleanup {in out bytes {error {}}} {
global total
set total $bytes
close $in
close $out
if {[string length $error] != 0} {
# error occurred during the copy
}
}
set in [open $file1]
set out [socket $server $port]
\fBfcopy\fR $in $out -command [list Cleanup $in $out]
vwait total
.CE
.PP
The third example copies in chunks and tests for end of file
in the command callback.
.PP
.CS
proc CopyMore {in out chunk bytes {error {}}} {
global total done
incr total $bytes
if {([string length $error] != 0) || [eof $in]} {
set done $total
close $in
close $out
} else {
\fBfcopy\fR $in $out -size $chunk \e
-command [list CopyMore $in $out $chunk]
}
}
set in [open $file1]
set out [socket $server $port]
set chunk 1024
set total 0
\fBfcopy\fR $in $out -size $chunk \e
-command [list CopyMore $in $out $chunk]
vwait done
.CE
.PP
The fourth example starts an asynchronous, bidirectional fcopy between
two sockets. Those could also be pipes from two [open "|hal 9000" r+]
(though their conversation would remain secret to the script, since
all four fileevent slots are busy).
.PP
.CS
set flows 2
proc Done {dir args} {
global flows done
puts "$dir is over."
incr flows -1
if {$flows<=0} {set done 1}
}
\fBfcopy\fR $sok1 $sok2 -command [list Done UP]
\fBfcopy\fR $sok2 $sok1 -command [list Done DOWN]
vwait done
.CE
.RE
.TP
\fBchan create \fImode cmdPrefix\fR
+146 -110
View File
@@ -8,160 +8,196 @@
.so man.macros
.BS
.SH NAME
encoding \- Manipulate encodings
encoding \- Work with encodings
.SH SYNOPSIS
\fBencoding \fIoption\fR ?\fIarg arg ...\fR?
\fBencoding \fIoperation\fR ?\fIarg arg ...\fR?
.BE
.SH INTRODUCTION
.PP
Strings in Tcl are logically a sequence of Unicode characters.
These strings are represented in memory as a sequence of bytes that
may be in one of several encodings: modified UTF\-8 (which uses 1 to 4
bytes per character), or a custom encoding start as 8 bit binary data.
In Tcl every string is composed of Unicode values. Text may be encoded into an
encoding such as cp1252, iso8859-1, Shitf\-JIS, utf-8, utf-16, etc. Not every
Unicode vealue is encodable in every encoding, and some encodings can encode
values that are not available in Unicode.
.PP
Different operating system interfaces or applications may generate
strings in other encodings such as Shift\-JIS. The \fBencoding\fR
command helps to bridge the gap between Unicode and these other
formats.
Even though Unicode is for encoding the written texts of human languages, any
sequence of bytes can be encoded as the first 255 Unicode values. iso8859-1 an
encoding for a subset of Unicode in which each byte is a Unicode value of 255
or less. Thus, any sequence of bytes can be considered to be a Unicode string
encoded in iso8859-1. To work with binary data in Tcl, decode it from
iso8859-1 when reading it in, and encode it into iso8859-1 when writing it out,
ensuring that each character in the string has a value of 255 or less.
Decoding such a string does nothing, and encoding encoding such a string also
does nothing.
.PP
For example, the following is true:
.CS
set text {In Tcl binary data is treated as Unicode text and it just works.}
set encoded [encoding convertto iso8859-1 $text]
expr {$text eq $encoded}; #-> 1
.CE
The following is also true:
.CS
set decoded [encoding convertfrom iso8859-1 $text]
expr {$text eq $decoded}; #-> 1
.CE
.SH DESCRIPTION
.PP
Performs one of several encoding related operations, depending on
\fIoption\fR. The legal \fIoption\fRs are:
Performs one of the following encoding \fIoperations\fR:
.TP
\fBencoding convertfrom\fR ?\fB-nocomplain\fR? ?\fB-failindex var\fR? ?\fB-strict\fR? ?\fIencoding\fR? \fIdata\fR
.
Convert \fIdata\fR to a Unicode string from the specified \fIencoding\fR. The
characters in \fIdata\fR are 8 bit binary data. The resulting
sequence of bytes is a string created by applying the given \fIencoding\fR
to the data. If \fIencoding\fR is not specified, the current
system encoding is used.
.VS "TCL8.7 TIP346, TIP607, TIP601"
.PP
.RS
If the option \fB-nocomplain\fR is given, the command does not fail on
encoding errors. Instead, any not convertable bytes (like incomplete UTF-8
sequences, see example below) are put as byte values into the output stream.
If the option \fB-nocomplain\fR is not given, the command will fail with an
appropriate error message.
.PP
If the option \fB-failindex\fR with a variable name is given, the error reporting
is changed in the following manner:
in case of a conversion error, the position of the input byte causing the error
is returned in the given variable. The return value of the command are the
converted characters until the first error position. No error condition is raised.
In case of no error, the value \fI-1\fR is written to the variable. This option
may not be used together with \fB-nocomplain\fR.
.PP
The \fB-strict\fR option followes more strict rules in conversion. Currently, only
the sequence \fB\\xC0\\x80\fR in \fButf-8\fR encoding is disallowed. Additional rules
may follow.
.VE "TCL8.7 TIP346, TIP607, TIP601"
.RE
\fBencoding convertfrom\fR ?\fIencoding\fR? \fIdata\fR
.TP
\fBencoding convertto\fR ?\fB-nocomplain\fR? ?\fB-failindex var\fR? ?\fB-strict\fR? ?\fIencoding\fR? \fIstring\fR
\fBencoding convertfrom\fR ?\fB-profile \fIprofile\fR? ?\fB-failindex var\fR? \fIencoding\fR \fIdata\fR
.
Convert \fIstring\fR from Unicode to the specified \fIencoding\fR.
The result is a sequence of bytes that represents the converted
string. Each byte is stored in the lower 8-bits of a Unicode
character (indeed, the resulting string is a binary string as far as
Tcl is concerned, at least initially). If \fIencoding\fR is not
specified, the current system encoding is used.
.VS "TCL8.7 TIP346, TIP607, TIP601"
.PP
.RS
If the option \fB-nocomplain\fR is given, the command does not fail on
encoding errors. Instead, the replacement character \fB?\fR is output
for any not representable character (like the dot \fB\\U2022\fR
in \fBiso-8859-1\fR encoding, see example below).
If the option \fB-nocomplain\fR is not given, the command will fail with an
appropriate error message.
.PP
If the option \fB-failindex\fR with a variable name is given, the error reporting
is changed in the following manner:
in case of a conversion error, the position of the input character causing the error
is returned in the given variable. The return value of the command are the
converted bytes until the first error position. No error condition is raised.
In case of no error, the value \fI-1\fR is written to the variable. This option
may not be used together with \fB-nocomplain\fR.
.PP
The \fB-strict\fR option followes more strict rules in conversion. Currently, it has
no effect but may be used in future to add additional encoding checks.
.VE "TCL8.7 TIP346, TIP607, TIP601"
.RE
Decodes \fIdata\fR encoded in \fIencoding\fR. If \fIencoding\fR is not
specified the current system encoding is used.
.VS "TCL8.7 TIP607, TIP656"
\fB-profile\fR determines how invalid data for the encoding are handled. See
the \fBPROFILES\fR section below for details. Returns an error if decoding
fails. However, if \fB-failindex\fR given, returns the result of the
conversion up to the point of termination, and stores in \fBvar\fR the index of
the character that could not be converted. If no errors are encountered the
entire result of the conversion is returned and the value \fB-1\fR is stored in
\fBvar\fR.
.VE "TCL8.7 TIP607, TIP656"
.TP
\fBencoding convertto\fR ?\fIencoding\fR? \fIdata\fR
.TP
\fBencoding convertto\fR ?\fB-profile \fIprofile\fR? ?\fB-failindex var\fR? \fIencoding\fR \fIdata\fR
.
Converts \fIstring\fR to \fIencoding\fR. If \fIencoding\fR is not given, the
current system encoding is used.
.VS "TCL8.7 TIP607, TIP656"
See \fBencoding convertfrom\fR for the meaning of \fB-profile\fR and \fB-failindex\fR.
.VE "TCL8.7 TIP607, TIP656"
.TP
\fBencoding dirs\fR ?\fIdirectoryList\fR?
.
Tcl can load encoding data files from the file system that describe
additional encodings for it to work with. This command sets the search
path for \fB*.enc\fR encoding data files to the list of directories
\fIdirectoryList\fR. If \fIdirectoryList\fR is omitted then the
command returns the current list of directories that make up the
search path. It is an error for \fIdirectoryList\fR to not be a valid
list. If, when a search for an encoding data file is happening, an
element in \fIdirectoryList\fR does not refer to a readable,
searchable directory, that element is ignored.
Sets the search path for \fB*.enc\fR encoding data files to the list of
directories given by \fIdirectoryList\fR. If \fIdirectoryList\fR is not given,
returns the current list of directories that make up the search path. It is
not an error for an item in \fIdirectoryList\fR to not refer to a readable,
searchable directory.
.TP
\fBencoding names\fR
.
Returns a list containing the names of all of the encodings that are
currently available.
Returns a list of the names of available encodings.
The encodings
.QW utf-8
and
.QW iso8859-1
are guaranteed to be present in the list.
.VS "TCL8.7 TIP656"
.TP
\fBencoding profiles\fR
Returns a list of names of available encoding profiles. See \fBPROFILES\fR
below.
.VE "TCL8.7 TIP656"
.TP
\fBencoding system\fR ?\fIencoding\fR?
.
Set the system encoding to \fIencoding\fR. If \fIencoding\fR is
omitted then the command returns the current system encoding. The
system encoding is used whenever Tcl passes strings to system calls.
.SH EXAMPLE
Sets the system encoding to \fIencoding\fR. If \fIencoding\fR is not given,
returns the current system encoding. The system encoding is used to pass
strings to system calls.
.\" Do not put .VS on whole section as that messes up the bullet list alignment
.SH PROFILES
.PP
Example 1: convert a byte sequence in Japanese euc-jp encoding to a TCL string:
.VS "TCL8.7 TIP656"
Each \fIprofile\fR is a distinct strategy for dealing with invalid data for an
encoding.
.PP
The following profiles are currently implemented.
.VS "TCL8.7 TIP656"
.TP
\fBtcl8\fR
.
The default profile. Provides for behaviour identical to that of Tcl 8.6: When
decoding, for encodings \fBother than utf-8\fR, each invalid byte is interpreted
as the Unicode value given by that one byte. For example, the byte 0x80, which
is invalid in the ASCII encoding would be mapped to the Unicode value U+0080.
For \fButf-8\fR, each invalid byte that is a valid CP1252 character is
interpreted as the Unicode value for that character, while each byte that is
not is treated as the Unicode value given by that one byte. For example, byte
0x80 is defined by CP1252 and is therefore mapped to its Unicode equivalent
U+20AC while byte 0x81 which is not defined by CP1252 is mapped to U+0081. As
an additional special case, the sequence 0xC0 0x80 is mapped to U+0000.
When encoding, each character that cannot be represented in the encoding is
replaced by an encoding-dependent character, usually the question mark \fB?\fR.
.TP
\fBstrict\fR
.
The operation fails when invalid data for the encoding are encountered.
.TP
\fBreplace\fR
.
When decoding, invalid bytes are replaced by U+FFFD, the Unicode REPLACEMENT
CHARACTER.
When encoding, Unicode values that cannot be represented in the target encoding
are transformed to an encoding-specific fallback character, U+FFFD REPLACEMENT
CHARACTER for UTF targets, and generally `?` for other encodings.
.VE "TCL8.7 TIP656"
.SH EXAMPLES
.PP
These examples use the utility proc below that prints the Unicode value for
each character in a string.
.PP
.CS
set s [\fBencoding convertfrom\fR euc-jp "\exA4\exCF"]
proc codepoints s {join [lmap c [split $s {}] {
string cat U+ [format %.6X [scan $c %c]]}]
}
.CE
.PP
The result is the unicode codepoint:
Example 1: Convert from euc-jp:
.PP
.CS
% codepoints [\fBencoding convertfrom\fR euc-jp \exA4\exCF]
U+00306F
.CE
.PP
The result is the Unicode value
.QW "\eu306F" ,
which is the Hiragana letter HA.
.VS "TCL8.7 TIP346, TIP607, TIP601"
.VS "TCL8.7 TIP607, TIP656"
.PP
Example 2: detect the error location in an incomplete UTF-8 sequence:
Example 2: Error handling based on profiles:
.PP
The letter \fBA\fR is Unicode character U+0041 and the byte "\ex80" is invalid
in ASCII encoding.
.PP
.CS
% set s [\fBencoding convertfrom\fR -failindex i utf-8 "A\exC3"]
A
% set i
1
% codepoints [encoding convertfrom -profile tcl8 ascii A\ex80]
U+000041 U+000080
% codepoints [encoding convertfrom -profile replace ascii A\ex80]
U+000041 U+00FFFD
% codepoints [encoding convertfrom -profile strict ascii A\ex80]
unexpected byte sequence starting at index 1: '\ex80'
.CE
.PP
Example 3: return the incomplete UTF-8 sequence by raw bytes:
Example 3: Get partial data and the error location:
.PP
.CS
% set s [\fBencoding convertfrom\fR -nocomplain utf-8 "A\exC3"]
.CE
The result is "A" followed by the byte \exC3.
.PP
Example 4: detect the error location while transforming to ISO8859-1
(ISO-Latin 1):
.PP
.CS
% set s [\fBencoding convertto\fR -failindex i utf-8 "A\eu0141"]
A
% set i
1
% codepoints [encoding convertfrom -profile strict -failindex idx ascii AB\ex80]
U+000041 U+000042
% set idx
2
.CE
.PP
Example 5: replace a not representable character by the replacement character:
Example 4: Encode a character that is not representable in ISO8859-1:
.PP
.CS
% set s [\fBencoding convertto\fR -nocomplain utf-8 "A\eu0141"]
% encoding convertto iso8859-1 A\eu0141
A?
% encoding convertto -profile strict iso8859-1 A\eu0141
unexpected character at index 1: 'U+000141'
% encoding convertto -profile strict -failindex idx iso8859-1 A\eu0141
A
% set idx
1
.CE
.VE "TCL8.7 TIP346, TIP607, TIP601"
.VE "TCL8.7 TIP607, TIP656"
.PP
.SH "SEE ALSO"
Tcl_GetEncoding(3), fconfigure(n)
+9 -26
View File
@@ -112,33 +112,16 @@ string.
The acceptable range for \fB\-eofchar\fR values is \ex01 - \ex7F;
attempting to set \fB\-eofchar\fR to a value outside of this range will
generate an error.
.VS "TCL9.0 TIP633"
.VS "TCL8.7 TIP656"
.TP
\fB\-nocomplainencoding\fR \fIbool\fR
\fB\-profile\fR \fIprofile\fR
.
Reporting mode of encoding errors.
If set to a \fItrue\fR value, encoding errors are resolved by a replacement
character (output) or verbatim bytes (input). No error is thrown.
If set to a \fIfalse\fR value, errors are thrown in case of encoding errors.
.RS
.PP
The default value is \fIfalse\fR starting from TCL 9.0 and \fItrue\fR on TCL 8.7.
This option was introduced with TCL 8.7 and has the fix value \fItrue\fR.
.PP
See the \fI\-nocomplain\fR option of the \fBencoding\fR command for more information.
.RE
.VE "TCL9.0 TIP633"
.VS "TCL8.7 TIP346"
.TP
\fB\-strictencoding\fR \fIbool\fR
.
Activate additional stricter encoding application rules.
Default value is \fIfalse\fR.
.RS
.PP
See the \fI\-strict\fR option of the \fBencoding\fR command for more information.
.VE "TCL8.7 TIP346"
.RE
Specifies the encoding profile to be used on the channel. The encoding
transforms in use for the channel's input and output will then be subject to the
rules of that profile. Any failures will result in a channel error. See
\fBPROFILES\fR in the \fBencoding(n)\fR documentation for details about encoding
profiles.
.VE "TCL8.7 TIP656"
.TP
\fB\-translation\fR \fImode\fR
.TP
@@ -299,7 +282,7 @@ close(n), encoding(n), flush(n), gets(n), open(n), puts(n), read(n), socket(n),
Tcl_StandardChannels(3)
.SH KEYWORDS
blocking, buffering, carriage return, end of line, encoding, flushing, linemode,
newline, nonblocking, platform, translation, encoding, filter, byte array,
newline, nonblocking, platform, profile, translation, encoding, filter, byte array,
binary
'\" Local Variables:
'\" mode: nroff
+29 -75
View File
@@ -12,90 +12,44 @@
.SH NAME
fcopy \- Copy data from one channel to another
.SH SYNOPSIS
\fBfcopy \fIinchan\fR \fIoutchan\fR ?\fB\-size \fIsize\fR? ?\fB\-command \fIcallback\fR?
\fBfcopy \fIinputChan\fR \fIoutputChan\fR ?\fB\-size \fIsize\fR? ?\fB\-command \fIcallback\fR?
.BE
.SH DESCRIPTION
.PP
The \fBfcopy\fR command copies data from one I/O channel, \fIinchan\fR to another I/O channel, \fIoutchan\fR.
The \fBfcopy\fR command leverages the buffering in the Tcl I/O system to
avoid extra copies and to avoid buffering too much data in
main memory when copying large files to slow destinations like
network sockets.
Reads characters from \fIinputChan\fR and writes them to \fIoutputChan\fR until
all characters are copied, blocking until the copy is complete and returning
the number of characters copied. Leverages internal buffers to avoid extra
copies and to avoid buffering too much data in main memory when copying large
files to slow destinations like network sockets.
.PP
The \fBfcopy\fR
command transfers data from \fIinchan\fR until end of file
or \fIsize\fR bytes or characters have been
transferred; \fIsize\fR is in bytes if the two channels are using the
same encoding, and is in characters otherwise.
If no \fB\-size\fR argument is given,
then the copy goes until end of file.
All the data read from \fIinchan\fR is copied to \fIoutchan\fR.
Without the \fB\-command\fR option, \fBfcopy\fR blocks until the copy is complete
and returns the number of bytes or characters (using the same rules as
for the \fB\-size\fR option) written to \fIoutchan\fR.
\fB\-size\fR limits the number of characters copied.
.PP
The \fB\-command\fR argument makes \fBfcopy\fR work in the background.
In this case it returns immediately and the \fIcallback\fR is invoked
later when the copy completes.
The \fIcallback\fR is called with
one or two additional
arguments that indicates how many bytes were written to \fIoutchan\fR.
If an error occurred during the background copy, the second argument is the
error string associated with the error.
With a background copy,
it is not necessary to put \fIinchan\fR or \fIoutchan\fR into
non-blocking mode; the \fBfcopy\fR command takes care of that automatically.
However, it is necessary to enter the event loop by using
the \fBvwait\fR command or by using Tk.
\fB\-command\fR makes \fBfcopy\fR return immediately, work in the background,
and call \fIcallback\fR when the copy completes, providing as an additional
argument the number of characters written to \fIoutputChan\fR. If an error
occurres during the background copy, another argument provides the message for
the error. \fIinputChan\fR and \fIoutputChan\fR are automatically configured
for non-blocking mode if needed. Background copying only works correctly if
events are being processed e.g. via \fBvwait\fR or Tk.
.PP
You are not allowed to do other input operations with \fIinchan\fR, or
output operations with \fIoutchan\fR, during a background
\fBfcopy\fR. The converse is entirely legitimate, as exhibited by the
bidirectional fcopy example below.
During a background copy no other read operation may be performed on
\fIinputChan\fR, and no other write operation may be performed on
\fIoutputChan\fR. However, write operations may by performed on
\fIinputChan\fR and read operations may be performed on \fIoutputChan\fR, as
exhibited by the bidirectional copy example below.
.PP
If either \fIinchan\fR or \fIoutchan\fR get closed
while the copy is in progress, the current copy is stopped
and the command callback is \fInot\fR made.
If \fIinchan\fR is closed,
then all data already queued for \fIoutchan\fR is written out.
If either \fIinputChan\fR or \fIoutputChan\fR is closed while the copy is in
progress, copying ceases and \fBno\fR callback is made. If \fIinputChan\fR is
closed all data already queued is written to \fIoutputChan\fR.
.PP
Note that \fIinchan\fR can become readable during a background copy.
You should turn off any \fBfileevent\fR handlers during a background
copy so those handlers do not interfere with the copy.
Any wrong-sided I/O attempted (by a \fBfileevent\fR handler or otherwise) will get a
There should be no event handler established for \fIinputChan\fR because it
may become readable during a background copy. An attempt to read or write from
within an event handler results result in the error, "channel busy". Any
wrong-sided I/O attempted (by a \fBfileevent\fR handler or otherwise) results
in a
.QW "channel busy"
error.
.PP
\fBFcopy\fR translates end-of-line sequences in \fIinchan\fR and \fIoutchan\fR
according to the \fB\-translation\fR option
for these channels.
See the manual entry for \fBfconfigure\fR for details on the
\fB\-translation\fR option.
The translations mean that the number of bytes read from \fIinchan\fR
can be different than the number of bytes written to \fIoutchan\fR.
Only the number of bytes written to \fIoutchan\fR is reported,
either as the return value of a synchronous \fBfcopy\fR or
as the argument to the callback for an asynchronous \fBfcopy\fR.
.PP
\fBFcopy\fR obeys the encodings and character translations configured
for the channels. This
means that the incoming characters are converted internally first
UTF-8 and then into the encoding of the channel \fBfcopy\fR writes
to. See the manual entry for \fBfconfigure\fR for details on the
\fB\-encoding\fR and \fB\-translation\fR options. No conversion is
done if both channels are
set to encoding
.QW binary
and have matching translations. If only the output channel is set to encoding
.QW binary
the system will write the internal UTF-8 representation of the incoming
characters. If only the input channel is set to encoding
.QW binary
the system will assume that the incoming
bytes are valid UTF-8 characters and convert them according to the
output encoding. The behaviour of the system for bytes which are not
valid UTF-8 characters is undefined in this case.
.SH EXAMPLES
.PP
The first example transfers the contents of one channel exactly to
@@ -144,7 +98,7 @@ proc CopyMore {in out chunk bytes {error {}}} {
close $out
} else {
\fBfcopy\fR $in $out -size $chunk \e
-command [list CopyMore $in $out $chunk]
-command [list CopyMore $in $out $chunk]
}
}
set in [open $file1]
@@ -152,7 +106,7 @@ set out [socket $server $port]
set chunk 1024
set total 0
\fBfcopy\fR $in $out -size $chunk \e
-command [list CopyMore $in $out $chunk]
-command [list CopyMore $in $out $chunk]
vwait done
.CE
.PP
+2 -2
View File
@@ -53,8 +53,8 @@ here, then the \fBfinalize\fR subcommand will not be called.
.PP
The \fImode\fR argument tells the handler whether the channel was
opened for reading, writing, or both. It is a list containing any of
the strings \fBread\fR or \fBwrite\fR. The list will always
contain at least one element.
the strings \fBread\fR or \fBwrite\fR. The list may be empty, but
will usually contain at least one element.
.PP
The subcommand must throw an error if the chosen mode is not
supported by the \fIcmdPrefix\fR.
+2 -2
View File
@@ -2184,9 +2184,9 @@ stid(
return "unable";
}
if (t->id != 0) {
sprintf(buf, "%d", t->id);
snprintf(buf, bufsize, "%d", t->id);
} else {
sprintf(buf, "%p", t);
snprintf(buf, bufsize, "%p", t);
}
return buf;
}
+3 -3
View File
@@ -73,7 +73,7 @@ regerror(
break;
}
}
sprintf(convbuf, "%d", r->code); /* -1 for unknown */
snprintf(convbuf, sizeof(convbuf), "%d", r->code); /* -1 for unknown */
msg = convbuf;
break;
case REG_ITOA: /* Convert number to name */
@@ -86,7 +86,7 @@ regerror(
if (r->code >= 0) {
msg = r->name;
} else { /* Unknown; tell him the number */
sprintf(convbuf, "REG_%u", icode);
snprintf(convbuf, sizeof(convbuf), "REG_%u", icode);
msg = convbuf;
}
break;
@@ -99,7 +99,7 @@ regerror(
if (r->code >= 0) {
msg = r->explain;
} else { /* Unknown; say so */
sprintf(convbuf, unk, code);
snprintf(convbuf, sizeof(convbuf), unk, code);
msg = convbuf;
}
break;
+33 -13
View File
@@ -1205,7 +1205,7 @@ declare 323 {
int Tcl_UniCharToUpper(int ch)
}
declare 324 {
int Tcl_UniCharToUtf(int ch, char *buf)
Tcl_Size Tcl_UniCharToUtf(int ch, char *buf)
}
declare 325 {
const char *TclUtfAtIndex(const char *src, Tcl_Size index)
@@ -1239,16 +1239,16 @@ declare 333 {
const char *src, Tcl_Size srcLen, Tcl_DString *dsPtr)
}
declare 334 {
int Tcl_UtfToLower(char *src)
Tcl_Size Tcl_UtfToLower(char *src)
}
declare 335 {
int Tcl_UtfToTitle(char *src)
Tcl_Size Tcl_UtfToTitle(char *src)
}
declare 336 {
int Tcl_UtfToChar16(const char *src, unsigned short *chPtr)
Tcl_Size Tcl_UtfToChar16(const char *src, unsigned short *chPtr)
}
declare 337 {
int Tcl_UtfToUpper(char *src)
Tcl_Size Tcl_UtfToUpper(char *src)
}
declare 338 {
Tcl_Size Tcl_WriteChars(Tcl_Channel chan, const char *src, Tcl_Size srcLen)
@@ -2454,7 +2454,7 @@ declare 645 {
# TIP #548
declare 646 {
int Tcl_UtfToUniChar(const char *src, int *chPtr)
Tcl_Size Tcl_UtfToUniChar(const char *src, int *chPtr)
}
declare 647 {
char *Tcl_UniCharToUtfDString(const int *uniStr,
@@ -2500,13 +2500,17 @@ declare 656 {
declare 657 {
int Tcl_UniCharIsUnicode(int ch)
}
# TIP 656
declare 658 {
Tcl_Size Tcl_ExternalToUtfDStringEx(Tcl_Encoding encoding,
const char *src, Tcl_Size srcLen, int flags, Tcl_DString *dsPtr)
int Tcl_ExternalToUtfDStringEx(Tcl_Interp *interp, Tcl_Encoding encoding,
const char *src, Tcl_Size srcLen, int flags, Tcl_DString *dsPtr,
Tcl_Size *errorLocationPtr)
}
declare 659 {
Tcl_Size Tcl_UtfToExternalDStringEx(Tcl_Encoding encoding,
const char *src, Tcl_Size srcLen, int flags, Tcl_DString *dsPtr)
int Tcl_UtfToExternalDStringEx(Tcl_Interp *interp, Tcl_Encoding encoding,
const char *src, Tcl_Size srcLen, int flags, Tcl_DString *dsPtr,
Tcl_Size *errorLocationPtr)
}
# TIP #511
@@ -2608,10 +2612,25 @@ declare 682 {
# TIP 643
declare 683 {
int Tcl_GetEncodingNulLength(Tcl_Encoding encoding)
Tcl_Size Tcl_GetEncodingNulLength(Tcl_Encoding encoding)
}
# ----- BASELINE -- FOR -- 8.7.0 ----- #
# TIP #650
declare 684 {
int Tcl_GetWideUIntFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr,
Tcl_WideUInt *uwidePtr)
}
# TIP 651
declare 685 {
Tcl_Obj *Tcl_DStringToObj(Tcl_DString *dsPtr)
}
# ----- BASELINE -- FOR -- 8.7.0 / 9.0.0 ----- #
declare 687 {
void TclUnusedStubEntry(void)
}
##############################################################################
@@ -2630,7 +2649,7 @@ interface tclPlat
declare 1 {
int Tcl_MacOSXOpenVersionedBundleResources(Tcl_Interp *interp,
const char *bundleName, const char *bundleVersion,
int hasResourceFile, size_t maxPathLen, char *libraryPath)
int hasResourceFile, Tcl_Size maxPathLen, char *libraryPath)
}
declare 2 {
void Tcl_MacOSXNotifierAddRunLoopMode(const void *runLoopMode)
@@ -2685,6 +2704,7 @@ export {
const char *TclZipfs_AppHook(int *argc, char ***argv)
}
# Local Variables:
# mode: tcl
# End:
+71 -49
View File
@@ -311,10 +311,23 @@ typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt;
#define Tcl_WideAsDouble(val) ((double)((Tcl_WideInt)(val)))
#define Tcl_DoubleAsWide(val) ((Tcl_WideInt)((double)(val)))
#if TCL_MAJOR_VERSION < 9
typedef int Tcl_Size;
#define TCL_SIZE_ISNEG(index) ((index) < 0)
#elif defined(TCL_SIGNED_SIZE) && !defined(BUILD_tcl)
typedef ptrdiff_t Tcl_Size;
#define TCL_SIZE_ISNEG(index) (((index) == TCL_INDEX_NONE) \
|| ((sizeof(int) != sizeof(size_t)) && ((ptrdiff_t)(index) < 0) \
&& (Tcl_Panic("Tcl_Size overflow %s:%d", __FILE__, __LINE__), 1)))
#else
typedef size_t Tcl_Size;
#define TCL_SIZE_ISNEG(index) (((index) == TCL_INDEX_NONE) \
|| ((sizeof(int) != sizeof(size_t)) && ((ptrdiff_t)(index) < 0) \
&& (Tcl_Panic("Tcl_Size overflow %s:%d", __FILE__, __LINE__), 1)))
#endif
#ifdef _WIN32
# if TCL_MAJOR_VERSION > 8
typedef struct __stat64 Tcl_StatBuf;
# elif defined(_WIN64) || defined(_USE_64BIT_TIME_T)
# if TCL_MAJOR_VERSION > 8 || defined(_WIN64) || defined(_USE_64BIT_TIME_T)
typedef struct __stat64 Tcl_StatBuf;
# elif defined(_USE_32BIT_TIME_T)
typedef struct _stati64 Tcl_StatBuf;
@@ -323,26 +336,19 @@ typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt;
# endif
#elif defined(__CYGWIN__)
typedef struct {
dev_t st_dev;
unsigned st_dev;
unsigned short st_ino;
unsigned short st_mode;
short st_nlink;
short st_uid;
short st_gid;
/* Here is a 2-byte gap */
dev_t st_rdev;
unsigned st_rdev;
/* Here is a 4-byte gap */
long long st_size;
#if TCL_MAJOR_VERSION > 8
struct {long long tv_sec;} st_atim;
struct {long long tv_sec;} st_mtim;
struct {long long tv_sec;} st_ctim;
#else
struct {long tv_sec;} st_atim;
struct {long tv_sec;} st_mtim;
struct {long tv_sec;} st_ctim;
/* Here is a 4-byte gap */
#endif
} Tcl_StatBuf;
#elif defined(HAVE_STRUCT_STAT64) && !defined(__APPLE__)
typedef struct stat64 Tcl_StatBuf;
@@ -455,17 +461,17 @@ typedef void (Tcl_ThreadCreateProc) (void *clientData);
#if TCL_MAJOR_VERSION > 8
typedef struct Tcl_RegExpIndices {
size_t start; /* Character offset of first character in
Tcl_Size start; /* Character offset of first character in
* match. */
size_t end; /* Character offset of first character after
Tcl_Size end; /* Character offset of first character after
* the match. */
} Tcl_RegExpIndices;
typedef struct Tcl_RegExpInfo {
size_t nsubs; /* Number of subexpressions in the compiled
Tcl_Size nsubs; /* Number of subexpressions in the compiled
* expression. */
Tcl_RegExpIndices *matches; /* Array of nsubs match offset pairs. */
size_t extendStart; /* The offset at which a subsequent match
Tcl_Size extendStart; /* The offset at which a subsequent match
* might begin. */
} Tcl_RegExpInfo;
#else
@@ -557,9 +563,15 @@ typedef void (Tcl_CmdTraceProc) (void *clientData, Tcl_Interp *interp,
typedef int (Tcl_CmdObjTraceProc) (void *clientData, Tcl_Interp *interp,
int level, const char *command, Tcl_Command commandInfo, int objc,
struct Tcl_Obj *const *objv);
#if defined(TCL_SIGNED_SIZE) && !defined(BUILD_tcl)
typedef int (Tcl_CmdObjTraceProc2) (void *clientData, Tcl_Interp *interp,
ptrdiff_t level, const char *command, Tcl_Command commandInfo, ptrdiff_t objc,
struct Tcl_Obj *const *objv);
#else
typedef int (Tcl_CmdObjTraceProc2) (void *clientData, Tcl_Interp *interp,
size_t level, const char *command, Tcl_Command commandInfo, size_t objc,
struct Tcl_Obj *const *objv);
#endif
typedef void (Tcl_CmdObjTraceDeleteProc) (void *clientData);
typedef void (Tcl_DupInternalRepProc) (struct Tcl_Obj *srcPtr,
struct Tcl_Obj *dupPtr);
@@ -582,8 +594,13 @@ typedef void (Tcl_InterpDeleteProc) (void *clientData,
typedef void (Tcl_NamespaceDeleteProc) (void *clientData);
typedef int (Tcl_ObjCmdProc) (void *clientData, Tcl_Interp *interp,
int objc, struct Tcl_Obj *const *objv);
#if defined(TCL_SIGNED_SIZE) && !defined(BUILD_tcl)
typedef int (Tcl_ObjCmdProc2) (void *clientData, Tcl_Interp *interp,
ptrdiff_t objc, struct Tcl_Obj *const *objv);
#else
typedef int (Tcl_ObjCmdProc2) (void *clientData, Tcl_Interp *interp,
size_t objc, struct Tcl_Obj *const *objv);
#endif
typedef int (Tcl_LibraryInitProc) (Tcl_Interp *interp);
typedef int (Tcl_LibraryUnloadProc) (Tcl_Interp *interp, int flags);
typedef void (Tcl_PanicProc) (const char *format, ...);
@@ -668,12 +685,6 @@ typedef union Tcl_ObjInternalRep { /* The internal representation: */
* An object stores a value as either a string, some internal representation,
* or both.
*/
#if TCL_MAJOR_VERSION > 8
typedef size_t Tcl_Size;
#else
typedef int Tcl_Size;
#endif
typedef struct Tcl_Obj {
Tcl_Size refCount; /* When 0 the object will be freed. */
@@ -688,7 +699,7 @@ typedef struct Tcl_Obj {
* should use Tcl_GetStringFromObj or
* Tcl_GetString to get a pointer to the byte
* array as a readonly value. */
Tcl_Size length; /* The number of bytes at *bytes, not
Tcl_Size length; /* The number of bytes at *bytes, not
* including the terminating null. */
const Tcl_ObjType *typePtr; /* Denotes the object's type. Always
* corresponds to the type of the object's
@@ -1909,11 +1920,11 @@ typedef struct Tcl_EncodingType {
* encoding is deleted. */
void *clientData; /* Arbitrary value associated with encoding
* type. Passed to conversion functions. */
int nullSize; /* Number of zero bytes that signify
Tcl_Size nullSize; /* Number of zero bytes that signify
* end-of-string in this encoding. This number
* is used to determine the source string
* length when the srcLen argument is
* negative. Must be 1 or 2. */
* negative. Must be 1, 2, or 4. */
} Tcl_EncodingType;
/*
@@ -1953,33 +1964,35 @@ typedef struct Tcl_EncodingType {
* content. Otherwise, the number of chars
* produced is controlled only by other limiting
* factors.
* TCL_ENCODING_MODIFIED - Convert NULL bytes to \xC0\x80 in stead of
* 0x00. Only valid for "utf-8" and "cesu-8".
* This flag is implicit for external -> internal conversions,
* optional for internal -> external conversions.
* TCL_ENCODING_NOCOMPLAIN - If set, the converter
* substitutes the problematic character(s) with
* one or more "close" characters in the
* destination buffer and then continues to
* convert the source. If clear, the converter returns
* immediately upon encountering an invalid byte sequence
* or a source character that has no mapping in the
* target encoding. Only for Tcl 9.x.
* TCL_ENCODING_PROFILE_* - Mutually exclusive encoding profile ids. Note
* these are bit masks.
*
* NOTE: THESE BIT DEFINITIONS SHOULD NOT OVERLAP WITH INTERNAL USE BITS
* DEFINED IN tclEncoding.c (ENCODING_INPUT et al). Be cognizant of this
* when adding bits.
*/
#define TCL_ENCODING_START 0x01
#define TCL_ENCODING_END 0x02
#if TCL_MAJOR_VERSION > 8
# define TCL_ENCODING_STRICT 0x04
# define TCL_ENCODING_STOPONERROR 0x0 /* Not used any more */
#else
# define TCL_ENCODING_STRICT 0x44
# define TCL_ENCODING_STOPONERROR 0x04
#endif
#define TCL_ENCODING_NO_TERMINATE 0x08
#define TCL_ENCODING_CHAR_LIMIT 0x10
#define TCL_ENCODING_MODIFIED 0x20
#define TCL_ENCODING_NOCOMPLAIN 0x40
/* Internal use bits, do not define bits in this space. See above comment */
#define TCL_ENCODING_INTERNAL_USE_MASK 0xFF00
/* Reserve top byte for profile values (disjoint, not a mask) */
#define TCL_ENCODING_PROFILE_TCL8 0x01000000
#define TCL_ENCODING_PROFILE_STRICT 0x02000000
#define TCL_ENCODING_PROFILE_REPLACE 0x03000000
/* Still being argued - For Tcl9, is the default strict? TODO */
#if TCL_MAJOR_VERSION < 9
#define TCL_ENCODING_PROFILE_DEFAULT TCL_ENCODING_PROFILE_TCL8
#else
#define TCL_ENCODING_PROFILE_DEFAULT TCL_ENCODING_PROFILE_TCL8 /* STRICT? REPLACE? TODO */
#endif
/*
* The following definitions are the error codes returned by the conversion
@@ -2000,13 +2013,10 @@ typedef struct Tcl_EncodingType {
* TCL_CONVERT_SYNTAX - The source stream contained an invalid
* character sequence. This may occur if the
* input stream has been damaged or if the input
* encoding method was misidentified. This error
* is reported unless if TCL_ENCODING_NOCOMPLAIN
* was specified.
* encoding method was misidentified.
* TCL_CONVERT_UNKNOWN - The source string contained a character that
* could not be represented in the target
* encoding. This error is reported unless if
* TCL_ENCODING_NOCOMPLAIN was specified.
* encoding.
*/
#define TCL_CONVERT_MULTIBYTE (-1)
@@ -2259,10 +2269,17 @@ void * TclStubCall(void *arg);
#ifdef USE_TCL_STUBS
#if TCL_MAJOR_VERSION < 9
# if TCL_UTF_MAX < 4
# define Tcl_InitStubs(interp, version, exact) \
(Tcl_InitStubs)(interp, version, \
(exact)|(TCL_MAJOR_VERSION<<8)|(0xFF<<16), \
TCL_STUB_MAGIC)
# else
# define Tcl_InitStubs(interp, version, exact) \
(Tcl_InitStubs)(interp, "8.7.0", \
(exact)|(TCL_MAJOR_VERSION<<8)|(0xFF<<16), \
TCL_STUB_MAGIC)
# endif
#elif TCL_RELEASE_LEVEL == TCL_FINAL_RELEASE
# define Tcl_InitStubs(interp, version, exact) \
(Tcl_InitStubs)(interp, version, \
@@ -2323,9 +2340,14 @@ EXTERN const char *TclZipfs_AppHook(int *argc, char ***argv);
# define Tcl_FindExecutable(arg) ((Tcl_FindExecutable)((const char *)(arg)))
#endif
# define Tcl_MainEx Tcl_MainExW
#if defined(TCL_SIGNED_SIZE) && !defined(BUILD_tcl)
EXTERN TCL_NORETURN void Tcl_MainExW(ptrdiff_t argc, wchar_t **argv,
Tcl_AppInitProc *appInitProc, Tcl_Interp *interp);
#else
EXTERN TCL_NORETURN void Tcl_MainExW(size_t argc, wchar_t **argv,
Tcl_AppInitProc *appInitProc, Tcl_Interp *interp);
#endif
#endif
#if defined(USE_TCL_STUBS) && (TCL_MAJOR_VERSION > 8)
#define Tcl_SetPanicProc(panicProc) \
TclInitStubTable(((const char *(*)(Tcl_PanicProc *))TclStubCall((void *)panicProc))(panicProc))
@@ -2386,9 +2408,9 @@ EXTERN const char *TclZipfs_AppHook(int *argc, char ***argv);
# define attemptckalloc Tcl_AttemptAlloc
# ifdef _MSC_VER
/* Silence invalid C4090 warnings */
# define ckfree(a) Tcl_Free((char *)(a))
# define ckrealloc(a,b) Tcl_Realloc((char *)(a),(b))
# define attemptckrealloc(a,b) Tcl_AttemptRealloc((char *)(a),(b))
# define ckfree(a) Tcl_Free((void *)(a))
# define ckrealloc(a,b) Tcl_Realloc((void *)(a),(b))
# define attemptckrealloc(a,b) Tcl_AttemptRealloc((void *)(a),(b))
# else
# define ckfree Tcl_Free
# define ckrealloc Tcl_Realloc
+2 -2
View File
@@ -251,7 +251,7 @@ TclFinalizeAllocSubsystem(void)
void *
TclpAlloc(
size_t numBytes) /* Number of bytes to allocate. */
TCL_HASH_TYPE numBytes) /* Number of bytes to allocate. */
{
union overhead *overPtr;
size_t bucket;
@@ -694,7 +694,7 @@ mstats(
#undef TclpAlloc
void *
TclpAlloc(
size_t numBytes) /* Number of bytes to allocate. */
TCL_HASH_TYPE numBytes) /* Number of bytes to allocate. */
{
return malloc(numBytes);
}
+138 -132
View File
@@ -29,7 +29,7 @@
#define ArithSeriesGetInternalRep(objPtr, arithRepPtr) \
do { \
const Tcl_ObjInternalRep *irPtr; \
irPtr = TclFetchInternalRep((objPtr), &tclArithSeriesType); \
irPtr = TclFetchInternalRep((objPtr), &tclArithSeriesType.objType); \
(arithRepPtr) = irPtr ? (ArithSeries *)irPtr->twoPtrValue.ptr1 : NULL; \
} while (0)
@@ -41,7 +41,9 @@
static void DupArithSeriesInternalRep (Tcl_Obj *srcPtr, Tcl_Obj *copyPtr);
static void FreeArithSeriesInternalRep (Tcl_Obj *listPtr);
static int SetArithSeriesFromAny (Tcl_Interp *interp, Tcl_Obj *objPtr);
static void UpdateStringOfArithSeries (Tcl_Obj *listPtr);
static void UpdateStringOfArithSeries (Tcl_Obj *arithSeriesObj);
static Tcl_Obj *ArithSeriesObjStep(Tcl_Obj *arithSeriesPtr);
static size_t ArithSeriesObjLength(Tcl_Obj *arithSeriesPtr);
/*
* The structure below defines the arithmetic series Tcl object type by
@@ -64,19 +66,21 @@ static void UpdateStringOfArithSeries (Tcl_Obj *listPtr);
* And where the equivalent's list I-th element is calculated
* as:
*
* LIST[i] = START+(STEP*i)
* LIST[i] = START + (STEP * i)
*
* Zero elements ranges, like in the case of START=10 END=10 STEP=1
* are valid and will be equivalent to the empty list.
*/
const Tcl_ObjType tclArithSeriesType = {
"arithseries", /* name */
const TclObjTypeWithAbstractList tclArithSeriesType = {
{"arithseries", /* name */
FreeArithSeriesInternalRep, /* freeIntRepProc */
DupArithSeriesInternalRep, /* dupIntRepProc */
UpdateStringOfArithSeries, /* updateStringProc */
SetArithSeriesFromAny, /* setFromAnyProc */
TCL_OBJTYPE_V0
TCL_OBJTYPE_V0_1(
ArithSeriesObjLength
)}
};
/*
@@ -117,7 +121,7 @@ ArithSeriesLen(Tcl_WideInt start, Tcl_WideInt end, Tcl_WideInt step)
/*
*----------------------------------------------------------------------
*
* TclNewArithSeriesInt --
* NewArithSeriesInt --
*
* Creates a new ArithSeries object. The returned object has
* refcount = 0.
@@ -132,17 +136,18 @@ ArithSeriesLen(Tcl_WideInt start, Tcl_WideInt end, Tcl_WideInt step)
* None.
*----------------------------------------------------------------------
*/
static
Tcl_Obj *
TclNewArithSeriesInt(Tcl_WideInt start, Tcl_WideInt end, Tcl_WideInt step, Tcl_WideInt len)
NewArithSeriesInt(Tcl_WideInt start, Tcl_WideInt end, Tcl_WideInt step, Tcl_WideInt len)
{
Tcl_WideInt length = (len>=0 ? len : ArithSeriesLen(start, end, step));
Tcl_Obj *arithSeriesPtr;
Tcl_Obj *arithSeriesObj;
ArithSeries *arithSeriesRepPtr;
TclNewObj(arithSeriesPtr);
TclNewObj(arithSeriesObj);
if (length <= 0) {
return arithSeriesPtr;
return arithSeriesObj;
}
arithSeriesRepPtr = (ArithSeries*) Tcl_Alloc(sizeof (ArithSeries));
@@ -152,19 +157,19 @@ TclNewArithSeriesInt(Tcl_WideInt start, Tcl_WideInt end, Tcl_WideInt step, Tcl_W
arithSeriesRepPtr->step = step;
arithSeriesRepPtr->len = length;
arithSeriesRepPtr->elements = NULL;
arithSeriesPtr->internalRep.twoPtrValue.ptr1 = arithSeriesRepPtr;
arithSeriesPtr->internalRep.twoPtrValue.ptr2 = NULL;
arithSeriesPtr->typePtr = &tclArithSeriesType;
arithSeriesObj->internalRep.twoPtrValue.ptr1 = arithSeriesRepPtr;
arithSeriesObj->internalRep.twoPtrValue.ptr2 = NULL;
arithSeriesObj->typePtr = &tclArithSeriesType.objType;
if (length > 0)
Tcl_InvalidateStringRep(arithSeriesPtr);
Tcl_InvalidateStringRep(arithSeriesObj);
return arithSeriesPtr;
return arithSeriesObj;
}
/*
*----------------------------------------------------------------------
*
* TclNewArithSeriesDbl --
* NewArithSeriesDbl --
*
* Creates a new ArithSeries object with doubles. The returned object has
* refcount = 0.
@@ -179,17 +184,18 @@ TclNewArithSeriesInt(Tcl_WideInt start, Tcl_WideInt end, Tcl_WideInt step, Tcl_W
* None.
*----------------------------------------------------------------------
*/
static
Tcl_Obj *
TclNewArithSeriesDbl(double start, double end, double step, Tcl_WideInt len)
NewArithSeriesDbl(double start, double end, double step, Tcl_WideInt len)
{
Tcl_WideInt length = (len>=0 ? len : ArithSeriesLen(start, end, step));
Tcl_Obj *arithSeriesPtr;
Tcl_Obj *arithSeriesObj;
ArithSeriesDbl *arithSeriesRepPtr;
TclNewObj(arithSeriesPtr);
TclNewObj(arithSeriesObj);
if (length <= 0) {
return arithSeriesPtr;
return arithSeriesObj;
}
arithSeriesRepPtr = (ArithSeriesDbl*) Tcl_Alloc(sizeof (ArithSeriesDbl));
@@ -199,13 +205,13 @@ TclNewArithSeriesDbl(double start, double end, double step, Tcl_WideInt len)
arithSeriesRepPtr->step = step;
arithSeriesRepPtr->len = length;
arithSeriesRepPtr->elements = NULL;
arithSeriesPtr->internalRep.twoPtrValue.ptr1 = arithSeriesRepPtr;
arithSeriesPtr->internalRep.twoPtrValue.ptr2 = NULL;
arithSeriesPtr->typePtr = &tclArithSeriesType;
arithSeriesObj->internalRep.twoPtrValue.ptr1 = arithSeriesRepPtr;
arithSeriesObj->internalRep.twoPtrValue.ptr2 = NULL;
arithSeriesObj->typePtr = &tclArithSeriesType.objType;
if (length > 0)
Tcl_InvalidateStringRep(arithSeriesPtr);
Tcl_InvalidateStringRep(arithSeriesObj);
return arithSeriesPtr;
return arithSeriesObj;
}
/*
@@ -228,7 +234,11 @@ TclNewArithSeriesDbl(double start, double end, double step, Tcl_WideInt len)
*----------------------------------------------------------------------
*/
static void
assignNumber(int useDoubles, Tcl_WideInt *intNumberPtr, double *dblNumberPtr, Tcl_Obj *numberObj)
assignNumber(
int useDoubles,
Tcl_WideInt *intNumberPtr,
double *dblNumberPtr,
Tcl_Obj *numberObj)
{
void *clientData;
int tcl_number_type;
@@ -271,6 +281,7 @@ assignNumber(int useDoubles, Tcl_WideInt *intNumberPtr, double *dblNumberPtr, Tc
* None.
*----------------------------------------------------------------------
*/
int
TclNewArithSeriesObj(
Tcl_Interp *interp, /* For error reporting */
@@ -346,15 +357,15 @@ TclNewArithSeriesObj(
if (TCL_MAJOR_VERSION < 9 && len > ListSizeT_MAX) {
Tcl_SetObjResult(
interp,
Tcl_NewStringObj("max length of a Tcl list exceeded", -1));
Tcl_NewStringObj("max length of a Tcl list exceeded", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL);
return TCL_ERROR;
}
if (arithSeriesObj) {
*arithSeriesObj = (useDoubles)
? TclNewArithSeriesDbl(dstart, dend, dstep, len)
: TclNewArithSeriesInt(start, end, step, len);
? NewArithSeriesDbl(dstart, dend, dstep, len)
: NewArithSeriesInt(start, end, step, len);
}
return TCL_OK;
}
@@ -362,7 +373,7 @@ TclNewArithSeriesObj(
/*
*----------------------------------------------------------------------
*
* TclArithSeriesObjStep --
* ArithSeriesObjStep --
*
* Return a Tcl_Obj with the step value from the give ArithSeries Obj.
* refcount = 0.
@@ -377,26 +388,23 @@ TclNewArithSeriesObj(
* None.
*----------------------------------------------------------------------
*/
/*
* TclArithSeriesObjStep --
*/
int
TclArithSeriesObjStep(
Tcl_Obj *arithSeriesPtr,
Tcl_Obj **stepObj)
Tcl_Obj *
ArithSeriesObjStep(
Tcl_Obj *arithSeriesObj)
{
ArithSeries *arithSeriesRepPtr;
Tcl_Obj *stepObj;
if (arithSeriesPtr->typePtr != &tclArithSeriesType) {
Tcl_Panic("TclArithSeriesObjIndex called with a not ArithSeries Obj.");
if (arithSeriesObj->typePtr != &tclArithSeriesType.objType) {
Tcl_Panic("ArithSeriesObjStep called with a not ArithSeries Obj.");
}
arithSeriesRepPtr = ArithSeriesRepPtr(arithSeriesPtr);
arithSeriesRepPtr = ArithSeriesRepPtr(arithSeriesObj);
if (arithSeriesRepPtr->isDouble) {
*stepObj = Tcl_NewDoubleObj(((ArithSeriesDbl*)(arithSeriesRepPtr))->step);
TclNewDoubleObj(stepObj, ((ArithSeriesDbl*)(arithSeriesRepPtr))->step);
} else {
*stepObj = Tcl_NewWideIntObj(arithSeriesRepPtr->step);
TclNewIntObj(stepObj, arithSeriesRepPtr->step);
}
return TCL_OK;
return stepObj;
}
@@ -407,13 +415,11 @@ TclArithSeriesObjStep(
*
* Returns the element with the specified index in the list
* represented by the specified Arithmetic Sequence object.
* If the index is out of range, TCL_ERROR is returned,
* otherwise TCL_OK is returned and the integer value of the
* element is stored in *element.
* If the index is out of range, NULL is returned.
*
* Results:
*
* TCL_OK on success, TCL_ERROR on index out of range.
* The element on success, NULL on index out of range.
*
* Side Effects:
*
@@ -422,31 +428,39 @@ TclArithSeriesObjStep(
*----------------------------------------------------------------------
*/
int
TclArithSeriesObjIndex(Tcl_Obj *arithSeriesPtr, Tcl_WideInt index, Tcl_Obj **elementObj)
Tcl_Obj *
TclArithSeriesObjIndex(
Tcl_Interp *interp,
Tcl_Obj *arithSeriesObj,
Tcl_WideInt index)
{
ArithSeries *arithSeriesRepPtr;
if (arithSeriesPtr->typePtr != &tclArithSeriesType) {
if (arithSeriesObj->typePtr != &tclArithSeriesType.objType) {
Tcl_Panic("TclArithSeriesObjIndex called with a not ArithSeries Obj.");
}
arithSeriesRepPtr = ArithSeriesRepPtr(arithSeriesPtr);
if (index < 0 || index >= arithSeriesRepPtr->len) {
return TCL_ERROR;
arithSeriesRepPtr = ArithSeriesRepPtr(arithSeriesObj);
if (index < 0 || (Tcl_Size)index >= arithSeriesRepPtr->len) {
if (interp) {
Tcl_SetObjResult(interp,
Tcl_ObjPrintf("index %" TCL_LL_MODIFIER "d is out of bounds 0 to %"
TCL_Z_MODIFIER "d", index, (arithSeriesRepPtr->len-1)));
Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL);
}
return NULL;
}
/* List[i] = Start + (Step * index) */
if (arithSeriesRepPtr->isDouble) {
*elementObj = Tcl_NewDoubleObj(ArithSeriesIndexM(arithSeriesRepPtr, index));
return Tcl_NewDoubleObj(ArithSeriesIndexM(arithSeriesRepPtr, index));
} else {
*elementObj = Tcl_NewWideIntObj(ArithSeriesIndexM(arithSeriesRepPtr, index));
return Tcl_NewWideIntObj(ArithSeriesIndexM(arithSeriesRepPtr, index));
}
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* TclArithSeriesObjLength
* ArithSeriesObjLength
*
* Returns the length of the arithmetic series.
*
@@ -460,10 +474,10 @@ TclArithSeriesObjIndex(Tcl_Obj *arithSeriesPtr, Tcl_WideInt index, Tcl_Obj **ele
*
*----------------------------------------------------------------------
*/
Tcl_WideInt TclArithSeriesObjLength(Tcl_Obj *arithSeriesPtr)
size_t ArithSeriesObjLength(Tcl_Obj *arithSeriesObj)
{
ArithSeries *arithSeriesRepPtr = (ArithSeries*)
arithSeriesPtr->internalRep.twoPtrValue.ptr1;
arithSeriesObj->internalRep.twoPtrValue.ptr1;
return arithSeriesRepPtr->len;
}
@@ -479,19 +493,19 @@ Tcl_WideInt TclArithSeriesObjLength(Tcl_Obj *arithSeriesPtr)
* None.
*
* Side effects:
* Frees arithSeriesPtr's ArithSeries* internal representation and
* Frees arithSeriesObj's ArithSeries* internal representation and
* sets listPtr's internalRep.twoPtrValue.ptr1 to NULL.
*
*----------------------------------------------------------------------
*/
static void
FreeArithSeriesInternalRep(Tcl_Obj *arithSeriesPtr)
FreeArithSeriesInternalRep(Tcl_Obj *arithSeriesObj)
{
ArithSeries *arithSeriesRepPtr =
(ArithSeries *) arithSeriesPtr->internalRep.twoPtrValue.ptr1;
(ArithSeries *) arithSeriesObj->internalRep.twoPtrValue.ptr1;
if (arithSeriesRepPtr->elements) {
Tcl_WideInt i;
Tcl_Size i;
Tcl_Obj**elmts = arithSeriesRepPtr->elements;
for(i=0; i<arithSeriesRepPtr->len; i++) {
if (elmts[i]) {
@@ -501,7 +515,7 @@ FreeArithSeriesInternalRep(Tcl_Obj *arithSeriesPtr)
Tcl_Free((char *) arithSeriesRepPtr->elements);
}
Tcl_Free((char *) arithSeriesRepPtr);
arithSeriesPtr->internalRep.twoPtrValue.ptr1 = NULL;
arithSeriesObj->internalRep.twoPtrValue.ptr1 = NULL;
}
/*
@@ -538,7 +552,7 @@ DupArithSeriesInternalRep(
copyArithSeriesRepPtr->elements = NULL;
copyPtr->internalRep.twoPtrValue.ptr1 = copyArithSeriesRepPtr;
copyPtr->internalRep.twoPtrValue.ptr2 = NULL;
copyPtr->typePtr = &tclArithSeriesType;
copyPtr->typePtr = &tclArithSeriesType.objType;
}
/*
@@ -570,22 +584,22 @@ DupArithSeriesInternalRep(
*/
static void
UpdateStringOfArithSeries(Tcl_Obj *arithSeriesPtr)
UpdateStringOfArithSeries(Tcl_Obj *arithSeriesObj)
{
ArithSeries *arithSeriesRepPtr =
(ArithSeries*) arithSeriesPtr->internalRep.twoPtrValue.ptr1;
(ArithSeries*) arithSeriesObj->internalRep.twoPtrValue.ptr1;
char *elem, *p;
Tcl_Obj *elemObj;
Tcl_WideInt i;
Tcl_Size i;
Tcl_WideInt length = 0;
int slen;
size_t slen;
/*
* Pass 1: estimate space.
*/
for (i = 0; i < arithSeriesRepPtr->len; i++) {
TclArithSeriesObjIndex(arithSeriesPtr, i, &elemObj);
elem = TclGetStringFromObj(elemObj, &slen);
elemObj = TclArithSeriesObjIndex(NULL, arithSeriesObj, i);
elem = Tcl_GetStringFromObj(elemObj, &slen);
Tcl_DecrRefCount(elemObj);
slen += 1; /* + 1 is for the space or the nul-term */
length += slen;
@@ -595,17 +609,17 @@ UpdateStringOfArithSeries(Tcl_Obj *arithSeriesPtr)
* Pass 2: generate the string repr.
*/
p = Tcl_InitStringRep(arithSeriesPtr, NULL, length);
p = Tcl_InitStringRep(arithSeriesObj, NULL, length);
for (i = 0; i < arithSeriesRepPtr->len; i++) {
TclArithSeriesObjIndex(arithSeriesPtr, i, &elemObj);
elem = TclGetStringFromObj(elemObj, &slen);
elemObj = TclArithSeriesObjIndex(NULL, arithSeriesObj, i);
elem = Tcl_GetStringFromObj(elemObj, &slen);
strcpy(p, elem);
p[slen] = ' ';
p += slen+1;
Tcl_DecrRefCount(elemObj);
}
if (length > 0) arithSeriesPtr->bytes[length-1] = '\0';
arithSeriesPtr->length = length-1;
if (length > 0) arithSeriesObj->bytes[length-1] = '\0';
arithSeriesObj->length = length-1;
}
/*
@@ -651,8 +665,8 @@ SetArithSeriesFromAny(
* Results:
*
* Normally returns a pointer to a new Tcl_Obj, that contains the same
* arithSeries value as *arithSeriesPtr does. The returned Tcl_Obj has a
* refCount of zero. If *arithSeriesPtr does not hold an arithSeries,
* arithSeries value as *arithSeriesObj does. The returned Tcl_Obj has a
* refCount of zero. If *arithSeriesObj does not hold an arithSeries,
* NULL is returned, and if interp is non-NULL, an error message is
* recorded there.
*
@@ -665,15 +679,15 @@ SetArithSeriesFromAny(
Tcl_Obj *
TclArithSeriesObjCopy(
Tcl_Interp *interp, /* Used to report errors if not NULL. */
Tcl_Obj *arithSeriesPtr) /* List object for which an element array is
Tcl_Obj *arithSeriesObj) /* List object for which an element array is
* to be returned. */
{
Tcl_Obj *copyPtr;
ArithSeries *arithSeriesRepPtr;
ArithSeriesGetInternalRep(arithSeriesPtr, arithSeriesRepPtr);
ArithSeriesGetInternalRep(arithSeriesObj, arithSeriesRepPtr);
if (NULL == arithSeriesRepPtr) {
if (SetArithSeriesFromAny(interp, arithSeriesPtr) != TCL_OK) {
if (SetArithSeriesFromAny(interp, arithSeriesObj) != TCL_OK) {
/* We know this is going to panic, but it's the message we want */
return NULL;
}
@@ -681,7 +695,7 @@ TclArithSeriesObjCopy(
TclNewObj(copyPtr);
TclInvalidateStringRep(copyPtr);
DupArithSeriesInternalRep(arithSeriesPtr, copyPtr);
DupArithSeriesInternalRep(arithSeriesObj, copyPtr);
return copyPtr;
}
@@ -691,7 +705,7 @@ TclArithSeriesObjCopy(
* TclArithSeriesObjRange --
*
* Makes a slice of an ArithSeries value.
* *arithSeriesPtr must be known to be a valid list.
* *arithSeriesObj must be known to be a valid list.
*
* Results:
* Returns a pointer to the sliced series.
@@ -707,16 +721,16 @@ TclArithSeriesObjCopy(
Tcl_Obj *
TclArithSeriesObjRange(
Tcl_Interp *interp, /* For error message(s) */
Tcl_Obj *arithSeriesPtr, /* List object to take a range from. */
Tcl_Obj *arithSeriesObj, /* List object to take a range from. */
Tcl_Size fromIdx, /* Index of first element to include. */
Tcl_Size toIdx) /* Index of last element to include. */
Tcl_Size toIdx) /* Index of last element to include. */
{
ArithSeries *arithSeriesRepPtr;
Tcl_Obj *startObj, *endObj, *stepObj;
ArithSeriesGetInternalRep(arithSeriesPtr, arithSeriesRepPtr);
ArithSeriesGetInternalRep(arithSeriesObj, arithSeriesRepPtr);
if (fromIdx == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(fromIdx)) {
fromIdx = 0;
}
if (fromIdx > toIdx) {
@@ -725,33 +739,21 @@ TclArithSeriesObjRange(
return obj;
}
if (TclArithSeriesObjIndex(arithSeriesPtr, fromIdx, &startObj) != TCL_OK) {
if (interp) {
Tcl_SetObjResult(
interp,
Tcl_ObjPrintf("index %" TCL_Z_MODIFIER "u is out of bounds 0 to %"
TCL_LL_MODIFIER "d", fromIdx, (arithSeriesRepPtr->len-1)));
Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL);
}
startObj = TclArithSeriesObjIndex(interp, arithSeriesObj, fromIdx);
if (startObj == NULL) {
return NULL;
}
Tcl_IncrRefCount(startObj);
if (TclArithSeriesObjIndex(arithSeriesPtr, toIdx, &endObj) != TCL_OK) {
if (interp) {
Tcl_SetObjResult(
interp,
Tcl_ObjPrintf("index %" TCL_Z_MODIFIER "u is out of bounds 0 to %"
TCL_LL_MODIFIER "d", fromIdx, (arithSeriesRepPtr->len-1)));
Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL);
}
endObj = TclArithSeriesObjIndex(interp, arithSeriesObj, toIdx);
if (endObj == NULL) {
return NULL;
}
Tcl_IncrRefCount(endObj);
TclArithSeriesObjStep(arithSeriesPtr, &stepObj);
stepObj = ArithSeriesObjStep(arithSeriesObj);
Tcl_IncrRefCount(stepObj);
if (Tcl_IsShared(arithSeriesPtr) ||
((arithSeriesPtr->refCount > 1))) {
if (Tcl_IsShared(arithSeriesObj) ||
((arithSeriesObj->refCount > 1))) {
Tcl_Obj *newSlicePtr;
if (TclNewArithSeriesObj(interp, &newSlicePtr,
arithSeriesRepPtr->isDouble, startObj, endObj,
@@ -773,10 +775,10 @@ TclArithSeriesObjRange(
* string-canonizing effect of [lrange 0 end].
*/
TclInvalidateStringRep(arithSeriesPtr);
TclInvalidateStringRep(arithSeriesObj);
if (arithSeriesRepPtr->isDouble) {
ArithSeriesDbl *arithSeriesDblRepPtr = (ArithSeriesDbl*)arithSeriesPtr;
ArithSeriesDbl *arithSeriesDblRepPtr = (ArithSeriesDbl*)arithSeriesObj;
double start, end, step;
Tcl_GetDoubleFromObj(NULL, startObj, &start);
Tcl_GetDoubleFromObj(NULL, endObj, &end);
@@ -803,7 +805,7 @@ TclArithSeriesObjRange(
Tcl_DecrRefCount(endObj);
Tcl_DecrRefCount(stepObj);
return arithSeriesPtr;
return arithSeriesObj;
}
/*
@@ -838,14 +840,14 @@ TclArithSeriesObjRange(
int
TclArithSeriesGetElements(
Tcl_Interp *interp, /* Used to report errors if not NULL. */
Tcl_Obj *objPtr, /* AbstractList object for which an element
Tcl_Obj *objPtr, /* ArithSeries object for which an element
* array is to be returned. */
Tcl_Size *objcPtr, /* Where to store the count of objects
* referenced by objv. */
Tcl_Obj ***objvPtr) /* Where to store the pointer to an array of
* pointers to the list's objects. */
{
if (TclHasInternalRep(objPtr,&tclArithSeriesType)) {
if (TclHasInternalRep(objPtr,&tclArithSeriesType.objType)) {
ArithSeries *arithSeriesRepPtr;
Tcl_Obj **objv;
int i, objc;
@@ -863,20 +865,15 @@ TclArithSeriesGetElements(
if (interp) {
Tcl_SetObjResult(
interp,
Tcl_NewStringObj("max length of a Tcl list exceeded", -1));
Tcl_NewStringObj("max length of a Tcl list exceeded", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL);
}
return TCL_ERROR;
}
arithSeriesRepPtr->elements = objv;
for (i = 0; i < objc; i++) {
if (TclArithSeriesObjIndex(objPtr, i, &objv[i]) != TCL_OK) {
if (interp) {
Tcl_SetObjResult(
interp,
Tcl_NewStringObj("indexing error", -1));
Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL);
}
objv[i] = TclArithSeriesObjIndex(interp, objPtr, i);
if (objv[i] == NULL) {
return TCL_ERROR;
}
Tcl_IncrRefCount(objv[i]);
@@ -905,7 +902,7 @@ TclArithSeriesGetElements(
* TclArithSeriesObjReverse --
*
* Reverse the order of the ArithSeries value.
* *arithSeriesPtr must be known to be a valid list.
* *arithSeriesObj must be known to be a valid list.
*
* Results:
* Returns a pointer to the reordered series.
@@ -921,7 +918,7 @@ TclArithSeriesGetElements(
Tcl_Obj *
TclArithSeriesObjReverse(
Tcl_Interp *interp, /* For error message(s) */
Tcl_Obj *arithSeriesPtr) /* List object to reverse. */
Tcl_Obj *arithSeriesObj) /* List object to reverse. */
{
ArithSeries *arithSeriesRepPtr;
Tcl_Obj *startObj, *endObj, *stepObj;
@@ -930,16 +927,16 @@ TclArithSeriesObjReverse(
double dstart, dend, dstep;
int isDouble;
ArithSeriesGetInternalRep(arithSeriesPtr, arithSeriesRepPtr);
ArithSeriesGetInternalRep(arithSeriesObj, arithSeriesRepPtr);
isDouble = arithSeriesRepPtr->isDouble;
len = arithSeriesRepPtr->len;
TclArithSeriesObjIndex(arithSeriesPtr, (len-1), &startObj);
startObj = TclArithSeriesObjIndex(NULL, arithSeriesObj, (len-1));
Tcl_IncrRefCount(startObj);
TclArithSeriesObjIndex(arithSeriesPtr, 0, &endObj);
endObj = TclArithSeriesObjIndex(NULL, arithSeriesObj, 0);
Tcl_IncrRefCount(endObj);
TclArithSeriesObjStep(arithSeriesPtr, &stepObj);
stepObj = ArithSeriesObjStep(arithSeriesObj);
Tcl_IncrRefCount(stepObj);
if (isDouble) {
@@ -956,9 +953,10 @@ TclArithSeriesObjReverse(
TclSetIntObj(stepObj, step);
}
if (Tcl_IsShared(arithSeriesPtr) ||
((arithSeriesPtr->refCount > 1))) {
Tcl_Obj *lenObj = Tcl_NewWideIntObj(len);
if (Tcl_IsShared(arithSeriesObj) ||
((arithSeriesObj->refCount > 1))) {
Tcl_Obj *lenObj;
TclNewIntObj(lenObj, len);
if (TclNewArithSeriesObj(interp, &resultObj,
isDouble, startObj, endObj, stepObj, lenObj) != TCL_OK) {
resultObj = NULL;
@@ -970,7 +968,7 @@ TclArithSeriesObjReverse(
* In-place is possible.
*/
TclInvalidateStringRep(arithSeriesPtr);
TclInvalidateStringRep(arithSeriesObj);
if (isDouble) {
ArithSeriesDbl *arithSeriesDblRepPtr =
@@ -992,7 +990,7 @@ TclArithSeriesObjReverse(
}
arithSeriesRepPtr->elements = NULL;
resultObj = arithSeriesPtr;
resultObj = arithSeriesObj;
}
Tcl_DecrRefCount(startObj);
@@ -1001,3 +999,11 @@ TclArithSeriesObjReverse(
return resultObj;
}
/*
* Local Variables:
* mode: c
* c-basic-offset: 4
* fill-column: 78
* End:
*/
+17 -17
View File
@@ -15,43 +15,43 @@
* Note that the len can in theory be always computed by start,end,step
* but it's faster to cache it inside the internal representation.
*/
typedef struct ArithSeries {
typedef struct {
Tcl_Size len;
Tcl_Obj **elements;
int isDouble;
Tcl_WideInt start;
Tcl_WideInt end;
Tcl_WideInt step;
Tcl_WideInt len;
} ArithSeries;
typedef struct {
Tcl_Size len;
Tcl_Obj **elements;
int isDouble;
} ArithSeries;
typedef struct ArithSeriesDbl {
double start;
double end;
double step;
Tcl_WideInt len;
Tcl_Obj **elements;
int isDouble;
} ArithSeriesDbl;
MODULE_SCOPE Tcl_Obj * TclArithSeriesObjCopy(Tcl_Interp *interp,
Tcl_Obj *arithSeriesPtr);
MODULE_SCOPE int TclArithSeriesObjStep(Tcl_Obj *arithSeriesPtr,
Tcl_Obj **stepObj);
MODULE_SCOPE int TclArithSeriesObjIndex(Tcl_Obj *arithSeriesPtr,
Tcl_WideInt index, Tcl_Obj **elementObj);
MODULE_SCOPE Tcl_WideInt TclArithSeriesObjLength(Tcl_Obj *arithSeriesPtr);
MODULE_SCOPE Tcl_Obj *TclArithSeriesObjIndex(Tcl_Interp *, Tcl_Obj *,
Tcl_WideInt index);
MODULE_SCOPE Tcl_Obj * TclArithSeriesObjRange(Tcl_Interp *interp,
Tcl_Obj *arithSeriesPtr, Tcl_Size fromIdx, Tcl_Size toIdx);
MODULE_SCOPE Tcl_Obj * TclArithSeriesObjReverse(Tcl_Interp *interp,
Tcl_Obj *arithSeriesPtr);
MODULE_SCOPE int TclArithSeriesGetElements(Tcl_Interp *interp,
Tcl_Obj *objPtr, Tcl_Size *objcPtr, Tcl_Obj ***objvPtr);
MODULE_SCOPE Tcl_Obj * TclNewArithSeriesInt(Tcl_WideInt start,
Tcl_WideInt end, Tcl_WideInt step,
Tcl_WideInt len);
MODULE_SCOPE Tcl_Obj * TclNewArithSeriesDbl(double start, double end,
double step, Tcl_WideInt len);
MODULE_SCOPE int TclNewArithSeriesObj(Tcl_Interp *interp,
Tcl_Obj **arithSeriesObj, int useDoubles,
Tcl_Obj *startObj, Tcl_Obj *endObj,
Tcl_Obj *stepObj, Tcl_Obj *lenObj);
/*
* Local Variables:
* mode: c
* c-basic-offset: 4
* fill-column: 78
* End:
*/
+28 -25
View File
@@ -1367,7 +1367,7 @@ AssembleOneLine(
goto cleanup;
}
localVar = FindLocalVar(assemEnvPtr, &tokenPtr);
if (localVar == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(localVar)) {
goto cleanup;
}
BBEmitInstInt1(assemEnvPtr, tblIdx, opnd, 0);
@@ -1384,7 +1384,7 @@ AssembleOneLine(
}
if (opnd < 0 || opnd > 3) {
Tcl_SetObjResult(interp,
Tcl_NewStringObj("operand must be [0..3]", -1));
Tcl_NewStringObj("operand must be [0..3]", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "OPERAND<0,>3", NULL);
goto cleanup;
}
@@ -1427,7 +1427,7 @@ AssembleOneLine(
goto cleanup;
}
localVar = FindLocalVar(assemEnvPtr, &tokenPtr);
if (localVar == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(localVar)) {
goto cleanup;
}
BBEmitInstInt4(assemEnvPtr, tblIdx, opnd, opnd+1);
@@ -1444,7 +1444,7 @@ AssembleOneLine(
goto cleanup;
}
localVar = FindLocalVar(assemEnvPtr, &tokenPtr);
if (localVar == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(localVar)) {
goto cleanup;
}
BBEmitInstInt4(assemEnvPtr, tblIdx, opnd, opnd);
@@ -1625,7 +1625,7 @@ AssembleOneLine(
if (opnd < 2) {
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
Tcl_SetObjResult(interp,
Tcl_NewStringObj("operand must be >=2", -1));
Tcl_NewStringObj("operand must be >=2", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "OPERAND>=2", NULL);
}
goto cleanup;
@@ -1639,7 +1639,7 @@ AssembleOneLine(
goto cleanup;
}
localVar = FindLocalVar(assemEnvPtr, &tokenPtr);
if (localVar == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(localVar)) {
goto cleanup;
}
BBEmitInst1or4(assemEnvPtr, tblIdx, localVar, 0);
@@ -1651,7 +1651,7 @@ AssembleOneLine(
goto cleanup;
}
localVar = FindLocalVar(assemEnvPtr, &tokenPtr);
if (localVar == TCL_INDEX_NONE || CheckOneByte(interp, localVar)) {
if (TCL_SIZE_ISNEG(localVar) || CheckOneByte(interp, localVar)) {
goto cleanup;
}
BBEmitInstInt1(assemEnvPtr, tblIdx, localVar, 0);
@@ -1663,7 +1663,7 @@ AssembleOneLine(
goto cleanup;
}
localVar = FindLocalVar(assemEnvPtr, &tokenPtr);
if (localVar == TCL_INDEX_NONE || CheckOneByte(interp, localVar)
if (TCL_SIZE_ISNEG(localVar) || CheckOneByte(interp, localVar)
|| GetIntegerOperand(assemEnvPtr, &tokenPtr, &opnd) != TCL_OK
|| CheckSignedOneByte(interp, opnd)) {
goto cleanup;
@@ -1678,7 +1678,7 @@ AssembleOneLine(
goto cleanup;
}
localVar = FindLocalVar(assemEnvPtr, &tokenPtr);
if (localVar == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(localVar)) {
goto cleanup;
}
BBEmitInstInt4(assemEnvPtr, tblIdx, localVar, 0);
@@ -1742,7 +1742,7 @@ AssembleOneLine(
goto cleanup;
}
localVar = FindLocalVar(assemEnvPtr, &tokenPtr);
if (localVar == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(localVar)) {
goto cleanup;
}
BBEmitInstInt4(assemEnvPtr, tblIdx, opnd, 0);
@@ -1984,7 +1984,7 @@ CreateMirrorJumpTable(
* table. */
size_t i;
if (TclListObjGetElementsM(interp, jumps, &objc, &objv) != TCL_OK) {
if (TclListObjLengthM(interp, jumps, &objc) != TCL_OK) {
return TCL_ERROR;
}
if (objc % 2 != 0) {
@@ -1996,6 +1996,9 @@ CreateMirrorJumpTable(
}
return TCL_ERROR;
}
if (TclListObjGetElementsM(interp, jumps, &objc, &objv) != TCL_OK) {
return TCL_ERROR;
}
/*
* Allocate the jumptable.
@@ -2104,7 +2107,7 @@ GetNextOperand(
Tcl_DecrRefCount(operandObj);
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"assembly code may not contain substitutions", -1));
"assembly code may not contain substitutions", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "NOSUBST", NULL);
}
return TCL_ERROR;
@@ -2323,11 +2326,11 @@ FindLocalVar(
}
localVar = TclFindCompiledLocal(varNameStr, varNameLen, 1, envPtr);
Tcl_DecrRefCount(varNameObj);
if (localVar == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(localVar)) {
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"cannot use this instruction to create a variable"
" in a non-proc context", -1));
" in a non-proc context", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "LVT", NULL);
}
return TCL_INDEX_NONE;
@@ -2397,7 +2400,7 @@ CheckOneByte(
Tcl_Obj* result; /* Error message */
if (value < 0 || value > 0xFF) {
result = Tcl_NewStringObj("operand does not fit in one byte", -1);
result = Tcl_NewStringObj("operand does not fit in one byte", TCL_INDEX_NONE);
Tcl_SetObjResult(interp, result);
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "1BYTE", NULL);
return TCL_ERROR;
@@ -2432,7 +2435,7 @@ CheckSignedOneByte(
Tcl_Obj* result; /* Error message */
if (value > 0x7F || value < -0x80) {
result = Tcl_NewStringObj("operand does not fit in one byte", -1);
result = Tcl_NewStringObj("operand does not fit in one byte", TCL_INDEX_NONE);
Tcl_SetObjResult(interp, result);
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "1BYTE", NULL);
return TCL_ERROR;
@@ -2465,7 +2468,7 @@ CheckNonNegative(
Tcl_Obj* result; /* Error message */
if (value < 0) {
result = Tcl_NewStringObj("operand must be nonnegative", -1);
result = Tcl_NewStringObj("operand must be nonnegative", TCL_INDEX_NONE);
Tcl_SetObjResult(interp, result);
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "NONNEGATIVE", NULL);
return TCL_ERROR;
@@ -2498,7 +2501,7 @@ CheckStrictlyPositive(
Tcl_Obj* result; /* Error message */
if (value <= 0) {
result = Tcl_NewStringObj("operand must be positive", -1);
result = Tcl_NewStringObj("operand must be positive", TCL_INDEX_NONE);
Tcl_SetObjResult(interp, result);
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "POSITIVE", NULL);
return TCL_ERROR;
@@ -3411,7 +3414,7 @@ StackCheckBasicBlock(
}
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"inconsistent stack depths on two execution paths", -1));
"inconsistent stack depths on two execution paths", TCL_INDEX_NONE));
/*
* TODO - add execution trace of both paths
@@ -3440,7 +3443,7 @@ StackCheckBasicBlock(
if (initialStackDepth + blockPtr->minStackDepth < 0) {
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
Tcl_SetObjResult(interp, Tcl_NewStringObj("stack underflow", -1));
Tcl_SetObjResult(interp, Tcl_NewStringObj("stack underflow", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "BADSTACK", NULL);
AddBasicBlockRangeToErrorInfo(assemEnvPtr, blockPtr);
Tcl_SetErrorLine(interp, blockPtr->startLine);
@@ -3459,8 +3462,8 @@ StackCheckBasicBlock(
+ blockPtr->enclosingCatch->finalStackDepth)) {
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"code pops stack below level of enclosing catch", -1));
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "BADSTACKINCATCH", -1);
"code pops stack below level of enclosing catch", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "BADSTACKINCATCH", TCL_INDEX_NONE);
AddBasicBlockRangeToErrorInfo(assemEnvPtr, blockPtr);
Tcl_SetErrorLine(interp, blockPtr->startLine);
}
@@ -3731,7 +3734,7 @@ ProcessCatchesInBasicBlock(
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"execution reaches an instruction in inconsistent "
"exception contexts", -1));
"exception contexts", TCL_INDEX_NONE));
Tcl_SetErrorLine(interp, bbPtr->startLine);
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "BADCATCH", NULL);
}
@@ -3790,7 +3793,7 @@ ProcessCatchesInBasicBlock(
if (enclosing == NULL) {
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"endCatch without a corresponding beginCatch", -1));
"endCatch without a corresponding beginCatch", TCL_INDEX_NONE));
Tcl_SetErrorLine(interp, bbPtr->startLine);
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "BADENDCATCH", NULL);
}
@@ -3865,7 +3868,7 @@ CheckForUnclosedCatches(
if (assemEnvPtr->curr_bb->catchState >= BBCS_INCATCH) {
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"catch still active on exit from assembly code", -1));
"catch still active on exit from assembly code", TCL_INDEX_NONE));
Tcl_SetErrorLine(interp,
assemEnvPtr->curr_bb->enclosingCatch->startLine);
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "UNCLOSEDCATCH", NULL);
+82 -79
View File
@@ -613,7 +613,7 @@ static int
buildInfoObjCmd2(
void *clientData,
Tcl_Interp *interp, /* Current interpreter. */
size_t objc, /* Number of arguments. */
Tcl_Size objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
if (objc - 1 > 1) {
@@ -621,8 +621,8 @@ buildInfoObjCmd2(
return TCL_ERROR;
}
if (objc == 2) {
int len;
const char *arg = TclGetStringFromObj(objv[1], &len);
size_t len;
const char *arg = Tcl_GetStringFromObj(objv[1], &len);
if (len == 7 && !strcmp(arg, "version")) {
char buf[80];
const char *p = strchr((char *)clientData, '.');
@@ -1499,7 +1499,7 @@ Tcl_CallWhenDeleted(
AssocData *dPtr = (AssocData *)Tcl_Alloc(sizeof(AssocData));
Tcl_HashEntry *hPtr;
sprintf(buffer, "Assoc Data Key #%d", *assocDataCounterPtr);
snprintf(buffer, sizeof(buffer), "Assoc Data Key #%d", *assocDataCounterPtr);
(*assocDataCounterPtr)++;
if (iPtr->assocData == NULL) {
@@ -2152,7 +2152,7 @@ Tcl_HideCommand(
if (strstr(hiddenCmdToken, "::") != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"cannot use namespace qualifiers in hidden command"
" token (rename)", -1));
" token (rename)", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "HIDDENTOKEN", NULL);
return TCL_ERROR;
}
@@ -3188,11 +3188,11 @@ TclRenameCommand(
*/
Tcl_DStringInit(&newFullName);
Tcl_DStringAppend(&newFullName, newNsPtr->fullName, -1);
Tcl_DStringAppend(&newFullName, newNsPtr->fullName, TCL_INDEX_NONE);
if (newNsPtr != iPtr->globalNsPtr) {
TclDStringAppendLiteral(&newFullName, "::");
}
Tcl_DStringAppend(&newFullName, newTail, -1);
Tcl_DStringAppend(&newFullName, newTail, TCL_INDEX_NONE);
cmdPtr->refCount++;
CallCommandTraces(iPtr, cmdPtr, TclGetString(oldFullName),
Tcl_DStringValue(&newFullName), TCL_TRACE_RENAME);
@@ -3291,7 +3291,7 @@ static int
invokeObj2Command(
void *clientData, /* Points to command's Command structure. */
Tcl_Interp *interp, /* Current interpreter. */
size_t objc, /* Number of arguments. */
Tcl_Size objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
int result;
@@ -3311,7 +3311,7 @@ invokeObj2Command(
static int cmdWrapper2Proc(void *clientData,
Tcl_Interp *interp,
size_t objc,
Tcl_Size objc,
Tcl_Obj *const objv[])
{
Command *cmdPtr = (Command *)clientData;
@@ -3553,14 +3553,14 @@ Tcl_GetCommandFullName(
if ((cmdPtr != NULL) && TclRoutineHasName(cmdPtr)) {
if (cmdPtr->nsPtr != NULL) {
Tcl_AppendToObj(objPtr, cmdPtr->nsPtr->fullName, -1);
Tcl_AppendToObj(objPtr, cmdPtr->nsPtr->fullName, TCL_INDEX_NONE);
if (cmdPtr->nsPtr != iPtr->globalNsPtr) {
Tcl_AppendToObj(objPtr, "::", 2);
}
}
if (cmdPtr->hPtr != NULL) {
name = (char *)Tcl_GetHashKey(cmdPtr->hPtr->tablePtr, cmdPtr->hPtr);
Tcl_AppendToObj(objPtr, name, -1);
Tcl_AppendToObj(objPtr, name, TCL_INDEX_NONE);
}
}
}
@@ -4061,7 +4061,7 @@ TclInterpReady(
if (iPtr->flags & DELETED) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"attempt to call eval in deleted interpreter", -1));
"attempt to call eval in deleted interpreter", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "IDELETE",
"attempt to call eval in deleted interpreter", NULL);
return TCL_ERROR;
@@ -4090,7 +4090,7 @@ TclInterpReady(
}
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"too many nested evaluations (infinite loop?)", -1));
"too many nested evaluations (infinite loop?)", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "LIMIT", "STACK", NULL);
return TCL_ERROR;
}
@@ -4224,7 +4224,7 @@ Tcl_Canceled(
}
}
Tcl_SetObjResult(interp, Tcl_NewStringObj(message, -1));
Tcl_SetObjResult(interp, Tcl_NewStringObj(message, TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "CANCEL", id, message, NULL);
}
@@ -4370,7 +4370,7 @@ int
Tcl_EvalObjv(
Tcl_Interp *interp, /* Interpreter in which to evaluate the
* command. Also used for error reporting. */
size_t objc, /* Number of words in command. */
Tcl_Size objc, /* Number of words in command. */
Tcl_Obj *const objv[], /* An array of pointers to objects that are
* the words that make up the command. */
int flags) /* Collection of OR-ed bits that control the
@@ -4389,7 +4389,7 @@ int
TclNREvalObjv(
Tcl_Interp *interp, /* Interpreter in which to evaluate the
* command. Also used for error reporting. */
size_t objc, /* Number of words in command. */
Tcl_Size objc, /* Number of words in command. */
Tcl_Obj *const objv[], /* An array of pointers to objects that are
* the words that make up the command. */
int flags, /* Collection of OR-ed bits that control the
@@ -5089,7 +5089,7 @@ Tcl_EvalTokensStandard(
* errors. */
Tcl_Token *tokenPtr, /* Pointer to first in an array of tokens to
* evaluate and concatenate. */
size_t count) /* Number of tokens to consider at tokenPtr.
Tcl_Size count) /* Number of tokens to consider at tokenPtr.
* Must be at least 1. */
{
return TclSubstTokens(interp, tokenPtr, count, /* numLeftPtr */ NULL, 1,
@@ -5122,7 +5122,7 @@ Tcl_EvalEx(
Tcl_Interp *interp, /* Interpreter in which to evaluate the
* script. Also used for error reporting. */
const char *script, /* First character of script to evaluate. */
size_t numBytes, /* Number of bytes in script. If -1, the
Tcl_Size numBytes, /* Number of bytes in script. If TCL_INDEX_NONE, the
* script consists of all bytes up to the
* first null character. */
int flags) /* Collection of OR-ed bits that control the
@@ -5137,7 +5137,7 @@ TclEvalEx(
Tcl_Interp *interp, /* Interpreter in which to evaluate the
* script. Also used for error reporting. */
const char *script, /* First character of script to evaluate. */
size_t numBytes, /* Number of bytes in script. If -1, the
size_t numBytes, /* Number of bytes in script. If TCL_INDEX_NONE, the
* script consists of all bytes up to the
* first NUL character. */
int flags, /* Collection of OR-ed bits that control the
@@ -5203,7 +5203,7 @@ TclEvalEx(
}
}
if (numBytes == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(numBytes)) {
numBytes = strlen(script);
}
Tcl_ResetResult(interp);
@@ -5852,7 +5852,7 @@ TclArgumentBCEnter(
* housekeeping, and can escape now.
*/
if (ePtr->nline != (size_t)objc) {
if (ePtr->nline != (Tcl_Size)objc) {
return;
}
@@ -6361,15 +6361,15 @@ ProcessUnexpectedResult(
Tcl_ResetResult(interp);
if (returnCode == TCL_BREAK) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"invoked \"break\" outside of a loop", -1));
"invoked \"break\" outside of a loop", TCL_INDEX_NONE));
} else if (returnCode == TCL_CONTINUE) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"invoked \"continue\" outside of a loop", -1));
"invoked \"continue\" outside of a loop", TCL_INDEX_NONE));
} else {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"command returned bad code: %d", returnCode));
}
sprintf(buf, "%d", returnCode);
snprintf(buf, sizeof(buf), "%d", returnCode);
Tcl_SetErrorCode(interp, "TCL", "UNEXPECTED_RESULT_CODE", buf, NULL);
}
@@ -6410,7 +6410,7 @@ Tcl_ExprLong(
*ptr = 0;
} else {
exprPtr = Tcl_NewStringObj(exprstring, -1);
exprPtr = Tcl_NewStringObj(exprstring, TCL_INDEX_NONE);
Tcl_IncrRefCount(exprPtr);
result = Tcl_ExprLongObj(interp, exprPtr, ptr);
Tcl_DecrRefCount(exprPtr);
@@ -6435,7 +6435,7 @@ Tcl_ExprDouble(
*ptr = 0.0;
} else {
exprPtr = Tcl_NewStringObj(exprstring, -1);
exprPtr = Tcl_NewStringObj(exprstring, TCL_INDEX_NONE);
Tcl_IncrRefCount(exprPtr);
result = Tcl_ExprDoubleObj(interp, exprPtr, ptr);
Tcl_DecrRefCount(exprPtr);
@@ -6460,7 +6460,7 @@ Tcl_ExprBoolean(
return TCL_OK;
} else {
int result;
Tcl_Obj *exprPtr = Tcl_NewStringObj(exprstring, -1);
Tcl_Obj *exprPtr = Tcl_NewStringObj(exprstring, TCL_INDEX_NONE);
Tcl_IncrRefCount(exprPtr);
result = Tcl_ExprBooleanObj(interp, exprPtr, ptr);
@@ -6673,7 +6673,7 @@ TclObjInvoke(
}
if ((objc < 1) || (objv == NULL)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"illegal argument vector", -1));
"illegal argument vector", TCL_INDEX_NONE));
return TCL_ERROR;
}
if ((flags & TCL_INVOKE_HIDDEN) == 0) {
@@ -6772,7 +6772,7 @@ Tcl_ExprString(
Tcl_SetObjResult(interp, Tcl_NewWideIntObj(0));
} else {
Tcl_Obj *resultPtr, *exprObj = Tcl_NewStringObj(expr, -1);
Tcl_Obj *resultPtr, *exprObj = Tcl_NewStringObj(expr, TCL_INDEX_NONE);
Tcl_IncrRefCount(exprObj);
code = Tcl_ExprObj(interp, exprObj, &resultPtr);
@@ -6886,10 +6886,10 @@ Tcl_VarEval(
if (string == NULL) {
break;
}
Tcl_DStringAppend(&buf, string, -1);
Tcl_DStringAppend(&buf, string, TCL_INDEX_NONE);
}
result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, 0);
result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), TCL_INDEX_NONE, 0);
Tcl_DStringFree(&buf);
return result;
}
@@ -6911,14 +6911,14 @@ Tcl_VarEval(
*----------------------------------------------------------------------
*/
size_t
Tcl_Size
Tcl_SetRecursionLimit(
Tcl_Interp *interp, /* Interpreter whose nesting limit is to be
* set. */
size_t depth) /* New value for maximimum depth. */
Tcl_Size depth) /* New value for maximimum depth. */
{
Interp *iPtr = (Interp *) interp;
size_t old;
Tcl_Size old;
old = iPtr->maxNestingDepth;
if (depth + 1 > 1) {
@@ -7031,7 +7031,7 @@ ExprCeilFunc(
code = Tcl_GetDoubleFromObj(interp, objv[1], &d);
#ifdef ACCEPT_NAN
if (code != TCL_OK) {
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objv[1], &tclDoubleType);
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objv[1], &tclDoubleType.objType);
if (irPtr) {
Tcl_SetObjResult(interp, objv[1]);
@@ -7071,7 +7071,7 @@ ExprFloorFunc(
code = Tcl_GetDoubleFromObj(interp, objv[1], &d);
#ifdef ACCEPT_NAN
if (code != TCL_OK) {
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objv[1], &tclDoubleType);
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objv[1], &tclDoubleType.objType);
if (irPtr) {
Tcl_SetObjResult(interp, objv[1]);
@@ -7192,7 +7192,7 @@ ExprIsqrtFunc(
negarg:
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"square root of negative argument", -1));
"square root of negative argument", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "ARITH", "DOMAIN",
"domain error: argument not in valid range", NULL);
return TCL_ERROR;
@@ -7217,7 +7217,7 @@ ExprSqrtFunc(
code = Tcl_GetDoubleFromObj(interp, objv[1], &d);
#ifdef ACCEPT_NAN
if (code != TCL_OK) {
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objv[1], &tclDoubleType);
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objv[1], &tclDoubleType.objType);
if (irPtr) {
Tcl_SetObjResult(interp, objv[1]);
@@ -7271,7 +7271,7 @@ ExprUnaryFunc(
code = Tcl_GetDoubleFromObj(interp, objv[1], &d);
#ifdef ACCEPT_NAN
if (code != TCL_OK) {
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objv[1], &tclDoubleType);
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objv[1], &tclDoubleType.objType);
if (irPtr) {
d = irPtr->doubleValue;
@@ -7335,7 +7335,7 @@ ExprBinaryFunc(
code = Tcl_GetDoubleFromObj(interp, objv[1], &d1);
#ifdef ACCEPT_NAN
if (code != TCL_OK) {
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objv[1], &tclDoubleType);
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objv[1], &tclDoubleType.objType);
if (irPtr) {
d1 = irPtr->doubleValue;
@@ -7350,7 +7350,7 @@ ExprBinaryFunc(
code = Tcl_GetDoubleFromObj(interp, objv[2], &d2);
#ifdef ACCEPT_NAN
if (code != TCL_OK) {
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objv[1], &tclDoubleType);
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objv[1], &tclDoubleType.objType);
if (irPtr) {
d2 = irPtr->doubleValue;
@@ -7511,7 +7511,7 @@ ExprDoubleFunc(
}
if (Tcl_GetDoubleFromObj(interp, objv[1], &dResult) != TCL_OK) {
#ifdef ACCEPT_NAN
if (TclHasInternalRep(objv[1], &tclDoubleType)) {
if (TclHasInternalRep(objv[1], &tclDoubleType.objType)) {
Tcl_SetObjResult(interp, objv[1]);
return TCL_OK;
}
@@ -8474,7 +8474,7 @@ Tcl_NRCallObjProc(
Tcl_Interp *interp,
Tcl_ObjCmdProc *objProc,
void *clientData,
size_t objc,
Tcl_Size objc,
Tcl_Obj *const objv[])
{
NRE_callback *rootPtr = TOP_CB(interp);
@@ -8657,7 +8657,7 @@ int
Tcl_NREvalObjv(
Tcl_Interp *interp, /* Interpreter in which to evaluate the
* command. Also used for error reporting. */
size_t objc, /* Number of words in command. */
Tcl_Size objc, /* Number of words in command. */
Tcl_Obj *const objv[], /* An array of pointers to objects that are
* the words that make up the command. */
int flags) /* Collection of OR-ed bits that control the
@@ -8672,7 +8672,7 @@ int
Tcl_NRCmdSwap(
Tcl_Interp *interp,
Tcl_Command cmd,
size_t objc,
Tcl_Size objc,
Tcl_Obj *const objv[],
int flags)
{
@@ -8806,7 +8806,7 @@ TclNRTailcallObjCmd(
if (!(iPtr->varFramePtr->isProcCallFrame & 1)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"tailcall can only be called from a proc, lambda or method", -1));
"tailcall can only be called from a proc, lambda or method", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "TAILCALL", "ILLEGAL", NULL);
return TCL_ERROR;
}
@@ -8836,7 +8836,7 @@ TclNRTailcallObjCmd(
* namespace, the rest the command to be tailcalled.
*/
nsObjPtr = Tcl_NewStringObj(nsPtr->fullName, -1);
nsObjPtr = Tcl_NewStringObj(nsPtr->fullName, TCL_INDEX_NONE);
listPtr = Tcl_NewListObj(objc, objv);
TclListObjSetElement(interp, listPtr, 0, nsObjPtr);
@@ -8968,7 +8968,7 @@ TclNRYieldObjCmd(
if (!corPtr) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"yield can only be called in a coroutine", -1));
"yield can only be called in a coroutine", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "COROUTINE", "ILLEGAL_YIELD", NULL);
return TCL_ERROR;
}
@@ -9001,14 +9001,14 @@ TclNRYieldToObjCmd(
if (!corPtr) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"yieldto can only be called in a coroutine", -1));
"yieldto can only be called in a coroutine", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "COROUTINE", "ILLEGAL_YIELD", NULL);
return TCL_ERROR;
}
if (((Namespace *) nsPtr)->flags & NS_DYING) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"yieldto called in deleted namespace", -1));
"yieldto called in deleted namespace", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "COROUTINE", "YIELDTO_IN_DELETED",
NULL);
return TCL_ERROR;
@@ -9021,7 +9021,7 @@ TclNRYieldToObjCmd(
*/
listPtr = Tcl_NewListObj(objc, objv);
nsObjPtr = Tcl_NewStringObj(nsPtr->fullName, -1);
nsObjPtr = Tcl_NewStringObj(nsPtr->fullName, TCL_INDEX_NONE);
TclListObjSetElement(interp, listPtr, 0, nsObjPtr);
/*
@@ -9029,6 +9029,7 @@ TclNRYieldToObjCmd(
*/
iPtr->execEnvPtr = corPtr->callerEEPtr;
/* Not calling Tcl_IncrRefCount(listPtr) here because listPtr is private */
TclSetTailcall(interp, listPtr);
corPtr->yieldPtr = listPtr;
iPtr->execEnvPtr = corPtr->eePtr;
@@ -9231,8 +9232,8 @@ TclNRCoroutineActivateCallback(
if (corPtr->yieldPtr) {
for (runPtr = TOP_CB(interp); runPtr; runPtr = runPtr->nextPtr) {
if (runPtr->data[1] == corPtr->yieldPtr) {
Tcl_DecrRefCount((Tcl_Obj *)runPtr->data[1]);
runPtr->data[1] = NULL;
Tcl_DecrRefCount(corPtr->yieldPtr);
corPtr->yieldPtr = NULL;
break;
}
@@ -9242,7 +9243,7 @@ TclNRCoroutineActivateCallback(
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"cannot yield: C stack busy", -1));
"cannot yield: C stack busy", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "COROUTINE", "CANT_YIELD",
NULL);
return TCL_ERROR;
@@ -9331,7 +9332,7 @@ CoroTypeObjCmd(
cmdPtr = (Command *) Tcl_GetCommandFromObj(interp, objv[1]);
if ((!cmdPtr) || (cmdPtr->nreProc != TclNRInterpCoroutine)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"can only get coroutine type of a coroutine", -1));
"can only get coroutine type of a coroutine", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "COROUTINE",
TclGetString(objv[1]), NULL);
return TCL_ERROR;
@@ -9344,7 +9345,7 @@ CoroTypeObjCmd(
corPtr = (CoroutineData *)cmdPtr->objClientData;
if (!COR_IS_SUSPENDED(corPtr)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj("active", -1));
Tcl_SetObjResult(interp, Tcl_NewStringObj("active", TCL_INDEX_NONE));
return TCL_OK;
}
@@ -9355,14 +9356,14 @@ CoroTypeObjCmd(
switch (corPtr->nargs) {
case COROUTINE_ARGUMENTS_SINGLE_OPTIONAL:
Tcl_SetObjResult(interp, Tcl_NewStringObj("yield", -1));
Tcl_SetObjResult(interp, Tcl_NewStringObj("yield", TCL_INDEX_NONE));
return TCL_OK;
case COROUTINE_ARGUMENTS_ARBITRARY:
Tcl_SetObjResult(interp, Tcl_NewStringObj("yieldto", -1));
Tcl_SetObjResult(interp, Tcl_NewStringObj("yieldto", TCL_INDEX_NONE));
return TCL_OK;
default:
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"unknown coroutine type", -1));
"unknown coroutine type", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "COROUTINE", "BAD_TYPE", NULL);
return TCL_ERROR;
}
@@ -9391,7 +9392,7 @@ GetCoroutineFromObj(
Command *cmdPtr = (Command *) Tcl_GetCommandFromObj(interp, objPtr);
if ((!cmdPtr) || (cmdPtr->nreProc != TclNRInterpCoroutine)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(errMsg, -1));
Tcl_SetObjResult(interp, Tcl_NewStringObj(errMsg, TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "COROUTINE",
TclGetString(objPtr), NULL);
return NULL;
@@ -9425,7 +9426,7 @@ TclNRCoroInjectObjCmd(
}
if (!COR_IS_SUSPENDED(corPtr)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"can only inject a command into a suspended coroutine", -1));
"can only inject a command into a suspended coroutine", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "COROUTINE", "ACTIVE", NULL);
return TCL_ERROR;
}
@@ -9553,24 +9554,25 @@ InjectHandler(
Tcl_Obj **objv;
if (!isProbe) {
/*
* If this is [coroinject], add the extra arguments now.
*/
/*
* If this is [coroinject], add the extra arguments now.
*/
if (nargs == COROUTINE_ARGUMENTS_SINGLE_OPTIONAL) {
Tcl_ListObjAppendElement(NULL, listPtr,
Tcl_NewStringObj("yield", -1));
} else if (nargs == COROUTINE_ARGUMENTS_ARBITRARY) {
Tcl_ListObjAppendElement(NULL, listPtr,
Tcl_NewStringObj("yieldto", -1));
} else {
/*
* I don't think this is reachable...
*/
Tcl_ListObjAppendElement(NULL, listPtr, Tcl_NewWideIntObj((Tcl_WideInt)(nargs + 1U) - 1));
}
Tcl_ListObjAppendElement(NULL, listPtr, Tcl_GetObjResult(interp));
if (nargs == COROUTINE_ARGUMENTS_SINGLE_OPTIONAL) {
Tcl_ListObjAppendElement(NULL, listPtr,
Tcl_NewStringObj("yield", TCL_INDEX_NONE));
} else if (nargs == COROUTINE_ARGUMENTS_ARBITRARY) {
Tcl_ListObjAppendElement(NULL, listPtr,
Tcl_NewStringObj("yieldto", TCL_INDEX_NONE));
} else {
/*
* I don't think this is reachable...
*/
Tcl_Obj *nargsObj;
TclNewIndexObj(nargsObj, nargs);
Tcl_ListObjAppendElement(NULL, listPtr, nargsObj);
}
Tcl_ListObjAppendElement(NULL, listPtr, Tcl_GetObjResult(interp));
}
/*
@@ -9661,7 +9663,7 @@ NRInjectObjCmd(
}
if (!COR_IS_SUSPENDED(corPtr)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"can only inject a command into a suspended coroutine", -1));
"can only inject a command into a suspended coroutine", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "COROUTINE", "ACTIVE", NULL);
return TCL_ERROR;
}
@@ -9715,7 +9717,7 @@ TclNRInterpCoroutine(
if (corPtr->nargs + 1 != (size_t)objc) {
Tcl_SetObjResult(interp,
Tcl_NewStringObj("wrong coro nargs; how did we get here? "
"not implemented!", -1));
"not implemented!", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "WRONGARGS", NULL);
return TCL_ERROR;
}
@@ -9833,6 +9835,7 @@ TclNRCoroutineObjCmd(
corPtr->running.lineLABCPtr = corPtr->lineLABCPtr;
corPtr->stackLevel = NULL;
corPtr->auxNumLevels = 0;
corPtr->yieldPtr = NULL;
/*
* Create the coro's execEnv, switch to it to push the exit and coro
+31 -27
View File
@@ -222,7 +222,7 @@ Tcl_Obj *
Tcl_NewByteArrayObj(
const unsigned char *bytes, /* The array of bytes used to initialize the
* new object. */
size_t numBytes) /* Number of bytes in the array */
Tcl_Size numBytes) /* Number of bytes in the array */
{
#ifdef TCL_MEM_DEBUG
return Tcl_DbNewByteArrayObj(bytes, numBytes, "unknown", 0);
@@ -265,7 +265,7 @@ Tcl_Obj *
Tcl_DbNewByteArrayObj(
const unsigned char *bytes, /* The array of bytes used to initialize the
* new object. */
size_t numBytes, /* Number of bytes in the array */
Tcl_Size numBytes, /* Number of bytes in the array */
const char *file, /* The name of the source file calling this
* procedure; used for debugging. */
int line) /* Line number in the source file; used for
@@ -282,7 +282,7 @@ Tcl_Obj *
Tcl_DbNewByteArrayObj(
const unsigned char *bytes, /* The array of bytes used to initialize the
* new object. */
size_t numBytes, /* Number of bytes in the array */
Tcl_Size numBytes, /* Number of bytes in the array */
TCL_UNUSED(const char *) /*file*/,
TCL_UNUSED(int) /*line*/)
{
@@ -313,7 +313,7 @@ Tcl_SetByteArrayObj(
Tcl_Obj *objPtr, /* Object to initialize as a ByteArray. */
const unsigned char *bytes, /* The array of bytes to use as the new value.
* May be NULL even if numBytes > 0. */
size_t numBytes) /* Number of bytes in the array */
Tcl_Size numBytes) /* Number of bytes in the array */
{
ByteArray *byteArrayPtr;
Tcl_ObjInternalRep ir;
@@ -395,7 +395,7 @@ TclGetBytesFromObj(
if (interp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"byte sequence length exceeds INT_MAX", -1));
"byte sequence length exceeds INT_MAX", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "API", "OUTDATED", NULL);
}
return NULL;
@@ -431,7 +431,7 @@ TclGetBytesFromObj(
unsigned char *
Tcl_SetByteArrayLength(
Tcl_Obj *objPtr, /* The ByteArray object. */
size_t numBytes) /* Number of bytes in resized array */
Tcl_Size numBytes) /* Number of bytes in resized array */
{
ByteArray *byteArrayPtr;
Tcl_ObjInternalRep *irPtr;
@@ -494,7 +494,7 @@ MakeByteArray(
size_t length;
const char *src = Tcl_GetStringFromObj(objPtr, &length);
size_t numBytes
= (limit != TCL_INDEX_NONE && limit < length) ? limit : length;
= (!TCL_SIZE_ISNEG(limit) && limit < length) ? limit : length;
ByteArray *byteArrayPtr = (ByteArray *)Tcl_Alloc(BYTEARRAY_SIZE(numBytes));
unsigned char *dst = byteArrayPtr->bytes;
unsigned char *dstEnd = dst + numBytes;
@@ -530,7 +530,7 @@ MakeByteArray(
return proper;
}
Tcl_Obj *
static Tcl_Obj *
TclNarrowToBytes(
Tcl_Obj *objPtr)
{
@@ -730,7 +730,7 @@ TclAppendBytesToByteArray(
if (Tcl_IsShared(objPtr)) {
Tcl_Panic("%s called with shared object","TclAppendBytesToByteArray");
}
if (len == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(len)) {
Tcl_Panic("%s must be called with definite number of bytes to append",
"TclAppendBytesToByteArray");
}
@@ -912,9 +912,9 @@ BinaryFormatCmd(
goto badIndex;
}
if (count == BINARY_ALL) {
Tcl_Obj *copy = TclNarrowToBytes(objv[arg]);
(void)Tcl_GetByteArrayFromObj(copy, &count);
Tcl_DecrRefCount(copy);
if (Tcl_GetByteArrayFromObj(objv[arg], &count) == NULL) {
count = Tcl_GetCharLength(objv[arg]);
}
} else if (count == BINARY_NOCOUNT) {
count = 1;
}
@@ -978,20 +978,24 @@ BinaryFormatCmd(
* The macro evals its args more than once: avoid arg++
*/
if (TclListObjGetElementsM(interp, objv[arg], &listc,
&listv) != TCL_OK) {
if (TclListObjLengthM(interp, objv[arg], &listc
) != TCL_OK) {
return TCL_ERROR;
}
arg++;
if (count == BINARY_ALL) {
count = listc;
} else if (count > listc) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"number of elements in list does not match count",
-1));
TCL_INDEX_NONE));
return TCL_ERROR;
}
if (TclListObjGetElementsM(interp, objv[arg], &listc,
&listv) != TCL_OK) {
return TCL_ERROR;
}
arg++;
}
offset += count*size;
break;
@@ -999,7 +1003,7 @@ BinaryFormatCmd(
case 'x':
if (count == BINARY_ALL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"cannot use \"*\" in format string with \"x\"", -1));
"cannot use \"*\" in format string with \"x\"", TCL_INDEX_NONE));
return TCL_ERROR;
} else if (count == BINARY_NOCOUNT) {
count = 1;
@@ -1339,7 +1343,7 @@ BinaryFormatCmd(
}
error:
Tcl_SetObjResult(interp, Tcl_NewStringObj(errorString, -1));
Tcl_SetObjResult(interp, Tcl_NewStringObj(errorString, TCL_INDEX_NONE));
return TCL_ERROR;
}
@@ -1720,7 +1724,7 @@ BinaryScanCmd(
}
error:
Tcl_SetObjResult(interp, Tcl_NewStringObj(errorString, -1));
Tcl_SetObjResult(interp, Tcl_NewStringObj(errorString, TCL_INDEX_NONE));
return TCL_ERROR;
}
@@ -2017,7 +2021,7 @@ FormatNumber(
*/
if (Tcl_GetDoubleFromObj(interp, src, &dvalue) != TCL_OK) {
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(src, &tclDoubleType);
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(src, &tclDoubleType.objType);
if (irPtr == NULL) {
return TCL_ERROR;
}
@@ -2037,7 +2041,7 @@ FormatNumber(
*/
if (Tcl_GetDoubleFromObj(interp, src, &dvalue) != TCL_OK) {
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(src, &tclDoubleType);
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(src, &tclDoubleType.objType);
if (irPtr == NULL) {
return TCL_ERROR;
@@ -2524,7 +2528,7 @@ BinaryDecodeHex(
}
TclNewObj(resultObj);
data = Tcl_GetBytesFromObj(NULL, objv[objc - 1], &count);
data = Tcl_GetByteArrayFromObj(objv[objc - 1], &count);
if (data == NULL) {
pure = 0;
data = (unsigned char *) Tcl_GetStringFromObj(objv[objc - 1], &count);
@@ -2650,14 +2654,14 @@ BinaryEncode64(
}
if (maxlen < 0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"line length out of range", -1));
"line length out of range", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "BINARY", "ENCODE",
"LINE_LENGTH", NULL);
return TCL_ERROR;
}
break;
case OPT_WRAPCHAR:
wrapchar = (const char *)Tcl_GetBytesFromObj(NULL,
wrapchar = (const char *)Tcl_GetByteArrayFromObj(
objv[i + 1], &wrapcharlen);
if (wrapchar == NULL) {
purewrap = 0;
@@ -2778,7 +2782,7 @@ BinaryEncodeUu(
}
if (lineLength < 5 || lineLength > 85) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"line length out of range", -1));
"line length out of range", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "BINARY", "ENCODE",
"LINE_LENGTH", NULL);
return TCL_ERROR;
@@ -2928,7 +2932,7 @@ BinaryDecodeUu(
}
TclNewObj(resultObj);
data = Tcl_GetBytesFromObj(NULL, objv[objc - 1], &count);
data = Tcl_GetByteArrayFromObj(objv[objc - 1], &count);
if (data == NULL) {
pure = 0;
data = (unsigned char *) Tcl_GetStringFromObj(objv[objc - 1], &count);
@@ -3103,7 +3107,7 @@ BinaryDecode64(
}
TclNewObj(resultObj);
data = Tcl_GetBytesFromObj(NULL, objv[objc - 1], &count);
data = Tcl_GetByteArrayFromObj(objv[objc - 1], &count);
if (data == NULL) {
pure = 0;
data = (unsigned char *) Tcl_GetStringFromObj(objv[objc - 1], &count);
+18 -18
View File
@@ -172,7 +172,7 @@ TclDumpMemoryInfo(
if (clientData == NULL) {
return 0;
}
sprintf(buf,
snprintf(buf, sizeof(buf),
"total mallocs %10" TCL_Z_MODIFIER "u\n"
"total frees %10" TCL_Z_MODIFIER "u\n"
"current packets allocated %10" TCL_Z_MODIFIER "u\n"
@@ -189,7 +189,7 @@ TclDumpMemoryInfo(
fprintf((FILE *)clientData, "%s", buf);
} else {
/* Assume objPtr to append to */
Tcl_AppendToObj((Tcl_Obj *) clientData, buf, -1);
Tcl_AppendToObj((Tcl_Obj *) clientData, buf, TCL_INDEX_NONE);
}
return 1;
}
@@ -382,7 +382,7 @@ Tcl_DumpActiveMemory(
void *
Tcl_DbCkalloc(
size_t size,
TCL_HASH_TYPE size,
const char *file,
int line)
{
@@ -472,7 +472,7 @@ Tcl_DbCkalloc(
void *
Tcl_AttemptDbCkalloc(
size_t size,
TCL_HASH_TYPE size,
const char *file,
int line)
{
@@ -657,7 +657,7 @@ Tcl_DbCkfree(
void *
Tcl_DbCkrealloc(
void *ptr,
size_t size,
TCL_HASH_TYPE size,
const char *file,
int line)
{
@@ -688,7 +688,7 @@ Tcl_DbCkrealloc(
void *
Tcl_AttemptDbCkrealloc(
void *ptr,
size_t size,
TCL_HASH_TYPE size,
const char *file,
int line)
{
@@ -739,14 +739,14 @@ Tcl_AttemptDbCkrealloc(
void *
Tcl_Alloc(
size_t size)
TCL_HASH_TYPE size)
{
return Tcl_DbCkalloc(size, "unknown", 0);
}
void *
Tcl_AttemptAlloc(
size_t size)
TCL_HASH_TYPE size)
{
return Tcl_AttemptDbCkalloc(size, "unknown", 0);
}
@@ -761,14 +761,14 @@ Tcl_Free(
void *
Tcl_Realloc(
void *ptr,
size_t size)
TCL_HASH_TYPE size)
{
return Tcl_DbCkrealloc(ptr, size, "unknown", 0);
}
void *
Tcl_AttemptRealloc(
void *ptr,
size_t size)
TCL_HASH_TYPE size)
{
return Tcl_AttemptDbCkrealloc(ptr, size, "unknown", 0);
}
@@ -1032,7 +1032,7 @@ Tcl_InitMemory(
void *
Tcl_Alloc(
size_t size)
TCL_HASH_TYPE size)
{
void *result = TclpAlloc(size);
@@ -1054,7 +1054,7 @@ Tcl_Alloc(
void *
Tcl_DbCkalloc(
size_t size,
TCL_HASH_TYPE size,
const char *file,
int line)
{
@@ -1081,14 +1081,14 @@ Tcl_DbCkalloc(
void *
Tcl_AttemptAlloc(
size_t size)
TCL_HASH_TYPE size)
{
return (char *)TclpAlloc(size);
}
void *
Tcl_AttemptDbCkalloc(
size_t size,
TCL_HASH_TYPE size,
TCL_UNUSED(const char *) /*file*/,
TCL_UNUSED(int) /*line*/)
{
@@ -1109,7 +1109,7 @@ Tcl_AttemptDbCkalloc(
void *
Tcl_Realloc(
void *ptr,
size_t size)
TCL_HASH_TYPE size)
{
void *result = TclpRealloc(ptr, size);
@@ -1122,7 +1122,7 @@ Tcl_Realloc(
void *
Tcl_DbCkrealloc(
void *ptr,
size_t size,
TCL_HASH_TYPE size,
const char *file,
int line)
{
@@ -1150,7 +1150,7 @@ Tcl_DbCkrealloc(
void *
Tcl_AttemptRealloc(
void *ptr,
size_t size)
TCL_HASH_TYPE size)
{
return (char *)TclpRealloc(ptr, size);
}
@@ -1158,7 +1158,7 @@ Tcl_AttemptRealloc(
void *
Tcl_AttemptDbCkrealloc(
void *ptr,
size_t size,
TCL_HASH_TYPE size,
TCL_UNUSED(const char *) /*file*/,
TCL_UNUSED(int) /*line*/)
{
+13 -7
View File
@@ -14,6 +14,7 @@
*/
#include "tclInt.h"
#include "tclTomMath.h"
/*
* Windows has mktime. The configurators do not check.
@@ -432,7 +433,7 @@ ClockGetdatefieldsObjCmd(
* that it isn't.
*/
if (TclHasInternalRep(objv[1], &tclBignumType)) {
if (TclHasInternalRep(objv[1], &tclBignumType.objType)) {
Tcl_SetObjResult(interp, lit[LIT_INTEGER_VALUE_TOO_LARGE]);
return TCL_ERROR;
}
@@ -1085,12 +1086,12 @@ ConvertUTCToLocalUsingC(
} else {
*buffer = '+';
}
sprintf(buffer+1, "%02d", diff / 3600);
snprintf(buffer+1, sizeof(buffer) - 1, "%02d", diff / 3600);
diff %= 3600;
sprintf(buffer+3, "%02d", diff / 60);
snprintf(buffer+3, sizeof(buffer) - 3, "%02d", diff / 60);
diff %= 60;
if (diff > 0) {
sprintf(buffer+5, "%02d", diff);
snprintf(buffer+5, sizeof(buffer) - 5, "%02d", diff);
}
fields->tzName = Tcl_NewStringObj(buffer, -1);
Tcl_IncrRefCount(fields->tzName);
@@ -1804,14 +1805,16 @@ ClockMillisecondsObjCmd(
Tcl_Obj *const *objv) /* Parameter values */
{
Tcl_Time now;
Tcl_Obj *timeObj;
if (objc != 1) {
Tcl_WrongNumArgs(interp, 1, objv, NULL);
return TCL_ERROR;
}
Tcl_GetTime(&now);
Tcl_SetObjResult(interp, Tcl_NewWideIntObj((Tcl_WideInt)
now.sec * 1000 + now.usec / 1000));
TclNewUIntObj(timeObj, (Tcl_WideUInt)
now.sec * 1000 + now.usec / 1000);
Tcl_SetObjResult(interp, timeObj);
return TCL_OK;
}
@@ -1992,13 +1995,16 @@ ClockSecondsObjCmd(
Tcl_Obj *const *objv) /* Parameter values */
{
Tcl_Time now;
Tcl_Obj *timeObj;
if (objc != 1) {
Tcl_WrongNumArgs(interp, 1, objv, NULL);
return TCL_ERROR;
}
Tcl_GetTime(&now);
Tcl_SetObjResult(interp, Tcl_NewWideIntObj((Tcl_WideInt) now.sec));
TclNewUIntObj(timeObj, (Tcl_WideUInt)now.sec);
Tcl_SetObjResult(interp, timeObj);
return TCL_OK;
}
+247 -164
View File
@@ -12,6 +12,8 @@
*/
#include "tclInt.h"
#include "tclIO.h"
#include "tclTomMath.h"
#ifdef _WIN32
# include "tclWinInt.h"
#endif
@@ -50,6 +52,7 @@ static Tcl_ObjCmdProc EncodingConvertfromObjCmd;
static Tcl_ObjCmdProc EncodingConverttoObjCmd;
static Tcl_ObjCmdProc EncodingDirsObjCmd;
static Tcl_ObjCmdProc EncodingNamesObjCmd;
static Tcl_ObjCmdProc EncodingProfilesObjCmd;
static Tcl_ObjCmdProc EncodingSystemObjCmd;
static inline int ForeachAssignments(Tcl_Interp *interp,
struct ForeachState *statePtr);
@@ -385,6 +388,7 @@ TclInitEncodingCmd(
{"convertto", EncodingConverttoObjCmd, TclCompileBasic1To3ArgCmd, NULL, NULL, 0},
{"dirs", EncodingDirsObjCmd, TclCompileBasic0Or1ArgCmd, NULL, NULL, 1},
{"names", EncodingNamesObjCmd, TclCompileBasic0ArgCmd, NULL, NULL, 0},
{"profiles", EncodingProfilesObjCmd, TclCompileBasic0ArgCmd, NULL, NULL, 0},
{"system", EncodingSystemObjCmd, TclCompileBasic0Or1ArgCmd, NULL, NULL, 1},
{NULL, NULL, NULL, NULL, NULL, 0}
};
@@ -392,6 +396,116 @@ TclInitEncodingCmd(
return TclMakeEnsemble(interp, "encoding", encodingImplMap);
}
/*
*------------------------------------------------------------------------
*
* EncodingConvertParseOptions --
*
* Common routine for parsing arguments passed to encoding convertfrom
* and encoding convertto.
*
* Results:
* TCL_OK or TCL_ERROR.
*
* Side effects:
* On success,
* - *encPtr is set to the encoding. Must be freed with Tcl_FreeEncoding
* if non-NULL
* - *dataObjPtr is set to the Tcl_Obj containing the data to encode or
* decode
* - *profilePtr is set to encoding error handling profile
* - *failVarPtr is set to -failindex option value or NULL
* On error, all of the above are uninitialized.
*
*------------------------------------------------------------------------
*/
static int
EncodingConvertParseOptions (
Tcl_Interp *interp, /* For error messages. May be NULL */
int objc, /* Number of arguments */
Tcl_Obj *const objv[], /* Argument objects as passed to command. */
Tcl_Encoding *encPtr, /* Where to store the encoding */
Tcl_Obj **dataObjPtr, /* Where to store ptr to Tcl_Obj containing data */
int *profilePtr, /* Bit mask of encoding option profile */
Tcl_Obj **failVarPtr /* Where to store -failindex option value */
)
{
static const char *const options[] = {"-profile", "-failindex", NULL};
enum convertfromOptions { PROFILE, FAILINDEX } optIndex;
Tcl_Encoding encoding;
Tcl_Obj *dataObj;
Tcl_Obj *failVarObj;
#if TCL_MAJOR_VERSION > 8 || defined(TCL_NO_DEPRECATED)
int profile = TCL_ENCODING_PROFILE_TCL8; /* TODO - default for Tcl9? */
#else
int profile = TCL_ENCODING_PROFILE_TCL8;
#endif
/*
* Possible combinations:
* 1) data -> objc = 2
* 2) ?options? encoding data -> objc >= 3
* It is intentional that specifying option forces encoding to be
* specified. Less prone to user error. This should have always been
* the case even in 8.6 imho where there were no options (ie (1)
* should never have been allowed)
*/
if (objc == 1) {
numArgsError: /* ONLY jump here if nothing needs to be freed!!! */
Tcl_WrongNumArgs(interp,
1,
objv,
"?-profile profile? ?-failindex var? encoding data");
((Interp *)interp)->flags |= INTERP_ALTERNATE_WRONG_ARGS;
Tcl_WrongNumArgs(interp, 1, objv, "data");
return TCL_ERROR;
}
failVarObj = NULL;
if (objc == 2) {
encoding = Tcl_GetEncoding(interp, NULL);
dataObj = objv[1];
} else {
int argIndex;
for (argIndex = 1; argIndex < (objc-2); ++argIndex) {
if (Tcl_GetIndexFromObj(
interp, objv[argIndex], options, "option", 0, &optIndex)
!= TCL_OK) {
return TCL_ERROR;
}
if (++argIndex == (objc - 2)) {
goto numArgsError;
}
switch (optIndex) {
case PROFILE:
if (TclEncodingProfileNameToId(interp,
Tcl_GetString(objv[argIndex]),
&profile) != TCL_OK) {
return TCL_ERROR;
}
break;
case FAILINDEX:
failVarObj = objv[argIndex];
break;
}
}
/* Get encoding after opts so no need to free it on option error */
if (Tcl_GetEncodingFromObj(interp, objv[objc - 2], &encoding)
!= TCL_OK) {
return TCL_ERROR;
}
dataObj = objv[objc - 1];
}
*encPtr = encoding;
*dataObjPtr = dataObj;
*profilePtr = profile;
*failVarPtr = failVarObj;
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
@@ -418,104 +532,74 @@ EncodingConvertfromObjCmd(
Tcl_Encoding encoding; /* Encoding to use */
size_t length = 0; /* Length of the byte array being converted */
const char *bytesPtr; /* Pointer to the first byte of the array */
int flags = 0;
size_t result;
Tcl_Obj *failVarObj = NULL;
/*
* Decode parameters:
* Possible combinations:
* 1) data -> objc = 2
* 2) encoding data -> objc = 3
* 3) -nocomplain data -> objc = 3
* 4) -nocomplain encoding data -> objc = 4
* 5) -strict data -> objc = 3
* 6) -strict encoding data -> objc = 4
* 7) -failindex val data -> objc = 4
* 8) -failindex val encoding data -> objc = 5
*/
int flags;
int result;
Tcl_Obj *failVarObj;
Tcl_Size errorLocation;
if (objc == 2) {
encoding = Tcl_GetEncoding(interp, NULL);
data = objv[1];
} else if (objc > 2 && objc < 6) {
int objcUnprocessed = objc;
data = objv[objc - 1];
bytesPtr = Tcl_GetString(objv[1]);
if (bytesPtr[0] == '-' && bytesPtr[1] == 'n'
&& !strncmp(bytesPtr, "-nocomplain", strlen(bytesPtr))) {
flags = TCL_ENCODING_NOCOMPLAIN;
objcUnprocessed--;
} else if (bytesPtr[0] == '-' && bytesPtr[1] == 's'
&& !strncmp(bytesPtr, "-strict", strlen(bytesPtr))) {
flags = TCL_ENCODING_STRICT;
objcUnprocessed--;
} else if (bytesPtr[0] == '-' && bytesPtr[1] == 'f'
&& !strncmp(bytesPtr, "-failindex", strlen(bytesPtr))) {
/* at least two additional arguments needed */
if (objc < 4) {
goto encConvFromError;
}
failVarObj = objv[2];
objcUnprocessed -= 2;
}
switch (objcUnprocessed) {
case 3:
if (Tcl_GetEncodingFromObj(interp, objv[objc - 2], &encoding) != TCL_OK) {
return TCL_ERROR;
}
break;
case 2:
encoding = Tcl_GetEncoding(interp, NULL);
break;
default:
goto encConvFromError;
}
} else {
encConvFromError:
Tcl_WrongNumArgs(interp, 1, objv, "?-nocomplain? ?-strict? ?-failindex var? ?encoding? data");
if (EncodingConvertParseOptions(
interp, objc, objv, &encoding, &data, &flags, &failVarObj)
!= TCL_OK) {
return TCL_ERROR;
}
/*
* Convert the string into a byte array in 'ds'
* Convert the string into a byte array in 'ds'.
*/
bytesPtr = (char *) Tcl_GetBytesFromObj(interp, data, &length);
if (bytesPtr == NULL) {
return TCL_ERROR;
}
result = Tcl_ExternalToUtfDStringEx(encoding, bytesPtr, length,
flags, &ds);
if ((!(flags & TCL_ENCODING_NOCOMPLAIN) || ((flags & TCL_ENCODING_STRICT) == TCL_ENCODING_STRICT)) && (result != TCL_INDEX_NONE)) {
if (failVarObj != NULL) {
if (Tcl_ObjSetVar2(interp, failVarObj, NULL, Tcl_NewWideIntObj(result), TCL_LEAVE_ERR_MSG) == NULL) {
return TCL_ERROR;
}
} else {
char buf[TCL_INTEGER_SPACE];
sprintf(buf, "%" TCL_Z_MODIFIER "u", result);
Tcl_SetObjResult(interp, Tcl_ObjPrintf("unexpected byte sequence starting at index %"
TCL_Z_MODIFIER "u: '\\x%X'", result, UCHAR(bytesPtr[result])));
Tcl_SetErrorCode(interp, "TCL", "ENCODING", "ILLEGALSEQUENCE",
buf, NULL);
result = Tcl_ExternalToUtfDStringEx(interp, encoding, bytesPtr, length, flags,
&ds, failVarObj ? &errorLocation : NULL);
/* NOTE: ds must be freed beyond this point even on error */
switch (result) {
case TCL_OK:
errorLocation = TCL_INDEX_NONE;
break;
case TCL_ERROR:
/* Error in parameters. Should not happen. interp will have error */
Tcl_DStringFree(&ds);
return TCL_ERROR;
default:
/*
* One of the TCL_CONVERT_* errors. If we were not interested in the
* error location, interp result would already have been filled in
* and we can just return the error. Otherwise, we have to return
* what could be decoded and the returned error location.
*/
if (failVarObj == NULL) {
Tcl_DStringFree(&ds);
return TCL_ERROR;
}
break;
}
/*
* TCL_OK or a TCL_CONVERT_* error where the caller wants back as much
* data as was converted.
*/
if (failVarObj) {
Tcl_Obj *failIndex;
TclNewIndexObj(failIndex, errorLocation);
if (Tcl_ObjSetVar2(interp,
failVarObj,
NULL,
failIndex,
TCL_LEAVE_ERR_MSG) == NULL) {
Tcl_DStringFree(&ds);
return TCL_ERROR;
}
} else if (failVarObj != NULL) {
if (Tcl_ObjSetVar2(interp, failVarObj, NULL, Tcl_NewIntObj(-1), TCL_LEAVE_ERR_MSG) == NULL) {
return TCL_ERROR;
}
}
/*
* Note that we cannot use Tcl_DStringResult here because it will
* truncate the string at the first null byte.
*/
Tcl_SetObjResult(interp, TclDStringToObj(&ds));
Tcl_SetObjResult(interp, Tcl_DStringToObj(&ds));
/*
* We're done with the encoding
*/
/* We're done with the encoding */
Tcl_FreeEncoding(encoding);
return TCL_OK;
@@ -548,60 +632,14 @@ EncodingConverttoObjCmd(
Tcl_Encoding encoding; /* Encoding to use */
size_t length; /* Length of the string being converted */
const char *stringPtr; /* Pointer to the first byte of the string */
size_t result;
int flags = 0;
Tcl_Obj *failVarObj = NULL;
int result;
int flags;
Tcl_Obj *failVarObj;
Tcl_Size errorLocation;
/*
* Decode parameters:
* Possible combinations:
* 1) data -> objc = 2
* 2) encoding data -> objc = 3
* 3) -nocomplain data -> objc = 3
* 4) -nocomplain encoding data -> objc = 4
* 5) -failindex val data -> objc = 4
* 6) -failindex val encoding data -> objc = 5
*/
if (objc == 2) {
encoding = Tcl_GetEncoding(interp, NULL);
data = objv[1];
} else if (objc > 2 && objc < 6) {
int objcUnprocessed = objc;
data = objv[objc - 1];
stringPtr = Tcl_GetString(objv[1]);
if (stringPtr[0] == '-' && stringPtr[1] == 'n'
&& !strncmp(stringPtr, "-nocomplain", strlen(stringPtr))) {
flags = TCL_ENCODING_NOCOMPLAIN;
objcUnprocessed--;
} else if (stringPtr[0] == '-' && stringPtr[1] == 's'
&& !strncmp(stringPtr, "-strict", strlen(stringPtr))) {
flags = TCL_ENCODING_STRICT;
objcUnprocessed--;
} else if (stringPtr[0] == '-' && stringPtr[1] == 'f'
&& !strncmp(stringPtr, "-failindex", strlen(stringPtr))) {
/* at least two additional arguments needed */
if (objc < 4) {
goto encConvToError;
}
failVarObj = objv[2];
objcUnprocessed -= 2;
}
switch (objcUnprocessed) {
case 3:
if (Tcl_GetEncodingFromObj(interp, objv[objc - 2], &encoding) != TCL_OK) {
return TCL_ERROR;
}
break;
case 2:
encoding = Tcl_GetEncoding(interp, NULL);
break;
default:
goto encConvToError;
}
} else {
encConvToError:
Tcl_WrongNumArgs(interp, 1, objv, "?-nocomplain? ?-strict? ?-failindex var? ?encoding? data");
if (EncodingConvertParseOptions(
interp, objc, objv, &encoding, &data, &flags, &failVarObj)
!= TCL_OK) {
return TCL_ERROR;
}
@@ -610,40 +648,54 @@ EncodingConverttoObjCmd(
*/
stringPtr = Tcl_GetStringFromObj(data, &length);
result = Tcl_UtfToExternalDStringEx(encoding, stringPtr, length,
flags, &ds);
if ((!(flags & TCL_ENCODING_NOCOMPLAIN) || ((flags & TCL_ENCODING_STRICT) == TCL_ENCODING_STRICT)) && (result != TCL_INDEX_NONE)) {
if (failVarObj != NULL) {
/* I hope, wide int will cover size_t data type */
if (Tcl_ObjSetVar2(interp, failVarObj, NULL, Tcl_NewWideIntObj(result), TCL_LEAVE_ERR_MSG) == NULL) {
return TCL_ERROR;
}
} else {
size_t pos = Tcl_NumUtfChars(stringPtr, result);
int ucs4;
char buf[TCL_INTEGER_SPACE];
TclUtfToUCS4(&stringPtr[result], &ucs4);
sprintf(buf, "%" TCL_Z_MODIFIER "u", result);
Tcl_SetObjResult(interp, Tcl_ObjPrintf("unexpected character at index %"
TCL_Z_MODIFIER "u: 'U+%06X'", pos, ucs4));
Tcl_SetErrorCode(interp, "TCL", "ENCODING", "ILLEGALSEQUENCE",
buf, NULL);
result = Tcl_UtfToExternalDStringEx(interp, encoding, stringPtr, length, flags,
&ds, failVarObj ? &errorLocation : NULL);
/* NOTE: ds must be freed beyond this point even on error */
switch (result) {
case TCL_OK:
errorLocation = TCL_INDEX_NONE;
break;
case TCL_ERROR:
/* Error in parameters. Should not happen. interp will have error */
Tcl_DStringFree(&ds);
return TCL_ERROR;
default:
/*
* One of the TCL_CONVERT_* errors. If we were not interested in the
* error location, interp result would already have been filled in
* and we can just return the error. Otherwise, we have to return
* what could be decoded and the returned error location.
*/
if (failVarObj == NULL) {
Tcl_DStringFree(&ds);
return TCL_ERROR;
}
break;
}
/*
* TCL_OK or a TCL_CONVERT_* error where the caller wants back as much
* data as was converted.
*/
if (failVarObj) {
Tcl_Obj *failIndex;
TclNewIndexObj(failIndex, errorLocation);
if (Tcl_ObjSetVar2(interp,
failVarObj,
NULL,
failIndex,
TCL_LEAVE_ERR_MSG) == NULL) {
Tcl_DStringFree(&ds);
return TCL_ERROR;
}
} else if (failVarObj != NULL) {
if (Tcl_ObjSetVar2(interp, failVarObj, NULL, Tcl_NewIntObj(-1), TCL_LEAVE_ERR_MSG) == NULL) {
return TCL_ERROR;
}
}
Tcl_SetObjResult(interp,
Tcl_NewByteArrayObj((unsigned char*) Tcl_DStringValue(&ds),
Tcl_DStringLength(&ds)));
Tcl_DStringFree(&ds);
/*
* We're done with the encoding
*/
/* We're done with the encoding */
Tcl_FreeEncoding(encoding);
return TCL_OK;
@@ -725,6 +777,34 @@ EncodingNamesObjCmd(
return TCL_OK;
}
/*
*-----------------------------------------------------------------------------
*
* EncodingProfilesObjCmd --
*
* This command returns a list of the available encoding profiles
*
* Results:
* Returns a standard Tcl result
*
*-----------------------------------------------------------------------------
*/
int
EncodingProfilesObjCmd(
TCL_UNUSED(void *),
Tcl_Interp* interp, /* Tcl interpreter */
int objc, /* Number of command line args */
Tcl_Obj* const objv[]) /* Vector of command line args */
{
if (objc > 1) {
Tcl_WrongNumArgs(interp, 1, objv, NULL);
return TCL_ERROR;
}
TclGetEncodingProfiles(interp);
return TCL_OK;
}
/*
*-----------------------------------------------------------------------------
*
@@ -1912,7 +1992,7 @@ PathNativeNameCmd(
if (Tcl_TranslateFileName(interp, TclGetString(objv[1]), &ds) == NULL) {
return TCL_ERROR;
}
Tcl_SetObjResult(interp, TclDStringToObj(&ds));
Tcl_SetObjResult(interp, Tcl_DStringToObj(&ds));
return TCL_OK;
}
@@ -2712,8 +2792,8 @@ EachloopCmd(
result = TCL_ERROR;
goto done;
}
TclListObjGetElementsM(NULL, statePtr->vCopyList[i],
&statePtr->varcList[i], &statePtr->varvList[i]);
TclListObjLengthM(NULL, statePtr->vCopyList[i],
&statePtr->varcList[i]);
if (statePtr->varcList[i] < 1) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"%s varlist is empty",
@@ -2724,17 +2804,19 @@ EachloopCmd(
result = TCL_ERROR;
goto done;
}
TclListObjGetElementsM(NULL, statePtr->vCopyList[i],
&statePtr->varcList[i], &statePtr->varvList[i]);
/* Values */
if (TclHasInternalRep(objv[2+i*2],&tclArithSeriesType)) {
if (TclHasInternalRep(objv[2+i*2],&tclArithSeriesType.objType)) {
/* Special case for Arith Series */
statePtr->aCopyList[i] = TclArithSeriesObjCopy(interp, objv[2+i*2]);
if (statePtr->aCopyList[i] == NULL) {
result = TCL_ERROR;
goto done;
}
/* Don't compute values here, wait until the last momement */
statePtr->argcList[i] = TclArithSeriesObjLength(statePtr->aCopyList[i]);
/* Don't compute values here, wait until the last moment */
statePtr->argcList[i] = ABSTRACTLIST_PROC(statePtr->aCopyList[i], lengthProc)(statePtr->aCopyList[i]);
} else {
/* List values */
statePtr->aCopyList[i] = TclListObjCopy(interp, objv[2+i*2]);
@@ -2868,12 +2950,13 @@ ForeachAssignments(
Tcl_Obj *valuePtr, *varValuePtr;
for (i=0 ; i<statePtr->numLists ; i++) {
int isarithseries = TclHasInternalRep(statePtr->aCopyList[i],&tclArithSeriesType);
int isarithseries = TclHasInternalRep(statePtr->aCopyList[i],&tclArithSeriesType.objType);
for (v=0 ; v<statePtr->varcList[i] ; v++) {
k = statePtr->index[i]++;
if (k < statePtr->argcList[i]) {
if (isarithseries) {
if (TclArithSeriesObjIndex(statePtr->aCopyList[i], k, &valuePtr) != TCL_OK) {
valuePtr = TclArithSeriesObjIndex(interp, statePtr->aCopyList[i], k);
if (valuePtr == NULL) {
Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
"\n (setting %s loop variable \"%s\")",
(statePtr->resultList != NULL ? "lmap" : "foreach"),
+58 -53
View File
@@ -504,7 +504,7 @@ InfoArgsCmd(
localPtr = localPtr->nextPtr) {
if (TclIsVarArgument(localPtr)) {
Tcl_ListObjAppendElement(interp, listObjPtr,
Tcl_NewStringObj(localPtr->name, -1));
Tcl_NewStringObj(localPtr->name, TCL_INDEX_NONE));
}
}
Tcl_SetObjResult(interp, listObjPtr);
@@ -716,7 +716,7 @@ InfoCommandsCmd(
Tcl_GetCommandFullName(interp, cmd, elemObjPtr);
} else {
cmdName = (const char *)Tcl_GetHashKey(&nsPtr->cmdTable, entryPtr);
elemObjPtr = Tcl_NewStringObj(cmdName, -1);
elemObjPtr = Tcl_NewStringObj(cmdName, TCL_INDEX_NONE);
}
Tcl_ListObjAppendElement(interp, listPtr, elemObjPtr);
Tcl_SetObjResult(interp, listPtr);
@@ -744,7 +744,7 @@ InfoCommandsCmd(
if (entryPtr != NULL) {
cmdName = (const char *)Tcl_GetHashKey(tablePtr, entryPtr);
Tcl_ListObjAppendElement(interp, listPtr,
Tcl_NewStringObj(cmdName, -1));
Tcl_NewStringObj(cmdName, TCL_INDEX_NONE));
Tcl_SetObjResult(interp, listPtr);
return TCL_OK;
}
@@ -766,7 +766,7 @@ InfoCommandsCmd(
elemObjPtr = Tcl_NewObj();
Tcl_GetCommandFullName(interp, cmd, elemObjPtr);
} else {
elemObjPtr = Tcl_NewStringObj(cmdName, -1);
elemObjPtr = Tcl_NewStringObj(cmdName, TCL_INDEX_NONE);
}
Tcl_ListObjAppendElement(interp, listPtr, elemObjPtr);
}
@@ -789,7 +789,7 @@ InfoCommandsCmd(
|| Tcl_StringMatch(cmdName, simplePattern)) {
if (Tcl_FindHashEntry(&nsPtr->cmdTable,cmdName) == NULL) {
Tcl_ListObjAppendElement(interp, listPtr,
Tcl_NewStringObj(cmdName, -1));
Tcl_NewStringObj(cmdName, TCL_INDEX_NONE));
}
}
entryPtr = Tcl_NextHashEntry(&search);
@@ -818,7 +818,7 @@ InfoCommandsCmd(
cmdName = (const char *)Tcl_GetHashKey(&nsPtr->cmdTable, entryPtr);
if ((simplePattern == NULL)
|| Tcl_StringMatch(cmdName, simplePattern)) {
elemObjPtr = Tcl_NewStringObj(cmdName, -1);
elemObjPtr = Tcl_NewStringObj(cmdName, TCL_INDEX_NONE);
Tcl_ListObjAppendElement(interp, listPtr, elemObjPtr);
(void) Tcl_CreateHashEntry(&addedCommandsTable,
elemObjPtr, &isNew);
@@ -844,7 +844,7 @@ InfoCommandsCmd(
cmdName = (const char *)Tcl_GetHashKey(&pathNsPtr->cmdTable, entryPtr);
if ((simplePattern == NULL)
|| Tcl_StringMatch(cmdName, simplePattern)) {
elemObjPtr = Tcl_NewStringObj(cmdName, -1);
elemObjPtr = Tcl_NewStringObj(cmdName, TCL_INDEX_NONE);
(void) Tcl_CreateHashEntry(&addedCommandsTable,
elemObjPtr, &isNew);
if (isNew) {
@@ -871,7 +871,7 @@ InfoCommandsCmd(
cmdName = (const char *)Tcl_GetHashKey(&globalNsPtr->cmdTable, entryPtr);
if ((simplePattern == NULL)
|| Tcl_StringMatch(cmdName, simplePattern)) {
elemObjPtr = Tcl_NewStringObj(cmdName, -1);
elemObjPtr = Tcl_NewStringObj(cmdName, TCL_INDEX_NONE);
if (Tcl_FindHashEntry(&addedCommandsTable,
(char *) elemObjPtr) == NULL) {
Tcl_ListObjAppendElement(interp, listPtr, elemObjPtr);
@@ -1291,7 +1291,7 @@ TclInfoFrame(
* str.
*/
ADD_PAIR("type", Tcl_NewStringObj(typeString[framePtr->type], -1));
ADD_PAIR("type", Tcl_NewStringObj(typeString[framePtr->type], TCL_INDEX_NONE));
if (framePtr->line) {
ADD_PAIR("line", Tcl_NewWideIntObj(framePtr->line[0]));
} else {
@@ -1305,7 +1305,7 @@ TclInfoFrame(
* Precompiled. Result contains the type as signal, nothing else.
*/
ADD_PAIR("type", Tcl_NewStringObj(typeString[framePtr->type], -1));
ADD_PAIR("type", Tcl_NewStringObj(typeString[framePtr->type], TCL_INDEX_NONE));
break;
case TCL_LOCATION_BC: {
@@ -1330,7 +1330,7 @@ TclInfoFrame(
* Possibly modified: type, path!
*/
ADD_PAIR("type", Tcl_NewStringObj(typeString[fPtr->type], -1));
ADD_PAIR("type", Tcl_NewStringObj(typeString[fPtr->type], TCL_INDEX_NONE));
if (fPtr->line) {
ADD_PAIR("line", Tcl_NewWideIntObj(fPtr->line[0]));
}
@@ -1358,7 +1358,7 @@ TclInfoFrame(
* Evaluation of a script file.
*/
ADD_PAIR("type", Tcl_NewStringObj(typeString[framePtr->type], -1));
ADD_PAIR("type", Tcl_NewStringObj(typeString[framePtr->type], TCL_INDEX_NONE));
ADD_PAIR("line", Tcl_NewWideIntObj(framePtr->line[0]));
ADD_PAIR("file", framePtr->data.eval.path);
@@ -1404,7 +1404,7 @@ TclInfoFrame(
*/
for (i=0 ; i<efiPtr->length ; i++) {
lv[lc++] = Tcl_NewStringObj(efiPtr->fields[i].name, -1);
lv[lc++] = Tcl_NewStringObj(efiPtr->fields[i].name, TCL_INDEX_NONE);
if (efiPtr->fields[i].proc) {
lv[lc++] =
efiPtr->fields[i].proc(efiPtr->fields[i].clientData);
@@ -1492,7 +1492,7 @@ InfoFunctionsCmd(
" }\n"
" }\n"
" ::return $cmds\n"
" } [::namespace current]] ", -1);
" } [::namespace current]] ", TCL_INDEX_NONE);
if (objc == 2) {
Tcl_Obj *arg = Tcl_NewListObj(1, &(objv[1]));
@@ -1545,12 +1545,12 @@ InfoHostnameCmd(
name = Tcl_GetHostName();
if (name) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(name, -1));
Tcl_SetObjResult(interp, Tcl_NewStringObj(name, TCL_INDEX_NONE));
return TCL_OK;
}
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"unable to determine name of host", -1));
"unable to determine name of host", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "HOSTNAME", "UNKNOWN", NULL);
return TCL_ERROR;
}
@@ -1665,12 +1665,12 @@ InfoLibraryCmd(
libDirName = Tcl_GetVar2(interp, "tcl_library", NULL, TCL_GLOBAL_ONLY);
if (libDirName != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(libDirName, -1));
Tcl_SetObjResult(interp, Tcl_NewStringObj(libDirName, TCL_INDEX_NONE));
return TCL_OK;
}
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"no library has been specified for Tcl", -1));
"no library has been specified for Tcl", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "VARIABLE", "tcl_library",NULL);
return TCL_ERROR;
}
@@ -1797,7 +1797,7 @@ InfoPatchLevelCmd(
patchlevel = Tcl_GetVar2(interp, "tcl_patchLevel", NULL,
(TCL_GLOBAL_ONLY | TCL_LEAVE_ERR_MSG));
if (patchlevel != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(patchlevel, -1));
Tcl_SetObjResult(interp, Tcl_NewStringObj(patchlevel, TCL_INDEX_NONE));
return TCL_OK;
}
return TCL_ERROR;
@@ -1910,7 +1910,7 @@ InfoProcsCmd(
Tcl_GetCommandFullName(interp, (Tcl_Command) cmdPtr,
elemObjPtr);
} else {
elemObjPtr = Tcl_NewStringObj(simplePattern, -1);
elemObjPtr = Tcl_NewStringObj(simplePattern, TCL_INDEX_NONE);
}
Tcl_ListObjAppendElement(interp, listPtr, elemObjPtr);
}
@@ -1938,7 +1938,7 @@ InfoProcsCmd(
Tcl_GetCommandFullName(interp, (Tcl_Command) cmdPtr,
elemObjPtr);
} else {
elemObjPtr = Tcl_NewStringObj(cmdName, -1);
elemObjPtr = Tcl_NewStringObj(cmdName, TCL_INDEX_NONE);
}
Tcl_ListObjAppendElement(interp, listPtr, elemObjPtr);
}
@@ -1977,7 +1977,7 @@ InfoProcsCmd(
if (TclIsProc(cmdPtr) || ((realCmdPtr != NULL)
&& TclIsProc(realCmdPtr))) {
Tcl_ListObjAppendElement(interp, listPtr,
Tcl_NewStringObj(cmdName, -1));
Tcl_NewStringObj(cmdName, TCL_INDEX_NONE));
}
}
}
@@ -2075,7 +2075,7 @@ InfoSharedlibCmd(
}
#ifdef TCL_SHLIB_EXT
Tcl_SetObjResult(interp, Tcl_NewStringObj(TCL_SHLIB_EXT, -1));
Tcl_SetObjResult(interp, Tcl_NewStringObj(TCL_SHLIB_EXT, TCL_INDEX_NONE));
#endif
return TCL_OK;
}
@@ -2172,7 +2172,7 @@ InfoCmdTypeCmd(
Tcl_AppendResult(interp, "native", NULL);
} else {
Tcl_SetObjResult(interp,
Tcl_NewStringObj(TclGetCommandTypeName(command), -1));
Tcl_NewStringObj(TclGetCommandTypeName(command), TCL_INDEX_NONE));
}
return TCL_OK;
}
@@ -2215,9 +2215,9 @@ Tcl_JoinObjCmd(
* pointer to its array of element pointers.
*/
if (TclHasInternalRep(objv[1],&tclArithSeriesType)) {
if (TclHasInternalRep(objv[1],&tclArithSeriesType.objType)) {
isArithSeries = 1;
listLen = TclArithSeriesObjLength(objv[1]);
listLen = ABSTRACTLIST_PROC(objv[1], lengthProc)(objv[1]);
} else {
if (TclListObjGetElementsM(interp, objv[1], &listLen,
&elemPtrs) != TCL_OK) {
@@ -2232,8 +2232,8 @@ Tcl_JoinObjCmd(
if (listLen == 1) {
/* One element; return it */
if (isArithSeries) {
Tcl_Obj *valueObj;
if (TclArithSeriesObjIndex(objv[1], 0, &valueObj) != TCL_OK) {
Tcl_Obj *valueObj = TclArithSeriesObjIndex(interp, objv[1], 0);
if (valueObj == NULL) {
return TCL_ERROR;
}
Tcl_SetObjResult(interp, valueObj);
@@ -2267,10 +2267,12 @@ Tcl_JoinObjCmd(
Tcl_AppendObjToObj(resObjPtr, joinObjPtr);
}
if (TclArithSeriesObjIndex(objv[1], i, &valueObj) != TCL_OK) {
valueObj = TclArithSeriesObjIndex(interp, objv[1], i);
if (valueObj == NULL) {
return TCL_ERROR;
}
Tcl_AppendObjToObj(resObjPtr, valueObj);
Tcl_DecrRefCount(valueObj);
}
} else {
for (i = 0; i < listLen; i++) {
@@ -2575,6 +2577,7 @@ Tcl_LlengthObjCmd(
{
size_t listLen;
int result;
Tcl_Obj *objPtr;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "list");
@@ -2591,7 +2594,8 @@ Tcl_LlengthObjCmd(
* length.
*/
Tcl_SetObjResult(interp, Tcl_NewWideIntObj(listLen));
TclNewUIntObj(objPtr, listLen);
Tcl_SetObjResult(interp, objPtr);
return TCL_OK;
}
@@ -2649,7 +2653,7 @@ Tcl_LpopObjCmd(
if (!listLen) {
/* empty list, throw the same error as with index "end" */
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"index \"end\" out of range", -1));
"index \"end\" out of range", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "INDEX"
"OUTOFRANGE", NULL);
return TCL_ERROR;
@@ -2723,7 +2727,7 @@ Tcl_LrangeObjCmd(
/* Argument objects. */
{
int result;
size_t listLen, first, last;
Tcl_Size listLen, first, last;
if (objc != 4) {
Tcl_WrongNumArgs(interp, 1, objv, "list first last");
return TCL_ERROR;
@@ -2746,7 +2750,7 @@ Tcl_LrangeObjCmd(
return result;
}
if (TclHasInternalRep(objv[1],&tclArithSeriesType)) {
if (TclHasInternalRep(objv[1],&tclArithSeriesType.objType)) {
Tcl_Obj *rangeObj;
rangeObj = TclArithSeriesObjRange(interp, objv[1], first, last);
if (rangeObj) {
@@ -3145,7 +3149,7 @@ Tcl_LreverseObjCmd(
* Handle ArithSeries special case - don't shimmer a series into a list
* just to reverse it.
*/
if (TclHasInternalRep(objv[1],&tclArithSeriesType)) {
if (TclHasInternalRep(objv[1],&tclArithSeriesType.objType)) {
Tcl_Obj *resObj = TclArithSeriesObjReverse(interp, objv[1]);
if (resObj) {
Tcl_SetObjResult(interp, resObj);
@@ -3156,7 +3160,7 @@ Tcl_LreverseObjCmd(
} /* end ArithSeries */
/* True List */
if (TclListObjGetElementsM(interp, objv[1], &elemc, &elemv) != TCL_OK) {
if (TclListObjLengthM(interp, objv[1], &elemc) != TCL_OK) {
return TCL_ERROR;
}
@@ -3168,6 +3172,9 @@ Tcl_LreverseObjCmd(
Tcl_SetObjResult(interp, objv[1]);
return TCL_OK;
}
if (TclListObjGetElementsM(interp, objv[1], &elemc, &elemv) != TCL_OK) {
return TCL_ERROR;
}
if (Tcl_IsShared(objv[1])
|| ListObjRepIsShared(objv[1])) { /* Bug 1675044 */
@@ -3368,7 +3375,7 @@ Tcl_LsearchObjCmd(
}
if (i + 4 > (size_t)objc) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"missing starting index", -1));
"missing starting index", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "ARGUMENT", "MISSING", NULL);
result = TCL_ERROR;
goto done;
@@ -3392,7 +3399,7 @@ Tcl_LsearchObjCmd(
if (i + 4 > (size_t)objc) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"\"-stride\" option must be "
"followed by stride length", -1));
"followed by stride length", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "ARGUMENT", "MISSING", NULL);
result = TCL_ERROR;
goto done;
@@ -3403,7 +3410,7 @@ Tcl_LsearchObjCmd(
}
if (wide < 1) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"stride length must be at least 1", -1));
"stride length must be at least 1", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LSEARCH",
"BADSTRIDE", NULL);
result = TCL_ERROR;
@@ -3493,7 +3500,7 @@ Tcl_LsearchObjCmd(
if (returnSubindices && sortInfo.indexc==0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"-subindices cannot be used without -index option", -1));
"-subindices cannot be used without -index option", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LSEARCH",
"BAD_OPTION_MIX", NULL);
result = TCL_ERROR;
@@ -3502,7 +3509,7 @@ Tcl_LsearchObjCmd(
if (bisect && (allMatches || negatedMatch)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"-bisect is not compatible with -all or -not", -1));
"-bisect is not compatible with -all or -not", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LSEARCH",
"BAD_OPTION_MIX", NULL);
result = TCL_ERROR;
@@ -3572,7 +3579,7 @@ Tcl_LsearchObjCmd(
if (groupOffset >= groupSize) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"when used with \"-stride\", the leading \"-index\""
" value must be within the group", -1));
" value must be within the group", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LSEARCH",
"BADINDEX", NULL);
result = TCL_ERROR;
@@ -3905,8 +3912,7 @@ Tcl_LsearchObjCmd(
TclNewIndexObj(itemPtr, i+groupOffset);
for (j=0 ; j<sortInfo.indexc ; j++) {
Tcl_Obj *elObj;
size_t elValue = TclIndexDecode(sortInfo.indexv[j], listc);
TclNewIndexObj(elObj, elValue);
TclNewIndexObj(elObj, TclIndexDecode(sortInfo.indexv[j], listc));
Tcl_ListObjAppendElement(interp, itemPtr, elObj);
}
Tcl_ListObjAppendElement(interp, listPtr, itemPtr);
@@ -3929,8 +3935,7 @@ Tcl_LsearchObjCmd(
TclNewIndexObj(itemPtr, index+groupOffset);
for (j=0 ; j<sortInfo.indexc ; j++) {
Tcl_Obj *elObj;
size_t elValue = TclIndexDecode(sortInfo.indexv[j], listc);
TclNewIndexObj(elObj, elValue);
TclNewIndexObj(elObj, TclIndexDecode(sortInfo.indexv[j], listc));
Tcl_ListObjAppendElement(interp, itemPtr, elObj);
}
Tcl_SetObjResult(interp, itemPtr);
@@ -4111,10 +4116,10 @@ SequenceIdentifyArgument(
exprValueObj = argPtr;
} else {
if (floor(dvalue) == dvalue) {
exprValueObj = Tcl_NewWideIntObj(value);
TclNewIntObj(exprValueObj, value);
keyword = TCL_NUMBER_INT;
} else {
exprValueObj = Tcl_NewDoubleObj(dvalue);
TclNewDoubleObj(exprValueObj, dvalue);
keyword = TCL_NUMBER_DOUBLE;
}
}
@@ -4545,7 +4550,7 @@ Tcl_LsortObjCmd(
if (i + 2 == (size_t)objc) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"\"-command\" option must be followed "
"by comparison command", -1));
"by comparison command", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "ARGUMENT", "MISSING", NULL);
sortInfo.resultCode = TCL_ERROR;
goto done;
@@ -4632,7 +4637,7 @@ Tcl_LsortObjCmd(
if (i + 2 == (size_t)objc) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"\"-stride\" option must be "
"followed by stride length", -1));
"followed by stride length", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "ARGUMENT", "MISSING", NULL);
sortInfo.resultCode = TCL_ERROR;
goto done;
@@ -4643,7 +4648,7 @@ Tcl_LsortObjCmd(
}
if (wide < 2) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"stride length must be at least 2", -1));
"stride length must be at least 2", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LSORT",
"BADSTRIDE", NULL);
sortInfo.resultCode = TCL_ERROR;
@@ -4728,7 +4733,7 @@ Tcl_LsortObjCmd(
sortInfo.compareCmdPtr = newCommandPtr;
}
if (TclHasInternalRep(listObj,&tclArithSeriesType)) {
if (TclHasInternalRep(listObj,&tclArithSeriesType.objType)) {
sortInfo.resultCode = TclArithSeriesGetElements(interp,
listObj, &length, &listObjPtrs);
} else {
@@ -4765,7 +4770,7 @@ Tcl_LsortObjCmd(
if (groupOffset >= groupSize) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"when used with \"-stride\", the leading \"-index\""
" value must be within the group", -1));
" value must be within the group", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LSORT",
"BADINDEX", NULL);
sortInfo.resultCode = TCL_ERROR;
@@ -5292,7 +5297,7 @@ SortCompare(
if (TclGetIntFromObj(infoPtr->interp,
Tcl_GetObjResult(infoPtr->interp), &order) != TCL_OK) {
Tcl_SetObjResult(infoPtr->interp, Tcl_NewStringObj(
"-compare command returned non-integer result", -1));
"-compare command returned non-integer result", TCL_INDEX_NONE));
Tcl_SetErrorCode(infoPtr->interp, "TCL", "OPERATION", "LSORT",
"COMPARISONFAILED", NULL);
infoPtr->resultCode = TCL_ERROR;
+44 -41
View File
@@ -227,7 +227,7 @@ Tcl_RegexpObjCmd(
if (doinline && ((objc - 2) != 0)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"regexp match variables not allowed when using -inline", -1));
"regexp match variables not allowed when using -inline", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "REGEXP",
"MIX_VAR_INLINE", NULL);
goto optionError;
@@ -261,7 +261,7 @@ Tcl_RegexpObjCmd(
if (startIndex) {
TclGetIntForIndexM(interp, startIndex, stringLength, &offset);
Tcl_DecrRefCount(startIndex);
if (offset == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(offset)) {
offset = TCL_INDEX_START;
}
}
@@ -372,7 +372,7 @@ Tcl_RegexpObjCmd(
* area. (Scriptics Bug 4391/SF Bug #219232)
*/
if (i <= (int)info.nsubs && info.matches[i].start != TCL_INDEX_NONE) {
if (i <= (int)info.nsubs && !TCL_SIZE_ISNEG(info.matches[i].start)) {
start = offset + info.matches[i].start;
end = offset + info.matches[i].end;
@@ -585,7 +585,7 @@ Tcl_RegsubObjCmd(
TclGetIntForIndexM(interp, startIndex, stringLength, &offset);
Tcl_DecrRefCount(startIndex);
if (offset == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(offset)) {
offset = TCL_INDEX_START;
}
}
@@ -784,7 +784,7 @@ Tcl_RegsubObjCmd(
for (idx = 0 ; idx <= info.nsubs ; idx++) {
subStart = info.matches[idx].start;
subEnd = info.matches[idx].end;
if ((subStart != TCL_INDEX_NONE) && (subEnd != TCL_INDEX_NONE)) {
if (!TCL_SIZE_ISNEG(subStart) && !TCL_SIZE_ISNEG(subEnd)) {
args[idx + numParts] = Tcl_NewUnicodeObj(
wstring + offset + subStart, subEnd - subStart);
} else {
@@ -888,7 +888,7 @@ Tcl_RegsubObjCmd(
if (idx <= info.nsubs) {
subStart = info.matches[idx].start;
subEnd = info.matches[idx].end;
if ((subStart != TCL_INDEX_NONE) && (subEnd != TCL_INDEX_NONE)) {
if (!TCL_SIZE_ISNEG(subStart) && !TCL_SIZE_ISNEG(subEnd)) {
Tcl_AppendUnicodeToObj(resultPtr,
wstring + offset + subStart, subEnd - subStart);
}
@@ -1411,7 +1411,7 @@ StringIndexCmd(
return TCL_ERROR;
}
if ((index != TCL_INDEX_NONE) && (index + 1 <= end + 1)) {
if (!TCL_SIZE_ISNEG(index) && (index + 1 <= end + 1)) {
int ch = Tcl_GetUniChar(objv[1], index);
if (ch == -1) {
@@ -1481,7 +1481,7 @@ StringInsertCmd(
return TCL_ERROR;
}
if (index == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(index)) {
index = TCL_INDEX_START;
}
if (index > length) {
@@ -1612,7 +1612,7 @@ StringIsCmd(
case STR_IS_BOOL:
case STR_IS_TRUE:
case STR_IS_FALSE:
if (!TclHasInternalRep(objPtr, &tclBooleanType)
if (!TclHasInternalRep(objPtr, &tclBooleanType.objType)
&& (TCL_OK != TclSetBooleanFromAny(NULL, objPtr))) {
if (strict) {
result = 0;
@@ -1682,9 +1682,9 @@ StringIsCmd(
chcomp = Tcl_UniCharIsDigit;
break;
case STR_IS_DOUBLE: {
if (TclHasInternalRep(objPtr, &tclDoubleType) ||
TclHasInternalRep(objPtr, &tclIntType) ||
TclHasInternalRep(objPtr, &tclBignumType)) {
if (TclHasInternalRep(objPtr, &tclDoubleType.objType) ||
TclHasInternalRep(objPtr, &tclIntType.objType) ||
TclHasInternalRep(objPtr, &tclBignumType.objType)) {
break;
}
string1 = Tcl_GetStringFromObj(objPtr, &length1);
@@ -1695,7 +1695,7 @@ StringIsCmd(
goto str_is_done;
}
end = string1 + length1;
if (TclParseNumber(NULL, objPtr, NULL, NULL, -1,
if (TclParseNumber(NULL, objPtr, NULL, NULL, TCL_INDEX_NONE,
(const char **) &stop, 0) != TCL_OK) {
result = 0;
failat = 0;
@@ -1713,8 +1713,8 @@ StringIsCmd(
break;
case STR_IS_INT:
case STR_IS_ENTIER:
if (TclHasInternalRep(objPtr, &tclIntType) ||
TclHasInternalRep(objPtr, &tclBignumType)) {
if (TclHasInternalRep(objPtr, &tclIntType.objType) ||
TclHasInternalRep(objPtr, &tclBignumType.objType)) {
break;
}
string1 = Tcl_GetStringFromObj(objPtr, &length1);
@@ -1725,7 +1725,7 @@ StringIsCmd(
goto str_is_done;
}
end = string1 + length1;
if (TclParseNumber(NULL, objPtr, NULL, NULL, -1,
if (TclParseNumber(NULL, objPtr, NULL, NULL, TCL_INDEX_NONE,
(const char **) &stop, TCL_PARSE_INTEGER_ONLY) == TCL_OK) {
if (stop == end) {
/*
@@ -1776,7 +1776,7 @@ StringIsCmd(
break;
}
end = string1 + length1;
if (TclParseNumber(NULL, objPtr, NULL, NULL, -1,
if (TclParseNumber(NULL, objPtr, NULL, NULL, TCL_INDEX_NONE,
(const char **) &stop, TCL_PARSE_INTEGER_ONLY) == TCL_OK) {
if (stop == end) {
/*
@@ -2047,7 +2047,7 @@ StringMapCmd(
*/
Tcl_SetObjResult(interp,
Tcl_NewStringObj("char map list unbalanced", -1));
Tcl_NewStringObj("char map list unbalanced", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "MAP",
"UNBALANCED", NULL);
return TCL_ERROR;
@@ -2307,7 +2307,7 @@ StringRangeCmd(
return TCL_ERROR;
}
if (last != TCL_INDEX_NONE) {
if (!TCL_SIZE_ISNEG(last)) {
Tcl_SetObjResult(interp, Tcl_GetRange(objv[1], first, last));
}
return TCL_OK;
@@ -2414,7 +2414,7 @@ StringRplcCmd(
* result is the original string.
*/
if ((last == TCL_INDEX_NONE) || /* Range ends before start of string */
if (TCL_SIZE_ISNEG(last) || /* Range ends before start of string */
(first + 1 > end + 1) || /* Range begins after end of string */
(last + 1 < first + 1)) { /* Range begins after it starts */
/*
@@ -2427,7 +2427,7 @@ StringRplcCmd(
} else {
Tcl_Obj *resultPtr;
if (first == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(first)) {
first = TCL_INDEX_START;
}
if (last + 1 > end + 1) {
@@ -2526,7 +2526,7 @@ StringStartCmd(
p = &string[index];
(void)TclUniCharToUCS4(p, &ch);
for (cur = index; cur != TCL_INDEX_NONE; cur--) {
for (cur = index; !TCL_SIZE_ISNEG(cur); cur--) {
int delta = 0;
const Tcl_UniChar *next;
@@ -2588,7 +2588,7 @@ StringEndCmd(
if (TclGetIntForIndexM(interp, objv[2], length-1, &index) != TCL_OK) {
return TCL_ERROR;
}
if (index == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(index)) {
index = TCL_INDEX_START;
}
if (index + 1 <= length + 1) {
@@ -2682,7 +2682,7 @@ StringEqualCmd(
*/
objv += objc-2;
match = TclStringCmp(objv[0], objv[1], 0, nocase, reqlength);
match = TclStringCmp(objv[0], objv[1], 1, nocase, reqlength);
Tcl_SetObjResult(interp, Tcl_NewBooleanObj(match ? 0 : 1));
return TCL_OK;
}
@@ -2906,7 +2906,7 @@ StringLowerCmd(
if (TclGetIntForIndexM(interp,objv[2],length1, &first) != TCL_OK) {
return TCL_ERROR;
}
if (first == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(first)) {
first = 0;
}
last = first;
@@ -2933,7 +2933,7 @@ StringLowerCmd(
length2 = Tcl_UtfToLower(string2);
Tcl_SetObjLength(resultPtr, length2 + (start - string1));
Tcl_AppendToObj(resultPtr, end, -1);
Tcl_AppendToObj(resultPtr, end, TCL_INDEX_NONE);
Tcl_SetObjResult(interp, resultPtr);
}
@@ -2991,7 +2991,7 @@ StringUpperCmd(
if (TclGetIntForIndexM(interp,objv[2],length1, &first) != TCL_OK) {
return TCL_ERROR;
}
if (first == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(first)) {
first = TCL_INDEX_START;
}
last = first;
@@ -3018,7 +3018,7 @@ StringUpperCmd(
length2 = Tcl_UtfToUpper(string2);
Tcl_SetObjLength(resultPtr, length2 + (start - string1));
Tcl_AppendToObj(resultPtr, end, -1);
Tcl_AppendToObj(resultPtr, end, TCL_INDEX_NONE);
Tcl_SetObjResult(interp, resultPtr);
}
@@ -3076,7 +3076,7 @@ StringTitleCmd(
if (TclGetIntForIndexM(interp,objv[2],length1, &first) != TCL_OK) {
return TCL_ERROR;
}
if (first == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(first)) {
first = TCL_INDEX_START;
}
last = first;
@@ -3103,7 +3103,7 @@ StringTitleCmd(
length2 = Tcl_UtfToTitle(string2);
Tcl_SetObjLength(resultPtr, length2 + (start - string1));
Tcl_AppendToObj(resultPtr, end, -1);
Tcl_AppendToObj(resultPtr, end, TCL_INDEX_NONE);
Tcl_SetObjResult(interp, resultPtr);
}
@@ -3583,7 +3583,7 @@ TclNRSwitchObjCmd(
size_t listc;
blist = objv[0];
if (TclListObjGetElementsM(interp, objv[0], &listc, &listv) != TCL_OK) {
if (TclListObjLengthM(interp, objv[0], &listc) != TCL_OK) {
return TCL_ERROR;
}
@@ -3596,6 +3596,9 @@ TclNRSwitchObjCmd(
"?-option ...? string {?pattern body ...? ?default body?}");
return TCL_ERROR;
}
if (TclListObjGetElementsM(interp, objv[0], &listc, &listv) != TCL_OK) {
return TCL_ERROR;
}
objc = listc;
objv = listv;
splitObjs = 1;
@@ -3609,7 +3612,7 @@ TclNRSwitchObjCmd(
if (objc % 2) {
Tcl_ResetResult(interp);
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"extra switch pattern with no body", -1));
"extra switch pattern with no body", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "SWITCH", "BADARM",
NULL);
@@ -3627,7 +3630,7 @@ TclNRSwitchObjCmd(
Tcl_AppendToObj(Tcl_GetObjResult(interp),
", this may be due to a comment incorrectly"
" placed outside of a switch body - see the"
" \"switch\" documentation", -1);
" \"switch\" documentation", TCL_INDEX_NONE);
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "SWITCH",
"BADARM", "COMMENT?", NULL);
break;
@@ -3977,7 +3980,7 @@ Tcl_ThrowObjCmd(
return TCL_ERROR;
} else if (len < 1) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"type must be non-empty list", -1));
"type must be non-empty list", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "THROW", "BADEXCEPTION",
NULL);
return TCL_ERROR;
@@ -4073,9 +4076,9 @@ Tcl_TimeObjCmd(
* Use int obj since we know time is not fractional. [Bug 1202178]
*/
objs[0] = Tcl_NewWideIntObj((count <= 0) ? 0 : (Tcl_WideInt)totalMicroSec);
TclNewIntObj(objs[0], (count <= 0) ? 0 : (Tcl_WideInt)totalMicroSec);
} else {
objs[0] = Tcl_NewDoubleObj(totalMicroSec/count);
TclNewDoubleObj(objs[0], totalMicroSec/count);
}
/*
@@ -4560,7 +4563,7 @@ Tcl_TimeRateObjCmd(
if (measureOverhead > ((double) usec) / count) {
measureOverhead = ((double) usec) / count;
}
objs[0] = Tcl_NewDoubleObj(measureOverhead);
TclNewDoubleObj(objs[0], measureOverhead);
TclNewLiteralStringObj(objs[1], "\xC2\xB5s/#-overhead"); /* mics */
objs += 2;
}
@@ -4715,7 +4718,7 @@ TclNRTryObjCmd(
case TryFinally: /* finally script */
if (i < objc-2) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"finally clause must be last", -1));
"finally clause must be last", TCL_INDEX_NONE));
Tcl_DecrRefCount(handlersObj);
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "TRY", "FINALLY",
"NONTERMINAL", NULL);
@@ -4723,7 +4726,7 @@ TclNRTryObjCmd(
} else if (i == objc-1) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"wrong # args to finally clause: must be"
" \"... finally script\"", -1));
" \"... finally script\"", TCL_INDEX_NONE));
Tcl_DecrRefCount(handlersObj);
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "TRY", "FINALLY",
"ARGUMENT", NULL);
@@ -4736,7 +4739,7 @@ TclNRTryObjCmd(
if (i > objc-4) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"wrong # args to on clause: must be \"... on code"
" variableList script\"", -1));
" variableList script\"", TCL_INDEX_NONE));
Tcl_DecrRefCount(handlersObj);
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "TRY", "ON",
"ARGUMENT", NULL);
@@ -4797,7 +4800,7 @@ TclNRTryObjCmd(
}
if (bodyShared) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"last non-finally clause must not have a body of \"-\"", -1));
"last non-finally clause must not have a body of \"-\"", TCL_INDEX_NONE));
Tcl_DecrRefCount(handlersObj);
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "TRY", "BADFALLTHROUGH",
NULL);
+38 -38
View File
@@ -287,7 +287,7 @@ TclCompileArraySetCmd(
Tcl_Token *varTokenPtr, *dataTokenPtr;
int isScalar, localIndex, code = TCL_OK;
int isDataLiteral, isDataValid, isDataEven;
size_t len;
Tcl_Size len;
int keyVar, valVar, infoIndex;
int fwd, offsetBack, offsetFwd;
Tcl_Obj *literalObj;
@@ -393,7 +393,7 @@ TclCompileArraySetCmd(
infoPtr = (ForeachInfo *)Tcl_Alloc(offsetof(ForeachInfo, varLists) + sizeof(ForeachVarList *));
infoPtr->numLists = 1;
infoPtr->varLists[0] = (ForeachVarList *)Tcl_Alloc(offsetof(ForeachVarList, varIndexes) + 2 * sizeof(size_t));
infoPtr->varLists[0] = (ForeachVarList *)Tcl_Alloc(offsetof(ForeachVarList, varIndexes) + 2 * sizeof(Tcl_Size));
infoPtr->varLists[0]->numVars = 2;
infoPtr->varLists[0]->varIndexes[0] = keyVar;
infoPtr->varLists[0]->varIndexes[1] = valVar;
@@ -891,7 +891,7 @@ TclCompileConcatCmd(
if (listObj != NULL) {
Tcl_Obj **objs;
const char *bytes;
size_t len, slen;
Tcl_Size len, slen;
TclListObjGetElementsM(NULL, listObj, &len, &objs);
objPtr = Tcl_ConcatObj(len, objs);
@@ -1078,7 +1078,7 @@ TclCompileDictIncrCmd(
if (parsePtr->numWords == 4) {
const char *word;
size_t numBytes;
Tcl_Size numBytes;
int code;
Tcl_Token *incrTokenPtr;
Tcl_Obj *intObj;
@@ -1293,7 +1293,7 @@ TclCompileDictCreateCmd(
Tcl_Obj *keyObj, *valueObj, *dictObj;
const char *bytes;
int i;
size_t len;
Tcl_Size len;
if ((parsePtr->numWords & 1) == 0) {
return TCL_ERROR;
@@ -1528,7 +1528,7 @@ CompileDictEachCmd(
Tcl_Token *varsTokenPtr, *dictTokenPtr, *bodyTokenPtr;
int keyVarIndex, valueVarIndex, nameChars, loopRange, catchRange;
int infoIndex, jumpDisplacement, bodyTargetOffset, emptyTargetOffset;
size_t numVars;
Tcl_Size numVars;
int endTargetOffset;
int collectVar = -1; /* Index of temp var holding the result
* dict. */
@@ -2293,14 +2293,14 @@ PrintDictUpdateInfo(
void *clientData,
Tcl_Obj *appendObj,
TCL_UNUSED(ByteCode *),
TCL_UNUSED(size_t))
TCL_UNUSED(TCL_HASH_TYPE))
{
DictUpdateInfo *duiPtr = (DictUpdateInfo *)clientData;
size_t i;
Tcl_Size i;
for (i=0 ; i<duiPtr->length ; i++) {
if (i) {
Tcl_AppendToObj(appendObj, ", ", -1);
Tcl_AppendToObj(appendObj, ", ", TCL_INDEX_NONE);
}
Tcl_AppendPrintfToObj(appendObj, "%%v%" TCL_Z_MODIFIER "u", duiPtr->varIndices[i]);
}
@@ -2311,10 +2311,10 @@ DisassembleDictUpdateInfo(
void *clientData,
Tcl_Obj *dictObj,
TCL_UNUSED(ByteCode *),
TCL_UNUSED(size_t))
TCL_UNUSED(TCL_HASH_TYPE))
{
DictUpdateInfo *duiPtr = (DictUpdateInfo *)clientData;
size_t i;
Tcl_Size i;
Tcl_Obj *variables;
TclNewObj(variables);
@@ -2322,7 +2322,7 @@ DisassembleDictUpdateInfo(
Tcl_ListObjAppendElement(NULL, variables,
Tcl_NewWideIntObj(duiPtr->varIndices[i]));
}
Tcl_DictObjPut(NULL, dictObj, Tcl_NewStringObj("variables", -1),
Tcl_DictObjPut(NULL, dictObj, Tcl_NewStringObj("variables", TCL_INDEX_NONE),
variables);
}
@@ -2690,7 +2690,7 @@ CompileEachloopCmd(
Tcl_Token *tokenPtr, *bodyTokenPtr;
int jumpBackOffset, infoIndex, range;
int numWords, numLists, i, code = TCL_OK;
size_t j;
Tcl_Size j;
Tcl_Obj *varListObj = NULL;
/*
@@ -2742,7 +2742,7 @@ CompileEachloopCmd(
i < numWords-1;
i++, tokenPtr = TokenAfter(tokenPtr)) {
ForeachVarList *varListPtr;
size_t numVars;
Tcl_Size numVars;
if (i%2 != 1) {
continue;
@@ -2762,7 +2762,7 @@ CompileEachloopCmd(
}
varListPtr = (ForeachVarList *)Tcl_Alloc(offsetof(ForeachVarList, varIndexes)
+ numVars * sizeof(size_t));
+ numVars * sizeof(Tcl_Size));
varListPtr->numVars = numVars;
infoPtr->varLists[i/2] = varListPtr;
infoPtr->numLists++;
@@ -2771,7 +2771,7 @@ CompileEachloopCmd(
Tcl_Obj *varNameObj;
const char *bytes;
int varIndex;
size_t length;
Tcl_Size length;
Tcl_ListObjIndex(NULL, varListObj, j, &varNameObj);
@@ -2976,17 +2976,17 @@ PrintForeachInfo(
void *clientData,
Tcl_Obj *appendObj,
TCL_UNUSED(ByteCode *),
TCL_UNUSED(size_t))
TCL_UNUSED(TCL_HASH_TYPE))
{
ForeachInfo *infoPtr = (ForeachInfo *)clientData;
ForeachVarList *varsPtr;
size_t i, j;
Tcl_Size i, j;
Tcl_AppendToObj(appendObj, "data=[", -1);
Tcl_AppendToObj(appendObj, "data=[", TCL_INDEX_NONE);
for (i=0 ; i<infoPtr->numLists ; i++) {
if (i) {
Tcl_AppendToObj(appendObj, ", ", -1);
Tcl_AppendToObj(appendObj, ", ", TCL_INDEX_NONE);
}
Tcl_AppendPrintfToObj(appendObj, "%%v%" TCL_Z_MODIFIER "u",
(infoPtr->firstValueTemp + i));
@@ -2995,19 +2995,19 @@ PrintForeachInfo(
infoPtr->loopCtTemp);
for (i=0 ; i<infoPtr->numLists ; i++) {
if (i) {
Tcl_AppendToObj(appendObj, ",", -1);
Tcl_AppendToObj(appendObj, ",", TCL_INDEX_NONE);
}
Tcl_AppendPrintfToObj(appendObj, "\n\t\t it%%v%" TCL_Z_MODIFIER "u\t[",
(infoPtr->firstValueTemp + i));
varsPtr = infoPtr->varLists[i];
for (j=0 ; j<varsPtr->numVars ; j++) {
if (j) {
Tcl_AppendToObj(appendObj, ", ", -1);
Tcl_AppendToObj(appendObj, ", ", TCL_INDEX_NONE);
}
Tcl_AppendPrintfToObj(appendObj, "%%v%" TCL_Z_MODIFIER "u",
varsPtr->varIndexes[j]);
}
Tcl_AppendToObj(appendObj, "]", -1);
Tcl_AppendToObj(appendObj, "]", TCL_INDEX_NONE);
}
}
@@ -3016,28 +3016,28 @@ PrintNewForeachInfo(
void *clientData,
Tcl_Obj *appendObj,
TCL_UNUSED(ByteCode *),
TCL_UNUSED(size_t))
TCL_UNUSED(TCL_HASH_TYPE))
{
ForeachInfo *infoPtr = (ForeachInfo *)clientData;
ForeachVarList *varsPtr;
size_t i, j;
Tcl_Size i, j;
Tcl_AppendPrintfToObj(appendObj, "jumpOffset=%+" TCL_Z_MODIFIER "d, vars=",
infoPtr->loopCtTemp);
for (i=0 ; i<infoPtr->numLists ; i++) {
if (i) {
Tcl_AppendToObj(appendObj, ",", -1);
Tcl_AppendToObj(appendObj, ",", TCL_INDEX_NONE);
}
Tcl_AppendToObj(appendObj, "[", -1);
Tcl_AppendToObj(appendObj, "[", TCL_INDEX_NONE);
varsPtr = infoPtr->varLists[i];
for (j=0 ; j<varsPtr->numVars ; j++) {
if (j) {
Tcl_AppendToObj(appendObj, ",", -1);
Tcl_AppendToObj(appendObj, ",", TCL_INDEX_NONE);
}
Tcl_AppendPrintfToObj(appendObj, "%%v%" TCL_Z_MODIFIER "u",
varsPtr->varIndexes[j]);
}
Tcl_AppendToObj(appendObj, "]", -1);
Tcl_AppendToObj(appendObj, "]", TCL_INDEX_NONE);
}
}
@@ -3046,11 +3046,11 @@ DisassembleForeachInfo(
void *clientData,
Tcl_Obj *dictObj,
TCL_UNUSED(ByteCode *),
TCL_UNUSED(size_t))
TCL_UNUSED(TCL_HASH_TYPE))
{
ForeachInfo *infoPtr = (ForeachInfo *)clientData;
ForeachVarList *varsPtr;
size_t i, j;
Tcl_Size i, j;
Tcl_Obj *objPtr, *innerPtr;
/*
@@ -3062,13 +3062,13 @@ DisassembleForeachInfo(
Tcl_ListObjAppendElement(NULL, objPtr,
Tcl_NewWideIntObj(infoPtr->firstValueTemp + i));
}
Tcl_DictObjPut(NULL, dictObj, Tcl_NewStringObj("data", -1), objPtr);
Tcl_DictObjPut(NULL, dictObj, Tcl_NewStringObj("data", TCL_INDEX_NONE), objPtr);
/*
* Loop counter.
*/
Tcl_DictObjPut(NULL, dictObj, Tcl_NewStringObj("loop", -1),
Tcl_DictObjPut(NULL, dictObj, Tcl_NewStringObj("loop", TCL_INDEX_NONE),
Tcl_NewWideIntObj(infoPtr->loopCtTemp));
/*
@@ -3085,7 +3085,7 @@ DisassembleForeachInfo(
}
Tcl_ListObjAppendElement(NULL, objPtr, innerPtr);
}
Tcl_DictObjPut(NULL, dictObj, Tcl_NewStringObj("assign", -1), objPtr);
Tcl_DictObjPut(NULL, dictObj, Tcl_NewStringObj("assign", TCL_INDEX_NONE), objPtr);
}
static void
@@ -3093,18 +3093,18 @@ DisassembleNewForeachInfo(
void *clientData,
Tcl_Obj *dictObj,
TCL_UNUSED(ByteCode *),
TCL_UNUSED(size_t))
TCL_UNUSED(TCL_HASH_TYPE))
{
ForeachInfo *infoPtr = (ForeachInfo *)clientData;
ForeachVarList *varsPtr;
size_t i, j;
Tcl_Size i, j;
Tcl_Obj *objPtr, *innerPtr;
/*
* Jump offset.
*/
Tcl_DictObjPut(NULL, dictObj, Tcl_NewStringObj("jumpOffset", -1),
Tcl_DictObjPut(NULL, dictObj, Tcl_NewStringObj("jumpOffset", TCL_INDEX_NONE),
Tcl_NewWideIntObj(infoPtr->loopCtTemp));
/*
@@ -3121,7 +3121,7 @@ DisassembleNewForeachInfo(
}
Tcl_ListObjAppendElement(NULL, objPtr, innerPtr);
}
Tcl_DictObjPut(NULL, dictObj, Tcl_NewStringObj("assign", -1), objPtr);
Tcl_DictObjPut(NULL, dictObj, Tcl_NewStringObj("assign", TCL_INDEX_NONE), objPtr);
}
/*
+1 -1
View File
@@ -2378,7 +2378,7 @@ TclCompileReturnCmd(
ExceptionRange range = envPtr->exceptArrayPtr[index];
if ((range.type == CATCH_EXCEPTION_RANGE)
&& (range.catchOffset == TCL_INDEX_NONE)) {
&& TCL_SIZE_ISNEG(range.catchOffset)) {
enclosingCatch = 1;
break;
}
+31 -31
View File
@@ -897,7 +897,7 @@ TclCompileStringLenCmd(
char buf[TCL_INTEGER_SPACE];
size_t len = Tcl_GetCharLength(objPtr);
len = sprintf(buf, "%" TCL_Z_MODIFIER "u", len);
len = snprintf(buf, sizeof(buf), "%" TCL_Z_MODIFIER "u", len);
PushLiteral(envPtr, buf, len);
} else {
SetLineInformation(1);
@@ -921,7 +921,7 @@ TclCompileStringMapCmd(
Tcl_Token *mapTokenPtr, *stringTokenPtr;
Tcl_Obj *mapObj, **objv;
const char *bytes;
size_t len, slen;
Tcl_Size len, slen;
/*
* We only handle the case:
@@ -1524,7 +1524,7 @@ TclSubstCompile(
{
Tcl_Token *endTokenPtr, *tokenPtr;
int breakOffset = 0, count = 0;
size_t bline = line;
Tcl_Size bline = line;
Tcl_Parse parse;
Tcl_InterpState state = NULL;
@@ -1549,7 +1549,7 @@ TclSubstCompile(
for (endTokenPtr = tokenPtr + parse.numTokens;
tokenPtr < endTokenPtr; tokenPtr = TokenAfter(tokenPtr)) {
size_t length;
Tcl_Size length;
int literal, catchRange, breakJump;
char buf[4] = "";
JumpFixup startFixup, okFixup, returnFixup, breakFixup;
@@ -1581,7 +1581,7 @@ TclSubstCompile(
*/
if (tokenPtr->numComponents > 1) {
size_t i;
Tcl_Size i;
int foundCommand = 0;
for (i=2 ; i<=tokenPtr->numComponents ; i++) {
@@ -1945,8 +1945,8 @@ TclCompileSwitchCmd(
if (numWords == 1) {
const char *bytes;
size_t maxLen, numBytes;
size_t bline; /* TIP #280: line of the pattern/action list,
Tcl_Size maxLen, numBytes;
Tcl_Size bline; /* TIP #280: line of the pattern/action list,
* and start of list for when tracking the
* location. This list comes immediately after
* the value we switch on. */
@@ -2590,7 +2590,7 @@ PrintJumptableInfo(
void *clientData,
Tcl_Obj *appendObj,
TCL_UNUSED(ByteCode *),
size_t pcOffset)
TCL_HASH_TYPE pcOffset)
{
JumptableInfo *jtPtr = (JumptableInfo *)clientData;
Tcl_HashEntry *hPtr;
@@ -2604,9 +2604,9 @@ PrintJumptableInfo(
offset = PTR2INT(Tcl_GetHashValue(hPtr));
if (i++) {
Tcl_AppendToObj(appendObj, ", ", -1);
Tcl_AppendToObj(appendObj, ", ", TCL_INDEX_NONE);
if (i%4==0) {
Tcl_AppendToObj(appendObj, "\n\t\t", -1);
Tcl_AppendToObj(appendObj, "\n\t\t", TCL_INDEX_NONE);
}
}
Tcl_AppendPrintfToObj(appendObj, "\"%s\"->pc %" TCL_Z_MODIFIER "u",
@@ -2619,7 +2619,7 @@ DisassembleJumptableInfo(
void *clientData,
Tcl_Obj *dictObj,
TCL_UNUSED(ByteCode *),
TCL_UNUSED(size_t))
TCL_UNUSED(TCL_HASH_TYPE))
{
JumptableInfo *jtPtr = (JumptableInfo *)clientData;
Tcl_Obj *mapping;
@@ -2633,10 +2633,10 @@ DisassembleJumptableInfo(
for (; hPtr ; hPtr = Tcl_NextHashEntry(&search)) {
keyPtr = (const char *)Tcl_GetHashKey(&jtPtr->hashTable, hPtr);
offset = PTR2INT(Tcl_GetHashValue(hPtr));
Tcl_DictObjPut(NULL, mapping, Tcl_NewStringObj(keyPtr, -1),
Tcl_DictObjPut(NULL, mapping, Tcl_NewStringObj(keyPtr, TCL_INDEX_NONE),
Tcl_NewWideIntObj(offset));
}
Tcl_DictObjPut(NULL, dictObj, Tcl_NewStringObj("mapping", -1), mapping);
Tcl_DictObjPut(NULL, dictObj, Tcl_NewStringObj("mapping", TCL_INDEX_NONE), mapping);
}
/*
@@ -2716,7 +2716,7 @@ TclCompileThrowCmd(
Tcl_Token *codeToken, *msgToken;
Tcl_Obj *objPtr;
int codeKnown, codeIsList, codeIsValid;
size_t len;
Tcl_Size len;
if (numWords != 3) {
return TCL_ERROR;
@@ -2857,7 +2857,7 @@ TclCompileTryCmd(
for (i=0 ; i<numHandlers ; i++) {
Tcl_Obj *tmpObj, **objv;
size_t objc;
Tcl_Size objc;
if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) {
goto failedToCompile;
@@ -2922,7 +2922,7 @@ TclCompileTryCmd(
goto failedToCompile;
}
if (objc > 0) {
size_t len;
Tcl_Size len;
const char *varname = Tcl_GetStringFromObj(objv[0], &len);
resultVarIndices[i] = LocalScalar(varname, len, envPtr);
@@ -2934,7 +2934,7 @@ TclCompileTryCmd(
resultVarIndices[i] = -1;
}
if (objc == 2) {
size_t len;
Tcl_Size len;
const char *varname = Tcl_GetStringFromObj(objv[1], &len);
optionVarIndices[i] = LocalScalar(varname, len, envPtr);
@@ -3056,7 +3056,7 @@ IssueTryClausesInstructions(
DefineLineInformation; /* TIP #280 */
int range, resultVar, optionsVar;
int i, j, forwardsNeedFixing = 0, trapZero = 0, afterBody = 0;
size_t slen, len;
Tcl_Size slen, len;
int *addrsToFix, *forwardsToFix, notCodeJumpSource, notECJumpSource;
int *noError;
char buf[TCL_INTEGER_SPACE];
@@ -3124,7 +3124,7 @@ IssueTryClausesInstructions(
for (i=0 ; i<numHandlers ; i++) {
noError[i] = -1;
sprintf(buf, "%d", matchCodes[i]);
snprintf(buf, sizeof(buf), "%d", matchCodes[i]);
OP( DUP);
PushLiteral(envPtr, buf, strlen(buf));
OP( EQ);
@@ -3270,7 +3270,7 @@ IssueTryClausesFinallyInstructions(
int trapZero = 0, afterBody = 0, finalOK, finalError, noFinalError;
int *addrsToFix, *forwardsToFix, notCodeJumpSource, notECJumpSource;
char buf[TCL_INTEGER_SPACE];
size_t slen, len;
Tcl_Size slen, len;
resultVar = AnonymousLocal(envPtr);
optionsVar = AnonymousLocal(envPtr);
@@ -3337,7 +3337,7 @@ IssueTryClausesFinallyInstructions(
int noTrapError, trapError;
const char *p;
sprintf(buf, "%d", matchCodes[i]);
snprintf(buf, sizeof(buf), "%d", matchCodes[i]);
OP( DUP);
PushLiteral(envPtr, buf, strlen(buf));
OP( EQ);
@@ -3680,7 +3680,7 @@ TclCompileUnsetCmd(
}
if (varCount == 0) {
const char *bytes;
size_t len;
Tcl_Size len;
bytes = Tcl_GetStringFromObj(leadingWord, &len);
if (i == 1 && len == 11 && !strncmp("-nocomplain", bytes, 11)) {
@@ -4073,7 +4073,7 @@ CompileAssociativeBinaryOpCmd(
{
DefineLineInformation; /* TIP #280 */
Tcl_Token *tokenPtr = parsePtr->tokenPtr;
size_t words;
Tcl_Size words;
/* TODO: Consider support for compiling expanded args. */
for (words=1 ; words<parsePtr->numWords ; words++) {
@@ -4081,13 +4081,13 @@ CompileAssociativeBinaryOpCmd(
CompileWord(envPtr, tokenPtr, interp, words);
}
if (parsePtr->numWords <= 2) {
PushLiteral(envPtr, identity, -1);
PushLiteral(envPtr, identity, TCL_INDEX_NONE);
words++;
}
if (words > 3) {
/*
* Reverse order of arguments to get precise agreement with [expr] in
* calcuations, including roundoff errors.
* calculations, including roundoff errors.
*/
OP4( REVERSE, words-1);
@@ -4176,7 +4176,7 @@ CompileComparisonOpCmd(
return TCL_ERROR;
} else {
int tmpIndex = AnonymousLocal(envPtr);
size_t words;
Tcl_Size words;
tokenPtr = TokenAfter(parsePtr->tokenPtr);
CompileWord(envPtr, tokenPtr, interp, 1);
@@ -4312,7 +4312,7 @@ TclCompilePowOpCmd(
{
DefineLineInformation; /* TIP #280 */
Tcl_Token *tokenPtr = parsePtr->tokenPtr;
size_t words;
Tcl_Size words;
/*
* This one has its own implementation because the ** operator is the only
@@ -4513,7 +4513,7 @@ TclCompileMinusOpCmd(
{
DefineLineInformation; /* TIP #280 */
Tcl_Token *tokenPtr = parsePtr->tokenPtr;
size_t words;
Tcl_Size words;
/* TODO: Consider support for compiling expanded args. */
if (parsePtr->numWords == 1) {
@@ -4538,7 +4538,7 @@ TclCompileMinusOpCmd(
/*
* Reverse order of arguments to get precise agreement with [expr] in
* calcuations, including roundoff errors.
* calculations, including roundoff errors.
*/
TclEmitInstInt4(INST_REVERSE, words-1, envPtr);
@@ -4558,7 +4558,7 @@ TclCompileDivOpCmd(
{
DefineLineInformation; /* TIP #280 */
Tcl_Token *tokenPtr = parsePtr->tokenPtr;
size_t words;
Tcl_Size words;
/* TODO: Consider support for compiling expanded args. */
if (parsePtr->numWords == 1) {
@@ -4582,7 +4582,7 @@ TclCompileDivOpCmd(
/*
* Reverse order of arguments to get precise agreement with [expr] in
* calcuations, including roundoff errors.
* calculations, including roundoff errors.
*/
TclEmitInstInt4(INST_REVERSE, words-1, envPtr);
+9 -9
View File
@@ -798,14 +798,14 @@ ParseExpr(
switch (start[1]) {
case 'b':
Tcl_AppendToObj(post,
" (invalid binary number?)", -1);
" (invalid binary number?)", TCL_INDEX_NONE);
parsePtr->errorType = TCL_PARSE_BAD_NUMBER;
errCode = "BADNUMBER";
subErrCode = "BINARY";
break;
case 'o':
Tcl_AppendToObj(post,
" (invalid octal number?)", -1);
" (invalid octal number?)", TCL_INDEX_NONE);
parsePtr->errorType = TCL_PARSE_BAD_NUMBER;
errCode = "BADNUMBER";
subErrCode = "OCTAL";
@@ -813,7 +813,7 @@ ParseExpr(
default:
if (isdigit(UCHAR(start[1]))) {
Tcl_AppendToObj(post,
" (invalid octal number?)", -1);
" (invalid octal number?)", TCL_INDEX_NONE);
parsePtr->errorType = TCL_PARSE_BAD_NUMBER;
errCode = "BADNUMBER";
subErrCode = "OCTAL";
@@ -1462,7 +1462,7 @@ ParseExpr(
*/
if (post != NULL) {
Tcl_AppendToObj(msg, ";\n", -1);
Tcl_AppendToObj(msg, ";\n", TCL_INDEX_NONE);
Tcl_AppendObjToObj(msg, post);
Tcl_DecrRefCount(post);
}
@@ -1860,7 +1860,7 @@ int
Tcl_ParseExpr(
Tcl_Interp *interp, /* Used for error reporting. */
const char *start, /* Start of source string to parse. */
size_t numBytes, /* Number of bytes in string. If -1, the
Tcl_Size numBytes, /* Number of bytes in string. If -1, the
* string consists of all bytes up to the
* first null character. */
Tcl_Parse *parsePtr) /* Structure to fill with information about
@@ -1876,7 +1876,7 @@ Tcl_ParseExpr(
TclNewObj(litList);
TclNewObj(funcList);
if (numBytes == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(numBytes)) {
numBytes = (start ? strlen(start) : 0);
}
@@ -2111,7 +2111,7 @@ ParseLexeme(
* Example: Inf + luence + () becomes a valid function call.
* [Bug 3401704]
*/
if (TclHasInternalRep(literal, &tclDoubleType)) {
if (TclHasInternalRep(literal, &tclDoubleType.objType)) {
const char *p = start;
while (p < end) {
@@ -2197,7 +2197,7 @@ void
TclCompileExpr(
Tcl_Interp *interp, /* Used for error reporting. */
const char *script, /* The source script to compile. */
size_t numBytes, /* Number of bytes in script. */
Tcl_Size numBytes, /* Number of bytes in script. */
CompileEnv *envPtr, /* Holds resulting instructions. */
int optimize) /* 0 for one-off expressions. */
{
@@ -2790,7 +2790,7 @@ TclVariadicOpCmd(
nodes[1].p.parent = 0;
} else {
if (lexeme == DIVIDE) {
litObjv[0] = Tcl_NewDoubleObj(1.0);
TclNewDoubleObj(litObjv[0], 1.0);
} else {
TclNewIntObj(litObjv[0], occdPtr->i.identity);
}
+47 -47
View File
@@ -680,9 +680,9 @@ static void DupByteCodeInternalRep(Tcl_Obj *srcPtr,
static unsigned char * EncodeCmdLocMap(CompileEnv *envPtr,
ByteCode *codePtr, unsigned char *startPtr);
static void EnterCmdExtentData(CompileEnv *envPtr,
size_t cmdNumber, size_t numSrcBytes, size_t numCodeBytes);
Tcl_Size cmdNumber, Tcl_Size numSrcBytes, Tcl_Size numCodeBytes);
static void EnterCmdStartData(CompileEnv *envPtr,
size_t cmdNumber, size_t srcOffset, size_t codeOffset);
Tcl_Size cmdNumber, Tcl_Size srcOffset, Tcl_Size codeOffset);
static void FreeByteCodeInternalRep(Tcl_Obj *objPtr);
static void FreeSubstCodeInternalRep(Tcl_Obj *objPtr);
static int GetCmdLocEncodingSize(CompileEnv *envPtr);
@@ -699,9 +699,9 @@ static void StartExpanding(CompileEnv *envPtr);
* TIP #280: Helper for building the per-word line information of all compiled
* commands.
*/
static void EnterCmdWordData(ExtCmdLoc *eclPtr, size_t srcOffset,
static void EnterCmdWordData(ExtCmdLoc *eclPtr, Tcl_Size srcOffset,
Tcl_Token *tokenPtr, const char *cmd,
size_t numWords, size_t line, int *clNext, int **lines,
Tcl_Size numWords, Tcl_Size line, int *clNext, int **lines,
CompileEnv *envPtr);
static void ReleaseCmdWordData(ExtCmdLoc *eclPtr);
@@ -776,7 +776,7 @@ TclSetByteCodeFromAny(
Interp *iPtr = (Interp *) interp;
CompileEnv compEnv; /* Compilation environment structure allocated
* in frame. */
size_t length;
Tcl_Size length;
int result = TCL_OK;
const char *stringPtr;
Proc *procPtr = iPtr->compiledProcPtr;
@@ -1391,7 +1391,7 @@ static void
ReleaseCmdWordData(
ExtCmdLoc *eclPtr)
{
size_t i;
Tcl_Size i;
if (eclPtr->type == TCL_LOCATION_SOURCE) {
Tcl_DecrRefCount(eclPtr->path);
@@ -1553,7 +1553,7 @@ TclInitCompileEnv(
pc = 1;
}
if ((ctxPtr->nline <= (size_t)word) || (ctxPtr->line[word] < 0)) {
if ((ctxPtr->nline <= (Tcl_Size)word) || (ctxPtr->line[word] < 0)) {
/*
* Word is not a literal, relative counting.
*/
@@ -1647,7 +1647,7 @@ TclFreeCompileEnv(
* have transferred to it.
*/
size_t i;
Tcl_Size i;
LiteralEntry *entryPtr = envPtr->literalArrayPtr;
AuxData *auxDataPtr = envPtr->auxDataArrayPtr;
@@ -1748,7 +1748,7 @@ TclWordKnownAtCompileTime(
case TCL_TOKEN_BS:
if (tempPtr != NULL) {
char utfBuf[4] = "";
size_t length = TclParseBackslash(tokenPtr->start,
Tcl_Size length = TclParseBackslash(tokenPtr->start,
tokenPtr->size, NULL, utfBuf);
Tcl_AppendToObj(tempPtr, utfBuf, length);
@@ -1812,7 +1812,7 @@ CompileCmdLiteral(
const char *bytes;
Command *cmdPtr;
int cmdLitIdx, extraLiteralFlags = LITERAL_CMD_NAME;
size_t length;
Tcl_Size length;
cmdPtr = (Command *) Tcl_GetCommandFromObj(interp, cmdObj);
if ((cmdPtr != NULL) && (cmdPtr->flags & CMD_VIA_RESOLVER)) {
@@ -2161,7 +2161,7 @@ TclCompileScript(
*/
if (iPtr->numLevels / 5 > iPtr->maxNestingDepth / 4) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"too many nested compilations (infinite loop?)", -1));
"too many nested compilations (infinite loop?)", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "LIMIT", "STACK", NULL);
TclCompileSyntaxError(interp, envPtr);
return;
@@ -2323,8 +2323,8 @@ TclCompileVarSubst(
CompileEnv *envPtr)
{
const char *p, *name = tokenPtr[1].start;
size_t i, nameBytes = tokenPtr[1].size;
size_t localVar;
Tcl_Size i, nameBytes = tokenPtr[1].size;
Tcl_Size localVar;
int localVarName = 1;
/*
@@ -2356,7 +2356,7 @@ TclCompileVarSubst(
if (localVarName != -1) {
localVar = TclFindCompiledLocal(name, nameBytes, localVarName, envPtr);
}
if (localVar == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(localVar)) {
PushLiteral(envPtr, name, nameBytes);
}
@@ -2368,7 +2368,7 @@ TclCompileVarSubst(
tokenPtr[1].start + tokenPtr[1].size);
if (tokenPtr->numComponents == 1) {
if (localVar == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(localVar)) {
TclEmitOpcode(INST_LOAD_STK, envPtr);
} else if (localVar <= 255) {
TclEmitInstInt1(INST_LOAD_SCALAR1, localVar, envPtr);
@@ -2377,7 +2377,7 @@ TclCompileVarSubst(
}
} else {
TclCompileTokens(interp, tokenPtr+2, tokenPtr->numComponents-1, envPtr);
if (localVar == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(localVar)) {
TclEmitOpcode(INST_LOAD_ARRAY_STK, envPtr);
} else if (localVar <= 255) {
TclEmitInstInt1(INST_LOAD_ARRAY1, localVar, envPtr);
@@ -2400,7 +2400,7 @@ TclCompileTokens(
* TCL_TOKEN_TEXT, TCL_TOKEN_BS tokens. */
char buffer[4] = "";
int i, numObjsToConcat, adjust;
size_t length;
Tcl_Size length;
unsigned char *entryCodeNext = envPtr->codeNext;
#define NUM_STATIC_POS 20
int isLiteral, maxNumCL, numCL;
@@ -2776,7 +2776,7 @@ PreventCycle(
Tcl_Obj *objPtr,
CompileEnv *envPtr)
{
size_t i;
Tcl_Size i;
for (i = 0; i < envPtr->literalArrayNext; i++) {
if (objPtr == TclFetchLiteral(envPtr, i)) {
@@ -2791,7 +2791,7 @@ PreventCycle(
* can be sure we do not have any lingering cycles hiding in
* the internalrep.
*/
size_t numBytes;
Tcl_Size numBytes;
const char *bytes = Tcl_GetStringFromObj(objPtr, &numBytes);
Tcl_Obj *copyPtr = Tcl_NewStringObj(bytes, numBytes);
@@ -2993,19 +2993,19 @@ TclInitByteCodeObj(
*----------------------------------------------------------------------
*/
size_t
Tcl_Size
TclFindCompiledLocal(
const char *name, /* Points to first character of the name of a
* scalar or array variable. If NULL, a
* temporary var should be created. */
size_t nameBytes, /* Number of bytes in the name. */
Tcl_Size nameBytes, /* Number of bytes in the name. */
int create, /* If 1, allocate a local frame entry for the
* variable if it is new. */
CompileEnv *envPtr) /* Points to the current compile environment*/
{
CompiledLocal *localPtr;
size_t localVar = TCL_INDEX_NONE;
size_t i;
Tcl_Size localVar = TCL_INDEX_NONE;
Tcl_Size i;
Proc *procPtr;
/*
@@ -3024,7 +3024,7 @@ TclFindCompiledLocal(
LocalCache *cachePtr = envPtr->iPtr->varFramePtr->localCachePtr;
const char *localName;
Tcl_Obj **varNamePtr;
size_t len;
Tcl_Size len;
if (!cachePtr || !name) {
return TCL_INDEX_NONE;
@@ -3043,7 +3043,7 @@ TclFindCompiledLocal(
}
if (name != NULL) {
size_t localCt = procPtr->numCompiledLocals;
Tcl_Size localCt = procPtr->numCompiledLocals;
localPtr = procPtr->firstLocalPtr;
for (i = 0; i < localCt; i++) {
@@ -3171,14 +3171,14 @@ EnterCmdStartData(
CompileEnv *envPtr, /* Points to the compilation environment
* structure in which to enter command
* location information. */
size_t cmdIndex, /* Index of the command whose start data is
Tcl_Size cmdIndex, /* Index of the command whose start data is
* being set. */
size_t srcOffset, /* Offset of first char of the command. */
size_t codeOffset) /* Offset of first byte of command code. */
Tcl_Size srcOffset, /* Offset of first char of the command. */
Tcl_Size codeOffset) /* Offset of first byte of command code. */
{
CmdLocation *cmdLocPtr;
if (cmdIndex >= envPtr->numCommands) {
if (TCL_SIZE_ISNEG(cmdIndex) || (cmdIndex >= envPtr->numCommands)) {
Tcl_Panic("EnterCmdStartData: bad command index %" TCL_Z_MODIFIER "u", cmdIndex);
}
@@ -3250,14 +3250,14 @@ EnterCmdExtentData(
CompileEnv *envPtr, /* Points to the compilation environment
* structure in which to enter command
* location information. */
size_t cmdIndex, /* Index of the command whose source and code
Tcl_Size cmdIndex, /* Index of the command whose source and code
* length data is being set. */
size_t numSrcBytes, /* Number of command source chars. */
size_t numCodeBytes) /* Offset of last byte of command code. */
Tcl_Size numSrcBytes, /* Number of command source chars. */
Tcl_Size numCodeBytes) /* Offset of last byte of command code. */
{
CmdLocation *cmdLocPtr;
if (cmdIndex >= envPtr->numCommands) {
if (TCL_SIZE_ISNEG(cmdIndex) || (cmdIndex >= envPtr->numCommands)) {
Tcl_Panic("EnterCmdExtentData: bad command index %" TCL_Z_MODIFIER "u", cmdIndex);
}
@@ -3296,18 +3296,18 @@ EnterCmdWordData(
ExtCmdLoc *eclPtr, /* Points to the map environment structure in
* which to enter command location
* information. */
size_t srcOffset, /* Offset of first char of the command. */
Tcl_Size srcOffset, /* Offset of first char of the command. */
Tcl_Token *tokenPtr,
const char *cmd,
size_t numWords,
size_t line,
Tcl_Size numWords,
Tcl_Size line,
int *clNext,
int **wlines,
CompileEnv *envPtr)
{
ECL *ePtr;
const char *last;
size_t wordIdx, wordLine;
Tcl_Size wordIdx, wordLine;
int *wwlines, *wordNext;
if (eclPtr->nuloc >= eclPtr->nloc) {
@@ -3373,7 +3373,7 @@ EnterCmdWordData(
*----------------------------------------------------------------------
*/
size_t
Tcl_Size
TclCreateExceptRange(
ExceptionRangeType type, /* The kind of ExceptionRange desired. */
CompileEnv *envPtr)/* Points to CompileEnv for which to create a
@@ -3381,7 +3381,7 @@ TclCreateExceptRange(
{
ExceptionRange *rangePtr;
ExceptionAux *auxPtr;
size_t index = envPtr->exceptArrayNext;
Tcl_Size index = envPtr->exceptArrayNext;
if (index >= envPtr->exceptArrayEnd) {
/*
@@ -3512,7 +3512,7 @@ TclAddLoopBreakFixup(
auxPtr->allocBreakTargets *= 2;
auxPtr->allocBreakTargets += 2;
if (auxPtr->breakTargets) {
auxPtr->breakTargets = (size_t *)Tcl_Realloc(auxPtr->breakTargets,
auxPtr->breakTargets = (TCL_HASH_TYPE *)Tcl_Realloc(auxPtr->breakTargets,
sizeof(size_t) * auxPtr->allocBreakTargets);
} else {
auxPtr->breakTargets =
@@ -3734,7 +3734,7 @@ TclFinalizeLoopExceptionRange(
*----------------------------------------------------------------------
*/
size_t
Tcl_Size
TclCreateAuxData(
void *clientData, /* The compilation auxiliary data to store in
* the new aux data record. */
@@ -3743,7 +3743,7 @@ TclCreateAuxData(
CompileEnv *envPtr)/* Points to the CompileEnv for which a new
* aux data structure is to be allocated. */
{
size_t index; /* Index for the new AuxData structure. */
Tcl_Size index; /* Index for the new AuxData structure. */
AuxData *auxDataPtr;
/* Points to the new AuxData structure */
@@ -4416,8 +4416,8 @@ EncodeCmdLocMap(
* is to be stored. */
{
CmdLocation *mapPtr = envPtr->cmdMapPtr;
size_t i, codeDelta, codeLen, srcLen, prevOffset;
size_t numCmds = envPtr->numCommands;
Tcl_Size i, codeDelta, codeLen, srcLen, prevOffset;
Tcl_Size numCmds = envPtr->numCommands;
unsigned char *p = startPtr;
int srcDelta;
@@ -4429,7 +4429,7 @@ EncodeCmdLocMap(
prevOffset = 0;
for (i = 0; i < numCmds; i++) {
codeDelta = mapPtr[i].codeOffset - prevOffset;
if (codeDelta == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(codeDelta)) {
Tcl_Panic("EncodeCmdLocMap: bad code offset");
} else if (codeDelta <= 127) {
TclStoreInt1AtPtr(codeDelta, p);
@@ -4450,7 +4450,7 @@ EncodeCmdLocMap(
codePtr->codeLengthStart = p;
for (i = 0; i < numCmds; i++) {
codeLen = mapPtr[i].numCodeBytes;
if (codeLen == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(codeLen)) {
Tcl_Panic("EncodeCmdLocMap: bad code length");
} else if (codeLen <= 127) {
TclStoreInt1AtPtr(codeLen, p);
@@ -4490,7 +4490,7 @@ EncodeCmdLocMap(
codePtr->srcLengthStart = p;
for (i = 0; i < numCmds; i++) {
srcLen = mapPtr[i].numSrcBytes;
if (srcLen == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(srcLen)) {
Tcl_Panic("EncodeCmdLocMap: bad source length");
} else if (srcLen <= 127) {
TclStoreInt1AtPtr(srcLen, p);
+12 -12
View File
@@ -1084,7 +1084,7 @@ MODULE_SCOPE ByteCode * TclCompileObj(Tcl_Interp *interp, Tcl_Obj *objPtr,
*/
MODULE_SCOPE int TclAttemptCompileProc(Tcl_Interp *interp,
Tcl_Parse *parsePtr, size_t depth, Command *cmdPtr,
Tcl_Parse *parsePtr, Tcl_Size depth, Command *cmdPtr,
CompileEnv *envPtr);
MODULE_SCOPE void TclCleanupStackForBreakContinue(CompileEnv *envPtr,
ExceptionAux *auxPtr);
@@ -1092,7 +1092,7 @@ MODULE_SCOPE void TclCompileCmdWord(Tcl_Interp *interp,
Tcl_Token *tokenPtr, size_t count,
CompileEnv *envPtr);
MODULE_SCOPE void TclCompileExpr(Tcl_Interp *interp, const char *script,
size_t numBytes, CompileEnv *envPtr, int optimize);
Tcl_Size numBytes, CompileEnv *envPtr, int optimize);
MODULE_SCOPE void TclCompileExprWords(Tcl_Interp *interp,
Tcl_Token *tokenPtr, size_t numWords,
CompileEnv *envPtr);
@@ -1109,13 +1109,13 @@ MODULE_SCOPE void TclCompileTokens(Tcl_Interp *interp,
CompileEnv *envPtr);
MODULE_SCOPE void TclCompileVarSubst(Tcl_Interp *interp,
Tcl_Token *tokenPtr, CompileEnv *envPtr);
MODULE_SCOPE size_t TclCreateAuxData(void *clientData,
MODULE_SCOPE Tcl_Size TclCreateAuxData(void *clientData,
const AuxDataType *typePtr, CompileEnv *envPtr);
MODULE_SCOPE size_t TclCreateExceptRange(ExceptionRangeType type,
MODULE_SCOPE Tcl_Size TclCreateExceptRange(ExceptionRangeType type,
CompileEnv *envPtr);
MODULE_SCOPE ExecEnv * TclCreateExecEnv(Tcl_Interp *interp, size_t size);
MODULE_SCOPE Tcl_Obj * TclCreateLiteral(Interp *iPtr, const char *bytes,
size_t length, TCL_HASH_TYPE hash, int *newPtr,
size_t length, size_t hash, int *newPtr,
Namespace *nsPtr, int flags,
LiteralEntry **globalPtrPtr);
MODULE_SCOPE void TclDeleteExecEnv(ExecEnv *eePtr);
@@ -1129,8 +1129,8 @@ MODULE_SCOPE ExceptionRange * TclGetExceptionRangeForPc(unsigned char *pc,
MODULE_SCOPE void TclExpandJumpFixupArray(JumpFixupArray *fixupArrayPtr);
MODULE_SCOPE int TclNRExecuteByteCode(Tcl_Interp *interp,
ByteCode *codePtr);
MODULE_SCOPE Tcl_Obj * TclFetchLiteral(CompileEnv *envPtr, TCL_HASH_TYPE index);
MODULE_SCOPE size_t TclFindCompiledLocal(const char *name, size_t nameChars,
MODULE_SCOPE Tcl_Obj * TclFetchLiteral(CompileEnv *envPtr, Tcl_Size index);
MODULE_SCOPE Tcl_Size TclFindCompiledLocal(const char *name, Tcl_Size nameChars,
int create, CompileEnv *envPtr);
MODULE_SCOPE int TclFixupForwardJump(CompileEnv *envPtr,
JumpFixup *jumpFixupPtr, int jumpDist,
@@ -1171,9 +1171,9 @@ MODULE_SCOPE void TclPrintByteCodeObj(Tcl_Interp *interp,
MODULE_SCOPE int TclPrintInstruction(ByteCode *codePtr,
const unsigned char *pc);
MODULE_SCOPE void TclPrintObject(FILE *outFile,
Tcl_Obj *objPtr, size_t maxChars);
Tcl_Obj *objPtr, Tcl_Size maxChars);
MODULE_SCOPE void TclPrintSource(FILE *outFile,
const char *string, size_t maxChars);
const char *string, Tcl_Size maxChars);
MODULE_SCOPE void TclPushVarName(Tcl_Interp *interp,
Tcl_Token *varTokenPtr, CompileEnv *envPtr,
int flags, int *localIndexPtr,
@@ -1195,13 +1195,13 @@ MODULE_SCOPE int TclWordKnownAtCompileTime(Tcl_Token *tokenPtr,
Tcl_Obj *valuePtr);
MODULE_SCOPE void TclLogCommandInfo(Tcl_Interp *interp,
const char *script, const char *command,
size_t length, const unsigned char *pc,
Tcl_Size length, const unsigned char *pc,
Tcl_Obj **tosPtr);
MODULE_SCOPE Tcl_Obj *TclGetInnerContext(Tcl_Interp *interp,
const unsigned char *pc, Tcl_Obj **tosPtr);
MODULE_SCOPE Tcl_Obj *TclNewInstNameObj(unsigned char inst);
MODULE_SCOPE int TclPushProcCallFrame(void *clientData,
Tcl_Interp *interp, size_t objc,
Tcl_Interp *interp, Tcl_Size objc,
Tcl_Obj *const objv[], int isLambda);
#endif /* TCL_MAJOR_VERSION > 8 */
@@ -1817,7 +1817,7 @@ MODULE_SCOPE void TclDTraceInfo(Tcl_Obj *info, const char **args, int *argsi);
FILE *tclDTraceDebugLog = NULL; \
void TclDTraceOpenDebugLog(void) { \
char n[35]; \
sprintf(n, "/tmp/tclDTraceDebug-%" TCL_Z_MODIFIER "u.log", \
snprintf(n, sizeof(n), "/tmp/tclDTraceDebug-%" TCL_Z_MODIFIER "u.log", \
(size_t) getpid()); \
tclDTraceDebugLog = fopen(n, "a"); \
}
+10 -7
View File
@@ -85,7 +85,7 @@ Tcl_RegisterConfig(
} else {
cdPtr->encoding = NULL;
}
cdPtr->pkg = Tcl_NewStringObj(pkgName, -1);
cdPtr->pkg = Tcl_NewStringObj(pkgName, TCL_INDEX_NONE);
/*
* Phase I: Adding the provided information to the internal database of
@@ -127,7 +127,7 @@ Tcl_RegisterConfig(
*/
for (cfg=configuration ; cfg->key!=NULL && cfg->key[0]!='\0' ; cfg++) {
Tcl_DictObjPut(interp, pkgDict, Tcl_NewStringObj(cfg->key, -1),
Tcl_DictObjPut(interp, pkgDict, Tcl_NewStringObj(cfg->key, TCL_INDEX_NONE),
Tcl_NewByteArrayObj((unsigned char *)cfg->value, strlen(cfg->value)));
}
@@ -144,7 +144,7 @@ Tcl_RegisterConfig(
Tcl_DStringInit(&cmdName);
TclDStringAppendLiteral(&cmdName, "::");
Tcl_DStringAppend(&cmdName, pkgName, -1);
Tcl_DStringAppend(&cmdName, pkgName, TCL_INDEX_NONE);
/*
* The incomplete command name is the name of the namespace to place it
@@ -227,7 +227,7 @@ QueryConfigObjCmd(
* present.
*/
Tcl_SetObjResult(interp, Tcl_NewStringObj("package not known", -1));
Tcl_SetObjResult(interp, Tcl_NewStringObj("package not known", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "FATAL", "PKGCFG_BASE",
TclGetString(pkgName), NULL);
return TCL_ERROR;
@@ -242,7 +242,7 @@ QueryConfigObjCmd(
if (Tcl_DictObjGet(interp, pkgDict, objv[2], &val) != TCL_OK
|| val == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj("key not known", -1));
Tcl_SetObjResult(interp, Tcl_NewStringObj("key not known", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "CONFIG",
TclGetString(objv[2]), NULL);
return TCL_ERROR;
@@ -258,7 +258,10 @@ QueryConfigObjCmd(
* Value is stored as-is in a byte array, see Bug [9b2e636361],
* so we have to decode it first.
*/
value = (const char *) Tcl_GetByteArrayFromObj(val, &n);
value = (const char *) Tcl_GetBytesFromObj(interp, val, &n);
if (value == NULL) {
return TCL_ERROR;
}
value = Tcl_ExternalToUtfDString(venc, value, n, &conv);
Tcl_SetObjResult(interp, Tcl_NewStringObj(value,
Tcl_DStringLength(&conv)));
@@ -276,7 +279,7 @@ QueryConfigObjCmd(
if (!listPtr) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"insufficient memory to create list", -1));
"insufficient memory to create list", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL);
return TCL_ERROR;
}
+58 -33
View File
@@ -860,7 +860,7 @@ EXTERN int Tcl_UniCharToTitle(int ch);
/* 323 */
EXTERN int Tcl_UniCharToUpper(int ch);
/* 324 */
EXTERN int Tcl_UniCharToUtf(int ch, char *buf);
EXTERN Tcl_Size Tcl_UniCharToUtf(int ch, char *buf);
/* 325 */
EXTERN const char * TclUtfAtIndex(const char *src, Tcl_Size index);
/* 326 */
@@ -888,14 +888,14 @@ EXTERN char * Tcl_UtfToExternalDString(Tcl_Encoding encoding,
const char *src, Tcl_Size srcLen,
Tcl_DString *dsPtr);
/* 334 */
EXTERN int Tcl_UtfToLower(char *src);
EXTERN Tcl_Size Tcl_UtfToLower(char *src);
/* 335 */
EXTERN int Tcl_UtfToTitle(char *src);
EXTERN Tcl_Size Tcl_UtfToTitle(char *src);
/* 336 */
EXTERN int Tcl_UtfToChar16(const char *src,
EXTERN Tcl_Size Tcl_UtfToChar16(const char *src,
unsigned short *chPtr);
/* 337 */
EXTERN int Tcl_UtfToUpper(char *src);
EXTERN Tcl_Size Tcl_UtfToUpper(char *src);
/* 338 */
EXTERN Tcl_Size Tcl_WriteChars(Tcl_Channel chan, const char *src,
Tcl_Size srcLen);
@@ -1735,7 +1735,7 @@ EXTERN int Tcl_GetIntForIndex(Tcl_Interp *interp,
Tcl_Obj *objPtr, Tcl_Size endValue,
Tcl_Size *indexPtr);
/* 646 */
EXTERN int Tcl_UtfToUniChar(const char *src, int *chPtr);
EXTERN Tcl_Size Tcl_UtfToUniChar(const char *src, int *chPtr);
/* 647 */
EXTERN char * Tcl_UniCharToUtfDString(const int *uniStr,
Tcl_Size uniLength, Tcl_DString *dsPtr);
@@ -1766,13 +1766,17 @@ EXTERN const char * Tcl_UtfPrev(const char *src, const char *start);
/* 657 */
EXTERN int Tcl_UniCharIsUnicode(int ch);
/* 658 */
EXTERN Tcl_Size Tcl_ExternalToUtfDStringEx(Tcl_Encoding encoding,
const char *src, Tcl_Size srcLen, int flags,
Tcl_DString *dsPtr);
EXTERN int Tcl_ExternalToUtfDStringEx(Tcl_Interp *interp,
Tcl_Encoding encoding, const char *src,
Tcl_Size srcLen, int flags,
Tcl_DString *dsPtr,
Tcl_Size *errorLocationPtr);
/* 659 */
EXTERN Tcl_Size Tcl_UtfToExternalDStringEx(Tcl_Encoding encoding,
const char *src, Tcl_Size srcLen, int flags,
Tcl_DString *dsPtr);
EXTERN int Tcl_UtfToExternalDStringEx(Tcl_Interp *interp,
Tcl_Encoding encoding, const char *src,
Tcl_Size srcLen, int flags,
Tcl_DString *dsPtr,
Tcl_Size *errorLocationPtr);
/* 660 */
EXTERN int Tcl_AsyncMarkFromSignal(Tcl_AsyncHandler async,
int sigNumber);
@@ -1851,7 +1855,15 @@ EXTERN int Tcl_GetNumber(Tcl_Interp *interp, const char *bytes,
EXTERN int Tcl_RemoveChannelMode(Tcl_Interp *interp,
Tcl_Channel chan, int mode);
/* 683 */
EXTERN int Tcl_GetEncodingNulLength(Tcl_Encoding encoding);
EXTERN Tcl_Size Tcl_GetEncodingNulLength(Tcl_Encoding encoding);
/* 684 */
EXTERN int Tcl_GetWideUIntFromObj(Tcl_Interp *interp,
Tcl_Obj *objPtr, Tcl_WideUInt *uwidePtr);
/* 685 */
EXTERN Tcl_Obj * Tcl_DStringToObj(Tcl_DString *dsPtr);
/* Slot 686 is reserved */
/* 687 */
EXTERN void TclUnusedStubEntry(void);
typedef struct {
const struct TclPlatStubs *tclPlatStubs;
@@ -2187,7 +2199,7 @@ typedef struct TclStubs {
int (*tcl_UniCharToLower) (int ch); /* 321 */
int (*tcl_UniCharToTitle) (int ch); /* 322 */
int (*tcl_UniCharToUpper) (int ch); /* 323 */
int (*tcl_UniCharToUtf) (int ch, char *buf); /* 324 */
Tcl_Size (*tcl_UniCharToUtf) (int ch, char *buf); /* 324 */
const char * (*tclUtfAtIndex) (const char *src, Tcl_Size index); /* 325 */
int (*tclUtfCharComplete) (const char *src, Tcl_Size length); /* 326 */
Tcl_Size (*tcl_UtfBackslash) (const char *src, int *readPtr, char *dst); /* 327 */
@@ -2197,10 +2209,10 @@ typedef struct TclStubs {
const char * (*tclUtfPrev) (const char *src, const char *start); /* 331 */
int (*tcl_UtfToExternal) (Tcl_Interp *interp, Tcl_Encoding encoding, const char *src, Tcl_Size srcLen, int flags, Tcl_EncodingState *statePtr, char *dst, Tcl_Size dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr); /* 332 */
char * (*tcl_UtfToExternalDString) (Tcl_Encoding encoding, const char *src, Tcl_Size srcLen, Tcl_DString *dsPtr); /* 333 */
int (*tcl_UtfToLower) (char *src); /* 334 */
int (*tcl_UtfToTitle) (char *src); /* 335 */
int (*tcl_UtfToChar16) (const char *src, unsigned short *chPtr); /* 336 */
int (*tcl_UtfToUpper) (char *src); /* 337 */
Tcl_Size (*tcl_UtfToLower) (char *src); /* 334 */
Tcl_Size (*tcl_UtfToTitle) (char *src); /* 335 */
Tcl_Size (*tcl_UtfToChar16) (const char *src, unsigned short *chPtr); /* 336 */
Tcl_Size (*tcl_UtfToUpper) (char *src); /* 337 */
Tcl_Size (*tcl_WriteChars) (Tcl_Channel chan, const char *src, Tcl_Size srcLen); /* 338 */
Tcl_Size (*tcl_WriteObj) (Tcl_Channel chan, Tcl_Obj *objPtr); /* 339 */
char * (*tcl_GetString) (Tcl_Obj *objPtr); /* 340 */
@@ -2509,7 +2521,7 @@ typedef struct TclStubs {
int (*tcl_IsShared) (Tcl_Obj *objPtr); /* 643 */
int (*tcl_LinkArray) (Tcl_Interp *interp, const char *varName, void *addr, int type, Tcl_Size size); /* 644 */
int (*tcl_GetIntForIndex) (Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_Size endValue, Tcl_Size *indexPtr); /* 645 */
int (*tcl_UtfToUniChar) (const char *src, int *chPtr); /* 646 */
Tcl_Size (*tcl_UtfToUniChar) (const char *src, int *chPtr); /* 646 */
char * (*tcl_UniCharToUtfDString) (const int *uniStr, Tcl_Size uniLength, Tcl_DString *dsPtr); /* 647 */
int * (*tcl_UtfToUniCharDString) (const char *src, Tcl_Size length, Tcl_DString *dsPtr); /* 648 */
unsigned char * (*tclGetBytesFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *numBytesPtr); /* 649 */
@@ -2521,8 +2533,8 @@ typedef struct TclStubs {
const char * (*tcl_UtfNext) (const char *src); /* 655 */
const char * (*tcl_UtfPrev) (const char *src, const char *start); /* 656 */
int (*tcl_UniCharIsUnicode) (int ch); /* 657 */
Tcl_Size (*tcl_ExternalToUtfDStringEx) (Tcl_Encoding encoding, const char *src, Tcl_Size srcLen, int flags, Tcl_DString *dsPtr); /* 658 */
Tcl_Size (*tcl_UtfToExternalDStringEx) (Tcl_Encoding encoding, const char *src, Tcl_Size srcLen, int flags, Tcl_DString *dsPtr); /* 659 */
int (*tcl_ExternalToUtfDStringEx) (Tcl_Interp *interp, Tcl_Encoding encoding, const char *src, Tcl_Size srcLen, int flags, Tcl_DString *dsPtr, Tcl_Size *errorLocationPtr); /* 658 */
int (*tcl_UtfToExternalDStringEx) (Tcl_Interp *interp, Tcl_Encoding encoding, const char *src, Tcl_Size srcLen, int flags, Tcl_DString *dsPtr, Tcl_Size *errorLocationPtr); /* 659 */
int (*tcl_AsyncMarkFromSignal) (Tcl_AsyncHandler async, int sigNumber); /* 660 */
int (*tcl_ListObjGetElements) (Tcl_Interp *interp, Tcl_Obj *listPtr, size_t *objcPtr, Tcl_Obj ***objvPtr); /* 661 */
int (*tcl_ListObjLength) (Tcl_Interp *interp, Tcl_Obj *listPtr, size_t *lengthPtr); /* 662 */
@@ -2546,7 +2558,11 @@ typedef struct TclStubs {
int (*tcl_GetNumberFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, void **clientDataPtr, int *typePtr); /* 680 */
int (*tcl_GetNumber) (Tcl_Interp *interp, const char *bytes, size_t numBytes, void **clientDataPtr, int *typePtr); /* 681 */
int (*tcl_RemoveChannelMode) (Tcl_Interp *interp, Tcl_Channel chan, int mode); /* 682 */
int (*tcl_GetEncodingNulLength) (Tcl_Encoding encoding); /* 683 */
Tcl_Size (*tcl_GetEncodingNulLength) (Tcl_Encoding encoding); /* 683 */
int (*tcl_GetWideUIntFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_WideUInt *uwidePtr); /* 684 */
Tcl_Obj * (*tcl_DStringToObj) (Tcl_DString *dsPtr); /* 685 */
void (*reserved686)(void);
void (*tclUnusedStubEntry) (void); /* 687 */
} TclStubs;
extern const TclStubs *tclStubsPtr;
@@ -3867,11 +3883,20 @@ extern const TclStubs *tclStubsPtr;
(tclStubsPtr->tcl_RemoveChannelMode) /* 682 */
#define Tcl_GetEncodingNulLength \
(tclStubsPtr->tcl_GetEncodingNulLength) /* 683 */
#define Tcl_GetWideUIntFromObj \
(tclStubsPtr->tcl_GetWideUIntFromObj) /* 684 */
#define Tcl_DStringToObj \
(tclStubsPtr->tcl_DStringToObj) /* 685 */
/* Slot 686 is reserved */
#define TclUnusedStubEntry \
(tclStubsPtr->tclUnusedStubEntry) /* 687 */
#endif /* defined(USE_TCL_STUBS) */
/* !END!: Do not edit above this line. */
#undef TclUnusedStubEntry
#ifdef _WIN32
# undef Tcl_CreateFileHandler
# undef Tcl_DeleteFileHandler
@@ -3935,12 +3960,12 @@ extern const TclStubs *tclStubsPtr;
#undef Tcl_UtfToExternalDString
#define Tcl_UtfToExternalDString(encoding, src, len, ds) \
(Tcl_UtfToExternalDStringEx((encoding), (src), (len), \
TCL_ENCODING_NOCOMPLAIN, (ds)), Tcl_DStringValue(ds))
(Tcl_UtfToExternalDStringEx(NULL, (encoding), (src), (len), \
TCL_ENCODING_PROFILE_TCL8, (ds), NULL), Tcl_DStringValue(ds))
#undef Tcl_ExternalToUtfDString
#define Tcl_ExternalToUtfDString(encoding, src, len, ds) \
(Tcl_ExternalToUtfDStringEx((encoding), (src), (len), \
TCL_ENCODING_NOCOMPLAIN, (ds)), Tcl_DStringValue(ds))
(Tcl_ExternalToUtfDStringEx(NULL, (encoding), (src), (len), \
TCL_ENCODING_PROFILE_TCL8, (ds), NULL), Tcl_DStringValue(ds))
#if defined(USE_TCL_STUBS)
# if defined(_WIN32) && defined(_WIN64)
@@ -3948,14 +3973,14 @@ extern const TclStubs *tclStubsPtr;
/* Handle Win64 tk.dll being loaded in Cygwin64. */
# define Tcl_GetTime(t) \
do { \
union { \
struct { \
Tcl_Time now; \
long long reserved; \
} _t; \
_t.reserved = -1; \
tclStubsPtr->tcl_GetTime((&_t.now)); \
if (_t.reserved != -1) { \
_t.now.usec = _t.reserved; \
_t.now.usec = (long) _t.reserved; \
} \
*(t) = _t.now; \
} while (0)
@@ -4128,8 +4153,8 @@ extern const TclStubs *tclStubsPtr;
? (wchar_t *(*)(const char *, Tcl_Size, Tcl_DString *))tclStubsPtr->tcl_UtfToUniCharDString \
: (wchar_t *(*)(const char *, Tcl_Size, Tcl_DString *))Tcl_UtfToChar16DString)
# define Tcl_UtfToWChar (sizeof(wchar_t) != sizeof(short) \
? (int (*)(const char *, wchar_t *))tclStubsPtr->tcl_UtfToUniChar \
: (int (*)(const char *, wchar_t *))Tcl_UtfToChar16)
? (Tcl_Size (*)(const char *, wchar_t *))tclStubsPtr->tcl_UtfToUniChar \
: (Tcl_Size (*)(const char *, wchar_t *))Tcl_UtfToChar16)
# define Tcl_WCharLen (sizeof(wchar_t) != sizeof(short) \
? (Tcl_Size (*)(wchar_t *))tclStubsPtr->tcl_UniCharLen \
: (Tcl_Size (*)(wchar_t *))Tcl_Char16Len)
@@ -4169,8 +4194,8 @@ extern const TclStubs *tclStubsPtr;
? (wchar_t *(*)(const char *, Tcl_Size, Tcl_DString *))Tcl_UtfToUniCharDString \
: (wchar_t *(*)(const char *, Tcl_Size, Tcl_DString *))Tcl_UtfToChar16DString)
# define Tcl_UtfToWChar (sizeof(wchar_t) != sizeof(short) \
? (int (*)(const char *, wchar_t *))Tcl_UtfToUniChar \
: (int (*)(const char *, wchar_t *))Tcl_UtfToChar16)
? (Tcl_Size (*)(const char *, wchar_t *))Tcl_UtfToUniChar \
: (Tcl_Size (*)(const char *, wchar_t *))Tcl_UtfToChar16)
# define Tcl_WCharLen (sizeof(wchar_t) != sizeof(short) \
? (Tcl_Size (*)(wchar_t *))Tcl_UniCharLen \
: (Tcl_Size (*)(wchar_t *))Tcl_Char16Len)
@@ -4208,7 +4233,7 @@ extern const TclStubs *tclStubsPtr;
#define Tcl_GlobalEvalObj(interp, objPtr) \
Tcl_EvalObjEx(interp, objPtr, TCL_EVAL_GLOBAL)
#if defined(TCL_8_COMPAT) && !defined(BUILD_tcl)
#if defined(TCL_SIGNED_SIZE) && !defined(BUILD_tcl) && TCL_MAJOR_VERSION > 8
# ifdef USE_TCL_STUBS
# undef Tcl_Gets
# undef Tcl_GetsObj
+10 -10
View File
@@ -603,7 +603,7 @@ SetDictFromAny(
* the conversion from lists to dictionaries.
*/
if (TclHasInternalRep(objPtr, &tclListType)) {
if (TclHasInternalRep(objPtr, &tclListType.objType)) {
size_t objc, i;
Tcl_Obj **objv;
@@ -717,7 +717,7 @@ SetDictFromAny(
missingValue:
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"missing value to go with key", -1));
"missing value to go with key", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "DICTIONARY", NULL);
}
errorInFindDictElement:
@@ -779,12 +779,12 @@ Tcl_Obj *
TclTraceDictPath(
Tcl_Interp *interp,
Tcl_Obj *dictPtr,
size_t keyc,
Tcl_Size keyc,
Tcl_Obj *const keyv[],
int flags)
{
Dict *dict, *newDict;
size_t i;
Tcl_Size i;
DictGetInternalRep(dictPtr, dict);
if (dict == NULL) {
@@ -1281,7 +1281,7 @@ int
Tcl_DictObjPutKeyList(
Tcl_Interp *interp,
Tcl_Obj *dictPtr,
size_t keyc,
Tcl_Size keyc,
Tcl_Obj *const keyv[],
Tcl_Obj *valuePtr)
{
@@ -1342,7 +1342,7 @@ int
Tcl_DictObjRemoveKeyList(
Tcl_Interp *interp,
Tcl_Obj *dictPtr,
size_t keyc,
Tcl_Size keyc,
Tcl_Obj *const keyv[])
{
Dict *dict;
@@ -2119,7 +2119,7 @@ DictInfoCmd(
}
statsStr = Tcl_HashStats(&dict->table);
Tcl_SetObjResult(interp, Tcl_NewStringObj(statsStr, -1));
Tcl_SetObjResult(interp, Tcl_NewStringObj(statsStr, TCL_INDEX_NONE));
Tcl_Free(statsStr);
return TCL_OK;
}
@@ -2481,7 +2481,7 @@ DictForNRCmd(
}
if (varc != 2) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"must have exactly two variable names", -1));
"must have exactly two variable names", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "SYNTAX", "dict", "for", NULL);
return TCL_ERROR;
}
@@ -2676,7 +2676,7 @@ DictMapNRCmd(
}
if (varc != 2) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"must have exactly two variable names", -1));
"must have exactly two variable names", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "SYNTAX", "dict", "map", NULL);
return TCL_ERROR;
}
@@ -3116,7 +3116,7 @@ DictFilterCmd(
}
if (varc != 2) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"must have exactly two variable names", -1));
"must have exactly two variable names", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "SYNTAX", "dict", "filter", NULL);
return TCL_ERROR;
}
+61 -61
View File
@@ -280,7 +280,7 @@ DisassembleByteCodeObj(
Tcl_AppendPrintfToObj(bufferObj,
"ByteCode %p, refCt %" TCL_Z_MODIFIER "u, epoch %" TCL_Z_MODIFIER "u, interp %p (epoch %" TCL_Z_MODIFIER "u)\n",
codePtr, codePtr->refCount, codePtr->compileEpoch, iPtr, iPtr->compileEpoch);
Tcl_AppendToObj(bufferObj, " Source ", -1);
Tcl_AppendToObj(bufferObj, " Source ", TCL_INDEX_NONE);
PrintSourceToObj(bufferObj, codePtr->source,
TclMin(codePtr->numSrcBytes, 55));
GetLocationInformation(codePtr->procPtr, &fileObj, &line);
@@ -339,7 +339,7 @@ DisassembleByteCodeObj(
(localPtr->flags & VAR_TEMPORARY) ? ", temp" : "",
(localPtr->flags & VAR_RESOLVED) ? ", resolved" : "");
if (TclIsVarTemporary(localPtr)) {
Tcl_AppendToObj(bufferObj, "\n", -1);
Tcl_AppendToObj(bufferObj, "\n", TCL_INDEX_NONE);
} else {
Tcl_AppendPrintfToObj(bufferObj, ", \"%s\"\n",
localPtr->name);
@@ -389,7 +389,7 @@ DisassembleByteCodeObj(
if (numCmds == 0) {
pc = codeStart;
while (pc < codeLimit) {
Tcl_AppendToObj(bufferObj, " ", -1);
Tcl_AppendToObj(bufferObj, " ", TCL_INDEX_NONE);
pc += FormatInstruction(codePtr, pc, bufferObj);
}
return bufferObj;
@@ -451,7 +451,7 @@ DisassembleByteCodeObj(
srcOffset, (srcOffset + srcLen - 1));
}
if (numCmds > 0) {
Tcl_AppendToObj(bufferObj, "\n", -1);
Tcl_AppendToObj(bufferObj, "\n", TCL_INDEX_NONE);
}
/*
@@ -500,14 +500,14 @@ DisassembleByteCodeObj(
*/
while ((pc-codeStart) < codeOffset) {
Tcl_AppendToObj(bufferObj, " ", -1);
Tcl_AppendToObj(bufferObj, " ", TCL_INDEX_NONE);
pc += FormatInstruction(codePtr, pc, bufferObj);
}
Tcl_AppendPrintfToObj(bufferObj, " Command %d: ", i+1);
PrintSourceToObj(bufferObj, (codePtr->source + srcOffset),
TclMin(srcLen, 55));
Tcl_AppendToObj(bufferObj, "\n", -1);
Tcl_AppendToObj(bufferObj, "\n", TCL_INDEX_NONE);
}
if (pc < codeLimit) {
/*
@@ -515,7 +515,7 @@ DisassembleByteCodeObj(
*/
while (pc < codeLimit) {
Tcl_AppendToObj(bufferObj, " ", -1);
Tcl_AppendToObj(bufferObj, " ", TCL_INDEX_NONE);
pc += FormatInstruction(codePtr, pc, bufferObj);
}
}
@@ -571,22 +571,22 @@ FormatInstruction(
case OPERAND_UINT4:
opnd = TclGetUInt4AtPtr(pc+numBytes); numBytes += 4;
if (opCode == INST_START_CMD) {
sprintf(suffixBuffer+strlen(suffixBuffer),
snprintf(suffixBuffer+strlen(suffixBuffer), sizeof(suffixBuffer) - strlen(suffixBuffer),
", %u cmds start here", opnd);
}
Tcl_AppendPrintfToObj(bufferObj, "%u ", opnd);
break;
case OPERAND_OFFSET1:
opnd = TclGetInt1AtPtr(pc+numBytes); numBytes++;
sprintf(suffixBuffer, "pc %u", pcOffset+opnd);
snprintf(suffixBuffer, sizeof(suffixBuffer), "pc %u", pcOffset+opnd);
Tcl_AppendPrintfToObj(bufferObj, "%+d ", opnd);
break;
case OPERAND_OFFSET4:
opnd = TclGetInt4AtPtr(pc+numBytes); numBytes += 4;
if (opCode == INST_START_CMD) {
sprintf(suffixBuffer, "next cmd at pc %u", pcOffset+opnd);
snprintf(suffixBuffer, sizeof(suffixBuffer), "next cmd at pc %u", pcOffset+opnd);
} else {
sprintf(suffixBuffer, "pc %u", pcOffset+opnd);
snprintf(suffixBuffer, sizeof(suffixBuffer), "pc %u", pcOffset+opnd);
}
Tcl_AppendPrintfToObj(bufferObj, "%+d ", opnd);
break;
@@ -632,9 +632,9 @@ FormatInstruction(
localPtr = localPtr->nextPtr;
}
if (TclIsVarTemporary(localPtr)) {
sprintf(suffixBuffer, "temp var %u", opnd);
snprintf(suffixBuffer, sizeof(suffixBuffer), "temp var %u", opnd);
} else {
sprintf(suffixBuffer, "var ");
snprintf(suffixBuffer, sizeof(suffixBuffer), "var ");
suffixSrc = localPtr->name;
}
}
@@ -654,7 +654,7 @@ FormatInstruction(
const char *bytes;
size_t length;
Tcl_AppendToObj(bufferObj, "\t# ", -1);
Tcl_AppendToObj(bufferObj, "\t# ", TCL_INDEX_NONE);
bytes = Tcl_GetStringFromObj(codePtr->objArrayPtr[opnd], &length);
PrintSourceToObj(bufferObj, bytes, TclMin(length, 40));
} else if (suffixBuffer[0]) {
@@ -663,12 +663,12 @@ FormatInstruction(
PrintSourceToObj(bufferObj, suffixSrc, 40);
}
}
Tcl_AppendToObj(bufferObj, "\n", -1);
Tcl_AppendToObj(bufferObj, "\n", TCL_INDEX_NONE);
if (auxPtr && auxPtr->type->printProc) {
Tcl_AppendToObj(bufferObj, "\t\t[", -1);
Tcl_AppendToObj(bufferObj, "\t\t[", TCL_INDEX_NONE);
auxPtr->type->printProc(auxPtr->clientData, bufferObj, codePtr,
pcOffset);
Tcl_AppendToObj(bufferObj, "]\n", -1);
Tcl_AppendToObj(bufferObj, "]\n", TCL_INDEX_NONE);
}
return numBytes;
}
@@ -836,7 +836,7 @@ UpdateStringOfInstName(
if (inst >= LAST_INST_OPCODE) {
dst = Tcl_InitStringRep(objPtr, NULL, TCL_INTEGER_SPACE + 5);
TclOOM(dst, TCL_INTEGER_SPACE + 5);
sprintf(dst, "inst_%" TCL_Z_MODIFIER "u", inst);
snprintf(dst, TCL_INTEGER_SPACE + 5, "inst_%" TCL_Z_MODIFIER "u", inst);
(void) Tcl_InitStringRep(objPtr, NULL, strlen(dst));
} else {
const char *s = tclInstructionTable[inst].name;
@@ -866,11 +866,11 @@ PrintSourceToObj(
size_t i = 0, len;
if (stringPtr == NULL) {
Tcl_AppendToObj(appendObj, "\"\"", -1);
Tcl_AppendToObj(appendObj, "\"\"", TCL_INDEX_NONE);
return;
}
Tcl_AppendToObj(appendObj, "\"", -1);
Tcl_AppendToObj(appendObj, "\"", TCL_INDEX_NONE);
p = stringPtr;
for (; (*p != '\0') && (i < maxChars); p+=len) {
int ucs4;
@@ -878,27 +878,27 @@ PrintSourceToObj(
len = TclUtfToUCS4(p, &ucs4);
switch (ucs4) {
case '"':
Tcl_AppendToObj(appendObj, "\\\"", -1);
Tcl_AppendToObj(appendObj, "\\\"", TCL_INDEX_NONE);
i += 2;
continue;
case '\f':
Tcl_AppendToObj(appendObj, "\\f", -1);
Tcl_AppendToObj(appendObj, "\\f", TCL_INDEX_NONE);
i += 2;
continue;
case '\n':
Tcl_AppendToObj(appendObj, "\\n", -1);
Tcl_AppendToObj(appendObj, "\\n", TCL_INDEX_NONE);
i += 2;
continue;
case '\r':
Tcl_AppendToObj(appendObj, "\\r", -1);
Tcl_AppendToObj(appendObj, "\\r", TCL_INDEX_NONE);
i += 2;
continue;
case '\t':
Tcl_AppendToObj(appendObj, "\\t", -1);
Tcl_AppendToObj(appendObj, "\\t", TCL_INDEX_NONE);
i += 2;
continue;
case '\v':
Tcl_AppendToObj(appendObj, "\\v", -1);
Tcl_AppendToObj(appendObj, "\\v", TCL_INDEX_NONE);
i += 2;
continue;
default:
@@ -916,9 +916,9 @@ PrintSourceToObj(
}
}
if (*p != '\0') {
Tcl_AppendToObj(appendObj, "...", -1);
Tcl_AppendToObj(appendObj, "...", TCL_INDEX_NONE);
}
Tcl_AppendToObj(appendObj, "\"", -1);
Tcl_AppendToObj(appendObj, "\"", TCL_INDEX_NONE);
}
/*
@@ -972,33 +972,33 @@ DisassembleByteCodeAsDicts(
TclNewObj(descriptor[0]);
if (!(localPtr->flags & (VAR_ARRAY|VAR_LINK))) {
Tcl_ListObjAppendElement(NULL, descriptor[0],
Tcl_NewStringObj("scalar", -1));
Tcl_NewStringObj("scalar", TCL_INDEX_NONE));
}
if (localPtr->flags & VAR_ARRAY) {
Tcl_ListObjAppendElement(NULL, descriptor[0],
Tcl_NewStringObj("array", -1));
Tcl_NewStringObj("array", TCL_INDEX_NONE));
}
if (localPtr->flags & VAR_LINK) {
Tcl_ListObjAppendElement(NULL, descriptor[0],
Tcl_NewStringObj("link", -1));
Tcl_NewStringObj("link", TCL_INDEX_NONE));
}
if (localPtr->flags & VAR_ARGUMENT) {
Tcl_ListObjAppendElement(NULL, descriptor[0],
Tcl_NewStringObj("arg", -1));
Tcl_NewStringObj("arg", TCL_INDEX_NONE));
}
if (localPtr->flags & VAR_TEMPORARY) {
Tcl_ListObjAppendElement(NULL, descriptor[0],
Tcl_NewStringObj("temp", -1));
Tcl_NewStringObj("temp", TCL_INDEX_NONE));
}
if (localPtr->flags & VAR_RESOLVED) {
Tcl_ListObjAppendElement(NULL, descriptor[0],
Tcl_NewStringObj("resolved", -1));
Tcl_NewStringObj("resolved", TCL_INDEX_NONE));
}
if (localPtr->flags & VAR_TEMPORARY) {
Tcl_ListObjAppendElement(NULL, variables,
Tcl_NewListObj(1, descriptor));
} else {
descriptor[1] = Tcl_NewStringObj(localPtr->name, -1);
descriptor[1] = Tcl_NewStringObj(localPtr->name, TCL_INDEX_NONE);
Tcl_ListObjAppendElement(NULL, variables,
Tcl_NewListObj(2, descriptor));
}
@@ -1016,7 +1016,7 @@ DisassembleByteCodeAsDicts(
TclNewObj(inst);
Tcl_ListObjAppendElement(NULL, inst, Tcl_NewStringObj(
instDesc->name, -1));
instDesc->name, TCL_INDEX_NONE));
opnd = pc + 1;
for (i=0 ; i<instDesc->numOperands ; i++) {
switch (instDesc->opTypes[i]) {
@@ -1082,7 +1082,7 @@ DisassembleByteCodeAsDicts(
".%d", val));
} else if (val == -2) {
Tcl_ListObjAppendElement(NULL, inst, Tcl_NewStringObj(
".end", -1));
".end", TCL_INDEX_NONE));
} else {
Tcl_ListObjAppendElement(NULL, inst, Tcl_ObjPrintf(
".end-%d", -2-val));
@@ -1115,13 +1115,13 @@ DisassembleByteCodeAsDicts(
TclNewObj(aux);
for (i=0 ; i<(int)codePtr->numAuxDataItems ; i++) {
AuxData *auxData = &codePtr->auxDataArrayPtr[i];
Tcl_Obj *auxDesc = Tcl_NewStringObj(auxData->type->name, -1);
Tcl_Obj *auxDesc = Tcl_NewStringObj(auxData->type->name, TCL_INDEX_NONE);
if (auxData->type->disassembleProc) {
Tcl_Obj *desc;
TclNewObj(desc);
Tcl_DictObjPut(NULL, desc, Tcl_NewStringObj("name", -1), auxDesc);
Tcl_DictObjPut(NULL, desc, Tcl_NewStringObj("name", TCL_INDEX_NONE), auxDesc);
auxDesc = desc;
auxData->type->disassembleProc(auxData->clientData, auxDesc,
codePtr, 0);
@@ -1188,9 +1188,9 @@ DisassembleByteCodeAsDicts(
sourceOffset += Decode(srcOffPtr);
sourceLength = Decode(srcLenPtr);
TclNewObj(cmd);
Tcl_DictObjPut(NULL, cmd, Tcl_NewStringObj("codefrom", -1),
Tcl_DictObjPut(NULL, cmd, Tcl_NewStringObj("codefrom", TCL_INDEX_NONE),
Tcl_NewWideIntObj(codeOffset));
Tcl_DictObjPut(NULL, cmd, Tcl_NewStringObj("codeto", -1),
Tcl_DictObjPut(NULL, cmd, Tcl_NewStringObj("codeto", TCL_INDEX_NONE),
Tcl_NewWideIntObj(codeOffset + codeLength - 1));
/*
@@ -1198,13 +1198,13 @@ DisassembleByteCodeAsDicts(
* characters are present in the source!
*/
Tcl_DictObjPut(NULL, cmd, Tcl_NewStringObj("scriptfrom", -1),
Tcl_DictObjPut(NULL, cmd, Tcl_NewStringObj("scriptfrom", TCL_INDEX_NONE),
Tcl_NewWideIntObj(Tcl_NumUtfChars(codePtr->source,
sourceOffset)));
Tcl_DictObjPut(NULL, cmd, Tcl_NewStringObj("scriptto", -1),
Tcl_DictObjPut(NULL, cmd, Tcl_NewStringObj("scriptto", TCL_INDEX_NONE),
Tcl_NewWideIntObj(Tcl_NumUtfChars(codePtr->source,
sourceOffset + sourceLength - 1)));
Tcl_DictObjPut(NULL, cmd, Tcl_NewStringObj("script", -1),
Tcl_DictObjPut(NULL, cmd, Tcl_NewStringObj("script", TCL_INDEX_NONE),
Tcl_NewStringObj(codePtr->source+sourceOffset, sourceLength));
Tcl_ListObjAppendElement(NULL, commands, cmd);
}
@@ -1223,32 +1223,32 @@ DisassembleByteCodeAsDicts(
*/
TclNewObj(description);
Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("literals", -1),
Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("literals", TCL_INDEX_NONE),
literals);
Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("variables", -1),
Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("variables", TCL_INDEX_NONE),
variables);
Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("exception", -1), exn);
Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("instructions", -1),
Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("exception", TCL_INDEX_NONE), exn);
Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("instructions", TCL_INDEX_NONE),
instructions);
Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("auxiliary", -1), aux);
Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("commands", -1),
Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("auxiliary", TCL_INDEX_NONE), aux);
Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("commands", TCL_INDEX_NONE),
commands);
Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("script", -1),
Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("script", TCL_INDEX_NONE),
Tcl_NewStringObj(codePtr->source, codePtr->numSrcBytes));
Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("namespace", -1),
Tcl_NewStringObj(codePtr->nsPtr->fullName, -1));
Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("stackdepth", -1),
Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("namespace", TCL_INDEX_NONE),
Tcl_NewStringObj(codePtr->nsPtr->fullName, TCL_INDEX_NONE));
Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("stackdepth", TCL_INDEX_NONE),
Tcl_NewWideIntObj(codePtr->maxStackDepth));
Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("exceptdepth", -1),
Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("exceptdepth", TCL_INDEX_NONE),
Tcl_NewWideIntObj(codePtr->maxExceptDepth));
if (line >= 0) {
Tcl_DictObjPut(NULL, description,
Tcl_NewStringObj("initiallinenumber", -1),
Tcl_NewStringObj("initiallinenumber", TCL_INDEX_NONE),
Tcl_NewWideIntObj(line));
}
if (file) {
Tcl_DictObjPut(NULL, description,
Tcl_NewStringObj("sourcefile", -1), file);
Tcl_NewStringObj("sourcefile", TCL_INDEX_NONE), file);
}
return description;
}
@@ -1410,7 +1410,7 @@ Tcl_DisassembleObjCmd(
procPtr = TclOOGetProcFromMethod(methodPtr);
if (procPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"body not available for this kind of constructor", -1));
"body not available for this kind of constructor", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "DISASSEMBLE",
"METHODTYPE", NULL);
return TCL_ERROR;
@@ -1475,7 +1475,7 @@ Tcl_DisassembleObjCmd(
procPtr = TclOOGetProcFromMethod(methodPtr);
if (procPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"body not available for this kind of destructor", -1));
"body not available for this kind of destructor", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "DISASSEMBLE",
"METHODTYPE", NULL);
return TCL_ERROR;
@@ -1565,7 +1565,7 @@ Tcl_DisassembleObjCmd(
procPtr = TclOOGetProcFromMethod((Method *)Tcl_GetHashValue(hPtr));
if (procPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"body not available for this kind of method", -1));
"body not available for this kind of method", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "DISASSEMBLE",
"METHODTYPE", NULL);
return TCL_ERROR;
@@ -1602,7 +1602,7 @@ Tcl_DisassembleObjCmd(
if (codePtr->flags & TCL_BYTECODE_PRECOMPILED) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"may not disassemble prebuilt bytecode", -1));
"may not disassemble prebuilt bytecode", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "DISASSEMBLE",
"BYTECODE", NULL);
return TCL_ERROR;
+821 -202
View File
File diff suppressed because it is too large Load Diff
+80 -72
View File
@@ -106,7 +106,7 @@ static const Tcl_ObjType ensembleCmdType = {
*/
typedef struct {
size_t epoch; /* Used to confirm when the data in this
Tcl_Size epoch; /* Used to confirm when the data in this
* really structure matches up with the
* ensemble. */
Command *token; /* Reference to the command for which this
@@ -125,7 +125,7 @@ NewNsObj(
if (namespacePtr == TclGetGlobalNamespace(nsPtr->interp)) {
return Tcl_NewStringObj("::", 2);
}
return Tcl_NewStringObj(nsPtr->fullName, -1);
return Tcl_NewStringObj(nsPtr->fullName, TCL_INDEX_NONE);
}
/*
@@ -189,7 +189,7 @@ TclNamespaceEnsembleCmd(
switch (index) {
case ENS_CREATE: {
const char *name;
size_t len;
Tcl_Size len;
int allocatedMapFlag = 0;
/*
* Defaults
@@ -289,7 +289,7 @@ TclNamespaceEnsembleCmd(
if (len < 1) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"ensemble subcommand implementations "
"must be non-empty lists", -1));
"must be non-empty lists", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "ENSEMBLE",
"EMPTY_TARGET", NULL);
Tcl_DictObjDone(&search);
@@ -460,7 +460,7 @@ TclNamespaceEnsembleCmd(
/* -map option */
Tcl_ListObjAppendElement(NULL, resultObj,
Tcl_NewStringObj(ensembleConfigOptions[CONF_MAP], -1));
Tcl_NewStringObj(ensembleConfigOptions[CONF_MAP], TCL_INDEX_NONE));
Tcl_GetEnsembleMappingDict(NULL, token, &tmpObj);
Tcl_ListObjAppendElement(NULL, resultObj,
(tmpObj != NULL) ? tmpObj : Tcl_NewObj());
@@ -475,14 +475,14 @@ TclNamespaceEnsembleCmd(
/* -parameters option */
Tcl_ListObjAppendElement(NULL, resultObj,
Tcl_NewStringObj(ensembleConfigOptions[CONF_PARAM], -1));
Tcl_NewStringObj(ensembleConfigOptions[CONF_PARAM], TCL_INDEX_NONE));
Tcl_GetEnsembleParameterList(NULL, token, &tmpObj);
Tcl_ListObjAppendElement(NULL, resultObj,
(tmpObj != NULL) ? tmpObj : Tcl_NewObj());
/* -prefix option */
Tcl_ListObjAppendElement(NULL, resultObj,
Tcl_NewStringObj(ensembleConfigOptions[CONF_PREFIX], -1));
Tcl_NewStringObj(ensembleConfigOptions[CONF_PREFIX], TCL_INDEX_NONE));
Tcl_GetEnsembleFlags(NULL, token, &flags);
Tcl_ListObjAppendElement(NULL, resultObj,
Tcl_NewBooleanObj(flags & TCL_ENSEMBLE_PREFIX));
@@ -503,7 +503,7 @@ TclNamespaceEnsembleCmd(
Tcl_SetObjResult(interp, resultObj);
} else {
size_t len;
Tcl_Size len;
int allocatedMapFlag = 0;
Tcl_Obj *subcmdObj = NULL, *mapObj = NULL, *paramObj = NULL,
*unknownObj = NULL; /* Defaults, silence gcc 4 warnings */
@@ -566,8 +566,8 @@ TclNamespaceEnsembleCmd(
continue;
}
do {
if (TclListObjGetElementsM(interp, listObj, &len,
&listv) != TCL_OK) {
if (TclListObjLengthM(interp, listObj, &len
) != TCL_OK) {
Tcl_DictObjDone(&search);
if (patchedDict) {
Tcl_DecrRefCount(patchedDict);
@@ -577,7 +577,7 @@ TclNamespaceEnsembleCmd(
if (len < 1) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"ensemble subcommand implementations "
"must be non-empty lists", -1));
"must be non-empty lists", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "ENSEMBLE",
"EMPTY_TARGET", NULL);
Tcl_DictObjDone(&search);
@@ -586,6 +586,14 @@ TclNamespaceEnsembleCmd(
}
goto freeMapAndError;
}
if (TclListObjGetElementsM(interp, listObj, &len,
&listv) != TCL_OK) {
Tcl_DictObjDone(&search);
if (patchedDict) {
Tcl_DecrRefCount(patchedDict);
}
goto freeMapAndError;
}
cmd = TclGetString(listv[0]);
if (!(cmd[0] == ':' && cmd[1] == ':')) {
Tcl_Obj *newList = Tcl_DuplicateObj(listObj);
@@ -617,7 +625,7 @@ TclNamespaceEnsembleCmd(
}
case CONF_NAMESPACE:
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"option -namespace is read-only", -1));
"option -namespace is read-only", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "ENSEMBLE", "READ_ONLY",
NULL);
goto freeMapAndError;
@@ -790,12 +798,12 @@ Tcl_SetEnsembleSubcommandList(
if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"command is not an ensemble", -1));
"command is not an ensemble", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "ENSEMBLE", "NOT_ENSEMBLE", NULL);
return TCL_ERROR;
}
if (subcmdList != NULL) {
size_t length;
Tcl_Size length;
if (TclListObjLengthM(interp, subcmdList, &length) != TCL_OK) {
return TCL_ERROR;
@@ -862,11 +870,11 @@ Tcl_SetEnsembleParameterList(
Command *cmdPtr = (Command *) token;
EnsembleConfig *ensemblePtr;
Tcl_Obj *oldList;
size_t length;
Tcl_Size length;
if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"command is not an ensemble", -1));
"command is not an ensemble", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "ENSEMBLE", "NOT_ENSEMBLE", NULL);
return TCL_ERROR;
}
@@ -942,12 +950,12 @@ Tcl_SetEnsembleMappingDict(
if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"command is not an ensemble", -1));
"command is not an ensemble", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "ENSEMBLE", "NOT_ENSEMBLE", NULL);
return TCL_ERROR;
}
if (mapDict != NULL) {
size_t size;
Tcl_Size size;
int done;
Tcl_DictSearch search;
Tcl_Obj *valuePtr;
@@ -1042,12 +1050,12 @@ Tcl_SetEnsembleUnknownHandler(
if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"command is not an ensemble", -1));
"command is not an ensemble", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "ENSEMBLE", "NOT_ENSEMBLE", NULL);
return TCL_ERROR;
}
if (unknownList != NULL) {
size_t length;
Tcl_Size length;
if (TclListObjLengthM(interp, unknownList, &length) != TCL_OK) {
return TCL_ERROR;
@@ -1108,7 +1116,7 @@ Tcl_SetEnsembleFlags(
if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"command is not an ensemble", -1));
"command is not an ensemble", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "ENSEMBLE", "NOT_ENSEMBLE", NULL);
return TCL_ERROR;
}
@@ -1185,7 +1193,7 @@ Tcl_GetEnsembleSubcommandList(
if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"command is not an ensemble", -1));
"command is not an ensemble", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "ENSEMBLE", "NOT_ENSEMBLE", NULL);
}
return TCL_ERROR;
@@ -1227,7 +1235,7 @@ Tcl_GetEnsembleParameterList(
if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"command is not an ensemble", -1));
"command is not an ensemble", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "ENSEMBLE", "NOT_ENSEMBLE", NULL);
}
return TCL_ERROR;
@@ -1269,7 +1277,7 @@ Tcl_GetEnsembleMappingDict(
if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"command is not an ensemble", -1));
"command is not an ensemble", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "ENSEMBLE", "NOT_ENSEMBLE", NULL);
}
return TCL_ERROR;
@@ -1310,7 +1318,7 @@ Tcl_GetEnsembleUnknownHandler(
if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"command is not an ensemble", -1));
"command is not an ensemble", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "ENSEMBLE", "NOT_ENSEMBLE", NULL);
}
return TCL_ERROR;
@@ -1351,7 +1359,7 @@ Tcl_GetEnsembleFlags(
if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"command is not an ensemble", -1));
"command is not an ensemble", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "ENSEMBLE", "NOT_ENSEMBLE", NULL);
}
return TCL_ERROR;
@@ -1392,7 +1400,7 @@ Tcl_GetEnsembleNamespace(
if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"command is not an ensemble", -1));
"command is not an ensemble", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "ENSEMBLE", "NOT_ENSEMBLE", NULL);
}
return TCL_ERROR;
@@ -1531,7 +1539,7 @@ TclMakeEnsemble(
Tcl_DString buf, hiddenBuf;
const char **nameParts = NULL;
const char *cmdName = NULL;
size_t i, nameCount = 0;
Tcl_Size i, nameCount = 0;
int ensembleFlags = 0, hiddenLen;
/*
@@ -1541,7 +1549,7 @@ TclMakeEnsemble(
Tcl_DStringInit(&buf);
Tcl_DStringInit(&hiddenBuf);
TclDStringAppendLiteral(&hiddenBuf, "tcl:");
Tcl_DStringAppend(&hiddenBuf, name, -1);
Tcl_DStringAppend(&hiddenBuf, name, TCL_INDEX_NONE);
TclDStringAppendLiteral(&hiddenBuf, ":");
hiddenLen = Tcl_DStringLength(&hiddenBuf);
if (name[0] == ':' && name[1] == ':') {
@@ -1550,7 +1558,7 @@ TclMakeEnsemble(
*/
cmdName = name;
Tcl_DStringAppend(&buf, name, -1);
Tcl_DStringAppend(&buf, name, TCL_INDEX_NONE);
ensembleFlags = TCL_ENSEMBLE_PREFIX;
} else {
/*
@@ -1566,7 +1574,7 @@ TclMakeEnsemble(
for (i = 0; i < nameCount; ++i) {
TclDStringAppendLiteral(&buf, "::");
Tcl_DStringAppend(&buf, nameParts[i], -1);
Tcl_DStringAppend(&buf, nameParts[i], TCL_INDEX_NONE);
}
}
@@ -1611,10 +1619,10 @@ TclMakeEnsemble(
TclDStringAppendLiteral(&buf, "::");
TclNewObj(mapDict);
for (i=0 ; map[i].name != NULL ; i++) {
fromObj = Tcl_NewStringObj(map[i].name, -1);
fromObj = Tcl_NewStringObj(map[i].name, TCL_INDEX_NONE);
TclNewStringObj(toObj, Tcl_DStringValue(&buf),
Tcl_DStringLength(&buf));
Tcl_AppendToObj(toObj, map[i].name, -1);
Tcl_AppendToObj(toObj, map[i].name, TCL_INDEX_NONE);
Tcl_DictObjPut(NULL, mapDict, fromObj, toObj);
if (map[i].proc || map[i].nreProc) {
@@ -1632,7 +1640,7 @@ TclMakeEnsemble(
map[i].nreProc, map[i].clientData, NULL);
Tcl_DStringSetLength(&hiddenBuf, hiddenLen);
if (Tcl_HideCommand(interp, "___tmp",
Tcl_DStringAppend(&hiddenBuf, map[i].name, -1))) {
Tcl_DStringAppend(&hiddenBuf, map[i].name, TCL_INDEX_NONE))) {
Tcl_Panic("%s", Tcl_GetStringResult(interp));
}
} else {
@@ -1710,7 +1718,7 @@ NsEnsembleImplementationCmdNR(
int reparseCount = 0; /* Number of reparses. */
Tcl_Obj *errorObj; /* Used for building error messages. */
Tcl_Obj *subObj;
size_t subIdx;
Tcl_Size subIdx;
/*
* Must recheck objc since numParameters might have changed. See test
@@ -1719,7 +1727,7 @@ NsEnsembleImplementationCmdNR(
restartEnsembleParse:
subIdx = 1 + ensemblePtr->numParameters;
if ((size_t)objc < subIdx + 1) {
if ((Tcl_Size)objc < subIdx + 1) {
/*
* No subcommand argument. Make error message.
*/
@@ -1729,7 +1737,7 @@ NsEnsembleImplementationCmdNR(
Tcl_DStringInit(&buf);
if (ensemblePtr->parameterList) {
Tcl_DStringAppend(&buf,
TclGetString(ensemblePtr->parameterList), -1);
TclGetString(ensemblePtr->parameterList), TCL_INDEX_NONE);
TclDStringAppendLiteral(&buf, " ");
}
TclDStringAppendLiteral(&buf, "subcommand ?arg ...?");
@@ -1746,7 +1754,7 @@ NsEnsembleImplementationCmdNR(
if (!Tcl_InterpDeleted(interp)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"ensemble activated for deleted namespace", -1));
"ensemble activated for deleted namespace", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "ENSEMBLE", "DEAD", NULL);
}
return TCL_ERROR;
@@ -1813,8 +1821,8 @@ NsEnsembleImplementationCmdNR(
* it (a non-unique prefix produces an error).
*/
char *fullName = NULL; /* Full name of the subcommand. */
size_t stringLength, i;
size_t tableLength = ensemblePtr->subcommandTable.numEntries;
Tcl_Size stringLength, i;
Tcl_Size tableLength = ensemblePtr->subcommandTable.numEntries;
Tcl_Obj *fix;
subcmdName = Tcl_GetStringFromObj(subObj, &stringLength);
@@ -1861,7 +1869,7 @@ NsEnsembleImplementationCmdNR(
* Record the spelling correction for usage message.
*/
fix = Tcl_NewStringObj(fullName, -1);
fix = Tcl_NewStringObj(fullName, TCL_INDEX_NONE);
/*
* Cache for later in the subcommand object.
@@ -1891,7 +1899,7 @@ NsEnsembleImplementationCmdNR(
Tcl_Obj *copyPtr; /* The list of words to dispatch on.
* Will be freed by the dispatch engine. */
Tcl_Obj **copyObjv;
size_t copyObjc, prefixObjc;
Tcl_Size copyObjc, prefixObjc;
TclListObjLengthM(NULL, prefixObj, &prefixObjc);
@@ -1972,12 +1980,12 @@ NsEnsembleImplementationCmdNR(
(ensemblePtr->flags & TCL_ENSEMBLE_PREFIX ? " or ambiguous" : ""),
TclGetString(subObj));
if (ensemblePtr->subcommandTable.numEntries == 1) {
Tcl_AppendToObj(errorObj, ensemblePtr->subcommandArrayPtr[0], -1);
Tcl_AppendToObj(errorObj, ensemblePtr->subcommandArrayPtr[0], TCL_INDEX_NONE);
} else {
size_t i;
Tcl_Size i;
for (i=0 ; i<ensemblePtr->subcommandTable.numEntries-1 ; i++) {
Tcl_AppendToObj(errorObj, ensemblePtr->subcommandArrayPtr[i], -1);
Tcl_AppendToObj(errorObj, ensemblePtr->subcommandArrayPtr[i], TCL_INDEX_NONE);
Tcl_AppendToObj(errorObj, ", ", 2);
}
Tcl_AppendPrintfToObj(errorObj, "or %s",
@@ -2019,8 +2027,8 @@ TclClearRootEnsemble(
int
TclInitRewriteEnsemble(
Tcl_Interp *interp,
size_t numRemoved,
size_t numInserted,
Tcl_Size numRemoved,
Tcl_Size numInserted,
Tcl_Obj *const *objv)
{
Interp *iPtr = (Interp *) interp;
@@ -2032,7 +2040,7 @@ TclInitRewriteEnsemble(
iPtr->ensembleRewrite.numRemovedObjs = numRemoved;
iPtr->ensembleRewrite.numInsertedObjs = numInserted;
} else {
size_t numIns = iPtr->ensembleRewrite.numInsertedObjs;
Tcl_Size numIns = iPtr->ensembleRewrite.numInsertedObjs;
if (numIns < numRemoved) {
iPtr->ensembleRewrite.numRemovedObjs += numRemoved - numIns;
@@ -2119,8 +2127,8 @@ TclSpellFix(
Interp *iPtr = (Interp *) interp;
Tcl_Obj *const *search;
Tcl_Obj **store;
size_t idx;
size_t size;
Tcl_Size idx;
Tcl_Size size;
if (iPtr->ensembleRewrite.sourceObjs == NULL) {
iPtr->ensembleRewrite.sourceObjs = objv;
@@ -2287,9 +2295,9 @@ EnsembleUnknownCallback(
Tcl_Obj *const objv[],
Tcl_Obj **prefixObjPtr)
{
size_t paramc;
Tcl_Size paramc;
int result;
size_t i, prefixObjc;
Tcl_Size i, prefixObjc;
Tcl_Obj **paramv, *unknownCmd, *ensObj;
/*
@@ -2300,7 +2308,7 @@ EnsembleUnknownCallback(
TclNewObj(ensObj);
Tcl_GetCommandFullName(interp, ensemblePtr->token, ensObj);
Tcl_ListObjAppendElement(NULL, unknownCmd, ensObj);
for (i = 1 ; i < (size_t)objc ; i++) {
for (i = 1 ; i < (Tcl_Size)objc ; i++) {
Tcl_ListObjAppendElement(NULL, unknownCmd, objv[i]);
}
TclListObjGetElementsM(NULL, unknownCmd, &paramc, &paramv);
@@ -2318,7 +2326,7 @@ EnsembleUnknownCallback(
if ((result == TCL_OK) && (ensemblePtr->flags & ENSEMBLE_DEAD)) {
if (!Tcl_InterpDeleted(interp)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"unknown subcommand handler deleted its ensemble", -1));
"unknown subcommand handler deleted its ensemble", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "ENSEMBLE", "UNKNOWN_DELETED",
NULL);
}
@@ -2366,16 +2374,16 @@ EnsembleUnknownCallback(
if (result != TCL_ERROR) {
Tcl_ResetResult(interp);
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"unknown subcommand handler returned bad code: ", -1));
"unknown subcommand handler returned bad code: ", TCL_INDEX_NONE));
switch (result) {
case TCL_RETURN:
Tcl_AppendToObj(Tcl_GetObjResult(interp), "return", -1);
Tcl_AppendToObj(Tcl_GetObjResult(interp), "return", TCL_INDEX_NONE);
break;
case TCL_BREAK:
Tcl_AppendToObj(Tcl_GetObjResult(interp), "break", -1);
Tcl_AppendToObj(Tcl_GetObjResult(interp), "break", TCL_INDEX_NONE);
break;
case TCL_CONTINUE:
Tcl_AppendToObj(Tcl_GetObjResult(interp), "continue", -1);
Tcl_AppendToObj(Tcl_GetObjResult(interp), "continue", TCL_INDEX_NONE);
break;
default:
Tcl_AppendPrintfToObj(Tcl_GetObjResult(interp), "%d", result);
@@ -2577,7 +2585,7 @@ BuildEnsembleConfig(
{
Tcl_HashSearch search; /* Used for scanning the commands in
* the namespace for this ensemble. */
size_t i, j;
Tcl_Size i, j;
int isNew;
Tcl_HashTable *hash = &ensemblePtr->subcommandTable;
Tcl_HashEntry *hPtr;
@@ -2588,7 +2596,7 @@ BuildEnsembleConfig(
Tcl_InitHashTable(hash, TCL_STRING_KEYS);
if (subList) {
size_t subc;
Tcl_Size subc;
Tcl_Obj **subv, *target, *cmdObj, *cmdPrefixObj;
const char *name;
@@ -2617,7 +2625,7 @@ BuildEnsembleConfig(
name = TclGetString(subv[i+1]);
hPtr = Tcl_CreateHashEntry(hash, name, &isNew);
if (isNew) {
cmdObj = Tcl_NewStringObj(name, -1);
cmdObj = Tcl_NewStringObj(name, TCL_INDEX_NONE);
cmdPrefixObj = Tcl_NewListObj(1, &cmdObj);
Tcl_SetHashValue(hPtr, cmdPrefixObj);
Tcl_IncrRefCount(cmdPrefixObj);
@@ -2655,7 +2663,7 @@ BuildEnsembleConfig(
* programmer (or [::unknown] of course) to provide the procedure.
*/
cmdObj = Tcl_NewStringObj(name, -1);
cmdObj = Tcl_NewStringObj(name, TCL_INDEX_NONE);
cmdPrefixObj = Tcl_NewListObj(1, &cmdObj);
Tcl_SetHashValue(hPtr, cmdPrefixObj);
Tcl_IncrRefCount(cmdPrefixObj);
@@ -2920,7 +2928,7 @@ TclCompileEnsemble(
Command *oldCmdPtr = cmdPtr, *newCmdPtr;
int result, flags = 0, depth = 1, invokeAnyway = 0;
int ourResult = TCL_ERROR;
size_t i, len, numBytes;
Tcl_Size i, len, numBytes;
const char *word;
TclNewObj(replaced);
@@ -2990,7 +2998,7 @@ TclCompileEnsemble(
(void) Tcl_GetEnsembleSubcommandList(NULL, ensemble, &listObj);
if (listObj != NULL) {
size_t sclen;
Tcl_Size sclen;
const char *str;
Tcl_Obj *matchObj = NULL;
@@ -3247,20 +3255,20 @@ int
TclAttemptCompileProc(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
size_t depth,
Tcl_Size depth,
Command *cmdPtr,
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation;
int result;
size_t i;
Tcl_Size i;
Tcl_Token *saveTokenPtr = parsePtr->tokenPtr;
size_t savedStackDepth = envPtr->currStackDepth;
unsigned savedCodeNext = envPtr->codeNext - envPtr->codeStart;
size_t savedAuxDataArrayNext = envPtr->auxDataArrayNext;
size_t savedExceptArrayNext = envPtr->exceptArrayNext;
Tcl_Size savedStackDepth = envPtr->currStackDepth;
TCL_HASH_TYPE savedCodeNext = envPtr->codeNext - envPtr->codeStart;
Tcl_Size savedAuxDataArrayNext = envPtr->auxDataArrayNext;
Tcl_Size savedExceptArrayNext = envPtr->exceptArrayNext;
#ifdef TCL_COMPILE_DEBUG
size_t savedExceptDepth = envPtr->exceptDepth;
Tcl_Size savedExceptDepth = envPtr->exceptDepth;
#endif
if (cmdPtr->compileProc == NULL) {
@@ -3390,7 +3398,7 @@ CompileToInvokedCommand(
Tcl_Obj *objPtr, **words;
const char *bytes;
int cmdLit, extraLiteralFlags = LITERAL_CMD_NAME;
size_t i, numWords, length;
Tcl_Size i, numWords, length;
/*
* Push the words of the command. Take care; the command words may be
+8 -8
View File
@@ -185,8 +185,8 @@ TclSetupEnv(
p1 = "COMSPEC";
}
#endif
obj1 = Tcl_NewStringObj(p1, -1);
obj2 = Tcl_NewStringObj(p2, -1);
obj1 = Tcl_NewStringObj(p1, TCL_INDEX_NONE);
obj2 = Tcl_NewStringObj(p2, TCL_INDEX_NONE);
Tcl_DStringFree(&envString);
Tcl_IncrRefCount(obj1);
@@ -267,7 +267,7 @@ TclSetEnv(
Tcl_MutexLock(&envMutex);
index = TclpFindVariable(name, &length);
if (index == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(index)) {
#ifndef USE_PUTENV
/*
* We need to handle the case where the environment may be changed
@@ -351,7 +351,7 @@ TclSetEnv(
* string in the cache.
*/
if ((index != TCL_INDEX_NONE) && (tenviron[index] == (techar *)p)) {
if (!TCL_SIZE_ISNEG(index) && (tenviron[index] == (techar *)p)) {
ReplaceString(oldValue, p);
#ifdef HAVE_PUTENV_THAT_COPIES
} else {
@@ -406,7 +406,7 @@ Tcl_PutEnv(
* name and value parts, and call TclSetEnv to do all of the real work.
*/
name = Tcl_ExternalToUtfDString(NULL, assignment, -1, &nameString);
name = Tcl_ExternalToUtfDString(NULL, assignment, TCL_INDEX_NONE, &nameString);
value = (char *)strchr(name, '=');
if ((value != NULL) && (value != name)) {
@@ -469,7 +469,7 @@ TclUnsetEnv(
* needless work and to avoid recursion on the unset.
*/
if (index == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(index)) {
Tcl_MutexUnlock(&envMutex);
return;
}
@@ -574,7 +574,7 @@ TclGetEnv(
Tcl_MutexLock(&envMutex);
index = TclpFindVariable(name, &length);
result = NULL;
if (index != TCL_INDEX_NONE) {
if (!TCL_SIZE_ISNEG(index)) {
Tcl_DString envStr;
result = tenviron2utfdstr(tenviron[index], -1, &envStr);
@@ -582,7 +582,7 @@ TclGetEnv(
if (*result == '=') {
result++;
Tcl_DStringInit(valuePtr);
Tcl_DStringAppend(valuePtr, result, -1);
Tcl_DStringAppend(valuePtr, result, TCL_INDEX_NONE);
result = Tcl_DStringValue(valuePtr);
} else {
result = NULL;
+19 -19
View File
@@ -224,7 +224,7 @@ HandleBgErrors(
Tcl_Preserve(interp);
while (assocPtr->firstBgPtr != NULL) {
int code;
size_t prefixObjc;
Tcl_Size prefixObjc;
Tcl_Obj **prefixObjv, **tempObjv;
/*
@@ -281,7 +281,7 @@ HandleBgErrors(
Tcl_DecrRefCount(keyPtr);
Tcl_WriteChars(errChannel,
"error in background error handler:\n", -1);
"error in background error handler:\n", TCL_INDEX_NONE);
if (valuePtr) {
Tcl_WriteObj(errChannel, valuePtr);
} else {
@@ -343,7 +343,7 @@ TclDefaultBgErrorHandlerObjCmd(
Tcl_DecrRefCount(keyPtr);
if (result != TCL_OK || valuePtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"missing return option \"-level\"", -1));
"missing return option \"-level\"", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "ARGUMENT", "MISSING", NULL);
return TCL_ERROR;
}
@@ -356,7 +356,7 @@ TclDefaultBgErrorHandlerObjCmd(
Tcl_DecrRefCount(keyPtr);
if (result != TCL_OK || valuePtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"missing return option \"-code\"", -1));
"missing return option \"-code\"", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "ARGUMENT", "MISSING", NULL);
return TCL_ERROR;
}
@@ -474,17 +474,17 @@ TclDefaultBgErrorHandlerObjCmd(
Tcl_RestoreInterpState(interp, saved);
Tcl_WriteObj(errChannel, Tcl_GetVar2Ex(interp,
"errorInfo", NULL, TCL_GLOBAL_ONLY));
Tcl_WriteChars(errChannel, "\n", -1);
Tcl_WriteChars(errChannel, "\n", TCL_INDEX_NONE);
} else {
Tcl_DiscardInterpState(saved);
Tcl_WriteChars(errChannel,
"bgerror failed to handle background error.\n",-1);
Tcl_WriteChars(errChannel, " Original error: ", -1);
"bgerror failed to handle background error.\n", TCL_INDEX_NONE);
Tcl_WriteChars(errChannel, " Original error: ", TCL_INDEX_NONE);
Tcl_WriteObj(errChannel, tempObjv[1]);
Tcl_WriteChars(errChannel, "\n", -1);
Tcl_WriteChars(errChannel, " Error in bgerror: ", -1);
Tcl_WriteChars(errChannel, "\n", TCL_INDEX_NONE);
Tcl_WriteChars(errChannel, " Error in bgerror: ", TCL_INDEX_NONE);
Tcl_WriteObj(errChannel, resultPtr);
Tcl_WriteChars(errChannel, "\n", -1);
Tcl_WriteChars(errChannel, "\n", TCL_INDEX_NONE);
}
Tcl_DecrRefCount(resultPtr);
Tcl_Flush(errChannel);
@@ -957,7 +957,7 @@ Tcl_Exit(
/*
* Warning: this function SHOULD NOT return, as there is code that depends
* on Tcl_Exit never returning. In fact, we will Tcl_Panic if anyone
* returns, so critical is this dependcy.
* returns, so critical is this dependency.
*
* If subsystems are not (yet) initialized, proper Tcl-finalization is
* impossible, so fallback to system exit, see bug-[f8a33ce3db5d8cc2].
@@ -1572,7 +1572,7 @@ Tcl_VwaitObjCmd(
if (timeout < 0) {
Tcl_ResetResult(interp);
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"timeout must be positive", -1));
"timeout must be positive", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "EVENT", "NEGTIME", NULL);
result = TCL_ERROR;
goto done;
@@ -1652,7 +1652,7 @@ Tcl_VwaitObjCmd(
if ((mask & (TCL_FILE_EVENTS | TCL_IDLE_EVENTS |
TCL_TIMER_EVENTS | TCL_WINDOW_EVENTS)) == 0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"can't wait: would block forever", -1));
"can't wait: would block forever", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "EVENT", "NO_SOURCES", NULL);
result = TCL_ERROR;
goto done;
@@ -1660,7 +1660,7 @@ Tcl_VwaitObjCmd(
if ((timeout > 0) && ((mask & TCL_TIMER_EVENTS) == 0)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"timer events disabled with timeout specified", -1));
"timer events disabled with timeout specified", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "EVENT", "NO_TIME", NULL);
result = TCL_ERROR;
goto done;
@@ -1688,7 +1688,7 @@ Tcl_VwaitObjCmd(
for (i = 0; i < numItems; i++) {
if (vwaitItems[i].mask) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"file events disabled with channel(s) specified", -1));
"file events disabled with channel(s) specified", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "EVENT", "NO_FILE_EVENT", NULL);
result = TCL_ERROR;
goto done;
@@ -1727,7 +1727,7 @@ Tcl_VwaitObjCmd(
}
if (Tcl_LimitExceeded(interp)) {
Tcl_ResetResult(interp);
Tcl_SetObjResult(interp, Tcl_NewStringObj("limit exceeded", -1));
Tcl_SetObjResult(interp, Tcl_NewStringObj("limit exceeded", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "EVENT", "LIMIT", NULL);
break;
}
@@ -1975,7 +1975,7 @@ Tcl_UpdateObjCmd(
}
if (Tcl_LimitExceeded(interp)) {
Tcl_ResetResult(interp);
Tcl_SetObjResult(interp, Tcl_NewStringObj("limit exceeded", -1));
Tcl_SetObjResult(interp, Tcl_NewStringObj("limit exceeded", TCL_INDEX_NONE));
return TCL_ERROR;
}
}
@@ -2047,8 +2047,8 @@ int
Tcl_CreateThread(
Tcl_ThreadId *idPtr, /* Return, the ID of the thread */
Tcl_ThreadCreateProc *proc, /* Main() function of the thread */
void *clientData, /* The one argument to Main() */
size_t stackSize, /* Size of stack for the new thread */
void *clientData, /* The one argument to Main() */
Tcl_Size stackSize, /* Size of stack for the new thread */
int flags) /* Flags controlling behaviour of the new
* thread. */
{
+54 -56
View File
@@ -452,11 +452,11 @@ VarHashCreateVar(
*/
#define GetNumberFromObj(interp, objPtr, ptrPtr, tPtr) \
((TclHasInternalRep((objPtr), &tclIntType)) \
((TclHasInternalRep((objPtr), &tclIntType.objType)) \
? (*(tPtr) = TCL_NUMBER_INT, \
*(ptrPtr) = (void *) \
(&((objPtr)->internalRep.wideValue)), TCL_OK) : \
TclHasInternalRep((objPtr), &tclDoubleType) \
TclHasInternalRep((objPtr), &tclDoubleType.objType) \
? (((isnan((objPtr)->internalRep.doubleValue)) \
? (*(tPtr) = TCL_NUMBER_NAN) \
: (*(tPtr) = TCL_NUMBER_DOUBLE)), \
@@ -1224,10 +1224,10 @@ TclStackFree(
void *
TclStackAlloc(
Tcl_Interp *interp,
size_t numBytes)
Tcl_Size numBytes)
{
Interp *iPtr = (Interp *) interp;
size_t numWords;
Tcl_Size numWords;
if (iPtr == NULL || iPtr->execEnvPtr == NULL) {
return (void *) Tcl_Alloc(numBytes);
@@ -1742,7 +1742,7 @@ TclCompileObj(
* of course).
*
* Side effects:
* valuePtr gets the new incrmented value.
* valuePtr gets the new incremented value.
*
*----------------------------------------------------------------------
*/
@@ -2377,7 +2377,7 @@ TEBCresume(
if (!corPtr) {
TRACE_APPEND(("ERROR: yield outside coroutine\n"));
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"yield can only be called in a coroutine", -1));
"yield can only be called in a coroutine", TCL_INDEX_NONE));
DECACHE_STACK_INFO();
Tcl_SetErrorCode(interp, "TCL", "COROUTINE", "ILLEGAL_YIELD",
NULL);
@@ -2408,7 +2408,7 @@ TEBCresume(
TRACE(("[%.30s] => ERROR: yield outside coroutine\n",
O2S(valuePtr)));
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"yieldto can only be called in a coroutine", -1));
"yieldto can only be called in a coroutine", TCL_INDEX_NONE));
DECACHE_STACK_INFO();
Tcl_SetErrorCode(interp, "TCL", "COROUTINE", "ILLEGAL_YIELD",
NULL);
@@ -2419,7 +2419,7 @@ TEBCresume(
TRACE(("[%.30s] => ERROR: yield in deleted\n",
O2S(valuePtr)));
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"yieldto called in deleted namespace", -1));
"yieldto called in deleted namespace", TCL_INDEX_NONE));
DECACHE_STACK_INFO();
Tcl_SetErrorCode(interp, "TCL", "COROUTINE", "YIELDTO_IN_DELETED",
NULL);
@@ -2447,8 +2447,8 @@ TEBCresume(
* 'yieldParameter').
*/
Tcl_IncrRefCount(valuePtr);
iPtr->execEnvPtr = corPtr->callerEEPtr;
Tcl_IncrRefCount(valuePtr);
TclSetTailcall(interp, valuePtr);
corPtr->yieldPtr = valuePtr;
iPtr->execEnvPtr = corPtr->eePtr;
@@ -2482,7 +2482,7 @@ TEBCresume(
if (!(iPtr->varFramePtr->isProcCallFrame & 1)) {
TRACE(("%d => ERROR: tailcall in non-proc context\n", opnd));
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"tailcall can only be called from a proc or lambda", -1));
"tailcall can only be called from a proc or lambda", TCL_INDEX_NONE));
DECACHE_STACK_INFO();
Tcl_SetErrorCode(interp, "TCL", "TAILCALL", "ILLEGAL", NULL);
CACHE_STACK_INFO();
@@ -2511,7 +2511,7 @@ TEBCresume(
*/
listPtr = Tcl_NewListObj(opnd, &OBJ_AT_DEPTH(opnd-1));
nsObjPtr = Tcl_NewStringObj(iPtr->varFramePtr->nsPtr->fullName, -1);
nsObjPtr = Tcl_NewStringObj(iPtr->varFramePtr->nsPtr->fullName, TCL_INDEX_NONE);
TclListObjSetElement(interp, listPtr, 0, nsObjPtr);
if (iPtr->varFramePtr->tailcallPtr) {
Tcl_DecrRefCount(iPtr->varFramePtr->tailcallPtr);
@@ -3444,10 +3444,8 @@ TEBCresume(
}
}
DECACHE_STACK_INFO();
Tcl_IncrRefCount(valueToAssign);
objResultPtr = TclPtrSetVarIdx(interp, varPtr, arrayPtr, part1Ptr,
part2Ptr, valueToAssign, TCL_LEAVE_ERR_MSG, opnd);
TclDecrRefCount(valueToAssign);
CACHE_STACK_INFO();
if (!objResultPtr) {
errorInLappendListPtr:
@@ -4455,7 +4453,7 @@ TEBCresume(
TRACE_APPEND(("ERROR: \"%.30s\" not on reachable chain\n",
O2S(valuePtr)));
for (i = contextPtr->index ; i != TCL_INDEX_NONE ; i--) {
for (i = contextPtr->index ; !TCL_SIZE_ISNEG(i) ; i--) {
miPtr = contextPtr->callPtr->chain + i;
if (miPtr->isFilter
|| miPtr->mPtr->declaringClassPtr != classPtr) {
@@ -4649,7 +4647,7 @@ TEBCresume(
TRACE_ERROR(interp);
goto gotError;
}
TclNewIntObj(objResultPtr, length);
TclNewUIntObj(objResultPtr, length);
TRACE_APPEND(("%" TCL_Z_MODIFIER "u\n", length));
NEXT_INST_F(1, 1, 1);
@@ -4660,14 +4658,15 @@ TEBCresume(
/* special case for ArithSeries */
if (TclHasInternalRep(valuePtr,&tclArithSeriesType)) {
length = TclArithSeriesObjLength(valuePtr);
if (TclHasInternalRep(valuePtr,&tclArithSeriesType.objType)) {
length = ABSTRACTLIST_PROC(valuePtr, lengthProc)(valuePtr);
if (TclGetIntForIndexM(interp, value2Ptr, length-1, &index)!=TCL_OK) {
CACHE_STACK_INFO();
TRACE_ERROR(interp);
goto gotError;
}
if (TclArithSeriesObjIndex(valuePtr, index, &objResultPtr) != TCL_OK) {
objResultPtr = TclArithSeriesObjIndex(interp, valuePtr, index);
if (objResultPtr == NULL) {
CACHE_STACK_INFO();
TRACE_ERROR(interp);
goto gotError;
@@ -4681,7 +4680,7 @@ TEBCresume(
*/
if ((TclListObjGetElementsM(interp, valuePtr, &objc, &objv) == TCL_OK)
&& !TclHasInternalRep(value2Ptr, &tclListType)) {
&& !TclHasInternalRep(value2Ptr, &tclListType.objType)) {
int code;
DECACHE_STACK_INFO();
@@ -4723,8 +4722,8 @@ TEBCresume(
TRACE(("\"%.30s\" %d => ", O2S(valuePtr), opnd));
/* special case for ArithSeries */
if (TclHasInternalRep(valuePtr,&tclArithSeriesType)) {
length = TclArithSeriesObjLength(valuePtr);
if (TclHasInternalRep(valuePtr,&tclArithSeriesType.objType)) {
length = ABSTRACTLIST_PROC(valuePtr, lengthProc)(valuePtr);
/* Decode end-offset index values. */
@@ -4732,7 +4731,8 @@ TEBCresume(
/* Compute value @ index */
if (index < length) {
if (TclArithSeriesObjIndex(valuePtr, index, &objResultPtr) != TCL_OK) {
objResultPtr = TclArithSeriesObjIndex(interp, valuePtr, index);
if (objResultPtr == NULL) {
CACHE_STACK_INFO();
TRACE_ERROR(interp);
goto gotError;
@@ -4943,7 +4943,7 @@ TEBCresume(
fromIdx = TclIndexDecode(fromIdx, objc - 1);
if (TclHasInternalRep(valuePtr,&tclArithSeriesType)) {
if (TclHasInternalRep(valuePtr,&tclArithSeriesType.objType)) {
objResultPtr = TclArithSeriesObjRange(interp, valuePtr, fromIdx, toIdx);
if (objResultPtr == NULL) {
TRACE_ERROR(interp);
@@ -4971,14 +4971,14 @@ TEBCresume(
if (length > 0) {
size_t i = 0;
Tcl_Obj *o;
int isArithSeries = TclHasInternalRep(value2Ptr,&tclArithSeriesType);
int isArithSeries = TclHasInternalRep(value2Ptr,&tclArithSeriesType.objType);
/*
* An empty list doesn't match anything.
*/
do {
if (isArithSeries) {
TclArithSeriesObjIndex(value2Ptr, i, &o);
o = TclArithSeriesObjIndex(NULL, value2Ptr, i);
} else {
Tcl_ListObjIndex(NULL, value2Ptr, i, &o);
}
@@ -5037,7 +5037,7 @@ TEBCresume(
case INST_LREPLACE4:
{
Tcl_Size numToDelete, numNewElems;
size_t numToDelete, numNewElems;
int end_indicator;
int haveSecondIndex, flags;
Tcl_Obj *fromIdxObj, *toIdxObj;
@@ -5071,8 +5071,7 @@ TEBCresume(
}
if (fromIdx == TCL_INDEX_NONE) {
fromIdx = 0;
}
else if (fromIdx > length) {
} else if (fromIdx > length) {
fromIdx = length;
}
numToDelete = 0;
@@ -5111,8 +5110,7 @@ TEBCresume(
}
TRACE_APPEND(("\"%.30s\"\n", O2S(objResultPtr)));
NEXT_INST_V(6, opnd, 1);
}
else {
} else {
if (Tcl_ListObjReplace(interp,
valuePtr,
fromIdx,
@@ -5148,7 +5146,7 @@ TEBCresume(
{
int checkEq = ((*pc == INST_EQ) || (*pc == INST_NEQ)
|| (*pc == INST_STR_EQ) || (*pc == INST_STR_NEQ));
match = TclStringCmp(valuePtr, value2Ptr, checkEq, 0, -1);
match = TclStringCmp(valuePtr, value2Ptr, checkEq, 0, TCL_INDEX_NONE);
}
/*
@@ -5274,7 +5272,7 @@ TEBCresume(
TclNewObj(objResultPtr);
} else if (TclIsPureByteArray(valuePtr)) {
objResultPtr = Tcl_NewByteArrayObj(
Tcl_GetBytesFromObj(NULL, valuePtr, (size_t *)NULL)+index, 1);
Tcl_GetByteArrayFromObj(valuePtr, (size_t *)NULL)+index, 1);
} else if (valuePtr->bytes && slength == valuePtr->length) {
objResultPtr = Tcl_NewStringObj((const char *)
valuePtr->bytes+index, 1);
@@ -5348,7 +5346,7 @@ TEBCresume(
toIdx = TclIndexDecode(toIdx, slength - 1);
fromIdx = TclIndexDecode(fromIdx, slength - 1);
if (toIdx == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(toIdx)) {
TclNewObj(objResultPtr);
} else {
objResultPtr = Tcl_GetRange(valuePtr, fromIdx, toIdx);
@@ -5383,7 +5381,7 @@ TEBCresume(
TclDecrRefCount(OBJ_AT_TOS);
(void) POP_OBJECT();
if ((toIdx == TCL_INDEX_NONE) ||
if (TCL_SIZE_ISNEG(toIdx) ||
(fromIdx + 1 > slength + 1) ||
(toIdx + 1 < fromIdx + 1)) {
TRACE_APPEND(("\"%.30s\"\n", O2S(valuePtr)));
@@ -5391,7 +5389,7 @@ TEBCresume(
NEXT_INST_F(1, 0, 0);
}
if (fromIdx == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(fromIdx)) {
fromIdx = TCL_INDEX_START;
}
@@ -5536,7 +5534,7 @@ TEBCresume(
ustring2 = Tcl_GetUnicodeFromObj(value2Ptr, &length2);
match = TclUniCharMatch(ustring1, slength, ustring2, length2,
nocase);
} else if (TclIsPureByteArray(valuePtr) && !nocase) {
} else if (TclIsPureByteArray(valuePtr) && TclIsPureByteArray(value2Ptr) && !nocase) {
unsigned char *bytes1, *bytes2;
size_t wlen1 = 0, wlen2 = 0;
@@ -5842,7 +5840,7 @@ TEBCresume(
case INST_RSHIFT:
if (w2 < 0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"negative shift argument", -1));
"negative shift argument", TCL_INDEX_NONE));
#ifdef ERROR_CODE_FOR_EARLY_DETECTED_ARITH_ERROR
DECACHE_STACK_INFO();
Tcl_SetErrorCode(interp, "ARITH", "DOMAIN",
@@ -5891,7 +5889,7 @@ TEBCresume(
case INST_LSHIFT:
if (w2 < 0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"negative shift argument", -1));
"negative shift argument", TCL_INDEX_NONE));
#ifdef ERROR_CODE_FOR_EARLY_DETECTED_ARITH_ERROR
DECACHE_STACK_INFO();
Tcl_SetErrorCode(interp, "ARITH", "DOMAIN",
@@ -5914,7 +5912,7 @@ TEBCresume(
*/
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"integer value too large to represent", -1));
"integer value too large to represent", TCL_INDEX_NONE));
#ifdef ERROR_CODE_FOR_EARLY_DETECTED_ARITH_ERROR
DECACHE_STACK_INFO();
Tcl_SetErrorCode(interp, "ARITH", "IOVERFLOW",
@@ -6337,7 +6335,7 @@ TEBCresume(
case INST_TRY_CVT_TO_BOOLEAN:
valuePtr = OBJ_AT_TOS;
if (TclHasInternalRep(valuePtr, &tclBooleanType)) {
if (TclHasInternalRep(valuePtr, &tclBooleanType.objType)) {
objResultPtr = TCONST(1);
} else {
int res = (TclSetBooleanFromAny(NULL, valuePtr) == TCL_OK);
@@ -7388,7 +7386,7 @@ TEBCresume(
rangePtr->codeOffset, rangePtr->breakOffset));
NEXT_INST_F(0, 0, 0);
}
if (rangePtr->continueOffset == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(rangePtr->continueOffset)) {
TRACE_APPEND(("%s, loop w/o continue, checking for catch\n",
StringForResultCode(result)));
goto checkForCatch;
@@ -7420,14 +7418,14 @@ TEBCresume(
*/
divideByZero:
Tcl_SetObjResult(interp, Tcl_NewStringObj("divide by zero", -1));
Tcl_SetObjResult(interp, Tcl_NewStringObj("divide by zero", TCL_INDEX_NONE));
DECACHE_STACK_INFO();
Tcl_SetErrorCode(interp, "ARITH", "DIVZERO", "divide by zero", NULL);
CACHE_STACK_INFO();
goto gotError;
outOfMemory:
Tcl_SetObjResult(interp, Tcl_NewStringObj("out of memory", -1));
Tcl_SetObjResult(interp, Tcl_NewStringObj("out of memory", TCL_INDEX_NONE));
DECACHE_STACK_INFO();
Tcl_SetErrorCode(interp, "ARITH", "OUTOFMEMORY", "out of memory", NULL);
CACHE_STACK_INFO();
@@ -7440,7 +7438,7 @@ TEBCresume(
exponOfZero:
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"exponentiation of zero by negative power", -1));
"exponentiation of zero by negative power", TCL_INDEX_NONE));
DECACHE_STACK_INFO();
Tcl_SetErrorCode(interp, "ARITH", "DOMAIN",
"exponentiation of zero by negative power", NULL);
@@ -8001,7 +7999,7 @@ ExecuteExtendedBinaryMathOp(
}
if (invalid) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"negative shift argument", -1));
"negative shift argument", TCL_INDEX_NONE));
return GENERAL_ARITHMETIC_ERROR;
}
@@ -8032,7 +8030,7 @@ ExecuteExtendedBinaryMathOp(
*/
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"integer value too large to represent", -1));
"integer value too large to represent", TCL_INDEX_NONE));
return GENERAL_ARITHMETIC_ERROR;
}
shift = (int)(*((const Tcl_WideInt *)ptr2));
@@ -8280,7 +8278,7 @@ ExecuteExtendedBinaryMathOp(
if (type2 != TCL_NUMBER_INT) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"exponent too large", -1));
"exponent too large", TCL_INDEX_NONE));
return GENERAL_ARITHMETIC_ERROR;
}
@@ -8357,10 +8355,10 @@ ExecuteExtendedBinaryMathOp(
overflowExpon:
if ((TclGetWideIntFromObj(NULL, value2Ptr, &w2) != TCL_OK)
|| (value2Ptr->typePtr != &tclIntType)
|| (value2Ptr->typePtr != &tclIntType.objType)
|| (Tcl_WideUInt)w2 >= (1<<28)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"exponent too large", -1));
"exponent too large", TCL_INDEX_NONE));
return GENERAL_ARITHMETIC_ERROR;
}
Tcl_TakeBignumFromObj(NULL, valuePtr, &big1);
@@ -9302,7 +9300,7 @@ GetExceptRangeForPc(
if (searchMode == TCL_BREAK) {
return rangePtr;
}
if (searchMode == TCL_CONTINUE && rangePtr->continueOffset != TCL_INDEX_NONE){
if (searchMode == TCL_CONTINUE && !TCL_SIZE_ISNEG(rangePtr->continueOffset)){
return rangePtr;
}
}
@@ -9367,16 +9365,16 @@ TclExprFloatError(
if ((errno == EDOM) || isnan(value)) {
s = "domain error: argument not in valid range";
Tcl_SetObjResult(interp, Tcl_NewStringObj(s, -1));
Tcl_SetObjResult(interp, Tcl_NewStringObj(s, TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "ARITH", "DOMAIN", s, NULL);
} else if ((errno == ERANGE) || isinf(value)) {
if (value == 0.0) {
s = "floating-point value too small to represent";
Tcl_SetObjResult(interp, Tcl_NewStringObj(s, -1));
Tcl_SetObjResult(interp, Tcl_NewStringObj(s, TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "ARITH", "UNDERFLOW", s, NULL);
} else {
s = "floating-point value too large to represent";
Tcl_SetObjResult(interp, Tcl_NewStringObj(s, -1));
Tcl_SetObjResult(interp, Tcl_NewStringObj(s, TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "ARITH", "OVERFLOW", s, NULL);
}
} else {
@@ -9736,7 +9734,7 @@ EvalStatsCmd(
break;
}
}
for (i = 31; i != TCL_INDEX_NONE; i--) {
for (i = 31; !TCL_SIZE_ISNEG(i); i--) {
if (statsPtr->srcCount[i] > 0) {
break; /* maxSizeDecade to consume 'i' value
* below... */
@@ -9760,7 +9758,7 @@ EvalStatsCmd(
break;
}
}
for (i = 31; i != TCL_INDEX_NONE; i--) {
for (i = 31; !TCL_SIZE_ISNEG(i); i--) {
if (statsPtr->byteCodeCount[i] > 0) {
break; /* maxSizeDecade to consume 'i' value
* below... */
@@ -9784,7 +9782,7 @@ EvalStatsCmd(
break;
}
}
for (i = 31; i != TCL_INDEX_NONE; i--) {
for (i = 31; !TCL_SIZE_ISNEG(i); i--) {
if (statsPtr->lifetimeCount[i] > 0) {
break; /* maxSizeDecade to consume 'i' value
* below... */
+3 -3
View File
@@ -426,7 +426,7 @@ TclFileDeleteCmd(
if (result != TCL_OK) {
if (errfile == NULL) {
/*
* We try to accomodate poor error results from our Tcl_FS calls.
* We try to accommodate poor error results from our Tcl_FS calls.
*/
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
@@ -1042,7 +1042,7 @@ TclFileAttrsCmd(
res = Tcl_FSFileAttrsGet(interp, index, filePtr, &objPtrAttr);
if (res == TCL_OK) {
Tcl_Obj *objPtr =
Tcl_NewStringObj(attributeStrings[index], -1);
Tcl_NewStringObj(attributeStrings[index], TCL_INDEX_NONE);
Tcl_ListObjAppendElement(interp, listPtr, objPtr);
Tcl_ListObjAppendElement(interp, listPtr, objPtrAttr);
@@ -1492,7 +1492,7 @@ TclFileTemporaryCmd(
return TCL_ERROR;
}
}
Tcl_SetObjResult(interp, Tcl_NewStringObj(Tcl_GetChannelName(chan), -1));
Tcl_SetObjResult(interp, Tcl_NewStringObj(Tcl_GetChannelName(chan), TCL_INDEX_NONE));
return TCL_OK;
}
+20 -20
View File
@@ -428,7 +428,7 @@ TclpGetNativePathType(
if ((rootEnd != path) && (driveNameLengthPtr != NULL)) {
*driveNameLengthPtr = rootEnd - path;
if (driveNameRef != NULL) {
*driveNameRef = TclDStringToObj(&ds);
*driveNameRef = Tcl_DStringToObj(&ds);
Tcl_IncrRefCount(*driveNameRef);
}
}
@@ -537,7 +537,7 @@ Tcl_SplitPath(
* Perform the splitting, using objectified, vfs-aware code.
*/
tmpPtr = Tcl_NewStringObj(path, -1);
tmpPtr = Tcl_NewStringObj(path, TCL_INDEX_NONE);
Tcl_IncrRefCount(tmpPtr);
resultPtr = Tcl_FSSplitPath(tmpPtr, argcPtr);
Tcl_IncrRefCount(resultPtr);
@@ -701,7 +701,7 @@ SplitWinPath(
*/
if (p != path) {
Tcl_ListObjAppendElement(NULL, result, TclDStringToObj(&buf));
Tcl_ListObjAppendElement(NULL, result, Tcl_DStringToObj(&buf));
}
Tcl_DStringFree(&buf);
@@ -758,7 +758,7 @@ SplitWinPath(
Tcl_Obj *
Tcl_FSJoinToPath(
Tcl_Obj *pathPtr, /* Valid path or NULL. */
size_t objc, /* Number of array elements to join */
Tcl_Size objc, /* Number of array elements to join */
Tcl_Obj *const objv[]) /* Path elements to join. */
{
if (pathPtr == NULL) {
@@ -927,11 +927,11 @@ TclpNativeJoinPath(
char *
Tcl_JoinPath(
size_t argc,
Tcl_Size argc,
const char *const *argv,
Tcl_DString *resultPtr) /* Pointer to previously initialized DString */
{
size_t i, len;
Tcl_Size i, len;
Tcl_Obj *listObj;
Tcl_Obj *resultObj;
const char *resultStr;
@@ -943,7 +943,7 @@ Tcl_JoinPath(
TclNewObj(listObj);
for (i = 0; i < argc; i++) {
Tcl_ListObjAppendElement(NULL, listObj,
Tcl_NewStringObj(argv[i], -1));
Tcl_NewStringObj(argv[i], TCL_INDEX_NONE));
}
/*
@@ -1003,7 +1003,7 @@ Tcl_TranslateFileName(
Tcl_DString *bufferPtr) /* Uninitialized or free DString filled with
* name. */
{
Tcl_Obj *path = Tcl_NewStringObj(name, -1);
Tcl_Obj *path = Tcl_NewStringObj(name, TCL_INDEX_NONE);
Tcl_Obj *transPtr;
Tcl_IncrRefCount(path);
@@ -1171,7 +1171,7 @@ Tcl_GlobObjCmd(
case GLOB_DIR: /* -dir */
if (i == (objc-1)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"missing argument to \"-directory\"", -1));
"missing argument to \"-directory\"", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "ARGUMENT", "MISSING", NULL);
return TCL_ERROR;
}
@@ -1199,7 +1199,7 @@ Tcl_GlobObjCmd(
case GLOB_PATH: /* -path */
if (i == (objc-1)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"missing argument to \"-path\"", -1));
"missing argument to \"-path\"", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "ARGUMENT", "MISSING", NULL);
return TCL_ERROR;
}
@@ -1220,7 +1220,7 @@ Tcl_GlobObjCmd(
case GLOB_TYPE: /* -types */
if (i == (objc-1)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"missing argument to \"-types\"", -1));
"missing argument to \"-types\"", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "ARGUMENT", "MISSING", NULL);
return TCL_ERROR;
}
@@ -1240,7 +1240,7 @@ Tcl_GlobObjCmd(
if ((globFlags & TCL_GLOBMODE_TAILS) && (pathOrDir == NULL)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"\"-tails\" must be used with either "
"\"-directory\" or \"-path\"", -1));
"\"-directory\" or \"-path\"", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "GLOB",
"BADOPTIONCOMBINATION", NULL);
return TCL_ERROR;
@@ -1291,7 +1291,7 @@ Tcl_GlobObjCmd(
* in TclGlob requires a non-NULL pathOrDir.
*/
Tcl_DStringAppend(&pref, first, -1);
Tcl_DStringAppend(&pref, first, TCL_INDEX_NONE);
globFlags &= ~TCL_GLOBMODE_TAILS;
pathOrDir = NULL;
} else {
@@ -1330,7 +1330,7 @@ Tcl_GlobObjCmd(
}
}
if (*search != '\0') {
Tcl_DStringAppend(&prefix, search, -1);
Tcl_DStringAppend(&prefix, search, TCL_INDEX_NONE);
}
Tcl_DStringFree(&pref);
}
@@ -1460,7 +1460,7 @@ Tcl_GlobObjCmd(
badMacTypesArg:
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"only one MacOS type or creator argument"
" to \"-types\" allowed", -1));
" to \"-types\" allowed", TCL_INDEX_NONE));
result = TCL_ERROR;
Tcl_SetErrorCode(interp, "TCL", "ARGUMENT", "BAD", NULL);
join = 0;
@@ -1642,7 +1642,7 @@ TclGlob(
|| (tail[0] == '\\' && tail[1] == '\\'))) {
size_t driveNameLen;
Tcl_Obj *driveName;
Tcl_Obj *temp = Tcl_NewStringObj(tail, -1);
Tcl_Obj *temp = Tcl_NewStringObj(tail, TCL_INDEX_NONE);
Tcl_IncrRefCount(temp);
switch (TclGetPathType(temp, NULL, &driveNameLen, &driveName)) {
@@ -2033,14 +2033,14 @@ DoGlob(
break;
}
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"unmatched open-brace in file name", -1));
"unmatched open-brace in file name", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "GLOB", "BALANCE",
NULL);
return TCL_ERROR;
} else if (*p == '}') {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"unmatched close-brace in file name", -1));
"unmatched close-brace in file name", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "GLOB", "BALANCE",
NULL);
return TCL_ERROR;
@@ -2072,7 +2072,7 @@ DoGlob(
SkipToChar(&p, ',');
Tcl_DStringSetLength(&newName, baseLength);
Tcl_DStringAppend(&newName, element, p-element);
Tcl_DStringAppend(&newName, closeBrace+1, -1);
Tcl_DStringAppend(&newName, closeBrace+1, TCL_INDEX_NONE);
result = DoGlob(interp, matchesObj, separators, pathPtr, flags,
Tcl_DStringValue(&newName), types);
if (result != TCL_OK) {
@@ -2241,7 +2241,7 @@ DoGlob(
*/
if (pathPtr == NULL) {
joinedPtr = TclDStringToObj(&append);
joinedPtr = Tcl_DStringToObj(&append);
} else if (flags) {
joinedPtr = TclNewFSPathObj(pathPtr, Tcl_DStringValue(&append),
Tcl_DStringLength(&append));
+4 -4
View File
@@ -623,18 +623,18 @@ Tcl_HashStats(
*/
result = (char *)Tcl_Alloc((NUM_COUNTERS * 60) + 300);
sprintf(result, "%" TCL_Z_MODIFIER "u entries in table, %" TCL_Z_MODIFIER "u buckets\n",
snprintf(result, 60, "%" TCL_Z_MODIFIER "u entries in table, %" TCL_Z_MODIFIER "u buckets\n",
tablePtr->numEntries, tablePtr->numBuckets);
p = result + strlen(result);
for (i = 0; i < NUM_COUNTERS; i++) {
sprintf(p, "number of buckets with %" TCL_Z_MODIFIER "u entries: %" TCL_Z_MODIFIER "u\n",
snprintf(p, 60, "number of buckets with %" TCL_Z_MODIFIER "u entries: %" TCL_Z_MODIFIER "u\n",
i, count[i]);
p += strlen(p);
}
sprintf(p, "number of buckets with %d or more entries: %" TCL_Z_MODIFIER "u\n",
snprintf(p, 60, "number of buckets with %d or more entries: %" TCL_Z_MODIFIER "u\n",
NUM_COUNTERS, overflow);
p += strlen(p);
sprintf(p, "average search distance for entry: %.1f", average);
snprintf(p, 60, "average search distance for entry: %.1f", average);
return result;
}
+1 -1
View File
@@ -69,7 +69,7 @@ Tcl_RecordAndEval(
* Call Tcl_RecordAndEvalObj to do the actual work.
*/
cmdPtr = Tcl_NewStringObj(cmd, -1);
cmdPtr = Tcl_NewStringObj(cmd, TCL_INDEX_NONE);
Tcl_IncrRefCount(cmdPtr);
result = Tcl_RecordAndEvalObj(interp, cmdPtr, flags);
+409 -299
View File
File diff suppressed because it is too large Load Diff
+19 -11
View File
@@ -36,12 +36,12 @@
*/
typedef struct ChannelBuffer {
size_t refCount; /* Current uses count */
size_t nextAdded; /* The next position into which a character
Tcl_Size refCount; /* Current uses count */
Tcl_Size nextAdded; /* The next position into which a character
* will be put in the buffer. */
size_t nextRemoved; /* Position of next byte to be removed from
Tcl_Size nextRemoved; /* Position of next byte to be removed from
* the buffer. */
size_t bufLength; /* How big is the buffer? */
Tcl_Size bufLength; /* How big is the buffer? */
struct ChannelBuffer *nextPtr;
/* Next buffer in chain. */
char buf[TCLFLEXARRAY]; /* Placeholder for real buffer. The real
@@ -113,7 +113,7 @@ typedef struct Channel {
ChannelBuffer *inQueueHead; /* Points at first buffer in input queue. */
ChannelBuffer *inQueueTail; /* Points at last buffer in input queue. */
size_t refCount;
Tcl_Size refCount;
} Channel;
/*
@@ -165,7 +165,7 @@ typedef struct ChannelState {
int unreportedError; /* Non-zero if an error report was deferred
* because it happened in the background. The
* value is the POSIX error code. */
size_t refCount; /* How many interpreters hold references to
Tcl_Size refCount; /* How many interpreters hold references to
* this IO channel? */
struct CloseCallback *closeCbPtr;
/* Callbacks registered to be called when the
@@ -188,8 +188,11 @@ typedef struct ChannelState {
EventScriptRecord *scriptRecordPtr;
/* Chain of all scripts registered for event
* handlers ("fileevent") on this channel. */
size_t bufSize; /* What size buffers to allocate? */
Tcl_Size bufSize; /* What size buffers to allocate? */
Tcl_TimerToken timer; /* Handle to wakeup timer for this channel. */
Channel *timerChanPtr; /* Needed in order to decrement the refCount of
the right channel when the timer is
deleted. */
struct CopyState *csPtrR; /* State of background copy for which channel
* is input, or NULL. */
struct CopyState *csPtrW; /* State of background copy for which channel
@@ -273,12 +276,10 @@ typedef struct ChannelState {
* delivered for buffered data until
* the state of the channel
* changes. */
#define CHANNEL_ENCODING_ERROR (1<<15) /* set if channel
* encountered an encoding error */
#define CHANNEL_RAW_MODE (1<<16) /* When set, notes that the Raw API is
* being used. */
#define CHANNEL_ENCODING_NOCOMPLAIN (1<<17) /* set if option
* -nocomplainencoding is set to 1 */
#define CHANNEL_ENCODING_STRICT (1<<18) /* set if option
* -strictencoding is set to 1 */
#define CHANNEL_INCLOSE (1<<19) /* Channel is currently being closed.
* Its structures are still live and
* usable, but it may not be closed
@@ -287,6 +288,13 @@ typedef struct ChannelState {
#define CHANNEL_CLOSEDWRITE (1<<21) /* Channel write side has been closed.
* No further Tcl-level write IO on
* the channel is allowed. */
#define CHANNEL_PROFILE_MASK 0xFF000000
#define CHANNEL_PROFILE_GET(flags_) ((flags_) & CHANNEL_PROFILE_MASK)
#define CHANNEL_PROFILE_SET(flags_, profile_) \
do { \
(flags_) &= ~CHANNEL_PROFILE_MASK; \
(flags_) |= profile_; \
} while (0)
/*
* The length of time to wait between synthetic timer events. Must be zero or
+12 -9
View File
@@ -10,6 +10,7 @@
*/
#include "tclInt.h"
#include "tclTomMath.h"
/*
* Callback structure for accept callback in a TCP server.
@@ -44,7 +45,7 @@ static void RegisterTcpServerInterpCleanup(
Tcl_Interp *interp,
AcceptCallback *acceptCallbackPtr);
static Tcl_InterpDeleteProc TcpAcceptCallbacksDeleteProc;
static void TcpServerCloseProc(ClientData callbackData);
static void TcpServerCloseProc(void *callbackData);
static void UnregisterTcpServerInterpCleanupProc(
Tcl_Interp *interp,
AcceptCallback *acceptCallbackPtr);
@@ -106,7 +107,7 @@ Tcl_PutsObjCmd(
Tcl_Obj *string; /* String to write. */
Tcl_Obj *chanObjPtr = NULL; /* channel object. */
int newline; /* Add a newline at end? */
int result; /* Result of puts operation. */
size_t result; /* Result of puts operation. */
int mode; /* Mode in which channel is opened. */
switch (objc) {
@@ -163,12 +164,12 @@ Tcl_PutsObjCmd(
TclChannelPreserve(chan);
result = Tcl_WriteObj(chan, string);
if (result == -1) {
if (TCL_SIZE_ISNEG(result)) {
goto error;
}
if (newline != 0) {
result = Tcl_WriteChars(chan, "\n", 1);
if (result == -1) {
if (TCL_SIZE_ISNEG(result)) {
goto error;
}
}
@@ -330,7 +331,9 @@ Tcl_GetsObjCmd(
code = TCL_ERROR;
goto done;
}
Tcl_SetObjResult(interp, Tcl_NewWideIntObj((Tcl_WideInt)((Tcl_WideUInt)(lineLen + 1U)) - 1));
Tcl_Obj *lineLenObj;
TclNewIndexObj(lineLenObj, lineLen);
Tcl_SetObjResult(interp, lineLenObj);
} else {
Tcl_SetObjResult(interp, linePtr);
}
@@ -1080,7 +1083,7 @@ Tcl_OpenObjCmd(
if (objc == 4) {
const char *permString = TclGetString(objv[3]);
int code = TCL_ERROR;
int scanned = TclParseAllWhiteSpace(permString, -1);
int scanned = TclParseAllWhiteSpace(permString, TCL_INDEX_NONE);
/*
* Support legacy octal numbers.
@@ -1183,7 +1186,7 @@ Tcl_OpenObjCmd(
static void
TcpAcceptCallbacksDeleteProc(
ClientData clientData, /* Data which was passed when the assocdata
void *clientData, /* Data which was passed when the assocdata
* was registered. */
TCL_UNUSED(Tcl_Interp *))
{
@@ -1311,7 +1314,7 @@ UnregisterTcpServerInterpCleanupProc(
static void
AcceptCallbackProc(
ClientData callbackData, /* The data stored when the callback was
void *callbackData, /* The data stored when the callback was
* created in the call to
* Tcl_OpenTcpServer. */
Tcl_Channel chan, /* Channel for the newly accepted
@@ -1402,7 +1405,7 @@ AcceptCallbackProc(
static void
TcpServerCloseProc(
ClientData callbackData) /* The data passed in the call to
void *callbackData) /* The data passed in the call to
* Tcl_CreateCloseHandler. */
{
AcceptCallback *acceptCallbackPtr = (AcceptCallback *)callbackData;
+26 -26
View File
@@ -19,25 +19,25 @@
* the transformation.
*/
static int TransformBlockModeProc(ClientData instanceData,
static int TransformBlockModeProc(void *instanceData,
int mode);
static int TransformCloseProc(ClientData instanceData,
static int TransformCloseProc(void *instanceData,
Tcl_Interp *interp, int flags);
static int TransformInputProc(ClientData instanceData, char *buf,
static int TransformInputProc(void *instanceData, char *buf,
int toRead, int *errorCodePtr);
static int TransformOutputProc(ClientData instanceData,
static int TransformOutputProc(void *instanceData,
const char *buf, int toWrite, int *errorCodePtr);
static int TransformSetOptionProc(ClientData instanceData,
static int TransformSetOptionProc(void *instanceData,
Tcl_Interp *interp, const char *optionName,
const char *value);
static int TransformGetOptionProc(ClientData instanceData,
static int TransformGetOptionProc(void *instanceData,
Tcl_Interp *interp, const char *optionName,
Tcl_DString *dsPtr);
static void TransformWatchProc(ClientData instanceData, int mask);
static int TransformGetFileHandleProc(ClientData instanceData,
int direction, ClientData *handlePtr);
static int TransformNotifyProc(ClientData instanceData, int mask);
static long long TransformWideSeekProc(ClientData instanceData,
static void TransformWatchProc(void *instanceData, int mask);
static int TransformGetFileHandleProc(void *instanceData,
int direction, void **handlePtr);
static int TransformNotifyProc(void *instanceData, int mask);
static long long TransformWideSeekProc(void *instanceData,
long long offset, int mode, int *errorCodePtr);
/*
@@ -45,7 +45,7 @@ static long long TransformWideSeekProc(ClientData instanceData,
* handling and generating fileeevents.
*/
static void TransformChannelHandlerTimer(ClientData clientData);
static void TransformChannelHandlerTimer(void *clientData);
/*
* Forward declarations of internal procedures. Third, helper procedures
@@ -268,7 +268,7 @@ TclChannelTransform(
if (TCL_OK != TclListObjLengthM(interp, cmdObjPtr, &objc)) {
Tcl_SetObjResult(interp,
Tcl_NewStringObj("-command value is not a list", -1));
Tcl_NewStringObj("-command value is not a list", TCL_INDEX_NONE));
return TCL_ERROR;
}
@@ -397,7 +397,7 @@ ExecuteCallback(
}
Tcl_IncrRefCount(command);
Tcl_ListObjAppendElement(NULL, command, Tcl_NewStringObj((char *) op, -1));
Tcl_ListObjAppendElement(NULL, command, Tcl_NewStringObj((char *) op, TCL_INDEX_NONE));
/*
* Use a byte-array to prevent the misinterpretation of binary data coming
@@ -510,7 +510,7 @@ ExecuteCallback(
static int
TransformBlockModeProc(
ClientData instanceData, /* State of transformation. */
void *instanceData, /* State of transformation. */
int mode) /* New blocking mode. */
{
TransformChannelData *dataPtr = (TransformChannelData *)instanceData;
@@ -542,7 +542,7 @@ TransformBlockModeProc(
static int
TransformCloseProc(
ClientData instanceData,
void *instanceData,
Tcl_Interp *interp,
int flags)
{
@@ -626,7 +626,7 @@ TransformCloseProc(
static int
TransformInputProc(
ClientData instanceData,
void *instanceData,
char *buf,
int toRead,
int *errorCodePtr)
@@ -793,7 +793,7 @@ TransformInputProc(
static int
TransformOutputProc(
ClientData instanceData,
void *instanceData,
const char *buf,
int toWrite,
int *errorCodePtr)
@@ -845,7 +845,7 @@ TransformOutputProc(
static long long
TransformWideSeekProc(
ClientData instanceData, /* The channel to manipulate. */
void *instanceData, /* The channel to manipulate. */
long long offset, /* Size of movement. */
int mode, /* How to move. */
int *errorCodePtr) /* Location of error flag. */
@@ -923,7 +923,7 @@ TransformWideSeekProc(
static int
TransformSetOptionProc(
ClientData instanceData,
void *instanceData,
Tcl_Interp *interp,
const char *optionName,
const char *value)
@@ -961,7 +961,7 @@ TransformSetOptionProc(
static int
TransformGetOptionProc(
ClientData instanceData,
void *instanceData,
Tcl_Interp *interp,
const char *optionName,
Tcl_DString *dsPtr)
@@ -1008,7 +1008,7 @@ TransformGetOptionProc(
static void
TransformWatchProc(
ClientData instanceData, /* Channel to watch. */
void *instanceData, /* Channel to watch. */
int mask) /* Events of interest. */
{
TransformChannelData *dataPtr = (TransformChannelData *)instanceData;
@@ -1086,9 +1086,9 @@ TransformWatchProc(
static int
TransformGetFileHandleProc(
ClientData instanceData, /* Channel to query. */
void *instanceData, /* Channel to query. */
int direction, /* Direction of interest. */
ClientData *handlePtr) /* Place to store the handle into. */
void **handlePtr) /* Place to store the handle into. */
{
TransformChannelData *dataPtr = (TransformChannelData *)instanceData;
@@ -1120,7 +1120,7 @@ TransformGetFileHandleProc(
static int
TransformNotifyProc(
ClientData clientData, /* The state of the notified
void *clientData, /* The state of the notified
* transformation. */
int mask) /* The mask of occuring events. */
{
@@ -1165,7 +1165,7 @@ TransformNotifyProc(
static void
TransformChannelHandlerTimer(
ClientData clientData) /* Transformation to query. */
void *clientData) /* Transformation to query. */
{
TransformChannelData *dataPtr = (TransformChannelData *)clientData;
+14 -13
View File
@@ -549,7 +549,7 @@ TclChanCreateObjCmd(
/*
* First argument is a list of modes. Allowed entries are "read", "write".
* Expect at least one list element. Abbreviations are ok.
* Empty list is uncommon, but allowed. Abbreviations are ok.
*/
modeObj = objv[MODE];
@@ -922,6 +922,11 @@ TclChanPostEventObjCmd(
if (EncodeEventMask(interp, "event", objv[EVENT], &events) != TCL_OK) {
return TCL_ERROR;
}
if (events == 0) {
Tcl_SetObjResult(interp,
Tcl_NewStringObj("bad event list: is empty", -1));
return TCL_ERROR;
}
/*
* Check that the channel is actually interested in the provided events.
@@ -1387,7 +1392,7 @@ ReflectInput(
if (bytev == NULL) {
SetChannelErrorStr(rcPtr->chan, msg_read_nonbyte);
goto invalid;
goto invalid;
} else if ((size_t)toRead < bytec) {
SetChannelErrorStr(rcPtr->chan, msg_read_toomuch);
goto invalid;
@@ -2111,10 +2116,10 @@ ReflectTruncate(
* EncodeEventMask --
*
* This function takes a list of event items and constructs the
* equivalent internal bitmask. The list must contain at least one
* element. Elements are "read", "write", or any unique abbreviation of
* them. Note that the bitmask is not changed if problems are
* encountered.
* equivalent internal bitmask. The list may be empty but will usually
* contain at least one element. Valid elements are "read", "write", or
* any unique abbreviation of them. Note that the bitmask is not changed
* if problems are encountered.
*
* Results:
* A standard Tcl error code. A bitmask where TCL_READABLE and/or
@@ -2144,12 +2149,6 @@ EncodeEventMask(
return TCL_ERROR;
}
if (listc < 1) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"bad %s list: is empty", objName));
return TCL_ERROR;
}
events = 0;
while (listc > 0) {
if (Tcl_GetIndexFromObj(interp, listv[listc-1], eventOptions,
@@ -2804,6 +2803,7 @@ DeleteThreadReflectedChannelMap(
Tcl_ThreadId self = Tcl_GetCurrentThread();
ReflectedChannelMap *rcmPtr; /* The map */
ForwardingResult *resultPtr;
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
/*
* The origin thread for one or more reflected channels is gone.
@@ -2883,6 +2883,7 @@ DeleteThreadReflectedChannelMap(
*/
rcmPtr = GetThreadReflectedChannelMap();
tsdPtr->rcmPtr = NULL;
for (hPtr = Tcl_FirstHashEntry(&rcmPtr->map, &hSearch);
hPtr != NULL;
hPtr = Tcl_FirstHashEntry(&rcmPtr->map, &hSearch)) {
@@ -3319,7 +3320,7 @@ ForwardProc(
*/
char *buf = (char *)Tcl_Alloc(200);
sprintf(buf,
snprintf(buf, 200,
"{Expected list with even number of elements, got %" TCL_Z_MODIFIER "u %s instead}",
listc, (listc == 1 ? "element" : "elements"));
+3 -3
View File
@@ -117,13 +117,13 @@ TclSockGetPort(
int
TclSockMinimumBuffers(
void *sock, /* Socket file descriptor */
size_t size1) /* Minimum buffer size */
Tcl_Size size1) /* Minimum buffer size */
{
int current;
socklen_t len;
int size = size1;
if ((size_t)size != size1) {
if ((Tcl_Size)size != size1) {
return TCL_ERROR;
}
len = sizeof(int);
@@ -317,7 +317,7 @@ Tcl_OpenTcpServer(
int port,
const char *host,
Tcl_TcpAcceptProc *acceptProc,
ClientData callbackData)
void *callbackData)
{
char portbuf[TCL_INTEGER_SPACE];
+6 -6
View File
@@ -178,7 +178,7 @@ const Tcl_Filesystem tclNativeFilesystem = {
/*
* An initial record in the linked list for the native filesystem. Remains at
* the tail of the list and is never freed. Currently the native filesystem is
* hard-coded. It may make sense to modify this to accomodate unconventional
* hard-coded. It may make sense to modify this to accommodate unconventional
* uses of Tcl that provide no native filesystem.
*/
@@ -1756,7 +1756,7 @@ Tcl_FSEvalFileEx(
* Otherwise, replace them. [Bug 3466099]
*/
if (Tcl_ReadChars(chan, objPtr, -1,
if (Tcl_ReadChars(chan, objPtr, TCL_INDEX_NONE,
memcmp(string, "\xEF\xBB\xBF", 3)) == TCL_IO_FAILURE) {
Tcl_CloseEx(interp, chan, 0);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
@@ -1893,7 +1893,7 @@ TclNREvalFile(
* Otherwise, replace them. [Bug 3466099]
*/
if (Tcl_ReadChars(chan, objPtr, -1,
if (Tcl_ReadChars(chan, objPtr, TCL_INDEX_NONE,
memcmp(string, "\xEF\xBB\xBF", 3)) == TCL_IO_FAILURE) {
Tcl_CloseEx(interp, chan, 0);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
@@ -2459,7 +2459,7 @@ TclFSFileAttrIndex(
* It's a constant attribute table, so use T_GIFO.
*/
Tcl_Obj *tmpObj = Tcl_NewStringObj(attributeName, -1);
Tcl_Obj *tmpObj = Tcl_NewStringObj(attributeName, TCL_INDEX_NONE);
int result;
result = Tcl_GetIndexFromObj(NULL, tmpObj, attrTable, NULL, TCL_EXACT,
@@ -3292,7 +3292,7 @@ Tcl_LoadFile(
Tcl_DecrRefCount(copyToPtr);
if (interp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"couldn't load from current filesystem", -1));
"couldn't load from current filesystem", TCL_INDEX_NONE));
}
return TCL_ERROR;
}
@@ -4612,7 +4612,7 @@ Tcl_FSFileSystemInfo(
resPtr = Tcl_NewListObj(0, NULL);
Tcl_ListObjAppendElement(NULL, resPtr,
Tcl_NewStringObj(fsPtr->typeName, -1));
Tcl_NewStringObj(fsPtr->typeName, TCL_INDEX_NONE));
if (fsPtr->filesystemPathTypeProc != NULL) {
Tcl_Obj *typePtr = fsPtr->filesystemPathTypeProc(pathPtr);
+27 -27
View File
@@ -55,8 +55,8 @@ static const Tcl_ObjType indexType = {
typedef struct {
void *tablePtr; /* Pointer to the table of strings */
size_t offset; /* Offset between table entries */
size_t index; /* Selected index into table. */
Tcl_Size offset; /* Offset between table entries */
Tcl_Size index; /* Selected index into table. */
} IndexRep;
/*
@@ -107,7 +107,7 @@ GetIndexFromObjList(
int *indexPtr) /* Place to store resulting integer index. */
{
size_t objc, t;
Tcl_Size objc, t;
int result;
Tcl_Obj **objv;
const char **tablePtr;
@@ -187,13 +187,13 @@ Tcl_GetIndexFromObjStruct(
* offset, the third plus the offset again,
* etc. The last entry must be NULL and there
* must not be duplicate entries. */
size_t offset, /* The number of bytes between entries */
Tcl_Size offset, /* The number of bytes between entries */
const char *msg, /* Identifying word to use in error
* messages. */
int flags, /* 0, TCL_EXACT, TCL_NULL_OK or TCL_INDEX_TEMP_TABLE */
void *indexPtr) /* Place to store resulting index. */
{
size_t index, idx, numAbbrev;
Tcl_Size index, idx, numAbbrev;
const char *key, *p1;
const char *p2;
const char *const *entryPtr;
@@ -202,7 +202,7 @@ Tcl_GetIndexFromObjStruct(
const Tcl_ObjInternalRep *irPtr;
/* Protect against invalid values, like TCL_INDEX_NONE or 0. */
if (offset+1 <= sizeof(char *)) {
if (offset + 1 <= sizeof(char *)) {
offset = sizeof(char *);
}
/*
@@ -505,7 +505,7 @@ PrefixMatchObjCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
int flags = 0, result, dummy, i;
size_t dummyLength, errorLength;
Tcl_Size dummyLength, errorLength;
Tcl_Obj *errorPtr = NULL;
const char *message = "option";
Tcl_Obj *tablePtr, *objPtr, *resultPtr;
@@ -533,7 +533,7 @@ PrefixMatchObjCmd(
case PRFMATCH_MESSAGE:
if (i > objc-4) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"missing value for -message", -1));
"missing value for -message", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "NOARG", NULL);
return TCL_ERROR;
}
@@ -543,7 +543,7 @@ PrefixMatchObjCmd(
case PRFMATCH_ERROR:
if (i > objc-4) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"missing value for -error", -1));
"missing value for -error", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "NOARG", NULL);
return TCL_ERROR;
}
@@ -629,7 +629,7 @@ PrefixAllObjCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
int result;
size_t length, elemLength, tableObjc, t;
Tcl_Size length, elemLength, tableObjc, t;
const char *string, *elemString;
Tcl_Obj **tableObjv, *resultPtr;
@@ -687,7 +687,7 @@ PrefixLongestObjCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
int result;
size_t i, length, elemLength, resultLength, tableObjc, t;
Tcl_Size i, length, elemLength, resultLength, tableObjc, t;
const char *string, *elemString, *resultString;
Tcl_Obj **tableObjv;
@@ -802,7 +802,7 @@ PrefixLongestObjCmd(
void
Tcl_WrongNumArgs(
Tcl_Interp *interp, /* Current interpreter. */
size_t objc, /* Number of arguments to print from objv. */
Tcl_Size objc, /* Number of arguments to print from objv. */
Tcl_Obj *const objv[], /* Initial argument objects, which should be
* included in the error message. */
const char *message) /* Error message to print after the leading
@@ -810,7 +810,7 @@ Tcl_WrongNumArgs(
* NULL. */
{
Tcl_Obj *objPtr;
size_t i, len, elemLen;
Tcl_Size i, len, elemLen;
char flags;
Interp *iPtr = (Interp *)interp;
const char *elementStr;
@@ -819,9 +819,9 @@ Tcl_WrongNumArgs(
if (iPtr->flags & INTERP_ALTERNATE_WRONG_ARGS) {
iPtr->flags &= ~INTERP_ALTERNATE_WRONG_ARGS;
Tcl_AppendObjToObj(objPtr, Tcl_GetObjResult(interp));
Tcl_AppendToObj(objPtr, " or \"", -1);
Tcl_AppendToObj(objPtr, " or \"", TCL_INDEX_NONE);
} else {
Tcl_AppendToObj(objPtr, "wrong # args: should be \"", -1);
Tcl_AppendToObj(objPtr, "wrong # args: should be \"", TCL_INDEX_NONE);
}
/*
@@ -830,8 +830,8 @@ Tcl_WrongNumArgs(
*/
if (iPtr->ensembleRewrite.sourceObjs != NULL) {
size_t toSkip = iPtr->ensembleRewrite.numInsertedObjs;
size_t toPrint = iPtr->ensembleRewrite.numRemovedObjs;
Tcl_Size toSkip = iPtr->ensembleRewrite.numInsertedObjs;
Tcl_Size toPrint = iPtr->ensembleRewrite.numRemovedObjs;
Tcl_Obj *const *origObjv = TclEnsembleGetRewriteValues(interp);
/*
@@ -889,7 +889,7 @@ Tcl_WrongNumArgs(
* moderately complex condition here).
*/
if (i+1<toPrint || objc!=0 || message!=NULL) {
if (i + 1 < toPrint || objc!=0 || message!=NULL) {
Tcl_AppendStringsToObj(objPtr, " ", NULL);
}
}
@@ -997,7 +997,7 @@ Tcl_ParseArgsObjv(
Tcl_Obj **leftovers; /* Array to write back to remObjv on
* successful exit. Will include the name of
* the command. */
size_t nrem; /* Size of leftovers.*/
Tcl_Size nrem; /* Size of leftovers.*/
const Tcl_ArgvInfo *infoPtr;
/* Pointer to the current entry in the table
* of argument descriptions. */
@@ -1009,13 +1009,13 @@ Tcl_ParseArgsObjv(
* quick check for matching; use 2nd char.
* because first char. will almost always be
* '-'). */
size_t srcIndex; /* Location from which to read next argument
Tcl_Size srcIndex; /* Location from which to read next argument
* from objv. */
size_t dstIndex; /* Used to keep track of current arguments
Tcl_Size dstIndex; /* Used to keep track of current arguments
* being processed, primarily for error
* reporting. */
size_t objc; /* # arguments in objv still to process. */
size_t length; /* Number of characters in current argument */
Tcl_Size objc; /* # arguments in objv still to process. */
Tcl_Size length; /* Number of characters in current argument */
if (remObjv != NULL) {
/*
@@ -1274,13 +1274,13 @@ PrintUsage(
width = 4;
for (infoPtr = argTable; infoPtr->type != TCL_ARGV_END; infoPtr++) {
size_t length;
Tcl_Size length;
if (infoPtr->keyStr == NULL) {
continue;
}
length = strlen(infoPtr->keyStr);
if (length > (size_t)width) {
if (length > (Tcl_Size)width) {
width = length;
}
}
@@ -1289,7 +1289,7 @@ PrintUsage(
* Now add the option information, with pretty-printing.
*/
msg = Tcl_NewStringObj("Command-specific options:", -1);
msg = Tcl_NewStringObj("Command-specific options:", TCL_INDEX_NONE);
for (infoPtr = argTable; infoPtr->type != TCL_ARGV_END; infoPtr++) {
if ((infoPtr->type == TCL_ARGV_HELP) && (infoPtr->keyStr == NULL)) {
Tcl_AppendPrintfToObj(msg, "\n%s", infoPtr->helpStr);
@@ -1305,7 +1305,7 @@ PrintUsage(
}
numSpaces -= NUM_SPACES;
}
Tcl_AppendToObj(msg, infoPtr->helpStr, -1);
Tcl_AppendToObj(msg, infoPtr->helpStr, TCL_INDEX_NONE);
switch (infoPtr->type) {
case TCL_ARGV_INT:
Tcl_AppendPrintfToObj(msg, "\n\t\tDefault value: %d",
+1 -1
View File
@@ -706,7 +706,7 @@ declare 258 {
# TIP 625: for unit testing - create list objects with span
declare 260 {
Tcl_Obj *TclListTestObj(int length, int leadingSpace, int endSpace)
Tcl_Obj *TclListTestObj(size_t length, size_t leadingSpace, size_t endSpace)
}
# TIP 625: for unit testing - check list invariants
+119 -89
View File
@@ -131,6 +131,7 @@
#if defined(_WIN32) && defined(_MSC_VER)
# define vsnprintf _vsnprintf
# define snprintf _snprintf
#endif
#if !defined(TCL_THREADS)
@@ -1091,6 +1092,20 @@ typedef struct ActiveInterpTrace {
#define TCL_TRACE_ENTER_EXEC 1
#define TCL_TRACE_LEAVE_EXEC 2
typedef struct { /* For internal core use only */
Tcl_ObjType objType;
struct {
size_t (*lengthProc)(Tcl_Obj *obj);
} abstractList;
} TclObjTypeWithAbstractList;
#define TCL_OBJTYPE_V0_1(lengthProc) (sizeof(TclObjTypeWithAbstractList)) \
}, {lengthProc /* For internal core use only */
#define ABSTRACTLIST_PROC(objPtr, proc) (((objPtr)->typePtr \
&& ((objPtr)->typePtr->version > offsetof(TclObjTypeWithAbstractList, abstractList.proc))) ? \
((const TclObjTypeWithAbstractList *)(objPtr)->typePtr)->abstractList.proc : NULL)
MODULE_SCOPE size_t TclLengthOne(Tcl_Obj *);
/*
* The structure below defines an entry in the assocData hash table which is
* associated with an interpreter. The entry contains a pointer to a function
@@ -1450,12 +1465,8 @@ struct CompileEnv;
* reporting is deferred until the actual runtime,
* because by then changes in the interp state may allow
* the command to be successfully evaluated.
* TCL_OUT_LINE_COMPILE A source-compatible alias for TCL_ERROR, kept for the
* sake of old code only.
*/
#define TCL_OUT_LINE_COMPILE TCL_ERROR
typedef int (CompileProc)(Tcl_Interp *interp, Tcl_Parse *parsePtr,
struct Command *cmdPtr, struct CompileEnv *compEnvPtr);
@@ -2617,7 +2628,7 @@ typedef struct ListRep {
* converted to a list.
*/
#define TclListObjGetElementsM(interp_, listObj_, objcPtr_, objvPtr_) \
(((listObj_)->typePtr == &tclListType) \
(((listObj_)->typePtr == &tclListType.objType) \
? ((ListObjGetElements((listObj_), *(objcPtr_), *(objvPtr_))), \
TCL_OK) \
: Tcl_ListObjGetElements( \
@@ -2629,12 +2640,12 @@ typedef struct ListRep {
* Tcl_Obj cannot be converted to a list.
*/
#define TclListObjLengthM(interp_, listObj_, lenPtr_) \
(((listObj_)->typePtr == &tclListType) \
(((listObj_)->typePtr == &tclListType.objType) \
? ((ListObjLength((listObj_), *(lenPtr_))), TCL_OK) \
: Tcl_ListObjLength((interp_), (listObj_), (lenPtr_)))
#define TclListObjIsCanonical(listObj_) \
(((listObj_)->typePtr == &tclListType) ? ListObjIsCanonical((listObj_)) : 0)
(((listObj_)->typePtr == &tclListType.objType) ? ListObjIsCanonical((listObj_)) : 0)
/*
* Modes for collecting (or not) in the implementations of TclNRForeachCmd,
@@ -2654,27 +2665,27 @@ typedef struct ListRep {
#if TCL_MAJOR_VERSION > 8
#define TclGetBooleanFromObj(interp, objPtr, intPtr) \
(((objPtr)->typePtr == &tclIntType \
|| (objPtr)->typePtr == &tclBooleanType) \
(((objPtr)->typePtr == &tclIntType.objType \
|| (objPtr)->typePtr == &tclBooleanType.objType) \
? (*(intPtr) = ((objPtr)->internalRep.wideValue!=0), TCL_OK) \
: Tcl_GetBooleanFromObj((interp), (objPtr), (intPtr)))
#else
#define TclGetBooleanFromObj(interp, objPtr, intPtr) \
(((objPtr)->typePtr == &tclIntType) \
(((objPtr)->typePtr == &tclIntType.objType) \
? (*(intPtr) = ((objPtr)->internalRep.wideValue!=0), TCL_OK) \
: ((objPtr)->typePtr == &tclBooleanType) \
: ((objPtr)->typePtr == &tclBooleanType.objType) \
? (*(intPtr) = ((objPtr)->internalRep.longValue!=0), TCL_OK) \
: Tcl_GetBooleanFromObj((interp), (objPtr), (intPtr)))
#endif
#ifdef TCL_WIDE_INT_IS_LONG
#define TclGetLongFromObj(interp, objPtr, longPtr) \
(((objPtr)->typePtr == &tclIntType) \
(((objPtr)->typePtr == &tclIntType.objType) \
? ((*(longPtr) = (objPtr)->internalRep.wideValue), TCL_OK) \
: Tcl_GetLongFromObj((interp), (objPtr), (longPtr)))
#else
#define TclGetLongFromObj(interp, objPtr, longPtr) \
(((objPtr)->typePtr == &tclIntType \
(((objPtr)->typePtr == &tclIntType.objType \
&& (objPtr)->internalRep.wideValue >= (Tcl_WideInt)(LONG_MIN) \
&& (objPtr)->internalRep.wideValue <= (Tcl_WideInt)(LONG_MAX)) \
? ((*(longPtr) = (long)(objPtr)->internalRep.wideValue), TCL_OK) \
@@ -2682,13 +2693,13 @@ typedef struct ListRep {
#endif
#define TclGetIntFromObj(interp, objPtr, intPtr) \
(((objPtr)->typePtr == &tclIntType \
(((objPtr)->typePtr == &tclIntType.objType \
&& (objPtr)->internalRep.wideValue >= (Tcl_WideInt)(INT_MIN) \
&& (objPtr)->internalRep.wideValue <= (Tcl_WideInt)(INT_MAX)) \
? ((*(intPtr) = (int)(objPtr)->internalRep.wideValue), TCL_OK) \
: Tcl_GetIntFromObj((interp), (objPtr), (intPtr)))
#define TclGetIntForIndexM(interp, objPtr, endValue, idxPtr) \
((((objPtr)->typePtr == &tclIntType) && ((objPtr)->internalRep.wideValue >= 0) \
((((objPtr)->typePtr == &tclIntType.objType) && ((objPtr)->internalRep.wideValue >= 0) \
&& ((Tcl_WideUInt)(objPtr)->internalRep.wideValue <= (Tcl_WideUInt)(endValue + 1))) \
? ((*(idxPtr) = (objPtr)->internalRep.wideValue), TCL_OK) \
: Tcl_GetIntForIndex((interp), (objPtr), (endValue), (idxPtr)))
@@ -2702,7 +2713,7 @@ typedef struct ListRep {
*/
#define TclGetWideIntFromObj(interp, objPtr, wideIntPtr) \
(((objPtr)->typePtr == &tclIntType) \
(((objPtr)->typePtr == &tclIntType.objType) \
? (*(wideIntPtr) = \
((objPtr)->internalRep.wideValue), TCL_OK) : \
Tcl_GetWideIntFromObj((interp), (objPtr), (wideIntPtr)))
@@ -2865,7 +2876,19 @@ MODULE_SCOPE int tclFindExecutableSearchDone;
MODULE_SCOPE char *tclMemDumpFileName;
MODULE_SCOPE TclPlatformType tclPlatform;
/*
* Declarations related to internal encoding functions.
*/
MODULE_SCOPE Tcl_Encoding tclIdentityEncoding;
MODULE_SCOPE int
TclEncodingProfileNameToId(Tcl_Interp *interp,
const char *profileName,
int *profilePtr);
MODULE_SCOPE const char *TclEncodingProfileIdToName(Tcl_Interp *interp,
int profileId);
MODULE_SCOPE int TclEncodingSetProfileFlags(int flags);
MODULE_SCOPE void TclGetEncodingProfiles(Tcl_Interp *interp);
/*
* TIP #233 (Virtualized Time)
@@ -2880,13 +2903,13 @@ MODULE_SCOPE void *tclTimeClientData;
* Variables denoting the Tcl object types defined in the core.
*/
MODULE_SCOPE const Tcl_ObjType tclBignumType;
MODULE_SCOPE const Tcl_ObjType tclBooleanType;
MODULE_SCOPE const TclObjTypeWithAbstractList tclBignumType;
MODULE_SCOPE const TclObjTypeWithAbstractList tclBooleanType;
MODULE_SCOPE const Tcl_ObjType tclByteCodeType;
MODULE_SCOPE const Tcl_ObjType tclDoubleType;
MODULE_SCOPE const Tcl_ObjType tclIntType;
MODULE_SCOPE const Tcl_ObjType tclListType;
MODULE_SCOPE const Tcl_ObjType tclArithSeriesType;
MODULE_SCOPE const TclObjTypeWithAbstractList tclDoubleType;
MODULE_SCOPE const TclObjTypeWithAbstractList tclIntType;
MODULE_SCOPE const TclObjTypeWithAbstractList tclListType;
MODULE_SCOPE const TclObjTypeWithAbstractList tclArithSeriesType;
MODULE_SCOPE const Tcl_ObjType tclDictType;
MODULE_SCOPE const Tcl_ObjType tclProcBodyType;
MODULE_SCOPE const Tcl_ObjType tclStringType;
@@ -3031,12 +3054,12 @@ struct Tcl_LoadHandle_ {
#if TCL_MAJOR_VERSION > 8
MODULE_SCOPE void TclAppendBytesToByteArray(Tcl_Obj *objPtr,
const unsigned char *bytes, size_t len);
const unsigned char *bytes, Tcl_Size len);
MODULE_SCOPE int TclNREvalCmd(Tcl_Interp *interp, Tcl_Obj *objPtr,
int flags);
MODULE_SCOPE void TclAdvanceContinuations(size_t *line, int **next,
MODULE_SCOPE void TclAdvanceContinuations(Tcl_Size *line, int **next,
int loc);
MODULE_SCOPE void TclAdvanceLines(size_t *line, const char *start,
MODULE_SCOPE void TclAdvanceLines(Tcl_Size *line, const char *start,
const char *end);
MODULE_SCOPE void TclArgumentEnter(Tcl_Interp *interp,
Tcl_Obj *objv[], int objc, CmdFrame *cf);
@@ -3044,7 +3067,7 @@ MODULE_SCOPE void TclArgumentRelease(Tcl_Interp *interp,
Tcl_Obj *objv[], int objc);
MODULE_SCOPE void TclArgumentBCEnter(Tcl_Interp *interp,
Tcl_Obj *objv[], int objc,
void *codePtr, CmdFrame *cfPtr, int cmd, size_t pc);
void *codePtr, CmdFrame *cfPtr, int cmd, Tcl_Size pc);
MODULE_SCOPE void TclArgumentBCRelease(Tcl_Interp *interp,
CmdFrame *cfPtr);
MODULE_SCOPE void TclArgumentGet(Tcl_Interp *interp, Tcl_Obj *obj,
@@ -3054,8 +3077,8 @@ MODULE_SCOPE int TclAsyncNotifier(int sigNumber, Tcl_ThreadId threadId,
MODULE_SCOPE void TclAsyncMarkFromNotifier(void);
MODULE_SCOPE double TclBignumToDouble(const void *bignum);
MODULE_SCOPE int TclByteArrayMatch(const unsigned char *string,
size_t strLen, const unsigned char *pattern,
size_t ptnLen, int flags);
Tcl_Size strLen, const unsigned char *pattern,
Tcl_Size ptnLen, int flags);
MODULE_SCOPE double TclCeil(const void *a);
MODULE_SCOPE void TclChannelPreserve(Tcl_Channel chan);
MODULE_SCOPE void TclChannelRelease(Tcl_Channel chan);
@@ -3068,14 +3091,14 @@ MODULE_SCOPE Tcl_ObjCmdProc TclChannelNamesCmd;
MODULE_SCOPE Tcl_NRPostProc TclClearRootEnsemble;
MODULE_SCOPE int TclCompareTwoNumbers(Tcl_Obj *valuePtr,
Tcl_Obj *value2Ptr);
MODULE_SCOPE ContLineLoc *TclContinuationsEnter(Tcl_Obj *objPtr, size_t num,
MODULE_SCOPE ContLineLoc *TclContinuationsEnter(Tcl_Obj *objPtr, Tcl_Size num,
int *loc);
MODULE_SCOPE void TclContinuationsEnterDerived(Tcl_Obj *objPtr,
int start, int *clNext);
MODULE_SCOPE ContLineLoc *TclContinuationsGet(Tcl_Obj *objPtr);
MODULE_SCOPE void TclContinuationsCopy(Tcl_Obj *objPtr,
Tcl_Obj *originObjPtr);
MODULE_SCOPE size_t TclConvertElement(const char *src, size_t length,
MODULE_SCOPE Tcl_Size TclConvertElement(const char *src, Tcl_Size length,
char *dst, int flags);
MODULE_SCOPE Tcl_Command TclCreateObjCommandInNs(Tcl_Interp *interp,
const char *cmdName, Tcl_Namespace *nsPtr,
@@ -3087,12 +3110,12 @@ MODULE_SCOPE Tcl_Command TclCreateEnsembleInNs(Tcl_Interp *interp,
MODULE_SCOPE void TclDeleteNamespaceVars(Namespace *nsPtr);
MODULE_SCOPE void TclDeleteNamespaceChildren(Namespace *nsPtr);
MODULE_SCOPE int TclFindDictElement(Tcl_Interp *interp,
const char *dict, size_t dictLength,
const char *dict, Tcl_Size dictLength,
const char **elementPtr, const char **nextPtr,
size_t *sizePtr, int *literalPtr);
Tcl_Size *sizePtr, int *literalPtr);
/* TIP #280 - Modified token based evaluation, with line information. */
MODULE_SCOPE int TclEvalEx(Tcl_Interp *interp, const char *script,
size_t numBytes, int flags, size_t line,
Tcl_Size numBytes, int flags, Tcl_Size line,
int *clNextOuter, const char *outerScript);
MODULE_SCOPE Tcl_ObjCmdProc TclFileAttrsCmd;
MODULE_SCOPE Tcl_ObjCmdProc TclFileCopyCmd;
@@ -3113,9 +3136,8 @@ MODULE_SCOPE char * TclDStringAppendObj(Tcl_DString *dsPtr,
Tcl_Obj *objPtr);
MODULE_SCOPE char * TclDStringAppendDString(Tcl_DString *dsPtr,
Tcl_DString *toAppendPtr);
MODULE_SCOPE Tcl_Obj * TclDStringToObj(Tcl_DString *dsPtr);
MODULE_SCOPE Tcl_Obj *const *TclFetchEnsembleRoot(Tcl_Interp *interp,
Tcl_Obj *const *objv, size_t objc, size_t *objcPtr);
Tcl_Obj *const *objv, Tcl_Size objc, Tcl_Size *objcPtr);
MODULE_SCOPE Tcl_Obj *const *TclEnsembleGetRewriteValues(Tcl_Interp *interp);
MODULE_SCOPE Tcl_Namespace *TclEnsureNamespace(Tcl_Interp *interp,
Tcl_Namespace *namespacePtr);
@@ -3169,7 +3191,7 @@ MODULE_SCOPE Tcl_Obj * TclGetProcessGlobalValue(ProcessGlobalValue *pgvPtr);
MODULE_SCOPE Tcl_Obj * TclGetSourceFromFrame(CmdFrame *cfPtr, int objc,
Tcl_Obj *const objv[]);
MODULE_SCOPE char * TclGetStringStorage(Tcl_Obj *objPtr,
TCL_HASH_TYPE *sizePtr);
Tcl_Size *sizePtr);
MODULE_SCOPE int TclGetLoadedLibraries(Tcl_Interp *interp,
const char *targetName,
const char *packageName);
@@ -3199,7 +3221,7 @@ MODULE_SCOPE void TclInitObjSubsystem(void);
MODULE_SCOPE int TclInterpReady(Tcl_Interp *interp);
MODULE_SCOPE int TclIsDigitProc(int byte);
MODULE_SCOPE int TclIsBareword(int byte);
MODULE_SCOPE Tcl_Obj * TclJoinPath(size_t elements, Tcl_Obj * const objv[],
MODULE_SCOPE Tcl_Obj * TclJoinPath(Tcl_Size elements, Tcl_Obj * const objv[],
int forceRelative);
MODULE_SCOPE int MakeTildeRelativePath(Tcl_Interp *interp, const char *user,
const char *subPath, Tcl_DString *dsPtr);
@@ -3212,30 +3234,29 @@ MODULE_SCOPE void TclLimitRemoveAllHandlers(Tcl_Interp *interp);
MODULE_SCOPE Tcl_Obj * TclLindexList(Tcl_Interp *interp,
Tcl_Obj *listPtr, Tcl_Obj *argPtr);
MODULE_SCOPE Tcl_Obj * TclLindexFlat(Tcl_Interp *interp, Tcl_Obj *listPtr,
size_t indexCount, Tcl_Obj *const indexArray[]);
Tcl_Size indexCount, Tcl_Obj *const indexArray[]);
/* TIP #280 */
MODULE_SCOPE void TclListLines(Tcl_Obj *listObj, size_t line, int n,
MODULE_SCOPE void TclListLines(Tcl_Obj *listObj, Tcl_Size line, int n,
int *lines, Tcl_Obj *const *elems);
MODULE_SCOPE Tcl_Obj * TclListObjCopy(Tcl_Interp *interp, Tcl_Obj *listPtr);
MODULE_SCOPE int TclListObjAppendElements(Tcl_Interp *interp,
Tcl_Obj *toObj, size_t elemCount,
Tcl_Obj *toObj, Tcl_Size elemCount,
Tcl_Obj *const elemObjv[]);
MODULE_SCOPE Tcl_Obj * TclListObjRange(Tcl_Obj *listPtr, size_t fromIdx,
size_t toIdx);
MODULE_SCOPE Tcl_Obj * TclListObjRange(Tcl_Obj *listPtr, Tcl_Size fromIdx,
Tcl_Size toIdx);
MODULE_SCOPE Tcl_Obj * TclLsetList(Tcl_Interp *interp, Tcl_Obj *listPtr,
Tcl_Obj *indexPtr, Tcl_Obj *valuePtr);
MODULE_SCOPE Tcl_Obj * TclLsetFlat(Tcl_Interp *interp, Tcl_Obj *listPtr,
size_t indexCount, Tcl_Obj *const indexArray[],
Tcl_Size indexCount, Tcl_Obj *const indexArray[],
Tcl_Obj *valuePtr);
MODULE_SCOPE Tcl_Command TclMakeEnsemble(Tcl_Interp *interp, const char *name,
const EnsembleImplMap map[]);
MODULE_SCOPE int TclMakeSafe(Tcl_Interp *interp);
MODULE_SCOPE int TclMaxListLength(const char *bytes, size_t numBytes,
MODULE_SCOPE Tcl_Size TclMaxListLength(const char *bytes, Tcl_Size numBytes,
const char **endPtr);
MODULE_SCOPE int TclMergeReturnOptions(Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[], Tcl_Obj **optionsPtrPtr,
int *codePtr, int *levelPtr);
MODULE_SCOPE Tcl_Obj * TclNarrowToBytes(Tcl_Obj *objPtr);
MODULE_SCOPE Tcl_Obj * TclNoErrorStack(Tcl_Interp *interp, Tcl_Obj *options);
MODULE_SCOPE int TclNokia770Doubles(void);
MODULE_SCOPE void TclNsDecrRefCount(Namespace *nsPtr);
@@ -3249,15 +3270,15 @@ MODULE_SCOPE int TclObjInvokeNamespace(Tcl_Interp *interp,
MODULE_SCOPE int TclObjUnsetVar2(Tcl_Interp *interp,
Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, int flags);
MODULE_SCOPE int TclParseBackslash(const char *src,
size_t numBytes, size_t *readPtr, char *dst);
MODULE_SCOPE int TclParseHex(const char *src, size_t numBytes,
Tcl_Size numBytes, Tcl_Size *readPtr, char *dst);
MODULE_SCOPE int TclParseHex(const char *src, Tcl_Size numBytes,
int *resultPtr);
MODULE_SCOPE int TclParseNumber(Tcl_Interp *interp, Tcl_Obj *objPtr,
const char *expected, const char *bytes,
size_t numBytes, const char **endPtrPtr, int flags);
Tcl_Size numBytes, const char **endPtrPtr, int flags);
MODULE_SCOPE void TclParseInit(Tcl_Interp *interp, const char *string,
size_t numBytes, Tcl_Parse *parsePtr);
MODULE_SCOPE size_t TclParseAllWhiteSpace(const char *src, size_t numBytes);
Tcl_Size numBytes, Tcl_Parse *parsePtr);
MODULE_SCOPE Tcl_Size TclParseAllWhiteSpace(const char *src, Tcl_Size numBytes);
MODULE_SCOPE int TclProcessReturn(Tcl_Interp *interp,
int code, int level, Tcl_Obj *returnOpts);
MODULE_SCOPE int TclpObjLstat(Tcl_Obj *pathPtr, Tcl_StatBuf *buf);
@@ -3265,7 +3286,7 @@ MODULE_SCOPE Tcl_Obj * TclpTempFileName(void);
MODULE_SCOPE Tcl_Obj * TclpTempFileNameForLibrary(Tcl_Interp *interp,
Tcl_Obj* pathPtr);
MODULE_SCOPE Tcl_Obj * TclNewFSPathObj(Tcl_Obj *dirPtr, const char *addStrRep,
size_t len);
Tcl_Size len);
MODULE_SCOPE void TclpAlertNotifier(void *clientData);
MODULE_SCOPE void *TclpNotifierData(void);
MODULE_SCOPE void TclpServiceModeHook(int mode);
@@ -3291,10 +3312,10 @@ MODULE_SCOPE int TclCreateSocketAddress(Tcl_Interp *interp,
const char **errorMsgPtr);
MODULE_SCOPE int TclpThreadCreate(Tcl_ThreadId *idPtr,
Tcl_ThreadCreateProc *proc, void *clientData,
size_t stackSize, int flags);
MODULE_SCOPE size_t TclpFindVariable(const char *name, size_t *lengthPtr);
Tcl_Size stackSize, int flags);
MODULE_SCOPE Tcl_Size TclpFindVariable(const char *name, Tcl_Size *lengthPtr);
MODULE_SCOPE void TclpInitLibraryPath(char **valuePtr,
TCL_HASH_TYPE *lengthPtr, Tcl_Encoding *encodingPtr);
Tcl_Size *lengthPtr, Tcl_Encoding *encodingPtr);
MODULE_SCOPE void TclpInitLock(void);
MODULE_SCOPE void *TclpInitNotifier(void);
MODULE_SCOPE void TclpInitPlatform(void);
@@ -3307,9 +3328,9 @@ MODULE_SCOPE int TclpMatchFiles(Tcl_Interp *interp, char *separators,
MODULE_SCOPE int TclpObjNormalizePath(Tcl_Interp *interp,
Tcl_Obj *pathPtr, int nextCheckpoint);
MODULE_SCOPE void TclpNativeJoinPath(Tcl_Obj *prefix, const char *joining);
MODULE_SCOPE Tcl_Obj * TclpNativeSplitPath(Tcl_Obj *pathPtr, size_t *lenPtr);
MODULE_SCOPE Tcl_Obj * TclpNativeSplitPath(Tcl_Obj *pathPtr, Tcl_Size *lenPtr);
MODULE_SCOPE Tcl_PathType TclpGetNativePathType(Tcl_Obj *pathPtr,
size_t *driveNameLengthPtr, Tcl_Obj **driveNameRef);
Tcl_Size *driveNameLengthPtr, Tcl_Obj **driveNameRef);
MODULE_SCOPE int TclCrossFilesystemCopy(Tcl_Interp *interp,
Tcl_Obj *source, Tcl_Obj *target);
MODULE_SCOPE int TclpMatchInDirectory(Tcl_Interp *interp,
@@ -3340,9 +3361,9 @@ MODULE_SCOPE void TclRememberJoinableThread(Tcl_ThreadId id);
MODULE_SCOPE void TclRememberMutex(Tcl_Mutex *mutex);
MODULE_SCOPE void TclRemoveScriptLimitCallbacks(Tcl_Interp *interp);
MODULE_SCOPE int TclReToGlob(Tcl_Interp *interp, const char *reStr,
size_t reStrLen, Tcl_DString *dsPtr, int *flagsPtr,
Tcl_Size reStrLen, Tcl_DString *dsPtr, int *flagsPtr,
int *quantifiersFoundPtr);
MODULE_SCOPE TCL_HASH_TYPE TclScanElement(const char *string, size_t length,
MODULE_SCOPE Tcl_Size TclScanElement(const char *string, Tcl_Size length,
char *flagPtr);
MODULE_SCOPE void TclSetBgErrorHandler(Tcl_Interp *interp,
Tcl_Obj *cmdPrefix);
@@ -3357,44 +3378,44 @@ MODULE_SCOPE void TclSetProcessGlobalValue(ProcessGlobalValue *pgvPtr,
Tcl_Obj *newValue, Tcl_Encoding encoding);
MODULE_SCOPE void TclSignalExitThread(Tcl_ThreadId id, int result);
MODULE_SCOPE void TclSpellFix(Tcl_Interp *interp,
Tcl_Obj *const *objv, size_t objc, size_t subIdx,
Tcl_Obj *const *objv, Tcl_Size objc, Tcl_Size subIdx,
Tcl_Obj *bad, Tcl_Obj *fix);
MODULE_SCOPE void * TclStackRealloc(Tcl_Interp *interp, void *ptr,
size_t numBytes);
Tcl_Size numBytes);
typedef int (*memCmpFn_t)(const void*, const void*, size_t);
MODULE_SCOPE int TclStringCmp(Tcl_Obj *value1Ptr, Tcl_Obj *value2Ptr,
int checkEq, int nocase, size_t reqlength);
int checkEq, int nocase, Tcl_Size reqlength);
MODULE_SCOPE int TclStringCmpOpts(Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[], int *nocase,
int *reqlength);
MODULE_SCOPE int TclStringMatch(const char *str, size_t strLen,
MODULE_SCOPE int TclStringMatch(const char *str, Tcl_Size strLen,
const char *pattern, int ptnLen, int flags);
MODULE_SCOPE int TclStringMatchObj(Tcl_Obj *stringObj,
Tcl_Obj *patternObj, int flags);
MODULE_SCOPE void TclSubstCompile(Tcl_Interp *interp, const char *bytes,
size_t numBytes, int flags, size_t line,
Tcl_Size numBytes, int flags, Tcl_Size line,
struct CompileEnv *envPtr);
MODULE_SCOPE int TclSubstOptions(Tcl_Interp *interp, size_t numOpts,
MODULE_SCOPE int TclSubstOptions(Tcl_Interp *interp, Tcl_Size numOpts,
Tcl_Obj *const opts[], int *flagPtr);
MODULE_SCOPE void TclSubstParse(Tcl_Interp *interp, const char *bytes,
size_t numBytes, int flags, Tcl_Parse *parsePtr,
Tcl_Size numBytes, int flags, Tcl_Parse *parsePtr,
Tcl_InterpState *statePtr);
MODULE_SCOPE int TclSubstTokens(Tcl_Interp *interp, Tcl_Token *tokenPtr,
size_t count, int *tokensLeftPtr, size_t line,
Tcl_Size count, int *tokensLeftPtr, Tcl_Size line,
int *clNextOuter, const char *outerScript);
MODULE_SCOPE size_t TclTrim(const char *bytes, size_t numBytes,
const char *trim, size_t numTrim, size_t *trimRight);
MODULE_SCOPE size_t TclTrimLeft(const char *bytes, size_t numBytes,
const char *trim, size_t numTrim);
MODULE_SCOPE size_t TclTrimRight(const char *bytes, size_t numBytes,
const char *trim, size_t numTrim);
MODULE_SCOPE Tcl_Size TclTrim(const char *bytes, Tcl_Size numBytes,
const char *trim, Tcl_Size numTrim, Tcl_Size *trimRight);
MODULE_SCOPE Tcl_Size TclTrimLeft(const char *bytes, Tcl_Size numBytes,
const char *trim, Tcl_Size numTrim);
MODULE_SCOPE Tcl_Size TclTrimRight(const char *bytes, Tcl_Size numBytes,
const char *trim, Tcl_Size numTrim);
MODULE_SCOPE const char*TclGetCommandTypeName(Tcl_Command command);
MODULE_SCOPE void TclRegisterCommandTypeName(
Tcl_ObjCmdProc *implementationProc,
const char *nameStr);
MODULE_SCOPE int TclUtfCmp(const char *cs, const char *ct);
MODULE_SCOPE int TclUtfCasecmp(const char *cs, const char *ct);
MODULE_SCOPE size_t TclUtfCount(int ch);
MODULE_SCOPE Tcl_Size TclUtfCount(int ch);
#if TCL_UTF_MAX > 3
# define TclUtfToUCS4 Tcl_UtfToUniChar
# define TclUniCharToUCS4(src, ptr) (*ptr = *(src),1)
@@ -3441,7 +3462,7 @@ MODULE_SCOPE void TclpThreadDeleteKey(void *keyPtr);
MODULE_SCOPE void TclpThreadSetGlobalTSD(void *tsdKeyPtr, void *ptr);
MODULE_SCOPE void * TclpThreadGetGlobalTSD(void *tsdKeyPtr);
MODULE_SCOPE void TclErrorStackResetIf(Tcl_Interp *interp,
const char *msg, size_t length);
const char *msg, Tcl_Size length);
/* Tip 430 */
MODULE_SCOPE int TclZipfs_Init(Tcl_Interp *interp);
@@ -3490,7 +3511,7 @@ MODULE_SCOPE int TclDictWithFinish(Tcl_Interp *interp, Var *varPtr,
Tcl_Obj *part2Ptr, int index, int pathc,
Tcl_Obj *const pathv[], Tcl_Obj *keysPtr);
MODULE_SCOPE Tcl_Obj * TclDictWithInit(Tcl_Interp *interp, Tcl_Obj *dictPtr,
size_t pathc, Tcl_Obj *const pathv[]);
Tcl_Size pathc, Tcl_Obj *const pathv[]);
MODULE_SCOPE Tcl_ObjCmdProc Tcl_DisassembleObjCmd;
/* Assemble command function */
@@ -4016,13 +4037,13 @@ MODULE_SCOPE int TclCompileAssembleCmd(Tcl_Interp *interp,
MODULE_SCOPE Tcl_Obj * TclStringCat(Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[], int flags);
MODULE_SCOPE Tcl_Obj * TclStringFirst(Tcl_Obj *needle, Tcl_Obj *haystack,
size_t start);
Tcl_Size start);
MODULE_SCOPE Tcl_Obj * TclStringLast(Tcl_Obj *needle, Tcl_Obj *haystack,
size_t last);
Tcl_Size last);
MODULE_SCOPE Tcl_Obj * TclStringRepeat(Tcl_Interp *interp, Tcl_Obj *objPtr,
size_t count, int flags);
Tcl_Size count, int flags);
MODULE_SCOPE Tcl_Obj * TclStringReplace(Tcl_Interp *interp, Tcl_Obj *objPtr,
size_t first, size_t count, Tcl_Obj *insertPtr,
Tcl_Size first, Tcl_Size count, Tcl_Obj *insertPtr,
int flags);
MODULE_SCOPE Tcl_Obj * TclStringReverse(Tcl_Obj *objPtr, int flags);
@@ -4149,8 +4170,8 @@ MODULE_SCOPE Tcl_Obj * TclGetArrayDefault(Var *arrayPtr);
*/
MODULE_SCOPE int TclIndexEncode(Tcl_Interp *interp, Tcl_Obj *objPtr,
size_t before, size_t after, int *indexPtr);
MODULE_SCOPE size_t TclIndexDecode(int encoded, size_t endValue);
Tcl_Size before, Tcl_Size after, int *indexPtr);
MODULE_SCOPE Tcl_Size TclIndexDecode(int encoded, Tcl_Size endValue);
#endif /* TCL_MAJOR_VERSION > 8 */
/* Constants used in index value encoding routines. */
@@ -4740,6 +4761,8 @@ MODULE_SCOPE Tcl_LibraryInitProc TclThread_Init;
MODULE_SCOPE Tcl_LibraryInitProc Procbodytest_Init;
MODULE_SCOPE Tcl_LibraryInitProc Procbodytest_SafeInit;
/*
*----------------------------------------------------------------
* Macro used by the Tcl core to check whether a pattern has any characters
@@ -4769,7 +4792,7 @@ MODULE_SCOPE Tcl_LibraryInitProc Procbodytest_SafeInit;
Tcl_ObjInternalRep ir; \
ir.wideValue = (Tcl_WideInt) i; \
TclInvalidateStringRep(objPtr); \
Tcl_StoreInternalRep(objPtr, &tclIntType, &ir); \
Tcl_StoreInternalRep(objPtr, &tclIntType.objType, &ir); \
} while (0)
#define TclSetDoubleObj(objPtr, d) \
@@ -4777,7 +4800,7 @@ MODULE_SCOPE Tcl_LibraryInitProc Procbodytest_SafeInit;
Tcl_ObjInternalRep ir; \
ir.doubleValue = (double) d; \
TclInvalidateStringRep(objPtr); \
Tcl_StoreInternalRep(objPtr, &tclDoubleType, &ir); \
Tcl_StoreInternalRep(objPtr, &tclDoubleType.objType, &ir); \
} while (0)
/*
@@ -4802,7 +4825,7 @@ MODULE_SCOPE Tcl_LibraryInitProc Procbodytest_SafeInit;
(objPtr)->refCount = 0; \
(objPtr)->bytes = NULL; \
(objPtr)->internalRep.wideValue = (Tcl_WideInt)(w); \
(objPtr)->typePtr = &tclIntType; \
(objPtr)->typePtr = &tclIntType.objType; \
TCL_DTRACE_OBJ_CREATE(objPtr); \
} while (0)
@@ -4821,7 +4844,7 @@ MODULE_SCOPE Tcl_LibraryInitProc Procbodytest_SafeInit;
TclSetBignumInternalRep((objPtr), &bignumValue_); \
} else { \
(objPtr)->internalRep.wideValue = (Tcl_WideInt)(uw_); \
(objPtr)->typePtr = &tclIntType; \
(objPtr)->typePtr = &tclIntType.objType; \
} \
TCL_DTRACE_OBJ_CREATE(objPtr); \
} while (0)
@@ -4835,7 +4858,7 @@ MODULE_SCOPE Tcl_LibraryInitProc Procbodytest_SafeInit;
Tcl_WideUInt uw_ = (uw); \
if (uw_ >= TCL_INDEX_NONE) { \
(objPtr)->internalRep.wideValue = -1; \
(objPtr)->typePtr = &tclIntType; \
(objPtr)->typePtr = &tclIntType.objType; \
} else if (uw_ > WIDE_MAX) { \
mp_int bignumValue_; \
if (mp_init_u64(&bignumValue_, uw_) != MP_OKAY) { \
@@ -4844,7 +4867,7 @@ MODULE_SCOPE Tcl_LibraryInitProc Procbodytest_SafeInit;
TclSetBignumInternalRep((objPtr), &bignumValue_); \
} else { \
(objPtr)->internalRep.wideValue = (Tcl_WideInt)(uw_); \
(objPtr)->typePtr = &tclIntType; \
(objPtr)->typePtr = &tclIntType.objType; \
} \
TCL_DTRACE_OBJ_CREATE(objPtr); \
} while (0)
@@ -4856,7 +4879,7 @@ MODULE_SCOPE Tcl_LibraryInitProc Procbodytest_SafeInit;
(objPtr)->refCount = 0; \
(objPtr)->bytes = NULL; \
(objPtr)->internalRep.doubleValue = (double)(d); \
(objPtr)->typePtr = &tclDoubleType; \
(objPtr)->typePtr = &tclDoubleType.objType; \
TCL_DTRACE_OBJ_CREATE(objPtr); \
} while (0)
@@ -4890,7 +4913,14 @@ MODULE_SCOPE Tcl_LibraryInitProc Procbodytest_SafeInit;
} while (0)
#define TclNewIndexObj(objPtr, w) \
(objPtr) = (((Tcl_WideUInt)w) >= TCL_INDEX_NONE) ? Tcl_NewWideIntObj(-1) : Tcl_NewWideIntObj(w)
do { \
Tcl_WideUInt _uw = (Tcl_WideUInt)(w); \
if (_uw >= TCL_INDEX_NONE) { \
TclNewIntObj(objPtr, -1); \
} else { \
TclNewUIntObj(objPtr, _uw); \
} \
} while (0)
#define TclNewDoubleObj(objPtr, d) \
(objPtr) = Tcl_NewDoubleObj(d)
+3 -3
View File
@@ -578,8 +578,8 @@ EXTERN Tcl_Obj * TclpCreateTemporaryDirectory(Tcl_Obj *dirObj,
Tcl_Obj *basenameObj);
/* Slot 259 is reserved */
/* 260 */
EXTERN Tcl_Obj * TclListTestObj(int length, int leadingSpace,
int endSpace);
EXTERN Tcl_Obj * TclListTestObj(size_t length, size_t leadingSpace,
size_t endSpace);
/* 261 */
EXTERN void TclListObjValidate(Tcl_Interp *interp,
Tcl_Obj *listObj);
@@ -848,7 +848,7 @@ typedef struct TclIntStubs {
void (*tclStaticLibrary) (Tcl_Interp *interp, const char *prefix, Tcl_LibraryInitProc *initProc, Tcl_LibraryInitProc *safeInitProc); /* 257 */
Tcl_Obj * (*tclpCreateTemporaryDirectory) (Tcl_Obj *dirObj, Tcl_Obj *basenameObj); /* 258 */
void (*reserved259)(void);
Tcl_Obj * (*tclListTestObj) (int length, int leadingSpace, int endSpace); /* 260 */
Tcl_Obj * (*tclListTestObj) (size_t length, size_t leadingSpace, size_t endSpace); /* 260 */
void (*tclListObjValidate) (Tcl_Interp *interp, Tcl_Obj *listObj); /* 261 */
} TclIntStubs;
+1 -5
View File
@@ -140,8 +140,6 @@ EXTERN int TclWinSetSockOpt(SOCKET s, int level, int optname,
EXTERN int TclpGetPid(Tcl_Pid pid);
/* 9 */
EXTERN int TclWinGetPlatformId(void);
/* 10 */
EXTERN Tcl_DirEntry * TclpReaddir(TclDIR *dir);
/* 11 */
EXTERN void TclGetAndDetachPids(Tcl_Interp *interp,
Tcl_Channel chan);
@@ -316,7 +314,7 @@ typedef struct TclIntPlatStubs {
int (*tclWinSetSockOpt) (SOCKET s, int level, int optname, const char *optval, int optlen); /* 7 */
int (*tclpGetPid) (Tcl_Pid pid); /* 8 */
int (*tclWinGetPlatformId) (void); /* 9 */
Tcl_DirEntry * (*tclpReaddir) (TclDIR *dir); /* 10 */
void *(*tclpReaddir) (void *dir); /* 10 */
void (*tclGetAndDetachPids) (Tcl_Interp *interp, Tcl_Channel chan); /* 11 */
int (*tclpCloseFile) (TclFile file); /* 12 */
Tcl_Channel (*tclpCreateCommandChannel) (TclFile readFile, TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr); /* 13 */
@@ -462,8 +460,6 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr;
(tclIntPlatStubsPtr->tclpGetPid) /* 8 */
#define TclWinGetPlatformId \
(tclIntPlatStubsPtr->tclWinGetPlatformId) /* 9 */
#define TclpReaddir \
(tclIntPlatStubsPtr->tclpReaddir) /* 10 */
#define TclGetAndDetachPids \
(tclIntPlatStubsPtr->tclGetAndDetachPids) /* 11 */
#define TclpCloseFile \
+63 -63
View File
@@ -60,7 +60,7 @@ typedef struct {
Tcl_Obj *objPtr; /* The first actual prefix object - the target
* command name; this has to be at the end of
* the structure, which will be extended to
* accomodate the remaining objects in the
* accommodate the remaining objects in the
* prefix. */
} Alias;
@@ -186,7 +186,7 @@ struct LimitHandler {
int flags; /* The state of this particular handler. */
Tcl_LimitHandlerProc *handlerProc;
/* The handler callback. */
ClientData clientData; /* Opaque argument to the handler callback. */
void *clientData; /* Opaque argument to the handler callback. */
Tcl_LimitHandlerDeleteProc *deleteProc;
/* How to delete the clientData. */
LimitHandler *prevPtr; /* Previous item in linked list of
@@ -265,12 +265,12 @@ static void InheritLimitsFromParent(Tcl_Interp *childInterp,
Tcl_Interp *parentInterp);
static void SetScriptLimitCallback(Tcl_Interp *interp, int type,
Tcl_Interp *targetInterp, Tcl_Obj *scriptObj);
static void CallScriptLimitCallback(ClientData clientData,
static void CallScriptLimitCallback(void *clientData,
Tcl_Interp *interp);
static void DeleteScriptLimitCallback(ClientData clientData);
static void DeleteScriptLimitCallback(void *clientData);
static void RunLimitHandlers(LimitHandler *handlerPtr,
Tcl_Interp *interp);
static void TimeLimitCallback(ClientData clientData);
static void TimeLimitCallback(void *clientData);
/* NRE enabling */
static Tcl_NRPostProc NRPostInvokeHidden;
@@ -339,7 +339,7 @@ Tcl_Init(
pkgName.nextPtr = *names;
*names = &pkgName;
if (tclPreInitScript != NULL) {
if (Tcl_EvalEx(interp, tclPreInitScript, -1, 0) == TCL_ERROR) {
if (Tcl_EvalEx(interp, tclPreInitScript, TCL_INDEX_NONE, 0) == TCL_ERROR) {
goto end;
}
}
@@ -449,7 +449,7 @@ Tcl_Init(
" error $msg\n"
" }\n"
"}\n"
"tclInit", -1, 0);
"tclInit", TCL_INDEX_NONE, 0);
end:
*names = (*names)->nextPtr;
@@ -601,7 +601,7 @@ InterpInfoDeleteProc(
int
Tcl_InterpObjCmd(
ClientData clientData,
void *clientData,
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -832,12 +832,12 @@ NRInterpCmd(
for (i = 0; ; i++) {
Tcl_CmdInfo cmdInfo;
sprintf(buf, "interp%d", i);
snprintf(buf, sizeof(buf), "interp%d", i);
if (Tcl_GetCommandInfo(interp, buf, &cmdInfo) == 0) {
break;
}
}
childPtr = Tcl_NewStringObj(buf, -1);
childPtr = Tcl_NewStringObj(buf, TCL_INDEX_NONE);
}
if (ChildCreate(interp, childPtr, safe) == NULL) {
if (buf[0] != '\0') {
@@ -872,7 +872,7 @@ NRInterpCmd(
return TCL_ERROR;
} else if (childInterp == interp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"cannot delete the current interpreter", -1));
"cannot delete the current interpreter", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "INTERP",
"DELETESELF", NULL);
return TCL_ERROR;
@@ -1053,7 +1053,7 @@ NRInterpCmd(
for ( ; hPtr != NULL; hPtr = Tcl_NextHashEntry(&hashSearch)) {
string = (char *)Tcl_GetHashKey(&iiPtr->parent.childTable, hPtr);
Tcl_ListObjAppendElement(NULL, resultPtr,
Tcl_NewStringObj(string, -1));
Tcl_NewStringObj(string, TCL_INDEX_NONE));
}
Tcl_SetObjResult(interp, resultPtr);
return TCL_OK;
@@ -1197,7 +1197,7 @@ Tcl_CreateAlias(
const char *childCmd, /* Command to install in child. */
Tcl_Interp *targetInterp, /* Interpreter for target command. */
const char *targetCmd, /* Name of target command. */
size_t argc, /* How many additional arguments? */
Tcl_Size argc, /* How many additional arguments? */
const char *const *argv) /* These are the additional args. */
{
Tcl_Obj *childObjPtr, *targetObjPtr;
@@ -1207,14 +1207,14 @@ Tcl_CreateAlias(
objv = (Tcl_Obj **)TclStackAlloc(childInterp, sizeof(Tcl_Obj *) * argc);
for (i = 0; i < argc; i++) {
objv[i] = Tcl_NewStringObj(argv[i], -1);
objv[i] = Tcl_NewStringObj(argv[i], TCL_INDEX_NONE);
Tcl_IncrRefCount(objv[i]);
}
childObjPtr = Tcl_NewStringObj(childCmd, -1);
childObjPtr = Tcl_NewStringObj(childCmd, TCL_INDEX_NONE);
Tcl_IncrRefCount(childObjPtr);
targetObjPtr = Tcl_NewStringObj(targetCmd, -1);
targetObjPtr = Tcl_NewStringObj(targetCmd, TCL_INDEX_NONE);
Tcl_IncrRefCount(targetObjPtr);
result = AliasCreate(childInterp, childInterp, targetInterp, childObjPtr,
@@ -1252,16 +1252,16 @@ Tcl_CreateAliasObj(
const char *childCmd, /* Command to install in child. */
Tcl_Interp *targetInterp, /* Interpreter for target command. */
const char *targetCmd, /* Name of target command. */
size_t objc, /* How many additional arguments? */
Tcl_Size objc, /* How many additional arguments? */
Tcl_Obj *const objv[]) /* Argument vector. */
{
Tcl_Obj *childObjPtr, *targetObjPtr;
int result;
childObjPtr = Tcl_NewStringObj(childCmd, -1);
childObjPtr = Tcl_NewStringObj(childCmd, TCL_INDEX_NONE);
Tcl_IncrRefCount(childObjPtr);
targetObjPtr = Tcl_NewStringObj(targetCmd, -1);
targetObjPtr = Tcl_NewStringObj(targetCmd, TCL_INDEX_NONE);
Tcl_IncrRefCount(targetObjPtr);
result = AliasCreate(childInterp, childInterp, targetInterp, childObjPtr,
@@ -1820,7 +1820,7 @@ AliasList(
static int
AliasNRCmd(
ClientData clientData, /* Alias record. */
void *clientData, /* Alias record. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument vector. */
@@ -1873,7 +1873,7 @@ AliasNRCmd(
int
TclAliasObjCmd(
ClientData clientData, /* Alias record. */
void *clientData, /* Alias record. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument vector. */
@@ -1964,7 +1964,7 @@ TclAliasObjCmd(
int
TclLocalAliasObjCmd(
ClientData clientData, /* Alias record. */
void *clientData, /* Alias record. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument vector. */
@@ -2049,7 +2049,7 @@ TclLocalAliasObjCmd(
static void
AliasObjCmdDeleteProc(
ClientData clientData) /* The alias record for this alias. */
void *clientData) /* The alias record for this alias. */
{
Alias *aliasPtr = (Alias *)clientData;
Target *targetPtr;
@@ -2116,7 +2116,7 @@ Tcl_CreateChild(
Tcl_Obj *pathPtr;
Tcl_Interp *childInterp;
pathPtr = Tcl_NewStringObj(childPath, -1);
pathPtr = Tcl_NewStringObj(childPath, TCL_INDEX_NONE);
childInterp = ChildCreate(interp, pathPtr, isSafe);
Tcl_DecrRefCount(pathPtr);
@@ -2147,7 +2147,7 @@ Tcl_GetChild(
Tcl_Obj *pathPtr;
Tcl_Interp *childInterp;
pathPtr = Tcl_NewStringObj(childPath, -1);
pathPtr = Tcl_NewStringObj(childPath, TCL_INDEX_NONE);
childInterp = GetInterp(interp, pathPtr);
Tcl_DecrRefCount(pathPtr);
@@ -2293,7 +2293,7 @@ Tcl_GetInterpPath(
}
Tcl_ListObjAppendElement(NULL, Tcl_GetObjResult(interp),
Tcl_NewStringObj((const char *)Tcl_GetHashKey(&iiPtr->parent.childTable,
iiPtr->child.childEntryPtr), -1));
iiPtr->child.childEntryPtr), TCL_INDEX_NONE));
return TCL_OK;
}
@@ -2386,7 +2386,7 @@ ChildBgerror(
if (TCL_ERROR == TclListObjLengthM(NULL, objv[0], &length)
|| (length < 1)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"cmdPrefix must be list of length >= 1", -1));
"cmdPrefix must be list of length >= 1", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "INTERP",
"BGERRORFORMAT", NULL);
return TCL_ERROR;
@@ -2552,7 +2552,7 @@ ChildCreate(
int
TclChildObjCmd(
ClientData clientData, /* Child interpreter. */
void *clientData, /* Child interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -2562,7 +2562,7 @@ TclChildObjCmd(
static int
NRChildCmd(
ClientData clientData, /* Child interpreter. */
void *clientData, /* Child interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -2766,7 +2766,7 @@ NRChildCmd(
static void
ChildObjCmdDeleteProc(
ClientData clientData) /* The ChildRecord for the command. */
void *clientData) /* The ChildRecord for the command. */
{
Child *childPtr; /* Interim storage for Child record. */
Tcl_Interp *childInterp = (Tcl_Interp *)clientData;
@@ -2831,7 +2831,7 @@ ChildDebugCmd(
if (objc == 0) {
TclNewObj(resultPtr);
Tcl_ListObjAppendElement(NULL, resultPtr,
Tcl_NewStringObj("-frame", -1));
Tcl_NewStringObj("-frame", TCL_INDEX_NONE));
Tcl_ListObjAppendElement(NULL, resultPtr,
Tcl_NewBooleanObj(iPtr->flags & INTERP_DEBUG_FRAME));
Tcl_SetObjResult(interp, resultPtr);
@@ -3001,7 +3001,7 @@ ChildRecursionLimit(
if (objc) {
if (Tcl_IsSafe(interp)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj("permission denied: "
"safe interpreters cannot change recursion limit", -1));
"safe interpreters cannot change recursion limit", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "INTERP", "UNSAFE",
NULL);
return TCL_ERROR;
@@ -3020,7 +3020,7 @@ ChildRecursionLimit(
iPtr = (Interp *) childInterp;
if (interp == childInterp && iPtr->numLevels > (size_t)limit) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"falling back due to new recursion limit", -1));
"falling back due to new recursion limit", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "RECURSION", NULL);
return TCL_ERROR;
}
@@ -3110,7 +3110,7 @@ ChildHidden(
hPtr != NULL;
hPtr = Tcl_NextHashEntry(&hSearch)) {
Tcl_ListObjAppendElement(NULL, listObjPtr,
Tcl_NewStringObj((const char *)Tcl_GetHashKey(hTblPtr, hPtr), -1));
Tcl_NewStringObj((const char *)Tcl_GetHashKey(hTblPtr, hPtr), TCL_INDEX_NONE));
}
}
Tcl_SetObjResult(interp, listObjPtr);
@@ -3183,7 +3183,7 @@ ChildInvokeHidden(
static int
NRPostInvokeHidden(
ClientData data[],
void *data[],
Tcl_Interp *interp,
int result)
{
@@ -3299,7 +3299,7 @@ TclMakeSafe(
*/
(void) Tcl_EvalEx(interp,
"namespace eval ::tcl {namespace eval mathfunc {}}", -1, 0);
"namespace eval ::tcl {namespace eval mathfunc {}}", TCL_INDEX_NONE, 0);
}
iPtr->flags |= SAFE_INTERP;
@@ -3479,7 +3479,7 @@ Tcl_LimitCheck(
iPtr->limit.exceeded &= ~TCL_LIMIT_COMMANDS;
} else if (iPtr->limit.exceeded & TCL_LIMIT_COMMANDS) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"command count limit exceeded", -1));
"command count limit exceeded", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "LIMIT", "COMMANDS", NULL);
Tcl_Release(interp);
return TCL_ERROR;
@@ -3505,7 +3505,7 @@ Tcl_LimitCheck(
iPtr->limit.exceeded &= ~TCL_LIMIT_TIME;
} else if (iPtr->limit.exceeded & TCL_LIMIT_TIME) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"time limit exceeded", -1));
"time limit exceeded", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "LIMIT", "TIME", NULL);
Tcl_Release(interp);
return TCL_ERROR;
@@ -3608,7 +3608,7 @@ Tcl_LimitAddHandler(
Tcl_Interp *interp,
int type,
Tcl_LimitHandlerProc *handlerProc,
ClientData clientData,
void *clientData,
Tcl_LimitHandlerDeleteProc *deleteProc)
{
Interp *iPtr = (Interp *) interp;
@@ -3682,7 +3682,7 @@ Tcl_LimitRemoveHandler(
Tcl_Interp *interp,
int type,
Tcl_LimitHandlerProc *handlerProc,
ClientData clientData)
void *clientData)
{
Interp *iPtr = (Interp *) interp;
LimitHandler *handlerPtr;
@@ -3985,7 +3985,7 @@ Tcl_LimitTypeReset(
void
Tcl_LimitSetCommands(
Tcl_Interp *interp,
size_t commandLimit)
Tcl_Size commandLimit)
{
Interp *iPtr = (Interp *) interp;
@@ -4081,7 +4081,7 @@ Tcl_LimitSetTime(
static void
TimeLimitCallback(
ClientData clientData)
void *clientData)
{
Tcl_Interp *interp = (Tcl_Interp *)clientData;
Interp *iPtr = (Interp *)clientData;
@@ -4225,7 +4225,7 @@ Tcl_LimitGetGranularity(
static void
DeleteScriptLimitCallback(
ClientData clientData)
void *clientData)
{
ScriptLimitCallback *limitCBPtr = (ScriptLimitCallback *)clientData;
@@ -4256,7 +4256,7 @@ DeleteScriptLimitCallback(
static void
CallScriptLimitCallback(
ClientData clientData,
void *clientData,
TCL_UNUSED(Tcl_Interp *))
{
ScriptLimitCallback *limitCBPtr = (ScriptLimitCallback *)clientData;
@@ -4508,7 +4508,7 @@ ChildCommandLimitCmd(
if (interp == childInterp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"limits on current interpreter inaccessible", -1));
"limits on current interpreter inaccessible", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "INTERP", "SELF", NULL);
return TCL_ERROR;
}
@@ -4523,7 +4523,7 @@ ChildCommandLimitCmd(
if (hPtr != NULL) {
limitCBPtr = (ScriptLimitCallback *)Tcl_GetHashValue(hPtr);
if (limitCBPtr != NULL && limitCBPtr->scriptObj != NULL) {
Tcl_DictObjPut(NULL, dictPtr, Tcl_NewStringObj(options[0], -1),
Tcl_DictObjPut(NULL, dictPtr, Tcl_NewStringObj(options[0], TCL_INDEX_NONE),
limitCBPtr->scriptObj);
} else {
goto putEmptyCommandInDict;
@@ -4534,21 +4534,21 @@ ChildCommandLimitCmd(
putEmptyCommandInDict:
TclNewObj(empty);
Tcl_DictObjPut(NULL, dictPtr,
Tcl_NewStringObj(options[0], -1), empty);
Tcl_NewStringObj(options[0], TCL_INDEX_NONE), empty);
}
Tcl_DictObjPut(NULL, dictPtr, Tcl_NewStringObj(options[1], -1),
Tcl_DictObjPut(NULL, dictPtr, Tcl_NewStringObj(options[1], TCL_INDEX_NONE),
Tcl_NewWideIntObj(Tcl_LimitGetGranularity(childInterp,
TCL_LIMIT_COMMANDS)));
if (Tcl_LimitTypeEnabled(childInterp, TCL_LIMIT_COMMANDS)) {
Tcl_DictObjPut(NULL, dictPtr, Tcl_NewStringObj(options[2], -1),
Tcl_DictObjPut(NULL, dictPtr, Tcl_NewStringObj(options[2], TCL_INDEX_NONE),
Tcl_NewWideIntObj(Tcl_LimitGetCommands(childInterp)));
} else {
Tcl_Obj *empty;
TclNewObj(empty);
Tcl_DictObjPut(NULL, dictPtr,
Tcl_NewStringObj(options[2], -1), empty);
Tcl_NewStringObj(options[2], TCL_INDEX_NONE), empty);
}
Tcl_SetObjResult(interp, dictPtr);
return TCL_OK;
@@ -4607,7 +4607,7 @@ ChildCommandLimitCmd(
}
if (gran < 1) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"granularity must be at least 1", -1));
"granularity must be at least 1", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "INTERP",
"BADVALUE", NULL);
return TCL_ERROR;
@@ -4624,7 +4624,7 @@ ChildCommandLimitCmd(
}
if (limit < 0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"command limit value must be at least 0", -1));
"command limit value must be at least 0", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "INTERP",
"BADVALUE", NULL);
return TCL_ERROR;
@@ -4696,7 +4696,7 @@ ChildTimeLimitCmd(
if (interp == childInterp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"limits on current interpreter inaccessible", -1));
"limits on current interpreter inaccessible", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "INTERP", "SELF", NULL);
return TCL_ERROR;
}
@@ -4711,7 +4711,7 @@ ChildTimeLimitCmd(
if (hPtr != NULL) {
limitCBPtr = (ScriptLimitCallback *)Tcl_GetHashValue(hPtr);
if (limitCBPtr != NULL && limitCBPtr->scriptObj != NULL) {
Tcl_DictObjPut(NULL, dictPtr, Tcl_NewStringObj(options[0], -1),
Tcl_DictObjPut(NULL, dictPtr, Tcl_NewStringObj(options[0], TCL_INDEX_NONE),
limitCBPtr->scriptObj);
} else {
goto putEmptyCommandInDict;
@@ -4721,9 +4721,9 @@ ChildTimeLimitCmd(
putEmptyCommandInDict:
TclNewObj(empty);
Tcl_DictObjPut(NULL, dictPtr,
Tcl_NewStringObj(options[0], -1), empty);
Tcl_NewStringObj(options[0], TCL_INDEX_NONE), empty);
}
Tcl_DictObjPut(NULL, dictPtr, Tcl_NewStringObj(options[1], -1),
Tcl_DictObjPut(NULL, dictPtr, Tcl_NewStringObj(options[1], TCL_INDEX_NONE),
Tcl_NewWideIntObj(Tcl_LimitGetGranularity(childInterp,
TCL_LIMIT_TIME)));
@@ -4731,18 +4731,18 @@ ChildTimeLimitCmd(
Tcl_Time limitMoment;
Tcl_LimitGetTime(childInterp, &limitMoment);
Tcl_DictObjPut(NULL, dictPtr, Tcl_NewStringObj(options[2], -1),
Tcl_DictObjPut(NULL, dictPtr, Tcl_NewStringObj(options[2], TCL_INDEX_NONE),
Tcl_NewWideIntObj(limitMoment.usec/1000));
Tcl_DictObjPut(NULL, dictPtr, Tcl_NewStringObj(options[3], -1),
Tcl_DictObjPut(NULL, dictPtr, Tcl_NewStringObj(options[3], TCL_INDEX_NONE),
Tcl_NewWideIntObj(limitMoment.sec));
} else {
Tcl_Obj *empty;
TclNewObj(empty);
Tcl_DictObjPut(NULL, dictPtr,
Tcl_NewStringObj(options[2], -1), empty);
Tcl_NewStringObj(options[2], TCL_INDEX_NONE), empty);
Tcl_DictObjPut(NULL, dictPtr,
Tcl_NewStringObj(options[3], -1), empty);
Tcl_NewStringObj(options[3], TCL_INDEX_NONE), empty);
}
Tcl_SetObjResult(interp, dictPtr);
return TCL_OK;
@@ -4816,7 +4816,7 @@ ChildTimeLimitCmd(
}
if (gran < 1) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"granularity must be at least 1", -1));
"granularity must be at least 1", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "INTERP",
"BADVALUE", NULL);
return TCL_ERROR;
@@ -4870,7 +4870,7 @@ ChildTimeLimitCmd(
if (secObj != NULL && secLen == 0 && milliLen > 0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"may only set -milliseconds if -seconds is not "
"also being reset", -1));
"also being reset", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "INTERP",
"BADUSAGE", NULL);
return TCL_ERROR;
@@ -4878,7 +4878,7 @@ ChildTimeLimitCmd(
if (milliLen == 0 && (secObj == NULL || secLen > 0)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"may only reset -milliseconds if -seconds is "
"also being reset", -1));
"also being reset", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "INTERP",
"BADUSAGE", NULL);
return TCL_ERROR;
+19 -60
View File
@@ -175,7 +175,7 @@ Tcl_LinkVar(
linkPtr = (Link *)Tcl_Alloc(sizeof(Link));
linkPtr->interp = interp;
linkPtr->nsPtr = NULL;
linkPtr->varName = Tcl_NewStringObj(varName, -1);
linkPtr->varName = Tcl_NewStringObj(varName, TCL_INDEX_NONE);
Tcl_IncrRefCount(linkPtr->varName);
linkPtr->addr = addr;
linkPtr->type = type & ~TCL_LINK_READ_ONLY;
@@ -246,7 +246,7 @@ Tcl_LinkArray(
* interpreter result. */
int type, /* Type of C variable: TCL_LINK_INT, etc. Also
* may have TCL_LINK_READ_ONLY OR'ed in. */
size_t size) /* Size of C variable array, >1 if array */
Tcl_Size size) /* Size of C variable array, >1 if array */
{
Tcl_Obj *objPtr;
Link *linkPtr;
@@ -254,9 +254,9 @@ Tcl_LinkArray(
const char *name;
int code;
if (size < 1) {
if (TCL_SIZE_ISNEG(size) || size < 1) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"wrong array size given", -1));
"wrong array size given", TCL_INDEX_NONE));
return TCL_ERROR;
}
@@ -340,7 +340,7 @@ Tcl_LinkArray(
default:
LinkFree(linkPtr);
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"bad linked array variable type", -1));
"bad linked array variable type", TCL_INDEX_NONE));
return TCL_ERROR;
}
@@ -380,7 +380,7 @@ Tcl_LinkArray(
*/
linkPtr->interp = interp;
linkPtr->varName = Tcl_NewStringObj(varName, -1);
linkPtr->varName = Tcl_NewStringObj(varName, TCL_INDEX_NONE);
Tcl_IncrRefCount(linkPtr->varName);
TclGetNamespaceForQualName(interp, varName, NULL, TCL_GLOBAL_ONLY,
@@ -527,56 +527,14 @@ GetUWide(
Tcl_Obj *objPtr,
Tcl_WideUInt *uwidePtr)
{
Tcl_WideInt *widePtr = (Tcl_WideInt *) uwidePtr;
void *clientData;
int type, intValue;
if (Tcl_GetWideUIntFromObj(NULL, objPtr, uwidePtr) != TCL_OK) {
int intValue;
if (Tcl_GetNumberFromObj(NULL, objPtr, &clientData, &type) == TCL_OK) {
if (type == TCL_NUMBER_INT) {
*widePtr = *((const Tcl_WideInt *) clientData);
return (*widePtr < 0);
} else if (type == TCL_NUMBER_BIG) {
mp_int *numPtr = (mp_int *)clientData;
Tcl_WideUInt value = 0;
union {
Tcl_WideUInt value;
unsigned char bytes[sizeof(Tcl_WideUInt)];
} scratch;
size_t numBytes;
unsigned char *bytes = scratch.bytes;
if (numPtr->sign || (MP_OKAY != mp_to_ubin(numPtr,
bytes, sizeof(Tcl_WideUInt), &numBytes))) {
/*
* If the sign bit is set (a negative value) or if the value
* can't possibly fit in the bits of an unsigned wide, there's
* no point in doing further conversion.
*/
return 1;
}
#ifndef WORDS_BIGENDIAN
while (numBytes-- > 0) {
value = (value << CHAR_BIT) | *bytes++;
}
#else /* WORDS_BIGENDIAN */
/*
* Big-endian can read the value directly.
*/
value = scratch.value;
#endif /* WORDS_BIGENDIAN */
*uwidePtr = value;
return 0;
if (GetInvalidIntFromObj(objPtr, &intValue) != TCL_OK) {
return 1;
}
*uwidePtr = intValue;
}
/*
* Evil edge case fallback.
*/
if (GetInvalidIntFromObj(objPtr, &intValue) != TCL_OK) {
return 1;
}
*uwidePtr = intValue;
return 0;
}
@@ -589,7 +547,7 @@ GetDouble(
return 0;
} else {
#ifdef ACCEPT_NAN
Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objPtr, &tclDoubleType);
Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objPtr, &tclDoubleType.objType);
if (irPtr != NULL) {
*dblPtr = irPtr->doubleValue;
@@ -922,7 +880,9 @@ LinkTraceProc(
case TCL_LINK_BINARY:
value = (char *) Tcl_GetByteArrayFromObj(valueObj, &valueLength);
if (valueLength != linkPtr->bytes) {
if (value == NULL) {
return (char *) "invalid binary value";
} else if (valueLength != linkPtr->bytes) {
return (char *) "wrong size of binary value";
}
if (linkPtr->flags & LINK_ALLOC_LAST) {
@@ -1323,7 +1283,7 @@ ObjValue(
memcpy(linkPtr->lastValue.aryPtr, linkPtr->addr, linkPtr->bytes);
objv = (Tcl_Obj **)Tcl_Alloc(linkPtr->numElems * sizeof(Tcl_Obj *));
for (i=0; i < linkPtr->numElems; i++) {
objv[i] = Tcl_NewDoubleObj(linkPtr->lastValue.dPtr[i]);
TclNewDoubleObj(objv[i], linkPtr->lastValue.dPtr[i]);
}
resultObj = Tcl_NewListObj(linkPtr->numElems, objv);
Tcl_Free(objv);
@@ -1442,7 +1402,7 @@ ObjValue(
memcpy(linkPtr->lastValue.aryPtr, linkPtr->addr, linkPtr->bytes);
objv = (Tcl_Obj **)Tcl_Alloc(linkPtr->numElems * sizeof(Tcl_Obj *));
for (i=0; i < linkPtr->numElems; i++) {
objv[i] = Tcl_NewDoubleObj(linkPtr->lastValue.fPtr[i]);
TclNewDoubleObj(objv[i], linkPtr->lastValue.fPtr[i]);
}
resultObj = Tcl_NewListObj(linkPtr->numElems, objv);
Tcl_Free(objv);
@@ -1455,8 +1415,7 @@ ObjValue(
memcpy(linkPtr->lastValue.aryPtr, linkPtr->addr, linkPtr->bytes);
objv = (Tcl_Obj **)Tcl_Alloc(linkPtr->numElems * sizeof(Tcl_Obj *));
for (i=0; i < linkPtr->numElems; i++) {
TclNewUIntObj(objv[i],
linkPtr->lastValue.uwPtr[i]);
TclNewUIntObj(objv[i], linkPtr->lastValue.uwPtr[i]);
}
resultObj = Tcl_NewListObj(linkPtr->numElems, objv);
Tcl_Free(objv);
@@ -1474,7 +1433,7 @@ ObjValue(
TclNewLiteralStringObj(resultObj, "NULL");
return resultObj;
}
return Tcl_NewStringObj(p, -1);
return Tcl_NewStringObj(p, TCL_INDEX_NONE);
case TCL_LINK_CHARS:
if (linkPtr->flags & LINK_ALLOC_LAST) {
+46 -35
View File
@@ -11,6 +11,7 @@
#include <assert.h>
#include "tclInt.h"
#include "tclTomMath.h"
#include "tclArithSeries.h"
/*
@@ -68,7 +69,7 @@
/* Checks for when caller should have already converted to internal list type */
#define LIST_ASSERT_TYPE(listObj_) \
LIST_ASSERT((listObj_)->typePtr == &tclListType);
LIST_ASSERT((listObj_)->typePtr == &tclListType.objType);
/*
@@ -142,6 +143,7 @@ static void DupListInternalRep(Tcl_Obj *srcPtr, Tcl_Obj *copyPtr);
static void FreeListInternalRep(Tcl_Obj *listPtr);
static int SetListFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr);
static void UpdateStringOfList(Tcl_Obj *listPtr);
static size_t ListLength(Tcl_Obj *listPtr);
/*
* The structure below defines the list Tcl object type by means of functions
@@ -150,13 +152,15 @@ static void UpdateStringOfList(Tcl_Obj *listPtr);
* The internal representation of a list object is ListRep defined in tcl.h.
*/
const Tcl_ObjType tclListType = {
"list", /* name */
const TclObjTypeWithAbstractList tclListType = {
{"list", /* name */
FreeListInternalRep, /* freeIntRepProc */
DupListInternalRep, /* dupIntRepProc */
UpdateStringOfList, /* updateStringProc */
SetListFromAny, /* setFromAnyProc */
TCL_OBJTYPE_V0
TCL_OBJTYPE_V0_1(
ListLength
)}
};
/* Macros to manipulate the List internal rep */
@@ -202,7 +206,7 @@ const Tcl_ObjType tclListType = {
do { \
(objPtr_)->internalRep.twoPtrValue.ptr1 = (repPtr_)->storePtr; \
(objPtr_)->internalRep.twoPtrValue.ptr2 = (repPtr_)->spanPtr; \
(objPtr_)->typePtr = &tclListType; \
(objPtr_)->typePtr = &tclListType.objType; \
} while (0)
#define ListObjOverwriteRep(objPtr_, repPtr_) \
@@ -522,7 +526,7 @@ ListLimitExceededError(Tcl_Interp *interp)
if (interp != NULL) {
Tcl_SetObjResult(
interp,
Tcl_NewStringObj("max length of a Tcl list exceeded", -1));
Tcl_NewStringObj("max length of a Tcl list exceeded", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL);
}
return TCL_ERROR;
@@ -1272,7 +1276,7 @@ TclListObjGetRep(
* to be returned. */
ListRep *repPtr) /* Location to store descriptor */
{
if (!TclHasInternalRep(listObj, &tclListType)) {
if (!TclHasInternalRep(listObj, &tclListType.objType)) {
int result;
result = SetListFromAny(interp, listObj);
if (result != TCL_OK) {
@@ -1366,8 +1370,8 @@ TclListObjCopy(
{
Tcl_Obj *copyObj;
if (!TclHasInternalRep(listObj, &tclListType)) {
if (TclHasInternalRep(listObj,&tclArithSeriesType)) {
if (!TclHasInternalRep(listObj, &tclListType.objType)) {
if (TclHasInternalRep(listObj,&tclArithSeriesType.objType)) {
return TclArithSeriesObjCopy(interp, listObj);
}
if (SetListFromAny(interp, listObj) != TCL_OK) {
@@ -1656,14 +1660,14 @@ Tcl_ListObjGetElements(
Tcl_Interp *interp, /* Used to report errors if not NULL. */
Tcl_Obj *objPtr, /* List object for which an element array is
* to be returned. */
Tcl_Size *objcPtr, /* Where to store the count of objects
size_t *objcPtr, /* Where to store the count of objects
* referenced by objv. */
Tcl_Obj ***objvPtr) /* Where to store the pointer to an array of
* pointers to the list's objects. */
{
ListRep listRep;
if (TclHasInternalRep(objPtr,&tclArithSeriesType)) {
if (TclHasInternalRep(objPtr,&tclArithSeriesType.objType)) {
return TclArithSeriesGetElements(interp, objPtr, objcPtr, objvPtr);
}
@@ -1989,12 +1993,13 @@ int
Tcl_ListObjLength(
Tcl_Interp *interp, /* Used to report errors if not NULL. */
Tcl_Obj *listObj, /* List object whose #elements to return. */
Tcl_Size *lenPtr) /* The resulting int is stored here. */
size_t *lenPtr) /* The resulting length is stored here. */
{
ListRep listRep;
if (TclHasInternalRep(listObj,&tclArithSeriesType)) {
*lenPtr = TclArithSeriesObjLength(listObj);
size_t (*lengthProc)(Tcl_Obj *obj) = ABSTRACTLIST_PROC(listObj, lengthProc);
if (lengthProc) {
*lenPtr = lengthProc(listObj);
return TCL_OK;
}
@@ -2011,6 +2016,15 @@ Tcl_ListObjLength(
*lenPtr = ListRepLength(&listRep);
return TCL_OK;
}
size_t ListLength(
Tcl_Obj *listPtr)
{
ListRep listRep;
ListObjGetRep(listPtr, &listRep);
return ListRepLength(&listRep);
}
/*
*----------------------------------------------------------------------
@@ -2330,7 +2344,7 @@ Tcl_ListObjReplace(
*/
/*
* Calculate shifts if necessary to accomodate insertions.
* Calculate shifts if necessary to accommodate insertions.
* NOTE: all indices are relative to listObjs which is not necessarily the
* start of the ListStore storage area.
*
@@ -2553,7 +2567,7 @@ TclLindexList(
* shimmering; if internal rep is already a list do not shimmer it.
* see TIP#22 and TIP#33 for the details.
*/
if (!TclHasInternalRep(argObj, &tclListType)
if (!TclHasInternalRep(argObj, &tclListType.objType)
&& TclGetIntForIndexM(NULL, argObj, ListSizeT_MAX - 1, &index)
== TCL_OK) {
/*
@@ -2626,8 +2640,8 @@ TclLindexFlat(
Tcl_Size i;
/* Handle ArithSeries as special case */
if (TclHasInternalRep(listObj,&tclArithSeriesType)) {
Tcl_WideInt listLen = TclArithSeriesObjLength(listObj);
if (TclHasInternalRep(listObj,&tclArithSeriesType.objType)) {
Tcl_Size listLen = ABSTRACTLIST_PROC(listObj, lengthProc)(listObj);
Tcl_Size index;
Tcl_Obj *elemObj = NULL;
for (i=0 ; i<indexCount && listObj ; i++) {
@@ -2635,7 +2649,7 @@ TclLindexFlat(
&index) == TCL_OK) {
}
if (i==0) {
TclArithSeriesObjIndex(listObj, index, &elemObj);
elemObj = TclArithSeriesObjIndex(NULL, listObj, index);
} else if (index > 0) {
/* ArithSeries cannot be a list of lists */
Tcl_DecrRefCount(elemObj);
@@ -2744,7 +2758,7 @@ TclLsetList(
* shimmering; see TIP #22 and #23 for details.
*/
if (!TclHasInternalRep(indexArgObj, &tclListType)
if (!TclHasInternalRep(indexArgObj, &tclListType.objType)
&& TclGetIntForIndexM(NULL, indexArgObj, ListSizeT_MAX - 1, &index)
== TCL_OK) {
/* indexArgPtr designates a single index. */
@@ -3274,13 +3288,13 @@ SetListFromAny(
Tcl_IncrRefCount(valuePtr);
Tcl_DictObjNext(&search, &keyPtr, &valuePtr, &done);
}
} else if (TclHasInternalRep(objPtr,&tclArithSeriesType)) {
} else if (TclHasInternalRep(objPtr,&tclArithSeriesType.objType)) {
/*
* Convertion from Arithmetic Series is a special case
* because it can be done an order of magnitude faster
* and may occur frequently.
*/
Tcl_Size j, size = TclArithSeriesObjLength(objPtr);
Tcl_Size j, size = ABSTRACTLIST_PROC(objPtr, lengthProc)(objPtr);
/* TODO - leave space in front and/or back? */
if (ListRepInitAttempt(
@@ -3296,7 +3310,8 @@ SetListFromAny(
listRep.storePtr->numUsed = size;
elemPtrs = listRep.storePtr->slots;
for (j = 0; j < size; j++) {
if (TclArithSeriesObjIndex(objPtr, j, &elemPtrs[j]) != TCL_OK) {
elemPtrs[j] = TclArithSeriesObjIndex(interp, objPtr, j);
if (elemPtrs[j] == NULL) {
return TCL_ERROR;
}
}
@@ -3382,7 +3397,7 @@ fail:
TclFreeInternalRep(objPtr);
objPtr->internalRep.twoPtrValue.ptr1 = listRep.storePtr;
objPtr->internalRep.twoPtrValue.ptr2 = listRep.spanPtr;
objPtr->typePtr = &tclListType;
objPtr->typePtr = &tclListType.objType;
return TCL_OK;
}
@@ -3507,17 +3522,10 @@ UpdateStringOfList(
*------------------------------------------------------------------------
*/
Tcl_Obj *
TclListTestObj (int length, int leadingSpace, int endSpace)
TclListTestObj(size_t length, size_t leadingSpace, size_t endSpace)
{
if (length < 0)
length = 0;
if (leadingSpace < 0)
leadingSpace = 0;
if (endSpace < 0)
endSpace = 0;
ListRep listRep;
Tcl_Size capacity;
size_t capacity;
Tcl_Obj *listObj;
TclNewObj(listObj);
@@ -3527,13 +3535,16 @@ TclListTestObj (int length, int leadingSpace, int endSpace)
if (capacity == 0) {
return listObj;
}
if (capacity > LIST_MAX) {
return NULL;
}
ListRepInit(capacity, NULL, 0, &listRep);
ListStore *storePtr = listRep.storePtr;
int i;
size_t i;
for (i = 0; i < length; ++i) {
storePtr->slots[i + leadingSpace] = Tcl_NewIntObj(i);
TclNewUIntObj(storePtr->slots[i + leadingSpace], i);
Tcl_IncrRefCount(storePtr->slots[i + leadingSpace]);
}
storePtr->firstUsed = leadingSpace;
+18 -18
View File
@@ -179,8 +179,8 @@ TclCreateLiteral(
const char *bytes, /* The start of the string. Note that this is
* not a NUL-terminated string. */
size_t length, /* Number of bytes in the string. */
size_t hash, /* The string's hash. If -1, it will be
* computed here. */
TCL_HASH_TYPE hash, /* The string's hash. If the value is
* TCL_INDEX_NONE, it will be computed here. */
int *newPtr,
Namespace *nsPtr,
int flags,
@@ -229,7 +229,7 @@ TclCreateLiteral(
if (flags & LITERAL_ON_HEAP) {
Tcl_Free((void *)bytes);
}
if (globalPtr->refCount != TCL_INDEX_NONE) {
if (!TCL_SIZE_ISNEG(globalPtr->refCount)) {
globalPtr->refCount++;
}
return objPtr;
@@ -351,7 +351,7 @@ Tcl_Obj *
TclFetchLiteral(
CompileEnv *envPtr, /* Points to the CompileEnv from which to
* fetch the registered literal value. */
size_t index) /* Index of the desired literal, as returned
Tcl_Size index) /* Index of the desired literal, as returned
* by prior call to TclRegisterLiteral() */
{
if (index >= envPtr->literalArrayNext) {
@@ -387,16 +387,16 @@ TclFetchLiteral(
*----------------------------------------------------------------------
*/
size_t
Tcl_Size
TclRegisterLiteral(
void *ePtr, /* Points to the CompileEnv in whose object
* array an object is found or created. */
const char *bytes, /* Points to string for which to find or
* create an object in CompileEnv's object
* array. */
size_t length, /* Number of bytes in the string. If -1, the
* string consists of all bytes up to the
* first null character. */
Tcl_Size length, /* Number of bytes in the string. If
* TCL_INDEX_NONE, the string consists of all bytes
* up to the first null character. */
int flags) /* If LITERAL_ON_HEAP then the caller already
* malloc'd bytes and ownership is passed to
* this function. If LITERAL_CMD_NAME then
@@ -412,7 +412,7 @@ TclRegisterLiteral(
int isNew;
Namespace *nsPtr;
if (length == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(length)) {
length = (bytes ? strlen(bytes) : 0);
}
hash = HashString(bytes, length);
@@ -607,7 +607,7 @@ TclHideLiteral(
*----------------------------------------------------------------------
*/
size_t
Tcl_Size
TclAddLiteralObj(
CompileEnv *envPtr,/* Points to CompileEnv in whose literal array
* the object is to be inserted. */
@@ -617,7 +617,7 @@ TclAddLiteralObj(
* NULL. */
{
LiteralEntry *lPtr;
size_t objIndex;
Tcl_Size objIndex;
if (envPtr->literalArrayNext >= envPtr->literalArrayEnd) {
ExpandLocalLiteralArray(envPtr);
@@ -851,7 +851,7 @@ TclReleaseLiteral(
* literal table entry (decrement the ref count of the object).
*/
if ((entryPtr->refCount != TCL_INDEX_NONE) && (entryPtr->refCount-- <= 1)) {
if (!TCL_SIZE_ISNEG((entryPtr->refCount)) && (entryPtr->refCount-- <= 1)) {
if (prevPtr == NULL) {
globalTablePtr->buckets[index] = entryPtr->nextPtr;
} else {
@@ -1057,7 +1057,7 @@ TclInvalidateCmdLiteral(
{
Interp *iPtr = (Interp *) interp;
Tcl_Obj *literalObjPtr = TclCreateLiteral(iPtr, name,
strlen(name), -1, NULL, nsPtr, 0, NULL);
strlen(name), TCL_INDEX_NONE, NULL, nsPtr, 0, NULL);
if (literalObjPtr != NULL) {
if (TclHasInternalRep(literalObjPtr, &tclCmdNameType)) {
@@ -1128,18 +1128,18 @@ TclLiteralStats(
*/
result = (char *)Tcl_Alloc(NUM_COUNTERS*60 + 300);
sprintf(result, "%" TCL_Z_MODIFIER "u entries in table, %" TCL_Z_MODIFIER "u buckets\n",
snprintf(result, 60, "%" TCL_Z_MODIFIER "u entries in table, %" TCL_Z_MODIFIER "u buckets\n",
tablePtr->numEntries, tablePtr->numBuckets);
p = result + strlen(result);
for (i=0 ; i<NUM_COUNTERS ; i++) {
sprintf(p, "number of buckets with %" TCL_Z_MODIFIER "u entries: %" TCL_Z_MODIFIER "u\n",
snprintf(p, 60, "number of buckets with %" TCL_Z_MODIFIER "u entries: %" TCL_Z_MODIFIER "u\n",
i, count[i]);
p += strlen(p);
}
sprintf(p, "number of buckets with %d or more entries: %" TCL_Z_MODIFIER "u\n",
snprintf(p, 60, "number of buckets with %d or more entries: %" TCL_Z_MODIFIER "u\n",
NUM_COUNTERS, overflow);
p += strlen(p);
sprintf(p, "average search distance for entry: %.1f", average);
snprintf(p, 60, "average search distance for entry: %.1f", average);
return result;
}
#endif /*TCL_COMPILE_STATS*/
@@ -1175,7 +1175,7 @@ TclVerifyLocalLiteralTable(
for (localPtr=localTablePtr->buckets[i] ; localPtr!=NULL;
localPtr=localPtr->nextPtr) {
count++;
if (localPtr->refCount != TCL_INDEX_NONE) {
if (!TCL_SIZE_ISNEG(localPtr->refCount)) {
bytes = Tcl_GetStringFromObj(localPtr->objPtr, &length);
Tcl_Panic("%s: local literal \"%.*s\" had bad refCount %" TCL_Z_MODIFIER "u",
"TclVerifyLocalLiteralTable",
+13 -13
View File
@@ -192,7 +192,7 @@ Tcl_LoadObjCmd(
}
if ((fullFileName[0] == 0) && (prefix == NULL)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"must specify either file name or prefix", -1));
"must specify either file name or prefix", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LOAD", "NOLIBRARY",
NULL);
code = TCL_ERROR;
@@ -232,9 +232,9 @@ Tcl_LoadObjCmd(
namesMatch = 0;
} else {
TclDStringClear(&pfx);
Tcl_DStringAppend(&pfx, prefix, -1);
Tcl_DStringAppend(&pfx, prefix, TCL_INDEX_NONE);
TclDStringClear(&tmp);
Tcl_DStringAppend(&tmp, libraryPtr->prefix, -1);
Tcl_DStringAppend(&tmp, libraryPtr->prefix, TCL_INDEX_NONE);
if (strcmp(Tcl_DStringValue(&tmp),
Tcl_DStringValue(&pfx)) == 0) {
namesMatch = 1;
@@ -307,7 +307,7 @@ Tcl_LoadObjCmd(
*/
if (prefix != NULL) {
Tcl_DStringAppend(&pfx, prefix, -1);
Tcl_DStringAppend(&pfx, prefix, TCL_INDEX_NONE);
} else {
Tcl_Obj *splitPtr, *pkgGuessPtr;
size_t pElements;
@@ -487,7 +487,7 @@ Tcl_LoadObjCmd(
* this interp are incompatible in their stubs mechanisms, and
* recorded the error in the oldest legacy place we have to do so.
*/
Tcl_SetObjResult(target, Tcl_NewStringObj(iPtr->legacyResult, -1));
Tcl_SetObjResult(target, Tcl_NewStringObj(iPtr->legacyResult, TCL_INDEX_NONE));
iPtr->legacyResult = NULL;
iPtr->legacyFreeProc = (void (*) (void))-1;
}
@@ -625,7 +625,7 @@ Tcl_UnloadObjCmd(
}
if ((fullFileName[0] == 0) && (prefix == NULL)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"must specify either file name or prefix", -1));
"must specify either file name or prefix", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "UNLOAD", "NOLIBRARY",
NULL);
code = TCL_ERROR;
@@ -665,9 +665,9 @@ Tcl_UnloadObjCmd(
namesMatch = 0;
} else {
TclDStringClear(&pfx);
Tcl_DStringAppend(&pfx, prefix, -1);
Tcl_DStringAppend(&pfx, prefix, TCL_INDEX_NONE);
TclDStringClear(&tmp);
Tcl_DStringAppend(&tmp, libraryPtr->prefix, -1);
Tcl_DStringAppend(&tmp, libraryPtr->prefix, TCL_INDEX_NONE);
if (strcmp(Tcl_DStringValue(&tmp),
Tcl_DStringValue(&pfx)) == 0) {
namesMatch = 1;
@@ -1121,8 +1121,8 @@ TclGetLoadedLibraries(
Tcl_MutexLock(&libraryMutex);
for (libraryPtr = firstLibraryPtr; libraryPtr != NULL;
libraryPtr = libraryPtr->nextPtr) {
pkgDesc[0] = Tcl_NewStringObj(libraryPtr->fileName, -1);
pkgDesc[1] = Tcl_NewStringObj(libraryPtr->prefix, -1);
pkgDesc[0] = Tcl_NewStringObj(libraryPtr->fileName, TCL_INDEX_NONE);
pkgDesc[1] = Tcl_NewStringObj(libraryPtr->prefix, TCL_INDEX_NONE);
Tcl_ListObjAppendElement(NULL, resultObj,
Tcl_NewListObj(2, pkgDesc));
}
@@ -1147,7 +1147,7 @@ TclGetLoadedLibraries(
libraryPtr = ipPtr->libraryPtr;
if (!strcmp(prefix, libraryPtr->prefix)) {
resultObj = Tcl_NewStringObj(libraryPtr->fileName, -1);
resultObj = Tcl_NewStringObj(libraryPtr->fileName, TCL_INDEX_NONE);
break;
}
}
@@ -1166,8 +1166,8 @@ TclGetLoadedLibraries(
TclNewObj(resultObj);
for (; ipPtr != NULL; ipPtr = ipPtr->nextPtr) {
libraryPtr = ipPtr->libraryPtr;
pkgDesc[0] = Tcl_NewStringObj(libraryPtr->fileName, -1);
pkgDesc[1] = Tcl_NewStringObj(libraryPtr->prefix, -1);
pkgDesc[0] = Tcl_NewStringObj(libraryPtr->fileName, TCL_INDEX_NONE);
pkgDesc[1] = Tcl_NewStringObj(libraryPtr->prefix, TCL_INDEX_NONE);
Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewListObj(2, pkgDesc));
}
Tcl_SetObjResult(interp, resultObj);
+1 -1
View File
@@ -81,7 +81,7 @@ TclpLoadMemory(
{
if (interp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj("dynamic loading from memory "
"is not available on this system", -1));
"is not available on this system", TCL_INDEX_NONE));
}
return TCL_ERROR;
}
+7 -7
View File
@@ -55,7 +55,7 @@ NewNativeObj(
#else
(void)Tcl_ExternalToUtfDString(NULL, (char *)string, -1, &ds);
#endif
return TclDStringToObj(&ds);
return Tcl_DStringToObj(&ds);
}
/*
@@ -280,7 +280,7 @@ Tcl_SourceRCFile(
TCL_NORETURN void
Tcl_MainEx(
size_t argc, /* Number of arguments. */
Tcl_Size argc, /* Number of arguments. */
TCHAR **argv, /* Array of argument strings. */
Tcl_AppInitProc *appInitProc,
/* Application-specific initialization
@@ -288,7 +288,7 @@ Tcl_MainEx(
* but before starting to execute commands. */
Tcl_Interp *interp)
{
size_t i=0; /* argv[i] index */
Tcl_Size i=0; /* argv[i] index */
Tcl_Obj *path, *resultPtr, *argvPtr, *appName;
const char *encodingName = NULL;
int code, exitCode = 0;
@@ -454,7 +454,7 @@ Tcl_MainEx(
while ((is.input != NULL) && !Tcl_InterpDeleted(interp)) {
mainLoopProc = TclGetMainLoop();
if (mainLoopProc == NULL) {
size_t length;
Tcl_Size length;
if (is.tty) {
Prompt(interp, &is);
@@ -475,7 +475,7 @@ Tcl_MainEx(
Tcl_IncrRefCount(is.commandPtr);
}
length = Tcl_GetsObj(is.input, is.commandPtr);
if (length == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(length)) {
if (Tcl_InputBlocked(is.input)) {
/*
* This can only happen if stdin has been set to
@@ -740,7 +740,7 @@ StdinProc(
TCL_UNUSED(int) /*mask*/)
{
int code;
size_t length;
Tcl_Size length;
InteractiveState *isPtr = (InteractiveState *)clientData;
Tcl_Channel chan = isPtr->input;
Tcl_Obj *commandPtr = isPtr->commandPtr;
@@ -752,7 +752,7 @@ StdinProc(
Tcl_IncrRefCount(commandPtr);
}
length = Tcl_GetsObj(chan, commandPtr);
if (length == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(length)) {
if (Tcl_InputBlocked(chan)) {
return;
}
+49 -47
View File
@@ -71,26 +71,26 @@ typedef struct {
* Declarations for functions local to this file:
*/
static void DeleteImportedCmd(ClientData clientData);
static void DeleteImportedCmd(void *clientData);
static int DoImport(Tcl_Interp *interp,
Namespace *nsPtr, Tcl_HashEntry *hPtr,
const char *cmdName, const char *pattern,
Namespace *importNsPtr, int allowOverwrite);
static void DupNsNameInternalRep(Tcl_Obj *objPtr,Tcl_Obj *copyPtr);
static char * ErrorCodeRead(ClientData clientData,Tcl_Interp *interp,
static char * ErrorCodeRead(void *clientData,Tcl_Interp *interp,
const char *name1, const char *name2, int flags);
static char * ErrorInfoRead(ClientData clientData,Tcl_Interp *interp,
static char * ErrorInfoRead(void *clientData,Tcl_Interp *interp,
const char *name1, const char *name2, int flags);
static char * EstablishErrorCodeTraces(ClientData clientData,
static char * EstablishErrorCodeTraces(void *clientData,
Tcl_Interp *interp, const char *name1,
const char *name2, int flags);
static char * EstablishErrorInfoTraces(ClientData clientData,
static char * EstablishErrorInfoTraces(void *clientData,
Tcl_Interp *interp, const char *name1,
const char *name2, int flags);
static void FreeNsNameInternalRep(Tcl_Obj *objPtr);
static int GetNamespaceFromObj(Tcl_Interp *interp,
Tcl_Obj *objPtr, Tcl_Namespace **nsPtrPtr);
static int InvokeImportedNRCmd(ClientData clientData,
static int InvokeImportedNRCmd(void *clientData,
Tcl_Interp *interp,int objc,Tcl_Obj *const objv[]);
static Tcl_ObjCmdProc NamespaceChildrenCmd;
static Tcl_ObjCmdProc NamespaceCodeCmd;
@@ -417,6 +417,8 @@ Tcl_PopCallFrame(
framePtr->nsPtr = NULL;
if (framePtr->tailcallPtr) {
/* Reusing the existing reference count from framePtr->tailcallPtr, so
* no need to Tcl_IncrRefCount(framePtr->tailcallPtr)*/
TclSetTailcall(interp, framePtr->tailcallPtr);
}
}
@@ -651,7 +653,7 @@ Tcl_CreateNamespace(
const char *name, /* Name for the new namespace. May be a
* qualified name with names of ancestor
* namespaces separated by "::"s. */
ClientData clientData, /* One-word value to store with namespace. */
void *clientData, /* One-word value to store with namespace. */
Tcl_NamespaceDeleteProc *deleteProc)
/* Function called to delete client data when
* the namespace is deleted. NULL if no
@@ -696,7 +698,7 @@ Tcl_CreateNamespace(
if (deleteProc != NULL) {
nameStr = name + strlen(name) - 2;
if (nameStr >= name && nameStr[1] == ':' && nameStr[0] == ':') {
Tcl_DStringAppend(&tmpBuffer, name, -1);
Tcl_DStringAppend(&tmpBuffer, name, TCL_INDEX_NONE);
while ((nameLen = Tcl_DStringLength(&tmpBuffer)) > 0
&& Tcl_DStringValue(&tmpBuffer)[nameLen-1] == ':') {
Tcl_DStringSetLength(&tmpBuffer, nameLen-1);
@@ -713,7 +715,7 @@ Tcl_CreateNamespace(
if (*name == '\0') {
Tcl_SetObjResult(interp, Tcl_NewStringObj("can't create namespace"
" \"\": only global namespace can have empty name", -1));
" \"\": only global namespace can have empty name", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "NAMESPACE",
"CREATEGLOBAL", NULL);
Tcl_DStringFree(&tmpBuffer);
@@ -831,7 +833,7 @@ Tcl_CreateNamespace(
Tcl_DString *tempPtr = namePtr;
TclDStringAppendLiteral(buffPtr, "::");
Tcl_DStringAppend(buffPtr, ancestorPtr->name, -1);
Tcl_DStringAppend(buffPtr, ancestorPtr->name, TCL_INDEX_NONE);
TclDStringAppendDString(buffPtr, namePtr);
/*
@@ -1183,7 +1185,7 @@ TclTeardownNamespace(
Interp *iPtr = (Interp *) nsPtr->interp;
Tcl_HashEntry *entryPtr;
Tcl_HashSearch search;
size_t i;
Tcl_Size i;
/*
* Start by destroying the namespace's variable table, since variables
@@ -1204,7 +1206,7 @@ TclTeardownNamespace(
*/
while (nsPtr->cmdTable.numEntries > 0) {
size_t length = nsPtr->cmdTable.numEntries;
Tcl_Size length = nsPtr->cmdTable.numEntries;
Command **cmds = (Command **)TclStackAlloc((Tcl_Interp *) iPtr,
sizeof(Command *) * length);
@@ -1394,7 +1396,7 @@ Tcl_Export(
Namespace *currNsPtr = (Namespace *) TclGetCurrentNamespace(interp);
const char *simplePattern;
char *patternCpy;
size_t neededElems, len, i;
Tcl_Size neededElems, len, i;
/*
* If the specified namespace is NULL, use the current namespace.
@@ -1521,7 +1523,7 @@ Tcl_AppendExportList(
* export pattern list is appended. */
{
Namespace *nsPtr;
size_t i;
Tcl_Size i;
int result;
/*
@@ -1540,7 +1542,7 @@ Tcl_AppendExportList(
for (i = 0; i < nsPtr->numExportPatterns; i++) {
result = Tcl_ListObjAppendElement(interp, objPtr,
Tcl_NewStringObj(nsPtr->exportArrayPtr[i], -1));
Tcl_NewStringObj(nsPtr->exportArrayPtr[i], TCL_INDEX_NONE));
if (result != TCL_OK) {
return result;
}
@@ -1619,7 +1621,7 @@ Tcl_Import(
int result;
TclNewLiteralStringObj(objv[0], "auto_import");
objv[1] = Tcl_NewStringObj(pattern, -1);
objv[1] = Tcl_NewStringObj(pattern, TCL_INDEX_NONE);
Tcl_IncrRefCount(objv[0]);
Tcl_IncrRefCount(objv[1]);
@@ -1724,7 +1726,7 @@ DoImport(
Namespace *importNsPtr,
int allowOverwrite)
{
size_t i = 0, exported = 0;
Tcl_Size i = 0, exported = 0;
Tcl_HashEntry *found;
/*
@@ -1760,11 +1762,11 @@ DoImport(
ImportRef *refPtr;
Tcl_DStringInit(&ds);
Tcl_DStringAppend(&ds, nsPtr->fullName, -1);
Tcl_DStringAppend(&ds, nsPtr->fullName, TCL_INDEX_NONE);
if (nsPtr != ((Interp *) interp)->globalNsPtr) {
TclDStringAppendLiteral(&ds, "::");
}
Tcl_DStringAppend(&ds, cmdName, -1);
Tcl_DStringAppend(&ds, cmdName, TCL_INDEX_NONE);
/*
* Check whether creating the new imported command in the current
@@ -2034,7 +2036,7 @@ TclGetOriginalCommand(
static int
InvokeImportedNRCmd(
ClientData clientData, /* Points to the imported command's
void *clientData, /* Points to the imported command's
* ImportedCmdData structure. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -2049,7 +2051,7 @@ InvokeImportedNRCmd(
int
TclInvokeImportedCmd(
ClientData clientData, /* Points to the imported command's
void *clientData, /* Points to the imported command's
* ImportedCmdData structure. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -2082,7 +2084,7 @@ TclInvokeImportedCmd(
static void
DeleteImportedCmd(
ClientData clientData) /* Points to the imported command's
void *clientData) /* Points to the imported command's
* ImportedCmdData structure. */
{
ImportedCmdData *dataPtr = (ImportedCmdData *)clientData;
@@ -2636,7 +2638,7 @@ Tcl_FindCommand(
cmdPtr = NULL;
if (cxtNsPtr->commandPathLength!=0 && strncmp(name, "::", 2)
&& !(flags & TCL_NAMESPACE_ONLY)) {
size_t i;
Tcl_Size i;
Namespace *pathNsPtr, *realNsPtr, *dummyNsPtr;
(void) TclGetNamespaceForQualName(interp, name, cxtNsPtr,
@@ -3047,11 +3049,11 @@ NamespaceChildrenCmd(
if ((*name == ':') && (*(name+1) == ':')) {
pattern = name;
} else {
Tcl_DStringAppend(&buffer, nsPtr->fullName, -1);
Tcl_DStringAppend(&buffer, nsPtr->fullName, TCL_INDEX_NONE);
if (nsPtr != globalNsPtr) {
TclDStringAppendLiteral(&buffer, "::");
}
Tcl_DStringAppend(&buffer, name, -1);
Tcl_DStringAppend(&buffer, name, TCL_INDEX_NONE);
pattern = Tcl_DStringValue(&buffer);
}
}
@@ -3077,7 +3079,7 @@ NamespaceChildrenCmd(
#endif
) {
Tcl_ListObjAppendElement(interp, listPtr,
Tcl_NewStringObj(pattern, -1));
Tcl_NewStringObj(pattern, TCL_INDEX_NONE));
}
goto searchDone;
}
@@ -3093,7 +3095,7 @@ NamespaceChildrenCmd(
childNsPtr = (Namespace *)Tcl_GetHashValue(entryPtr);
if ((pattern == NULL)
|| Tcl_StringMatch(childNsPtr->fullName, pattern)) {
elemPtr = Tcl_NewStringObj(childNsPtr->fullName, -1);
elemPtr = Tcl_NewStringObj(childNsPtr->fullName, TCL_INDEX_NONE);
Tcl_ListObjAppendElement(interp, listPtr, elemPtr);
}
entryPtr = Tcl_NextHashEntry(&search);
@@ -3183,7 +3185,7 @@ NamespaceCodeCmd(
if (currNsPtr == (Namespace *) TclGetGlobalNamespace(interp)) {
TclNewLiteralStringObj(objPtr, "::");
} else {
objPtr = Tcl_NewStringObj(currNsPtr->fullName, -1);
objPtr = Tcl_NewStringObj(currNsPtr->fullName, TCL_INDEX_NONE);
}
Tcl_ListObjAppendElement(interp, listPtr, objPtr);
@@ -3241,7 +3243,7 @@ NamespaceCurrentCmd(
if (currNsPtr == (Namespace *) TclGetGlobalNamespace(interp)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj("::", 2));
} else {
Tcl_SetObjResult(interp, Tcl_NewStringObj(currNsPtr->fullName, -1));
Tcl_SetObjResult(interp, Tcl_NewStringObj(currNsPtr->fullName, TCL_INDEX_NONE));
}
return TCL_OK;
}
@@ -3356,7 +3358,7 @@ NamespaceDeleteCmd(
static int
NamespaceEvalCmd(
ClientData clientData, /* Arbitrary value passed to cmd. */
void *clientData, /* Arbitrary value passed to cmd. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -3449,7 +3451,7 @@ NRNamespaceEvalCmd(
static int
NsEval_Callback(
ClientData data[],
void *data[],
Tcl_Interp *interp,
int result)
{
@@ -3805,7 +3807,7 @@ NamespaceImportCmd(
static int
NamespaceInscopeCmd(
ClientData clientData, /* Arbitrary value passed to cmd. */
void *clientData, /* Arbitrary value passed to cmd. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -3997,7 +3999,7 @@ NamespaceParentCmd(
if (nsPtr->parentPtr != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
nsPtr->parentPtr->fullName, -1));
nsPtr->parentPtr->fullName, TCL_INDEX_NONE));
}
return TCL_OK;
}
@@ -4037,7 +4039,7 @@ NamespacePathCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
Namespace *nsPtr = (Namespace *) TclGetCurrentNamespace(interp);
size_t nsObjc, i;
Tcl_Size nsObjc, i;
int result = TCL_ERROR;
Tcl_Obj **nsObjv;
Tcl_Namespace **namespaceList = NULL;
@@ -4058,7 +4060,7 @@ NamespacePathCmd(
for (i=0 ; i<nsPtr->commandPathLength ; i++) {
if (nsPtr->commandPathArray[i].nsPtr != NULL) {
Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj(
nsPtr->commandPathArray[i].nsPtr->fullName, -1));
nsPtr->commandPathArray[i].nsPtr->fullName, TCL_INDEX_NONE));
}
}
Tcl_SetObjResult(interp, resultObj);
@@ -4121,13 +4123,13 @@ NamespacePathCmd(
void
TclSetNsPath(
Namespace *nsPtr, /* Namespace whose path is to be set. */
size_t pathLength, /* Length of pathAry. */
Tcl_Size pathLength, /* Length of pathAry. */
Tcl_Namespace *pathAry[]) /* Array of namespaces that are the path. */
{
if (pathLength != 0) {
NamespacePathEntry *tmpPathArray =
(NamespacePathEntry *)Tcl_Alloc(sizeof(NamespacePathEntry) * pathLength);
size_t i;
Tcl_Size i;
for (i=0 ; i<pathLength ; i++) {
tmpPathArray[i].nsPtr = (Namespace *) pathAry[i];
@@ -4178,7 +4180,7 @@ static void
UnlinkNsPath(
Namespace *nsPtr)
{
size_t i;
Tcl_Size i;
for (i=0 ; i<nsPtr->commandPathLength ; i++) {
NamespacePathEntry *nsPathPtr = &nsPtr->commandPathArray[i];
@@ -4429,7 +4431,7 @@ Tcl_SetNamespaceUnknownHandler(
Tcl_Namespace *nsPtr, /* Namespace which is being updated. */
Tcl_Obj *handlerPtr) /* The new handler, or NULL to reset. */
{
size_t lstlen = 0;
Tcl_Size lstlen = 0;
Namespace *currNsPtr = (Namespace *) nsPtr;
/*
@@ -4542,7 +4544,7 @@ NamespaceTailCmd(
}
if (p >= name) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(p, -1));
Tcl_SetObjResult(interp, Tcl_NewStringObj(p, TCL_INDEX_NONE));
}
return TCL_OK;
}
@@ -4925,7 +4927,7 @@ TclLogCommandInfo(
* command (must be <= command). */
const char *command, /* First character in command that generated
* the error. */
size_t length, /* Number of bytes in command (TCL_INDEX_NONE
Tcl_Size length, /* Number of bytes in command (TCL_INDEX_NONE
* means use all bytes up to first null byte).
*/
const unsigned char *pc, /* Current pc of bytecode execution context */
@@ -4958,10 +4960,10 @@ TclLogCommandInfo(
}
}
if (length == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(length)) {
length = strlen(command);
}
overflow = (length > (size_t)limit);
overflow = (length > (Tcl_Size)limit);
Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
"\n %s\n\"%.*s%s\"", ((iPtr->errorInfo == NULL)
? "while executing" : "invoked from within"),
@@ -5011,7 +5013,7 @@ TclLogCommandInfo(
iPtr->errorStack = newObj;
}
if (iPtr->resetErrorStack) {
size_t len;
Tcl_Size len;
iPtr->resetErrorStack = 0;
TclListObjLengthM(interp, iPtr->errorStack, &len);
@@ -5083,7 +5085,7 @@ void
TclErrorStackResetIf(
Tcl_Interp *interp,
const char *msg,
size_t length)
Tcl_Size length)
{
Interp *iPtr = (Interp *) interp;
@@ -5096,7 +5098,7 @@ TclErrorStackResetIf(
iPtr->errorStack = newObj;
}
if (iPtr->resetErrorStack) {
size_t len;
Tcl_Size len;
iPtr->resetErrorStack = 0;
TclListObjLengthM(interp, iPtr->errorStack, &len);
@@ -5138,7 +5140,7 @@ Tcl_LogCommandInfo(
* command (must be <= command). */
const char *command, /* First character in command that generated
* the error. */
size_t length) /* Number of bytes in command (-1 means use
Tcl_Size length) /* Number of bytes in command (-1 means use
* all bytes up to first null byte). */
{
TclLogCommandInfo(interp, script, command, length, NULL, NULL);
+57 -57
View File
@@ -67,9 +67,9 @@ static int CloneClassMethod(Tcl_Interp *interp, Class *clsPtr,
Method **newMPtrPtr);
static int CloneObjectMethod(Tcl_Interp *interp, Object *oPtr,
Method *mPtr, Tcl_Obj *namePtr);
static void DeletedDefineNamespace(ClientData clientData);
static void DeletedObjdefNamespace(ClientData clientData);
static void DeletedHelpersNamespace(ClientData clientData);
static void DeletedDefineNamespace(void *clientData);
static void DeletedObjdefNamespace(void *clientData);
static void DeletedHelpersNamespace(void *clientData);
static Tcl_NRPostProc FinalizeAlloc;
static Tcl_NRPostProc FinalizeNext;
static Tcl_NRPostProc FinalizeObjectCall;
@@ -78,23 +78,23 @@ static void InitClassSystemRoots(Tcl_Interp *interp,
Foundation *fPtr);
static int InitFoundation(Tcl_Interp *interp);
static Tcl_InterpDeleteProc KillFoundation;
static void MyDeleted(ClientData clientData);
static void ObjectNamespaceDeleted(ClientData clientData);
static void MyDeleted(void *clientData);
static void ObjectNamespaceDeleted(void *clientData);
static Tcl_CommandTraceProc ObjectRenamedTrace;
static inline void RemoveClass(Class **list, int num, int idx);
static inline void RemoveObject(Object **list, int num, int idx);
static inline void RemoveClass(Class **list, size_t num, size_t idx);
static inline void RemoveObject(Object **list, size_t num, size_t idx);
static inline void SquelchCachedName(Object *oPtr);
static int PublicNRObjectCmd(ClientData clientData,
static int PublicNRObjectCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const *objv);
static int PrivateNRObjectCmd(ClientData clientData,
static int PrivateNRObjectCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const *objv);
static int MyClassNRObjCmd(ClientData clientData,
static int MyClassNRObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const *objv);
static void MyClassDeleted(ClientData clientData);
static void MyClassDeleted(void *clientData);
/*
* Methods in the oo::object and oo::class classes. First, we define a helper
@@ -201,10 +201,10 @@ MODULE_SCOPE const TclOOStubs tclOOStubs;
static inline void
RemoveClass(
Class **list,
int num,
int idx)
size_t num,
size_t idx)
{
for (; idx < num - 1; idx++) {
for (; idx + 1 < num; idx++) {
list[idx] = list[idx + 1];
}
list[idx] = NULL;
@@ -213,10 +213,10 @@ RemoveClass(
static inline void
RemoveObject(
Object **list,
int num,
int idx)
size_t num,
size_t idx)
{
for (; idx < num - 1; idx++) {
for (; idx + 1 < num; idx++) {
list[idx] = list[idx + 1];
}
list[idx] = NULL;
@@ -256,7 +256,7 @@ TclOOInit(
* to be fully provided.
*/
if (Tcl_EvalEx(interp, initScript, -1, 0) != TCL_OK) {
if (Tcl_EvalEx(interp, initScript, TCL_INDEX_NONE, 0) != TCL_OK) {
return TCL_ERROR;
}
@@ -352,14 +352,14 @@ InitFoundation(
Tcl_DStringInit(&buffer);
for (i = 0 ; defineCmds[i].name ; i++) {
TclDStringAppendLiteral(&buffer, "::oo::define::");
Tcl_DStringAppend(&buffer, defineCmds[i].name, -1);
Tcl_DStringAppend(&buffer, defineCmds[i].name, TCL_INDEX_NONE);
Tcl_CreateObjCommand(interp, Tcl_DStringValue(&buffer),
defineCmds[i].objProc, INT2PTR(defineCmds[i].flag), NULL);
Tcl_DStringFree(&buffer);
}
for (i = 0 ; objdefCmds[i].name ; i++) {
TclDStringAppendLiteral(&buffer, "::oo::objdefine::");
Tcl_DStringAppend(&buffer, objdefCmds[i].name, -1);
Tcl_DStringAppend(&buffer, objdefCmds[i].name, TCL_INDEX_NONE);
Tcl_CreateObjCommand(interp, Tcl_DStringValue(&buffer),
objdefCmds[i].objProc, INT2PTR(objdefCmds[i].flag), NULL);
Tcl_DStringFree(&buffer);
@@ -429,7 +429,7 @@ InitFoundation(
* Evaluate the remaining definitions, which are a compiled-in Tcl script.
*/
return Tcl_EvalEx(interp, tclOOSetupScript, -1, 0);
return Tcl_EvalEx(interp, tclOOSetupScript, TCL_INDEX_NONE, 0);
}
/*
@@ -535,7 +535,7 @@ InitClassSystemRoots(
static void
DeletedDefineNamespace(
ClientData clientData)
void *clientData)
{
Foundation *fPtr = (Foundation *)clientData;
@@ -544,7 +544,7 @@ DeletedDefineNamespace(
static void
DeletedObjdefNamespace(
ClientData clientData)
void *clientData)
{
Foundation *fPtr = (Foundation *)clientData;
@@ -553,7 +553,7 @@ DeletedObjdefNamespace(
static void
DeletedHelpersNamespace(
ClientData clientData)
void *clientData)
{
Foundation *fPtr = (Foundation *)clientData;
@@ -654,7 +654,7 @@ AllocObject(
while (1) {
char objName[10 + TCL_INTEGER_SPACE];
sprintf(objName, "::oo::Obj%" TCL_Z_MODIFIER "u", ++fPtr->tsdPtr->nsCount);
snprintf(objName, sizeof(objName), "::oo::Obj%" TCL_Z_MODIFIER "u", ++fPtr->tsdPtr->nsCount);
oPtr->namespacePtr = Tcl_CreateNamespace(interp, objName, oPtr, NULL);
if (oPtr->namespacePtr != NULL) {
creationEpoch = fPtr->tsdPtr->nsCount;
@@ -789,7 +789,7 @@ SquelchCachedName(
static void
MyDeleted(
ClientData clientData) /* Reference to the object whose [my] has been
void *clientData) /* Reference to the object whose [my] has been
* squelched. */
{
Object *oPtr = (Object *)clientData;
@@ -799,7 +799,7 @@ MyDeleted(
static void
MyClassDeleted(
ClientData clientData)
void *clientData)
{
Object *oPtr = (Object *)clientData;
oPtr->myclassCommand = NULL;
@@ -820,7 +820,7 @@ MyClassDeleted(
static void
ObjectRenamedTrace(
ClientData clientData, /* The object being deleted. */
void *clientData, /* The object being deleted. */
TCL_UNUSED(Tcl_Interp *),
TCL_UNUSED(const char *) /*oldName*/,
TCL_UNUSED(const char *) /*newName*/,
@@ -1038,7 +1038,7 @@ TclOOReleaseClassContents(
if (clsPtr->metadataPtr != NULL) {
Tcl_ObjectMetadataType *metadataTypePtr;
ClientData value;
void *value;
FOREACH_HASH(metadataTypePtr, value, clsPtr->metadataPtr) {
metadataTypePtr->deleteProc(value);
@@ -1110,7 +1110,7 @@ TclOOReleaseClassContents(
static void
ObjectNamespaceDeleted(
ClientData clientData) /* Pointer to the class whose namespace is
void *clientData) /* Pointer to the class whose namespace is
* being deleted. */
{
Object *oPtr = (Object *)clientData;
@@ -1261,7 +1261,7 @@ ObjectNamespaceDeleted(
if (oPtr->metadataPtr != NULL) {
Tcl_ObjectMetadataType *metadataTypePtr;
ClientData value;
void *value;
FOREACH_HASH(metadataTypePtr, value, oPtr->metadataPtr) {
metadataTypePtr->deleteProc(value);
@@ -1675,7 +1675,7 @@ Tcl_NewObjectInstance(
{
Class *classPtr = (Class *) cls;
Object *oPtr;
ClientData clientData[4];
void *clientData[4];
oPtr = TclNewObjectInstanceCommon(interp, classPtr, nameStr, nsNameStr);
if (oPtr == NULL) {
@@ -1687,7 +1687,7 @@ Tcl_NewObjectInstance(
* used for object cloning only.
*/
if (objc != TCL_INDEX_NONE) {
if (!TCL_SIZE_ISNEG(objc)) {
CallContext *contextPtr =
TclOOGetCallContext(oPtr, NULL, CONSTRUCTOR, NULL, NULL, NULL);
@@ -1758,7 +1758,7 @@ TclNRNewObjectInstance(
* object cloning only). If there aren't any constructors, we do nothing.
*/
if (objc == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(objc)) {
*objectPtr = (Tcl_Object) oPtr;
return TCL_OK;
}
@@ -1854,7 +1854,7 @@ TclNewObjectInstanceCommon(
static int
FinalizeAlloc(
ClientData data[],
void *data[],
Tcl_Interp *interp,
int result)
{
@@ -1870,7 +1870,7 @@ FinalizeAlloc(
if (result != TCL_ERROR && Destructing(oPtr)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"object deleted in constructor", -1));
"object deleted in constructor", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OO", "STILLBORN", NULL);
result = TCL_ERROR;
}
@@ -1941,7 +1941,7 @@ Tcl_CopyObjectInstance(
if (IsRootClass(oPtr)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"may not clone the class of classes", -1));
"may not clone the class of classes", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OO", "CLONING_CLASS", NULL);
return NULL;
}
@@ -1951,8 +1951,8 @@ Tcl_CopyObjectInstance(
*/
o2Ptr = (Object *) Tcl_NewObjectInstance(interp,
(Tcl_Class) oPtr->selfCls, targetName, targetNamespaceName, -1,
NULL, -1);
(Tcl_Class) oPtr->selfCls, targetName, targetNamespaceName, TCL_INDEX_NONE,
NULL, TCL_INDEX_NONE);
if (o2Ptr == NULL) {
return NULL;
}
@@ -2037,7 +2037,7 @@ Tcl_CopyObjectInstance(
if (oPtr->metadataPtr != NULL) {
Tcl_ObjectMetadataType *metadataTypePtr;
ClientData value, duplicate;
void *value, *duplicate;
FOREACH_HASH(metadataTypePtr, value, oPtr->metadataPtr) {
if (metadataTypePtr->cloneProc == NULL) {
@@ -2182,7 +2182,7 @@ Tcl_CopyObjectInstance(
if (clsPtr->metadataPtr != NULL) {
Tcl_ObjectMetadataType *metadataTypePtr;
ClientData value, duplicate;
void *value, *duplicate;
FOREACH_HASH(metadataTypePtr, value, clsPtr->metadataPtr) {
if (metadataTypePtr->cloneProc == NULL) {
@@ -2254,7 +2254,7 @@ CloneObjectMethod(
TclNewInstanceMethod(interp, (Tcl_Object) oPtr, namePtr,
mPtr->flags & PUBLIC_METHOD, NULL, NULL);
} else if (mPtr->typePtr->cloneProc) {
ClientData newClientData;
void *newClientData;
if (mPtr->typePtr->cloneProc(interp, mPtr->clientData,
&newClientData) != TCL_OK) {
@@ -2283,7 +2283,7 @@ CloneClassMethod(
m2Ptr = (Method *) TclNewMethod(interp, (Tcl_Class) clsPtr,
namePtr, mPtr->flags & PUBLIC_METHOD, NULL, NULL);
} else if (mPtr->typePtr->cloneProc) {
ClientData newClientData;
void *newClientData;
if (mPtr->typePtr->cloneProc(interp, mPtr->clientData,
&newClientData) != TCL_OK) {
@@ -2329,7 +2329,7 @@ CloneClassMethod(
* ----------------------------------------------------------------------
*/
ClientData
void *
Tcl_ClassGetMetadata(
Tcl_Class clazz,
const Tcl_ObjectMetadataType *typePtr)
@@ -2366,7 +2366,7 @@ void
Tcl_ClassSetMetadata(
Tcl_Class clazz,
const Tcl_ObjectMetadataType *typePtr,
ClientData metadata)
void *metadata)
{
Class *clsPtr = (Class *) clazz;
Tcl_HashEntry *hPtr;
@@ -2409,7 +2409,7 @@ Tcl_ClassSetMetadata(
Tcl_SetHashValue(hPtr, metadata);
}
ClientData
void *
Tcl_ObjectGetMetadata(
Tcl_Object object,
const Tcl_ObjectMetadataType *typePtr)
@@ -2446,7 +2446,7 @@ void
Tcl_ObjectSetMetadata(
Tcl_Object object,
const Tcl_ObjectMetadataType *typePtr,
ClientData metadata)
void *metadata)
{
Object *oPtr = (Object *) object;
Tcl_HashEntry *hPtr;
@@ -2504,7 +2504,7 @@ Tcl_ObjectSetMetadata(
int
TclOOPublicObjectCmd(
ClientData clientData,
void *clientData,
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -2514,7 +2514,7 @@ TclOOPublicObjectCmd(
static int
PublicNRObjectCmd(
ClientData clientData,
void *clientData,
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -2525,7 +2525,7 @@ PublicNRObjectCmd(
int
TclOOPrivateObjectCmd(
ClientData clientData,
void *clientData,
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -2535,7 +2535,7 @@ TclOOPrivateObjectCmd(
static int
PrivateNRObjectCmd(
ClientData clientData,
void *clientData,
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -2586,7 +2586,7 @@ TclOOInvokeObject(
int
TclOOMyClassObjCmd(
ClientData clientData,
void *clientData,
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -2596,7 +2596,7 @@ TclOOMyClassObjCmd(
static int
MyClassNRObjCmd(
ClientData clientData,
void *clientData,
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -2627,7 +2627,7 @@ int
TclOOObjectCmdCore(
Object *oPtr, /* The object being invoked. */
Tcl_Interp *interp, /* The interpreter containing the object. */
size_t objc, /* How many arguments are being passed in. */
Tcl_Size objc, /* How many arguments are being passed in. */
Tcl_Obj *const *objv, /* The array of arguments. */
int flags, /* Whether this is an invocation through the
* public or the private command interface. */
@@ -2749,7 +2749,7 @@ TclOOObjectCmdCore(
}
if (contextPtr->index >= contextPtr->callPtr->numChain) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"no valid method implementation", -1));
"no valid method implementation", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "METHOD",
TclGetString(methodNamePtr), NULL);
TclOODeleteContext(contextPtr);
@@ -2768,7 +2768,7 @@ TclOOObjectCmdCore(
static int
FinalizeObjectCall(
ClientData data[],
void *data[],
TCL_UNUSED(Tcl_Interp *),
int result)
{
@@ -2929,7 +2929,7 @@ TclNRObjectContextInvokeNext(
static int
FinalizeNext(
ClientData data[],
void *data[],
TCL_UNUSED(Tcl_Interp *),
int result)
{
+11 -11
View File
@@ -68,8 +68,8 @@ declare 12 {
}
declare 13 {
Tcl_Object Tcl_NewObjectInstance(Tcl_Interp *interp, Tcl_Class cls,
const char *nameStr, const char *nsNameStr, size_t objc,
Tcl_Obj *const *objv, size_t skip)
const char *nameStr, const char *nsNameStr, Tcl_Size objc,
Tcl_Obj *const *objv, Tcl_Size skip)
}
declare 14 {
int Tcl_ObjectDeleted(Tcl_Object object)
@@ -84,7 +84,7 @@ declare 17 {
Tcl_Object Tcl_ObjectContextObject(Tcl_ObjectContext context)
}
declare 18 {
size_t Tcl_ObjectContextSkippedArgs(Tcl_ObjectContext context)
Tcl_Size Tcl_ObjectContextSkippedArgs(Tcl_ObjectContext context)
}
declare 19 {
void *Tcl_ClassGetMetadata(Tcl_Class clazz,
@@ -104,8 +104,8 @@ declare 22 {
}
declare 23 {
int Tcl_ObjectContextInvokeNext(Tcl_Interp *interp,
Tcl_ObjectContext context, size_t objc, Tcl_Obj *const *objv,
size_t skip)
Tcl_ObjectContext context, Tcl_Size objc, Tcl_Obj *const *objv,
Tcl_Size skip)
}
declare 24 {
Tcl_ObjectMapMethodNameProc *Tcl_ObjectGetMethodNameMapper(
@@ -184,7 +184,7 @@ declare 4 {
ProcedureMethod **pmPtrPtr)
}
declare 5 {
int TclOOObjectCmdCore(Object *oPtr, Tcl_Interp *interp, size_t objc,
int TclOOObjectCmdCore(Object *oPtr, Tcl_Interp *interp, Tcl_Size objc,
Tcl_Obj *const *objv, int publicOnly, Class *startCls)
}
declare 6 {
@@ -214,24 +214,24 @@ declare 10 {
}
declare 11 {
int TclOOInvokeObject(Tcl_Interp *interp, Tcl_Object object,
Tcl_Class startCls, int publicPrivate, size_t objc,
Tcl_Class startCls, int publicPrivate, Tcl_Size objc,
Tcl_Obj *const *objv)
}
declare 12 {
void TclOOObjectSetFilters(Object *oPtr, size_t numFilters,
void TclOOObjectSetFilters(Object *oPtr, Tcl_Size numFilters,
Tcl_Obj *const *filters)
}
declare 13 {
void TclOOClassSetFilters(Tcl_Interp *interp, Class *classPtr,
size_t numFilters, Tcl_Obj *const *filters)
Tcl_Size numFilters, Tcl_Obj *const *filters)
}
declare 14 {
void TclOOObjectSetMixins(Object *oPtr, size_t numMixins,
void TclOOObjectSetMixins(Object *oPtr, Tcl_Size numMixins,
Class *const *mixins)
}
declare 15 {
void TclOOClassSetMixins(Tcl_Interp *interp, Class *classPtr,
size_t numMixins, Class *const *mixins)
Tcl_Size numMixins, Class *const *mixins)
}
return
+44 -42
View File
@@ -52,7 +52,7 @@ AddConstructionFinalizer(
static int
FinalizeConstruction(
ClientData data[],
void *data[],
Tcl_Interp *interp,
int result)
{
@@ -86,11 +86,12 @@ TclOO_Class_Constructor(
Object *oPtr = (Object *) Tcl_ObjectContextObject(context);
Tcl_Obj **invoke, *nameObj;
if (objc-1 > (int)Tcl_ObjectContextSkippedArgs(context)) {
Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv,
size_t skip = Tcl_ObjectContextSkippedArgs(context);
if ((size_t)objc > skip + 1) {
Tcl_WrongNumArgs(interp, skip, objv,
"?definitionScript?");
return TCL_ERROR;
} else if (objc == (int)Tcl_ObjectContextSkippedArgs(context)) {
} else if ((size_t)objc == skip) {
return TCL_OK;
}
@@ -99,10 +100,10 @@ TclOO_Class_Constructor(
* here (and the class definition delegate doesn't run any constructors).
*/
nameObj = Tcl_NewStringObj(oPtr->namespacePtr->fullName, -1);
Tcl_AppendToObj(nameObj, ":: oo ::delegate", -1);
nameObj = Tcl_NewStringObj(oPtr->namespacePtr->fullName, TCL_INDEX_NONE);
Tcl_AppendToObj(nameObj, ":: oo ::delegate", TCL_INDEX_NONE);
Tcl_NewObjectInstance(interp, (Tcl_Class) oPtr->fPtr->classCls,
TclGetString(nameObj), NULL, -1, NULL, -1);
TclGetString(nameObj), NULL, TCL_INDEX_NONE, NULL, TCL_INDEX_NONE);
Tcl_DecrRefCount(nameObj);
/*
@@ -135,7 +136,7 @@ TclOO_Class_Constructor(
static int
DecrRefsPostClassConstructor(
ClientData data[],
void *data[],
Tcl_Interp *interp,
int result)
{
@@ -147,7 +148,7 @@ DecrRefsPostClassConstructor(
TclDecrRefCount(invoke[0]);
TclDecrRefCount(invoke[1]);
TclDecrRefCount(invoke[2]);
invoke[0] = Tcl_NewStringObj("::oo::MixinClassDelegates", -1);
invoke[0] = Tcl_NewStringObj("::oo::MixinClassDelegates", TCL_INDEX_NONE);
invoke[1] = TclOOObjectName(interp, oPtr);
Tcl_IncrRefCount(invoke[0]);
Tcl_IncrRefCount(invoke[1]);
@@ -204,7 +205,7 @@ TclOO_Class_Create(
* Check we have the right number of (sensible) arguments.
*/
if (objc - Tcl_ObjectContextSkippedArgs(context) < 1) {
if ((size_t)objc < 1 + Tcl_ObjectContextSkippedArgs(context)) {
Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv,
"objectName ?arg ...?");
return TCL_ERROR;
@@ -213,7 +214,7 @@ TclOO_Class_Create(
objv[Tcl_ObjectContextSkippedArgs(context)], &len);
if (len == 0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"object name must not be empty", -1));
"object name must not be empty", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OO", "EMPTY_NAME", NULL);
return TCL_ERROR;
}
@@ -269,7 +270,7 @@ TclOO_Class_CreateNs(
* Check we have the right number of (sensible) arguments.
*/
if (objc - Tcl_ObjectContextSkippedArgs(context) < 2) {
if ((size_t)objc + 1 < Tcl_ObjectContextSkippedArgs(context) + 3) {
Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv,
"objectName namespaceName ?arg ...?");
return TCL_ERROR;
@@ -278,7 +279,7 @@ TclOO_Class_CreateNs(
objv[Tcl_ObjectContextSkippedArgs(context)], &len);
if (len == 0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"object name must not be empty", -1));
"object name must not be empty", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OO", "EMPTY_NAME", NULL);
return TCL_ERROR;
}
@@ -286,7 +287,7 @@ TclOO_Class_CreateNs(
objv[Tcl_ObjectContextSkippedArgs(context)+1], &len);
if (len == 0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"namespace name must not be empty", -1));
"namespace name must not be empty", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OO", "EMPTY_NAME", NULL);
return TCL_ERROR;
}
@@ -393,7 +394,7 @@ TclOO_Object_Destroy(
static int
AfterNRDestructor(
ClientData data[],
void *data[],
Tcl_Interp *interp,
int result)
{
@@ -427,12 +428,12 @@ TclOO_Object_Eval(
{
CallContext *contextPtr = (CallContext *) context;
Tcl_Object object = Tcl_ObjectContextObject(context);
const int skip = Tcl_ObjectContextSkippedArgs(context);
size_t skip = Tcl_ObjectContextSkippedArgs(context);
CallFrame *framePtr, **framePtrPtr = &framePtr;
Tcl_Obj *scriptPtr;
CmdFrame *invoker;
if (objc-1 < skip) {
if ((size_t)objc < skip + 1) {
Tcl_WrongNumArgs(interp, skip, objv, "arg ?arg ...?");
return TCL_ERROR;
}
@@ -460,7 +461,7 @@ TclOO_Object_Eval(
* object when it decrements its refcount after eval'ing it.
*/
if (objc != skip+1) {
if ((size_t)objc != skip+1) {
scriptPtr = Tcl_ConcatObj(objc-skip, objv+skip);
invoker = NULL;
} else {
@@ -479,7 +480,7 @@ TclOO_Object_Eval(
static int
FinalizeEval(
ClientData data[],
void *data[],
Tcl_Interp *interp,
int result)
{
@@ -531,7 +532,8 @@ TclOO_Object_Unknown(
Class *callerCls = NULL;
Object *oPtr = contextPtr->oPtr;
const char **methodNames;
int numMethodNames, i, skip = Tcl_ObjectContextSkippedArgs(context);
int numMethodNames, i;
size_t skip = Tcl_ObjectContextSkippedArgs(context);
CallFrame *framePtr = ((Interp *) interp)->varFramePtr;
Tcl_Obj *errorMsg;
@@ -541,7 +543,7 @@ TclOO_Object_Unknown(
* name without an error).
*/
if (objc < skip+1) {
if ((size_t)objc < skip+1) {
Tcl_WrongNumArgs(interp, skip, objv, "method ?arg ...?");
return TCL_ERROR;
}
@@ -598,14 +600,14 @@ TclOO_Object_Unknown(
TclGetString(objv[skip]));
for (i=0 ; i<numMethodNames-1 ; i++) {
if (i) {
Tcl_AppendToObj(errorMsg, ", ", -1);
Tcl_AppendToObj(errorMsg, ", ", TCL_INDEX_NONE);
}
Tcl_AppendToObj(errorMsg, methodNames[i], -1);
Tcl_AppendToObj(errorMsg, methodNames[i], TCL_INDEX_NONE);
}
if (i) {
Tcl_AppendToObj(errorMsg, " or ", -1);
Tcl_AppendToObj(errorMsg, " or ", TCL_INDEX_NONE);
}
Tcl_AppendToObj(errorMsg, methodNames[i], -1);
Tcl_AppendToObj(errorMsg, methodNames[i], TCL_INDEX_NONE);
Tcl_Free((void *)methodNames);
Tcl_SetObjResult(interp, errorMsg);
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "METHOD",
@@ -635,7 +637,7 @@ TclOO_Object_LinkVar(
Interp *iPtr = (Interp *) interp;
Tcl_Object object = Tcl_ObjectContextObject(context);
Namespace *savedNsPtr;
int i;
size_t i;
if ((size_t)objc < Tcl_ObjectContextSkippedArgs(context)) {
Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv,
@@ -653,7 +655,7 @@ TclOO_Object_LinkVar(
return TCL_OK;
}
for (i=Tcl_ObjectContextSkippedArgs(context) ; i<objc ; i++) {
for (i = Tcl_ObjectContextSkippedArgs(context) ; i < (size_t)objc ; i++) {
Var *varPtr, *aryPtr;
const char *varName = TclGetString(objv[i]);
@@ -814,7 +816,7 @@ TclOO_Object_VarName(
}
}
varNamePtr = Tcl_NewStringObj(namespacePtr->fullName, -1);
varNamePtr = Tcl_NewStringObj(namespacePtr->fullName, TCL_INDEX_NONE);
Tcl_AppendToObj(varNamePtr, "::", 2);
Tcl_AppendObjToObj(varNamePtr, argPtr);
}
@@ -840,10 +842,10 @@ TclOO_Object_VarName(
* WARNING! This code pokes inside the implementation of hash tables!
*/
Tcl_AppendToObj(varNamePtr, "(", -1);
Tcl_AppendToObj(varNamePtr, "(", TCL_INDEX_NONE);
Tcl_AppendObjToObj(varNamePtr, ((VarInHash *)
varPtr)->entry.key.objPtr);
Tcl_AppendToObj(varNamePtr, ")", -1);
Tcl_AppendToObj(varNamePtr, ")", TCL_INDEX_NONE);
} else {
Tcl_GetVariableFullName(interp, (Tcl_Var) varPtr, varNamePtr);
}
@@ -986,7 +988,7 @@ TclOONextToObjCmd(
methodType = "method";
}
for (i=contextPtr->index ; i != TCL_INDEX_NONE ; i--) {
for (i=contextPtr->index ; !TCL_SIZE_ISNEG(i) ; i--) {
struct MInvoke *miPtr = contextPtr->callPtr->chain + i;
if (!miPtr->isFilter && miPtr->mPtr->declaringClassPtr == classPtr) {
@@ -1007,7 +1009,7 @@ TclOONextToObjCmd(
static int
NextRestoreFrame(
ClientData data[],
void *data[],
Tcl_Interp *interp,
int result)
{
@@ -1016,7 +1018,7 @@ NextRestoreFrame(
iPtr->varFramePtr = (CallFrame *)data[0];
if (contextPtr != NULL) {
contextPtr->index = PTR2INT(data[2]);
contextPtr->index = PTR2UINT(data[2]);
}
return result;
}
@@ -1090,14 +1092,14 @@ TclOOSelfObjCmd(
return TCL_OK;
case SELF_NS:
Tcl_SetObjResult(interp, Tcl_NewStringObj(
contextPtr->oPtr->namespacePtr->fullName,-1));
contextPtr->oPtr->namespacePtr->fullName, TCL_INDEX_NONE));
return TCL_OK;
case SELF_CLASS: {
Class *clsPtr = CurrentlyInvoked(contextPtr).mPtr->declaringClassPtr;
if (clsPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"method not defined by a class", -1));
"method not defined by a class", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OO", "UNMATCHED_CONTEXT", NULL);
return TCL_ERROR;
}
@@ -1118,7 +1120,7 @@ TclOOSelfObjCmd(
case SELF_FILTER:
if (!CurrentlyInvoked(contextPtr).isFilter) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"not inside a filtering context", -1));
"not inside a filtering context", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OO", "UNMATCHED_CONTEXT", NULL);
return TCL_ERROR;
} else {
@@ -1135,7 +1137,7 @@ TclOOSelfObjCmd(
}
result[0] = TclOOObjectName(interp, oPtr);
result[1] = Tcl_NewStringObj(type, -1);
result[1] = Tcl_NewStringObj(type, TCL_INDEX_NONE);
result[2] = miPtr->mPtr->namePtr;
Tcl_SetObjResult(interp, Tcl_NewListObj(3, result));
return TCL_OK;
@@ -1144,7 +1146,7 @@ TclOOSelfObjCmd(
if ((framePtr->callerVarPtr == NULL) ||
!(framePtr->callerVarPtr->isProcCallFrame & FRAME_IS_METHOD)){
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"caller is not an object", -1));
"caller is not an object", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OO", "CONTEXT_REQUIRED", NULL);
return TCL_ERROR;
} else {
@@ -1162,7 +1164,7 @@ TclOOSelfObjCmd(
*/
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"method without declarer!", -1));
"method without declarer!", TCL_INDEX_NONE));
return TCL_ERROR;
}
@@ -1194,7 +1196,7 @@ TclOOSelfObjCmd(
*/
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"method without declarer!", -1));
"method without declarer!", TCL_INDEX_NONE));
return TCL_ERROR;
}
@@ -1212,7 +1214,7 @@ TclOOSelfObjCmd(
case SELF_TARGET:
if (!CurrentlyInvoked(contextPtr).isFilter) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"not inside a filtering context", -1));
"not inside a filtering context", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OO", "UNMATCHED_CONTEXT", NULL);
return TCL_ERROR;
} else {
@@ -1239,7 +1241,7 @@ TclOOSelfObjCmd(
*/
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"method without declarer!", -1));
"method without declarer!", TCL_INDEX_NONE));
return TCL_ERROR;
}
result[0] = TclOOObjectName(interp, declarerPtr);
+1 -1
View File
@@ -1848,7 +1848,7 @@ TclOORenderCallChain(
? Tcl_GetObjectName(interp,
(Tcl_Object) miPtr->mPtr->declaringClassPtr->thisPtr)
: objectLiteral;
descObjs[3] = Tcl_NewStringObj(miPtr->mPtr->typePtr->name, -1);
descObjs[3] = Tcl_NewStringObj(miPtr->mPtr->typePtr->name, TCL_INDEX_NONE);
objv[i] = Tcl_NewListObj(4, descObjs);
}
+8 -8
View File
@@ -69,8 +69,8 @@ TCLAPI Tcl_Method Tcl_NewMethod(Tcl_Interp *interp, Tcl_Class cls,
/* 13 */
TCLAPI Tcl_Object Tcl_NewObjectInstance(Tcl_Interp *interp,
Tcl_Class cls, const char *nameStr,
const char *nsNameStr, size_t objc,
Tcl_Obj *const *objv, size_t skip);
const char *nsNameStr, Tcl_Size objc,
Tcl_Obj *const *objv, Tcl_Size skip);
/* 14 */
TCLAPI int Tcl_ObjectDeleted(Tcl_Object object);
/* 15 */
@@ -81,7 +81,7 @@ TCLAPI Tcl_Method Tcl_ObjectContextMethod(Tcl_ObjectContext context);
/* 17 */
TCLAPI Tcl_Object Tcl_ObjectContextObject(Tcl_ObjectContext context);
/* 18 */
TCLAPI size_t Tcl_ObjectContextSkippedArgs(
TCLAPI Tcl_Size Tcl_ObjectContextSkippedArgs(
Tcl_ObjectContext context);
/* 19 */
TCLAPI void * Tcl_ClassGetMetadata(Tcl_Class clazz,
@@ -99,8 +99,8 @@ TCLAPI void Tcl_ObjectSetMetadata(Tcl_Object object,
void *metadata);
/* 23 */
TCLAPI int Tcl_ObjectContextInvokeNext(Tcl_Interp *interp,
Tcl_ObjectContext context, size_t objc,
Tcl_Obj *const *objv, size_t skip);
Tcl_ObjectContext context, Tcl_Size objc,
Tcl_Obj *const *objv, Tcl_Size skip);
/* 24 */
TCLAPI Tcl_ObjectMapMethodNameProc * Tcl_ObjectGetMethodNameMapper(
Tcl_Object object);
@@ -159,17 +159,17 @@ typedef struct TclOOStubs {
Tcl_Obj * (*tcl_MethodName) (Tcl_Method method); /* 10 */
Tcl_Method (*tcl_NewInstanceMethod) (Tcl_Interp *interp, Tcl_Object object, Tcl_Obj *nameObj, int flags, const Tcl_MethodType *typePtr, void *clientData); /* 11 */
Tcl_Method (*tcl_NewMethod) (Tcl_Interp *interp, Tcl_Class cls, Tcl_Obj *nameObj, int flags, const Tcl_MethodType *typePtr, void *clientData); /* 12 */
Tcl_Object (*tcl_NewObjectInstance) (Tcl_Interp *interp, Tcl_Class cls, const char *nameStr, const char *nsNameStr, size_t objc, Tcl_Obj *const *objv, size_t skip); /* 13 */
Tcl_Object (*tcl_NewObjectInstance) (Tcl_Interp *interp, Tcl_Class cls, const char *nameStr, const char *nsNameStr, Tcl_Size objc, Tcl_Obj *const *objv, Tcl_Size skip); /* 13 */
int (*tcl_ObjectDeleted) (Tcl_Object object); /* 14 */
int (*tcl_ObjectContextIsFiltering) (Tcl_ObjectContext context); /* 15 */
Tcl_Method (*tcl_ObjectContextMethod) (Tcl_ObjectContext context); /* 16 */
Tcl_Object (*tcl_ObjectContextObject) (Tcl_ObjectContext context); /* 17 */
size_t (*tcl_ObjectContextSkippedArgs) (Tcl_ObjectContext context); /* 18 */
Tcl_Size (*tcl_ObjectContextSkippedArgs) (Tcl_ObjectContext context); /* 18 */
void * (*tcl_ClassGetMetadata) (Tcl_Class clazz, const Tcl_ObjectMetadataType *typePtr); /* 19 */
void (*tcl_ClassSetMetadata) (Tcl_Class clazz, const Tcl_ObjectMetadataType *typePtr, void *metadata); /* 20 */
void * (*tcl_ObjectGetMetadata) (Tcl_Object object, const Tcl_ObjectMetadataType *typePtr); /* 21 */
void (*tcl_ObjectSetMetadata) (Tcl_Object object, const Tcl_ObjectMetadataType *typePtr, void *metadata); /* 22 */
int (*tcl_ObjectContextInvokeNext) (Tcl_Interp *interp, Tcl_ObjectContext context, size_t objc, Tcl_Obj *const *objv, size_t skip); /* 23 */
int (*tcl_ObjectContextInvokeNext) (Tcl_Interp *interp, Tcl_ObjectContext context, Tcl_Size objc, Tcl_Obj *const *objv, Tcl_Size skip); /* 23 */
Tcl_ObjectMapMethodNameProc * (*tcl_ObjectGetMethodNameMapper) (Tcl_Object object); /* 24 */
void (*tcl_ObjectSetMethodNameMapper) (Tcl_Object object, Tcl_ObjectMapMethodNameProc *mapMethodNameProc); /* 25 */
void (*tcl_ClassSetConstructor) (Tcl_Interp *interp, Tcl_Class clazz, Tcl_Method method); /* 26 */
+56 -56
View File
@@ -78,49 +78,49 @@ static inline void RecomputeClassCacheFlag(Object *oPtr);
static int RenameDeleteMethod(Tcl_Interp *interp, Object *oPtr,
int useClass, Tcl_Obj *const fromPtr,
Tcl_Obj *const toPtr);
static int ClassFilterGet(ClientData clientData,
static int ClassFilterGet(void *clientData,
Tcl_Interp *interp, Tcl_ObjectContext context,
int objc, Tcl_Obj *const *objv);
static int ClassFilterSet(ClientData clientData,
static int ClassFilterSet(void *clientData,
Tcl_Interp *interp, Tcl_ObjectContext context,
int objc, Tcl_Obj *const *objv);
static int ClassMixinGet(ClientData clientData,
static int ClassMixinGet(void *clientData,
Tcl_Interp *interp, Tcl_ObjectContext context,
int objc, Tcl_Obj *const *objv);
static int ClassMixinSet(ClientData clientData,
static int ClassMixinSet(void *clientData,
Tcl_Interp *interp, Tcl_ObjectContext context,
int objc, Tcl_Obj *const *objv);
static int ClassSuperGet(ClientData clientData,
static int ClassSuperGet(void *clientData,
Tcl_Interp *interp, Tcl_ObjectContext context,
int objc, Tcl_Obj *const *objv);
static int ClassSuperSet(ClientData clientData,
static int ClassSuperSet(void *clientData,
Tcl_Interp *interp, Tcl_ObjectContext context,
int objc, Tcl_Obj *const *objv);
static int ClassVarsGet(ClientData clientData,
static int ClassVarsGet(void *clientData,
Tcl_Interp *interp, Tcl_ObjectContext context,
int objc, Tcl_Obj *const *objv);
static int ClassVarsSet(ClientData clientData,
static int ClassVarsSet(void *clientData,
Tcl_Interp *interp, Tcl_ObjectContext context,
int objc, Tcl_Obj *const *objv);
static int ObjFilterGet(ClientData clientData,
static int ObjFilterGet(void *clientData,
Tcl_Interp *interp, Tcl_ObjectContext context,
int objc, Tcl_Obj *const *objv);
static int ObjFilterSet(ClientData clientData,
static int ObjFilterSet(void *clientData,
Tcl_Interp *interp, Tcl_ObjectContext context,
int objc, Tcl_Obj *const *objv);
static int ObjMixinGet(ClientData clientData,
static int ObjMixinGet(void *clientData,
Tcl_Interp *interp, Tcl_ObjectContext context,
int objc, Tcl_Obj *const *objv);
static int ObjMixinSet(ClientData clientData,
static int ObjMixinSet(void *clientData,
Tcl_Interp *interp, Tcl_ObjectContext context,
int objc, Tcl_Obj *const *objv);
static int ObjVarsGet(ClientData clientData,
static int ObjVarsGet(void *clientData,
Tcl_Interp *interp, Tcl_ObjectContext context,
int objc, Tcl_Obj *const *objv);
static int ObjVarsSet(ClientData clientData,
static int ObjVarsSet(void *clientData,
Tcl_Interp *interp, Tcl_ObjectContext context,
int objc, Tcl_Obj *const *objv);
static int ResolveClass(ClientData clientData,
static int ResolveClass(void *clientData,
Tcl_Interp *interp, Tcl_ObjectContext context,
int objc, Tcl_Obj *const *objv);
@@ -633,7 +633,7 @@ RenameDeleteMethod(
if (hPtr == newHPtr) {
renameToSelf:
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"cannot rename method to itself", -1));
"cannot rename method to itself", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OO", "RENAME_TO_SELF", NULL);
return TCL_ERROR;
} else if (!isNew) {
@@ -709,7 +709,7 @@ TclOOUnknownDefinition(
if (objc < 2) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"bad call of unknown handler", -1));
"bad call of unknown handler", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OO", "BAD_UNKNOWN", NULL);
return TCL_ERROR;
}
@@ -743,7 +743,7 @@ TclOOUnknownDefinition(
TclStackAlloc(interp, sizeof(Tcl_Obj*) * (objc - 1));
int result;
newObjv[0] = Tcl_NewStringObj(matchedStr, -1);
newObjv[0] = Tcl_NewStringObj(matchedStr, TCL_INDEX_NONE);
Tcl_IncrRefCount(newObjv[0]);
if (objc > 2) {
memcpy(newObjv + 1, objv + 2, sizeof(Tcl_Obj *) * (objc - 2));
@@ -846,7 +846,7 @@ InitDefineContext(
if (namespacePtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"no definition namespace available", -1));
"no definition namespace available", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
return TCL_ERROR;
}
@@ -887,7 +887,7 @@ TclOOGetDefineCmdContext(
&& iPtr->varFramePtr->isProcCallFrame != PRIVATE_FRAME)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"this command may only be called from within the context of"
" an ::oo::define or ::oo::objdefine command", -1));
" an ::oo::define or ::oo::objdefine command", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
return NULL;
}
@@ -895,7 +895,7 @@ TclOOGetDefineCmdContext(
if (Tcl_ObjectDeleted(object)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"this command cannot be called when the object has been"
" deleted", -1));
" deleted", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
return NULL;
}
@@ -938,7 +938,7 @@ GetClassInOuterContext(
return NULL;
}
if (oPtr->classPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(errMsg, -1));
Tcl_SetObjResult(interp, Tcl_NewStringObj(errMsg, TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "CLASS",
TclGetString(className), NULL);
return NULL;
@@ -1344,7 +1344,7 @@ TclOODefineObjSelfObjCmd(
int
TclOODefinePrivateObjCmd(
ClientData clientData,
void *clientData,
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -1437,13 +1437,13 @@ TclOODefineClassObjCmd(
}
if (oPtr->flags & ROOT_OBJECT) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"may not modify the class of the root object class", -1));
"may not modify the class of the root object class", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
return TCL_ERROR;
}
if (oPtr->flags & ROOT_CLASS) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"may not modify the class of the class of classes", -1));
"may not modify the class of the class of classes", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
return TCL_ERROR;
}
@@ -1463,7 +1463,7 @@ TclOODefineClassObjCmd(
}
if (oPtr == clsPtr->thisPtr) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"may not change classes into an instance of themselves", -1));
"may not change classes into an instance of themselves", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
return TCL_ERROR;
}
@@ -1616,7 +1616,7 @@ TclOODefineDefnNsObjCmd(
}
if (!oPtr->classPtr) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"attempt to misuse API", -1));
"attempt to misuse API", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
return TCL_ERROR;
}
@@ -1647,7 +1647,7 @@ TclOODefineDefnNsObjCmd(
if (nsPtr == NULL) {
return TCL_ERROR;
}
nsNamePtr = Tcl_NewStringObj(nsPtr->fullName, -1);
nsNamePtr = Tcl_NewStringObj(nsPtr->fullName, TCL_INDEX_NONE);
Tcl_IncrRefCount(nsNamePtr);
}
@@ -1680,7 +1680,7 @@ TclOODefineDefnNsObjCmd(
int
TclOODefineDeleteMethodObjCmd(
ClientData clientData,
void *clientData,
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -1700,7 +1700,7 @@ TclOODefineDeleteMethodObjCmd(
}
if (!isInstanceDeleteMethod && !oPtr->classPtr) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"attempt to misuse API", -1));
"attempt to misuse API", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
return TCL_ERROR;
}
@@ -1802,7 +1802,7 @@ TclOODefineDestructorObjCmd(
int
TclOODefineExportObjCmd(
ClientData clientData,
void *clientData,
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -1826,7 +1826,7 @@ TclOODefineExportObjCmd(
clsPtr = oPtr->classPtr;
if (!isInstanceExport && !clsPtr) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"attempt to misuse API", -1));
"attempt to misuse API", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
return TCL_ERROR;
}
@@ -1898,7 +1898,7 @@ TclOODefineExportObjCmd(
int
TclOODefineForwardObjCmd(
ClientData clientData,
void *clientData,
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -1920,7 +1920,7 @@ TclOODefineForwardObjCmd(
}
if (!isInstanceForward && !oPtr->classPtr) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"attempt to misuse API", -1));
"attempt to misuse API", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
return TCL_ERROR;
}
@@ -1962,7 +1962,7 @@ TclOODefineForwardObjCmd(
int
TclOODefineMethodObjCmd(
ClientData clientData,
void *clientData,
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -1998,7 +1998,7 @@ TclOODefineMethodObjCmd(
}
if (!isInstanceMethod && !oPtr->classPtr) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"attempt to misuse API", -1));
"attempt to misuse API", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
return TCL_ERROR;
}
@@ -2058,7 +2058,7 @@ TclOODefineMethodObjCmd(
int
TclOODefineRenameMethodObjCmd(
ClientData clientData,
void *clientData,
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -2077,7 +2077,7 @@ TclOODefineRenameMethodObjCmd(
}
if (!isInstanceRenameMethod && !oPtr->classPtr) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"attempt to misuse API", -1));
"attempt to misuse API", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
return TCL_ERROR;
}
@@ -2115,7 +2115,7 @@ TclOODefineRenameMethodObjCmd(
int
TclOODefineUnexportObjCmd(
ClientData clientData,
void *clientData,
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -2139,7 +2139,7 @@ TclOODefineUnexportObjCmd(
clsPtr = oPtr->classPtr;
if (!isInstanceUnexport && !clsPtr) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"attempt to misuse API", -1));
"attempt to misuse API", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
return TCL_ERROR;
}
@@ -2268,13 +2268,13 @@ TclOODefineSlots(
Foundation *fPtr)
{
const struct DeclaredSlot *slotInfoPtr;
Tcl_Obj *getName = Tcl_NewStringObj("Get", -1);
Tcl_Obj *setName = Tcl_NewStringObj("Set", -1);
Tcl_Obj *resolveName = Tcl_NewStringObj("Resolve", -1);
Tcl_Obj *getName = Tcl_NewStringObj("Get", TCL_INDEX_NONE);
Tcl_Obj *setName = Tcl_NewStringObj("Set", TCL_INDEX_NONE);
Tcl_Obj *resolveName = Tcl_NewStringObj("Resolve", TCL_INDEX_NONE);
Class *slotCls;
slotCls = ((Object *) Tcl_NewObjectInstance(fPtr->interp, (Tcl_Class)
fPtr->classCls, "::oo::Slot", NULL, -1, NULL, 0))->classPtr;
fPtr->classCls, "::oo::Slot", NULL, TCL_INDEX_NONE, NULL, 0))->classPtr;
if (slotCls == NULL) {
return TCL_ERROR;
}
@@ -2283,7 +2283,7 @@ TclOODefineSlots(
Tcl_IncrRefCount(resolveName);
for (slotInfoPtr = slots ; slotInfoPtr->name ; slotInfoPtr++) {
Tcl_Object slotObject = Tcl_NewObjectInstance(fPtr->interp,
(Tcl_Class) slotCls, slotInfoPtr->name, NULL, -1, NULL, 0);
(Tcl_Class) slotCls, slotInfoPtr->name, NULL, TCL_INDEX_NONE, NULL, 0);
if (slotObject == NULL) {
continue;
@@ -2335,7 +2335,7 @@ ClassFilterGet(
return TCL_ERROR;
} else if (!oPtr->classPtr) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"attempt to misuse API", -1));
"attempt to misuse API", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
return TCL_ERROR;
}
@@ -2371,7 +2371,7 @@ ClassFilterSet(
return TCL_ERROR;
} else if (!oPtr->classPtr) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"attempt to misuse API", -1));
"attempt to misuse API", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
return TCL_ERROR;
} else if (TclListObjGetElementsM(interp, objv[0], &filterc,
@@ -2416,7 +2416,7 @@ ClassMixinGet(
return TCL_ERROR;
} else if (!oPtr->classPtr) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"attempt to misuse API", -1));
"attempt to misuse API", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
return TCL_ERROR;
}
@@ -2455,7 +2455,7 @@ ClassMixinSet(
return TCL_ERROR;
} else if (!oPtr->classPtr) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"attempt to misuse API", -1));
"attempt to misuse API", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
return TCL_ERROR;
} else if (TclListObjGetElementsM(interp, objv[0], &mixinc,
@@ -2474,7 +2474,7 @@ ClassMixinSet(
}
if (TclOOIsReachable(oPtr->classPtr, mixins[i])) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"may not mix a class into itself", -1));
"may not mix a class into itself", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OO", "SELF_MIXIN", NULL);
goto freeAndError;
}
@@ -2522,7 +2522,7 @@ ClassSuperGet(
return TCL_ERROR;
} else if (!oPtr->classPtr) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"attempt to misuse API", -1));
"attempt to misuse API", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
return TCL_ERROR;
}
@@ -2561,12 +2561,12 @@ ClassSuperSet(
return TCL_ERROR;
} else if (!oPtr->classPtr) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"attempt to misuse API", -1));
"attempt to misuse API", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
return TCL_ERROR;
} else if (oPtr == oPtr->fPtr->objectCls->thisPtr) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"may not modify the superclass of the root object", -1));
"may not modify the superclass of the root object", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
return TCL_ERROR;
} else if (TclListObjGetElementsM(interp, objv[0], &superc,
@@ -2614,7 +2614,7 @@ ClassSuperSet(
}
if (TclOOIsReachable(oPtr->classPtr, superclasses[i])) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"attempt to form circular dependency graph", -1));
"attempt to form circular dependency graph", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OO", "CIRCULARITY", NULL);
failedAfterAlloc:
for (; i-- > 0 ;) {
@@ -2689,7 +2689,7 @@ ClassVarsGet(
return TCL_ERROR;
} else if (!oPtr->classPtr) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"attempt to misuse API", -1));
"attempt to misuse API", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
return TCL_ERROR;
}
@@ -2736,7 +2736,7 @@ ClassVarsSet(
return TCL_ERROR;
} else if (!oPtr->classPtr) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"attempt to misuse API", -1));
"attempt to misuse API", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
return TCL_ERROR;
} else if (TclListObjGetElementsM(interp, objv[0], &varc,
+18 -18
View File
@@ -120,10 +120,10 @@ TclOOInitInfo(
infoCmd = Tcl_FindCommand(interp, "info", NULL, TCL_GLOBAL_ONLY);
if (infoCmd) {
Tcl_GetEnsembleMappingDict(NULL, infoCmd, &mapDict);
Tcl_DictObjPut(NULL, mapDict, Tcl_NewStringObj("object", -1),
Tcl_NewStringObj("::oo::InfoObject", -1));
Tcl_DictObjPut(NULL, mapDict, Tcl_NewStringObj("class", -1),
Tcl_NewStringObj("::oo::InfoClass", -1));
Tcl_DictObjPut(NULL, mapDict, Tcl_NewStringObj("object", TCL_INDEX_NONE),
Tcl_NewStringObj("::oo::InfoObject", TCL_INDEX_NONE));
Tcl_DictObjPut(NULL, mapDict, Tcl_NewStringObj("class", TCL_INDEX_NONE),
Tcl_NewStringObj("::oo::InfoClass", TCL_INDEX_NONE));
Tcl_SetEnsembleMappingDict(interp, infoCmd, mapDict);
}
}
@@ -264,7 +264,7 @@ InfoObjectDefnCmd(
procPtr = TclOOGetProcFromMethod((Method *)Tcl_GetHashValue(hPtr));
if (procPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"definition not available for this kind of method", -1));
"definition not available for this kind of method", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "METHOD",
TclGetString(objv[2]), NULL);
return TCL_ERROR;
@@ -278,7 +278,7 @@ InfoObjectDefnCmd(
TclNewObj(argObj);
Tcl_ListObjAppendElement(NULL, argObj,
Tcl_NewStringObj(localPtr->name, -1));
Tcl_NewStringObj(localPtr->name, TCL_INDEX_NONE));
if (localPtr->defValuePtr != NULL) {
Tcl_ListObjAppendElement(NULL, argObj, localPtr->defValuePtr);
}
@@ -610,7 +610,7 @@ InfoObjectMethodsCmd(
for (i=0 ; i<numNames ; i++) {
Tcl_ListObjAppendElement(NULL, resultObj,
Tcl_NewStringObj(names[i], -1));
Tcl_NewStringObj(names[i], TCL_INDEX_NONE));
}
if (numNames > 0) {
Tcl_Free((void *)names);
@@ -679,7 +679,7 @@ InfoObjectMethodTypeCmd(
goto unknownMethod;
}
Tcl_SetObjResult(interp, Tcl_NewStringObj(mPtr->typePtr->name, -1));
Tcl_SetObjResult(interp, Tcl_NewStringObj(mPtr->typePtr->name, TCL_INDEX_NONE));
return TCL_OK;
}
@@ -787,7 +787,7 @@ InfoObjectNsCmd(
}
Tcl_SetObjResult(interp,
Tcl_NewStringObj(oPtr->namespacePtr->fullName, -1));
Tcl_NewStringObj(oPtr->namespacePtr->fullName, TCL_INDEX_NONE));
return TCL_OK;
}
@@ -943,7 +943,7 @@ InfoClassConstrCmd(
procPtr = TclOOGetProcFromMethod(clsPtr->constructorPtr);
if (procPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"definition not available for this kind of method", -1));
"definition not available for this kind of method", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OO", "METHOD_TYPE", NULL);
return TCL_ERROR;
}
@@ -956,7 +956,7 @@ InfoClassConstrCmd(
TclNewObj(argObj);
Tcl_ListObjAppendElement(NULL, argObj,
Tcl_NewStringObj(localPtr->name, -1));
Tcl_NewStringObj(localPtr->name, TCL_INDEX_NONE));
if (localPtr->defValuePtr != NULL) {
Tcl_ListObjAppendElement(NULL, argObj, localPtr->defValuePtr);
}
@@ -1010,7 +1010,7 @@ InfoClassDefnCmd(
procPtr = TclOOGetProcFromMethod((Method *)Tcl_GetHashValue(hPtr));
if (procPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"definition not available for this kind of method", -1));
"definition not available for this kind of method", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "METHOD",
TclGetString(objv[2]), NULL);
return TCL_ERROR;
@@ -1024,7 +1024,7 @@ InfoClassDefnCmd(
TclNewObj(argObj);
Tcl_ListObjAppendElement(NULL, argObj,
Tcl_NewStringObj(localPtr->name, -1));
Tcl_NewStringObj(localPtr->name, TCL_INDEX_NONE));
if (localPtr->defValuePtr != NULL) {
Tcl_ListObjAppendElement(NULL, argObj, localPtr->defValuePtr);
}
@@ -1121,7 +1121,7 @@ InfoClassDestrCmd(
procPtr = TclOOGetProcFromMethod(clsPtr->destructorPtr);
if (procPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"definition not available for this kind of method", -1));
"definition not available for this kind of method", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OO", "METHOD_TYPE", NULL);
return TCL_ERROR;
}
@@ -1365,7 +1365,7 @@ InfoClassMethodsCmd(
for (i=0 ; i<numNames ; i++) {
Tcl_ListObjAppendElement(NULL, resultObj,
Tcl_NewStringObj(names[i], -1));
Tcl_NewStringObj(names[i], TCL_INDEX_NONE));
}
if (numNames > 0) {
Tcl_Free((void *)names);
@@ -1431,7 +1431,7 @@ InfoClassMethodTypeCmd(
goto unknownMethod;
}
Tcl_SetObjResult(interp, Tcl_NewStringObj(mPtr->typePtr->name, -1));
Tcl_SetObjResult(interp, Tcl_NewStringObj(mPtr->typePtr->name, TCL_INDEX_NONE));
return TCL_OK;
}
@@ -1663,7 +1663,7 @@ InfoObjectCallCmd(
NULL);
if (contextPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"cannot construct any call chain", -1));
"cannot construct any call chain", TCL_INDEX_NONE));
return TCL_ERROR;
}
Tcl_SetObjResult(interp,
@@ -1708,7 +1708,7 @@ InfoClassCallCmd(
callPtr = TclOOGetStereotypeCallChain(clsPtr, objv[2], PUBLIC_METHOD);
if (callPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"cannot construct any call chain", -1));
"cannot construct any call chain", TCL_INDEX_NONE));
return TCL_ERROR;
}
Tcl_SetObjResult(interp, TclOORenderCallChain(interp, callPtr));
+18 -18
View File
@@ -46,7 +46,7 @@ typedef struct Method {
/* The type of method. If NULL, this is a
* special flag record which is just used for
* the setting of the flags field. */
size_t refCount;
Tcl_Size refCount;
void *clientData; /* Type-specific data. */
Tcl_Obj *namePtr; /* Name of the method. */
struct Object *declaringObjectPtr;
@@ -83,7 +83,7 @@ typedef struct ProcedureMethod {
* includes the argument definition and the
* body bytecodes. */
int flags; /* Flags to control features. */
size_t refCount;
Tcl_Size refCount;
void *clientData;
TclOO_PmCDDeleteProc *deleteClientdataProc;
TclOO_PmCDCloneProc *cloneClientdataProc;
@@ -149,9 +149,9 @@ typedef struct {
*/
#define LIST_STATIC(listType_t) \
struct { size_t num; listType_t *list; }
struct { Tcl_Size num; listType_t *list; }
#define LIST_DYNAMIC(listType_t) \
struct { size_t num, size; listType_t *list; }
struct { Tcl_Size num, size; listType_t *list; }
/*
* These types are needed in function arguments.
@@ -184,14 +184,14 @@ typedef struct Object {
struct Class *classPtr; /* This is non-NULL for all classes, and NULL
* for everything else. It points to the class
* structure. */
size_t refCount; /* Number of strong references to this object.
Tcl_Size refCount; /* Number of strong references to this object.
* Note that there may be many more weak
* references; this mechanism exists to
* avoid Tcl_Preserve. */
int flags;
size_t creationEpoch; /* Unique value to make comparisons of objects
Tcl_Size creationEpoch; /* Unique value to make comparisons of objects
* easier. */
size_t epoch; /* Per-object epoch, incremented when the way
Tcl_Size epoch; /* Per-object epoch, incremented when the way
* an object should resolve call chains is
* changed. */
Tcl_HashTable *metadataPtr; /* Mapping from pointers to metadata type to
@@ -329,7 +329,7 @@ typedef struct Class {
*/
typedef struct ThreadLocalData {
size_t nsCount; /* Epoch counter is used for keeping
Tcl_Size nsCount; /* Epoch counter is used for keeping
* the values used in Tcl_Obj internal
* representations sane. Must be thread-local
* because Tcl_Objs can cross interpreter
@@ -353,7 +353,7 @@ typedef struct Foundation {
Tcl_Namespace *helpersNs; /* Namespace containing the commands that are
* only valid when executing inside a
* procedural method. */
size_t epoch; /* Used to invalidate method chains when the
Tcl_Size epoch; /* Used to invalidate method chains when the
* class structure changes. */
ThreadLocalData *tsdPtr; /* Counter so we can allocate a unique
* namespace to each object. */
@@ -387,16 +387,16 @@ struct MInvoke {
};
typedef struct CallChain {
size_t objectCreationEpoch; /* The object's creation epoch. Note that the
Tcl_Size objectCreationEpoch; /* The object's creation epoch. Note that the
* object reference is not stored in the call
* chain; it is in the call context. */
size_t objectEpoch; /* Local (object structure) epoch counter
Tcl_Size objectEpoch; /* Local (object structure) epoch counter
* snapshot. */
size_t epoch; /* Global (class structure) epoch counter
Tcl_Size epoch; /* Global (class structure) epoch counter
* snapshot. */
int flags; /* Assorted flags, see below. */
size_t refCount; /* Reference count. */
size_t numChain; /* Size of the call chain. */
Tcl_Size refCount; /* Reference count. */
Tcl_Size numChain; /* Size of the call chain. */
struct MInvoke *chain; /* Array of call chain entries. May point to
* staticChain if the number of entries is
* small. */
@@ -405,9 +405,9 @@ typedef struct CallChain {
typedef struct CallContext {
Object *oPtr; /* The object associated with this call. */
size_t index; /* Index into the call chain of the currently
Tcl_Size index; /* Index into the call chain of the currently
* executing method implementation. */
size_t skip; /* Current number of arguments to skip; can
Tcl_Size skip; /* Current number of arguments to skip; can
* vary depending on whether it is a direct
* method call or a continuation via the
* [next] command. */
@@ -578,7 +578,7 @@ MODULE_SCOPE void TclOOSetupVariableResolver(Tcl_Namespace *nsPtr);
/*
* A convenience macro for iterating through the lists used in the internal
* memory management of objects.
* REQUIRES DECLARATION: size_t i;
* REQUIRES DECLARATION: Tcl_Size i;
*/
#define FOREACH(var,ary) \
@@ -590,7 +590,7 @@ MODULE_SCOPE void TclOOSetupVariableResolver(Tcl_Namespace *nsPtr);
* A variation where the array is an array of structs. There's no issue with
* possible NULLs; every element of the array will be iterated over and the
* varable set to a pointer to each of those elements in turn.
* REQUIRES DECLARATION: size_t i;
* REQUIRES DECLARATION: Tcl_Size i;
*/
#define FOREACH_STRUCT(var,ary) \
+13 -13
View File
@@ -42,7 +42,7 @@ TCLAPI Method * TclOONewProcMethod(Tcl_Interp *interp, Class *clsPtr,
ProcedureMethod **pmPtrPtr);
/* 5 */
TCLAPI int TclOOObjectCmdCore(Object *oPtr, Tcl_Interp *interp,
size_t objc, Tcl_Obj *const *objv,
Tcl_Size objc, Tcl_Obj *const *objv,
int publicOnly, Class *startCls);
/* 6 */
TCLAPI int TclOOIsReachable(Class *targetPtr, Class *startPtr);
@@ -75,21 +75,21 @@ TCLAPI Tcl_Method TclOONewProcMethodEx(Tcl_Interp *interp,
/* 11 */
TCLAPI int TclOOInvokeObject(Tcl_Interp *interp,
Tcl_Object object, Tcl_Class startCls,
int publicPrivate, size_t objc,
int publicPrivate, Tcl_Size objc,
Tcl_Obj *const *objv);
/* 12 */
TCLAPI void TclOOObjectSetFilters(Object *oPtr,
size_t numFilters, Tcl_Obj *const *filters);
Tcl_Size numFilters, Tcl_Obj *const *filters);
/* 13 */
TCLAPI void TclOOClassSetFilters(Tcl_Interp *interp,
Class *classPtr, size_t numFilters,
Class *classPtr, Tcl_Size numFilters,
Tcl_Obj *const *filters);
/* 14 */
TCLAPI void TclOOObjectSetMixins(Object *oPtr, size_t numMixins,
Class *const *mixins);
TCLAPI void TclOOObjectSetMixins(Object *oPtr,
Tcl_Size numMixins, Class *const *mixins);
/* 15 */
TCLAPI void TclOOClassSetMixins(Tcl_Interp *interp,
Class *classPtr, size_t numMixins,
Class *classPtr, Tcl_Size numMixins,
Class *const *mixins);
typedef struct TclOOIntStubs {
@@ -101,17 +101,17 @@ typedef struct TclOOIntStubs {
Tcl_Method (*tclOOMakeProcMethod) (Tcl_Interp *interp, Class *clsPtr, int flags, Tcl_Obj *nameObj, const char *namePtr, Tcl_Obj *argsObj, Tcl_Obj *bodyObj, const Tcl_MethodType *typePtr, void *clientData, Proc **procPtrPtr); /* 2 */
Method * (*tclOONewProcInstanceMethod) (Tcl_Interp *interp, Object *oPtr, int flags, Tcl_Obj *nameObj, Tcl_Obj *argsObj, Tcl_Obj *bodyObj, ProcedureMethod **pmPtrPtr); /* 3 */
Method * (*tclOONewProcMethod) (Tcl_Interp *interp, Class *clsPtr, int flags, Tcl_Obj *nameObj, Tcl_Obj *argsObj, Tcl_Obj *bodyObj, ProcedureMethod **pmPtrPtr); /* 4 */
int (*tclOOObjectCmdCore) (Object *oPtr, Tcl_Interp *interp, size_t objc, Tcl_Obj *const *objv, int publicOnly, Class *startCls); /* 5 */
int (*tclOOObjectCmdCore) (Object *oPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const *objv, int publicOnly, Class *startCls); /* 5 */
int (*tclOOIsReachable) (Class *targetPtr, Class *startPtr); /* 6 */
Method * (*tclOONewForwardMethod) (Tcl_Interp *interp, Class *clsPtr, int isPublic, Tcl_Obj *nameObj, Tcl_Obj *prefixObj); /* 7 */
Method * (*tclOONewForwardInstanceMethod) (Tcl_Interp *interp, Object *oPtr, int isPublic, Tcl_Obj *nameObj, Tcl_Obj *prefixObj); /* 8 */
Tcl_Method (*tclOONewProcInstanceMethodEx) (Tcl_Interp *interp, Tcl_Object oPtr, TclOO_PreCallProc *preCallPtr, TclOO_PostCallProc *postCallPtr, ProcErrorProc *errProc, void *clientData, Tcl_Obj *nameObj, Tcl_Obj *argsObj, Tcl_Obj *bodyObj, int flags, void **internalTokenPtr); /* 9 */
Tcl_Method (*tclOONewProcMethodEx) (Tcl_Interp *interp, Tcl_Class clsPtr, TclOO_PreCallProc *preCallPtr, TclOO_PostCallProc *postCallPtr, ProcErrorProc *errProc, void *clientData, Tcl_Obj *nameObj, Tcl_Obj *argsObj, Tcl_Obj *bodyObj, int flags, void **internalTokenPtr); /* 10 */
int (*tclOOInvokeObject) (Tcl_Interp *interp, Tcl_Object object, Tcl_Class startCls, int publicPrivate, size_t objc, Tcl_Obj *const *objv); /* 11 */
void (*tclOOObjectSetFilters) (Object *oPtr, size_t numFilters, Tcl_Obj *const *filters); /* 12 */
void (*tclOOClassSetFilters) (Tcl_Interp *interp, Class *classPtr, size_t numFilters, Tcl_Obj *const *filters); /* 13 */
void (*tclOOObjectSetMixins) (Object *oPtr, size_t numMixins, Class *const *mixins); /* 14 */
void (*tclOOClassSetMixins) (Tcl_Interp *interp, Class *classPtr, size_t numMixins, Class *const *mixins); /* 15 */
int (*tclOOInvokeObject) (Tcl_Interp *interp, Tcl_Object object, Tcl_Class startCls, int publicPrivate, Tcl_Size objc, Tcl_Obj *const *objv); /* 11 */
void (*tclOOObjectSetFilters) (Object *oPtr, Tcl_Size numFilters, Tcl_Obj *const *filters); /* 12 */
void (*tclOOClassSetFilters) (Tcl_Interp *interp, Class *classPtr, Tcl_Size numFilters, Tcl_Obj *const *filters); /* 13 */
void (*tclOOObjectSetMixins) (Object *oPtr, Tcl_Size numMixins, Class *const *mixins); /* 14 */
void (*tclOOClassSetMixins) (Tcl_Interp *interp, Class *classPtr, Tcl_Size numMixins, Class *const *mixins); /* 15 */
} TclOOIntStubs;
extern const TclOOIntStubs *tclOOIntStubsPtr;
+7 -7
View File
@@ -387,7 +387,7 @@ TclOONewBasicMethod(
/* Name of the method, whether it is public,
* and the function to implement it. */
{
Tcl_Obj *namePtr = Tcl_NewStringObj(dcm->name, -1);
Tcl_Obj *namePtr = Tcl_NewStringObj(dcm->name, TCL_INDEX_NONE);
Tcl_IncrRefCount(namePtr);
TclNewMethod(interp, (Tcl_Class) clsPtr, namePtr,
@@ -498,7 +498,7 @@ TclOONewProcMethod(
method = TclOOMakeProcMethod(interp, clsPtr, flags, nameObj, procName,
argsObj, bodyObj, &procMethodType, pmPtr, &pmPtr->procPtr);
if (argsLen == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(argsLen)) {
Tcl_DecrRefCount(argsObj);
}
if (method == NULL) {
@@ -1188,7 +1188,7 @@ static int
ProcedureMethodCompiledVarResolver(
TCL_UNUSED(Tcl_Interp *),
const char *varName,
size_t length,
Tcl_Size length,
TCL_UNUSED(Tcl_Namespace *),
Tcl_ResolvedVarInfo **rPtrPtr)
{
@@ -1410,7 +1410,7 @@ CloneProcedureMethod(
TclNewObj(argObj);
Tcl_ListObjAppendElement(NULL, argObj,
Tcl_NewStringObj(localPtr->name, -1));
Tcl_NewStringObj(localPtr->name, TCL_INDEX_NONE));
if (localPtr->defValuePtr != NULL) {
Tcl_ListObjAppendElement(NULL, argObj, localPtr->defValuePtr);
}
@@ -1481,7 +1481,7 @@ TclOONewForwardInstanceMethod(
}
if (prefixLen < 1) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"method forward prefix must be non-empty", -1));
"method forward prefix must be non-empty", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OO", "BAD_FORWARD", NULL);
return NULL;
}
@@ -1520,7 +1520,7 @@ TclOONewForwardMethod(
}
if (prefixLen < 1) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"method forward prefix must be non-empty", -1));
"method forward prefix must be non-empty", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OO", "BAD_FORWARD", NULL);
return NULL;
}
@@ -1707,7 +1707,7 @@ InitEnsembleRewrite(
int *lengthPtr) /* Where to write the resulting length of the
* array of rewritten arguments. */
{
unsigned len = rewriteLength + objc - toRewrite;
size_t len = rewriteLength + objc - toRewrite;
Tcl_Obj **argObjs = (Tcl_Obj **)TclStackAlloc(interp, sizeof(Tcl_Obj *) * len);
memcpy(argObjs, rewriteObjs, rewriteLength * sizeof(Tcl_Obj *));
+171 -67
View File
@@ -225,37 +225,45 @@ static int SetCmdNameFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr);
* implementations.
*/
const Tcl_ObjType tclBooleanType = {
"boolean", /* name */
const TclObjTypeWithAbstractList tclBooleanType= {
{"boolean", /* name */
NULL, /* freeIntRepProc */
NULL, /* dupIntRepProc */
NULL, /* updateStringProc */
TclSetBooleanFromAny, /* setFromAnyProc */
TCL_OBJTYPE_V0
TCL_OBJTYPE_V0_1(
TclLengthOne
)}
};
const Tcl_ObjType tclDoubleType = {
"double", /* name */
const TclObjTypeWithAbstractList tclDoubleType= {
{"double", /* name */
NULL, /* freeIntRepProc */
NULL, /* dupIntRepProc */
UpdateStringOfDouble, /* updateStringProc */
SetDoubleFromAny, /* setFromAnyProc */
TCL_OBJTYPE_V0
TCL_OBJTYPE_V0_1(
TclLengthOne
)}
};
const Tcl_ObjType tclIntType = {
"int", /* name */
const TclObjTypeWithAbstractList tclIntType = {
{"int", /* name */
NULL, /* freeIntRepProc */
NULL, /* dupIntRepProc */
UpdateStringOfInt, /* updateStringProc */
SetIntFromAny, /* setFromAnyProc */
TCL_OBJTYPE_V0
TCL_OBJTYPE_V0_1(
TclLengthOne
)}
};
const Tcl_ObjType tclBignumType = {
"bignum", /* name */
const TclObjTypeWithAbstractList tclBignumType = {
{"bignum", /* name */
FreeBignum, /* freeIntRepProc */
DupBignum, /* dupIntRepProc */
UpdateStringOfBignum, /* updateStringProc */
NULL, /* setFromAnyProc */
TCL_OBJTYPE_V0
TCL_OBJTYPE_V0_1(
TclLengthOne
)}
};
/*
@@ -338,6 +346,18 @@ typedef struct ResolvedCmdName {
* structure can be freed when refCount
* becomes zero. */
} ResolvedCmdName;
#ifdef TCL_MEM_DEBUG
/*
* Filler matches the value used for filling freed memory in tclCkalloc.
* On 32-bit systems, the ref counts do not cross 0x7fffffff. On 64-bit
* implementations, ref counts will never reach this value (unless explicitly
* incremented without actual references!)
*/
#define FREEDREFCOUNTFILLER \
(sizeof(objPtr->refCount) == 4 ? 0xe8e8e8e8 : 0xe8e8e8e8e8e8e8e8)
#endif
/*
*-------------------------------------------------------------------------
@@ -365,9 +385,9 @@ TclInitObjSubsystem(void)
Tcl_InitHashTable(&typeTable, TCL_STRING_KEYS);
Tcl_MutexUnlock(&tableMutex);
Tcl_RegisterObjType(&tclDoubleType);
Tcl_RegisterObjType(&tclDoubleType.objType);
Tcl_RegisterObjType(&tclStringType);
Tcl_RegisterObjType(&tclListType);
Tcl_RegisterObjType(&tclListType.objType);
Tcl_RegisterObjType(&tclDictType);
Tcl_RegisterObjType(&tclByteCodeType);
Tcl_RegisterObjType(&tclCmdNameType);
@@ -859,7 +879,7 @@ Tcl_AppendAllObjTypes(
for (hPtr = Tcl_FirstHashEntry(&typeTable, &search);
hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
Tcl_ListObjAppendElement(NULL, objPtr,
Tcl_NewStringObj((char *)Tcl_GetHashKey(&typeTable, hPtr), -1));
Tcl_NewStringObj((char *)Tcl_GetHashKey(&typeTable, hPtr), TCL_INDEX_NONE));
}
Tcl_MutexUnlock(&tableMutex);
return TCL_OK;
@@ -1008,7 +1028,7 @@ TclDbDumpActiveObjects(
*
* Called via the TclNewObj or TclDbNewObj macros when TCL_MEM_DEBUG is
* enabled. This function will initialize the members of a Tcl_Obj
* struct. Initilization would be done inline via the TclNewObj macro
* struct. Initialization would be done inline via the TclNewObj macro
* when compiling without TCL_MEM_DEBUG.
*
* Results:
@@ -1492,7 +1512,7 @@ int
TclObjBeingDeleted(
Tcl_Obj *objPtr)
{
return (objPtr->length == TCL_INDEX_NONE);
return (TCL_SIZE_ISNEG(objPtr->length));
}
/*
@@ -1612,7 +1632,7 @@ Tcl_GetString(
objPtr->typePtr->name);
}
objPtr->typePtr->updateStringProc(objPtr);
if (objPtr->bytes == NULL || objPtr->length == TCL_INDEX_NONE
if (objPtr->bytes == NULL || TCL_SIZE_ISNEG(objPtr->length)
|| objPtr->bytes[objPtr->length] != '\0') {
Tcl_Panic("UpdateStringProc for type '%s' "
"failed to create a valid string rep",
@@ -1672,7 +1692,7 @@ TclGetStringFromObj(
objPtr->typePtr->name);
}
objPtr->typePtr->updateStringProc(objPtr);
if (objPtr->bytes == NULL || objPtr->length == TCL_INDEX_NONE
if (objPtr->bytes == NULL || TCL_SIZE_ISNEG(objPtr->length)
|| objPtr->bytes[objPtr->length] != '\0') {
Tcl_Panic("UpdateStringProc for type '%s' "
"failed to create a valid string rep",
@@ -1778,7 +1798,7 @@ char *
Tcl_InitStringRep(
Tcl_Obj *objPtr, /* Object whose string rep is to be set */
const char *bytes,
size_t numBytes)
TCL_HASH_TYPE numBytes)
{
assert(objPtr->bytes == NULL || bytes == NULL);
@@ -2001,17 +2021,17 @@ Tcl_GetBoolFromObj(
if (interp) {
TclNewObj(objPtr);
TclParseNumber(interp, objPtr, (flags & TCL_NULL_OK)
? "boolean value or \"\"" : "boolean value", NULL, -1, NULL, 0);
? "boolean value or \"\"" : "boolean value", NULL, TCL_INDEX_NONE, NULL, 0);
Tcl_DecrRefCount(objPtr);
}
return TCL_ERROR;
}
do {
if (objPtr->typePtr == &tclIntType || objPtr->typePtr == &tclBooleanType) {
if (objPtr->typePtr == &tclIntType.objType || objPtr->typePtr == &tclBooleanType.objType) {
result = (objPtr->internalRep.wideValue != 0);
goto boolEnd;
}
if (objPtr->typePtr == &tclDoubleType) {
if (objPtr->typePtr == &tclDoubleType.objType) {
/*
* Caution: Don't be tempted to check directly for the "double"
* Tcl_ObjType and then compare the internalrep to 0.0. This isn't
@@ -2028,7 +2048,7 @@ Tcl_GetBoolFromObj(
result = (d != 0.0);
goto boolEnd;
}
if (objPtr->typePtr == &tclBignumType) {
if (objPtr->typePtr == &tclBignumType.objType) {
result = 1;
boolEnd:
if (charPtr != NULL) {
@@ -2096,18 +2116,18 @@ TclSetBooleanFromAny(
*/
if (objPtr->bytes == NULL) {
if (objPtr->typePtr == &tclIntType) {
if (objPtr->typePtr == &tclIntType.objType) {
if ((Tcl_WideUInt)objPtr->internalRep.wideValue < 2) {
return TCL_OK;
}
goto badBoolean;
}
if (objPtr->typePtr == &tclBignumType) {
if (objPtr->typePtr == &tclBignumType.objType) {
goto badBoolean;
}
if (objPtr->typePtr == &tclDoubleType) {
if (objPtr->typePtr == &tclDoubleType.objType) {
goto badBoolean;
}
}
@@ -2124,7 +2144,7 @@ TclSetBooleanFromAny(
TclNewLiteralStringObj(msg, "expected boolean value but got \"");
Tcl_AppendLimitedToObj(msg, str, length, 50, "");
Tcl_AppendToObj(msg, "\"", -1);
Tcl_AppendToObj(msg, "\"", TCL_INDEX_NONE);
Tcl_SetObjResult(interp, msg);
Tcl_SetErrorCode(interp, "TCL", "VALUE", "BOOLEAN", NULL);
}
@@ -2238,13 +2258,13 @@ ParseBoolean(
goodBoolean:
TclFreeInternalRep(objPtr);
objPtr->internalRep.wideValue = newBool;
objPtr->typePtr = &tclBooleanType;
objPtr->typePtr = &tclBooleanType.objType;
return TCL_OK;
numericBoolean:
TclFreeInternalRep(objPtr);
objPtr->internalRep.wideValue = newBool;
objPtr->typePtr = &tclIntType;
objPtr->typePtr = &tclIntType.objType;
return TCL_OK;
}
@@ -2336,7 +2356,7 @@ Tcl_DbNewDoubleObj(
objPtr->bytes = NULL;
objPtr->internalRep.doubleValue = dblValue;
objPtr->typePtr = &tclDoubleType;
objPtr->typePtr = &tclDoubleType.objType;
return objPtr;
}
@@ -2409,11 +2429,11 @@ Tcl_GetDoubleFromObj(
double *dblPtr) /* Place to store resulting double. */
{
do {
if (objPtr->typePtr == &tclDoubleType) {
if (objPtr->typePtr == &tclDoubleType.objType) {
if (isnan(objPtr->internalRep.doubleValue)) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"floating point value is Not a Number", -1));
"floating point value is Not a Number", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "DOUBLE", "NAN",
NULL);
}
@@ -2422,11 +2442,11 @@ Tcl_GetDoubleFromObj(
*dblPtr = (double) objPtr->internalRep.doubleValue;
return TCL_OK;
}
if (objPtr->typePtr == &tclIntType) {
if (objPtr->typePtr == &tclIntType.objType) {
*dblPtr = (double) objPtr->internalRep.wideValue;
return TCL_OK;
}
if (objPtr->typePtr == &tclBignumType) {
if (objPtr->typePtr == &tclBignumType.objType) {
mp_int big;
TclUnpackBignum(objPtr, big);
@@ -2545,7 +2565,7 @@ Tcl_GetIntFromObj(
if (interp != NULL) {
const char *s =
"integer value too large to represent";
Tcl_SetObjResult(interp, Tcl_NewStringObj(s, -1));
Tcl_SetObjResult(interp, Tcl_NewStringObj(s, TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "ARITH", "IOVERFLOW", s, NULL);
}
return TCL_ERROR;
@@ -2640,12 +2660,12 @@ Tcl_GetLongFromObj(
{
do {
#ifdef TCL_WIDE_INT_IS_LONG
if (objPtr->typePtr == &tclIntType) {
if (objPtr->typePtr == &tclIntType.objType) {
*longPtr = objPtr->internalRep.wideValue;
return TCL_OK;
}
#else
if (objPtr->typePtr == &tclIntType) {
if (objPtr->typePtr == &tclIntType.objType) {
/*
* We return any integer in the range LONG_MIN to ULONG_MAX
* converted to a long, ignoring overflow. The rule preserves
@@ -2664,7 +2684,7 @@ Tcl_GetLongFromObj(
goto tooLarge;
}
#endif
if (objPtr->typePtr == &tclDoubleType) {
if (objPtr->typePtr == &tclDoubleType.objType) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"expected integer but got \"%s\"",
@@ -2673,7 +2693,7 @@ Tcl_GetLongFromObj(
}
return TCL_ERROR;
}
if (objPtr->typePtr == &tclBignumType) {
if (objPtr->typePtr == &tclBignumType.objType) {
/*
* Must check for those bignum values that can fit in a long, even
* when auto-narrowing is enabled. Only those values in the signed
@@ -2710,7 +2730,7 @@ Tcl_GetLongFromObj(
#endif
if (interp != NULL) {
const char *s = "integer value too large to represent";
Tcl_Obj *msg = Tcl_NewStringObj(s, -1);
Tcl_Obj *msg = Tcl_NewStringObj(s, TCL_INDEX_NONE);
Tcl_SetObjResult(interp, msg);
Tcl_SetErrorCode(interp, "ARITH", "IOVERFLOW", s, NULL);
@@ -2901,11 +2921,11 @@ Tcl_GetWideIntFromObj(
/* Place to store resulting long. */
{
do {
if (objPtr->typePtr == &tclIntType) {
if (objPtr->typePtr == &tclIntType.objType) {
*wideIntPtr = objPtr->internalRep.wideValue;
return TCL_OK;
}
if (objPtr->typePtr == &tclDoubleType) {
if (objPtr->typePtr == &tclDoubleType.objType) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"expected integer but got \"%s\"",
@@ -2914,7 +2934,7 @@ Tcl_GetWideIntFromObj(
}
return TCL_ERROR;
}
if (objPtr->typePtr == &tclBignumType) {
if (objPtr->typePtr == &tclBignumType.objType) {
/*
* Must check for those bignum values that can fit in a
* Tcl_WideInt, even when auto-narrowing is enabled.
@@ -2945,7 +2965,7 @@ Tcl_GetWideIntFromObj(
}
if (interp != NULL) {
const char *s = "integer value too large to represent";
Tcl_Obj *msg = Tcl_NewStringObj(s, -1);
Tcl_Obj *msg = Tcl_NewStringObj(s, TCL_INDEX_NONE);
Tcl_SetObjResult(interp, msg);
Tcl_SetErrorCode(interp, "ARITH", "IOVERFLOW", s, NULL);
@@ -2957,6 +2977,90 @@ Tcl_GetWideIntFromObj(
return TCL_ERROR;
}
/*
*----------------------------------------------------------------------
*
* Tcl_GetWideUIntFromObj --
*
* Attempt to return a unsigned wide integer from the Tcl object "objPtr". If the
* object is not already a wide int object or a bignum object, an attempt will
* be made to convert it to one.
*
* Results:
* The return value is a standard Tcl object result. If an error occurs
* during conversion, an error message is left in the interpreter's
* result unless "interp" is NULL.
*
* Side effects:
* If the object is not already an int object, the conversion will free
* any old internal representation.
*
*----------------------------------------------------------------------
*/
int
Tcl_GetWideUIntFromObj(
Tcl_Interp *interp, /* Used for error reporting if not NULL. */
Tcl_Obj *objPtr, /* Object from which to get a wide int. */
Tcl_WideUInt *wideUIntPtr)
/* Place to store resulting long. */
{
do {
if (objPtr->typePtr == &tclIntType.objType) {
if (objPtr->internalRep.wideValue < 0) {
wideUIntOutOfRange:
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"expected unsigned integer but got \"%s\"",
TclGetString(objPtr)));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "INTEGER", NULL);
}
return TCL_ERROR;
}
*wideUIntPtr = (Tcl_WideUInt)objPtr->internalRep.wideValue;
return TCL_OK;
}
if (objPtr->typePtr == &tclDoubleType.objType) {
goto wideUIntOutOfRange;
}
if (objPtr->typePtr == &tclBignumType.objType) {
/*
* Must check for those bignum values that can fit in a
* Tcl_WideUInt, even when auto-narrowing is enabled.
*/
mp_int big;
Tcl_WideUInt value = 0;
size_t numBytes;
Tcl_WideUInt scratch;
unsigned char *bytes = (unsigned char *) &scratch;
TclUnpackBignum(objPtr, big);
if (big.sign == MP_NEG) {
goto wideUIntOutOfRange;
}
if (mp_to_ubin(&big, bytes, sizeof(Tcl_WideUInt), &numBytes) == MP_OKAY) {
while (numBytes-- > 0) {
value = (value << CHAR_BIT) | *bytes++;
}
*wideUIntPtr = (Tcl_WideUInt)value;
return TCL_OK;
}
if (interp != NULL) {
const char *s = "integer value too large to represent";
Tcl_Obj *msg = Tcl_NewStringObj(s, TCL_INDEX_NONE);
Tcl_SetObjResult(interp, msg);
Tcl_SetErrorCode(interp, "ARITH", "IOVERFLOW", s, NULL);
}
return TCL_ERROR;
}
} while (TclParseNumber(interp, objPtr, "integer", NULL, -1, NULL,
TCL_PARSE_INTEGER_ONLY)==TCL_OK);
return TCL_ERROR;
}
/*
*----------------------------------------------------------------------
*
@@ -2986,11 +3090,11 @@ TclGetWideBitsFromObj(
Tcl_WideInt *wideIntPtr) /* Place to store resulting wide integer. */
{
do {
if (objPtr->typePtr == &tclIntType) {
if (objPtr->typePtr == &tclIntType.objType) {
*wideIntPtr = objPtr->internalRep.wideValue;
return TCL_OK;
}
if (objPtr->typePtr == &tclDoubleType) {
if (objPtr->typePtr == &tclDoubleType.objType) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"expected integer but got \"%s\"",
@@ -2999,7 +3103,7 @@ TclGetWideBitsFromObj(
}
return TCL_ERROR;
}
if (objPtr->typePtr == &tclBignumType) {
if (objPtr->typePtr == &tclBignumType.objType) {
mp_int big;
mp_err err;
@@ -3065,7 +3169,7 @@ FreeBignum(
* None.
*
* Side effects:
* The destination object receies a copy of the source object
* The destination object receives a copy of the source object
*
*----------------------------------------------------------------------
*/
@@ -3078,7 +3182,7 @@ DupBignum(
mp_int bignumVal;
mp_int bignumCopy;
copyPtr->typePtr = &tclBignumType;
copyPtr->typePtr = &tclBignumType.objType;
TclUnpackBignum(srcPtr, bignumVal);
if (mp_init_copy(&bignumCopy, &bignumVal) != MP_OKAY) {
Tcl_Panic("initialization failure in DupBignum");
@@ -3144,7 +3248,7 @@ UpdateStringOfBignum(
*
* Tcl_NewBignumObj --
*
* Creates an initializes a bignum object.
* Creates and initializes a bignum object.
*
* Results:
* Returns the newly created object.
@@ -3248,7 +3352,7 @@ GetBignumFromObj(
mp_int *bignumValue) /* Returned bignum value. */
{
do {
if (objPtr->typePtr == &tclBignumType) {
if (objPtr->typePtr == &tclBignumType.objType) {
if (copy || Tcl_IsShared(objPtr)) {
mp_int temp;
@@ -3273,14 +3377,14 @@ GetBignumFromObj(
}
return TCL_OK;
}
if (objPtr->typePtr == &tclIntType) {
if (objPtr->typePtr == &tclIntType.objType) {
if (mp_init_i64(bignumValue,
objPtr->internalRep.wideValue) != MP_OKAY) {
return TCL_ERROR;
}
return TCL_OK;
}
if (objPtr->typePtr == &tclDoubleType) {
if (objPtr->typePtr == &tclDoubleType.objType) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"expected integer but got \"%s\"",
@@ -3440,7 +3544,7 @@ TclSetBignumInternalRep(
void *big)
{
mp_int *bignumValue = (mp_int *)big;
objPtr->typePtr = &tclBignumType;
objPtr->typePtr = &tclBignumType.objType;
PACK_BIGNUM(*bignumValue, objPtr);
/*
@@ -3483,7 +3587,7 @@ Tcl_GetNumberFromObj(
int *typePtr)
{
do {
if (objPtr->typePtr == &tclDoubleType) {
if (objPtr->typePtr == &tclDoubleType.objType) {
if (isnan(objPtr->internalRep.doubleValue)) {
*typePtr = TCL_NUMBER_NAN;
} else {
@@ -3492,12 +3596,12 @@ Tcl_GetNumberFromObj(
*clientDataPtr = &objPtr->internalRep.doubleValue;
return TCL_OK;
}
if (objPtr->typePtr == &tclIntType) {
if (objPtr->typePtr == &tclIntType.objType) {
*typePtr = TCL_NUMBER_INT;
*clientDataPtr = &objPtr->internalRep.wideValue;
return TCL_OK;
}
if (objPtr->typePtr == &tclBignumType) {
if (objPtr->typePtr == &tclBignumType.objType) {
static Tcl_ThreadDataKey bignumKey;
mp_int *bigPtr = (mp_int *)Tcl_GetThreadData(&bignumKey,
sizeof(mp_int));
@@ -3644,7 +3748,7 @@ Tcl_DbIncrRefCount(
int line) /* Line number in the source file; used for
* debugging. */
{
if (objPtr->refCount == 0x61616161) {
if (objPtr->refCount == FREEDREFCOUNTFILLER) {
fprintf(stderr, "file = %s, line = %d\n", file, line);
fflush(stderr);
Tcl_Panic("incrementing refCount of previously disposed object");
@@ -3717,7 +3821,7 @@ Tcl_DbDecrRefCount(
int line) /* Line number in the source file; used for
* debugging. */
{
if (objPtr->refCount == 0x61616161) {
if (objPtr->refCount == FREEDREFCOUNTFILLER) {
fprintf(stderr, "file = %s, line = %d\n", file, line);
fflush(stderr);
Tcl_Panic("decrementing refCount of previously disposed object");
@@ -3799,7 +3903,7 @@ Tcl_DbIsShared(
#endif
{
#ifdef TCL_MEM_DEBUG
if (objPtr->refCount == 0x61616161) {
if (objPtr->refCount == FREEDREFCOUNTFILLER) {
fprintf(stderr, "file = %s, line = %d\n", file, line);
fflush(stderr);
Tcl_Panic("checking whether previously disposed object is shared");
@@ -4015,7 +4119,7 @@ TclHashObjKey(
void *keyPtr) /* Key from which to compute hash value. */
{
Tcl_Obj *objPtr = (Tcl_Obj *)keyPtr;
size_t length;
Tcl_Size length;
const char *string = Tcl_GetStringFromObj(objPtr, &length);
TCL_HASH_TYPE result = 0;
@@ -4156,7 +4260,7 @@ Tcl_GetCommandFromObj(
* None.
*
* Side effects:
* The object's old internal rep is freed. It's string rep is not
* The object's old internal rep is freed. Its string rep is not
* changed. The refcount in the Command structure is incremented to keep
* it from being freed if the command is later deleted until
* TclNRExecuteByteCode has a chance to recognize that it was deleted.
@@ -4436,7 +4540,7 @@ Tcl_RepresentationCmd(
objv[1]->refCount, objv[1]);
if (objv[1]->typePtr) {
if (objv[1]->typePtr == &tclDoubleType) {
if (objv[1]->typePtr == &tclDoubleType.objType) {
Tcl_AppendPrintfToObj(descObj, ", internal representation %g",
objv[1]->internalRep.doubleValue);
} else {
@@ -4447,12 +4551,12 @@ Tcl_RepresentationCmd(
}
if (objv[1]->bytes) {
Tcl_AppendToObj(descObj, ", string representation \"", -1);
Tcl_AppendToObj(descObj, ", string representation \"", TCL_INDEX_NONE);
Tcl_AppendLimitedToObj(descObj, objv[1]->bytes, objv[1]->length,
16, "...");
Tcl_AppendToObj(descObj, "\"", -1);
Tcl_AppendToObj(descObj, "\"", TCL_INDEX_NONE);
} else {
Tcl_AppendToObj(descObj, ", no string representation", -1);
Tcl_AppendToObj(descObj, ", no string representation", TCL_INDEX_NONE);
}
Tcl_SetObjResult(interp, descObj);
+1 -1
View File
@@ -134,7 +134,7 @@ LocateTargetAddresses(
} else {
targetInstPtr = envPtr->codeStart + rangePtr->breakOffset;
DefineTargetAddress(tablePtr, targetInstPtr);
if (rangePtr->continueOffset != TCL_INDEX_NONE) {
if (!TCL_SIZE_ISNEG(rangePtr->continueOffset)) {
targetInstPtr = envPtr->codeStart + rangePtr->continueOffset;
DefineTargetAddress(tablePtr, targetInstPtr);
}
+21 -21
View File
@@ -39,7 +39,7 @@
* TYPE_BRACE - Character is a curly brace (either left or right).
*/
const char tclCharTypeTable[] = {
const unsigned char tclCharTypeTable[] = {
/*
* Positive character values, from 0-127:
@@ -198,7 +198,7 @@ Tcl_ParseCommand(
* NULL, then no error message is provided. */
const char *start, /* First character of string containing one or
* more Tcl commands. */
size_t numBytes, /* Total number of bytes in string. If -1,
Tcl_Size numBytes, /* Total number of bytes in string. If TCL_INDEX_NONE,
* the script consists of all bytes up to the
* first null character. */
int nested, /* Non-zero means this is a nested command:
@@ -221,14 +221,14 @@ Tcl_ParseCommand(
* point to char after terminating one. */
size_t scanned;
if (numBytes == TCL_INDEX_NONE && start) {
if (TCL_SIZE_ISNEG(numBytes) && start) {
numBytes = strlen(start);
}
TclParseInit(interp, start, numBytes, parsePtr);
if ((start == NULL) && (numBytes != 0)) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"can't parse a NULL pointer", -1));
"can't parse a NULL pointer", TCL_INDEX_NONE));
}
return TCL_ERROR;
}
@@ -282,13 +282,13 @@ Tcl_ParseCommand(
if (src[-1] == '"') {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"extra characters after close-quote", -1));
"extra characters after close-quote", TCL_INDEX_NONE));
}
parsePtr->errorType = TCL_PARSE_QUOTE_EXTRA;
} else {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"extra characters after close-brace", -1));
"extra characters after close-brace", TCL_INDEX_NONE));
}
parsePtr->errorType = TCL_PARSE_BRACE_EXTRA;
}
@@ -1179,7 +1179,7 @@ ParseTokens(
if (numBytes == 0) {
if (parsePtr->interp != NULL) {
Tcl_SetObjResult(parsePtr->interp, Tcl_NewStringObj(
"missing close-bracket", -1));
"missing close-bracket", TCL_INDEX_NONE));
}
parsePtr->errorType = TCL_PARSE_MISSING_BRACKET;
parsePtr->term = tokenPtr->start;
@@ -1335,7 +1335,7 @@ Tcl_ParseVarName(
* NULL, then no error message is provided. */
const char *start, /* Start of variable substitution string.
* First character must be "$". */
size_t numBytes, /* Total number of bytes in string. If -1,
Tcl_Size numBytes, /* Total number of bytes in string. If TCL_INDEX_NONE,
* the string consists of all bytes up to the
* first null character. */
Tcl_Parse *parsePtr, /* Structure to fill in with information about
@@ -1350,7 +1350,7 @@ Tcl_ParseVarName(
int varIndex;
unsigned array;
if (numBytes == TCL_INDEX_NONE && start) {
if (TCL_SIZE_ISNEG(numBytes) && start) {
numBytes = strlen(start);
}
if (!append) {
@@ -1425,7 +1425,7 @@ Tcl_ParseVarName(
if (numBytes == 0) {
if (parsePtr->interp != NULL) {
Tcl_SetObjResult(parsePtr->interp, Tcl_NewStringObj(
"missing close-brace for variable name", -1));
"missing close-brace for variable name", TCL_INDEX_NONE));
}
parsePtr->errorType = TCL_PARSE_MISSING_VAR_BRACE;
parsePtr->term = tokenPtr->start-1;
@@ -1483,7 +1483,7 @@ Tcl_ParseVarName(
if (parsePtr->term == src+numBytes){
if (parsePtr->interp != NULL) {
Tcl_SetObjResult(parsePtr->interp, Tcl_NewStringObj(
"missing )", -1));
"missing )", TCL_INDEX_NONE));
}
parsePtr->errorType = TCL_PARSE_MISSING_PAREN;
parsePtr->term = src;
@@ -1492,7 +1492,7 @@ Tcl_ParseVarName(
} else if ((*parsePtr->term != ')')){
if (parsePtr->interp != NULL) {
Tcl_SetObjResult(parsePtr->interp, Tcl_NewStringObj(
"invalid character in array index", -1));
"invalid character in array index", TCL_INDEX_NONE));
}
parsePtr->errorType = TCL_PARSE_SYNTAX;
parsePtr->term = src;
@@ -1558,7 +1558,7 @@ Tcl_ParseVar(
int code;
Tcl_Parse *parsePtr = (Tcl_Parse *)TclStackAlloc(interp, sizeof(Tcl_Parse));
if (Tcl_ParseVarName(interp, start, -1, parsePtr, 0) != TCL_OK) {
if (Tcl_ParseVarName(interp, start, TCL_INDEX_NONE, parsePtr, 0) != TCL_OK) {
TclStackFree(interp, parsePtr);
return NULL;
}
@@ -1633,7 +1633,7 @@ Tcl_ParseBraces(
* NULL, then no error message is provided. */
const char *start, /* Start of string enclosed in braces. The
* first character must be {'. */
size_t numBytes, /* Total number of bytes in string. If -1,
Tcl_Size numBytes, /* Total number of bytes in string. If TCL_INDEX_NONE,
* the string consists of all bytes up to the
* first null character. */
Tcl_Parse *parsePtr,
@@ -1651,9 +1651,9 @@ Tcl_ParseBraces(
Tcl_Token *tokenPtr;
const char *src;
int startIndex, level;
size_t length;
Tcl_Size length;
if (numBytes == TCL_INDEX_NONE && start) {
if (TCL_SIZE_ISNEG(numBytes) && start) {
numBytes = strlen(start);
}
if (!append) {
@@ -1765,7 +1765,7 @@ Tcl_ParseBraces(
}
Tcl_SetObjResult(parsePtr->interp, Tcl_NewStringObj(
"missing close-brace", -1));
"missing close-brace", TCL_INDEX_NONE));
/*
* Guess if the problem is due to comments by searching the source string
@@ -1788,7 +1788,7 @@ Tcl_ParseBraces(
case '#' :
if (openBrace && TclIsSpaceProcM(src[-1])) {
Tcl_AppendToObj(Tcl_GetObjResult(parsePtr->interp),
": possible unbalanced brace in comment", -1);
": possible unbalanced brace in comment", TCL_INDEX_NONE);
goto error;
}
break;
@@ -1835,7 +1835,7 @@ Tcl_ParseQuotedString(
* NULL, then no error message is provided. */
const char *start, /* Start of the quoted string. The first
* character must be '"'. */
size_t numBytes, /* Total number of bytes in string. If -1,
Tcl_Size numBytes, /* Total number of bytes in string. If TCL_INDEX_NONE,
* the string consists of all bytes up to the
* first null character. */
Tcl_Parse *parsePtr,
@@ -1850,7 +1850,7 @@ Tcl_ParseQuotedString(
* the quoted string's terminating close-quote
* if the parse succeeds. */
{
if (numBytes == TCL_INDEX_NONE && start) {
if (TCL_SIZE_ISNEG(numBytes) && start) {
numBytes = strlen(start);
}
if (!append) {
@@ -1867,7 +1867,7 @@ Tcl_ParseQuotedString(
if (*parsePtr->term != '"') {
if (parsePtr->interp != NULL) {
Tcl_SetObjResult(parsePtr->interp, Tcl_NewStringObj(
"missing \"", -1));
"missing \"", TCL_INDEX_NONE));
}
parsePtr->errorType = TCL_PARSE_MISSING_QUOTE;
parsePtr->term = start;
+1 -1
View File
@@ -16,4 +16,4 @@
#define CHAR_TYPE(c) tclCharTypeTable[(unsigned char)(c)]
MODULE_SCOPE const char tclCharTypeTable[];
MODULE_SCOPE const unsigned char tclCharTypeTable[];
+19 -17
View File
@@ -65,7 +65,7 @@ typedef struct {
* normPathPtr exists and is absolute. */
int flags; /* Flags to describe interpretation - see
* below. */
ClientData nativePathPtr; /* Native representation of this path, which
void *nativePathPtr; /* Native representation of this path, which
* is filesystem dependent. */
size_t filesystemEpoch; /* Used to ensure the path representation was
* generated during the correct filesystem
@@ -624,7 +624,7 @@ TclPathPart(
return GetExtension(fsPathPtr->normPathPtr);
case TCL_PATH_ROOT: {
const char *fileName, *extension;
size_t length;
Tcl_Size length;
fileName = Tcl_GetStringFromObj(fsPathPtr->normPathPtr,
&length);
@@ -751,7 +751,7 @@ GetExtension(
if (extension == NULL) {
TclNewObj(ret);
} else {
ret = Tcl_NewStringObj(extension, -1);
ret = Tcl_NewStringObj(extension, TCL_INDEX_NONE);
}
Tcl_IncrRefCount(ret);
return ret;
@@ -795,17 +795,17 @@ Tcl_Obj *
Tcl_FSJoinPath(
Tcl_Obj *listObj, /* Path elements to join, may have a zero
* reference count. */
size_t elements) /* Number of elements to use (-1 = all) */
Tcl_Size elements) /* Number of elements to use (TCL_INDEX_NONE = all) */
{
Tcl_Obj *res;
size_t objc;
Tcl_Size objc;
Tcl_Obj **objv;
if (TclListObjLengthM(NULL, listObj, &objc) != TCL_OK) {
return NULL;
}
elements = ((elements != TCL_INDEX_NONE) && (elements <= objc)) ? elements : objc;
elements = (!TCL_SIZE_ISNEG(elements) && (elements <= objc)) ? elements : objc;
TclListObjGetElementsM(NULL, listObj, &objc, &objv);
res = TclJoinPath(elements, objv, 0);
return res;
@@ -813,13 +813,13 @@ Tcl_FSJoinPath(
Tcl_Obj *
TclJoinPath(
size_t elements, /* Number of elements to use */
Tcl_Size elements, /* Number of elements to use */
Tcl_Obj * const objv[], /* Path elements to join */
int forceRelative) /* If non-zero, assume all more paths are
* relative (e. g. simple normalization) */
{
Tcl_Obj *res = NULL;
size_t i;
Tcl_Size i;
const Tcl_Filesystem *fsPtr = NULL;
if (elements == 0) {
@@ -1489,7 +1489,7 @@ MakePathFromNormalized(
Tcl_Obj *
Tcl_FSNewNativePath(
const Tcl_Filesystem *fromFilesystem,
ClientData clientData)
void *clientData)
{
Tcl_Obj *pathPtr = NULL;
FsPath *fsPathPtr;
@@ -1927,7 +1927,7 @@ Tcl_FSGetNormalizedPath(
*---------------------------------------------------------------------------
*/
ClientData
void *
Tcl_FSGetInternalRep(
Tcl_Obj *pathPtr,
const Tcl_Filesystem *fsPtr)
@@ -2074,7 +2074,7 @@ void
TclFSSetPathDetails(
Tcl_Obj *pathPtr,
const Tcl_Filesystem *fsPtr,
ClientData clientData)
void *clientData)
{
FsPath *srcFsPathPtr;
@@ -2207,10 +2207,12 @@ SetFsPathFromAny(
fsPathPtr = (FsPath *)Tcl_Alloc(sizeof(FsPath));
if (transPtr == pathPtr) {
transPtr = Tcl_DuplicateObj(pathPtr);
fsPathPtr->filesystemEpoch = 0;
(void) Tcl_GetString(pathPtr);
TclFreeInternalRep(pathPtr);
transPtr = Tcl_DuplicateObj(pathPtr);
fsPathPtr->filesystemEpoch = 0;
} else {
fsPathPtr->filesystemEpoch = TclFSEpoch();
fsPathPtr->filesystemEpoch = TclFSEpoch();
}
Tcl_IncrRefCount(transPtr);
fsPathPtr->translatedPathPtr = transPtr;
@@ -2368,7 +2370,7 @@ UpdateStringOfFsPath(
int
TclNativePathInFilesystem(
Tcl_Obj *pathPtr,
TCL_UNUSED(ClientData *))
TCL_UNUSED(void **))
{
/*
* A special case is required to handle the empty path "". This is a valid
@@ -2514,7 +2516,7 @@ TclGetHomeDirObj(
if (MakeTildeRelativePath(interp, user, NULL, &dirString) != TCL_OK) {
return NULL;
}
return TclDStringToObj(&dirString);
return Tcl_DStringToObj(&dirString);
}
/*
@@ -2586,7 +2588,7 @@ TclResolveTildePath(
}
Tcl_DStringFree(&userName);
}
return TclDStringToObj(&resolvedPath);
return Tcl_DStringToObj(&resolvedPath);
}
/*
+15 -15
View File
@@ -179,12 +179,12 @@ FileForRedirect(
void
Tcl_DetachPids(
size_t numPids, /* Number of pids to detach: gives size of
Tcl_Size numPids, /* Number of pids to detach: gives size of
* array pointed to by pidPtr. */
Tcl_Pid *pidPtr) /* Array of pids to detach. */
{
Detached *detPtr;
size_t i;
Tcl_Size i;
Tcl_MutexLock(&pipeMutex);
for (i = 0; i < numPids; i++) {
@@ -269,7 +269,7 @@ Tcl_ReapDetachedProcs(void)
int
TclCleanupChildren(
Tcl_Interp *interp, /* Used for error messages. */
size_t numPids, /* Number of entries in pidPtr array. */
Tcl_Size numPids, /* Number of entries in pidPtr array. */
Tcl_Pid *pidPtr, /* Array of process ids of children. */
Tcl_Channel errorChan) /* Channel for file containing stderr output
* from pipeline. NULL means there isn't any
@@ -278,7 +278,7 @@ TclCleanupChildren(
int result = TCL_OK;
int code, abnormalExit, anyErrorInfo;
TclProcessWaitStatus waitStatus;
size_t i;
Tcl_Size i;
Tcl_Obj *msg, *error;
abnormalExit = 0;
@@ -335,7 +335,7 @@ TclCleanupChildren(
Tcl_Seek(errorChan, 0, SEEK_SET);
TclNewObj(objPtr);
count = Tcl_ReadChars(errorChan, objPtr, -1, 0);
count = Tcl_ReadChars(errorChan, objPtr, TCL_INDEX_NONE, 0);
if (count == -1) {
result = TCL_ERROR;
Tcl_DecrRefCount(objPtr);
@@ -361,7 +361,7 @@ TclCleanupChildren(
if ((abnormalExit != 0) && (anyErrorInfo == 0) && (interp != NULL)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"child process exited abnormally", -1));
"child process exited abnormally", TCL_INDEX_NONE));
}
return result;
}
@@ -395,10 +395,10 @@ TclCleanupChildren(
*----------------------------------------------------------------------
*/
size_t
Tcl_Size
TclCreatePipeline(
Tcl_Interp *interp, /* Interpreter to use for error reporting. */
size_t argc, /* Number of entries in argv. */
Tcl_Size argc, /* Number of entries in argv. */
const char **argv, /* Array of strings describing commands in
* pipeline plus I/O redirection with <, <<,
* >, etc. Argv[argc] must be NULL. */
@@ -512,7 +512,7 @@ TclCreatePipeline(
if (*p == '\0') {
if ((i == (lastBar + 1)) || (i == (argc - 1))) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"illegal use of | or |& in command", -1));
"illegal use of | or |& in command", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "EXEC",
"PIPESYNTAX", NULL);
goto error;
@@ -700,7 +700,7 @@ TclCreatePipeline(
*/
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"illegal use of | or |& in command", -1));
"illegal use of | or |& in command", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "EXEC", "PIPESYNTAX",
NULL);
goto error;
@@ -1021,7 +1021,7 @@ Tcl_Channel
Tcl_OpenCommandChannel(
Tcl_Interp *interp, /* Interpreter for error reporting. Can NOT be
* NULL. */
size_t argc, /* How many arguments. */
Tcl_Size argc, /* How many arguments. */
const char **argv, /* Array of arguments for command pipe. */
int flags) /* Or'ed combination of TCL_STDIN, TCL_STDOUT,
* TCL_STDERR, and TCL_ENFORCE_MODE. */
@@ -1041,7 +1041,7 @@ Tcl_OpenCommandChannel(
numPids = TclCreatePipeline(interp, argc, argv, &pidPtr, inPipePtr,
outPipePtr, errFilePtr);
if (numPids == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(numPids)) {
goto error;
}
@@ -1054,7 +1054,7 @@ Tcl_OpenCommandChannel(
if ((flags & TCL_STDOUT) && (outPipe == NULL)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"can't read output from command:"
" standard output was redirected", -1));
" standard output was redirected", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "EXEC",
"BADREDIRECT", NULL);
goto error;
@@ -1062,7 +1062,7 @@ Tcl_OpenCommandChannel(
if ((flags & TCL_STDIN) && (inPipe == NULL)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"can't write input to command:"
" standard input was redirected", -1));
" standard input was redirected", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "EXEC",
"BADREDIRECT", NULL);
goto error;
@@ -1074,7 +1074,7 @@ Tcl_OpenCommandChannel(
if (channel == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"pipe for command could not be created", -1));
"pipe for command could not be created", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "EXEC", "NOPIPE", NULL);
goto error;
}
+43 -43
View File
@@ -96,15 +96,15 @@ static void AddRequirementsToResult(Tcl_Interp *interp, int reqc,
static void AddRequirementsToDString(Tcl_DString *dstring,
int reqc, Tcl_Obj *const reqv[]);
static Package * FindPackage(Tcl_Interp *interp, const char *name);
static int PkgRequireCore(ClientData data[], Tcl_Interp *interp, int result);
static int PkgRequireCoreFinal(ClientData data[], Tcl_Interp *interp, int result);
static int PkgRequireCoreCleanup(ClientData data[], Tcl_Interp *interp, int result);
static int PkgRequireCoreStep1(ClientData data[], Tcl_Interp *interp, int result);
static int PkgRequireCoreStep2(ClientData data[], Tcl_Interp *interp, int result);
static int TclNRPkgRequireProc(ClientData clientData, Tcl_Interp *interp, int reqc, Tcl_Obj *const reqv[]);
static int SelectPackage(ClientData data[], Tcl_Interp *interp, int result);
static int SelectPackageFinal(ClientData data[], Tcl_Interp *interp, int result);
static int TclNRPackageObjCmdCleanup(ClientData data[], Tcl_Interp *interp, int result);
static int PkgRequireCore(void *data[], Tcl_Interp *interp, int result);
static int PkgRequireCoreFinal(void *data[], Tcl_Interp *interp, int result);
static int PkgRequireCoreCleanup(void *data[], Tcl_Interp *interp, int result);
static int PkgRequireCoreStep1(void *data[], Tcl_Interp *interp, int result);
static int PkgRequireCoreStep2(void *data[], Tcl_Interp *interp, int result);
static int TclNRPkgRequireProc(void *clientData, Tcl_Interp *interp, int reqc, Tcl_Obj *const reqv[]);
static int SelectPackage(void *data[], Tcl_Interp *interp, int result);
static int SelectPackageFinal(void *data[], Tcl_Interp *interp, int result);
static int TclNRPackageObjCmdCleanup(void *data[], Tcl_Interp *interp, int result);
/*
* Helper macros.
@@ -165,7 +165,7 @@ Tcl_PkgProvideEx(
pkgPtr = FindPackage(interp, name);
if (pkgPtr->version == NULL) {
pkgPtr->version = Tcl_NewStringObj(version, -1);
pkgPtr->version = Tcl_NewStringObj(version, TCL_INDEX_NONE);
Tcl_IncrRefCount(pkgPtr->version);
pkgPtr->clientData = clientData;
return TCL_OK;
@@ -225,7 +225,7 @@ Tcl_PkgProvideEx(
static void
PkgFilesCleanupProc(
ClientData clientData,
void *clientData,
TCL_UNUSED(Tcl_Interp *))
{
PkgFiles *pkgFiles = (PkgFiles *) clientData;
@@ -291,7 +291,7 @@ TclPkgFileSeen(
} else {
list = (Tcl_Obj *)Tcl_GetHashValue(entry);
}
Tcl_ListObjAppendElement(interp, list, Tcl_NewStringObj(fileName, -1));
Tcl_ListObjAppendElement(interp, list, Tcl_NewStringObj(fileName, TCL_INDEX_NONE));
}
}
@@ -399,7 +399,7 @@ Tcl_PkgRequireEx(
if (version == NULL) {
if (Tcl_PkgRequireProc(interp, name, 0, NULL, clientDataPtr) == TCL_OK) {
result = Tcl_GetString(Tcl_GetObjResult(interp));
result = Tcl_GetStringResult(interp);
Tcl_ResetResult(interp);
}
} else {
@@ -407,13 +407,13 @@ Tcl_PkgRequireEx(
!= CheckVersionAndConvert(interp, version, NULL, NULL)) {
return NULL;
}
ov = Tcl_NewStringObj(version, -1);
ov = Tcl_NewStringObj(version, TCL_INDEX_NONE);
if (exact) {
Tcl_AppendStringsToObj(ov, "-", version, NULL);
}
Tcl_IncrRefCount(ov);
if (Tcl_PkgRequireProc(interp, name, 1, &ov, clientDataPtr) == TCL_OK) {
result = Tcl_GetString(Tcl_GetObjResult(interp));
result = Tcl_GetStringResult(interp);
Tcl_ResetResult(interp);
}
TclDecrRefCount(ov);
@@ -426,7 +426,7 @@ Tcl_PkgRequireProc(
Tcl_Interp *interp, /* Interpreter in which package is now
* available. */
const char *name, /* Name of desired package. */
size_t reqc, /* Requirements constraining the desired
Tcl_Size reqc, /* Requirements constraining the desired
* version. */
Tcl_Obj *const reqv[], /* 0 means to use the latest version
* available. */
@@ -442,7 +442,7 @@ Tcl_PkgRequireProc(
static int
TclNRPkgRequireProc(
ClientData clientData,
void *clientData,
Tcl_Interp *interp,
int reqc,
Tcl_Obj *const reqv[])
@@ -457,12 +457,12 @@ TclNRPkgRequireProc(
static int
PkgRequireCore(
ClientData data[],
void *data[],
Tcl_Interp *interp,
TCL_UNUSED(int))
{
const char *name = (const char *)data[0];
int reqc = PTR2INT(data[1]);
int reqc = (int)PTR2INT(data[1]);
Tcl_Obj **reqv = (Tcl_Obj **)data[2];
int code = CheckAllRequirements(interp, reqc, reqv);
Require *reqPtr;
@@ -488,14 +488,14 @@ PkgRequireCore(
static int
PkgRequireCoreStep1(
ClientData data[],
void *data[],
Tcl_Interp *interp,
TCL_UNUSED(int))
{
Tcl_DString command;
char *script;
Require *reqPtr = (Require *)data[0];
int reqc = PTR2INT(data[1]);
int reqc = (int)PTR2INT(data[1]);
Tcl_Obj **const reqv = (Tcl_Obj **)data[2];
const char *name = reqPtr->name /* Name of desired package. */;
@@ -531,7 +531,7 @@ PkgRequireCoreStep1(
*/
Tcl_DStringInit(&command);
Tcl_DStringAppend(&command, script, -1);
Tcl_DStringAppend(&command, script, TCL_INDEX_NONE);
Tcl_DStringAppendElement(&command, name);
AddRequirementsToDString(&command, reqc, reqv);
@@ -547,12 +547,12 @@ PkgRequireCoreStep1(
static int
PkgRequireCoreStep2(
ClientData data[],
void *data[],
Tcl_Interp *interp,
int result)
{
Require *reqPtr = (Require *)data[0];
int reqc = PTR2INT(data[1]);
int reqc = (int)PTR2INT(data[1]);
Tcl_Obj **const reqv = (Tcl_Obj **)data[2];
const char *name = reqPtr->name; /* Name of desired package. */
@@ -582,12 +582,12 @@ PkgRequireCoreStep2(
static int
PkgRequireCoreFinal(
ClientData data[],
void *data[],
Tcl_Interp *interp,
TCL_UNUSED(int))
{
Require *reqPtr = (Require *)data[0];
int reqc = PTR2INT(data[1]), satisfies;
int reqc = (int)PTR2INT(data[1]), satisfies;
Tcl_Obj **const reqv = (Tcl_Obj **)data[2];
char *pkgVersionI;
void *clientDataPtr = reqPtr->clientDataPtr;
@@ -634,7 +634,7 @@ PkgRequireCoreFinal(
static int
PkgRequireCoreCleanup(
ClientData data[],
void *data[],
TCL_UNUSED(Tcl_Interp *),
int result)
{
@@ -644,7 +644,7 @@ PkgRequireCoreCleanup(
static int
SelectPackage(
ClientData data[],
void *data[],
Tcl_Interp *interp,
TCL_UNUSED(int))
{
@@ -653,7 +653,7 @@ SelectPackage(
/* Internal rep. of versions */
int availStable, satisfies;
Require *reqPtr = (Require *)data[0];
int reqc = PTR2INT(data[1]);
int reqc = (int)PTR2INT(data[1]);
Tcl_Obj **const reqv = (Tcl_Obj **)data[2];
const char *name = reqPtr->name;
Package *pkgPtr = reqPtr->pkgPtr;
@@ -839,7 +839,7 @@ SelectPackage(
Tcl_NRAddCallback(interp,
SelectPackageFinal, reqPtr, INT2PTR(reqc), (void *)reqv,
data[3]);
Tcl_NREvalObj(interp, Tcl_NewStringObj(bestPtr->script, -1),
Tcl_NREvalObj(interp, Tcl_NewStringObj(bestPtr->script, TCL_INDEX_NONE),
TCL_EVAL_GLOBAL);
}
return TCL_OK;
@@ -847,12 +847,12 @@ SelectPackage(
static int
SelectPackageFinal(
ClientData data[],
void *data[],
Tcl_Interp *interp,
int result)
{
Require *reqPtr = (Require *)data[0];
int reqc = PTR2INT(data[1]);
int reqc = (int)PTR2INT(data[1]);
Tcl_Obj **const reqv = (Tcl_Obj **)data[2];
const char *name = reqPtr->name;
char *versionToProvide = reqPtr->versionToProvide;
@@ -1053,7 +1053,7 @@ Tcl_PkgPresentEx(
*/
int
Tcl_PackageObjCmd(
ClientData clientData,
void *clientData,
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1160,7 +1160,7 @@ TclNRPackageObjCmd(
break;
}
case PKG_IFNEEDED: {
size_t length;
Tcl_Size length;
int res;
char *argv3i, *avi;
@@ -1200,7 +1200,7 @@ TclNRPackageObjCmd(
if (objc == 4) {
Tcl_Free(argv3i);
Tcl_SetObjResult(interp,
Tcl_NewStringObj(availPtr->script, -1));
Tcl_NewStringObj(availPtr->script, TCL_INDEX_NONE));
return TCL_OK;
}
Tcl_EventuallyFree(availPtr->script, TCL_DYNAMIC);
@@ -1251,7 +1251,7 @@ TclNRPackageObjCmd(
pkgPtr = (Package *)Tcl_GetHashValue(hPtr);
if ((pkgPtr->version != NULL) || (pkgPtr->availPtr != NULL)) {
Tcl_ListObjAppendElement(NULL,resultObj, Tcl_NewStringObj(
(char *)Tcl_GetHashKey(tablePtr, hPtr), -1));
(char *)Tcl_GetHashKey(tablePtr, hPtr), TCL_INDEX_NONE));
}
}
Tcl_SetObjResult(interp, resultObj);
@@ -1353,7 +1353,7 @@ TclNRPackageObjCmd(
* Create a new-style requirement for the exact version.
*/
ov = Tcl_NewStringObj(version, -1);
ov = Tcl_NewStringObj(version, TCL_INDEX_NONE);
Tcl_AppendStringsToObj(ov, "-", version, NULL);
version = NULL;
argv3 = TclGetString(objv[3]);
@@ -1399,12 +1399,12 @@ TclNRPackageObjCmd(
}
break;
case PKG_UNKNOWN: {
size_t length;
Tcl_Size length;
if (objc == 2) {
if (iPtr->packageUnknown != NULL) {
Tcl_SetObjResult(interp,
Tcl_NewStringObj(iPtr->packageUnknown, -1));
Tcl_NewStringObj(iPtr->packageUnknown, TCL_INDEX_NONE));
}
} else if (objc == 3) {
if (iPtr->packageUnknown != NULL) {
@@ -1456,7 +1456,7 @@ TclNRPackageObjCmd(
*/
Tcl_SetObjResult(interp,
Tcl_NewStringObj(pkgPreferOptions[iPtr->packagePrefer], -1));
Tcl_NewStringObj(pkgPreferOptions[iPtr->packagePrefer], TCL_INDEX_NONE));
break;
}
case PKG_VCOMPARE:
@@ -1503,7 +1503,7 @@ TclNRPackageObjCmd(
for (availPtr = pkgPtr->availPtr; availPtr != NULL;
availPtr = availPtr->nextPtr) {
Tcl_ListObjAppendElement(NULL, resultObj,
Tcl_NewStringObj(availPtr->version, -1));
Tcl_NewStringObj(availPtr->version, TCL_INDEX_NONE));
}
}
Tcl_SetObjResult(interp, resultObj);
@@ -1539,7 +1539,7 @@ TclNRPackageObjCmd(
static int
TclNRPackageObjCmdCleanup(
ClientData data[],
void *data[],
TCL_UNUSED(Tcl_Interp *),
int result)
{
@@ -2072,7 +2072,7 @@ AddRequirementsToResult(
{
Tcl_Obj *result = Tcl_GetObjResult(interp);
int i;
size_t length;
Tcl_Size length;
for (i = 0; i < reqc; i++) {
const char *v = Tcl_GetStringFromObj(reqv[i], &length);
+2 -2
View File
@@ -151,7 +151,7 @@ extern "C" {
EXTERN int Tcl_MacOSXOpenVersionedBundleResources(
Tcl_Interp *interp, const char *bundleName,
const char *bundleVersion,
int hasResourceFile, size_t maxPathLen,
int hasResourceFile, Tcl_Size maxPathLen,
char *libraryPath);
/* 2 */
EXTERN void Tcl_MacOSXNotifierAddRunLoopMode(
@@ -164,7 +164,7 @@ typedef struct TclPlatStubs {
void *hooks;
void (*reserved0)(void);
int (*tcl_MacOSXOpenVersionedBundleResources) (Tcl_Interp *interp, const char *bundleName, const char *bundleVersion, int hasResourceFile, size_t maxPathLen, char *libraryPath); /* 1 */
int (*tcl_MacOSXOpenVersionedBundleResources) (Tcl_Interp *interp, const char *bundleName, const char *bundleVersion, int hasResourceFile, Tcl_Size maxPathLen, char *libraryPath); /* 1 */
void (*tcl_MacOSXNotifierAddRunLoopMode) (const void *runLoopMode); /* 2 */
void (*tcl_WinConvertError) (unsigned errCode); /* 3 */
} TclPlatStubs;
+127 -64
View File
@@ -62,6 +62,9 @@ Tcl_ErrnoId(void)
#if defined(EALREADY) && (!defined(EBUSY) || (EALREADY != EBUSY))
case EALREADY: return "EALREADY";
#endif
#ifdef EBADCAT
case EBADCAT: return "EBADCAT";
#endif
#ifdef EBADE
case EBADE: return "EBADE";
#endif
@@ -74,9 +77,6 @@ Tcl_ErrnoId(void)
#ifdef EBADMSG
case EBADMSG: return "EBADMSG";
#endif
#ifdef ECANCELED
case ECANCELED: return "ECANCELED";
#endif
#ifdef EBADR
case EBADR: return "EBADR";
#endif
@@ -95,6 +95,12 @@ Tcl_ErrnoId(void)
#ifdef EBUSY
case EBUSY: return "EBUSY";
#endif
#ifdef ECANCELED
case ECANCELED: return "ECANCELED";
#endif
#ifdef ECASECLASH
case ECASECLASH: return "ECASECLASH";
#endif
#ifdef ECHILD
case ECHILD: return "ECHILD";
#endif
@@ -140,12 +146,18 @@ Tcl_ErrnoId(void)
#ifdef EEXIST
case EEXIST: return "EEXIST";
#endif
#ifdef EFAIL
case EFAIL: return "EFAIL";
#endif
#ifdef EFAULT
case EFAULT: return "EFAULT";
#endif
#ifdef EFBIG
case EFBIG: return "EFBIG";
#endif
#ifdef EFTYPE
case EFTYPE: return "EFTYPE";
#endif
#ifdef EHOSTDOWN
case EHOSTDOWN: return "EHOSTDOWN";
#endif
@@ -161,6 +173,9 @@ Tcl_ErrnoId(void)
#ifdef EILSEQ
case EILSEQ: return "EILSEQ";
#endif
#ifdef EINPROG
case EINPROG: return "EINPROG";
#endif
#ifdef EINPROGRESS
case EINPROGRESS: return "EINPROGRESS";
#endif
@@ -179,12 +194,9 @@ Tcl_ErrnoId(void)
#ifdef EISDIR
case EISDIR: return "EISDIR";
#endif
#ifdef EISNAME
#ifdef EISNAM
case EISNAM: return "EISNAM";
#endif
#ifdef ELBIN
case ELBIN: return "ELBIN";
#endif
#ifdef EL2HLT
case EL2HLT: return "EL2HLT";
#endif
@@ -197,6 +209,9 @@ Tcl_ErrnoId(void)
#ifdef EL3RST
case EL3RST: return "EL3RST";
#endif
#ifdef ELBIN
case ELBIN: return "ELBIN";
#endif
#ifdef ELIBACC
case ELIBACC: return "ELIBACC";
#endif
@@ -218,6 +233,9 @@ Tcl_ErrnoId(void)
#if defined(ELOOP) && (!defined(ENOENT) || (ELOOP != ENOENT))
case ELOOP: return "ELOOP";
#endif
#ifdef EMEDIUMTYPE
case EMEDIUMTYPE: return "EMEDIUMTYPE";
#endif
#ifdef EMFILE
case EMFILE: return "EMFILE";
#endif
@@ -236,9 +254,6 @@ Tcl_ErrnoId(void)
#ifdef ENAVAIL
case ENAVAIL: return "ENAVAIL";
#endif
#ifdef ENET
case ENET: return "ENET";
#endif
#ifdef ENETDOWN
case ENETDOWN: return "ENETDOWN";
#endif
@@ -251,6 +266,9 @@ Tcl_ErrnoId(void)
#ifdef ENFILE
case ENFILE: return "ENFILE";
#endif
#ifdef ENMFILE
case ENMFILE: return "ENMFILE";
#endif
#ifdef ENOANO
case ENOANO: return "ENOANO";
#endif
@@ -281,6 +299,9 @@ Tcl_ErrnoId(void)
#ifdef ENOMEM
case ENOMEM: return "ENOMEM";
#endif
#ifdef ENOMEDIUM
case ENOMEDIUM: return "ENOMEDIUM";
#endif
#ifdef ENOMSG
case ENOMSG: return "ENOMSG";
#endif
@@ -293,6 +314,9 @@ Tcl_ErrnoId(void)
#ifdef ENOPROTOOPT
case ENOPROTOOPT: return "ENOPROTOOPT";
#endif
#ifdef ENOSHARE
case ENOSHARE: return "ENOSHARE";
#endif
#ifdef ENOSPC
case ENOSPC: return "ENOSPC";
#endif
@@ -338,6 +362,9 @@ Tcl_ErrnoId(void)
#ifdef ENOTUNIQ
case ENOTUNIQ: return "ENOTUNIQ";
#endif
#ifdef ENWAIT
case ENWAIT: return "ENWAIT";
#endif
#ifdef ENXIO
case ENXIO: return "ENXIO";
#endif
@@ -404,6 +431,9 @@ Tcl_ErrnoId(void)
#ifdef EREMOTERELEASE
case EREMOTERELEASE: return "EREMOTERELEASE";
#endif
#ifdef ERESTART
case ERESTART: return "ERESTART";
#endif
#ifdef EROFS
case EROFS: return "EROFS";
#endif
@@ -519,34 +549,34 @@ Tcl_ErrnoMsg(
case EAGAIN: return "resource temporarily unavailable";
#endif
#ifdef EALIGN
case EALIGN: return "EALIGN";
case EALIGN: return "alignment error";
#endif
#if defined(EALREADY) && (!defined(EBUSY) || (EALREADY != EBUSY))
case EALREADY: return "operation already in progress";
#endif
#ifdef EBADCAT
case EBADCAT: return "bad message catalogue format";
#endif
#ifdef EBADE
case EBADE: return "bad exchange descriptor";
case EBADE: return "invalid exchange";
#endif
#ifdef EBADF
case EBADF: return "bad file number";
case EBADF: return "bad file descriptor";
#endif
#ifdef EBADFD
case EBADFD: return "file descriptor in bad state";
#endif
#ifdef EBADMSG
case EBADMSG: return "not a data message";
#endif
#ifdef ECANCELED
case ECANCELED: return "operation canceled";
case EBADMSG: return "bad message";
#endif
#ifdef EBADR
case EBADR: return "bad request descriptor";
case EBADR: return "invalid request descriptor";
#endif
#ifdef EBADRPC
case EBADRPC: return "RPC structure is bad";
#endif
#ifdef EBADRQC
case EBADRQC: return "bad request code";
case EBADRQC: return "invalid request code";
#endif
#ifdef EBADSLT
case EBADSLT: return "invalid slot";
@@ -555,10 +585,16 @@ Tcl_ErrnoMsg(
case EBFONT: return "bad font file format";
#endif
#ifdef EBUSY
case EBUSY: return "file busy";
case EBUSY: return "device or resource busy";
#endif
#ifdef ECANCELED
case ECANCELED: return "operation canceled";
#endif
#ifdef ECASECLASH
case ECASECLASH: return "filename exists with different case";
#endif
#ifdef ECHILD
case ECHILD: return "no children";
case ECHILD: return "no child processes";
#endif
#ifdef ECHRNG
case ECHRNG: return "channel number out of range";
@@ -588,7 +624,7 @@ Tcl_ErrnoMsg(
case EDIRTY: return "mounting a dirty fs w/o force";
#endif
#ifdef EDOM
case EDOM: return "math argument out of range";
case EDOM: return "numerical argument out of domain";
#endif
#ifdef EDOTDOT
case EDOTDOT: return "cross mount point";
@@ -600,19 +636,25 @@ Tcl_ErrnoMsg(
case EDUPPKG: return "duplicate package name";
#endif
#ifdef EEXIST
case EEXIST: return "file already exists";
case EEXIST: return "file exists";
#endif
#ifdef EFAIL
case EFAIL: return "cannot start operation";
#endif
#ifdef EFAULT
case EFAULT: return "bad address in system call argument";
case EFAULT: return "bad address";
#endif
#ifdef EFBIG
case EFBIG: return "file too large";
#endif
#ifdef EFTYPE
case EFTYPE: return "inappropriate file type or format";
#endif
#ifdef EHOSTDOWN
case EHOSTDOWN: return "host is down";
#endif
#ifdef EHOSTUNREACH
case EHOSTUNREACH: return "host is unreachable";
case EHOSTUNREACH: return "no route to host";
#endif
#if defined(EIDRM) && (!defined(EINPROGRESS) || (EIDRM != EINPROGRESS))
case EIDRM: return "identifier removed";
@@ -621,7 +663,10 @@ Tcl_ErrnoMsg(
case EINIT: return "initialization error";
#endif
#ifdef EILSEQ
case EILSEQ: return "illegal byte sequence";
case EILSEQ: return "invalid or incomplete multibyte or wide character";
#endif
#ifdef EINPROG
case EINPROG: return "asynchronous operation in progress";
#endif
#ifdef EINPROGRESS
case EINPROGRESS: return "operation now in progress";
@@ -633,19 +678,16 @@ Tcl_ErrnoMsg(
case EINVAL: return "invalid argument";
#endif
#ifdef EIO
case EIO: return "I/O error";
case EIO: return "input/output error";
#endif
#ifdef EISCONN
case EISCONN: return "socket is already connected";
case EISCONN: return "transport endpoint is already connected";
#endif
#ifdef EISDIR
case EISDIR: return "illegal operation on a directory";
case EISDIR: return "is a directory";
#endif
#ifdef EISNAME
case EISNAM: return "is a name file";
#endif
#ifdef ELBIN
case ELBIN: return "ELBIN";
#ifdef EISNAM
case EISNAM: return "is a named type file";
#endif
#ifdef EL2HLT
case EL2HLT: return "level 2 halted";
@@ -659,8 +701,11 @@ Tcl_ErrnoMsg(
#ifdef EL3RST
case EL3RST: return "level 3 reset";
#endif
#ifdef ELBIN
case ELBIN: return "inode is remote";
#endif
#ifdef ELIBACC
case ELIBACC: return "cannot access a needed shared library";
case ELIBACC: return "can not access a needed shared library";
#endif
#ifdef ELIBBAD
case ELIBBAD: return "accessing a corrupted shared library";
@@ -670,7 +715,7 @@ Tcl_ErrnoMsg(
#endif
#if defined(ELIBMAX) && (!defined(ECANCELED) || (ELIBMAX != ECANCELED))
case ELIBMAX: return
"attempting to link in more shared libraries than system limit";
"attempting to link in too many shared libraries";
#endif
#ifdef ELIBSCN
case ELIBSCN: return ".lib section in a.out corrupted";
@@ -681,6 +726,9 @@ Tcl_ErrnoMsg(
#if defined(ELOOP) && (!defined(ENOENT) || (ELOOP != ENOENT))
case ELOOP: return "too many levels of symbolic links";
#endif
#ifdef EMEDIUMTYPE
case EMEDIUMTYPE: return "wrong medium type";
#endif
#ifdef EMFILE
case EMFILE: return "too many open files";
#endif
@@ -699,9 +747,6 @@ Tcl_ErrnoMsg(
#ifdef ENAVAIL
case ENAVAIL: return "not available";
#endif
#ifdef ENET
case ENET: return "ENET";
#endif
#ifdef ENETDOWN
case ENETDOWN: return "network is down";
#endif
@@ -712,10 +757,13 @@ Tcl_ErrnoMsg(
case ENETUNREACH: return "network is unreachable";
#endif
#ifdef ENFILE
case ENFILE: return "file table overflow";
case ENFILE: return "too many open files in system";
#endif
#ifdef ENMFILE
case ENMFILE: return "no more files";
#endif
#ifdef ENOANO
case ENOANO: return "anode table overflow";
case ENOANO: return "no anode";
#endif
#if defined(ENOBUFS) && (!defined(ENOSR) || (ENOBUFS != ENOSR))
case ENOBUFS: return "no buffer space available";
@@ -742,7 +790,10 @@ Tcl_ErrnoMsg(
case ENOLINK: return "link has been severed";
#endif
#ifdef ENOMEM
case ENOMEM: return "not enough memory";
case ENOMEM: return "cannot allocate memory";
#endif
#ifdef ENOMEDIUM
case ENOMEDIUM: return "no medium found";
#endif
#ifdef ENOMSG
case ENOMSG: return "no message of desired type";
@@ -754,16 +805,19 @@ Tcl_ErrnoMsg(
case ENOPKG: return "package not installed";
#endif
#ifdef ENOPROTOOPT
case ENOPROTOOPT: return "bad protocol option";
case ENOPROTOOPT: return "protocol not available";
#endif
#ifdef ENOSHARE
case ENOSHARE: return "no such host or network path";
#endif
#ifdef ENOSPC
case ENOSPC: return "no space left on device";
#endif
#if defined(ENOSR) && (!defined(ENAMETOOLONG) || (ENAMETOOLONG != ENOSR))
case ENOSR: return "out of stream resources";
case ENOSR: return "out of streams resources";
#endif
#if defined(ENOSTR) && (!defined(ENOTTY) || (ENOTTY != ENOSTR))
case ENOSTR: return "not a stream device";
case ENOSTR: return "device not a stream";
#endif
#ifdef ENOSYM
case ENOSYM: return "unresolved symbol name";
@@ -775,10 +829,7 @@ Tcl_ErrnoMsg(
case ENOTBLK: return "block device required";
#endif
#ifdef ENOTCONN
case ENOTCONN: return "socket is not connected";
#endif
#ifdef ENOTRECOVERABLE
case ENOTRECOVERABLE: return "state not recoverable";
case ENOTCONN: return "transport endpoint is not connected";
#endif
#ifdef ENOTDIR
case ENOTDIR: return "not a directory";
@@ -789,6 +840,9 @@ Tcl_ErrnoMsg(
#ifdef ENOTNAM
case ENOTNAM: return "not a name file";
#endif
#ifdef ENOTRECOVERABLE
case ENOTRECOVERABLE: return "state not recoverable";
#endif
#ifdef ENOTSOCK
case ENOTSOCK: return "socket operation on non-socket";
#endif
@@ -796,11 +850,14 @@ Tcl_ErrnoMsg(
case ENOTSUP: return "operation not supported";
#endif
#ifdef ENOTTY
case ENOTTY: return "inappropriate device for ioctl";
case ENOTTY: return "inappropriate ioctl for device";
#endif
#ifdef ENOTUNIQ
case ENOTUNIQ: return "name not unique on network";
#endif
#ifdef ENWAIT
case ENWAIT: return "No waiting processes";
#endif
#ifdef ENXIO
case ENXIO: return "no such device or address";
#endif
@@ -811,13 +868,13 @@ Tcl_ErrnoMsg(
case EOTHER: return "other error";
#endif
#if defined(EOVERFLOW) && (!defined(EFBIG) || (EOVERFLOW != EFBIG)) && (!defined(EINVAL) || (EOVERFLOW != EINVAL))
case EOVERFLOW: return "file too big";
case EOVERFLOW: return "value too large for defined data type";
#endif
#ifdef EOWNERDEAD
case EOWNERDEAD: return "owner died";
#endif
#ifdef EPERM
case EPERM: return "not owner";
case EPERM: return "operation not permitted";
#endif
#if defined(EPFNOSUPPORT) && (!defined(ENOLCK) || (ENOLCK != EPFNOSUPPORT))
case EPFNOSUPPORT: return "protocol family not supported";
@@ -847,10 +904,10 @@ Tcl_ErrnoMsg(
case EPROTOTYPE: return "protocol wrong type for socket";
#endif
#ifdef ERANGE
case ERANGE: return "math result unrepresentable";
case ERANGE: return "numerical result out of range";
#endif
#if defined(EREFUSED) && (!defined(ECONNREFUSED) || (EREFUSED != ECONNREFUSED))
case EREFUSED: return "EREFUSED";
case EREFUSED: return "connection refused";
#endif
#ifdef EREMCHG
case EREMCHG: return "remote address changed";
@@ -859,13 +916,16 @@ Tcl_ErrnoMsg(
case EREMDEV: return "remote device";
#endif
#ifdef EREMOTE
case EREMOTE: return "pathname hit remote file system";
case EREMOTE: return "object is remote";
#endif
#ifdef EREMOTEIO
case EREMOTEIO: return "remote i/o error";
case EREMOTEIO: return "remote I/O error";
#endif
#ifdef EREMOTERELEASE
case EREMOTERELEASE: return "EREMOTERELEASE";
case EREMOTERELEASE: return "remote peer released connection";
#endif
#ifdef ERESTART
case ERESTART: return "interrupted system call should be restarted";
#endif
#ifdef EROFS
case EROFS: return "read-only file system";
@@ -877,13 +937,13 @@ Tcl_ErrnoMsg(
case ERREMOTE: return "object is remote";
#endif
#ifdef ESHUTDOWN
case ESHUTDOWN: return "cannot send after socket shutdown";
case ESHUTDOWN: return "cannot send after transport endpoint shutdown";
#endif
#ifdef ESOCKTNOSUPPORT
case ESOCKTNOSUPPORT: return "socket type not supported";
#endif
#ifdef ESPIPE
case ESPIPE: return "invalid seek";
case ESPIPE: return "illegal seek";
#endif
#ifdef ESRCH
case ESRCH: return "no such process";
@@ -892,10 +952,13 @@ Tcl_ErrnoMsg(
case ESRMNT: return "srmount error";
#endif
#ifdef ESTALE
case ESTALE: return "stale remote file handle";
case ESTALE: return "stale file handle";
#endif
#ifdef ESTRPIPE
case ESTRPIPE: return "streams pipe error";
#endif
#ifdef ESUCCESS
case ESUCCESS: return "Error 0";
case ESUCCESS: return "success";
#endif
#if defined(ETIME) && (!defined(ELOOP) || (ETIME != ELOOP))
case ETIME: return "timer expired";
@@ -907,7 +970,7 @@ Tcl_ErrnoMsg(
case ETOOMANYREFS: return "too many references: cannot splice";
#endif
#ifdef ETXTBSY
case ETXTBSY: return "text file or pseudo-device busy";
case ETXTBSY: return "text file busy";
#endif
#ifdef EUCLEAN
case EUCLEAN: return "structure needs cleaning";
@@ -925,10 +988,10 @@ Tcl_ErrnoMsg(
case EWOULDBLOCK: return "operation would block";
#endif
#ifdef EXDEV
case EXDEV: return "cross-domain link";
case EXDEV: return "invalid cross-device link";
#endif
#ifdef EXFULL
case EXFULL: return "message tables full";
case EXFULL: return "exchange full";
#endif
default:
#ifdef NO_STRERROR
+4 -4
View File
@@ -21,7 +21,7 @@
*/
typedef struct {
ClientData clientData; /* Address of preserved block. */
void *clientData; /* Address of preserved block. */
size_t refCount; /* Number of Tcl_Preserve calls in effect for
* block. */
int mustFree; /* Non-zero means Tcl_EventuallyFree was
@@ -117,7 +117,7 @@ TclFinalizePreserve(void)
void
Tcl_Preserve(
ClientData clientData) /* Pointer to malloc'ed block of memory. */
void *clientData) /* Pointer to malloc'ed block of memory. */
{
Reference *refPtr;
size_t i;
@@ -180,7 +180,7 @@ Tcl_Preserve(
void
Tcl_Release(
ClientData clientData) /* Pointer to malloc'ed block of memory. */
void *clientData) /* Pointer to malloc'ed block of memory. */
{
Reference *refPtr;
size_t i;
@@ -259,7 +259,7 @@ Tcl_Release(
void
Tcl_EventuallyFree(
ClientData clientData, /* Pointer to malloc'ed block of memory. */
void *clientData, /* Pointer to malloc'ed block of memory. */
Tcl_FreeProc *freeProc) /* Function to actually do free. */
{
Reference *refPtr;
+18 -10
View File
@@ -524,9 +524,9 @@ TclCreateProc(
}
if (fieldCount > 2) {
Tcl_Obj *errorObj = Tcl_NewStringObj(
"too many fields in argument specifier \"", -1);
"too many fields in argument specifier \"", TCL_INDEX_NONE);
Tcl_AppendObjToObj(errorObj, argArray[i]);
Tcl_AppendToObj(errorObj, "\"", -1);
Tcl_AppendToObj(errorObj, "\"", TCL_INDEX_NONE);
Tcl_SetObjResult(interp, errorObj);
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC",
"FORMALARGUMENTFORMAT", NULL);
@@ -534,7 +534,7 @@ TclCreateProc(
}
if ((fieldCount == 0) || (Tcl_GetCharLength(fieldValues[0]) == 0)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"argument with no name", -1));
"argument with no name", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC",
"FORMALARGUMENTFORMAT", NULL);
goto procError;
@@ -560,9 +560,9 @@ TclCreateProc(
}
} else if (*argnamei == ':' && *(argnamei+1) == ':') {
Tcl_Obj *errorObj = Tcl_NewStringObj(
"formal parameter \"", -1);
"formal parameter \"", TCL_INDEX_NONE);
Tcl_AppendObjToObj(errorObj, fieldValues[0]);
Tcl_AppendToObj(errorObj, "\" is not a simple name", -1);
Tcl_AppendToObj(errorObj, "\" is not a simple name", TCL_INDEX_NONE);
Tcl_SetObjResult(interp, errorObj);
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC",
"FORMALARGUMENTFORMAT", NULL);
@@ -613,7 +613,7 @@ TclCreateProc(
"procedure \"%s\": formal parameter \"", procName);
Tcl_AppendObjToObj(errorObj, fieldValues[0]);
Tcl_AppendToObj(errorObj, "\" has "
"default value inconsistent with precompiled body", -1);
"default value inconsistent with precompiled body", TCL_INDEX_NONE);
Tcl_SetObjResult(interp, errorObj);
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC",
"BYTECODELIES", NULL);
@@ -1080,7 +1080,7 @@ ProcWrongNumArgs(
sizeof(Tcl_Obj *) * (numArgs+1));
if (framePtr->isProcCallFrame & FRAME_IS_LAMBDA) {
desiredObjs[0] = Tcl_NewStringObj("lambdaExpr", -1);
desiredObjs[0] = Tcl_NewStringObj("lambdaExpr", TCL_INDEX_NONE);
} else {
desiredObjs[0] = framePtr->objv[skip-1];
}
@@ -1298,7 +1298,7 @@ InitLocalCache(
*namePtr = NULL;
} else {
*namePtr = TclCreateLiteral(iPtr, localPtr->name,
localPtr->nameLength, /* hash */ (size_t) -1,
localPtr->nameLength, /* hash */ TCL_INDEX_NONE,
&isNew, /* nsPtr */ NULL, 0, NULL);
Tcl_IncrRefCount(*namePtr);
}
@@ -1941,7 +1941,7 @@ TclProcCompileProc(
if (codePtr->flags & TCL_BYTECODE_PRECOMPILED) {
if ((Interp *) *codePtr->interpHandle != iPtr) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"a precompiled script jumped interps", -1));
"a precompiled script jumped interps", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC",
"CROSSINTERPBYTECODE", NULL);
return TCL_ERROR;
@@ -1969,7 +1969,7 @@ TclProcCompileProc(
TclNewLiteralStringObj(message, "Compiling ");
Tcl_IncrRefCount(message);
Tcl_AppendStringsToObj(message, description, " \"", NULL);
Tcl_AppendLimitedToObj(message, procName, -1, 50, NULL);
Tcl_AppendLimitedToObj(message, procName, TCL_INDEX_NONE, 50, NULL);
fprintf(stdout, "%s\"\n", TclGetString(message));
Tcl_DecrRefCount(message);
}
@@ -2456,6 +2456,14 @@ SetLambdaFromAny(
* length is not 2, then it cannot be converted to lambdaType.
*/
result = TclListObjLengthM(NULL, objPtr, &objc);
if ((result != TCL_OK) || ((objc != 2) && (objc != 3))) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't interpret \"%s\" as a lambda expression",
Tcl_GetString(objPtr)));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "LAMBDA", NULL);
return TCL_ERROR;
}
result = TclListObjGetElementsM(NULL, objPtr, &objc, &objv);
if ((result != TCL_OK) || ((objc != 2) && (objc != 3))) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+16 -16
View File
@@ -233,9 +233,9 @@ WaitProcessStatus(
if (msgObjPtr) *msgObjPtr = Tcl_ObjPrintf(
"error waiting for process to exit: %s", msg);
if (errorObjPtr) {
errorStrings[0] = Tcl_NewStringObj("POSIX", -1);
errorStrings[1] = Tcl_NewStringObj(Tcl_ErrnoId(), -1);
errorStrings[2] = Tcl_NewStringObj(msg, -1);
errorStrings[0] = Tcl_NewStringObj("POSIX", TCL_INDEX_NONE);
errorStrings[1] = Tcl_NewStringObj(Tcl_ErrnoId(), TCL_INDEX_NONE);
errorStrings[2] = Tcl_NewStringObj(msg, TCL_INDEX_NONE);
*errorObjPtr = Tcl_NewListObj(3, errorStrings);
}
return TCL_PROCESS_ERROR;
@@ -256,9 +256,9 @@ WaitProcessStatus(
*/
if (msgObjPtr) *msgObjPtr = Tcl_NewStringObj(
"child process exited abnormally", -1);
"child process exited abnormally", TCL_INDEX_NONE);
if (errorObjPtr) {
errorStrings[0] = Tcl_NewStringObj("CHILDSTATUS", -1);
errorStrings[0] = Tcl_NewStringObj("CHILDSTATUS", TCL_INDEX_NONE);
TclNewIntObj(errorStrings[1], resolvedPid);
TclNewIntObj(errorStrings[2], WEXITSTATUS(waitStatus));
*errorObjPtr = Tcl_NewListObj(3, errorStrings);
@@ -277,10 +277,10 @@ WaitProcessStatus(
if (msgObjPtr) *msgObjPtr = Tcl_ObjPrintf(
"child killed: %s", msg);
if (errorObjPtr) {
errorStrings[0] = Tcl_NewStringObj("CHILDKILLED", -1);
errorStrings[0] = Tcl_NewStringObj("CHILDKILLED", TCL_INDEX_NONE);
TclNewIntObj(errorStrings[1], resolvedPid);
errorStrings[2] = Tcl_NewStringObj(Tcl_SignalId(WTERMSIG(waitStatus)), -1);
errorStrings[3] = Tcl_NewStringObj(msg, -1);
errorStrings[2] = Tcl_NewStringObj(Tcl_SignalId(WTERMSIG(waitStatus)), TCL_INDEX_NONE);
errorStrings[3] = Tcl_NewStringObj(msg, TCL_INDEX_NONE);
*errorObjPtr = Tcl_NewListObj(4, errorStrings);
}
return TCL_PROCESS_SIGNALED;
@@ -296,10 +296,10 @@ WaitProcessStatus(
if (msgObjPtr) *msgObjPtr = Tcl_ObjPrintf(
"child suspended: %s", msg);
if (errorObjPtr) {
errorStrings[0] = Tcl_NewStringObj("CHILDSUSP", -1);
errorStrings[0] = Tcl_NewStringObj("CHILDSUSP", TCL_INDEX_NONE);
TclNewIntObj(errorStrings[1], resolvedPid);
errorStrings[2] = Tcl_NewStringObj(Tcl_SignalId(WSTOPSIG(waitStatus)), -1);
errorStrings[3] = Tcl_NewStringObj(msg, -1);
errorStrings[2] = Tcl_NewStringObj(Tcl_SignalId(WSTOPSIG(waitStatus)), TCL_INDEX_NONE);
errorStrings[3] = Tcl_NewStringObj(msg, TCL_INDEX_NONE);
*errorObjPtr = Tcl_NewListObj(4, errorStrings);
}
return TCL_PROCESS_STOPPED;
@@ -312,12 +312,12 @@ WaitProcessStatus(
if (codePtr) *codePtr = waitStatus;
if (msgObjPtr) *msgObjPtr = Tcl_NewStringObj(
"child wait status didn't make sense\n", -1);
"child wait status didn't make sense\n", TCL_INDEX_NONE);
if (errorObjPtr) {
errorStrings[0] = Tcl_NewStringObj("TCL", -1);
errorStrings[1] = Tcl_NewStringObj("OPERATION", -1);
errorStrings[2] = Tcl_NewStringObj("EXEC", -1);
errorStrings[3] = Tcl_NewStringObj("ODDWAITRESULT", -1);
errorStrings[0] = Tcl_NewStringObj("TCL", TCL_INDEX_NONE);
errorStrings[1] = Tcl_NewStringObj("OPERATION", TCL_INDEX_NONE);
errorStrings[2] = Tcl_NewStringObj("EXEC", TCL_INDEX_NONE);
errorStrings[3] = Tcl_NewStringObj("ODDWAITRESULT", TCL_INDEX_NONE);
TclNewIntObj(errorStrings[4], resolvedPid);
*errorObjPtr = Tcl_NewListObj(5, errorStrings);
}
+15 -15
View File
@@ -221,9 +221,9 @@ Tcl_RegExpExec(
*/
Tcl_DStringInit(&ds);
ustr = Tcl_UtfToUniCharDString(text, -1, &ds);
ustr = Tcl_UtfToUniCharDString(text, TCL_INDEX_NONE, &ds);
numChars = Tcl_DStringLength(&ds) / sizeof(Tcl_UniChar);
result = RegExpExecUniChar(interp, re, ustr, numChars, -1 /* nmatches */,
result = RegExpExecUniChar(interp, re, ustr, numChars, TCL_INDEX_NONE /* nmatches */,
flags);
Tcl_DStringFree(&ds);
@@ -253,7 +253,7 @@ void
Tcl_RegExpRange(
Tcl_RegExp re, /* Compiled regular expression that has been
* passed to Tcl_RegExpExec. */
size_t index, /* 0 means give the range of the entire match,
Tcl_Size index, /* 0 means give the range of the entire match,
* > 0 means give the range of a matching
* subrange. */
const char **startPtr, /* Store address of first character in
@@ -266,7 +266,7 @@ Tcl_RegExpRange(
if (index > regexpPtr->re.re_nsub) {
*startPtr = *endPtr = NULL;
} else if (regexpPtr->matches[index].rm_so == TCL_INDEX_NONE) {
} else if (TCL_SIZE_ISNEG(regexpPtr->matches[index].rm_so)) {
*startPtr = *endPtr = NULL;
} else {
if (regexpPtr->objPtr) {
@@ -363,18 +363,18 @@ void
TclRegExpRangeUniChar(
Tcl_RegExp re, /* Compiled regular expression that has been
* passed to Tcl_RegExpExec. */
size_t index, /* 0 means give the range of the entire match,
Tcl_Size index, /* 0 means give the range of the entire match,
* > 0 means give the range of a matching
* subrange, TCL_INDEX_NONE means the range of the
* rm_extend field. */
size_t *startPtr, /* Store address of first character in
Tcl_Size *startPtr, /* Store address of first character in
* (sub-)range here. */
size_t *endPtr) /* Store address of character just after last
Tcl_Size *endPtr) /* Store address of character just after last
* in (sub-)range here. */
{
TclRegexp *regexpPtr = (TclRegexp *) re;
if ((regexpPtr->flags&REG_EXPECT) && (index == TCL_INDEX_NONE)) {
if ((regexpPtr->flags&REG_EXPECT) && TCL_SIZE_ISNEG(index)) {
*startPtr = regexpPtr->details.rm_extend.rm_so;
*endPtr = regexpPtr->details.rm_extend.rm_eo;
} else if (index + 1 > regexpPtr->re.re_nsub + 1) {
@@ -443,16 +443,16 @@ Tcl_RegExpExecObj(
* returned by previous call to
* Tcl_GetRegExpFromObj. */
Tcl_Obj *textObj, /* Text against which to match re. */
size_t offset, /* Character index that marks where matching
Tcl_Size offset, /* Character index that marks where matching
* should begin. */
size_t nmatches, /* How many subexpression matches (counting
Tcl_Size nmatches, /* How many subexpression matches (counting
* the whole match as subexpression 0) are of
* interest. -1 means all of them. */
* interest. TCL_INDEX_NONE means all of them. */
int flags) /* Regular expression execution flags. */
{
TclRegexp *regexpPtr = (TclRegexp *) re;
Tcl_UniChar *udata;
size_t length;
Tcl_Size length;
int reflags = regexpPtr->flags;
#define TCL_REG_GLOBOK_FLAGS \
(TCL_REG_ADVANCED | TCL_REG_NOSUB | TCL_REG_NOCASE)
@@ -689,7 +689,7 @@ TclRegAbout(
for (inf=infonames ; inf->bit != 0 ; inf++) {
if (regexpPtr->re.re_info & inf->bit) {
Tcl_ListObjAppendElement(NULL, infoObj,
Tcl_NewStringObj(inf->text, -1));
Tcl_NewStringObj(inf->text, TCL_INDEX_NONE));
}
}
Tcl_ListObjAppendElement(NULL, resultObj, infoObj);
@@ -730,7 +730,7 @@ TclRegError(
p = (n > sizeof(buf)) ? "..." : "";
Tcl_SetObjResult(interp, Tcl_ObjPrintf("%s%s%s", msg, buf, p));
sprintf(cbuf, "%d", status);
snprintf(cbuf, sizeof(cbuf), "%d", status);
(void) TclReError(REG_ITOA, cbuf, sizeof(cbuf));
Tcl_SetErrorCode(interp, "REGEXP", cbuf, buf, NULL);
}
@@ -960,7 +960,7 @@ CompileRegexp(
if (TclReToGlob(NULL, string, length, &stringBuf, &exact,
NULL) == TCL_OK) {
regexpPtr->globObjPtr = TclDStringToObj(&stringBuf);
regexpPtr->globObjPtr = Tcl_DStringToObj(&stringBuf);
Tcl_IncrRefCount(regexpPtr->globObjPtr);
} else {
regexpPtr->globObjPtr = NULL;
+7 -7
View File
@@ -317,7 +317,7 @@ Tcl_AppendResult(
if (bytes == NULL) {
break;
}
Tcl_AppendToObj(objPtr, bytes, -1);
Tcl_AppendToObj(objPtr, bytes, TCL_INDEX_NONE);
}
Tcl_SetObjResult(interp, objPtr);
va_end(argList);
@@ -354,10 +354,10 @@ Tcl_AppendElement(
* to result. */
{
Interp *iPtr = (Interp *) interp;
Tcl_Obj *elementPtr = Tcl_NewStringObj(element, -1);
Tcl_Obj *elementPtr = Tcl_NewStringObj(element, TCL_INDEX_NONE);
Tcl_Obj *listPtr = Tcl_NewListObj(1, &elementPtr);
const char *bytes;
size_t length;
Tcl_Size length;
if (Tcl_IsShared(iPtr->objResultPtr)) {
Tcl_SetObjResult(interp, Tcl_DuplicateObj(iPtr->objResultPtr));
@@ -511,7 +511,7 @@ Tcl_SetErrorCode(
if (elem == NULL) {
break;
}
Tcl_ListObjAppendElement(NULL, errorObj, Tcl_NewStringObj(elem, -1));
Tcl_ListObjAppendElement(NULL, errorObj, Tcl_NewStringObj(elem, TCL_INDEX_NONE));
}
Tcl_SetObjErrorCode(interp, errorObj);
va_end(argList);
@@ -721,7 +721,7 @@ TclProcessReturn(
Tcl_DictObjGet(NULL, iPtr->returnOpts, keys[KEY_ERRORINFO],
&valuePtr);
if (valuePtr != NULL) {
size_t length;
Tcl_Size length;
(void) Tcl_GetStringFromObj(valuePtr, &length);
if (length) {
@@ -910,7 +910,7 @@ TclMergeReturnOptions(
Tcl_DictObjGet(NULL, returnOpts, keys[KEY_ERRORCODE], &valuePtr);
if (valuePtr != NULL) {
size_t length;
Tcl_Size length;
if (TCL_ERROR == TclListObjLengthM(NULL, valuePtr, &length )) {
/*
@@ -932,7 +932,7 @@ TclMergeReturnOptions(
Tcl_DictObjGet(NULL, returnOpts, keys[KEY_ERRORSTACK], &valuePtr);
if (valuePtr != NULL) {
size_t length;
Tcl_Size length;
if (TCL_ERROR == TclListObjLengthM(NULL, valuePtr, &length)) {
/*
+14 -14
View File
@@ -397,9 +397,9 @@ ValidateFormat(
invalidFieldSize:
buf[Tcl_UniCharToUtf(ch, buf)] = '\0';
errorMsg = Tcl_NewStringObj(
"field size modifier may not be specified in %", -1);
Tcl_AppendToObj(errorMsg, buf, -1);
Tcl_AppendToObj(errorMsg, " conversion", -1);
"field size modifier may not be specified in %", TCL_INDEX_NONE);
Tcl_AppendToObj(errorMsg, buf, TCL_INDEX_NONE);
Tcl_AppendToObj(errorMsg, " conversion", TCL_INDEX_NONE);
Tcl_SetObjResult(interp, errorMsg);
Tcl_SetErrorCode(interp, "TCL", "FORMAT", "BADSIZE", NULL);
goto error;
@@ -452,15 +452,15 @@ ValidateFormat(
break;
badSet:
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"unmatched [ in format string", -1));
"unmatched [ in format string", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "FORMAT", "BRACKET", NULL);
goto error;
default:
buf[Tcl_UniCharToUtf(ch, buf)] = '\0';
errorMsg = Tcl_NewStringObj(
"bad scan conversion character \"", -1);
Tcl_AppendToObj(errorMsg, buf, -1);
Tcl_AppendToObj(errorMsg, "\"", -1);
"bad scan conversion character \"", TCL_INDEX_NONE);
Tcl_AppendToObj(errorMsg, buf, TCL_INDEX_NONE);
Tcl_AppendToObj(errorMsg, "\"", TCL_INDEX_NONE);
Tcl_SetObjResult(interp, errorMsg);
Tcl_SetErrorCode(interp, "TCL", "FORMAT", "BADTYPE", NULL);
goto error;
@@ -531,7 +531,7 @@ ValidateFormat(
badIndex:
if (gotXpg) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"\"%n$\" argument index out of range", -1));
"\"%n$\" argument index out of range", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "FORMAT", "INDEXRANGE", NULL);
} else {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
@@ -926,7 +926,7 @@ Tcl_ScanObjCmd(
mp_int big;
if (mp_init_u64(&big, (Tcl_WideUInt)wideValue) != MP_OKAY) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"insufficient memory to create bignum", -1));
"insufficient memory to create bignum", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL);
return TCL_ERROR;
} else {
@@ -953,7 +953,7 @@ Tcl_ScanObjCmd(
}
Tcl_DecrRefCount(objPtr);
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"unsigned bignum scans are invalid", -1));
"unsigned bignum scans are invalid", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "FORMAT",
"BADUNSIGNED",NULL);
return TCL_ERROR;
@@ -972,7 +972,7 @@ Tcl_ScanObjCmd(
mp_int big;
if (mp_init_u64(&big, (unsigned long)value) != MP_OKAY) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"insufficient memory to create bignum", -1));
"insufficient memory to create bignum", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL);
return TCL_ERROR;
} else {
@@ -993,7 +993,7 @@ Tcl_ScanObjCmd(
* Scan a floating point number
*/
objPtr = Tcl_NewDoubleObj(0.0);
TclNewDoubleObj(objPtr, 0.0);
Tcl_IncrRefCount(objPtr);
if (width == 0) {
width = ~0;
@@ -1019,7 +1019,7 @@ Tcl_ScanObjCmd(
if (Tcl_GetDoubleFromObj(NULL, objPtr, &dvalue) != TCL_OK) {
#ifdef ACCEPT_NAN
const Tcl_ObjInternalRep *irPtr
= TclFetchInternalRep(objPtr, &tclDoubleType);
= TclFetchInternalRep(objPtr, &tclDoubleType.objType);
if (irPtr) {
dvalue = irPtr->doubleValue;
} else
@@ -1090,7 +1090,7 @@ Tcl_ScanObjCmd(
if (code == TCL_OK) {
if (underflow && (nconversions == 0)) {
if (numVars) {
TclNewIndexObj(objPtr, TCL_INDEX_NONE);
TclNewIntObj(objPtr, -1);
} else {
if (objPtr) {
Tcl_SetListObj(objPtr, 0, NULL);
+40 -39
View File
@@ -261,34 +261,35 @@ static const int log2pow5[27] = {
};
#define N_LOG2POW5 27
static const Tcl_WideUInt wuipow5[27] = {
(Tcl_WideUInt) 1, /* 5**0 */
(Tcl_WideUInt) 5,
(Tcl_WideUInt) 25,
(Tcl_WideUInt) 125,
(Tcl_WideUInt) 625,
(Tcl_WideUInt) 3125, /* 5**5 */
(Tcl_WideUInt) 3125*5,
(Tcl_WideUInt) 3125*25,
(Tcl_WideUInt) 3125*125,
(Tcl_WideUInt) 3125*625,
(Tcl_WideUInt) 3125*3125, /* 5**10 */
(Tcl_WideUInt) 3125*3125*5,
(Tcl_WideUInt) 3125*3125*25,
(Tcl_WideUInt) 3125*3125*125,
(Tcl_WideUInt) 3125*3125*625,
(Tcl_WideUInt) 3125*3125*3125, /* 5**15 */
(Tcl_WideUInt) 3125*3125*3125*5,
(Tcl_WideUInt) 3125*3125*3125*25,
(Tcl_WideUInt) 3125*3125*3125*125,
(Tcl_WideUInt) 3125*3125*3125*625,
(Tcl_WideUInt) 3125*3125*3125*3125, /* 5**20 */
(Tcl_WideUInt) 3125*3125*3125*3125*5,
(Tcl_WideUInt) 3125*3125*3125*3125*25,
(Tcl_WideUInt) 3125*3125*3125*3125*125,
(Tcl_WideUInt) 3125*3125*3125*3125*625,
(Tcl_WideUInt) 3125*3125*3125*3125*3125, /* 5**25 */
(Tcl_WideUInt) 3125*3125*3125*3125*3125*5 /* 5**26 */
static const Tcl_WideUInt wuipow5[] = {
(Tcl_WideUInt) 1U, /* 5**0 */
(Tcl_WideUInt) 5U,
(Tcl_WideUInt) 25U,
(Tcl_WideUInt) 125U,
(Tcl_WideUInt) 625U,
(Tcl_WideUInt) 3125U, /* 5**5 */
(Tcl_WideUInt) 3125U*5U,
(Tcl_WideUInt) 3125U*25U,
(Tcl_WideUInt) 3125U*125U,
(Tcl_WideUInt) 3125U*625U,
(Tcl_WideUInt) 3125U*3125U, /* 5**10 */
(Tcl_WideUInt) 3125U*3125U*5U,
(Tcl_WideUInt) 3125U*3125U*25U,
(Tcl_WideUInt) 3125U*3125U*125U,
(Tcl_WideUInt) 3125U*3125U*625U,
(Tcl_WideUInt) 3125U*3125U*3125U, /* 5**15 */
(Tcl_WideUInt) 3125U*3125U*3125U*5U,
(Tcl_WideUInt) 3125U*3125U*3125U*25U,
(Tcl_WideUInt) 3125U*3125U*3125U*125U,
(Tcl_WideUInt) 3125U*3125U*3125U*625U,
(Tcl_WideUInt) 3125U*3125U*3125U*3125U, /* 5**20 */
(Tcl_WideUInt) 3125U*3125U*3125U*3125U*5U,
(Tcl_WideUInt) 3125U*3125U*3125U*3125U*25U,
(Tcl_WideUInt) 3125U*3125U*3125U*3125U*125U,
(Tcl_WideUInt) 3125U*3125U*3125U*3125U*625U,
(Tcl_WideUInt) 3125U*3125U*3125U*3125U*3125U, /* 5**25 */
(Tcl_WideUInt) 3125U*3125U*3125U*3125U*3125U*5U,
(Tcl_WideUInt) 3125U*3125U*3125U*3125U*3125U*25U /* 5**27 */
};
/*
@@ -554,7 +555,7 @@ TclParseNumber(
/* A dict can never be a (single) number */
return TCL_ERROR;
}
if (TclHasInternalRep(objPtr, &tclListType)) {
if (TclHasInternalRep(objPtr, &tclListType.objType)) {
size_t length;
/* A list can only be a (single) number if its length == 1 */
TclListObjLengthM(NULL, objPtr, &length);
@@ -1377,7 +1378,7 @@ TclParseNumber(
octalSignificandWide);
octalSignificandOverflow = 1;
} else {
objPtr->typePtr = &tclIntType;
objPtr->typePtr = &tclIntType.objType;
if (signum) {
objPtr->internalRep.wideValue =
(Tcl_WideInt)(-octalSignificandWide);
@@ -1413,7 +1414,7 @@ TclParseNumber(
significandWide);
significandOverflow = 1;
} else {
objPtr->typePtr = &tclIntType;
objPtr->typePtr = &tclIntType.objType;
if (signum) {
objPtr->internalRep.wideValue =
(Tcl_WideInt)(-significandWide);
@@ -1445,7 +1446,7 @@ TclParseNumber(
* k = numTrailZeros+exponent-numDigitsAfterDp.
*/
objPtr->typePtr = &tclDoubleType;
objPtr->typePtr = &tclDoubleType.objType;
if (exponentSignum) {
/*
* At this point exponent>=0, so the following calculation
@@ -1496,14 +1497,14 @@ TclParseNumber(
} else {
objPtr->internalRep.doubleValue = HUGE_VAL;
}
objPtr->typePtr = &tclDoubleType;
objPtr->typePtr = &tclDoubleType.objType;
break;
#ifdef IEEE_FLOATING_POINT
case sNAN:
case sNANFINISH:
objPtr->internalRep.doubleValue = MakeNaN(signum, significandWide);
objPtr->typePtr = &tclDoubleType;
objPtr->typePtr = &tclDoubleType.objType;
break;
#endif
case INITIAL:
@@ -1522,7 +1523,7 @@ TclParseNumber(
expected);
Tcl_AppendLimitedToObj(msg, bytes, numBytes, 50, "");
Tcl_AppendToObj(msg, "\"", -1);
Tcl_AppendToObj(msg, "\"", TCL_INDEX_NONE);
Tcl_SetObjResult(interp, msg);
Tcl_SetErrorCode(interp, "TCL", "VALUE", "NUMBER", NULL);
}
@@ -4484,7 +4485,7 @@ TclDoubleDigits(
++m2plus;
}
if (s5+1 < N_LOG2POW5 && s2+1 + log2pow5[s5+1] <= 64) {
if (s5+1 < N_LOG2POW5 && s2+1 + log2pow5[s5+1] < 64) {
/*
* If 10*2**s2*5**s5 == 2**(s2+1)+5**(s5+1) fits in a 64-bit word,
* then all our intermediate calculations can be done using exact
@@ -4541,7 +4542,7 @@ TclDoubleDigits(
s2 -= b2; b2 = 0;
}
if (s5+1 < N_LOG2POW5 && s2+1 + log2pow5[s5+1] <= 64) {
if (s5+1 < N_LOG2POW5 && s2+1 + log2pow5[s5+1] < 64) {
/*
* If 10*2**s2*5**s5 == 2**(s2+1)+5**(s5+1) fits in a 64-bit word,
* then all our intermediate calculations can be done using exact
@@ -4786,7 +4787,7 @@ Tcl_InitBignumFromDouble(
if (interp != NULL) {
const char *s = "integer value too large to represent";
Tcl_SetObjResult(interp, Tcl_NewStringObj(s, -1));
Tcl_SetObjResult(interp, Tcl_NewStringObj(s, TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "ARITH", "IOVERFLOW", s, NULL);
}
return TCL_ERROR;
@@ -5272,7 +5273,7 @@ TclFormatNaN(
*buffer++ = 'N';
bitwhack.iv &= ((UINT64_C(1)) << 51) - 1;
if (bitwhack.iv != 0) {
sprintf(buffer, "(%" PRIx64 ")", bitwhack.iv);
snprintf(buffer, TCL_DOUBLE_SPACE, "(%" PRIx64 ")", bitwhack.iv);
} else {
*buffer = '\0';
}
+108 -96
View File
@@ -257,7 +257,7 @@ Tcl_Obj *
Tcl_NewStringObj(
const char *bytes, /* Points to the first of the length bytes
* used to initialize the new object. */
size_t length) /* The number of bytes to copy from "bytes"
Tcl_Size length) /* The number of bytes to copy from "bytes"
* when initializing the new object. If
* TCL_INDEX_NONE, use bytes up to the first NUL
* byte. */
@@ -269,13 +269,13 @@ Tcl_Obj *
Tcl_NewStringObj(
const char *bytes, /* Points to the first of the length bytes
* used to initialize the new object. */
size_t length) /* The number of bytes to copy from "bytes"
* when initializing the new object. If -1,
Tcl_Size length) /* The number of bytes to copy from "bytes"
* when initializing the new object. If TCL_INDEX_NONE,
* use bytes up to the first NUL byte. */
{
Tcl_Obj *objPtr;
if (length == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(length)) {
length = (bytes? strlen(bytes) : 0);
}
TclNewStringObj(objPtr, bytes, length);
@@ -317,7 +317,7 @@ Tcl_Obj *
Tcl_DbNewStringObj(
const char *bytes, /* Points to the first of the length bytes
* used to initialize the new object. */
size_t length, /* The number of bytes to copy from "bytes"
Tcl_Size length, /* The number of bytes to copy from "bytes"
* when initializing the new object. If -1,
* use bytes up to the first NUL byte. */
const char *file, /* The name of the source file calling this
@@ -327,7 +327,7 @@ Tcl_DbNewStringObj(
{
Tcl_Obj *objPtr;
if (length == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(length)) {
length = (bytes? strlen(bytes) : 0);
}
TclDbNewObj(objPtr, file, line);
@@ -339,7 +339,7 @@ Tcl_Obj *
Tcl_DbNewStringObj(
const char *bytes, /* Points to the first of the length bytes
* used to initialize the new object. */
size_t length, /* The number of bytes to copy from "bytes"
Tcl_Size length, /* The number of bytes to copy from "bytes"
* when initializing the new object. If -1,
* use bytes up to the first NUL byte. */
TCL_UNUSED(const char *) /*file*/,
@@ -372,7 +372,7 @@ Tcl_Obj *
Tcl_NewUnicodeObj(
const Tcl_UniChar *unicode, /* The unicode string used to initialize the
* new object. */
size_t numChars) /* Number of characters in the unicode
Tcl_Size numChars) /* Number of characters in the unicode
* string. */
{
Tcl_Obj *objPtr;
@@ -399,13 +399,13 @@ Tcl_NewUnicodeObj(
*----------------------------------------------------------------------
*/
size_t
Tcl_Size
Tcl_GetCharLength(
Tcl_Obj *objPtr) /* The String object to get the num chars
* of. */
{
String *stringPtr;
size_t numChars = 0;
Tcl_Size numChars = 0;
/*
* Quick, no-shimmer return for short string reps.
@@ -444,19 +444,19 @@ Tcl_GetCharLength(
* If numChars is unknown, compute it.
*/
if (numChars == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(numChars)) {
TclNumUtfCharsM(numChars, objPtr->bytes, objPtr->length);
stringPtr->numChars = numChars;
}
return numChars;
}
size_t
Tcl_Size
TclGetCharLength(
Tcl_Obj *objPtr) /* The String object to get the num chars
* of. */
{
size_t numChars = 0;
Tcl_Size numChars = 0;
/*
* Quick, no-shimmer return for short string reps.
@@ -509,7 +509,7 @@ int
TclCheckEmptyString(
Tcl_Obj *objPtr)
{
size_t length = TCL_INDEX_NONE;
Tcl_Size length = TCL_INDEX_NONE;
if (objPtr->bytes == &tclEmptyString) {
return TCL_EMPTYSTRING_YES;
@@ -553,7 +553,7 @@ int
Tcl_GetUniChar(
Tcl_Obj *objPtr, /* The object to get the Unicode charater
* from. */
size_t index) /* Get the index'th Unicode character. */
Tcl_Size index) /* Get the index'th Unicode character. */
{
String *stringPtr;
int ch;
@@ -564,7 +564,7 @@ Tcl_GetUniChar(
*/
if (TclIsPureByteArray(objPtr)) {
size_t length = 0;
Tcl_Size length = 0;
unsigned char *bytes = Tcl_GetByteArrayFromObj(objPtr, &length);
if (index >= length) {
return -1;
@@ -585,7 +585,7 @@ Tcl_GetUniChar(
* If numChars is unknown, compute it.
*/
if (stringPtr->numChars == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(stringPtr->numChars)) {
TclNumUtfCharsM(stringPtr->numChars, objPtr->bytes, objPtr->length);
}
if (stringPtr->numChars == objPtr->length) {
@@ -622,7 +622,7 @@ int
TclGetUniChar(
Tcl_Obj *objPtr, /* The object to get the Unicode charater
* from. */
size_t index) /* Get the index'th Unicode character. */
Tcl_Size index) /* Get the index'th Unicode character. */
{
int ch = 0;
@@ -632,7 +632,7 @@ TclGetUniChar(
*/
if (TclIsPureByteArray(objPtr)) {
size_t length = 0;
Tcl_Size length = 0;
unsigned char *bytes = Tcl_GetByteArrayFromObj(objPtr, &length);
if (index >= length) {
return -1;
@@ -641,7 +641,7 @@ TclGetUniChar(
return bytes[index];
}
size_t numChars = TclNumUtfChars(objPtr->bytes, objPtr->length);
Tcl_Size numChars = TclNumUtfChars(objPtr->bytes, objPtr->length);
if (index >= numChars) {
return -1;
@@ -693,7 +693,7 @@ TclGetUnicodeFromObj(
if (lengthPtr != NULL) {
if (stringPtr->numChars > INT_MAX) {
Tcl_Panic("Tcl_GetUnicodeFromObj with 'int' lengthPtr"
"cannot handle such long strings. Please use 'size_t'");
"cannot handle such long strings. Please use 'Tcl_Size'");
}
*lengthPtr = (int)stringPtr->numChars;
}
@@ -747,14 +747,14 @@ Tcl_GetUnicodeFromObj(
Tcl_Obj *
Tcl_GetRange(
Tcl_Obj *objPtr, /* The Tcl object to find the range of. */
size_t first, /* First index of the range. */
size_t last) /* Last index of the range. */
Tcl_Size first, /* First index of the range. */
Tcl_Size last) /* Last index of the range. */
{
Tcl_Obj *newObjPtr; /* The Tcl object to find the range of. */
String *stringPtr;
size_t length = 0;
Tcl_Size length = 0;
if (first == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(first)) {
first = TCL_INDEX_START;
}
@@ -788,7 +788,7 @@ Tcl_GetRange(
* If numChars is unknown, compute it.
*/
if (stringPtr->numChars == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(stringPtr->numChars)) {
TclNumUtfCharsM(stringPtr->numChars, objPtr->bytes, objPtr->length);
}
if (stringPtr->numChars == objPtr->length) {
@@ -838,13 +838,13 @@ Tcl_GetRange(
Tcl_Obj *
TclGetRange(
Tcl_Obj *objPtr, /* The Tcl object to find the range of. */
size_t first, /* First index of the range. */
size_t last) /* Last index of the range. */
Tcl_Size first, /* First index of the range. */
Tcl_Size last) /* Last index of the range. */
{
Tcl_Obj *newObjPtr; /* The Tcl object to find the range of. */
size_t length = 0;
Tcl_Size length = 0;
if (first == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(first)) {
first = TCL_INDEX_START;
}
@@ -866,7 +866,7 @@ TclGetRange(
return Tcl_NewByteArrayObj(bytes + first, last - first + 1);
}
size_t numChars = TclNumUtfChars(objPtr->bytes, objPtr->length);
Tcl_Size numChars = TclNumUtfChars(objPtr->bytes, objPtr->length);
if (last >= numChars) {
last = numChars - 1;
@@ -906,8 +906,8 @@ Tcl_SetStringObj(
Tcl_Obj *objPtr, /* Object whose internal rep to init. */
const char *bytes, /* Points to the first of the length bytes
* used to initialize the object. */
size_t length) /* The number of bytes to copy from "bytes"
* when initializing the object. If -1,
Tcl_Size length) /* The number of bytes to copy from "bytes"
* when initializing the object. If TCL_INDEX_NONE,
* use bytes up to the first NUL byte.*/
{
if (Tcl_IsShared(objPtr)) {
@@ -926,7 +926,7 @@ Tcl_SetStringObj(
*/
TclInvalidateStringRep(objPtr);
if (length == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(length)) {
length = (bytes? strlen(bytes) : 0);
}
TclInitStringRep(objPtr, bytes, length);
@@ -959,7 +959,7 @@ void
Tcl_SetObjLength(
Tcl_Obj *objPtr, /* Pointer to object. This object must not
* currently be shared. */
size_t length) /* Number of bytes desired for string
Tcl_Size length) /* Number of bytes desired for string
* representation of object, not including
* terminating null byte. */
{
@@ -1050,7 +1050,7 @@ int
Tcl_AttemptSetObjLength(
Tcl_Obj *objPtr, /* Pointer to object. This object must not
* currently be shared. */
size_t length) /* Number of bytes desired for string
Tcl_Size length) /* Number of bytes desired for string
* representation of object, not including
* terminating null byte. */
{
@@ -1149,7 +1149,7 @@ Tcl_SetUnicodeObj(
Tcl_Obj *objPtr, /* The object to set the string of. */
const Tcl_UniChar *unicode, /* The unicode string used to initialize the
* object. */
size_t numChars) /* Number of characters in the unicode
Tcl_Size numChars) /* Number of characters in the unicode
* string. */
{
if (Tcl_IsShared(objPtr)) {
@@ -1163,10 +1163,10 @@ static size_t
UnicodeLength(
const Tcl_UniChar *unicode)
{
size_t numChars = 0;
Tcl_Size numChars = 0;
if (unicode) {
while ((numChars != TCL_INDEX_NONE) && (unicode[numChars] != 0)) {
while (!TCL_SIZE_ISNEG(numChars) && (unicode[numChars] != 0)) {
numChars++;
}
}
@@ -1183,8 +1183,8 @@ SetUnicodeObj(
{
String *stringPtr;
if (numChars == TCL_INDEX_NONE) {
numChars = UnicodeLength(unicode);
if (TCL_SIZE_ISNEG(numChars)) {
numChars = UnicodeLength(unicode);
}
/*
@@ -1228,10 +1228,10 @@ Tcl_AppendLimitedToObj(
Tcl_Obj *objPtr, /* Points to the object to append to. */
const char *bytes, /* Points to the bytes to append to the
* object. */
size_t length, /* The number of bytes available to be
* appended from "bytes". If -1, then
Tcl_Size length, /* The number of bytes available to be
* appended from "bytes". If TCL_INDEX_NONE, then
* all bytes up to a NUL byte are available. */
size_t limit, /* The maximum number of bytes to append to
Tcl_Size limit, /* The maximum number of bytes to append to
* the object. */
const char *ellipsis) /* Ellipsis marker string, appended to the
* object to indicate not all available bytes
@@ -1241,7 +1241,7 @@ Tcl_AppendLimitedToObj(
size_t toCopy = 0;
size_t eLen = 0;
if (length == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(length)) {
length = (bytes ? strlen(bytes) : 0);
}
if (length == 0) {
@@ -1324,7 +1324,7 @@ Tcl_AppendToObj(
Tcl_Obj *objPtr, /* Points to the object to append to. */
const char *bytes, /* Points to the bytes to append to the
* object. */
size_t length) /* The number of bytes to append from "bytes".
Tcl_Size length) /* The number of bytes to append from "bytes".
* If TCL_INDEX_NONE, then append all bytes up to NUL
* byte. */
{
@@ -1353,7 +1353,7 @@ Tcl_AppendUnicodeToObj(
Tcl_Obj *objPtr, /* Points to the object to append to. */
const Tcl_UniChar *unicode, /* The unicode string to append to the
* object. */
size_t length) /* Number of chars in "unicode". */
Tcl_Size length) /* Number of chars in "unicode". */
{
String *stringPtr;
@@ -1407,7 +1407,7 @@ Tcl_AppendObjToObj(
Tcl_Obj *appendObjPtr) /* Object to append. */
{
String *stringPtr;
size_t length = 0, numChars;
Tcl_Size length = 0, numChars;
size_t appendNumChars = TCL_INDEX_NONE;
const char *bytes;
@@ -1448,7 +1448,7 @@ Tcl_AppendObjToObj(
* First, get the lengths.
*/
size_t lengthSrc = 0;
Tcl_Size lengthSrc = 0;
(void) Tcl_GetByteArrayFromObj(objPtr, &length);
(void) Tcl_GetByteArrayFromObj(appendObjPtr, &lengthSrc);
@@ -1471,7 +1471,7 @@ Tcl_AppendObjToObj(
*/
TclAppendBytesToByteArray(objPtr,
Tcl_GetBytesFromObj(NULL, appendObjPtr, (size_t *)NULL), lengthSrc);
Tcl_GetByteArrayFromObj(appendObjPtr, (size_t *)NULL), lengthSrc);
return;
}
@@ -1520,7 +1520,7 @@ Tcl_AppendObjToObj(
bytes = Tcl_GetStringFromObj(appendObjPtr, &length);
numChars = stringPtr->numChars;
if ((numChars != TCL_INDEX_NONE) && TclHasInternalRep(appendObjPtr, &tclStringType)) {
if (!TCL_SIZE_ISNEG(numChars) && TclHasInternalRep(appendObjPtr, &tclStringType)) {
String *appendStringPtr = GET_STRING(appendObjPtr);
appendNumChars = appendStringPtr->numChars;
@@ -1528,7 +1528,7 @@ Tcl_AppendObjToObj(
AppendUtfToUtfRep(objPtr, bytes, length);
if ((numChars != TCL_INDEX_NONE) && (appendNumChars != TCL_INDEX_NONE)) {
if (!TCL_SIZE_ISNEG(numChars) && !TCL_SIZE_ISNEG(appendNumChars)) {
stringPtr->numChars = numChars + appendNumChars;
}
}
@@ -1559,7 +1559,7 @@ AppendUnicodeToUnicodeRep(
String *stringPtr;
size_t numChars;
if (appendNumChars == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(appendNumChars)) {
appendNumChars = UnicodeLength(unicode);
}
if (appendNumChars == 0) {
@@ -1600,7 +1600,7 @@ AppendUnicodeToUnicodeRep(
* Relocate unicode if needed; see above.
*/
if (index != TCL_INDEX_NONE) {
if (!TCL_SIZE_ISNEG(index)) {
unicode = stringPtr->unicode + index;
}
}
@@ -1648,7 +1648,7 @@ AppendUnicodeToUtfRep(
numChars = ExtendStringRepWithUnicode(objPtr, unicode, numChars);
if (stringPtr->numChars != TCL_INDEX_NONE) {
if (!TCL_SIZE_ISNEG(stringPtr->numChars)) {
stringPtr->numChars += numChars;
}
}
@@ -1683,7 +1683,7 @@ AppendUtfToUnicodeRep(
return;
}
ExtendUnicodeRepWithString(objPtr, bytes, numBytes, -1);
ExtendUnicodeRepWithString(objPtr, bytes, numBytes, TCL_INDEX_NONE);
TclInvalidateStringRep(objPtr);
stringPtr = GET_STRING(objPtr);
stringPtr->allocated = 0;
@@ -1757,7 +1757,7 @@ AppendUtfToUtfRep(
* Relocate bytes if needed; see above.
*/
if (offset != TCL_INDEX_NONE) {
if (!TCL_SIZE_ISNEG(offset)) {
bytes = objPtr->bytes + offset;
}
}
@@ -1812,7 +1812,7 @@ Tcl_AppendStringsToObj(
if (bytes == NULL) {
break;
}
Tcl_AppendToObj(objPtr, bytes, -1);
Tcl_AppendToObj(objPtr, bytes, TCL_INDEX_NONE);
}
va_end(argList);
}
@@ -1842,12 +1842,12 @@ Tcl_AppendFormatToObj(
Tcl_Interp *interp,
Tcl_Obj *appendObj,
const char *format,
size_t objc,
Tcl_Size objc,
Tcl_Obj *const objv[])
{
const char *span = format, *msg, *errCode;
int gotXpg = 0, gotSequential = 0;
size_t objIndex = 0, originalLength, limit, numBytes = 0;
Tcl_Size objIndex = 0, originalLength, limit, numBytes = 0;
Tcl_UniChar ch = 0;
static const char *mixedXPG =
"cannot mix \"%\" and \"%n$\" conversion specifiers";
@@ -2130,6 +2130,9 @@ Tcl_AppendFormatToObj(
if (TclGetIntFromObj(interp, segment, &code) != TCL_OK) {
goto error;
}
if ((unsigned)code > 0x10FFFF) {
code = 0xFFFD;
}
length = Tcl_UniCharToUtf(code, buf);
#if TCL_UTF_MAX < 4
if ((code >= 0xD800) && (length < 3)) {
@@ -2244,7 +2247,7 @@ Tcl_AppendFormatToObj(
switch (ch) {
case 'd': {
size_t length;
Tcl_Size length;
Tcl_Obj *pure;
const char *bytes;
@@ -2317,7 +2320,7 @@ Tcl_AppendFormatToObj(
Tcl_WideUInt bits = 0;
Tcl_WideInt numDigits = 0;
int numBits = 4, base = 16, index = 0, shift = 0;
size_t length;
Tcl_Size length;
Tcl_Obj *pure;
char *bytes;
@@ -2478,14 +2481,14 @@ Tcl_AppendFormatToObj(
*p++ = '+';
}
if (width) {
p += sprintf(p, "%d", width);
p += snprintf(p, TCL_INTEGER_SPACE, "%d", width);
if (width > length) {
length = width;
}
}
if (gotPrecision) {
*p++ = '.';
p += sprintf(p, "%d", precision);
p += snprintf(p, TCL_INTEGER_SPACE, "%d", precision);
if (precision > INT_MAX - length) {
msg = overflow;
errCode = "OVERFLOW";
@@ -2509,7 +2512,7 @@ Tcl_AppendFormatToObj(
goto errorMsg;
}
bytes = TclGetString(segment);
if (!Tcl_AttemptSetObjLength(segment, sprintf(bytes, spec, d))) {
if (!Tcl_AttemptSetObjLength(segment, snprintf(bytes, segment->length, spec, d))) {
msg = overflow;
errCode = "OVERFLOW";
goto errorMsg;
@@ -2585,7 +2588,7 @@ Tcl_AppendFormatToObj(
errorMsg:
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(msg, -1));
Tcl_SetObjResult(interp, Tcl_NewStringObj(msg, TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "FORMAT", errCode, NULL);
}
error:
@@ -2611,7 +2614,7 @@ Tcl_Obj *
Tcl_Format(
Tcl_Interp *interp,
const char *format,
size_t objc,
Tcl_Size objc,
Tcl_Obj *const objv[])
{
int result;
@@ -2892,7 +2895,7 @@ Tcl_ObjPrintf(
char *
TclGetStringStorage(
Tcl_Obj *objPtr,
size_t *sizePtr)
Tcl_Size *sizePtr)
{
String *stringPtr;
@@ -2931,7 +2934,7 @@ TclStringRepeat(
{
Tcl_Obj *objResultPtr;
int inPlace = flags & TCL_STRING_IN_PLACE;
size_t length = 0, unichar = 0, done = 1;
Tcl_Size length = 0, unichar = 0, done = 1;
int binary = TclIsPureByteArray(objPtr);
size_t maxCount;
@@ -2957,13 +2960,11 @@ TclStringRepeat(
/* Result will be pure byte array. Pre-size it */
(void)Tcl_GetByteArrayFromObj(objPtr, &length);
maxCount = TCL_SIZE_SMAX;
}
else if (unichar) {
} else if (unichar) {
/* Result will be pure Tcl_UniChar array. Pre-size it. */
(void)Tcl_GetUnicodeFromObj(objPtr, &length);
maxCount = TCL_SIZE_SMAX/sizeof(Tcl_UniChar);
}
else {
} else {
/* Result will be concat of string reps. Pre-size it. */
(void)Tcl_GetStringFromObj(objPtr, &length);
maxCount = TCL_SIZE_SMAX;
@@ -3000,7 +3001,7 @@ TclStringRepeat(
done *= 2;
}
TclAppendBytesToByteArray(objResultPtr,
Tcl_GetBytesFromObj(NULL, objResultPtr, (size_t *)NULL),
Tcl_GetByteArrayFromObj(objResultPtr, (size_t *)NULL),
(count - done) * length);
} else if (unichar) {
/*
@@ -3089,7 +3090,7 @@ TclStringCat(
{
Tcl_Obj *objResultPtr, * const *ov;
int oc, binary = 1;
size_t length = 0;
Tcl_Size length = 0;
int allowUniChar = 1, requestUniChar = 0, forceUniChar = 0;
int first = objc - 1; /* Index of first value possibly not empty */
int last = 0; /* Index of last value possibly not empty */
@@ -3468,11 +3469,12 @@ TclStringCmp(
Tcl_Obj *value2Ptr,
int checkEq, /* comparison is only for equality */
int nocase, /* comparison is not case sensitive */
size_t reqlength) /* requested length */
size_t reqlength) /* requested length in characters;
* TCL_INDEX_NONE to compare whole strings */
{
char *s1, *s2;
const char *s1, *s2;
int empty, match;
size_t length, s1len = 0, s2len = 0;
Tcl_Size length, s1len = 0, s2len = 0;
memCmpFn_t memCmpFn;
if ((reqlength == 0) || (value1Ptr == value2Ptr)) {
@@ -3496,10 +3498,10 @@ TclStringCmp(
} else if (TclHasInternalRep(value1Ptr, &tclStringType)
&& TclHasInternalRep(value2Ptr, &tclStringType)) {
/*
* Do a unicode-specific comparison if both of the args are of
* String type. If the char length == byte length, we can do a
* memcmp. In benchmark testing this proved the most efficient
* check between the unicode and string comparison operations.
* Do a Unicode-specific comparison if both of the args are of String
* type. If the char length == byte length, we can do a memcmp. In
* benchmark testing this proved the most efficient check between the
* Unicode and string comparison operations.
*/
if (nocase) {
@@ -3513,6 +3515,9 @@ TclStringCmp(
&& (value1Ptr->bytes != NULL)
&& (s2len == value2Ptr->length)
&& (value2Ptr->bytes != NULL)) {
/* each byte represents one character so s1l3n, s2l3n, and
* reqlength are in both bytes and characters
*/
s1 = value1Ptr->bytes;
s2 = value2Ptr->bytes;
memCmpFn = memcmp;
@@ -3529,6 +3534,9 @@ TclStringCmp(
memCmpFn = memcmp;
s1len *= sizeof(Tcl_UniChar);
s2len *= sizeof(Tcl_UniChar);
if (!TCL_SIZE_ISNEG(reqlength)) {
reqlength *= sizeof(Tcl_UniChar);
}
} else {
memCmpFn = (memCmpFn_t) TclUniCharNcmp;
}
@@ -3570,7 +3578,7 @@ TclStringCmp(
s1 = Tcl_GetStringFromObj(value1Ptr, &s1len);
s2 = Tcl_GetStringFromObj(value2Ptr, &s2len);
}
if (!nocase && checkEq) {
if (!nocase && checkEq && TCL_SIZE_ISNEG(reqlength)) {
/*
* When we have equal-length we can check only for
* (in)equality. We can use memcmp in all (n)eq cases because
@@ -3587,7 +3595,7 @@ TclStringCmp(
* length was requested.
*/
if ((reqlength == TCL_INDEX_NONE) && !nocase) {
if (TCL_SIZE_ISNEG(reqlength) && !nocase) {
memCmpFn = (memCmpFn_t) TclpUtfNcmp2;
} else {
s1len = Tcl_NumUtfChars(s1, s1len);
@@ -3598,11 +3606,15 @@ TclStringCmp(
}
}
/* At this point s1len, s2len, and reqlength should by now have been
* adjusted so that they are all in the units expected by the selected
* comparison function.
*/
length = (s1len < s2len) ? s1len : s2len;
if (reqlength == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(reqlength)) {
/*
* The requested length is negative, so we ignore it by setting it
* to length + 1 so we correct the match var.
* The requested length is negative, so ignore it by setting it
* to length + 1 to correct the match var.
*/
reqlength = length + 1;
@@ -3610,7 +3622,7 @@ TclStringCmp(
length = reqlength;
}
if (checkEq && (s1len != s2len)) {
if (checkEq && TCL_SIZE_ISNEG(reqlength) && (s1len != s2len)) {
match = 1; /* This will be reversed below. */
} else {
/*
@@ -3658,7 +3670,7 @@ TclStringFirst(
Tcl_UniChar *checkStr, *endStr, *uh, *un;
Tcl_Obj *obj;
if (start == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(start)) {
start = 0;
}
if (ln == 0) {
@@ -3884,7 +3896,7 @@ TclStringReverse(
if (!inPlace || Tcl_IsShared(objPtr)) {
objPtr = Tcl_NewByteArrayObj(NULL, numBytes);
}
ReverseBytes(Tcl_GetBytesFromObj(NULL, objPtr, (size_t *)NULL), from, numBytes);
ReverseBytes(Tcl_GetByteArrayFromObj(objPtr, (size_t *)NULL), from, numBytes);
return objPtr;
}
@@ -3969,7 +3981,7 @@ TclStringReverse(
}
to = objPtr->bytes;
if ((numChars == TCL_INDEX_NONE) || (numChars < numBytes)) {
if (TCL_SIZE_ISNEG(numChars) || (numChars < numBytes)) {
/*
* Either numChars == -1 and we don't know how many chars are
* represented by objPtr->bytes and we need Pass 1 just in case,
@@ -4154,7 +4166,7 @@ TclStringReplace(
* FillUnicodeRep --
*
* Populate the Unicode internal rep with the Unicode form of its string
* rep. The object must alread have a "String" internal rep.
* rep. The object must already have a "String" internal rep.
*
* Results:
* None.
@@ -4190,7 +4202,7 @@ ExtendUnicodeRepWithString(
if (stringPtr->hasUnicode) {
numOrigChars = stringPtr->numChars;
}
if (numAppendChars == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(numAppendChars)) {
TclNumUtfCharsM(numAppendChars, bytes, numBytes);
}
needed = numOrigChars + numAppendChars;
@@ -4246,7 +4258,7 @@ DupStringInternalRep(
String *srcStringPtr = GET_STRING(srcPtr);
String *copyStringPtr = NULL;
if (srcStringPtr->numChars == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(srcStringPtr->numChars)) {
/*
* The String struct in the source value holds zero useful data. Don't
* bother copying it. Don't even bother allocating space in which to
@@ -4304,7 +4316,7 @@ DupStringInternalRep(
* This operation always succeeds and returns TCL_OK.
*
* Side effects:
* Any old internal reputation for objPtr is freed and the internal
* Any old internal representation for objPtr is freed and the internal
* representation is set to "String".
*
*----------------------------------------------------------------------
@@ -4396,7 +4408,7 @@ ExtendStringRepWithUnicode(
char *dst;
String *stringPtr = GET_STRING(objPtr);
if (numChars == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(numChars)) {
numChars = UnicodeLength(unicode);
}

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