Compare commits

...
287 Commits
Author SHA1 Message Date
dgp eb5163d9e8 merge 8.7 2020-01-17 15:37:22 +00:00
jan.nijtmans 37ad5db296 Merge 8.6 2020-01-17 08:54:21 +00:00
jan.nijtmans 9169847966 Fix [8cd2fe7474]: "unload" command Bug (when handling multiple libs) 2020-01-17 08:53:29 +00:00
jan.nijtmans eb08a10e38 Fix [8cd2fe7474]: "unload" command Bug (when handling multiple libs) 2020-01-17 08:51:38 +00:00
jan.nijtmans d59509dee2 Proposed fix for [8cd2fe7474]: "unload" command Bug (when handling multiple libs) 2020-01-16 14:16:48 +00:00
jan.nijtmans 3101fc1da1 Merge-mark 8.6. Remove a few "break"'s added in the previous commit, because they are redundant. 2020-01-15 10:21:02 +00:00
jan.nijtmans 9a78221b8d A few more "break" statements, so any compiler knows these are no FALLTHROUGH situations. 2020-01-15 10:07:46 +00:00
jan.nijtmans 939c35f568 A few more "break" statements, so any compiler knows these are no FALLTHROUGH situations. 2020-01-14 09:09:50 +00:00
jan.nijtmans 41e035d59b Merge 8.6 2020-01-13 15:20:03 +00:00
jan.nijtmans 46a6094df7 Fix [cff53cf7d0]: Failed test oo-0.9 in file oo.test in Tcl8.6.10 2020-01-13 15:19:08 +00:00
jan.nijtmans a8e3a2a3a8 Merge 8.6 2020-01-13 12:47:13 +00:00
jan.nijtmans 6a4eb9df57 Add ${LDFLAGS} to MAKE_LIB. This handles the possibility of adding LDFLAGS=?? on the "configure" commandline. Suggested by Pietro Cerutti. Thanks! 2020-01-13 12:17:09 +00:00
jan.nijtmans f468073bd5 Merge 8.6 2020-01-13 10:44:25 +00:00
jan.nijtmans 997e0f3505 Fix [0b9332722a]: Support utf-8 on Windows console 2020-01-13 10:01:30 +00:00
jan.nijtmans f3070aa2fc Silence some gcc-9 compiler warnings. 2020-01-13 10:00:03 +00:00
jan.nijtmans 2d27c96b7e tommath_private.h : Remove special C4146 handling: already done in tclWinPort.h too.
tcl.pc.in:  Make sure that libtommath >= 1.2.0
2020-01-10 15:18:36 +00:00
jan.nijtmans f608fa90db Put "-ltommath" in $MATH_LIBS in stead of $LIBS, so it won't be used by other checks in the configure script. Suggested by Pietro Cerutti. 2020-01-09 09:27:09 +00:00
dgp f7076c6ce8 merge 8.7 2020-01-08 23:00:06 +00:00
dgp 8ef7bd41b6 Improvements to doc changes from TIPs 422 and 512. 2020-01-08 22:25:36 +00:00
dgp 0d799f84b3 s/in stead/instead/ 2020-01-08 21:40:10 +00:00
dgp d1f6dc44aa s/in stead/instead/ 2020-01-08 21:39:12 +00:00
dgp 6804338322 merge 8.6 2020-01-08 21:10:10 +00:00
dgp 780f439396 Remove another mention of interp->result. 2020-01-08 16:53:25 +00:00
dgp 0215962576 Revise documentation that refers to direct access to interp->result. 2020-01-08 14:23:06 +00:00
jan.nijtmans 0c195b760a Merge 8.6 2020-01-08 13:16:49 +00:00
jan.nijtmans 0df818c01f Use _copysign on Windows always (available from float.h). Use mp_iszero() whenever appropriate. 2020-01-08 12:51:29 +00:00
jan.nijtmans 3b3abe0ce1 Code cleanup (mostly comments, backported from 8.6). 2020-01-08 11:53:03 +00:00
jan.nijtmans 4afa382971 Merge 8.7 2020-01-07 15:44:16 +00:00
jan.nijtmans 49a7184962 Don't use "operator" as variable name, as it is a keyword in C++.
Add some break statements, so Tcl can be compiled warning-free with gcc-7's -Wimplicit-fallthrough
A few better indications of unused (dummy) functions parameters.
2020-01-07 14:42:15 +00:00
jan.nijtmans 7c23c57789 Some eol whitespace eliminations 2020-01-07 14:32:16 +00:00
jan.nijtmans 7d90738e3a One more place where the (deprecated) "unicode" encoding was still used. 2020-01-07 12:18:51 +00:00
jan.nijtmans d92cffaa0c Remove type-casts in many Tcl_LinkVar() calls, which is no longer necessary since 8.7.
Small missing piece in Tcl_LinkArray() implementation, handling (unsigned) longs on 64-bit platforms.
2020-01-07 09:24:19 +00:00
jan.nijtmans 0bf39185fb Fix test encoding-28.0, adapting for the correct number of available encodings 2020-01-07 08:35:34 +00:00
dgp 1923110631 one more 2020-01-06 20:24:25 +00:00
dgp c187695b61 Bring docs up to date with TIP 330 and TIP 336 changes already in Tcl 8.7 2020-01-06 20:12:32 +00:00
dgp edcdd9afe1 Missing bit of interp->result deprecation. 2020-01-06 18:07:43 +00:00
dgp f140e958c5 Remove "new in 8.6" marks from the docs in the 8.7 branch. 2020-01-06 17:26:05 +00:00
dgp b0db0ad956 remove 'new in 8.5' marks in docs 2020-01-06 17:17:58 +00:00
dgp 6dcb4cb65c Remove the "new in 8.5" markings from the 8.6 branch of docs. 2020-01-06 17:17:11 +00:00
jan.nijtmans 4c14bc7964 Fix typo: "==" -> "=" 2020-01-06 11:02:12 +00:00
jan.nijtmans 16deae9be1 Merge-mark 2020-01-06 10:50:18 +00:00
jan.nijtmans 8d01cecc9a (cherry-pick): Fix issue [9128866ec8448752] by adding Line Feed character to tis-620.enc. 2020-01-06 10:48:04 +00:00
jan.nijtmans 4bea353255 Merge 8.6 2020-01-06 10:40:14 +00:00
jan.nijtmans 2595be3dfe Merge 8.5 2020-01-06 10:34:16 +00:00
jan.nijtmans 1ccdd5f186 Don't assume/set LDFLAGS being "", it could be set on the "configure" command-line.
Remove "test-packages" test-target (which doesn't exist), but add "test-tcl" being the same as "test".
2020-01-06 10:28:28 +00:00
dgp b60f173c37 Tcl_TransferResult was new in 8.6, so mark the man page with that version. 2020-01-05 19:41:04 +00:00
dgp 3dae54c810 formatting typo and rewrite 2020-01-05 19:18:30 +00:00
dgp 5f46a6c4a7 Rewrite: lead paragraph with name of documented routine. 2020-01-05 19:16:33 +00:00
dgp a75f6ac8ce Fix documentation, comments, and argument names of Tcl_TransferResult(). 2020-01-05 19:03:12 +00:00
pooryorick ac2be8e353 Add a test for issue [9128866ec8], encoding fails to load 2020-01-04 17:21:53 +00:00
pooryorick 0cd25f6ca2 merge 8.6 2020-01-04 14:51:40 +00:00
pooryorick b873f56401 Fix issue [9128866ec8448752] by adding Line Feed character to tis-620.enc. 2020-01-04 14:34:36 +00:00
fvogel 0188ad7082 Restore the build by providing a copysign replacement for old MSVC versions. 2020-01-02 21:00:22 +00:00
fvogel 019eea55c0 Restore the build by providing a copysign replacement for old MSVC versions. 2020-01-02 20:56:46 +00:00
fvogel 158c112e03 Restore the build by providing a copysign replacement for old MSVC versions. 2020-01-02 20:56:20 +00:00
dkf 30d15963da Fixed index line 2019-12-30 16:24:29 +00:00
Kevin B Kenny ccc57bc577 Merge Tcl 8.6 changes to deal with integer overflow in the exponent, and floating point overflow in the significand, of floating point input conversion (Bug [1de6b0629e] 2019-12-27 00:23:49 +00:00
Kevin B Kenny 8140d238ea Merge Tcl 8.5 changes to deal with integer overflow in the exponent, and floating point overflow in the significand, of floating point input conversion (Bug [1de6b0629e] 2019-12-27 00:12:58 +00:00
Kevin B Kenny f7d1daa7fd Merge changes to deal with integer overflow in the exponent, and floating point overflow in the significand, of floating point input conversion (Bug [1de6b0629e] 2019-12-27 00:03:41 +00:00
Kevin B Kenny ba0a3a3dd2 Add test cases that used to cause floating point overflow in computing the correction term in floating point input conversion. Fix exponent overflow in floating point input conversion, and floating-point overflow in the significand in input conversion. 2019-12-26 23:54:03 +00:00
jan.nijtmans 032451725b Add FALLTHRU markers, eliminating gcc warning using -Wextra 2019-12-24 15:04:57 +00:00
jan.nijtmans 51bf99fdf5 More progress in making clang build on Cygwin warning-free 2019-12-24 13:52:05 +00:00
jan.nijtmans 0f7dc05b52 Make definition of struct mp_int EXACTLY the same as the one in the (modified) tommath.h 2019-12-24 13:51:22 +00:00
jan.nijtmans 2d00a8c17e Put our own included (-I) directories before directories coming in though CFLAGS, so building with external libraries (like libtommath) doesn't possibly corrupt our own build. Reported by Pietro Cerutti 2019-12-24 10:05:40 +00:00
jan.nijtmans cf8d2f27eb Merge 8.6 2019-12-23 13:42:55 +00:00
jan.nijtmans 86e6d287a0 Fix for building Cygwin using Clang. 2019-12-23 13:38:20 +00:00
jan.nijtmans ce2dc4a07d Merge 8.6 2019-12-23 11:27:22 +00:00
jan.nijtmans 1e7fb75229 Workaround for [ce3b9f2b04]: compilation errors with clang (windows msys2) 2019-12-23 11:26:31 +00:00
dgp 63253bc07d Fix parsing bug when (numSigDigs == 0). 2019-12-23 00:54:44 +00:00
dgp 38d9207627 Assign a double literal to a double variable. No point in requiring conversion. 2019-12-22 23:48:00 +00:00
dgp e52a22ff57 Tests for another parsing bug. 2019-12-22 18:44:45 +00:00
jan.nijtmans 7b099b30d8 Merge 8.6 2019-12-22 14:55:25 +00:00
jan.nijtmans 834ee2dd0d Minor optimization in TclFormatInt: No need to check for "0" as special value. No need to include final NULL-byte in character-reversion operation, as we already known the NULL-byte will come last. 2019-12-22 14:52:33 +00:00
dgp 1f81e5eb51 Tests demonstrating the number parsing overflow bugs. 2019-12-21 14:19:08 +00:00
jan.nijtmans f3e5dd7a04 Prevent double definition of MODULE_SCOPE on Darwin 2019-12-20 16:13:36 +00:00
jan.nijtmans 8e18ac6cf7 Update travis build fro xcode11 to xcode11.3 as highest platform 2019-12-20 15:23:26 +00:00
jan.nijtmans 14a974e2d0 Merge 8.7. Exclude 4 test-cases in TCL_NO_DEPRECATED mode, because they are not supposed to work then 2019-12-19 22:26:37 +00:00
jan.nijtmans 2a08be49c2 Merge 8.6 2019-12-19 22:12:19 +00:00
jan.nijtmans 588a92ec6b Merge 8.5 2019-12-19 22:11:01 +00:00
jan.nijtmans 6fa04d74e0 Add type-cast, making sure that the unary minus is handled correctly on any compiler 2019-12-19 22:09:46 +00:00
jan.nijtmans 2c3a603e13 Merge 8.6 2019-12-19 22:04:09 +00:00
jan.nijtmans a0f11eae42 Merge 8.5 2019-12-19 21:31:05 +00:00
jan.nijtmans 88e4842dfe Put back 4 test-cases as they were in core-8-branch, but only for TCL_UTF_MAX=3 2019-12-17 23:14:53 +00:00
jan.nijtmans 3a7b07be0d Better fix for [3390638]: making the intVal variable unsigned prevents the need for using sprintf() altogether. 2019-12-16 10:09:40 +00:00
jan.nijtmans dbd3d4eff0 Only use OPTS=msvcrt in combination with "static", otherwise it's a NOOP. Disable pragma warning:C4146 (backported from 8.6), since it only gives misleading warnings. 2019-12-16 10:08:07 +00:00
jan.nijtmans 899310175d Merge 8.7 2019-12-14 17:46:34 +00:00
jan.nijtmans 4e6d44d0e6 Merge 8.6 2019-12-14 17:43:22 +00:00
jan.nijtmans ea5ed28162 Make win/configure work with CC=g++ (doesn't actually work with Tcl and Tk yet) 2019-12-14 17:36:09 +00:00
jan.nijtmans 72b3895d8b Merge 8.7 2019-12-14 14:08:54 +00:00
jan.nijtmans 59f4600ec3 One #undef too much 2019-12-13 22:18:40 +00:00
jan.nijtmans de326e5c5e Don't export mp_sqr() directly from libtcl 2019-12-13 21:48:15 +00:00
jan.nijtmans 230886d1fe Merge 8.7 2019-12-13 21:27:52 +00:00
jan.nijtmans 9eeefad066 Optimize mp_mul for the case a==b 2019-12-13 21:16:44 +00:00
jan.nijtmans 8ddd0ca822 Merge 8.7 2019-12-13 15:41:16 +00:00
jan.nijtmans 4cef9fbbe2 merge-mark 2019-12-13 15:13:15 +00:00
jan.nijtmans 3fb9396959 Fix Travis build for MSVC Debug mode 2019-12-13 15:12:29 +00:00
jan.nijtmans 6fdc83ae14 Implement TIP's #538: Externalize libtommath 2019-12-13 11:05:43 +00:00
jan.nijtmans db35fe50e9 Little code tweaks, regarding the use of TCL_UTF_MAX or wchar_t. 2019-12-12 21:38:46 +00:00
jan.nijtmans 9ef936369e merge-mark 2019-12-12 21:05:16 +00:00
jan.nijtmans 3701dc242d Add 3 (libtommath) functions to the stub table. Will be added to 8.7 too, through TIP #538 2019-12-12 21:02:48 +00:00
jan.nijtmans f70589ae3e Add many missing constraints 2019-12-12 13:12:29 +00:00
jan.nijtmans e3f42b0c1a Little doc tweak 2019-12-12 08:23:58 +00:00
jan.nijtmans f8474f319c Implement "panic" as described in the TIP 2019-12-11 12:41:00 +00:00
jan.nijtmans 81d54e6432 Merge 8.7 2019-12-11 08:55:48 +00:00
jan.nijtmans 1d6a94f9f8 Fix bug in tclEncoding.c, only manifesting in testcase encoding-15.4 for TCL_UTF_MAX=6. (knownBug, fixed now) 2019-12-11 08:52:58 +00:00
jan.nijtmans 86c130f239 Merge 8.6 2019-12-10 13:42:52 +00:00
jan.nijtmans db4a693d72 Fix [5f236bc67a]: valgrind report for Tcl_UniCharToUtf. Also add test-cases for more corner-cases. 2019-12-10 13:16:48 +00:00
sebres 4a214309b2 merge 8.6 2019-12-10 13:15:48 +00:00
sebres 5caaa0f557 amend to [2cf1202807]: find the hooks in tcltest namespace only 2019-12-10 12:45:09 +00:00
jan.nijtmans a7212b0557 Undo accidental change in [343273c9de4fd4f1] 2019-12-09 22:48:56 +00:00
jan.nijtmans 216a1d1937 Attempt to fix [5f236bc67a]: valgrind report for Tcl_UniCharToUtf 2019-12-09 19:36:21 +00:00
sebres 19e564ab89 remove unneeded import (for >= 8.7) 2019-12-09 11:42:57 +00:00
jan.nijtmans 54b0e77083 Merge 8.6 2019-12-09 11:31:25 +00:00
sebres c66173309f merge 8.5 (timing issue avoidance, skip test in runtime feature) 2019-12-09 10:40:04 +00:00
sebres f9490c56c6 small amend (whitespace, no functional) 2019-12-09 10:30:19 +00:00
sebres c8634b0b9e tcltest: hook enhancements rewritten backwards compatible now, reverts [0067db1bbf], [0f3d6f90f0], [b8be012969], [375a566d22] 2019-12-09 10:26:23 +00:00
jan.nijtmans 37f6a196c5 Fix [abd4abedd2]: Failed to build tk 8.6.10 with cross compile 2019-12-09 10:02:20 +00:00
jan.nijtmans fea9c41d92 Add special handling of lower surrogate to UtfToUtfProc(), so valgrind should't complain in that situation. With new test-cases covering that. 2019-12-09 09:59:02 +00:00
jan.nijtmans 1121106257 Merge 8.7 2019-12-08 16:58:26 +00:00
jan.nijtmans 39bf69006a Merge 8.6Merge 8.6 2019-12-08 16:49:34 +00:00
jan.nijtmans d67affb100 Fix Valgrind problem reported as follow-up in [fc4393e9b0]. Since it happens only for TCL_UTF_MAX>3 it's not actully a 'bug' in 8.6, but it might be a corner-case not handled well in 8.7 2019-12-08 16:33:18 +00:00
jan.nijtmans 6d5473da30 merge-mark 2019-12-07 18:25:58 +00:00
jan.nijtmans bf4f51ce78 Fix 2 test-cases, which were failing when TCL_UTF_MAX=6. Add UTF_MAX=6 UNIX build to Travis as proof that now all test-cases pass for UTF_MAX=6 (still not officially supported) 2019-12-07 18:23:41 +00:00
sebres 74b0c7c91a rewrite of [dff608952b]: skip tests if there is really a timing issue (and implements new feature ::tcltest::Skip which allows conditionally skipping of tests at runtime) 2019-12-06 16:42:19 +00:00
jan.nijtmans 364ba5e8b9 Exclude some test-cases with possible timing problems on Windows. Double ;; in generic/tclTimer.c 2019-12-06 14:51:39 +00:00
jan.nijtmans 5aef84d1f4 Merge 8.6 2019-12-06 14:38:28 +00:00
jan.nijtmans f67bef714e Unnecessary double ;; in tclTimer.c. Update compat/zlib to exactly the same content as in the core-8-branch branch. 2019-12-06 14:35:10 +00:00
jan.nijtmans e2ecc3c090 merge-mark 2019-12-06 13:47:34 +00:00
jan.nijtmans a84aa656ee Fix some test-cases when Tcl is compiled with -DTCL_UTF_MAX=6. Not officially supported but used by Androwish. The test-cases prove that "unicode" should be UTF-16 actually for all TCL_UTF_MAX values. 2019-12-06 13:43:25 +00:00
jan.nijtmans 7d17ab9a13 Merge 8.6 2019-12-04 13:26:53 +00:00
jan.nijtmans 0acc700234 Add builds using TCL_UTF_MAX=4 on Windows. Not officially supported, but used by Androwish. Also alphabetise some options in win/makefile.vc and win/rules.vc 2019-12-04 12:54:39 +00:00
jan.nijtmans d02ab64fa2 Use the right encoding when converting (Unicode) messages regarding socket errors on Windows. Some code cleanup in win/tclWinfile.c. 2019-12-04 12:53:25 +00:00
jan.nijtmans 29b775c36a Remove Travis's Clang builds using TCL_UTF_MAX!=4. Too little difference with the corresponding GCC builds to be useful. 2019-12-03 19:30:19 +00:00
jan.nijtmans 40938f72a2 Add build using gcc and TCL_UTF_MAX=4 to Travis build. Not officially supported but used by Androwish. Remove "threads" designator on Windows, since it's already default. 2019-12-03 19:24:05 +00:00
jan.nijtmans 4a5f73e338 Merge 8.7 2019-12-03 16:13:29 +00:00
jan.nijtmans 28d5df364e Merge 8.6 2019-12-03 13:21:32 +00:00
jan.nijtmans 678d2103f9 Fix encoding-15.6 testacase for TCL_UTF_MAX=6, due to changes escape sequences for upper/lower surrogate combination. 2019-12-03 13:20:47 +00:00
jan.nijtmans c4990c8bf6 Merge 8.6 2019-12-03 12:58:25 +00:00
jan.nijtmans 9e0083e9f0 Fix [3cd9bea1e6]: check-in [43032d7ba3] potential problems. Also don't allow surrogates in \U?????? syntax. 2019-12-03 12:27:42 +00:00
pooryorick 3c7bb58fb9 merge 8.6 2019-12-02 22:07:33 +00:00
pooryorick 36f4518f89 Add tcltest::CleanupTest to make it easier to customize behaviour. 2019-12-02 22:04:41 +00:00
jan.nijtmans cfb43a5a2c Merge 8.6 2019-12-02 20:48:35 +00:00
jan.nijtmans 4f6ea8aef9 If TCL_UTF_MAX>=4, make Tcl_ParseBackslash combine two surrogates so they appear as one 4-byte UTF-8 byte sequence from the start. Add test-case for this. 2019-12-02 20:26:58 +00:00
dgp a42ecfa12e Bump to 8.7a4 to distinguish development from 8.7a3 release. 2019-12-02 18:15:07 +00:00
jan.nijtmans eadbf37f4e Fix [a46a49b90f]: tests http-cookiejar-1.[12] fail 2019-12-02 13:28:46 +00:00
jan.nijtmans 8e1f9bb6d1 Eliminate excess eol-spacing 2019-12-02 10:58:19 +00:00
jan.nijtmans a86677ebd5 Merge 8.6 2019-12-02 10:52:45 +00:00
jan.nijtmans 90493b4012 Renumber tcltest from 2.5.1 -> 2.5.2, already for next release. 2019-12-02 10:49:11 +00:00
jan.nijtmans d6a3244d18 More eol-spacing 2019-12-02 10:48:01 +00:00
jan.nijtmans f7e46677b5 Eliminate unneccessary eol-spacing from documentation. 2019-12-02 10:47:00 +00:00
jan.nijtmans db669f381b Fix make install on Ubuntu (and - most likely - other platforms) 2019-12-01 21:25:32 +00:00
jan.nijtmans 6cc489aa4f Merge 8.7 2019-12-01 20:04:10 +00:00
pooryorick 506589f483 Add tcltest::EvalTest to make it easier to customize behaviour. 2019-12-01 19:45:54 +00:00
jan.nijtmans bd7870ec5f Fix executable flag 2019-12-01 17:52:17 +00:00
pooryorick 7363d850a9 merge 8.6 2019-12-01 13:52:06 +00:00
pooryorick d138d28133 Fix tcltest::SetupTest added in previous commit. 2019-12-01 13:48:48 +00:00
pooryorick af1ecf410e merge 8.6 2019-12-01 12:16:04 +00:00
pooryorick 3435c9713f add tcltest::SetupTest to make it easier to customize the -setup step of a test 2019-12-01 11:59:41 +00:00
jan.nijtmans 09abed41d6 merge-mark 2019-11-29 12:29:18 +00:00
jan.nijtmans 332401e645 Add some new test-cases involving e.g. Unicode 11. Backported from Tcl 8.7a3 2019-11-29 12:27:00 +00:00
jan.nijtmans 17a9125415 Merge 8.7 2019-11-29 09:52:54 +00:00
jan.nijtmans 800a3f62b3 Fix one failing testcase (thanks, Travis!) 2019-11-29 09:52:09 +00:00
jan.nijtmans e4704dda2f Merge 8.7 2019-11-28 14:14:29 +00:00
jan.nijtmans a5162e47d5 Merge 8.6 2019-11-28 13:15:44 +00:00
jan.nijtmans 122bb72a66 Enhance rules.vc like already done in other configure scripts: Determine HAVE_STDINT_H/HAVE_INTTYPES_H/HAVE_STDBOOL_H/MP_NO_STDINT the simple way, just by compiler version. 2019-11-28 12:53:38 +00:00
jan.nijtmans bc00595941 Give cookiejar en tcl::idna a 3-part version number. Use 0.2.0 for cookiejar and 1.0.1 for tcl::idna.
"make install" and "make install-libraries" should now (finally) work fine for all platforms, both with configure/make and nmake.
2019-11-28 12:36:22 +00:00
jan.nijtmans 7c405f2e81 Merge 8.5 (Update opt package from 0.4.6 to 0.4.7).
Also fix installation of opt0.4 as done by makefile.vc, which never worked in Tcl 8.6.
2019-11-28 11:35:51 +00:00
jan.nijtmans d473f1507c Update "opt" from version 0.4.5 to 0.4.7, backported from Tcl 8.7a3. 2019-11-28 10:54:21 +00:00
jan.nijtmans 0e57f61ede (hopefully) fix installation on Windows 2019-11-27 22:20:48 +00:00
jan.nijtmans 4ab699dc03 Merge 8.7. Tweak makefile.vc for detection of stdint.h/inttypes.h/stdbool.h 2019-11-27 21:09:36 +00:00
jan.nijtmans 0c50d57d08 Another minor tweak: No need to include manifest.txt in the vfs zip-file, since it's renamed to pkgIndex.tcl 2019-11-27 20:15:50 +00:00
jan.nijtmans 38e41ac6ef Merge 8.7, and take over some fixes for VC++ 6.0 from Sebres. 2019-11-27 14:41:11 +00:00
jan.nijtmans 9a80393d63 Minor tweak: Don't include the "dde" and "reg" directory in the zip-file on UNIX 2019-11-27 14:25:47 +00:00
sergey.brester 87934d6db3 merge digit-bit-60 2019-11-27 13:43:36 +00:00
sergey.brester dd334ec3d0 fixes compile errors for old VC versions, as well as tommath include path, there are two files with this name and wrapper "generic/tommath.h" gets included, but "libtommath/tommath.h" is never included, because did not addressed directly with this name (first from path wins). 2019-11-27 13:38:37 +00:00
jan.nijtmans f5464908a6 Move check for stdbool.h from SC_MISSING_POSIX_HEADERS to SC_CONFIG_CFLAGS, since it's not POSIX. 2019-11-27 12:14:57 +00:00
jan.nijtmans 37a548351b Merge 8.6 2019-11-27 11:09:33 +00:00
dkf d9f8a23002 Proposed Windows installation code for cookiejar package 2019-11-27 11:01:38 +00:00
jan.nijtmans 1b760ca1a5 Merge 8.5 2019-11-27 10:25:49 +00:00
jan.nijtmans 627fe239a5 Don't bother paths of 64-bit SDK any more: This was Visual Studio 2008-specific and doesn't work with other Visual Studio versions. 2019-11-27 09:44:17 +00:00
jan.nijtmans 9eaa827e59 Merge 8.7 2019-11-26 22:49:05 +00:00
jan.nijtmans 94206b30ff Merge 8.7 2019-11-26 22:42:59 +00:00
jan.nijtmans d8a1ef0827 Fix installation of cookiejar on UNIX, and add same pieces to windows as well. Also modify manifext.txt accordingly, for the zipfile vfs. 2019-11-26 21:35:52 +00:00
dgp e5e3156e56 merge release 2019-11-26 17:35:08 +00:00
dgp 5d1722aaf1 Accept repackaging and distribution of http::cookiejar for Tcl 8.7a3. 2019-11-26 16:29:12 +00:00
jan.nijtmans e92bcc6be3 Merge 8.7a3 2019-11-26 08:11:37 +00:00
dgp cf9edc4a1d merge 8.7 2019-11-25 18:08:50 +00:00
jan.nijtmans a5549e4cd2 Tweak visibility of some libtommath symbols and add --with-system-libtommath configure option (as requested by Pietro Cerutti) 2019-11-25 16:34:20 +00:00
jan.nijtmans b7e4a9f65b Merge 8.7 rc branch 2019-11-23 20:49:55 +00:00
dgp 20ce24d285 merge 8.7 2019-11-22 15:18:54 +00:00
jan.nijtmans 76f04364e3 Undo minor tweak, no longer necessary 2019-11-22 13:33:53 +00:00
jan.nijtmans 3a1186689a Merge 8.7, and update to latest libtommath (support/1.x branch) 2019-11-22 13:26:30 +00:00
jan.nijtmans 9c4252f295 Fix typo in tclTestObj.c 2019-11-20 13:32:00 +00:00
jan.nijtmans b39f1c56d5 Merge 8.7. ignore MP_WUR for mp_neg() calls with equal arguments (even though MP_WUR is not enabled yet) 2019-11-18 21:41:18 +00:00
jan.nijtmans 377a4e24ed Formatting 2019-11-18 15:56:11 +00:00
jan.nijtmans 29db2a6761 Some code cleanup. Build with zlib dll on Win32 when using makefile.vc (shared-build only) 2019-11-18 14:40:54 +00:00
jan.nijtmans 37e202ac7d Update makefile.vc and rules.vc for using libtommath.dll/zlib1.dll in stead of statically linking libtommath, whenever possible. 2019-11-18 12:58:55 +00:00
jan.nijtmans f02189588a Merge 8.7. Unbreak travis build with TCL_UTF_MAX=3 2019-11-17 13:39:46 +00:00
dgp 16135b4d33 update changes 2019-11-16 19:57:03 +00:00
dgp 85f552fa8a merge 8.7 2019-11-15 20:20:33 +00:00
dgp 20685407f3 merge 8.7; update changes 2019-11-15 20:01:16 +00:00
jan.nijtmans 84987939c7 Merge 8.7 2019-11-15 15:19:56 +00:00
jan.nijtmans 3ce435c137 Merge 8.7 2019-11-15 14:53:21 +00:00
jan.nijtmans ce1e21eb7c Merge 8.7 2019-11-15 14:20:45 +00:00
dgp c2e61fa00e merge 8.7 2019-11-13 18:24:06 +00:00
dgp 21c4caf8e1 More work on changes. 2019-11-13 17:32:26 +00:00
jan.nijtmans e9559b5cc0 Merge 8.7 2019-11-13 16:11:37 +00:00
jan.nijtmans 9e9a51f3cb Merge 8.7 2019-11-13 16:10:12 +00:00
jan.nijtmans 863dfac9d9 try to install libtommath 1.2.0 through homebrew on MacOS 2019-11-12 22:06:09 +00:00
jan.nijtmans 41e4211a15 Merge 8.7. Finish implementation. 2019-11-12 12:11:05 +00:00
jan.nijtmans 6ce8973116 Merge 8.7 2019-11-11 16:19:46 +00:00
jan.nijtmans e512564f36 Merge 8.7 2019-11-11 14:26:50 +00:00
jan.nijtmans 99cce0ea11 Fix travis build win32, 32-bit mingw 2019-11-08 20:09:46 +00:00
dgp 3b028ddc03 Start updates to changes 2019-11-08 15:11:42 +00:00
dgp b82082f321 merge 8.7 2019-11-07 15:09:23 +00:00
dgp 245f333d52 Merge 8.7. Add files missing from distribution. 2019-11-06 14:35:24 +00:00
dgp 7f6aa30c40 Bump release date 2019-11-05 17:52:33 +00:00
dgp 2ac91d1f8e merge 8.7 2019-11-05 17:51:55 +00:00
jan.nijtmans d010f7c348 More WIP: All makefile builds appear to work fine, makefile.vc build still to be done. 2019-11-05 16:37:52 +00:00
jan.nijtmans 55e2ef9b31 Merge 8.7 2019-11-04 12:10:19 +00:00
jan.nijtmans c848a8872a Add compat/stdint.h, upgrade to libtommath 1.2.0, adapt as much as possible accordingly (still WIP) 2019-11-01 16:15:49 +00:00
jan.nijtmans 01c6f7705f Re-base to core-8-branch 2019-11-01 11:25:03 +00:00
dgp 7732a55113 merge 8.7 2019-10-30 14:27:57 +00:00
jan.nijtmans c8444b192d Merge 8.7 2019-10-28 16:49:32 +00:00
dgp d48eb0305d merge 8.7 2019-10-28 15:37:47 +00:00
dgp 9b08b0169a merge 8.7 2019-10-21 13:13:52 +00:00
jan.nijtmans 3d55f5f6f0 Merge 8.7 2019-10-02 21:40:45 +00:00
dgp b73c0aa0aa merge 8.7 2019-10-02 15:45:36 +00:00
dgp 22d8a012ca merge 8.7 2019-09-25 15:03:42 +00:00
jan.nijtmans 2c327304a1 Merge 8.7 2019-09-25 13:42:11 +00:00
dgp 75bd963079 merge 8.7 2019-09-20 13:28:34 +00:00
dgp 11fdd10d9e merge 8.7 2019-09-18 16:31:13 +00:00
dgp 2ff1a19af2 merge 8.7 2019-09-16 14:50:38 +00:00
dgp 663240b26f merge 8.7 2019-09-13 12:27:17 +00:00
dgp 2975cfd589 merge 8.7 2019-09-11 16:10:10 +00:00
dgp 6f8793bff8 merge 8.7 2019-08-28 12:57:14 +00:00
dgp 278477fcd7 merge 8.7 2019-08-26 16:10:24 +00:00
jan.nijtmans 261bde3156 Eliminate dependency in test-suite on Unicode functions. Merge tip-548. Fix build with -DTCL_NO_DEPRECATED 2019-08-13 21:00:28 +00:00
jan.nijtmans 4b48c76e1c default TCL_UTF_MAX should still be 3 2019-08-12 20:49:50 +00:00
jan.nijtmans 92c04315ff Forgot some changes from tip-548 2019-08-12 20:47:01 +00:00
jan.nijtmans 8ddf96d852 Merge branch tip-548. No longer define addtional stub-entries for functions that will be removed (because of deprecation) anyway 2019-08-12 20:38:09 +00:00
jan.nijtmans 2b096ec26d Merge tip-548 2019-08-02 15:03:45 +00:00
jan.nijtmans 972ac8cc9d Protect Tcl_AToB() functions against NULL input 2019-08-01 21:55:52 +00:00
jan.nijtmans 203f7657fe wrong length in tclMain.c, and wrong #endif 2019-08-01 21:47:01 +00:00
jan.nijtmans 5c8bbdd6d9 Merge tip-548 2019-08-01 21:35:37 +00:00
jan.nijtmans 74f9c831ac Merge tip-548 2019-08-01 11:55:40 +00:00
jan.nijtmans a2d61902c5 Merge tip-548 2019-06-29 14:35:51 +00:00
jan.nijtmans 3d185e117d Merge tip-548 2019-06-29 07:19:50 +00:00
dgp eb64fc3dac merge 8.7 2019-06-27 13:08:45 +00:00
jan.nijtmans 379b57abd7 Merge tip-548 2019-06-27 10:49:29 +00:00
jan.nijtmans 218593d964 Merge tip-548 2019-06-26 21:25:54 +00:00
dgp fe44a8d5e9 merge 8.7 2019-06-17 18:28:39 +00:00
dgp 1fea6044ed merge 8.7 2019-06-12 18:58:35 +00:00
jan.nijtmans d64f20cebe Merge tip-548 2019-06-09 21:18:35 +00:00
jan.nijtmans e2abfe30a7 Merge tip-548 branch. 2019-06-03 21:20:07 +00:00
jan.nijtmans 83661bdca4 Merge tip-547 2019-05-31 23:35:20 +00:00
dgp 9b8f76b445 merge 8.7 2019-05-30 12:14:57 +00:00
jan.nijtmans 58260d444e More simplifications, taking deprecations into account 2019-05-22 21:50:14 +00:00
jan.nijtmans ea5190faaa Merge 8.7 2019-05-22 07:33:13 +00:00
jan.nijtmans d063a23455 More WIP: eliminate all usage of (platform-specific) Tcl_WinTCharToUtf()/Tcl_WinUtfToTChar() to its proposed portable replacements: Tcl_Utf16ToUtfDString()/Tcl_UtfToUtf16DString()
This allows for Tcl_WinTCharToUtf()/Tcl_WinUtfToTChar() to be declared deprecated.
2019-05-22 07:32:37 +00:00
dgp 28cc8c889e merge 8.7 2019-05-17 14:42:44 +00:00
jan.nijtmans f51c5464dc Merge 8.7 2019-05-17 14:22:50 +00:00
jan.nijtmans 3a37a573a2 Merge 8.7 2019-05-13 21:55:28 +00:00
jan.nijtmans 7b90ffbb48 merge 8.7 2019-05-10 07:46:32 +00:00
jan.nijtmans d5c3b7ac25 Complete implementation for MSVC (even building minigzip) 2019-04-10 19:53:39 +00:00
jan.nijtmans fbf45e053a Merge 8.7. Complete implementation for MSVC and for UNIX. 2019-04-09 19:21:38 +00:00
jan.nijtmans bb3ef94985 Merge 8.7. Intended operation completed for mingw-w64 (but not yet for other compilers/platforms) 2019-04-08 19:06:57 +00:00
jan.nijtmans 4865914200 Merge 8.7. Add checks for libtommath library to configure script (experimental) 2019-04-06 20:41:21 +00:00
jan.nijtmans 889e874282 Merge 8.7
Undo Tcl-specific changes in bn_mp_sqrt.c, and re-enable the two disabled test-cases: This proves the observed crash with DIBIT_BIT=60 is caused by those Tcl-specific changes!
2019-04-04 21:31:01 +00:00
jan.nijtmans f9eb1833d2 Merge 8.7 2019-04-03 19:52:38 +00:00
jan.nijtmans 7d8a7adc9f (temporary workaround): Mark expr-47.12 and expr-47.13 as nonPortable: Those are the test-cases failing with DIGIT_BIT=60 on MacOSX but not on other platforms. To be investigated further! 2019-03-31 20:45:46 +00:00
jan.nijtmans d1a1ae5194 Merge 8.7 2019-03-28 22:49:59 +00:00
jan.nijtmans 3664f127cd More complete typedef for mp_word, for MP_8BIT and MP_16BIT as well. 2019-03-28 22:42:56 +00:00
jan.nijtmans b3664a2eaa Experiment: On platforms which support it (gcc), compiled libtommath with DIGIT_BIT=60 2019-03-28 21:44:39 +00:00
jan.nijtmans 388ed8fba7 Merge 8.7 2019-03-24 13:05:07 +00:00
jan.nijtmans ebd469c2a8 Merge 8.7. Also fix invalid reference to TclUtfToWChar, causing build failure 2019-03-21 20:28:49 +00:00
jan.nijtmans d8c1fbed81 Merge 8.7 2019-03-20 22:54:13 +00:00
jan.nijtmans 301062d3fb Add 4 new encodings, and add documentation. 2019-03-18 20:07:15 +00:00
jan.nijtmans 6d0e92b89e More WIP. Seems to be *almost* working. 2019-03-17 22:01:42 +00:00
jan.nijtmans bc2c8431fc Merge 8.7
Move up some stub entries related to Tcl_UniChar
Use TCL_UTF_MAX=4 for full Unicode in stead of TCL_UTF_MAX=6 (TCL_UTF_MAX: 3 is default)
2019-03-16 21:10:20 +00:00
jan.nijtmans 842878d2d0 Merge 8.7.
Fix 2 test-cases which were failing for TCL_UTF_MAX=6
2019-03-14 20:59:28 +00:00
jan.nijtmans da96c53041 Even better support for -DTCL_UTF_MAX=6. Ongoing improvements (TIP being planned) 2019-03-12 20:39:42 +00:00
dgp 03405163b7 merge 8.7 2019-02-25 17:46:36 +00:00
dgp 995a8579cf merge 8.7 2018-12-14 21:33:25 +00:00
dgp e32b5b3f8a merge 8.7 2018-11-19 16:13:52 +00:00
dgp b0122226ed merge 8.7 2018-11-15 18:07:47 +00:00
dgp e326690201 Bump to version 8.7a3 for release. 2018-11-14 17:52:35 +00:00
165 changed files with 3360 additions and 2873 deletions
+18
View File
@@ -1,4 +1,22 @@
compat/zlib/win32/zdll.lib
compat/zlib/win32/zlib1.dll
compat/zlib/win64/zdll.lib
compat/zlib/win64/zlib1.dll
compat/zlib/win64/libz.dll.a
compat/zlib/zlib.3.pdf
compat/zlib/win32/zdll.lib
compat/zlib/win32/zlib1.dll
compat/zlib/win64/zdll.lib
compat/zlib/win64/zlib1.dll
compat/zlib/win64/libz.dll.a
compat/zlib/zlib.3.pdf
libtommath/win32/tommath.lib
libtommath/win32/libtommath.dll
libtommath/win64/tommath.lib
libtommath/win64/libtommath.dll
libtommath/win64/libtommath.dll.a
*.a
*.bmp
*.dll
*.exe
*.gif
+33 -52
View File
@@ -10,20 +10,13 @@ matrix:
compiler: gcc
env:
- BUILD_DIR=unix
- name: "Linux/GCC/Shared: UTF_MAX=6"
- name: "Linux/GCC/Shared: UTF_MAX=4"
os: linux
dist: xenial
compiler: gcc
env:
- BUILD_DIR=unix
- CFGOPT=CFLAGS=-DTCL_UTF_MAX=6
- name: "Linux/GCC/Shared: UTF_MAX=3"
os: linux
dist: xenial
compiler: gcc
env:
- BUILD_DIR=unix
- CFGOPT=CFLAGS=-DTCL_UTF_MAX=3
- CFGOPT=CFLAGS=-DTCL_UTF_MAX=4
- name: "Linux/GCC/Shared: NO_DEPRECATED"
os: linux
dist: xenial
@@ -101,20 +94,6 @@ matrix:
compiler: clang
env:
- BUILD_DIR=unix
- name: "Linux/Clang/Shared: UTF_MAX=6"
os: linux
dist: xenial
compiler: clang
env:
- BUILD_DIR=unix
- CFGOPT=CFLAGS=-DTCL_UTF_MAX=6
- name: "Linux/Clang/Shared: UTF_MAX=3"
os: linux
dist: xenial
compiler: clang
env:
- BUILD_DIR=unix
- CFGOPT=CFLAGS=-DTCL_UTF_MAX=3
- name: "Linux/Clang/Shared:NO_DEPRECATED"
os: linux
dist: xenial
@@ -137,14 +116,14 @@ matrix:
- BUILD_DIR=unix
- CFGOPT="--enable-symbols"
# Testing on Mac, various styles
- name: "macOS/Xcode 11/Shared/Unix-like"
- name: "macOS/Xcode 11.3/Shared/Unix-like"
os: osx
osx_image: xcode11
osx_image: xcode11.3
env:
- BUILD_DIR=unix
- name: "macOS/Xcode 11/Shared"
- name: "macOS/Xcode 11.3/Shared"
os: osx
osx_image: xcode11
osx_image: xcode11.3
env:
- BUILD_DIR=macosx
install: []
@@ -152,6 +131,10 @@ matrix:
- make all
# The styles=develop avoids some weird problems on OSX
- make test styles=develop
addons:
homebrew:
packages:
- libtommath
- name: "macOS/Xcode 10/Shared"
os: osx
osx_image: xcode10.3
@@ -159,6 +142,10 @@ matrix:
- BUILD_DIR=macosx
install: []
script: *mactest
addons:
homebrew:
packages:
- libtommath
- name: "macOS/Xcode 9/Shared"
os: osx
osx_image: xcode9
@@ -166,6 +153,10 @@ matrix:
- BUILD_DIR=macosx
install: []
script: *mactest
addons:
homebrew:
packages:
- libtommath
- name: "macOS/Xcode 8/Shared"
os: osx
osx_image: xcode8
@@ -173,6 +164,10 @@ matrix:
- BUILD_DIR=macosx
install: []
script: *mactest
addons:
homebrew:
packages:
- libtommath
# Test with mingw-w64 cross-compile
# Doesn't run tests because wine is only an imperfect Windows emulation
- name: "Linux-cross-Windows/GCC/Shared/no test"
@@ -226,7 +221,7 @@ matrix:
script:
- cmd.exe /C 'vcvarsall.bat x64 && nmake -f makefile.vc all tcltest'
- cmd.exe /C 'vcvarsall.bat x64 && nmake -f makefile.vc test'
- name: "Windows/MSVC/Shared: UTF_MAX=6"
- name: "Windows/MSVC/Shared: UTF_MAX=4"
os: windows
compiler: cl
env: *vcenv
@@ -251,8 +246,8 @@ matrix:
before_install: *vcpreinst
install: []
script:
- cmd.exe /C 'vcvarsall.bat x64 && nmake OPTS=static -f makefile.vc all tcltest'
- cmd.exe /C 'vcvarsall.bat x64 && nmake OPTS=static -f makefile.vc test'
- cmd.exe /C 'vcvarsall.bat x64 && nmake OPTS=static,msvcrt -f makefile.vc all tcltest'
- cmd.exe /C 'vcvarsall.bat x64 && nmake OPTS=static,msvcrt -f makefile.vc test'
- name: "Windows/MSVC/Debug"
os: windows
compiler: cl
@@ -272,7 +267,7 @@ matrix:
script:
- cmd.exe /C 'vcvarsall.bat x86 && nmake -f makefile.vc all tcltest'
- cmd.exe /C 'vcvarsall.bat x86 && nmake -f makefile.vc test'
- name: "Windows/MSVC-x86/Shared: UTF_MAX=6"
- name: "Windows/MSVC-x86/Shared: UTF_MAX=4"
os: windows
compiler: cl
env: *vcenv
@@ -297,8 +292,8 @@ matrix:
before_install: *vcpreinst
install: []
script:
- cmd.exe /C 'vcvarsall.bat x86 && nmake OPTS=static -f makefile.vc all tcltest'
- cmd.exe /C 'vcvarsall.bat x86 && nmake OPTS=static -f makefile.vc test'
- cmd.exe /C 'vcvarsall.bat x86 && nmake OPTS=static,msvcrt -f makefile.vc all tcltest'
- cmd.exe /C 'vcvarsall.bat x86 && nmake OPTS=static,msvcrt -f makefile.vc test'
- name: "Windows/MSVC-x86/Debug"
os: windows
compiler: cl
@@ -316,21 +311,14 @@ matrix:
- BUILD_DIR=win
- CFGOPT="--enable-64bit"
before_install: &makepreinst
- choco install make
- choco install -y make zip
- cd ${BUILD_DIR}
- name: "Windows/GCC/Shared: UTF_MAX=6"
- name: "Windows/GCC/Shared: UTF_MAX=4"
os: windows
compiler: gcc
env:
- BUILD_DIR=win
- CFGOPT="--enable-64bit CFLAGS=-DTCL_UTF_MAX=6"
before_install: *makepreinst
- name: "Windows/GCC/Shared: UTF_MAX=3"
os: windows
compiler: gcc
env:
- BUILD_DIR=win
- CFGOPT="--enable-64bit CFLAGS=-DTCL_UTF_MAX=3"
- CFGOPT="--enable-64bit CFLAGS=-DTCL_UTF_MAX=4"
before_install: *makepreinst
- name: "Windows/GCC/Shared: NO_DEPRECATED"
os: windows
@@ -360,19 +348,12 @@ matrix:
env:
- BUILD_DIR=win
before_install: *makepreinst
- name: "Windows/GCC-x86/Shared: UTF_MAX=6"
- name: "Windows/GCC-x86/Shared: UTF_MAX=4"
os: windows
compiler: gcc
env:
- BUILD_DIR=win
- CFGOPT="CFLAGS=-DTCL_UTF_MAX=6"
before_install: *makepreinst
- name: "Windows/GCC-x86/Shared: UTF_MAX=3"
os: windows
compiler: gcc
env:
- BUILD_DIR=win
- CFGOPT="CFLAGS=-DTCL_UTF_MAX=3"
- CFGOPT="CFLAGS=-DTCL_UTF_MAX=4"
before_install: *makepreinst
- name: "Windows/GCC-x86/Shared: NO_DEPRECATED"
os: windows
+1 -1
View File
@@ -1,6 +1,6 @@
# README: Tcl
This is the **Tcl 8.7a2** source distribution.
This is the **Tcl 8.7a4** source distribution.
You can get any source release of Tcl from [our distribution
site](https://sourceforge.net/projects/tcl/files/Tcl/).
+202 -32
View File
@@ -8796,6 +8796,55 @@ improvements to regexp engine from Postgres (lane,porter,fellows,seltenreich)
--- Released 8.6.7, August 9, 2017 --- https://core.tcl-lang.org/tcl/ for details
Changes to 8.7a1 include all changes to the 8.6 line through 8.6.7,
plus the following, which focuses on the high-level feature changes
in this changeset (new minor version) rather than bug fixes:
2016-03-17 (bug)[0b8c38] socket accept callbacks always in global ns (porter)
*** POTENTIAL INCOMPATIBILITY ***
2016-07-01 Hack accommodations for legacy Itcl 3 disabled (porter)
2016-07-12 Make TCL_HASH_TYPE build-time configurable (nijtmans)
2016-07-19 (bug)[0363f0] Partial array search ID reform (porter)
2016-07-19 (feature removed) Tcl_ObjType "array search" unregistered (porter)
*** POTENTIAL INCOMPATIBILITY for Tcl_GetObjType("array search") ***
2016-10-04 Server socket on port 0 chooses port supporting IPv4 * IPv6 (max)
2016-11-25 [array names -regexp] supports backrefs (goth)
2017-01-04 (TIP 456) New routine Tcl_OpenTcpServerEx() (limeboy)
2017-01-04 (TIP 459) New subcommand [package files] (nijtmans)
2017-01-16 threaded allocator initialization repair (vasiljevic,nijtmans)
2017-01-30 Add to Win shell builtins: assoc ftype move (ashok)
2017-03-31 TCL_MEM_DEBUG facilities better support 64-bit memory (nijtmans)
2017-04-13 \u escaped content in msg files converted to true utf-8 (nijtmans)
2017-05-18 (TIP 458) New epoll or kqueue notifiers are default (alborboz)
2017-05-31 Purge build support for SunOS-4.* (stu)
2017-06-22 (TIP 463) New option [regsub ... -command ...] (fellows)
2017-06-22 (TIP 470) Tcl_GetDefineContextObject();[oo::define [self]] (fellows)
=> TclOO 1.2.0
2017-06-23 (TIP 472) Support 0d as prefix of decimal numbers (iyer,griffin)
2017-08-31 (bug)[2a9465] http state 100 continue handling broken (oehlmann)
2017-09-02 (bug)[0e4d88] replace command, delete trace kills namespace (porter)
--- Released 8.7a1, September 8, 2017 --- http://core.tcl.tk/tcl/ for details
2017-08-10 [array names -regexp] supports backrefs (goth)
2017-08-10 Fix gcc build failures due to #pragma placement (cassoff,fellows)
@@ -8895,58 +8944,179 @@ improvements to regexp engine from Postgres (lane,porter,fellows,seltenreich)
- Released 8.6.9, November 16, 2018 - details at http://core.tcl-lang.org/tcl/ -
Changes to 8.7a1 include all changes to the 8.6 line through 8.6.7,
2018-11-22 (bug)[7a9dc5] [file normalize ~/~foo] segfault (sebres)
2018-12-30 (bug)[3cf3a9] variable 'timezone' deprecated in vc2017 (nijtmans)
2019-01-09 (bug)[cc1e91] [list [list {*}[set a " "]]] regression (sebres)
2019-02-01 (bug)[e3f481] tests var-1.2[01] (sebres)
2019-03-01 (new) Update to Unicode 12.0 (nijtmans)
2019-03-05 (new)[TIP 527] New command [timerate] (sebres)
2019-03-08 (bug)[39fed4] [package require] memory validity (hume,porter)
2019-04-23 (new) New command tcl::unsupported::corotype (fellows)
2019-05-04 (bug) memlink when namespace deletion kills linked var (porter)
2019-05-28 (new) README file converted to README.md in Markdown (nijtmans)
2019-06-17 (bug)[8b9854] [info level 0] regression with ensembles (porter)
2019-06-20 (bug)[6bdadf] crash multi-arg write-traced [lappend] (fellows,porter)
2019-06-21 (bug)[f8a33c] crash Tcl_Exit before init (brooks,sebres)
2019-08-27 (bug)[fa6bf3] Bytecode fails epoch recovery at numLevel=0 (sebres)
2019-08-29 (bug)[fec0c1] C stack overflow compiling bytecode (ade,sebres)
2019-09-12 tzdata updated to Olson's tzdata2019c (jima)
2019-09-20 (new) registry/dde no longer need -DUNICODE (nijtmans)
=> registry 1.3.4
=> dde 1.4.2
2019-10-02 (bug)[16768d] Fix [info hostname] on NetBSD (rytaro)
2019-10-23 (new) libtommath updated to release 1.2.0 (nijtmans)
2019-10-25 OSX: system Tcl deprecated. End default use of its packages. (walzer)
2019-10-28 (bug)[bcd100] bad fs cache when system encoding changes (coulter)
2019-11-15 (bug)[135804] segfault in [next] after destroy (coulter,sebres)
- Released 8.6.10, Nov 21, 2019 - details at http://core.tcl-lang.org/tcl/ -
Changes to 8.7a3 include all changes to the 8.6 line through 8.6.10,
plus the following, which focuses on the high-level feature changes
in this changeset (new minor version) rather than bug fixes:
2016-03-17 (bug)[0b8c38] socket accept callbacks always in global ns (porter)
*** POTENTIAL INCOMPATIBILITY ***
2017-11-01 (bug)[3c32a3] crash deleting class mixed into instance (coulter)
2016-07-01 Hack accommodations for legacy Itcl 3 disabled (porter)
2017-11-03 [TIP 345] eliminate the encoding 'identity' (porter)
2016-07-12 Make TCL_HASH_TYPE build-time configurable (nijtmans)
2017-11-04 (bug)[0d902e] [string first] on ASCII stored as Unicode (fellows)
2016-07-19 (bug)[0363f0] Partial array search ID reform (porter)
2017-11-17 [TIP 422] Mark all Tcl_*VA() routines deprecated. (nijtmans)
2016-07-19 (feature removed) Tcl_ObjType "array search" unregistered (porter)
*** POTENTIAL INCOMPATIBILITY for Tcl_GetObjType("array search") ***
2017-11-20 (support) Ended use of the obsolete values.h header (culler)
2016-10-04 Server socket on port 0 chooses port supporting IPv4 * IPv6 (max)
2017-11-30 (bug)[8e1e31] [lsort] ordering of U+0000 (nijtmans)
2016-11-25 [array names -regexp] supports backrefs (goth)
2017-12-07 [TIP 487] Terminate support for pre-XP Windows (nijtmans)
2017-01-04 (TIP 456) New routine Tcl_OpenTcpServerEx() (limeboy)
2017-12-08 [TIP 477] Reform of nmake build (nadkarni)
2017-01-04 (TIP 459) New subcommand [package files] (nijtmans)
2017-12-20 (bug)[ba1419] Crash: complex ensemble delete, namespace-7.8 (coulter)
2017-01-16 threaded allocator initialization repair (vasiljevic,nijtmans)
2018-01-17 [TIP 485] Removal of many deprecated features (nijtmans)
2017-01-30 Add to Win shell builtins: assoc ftype move (ashok)
2018-01-27 (bug) Crash in [join $l $l], join-4.1 (porter)
2017-03-31 TCL_MEM_DEBUG facilities better support 64-bit memory (nijtmans)
2018-02-06 [TIP 493] Cease Distribution of http 1.0 (porter)
2017-04-13 \u escaped content in msg files converted to true utf-8 (nijtmans)
2018-02-06 [TIP 484] internal rep for native ints are all 64-bit (nijtmans)
2017-05-18 (TIP 458) New epoll or kqueue notifiers are default (alborboz)
2018-02-14 [TIP 476] Scan/Printf consistency (nijtmans)
2017-05-31 Purge build support for SunOS-4.* (stu)
2018-03-05 [TIP 351] [lsearch] striding
2017-06-22 (TIP 463) New option [regsub ... -command ...] (fellows)
2018-03-05 [TIPs 330,336] tighten access to Interp fields (porter)
2017-06-22 (TIP 470) Tcl_GetDefineContextObject();[oo::define [self]] (fellows)
=> TclOO 1.2.0
2018-03-12 [TIP 462] [::tcl::process]
2017-06-23 (TIP 472) Support 0d as prefix of decimal numbers (iyer,griffin)
2018-03-12 [TIP 490] add oo support for msgcat => msgcat 1.7.0 (oehlmann)
2017-08-31 (bug)[2a9465] http state 100 continue handling broken (oehlmann)
2017-09-02 (bug)[0e4d88] replace command, delete trace kills namespace (porter)
--- Released 8.7a1, September 8, 2017 --- http://core.tcl.tk/tcl/ for details
2018-03-12 (TIP 490) add oo support for msgcat => msgcat 1.7.0 (oehlmann)
2018-03-12 (TIP 499) custom locale preference list (oehlmann)
2018-03-12 [TIP 499] custom locale preference list (oehlmann)
=> msgcat 1.7.0
- Released 8.7a3, Nov 30, 2018 --- http://core.tcl-lang.org/tcl/ for details -
2018-03-20 [TIP 503] End CONST84 support for Tcl 8.3 (porter)
2018-03-30 Refactored [lrange] (spjuth)
2018-04-20 [TIP 389] Unicode beyond BMP (nijtmans)
2018-04-20 [TIP 421] [array for]
2018-05-11 [TIP 425] Windows panic callback use of UTF-8
2018-05-17 [TIP 491] Phase out --disable-threads support
2018-06-03 [TIP 500] TclOO Private Methods and Variables
2018-07-26 (bug)[ba921a] [string cat] of bytearrays (coulter,porter)
2018-09-02 [TIP 478] Many new features in TclOO (lester,fellows)
2018-09-04 (bug)[540bed] [binary format w] from bignum (nijtmans)
2018-09-12 [TIP 430] zipfs and embedded script library (woods)
2018-09-26 [TIP 508] [array default] (bonnet,fellows)
2018-09-27 [TIP 515] level value reform (nijtmans)
2018-09-27 [TIP 516] More OO slot operations (fellows)
2018-09-27 [TIP 426] [info cmdtype] (fellows)
2018-09-28 [TIP 509] Cross platform reentrant mutex
2018-10-08 [TIP 514] native integers are 64-bit
2018-10-12 [TIP 502] index value reform (porter)
2018-11-06 [TIP 406] http cookies (fellows)
2018-11-06 [TIP 445] Tcl_ObjType utilities (migrate to Tcl 9) (porter)
2018-11-06 [TIP 501] [string is dict]
2018-11-06 [TIP 519] inline export/unexport option for [oo::define]
2018-11-06 [TIP 523] [lpop]
2018-11-06 [TIP 524] TclOO custom dialects
2018-11-06 [TIP 506] Tcl_(Incr|Decr)RefCount macros -> functions (porter)
2018-11-15 [TIP 512] No stub for Tcl_SetExitProc()
2019-04-08 (bug)[45b9fa] crash in [try] (coulter)
2019-04-14 [TIP 160] terminal and serial channel controls
2019-04-14 [TIP 312] more types for Tcl_LinkVar
2019-04-14 [TIP 367] [lremove]
2019-04-14 [TIP 504] [string insert]
2019-04-16 [TIP 342] [dict getwithdefault]
2019-05-25 [TIP 431] [file tempdir]
2019-05-25 [TIP 383] [coroinject], [coroprobe]
2019-05-31 [TIP 544] Tcl_GetIntForIndex()
2019-06-12 Replace TclOffset() with offsetof()
2019-06-15 [TIP 461] string compare operators for [expr]
2019-06-16 [TIP 521] floating point classification functions for [expr]
2019-06-20 (bug)[6bdadf] crash multi-arg traced [lappend] (fellows)
2019-06-28 [TIP 547] New encodings utf-16, ucs-2
2019-09-14 [TIP 414] Tcl_InitSubsystems()
2019-09-14 [TIP 548] wchar_t conversion functions
- Released 8.7a3, Nov 21, 2019 --- http://core.tcl-lang.org/tcl/ for details -
+919
View File
@@ -0,0 +1,919 @@
/* A portable stdint.h
****************************************************************************
* BSD License:
****************************************************************************
*
* Copyright (c) 2005-2016 Paul Hsieh
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************
*
* Version 0.1.16.0
*
* The ANSI C standard committee, for the C99 standard, specified the
* inclusion of a new standard include file called stdint.h. This is
* a very useful and long desired include file which contains several
* very precise definitions for integer scalar types that is critically
* important for making several classes of applications portable
* including cryptography, hashing, variable length integer libraries
* and so on. But for most developers its likely useful just for
* programming sanity.
*
* The problem is that some compiler vendors chose to ignore the C99
* standard and some older compilers have no opportunity to be updated.
* Because of this situation, simply including stdint.h in your code
* makes it unportable.
*
* So that's what this file is all about. It's an attempt to build a
* single universal include file that works on as many platforms as
* possible to deliver what stdint.h is supposed to. Even compilers
* that already come with stdint.h can use this file instead without
* any loss of functionality. A few things that should be noted about
* this file:
*
* 1) It is not guaranteed to be portable and/or present an identical
* interface on all platforms. The extreme variability of the
* ANSI C standard makes this an impossibility right from the
* very get go. Its really only meant to be useful for the vast
* majority of platforms that possess the capability of
* implementing usefully and precisely defined, standard sized
* integer scalars. Systems which are not intrinsically 2s
* complement may produce invalid constants.
*
* 2) There is an unavoidable use of non-reserved symbols.
*
* 3) Other standard include files are invoked.
*
* 4) This file may come in conflict with future platforms that do
* include stdint.h. The hope is that one or the other can be
* used with no real difference.
*
* 5) In the current version, if your platform can't represent
* int32_t, int16_t and int8_t, it just dumps out with a compiler
* error.
*
* 6) 64 bit integers may or may not be defined. Test for their
* presence with the test: #ifdef INT64_MAX or #ifdef UINT64_MAX.
* Note that this is different from the C99 specification which
* requires the existence of 64 bit support in the compiler. If
* this is not defined for your platform, yet it is capable of
* dealing with 64 bits then it is because this file has not yet
* been extended to cover all of your system's capabilities.
*
* 7) (u)intptr_t may or may not be defined. Test for its presence
* with the test: #ifdef PTRDIFF_MAX. If this is not defined
* for your platform, then it is because this file has not yet
* been extended to cover all of your system's capabilities, not
* because its optional.
*
* 8) The following might not been defined even if your platform is
* capable of defining it:
*
* WCHAR_MIN
* WCHAR_MAX
* (u)int64_t
* PTRDIFF_MIN
* PTRDIFF_MAX
* (u)intptr_t
*
* 9) The following have not been defined:
*
* WINT_MIN
* WINT_MAX
*
* 10) The criteria for defining (u)int_least(*)_t isn't clear,
* except for systems which don't have a type that precisely
* defined 8, 16, or 32 bit types (which this include file does
* not support anyways). Default definitions have been given.
*
* 11) The criteria for defining (u)int_fast(*)_t isn't something I
* would trust to any particular compiler vendor or the ANSI C
* committee. It is well known that "compatible systems" are
* commonly created that have very different performance
* characteristics from the systems they are compatible with,
* especially those whose vendors make both the compiler and the
* system. Default definitions have been given, but its strongly
* recommended that users never use these definitions for any
* reason (they do *NOT* deliver any serious guarantee of
* improved performance -- not in this file, nor any vendor's
* stdint.h).
*
* 12) The following macros:
*
* PRINTF_INTMAX_MODIFIER
* PRINTF_INT64_MODIFIER
* PRINTF_INT32_MODIFIER
* PRINTF_INT16_MODIFIER
* PRINTF_LEAST64_MODIFIER
* PRINTF_LEAST32_MODIFIER
* PRINTF_LEAST16_MODIFIER
* PRINTF_INTPTR_MODIFIER
*
* are strings which have been defined as the modifiers required
* for the "d", "u" and "x" printf formats to correctly output
* (u)intmax_t, (u)int64_t, (u)int32_t, (u)int16_t, (u)least64_t,
* (u)least32_t, (u)least16_t and (u)intptr_t types respectively.
* PRINTF_INTPTR_MODIFIER is not defined for some systems which
* provide their own stdint.h. PRINTF_INT64_MODIFIER is not
* defined if INT64_MAX is not defined. These are an extension
* beyond what C99 specifies must be in stdint.h.
*
* In addition, the following macros are defined:
*
* PRINTF_INTMAX_HEX_WIDTH
* PRINTF_INT64_HEX_WIDTH
* PRINTF_INT32_HEX_WIDTH
* PRINTF_INT16_HEX_WIDTH
* PRINTF_INT8_HEX_WIDTH
* PRINTF_INTMAX_DEC_WIDTH
* PRINTF_INT64_DEC_WIDTH
* PRINTF_INT32_DEC_WIDTH
* PRINTF_INT16_DEC_WIDTH
* PRINTF_UINT8_DEC_WIDTH
* PRINTF_UINTMAX_DEC_WIDTH
* PRINTF_UINT64_DEC_WIDTH
* PRINTF_UINT32_DEC_WIDTH
* PRINTF_UINT16_DEC_WIDTH
* PRINTF_UINT8_DEC_WIDTH
*
* Which specifies the maximum number of characters required to
* print the number of that type in either hexadecimal or decimal.
* These are an extension beyond what C99 specifies must be in
* stdint.h.
*
* Compilers tested (all with 0 warnings at their highest respective
* settings): Borland Turbo C 2.0, WATCOM C/C++ 11.0 (16 bits and 32
* bits), Microsoft Visual C++ 6.0 (32 bit), Microsoft Visual Studio
* .net (VC7), Intel C++ 4.0, GNU gcc v3.3.3
*
* This file should be considered a work in progress. Suggestions for
* improvements, especially those which increase coverage are strongly
* encouraged.
*
* Acknowledgements
*
* The following people have made significant contributions to the
* development and testing of this file:
*
* Chris Howie
* John Steele Scott
* Dave Thorup
* John Dill
* Florian Wobbe
* Christopher Sean Morrison
* Mikkel Fahnoe Jorgensen
*
*/
#include <stddef.h>
#include <limits.h>
#include <signal.h>
/*
* For gcc with _STDINT_H, fill in the PRINTF_INT*_MODIFIER macros, and
* do nothing else. On the Mac OS X version of gcc this is _STDINT_H_.
*/
#if ((defined(__SUNPRO_C) && __SUNPRO_C >= 0x570) || (defined(_MSC_VER) && _MSC_VER >= 1600) || (defined(__STDC__) && __STDC__ && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || (defined (__WATCOMC__) && (defined (_STDINT_H_INCLUDED) || __WATCOMC__ >= 1250)) || (defined(__GNUC__) && (__GNUC__ > 3 || defined(_STDINT_H) || defined(_STDINT_H_) || defined (__UINT_FAST64_TYPE__)) )) && !defined (_PSTDINT_H_INCLUDED)
#include <stdint.h>
#define _PSTDINT_H_INCLUDED
# if defined(__GNUC__) && (defined(__x86_64__) || defined(__ppc64__)) && !(defined(__APPLE__) && defined(__MACH__))
# ifndef PRINTF_INT64_MODIFIER
# define PRINTF_INT64_MODIFIER "l"
# endif
# ifndef PRINTF_INT32_MODIFIER
# define PRINTF_INT32_MODIFIER ""
# endif
# else
# ifndef PRINTF_INT64_MODIFIER
# define PRINTF_INT64_MODIFIER "ll"
# endif
# ifndef PRINTF_INT32_MODIFIER
# if (UINT_MAX == UINT32_MAX)
# define PRINTF_INT32_MODIFIER ""
# else
# define PRINTF_INT32_MODIFIER "l"
# endif
# endif
# endif
# ifndef PRINTF_INT16_MODIFIER
# define PRINTF_INT16_MODIFIER "h"
# endif
# ifndef PRINTF_INTMAX_MODIFIER
# define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER
# endif
# ifndef PRINTF_INT64_HEX_WIDTH
# define PRINTF_INT64_HEX_WIDTH "16"
# endif
# ifndef PRINTF_UINT64_HEX_WIDTH
# define PRINTF_UINT64_HEX_WIDTH "16"
# endif
# ifndef PRINTF_INT32_HEX_WIDTH
# define PRINTF_INT32_HEX_WIDTH "8"
# endif
# ifndef PRINTF_UINT32_HEX_WIDTH
# define PRINTF_UINT32_HEX_WIDTH "8"
# endif
# ifndef PRINTF_INT16_HEX_WIDTH
# define PRINTF_INT16_HEX_WIDTH "4"
# endif
# ifndef PRINTF_UINT16_HEX_WIDTH
# define PRINTF_UINT16_HEX_WIDTH "4"
# endif
# ifndef PRINTF_INT8_HEX_WIDTH
# define PRINTF_INT8_HEX_WIDTH "2"
# endif
# ifndef PRINTF_UINT8_HEX_WIDTH
# define PRINTF_UINT8_HEX_WIDTH "2"
# endif
# ifndef PRINTF_INT64_DEC_WIDTH
# define PRINTF_INT64_DEC_WIDTH "19"
# endif
# ifndef PRINTF_UINT64_DEC_WIDTH
# define PRINTF_UINT64_DEC_WIDTH "20"
# endif
# ifndef PRINTF_INT32_DEC_WIDTH
# define PRINTF_INT32_DEC_WIDTH "10"
# endif
# ifndef PRINTF_UINT32_DEC_WIDTH
# define PRINTF_UINT32_DEC_WIDTH "10"
# endif
# ifndef PRINTF_INT16_DEC_WIDTH
# define PRINTF_INT16_DEC_WIDTH "5"
# endif
# ifndef PRINTF_UINT16_DEC_WIDTH
# define PRINTF_UINT16_DEC_WIDTH "5"
# endif
# ifndef PRINTF_INT8_DEC_WIDTH
# define PRINTF_INT8_DEC_WIDTH "3"
# endif
# ifndef PRINTF_UINT8_DEC_WIDTH
# define PRINTF_UINT8_DEC_WIDTH "3"
# endif
# ifndef PRINTF_INTMAX_HEX_WIDTH
# define PRINTF_INTMAX_HEX_WIDTH PRINTF_UINT64_HEX_WIDTH
# endif
# ifndef PRINTF_UINTMAX_HEX_WIDTH
# define PRINTF_UINTMAX_HEX_WIDTH PRINTF_UINT64_HEX_WIDTH
# endif
# ifndef PRINTF_INTMAX_DEC_WIDTH
# define PRINTF_INTMAX_DEC_WIDTH PRINTF_UINT64_DEC_WIDTH
# endif
# ifndef PRINTF_UINTMAX_DEC_WIDTH
# define PRINTF_UINTMAX_DEC_WIDTH PRINTF_UINT64_DEC_WIDTH
# endif
/*
* Something really weird is going on with Open Watcom. Just pull some of
* these duplicated definitions from Open Watcom's stdint.h file for now.
*/
# if defined (__WATCOMC__) && __WATCOMC__ >= 1250
# if !defined (INT64_C)
# define INT64_C(x) (x + (INT64_MAX - INT64_MAX))
# endif
# if !defined (UINT64_C)
# define UINT64_C(x) (x + (UINT64_MAX - UINT64_MAX))
# endif
# if !defined (INT32_C)
# define INT32_C(x) (x + (INT32_MAX - INT32_MAX))
# endif
# if !defined (UINT32_C)
# define UINT32_C(x) (x + (UINT32_MAX - UINT32_MAX))
# endif
# if !defined (INT16_C)
# define INT16_C(x) (x)
# endif
# if !defined (UINT16_C)
# define UINT16_C(x) (x)
# endif
# if !defined (INT8_C)
# define INT8_C(x) (x)
# endif
# if !defined (UINT8_C)
# define UINT8_C(x) (x)
# endif
# if !defined (UINT64_MAX)
# define UINT64_MAX 18446744073709551615ULL
# endif
# if !defined (INT64_MAX)
# define INT64_MAX 9223372036854775807LL
# endif
# if !defined (UINT32_MAX)
# define UINT32_MAX 4294967295UL
# endif
# if !defined (INT32_MAX)
# define INT32_MAX 2147483647L
# endif
# if !defined (INTMAX_MAX)
# define INTMAX_MAX INT64_MAX
# endif
# if !defined (INTMAX_MIN)
# define INTMAX_MIN INT64_MIN
# endif
# endif
#endif
/*
* I have no idea what is the truly correct thing to do on older Solaris.
* From some online discussions, this seems to be what is being
* recommended. For people who actually are developing on older Solaris,
* what I would like to know is, does this define all of the relevant
* macros of a complete stdint.h? Remember, in pstdint.h 64 bit is
* considered optional.
*/
#if (defined(__SUNPRO_C) && __SUNPRO_C >= 0x420) && !defined(_PSTDINT_H_INCLUDED)
#include <sys/inttypes.h>
#define _PSTDINT_H_INCLUDED
#endif
#ifndef _PSTDINT_H_INCLUDED
#define _PSTDINT_H_INCLUDED
#ifndef SIZE_MAX
# define SIZE_MAX ((size_t)-1)
#endif
/*
* Deduce the type assignments from limits.h under the assumption that
* integer sizes in bits are powers of 2, and follow the ANSI
* definitions.
*/
#ifndef UINT8_MAX
# define UINT8_MAX 0xff
#endif
#if !defined(uint8_t) && !defined(_UINT8_T) && !defined(vxWorks)
# if (UCHAR_MAX == UINT8_MAX) || defined (S_SPLINT_S)
typedef unsigned char uint8_t;
# define UINT8_C(v) ((uint8_t) v)
# else
# error "Platform not supported"
# endif
#endif
#ifndef INT8_MAX
# define INT8_MAX 0x7f
#endif
#ifndef INT8_MIN
# define INT8_MIN INT8_C(0x80)
#endif
#if !defined(int8_t) && !defined(_INT8_T) && !defined(vxWorks)
# if (SCHAR_MAX == INT8_MAX) || defined (S_SPLINT_S)
typedef signed char int8_t;
# define INT8_C(v) ((int8_t) v)
# else
# error "Platform not supported"
# endif
#endif
#ifndef UINT16_MAX
# define UINT16_MAX 0xffff
#endif
#if !defined(uint16_t) && !defined(_UINT16_T) && !defined(vxWorks)
#if (UINT_MAX == UINT16_MAX) || defined (S_SPLINT_S)
typedef unsigned int uint16_t;
# ifndef PRINTF_INT16_MODIFIER
# define PRINTF_INT16_MODIFIER ""
# endif
# define UINT16_C(v) ((uint16_t) (v))
#elif (USHRT_MAX == UINT16_MAX)
typedef unsigned short uint16_t;
# define UINT16_C(v) ((uint16_t) (v))
# ifndef PRINTF_INT16_MODIFIER
# define PRINTF_INT16_MODIFIER "h"
# endif
#else
#error "Platform not supported"
#endif
#endif
#ifndef INT16_MAX
# define INT16_MAX 0x7fff
#endif
#ifndef INT16_MIN
# define INT16_MIN INT16_C(0x8000)
#endif
#if !defined(int16_t) && !defined(_INT16_T) && !defined(vxWorks)
#if (INT_MAX == INT16_MAX) || defined (S_SPLINT_S)
typedef signed int int16_t;
# define INT16_C(v) ((int16_t) (v))
# ifndef PRINTF_INT16_MODIFIER
# define PRINTF_INT16_MODIFIER ""
# endif
#elif (SHRT_MAX == INT16_MAX)
typedef signed short int16_t;
# define INT16_C(v) ((int16_t) (v))
# ifndef PRINTF_INT16_MODIFIER
# define PRINTF_INT16_MODIFIER "h"
# endif
#else
#error "Platform not supported"
#endif
#endif
#ifndef UINT32_MAX
# define UINT32_MAX (0xffffffffUL)
#endif
#if !defined(uint32_t) && !defined(_UINT32_T) && !defined(vxWorks)
#if (ULONG_MAX == UINT32_MAX) || defined (S_SPLINT_S)
typedef unsigned long uint32_t;
# define UINT32_C(v) v ## UL
# ifndef PRINTF_INT32_MODIFIER
# define PRINTF_INT32_MODIFIER "l"
# endif
#elif (UINT_MAX == UINT32_MAX)
typedef unsigned int uint32_t;
# ifndef PRINTF_INT32_MODIFIER
# define PRINTF_INT32_MODIFIER ""
# endif
# define UINT32_C(v) v ## U
#elif (USHRT_MAX == UINT32_MAX)
typedef unsigned short uint32_t;
# define UINT32_C(v) ((unsigned short) (v))
# ifndef PRINTF_INT32_MODIFIER
# define PRINTF_INT32_MODIFIER ""
# endif
#else
#error "Platform not supported"
#endif
#endif
#ifndef INT32_MAX
# define INT32_MAX (0x7fffffffL)
#endif
#ifndef INT32_MIN
# define INT32_MIN INT32_C(0x80000000)
#endif
#if !defined(int32_t) && !defined(_INT32_T) && !defined(vxWorks)
#if (LONG_MAX == INT32_MAX) || defined (S_SPLINT_S)
typedef signed long int32_t;
# define INT32_C(v) v ## L
# ifndef PRINTF_INT32_MODIFIER
# define PRINTF_INT32_MODIFIER "l"
# endif
#elif (INT_MAX == INT32_MAX)
typedef signed int int32_t;
# define INT32_C(v) v
# ifndef PRINTF_INT32_MODIFIER
# define PRINTF_INT32_MODIFIER ""
# endif
#elif (SHRT_MAX == INT32_MAX)
typedef signed short int32_t;
# define INT32_C(v) ((short) (v))
# ifndef PRINTF_INT32_MODIFIER
# define PRINTF_INT32_MODIFIER ""
# endif
#else
#error "Platform not supported"
#endif
#endif
/*
* The macro stdint_int64_defined is temporarily used to record
* whether or not 64 integer support is available. It must be
* defined for any 64 integer extensions for new platforms that are
* added.
*/
#undef stdint_int64_defined
#if (defined(__STDC__) && defined(__STDC_VERSION__)) || defined (S_SPLINT_S)
# if (__STDC__ && __STDC_VERSION__ >= 199901L) || defined (S_SPLINT_S)
# define stdint_int64_defined
typedef long long int64_t;
typedef unsigned long long uint64_t;
# define UINT64_C(v) v ## ULL
# define INT64_C(v) v ## LL
# ifndef PRINTF_INT64_MODIFIER
# define PRINTF_INT64_MODIFIER "ll"
# endif
# endif
#endif
#if !defined (stdint_int64_defined)
# if defined(__GNUC__) && !defined(vxWorks)
# define stdint_int64_defined
__extension__ typedef long long int64_t;
__extension__ typedef unsigned long long uint64_t;
# define UINT64_C(v) v ## ULL
# define INT64_C(v) v ## LL
# ifndef PRINTF_INT64_MODIFIER
# define PRINTF_INT64_MODIFIER "ll"
# endif
# elif defined(__MWERKS__) || defined (__SUNPRO_C) || defined (__SUNPRO_CC) || defined (__APPLE_CC__) || defined (_LONG_LONG) || defined (_CRAYC) || defined (S_SPLINT_S)
# define stdint_int64_defined
typedef long long int64_t;
typedef unsigned long long uint64_t;
# define UINT64_C(v) v ## ULL
# define INT64_C(v) v ## LL
# ifndef PRINTF_INT64_MODIFIER
# define PRINTF_INT64_MODIFIER "ll"
# endif
# elif (defined(__WATCOMC__) && defined(__WATCOM_INT64__)) || (defined(_MSC_VER) && _INTEGRAL_MAX_BITS >= 64) || (defined (__BORLANDC__) && __BORLANDC__ > 0x460) || defined (__alpha) || defined (__DECC)
# define stdint_int64_defined
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
# define UINT64_C(v) v ## UI64
# define INT64_C(v) v ## I64
# ifndef PRINTF_INT64_MODIFIER
# define PRINTF_INT64_MODIFIER "I64"
# endif
# endif
#endif
#if !defined (LONG_LONG_MAX) && defined (INT64_C)
# define LONG_LONG_MAX INT64_C (9223372036854775807)
#endif
#ifndef ULONG_LONG_MAX
# define ULONG_LONG_MAX UINT64_C (18446744073709551615)
#endif
#if !defined (INT64_MAX) && defined (INT64_C)
# define INT64_MAX INT64_C (9223372036854775807)
#endif
#if !defined (INT64_MIN) && defined (INT64_C)
# define INT64_MIN INT64_C (-9223372036854775808)
#endif
#if !defined (UINT64_MAX) && defined (INT64_C)
# define UINT64_MAX UINT64_C (18446744073709551615)
#endif
/*
* Width of hexadecimal for number field.
*/
#ifndef PRINTF_INT64_HEX_WIDTH
# define PRINTF_INT64_HEX_WIDTH "16"
#endif
#ifndef PRINTF_INT32_HEX_WIDTH
# define PRINTF_INT32_HEX_WIDTH "8"
#endif
#ifndef PRINTF_INT16_HEX_WIDTH
# define PRINTF_INT16_HEX_WIDTH "4"
#endif
#ifndef PRINTF_INT8_HEX_WIDTH
# define PRINTF_INT8_HEX_WIDTH "2"
#endif
#ifndef PRINTF_INT64_DEC_WIDTH
# define PRINTF_INT64_DEC_WIDTH "19"
#endif
#ifndef PRINTF_INT32_DEC_WIDTH
# define PRINTF_INT32_DEC_WIDTH "10"
#endif
#ifndef PRINTF_INT16_DEC_WIDTH
# define PRINTF_INT16_DEC_WIDTH "5"
#endif
#ifndef PRINTF_INT8_DEC_WIDTH
# define PRINTF_INT8_DEC_WIDTH "3"
#endif
#ifndef PRINTF_UINT64_DEC_WIDTH
# define PRINTF_UINT64_DEC_WIDTH "20"
#endif
#ifndef PRINTF_UINT32_DEC_WIDTH
# define PRINTF_UINT32_DEC_WIDTH "10"
#endif
#ifndef PRINTF_UINT16_DEC_WIDTH
# define PRINTF_UINT16_DEC_WIDTH "5"
#endif
#ifndef PRINTF_UINT8_DEC_WIDTH
# define PRINTF_UINT8_DEC_WIDTH "3"
#endif
/*
* Ok, lets not worry about 128 bit integers for now. Moore's law says
* we don't need to worry about that until about 2040 at which point
* we'll have bigger things to worry about.
*/
#ifdef stdint_int64_defined
typedef int64_t intmax_t;
typedef uint64_t uintmax_t;
# define INTMAX_MAX INT64_MAX
# define INTMAX_MIN INT64_MIN
# define UINTMAX_MAX UINT64_MAX
# define UINTMAX_C(v) UINT64_C(v)
# define INTMAX_C(v) INT64_C(v)
# ifndef PRINTF_INTMAX_MODIFIER
# define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER
# endif
# ifndef PRINTF_INTMAX_HEX_WIDTH
# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH
# endif
# ifndef PRINTF_INTMAX_DEC_WIDTH
# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH
# endif
#else
typedef int32_t intmax_t;
typedef uint32_t uintmax_t;
# define INTMAX_MAX INT32_MAX
# define UINTMAX_MAX UINT32_MAX
# define UINTMAX_C(v) UINT32_C(v)
# define INTMAX_C(v) INT32_C(v)
# ifndef PRINTF_INTMAX_MODIFIER
# define PRINTF_INTMAX_MODIFIER PRINTF_INT32_MODIFIER
# endif
# ifndef PRINTF_INTMAX_HEX_WIDTH
# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT32_HEX_WIDTH
# endif
# ifndef PRINTF_INTMAX_DEC_WIDTH
# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT32_DEC_WIDTH
# endif
#endif
/*
* Because this file currently only supports platforms which have
* precise powers of 2 as bit sizes for the default integers, the
* least definitions are all trivial. Its possible that a future
* version of this file could have different definitions.
*/
#ifndef stdint_least_defined
typedef int8_t int_least8_t;
typedef uint8_t uint_least8_t;
typedef int16_t int_least16_t;
typedef uint16_t uint_least16_t;
typedef int32_t int_least32_t;
typedef uint32_t uint_least32_t;
# define PRINTF_LEAST32_MODIFIER PRINTF_INT32_MODIFIER
# define PRINTF_LEAST16_MODIFIER PRINTF_INT16_MODIFIER
# define UINT_LEAST8_MAX UINT8_MAX
# define INT_LEAST8_MAX INT8_MAX
# define UINT_LEAST16_MAX UINT16_MAX
# define INT_LEAST16_MAX INT16_MAX
# define UINT_LEAST32_MAX UINT32_MAX
# define INT_LEAST32_MAX INT32_MAX
# define INT_LEAST8_MIN INT8_MIN
# define INT_LEAST16_MIN INT16_MIN
# define INT_LEAST32_MIN INT32_MIN
# ifdef stdint_int64_defined
typedef int64_t int_least64_t;
typedef uint64_t uint_least64_t;
# define PRINTF_LEAST64_MODIFIER PRINTF_INT64_MODIFIER
# define UINT_LEAST64_MAX UINT64_MAX
# define INT_LEAST64_MAX INT64_MAX
# define INT_LEAST64_MIN INT64_MIN
# endif
#endif
#undef stdint_least_defined
/*
* The ANSI C committee has defined *int*_fast*_t types as well. This,
* of course, defies rationality -- you can't know what will be fast
* just from the type itself. Even for a given architecture, compatible
* implementations might have different performance characteristics.
* Developers are warned to stay away from these types when using this
* or any other stdint.h.
*/
typedef int_least8_t int_fast8_t;
typedef uint_least8_t uint_fast8_t;
typedef int_least16_t int_fast16_t;
typedef uint_least16_t uint_fast16_t;
typedef int_least32_t int_fast32_t;
typedef uint_least32_t uint_fast32_t;
#define UINT_FAST8_MAX UINT_LEAST8_MAX
#define INT_FAST8_MAX INT_LEAST8_MAX
#define UINT_FAST16_MAX UINT_LEAST16_MAX
#define INT_FAST16_MAX INT_LEAST16_MAX
#define UINT_FAST32_MAX UINT_LEAST32_MAX
#define INT_FAST32_MAX INT_LEAST32_MAX
#define INT_FAST8_MIN INT_LEAST8_MIN
#define INT_FAST16_MIN INT_LEAST16_MIN
#define INT_FAST32_MIN INT_LEAST32_MIN
#ifdef stdint_int64_defined
typedef int_least64_t int_fast64_t;
typedef uint_least64_t uint_fast64_t;
# define UINT_FAST64_MAX UINT_LEAST64_MAX
# define INT_FAST64_MAX INT_LEAST64_MAX
# define INT_FAST64_MIN INT_LEAST64_MIN
#endif
#undef stdint_int64_defined
/*
* Whatever piecemeal, per compiler thing we can do about the wchar_t
* type limits.
*/
#if defined(__WATCOMC__) || defined(_MSC_VER) || defined (__GNUC__) && !defined(vxWorks)
# include <wchar.h>
# ifndef WCHAR_MIN
# define WCHAR_MIN 0
# endif
# ifndef WCHAR_MAX
# define WCHAR_MAX ((wchar_t)-1)
# endif
#endif
/*
* Whatever piecemeal, per compiler/platform thing we can do about the
* (u)intptr_t types and limits.
*/
#if (defined (_MSC_VER) && defined (_UINTPTR_T_DEFINED)) || defined (_UINTPTR_T)
# define STDINT_H_UINTPTR_T_DEFINED
#endif
#ifndef STDINT_H_UINTPTR_T_DEFINED
# if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (_WIN64) || defined (__ppc64__)
# define stdint_intptr_bits 64
# elif defined (__WATCOMC__) || defined (__TURBOC__)
# if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__)
# define stdint_intptr_bits 16
# else
# define stdint_intptr_bits 32
# endif
# elif defined (__i386__) || defined (_WIN32) || defined (WIN32) || defined (__ppc64__)
# define stdint_intptr_bits 32
# elif defined (__INTEL_COMPILER)
/* TODO -- what did Intel do about x86-64? */
# else
/* #error "This platform might not be supported yet" */
# endif
# ifdef stdint_intptr_bits
# define stdint_intptr_glue3_i(a,b,c) a##b##c
# define stdint_intptr_glue3(a,b,c) stdint_intptr_glue3_i(a,b,c)
# ifndef PRINTF_INTPTR_MODIFIER
# define PRINTF_INTPTR_MODIFIER stdint_intptr_glue3(PRINTF_INT,stdint_intptr_bits,_MODIFIER)
# endif
# ifndef PTRDIFF_MAX
# define PTRDIFF_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX)
# endif
# ifndef PTRDIFF_MIN
# define PTRDIFF_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN)
# endif
# ifndef UINTPTR_MAX
# define UINTPTR_MAX stdint_intptr_glue3(UINT,stdint_intptr_bits,_MAX)
# endif
# ifndef INTPTR_MAX
# define INTPTR_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX)
# endif
# ifndef INTPTR_MIN
# define INTPTR_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN)
# endif
# ifndef INTPTR_C
# define INTPTR_C(x) stdint_intptr_glue3(INT,stdint_intptr_bits,_C)(x)
# endif
# ifndef UINTPTR_C
# define UINTPTR_C(x) stdint_intptr_glue3(UINT,stdint_intptr_bits,_C)(x)
# endif
typedef stdint_intptr_glue3(uint,stdint_intptr_bits,_t) uintptr_t;
typedef stdint_intptr_glue3( int,stdint_intptr_bits,_t) intptr_t;
# else
/* TODO -- This following is likely wrong for some platforms, and does
nothing for the definition of uintptr_t. */
typedef ptrdiff_t intptr_t;
# endif
# define STDINT_H_UINTPTR_T_DEFINED
#endif
/*
* Assumes sig_atomic_t is signed and we have a 2s complement machine.
*/
#ifndef SIG_ATOMIC_MAX
# define SIG_ATOMIC_MAX ((((sig_atomic_t) 1) << (sizeof (sig_atomic_t)*CHAR_BIT-1)) - 1)
#endif
#endif
#if defined (__TEST_PSTDINT_FOR_CORRECTNESS)
/*
* Please compile with the maximum warning settings to make sure macros are
* not defined more than once.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define glue3_aux(x,y,z) x ## y ## z
#define glue3(x,y,z) glue3_aux(x,y,z)
#define DECLU(bits) glue3(uint,bits,_t) glue3(u,bits,) = glue3(UINT,bits,_C) (0);
#define DECLI(bits) glue3(int,bits,_t) glue3(i,bits,) = glue3(INT,bits,_C) (0);
#define DECL(us,bits) glue3(DECL,us,) (bits)
#define TESTUMAX(bits) glue3(u,bits,) = ~glue3(u,bits,); if (glue3(UINT,bits,_MAX) != glue3(u,bits,)) printf ("Something wrong with UINT%d_MAX\n", bits)
#define REPORTERROR(msg) { err_n++; if (err_first <= 0) err_first = __LINE__; printf msg; }
#define X_SIZE_MAX ((size_t)-1)
int main () {
int err_n = 0;
int err_first = 0;
DECL(I,8)
DECL(U,8)
DECL(I,16)
DECL(U,16)
DECL(I,32)
DECL(U,32)
#ifdef INT64_MAX
DECL(I,64)
DECL(U,64)
#endif
intmax_t imax = INTMAX_C(0);
uintmax_t umax = UINTMAX_C(0);
char str0[256], str1[256];
sprintf (str0, "%" PRINTF_INT32_MODIFIER "d", INT32_C(2147483647));
if (0 != strcmp (str0, "2147483647")) REPORTERROR (("Something wrong with PRINTF_INT32_MODIFIER : %s\n", str0));
if (atoi(PRINTF_INT32_DEC_WIDTH) != (int) strlen(str0)) REPORTERROR (("Something wrong with PRINTF_INT32_DEC_WIDTH : %s\n", PRINTF_INT32_DEC_WIDTH));
sprintf (str0, "%" PRINTF_INT32_MODIFIER "u", UINT32_C(4294967295));
if (0 != strcmp (str0, "4294967295")) REPORTERROR (("Something wrong with PRINTF_INT32_MODIFIER : %s\n", str0));
if (atoi(PRINTF_UINT32_DEC_WIDTH) != (int) strlen(str0)) REPORTERROR (("Something wrong with PRINTF_UINT32_DEC_WIDTH : %s\n", PRINTF_UINT32_DEC_WIDTH));
#ifdef INT64_MAX
sprintf (str1, "%" PRINTF_INT64_MODIFIER "d", INT64_C(9223372036854775807));
if (0 != strcmp (str1, "9223372036854775807")) REPORTERROR (("Something wrong with PRINTF_INT32_MODIFIER : %s\n", str1));
if (atoi(PRINTF_INT64_DEC_WIDTH) != (int) strlen(str1)) REPORTERROR (("Something wrong with PRINTF_INT64_DEC_WIDTH : %s, %d\n", PRINTF_INT64_DEC_WIDTH, (int) strlen(str1)));
sprintf (str1, "%" PRINTF_INT64_MODIFIER "u", UINT64_C(18446744073709550591));
if (0 != strcmp (str1, "18446744073709550591")) REPORTERROR (("Something wrong with PRINTF_INT32_MODIFIER : %s\n", str1));
if (atoi(PRINTF_UINT64_DEC_WIDTH) != (int) strlen(str1)) REPORTERROR (("Something wrong with PRINTF_UINT64_DEC_WIDTH : %s, %d\n", PRINTF_UINT64_DEC_WIDTH, (int) strlen(str1)));
#endif
sprintf (str0, "%d %x\n", 0, ~0);
sprintf (str1, "%d %x\n", i8, ~0);
if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with i8 : %s\n", str1));
sprintf (str1, "%u %x\n", u8, ~0);
if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with u8 : %s\n", str1));
sprintf (str1, "%d %x\n", i16, ~0);
if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with i16 : %s\n", str1));
sprintf (str1, "%u %x\n", u16, ~0);
if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with u16 : %s\n", str1));
sprintf (str1, "%" PRINTF_INT32_MODIFIER "d %x\n", i32, ~0);
if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with i32 : %s\n", str1));
sprintf (str1, "%" PRINTF_INT32_MODIFIER "u %x\n", u32, ~0);
if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with u32 : %s\n", str1));
#ifdef INT64_MAX
sprintf (str1, "%" PRINTF_INT64_MODIFIER "d %x\n", i64, ~0);
if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with i64 : %s\n", str1));
#endif
sprintf (str1, "%" PRINTF_INTMAX_MODIFIER "d %x\n", imax, ~0);
if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with imax : %s\n", str1));
sprintf (str1, "%" PRINTF_INTMAX_MODIFIER "u %x\n", umax, ~0);
if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with umax : %s\n", str1));
TESTUMAX(8);
TESTUMAX(16);
TESTUMAX(32);
#ifdef INT64_MAX
TESTUMAX(64);
#endif
#define STR(v) #v
#define Q(v) printf ("sizeof " STR(v) " = %u\n", (unsigned) sizeof (v));
if (err_n) {
printf ("pstdint.h is not correct. Please use sizes below to correct it:\n");
}
Q(int)
Q(unsigned)
Q(long int)
Q(short int)
Q(int8_t)
Q(int16_t)
Q(int32_t)
#ifdef INT64_MAX
Q(int64_t)
#endif
#if UINT_MAX < X_SIZE_MAX
printf ("UINT_MAX < X_SIZE_MAX\n");
#else
printf ("UINT_MAX >= X_SIZE_MAX\n");
#endif
printf ("%" PRINTF_INT64_MODIFIER "u vs %" PRINTF_INT64_MODIFIER "u\n", UINT_MAX, X_SIZE_MAX);
return EXIT_SUCCESS;
}
#endif
+1 -1
View File
@@ -53,7 +53,7 @@ strtol(
*/
p = string;
while (TclIsSpaceProc(*p)) {
while (isspace(UCHAR(*p))) {
p += 1;
}
+1 -1
View File
@@ -74,7 +74,7 @@ strtoul(
*/
p = string;
while (TclIsSpaceProc(*p)) {
while (isspace(UCHAR(*p))) {
p += 1;
}
if (*p == '-') {
+3
View File
@@ -247,6 +247,9 @@ record instead of a value. Otherwise, it is similar to
.PP
\fBTcl_SetErrorCodeVA\fR is the same as \fBTcl_SetErrorCode\fR except that
instead of taking a variable number of arguments it takes an argument list.
Interfaces using argument lists have been found to be nonportable in practice.
This function is deprecated and will be removed in Tcl 9.0.
.PP
The procedure \fBTcl_GetErrorLine\fR is used to read the integer value
of the \fB\-errorline\fR return option without the overhead of a full
+2 -2
View File
@@ -648,8 +648,8 @@ It should call \fBTcl_BadChannelOption\fR which itself returns
unrecognized.
If \fInewValue\fR specifies a value for the option that
is not supported or if a system call error occurs,
the function should leave an error message in the
\fIresult\fR field of \fIinterp\fR if \fIinterp\fR is not NULL. The
the function should leave an error message in the result
of \fIinterp\fR if \fIinterp\fR is not NULL. The
function should also call \fBTcl_SetErrno\fR to store an appropriate POSIX
error code.
.PP
-6
View File
@@ -22,10 +22,8 @@ Tcl_Interp *
int
\fBTcl_InterpDeleted\fR(\fIinterp\fR)
.sp
.VS 8.6
int
\fBTcl_InterpActive\fR(\fIinterp\fR)
.VE 8.6
.SH ARGUMENTS
.AS Tcl_Interp *interp
.AP Tcl_Interp *interp in
@@ -70,14 +68,12 @@ deleted and when the whole interpreter is being deleted. In the former case
the callback may recreate the data being deleted, but this would lead to an
infinite loop if the interpreter were being deleted.
.PP
.VS 8.6
\fBTcl_InterpActive\fR is useful for determining whether there is any
execution of scripts ongoing in an interpreter, which is a useful piece of
information when Tcl is embedded in a garbage-collected environment and it
becomes necessary to determine whether the interpreter is a candidate for
deletion. The function returns a true value if the interpreter has at least
one active execution running inside it, and a false value otherwise.
.VE 8.6
.SH "INTERPRETERS AND MEMORY MANAGEMENT"
.PP
\fBTcl_DeleteInterp\fR can be called at any time on an interpreter that may
@@ -138,12 +134,10 @@ All uses of interpreters in Tcl and Tk have already been protected.
Extension writers should ensure that their code also properly protects any
additional interpreters used, as described above.
.PP
.VS 8.6
Note that the protection mechanisms do not work well with conventional garbage
collection systems. When in such a managed environment, \fBTcl_InterpActive\fR
should be used to determine when an interpreter is a candidate for deletion
due to inactivity.
.VE 8.6
.SH "SEE ALSO"
Tcl_Preserve(3), Tcl_Release(3)
.SH KEYWORDS
+17 -17
View File
@@ -119,7 +119,7 @@ in a hierarchical relationship, and the management of aliases, commands
that when invoked in one interpreter execute a command in another
interpreter. The return value for those procedures that return an \fBint\fR
is either \fBTCL_OK\fR or \fBTCL_ERROR\fR. If \fBTCL_ERROR\fR is returned
then the \fBresult\fR field of the interpreter contains an error message.
then the interpreter's result contains an error message.
.PP
\fBTcl_CreateSlave\fR creates a new interpreter as a slave of \fIinterp\fR.
It also creates a slave command named \fIslaveName\fR in \fIinterp\fR which
@@ -158,12 +158,12 @@ If no such slave interpreter exists, \fBNULL\fR is returned.
\fIinterp\fR. If \fIinterp\fR has no master (it is a
top-level interpreter) then \fBNULL\fR is returned.
.PP
\fBTcl_GetInterpPath\fR sets the \fIresult\fR field in \fIaskingInterp\fR
to the relative path between \fIaskingInterp\fR and \fIslaveInterp\fR;
\fBTcl_GetInterpPath\fR stores in the result of \fIaskingInterp\fR
the relative path between \fIaskingInterp\fR and \fIslaveInterp\fR;
\fIslaveInterp\fR must be a slave of \fIaskingInterp\fR. If the computation
of the relative path succeeds, \fBTCL_OK\fR is returned, else
\fBTCL_ERROR\fR is returned and the \fIresult\fR field in
\fIaskingInterp\fR contains the error message.
\fBTCL_ERROR\fR is returned and an error message is stored as the
result of \fIaskingInterp\fR.
.PP
\fBTcl_CreateAlias\fR creates a command named \fIslaveCmd\fR in
\fIslaveInterp\fR that when invoked, will cause the command \fItargetCmd\fR
@@ -198,33 +198,33 @@ the set of hidden commands to the set of exposed commands, putting
it under the name
\fIcmdName\fR.
\fIHiddenCmdName\fR must be the name of an existing hidden
command, or the operation will return \fBTCL_ERROR\fR and leave an error
message in the \fIresult\fR field in \fIinterp\fR.
command, or the operation will return \fBTCL_ERROR\fR and
leave an error message as the result of \fIinterp\fR.
If an exposed command named \fIcmdName\fR already exists,
the operation returns \fBTCL_ERROR\fR and leaves an error message in the
value result of \fIinterp\fR.
the operation returns \fBTCL_ERROR\fR and leaves an error message as
the result of \fIinterp\fR.
If the operation succeeds, it returns \fBTCL_OK\fR.
After executing this command, attempts to use \fIcmdName\fR in a call to
\fBTcl_Eval\fR or with the Tcl \fBeval\fR command will again succeed.
After executing this command, attempts to use \fIcmdName\fR in any
script evaluation mechanism will again succeed.
.PP
\fBTcl_HideCommand\fR moves the command named \fIcmdName\fR from the set of
exposed commands to the set of hidden commands, under the name
\fIhiddenCmdName\fR.
\fICmdName\fR must be the name of an existing exposed
command, or the operation will return \fBTCL_ERROR\fR and leave an error
message in the value result of \fIinterp\fR.
message as the result of \fIinterp\fR.
Currently both \fIcmdName\fR and \fIhiddenCmdName\fR must not contain
namespace qualifiers, or the operation will return \fBTCL_ERROR\fR and
leave an error message in the value result of \fIinterp\fR.
leave an error message as the result of \fIinterp\fR.
The \fICmdName\fR will be looked up in the global namespace, and not
relative to the current namespace, even if the current namespace is not the
global one.
If a hidden command whose name is \fIhiddenCmdName\fR already
exists, the operation also returns \fBTCL_ERROR\fR and the \fIresult\fR
field in \fIinterp\fR contains an error message.
exists, the operation also returns \fBTCL_ERROR\fR and an error
message is left as the result of \fIinterp\fR.
If the operation succeeds, it returns \fBTCL_OK\fR.
After executing this command, attempts to use \fIcmdName\fR in a call to
\fBTcl_Eval\fR or with the Tcl \fBeval\fR command will fail.
After executing this command, attempts to use \fIcmdName\fR in
any script evaluation mechanism will fail.
.PP
For a description of the Tcl interface to multiple interpreters, see
\fIinterp(n)\fR.
-4
View File
@@ -36,13 +36,11 @@ int
int
\fBTcl_SetEnsembleMappingDict\fR(\fIinterp, token, dictObj\fR)
.sp
.VS 8.6
int
\fBTcl_GetEnsembleParameterList\fR(\fIinterp, token, listObjPtr\fR)
.sp
int
\fBTcl_SetEnsembleParameterList\fR(\fIinterp, token, listObj\fR)
.VE 8.6
.sp
int
\fBTcl_GetEnsembleSubcommandList\fR(\fIinterp, token, listObjPtr\fR)
@@ -163,7 +161,6 @@ All command names in prefixes set via \fBTcl_SetEnsembleMappingDict\fR
must be fully qualified.
.TP
\fBformal pre-subcommand parameter list\fR (read-write)
.VS 8.6
A list of formal parameter names (the names only being used when generating
error messages) that come at invocation of the ensemble between the name of
the ensemble and the subcommand argument. NULL (the default) is equivalent to
@@ -174,7 +171,6 @@ respectively. The result of both of those functions is a Tcl result code
ensemble) and the
dictionary obtained from \fBTcl_GetEnsembleParameterList\fR should always be
treated as immutable even if it is unshared.
.VE 8.6
.TP
\fBsubcommand list\fR (read-write)
.
+3 -2
View File
@@ -150,13 +150,14 @@ equivalent to using the \fBTCL_EVAL_GLOBAL\fR flag (see below).
of any length, concatenates them into a single string,
then calls \fBTcl_Eval\fR to execute that string as a Tcl command.
It returns the result of the command and also modifies
\fIinterp->result\fR in the same way as \fBTcl_Eval\fR.
the interpreter result in the same way as \fBTcl_Eval\fR.
The last argument to \fBTcl_VarEval\fR must be NULL to indicate the end
of arguments. \fBTcl_VarEval\fR is now deprecated.
.PP
\fBTcl_VarEvalVA\fR is the same as \fBTcl_VarEval\fR except that
instead of taking a variable number of arguments it takes an argument
list. Like \fBTcl_VarEval\fR, \fBTcl_VarEvalVA\fR is deprecated.
list. Interfaces using argument lists have been found to be nonportable
in practice. This function is deprecated and will be removed in Tcl 9.0.
.SH "FLAG BITS"
.PP
-10
View File
@@ -63,10 +63,8 @@ int
\fBTcl_FSLoadFile\fR(\fIinterp, pathPtr, sym1, sym2, proc1Ptr, proc2Ptr,
loadHandlePtr, unloadProcPtr\fR)
.sp
.VS 8.6
int
\fBTcl_FSUnloadFile\fR(\fIinterp, loadHandle\fR)
.VE 8.6
.sp
int
\fBTcl_FSMatchInDirectory\fR(\fIinterp, resultPtr, pathPtr, pattern, types\fR)
@@ -146,7 +144,6 @@ Tcl_Obj *
Tcl_StatBuf *
\fBTcl_AllocStatBuf\fR()
.sp
.VS 8.6
Tcl_WideInt
\fBTcl_GetAccessTimeFromStat\fR(\fIstatPtr\fR)
.sp
@@ -185,7 +182,6 @@ Tcl_WideUInt
.sp
int
\fBTcl_GetUserIdFromStat\fR(\fIstatPtr\fR)
.VE 8.6
.SH ARGUMENTS
.AS Tcl_GlobTypeData **srcPathPtr out
.AP "const Tcl_Filesystem" *fsPtr in
@@ -444,20 +440,16 @@ belongs will be called. If that filesystem does not implement this
function (most virtual filesystems will not, because of OS limitations
in dynamically loading binary code), Tcl will attempt to copy the file
to a temporary directory and load that temporary file.
.VS 8.6
\fBTcl_FSUnloadFile\fR reverses the operation, asking for the library
indicated by the \fIloadHandle\fR to be removed from the process. Note that,
unlike with the \fBunload\fR command, this does not give the library any
opportunity to clean up.
.VE 8.6
.PP
Both the above functions return a standard Tcl completion code. If an error
occurs, an error message is left in the \fIinterp\fR's result.
.PP
.VS 8.6
The token provided via the variable indicated by \fIloadHandlePtr\fR may be
used with \fBTcl_FindSymbol\fR.
.VE 8.6
.PP
\fBTcl_FSMatchInDirectory\fR is used by the globbing code to search a
directory for all files which match a given pattern. The appropriate
@@ -795,7 +787,6 @@ may be deallocated by being passed to \fBckfree\fR). This allows extensions to
invoke \fBTcl_FSStat\fR and \fBTcl_FSLstat\fR without being dependent on the
size of the buffer. That in turn depends on the flags used to build Tcl.
.PP
.VS 8.6
The portable fields of a \fITcl_StatBuf\fR may be read using the following
functions, each of which returns the value of the corresponding field listed
in the table below. Note that on some platforms there may be other fields in
@@ -819,7 +810,6 @@ for a full description of these fields.
\fBTcl_GetBlocksFromStat\fR st_blocks
\fBTcl_GetBlockSizeFromStat\fR st_blksize
.DE
.VE 8.6
.SH "THE VIRTUAL FILESYSTEM API"
.PP
A filesystem provides a \fBTcl_Filesystem\fR structure that contains
+13 -106
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
.TH Tcl_Interp 3 7.5 Tcl "Tcl Library Procedures"
.TH Tcl_Interp 3 8.7 Tcl "Tcl Library Procedures"
.so man.macros
.BS
.SH NAME
@@ -15,9 +15,9 @@ Tcl_Interp \- client-visible fields of interpreter structures
\fB#include <tcl.h>\fR
.sp
typedef struct {
char *\fIresult\fR;
Tcl_FreeProc *\fIfreeProc\fR;
int \fIerrorLine\fR;
char *\fIresult\fR; /* NO LONGER AVAILABLE */
Tcl_FreeProc *\fIfreeProc\fR; /* NO LONGER AVAILABLE */
int \fIerrorLine\fR; /* NO LONGER AVAILABLE */
} \fBTcl_Interp\fR;
typedef void \fBTcl_FreeProc\fR(
@@ -25,110 +25,17 @@ typedef void \fBTcl_FreeProc\fR(
.BE
.SH DESCRIPTION
.PP
The \fBTcl_CreateInterp\fR procedure returns a pointer to a Tcl_Interp
The \fBTcl_CreateInterp\fR procedure returns a pointer to a \fBTcl_Interp\fR
structure. Callers of \fBTcl_CreateInterp\fR should use this pointer
as an opaque token, suitable for nothing other than passing back to
other routines in the Tcl interface. Accessing fields directly through
the pointer as described below is no longer supported. The supported
public routines \fBTcl_SetResult\fR, \fBTcl_GetResult\fR,
\fBTcl_SetErrorLine\fR, \fBTcl_GetErrorLine\fR must be used instead.
other routines in the Tcl interface from the same thread that called
\fBTcl_CreateInterp\fR. The \fBTcl_Interp\fR struct no longer has any
supported client-visible fields. Supported public routines such as
\fBTcl_SetResult\fR, \fBTcl_GetResult\fR, \fBTcl_SetErrorLine\fR,
\fBTcl_GetErrorLine\fR must be used instead.
.PP
For legacy programs and extensions no longer being maintained, compiles
against the Tcl 8.6 header files are only possible with the compiler
directives
.CS
#define USE_INTERP_RESULT
.CE
and/or
.CS
#define USE_INTERP_ERRORLINE
.CE
depending on which fields of the \fBTcl_Interp\fR struct are accessed.
These directives may be embedded in code or supplied via compiler options.
.PP
The \fIresult\fR and \fIfreeProc\fR fields are used to return
results or error messages from commands.
This information is returned by command procedures back to \fBTcl_Eval\fR,
and by \fBTcl_Eval\fR back to its callers.
The \fIresult\fR field points to the string that represents the
result or error message, and the \fIfreeProc\fR field tells how
to dispose of the storage for the string when it is not needed anymore.
The easiest way for command procedures to manipulate these
fields is to call procedures like \fBTcl_SetResult\fR
or \fBTcl_AppendResult\fR; they
will hide all the details of managing the fields.
The description below is for those procedures that manipulate the
fields directly.
.PP
Whenever a command procedure returns, it must ensure
that the \fIresult\fR field of its interpreter points to the string
being returned by the command.
The \fIresult\fR field must always point to a valid string.
If a command wishes to return no result then \fIinterp->result\fR
should point to an empty string.
Normally, results are assumed to be statically allocated,
which means that the contents will not change before the next time
\fBTcl_Eval\fR is called or some other command procedure is invoked.
In this case, the \fIfreeProc\fR field must be zero.
Alternatively, a command procedure may dynamically
allocate its return value (e.g. using \fBTcl_Alloc\fR)
and store a pointer to it in \fIinterp->result\fR.
In this case, the command procedure must also set \fIinterp->freeProc\fR
to the address of a procedure that can free the value, or \fBTCL_DYNAMIC\fR
if the storage was allocated directly by Tcl or by a call to
\fBTcl_Alloc\fR.
If \fIinterp->freeProc\fR is non-zero, then Tcl will call \fIfreeProc\fR
to free the space pointed to by \fIinterp->result\fR before it
invokes the next command.
If a client procedure overwrites \fIinterp->result\fR when
\fIinterp->freeProc\fR is non-zero, then it is responsible for calling
\fIfreeProc\fR to free the old \fIinterp->result\fR (the \fBTcl_FreeResult\fR
macro should be used for this purpose).
.PP
\fIFreeProc\fR should have arguments and result that match the
\fBTcl_FreeProc\fR declaration above: it receives a single
argument which is a pointer to the result value to free.
In most applications \fBTCL_DYNAMIC\fR is the only non-zero value ever
used for \fIfreeProc\fR.
However, an application may store a different procedure address
in \fIfreeProc\fR in order to use an alternate memory allocator
or in order to do other cleanup when the result memory is freed.
.PP
As part of processing each command, \fBTcl_Eval\fR initializes
\fIinterp->result\fR
and \fIinterp->freeProc\fR just before calling the command procedure for
the command. The \fIfreeProc\fR field will be initialized to zero,
and \fIinterp->result\fR will point to an empty string. Commands that
do not return any value can simply leave the fields alone.
Furthermore, the empty string pointed to by \fIresult\fR is actually
part of an array of approximately 200 characters.
If a command wishes to return a short string, it can simply copy
it to the area pointed to by \fIinterp->result\fR. Or, it can use
the sprintf procedure to generate a short result string at the location
pointed to by \fIinterp->result\fR.
.PP
It is a general convention in Tcl-based applications that the result
of an interpreter is normally in the initialized state described
in the previous paragraph.
Procedures that manipulate an interpreter's result (e.g. by
returning an error) will generally assume that the result
has been initialized when the procedure is called.
If such a procedure is to be called after the result has been
changed, then \fBTcl_ResetResult\fR should be called first to
reset the result to its initialized state. The direct use of
\fIinterp->result\fR is strongly deprecated (see \fBTcl_SetResult\fR).
.PP
The \fIerrorLine\fR
field is valid only after \fBTcl_Eval\fR returns
a \fBTCL_ERROR\fR return code. In this situation the \fIerrorLine\fR
field identifies the line number of the command being executed when
the error occurred. The line numbers are relative to the command
being executed: 1 means the first line of the command passed to
\fBTcl_Eval\fR, 2 means the second line, and so on.
The \fIerrorLine\fR field is typically used in conjunction with
\fBTcl_AddErrorInfo\fR to report information about where an error
occurred.
\fIErrorLine\fR should not normally be modified except by \fBTcl_Eval\fR.
Any legacy programs and extensions trying to access the fields above
in their source code will need conversion to compile for Tcl 8.7 and later.
.SH KEYWORDS
free, initialized, interpreter, malloc, result
interpreter, result
+12 -12
View File
@@ -96,7 +96,7 @@ Any value written into the Tcl variable must have a proper integer
form acceptable to \fBTcl_GetIntFromObj\fR; attempts to write
non-integer values into \fIvarName\fR will be rejected with
Tcl errors. Incomplete integer representations (like the empty
string, '+', '-' or the hex/octal/binary prefix) are accepted
string, '+', '-' or the hex/octal/decimal/binary prefix) are accepted
as if they are valid too.
.TP
\fBTCL_LINK_UINT\fR
@@ -107,7 +107,7 @@ integer form acceptable to \fBTcl_GetWideIntFromObj\fR and in the
platform's defined range for the \fBunsigned int\fR type; attempts to
write non-integer values (or values outside the range) into
\fIvarName\fR will be rejected with Tcl errors. Incomplete integer
representations (like the empty string, '+', '-' or the hex/octal/binary
representations (like the empty string, '+', '-' or the hex/octal/decimal/binary
prefix) are accepted as if they are valid too.
.TP
\fBTCL_LINK_CHAR\fR
@@ -118,7 +118,7 @@ form acceptable to \fBTcl_GetIntFromObj\fR and be in the range of the
\fBchar\fR datatype; attempts to write non-integer or out-of-range
values into \fIvarName\fR will be rejected with Tcl errors. Incomplete
integer representations (like the empty string, '+', '-' or the
hex/octal/binary prefix) are accepted as if they are valid too.
hex/octal/decimal/binary prefix) are accepted as if they are valid too.
.RS
.PP
.VS "TIP 312"
@@ -141,7 +141,7 @@ integer form acceptable to \fBTcl_GetIntFromObj\fR and in the
platform's defined range for the \fBunsigned char\fR type; attempts to
write non-integer values (or values outside the range) into
\fIvarName\fR will be rejected with Tcl errors. Incomplete integer
representations (like the empty string, '+', '-' or the hex/octal/binary
representations (like the empty string, '+', '-' or the hex/octal/decimal/binary
prefix) are accepted as if they are valid too.
.RS
.PP
@@ -166,7 +166,7 @@ form acceptable to \fBTcl_GetIntFromObj\fR and be in the range of the
\fBshort\fR datatype; attempts to write non-integer or out-of-range
values into \fIvarName\fR will be rejected with Tcl errors. Incomplete
integer representations (like the empty string, '+', '-' or the
hex/octal/binary prefix) are accepted as if they are valid too.
hex/octal/decimal/binary prefix) are accepted as if they are valid too.
.TP
\fBTCL_LINK_USHORT\fR
.
@@ -176,7 +176,7 @@ integer form acceptable to \fBTcl_GetIntFromObj\fR and in the
platform's defined range for the \fBunsigned short\fR type; attempts to
write non-integer values (or values outside the range) into
\fIvarName\fR will be rejected with Tcl errors. Incomplete integer
representations (like the empty string, '+', '-' or the hex/octal/binary
representations (like the empty string, '+', '-' or the hex/octal/decimal/binary
prefix) are accepted as if they are valid too.
.TP
\fBTCL_LINK_LONG\fR
@@ -187,7 +187,7 @@ form acceptable to \fBTcl_GetLongFromObj\fR; attempts to write
non-integer or out-of-range
values into \fIvarName\fR will be rejected with Tcl errors. Incomplete
integer representations (like the empty string, '+', '-' or the
hex/octal/binary prefix) are accepted as if they are valid too.
hex/octal/decimal/binary prefix) are accepted as if they are valid too.
.TP
\fBTCL_LINK_ULONG\fR
.
@@ -197,7 +197,7 @@ integer form acceptable to \fBTcl_GetWideIntFromObj\fR and in the
platform's defined range for the \fBunsigned long\fR type; attempts to
write non-integer values (or values outside the range) into
\fIvarName\fR will be rejected with Tcl errors. Incomplete integer
representations (like the empty string, '+', '-' or the hex/octal/binary
representations (like the empty string, '+', '-' or the hex/octal/decimal/binary
prefix) are accepted as if they are valid too.
.TP
\fBTCL_LINK_DOUBLE\fR
@@ -207,7 +207,7 @@ Any value written into the Tcl variable must have a proper real
form acceptable to \fBTcl_GetDoubleFromObj\fR; attempts to write
non-real values into \fIvarName\fR will be rejected with
Tcl errors. Incomplete integer or real representations (like the
empty string, '.', '+', '-' or the hex/octal/binary prefix) are
empty string, '.', '+', '-' or the hex/octal/decimal/binary prefix) are
accepted as if they are valid too.
.TP
\fBTCL_LINK_FLOAT\fR
@@ -219,7 +219,7 @@ range acceptable for a \fBfloat\fR; attempts to
write non-real values (or values outside the range) into
\fIvarName\fR will be rejected with Tcl errors. Incomplete integer
or real representations (like the empty string, '.', '+', '-' or
the hex/octal/binary prefix) are accepted as if they are valid too.
the hex/octal/decimal/binary prefix) are accepted as if they are valid too.
.TP
\fBTCL_LINK_WIDE_INT\fR
.
@@ -230,7 +230,7 @@ Any value written into the Tcl variable must have a proper integer
form acceptable to \fBTcl_GetWideIntFromObj\fR; attempts to write
non-integer values into \fIvarName\fR will be rejected with
Tcl errors. Incomplete integer representations (like the empty
string, '+', '-' or the hex/octal/binary prefix) are accepted
string, '+', '-' or the hex/octal/decimal/binary prefix) are accepted
as if they are valid too.
.TP
\fBTCL_LINK_WIDE_UINT\fR
@@ -244,7 +244,7 @@ cast to unsigned);
.\" FIXME! Use bignums instead.
attempts to write non-integer values into \fIvarName\fR will be
rejected with Tcl errors. Incomplete integer representations (like
the empty string, '+', '-' or the hex/octal/binary prefix) are accepted
the empty string, '+', '-' or the hex/octal/decimal/binary prefix) are accepted
as if they are valid too.
.TP
\fBTCL_LINK_BOOLEAN\fR
-2
View File
@@ -85,14 +85,12 @@ unless \fIinterp\fR is NULL.
Otherwise, it returns \fBTCL_OK\fR.
Passing a NULL \fIinterp\fR allows this procedure to be used
as a test whether the conversion can be done (and in fact was done).
.VS 8.5
.PP
In many cases, the \fItypePtr->setFromAnyProc\fR routine will
set \fIobjPtr->typePtr\fR to the argument value \fItypePtr\fR,
but that is no longer guaranteed. The \fIsetFromAnyProc\fR is
free to set the internal representation for \fIobjPtr\fR to make
use of another related Tcl_ObjType, if it sees fit.
.VE 8.5
.SH "THE TCL_OBJTYPE STRUCTURE"
.PP
Extension writers can define new value types by defining four
+7 -6
View File
@@ -53,13 +53,13 @@ In a freshly loaded Tcl library, \fBTcl_Panic\fR prints the formatted
error message to the standard error file of the process, and then
calls \fBabort\fR to terminate the process. \fBTcl_Panic\fR does not
return. On Windows, when a debugger is running, the formatted error
message is sent to the debugger in stead. If the windows executable
message is sent to the debugger instead. If the windows executable
does not have a stderr channel (e.g. \fBwish.exe\fR), then a
system dialog box is used to display the panic message.
.PP
If your application doesn't use \fBTcl_Main\fR or \fBTk_Main\fR
and you want to implicitly use the stderr channel of your
application's C runtime (in stead of the stderr channel of the
application's C runtime (instead of the stderr channel of the
C runtime used by Tcl), you can call \fBTcl_SetPanicProc\fR
with \fBTcl_ConsolePanic\fR as its argument. On platforms which
only have one C runtime (almost all platforms except Windows)
@@ -86,6 +86,9 @@ The typical use of \fBTcl_SetPanicProc\fR arranges for the error message
to be displayed or reported in a manner more suitable for the
application or the platform.
.PP
\fBTcl_SetPanicProc\fR can not be used in stub-enabled extensions. Its symbol
entry in the stub table is deprecated and it will be removed in Tcl 9.0.
.PP
Although the primary callers of \fBTcl_Panic\fR are the procedures of
the Tcl library, \fBTcl_Panic\fR is a public function and may be called
by any extension or application that wishes to abort the process and
@@ -93,11 +96,9 @@ have a panic message displayed the same way that panic messages from Tcl
will be displayed.
.PP
\fBTcl_PanicVA\fR is the same as \fBTcl_Panic\fR except that instead of
taking a variable number of arguments it takes an argument list. This
taking a variable number of arguments it takes an argument list. Interfaces
using argument lists have been found to be nonportable in practice. This
function is deprecated and will be removed in Tcl 9.0.
.PP
This function can not be used in stub-enabled extensions. Its symbol
entry in the stub table is deprecated and it will be removed in Tcl 9.0.
.SH "SEE ALSO"
abort(3), printf(3), exec(n), format(n)
.SH KEYWORDS
+19 -28
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
.TH Tcl_SetResult 3 8.0 Tcl "Tcl Library Procedures"
.TH Tcl_SetResult 3 8.7 Tcl "Tcl Library Procedures"
.so man.macros
.BS
.SH NAME
@@ -30,9 +30,7 @@ const char *
.sp
\fBTcl_ResetResult\fR(\fIinterp\fR)
.sp
.VS 8.6
\fBTcl_TransferResult\fR(\fIsourceInterp, result, targetInterp\fR)
.VE 8.6
\fBTcl_TransferResult\fR(\fIsourceInterp, code, targetInterp\fR)
.sp
\fBTcl_AppendElement\fR(\fIinterp, element\fR)
.sp
@@ -57,18 +55,11 @@ Address of procedure to call to release storage at
An argument list which must have been initialized using
\fBva_start\fR, and cleared using \fBva_end\fR.
.AP Tcl_Interp *sourceInterp in
.VS 8.6
Interpreter that the result and error information should be copied from.
.VE 8.6
Interpreter that the result and return options should be transferred from.
.AP Tcl_Interp *targetInterp in
.VS 8.6
Interpreter that the result and error information should be copied to.
.VE 8.6
.AP int result in
.VS 8.6
If \fBTCL_OK\fR, only copy the result. If \fBTCL_ERROR\fR, copy the error
information as well.
.VE 8.6
Interpreter that the result and return options should be transferred to.
.AP int code in
Return code value that controls transfer of return options.
.BE
.SH DESCRIPTION
.PP
@@ -154,13 +145,17 @@ call; the last argument in the list must be a NULL pointer.
.PP
\fBTcl_AppendResultVA\fR is the same as \fBTcl_AppendResult\fR except that
instead of taking a variable number of arguments it takes an argument list.
Interfaces using argument lists have been found to be nonportable in practice.
This function is deprecated and will be removed in Tcl 9.0.
.PP
.VS 8.6
\fBTcl_TransferResult\fR moves a result from one interpreter to another,
optionally (dependent on the \fIresult\fR parameter) including the error
information dictionary as well. The interpreters must be in the same thread.
The source interpreter will have its result reset by this operation.
.VE 8.6
\fBTcl_TransferResult\fR transfers interpreter state from \fIsourceInterp\fR
to \fItargetInterp\fR. The two interpreters must have been created in the
same thread. If \fIsourceInterp\fR and \fItargetInterp\fR are the same,
nothing is done. Otherwise, \fBTcl_TransferResult\fR moves the result
from \fIsourceInterp\fR to \fItargetInterp\fR, and resets the result
in \fIsourceInterp\fR. It also moves the return options dictionary as
controlled by the return code value \fIcode\fR in the same manner
as \fBTcl_GetReturnOptions\fR.
.SH "DEPRECATED INTERFACES"
.SS "OLD STRING PROCEDURES"
.PP
@@ -202,14 +197,9 @@ is about to replace one result value with another.
It used to be legal for programs to
directly read and write \fIinterp->result\fR
to manipulate the interpreter result. The Tcl headers no longer
permit this access by default, and C code still doing this must
permit this access. C code still doing this must
be updated to use supported routines \fBTcl_GetObjResult\fR,
\fBTcl_GetStringResult\fR, \fBTcl_SetObjResult\fR, and \fBTcl_SetResult\fR.
As a migration aid, access can be restored with the compiler directive
.CS
#define USE_INTERP_RESULT
.CE
but this is meant only to offer life support to otherwise dead code.
.SH "THE TCL_FREEPROC ARGUMENT TO TCL_SETRESULT"
.PP
\fBTcl_SetResult\fR's \fIfreeProc\fR argument specifies how
@@ -250,6 +240,7 @@ typedef void \fBTcl_FreeProc\fR(
When \fIfreeProc\fR is called, its \fIblockPtr\fR will be set to
the value of \fIresult\fR passed to \fBTcl_SetResult\fR.
.SH "SEE ALSO"
Tcl_AddErrorInfo, Tcl_CreateObjCommand, Tcl_SetErrorCode, Tcl_Interp
Tcl_AddErrorInfo, Tcl_CreateObjCommand, Tcl_SetErrorCode, Tcl_Interp,
Tcl_GetReturnOptions
.SH KEYWORDS
append, command, element, list, value, result, return value, interpreter
+1 -1
View File
@@ -65,7 +65,7 @@ error message. The result or error from the initialization procedure will
be returned as the result of the \fBload\fR command that caused the
initialization procedure to be invoked.
.PP
This function can not be used in stub-enabled extensions. Its symbol
\fBTcl_StaticPackage\fR can not be used in stub-enabled extensions. Its symbol
entry in the stub table is deprecated and it will be removed in Tcl 9.0.
.SH KEYWORDS
initialization procedure, package, static linking
+3 -1
View File
@@ -249,7 +249,9 @@ must be a NULL pointer to indicate the end of the list.
.PP
\fBTcl_AppendStringsToObjVA\fR is the same as \fBTcl_AppendStringsToObj\fR
except that instead of taking a variable number of arguments it takes an
argument list.
argument list. Interfaces using argument lists have been found to be
nonportable in practice. This function is deprecated and will be removed
in Tcl 9.0.
.PP
\fBTcl_AppendLimitedToObj\fR is similar to \fBTcl_AppendToObj\fR
except that it imposes a limit on how many bytes are appended.
+1 -1
View File
@@ -190,7 +190,7 @@ procedure (if any) returns. In non-interactive mode, after
procedure (if any) returns, \fBTcl_Main\fR will also evaluate
the \fBexit\fR command.
.PP
This function can not be used in stub-enabled extensions.
\fBTcl_Main\fR can not be used in stub-enabled extensions.
.SH "SEE ALSO"
tclsh(1), Tcl_GetStdChannel(3), Tcl_StandardChannels(3), Tcl_AppInit(3),
exit(n), encoding(n)
+10 -4
View File
@@ -8,7 +8,7 @@
.so man.macros
.BS
.SH NAME
Tcl_UniChar, Tcl_UniCharToUtf, Tcl_UtfToUniChar, Tcl_UtfToChar16, Tcl_UtfToWChar, Tcl_UniCharToUtfDString, Tcl_UtfToUniCharDString, Tcl_WCharToUtfDString, Tcl_UtfToWCharDString, Tcl_Char16ToUtfDString, Tcl_UtfToChar16DString, Tcl_UniCharLen, Tcl_UniCharNcmp, Tcl_UniCharNcasecmp, Tcl_UniCharCaseMatch, Tcl_UtfNcmp, Tcl_UtfNcasecmp, Tcl_UtfCharComplete, Tcl_NumUtfChars, Tcl_UtfFindFirst, Tcl_UtfFindLast, Tcl_UtfNext, Tcl_UtfPrev, Tcl_UniCharAtIndex, Tcl_UtfAtIndex, Tcl_UtfBackslash \- routines for manipulating UTF-8 strings
Tcl_UniChar, Tcl_UniCharToUtf, Tcl_UtfToUniChar, Tcl_UtfToChar16, Tcl_UtfToWChar, Tcl_UniCharToUtfDString, Tcl_UtfToUniCharDString, Tcl_Char16ToUtfDString, Tcl_UtfToWCharDString, Tcl_UtfToChar16DString, Tcl_UniCharLen, Tcl_UniCharNcmp, Tcl_UniCharNcasecmp, Tcl_UniCharCaseMatch, Tcl_UtfNcmp, Tcl_UtfNcasecmp, Tcl_UtfCharComplete, Tcl_NumUtfChars, Tcl_UtfFindFirst, Tcl_UtfFindLast, Tcl_UtfNext, Tcl_UtfPrev, Tcl_UniCharAtIndex, Tcl_UtfAtIndex, Tcl_UtfBackslash \- routines for manipulating UTF-8 strings
.SH SYNOPSIS
.nf
\fB#include <tcl.h>\fR
@@ -120,6 +120,12 @@ A null-terminated Unicode string.
A null-terminated UTF-16 string.
.AP "const wchar_t" *wStr in
A null-terminated wchar_t string.
.AP "const unsigned short" *utf16s in
A null-terminated utf-16 string.
.AP "const unsigned short" *utf16t in
A null-terminated utf-16 string.
.AP "const unsigned short" *utf16Pattern in
A null-terminated utf-16 string.
.AP int length in
The length of the UTF-8 string in bytes (not UTF-8 characters). If
negative, all bytes up to the first null byte are used.
@@ -148,11 +154,11 @@ case-insensitive (1).
.PP
These routines convert between UTF-8 strings and Unicode/Utf-16 characters.
A UTF-8 character is a Unicode character represented as a varying-length
sequence of up to \fBTCL_UTF_MAX\fR bytes. A multibyte UTF-8 sequence
sequence of up to \fB4\fR bytes. A multibyte UTF-8 sequence
consists of a lead byte followed by some number of trail bytes.
.PP
\fBTCL_UTF_MAX\fR is the maximum number of bytes that it takes to
represent one Unicode character in the UTF-8 representation.
\fBTCL_UTF_MAX\fR is the maximum number of bytes that \fBTcl_UtfToUniChar\fR
can consume in a single call.
.PP
\fBTcl_UniCharToUtf\fR stores the character \fIch\fR as a UTF-8 string
in starting at \fIbuf\fR. The return value is the number of bytes stored
-6
View File
@@ -56,9 +56,7 @@ When the return code from evaluation of \fIscript\fR is
\fBTCL_ERROR\fR, four additional entries are defined in the dictionary
of return options stored in \fIoptionsVarName\fR: \fB\-errorinfo\fR,
\fB\-errorcode\fR, \fB\-errorline\fR, and
.VS 8.6
\fB\-errorstack\fR.
.VE 8.6
The value of the \fB\-errorinfo\fR entry is a formatted stack trace containing
more information about the context in which the error happened. The formatted
stack trace is meant to be read by a person. The value of the
@@ -67,7 +65,6 @@ list. The \fB\-errorcode\fR value is meant to be further processed by
programs, and may not be particularly readable by people. The value of the
\fB\-errorline\fR entry is an integer indicating which line of \fIscript\fR
was being evaluated when the error occurred.
.VS 8.6
The value of the \fB\-errorstack\fR entry is an
even-sized list made of token-parameter pairs accumulated while
unwinding the stack. The token may be
@@ -87,14 +84,11 @@ the static text of the calling sites, and
.IP [3]
it is coarser-grained, with only one element per stack frame (like procs; no
separate elements for \fBforeach\fR constructs for example).
.VE 8.6
.PP
The values of the \fB\-errorinfo\fR and \fB\-errorcode\fR entries of
the most recent error are also available as values of the global
variables \fB::errorInfo\fR and \fB::errorCode\fR respectively.
.VS 8.6
The value of the \fB\-errorstack\fR entry surfaces as \fBinfo errorstack\fR.
.VE 8.6
.PP
Tcl packages may provide commands that set other entries in the
dictionary of return options, and the \fBreturn\fR command may be
-10
View File
@@ -35,7 +35,6 @@ turned on by default.
.
Close and destroy the channel called \fIchannelId\fR. Note that this
deletes all existing file-events registered on the channel.
.VS 8.6
If the \fIdirection\fR argument (which must be \fBread\fR or \fBwrite\fR or
any unique abbreviation of them) is present, the channel will only be
half-closed, so that it can go from being read-write to write-only or
@@ -45,7 +44,6 @@ write-only channels. Without the \fIdirection\fR argument, the channel is
closed for both reading and writing (but only if those directions are
currently open). It is an error to close a read-only channel for writing, or a
write-only channel for reading.
.VE 8.6
.RS
.PP
As part of closing the channel, all buffered output is flushed to the
@@ -83,12 +81,10 @@ an error occurs while flushing output. If a command in a command
pipeline created with \fBopen\fR returns an error, \fBchan close\fR
generates an error (similar to the \fBexec\fR command.)
.PP
.VS 8.6
Note that half-closes of sockets and command pipelines can have important side
effects because they result in a shutdown() or close() of the underlying
system resource, which can change how other processes or systems respond to
the Tcl program.
.VE 8.6
.RE
.TP
\fBchan configure \fIchannelId\fR ?\fIoptionName\fR? ?\fIvalue\fR? ?\fIoptionName value\fR?...
@@ -540,7 +536,6 @@ an extremely long line that exceeds the available memory to buffer it).
Returns -1 if the channel was not opened for the mode in question.
.TP
\fBchan pipe\fR
.VS 8.6
Creates a standalone pipe whose read- and write-side channels are
returned as a 2-element list, the first element being the read side and
the second the write side. Can be useful e.g. to redirect
@@ -561,16 +556,13 @@ is most likely to show up when using pipelines for testing; care should be
taken to ensure that deadlocks do not occur and that potential short reads are
allowed for.
.RE
.VE 8.6
.TP
\fBchan pop \fIchannelId\fR
.VS 8.6
Removes the topmost transformation from the channel \fIchannelId\fR, if there
is any. If there are no transformations added to \fIchannelId\fR, this is
equivalent to \fBchan close\fR of that channel. The result is normally the
empty string, but can be an error in some situations (i.e. where the
underlying system stream is closed and that results in an error).
.VE 8.6
.TP
\fBchan postevent \fIchannelId eventSpec\fR
.
@@ -609,7 +601,6 @@ executed in the interpreter that set them up.
.RE
.TP
\fBchan push \fIchannelId cmdPrefix\fR
.VS 8.6
Adds a new transformation on top of the channel \fIchannelId\fR. The
\fIcmdPrefix\fR argument describes a list of one or more words which represent
a handler that will be used to implement the transformation. The command
@@ -618,7 +609,6 @@ The result of this subcommand is a handle to the transformation. Note that it
is important to make sure that the transformation is capable of supporting the
channel mode that it is used with or this can make the channel neither
readable nor writable.
.VE 8.6
.TP
\fBchan puts\fR ?\fB\-nonewline\fR? ?\fIchannelId\fR? \fIstring\fR
.
-4
View File
@@ -49,16 +49,13 @@ When the last interpreter in which the channel is registered invokes
.PP
Channels are automatically closed when an interpreter is destroyed and
when the process exits.
.VS 8.6
From 8.6 on (TIP#398), nonblocking channels are no longer switched to blocking mode when exiting; this guarantees a timely exit even when the peer or a communication channel is stalled. To ensure proper flushing of stalled nonblocking channels on exit, one must now either (a) actively switch them back to blocking or (b) use the environment variable TCL_FLUSH_NONBLOCKING_ON_EXIT, which when set and not equal to "0" restores the previous behavior.
.VE 8.6
.PP
The command returns an empty string, and may generate an error if
an error occurs while flushing output. If a command in a command
pipeline created with \fBopen\fR returns an error, \fBclose\fR
generates an error (similar to the \fBexec\fR command.)
.PP
.VS 8.6
The two-argument form is a
.QW "half-close" :
given a bidirectional channel like a
@@ -80,7 +77,6 @@ abnormal exit error.
.PP
Currently only sockets and command pipelines support half-close. A future
extension will allow reflected and stacked channels to do so.
.VE 8.6
.SH EXAMPLE
.PP
This illustrates how you can use Tcl to ensure that files get closed
+1 -1
View File
@@ -9,7 +9,7 @@
.BS
'\" Note: do not modify the .SH NAME line immediately below!
.SH NAME
coroutine, yield, yieldto \- Create and produce values from coroutines
coroutine, yield, yieldto, coroinject, coroprobe \- Create and produce values from coroutines
.SH SYNOPSIS
.nf
\fBcoroutine \fIname command\fR ?\fIarg...\fR?
-6
View File
@@ -17,11 +17,9 @@ dde \- Execute a Dynamic Data Exchange command
.sp
\fBdde servername\fR ?\fB\-force\fR? ?\fB\-handler \fIproc\fR? ?\fB\-\|\-\fR? ?\fItopic\fR?
.sp
.VS 8.6
\fBdde execute\fR ?\fB\-async\fR? ?\fB\-binary\fR? \fIservice topic data\fR
.sp
\fBdde poke\fR ?\fB\-binary\fR? \fIservice topic item data\fR
.VE 8.6
.sp
\fBdde request\fR ?\fB\-binary\fR? \fIservice topic item\fR
.sp
@@ -82,13 +80,11 @@ script is run in the application. The \fB\-async\fR option requests
asynchronous invocation. The command returns an error message if the
script did not run, unless the \fB\-async\fR flag was used, in which case
the command returns immediately with no error.
.VS 8.6
Without the \fB\-binary\fR option all data will be sent in unicode. For
dde clients which don't implement the CF_UNICODE clipboard format, this
will automatically be translated to the system encoding. You can use
the \fB\-binary\fR option in combination with the result of
\fBencoding convertto\fR to send data in any other encoding.
.VE 8.6
.TP
\fBdde poke\fR ?\fB\-binary\fR? \fIservice topic item data\fR
.
@@ -99,13 +95,11 @@ specific but can be a command to the server or the name of a file to work
on. The \fIitem\fR is also application specific and is often not used, but
it must always be non-null. The \fIdata\fR field is given to the remote
application.
.VS 8.6
Without the \fB\-binary\fR option all data will be sent in unicode. For
dde clients which don't implement the CF_UNICODE clipboard format, this
will automatically be translated to the system encoding. You can use
the \fB\-binary\fR option in combination with the result of
\fBencoding convertto\fR to send data in any other encoding.
.VE 8.6
.TP
\fBdde request\fR ?\fB\-binary\fR? \fIservice topic item\fR
.
-4
View File
@@ -54,10 +54,8 @@ type (which may be abbreviated.) Supported filter types are:
.RS
.TP
\fBdict filter \fIdictionaryValue \fBkey\fR ?\fIglobPattern ...\fR?
.VS 8.6
The key rule only matches those key/value pairs whose keys match any
of the given patterns (in the style of \fBstring match\fR.)
.VE 8.6
.TP
\fBdict filter \fIdictionaryValue \fBscript {\fIkeyVariable valueVariable\fB} \fIscript\fR
.
@@ -74,10 +72,8 @@ result. The key/value pairs are tested in the order in which the keys
were inserted into the dictionary.
.TP
\fBdict filter \fIdictionaryValue \fBvalue \fR?\fIglobPattern ...\fR?
.VS 8.6
The value rule only matches those key/value pairs whose values match any
of the given patterns (in the style of \fBstring match\fR.)
.VE 8.6
.RE
.TP
\fBdict for {\fIkeyVariable valueVariable\fB} \fIdictionaryValue body\fR
-2
View File
@@ -338,7 +338,6 @@ if {[catch {\fBexec\fR grep foo bar.txt} results options]} {
}
}
.CE
.VS 8.6
.PP
This is more easily written using the \fBtry\fR command, as that makes
it simpler to trap specific types of errors. This is
@@ -352,7 +351,6 @@ try {
set status [lindex [dict get $options -errorcode] 2]
}
.CE
.VE 8.6
.SS "WORKING WITH QUOTED ARGUMENTS"
.PP
When translating a command from a Unix shell invocation, care should
-2
View File
@@ -465,7 +465,6 @@ between platforms:
.TP
\fBfile tempfile\fR ?\fInameVar\fR? ?\fItemplate\fR?
'\" TIP #210
.VS 8.6
Creates a temporary file and returns a read-write channel opened on that file.
If the \fInameVar\fR is given, it specifies a variable that the name of the
temporary file will be written into; if absent, Tcl will attempt to arrange
@@ -480,7 +479,6 @@ Note that temporary files are \fIonly\fR ever created on the native
filesystem. As such, they can be relied upon to be used with operating-system
native APIs and external programs that require a filename.
.RE
.VE 8.6
.TP
\fBfile type \fIname\fR
.
-2
View File
@@ -154,7 +154,6 @@ what to set the interpreter's background exception handler to. See the
\fBBACKGROUND EXCEPTION HANDLING\fR section for more details.
.TP
\fBinterp\fR \fBcancel \fR?\fB\-unwind\fR? ?\fB\-\|\-\fR? ?\fIpath\fR? ?\fIresult\fR?
.VS 8.6
Cancels the script being evaluated in the interpreter identified by
\fIpath\fR. Without the \fB\-unwind\fR switch the evaluation stack for
the interpreter is unwound until an enclosing catch command is found or
@@ -167,7 +166,6 @@ switches; it may be needed if \fIpath\fR is an unusual value such
as \fB\-safe\fR. If \fIresult\fR is present, it will be used as the
error message string; otherwise, a default error message string will be
used.
.VE 8.6
.TP
\fBinterp\fR \fBcreate \fR?\fB\-safe\fR? ?\fB\-\|\-\fR? ?\fIpath\fR?
.
-2
View File
@@ -134,7 +134,6 @@ The list elements are sorted in increasing order. This option is only
meaningful when used with \fB\-sorted\fR.
.TP
\fB\-bisect\fR
.VS 8.6
Inexact search when the list elements are in sorted order. For an increasing
list the last index where the element is less than or equal to the pattern
is returned. For a decreasing list the last index where the element is greater
@@ -142,7 +141,6 @@ than or equal to the pattern is returned. If the pattern is before the first
element or the list is empty, -1 is returned.
This option implies \fB\-sorted\fR and cannot be used with either \fB\-all\fR
or \fB\-not\fR.
.VE 8.6
.SS "NESTED LIST OPTIONS"
.PP
These options are used to search lists of lists. They may be used
-2
View File
@@ -221,7 +221,6 @@ Sorting using indices:
{e 1} {d 2} { c 3} {b 4} {a 5}
.CE
.PP
.VS 8.6
Sorting a dictionary:
.PP
.CS
@@ -239,7 +238,6 @@ Sorting using striding and multiple indices:
{{Bob Smith} 25 Audi {Jane Doe} 40 Ford}
{{Jane Doe} 40 Ford {Bob Smith} 25 Audi}
.CE
.VE 8.6
.PP
Stripping duplicate values using sorting:
.PP
-4
View File
@@ -788,12 +788,10 @@ name. Note that when this option is non-empty and the
will be exactly those words that have mappings in the dictionary.
.TP
\fB\-parameters\fR
.VS 8.6
This option gives a list of named arguments (the names being used during
generation of error messages) that are passed by the caller of the ensemble
between the name of the ensemble and the subcommand argument. By default, it
is the empty list.
.VE 8.6
.TP
\fB\-prefixes\fR
.
@@ -943,7 +941,6 @@ Remove all imported commands from the current namespace:
namespace forget {*}[namespace import]
.CE
.PP
.VS 8.6
Create an ensemble for simple working with numbers, using the
\fB\-parameters\fR option to allow the operator to be put between the first
and second arguments.
@@ -959,7 +956,6 @@ and second arguments.
# In use, the ensemble works like this:
puts [do 1 plus [do 9 minus 7]]
.CE
.VE 8.6
.SH "SEE ALSO"
interp(n), upvar(n), variable(n)
.SH KEYWORDS
-2
View File
@@ -44,13 +44,11 @@ one of \fBHKEY_LOCAL_MACHINE\fR, \fBHKEY_USERS\fR,
\fBHKEY_DYN_DATA\fR. The \fIkeypath\fR can be one or more
registry key names separated by backslash (\fB\e\fR) characters.
.PP
.VS 8.6
The optional \fI\-mode\fR argument indicates which registry to work
with; when it is \fB\-32bit\fR the 32-bit registry will be used, and
when it is \fB\-64bit\fR the 64-bit registry will be used. If this
argument is omitted, the system's default registry will be the subject
of the requested operation.
.VE 8.6
.PP
\fIOption\fR indicates what to do with the registry key name. Any
unique abbreviation for \fIoption\fR is acceptable. The valid options
-2
View File
@@ -137,7 +137,6 @@ by the \fBcatch\fR command (or from the copy of that information
stored in the global variable \fBerrorInfo\fR).
.TP
\fB\-errorstack \fIlist\fR
.VS 8.6
The \fB\-errorstack\fR option receives special treatment only when the value
of the \fB\-code\fR option is \fBTCL_ERROR\fR. Then \fIlist\fR is the initial
error stack, recording actual argument values passed to each proc level. The error stack will
@@ -152,7 +151,6 @@ the procedure. Typically the \fIlist\fR value is supplied from
the value of \fB\-errorstack\fR in a return options dictionary captured
by the \fBcatch\fR command (or from the copy of that information from
\fBinfo errorstack\fR).
.VE 8.6
.TP
\fB\-level \fIlevel\fR
.
-2
View File
@@ -322,11 +322,9 @@ The version number for the operating system running on this machine.
On UNIX machines, this is the value returned by \fBuname -r\fR.
.TP
\fBpathSeparator\fR
.VS 8.6
'\" Defined by TIP #315
The character that should be used to \fBsplit\fR PATH-like environment
variables into their corresponding list of directory names.
.VE 8.6
.TP
\fBplatform\fR
.
+1 -1
View File
@@ -83,7 +83,7 @@ example, the Tcl 8.7.2 release would be searched for in a file
\fBlibtcl_8_7_2.zip\fR.) That archive, if located, is also mounted read-only.
.PP
On Windows, \fBTclZipfs_AppHook\fR has a slightly different signature, since
it uses WCHAR in stead of char. As a result, it requires your application to
it uses WCHAR instead of char. As a result, it requires your application to
be compiled with the UNICODE preprocessor symbol defined (e.g., via the
\fB-DUNICODE\fR compiler flag).
.PP
+1 -1
View File
@@ -88,7 +88,7 @@ typedef int celt; /* Type to hold chr, or NOCELT */
#define NOCELT (-1) /* Celt value which is not valid chr */
#define CHR(c) (UCHAR(c)) /* Turn char literal into chr literal */
#define DIGITVAL(c) ((c)-'0') /* Turn chr digit into its value */
#if TCL_UTF_MAX > 4
#if TCL_UTF_MAX > 3
#define CHRBITS 32 /* Bits in a chr; must not use sizeof */
#define CHR_MIN 0x00000000 /* Smallest and largest chr; the value */
#define CHR_MAX 0x10ffff /* CHR_MAX-CHR_MIN+1 should fit in uchr */
+9 -9
View File
@@ -1244,10 +1244,10 @@ declare 350 {
declare 351 {
int Tcl_UniCharIsWordChar(int ch)
}
declare 352 {
declare 352 {deprecated {Use Tcl_GetCharLength}} {
int Tcl_UniCharLen(const Tcl_UniChar *uniStr)
}
declare 353 {
declare 353 {deprecated {Use Tcl_UtfNcmp}} {
int Tcl_UniCharNcmp(const Tcl_UniChar *ucs, const Tcl_UniChar *uct,
unsigned long numChars)
}
@@ -1337,10 +1337,10 @@ declare 376 {
declare 377 {
void Tcl_RegExpGetInfo(Tcl_RegExp regexp, Tcl_RegExpInfo *infoPtr)
}
declare 378 {
declare 378 {deprecated {Use Tcl_UniCharToUtfDString}} {
Tcl_Obj *Tcl_NewUnicodeObj(const Tcl_UniChar *unicode, int numChars)
}
declare 379 {
declare 379 {deprecated {Use Tcl_UniCharToUtfDString}} {
void Tcl_SetUnicodeObj(Tcl_Obj *objPtr, const Tcl_UniChar *unicode,
int numChars)
}
@@ -1356,7 +1356,7 @@ declare 382 {deprecated {No longer in use, changed to macro}} {
declare 383 {
Tcl_Obj *Tcl_GetRange(Tcl_Obj *objPtr, int first, int last)
}
declare 384 {
declare 384 {deprecated {Use Tcl_AppendStringsToObj}} {
void Tcl_AppendUnicodeToObj(Tcl_Obj *objPtr, const Tcl_UniChar *unicode,
int length)
}
@@ -1482,11 +1482,11 @@ declare 417 {
declare 418 {
int Tcl_IsChannelExisting(const char *channelName)
}
declare 419 {
declare 419 {deprecated {Use Tcl_UtfNcasecmp}} {
int Tcl_UniCharNcasecmp(const Tcl_UniChar *ucs, const Tcl_UniChar *uct,
unsigned long numChars)
}
declare 420 {
declare 420 {deprecated {Use Tcl_StringCaseMatch}} {
int Tcl_UniCharCaseMatch(const Tcl_UniChar *uniStr,
const Tcl_UniChar *uniPattern, int nocase)
}
@@ -1540,7 +1540,7 @@ declare 433 {
}
# introduced in 8.4a3
declare 434 {
declare 434 {deprecated {Use Tcl_UtfToUniCharDString}} {
Tcl_UniChar *Tcl_GetUnicodeFromObj(Tcl_Obj *objPtr, int *lengthPtr)
}
@@ -2221,7 +2221,7 @@ declare 606 {
# TIP#307 (move results between interpreters) dkf
declare 607 {
void Tcl_TransferResult(Tcl_Interp *sourceInterp, int result,
void Tcl_TransferResult(Tcl_Interp *sourceInterp, int code,
Tcl_Interp *targetInterp)
}
+16 -19
View File
@@ -51,10 +51,10 @@ extern "C" {
#define TCL_MAJOR_VERSION 8
#define TCL_MINOR_VERSION 7
#define TCL_RELEASE_LEVEL TCL_ALPHA_RELEASE
#define TCL_RELEASE_SERIAL 2
#define TCL_RELEASE_SERIAL 4
#define TCL_VERSION "8.7"
#define TCL_PATCH_LEVEL "8.7a2"
#define TCL_PATCH_LEVEL "8.7a4"
#if !defined(TCL_NO_DEPRECATED) || defined(RC_INVOKED)
/*
@@ -1729,7 +1729,7 @@ typedef struct Tcl_Filesystem {
* arbitrary additional data to files in a
* filesystem. */
Tcl_FSFileAttrsGetProc *fileAttrsGetProc;
/* Called by 'Tcl_FSFileAttrsGet()' and by
/* Called by 'Tcl_FSFileAttrsGet()' and by
* 'file attributes'. */
Tcl_FSFileAttrsSetProc *fileAttrsSetProc;
/* Called by 'Tcl_FSFileAttrsSet()' and by
@@ -2106,16 +2106,15 @@ typedef struct Tcl_EncodingType {
/*
* The maximum number of bytes that are necessary to represent a single
* Unicode character in UTF-8. The valid values are 4 and 6
* (or perhaps 1 if we want to support a non-unicode enabled core). If 4,
* then Tcl_UniChar must be 2-bytes in size (UCS-2) (the default). If 6,
* Unicode character in UTF-8. The valid values are 3 and 4
* (or perhaps 1 if we want to support a non-unicode enabled core). If 3,
* then Tcl_UniChar must be 2-bytes in size (UCS-2) (the default). If > 3,
* then Tcl_UniChar must be 4-bytes in size (UCS-4). At this time UCS-2 mode
* is the default and recommended mode. UCS-4 is experimental and not
* recommended. It works for the core, but most extensions expect UCS-2.
* is the default and recommended mode.
*/
#ifndef TCL_UTF_MAX
#define TCL_UTF_MAX 4
#define TCL_UTF_MAX 3
#endif
/*
@@ -2123,15 +2122,11 @@ typedef struct Tcl_EncodingType {
* reflected in regcustom.h.
*/
#if TCL_UTF_MAX > 4
#if TCL_UTF_MAX > 3
/*
* int isn't 100% accurate as it should be a strict 4-byte value
* (perhaps wchar_t). 64-bit systems may have troubles. The size of this
* value must be reflected correctly in regcustom.h and
* in tclEncoding.c.
* XXX: Tcl is currently UCS-2 and planning UTF-16 for the Unicode
* XXX: string rep that Tcl_UniChar represents. Changing the size
* XXX: of Tcl_UniChar is /not/ supported.
* (perhaps wchar_t). ILP64/SILP64 systems may have troubles. The
* size of this value must be reflected correctly in regcustom.h.
*/
typedef int Tcl_UniChar;
#else
@@ -2173,8 +2168,10 @@ typedef void (Tcl_LimitHandlerDeleteProc) (ClientData clientData);
* Override definitions for libtommath.
*/
typedef struct mp_int mp_int;
#ifndef MP_INT_DECLARED
#define MP_INT_DECLARED
typedef struct mp_int mp_int;
#endif
/*
*----------------------------------------------------------------------------
@@ -2309,10 +2306,10 @@ typedef int (Tcl_NRPostProc) (ClientData data[], Tcl_Interp *interp,
/*
*----------------------------------------------------------------------------
* The following constant is used to test for older versions of Tcl in the
* stubs tables. If TCL_UTF_MAX>4 use a different value.
* stubs tables.
*/
#define TCL_STUB_MAGIC ((int) 0xFCA3BACF + (TCL_UTF_MAX>4))
#define TCL_STUB_MAGIC ((int) 0xFCA3BACF)
/*
* The following function is required to be defined in all stubs aware
+5 -3
View File
@@ -20,7 +20,7 @@
#include "tclInt.h"
#include "tclOOInt.h"
#include "tclCompile.h"
#include "tommath.h"
#include "tclTomMath.h"
#include <math.h>
#include <assert.h>
@@ -1866,8 +1866,10 @@ DeleteInterpProc(
* could have transferred ownership of the result string to Tcl.
*/
#ifndef TCL_NO_DEPRECATED
Tcl_FreeResult(interp);
iPtr->result = NULL;
#endif
Tcl_DecrRefCount(iPtr->objResultPtr);
iPtr->objResultPtr = NULL;
Tcl_DecrRefCount(iPtr->ecVar);
@@ -7891,7 +7893,7 @@ ExprAbsFunc(
}
goto unChanged;
} else if (l == WIDE_MIN) {
mp_init_ll(&big, l);
mp_init_i64(&big, l);
goto tooLarge;
}
Tcl_SetObjResult(interp, Tcl_NewWideIntObj(-l));
@@ -7922,7 +7924,7 @@ ExprAbsFunc(
if (mp_isneg((const mp_int *) ptr)) {
Tcl_GetBignumFromObj(NULL, objv[1], &big);
tooLarge:
mp_neg(&big, &big);
(void)mp_neg(&big, &big);
Tcl_SetObjResult(interp, Tcl_NewBignumObj(&big));
} else {
unChanged:
+4 -5
View File
@@ -12,7 +12,7 @@
*/
#include "tclInt.h"
#include "tommath.h"
#include "tclTomMath.h"
#include <math.h>
#include <assert.h>
@@ -1363,7 +1363,7 @@ BinaryFormatCmd(
badField:
{
Tcl_UniChar ch = 0;
char buf[TCL_UTF_MAX + 1] = "";
char buf[5] = "";
TclUtfToUniChar(errorString, &ch);
buf[Tcl_UniCharToUtf(ch, buf)] = '\0';
@@ -1733,7 +1733,7 @@ BinaryScanCmd(
badField:
{
Tcl_UniChar ch = 0;
char buf[TCL_UTF_MAX + 1] = "";
char buf[5] = "";
TclUtfToUniChar(errorString, &ch);
buf[Tcl_UniCharToUtf(ch, buf)] = '\0';
@@ -2349,8 +2349,7 @@ ScanNumber(
Tcl_Obj *bigObj = NULL;
mp_int big;
if (mp_init(&big) == MP_OKAY) {
mp_set_ull(&big, uwvalue);
if (mp_init_u64(&big, uwvalue) == MP_OKAY) {
bigObj = Tcl_NewBignumObj(&big);
}
return bigObj;
+2 -2
View File
@@ -1221,7 +1221,7 @@ Tcl_SplitObjCmd(
len = TclUtfToUniChar(stringPtr, &ch);
fullchar = ch;
#if TCL_UTF_MAX <= 4
#if TCL_UTF_MAX <= 3
if ((ch >= 0xD800) && (len < 3)) {
len += TclUtfToUniChar(stringPtr + len, &ch);
fullchar = (((fullchar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000;
@@ -1911,7 +1911,7 @@ StringIsCmd(
int fullchar;
length2 = TclUtfToUniChar(string1, &ch);
fullchar = ch;
#if TCL_UTF_MAX <= 4
#if TCL_UTF_MAX <= 3
if ((ch >= 0xD800) && (length2 < 3)) {
length2 += TclUtfToUniChar(string1 + length2, &ch);
fullchar = (((fullchar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000;
+1
View File
@@ -694,6 +694,7 @@ TclCompileStringIsCmd(
OP( LNOT);
return TCL_OK;
}
break;
case STR_IS_DOUBLE: {
int satisfied, isEmpty;
+1 -1
View File
@@ -797,7 +797,7 @@ TclSetByteCodeFromAny(
#ifdef TCL_COMPILE_DEBUG
if (!traceInitialized) {
if (Tcl_LinkVar(interp, "tcl_traceCompile",
(char *) &tclTraceCompile, TCL_LINK_INT) != TCL_OK) {
&tclTraceCompile, TCL_LINK_INT) != TCL_OK) {
Tcl_Panic("SetByteCodeFromAny: unable to create link for tcl_traceCompile variable");
}
traceInitialized = 1;
+27 -19
View File
@@ -1063,9 +1063,11 @@ EXTERN int Tcl_UniCharIsUpper(int ch);
/* 351 */
EXTERN int Tcl_UniCharIsWordChar(int ch);
/* 352 */
EXTERN int Tcl_UniCharLen(const Tcl_UniChar *uniStr);
TCL_DEPRECATED("Use Tcl_GetCharLength")
int Tcl_UniCharLen(const Tcl_UniChar *uniStr);
/* 353 */
EXTERN int Tcl_UniCharNcmp(const Tcl_UniChar *ucs,
TCL_DEPRECATED("Use Tcl_UtfNcmp")
int Tcl_UniCharNcmp(const Tcl_UniChar *ucs,
const Tcl_UniChar *uct,
unsigned long numChars);
/* 354 */
@@ -1141,10 +1143,12 @@ EXTERN int Tcl_RegExpExecObj(Tcl_Interp *interp,
EXTERN void Tcl_RegExpGetInfo(Tcl_RegExp regexp,
Tcl_RegExpInfo *infoPtr);
/* 378 */
EXTERN Tcl_Obj * Tcl_NewUnicodeObj(const Tcl_UniChar *unicode,
TCL_DEPRECATED("Use Tcl_UniCharToUtfDString")
Tcl_Obj * Tcl_NewUnicodeObj(const Tcl_UniChar *unicode,
int numChars);
/* 379 */
EXTERN void Tcl_SetUnicodeObj(Tcl_Obj *objPtr,
TCL_DEPRECATED("Use Tcl_UniCharToUtfDString")
void Tcl_SetUnicodeObj(Tcl_Obj *objPtr,
const Tcl_UniChar *unicode, int numChars);
/* 380 */
EXTERN int Tcl_GetCharLength(Tcl_Obj *objPtr);
@@ -1156,7 +1160,8 @@ Tcl_UniChar * Tcl_GetUnicode(Tcl_Obj *objPtr);
/* 383 */
EXTERN Tcl_Obj * Tcl_GetRange(Tcl_Obj *objPtr, int first, int last);
/* 384 */
EXTERN void Tcl_AppendUnicodeToObj(Tcl_Obj *objPtr,
TCL_DEPRECATED("Use Tcl_AppendStringsToObj")
void Tcl_AppendUnicodeToObj(Tcl_Obj *objPtr,
const Tcl_UniChar *unicode, int length);
/* 385 */
EXTERN int Tcl_RegExpMatchObj(Tcl_Interp *interp,
@@ -1250,11 +1255,13 @@ EXTERN void Tcl_ClearChannelHandlers(Tcl_Channel channel);
/* 418 */
EXTERN int Tcl_IsChannelExisting(const char *channelName);
/* 419 */
EXTERN int Tcl_UniCharNcasecmp(const Tcl_UniChar *ucs,
TCL_DEPRECATED("Use Tcl_UtfNcasecmp")
int Tcl_UniCharNcasecmp(const Tcl_UniChar *ucs,
const Tcl_UniChar *uct,
unsigned long numChars);
/* 420 */
EXTERN int Tcl_UniCharCaseMatch(const Tcl_UniChar *uniStr,
TCL_DEPRECATED("Use Tcl_StringCaseMatch")
int Tcl_UniCharCaseMatch(const Tcl_UniChar *uniStr,
const Tcl_UniChar *uniPattern, int nocase);
/* 421 */
EXTERN Tcl_HashEntry * Tcl_FindHashEntry(Tcl_HashTable *tablePtr,
@@ -1297,7 +1304,8 @@ EXTERN int Tcl_AttemptSetObjLength(Tcl_Obj *objPtr, int length);
/* 433 */
EXTERN Tcl_ThreadId Tcl_GetChannelThread(Tcl_Channel channel);
/* 434 */
EXTERN Tcl_UniChar * Tcl_GetUnicodeFromObj(Tcl_Obj *objPtr,
TCL_DEPRECATED("Use Tcl_UtfToUniCharDString")
Tcl_UniChar * Tcl_GetUnicodeFromObj(Tcl_Obj *objPtr,
int *lengthPtr);
/* 435 */
TCL_DEPRECATED("")
@@ -1792,7 +1800,7 @@ EXTERN int Tcl_GetErrorLine(Tcl_Interp *interp);
EXTERN void Tcl_SetErrorLine(Tcl_Interp *interp, int lineNum);
/* 607 */
EXTERN void Tcl_TransferResult(Tcl_Interp *sourceInterp,
int result, Tcl_Interp *targetInterp);
int code, Tcl_Interp *targetInterp);
/* 608 */
EXTERN int Tcl_InterpActive(Tcl_Interp *interp);
/* 609 */
@@ -2300,8 +2308,8 @@ typedef struct TclStubs {
int (*tcl_UniCharIsSpace) (int ch); /* 349 */
int (*tcl_UniCharIsUpper) (int ch); /* 350 */
int (*tcl_UniCharIsWordChar) (int ch); /* 351 */
int (*tcl_UniCharLen) (const Tcl_UniChar *uniStr); /* 352 */
int (*tcl_UniCharNcmp) (const Tcl_UniChar *ucs, const Tcl_UniChar *uct, unsigned long numChars); /* 353 */
TCL_DEPRECATED_API("Use Tcl_GetCharLength") int (*tcl_UniCharLen) (const Tcl_UniChar *uniStr); /* 352 */
TCL_DEPRECATED_API("Use Tcl_UtfNcmp") int (*tcl_UniCharNcmp) (const Tcl_UniChar *ucs, const Tcl_UniChar *uct, unsigned long numChars); /* 353 */
char * (*tcl_Char16ToUtfDString) (const unsigned short *uniStr, int uniLength, Tcl_DString *dsPtr); /* 354 */
unsigned short * (*tcl_UtfToChar16DString) (const char *src, int length, Tcl_DString *dsPtr); /* 355 */
Tcl_RegExp (*tcl_GetRegExpFromObj) (Tcl_Interp *interp, Tcl_Obj *patObj, int flags); /* 356 */
@@ -2326,13 +2334,13 @@ typedef struct TclStubs {
int (*tcl_UniCharIsPunct) (int ch); /* 375 */
int (*tcl_RegExpExecObj) (Tcl_Interp *interp, Tcl_RegExp regexp, Tcl_Obj *textObj, int offset, int nmatches, int flags); /* 376 */
void (*tcl_RegExpGetInfo) (Tcl_RegExp regexp, Tcl_RegExpInfo *infoPtr); /* 377 */
Tcl_Obj * (*tcl_NewUnicodeObj) (const Tcl_UniChar *unicode, int numChars); /* 378 */
void (*tcl_SetUnicodeObj) (Tcl_Obj *objPtr, const Tcl_UniChar *unicode, int numChars); /* 379 */
TCL_DEPRECATED_API("Use Tcl_UniCharToUtfDString") Tcl_Obj * (*tcl_NewUnicodeObj) (const Tcl_UniChar *unicode, int numChars); /* 378 */
TCL_DEPRECATED_API("Use Tcl_UniCharToUtfDString") void (*tcl_SetUnicodeObj) (Tcl_Obj *objPtr, const Tcl_UniChar *unicode, int numChars); /* 379 */
int (*tcl_GetCharLength) (Tcl_Obj *objPtr); /* 380 */
int (*tcl_GetUniChar) (Tcl_Obj *objPtr, int index); /* 381 */
TCL_DEPRECATED_API("No longer in use, changed to macro") Tcl_UniChar * (*tcl_GetUnicode) (Tcl_Obj *objPtr); /* 382 */
Tcl_Obj * (*tcl_GetRange) (Tcl_Obj *objPtr, int first, int last); /* 383 */
void (*tcl_AppendUnicodeToObj) (Tcl_Obj *objPtr, const Tcl_UniChar *unicode, int length); /* 384 */
TCL_DEPRECATED_API("Use Tcl_AppendStringsToObj") void (*tcl_AppendUnicodeToObj) (Tcl_Obj *objPtr, const Tcl_UniChar *unicode, int length); /* 384 */
int (*tcl_RegExpMatchObj) (Tcl_Interp *interp, Tcl_Obj *textObj, Tcl_Obj *patternObj); /* 385 */
void (*tcl_SetNotifier) (Tcl_NotifierProcs *notifierProcPtr); /* 386 */
Tcl_Mutex * (*tcl_GetAllocMutex) (void); /* 387 */
@@ -2367,8 +2375,8 @@ typedef struct TclStubs {
void (*tcl_SpliceChannel) (Tcl_Channel channel); /* 416 */
void (*tcl_ClearChannelHandlers) (Tcl_Channel channel); /* 417 */
int (*tcl_IsChannelExisting) (const char *channelName); /* 418 */
int (*tcl_UniCharNcasecmp) (const Tcl_UniChar *ucs, const Tcl_UniChar *uct, unsigned long numChars); /* 419 */
int (*tcl_UniCharCaseMatch) (const Tcl_UniChar *uniStr, const Tcl_UniChar *uniPattern, int nocase); /* 420 */
TCL_DEPRECATED_API("Use Tcl_UtfNcasecmp") int (*tcl_UniCharNcasecmp) (const Tcl_UniChar *ucs, const Tcl_UniChar *uct, unsigned long numChars); /* 419 */
TCL_DEPRECATED_API("Use Tcl_StringCaseMatch") int (*tcl_UniCharCaseMatch) (const Tcl_UniChar *uniStr, const Tcl_UniChar *uniPattern, int nocase); /* 420 */
Tcl_HashEntry * (*tcl_FindHashEntry) (Tcl_HashTable *tablePtr, const void *key); /* 421 */
Tcl_HashEntry * (*tcl_CreateHashEntry) (Tcl_HashTable *tablePtr, const void *key, int *newPtr); /* 422 */
void (*tcl_InitCustomHashTable) (Tcl_HashTable *tablePtr, int keyType, const Tcl_HashKeyType *typePtr); /* 423 */
@@ -2382,7 +2390,7 @@ typedef struct TclStubs {
char * (*tcl_AttemptDbCkrealloc) (char *ptr, unsigned int size, const char *file, int line); /* 431 */
int (*tcl_AttemptSetObjLength) (Tcl_Obj *objPtr, int length); /* 432 */
Tcl_ThreadId (*tcl_GetChannelThread) (Tcl_Channel channel); /* 433 */
Tcl_UniChar * (*tcl_GetUnicodeFromObj) (Tcl_Obj *objPtr, int *lengthPtr); /* 434 */
TCL_DEPRECATED_API("Use Tcl_UtfToUniCharDString") Tcl_UniChar * (*tcl_GetUnicodeFromObj) (Tcl_Obj *objPtr, int *lengthPtr); /* 434 */
TCL_DEPRECATED_API("") int (*tcl_GetMathFuncInfo) (Tcl_Interp *interp, const char *name, int *numArgsPtr, Tcl_ValueType **argTypesPtr, Tcl_MathProc **procPtr, ClientData *clientDataPtr); /* 435 */
TCL_DEPRECATED_API("") Tcl_Obj * (*tcl_ListMathFuncs) (Tcl_Interp *interp, const char *pattern); /* 436 */
Tcl_Obj * (*tcl_SubstObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int flags); /* 437 */
@@ -2555,7 +2563,7 @@ typedef struct TclStubs {
int (*tcl_ParseArgsObjv) (Tcl_Interp *interp, const Tcl_ArgvInfo *argTable, int *objcPtr, Tcl_Obj *const *objv, Tcl_Obj ***remObjv); /* 604 */
int (*tcl_GetErrorLine) (Tcl_Interp *interp); /* 605 */
void (*tcl_SetErrorLine) (Tcl_Interp *interp, int lineNum); /* 606 */
void (*tcl_TransferResult) (Tcl_Interp *sourceInterp, int result, Tcl_Interp *targetInterp); /* 607 */
void (*tcl_TransferResult) (Tcl_Interp *sourceInterp, int code, Tcl_Interp *targetInterp); /* 607 */
int (*tcl_InterpActive) (Tcl_Interp *interp); /* 608 */
void (*tcl_BackgroundException) (Tcl_Interp *interp, int code); /* 609 */
int (*tcl_ZlibDeflate) (Tcl_Interp *interp, int format, Tcl_Obj *data, int level, Tcl_Obj *gzipHeaderDictObj); /* 610 */
@@ -4109,7 +4117,7 @@ extern const TclStubs *tclStubsPtr;
#undef Tcl_StringMatch
#define Tcl_StringMatch(str, pattern) Tcl_StringCaseMatch((str), (pattern), 0)
#if TCL_UTF_MAX <= 4
#if TCL_UTF_MAX <= 3
# undef Tcl_UniCharToUtfDString
# define Tcl_UniCharToUtfDString Tcl_Char16ToUtfDString
# undef Tcl_UtfToUniCharDString
+1 -1
View File
@@ -11,7 +11,7 @@
*/
#include "tclInt.h"
#include "tommath.h"
#include "tclTomMath.h"
#include <assert.h>
/*
+1 -1
View File
@@ -903,7 +903,7 @@ PrintSourceToObj(
i += 2;
continue;
default:
#if TCL_UTF_MAX > 4
#if TCL_UTF_MAX > 3
if (ch > 0xffff) {
Tcl_AppendPrintfToObj(appendObj, "\\U%08x", ch);
i += 10;
+17 -16
View File
@@ -622,13 +622,13 @@ TclInitEncodingSubsystem(void)
type.freeProc = NULL;
type.nullSize = 2;
type.encodingName = "utf-16le";
type.clientData = INT2PTR(1);;
type.clientData = INT2PTR(1);
Tcl_CreateEncoding(&type);
type.encodingName = "utf-16be";
type.clientData = INT2PTR(0);
Tcl_CreateEncoding(&type);
type.encodingName = "utf-16";
type.clientData = INT2PTR(isLe.c);;
type.clientData = INT2PTR(isLe.c);
Tcl_CreateEncoding(&type);
#ifndef TCL_NO_DEPRECATED
@@ -1721,7 +1721,7 @@ LoadEncodingFile(
* not be created because the file contained invalid data.
*
* Side effects:
* See Tcl_CreateEncoding().
* See Tcl_CreateEncoding().
*
*-------------------------------------------------------------------------
*/
@@ -2409,18 +2409,19 @@ UtfToUtfProc(
dst += Tcl_UniCharToUtf(*chPtr, dst);
} else {
src += TclUtfToUniChar(src, chPtr);
if ((*chPtr & 0xFC00) == 0xD800) {
/* A high surrogate character is detected, handle especially */
if ((*chPtr | 0x7FF) == 0xDFFF) {
/* A surrogate character is detected, handle especially */
Tcl_UniChar low = *chPtr;
if (src <= srcEnd-3) {
Tcl_UtfToUniChar(src, &low);
}
if ((low & 0xFC00) != 0xDC00) {
size_t len = (src <= srcEnd-3) ? Tcl_UtfToUniChar(src, &low) : 0;
if (((low | 0x3FF) != 0xDFFF) || (*chPtr & 0x400)) {
*dst++ = (char) (((*chPtr >> 12) | 0xE0) & 0xEF);
*dst++ = (char) (((*chPtr >> 6) | 0x80) & 0xBF);
*dst++ = (char) ((*chPtr | 0x80) & 0xBF);
continue;
}
src += len;
dst += Tcl_UniCharToUtf(*chPtr, dst);
*chPtr = low;
}
dst += Tcl_UniCharToUtf(*chPtr, dst);
}
@@ -2614,7 +2615,7 @@ UtfToUtf16Proc(
*/
if (clientData) {
#if TCL_UTF_MAX > 4
#if TCL_UTF_MAX > 3
if (*chPtr <= 0xFFFF) {
*dst++ = (*chPtr & 0xFF);
*dst++ = (*chPtr >> 8);
@@ -2629,7 +2630,7 @@ UtfToUtf16Proc(
*dst++ = (*chPtr >> 8);
#endif
} else {
#if TCL_UTF_MAX > 4
#if TCL_UTF_MAX > 3
if (*chPtr <= 0xFFFF) {
*dst++ = (*chPtr >> 8);
*dst++ = (*chPtr & 0xFF);
@@ -2696,7 +2697,7 @@ UtfToUcs2Proc(
{
const char *srcStart, *srcEnd, *srcClose, *dstStart, *dstEnd;
int result, numChars;
#if TCL_UTF_MAX <= 4
#if TCL_UTF_MAX <= 3
int len;
#endif
Tcl_UniChar ch = 0;
@@ -2726,7 +2727,7 @@ UtfToUcs2Proc(
result = TCL_CONVERT_NOSPACE;
break;
}
#if TCL_UTF_MAX <= 4
#if TCL_UTF_MAX <= 3
src += (len = TclUtfToUniChar(src, &ch));
if ((ch >= 0xD800) && (len < 3)) {
src += TclUtfToUniChar(src, &ch);
@@ -2950,7 +2951,7 @@ TableFromUtfProc(
}
len = TclUtfToUniChar(src, &ch);
#if TCL_UTF_MAX > 4
#if TCL_UTF_MAX > 3
/*
* This prevents a crash condition. More evaluation is required for
* full support of int Tcl_UniChar. [Bug 1004065]
@@ -3161,7 +3162,7 @@ Iso88591FromUtfProc(
*/
if (ch > 0xff
#if TCL_UTF_MAX <= 4
#if TCL_UTF_MAX <= 3
|| ((ch >= 0xD800) && (len < 3))
#endif
) {
@@ -3169,7 +3170,7 @@ Iso88591FromUtfProc(
result = TCL_CONVERT_UNKNOWN;
break;
}
#if TCL_UTF_MAX <= 4
#if TCL_UTF_MAX <= 3
if ((ch >= 0xD800) && (len < 3)) len = 4;
#endif
/*
+69 -17
View File
@@ -18,7 +18,7 @@
#include "tclInt.h"
#include "tclCompile.h"
#include "tclOOInt.h"
#include "tommath.h"
#include "tclTomMath.h"
#include <math.h>
#include <assert.h>
@@ -317,12 +317,16 @@ VarHashCreateVar(
switch (*pc) { \
case INST_JUMP_FALSE1: \
NEXT_INST_F(((condition)? 2 : TclGetInt1AtPtr(pc+1)), (cleanup), 0); \
break; \
case INST_JUMP_TRUE1: \
NEXT_INST_F(((condition)? TclGetInt1AtPtr(pc+1) : 2), (cleanup), 0); \
break; \
case INST_JUMP_FALSE4: \
NEXT_INST_F(((condition)? 5 : TclGetInt4AtPtr(pc+1)), (cleanup), 0); \
break; \
case INST_JUMP_TRUE4: \
NEXT_INST_F(((condition)? TclGetInt4AtPtr(pc+1) : 5), (cleanup), 0); \
break; \
default: \
if ((condition) < 0) { \
TclNewIntObj(objResultPtr, -1); \
@@ -330,6 +334,7 @@ VarHashCreateVar(
objResultPtr = TCONST((condition) > 0); \
} \
NEXT_INST_F(0, (cleanup), 1); \
break; \
} \
} while (0)
#define JUMP_PEEPHOLE_V(condition, pcAdjustment, cleanup) \
@@ -338,12 +343,16 @@ VarHashCreateVar(
switch (*pc) { \
case INST_JUMP_FALSE1: \
NEXT_INST_V(((condition)? 2 : TclGetInt1AtPtr(pc+1)), (cleanup), 0); \
break; \
case INST_JUMP_TRUE1: \
NEXT_INST_V(((condition)? TclGetInt1AtPtr(pc+1) : 2), (cleanup), 0); \
break; \
case INST_JUMP_FALSE4: \
NEXT_INST_V(((condition)? 5 : TclGetInt4AtPtr(pc+1)), (cleanup), 0); \
break; \
case INST_JUMP_TRUE4: \
NEXT_INST_V(((condition)? TclGetInt4AtPtr(pc+1) : 5), (cleanup), 0); \
break; \
default: \
if ((condition) < 0) { \
TclNewIntObj(objResultPtr, -1); \
@@ -351,6 +360,7 @@ VarHashCreateVar(
objResultPtr = TCONST((condition) > 0); \
} \
NEXT_INST_V(0, (cleanup), 1); \
break; \
} \
} while (0)
#else /* TCL_COMPILE_DEBUG */
@@ -794,12 +804,14 @@ InitByteCodeExecution(
* instruction tracing. */
{
#ifdef TCL_COMPILE_DEBUG
if (Tcl_LinkVar(interp, "tcl_traceExec", (char *) &tclTraceExec,
if (Tcl_LinkVar(interp, "tcl_traceExec", &tclTraceExec,
TCL_LINK_INT) != TCL_OK) {
Tcl_Panic("InitByteCodeExecution: can't create link for tcl_traceExec variable");
}
#endif
#ifdef TCL_COMPILE_STATS
#ifndef TCL_COMPILE_STATS
(void)interp;
#else
Tcl_CreateObjCommand(interp, "evalstats", EvalStatsCmd, NULL, NULL);
#endif /* TCL_COMPILE_STATS */
}
@@ -1345,11 +1357,12 @@ Tcl_ExprObj(
static int
CopyCallback(
ClientData data[],
Tcl_Interp *interp,
Tcl_Interp *dummy,
int result)
{
Tcl_Obj **resultPtrPtr = data[0];
Tcl_Obj *resultPtr = data[1];
(void)dummy;
if (result == TCL_OK) {
*resultPtrPtr = resultPtr;
@@ -1543,6 +1556,8 @@ DupExprCodeInternalRep(
Tcl_Obj *srcPtr,
Tcl_Obj *copyPtr)
{
(void)srcPtr;
(void)copyPtr;
return;
}
@@ -2571,23 +2586,27 @@ TEBCresume(
objResultPtr = codePtr->objArrayPtr[TclGetUInt4AtPtr(pc+1)];
TRACE_WITH_OBJ(("%u => ", TclGetUInt4AtPtr(pc+1)), objResultPtr);
NEXT_INST_F(5, 0, 1);
break;
case INST_POP:
TRACE_WITH_OBJ(("=> discarding "), OBJ_AT_TOS);
objPtr = POP_OBJECT();
TclDecrRefCount(objPtr);
NEXT_INST_F(1, 0, 0);
break;
case INST_DUP:
objResultPtr = OBJ_AT_TOS;
TRACE_WITH_OBJ(("=> "), objResultPtr);
NEXT_INST_F(1, 0, 1);
break;
case INST_OVER:
opnd = TclGetUInt4AtPtr(pc+1);
objResultPtr = OBJ_AT_DEPTH(opnd);
TRACE_WITH_OBJ(("%u => ", opnd), objResultPtr);
NEXT_INST_F(5, 0, 1);
break;
case INST_REVERSE: {
Tcl_Obj **a, **b;
@@ -2604,6 +2623,7 @@ TEBCresume(
TRACE(("%u => OK\n", opnd));
NEXT_INST_F(5, 0, 0);
}
break;
case INST_STR_CONCAT1:
@@ -2617,6 +2637,7 @@ TEBCresume(
TRACE_WITH_OBJ(("%u => ", opnd), objResultPtr);
NEXT_INST_V(2, opnd, 1);
break;
case INST_CONCAT_STK:
/*
@@ -2628,6 +2649,7 @@ TEBCresume(
objResultPtr = Tcl_ConcatObj(opnd, &OBJ_AT_DEPTH(opnd-1));
TRACE_WITH_OBJ(("%u => ", opnd), objResultPtr);
NEXT_INST_V(5, opnd, 1);
break;
case INST_EXPAND_START:
/*
@@ -2649,6 +2671,7 @@ TEBCresume(
PUSH_TAUX_OBJ(objPtr);
TRACE(("=> mark depth as %d\n", (int) CURR_DEPTH));
NEXT_INST_F(1, 0, 0);
break;
case INST_EXPAND_DROP:
/*
@@ -2727,6 +2750,7 @@ TEBCresume(
Tcl_DecrRefCount(objPtr);
NEXT_INST_F(5, 0, 0);
}
break;
case INST_EXPR_STK: {
ByteCode *newCodePtr;
@@ -2774,6 +2798,7 @@ TEBCresume(
TclNewObj(objResultPtr);
NEXT_INST_F(1, 0, 1);
break;
case INST_INVOKE_STK4:
objc = TclGetUInt4AtPtr(pc+1);
@@ -4025,6 +4050,7 @@ TEBCresume(
}
NEXT_INST_F(5, 0, 0);
}
break;
/*
* End of INST_UNSET instructions.
@@ -4242,6 +4268,7 @@ TEBCresume(
TRACE_APPEND(("link made\n"));
NEXT_INST_F(5, 1, 0);
}
break;
/*
* End of variable linking instructions.
@@ -4253,6 +4280,7 @@ TEBCresume(
TRACE(("%d => new pc %u\n", opnd,
(unsigned)(pc + opnd - codePtr->codeStart)));
NEXT_INST_F(opnd, 0, 0);
break;
case INST_JUMP4:
opnd = TclGetInt4AtPtr(pc+1);
@@ -4315,6 +4343,7 @@ TEBCresume(
#endif
NEXT_INST_F(jmpOffset[b], 1, 0);
}
break;
case INST_JUMP_TABLE: {
Tcl_HashEntry *hPtr;
@@ -4340,6 +4369,7 @@ TEBCresume(
NEXT_INST_F(5, 1, 0);
}
}
break;
/*
* These two instructions are now redundant: the complete logic of the LOR
@@ -4384,6 +4414,7 @@ TEBCresume(
TRACE(("%.20s %.20s => %d\n", O2S(valuePtr),O2S(value2Ptr),iResult));
NEXT_INST_F(1, 2, 1);
}
break;
/*
* -----------------------------------------------------------------
@@ -4402,6 +4433,7 @@ TEBCresume(
TRACE_WITH_OBJ(("=> "), objResultPtr);
NEXT_INST_F(1, 0, 1);
}
break;
case INST_COROUTINE_NAME: {
CoroutineData *corPtr = iPtr->execEnvPtr->corPtr;
@@ -4413,10 +4445,12 @@ TEBCresume(
TRACE_WITH_OBJ(("=> "), objResultPtr);
NEXT_INST_F(1, 0, 1);
}
break;
case INST_INFO_LEVEL_NUM:
TclNewIntObj(objResultPtr, iPtr->varFramePtr->level);
TRACE_WITH_OBJ(("=> "), objResultPtr);
NEXT_INST_F(1, 0, 1);
break;
case INST_INFO_LEVEL_ARGS: {
int level;
CallFrame *framePtr = iPtr->varFramePtr;
@@ -5838,6 +5872,7 @@ TEBCresume(
wResult = w1 - w2*wResult;
goto wideResultOfArithmetic;
}
break;
case INST_RSHIFT:
if (w2 < 0) {
@@ -5886,6 +5921,7 @@ TEBCresume(
wResult = w1 >> ((int) w2);
goto wideResultOfArithmetic;
}
break;
case INST_LSHIFT:
if (w2 < 0) {
@@ -6075,6 +6111,7 @@ TEBCresume(
TclSetIntObj(valuePtr, wResult);
TRACE(("%s\n", O2S(valuePtr)));
NEXT_INST_F(1, 1, 0);
break;
case INST_DIV:
if (w2 == 0) {
@@ -6214,6 +6251,7 @@ TEBCresume(
/* -NaN => NaN */
TRACE_APPEND(("%s\n", O2S(valuePtr)));
NEXT_INST_F(1, 0, 0);
break;
case TCL_NUMBER_INT:
w1 = *((const Tcl_WideInt *) ptr1);
if (w1 != WIDE_MIN) {
@@ -6322,6 +6360,7 @@ TEBCresume(
TRACE_APPEND(("numeric, same Tcl_Obj\n"));
NEXT_INST_F(1, 0, 0);
}
break;
/*
* End of numeric operator instructions.
@@ -6338,6 +6377,7 @@ TEBCresume(
}
TRACE_WITH_OBJ(("\"%.30s\" => ", O2S(valuePtr)), objResultPtr);
NEXT_INST_F(1, 0, 1);
break;
case INST_BREAK:
/*
@@ -6719,6 +6759,7 @@ TEBCresume(
Tcl_ListObjAppendElement(NULL, objPtr, OBJ_AT_TOS);
NEXT_INST_F(1, 1, 0);
}
break;
case INST_BEGIN_CATCH4:
/*
@@ -6732,6 +6773,7 @@ TEBCresume(
TclGetUInt4AtPtr(pc+1), (int) (catchTop - initCatchTop - 1),
(int) CURR_DEPTH));
NEXT_INST_F(5, 0, 0);
break;
case INST_END_CATCH:
catchTop--;
@@ -6741,6 +6783,7 @@ TEBCresume(
result = TCL_OK;
TRACE(("=> catchTop=%d\n", (int) (catchTop - initCatchTop - 1)));
NEXT_INST_F(1, 0, 0);
break;
case INST_PUSH_RESULT:
objResultPtr = Tcl_GetObjResult(interp);
@@ -6754,11 +6797,13 @@ TEBCresume(
Tcl_IncrRefCount(objPtr);
iPtr->objResultPtr = objPtr;
NEXT_INST_F(1, 0, -1);
break;
case INST_PUSH_RETURN_CODE:
TclNewIntObj(objResultPtr, result);
TRACE(("=> %u\n", result));
NEXT_INST_F(1, 0, 1);
break;
case INST_PUSH_RETURN_OPTIONS:
DECACHE_STACK_INFO();
@@ -6766,6 +6811,7 @@ TEBCresume(
CACHE_STACK_INFO();
TRACE_WITH_OBJ(("=> "), objResultPtr);
NEXT_INST_F(1, 0, 1);
break;
case INST_RETURN_CODE_BRANCH: {
int code;
@@ -6805,6 +6851,7 @@ TEBCresume(
}
TRACE_APPEND(("OK\n"));
NEXT_INST_F(1, 1, 0);
break;
case INST_DICT_EXISTS: {
int found;
@@ -7428,6 +7475,7 @@ TEBCresume(
TRACE_APPEND(("OK\n"));
NEXT_INST_F(5, 2, 0);
}
break;
/*
* End of dictionary-related instructions.
@@ -7465,6 +7513,7 @@ TEBCresume(
TRACE_WITH_OBJ(("=> "), objResultPtr);
NEXT_INST_F(2, 0, 1);
}
break;
default:
Tcl_Panic("TclNRExecuteByteCode: unrecognized opCode %u", *pc);
@@ -8072,7 +8121,7 @@ ExecuteExtendedBinaryMathOp(
* Arguments are opposite sign; remainder is sum.
*/
mp_init_ll(&big1, w1);
mp_init_i64(&big1, w1);
mp_add(&big2, &big1, &big2);
mp_clear(&big1);
BIG_RESULT(&big2);
@@ -8090,7 +8139,7 @@ ExecuteExtendedBinaryMathOp(
mp_init(&bigResult);
mp_init(&bigRemainder);
mp_div(&big1, &big2, &bigResult, &bigRemainder);
if ((bigRemainder.used != 0) && (bigRemainder.sign != big2.sign)) {
if (!mp_iszero(&bigRemainder) && (bigRemainder.sign != big2.sign)) {
/*
* Convert to Tcl's integer division rules.
*/
@@ -8321,7 +8370,7 @@ ExecuteExtendedBinaryMathOp(
Tcl_TakeBignumFromObj(NULL, value2Ptr, &big2);
negativeExponent = mp_isneg(&big2);
mp_mod_2d(&big2, 1, &big2);
oddExponent = big2.used != 0;
oddExponent = !mp_iszero(&big2);
mp_clear(&big2);
}
@@ -8638,7 +8687,7 @@ ExecuteExtendedBinaryMathOp(
mp_mul(&big1, &big2, &bigResult);
break;
case INST_DIV:
if (big2.used == 0) {
if (mp_iszero(&big2)) {
mp_clear(&big1);
mp_clear(&big2);
mp_clear(&bigResult);
@@ -8647,7 +8696,7 @@ ExecuteExtendedBinaryMathOp(
mp_init(&bigRemainder);
mp_div(&big1, &big2, &bigResult, &bigRemainder);
/* TODO: internals intrusion */
if ((bigRemainder.used != 0)
if (!mp_iszero(&bigRemainder)
&& (bigRemainder.sign != big2.sign)) {
/*
* Convert to Tcl's integer division rules.
@@ -8689,7 +8738,7 @@ ExecuteExtendedUnaryMathOp(
}
Tcl_TakeBignumFromObj(NULL, valuePtr, &big);
/* ~a = - a - 1 */
mp_neg(&big, &big);
(void)mp_neg(&big, &big);
mp_sub_d(&big, 1, &big);
BIG_RESULT(&big);
case INST_UMINUS:
@@ -8701,12 +8750,12 @@ ExecuteExtendedUnaryMathOp(
if (w != WIDE_MIN) {
WIDE_RESULT(-w);
}
mp_init_ll(&big, w);
mp_init_i64(&big, w);
break;
default:
Tcl_TakeBignumFromObj(NULL, valuePtr, &big);
}
mp_neg(&big, &big);
(void)mp_neg(&big, &big);
BIG_RESULT(&big);
}
@@ -8802,6 +8851,7 @@ TclCompareTwoNumbers(
mp_clear(&big2);
return compare;
}
break;
case TCL_NUMBER_DOUBLE:
d1 = *((const double *)ptr1);
@@ -8848,6 +8898,7 @@ TclCompareTwoNumbers(
Tcl_InitBignumFromDouble(NULL, d1, &big1);
goto bigCompare;
}
break;
case TCL_NUMBER_BIG:
Tcl_TakeBignumFromObj(NULL, valuePtr, &big1);
@@ -8884,10 +8935,11 @@ TclCompareTwoNumbers(
mp_clear(&big2);
return compare;
}
break;
default:
Tcl_Panic("unexpected number type");
return TCL_ERROR;
}
return TCL_ERROR;
}
#ifdef TCL_COMPILE_DEBUG
@@ -9056,12 +9108,12 @@ IllegalExprOperandType(
ClientData ptr;
int type;
const unsigned char opcode = *pc;
const char *description, *operator = "unknown";
const char *description, *op = "unknown";
if (opcode == INST_EXPON) {
operator = "**";
op = "**";
} else if (opcode <= INST_LNOT) {
operator = operatorStrings[opcode - INST_LOR];
op = operatorStrings[opcode - INST_LOR];
}
if (GetNumberFromObj(NULL, opndPtr, &ptr, &type) != TCL_OK) {
@@ -9085,7 +9137,7 @@ IllegalExprOperandType(
}
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't use %s as operand of \"%s\"", description, operator));
"can't use %s as operand of \"%s\"", description, op));
Tcl_SetErrorCode(interp, "ARITH", "DOMAIN", description, NULL);
}
+4 -4
View File
@@ -4712,14 +4712,14 @@ Tcl_GetsObj(
* Skip the raw bytes that make up the '\n'.
*/
char tmp[TCL_UTF_MAX];
int rawRead;
char tmp[TCL_UTF_MAX];
bufPtr = gs.bufPtr;
Tcl_ExternalToUtf(NULL, gs.encoding, RemovePoint(bufPtr),
gs.rawRead, statePtr->inputEncodingFlags
| TCL_ENCODING_NO_TERMINATE, &gs.state, tmp,
TCL_UTF_MAX, &rawRead, NULL, NULL);
sizeof(tmp), &rawRead, NULL, NULL);
bufPtr->nextRemoved += rawRead;
gs.rawRead -= rawRead;
gs.bytesWrote--;
@@ -6265,8 +6265,8 @@ ReadChars(
*/
if (code != TCL_OK) {
char buffer[TCL_UTF_MAX + 1];
int read, decoded, count;
char buffer[TCL_UTF_MAX + 1];
/*
* Didn't get everything the buffer could offer
@@ -6282,7 +6282,7 @@ ReadChars(
Tcl_ExternalToUtf(NULL, encoding, src, srcLen,
(statePtr->inputEncodingFlags | TCL_ENCODING_NO_TERMINATE),
&statePtr->inputEncodingState, buffer, TCL_UTF_MAX + 1,
&statePtr->inputEncodingState, buffer, sizeof(buffer),
&read, &decoded, &count);
if (count == 2) {
+22 -22
View File
@@ -171,7 +171,7 @@ const Tcl_Filesystem tclNativeFilesystem = {
TclpObjCopyDirectory,
TclpObjLstat,
/* Needs casts since we're using version_2. */
(Tcl_FSLoadFileProc *) TclpDlopen,
(Tcl_FSLoadFileProc *)(void *) TclpDlopen,
(Tcl_FSGetCwdProc *) TclpGetNativeCwd,
TclpObjChdir
};
@@ -620,7 +620,7 @@ FsGetFirstFilesystem(void)
}
/*
* The epoch can is changed when a filesystems is added or removed, when
* The epoch can is changed when a filesystems is added or removed, when
* "system encoding" changes, and when env(HOME) changes.
*/
@@ -959,7 +959,7 @@ Tcl_FSUnregister(
* Search in the given pathname for files matching the given pattern.
* Used by [glob]. Processes just one pattern for one directory. Callers
* such as TclGlob and DoGlob implement manage the searching of multiple
* directories in cases such as
* directories in cases such as
* glob -dir $dir -join * pkgIndex.tcl
*
* Results:
@@ -1222,7 +1222,7 @@ FsAddMountsToGlobResult(
*
* The reason for the exception in 2,3 for the native filesystem is that
* the native filesystem claims every file without determining whether
* whether the file exists, or even whether the pathname makes sense.
* whether the file exists, or even whether the pathname makes sense.
*
*----------------------------------------------------------------------
*/
@@ -1240,7 +1240,7 @@ Tcl_FSMountsChanged(
/*
* Increment the filesystem epoch to invalidate every existing cached
* internal representation.
* internal representation.
*/
Tcl_MutexLock(&filesystemMutex);
@@ -1475,7 +1475,7 @@ TclGetOpenModeEx(
const char *modeString, /* Mode string, e.g. "r+" or "RDONLY CREAT" */
int *seekFlagPtr, /* Sets this to 1 to tell the the caller to seek to
* EOF after opening the file, and 0 otherwise. */
int *binaryPtr) /* Sets this to 1 to tell the caller to
int *binaryPtr) /* Sets this to 1 to tell the caller to
* configure the channel for binary
* operations after opening the file. */
{
@@ -1718,7 +1718,7 @@ Tcl_FSEvalFileEx(
}
/*
* The eof character is \32 (^Z). This is standard on Windows, and Tcl
* The eof character is \32 (^Z). This is standard on Windows, and Tcl
* uses it on every platform to allow for scripted documents. [Bug: 2040]
*/
@@ -1854,7 +1854,7 @@ TclNREvalFile(
TclPkgFileSeen(interp, Tcl_GetString(pathPtr));
/*
* The eof character is \32 (^Z). This is standard on Windows, and Tcl
* The eof character is \32 (^Z). This is standard on Windows, and Tcl
* uses it on every platform to allow for scripted documents. [Bug: 2040]
*/
@@ -2064,7 +2064,7 @@ Tcl_PosixError(
*----------------------------------------------------------------------
*
* Tcl_FSStat --
* Calls 'statProc' of the filesystem corresponding to pathPtr.
* Calls 'statProc' of the filesystem corresponding to pathPtr.
*
* Replaces the standard library routines stat.
*
@@ -2098,7 +2098,7 @@ Tcl_FSStat(
*----------------------------------------------------------------------
*
* Tcl_FSLstat --
* Calls the 'lstatProc' of the filesystem corresponding to pathPtr.
* Calls the 'lstatProc' of the filesystem corresponding to pathPtr.
*
* Replaces the library version of lstat. If the filesystem doesn't
* provide lstatProc but does provide statProc, Tcl falls back to
@@ -2198,7 +2198,7 @@ Tcl_FSOpenFileChannel(
if (Tcl_FSGetNormalizedPath(interp, pathPtr) == NULL) {
/*
* Return the correct error message.
* Return the correct error message.
*/
return NULL;
}
@@ -2650,7 +2650,7 @@ Tcl_FSGetCwd(
norm = TclFSNormalizeAbsolutePath(interp,retVal);
if (norm != NULL) {
/*
* Assign to global storage the pathname of the current directory
* Assign to global storage the pathname of the current directory
* and copy it into thread-local storage as well.
*
* At system startup multiple threads could in principle
@@ -2953,7 +2953,7 @@ Tcl_FSChdir(
*/
FsUpdateCwd(normDirName, cd);
}
}
} else {
/*
* Tcl_FSGetCwd() synchronizes the file-global cwdPathPtr if
@@ -3017,7 +3017,7 @@ Tcl_FSLoadFile(
/* Places to store pointers to the functions
* named by sym1 and sym2. */
Tcl_LoadHandle *handlePtr, /* A place to store the token for the loaded
* object. Can be passed to
* object. Can be passed to
* (*unloadProcPtr)() to unload the file. */
Tcl_FSUnloadFileProc **unloadProcPtr)
/* A place to store a pointer to the function
@@ -3049,7 +3049,7 @@ Tcl_FSLoadFile(
*
* Load a dynamic shared object by calling 'loadFileProc' of the
* filesystem corresponding to the given pathname, and then finds within
* the loaded object the functions named in symbols[].
* the loaded object the functions named in symbols[].
*
* The given pathname is passed unmodified to `loadFileProc`, which
* decides how to resolve it. On POSIX systems the native filesystem
@@ -3176,7 +3176,7 @@ Tcl_LoadFile(
}
if (fsPtr->loadFileProc != NULL) {
int retVal = ((Tcl_FSLoadFileProc2 *)(fsPtr->loadFileProc))
int retVal = ((Tcl_FSLoadFileProc2 *)(void *)(fsPtr->loadFileProc))
(interp, pathPtr, handlePtr, &unloadProcPtr, flags);
if (retVal == TCL_OK) {
@@ -3194,7 +3194,7 @@ Tcl_LoadFile(
}
/*
* The filesystem doesn't support 'load'. Fall to the following:
* The filesystem doesn't support 'load'. Fall to the following:
*/
/*
@@ -3377,7 +3377,7 @@ Tcl_LoadFile(
/*
* This is the filesystem for the temporary file the object was loaded
* from. A reference to copyToPtr is already stored in
* tvdlPtr->divertedFile, so need need to increment the refCount again.
* tvdlPtr->divertedFile, so need need to increment the refCount again.
*/
tvdlPtr->divertedFilesystem = copyFsPtr;
@@ -3720,7 +3720,7 @@ TclFSUnloadTempFile(
Tcl_Obj *
Tcl_FSLink(
Tcl_Obj *pathPtr, /* Pathaname of file. */
Tcl_Obj *toPtr, /*
Tcl_Obj *toPtr, /*
* NULL or the pathname of a file to link to.
*/
int linkAction) /* Action to perform. */
@@ -3803,7 +3803,7 @@ Tcl_FSListVolumes(void)
*
* FsListMounts --
*
* Lists the mounts mathing the given pattern in the given directory.
* Lists the mounts mathing the given pattern in the given directory.
*
* Results:
* A list, having a refCount of 0, of the matching mounts, or NULL if no
@@ -4208,7 +4208,7 @@ Tcl_FSCopyFile(
* TclCrossFilesystemCopy --
*
* Helper for Tcl_FSCopyFile and Tcl_FSLoadFile. Copies a file from one
* filesystem to another, overwiting any file that already exists.
* filesystem to another, overwiting any file that already exists.
*
* Results:
* A standard Tcl return code.
@@ -4513,7 +4513,7 @@ Tcl_FSGetFileSystemForPath(
/*
* Call each of the "pathInFilesystem" functions in succession until the
* corresponding filesystem is found.
*/
*/
for (; fsRecPtr!=NULL ; fsRecPtr=fsRecPtr->nextPtr) {
ClientData clientData = NULL;
+1 -2
View File
@@ -4615,7 +4615,7 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file,
*----------------------------------------------------------------
*/
#if TCL_UTF_MAX > 4
#if TCL_UTF_MAX > 3
#define TclUtfToUniChar(str, chPtr) \
((((unsigned char) *(str)) < 0x80) ? \
((*(chPtr) = (unsigned char) *(str)), 1) \
@@ -5078,7 +5078,6 @@ typedef struct NRE_callback {
#include "tclIntDecls.h"
#include "tclIntPlatDecls.h"
#include "tclTomMathDecls.h"
#if !defined(USE_TCL_STUBS) && !defined(TCL_MEM_DEBUG)
#define Tcl_AttemptAlloc(size) TclpAlloc(size)
+8 -3
View File
@@ -525,7 +525,7 @@ TclInterpInit(
static void
InterpInfoDeleteProc(
ClientData clientData, /* Ignored. */
ClientData dummy, /* Ignored. */
Tcl_Interp *interp) /* Interp being deleted. All commands for
* slave interps should already be deleted. */
{
@@ -533,6 +533,7 @@ InterpInfoDeleteProc(
Slave *slavePtr;
Master *masterPtr;
Target *targetPtr;
(void)dummy;
interpInfoPtr = (InterpInfo *) ((Interp *) interp)->interpInfo;
@@ -614,7 +615,7 @@ Tcl_InterpObjCmd(
static int
NRInterpCmd(
ClientData clientData, /* Unused. */
ClientData dummy, /* Unused. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -638,6 +639,7 @@ 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 ...?");
@@ -999,6 +1001,7 @@ NRInterpCmd(
return SlaveTimeLimitCmd(interp, slaveInterp, 4, objc, objv);
}
}
break;
case OPT_MARKTRUSTED:
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "path");
@@ -2707,6 +2710,7 @@ NRSlaveCmd(
return SlaveTimeLimitCmd(interp, slaveInterp, 3, objc, objv);
}
}
break;
case OPT_MARKTRUSTED:
if (objc != 2) {
Tcl_WrongNumArgs(interp, 2, objv, NULL);
@@ -4235,10 +4239,11 @@ DeleteScriptLimitCallback(
static void
CallScriptLimitCallback(
ClientData clientData,
Tcl_Interp *interp) /* Interpreter which failed the limit */
Tcl_Interp *dummy) /* Interpreter which failed the limit */
{
ScriptLimitCallback *limitCBPtr = clientData;
int code;
(void)dummy;
if (Tcl_InterpDeleted(limitCBPtr->interp)) {
return;
+9 -1
View File
@@ -16,7 +16,7 @@
*/
#include "tclInt.h"
#include "tommath.h"
#include "tclTomMath.h"
#include <math.h>
/*
@@ -261,6 +261,14 @@ Tcl_LinkArray(
linkPtr = ckalloc(sizeof(Link));
linkPtr->type = type & ~TCL_LINK_READ_ONLY;
#if !defined(TCL_NO_DEPRECATED) && (defined(TCL_WIDE_INT_IS_LONG) \
|| defined(_WIN32) || defined(__CYGWIN__))
if (linkPtr->type == 11 /* legacy TCL_LINK_LONG */) {
linkPtr->type = TCL_LINK_LONG;
} else if (linkPtr->type == 12 /* legacy TCL_LINK_ULONG */) {
linkPtr->type = TCL_LINK_ULONG;
}
#endif
linkPtr->numElems = size;
if (type & TCL_LINK_READ_ONLY) {
linkPtr->flags = LINK_READ_ONLY;
+1 -1
View File
@@ -884,7 +884,7 @@ Tcl_UnloadObjCmd(
for (ipPrevPtr = ipPtr; ipPtr != NULL;
ipPrevPtr = ipPtr, ipPtr = ipPtr->nextPtr) {
if (ipPtr->pkgPtr == pkgPtr) {
if (ipPtr->pkgPtr == defaultPtr) {
ipPrevPtr->nextPtr = ipPtr->nextPtr;
break;
}
+1 -1
View File
@@ -446,7 +446,7 @@ Tcl_MainEx(
* Get a new value for tty if anyone writes to ::tcl_interactive
*/
Tcl_LinkVar(interp, "tcl_interactive", (char *) &is.tty, TCL_LINK_BOOLEAN);
Tcl_LinkVar(interp, "tcl_interactive", &is.tty, TCL_LINK_BOOLEAN);
is.input = Tcl_GetStdChannel(TCL_STDIN);
while ((is.input != NULL) && !Tcl_InterpDeleted(interp)) {
mainLoopProc = TclGetMainLoop();
+2
View File
@@ -1677,6 +1677,7 @@ AddPrivatesFromClassChainToCallContext(
return 1;
}
}
/* FALLTHRU */
case 0:
return 0;
}
@@ -1768,6 +1769,7 @@ AddSimpleClassChainToCallContext(
privateDanger |= AddSimpleClassChainToCallContext(superPtr,
methodNameObj, cbPtr, doneFilters, flags, filterDecl);
}
/* FALLTHRU */
case 0:
return privateDanger;
}
+2 -2
View File
@@ -15,7 +15,7 @@
*/
#include "tclInt.h"
#include "tommath.h"
#include "tclTomMath.h"
#include <math.h>
#include <assert.h>
@@ -3604,7 +3604,7 @@ GetBignumFromObj(
return TCL_OK;
}
if (objPtr->typePtr == &tclIntType) {
mp_init_ll(bignumValue,
mp_init_i64(bignumValue,
objPtr->internalRep.wideValue);
return TCL_OK;
}
+19 -6
View File
@@ -816,7 +816,7 @@ TclParseBackslash(
count = 2;
switch (*p) {
/*
* Note: in the conversions below, use absolute values (e.g., 0xa)
* Note: in the conversions below, use absolute values (e.g., 0xA)
* rather than symbolic values (e.g. \n) that get converted by the
* compiler. It's possible that compilers on some platforms will do
* the symbolic conversions differently, which could result in
@@ -830,19 +830,19 @@ TclParseBackslash(
result = 0x8;
break;
case 'f':
result = 0xc;
result = 0xC;
break;
case 'n':
result = 0xa;
result = 0xA;
break;
case 'r':
result = 0xd;
result = 0xD;
break;
case 't':
result = 0x9;
break;
case 'v':
result = 0xb;
result = 0xB;
break;
case 'x':
count += TclParseHex(p+1, (numBytes > 3) ? 2 : numBytes-2, &result);
@@ -866,6 +866,16 @@ TclParseBackslash(
* No hexdigits -> This is just "u".
*/
result = 'u';
} else if (((result & 0xDC00) == 0xD800) && (count == 6)
&& (p[5] == '\\') && (p[6] == 'u') && (numBytes >= 10)) {
/* If high surrogate is immediately followed by a low surrogate
* escape, combine them into one character. */
int low;
int count2 = TclParseHex(p+7, 4, &low);
if ((count2 == 4) && ((low & 0xDC00) == 0xDC00)) {
result = ((result & 0x3FF)<<10 | (low & 0x3FF)) + 0x10000;
count += count2 + 2;
}
}
break;
case 'U':
@@ -875,6 +885,9 @@ TclParseBackslash(
* No hexdigits -> This is just "U".
*/
result = 'U';
} else if ((result | 0x7FF) == 0xDFFF) {
/* Upper or lower surrogate, not allowed in this syntax. */
result = 0xFFFD;
}
break;
case '\n':
@@ -923,7 +936,7 @@ TclParseBackslash(
if (Tcl_UtfCharComplete(p, numBytes - 1)) {
count = TclUtfToUniChar(p, &unichar) + 1; /* +1 for '\' */
} else {
char utfBytes[TCL_UTF_MAX];
char utfBytes[4];
memcpy(utfBytes, p, numBytes - 1);
utfBytes[numBytes - 1] = '\0';
+3 -3
View File
@@ -47,7 +47,7 @@ static const Tcl_ObjType fsPathType = {
/*
* struct FsPath --
*
* Internal representation of a Tcl_Obj of fsPathType
* Internal representation of a Tcl_Obj of fsPathType
*/
typedef struct FsPath {
@@ -124,7 +124,7 @@ typedef struct FsPath {
* None (beyond the memory allocation for the result).
*
* Special note:
* Originally based on code from Matt Newman and Jean-Claude Wippler.
* Originally based on code from Matt Newman and Jean-Claude Wippler.
* Totally rewritten later by Vince Darley to handle symbolic links.
*
*---------------------------------------------------------------------------
@@ -2028,7 +2028,7 @@ Tcl_FSGetInternalRep(
*
* TclFSEnsureEpochOk --
*
* Ensure that the path is a valid path, and that it has a
* Ensure that the path is a valid path, and that it has a
* fsPathType internal representation that is not stale.
*
* Results:
+13 -19
View File
@@ -1690,22 +1690,14 @@ Tcl_SetReturnOptions(
*
* Tcl_TransferResult --
*
* Copy the result (and error information) from one interp to another.
* Transfer the result (and error information) from one interp to another.
* Used when one interp has caused another interp to evaluate a script
* and then wants to transfer the results back to itself.
*
* This routine copies the string reps of the result and error
* information. It does not simply increment the refcounts of the result
* and error information objects themselves. It is not legal to exchange
* objects between interps, because an object may be kept alive by one
* interp, but have an internal rep that is only valid while some other
* interp is alive.
*
* Results:
* The target interp's result is set to a copy of the source interp's
* result. The source's errorInfo field may be transferred to the
* target's errorInfo field, and the source's errorCode field may be
* transferred to the target's errorCode field.
* The result of targetInterp is set to the result read from sourceInterp.
* The return options dictionary of sourceInterp is transferred to
* targetInterp as appropriate for the return code value code.
*
* Side effects:
* None.
@@ -1715,14 +1707,16 @@ Tcl_SetReturnOptions(
void
Tcl_TransferResult(
Tcl_Interp *sourceInterp, /* Interp whose result and error information
Tcl_Interp *sourceInterp, /* Interp whose result and return options
* should be moved to the target interp.
* After moving result, this interp's result
* is reset. */
int result, /* TCL_OK if just the result should be copied,
* TCL_ERROR if both the result and error
* information should be copied. */
Tcl_Interp *targetInterp) /* Interp where result and error information
int code, /* The return code value active in
* sourceInterp. Controls how the return options
* dictionary is retrieved from sourceInterp,
* same as in Tcl_GetReturnOptions, to then be
* transferred to targetInterp. */
Tcl_Interp *targetInterp) /* Interp where result and return options
* should be stored. If source and target are
* the same, nothing is done. */
{
@@ -1733,7 +1727,7 @@ Tcl_TransferResult(
return;
}
if (result == TCL_OK && siPtr->returnOpts == NULL) {
if (code == TCL_OK && siPtr->returnOpts == NULL) {
/*
* Special optimization for the common case of normal command return
* code and no explicit return options.
@@ -1745,7 +1739,7 @@ Tcl_TransferResult(
}
} else {
Tcl_SetReturnOptions(targetInterp,
Tcl_GetReturnOptions(sourceInterp, result));
Tcl_GetReturnOptions(sourceInterp, code));
tiPtr->flags &= ~(ERR_ALREADY_LOGGED);
}
Tcl_SetObjResult(targetInterp, Tcl_GetObjResult(sourceInterp));
+5 -7
View File
@@ -10,7 +10,7 @@
*/
#include "tclInt.h"
#include "tommath.h"
#include "tclTomMath.h"
/*
* Flag values used by Tcl_ScanObjCmd.
@@ -261,11 +261,11 @@ ValidateFormat(
Tcl_UniChar ch = 0;
int objIndex, xpgSize, nspace = numVars;
int *nassign = TclStackAlloc(interp, nspace * sizeof(int));
char buf[TCL_UTF_MAX + 1] = "";
Tcl_Obj *errorMsg; /* Place to build an error messages. Note that
* these are messy operations because we do
* not want to use the formatting engine;
* we're inside there! */
char buf[5] = "";
/*
* Initialize an array that records the number of times a variable is
@@ -877,7 +877,7 @@ Tcl_ScanObjCmd(
offset = TclUtfToUniChar(string, &sch);
i = (int)sch;
#if TCL_UTF_MAX <= 4
#if TCL_UTF_MAX <= 3
if ((sch >= 0xD800) && (offset < 3)) {
offset += TclUtfToUniChar(string+offset, &sch);
i = (((i<<10) & 0x0FFC00) + 0x10000) + (sch & 0x3FF);
@@ -929,13 +929,12 @@ Tcl_ScanObjCmd(
}
if ((flags & SCAN_UNSIGNED) && (wideValue < 0)) {
mp_int big;
if (mp_init(&big) != MP_OKAY) {
if (mp_init_u64(&big, (Tcl_WideUInt)wideValue) != MP_OKAY) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"insufficient memory to create bignum", -1));
Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL);
return TCL_ERROR;
} else {
mp_set_ull(&big, (Tcl_WideUInt)wideValue);
Tcl_SetBignumObj(objPtr, &big);
}
} else {
@@ -976,13 +975,12 @@ Tcl_ScanObjCmd(
if ((flags & SCAN_UNSIGNED) && (value < 0)) {
#ifdef TCL_WIDE_INT_IS_LONG
mp_int big;
if (mp_init(&big) != MP_OKAY) {
if (mp_init_u64(&big, (unsigned long)value) != MP_OKAY) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"insufficient memory to create bignum", -1));
Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL);
return TCL_ERROR;
} else {
mp_set_ull(&big, (unsigned long)value);
Tcl_SetBignumObj(objPtr, &big);
}
#else
+139 -62
View File
@@ -14,9 +14,14 @@
*/
#include "tclInt.h"
#include "tommath.h"
#include "tclTomMath.h"
#include <float.h>
#include <math.h>
#ifdef _WIN32
#define copysign _copysign
#endif
/*
* This code supports (at least hypothetically), IBM, Cray, VAX and IEEE-754
* floating point; of these, only IEEE-754 can represent NaN. IEEE-754 can be
@@ -289,10 +294,10 @@ static const Tcl_WideUInt wuipow5[27] = {
static int AccumulateDecimalDigit(unsigned, int,
Tcl_WideUInt *, mp_int *, int);
static double MakeHighPrecisionDouble(int signum,
mp_int *significand, int nSigDigs, int exponent);
mp_int *significand, int nSigDigs, long exponent);
static double MakeLowPrecisionDouble(int signum,
Tcl_WideUInt significand, int nSigDigs,
int exponent);
long exponent);
#ifdef IEEE_FLOATING_POINT
static double MakeNaN(int signum, Tcl_WideUInt tag);
#endif
@@ -711,7 +716,7 @@ TclParseNumber(
|| (octalSignificandWide >
((Tcl_WideUInt)-1 >> shift)))) {
octalSignificandOverflow = 1;
mp_init_ull(&octalSignificandBig,
mp_init_u64(&octalSignificandBig,
octalSignificandWide);
}
}
@@ -828,7 +833,7 @@ TclParseNumber(
((size_t)shift >= CHAR_BIT*sizeof(Tcl_WideUInt) ||
significandWide > ((Tcl_WideUInt)-1 >> shift))) {
significandOverflow = 1;
mp_init_ull(&significandBig,
mp_init_u64(&significandBig,
significandWide);
}
}
@@ -847,6 +852,7 @@ TclParseNumber(
acceptState = state;
acceptPoint = p;
acceptLen = len;
/* FALLTHRU */
case ZERO_B:
zerob:
if (c == '0') {
@@ -869,7 +875,7 @@ TclParseNumber(
((size_t)shift >= CHAR_BIT*sizeof(Tcl_WideUInt) ||
significandWide > ((Tcl_WideUInt)-1 >> shift))) {
significandOverflow = 1;
mp_init_ull(&significandBig,
mp_init_u64(&significandBig,
significandWide);
}
}
@@ -1214,7 +1220,7 @@ TclParseNumber(
((size_t)shift >= CHAR_BIT*sizeof(Tcl_WideUInt) ||
significandWide > (MOST_BITS + signum) >> shift)) {
significandOverflow = 1;
mp_init_ull(&significandBig, significandWide);
mp_init_u64(&significandBig, significandWide);
}
if (shift) {
if (!significandOverflow) {
@@ -1235,7 +1241,7 @@ TclParseNumber(
((size_t)shift >= CHAR_BIT*sizeof(Tcl_WideUInt) ||
significandWide > (MOST_BITS + signum) >> shift)) {
significandOverflow = 1;
mp_init_ull(&significandBig, significandWide);
mp_init_u64(&significandBig, significandWide);
}
if (shift) {
if (!significandOverflow) {
@@ -1256,7 +1262,7 @@ TclParseNumber(
((size_t)shift >= CHAR_BIT*sizeof(Tcl_WideUInt) ||
octalSignificandWide > (MOST_BITS + signum) >> shift)) {
octalSignificandOverflow = 1;
mp_init_ull(&octalSignificandBig,
mp_init_u64(&octalSignificandBig,
octalSignificandWide);
}
if (shift) {
@@ -1269,7 +1275,7 @@ TclParseNumber(
}
if (!octalSignificandOverflow) {
if (octalSignificandWide > (MOST_BITS + signum)) {
mp_init_ull(&octalSignificandBig,
mp_init_u64(&octalSignificandBig,
octalSignificandWide);
octalSignificandOverflow = 1;
} else {
@@ -1285,7 +1291,7 @@ TclParseNumber(
}
if (octalSignificandOverflow) {
if (signum) {
mp_neg(&octalSignificandBig, &octalSignificandBig);
(void)mp_neg(&octalSignificandBig, &octalSignificandBig);
}
TclSetBignumIntRep(objPtr, &octalSignificandBig);
}
@@ -1295,14 +1301,14 @@ TclParseNumber(
case DECIMAL:
significandOverflow = AccumulateDecimalDigit(0, numTrailZeros-1,
&significandWide, &significandBig, significandOverflow);
if (!significandOverflow && (significandWide > MOST_BITS+signum)){
if (!significandOverflow && (significandWide > MOST_BITS+signum)) {
significandOverflow = 1;
mp_init_ull(&significandBig, significandWide);
mp_init_u64(&significandBig, significandWide);
}
returnInteger:
if (!significandOverflow) {
if (significandWide > MOST_BITS+signum) {
mp_init_ull(&significandBig,
mp_init_u64(&significandBig,
significandWide);
significandOverflow = 1;
} else {
@@ -1318,7 +1324,7 @@ TclParseNumber(
}
if (significandOverflow) {
if (signum) {
mp_neg(&significandBig, &significandBig);
(void)mp_neg(&significandBig, &significandBig);
}
TclSetBignumIntRep(objPtr, &significandBig);
}
@@ -1337,16 +1343,45 @@ TclParseNumber(
objPtr->typePtr = &tclDoubleType;
if (exponentSignum) {
/*
* At this point exponent>=0, so the following calculation
* cannot underflow.
*/
exponent = -exponent;
}
/*
* Adjust the exponent for the number of trailing zeros that
* have not been accumulated, and the number of digits after
* the decimal point. Pin any overflow to LONG_MAX/LONG_MIN
* respectively.
*/
if (exponent >= 0) {
if (exponent - numDigitsAfterDp > LONG_MAX - numTrailZeros) {
exponent = LONG_MAX;
} else {
exponent = exponent - numDigitsAfterDp + numTrailZeros;
}
} else {
if (exponent + numTrailZeros < LONG_MIN + numDigitsAfterDp) {
exponent = LONG_MIN;
} else {
exponent = exponent + numTrailZeros - numDigitsAfterDp;
}
}
/*
* The desired number is now significandWide * 10**exponent
* or significandBig * 10**exponent, depending on whether
* the significand has overflowed a wide int.
*/
if (!significandOverflow) {
objPtr->internalRep.doubleValue = MakeLowPrecisionDouble(
signum, significandWide, numSigDigs,
numTrailZeros + exponent - numDigitsAfterDp);
signum, significandWide, numSigDigs, exponent);
} else {
objPtr->internalRep.doubleValue = MakeHighPrecisionDouble(
signum, &significandBig, numSigDigs,
numTrailZeros + exponent - numDigitsAfterDp);
signum, &significandBig, numSigDigs, exponent);
}
break;
@@ -1363,7 +1398,7 @@ TclParseNumber(
#ifdef IEEE_FLOATING_POINT
case sNAN:
case sNANFINISH:
objPtr->internalRep.doubleValue = MakeNaN(signum,significandWide);
objPtr->internalRep.doubleValue = MakeNaN(signum, significandWide);
objPtr->typePtr = &tclDoubleType;
break;
#endif
@@ -1457,7 +1492,7 @@ AccumulateDecimalDigit(
* bignum and fall through into the bignum case.
*/
mp_init_ull(bignumRepPtr, w);
mp_init_u64(bignumRepPtr, w);
} else {
/*
* Wide multiplication.
@@ -1530,9 +1565,9 @@ AccumulateDecimalDigit(
static double
MakeLowPrecisionDouble(
int signum, /* 1 if the number is negative, 0 otherwise */
Tcl_WideUInt significand, /* Significand of the number. */
int numSigDigs, /* Number of digits in the significand. */
int exponent) /* Power of ten. */
Tcl_WideUInt significand, /* Significand of the number */
int numSigDigs, /* Number of digits in the significand */
long exponent) /* Power of ten */
{
double retval; /* Value of the number. */
mp_int significandBig; /* Significand expressed as a bignum. */
@@ -1551,6 +1586,9 @@ MakeLowPrecisionDouble(
* Test for the easy cases.
*/
if (significand == 0) {
return copysign(0.0, -signum);
}
if (numSigDigs <= QUICK_MAX) {
if (exponent >= 0) {
if (exponent <= mmaxpow) {
@@ -1600,7 +1638,7 @@ MakeLowPrecisionDouble(
* call MakeHighPrecisionDouble to do it the hard way.
*/
mp_init_ull(&significandBig, significand);
mp_init_u64(&significandBig, significand);
retval = MakeHighPrecisionDouble(0, &significandBig, numSigDigs,
exponent);
mp_clear(&significandBig);
@@ -1643,10 +1681,10 @@ MakeLowPrecisionDouble(
static double
MakeHighPrecisionDouble(
int signum, /* 1=negative, 0=nonnegative. */
mp_int *significand, /* Exact significand of the number. */
int numSigDigs, /* Number of significant digits. */
int exponent) /* Power of 10 by which to multiply. */
int signum, /* 1=negative, 0=nonnegative */
mp_int *significand, /* Exact significand of the number */
int numSigDigs, /* Number of significant digits */
long exponent) /* Power of 10 by which to multiply */
{
double retval;
int machexp; /* Machine exponent of a power of 10. */
@@ -1662,15 +1700,18 @@ MakeHighPrecisionDouble(
TCL_IEEE_DOUBLE_ROUNDING;
/*
* Quick checks for over/underflow.
* Quick checks for zero, and over/underflow. Be careful to avoid
* integer overflow when calculating with 'exponent'.
*/
if (numSigDigs+exponent-1 > maxDigits) {
if (mp_iszero(significand)) {
return copysign(0.0, -signum);
}
if (exponent >= 0 && exponent-1 > maxDigits-numSigDigs) {
retval = HUGE_VAL;
goto returnValue;
}
if (numSigDigs+exponent-1 < minDigits) {
retval = 0;
} else if (exponent < 0 && numSigDigs+exponent < minDigits+1) {
retval = 0.0;
goto returnValue;
}
@@ -1805,6 +1846,9 @@ RefineApproximation(
* "round to even" functionality */
double rteSignificand; /* Significand of the round-to-even result */
int rteExponent; /* Exponent of the round-to-even result */
int shift; /* Shift count for converting numerator
* and denominator of corrector to floating
* point */
Tcl_WideInt rteSigWide; /* Wide integer version of the significand
* for testing evenness */
int i;
@@ -1817,13 +1861,22 @@ RefineApproximation(
if (approxResult == HUGE_VAL) {
return approxResult;
}
significand = frexp(approxResult, &binExponent);
/*
* Find a common denominator for the decimal and binary fractions. The
* common denominator will be 2**M2 + 5**M5.
* We are trying to compute a corrector term that, when added to the
* approximate result, will yield close to the exact result.
* The exact result is exactSignificand * 10**exponent.
* The approximate result is significand * 2**binExponent
* If exponent<0, we need to multiply the exact value by 10**-exponent
* to make it an integer, plus another factor of 2 to decide on rounding.
* Similarly if binExponent<FP_PRECISION, we need
* to multiply by 2**FP_PRECISION to make the approximate value an integer.
*
* Let M = 2**M2 * 5**M5 be the least common multiple of these two
* multipliers.
*/
significand = frexp(approxResult, &binExponent);
i = mantBits - binExponent;
if (i < 0) {
M2 = 0;
@@ -1840,12 +1893,9 @@ RefineApproximation(
}
/*
* The floating point number is significand*2**binExponent. Compute the
* large integer significand*2**(binExponent+M2+1). The 2**-1 bit of the
* significand (the most significant) corresponds to the
* 2**(binExponent+M2 + 1) bit of 2*M2*v. Allocate enough digits to hold
* that quantity, then convert the significand to a large integer, scaled
* appropriately. Then multiply by the appropriate power of 5.
* Compute twoMv as 2*M*v, where v is the approximate value.
* This is done by bit-whacking to calculate 2**(M2+1)*significand,
* and then multiplying by 5**M5.
*/
msb = binExponent + M2; /* 1008 */
@@ -1866,10 +1916,9 @@ RefineApproximation(
}
/*
* Collect the decimal significand as a high precision integer. The least
* significant bit corresponds to bit M2+exponent+1 so it will need to be
* shifted left by that many bits after being multiplied by
* 5**(M5+exponent).
* Compute twoMd as 2*M*d, where d is the exact value.
* This is done by multiplying by 5**(M5+exponent) and then multiplying
* by 2**(M5+exponent+1), which is, of couse, a left shift.
*/
mp_init_copy(&twoMd, exactSignificand);
@@ -1879,17 +1928,23 @@ RefineApproximation(
}
}
mp_mul_2d(&twoMd, M2+exponent+1, &twoMd);
/*
* Now let twoMd = twoMd - twoMv, the difference between the exact and
* approximate values.
*/
mp_sub(&twoMd, &twoMv, &twoMd);
/*
* The result, 2Mv-2Md, needs to be divided by 2M to yield a correction
* term. Because 2M may well overflow a double, we need to scale the
* denominator by a factor of 2**binExponent-mantBits.
* denominator by a factor of 2**binExponent-mantBits. Place that factor
* times 1/2 ULP into twoMd.
*/
scale = binExponent - mantBits - 1;
mp_set(&twoMv, 1);
mp_set_u64(&twoMv, 1);
for (i=0; i<=8; ++i) {
if (M5 & (1 << i)) {
mp_mul(&twoMv, pow5+i, &twoMv);
@@ -1902,25 +1957,36 @@ RefineApproximation(
mp_div_2d(&twoMv, -multiplier, &twoMv, NULL);
}
/*
* Will the eventual correction term be less than, equal to, or
* greater than 1/2 ULP?
*/
switch (mp_cmp_mag(&twoMd, &twoMv)) {
case MP_LT:
/*
* If the result is less than unity, the error is less than 1/2 unit in
* the last place, so there's no correction to make.
* If the error is less than 1/2 ULP, there's no correction to make.
*/
mp_clear(&twoMd);
mp_clear(&twoMv);
return approxResult;
case MP_EQ:
/*
* If the result is exactly unity, we need to round to even.
* If the error is exactly 1/2 ULP, we need to round to even.
*/
roundToEven = 1;
break;
case MP_GT:
/*
* We need to correct the result if the error exceeds 1/2 ULP.
*/
break;
}
/*
* If we're in the 'round to even' case, and the significand is already
* even, we're done. Return the approximate result.
*/
if (roundToEven) {
rteSignificand = frexp(approxResult, &rteExponent);
rteSigWide = (Tcl_WideInt) ldexp(rteSignificand, FP_PRECISION);
@@ -1931,6 +1997,16 @@ RefineApproximation(
}
}
/*
* Reduce the numerator and denominator of the corrector term so that
* they will fit in the floating point precision.
*/
shift = mp_count_bits(&twoMv) - FP_PRECISION - 1;
if (shift > 0) {
mp_div_2d(&twoMv, shift, &twoMv, NULL);
mp_div_2d(&twoMd, shift, &twoMd, NULL);
}
/*
* Convert the numerator and denominator of the corrector term accurately
* to floating point numbers.
@@ -3267,7 +3343,7 @@ ShorteningBignumConversionPowD(
* mminus = 5**m5
*/
mp_init_ull(&b, bw);
mp_init_u64(&b, bw);
mp_init_set(&mminus, 1);
MulPow5(&b, b5, &b);
mp_mul_2d(&b, b2, &b);
@@ -3451,7 +3527,7 @@ StrictBignumConversionPowD(
* b = bw * 2**b2 * 5**b5
*/
mp_init_ull(&b, bw);
mp_init_u64(&b, bw);
MulPow5(&b, b5, &b);
mp_mul_2d(&b, b2, &b);
@@ -3651,7 +3727,7 @@ ShorteningBignumConversion(
* S = 2**s2 * 5*s5
*/
mp_init_ull(&b, bw);
mp_init_u64(&b, bw);
mp_mul_2d(&b, b2, &b);
mp_init_set(&S, 1);
MulPow5(&S, s5, &S); mp_mul_2d(&S, s2, &S);
@@ -3860,7 +3936,7 @@ StrictBignumConversion(
*/
mp_init_multi(&dig, NULL);
mp_init_ull(&b, bw);
mp_init_u64(&b, bw);
mp_mul_2d(&b, b2, &b);
mp_init_set(&S, 1);
MulPow5(&S, s5, &S); mp_mul_2d(&S, s2, &S);
@@ -4338,7 +4414,8 @@ TclInitDoubleConversion(void)
maxpow10_wide = (int)
floor(sizeof(Tcl_WideUInt) * CHAR_BIT * log(2.) / log(10.));
pow10_wide = ckalloc((maxpow10_wide + 1) * sizeof(Tcl_WideUInt));
pow10_wide = (Tcl_WideUInt *)
ckalloc((maxpow10_wide + 1) * sizeof(Tcl_WideUInt));
u = 1;
for (i = 0; i < maxpow10_wide; ++i) {
pow10_wide[i] = u;
@@ -4381,11 +4458,11 @@ TclInitDoubleConversion(void)
for (i=0; i<9; ++i) {
mp_init(pow5 + i);
}
mp_set(pow5, 5);
mp_set_u64(pow5, 5);
for (i=0; i<8; ++i) {
mp_sqr(pow5+i, pow5+i+1);
}
mp_init_ul(pow5_13, 1220703125);
mp_init_u64(pow5_13, 1220703125);
for (i = 1; i < 5; ++i) {
mp_init(pow5_13 + i);
mp_sqr(pow5_13 + i - 1, pow5_13 + i);
@@ -4503,7 +4580,7 @@ Tcl_InitBignumFromDouble(
Tcl_WideInt w = (Tcl_WideInt) ldexp(fract, mantBits);
int shift = expt - mantBits;
mp_init_ll(b, w);
mp_init_i64(b, w);
if (shift < 0) {
mp_div_2d(b, -shift, b, NULL);
} else if (shift > 0) {
@@ -4666,7 +4743,7 @@ TclCeil(
mp_int d;
mp_init(&d);
mp_div_2d(a, -shift, &b, &d);
exact = d.used == 0;
exact = mp_iszero(&d);
mp_clear(&d);
} else {
mp_copy(a, &b);
+6 -6
View File
@@ -35,7 +35,7 @@
*/
#include "tclInt.h"
#include "tommath.h"
#include "tclTomMath.h"
#include "tclStringRep.h"
#include "assert.h"
@@ -568,7 +568,7 @@ Tcl_GetUniChar(
return -1;
}
ch = stringPtr->unicode[index];
#if TCL_UTF_MAX <= 4
#if TCL_UTF_MAX <= 3
/* See: bug [11ae2be95dac9417] */
if ((ch & 0xF800) == 0xD800) {
if (ch & 0x400) {
@@ -752,7 +752,7 @@ Tcl_GetRange(
if (last < first) {
return Tcl_NewObj();
}
#if TCL_UTF_MAX <= 4
#if TCL_UTF_MAX <= 3
/* See: bug [11ae2be95dac9417] */
if ((first > 0) && ((stringPtr->unicode[first] & 0xFC00) == 0xDC00)
&& ((stringPtr->unicode[first-1] & 0xFC00) == 0xD800)) {
@@ -2270,7 +2270,7 @@ Tcl_AppendFormatToObj(
uw /= base;
}
#endif
} else if (useBig && big.used) {
} else if (useBig && !mp_iszero(&big)) {
int leftover = (big.used * MP_DIGIT_BIT) % numBits;
mp_digit mask = (~(mp_digit)0) << (MP_DIGIT_BIT-leftover);
@@ -2309,7 +2309,7 @@ Tcl_AppendFormatToObj(
while (numDigits--) {
int digitOffset;
if (useBig && big.used) {
if (useBig && !mp_iszero(&big)) {
if (index < big.used && (size_t) shift <
CHAR_BIT*sizeof(Tcl_WideUInt) - MP_DIGIT_BIT) {
bits |= ((Tcl_WideUInt) big.dp[index++]) << shift;
@@ -2613,7 +2613,7 @@ AppendPrintfToObjVA(
end = q;
}
q = bytes + TCL_UTF_MAX;
q = bytes + 4;
while ((bytes < end) && (bytes < q)
&& ((*bytes & 0xC0) == 0x80)) {
bytes++;
+190 -69
View File
@@ -11,6 +11,7 @@
#include "tclInt.h"
#include "tommath_private.h"
#include "tclTomMath.h"
#ifdef __CYGWIN__
# include <wchar.h>
@@ -39,6 +40,14 @@
#undef Tcl_NewObj
#undef Tcl_NewStringObj
#undef Tcl_GetUnicode
#undef Tcl_GetUnicodeFromObj
#undef Tcl_AppendUnicodeToObj
#undef Tcl_NewUnicodeObj
#undef Tcl_SetUnicodeObj
#undef Tcl_UniCharNcasecmp
#undef Tcl_UniCharCaseMatch
#undef Tcl_UniCharLen
#undef Tcl_UniCharNcmp
#undef Tcl_DumpActiveMemory
#undef Tcl_ValidateAllMemory
#undef Tcl_FindHashEntry
@@ -63,12 +72,84 @@
#undef Tcl_UtfToUniCharDString
#undef Tcl_UtfToUniChar
#undef TclBN_mp_tc_and
#undef TclBN_mp_tc_or
#undef TclBN_mp_tc_xor
#if TCL_UTF_MAX > 3
static void uniCodePanic() {
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
#endif
#define TclBN_mp_add mp_add
#define TclBN_mp_and mp_and
#define TclBN_mp_clamp mp_clamp
#define TclBN_mp_clear mp_clear
#define TclBN_mp_clear_multi mp_clear_multi
#define TclBN_mp_cmp mp_cmp
#define TclBN_mp_cmp_mag mp_cmp_mag
#define TclBN_mp_cnt_lsb mp_cnt_lsb
#define TclBN_mp_copy mp_copy
#define TclBN_mp_count_bits mp_count_bits
#define TclBN_mp_div mp_div
#define TclBN_mp_div_2 mp_div_2
#define TclBN_mp_div_2d mp_div_2d
#define TclBN_mp_exch mp_exch
#define TclBN_mp_get_mag_u64 mp_get_mag_u64
#define TclBN_mp_grow mp_grow
#define TclBN_mp_init mp_init
#define TclBN_mp_init_copy mp_init_copy
#define TclBN_mp_init_multi mp_init_multi
#define TclBN_mp_init_size mp_init_size
#define TclBN_mp_init_i64 mp_init_i64
#define TclBN_mp_init_u64 mp_init_u64
#define TclBN_mp_lshd mp_lshd
#define TclBN_mp_mod mp_mod
#define TclBN_mp_mod_2d mp_mod_2d
#define TclBN_mp_mul mp_mul
#define TclBN_mp_mul_2 mp_mul_2
#define TclBN_mp_mul_2d mp_mul_2d
#define TclBN_mp_neg mp_neg
#define TclBN_mp_or mp_or
#define TclBN_mp_radix_size mp_radix_size
#define TclBN_mp_reverse mp_reverse
#define TclBN_mp_read_radix mp_read_radix
#define TclBN_mp_rshd mp_rshd
#define TclBN_mp_set_i64 mp_set_i64
#define TclBN_mp_set_u64 mp_set_u64
#define TclBN_mp_shrink mp_shrink
#define TclBN_mp_sqr mp_sqr
#define TclBN_mp_sqrt mp_sqrt
#define TclBN_mp_sub mp_sub
#define TclBN_mp_signed_rsh mp_signed_rsh
#define TclBN_mp_tc_and TclBN_mp_and
#define TclBN_mp_tc_div_2d mp_signed_rsh
#define TclBN_mp_tc_or TclBN_mp_or
#define TclBN_mp_tc_xor TclBN_mp_xor
#define TclBN_mp_to_radix mp_to_radix
#define TclBN_mp_to_ubin mp_to_ubin
#define TclBN_mp_ubin_size mp_ubin_size
#define TclBN_mp_xor mp_xor
#define TclBN_mp_zero mp_zero
#define TclBN_s_mp_add s_mp_add
#define TclBN_s_mp_balance_mul mp_balance_mul
#define TclBN_mp_karatsuba_mul s_mp_karatsuba_mul
#define TclBN_mp_karatsuba_sqr s_mp_karatsuba_sqr
#define TclBN_s_mp_mul_digs s_mp_mul_digs
#define TclBN_s_mp_mul_digs_fast s_mp_mul_digs_fast
#define TclBN_s_mp_reverse s_mp_reverse
#define TclBN_s_mp_sqr s_mp_sqr
#define TclBN_s_mp_sqr_fast s_mp_sqr_fast
#define TclBN_s_mp_sub s_mp_sub
#define TclBN_mp_toom_mul s_mp_toom_mul
#define TclBN_mp_toom_sqr s_mp_toom_sqr
/* See bug 510001: TclSockMinimumBuffers needs plat imp */
#if defined(_WIN64) || defined(TCL_NO_DEPRECATED) || TCL_MAJOR_VERSION > 8
@@ -81,65 +162,72 @@ static int TclSockMinimumBuffersOld(int sock, int size)
}
#endif
MP_SET_UNSIGNED(mp_set_ull, Tcl_WideUInt)
MP_SET_SIGNED(mp_set_ll, mp_set_ull, Tcl_WideInt, Tcl_WideUInt)
MP_GET_MAG(mp_get_mag_ull, Tcl_WideUInt)
mp_err TclBN_mp_set_int(mp_int *a, unsigned long i)
{
mp_set_ul(a, i);
TclBN_mp_set_u64(a, i);
return MP_OKAY;
}
static mp_err TclBN_mp_set_long(mp_int *a, unsigned long i)
{
mp_set_ul(a, i);
return MP_OKAY;
TclBN_mp_set_u64(a, i);
return MP_OKAY;
}
#define TclBN_mp_set_ul (void (*)(mp_int *a, unsigned long i))TclBN_mp_set_long
#define TclBN_mp_set_ul (void (*)(mp_int *a, unsigned long i))(void *)TclBN_mp_set_long
mp_err MP_WUR TclBN_mp_expt_u32(const mp_int *a, unsigned int b, mp_int *c) {
return TclBN_s_mp_expt_u32(a, b, c);
return mp_expt_u32(a, b, c);
}
mp_err TclBN_mp_add_d(const mp_int *a, unsigned int b, mp_int *c) {
return TclBN_s_mp_add_d(a, b, c);
return mp_add_d(a, b, c);
}
mp_err TclBN_mp_cmp_d(const mp_int *a, unsigned int b) {
return TclBN_s_mp_cmp_d(a, b);
return mp_cmp_d(a, b);
}
mp_err TclBN_mp_sub_d(const mp_int *a, unsigned int b, mp_int *c) {
return TclBN_s_mp_sub_d(a, b, c);
return mp_sub_d(a, b, c);
}
mp_err TclBN_mp_div_d(const mp_int *a, unsigned int b, mp_int *c, unsigned int *d) {
mp_digit d2;
mp_err result = TclBN_s_mp_div_d(a, b, c, (d ? &d2 : NULL));
mp_err result = mp_div_d(a, b, c, (d ? &d2 : NULL));
if (d) {
*d = d2;
}
return result;
}
mp_err TclBN_mp_div_ld(const mp_int *a, uint64_t b, mp_int *c, uint64_t *d) {
mp_err result;
mp_digit d2;
if ((b | (mp_digit)-1) != (mp_digit)-1) {
return MP_VAL;
}
result = mp_div_d(a, b, c, (d ? &d2 : NULL));
if (d) {
*d = d2;
}
return result;
}
mp_err TclBN_mp_init_set(mp_int *a, unsigned int b) {
return TclBN_s_mp_init_set(a, b);
return mp_init_set(a, b);
}
mp_err TclBN_mp_mul_d(const mp_int *a, unsigned int b, mp_int *c) {
return TclBN_s_mp_mul_d(a, b, c);
return mp_mul_d(a, b, c);
}
void TclBN_mp_set(mp_int *a, unsigned int b) {
TclBN_s_mp_set(a, b);
}
#if defined(TCL_NO_DEPRECATED) || TCL_MAJOR_VERSION > 8
# define TclBN_mp_expt_d_ex 0
# define TclBN_mp_to_unsigned_bin 0
# define TclBN_mp_to_unsigned_bin_n 0
# define TclBN_mp_toradix_n 0
# undef TclBN_mp_sqr
# define TclBN_mp_sqr 0
# undef TclBN_mp_div_3
# define TclBN_mp_div_3 0
# define TclBN_mp_init_l 0
# define TclBN_mp_init_ul 0
# define TclBN_mp_set 0
# define TclSetStartupScriptPath 0
# define TclGetStartupScriptPath 0
# define TclSetStartupScriptFileName 0
@@ -170,47 +258,61 @@ void TclBN_mp_set(mp_int *a, unsigned int b) {
#else
mp_err TclBN_mp_div_3(const mp_int *a, mp_int *c, unsigned int *d) {
mp_digit d2;
mp_err result = TclBN_s_mp_div_3(a, c, &d2);
if (d) {
*d = d2;
}
return result;
mp_digit d2;
mp_err result = mp_div_d(a, 3, c, &d2);
if (d) {
*d = d2;
}
return result;
}
int TclBN_mp_expt_d_ex(const mp_int *a, unsigned int b, mp_int *c, int fast)
{
return mp_expt_u32(a, b, c);
return TclBN_mp_expt_u32(a, b, c);
}
mp_err mp_to_unsigned_bin(const mp_int *a, unsigned char *b)
mp_err TclBN_mp_to_unsigned_bin(const mp_int *a, unsigned char *b)
{
return mp_to_ubin(a, b, INT_MAX, NULL);
return TclBN_mp_to_ubin(a, b, INT_MAX, NULL);
}
mp_err mp_to_unsigned_bin_n(const mp_int *a, unsigned char *b, unsigned long *outlen)
mp_err TclBN_mp_to_unsigned_bin_n(const mp_int *a, unsigned char *b, unsigned long *outlen)
{
size_t n = mp_ubin_size(a);
if (*outlen < (unsigned long)n) {
return MP_VAL;
}
*outlen = (unsigned long)n;
return mp_to_ubin(a, b, n, NULL);
size_t n = TclBN_mp_ubin_size(a);
if (*outlen < (unsigned long)n) {
return MP_VAL;
}
*outlen = (unsigned long)n;
return TclBN_mp_to_ubin(a, b, n, NULL);
}
void bn_reverse(unsigned char *s, int len)
void TclBN_reverse(unsigned char *s, int len)
{
if (len > 0) {
s_mp_reverse(s, (size_t)len);
}
if (len > 0) {
TclBN_s_mp_reverse(s, (size_t)len);
}
}
mp_err mp_toradix_n(const mp_int *a, char *str, int radix, int maxlen)
mp_err TclBN_mp_init_ul(mp_int *a, unsigned long b)
{
if (maxlen < 0) {
return MP_VAL;
}
return mp_to_radix(a, str, (size_t)maxlen, NULL, radix);
return TclBN_mp_init_u64(a,b);
}
mp_err TclBN_mp_init_l(mp_int *a, long b)
{
return TclBN_mp_init_i64(a,b);
}
void TclBN_mp_set(mp_int *a, unsigned int b) {
TclBN_mp_set_u64(a, b);
}
mp_err TclBN_mp_toradix_n(const mp_int *a, char *str, int radix, int maxlen)
{
if (maxlen < 0) {
return MP_VAL;
}
return TclBN_mp_to_radix(a, str, (size_t)maxlen, NULL, radix);
}
#define TclSetStartupScriptPath setStartupScriptPath
@@ -291,7 +393,7 @@ void *TclWinGetTclInstance()
{
void *hInstance = NULL;
GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
(const char *)&TclpIsAtty, &hInstance);
(const wchar_t *)&TclpIsAtty, &hInstance);
return hInstance;
}
@@ -401,22 +503,24 @@ static int exprIntObj(Tcl_Interp *interp, Tcl_Obj*expr, int *ptr){
return result;
}
#define Tcl_ExprLongObj (int(*)(Tcl_Interp*,Tcl_Obj*,long*))exprIntObj
#if TCL_UTF_MAX < 4
static int uniCharNcmp(const Tcl_UniChar *ucs, const Tcl_UniChar *uct, unsigned int n){
return Tcl_UniCharNcmp(ucs, uct, (unsigned long)n);
}
#define Tcl_UniCharNcmp (int(*)(const Tcl_UniChar*,const Tcl_UniChar*,unsigned long))uniCharNcmp
static int utfNcmp(const char *s1, const char *s2, unsigned int n){
return Tcl_UtfNcmp(s1, s2, (unsigned long)n);
}
#define Tcl_UtfNcmp (int(*)(const char*,const char*,unsigned long))utfNcmp
static int utfNcasecmp(const char *s1, const char *s2, unsigned int n){
return Tcl_UtfNcasecmp(s1, s2, (unsigned long)n);
}
#define Tcl_UtfNcasecmp (int(*)(const char*,const char*,unsigned long))utfNcasecmp
#define Tcl_UniCharNcmp (int(*)(const Tcl_UniChar*,const Tcl_UniChar*,unsigned long))(void *)uniCharNcmp
static int uniCharNcasecmp(const Tcl_UniChar *ucs, const Tcl_UniChar *uct, unsigned int n){
return Tcl_UniCharNcasecmp(ucs, uct, (unsigned long)n);
}
#define Tcl_UniCharNcasecmp (int(*)(const Tcl_UniChar*,const Tcl_UniChar*,unsigned long))uniCharNcasecmp
#endif
static int utfNcmp(const char *s1, const char *s2, unsigned int n){
return Tcl_UtfNcmp(s1, s2, (unsigned long)n);
}
#define Tcl_UtfNcmp (int(*)(const char*,const char*,unsigned long))(void *)utfNcmp
static int utfNcasecmp(const char *s1, const char *s2, unsigned int n){
return Tcl_UtfNcasecmp(s1, s2, (unsigned long)n);
}
#define Tcl_UtfNcasecmp (int(*)(const char*,const char*,unsigned long))(void *)utfNcasecmp
#endif /* TCL_WIDE_INT_IS_LONG */
@@ -512,18 +616,35 @@ static int uniCharNcasecmp(const Tcl_UniChar *ucs, const Tcl_UniChar *uct, unsig
# define Tcl_SetPanicProc 0
# define Tcl_FindExecutable 0
# define Tcl_GetUnicode 0
#if TCL_UTF_MAX < 4
# define Tcl_AppendUnicodeToObj 0
# define Tcl_UniCharCaseMatch 0
# define Tcl_UniCharLen 0
# define Tcl_UniCharNcasecmp 0
# define Tcl_UniCharNcmp 0
#endif
# undef Tcl_StringMatch
# define Tcl_StringMatch 0
# define TclBN_reverse 0
# undef TclBN_s_mp_mul_digs_fast
# define TclBN_s_mp_mul_digs_fast 0
# undef TclBN_s_mp_sqr_fast
# define TclBN_s_mp_sqr_fast 0
# undef TclBN_mp_karatsuba_mul
# define TclBN_mp_karatsuba_mul 0
# undef TclBN_mp_karatsuba_sqr
# define TclBN_mp_karatsuba_sqr 0
# undef TclBN_mp_toom_mul
# define TclBN_mp_toom_mul 0
# undef TclBN_mp_toom_sqr
# define TclBN_mp_toom_sqr 0
# undef TclBN_s_mp_add
# define TclBN_s_mp_add 0
# undef TclBN_s_mp_mul_digs
# define TclBN_s_mp_mul_digs 0
# undef TclBN_s_mp_sqr
# define TclBN_s_mp_sqr 0
# undef TclBN_s_mp_sub
# define TclBN_s_mp_sub 0
#else /* TCL_NO_DEPRECATED */
# define Tcl_SeekOld seekOld
@@ -1037,22 +1158,22 @@ const TclTomMathStubs tclTomMathStubs = {
TclBN_mp_init_ul, /* 61 */
TclBN_mp_set_ul, /* 62 */
TclBN_mp_cnt_lsb, /* 63 */
TclBNInitBignumFromLong, /* 64 */
TclBNInitBignumFromWideInt, /* 65 */
TclBNInitBignumFromWideUInt, /* 66 */
TclBN_mp_init_l, /* 64 */
TclBN_mp_init_i64, /* 65 */
TclBN_mp_init_u64, /* 66 */
TclBN_mp_expt_d_ex, /* 67 */
TclBN_mp_set_ull, /* 68 */
TclBN_mp_get_mag_ull, /* 69 */
TclBN_mp_set_ll, /* 70 */
TclBN_mp_get_mag_ul, /* 71 */
TclBN_mp_set_l, /* 72 */
TclBN_mp_set_u64, /* 68 */
TclBN_mp_get_mag_u64, /* 69 */
TclBN_mp_set_i64, /* 70 */
0, /* 71 */
0, /* 72 */
TclBN_mp_tc_and, /* 73 */
TclBN_mp_tc_or, /* 74 */
TclBN_mp_tc_xor, /* 75 */
TclBN_mp_signed_rsh, /* 76 */
0, /* 77 */
TclBN_mp_to_ubin, /* 78 */
0, /* 79 */
TclBN_mp_div_ld, /* 79 */
TclBN_mp_to_radix, /* 80 */
};
+15 -14
View File
@@ -20,6 +20,7 @@
# define USE_TCL_STUBS
#endif
#include "tclInt.h"
#include "tclTomMath.h"
#include "tclOO.h"
#include <math.h>
@@ -2921,7 +2922,7 @@ TestlinkCmd(
return TCL_ERROR;
}
flag = (writable != 0) ? 0 : TCL_LINK_READ_ONLY;
if (Tcl_LinkVar(interp, "int", (char *) &intVar,
if (Tcl_LinkVar(interp, "int", &intVar,
TCL_LINK_INT | flag) != TCL_OK) {
return TCL_ERROR;
}
@@ -2929,7 +2930,7 @@ TestlinkCmd(
return TCL_ERROR;
}
flag = (writable != 0) ? 0 : TCL_LINK_READ_ONLY;
if (Tcl_LinkVar(interp, "real", (char *) &realVar,
if (Tcl_LinkVar(interp, "real", &realVar,
TCL_LINK_DOUBLE | flag) != TCL_OK) {
return TCL_ERROR;
}
@@ -2937,7 +2938,7 @@ TestlinkCmd(
return TCL_ERROR;
}
flag = (writable != 0) ? 0 : TCL_LINK_READ_ONLY;
if (Tcl_LinkVar(interp, "bool", (char *) &boolVar,
if (Tcl_LinkVar(interp, "bool", &boolVar,
TCL_LINK_BOOLEAN | flag) != TCL_OK) {
return TCL_ERROR;
}
@@ -2945,7 +2946,7 @@ TestlinkCmd(
return TCL_ERROR;
}
flag = (writable != 0) ? 0 : TCL_LINK_READ_ONLY;
if (Tcl_LinkVar(interp, "string", (char *) &stringVar,
if (Tcl_LinkVar(interp, "string", &stringVar,
TCL_LINK_STRING | flag) != TCL_OK) {
return TCL_ERROR;
}
@@ -2953,7 +2954,7 @@ TestlinkCmd(
return TCL_ERROR;
}
flag = (writable != 0) ? 0 : TCL_LINK_READ_ONLY;
if (Tcl_LinkVar(interp, "wide", (char *) &wideVar,
if (Tcl_LinkVar(interp, "wide", &wideVar,
TCL_LINK_WIDE_INT | flag) != TCL_OK) {
return TCL_ERROR;
}
@@ -2961,7 +2962,7 @@ TestlinkCmd(
return TCL_ERROR;
}
flag = (writable != 0) ? 0 : TCL_LINK_READ_ONLY;
if (Tcl_LinkVar(interp, "char", (char *) &charVar,
if (Tcl_LinkVar(interp, "char", &charVar,
TCL_LINK_CHAR | flag) != TCL_OK) {
return TCL_ERROR;
}
@@ -2969,7 +2970,7 @@ TestlinkCmd(
return TCL_ERROR;
}
flag = (writable != 0) ? 0 : TCL_LINK_READ_ONLY;
if (Tcl_LinkVar(interp, "uchar", (char *) &ucharVar,
if (Tcl_LinkVar(interp, "uchar", &ucharVar,
TCL_LINK_UCHAR | flag) != TCL_OK) {
return TCL_ERROR;
}
@@ -2977,7 +2978,7 @@ TestlinkCmd(
return TCL_ERROR;
}
flag = (writable != 0) ? 0 : TCL_LINK_READ_ONLY;
if (Tcl_LinkVar(interp, "short", (char *) &shortVar,
if (Tcl_LinkVar(interp, "short", &shortVar,
TCL_LINK_SHORT | flag) != TCL_OK) {
return TCL_ERROR;
}
@@ -2985,7 +2986,7 @@ TestlinkCmd(
return TCL_ERROR;
}
flag = (writable != 0) ? 0 : TCL_LINK_READ_ONLY;
if (Tcl_LinkVar(interp, "ushort", (char *) &ushortVar,
if (Tcl_LinkVar(interp, "ushort", &ushortVar,
TCL_LINK_USHORT | flag) != TCL_OK) {
return TCL_ERROR;
}
@@ -2993,7 +2994,7 @@ TestlinkCmd(
return TCL_ERROR;
}
flag = (writable != 0) ? 0 : TCL_LINK_READ_ONLY;
if (Tcl_LinkVar(interp, "uint", (char *) &uintVar,
if (Tcl_LinkVar(interp, "uint", &uintVar,
TCL_LINK_UINT | flag) != TCL_OK) {
return TCL_ERROR;
}
@@ -3001,7 +3002,7 @@ TestlinkCmd(
return TCL_ERROR;
}
flag = (writable != 0) ? 0 : TCL_LINK_READ_ONLY;
if (Tcl_LinkVar(interp, "long", (char *) &longVar,
if (Tcl_LinkVar(interp, "long", &longVar,
TCL_LINK_LONG | flag) != TCL_OK) {
return TCL_ERROR;
}
@@ -3009,7 +3010,7 @@ TestlinkCmd(
return TCL_ERROR;
}
flag = (writable != 0) ? 0 : TCL_LINK_READ_ONLY;
if (Tcl_LinkVar(interp, "ulong", (char *) &ulongVar,
if (Tcl_LinkVar(interp, "ulong", &ulongVar,
TCL_LINK_ULONG | flag) != TCL_OK) {
return TCL_ERROR;
}
@@ -3017,7 +3018,7 @@ TestlinkCmd(
return TCL_ERROR;
}
flag = (writable != 0) ? 0 : TCL_LINK_READ_ONLY;
if (Tcl_LinkVar(interp, "float", (char *) &floatVar,
if (Tcl_LinkVar(interp, "float", &floatVar,
TCL_LINK_FLOAT | flag) != TCL_OK) {
return TCL_ERROR;
}
@@ -3025,7 +3026,7 @@ TestlinkCmd(
return TCL_ERROR;
}
flag = (writable != 0) ? 0 : TCL_LINK_READ_ONLY;
if (Tcl_LinkVar(interp, "uwide", (char *) &uwideVar,
if (Tcl_LinkVar(interp, "uwide", &uwideVar,
TCL_LINK_WIDE_UINT | flag) != TCL_OK) {
return TCL_ERROR;
}
+5 -1
View File
@@ -18,7 +18,11 @@
# define USE_TCL_STUBS
#endif
#include "tclInt.h"
#include "tommath.h"
#ifdef TCL_WITH_EXTERNAL_TOMMATH
# include "tommath.h"
#else
# include "tclTomMath.h"
#endif
#include "tclStringRep.h"
+1 -1
View File
@@ -892,7 +892,7 @@ Tcl_AfterObjCmd(
if (objc == 3) {
commandPtr = objv[2];
} else {
commandPtr = Tcl_ConcatObj(objc-2, objv+2);;
commandPtr = Tcl_ConcatObj(objc-2, objv+2);
}
command = TclGetStringFromObj(commandPtr, &length);
for (afterPtr = assocPtr->firstAfterPtr; afterPtr != NULL;
+20 -26
View File
@@ -140,7 +140,7 @@ declare 37 {
declare 38 {
mp_err MP_WUR TclBN_mp_shrink(mp_int *a)
}
declare 39 {
declare 39 {deprecated {macro calling mp_set_u64}} {
void TclBN_mp_set(mp_int *a, unsigned int b)
}
declare 40 {nostub {is private function in libtommath}} {
@@ -211,26 +211,23 @@ declare 59 {deprecated {is private function in libtommath}} {
declare 60 {deprecated {is private function in libtommath}} {
mp_err TclBN_s_mp_sub(const mp_int *a, const mp_int *b, mp_int *c)
}
declare 61 {
mp_err MP_WUR TclBN_mp_init_ul(mp_int *a, unsigned long i)
declare 61 {deprecated {macro calling mp_init_u64}} {
mp_err TclBN_mp_init_ul(mp_int *a, unsigned long i)
}
declare 62 {
declare 62 {deprecated {macro calling mp_set_u64}} {
void TclBN_mp_set_ul(mp_int *a, unsigned long i)
}
declare 63 {
int MP_WUR TclBN_mp_cnt_lsb(const mp_int *a)
}
# Formerly internal API to allow initialisation of bignums without knowing the
# typedefs of how a bignum works internally.
declare 64 {
int TclBNInitBignumFromLong(mp_int *bignum, long initVal)
declare 64 {deprecated {macro calling mp_init_i64}} {
int TclBN_mp_init_l(mp_int *bignum, long initVal)
}
declare 65 {
int TclBNInitBignumFromWideInt(mp_int *bignum, Tcl_WideInt initVal)
int MP_WUR TclBN_mp_init_i64(mp_int *bignum, int64_t initVal)
}
declare 66 {
int TclBNInitBignumFromWideUInt(mp_int *bignum, Tcl_WideUInt initVal)
int MP_WUR TclBN_mp_init_u64(mp_int *bignum, uint64_t initVal)
}
# Added in libtommath 1.0
@@ -239,30 +236,24 @@ declare 67 {deprecated {Use mp_expt_u32}} {
}
# Added in libtommath 1.0.1
declare 68 {
void TclBN_mp_set_ull(mp_int *a, Tcl_WideUInt i)
void TclBN_mp_set_u64(mp_int *a, uint64_t i)
}
declare 69 {
Tcl_WideUInt MP_WUR TclBN_mp_get_mag_ull(const mp_int *a)
uint64_t MP_WUR TclBN_mp_get_mag_u64(const mp_int *a)
}
declare 70 {
void TclBN_mp_set_ll(mp_int *a, Tcl_WideInt i)
}
declare 71 {
unsigned long MP_WUR TclBN_mp_get_mag_ul(const mp_int *a)
}
declare 72 {
void TclBN_mp_set_l(mp_int *a, long i)
void TclBN_mp_set_i64(mp_int *a, int64_t i)
}
# Added in libtommath 1.1.0
declare 73 {
mp_err MP_WUR TclBN_mp_tc_and(const mp_int *a, const mp_int *b, mp_int *c)
declare 73 {deprecated {merged with mp_and}} {
mp_err TclBN_mp_tc_and(const mp_int *a, const mp_int *b, mp_int *c)
}
declare 74 {
mp_err MP_WUR TclBN_mp_tc_or(const mp_int *a, const mp_int *b, mp_int *c)
declare 74 {deprecated {merged with mp_or}} {
mp_err TclBN_mp_tc_or(const mp_int *a, const mp_int *b, mp_int *c)
}
declare 75 {
mp_err MP_WUR TclBN_mp_tc_xor(const mp_int *a, const mp_int *b, mp_int *c)
declare 75 {deprecated {merged with mp_xor}} {
mp_err TclBN_mp_tc_xor(const mp_int *a, const mp_int *b, mp_int *c)
}
declare 76 {
mp_err MP_WUR TclBN_mp_signed_rsh(const mp_int *a, int b, mp_int *c)
@@ -272,6 +263,9 @@ declare 76 {
declare 78 {
int MP_WUR TclBN_mp_to_ubin(const mp_int *a, unsigned char *buf, size_t maxlen, size_t *written)
}
declare 79 {
mp_err MP_WUR TclBN_mp_div_ld(const mp_int *a, uint64_t b, mp_int *q, uint64_t *r)
}
declare 80 {
int MP_WUR TclBN_mp_to_radix(const mp_int *a, char *str, size_t maxlen, size_t *written, int radix)
}
+6 -1082
View File
File diff suppressed because it is too large Load Diff
+150 -111
View File
@@ -16,6 +16,7 @@
#define _TCLTOMMATHDECLS
#include "tcl.h"
#include <string.h>
#ifndef BN_H_
#include "tclTomMath.h"
#endif
@@ -42,59 +43,70 @@
/* MODULE_SCOPE void TclBNFree( void* ); */
#define TclBNFree(x) (ckfree((char*)(x)))
#undef MP_MALLOC
#undef MP_CALLOC
#undef MP_REALLOC
#undef MP_FREE
#define MP_MALLOC(size) TclBNAlloc(size)
#define MP_CALLOC(nmemb, size) TclBNCalloc(nmemb, size)
#define MP_REALLOC(mem, oldsize, newsize) TclBNRealloc(mem, newsize)
#define MP_FREE(mem, size) TclBNFree(mem)
#ifndef MODULE_SCOPE
# define MODULE_SCOPE extern
#endif
MODULE_SCOPE void TclBN_s_mp_reverse(unsigned char *s, size_t len);
MODULE_SCOPE mp_err TclBN_s_mp_add_d(const mp_int *a, mp_digit b, mp_int *c);
MODULE_SCOPE mp_ord TclBN_s_mp_cmp_d(const mp_int *a, mp_digit b);
MODULE_SCOPE mp_err TclBN_s_mp_sub_d(const mp_int *a, mp_digit b, mp_int *c);
MODULE_SCOPE mp_err TclBN_s_mp_div_d(const mp_int *a, mp_digit b, mp_int *c, mp_digit *d);
MODULE_SCOPE mp_err TclBN_s_mp_div_3(const mp_int *a, mp_int *c, mp_digit *d);
MODULE_SCOPE mp_err TclBN_s_mp_init_set(mp_int *a, mp_digit b);
MODULE_SCOPE mp_err TclBN_s_mp_div_3(const mp_int *a, mp_int *c, mp_digit *b);
MODULE_SCOPE mp_err TclBN_s_mp_expt_u32(const mp_int *a, uint32_t b, mp_int *c);
MODULE_SCOPE mp_err TclBN_s_mp_init_set(mp_int *a, mp_digit b);
MODULE_SCOPE mp_err TclBN_s_mp_mul_d(const mp_int *a, mp_digit b, mp_int *c);
MODULE_SCOPE void TclBN_s_mp_reverse(unsigned char *s, size_t len);
MODULE_SCOPE void TclBN_s_mp_set(mp_int *a, mp_digit b);
MODULE_SCOPE mp_err TclBN_s_mp_expt_u32(const mp_int *a, unsigned int b, mp_int *c);
MODULE_SCOPE mp_err TclBN_s_mp_sub_d(const mp_int *a, mp_digit b, mp_int *c);
/* Rename the global symbols in libtommath to avoid linkage conflicts */
#ifndef TCL_WITH_EXTERNAL_TOMMATH
#define bn_reverse TclBN_reverse
#define mp_add TclBN_mp_add
#define mp_add_d TclBN_s_mp_add_d
#define mp_and TclBN_mp_and
#define mp_clamp TclBN_mp_clamp
#define mp_clear TclBN_mp_clear
#define mp_clear_multi TclBN_mp_clear_multi
#define mp_cmp TclBN_mp_cmp
#define mp_cmp_d TclBN_s_mp_cmp_d
#define mp_cmp_mag TclBN_mp_cmp_mag
#define mp_cnt_lsb TclBN_mp_cnt_lsb
#define mp_copy TclBN_mp_copy
#define mp_count_bits TclBN_mp_count_bits
#define mp_div TclBN_mp_div
#define mp_div_d TclBN_s_mp_div_d
#define mp_div_2 TclBN_mp_div_2
#define mp_div_3 TclBN_s_mp_div_3
#define mp_div_2d TclBN_mp_div_2d
#define mp_exch TclBN_mp_exch
#define mp_expt_d TclBN_mp_expt_u32
#define mp_expt_d TclBN_mp_expt_d
#define mp_expt_d_ex TclBN_mp_expt_d_ex
#define mp_get_mag_ul TclBN_mp_get_mag_ul
#define mp_get_mag_ull TclBN_mp_get_mag_ull
#define mp_expt_u32 TclBN_s_mp_expt_u32
#define mp_get_mag_u64 TclBN_mp_get_mag_u64
#define mp_grow TclBN_mp_grow
#define mp_init TclBN_mp_init
#define mp_init_copy TclBN_mp_init_copy
#define mp_init_l TclBNInitBignumFromLong
#define mp_init_ll TclBNInitBignumFromWideInt
#define mp_init_i64 TclBN_mp_init_i64
#define mp_init_multi TclBN_mp_init_multi
#define mp_init_set_int(a,i) (MP_DEPRECATED_PRAGMA("replaced by mp_init_ul") TclBN_mp_init_ul(a,(unsigned int)(i)))
#define mp_init_set TclBN_s_mp_init_set
#define mp_init_size TclBN_mp_init_size
#define mp_init_ul TclBN_mp_init_ul
#define mp_init_ull TclBNInitBignumFromWideUInt
#define mp_init_u64 TclBN_mp_init_u64
#define mp_lshd TclBN_mp_lshd
#define mp_mod TclBN_mp_mod
#define mp_mod_2d TclBN_mp_mod_2d
#define mp_mul TclBN_mp_mul
#define mp_mul_d TclBN_s_mp_mul_d
#define mp_mul_2 TclBN_mp_mul_2
#define mp_mul_2d TclBN_mp_mul_2d
#define mp_neg TclBN_mp_neg
@@ -102,16 +114,17 @@ MODULE_SCOPE mp_err TclBN_s_mp_expt_u32(const mp_int *a, unsigned int b, mp_int
#define mp_radix_size TclBN_mp_radix_size
#define mp_read_radix TclBN_mp_read_radix
#define mp_rshd TclBN_mp_rshd
#define mp_set_int(a,b) (MP_DEPRECATED_PRAGMA("replaced by mp_set_ul") (TclBN_mp_set_ul((a),((unsigned int)(b))),MP_OKAY))
#define mp_set_l TclBN_mp_set_l
#define mp_set_ll TclBN_mp_set_ll
#define mp_set_long(a,b) (MP_DEPRECATED_PRAGMA("replaced by mp_set_ul") (TclBN_mp_set_ul((a),(b)),MP_OKAY))
#define mp_set_long_long(a,b) (MP_DEPRECATED_PRAGMA("replaced by mp_set_ull") (TclBN_mp_set_ull((a),(b)),MP_OKAY))
#define mp_set_ul TclBN_mp_set_ul
#define mp_set_ull TclBN_mp_set_ull
#define mp_s_rmap TclBN_mp_s_rmap
#define mp_s_rmap_reverse TclBN_mp_s_rmap_reverse
#define mp_s_rmap_reverse_sz TclBN_mp_s_rmap_reverse_sz
#define mp_set TclBN_s_mp_set
#define mp_set_i64 TclBN_mp_set_i64
#define mp_set_u64 TclBN_mp_set_u64
#define mp_shrink TclBN_mp_shrink
#define mp_sqr TclBN_mp_sqr
#define mp_sqrt TclBN_mp_sqrt
#define mp_sub TclBN_mp_sub
#define mp_sub_d TclBN_s_mp_sub_d
#define mp_signed_rsh TclBN_mp_signed_rsh
#define mp_tc_and TclBN_mp_and
#define mp_tc_div_2d TclBN_mp_signed_rsh
@@ -123,7 +136,6 @@ MODULE_SCOPE mp_err TclBN_s_mp_expt_u32(const mp_int *a, unsigned int b, mp_int
#define mp_to_radix TclBN_mp_to_radix
#define mp_to_ubin TclBN_mp_to_ubin
#define mp_ubin_size TclBN_mp_ubin_size
#define mp_unsigned_bin_size(mp) (MP_DEPRECATED_PRAGMA("replaced by mp_ubin_size") (int)TclBN_mp_ubin_size(mp))
#define mp_xor TclBN_mp_xor
#define mp_zero TclBN_mp_zero
#define s_mp_add TclBN_s_mp_add
@@ -138,6 +150,13 @@ MODULE_SCOPE mp_err TclBN_s_mp_expt_u32(const mp_int *a, unsigned int b, mp_int
#define s_mp_sub TclBN_s_mp_sub
#define s_mp_toom_mul TclBN_mp_toom_mul
#define s_mp_toom_sqr TclBN_mp_toom_sqr
#endif /* !TCL_WITH_EXTERNAL_TOMMATH */
#define mp_init_set_int(a,b) (MP_DEPRECATED_PRAGMA("replaced by mp_init_ul") TclBN_mp_init_u64(a,(unsigned int)(b)))
#define mp_set_int(a,b) (MP_DEPRECATED_PRAGMA("replaced by mp_set_ul") (TclBN_mp_set_u64((a),((unsigned int)(b))),MP_OKAY))
#define mp_set_long(a,b) (MP_DEPRECATED_PRAGMA("replaced by mp_set_ul") (TclBN_mp_set_u64((a),(long)(b)),MP_OKAY))
#define mp_set_long_long(a,b) (MP_DEPRECATED_PRAGMA("replaced by mp_set_u64") (TclBN_mp_set_u64((a),(b)),MP_OKAY))
#define mp_unsigned_bin_size(mp) (MP_DEPRECATED_PRAGMA("replaced by mp_ubin_size") (int)TclBN_mp_ubin_size(mp))
#undef TCL_STORAGE_CLASS
#ifdef BUILD_tcl
@@ -260,7 +279,8 @@ EXTERN void TclBN_mp_rshd(mp_int *a, int shift);
/* 38 */
EXTERN mp_err TclBN_mp_shrink(mp_int *a) MP_WUR;
/* 39 */
EXTERN void TclBN_mp_set(mp_int *a, unsigned int b);
TCL_DEPRECATED("macro calling mp_set_u64")
void TclBN_mp_set(mp_int *a, unsigned int b);
/* 40 */
EXTERN mp_err TclBN_mp_sqr(const mp_int *a, mp_int *b);
/* 41 */
@@ -330,42 +350,44 @@ TCL_DEPRECATED("is private function in libtommath")
mp_err TclBN_s_mp_sub(const mp_int *a, const mp_int *b,
mp_int *c);
/* 61 */
EXTERN mp_err TclBN_mp_init_ul(mp_int *a, unsigned long i) MP_WUR;
TCL_DEPRECATED("macro calling mp_init_u64")
mp_err TclBN_mp_init_ul(mp_int *a, unsigned long i);
/* 62 */
EXTERN void TclBN_mp_set_ul(mp_int *a, unsigned long i);
TCL_DEPRECATED("macro calling mp_set_u64")
void TclBN_mp_set_ul(mp_int *a, unsigned long i);
/* 63 */
EXTERN int TclBN_mp_cnt_lsb(const mp_int *a) MP_WUR;
/* 64 */
EXTERN int TclBNInitBignumFromLong(mp_int *bignum, long initVal);
TCL_DEPRECATED("macro calling mp_init_i64")
int TclBN_mp_init_l(mp_int *bignum, long initVal);
/* 65 */
EXTERN int TclBNInitBignumFromWideInt(mp_int *bignum,
Tcl_WideInt initVal);
EXTERN int TclBN_mp_init_i64(mp_int *bignum, int64_t initVal) MP_WUR;
/* 66 */
EXTERN int TclBNInitBignumFromWideUInt(mp_int *bignum,
Tcl_WideUInt initVal);
EXTERN int TclBN_mp_init_u64(mp_int *bignum, uint64_t initVal) MP_WUR;
/* 67 */
TCL_DEPRECATED("Use mp_expt_u32")
mp_err TclBN_mp_expt_d_ex(const mp_int *a, unsigned int b,
mp_int *c, int fast);
/* 68 */
EXTERN void TclBN_mp_set_ull(mp_int *a, Tcl_WideUInt i);
EXTERN void TclBN_mp_set_u64(mp_int *a, uint64_t i);
/* 69 */
EXTERN Tcl_WideUInt TclBN_mp_get_mag_ull(const mp_int *a) MP_WUR;
EXTERN uint64_t TclBN_mp_get_mag_u64(const mp_int *a) MP_WUR;
/* 70 */
EXTERN void TclBN_mp_set_ll(mp_int *a, Tcl_WideInt i);
/* 71 */
EXTERN unsigned long TclBN_mp_get_mag_ul(const mp_int *a) MP_WUR;
/* 72 */
EXTERN void TclBN_mp_set_l(mp_int *a, long i);
EXTERN void TclBN_mp_set_i64(mp_int *a, int64_t i);
/* Slot 71 is reserved */
/* Slot 72 is reserved */
/* 73 */
EXTERN mp_err TclBN_mp_tc_and(const mp_int *a, const mp_int *b,
mp_int *c) MP_WUR;
TCL_DEPRECATED("merged with mp_and")
mp_err TclBN_mp_tc_and(const mp_int *a, const mp_int *b,
mp_int *c);
/* 74 */
EXTERN mp_err TclBN_mp_tc_or(const mp_int *a, const mp_int *b,
mp_int *c) MP_WUR;
TCL_DEPRECATED("merged with mp_or")
mp_err TclBN_mp_tc_or(const mp_int *a, const mp_int *b,
mp_int *c);
/* 75 */
EXTERN mp_err TclBN_mp_tc_xor(const mp_int *a, const mp_int *b,
mp_int *c) MP_WUR;
TCL_DEPRECATED("merged with mp_xor")
mp_err TclBN_mp_tc_xor(const mp_int *a, const mp_int *b,
mp_int *c);
/* 76 */
EXTERN mp_err TclBN_mp_signed_rsh(const mp_int *a, int b,
mp_int *c) MP_WUR;
@@ -373,7 +395,9 @@ EXTERN mp_err TclBN_mp_signed_rsh(const mp_int *a, int b,
/* 78 */
EXTERN int TclBN_mp_to_ubin(const mp_int *a, unsigned char *buf,
size_t maxlen, size_t *written) MP_WUR;
/* Slot 79 is reserved */
/* 79 */
EXTERN mp_err TclBN_mp_div_ld(const mp_int *a, uint64_t b,
mp_int *q, uint64_t *r) MP_WUR;
/* 80 */
EXTERN int TclBN_mp_to_radix(const mp_int *a, char *str,
size_t maxlen, size_t *written, int radix) MP_WUR;
@@ -421,7 +445,7 @@ typedef struct TclTomMathStubs {
mp_err (*tclBN_mp_read_radix) (mp_int *a, const char *str, int radix) MP_WUR; /* 36 */
void (*tclBN_mp_rshd) (mp_int *a, int shift); /* 37 */
mp_err (*tclBN_mp_shrink) (mp_int *a) MP_WUR; /* 38 */
void (*tclBN_mp_set) (mp_int *a, unsigned int b); /* 39 */
TCL_DEPRECATED_API("macro calling mp_set_u64") void (*tclBN_mp_set) (mp_int *a, unsigned int b); /* 39 */
TCL_DEPRECATED_API("is private function in libtommath") mp_err (*tclBN_mp_sqr) (const mp_int *a, mp_int *b); /* 40 */
mp_err (*tclBN_mp_sqrt) (const mp_int *a, mp_int *b) MP_WUR; /* 41 */
mp_err (*tclBN_mp_sub) (const mp_int *a, const mp_int *b, mp_int *c) MP_WUR; /* 42 */
@@ -443,25 +467,25 @@ typedef struct TclTomMathStubs {
TCL_DEPRECATED_API("is private function in libtommath") mp_err (*tclBN_s_mp_mul_digs) (const mp_int *a, const mp_int *b, mp_int *c, int digs); /* 58 */
TCL_DEPRECATED_API("is private function in libtommath") mp_err (*tclBN_s_mp_sqr) (const mp_int *a, mp_int *b); /* 59 */
TCL_DEPRECATED_API("is private function in libtommath") mp_err (*tclBN_s_mp_sub) (const mp_int *a, const mp_int *b, mp_int *c); /* 60 */
mp_err (*tclBN_mp_init_ul) (mp_int *a, unsigned long i) MP_WUR; /* 61 */
void (*tclBN_mp_set_ul) (mp_int *a, unsigned long i); /* 62 */
TCL_DEPRECATED_API("macro calling mp_init_u64") mp_err (*tclBN_mp_init_ul) (mp_int *a, unsigned long i); /* 61 */
TCL_DEPRECATED_API("macro calling mp_set_u64") void (*tclBN_mp_set_ul) (mp_int *a, unsigned long i); /* 62 */
int (*tclBN_mp_cnt_lsb) (const mp_int *a) MP_WUR; /* 63 */
int (*tclBNInitBignumFromLong) (mp_int *bignum, long initVal); /* 64 */
int (*tclBNInitBignumFromWideInt) (mp_int *bignum, Tcl_WideInt initVal); /* 65 */
int (*tclBNInitBignumFromWideUInt) (mp_int *bignum, Tcl_WideUInt initVal); /* 66 */
TCL_DEPRECATED_API("macro calling mp_init_i64") int (*tclBN_mp_init_l) (mp_int *bignum, long initVal); /* 64 */
int (*tclBN_mp_init_i64) (mp_int *bignum, int64_t initVal) MP_WUR; /* 65 */
int (*tclBN_mp_init_u64) (mp_int *bignum, uint64_t initVal) MP_WUR; /* 66 */
TCL_DEPRECATED_API("Use mp_expt_u32") mp_err (*tclBN_mp_expt_d_ex) (const mp_int *a, unsigned int b, mp_int *c, int fast); /* 67 */
void (*tclBN_mp_set_ull) (mp_int *a, Tcl_WideUInt i); /* 68 */
Tcl_WideUInt (*tclBN_mp_get_mag_ull) (const mp_int *a) MP_WUR; /* 69 */
void (*tclBN_mp_set_ll) (mp_int *a, Tcl_WideInt i); /* 70 */
unsigned long (*tclBN_mp_get_mag_ul) (const mp_int *a) MP_WUR; /* 71 */
void (*tclBN_mp_set_l) (mp_int *a, long i); /* 72 */
mp_err (*tclBN_mp_tc_and) (const mp_int *a, const mp_int *b, mp_int *c) MP_WUR; /* 73 */
mp_err (*tclBN_mp_tc_or) (const mp_int *a, const mp_int *b, mp_int *c) MP_WUR; /* 74 */
mp_err (*tclBN_mp_tc_xor) (const mp_int *a, const mp_int *b, mp_int *c) MP_WUR; /* 75 */
void (*tclBN_mp_set_u64) (mp_int *a, uint64_t i); /* 68 */
uint64_t (*tclBN_mp_get_mag_u64) (const mp_int *a) MP_WUR; /* 69 */
void (*tclBN_mp_set_i64) (mp_int *a, int64_t i); /* 70 */
void (*reserved71)(void);
void (*reserved72)(void);
TCL_DEPRECATED_API("merged with mp_and") mp_err (*tclBN_mp_tc_and) (const mp_int *a, const mp_int *b, mp_int *c); /* 73 */
TCL_DEPRECATED_API("merged with mp_or") mp_err (*tclBN_mp_tc_or) (const mp_int *a, const mp_int *b, mp_int *c); /* 74 */
TCL_DEPRECATED_API("merged with mp_xor") mp_err (*tclBN_mp_tc_xor) (const mp_int *a, const mp_int *b, mp_int *c); /* 75 */
mp_err (*tclBN_mp_signed_rsh) (const mp_int *a, int b, mp_int *c) MP_WUR; /* 76 */
void (*reserved77)(void);
int (*tclBN_mp_to_ubin) (const mp_int *a, unsigned char *buf, size_t maxlen, size_t *written) MP_WUR; /* 78 */
void (*reserved79)(void);
mp_err (*tclBN_mp_div_ld) (const mp_int *a, uint64_t b, mp_int *q, uint64_t *r) MP_WUR; /* 79 */
int (*tclBN_mp_to_radix) (const mp_int *a, char *str, size_t maxlen, size_t *written, int radix) MP_WUR; /* 80 */
} TclTomMathStubs;
@@ -605,24 +629,22 @@ extern const TclTomMathStubs *tclTomMathStubsPtr;
(tclTomMathStubsPtr->tclBN_mp_set_ul) /* 62 */
#define TclBN_mp_cnt_lsb \
(tclTomMathStubsPtr->tclBN_mp_cnt_lsb) /* 63 */
#define TclBNInitBignumFromLong \
(tclTomMathStubsPtr->tclBNInitBignumFromLong) /* 64 */
#define TclBNInitBignumFromWideInt \
(tclTomMathStubsPtr->tclBNInitBignumFromWideInt) /* 65 */
#define TclBNInitBignumFromWideUInt \
(tclTomMathStubsPtr->tclBNInitBignumFromWideUInt) /* 66 */
#define TclBN_mp_init_l \
(tclTomMathStubsPtr->tclBN_mp_init_l) /* 64 */
#define TclBN_mp_init_i64 \
(tclTomMathStubsPtr->tclBN_mp_init_i64) /* 65 */
#define TclBN_mp_init_u64 \
(tclTomMathStubsPtr->tclBN_mp_init_u64) /* 66 */
#define TclBN_mp_expt_d_ex \
(tclTomMathStubsPtr->tclBN_mp_expt_d_ex) /* 67 */
#define TclBN_mp_set_ull \
(tclTomMathStubsPtr->tclBN_mp_set_ull) /* 68 */
#define TclBN_mp_get_mag_ull \
(tclTomMathStubsPtr->tclBN_mp_get_mag_ull) /* 69 */
#define TclBN_mp_set_ll \
(tclTomMathStubsPtr->tclBN_mp_set_ll) /* 70 */
#define TclBN_mp_get_mag_ul \
(tclTomMathStubsPtr->tclBN_mp_get_mag_ul) /* 71 */
#define TclBN_mp_set_l \
(tclTomMathStubsPtr->tclBN_mp_set_l) /* 72 */
#define TclBN_mp_set_u64 \
(tclTomMathStubsPtr->tclBN_mp_set_u64) /* 68 */
#define TclBN_mp_get_mag_u64 \
(tclTomMathStubsPtr->tclBN_mp_get_mag_u64) /* 69 */
#define TclBN_mp_set_i64 \
(tclTomMathStubsPtr->tclBN_mp_set_i64) /* 70 */
/* Slot 71 is reserved */
/* Slot 72 is reserved */
#define TclBN_mp_tc_and \
(tclTomMathStubsPtr->tclBN_mp_tc_and) /* 73 */
#define TclBN_mp_tc_or \
@@ -634,7 +656,8 @@ extern const TclTomMathStubs *tclTomMathStubsPtr;
/* Slot 77 is reserved */
#define TclBN_mp_to_ubin \
(tclTomMathStubsPtr->tclBN_mp_to_ubin) /* 78 */
/* Slot 79 is reserved */
#define TclBN_mp_div_ld \
(tclTomMathStubsPtr->tclBN_mp_div_ld) /* 79 */
#define TclBN_mp_to_radix \
(tclTomMathStubsPtr->tclBN_mp_to_radix) /* 80 */
@@ -643,42 +666,32 @@ extern const TclTomMathStubs *tclTomMathStubsPtr;
/* !END!: Do not edit above this line. */
#if defined(USE_TCL_STUBS)
#undef mp_add_d
#define mp_add_d TclBN_mp_add_d
#undef mp_cmp_d
#define mp_cmp_d TclBN_mp_cmp_d
#undef mp_div_d
#ifdef MP_64BIT
#define mp_div_d TclBN_mp_div_ld
#else
#define mp_div_d TclBN_mp_div_d
#define mp_div_3 TclBN_mp_div_3
#define mp_sub_d TclBN_mp_sub_d
#define mp_init_set TclBN_mp_init_set
#define mp_mul_d TclBN_mp_mul_d
#define mp_set TclBN_mp_set
#define mp_expt_u32 TclBN_mp_expt_u32
#else
#define mp_add_d TclBN_s_mp_add_d
#define mp_cmp_d TclBN_s_mp_cmp_d
#define mp_div_d TclBN_s_mp_div_d
#define mp_div_3 TclBN_s_mp_div_3
#define mp_sub_d TclBN_s_mp_sub_d
#define mp_init_set TclBN_s_mp_init_set
#define mp_mul_d TclBN_s_mp_mul_d
#define mp_set TclBN_s_mp_set
#define mp_expt_u32 TclBN_s_mp_expt_u32
#endif /* !BUILD_tcl */
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLIMPORT
#if defined(USE_TCL_STUBS)
# define mp_sqr(a,b) mp_mul(a,a,b)
#else
# define mp_sqr TclBN_mp_sqr
#endif
#undef mp_sub_d
#define mp_sub_d TclBN_mp_sub_d
#undef mp_init_set
#define mp_init_set TclBN_mp_init_set
#undef mp_mul_d
#define mp_mul_d TclBN_mp_mul_d
#undef mp_set
#define mp_set TclBN_mp_set
#undef mp_expt_u32
#define mp_expt_u32 TclBN_mp_expt_u32
#endif /* USE_TCL_STUBS */
#ifdef USE_TCL_STUBS
#undef TclBNInitBignumFromLong
#define TclBNInitBignumFromLong(a,b) \
do { \
(a)->dp = NULL; \
(void)tclTomMathStubsPtr->tclBNInitBignumFromLong((a),(b)); \
(void)mp_init_i64((a),(b)); \
if ((a)->dp == NULL) { \
Tcl_Panic("initialization failure in TclBNInitBignumFromLong"); \
} \
@@ -687,7 +700,7 @@ extern const TclTomMathStubs *tclTomMathStubsPtr;
#define TclBNInitBignumFromWideInt(a,b) \
do { \
(a)->dp = NULL; \
(void)tclTomMathStubsPtr->tclBNInitBignumFromWideInt((a),(b)); \
(void)mp_init_i64((a),(b)); \
if ((a)->dp == NULL) { \
Tcl_Panic("initialization failure in TclBNInitBignumFromWideInt"); \
} \
@@ -696,15 +709,41 @@ extern const TclTomMathStubs *tclTomMathStubsPtr;
#define TclBNInitBignumFromWideUInt(a,b) \
do { \
(a)->dp = NULL; \
(void)tclTomMathStubsPtr->tclBNInitBignumFromWideUInt((a),(b)); \
(void)mp_init_u64((a),(b)); \
if ((a)->dp == NULL) { \
Tcl_Panic("initialization failure in TclBNInitBignumFromWideUInt"); \
} \
} while (0)
#else
#endif /* USE_TCL_STUBS */
#define mp_init_i32(a,b) mp_init_l((a),(int32_t)(b))
#define mp_init_i64(a,b) mp_init_ll((a),(b))
#define mp_init_u32(a,b) mp_init_ull((a),(uint32_t)(b))
#define mp_init_u64(a,b) mp_init_ull((a),(b))
#undef mp_get_ll
#define mp_get_ll(a) ((long long)mp_get_i64(a))
#undef mp_set_ll
#define mp_set_ll(a,b) mp_set_i64(a,b)
#undef mp_init_ll
#define mp_init_ll(a,b) mp_init_i64(a,b)
#undef mp_get_ull
#define mp_get_ull(a) ((unsigned long long)mp_get_i64(a))
#undef mp_set_ull
#define mp_set_ull(a,b) mp_set_u64(a,b)
#undef mp_init_ull
#define mp_init_ull(a,b) mp_init_u64(a,b)
#undef mp_set
#define mp_set(a,b) mp_set_i64((a),(int32_t)(b))
#define mp_set_i32(a,b) mp_set_i64((a),(int32_t)(b))
#define mp_set_l(a,b) mp_set_i64((a),(long)(b))
#define mp_set_u32(a,b) mp_set_u64((a),(uint32_t)(b))
#define mp_set_ul(a,b) mp_set_u64((a),(unsigned long)(b))
#define mp_init_i32(a,b) mp_init_i64((a),(int32_t)(b))
#define mp_init_l(a,b) mp_init_i64((a),(long)(b))
#define mp_init_u32(a,b) mp_init_u64((a),(uint32_t)(b))
#define mp_init_ul(a,b) mp_init_u64((a),(unsigned long)(b))
#undef mp_iseven
#undef mp_isodd
#define mp_iseven(a) (!mp_isodd(a))
#define mp_isodd(a) (((a)->used != 0 && (((a)->dp[0] & 1) != 0)) ? MP_YES : MP_NO)
#undef mp_sqr
#define mp_sqr(a,b) mp_mul(a,a,b)
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLIMPORT
#endif /* _TCLINTDECLS */
+1 -1
View File
@@ -13,7 +13,7 @@
*/
#include "tclInt.h"
#include "tommath.h"
#include "tclTomMath.h"
MODULE_SCOPE const TclTomMathStubs tclTomMathStubs;
+1
View File
@@ -12,6 +12,7 @@
*/
#include "tclInt.h"
#include "tclTomMath.h"
MODULE_SCOPE const TclTomMathStubs *tclTomMathStubsPtr;
+17 -17
View File
@@ -787,7 +787,7 @@ Tcl_UtfFindFirst(
while (1) {
len = TclUtfToUniChar(src, &find);
fullchar = find;
#if TCL_UTF_MAX <= 4
#if TCL_UTF_MAX <= 3
if ((fullchar != ch) && (find >= 0xD800) && (len < 3)) {
len += TclUtfToUniChar(src + len, &find);
fullchar = (((fullchar & 0x3ff) << 10) | (find & 0x3ff)) + 0x10000;
@@ -835,7 +835,7 @@ Tcl_UtfFindLast(
while (1) {
len = TclUtfToUniChar(src, &find);
fullchar = find;
#if TCL_UTF_MAX <= 4
#if TCL_UTF_MAX <= 3
if ((fullchar != ch) && (find >= 0xD800) && (len < 3)) {
len += TclUtfToUniChar(src + len, &find);
fullchar = (((fullchar & 0x3ff) << 10) | (find & 0x3ff)) + 0x10000;
@@ -878,7 +878,7 @@ Tcl_UtfNext(
Tcl_UniChar ch = 0;
int len = TclUtfToUniChar(src, &ch);
#if TCL_UTF_MAX <= 4
#if TCL_UTF_MAX <= 3
if ((ch >= 0xD800) && (len < 3)) {
len += TclUtfToUniChar(src + len, &ch);
}
@@ -960,19 +960,19 @@ Tcl_UniCharAtIndex(
{
Tcl_UniChar ch = 0;
int fullchar = 0;
#if TCL_UTF_MAX <= 4
#if TCL_UTF_MAX <= 3
int len = 0;
#endif
while (index-- >= 0) {
#if TCL_UTF_MAX <= 4
#if TCL_UTF_MAX <= 3
src += (len = TclUtfToUniChar(src, &ch));
#else
src += TclUtfToUniChar(src, &ch);
#endif
}
fullchar = ch;
#if TCL_UTF_MAX <= 4
#if TCL_UTF_MAX <= 3
if ((ch >= 0xD800) && (len < 3)) {
/* If last Tcl_UniChar was a high surrogate, combine with low surrogate */
(void)TclUtfToUniChar(src, &ch);
@@ -988,7 +988,7 @@ Tcl_UniCharAtIndex(
* Tcl_UtfAtIndex --
*
* Returns a pointer to the specified character (not byte) position in
* the UTF-8 string. If TCL_UTF_MAX <= 4, characters > U+FFFF count as
* the UTF-8 string. If TCL_UTF_MAX <= 3, characters > U+FFFF count as
* 2 positions, but then the pointer should never be placed between
* the two positions.
*
@@ -1013,7 +1013,7 @@ Tcl_UtfAtIndex(
len = TclUtfToUniChar(src, &ch);
src += len;
}
#if TCL_UTF_MAX <= 4
#if TCL_UTF_MAX <= 3
if ((ch >= 0xD800) && (len < 3)) {
/* Index points at character following high Surrogate */
src += TclUtfToUniChar(src, &ch);
@@ -1067,7 +1067,7 @@ Tcl_UtfBackslash(
* We ate a whole line. Pay the price of a strlen()
*/
result = TclParseBackslash(src, (int)strlen(src), &numRead, dst);
result = TclParseBackslash(src, strlen(src), &numRead, dst);
}
if (readPtr != NULL) {
*readPtr = numRead;
@@ -1110,7 +1110,7 @@ Tcl_UtfToUpper(
while (*src) {
len = TclUtfToUniChar(src, &ch);
upChar = ch;
#if TCL_UTF_MAX <= 4
#if TCL_UTF_MAX <= 3
if ((ch >= 0xD800) && (len < 3)) {
len += TclUtfToUniChar(src + len, &ch);
/* Combine surrogates */
@@ -1172,7 +1172,7 @@ Tcl_UtfToLower(
while (*src) {
len = TclUtfToUniChar(src, &ch);
lowChar = ch;
#if TCL_UTF_MAX <= 4
#if TCL_UTF_MAX <= 3
if ((ch >= 0xD800) && (len < 3)) {
len += TclUtfToUniChar(src + len, &ch);
/* Combine surrogates */
@@ -1237,7 +1237,7 @@ Tcl_UtfToTitle(
if (*src) {
len = TclUtfToUniChar(src, &ch);
titleChar = ch;
#if TCL_UTF_MAX <= 4
#if TCL_UTF_MAX <= 3
if ((ch >= 0xD800) && (len < 3)) {
len += TclUtfToUniChar(src + len, &ch);
/* Combine surrogates */
@@ -1257,7 +1257,7 @@ Tcl_UtfToTitle(
while (*src) {
len = TclUtfToUniChar(src, &ch);
lowChar = ch;
#if TCL_UTF_MAX <= 4
#if TCL_UTF_MAX <= 3
if ((ch >= 0xD800) && (len < 3)) {
len += TclUtfToUniChar(src + len, &ch);
/* Combine surrogates */
@@ -1369,7 +1369,7 @@ Tcl_UtfNcmp(
cs += TclUtfToUniChar(cs, &ch1);
ct += TclUtfToUniChar(ct, &ch2);
if (ch1 != ch2) {
#if TCL_UTF_MAX <= 4
#if TCL_UTF_MAX <= 3
/* Surrogates always report higher than non-surrogates */
if (((ch1 & 0xFC00) == 0xD800)) {
if ((ch2 & 0xFC00) != 0xD800) {
@@ -1420,7 +1420,7 @@ Tcl_UtfNcasecmp(
cs += TclUtfToUniChar(cs, &ch1);
ct += TclUtfToUniChar(ct, &ch2);
if (ch1 != ch2) {
#if TCL_UTF_MAX <= 4
#if TCL_UTF_MAX <= 3
/* Surrogates always report higher than non-surrogates */
if (((ch1 & 0xFC00) == 0xD800)) {
if ((ch2 & 0xFC00) != 0xD800) {
@@ -1469,7 +1469,7 @@ TclUtfCmp(
cs += TclUtfToUniChar(cs, &ch1);
ct += TclUtfToUniChar(ct, &ch2);
if (ch1 != ch2) {
#if TCL_UTF_MAX <= 4
#if TCL_UTF_MAX <= 3
/* Surrogates always report higher than non-surrogates */
if (((ch1 & 0xFC00) == 0xD800)) {
if ((ch2 & 0xFC00) != 0xD800) {
@@ -1515,7 +1515,7 @@ TclUtfCasecmp(
cs += TclUtfToUniChar(cs, &ch1);
ct += TclUtfToUniChar(ct, &ch2);
if (ch1 != ch2) {
#if TCL_UTF_MAX <= 4
#if TCL_UTF_MAX <= 3
/* Surrogates always report higher than non-surrogates */
if (((ch1 & 0xFC00) == 0xD800)) {
if ((ch2 & 0xFC00) != 0xD800) {
+10 -34
View File
@@ -15,7 +15,7 @@
#include "tclInt.h"
#include "tclParse.h"
#include "tclStringTrim.h"
#include "tommath.h"
#include "tclTomMath.h"
#include <math.h>
/*
@@ -3615,49 +3615,25 @@ TclFormatInt(
* formatted characters are written. */
Tcl_WideInt n) /* The integer to format. */
{
Tcl_WideInt intVal;
int i;
Tcl_WideUInt intVal;
int i = 0;
int numFormatted, j;
const char *digits = "0123456789";
/*
* Check first whether "n" is zero.
*/
if (n == 0) {
buffer[0] = '0';
buffer[1] = 0;
return 1;
}
/*
* Check whether "n" is the maximum negative value. This is -2^(m-1) for
* an m-bit word, and has no positive equivalent; negating it produces the
* same value.
*/
intVal = -n; /* [Bug 3390638] Workaround for*/
if (n == -n || intVal == n) { /* broken compiler optimizers. */
return sprintf(buffer, "%" TCL_LL_MODIFIER "d", n);
}
static const char digits[] = "0123456789";
/*
* Generate the characters of the result backwards in the buffer.
*/
intVal = (n < 0? -n : n);
i = 0;
buffer[0] = '\0';
intVal = (n < 0 ? -(Tcl_WideUInt)n : (Tcl_WideUInt)n);
do {
i++;
buffer[i] = digits[intVal % 10];
intVal = intVal/10;
buffer[i++] = digits[intVal % 10];
intVal = intVal / 10;
} while (intVal > 0);
if (n < 0) {
i++;
buffer[i] = '-';
buffer[i++] = '-';
}
numFormatted = i;
buffer[i] = '\0';
numFormatted = i--;
/*
* Now reverse the characters.
+3 -3
View File
@@ -430,7 +430,7 @@ static const Tcl_Filesystem zipfsFilesystem = {
NULL, /* renameFileProc */
NULL, /* copyDirectoryProc */
NULL, /* lstatProc */
(Tcl_FSLoadFileProc *) ZipFSLoadFile,
(Tcl_FSLoadFileProc *)(void *)ZipFSLoadFile,
NULL, /* getCwdProc */
NULL, /* chdirProc */
};
@@ -3178,7 +3178,7 @@ TclZipfs_TclLibrary(void)
#ifdef _WIN32
HMODULE hModule;
WCHAR wName[MAX_PATH + LIBRARY_SIZE];
char dllName[(MAX_PATH + LIBRARY_SIZE) * TCL_UTF_MAX];
char dllName[(MAX_PATH + LIBRARY_SIZE) * 3];
#endif /* _WIN32 */
/*
@@ -4696,7 +4696,7 @@ ZipFSLoadFile(
Tcl_DecrRefCount(objs[1]);
}
loadFileProc = (Tcl_FSLoadFileProc2 *) tclNativeFilesystem.loadFileProc;
loadFileProc = (Tcl_FSLoadFileProc2 *)(void *)tclNativeFilesystem.loadFileProc;
if (loadFileProc) {
ret = loadFileProc(interp, path, loadHandle, unloadProcPtr, flags);
} else {
-1
View File
@@ -1 +0,0 @@
#include "tclTomMathInt.h"
+1 -1
View File
@@ -54,7 +54,7 @@ namespace eval [info object namespace ::http::cookiejar] {
# Keep this in sync with pkgIndex.tcl and with the install directories in
# Makefiles
variable version 0.1
variable version 0.2.0
variable domainlist \
http://publicsuffix.org/list/effective_tld_names.dat
+1 -1
View File
@@ -284,7 +284,7 @@ namespace eval ::tcl::idna {
}
}
package provide tcl::idna 1.0
package provide tcl::idna 1.0.1
# Local variables:
# mode: tcl
+2 -2
View File
@@ -1,3 +1,3 @@
if {![package vsatisfies [package provide Tcl] 8.6-]} {return}
package ifneeded cookiejar 0.1 [list source [file join $dir cookiejar.tcl]]
package ifneeded tcl::idna 1.0 [list source [file join $dir idna.tcl]]
package ifneeded cookiejar 0.2.0 [list source [file join $dir cookiejar.tcl]]
package ifneeded tcl::idna 1.0.1 [list source [file join $dir idna.tcl]]
+1 -1
View File
@@ -17,4 +17,4 @@ S
0E200E210E220E230E240E250E260E270E280E290E2A0E2B0E2C0E2D0E2E0E2F
0E300E310E320E330E340E350E360E370E380E390E3A00000000000000000E3F
0E400E410E420E430E440E450E460E470E480E490E4A0E4B0E4C0E4D0E4E0E4F
0E500E510E520E530E540E550E560E570E580E590E5A0E5B0000000000000000
0E500E510E520E530E540E550E560E570E580E590E5A0E5B0000000000000000
+1 -1
View File
@@ -19,7 +19,7 @@
if {[info commands package] == ""} {
error "version mismatch: library\nscripts expect Tcl version 7.5b1 or later but the loaded version is\nonly [info patchlevel]"
}
package require -exact Tcl 8.7a2
package require -exact Tcl 8.7a4
# Compute the auto path to use in this interpreter.
# The values on the path come from several locations:
+2
View File
@@ -8,6 +8,8 @@ apply {{dir} {
0 http 2.9.1 {http http.tcl}
1 msgcat 1.7.0 {msgcat msgcat.tcl}
1 opt 0.4.7 {opt optparse.tcl}
0 cookiejar 0.2.0 {cookiejar cookiejar.tcl}
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 -1
View File
@@ -20,7 +20,7 @@
#
# Needed utilities package
package require opt 0.4.1
package require opt 0.4.7
# Create the safe namespace
namespace eval ::safe {
+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.1 [list source [file join $dir tcltest.tcl]]
package ifneeded tcltest 2.5.2 [list source [file join $dir tcltest.tcl]]
+64 -18
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.1
variable Version 2.5.2
# Compatibility support for dumb variables defined in tcltest 1
# Do not use these. Call [package provide Tcl] and [info patchlevel]
@@ -1982,16 +1982,24 @@ proc tcltest::test {name description args} {
}
}
# First, run the setup script
# First, run the setup script (or a hook if it presents):
if {[set cmd [namespace which -command [namespace current]::SetupTest]] ne ""} {
set setup [list $cmd $setup]
}
set processTest 1
set code [catch {uplevel 1 $setup} setupMsg]
if {$code == 1} {
set errorInfo(setup) $::errorInfo
set errorCodeRes(setup) $::errorCode
if {$errorCodeRes(setup) eq "BYPASS-SKIPPED-TEST"} {
_noticeSkipped $name $setupMsg
set processTest [set code 0]
}
}
set setupFailure [expr {$code != 0}]
# Only run the test body if the setup was successful
if {!$setupFailure} {
if {$processTest && !$setupFailure} {
# Register startup time
if {[IsVerbose msec] || [IsVerbose usec]} {
@@ -2014,16 +2022,20 @@ proc tcltest::test {name description args} {
if {$returnCode == 1} {
set errorInfo(body) $::errorInfo
set errorCodeRes(body) $::errorCode
if {$errorCodeRes(body) eq "BYPASS-SKIPPED-TEST"} {
_noticeSkipped $name $actualAnswer
set processTest [set returnCode 0]
}
}
}
# check if the return code matched the expected return code
set codeFailure 0
if {!$setupFailure && ($returnCode ni $returnCodes)} {
if {$processTest && !$setupFailure && ($returnCode ni $returnCodes)} {
set codeFailure 1
}
set errorCodeFailure 0
if {!$setupFailure && !$codeFailure && $returnCode == 1 && \
if {$processTest && !$setupFailure && !$codeFailure && $returnCode == 1 && \
![string match $errorCode $errorCodeRes(body)]} {
set errorCodeFailure 1
}
@@ -2032,7 +2044,7 @@ proc tcltest::test {name description args} {
# them. If the comparison fails, then so did the test.
set outputFailure 0
variable outData
if {[info exists output] && !$codeFailure} {
if {$processTest && [info exists output] && !$codeFailure} {
if {[set outputCompare [catch {
CompareStrings $outData $output $match
} outputMatch]] == 0} {
@@ -2044,7 +2056,7 @@ proc tcltest::test {name description args} {
set errorFailure 0
variable errData
if {[info exists errorOutput] && !$codeFailure} {
if {$processTest && [info exists errorOutput] && !$codeFailure} {
if {[set errorCompare [catch {
CompareStrings $errData $errorOutput $match
} errorMatch]] == 0} {
@@ -2056,7 +2068,9 @@ proc tcltest::test {name description args} {
# check if the answer matched the expected answer
# Only check if we ran the body of the test (no setup failure)
if {$setupFailure || $codeFailure} {
if {!$processTest} {
set scriptFailure 0
} elseif {$setupFailure || $codeFailure} {
set scriptFailure 0
} elseif {[set scriptCompare [catch {
CompareStrings $actualAnswer $result $match
@@ -2066,7 +2080,10 @@ proc tcltest::test {name description args} {
set scriptFailure 1
}
# Always run the cleanup script
# Always run the cleanup script (or a hook if it presents):
if {[set cmd [namespace which -command [namespace current]::CleanupTest]] ne ""} {
set cleanup [list $cmd $cleanup]
}
set code [catch {uplevel 1 $cleanup} cleanupMsg]
if {$code == 1} {
set errorInfo(cleanup) $::errorInfo
@@ -2117,6 +2134,12 @@ proc tcltest::test {name description args} {
}
}
# if skipped, it is safe to return here
if {!$processTest} {
incr testLevel -1
return
}
# if we didn't experience any failures, then we passed
variable numTests
if {!($setupFailure || $cleanupFailure || $coreFailure
@@ -2177,7 +2200,7 @@ proc tcltest::test {name description args} {
puts [outputChannel] "---- errorCode(setup): $errorCodeRes(setup)"
}
}
if {$scriptFailure} {
if {$processTest && $scriptFailure} {
if {$scriptCompare} {
puts [outputChannel] "---- Error testing result: $scriptMatch"
} else {
@@ -2244,6 +2267,32 @@ proc tcltest::test {name description args} {
return
}
# Skip --
#
# Skips a running test and add a reason to skipped "constraints". Can be used
# to conditional intended abort of the test.
#
# Side Effects: Maintains tally of total tests seen and tests skipped.
#
proc tcltest::Skip {reason} {
return -code error -errorcode BYPASS-SKIPPED-TEST $reason
}
proc tcltest::_noticeSkipped {name reason} {
variable testLevel
variable numTests
if {[IsVerbose skip]} {
puts [outputChannel] "++++ $name SKIPPED: $reason"
}
if {$testLevel == 1} {
incr numTests(Skipped)
AddToSkippedBecause $reason
}
}
# Skipped --
#
# Given a test name and it constraints, returns a boolean indicating
@@ -2324,14 +2373,7 @@ proc tcltest::Skipped {name constraints} {
}
if {!$doTest} {
if {[IsVerbose skip]} {
puts [outputChannel] "++++ $name SKIPPED: $constraints"
}
if {$testLevel == 1} {
incr numTests(Skipped)
AddToSkippedBecause $constraints
}
_noticeSkipped $name $constraints
return 1
}
}
@@ -2354,6 +2396,10 @@ proc tcltest::RunTest {name script} {
memory tag $name
}
# run the test script (or a hook if it presents):
if {[set cmd [namespace which -command [namespace current]::EvalTest]] ne ""} {
set script [list $cmd $script]
}
set code [catch {uplevel 1 $script} actualAnswer]
return [list $actualAnswer $code]
+1
View File
@@ -4,6 +4,7 @@ branches:
- master
- develop
- /^release/
- /^support/
- /^travis/
image:
- Visual Studio 2019
+5 -5
View File
@@ -25,7 +25,7 @@ mp_err mp_jacobi(const mp_int *a, const mp_int *n, int *c)
}
#endif
#ifdef BN_MP_PRIME_RANDOM_EX_C
mp_err mp_prime_random_ex(mp_int *a, int t, int size, int flags, mp_prime_callback cb, void *dat)
mp_err mp_prime_random_ex(mp_int *a, int t, int size, int flags, private_mp_prime_callback cb, void *dat)
{
return s_mp_prime_random_ex(a, t, size, flags, cb, dat);
}
@@ -158,14 +158,14 @@ mp_err mp_set_int(mp_int *a, unsigned long b)
#ifdef BN_MP_SET_LONG_C
mp_err mp_set_long(mp_int *a, unsigned long b)
{
mp_set_ul(a, b);
mp_set_u64(a, b);
return MP_OKAY;
}
#endif
#ifdef BN_MP_SET_LONG_LONG_C
mp_err mp_set_long_long(mp_int *a, unsigned long long b)
{
mp_set_ull(a, b);
mp_set_u64(a, b);
return MP_OKAY;
}
#endif
@@ -219,7 +219,7 @@ mp_err mp_n_root_ex(const mp_int *a, mp_digit b, mp_int *c, int fast)
if (b > MP_MIN(MP_DIGIT_MAX, UINT32_MAX)) {
return MP_VAL;
}
return mp_root_u32(a, (unsigned int)b, c);
return mp_root_u32(a, (uint32_t)b, c);
}
#endif
#ifdef BN_MP_N_ROOT_C
@@ -228,7 +228,7 @@ mp_err mp_n_root(const mp_int *a, mp_digit b, mp_int *c)
if (b > MP_MIN(MP_DIGIT_MAX, UINT32_MAX)) {
return MP_VAL;
}
return mp_root_u32(a, (unsigned int)b, c);
return mp_root_u32(a, (uint32_t)b, c);
}
#endif
#ifdef BN_MP_UNSIGNED_BIN_SIZE_C
+1 -1
View File
@@ -4,7 +4,7 @@
/* SPDX-License-Identifier: Unlicense */
/* calculate c = a**b using a square-multiply algorithm */
mp_err mp_expt_u32(const mp_int *a, unsigned int b, mp_int *c)
mp_err mp_expt_u32(const mp_int *a, uint32_t b, mp_int *c)
{
mp_err err;
+2 -2
View File
@@ -30,11 +30,11 @@ mp_err mp_fread(mp_int *a, int radix, FILE *stream)
do {
int y;
unsigned pos = (unsigned)(ch - (int)'(');
if (MP_RMAP_REVERSE_SIZE < pos) {
if (mp_s_rmap_reverse_sz < pos) {
break;
}
y = (int)s_mp_rmap_reverse[pos];
y = (int)mp_s_rmap_reverse[pos];
if ((y == 0xff) || (y >= radix)) {
break;
+1 -1
View File
@@ -3,5 +3,5 @@
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
/* SPDX-License-Identifier: Unlicense */
MP_INIT_INT(mp_init_ll, mp_set_ll, Tcl_WideInt)
MP_INIT_INT(mp_init_ll, mp_set_ll, long long)
#endif
+1 -1
View File
@@ -3,5 +3,5 @@
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
/* SPDX-License-Identifier: Unlicense */
MP_INIT_INT(mp_init_ull, mp_set_ull, Tcl_WideUInt)
MP_INIT_INT(mp_init_ull, mp_set_ull, unsigned long long)
#endif
+9 -9
View File
@@ -6,7 +6,7 @@
/* Compute log_{base}(a) */
static mp_word s_pow(mp_word base, mp_word exponent)
{
mp_word result = 1;
mp_word result = 1u;
while (exponent != 0u) {
if ((exponent & 1u) == 1u) {
result *= base;
@@ -20,8 +20,8 @@ static mp_word s_pow(mp_word base, mp_word exponent)
static mp_digit s_digit_ilogb(mp_digit base, mp_digit n)
{
mp_word bracket_low = 1, bracket_mid, bracket_high, N;
mp_digit ret, high = 1uL, low = 0uL, mid;
mp_word bracket_low = 1u, bracket_mid, bracket_high, N;
mp_digit ret, high = 1u, low = 0uL, mid;
if (n < base) {
return 0uL;
@@ -40,7 +40,7 @@ static mp_digit s_digit_ilogb(mp_digit base, mp_digit n)
bracket_high *= bracket_high;
}
while (((mp_digit)(high - low)) > 1uL) {
while (((mp_digit)(high - low)) > 1u) {
mid = (low + high) >> 1;
bracket_mid = bracket_low * s_pow(base, (mp_word)(mid - low));
@@ -70,11 +70,11 @@ static mp_digit s_digit_ilogb(mp_digit base, mp_digit n)
as is the output of mp_bitcount.
With the same problem: max size is INT_MAX * MP_DIGIT not INT_MAX only!
*/
mp_err mp_log_u32(const mp_int *a, unsigned int base, unsigned int *c)
mp_err mp_log_u32(const mp_int *a, uint32_t base, uint32_t *c)
{
mp_err err;
mp_ord cmp;
unsigned int high, low, mid;
uint32_t high, low, mid;
mp_int bracket_low, bracket_high, bracket_mid, t, bi_base;
err = MP_OKAY;
@@ -98,12 +98,12 @@ mp_err mp_log_u32(const mp_int *a, unsigned int base, unsigned int *c)
base >>= 1;
}
bit_count = mp_count_bits(a) - 1;
*c = (unsigned int)(bit_count/y);
*c = (uint32_t)(bit_count/y);
return MP_OKAY;
}
if (a->used == 1) {
*c = (unsigned int)s_digit_ilogb(base, a->dp[0]);
*c = (uint32_t)s_digit_ilogb(base, a->dp[0]);
return err;
}
@@ -146,7 +146,7 @@ mp_err mp_log_u32(const mp_int *a, unsigned int base, unsigned int *c)
while ((high - low) > 1u) {
mid = (high + low) >> 1;
if ((err = mp_expt_u32(&bi_base, mid - low, &t)) != MP_OKAY) {
if ((err = mp_expt_u32(&bi_base, (uint32_t)(mid - low), &t)) != MP_OKAY) {
goto LBL_ERR;
}
if ((err = mp_mul(&bracket_low, &t, &bracket_mid)) != MP_OKAY) {
+2 -2
View File
@@ -17,8 +17,8 @@ mp_err mp_montgomery_reduce(mp_int *x, const mp_int *n, mp_digit rho)
* are fixed up in the inner loop.
*/
digs = (n->used * 2) + 1;
if ((digs < PRIVATE_MP_WARRAY) &&
(x->used <= PRIVATE_MP_WARRAY) &&
if ((digs < MP_WARRAY) &&
(x->used <= MP_WARRAY) &&
(n->used < MP_MAXFAST)) {
return s_mp_montgomery_reduce_fast(x, n, rho);
}
+3 -3
View File
@@ -19,7 +19,7 @@ mp_err mp_mul(const mp_int *a, const mp_int *b, mp_int *c)
* The bigger one needs to be at least about one MP_KARATSUBA_MUL_CUTOFF bigger
* to make some sense, but it depends on architecture, OS, position of the
* stars... so YMMV.
* Using it to cut the input into slices small enough for s_mp_mul_digs_fast
* Using it to cut the input into slices small enough for fast_s_mp_mul_digs
* was actually slower on the author's machine, but YMMV.
*/
(min_len >= MP_KARATSUBA_MUL_CUTOFF) &&
@@ -37,10 +37,10 @@ mp_err mp_mul(const mp_int *a, const mp_int *b, mp_int *c)
/* can we use the fast multiplier?
*
* The fast multiplier can be used if the output will
* have less than PRIVATE_MP_WARRAY digits and the number of
* have less than MP_WARRAY digits and the number of
* digits won't affect carry propagation
*/
(digs < PRIVATE_MP_WARRAY) &&
(digs < MP_WARRAY) &&
(min_len <= MP_MAXFAST)) {
err = s_mp_mul_digs_fast(a, b, c, digs);
} else if (MP_HAS(S_MP_MUL_DIGS)) {
+1 -1
View File
@@ -18,7 +18,7 @@
*/
/* This is possibly the mother of all prime generation functions, muahahahahaha! */
mp_err s_mp_prime_random_ex(mp_int *a, int t, int size, int flags, mp_prime_callback cb, void *dat)
mp_err s_mp_prime_random_ex(mp_int *a, int t, int size, int flags, private_mp_prime_callback cb, void *dat)
{
unsigned char *tmp, maskAND, maskOR_msb, maskOR_lsb;
int bsize, maskOR_msb_offset;
+3 -2
View File
@@ -4,8 +4,8 @@
/* SPDX-License-Identifier: Unlicense */
/* chars used in radix conversions */
const char s_mp_rmap[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/";
const unsigned char s_mp_rmap_reverse[] = {
const char *const mp_s_rmap = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/";
const uint8_t mp_s_rmap_reverse[] = {
0xff, 0xff, 0xff, 0x3e, 0xff, 0xff, 0xff, 0x3f, /* ()*+,-./ */
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 01234567 */
0x08, 0x09, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 89:;<=>? */
@@ -18,4 +18,5 @@ const unsigned char s_mp_rmap_reverse[] = {
0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, /* pqrstuvw */
0x3b, 0x3c, 0x3d, 0xff, 0xff, 0xff, 0xff, 0xff, /* xyz{|}~. */
};
const size_t mp_s_rmap_reverse_sz = sizeof(mp_s_rmap_reverse);
#endif

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