Compare commits

...
Author SHA1 Message Date
dgp 5893756a8c Revise writing to binary channels so that non-byte characters get replaced
with a replacement character ("?" for iso8859-1).
2020-03-30 20:59:03 +00:00
dgp 26bd764323 Merge 8.6; revise to use TclGetBytesFromObj. 2020-03-30 15:51:00 +00:00
dgp 68a12bf6aa Optimize [binary decode hex] to process bytearray without string generation
when it can.
2020-03-30 15:48:17 +00:00
jan.nijtmans 60d0ed0069 Initialize Tcl_UniChar's, in case we are handling surrogates (however unlikely). 2020-03-30 15:27:43 +00:00
dgp 8139a8a595 Merge 8.6, revise to use TclGetBytesFromObj. 2020-03-30 15:13:53 +00:00
dgp 987ffc2687 Optimize [binary decode uuencode] to process bytearray without string
generation when it can.
2020-03-30 15:09:40 +00:00
jan.nijtmans bcfc4a29c5 Merge 8.6 2020-03-30 13:00:44 +00:00
jan.nijtmans 1d7fa6b53d genStubs.tcl: Only do an "append line" when there really is something to be done. 2020-03-30 12:59:29 +00:00
jan.nijtmans aa371355b1 Optimize TclStringFirst/TclStringLast: Let it return a Tcl_Obj * in stead of an int, so its callers don't need to do the conversion any more. 2020-03-30 11:37:54 +00:00
jan.nijtmans 4cbd0649ef Merge 8.6 2020-03-30 10:30:30 +00:00
jan.nijtmans 97ab1046f9 tcltest.tcl: Only adapt "filesMade" variable if the file to be removed is actually found.
tcltest 2.5.2 -> 2.5.3
2020-03-30 10:25:44 +00:00
dgp 7a81cc7b2b merge 8.6 2020-03-28 19:39:42 +00:00
dgp e7e6720ba4 Add a test for fixed bug. 2020-03-28 19:25:54 +00:00
dgp a32dffe303 [8edfcedfa0] [binary encode base64] build a string instead of a bytearray
whenever it might be required to get the right result.
2020-03-28 19:21:56 +00:00
dgp 65c57e8170 Make sure maxlen value does not rely on ordering of options. 2020-03-28 18:52:16 +00:00
dgp beae292420 Revise comment that was a plain lie. 2020-03-28 18:28:42 +00:00
dgp 65c59cb146 Missing error codes from decoder routines. 2020-03-28 18:23:43 +00:00
dgp 29cb05c855 Optimize base64 decoder to work on bytearrays without string generation. 2020-03-28 17:35:23 +00:00
dgp f5621cf853 merge 8.6 2020-03-28 16:33:50 +00:00
dgp c619f65f15 [ffeb2097af] Restore the standard and original practice of ignoring invalid
characters when decoding base64. Error only in -strict mode. See RFC 2045.
2020-03-28 15:35:12 +00:00
dgp 3cd192c81c Further improvement. Report invalid multi-byte characters accurately. 2020-03-27 21:52:42 +00:00
dgp 74657995c7 Improve error reporting. If codepoint looks negative, bad char is reported
as REPLACEMENT CHARACTER, which is wrong, therefore not helpful.
2020-03-27 21:21:28 +00:00
jan.nijtmans a30671934a Merge 8.6 2020-03-27 21:06:19 +00:00
jan.nijtmans 250116c887 Fix [767e070d35]: Tcl_GetRange and Tcl_GetUniChar do not validate index inputs. Backported from 8.7 (where it already was fixed as part of TIP #542 implementation) 2020-03-27 20:58:33 +00:00
dgp 2b68efb386 Repair bad test labels. 2020-03-27 18:02:02 +00:00
jan.nijtmans afa1204d07 Merge 8.6 2020-03-27 16:28:03 +00:00
jan.nijtmans 0a00f85f84 Looks like this little hack is no longer necessary on current 32-bit Cygwin. 2020-03-27 16:24:30 +00:00
jan.nijtmans 82b83bb7a6 Merge 8.6 2020-03-27 12:06:38 +00:00
jan.nijtmans 5c2d281edc Fix harmless gcc warning, when compiling on Linux 2020-03-27 12:05:39 +00:00
jan.nijtmans 9a007031fa Fix [767e070d35]: Tcl_GetRange and Tcl_GetUniChar do not validate index inputs 2020-03-27 10:33:08 +00:00
jan.nijtmans 841855aced Merge 8.6 2020-03-25 17:06:52 +00:00
jan.nijtmans 4005a8776e Little typo 2020-03-25 17:06:03 +00:00
jan.nijtmans b86333ba01 Merge 8.6 2020-03-25 15:03:06 +00:00
jan.nijtmans 6f438769bc Follow-up to [a9f61c48906b66f8]: Fill UNIX TclIntPlatDecls stub entry 5 with same entry from win32. Can be simplified further in 8.7/9.0. 2020-03-25 14:48:44 +00:00
jan.nijtmans 652e994c73 Merge 8.6 2020-03-24 13:34:44 +00:00
jan.nijtmans 9acd2dacaa Spurious test-failure on Travis OSX 2020-03-24 13:31:42 +00:00
jan.nijtmans 3f3b063fc1 Merge 8.6. If compiled with -DTCL_NO_DEPRECATED, remove Tcl_MacOSXOpenBundleResources() completely 2020-03-24 10:59:21 +00:00
jan.nijtmans 6a93c7f370 MacOS: Make Tcl_MacOSXOpenBundleResources() a macro calling Tcl_MacOSXOpenVersionedBundleResources: One more stub entry which can be removed in Tcl 9.0 2020-03-24 10:42:49 +00:00
jan.nijtmans 26039c20d8 Fill UNIX TclIntPlatDecls stub entries 15 up to 19 and 22 with same functions as for win32. Not used in 8.6 yet.
This is a step on the way, making the TclIntPlatDecls stub table the same for all platforms in 9.0
2020-03-24 10:34:48 +00:00
jan.nijtmans e1c726c819 Merge 8.6 2020-03-22 21:24:31 +00:00
jan.nijtmans 833501b319 Even more uppercase HEX representations in source-code 2020-03-22 21:16:21 +00:00
jan.nijtmans a6d6075761 Resolve gcc compiler warnings, only on 32-bit builds (gcc-7) 2020-03-20 17:16:28 +00:00
dgp bb70971aa9 Improve the standard error message for nonbyte arguments. 2020-03-18 20:48:32 +00:00
jan.nijtmans 176431f584 Merge 8.6 2020-03-18 13:54:06 +00:00
jan.nijtmans af7fa225c1 More uppercase HEX representations in source-code. 2020-03-18 12:51:30 +00:00
jan.nijtmans ae243c85b7 Merge 8.6 2020-03-17 16:45:47 +00:00
jan.nijtmans 27c27e941a Merge 8.5. Mainly add Unicode 13 new plane 3 characters to the internal Unicode tables. Not used in 8.6 yet. 2020-03-17 16:35:51 +00:00
jan.nijtmans 50eee151a9 Unicode 13 has a new range of characters from 0x30000 to 0x3134A, so generate those in the tables too.
Add one reserved stub entry (Backported from 8.6)
2020-03-17 16:19:17 +00:00
dgp cb291b4c47 a few more 2020-03-17 01:03:05 +00:00
dgp dc763386a9 TIP 569 - remove lint comments 2020-03-17 01:01:25 +00:00
jan.nijtmans 23bd4dbf08 merge-mark 2020-03-15 22:24:01 +00:00
jan.nijtmans 07cfb2190f Add one more reserved stub entry, most likely will be Tcl_GetBytesFromObj() in Tcl 8.7. 2020-03-15 22:21:27 +00:00
jan.nijtmans 27ee10bdf0 Merge 8.6. Also fix build with -DTCL_NO_DEPRECATED (which was also the cause of the "master" build failure) 2020-03-15 12:11:51 +00:00
jan.nijtmans 13be49f585 Make ourEnviron type (techar **) not (char **), so we need less type-casts. 2020-03-15 12:03:21 +00:00
jan.nijtmans ad02769933 Merge 8.6 2020-03-14 22:07:25 +00:00
jan.nijtmans bb05d544ee Fix one wrong type-cast (only causing warning, nothing serious) 2020-03-14 22:06:08 +00:00
jan.nijtmans 6751485187 Merge 8.6 2020-03-14 21:52:01 +00:00
jan.nijtmans 7070324787 Convert many test-cases to modern test syntax 2020-03-14 21:21:10 +00:00
jan.nijtmans 9b8409d9e9 Fix [8f89e2e059aafa1c]: Windows: environment is not reflected properly (special characters). Thanks to sebres for patch and test-case! 2020-03-14 21:02:12 +00:00
dgp e3e05a2cf9 Need declaration too. 2020-03-13 18:55:10 +00:00
dgp fdfd0ad0b6 New internal routine TclGetBytesFromObj().
Aimed to become public, see TIP 568 in progress.
2020-03-13 18:32:45 +00:00
jan.nijtmans 91484ba1c9 Merge 8.6.
Code review: Tcl 8.6 doesn't (need to) build with -DUNICODE -D_UNICODE any more, so things can be simplified. Good work, thanks!
2020-03-13 14:45:34 +00:00
sebres 72a735d089 fix back-ported from tclSE (with several modifications due to conflicts and compat reasons) 2020-03-13 13:08:15 +00:00
sebres 86581b5325 env.test: added test for windows illustrating bug [8f89e2e059] - loss of multi-byte chars in environment if single-byte system encoding used 2020-03-13 13:06:53 +00:00
jan.nijtmans f7550ff059 Merge 8.6 2020-03-13 11:03:14 +00:00
jan.nijtmans 068df4904b reformat assemble-15.* test-cases 2020-03-13 11:01:34 +00:00
dgp 442f4cfd68 Minimal fix for crash bug. 2020-03-12 20:54:09 +00:00
dgp bebe16e96c Merge new tests. Reveals crash in Tcl 8.7 implementation. 2020-03-12 17:38:30 +00:00
dgp 5d52fb6a3f Renumber tests to account for later releases. 2020-03-12 17:37:16 +00:00
dgp 46e5b17ffb Add some testing of Tcl_SetByteArrayLength(). 2020-03-12 17:29:33 +00:00
sebres e13a8e77f2 fixes segfault [234d6c811d]: "lpop" on empty list variable without index + new test case 2020-03-11 15:51:06 +00:00
sebres 7cf28a1e23 close [234d6c811d]: fixed segfault on empty list variable by "lpop" without index 2020-03-11 15:48:07 +00:00
sebres 14fd6b059e lpop.test: added test illustrating segfault in [234d6c811d] (and small review - stability of tests depending on outside circumstances, e. g. in case of -singleproc) 2020-03-11 15:33:28 +00:00
jan.nijtmans f13b7726c4 Fix Windows build, broken by [d5175f6050e308f4] 2020-03-10 13:51:25 +00:00
dgp 065483ce8b Mac fix 2020-03-09 16:24:52 +00:00
dgp 683144e7f0 TCL_UNUSED for win sources. 2020-03-09 16:13:11 +00:00
dgp 8816b1a873 TCL_UNUSED in the unix sources. 2020-03-09 15:45:52 +00:00
dgp 1baa16d30d need internal header now. 2020-03-09 14:43:18 +00:00
dgp bd4dfc850e Bring TCL_UNUSED to macosx sources. 2020-03-09 14:40:27 +00:00
dgp a5406cf5c0 more 2020-03-09 14:34:27 +00:00
dgp a8870a4fae More 2020-03-09 13:15:02 +00:00
jan.nijtmans 4f3c0fa94f Use more uppercase hex (e.g. 0xFF) in stead of lowercase (0xff) consistantly. 2020-03-09 12:49:41 +00:00
dgp 42e6e9b167 More TCL_UNUSED 2020-03-09 12:31:47 +00:00
dgp 085094bd87 More TCL_UNUSED. 2020-03-08 13:58:07 +00:00
jan.nijtmans 89b0bdb882 Move TCL_UNUSED to tclInt.h, so we can still deprecate JOIN() 2020-03-07 18:25:27 +00:00
jan.nijtmans 467d03dbc9 Change (interal) function signature of TclpAlloc/TclpRealloc/TclpFree, using (void *) in stead of (char *) 2020-03-07 15:55:35 +00:00
dgp b8ffa18096 Unused arguments in the OO source code files. 2020-03-07 00:41:42 +00:00
dgp fa6d9198c0 more 2020-03-06 23:44:14 +00:00
dgp 81e31a16d8 More unused arguments through the IO code. 2020-03-06 21:22:28 +00:00
dgp a619fad748 more 2020-03-06 20:57:28 +00:00
dgp d599e21dbc more unused arguments 2020-03-06 20:46:51 +00:00
dgp b996359ed1 merge 8.6 2020-03-06 20:34:25 +00:00
dgp 2cd124a28e Remove SetIndexFromAny(), a useless routine that can only be reached via
unsupported shenanigans.
2020-03-06 20:32:47 +00:00
dgp b88a8f3dd9 more 2020-03-06 20:23:01 +00:00
dgp 9bfe372421 more 2020-03-06 20:15:24 +00:00
dgp e72ebf58a1 (no comment) 2020-03-06 20:01:56 +00:00
dgp 3f741fda03 (no comment) 2020-03-06 19:58:14 +00:00
dgp e870d650fd more unused arguments 2020-03-06 19:29:59 +00:00
dgp 3db7dab605 more of the same 2020-03-06 18:31:49 +00:00
dgp e84e229fd5 More TCL_UNUSED(). 2020-03-06 18:02:25 +00:00
dgp c0a030fa0b More TCL_UNUSED deployment 2020-03-06 16:42:07 +00:00
dgp 62a2883b43 More TCL_UNUSED deployment. 2020-03-06 14:41:02 +00:00
dgp d38d34e937 Untangle some MEM_DEBUG ifdeffery. 2020-03-06 13:55:07 +00:00
dgp 39956f875b More deployment of TCL_UNUSED. (Travis appears happy with it). 2020-03-06 13:45:00 +00:00
dgp 02ceb3f3a4 Have to move the JOIN() macro out of deprecation for this TCL_UNUSED.
Alternatives welcome.
2020-03-05 19:17:34 +00:00
dgp 39cde7c069 Merge TCL_UNUSED to dev branches for full Travis testing as a tool to arrest
the undesirable explosion of "(void)dummy" through the codebase.
2020-03-05 19:09:15 +00:00
jan.nijtmans f5a3d0b135 Merge 8.6 2020-03-05 14:42:36 +00:00
jan.nijtmans 9cc797aba7 Update to Unicode-13 2020-03-05 14:39:23 +00:00
jan.nijtmans 36d1b8447c Update all internal tables to Unicode 13.
(while on it) sync tclWinDdde.c and tclWinReg.c, making it 100% identical to other branches.
2020-03-05 14:03:59 +00:00
jan.nijtmans 6daca5d73a Merge 8.6 2020-03-05 11:48:21 +00:00
jan.nijtmans 38aabeeca8 Move setting of interpreter error-message from tclUnixSock.c to tclIO.c, since the same should be done for all channel types. (Thanks, Don, for noticing this!)
Also, ENOTCONN for a half-close should not be fatal, just a EINVAL, when doing it as part of a full close. See: [65c9cd1534]
2020-03-05 11:32:43 +00:00
dgp 0bee61f5cd merge 8.6 2020-03-04 21:00:44 +00:00
dgp dd7b6e2245 The close routines of the "tcp" channel type were failing to record error
messages and error codes.
2020-03-04 20:50:38 +00:00
jan.nijtmans 9d172afc1b Merge 8.6 2020-03-04 16:17:26 +00:00
jan.nijtmans 167bc4d8e7 Some more gcc(-9) warnings 2020-03-04 16:16:30 +00:00
jan.nijtmans 1ad756567b Merge 8.6 2020-03-04 15:55:38 +00:00
jan.nijtmans 3e92ec87df Fix some gcc(-9) warnings caused by -Wcast-function-type 2020-03-04 15:52:50 +00:00
jan.nijtmans f67e087180 Merge 8.6 2020-03-04 13:59:36 +00:00
jan.nijtmans 8defb7d10b Implement WideSeekProc() for all channels which have a SeekProc(). Implement Close2Proc() for all channels, as minimal wrapper around CloseProc().
Backported (with comments) and adapted from core-8-branch.
2020-03-04 13:42:42 +00:00
dgp 71e8c4c72b Create a new macro to deal with unused arguments so we can silence compiler
warnings without the need of an explosion of noise lines "(void)dummy"
2020-03-02 17:08:01 +00:00
jan.nijtmans ac5f46d270 Don't generate "deprecated" warning for Tcl_Close(), since only the stub entry is deprecated. Will be replaced by macro. 2020-03-02 11:30:05 +00:00
jan.nijtmans 520e0c9938 Better error-message in case of "index out of range", mentioning the actual index which was out of range. Also, use the same error-code, because the underlying cause is all the same. 2020-02-29 21:42:18 +00:00
jan.nijtmans 4cca9ff9e3 Minor TIP #562 fix: Missing #endif, results in (harmless) compiler warning when compiling with -DTCL_NO_DEPRECATED. 2020-02-28 14:23:34 +00:00
jan.nijtmans 57b1d9531c Implement TIP #562: Deprecate channel types 1-4 2020-02-28 13:13:07 +00:00
jan.nijtmans 52e543c569 Implement TIP #557: C++ support for Tcl 2020-02-28 12:06:07 +00:00
jan.nijtmans f9ddbba3d6 Merge 8.6 2020-02-26 14:05:44 +00:00
jan.nijtmans a4154b246b Resolve a number of shadowed variables (discovered by compiling with -Wshadow) 2020-02-26 13:45:40 +00:00
jan.nijtmans 541f9afd42 Merge 8.7 2020-02-12 13:26:52 +00:00
jan.nijtmans e7306ac7d8 Merge 8.7 2020-02-12 13:25:11 +00:00
jan.nijtmans 45f6edc21e Update all tables to [http://unicode.org/versions/Unicode13.0.0/|Unicode 13] (to be released March 10, 2020) 2020-02-11 13:31:32 +00:00
jan.nijtmans f2ae531f0f Oopsee 2020-02-02 22:17:50 +00:00
jan.nijtmans 4c9136763a Deprecate Tcl_Close() stub entry as well 2020-02-02 22:11:38 +00:00
jan.nijtmans bfad7e731e Make Tcl_ChannelCloseProc() deprecated too. Implement close2Proc and wideSeekProc for all internal channel types. 2020-01-31 14:58:07 +00:00
jan.nijtmans ff4989d192 Merge 8.7 2020-01-31 08:00:22 +00:00
jan.nijtmans 75b437e696 Merge 8.7 2020-01-30 16:08:14 +00:00
jan.nijtmans f85de8a933 Deprecate channel types 1-4 2020-01-29 15:52:02 +00:00
162 changed files with 4656 additions and 5764 deletions
+1 -1
View File
@@ -1847,7 +1847,7 @@ a better first place to look now.
* tools/uniClass.tcl: [FRQ 3473670]: Various Unicode-related
* tools/uniParse.tcl: speedups/robustness. Enhanced tools to be
* generic/tclUniData.c: able to handle characters > 0xffff. Done in
* generic/tclUniData.c: able to handle characters > 0xFFFF. Done in
* generic/tclUtf.c: all branches in order to simplify merges for
* generic/regc_locale.c: new Unicode versions (such as 6.1)
+1 -1
View File
@@ -2913,7 +2913,7 @@
* generic/tclCompCmds.c: Updated callers to call new routine.
* generic/tclDictObj.c: Updated callers to call new routine.
* tests/obj.test: Corrected bad tests that actually expected
values like "47" and "0xac" to be accepted as booleans.
values like "47" and "0xAC" to be accepted as booleans.
* generic/tclLiteral.c: Disabled the code that forces some literals
into the "int" Tcl_ObjType during registration. We can re-enable it if
+1 -1
View File
@@ -2307,7 +2307,7 @@ to the standard channel, do not increment the refcount. The channel can
be NULL if there is for example no standard input. (JL)
9/6/96 (portability improvement) Changed parsing of backslash sequences
like \n to translate directly to absolute values like 0xa instead of
like \n to translate directly to absolute values like 0xA instead of
letting the compiler do the translation. This guarantees that the
translation is done the same everywhere. (JO)
+1 -1
View File
@@ -218,7 +218,7 @@ fake_getaddrinfo(const char *hostname, const char *servname,
}
if (!hostname) {
*res = malloc_ai(port, htonl(0x7f000001), hints);
*res = malloc_ai(port, htonl(0x7F000001), hints);
if (*res == NULL)
return (EAI_MEMORY);
return (0);
+1 -1
View File
@@ -302,7 +302,7 @@ The \fInumComponents\fR field is always 0.
.TP
\fBTCL_TOKEN_BS\fR
.
The token describes a backslash sequence such as \fB\en\fR or \fB\e0xa3\fR.
The token describes a backslash sequence such as \fB\en\fR or \fB\e0xA3\fR.
The \fInumComponents\fR field is always 0.
.TP
\fBTCL_TOKEN_COMMAND\fR
+7 -4
View File
@@ -73,7 +73,9 @@ During decoding, the following options are supported:
.TP
\fB\-strict\fR
.
Instructs the decoder to throw an error if it encounters whitespace characters. Otherwise it ignores them.
Instructs the decoder to throw an error if it encounters any characters
that are not strictly part of the encoding itself. Otherwise it ignores them.
RFC 2045 calls for base64 decoders to be non-strict.
.RE
.TP
\fBhex\fR
@@ -87,7 +89,8 @@ options are supported:
.TP
\fB\-strict\fR
.
Instructs the decoder to throw an error if it encounters whitespace characters. Otherwise it ignores them.
Instructs the decoder to throw an error if it encounters whitespace characters.
Otherwise it ignores them.
.RE
.TP
\fBuuencode\fR
@@ -117,8 +120,8 @@ During decoding, the following options are supported:
.TP
\fB\-strict\fR
.
Instructs the decoder to throw an error if it encounters unexpected whitespace
characters. Otherwise it ignores them.
Instructs the decoder to throw an error if it encounters unexpected
whitespace characters. Otherwise it ignores them.
.PP
Note that neither the encoder nor the decoder handle the header and footer of
the uuencode format.
+9 -9
View File
@@ -259,15 +259,15 @@ static const chr brbacks[] = { /* \s within brackets */
#define PUNCT_CONN \
CHR('_'), \
0x203f /* UNDERTIE */, \
0x203F /* UNDERTIE */, \
0x2040 /* CHARACTER TIE */,\
0x2054 /* INVERTED UNDERTIE */,\
0xfe33 /* PRESENTATION FORM FOR VERTICAL LOW LINE */, \
0xfe34 /* PRESENTATION FORM FOR VERTICAL WAVY LOW LINE */, \
0xfe4d /* DASHED LOW LINE */, \
0xfe4e /* CENTRELINE LOW LINE */, \
0xfe4f /* WAVY LOW LINE */, \
0xff3f /* FULLWIDTH LOW LINE */
0xFE33 /* PRESENTATION FORM FOR VERTICAL LOW LINE */, \
0xFE34 /* PRESENTATION FORM FOR VERTICAL WAVY LOW LINE */, \
0xFE4D /* DASHED LOW LINE */, \
0xFE4E /* CENTRELINE LOW LINE */, \
0xFE4F /* WAVY LOW LINE */, \
0xFF3F /* FULLWIDTH LOW LINE */
static const chr backw[] = { /* \w */
CHR('['), CHR('['), CHR(':'),
@@ -914,7 +914,7 @@ lexescape(
if (ISERR()) {
FAILW(REG_EESCAPE);
}
if (c > 0xff) {
if (c > 0xFF) {
/* out of range, so we handled one digit too much */
v->now--;
c >>= 3;
@@ -948,7 +948,7 @@ lexdigits(
n = 0;
for (len = 0; len < maxlen && !ATEOS(); len++) {
if (n > 0x10fff) {
if (n > 0x10FFF) {
/* Stop when continuing would otherwise overflow */
break;
}
+535 -528
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -808,7 +808,7 @@ parseqatom(
atom = NULL;
assert(lp->nouts == 0); /* must string new code */
assert(rp->nins == 0); /* between lp and rp */
subno = 0; /* just to shut lint up */
subno = 0;
/*
* An atom or constraint...
+2 -2
View File
@@ -91,11 +91,11 @@ typedef int celt; /* Type to hold chr, or NOCELT */
#if TCL_UTF_MAX > 3
#define CHRBITS 32 /* Bits in a chr; must not use sizeof */
#define CHR_MIN 0x00000000 /* Smallest and largest chr; the value */
#define CHR_MAX 0x10ffff /* CHR_MAX-CHR_MIN+1 should fit in uchr */
#define CHR_MAX 0x10FFFF /* CHR_MAX-CHR_MIN+1 should fit in uchr */
#else
#define CHRBITS 16 /* Bits in a chr; must not use sizeof */
#define CHR_MIN 0x0000 /* Smallest and largest chr; the value */
#define CHR_MAX 0xffff /* CHR_MAX-CHR_MIN+1 should fit in uchr */
#define CHR_MAX 0xFFFF /* CHR_MAX-CHR_MIN+1 should fit in uchr */
#endif
/*
-1
View File
@@ -54,7 +54,6 @@ static const struct rerr {
/*
- regerror - the interface to error numbers
*/
/* ARGSUSED */
size_t /* Actual space needed (including NUL) */
regerror(
int code, /* Error code, or REG_ATOI or REG_ITOA */
+2 -2
View File
@@ -74,7 +74,7 @@
#define DUPMAX _POSIX2_RE_DUP_MAX
#define DUPINF (DUPMAX+1)
#define REMAGIC 0xfed7 /* magic number for main struct */
#define REMAGIC 0xFED7 /* magic number for main struct */
/*
* debugging facilities
@@ -390,7 +390,7 @@ struct fns {
struct guts {
int magic;
#define GUTSMAGIC 0xfed9
#define GUTSMAGIC 0xFED9
int cflags; /* copy of compile flags */
long info; /* copy of re_info */
size_t nsub; /* copy of re_nsub */
+3 -3
View File
@@ -595,7 +595,7 @@ declare 166 {
}
# Tcl_GetOpenFile is only available on unix, but it is a part of the old
# generic interface, so we inlcude it here for compatibility reasons.
# generic interface, so we include it here for compatibility reasons.
declare 167 unix {
int Tcl_GetOpenFile(Tcl_Interp *interp, const char *chanID, int forWriting,
@@ -1415,7 +1415,7 @@ declare 400 {
Tcl_DriverBlockModeProc *Tcl_ChannelBlockModeProc(
const Tcl_ChannelType *chanTypePtr)
}
declare 401 {
declare 401 {deprecated {Use Tcl_ChannelClose2Proc}} {
Tcl_DriverCloseProc *Tcl_ChannelCloseProc(
const Tcl_ChannelType *chanTypePtr)
}
@@ -1431,7 +1431,7 @@ declare 404 {
Tcl_DriverOutputProc *Tcl_ChannelOutputProc(
const Tcl_ChannelType *chanTypePtr)
}
declare 405 {
declare 405 {deprecated {Use Tcl_ChannelWideSeekProc}} {
Tcl_DriverSeekProc *Tcl_ChannelSeekProc(
const Tcl_ChannelType *chanTypePtr)
}
+3 -1
View File
@@ -1400,10 +1400,12 @@ typedef void (Tcl_ScaleTimeProc) (Tcl_Time *timebuf, ClientData clientData);
* Channel version tag. This was introduced in 8.3.2/8.4.
*/
#ifndef TCL_NO_DEPRECATED
#define TCL_CHANNEL_VERSION_1 ((Tcl_ChannelTypeVersion) 0x1)
#define TCL_CHANNEL_VERSION_2 ((Tcl_ChannelTypeVersion) 0x2)
#define TCL_CHANNEL_VERSION_3 ((Tcl_ChannelTypeVersion) 0x3)
#define TCL_CHANNEL_VERSION_4 ((Tcl_ChannelTypeVersion) 0x4)
#endif
#define TCL_CHANNEL_VERSION_5 ((Tcl_ChannelTypeVersion) 0x5)
/*
@@ -1472,7 +1474,7 @@ typedef struct Tcl_ChannelType {
/* Version of the channel type. */
Tcl_DriverCloseProc *closeProc;
/* Function to call to close the channel, or
* TCL_CLOSE2PROC if the close2Proc should be
* NULL or TCL_CLOSE2PROC if the close2Proc should be
* used instead. */
Tcl_DriverInputProc *inputProc;
/* Function to call for input on channel. */
+16 -16
View File
@@ -68,7 +68,7 @@ union overhead {
};
#define MAGIC 0xef /* magic # on accounting info */
#define MAGIC 0xEF /* magic # on accounting info */
#define RMAGIC 0x5555 /* magic # on range info */
#ifndef NDEBUG
@@ -249,7 +249,7 @@ TclFinalizeAllocSubsystem(void)
*----------------------------------------------------------------------
*/
char *
void *
TclpAlloc(
unsigned int numBytes) /* Number of bytes to allocate. */
{
@@ -288,7 +288,7 @@ TclpAlloc(
overPtr = (union overhead *) (bigBlockPtr + 1);
overPtr->overMagic0 = overPtr->overMagic1 = MAGIC;
overPtr->bucketIndex = 0xff;
overPtr->bucketIndex = 0xFF;
#ifdef MSTATS
numMallocs[NBUCKETS]++;
#endif
@@ -446,7 +446,7 @@ MoreCore(
void
TclpFree(
char *oldPtr) /* Pointer to memory to free. */
void *oldPtr) /* Pointer to memory to free. */
{
size_t size;
union overhead *overPtr;
@@ -469,7 +469,7 @@ TclpFree(
RANGE_ASSERT(overPtr->rangeCheckMagic == RMAGIC);
RANGE_ASSERT(BLOCK_END(overPtr) == RMAGIC);
size = overPtr->bucketIndex;
if (size == 0xff) {
if (size == 0xFF) {
#ifdef MSTATS
numMallocs[NBUCKETS]--;
#endif
@@ -509,9 +509,9 @@ TclpFree(
*----------------------------------------------------------------------
*/
char *
void *
TclpRealloc(
char *oldPtr, /* Pointer to alloced block. */
void *oldPtr, /* Pointer to alloced block. */
unsigned int numBytes) /* New size of memory. */
{
int i;
@@ -543,7 +543,7 @@ TclpRealloc(
* If the block isn't in a bin, just realloc it.
*/
if (i == 0xff) {
if (i == 0xFF) {
struct block *prevPtr, *nextPtr;
bigBlockPtr = (struct block *) overPtr - 1;
prevPtr = bigBlockPtr->prevPtr;
@@ -581,7 +581,7 @@ TclpRealloc(
#endif
Tcl_MutexUnlock(allocMutexPtr);
return (char *)(overPtr+1);
return (void *)(overPtr+1);
}
maxSize = 1 << (i+3);
expensive = 0;
@@ -592,7 +592,7 @@ TclpRealloc(
}
if (expensive) {
char *newPtr;
void *newPtr;
Tcl_MutexUnlock(allocMutexPtr);
@@ -692,11 +692,11 @@ mstats(
*----------------------------------------------------------------------
*/
char *
void *
TclpAlloc(
unsigned int numBytes) /* Number of bytes to allocate. */
{
return (char *) malloc(numBytes);
return malloc(numBytes);
}
/*
@@ -717,7 +717,7 @@ TclpAlloc(
void
TclpFree(
char *oldPtr) /* Pointer to memory to free. */
void *oldPtr) /* Pointer to memory to free. */
{
free(oldPtr);
return;
@@ -739,12 +739,12 @@ TclpFree(
*----------------------------------------------------------------------
*/
char *
void *
TclpRealloc(
char *oldPtr, /* Pointer to alloced block. */
void *oldPtr, /* Pointer to alloced block. */
unsigned int numBytes) /* New size of memory. */
{
return (char *) realloc(oldPtr, numBytes);
return realloc(oldPtr, numBytes);
}
#endif /* !USE_TCLALLOC */
+13 -20
View File
@@ -676,7 +676,7 @@ BBEmitOpcode(
/* Compilation environment */
BasicBlock* bbPtr = assemEnvPtr->curr_bb;
/* Current basic block */
int op = TalInstructionTable[tblIdx].tclInstCode & 0xff;
int op = TalInstructionTable[tblIdx].tclInstCode & 0xFF;
/*
* If this is the first instruction in a basic block, record its line
@@ -738,13 +738,13 @@ BBEmitInst1or4(
/* Current basic block */
int op = TalInstructionTable[tblIdx].tclInstCode;
if (param <= 0xff) {
if (param <= 0xFF) {
op >>= 8;
} else {
op &= 0xff;
op &= 0xFF;
}
TclEmitInt1(op, envPtr);
if (param <= 0xff) {
if (param <= 0xFF) {
TclEmitInt1(param, envPtr);
} else {
TclEmitInt4(param, envPtr);
@@ -787,7 +787,7 @@ Tcl_AssembleObjCmd(
int
TclNRAssembleObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -796,7 +796,6 @@ TclNRAssembleObjCmd(
Tcl_Obj* backtrace; /* Object where extra error information is
* constructed. */
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "bytecodeList");
return TCL_ERROR;
@@ -961,8 +960,7 @@ TclCompileAssembleCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr; /* Token in the input script */
@@ -970,7 +968,6 @@ TclCompileAssembleCmd(
int numCommands = envPtr->numCommands;
int offset = envPtr->codeNext - envPtr->codeStart;
int depth = envPtr->currStackDepth;
(void)cmdPtr;
/*
* Make sure that the command has a single arg that is a simple word.
*/
@@ -1709,9 +1706,7 @@ AssembleOneLine(
goto cleanup;
}
{
int flags = TCL_REG_ADVANCED | (opnd ? TCL_REG_NOCASE : 0);
BBEmitInstInt1(assemEnvPtr, tblIdx, flags, 0);
BBEmitInstInt1(assemEnvPtr, tblIdx, TCL_REG_ADVANCED | (opnd ? TCL_REG_NOCASE : 0), 0);
}
break;
@@ -2238,7 +2233,7 @@ GetIntegerOperand(
* TCL_ERROR (with an appropriate error message) if the parse fails.
*
* Side effects:
* Stores the list index at '*index'. Values between -1 and 0x7fffffff
* Stores the list index at '*index'. Values between -1 and 0x7FFFFFFF
* have their natural meaning; values between -2 and -0x80000000
* represent 'end-2-N'.
*
@@ -2401,7 +2396,7 @@ CheckOneByte(
{
Tcl_Obj* result; /* Error message */
if (value < 0 || value > 0xff) {
if (value < 0 || value > 0xFF) {
result = Tcl_NewStringObj("operand does not fit in one byte", -1);
Tcl_SetObjResult(interp, result);
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "1BYTE", NULL);
@@ -2436,7 +2431,7 @@ CheckSignedOneByte(
{
Tcl_Obj* result; /* Error message */
if (value > 0x7f || value < -0x80) {
if (value > 0x7F || value < -0x80) {
result = Tcl_NewStringObj("operand does not fit in one byte", -1);
Tcl_SetObjResult(interp, result);
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "1BYTE", NULL);
@@ -2850,7 +2845,7 @@ CalculateJumpRelocations(
if (bbPtr->flags & BB_JUMP1) {
offset = jumpTarget->startOffset
- (bbPtr->jumpOffset + motion);
if (offset < -0x80 || offset > 0x7f) {
if (offset < -0x80 || offset > 0x7F) {
opcode = TclGetUInt1AtPtr(envPtr->codeStart
+ bbPtr->jumpOffset);
++opcode;
@@ -4316,11 +4311,9 @@ AddBasicBlockRangeToErrorInfo(
static void
DupAssembleCodeInternalRep(
Tcl_Obj *srcPtr,
Tcl_Obj *copyPtr)
TCL_UNUSED(Tcl_Obj *),
TCL_UNUSED(Tcl_Obj *))
{
(void)srcPtr;
(void)copyPtr;
return;
}
+52 -101
View File
@@ -653,7 +653,6 @@ Tcl_CreateInterp(void)
*/
if (sizeof(Tcl_CallFrame) < sizeof(CallFrame)) {
/*NOTREACHED*/
Tcl_Panic("Tcl_CallFrame must not be smaller than CallFrame");
}
@@ -666,7 +665,6 @@ Tcl_CreateInterp(void)
*/
if ((offsetof(Tcl_StatBuf,st_atime) != 32)
|| (offsetof(Tcl_StatBuf,st_ctime) != 40)) {
/*NOTREACHED*/
Tcl_Panic("<sys/stat.h> is not compatible with MSVC");
}
#endif
@@ -1374,12 +1372,10 @@ static int
BadEnsembleSubcommand(
ClientData clientData,
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
TCL_UNUSED(int) /*objc*/,
TCL_UNUSED(Tcl_Obj *const *) /* objv */)
{
const UnsafeEnsembleInfo *infoPtr = (const UnsafeEnsembleInfo *)clientData;
(void)objc;
(void)objv;
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"not allowed to invoke subcommand %s of %s",
@@ -3319,13 +3315,12 @@ Tcl_GetCommandInfoFromToken(
const char *
Tcl_GetCommandName(
Tcl_Interp *dummy, /* Not used. */
TCL_UNUSED(Tcl_Interp *),
Tcl_Command command) /* Token for command returned by a previous
* call to Tcl_CreateCommand. The command must
* not have been deleted. */
{
Command *cmdPtr = (Command *) command;
(void)dummy;
if ((cmdPtr == NULL) || (cmdPtr->hPtr == NULL)) {
/*
@@ -3768,12 +3763,11 @@ CallCommandTraces(
static int
CancelEvalProc(
ClientData clientData, /* Interp to cancel the script in progress. */
Tcl_Interp *dummy, /* Not used. */
TCL_UNUSED(Tcl_Interp *),
int code) /* Current return code from command. */
{
CancelInfo *cancelInfo = (CancelInfo *)clientData;
Interp *iPtr;
(void)dummy;
if (cancelInfo != NULL) {
Tcl_MutexLock(&cancelLock);
@@ -4616,7 +4610,7 @@ static int
EvalObjvCore(
ClientData data[],
Tcl_Interp *interp,
int result)
TCL_UNUSED(int) /*result*/)
{
Command *cmdPtr = NULL, *preCmdPtr = (Command *)data[0];
int flags = PTR2INT(data[1]);
@@ -4625,7 +4619,6 @@ EvalObjvCore(
Interp *iPtr = (Interp *) interp;
Namespace *lookupNsPtr = NULL;
int enterTracesDone = 0;
(void)result;
/*
* Push records for task to be done on return, in INVERSE order. First, if
@@ -4777,14 +4770,13 @@ static int
Dispatch(
ClientData data[],
Tcl_Interp *interp,
int result)
TCL_UNUSED(int) /*result*/)
{
Tcl_ObjCmdProc *objProc = (Tcl_ObjCmdProc *)data[0];
ClientData clientData = data[1];
int objc = PTR2INT(data[2]);
Tcl_Obj **objv = (Tcl_Obj **)data[3];
Interp *iPtr = (Interp *) interp;
(void)result;
#ifdef USE_DTRACE
if (TCL_DTRACE_CMD_ARGS_ENABLED()) {
@@ -7037,7 +7029,7 @@ TclObjInvoke(
int
TclNRInvoke(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -7047,7 +7039,6 @@ TclNRInvoke(
const char *cmdName; /* Name of the command from objv[0]. */
Tcl_HashEntry *hPtr = NULL;
Command *cmdPtr;
(void)dummy;
cmdName = TclGetString(objv[0]);
hTblPtr = iPtr->hiddenCmdTablePtr;
@@ -7081,12 +7072,11 @@ TclNRInvoke(
static int
NRPostInvoke(
ClientData dummy[], /* Not used. */
TCL_UNUSED(ClientData *),
Tcl_Interp *interp,
int result)
{
Interp *iPtr = (Interp *)interp;
(void)dummy;
iPtr->numLevels--;
return result;
@@ -7347,7 +7337,6 @@ Tcl_VarEvalVA(
*
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_VarEval(
Tcl_Interp *interp,
@@ -7522,7 +7511,7 @@ Tcl_GetVersion(
static int
ExprCeilFunc(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count. */
@@ -7531,7 +7520,6 @@ ExprCeilFunc(
int code;
double d;
mp_int big;
(void)dummy;
if (objc != 2) {
MathFuncWrongNumArgs(interp, 2, objc, objv);
@@ -7563,7 +7551,7 @@ ExprCeilFunc(
static int
ExprFloorFunc(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count. */
@@ -7572,7 +7560,6 @@ ExprFloorFunc(
int code;
double d;
mp_int big;
(void)dummy;
if (objc != 2) {
MathFuncWrongNumArgs(interp, 2, objc, objv);
@@ -7604,7 +7591,7 @@ ExprFloorFunc(
static int
ExprIsqrtFunc(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* The interpreter in which to execute. */
int objc, /* Actual parameter count. */
Tcl_Obj *const *objv) /* Actual parameter list. */
@@ -7616,7 +7603,6 @@ ExprIsqrtFunc(
mp_int big;
int exact = 0; /* Flag ==1 if the argument can be represented
* in a double as an exact integer. */
(void)dummy;
/*
* Check syntax.
@@ -7711,7 +7697,7 @@ ExprIsqrtFunc(
static int
ExprSqrtFunc(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count. */
@@ -7720,7 +7706,6 @@ ExprSqrtFunc(
int code;
double d;
mp_int big;
(void)dummy;
if (objc != 2) {
MathFuncWrongNumArgs(interp, 2, objc, objv);
@@ -7880,7 +7865,7 @@ ExprBinaryFunc(
static int
ExprAbsFunc(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count. */
@@ -7889,7 +7874,6 @@ ExprAbsFunc(
ClientData ptr;
int type;
mp_int big;
(void)dummy;
if (objc != 2) {
MathFuncWrongNumArgs(interp, 2, objc, objv);
@@ -7980,14 +7964,13 @@ ExprAbsFunc(
static int
ExprBoolFunc(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count. */
Tcl_Obj *const *objv) /* Actual parameter vector. */
{
int value;
(void)dummy;
if (objc != 2) {
MathFuncWrongNumArgs(interp, 2, objc, objv);
@@ -8002,14 +7985,13 @@ ExprBoolFunc(
static int
ExprDoubleFunc(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count. */
Tcl_Obj *const *objv) /* Actual parameter vector. */
{
double dResult;
(void)dummy;
if (objc != 2) {
MathFuncWrongNumArgs(interp, 2, objc, objv);
@@ -8030,7 +8012,7 @@ ExprDoubleFunc(
static int
ExprIntFunc(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count. */
@@ -8039,7 +8021,6 @@ ExprIntFunc(
double d;
int type;
ClientData ptr;
(void)dummy;
if (objc != 2) {
MathFuncWrongNumArgs(interp, 2, objc, objv);
@@ -8087,14 +8068,13 @@ ExprIntFunc(
static int
ExprWideFunc(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count. */
Tcl_Obj *const *objv) /* Actual parameter vector. */
{
Tcl_WideInt wResult;
(void)dummy;
if (ExprIntFunc(NULL, interp, objc, objv) != TCL_OK) {
return TCL_ERROR;
@@ -8109,7 +8089,7 @@ ExprWideFunc(
*/
static int
ExprMaxMinFunc(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count. */
@@ -8120,7 +8100,6 @@ ExprMaxMinFunc(
double d;
int type, i;
ClientData ptr;
(void)dummy;
if (objc < 2) {
MathFuncWrongNumArgs(interp, 2, objc, objv);
@@ -8150,31 +8129,29 @@ ExprMaxMinFunc(
static int
ExprMaxFunc(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count. */
Tcl_Obj *const *objv) /* Actual parameter vector. */
{
(void)dummy;
return ExprMaxMinFunc(NULL, interp, objc, objv, MP_GT);
}
static int
ExprMinFunc(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count. */
Tcl_Obj *const *objv) /* Actual parameter vector. */
{
(void)dummy;
return ExprMaxMinFunc(NULL, interp, objc, objv, MP_LT);
}
static int
ExprRandFunc(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count. */
@@ -8185,7 +8162,6 @@ ExprRandFunc(
long tmp; /* Algorithm assumes at least 32 bits. Only
* long guarantees that. See below. */
Tcl_Obj *oResult;
(void)dummy;
if (objc != 1) {
MathFuncWrongNumArgs(interp, 1, objc, objv);
@@ -8206,8 +8182,8 @@ ExprRandFunc(
* Make sure 1 <= randSeed <= (2^31) - 2. See below.
*/
iPtr->randSeed &= 0x7fffffff;
if ((iPtr->randSeed == 0) || (iPtr->randSeed == 0x7fffffff)) {
iPtr->randSeed &= 0x7FFFFFFF;
if ((iPtr->randSeed == 0) || (iPtr->randSeed == 0x7FFFFFFF)) {
iPtr->randSeed ^= 123459876;
}
}
@@ -8268,7 +8244,7 @@ ExprRandFunc(
static int
ExprRoundFunc(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count. */
@@ -8277,7 +8253,6 @@ ExprRoundFunc(
double d;
ClientData ptr;
int type;
(void)dummy;
if (objc != 2) {
MathFuncWrongNumArgs(interp, 2, objc, objv);
@@ -8348,15 +8323,14 @@ ExprRoundFunc(
static int
ExprSrandFunc(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count. */
Tcl_Obj *const *objv) /* Parameter vector. */
{
Interp *iPtr = (Interp *) interp;
Tcl_WideInt w = 0; /* Initialized to avoid compiler warning. */
(void)dummy;
Tcl_WideInt w = 0; /* Initialized to avoid compiler warning. */
/*
* Convert argument and use it to reset the seed.
@@ -8377,8 +8351,8 @@ ExprSrandFunc(
*/
iPtr->flags |= RAND_SEED_INITIALIZED;
iPtr->randSeed = (long) w & 0x7fffffff;
if ((iPtr->randSeed == 0) || (iPtr->randSeed == 0x7fffffff)) {
iPtr->randSeed = (long) w & 0x7FFFFFFF;
if ((iPtr->randSeed == 0) || (iPtr->randSeed == 0x7FFFFFFF)) {
iPtr->randSeed ^= 123459876;
}
@@ -8471,9 +8445,9 @@ ClassifyDouble(
* Shifts and masks to use with the doubleMeaning variable above.
*/
#define EXPONENT_MASK 0x7ff /* 11 bits (after shifting) */
#define EXPONENT_MASK 0x7FF /* 11 bits (after shifting) */
#define EXPONENT_SHIFT 20 /* Moves exponent to bottom of word */
#define MANTISSA_MASK 0xfffff /* 20 bits (plus 32 from other word) */
#define MANTISSA_MASK 0xFFFFF /* 20 bits (plus 32 from other word) */
/*
* Extract the exponent (11 bits) and mantissa (52 bits). Note that we
@@ -8538,7 +8512,7 @@ ClassifyDouble(
static int
ExprIsFiniteFunc(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count */
@@ -8547,7 +8521,6 @@ ExprIsFiniteFunc(
double d;
ClientData ptr;
int type, result = 0;
(void)dummy;
if (objc != 2) {
MathFuncWrongNumArgs(interp, 2, objc, objv);
@@ -8570,7 +8543,7 @@ ExprIsFiniteFunc(
static int
ExprIsInfinityFunc(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count */
@@ -8579,7 +8552,6 @@ ExprIsInfinityFunc(
double d;
ClientData ptr;
int type, result = 0;
(void)dummy;
if (objc != 2) {
MathFuncWrongNumArgs(interp, 2, objc, objv);
@@ -8601,7 +8573,7 @@ ExprIsInfinityFunc(
static int
ExprIsNaNFunc(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count */
@@ -8610,7 +8582,6 @@ ExprIsNaNFunc(
double d;
ClientData ptr;
int type, result = 1;
(void)dummy;
if (objc != 2) {
MathFuncWrongNumArgs(interp, 2, objc, objv);
@@ -8632,7 +8603,7 @@ ExprIsNaNFunc(
static int
ExprIsNormalFunc(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count */
@@ -8641,7 +8612,6 @@ ExprIsNormalFunc(
double d;
ClientData ptr;
int type, result = 0;
(void)dummy;
if (objc != 2) {
MathFuncWrongNumArgs(interp, 2, objc, objv);
@@ -8663,7 +8633,7 @@ ExprIsNormalFunc(
static int
ExprIsSubnormalFunc(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count */
@@ -8672,7 +8642,6 @@ ExprIsSubnormalFunc(
double d;
ClientData ptr;
int type, result = 0;
(void)dummy;
if (objc != 2) {
MathFuncWrongNumArgs(interp, 2, objc, objv);
@@ -8694,7 +8663,7 @@ ExprIsSubnormalFunc(
static int
ExprIsUnorderedFunc(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count */
@@ -8703,7 +8672,6 @@ ExprIsUnorderedFunc(
double d;
ClientData ptr;
int type, result = 0;
(void)dummy;
if (objc != 3) {
MathFuncWrongNumArgs(interp, 3, objc, objv);
@@ -8736,7 +8704,7 @@ ExprIsUnorderedFunc(
static int
FloatClassifyObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count */
@@ -8746,7 +8714,6 @@ FloatClassifyObjCmd(
Tcl_Obj *objPtr;
ClientData ptr;
int type;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "floatValue");
@@ -8846,14 +8813,11 @@ MathFuncWrongNumArgs(
static int
DTraceObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
TCL_UNUSED(ClientData),
TCL_UNUSED(Tcl_Interp *),
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
(void)dummy;
(void)interp;
if (TCL_DTRACE_TCL_PROBE_ENABLED()) {
char *a[10];
int i = 0;
@@ -9233,13 +9197,12 @@ TclSetTailcall(
int
TclNRTailcallObjCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
Interp *iPtr = (Interp *) interp;
(void)dummy;
if (objc < 1) {
Tcl_WrongNumArgs(interp, 1, objv, "?command? ?arg ...?");
@@ -9339,11 +9302,10 @@ TclNRTailcallEval(
int
TclNRReleaseValues(
ClientData data[],
Tcl_Interp *dummy,
TCL_UNUSED(Tcl_Interp *),
int result)
{
int i = 0;
(void)dummy;
while (i < 4) {
if (data[i]) {
@@ -9428,7 +9390,7 @@ TclNRYieldObjCmd(
int
TclNRYieldToObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -9436,7 +9398,6 @@ TclNRYieldToObjCmd(
CoroutineData *corPtr = iPtr->execEnvPtr->corPtr;
Tcl_Obj *listPtr, *nsObjPtr;
Tcl_Namespace *nsPtr = TclGetCurrentNamespace(interp);
(void)dummy;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "command ?arg ...?");
@@ -9483,9 +9444,8 @@ static int
RewindCoroutineCallback(
ClientData data[],
Tcl_Interp *interp,
int result)
TCL_UNUSED(int) /*result*/)
{
(void)result;
return Tcl_RestoreInterpState(interp, (Tcl_InterpState)data[0]);
}
@@ -9635,13 +9595,12 @@ int
TclNRCoroutineActivateCallback(
ClientData data[],
Tcl_Interp *interp,
int result)
TCL_UNUSED(int) /*result*/)
{
CoroutineData *corPtr = (CoroutineData *)data[0];
int type = PTR2INT(data[1]);
int numLevels, unused;
int *stackLevel = &unused;
(void)result;
if (!corPtr->stackLevel) {
/*
@@ -9715,12 +9674,11 @@ static int
TclNREvalList(
ClientData data[],
Tcl_Interp *interp,
int result)
TCL_UNUSED(int) /*result*/)
{
int objc;
Tcl_Obj **objv;
Tcl_Obj *listPtr = (Tcl_Obj *)data[0];
(void)result;
Tcl_IncrRefCount(listPtr);
@@ -9742,14 +9700,13 @@ TclNREvalList(
static int
CoroTypeObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
Command *cmdPtr;
CoroutineData *corPtr;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "coroName");
@@ -9833,14 +9790,13 @@ GetCoroutineFromObj(
static int
TclNRCoroInjectObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
CoroutineData *corPtr;
ExecEnv *savedEEPtr = iPtr->execEnvPtr;
(void)dummy;
/*
* Usage more or less like tailcall:
@@ -9879,7 +9835,7 @@ TclNRCoroInjectObjCmd(
static int
TclNRCoroProbeObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -9888,7 +9844,6 @@ TclNRCoroProbeObjCmd(
ExecEnv *savedEEPtr = iPtr->execEnvPtr;
int numLevels, unused;
int *stackLevel = &unused;
(void)dummy;
/*
* Usage more or less like tailcall:
@@ -9979,7 +9934,7 @@ static int
InjectHandler(
ClientData data[],
Tcl_Interp *interp,
int result)
TCL_UNUSED(int) /*result*/)
{
CoroutineData *corPtr = (CoroutineData *)data[0];
Tcl_Obj *listPtr = (Tcl_Obj *)data[1];
@@ -9987,7 +9942,6 @@ InjectHandler(
ClientData isProbe = data[3];
int objc;
Tcl_Obj **objv;
(void)result;
if (!isProbe) {
/*
@@ -10074,14 +10028,13 @@ InjectHandlerPostCall(
static int
NRInjectObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
CoroutineData *corPtr;
ExecEnv *savedEEPtr = iPtr->execEnvPtr;
(void)dummy;
/*
* Usage more or less like tailcall:
@@ -10184,7 +10137,7 @@ TclNRInterpCoroutine(
int
TclNRCoroutineObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -10195,7 +10148,6 @@ TclNRCoroutineObjCmd(
Namespace *nsPtr, *altNsPtr, *cxtNsPtr,
*inNsPtr = (Namespace *)TclGetCurrentNamespace(interp);
Namespace *lookupNsPtr = iPtr->varFramePtr->nsPtr;
(void)dummy;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 1, objv, "name cmd ?arg ...?");
@@ -10318,13 +10270,12 @@ TclNRCoroutineObjCmd(
int
TclInfoCoroutineCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
CoroutineData *corPtr = iPtr->execEnvPtr->corPtr;
(void)dummy;
if (objc != 1) {
Tcl_WrongNumArgs(interp, 1, objv, NULL);
+216 -104
View File
@@ -267,6 +267,9 @@ const Tcl_ObjType tclByteArrayType = {
*/
typedef struct ByteArray {
unsigned int bad; /* Index of the character that is a nonbyte.
* If all characters are bytes, bad = used,
* though then we should never read it. */
unsigned int used; /* The number of bytes used in the byte
* array. */
unsigned int allocated; /* The amount of space actually allocated
@@ -352,6 +355,7 @@ Tcl_NewByteArrayObj(
*----------------------------------------------------------------------
*/
#ifdef TCL_MEM_DEBUG
Tcl_Obj *
Tcl_DbNewByteArrayObj(
const unsigned char *bytes, /* The array of bytes used to initialize the
@@ -363,18 +367,25 @@ Tcl_DbNewByteArrayObj(
int line) /* Line number in the source file; used for
* debugging. */
{
#ifdef TCL_MEM_DEBUG
Tcl_Obj *objPtr;
TclDbNewObj(objPtr, file, line);
Tcl_SetByteArrayObj(objPtr, bytes, length);
return objPtr;
#else /* if not TCL_MEM_DEBUG */
(void)file;
(void)line;
return Tcl_NewByteArrayObj(bytes, length);
#endif /* TCL_MEM_DEBUG */
}
#else /* if not TCL_MEM_DEBUG */
Tcl_Obj *
Tcl_DbNewByteArrayObj(
const unsigned char *bytes, /* The array of bytes used to initialize the
* new object. */
int length, /* Length of the array of bytes, which must be
* >= 0. */
TCL_UNUSED(const char *) /*file*/,
TCL_UNUSED(int) /*line*/)
{
return Tcl_NewByteArrayObj(bytes, length);
}
#endif /* TCL_MEM_DEBUG */
/*
*---------------------------------------------------------------------------
@@ -414,6 +425,7 @@ Tcl_SetByteArrayObj(
length = 0;
}
byteArrayPtr = (ByteArray *)ckalloc(BYTEARRAY_SIZE(length));
byteArrayPtr->bad = length;
byteArrayPtr->used = length;
byteArrayPtr->allocated = length;
@@ -425,6 +437,62 @@ Tcl_SetByteArrayObj(
Tcl_StoreIntRep(objPtr, &properByteArrayType, &ir);
}
/*
*----------------------------------------------------------------------
*
* TclGetBytesFromObj --
*
* Attempt to extract the value from objPtr in the representation
* of a byte sequence. On success return the extracted byte sequence.
* On failures, return NULL and record error message and code in
* interp (if not NULL).
*
* Results:
* Pointer to array of bytes, or NULL. representing the ByteArray object.
* Writes number of bytes in array to *lengthPtr.
*
*----------------------------------------------------------------------
*/
unsigned char *
TclGetBytesFromObj(
Tcl_Interp *interp, /* For error reporting */
Tcl_Obj *objPtr, /* Value to extract from */
int *lengthPtr) /* If non-NULL, filled with length of the
* array of bytes in the ByteArray object. */
{
ByteArray *baPtr;
const Tcl_ObjIntRep *irPtr = TclFetchIntRep(objPtr, &properByteArrayType);
if (irPtr == NULL) {
SetByteArrayFromAny(NULL, objPtr);
irPtr = TclFetchIntRep(objPtr, &properByteArrayType);
if (irPtr == NULL) {
if (interp) {
const char *nonbyte;
Tcl_UniChar ch;
irPtr = TclFetchIntRep(objPtr, &tclByteArrayType);
baPtr = GET_BYTEARRAY(irPtr);
nonbyte = Tcl_UtfAtIndex(Tcl_GetString(objPtr), baPtr->bad);
Tcl_UtfToUniChar(nonbyte, &ch);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"expected byte sequence but character %d "
"was '%1s' (U+%04X)", baPtr->bad, nonbyte, ch));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "BYTES", NULL);
}
return NULL;
}
}
baPtr = GET_BYTEARRAY(irPtr);
if (lengthPtr != NULL) {
*lengthPtr = baPtr->used;
}
return baPtr->bytes;
}
/*
*----------------------------------------------------------------------
*
@@ -450,18 +518,16 @@ Tcl_GetByteArrayFromObj(
* array of bytes in the ByteArray object. */
{
ByteArray *baPtr;
const Tcl_ObjIntRep *irPtr = TclFetchIntRep(objPtr, &properByteArrayType);
const Tcl_ObjIntRep *irPtr;
unsigned char *result = TclGetBytesFromObj(NULL, objPtr, lengthPtr);
if (irPtr == NULL) {
irPtr = TclFetchIntRep(objPtr, &tclByteArrayType);
if (irPtr == NULL) {
SetByteArrayFromAny(NULL, objPtr);
irPtr = TclFetchIntRep(objPtr, &properByteArrayType);
if (irPtr == NULL) {
irPtr = TclFetchIntRep(objPtr, &tclByteArrayType);
}
}
if (result) {
return result;
}
irPtr = TclFetchIntRep(objPtr, &tclByteArrayType);
assert(irPtr != NULL);
baPtr = GET_BYTEARRAY(irPtr);
if (lengthPtr != NULL) {
@@ -527,6 +593,8 @@ Tcl_SetByteArrayLength(
SET_BYTEARRAY(irPtr, byteArrayPtr);
}
TclInvalidateStringRep(objPtr);
objPtr->typePtr = &properByteArrayType;
byteArrayPtr->bad = newLength;
byteArrayPtr->used = newLength;
return byteArrayPtr->bytes;
}
@@ -549,17 +617,15 @@ Tcl_SetByteArrayLength(
static int
SetByteArrayFromAny(
Tcl_Interp *dummy, /* Not used. */
TCL_UNUSED(Tcl_Interp *),
Tcl_Obj *objPtr) /* The object to convert to type ByteArray. */
{
size_t length;
int improper = 0;
size_t length, bad;
const char *src, *srcEnd;
unsigned char *dst;
Tcl_UniChar ch = 0;
ByteArray *byteArrayPtr;
Tcl_ObjIntRep ir;
(void)dummy;
if (TclHasIntRep(objPtr, &properByteArrayType)) {
return TCL_OK;
@@ -569,22 +635,30 @@ SetByteArrayFromAny(
}
src = TclGetString(objPtr);
length = objPtr->length;
length = bad = objPtr->length;
srcEnd = src + length;
byteArrayPtr = (ByteArray *)ckalloc(BYTEARRAY_SIZE(length));
for (dst = byteArrayPtr->bytes; src < srcEnd; ) {
src += TclUtfToUniChar(src, &ch);
improper = improper || (ch > 255);
if ((bad == length) && (ch > 255)) {
bad = dst - byteArrayPtr->bytes;
}
*dst++ = UCHAR(ch);
}
byteArrayPtr->used = dst - byteArrayPtr->bytes;
byteArrayPtr->allocated = length;
SET_BYTEARRAY(&ir, byteArrayPtr);
Tcl_StoreIntRep(objPtr,
improper ? &tclByteArrayType : &properByteArrayType, &ir);
byteArrayPtr->allocated = length;
byteArrayPtr->used = dst - byteArrayPtr->bytes;
if (bad == length) {
byteArrayPtr->bad = byteArrayPtr->used;
Tcl_StoreIntRep(objPtr, &properByteArrayType, &ir);
} else {
byteArrayPtr->bad = bad;
Tcl_StoreIntRep(objPtr, &tclByteArrayType, &ir);
}
return TCL_OK;
}
@@ -649,6 +723,7 @@ DupByteArrayInternalRep(
length = srcArrayPtr->used;
copyArrayPtr = (ByteArray *)ckalloc(BYTEARRAY_SIZE(length));
copyArrayPtr->bad = srcArrayPtr->bad;
copyArrayPtr->used = length;
copyArrayPtr->allocated = length;
memcpy(copyArrayPtr->bytes, srcArrayPtr->bytes, length);
@@ -670,6 +745,7 @@ DupProperByteArrayInternalRep(
length = srcArrayPtr->used;
copyArrayPtr = (ByteArray *)ckalloc(BYTEARRAY_SIZE(length));
copyArrayPtr->bad = length;
copyArrayPtr->used = length;
copyArrayPtr->allocated = length;
memcpy(copyArrayPtr->bytes, srcArrayPtr->bytes, length);
@@ -844,6 +920,7 @@ TclAppendBytesToByteArray(
}
byteArrayPtr->used += length;
TclInvalidateStringRep(objPtr);
objPtr->typePtr = &properByteArrayType;
}
/*
@@ -893,7 +970,7 @@ TclInitBinaryCmd(
static int
BinaryFormatCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -915,7 +992,6 @@ BinaryFormatCmd(
const char *errorString;
const char *errorValue, *str;
int offset, size, length;
(void)dummy;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "formatString ?arg ...?");
@@ -1228,7 +1304,7 @@ BinaryFormatCmd(
if (c > 16) {
c += ('A' - 'a');
}
value |= (c & 0xf);
value |= (c & 0xF);
if (offset % 2) {
*cursor++ = (char) value;
value = 0;
@@ -1250,9 +1326,9 @@ BinaryFormatCmd(
if (c > 16) {
c += ('A' - 'a');
}
value |= ((c << 4) & 0xf0);
value |= ((c << 4) & 0xF0);
if (offset % 2) {
*cursor++ = UCHAR(value & 0xff);
*cursor++ = UCHAR(value & 0xFF);
value = 0;
}
}
@@ -1399,7 +1475,7 @@ BinaryFormatCmd(
int
BinaryScanCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1422,7 +1498,6 @@ BinaryScanCmd(
Tcl_Obj *valuePtr, *elementPtr;
Tcl_HashTable numberCacheHash;
Tcl_HashTable *numberCachePtr;
(void)dummy;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 1, objv,
@@ -1586,7 +1661,7 @@ BinaryScanCmd(
} else {
value = *src++;
}
*dest++ = hexdigit[value & 0xf];
*dest++ = hexdigit[value & 0xF];
}
} else {
for (i = 0; i < count; i++) {
@@ -1595,7 +1670,7 @@ BinaryScanCmd(
} else {
value = *src++;
}
*dest++ = hexdigit[(value >> 4) & 0xf];
*dest++ = hexdigit[(value >> 4) & 0xF];
}
}
@@ -2467,7 +2542,7 @@ DeleteScanNumberCache(
static int
BinaryEncodeHex(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -2476,7 +2551,6 @@ BinaryEncodeHex(
unsigned char *data = NULL;
unsigned char *cursor = NULL;
int offset = 0, count = 0;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "data");
@@ -2487,8 +2561,8 @@ BinaryEncodeHex(
data = Tcl_GetByteArrayFromObj(objv[1], &count);
cursor = Tcl_SetByteArrayLength(resultObj, count * 2);
for (offset = 0; offset < count; ++offset) {
*cursor++ = HexDigits[(data[offset] >> 4) & 0x0f];
*cursor++ = HexDigits[data[offset] & 0x0f];
*cursor++ = HexDigits[(data[offset] >> 4) & 0x0F];
*cursor++ = HexDigits[data[offset] & 0x0F];
}
Tcl_SetObjResult(interp, resultObj);
return TCL_OK;
@@ -2512,7 +2586,7 @@ BinaryEncodeHex(
static int
BinaryDecodeHex(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -2520,10 +2594,10 @@ BinaryDecodeHex(
Tcl_Obj *resultObj = NULL;
unsigned char *data, *datastart, *dataend;
unsigned char *begin, *cursor, c;
int i, index, value, size, count = 0, cut = 0, strict = 0;
int i, index, value, size, pure = 1, count = 0, cut = 0, strict = 0;
Tcl_UniChar ch = 0;
enum {OPT_STRICT };
static const char *const optStrings[] = { "-strict", NULL };
(void)dummy;
if (objc < 2 || objc > 3) {
Tcl_WrongNumArgs(interp, 1, objv, "?options? data");
@@ -2542,8 +2616,12 @@ BinaryDecodeHex(
}
TclNewObj(resultObj);
datastart = data = (unsigned char *)
TclGetStringFromObj(objv[objc - 1], &count);
data = TclGetBytesFromObj(NULL, objv[objc - 1], &count);
if (data == NULL) {
pure = 0;
data = (unsigned char *) TclGetStringFromObj(objv[objc - 1], &count);
}
datastart = data;
dataend = data + count;
size = (count + 1) / 2;
begin = cursor = Tcl_SetByteArrayLength(resultObj, size);
@@ -2572,7 +2650,7 @@ BinaryDecodeHex(
if (c > 16) {
c += ('A' - 'a');
}
value |= c & 0xf;
value |= c & 0xF;
}
if (i < 2) {
cut++;
@@ -2588,10 +2666,16 @@ BinaryDecodeHex(
return TCL_OK;
badChar:
if (pure) {
ch = c;
} else {
TclUtfToUniChar((const char *)(data - 1), &ch);
}
TclDecrRefCount(resultObj);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"invalid hexadecimal digit \"%c\" at position %d",
c, (int) (data - datastart - 1)));
ch, (int) (data - datastart - 1)));
Tcl_SetErrorCode(interp, "TCL", "BINARY", "DECODE", "INVALID", NULL);
return TCL_ERROR;
}
@@ -2600,16 +2684,10 @@ BinaryDecodeHex(
*
* BinaryEncode64 --
*
* This implements a generic 6 bit binary encoding. Input is broken into
* 6 bit chunks and a lookup table passed in via clientData is used to
* turn these values into output characters. This is used to implement
* base64 binary encodings.
* This procedure implements the "binary encode base64" Tcl command.
*
* Results:
* Interp result set to an encoded byte array object
*
* Side effects:
* None
* The base64 encoded value prescribed by the input arguments.
*
*----------------------------------------------------------------------
*/
@@ -2632,20 +2710,19 @@ BinaryDecodeHex(
static int
BinaryEncode64(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
Tcl_Obj *resultObj;
unsigned char *data, *cursor, *limit;
unsigned char *data, *limit;
int maxlen = 0;
const char *wrapchar = "\n";
int wrapcharlen = 1;
int offset, i, index, size, outindex = 0, count = 0;
int offset, i, index, size, outindex = 0, count = 0, purewrap = 1;
enum { OPT_MAXLEN, OPT_WRAPCHAR };
static const char *const optStrings[] = { "-maxlen", "-wrapchar", NULL };
(void)dummy;
if (objc < 2 || objc % 2 != 0) {
Tcl_WrongNumArgs(interp, 1, objv,
@@ -2671,17 +2748,24 @@ BinaryEncode64(
}
break;
case OPT_WRAPCHAR:
wrapchar = TclGetStringFromObj(objv[i + 1], &wrapcharlen);
if (wrapcharlen == 0) {
maxlen = 0;
wrapchar = (const char *)TclGetBytesFromObj(NULL,
objv[i + 1], &wrapcharlen);
if (wrapchar == NULL) {
purewrap = 0;
wrapchar = TclGetStringFromObj(objv[i + 1], &wrapcharlen);
}
break;
}
}
if (wrapcharlen == 0) {
maxlen = 0;
}
resultObj = Tcl_NewObj();
data = Tcl_GetByteArrayFromObj(objv[objc - 1], &count);
if (count > 0) {
unsigned char *cursor = NULL;
size = (((count * 4) / 3) + 3) & ~3; /* ensure 4 byte chunks */
if (maxlen > 0 && size > maxlen) {
int adjusted = size + (wrapcharlen * (size / maxlen));
@@ -2690,8 +2774,17 @@ BinaryEncode64(
adjusted -= wrapcharlen;
}
size = adjusted;
if (purewrap == 0) {
/* Wrapchar is (possibly) non-byte, so build result as
* general string, not bytearray */
Tcl_SetObjLength(resultObj, size);
cursor = (unsigned char *) TclGetString(resultObj);
}
}
if (cursor == NULL) {
cursor = Tcl_SetByteArrayLength(resultObj, size);
}
cursor = Tcl_SetByteArrayLength(resultObj, size);
limit = cursor + size;
for (offset = 0; offset < count; offset += 3) {
unsigned char d[3] = {0, 0, 0};
@@ -2702,12 +2795,12 @@ BinaryEncode64(
OUTPUT(B64Digits[d[0] >> 2]);
OUTPUT(B64Digits[((d[0] & 0x03) << 4) | (d[1] >> 4)]);
if (offset + 1 < count) {
OUTPUT(B64Digits[((d[1] & 0x0f) << 2) | (d[2] >> 6)]);
OUTPUT(B64Digits[((d[1] & 0x0F) << 2) | (d[2] >> 6)]);
} else {
OUTPUT(B64Digits[64]);
}
if (offset+2 < count) {
OUTPUT(B64Digits[d[2] & 0x3f]);
OUTPUT(B64Digits[d[2] & 0x3F]);
} else {
OUTPUT(B64Digits[64]);
}
@@ -2739,7 +2832,7 @@ BinaryEncode64(
static int
BinaryEncodeUu(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -2753,7 +2846,6 @@ BinaryEncodeUu(
int wrapcharlen = sizeof(SingleNewline);
enum { OPT_MAXLEN, OPT_WRAPCHAR };
static const char *const optStrings[] = { "-maxlen", "-wrapchar", NULL };
(void)dummy;
if (objc < 2 || objc % 2 != 0) {
Tcl_WrongNumArgs(interp, 1, objv,
@@ -2817,12 +2909,12 @@ BinaryEncodeUu(
n <<= 8;
n |= data[offset++];
for (bits += 8; bits > 6 ; bits -= 6) {
*cursor++ = UueDigits[(n >> (bits - 6)) & 0x3f];
*cursor++ = UueDigits[(n >> (bits - 6)) & 0x3F];
}
}
if (bits > 0) {
n <<= 8;
*cursor++ = UueDigits[(n >> (bits + 2)) & 0x3f];
*cursor++ = UueDigits[(n >> (bits + 2)) & 0x3F];
bits = 0;
}
for (j = 0 ; j < wrapcharlen ; ++j) {
@@ -2857,7 +2949,7 @@ BinaryEncodeUu(
static int
BinaryDecodeUu(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -2865,11 +2957,11 @@ BinaryDecodeUu(
Tcl_Obj *resultObj = NULL;
unsigned char *data, *datastart, *dataend;
unsigned char *begin, *cursor;
int i, index, size, count = 0, strict = 0, lineLen;
int i, index, size, pure = 1, count = 0, strict = 0, lineLen;
unsigned char c;
Tcl_UniChar ch = 0;
enum { OPT_STRICT };
static const char *const optStrings[] = { "-strict", NULL };
(void)dummy;
if (objc < 2 || objc > 3) {
Tcl_WrongNumArgs(interp, 1, objv, "?options? data");
@@ -2888,8 +2980,12 @@ BinaryDecodeUu(
}
TclNewObj(resultObj);
datastart = data = (unsigned char *)
TclGetStringFromObj(objv[objc - 1], &count);
data = TclGetBytesFromObj(NULL, objv[objc - 1], &count);
if (data == NULL) {
pure = 0;
data = (unsigned char *) TclGetStringFromObj(objv[objc - 1], &count);
}
datastart = data;
dataend = data + count;
size = ((count + 3) & ~3) * 3 / 4;
begin = cursor = Tcl_SetByteArrayLength(resultObj, size);
@@ -2914,7 +3010,7 @@ BinaryDecodeUu(
i--;
continue;
}
lineLen = (c - 32) & 0x3f;
lineLen = (c - 32) & 0x3F;
}
/*
@@ -2943,14 +3039,14 @@ BinaryDecodeUu(
*/
if (lineLen > 0) {
*cursor++ = (((d[0] - 0x20) & 0x3f) << 2)
| (((d[1] - 0x20) & 0x3f) >> 4);
*cursor++ = (((d[0] - 0x20) & 0x3F) << 2)
| (((d[1] - 0x20) & 0x3F) >> 4);
if (--lineLen > 0) {
*cursor++ = (((d[1] - 0x20) & 0x3f) << 4)
| (((d[2] - 0x20) & 0x3f) >> 2);
*cursor++ = (((d[1] - 0x20) & 0x3F) << 4)
| (((d[2] - 0x20) & 0x3F) >> 2);
if (--lineLen > 0) {
*cursor++ = (((d[2] - 0x20) & 0x3f) << 6)
| (((d[3] - 0x20) & 0x3f));
*cursor++ = (((d[2] - 0x20) & 0x3F) << 6)
| (((d[3] - 0x20) & 0x3F));
lineLen--;
}
}
@@ -2995,9 +3091,14 @@ BinaryDecodeUu(
return TCL_ERROR;
badUu:
if (pure) {
ch = c;
} else {
TclUtfToUniChar((const char *)(data - 1), &ch);
}
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"invalid uuencode character \"%c\" at position %d",
c, (int) (data - datastart - 1)));
ch, (int) (data - datastart - 1)));
Tcl_SetErrorCode(interp, "TCL", "BINARY", "DECODE", "INVALID", NULL);
TclDecrRefCount(resultObj);
return TCL_ERROR;
@@ -3021,7 +3122,7 @@ BinaryDecodeUu(
static int
BinaryDecode64(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -3030,11 +3131,11 @@ BinaryDecode64(
unsigned char *data, *datastart, *dataend, c = '\0';
unsigned char *begin = NULL;
unsigned char *cursor = NULL;
int strict = 0;
int pure = 1, strict = 0;
int i, index, size, cut = 0, count = 0;
Tcl_UniChar ch = 0;
enum { OPT_STRICT };
static const char *const optStrings[] = { "-strict", NULL };
(void)dummy;
if (objc < 2 || objc > 3) {
Tcl_WrongNumArgs(interp, 1, objv, "?options? data");
@@ -3053,8 +3154,12 @@ BinaryDecode64(
}
TclNewObj(resultObj);
datastart = data = (unsigned char *)
TclGetStringFromObj(objv[objc - 1], &count);
data = TclGetBytesFromObj(NULL, objv[objc - 1], &count);
if (data == NULL) {
pure = 0;
data = (unsigned char *) TclGetStringFromObj(objv[objc - 1], &count);
}
datastart = data;
dataend = data + count;
size = ((count + 3) & ~3) * 3 / 4;
begin = cursor = Tcl_SetByteArrayLength(resultObj, size);
@@ -3104,21 +3209,21 @@ BinaryDecode64(
if (c == '=' && i > 1) {
value <<= 6;
cut++;
} else if (!strict && TclIsSpaceProc(c)) {
} else if (!strict) {
i--;
} else {
goto bad64;
}
} else if (c >= 'A' && c <= 'Z') {
value = (value << 6) | ((c - 'A') & 0x3f);
value = (value << 6) | ((c - 'A') & 0x3F);
} else if (c >= 'a' && c <= 'z') {
value = (value << 6) | ((c - 'a' + 26) & 0x3f);
value = (value << 6) | ((c - 'a' + 26) & 0x3F);
} else if (c >= '0' && c <= '9') {
value = (value << 6) | ((c - '0' + 52) & 0x3f);
value = (value << 6) | ((c - '0' + 52) & 0x3F);
} else if (c == '+') {
value = (value << 6) | 0x3e;
value = (value << 6) | 0x3E;
} else if (c == '/') {
value = (value << 6) | 0x3f;
value = (value << 6) | 0x3F;
} else if (c == '=' && (!strict || i > 1)) {
/*
* "=" and "a=" is rather bad64 error case in strict mode.
@@ -3128,15 +3233,15 @@ BinaryDecode64(
if (i) {
cut++;
}
} else if (strict || !TclIsSpaceProc(c)) {
} else if (strict) {
goto bad64;
} else {
i--;
}
}
*cursor++ = UCHAR((value >> 16) & 0xff);
*cursor++ = UCHAR((value >> 8) & 0xff);
*cursor++ = UCHAR(value & 0xff);
*cursor++ = UCHAR((value >> 16) & 0xFF);
*cursor++ = UCHAR((value >> 8) & 0xFF);
*cursor++ = UCHAR(value & 0xFF);
/*
* Since = is only valid within the final block, if it was encountered
@@ -3148,11 +3253,6 @@ BinaryDecode64(
if (strict) {
goto bad64;
}
for (; data < dataend; data++) {
if (!TclIsSpaceProc(*data)) {
goto bad64;
}
}
}
}
Tcl_SetByteArrayLength(resultObj, cursor - begin - cut);
@@ -3160,9 +3260,21 @@ BinaryDecode64(
return TCL_OK;
bad64:
if (pure) {
ch = c;
} else {
/* The decoder is byte-oriented. If we saw a byte that's not a
* valid member of the base64 alphabet, it could be the lead byte
* of a multi-byte character. */
/* Safe because we know data is NUL-terminated */
TclUtfToUniChar((const char *)(data - 1), &ch);
}
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"invalid base64 character \"%c\" at position %d",
(char) c, (int) (data - datastart - 1)));
"invalid base64 character \"%c\" at position %d", ch,
(int) (data - datastart - 1)));
Tcl_SetErrorCode(interp, "TCL", "BINARY", "DECODE", "INVALID", NULL);
TclDecrRefCount(resultObj);
return TCL_ERROR;
}
+29 -63
View File
@@ -246,7 +246,7 @@ ValidateMemory(
if (byte != GUARD_VALUE) {
guard_failed = TRUE;
fflush(stdout);
byte &= 0xff;
byte &= 0xFF;
fprintf(stderr, "low guard byte %d is 0x%x \t%c\n", (int)idx, byte,
(isprint(UCHAR(byte)) ? byte : ' ')); /* INTL: bytes */
}
@@ -267,7 +267,7 @@ ValidateMemory(
if (byte != GUARD_VALUE) {
guard_failed = TRUE;
fflush(stdout);
byte &= 0xff;
byte &= 0xFF;
fprintf(stderr, "hi guard byte %d is 0x%x \t%c\n", (int)idx, byte,
(isprint(UCHAR(byte)) ? byte : ' ')); /* INTL: bytes */
}
@@ -633,7 +633,7 @@ Tcl_DbCkfree(
if (memp->tagPtr != NULL) {
if ((memp->tagPtr->refCount-- <= 1) && (curTagPtr != memp->tagPtr)) {
TclpFree((char *) memp->tagPtr);
TclpFree(memp->tagPtr);
}
}
@@ -650,7 +650,7 @@ Tcl_DbCkfree(
if (allocHead == memp) {
allocHead = memp->flink;
}
TclpFree((char *) memp);
TclpFree(memp);
Tcl_MutexUnlock(ckallocMutexPtr);
}
@@ -808,13 +808,12 @@ Tcl_AttemptRealloc(
*
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static int
MemoryCmd(
ClientData clientData,
Tcl_Interp *interp,
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Obj values of arguments. */
Tcl_Obj *const objv[]) /* Obj values of arguments. */
{
const char *fileName;
FILE *fileP;
@@ -914,7 +913,7 @@ MemoryCmd(
return TCL_ERROR;
}
if ((curTagPtr != NULL) && (curTagPtr->refCount == 0)) {
TclpFree((char *) curTagPtr);
TclpFree(curTagPtr);
}
len = strlen(TclGetString(objv[2]));
curTagPtr = (MemTag *) TclpAlloc(TAG_SIZE(len));
@@ -987,10 +986,10 @@ static int CheckmemCmd(ClientData clientData,
static int
CheckmemCmd(
ClientData clientData, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Interpreter for evaluation. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Obj values of arguments. */
Tcl_Obj *const objv[]) /* Obj values of arguments. */
{
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "fileName");
@@ -1052,9 +1051,7 @@ char *
Tcl_Alloc(
unsigned int size)
{
char *result;
result = TclpAlloc(size);
char *result = (char *)TclpAlloc(size);
/*
* Most systems will not alloc(0), instead bumping it to one so that NULL
@@ -1078,9 +1075,7 @@ Tcl_DbCkalloc(
const char *file,
int line)
{
char *result;
result = (char *) TclpAlloc(size);
char *result = (char *)TclpAlloc(size);
if ((result == NULL) && size) {
fflush(stdout);
@@ -1104,24 +1099,16 @@ char *
Tcl_AttemptAlloc(
unsigned int size)
{
char *result;
result = TclpAlloc(size);
return result;
return (char *)TclpAlloc(size);
}
char *
Tcl_AttemptDbCkalloc(
unsigned int size,
const char *file,
int line)
TCL_UNUSED(const char *) /*file*/,
TCL_UNUSED(int) /*line*/)
{
char *result;
(void)file;
(void)line;
result = (char *) TclpAlloc(size);
return result;
return (char *)TclpAlloc(size);
}
/*
@@ -1140,9 +1127,7 @@ Tcl_Realloc(
char *ptr,
unsigned int size)
{
char *result;
result = TclpRealloc(ptr, size);
char *result = (char *)TclpRealloc(ptr, size);
if ((result == NULL) && size) {
Tcl_Panic("unable to realloc %u bytes", size);
@@ -1157,9 +1142,7 @@ Tcl_DbCkrealloc(
const char *file,
int line)
{
char *result;
result = (char *) TclpRealloc(ptr, size);
char *result = (char *)TclpRealloc(ptr, size);
if ((result == NULL) && size) {
fflush(stdout);
@@ -1184,25 +1167,17 @@ Tcl_AttemptRealloc(
char *ptr,
unsigned int size)
{
char *result;
result = TclpRealloc(ptr, size);
return result;
return (char *)TclpRealloc(ptr, size);
}
char *
Tcl_AttemptDbCkrealloc(
char *ptr,
unsigned int size,
const char *file,
int line)
TCL_UNUSED(const char *) /*file*/,
TCL_UNUSED(int) /*line*/)
{
char *result;
(void)file;
(void)line;
result = (char *) TclpRealloc(ptr, size);
return result;
return (char *)TclpRealloc(ptr, size);
}
/*
@@ -1227,11 +1202,9 @@ Tcl_Free(
void
Tcl_DbCkfree(
char *ptr,
const char *file,
int line)
TCL_UNUSED(const char *) /*file*/,
TCL_UNUSED(int) /*line*/)
{
(void)file;
(void)line;
TclpFree(ptr);
}
@@ -1245,38 +1218,31 @@ Tcl_DbCkfree(
*
*----------------------------------------------------------------------
*/
/* ARGSUSED */
void
Tcl_InitMemory(
Tcl_Interp *interp)
TCL_UNUSED(Tcl_Interp *) /*interp*/)
{
(void)interp;
}
int
Tcl_DumpActiveMemory(
const char *fileName)
TCL_UNUSED(const char *) /*fileName*/)
{
(void)fileName;
return TCL_OK;
}
void
Tcl_ValidateAllMemory(
const char *file,
int line)
TCL_UNUSED(const char *) /*file*/,
TCL_UNUSED(int) /*line*/)
{
(void)file;
(void)line;
}
int
TclDumpMemoryInfo(
ClientData clientData,
int flags)
TCL_UNUSED(ClientData),
TCL_UNUSED(int) /*flags*/)
{
(void)clientData;
(void)flags;
return 1;
}
@@ -1314,7 +1280,7 @@ TclFinalizeMemorySubsystem(void)
Tcl_MutexLock(ckallocMutexPtr);
if (curTagPtr != NULL) {
TclpFree((char *) curTagPtr);
TclpFree(curTagPtr);
curTagPtr = NULL;
}
allocHead = NULL;
+37 -42
View File
@@ -337,7 +337,7 @@ ClockConvertlocaltoutcObjCmd(
Tcl_Obj *const *objv) /* Parameter vector */
{
ClockClientData *data = (ClockClientData *)clientData;
Tcl_Obj *const *literals = data->literals;
Tcl_Obj *const *lit = data->literals;
Tcl_Obj *secondsObj;
Tcl_Obj *dict;
int changeover;
@@ -354,7 +354,7 @@ ClockConvertlocaltoutcObjCmd(
return TCL_ERROR;
}
dict = objv[1];
if (Tcl_DictObjGet(interp, dict, literals[LIT_LOCALSECONDS],
if (Tcl_DictObjGet(interp, dict, lit[LIT_LOCALSECONDS],
&secondsObj)!= TCL_OK) {
return TCL_ERROR;
}
@@ -380,7 +380,7 @@ ClockConvertlocaltoutcObjCmd(
created = 1;
Tcl_IncrRefCount(dict);
}
status = Tcl_DictObjPut(interp, dict, literals[LIT_SECONDS],
status = Tcl_DictObjPut(interp, dict, lit[LIT_SECONDS],
Tcl_NewWideIntObj(fields.seconds));
if (status == TCL_OK) {
Tcl_SetObjResult(interp, dict);
@@ -431,7 +431,7 @@ ClockGetdatefieldsObjCmd(
TclDateFields fields;
Tcl_Obj *dict;
ClockClientData *data = (ClockClientData *)clientData;
Tcl_Obj *const *literals = data->literals;
Tcl_Obj *const *lit = data->literals;
int changeover;
/*
@@ -453,7 +453,7 @@ ClockGetdatefieldsObjCmd(
*/
if (TclHasIntRep(objv[1], &tclBignumType)) {
Tcl_SetObjResult(interp, literals[LIT_INTEGER_VALUE_TOO_LARGE]);
Tcl_SetObjResult(interp, lit[LIT_INTEGER_VALUE_TOO_LARGE]);
return TCL_ERROR;
}
@@ -481,33 +481,33 @@ ClockGetdatefieldsObjCmd(
GetYearWeekDay(&fields, changeover);
dict = Tcl_NewDictObj();
Tcl_DictObjPut(NULL, dict, literals[LIT_LOCALSECONDS],
Tcl_DictObjPut(NULL, dict, lit[LIT_LOCALSECONDS],
Tcl_NewWideIntObj(fields.localSeconds));
Tcl_DictObjPut(NULL, dict, literals[LIT_SECONDS],
Tcl_DictObjPut(NULL, dict, lit[LIT_SECONDS],
Tcl_NewWideIntObj(fields.seconds));
Tcl_DictObjPut(NULL, dict, literals[LIT_TZNAME], fields.tzName);
Tcl_DictObjPut(NULL, dict, lit[LIT_TZNAME], fields.tzName);
Tcl_DecrRefCount(fields.tzName);
Tcl_DictObjPut(NULL, dict, literals[LIT_TZOFFSET],
Tcl_DictObjPut(NULL, dict, lit[LIT_TZOFFSET],
Tcl_NewWideIntObj(fields.tzOffset));
Tcl_DictObjPut(NULL, dict, literals[LIT_JULIANDAY],
Tcl_DictObjPut(NULL, dict, lit[LIT_JULIANDAY],
Tcl_NewWideIntObj(fields.julianDay));
Tcl_DictObjPut(NULL, dict, literals[LIT_GREGORIAN],
Tcl_DictObjPut(NULL, dict, lit[LIT_GREGORIAN],
Tcl_NewWideIntObj(fields.gregorian));
Tcl_DictObjPut(NULL, dict, literals[LIT_ERA],
literals[fields.isBce ? LIT_BCE : LIT_CE]);
Tcl_DictObjPut(NULL, dict, literals[LIT_YEAR],
Tcl_DictObjPut(NULL, dict, lit[LIT_ERA],
lit[fields.isBce ? LIT_BCE : LIT_CE]);
Tcl_DictObjPut(NULL, dict, lit[LIT_YEAR],
Tcl_NewWideIntObj(fields.year));
Tcl_DictObjPut(NULL, dict, literals[LIT_DAYOFYEAR],
Tcl_DictObjPut(NULL, dict, lit[LIT_DAYOFYEAR],
Tcl_NewWideIntObj(fields.dayOfYear));
Tcl_DictObjPut(NULL, dict, literals[LIT_MONTH],
Tcl_DictObjPut(NULL, dict, lit[LIT_MONTH],
Tcl_NewWideIntObj(fields.month));
Tcl_DictObjPut(NULL, dict, literals[LIT_DAYOFMONTH],
Tcl_DictObjPut(NULL, dict, lit[LIT_DAYOFMONTH],
Tcl_NewWideIntObj(fields.dayOfMonth));
Tcl_DictObjPut(NULL, dict, literals[LIT_ISO8601YEAR],
Tcl_DictObjPut(NULL, dict, lit[LIT_ISO8601YEAR],
Tcl_NewWideIntObj(fields.iso8601Year));
Tcl_DictObjPut(NULL, dict, literals[LIT_ISO8601WEEK],
Tcl_DictObjPut(NULL, dict, lit[LIT_ISO8601WEEK],
Tcl_NewWideIntObj(fields.iso8601Week));
Tcl_DictObjPut(NULL, dict, literals[LIT_DAYOFWEEK],
Tcl_DictObjPut(NULL, dict, lit[LIT_DAYOFWEEK],
Tcl_NewWideIntObj(fields.dayOfWeek));
Tcl_SetObjResult(interp, dict);
@@ -585,7 +585,7 @@ ClockGetjuliandayfromerayearmonthdayObjCmd(
TclDateFields fields;
Tcl_Obj *dict;
ClockClientData *data = (ClockClientData *)clientData;
Tcl_Obj *const *literals = data->literals;
Tcl_Obj *const *lit = data->literals;
int changeover;
int copied = 0;
int status;
@@ -600,12 +600,12 @@ ClockGetjuliandayfromerayearmonthdayObjCmd(
return TCL_ERROR;
}
dict = objv[1];
if (FetchEraField(interp, dict, literals[LIT_ERA], &isBce) != TCL_OK
|| FetchIntField(interp, dict, literals[LIT_YEAR], &fields.year)
if (FetchEraField(interp, dict, lit[LIT_ERA], &isBce) != TCL_OK
|| FetchIntField(interp, dict, lit[LIT_YEAR], &fields.year)
!= TCL_OK
|| FetchIntField(interp, dict, literals[LIT_MONTH], &fields.month)
|| FetchIntField(interp, dict, lit[LIT_MONTH], &fields.month)
!= TCL_OK
|| FetchIntField(interp, dict, literals[LIT_DAYOFMONTH],
|| FetchIntField(interp, dict, lit[LIT_DAYOFMONTH],
&fields.dayOfMonth) != TCL_OK
|| TclGetIntFromObj(interp, objv[2], &changeover) != TCL_OK) {
return TCL_ERROR;
@@ -627,7 +627,7 @@ ClockGetjuliandayfromerayearmonthdayObjCmd(
Tcl_IncrRefCount(dict);
copied = 1;
}
status = Tcl_DictObjPut(interp, dict, literals[LIT_JULIANDAY],
status = Tcl_DictObjPut(interp, dict, lit[LIT_JULIANDAY],
Tcl_NewWideIntObj(fields.julianDay));
if (status == TCL_OK) {
Tcl_SetObjResult(interp, dict);
@@ -669,7 +669,7 @@ ClockGetjuliandayfromerayearweekdayObjCmd(
TclDateFields fields;
Tcl_Obj *dict;
ClockClientData *data = (ClockClientData *)clientData;
Tcl_Obj *const *literals = data->literals;
Tcl_Obj *const *lit = data->literals;
int changeover;
int copied = 0;
int status;
@@ -684,12 +684,12 @@ ClockGetjuliandayfromerayearweekdayObjCmd(
return TCL_ERROR;
}
dict = objv[1];
if (FetchEraField(interp, dict, literals[LIT_ERA], &isBce) != TCL_OK
|| FetchIntField(interp, dict, literals[LIT_ISO8601YEAR],
if (FetchEraField(interp, dict, lit[LIT_ERA], &isBce) != TCL_OK
|| FetchIntField(interp, dict, lit[LIT_ISO8601YEAR],
&fields.iso8601Year) != TCL_OK
|| FetchIntField(interp, dict, literals[LIT_ISO8601WEEK],
|| FetchIntField(interp, dict, lit[LIT_ISO8601WEEK],
&fields.iso8601Week) != TCL_OK
|| FetchIntField(interp, dict, literals[LIT_DAYOFWEEK],
|| FetchIntField(interp, dict, lit[LIT_DAYOFWEEK],
&fields.dayOfWeek) != TCL_OK
|| TclGetIntFromObj(interp, objv[2], &changeover) != TCL_OK) {
return TCL_ERROR;
@@ -711,7 +711,7 @@ ClockGetjuliandayfromerayearweekdayObjCmd(
Tcl_IncrRefCount(dict);
copied = 1;
}
status = Tcl_DictObjPut(interp, dict, literals[LIT_JULIANDAY],
status = Tcl_DictObjPut(interp, dict, lit[LIT_JULIANDAY],
Tcl_NewWideIntObj(fields.julianDay));
if (status == TCL_OK) {
Tcl_SetObjResult(interp, dict);
@@ -1645,14 +1645,13 @@ WeekdayOnOrBefore(
int
ClockGetenvObjCmd(
ClientData clientData,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
const char *varName;
const char *varValue;
(void)clientData;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "name");
@@ -1731,7 +1730,7 @@ ThreadSafeLocalTime(
int
ClockClicksObjCmd(
ClientData clientData, /* Client data is unused */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Tcl interpreter */
int objc, /* Parameter count */
Tcl_Obj *const *objv) /* Parameter values */
@@ -1745,7 +1744,6 @@ ClockClicksObjCmd(
int index = CLICKS_NATIVE;
Tcl_Time now;
Tcl_WideInt clicks = 0;
(void)clientData;
switch (objc) {
case 1:
@@ -1802,13 +1800,12 @@ ClockClicksObjCmd(
int
ClockMillisecondsObjCmd(
ClientData clientData, /* Client data is unused */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Tcl interpreter */
int objc, /* Parameter count */
Tcl_Obj *const *objv) /* Parameter values */
{
Tcl_Time now;
(void)clientData;
if (objc != 1) {
Tcl_WrongNumArgs(interp, 1, objv, NULL);
@@ -1840,12 +1837,11 @@ ClockMillisecondsObjCmd(
int
ClockMicrosecondsObjCmd(
ClientData clientData, /* Client data is unused */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Tcl interpreter */
int objc, /* Parameter count */
Tcl_Obj *const *objv) /* Parameter values */
{
(void)clientData;
if (objc != 1) {
Tcl_WrongNumArgs(interp, 1, objv, NULL);
return TCL_ERROR;
@@ -1992,13 +1988,12 @@ ClockParseformatargsObjCmd(
int
ClockSecondsObjCmd(
ClientData clientData, /* Client data is unused */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Tcl interpreter */
int objc, /* Parameter count */
Tcl_Obj *const *objv) /* Parameter values */
{
Tcl_Time now;
(void)clientData;
if (objc != 1) {
Tcl_WrongNumArgs(interp, 1, objv, NULL);
+69 -152
View File
@@ -45,21 +45,11 @@ struct ForeachState {
static int CheckAccess(Tcl_Interp *interp, Tcl_Obj *pathPtr,
int mode);
static int EncodingConvertfromObjCmd(ClientData dummy,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
static int EncodingConverttoObjCmd(ClientData dummy,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
static int EncodingDirsObjCmd(ClientData dummy,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
static int EncodingNamesObjCmd(ClientData dummy,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
static int EncodingSystemObjCmd(ClientData dummy,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
static Tcl_ObjCmdProc EncodingConvertfromObjCmd;
static Tcl_ObjCmdProc EncodingConverttoObjCmd;
static Tcl_ObjCmdProc EncodingDirsObjCmd;
static Tcl_ObjCmdProc EncodingNamesObjCmd;
static Tcl_ObjCmdProc EncodingSystemObjCmd;
static inline int ForeachAssignments(Tcl_Interp *interp,
struct ForeachState *statePtr);
static inline void ForeachCleanup(Tcl_Interp *interp,
@@ -127,16 +117,13 @@ static Tcl_ObjCmdProc PathTypeCmd;
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_BreakObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
(void)dummy;
if (objc != 1) {
Tcl_WrongNumArgs(interp, 1, objv, NULL);
return TCL_ERROR;
@@ -162,10 +149,9 @@ Tcl_BreakObjCmd(
*----------------------------------------------------------------------
*/
#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
/* ARGSUSED */
int
Tcl_CaseObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -175,7 +161,6 @@ Tcl_CaseObjCmd(
const char *stringPtr, *arg;
Tcl_Obj *const *caseObjv;
Tcl_Obj *armPtr;
(void)dummy;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 1, objv,
@@ -299,20 +284,19 @@ Tcl_CaseObjCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_CatchObjCmd(
ClientData dummy, /* Not used. */
ClientData clientData,
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
return Tcl_NRCallObjProc(interp, TclNRCatchObjCmd, dummy, objc, objv);
return Tcl_NRCallObjProc(interp, TclNRCatchObjCmd, clientData, objc, objv);
}
int
TclNRCatchObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -320,7 +304,6 @@ TclNRCatchObjCmd(
Tcl_Obj *varNamePtr = NULL;
Tcl_Obj *optionVarNamePtr = NULL;
Interp *iPtr = (Interp *) interp;
(void)dummy;
if ((objc < 2) || (objc > 4)) {
Tcl_WrongNumArgs(interp, 1, objv,
@@ -406,17 +389,15 @@ CatchObjCmdCallback(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_CdObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tcl_Obj *dir;
int result;
(void)dummy;
if (objc > 2) {
Tcl_WrongNumArgs(interp, 1, objv, "?dirName?");
@@ -463,16 +444,13 @@ Tcl_CdObjCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_ConcatObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
(void)dummy;
if (objc >= 2) {
Tcl_SetObjResult(interp, Tcl_ConcatObj(objc-1, objv+1));
}
@@ -500,16 +478,13 @@ Tcl_ConcatObjCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_ContinueObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
(void)dummy;
if (objc != 1) {
Tcl_WrongNumArgs(interp, 1, objv, NULL);
return TCL_ERROR;
@@ -565,7 +540,7 @@ TclInitEncodingCmd(
int
EncodingConvertfromObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -575,7 +550,6 @@ EncodingConvertfromObjCmd(
Tcl_Encoding encoding; /* Encoding to use */
int length; /* Length of the byte array being converted */
const char *bytesPtr; /* Pointer to the first byte of the array */
(void)dummy;
if (objc == 2) {
encoding = Tcl_GetEncoding(interp, NULL);
@@ -628,7 +602,7 @@ EncodingConvertfromObjCmd(
int
EncodingConverttoObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -638,7 +612,6 @@ EncodingConverttoObjCmd(
Tcl_Encoding encoding; /* Encoding to use */
int length; /* Length of the string being converted */
const char *stringPtr; /* Pointer to the first byte of the string */
(void)dummy;
/* TODO - ADJUST OBJ INDICES WHEN ENSEMBLIFYING THIS */
@@ -693,13 +666,12 @@ EncodingConverttoObjCmd(
int
EncodingDirsObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tcl_Obj *dirListObj;
(void)dummy;
if (objc > 2) {
Tcl_WrongNumArgs(interp, 1, objv, "?dirList?");
@@ -738,13 +710,11 @@ EncodingDirsObjCmd(
int
EncodingNamesObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp* interp, /* Tcl interpreter */
int objc, /* Number of command line args */
Tcl_Obj* const objv[]) /* Vector of command line args */
TCL_UNUSED(ClientData),
Tcl_Interp* interp, /* Tcl interpreter */
int objc, /* Number of command line args */
Tcl_Obj* const objv[]) /* Vector of command line args */
{
(void)dummy;
if (objc > 1) {
Tcl_WrongNumArgs(interp, 1, objv, NULL);
return TCL_ERROR;
@@ -771,13 +741,11 @@ EncodingNamesObjCmd(
int
EncodingSystemObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp* interp, /* Tcl interpreter */
int objc, /* Number of command line args */
Tcl_Obj* const objv[]) /* Vector of command line args */
TCL_UNUSED(ClientData),
Tcl_Interp* interp, /* Tcl interpreter */
int objc, /* Number of command line args */
Tcl_Obj* const objv[]) /* Vector of command line args */
{
(void)dummy;
if (objc > 2) {
Tcl_WrongNumArgs(interp, 1, objv, "?encoding?");
return TCL_ERROR;
@@ -808,16 +776,14 @@ EncodingSystemObjCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_ErrorObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tcl_Obj *options, *optName;
(void)dummy;
if ((objc < 2) || (objc > 4)) {
Tcl_WrongNumArgs(interp, 1, objv, "message ?errorInfo? ?errorCode?");
@@ -859,15 +825,12 @@ Tcl_ErrorObjCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static int
EvalCmdErrMsg(
ClientData dummy[],
TCL_UNUSED(ClientData *),
Tcl_Interp *interp,
int result)
{
(void)dummy;
if (result == TCL_ERROR) {
Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
"\n (\"eval\" body line %d)", Tcl_GetErrorLine(interp)));
@@ -877,17 +840,17 @@ EvalCmdErrMsg(
int
Tcl_EvalObjCmd(
ClientData dummy, /* Not used. */
ClientData clientData,
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
return Tcl_NRCallObjProc(interp, TclNREvalObjCmd, dummy, objc, objv);
return Tcl_NRCallObjProc(interp, TclNREvalObjCmd, clientData, objc, objv);
}
int
TclNREvalObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -896,7 +859,6 @@ TclNREvalObjCmd(
Interp *iPtr = (Interp *) interp;
CmdFrame *invoker = NULL;
int word = 0;
(void)dummy;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "arg ?arg ...?");
@@ -945,16 +907,14 @@ TclNREvalObjCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_ExitObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tcl_WideInt value;
(void)dummy;
if ((objc != 1) && (objc != 2)) {
Tcl_WrongNumArgs(interp, 1, objv, "?returnCode?");
@@ -967,7 +927,6 @@ Tcl_ExitObjCmd(
return TCL_ERROR;
}
Tcl_Exit((int)value);
/*NOTREACHED*/
return TCL_OK; /* Better not ever reach this! */
}
@@ -995,26 +954,24 @@ Tcl_ExitObjCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_ExprObjCmd(
ClientData dummy, /* Not used. */
ClientData clientData,
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
return Tcl_NRCallObjProc(interp, TclNRExprObjCmd, dummy, objc, objv);
return Tcl_NRCallObjProc(interp, TclNRExprObjCmd, clientData, objc, objv);
}
int
TclNRExprObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tcl_Obj *resultPtr, *objPtr;
(void)dummy;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "arg ?arg ...?");
@@ -1145,14 +1102,13 @@ TclInitFileCmd(
static int
FileAttrAccessTimeCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
Tcl_StatBuf buf;
struct utimbuf tval;
(void)dummy;
if (objc < 2 || objc > 3) {
Tcl_WrongNumArgs(interp, 1, objv, "name ?time?");
@@ -1228,14 +1184,13 @@ FileAttrAccessTimeCmd(
static int
FileAttrModifyTimeCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
Tcl_StatBuf buf;
struct utimbuf tval;
(void)dummy;
if (objc < 2 || objc > 3) {
Tcl_WrongNumArgs(interp, 1, objv, "name ?time?");
@@ -1308,13 +1263,12 @@ FileAttrModifyTimeCmd(
static int
FileAttrLinkStatCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
Tcl_StatBuf buf;
(void)dummy;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 1, objv, "name varName");
@@ -1345,13 +1299,12 @@ FileAttrLinkStatCmd(
static int
FileAttrStatCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
Tcl_StatBuf buf;
(void)dummy;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 1, objv, "name varName");
@@ -1382,13 +1335,12 @@ FileAttrStatCmd(
static int
FileAttrTypeCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
Tcl_StatBuf buf;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "name");
@@ -1421,13 +1373,12 @@ FileAttrTypeCmd(
static int
FileAttrSizeCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
Tcl_StatBuf buf;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "name");
@@ -1459,14 +1410,13 @@ FileAttrSizeCmd(
static int
FileAttrIsDirectoryCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
Tcl_StatBuf buf;
int value = 0;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "name");
@@ -1498,13 +1448,11 @@ FileAttrIsDirectoryCmd(
static int
FileAttrIsExecutableCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "name");
return TCL_ERROR;
@@ -1531,13 +1479,11 @@ FileAttrIsExecutableCmd(
static int
FileAttrIsExistingCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "name");
return TCL_ERROR;
@@ -1564,14 +1510,13 @@ FileAttrIsExistingCmd(
static int
FileAttrIsFileCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
Tcl_StatBuf buf;
int value = 0;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "name");
@@ -1603,7 +1548,7 @@ FileAttrIsFileCmd(
static int
FileAttrIsOwnedCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1615,7 +1560,6 @@ FileAttrIsOwnedCmd(
Tcl_StatBuf buf;
#endif
int value = 0;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "name");
@@ -1651,13 +1595,11 @@ FileAttrIsOwnedCmd(
static int
FileAttrIsReadableCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "name");
return TCL_ERROR;
@@ -1684,13 +1626,11 @@ FileAttrIsReadableCmd(
static int
FileAttrIsWritableCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "name");
return TCL_ERROR;
@@ -1717,13 +1657,12 @@ FileAttrIsWritableCmd(
static int
PathDirNameCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
Tcl_Obj *dirPtr;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "name");
@@ -1757,13 +1696,12 @@ PathDirNameCmd(
static int
PathExtensionCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
Tcl_Obj *dirPtr;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "name");
@@ -1797,13 +1735,12 @@ PathExtensionCmd(
static int
PathRootNameCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
Tcl_Obj *dirPtr;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "name");
@@ -1837,13 +1774,12 @@ PathRootNameCmd(
static int
PathTailCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
Tcl_Obj *dirPtr;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "name");
@@ -1877,13 +1813,12 @@ PathTailCmd(
static int
PathFilesystemCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
Tcl_Obj *fsInfo;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "name");
@@ -1919,13 +1854,11 @@ PathFilesystemCmd(
static int
PathJoinCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
(void)dummy;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "name ?name ...?");
return TCL_ERROR;
@@ -1953,13 +1886,12 @@ PathJoinCmd(
static int
PathNativeNameCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
Tcl_DString ds;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "name");
@@ -1991,13 +1923,12 @@ PathNativeNameCmd(
static int
PathNormalizeCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
Tcl_Obj *fileName;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "name");
@@ -2030,13 +1961,12 @@ PathNormalizeCmd(
static int
PathSplitCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
Tcl_Obj *res;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "name");
@@ -2074,13 +2004,12 @@ PathSplitCmd(
static int
PathTypeCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
Tcl_Obj *typeName;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "name");
@@ -2123,19 +2052,17 @@ PathTypeCmd(
static int
FilesystemSeparatorCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
(void)dummy;
if (objc < 1 || objc > 2) {
Tcl_WrongNumArgs(interp, 1, objv, "?name?");
return TCL_ERROR;
}
if (objc == 1) {
const char *separator = NULL; /* lint */
const char *separator = NULL;
switch (tclPlatform) {
case TCL_PLATFORM_UNIX:
@@ -2180,13 +2107,11 @@ FilesystemSeparatorCmd(
static int
FilesystemVolumesCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
(void)dummy;
if (objc != 1) {
Tcl_WrongNumArgs(interp, 1, objv, NULL);
return TCL_ERROR;
@@ -2440,27 +2365,25 @@ GetTypeFromMode(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_ForObjCmd(
ClientData dummy, /* Not used. */
ClientData clientData,
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
return Tcl_NRCallObjProc(interp, TclNRForObjCmd, dummy, objc, objv);
return Tcl_NRCallObjProc(interp, TclNRForObjCmd, clientData, objc, objv);
}
int
TclNRForObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Interp *iPtr = (Interp *) interp;
ForIterData *iterPtr;
(void)dummy;
if (objc != 5) {
Tcl_WrongNumArgs(interp, 1, objv, "start test next command");
@@ -2636,47 +2559,43 @@ ForPostNextCallback(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_ForeachObjCmd(
ClientData dummy, /* Not used. */
ClientData clientData,
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
return Tcl_NRCallObjProc(interp, TclNRForeachCmd, dummy, objc, objv);
return Tcl_NRCallObjProc(interp, TclNRForeachCmd, clientData, objc, objv);
}
int
TclNRForeachCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
(void)dummy;
return EachloopCmd(interp, TCL_EACH_KEEP_NONE, objc, objv);
}
int
Tcl_LmapObjCmd(
ClientData dummy, /* Not used. */
ClientData clientData,
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
return Tcl_NRCallObjProc(interp, TclNRLmapCmd, dummy, objc, objv);
return Tcl_NRCallObjProc(interp, TclNRLmapCmd, clientData, objc, objv);
}
int
TclNRLmapCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
(void)dummy;
return EachloopCmd(interp, TCL_EACH_COLLECT, objc, objv);
}
@@ -2957,16 +2876,14 @@ ForeachCleanup(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_FormatObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tcl_Obj *resultPtr; /* Where result is stored finally. */
(void)dummy;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "formatString ?arg ...?");
+75 -129
View File
@@ -99,49 +99,28 @@ typedef struct {
static int DictionaryCompare(const char *left, const char *right);
static Tcl_NRPostProc IfConditionCallback;
static int InfoArgsCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int InfoBodyCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int InfoCmdCountCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int InfoCommandsCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int InfoCompleteCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int InfoDefaultCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static Tcl_ObjCmdProc InfoArgsCmd;
static Tcl_ObjCmdProc InfoBodyCmd;
static Tcl_ObjCmdProc InfoCmdCountCmd;
static Tcl_ObjCmdProc InfoCommandsCmd;
static Tcl_ObjCmdProc InfoCompleteCmd;
static Tcl_ObjCmdProc InfoDefaultCmd;
/* TIP #348 - New 'info' subcommand 'errorstack' */
static int InfoErrorStackCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static Tcl_ObjCmdProc InfoErrorStackCmd;
/* TIP #280 - New 'info' subcommand 'frame' */
static int InfoFrameCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int InfoFunctionsCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int InfoHostnameCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int InfoLevelCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int InfoLibraryCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int InfoLoadedCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int InfoNameOfExecutableCmd(ClientData dummy,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
static int InfoPatchLevelCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int InfoProcsCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int InfoScriptCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int InfoSharedlibCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int InfoCmdTypeCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int InfoTclVersionCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static Tcl_ObjCmdProc InfoFrameCmd;
static Tcl_ObjCmdProc InfoFunctionsCmd;
static Tcl_ObjCmdProc InfoHostnameCmd;
static Tcl_ObjCmdProc InfoLevelCmd;
static Tcl_ObjCmdProc InfoLibraryCmd;
static Tcl_ObjCmdProc InfoLoadedCmd;
static Tcl_ObjCmdProc InfoNameOfExecutableCmd;
static Tcl_ObjCmdProc InfoPatchLevelCmd;
static Tcl_ObjCmdProc InfoProcsCmd;
static Tcl_ObjCmdProc InfoScriptCmd;
static Tcl_ObjCmdProc InfoSharedlibCmd;
static Tcl_ObjCmdProc InfoCmdTypeCmd;
static Tcl_ObjCmdProc InfoTclVersionCmd;
static SortElement * MergeLists(SortElement *leftPtr, SortElement *rightPtr,
SortInfo *infoPtr);
static int SortCompare(SortElement *firstPtr, SortElement *second,
@@ -206,23 +185,22 @@ static const EnsembleImplMap defaultInfoMap[] = {
int
Tcl_IfObjCmd(
ClientData dummy, /* Not used. */
ClientData clientData,
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
return Tcl_NRCallObjProc(interp, TclNRIfObjCmd, dummy, objc, objv);
return Tcl_NRCallObjProc(interp, TclNRIfObjCmd, clientData, objc, objv);
}
int
TclNRIfObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tcl_Obj *boolObj;
(void)dummy;
if (objc <= 1) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
@@ -390,13 +368,12 @@ IfConditionCallback(
int
Tcl_IncrObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tcl_Obj *newValuePtr, *incrPtr;
(void)dummy;
if ((objc != 2) && (objc != 3)) {
Tcl_WrongNumArgs(interp, 1, objv, "varName ?increment?");
@@ -472,7 +449,7 @@ TclInitInfoCmd(
static int
InfoArgsCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -482,7 +459,6 @@ InfoArgsCmd(
Proc *procPtr;
CompiledLocal *localPtr;
Tcl_Obj *listObjPtr;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "procname");
@@ -536,7 +512,7 @@ InfoArgsCmd(
static int
InfoBodyCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -545,7 +521,6 @@ InfoBodyCmd(
const char *name, *bytes;
Proc *procPtr;
int numBytes;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "procname");
@@ -598,13 +573,12 @@ InfoBodyCmd(
static int
InfoCmdCountCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Interp *iPtr = (Interp *) interp;
(void)dummy;
if (objc != 1) {
Tcl_WrongNumArgs(interp, 1, objv, NULL);
@@ -641,7 +615,7 @@ InfoCmdCountCmd(
static int
InfoCommandsCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -657,7 +631,6 @@ InfoCommandsCmd(
int specificNsInPattern = 0;/* Init. to avoid compiler warning. */
Tcl_Command cmd;
int i;
(void)dummy;
/*
* Get the pattern and find the "effective namespace" in which to list
@@ -919,13 +892,11 @@ InfoCommandsCmd(
static int
InfoCompleteCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "command");
return TCL_ERROR;
@@ -958,7 +929,7 @@ InfoCompleteCmd(
static int
InfoDefaultCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -968,7 +939,6 @@ InfoDefaultCmd(
Proc *procPtr;
CompiledLocal *localPtr;
Tcl_Obj *valueObjPtr;
(void)dummy;
if (objc != 4) {
Tcl_WrongNumArgs(interp, 1, objv, "procname arg varname");
@@ -1041,14 +1011,13 @@ InfoDefaultCmd(
static int
InfoErrorStackCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tcl_Interp *target;
Interp *iPtr;
(void)dummy;
if ((objc != 1) && (objc != 2)) {
Tcl_WrongNumArgs(interp, 1, objv, "?interp?");
@@ -1091,14 +1060,13 @@ InfoErrorStackCmd(
int
TclInfoExistsCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
const char *varName;
Var *varPtr;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "varName");
@@ -1137,7 +1105,7 @@ TclInfoExistsCmd(
static int
InfoFrameCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1147,7 +1115,6 @@ InfoFrameCmd(
CmdFrame *framePtr, **cmdFramePtrPtr = &iPtr->cmdFramePtr;
CoroutineData *corPtr = iPtr->execEnvPtr->corPtr;
int topLevel = 0;
(void)dummy;
if (objc > 2) {
Tcl_WrongNumArgs(interp, 1, objv, "?number?");
@@ -1478,14 +1445,13 @@ TclInfoFrame(
static int
InfoFunctionsCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tcl_Obj *script;
int code;
(void)dummy;
if (objc > 2) {
Tcl_WrongNumArgs(interp, 1, objv, "?pattern?");
@@ -1544,13 +1510,12 @@ InfoFunctionsCmd(
static int
InfoHostnameCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
const char *name;
(void)dummy;
if (objc != 1) {
Tcl_WrongNumArgs(interp, 1, objv, NULL);
@@ -1591,13 +1556,12 @@ InfoHostnameCmd(
static int
InfoLevelCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Interp *iPtr = (Interp *) interp;
(void)dummy;
if (objc == 1) { /* Just "info level" */
Tcl_SetObjResult(interp, Tcl_NewWideIntObj(iPtr->varFramePtr->level));
@@ -1666,13 +1630,12 @@ InfoLevelCmd(
static int
InfoLibraryCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
const char *libDirName;
(void)dummy;
if (objc != 1) {
Tcl_WrongNumArgs(interp, 1, objv, NULL);
@@ -1714,13 +1677,12 @@ InfoLibraryCmd(
static int
InfoLoadedCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
const char *interpName, *packageName;
(void)dummy;
if (objc > 3) {
Tcl_WrongNumArgs(interp, 1, objv, "?interp? ?packageName?");
@@ -1763,13 +1725,11 @@ InfoLoadedCmd(
static int
InfoNameOfExecutableCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
(void)dummy;
if (objc != 1) {
Tcl_WrongNumArgs(interp, 1, objv, NULL);
return TCL_ERROR;
@@ -1801,13 +1761,12 @@ InfoNameOfExecutableCmd(
static int
InfoPatchLevelCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
const char *patchlevel;
(void)dummy;
if (objc != 1) {
Tcl_WrongNumArgs(interp, 1, objv, NULL);
@@ -1849,7 +1808,7 @@ InfoPatchLevelCmd(
static int
InfoProcsCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1866,7 +1825,6 @@ InfoProcsCmd(
Tcl_HashEntry *entryPtr;
Tcl_HashSearch search;
Command *cmdPtr, *realCmdPtr;
(void)dummy;
/*
* Get the pattern and find the "effective namespace" in which to list
@@ -2037,13 +1995,12 @@ InfoProcsCmd(
static int
InfoScriptCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Interp *iPtr = (Interp *) interp;
(void)dummy;
if ((objc != 1) && (objc != 2)) {
Tcl_WrongNumArgs(interp, 1, objv, "?filename?");
@@ -2086,13 +2043,11 @@ InfoScriptCmd(
static int
InfoSharedlibCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
(void)dummy;
if (objc != 1) {
Tcl_WrongNumArgs(interp, 1, objv, NULL);
return TCL_ERROR;
@@ -2126,13 +2081,12 @@ InfoSharedlibCmd(
static int
InfoTclVersionCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tcl_Obj *version;
(void)dummy;
if (objc != 1) {
Tcl_WrongNumArgs(interp, 1, objv, NULL);
@@ -2170,13 +2124,12 @@ InfoTclVersionCmd(
static int
InfoCmdTypeCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tcl_Command command;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "commandName");
@@ -2222,14 +2175,13 @@ InfoCmdTypeCmd(
int
Tcl_JoinObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* The argument objects. */
{
int length, listLen;
Tcl_Obj *resObjPtr = NULL, *joinObjPtr, **elemPtrs;
(void)dummy;
if ((objc < 2) || (objc > 3)) {
Tcl_WrongNumArgs(interp, 1, objv, "list ?joinString?");
@@ -2308,7 +2260,7 @@ Tcl_JoinObjCmd(
int
Tcl_LassignObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -2317,7 +2269,6 @@ Tcl_LassignObjCmd(
Tcl_Obj **listObjv; /* The contents of the list. */
int listObjc; /* The length of the list. */
int code = TCL_OK;
(void)dummy;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "list ?varName ...?");
@@ -2383,13 +2334,12 @@ Tcl_LassignObjCmd(
int
Tcl_LindexObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tcl_Obj *elemPtr; /* Pointer to the element being extracted. */
(void)dummy;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "list ?index ...?");
@@ -2442,14 +2392,13 @@ Tcl_LindexObjCmd(
int
Tcl_LinsertObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tcl_Obj *listPtr;
int index, len, result;
(void)dummy;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 1, objv, "list index ?element ...?");
@@ -2525,13 +2474,12 @@ Tcl_LinsertObjCmd(
int
Tcl_ListObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[])
/* The argument objects. */
{
(void)dummy;
/*
* If there are no list elements, the result is an empty object.
* Otherwise set the interpreter's result object to be a list object.
@@ -2562,14 +2510,13 @@ Tcl_ListObjCmd(
int
Tcl_LlengthObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[])
/* Argument objects. */
{
int listLen, result;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "list");
@@ -2609,7 +2556,7 @@ Tcl_LlengthObjCmd(
int
Tcl_LpopObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[])
@@ -2618,7 +2565,6 @@ Tcl_LpopObjCmd(
int listLen, result;
Tcl_Obj *elemPtr, *stored;
Tcl_Obj *listPtr, **elemPtrs;
(void)dummy;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "listvar ?index?");
@@ -2641,6 +2587,14 @@ Tcl_LpopObjCmd(
*/
if (objc == 2) {
if (!listLen) {
/* empty list, throw the same error as with index "end" */
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"index \"end\" out of range", -1));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "INDEX"
"OUTOFRANGE", NULL);
return TCL_ERROR;
}
elemPtr = elemPtrs[listLen - 1];
Tcl_IncrRefCount(elemPtr);
} else {
@@ -2703,14 +2657,13 @@ Tcl_LpopObjCmd(
int
Tcl_LrangeObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[])
/* Argument objects. */
{
int listLen, first, last, result;
(void)dummy;
if (objc != 4) {
Tcl_WrongNumArgs(interp, 1, objv, "list first last");
@@ -2772,7 +2725,7 @@ LremoveIndexCompare(
int
Tcl_LremoveObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -2780,7 +2733,6 @@ Tcl_LremoveObjCmd(
int i, idxc;
int listLen, *idxv, prevIdx, first, num;
Tcl_Obj *listObj;
(void)dummy;
/*
* Parse the arguments.
@@ -2892,7 +2844,7 @@ Tcl_LremoveObjCmd(
int
Tcl_LrepeatObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[])
@@ -2900,7 +2852,6 @@ Tcl_LrepeatObjCmd(
{
int elementCount, i, totalElems;
Tcl_Obj *listPtr, **dataArray = NULL;
(void)dummy;
/*
* Check arguments for legality:
@@ -3002,14 +2953,13 @@ Tcl_LrepeatObjCmd(
int
Tcl_LreplaceObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tcl_Obj *listPtr;
int first, last, listLen, numToDelete, result;
(void)dummy;
if (objc < 4) {
Tcl_WrongNumArgs(interp, 1, objv,
@@ -3104,14 +3054,13 @@ Tcl_LreplaceObjCmd(
int
Tcl_LreverseObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument values. */
{
Tcl_Obj **elemv;
int elemc, i, j;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "list");
@@ -3184,7 +3133,7 @@ Tcl_LreverseObjCmd(
int
Tcl_LsearchObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument values. */
@@ -3221,7 +3170,6 @@ Tcl_LsearchObjCmd(
EXACT, GLOB, REGEXP, SORTED
};
enum modes mode;
(void)dummy;
mode = GLOB;
dataType = ASCII;
@@ -3421,8 +3369,8 @@ Tcl_LsearchObjCmd(
}
if (encoded == (int)TCL_INDEX_NONE) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"index \"%s\" cannot select an element "
"from any list", TclGetString(indices[j])));
"index \"%s\" out of range",
TclGetString(indices[j])));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "INDEX"
"OUTOFRANGE", NULL);
result = TCL_ERROR;
@@ -3937,14 +3885,13 @@ Tcl_LsearchObjCmd(
int
Tcl_LsetObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument values. */
{
Tcl_Obj *listPtr; /* Pointer to the list being altered. */
Tcl_Obj *finalValuePtr; /* Value finally assigned to the variable. */
(void)dummy;
/*
* Check parameter count.
@@ -4023,7 +3970,7 @@ Tcl_LsetObjCmd(
int
Tcl_LsortObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument values. */
@@ -4053,7 +4000,6 @@ Tcl_LsortObjCmd(
LSORT_INCREASING, LSORT_INDEX, LSORT_INDICES, LSORT_INTEGER,
LSORT_NOCASE, LSORT_REAL, LSORT_STRIDE, LSORT_UNIQUE
};
(void)dummy;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "?-option value ...? list");
@@ -4110,7 +4056,7 @@ Tcl_LsortObjCmd(
sortInfo.isIncreasing = 1;
break;
case LSORT_INDEX: {
int indexc;
int sortindex;
Tcl_Obj **indexv;
if (i == objc-2) {
@@ -4121,7 +4067,7 @@ Tcl_LsortObjCmd(
sortInfo.resultCode = TCL_ERROR;
goto done;
}
if (TclListObjGetElements(interp, objv[i+1], &indexc,
if (TclListObjGetElements(interp, objv[i+1], &sortindex,
&indexv) != TCL_OK) {
sortInfo.resultCode = TCL_ERROR;
goto done;
@@ -4135,15 +4081,15 @@ Tcl_LsortObjCmd(
* options is done.
*/
for (j=0 ; j<indexc ; j++) {
for (j=0 ; j<sortindex ; j++) {
int encoded = 0;
int result = TclIndexEncode(interp, indexv[j],
TCL_INDEX_NONE, TCL_INDEX_NONE, &encoded);
if ((result == TCL_OK) && (encoded == (int)TCL_INDEX_NONE)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"index \"%s\" cannot select an element "
"from any list", TclGetString(indexv[j])));
"index \"%s\" out of range",
TclGetString(indexv[j])));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "INDEX"
"OUTOFRANGE", NULL);
result = TCL_ERROR;
+58 -100
View File
@@ -82,13 +82,12 @@ const char tclDefaultTrimSet[] =
int
Tcl_PwdObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tcl_Obj *retVal;
(void)dummy;
if (objc != 1) {
Tcl_WrongNumArgs(interp, 1, objv, NULL);
@@ -123,7 +122,7 @@ Tcl_PwdObjCmd(
int
Tcl_RegexpObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -143,7 +142,6 @@ Tcl_RegexpObjCmd(
REGEXP_EXPANDED,REGEXP_LINE, REGEXP_LINESTOP,REGEXP_LINEANCHOR,
REGEXP_NOCASE, REGEXP_START, REGEXP_LAST
};
(void)dummy;
indices = 0;
about = 0;
@@ -484,7 +482,7 @@ Tcl_RegexpObjCmd(
int
Tcl_RegsubObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -506,7 +504,6 @@ Tcl_RegsubObjCmd(
REGSUB_LINESTOP, REGSUB_LINEANCHOR, REGSUB_NOCASE, REGSUB_START,
REGSUB_LAST
};
(void)dummy;
cflags = TCL_REG_ADVANCED;
all = 0;
@@ -1005,13 +1002,12 @@ Tcl_RegsubObjCmd(
int
Tcl_RenameObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
const char *oldName, *newName;
(void)dummy;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 1, objv, "oldName newName");
@@ -1042,7 +1038,7 @@ Tcl_RenameObjCmd(
int
Tcl_ReturnObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1057,7 +1053,6 @@ Tcl_ReturnObjCmd(
int explicitResult = (0 == (objc % 2));
int numOptionWords = objc - 1 - explicitResult;
(void)dummy;
if (TCL_ERROR == TclMergeReturnOptions(interp, numOptionWords, objv+1,
&returnOpts, &code, &level)) {
@@ -1090,17 +1085,17 @@ Tcl_ReturnObjCmd(
int
Tcl_SourceObjCmd(
ClientData dummy, /* Not used. */
ClientData clientData,
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
return Tcl_NRCallObjProc(interp, TclNRSourceObjCmd, dummy, objc, objv);
return Tcl_NRCallObjProc(interp, TclNRSourceObjCmd, clientData, objc, objv);
}
int
TclNRSourceObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1110,7 +1105,6 @@ TclNRSourceObjCmd(
int result;
void **pkgFiles = NULL;
void *names = NULL;
(void)dummy;
if (objc < 2 || objc > 4) {
Tcl_WrongNumArgs(interp, 1, objv, "?-encoding name? fileName");
@@ -1175,7 +1169,7 @@ TclNRSourceObjCmd(
int
Tcl_SplitObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1187,7 +1181,6 @@ Tcl_SplitObjCmd(
const char *end;
int splitCharLen, stringLen;
Tcl_Obj *listPtr, *objPtr;
(void)dummy;
if (objc == 2) {
splitChars = " \n\t\r";
@@ -1231,7 +1224,7 @@ Tcl_SplitObjCmd(
#if TCL_UTF_MAX <= 3
if ((ch >= 0xD800) && (len < 3)) {
len += TclUtfToUniChar(stringPtr + len, &ch);
fullchar = (((fullchar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000;
fullchar = (((fullchar & 0x3FF) << 10) | (ch & 0x3FF)) + 0x10000;
}
#endif
@@ -1324,13 +1317,12 @@ Tcl_SplitObjCmd(
static int
StringFirstCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
int start = 0;
(void)dummy;
if (objc < 3 || objc > 4) {
Tcl_WrongNumArgs(interp, 1, objv,
@@ -1345,8 +1337,7 @@ StringFirstCmd(
return TCL_ERROR;
}
}
Tcl_SetObjResult(interp, Tcl_NewWideIntObj(TclStringFirst(objv[1],
objv[2], start)));
Tcl_SetObjResult(interp, TclStringFirst(objv[1], objv[2], start));
return TCL_OK;
}
@@ -1370,13 +1361,12 @@ StringFirstCmd(
static int
StringLastCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
int last = INT_MAX - 1;
(void)dummy;
if (objc < 3 || objc > 4) {
Tcl_WrongNumArgs(interp, 1, objv,
@@ -1391,8 +1381,7 @@ StringLastCmd(
return TCL_ERROR;
}
}
Tcl_SetObjResult(interp, Tcl_NewWideIntObj(TclStringLast(objv[1],
objv[2], last)));
Tcl_SetObjResult(interp, TclStringLast(objv[1], objv[2], last));
return TCL_OK;
}
@@ -1416,13 +1405,12 @@ StringLastCmd(
static int
StringIndexCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
int length, index;
(void)dummy;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 1, objv, "string charIndex");
@@ -1487,7 +1475,7 @@ StringIndexCmd(
static int
StringInsertCmd(
ClientData dummy, /* Not used */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter */
int objc, /* Number of arguments */
Tcl_Obj *const objv[]) /* Argument objects */
@@ -1495,7 +1483,6 @@ StringInsertCmd(
int length; /* String length */
int index; /* Insert index */
Tcl_Obj *outObj; /* Output object */
(void)dummy;
if (objc != 4) {
Tcl_WrongNumArgs(interp, 1, objv, "string index insertString");
@@ -1545,7 +1532,7 @@ StringInsertCmd(
static int
StringIsCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1579,7 +1566,6 @@ StringIsCmd(
enum isOptions {
OPT_STRICT, OPT_FAILIDX
};
(void)dummy;
if (objc < 3 || objc > 6) {
Tcl_WrongNumArgs(interp, 1, objv,
@@ -1926,7 +1912,7 @@ StringIsCmd(
#if TCL_UTF_MAX <= 3
if ((ch >= 0xD800) && (length2 < 3)) {
length2 += TclUtfToUniChar(string1 + length2, &ch);
fullchar = (((fullchar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000;
fullchar = (((fullchar & 0x3FF) << 10) | (ch & 0x3FF)) + 0x10000;
}
#endif
if (!chcomp(fullchar)) {
@@ -1985,7 +1971,7 @@ UniCharIsHexDigit(
static int
StringMapCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1995,7 +1981,6 @@ StringMapCmd(
Tcl_Obj **mapElemv, *sourceObj, *resultPtr;
Tcl_UniChar *ustring1, *ustring2, *p, *end;
int (*strCmpFn)(const Tcl_UniChar*, const Tcl_UniChar*, unsigned long);
(void)dummy;
if (objc < 3 || objc > 4) {
Tcl_WrongNumArgs(interp, 1, objv, "?-nocase? charMap string");
@@ -2257,13 +2242,12 @@ StringMapCmd(
static int
StringMatchCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
int nocase = 0;
(void)dummy;
if (objc < 3 || objc > 4) {
Tcl_WrongNumArgs(interp, 1, objv, "?-nocase? pattern string");
@@ -2310,13 +2294,12 @@ StringMatchCmd(
static int
StringRangeCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
int length, first, last;
(void)dummy;
if (objc != 4) {
Tcl_WrongNumArgs(interp, 1, objv, "string first last");
@@ -2367,14 +2350,13 @@ StringRangeCmd(
static int
StringReptCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
int count;
Tcl_Obj *resultPtr;
(void)dummy;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 1, objv, "string count");
@@ -2424,13 +2406,12 @@ StringReptCmd(
static int
StringRplcCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
int first, last, length, end;
(void)dummy;
if (objc < 4 || objc > 5) {
Tcl_WrongNumArgs(interp, 1, objv, "string first last ?string?");
@@ -2501,13 +2482,11 @@ StringRplcCmd(
static int
StringRevCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "string");
return TCL_ERROR;
@@ -2538,7 +2517,7 @@ StringRevCmd(
static int
StringStartCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -2546,7 +2525,6 @@ StringStartCmd(
Tcl_UniChar ch = 0;
const char *p, *string;
int cur, index, length, numChars;
(void)dummy;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 1, objv, "string index");
@@ -2600,7 +2578,7 @@ StringStartCmd(
static int
StringEndCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -2608,7 +2586,6 @@ StringEndCmd(
Tcl_UniChar ch = 0;
const char *p, *end, *string;
int cur, index, length, numChars;
(void)dummy;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 1, objv, "string index");
@@ -2663,7 +2640,7 @@ StringEndCmd(
static int
StringEqualCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -2676,7 +2653,6 @@ StringEqualCmd(
const char *string2;
int length, i, match, nocase = 0, reqlength = -1;
(void)dummy;
if (objc < 3 || objc > 6) {
str_cmp_args:
@@ -2739,7 +2715,7 @@ StringEqualCmd(
static int
StringCmpCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -2751,7 +2727,6 @@ StringCmpCmd(
*/
int match, nocase, reqlength, status;
(void)dummy;
status = TclStringCmpOpts(interp, objc, objv, &nocase, &reqlength);
if (status != TCL_OK) {
@@ -2828,13 +2803,12 @@ TclStringCmpOpts(
static int
StringCatCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tcl_Obj *objResultPtr;
(void)dummy;
if (objc < 2) {
/*
@@ -2874,13 +2848,12 @@ StringCatCmd(
*/
static int
StringBytesCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
int length;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "string");
@@ -2912,13 +2885,11 @@ StringBytesCmd(
static int
StringLenCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "string");
return TCL_ERROR;
@@ -2948,7 +2919,7 @@ StringLenCmd(
static int
StringLowerCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -2956,7 +2927,6 @@ StringLowerCmd(
int length1, length2;
const char *string1;
char *string2;
(void)dummy;
if (objc < 2 || objc > 4) {
Tcl_WrongNumArgs(interp, 1, objv, "string ?first? ?last?");
@@ -3034,7 +3004,7 @@ StringLowerCmd(
static int
StringUpperCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -3042,7 +3012,6 @@ StringUpperCmd(
int length1, length2;
const char *string1;
char *string2;
(void)dummy;
if (objc < 2 || objc > 4) {
Tcl_WrongNumArgs(interp, 1, objv, "string ?first? ?last?");
@@ -3120,7 +3089,7 @@ StringUpperCmd(
static int
StringTitleCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -3128,7 +3097,6 @@ StringTitleCmd(
int length1, length2;
const char *string1;
char *string2;
(void)dummy;
if (objc < 2 || objc > 4) {
Tcl_WrongNumArgs(interp, 1, objv, "string ?first? ?last?");
@@ -3206,14 +3174,13 @@ StringTitleCmd(
static int
StringTrimCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
const char *string1, *string2;
int triml, trimr, length1, length2;
(void)dummy;
if (objc == 3) {
string2 = TclGetStringFromObj(objv[2], &length2);
@@ -3254,14 +3221,13 @@ StringTrimCmd(
static int
StringTrimLCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
const char *string1, *string2;
int trim, length1, length2;
(void)dummy;
if (objc == 3) {
string2 = TclGetStringFromObj(objv[2], &length2);
@@ -3301,14 +3267,13 @@ StringTrimLCmd(
static int
StringTrimRCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
const char *string1, *string2;
int trim, length1, length2;
(void)dummy;
if (objc == 3) {
string2 = TclGetStringFromObj(objv[2], &length2);
@@ -3445,23 +3410,22 @@ TclSubstOptions(
int
Tcl_SubstObjCmd(
ClientData dummy, /* Not used. */
ClientData clientData,
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
return Tcl_NRCallObjProc(interp, TclNRSubstObjCmd, dummy, objc, objv);
return Tcl_NRCallObjProc(interp, TclNRSubstObjCmd, clientData, objc, objv);
}
int
TclNRSubstObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
int flags;
(void)dummy;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv,
@@ -3494,16 +3458,16 @@ TclNRSubstObjCmd(
int
Tcl_SwitchObjCmd(
ClientData dummy, /* Not used. */
ClientData clientData,
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
return Tcl_NRCallObjProc(interp, TclNRSwitchObjCmd, dummy, objc, objv);
return Tcl_NRCallObjProc(interp, TclNRSwitchObjCmd, clientData, objc, objv);
}
int
TclNRSwitchObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -3536,7 +3500,6 @@ TclNRSwitchObjCmd(
};
typedef int (*strCmpFn_t)(const char *, const char *);
strCmpFn_t strCmpFn = TclUtfCmp;
(void)dummy;
mode = OPT_EXACT;
foundmode = 0;
@@ -4025,17 +3988,15 @@ SwitchPostProc(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_ThrowObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tcl_Obj *options;
int len;
(void)dummy;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 1, objv, "type message");
@@ -4091,7 +4052,7 @@ Tcl_ThrowObjCmd(
int
Tcl_TimeObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -4106,7 +4067,6 @@ Tcl_TimeObjCmd(
#else
Tcl_WideInt start, stop;
#endif
(void)dummy;
if (objc == 2) {
count = 1;
@@ -4190,7 +4150,7 @@ Tcl_TimeObjCmd(
int
Tcl_TimeRateObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -4225,7 +4185,6 @@ Tcl_TimeRateObjCmd(
};
NRE_callback *rootPtr;
ByteCode *codePtr = NULL;
(void)dummy;
for (i = 1; i < objc - 1; i++) {
int index;
@@ -4734,17 +4693,17 @@ Tcl_TimeRateObjCmd(
int
Tcl_TryObjCmd(
ClientData dummy, /* Not used. */
ClientData clientData,
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
return Tcl_NRCallObjProc(interp, TclNRTryObjCmd, dummy, objc, objv);
return Tcl_NRCallObjProc(interp, TclNRTryObjCmd, clientData, objc, objv);
}
int
TclNRTryObjCmd(
ClientData clientData, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -4757,7 +4716,6 @@ TclNRTryObjCmd(
enum Handlers {
TryFinally, TryOn, TryTrap
};
(void)clientData;
/*
* Parse the arguments. The handlers are passed to subsequent callbacks as
@@ -4948,7 +4906,7 @@ TryPostBody(
int result)
{
Tcl_Obj *resultObj, *options, *handlersObj, *finallyObj, *cmdObj, **objv;
int i, dummy, code, objc;
int i, code, objc;
int numHandlers = 0;
handlersObj = (Tcl_Obj *)data[0];
@@ -4999,8 +4957,9 @@ TryPostBody(
Tcl_ListObjGetElements(NULL, handlersObj, &numHandlers, &handlers);
for (i=0 ; i<numHandlers ; i++) {
Tcl_Obj *handlerBodyObj;
int numElems = 0;
Tcl_ListObjGetElements(NULL, handlers[i], &dummy, &info);
Tcl_ListObjGetElements(NULL, handlers[i], &numElems, &info);
if (!found) {
Tcl_GetIntFromObj(NULL, info[1], &code);
if (code != result) {
@@ -5062,8 +5021,8 @@ TryPostBody(
Tcl_ResetResult(interp);
result = TCL_ERROR;
Tcl_ListObjLength(NULL, info[3], &dummy);
if (dummy > 0) {
Tcl_ListObjLength(NULL, info[3], &numElems);
if (numElems> 0) {
Tcl_Obj *varName;
Tcl_ListObjIndex(NULL, info[3], 0, &varName);
@@ -5073,7 +5032,7 @@ TryPostBody(
goto handlerFailed;
}
Tcl_DecrRefCount(resultObj);
if (dummy > 1) {
if (numElems> 1) {
Tcl_ListObjIndex(NULL, info[3], 1, &varName);
if (Tcl_ObjSetVar2(interp, varName, NULL, options,
TCL_LEAVE_ERR_MSG) == NULL) {
@@ -5311,23 +5270,22 @@ TryPostFinal(
int
Tcl_WhileObjCmd(
ClientData dummy, /* Not used. */
ClientData clientData,
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
return Tcl_NRCallObjProc(interp, TclNRWhileObjCmd, dummy, objc, objv);
return Tcl_NRCallObjProc(interp, TclNRWhileObjCmd, clientData, objc, objv);
}
int
TclNRWhileObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
ForIterData *iterPtr;
(void)dummy;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 1, objv, "test command");
+41 -100
View File
@@ -21,28 +21,16 @@
* Prototypes for procedures defined later in this file:
*/
static ClientData DupDictUpdateInfo(ClientData clientData);
static void FreeDictUpdateInfo(ClientData clientData);
static void PrintDictUpdateInfo(ClientData clientData,
Tcl_Obj *appendObj, ByteCode *codePtr,
unsigned int pcOffset);
static void DisassembleDictUpdateInfo(ClientData clientData,
Tcl_Obj *dictObj, ByteCode *codePtr,
unsigned int pcOffset);
static ClientData DupForeachInfo(ClientData clientData);
static void FreeForeachInfo(ClientData clientData);
static void PrintForeachInfo(ClientData clientData,
Tcl_Obj *appendObj, ByteCode *codePtr,
unsigned int pcOffset);
static void DisassembleForeachInfo(ClientData clientData,
Tcl_Obj *dictObj, ByteCode *codePtr,
unsigned int pcOffset);
static void PrintNewForeachInfo(ClientData clientData,
Tcl_Obj *appendObj, ByteCode *codePtr,
unsigned int pcOffset);
static void DisassembleNewForeachInfo(ClientData clientData,
Tcl_Obj *dictObj, ByteCode *codePtr,
unsigned int pcOffset);
static AuxDataDupProc DupDictUpdateInfo;
static AuxDataFreeProc FreeDictUpdateInfo;
static AuxDataPrintProc PrintDictUpdateInfo;
static AuxDataPrintProc DisassembleDictUpdateInfo;
static AuxDataDupProc DupForeachInfo;
static AuxDataFreeProc FreeForeachInfo;
static AuxDataPrintProc PrintForeachInfo;
static AuxDataPrintProc DisassembleForeachInfo;
static AuxDataPrintProc PrintNewForeachInfo;
static AuxDataPrintProc DisassembleNewForeachInfo;
static int CompileEachloopCmd(Tcl_Interp *interp,
Tcl_Parse *parsePtr, Command *cmdPtr,
CompileEnv *envPtr, int collect);
@@ -260,14 +248,12 @@ TclCompileArrayExistsCmd(
Tcl_Interp *interp, /* Used for looking up stuff. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
Tcl_Token *tokenPtr;
int isScalar, localIndex;
(void)cmdPtr;
if (parsePtr->numWords != 2) {
return TCL_ERROR;
@@ -523,17 +509,14 @@ TclCompileArrayUnsetCmd(
int
TclCompileBreakCmd(
Tcl_Interp *dummy, /* Used for error reporting. */
TCL_UNUSED(Tcl_Interp *),
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
ExceptionRange *rangePtr;
ExceptionAux *auxPtr;
(void)dummy;
(void)cmdPtr;
if (parsePtr->numWords != 1) {
return TCL_ERROR;
@@ -586,8 +569,7 @@ TclCompileCatchCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
JumpFixup jumpFixup;
@@ -595,7 +577,6 @@ TclCompileCatchCmd(
int resultIndex, optsIndex, range, dropScript = 0;
DefineLineInformation; /* TIP #280 */
int depth = TclGetStackDepth(envPtr);
(void)cmdPtr;
/*
* If syntax does not match what we expect for [catch], do not compile.
@@ -769,16 +750,13 @@ TclCompileCatchCmd(
int
TclCompileClockClicksCmd(
Tcl_Interp* dummy, /* Tcl interpreter */
TCL_UNUSED(Tcl_Interp *),
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token* tokenPtr;
(void)dummy;
(void)cmdPtr;
switch (parsePtr->numWords) {
case 1:
@@ -835,15 +813,13 @@ TclCompileClockClicksCmd(
int
TclCompileClockReadingCmd(
Tcl_Interp* dummy, /* Tcl interpreter */
TCL_UNUSED(Tcl_Interp *),
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
(void)dummy;
if (parsePtr->numWords != 1) {
return TCL_ERROR;
}
@@ -876,15 +852,13 @@ TclCompileConcatCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
Tcl_Obj *objPtr, *listObj;
Tcl_Token *tokenPtr;
int i;
(void)cmdPtr;
/* TODO: Consider compiling expansion case. */
if (parsePtr->numWords == 1) {
@@ -961,17 +935,14 @@ TclCompileConcatCmd(
int
TclCompileContinueCmd(
Tcl_Interp *dummy, /* Used for error reporting. */
TCL_UNUSED(Tcl_Interp *),
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
ExceptionRange *rangePtr;
ExceptionAux *auxPtr;
(void)dummy;
(void)cmdPtr;
/*
* There should be no argument after the "continue".
@@ -1029,15 +1000,13 @@ TclCompileDictSetCmd(
Tcl_Interp *interp, /* Used for looking up stuff. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr;
int i, dictVarIndex;
DefineLineInformation; /* TIP #280 */
Tcl_Token *varTokenPtr;
(void)cmdPtr;
/*
* There must be at least one argument after the command.
@@ -1156,14 +1125,12 @@ TclCompileDictGetCmd(
Tcl_Interp *interp, /* Used for looking up stuff. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr;
int i;
DefineLineInformation; /* TIP #280 */
(void)cmdPtr;
/*
* There must be at least two arguments after the command (the single-arg
@@ -1194,14 +1161,12 @@ TclCompileDictGetWithDefaultCmd(
Tcl_Interp *interp, /* Used for looking up stuff. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr;
int i;
DefineLineInformation; /* TIP #280 */
(void)cmdPtr;
/*
* There must be at least three arguments after the command.
@@ -1227,14 +1192,12 @@ TclCompileDictExistsCmd(
Tcl_Interp *interp, /* Used for looking up stuff. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr;
int i;
DefineLineInformation; /* TIP #280 */
(void)cmdPtr;
/*
* There must be at least two arguments after the command (the single-arg
@@ -2325,13 +2288,11 @@ static void
PrintDictUpdateInfo(
ClientData clientData,
Tcl_Obj *appendObj,
ByteCode *codePtr,
unsigned int pcOffset)
TCL_UNUSED(ByteCode *),
TCL_UNUSED(unsigned int))
{
DictUpdateInfo *duiPtr = (DictUpdateInfo *)clientData;
int i;
(void)codePtr;
(void)pcOffset;
for (i=0 ; i<duiPtr->length ; i++) {
if (i) {
@@ -2345,14 +2306,12 @@ static void
DisassembleDictUpdateInfo(
ClientData clientData,
Tcl_Obj *dictObj,
ByteCode *codePtr,
unsigned int pcOffset)
TCL_UNUSED(ByteCode *),
TCL_UNUSED(unsigned int))
{
DictUpdateInfo *duiPtr = (DictUpdateInfo *)clientData;
int i;
Tcl_Obj *variables = Tcl_NewObj();
(void)codePtr;
(void)pcOffset;
for (i=0 ; i<duiPtr->length ; i++) {
Tcl_ListObjAppendElement(NULL, variables,
@@ -2385,8 +2344,7 @@ TclCompileErrorCmd(
Tcl_Interp *interp, /* Used for context. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
/*
@@ -2395,7 +2353,6 @@ TclCompileErrorCmd(
Tcl_Token *tokenPtr;
DefineLineInformation; /* TIP #280 */
(void)cmdPtr;
if (parsePtr->numWords < 2 || parsePtr->numWords > 4) {
return TCL_ERROR;
@@ -2460,12 +2417,10 @@ TclCompileExprCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *firstWordPtr;
(void)cmdPtr;
if (parsePtr->numWords == 1) {
return TCL_ERROR;
@@ -2506,8 +2461,7 @@ TclCompileForCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *startTokenPtr, *testTokenPtr, *nextTokenPtr, *bodyTokenPtr;
@@ -2515,7 +2469,6 @@ TclCompileForCmd(
int bodyCodeOffset, nextCodeOffset, jumpDist;
int bodyRange, nextRange;
DefineLineInformation; /* TIP #280 */
(void)cmdPtr;
if (parsePtr->numWords != 5) {
return TCL_ERROR;
@@ -2718,8 +2671,7 @@ CompileEachloopCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr, /* Holds resulting instructions. */
int collect) /* Select collecting or accumulating mode
* (TCL_EACH_*) */
@@ -2734,7 +2686,6 @@ CompileEachloopCmd(
int numWords, numLists, i, j, code = TCL_OK;
Tcl_Obj *varListObj = NULL;
DefineLineInformation; /* TIP #280 */
(void)cmdPtr;
/*
* If the foreach command isn't in a procedure, don't compile it inline:
@@ -3017,14 +2968,12 @@ static void
PrintForeachInfo(
ClientData clientData,
Tcl_Obj *appendObj,
ByteCode *codePtr,
unsigned int pcOffset)
TCL_UNUSED(ByteCode *),
TCL_UNUSED(unsigned int))
{
ForeachInfo *infoPtr = (ForeachInfo *)clientData;
ForeachVarList *varsPtr;
int i, j;
(void)codePtr;
(void)pcOffset;
Tcl_AppendToObj(appendObj, "data=[", -1);
@@ -3059,14 +3008,12 @@ static void
PrintNewForeachInfo(
ClientData clientData,
Tcl_Obj *appendObj,
ByteCode *codePtr,
unsigned int pcOffset)
TCL_UNUSED(ByteCode *),
TCL_UNUSED(unsigned int))
{
ForeachInfo *infoPtr = (ForeachInfo *)clientData;
ForeachVarList *varsPtr;
int i, j;
(void)codePtr;
(void)pcOffset;
Tcl_AppendPrintfToObj(appendObj, "jumpOffset=%+d, vars=",
infoPtr->loopCtTemp);
@@ -3091,15 +3038,13 @@ static void
DisassembleForeachInfo(
ClientData clientData,
Tcl_Obj *dictObj,
ByteCode *codePtr,
unsigned int pcOffset)
TCL_UNUSED(ByteCode *),
TCL_UNUSED(unsigned int))
{
ForeachInfo *infoPtr = (ForeachInfo *)clientData;
ForeachVarList *varsPtr;
int i, j;
Tcl_Obj *objPtr, *innerPtr;
(void)codePtr;
(void)pcOffset;
/*
* Data stores.
@@ -3140,15 +3085,13 @@ static void
DisassembleNewForeachInfo(
ClientData clientData,
Tcl_Obj *dictObj,
ByteCode *codePtr,
unsigned int pcOffset)
TCL_UNUSED(ByteCode *),
TCL_UNUSED(unsigned int))
{
ForeachInfo *infoPtr = (ForeachInfo *)clientData;
ForeachVarList *varsPtr;
int i, j;
Tcl_Obj *objPtr, *innerPtr;
(void)codePtr;
(void)pcOffset;
/*
* Jump offset.
@@ -3198,8 +3141,7 @@ TclCompileFormatCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
@@ -3207,7 +3149,6 @@ TclCompileFormatCmd(
Tcl_Obj **objv, *formatObj, *tmpObj;
const char *bytes, *start;
int i, j, len;
(void)cmdPtr;
/*
* Don't handle any guaranteed-error cases.
+37 -107
View File
@@ -86,14 +86,12 @@ TclCompileGlobalCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *varTokenPtr;
int localIndex, numWords, i;
DefineLineInformation; /* TIP #280 */
(void)cmdPtr;
/* TODO: Consider support for compiling expanded args. */
numWords = parsePtr->numWords;
@@ -169,8 +167,7 @@ TclCompileIfCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
JumpFixupArray jumpFalseFixupArray;
@@ -189,7 +186,6 @@ TclCompileIfCmd(
int boolVal; /* Value of static condition. */
int compileScripts = 1;
DefineLineInformation; /* TIP #280 */
(void)cmdPtr;
/*
* Only compile the "if" command if all arguments are simple words, in
@@ -473,14 +469,12 @@ TclCompileIncrCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *varTokenPtr, *incrTokenPtr;
int isScalar, localIndex, haveImmValue, immValue;
DefineLineInformation; /* TIP #280 */
(void)cmdPtr;
if ((parsePtr->numWords != 2) && (parsePtr->numWords != 3)) {
return TCL_ERROR;
@@ -643,15 +637,12 @@ TclCompileInfoCommandsCmd(
int
TclCompileInfoCoroutineCmd(
Tcl_Interp *dummy, /* Used for error reporting. */
TCL_UNUSED(Tcl_Interp *),
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
(void)dummy;
(void)cmdPtr;
/*
* Only compile [info coroutine] without arguments.
*/
@@ -673,14 +664,12 @@ TclCompileInfoExistsCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr;
int isScalar, localIndex;
DefineLineInformation; /* TIP #280 */
(void)cmdPtr;
if (parsePtr->numWords != 2) {
return TCL_ERROR;
@@ -723,11 +712,9 @@ TclCompileInfoLevelCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
(void)cmdPtr;
/*
* Only compile [info level] without arguments or with a single argument.
*/
@@ -759,13 +746,11 @@ TclCompileInfoObjectClassCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
DefineLineInformation; /* TIP #280 */
Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr);
(void)cmdPtr;
if (parsePtr->numWords != 2) {
return TCL_ERROR;
@@ -780,13 +765,11 @@ TclCompileInfoObjectIsACmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
DefineLineInformation; /* TIP #280 */
Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr);
(void)cmdPtr;
/*
* We only handle [info object isa object <somevalue>]. The first three
@@ -817,13 +800,11 @@ TclCompileInfoObjectNamespaceCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
DefineLineInformation; /* TIP #280 */
Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr);
(void)cmdPtr;
if (parsePtr->numWords != 2) {
return TCL_ERROR;
@@ -856,14 +837,12 @@ TclCompileLappendCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *varTokenPtr, *valueTokenPtr;
int isScalar, localIndex, numWords, i;
DefineLineInformation; /* TIP #280 */
(void)cmdPtr;
/* TODO: Consider support for compiling expanded args. */
numWords = parsePtr->numWords;
@@ -973,14 +952,12 @@ TclCompileLassignCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr;
int isScalar, localIndex, numWords, idx;
DefineLineInformation; /* TIP #280 */
(void)cmdPtr;
numWords = parsePtr->numWords;
@@ -1078,14 +1055,12 @@ TclCompileLindexCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *idxTokenPtr, *valTokenPtr;
int i, idx, numWords = parsePtr->numWords;
DefineLineInformation; /* TIP #280 */
(void)cmdPtr;
/*
* Quit if too few args.
@@ -1170,15 +1145,13 @@ TclCompileListCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
Tcl_Token *valueTokenPtr;
int i, numWords, concat, build;
Tcl_Obj *listObj, *objPtr;
(void)cmdPtr;
if (parsePtr->numWords == 1) {
/*
@@ -1285,13 +1258,11 @@ TclCompileLlengthCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *varTokenPtr;
DefineLineInformation; /* TIP #280 */
(void)cmdPtr;
if (parsePtr->numWords != 2) {
return TCL_ERROR;
@@ -1319,14 +1290,12 @@ TclCompileLrangeCmd(
Tcl_Interp *interp, /* Tcl interpreter for context. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the
* command. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds the resulting instructions. */
{
Tcl_Token *tokenPtr, *listTokenPtr;
DefineLineInformation; /* TIP #280 */
int idx1, idx2;
(void)cmdPtr;
if (parsePtr->numWords != 4) {
return TCL_ERROR;
@@ -1381,14 +1350,12 @@ TclCompileLinsertCmd(
Tcl_Interp *interp, /* Tcl interpreter for context. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the
* command. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds the resulting instructions. */
{
Tcl_Token *tokenPtr, *listTokenPtr;
DefineLineInformation; /* TIP #280 */
int idx, i;
(void)cmdPtr;
if (parsePtr->numWords < 3) {
return TCL_ERROR;
@@ -1485,15 +1452,13 @@ TclCompileLreplaceCmd(
Tcl_Interp *interp, /* Tcl interpreter for context. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the
* command. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds the resulting instructions. */
{
Tcl_Token *tokenPtr, *listTokenPtr;
DefineLineInformation; /* TIP #280 */
int idx1, idx2, i;
int emptyPrefix=1, suffixStart = 0;
(void)cmdPtr;
if (parsePtr->numWords < 4) {
return TCL_ERROR;
@@ -1650,8 +1615,7 @@ TclCompileLsetCmd(
Tcl_Interp *interp, /* Tcl interpreter for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the
* command. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds the resulting instructions. */
{
int tempDepth; /* Depth used for emitting one part of the
@@ -1662,7 +1626,6 @@ TclCompileLsetCmd(
int isScalar; /* Flag == 1 if scalar, 0 if array. */
int i;
DefineLineInformation; /* TIP #280 */
(void)cmdPtr;
/*
* Check argument count.
@@ -1795,15 +1758,12 @@ TclCompileLsetCmd(
int
TclCompileNamespaceCurrentCmd(
Tcl_Interp *dummy, /* Used for error reporting. */
TCL_UNUSED(Tcl_Interp *),
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
(void)dummy;
(void)cmdPtr;
/*
* Only compile [namespace current] without arguments.
*/
@@ -1825,13 +1785,11 @@ TclCompileNamespaceCodeCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr;
DefineLineInformation; /* TIP #280 */
(void)cmdPtr;
if (parsePtr->numWords != 2) {
return TCL_ERROR;
@@ -1876,13 +1834,11 @@ TclCompileNamespaceOriginCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr;
DefineLineInformation; /* TIP #280 */
(void)cmdPtr;
if (parsePtr->numWords != 2) {
return TCL_ERROR;
@@ -1899,14 +1855,12 @@ TclCompileNamespaceQualifiersCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr);
DefineLineInformation; /* TIP #280 */
int off;
(void)cmdPtr;
if (parsePtr->numWords != 2) {
return TCL_ERROR;
@@ -1936,14 +1890,12 @@ TclCompileNamespaceTailCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr);
DefineLineInformation; /* TIP #280 */
JumpFixup jumpFixup;
(void)cmdPtr;
if (parsePtr->numWords != 2) {
return TCL_ERROR;
@@ -1974,14 +1926,12 @@ TclCompileNamespaceUpvarCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr, *otherTokenPtr, *localTokenPtr;
int localIndex, numWords, i;
DefineLineInformation; /* TIP #280 */
(void)cmdPtr;
if (envPtr->procPtr == NULL) {
return TCL_ERROR;
@@ -2036,14 +1986,12 @@ TclCompileNamespaceWhichCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
Tcl_Token *tokenPtr, *opt;
int idx;
(void)cmdPtr;
if (parsePtr->numWords < 2 || parsePtr->numWords > 3) {
return TCL_ERROR;
@@ -2101,8 +2049,7 @@ TclCompileRegexpCmd(
Tcl_Interp *interp, /* Tcl interpreter for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the
* command. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds the resulting instructions. */
{
Tcl_Token *varTokenPtr; /* Pointer to the Tcl_Token representing the
@@ -2110,7 +2057,6 @@ TclCompileRegexpCmd(
int i, len, nocase, exact, sawLast, simple;
const char *str;
DefineLineInformation; /* TIP #280 */
(void)cmdPtr;
/*
* We are only interested in compiling simple regexp cases. Currently
@@ -2267,8 +2213,7 @@ TclCompileRegsubCmd(
Tcl_Interp *interp, /* Tcl interpreter for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the
* command. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds the resulting instructions. */
{
/*
@@ -2297,7 +2242,6 @@ TclCompileRegsubCmd(
Tcl_DString pattern;
const char *bytes;
int len, exact, quantified, result = TCL_ERROR;
(void)cmdPtr;
if (parsePtr->numWords < 5 || parsePtr->numWords > 6) {
return TCL_ERROR;
@@ -2443,8 +2387,7 @@ TclCompileReturnCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
/*
@@ -2458,7 +2401,6 @@ TclCompileReturnCmd(
Tcl_Obj *returnOpts, **objv;
Tcl_Token *wordTokenPtr = TokenAfter(parsePtr->tokenPtr);
DefineLineInformation; /* TIP #280 */
(void)cmdPtr;
/*
* Check for special case which can always be compiled:
@@ -2696,15 +2638,13 @@ TclCompileUpvarCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr, *otherTokenPtr, *localTokenPtr;
int localIndex, numWords, i;
DefineLineInformation; /* TIP #280 */
Tcl_Obj *objPtr;
(void)cmdPtr;
if (envPtr->procPtr == NULL) {
return TCL_ERROR;
@@ -2804,14 +2744,12 @@ TclCompileVariableCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *varTokenPtr, *valueTokenPtr;
int localIndex, numWords, i;
DefineLineInformation; /* TIP #280 */
(void)cmdPtr;
numWords = parsePtr->numWords;
if (numWords < 2) {
@@ -2887,7 +2825,7 @@ TclCompileVariableCmd(
static int
IndexTailVarIfKnown(
Tcl_Interp *dummy,
TCL_UNUSED(Tcl_Interp *),
Tcl_Token *varTokenPtr, /* Token representing the variable name */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
@@ -2896,7 +2834,6 @@ IndexTailVarIfKnown(
int len, n = varTokenPtr->numComponents;
Tcl_Token *lastTokenPtr;
int full, localIndex;
(void)dummy;
/*
* Determine if the tail is (a) known at compile time, and (b) not an
@@ -2980,14 +2917,12 @@ TclCompileObjectNextCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
Tcl_Token *tokenPtr = parsePtr->tokenPtr;
int i;
(void)cmdPtr;
if (parsePtr->numWords > 255) {
return TCL_ERROR;
@@ -3006,14 +2941,12 @@ TclCompileObjectNextToCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
Tcl_Token *tokenPtr = parsePtr->tokenPtr;
int i;
(void)cmdPtr;
if (parsePtr->numWords < 2 || parsePtr->numWords > 255) {
return TCL_ERROR;
@@ -3029,15 +2962,12 @@ TclCompileObjectNextToCmd(
int
TclCompileObjectSelfCmd(
Tcl_Interp *dummy, /* Used for error reporting. */
TCL_UNUSED(Tcl_Interp *),
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
(void)dummy;
(void)cmdPtr;
/*
* We only handle [self] and [self object] (which is the same operation).
* These are the only very common operations on [self] for which
+59 -167
View File
@@ -23,14 +23,10 @@
* Prototypes for procedures defined later in this file:
*/
static ClientData DupJumptableInfo(ClientData clientData);
static void FreeJumptableInfo(ClientData clientData);
static void PrintJumptableInfo(ClientData clientData,
Tcl_Obj *appendObj, ByteCode *codePtr,
unsigned int pcOffset);
static void DisassembleJumptableInfo(ClientData clientData,
Tcl_Obj *dictObj, ByteCode *codePtr,
unsigned int pcOffset);
static AuxDataDupProc DupJumptableInfo;
static AuxDataFreeProc FreeJumptableInfo;
static AuxDataPrintProc PrintJumptableInfo;
static AuxDataPrintProc DisassembleJumptableInfo;
static int CompileAssociativeBinaryOpCmd(Tcl_Interp *interp,
Tcl_Parse *parsePtr, const char *identity,
int instruction, CompileEnv *envPtr);
@@ -130,14 +126,12 @@ TclCompileSetCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *varTokenPtr, *valueTokenPtr;
int isAssignment, isScalar, localIndex, numWords;
DefineLineInformation; /* TIP #280 */
(void)cmdPtr;
numWords = parsePtr->numWords;
if ((numWords != 2) && (numWords != 3)) {
@@ -225,15 +219,13 @@ TclCompileStringCatCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
int i, numWords = parsePtr->numWords, numArgs;
Tcl_Token *wordTokenPtr;
Tcl_Obj *obj, *folded;
DefineLineInformation; /* TIP #280 */
(void)cmdPtr;
/* Trivial case, no arg */
@@ -298,13 +290,11 @@ TclCompileStringCmpCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
Tcl_Token *tokenPtr;
(void)cmdPtr;
/*
* We don't support any flags; the bytecode isn't that sophisticated.
@@ -331,13 +321,11 @@ TclCompileStringEqualCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
Tcl_Token *tokenPtr;
(void)cmdPtr;
/*
* We don't support any flags; the bytecode isn't that sophisticated.
@@ -364,13 +352,11 @@ TclCompileStringFirstCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
Tcl_Token *tokenPtr;
(void)cmdPtr;
/*
* We don't support any flags; the bytecode isn't that sophisticated.
@@ -397,13 +383,11 @@ TclCompileStringLastCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
Tcl_Token *tokenPtr;
(void)cmdPtr;
/*
* We don't support any flags; the bytecode isn't that sophisticated.
@@ -430,13 +414,11 @@ TclCompileStringIndexCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
Tcl_Token *tokenPtr;
(void)cmdPtr;
if (parsePtr->numWords != 3) {
return TCL_ERROR;
@@ -459,14 +441,12 @@ TclCompileStringInsertCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr;
DefineLineInformation; /* TIP #280 */
int idx;
(void)cmdPtr;
if (parsePtr->numWords != 4) {
return TCL_ERROR;
@@ -886,14 +866,12 @@ TclCompileStringLenCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
Tcl_Token *tokenPtr;
Tcl_Obj *objPtr;
(void)cmdPtr;
if (parsePtr->numWords != 2) {
return TCL_ERROR;
@@ -990,14 +968,12 @@ TclCompileStringRangeCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
Tcl_Token *stringTokenPtr, *fromTokenPtr, *toTokenPtr;
int idx1, idx2;
(void)cmdPtr;
if (parsePtr->numWords != 4) {
return TCL_ERROR;
@@ -1067,14 +1043,12 @@ TclCompileStringReplaceCmd(
Tcl_Interp *interp, /* Tcl interpreter for context. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the
* command. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds the resulting instructions. */
{
Tcl_Token *tokenPtr, *valueTokenPtr;
DefineLineInformation; /* TIP #280 */
int first, last;
(void)cmdPtr;
if (parsePtr->numWords < 4 || parsePtr->numWords > 5) {
return TCL_ERROR;
@@ -1267,13 +1241,11 @@ TclCompileStringTrimLCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
Tcl_Token *tokenPtr;
(void)cmdPtr;
if (parsePtr->numWords != 2 && parsePtr->numWords != 3) {
return TCL_ERROR;
@@ -1296,13 +1268,11 @@ TclCompileStringTrimRCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
Tcl_Token *tokenPtr;
(void)cmdPtr;
if (parsePtr->numWords != 2 && parsePtr->numWords != 3) {
return TCL_ERROR;
@@ -1325,13 +1295,11 @@ TclCompileStringTrimCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
Tcl_Token *tokenPtr;
(void)cmdPtr;
if (parsePtr->numWords != 2 && parsePtr->numWords != 3) {
return TCL_ERROR;
@@ -1475,8 +1443,7 @@ TclCompileSubstCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
int numArgs = parsePtr->numWords - 1;
@@ -1486,7 +1453,6 @@ TclCompileSubstCmd(
Tcl_Token *wordTokenPtr = TokenAfter(parsePtr->tokenPtr);
int code = TCL_ERROR;
DefineLineInformation; /* TIP #280 */
(void)cmdPtr;
if (numArgs == 0) {
return TCL_ERROR;
@@ -1809,8 +1775,7 @@ TclCompileSwitchCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr; /* Pointer to tokens in command. */
@@ -1831,7 +1796,6 @@ TclCompileSwitchCmd(
int result = TCL_ERROR;
DefineLineInformation; /* TIP #280 */
int *clNext = envPtr->clNext;
(void)cmdPtr;
/*
* Only handle the following versions:
@@ -2613,7 +2577,7 @@ static void
PrintJumptableInfo(
ClientData clientData,
Tcl_Obj *appendObj,
ByteCode *codePtr,
TCL_UNUSED(ByteCode *),
unsigned int pcOffset)
{
JumptableInfo *jtPtr = (JumptableInfo *)clientData;
@@ -2621,7 +2585,6 @@ PrintJumptableInfo(
Tcl_HashSearch search;
const char *keyPtr;
int offset, i = 0;
(void)codePtr;
hPtr = Tcl_FirstHashEntry(&jtPtr->hashTable, &search);
for (; hPtr ; hPtr = Tcl_NextHashEntry(&search)) {
@@ -2643,8 +2606,8 @@ static void
DisassembleJumptableInfo(
ClientData clientData,
Tcl_Obj *dictObj,
ByteCode *codePtr,
unsigned int pcOffset)
TCL_UNUSED(ByteCode *),
TCL_UNUSED(unsigned int))
{
JumptableInfo *jtPtr = (JumptableInfo *)clientData;
Tcl_Obj *mapping = Tcl_NewObj();
@@ -2652,8 +2615,6 @@ DisassembleJumptableInfo(
Tcl_HashSearch search;
const char *keyPtr;
int offset;
(void)codePtr;
(void)pcOffset;
hPtr = Tcl_FirstHashEntry(&jtPtr->hashTable, &search);
for (; hPtr ; hPtr = Tcl_NextHashEntry(&search)) {
@@ -2688,14 +2649,12 @@ TclCompileTailcallCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
Tcl_Token *tokenPtr = parsePtr->tokenPtr;
int i;
(void)cmdPtr;
if (parsePtr->numWords < 2 || parsePtr->numWords > 256
|| envPtr->procPtr == NULL) {
@@ -2736,8 +2695,7 @@ TclCompileThrowCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
@@ -2745,7 +2703,6 @@ TclCompileThrowCmd(
Tcl_Token *codeToken, *msgToken;
Tcl_Obj *objPtr;
int codeKnown, codeIsList, codeIsValid, len;
(void)cmdPtr;
if (numWords != 3) {
return TCL_ERROR;
@@ -2841,8 +2798,7 @@ TclCompileTryCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
int numWords = parsePtr->numWords, numHandlers, result = TCL_ERROR;
@@ -2851,7 +2807,6 @@ TclCompileTryCmd(
Tcl_Obj **matchClauses = NULL;
int *matchCodes=NULL, *resultVarIndices=NULL, *optionVarIndices=NULL;
int i;
(void)cmdPtr;
if (numWords < 2) {
return TCL_ERROR;
@@ -3174,7 +3129,7 @@ IssueTryClausesInstructions(
OP( STR_EQ);
JUMP4( JUMP_FALSE, notECJumpSource);
} else {
notECJumpSource = -1; /* LINT */
notECJumpSource = -1;
}
OP( POP);
@@ -3385,7 +3340,7 @@ IssueTryClausesFinallyInstructions(
OP( STR_EQ);
JUMP4( JUMP_FALSE, notECJumpSource);
} else {
notECJumpSource = -1; /* LINT */
notECJumpSource = -1;
}
OP( POP);
@@ -3652,14 +3607,12 @@ TclCompileUnsetCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *varTokenPtr;
int isScalar, localIndex, flags = 1, i, varCount = 0, haveFlags = 0;
DefineLineInformation; /* TIP #280 */
(void)cmdPtr;
/* TODO: Consider support for compiling expanded args. */
@@ -3791,8 +3744,7 @@ TclCompileWhileCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *testTokenPtr, *bodyTokenPtr;
@@ -3802,7 +3754,6 @@ TclCompileWhileCmd(
* infinite loop. */
Tcl_Obj *boolObj;
DefineLineInformation; /* TIP #280 */
(void)cmdPtr;
if (parsePtr->numWords != 3) {
return TCL_ERROR;
@@ -3970,12 +3921,9 @@ TclCompileYieldCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
(void)cmdPtr;
if (parsePtr->numWords < 1 || parsePtr->numWords > 2) {
return TCL_ERROR;
}
@@ -4015,14 +3963,12 @@ TclCompileYieldToCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation; /* TIP #280 */
Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr);
int i;
(void)cmdPtr;
if (parsePtr->numWords < 2) {
return TCL_ERROR;
@@ -4266,11 +4212,9 @@ int
TclCompileInvertOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
(void)cmdPtr;
return CompileUnaryOpCmd(interp, parsePtr, INST_BITNOT, envPtr);
}
@@ -4278,11 +4222,9 @@ int
TclCompileNotOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
(void)cmdPtr;
return CompileUnaryOpCmd(interp, parsePtr, INST_LNOT, envPtr);
}
@@ -4290,11 +4232,9 @@ int
TclCompileAddOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
(void)cmdPtr;
return CompileAssociativeBinaryOpCmd(interp, parsePtr, "0", INST_ADD,
envPtr);
}
@@ -4303,11 +4243,9 @@ int
TclCompileMulOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
(void)cmdPtr;
return CompileAssociativeBinaryOpCmd(interp, parsePtr, "1", INST_MULT,
envPtr);
}
@@ -4316,11 +4254,9 @@ int
TclCompileAndOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
(void)cmdPtr;
return CompileAssociativeBinaryOpCmd(interp, parsePtr, "-1", INST_BITAND,
envPtr);
}
@@ -4329,11 +4265,9 @@ int
TclCompileOrOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
(void)cmdPtr;
return CompileAssociativeBinaryOpCmd(interp, parsePtr, "0", INST_BITOR,
envPtr);
}
@@ -4342,11 +4276,9 @@ int
TclCompileXorOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
(void)cmdPtr;
return CompileAssociativeBinaryOpCmd(interp, parsePtr, "0", INST_BITXOR,
envPtr);
}
@@ -4355,8 +4287,7 @@ int
TclCompilePowOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
/*
@@ -4367,7 +4298,6 @@ TclCompilePowOpCmd(
Tcl_Token *tokenPtr = parsePtr->tokenPtr;
DefineLineInformation; /* TIP #280 */
int words;
(void)cmdPtr;
for (words=1 ; words<parsePtr->numWords ; words++) {
tokenPtr = TokenAfter(tokenPtr);
@@ -4387,11 +4317,9 @@ int
TclCompileLshiftOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
(void)cmdPtr;
return CompileStrictlyBinaryOpCmd(interp, parsePtr, INST_LSHIFT, envPtr);
}
@@ -4399,11 +4327,9 @@ int
TclCompileRshiftOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
(void)cmdPtr;
return CompileStrictlyBinaryOpCmd(interp, parsePtr, INST_RSHIFT, envPtr);
}
@@ -4411,11 +4337,9 @@ int
TclCompileModOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
(void)cmdPtr;
return CompileStrictlyBinaryOpCmd(interp, parsePtr, INST_MOD, envPtr);
}
@@ -4423,11 +4347,9 @@ int
TclCompileNeqOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
(void)cmdPtr;
return CompileStrictlyBinaryOpCmd(interp, parsePtr, INST_NEQ, envPtr);
}
@@ -4435,11 +4357,9 @@ int
TclCompileStrneqOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
(void)cmdPtr;
return CompileStrictlyBinaryOpCmd(interp, parsePtr, INST_STR_NEQ, envPtr);
}
@@ -4447,11 +4367,9 @@ int
TclCompileInOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
(void)cmdPtr;
return CompileStrictlyBinaryOpCmd(interp, parsePtr, INST_LIST_IN, envPtr);
}
@@ -4459,11 +4377,9 @@ int
TclCompileNiOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
(void)cmdPtr;
return CompileStrictlyBinaryOpCmd(interp, parsePtr, INST_LIST_NOT_IN,
envPtr);
}
@@ -4472,11 +4388,9 @@ int
TclCompileLessOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
(void)cmdPtr;
return CompileComparisonOpCmd(interp, parsePtr, INST_LT, envPtr);
}
@@ -4484,11 +4398,9 @@ int
TclCompileLeqOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
(void)cmdPtr;
return CompileComparisonOpCmd(interp, parsePtr, INST_LE, envPtr);
}
@@ -4496,11 +4408,9 @@ int
TclCompileGreaterOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
(void)cmdPtr;
return CompileComparisonOpCmd(interp, parsePtr, INST_GT, envPtr);
}
@@ -4508,11 +4418,9 @@ int
TclCompileGeqOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
(void)cmdPtr;
return CompileComparisonOpCmd(interp, parsePtr, INST_GE, envPtr);
}
@@ -4520,11 +4428,9 @@ int
TclCompileEqOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
(void)cmdPtr;
return CompileComparisonOpCmd(interp, parsePtr, INST_EQ, envPtr);
}
@@ -4532,11 +4438,9 @@ int
TclCompileStreqOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
(void)cmdPtr;
return CompileComparisonOpCmd(interp, parsePtr, INST_STR_EQ, envPtr);
}
@@ -4544,11 +4448,9 @@ int
TclCompileStrLtOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
(void)cmdPtr;
return CompileComparisonOpCmd(interp, parsePtr, INST_STR_LT, envPtr);
}
@@ -4556,11 +4458,9 @@ int
TclCompileStrLeOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
(void)cmdPtr;
return CompileComparisonOpCmd(interp, parsePtr, INST_STR_LE, envPtr);
}
@@ -4568,11 +4468,9 @@ int
TclCompileStrGtOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
(void)cmdPtr;
return CompileComparisonOpCmd(interp, parsePtr, INST_STR_GT, envPtr);
}
@@ -4580,11 +4478,9 @@ int
TclCompileStrGeOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
(void)cmdPtr;
return CompileComparisonOpCmd(interp, parsePtr, INST_STR_GE, envPtr);
}
@@ -4592,14 +4488,12 @@ int
TclCompileMinusOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
Tcl_Token *tokenPtr = parsePtr->tokenPtr;
DefineLineInformation; /* TIP #280 */
int words;
(void)cmdPtr;
/* TODO: Consider support for compiling expanded args. */
if (parsePtr->numWords == 1) {
@@ -4639,14 +4533,12 @@ int
TclCompileDivOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
Tcl_Token *tokenPtr = parsePtr->tokenPtr;
DefineLineInformation; /* TIP #280 */
int words;
(void)cmdPtr;
/* TODO: Consider support for compiling expanded args. */
if (parsePtr->numWords == 1) {
+5 -12
View File
@@ -697,8 +697,7 @@ static void EnterCmdStartData(CompileEnv *envPtr,
static void FreeByteCodeInternalRep(Tcl_Obj *objPtr);
static void FreeSubstCodeInternalRep(Tcl_Obj *objPtr);
static int GetCmdLocEncodingSize(CompileEnv *envPtr);
static int IsCompactibleCompileEnv(Tcl_Interp *interp,
CompileEnv *envPtr);
static int IsCompactibleCompileEnv(CompileEnv *envPtr);
static void PreventCycle(Tcl_Obj *objPtr, CompileEnv *envPtr);
#ifdef TCL_COMPILE_STATS
static void RecordByteCodeStats(ByteCode *codePtr);
@@ -851,7 +850,7 @@ TclSetByteCodeFromAny(
if (Tcl_GetMaster(interp) == NULL &&
!Tcl_LimitTypeEnabled(interp, TCL_LIMIT_COMMANDS|TCL_LIMIT_TIME)
&& IsCompactibleCompileEnv(interp, &compEnv)) {
&& IsCompactibleCompileEnv(&compEnv)) {
TclFreeCompileEnv(&compEnv);
iPtr->compiledProcPtr = procPtr;
TclInitCompileEnv(interp, &compEnv, stringPtr, length,
@@ -962,11 +961,9 @@ SetByteCodeFromAny(
static void
DupByteCodeInternalRep(
Tcl_Obj *srcPtr, /* Object with internal rep to copy. */
Tcl_Obj *copyPtr) /* Object with internal rep to set. */
TCL_UNUSED(Tcl_Obj *) /*srcPtr*/,
TCL_UNUSED(Tcl_Obj *) /*copyPtr*/)
{
(void)srcPtr;
(void)copyPtr;
return;
}
@@ -1176,12 +1173,10 @@ CleanupByteCode(
static int
IsCompactibleCompileEnv(
Tcl_Interp *dummy,
CompileEnv *envPtr)
{
unsigned char *pc;
int size;
(void)dummy;
/*
* Special: procedures in the '::tcl' namespace (or its children) are
@@ -2740,13 +2735,11 @@ TclCompileNoOp(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr;
int i;
(void)cmdPtr;
tokenPtr = parsePtr->tokenPtr;
for (i = 1; i < parsePtr->numWords; i++) {
+5 -11
View File
@@ -41,13 +41,10 @@ typedef struct QCCD {
* Static functions in this file:
*/
static int QueryConfigObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
struct Tcl_Obj *const *objv);
static void QueryConfigDelete(ClientData clientData);
static Tcl_ObjCmdProc QueryConfigObjCmd;
static Tcl_CmdDeleteProc QueryConfigDelete;
static Tcl_InterpDeleteProc ConfigDictDeleteProc;
static Tcl_Obj * GetConfigDict(Tcl_Interp *interp);
static void ConfigDictDeleteProc(ClientData clientData,
Tcl_Interp *interp);
/*
*----------------------------------------------------------------------
@@ -392,12 +389,9 @@ GetConfigDict(
static void
ConfigDictDeleteProc(
ClientData clientData, /* Pointer to Tcl_Obj. */
Tcl_Interp *dummy) /* Interpreter being deleted. */
TCL_UNUSED(Tcl_Interp *))
{
Tcl_Obj *pDB = (Tcl_Obj *)clientData;
(void)dummy;
Tcl_DecrRefCount(pDB);
Tcl_DecrRefCount((Tcl_Obj *)clientData);
}
/*
+1 -2
View File
@@ -2744,7 +2744,7 @@ TclDatelex(
int
TclClockOldscanObjCmd(
void *dummy, /* Unused */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Tcl interpreter */
int objc, /* Count of paraneters */
Tcl_Obj *const *objv) /* Parameters */
@@ -2754,7 +2754,6 @@ TclClockOldscanObjCmd(
DateInfo dateInfo;
DateInfo* info = &dateInfo;
int status;
(void)dummy;
if (objc != 5) {
Tcl_WrongNumArgs(interp, 1, objv,
+11 -4
View File
@@ -1206,7 +1206,8 @@ EXTERN Tcl_ChannelTypeVersion Tcl_ChannelVersion(
EXTERN Tcl_DriverBlockModeProc * Tcl_ChannelBlockModeProc(
const Tcl_ChannelType *chanTypePtr);
/* 401 */
EXTERN Tcl_DriverCloseProc * Tcl_ChannelCloseProc(
TCL_DEPRECATED("Use Tcl_ChannelClose2Proc")
Tcl_DriverCloseProc * Tcl_ChannelCloseProc(
const Tcl_ChannelType *chanTypePtr);
/* 402 */
EXTERN Tcl_DriverClose2Proc * Tcl_ChannelClose2Proc(
@@ -1218,7 +1219,8 @@ EXTERN Tcl_DriverInputProc * Tcl_ChannelInputProc(
EXTERN Tcl_DriverOutputProc * Tcl_ChannelOutputProc(
const Tcl_ChannelType *chanTypePtr);
/* 405 */
EXTERN Tcl_DriverSeekProc * Tcl_ChannelSeekProc(
TCL_DEPRECATED("Use Tcl_ChannelWideSeekProc")
Tcl_DriverSeekProc * Tcl_ChannelSeekProc(
const Tcl_ChannelType *chanTypePtr);
/* 406 */
EXTERN Tcl_DriverSetOptionProc * Tcl_ChannelSetOptionProc(
@@ -2355,11 +2357,11 @@ typedef struct TclStubs {
const char * (*tcl_ChannelName) (const Tcl_ChannelType *chanTypePtr); /* 398 */
Tcl_ChannelTypeVersion (*tcl_ChannelVersion) (const Tcl_ChannelType *chanTypePtr); /* 399 */
Tcl_DriverBlockModeProc * (*tcl_ChannelBlockModeProc) (const Tcl_ChannelType *chanTypePtr); /* 400 */
Tcl_DriverCloseProc * (*tcl_ChannelCloseProc) (const Tcl_ChannelType *chanTypePtr); /* 401 */
TCL_DEPRECATED_API("Use Tcl_ChannelClose2Proc") Tcl_DriverCloseProc * (*tcl_ChannelCloseProc) (const Tcl_ChannelType *chanTypePtr); /* 401 */
Tcl_DriverClose2Proc * (*tcl_ChannelClose2Proc) (const Tcl_ChannelType *chanTypePtr); /* 402 */
Tcl_DriverInputProc * (*tcl_ChannelInputProc) (const Tcl_ChannelType *chanTypePtr); /* 403 */
Tcl_DriverOutputProc * (*tcl_ChannelOutputProc) (const Tcl_ChannelType *chanTypePtr); /* 404 */
Tcl_DriverSeekProc * (*tcl_ChannelSeekProc) (const Tcl_ChannelType *chanTypePtr); /* 405 */
TCL_DEPRECATED_API("Use Tcl_ChannelWideSeekProc") Tcl_DriverSeekProc * (*tcl_ChannelSeekProc) (const Tcl_ChannelType *chanTypePtr); /* 405 */
Tcl_DriverSetOptionProc * (*tcl_ChannelSetOptionProc) (const Tcl_ChannelType *chanTypePtr); /* 406 */
Tcl_DriverGetOptionProc * (*tcl_ChannelGetOptionProc) (const Tcl_ChannelType *chanTypePtr); /* 407 */
Tcl_DriverWatchProc * (*tcl_ChannelWatchProc) (const Tcl_ChannelType *chanTypePtr); /* 408 */
@@ -4171,4 +4173,9 @@ extern const TclStubs *tclStubsPtr;
#define Tcl_GlobalEvalObj(interp, objPtr) \
Tcl_EvalObjEx(interp, objPtr, TCL_EVAL_GLOBAL)
#if defined(TCL_NO_DEPRECATED) && defined(USE_TCL_STUBS)
#undef Tcl_Close
#define Tcl_Close(interp, chan) Tcl_CloseEx(interp, chan, 0)
#endif
#endif /* _TCLDECLS */
+70 -106
View File
@@ -23,62 +23,44 @@ struct Dict;
* Prototypes for functions defined later in this file:
*/
static void DeleteDict(struct Dict *dict);
static int DictAppendCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const *objv);
static int DictCreateCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const *objv);
static int DictExistsCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const *objv);
static int DictFilterCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const *objv);
static int DictGetCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const *objv);
static int DictGetDefCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const *objv);
static int DictIncrCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const *objv);
static int DictInfoCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const *objv);
static int DictKeysCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const *objv);
static int DictLappendCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const *objv);
static int DictMergeCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const *objv);
static int DictRemoveCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const *objv);
static int DictReplaceCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const *objv);
static int DictSetCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const *objv);
static int DictSizeCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const *objv);
static int DictUnsetCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const *objv);
static int DictUpdateCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const *objv);
static int DictValuesCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const *objv);
static int DictWithCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const *objv);
static void DupDictInternalRep(Tcl_Obj *srcPtr, Tcl_Obj *copyPtr);
static void FreeDictInternalRep(Tcl_Obj *dictPtr);
static void InvalidateDictChain(Tcl_Obj *dictObj);
static int SetDictFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr);
static void UpdateStringOfDict(Tcl_Obj *dictPtr);
static Tcl_HashEntry * AllocChainEntry(Tcl_HashTable *tablePtr,void *keyPtr);
static inline void InitChainTable(struct Dict *dict);
static inline void DeleteChainTable(struct Dict *dict);
static inline Tcl_HashEntry *CreateChainEntry(struct Dict *dict,
Tcl_Obj *keyPtr, int *newPtr);
static inline int DeleteChainEntry(struct Dict *dict, Tcl_Obj *keyPtr);
static Tcl_NRPostProc FinalizeDictUpdate;
static Tcl_NRPostProc FinalizeDictWith;
static Tcl_ObjCmdProc DictForNRCmd;
static Tcl_ObjCmdProc DictMapNRCmd;
static Tcl_NRPostProc DictForLoopCallback;
static Tcl_NRPostProc DictMapLoopCallback;
static void DeleteDict(struct Dict *dict);
static Tcl_ObjCmdProc DictAppendCmd;
static Tcl_ObjCmdProc DictCreateCmd;
static Tcl_ObjCmdProc DictExistsCmd;
static Tcl_ObjCmdProc DictFilterCmd;
static Tcl_ObjCmdProc DictGetCmd;
static Tcl_ObjCmdProc DictGetDefCmd;
static Tcl_ObjCmdProc DictIncrCmd;
static Tcl_ObjCmdProc DictInfoCmd;
static Tcl_ObjCmdProc DictKeysCmd;
static Tcl_ObjCmdProc DictLappendCmd;
static Tcl_ObjCmdProc DictMergeCmd;
static Tcl_ObjCmdProc DictRemoveCmd;
static Tcl_ObjCmdProc DictReplaceCmd;
static Tcl_ObjCmdProc DictSetCmd;
static Tcl_ObjCmdProc DictSizeCmd;
static Tcl_ObjCmdProc DictUnsetCmd;
static Tcl_ObjCmdProc DictUpdateCmd;
static Tcl_ObjCmdProc DictValuesCmd;
static Tcl_ObjCmdProc DictWithCmd;
static Tcl_DupInternalRepProc DupDictInternalRep;
static Tcl_FreeInternalRepProc FreeDictInternalRep;
static void InvalidateDictChain(Tcl_Obj *dictObj);
static Tcl_SetFromAnyProc SetDictFromAny;
static Tcl_UpdateStringProc UpdateStringOfDict;
static Tcl_AllocHashEntryProc AllocChainEntry;
static inline void InitChainTable(struct Dict *dict);
static inline void DeleteChainTable(struct Dict *dict);
static inline Tcl_HashEntry * CreateChainEntry(struct Dict *dict,
Tcl_Obj *keyPtr, int *newPtr);
static inline int DeleteChainEntry(struct Dict *dict,
Tcl_Obj *keyPtr);
static Tcl_NRPostProc FinalizeDictUpdate;
static Tcl_NRPostProc FinalizeDictWith;
static Tcl_ObjCmdProc DictForNRCmd;
static Tcl_ObjCmdProc DictMapNRCmd;
static Tcl_NRPostProc DictForLoopCallback;
static Tcl_NRPostProc DictMapLoopCallback;
/*
* Table of dict subcommand names and implementations.
@@ -240,12 +222,11 @@ typedef struct {
static Tcl_HashEntry *
AllocChainEntry(
Tcl_HashTable *tablePtr,
TCL_UNUSED(Tcl_HashTable *),
void *keyPtr)
{
Tcl_Obj *objPtr = (Tcl_Obj *)keyPtr;
ChainEntry *cPtr;
(void)tablePtr;
cPtr = (ChainEntry *)ckalloc(sizeof(ChainEntry));
cPtr->entry.key.objPtr = objPtr;
@@ -1462,12 +1443,12 @@ Tcl_NewDictObj(void)
*----------------------------------------------------------------------
*/
#ifdef TCL_MEM_DEBUG
Tcl_Obj *
Tcl_DbNewDictObj(
const char *file,
int line)
{
#ifdef TCL_MEM_DEBUG
Tcl_Obj *dictPtr;
Dict *dict;
@@ -1480,12 +1461,16 @@ Tcl_DbNewDictObj(
dict->refCount = 1;
DictSetIntRep(dictPtr, dict);
return dictPtr;
#else /* !TCL_MEM_DEBUG */
(void)file;
(void)line;
return Tcl_NewDictObj();
#endif
}
#else /* !TCL_MEM_DEBUG */
Tcl_Obj *
Tcl_DbNewDictObj(
TCL_UNUSED(const char *) /*file*/,
TCL_UNUSED(int) /*line*/)
{
return Tcl_NewDictObj();
}
#endif
/***** START OF FUNCTIONS IMPLEMENTING TCL COMMANDS *****/
@@ -1509,14 +1494,13 @@ Tcl_DbNewDictObj(
static int
DictCreateCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
{
Tcl_Obj *dictObj;
int i;
(void)dummy;
/*
* Must have an even number of arguments; note that number of preceding
@@ -1560,14 +1544,13 @@ DictCreateCmd(
static int
DictGetCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
{
Tcl_Obj *dictPtr, *valuePtr = NULL;
int result;
(void)dummy;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "dictionary ?key ...?");
@@ -1654,7 +1637,7 @@ DictGetCmd(
static int
DictGetDefCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -1662,7 +1645,6 @@ DictGetDefCmd(
Tcl_Obj *dictPtr, *keyPtr, *valuePtr, *defaultPtr;
Tcl_Obj *const *keyPath;
int numKeys;
(void)dummy;
if (objc < 4) {
Tcl_WrongNumArgs(interp, 1, objv, "dictionary ?key ...? key default");
@@ -1720,14 +1702,13 @@ DictGetDefCmd(
static int
DictReplaceCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
{
Tcl_Obj *dictPtr;
int i;
(void)dummy;
if ((objc < 2) || (objc & 1)) {
Tcl_WrongNumArgs(interp, 1, objv, "dictionary ?key value ...?");
@@ -1769,14 +1750,13 @@ DictReplaceCmd(
static int
DictRemoveCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
{
Tcl_Obj *dictPtr;
int i;
(void)dummy;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "dictionary ?key ...?");
@@ -1818,7 +1798,7 @@ DictRemoveCmd(
static int
DictMergeCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -1827,7 +1807,6 @@ DictMergeCmd(
int allocatedDict = 0;
int i, done;
Tcl_DictSearch search;
(void)dummy;
if (objc == 1) {
/*
@@ -1906,14 +1885,13 @@ DictMergeCmd(
static int
DictKeysCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
{
Tcl_Obj *listPtr;
const char *pattern = NULL;
(void)dummy;
if (objc!=2 && objc!=3) {
Tcl_WrongNumArgs(interp, 1, objv, "dictionary ?pattern?");
@@ -1986,7 +1964,7 @@ DictKeysCmd(
static int
DictValuesCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -1995,7 +1973,6 @@ DictValuesCmd(
Tcl_DictSearch search;
int done;
const char *pattern;
(void)dummy;
if (objc!=2 && objc!=3) {
Tcl_WrongNumArgs(interp, 1, objv, "dictionary ?pattern?");
@@ -2047,13 +2024,12 @@ DictValuesCmd(
static int
DictSizeCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
{
int result, size;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "dictionary");
@@ -2086,13 +2062,12 @@ DictSizeCmd(
static int
DictExistsCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
{
Tcl_Obj *dictPtr, *valuePtr;
(void)dummy;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 1, objv, "dictionary key ?key ...?");
@@ -2129,14 +2104,13 @@ DictExistsCmd(
static int
DictInfoCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
{
Dict *dict;
char *statsStr;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "dictionary");
@@ -2174,14 +2148,13 @@ DictInfoCmd(
static int
DictIncrCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
{
int code = TCL_OK;
Tcl_Obj *dictPtr, *valuePtr = NULL;
(void)dummy;
if (objc < 3 || objc > 4) {
Tcl_WrongNumArgs(interp, 1, objv, "dictVarName key ?increment?");
@@ -2295,14 +2268,13 @@ DictIncrCmd(
static int
DictLappendCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
{
Tcl_Obj *dictPtr, *valuePtr, *resultPtr;
int i, allocatedDict = 0, allocatedValue = 0;
(void)dummy;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 1, objv, "dictVarName key ?value ...?");
@@ -2383,14 +2355,13 @@ DictLappendCmd(
static int
DictAppendCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
{
Tcl_Obj *dictPtr, *valuePtr, *resultPtr;
int allocatedDict = 0;
(void)dummy;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 1, objv, "dictVarName key ?value ...?");
@@ -2486,7 +2457,7 @@ DictAppendCmd(
static int
DictForNRCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -2496,7 +2467,6 @@ DictForNRCmd(
Tcl_Obj **varv, *keyObj, *valueObj;
Tcl_DictSearch *searchPtr;
int varc, done;
(void)dummy;
if (objc != 4) {
Tcl_WrongNumArgs(interp, 1, objv,
@@ -2682,7 +2652,7 @@ DictForLoopCallback(
static int
DictMapNRCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -2691,7 +2661,6 @@ DictMapNRCmd(
Tcl_Obj **varv, *keyObj, *valueObj;
DictMapStorage *storagePtr;
int varc, done;
(void)dummy;
if (objc != 4) {
Tcl_WrongNumArgs(interp, 1, objv,
@@ -2895,14 +2864,13 @@ DictMapLoopCallback(
static int
DictSetCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
{
Tcl_Obj *dictPtr, *resultPtr;
int result, allocatedDict = 0;
(void)dummy;
if (objc < 4) {
Tcl_WrongNumArgs(interp, 1, objv, "dictVarName key ?key ...? value");
@@ -2956,14 +2924,13 @@ DictSetCmd(
static int
DictUnsetCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
{
Tcl_Obj *dictPtr, *resultPtr;
int result, allocatedDict = 0;
(void)dummy;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 1, objv, "dictVarName key ?key ...?");
@@ -3016,7 +2983,7 @@ DictUnsetCmd(
static int
DictFilterCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -3033,7 +3000,6 @@ DictFilterCmd(
Tcl_DictSearch search;
int index, varc, done, result, satisfied;
const char *pattern;
(void)dummy;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 1, objv, "dictionary filterType ?arg ...?");
@@ -3302,7 +3268,7 @@ DictFilterCmd(
static int
DictUpdateCmd(
ClientData clientData,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -3310,7 +3276,6 @@ DictUpdateCmd(
Interp *iPtr = (Interp *) interp;
Tcl_Obj *dictPtr, *objPtr;
int i, dummy;
(void)clientData;
if (objc < 5 || !(objc & 1)) {
Tcl_WrongNumArgs(interp, 1, objv,
@@ -3461,14 +3426,13 @@ FinalizeDictUpdate(
static int
DictWithCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
{
Interp *iPtr = (Interp *) interp;
Tcl_Obj *dictPtr, *keysPtr, *pathPtr;
(void)dummy;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 1, objv, "dictVarName ?key ...? script");
+8 -11
View File
@@ -21,8 +21,7 @@
* Prototypes for procedures defined later in this file:
*/
static Tcl_Obj * DisassembleByteCodeAsDicts(Tcl_Interp *interp,
Tcl_Obj *objPtr);
static Tcl_Obj * DisassembleByteCodeAsDicts(Tcl_Obj *objPtr);
static Tcl_Obj * DisassembleByteCodeObj(Tcl_Obj *objPtr);
static int FormatInstruction(ByteCode *codePtr,
const unsigned char *pc, Tcl_Obj *bufferObj);
@@ -131,7 +130,7 @@ GetLocationInformation(
void
TclPrintByteCodeObj(
Tcl_Interp *interp, /* Used only for getting location info. */
TCL_UNUSED(Tcl_Interp *), /* Stuck with this in internal stubs */
Tcl_Obj *objPtr) /* The bytecode object to disassemble. */
{
Tcl_Obj *bufPtr = DisassembleByteCodeObj(objPtr);
@@ -902,23 +901,23 @@ PrintSourceToObj(
continue;
default:
#if TCL_UTF_MAX > 3
if (ch > 0xffff) {
if (ch > 0xFFFF) {
Tcl_AppendPrintfToObj(appendObj, "\\U%08x", ch);
i += 10;
} else
#else
/* If len == 0, this means we have a char > 0xffff, resulting in
/* If len == 0, this means we have a char > 0xFFFF, resulting in
* TclUtfToUniChar producing a surrogate pair. We want to output
* this pair as a single Unicode character.
*/
if (len == 0) {
int upper = ((ch & 0x3ff) + 1) << 10;
int upper = ((ch & 0x3FF) + 1) << 10;
len = TclUtfToUniChar(p, &ch);
Tcl_AppendPrintfToObj(appendObj, "\\U%08x", upper + (ch & 0x3ff));
Tcl_AppendPrintfToObj(appendObj, "\\U%08x", upper + (ch & 0x3FF));
i += 10;
} else
#endif
if (ch < 0x20 || ch >= 0x7f) {
if (ch < 0x20 || ch >= 0x7F) {
Tcl_AppendPrintfToObj(appendObj, "\\u%04x", ch);
i += 6;
} else {
@@ -950,7 +949,6 @@ PrintSourceToObj(
static Tcl_Obj *
DisassembleByteCodeAsDicts(
Tcl_Interp *dummy, /* Not used. */
Tcl_Obj *objPtr) /* The bytecode-holding value to take apart */
{
ByteCode *codePtr;
@@ -959,7 +957,6 @@ DisassembleByteCodeAsDicts(
unsigned char *pc, *opnd, *codeOffPtr, *codeLenPtr, *srcOffPtr, *srcLenPtr;
int codeOffset, codeLength, sourceOffset, sourceLength;
int i, val, line;
(void)dummy;
ByteCodeGetIntRep(objPtr, &tclByteCodeType, codePtr);
@@ -1622,7 +1619,7 @@ Tcl_DisassembleObjCmd(
}
if (clientData) {
Tcl_SetObjResult(interp,
DisassembleByteCodeAsDicts(interp, codeObjPtr));
DisassembleByteCodeAsDicts(codeObjPtr));
} else {
Tcl_SetObjResult(interp,
DisassembleByteCodeObj(codeObjPtr));
+65 -150
View File
@@ -195,85 +195,41 @@ static unsigned short emptyPage[256];
* Functions used only in this module.
*/
static int BinaryProc(ClientData clientData,
const char *src, int srcLen, int flags,
Tcl_EncodingState *statePtr, char *dst, int dstLen,
int *srcReadPtr, int *dstWrotePtr,
int *dstCharsPtr);
static void DupEncodingIntRep(Tcl_Obj *srcPtr, Tcl_Obj *dupPtr);
static void EscapeFreeProc(ClientData clientData);
static int EscapeFromUtfProc(ClientData clientData,
const char *src, int srcLen, int flags,
Tcl_EncodingState *statePtr, char *dst, int dstLen,
int *srcReadPtr, int *dstWrotePtr,
int *dstCharsPtr);
static int EscapeToUtfProc(ClientData clientData,
const char *src, int srcLen, int flags,
Tcl_EncodingState *statePtr, char *dst, int dstLen,
int *srcReadPtr, int *dstWrotePtr,
int *dstCharsPtr);
static void FillEncodingFileMap(void);
static void FreeEncoding(Tcl_Encoding encoding);
static void FreeEncodingIntRep(Tcl_Obj *objPtr);
static Encoding * GetTableEncoding(EscapeEncodingData *dataPtr,
int state);
static Tcl_Encoding LoadEncodingFile(Tcl_Interp *interp, const char *name);
static Tcl_Encoding LoadTableEncoding(const char *name, int type,
Tcl_Channel chan);
static Tcl_Encoding LoadEscapeEncoding(const char *name, Tcl_Channel chan);
static Tcl_Channel OpenEncodingFileChannel(Tcl_Interp *interp,
const char *name);
static void TableFreeProc(ClientData clientData);
static int TableFromUtfProc(ClientData clientData,
const char *src, int srcLen, int flags,
Tcl_EncodingState *statePtr, char *dst, int dstLen,
int *srcReadPtr, int *dstWrotePtr,
int *dstCharsPtr);
static int TableToUtfProc(ClientData clientData, const char *src,
int srcLen, int flags, Tcl_EncodingState *statePtr,
char *dst, int dstLen, int *srcReadPtr,
int *dstWrotePtr, int *dstCharsPtr);
static size_t unilen(const char *src);
static int Utf16ToUtfProc(ClientData clientData,
const char *src, int srcLen, int flags,
Tcl_EncodingState *statePtr, char *dst, int dstLen,
int *srcReadPtr, int *dstWrotePtr,
int *dstCharsPtr);
static int UtfToUtf16Proc(ClientData clientData,
const char *src, int srcLen, int flags,
Tcl_EncodingState *statePtr, char *dst, int dstLen,
int *srcReadPtr, int *dstWrotePtr,
int *dstCharsPtr);
static int UtfToUcs2Proc(ClientData clientData,
const char *src, int srcLen, int flags,
Tcl_EncodingState *statePtr, char *dst, int dstLen,
int *srcReadPtr, int *dstWrotePtr,
int *dstCharsPtr);
static int UtfToUtfProc(ClientData clientData,
const char *src, int srcLen, int flags,
Tcl_EncodingState *statePtr, char *dst, int dstLen,
int *srcReadPtr, int *dstWrotePtr,
int *dstCharsPtr, int pureNullMode);
static int UtfIntToUtfExtProc(ClientData clientData,
const char *src, int srcLen, int flags,
Tcl_EncodingState *statePtr, char *dst, int dstLen,
int *srcReadPtr, int *dstWrotePtr,
int *dstCharsPtr);
static int UtfExtToUtfIntProc(ClientData clientData,
const char *src, int srcLen, int flags,
Tcl_EncodingState *statePtr, char *dst, int dstLen,
int *srcReadPtr, int *dstWrotePtr,
int *dstCharsPtr);
static int Iso88591FromUtfProc(ClientData clientData,
const char *src, int srcLen, int flags,
Tcl_EncodingState *statePtr, char *dst, int dstLen,
int *srcReadPtr, int *dstWrotePtr,
int *dstCharsPtr);
static int Iso88591ToUtfProc(ClientData clientData,
const char *src, int srcLen, int flags,
Tcl_EncodingState *statePtr, char *dst,
int dstLen, int *srcReadPtr, int *dstWrotePtr,
int *dstCharsPtr);
static Tcl_EncodingConvertProc BinaryProc;
static Tcl_DupInternalRepProc DupEncodingIntRep;
static Tcl_EncodingFreeProc EscapeFreeProc;
static Tcl_EncodingConvertProc EscapeFromUtfProc;
static Tcl_EncodingConvertProc EscapeToUtfProc;
static void FillEncodingFileMap(void);
static void FreeEncoding(Tcl_Encoding encoding);
static Tcl_FreeInternalRepProc FreeEncodingIntRep;
static Encoding * GetTableEncoding(EscapeEncodingData *dataPtr,
int state);
static Tcl_Encoding LoadEncodingFile(Tcl_Interp *interp,
const char *name);
static Tcl_Encoding LoadTableEncoding(const char *name, int type,
Tcl_Channel chan);
static Tcl_Encoding LoadEscapeEncoding(const char *name,
Tcl_Channel chan);
static Tcl_Channel OpenEncodingFileChannel(Tcl_Interp *interp,
const char *name);
static Tcl_EncodingFreeProc TableFreeProc;
static Tcl_EncodingConvertProc TableFromUtfProc;
static Tcl_EncodingConvertProc TableToUtfProc;
static size_t unilen(const char *src);
static Tcl_EncodingConvertProc Utf16ToUtfProc;
static Tcl_EncodingConvertProc UtfToUtf16Proc;
static Tcl_EncodingConvertProc UtfToUcs2Proc;
static int UtfToUtfProc(ClientData clientData,
const char *src, int srcLen, int flags,
Tcl_EncodingState *statePtr, char *dst,
int dstLen, int *srcReadPtr,
int *dstWrotePtr, int *dstCharsPtr,
int pureNullMode);
static Tcl_EncodingConvertProc UtfIntToUtfExtProc;
static Tcl_EncodingConvertProc UtfExtToUtfIntProc;
static Tcl_EncodingConvertProc Iso88591FromUtfProc;
static Tcl_EncodingConvertProc Iso88591ToUtfProc;
/*
* A Tcl_ObjType for holding a cached Tcl_Encoding in the twoPtrValue.ptr1 field
@@ -1226,7 +1182,7 @@ Tcl_ExternalToUtfDString(
int
Tcl_ExternalToUtf(
Tcl_Interp *dummy, /* Interp for error return, if not NULL. */
TCL_UNUSED(Tcl_Interp *), /* TODO: Re-examine this. */
Tcl_Encoding encoding, /* The encoding for the source string, or NULL
* for the default system encoding. */
const char *src, /* Source string in specified encoding. */
@@ -1260,7 +1216,6 @@ Tcl_ExternalToUtf(
int charLimited = (flags & TCL_ENCODING_CHAR_LIMIT) && dstCharsPtr;
int maxChars = INT_MAX;
Tcl_EncodingState state;
(void)dummy;
if (encoding == NULL) {
encoding = systemEncoding;
@@ -1418,7 +1373,7 @@ Tcl_UtfToExternalDString(
int
Tcl_UtfToExternal(
Tcl_Interp *dummy, /* Interp for error return, if not NULL. */
TCL_UNUSED(Tcl_Interp *), /* TODO: Re-examine this. */
Tcl_Encoding encoding, /* The encoding for the converted string, or
* NULL for the default system encoding. */
const char *src, /* Source string in UTF-8. */
@@ -1449,7 +1404,6 @@ Tcl_UtfToExternal(
const Encoding *encodingPtr;
int result, srcRead, dstWrote, dstChars;
Tcl_EncodingState state;
(void)dummy;
if (encoding == NULL) {
encoding = systemEncoding;
@@ -1821,7 +1775,7 @@ LoadTableEncoding(
dataPtr->toUnicode[hi] = pageMemPtr;
p += 2;
for (lo = 0; lo < 256; lo++) {
if ((lo & 0x0f) == 0) {
if ((lo & 0x0F) == 0) {
p++;
}
ch = (staticHex[UCHAR(p[0])] << 12) + (staticHex[UCHAR(p[1])] << 8)
@@ -1882,7 +1836,7 @@ LoadTableEncoding(
pageMemPtr += 256;
dataPtr->fromUnicode[ch >> 8] = page;
}
page[ch & 0xff] = (unsigned short) ((hi << 8) + lo);
page[ch & 0xFF] = (unsigned short) ((hi << 8) + lo);
}
}
}
@@ -1988,7 +1942,7 @@ LoadTableEncoding(
if (from == 0) {
continue;
}
dataPtr->fromUnicode[from >> 8][from & 0xff] = to;
dataPtr->fromUnicode[from >> 8][from & 0xFF] = to;
}
}
doneParse:
@@ -2157,15 +2111,11 @@ LoadEscapeEncoding(
static int
BinaryProc(
ClientData clientData, /* Not used. */
TCL_UNUSED(ClientData),
const char *src, /* Source string (unknown encoding). */
int srcLen, /* Source string length in bytes. */
int flags, /* Conversion control flags. */
Tcl_EncodingState *statePtr,/* Place for conversion routine to store state
* information used during a piecewise
* conversion. Contents of statePtr are
* initialized and/or reset by conversion
* routine under control of flags argument. */
TCL_UNUSED(Tcl_EncodingState *),
char *dst, /* Output buffer in which converted string is
* stored. */
int dstLen, /* The maximum length of output buffer in
@@ -2180,8 +2130,6 @@ BinaryProc(
* output buffer. */
{
int result;
(void)clientData;
(void)statePtr;
result = TCL_OK;
dstLen -= TCL_UTF_MAX - 1;
@@ -2209,7 +2157,7 @@ BinaryProc(
* UtfIntToUtfExtProc --
*
* Convert from UTF-8 to UTF-8. While converting null-bytes from the
* Tcl's internal representation (0xc0, 0x80) to the official
* Tcl's internal representation (0xC0, 0x80) to the official
* representation (0x00). See UtfToUtfProc for details.
*
* Results:
@@ -2223,7 +2171,7 @@ BinaryProc(
static int
UtfIntToUtfExtProc(
ClientData clientData, /* Not used. */
ClientData clientData,
const char *src, /* Source string in UTF-8. */
int srcLen, /* Source string length in bytes. */
int flags, /* Conversion control flags. */
@@ -2258,7 +2206,7 @@ UtfIntToUtfExtProc(
* UtfExtToUtfIntProc --
*
* Convert from UTF-8 to UTF-8 while converting null-bytes from the
* official representation (0x00) to Tcl's internal representation (0xc0,
* official representation (0x00) to Tcl's internal representation (0xC0,
* 0x80). See UtfToUtfProc for details.
*
* Results:
@@ -2272,7 +2220,7 @@ UtfIntToUtfExtProc(
static int
UtfExtToUtfIntProc(
ClientData clientData, /* Not used. */
ClientData clientData,
const char *src, /* Source string in UTF-8. */
int srcLen, /* Source string length in bytes. */
int flags, /* Conversion control flags. */
@@ -2321,7 +2269,7 @@ UtfExtToUtfIntProc(
static int
UtfToUtfProc(
ClientData clientData, /* Not used. */
TCL_UNUSED(ClientData),
const char *src, /* Source string in UTF-8. */
int srcLen, /* Source string length in bytes. */
int flags, /* Conversion control flags. */
@@ -2353,7 +2301,6 @@ UtfToUtfProc(
const char *dstStart, *dstEnd;
int result, numChars, charLimit = INT_MAX;
Tcl_UniChar *chPtr = (Tcl_UniChar *) statePtr;
(void)clientData;
if (flags & TCL_ENCODING_START) {
*statePtr = 0;
@@ -2390,14 +2337,14 @@ UtfToUtfProc(
if (UCHAR(*src) < 0x80 && !(UCHAR(*src) == 0 && pureNullMode == 0)) {
/*
* Copy 7bit characters, but skip null-bytes when we are in input
* mode, so that they get converted to 0xc080.
* mode, so that they get converted to 0xC080.
*/
*dst++ = *src++;
} else if (pureNullMode == 1 && UCHAR(*src) == 0xc0 &&
} else if (pureNullMode == 1 && UCHAR(*src) == 0xC0 &&
(src + 1 < srcEnd) && UCHAR(*(src+1)) == 0x80) {
/*
* Convert 0xc080 to real nulls when we are in output mode.
* Convert 0xC080 to real nulls when we are in output mode.
*/
*dst++ = 0;
@@ -2460,11 +2407,7 @@ Utf16ToUtfProc(
const char *src, /* Source string in Unicode. */
int srcLen, /* Source string length in bytes. */
int flags, /* Conversion control flags. */
Tcl_EncodingState *statePtr,/* Place for conversion routine to store state
* information used during a piecewise
* conversion. Contents of statePtr are
* initialized and/or reset by conversion
* routine under control of flags argument. */
TCL_UNUSED(Tcl_EncodingState *),
char *dst, /* Output buffer in which converted string is
* stored. */
int dstLen, /* The maximum length of output buffer in
@@ -2485,7 +2428,6 @@ Utf16ToUtfProc(
const char *dstEnd, *dstStart;
int result, numChars, charLimit = INT_MAX;
unsigned short ch;
(void)statePtr;
if (flags & TCL_ENCODING_CHAR_LIMIT) {
charLimit = *dstCharsPtr;
@@ -2680,11 +2622,7 @@ UtfToUcs2Proc(
const char *src, /* Source string in UTF-8. */
int srcLen, /* Source string length in bytes. */
int flags, /* Conversion control flags. */
Tcl_EncodingState *statePtr,/* Place for conversion routine to store state
* information used during a piecewise
* conversion. Contents of statePtr are
* initialized and/or reset by conversion
* routine under control of flags argument. */
TCL_UNUSED(Tcl_EncodingState *),
char *dst, /* Output buffer in which converted string is
* stored. */
int dstLen, /* The maximum length of output buffer in
@@ -2707,7 +2645,6 @@ UtfToUcs2Proc(
int len;
#endif
Tcl_UniChar ch = 0;
(void)statePtr;
srcStart = src;
srcEnd = src + srcLen;
@@ -2790,11 +2727,7 @@ TableToUtfProc(
const char *src, /* Source string in specified encoding. */
int srcLen, /* Source string length in bytes. */
int flags, /* Conversion control flags. */
Tcl_EncodingState *statePtr,/* Place for conversion routine to store state
* information used during a piecewise
* conversion. Contents of statePtr are
* initialized and/or reset by conversion
* routine under control of flags argument. */
TCL_UNUSED(Tcl_EncodingState *),
char *dst, /* Output buffer in which converted string is
* stored. */
int dstLen, /* The maximum length of output buffer in
@@ -2818,7 +2751,6 @@ TableToUtfProc(
const unsigned short *const *toUnicode;
const unsigned short *pageZero;
TableEncodingData *dataPtr = (TableEncodingData *)clientData;
(void)statePtr;
if (flags & TCL_ENCODING_CHAR_LIMIT) {
charLimit = *dstCharsPtr;
@@ -2904,11 +2836,7 @@ TableFromUtfProc(
const char *src, /* Source string in UTF-8. */
int srcLen, /* Source string length in bytes. */
int flags, /* Conversion control flags. */
Tcl_EncodingState *statePtr,/* Place for conversion routine to store state
* information used during a piecewise
* conversion. Contents of statePtr are
* initialized and/or reset by conversion
* routine under control of flags argument. */
TCL_UNUSED(Tcl_EncodingState *),
char *dst, /* Output buffer in which converted string is
* stored. */
int dstLen, /* The maximum length of output buffer in
@@ -2931,7 +2859,6 @@ TableFromUtfProc(
int result, len, word, numChars;
TableEncodingData *dataPtr = (TableEncodingData *)clientData;
const unsigned short *const *fromUnicode;
(void)statePtr;
result = TCL_OK;
@@ -2966,7 +2893,7 @@ TableFromUtfProc(
* full support of int Tcl_UniChar. [Bug 1004065]
*/
if (ch & 0xffff0000) {
if (ch & 0xFFFF0000) {
word = 0;
} else
#else
@@ -2974,7 +2901,7 @@ TableFromUtfProc(
word = 0;
} else
#endif
word = fromUnicode[(ch >> 8)][ch & 0xff];
word = fromUnicode[(ch >> 8)][ch & 0xFF];
if ((word == 0) && (ch != 0)) {
if (flags & TCL_ENCODING_STOPONERROR) {
@@ -3026,15 +2953,11 @@ TableFromUtfProc(
static int
Iso88591ToUtfProc(
ClientData clientData, /* Ignored. */
TCL_UNUSED(ClientData),
const char *src, /* Source string in specified encoding. */
int srcLen, /* Source string length in bytes. */
int flags, /* Conversion control flags. */
Tcl_EncodingState *statePtr,/* Place for conversion routine to store state
* information used during a piecewise
* conversion. Contents of statePtr are
* initialized and/or reset by conversion
* routine under control of flags argument. */
TCL_UNUSED(Tcl_EncodingState *),
char *dst, /* Output buffer in which converted string is
* stored. */
int dstLen, /* The maximum length of output buffer in
@@ -3054,8 +2977,6 @@ Iso88591ToUtfProc(
const char *srcStart, *srcEnd;
const char *dstEnd, *dstStart;
int result, numChars, charLimit = INT_MAX;
(void)clientData;
(void)statePtr;
if (flags & TCL_ENCODING_CHAR_LIMIT) {
charLimit = *dstCharsPtr;
@@ -3112,15 +3033,11 @@ Iso88591ToUtfProc(
static int
Iso88591FromUtfProc(
ClientData clientData, /* Ignored. */
TCL_UNUSED(ClientData),
const char *src, /* Source string in UTF-8. */
int srcLen, /* Source string length in bytes. */
int flags, /* Conversion control flags. */
Tcl_EncodingState *statePtr,/* Place for conversion routine to store state
* information used during a piecewise
* conversion. Contents of statePtr are
* initialized and/or reset by conversion
* routine under control of flags argument. */
TCL_UNUSED(Tcl_EncodingState *),
char *dst, /* Output buffer in which converted string is
* stored. */
int dstLen, /* The maximum length of output buffer in
@@ -3141,8 +3058,6 @@ Iso88591FromUtfProc(
const char *dstStart, *dstEnd;
int result = TCL_OK, numChars;
Tcl_UniChar ch = 0;
(void)clientData;
(void)statePtr;
srcStart = src;
srcEnd = src + srcLen;
@@ -3172,7 +3087,7 @@ Iso88591FromUtfProc(
* Check for illegal characters.
*/
if (ch > 0xff
if (ch > 0xFF
#if TCL_UTF_MAX <= 3
|| ((ch >= 0xD800) && (len < 3))
#endif
@@ -3296,8 +3211,8 @@ EscapeToUtfProc(
charLimit = *dstCharsPtr;
}
result = TCL_OK;
tablePrefixBytes = NULL; /* lint. */
tableToUnicode = NULL; /* lint. */
tablePrefixBytes = NULL;
tableToUnicode = NULL;
prefixBytes = dataPtr->prefixBytes;
encodingPtr = NULL;
@@ -3559,7 +3474,7 @@ EscapeFromUtfProc(
break;
}
len = TclUtfToUniChar(src, &ch);
word = tableFromUnicode[(ch >> 8)][ch & 0xff];
word = tableFromUnicode[(ch >> 8)][ch & 0xFF];
if ((word == 0) && (ch != 0)) {
int oldState;
@@ -3569,7 +3484,7 @@ EscapeFromUtfProc(
for (state = 0; state < dataPtr->numSubTables; state++) {
encodingPtr = GetTableEncoding(dataPtr, state);
tableDataPtr = (const TableEncodingData *)encodingPtr->clientData;
word = tableDataPtr->fromUnicode[(ch >> 8)][ch & 0xff];
word = tableDataPtr->fromUnicode[(ch >> 8)][ch & 0xFF];
if (word != 0) {
break;
}
+3 -6
View File
@@ -151,7 +151,7 @@ NewNsObj(
int
TclNamespaceEnsembleCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -164,7 +164,6 @@ TclNamespaceEnsembleCmd(
Tcl_Obj *listObj;
const char *simpleName;
int index, done;
(void)dummy;
if (nsPtr == NULL || nsPtr->flags & NS_DYING) {
if (!Tcl_InterpDeleted(interp)) {
@@ -1988,11 +1987,10 @@ NsEnsembleImplementationCmdNR(
int
TclClearRootEnsemble(
ClientData dummy[],
TCL_UNUSED(ClientData *),
Tcl_Interp *interp,
int result)
{
(void)dummy;
TclResetRewriteEnsemble(interp, 1);
return result;
}
@@ -2096,12 +2094,11 @@ TclResetRewriteEnsemble(
static int
FreeER(
ClientData data[],
Tcl_Interp *dummy,
TCL_UNUSED(Tcl_Interp *),
int result)
{
Tcl_Obj **tmp = (Tcl_Obj **) data[0];
Tcl_Obj **store = (Tcl_Obj **) data[1];
(void)dummy;
ckfree(store);
ckfree(tmp);
+48 -29
View File
@@ -17,12 +17,31 @@
TCL_DECLARE_MUTEX(envMutex) /* To serialize access to environ. */
#if defined(_WIN32)
# define tenviron _wenviron
# define tenviron2utfdstr(string, len, dsPtr) (Tcl_DStringInit(dsPtr), \
(char *)Tcl_Char16ToUtfDString((const unsigned short *)(string), ((((len) + 2) >> 1) - 1), (dsPtr)))
# define utf2tenvirondstr(string, len, dsPtr) (Tcl_DStringInit(dsPtr), \
(const WCHAR *)Tcl_UtfToChar16DString((string), (len), (dsPtr)))
# define techar WCHAR
# ifdef USE_PUTENV
# define putenv(env) _wputenv((const wchar_t *)env)
# endif
#else
# define tenviron environ
# define tenviron2utfdstr(tenvstr, len, dstr) \
Tcl_ExternalToUtfDString(NULL, tenvstr, len, dstr)
# define utf2tenvirondstr(str, len, dstr) \
Tcl_UtfToExternalDString(NULL, str, len, dstr)
# define techar char
#endif
static struct {
int cacheSize; /* Number of env strings in cache. */
char **cache; /* Array containing all of the environment
* strings that Tcl has allocated. */
#ifndef USE_PUTENV
char **ourEnviron; /* Cache of the array that we allocate. We
techar **ourEnviron; /* Cache of the array that we allocate. We
* need to track this in case another
* subsystem swaps around the environ array
* like we do. */
@@ -34,6 +53,8 @@ static struct {
#endif
} env;
#define tNTL sizeof(techar)
/*
* Declarations for local functions defined in this file:
*/
@@ -113,16 +134,16 @@ TclSetupEnv(
* will hold just the parts to remove.
*/
if (environ[0] != NULL) {
if (tenviron[0] != NULL) {
int i;
Tcl_MutexLock(&envMutex);
for (i = 0; environ[i] != NULL; i++) {
for (i = 0; tenviron[i] != NULL; i++) {
Tcl_Obj *obj1, *obj2;
const char *p1;
char *p2;
p1 = Tcl_ExternalToUtfDString(NULL, environ[i], -1, &envString);
p1 = tenviron2utfdstr(tenviron[i], -1, &envString);
p2 = (char *)strchr(p1, '=');
if (p2 == NULL) {
/*
@@ -219,7 +240,7 @@ TclSetEnv(
unsigned nameLength, valueLength;
int index, length;
char *p, *oldValue;
const char *p2;
const techar *p2;
/*
* Figure out where the entry is going to go. If the name doesn't already
@@ -238,23 +259,23 @@ TclSetEnv(
* environment is the one we allocated. [Bug 979640]
*/
if ((env.ourEnviron != environ) || (length+2 > env.ourEnvironSize)) {
char **newEnviron = (char **)ckalloc((length + 5) * sizeof(char *));
if ((env.ourEnviron != tenviron) || (length+2 > env.ourEnvironSize)) {
techar **newEnviron = (techar **)ckalloc((length + 5) * sizeof(techar *));
memcpy(newEnviron, environ, length * sizeof(char *));
memcpy(newEnviron, tenviron, length * sizeof(techar *));
if ((env.ourEnvironSize != 0) && (env.ourEnviron != NULL)) {
ckfree(env.ourEnviron);
}
environ = env.ourEnviron = newEnviron;
tenviron = (env.ourEnviron = newEnviron);
env.ourEnvironSize = length + 5;
}
index = length;
environ[index + 1] = NULL;
tenviron[index + 1] = NULL;
#endif /* USE_PUTENV */
oldValue = NULL;
nameLength = strlen(name);
} else {
const char *env;
const char *oldEnv;
/*
* Compare the new value to the existing value. If they're the same
@@ -264,15 +285,15 @@ TclSetEnv(
* interpreters.
*/
env = Tcl_ExternalToUtfDString(NULL, environ[index], -1, &envString);
if (strcmp(value, env + (length + 1)) == 0) {
oldEnv = tenviron2utfdstr(tenviron[index], -1, &envString);
if (strcmp(value, oldEnv + (length + 1)) == 0) {
Tcl_DStringFree(&envString);
Tcl_MutexUnlock(&envMutex);
return;
}
Tcl_DStringFree(&envString);
oldValue = environ[index];
oldValue = (char *)tenviron[index];
nameLength = length;
}
@@ -287,14 +308,14 @@ TclSetEnv(
memcpy(p, name, nameLength);
p[nameLength] = '=';
memcpy(p+nameLength+1, value, valueLength+1);
p2 = Tcl_UtfToExternalDString(NULL, p, -1, &envString);
p2 = utf2tenvirondstr(p, -1, &envString);
/*
* Copy the native string to heap memory.
*/
p = (char *)ckrealloc(p, Tcl_DStringLength(&envString) + 1);
memcpy(p, p2, Tcl_DStringLength(&envString) + 1);
p = (char *)ckrealloc(p, Tcl_DStringLength(&envString) + tNTL);
memcpy(p, p2, Tcl_DStringLength(&envString) + tNTL);
Tcl_DStringFree(&envString);
#ifdef USE_PUTENV
@@ -305,7 +326,7 @@ TclSetEnv(
putenv(p);
index = TclpFindVariable(name, &length);
#else
environ[index] = p;
tenviron[index] = (techar *)p;
#endif /* USE_PUTENV */
/*
@@ -314,7 +335,7 @@ TclSetEnv(
* string in the cache.
*/
if ((index != -1) && (environ[index] == p)) {
if ((index != -1) && (tenviron[index] == (techar *)p)) {
ReplaceString(oldValue, p);
#ifdef HAVE_PUTENV_THAT_COPIES
} else {
@@ -440,7 +461,7 @@ TclUnsetEnv(
* Remember the old value so we can free it if Tcl created the string.
*/
oldValue = environ[index];
oldValue = (char *)tenviron[index];
/*
* Update the system environment. This must be done before we update the
@@ -464,10 +485,10 @@ TclUnsetEnv(
string[length] = '\0';
#endif /* _WIN32 */
Tcl_UtfToExternalDString(NULL, string, -1, &envString);
string = (char *)ckrealloc(string, Tcl_DStringLength(&envString) + 1);
utf2tenvirondstr(string, -1, &envString);
string = (char *)ckrealloc(string, Tcl_DStringLength(&envString) + tNTL);
memcpy(string, Tcl_DStringValue(&envString),
Tcl_DStringLength(&envString)+1);
Tcl_DStringLength(&envString) + tNTL);
Tcl_DStringFree(&envString);
putenv(string);
@@ -478,7 +499,7 @@ TclUnsetEnv(
* string in the cache.
*/
if (environ[index] == string) {
if (tenviron[index] == (techar *)string) {
ReplaceString(oldValue, string);
#ifdef HAVE_PUTENV_THAT_COPIES
} else {
@@ -490,7 +511,7 @@ TclUnsetEnv(
#endif /* HAVE_PUTENV_THAT_COPIES */
}
#else /* !USE_PUTENV_FOR_UNSET */
for (envPtr = environ+index+1; ; envPtr++) {
for (envPtr = (char **)(tenviron+index+1); ; envPtr++) {
envPtr[-1] = *envPtr;
if (*envPtr == NULL) {
break;
@@ -539,7 +560,7 @@ TclGetEnv(
if (index != -1) {
Tcl_DString envStr;
result = Tcl_ExternalToUtfDString(NULL, environ[index], -1, &envStr);
result = tenviron2utfdstr(tenviron[index], -1, &envStr);
result += length;
if (*result == '=') {
result++;
@@ -576,10 +597,9 @@ TclGetEnv(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static char *
EnvTraceProc(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Interpreter whose "env" variable is being
* modified. */
const char *name1, /* Better be "env". */
@@ -587,7 +607,6 @@ EnvTraceProc(
* whole array is being deleted (UTF-8). */
int flags) /* Indicates what's happening. */
{
(void)dummy;
/*
* For array traces, let TclSetupEnv do all the work.
*/
+6 -14
View File
@@ -311,7 +311,7 @@ HandleBgErrors(
int
TclDefaultBgErrorHandlerObjCmd(
void *dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -320,7 +320,6 @@ TclDefaultBgErrorHandlerObjCmd(
Tcl_Obj *tempObjv[2];
int result, code, level;
Tcl_InterpState saved;
(void)dummy;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 1, objv, "msg options");
@@ -598,11 +597,10 @@ TclGetBgErrorHandler(
static void
BgErrorDeleteProc(
void *clientData, /* Pointer to ErrAssocData structure. */
Tcl_Interp *dummy) /* Interpreter being deleted. */
TCL_UNUSED(Tcl_Interp *))
{
ErrAssocData *assocPtr = (ErrAssocData *)clientData;
BgError *errPtr;
(void)dummy;
while (assocPtr->firstBgPtr != NULL) {
errPtr = assocPtr->firstBgPtr;
@@ -1398,17 +1396,15 @@ TclInThreadExit(void)
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_VwaitObjCmd(
void *dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
int done, foundEvent;
const char *nameString;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "name");
@@ -1463,17 +1459,15 @@ Tcl_VwaitObjCmd(
return TCL_OK;
}
/* ARGSUSED */
static char *
VwaitVarProc(
void *clientData, /* Pointer to integer to set to 1. */
void *clientData, /* Pointer to integer to set to 1. */
Tcl_Interp *interp, /* Interpreter containing variable. */
const char *name1, /* Name of variable. */
const char *name2, /* Second part of variable name. */
int flags) /* Information about what happened. */
TCL_UNUSED(int) /*flags*/) /* Information about what happened. */
{
int *donePtr = (int *)clientData;
(void)flags;
*donePtr = 1;
Tcl_UntraceVar2(interp, name1, name2, TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
@@ -1498,10 +1492,9 @@ VwaitVarProc(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_UpdateObjCmd(
void *dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1510,7 +1503,6 @@ Tcl_UpdateObjCmd(
int flags = 0; /* Initialized to avoid compiler warning. */
static const char *const updateOptions[] = {"idletasks", NULL};
enum updateOptions {OPT_IDLETASKS};
(void)dummy;
if (objc == 1) {
flags = TCL_ALL_EVENTS|TCL_DONT_WAIT;
+19 -17
View File
@@ -798,6 +798,7 @@ ReleaseDictIterator(
*----------------------------------------------------------------------
*/
#if defined(TCL_COMPILE_STATS) || defined(TCL_COMPILE_DEBUG)
static void
InitByteCodeExecution(
Tcl_Interp *interp) /* Interpreter for which the Tcl variable
@@ -810,12 +811,19 @@ InitByteCodeExecution(
Tcl_Panic("InitByteCodeExecution: can't create link for tcl_traceExec variable");
}
#endif
#ifndef TCL_COMPILE_STATS
(void)interp;
#else
#ifdef TCL_COMPILE_STATS
Tcl_CreateObjCommand(interp, "evalstats", EvalStatsCmd, NULL, NULL);
#endif /* TCL_COMPILE_STATS */
}
#else
static void
InitByteCodeExecution(
TCL_UNUSED(Tcl_Interp *))
{
}
#endif
/*
*----------------------------------------------------------------------
@@ -1358,13 +1366,11 @@ Tcl_ExprObj(
static int
CopyCallback(
ClientData data[],
Tcl_Interp *dummy,
TCL_UNUSED(Tcl_Interp *),
int result)
{
Tcl_Obj **resultPtrPtr = (Tcl_Obj **)data[0];
Tcl_Obj *resultPtr = (Tcl_Obj *)data[1];
(void)dummy;
(void)dummy;
if (result == TCL_OK) {
*resultPtrPtr = resultPtr;
@@ -1555,11 +1561,9 @@ CompileExprObj(
static void
DupExprCodeInternalRep(
Tcl_Obj *srcPtr,
Tcl_Obj *copyPtr)
TCL_UNUSED(Tcl_Obj *),
TCL_UNUSED(Tcl_Obj *))
{
(void)srcPtr;
(void)copyPtr;
return;
}
@@ -5518,19 +5522,17 @@ TEBCresume(
NEXT_INST_V(1, 3, 1);
case INST_STR_FIND:
match = TclStringFirst(OBJ_UNDER_TOS, OBJ_AT_TOS, 0);
objResultPtr = TclStringFirst(OBJ_UNDER_TOS, OBJ_AT_TOS, 0);
TRACE(("%.20s %.20s => %d\n",
O2S(OBJ_UNDER_TOS), O2S(OBJ_AT_TOS), match));
TclNewIntObj(objResultPtr, match);
O2S(OBJ_UNDER_TOS), O2S(OBJ_AT_TOS), O2S(objResultPtr)));
NEXT_INST_F(1, 2, 1);
case INST_STR_FIND_LAST:
match = TclStringLast(OBJ_UNDER_TOS, OBJ_AT_TOS, INT_MAX - 1);
objResultPtr = TclStringLast(OBJ_UNDER_TOS, OBJ_AT_TOS, INT_MAX - 1);
TRACE(("%.20s %.20s => %d\n",
O2S(OBJ_UNDER_TOS), O2S(OBJ_AT_TOS), match));
TclNewIntObj(objResultPtr, match);
O2S(OBJ_UNDER_TOS), O2S(OBJ_AT_TOS), O2S(objResultPtr)));
NEXT_INST_F(1, 2, 1);
case INST_STR_CLASS:
@@ -8472,7 +8474,7 @@ ExecuteExtendedBinaryMathOp(
/*
* We refuse to accept exponent arguments that exceed one mp_digit
* which means the max exponent value is 2**28-1 = 0x0fffffff =
* which means the max exponent value is 2**28-1 = 0x0FFFFFFF =
* 268435455, which fits into a signed 32 bit int which is within the
* range of the long int type. This means any numeric Tcl_Obj value
* not using TCL_NUMBER_INT type must hold a value larger than we
+9 -18
View File
@@ -47,13 +47,12 @@ static int FileForceOption(Tcl_Interp *interp,
int
TclFileRenameCmd(
ClientData dummy, /* Unused */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Interp for error reporting or recursive
* calls in the case of a tricky rename. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings passed to Tcl_FileCmd. */
{
(void)dummy;
return FileCopyRename(interp, objc, objv, 0);
}
@@ -77,13 +76,12 @@ TclFileRenameCmd(
int
TclFileCopyCmd(
ClientData dummy, /* Unused */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Used for error reporting or recursive calls
* in the case of a tricky copy. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings passed to Tcl_FileCmd. */
{
(void)dummy;
return FileCopyRename(interp, objc, objv, 1);
}
@@ -216,7 +214,7 @@ FileCopyRename(
int
TclFileMakeDirsCmd(
ClientData dummy, /* Unused */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Used for error reporting. */
int objc, /* Number of arguments */
Tcl_Obj *const objv[]) /* Argument strings passed to Tcl_FileCmd. */
@@ -226,7 +224,6 @@ TclFileMakeDirsCmd(
Tcl_Obj *split = NULL;
Tcl_Obj *target = NULL;
Tcl_StatBuf statBuf;
(void)dummy;
result = TCL_OK;
for (i = 1; i < objc; i++) {
@@ -341,7 +338,7 @@ TclFileMakeDirsCmd(
int
TclFileDeleteCmd(
ClientData dummy, /* Unused */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Used for error reporting */
int objc, /* Number of arguments */
Tcl_Obj *const objv[]) /* Argument strings passed to Tcl_FileCmd. */
@@ -349,7 +346,6 @@ TclFileDeleteCmd(
int i, force, result;
Tcl_Obj *errfile;
Tcl_Obj *errorBuffer = NULL;
(void)dummy;
i = FileForceOption(interp, objc - 1, objv + 1, &force);
if (i < 0) {
@@ -950,7 +946,7 @@ FileBasename(
int
TclFileAttrsCmd(
ClientData dummy, /* Unused */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* The interpreter for error reporting. */
int objc, /* Number of command line arguments. */
Tcl_Obj *const objv[]) /* The command line objects. */
@@ -961,7 +957,6 @@ TclFileAttrsCmd(
Tcl_Obj *objStrings = NULL;
int numObjStrings = -1;
Tcl_Obj *filePtr;
(void)dummy;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "name ?-option value ...?");
@@ -1167,14 +1162,13 @@ TclFileAttrsCmd(
int
TclFileLinkCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
Tcl_Obj *contents;
int index;
(void)dummy;
if (objc < 2 || objc > 4) {
Tcl_WrongNumArgs(interp, 1, objv, "?-linktype? linkname ?target?");
@@ -1319,13 +1313,12 @@ TclFileLinkCmd(
int
TclFileReadLinkCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
Tcl_Obj *contents;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "name");
@@ -1371,7 +1364,7 @@ TclFileReadLinkCmd(
int
TclFileTemporaryCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1385,7 +1378,6 @@ TclFileTemporaryCmd(
/* Pieces of template. Each piece is NULL if
* it is omitted. The platform temporary file
* engine might ignore some pieces. */
(void)dummy;
if (objc < 1 || objc > 3) {
Tcl_WrongNumArgs(interp, 1, objv, "?nameVar? ?template?");
@@ -1531,7 +1523,7 @@ TclFileTemporaryCmd(
int
TclFileTempDirCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1542,7 +1534,6 @@ TclFileTempDirCmd(
/* Pieces of template. Each piece is NULL if
* it is omitted. The platform temporary file
* engine might ignore some pieces. */
(void)dummy;
if (objc < 1 || objc > 2) {
Tcl_WrongNumArgs(interp, 1, objv, "?template?");
+10 -9
View File
@@ -1217,10 +1217,9 @@ DoTildeSubst(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_GlobObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1241,7 +1240,6 @@ Tcl_GlobObjCmd(
};
enum pathDirOptions {PATH_NONE = -1 , PATH_GENERAL = 0, PATH_DIR = 1};
Tcl_GlobTypeData *globTypes = NULL;
(void)dummy;
globFlags = 0;
join = 0;
@@ -1345,7 +1343,7 @@ Tcl_GlobObjCmd(
return TCL_ERROR;
}
separators = NULL; /* lint. */
separators = NULL;
switch (tclPlatform) {
case TCL_PLATFORM_UNIX:
separators = "/";
@@ -1705,7 +1703,6 @@ Tcl_GlobObjCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
TclGlob(
Tcl_Interp *interp, /* Interpreter for returning error message or
@@ -1724,7 +1721,7 @@ TclGlob(
int result;
Tcl_Obj *filenamesObj, *savedResultObj;
separators = NULL; /* lint. */
separators = NULL;
switch (tclPlatform) {
case TCL_PLATFORM_UNIX:
separators = "/";
@@ -2634,21 +2631,25 @@ Tcl_GetBlocksFromStat(
#endif
}
#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
unsigned
Tcl_GetBlockSizeFromStat(
const Tcl_StatBuf *statPtr)
{
#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
return statPtr->st_blksize;
}
#else
(void)statPtr;
unsigned
Tcl_GetBlockSizeFromStat(
TCL_UNUSED(const Tcl_StatBuf *))
{
/*
* Not a great guess, but will do...
*/
return GUESSED_BLOCK_SIZE;
#endif
}
#endif
/*
* Local Variables:
+7 -18
View File
@@ -798,13 +798,12 @@ HashArrayKey(
static Tcl_HashEntry *
AllocStringEntry(
Tcl_HashTable *tablePtr, /* Hash table. */
TCL_UNUSED(Tcl_HashTable *),
void *keyPtr) /* Key to store in the hash table entry. */
{
const char *string = (const char *) keyPtr;
Tcl_HashEntry *hPtr;
size_t size, allocsize;
(void)tablePtr;
allocsize = size = strlen(string) + 1;
if (size < sizeof(hPtr->key)) {
@@ -864,13 +863,12 @@ CompareStringKeys(
static TCL_HASH_TYPE
HashStringKey(
Tcl_HashTable *tablePtr, /* Hash table. */
TCL_UNUSED(Tcl_HashTable *),
void *keyPtr) /* Key from which to compute hash value. */
{
const char *string = (const char *)keyPtr;
TCL_HASH_TYPE result;
char c;
(void)tablePtr;
/*
* I tried a zillion different hash functions and asked many other people
@@ -929,14 +927,11 @@ HashStringKey(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static Tcl_HashEntry *
BogusFind(
Tcl_HashTable *tablePtr, /* Table in which to lookup entry. */
const char *key) /* Key to use to find matching entry. */
TCL_UNUSED(Tcl_HashTable *),
TCL_UNUSED(const char *))
{
(void)tablePtr;
(void)key;
Tcl_Panic("called %s on deleted table", "Tcl_FindHashEntry");
return NULL;
}
@@ -958,18 +953,12 @@ BogusFind(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static Tcl_HashEntry *
BogusCreate(
Tcl_HashTable *tablePtr, /* Table in which to lookup entry. */
const char *key, /* Key to use to find or create matching
* entry. */
int *newPtr) /* Store info here telling whether a new entry
* was created. */
TCL_UNUSED(Tcl_HashTable *),
TCL_UNUSED(const char *),
TCL_UNUSED(int *))
{
(void)tablePtr;
(void)key;
(void)newPtr;
Tcl_Panic("called %s on deleted table", "Tcl_CreateHashEntry");
return NULL;
}
+1 -2
View File
@@ -211,10 +211,9 @@ Tcl_RecordAndEvalObj(
static void
DeleteHistoryObjs(
ClientData clientData,
Tcl_Interp *dummy)
TCL_UNUSED(Tcl_Interp *))
{
HistoryObjs *histObjsPtr = (HistoryObjs *)clientData;
(void)dummy;
TclDecrRefCount(histObjsPtr->historyObj);
TclDecrRefCount(histObjsPtr->addObj);
+186 -122
View File
@@ -201,7 +201,7 @@ static int FlushChannel(Tcl_Interp *interp, Channel *chanPtr,
int calledFromAsyncFlush);
static int TclGetsObjBinary(Tcl_Channel chan, Tcl_Obj *objPtr);
static Tcl_Encoding GetBinaryEncoding(void);
static void FreeBinaryEncoding(ClientData clientData);
static Tcl_ExitProc FreeBinaryEncoding;
static Tcl_HashTable * GetChannelTable(Tcl_Interp *interp);
static int GetInput(Channel *chanPtr);
static void PeekAhead(Channel *chanPtr, char **dstEndPtr,
@@ -374,20 +374,12 @@ ChanClose(
Channel *chanPtr,
Tcl_Interp *interp)
{
if (chanPtr->typePtr->closeProc != TCL_CLOSE2PROC) {
#ifndef TCL_NO_DEPRECATED
if ((chanPtr->typePtr->closeProc != TCL_CLOSE2PROC) && (chanPtr->typePtr->closeProc != NULL)) {
return chanPtr->typePtr->closeProc(chanPtr->instanceData, interp);
} else {
return chanPtr->typePtr->close2Proc(chanPtr->instanceData, interp, 0);
}
}
static inline int
ChanCloseHalf(
Channel *chanPtr,
Tcl_Interp *interp,
int flags)
{
return chanPtr->typePtr->close2Proc(chanPtr->instanceData, interp, flags);
#endif
return chanPtr->typePtr->close2Proc(chanPtr->instanceData, interp, 0);
}
/*
@@ -490,18 +482,23 @@ ChanSeek(
* type and non-NULL.
*/
if (Tcl_ChannelWideSeekProc(chanPtr->typePtr) != NULL) {
if (Tcl_ChannelWideSeekProc(chanPtr->typePtr) == NULL) {
#ifndef TCL_NO_DEPRECATED
if (offset<LONG_MIN || offset>LONG_MAX) {
*errnoPtr = EOVERFLOW;
return -1;
}
return Tcl_ChannelSeekProc(chanPtr->typePtr)(chanPtr->instanceData,
offset, mode, errnoPtr);
#else
*errnoPtr = EINVAL;
return -1;
#endif
}
return Tcl_ChannelWideSeekProc(chanPtr->typePtr)(chanPtr->instanceData,
offset, mode, errnoPtr);
}
if (offset<LONG_MIN || offset>LONG_MAX) {
*errnoPtr = EOVERFLOW;
return -1;
}
return Tcl_ChannelSeekProc(chanPtr->typePtr)(chanPtr->instanceData,
offset, mode, errnoPtr);
}
static inline void
@@ -582,7 +579,6 @@ TclInitIOSubsystem(void)
*-------------------------------------------------------------------------
*/
/* ARGSUSED */
void
TclFinalizeIOSubsystem(void)
{
@@ -1518,12 +1514,11 @@ TclGetChannelFromObj(
* channel was opened? Will contain an ORed
* combination of TCL_READABLE and
* TCL_WRITABLE, if non-NULL. */
int flags)
TCL_UNUSED(int) /*flags*/)
{
ChannelState *statePtr;
ResolvedChanName *resPtr = NULL;
Tcl_Channel chan;
(void)flags;
if (interp == NULL) {
return TCL_ERROR;
@@ -1540,8 +1535,8 @@ TclGetChannelFromObj(
/* No epoch change in channel since lookup */
&& (resPtr->epoch == statePtr->epoch)) {
/*
* Have a valid saved lookup. Jump to end to return it.
*/
* Have a valid saved lookup. Jump to end to return it.
*/
goto valid;
}
@@ -1626,9 +1621,18 @@ Tcl_CreateChannel(
assert(sizeof(Tcl_ChannelTypeVersion) == sizeof(Tcl_DriverBlockModeProc *));
assert(typePtr->typeName != NULL);
if (NULL == typePtr->closeProc) {
Tcl_Panic("channel type %s must define closeProc", typePtr->typeName);
#ifndef TCL_NO_DEPRECATED
if (((NULL == typePtr->closeProc) || (TCL_CLOSE2PROC == typePtr->closeProc)) && (typePtr->close2Proc == NULL)) {
Tcl_Panic("channel type %s must define closeProc or close2Proc", typePtr->typeName);
}
#else
if (Tcl_ChannelVersion(typePtr) < TCL_CHANNEL_VERSION_5) {
Tcl_Panic("channel type %s must be version TCL_CHANNEL_VERSION_5", typePtr->typeName);
}
if (typePtr->close2Proc == NULL) {
Tcl_Panic("channel type %s must define close2Proc", typePtr->typeName);
}
#endif
if ((TCL_READABLE & mask) && (NULL == typePtr->inputProc)) {
Tcl_Panic("channel type %s must define inputProc when used for reader channel", typePtr->typeName);
}
@@ -1638,9 +1642,11 @@ Tcl_CreateChannel(
if (NULL == typePtr->watchProc) {
Tcl_Panic("channel type %s must define watchProc", typePtr->typeName);
}
if ((NULL!=typePtr->wideSeekProc) && (NULL == typePtr->seekProc)) {
#ifndef TCL_NO_DEPRECATED
if ((NULL != typePtr->wideSeekProc) && (NULL == typePtr->seekProc)) {
Tcl_Panic("channel type %s must define seekProc if defining wideSeekProc", typePtr->typeName);
}
#endif
/*
* JH: We could subsequently memset these to 0 to avoid the numerous
@@ -2878,9 +2884,9 @@ FlushChannel(
break;
} else {
/*
* TODO: Consider detecting and reacting to short writes on
* TODO: Consider detecting and reacting to short writes on
* blocking channels. Ought not happen. See iocmd-24.2.
*/
*/
wroteSome = 1;
}
@@ -3371,7 +3377,6 @@ Tcl_SpliceChannel(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_Close(
Tcl_Interp *interp, /* Interpreter for errors. */
@@ -3382,7 +3387,7 @@ Tcl_Close(
* channel. */
Channel *chanPtr; /* The real IO channel. */
ChannelState *statePtr; /* State of real IO channel. */
int result; /* Of calling FlushChannel. */
int result = 0; /* Of calling FlushChannel. */
int flushcode;
int stickyError;
@@ -3483,12 +3488,20 @@ Tcl_Close(
* it anymore and this will help avoid deadlocks on some channel types.
*/
if (chanPtr->typePtr->closeProc == TCL_CLOSE2PROC) {
result = chanPtr->typePtr->close2Proc(chanPtr->instanceData, interp,
TCL_CLOSE_READ);
} else {
#ifndef TCL_NO_DEPRECATED
if ((chanPtr->typePtr->closeProc == TCL_CLOSE2PROC) || (chanPtr->typePtr->closeProc == NULL)) {
/* If this half-close gives a EINVAL or ENOTCONN, just continue the full close */
result = chanPtr->typePtr->close2Proc(chanPtr->instanceData, interp, TCL_CLOSE_READ);
if ((result == EINVAL) || result == ENOTCONN) {
result = 0;
}
}
#else
result = chanPtr->typePtr->close2Proc(chanPtr->instanceData, interp, TCL_CLOSE_READ);
if ((result == EINVAL) || result == ENOTCONN) {
result = 0;
}
#endif
/*
* The call to FlushChannel will flush any queued output and invoke the
@@ -3531,13 +3544,17 @@ Tcl_Close(
* message set up to now.
*/
if (flushcode != 0 && interp != NULL
if (flushcode != 0) {
/* flushcode has precedence, if available */
result = flushcode;
}
if ((result != 0) && (result != TCL_ERROR) && (interp != NULL)
&& 0 == Tcl_GetCharLength(Tcl_GetObjResult(interp))) {
Tcl_SetErrno(flushcode);
Tcl_SetErrno(result);
Tcl_SetObjResult(interp,
Tcl_NewStringObj(Tcl_PosixError(interp), -1));
}
if ((flushcode != 0) || (result != 0)) {
if (result != 0) {
return TCL_ERROR;
}
return TCL_OK;
@@ -3548,24 +3565,21 @@ Tcl_Close(
*
* Tcl_CloseEx --
*
* Closes one side of a channel, read or write.
* Closes one side of a channel, read or write, close all.
*
* Results:
* A standard Tcl result.
*
* Side effects:
* Closes one direction of the channel.
* Closes one direction of the channel, or do a full close.
*
* NOTE:
* Tcl_CloseEx closes the specified direction of the channel as far as
* the user is concerned. The channel keeps existing however. You cannot
* calls this function to close the last possible direction of the
* channel. Use Tcl_Close for that.
* the user is concerned. If flags = 0, this is equivalent to Tcl_Close.
*
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_CloseEx(
Tcl_Interp *interp, /* Interpreter for errors. */
@@ -3580,18 +3594,26 @@ Tcl_CloseEx(
return TCL_OK;
}
/* TODO: assert flags validity ? */
chanPtr = (Channel *) chan;
statePtr = chanPtr->state;
if ((flags & (TCL_READABLE | TCL_WRITABLE)) == 0) {
return Tcl_Close(interp, chan);
}
if ((flags & (TCL_READABLE | TCL_WRITABLE)) == (TCL_READABLE | TCL_WRITABLE)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"double-close of channels not supported by %ss",
chanPtr->typePtr->typeName));
return TCL_ERROR;
}
/*
* Does the channel support half-close anyway? Error if not.
*/
if (!chanPtr->typePtr->close2Proc) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"half-close of channels not supported by %ss",
"half-close of channels not supported by %ss",
chanPtr->typePtr->typeName));
return TCL_ERROR;
}
@@ -3827,7 +3849,7 @@ CloseChannelPart(
* message in the interp.
*/
result = ChanCloseHalf(chanPtr, interp, flags);
result = chanPtr->typePtr->close2Proc(chanPtr->instanceData, NULL, flags);
/*
* If we are being called synchronously, report either any latent error on
@@ -4147,8 +4169,13 @@ Tcl_WriteChars(
}
objPtr = Tcl_NewStringObj(src, len);
src = (char *) Tcl_GetByteArrayFromObj(objPtr, &len);
result = WriteBytes(chanPtr, src, len);
src = (char *) TclGetBytesFromObj(NULL, objPtr, &len);
if (src) {
result = WriteBytes(chanPtr, src, len);
} else {
src = TclGetStringFromObj(objPtr, &len);
result = Write(chanPtr, src, len, GetBinaryEncoding());
}
TclDecrRefCount(objPtr);
return result;
}
@@ -4199,12 +4226,24 @@ Tcl_WriteObj(
return -1;
}
if (statePtr->encoding == NULL) {
src = (char *) Tcl_GetByteArrayFromObj(objPtr, &srcLen);
return WriteBytes(chanPtr, src, srcLen);
} else {
/* We have a binary channel... */
src = (const char *) TclGetBytesFromObj(NULL, objPtr, &srcLen);
if (src) {
/* ... and value to write that is properly expressed as bytes. */
return WriteBytes(chanPtr, src, srcLen);
}
/* We have some non-byte content to write, encode in iso8859-1 */
src = TclGetStringFromObj(objPtr, &srcLen);
return WriteChars(chanPtr, src, srcLen);
return Write(chanPtr, src, srcLen, GetBinaryEncoding());
}
/* If either one is false, need to process encodings for correctness */
src = TclGetStringFromObj(objPtr, &srcLen);
return WriteChars(chanPtr, src, srcLen);
}
static void
@@ -4213,12 +4252,15 @@ WillWrite(
{
int inputBuffered;
if ((Tcl_ChannelSeekProc(chanPtr->typePtr) != NULL) &&
((inputBuffered = Tcl_InputBuffered((Tcl_Channel) chanPtr)) > 0)){
int ignore;
if (((Tcl_ChannelWideSeekProc(chanPtr->typePtr) != NULL)
#ifndef TCL_NO_DEPRECATED
|| (Tcl_ChannelSeekProc(chanPtr->typePtr) != NULL)
#endif
) && ((inputBuffered = Tcl_InputBuffered((Tcl_Channel) chanPtr)) > 0)){
int ignore;
DiscardInputQueued(chanPtr->state, 0);
ChanSeek(chanPtr, -inputBuffered, SEEK_CUR, &ignore);
DiscardInputQueued(chanPtr->state, 0);
ChanSeek(chanPtr, -inputBuffered, SEEK_CUR, &ignore);
}
}
@@ -4228,15 +4270,18 @@ WillRead(
{
if (chanPtr->typePtr == NULL) {
/*
* Prevent read attempts on a closed channel.
*/
* Prevent read attempts on a closed channel.
*/
DiscardInputQueued(chanPtr->state, 0);
DiscardInputQueued(chanPtr->state, 0);
Tcl_SetErrno(EINVAL);
return -1;
}
if ((Tcl_ChannelSeekProc(chanPtr->typePtr) != NULL)
&& (Tcl_OutputBuffered((Tcl_Channel) chanPtr) > 0)) {
if (((Tcl_ChannelWideSeekProc(chanPtr->typePtr) != NULL)
#ifndef TCL_NO_DEPRECATED
|| (Tcl_ChannelSeekProc(chanPtr->typePtr) != NULL)
#endif
) && (Tcl_OutputBuffered((Tcl_Channel) chanPtr) > 0)) {
/*
* CAVEAT - The assumption here is that FlushChannel() will push out
* the bytes of any writes that are in progress. Since this is a
@@ -4247,9 +4292,9 @@ WillRead(
* blocking mode.
*/
if (FlushChannel(NULL, chanPtr, 0) != 0) {
return -1;
}
if (FlushChannel(NULL, chanPtr, 0) != 0) {
return -1;
}
}
return 0;
}
@@ -4337,15 +4382,15 @@ Write(
dstLen + BUFFER_PADDING, &srcRead, &dstWrote, NULL);
/*
* See chan-io-1.[89]. Tcl Bug 506297.
*/
* See chan-io-1.[89]. Tcl Bug 506297.
*/
statePtr->outputEncodingFlags &= ~TCL_ENCODING_START;
if ((result != TCL_OK) && (srcRead + dstWrote == 0)) {
/*
* We're reading from invalid/incomplete UTF-8.
*/
* We're reading from invalid/incomplete UTF-8.
*/
ReleaseChannelBuffer(bufPtr);
if (total == 0) {
@@ -5196,10 +5241,9 @@ TclGetsObjBinary(
static void
FreeBinaryEncoding(
ClientData dummy) /* Not used */
TCL_UNUSED(ClientData))
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
(void)dummy;
if (tsdPtr->binaryEncoding != NULL) {
Tcl_FreeEncoding(tsdPtr->binaryEncoding);
@@ -5208,7 +5252,7 @@ FreeBinaryEncoding(
}
static Tcl_Encoding
GetBinaryEncoding()
GetBinaryEncoding(void)
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
@@ -5657,8 +5701,8 @@ Tcl_ReadRaw(
: bytesToRead;
/*
* Copy the current chunk into the read buffer.
*/
* Copy the current chunk into the read buffer.
*/
memcpy(readBuf, RemovePoint(bufPtr), toCopy);
bufPtr->nextRemoved += toCopy;
@@ -5699,8 +5743,8 @@ Tcl_ReadRaw(
if (nread > 0) {
/*
* Successful read (short is OK) - add to bytes copied.
*/
* Successful read (short is OK) - add to bytes copied.
*/
copied += nread;
} else if (nread < 0) {
@@ -6351,8 +6395,8 @@ ReadChars(
ChannelBuffer *nextPtr;
/*
* We were not able to read any chars.
*/
* We were not able to read any chars.
*/
assert(numChars == 0);
@@ -6372,7 +6416,7 @@ ReadChars(
}
/*
* Otherwise, reading zero characters indicates there's something
* Otherwise, reading zero characters indicates there's something
* incomplete at the end of the src buffer. Maybe there were not
* enough src bytes to decode into a char. Maybe a lone \r could
* not be translated (crlf mode). Need to combine any unused src
@@ -6481,17 +6525,17 @@ TranslateInputEOL(
case TCL_TRANSLATE_LF:
case TCL_TRANSLATE_CR:
if (srcLen > dstLen) {
/*
* In these modes, each src byte become a dst byte.
*/
/*
* In these modes, each src byte become a dst byte.
*/
srcLen = dstLen;
}
break;
default:
/*
* In other modes, at most 2 src bytes become a dst byte.
*/
* In other modes, at most 2 src bytes become a dst byte.
*/
if (srcLen/2 > dstLen) {
srcLen = 2 * dstLen;
@@ -6996,7 +7040,11 @@ Tcl_Seek(
* defined. This means that the channel does not support seeking.
*/
if (Tcl_ChannelSeekProc(chanPtr->typePtr) == NULL) {
if ((Tcl_ChannelWideSeekProc(chanPtr->typePtr) == NULL)
#ifndef TCL_NO_DEPRECATED
&& (Tcl_ChannelSeekProc(chanPtr->typePtr) == NULL)
#endif
) {
Tcl_SetErrno(EINVAL);
return -1;
}
@@ -7160,7 +7208,11 @@ Tcl_Tell(
* defined. This means that the channel does not support seeking.
*/
if (Tcl_ChannelSeekProc(chanPtr->typePtr) == NULL) {
if ((Tcl_ChannelWideSeekProc(chanPtr->typePtr) == NULL)
#ifndef TCL_NO_DEPRECATED
&& (Tcl_ChannelSeekProc(chanPtr->typePtr) == NULL)
#endif
) {
Tcl_SetErrno(EINVAL);
return -1;
}
@@ -8890,20 +8942,19 @@ CreateScriptRecord(
void
TclChannelEventScriptInvoker(
ClientData clientData, /* The script+interp record. */
int mask) /* Not used. */
TCL_UNUSED(int) /*mask*/)
{
Tcl_Interp *interp; /* Interpreter in which to eval the script. */
Channel *chanPtr; /* The channel for which this handler is
* registered. */
EventScriptRecord *esPtr; /* The event script + interpreter to eval it
EventScriptRecord *esPtr = (EventScriptRecord *)clientData;
/* The event script + interpreter to eval it
* in. */
Channel *chanPtr = esPtr->chanPtr;
/* The channel for which this handler is
* registered. */
Tcl_Interp *interp = esPtr->interp;
/* Interpreter in which to eval the script. */
int mask = esPtr->mask;
int result; /* Result of call to eval script. */
esPtr = (EventScriptRecord *)clientData;
chanPtr = esPtr->chanPtr;
mask = esPtr->mask;
interp = esPtr->interp;
/*
* We must preserve the interpreter so we can report errors on it later.
* Note that we do not need to preserve the channel because that is done
@@ -8951,10 +9002,9 @@ TclChannelEventScriptInvoker(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_FileEventObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Interpreter in which the channel for which
* to create the handler is found. */
int objc, /* Number of arguments. */
@@ -8968,7 +9018,6 @@ Tcl_FileEventObjCmd(
int mask;
static const char *const modeOptions[] = {"readable", "writable", NULL};
static const int maskArray[] = {TCL_READABLE, TCL_WRITABLE};
(void)dummy;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 1, objv, "channelId event ?script?");
@@ -9586,8 +9635,8 @@ CopyData(
if (size == 0) {
if (!GotFlag(inStatePtr, CHANNEL_NONBLOCKING)) {
/*
* We allowed a short read. Keep trying.
*/
* We allowed a short read. Keep trying.
*/
continue;
}
@@ -9870,16 +9919,16 @@ DoRead(
if (GotFlag(statePtr, CHANNEL_EOF|CHANNEL_BLOCKED)) {
/*
* Further reads cannot do any more.
*/
* Further reads cannot do any more.
*/
break;
}
if (code) {
/*
* Read error
*/
* Read error
*/
UpdateInterest(chanPtr);
TclChannelRelease((Tcl_Channel)chanPtr);
@@ -9931,28 +9980,28 @@ DoRead(
if (bufPtr->nextPtr == NULL) {
/*
* There's no more buffered data...
*/
* There's no more buffered data...
*/
if (statePtr->flags & CHANNEL_EOF) {
/*
* ...and there never will be.
*/
* ...and there never will be.
*/
*p++ = '\r';
bytesToRead--;
bufPtr->nextRemoved++;
} else if (statePtr->flags & CHANNEL_BLOCKED) {
/*
* ...and we cannot get more now.
*/
* ...and we cannot get more now.
*/
SetFlag(statePtr, CHANNEL_NEED_MORE_DATA);
break;
} else {
/*
* ...so we need to get some.
*/
* ...so we need to get some.
*/
goto moreData;
}
@@ -9960,8 +10009,8 @@ DoRead(
if (bufPtr->nextPtr) {
/*
* There's a next buffer. Shift orphan \r to it.
*/
* There's a next buffer. Shift orphan \r to it.
*/
ChannelBuffer *nextPtr = bufPtr->nextPtr;
@@ -10499,6 +10548,7 @@ Tcl_ChannelVersion(
const Tcl_ChannelType *chanTypePtr)
/* Pointer to channel type. */
{
#ifndef TCL_NO_DEPRECATED
if ((chanTypePtr->version < TCL_CHANNEL_VERSION_2)
|| (chanTypePtr->version > TCL_CHANNEL_VERSION_5)) {
/*
@@ -10507,6 +10557,7 @@ Tcl_ChannelVersion(
*/
return TCL_CHANNEL_VERSION_1;
}
#endif
return chanTypePtr->version;
}
@@ -10530,13 +10581,14 @@ Tcl_ChannelBlockModeProc(
const Tcl_ChannelType *chanTypePtr)
/* Pointer to channel type. */
{
#ifndef TCL_NO_DEPRECATED
if (Tcl_ChannelVersion(chanTypePtr) < TCL_CHANNEL_VERSION_2) {
/*
* The v1 structure had the blockModeProc in a different place.
*/
return (Tcl_DriverBlockModeProc *) chanTypePtr->version;
}
#endif
return chanTypePtr->blockModeProc;
}
@@ -10556,6 +10608,7 @@ Tcl_ChannelBlockModeProc(
*----------------------------------------------------------------------
*/
#ifndef TCL_NO_DEPRECATED
Tcl_DriverCloseProc *
Tcl_ChannelCloseProc(
const Tcl_ChannelType *chanTypePtr)
@@ -10563,6 +10616,7 @@ Tcl_ChannelCloseProc(
{
return chanTypePtr->closeProc;
}
#endif
/*
*----------------------------------------------------------------------
@@ -10652,6 +10706,7 @@ Tcl_ChannelOutputProc(
*----------------------------------------------------------------------
*/
#ifndef TCL_NO_DEPRECATED
Tcl_DriverSeekProc *
Tcl_ChannelSeekProc(
const Tcl_ChannelType *chanTypePtr)
@@ -10659,6 +10714,7 @@ Tcl_ChannelSeekProc(
{
return chanTypePtr->seekProc;
}
#endif
/*
*----------------------------------------------------------------------
@@ -10777,9 +10833,11 @@ Tcl_ChannelFlushProc(
const Tcl_ChannelType *chanTypePtr)
/* Pointer to channel type. */
{
#ifndef TCL_NO_DEPRECATED
if (Tcl_ChannelVersion(chanTypePtr) < TCL_CHANNEL_VERSION_2) {
return NULL;
}
#endif
return chanTypePtr->flushProc;
}
@@ -10804,9 +10862,11 @@ Tcl_ChannelHandlerProc(
const Tcl_ChannelType *chanTypePtr)
/* Pointer to channel type. */
{
#ifndef TCL_NO_DEPRECATED
if (Tcl_ChannelVersion(chanTypePtr) < TCL_CHANNEL_VERSION_2) {
return NULL;
}
#endif
return chanTypePtr->handlerProc;
}
@@ -10831,9 +10891,11 @@ Tcl_ChannelWideSeekProc(
const Tcl_ChannelType *chanTypePtr)
/* Pointer to channel type. */
{
#ifndef TCL_NO_DEPRECATED
if (Tcl_ChannelVersion(chanTypePtr) < TCL_CHANNEL_VERSION_3) {
return NULL;
}
#endif
return chanTypePtr->wideSeekProc;
}
@@ -10859,9 +10921,11 @@ Tcl_ChannelThreadActionProc(
const Tcl_ChannelType *chanTypePtr)
/* Pointer to channel type. */
{
#ifndef TCL_NO_DEPRECATED
if (Tcl_ChannelVersion(chanTypePtr) < TCL_CHANNEL_VERSION_4) {
return NULL;
}
#endif
return chanTypePtr->threadActionProc;
}
+28 -66
View File
@@ -36,18 +36,14 @@ static Tcl_ThreadDataKey dataKey;
* Static functions for this file:
*/
static void FinalizeIOCmdTSD(ClientData clientData);
static Tcl_TcpAcceptProc AcceptCallbackProc;
static int ChanPendingObjCmd(ClientData unused,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
static int ChanTruncateObjCmd(ClientData dummy,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
static void RegisterTcpServerInterpCleanup(Tcl_Interp *interp,
AcceptCallback *acceptCallbackPtr);
static void TcpAcceptCallbacksDeleteProc(ClientData clientData,
Tcl_Interp *interp);
static Tcl_ExitProc FinalizeIOCmdTSD;
static Tcl_TcpAcceptProc AcceptCallbackProc;
static Tcl_ObjCmdProc ChanPendingObjCmd;
static Tcl_ObjCmdProc ChanTruncateObjCmd;
static void RegisterTcpServerInterpCleanup(
Tcl_Interp *interp,
AcceptCallback *acceptCallbackPtr);
static Tcl_InterpDeleteProc TcpAcceptCallbacksDeleteProc;
static void TcpServerCloseProc(ClientData callbackData);
static void UnregisterTcpServerInterpCleanupProc(
Tcl_Interp *interp,
@@ -71,10 +67,9 @@ static void UnregisterTcpServerInterpCleanupProc(
static void
FinalizeIOCmdTSD(
ClientData dummy) /* Not used. */
TCL_UNUSED(ClientData))
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
(void)dummy;
if (tsdPtr->stdoutObjPtr != NULL) {
Tcl_DecrRefCount(tsdPtr->stdoutObjPtr);
@@ -100,10 +95,9 @@ FinalizeIOCmdTSD(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_PutsObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -114,7 +108,6 @@ Tcl_PutsObjCmd(
int newline; /* Add a newline at end? */
int result; /* Result of puts operation. */
int mode; /* Mode in which channel is opened. */
(void)dummy;
switch (objc) {
case 2: /* [puts $x] */
@@ -228,10 +221,9 @@ Tcl_PutsObjCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_FlushObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -239,7 +231,6 @@ Tcl_FlushObjCmd(
Tcl_Obj *chanObjPtr;
Tcl_Channel chan; /* The channel to flush on. */
int mode;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "channelId");
@@ -294,10 +285,9 @@ Tcl_FlushObjCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_GetsObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -307,7 +297,6 @@ Tcl_GetsObjCmd(
int mode; /* Mode in which channel is opened. */
Tcl_Obj *linePtr, *chanObjPtr;
int code = TCL_OK;
(void)dummy;
if ((objc != 2) && (objc != 3)) {
Tcl_WrongNumArgs(interp, 1, objv, "channelId ?varName?");
@@ -380,10 +369,9 @@ Tcl_GetsObjCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_ReadObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -394,7 +382,6 @@ Tcl_ReadObjCmd(
int charactersRead; /* How many characters were read? */
int mode; /* Mode in which channel is opened. */
Tcl_Obj *resultPtr, *chanObjPtr;
(void)dummy;
if ((objc != 2) && (objc != 3)) {
Interp *iPtr;
@@ -525,10 +512,9 @@ Tcl_ReadObjCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_SeekObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -542,7 +528,6 @@ Tcl_SeekObjCmd(
"start", "current", "end", NULL
};
static const int modeArray[] = {SEEK_SET, SEEK_CUR, SEEK_END};
(void)dummy;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 1, objv, "channelId offset ?origin?");
@@ -602,10 +587,9 @@ Tcl_SeekObjCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_TellObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -613,7 +597,6 @@ Tcl_TellObjCmd(
Tcl_Channel chan; /* The channel to tell on. */
Tcl_WideInt newLoc;
int code;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "channelId");
@@ -666,10 +649,9 @@ Tcl_TellObjCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_CloseObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -679,7 +661,6 @@ Tcl_CloseObjCmd(
"read", "write", NULL
};
static const int dirArray[] = {TCL_CLOSE_READ, TCL_CLOSE_WRITE};
(void)dummy;
if ((objc != 2) && (objc != 3)) {
Tcl_WrongNumArgs(interp, 1, objv, "channelId ?direction?");
@@ -776,10 +757,9 @@ Tcl_CloseObjCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_FconfigureObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -787,7 +767,6 @@ Tcl_FconfigureObjCmd(
const char *optionName, *valueName;
Tcl_Channel chan; /* The channel to set a mode on. */
int i; /* Iterate over arg-value pairs. */
(void)dummy;
if ((objc < 2) || (((objc % 2) == 1) && (objc != 3))) {
Tcl_WrongNumArgs(interp, 1, objv, "channelId ?-option value ...?");
@@ -853,16 +832,14 @@ Tcl_FconfigureObjCmd(
*---------------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_EofObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tcl_Channel chan;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "channelId");
@@ -894,10 +871,9 @@ Tcl_EofObjCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_ExecObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -915,7 +891,6 @@ Tcl_ExecObjCmd(
enum options {
EXEC_IGNORESTDERR, EXEC_KEEPNEWLINE, EXEC_LAST
};
(void)dummy;
/*
* Check for any leading option arguments.
@@ -1063,17 +1038,15 @@ Tcl_ExecObjCmd(
*---------------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_FblockedObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tcl_Channel chan;
int mode;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "channelId");
@@ -1111,10 +1084,9 @@ Tcl_FblockedObjCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_OpenObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1122,7 +1094,6 @@ Tcl_OpenObjCmd(
int pipeline, prot;
const char *modeString, *what;
Tcl_Channel chan;
(void)dummy;
if ((objc < 2) || (objc > 4)) {
Tcl_WrongNumArgs(interp, 1, objv, "fileName ?access? ?permissions?");
@@ -1236,17 +1207,15 @@ Tcl_OpenObjCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static void
TcpAcceptCallbacksDeleteProc(
ClientData clientData, /* Data which was passed when the assocdata
* was registered. */
Tcl_Interp *dummy) /* Interpreter being deleted - not used. */
TCL_UNUSED(Tcl_Interp *))
{
Tcl_HashTable *hTblPtr = (Tcl_HashTable *)clientData;
Tcl_HashEntry *hPtr;
Tcl_HashSearch hSearch;
(void)dummy;
for (hPtr = Tcl_FirstHashEntry(hTblPtr, &hSearch);
hPtr != NULL; hPtr = Tcl_NextHashEntry(&hSearch)) {
@@ -1492,7 +1461,7 @@ TcpServerCloseProc(
int
Tcl_SocketObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1511,7 +1480,6 @@ Tcl_SocketObjCmd(
const char *host, *port, *myaddr = NULL;
Tcl_Obj *script = NULL;
Tcl_Channel chan;
(void)dummy;
if (TclpHasSockets(interp) != TCL_OK) {
return TCL_ERROR;
@@ -1735,7 +1703,7 @@ Tcl_SocketObjCmd(
int
Tcl_FcopyObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1746,7 +1714,6 @@ Tcl_FcopyObjCmd(
Tcl_Obj *cmdPtr;
static const char *const switches[] = { "-size", "-command", NULL };
enum { FcopySize, FcopyCommand };
(void)dummy;
if ((objc < 3) || (objc > 7) || (objc == 4) || (objc == 6)) {
Tcl_WrongNumArgs(interp, 1, objv,
@@ -1829,10 +1796,9 @@ Tcl_FcopyObjCmd(
*---------------------------------------------------------------------------
*/
/* ARGSUSED */
static int
ChanPendingObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1841,7 +1807,6 @@ ChanPendingObjCmd(
int index, mode;
static const char *const options[] = {"input", "output", NULL};
enum options {PENDING_INPUT, PENDING_OUTPUT};
(void)dummy;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 1, objv, "mode channelId");
@@ -1895,14 +1860,13 @@ ChanPendingObjCmd(
static int
ChanTruncateObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tcl_Channel chan;
Tcl_WideInt length;
(void)dummy;
if ((objc < 2) || (objc > 3)) {
Tcl_WrongNumArgs(interp, 1, objv, "channelId ?length?");
@@ -1969,7 +1933,7 @@ ChanTruncateObjCmd(
static int
ChanPipeObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1977,7 +1941,6 @@ ChanPipeObjCmd(
Tcl_Channel rchan, wchan;
const char *channelNames[2];
Tcl_Obj *resultPtr;
(void)dummy;
if (objc != 1) {
Tcl_WrongNumArgs(interp, 1, objv, "");
@@ -2021,12 +1984,11 @@ ChanPipeObjCmd(
int
TclChannelNamesCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
(void)dummy;
if (objc < 1 || objc > 2) {
Tcl_WrongNumArgs(interp, 1, objv, "?pattern?");
return TCL_ERROR;
+45 -23
View File
@@ -22,13 +22,15 @@
static int TransformBlockModeProc(ClientData instanceData,
int mode);
static int TransformCloseProc(ClientData instanceData,
Tcl_Interp *interp);
Tcl_Interp *interp, int flags);
static int TransformInputProc(ClientData instanceData, char *buf,
int toRead, int *errorCodePtr);
static int TransformOutputProc(ClientData instanceData,
const char *buf, int toWrite, int *errorCodePtr);
#ifndef TCL_NO_DEPRECATED
static int TransformSeekProc(ClientData instanceData, long offset,
int mode, int *errorCodePtr);
#endif
static int TransformSetOptionProc(ClientData instanceData,
Tcl_Interp *interp, const char *optionName,
const char *value);
@@ -119,15 +121,19 @@ static inline void ResultAdd(ResultBuffer *r, unsigned char *buf,
static const Tcl_ChannelType transformChannelType = {
"transform", /* Type name. */
TCL_CHANNEL_VERSION_5, /* v5 channel */
TransformCloseProc, /* Close proc. */
TCL_CLOSE2PROC, /* Close proc. */
TransformInputProc, /* Input proc. */
TransformOutputProc, /* Output proc. */
#ifndef TCL_NO_DEPRECATED
TransformSeekProc, /* Seek proc. */
#else
NULL, /* Seek proc. */
#endif
TransformSetOptionProc, /* Set option proc. */
TransformGetOptionProc, /* Get option proc. */
TransformWatchProc, /* Initialize notifier. */
TransformGetFileHandleProc, /* Get OS handles out of channel. */
NULL, /* close2proc */
TransformCloseProc, /* close2proc */
TransformBlockModeProc, /* Set blocking/nonblocking mode.*/
NULL, /* Flush proc. */
TransformNotifyProc, /* Handling of events bubbling up. */
@@ -251,7 +257,6 @@ ReleaseData(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
TclChannelTransform(
Tcl_Interp *interp, /* Interpreter for result. */
@@ -533,10 +538,15 @@ TransformBlockModeProc(
static int
TransformCloseProc(
ClientData instanceData,
Tcl_Interp *interp)
Tcl_Interp *interp,
int flags)
{
TransformChannelData *dataPtr = (TransformChannelData *)instanceData;
if ((flags & (TCL_CLOSE_READ | TCL_CLOSE_WRITE)) != 0) {
return EINVAL;
}
/*
* Important: In this procedure 'dataPtr->self' already points to the
* underlying channel.
@@ -828,6 +838,7 @@ TransformOutputProc(
*----------------------------------------------------------------------
*/
#ifndef TCL_NO_DEPRECATED
static int
TransformSeekProc(
ClientData instanceData, /* The channel to manipulate. */
@@ -874,6 +885,7 @@ TransformSeekProc(
return parentSeekProc(Tcl_GetChannelInstanceData(parent), offset, mode,
errorCodePtr);
}
#endif
/*
*----------------------------------------------------------------------
@@ -905,7 +917,9 @@ TransformWideSeekProc(
TransformChannelData *dataPtr = (TransformChannelData *)instanceData;
Tcl_Channel parent = Tcl_GetStackedChannel(dataPtr->self);
const Tcl_ChannelType *parentType = Tcl_GetChannelType(parent);
#ifndef TCL_NO_DEPRECATED
Tcl_DriverSeekProc *parentSeekProc = Tcl_ChannelSeekProc(parentType);
#endif
Tcl_DriverWideSeekProc *parentWideSeekProc =
Tcl_ChannelWideSeekProc(parentType);
ClientData parentData = Tcl_GetChannelInstanceData(parent);
@@ -918,9 +932,14 @@ TransformWideSeekProc(
if (parentWideSeekProc != NULL) {
return parentWideSeekProc(parentData, offset, mode, errorCodePtr);
#ifndef TCL_NO_DEPRECATED
} else if (parentSeekProc) {
return parentSeekProc(parentData, 0, mode, errorCodePtr);
#endif
} else {
*errorCodePtr = EINVAL;
return -1;
}
return parentSeekProc(parentData, 0, mode, errorCodePtr);
}
/*
@@ -948,25 +967,29 @@ TransformWideSeekProc(
* If we have a wide seek capability, we should stick with that.
*/
if (parentWideSeekProc != NULL) {
return parentWideSeekProc(parentData, offset, mode, errorCodePtr);
}
if (parentWideSeekProc == NULL) {
/*
* We're transferring to narrow seeks at this point; this is a bit complex
* because we have to check whether the seek is possible first (i.e.
* whether we are losing information in truncating the bits of the
* offset). Luckily, there's a defined error for what happens when trying
* to go out of the representable range.
*/
/*
* We're transferring to narrow seeks at this point; this is a bit complex
* because we have to check whether the seek is possible first (i.e.
* whether we are losing information in truncating the bits of the
* offset). Luckily, there's a defined error for what happens when trying
* to go out of the representable range.
*/
#ifndef TCL_NO_DEPRECATED
if (offset<LONG_MIN || offset>LONG_MAX) {
*errorCodePtr = EOVERFLOW;
return -1;
}
if (offset<LONG_MIN || offset>LONG_MAX) {
*errorCodePtr = EOVERFLOW;
return parentSeekProc(parentData, offset,
mode, errorCodePtr);
#else
*errorCodePtr = EINVAL;
return -1;
#endif
}
return parentSeekProc(parentData, offset,
mode, errorCodePtr);
return parentWideSeekProc(parentData, offset, mode, errorCodePtr);
}
/*
@@ -1072,7 +1095,6 @@ TransformGetOptionProc(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static void
TransformWatchProc(
ClientData instanceData, /* Channel to watch. */
+36 -28
View File
@@ -32,7 +32,7 @@
*/
static int ReflectClose(ClientData clientData,
Tcl_Interp *interp);
Tcl_Interp *interp, int flags);
static int ReflectInput(ClientData clientData, char *buf,
int toRead, int *errorCodePtr);
static int ReflectOutput(ClientData clientData, const char *buf,
@@ -46,8 +46,10 @@ static int ReflectEventDelete(Tcl_Event *ev, ClientData cd);
#endif
static Tcl_WideInt ReflectSeekWide(ClientData clientData,
Tcl_WideInt offset, int mode, int *errorCodePtr);
#ifndef TCL_NO_DEPRECATED
static int ReflectSeek(ClientData clientData, long offset,
int mode, int *errorCodePtr);
#endif
static int ReflectGetOption(ClientData clientData,
Tcl_Interp *interp, const char *optionName,
Tcl_DString *dsPtr);
@@ -65,15 +67,19 @@ static void TimerRunWrite(ClientData clientData);
static const Tcl_ChannelType tclRChannelType = {
"tclrchannel", /* Type name. */
TCL_CHANNEL_VERSION_5, /* v5 channel */
ReflectClose, /* Close channel, clean instance data */
TCL_CLOSE2PROC, /* Close channel, clean instance data */
ReflectInput, /* Handle read request */
ReflectOutput, /* Handle write request */
#ifndef TCL_NO_DEPRECATED
ReflectSeek, /* Move location of access point. NULL'able */
#else
NULL,
#endif
ReflectSetOption, /* Set options. NULL'able */
ReflectGetOption, /* Get options. NULL'able */
ReflectWatch, /* Initialize notifier */
NULL, /* Get OS handle from the channel. NULL'able */
NULL, /* No close2 support. NULL'able */
ReflectClose, /* No close2 support. NULL'able */
ReflectBlock, /* Set blocking/nonblocking. NULL'able */
NULL, /* Flush channel. Not used by core. NULL'able */
NULL, /* Handle events. NULL'able */
@@ -81,7 +87,7 @@ static const Tcl_ChannelType tclRChannelType = {
#if TCL_THREADS
ReflectThread, /* thread action, tracking owner */
#else
NULL, /* thread action */
NULL, /* thread action */
#endif
NULL /* truncate */
};
@@ -419,7 +425,7 @@ static void SrcExitProc(ClientData clientData);
static void ForwardSetObjError(ForwardParam *p, Tcl_Obj *objPtr);
static ReflectedChannelMap * GetThreadReflectedChannelMap(void);
static void DeleteThreadReflectedChannelMap(ClientData clientData);
static Tcl_ExitProc DeleteThreadReflectedChannelMap;
#endif /* TCL_THREADS */
@@ -446,8 +452,7 @@ static int InvokeTclMethod(ReflectedChannel *rcPtr,
Tcl_Obj *argTwoObj, Tcl_Obj **resultObjPtr);
static ReflectedChannelMap * GetReflectedChannelMap(Tcl_Interp *interp);
static void DeleteReflectedChannelMap(ClientData clientData,
Tcl_Interp *interp);
static Tcl_InterpDeleteProc DeleteReflectedChannelMap;
static int ErrnoReturn(ReflectedChannel *rcPtr, Tcl_Obj *resObj);
static void MarkDead(ReflectedChannel *rcPtr);
@@ -492,7 +497,7 @@ static const char *msg_dstlost = "-code 1 -level 0 -errorcode NONE -errorinfo
int
TclChanCreateObjCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -518,7 +523,6 @@ TclChanCreateObjCmd(
* this interp. */
Tcl_HashEntry *hPtr; /* Entry in the above map */
int isNew; /* Placeholder. */
(void)dummy;
/*
* Syntax: chan create MODE CMDPREFIX
@@ -697,7 +701,9 @@ TclChanCreateObjCmd(
clonePtr->blockModeProc = NULL;
}
if (!(methods & FLAG(METH_SEEK))) {
#ifndef TCL_NO_DEPRECATED
clonePtr->seekProc = NULL;
#endif
clonePtr->wideSeekProc = NULL;
}
@@ -772,7 +778,7 @@ typedef struct {
static int
ReflectEventRun(
Tcl_Event *ev,
int flags)
TCL_UNUSED(int) /*flags*/)
{
/* OWNER thread
*
@@ -782,7 +788,6 @@ ReflectEventRun(
*/
ReflectEvent *e = (ReflectEvent *) ev;
(void)flags;
Tcl_NotifyChannel(e->rcPtr->chan, e->events);
return 1;
@@ -811,7 +816,7 @@ ReflectEventDelete(
int
TclChanPostEventObjCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -840,7 +845,6 @@ TclChanPostEventObjCmd(
ReflectedChannelMap *rcmPtr;/* Map of reflected channels with handlers in
* this interp. */
Tcl_HashEntry *hPtr; /* Entry in the above map */
(void)dummy;
/*
* Number of arguments...
@@ -1153,7 +1157,8 @@ TclChanCaughtErrorBypass(
static int
ReflectClose(
ClientData clientData,
Tcl_Interp *interp)
Tcl_Interp *interp,
int flags)
{
ReflectedChannel *rcPtr = (ReflectedChannel *)clientData;
int result; /* Result code for 'close' */
@@ -1163,6 +1168,10 @@ ReflectClose(
Tcl_HashEntry *hPtr; /* Entry in the above map */
const Tcl_ChannelType *tctPtr;
if ((flags & (TCL_CLOSE_READ | TCL_CLOSE_WRITE)) != 0) {
return EINVAL;
}
if (TclInThreadExit()) {
/*
* This call comes from TclFinalizeIOSystem. There are no
@@ -1334,8 +1343,8 @@ ReflectInput(
if (p.base.code != TCL_OK) {
if (p.base.code < 0) {
/*
* No error message, this is an errno signal.
*/
* No error message, this is an errno signal.
*/
*errorCodePtr = -p.base.code;
} else {
@@ -1440,8 +1449,8 @@ ReflectOutput(
if (p.base.code != TCL_OK) {
if (p.base.code < 0) {
/*
* No error message, this is an errno signal.
*/
* No error message, this is an errno signal.
*/
*errorCodePtr = -p.base.code;
} else {
@@ -1617,6 +1626,7 @@ ReflectSeekWide(
goto stop;
}
#ifndef TCL_NO_DEPRECATED
static int
ReflectSeek(
ClientData clientData,
@@ -1634,6 +1644,7 @@ ReflectSeek(
return ReflectSeekWide(clientData, offset, seekMode,
errorCodePtr);
}
#endif
/*
*----------------------------------------------------------------------
@@ -2504,8 +2515,7 @@ GetReflectedChannelMap(
if (rcmPtr == NULL) {
rcmPtr = (ReflectedChannelMap *)ckalloc(sizeof(ReflectedChannelMap));
Tcl_InitHashTable(&rcmPtr->map, TCL_STRING_KEYS);
Tcl_SetAssocData(interp, RCMKEY,
(Tcl_InterpDeleteProc *) DeleteReflectedChannelMap, rcmPtr);
Tcl_SetAssocData(interp, RCMKEY, DeleteReflectedChannelMap, rcmPtr);
}
return rcmPtr;
}
@@ -2630,8 +2640,8 @@ DeleteReflectedChannelMap(
evPtr = resultPtr->evPtr;
/*
* Basic crash safety until this routine can get revised [3411310]
*/
* Basic crash safety until this routine can get revised [3411310]
*/
if (evPtr == NULL) {
continue;
@@ -2731,14 +2741,13 @@ GetThreadReflectedChannelMap(void)
static void
DeleteThreadReflectedChannelMap(
ClientData dummy) /* The per-thread data structure. */
TCL_UNUSED(ClientData))
{
Tcl_HashSearch hSearch; /* Search variable. */
Tcl_HashEntry *hPtr; /* Search variable. */
Tcl_ThreadId self = Tcl_GetCurrentThread();
ReflectedChannelMap *rcmPtr; /* The map */
ForwardingResult *resultPtr;
(void)dummy;
/*
* The origin thread for one or more reflected channels is gone.
@@ -2781,8 +2790,8 @@ DeleteThreadReflectedChannelMap(
evPtr = resultPtr->evPtr;
/*
* Basic crash safety until this routine can get revised [3411310]
*/
* Basic crash safety until this routine can get revised [3411310]
*/
if (evPtr == NULL ) {
continue;
@@ -2956,7 +2965,7 @@ ForwardOpToHandlerThread(
static int
ForwardProc(
Tcl_Event *evGPtr,
int mask)
TCL_UNUSED(int) /* mask */)
{
/*
* HANDLER thread.
@@ -2985,7 +2994,6 @@ ForwardProc(
ReflectedChannelMap *rcmPtr;/* Map of reflected channels with handlers in
* this interp. */
Tcl_HashEntry *hPtr; /* Entry in the above map */
(void)mask;
/*
* Ignore the event if no one is waiting for its result anymore.
+37 -34
View File
@@ -32,7 +32,7 @@
*/
static int ReflectClose(ClientData clientData,
Tcl_Interp *interp);
Tcl_Interp *interp, int flags);
static int ReflectInput(ClientData clientData, char *buf,
int toRead, int *errorCodePtr);
static int ReflectOutput(ClientData clientData, const char *buf,
@@ -41,8 +41,10 @@ static void ReflectWatch(ClientData clientData, int mask);
static int ReflectBlock(ClientData clientData, int mode);
static Tcl_WideInt ReflectSeekWide(ClientData clientData,
Tcl_WideInt offset, int mode, int *errorCodePtr);
#ifndef TCL_NO_DEPRECATED
static int ReflectSeek(ClientData clientData, long offset,
int mode, int *errorCodePtr);
#endif
static int ReflectGetOption(ClientData clientData,
Tcl_Interp *interp, const char *optionName,
Tcl_DString *dsPtr);
@@ -60,15 +62,19 @@ static int ReflectNotify(ClientData clientData, int mask);
static const Tcl_ChannelType tclRTransformType = {
"tclrtransform", /* Type name. */
TCL_CHANNEL_VERSION_5, /* v5 channel. */
ReflectClose, /* Close channel, clean instance data. */
TCL_CLOSE2PROC, /* Close channel, clean instance data. */
ReflectInput, /* Handle read request. */
ReflectOutput, /* Handle write request. */
#ifndef TCL_NO_DEPRECATED
ReflectSeek, /* Move location of access point. */
#else
NULL, /* Move location of access point. */
#endif
ReflectSetOption, /* Set options. */
ReflectGetOption, /* Get options. */
ReflectWatch, /* Initialize notifier. */
ReflectHandle, /* Get OS handle from the channel. */
NULL, /* No close2 support. NULL'able. */
ReflectClose, /* No close2 support. NULL'able. */
ReflectBlock, /* Set blocking/nonblocking. */
NULL, /* Flush channel. Not used by core.
* NULL'able. */
@@ -497,7 +503,7 @@ static int TransformLimit(ReflectedTransform *rtPtr,
int
TclChanPushObjCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -524,7 +530,6 @@ TclChanPushObjCmd(
* in this interp. */
Tcl_HashEntry *hPtr; /* Entry in the above map */
int isNew; /* Placeholder. */
(void)dummy;
/*
* Syntax: chan push CHANNEL CMDPREFIX
@@ -743,7 +748,7 @@ TclChanPushObjCmd(
int
TclChanPopObjCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -761,7 +766,6 @@ TclChanPopObjCmd(
const char *chanId; /* Tcl level channel handle */
Tcl_Channel chan; /* Channel associated to the handle */
int mode; /* Channel r/w mode */
(void)dummy;
/*
* Number of arguments...
@@ -881,7 +885,8 @@ UnmarshallErrorResult(
static int
ReflectClose(
ClientData clientData,
Tcl_Interp *interp)
Tcl_Interp *interp,
int flags)
{
ReflectedTransform *rtPtr = (ReflectedTransform *)clientData;
int errorCode, errorCodeSet = 0;
@@ -892,6 +897,10 @@ ReflectClose(
* in this interp. */
Tcl_HashEntry *hPtr; /* Entry in the above map */
if ((flags & (TCL_CLOSE_READ | TCL_CLOSE_WRITE)) != 0) {
return EINVAL;
}
if (TclInThreadExit()) {
/*
* This call comes from TclFinalizeIOSystem. There are no
@@ -1329,18 +1338,6 @@ ReflectSeekWide(
Channel *parent = (Channel *) rtPtr->parent;
Tcl_WideInt curPos; /* Position on the device. */
Tcl_DriverSeekProc *seekProc =
Tcl_ChannelSeekProc(Tcl_GetChannelType(rtPtr->parent));
/*
* Fail if the parent channel is not seekable.
*/
if (seekProc == NULL) {
Tcl_SetErrno(EINVAL);
return -1;
}
/*
* Check if we can leave out involving the Tcl level, i.e. transformation
* handler. This is true for tell requests, and transformations which
@@ -1384,16 +1381,23 @@ ReflectSeekWide(
* non-NULL...
*/
if (Tcl_ChannelWideSeekProc(parent->typePtr) != NULL) {
curPos = Tcl_ChannelWideSeekProc(parent->typePtr)(parent->instanceData, offset,
seekMode, errorCodePtr);
} else if (offset < LONG_MIN || offset > LONG_MAX) {
*errorCodePtr = EOVERFLOW;
if (Tcl_ChannelWideSeekProc(parent->typePtr) == NULL) {
#ifndef TCL_NO_DEPRECATED
if (offset < LONG_MIN || offset > LONG_MAX) {
*errorCodePtr = EOVERFLOW;
curPos = -1;
} else {
curPos = Tcl_ChannelSeekProc(parent->typePtr)(
parent->instanceData, offset, seekMode,
errorCodePtr);
}
#else
*errorCodePtr = EINVAL;
curPos = -1;
#endif
} else {
curPos = Tcl_ChannelSeekProc(parent->typePtr)(
parent->instanceData, offset, seekMode,
errorCodePtr);
curPos = Tcl_ChannelWideSeekProc(parent->typePtr)(parent->instanceData, offset,
seekMode, errorCodePtr);
}
if (curPos == -1) {
Tcl_SetErrno(*errorCodePtr);
@@ -1404,6 +1408,7 @@ ReflectSeekWide(
return curPos;
}
#ifndef TCL_NO_DEPRECATED
static int
ReflectSeek(
ClientData clientData,
@@ -1421,6 +1426,7 @@ ReflectSeek(
return ReflectSeekWide(clientData, offset, seekMode,
errorCodePtr);
}
#endif
/*
*----------------------------------------------------------------------
@@ -1747,7 +1753,7 @@ static ReflectedTransform *
NewReflectedTransform(
Tcl_Interp *interp,
Tcl_Obj *cmdpfxObj,
int mode,
TCL_UNUSED(int) /*mode*/,
Tcl_Obj *handleObj,
Tcl_Channel parentChan)
{
@@ -1755,7 +1761,6 @@ NewReflectedTransform(
int listc;
Tcl_Obj **listv;
int i;
(void)mode;
rtPtr = (ReflectedTransform *)ckalloc(sizeof(ReflectedTransform));
@@ -2303,14 +2308,13 @@ GetThreadReflectedTransformMap(void)
static void
DeleteThreadReflectedTransformMap(
ClientData dummy) /* The per-thread data structure. */
TCL_UNUSED(ClientData))
{
Tcl_HashSearch hSearch; /* Search variable. */
Tcl_HashEntry *hPtr; /* Search variable. */
Tcl_ThreadId self = Tcl_GetCurrentThread();
ReflectedTransformMap *rtmPtr; /* The map */
ForwardingResult *resultPtr;
(void)dummy;
/*
* The origin thread for one or more reflected channels is gone.
@@ -2498,7 +2502,7 @@ ForwardOpToOwnerThread(
static int
ForwardProc(
Tcl_Event *evGPtr,
int mask)
TCL_UNUSED(int) /*mask*/)
{
/*
* Notes regarding access to the referenced data.
@@ -2523,7 +2527,6 @@ ForwardProc(
/* Map of reflected channels with handlers in
* this interp. */
Tcl_HashEntry *hPtr; /* Entry in the above map */
(void)mask;
/*
* Ignore the event if no one is waiting for its result anymore.
+7 -16
View File
@@ -1228,15 +1228,12 @@ FsAddMountsToGlobResult(
void
Tcl_FSMountsChanged(
const Tcl_Filesystem *fsPtr)
{
TCL_UNUSED(const Tcl_Filesystem *) /*fsPtr*/)
/*
* fsPtr is currently unused. In the future it might invalidate files for
* a particular filesystem, or take some other more advanced action.
*/
(void)fsPtr;
{
/*
* Increment the filesystem epoch to invalidate every existing cached
* internal representation.
@@ -2314,11 +2311,9 @@ Tcl_FSUtime(
static const char *const *
NativeFileAttrStrings(
Tcl_Obj *pathPtr,
Tcl_Obj **objPtrRef)
TCL_UNUSED(Tcl_Obj *),
TCL_UNUSED(Tcl_Obj **))
{
(void)pathPtr;
(void)objPtrRef;
return tclpFileAttrStrings;
}
@@ -3020,14 +3015,11 @@ Tcl_FSLoadFile(
Tcl_LoadHandle *handlePtr, /* A place to store the token for the loaded
* object. Can be passed to
* (*unloadProcPtr)() to unload the file. */
Tcl_FSUnloadFileProc **unloadProcPtr)
/* A place to store a pointer to the function
* that unloads the object. */
TCL_UNUSED(Tcl_FSUnloadFileProc **))
{
const char *symbols[3];
void *procPtrs[2];
int res;
(void)unloadProcPtr;
symbols[0] = sym1;
symbols[1] = sym2;
@@ -4686,10 +4678,9 @@ Tcl_FSPathSeparator(
static Tcl_Obj *
NativeFilesystemSeparator(
Tcl_Obj *pathPtr)
TCL_UNUSED(Tcl_Obj *) /*pathPtr*/)
{
const char *separator = NULL; /* lint */
(void)pathPtr;
const char *separator = NULL;
switch (tclPlatform) {
case TCL_PLATFORM_UNIX:
+4 -42
View File
@@ -22,7 +22,6 @@
static int GetIndexFromObjList(Tcl_Interp *interp,
Tcl_Obj *objPtr, Tcl_Obj *tableObjPtr,
const char *msg, int flags, int *indexPtr);
static int SetIndexFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr);
static void UpdateStringOfIndex(Tcl_Obj *objPtr);
static void DupIndex(Tcl_Obj *srcPtr, Tcl_Obj *dupPtr);
static void FreeIndex(Tcl_Obj *objPtr);
@@ -48,7 +47,7 @@ static const Tcl_ObjType indexType = {
FreeIndex, /* freeIntRepProc */
DupIndex, /* dupIntRepProc */
UpdateStringOfIndex, /* updateStringProc */
SetIndexFromAny /* setFromAnyProc */
NULL /* setFromAnyProc */
};
/*
@@ -403,40 +402,6 @@ Tcl_GetIndexFromObjStruct(
return TCL_ERROR;
}
/*
*----------------------------------------------------------------------
*
* SetIndexFromAny --
*
* This function is called to convert a Tcl object to index internal
* form. However, this doesn't make sense (need to have a table of
* keywords in order to do the conversion) so the function always
* generates an error.
*
* Results:
* The return value is always TCL_ERROR, and an error message is left in
* interp's result if interp isn't NULL.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
static int
SetIndexFromAny(
Tcl_Interp *interp, /* Used for error reporting if not NULL. */
Tcl_Obj *objPtr) /* The object to convert. */
{
(void)objPtr;
if (interp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"can't convert value to index except via Tcl_GetIndexFromObj API",
-1));
}
return TCL_ERROR;
}
/*
*----------------------------------------------------------------------
*
@@ -575,7 +540,7 @@ TclInitPrefixCmd(
static int
PrefixMatchObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -591,7 +556,6 @@ PrefixMatchObjCmd(
enum matchOptions {
PRFMATCH_ERROR, PRFMATCH_EXACT, PRFMATCH_MESSAGE
};
(void)dummy;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 1, objv, "?options? table string");
@@ -700,7 +664,7 @@ PrefixMatchObjCmd(
static int
PrefixAllObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -708,7 +672,6 @@ PrefixAllObjCmd(
int tableObjc, result, t, length, elemLength;
const char *string, *elemString;
Tcl_Obj **tableObjv, *resultPtr;
(void)dummy;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 1, objv, "table string");
@@ -758,7 +721,7 @@ PrefixAllObjCmd(
static int
PrefixLongestObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -766,7 +729,6 @@ PrefixLongestObjCmd(
int tableObjc, result, i, t, length, elemLength, resultLength;
const char *string, *elemString, *resultString;
Tcl_Obj **tableObjv;
(void)dummy;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 1, objv, "table string");
+14 -14
View File
@@ -289,7 +289,7 @@ declare 64 {
# int TclpAccess(const char *path, int mode)
#}
declare 69 {
char *TclpAlloc(unsigned int size)
void *TclpAlloc(unsigned int size)
}
#declare 70 {
# int TclpCopyFile(const char *source, const char *dest)
@@ -305,7 +305,7 @@ declare 69 {
# int TclpDeleteFile(const char *path)
#}
declare 74 {
void TclpFree(char *ptr)
void TclpFree(void *ptr)
}
declare 75 {
unsigned long TclpGetClicks(void)
@@ -330,7 +330,7 @@ declare 77 {deprecated {}} {
# char *modeString, int permissions)
#}
declare 81 {
char *TclpRealloc(char *ptr, unsigned int size)
void *TclpRealloc(void *ptr, unsigned int size)
}
#declare 82 {
# int TclpRemoveDirectory(const char *path, int recursive,
@@ -1203,10 +1203,9 @@ declare 4 unix {
const char **argv, TclFile inputFile, TclFile outputFile,
TclFile errorFile, Tcl_Pid *pidPtr)
}
# Signature changed in 8.1:
# declare 5 unix {
# TclFile TclpCreateTempFile(char *contents, Tcl_DString *namePtr)
# }
declare 5 unix {
int TclUnixWaitForFile_(int fd, int mask, int timeout)
}
declare 6 unix {
TclFile TclpMakeFile(Tcl_Channel channel, int direction)
}
@@ -1250,26 +1249,29 @@ declare 14 unix {
################################
# Mac OS X specific functions
declare 15 macosx {
declare 15 {unix macosx} {
int TclMacOSXGetFileAttribute(Tcl_Interp *interp, int objIndex,
Tcl_Obj *fileName, Tcl_Obj **attributePtrPtr)
}
declare 16 macosx {
declare 16 {unix macosx} {
int TclMacOSXSetFileAttribute(Tcl_Interp *interp, int objIndex,
Tcl_Obj *fileName, Tcl_Obj *attributePtr)
}
declare 17 macosx {
declare 17 {unix macosx} {
int TclMacOSXCopyFileAttributes(const char *src, const char *dst,
const Tcl_StatBuf *statBufPtr)
}
declare 18 macosx {
declare 18 {unix macosx} {
int TclMacOSXMatchType(Tcl_Interp *interp, const char *pathName,
const char *fileName, Tcl_StatBuf *statBufPtr,
Tcl_GlobTypeData *types)
}
declare 19 macosx {
declare 19 {unix macosx} {
void TclMacOSXNotifierAddRunLoopMode(const void *runLoopMode)
}
declare 22 {unix macosx} {
TclFile TclpCreateTempFile_(const char *contents)
}
declare 29 {win unix} {
int TclWinCPUID(int index, int *regs)
@@ -1279,8 +1281,6 @@ declare 30 {win unix} {
int TclUnixOpenTemporaryFile(Tcl_Obj *dirObj, Tcl_Obj *basenameObj,
Tcl_Obj *extensionObj, Tcl_Obj *resultingNameObj)
}
# Local Variables:
# mode: tcl
+19 -6
View File
@@ -53,7 +53,18 @@
# endif
#endif
#ifndef JOIN
# define JOIN(a,b) JOIN1(a,b)
# define JOIN1(a,b) a##b
#endif
#if defined(__cplusplus)
# define TCL_UNUSED(T) T
#elif defined(__GNUC__) && (__GNUC__ > 2)
# define TCL_UNUSED(T) T JOIN(dummy, __LINE__) __attribute__((unused))
#else
# define TCL_UNUSED(T) T JOIN(dummy, __LINE__)
#endif
/*
* Common include files needed by most of the Tcl source files are included
@@ -3015,6 +3026,8 @@ MODULE_SCOPE int TclNREvalFile(Tcl_Interp *interp, Tcl_Obj *pathPtr,
MODULE_SCOPE void TclFSUnloadTempFile(Tcl_LoadHandle loadHandle);
MODULE_SCOPE int * TclGetAsyncReadyPtr(void);
MODULE_SCOPE Tcl_Obj * TclGetBgErrorHandler(Tcl_Interp *interp);
MODULE_SCOPE unsigned char * TclGetBytesFromObj(Tcl_Interp *interp,
Tcl_Obj *objPtr, int *lengthPtr);
MODULE_SCOPE int TclGetChannelFromObj(Tcl_Interp *interp,
Tcl_Obj *objPtr, Tcl_Channel *chanPtr,
int *modePtr, int flags);
@@ -4062,9 +4075,9 @@ MODULE_SCOPE int TclCompileAssembleCmd(Tcl_Interp *interp,
MODULE_SCOPE Tcl_Obj * TclStringCat(Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[], int flags);
MODULE_SCOPE int TclStringFirst(Tcl_Obj *needle, Tcl_Obj *haystack,
MODULE_SCOPE Tcl_Obj * TclStringFirst(Tcl_Obj *needle, Tcl_Obj *haystack,
int start);
MODULE_SCOPE int TclStringLast(Tcl_Obj *needle, Tcl_Obj *haystack,
MODULE_SCOPE Tcl_Obj * TclStringLast(Tcl_Obj *needle, Tcl_Obj *haystack,
int last);
MODULE_SCOPE Tcl_Obj * TclStringRepeat(Tcl_Interp *interp, Tcl_Obj *objPtr,
int count, int flags);
@@ -4540,8 +4553,8 @@ MODULE_SCOPE const TclFileAttrProcs tclpFileAttrProcs[];
} else { \
(bignum).dp = (mp_digit *)bignumObj->internalRep.twoPtrValue.ptr1; \
(bignum).sign = bignumPayload >> 30; \
(bignum).alloc = (bignumPayload >> 15) & 0x7fff; \
(bignum).used = bignumPayload & 0x7fff; \
(bignum).alloc = (bignumPayload >> 15) & 0x7FFF; \
(bignum).used = bignumPayload & 0x7FFF; \
} \
} while (0)
@@ -4804,13 +4817,13 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit;
*/
#ifndef TCL_MEM_DEBUG
#define TclNewIntObj(objPtr, i) \
#define TclNewIntObj(objPtr, w) \
do { \
TclIncrObjsAllocated(); \
TclAllocObjStorage(objPtr); \
(objPtr)->refCount = 0; \
(objPtr)->bytes = NULL; \
(objPtr)->internalRep.wideValue = (Tcl_WideInt)(i); \
(objPtr)->internalRep.wideValue = (Tcl_WideInt)(w); \
(objPtr)->typePtr = &tclIntType; \
TCL_DTRACE_OBJ_CREATE(objPtr); \
} while (0)
+6 -6
View File
@@ -208,13 +208,13 @@ EXTERN int TclObjInvoke(Tcl_Interp *interp, int objc,
/* Slot 67 is reserved */
/* Slot 68 is reserved */
/* 69 */
EXTERN char * TclpAlloc(unsigned int size);
EXTERN void * TclpAlloc(unsigned int size);
/* Slot 70 is reserved */
/* Slot 71 is reserved */
/* Slot 72 is reserved */
/* Slot 73 is reserved */
/* 74 */
EXTERN void TclpFree(char *ptr);
EXTERN void TclpFree(void *ptr);
/* 75 */
EXTERN unsigned long TclpGetClicks(void);
/* 76 */
@@ -226,7 +226,7 @@ void TclpGetTime(Tcl_Time *time);
/* Slot 79 is reserved */
/* Slot 80 is reserved */
/* 81 */
EXTERN char * TclpRealloc(char *ptr, unsigned int size);
EXTERN void * TclpRealloc(void *ptr, unsigned int size);
/* Slot 82 is reserved */
/* Slot 83 is reserved */
/* Slot 84 is reserved */
@@ -734,19 +734,19 @@ typedef struct TclIntStubs {
void (*reserved66)(void);
void (*reserved67)(void);
void (*reserved68)(void);
char * (*tclpAlloc) (unsigned int size); /* 69 */
void * (*tclpAlloc) (unsigned int size); /* 69 */
void (*reserved70)(void);
void (*reserved71)(void);
void (*reserved72)(void);
void (*reserved73)(void);
void (*tclpFree) (char *ptr); /* 74 */
void (*tclpFree) (void *ptr); /* 74 */
unsigned long (*tclpGetClicks) (void); /* 75 */
unsigned long (*tclpGetSeconds) (void); /* 76 */
TCL_DEPRECATED_API("") void (*tclpGetTime) (Tcl_Time *time); /* 77 */
void (*reserved78)(void);
void (*reserved79)(void);
void (*reserved80)(void);
char * (*tclpRealloc) (char *ptr, unsigned int size); /* 81 */
void * (*tclpRealloc) (void *ptr, unsigned int size); /* 81 */
void (*reserved82)(void);
void (*reserved83)(void);
void (*reserved84)(void);
+65 -27
View File
@@ -57,7 +57,8 @@ EXTERN int TclpCreateProcess(Tcl_Interp *interp, int argc,
const char **argv, TclFile inputFile,
TclFile outputFile, TclFile errorFile,
Tcl_Pid *pidPtr);
/* Slot 5 is reserved */
/* 5 */
EXTERN int TclUnixWaitForFile_(int fd, int mask, int timeout);
/* 6 */
EXTERN TclFile TclpMakeFile(Tcl_Channel channel, int direction);
/* 7 */
@@ -78,14 +79,30 @@ EXTERN char * TclpInetNtoa(struct in_addr addr);
EXTERN int TclUnixCopyFile(const char *src, const char *dst,
const Tcl_StatBuf *statBufPtr,
int dontCopyAtts);
/* Slot 15 is reserved */
/* Slot 16 is reserved */
/* Slot 17 is reserved */
/* Slot 18 is reserved */
/* Slot 19 is reserved */
/* 15 */
EXTERN int TclMacOSXGetFileAttribute(Tcl_Interp *interp,
int objIndex, Tcl_Obj *fileName,
Tcl_Obj **attributePtrPtr);
/* 16 */
EXTERN int TclMacOSXSetFileAttribute(Tcl_Interp *interp,
int objIndex, Tcl_Obj *fileName,
Tcl_Obj *attributePtr);
/* 17 */
EXTERN int TclMacOSXCopyFileAttributes(const char *src,
const char *dst,
const Tcl_StatBuf *statBufPtr);
/* 18 */
EXTERN int TclMacOSXMatchType(Tcl_Interp *interp,
const char *pathName, const char *fileName,
Tcl_StatBuf *statBufPtr,
Tcl_GlobTypeData *types);
/* 19 */
EXTERN void TclMacOSXNotifierAddRunLoopMode(
const void *runLoopMode);
/* Slot 20 is reserved */
/* Slot 21 is reserved */
/* Slot 22 is reserved */
/* 22 */
EXTERN TclFile TclpCreateTempFile_(const char *contents);
/* Slot 23 is reserved */
/* Slot 24 is reserved */
/* Slot 25 is reserved */
@@ -191,7 +208,8 @@ EXTERN int TclpCreateProcess(Tcl_Interp *interp, int argc,
const char **argv, TclFile inputFile,
TclFile outputFile, TclFile errorFile,
Tcl_Pid *pidPtr);
/* Slot 5 is reserved */
/* 5 */
EXTERN int TclUnixWaitForFile_(int fd, int mask, int timeout);
/* 6 */
EXTERN TclFile TclpMakeFile(Tcl_Channel channel, int direction);
/* 7 */
@@ -234,7 +252,8 @@ EXTERN void TclMacOSXNotifierAddRunLoopMode(
const void *runLoopMode);
/* Slot 20 is reserved */
/* Slot 21 is reserved */
/* Slot 22 is reserved */
/* 22 */
EXTERN TclFile TclpCreateTempFile_(const char *contents);
/* Slot 23 is reserved */
/* Slot 24 is reserved */
/* Slot 25 is reserved */
@@ -259,7 +278,7 @@ typedef struct TclIntPlatStubs {
Tcl_Channel (*tclpCreateCommandChannel) (TclFile readFile, TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr); /* 2 */
int (*tclpCreatePipe) (TclFile *readPipe, TclFile *writePipe); /* 3 */
int (*tclpCreateProcess) (Tcl_Interp *interp, int argc, const char **argv, TclFile inputFile, TclFile outputFile, TclFile errorFile, Tcl_Pid *pidPtr); /* 4 */
void (*reserved5)(void);
int (*tclUnixWaitForFile_) (int fd, int mask, int timeout); /* 5 */
TclFile (*tclpMakeFile) (Tcl_Channel channel, int direction); /* 6 */
TclFile (*tclpOpenFile) (const char *fname, int mode); /* 7 */
int (*tclUnixWaitForFile) (int fd, int mask, int timeout); /* 8 */
@@ -269,14 +288,14 @@ typedef struct TclIntPlatStubs {
struct tm * (*tclpGmtime_unix) (const time_t *clock); /* 12 */
char * (*tclpInetNtoa) (struct in_addr addr); /* 13 */
int (*tclUnixCopyFile) (const char *src, const char *dst, const Tcl_StatBuf *statBufPtr, int dontCopyAtts); /* 14 */
void (*reserved15)(void);
void (*reserved16)(void);
void (*reserved17)(void);
void (*reserved18)(void);
void (*reserved19)(void);
int (*tclMacOSXGetFileAttribute) (Tcl_Interp *interp, int objIndex, Tcl_Obj *fileName, Tcl_Obj **attributePtrPtr); /* 15 */
int (*tclMacOSXSetFileAttribute) (Tcl_Interp *interp, int objIndex, Tcl_Obj *fileName, Tcl_Obj *attributePtr); /* 16 */
int (*tclMacOSXCopyFileAttributes) (const char *src, const char *dst, const Tcl_StatBuf *statBufPtr); /* 17 */
int (*tclMacOSXMatchType) (Tcl_Interp *interp, const char *pathName, const char *fileName, Tcl_StatBuf *statBufPtr, Tcl_GlobTypeData *types); /* 18 */
void (*tclMacOSXNotifierAddRunLoopMode) (const void *runLoopMode); /* 19 */
void (*reserved20)(void);
void (*reserved21)(void);
void (*reserved22)(void);
TclFile (*tclpCreateTempFile_) (const char *contents); /* 22 */
void (*reserved23)(void);
void (*reserved24)(void);
void (*reserved25)(void);
@@ -325,7 +344,7 @@ typedef struct TclIntPlatStubs {
Tcl_Channel (*tclpCreateCommandChannel) (TclFile readFile, TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr); /* 2 */
int (*tclpCreatePipe) (TclFile *readPipe, TclFile *writePipe); /* 3 */
int (*tclpCreateProcess) (Tcl_Interp *interp, int argc, const char **argv, TclFile inputFile, TclFile outputFile, TclFile errorFile, Tcl_Pid *pidPtr); /* 4 */
void (*reserved5)(void);
int (*tclUnixWaitForFile_) (int fd, int mask, int timeout); /* 5 */
TclFile (*tclpMakeFile) (Tcl_Channel channel, int direction); /* 6 */
TclFile (*tclpOpenFile) (const char *fname, int mode); /* 7 */
int (*tclUnixWaitForFile) (int fd, int mask, int timeout); /* 8 */
@@ -342,7 +361,7 @@ typedef struct TclIntPlatStubs {
void (*tclMacOSXNotifierAddRunLoopMode) (const void *runLoopMode); /* 19 */
void (*reserved20)(void);
void (*reserved21)(void);
void (*reserved22)(void);
TclFile (*tclpCreateTempFile_) (const char *contents); /* 22 */
void (*reserved23)(void);
void (*reserved24)(void);
void (*reserved25)(void);
@@ -377,7 +396,8 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr;
(tclIntPlatStubsPtr->tclpCreatePipe) /* 3 */
#define TclpCreateProcess \
(tclIntPlatStubsPtr->tclpCreateProcess) /* 4 */
/* Slot 5 is reserved */
#define TclUnixWaitForFile_ \
(tclIntPlatStubsPtr->tclUnixWaitForFile_) /* 5 */
#define TclpMakeFile \
(tclIntPlatStubsPtr->tclpMakeFile) /* 6 */
#define TclpOpenFile \
@@ -396,14 +416,20 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr;
(tclIntPlatStubsPtr->tclpInetNtoa) /* 13 */
#define TclUnixCopyFile \
(tclIntPlatStubsPtr->tclUnixCopyFile) /* 14 */
/* Slot 15 is reserved */
/* Slot 16 is reserved */
/* Slot 17 is reserved */
/* Slot 18 is reserved */
/* Slot 19 is reserved */
#define TclMacOSXGetFileAttribute \
(tclIntPlatStubsPtr->tclMacOSXGetFileAttribute) /* 15 */
#define TclMacOSXSetFileAttribute \
(tclIntPlatStubsPtr->tclMacOSXSetFileAttribute) /* 16 */
#define TclMacOSXCopyFileAttributes \
(tclIntPlatStubsPtr->tclMacOSXCopyFileAttributes) /* 17 */
#define TclMacOSXMatchType \
(tclIntPlatStubsPtr->tclMacOSXMatchType) /* 18 */
#define TclMacOSXNotifierAddRunLoopMode \
(tclIntPlatStubsPtr->tclMacOSXNotifierAddRunLoopMode) /* 19 */
/* Slot 20 is reserved */
/* Slot 21 is reserved */
/* Slot 22 is reserved */
#define TclpCreateTempFile_ \
(tclIntPlatStubsPtr->tclpCreateTempFile_) /* 22 */
/* Slot 23 is reserved */
/* Slot 24 is reserved */
/* Slot 25 is reserved */
@@ -488,7 +514,8 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr;
(tclIntPlatStubsPtr->tclpCreatePipe) /* 3 */
#define TclpCreateProcess \
(tclIntPlatStubsPtr->tclpCreateProcess) /* 4 */
/* Slot 5 is reserved */
#define TclUnixWaitForFile_ \
(tclIntPlatStubsPtr->tclUnixWaitForFile_) /* 5 */
#define TclpMakeFile \
(tclIntPlatStubsPtr->tclpMakeFile) /* 6 */
#define TclpOpenFile \
@@ -519,7 +546,8 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr;
(tclIntPlatStubsPtr->tclMacOSXNotifierAddRunLoopMode) /* 19 */
/* Slot 20 is reserved */
/* Slot 21 is reserved */
/* Slot 22 is reserved */
#define TclpCreateTempFile_ \
(tclIntPlatStubsPtr->tclpCreateTempFile_) /* 22 */
/* Slot 23 is reserved */
/* Slot 24 is reserved */
/* Slot 25 is reserved */
@@ -545,6 +573,16 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr;
#undef TclpInetNtoa
#define TclpInetNtoa inet_ntoa
#undef TclpCreateTempFile_
#undef TclUnixWaitForFile_
#ifndef MAC_OSX_TCL /* not accessable on Win32/UNIX */
#undef TclMacOSXGetFileAttribute /* 15 */
#undef TclMacOSXSetFileAttribute /* 16 */
#undef TclMacOSXCopyFileAttributes /* 17 */
#undef TclMacOSXMatchType /* 18 */
#undef TclMacOSXNotifierAddRunLoopMode /* 19 */
#endif
#if defined(_WIN32)
# undef TclWinNToHS
# undef TclWinGetServByName
+9 -17
View File
@@ -222,15 +222,12 @@ static int AliasDelete(Tcl_Interp *interp,
static int AliasDescribe(Tcl_Interp *interp,
Tcl_Interp *slaveInterp, Tcl_Obj *objPtr);
static int AliasList(Tcl_Interp *interp, Tcl_Interp *slaveInterp);
static int AliasNRCmd(ClientData dummy,
Tcl_Interp *currentInterp, int objc,
Tcl_Obj *const objv[]);
static void AliasObjCmdDeleteProc(ClientData clientData);
static Tcl_ObjCmdProc AliasNRCmd;
static Tcl_CmdDeleteProc AliasObjCmdDeleteProc;
static Tcl_Interp * GetInterp(Tcl_Interp *interp, Tcl_Obj *pathPtr);
static Tcl_Interp * GetInterp2(Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
static void InterpInfoDeleteProc(ClientData clientData,
Tcl_Interp *interp);
static Tcl_InterpDeleteProc InterpInfoDeleteProc;
static int SlaveBgerror(Tcl_Interp *interp,
Tcl_Interp *slaveInterp, int objc,
Tcl_Obj *const objv[]);
@@ -254,7 +251,7 @@ static int SlaveInvokeHidden(Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int SlaveMarkTrusted(Tcl_Interp *interp,
Tcl_Interp *slaveInterp);
static void SlaveObjCmdDeleteProc(ClientData clientData);
static Tcl_CmdDeleteProc SlaveObjCmdDeleteProc;
static int SlaveRecursionLimit(Tcl_Interp *interp,
Tcl_Interp *slaveInterp, int objc,
Tcl_Obj *const objv[]);
@@ -525,7 +522,7 @@ TclInterpInit(
static void
InterpInfoDeleteProc(
ClientData dummy, /* Ignored. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp) /* Interp being deleted. All commands for
* slave interps should already be deleted. */
{
@@ -533,7 +530,6 @@ InterpInfoDeleteProc(
Slave *slavePtr;
Master *masterPtr;
Target *targetPtr;
(void)dummy;
interpInfoPtr = (InterpInfo *) ((Interp *) interp)->interpInfo;
@@ -602,10 +598,10 @@ InterpInfoDeleteProc(
*
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_InterpObjCmd(
ClientData clientData, /* Unused. */
ClientData clientData,
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -615,7 +611,7 @@ Tcl_InterpObjCmd(
static int
NRInterpCmd(
ClientData dummy, /* Unused. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -639,7 +635,6 @@ NRInterpCmd(
OPT_INVOKEHID, OPT_LIMIT, OPT_MARKTRUSTED,OPT_RECLIMIT,
OPT_SLAVES, OPT_SHARE, OPT_TARGET, OPT_TRANSFER
};
(void)dummy;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "cmd ?arg ...?");
@@ -1479,8 +1474,6 @@ TclPreventAliasLoop(
}
nextAliasPtr = (Alias *)aliasCmdPtr->objClientData;
}
/* NOTREACHED */
}
/*
@@ -4239,11 +4232,10 @@ DeleteScriptLimitCallback(
static void
CallScriptLimitCallback(
ClientData clientData,
Tcl_Interp *dummy) /* Interpreter which failed the limit */
TCL_UNUSED(Tcl_Interp *))
{
ScriptLimitCallback *limitCBPtr = (ScriptLimitCallback *)clientData;
int code;
(void)dummy;
if (Tcl_InterpDeleted(limitCBPtr->interp)) {
return;
+8 -8
View File
@@ -628,12 +628,11 @@ IsSpecial(
static int
SetInvalidRealFromAny(
Tcl_Interp *dummy,
TCL_UNUSED(Tcl_Interp *),
Tcl_Obj *objPtr)
{
const char *str;
const char *endPtr;
(void)dummy;
str = TclGetString(objPtr);
if ((objPtr->length == 1) && (str[0] == '.')) {
@@ -746,8 +745,11 @@ static char *
LinkTraceProc(
ClientData clientData, /* Contains information about the link. */
Tcl_Interp *interp, /* Interpreter containing Tcl variable. */
const char *name1, /* First part of variable name. */
const char *name2, /* Second part of variable name. */
TCL_UNUSED(const char *) /*name1*/,
TCL_UNUSED(const char *) /*name2*/,
/* Links can only be made to global variables,
* so we can find them with need to resolve
* caller-supplied name in caller context. */
int flags) /* Miscellaneous additional information. */
{
Link *linkPtr = (Link *)clientData;
@@ -763,8 +765,6 @@ LinkTraceProc(
int objc;
Tcl_Obj **objv;
int i;
(void)name1;
(void)name2;
/*
* If the variable is being unset, then just re-create it (with a trace)
@@ -1188,7 +1188,7 @@ LinkTraceProc(
if (linkPtr->flags & LINK_ALLOC_LAST) {
for (i=0; i < objc; i++) {
if (GetUWide(objv[i], &valueUWide)
|| !InRange(0, valueUWide, ULONG_MAX)) {
|| (valueUWide > ULONG_MAX)) {
Tcl_ObjSetVar2(interp, linkPtr->varName, NULL,
ObjValue(linkPtr), TCL_GLOBAL_ONLY);
return (char *)
@@ -1198,7 +1198,7 @@ LinkTraceProc(
}
} else {
if (GetUWide(valueObj, &valueUWide)
|| !InRange(0, valueUWide, ULONG_MAX)) {
|| (valueUWide > ULONG_MAX)) {
Tcl_ObjSetVar2(interp, linkPtr->varName, NULL,
ObjValue(linkPtr), TCL_GLOBAL_ONLY);
return (char *) "variable must have unsigned long value";
+14 -19
View File
@@ -336,13 +336,9 @@ Tcl_Obj *
Tcl_DbNewListObj(
int objc, /* Count of objects referenced by objv. */
Tcl_Obj *const objv[], /* An array of pointers to Tcl objects. */
const char *file, /* The name of the source file calling this
* function; used for debugging. */
int line) /* Line number in the source file; used for
* debugging. */
TCL_UNUSED(const char *) /*file*/,
TCL_UNUSED(int) /*line*/)
{
(void)file;
(void)line;
return Tcl_NewListObj(objc, objv);
}
#endif /* TCL_MEM_DEBUG */
@@ -1608,11 +1604,10 @@ TclLsetFlat(
|| (valuePtr == NULL && index >= elemCount)) {
/* ...the index points outside the sublist. */
if (interp != NULL) {
Tcl_SetObjResult(interp,
Tcl_NewStringObj("list index out of range", -1));
Tcl_SetErrorCode(interp, "TCL", "OPERATION",
valuePtr == NULL ? "LPOP" : "LSET",
"BADINDEX", NULL);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"index \"%s\" out of range", Tcl_GetString(indexArray[-1])));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "INDEX"
"OUTOFRANGE", NULL);
}
result = TCL_ERROR;
break;
@@ -1803,10 +1798,10 @@ TclListObjSetElement(
(void) Tcl_GetStringFromObj(listPtr, &length);
if (length == 0) {
if (interp != NULL) {
Tcl_SetObjResult(interp,
Tcl_NewStringObj("list index out of range", -1));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LSET",
"BADINDEX", NULL);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"index \"%d\" out of range", index));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "INDEX",
"OUTOFRANGE", NULL);
}
return TCL_ERROR;
}
@@ -1825,10 +1820,10 @@ TclListObjSetElement(
if (index<0 || index>=elemCount) {
if (interp != NULL) {
Tcl_SetObjResult(interp,
Tcl_NewStringObj("list index out of range", -1));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LSET", "BADINDEX",
NULL);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"index \"%d\" out of range", index));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "INDEX",
"OUTOFRANGE", NULL);
}
return TCL_ERROR;
}
+3 -6
View File
@@ -115,7 +115,7 @@ static void LoadCleanupProc(ClientData clientData,
int
Tcl_LoadObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -140,7 +140,6 @@ Tcl_LoadObjCmd(
enum options {
LOAD_GLOBAL, LOAD_LAZY, LOAD_LAST
};
(void)dummy;
while (objc > 2) {
if (TclGetString(objv[1])[0] != '-') {
@@ -543,7 +542,7 @@ Tcl_LoadObjCmd(
int
Tcl_UnloadObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -563,7 +562,6 @@ Tcl_UnloadObjCmd(
enum options {
UNLOAD_NOCOMPLAIN, UNLOAD_KEEPLIB, UNLOAD_LAST
};
(void)dummy;
for (i = 1; i < objc; i++) {
if (Tcl_GetIndexFromObj(interp, objv[i], options, "option", 0,
@@ -1154,10 +1152,9 @@ static void
LoadCleanupProc(
ClientData clientData, /* Pointer to first InterpPackage structure
* for interp. */
Tcl_Interp *dummy) /* Interpreter that is being deleted. */
TCL_UNUSED(Tcl_Interp *))
{
InterpPackage *ipPtr, *nextPtr;
(void)dummy;
ipPtr = (InterpPackage *)clientData;
while (ipPtr != NULL) {
+1 -3
View File
@@ -731,18 +731,16 @@ TclFullFinalizationRequested(void)
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static void
StdinProc(
ClientData clientData, /* The state of interactive cmd line */
int mask) /* Not used. */
TCL_UNUSED(int) /*mask*/)
{
int code, length;
InteractiveState *isPtr = (InteractiveState *)clientData;
Tcl_Channel chan = isPtr->input;
Tcl_Obj *commandPtr = isPtr->commandPtr;
Tcl_Interp *interp = isPtr->interp;
(void)mask;
if (Tcl_IsShared(commandPtr)) {
Tcl_DecrRefCount(commandPtr);
+54 -110
View File
@@ -92,47 +92,27 @@ static int GetNamespaceFromObj(Tcl_Interp *interp,
Tcl_Obj *objPtr, Tcl_Namespace **nsPtrPtr);
static int InvokeImportedNRCmd(ClientData clientData,
Tcl_Interp *interp,int objc,Tcl_Obj *const objv[]);
static int NamespaceChildrenCmd(ClientData dummy,
Tcl_Interp *interp,int objc,Tcl_Obj *const objv[]);
static int NamespaceCodeCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int NamespaceCurrentCmd(ClientData dummy,
Tcl_Interp *interp,int objc,Tcl_Obj *const objv[]);
static int NamespaceDeleteCmd(ClientData dummy,Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int NamespaceEvalCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int NRNamespaceEvalCmd(ClientData dummy,
Tcl_Interp *interp,int objc,Tcl_Obj *const objv[]);
static int NamespaceExistsCmd(ClientData dummy,Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int NamespaceExportCmd(ClientData dummy,Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int NamespaceForgetCmd(ClientData dummy,Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static Tcl_ObjCmdProc NamespaceChildrenCmd;
static Tcl_ObjCmdProc NamespaceCodeCmd;
static Tcl_ObjCmdProc NamespaceCurrentCmd;
static Tcl_ObjCmdProc NamespaceDeleteCmd;
static Tcl_ObjCmdProc NamespaceEvalCmd;
static Tcl_ObjCmdProc NRNamespaceEvalCmd;
static Tcl_ObjCmdProc NamespaceExistsCmd;
static Tcl_ObjCmdProc NamespaceExportCmd;
static Tcl_ObjCmdProc NamespaceForgetCmd;
static void NamespaceFree(Namespace *nsPtr);
static int NamespaceImportCmd(ClientData dummy,Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int NamespaceInscopeCmd(ClientData dummy,
Tcl_Interp *interp,int objc,Tcl_Obj *const objv[]);
static int NRNamespaceInscopeCmd(ClientData dummy,
Tcl_Interp *interp,int objc,Tcl_Obj *const objv[]);
static int NamespaceOriginCmd(ClientData dummy,Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int NamespaceParentCmd(ClientData dummy,Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int NamespacePathCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int NamespaceQualifiersCmd(ClientData dummy,
Tcl_Interp *interp,int objc,Tcl_Obj *const objv[]);
static int NamespaceTailCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int NamespaceUpvarCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int NamespaceUnknownCmd(ClientData dummy,
Tcl_Interp *interp,int objc,Tcl_Obj *const objv[]);
static int NamespaceWhichCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static Tcl_ObjCmdProc NamespaceImportCmd;
static Tcl_ObjCmdProc NamespaceInscopeCmd;
static Tcl_ObjCmdProc NRNamespaceInscopeCmd;
static Tcl_ObjCmdProc NamespaceOriginCmd;
static Tcl_ObjCmdProc NamespaceParentCmd;
static Tcl_ObjCmdProc NamespacePathCmd;
static Tcl_ObjCmdProc NamespaceQualifiersCmd;
static Tcl_ObjCmdProc NamespaceTailCmd;
static Tcl_ObjCmdProc NamespaceUpvarCmd;
static Tcl_ObjCmdProc NamespaceUnknownCmd;
static Tcl_ObjCmdProc NamespaceWhichCmd;
static int SetNsNameFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr);
static void UnlinkNsPath(Namespace *nsPtr);
@@ -335,7 +315,6 @@ Tcl_PushCallFrame(
if (nsPtr->flags & NS_DEAD) {
Tcl_Panic("Trying to push call frame for dead namespace");
/*NOTREACHED*/
}
}
@@ -514,16 +493,12 @@ TclPopStackFrame(
static char *
EstablishErrorCodeTraces(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
const char *name1,
const char *name2,
int flags)
TCL_UNUSED(const char *) /*name1*/,
TCL_UNUSED(const char *) /*name2*/,
TCL_UNUSED(int) /*flags*/)
{
(void)dummy;
(void)name1;
(void)name2;
(void)flags;
Tcl_TraceVar2(interp, "errorCode", NULL, TCL_GLOBAL_ONLY|TCL_TRACE_READS,
ErrorCodeRead, NULL);
Tcl_TraceVar2(interp, "errorCode", NULL, TCL_GLOBAL_ONLY|TCL_TRACE_UNSETS,
@@ -550,17 +525,13 @@ EstablishErrorCodeTraces(
static char *
ErrorCodeRead(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
const char *name1,
const char *name2,
int flags)
TCL_UNUSED(const char *) /*name1*/,
TCL_UNUSED(const char *) /*name2*/,
TCL_UNUSED(int) /*flags*/)
{
Interp *iPtr = (Interp *) interp;
(void)dummy;
(void)name1;
(void)name2;
(void)flags;
if (Tcl_InterpDeleted(interp) || !(iPtr->flags & ERR_LEGACY_COPY)) {
return NULL;
@@ -596,17 +567,12 @@ ErrorCodeRead(
static char *
EstablishErrorInfoTraces(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
const char *name1,
const char *name2,
int flags)
TCL_UNUSED(const char *) /*name1*/,
TCL_UNUSED(const char *) /*name2*/,
TCL_UNUSED(int) /*flags*/)
{
(void)dummy;
(void)name1;
(void)name2;
(void)flags;
Tcl_TraceVar2(interp, "errorInfo", NULL, TCL_GLOBAL_ONLY|TCL_TRACE_READS,
ErrorInfoRead, NULL);
Tcl_TraceVar2(interp, "errorInfo", NULL, TCL_GLOBAL_ONLY|TCL_TRACE_UNSETS,
@@ -633,17 +599,13 @@ EstablishErrorInfoTraces(
static char *
ErrorInfoRead(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
const char *name1,
const char *name2,
int flags)
TCL_UNUSED(const char *) /*name1*/,
TCL_UNUSED(const char *) /*name2*/,
TCL_UNUSED(int) /*flags*/)
{
Interp *iPtr = (Interp *) interp;
(void)dummy;
(void)name1;
(void)name2;
(void)flags;
if (Tcl_InterpDeleted(interp) || !(iPtr->flags & ERR_LEGACY_COPY)) {
return NULL;
@@ -3015,7 +2977,7 @@ TclInitNamespaceCmd(
static int
NamespaceChildrenCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -3028,7 +2990,6 @@ NamespaceChildrenCmd(
Tcl_HashEntry *entryPtr;
Tcl_HashSearch search;
Tcl_Obj *listPtr, *elemPtr;
(void)dummy;
/*
* Get a pointer to the specified namespace, or the current namespace.
@@ -3145,7 +3106,7 @@ NamespaceChildrenCmd(
static int
NamespaceCodeCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -3154,7 +3115,6 @@ NamespaceCodeCmd(
Tcl_Obj *listPtr, *objPtr;
const char *arg;
int length;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "arg");
@@ -3227,13 +3187,12 @@ NamespaceCodeCmd(
static int
NamespaceCurrentCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Namespace *currNsPtr;
(void)dummy;
if (objc != 1) {
Tcl_WrongNumArgs(interp, 1, objv, NULL);
@@ -3291,7 +3250,7 @@ NamespaceCurrentCmd(
static int
NamespaceDeleteCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -3299,7 +3258,6 @@ NamespaceDeleteCmd(
Tcl_Namespace *namespacePtr;
const char *name;
int i;
(void)dummy;
if (objc < 1) {
Tcl_WrongNumArgs(interp, 1, objv, "?name name...?");
@@ -3380,7 +3338,7 @@ NamespaceEvalCmd(
static int
NRNamespaceEvalCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -3392,7 +3350,6 @@ NRNamespaceEvalCmd(
CallFrame *framePtr, **framePtrPtr;
Tcl_Obj *objPtr;
int result;
(void)dummy;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 1, objv, "name arg ?arg...?");
@@ -3513,13 +3470,12 @@ NsEval_Callback(
static int
NamespaceExistsCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tcl_Namespace *namespacePtr;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "name");
@@ -3569,13 +3525,12 @@ NamespaceExistsCmd(
static int
NamespaceExportCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
int firstArg, i;
(void)dummy;
if (objc < 1) {
Tcl_WrongNumArgs(interp, 1, objv, "?-clear? ?pattern pattern...?");
@@ -3651,14 +3606,13 @@ NamespaceExportCmd(
static int
NamespaceForgetCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
const char *pattern;
int i, result;
(void)dummy;
if (objc < 1) {
Tcl_WrongNumArgs(interp, 1, objv, "?pattern pattern...?");
@@ -3717,7 +3671,7 @@ NamespaceForgetCmd(
static int
NamespaceImportCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -3726,7 +3680,6 @@ NamespaceImportCmd(
const char *string, *pattern;
int i, result;
int firstArg;
(void)dummy;
if (objc < 1) {
Tcl_WrongNumArgs(interp, 1, objv, "?-force? ?pattern pattern...?");
@@ -3833,7 +3786,7 @@ NamespaceInscopeCmd(
static int
NRNamespaceInscopeCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -3842,7 +3795,6 @@ NRNamespaceInscopeCmd(
CallFrame *framePtr, **framePtrPtr;
int i;
Tcl_Obj *cmdObjPtr;
(void)dummy;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 1, objv, "name arg ?arg...?");
@@ -3931,14 +3883,13 @@ NRNamespaceInscopeCmd(
static int
NamespaceOriginCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tcl_Command command, origCommand;
Tcl_Obj *resultPtr;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "name");
@@ -3993,13 +3944,12 @@ NamespaceOriginCmd(
static int
NamespaceParentCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tcl_Namespace *nsPtr;
(void)dummy;
if (objc == 1) {
nsPtr = TclGetCurrentNamespace(interp);
@@ -4052,7 +4002,7 @@ NamespaceParentCmd(
static int
NamespacePathCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -4061,7 +4011,6 @@ NamespacePathCmd(
int i, nsObjc, result = TCL_ERROR;
Tcl_Obj **nsObjv;
Tcl_Namespace **namespaceList = NULL;
(void)dummy;
if (objc > 2) {
Tcl_WrongNumArgs(interp, 1, objv, "?pathList?");
@@ -4278,14 +4227,13 @@ TclInvalidateNsPath(
static int
NamespaceQualifiersCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
const char *name, *p;
int length;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "string");
@@ -4347,7 +4295,7 @@ NamespaceQualifiersCmd(
static int
NamespaceUnknownCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -4355,7 +4303,6 @@ NamespaceUnknownCmd(
Tcl_Namespace *currNsPtr;
Tcl_Obj *resultPtr;
int rc;
(void)dummy;
if (objc > 2) {
Tcl_WrongNumArgs(interp, 1, objv, "?script?");
@@ -4535,13 +4482,12 @@ Tcl_SetNamespaceUnknownHandler(
static int
NamespaceTailCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
const char *name, *p;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "string");
@@ -4594,7 +4540,7 @@ NamespaceTailCmd(
static int
NamespaceUpvarCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -4603,7 +4549,6 @@ NamespaceUpvarCmd(
Tcl_Namespace *nsPtr, *savedNsPtr;
Var *otherPtr, *arrayPtr;
const char *myName;
(void)dummy;
if (objc < 2 || (objc & 1)) {
Tcl_WrongNumArgs(interp, 1, objv, "ns ?otherVar myVar ...?");
@@ -4669,7 +4614,7 @@ NamespaceUpvarCmd(
static int
NamespaceWhichCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -4679,7 +4624,6 @@ NamespaceWhichCmd(
};
int lookupType = 0;
Tcl_Obj *resultPtr;
(void)dummy;
if (objc < 2 || objc > 3) {
badArgs:
+10 -20
View File
@@ -77,13 +77,10 @@ static inline void InitClassPath(Tcl_Interp * interp, Class *clsPtr);
static void InitClassSystemRoots(Tcl_Interp *interp,
Foundation *fPtr);
static int InitFoundation(Tcl_Interp *interp);
static void KillFoundation(ClientData clientData,
Tcl_Interp *interp);
static Tcl_InterpDeleteProc KillFoundation;
static void MyDeleted(ClientData clientData);
static void ObjectNamespaceDeleted(ClientData clientData);
static void ObjectRenamedTrace(ClientData clientData,
Tcl_Interp *interp, const char *oldName,
const char *newName, int flags);
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 SquelchCachedName(Object *oPtr);
@@ -569,13 +566,11 @@ DeletedHelpersNamespace(
static void
KillFoundation(
ClientData dummy, /* Pointer to the OO system foundation
* structure. */
Tcl_Interp *interp) /* The interpreter containing the OO system
* foundation. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp) /* The interpreter containing the OO system
* foundation. */
{
Foundation *fPtr = GetFoundation(interp);
(void)dummy;
TclDecrRefCount(fPtr->unknownMethodNameObj);
TclDecrRefCount(fPtr->constructorName);
@@ -819,15 +814,12 @@ MyClassDeleted(
static void
ObjectRenamedTrace(
ClientData clientData, /* The object being deleted. */
Tcl_Interp *interp, /* The interpreter containing the object. */
const char *oldName, /* What the object was (last) called. */
const char *newName, /* What it's getting renamed to. (unused) */
TCL_UNUSED(Tcl_Interp *),
TCL_UNUSED(const char *) /*oldName*/,
TCL_UNUSED(const char *) /*newName*/,
int flags) /* Why was the object deleted? */
{
Object *oPtr = (Object *)clientData;
(void)interp;
(void)oldName;
(void)newName;
/*
* If this is a rename and not a delete of the object, we just flush the
@@ -2765,10 +2757,9 @@ TclOOObjectCmdCore(
static int
FinalizeObjectCall(
ClientData data[],
Tcl_Interp *dummy,
TCL_UNUSED(Tcl_Interp *),
int result)
{
(void)dummy;
/*
* Dispose of the call chain, which drops the lock on the object's
* structure.
@@ -2927,11 +2918,10 @@ TclNRObjectContextInvokeNext(
static int
FinalizeNext(
ClientData data[],
Tcl_Interp *dummy,
TCL_UNUSED(Tcl_Interp *),
int result)
{
CallContext *contextPtr = (CallContext *)data[0];
(void)dummy;
/*
* Restore the call chain context index as we've finished the inner invoke
+13 -26
View File
@@ -76,7 +76,7 @@ FinalizeConstruction(
int
TclOO_Class_Constructor(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
Tcl_ObjectContext context,
int objc,
@@ -84,7 +84,6 @@ TclOO_Class_Constructor(
{
Object *oPtr = (Object *) Tcl_ObjectContextObject(context);
Tcl_Obj **invoke, *nameObj;
(void)dummy;
if (objc-1 > Tcl_ObjectContextSkippedArgs(context)) {
Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv,
@@ -175,7 +174,7 @@ DecrRefsPostClassConstructor(
int
TclOO_Class_Create(
ClientData dummy, /* Ignored. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Interpreter in which to create the object;
* also used for error reporting. */
Tcl_ObjectContext context, /* The object/call context. */
@@ -185,7 +184,6 @@ TclOO_Class_Create(
Object *oPtr = (Object *) Tcl_ObjectContextObject(context);
const char *objName;
int len;
(void)dummy;
/*
* Sanity check; should not be possible to invoke this method on a
@@ -241,7 +239,7 @@ TclOO_Class_Create(
int
TclOO_Class_CreateNs(
ClientData dummy, /* Ignored. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Interpreter in which to create the object;
* also used for error reporting. */
Tcl_ObjectContext context, /* The object/call context. */
@@ -251,7 +249,6 @@ TclOO_Class_CreateNs(
Object *oPtr = (Object *) Tcl_ObjectContextObject(context);
const char *objName, *nsName;
int len;
(void)dummy;
/*
* Sanity check; should not be possible to invoke this method on a
@@ -315,7 +312,7 @@ TclOO_Class_CreateNs(
int
TclOO_Class_New(
ClientData dummy, /* Ignored. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Interpreter in which to create the object;
* also used for error reporting. */
Tcl_ObjectContext context, /* The object/call context. */
@@ -323,7 +320,6 @@ TclOO_Class_New(
Tcl_Obj *const *objv) /* The actual arguments. */
{
Object *oPtr = (Object *) Tcl_ObjectContextObject(context);
(void)dummy;
/*
* Sanity check; should not be possible to invoke this method on a
@@ -360,7 +356,7 @@ TclOO_Class_New(
int
TclOO_Object_Destroy(
ClientData dummy, /* Ignored. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Interpreter in which to create the object;
* also used for error reporting. */
Tcl_ObjectContext context, /* The object/call context. */
@@ -369,7 +365,6 @@ TclOO_Object_Destroy(
{
Object *oPtr = (Object *) Tcl_ObjectContextObject(context);
CallContext *contextPtr;
(void)dummy;
if (objc != Tcl_ObjectContextSkippedArgs(context)) {
Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv,
@@ -422,7 +417,7 @@ AfterNRDestructor(
int
TclOO_Object_Eval(
ClientData dummy, /* Ignored. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Interpreter in which to create the object;
* also used for error reporting. */
Tcl_ObjectContext context, /* The object/call context. */
@@ -435,7 +430,6 @@ TclOO_Object_Eval(
CallFrame *framePtr, **framePtrPtr = &framePtr;
Tcl_Obj *scriptPtr;
CmdFrame *invoker;
(void)dummy;
if (objc-1 < skip) {
Tcl_WrongNumArgs(interp, skip, objv, "arg ?arg ...?");
@@ -524,7 +518,7 @@ FinalizeEval(
int
TclOO_Object_Unknown(
ClientData dummy, /* Ignored. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Interpreter in which to create the object;
* also used for error reporting. */
Tcl_ObjectContext context, /* The object/call context. */
@@ -539,7 +533,6 @@ TclOO_Object_Unknown(
int numMethodNames, i, skip = Tcl_ObjectContextSkippedArgs(context);
CallFrame *framePtr = ((Interp *) interp)->varFramePtr;
Tcl_Obj *errorMsg;
(void)dummy;
/*
* If no method name, generate an error asking for a method name. (Only by
@@ -631,7 +624,7 @@ TclOO_Object_Unknown(
int
TclOO_Object_LinkVar(
ClientData dummy, /* Ignored. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Interpreter in which to create the object;
* also used for error reporting. */
Tcl_ObjectContext context, /* The object/call context. */
@@ -642,7 +635,6 @@ TclOO_Object_LinkVar(
Tcl_Object object = Tcl_ObjectContextObject(context);
Namespace *savedNsPtr;
int i;
(void)dummy;
if (objc-Tcl_ObjectContextSkippedArgs(context) < 0) {
Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv,
@@ -734,7 +726,7 @@ TclOO_Object_LinkVar(
int
TclOO_Object_VarName(
ClientData dummy, /* Ignored. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Interpreter in which to create the object;
* also used for error reporting. */
Tcl_ObjectContext context, /* The object/call context. */
@@ -745,7 +737,6 @@ TclOO_Object_VarName(
Tcl_Obj *varNamePtr, *argPtr;
CallFrame *framePtr = ((Interp *) interp)->varFramePtr;
const char *arg;
(void)dummy;
if (Tcl_ObjectContextSkippedArgs(context)+1 != objc) {
Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv,
@@ -873,7 +864,7 @@ TclOO_Object_VarName(
int
TclOONextObjCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -881,7 +872,6 @@ TclOONextObjCmd(
Interp *iPtr = (Interp *) interp;
CallFrame *framePtr = iPtr->varFramePtr;
Tcl_ObjectContext context;
(void)dummy;
/*
* Start with sanity checks on the calling context to make sure that we
@@ -910,7 +900,7 @@ TclOONextObjCmd(
int
TclOONextToObjCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -922,7 +912,6 @@ TclOONextToObjCmd(
int i;
Tcl_Object object;
const char *methodType;
(void)dummy;
/*
* Start with sanity checks on the calling context to make sure that we
@@ -1044,7 +1033,7 @@ NextRestoreFrame(
int
TclOOSelfObjCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -1062,7 +1051,6 @@ TclOOSelfObjCmd(
CallContext *contextPtr;
Tcl_Obj *result[3];
int index;
(void)dummy;
#define CurrentlyInvoked(contextPtr) \
((contextPtr)->callPtr->chain[(contextPtr)->index])
@@ -1282,13 +1270,12 @@ TclOOSelfObjCmd(
int
TclOOCopyObjectCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
{
Tcl_Object oPtr, o2Ptr;
(void)dummy;
if (objc < 2 || objc > 4) {
Tcl_WrongNumArgs(interp, 1, objv,
+3 -6
View File
@@ -376,11 +376,10 @@ TclOOInvokeContext(
static int
SetFilterFlags(
ClientData data[],
Tcl_Interp *dummy,
TCL_UNUSED(Tcl_Interp *),
int result)
{
CallContext *contextPtr = (CallContext *)data[0];
(void)dummy;
contextPtr->oPtr->flags |= FILTER_HANDLING;
return result;
@@ -389,11 +388,10 @@ SetFilterFlags(
static int
ResetFilterFlags(
ClientData data[],
Tcl_Interp *dummy,
TCL_UNUSED(Tcl_Interp *),
int result)
{
CallContext *contextPtr = (CallContext *)data[0];
(void)dummy;
contextPtr->oPtr->flags &= ~FILTER_HANDLING;
return result;
@@ -402,12 +400,11 @@ ResetFilterFlags(
static int
FinalizeMethodRefs(
ClientData data[],
Tcl_Interp *dummy,
TCL_UNUSED(Tcl_Interp *),
int result)
{
CallContext *contextPtr = (CallContext *)data[0];
int i;
(void)dummy;
for (i = 0 ; i < contextPtr->callPtr->numChain ; i++) {
TclOODelMethodRef(contextPtr->callPtr->chain[i].mPtr);
+24 -48
View File
@@ -695,7 +695,7 @@ RenameDeleteMethod(
int
TclOOUnknownDefinition(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -705,7 +705,6 @@ TclOOUnknownDefinition(
Tcl_HashEntry *hPtr;
int soughtLen;
const char *soughtStr, *matchedStr = NULL;
(void)dummy;
if (objc < 2) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
@@ -1093,7 +1092,7 @@ MagicDefinitionInvoke(
int
TclOODefineObjCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -1101,7 +1100,6 @@ TclOODefineObjCmd(
Tcl_Namespace *nsPtr;
Object *oPtr;
int result;
(void)dummy;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 1, objv, "className arg ?arg ...?");
@@ -1170,7 +1168,7 @@ TclOODefineObjCmd(
int
TclOOObjDefObjCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -1178,7 +1176,6 @@ TclOOObjDefObjCmd(
Tcl_Namespace *nsPtr;
Object *oPtr;
int result;
(void)dummy;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 1, objv, "objectName arg ?arg ...?");
@@ -1240,7 +1237,7 @@ TclOOObjDefObjCmd(
int
TclOODefineSelfObjCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -1248,7 +1245,6 @@ TclOODefineSelfObjCmd(
Tcl_Namespace *nsPtr;
Object *oPtr;
int result, isPrivate;
(void)dummy;
oPtr = (Object *) TclOOGetDefineCmdContext(interp);
if (oPtr == NULL) {
@@ -1312,13 +1308,12 @@ TclOODefineSelfObjCmd(
int
TclOODefineObjSelfObjCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
{
Object *oPtr;
(void)dummy;
if (objc != 1) {
Tcl_WrongNumArgs(interp, 1, objv, NULL);
@@ -1420,7 +1415,7 @@ TclOODefinePrivateObjCmd(
int
TclOODefineClassObjCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -1429,7 +1424,6 @@ TclOODefineClassObjCmd(
Class *clsPtr;
Foundation *fPtr = TclOOGetFoundation(interp);
int wasClass, willBeClass;
(void)dummy;
/*
* Parse the context to get the object to operate on.
@@ -1530,7 +1524,7 @@ TclOODefineClassObjCmd(
int
TclOODefineConstructorObjCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -1539,7 +1533,6 @@ TclOODefineConstructorObjCmd(
Class *clsPtr;
Tcl_Method method;
int bodyLength;
(void)dummy;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 1, objv, "arguments body");
@@ -1600,7 +1593,7 @@ TclOODefineConstructorObjCmd(
int
TclOODefineDefnNsObjCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -1614,7 +1607,6 @@ TclOODefineDefnNsObjCmd(
Object *oPtr;
Tcl_Namespace *nsPtr;
Tcl_Obj *nsNamePtr, **storagePtr;
(void)dummy;
oPtr = (Object *) TclOOGetDefineCmdContext(interp);
if (oPtr == NULL) {
@@ -1743,7 +1735,7 @@ TclOODefineDeleteMethodObjCmd(
int
TclOODefineDestructorObjCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -1752,7 +1744,6 @@ TclOODefineDestructorObjCmd(
Class *clsPtr;
Tcl_Method method;
int bodyLength;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "body");
@@ -2323,7 +2314,7 @@ TclOODefineSlots(
static int
ClassFilterGet(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
Tcl_ObjectContext context,
int objc,
@@ -2332,7 +2323,6 @@ ClassFilterGet(
Object *oPtr = (Object *) TclOOGetDefineCmdContext(interp);
Tcl_Obj *resultObj, *filterObj;
int i;
(void)dummy;
if (Tcl_ObjectContextSkippedArgs(context) != objc) {
Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv,
@@ -2358,7 +2348,7 @@ ClassFilterGet(
static int
ClassFilterSet(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
Tcl_ObjectContext context,
int objc,
@@ -2367,7 +2357,6 @@ ClassFilterSet(
Object *oPtr = (Object *) TclOOGetDefineCmdContext(interp);
int filterc;
Tcl_Obj **filterv;
(void)dummy;
if (Tcl_ObjectContextSkippedArgs(context) + 1 != objc) {
Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv,
@@ -2405,7 +2394,7 @@ ClassFilterSet(
static int
ClassMixinGet(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
Tcl_ObjectContext context,
int objc,
@@ -2415,7 +2404,6 @@ ClassMixinGet(
Tcl_Obj *resultObj;
Class *mixinPtr;
int i;
(void)dummy;
if (Tcl_ObjectContextSkippedArgs(context) != objc) {
Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv,
@@ -2443,7 +2431,7 @@ ClassMixinGet(
static int
ClassMixinSet(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
Tcl_ObjectContext context,
int objc,
@@ -2453,7 +2441,6 @@ ClassMixinSet(
int mixinc, i;
Tcl_Obj **mixinv;
Class **mixins;
(void)dummy;
if (Tcl_ObjectContextSkippedArgs(context) + 1 != objc) {
Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv,
@@ -2513,7 +2500,7 @@ ClassMixinSet(
static int
ClassSuperGet(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
Tcl_ObjectContext context,
int objc,
@@ -2523,7 +2510,6 @@ ClassSuperGet(
Tcl_Obj *resultObj;
Class *superPtr;
int i;
(void)dummy;
if (Tcl_ObjectContextSkippedArgs(context) != objc) {
Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv,
@@ -2550,7 +2536,7 @@ ClassSuperGet(
static int
ClassSuperSet(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
Tcl_ObjectContext context,
int objc,
@@ -2560,7 +2546,6 @@ ClassSuperSet(
int superc, i, j;
Tcl_Obj **superv;
Class **superclasses, *superPtr;
(void)dummy;
if (Tcl_ObjectContextSkippedArgs(context) + 1 != objc) {
Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv,
@@ -2682,7 +2667,7 @@ ClassSuperSet(
static int
ClassVarsGet(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
Tcl_ObjectContext context,
int objc,
@@ -2691,7 +2676,6 @@ ClassVarsGet(
Object *oPtr = (Object *) TclOOGetDefineCmdContext(interp);
Tcl_Obj *resultObj;
int i;
(void)dummy;
if (Tcl_ObjectContextSkippedArgs(context) != objc) {
Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv,
@@ -2727,7 +2711,7 @@ ClassVarsGet(
static int
ClassVarsSet(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
Tcl_ObjectContext context,
int objc,
@@ -2737,7 +2721,6 @@ ClassVarsSet(
int varc;
Tcl_Obj **varv;
int i;
(void)dummy;
if (Tcl_ObjectContextSkippedArgs(context) + 1 != objc) {
Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv,
@@ -2799,7 +2782,7 @@ ClassVarsSet(
static int
ObjFilterGet(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
Tcl_ObjectContext context,
int objc,
@@ -2808,7 +2791,6 @@ ObjFilterGet(
Object *oPtr = (Object *) TclOOGetDefineCmdContext(interp);
Tcl_Obj *resultObj, *filterObj;
int i;
(void)dummy;
if (Tcl_ObjectContextSkippedArgs(context) != objc) {
Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv,
@@ -2828,7 +2810,7 @@ ObjFilterGet(
static int
ObjFilterSet(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
Tcl_ObjectContext context,
int objc,
@@ -2837,7 +2819,6 @@ ObjFilterSet(
Object *oPtr = (Object *) TclOOGetDefineCmdContext(interp);
int filterc;
Tcl_Obj **filterv;
(void)dummy;
if (Tcl_ObjectContextSkippedArgs(context) + 1 != objc) {
Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv,
@@ -2869,7 +2850,7 @@ ObjFilterSet(
static int
ObjMixinGet(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
Tcl_ObjectContext context,
int objc,
@@ -2879,7 +2860,6 @@ ObjMixinGet(
Tcl_Obj *resultObj;
Class *mixinPtr;
int i;
(void)dummy;
if (Tcl_ObjectContextSkippedArgs(context) != objc) {
Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv,
@@ -2902,7 +2882,7 @@ ObjMixinGet(
static int
ObjMixinSet(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
Tcl_ObjectContext context,
int objc,
@@ -2913,7 +2893,6 @@ ObjMixinSet(
Tcl_Obj **mixinv;
Class **mixins;
int i;
(void)dummy;
if (Tcl_ObjectContextSkippedArgs(context) + 1 != objc) {
Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv,
@@ -2957,7 +2936,7 @@ ObjMixinSet(
static int
ObjVarsGet(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
Tcl_ObjectContext context,
int objc,
@@ -2966,7 +2945,6 @@ ObjVarsGet(
Object *oPtr = (Object *) TclOOGetDefineCmdContext(interp);
Tcl_Obj *resultObj;
int i;
(void)dummy;
if (Tcl_ObjectContextSkippedArgs(context) != objc) {
Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv,
@@ -2996,7 +2974,7 @@ ObjVarsGet(
static int
ObjVarsSet(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
Tcl_ObjectContext context,
int objc,
@@ -3005,7 +2983,6 @@ ObjVarsSet(
Object *oPtr = (Object *) TclOOGetDefineCmdContext(interp);
int varc, i;
Tcl_Obj **varv;
(void)dummy;
if (Tcl_ObjectContextSkippedArgs(context) + 1 != objc) {
Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv,
@@ -3062,7 +3039,7 @@ ObjVarsSet(
static int
ResolveClass(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
Tcl_ObjectContext context,
int objc,
@@ -3071,7 +3048,6 @@ ResolveClass(
int idx = Tcl_ObjectContextSkippedArgs(context);
Object *oPtr = (Object *) TclOOGetDefineCmdContext(interp);
Class *clsPtr;
(void)dummy;
/*
* Check if were called wrongly. The definition context isn't used...
+27 -54
View File
@@ -171,13 +171,12 @@ GetClassFromObj(
static int
InfoObjectClassCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
Object *oPtr;
(void)dummy;
if (objc != 2 && objc != 3) {
Tcl_WrongNumArgs(interp, 1, objv, "objName ?className?");
@@ -229,7 +228,7 @@ InfoObjectClassCmd(
static int
InfoObjectDefnCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -239,7 +238,6 @@ InfoObjectDefnCmd(
Proc *procPtr;
CompiledLocal *localPtr;
Tcl_Obj *resultObjs[2];
(void)dummy;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 1, objv, "objName methodName");
@@ -304,7 +302,7 @@ InfoObjectDefnCmd(
static int
InfoObjectFiltersCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -312,7 +310,6 @@ InfoObjectFiltersCmd(
int i;
Tcl_Obj *filterObj, *resultObj;
Object *oPtr;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "objName");
@@ -344,7 +341,7 @@ InfoObjectFiltersCmd(
static int
InfoObjectForwardCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -352,7 +349,6 @@ InfoObjectForwardCmd(
Object *oPtr;
Tcl_HashEntry *hPtr;
Tcl_Obj *prefixObj;
(void)dummy;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 1, objv, "objName methodName");
@@ -402,7 +398,7 @@ InfoObjectForwardCmd(
static int
InfoObjectIsACmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -415,7 +411,6 @@ InfoObjectIsACmd(
};
Object *oPtr, *o2Ptr;
int idx, i, result = 0;
(void)dummy;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 1, objv, "category objName ?arg ...?");
@@ -522,7 +517,7 @@ InfoObjectIsACmd(
static int
InfoObjectMethodsCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -545,7 +540,6 @@ InfoObjectMethodsCmd(
SCOPE_PRIVATE, SCOPE_PUBLIC, SCOPE_UNEXPORTED,
SCOPE_LOCALPRIVATE
};
(void)dummy;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "objName ?-option value ...?");
@@ -643,7 +637,7 @@ InfoObjectMethodsCmd(
static int
InfoObjectMethodTypeCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -651,7 +645,6 @@ InfoObjectMethodTypeCmd(
Object *oPtr;
Tcl_HashEntry *hPtr;
Method *mPtr;
(void)dummy;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 1, objv, "objName methodName");
@@ -701,7 +694,7 @@ InfoObjectMethodTypeCmd(
static int
InfoObjectMixinsCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -710,7 +703,6 @@ InfoObjectMixinsCmd(
Object *oPtr;
Tcl_Obj *resultObj;
int i;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "objName");
@@ -745,13 +737,12 @@ InfoObjectMixinsCmd(
static int
InfoObjectIdCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
Object *oPtr;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "objName");
@@ -778,13 +769,12 @@ InfoObjectIdCmd(
static int
InfoObjectNsCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
Object *oPtr;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "objName");
@@ -812,7 +802,7 @@ InfoObjectNsCmd(
static int
InfoObjectVariablesCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -820,7 +810,6 @@ InfoObjectVariablesCmd(
Object *oPtr;
Tcl_Obj *resultObj;
int i, isPrivate = 0;
(void)dummy;
if (objc != 2 && objc != 3) {
Tcl_WrongNumArgs(interp, 1, objv, "objName ?-private?");
@@ -867,7 +856,7 @@ InfoObjectVariablesCmd(
static int
InfoObjectVarsCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -877,7 +866,6 @@ InfoObjectVarsCmd(
FOREACH_HASH_DECLS;
VarInHash *vihPtr;
Tcl_Obj *nameObj, *resultObj;
(void)dummy;
if (objc != 2 && objc != 3) {
Tcl_WrongNumArgs(interp, 1, objv, "objName ?pattern?");
@@ -929,7 +917,7 @@ InfoObjectVarsCmd(
static int
InfoClassConstrCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -938,7 +926,6 @@ InfoClassConstrCmd(
CompiledLocal *localPtr;
Tcl_Obj *resultObjs[2];
Class *clsPtr;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "className");
@@ -991,7 +978,7 @@ InfoClassConstrCmd(
static int
InfoClassDefnCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1001,7 +988,6 @@ InfoClassDefnCmd(
CompiledLocal *localPtr;
Tcl_Obj *resultObjs[2];
Class *clsPtr;
(void)dummy;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 1, objv, "className methodName");
@@ -1060,7 +1046,7 @@ InfoClassDefnCmd(
static int
InfoClassDefnNsCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1073,7 +1059,6 @@ InfoClassDefnNsCmd(
int kind = 0;
Tcl_Obj *nsNamePtr;
Class *clsPtr;
(void)dummy;
if (objc != 2 && objc != 3) {
Tcl_WrongNumArgs(interp, 1, objv, "className ?kind?");
@@ -1111,14 +1096,13 @@ InfoClassDefnNsCmd(
static int
InfoClassDestrCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
Proc *procPtr;
Class *clsPtr;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "className");
@@ -1156,7 +1140,7 @@ InfoClassDestrCmd(
static int
InfoClassFiltersCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1164,7 +1148,6 @@ InfoClassFiltersCmd(
int i;
Tcl_Obj *filterObj, *resultObj;
Class *clsPtr;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "className");
@@ -1195,7 +1178,7 @@ InfoClassFiltersCmd(
static int
InfoClassForwardCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1203,7 +1186,6 @@ InfoClassForwardCmd(
Tcl_HashEntry *hPtr;
Tcl_Obj *prefixObj;
Class *clsPtr;
(void)dummy;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 1, objv, "className methodName");
@@ -1247,7 +1229,7 @@ InfoClassForwardCmd(
static int
InfoClassInstancesCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1257,7 +1239,6 @@ InfoClassInstancesCmd(
int i;
const char *pattern = NULL;
Tcl_Obj *resultObj;
(void)dummy;
if (objc != 2 && objc != 3) {
Tcl_WrongNumArgs(interp, 1, objv, "className ?pattern?");
@@ -1296,7 +1277,7 @@ InfoClassInstancesCmd(
static int
InfoClassMethodsCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1317,7 +1298,6 @@ InfoClassMethodsCmd(
enum Scopes {
SCOPE_PRIVATE, SCOPE_PUBLIC, SCOPE_UNEXPORTED
};
(void)dummy;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "className ?-option value ...?");
@@ -1413,7 +1393,7 @@ InfoClassMethodsCmd(
static int
InfoClassMethodTypeCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1421,7 +1401,6 @@ InfoClassMethodTypeCmd(
Tcl_HashEntry *hPtr;
Method *mPtr;
Class *clsPtr;
(void)dummy;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 1, objv, "className methodName");
@@ -1466,7 +1445,7 @@ InfoClassMethodTypeCmd(
static int
InfoClassMixinsCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1474,7 +1453,6 @@ InfoClassMixinsCmd(
Class *clsPtr, *mixinPtr;
Tcl_Obj *resultObj;
int i;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "className");
@@ -1509,7 +1487,7 @@ InfoClassMixinsCmd(
static int
InfoClassSubsCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1518,7 +1496,6 @@ InfoClassSubsCmd(
Tcl_Obj *resultObj;
int i;
const char *pattern = NULL;
(void)dummy;
if (objc != 2 && objc != 3) {
Tcl_WrongNumArgs(interp, 1, objv, "className ?pattern?");
@@ -1565,7 +1542,7 @@ InfoClassSubsCmd(
static int
InfoClassSupersCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1573,7 +1550,6 @@ InfoClassSupersCmd(
Class *clsPtr, *superPtr;
Tcl_Obj *resultObj;
int i;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "className");
@@ -1605,7 +1581,7 @@ InfoClassSupersCmd(
static int
InfoClassVariablesCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1613,7 +1589,6 @@ InfoClassVariablesCmd(
Class *clsPtr;
Tcl_Obj *resultObj;
int i, isPrivate = 0;
(void)dummy;
if (objc != 2 && objc != 3) {
Tcl_WrongNumArgs(interp, 1, objv, "className ?-private?");
@@ -1660,14 +1635,13 @@ InfoClassVariablesCmd(
static int
InfoObjectCallCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
Object *oPtr;
CallContext *contextPtr;
(void)dummy;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 1, objv, "objName methodName");
@@ -1707,14 +1681,13 @@ InfoObjectCallCmd(
static int
InfoClassCallCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
Class *clsPtr;
CallChain *callPtr;
(void)dummy;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 1, objv, "className methodName");
+21 -33
View File
@@ -80,12 +80,9 @@ static void DeleteProcedureMethodRecord(ProcedureMethod *pmPtr);
static void DeleteProcedureMethod(void *clientData);
static int CloneProcedureMethod(Tcl_Interp *interp,
void *clientData, void **newClientData);
static void MethodErrorHandler(Tcl_Interp *interp,
Tcl_Obj *procNameObj);
static void ConstructorErrorHandler(Tcl_Interp *interp,
Tcl_Obj *procNameObj);
static void DestructorErrorHandler(Tcl_Interp *interp,
Tcl_Obj *procNameObj);
static ProcErrorProc MethodErrorHandler;
static ProcErrorProc ConstructorErrorHandler;
static ProcErrorProc DestructorErrorHandler;
static Tcl_Obj * RenderDeclarerName(void *clientData);
static int InvokeForwardMethod(void *clientData,
Tcl_Interp *interp, Tcl_ObjectContext context,
@@ -93,13 +90,8 @@ static int InvokeForwardMethod(void *clientData,
static void DeleteForwardMethod(void *clientData);
static int CloneForwardMethod(Tcl_Interp *interp,
void *clientData, void **newClientData);
static int ProcedureMethodVarResolver(Tcl_Interp *interp,
const char *varName, Tcl_Namespace *contextNs,
int flags, Tcl_Var *varPtr);
static int ProcedureMethodCompiledVarResolver(Tcl_Interp *interp,
const char *varName, int length,
Tcl_Namespace *contextNs,
Tcl_ResolvedVarInfo **rPtrPtr);
static Tcl_ResolveVarProc ProcedureMethodVarResolver;
static Tcl_ResolveCompiledVarProc ProcedureMethodCompiledVarResolver;
/*
* The types of methods defined by the core OO system.
@@ -135,7 +127,7 @@ static const Tcl_MethodType fwdMethodType = {
Tcl_Method
Tcl_NewInstanceMethod(
Tcl_Interp *dummy, /* Unused. */
TCL_UNUSED(Tcl_Interp *),
Tcl_Object object, /* The object that has the method attached to
* it. */
Tcl_Obj *nameObj, /* The name of the method. May be NULL; if so,
@@ -146,14 +138,13 @@ Tcl_NewInstanceMethod(
/* The type of method this is, which defines
* how to invoke, delete and clone the
* method. */
void *clientData) /* Some data associated with the particular
void *clientData) /* Some data associated with the particular
* method to be created. */
{
Object *oPtr = (Object *) object;
Method *mPtr;
Tcl_HashEntry *hPtr;
int isNew;
(void)dummy;
if (nameObj == NULL) {
mPtr = (Method *)ckalloc(sizeof(Method));
@@ -209,7 +200,7 @@ Tcl_NewInstanceMethod(
Tcl_Method
Tcl_NewMethod(
Tcl_Interp *dummy, /* The interpreter containing the class. */
TCL_UNUSED(Tcl_Interp *),
Tcl_Class cls, /* The class to attach the method to. */
Tcl_Obj *nameObj, /* The name of the object. May be NULL (e.g.,
* for constructors or destructors); if so, up
@@ -219,14 +210,13 @@ Tcl_NewMethod(
/* The type of method this is, which defines
* how to invoke, delete and clone the
* method. */
void *clientData) /* Some data associated with the particular
void *clientData) /* Some data associated with the particular
* method to be created. */
{
Class *clsPtr = (Class *) cls;
Method *mPtr;
Tcl_HashEntry *hPtr;
int isNew;
(void)dummy;
if (nameObj == NULL) {
mPtr = (Method *)ckalloc(sizeof(Method));
@@ -962,12 +952,11 @@ ProcedureMethodVarResolver(
Tcl_Interp *interp,
const char *varName,
Tcl_Namespace *contextNs,
int flags,
TCL_UNUSED(int) /*flags*/, /* Ignoring variable access flags (???) */
Tcl_Var *varPtr)
{
int result;
Tcl_ResolvedVarInfo *rPtr = NULL;
(void)flags;
result = ProcedureMethodCompiledVarResolver(interp, varName,
strlen(varName), contextNs, &rPtr);
@@ -1110,16 +1099,14 @@ ProcedureMethodCompiledVarDelete(
static int
ProcedureMethodCompiledVarResolver(
Tcl_Interp *dummy,
TCL_UNUSED(Tcl_Interp *),
const char *varName,
int length,
Tcl_Namespace *contextNs,
TCL_UNUSED(Tcl_Namespace *),
Tcl_ResolvedVarInfo **rPtrPtr)
{
OOResVarInfo *infoPtr;
Tcl_Obj *variableObj = Tcl_NewStringObj(varName, length);
(void)dummy;
(void)contextNs;
/*
* Do not create resolvers for cases that contain namespace separators or
@@ -1183,6 +1170,8 @@ RenderDeclarerName(
* ----------------------------------------------------------------------
*/
/* TODO: Check whether Tcl_AppendLimitedToObj() can work here. */
#define LIMIT 60
#define ELLIPSIFY(str,len) \
((len) > LIMIT ? LIMIT : (len)), (str), ((len) > LIMIT ? "..." : "")
@@ -1190,7 +1179,8 @@ RenderDeclarerName(
static void
MethodErrorHandler(
Tcl_Interp *interp,
Tcl_Obj *methodNameObj)
TCL_UNUSED(Tcl_Obj *) /*methodNameObj*/)
/* We pull the method name out of context instead of from argument */
{
int nameLen, objectNameLen;
CallContext *contextPtr = (CallContext *)((Interp *) interp)->varFramePtr->clientData;
@@ -1198,7 +1188,6 @@ MethodErrorHandler(
const char *objectName, *kindName, *methodName =
TclGetStringFromObj(mPtr->namePtr, &nameLen);
Object *declarerPtr;
(void)methodNameObj;
if (mPtr->declaringObjectPtr != NULL) {
declarerPtr = mPtr->declaringObjectPtr;
@@ -1222,14 +1211,14 @@ MethodErrorHandler(
static void
ConstructorErrorHandler(
Tcl_Interp *interp,
Tcl_Obj *methodNameObj)
TCL_UNUSED(Tcl_Obj *) /*methodNameObj*/)
/* Ignore. We know it is the constructor. */
{
CallContext *contextPtr = (CallContext *)((Interp *) interp)->varFramePtr->clientData;
Method *mPtr = contextPtr->callPtr->chain[contextPtr->index].mPtr;
Object *declarerPtr;
const char *objectName, *kindName;
int objectNameLen;
(void)methodNameObj;
if (mPtr->declaringObjectPtr != NULL) {
declarerPtr = mPtr->declaringObjectPtr;
@@ -1252,14 +1241,14 @@ ConstructorErrorHandler(
static void
DestructorErrorHandler(
Tcl_Interp *interp,
Tcl_Obj *methodNameObj)
TCL_UNUSED(Tcl_Obj *) /*methodNameObj*/)
/* Ignore. We know it is the destructor. */
{
CallContext *contextPtr = (CallContext *)((Interp *) interp)->varFramePtr->clientData;
Method *mPtr = contextPtr->callPtr->chain[contextPtr->index].mPtr;
Object *declarerPtr;
const char *objectName, *kindName;
int objectNameLen;
(void)methodNameObj;
if (mPtr->declaringObjectPtr != NULL) {
declarerPtr = mPtr->declaringObjectPtr;
@@ -1534,13 +1523,12 @@ DeleteForwardMethod(
static int
CloneForwardMethod(
Tcl_Interp *dummy,
TCL_UNUSED(Tcl_Interp *),
void *clientData,
void **newClientData)
{
ForwardMethod *fmPtr = (ForwardMethod *)clientData;
ForwardMethod *fm2Ptr = (ForwardMethod *)ckalloc(sizeof(ForwardMethod));
(void)dummy;
fm2Ptr->prefixObj = fmPtr->prefixObj;
Tcl_IncrRefCount(fm2Ptr->prefixObj);
+57 -67
View File
@@ -177,12 +177,12 @@ static Tcl_ThreadDataKey pendingObjDataKey;
*/
#define PACK_BIGNUM(bignum, objPtr) \
if ((bignum).used > 0x7fff) { \
if ((bignum).used > 0x7FFF) { \
mp_int *temp = (mp_int *) ckalloc(sizeof(mp_int)); \
*temp = bignum; \
(objPtr)->internalRep.twoPtrValue.ptr1 = temp; \
(objPtr)->internalRep.twoPtrValue.ptr2 = INT2PTR(-1); \
} else if (((bignum).alloc <= 0x7fff) || (mp_shrink(&(bignum))) == MP_OKAY) { \
} else if (((bignum).alloc <= 0x7FFF) || (mp_shrink(&(bignum))) == MP_OKAY) { \
(objPtr)->internalRep.twoPtrValue.ptr1 = (void *) (bignum).dp; \
(objPtr)->internalRep.twoPtrValue.ptr2 = INT2PTR( ((bignum).sign << 30) \
| ((bignum).alloc << 15) | ((bignum).used)); \
@@ -783,7 +783,7 @@ TclContinuationsGet(
static void
TclThreadFinalizeContLines(
ClientData dummy)
TCL_UNUSED(ClientData))
{
/*
* Release the hashtable tracking invisible continuation lines.
@@ -792,7 +792,6 @@ TclThreadFinalizeContLines(
ThreadSpecificData *tsdPtr = TclGetContLineTable();
Tcl_HashEntry *hPtr;
Tcl_HashSearch hSearch;
(void)dummy;
for (hPtr = Tcl_FirstHashEntry(tsdPtr->lineCLPtr, &hSearch);
hPtr != NULL; hPtr = Tcl_NextHashEntry(&hSearch)) {
@@ -993,11 +992,11 @@ Tcl_ConvertToType(
*--------------------------------------------------------------
*/
#if TCL_THREADS && defined(TCL_MEM_DEBUG)
void
TclDbDumpActiveObjects(
FILE *outFile)
{
#if TCL_THREADS && defined(TCL_MEM_DEBUG)
Tcl_HashSearch hSearch;
Tcl_HashEntry *hPtr;
Tcl_HashTable *tablePtr;
@@ -1022,10 +1021,14 @@ TclDbDumpActiveObjects(
}
}
}
#else
(void)outFile;
#endif
}
#else
void
TclDbDumpActiveObjects(
TCL_UNUSED(FILE *))
{
}
#endif
/*
*----------------------------------------------------------------------
@@ -1195,14 +1198,9 @@ Tcl_DbNewObj(
Tcl_Obj *
Tcl_DbNewObj(
const char *file, /* The name of the source file calling this
* function; used for debugging. */
int line) /* Line number in the source file; used for
* debugging. */
TCL_UNUSED(const char *) /*file*/,
TCL_UNUSED(int) /*line*/)
{
(void)file;
(void)line;
return Tcl_NewObj();
}
#endif /* TCL_MEM_DEBUG */
@@ -2036,14 +2034,9 @@ Tcl_DbNewBooleanObj(
Tcl_Obj *
Tcl_DbNewBooleanObj(
int boolValue, /* Boolean used to initialize new object. */
const char *file, /* The name of the source file calling this
* function; used for debugging. */
int line) /* Line number in the source file; used for
* debugging. */
TCL_UNUSED(const char *) /*file*/,
TCL_UNUSED(int) /*line*/)
{
(void)file;
(void)line;
return Tcl_NewBooleanObj(boolValue);
}
#endif /* TCL_MEM_DEBUG */
@@ -2426,14 +2419,9 @@ Tcl_DbNewDoubleObj(
Tcl_Obj *
Tcl_DbNewDoubleObj(
double dblValue, /* Double used to initialize the object. */
const char *file, /* The name of the source file calling this
* function; used for debugging. */
int line) /* Line number in the source file; used for
* debugging. */
TCL_UNUSED(const char *) /*file*/,
TCL_UNUSED(int) /*line*/)
{
(void)file;
(void)line;
return Tcl_NewDoubleObj(dblValue);
}
#endif /* TCL_MEM_DEBUG */
@@ -2913,14 +2901,9 @@ Tcl_Obj *
Tcl_DbNewLongObj(
long longValue, /* Long integer used to initialize the new
* object. */
const char *file, /* The name of the source file calling this
* function; used for debugging. */
int line) /* Line number in the source file; used for
* debugging. */
TCL_UNUSED(const char *) /*file*/,
TCL_UNUSED(int) /*line*/)
{
(void)file;
(void)line;
return Tcl_NewWideIntObj(longValue);
}
#endif /* TCL_MEM_DEBUG */
@@ -3182,14 +3165,9 @@ Tcl_DbNewWideIntObj(
Tcl_WideInt wideValue,
/* Long integer used to initialize the new
* object. */
const char *file, /* The name of the source file calling this
* function; used for debugging. */
int line) /* Line number in the source file; used for
* debugging. */
TCL_UNUSED(const char *) /*file*/,
TCL_UNUSED(int) /*line*/)
{
(void)file;
(void)line;
return Tcl_NewWideIntObj(wideValue);
}
#endif /* TCL_MEM_DEBUG */
@@ -3567,12 +3545,9 @@ Tcl_DbNewBignumObj(
Tcl_Obj *
Tcl_DbNewBignumObj(
void *bignumValue,
const char *file,
int line)
TCL_UNUSED(const char *) /*file*/,
TCL_UNUSED(int) /*line*/)
{
(void)file;
(void)line;
return Tcl_NewBignumObj(bignumValue);
}
#endif
@@ -3956,6 +3931,7 @@ Tcl_IsShared(
*----------------------------------------------------------------------
*/
#ifdef TCL_MEM_DEBUG
void
Tcl_DbIncrRefCount(
Tcl_Obj *objPtr, /* The object we are registering a reference
@@ -3965,7 +3941,6 @@ Tcl_DbIncrRefCount(
int line) /* Line number in the source file; used for
* debugging. */
{
#ifdef TCL_MEM_DEBUG
if (objPtr->refCount == 0x61616161) {
fprintf(stderr, "file = %s, line = %d\n", file, line);
fflush(stderr);
@@ -3994,12 +3969,19 @@ Tcl_DbIncrRefCount(
}
}
# endif /* TCL_THREADS */
#else
(void)file;
(void)line;
#endif /* TCL_MEM_DEBUG */
++(objPtr)->refCount;
}
#else /* !TCL_MEM_DEBUG */
void
Tcl_DbIncrRefCount(
Tcl_Obj *objPtr, /* The object we are registering a reference
* to. */
TCL_UNUSED(const char *) /*file*/,
TCL_UNUSED(int) /*line*/)
{
++(objPtr)->refCount;
}
#endif /* TCL_MEM_DEBUG */
/*
*----------------------------------------------------------------------
@@ -4022,6 +4004,7 @@ Tcl_DbIncrRefCount(
*----------------------------------------------------------------------
*/
#ifdef TCL_MEM_DEBUG
void
Tcl_DbDecrRefCount(
Tcl_Obj *objPtr, /* The object we are releasing a reference
@@ -4031,7 +4014,6 @@ Tcl_DbDecrRefCount(
int line) /* Line number in the source file; used for
* debugging. */
{
#ifdef TCL_MEM_DEBUG
if (objPtr->refCount == 0x61616161) {
fprintf(stderr, "file = %s, line = %d\n", file, line);
fflush(stderr);
@@ -4060,15 +4042,24 @@ Tcl_DbDecrRefCount(
}
}
# endif /* TCL_THREADS */
#else
(void)file;
(void)line;
#endif /* TCL_MEM_DEBUG */
if (objPtr->refCount-- <= 1) {
TclFreeObj(objPtr);
}
}
#else /* !TCL_MEM_DEBUG */
void
Tcl_DbDecrRefCount(
Tcl_Obj *objPtr, /* The object we are releasing a reference
* to. */
TCL_UNUSED(const char *) /*file*/,
TCL_UNUSED(int) /*line*/)
{
if (objPtr->refCount-- <= 1) {
TclFreeObj(objPtr);
}
}
#endif /* TCL_MEM_DEBUG */
/*
*----------------------------------------------------------------------
@@ -4094,10 +4085,15 @@ Tcl_DbDecrRefCount(
int
Tcl_DbIsShared(
Tcl_Obj *objPtr, /* The object to test for being shared. */
#ifdef TCL_MEM_DEBUG
const char *file, /* The name of the source file calling this
* function; used for debugging. */
int line) /* Line number in the source file; used for
* debugging. */
#else
TCL_UNUSED(const char *) /*file*/,
TCL_UNUSED(int) /*line*/)
#endif
{
#ifdef TCL_MEM_DEBUG
if (objPtr->refCount == 0x61616161) {
@@ -4128,9 +4124,6 @@ Tcl_DbIsShared(
}
}
# endif /* TCL_THREADS */
#else
(void)file;
(void)line;
#endif /* TCL_MEM_DEBUG */
#ifdef TCL_COMPILE_STATS
@@ -4194,12 +4187,11 @@ Tcl_InitObjHashTable(
static Tcl_HashEntry *
AllocObjEntry(
Tcl_HashTable *dummy, /* Hash table. */
TCL_UNUSED(Tcl_HashTable *),
void *keyPtr) /* Key to store in the hash table entry. */
{
Tcl_Obj *objPtr = (Tcl_Obj *)keyPtr;
Tcl_HashEntry *hPtr = (Tcl_HashEntry *)ckalloc(sizeof(Tcl_HashEntry));
(void)dummy;
hPtr->key.objPtr = objPtr;
Tcl_IncrRefCount(objPtr);
@@ -4316,14 +4308,13 @@ TclFreeObjEntry(
TCL_HASH_TYPE
TclHashObjKey(
Tcl_HashTable *dummy, /* Hash table. */
TCL_UNUSED(Tcl_HashTable *),
void *keyPtr) /* Key from which to compute hash value. */
{
Tcl_Obj *objPtr = (Tcl_Obj *)keyPtr;
int length;
const char *string = TclGetStringFromObj(objPtr, &length);
TCL_HASH_TYPE result = 0;
(void)dummy;
/*
* I tried a zillion different hash functions and asked many other people
@@ -4718,13 +4709,12 @@ SetCmdNameFromAny(
int
Tcl_RepresentationCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
Tcl_Obj *descObj;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "value");
-2
View File
@@ -142,8 +142,6 @@ Tcl_PanicVA(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
/*
* The following comment is here so that Coverity's static analizer knows that
* a Tcl_Panic() call can never return and avoids lots of false positives.
+1 -1
View File
@@ -734,7 +734,7 @@ TclParseHex(
while (numBytes--) {
unsigned char digit = UCHAR(*p);
if (!isxdigit(digit) || (result > 0x10fff)) {
if (!isxdigit(digit) || (result > 0x10FFF)) {
break;
}
+3 -6
View File
@@ -1385,14 +1385,13 @@ AppendPath(
Tcl_Obj *
TclFSMakePathRelative(
Tcl_Interp *dummy, /* Used for error reporting if not NULL. */
TCL_UNUSED(Tcl_Interp *),
Tcl_Obj *pathPtr, /* The path we have. */
Tcl_Obj *cwdPtr) /* Make it relative to this. */
{
int cwdLen, len;
const char *tempStr;
Tcl_ObjIntRep *irPtr = TclFetchIntRep(pathPtr, &fsPathType);
(void)dummy;
if (irPtr) {
FsPath *fsPathPtr = PATHOBJ(pathPtr);
@@ -1457,11 +1456,10 @@ TclFSMakePathRelative(
static int
MakePathFromNormalized(
Tcl_Interp *dummy, /* Not used. */
TCL_UNUSED(Tcl_Interp *),
Tcl_Obj *pathPtr) /* The object to convert. */
{
FsPath *fsPathPtr;
(void)dummy;
if (TclHasIntRep(pathPtr, &fsPathType)) {
return TCL_OK;
@@ -2512,9 +2510,8 @@ UpdateStringOfFsPath(
int
TclNativePathInFilesystem(
Tcl_Obj *pathPtr,
ClientData *dummy)
TCL_UNUSED(ClientData *))
{
(void)dummy;
/*
* A special case is required to handle the empty path "". This is a valid
* path (i.e. the user should be able to do 'file exists ""' without
+10 -23
View File
@@ -226,12 +226,11 @@ Tcl_PkgProvideEx(
static void
PkgFilesCleanupProc(
ClientData clientData,
Tcl_Interp *dummy)
TCL_UNUSED(Tcl_Interp *))
{
PkgFiles *pkgFiles = (PkgFiles *) clientData;
Tcl_HashSearch search;
Tcl_HashEntry *entry;
(void)dummy;
while (pkgFiles->names) {
PkgName *name = pkgFiles->names;
@@ -460,14 +459,13 @@ static int
PkgRequireCore(
ClientData data[],
Tcl_Interp *interp,
int result)
TCL_UNUSED(int))
{
const char *name = (const char *)data[0];
int reqc = PTR2INT(data[1]);
Tcl_Obj **reqv = (Tcl_Obj **)data[2];
int code = CheckAllRequirements(interp, reqc, reqv);
Require *reqPtr;
(void)result;
if (code != TCL_OK) {
return code;
@@ -492,7 +490,7 @@ static int
PkgRequireCoreStep1(
ClientData data[],
Tcl_Interp *interp,
int result)
TCL_UNUSED(int))
{
Tcl_DString command;
char *script;
@@ -500,7 +498,6 @@ PkgRequireCoreStep1(
int reqc = PTR2INT(data[1]);
Tcl_Obj **const reqv = (Tcl_Obj **)data[2];
const char *name = reqPtr->name /* Name of desired package. */;
(void)result;
/*
* If we've got the package in the DB already, go on to actually loading
@@ -587,7 +584,7 @@ static int
PkgRequireCoreFinal(
ClientData data[],
Tcl_Interp *interp,
int result)
TCL_UNUSED(int))
{
Require *reqPtr = (Require *)data[0];
int reqc = PTR2INT(data[1]), satisfies;
@@ -595,7 +592,6 @@ PkgRequireCoreFinal(
char *pkgVersionI;
void *clientDataPtr = reqPtr->clientDataPtr;
const char *name = reqPtr->name; /* Name of desired package. */
(void)result;
if (reqPtr->pkgPtr->version == NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
@@ -639,11 +635,9 @@ PkgRequireCoreFinal(
static int
PkgRequireCoreCleanup(
ClientData data[],
Tcl_Interp *dummy,
TCL_UNUSED(Tcl_Interp *),
int result)
{
(void)dummy;
ckfree(data[0]);
return result;
}
@@ -652,7 +646,7 @@ static int
SelectPackage(
ClientData data[],
Tcl_Interp *interp,
int result)
TCL_UNUSED(int))
{
PkgAvail *availPtr, *bestPtr, *bestStablePtr;
char *availVersion, *bestVersion, *bestStableVersion;
@@ -664,7 +658,6 @@ SelectPackage(
const char *name = reqPtr->name;
Package *pkgPtr = reqPtr->pkgPtr;
Interp *iPtr = (Interp *) interp;
(void)result;
/*
* Check whether we're already attempting to load some version of this
@@ -1059,20 +1052,17 @@ Tcl_PkgPresentEx(
*/
int
Tcl_PackageObjCmd(
ClientData dummy, /* Not used. */
ClientData clientData,
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
(void)dummy;
return Tcl_NRCallObjProc(interp, TclNRPackageObjCmd, NULL, objc, objv);
return Tcl_NRCallObjProc(interp, TclNRPackageObjCmd, clientData, objc, objv);
}
/* ARGSUSED */
int
TclNRPackageObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1098,7 +1088,6 @@ TclNRPackageObjCmd(
const char *argv2, *argv3, *argv4;
char *iva = NULL, *ivb = NULL;
Tcl_Obj *objvListPtr, **newObjvPtr;
(void)dummy;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?");
@@ -1546,11 +1535,9 @@ TclNRPackageObjCmd(
static int
TclNRPackageObjCmdCleanup(
ClientData data[],
Tcl_Interp *dummy,
TCL_UNUSED(Tcl_Interp *),
int result)
{
(void)dummy;
TclDecrRefCount((Tcl_Obj *) data[0]);
TclDecrRefCount((Tcl_Obj *) data[1]);
return result;
+5
View File
@@ -114,6 +114,11 @@ extern const TclPlatStubs *tclPlatStubsPtr;
/* !END!: Do not edit above this line. */
#ifdef MAC_OSX_TCL /* MACOSX */
#undef Tcl_MacOSXOpenBundleResources
#define Tcl_MacOSXOpenBundleResources(a,b,c,d,e) Tcl_MacOSXOpenVersionedBundleResources(a,b,NULL,c,d,e)
#endif
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLIMPORT
-1
View File
@@ -83,7 +83,6 @@ typedef struct HandleStruct {
*----------------------------------------------------------------------
*/
/* ARGSUSED */
void
TclFinalizePreserve(void)
{
+12 -21
View File
@@ -34,8 +34,7 @@ typedef struct {
static void DupLambdaInternalRep(Tcl_Obj *objPtr,
Tcl_Obj *copyPtr);
static void FreeLambdaInternalRep(Tcl_Obj *objPtr);
static int InitArgsAndLocals(Tcl_Interp *interp,
Tcl_Obj *procNameObj, int skip);
static int InitArgsAndLocals(Tcl_Interp *interp, int skip);
static void InitResolvedLocals(Tcl_Interp *interp,
ByteCode *codePtr, Var *defPtr,
Namespace *nsPtr);
@@ -149,10 +148,9 @@ static const Tcl_ObjType lambdaType = {
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_ProcObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -163,7 +161,6 @@ Tcl_ProcObjCmd(
const char *simpleName, *procArgs, *procBody;
Namespace *nsPtr, *altNsPtr, *cxtNsPtr;
Tcl_Command cmd;
(void)dummy;
if (objc != 4) {
Tcl_WrongNumArgs(interp, 1, objv, "name args body");
@@ -199,8 +196,8 @@ Tcl_ProcObjCmd(
* Create the data structure to represent the procedure.
*/
if (TclCreateProc(interp, nsPtr, simpleName, objv[2], objv[3],
&procPtr) != TCL_OK) {
if (TclCreateProc(interp, /*ignored nsPtr*/ NULL, simpleName, objv[2],
objv[3], &procPtr) != TCL_OK) {
Tcl_AddErrorInfo(interp, "\n (creating proc \"");
Tcl_AddErrorInfo(interp, simpleName);
Tcl_AddErrorInfo(interp, "\")");
@@ -398,7 +395,7 @@ Tcl_ProcObjCmd(
int
TclCreateProc(
Tcl_Interp *interp, /* Interpreter containing proc. */
Namespace *nsPtr, /* Namespace containing this proc. */
TCL_UNUSED(Namespace *) /*nsPtr*/,
const char *procName, /* Unqualified name of this proc. */
Tcl_Obj *argsPtr, /* Description of arguments. */
Tcl_Obj *bodyPtr, /* Command body. */
@@ -411,7 +408,6 @@ TclCreateProc(
CompiledLocal *localPtr = NULL;
Tcl_Obj **argArray;
int precompiled = 0;
(void)nsPtr;
ProcGetIntRep(bodyPtr, procPtr);
if (procPtr != NULL) {
@@ -887,20 +883,19 @@ Uplevel_Callback(
return result;
}
/* ARGSUSED */
int
Tcl_UplevelObjCmd(
ClientData dummy, /* Not used. */
ClientData clientData,
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
return Tcl_NRCallObjProc(interp, TclNRUplevelObjCmd, dummy, objc, objv);
return Tcl_NRCallObjProc(interp, TclNRUplevelObjCmd, clientData, objc, objv);
}
int
TclNRUplevelObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -912,7 +907,6 @@ TclNRUplevelObjCmd(
int result;
CallFrame *savedVarFramePtr, *framePtr;
Tcl_Obj *objPtr;
(void)dummy;
if (objc < 2) {
uplevelSyntax:
@@ -1374,7 +1368,6 @@ static int
InitArgsAndLocals(
Tcl_Interp *interp,/* Interpreter in which procedure was
* invoked. */
Tcl_Obj *procNameObj, /* Procedure name for error reporting. */
int skip) /* Number of initial arguments to be skipped,
* i.e., words in the "command name". */
{
@@ -1384,7 +1377,6 @@ InitArgsAndLocals(
Var *varPtr, *defPtr;
int localCt = procPtr->numCompiledLocals, numArgs, argCt, i, imax;
Tcl_Obj *const *argObjs;
(void)procNameObj;
ByteCodeGetIntRep(procPtr->bodyPtr, &tclByteCodeType, codePtr);
@@ -1698,7 +1690,7 @@ TclNRInterpProcCore(
CallFrame *freePtr;
ByteCode *codePtr;
result = InitArgsAndLocals(interp, procNameObj, skip);
result = InitArgsAndLocals(interp, skip);
if (result != TCL_OK) {
freePtr = iPtr->framePtr;
Tcl_PopCallFrame(interp); /* Pop but do not free. */
@@ -2626,17 +2618,17 @@ TclGetLambdaFromObj(
int
Tcl_ApplyObjCmd(
ClientData dummy, /* Not used. */
ClientData clientData,
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
return Tcl_NRCallObjProc(interp, TclNRApplyObjCmd, dummy, objc, objv);
return Tcl_NRCallObjProc(interp, TclNRApplyObjCmd, clientData, objc, objv);
}
int
TclNRApplyObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -2646,7 +2638,6 @@ TclNRApplyObjCmd(
int result;
Tcl_Namespace *nsPtr;
ApplyExtraData *extraPtr;
(void)dummy;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "lambdaExpr ?arg ...?");
+4 -8
View File
@@ -402,7 +402,7 @@ BuildProcessStatusObj(
static int
ProcessListObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -411,7 +411,6 @@ ProcessListObjCmd(
Tcl_HashEntry *entry;
Tcl_HashSearch search;
ProcessInfo *info;
(void)dummy;
if (objc != 1) {
Tcl_WrongNumArgs(interp, 1, objv, NULL);
@@ -454,7 +453,7 @@ ProcessListObjCmd(
static int
ProcessStatusObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -476,7 +475,6 @@ ProcessStatusObjCmd(
enum switches {
STATUS_WAIT, STATUS_LAST
};
(void)dummy;
while (objc > 1) {
if (TclGetString(objv[1])[0] != '-') {
@@ -603,7 +601,7 @@ ProcessStatusObjCmd(
static int
ProcessPurgeObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -616,7 +614,6 @@ ProcessPurgeObjCmd(
int result;
int i;
int pid;
(void)dummy;
if (objc != 1 && objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "?pids?");
@@ -704,12 +701,11 @@ ProcessPurgeObjCmd(
static int
ProcessAutopurgeObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
(void)dummy;
if (objc != 1 && objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "?flag?");
+1 -2
View File
@@ -1053,12 +1053,11 @@ FreeRegexp(
static void
FinalizeRegexp(
ClientData dummy) /* Not used. */
TCL_UNUSED(ClientData))
{
int i;
TclRegexp *regexpPtr;
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
(void)dummy;
for (i = 0; (i < NUM_REGEXPS) && (tsdPtr->patterns[i] != NULL); i++) {
regexpPtr = tsdPtr->regexps[i];
+1 -3
View File
@@ -562,10 +562,9 @@ ValidateFormat(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_ScanObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -581,7 +580,6 @@ Tcl_ScanObjCmd(
Tcl_UniChar ch = 0, sch = 0;
Tcl_Obj **objs = NULL, *objPtr = NULL;
int flags;
(void)dummy;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 1, objv,
+29 -35
View File
@@ -50,7 +50,7 @@ typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__)));
#define _FPU_GETCW(cw) __asm__ __volatile__ ("fnstcw %0" : "=m" (*&cw))
#define _FPU_SETCW(cw) __asm__ __volatile__ ("fldcw %0" : : "m" (*&cw))
# define FPU_IEEE_ROUNDING 0x027f
# define FPU_IEEE_ROUNDING 0x027F
# define ADJUST_FPU_CONTROL_WORD
#define TCL_IEEE_DOUBLE_ROUNDING \
fpu_control_t roundTo53Bits = FPU_IEEE_ROUNDING; \
@@ -99,10 +99,10 @@ typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__)));
*/
#ifdef __hppa
# define NAN_START 0x7ff4
# define NAN_START 0x7FF4
# define NAN_MASK (((Tcl_WideUInt) 1) << 50)
#else
# define NAN_START 0x7ff8
# define NAN_START 0x7FF8
# define NAN_MASK (((Tcl_WideUInt) 1) << 51)
#endif
@@ -124,23 +124,23 @@ typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__)));
#define SIGN_BIT 0x80000000
/* Mask for the sign bit in the first word of
* a double. */
#define EXP_MASK 0x7ff00000
#define EXP_MASK 0x7FF00000
/* Mask for the exponent field in the first
* word of a double. */
#define EXP_SHIFT 20 /* Shift count to make the exponent an
* integer. */
#define HIDDEN_BIT (((Tcl_WideUInt) 0x00100000) << 32)
/* Hidden 1 bit for the significand. */
#define HI_ORDER_SIG_MASK 0x000fffff
#define HI_ORDER_SIG_MASK 0x000FFFFF
/* Mask for the high-order part of the
* significand in the first word of a
* double. */
#define SIG_MASK (((Tcl_WideUInt) HI_ORDER_SIG_MASK << 32) \
| 0xffffffff)
| 0xFFFFFFFF)
/* Mask for the 52-bit significand. */
#define FP_PRECISION 53 /* Number of bits of significand plus the
* hidden bit. */
#define EXPONENT_BIAS 0x3ff /* Bias of the exponent 0. */
#define EXPONENT_BIAS 0x3FF /* Bias of the exponent 0. */
/*
* Derived quantities.
@@ -328,7 +328,7 @@ static void CastOutPowersOf2(int *, int *, int *);
static char * ShorteningInt64Conversion(Double *, Tcl_WideUInt,
int, int, int, int, int, int, int, int, int,
int, int, int *, char **);
static char * StrictInt64Conversion(Double *, Tcl_WideUInt,
static char * StrictInt64Conversion(Tcl_WideUInt,
int, int, int, int, int, int,
int, int, int *, char **);
static int ShouldBankerRoundUpPowD(mp_int *, int, int);
@@ -340,7 +340,7 @@ static char * ShorteningBignumConversionPowD(Double *dPtr,
int sd, int k, int len,
int ilim, int ilim1, int *decpt,
char **endPtr);
static char * StrictBignumConversionPowD(Double *dPtr,
static char * StrictBignumConversionPowD(
Tcl_WideUInt bw, int b2, int b5,
int sd, int k, int len,
int ilim, int ilim1, int *decpt,
@@ -354,7 +354,7 @@ static char * ShorteningBignumConversion(Double *dPtr,
int s2, int s5, int k, int len,
int ilim, int ilim1, int *decpt,
char **endPtr);
static char * StrictBignumConversion(Double *dPtr,
static char * StrictBignumConversion(
Tcl_WideUInt bw, int b2,
int s2, int s5, int k, int len,
int ilim, int ilim1, int *decpt,
@@ -2163,16 +2163,16 @@ NormalizeRightward(
int rv = 0;
Tcl_WideUInt w = *wPtr;
if (!(w & (Tcl_WideUInt) 0xffffffff)) {
if (!(w & (Tcl_WideUInt) 0xFFFFFFFF)) {
w >>= 32; rv += 32;
}
if (!(w & (Tcl_WideUInt) 0xffff)) {
if (!(w & (Tcl_WideUInt) 0xFFFF)) {
w >>= 16; rv += 16;
}
if (!(w & (Tcl_WideUInt) 0xff)) {
if (!(w & (Tcl_WideUInt) 0xFF)) {
w >>= 8; rv += 8;
}
if (!(w & (Tcl_WideUInt) 0xf)) {
if (!(w & (Tcl_WideUInt) 0xF)) {
w >>= 4; rv += 4;
}
if (!(w & 0x3)) {
@@ -2206,21 +2206,21 @@ RequiredPrecision(
int rv;
unsigned long wi;
if (w & ((Tcl_WideUInt) 0xffffffff << 32)) {
if (w & ((Tcl_WideUInt) 0xFFFFFFFF << 32)) {
wi = (unsigned long) (w >> 32); rv = 32;
} else {
wi = (unsigned long) w; rv = 0;
}
if (wi & 0xffff0000) {
if (wi & 0xFFFF0000) {
wi >>= 16; rv += 16;
}
if (wi & 0xff00) {
if (wi & 0xFF00) {
wi >>= 8; rv += 8;
}
if (wi & 0xf0) {
if (wi & 0xF0) {
wi >>= 4; rv += 4;
}
if (wi & 0xc) {
if (wi & 0xC) {
wi >>= 2; rv += 2;
}
if (wi & 0x2) {
@@ -2658,7 +2658,7 @@ AdjustRange(
* The number must be reduced to bring it into range.
*/
ds = tens[k & 0xf];
ds = tens[k & 0xF];
j = k >> 4;
if (j & BLETCH) {
j &= (BLETCH-1);
@@ -2679,7 +2679,7 @@ AdjustRange(
* The number must be increased to bring it into range.
*/
d *= tens[j1 & 0xf];
d *= tens[j1 & 0xF];
i = 0;
for (j = j1>>4; j; j>>=1) {
if (j & 1) {
@@ -3180,7 +3180,6 @@ ShorteningInt64Conversion(
static inline char *
StrictInt64Conversion(
Double *dPtr, /* Original number to convert. */
Tcl_WideUInt bw, /* Integer significand. */
int b2, int b5, /* Scale factor for the significand in the
* numerator. */
@@ -3205,7 +3204,6 @@ StrictInt64Conversion(
int digit; /* Current output digit. */
char *s = retval; /* Cursor in the output buffer. */
int i; /* Current position in the output buffer. */
(void)dPtr;
/*
* Adjust if the logarithm was guessed wrong.
@@ -3589,7 +3587,6 @@ ShorteningBignumConversionPowD(
static inline char *
StrictBignumConversionPowD(
Double *dPtr, /* Original number to convert. */
Tcl_WideUInt bw, /* Integer significand. */
int b2, int b5, /* Scale factor for the significand in the
* numerator. */
@@ -3611,7 +3608,6 @@ StrictBignumConversionPowD(
char *s = retval; /* Cursor in the output buffer. */
int i; /* Index in the output buffer. */
mp_err err;
(void)dPtr;
/*
* b = bw * 2**b2 * 5**b5
@@ -4028,7 +4024,6 @@ ShorteningBignumConversion(
static inline char *
StrictBignumConversion(
Double *dPtr, /* Original number being converted. */
Tcl_WideUInt bw, /* Integer significand and exponent. */
int b2, /* Scale factor for the significand. */
int s2, int s5, /* Scale factors for denominator. */
@@ -4049,7 +4044,6 @@ StrictBignumConversion(
int g; /* Size of the current digit ground. */
int i, j;
mp_err err;
(void)dPtr;
/*
* b = bw * 2**b2 * 5**b5
@@ -4469,7 +4463,7 @@ TclDoubleDigits(
* operations.
*/
return StrictInt64Conversion(&d, bw, b2, b5, s2, s5, k,
return StrictInt64Conversion(bw, b2, b5, s2, s5, k,
len, ilim, ilim1, decpt, endPtr);
} else if (s5 == 0) {
/*
@@ -4486,7 +4480,7 @@ TclDoubleDigits(
b2 += delta;
s2 += delta;
}
return StrictBignumConversionPowD(&d, bw, b2, b5,
return StrictBignumConversionPowD(bw, b2, b5,
s2/MP_DIGIT_BIT, k, len, ilim, ilim1, decpt, endPtr);
} else {
/*
@@ -4496,7 +4490,7 @@ TclDoubleDigits(
* fewer mp_int divisions.
*/
return StrictBignumConversion(&d, bw, b2, s2, s5, k,
return StrictBignumConversion(bw, b2, s2, s5, k,
len, ilim, ilim1, decpt, endPtr);
}
}
@@ -4629,9 +4623,9 @@ TclInitDoubleConversion(void)
#ifdef IEEE_FLOATING_POINT
bitwhack.dv = 1.000000238418579;
/* 3ff0 0000 4000 0000 */
if ((bitwhack.iv >> 32) == 0x3ff00000) {
if ((bitwhack.iv >> 32) == 0x3FF00000) {
n770_fp = 0;
} else if ((bitwhack.iv & 0xffffffff) == 0x3ff00000) {
} else if ((bitwhack.iv & 0xFFFFFFFF) == 0x3FF00000) {
n770_fp = 1;
} else {
Tcl_Panic("unknown floating point word order on this machine");
@@ -5085,7 +5079,7 @@ Pow10TimesFrExp(
* Multiply by 10**exponent.
*/
retval = frexp(retval * pow10vals[exponent & 0xf], &j);
retval = frexp(retval * pow10vals[exponent & 0xF], &j);
expt += j;
for (i=4; i<9; ++i) {
if (exponent & (1<<i)) {
@@ -5098,7 +5092,7 @@ Pow10TimesFrExp(
* Divide by 10**-exponent.
*/
retval = frexp(retval / pow10vals[(-exponent) & 0xf], &j);
retval = frexp(retval / pow10vals[(-exponent) & 0xF], &j);
expt += j;
for (i=4; i<9; ++i) {
if ((-exponent) & (1<<i)) {
@@ -5214,7 +5208,7 @@ static Tcl_WideUInt
Nokia770Twiddle(
Tcl_WideUInt w) /* Number to transpose. */
{
return (((w >> 32) & 0xffffffff) | (w << 32));
return (((w >> 32) & 0xFFFFFFFF) | (w << 32));
}
#endif
+59 -58
View File
@@ -342,14 +342,9 @@ Tcl_DbNewStringObj(
* when initializing the new object. If
* negative, use bytes up to the first NUL
* byte. */
const char *file, /* The name of the source file calling this
* function; used for debugging. */
int line) /* Line number in the source file; used for
* debugging. */
TCL_UNUSED(const char *) /*file*/,
TCL_UNUSED(int) /*line*/)
{
(void)file;
(void)line;
return Tcl_NewStringObj(bytes, length);
}
#endif /* TCL_MEM_DEBUG */
@@ -3549,13 +3544,16 @@ TclStringCmp(
*---------------------------------------------------------------------------
*/
int
Tcl_Obj *
TclStringFirst(
Tcl_Obj *needle,
Tcl_Obj *haystack,
int start)
{
int lh, ln = Tcl_GetCharLength(needle);
Tcl_Obj *result;
int value = -1;
Tcl_UniChar *check, *end, *uh, *un;
if (start < 0) {
start = 0;
@@ -3564,7 +3562,7 @@ TclStringFirst(
/* We don't find empty substrings. Bizarre!
* Whenever this routine is turned into a proper substring
* finder, change to `return start` after limits imposed. */
return -1;
goto firstEnd;
}
if (TclIsPureByteArray(needle) && TclIsPureByteArray(haystack)) {
@@ -3575,7 +3573,7 @@ TclStringFirst(
bh = Tcl_GetByteArrayFromObj(haystack, &lh);
if ((lh < ln) || (start > lh - ln)) {
/* Don't start the loop if there cannot be a valid answer */
return -1;
goto firstEnd;
}
end = bh + lh;
@@ -3589,17 +3587,18 @@ TclStringFirst(
check = (unsigned char *)memchr(check, bn[0], (end + 1 - ln) - check);
if (check == NULL) {
/* Leading byte not found -> needle cannot be found. */
return -1;
goto firstEnd;
}
/* Leading byte found, check rest of needle. */
if (0 == memcmp(check+1, bn+1, ln-1)) {
/* Checks! Return the successful index. */
return (check - bh);
value = (check - bh);
goto firstEnd;
}
/* Rest of needle match failed; Iterate to continue search. */
check++;
}
return -1;
goto firstEnd;
}
/*
@@ -3614,25 +3613,24 @@ TclStringFirst(
* do only the well-defined Tcl_UniChar array search.
*/
{
Tcl_UniChar *check, *end, *uh;
Tcl_UniChar *un = Tcl_GetUnicodeFromObj(needle, &ln);
uh = Tcl_GetUnicodeFromObj(haystack, &lh);
if ((lh < ln) || (start > lh - ln)) {
/* Don't start the loop if there cannot be a valid answer */
return -1;
}
end = uh + lh;
for (check = uh + start; check + ln <= end; check++) {
if ((*check == *un) && (0 ==
memcmp(check + 1, un + 1, (ln-1) * sizeof(Tcl_UniChar)))) {
return (check - uh);
}
}
return -1;
un = Tcl_GetUnicodeFromObj(needle, &ln);
uh = Tcl_GetUnicodeFromObj(haystack, &lh);
if ((lh < ln) || (start > lh - ln)) {
/* Don't start the loop if there cannot be a valid answer */
goto firstEnd;
}
end = uh + lh;
for (check = uh + start; check + ln <= end; check++) {
if ((*check == *un) && (0 ==
memcmp(check + 1, un + 1, (ln-1) * sizeof(Tcl_UniChar)))) {
value = (check - uh);
goto firstEnd;
}
}
firstEnd:
TclNewIntObj(result, value);
return result;
}
/*
@@ -3653,13 +3651,16 @@ TclStringFirst(
*---------------------------------------------------------------------------
*/
int
Tcl_Obj *
TclStringLast(
Tcl_Obj *needle,
Tcl_Obj *haystack,
int last)
{
int lh, ln = Tcl_GetCharLength(needle);
Tcl_Obj *result;
int value = -1;
Tcl_UniChar *check, *uh, *un;
if (ln == 0) {
/*
@@ -3668,7 +3669,7 @@ TclStringLast(
* TODO: When we one day make this a true substring
* finder, change this to "return last", after limitation.
*/
return -1;
goto lastEnd;
}
if (TclIsPureByteArray(needle) && TclIsPureByteArray(haystack)) {
@@ -3680,41 +3681,43 @@ TclStringLast(
}
if (last + 1 < ln) {
/* Don't start the loop if there cannot be a valid answer */
return -1;
goto lastEnd;
}
check = bh + last + 1 - ln;
while (check >= bh) {
if ((*check == bn[0])
&& (0 == memcmp(check+1, bn+1, ln-1))) {
return (check - bh);
value = (check - bh);
goto lastEnd;
}
check--;
}
return -1;
goto lastEnd;
}
{
Tcl_UniChar *check, *uh = Tcl_GetUnicodeFromObj(haystack, &lh);
Tcl_UniChar *un = Tcl_GetUnicodeFromObj(needle, &ln);
uh = Tcl_GetUnicodeFromObj(haystack, &lh);
un = Tcl_GetUnicodeFromObj(needle, &ln);
if (last >= lh) {
last = lh - 1;
}
if (last + 1 < ln) {
/* Don't start the loop if there cannot be a valid answer */
return -1;
}
check = uh + last + 1 - ln;
while (check >= uh) {
if ((*check == un[0])
&& (0 == memcmp(check+1, un+1, (ln-1)*sizeof(Tcl_UniChar)))) {
return (check - uh);
}
check--;
}
return -1;
if (last >= lh) {
last = lh - 1;
}
if (last + 1 < ln) {
/* Don't start the loop if there cannot be a valid answer */
goto lastEnd;
}
check = uh + last + 1 - ln;
while (check >= uh) {
if ((*check == un[0])
&& (0 == memcmp(check+1, un+1, (ln-1)*sizeof(Tcl_UniChar)))) {
value = (check - uh);
goto lastEnd;
}
check--;
}
lastEnd:
TclNewIntObj(result, value);
return result;
}
/*
@@ -4169,11 +4172,9 @@ DupStringInternalRep(
static int
SetStringFromAny(
Tcl_Interp *dummy, /* Not used. */
TCL_UNUSED(Tcl_Interp *),
Tcl_Obj *objPtr) /* The object to convert. */
{
(void)dummy;
if (!TclHasIntRep(objPtr, &tclStringType)) {
String *stringPtr = stringAlloc(0);
+45 -36
View File
@@ -71,20 +71,21 @@
#undef Tcl_UniCharToUtfDString
#undef Tcl_UtfToUniCharDString
#undef Tcl_UtfToUniChar
#undef Tcl_MacOSXOpenBundleResources
#if TCL_UTF_MAX > 3
static void uniCodePanic() {
static void uniCodePanic(void) {
Tcl_Panic("This extension uses a deprecated function, not available now: Tcl is compiled with -DTCL_UTF_MAX==%d", TCL_UTF_MAX);
}
# define Tcl_GetUnicode (int *(*)(Tcl_Obj *)) uniCodePanic
# define Tcl_GetUnicodeFromObj (int *(*)(Tcl_Obj *, Tcl_UniChar *)) uniCodePanic
# define Tcl_NewUnicodeObj (Tcl_Obj *(*)(const int *, Tcl_UniChar)) uniCodePanic
# define Tcl_SetUnicodeObj (void(*)(Tcl_Obj *, const Tcl_UniChar *, int)) uniCodePanic
# define Tcl_AppendUnicodeToObj (void(*)(Tcl_Obj *, const Tcl_UniChar *, int)) uniCodePanic
# define Tcl_UniCharNcasecmp (int(*)(const Tcl_UniChar *, const Tcl_UniChar *, unsigned long)) uniCodePanic
# define Tcl_UniCharCaseMatch (int(*)(const Tcl_UniChar *, const Tcl_UniChar *, int)) uniCodePanic
# define Tcl_UniCharLen (int(*)(const Tcl_UniChar *)) uniCodePanic
# define Tcl_UniCharNcmp (int(*)(const Tcl_UniChar *, const Tcl_UniChar *, unsigned long)) uniCodePanic
# define Tcl_GetUnicode (int *(*)(Tcl_Obj *))(void *)uniCodePanic
# define Tcl_GetUnicodeFromObj (int *(*)(Tcl_Obj *, Tcl_UniChar *))(void *)uniCodePanic
# define Tcl_NewUnicodeObj (Tcl_Obj *(*)(const int *, Tcl_UniChar))(void *)uniCodePanic
# define Tcl_SetUnicodeObj (void(*)(Tcl_Obj *, const Tcl_UniChar *, int))(void *)uniCodePanic
# define Tcl_AppendUnicodeToObj (void(*)(Tcl_Obj *, const Tcl_UniChar *, int))(void *)uniCodePanic
# define Tcl_UniCharNcasecmp (int(*)(const Tcl_UniChar *, const Tcl_UniChar *, unsigned long))(void *)uniCodePanic
# define Tcl_UniCharCaseMatch (int(*)(const Tcl_UniChar *, const Tcl_UniChar *, int))(void *)uniCodePanic
# define Tcl_UniCharLen (int(*)(const Tcl_UniChar *))(void *)uniCodePanic
# define Tcl_UniCharNcmp (int(*)(const Tcl_UniChar *, const Tcl_UniChar *, unsigned long))(void *)uniCodePanic
#endif
#define TclBN_mp_add mp_add
@@ -256,6 +257,10 @@ mp_err TclBN_mp_mul_d(const mp_int *a, unsigned int b, mp_int *c) {
# define Tcl_DbNewLongObj 0
# define Tcl_BackgroundError 0
# define Tcl_FreeResult 0
# define Tcl_ChannelSeekProc 0
# define Tcl_ChannelCloseProc 0
# define Tcl_Close 0
# define Tcl_MacOSXOpenBundleResources 0
#else
mp_err TclBN_mp_div_3(const mp_int *a, mp_int *c, unsigned int *d) {
@@ -267,9 +272,9 @@ mp_err TclBN_mp_div_3(const mp_int *a, mp_int *c, unsigned int *d) {
return result;
}
int TclBN_mp_expt_d_ex(const mp_int *a, unsigned int b, mp_int *c, int fast)
int TclBN_mp_expt_d_ex(const mp_int *a, unsigned int b, mp_int *c,
TCL_UNUSED(int) /*fast*/)
{
(void)fast;
return TclBN_mp_expt_u32(a, b, c);
}
@@ -367,6 +372,16 @@ TclWinGetPlatformId(void)
#endif
#endif /* TCL_NO_DEPRECATED */
#define TclpCreateTempFile_ TclpCreateTempFile
#define TclUnixWaitForFile_ TclUnixWaitForFile
#ifndef MAC_OSX_TCL /* On UNIX, fill with other stub entries */
#define TclMacOSXGetFileAttribute (int (*)(Tcl_Interp *, int, Tcl_Obj *, Tcl_Obj **))(void *)TclpCreateProcess
#define TclMacOSXSetFileAttribute (int (*)(Tcl_Interp *, int, Tcl_Obj *, Tcl_Obj *))(void *)isatty
#define TclMacOSXCopyFileAttributes (int (*)(const char *, const char *, const Tcl_StatBuf *))(void *)TclUnixCopyFile
#define TclMacOSXMatchType (int (*)(Tcl_Interp *, const char *, const char *, Tcl_StatBuf *, Tcl_GlobTypeData *))(void *)TclpMakeFile
#define TclMacOSXNotifierAddRunLoopMode (void (*)(const void *))TclpOpenFile
#endif
#ifdef _WIN32
# define TclUnixWaitForFile 0
# define TclUnixCopyFile 0
@@ -374,7 +389,7 @@ TclWinGetPlatformId(void)
# define TclpReaddir 0
# define TclpIsAtty 0
#elif defined(__CYGWIN__)
# define TclpIsAtty TclPlatIsAtty
# define TclpIsAtty isatty
#if defined(TCL_NO_DEPRECATED) || TCL_MAJOR_VERSION > 8
static void
doNothing(void)
@@ -385,20 +400,6 @@ doNothing(void)
# define TclWinAddProcess (void (*) (void *, unsigned int)) doNothing
# define TclWinFlushDirtyChannels doNothing
static int
TclpIsAtty(int fd)
{
return isatty(fd);
}
void *TclWinGetTclInstance()
{
void *hInstance = NULL;
GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
(const wchar_t *)&TclpIsAtty, &hInstance);
return hInstance;
}
#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
#define TclWinSetSockOpt winSetSockOpt
static int
@@ -438,6 +439,14 @@ TclWinNoBackslash(char *path)
return path;
}
void *TclWinGetTclInstance()
{
void *hInstance = NULL;
GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
(const wchar_t *)&TclWinNoBackslash, &hInstance);
return hInstance;
}
int
TclpGetPid(Tcl_Pid pid)
{
@@ -986,7 +995,7 @@ static const TclIntPlatStubs tclIntPlatStubs = {
TclpCreateCommandChannel, /* 2 */
TclpCreatePipe, /* 3 */
TclpCreateProcess, /* 4 */
0, /* 5 */
TclUnixWaitForFile_, /* 5 */
TclpMakeFile, /* 6 */
TclpOpenFile, /* 7 */
TclUnixWaitForFile, /* 8 */
@@ -996,14 +1005,14 @@ static const TclIntPlatStubs tclIntPlatStubs = {
TclpGmtime_unix, /* 12 */
TclpInetNtoa, /* 13 */
TclUnixCopyFile, /* 14 */
0, /* 15 */
0, /* 16 */
0, /* 17 */
0, /* 18 */
0, /* 19 */
TclMacOSXGetFileAttribute, /* 15 */
TclMacOSXSetFileAttribute, /* 16 */
TclMacOSXCopyFileAttributes, /* 17 */
TclMacOSXMatchType, /* 18 */
TclMacOSXNotifierAddRunLoopMode, /* 19 */
0, /* 20 */
0, /* 21 */
0, /* 22 */
TclpCreateTempFile_, /* 22 */
0, /* 23 */
0, /* 24 */
0, /* 25 */
@@ -1052,7 +1061,7 @@ static const TclIntPlatStubs tclIntPlatStubs = {
TclpCreateCommandChannel, /* 2 */
TclpCreatePipe, /* 3 */
TclpCreateProcess, /* 4 */
0, /* 5 */
TclUnixWaitForFile_, /* 5 */
TclpMakeFile, /* 6 */
TclpOpenFile, /* 7 */
TclUnixWaitForFile, /* 8 */
@@ -1069,7 +1078,7 @@ static const TclIntPlatStubs tclIntPlatStubs = {
TclMacOSXNotifierAddRunLoopMode, /* 19 */
0, /* 20 */
0, /* 21 */
0, /* 22 */
TclpCreateTempFile_, /* 22 */
0, /* 23 */
0, /* 24 */
0, /* 25 */
+2 -2
View File
@@ -65,7 +65,7 @@ Tcl_InitStubs(
* times. [Bug 615304]
*/
if (!stubsPtr || (stubsPtr->magic != (((exact&0xff00) >= 0x900) ? magic : TCL_STUB_MAGIC))) {
if (!stubsPtr || (stubsPtr->magic != (((exact&0xFF00) >= 0x900) ? magic : TCL_STUB_MAGIC))) {
iPtr->result = (char *)"interpreter uses an incompatible stubs mechanism";
iPtr->freeProc = 0;
return NULL;
@@ -101,7 +101,7 @@ Tcl_InitStubs(
}
}
}
if (((exact&0xff00) < 0x900)) {
if (((exact&0xFF00) < 0x900)) {
/* We are running Tcl 8.x */
stubsPtr = (TclStubs *)pkgData;
}
+296 -588
View File
File diff suppressed because it is too large Load Diff
+16 -33
View File
@@ -42,23 +42,14 @@ static int CheckIfVarUnset(Tcl_Interp *interp, Tcl_Obj **varPtr, int varIndex);
static int GetVariableIndex(Tcl_Interp *interp,
const char *string, int *indexPtr);
static void SetVarToObj(Tcl_Obj **varPtr, int varIndex, Tcl_Obj *objPtr);
static int TestbignumobjCmd(void *dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int TestbooleanobjCmd(void *dummy,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
static int TestdoubleobjCmd(void *dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int TestindexobjCmd(void *dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int TestintobjCmd(void *dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int TestlistobjCmd(void *dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int TestobjCmd(void *dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static int TeststringobjCmd(void *dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static Tcl_ObjCmdProc TestbignumobjCmd;
static Tcl_ObjCmdProc TestbooleanobjCmd;
static Tcl_ObjCmdProc TestdoubleobjCmd;
static Tcl_ObjCmdProc TestindexobjCmd;
static Tcl_ObjCmdProc TestintobjCmd;
static Tcl_ObjCmdProc TestlistobjCmd;
static Tcl_ObjCmdProc TestobjCmd;
static Tcl_ObjCmdProc TeststringobjCmd;
#define VARPTR_KEY "TCLOBJTEST_VARPTR"
#define NUMBER_OF_OBJECT_VARS 20
@@ -158,7 +149,7 @@ TclObjTest_Init(
static int
TestbignumobjCmd(
void *dummy, /* unused */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Tcl interpreter */
int objc, /* Argument count */
Tcl_Obj *const objv[]) /* Argument vector */
@@ -174,7 +165,6 @@ TestbignumobjCmd(
const char *string;
mp_int bignumValue;
Tcl_Obj **varPtr;
(void)dummy;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?");
@@ -358,7 +348,7 @@ TestbignumobjCmd(
static int
TestbooleanobjCmd(
void *dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -366,7 +356,6 @@ TestbooleanobjCmd(
int varIndex, boolValue;
const char *index, *subCmd;
Tcl_Obj **varPtr;
(void)dummy;
if (objc < 3) {
wrongNumArgs:
@@ -459,7 +448,7 @@ TestbooleanobjCmd(
static int
TestdoubleobjCmd(
void *dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -468,7 +457,6 @@ TestdoubleobjCmd(
double doubleValue;
const char *index, *subCmd, *string;
Tcl_Obj **varPtr;
(void)dummy;
if (objc < 3) {
wrongNumArgs:
@@ -578,7 +566,7 @@ TestdoubleobjCmd(
static int
TestindexobjCmd(
void *dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -596,7 +584,6 @@ TestindexobjCmd(
int index; /* Selected index into table. */
};
struct IndexRep *indexRep;
(void)dummy;
if ((objc == 3) && (strcmp(Tcl_GetString(objv[1]),
"check") == 0)) {
@@ -669,7 +656,7 @@ TestindexobjCmd(
static int
TestintobjCmd(
void *dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -678,7 +665,6 @@ TestintobjCmd(
Tcl_WideInt wideValue;
const char *index, *subCmd, *string;
Tcl_Obj **varPtr;
(void)dummy;
if (objc < 3) {
wrongNumArgs:
@@ -874,7 +860,7 @@ TestintobjCmd(
static int
TestlistobjCmd(
void *dummy, /* Not used */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Tcl interpreter */
int objc, /* Number of arguments */
Tcl_Obj *const objv[]) /* Argument objects */
@@ -897,7 +883,6 @@ TestlistobjCmd(
int first; /* First index in the list */
int count; /* Count of elements in a list */
Tcl_Obj **varPtr;
(void)dummy;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 1, objv, "option arg ?arg...?");
@@ -972,7 +957,7 @@ TestlistobjCmd(
static int
TestobjCmd(
void *dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -981,7 +966,6 @@ TestobjCmd(
const char *index, *subCmd, *string;
const Tcl_ObjType *targetType;
Tcl_Obj **varPtr;
(void)dummy;
if (objc < 2) {
wrongNumArgs:
@@ -1185,7 +1169,7 @@ TestobjCmd(
static int
TeststringobjCmd(
void *dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1201,7 +1185,6 @@ TeststringobjCmd(
"set", "set2", "setlength", "maxchars", "appendself",
"appendself2", NULL
};
(void)dummy;
if (objc < 3) {
wrongNumArgs:
+2 -4
View File
@@ -228,7 +228,7 @@ ProcBodyTestInitInternal(
static int
ProcBodyTestProcObjCmd(
void *dummy, /* context; not used */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* the current interpreter */
int objc, /* argument count */
Tcl_Obj *const objv[]) /* arguments */
@@ -240,7 +240,6 @@ ProcBodyTestProcObjCmd(
Tcl_Obj *bodyObjPtr;
Tcl_Obj *myobjv[5];
int result;
(void)dummy;
if (objc != 4) {
Tcl_WrongNumArgs(interp, 1, objv, "newName argsList bodyName");
@@ -328,13 +327,12 @@ ProcBodyTestProcObjCmd(
static int
ProcBodyTestCheckObjCmd(
void *dummy, /* context; not used */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* the current interpreter */
int objc, /* argument count */
Tcl_Obj *const objv[]) /* arguments */
{
const char *version;
(void)dummy;
if (objc != 1) {
Tcl_WrongNumArgs(interp, 1, objv, "");
+12 -14
View File
@@ -134,8 +134,8 @@ static void LockBucket(Cache *cachePtr, int bucket);
static void UnlockBucket(Cache *cachePtr, int bucket);
static void PutBlocks(Cache *cachePtr, int bucket, int numMove);
static int GetBlocks(Cache *cachePtr, int bucket);
static Block * Ptr2Block(char *ptr);
static char * Block2Ptr(Block *blockPtr, int bucket, unsigned int reqSize);
static Block * Ptr2Block(void *ptr);
static void * Block2Ptr(Block *blockPtr, int bucket, unsigned int reqSize);
static void MoveObjs(Cache *fromPtr, Cache *toPtr, int numMove);
static void PutObjs(Cache *fromPtr, int numMove);
@@ -299,7 +299,7 @@ TclFreeAllocCache(
*----------------------------------------------------------------------
*/
char *
void *
TclpAlloc(
unsigned int reqSize)
{
@@ -378,7 +378,7 @@ TclpAlloc(
void
TclpFree(
char *ptr)
void *ptr)
{
Cache *cachePtr;
Block *blockPtr;
@@ -435,9 +435,9 @@ TclpFree(
*----------------------------------------------------------------------
*/
char *
void *
TclpRealloc(
char *ptr,
void *ptr,
unsigned int reqSize)
{
Cache *cachePtr;
@@ -510,7 +510,7 @@ TclpRealloc(
memcpy(newPtr, ptr, reqSize);
TclpFree(ptr);
}
return (char *)newPtr;
return newPtr;
}
/*
@@ -804,7 +804,7 @@ PutObjs(
*----------------------------------------------------------------------
*/
static char *
static void *
Block2Ptr(
Block *blockPtr,
int bucket,
@@ -819,12 +819,12 @@ Block2Ptr(
#if RCHECK
((unsigned char *)(ptr))[reqSize] = MAGIC;
#endif
return (char *) ptr;
return ptr;
}
static Block *
Ptr2Block(
char *ptr)
void *ptr)
{
Block *blockPtr;
@@ -872,11 +872,9 @@ LockBucket(
static void
UnlockBucket(
Cache *cachePtr,
TCL_UNUSED(Cache *),
int bucket)
{
(void)cachePtr;
Tcl_MutexUnlock(bucketInfo[bucket].lockPtr);
}
@@ -1017,7 +1015,7 @@ GetBlocks(
blockPtr = NULL;
n = NBUCKETS;
size = 0; /* lint */
size = 0;
while (--n > bucket) {
if (cachePtr->buckets[n].numFree > 0) {
size = bucketInfo[n].blockSize;
+3 -12
View File
@@ -203,10 +203,9 @@ TclThread_Init(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static int
ThreadObjCmd(
void *dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -223,7 +222,6 @@ ThreadObjCmd(
THREAD_ID, THREAD_JOIN, THREAD_NAMES, THREAD_SEND,
THREAD_WAIT, THREAD_ERRORPROC
};
(void)dummy;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?");
@@ -492,7 +490,6 @@ ThreadObjCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static int
ThreadCreate(
Tcl_Interp *interp, /* Current interpreter. */
@@ -1011,7 +1008,7 @@ ThreadCancel(
static int
ThreadEventProc(
Tcl_Event *evPtr, /* Really ThreadEvent */
int mask)
TCL_UNUSED(int) /*mask*/)
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
ThreadEvent *threadEventPtr = (ThreadEvent *) evPtr;
@@ -1019,7 +1016,6 @@ ThreadEventProc(
Tcl_Interp *interp = tsdPtr->interp;
int code;
const char *result, *errorCode, *errorInfo;
(void)mask;
if (interp == NULL) {
code = TCL_ERROR;
@@ -1080,7 +1076,6 @@ ThreadEventProc(
*------------------------------------------------------------------------
*/
/* ARGSUSED */
static void
ThreadFreeProc(
void *clientData)
@@ -1107,14 +1102,11 @@ ThreadFreeProc(
*------------------------------------------------------------------------
*/
/* ARGSUSED */
static int
ThreadDeleteEvent(
Tcl_Event *eventPtr, /* Really ThreadEvent */
void *dummy) /* dummy */
TCL_UNUSED(ClientData))
{
(void)dummy;
if (eventPtr->proc == ThreadEventProc) {
ckfree(((ThreadEvent *) eventPtr)->script);
return 1;
@@ -1145,7 +1137,6 @@ ThreadDeleteEvent(
*------------------------------------------------------------------------
*/
/* ARGSUSED */
static void
ThreadExitProc(
void *clientData)
+6 -14
View File
@@ -211,10 +211,9 @@ InitTimer(void)
static void
TimerExitProc(
ClientData dummy) /* Not used. */
TCL_UNUSED(ClientData))
{
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)TclThreadDataKeyGet(&dataKey);
(void)dummy;
Tcl_DeleteEventSource(TimerSetupProc, TimerCheckProc, NULL);
if (tsdPtr != NULL) {
@@ -399,12 +398,11 @@ Tcl_DeleteTimerHandler(
static void
TimerSetupProc(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
int flags) /* Event flags as passed to Tcl_DoOneEvent. */
{
Tcl_Time blockTime;
ThreadSpecificData *tsdPtr = InitTimer();
(void)dummy;
if (((flags & TCL_IDLE_EVENTS) && tsdPtr->idleList)
|| ((flags & TCL_TIMER_EVENTS) && tsdPtr->timerPending)) {
@@ -458,13 +456,12 @@ TimerSetupProc(
static void
TimerCheckProc(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
int flags) /* Event flags as passed to Tcl_DoOneEvent. */
{
Tcl_Event *timerEvPtr;
Tcl_Time blockTime;
ThreadSpecificData *tsdPtr = InitTimer();
(void)dummy;
if ((flags & TCL_TIMER_EVENTS) && tsdPtr->firstTimerHandlerPtr) {
/*
@@ -521,7 +518,7 @@ TimerCheckProc(
static int
TimerHandlerEventProc(
Tcl_Event *evPtr, /* Event to service. */
TCL_UNUSED(Tcl_Event *),
int flags) /* Flags that indicate what events to handle,
* such as TCL_FILE_EVENTS. */
{
@@ -529,7 +526,6 @@ TimerHandlerEventProc(
Tcl_Time time;
int currentTimerId;
ThreadSpecificData *tsdPtr = InitTimer();
(void)evPtr;
/*
* Do nothing if timers aren't enabled. This leaves the event on the
@@ -780,10 +776,9 @@ TclServiceIdle(void)
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_AfterObjCmd(
ClientData dummy, /* Unused */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -799,7 +794,6 @@ Tcl_AfterObjCmd(
};
enum afterSubCmds {AFTER_CANCEL, AFTER_IDLE, AFTER_INFO};
ThreadSpecificData *tsdPtr = InitTimer();
(void)dummy;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?");
@@ -1253,16 +1247,14 @@ FreeAfterPtr(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static void
AfterCleanupProc(
ClientData clientData, /* Points to AfterAssocData for the
* interpreter. */
Tcl_Interp *dummy) /* Interpreter that is being deleted. */
TCL_UNUSED(Tcl_Interp *))
{
AfterAssocData *assocPtr = (AfterAssocData *)clientData;
AfterInfo *afterPtr;
(void)dummy;
while (assocPtr->firstAfterPtr != NULL) {
afterPtr = assocPtr->firstAfterPtr;
+4 -13
View File
@@ -181,10 +181,9 @@ typedef struct {
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_TraceObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -209,7 +208,6 @@ Tcl_TraceObjCmd(
TRACE_OLD_VARIABLE, TRACE_OLD_VDELETE, TRACE_OLD_VINFO
#endif
};
(void)dummy;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?");
@@ -1040,8 +1038,7 @@ ClientData
Tcl_CommandTraceInfo(
Tcl_Interp *interp, /* Interpreter containing command. */
const char *cmdName, /* Name of command. */
int flags, /* OR-ed combo or TCL_GLOBAL_ONLY,
* TCL_NAMESPACE_ONLY (can be 0). */
TCL_UNUSED(int) /*flags*/,
Tcl_CommandTraceProc *proc, /* Function assocated with trace. */
ClientData prevClientData) /* If non-NULL, gives last value returned by
* this function, so this call will return the
@@ -1050,7 +1047,6 @@ Tcl_CommandTraceInfo(
{
Command *cmdPtr;
CommandTrace *tracePtr;
(void)flags;
cmdPtr = (Command *) Tcl_FindCommand(interp, cmdName, NULL,
TCL_LEAVE_ERR_MSG);
@@ -1280,7 +1276,6 @@ Tcl_UntraceCommand(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static void
TraceCommandProc(
ClientData clientData, /* Information about the command trace. */
@@ -1424,8 +1419,7 @@ TclCheckExecutionTraces(
Tcl_Interp *interp, /* The current interpreter. */
const char *command, /* Pointer to beginning of the current command
* string. */
int numChars, /* The number of characters in 'command' which
* are part of the command string. */
TCL_UNUSED(int) /*numChars*/,
Command *cmdPtr, /* Points to command's Command struct. */
int code, /* The current result code. */
int traceFlags, /* Current tracing situation. */
@@ -1438,7 +1432,6 @@ TclCheckExecutionTraces(
int curLevel;
int traceCode = TCL_OK;
Tcl_InterpState state = NULL;
(void)numChars;
if (cmdPtr->tracePtr == NULL) {
return traceCode;
@@ -1765,7 +1758,7 @@ TraceExecutionProc(
Tcl_Interp *interp,
int level,
const char *command,
Tcl_Command cmdInfo,
TCL_UNUSED(Tcl_Command),
int objc,
struct Tcl_Obj *const objv[])
{
@@ -1775,7 +1768,6 @@ TraceExecutionProc(
int flags = tcmdPtr->curFlags;
int code = tcmdPtr->curCode;
int traceCode = TCL_OK;
(void)cmdInfo;
if (tcmdPtr->flags & TCL_TRACE_EXEC_IN_PROGRESS) {
/*
@@ -1967,7 +1959,6 @@ TraceExecutionProc(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static char *
TraceVarProc(
ClientData clientData, /* Information about the variable trace. */
+1037 -1005
View File
File diff suppressed because it is too large Load Diff
+12 -14
View File
@@ -352,7 +352,7 @@ Tcl_Char16ToUtfDString(
*/
static const unsigned short cp1252[32] = {
0x20ac, 0x81, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021,
0x20AC, 0x81, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021,
0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0x8D, 0x017D, 0x8F,
0x90, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
0x2DC, 0x2122, 0x0161, 0x203A, 0x0153, 0x9D, 0x017E, 0x0178
@@ -525,7 +525,7 @@ Tcl_UtfToChar16(
unsigned short high = (((byte & 0x07) << 8) | ((src[1] & 0x3F) << 2)
| ((src[2] & 0x3F) >> 4)) - 0x40;
if (high >= 0x400) {
/* out of range, < 0x10000 or > 0x10ffff */
/* out of range, < 0x10000 or > 0x10FFFF */
} else {
/* produce high surrogate, advance source pointer */
*chPtr = 0xD800 + high;
@@ -790,7 +790,7 @@ Tcl_UtfFindFirst(
#if TCL_UTF_MAX <= 3
if ((fullchar != ch) && (find >= 0xD800) && (len < 3)) {
len += TclUtfToUniChar(src + len, &find);
fullchar = (((fullchar & 0x3ff) << 10) | (find & 0x3ff)) + 0x10000;
fullchar = (((fullchar & 0x3FF) << 10) | (find & 0x3FF)) + 0x10000;
}
#endif
if (fullchar == ch) {
@@ -838,7 +838,7 @@ Tcl_UtfFindLast(
#if TCL_UTF_MAX <= 3
if ((fullchar != ch) && (find >= 0xD800) && (len < 3)) {
len += TclUtfToUniChar(src + len, &find);
fullchar = (((fullchar & 0x3ff) << 10) | (find & 0x3ff)) + 0x10000;
fullchar = (((fullchar & 0x3FF) << 10) | (find & 0x3FF)) + 0x10000;
}
#endif
if (fullchar == ch) {
@@ -976,7 +976,7 @@ Tcl_UniCharAtIndex(
if ((ch >= 0xD800) && (len < 3)) {
/* If last Tcl_UniChar was a high surrogate, combine with low surrogate */
(void)TclUtfToUniChar(src, &ch);
fullchar = (((fullchar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000;
fullchar = (((fullchar & 0x3FF) << 10) | (ch & 0x3FF)) + 0x10000;
}
#endif
return fullchar;
@@ -1114,7 +1114,7 @@ Tcl_UtfToUpper(
if ((ch >= 0xD800) && (len < 3)) {
len += TclUtfToUniChar(src + len, &ch);
/* Combine surrogates */
upChar = (((upChar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000;
upChar = (((upChar & 0x3FF) << 10) | (ch & 0x3FF)) + 0x10000;
}
#endif
upChar = Tcl_UniCharToUpper(upChar);
@@ -1176,7 +1176,7 @@ Tcl_UtfToLower(
if ((ch >= 0xD800) && (len < 3)) {
len += TclUtfToUniChar(src + len, &ch);
/* Combine surrogates */
lowChar = (((lowChar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000;
lowChar = (((lowChar & 0x3FF) << 10) | (ch & 0x3FF)) + 0x10000;
}
#endif
lowChar = Tcl_UniCharToLower(lowChar);
@@ -1241,7 +1241,7 @@ Tcl_UtfToTitle(
if ((ch >= 0xD800) && (len < 3)) {
len += TclUtfToUniChar(src + len, &ch);
/* Combine surrogates */
titleChar = (((titleChar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000;
titleChar = (((titleChar & 0x3FF) << 10) | (ch & 0x3FF)) + 0x10000;
}
#endif
titleChar = Tcl_UniCharToTitle(titleChar);
@@ -1261,7 +1261,7 @@ Tcl_UtfToTitle(
if ((ch >= 0xD800) && (len < 3)) {
len += TclUtfToUniChar(src + len, &ch);
/* Combine surrogates */
lowChar = (((lowChar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000;
lowChar = (((lowChar & 0x3FF) << 10) | (ch & 0x3FF)) + 0x10000;
}
#endif
/* Special exception for Georgian Asomtavruli chars, no titlecase. */
@@ -1821,7 +1821,7 @@ Tcl_UniCharIsControl(
{
if (UNICODE_OUT_OF_RANGE(ch)) {
ch &= 0x1FFFFF;
if ((ch == 0xE0001) || ((ch >= 0xE0020) && (ch <= 0xE007f))) {
if ((ch == 0xE0001) || ((ch >= 0xE0020) && (ch <= 0xE007F))) {
return 1;
}
if ((ch >= 0xF0000) && ((ch & 0xFFFF) <= 0xFFFD)) {
@@ -1879,8 +1879,7 @@ Tcl_UniCharIsGraph(
int ch) /* Unicode character to test. */
{
if (UNICODE_OUT_OF_RANGE(ch)) {
ch &= 0x1FFFFF;
return (ch >= 0xE0100) && (ch <= 0xE01EF);
return ((unsigned)((ch & 0x1FFFFF) - 0xE0100) <= 0xEF);
}
return ((GRAPH_BITS >> GetCategory(ch)) & 1);
}
@@ -1932,8 +1931,7 @@ Tcl_UniCharIsPrint(
int ch) /* Unicode character to test. */
{
if (UNICODE_OUT_OF_RANGE(ch)) {
ch &= 0x1FFFFF;
return (ch >= 0xE0100) && (ch <= 0xE01EF);
return ((unsigned)((ch & 0x1FFFFF) - 0xE0100) <= 0xEF);
}
return (((GRAPH_BITS|SPACE_BITS) >> GetCategory(ch)) & 1);
}
+8 -11
View File
@@ -581,7 +581,7 @@ FindElement(
const char *limit; /* Points just after list/dict's last byte. */
int openBraces = 0; /* Brace nesting level during parse. */
int inQuotes = 0;
int size = 0; /* lint. */
int size = 0;
int numChars;
int literal = 1;
const char *p2;
@@ -2475,11 +2475,10 @@ TclByteArrayMatch(
/* Pattern, which may contain special
* characters. */
int ptnLen, /* Length of Pattern */
int flags)
TCL_UNUSED(int) /*flags*/)
{
const unsigned char *stringEnd, *patternEnd;
unsigned char p;
(void)flags;
stringEnd = string + strLen;
patternEnd = pattern + ptnLen;
@@ -3264,7 +3263,7 @@ Tcl_DStringEndSublist(
void
Tcl_PrintDouble(
Tcl_Interp *dummy, /* Not used. */
TCL_UNUSED(Tcl_Interp *),
double value, /* Value to print as string. */
char *dst) /* Where to store converted value; must have
* at least TCL_DOUBLE_SPACE characters. */
@@ -3275,7 +3274,6 @@ Tcl_PrintDouble(
char *digits;
char *end;
int *precisionPtr = (int *)Tcl_GetThreadData(&precisionKey, sizeof(int));
(void)dummy;
/*
* Handle NaN.
@@ -3438,10 +3436,9 @@ Tcl_PrintDouble(
*/
#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
/* ARGSUSED */
char *
TclPrecTraceProc(
ClientData clientData, /* Not used. */
ClientData clientData,
Tcl_Interp *interp, /* Interpreter containing variable. */
const char *name1, /* Name of variable. */
const char *name2, /* Second part of variable name. */
@@ -4032,11 +4029,11 @@ GetEndOffsetFromObj(
* collection, and can be encoded as after. The end-relative
* expressions that indicate an index less than or equal to end
* are encoded relative to the value TCL_INDEX_END (-2). The
* index "end" is encoded as -2, down to the index "end-0x7ffffffe"
* index "end" is encoded as -2, down to the index "end-0x7FFFFFFE"
* which is encoded as INT_MIN. Since the largest index into a
* string possible in Tcl 8 is 0x7ffffffe, the interpretation of
* "end-0x7ffffffe" for that largest string would be 0. Thus,
* if the tokens "end-0x7fffffff" or "end+-0x80000000" are parsed,
* string possible in Tcl 8 is 0x7FFFFFFE, the interpretation of
* "end-0x7FFFFFFE" for that largest string would be 0. Thus,
* if the tokens "end-0x7FFFFFFF" or "end+-0x80000000" are parsed,
* they can be encoded with the before value.
*
* These details will require re-examination whenever string and
+27 -71
View File
@@ -188,8 +188,7 @@ static void ArrayPopulateSearch(Tcl_Interp *interp,
static void ArrayDoneSearch(Interp *iPtr, Var *varPtr,
ArraySearch *searchPtr);
static Tcl_NRPostProc ArrayForLoopCallback;
static int ArrayForNRCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const *objv);
static Tcl_ObjCmdProc ArrayForNRCmd;
static void DeleteSearches(Interp *iPtr, Var *arrayVarPtr);
static void DeleteArray(Interp *iPtr, Tcl_Obj *arrayNamePtr,
Var *varPtr, int flags, int index);
@@ -1525,16 +1524,14 @@ TclPtrGetVarIdx(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_SetObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp,/* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tcl_Obj *varValueObj;
(void)dummy;
if (objc == 2) {
varValueObj = Tcl_ObjGetVar2(interp, objv[1], NULL,TCL_LEAVE_ERR_MSG);
@@ -2821,17 +2818,15 @@ UnsetVarStruct(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_UnsetObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
int i, flags = TCL_LEAVE_ERR_MSG;
const char *name;
(void)dummy;
if (objc == 1) {
/*
@@ -2890,10 +2885,9 @@ Tcl_UnsetObjCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_AppendObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -2902,7 +2896,6 @@ Tcl_AppendObjCmd(
Tcl_Obj *varValuePtr = NULL;
/* Initialized to avoid compiler warning. */
int i;
(void)dummy;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "varName ?value ...?");
@@ -2957,10 +2950,9 @@ Tcl_AppendObjCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_LappendObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -2969,7 +2961,6 @@ Tcl_LappendObjCmd(
int numElems, createdNewObj;
Var *varPtr, *arrayPtr;
int result;
(void)dummy;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "varName ?value ...?");
@@ -3167,17 +3158,17 @@ ArrayObjNext(
static int
ArrayForObjCmd(
ClientData dummy, /* Not used. */
ClientData clientData,
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
return Tcl_NRCallObjProc(interp, ArrayForNRCmd, dummy, objc, objv);
return Tcl_NRCallObjProc(interp, ArrayForNRCmd, clientData, objc, objv);
}
static int
ArrayForNRCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
@@ -3186,7 +3177,6 @@ ArrayForNRCmd(
ArraySearch *searchPtr = NULL;
Var *varPtr;
int isArray, numVars;
(void)dummy;
/*
* array for {k v} a body
@@ -3405,11 +3395,9 @@ ArrayPopulateSearch(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static int
ArrayStartSearchCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -3417,7 +3405,6 @@ ArrayStartSearchCmd(
Var *varPtr;
int isArray;
ArraySearch *searchPtr;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "arrayName");
@@ -3503,10 +3490,9 @@ ArrayDoneSearch(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static int
ArrayAnyMoreCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -3516,7 +3502,6 @@ ArrayAnyMoreCmd(
Tcl_Obj *varNameObj, *searchObj;
int gotValue, isArray;
ArraySearch *searchPtr;
(void)dummy;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 1, objv, "arrayName searchId");
@@ -3583,10 +3568,9 @@ ArrayAnyMoreCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static int
ArrayNextElementCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -3595,7 +3579,6 @@ ArrayNextElementCmd(
Tcl_Obj *varNameObj, *searchObj;
ArraySearch *searchPtr;
int isArray;
(void)dummy;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 1, objv, "arrayName searchId");
@@ -3665,10 +3648,9 @@ ArrayNextElementCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static int
ArrayDoneSearchCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -3678,7 +3660,6 @@ ArrayDoneSearchCmd(
Tcl_Obj *varNameObj, *searchObj;
ArraySearch *searchPtr;
int isArray;
(void)dummy;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 1, objv, "arrayName searchId");
@@ -3727,17 +3708,15 @@ ArrayDoneSearchCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static int
ArrayExistsCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
Interp *iPtr = (Interp *)interp;
int isArray;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "arrayName");
@@ -3769,10 +3748,9 @@ ArrayExistsCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static int
ArrayGetCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -3783,7 +3761,6 @@ ArrayGetCmd(
Tcl_HashSearch search;
const char *pattern;
int i, count, result, isArray;
(void)dummy;
switch (objc) {
case 2:
@@ -3930,10 +3907,9 @@ ArrayGetCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static int
ArrayNamesCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -3947,7 +3923,6 @@ ArrayNamesCmd(
Tcl_HashSearch search;
const char *pattern = NULL;
int isArray, mode = OPT_GLOB;
(void)dummy;
if ((objc < 2) || (objc > 4)) {
Tcl_WrongNumArgs(interp, 1, objv, "arrayName ?mode? ?pattern?");
@@ -4099,10 +4074,9 @@ TclFindArrayPtrElements(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static int
ArraySetCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -4111,7 +4085,6 @@ ArraySetCmd(
Tcl_Obj *arrayElemObj;
Var *varPtr, *arrayPtr;
int result, i;
(void)dummy;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 1, objv, "arrayName list");
@@ -4276,10 +4249,9 @@ ArraySetCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static int
ArraySizeCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -4288,7 +4260,6 @@ ArraySizeCmd(
Tcl_HashSearch search;
Var *varPtr2;
int isArray, size = 0;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "arrayName");
@@ -4337,10 +4308,9 @@ ArraySizeCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static int
ArrayStatsCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -4349,7 +4319,6 @@ ArrayStatsCmd(
Tcl_Obj *varNameObj;
char *stats;
int isArray;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "arrayName");
@@ -4393,10 +4362,9 @@ ArrayStatsCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static int
ArrayUnsetCmd(
ClientData dummy,
TCL_UNUSED(ClientData),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -4407,7 +4375,6 @@ ArrayUnsetCmd(
const char *pattern;
const int unsetFlags = 0; /* Should this be TCL_LEAVE_ERR_MSG? */
int isArray;
(void)dummy;
switch (objc) {
case 2:
@@ -4531,7 +4498,6 @@ ArrayUnsetCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
Tcl_Command
TclInitArrayCmd(
Tcl_Interp *interp) /* Current interpreter. */
@@ -5023,7 +4989,7 @@ Tcl_GetVariableFullName(
int
Tcl_GlobalObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -5033,7 +4999,6 @@ Tcl_GlobalObjCmd(
const char *varName;
const char *tail;
int result, i;
(void)dummy;
/*
* If we are not executing inside a Tcl procedure, just return.
@@ -5128,7 +5093,7 @@ Tcl_GlobalObjCmd(
int
Tcl_VariableObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -5139,7 +5104,6 @@ Tcl_VariableObjCmd(
Tcl_Obj *varValuePtr;
int i, result;
Tcl_Obj *varNamePtr, *tailPtr;
(void)dummy;
for (i=1 ; i<objc ; i+=2) {
/*
@@ -5260,10 +5224,9 @@ Tcl_VariableObjCmd(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
Tcl_UpvarObjCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -5271,7 +5234,6 @@ Tcl_UpvarObjCmd(
CallFrame *framePtr;
int result, hasLevel;
Tcl_Obj *levelObj;
(void)dummy;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 1, objv,
@@ -6075,7 +6037,7 @@ ObjFindNamespaceVar(
int
TclInfoVarsCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -6090,7 +6052,6 @@ TclInfoVarsCmd(
Tcl_Obj *listPtr, *elemObjPtr, *varNamePtr;
int specificNsInPattern = 0;/* Init. to avoid compiler warning. */
Tcl_Obj *simplePatternPtr = NULL;
(void)dummy;
/*
* Get the pattern and find the "effective namespace" in which to list
@@ -6267,7 +6228,7 @@ TclInfoVarsCmd(
int
TclInfoGlobalsCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -6277,7 +6238,6 @@ TclInfoGlobalsCmd(
Tcl_HashSearch search;
Var *varPtr;
Tcl_Obj *listPtr, *varNamePtr, *patternPtr;
(void)dummy;
if (objc == 1) {
pattern = NULL;
@@ -6361,14 +6321,13 @@ TclInfoGlobalsCmd(
int
TclInfoLocalsCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Interp *iPtr = (Interp *) interp;
Tcl_Obj *patternPtr, *listPtr;
(void)dummy;
if (objc == 1) {
patternPtr = NULL;
@@ -6577,13 +6536,12 @@ TclInitVarHashTable(
static Tcl_HashEntry *
AllocVarEntry(
Tcl_HashTable *tablePtr, /* Hash table. */
TCL_UNUSED(Tcl_HashTable *),
void *keyPtr) /* Key to store in the hash table entry. */
{
Tcl_Obj *objPtr = (Tcl_Obj *)keyPtr;
Tcl_HashEntry *hPtr;
Var *varPtr;
(void)tablePtr;
varPtr = (Var *)ckalloc(sizeof(VarInHash));
varPtr->flags = VAR_IN_HASHTABLE;
@@ -6666,10 +6624,9 @@ CompareVarKeys(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static int
ArrayDefaultCmd(
ClientData dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -6681,7 +6638,6 @@ ArrayDefaultCmd(
Tcl_Obj *arrayNameObj, *defaultValueObj;
Var *varPtr, *arrayPtr;
int isArray, option;
(void)dummy;
/*
* Parse arguments.
+57 -89
View File
@@ -385,13 +385,14 @@ static int ZipFSLoadFile(Tcl_Interp *interp, Tcl_Obj *path,
static void ZipfsExitHandler(ClientData clientData);
static void ZipfsSetup(void);
static int ZipChannelClose(void *instanceData,
Tcl_Interp *interp);
static int ZipChannelGetFile(void *instanceData,
int direction, void **handlePtr);
Tcl_Interp *interp, int flags);
static Tcl_DriverGetHandleProc ZipChannelGetFile;
static int ZipChannelRead(void *instanceData, char *buf,
int toRead, int *errloc);
#ifndef TCL_NO_DEPRECATED
static int ZipChannelSeek(void *instanceData, long offset,
int mode, int *errloc);
#endif
static Tcl_WideInt ZipChannelWideSeek(void *instanceData, Tcl_WideInt offset,
int mode, int *errloc);
static void ZipChannelWatchChannel(void *instanceData,
@@ -444,15 +445,19 @@ static const Tcl_Filesystem zipfsFilesystem = {
static Tcl_ChannelType ZipChannelType = {
"zip", /* Type name. */
TCL_CHANNEL_VERSION_5,
ZipChannelClose, /* Close channel, clean instance data */
TCL_CLOSE2PROC, /* Close channel, clean instance data */
ZipChannelRead, /* Handle read request */
ZipChannelWrite, /* Handle write request */
#ifndef TCL_NO_DEPRECATED
ZipChannelSeek, /* Move location of access point, NULL'able */
#else
NULL, /* Move location of access point, NULL'able */
#endif
NULL, /* Set options, NULL'able */
NULL, /* Get options, NULL'able */
ZipChannelWatchChannel, /* Initialize notifier */
ZipChannelGetFile, /* Get OS handle from the channel */
NULL, /* 2nd version of close channel, NULL'able */
ZipChannelClose, /* 2nd version of close channel, NULL'able */
NULL, /* Set blocking mode for raw channel, NULL'able */
NULL, /* Function to flush channel, NULL'able */
NULL, /* Function to handle event, NULL'able */
@@ -1883,12 +1888,11 @@ TclZipfs_Unmount(
static int
ZipFSMountObjCmd(
void *dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
(void)dummy;
if (objc > 4) {
Tcl_WrongNumArgs(interp, 1, objv,
@@ -1919,7 +1923,7 @@ ZipFSMountObjCmd(
static int
ZipFSMountBufferObjCmd(
void *dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1927,7 +1931,6 @@ ZipFSMountBufferObjCmd(
const char *mountPoint; /* Mount point path. */
unsigned char *data;
int length;
(void)dummy;
if (objc > 3) {
Tcl_WrongNumArgs(interp, 1, objv, "?mountpoint? ?data?");
@@ -1972,15 +1975,11 @@ ZipFSMountBufferObjCmd(
static int
ZipFSRootObjCmd(
void *dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
TCL_UNUSED(int) /*objc*/,
TCL_UNUSED(Tcl_Obj *const *)) /*objv*/
{
(void)dummy;
(void)objc;
(void)objv;
Tcl_SetObjResult(interp, Tcl_NewStringObj(ZIPFS_VOLUME, -1));
return TCL_OK;
}
@@ -2003,12 +2002,11 @@ ZipFSRootObjCmd(
static int
ZipFSUnmountObjCmd(
void *dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "zipfile");
@@ -2036,14 +2034,13 @@ ZipFSUnmountObjCmd(
static int
ZipFSMkKeyObjCmd(
void *dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
int len, i = 0;
char *pw, passBuf[264];
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "password");
@@ -2816,13 +2813,11 @@ ZipFSMkZipOrImgObjCmd(
static int
ZipFSMkZipObjCmd(
void *dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
(void)dummy;
if (objc < 3 || objc > 5) {
Tcl_WrongNumArgs(interp, 1, objv, "outfile indir ?strip? ?password?");
return TCL_ERROR;
@@ -2838,13 +2833,11 @@ ZipFSMkZipObjCmd(
static int
ZipFSLMkZipObjCmd(
void *dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
(void)dummy;
if (objc < 3 || objc > 4) {
Tcl_WrongNumArgs(interp, 1, objv, "outfile inlist ?password?");
return TCL_ERROR;
@@ -2877,13 +2870,11 @@ ZipFSLMkZipObjCmd(
static int
ZipFSMkImgObjCmd(
void *dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
(void)dummy;
if (objc < 3 || objc > 6) {
Tcl_WrongNumArgs(interp, 1, objv,
"outfile indir ?strip? ?password? ?infile?");
@@ -2900,13 +2891,11 @@ ZipFSMkImgObjCmd(
static int
ZipFSLMkImgObjCmd(
void *dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
(void)dummy;
if (objc < 3 || objc > 5) {
Tcl_WrongNumArgs(interp, 1, objv, "outfile inlist ?password infile?");
return TCL_ERROR;
@@ -2939,7 +2928,7 @@ ZipFSLMkImgObjCmd(
static int
ZipFSCanonicalObjCmd(
void *dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -2948,7 +2937,6 @@ ZipFSCanonicalObjCmd(
char *filename = NULL;
char *result;
Tcl_DString dPath;
(void)dummy;
if (objc < 2 || objc > 4) {
Tcl_WrongNumArgs(interp, 1, objv, "?mountpoint? filename ?inZipfs?");
@@ -2996,7 +2984,7 @@ ZipFSCanonicalObjCmd(
static int
ZipFSExistsObjCmd(
void *dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -3004,7 +2992,6 @@ ZipFSExistsObjCmd(
char *filename;
int exists;
Tcl_DString ds;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "filename");
@@ -3050,14 +3037,13 @@ ZipFSExistsObjCmd(
static int
ZipFSInfoObjCmd(
void *dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
char *filename;
ZipEntry *z;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "filename");
@@ -3101,7 +3087,7 @@ ZipFSInfoObjCmd(
static int
ZipFSListObjCmd(
void *dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -3111,7 +3097,6 @@ ZipFSListObjCmd(
Tcl_HashEntry *hPtr;
Tcl_HashSearch search;
Tcl_Obj *result = Tcl_GetObjResult(interp);
(void)dummy;
if (objc > 3) {
Tcl_WrongNumArgs(interp, 1, objv, "?(-glob|-regexp)? ?pattern?");
@@ -3299,15 +3284,11 @@ TclZipfs_TclLibrary(void)
static int
ZipFSTclLibraryObjCmd(
void *dummy, /* Not used. */
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
TCL_UNUSED(int) /*objc*/,
TCL_UNUSED(Tcl_Obj *const *)) /*objv*/
{
(void)dummy;
(void)objc;
(void)objv;
if (!Tcl_IsSafe(interp)) {
Tcl_Obj *pResult = TclZipfs_TclLibrary();
@@ -3338,10 +3319,14 @@ ZipFSTclLibraryObjCmd(
static int
ZipChannelClose(
void *instanceData,
Tcl_Interp *dummy) /* Current interpreter. */
TCL_UNUSED(Tcl_Interp *),
int flags)
{
ZipChannel *info = (ZipChannel *)instanceData;
(void)dummy;
if ((flags & (TCL_CLOSE_READ | TCL_CLOSE_WRITE)) != 0) {
return EINVAL;
}
if (info->iscompr && info->ubuf) {
ckfree(info->ubuf);
@@ -3569,6 +3554,7 @@ ZipChannelWideSeek(
return info->numRead;
}
#ifndef TCL_NO_DEPRECATED
static int
ZipChannelSeek(
void *instanceData,
@@ -3578,6 +3564,7 @@ ZipChannelSeek(
{
return ZipChannelWideSeek(instanceData, offset, mode, errloc);
}
#endif
/*
*-------------------------------------------------------------------------
@@ -3598,12 +3585,9 @@ ZipChannelSeek(
static void
ZipChannelWatchChannel(
void *instanceData,
int mask)
TCL_UNUSED(ClientData),
TCL_UNUSED(int) /*mask*/)
{
(void)instanceData;
(void)mask;
return;
}
@@ -3626,14 +3610,10 @@ ZipChannelWatchChannel(
static int
ZipChannelGetFile(
void *instanceData,
int direction,
void **handlePtr)
TCL_UNUSED(ClientData),
TCL_UNUSED(int) /*direction*/,
TCL_UNUSED(ClientData *) /*handlePtr*/)
{
(void)instanceData;
(void)direction;
(void)handlePtr;
return TCL_ERROR;
}
@@ -3659,13 +3639,12 @@ ZipChannelOpen(
Tcl_Interp *interp, /* Current interpreter. */
char *filename,
int mode,
int permissions)
TCL_UNUSED(int) /*permissions*/)
{
ZipEntry *z;
ZipChannel *info;
int i, ch, trunc, wr, flags = 0;
char cname[128];
(void)permissions;
if ((mode & O_APPEND)
|| ((ZipFS.wrmax <= 0) && (mode & (O_WRONLY | O_RDWR)))) {
@@ -4186,10 +4165,8 @@ ZipFSAccessProc(
static Tcl_Obj *
ZipFSFilesystemSeparatorProc(
Tcl_Obj *pathPtr)
TCL_UNUSED(Tcl_Obj *) /*pathPtr*/)
{
(void)pathPtr;
return Tcl_NewStringObj("/", -1);
}
@@ -4214,7 +4191,7 @@ ZipFSFilesystemSeparatorProc(
static int
ZipFSMatchInDirectoryProc(
Tcl_Interp *dummy, /* Current interpreter. */
TCL_UNUSED(Tcl_Interp *),
Tcl_Obj *result,
Tcl_Obj *pathPtr,
const char *pattern,
@@ -4227,7 +4204,6 @@ ZipFSMatchInDirectoryProc(
size_t len;
char *pat, *prefix, *path;
Tcl_DString dsPref;
(void)dummy;
if (!normPathPtr) {
return -1;
@@ -4406,14 +4382,13 @@ ZipFSMatchInDirectoryProc(
static int
ZipFSPathInFilesystemProc(
Tcl_Obj *pathPtr,
void **dummy)
TCL_UNUSED(ClientData *))
{
Tcl_HashEntry *hPtr;
Tcl_HashSearch search;
int ret = -1;
size_t len;
char *path;
(void)dummy;
pathPtr = Tcl_FSGetNormalizedPath(NULL, pathPtr);
if (!pathPtr) {
@@ -4503,8 +4478,8 @@ ZipFSListVolumesProc(void)
static const char *const *
ZipFSFileAttrStringsProc(
Tcl_Obj *pathPtr,
Tcl_Obj **objPtrRef)
TCL_UNUSED(Tcl_Obj *) /*pathPtr*/,
TCL_UNUSED(Tcl_Obj **) /*objPtrRef*/)
{
static const char *const attrs[] = {
"-uncompsize",
@@ -4515,8 +4490,6 @@ ZipFSFileAttrStringsProc(
"-permissions",
NULL,
};
(void)pathPtr;
(void)objPtrRef;
return attrs;
}
@@ -4615,14 +4588,10 @@ ZipFSFileAttrsGetProc(
static int
ZipFSFileAttrsSetProc(
Tcl_Interp *interp, /* Current interpreter. */
int index,
Tcl_Obj *pathPtr,
Tcl_Obj *objPtr)
TCL_UNUSED(int) /*index*/,
TCL_UNUSED(Tcl_Obj *) /*pathPtr*/,
TCL_UNUSED(Tcl_Obj *) /*objPtr*/)
{
(void)index;
(void)pathPtr;
(void)objPtr;
if (interp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj("unsupported operation", -1));
Tcl_SetErrorCode(interp, "TCL", "ZIPFS", "UNSUPPORTED_OP", NULL);
@@ -4644,9 +4613,8 @@ ZipFSFileAttrsSetProc(
static Tcl_Obj *
ZipFSFilesystemPathTypeProc(
Tcl_Obj *pathPtr)
TCL_UNUSED(Tcl_Obj *) /*pathPtr*/)
{
(void)pathPtr;
return Tcl_NewStringObj("zip", -1);
}
@@ -4928,18 +4896,20 @@ ZipfsExitHandler(
int
TclZipfs_AppHook(
#ifdef SUPPORT_BUILTIN_ZIP_INSTALL
int *argcPtr, /* Pointer to argc */
#else
TCL_UNUSED(int *), /*argcPtr*/
#endif
#ifdef _WIN32
WCHAR
TCL_UNUSED(WCHAR ***)) /* argvPtr */
#else /* !_WIN32 */
char
char ***argvPtr) /* Pointer to argv */
#endif /* _WIN32 */
***argvPtr) /* Pointer to argv */
{
char *archive;
#ifdef _WIN32
(void)argvPtr;
Tcl_FindExecutable(NULL);
#else
Tcl_FindExecutable((*argvPtr)[0]);
@@ -5043,8 +5013,6 @@ TclZipfs_AppHook(
#ifdef _WIN32
Tcl_DStringFree(&ds);
#endif /* _WIN32 */
#else
(void)argcPtr;
#endif /* SUPPORT_BUILTIN_ZIP_INSTALL */
}
return TCL_OK;
+10 -6
View File
@@ -160,7 +160,7 @@ typedef struct {
static Tcl_CmdDeleteProc ZlibStreamCmdDelete;
static Tcl_DriverBlockModeProc ZlibTransformBlockMode;
static Tcl_DriverCloseProc ZlibTransformClose;
static Tcl_DriverClose2Proc ZlibTransformClose;
static Tcl_DriverGetHandleProc ZlibTransformGetHandle;
static Tcl_DriverGetOptionProc ZlibTransformGetOption;
static Tcl_DriverHandlerProc ZlibTransformEventHandler;
@@ -205,7 +205,7 @@ static void ZlibTransformTimerRun(void *clientData);
static const Tcl_ChannelType zlibChannelType = {
"zlib",
TCL_CHANNEL_VERSION_5,
ZlibTransformClose,
TCL_CLOSE2PROC,
ZlibTransformInput,
ZlibTransformOutput,
NULL, /* seekProc */
@@ -213,7 +213,7 @@ static const Tcl_ChannelType zlibChannelType = {
ZlibTransformGetOption,
ZlibTransformWatch,
ZlibTransformGetHandle,
NULL, /* close2Proc */
ZlibTransformClose, /* close2Proc */
ZlibTransformBlockMode,
NULL, /* flushProc */
ZlibTransformEventHandler,
@@ -1920,7 +1920,7 @@ Tcl_ZlibAdler32(
static int
ZlibCmd(
void *dummy,
TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1939,7 +1939,6 @@ ZlibCmd(
CMD_ADLER, CMD_COMPRESS, CMD_CRC, CMD_DECOMPRESS, CMD_DEFLATE,
CMD_GUNZIP, CMD_GZIP, CMD_INFLATE, CMD_PUSH, CMD_STREAM
};
(void)dummy;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "command arg ?...?");
@@ -2896,11 +2895,16 @@ ZlibStreamHeaderCmd(
static int
ZlibTransformClose(
void *instanceData,
Tcl_Interp *interp)
Tcl_Interp *interp,
int flags)
{
ZlibChannelData *cd = (ZlibChannelData *)instanceData;
int e, written, result = TCL_OK;
if ((flags & (TCL_CLOSE_READ | TCL_CLOSE_WRITE)) != 0) {
return EINVAL;
}
/*
* Delete the support timer.
*/
+1 -1
View File
@@ -3452,7 +3452,7 @@ proc ::tcl::clock::ReadZoneinfoFile {fileName fname} {
set times [linsert $times 0 $MINWIDE]
set codes {}
foreach c $tempCodes {
lappend codes [expr { $c & 0xff }]
lappend codes [expr { $c & 0xFF }]
}
set codes [linsert $codes 0 0]
+5 -5
View File
@@ -152,14 +152,14 @@ namespace eval ::tcl::idna {
# Increase delta enough to advance the decoder's <n,i> state to
# <m,0>, but guard against overflow:
if {$m-$n > (0xffffffff-$delta)/($h+1)} {
if {$m-$n > (0xFFFFFFFF-$delta)/($h+1)} {
throw {PUNYCODE OVERFLOW} "overflow in delta computation"
}
incr delta [expr {($m-$n) * ($h+1)}]
set n $m
foreach ch $in {
if {$ch < $n && ([incr delta] & 0xffffffff) == 0} {
if {$ch < $n && ([incr delta] & 0xFFFFFFFF) == 0} {
throw {PUNYCODE OVERFLOW} "overflow in delta computation"
}
@@ -251,7 +251,7 @@ namespace eval ::tcl::idna {
set first 0
break
}
if {[set w [expr {$w * ($base - $t)}]] > 0x7fffffff} {
if {[set w [expr {$w * ($base - $t)}]] > 0x7FFFFFFF} {
throw {PUNYCODE OVERFLOW} \
"excessively large integer computed in digit decode"
}
@@ -261,11 +261,11 @@ namespace eval ::tcl::idna {
# i was supposed to wrap around from out+1 to 0, incrementing n
# each time, so we'll fix that now:
if {[incr n [expr {$i / $out}]] > 0x7fffffff} {
if {[incr n [expr {$i / $out}]] > 0x7FFFFFFF} {
throw {PUNYCODE OVERFLOW} \
"excessively large integer computed in character choice"
} elseif {$n > $max_codepoint} {
if {$n >= 0x00d800 && $n < 0x00e000} {
if {$n >= 0x00D800 && $n < 0x00E000} {
# Bare surrogate?!
throw {PUNYCODE NON_BMP} \
[format "unsupported character U+%06x" $n]
+1 -1
View File
@@ -12,7 +12,7 @@ apply {{dir} {
0 tcl::idna 1.0.1 {cookiejar idna.tcl}
0 platform 1.0.14 {platform platform.tcl}
0 platform::shell 1.1.4 {platform shell.tcl}
1 tcltest 2.5.1 {tcltest tcltest.tcl}
1 tcltest 2.5.3 {tcltest tcltest.tcl}
} {
if {$isafe && !$safe} continue
package ifneeded $package $version [list source [file join $dir {*}$file]]
+1 -1
View File
@@ -9,4 +9,4 @@
# full path name of this file's directory.
if {![package vsatisfies [package provide Tcl] 8.5-]} {return}
package ifneeded tcltest 2.5.2 [list source [file join $dir tcltest.tcl]]
package ifneeded tcltest 2.5.3 [list source [file join $dir tcltest.tcl]]
+3 -2
View File
@@ -22,7 +22,7 @@ namespace eval tcltest {
# When the version number changes, be sure to update the pkgIndex.tcl file,
# and the install directory in the Makefiles. When the minor version
# changes (new feature) be sure to update the man page as well.
variable Version 2.5.2
variable Version 2.5.3
# Compatibility support for dumb variables defined in tcltest 1
# Do not use these. Call [package provide Tcl] and [info patchlevel]
@@ -3107,11 +3107,12 @@ proc tcltest::removeFile {name {directory ""}} {
set fullName [file join $directory $name]
DebugPuts 3 "[lindex [info level 0] 0]: removing $fullName"
set idx [lsearch -exact $filesMade $fullName]
set filesMade [lreplace $filesMade $idx $idx]
if {$idx == -1} {
DebugDo 1 {
Warn "removeFile removing \"$fullName\":\n not created by makeFile"
}
} else {
set filesMade [lreplace $filesMade $idx $idx]
}
if {![file isfile $fullName]} {
DebugDo 1 {
+5 -2
View File
@@ -12,6 +12,7 @@
*/
#include "tclPort.h"
#include "tclInt.h"
#ifdef HAVE_COREFOUNDATION
#include <CoreFoundation/CoreFoundation.h>
@@ -162,6 +163,8 @@ OpenResourceMap(
*----------------------------------------------------------------------
*/
#if !defined(TCL_NO_DEPRECATED) && (TCL_MAJOR_VERSION < 9)
#undef Tcl_MacOSXOpenBundleResources
int
Tcl_MacOSXOpenBundleResources(
Tcl_Interp *interp,
@@ -173,6 +176,7 @@ Tcl_MacOSXOpenBundleResources(
return Tcl_MacOSXOpenVersionedBundleResources(interp, bundleName, NULL,
hasResourceFile, maxPathLen, libraryPath);
}
#endif
/*
*----------------------------------------------------------------------
@@ -197,7 +201,7 @@ Tcl_MacOSXOpenBundleResources(
int
Tcl_MacOSXOpenVersionedBundleResources(
Tcl_Interp *dummy,
TCL_UNUSED(Tcl_Interp *),
const char *bundleName,
const char *bundleVersion,
int hasResourceFile,
@@ -208,7 +212,6 @@ Tcl_MacOSXOpenVersionedBundleResources(
CFBundleRef bundleRef, versionedBundleRef = NULL;
CFStringRef bundleNameRef;
CFURLRef libURL;
(void)dummy;
libraryPath[0] = '\0';
+5 -9
View File
@@ -755,7 +755,7 @@ StartNotifierThread(void)
void
Tcl_FinalizeNotifier(
ClientData clientData) /* Not used. */
ClientData clientData)
{
ThreadSpecificData *tsdPtr;
@@ -942,11 +942,9 @@ Tcl_SetTimer(
static void
TimerWakeUp(
CFRunLoopTimerRef timer,
void *info)
TCL_UNUSED(CFRunLoopTimerRef),
TCL_UNUSED(ClientData))
{
(void)timer;
(void)info;
}
/*
@@ -1450,12 +1448,11 @@ QueueFileEvents(
static void
UpdateWaitingListAndServiceEvents(
CFRunLoopObserverRef observer,
TCL_UNUSED(CFRunLoopObserverRef),
CFRunLoopActivity activity,
void *info)
{
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)info;
(void)observer;
if (tsdPtr->sleeping) {
return;
@@ -1830,14 +1827,13 @@ TclUnixWaitForFile(
static TCL_NORETURN void
NotifierThreadProc(
ClientData dummy) /* Not used. */
TCL_UNUSED(ClientData))
{
ThreadSpecificData *tsdPtr;
fd_set readableMask, writableMask, exceptionalMask;
int i, numFdBits = 0, polling;
struct timeval poll = {0., 0.}, *timePtr;
char buf[2];
(void)dummy;
/*
* Look for file events and report them to interested threads.
+1 -1
View File
@@ -49,7 +49,7 @@ proc _test_out_total {} {
return
}
set mintm 0x7fffffff
set mintm 0x7FFFFFFF
set maxtm 0
set nettm 0
set wtm 0

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