Compare commits

..
Author SHA1 Message Date
Joe Mistachkin 8365a58070 Update comment with TIP number. 2016-01-19 17:48:25 +00:00
Joe Mistachkin b25cb7d39a Add docs and tests. 2016-01-15 00:39:41 +00:00
Joe Mistachkin 02b32be1a7 Add the tcl_platform(engine) element, TIP to be written. 2016-01-14 23:55:45 +00:00
jan.nijtmans d533bb6a26 Fix [f01d74dc8c]: DEFAULT_COPY_BLOCK_SIZE has incorrect value 2016-01-07 11:33:02 +00:00
jan.nijtmans 972aafc741 Fix win32 mingw 32-bit build, bug was introduced by [c397433be321e6d9] (wrong zlib1.dll was copied) 2016-01-06 11:15:20 +00:00
dkf 3c9ec7f76f Document the Tcl_CancelEval function correctly. It was missing its second argument, making using it correctly impossible, especially from C++. 2016-01-01 17:46:45 +00:00
jan.nijtmans e39b986e81 Code-cleanup: CONST -> const, don't use macro's like __REG_CONST and types like re_void any more. No change in functionality. 2015-12-21 10:27:19 +00:00
jan.nijtmans 605aff99c9 Remove unused static function definition 2015-12-15 13:19:43 +00:00
jan.nijtmans 6df8a636f8 make some MODULE_SCOPE symbols static 2015-12-15 11:13:32 +00:00
jan.nijtmans 72dd32a3ca Eliminate AuxDataType table: since this table only contains 4 constant entries, it is overkill to use a hash table for that. 2015-12-15 10:33:09 +00:00
dkf 0b00017862 Issue the correct auxType when compiling [array set]. 2015-12-12 11:54:33 +00:00
jan.nijtmans e3a26ef9f6 Fix [c9eb6b0ac01bb8ef96a616c71426a3db4a279bec|c9eb6b0ac0]: ConvertLocalToUTCUsingC fails the first time if TZ is not set 2015-12-11 10:18:03 +00:00
jan.nijtmans 2e57446fb4 Fix [c9eb6b0ac01bb8ef96a616c71426a3db4a279bec|c9eb6b0ac0]: ConvertLocalToUTCUsingC fails the first time if TZ is not set 2015-12-11 10:13:33 +00:00
jan.nijtmans 456e333da9 Fix 64-bit MSVC build without SDK: If the MSVC version is recent enough, compiling without SDK works fine (provided that the build is configured using "--enable-64bit"). 2015-12-02 11:30:36 +00:00
jan.nijtmans 6c1d8b86ca Fix 64-bit MSVC build without SDK: If the MSVC version is recent enough, compiling without SDK works fine (provided that the build is configured using "--enable-64bit"). 2015-12-02 11:02:34 +00:00
dgp a2b2c6bfc4 [32c5740a4d] Have Tcl_ListObjReplace() try to use realloc() for growing when
it can do so.
2015-11-30 18:24:03 +00:00
jan.nijtmans c7c95d77f8 On cygwin, install libtcl8.6.dll.a in the {prefix}/lib directory. On win32, don't create empty {prefix}/lib/tcl8/8.2 and {prefix}/lib/tcl8/8.3 directories any more during installing. 2015-11-26 12:01:35 +00:00
jan.nijtmans e6fa255ed5 On cygwin, install libtcl8.5.dll.a in the {prefix}/lib directory.
On win32, don't create empty {prefix}/lib/tcl8/8.2 and {prefix}/lib/tcl8/8.3 directories any more during installing.
2015-11-26 11:46:02 +00:00
jan.nijtmans 4dd62bd6ed Fix comments at the top of the *.decls files, which are not correct any more for a long long time 2015-11-24 15:09:16 +00:00
jan.nijtmans d06ef17019 Fix comments at the top of the *.decls files, which are not correct any more for a long long time. 2015-11-24 15:05:15 +00:00
jan.nijtmans 99ba912ceb Make ::tcl::tm::roots work for alpha/beta Tcl releases. (backported from "novem", will be needed anyway for whatever future developments) 2015-11-24 09:00:27 +00:00
jan.nijtmans 9782f13f46 Cherrypick [812a81812ebf89d2416059d45fabd27e45603f5e|812a81812e]: Turn off NRE asserts by default. About a 5% speedup on [clock format]. 2015-11-22 21:02:29 +00:00
dkf e922cb1cd3 [3d96b7076e] Prevent crashes when destroying an object's class inside a method call. 2015-11-21 22:22:49 +00:00
dgp a166c55da0 Tcl_ListObjReplace() early out when > LIST_MAX attempted. 2015-11-20 16:59:55 +00:00
dgp 7e6cdc9cc4 [3293874] Simplified fix (not backport). Also detect >LIST_MAX early. 2015-11-20 16:58:11 +00:00
dgp 94b81dda49 [40f628e8e3] Tcl_ListObjReplace() callers need to handle TCL_ERROR. 2015-11-20 16:42:57 +00:00
dgp f4b65459ef [40f628e8e3] Tcl_ListObjReplace() callers need to handle TCL_ERROR. 2015-11-20 15:47:30 +00:00
oehhar 81ee44ac3b Spanish translation of example corrected 2015-11-17 17:07:33 +00:00
oehhar c3e6dcaa67 Spanish translation of example corrected 2015-11-17 17:01:58 +00:00
jan.nijtmans f89b8b1e2d Fix --enable-symbols build on Cygwin. Reported by François Vogel 2015-11-16 10:55:42 +00:00
jan.nijtmans 4e12f02a75 Fix --enable-symbols build on Cygwin. Reported by François Vogel 2015-11-16 10:32:40 +00:00
jan.nijtmans 8f1f92264a Fix [https://www.sqlite.org/src/info/34eb6911afee09e7|34eb6911af], taken over from SQLite: Fix uses of ctype functions (ex: isspace()) on signed characters in test programs and in some obscure extensions. No changes to the core. 2015-11-13 08:42:30 +00:00
jan.nijtmans d85dd92c27 Fix [https://www.sqlite.org/src/info/34eb6911afee09e7|34eb6911af], taken over from SQLite: Fix uses of ctype functions (ex: isspace()) on signed characters in test programs and in some obscure extensions. No changes to the core. 2015-11-13 08:40:54 +00:00
max 9965b67d8e Remove unused calculation of the result set size from TclCreateSocketAddress() 2015-11-11 09:56:41 +00:00
dgp 533f349b01 [261a8a79f0] Integer overflow leads to segfault. 2015-11-10 16:34:04 +00:00
dgp f3a2810d20 [261a8a79f0] Integer overflow leads to segfault. 2015-11-10 16:31:29 +00:00
dkf 04d1b41522 make genstubs 2015-10-28 21:15:52 +00:00
dkf a2efc41118 Expose some of the TclBN operations through the internal API, so clients of the bignum code don't need to use tclTomMath.h directly. 2015-10-28 21:15:21 +00:00
venkat 91ec2f6354 Merge tzdata2015g from ietf 2015-10-27 23:16:54 +00:00
venkat f98d4ff859 Update to tzdata2015g from ietf 2015-10-27 23:16:06 +00:00
jan.nijtmans 58e31795d0 re-generate "configure", both for unix and win 2015-10-25 22:47:39 +00:00
jan.nijtmans 2a20e200df re-generate "configure", both for unix and win 2015-10-25 22:45:39 +00:00
jan.nijtmans 383da62572 Remove use of HAVE_USLEEP. It isn't use anywhere any more 2015-10-25 19:41:29 +00:00
jan.nijtmans 500fbe92e6 Remove use of HAVE_USLEEP. It isn't use anywhere any more. 2015-10-25 19:39:38 +00:00
dkf 3fc99c04f6 A more lenient test; different platforms are more diverse in their correct output. 2015-10-24 16:02:32 +00:00
dkf 56bf715712 A more lenient test; different platforms are more diverse in their correct output. 2015-10-24 16:01:56 +00:00
jan.nijtmans 422eaa2077 Bring back regexp to what it was in latest release. This is the correct fix for the problem noted by kbk. Thanks! And thanks to dkf for the test-case 2015-10-24 07:43:33 +00:00
jan.nijtmans e8786f8348 Bring back regexp to wat it was in latest release. This is the correct fix for kbk's attempt. 2015-10-24 07:40:30 +00:00
dkf d1f3fe0de0 Mend problems with [platform::identify] formatting. 2015-10-23 22:44:31 +00:00
dkf a29de0a577 combine divergence 2015-10-23 22:39:02 +00:00
dkf 116ec0f471 Ensure that at lease the format of the output of the platform package's commands is consistently parsable. 2015-10-23 22:30:57 +00:00
Kevin B Kenny 4028edd571 Correct bad regexp in platform::identify that causes it to return incorrect results everywhere. 2015-10-23 22:29:23 +00:00
dgp 828abac60a merge mark 2015-10-23 14:59:38 +00:00
dgp f5599d7f8d Backout of failed attempt to fix [32ae34e63a] got checked into wrong branch. 2015-10-23 14:57:56 +00:00
oehhar b421519004 Make test clock-67.4 time zone independent. Bug [4a0c163d24] 2015-10-23 12:52:19 +00:00
oehhar c6fd11389a Change "clock scan/format -format %x -locale current" output on msgcat locale change. Bug [4a0c163d24] 2015-10-23 08:12:53 +00:00
oehhar a231dcf0ac New test for clock scan, test numbering corrected 2015-10-23 08:08:09 +00:00
oehhar c0a4d1371a Change "clock format -format %x -locale current" output on msgcat locale change [4a0c163d24] 2015-10-21 20:30:49 +00:00
dgp 990b376ae1 [1080042][8f245009b0] Big bundle of regexp engine fixes and improvements contributed from Tom Lane of the postgres project. 2015-10-21 14:10:13 +00:00
dgp 7640d1e898 [1080042][8f245009b0] Big bundle of regexp engine fixes and improvements
contributed from Tom Lane of the postgres project.
2015-10-21 13:50:55 +00:00
dgp cf8194b6a0 Adapted new tests contributed from Tom Lane @postgres. 2015-10-21 13:35:48 +00:00
dgp 1636c5d39a Adaptation of most of the re-mopup.patch from Tom Lane @ postgress.
Still should add the new tests.
2015-10-20 20:21:44 +00:00
dgp 33180e74dd Adaptation of re-memaccounting.patch from Tom Lane @postgres. 2015-10-20 19:53:03 +00:00
dgp f51da6d726 Adaptation of re-better-pushpull.patch from Tom Lane @postgres 2015-10-20 19:21:53 +00:00
dgp 6c297ad438 Adaptation of re-better-fixempties.patch from Tom Lane @ postgres. 2015-10-20 18:32:25 +00:00
dgp 1ead60af0b Adaptation of re-oNsquared.patch from Tom Lane @ postgres. 2015-10-19 19:32:04 +00:00
dgp d5029136c1 Adaptation of the patch re-fixconstraintloops.patch from
http://www.postgresql.org/message-id/19394.1444865029@sss.pgh.pa.us
2015-10-19 17:42:43 +00:00
dkf c0ab3b7128 [154f0982f2] Document that Tcl_NewObjectInstance() really needs to make a namespace. 2015-10-19 14:07:48 +00:00
jan.nijtmans ef1cf6b99b typo in comment. Eliminate unnecessary end-of-line spacing. 2015-10-19 13:52:58 +00:00
jan.nijtmans 44deaab456 Bring back Tcl_MutexLock() to exact implementation in Tcl 8.6.4. For details, see [ba44e415a0]: Use of mutexLock causes problem with reactive event handling in AndroWish 2015-10-18 10:34:30 +00:00
jan.nijtmans dfb834e395 Bring back Tcl_MutexLock() to exact implementation in Tcl 8.5.18. For details, see [ba44e415a0]: Use of mutexLock causes problem with reactive event handling in AndroWish 2015-10-18 10:31:50 +00:00
jan.nijtmans 463aed9329 Proposed fix for [ba44e415a0]: "Use of mutexLock causes problem with reactive event handling in AndroWish".
This basically undoes the retry mechamism in Tcl_MutexLock, introduced in [9f8b7bea53]. Does this retry mechamism hurt more than it helps? Feedback requested.
2015-10-17 07:21:19 +00:00
jan.nijtmans c6511f8d77 Various build fixes, when using Cygwin shell in combination with native MinGW compiler. Contributed by pooryorick. 2015-10-12 11:29:45 +00:00
jan.nijtmans 8f5f70cbb1 Various build fixes, when using Cygwin shell in combination with native MinGW compiler. Contributed by pooryorick. 2015-10-12 09:57:26 +00:00
jan.nijtmans e19283c7d5 merge-mark 2015-10-10 12:38:24 +00:00
jan.nijtmans f0ba2933f2 Fix minor msvc compiler warning in tclWinFile.c 2015-10-10 12:37:34 +00:00
jan.nijtmans 0519b566b8 Make autoconf > 2.59 work warning-free 2015-10-09 14:41:51 +00:00
jan.nijtmans 96ba10aa41 Make autoconf > 2.59 work warning-free 2015-10-09 14:40:28 +00:00
stwo 5767ab9581 Tcl/OpenBSD/Sparc needs -fPIC. 2015-10-09 13:30:49 +00:00
stwo efecaa64e2 Tcl/OpenBSD/Sparc needs -fPIC. 2015-10-09 13:18:48 +00:00
jan.nijtmans 8d774cfa0b Decorate Tcl_Exit() and Tcl_SetExitProc()'s argument with TCL_NORETURN as appropriate, as already done with Tcl_Panic() earlier.
Fix minor msvc compiler warning in tclWinFile.c
2015-10-08 14:41:46 +00:00
jan.nijtmans fe2ac816b0 Fix [8587cb648c445f7]: clock default format incorrect 2015-10-07 13:34:17 +00:00
jan.nijtmans ffeedbcbca Fix [8587cb648c445f7]: clock default format incorrect 2015-10-07 13:32:29 +00:00
jan.nijtmans aaa3242a11 Where "interp" is only used for error-reporting, it can be allowed to be NULL. This should fix [5da26d4760]: Tcl_LoadFile() segfaults if "interp" is NULL. 2015-10-07 13:14:27 +00:00
jan.nijtmans 6524bed322 Fix surrogate handling in PrintSourceToObj(), differenciating for TCL_UTF_MAX = 6 (androwish) and TCL_UTF_MAX = 4 (tip-389-impl). No effect when TCL_UTF_MAX = 3. 2015-10-07 08:40:23 +00:00
jan.nijtmans cfea006a9d Fix [b42a851475]: file normalize ~user returns wrong directory on Windows 2015-10-06 14:49:23 +00:00
jan.nijtmans 3a680cc449 Fix [b42a851475]: file normalize ~user returns wrong directory on Windows 2015-10-06 14:25:36 +00:00
jan.nijtmans 7c5ea5b5f1 Revise content of generate win/tclConfig.sh: Make sure that all entries use windows paths with forward slashes. 2015-10-06 09:36:34 +00:00
jan.nijtmans 601fa19fab Revise content of generate win/tclConfig.sh: Make sure that all entries use windows paths with forward slashes. 2015-10-06 09:19:18 +00:00
jan.nijtmans ecd0d69efb Double '[' and ']', otherwise re-generating "configure" doesn't give the expected result. 2015-10-06 08:21:15 +00:00
jan.nijtmans ef310f81a0 Double '[' and ']', otherwise re-generating "configure" doesn't give the expected result. 2015-10-06 08:18:46 +00:00
jan.nijtmans 4c6eb20ea5 Use "cygpath -m" in stead of "cygpath -w", so paths (even windows ones) always have forward slashes. Suggested by pooryorick for [http://core.tcl.tk/tclconfig/tktview/06f1692bbe29449ac3f2161ebf9dd153d0349845|TEA], but a good idea anyway 2015-10-05 09:26:29 +00:00
jan.nijtmans 6a0634acc9 Use "cygpath -m" in stead of "cygpath -w", so paths (even windows ones) always have forward slashes. Suggested by pooryorick for [http://core.tcl.tk/tclconfig/tktview/06f1692bbe29449ac3f2161ebf9dd153d0349845|TEA], but a good idea anyway 2015-10-05 09:23:12 +00:00
dkf 6e716af3b7 [05489ce335] Constrain broken tests. 2015-10-04 10:58:48 +00:00
jan.nijtmans db1ca42627 Eliminate unnessessary end-of-line spacing. No functional change. 2015-10-04 10:20:05 +00:00
jan.nijtmans 677ffa1104 Eliminate unnessessary end-of-line spacing. No functional change. 2015-10-04 10:10:58 +00:00
jan.nijtmans a82b49336a Fix signed<->unsigned compare gcc compiler warning. 2015-10-01 11:18:41 +00:00
jan.nijtmans e24d246c87 Eliminate a few gcc compiler warnings, when using -Wwrite-strings (tested with the brand-new gcc 5.2.0) 2015-10-01 11:04:19 +00:00
jan.nijtmans 56a99d9dd9 Mutch simpler solution to [219866c1e9]: In stead of filtering out version information from the string, make sure that ::platform::generic doesn't contain this version information in the first place. 2015-09-30 13:45:54 +00:00
jan.nijtmans 4cabc332b4 Mutch simpler solution to [219866c1e9]: In stead of filtering out version information from the string, make sure that ::platform::generic doesn't contain this version information in the first place. 2015-09-30 13:44:52 +00:00
jan.nijtmans 7d9ccac72d Fix [738bc50e93]: auto_execok doesn't recognise mklink on windows 2015-09-30 12:59:56 +00:00
jan.nijtmans 3449d223d1 Fix [738bc50e93]: auto_execok doesn't recognise mklink on windows. Remove some unnecessary end-of-line spacing. 2015-09-30 12:57:02 +00:00
jan.nijtmans 0036891363 Don't limit Universal runtime support VisualStudio version 14 only, future versions will probably have it as well. 2015-09-30 11:12:45 +00:00
jan.nijtmans c6f5daec40 Don't limit Universal runtime support VisualStudio version 14 only, future versions will probably have it as well. 2015-09-30 11:11:33 +00:00
jan.nijtmans 9c536234a9 Fix [b1f19286f0]: for command documentation.
Minor addendum to previous commit: Make OS version number available in ::platform::generic for Cygwin
2015-09-30 08:29:57 +00:00
jan.nijtmans 0ad034c3c6 Fix [b1f19286f0]: for command documentation.
Minor addendum to previous commit: Make OS version number available in ::platform::generic for Cygwin
2015-09-30 08:25:37 +00:00
jan.nijtmans e39c8e6b26 Fix [219866c1e9]: platform::identify: regexp doesn't match platform -> platform 1.0.14 2015-09-29 07:48:58 +00:00
jan.nijtmans 829e5981d2 Fix [219866c1e9]: platform::identify: regexp doesn't match platform -> platform 1.0.14 2015-09-29 07:46:08 +00:00
jan.nijtmans b381dafa84 Align comment. Remove some end-of-line spacing. No functional changes. 2015-09-28 11:13:25 +00:00
jan.nijtmans bb34bee773 align comment, no functional change 2015-09-28 11:11:00 +00:00
dgp 1f6b04d51b Backout failed attempt to fix [32ae34e63a]. 2015-09-25 16:43:05 +00:00
jan.nijtmans 27989920c5 proposed fix for [219866c1e9]: platform::identify: regexp doesn't match platform 2015-09-25 10:39:39 +00:00
jan.nijtmans faef5b981f Fix [5d170b5ca5e12743006d737c79f959f3efabc644|5d170b5ca5]: checkin 9f8b7bea5344f1b0 broke netbsd's thread notifier 2015-09-24 11:06:44 +00:00
jan.nijtmans 92b0e12403 Fix [5d170b5ca5e12743006d737c79f959f3efabc644|5d170b5ca5]: checkin 9f8b7bea5344f1b0 broke netbsd's thread notifier 2015-09-24 10:54:07 +00:00
jan.nijtmans 856c560b71 merge trunk 2015-09-24 10:03:20 +00:00
jan.nijtmans daa0c940b8 merge-mark (almost, just a few cosmetic changes) 2015-09-24 10:01:36 +00:00
jan.nijtmans c3eea370e5 Clean-up tclUnixNotfy.c, restructure it the same as "trunk" version. No functional changes. This will make upcoming merging work easier. 2015-09-24 09:55:14 +00:00
dgp c3805dda91 Update tests to new ReflectWatch() behavior. 2015-09-23 17:29:15 +00:00
dgp 02960a691f [e0a7b3e5f8] Add missing UpdateInterest call in DoRead(). 2015-09-23 17:15:53 +00:00
dgp c222d15bd1 [e0a7b3e5f8] Add missing UpdateInterest call in DoRead(). 2015-09-23 17:07:40 +00:00
dgp 93695198d8 [32ae34e63a] Prevent segfaults and data corruption when CopyData() is called recursively.
Mark new test io-53.20 as "knownBug". It demos some unknown flaw in MoveBytes().
2015-09-23 16:58:34 +00:00
dgp f2a99f6167 merge 8.5 2015-09-23 16:37:06 +00:00
dgp 049bb5ecaa [32ae34e63a] Prevent segfaults and data corruption when CopyData() is called
recursively.
2015-09-23 16:29:38 +00:00
dgp 8d4e35dc59 Update tests to account for changed ReflectWatch behavior. 2015-09-23 16:08:30 +00:00
dgp 9bcf18e010 Protect CopyState buffer from conflicting uses when CopyData() is called
recursively. Also, have ReflectWatch() always give driver a chance to act.
2015-09-23 16:00:57 +00:00
dgp df9835efa1 CopyData() now tolerates recursion enough so that io-53.18 does not segfault. 2015-09-23 13:18:32 +00:00
jan.nijtmans bac8bd28c0 Merge trunk 2015-09-23 12:19:12 +00:00
jan.nijtmans 4067fb322f Micro-optimization handling Tcl_Panic(), suggested by D. Richard Hipp.
As a side-effect, this is as well a fix  for [1446864]: segfaults if Tcl_Panic() returns.
2015-09-23 10:29:00 +00:00
dgp 1d9460e1e6 WIP 2015-09-23 09:40:46 +00:00
Miguel Sofer 001513fa18 micro-opt of hash lookups found by drh 2015-09-22 20:57:58 +00:00
dgp 2b9d31917d Reboot the bug fix. 2015-09-22 19:12:46 +00:00
dgp cdf813e288 merge 8.5 2015-09-22 18:24:03 +00:00
jan.nijtmans 9b08e4775f Decorate Tcl_Panic and Tcl_PanicVA with the noreturn option, alowing further optimizations by the C-compiler. 2015-09-22 15:24:11 +00:00
jan.nijtmans e014381903 Eliminate compiler warnings for MSVC 2015-09-22 11:32:11 +00:00
dgp 256865fe12 [187d7f499b] Sync the regexp engine to the Postgres version. 2015-09-21 19:25:20 +00:00
dgp 4669ea6d0c [1115587][0e0e150e49] Major fix for regexp handling of quantified backrefs.
Contributed by Tom Lane from the Postgres project.
2015-09-21 19:04:40 +00:00
dgp 87744f43c9 [d7ea9f985][a3c3508599] Internal regexp fixes that cleanup and streamline. 2015-09-21 18:50:23 +00:00
dgp a6f9ef29ae [d7ea9f985][a3c3508599] Internal regexp fixes that cleanup and streamline. 2015-09-21 18:22:46 +00:00
dgp d32ca76ec2 [a3c3508599] Fix typo that reversed test sense in prior fix for [3610026]. 2015-09-21 17:29:22 +00:00
dgp 0371108cbf [d7ea9f9853] Contributed patch from tgl with Postgres. 2015-09-21 17:14:52 +00:00
jan.nijtmans b29f3e80a5 Fix for [5d170b5ca5] now available for widespread testing (incl. HPUX and OSX) 2015-09-07 08:35:42 +00:00
jan.nijtmans 05956b6b36 Merge trunk.
"paranoia" patch for the notifier, making sure that thread local data from invalid threads are never accessed by the forked main thread.
2015-09-05 20:10:27 +00:00
jan.nijtmans 1ee459aa14 Document that multi-threading is on by default since 8.6 2015-09-04 12:23:18 +00:00
jan.nijtmans 9f4810e640 Remove unnecessary end-of-line spacing (preparing for some further documentation updates) 2015-09-04 07:23:25 +00:00
jan.nijtmans 85699b47e7 In StartNotifierThread() don't lock mutex if thread is already started.
Fix panic message if thread cannot be started. 
Remove asserts used for debugging.
2015-09-03 09:39:43 +00:00
jan.nijtmans 0e03c742fa nonportable -> nonPortable 2015-09-02 13:19:47 +00:00
jan.nijtmans 4c98b8717b Fix the Cygwin notifier, doing the initialization of the thread-local variables exactly the same as the Unix notifier. 2015-09-02 11:54:58 +00:00
dgp 2841bb1300 merge 8.5 2015-09-02 11:06:01 +00:00
jan.nijtmans 4792d8fa00 Merge trunk.
Gustaf's latest and greatest fix.
2015-09-02 09:02:53 +00:00
jan.nijtmans d9762826b9 Various Unicode handling enhancements, when building with TCL_UTF_MAX > 3, inspired by androwish. No effect if TCL_UTF_MAX=3 (which is the default) 2015-09-01 18:54:58 +00:00
jan.nijtmans 932409d7aa Whitespace reduction in Tcl scripts. No functional change. 2015-09-01 15:15:46 +00:00
jan.nijtmans b13ad88718 Merge trunk.
Add Gustaf's latest fix for unit-tests.
2015-08-31 10:41:22 +00:00
jan.nijtmans cdee0fcd74 Some Unicode encoding fixes, only having effect if TCL_UTF_MAX > 4. Backported from androwish 2015-08-31 10:18:31 +00:00
dkf b3892c4018 [7703ff1082] Improved wording. 2015-08-30 20:21:46 +00:00
dkf a3c3dc2581 [7703ff1082] Improved wording. 2015-08-30 20:20:09 +00:00
jan.nijtmans 3d8fa193f4 Completing [00189c4afc]: Allow semi-static UCRT build on Windows with VC 14.0. Now for the configure/makefile build. 2015-08-28 10:57:46 +00:00
jan.nijtmans 6dfc99d7f2 Completing [00189c4afc]: Allow semi-static UCRT build on Windows with VC 14.0. Now for the configure/makefile build. 2015-08-28 10:23:30 +00:00
jan.nijtmans 1439f39555 Fix [7703ff1082]: extra argument ?pattern? of parray is not documented 2015-08-27 14:53:11 +00:00
jan.nijtmans cc771f1b47 Fix [7703ff1082]: extra argument ?pattern? of parray is not documented 2015-08-27 14:49:06 +00:00
dgp 62addcfa82 merge 8.5 2015-08-27 11:48:03 +00:00
jan.nijtmans 6e58473427 merge trunk 2015-08-25 14:07:11 +00:00
jan.nijtmans 570eb6b10d Fix [0df7a1ec2674a76a]: unix/tclUnixFile.c: return value of call to TclpGetCwd in TclpFindExecutable is not checked, variable cwd is used uninitialized. 2015-08-25 11:35:01 +00:00
jan.nijtmans f08cbe00fd Fix [0df7a1ec2674a76a]: unix/tclUnixFile.c: return value of call to TclpGetCwd in TclpFindExecutable is not checked, variable cwd is used uninitialized. 2015-08-25 11:29:58 +00:00
jan.nijtmans 63ba958fe4 Removed "ucrt" as configureable option: If building with VC2014, it's the recommended way to build Tcl. 2015-08-25 10:01:51 +00:00
jan.nijtmans 2974c8e22c Removed "ucrt" as configureable option: If building with VC2014, it's the recommended way to build Tcl. 2015-08-25 09:39:16 +00:00
jan.nijtmans 2da34cb738 Eliminate (harmless) compiler warning. No functional change. 2015-08-21 11:21:41 +00:00
jan.nijtmans 9f8346d54f Eliminate some (harmless) compiler warnings. No functional change. 2015-08-21 10:40:48 +00:00
jan.nijtmans bd0d616070 Fix [00189c4afcb9e2586301d711f71383e48817a72d|00189c4afc]: Allow semi-static UCRT build on Windows with VC 14.0 2015-08-19 15:25:35 +00:00
jan.nijtmans 5dc66dd0c9 Fix [00189c4afcb9e2586301d711f71383e48817a72d|00189c4afc]: Allow semi-static UCRT build on Windows with VC 14.0 2015-08-19 15:23:25 +00:00
jan.nijtmans 023624c3c9 merge trunk.
Remove now unused internal functions.
2015-08-19 11:26:52 +00:00
dkf da2329ba8b [465213d171] Documentation correction for Tcl_NewMethod. 2015-08-18 13:27:46 +00:00
dkf 6916d195ce [2c509f6291] Minor documentation correction from Peter Lewerin. 2015-08-18 12:50:08 +00:00
dkf c892bc1f1d [d06b029d9d] next(n) documentation examples correction, from Peter Lewerin. 2015-08-18 12:47:01 +00:00
dkf 2e4ba03817 [7a87a9bc5b] Eliminate invalid write, found by Rolf Ade using Valgrind. 2015-08-18 07:01:41 +00:00
jan.nijtmans b8a93e8423 remove superfluous fprintf to stderr. 2015-08-17 20:35:15 +00:00
jan.nijtmans 5f6beb1bd2 Merge trunk.
More notifier code cleanup.
2015-08-17 19:39:16 +00:00
dkf 341ea00aaa [818a1a51e4] Apply fixes from Andreas Seltenreich (reported to us by Tom Lane) for handling low memory situations. Should not be reachable in Tcl due to ckalloc() panic policy. 2015-08-17 18:23:20 +00:00
dkf c6028b1641 [818a1a51e4] Apply fixes from Andreas Seltenreich (reported to us by Tom Lane) for handling low memory situations. Should not be reachable in Tcl due to ckalloc() panic policy. 2015-08-17 18:22:18 +00:00
dkf cdcc22a92d Proposed fix for invalid write, found by valgrind. 2015-08-17 18:01:16 +00:00
jan.nijtmans 85469aaecf Merge trunk.
Gustaf's latest Unix Notifier improvements, now fixed to work with Cygwin and single-threaded as well.
2015-08-17 15:21:46 +00:00
dkf 3ad3a0eae3 [e424e31ac7]: Corrected documentation of [regexp -indices] to mention all affected arguments. 2015-08-17 12:35:27 +00:00
dgp 57e43137bd New test attempting to demo Bug [e0a7b3e5f8]. Doesn't work yet. 2015-08-13 19:28:26 +00:00
dgp ed005a749a Disable the filtering of ReflectWatch so that every UpdateInterest() call
flows through to become a [driver watch] evaluation.  This makes new test
io-53.19 pass.
It also makes a collection of 10 test in ioCmd.test start failing, all of
which are recording detailed reflected channel driver command evaluation.
The now unfiltered [driver watch] change this record without (at least
apparently) changing any behavior.  Need review.
2015-08-13 17:02:04 +00:00
dgp 1cc03c884b A bit of code safety, and then a test demonstrating next issue. 2015-08-13 16:45:03 +00:00
dgp cababb3290 Adjustments to failing tests to account for changed [chan postevent]. 2015-08-12 17:49:42 +00:00
dgp ec3c0c79fb New test io-53.18 adapted from demo script in [32ae34e63a]. This test
segfaults without changes to source code.  This checkin also contains
a revised implementationf of [chan postevent] that stops calling
Tcl_NotifyChannel() directly, and queues an event to do it instead.
This stops the segfault, but causes tests iocmd-31.[67] to fail.
Need advice on whether that matters.
2015-08-12 16:37:28 +00:00
venkat 656a0f78c7 Merge tzdata2015f 2015-08-12 05:07:24 +00:00
venkat b50f18b840 Upgrade to tzdata2015f from IETF. 2015-08-12 05:06:26 +00:00
dgp 32a9dde838 Add the critical missing UpdateInterest() call at the exit of DoRead().
(Compare with same approach in DoReadChars()).  This involves removing
some other calls that are now replaced by the new one.
Also marked several UpdateInterest() calls throughout tclIO.c with comments
raising the suspicion that they serve no function.
2015-08-10 19:44:56 +00:00
jan.nijtmans faa471576e Fix [6f74ac47278f437a]: No man link to Tcl_UtfNcasecmp() during install on unix 2015-08-06 04:25:50 +00:00
jan.nijtmans de133cb36a Fix [6f74ac47278f437a]: No man link to Tcl_UtfNcasecmp() during install on unix 2015-08-06 04:24:44 +00:00
jan.nijtmans c24688ad4f Gustaf Neumann's experimental Unix notifier improvements. 2015-08-06 03:43:43 +00:00
Miguel Sofer d1ab32cd40 remove potential crash detected by Coverity (it is a should-never-happen thing) 2015-08-05 19:30:06 +00:00
Miguel Sofer 70c0fd83e8 mark function return as unused, to avoid confusing Coverity 2015-08-05 14:44:19 +00:00
dkf ff00a132ab merge mark 2015-08-03 09:57:12 +00:00
dkf 7e228aa961 Fix problems with break and continue in for-step clauses, triggered by reporting
of Coverity CID 1251203. Some of these were originally bugs in Tcl 8.0.
2015-08-03 07:21:29 +00:00
dkf 4e411a89fe Fix the documentation comment. 2015-08-03 07:18:13 +00:00
dkf 9d7f20adc5 Backport the fixes to handling of continue in for-step clauses. 2015-08-03 07:17:27 +00:00
dkf 93b515b360 And another problem with continue in for-step clauses, this time a problem in how TEBC handled an edge case in the semantics. 2015-08-02 16:17:00 +00:00
dkf 034f00bf1b Fix more problems with break and continue in for-step clauses. 2015-08-02 12:22:02 +00:00
dkf 29603179f4 Fix Coverity CID 1251203: break vs continue in for-step clause 2015-08-01 19:37:04 +00:00
Miguel Sofer 33a7feeefd explicitly ignore Tcl_PushCallFrame and TclPushStackFrame return value - it is always TCL_OK. Inconsistency found by coverity (CID 1251197) 2015-08-01 19:00:39 +00:00
Miguel Sofer f795c9e131 fix off-by-one possible buffer overrun when looking for encodings; found by coverity 2015-07-31 22:05:20 +00:00
Miguel Sofer 743ef38cdc fix typo found by Coverity; no effect on "most" platforms (is there anyone where it would matter?) 2015-07-31 00:01:52 +00:00
Miguel Sofer b62b6bd490 remove unnecessary checks found by coverity 2015-07-30 22:56:57 +00:00
Miguel Sofer 90beed4f41 remove self-assignment - found by Coverity 2015-07-30 18:57:30 +00:00
sebres f4fe4153ee Fix bug [f00009f7ce]: memory (object) leaks in TclNativeCreateNativeRep for windows platform:
missing decrement of refCount, because of confusing differently behavior Tcl_FSGetTranslatedPath vs Tcl_FSGetNormalizedPath.
2015-07-30 18:22:27 +00:00
Miguel Sofer 0b6ed354d1 add comment to flag Tcl_Panic as no-return for Coverity Scan static analyzer 2015-07-30 18:10:39 +00:00
sebres a6c191c2ea Fix bug [f00009f7ce]: memory (object) leaks in TclNativeCreateNativeRep for windows platform (erroneous Tcl_IncrRefCount removed) 2015-07-30 13:02:49 +00:00
dgp 7dfee7792b [3e7eca8c8c] Prevent overflow in size values passed to allocators. 2015-07-29 14:56:20 +00:00
dgp a16827f77e [3e7eca8c8c] Prevent overflow in size values passed to allocators. 2015-07-29 14:54:13 +00:00
dgp e91db44e66 [3e7eca8c8c] Prevent overflow in the size value passed to ckrealloc(). 2015-07-29 10:03:46 +00:00
dgp aa7b8f6ccb [3e7eca8c8c] Prevent overflow in the size value passed to ckrealloc(). 2015-07-29 03:06:30 +00:00
jan.nijtmans 7578a2c2bd Fix bug [57945b574a6df0332efc4ac96b066f7c347b28f7|57945b574a]: lock in forking process under heavy multithreading. Thanks to Joe Mistachkin for the implementation of the fix, and Gustaf Neumann for the original report and testing the fix. 2015-07-23 17:09:58 +00:00
jan.nijtmans 7d2d8c6e11 Fix bug [57945b574a6df0332efc4ac96b066f7c347b28f7|57945b574a]: lock in forking process under heavy multithreading. Thanks to Joe Mistachkin for the implementation of the fix, and Gustaf Neumann for the original report and testing the fix. 2015-07-23 16:53:42 +00:00
dgp fff7447683 [a3309d01db] Plug memleak in compiled [unset a($i)]. 2015-07-18 05:52:57 +00:00
dgp d17930c875 Add the missing cleanup bits in INST_UNSET_ARRAY. 2015-07-18 05:27:00 +00:00
dgp dfd5e62014 merge trunk 2015-07-18 02:39:02 +00:00
dgp c4bd26e054 Fix failing test 2015-07-18 01:45:06 +00:00
dgp 5bb79143c1 merge trunk 2015-07-17 21:22:22 +00:00
dgp 67b1d52de2 Test for original meaning of [unset -nocomplain --]. FAILS! 2015-07-17 21:17:48 +00:00
dgp dd3c1d71f7 Test for original meaning of [unset -nocomplain --]. 2015-07-17 21:15:26 +00:00
dgp 324a884128 [a3309d01db] Test the demonstrates leak in branch off checkin that starts it. 2015-07-17 19:33:08 +00:00
dgp 90fbc0fe78 [9bad630c31] Prevent read outside of buffer bounds. 2015-07-15 17:59:13 +00:00
dgp db73017a4a [9bad630c31] Prevent read outside of buffer bounds. 2015-07-15 17:57:34 +00:00
dgp 1a4e6b5d92 [b1534b438b] Prevent read outside buffer boundaries. 2015-07-15 17:20:19 +00:00
dgp 60a6f1779d [b1534b438b] Prevent read outside buffer boundaries. 2015-07-15 17:17:03 +00:00
jan.nijtmans 7b49d1632e Increase some counter sizes related to filesystem epoch from int to size_t. And prevent them ever becoming 0 due to an overflow. (backported with variation from androwish) 2015-07-15 14:47:32 +00:00
jan.nijtmans a7f9c92001 merge trunk 2015-07-15 11:17:12 +00:00
jan.nijtmans 5500c15d8a Eliminate the definition of L_tmpnam. It isn't used anywhere within Tcl any more. (backported from androwish) 2015-07-15 08:36:46 +00:00
andy 1b5d2f150d Spell out [info exists] in example code for [exit] command. 2015-07-14 21:38:05 +00:00
dkf 444cb185b8 Implement TIP 436: Improve TclOO isa Introspection 2015-07-10 12:41:57 +00:00
dkf 22932eb228 Added tests. 2015-07-10 12:40:49 +00:00
oehhar 2ee3ddac8a Documentation: source ignores BOM for unicode files 2015-07-07 14:20:26 +00:00
oehhar 8037d27915 Documentation: source ignores BOM for unicode files 2015-07-07 14:16:07 +00:00
dgp 4ce2c3e6e7 [a0ece9d6d4] The cmd field of a CmdFrame when non-NULL must point within the
string of the corresponding codePtr->source.
2015-07-05 16:52:27 +00:00
dgp b00e732483 Plug leak of two mp_ints. 2015-07-02 13:46:56 +00:00
dgp 20dafdc09e Revert refcount changes that were not cosmetic.
Changing equality testing to inequality testing does more than make code
prettier or clearer.  It makes it less strict, and thus more tolerant of
other bugs elsewhere.  Such changes deserve separate consideration at least,
not breezy entry in an otherwise "code cleanup" commit.
2015-07-02 12:54:57 +00:00
dgp 9aa3e85104 Revert some refcount changes on I/O structs.
These are refcounts on structs, not Tcl_Obj's.  Their scheme doesn't suffer
the same difficulties and histories as Tcl_Obj's, and they need not copy
every detail, appropriate or not, from Tcl_Obj refcount management.
The "significant value" -- as dkf puts it -- for the struct refcounting scheme
is 0 not 1.
2015-07-02 12:29:43 +00:00
jan.nijtmans fb6b7a8d8d Remove unnecessary end-of-line spacing in compat/*.c 2015-07-02 12:17:26 +00:00
jan.nijtmans 4cd9155ae9 Another round of refCount consistancy improvements. 2015-07-02 08:17:50 +00:00
Miguel Sofer 0918bf8c7b remove code that was ifdef'ed out for ages (ENABLE_NS_VARNAME_CACHING), has zero hope of being revived and got out of sync anyway 2015-07-02 03:15:21 +00:00
jan.nijtmans fec1116ba7 Don't use internalRep.otherValuePtr any more, twoPtrValue.ptr1 is always a better idea.
A few more consistancies in refcount management.
2015-07-01 13:12:57 +00:00
dkf 261a4a6282 Say what is meant more clearly, put syntax checks before semantic checks. 2015-07-01 09:58:42 +00:00
dkf bbb80087ae Implementation of TIP #436: Improve TclOO isa Introspection 2015-07-01 09:45:04 +00:00
jan.nijtmans 73484694b5 Consistancy in refcount management. 2015-06-30 21:41:18 +00:00
dkf 6af49e65ad Correct handling of dictionaries in the background error processing code. 2015-06-30 14:39:56 +00:00
dkf 12cc9a424d merge head 2015-06-30 14:39:17 +00:00
dkf f63cfcaea3 Correct handling of dictionaries in the background error processing code. 2015-06-30 14:36:24 +00:00
oehhar 502287c9dd "mcpackagelocale present" is more elegant 2015-06-30 14:32:12 +00:00
jan.nijtmans 63aa951254 Use twoPtrValue in stead of ptrAndLongRep for implementation of some internal Obj types. On most platforms this doesn't make a difference,
as (void *) and (long) generially have the same size. The only exception where it makes a difference is win64, as we can now store 64 bits in this field in stead of only 32 bits, exactly what the processor is optimized for.
2015-06-30 08:10:15 +00:00
oehhar 0698861f80 [TIP 412] msgcat dynamic locale change and package private locale (msgcat 1.6.0) 2015-06-29 21:44:12 +00:00
oehhar 352740916d Added tests for mcforgetpackage, mcpackagelocale and mcpackageconfig 2015-06-29 21:26:24 +00:00
venkat 987b08480c Merge tzdata2015e from ietf.org 2015-06-28 01:55:06 +00:00
venkat b87531a583 Summary: Update to tzdata2015e from ietf.org 2015-06-28 01:54:06 +00:00
oehhar 52f920ba57 Tests for mcexists and mcloadedlocales 2015-06-26 15:16:34 +00:00
oehhar 14476f18e0 Manpage, callback fail calls bgerror, clean catalog on packagelocale unset 2015-06-26 13:41:31 +00:00
jan.nijtmans 2b81ec85d4 revert unintended change of .settings/org.eclipse.core.resources.prefs in previous commit 2015-06-25 08:05:18 +00:00
jan.nijtmans c56e67115f Fix bug in "make dist" when system-encoding is UTF-8: eolFix will then translate some windows-specific files to UTF-8 too.
Solution: commit those files with CRLF line-ending, which eliminates the need for eolFix altgether.
See als: [495120] for the reason why eolFix was introduced in the first place. No longer needed with fossil.
2015-06-25 08:02:17 +00:00
jan.nijtmans 14f9ede961 Fix bug in "make dist" when system-encoding is UTF-8: eolFix will then translate some windows-specific files to UTF-8 too.
Solution: commit those files with CRLF line-ending, which eliminates the need for eolFix altgether.
See als: [495120] for the reason why eolFix was introduced in the first place. No longer needed with fossil.
2015-06-25 07:52:36 +00:00
jan.nijtmans 50ccb92ce7 Tcl_GetStringFromObj(..., NULL) -> Tcl_GetString(...). Use size_t in stead of int for more internal variables. 2015-06-24 14:28:47 +00:00
dgp d150ddf591 Silence compiler warning. 2015-06-24 13:56:36 +00:00
dgp 3ea3c1f2f9 Make sure that an input lying precisely 1/2 ULP between two floating point values is rounded to even. 2015-06-24 13:55:46 +00:00
jan.nijtmans 71ef3ba082 Registry extension 1.3.0 -> 1.3.1: SendMessageTimeoutA -> SendMessageTimeout, so make sure only win32 UNICODE API is used. 2015-06-23 21:47:41 +00:00
jan.nijtmans 51adf20eaf Member field which should not have been const, because it is dynamically allocated. Some end-of-line spacing in header files. 2015-06-23 20:32:33 +00:00
jan.nijtmans fde157fe11 Member field which should not have been CONST, because it is dynamically allocated 2015-06-23 19:58:38 +00:00
jan.nijtmans c793ae92e4 If the file system changes when "cwd" changes, force a filesystem refresh on path objects. Needed for AndroWish/TclKit (???) in obscure situations, harmless on systems which only have a single native filesystem. 2015-06-23 13:04:09 +00:00
oehhar 2972e0894d Merge trunk 2015-06-22 12:40:27 +00:00
Kevin B Kenny 9c52f7a98a Make sure that an input lying precisely 1/2 ULP between two floating point values is rounded to even. 2015-06-20 20:44:17 +00:00
dgp 0985259acd Remove lines of code made obsolete by earlier changes. 2015-06-19 15:35:14 +00:00
dgp 0132d11834 [a4cb3f06c4] Fix edge case handling in lreplace. Many more tests. 2015-06-18 17:33:52 +00:00
dgp ad6cba5a8e From aspect, several edge case coverage tests. 2015-06-18 17:26:59 +00:00
jan.nijtmans f43007cdd8 Upgrade all internal Unicode tables from Unicode 7.0 to Unicode 8.0 2015-06-18 12:54:30 +00:00
jan.nijtmans e6c567a325 Upgrade all internal Unicode tables from Unicode 7.0 to Unicode 8.0 2015-06-18 12:24:53 +00:00
Joe Mistachkin 7ba021af61 Rename the new API to TclMutexUnlockAndFinalize as it is not platform-specific. 2015-06-17 20:32:01 +00:00
jan.nijtmans d4bb7bdf65 Change Tcl_MutexUnlockAndFinalize() to internal function TclpMutexUnlockAndFinalize(). This does not require a TIP, and still should fix the reported bug. 2015-06-16 15:24:51 +00:00
jan.nijtmans 5fc6bbc782 Fix [e770d92d76]: Add support for higher baud rates in Tcl 2015-06-16 08:41:38 +00:00
jan.nijtmans d948ee6daa Fix [e770d92d76]: Add support for higher baud rates in Tcl 2015-06-16 07:39:37 +00:00
aspect e008d75c19 lreplace: more tests, doc improvement 2015-06-16 03:33:22 +00:00
aspect ea9f9ac81e fix for a4cb3f06c4fe - bug introduced in 32b61592465 2015-06-16 00:41:39 +00:00
Joe Mistachkin e99979bfcf Plug memory leaks in the Tcl_ZlibInflate() error handling code. Fix for ticket [478c446889]. 2015-06-11 02:47:41 +00:00
hypnotoad 2d6d821ea4 Patch to add support for higher baud rates under Unix Ticket [e770d92d76]] 2015-06-10 21:53:47 +00:00
Joe Mistachkin 5c4acfb73f The unit for usleep() is microseconds, not milliseconds. 2015-06-08 20:56:50 +00:00
dgp 4c5f334c06 Stop documentation lie about command rename traces and comment lie about
what's done with them in TclOO.
2015-06-08 17:19:09 +00:00
dgp 51bbc67659 Stop telling lie about command delete traces. 2015-06-08 17:17:14 +00:00
Joe Mistachkin 0f3896176d Merge thread test typo fixes from trunk. 2015-06-05 19:59:59 +00:00
Joe Mistachkin 2e30712093 Fix typo in three thread tests. 2015-06-05 19:58:42 +00:00
Joe Mistachkin 9cfa94b1da Add stress test. 2015-06-05 19:56:12 +00:00
Joe Mistachkin 810baa10b8 Merge updates from trunk. 2015-06-04 20:49:11 +00:00
dgp 6f63d23863 [268b23df11] Revised patch to create phony source string when the
original script does not actually contain the command being invoked.
(Example: the tcl::mathfunc::* command invoked via [expr] interpretation)
2015-06-03 19:08:15 +00:00
dgp aef7e0d6d9 Put the ellipsis inside, not outside, the close quote. 2015-06-03 17:40:10 +00:00
dgp 94d9bfa884 [268b23df11] When GetSrcInfoForPc() returns NULL, make sure it also sets
the length to a non-positive value so nothing tries to read offsets from
a NULL pointer.
2015-06-03 12:26:38 +00:00
oehhar 6f959222be Make all msgcat tests pass 2015-06-01 15:16:58 +00:00
oehhar 8f43773d55 clock.tcl modified that all clock tests pass 2015-05-31 19:03:56 +00:00
oehhar b4cd8e5d9c merge trunk 2015-05-31 16:20:06 +00:00
dgp 15c03f09c9 merge trunk 2015-05-28 12:28:48 +00:00
Joe Mistachkin 7f5f2ddc7f Make sure the necessary mutexes are in a well-known state across calls to fork(). 2015-05-28 00:53:33 +00:00
Joe Mistachkin d249a8af5d Fix typo in previous check-in. 2015-05-27 22:34:53 +00:00
Joe Mistachkin e8d057ad67 Make sure the master and mutex locks are in a well-known state across the fork() call. 2015-05-27 22:29:25 +00:00
andreask 450b7aafd0 Make tweak to the mem-debug tracking official. It is now again possible to use regular packages with a mem-debug core without inciting a panic. 2015-05-27 18:35:46 +00:00
andreask a0d647ab06 Make tweak to the mem-debug tracking official. It is now again possible to use regular packages with a mem-debug core without inciting a panic. 2015-05-27 18:25:38 +00:00
dkf 8c32ef71da Added missing marker for incompatibility. 2015-05-26 10:16:24 +00:00
jan.nijtmans 756d989440 Remove useless code, trying to sync win32 environment variables with cygwin's. cygwin1.dll is responsible for doing that. Taken over from cygwin's tcl fork. 2015-05-25 20:23:09 +00:00
jan.nijtmans d93aaadc5e Remove useless code, trying to sync win32 environment variables with cygwin's. cygwin1.dll is responsible for doing that. Taken over from cygwin's tcl fork. 2015-05-25 19:15:25 +00:00
Joe Mistachkin 17420ef9f0 Minor compilation issue fix, make sure variable declaration (via macro) is first. 2015-05-22 23:26:29 +00:00
andreask 907aebaab8 Moved Tcl_Obj* objThreadMap release tracking to a location where regular packages will call through, enabling their full tracking by the core, and thus avoiding the "expected to create new entry for object map" panic seen otherwise. 2015-05-22 20:21:48 +00:00
Joe Mistachkin 967856b8f8 Additional mutex locking/unlocking during fork() to keep things synchronized. 2015-05-21 17:58:49 +00:00
dgp 2ce1ce01c5 Missed a bit 2015-05-20 15:15:46 +00:00
dgp babd0b88a0 [29044ba23f] Remove RANLIB as part of library installation. At best it's
redundant to the RANLIB already done as part of library build.  At worst, it
conflicts with needs of cross-compiling.  Thanks Erik Leunissen.
2015-05-20 15:12:50 +00:00
dgp 0f54d7701d Don't change autoconf version by accident. 2015-05-20 13:45:33 +00:00
dgp bd81f35273 merge trunk 2015-05-20 13:37:21 +00:00
dkf deaa520c80 Simplify code generation for a list of literals. Generates slightly simpler bytecode too. 2015-05-19 20:34:10 +00:00
dkf acdb6bc384 Tidier version. 2015-05-19 20:29:47 +00:00
dgp 6be68f173f Don't cause string rep generation in [list <lit> <lit> ... <lit>] bytecode.
Candidate for merge to trunk to simplify bytecode.
2015-05-19 19:22:48 +00:00
dkf 0ae5b5b3c1 regenerate configure 2015-05-18 20:41:46 +00:00
Joe Mistachkin 0dd03dfef9 First attempt at implementing the necessary auto-magic for usleep. 2015-05-18 20:33:56 +00:00
Joe Mistachkin 2e3d1fac48 Adjust tweaks from the previous check-in to prepare for configure detection of usleep(). 2015-05-18 18:23:29 +00:00
dkf fdf990faf5 [11250a236d] Made the documentation of non-greediness overrides more obvious. 2015-05-18 08:20:43 +00:00
dkf 58f3361635 [c11a51c482] Stop race condition with -accept config option, and allow overriding of it via -headers option. 2015-05-18 07:51:54 +00:00
Joe Mistachkin 282b159f3b Temporary tweaks to allow Thread package tests to pass on Unix. 2015-05-17 23:45:53 +00:00
Joe Mistachkin e403d82b18 This should completely fix the race conditions at the cost of more complexity. Also, on Unix, a more reliable means than Tcl_Sleep() of sleeping for a short time is needed. 2015-05-17 22:13:39 +00:00
Joe Mistachkin c489e47329 Update header file with the TIP number. 2015-05-17 20:13:59 +00:00
Joe Mistachkin a32cc9b49b Fix deadlock. 2015-05-17 20:10:47 +00:00
Joe Mistachkin e3a528bc44 Merge updates from trunk. 2015-05-17 19:49:44 +00:00
Joe Mistachkin 12d28d084d Fix typo in the previous check-in. 2015-05-17 19:46:04 +00:00
Joe Mistachkin fc49271c0a Draft fix for a potential race condition in the new Tcl_MutexUnlockAndFinalize API. Not yet tested. 2015-05-17 18:03:15 +00:00
dkf 8c1c07d4bf [ad6696285c] Correction of description of filter behaviour with 'unknown'. 2015-05-17 12:56:06 +00:00
dkf 4240cb00f0 [ad6696285c] Demonstrate that filters are not called for destructors. 2015-05-17 12:06:31 +00:00
Joe Mistachkin 1a30606518 Reword and clarify the doc changes from the previous check-in. 2015-05-16 06:59:27 +00:00
Joe Mistachkin 99cc729bd2 First draft of the necessary doc changes. 2015-05-16 06:49:00 +00:00
dkf 9d64916f18 [0f42ff7871] Remove unintentional difference between interpreted and compiled [next]. 2015-05-15 14:40:00 +00:00
dkf c9e70a3901 [9dd1bd7a74] Ensure that [self] returns a sensible value in a destructor even when construction didn't complete. 2015-05-15 13:54:52 +00:00
dgp c11a7a6b08 Bump to http 2.8.9 2015-05-14 11:19:27 +00:00
dkf 6135265f5c [6a71dbe6ec] Ensure that compression errors log correctly. 2015-05-14 08:23:52 +00:00
dkf 1913208e18 [b9d0434667] Prefer the gzip encoding for transfers. It's less efficient, but
it is far more interoperable and that's a more important metric.
2015-05-14 08:05:37 +00:00
dgp 73deb43f4f Added contributed tests from aspect 2015-05-12 15:00:16 +00:00
dgp 205345779a merge trunk 2015-05-12 14:45:48 +00:00
dgp 92ce12cc43 test portability 2015-04-30 15:31:42 +00:00
dgp 1754a9a311 Test portability. 2015-04-30 15:31:17 +00:00
dgp 91d8b69074 merge mark 2015-04-29 20:35:05 +00:00
dgp d3e04b3a76 Use joinable threads to avoid thread finalization crashes. 2015-04-29 20:34:26 +00:00
dgp 3b743160f6 [894da183c8] Test and fix for regression in flushing blocked channels. 2015-04-29 18:16:36 +00:00
dgp 09d67aff95 [894da183c8] Test and fix for regression in flushing blocked channels. 2015-04-29 18:00:15 +00:00
dgp 227d96bf13 [894da183c8] Fix and test for bug at the point it was introduced. 2015-04-29 16:34:33 +00:00
venkat fd9d40cb5b Merge tzdata2015d from ietf.org 2015-04-29 07:56:01 +00:00
venkat f108505a5b Update to tzdata2015d from ietf.org 2015-04-29 07:54:51 +00:00
dgp 90b9288358 [879a0747be] Repair handling of incomplete multi-byte chars at the ends of input buffers. Also properly reset input encoding flags when cycling through a fleeting EOF condition. 2015-04-24 20:17:12 +00:00
dgp 5ecd3fa2b6 [879a0747be] Repair handling of incomplete multi-byte chars at the ends
of input buffers.  Also properly reset input encoding flags when cycling
through a fleeting EOF condition.
2015-04-24 20:06:27 +00:00
dgp a46cd743dd Fix UtfToUtfProc() to remove the potential to read beyond end of input buffer. 2015-04-24 15:48:56 +00:00
dgp ae445193f4 Fix UtfToUtfProc() to remove the potential to read beyond end of input buffer. 2015-04-24 15:47:58 +00:00
oehhar 459a48dc5c Open linked folder shared on Windows - Patch [19ea026e43] 2015-04-23 12:17:53 +00:00
oehhar 1590eb50c5 Open linked folder shared on Windows - Patch [19ea026e43] 2015-04-23 11:21:41 +00:00
jan.nijtmans c3f11e7741 Fix [8065d178229d8d335eee64d36ada37c4dedf2579|8065d17822]: Duplicate -DNDEBUG in compiler command with --disable-symbols 2015-04-20 10:35:20 +00:00
Miguel Sofer 9f710e45a9 bring in dgp's improvements to zippy 2015-04-17 20:52:12 +00:00
dgp c472223773 Reduce the list walking by keeping lastPtr fields. 2015-04-16 12:27:04 +00:00
dgp 7f030a6b44 Revise the zippy dance that pushes Blocks and Tcl_Objs back the shared pool
so that the overal operation remains a FIFO.  This help preserve cache locality
where it exists.  The price (for now) is a bit more time walking to the end
of free lists.  If this is important, the addition of a lastPtr field could
fix it without difficulty.
2015-04-15 19:57:41 +00:00
jan.nijtmans de7a370d58 Fix [a0a251e4e478977334da51e346cddff8ec3fbf52|a0a251e4e4]: tcl 8.6.4 compilation on windows with msys and VS2013 fails 2015-04-10 09:23:39 +00:00
Joe Mistachkin 63f824a7e9 Add new public Tcl C API to allow a mutex to be unlocked and then finalized atomically. Candidate fix for bug [57945b574a]. 2015-04-09 19:53:39 +00:00
dkf 805cd597f9 Don't warn about warnings that are suppressed correctly now. 2015-04-09 09:27:00 +00:00
dkf 1f2fb4cf5b Squelch otherwise-unavoidable OSX warnings. It's like magic! 2015-04-09 09:20:29 +00:00
Miguel Sofer 3d5869fb4b improve comments for TclMarkTailcall and friends 2015-04-08 19:08:57 +00:00
dgp 6d6afda39d Correction suggested by miguel. Passes test suite and fixes bug demos. 2015-04-08 16:42:33 +00:00
dgp 7fc61f369b Proposed fix. 2015-04-08 14:37:58 +00:00
dkf c6e6569dfe Don't fetch values we don't need. 2015-04-04 11:47:53 +00:00
dgp bc7e4c5d68 There's no need to constrain the declaration of Tcl_GetMemoryInfo(). 2015-03-24 18:27:09 +00:00
dgp cd70770139 Tcl source code already assumes the <limits.h> file is available.
(See tcl/libtommath/tommath.h .)  So dispose of all the configuration
shenanigans pretending we want to support systems that lack one.
2015-03-24 17:34:05 +00:00
Miguel Sofer 63e0947392 fix comments describing tailcall implementation 2015-03-23 16:05:04 +00:00
Miguel Sofer 4ed03a1f4b fix comments describing tailcall implementation 2015-03-23 13:46:08 +00:00
Miguel Sofer ee626d5909 more comments 2015-03-23 13:43:37 +00:00
Miguel Sofer d4166a6b3a updated, improved tailcall comments 2015-03-23 02:11:30 +00:00
Miguel Sofer e325a4742e branch for ordering and grouping the tailcall related code, and especially clean up the comments 2015-03-23 01:01:30 +00:00
Miguel Sofer 2cc11d4918 completing the fix for bug d87cb182053fd79b3 2015-03-23 00:33:07 +00:00
Miguel Sofer 7dbf5ed0b0 adding a test to reveal a problem with the fix of bug d87cb182053fd79b3 2015-03-21 15:08:35 +00:00
dgp 1292a0d927 [d87cb18205] Let compiled ensembles handle tailcalls properly. 2015-03-21 00:31:29 +00:00
dgp 6003e823bf Remove STRICT directive from public header. It does approximately nothing,
and doesn't belong in generic code.
2015-03-20 19:57:13 +00:00
ashok 50426ba9c5 Ticket [e66e444440]. Modified ReadConsoleBytes to handle Ctrl-C / Ctrl-Break
and not return 0 bytes indicating EOF for those cases.
2015-03-19 10:41:28 +00:00
dgp f399206c21 Upon further review, due the order of #include of headers, we do not have
a history of a #define STRICT active when the #include "windows.h" in
tclWinPort.h happens.  Don't want to start something new now.
2015-03-13 17:14:16 +00:00
dgp b2c41c81e4 The STRICT directive influences how #include "windows.h" works.
This is not a generic concern.  Move it over the tclWinPort.h.
2015-03-13 16:55:39 +00:00
dgp 0e5a1e2642 merge release 2015-03-12 14:47:17 +00:00
dgp 74708147ba update changes 2015-03-11 12:30:39 +00:00
dgp b199b80ba8 merge trunk 2015-03-11 12:26:36 +00:00
dgp 226278b0ac merge mark 2015-03-11 12:25:52 +00:00
Kevin Walzer 2c4d707b8f Fix or at least improvement for Tcl/Tk Cocoa event loop by forcing Tcl_ServiceAll() event processing: http://core.tcl.tk/tk/tktview/3028676fffffffffffffffffffffffffffffffff 2015-03-10 14:44:47 +00:00
Kevin Walzer 544df0c1b8 Fix or at least improvement for Tcl/Tk Cocoa event loop by forcing Tcl_ServiceAll() event processing: http://core.tcl.tk/tk/tktview/3028676fffffffffffffffffffffffffffffffff 2015-03-10 14:41:03 +00:00
dgp 8c7378b541 .RS/.RE balance 2015-03-06 19:55:38 +00:00
dgp 4f07b18244 make html must tolerate bundled packages using configure.ac over configure.in. 2015-03-06 19:48:31 +00:00
dgp f396811dd5 product of a make dist 2015-03-06 19:43:42 +00:00
dgp 83f6249875 merge mark 2015-03-06 16:39:07 +00:00
dgp 27503d10cd merge release 2015-03-06 15:26:03 +00:00
dgp 761a093174 repair nroff breakage 2015-03-06 15:06:02 +00:00
dgp 97739f4d09 repair nroff breakage 2015-03-06 14:59:11 +00:00
dgp f14d6cb130 products of "make dist" 2015-03-06 14:38:38 +00:00
dgp 07bc28e627 update release date 2015-03-06 14:17:48 +00:00
dgp 4a22756b41 update changes 2015-03-03 21:29:08 +00:00
dgp 94f2309f51 merge trunk 2015-03-02 22:38:09 +00:00
ashok dfc57be3b1 Deleted Win95/98-specific documentation as those platforms have long been unsupported. 2015-03-02 08:54:14 +00:00
dgp ec9c80bba9 autoconf-2.59 2015-02-26 16:58:52 +00:00
dgp 7e79080ed7 Bump to 8.6.4. 2015-02-26 16:57:59 +00:00
dgp 75e1a82785 update changes 2015-02-24 15:08:02 +00:00
dgp 434f351abc merge 8.5 2015-02-20 20:22:17 +00:00
dgp 8104f5f53d [32b6159246] Accept aspect patch for broken [lreplace] bytecode.
No more [lreplace {1 2 3} 2 0] => 1 2 2 3
2015-02-20 20:19:48 +00:00
dgp b3e2027137 [e08c2c407b] The getHandleProc routine in the Tcl_Channel struct is optional. Update the docs to make that clear. 2015-02-20 19:30:48 +00:00
dgp 28fe834bc3 [e08c2c407b] The getHandleProc routine in the Tcl_Channel struct is
optional.  Update the docs to make that clear.
2015-02-20 19:29:20 +00:00
bch 2919fd5221 per ticket [e08c2c407b053bbfaab] (and stray code related to [84f208762f172e]) adj code to passing test suite 2015-02-19 22:01:36 +00:00
bch e4089d79b3 Do not fault! Tcl_Panic()! - improvements to handling Tcl_CreateChannel() args 2015-02-19 19:19:42 +00:00
bch 87e36a4aa9 backout backwards-incompatible experiment that was accidentally committed 2015-02-19 19:16:37 +00:00
bch 6d6598bbcb sync w/ [trunk] 2015-02-19 18:57:26 +00:00
aspect bb005f26e4 undo erroneous change in [1fa2e32e07] 2015-02-19 06:29:18 +00:00
aspect b8674e42d2 handle [lreplace l x y ...] where y<x 2015-02-19 02:42:13 +00:00
aspect 48650316e3 (core ticket [32b6159246]) Fix for [lreplace l x y] where y<x-1 2015-02-19 02:34:43 +00:00
dgp b1ad5d16a7 merge 8.5 2015-02-12 15:13:32 +00:00
venkat d90a15ace1 merge tzdata2015a from ietf.org 2015-02-11 23:54:00 +00:00
dkf fc506f9ca9 Even clearer failure messages. 2015-02-11 15:56:27 +00:00
dgp 48bab372b9 merge mark 2015-02-11 03:43:22 +00:00
venkat f6b7fa43d6 merge tzdata2015a from ietf.org 2015-02-11 00:19:01 +00:00
bch 4214c7a3a9 inputProc and outputProc tests run conditionally on TCL_READABLE, TCL_WRITABLE mask 2015-02-08 05:04:33 +00:00
bch 02cc7437b2 switch raw assert() to Tcl_Panic() per discussion w/ dkf 2015-02-07 21:19:05 +00:00
bch 9d3e75eb7a merge [trunk] 2015-02-07 21:12:18 +00:00
dgp 4d7ebbdc94 update changes 2015-02-06 19:56:56 +00:00
dgp 22ce6aeb4b merge 8.5 2015-02-05 19:24:27 +00:00
dgp 2fabe1cead Backport of channel mem leak fix that got missed before. 2015-02-05 19:23:35 +00:00
dgp 4b3f548c27 Bump to version 8.5.18. 2015-02-05 18:17:07 +00:00
dgp 3f9555d4c2 Fix [08872796bc] 2015-01-29 18:39:11 +00:00
dgp 8acaf40209 Test for bug [08872796bc]. 2015-01-29 18:36:45 +00:00
dgp 8ee4bdf94d Test for bug [08872796bc]. 2015-01-29 18:34:50 +00:00
dgp 579463bcec Protect against extension variable resolvers that fail to play by the post-Var Reform rules. 2015-01-29 17:48:19 +00:00
dgp 2f36a2d349 Protect against extension variable resolvers that fail to play by
the post-Var Reform rules.
2015-01-29 17:37:59 +00:00
jan.nijtmans 6a233e935b Fix [df08482b042a16007f256bfbaaacfbe0def01074|df08482b04]: Double defined INFINITY in regguts.h 2015-01-26 20:56:01 +00:00
jan.nijtmans 4d5ff6cd13 Fix [df08482b042a16007f256bfbaaacfbe0def01074|df08482b04]: Double defined INFINITY in regguts.h 2015-01-26 20:47:23 +00:00
bch acad581479 truncateProc *can* be NULL 2015-01-21 00:21:18 +00:00
bch 52d37c087d assert() on missing definitions for Tcl_ChannelCreate() required struct Tcl_ChannelType{} fields. 2015-01-20 23:40:23 +00:00
dgp 5e6453d592 merge mark 2015-01-02 22:43:45 +00:00
dgp f16ec6e776 Now that we're using TCL_ENCODING_NO_TERMINATE - be careful about acting on
the contents of dst -- they could be leftovers.  Only check bytes reported
to have been written and take care to get the assertions right.
2015-01-02 22:42:12 +00:00
dgp 42c1a1e15a Revert use of the install-headers target. Tcl 8.5 has no such target. 2015-01-02 15:19:23 +00:00
dgp 5cd16427f7 Add two new (undocumented) flags to the Tcl_ExternalToUtf() interface.
TCL_ENCODING_NO_TERMINATE rejects the default behavior of appending a
terminating NUL byte to the produced Utf output.  This permits use of all
of the dstLen bytes provided, and simplifies the buffer size calculations
demanded from callers.  Perhaps some callers need or appreciate this default
behavior, but for Tcl's own main use of encodings - conversions within I/O -
this just gets in the way.
TCL_ENCODING_CHAR_LIMIT lets the caller set a limit on the number of chars
to be output to be enforced by the encoding routines themselves.  Without
this, callers have to check after the fact for going beyond limits and
make multiple encoding calls in a trial and error approach.
Full compatibility is supported.  No defaults are changed, and the flags
have their effect even if an encoding driver has not been written to support
these flags (but greater efficiency is enjoyed if they do!).
All of Tcl's own encoding drivers are updated to support this.  Other encoding
drivers may exist somewhere, but I cannot point to any.
A TIP to document this and make it officially supported may come in time.
2014-12-23 18:39:35 +00:00
dgp 1ddabb17f9 Support TCL_ENCODING_CHAR_LIMIT in TableToUtfProc and EscapeToUtfProc drivers. 2014-12-23 17:53:21 +00:00
dgp a3babfe12a Support TCL_ENCODING_CHAR_LIMIT in the Iso88591ToUtfProc driver. 2014-12-23 17:48:36 +00:00
dgp b6fecacc22 Support TCL_ENCODING_CHAR_LIMIT in the UnicodeToUtfProc driver. 2014-12-23 17:46:05 +00:00
dgp 360b5c41ee Support TCL_ENCODING_CHAR_LIMIT in the UtfToUtfProc driver. 2014-12-23 17:26:07 +00:00
dgp 5a6443d00e Support TCL_ENCODING_CHAR_LIMIT in the BinaryProc driver. 2014-12-23 17:13:13 +00:00
dgp 7134cd9399 Use the new TCL_ENCODING_CHAR_LIMIT flag to have the encoding system manage
the max chars to read constraint.
2014-12-23 16:57:02 +00:00
dgp 1a92fb378c merge trunk 2014-12-23 03:11:01 +00:00
dgp ef6f1ba2c3 Use more suitable variable name pushers. 2014-12-23 02:41:54 +00:00
dgp b0078c8129 Eliminate TclIsLocalScalar(). No callers left. 2014-12-23 02:12:59 +00:00
dgp 49e7d0262b Revise CompileEachloopCmd() to use LocalScalar() in place of TclIsLocalScalar(). 2014-12-23 01:28:30 +00:00
dgp 2cbec4bf44 Convert the LocalScalar*() macros to rest on TclPushVarName rather than on
TclIsLocalScalar().
2014-12-22 20:27:14 +00:00
dgp 7ac39417f1 Use (interp == NULL) argument to TclPushVarName() to signal that no compiling
is desired.  Only a lookup of an index into the compiled variable table.
2014-12-22 20:13:29 +00:00
dgp 3faf4cc3b8 More complete use of the TCL_NO_ELEMENT flag to suppress useless actions. 2014-12-22 19:57:36 +00:00
dgp 9f699d22a2 merge mark 2014-12-22 17:12:50 +00:00
dgp 13667e8096 One more (interp==NULL) shortcut. 2014-12-22 15:35:47 +00:00
dgp 51f7688e96 merge-mark. The compiler machinery has changed too much for any hope for
a successful merge.  TclIsLocalScalar() elimination will need to be done
on trunk as an independent effort.
2014-12-19 17:57:04 +00:00
dgp f6d6b394eb Revise name and interface of new utility routines to match work already
in place on the trunk.
2014-12-19 17:09:32 +00:00
dgp 7e44dabec3 [e711ffb458] Eliminate TclIsLocalScalar() and revise all callers to use
more appropriate facilities.
2014-12-19 16:09:20 +00:00
dgp cfefe7127b New utility routine GetLocalScalarIndex() reduces common caller boilerplate
(and fixes a bug!)
2014-12-19 15:55:21 +00:00
dgp 2613112a13 Use interp==NULL argument to PushVarName to signal that only an index into
the CLT is sought, and no time should be wasted compiling other cases which
the caller is just going to discard.
2014-12-19 15:13:11 +00:00
dgp 18131f9c09 With no callers left, TclIsLocalScalar() is removed. 2014-12-19 14:21:42 +00:00
dgp baf649278a Replace TclIsLocalScalar() with PushVarNameWord() in [dict for] compiler. 2014-12-19 14:17:03 +00:00
dgp 88ec3c9772 Narrow scope of numVars. 2014-12-19 03:31:09 +00:00
dgp ad19550909 A bit more tidying... 2014-12-18 22:25:27 +00:00
dgp aed72bee30 No need for a loopIndex. 2014-12-18 22:13:11 +00:00
dgp f65cb994d8 No need for varvList any more. 2014-12-18 22:00:08 +00:00
dgp 893c9c7302 Fix up the token array passed to PushVarNameWord. Remove string list parse. 2014-12-18 21:29:07 +00:00
dgp 24817641b1 Replace use of TclIsLocalScalar() and late setting of varIndexes with an
earlier setting of varIndexes using PushVarNameWord().
2014-12-18 21:08:53 +00:00
dgp 89e6a65411 Simplify creation and storage of temporaries 2014-12-18 20:38:53 +00:00
dgp f664d633e6 With that shift, varcList is no longer needed. 2014-12-18 20:34:12 +00:00
dgp d56e61b246 Shift the allocation of AuxData earlier in the [foreach] compiler. 2014-12-18 19:21:31 +00:00
dgp 8dd58baa04 merge 8.5 2014-12-18 18:16:10 +00:00
dgp 559113cc4c [7c187a3773] Fix error in managing inStatePtr->inQueueTail value in the
byte-moving optimized path of [chan copy].  Thanks to Benno.
2014-12-18 18:06:51 +00:00
dgp 5dafefe112 [af08e89777] Rework finalization to stop encoding-24.2 segfault. 2014-12-18 14:38:26 +00:00
dgp 955507f635 Rework the *FinalizeThread*() routines so that the quick exit preference
is respected without need to run afoul of encoding finalizations.
tests pass now.  All changes are fully internal.
2014-12-17 20:47:58 +00:00
dgp e942227f6e Revise encoding finalization so that it does a more complete job of restoring
the pre-initialized state.  This makes finalization errors more repeatable
and cross-platform.
2014-12-17 19:57:40 +00:00
oehhar 68b5780dde changes for TIP427 2014-12-17 11:21:16 +00:00
oehhar 3b7664e77f Include option -connecting in test iocmd-8.15.1 2014-12-17 08:42:24 +00:00
oehhar b47b88af9b TIP-427: make "fconfigure $h -connecting" official (client sockets only) 2014-12-17 08:24:33 +00:00
oehhar d7a9d63520 Documented "fconfigure $h -connecting" on socket man page 2014-12-17 08:22:23 +00:00
oehhar f716d8815b Merge trunk 2014-12-17 07:53:41 +00:00
jan.nijtmans 4e0313afe2 85 -> 86 2014-12-15 10:20:39 +00:00
jan.nijtmans d9b30b94b8 merge-mark 2014-12-14 12:13:30 +00:00
Kevin Walzer 2f8ea1be7c Add header install flag to OS X GNUMakefile; thanks to Stephan Houben for patch 2014-12-13 02:50:07 +00:00
Kevin Walzer 59cb45cc16 Add header install flag to OS X GNUMakefile; thanks to Stephan Houben for patch 2014-12-13 02:47:25 +00:00
dgp ee5c231ff5 Similar conversion of the [dict append] compiler. 2014-12-11 16:00:19 +00:00
dgp 604faa265f Similar conversion for [dict update] compiler. 2014-12-11 15:45:16 +00:00
dgp 8e80c62f6f Similar revisions to [dict incr] compiler. 2014-12-11 15:19:38 +00:00
dgp a417c667a5 Get the word number right, even though it has no effect. 2014-12-11 14:41:09 +00:00
dgp 26326004c6 [e711ffb458] Same conversion for [catch] compiler. 2014-12-11 14:40:02 +00:00
venkat 0318c256ed merge tzdata2014j from ietf.org 2014-12-10 00:37:24 +00:00
venkat 704532c57a tzdata2014j from ietf.org 2014-12-10 00:35:37 +00:00
dgp 2d415cbf59 [e711ffb458] Replace TclIsLocalScalar() with PushVarNameWord() in the
compiler for [dict set].
2014-12-09 20:45:30 +00:00
dgp 916f1716f3 [e711ffb458] Replace TclIsLocalScalar() (which does the wrong thing).... with
PushVarNameWord() (which doesn't) in the compiler for [dict lappend].
2014-12-09 20:29:09 +00:00
jan.nijtmans d297273a13 Fix some gcc compiler warnings (probably cygwin-only) 2014-12-08 16:10:00 +00:00
jan.nijtmans b27238fbbb Fix some gcc compiler warnings (probably cygwin-only) 2014-12-08 16:05:19 +00:00
oehhar 7466351c90 test for bug [c6ed4acfd8]: running async socket connect with other connect established will block tcl as it goes in an infinite loop in vwait 2014-12-07 12:17:24 +00:00
ashok 58bde2cb77 Potential fix for [c6ed4acfd8].
Simple typo in original fix for [336441ed59]. Was looping on
statePtr->next instead of statePtr2->next. Would result in
an infinite loop. Definitely a bug but whether it completely
fixes the above in all cases needs to be tested.
2014-12-06 11:19:32 +00:00
dgp 40420634aa Ever since (Tcl)PushVarName() stopped making a recursive call to Tcl_ParseCommand() (in the pre-8.4.0 timeframe), there's been no need for special protections for brace-quoted varname words. A simple word is a simple word is a simple word. 2014-12-05 21:28:00 +00:00
dgp b52476a5cd Ever since (Tcl)PushVarName() stopped making a recursive call to
Tcl_ParseCommand() (in the pre-8.4.0 timeframe), there's been no need
for special protections for brace-quoted varname words.  A simple word
is a simple word is a simple word.
2014-12-05 21:05:17 +00:00
dgp bc8ffb3922 [d2ffcca163] Limit parsing results that are documented to accept only ASCII chars to actually follow that constraint. This requires not trusting isalnum(.) and isalpha(.) to deliver portable identical results. 2014-12-05 12:28:01 +00:00
dgp bfb321eb38 [d2ffcca163] Limit parsing results that are documented to accept only
ASCII chars to actually follow that constraint.  This requires not trusting
isalnum(.) and isalpha(.) to deliver portable identical results.
2014-12-04 22:10:57 +00:00
dgp 5c1b9fefdf Limit isalpha(.) calls in the expr parser to only apply to known ASCII
arguments to make the results portable.
2014-12-04 21:29:18 +00:00
dgp 6d936db4a3 The isalpha(.) calls remaining in the expr parser still bring nonportability.
Commit a test that demonstrates that.
2014-12-04 20:45:11 +00:00
dgp dd4c175c81 Stop using isalnum(.). Its results are not portable. Replace with our
own private routine TclIsBareword() that does exactly what we want.
2014-12-04 18:26:31 +00:00
dgp 29b10229de merge 8.5 2014-12-04 13:02:43 +00:00
dgp bff00baca2 And then another merge mark to finish. 2014-12-03 23:55:39 +00:00
dgp 7dfd9c5a96 Now make the patch by hand that fossil could not merge. 2014-12-03 23:54:16 +00:00
dgp 05971adca4 Just a merge mark since fossil cannot do it right. 2014-12-03 23:51:36 +00:00
dgp 2f3edeea43 [0c043a175] backport fix from trunk. 2014-12-03 23:46:51 +00:00
Miguel Sofer 0c0be35710 missing unset in new test 2014-12-03 23:34:36 +00:00
Miguel Sofer 137e142be2 fix var($) problem, bug [0c043a175] (thx dgp) 2014-12-03 23:27:45 +00:00
Miguel Sofer 8694763c10 test and fix (thx dgp) 2014-12-03 23:17:16 +00:00
dkf 58cd08bb7d [0dca3bfa8f] Strengthen validity checks on fast-path string comparison. 2014-12-03 23:05:15 +00:00
Miguel Sofer 730a9a132c adding a test for the bug 2014-12-03 13:22:53 +00:00
andreask d7cf041bab Fix missing export of the "NewForeachInfoType" AuxData structure for tbcload/tclcompiler packages. 2014-12-01 20:17:04 +00:00
dgp 03f0d60f88 Same issue in expr parser also tested and fixed. 2014-11-26 17:00:55 +00:00
dgp 92402afe21 I like this patch better. Retain the byte orientation of the parser. 2014-11-26 16:22:40 +00:00
dgp d9465a5be2 One way to fix the parser of $-substitution accepting non-ASCII varnames. 2014-11-25 21:24:06 +00:00
dgp 52bcb866e5 merge trunk 2014-11-24 03:11:23 +00:00
dgp 7f5ddf43ee [e087812465] Trim back operatorStrings array to just the entries that are needed. Trims away the part of the array that was out of sync with the opcodes. 2014-11-24 03:08:50 +00:00
dgp 484de8b987 [e087812465] Trim back operatorStrings array to just the entries that are
needed.  Trims away the part of the array that was out of sync with the opcodes.
2014-11-24 03:00:03 +00:00
jan.nijtmans 2b3e403550 Fix [743338466549f09e3956d8a86e6f9a8030f227cb|7433384665]: socket error encoding bug. 2014-11-21 13:05:31 +00:00
dgp fa8d5668aa merge trunk 2014-11-17 13:00:42 +00:00
dgp 24d57ad4ff Add to Tcl_ExternalToUtf() a capability to impose a limit on the number
of chars produce in the encoding result.  When the flag
TCL_ENCODING_CHAR_LIMIT is set and dstCharsPtr is not NULL, then the
initial value of *dstCharsPtr is taken as the max number of chars to produce.
The limit is imposed in a way that does not require the assistance of the
encoding's driver procs, but the flag is passed on to them in case they
can do better when they know they should.  No callers updated yet.
No drivers updated yet.

One difficulty is that this necessarily imposes a pre-translation limit,
and the I/O system has a history of wanting to impose only a post-translation
limit.
2014-11-15 21:46:19 +00:00
dgp 3185389da2 With no padding needed for a terminating NUL, there no need for a distinction
between the dstNeeded and dstLimit values.
2014-11-15 21:13:52 +00:00
dgp 164250cf86 Tcl_ExternalToUtf appends a terminating NUL to its encoded results.
Perhaps this is a welcome convenience for some callers, but not for Tcl's
I/O system, which has no need for that.  Added a new flag value
TCL_ENCODING_NO_TERMINATE that callers can use to suppress this behavior.
This means buffers don't require so much padding, and a tiny bit of processing
is saved.  Update I/O callers to use the feature.
2014-11-15 21:08:57 +00:00
jan.nijtmans 9c2149012b Remove a number of eol-spaces. No change in functionality. 2014-11-14 09:44:34 +00:00
jan.nijtmans 6e056b1e14 Simplify NativeIsComPort() implementation: native paths never end in ':', and never use forward slashes (any more), so no need to check for that. 2014-11-13 16:08:47 +00:00
jan.nijtmans 99ee3e86d7 Improve documentation on the use of com ports (remove references to Windows 95, deprecate the use of postfix ':').
Allow lpt[5-9] just as com[5-9], and make sure that path normalization works as expected for ports > 4.
2014-11-13 12:52:29 +00:00
jan.nijtmans 3bbc2317b3 Improve documentation on the use of com ports (remove references to Windows 95, deprecate the use of postfix ':').
Allow lpt[5-9] just as com[5-9], and make sure that path normalization works as expected for ports > 4.
2014-11-13 12:29:04 +00:00
dgp 7d10d699c7 merge release 2014-11-12 04:35:37 +00:00
dgp 620cf6fa02 Likely fix for channel mem leaks. 2014-11-11 22:23:57 +00:00
dkf 98e4ac55d2 [214cc0eb22] Add tests to make sure that this bug stays fixed. 2014-11-08 07:06:52 +00:00
dgp eb64ed3cf0 Correct -singleproc 1 testing flaws. 2014-11-07 17:48:31 +00:00
dgp 5e0d1d6bc5 update changes; more test suite polishing. 2014-11-07 14:10:23 +00:00
dgp 7565b9ff1e Make sure all uses of the [testbytestring] command are constrained. 2014-11-07 13:59:27 +00:00
andreask 10dc783c93 Merged latest trunk work (especially changes to eof handling) into the RC. 2014-11-06 18:38:36 +00:00
dgp 0c027bb706 cleanup global namespace litter 2014-11-06 17:34:40 +00:00
dgp c658976cc3 [5adc350683] Stop Tcl forcing EOF condition on channels to be permanent. It may be fleeting, and all parts of Tcl channel ecosystem have to deal with that. New assertions and tests to keep us on track. 2014-11-06 16:34:03 +00:00
dgp 1db5ff8c2c [5adc350683] Stop Tcl forcing EOF condition on channels to be permanent.
It may be fleeting, and all parts of Tcl channel ecosystem have to deal
with that.  New assertions and tests to keep us on track.
2014-11-06 16:24:02 +00:00
dgp fbba7d0b1e merge iogt fixes. 2014-11-06 16:20:44 +00:00
dgp 559b8ab9de Also test transfroms that delay. 2014-11-06 16:12:26 +00:00
dgp 60ef43cb8c fix failing test 2014-11-06 15:49:30 +00:00
dgp 5c6717b7d5 New test iogt-7.0 demos bug in [testchannel transform]. 2014-11-06 15:06:52 +00:00
dgp 2f8dae1cec Another test checking that handling when transform returns nothing is right. 2014-11-06 14:52:36 +00:00
dgp dac552ac0b New tests iortrans-4.11* demonstrate what was wrong with the "leaky EOF flag"
approach in 8.6.1 and earlier.  If each level of the channel stack is to have
control over its EOF independently, we have to provide for that, even though
the Filesystem read APIs make it a big pain.  Also test robustness against
varing buffer sizes.
2014-11-06 13:38:01 +00:00
dgp 53ae611583 Reflected Transform channel fix. Be sure each EOF on the base channel gets
passed up to become an eof of the transform before continuing on to additional
ReadRaw() from the base channel.  This way we don't miss fleeting EOFs.
2014-11-05 20:34:03 +00:00
dgp 57de194b09 New test iortrans-4.10 to demo failure of channel transformation to handle
fleeting EOF in the base channel.  Falls into infinite block.  Regression
compared with Tcl 8.6.1.
2014-11-05 16:47:00 +00:00
dgp 5204910c12 merge trunk 2014-11-05 16:39:16 +00:00
dgp 71d27bd9c6 [214cc0eb22] Restore [lappend $var] return value to the 8.6.1- behavior.
If this is going to change, lets not do it by accident.
2014-11-05 06:36:07 +00:00
dgp 3fa4ffc77a Make sure reflected channels do not make a double call to Tcl_ReadRaw(),
with the unwarranted assumption that EOF is a permanent condition.
2014-11-03 21:37:37 +00:00
dgp d2b69b306e Same patch re-enabling read after EOF, but here applied to 8.6.
Likely additional changes needed in the other channel transforms new in 8.6.
2014-11-03 21:04:24 +00:00
dgp db9946ccc3 merge 8.5 2014-11-03 20:54:12 +00:00
dgp cb0895755d [5adc350683] Reworked the management of the EOF states to re-enable the
ability to read beyond EOF.  Plenty of assert()s to keep thing from going
off track again.
2014-11-03 20:39:25 +00:00
jan.nijtmans b14c2f49d2 Add test-case for previous commit, which shows that when trying to open a filename with invalid characters gives the right error-message. (same bug existed on UNIX too, which is now fixed) 2014-11-03 12:54:25 +00:00
jan.nijtmans 48ab03f3cd Add test-case for previous commit, which shows that when trying to open a filename with invalid characters gives the right error-message. (same bug existed on UNIX too, which is now fixed) 2014-11-03 12:44:55 +00:00
jan.nijtmans de82a1a99e Better errormessage when file path contains invalid characters. 2014-11-03 10:23:06 +00:00
jan.nijtmans 7ec17e20d3 Better errormessage when file path contains invalid characters. See: [03414f517b7a74]. 2014-11-03 10:14:48 +00:00
dgp d95273cf0e Disable assertion until tls bug it detects is fixed. 2014-11-01 14:52:55 +00:00
jan.nijtmans f87735c127 Extend WinIsReserved() to recognize COM[5-9]: as valid com ports as well. Prevent possible buffer-overflow if COM name ends with ':'. 2014-10-31 11:14:24 +00:00
jan.nijtmans 1e769e4b57 Extend WinIsReserved() to recognize COM[5-9]: as valid com ports as well. 2014-10-31 10:57:25 +00:00
jan.nijtmans a8dc863399 When translating a reserved devicename to native pathname, strip ':' postfix. Possible fix for [dcc03414f5], but anyway a good idea. 2014-10-31 10:20:03 +00:00
jan.nijtmans 476a68cbe5 When translating a reserved devicename to native pathname, strip ':' postfix. Possible fix for [dcc03414f5], but anyway a good idea. 2014-10-31 09:59:36 +00:00
dgp 54d2883694 Base test for [5adc350683]. 2014-10-29 14:54:11 +00:00
dgp 5a9b116846 merge 8.5 2014-10-29 13:49:46 +00:00
dgp df4391e23f Work in progress restoring ability to [read] after [eof] and get non-empty
strings back in those cases where the channel has them to offer.  Also
working through all the implications of this possibility on Tcl's more
exotic channel features, like stacking.
2014-10-28 20:10:32 +00:00
dgp 717a98747d merge trunk 2014-10-28 13:06:56 +00:00
jan.nijtmans 915359ddce Support for Windows 10 2014-10-26 07:53:23 +00:00
jan.nijtmans 999c88ea06 Support for Windows 10 2014-10-26 07:51:22 +00:00
dgp 790fed46bb merge mark 2014-10-24 20:10:39 +00:00
dgp da01ebeabe merge release 2014-10-24 20:07:52 +00:00
dgp 91d5ac9d0b by request 2014-10-22 14:46:33 +00:00
dgp adff5bc1c6 merge trunk 2014-10-18 22:43:06 +00:00
dgp eee56ee95a update changes 2014-10-18 20:11:36 +00:00
dgp 9cf7e2a336 merge 8.5 2014-10-18 20:06:02 +00:00
dgp 93082a74a2 [10dc6daa37] New fix for [gets] on non-blocking channel. This time properly accounts for the effects of ENCODING_LINESIZE. 2014-10-18 20:03:08 +00:00
dgp 9f2c3815f7 [10dc6daa37] New fix for [gets] on non-blocking channel. This time
properly accounts for the effects of ENCODING_LINESIZE.
2014-10-18 19:50:19 +00:00
dgp 592ab670f3 [10dc6daa37] [gets] on a non-blocking channel must take care so that
1) At least one call to the channel driver input proc gets made.
       Failure to do this locks up the channel - catastrophic FAIL. 
    2) After any driver call reports BLOCKED, don't call again.
       This is less serious, but FAILs to respect the non-blocking setting.
Code corrections and tests included, to restore 8.5.15 compat.
2014-10-17 15:20:34 +00:00
oehhar c0e8db49d5 fconfigure -peername and -sockname return empty string while async connect running. 2014-10-17 12:52:15 +00:00
oehhar d7604e5728 New tests: 14.16: -peername empty while async connect running, 14.17: -sockname 2014-10-17 12:28:55 +00:00
oehhar 8e5b3b87a5 Merge trunk 2014-10-17 10:00:39 +00:00
dgp d31d858702 Bump to Tcl 8.6.3, TclOO 1.0.3, and update changes file. 2014-10-14 18:12:36 +00:00
dgp 1234267c92 missed a bump 2014-10-13 17:34:12 +00:00
dgp 59491ce8ca update changes file 2014-10-13 17:15:55 +00:00
dgp ef89704696 Resolve test conflicts over global vars 2014-10-10 20:37:58 +00:00
dgp 1ce240e90f Bump to 8.5.17 2014-10-10 20:17:12 +00:00
dgp c132978e4b merge mark 2014-10-10 20:02:40 +00:00
dgp 59f2031ac5 backport those tests that can be 2014-10-10 20:02:00 +00:00
dgp f85490f4e1 [bf7135428c] Restore the Tcl_Write() return value logic. 2014-10-10 19:56:06 +00:00
dgp c2be2a28e0 [bf7135428c] Restore the Tcl_Write() return value logic. 2014-10-10 19:54:19 +00:00
dgp 4977df535f [ed29c4da21] Completed fix for [chan copy] handling [chan blocked]. 2014-10-10 19:44:54 +00:00
ferrieux 182bace1e3 Add Colin's test for coro floor above street level [Bug #3008307] 2014-10-10 19:36:17 +00:00
dgp 1f33c7ae12 Another test so both DoRead and MBRead are covered. 2014-10-10 19:02:37 +00:00
dgp 78c2c1cedf [ed29c4da21] Merge patch from 8.5, still not a complete fix. 2014-10-10 18:28:31 +00:00
dgp 186ecf8003 [ed29c4da21] Don't let BLOCKED state get converted into a channel error. 2014-10-10 18:24:32 +00:00
dgp 56c0b11912 New test io-53.15 for [ed29c4da21]. 2014-10-10 16:13:53 +00:00
dgp 1df1505d69 New test io-53.15 for [ed29c4da21]. 2014-10-10 15:38:15 +00:00
dgp 1a08ae6fb4 [2039178] Remove false claims about TCL_INTERP_DESTROYED flag bit in command traces. 2014-10-09 14:56:27 +00:00
dgp 891a0ade43 [2039178] Remove false claims about TCL_INTERP_DESTROYED flag bit in command traces. 2014-10-09 14:52:48 +00:00
jan.nijtmans 29d06499aa Fix [59a2e78e54d3361c33b8cd6eef55d384d8abecd7|59a2e78e54] : tclWinTime.c does not compile with MSVC14.
Eliminate use of __MINGW32__ macro everywhere, as it is deprecated.
2014-10-08 07:11:53 +00:00
jan.nijtmans ea97de415f Fix [59a2e78e54d3361c33b8cd6eef55d384d8abecd7|59a2e78e54] : tclWinTime.c does not compile with MSVC14.
Eliminate use of __MINGW32__ macro everywhare, as it is deprecated.
2014-10-08 07:02:34 +00:00
dgp b327c90dcc fix [bc1a96407a] 2014-10-03 20:20:12 +00:00
dgp cd1372b52d test cases 2014-10-03 15:47:38 +00:00
dgp 3b4cf982e3 Possible fix for testing. 2014-10-02 21:40:13 +00:00
dgp 7c4da917a7 [bc1a96407a] Partial solution should avoid crash, but may lead to wrong behavior. 2014-10-02 17:43:16 +00:00
dgp e36d384130 [bc5b790099] Improper calculation of new dstLimit value. New test io-12.7. 2014-10-02 14:46:54 +00:00
dgp 5e53c4c296 [bc5b790099] Improper calculation of new dstLimit value. New test io-12.7. 2014-10-02 14:43:10 +00:00
Miguel Sofer 78fcaa3580 Backing out commit [cddbfc3081], fix for bug [82521bfb6734f891dd]
The "optimisation" in that commit assumes that the last byte in the
generated bytecodes is an INST_TRY_CONVERT if it equals 64. This is an
invalid assumption, it could be 64 and not be an instruction.
2014-09-27 21:36:06 +00:00
ferrieux 11db57d058 Applied patch by Andreas Leitgeb so that [string cat]'s compiled bytecode optimally groups args by 255 for INSTR_STR_CONCAT1. 2014-09-27 20:28:47 +00:00
oehhar 822a2b50f7 Implemented tip-427: socket fconfigure option -connecting plus no -peername,-sockname when still connecting. 2014-09-26 12:05:30 +00:00
dgp fc21aee814 comment fix 2014-09-25 18:47:32 +00:00
dkf d06897f3ea Added a script-readable bytecode disassembler in tcl::unsupported. 2014-09-20 12:37:19 +00:00
dkf 1598658a83 Tidy things up a bit more. 2014-09-20 11:40:35 +00:00
jan.nijtmans 192fa71096 merge-mark 2014-09-17 10:47:21 +00:00
stwo 76db7c5c04 Better pic flag for OpenBSD. 2014-09-16 15:52:44 +00:00
stwo 85f3786d9c Better pic flag for OpenBSD. 2014-09-16 15:48:48 +00:00
dkf 5e0835667d whitespace tweak 2014-09-14 17:11:33 +00:00
dkf 26fe5fff38 merge trunk 2014-09-14 16:51:49 +00:00
dgp d75135cca1 [cee90e4e88] Correct error in stack depth checking. 2014-09-10 22:17:21 +00:00
dkf a5dd225e78 [2486824] Improve error message; not all that upvars is an upvar. 2014-09-10 08:24:59 +00:00
dkf 5f9519213f [2486824] Improve error message; not all that upvars is an upvar. 2014-09-10 08:20:46 +00:00
dkf 7bce68fe3b [84af1192f5]: [regsub] compiler no longer confused by quantification handling. 2014-09-09 19:49:08 +00:00
ferrieux 600ace1c4b Refine TclFinalizeThreadData so that the quick-exit optimization really only affects exit. 2014-09-08 22:50:11 +00:00
dgp 62004c9fb4 Exceptional handling of oo::class has to be consistent throughout. 2014-09-08 21:22:05 +00:00
stwo 976c48a7f1 Change one '#ifdef' to '#if defined()' for improved consistency within the file,
as in checkin [211aa43013].
2014-09-08 00:37:22 +00:00
dgp a3b501f125 Remove unused macros. 2014-09-05 19:04:43 +00:00
dgp 13d8cae724 Make corrections to long-false comments. 2014-09-05 18:30:57 +00:00
dkf 303cced03d [ccc2c2cc98]: lreplace edge case 2014-09-05 10:05:05 +00:00
dgp 3f8809d6ec Remove ChannelHandlerEvent struct, which has never been used in all of
recorded Tcl history.
Still need to purge comments of mentions of ChannelHandlerEventProc()
which is similarly pre-historic.
2014-09-04 22:05:21 +00:00
ferrieux b47df5123e Distinguish hanging from crashing in exit tests. 2014-09-03 19:44:29 +00:00
ashok 996c102b1f [132fad6fde]. Fixed GetCache to use TclpSysAlloc+memset instead
of calloc. Now consistent with tclWinThrd.c which no longer
uses malloc in its TclpSysAlloc implementation.
2014-09-03 15:48:56 +00:00
dkf 2e512ffbe8 merge trunk 2014-08-30 08:30:00 +00:00
Kevin B Kenny aa2667b729 merge trunk 2014-08-02 19:20:06 +00:00
Kevin B Kenny 0bab3624a9 merge trunk 2014-06-29 02:20:31 +00:00
dkf c0726f8f4f merge trunk 2014-02-08 07:54:21 +00:00
dkf 39ddd8c91b improve the testing of the disassembly commands 2014-02-08 07:54:04 +00:00
dkf d69c1d382b merge trunk 2014-02-08 07:41:17 +00:00
dkf 14b32b82e1 merge trunk 2014-02-04 09:09:06 +00:00
dkf 3f60452ac2 merge trunk 2014-02-03 22:29:31 +00:00
dkf 75b361386e merge trunk 2014-01-09 21:20:23 +00:00
dkf f3dba34e63 merge trunk 2013-09-26 16:32:21 +00:00
dkf 36a7db47de merge trunk 2013-09-20 13:02:29 +00:00
dkf 97323cd8a0 merge trunk 2013-08-22 07:09:21 +00:00
dkf 8fa124afba merge trunk 2013-07-07 11:57:55 +00:00
dkf df623b6abe Properly encode more operand types to reduce the number of special cases in the disassembler. 2013-06-20 11:05:20 +00:00
dkf 3ef97fba38 merge trunk 2013-06-19 22:46:10 +00:00
dkf a261f7d413 Remove extra scribblings not normally needed. Thanks to jdc for suggestion. 2013-06-17 14:04:28 +00:00
dkf 50cc521ee3 Improved rendering of some opcode arguments and auxdata. 2013-06-13 21:21:22 +00:00
dkf 48205fa50d merge trunk 2013-06-13 08:31:24 +00:00
dkf 9fb06ec1c9 Extract more of the info from the bytecode. 2013-06-12 08:55:15 +00:00
dkf f9e188bad3 merge trunk 2013-06-11 21:40:51 +00:00
dkf 6b65756937 Code-readable disassembler: tcl::unsupported::getbytecode 2013-06-11 21:33:33 +00:00
dkf a74538b064 merge trunk 2013-06-11 08:34:09 +00:00
dkf 55787f4f08 Move the disassembler to its own file. 2013-06-11 08:19:56 +00:00
dkf 0d59c187fe merge trunk 2013-06-09 17:38:20 +00:00
dkf 4d2add8f0f merge trunk 2013-06-08 13:42:46 +00:00
oehhar a4ced94ae6 clock uses new msgcat features 2012-09-20 09:53:02 +00:00
oehhar 496eb965ff (proposal) msgcat with dynamic mc file load on locale change 2012-09-19 20:40:14 +00:00
oehhar c2423634f2 TIP#399 implementation: mcconfig may add additional glob pattern for mcload 2012-09-19 20:31:48 +00:00
362 changed files with 18434 additions and 16443 deletions
+10
View File
@@ -0,0 +1,10 @@
tools/tcl.hpj.in
tools/tcl.wse.in
win/buildall.vc.bat
win/coffbase.txt
win/makefile.bc
win/makefile.vc
win/rules.vc
win/tcl.dsp
win/tcl.dsw
win/tcl.hpj.in
+10
View File
@@ -0,0 +1,10 @@
tools/tcl.hpj.in
tools/tcl.wse.in
win/buildall.vc.bat
win/coffbase.txt
win/makefile.bc
win/makefile.vc
win/rules.vc
win/tcl.dsp
win/tcl.dsw
win/tcl.hpj.in
+8
View File
@@ -913,6 +913,14 @@ a better first place to look now.
* win/nmakehlp.c: Let "nmakehlp -V" start searching digits after the
found match (suggested by Harald Oehlmann).
2012-09-19 Harald Oehlmann <oehhar@users.sf.net>
IMPLEMENTATION OF TIP#412.
* library/msgcat/msgcat.tcl: dynamic locale change with mc file
* library/clock.tcl: load on locale change.
clock uses new msgcat features.
2012-09-07 Harald Oehlmann <oehhar@users.sf.net>
*** 8.6b3 TAGGED FOR RELEASE ***
+1 -1
View File
@@ -1,5 +1,5 @@
README: Tcl
This is the Tcl 8.6.2 source distribution.
This is the Tcl 8.6.4 source distribution.
http://sourceforge.net/projects/tcl/files/Tcl/
You can get any source release of Tcl from the URL above.
+82 -4
View File
@@ -8303,11 +8303,11 @@ reported usage of large expressions (porter)
Many optmizations, improvements, and tightened stack management in bytecode.
--- Released 8.6.1, September 20, 2013 --- http://core.tcl.tk/tcl/ for details
--- Released 8.6.1, September 20, 2013 --- http://core.tcl.tk/tcl/ for details
2013-09-27 (enhancement) improved ::env synchronization (fellows)
2013-10-20 (bug fix)[2835313] segfault from
2013-10-20 (bug fix)[2835313] segfault from
[apply {{} {while 1 {a {*}[return -level 0 -code continue]}}}] (fellows)
2013-10-22 (bug fix)[3556215] [scan %E%G%X] support (fellows)
@@ -8451,6 +8451,84 @@ include ::oo::class (fellows)
2014-08-25 (TIP 429) New command [string cat] (leitgeb,ferrieux)
--- Released 8.6.2, August 27, 2014 --- http://core.tcl.tk/tcl/ for details
--- Released 8.6.2, August 27, 2014 --- http://core.tcl.tk/tcl/ for details
2014-08-28 (bug)[b9e1a3] Correct Method Search Order (nadkarni,fellows)
=> TclOO 1.0.3
*** POTENTIAL INCOMPATIBILITY ***
2014-09-05 (bug)[ccc2c2] Regression [lreplace {} 1 1] (bron,fellows)
2014-09-08 (bug)<oo-1.18.2> Crash regression in [oo::class destroy] (porter)
2014-09-09 (bug)[84af11] Regress [regsub -all {\(.*} a(b) {}] (fellows)
2014-09-10 (bug)[cee90e] [try {} on ok {} - on return {} {}] panic (porter)
2014-09-20 (feature) [tcl::unsupported::getbytecode] disassember (fellows)
2014-09-27 (enhancement) [string cat] bytecode optimization (leitgeb,ferrieux)
2014-09-27 (bug)[82521b] segfault in mangled bytecode (ogilvie,sofer)
2014-10-02 (bug)[bc5b79] Hang in some [read]s of limited size (rogers,porter)
2014-10-03 (bug)[bc1a96] segfault in [array set] of traced array (tab,porter)
2014-10-08 (bug)[59a2e7] MSVC14 compile support (dower,nijtmans)
2014-10-10 (bug)[ed29c4] [fcopy] treats [blocked] as error (rowen,porter)
2014-10-10 (bug)[bf7135] regression in Tcl_Write() interface (porter)
2014-10-18 (bug)[10dc6d] fix [gets] on non-blocking channels (fassel,porter)
2014-10-26 Support for Windows 10 (nijtmans)
2014-10-31 (bug)[dcc034] restore [open comX: r+] (lll,nijtmans)
2014-11-05 (bug)[214cc0] Restore [lappend v] return value (sayers,porter)
2014-11-06 (bug)[5adc35] Stop forcing EOF to be permanent (porter)
--- Released 8.6.3, November 12, 2014 --- http://core.tcl.tk/tcl/ for details
2014-11-21 (bug)[743338] Win: socket error encoding (ladayaroslav,nijtmans)
2014-12-01 (bug) restore tbcload/tclcompiler support (kupries)
2014-12-03 (bug)[0c043a] Fix compiled [set var($) val] (porter)
2014-12-04 (bug)[d2ffcc] Limit $... and bareword parsing to ASCII (ladayaroslav,porter)
*** POTENTIAL INCOMPATIBILITY ***
2014-12-06 (bug)[c6cd4a] Win: hang in async socket connection (shults,nadkarni)
2014-12-10 tzdata updated to Olson's tzdata2014j (venkat)
2014-12-13 fix header files installation on OS X (houben)
2014-12-17 (TIP 427) [fconfigure $h -connecting, -peername, -sockname] (oehlmann,rmax)
2014-12-18 (bug)[af08c8] Crash in full finalize encoding teardown (porter)
2014-12-18 (bug)[7c187a] [chan copy] crash (io-53.17) (benno,porter)
2015-01-26 (bug)[df0848] Trouble with INFINITY macro (dower,nijtmans)
2015-01-29 (bug) Stop crashes when extension var resolvers misbehave (porter)
2015-01-29 (bug)[088727] [read] past EOF (io-73.4) (fenugrec,porter)
2015-02-11 tzdata updated to Olson's tzdata2015a (venkat)
2015-02-20 (bug)[32b615] Fix compiled [lreplace] (lreplace-4.[345]) (aspect)
2015-03-10 (enhancement) Revise OS X notifier for better Cocoa (walzer)
*** POTENTIAL INCOMPATIBILITY ***
--- Released 8.6.4, March 12, 2015 --- http://core.tcl.tk/tcl/ for details
2015-06-25 (TIP 412) msgcat dynamic locale change and package private locale (oehlmann)
=> msgcat 1.6.0
2014-08-29 (TIP TBD) Added a C Implementation of ZipVFS to provide Tcl/Wishkit building capbilities in the core (hypnotoad)
+16 -16
View File
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2000-2003 Damien Miller. All rights reserved.
* Copyright (C) 1999 WIDE Project. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -13,7 +13,7 @@
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -67,7 +67,7 @@ strlcpy(char *dst, const char *src, size_t siz)
}
#endif
int fake_getnameinfo(const struct sockaddr *sa, size_t salen, char *host,
int fake_getnameinfo(const struct sockaddr *sa, size_t salen, char *host,
size_t hostlen, char *serv, size_t servlen, int flags)
{
struct sockaddr_in *sin = (struct sockaddr_in *)sa;
@@ -96,7 +96,7 @@ int fake_getnameinfo(const struct sockaddr *sa, size_t salen, char *host,
} else {
int ret;
Tcl_MutexLock(&netdbMutex);
hp = gethostbyaddr((char *)&sin->sin_addr,
hp = gethostbyaddr((char *)&sin->sin_addr,
sizeof(struct in_addr), AF_INET);
if (hp == NULL) {
ret = EAI_NODATA;
@@ -130,7 +130,7 @@ fake_gai_strerror(int err)
default:
return ("unknown/invalid error.");
}
}
}
#endif /* !HAVE_GAI_STRERROR */
#ifndef HAVE_FREEADDRINFO
@@ -156,9 +156,9 @@ addrinfo *malloc_ai(int port, u_long addr, const struct addrinfo *hints)
ai = malloc(sizeof(*ai) + sizeof(struct sockaddr_in));
if (ai == NULL)
return (NULL);
memset(ai, '\0', sizeof(*ai) + sizeof(struct sockaddr_in));
ai->ai_addr = (struct sockaddr *)(ai + 1);
/* XXX -- ssh doesn't use sa_len */
ai->ai_addrlen = sizeof(struct sockaddr_in);
@@ -166,7 +166,7 @@ addrinfo *malloc_ai(int port, u_long addr, const struct addrinfo *hints)
((struct sockaddr_in *)(ai)->ai_addr)->sin_port = port;
((struct sockaddr_in *)(ai)->ai_addr)->sin_addr.s_addr = addr;
/* XXX: the following is not generally correct, but does what we want */
if (hints->ai_socktype)
ai->ai_socktype = hints->ai_socktype;
@@ -180,7 +180,7 @@ addrinfo *malloc_ai(int port, u_long addr, const struct addrinfo *hints)
}
int
fake_getaddrinfo(const char *hostname, const char *servname,
fake_getaddrinfo(const char *hostname, const char *servname,
const struct addrinfo *hints, struct addrinfo **res)
{
struct hostent *hp;
@@ -211,29 +211,29 @@ fake_getaddrinfo(const char *hostname, const char *servname,
if (hostname && inet_aton(hostname, &in) != 0)
addr = in.s_addr;
*res = malloc_ai(port, addr, hints);
if (*res == NULL)
if (*res == NULL)
return (EAI_MEMORY);
return (0);
}
if (!hostname) {
*res = malloc_ai(port, htonl(0x7f000001), hints);
if (*res == NULL)
if (*res == NULL)
return (EAI_MEMORY);
return (0);
}
if (inet_aton(hostname, &in)) {
*res = malloc_ai(port, in.s_addr, hints);
if (*res == NULL)
if (*res == NULL)
return (EAI_MEMORY);
return (0);
}
/* Don't try DNS if AI_NUMERICHOST is set */
if (hints && hints->ai_flags & AI_NUMERICHOST)
return (EAI_NONAME);
Tcl_MutexLock(&netdbMutex);
hp = gethostbyname(hostname);
if (hp && hp->h_name && hp->h_name[0] && hp->h_addr_list[0]) {
+5 -5
View File
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2000-2003 Damien Miller. All rights reserved.
* Copyright (C) 1999 WIDE Project. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -13,7 +13,7 @@
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -39,7 +39,7 @@
#define _FAKE_RFC2553_H
/*
* First, socket and INET6 related definitions
* First, socket and INET6 related definitions
*/
#ifndef HAVE_STRUCT_SOCKADDR_STORAGE
# define _SS_MAXSIZE 128 /* Implementation specific max size */
@@ -146,7 +146,7 @@ struct addrinfo {
# undef getaddrinfo
#endif
#define getaddrinfo(a,b,c,d) (fake_getaddrinfo(a,b,c,d))
int getaddrinfo(const char *, const char *,
int getaddrinfo(const char *, const char *,
const struct addrinfo *, struct addrinfo **);
#endif /* !HAVE_GETADDRINFO */
@@ -162,7 +162,7 @@ void freeaddrinfo(struct addrinfo *);
#ifndef HAVE_GETNAMEINFO
#define getnameinfo(a,b,c,d,e,f,g) (fake_getnameinfo(a,b,c,d,e,f,g))
int getnameinfo(const struct sockaddr *, size_t, char *, size_t,
int getnameinfo(const struct sockaddr *, size_t, char *, size_t,
char *, size_t, int);
#endif /* !HAVE_GETNAMEINFO */
+1 -1
View File
@@ -1,4 +1,4 @@
/*
/*
* fixstrtod.c --
*
* Source code for the "fixstrtod" procedure. This procedure is
+1 -1
View File
@@ -1,4 +1,4 @@
/*
/*
* gettod.c --
*
* This file provides the gettimeofday function on systems
-22
View File
@@ -1,22 +0,0 @@
/*
* limits.h --
*
* This is a dummy header file to #include in Tcl when there
* is no limits.h in /usr/include. There are only a few
* definitions here; also see tclPort.h, which already
* #defines some of the things here if they're not arleady
* defined.
*
* Copyright (c) 1991 The Regents of the University of California.
* Copyright (c) 1994 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#define LONG_MIN 0x80000000
#define LONG_MAX 0x7fffffff
#define INT_MIN 0x80000000
#define INT_MAX 0x7fffffff
#define SHRT_MIN 0x8000
#define SHRT_MAX 0x7fff
+1 -1
View File
@@ -1,4 +1,4 @@
/*
/*
* mkstemp.c --
*
* Source code for the "mkstemp" library routine.
+1 -1
View File
@@ -1,4 +1,4 @@
/*
/*
* opendir.c --
*
* This file provides dirent-style directory-reading procedures for V7
+1 -1
View File
@@ -1,4 +1,4 @@
/*
/*
* strncasecmp.c --
*
* Source code for the "strncasecmp" library routine.
+1 -1
View File
@@ -1,4 +1,4 @@
/*
/*
* strstr.c --
*
* Source code for the "strstr" library routine.
+3 -3
View File
@@ -1,4 +1,4 @@
/*
/*
* strtod.c --
*
* Source code for the "strtod" library procedure.
@@ -137,7 +137,7 @@ strtod(
* has more than 18 digits, ignore the extras, since they can't affect the
* value anyway.
*/
pExp = p;
p -= mantSize;
if (decPt < 0) {
@@ -217,7 +217,7 @@ strtod(
* by processing the exponent one bit at a time to combine many powers of
* 2 of 10. Then combine the exponent with the fraction.
*/
if (exp < 0) {
expSign = TRUE;
exp = -exp;
+1 -1
View File
@@ -1,4 +1,4 @@
/*
/*
* strtol.c --
*
* Source code for the "strtol" library procedure.
+3 -3
View File
@@ -1,4 +1,4 @@
/*
/*
* strtoul.c --
*
* Source code for the "strtoul" library procedure.
@@ -90,7 +90,7 @@ strtoul(
* If no base was provided, pick one from the leading characters of the
* string.
*/
if (base == 0) {
if (*p == '0') {
p += 1;
@@ -206,7 +206,7 @@ strtoul(
if (overflow) {
errno = ERANGE;
return ULONG_MAX;
}
}
if (negative) {
return -result;
}
+1 -1
View File
@@ -20,7 +20,7 @@
#define NULL 0
#endif
/*
/*
* Strict POSIX stuff goes here. Extensions go down below, in the ifndef
* _POSIX_SOURCE section.
*/
+1 -1
View File
@@ -1,4 +1,4 @@
/*
/*
* waitpid.c --
*
* This procedure emulates the POSIX waitpid kernel call on BSD systems
+1 -1
View File
@@ -4,7 +4,7 @@
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\"
.TH Tcl_AddErrorInfo 3 8.5 Tcl "Tcl Library Procedures"
.so man.macros
.BS
+13 -5
View File
@@ -13,20 +13,25 @@ Tcl_CancelEval, Tcl_Canceled \- cancel Tcl scripts
.nf
\fB#include <tcl.h>\fR
int
\fBTcl_CancelEval\fR(\fIinterp, clientData, flags\fR)
\fBTcl_CancelEval\fR(\fIinterp, resultObjPtr, clientData, flags\fR)
.sp
int
\fBTcl_Canceled\fR(\fIinterp, flags\fR)
.SH ARGUMENTS
.AS Tcl_Interp *interp
.AP Tcl_Interp *interp in
Interpreter in which to cancel the script.
.AP Tcl_Obj *resultObjPtr in
Error message to use in the cancellation, or NULL to use a default message. If
not NULL, this object will have its reference count decremented before
\fBTcl_CancelEval\fR returns.
.AP int flags in
ORed combination of flag bits that specify additional options.
For \fBTcl_CancelEval\fR, only \fBTCL_CANCEL_UNWIND\fR is currently
supported. For \fBTcl_Canceled\fR, only \fBTCL_LEAVE_ERR_MSG\fR and
\fBTCL_CANCEL_UNWIND\fR are currently supported.
.AP ClientData clientData in
Currently, reserved for future use.
Currently reserved for future use.
It should be set to NULL.
.BE
.SH DESCRIPTION
@@ -41,19 +46,21 @@ returns \fBTCL_ERROR\fR if it has. Otherwise, \fBTCL_OK\fR is returned.
Extensions can use this function to check to see if they should abort a long
running command. This function is thread sensitive and may only be called
from the thread the interpreter was created in.
.SH "FLAG BITS"
.SS "FLAG BITS"
Any ORed combination of the following values may be used for the
\fIflags\fR argument to procedures such as \fBTcl_CancelEval\fR:
.TP 23
.TP 20
\fBTCL_CANCEL_UNWIND\fR
.
This flag is used by \fBTcl_CancelEval\fR and \fBTcl_Canceled\fR.
For \fBTcl_CancelEval\fR, if this flag is set, the script in progress
is canceled and the evaluation stack for the interpreter is unwound.
For \fBTcl_Canceled\fR, if this flag is set, the script in progress
is considered to be canceled only if the evaluation stack for the
interpreter is being unwound.
.TP 23
.TP 20
\fBTCL_LEAVE_ERR_MSG\fR
.
This flag is only used by \fBTcl_Canceled\fR; it is ignored by
other procedures. If an error is returned and this bit is set in
\fIflags\fR, then an error message will be left in the interpreter's
@@ -61,6 +68,7 @@ result, where it can be retrieved with \fBTcl_GetObjResult\fR or
\fBTcl_GetStringResult\fR. If this flag bit is not set then no error
message is left and the interpreter's result will not be modified.
.SH "SEE ALSO"
interp(n), Tcl_Eval(3),
TIP 285
.SH KEYWORDS
cancel, unwind
+2 -1
View File
@@ -71,7 +71,8 @@ The name of the object to create, or NULL if a new unused name is to be
automatically selected.
.AP "const char" *nsName in
The name of the namespace to create for the object's private use, or NULL if a
new unused name is to be automatically selected.
new unused name is to be automatically selected. The namespace must not
already exist.
.AP int objc in
The number of elements in the \fIobjv\fR array.
.AP "Tcl_Obj *const" *objv in
+1 -1
View File
@@ -336,7 +336,7 @@ typedef struct Tcl_ChannelType {
It is not necessary to provide implementations for all channel
operations. Those which are not necessary may be set to NULL in the
struct: \fIblockModeProc\fR, \fIseekProc\fR, \fIsetOptionProc\fR,
\fIgetOptionProc\fR, and \fIclose2Proc\fR, in addition to
\fIgetOptionProc\fR, \fIgetHandleProc\fR, and \fIclose2Proc\fR, in addition to
\fIflushProc\fR, \fIhandlerProc\fR, \fIthreadActionProc\fR, and
\fItruncateProc\fR. Other functions that cannot be implemented in a
meaningful way should return \fBEINVAL\fR when called, to indicate
+1 -1
View File
@@ -4,7 +4,7 @@
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\"
.TH Tcl_DString 3 7.4 Tcl "Tcl Library Procedures"
.so man.macros
.BS
+40 -74
View File
@@ -3,7 +3,7 @@
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\"
.TH Tcl_GetEncoding 3 "8.1" Tcl "Tcl Library Procedures"
.so man.macros
.BS
@@ -76,7 +76,7 @@ desired.
.AP "const char" *name in
Name of encoding to load.
.AP Tcl_Encoding encoding in
The encoding to query, free, or use for converting text. If \fIencoding\fR is
The encoding to query, free, or use for converting text. If \fIencoding\fR is
NULL, the current system encoding is used.
.AP Tcl_Obj *objPtr in
Name of encoding to get token for.
@@ -86,17 +86,17 @@ Points to storage where encoding token is to be written.
For the \fBTcl_ExternalToUtf\fR functions, an array of bytes in the
specified encoding that are to be converted to UTF-8. For the
\fBTcl_UtfToExternal\fR and \fBTcl_WinUtfToTChar\fR functions, an array of
UTF-8 characters to be converted to the specified encoding.
UTF-8 characters to be converted to the specified encoding.
.AP "const TCHAR" *tsrc in
An array of Windows TCHAR characters to convert to UTF-8.
.AP int srcLen in
Length of \fIsrc\fR or \fItsrc\fR in bytes. If the length is negative, the
.AP int srcLen in
Length of \fIsrc\fR or \fItsrc\fR in bytes. If the length is negative, the
encoding-specific length of the string is used.
.AP Tcl_DString *dstPtr out
Pointer to an uninitialized or free \fBTcl_DString\fR in which the converted
result will be stored.
.AP int flags in
Various flag bits OR-ed together.
Various flag bits OR-ed together.
\fBTCL_ENCODING_START\fR signifies that the
source buffer is the first block in a (potentially multi-block) input
stream, telling the conversion routine to reset to an initial state and
@@ -108,7 +108,7 @@ byte is converted and then to reset to an initial state.
\fBTCL_ENCODING_STOPONERROR\fR signifies that the conversion routine should
return immediately upon reading a source character that does not exist in
the target encoding; otherwise a default fallback character will
automatically be substituted.
automatically be substituted.
.AP Tcl_EncodingState *statePtr in/out
Used when converting a (generally long or indefinite length) byte stream
in a piece-by-piece fashion. The conversion routine stores its current
@@ -116,7 +116,7 @@ state in \fI*statePtr\fR after \fIsrc\fR (the buffer containing the
current piece) has been converted; that state information must be passed
back when converting the next piece of the stream so the conversion
routine knows what state it was in when it left off at the end of the
last piece. May be NULL, in which case the value specified for \fIflags\fR
last piece. May be NULL, in which case the value specified for \fIflags\fR
is ignored and the source buffer is assumed to contain the complete string to
convert.
.AP char *dst out
@@ -137,11 +137,11 @@ stored in the output buffer. May be NULL.
.AP Tcl_DString *bufPtr out
Storage for the prescribed system encoding name.
.AP "const Tcl_EncodingType" *typePtr in
Structure that defines a new type of encoding.
Structure that defines a new type of encoding.
.AP Tcl_Obj *searchPath in
List of filesystem directories in which to search for encoding data files.
.AP "const char" *path in
A path to the location of the encoding file.
A path to the location of the encoding file.
.BE
.SH INTRODUCTION
.PP
@@ -180,13 +180,13 @@ The first time \fIname\fR is seen, \fBTcl_GetEncoding\fR returns an
encoding with a reference count of 1. If the same \fIname\fR is requested
further times, then the reference count for that encoding is incremented
without the overhead of allocating a new encoding and all its associated
data structures.
data structures.
.PP
When an \fIencoding\fR is no longer needed, \fBTcl_FreeEncoding\fR
should be called to release it. When an \fIencoding\fR is no longer in use
anywhere (i.e., it has been freed as many times as it has been gotten)
\fBTcl_FreeEncoding\fR will release all storage the encoding was using
and delete it from the database.
and delete it from the database.
.PP
\fBTcl_GetEncodingFromObj\fR treats the string representation of
\fIobjPtr\fR as an encoding name, and finds an encoding with that
@@ -201,7 +201,7 @@ on the resulting encoding token when that token will no longer be
used.
.PP
\fBTcl_ExternalToUtfDString\fR converts a source buffer \fIsrc\fR from the
specified \fIencoding\fR into UTF-8. The converted bytes are stored in
specified \fIencoding\fR into UTF-8. The converted bytes are stored in
\fIdstPtr\fR, which is then null-terminated. The caller should eventually
call \fBTcl_DStringFree\fR to free any information stored in \fIdstPtr\fR.
When converting, if any of the characters in the source buffer cannot be
@@ -227,17 +227,17 @@ sequence, but more bytes were needed to complete this sequence. A
subsequent call to the conversion routine should pass a buffer containing
the unconverted bytes that remained in \fIsrc\fR plus some further bytes
from the source stream to properly convert the formerly split-up multibyte
sequence.
sequence.
.IP \fBTCL_CONVERT_SYNTAX\fR 29
The source buffer contained an invalid character sequence. This may occur
if the input stream has been damaged or if the input encoding method was
misidentified.
.IP \fBTCL_CONVERT_UNKNOWN\fR 29
The source buffer contained a character that could not be represented in
the target encoding and \fBTCL_ENCODING_STOPONERROR\fR was specified.
the target encoding and \fBTCL_ENCODING_STOPONERROR\fR was specified.
.RE
.LP
\fBTcl_UtfToExternalDString\fR converts a source buffer \fIsrc\fR from UTF-8
\fBTcl_UtfToExternalDString\fR converts a source buffer \fIsrc\fR from UTF-8
into the specified \fIencoding\fR. The converted bytes are stored in
\fIdstPtr\fR, which is then terminated with the appropriate encoding-specific
null. The caller should eventually call \fBTcl_DStringFree\fR to free any
@@ -257,51 +257,17 @@ is filled with the corresponding number of bytes that were stored in
.PP
\fBTcl_WinUtfToTChar\fR and \fBTcl_WinTCharToUtf\fR are
Windows-only convenience
functions for converting between UTF-8 and Windows strings. On Windows 95
(as with the Unix operating system),
all strings exchanged between Tcl and the operating system are
.QW "char"
based. On Windows NT, some strings exchanged between Tcl and the
operating system are
.QW "char"
oriented while others are in Unicode. By
convention, in Windows a TCHAR is a character in the ANSI code page
on Windows 95 and a Unicode character on Windows NT.
.PP
If you planned to use the same
.QW "char"
based interfaces on both Windows
95 and Windows NT, you could use \fBTcl_UtfToExternal\fR and
\fBTcl_ExternalToUtf\fR (or their \fBTcl_DString\fR equivalents) with an
encoding of NULL (the current system encoding). On the other hand,
if you planned to use the Unicode interface when running on Windows NT
and the
.QW "char"
interfaces when running on Windows 95, you would have
to perform the following type of test over and over in your program
(as represented in pseudo-code):
.PP
.CS
if (running NT) {
encoding <- Tcl_GetEncoding("unicode");
nativeBuffer <- Tcl_UtfToExternal(encoding, utfBuffer);
Tcl_FreeEncoding(encoding);
} else {
nativeBuffer <- Tcl_UtfToExternal(NULL, utfBuffer);
}
.CE
.PP
\fBTcl_WinUtfToTChar\fR and \fBTcl_WinTCharToUtf\fR automatically
handle this test and use the proper encoding based on the current
operating system. \fBTcl_WinUtfToTChar\fR returns a pointer to
a TCHAR string, and \fBTcl_WinTCharToUtf\fR expects a TCHAR string
pointer as the \fIsrc\fR string. Otherwise, these functions
behave identically to \fBTcl_UtfToExternalDString\fR and
\fBTcl_ExternalToUtfDString\fR.
functions for converting between UTF-8 and Windows strings
based on the TCHAR type which is by convention
a Unicode character on Windows NT.
These functions are essentially wrappers around
\fBTcl_UtfToExternalDString\fR and
\fBTcl_ExternalToUtfDString\fR that convert to and from the
Unicode encoding.
.PP
\fBTcl_GetEncodingName\fR is roughly the inverse of \fBTcl_GetEncoding\fR.
Given an \fIencoding\fR, the return value is the \fIname\fR argument that
was used to create the encoding. The string returned by
was used to create the encoding. The string returned by
\fBTcl_GetEncodingName\fR is only guaranteed to persist until the
\fIencoding\fR is deleted. The caller must not modify this string.
.PP
@@ -340,9 +306,9 @@ reference count of 1. If an encoding with the specified \fIname\fR
already exists, then its entry in the database is replaced with the new
encoding; the token for the old encoding will remain valid and continue
to behave as before, but users of the new token will now call the new
encoding procedures.
encoding procedures.
.PP
The \fItypePtr\fR argument to \fBTcl_CreateEncoding\fR contains information
The \fItypePtr\fR argument to \fBTcl_CreateEncoding\fR contains information
about the name of the encoding and the procedures that will be called to
convert between this encoding and UTF-8. It is defined as follows:
.PP
@@ -354,7 +320,7 @@ typedef struct Tcl_EncodingType {
Tcl_EncodingFreeProc *\fIfreeProc\fR;
ClientData \fIclientData\fR;
int \fInullSize\fR;
} \fBTcl_EncodingType\fR;
} \fBTcl_EncodingType\fR;
.CE
.PP
The \fIencodingName\fR provides a string name for the encoding, by
@@ -384,12 +350,12 @@ type \fBTcl_EncodingConvertProc\fR:
.CS
typedef int \fBTcl_EncodingConvertProc\fR(
ClientData \fIclientData\fR,
const char *\fIsrc\fR,
int \fIsrcLen\fR,
int \fIflags\fR,
const char *\fIsrc\fR,
int \fIsrcLen\fR,
int \fIflags\fR,
Tcl_EncodingState *\fIstatePtr\fR,
char *\fIdst\fR,
int \fIdstLen\fR,
char *\fIdst\fR,
int \fIdstLen\fR,
int *\fIsrcReadPtr\fR,
int *\fIdstWrotePtr\fR,
int *\fIdstCharsPtr\fR);
@@ -405,12 +371,12 @@ documented at the top, to \fBTcl_ExternalToUtf\fR or
\fBTcl_UtfToExternal\fR, with the following exceptions. If the
\fIsrcLen\fR argument to one of those high-level functions is negative,
the value passed to the callback procedure will be the appropriate
encoding-specific string length of \fIsrc\fR. If any of the \fIsrcReadPtr\fR,
encoding-specific string length of \fIsrc\fR. If any of the \fIsrcReadPtr\fR,
\fIdstWrotePtr\fR, or \fIdstCharsPtr\fR arguments to one of the high-level
functions is NULL, the corresponding value passed to the callback
procedure will be a non-NULL location.
.PP
The callback procedure \fIfreeProc\fR, if non-NULL, should match the type
The callback procedure \fIfreeProc\fR, if non-NULL, should match the type
\fBTcl_EncodingFreeProc\fR:
.PP
.CS
@@ -420,11 +386,11 @@ typedef void \fBTcl_EncodingFreeProc\fR(
.PP
This \fIfreeProc\fR function is called when the encoding is deleted. The
\fIclientData\fR parameter is the same as the \fIclientData\fR field
specified to \fBTcl_CreateEncoding\fR when the encoding was created.
specified to \fBTcl_CreateEncoding\fR when the encoding was created.
.PP
\fBTcl_GetEncodingSearchPath\fR and \fBTcl_SetEncodingSearchPath\fR
are called to access and set the list of filesystem directories searched
for encoding data files.
for encoding data files.
.PP
The value returned by \fBTcl_GetEncodingSearchPath\fR
is the value stored by the last successful call to
@@ -457,7 +423,7 @@ encoding files that can be loaded using the same mechanism. These
encoding files contain information about the tables and/or escape
sequences used to map between an external encoding and Unicode. The
external encoding may consist of single-byte, multi-byte, or double-byte
characters.
characters.
.PP
Each dynamically-loadable encoding is represented as a text file. The
initial line of the file, beginning with a
@@ -481,9 +447,9 @@ many Japanese computers.
.IP "[4] \fBE\fR"
An escape-sequence encoding, specifying that certain sequences of bytes
do not represent characters, but commands that describe how following bytes
should be interpreted.
should be interpreted.
.PP
The rest of the lines in the file depend on the type.
The rest of the lines in the file depend on the type.
.PP
Cases [1], [2], and [3] are collectively referred to as table-based encoding
files. The lines in a table-based encoding file are in the same
@@ -534,7 +500,7 @@ The third line of the file is three numbers. The first number is the
fallback character (in base 16) to use when converting from UTF-8 to this
encoding. The second number is a \fB1\fR if this file represents the
encoding for a symbol font, or \fB0\fR otherwise. The last number (in base
10) is how many pages of data follow.
10) is how many pages of data follow.
.PP
Subsequent lines in the example above are pages that describe how to map
from the encoding into 2-byte Unicode. The first line in a page identifies
+3 -1
View File
@@ -67,7 +67,9 @@ The class to create the method in.
The name of the method to create. Should not be NULL unless creating
constructors or destructors.
.AP int isPublic in
A boolean flag saying whether the method is to be exported.
A flag saying what the visibility of the method is. The only supported public
values of this flag are 0 for a non-exported method, and 1 for an exported
method.
.AP Tcl_MethodType *methodTypePtr in
A description of the type of the method to create, or the type of method to
compare against.
+2 -2
View File
@@ -3,7 +3,7 @@
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\"
.TH Tcl_Obj 3 8.5 Tcl "Tcl Library Procedures"
.so man.macros
.BS
@@ -94,7 +94,7 @@ Also, most Tcl values are only read and never modified.
This is especially true for procedure arguments,
which can be shared between the caller and the called procedure.
Assignment and argument binding is done by
simply assigning a pointer to the value.
simply assigning a pointer to the value.
Reference counting is used to determine when it is safe to
reclaim a value's storage.
.PP
+13 -13
View File
@@ -115,7 +115,7 @@ Used for error reporting and to look up a channel registered in it.
The name of a local or network file.
.AP "const char" *mode in
Specifies how the file is to be accessed. May have any of the values
allowed for the \fImode\fR argument to the Tcl \fBopen\fR command.
allowed for the \fImode\fR argument to the Tcl \fBopen\fR command.
.AP int permissions in
POSIX-style permission flags such as 0644. If a new file is created, these
permissions will be set on the created file.
@@ -141,7 +141,7 @@ file descriptor, for Windows it is a HANDLE.
OR-ed combination of \fBTCL_READABLE\fR and \fBTCL_WRITABLE\fR to indicate
what operations are valid on \fIhandle\fR.
.AP "const char" *channelName in
The name of the channel.
The name of the channel.
.AP int *modePtr out
Points at an integer variable that will receive an OR-ed combination of
\fBTCL_READABLE\fR and \fBTCL_WRITABLE\fR denoting whether the channel is
@@ -155,8 +155,8 @@ from a procedure such as \fBTcl_OpenFileChannel\fR.
A pointer to a Tcl value in which to store the characters read from the
channel.
.AP int charsToRead in
The number of characters to read from the channel. If the channel's encoding
is \fBbinary\fR, this is equivalent to the number of bytes to read from the
The number of characters to read from the channel. If the channel's encoding
is \fBbinary\fR, this is equivalent to the number of bytes to read from the
channel.
.AP int appendFlag in
If non-zero, data read from the channel will be appended to the value.
@@ -169,7 +169,7 @@ be large enough to hold this many bytes.
.AP Tcl_Obj *lineObjPtr in/out
A pointer to a Tcl value in which to store the line read from the
channel. The line read will be appended to the current value of the
value.
value.
.AP Tcl_DString *lineRead in/out
A pointer to a Tcl dynamic string in which to store the line read from the
channel. Must have been initialized by the caller. The line read will be
@@ -238,8 +238,8 @@ If an error occurs while opening the channel, \fBTcl_OpenFileChannel\fR
returns NULL and records a POSIX error code that can be
retrieved with \fBTcl_GetErrno\fR.
In addition, if \fIinterp\fR is non-NULL, \fBTcl_OpenFileChannel\fR
leaves an error message in \fIinterp\fR's result after any error.
As of Tcl 8.4, the value-based API \fBTcl_FSOpenFileChannel\fR should
leaves an error message in \fIinterp\fR's result after any error.
As of Tcl 8.4, the value-based API \fBTcl_FSOpenFileChannel\fR should
be used in preference to \fBTcl_OpenFileChannel\fR wherever possible.
.PP
The newly created channel is not registered in the supplied interpreter; to
@@ -360,7 +360,7 @@ the standard channels (\fBstdout\fR, \fBstderr\fR, \fBstdin\fR), and will return
Code not associated with a Tcl interpreter can call
\fBTcl_DetachChannel\fR with \fIinterp\fR as NULL, to indicate to Tcl
that it no longer holds a reference to that channel. If this is the last
reference to the channel, unlike \fBTcl_UnregisterChannel\fR,
reference to the channel, unlike \fBTcl_UnregisterChannel\fR,
it will not be closed.
.SH TCL_ISSTANDARDCHANNEL
.PP
@@ -368,7 +368,7 @@ it will not be closed.
three standard channels, \fBstdin\fR, \fBstdout\fR or \fBstderr\fR.
If so, it returns 1, otherwise 0.
.PP
No attempt is made to check whether the given channel or the standard
No attempt is made to check whether the given channel or the standard
channels are initialized or otherwise valid.
.SH TCL_CLOSE
.PP
@@ -402,7 +402,7 @@ corresponding calls to \fBTcl_UnregisterChannel\fR.
.SH "TCL_READCHARS AND TCL_READ"
.PP
\fBTcl_ReadChars\fR consumes bytes from \fIchannel\fR, converting the bytes
to UTF-8 based on the channel's encoding and storing the produced data in
to UTF-8 based on the channel's encoding and storing the produced data in
\fIreadObjPtr\fR's string representation. The return value of
\fBTcl_ReadChars\fR is the number of characters, up to \fIcharsToRead\fR,
that were stored in \fIreadObjPtr\fR. If an error occurs while reading, the
@@ -450,7 +450,7 @@ extensions. It consumes bytes from \fIchannel\fR and stores them in
of \fBTcl_Read\fR is the number of bytes, up to \fIbytesToRead\fR, written in
\fIreadBuf\fR. The buffer produced by \fBTcl_Read\fR is not null-terminated.
Its contents are valid from the zeroth position up to and excluding the
position indicated by the return value.
position indicated by the return value.
.PP
\fBTcl_ReadRaw\fR is the same as \fBTcl_Read\fR but does not
compensate for stacking. While \fBTcl_Read\fR (and the other functions
@@ -507,7 +507,7 @@ to be null-terminated and it outputs everything up to the null.
.PP
Data queued for output may not appear on the output device immediately, due
to internal buffering. If the data should appear immediately, call
\fBTcl_Flush\fR after the call to \fBTcl_WriteChars\fR, or set the
\fBTcl_Flush\fR after the call to \fBTcl_WriteChars\fR, or set the
\fB\-buffering\fR option on the channel to \fBnone\fR. If you wish the data
to appear as soon as a complete line is accepted for output, set the
\fB\-buffering\fR option on the channel to \fBline\fR mode.
@@ -525,7 +525,7 @@ channel. This is done even if the channel has no encoding.
\fBTcl_WriteObj\fR is similar to \fBTcl_WriteChars\fR except it
accepts a Tcl value whose contents will be output to the channel. The
UTF-8 characters in \fIwriteObjPtr\fR's string representation are converted
to the channel's encoding and queued for output to \fIchannel\fR.
to the channel's encoding and queued for output to \fIchannel\fR.
As a performance optimization, when writing to a channel with the encoding
\fBbinary\fR, UTF-8 characters are not converted as they are written.
Instead, the bytes in \fIwriteObjPtr\fR's internal representation as a
+9 -9
View File
@@ -3,7 +3,7 @@
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\"
.TH Tcl_ParseCommand 3 8.3 Tcl "Tcl Library Procedures"
.so man.macros
.BS
@@ -56,7 +56,7 @@ following \fIstart\fR up to the first null character.
.AP int nested in
Non-zero means that the script is part of a command substitution so an
unquoted close bracket should be treated as a command terminator. If zero,
close brackets have no special meaning.
close brackets have no special meaning.
.AP int append in
Non-zero means that \fI*parsePtr\fR already contains valid tokens; the new
tokens should be appended to those already present. Zero means that
@@ -118,7 +118,7 @@ result, and no information is left at \fI*parsePtr\fR.
enclosed in braces such as
\fB{hello}\fR or \fB{string \et with \et tabs}\fR
from the beginning of its argument \fIstart\fR.
The first character of \fIstart\fR must be \fB{\fR.
The first character of \fIstart\fR must be \fB{\fR.
If the braced string was parsed successfully,
\fBTcl_ParseBraces\fR returns \fBTCL_OK\fR,
fills in the structure pointed to by \fIparsePtr\fR
@@ -134,7 +134,7 @@ and no information is left at \fI*parsePtr\fR or \fI*termPtr\fR.
\fBTcl_ParseQuotedString\fR parses a double-quoted string such as
\fB"sum is [expr {$a+$b}]"\fR
from the beginning of the argument \fIstart\fR.
The first character of \fIstart\fR must be \fB\N'34'\fR.
The first character of \fIstart\fR must be \fB\N'34'\fR.
If the double-quoted string was parsed successfully,
\fBTcl_ParseQuotedString\fR returns \fBTCL_OK\fR,
fills in the structure pointed to by \fIparsePtr\fR
@@ -150,7 +150,7 @@ and no information is left at \fI*parsePtr\fR or \fI*termPtr\fR.
\fBTcl_ParseVarName\fR parses a Tcl variable reference such as
\fB$abc\fR or \fB$x([expr {$index + 1}])\fR from the beginning of its
\fIstart\fR argument.
The first character of \fIstart\fR must be \fB$\fR.
The first character of \fIstart\fR must be \fB$\fR.
If a variable name was parsed successfully, \fBTcl_ParseVarName\fR
returns \fBTCL_OK\fR and fills in the structure pointed to by
\fIparsePtr\fR with information about the structure of the variable name
@@ -184,7 +184,7 @@ a Tcl_Parse structure. The tokens typically consist
of all the tokens in a word or all the tokens that make up the index for
a reference to an array variable. \fBTcl_EvalTokensStandard\fR performs the
substitutions requested by the tokens and concatenates the
resulting values.
resulting values.
The return value from \fBTcl_EvalTokensStandard\fR is a Tcl completion
code with one of the values \fBTCL_OK\fR, \fBTCL_ERROR\fR,
\fBTCL_RETURN\fR, \fBTCL_BREAK\fR, or \fBTCL_CONTINUE\fR, or possibly
@@ -242,7 +242,7 @@ character that terminates the last comment.
If the command is not preceded by any comments, \fIcommentSize\fR is 0.
\fBTcl_ParseCommand\fR also sets the \fIcommandStart\fR field
to point to the first character of the first
word in the command (skipping any comments and leading space) and
word in the command (skipping any comments and leading space) and
\fIcommandSize\fR gives the total number of bytes in the command,
including the character pointed to by \fIcommandStart\fR up to and
including the newline, close bracket, or semicolon character that
@@ -350,7 +350,7 @@ just the \fBTCL_TOKEN_OPERATOR\fR token.
Each operand is described by a \fBTCL_TOKEN_SUB_EXPR\fR token.
Otherwise, the subexpression is a value described by
one of the token types \fBTCL_TOKEN_WORD\fR, \fBTCL_TOKEN_TEXT\fR,
\fBTCL_TOKEN_BS\fR, \fBTCL_TOKEN_COMMAND\fR,
\fBTCL_TOKEN_BS\fR, \fBTCL_TOKEN_COMMAND\fR,
\fBTCL_TOKEN_VARIABLE\fR, and \fBTCL_TOKEN_SUB_EXPR\fR.
The \fInumComponents\fR field
counts the total number of sub-tokens that make up the subexpression;
@@ -389,7 +389,7 @@ is always 0.
After \fBTcl_ParseCommand\fR returns, the first token pointed to by
the \fItokenPtr\fR field of the
Tcl_Parse structure always has type \fBTCL_TOKEN_WORD\fR or
\fBTCL_TOKEN_SIMPLE_WORD\fR or \fBTCL_TOKEN_EXPAND_WORD\fR.
\fBTCL_TOKEN_SIMPLE_WORD\fR or \fBTCL_TOKEN_EXPAND_WORD\fR.
It is followed by the sub-tokens
that must be concatenated to produce the value of that word.
The next token is the \fBTCL_TOKEN_WORD\fR or \fBTCL_TOKEN_SIMPLE_WORD\fR
+4 -4
View File
@@ -3,7 +3,7 @@
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\"
.TH Tcl_StringObj 3 8.1 Tcl "Tcl Library Procedures"
.so man.macros
.BS
@@ -308,7 +308,7 @@ sprintf(buf, format, ...);
\fBTcl_NewStringObj\fR(buf, -1);
.CE
.PP
but with greater convenience and no need to
but with greater convenience and no need to
determine \fBSOME_SUITABLE_LENGTH\fR. The formatting is done with the same
core formatting engine used by \fBTcl_Format\fR. This means the set of
supported conversion specifiers is that of the \fBformat\fR command and
@@ -329,8 +329,8 @@ Tcl_Obj *objPtr = \fBTcl_ObjPrintf\fR("Value is %d", x);
.PP
If the value of \fIformat\fR contains internal inconsistencies or invalid
specifier formats, the formatted string result produced by
\fBTcl_ObjPrintf\fR will be an error message describing the error.
It is impossible however to provide runtime protection against
\fBTcl_ObjPrintf\fR will be an error message describing the error.
It is impossible however to provide runtime protection against
mismatches between the format and any subsequent arguments.
Compile-time protection may be provided by some compilers.
.PP
+6 -5
View File
@@ -4,7 +4,7 @@
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\"
.TH Threads 3 "8.1" Tcl "Tcl Library Procedures"
.so man.macros
.BS
@@ -79,9 +79,10 @@ waited upon into it.
.SH INTRODUCTION
Beginning with the 8.1 release, the Tcl core is thread safe, which
allows you to incorporate Tcl into multithreaded applications without
customizing the Tcl core. To enable Tcl multithreading support,
you must include the \fB\-\|\-enable-threads\fR option to \fBconfigure\fR
when you configure and compile your Tcl core.
customizing the Tcl core. Starting with the 8.6 release, Tcl
multithreading support is on by default. To disable Tcl multithreading
support, you must include the \fB\-\|\-disable-threads\fR option to
\fBconfigure\fR when you configure and compile your Tcl core.
.PP
An important constraint of the Tcl threads implementation is that
\fIonly the thread that created a Tcl interpreter can use that
@@ -126,7 +127,7 @@ will cause a memory leak.
.PP
The \fBTcl_GetThreadData\fR call returns a pointer to a block of
thread-private data. Its argument is a key that is shared by all threads
and a size for the block of storage. The storage is automatically
and a size for the block of storage. The storage is automatically
allocated and initialized to all zeros the first time each thread asks for it.
The storage is automatically deallocated by \fBTcl_FinalizeThread\fR.
.SS "SYNCHRONIZATION AND COMMUNICATION"
+1 -1
View File
@@ -3,7 +3,7 @@
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\"
.TH Tcl_UtfToUpper 3 "8.1" Tcl "Tcl Library Procedures"
.so man.macros
.BS
+11 -24
View File
@@ -78,7 +78,7 @@ created. \fIClientData\fR typically points to an application-specific
data structure that describes what to do when \fIproc\fR is invoked.
\fIOldName\fR gives the name of the command being renamed, and
\fInewName\fR gives the name that the command is being renamed to (or
an empty string or NULL when the command is being deleted.)
NULL when the command is being deleted.)
\fIFlags\fR is an OR'ed combination of bits potentially providing
several pieces of information. One of the bits \fBTCL_TRACE_RENAME\fR and
\fBTCL_TRACE_DELETE\fR will be set in \fIflags\fR to indicate which
@@ -86,11 +86,14 @@ operation is being performed on the command. The bit
\fBTCL_TRACE_DESTROYED\fR will be set in \fIflags\fR if the trace is about
to be destroyed; this information may be useful to \fIproc\fR so that
it can clean up its own internal data structures (see the section
\fBTCL_TRACE_DESTROYED\fR below for more details). Lastly, the bit
\fBTCL_INTERP_DESTROYED\fR will be set if the entire interpreter is being
destroyed. When this bit is set, \fIproc\fR must be especially
careful in the things it does (see the section \fBTCL_INTERP_DESTROYED\fR
below).
\fBTCL_TRACE_DESTROYED\fR below for more details). Because the
deletion of commands can take place as part of the deletion of the interp
that contains them, \fIproc\fR must be careful about checking what
the passed in \fIinterp\fR value can be called upon to do.
The routine \fBTcl_InterpDeleted\fR is an important tool for this.
When \fBTcl_InterpDeleted\fR returns 1, \fIproc\fR will not be able
to invoke any scripts in \fIinterp\fR. The function of \fIproc\fR
in that circumstance is limited to the cleanup of its own data structures.
.PP
\fBTcl_UntraceCommand\fR may be used to remove a trace. If the
command specified by \fIinterp\fR, \fIcmdName\fR, and \fIflags\fR has
@@ -123,7 +126,8 @@ traces for a given command that have the same \fIproc\fR.
.PP
During rename traces, the command being renamed is visible with both
names simultaneously, and the command still exists during delete
traces (if \fBTCL_INTERP_DESTROYED\fR is not set). However, there is no
traces, unless the interp that contains it is being deleted.
However, there is no
mechanism for signaling that an error occurred in a trace procedure,
so great care should be taken that errors do not get silently lost.
.SH "MULTIPLE TRACES"
@@ -142,22 +146,5 @@ rename the command, the last renaming takes precedence.
In a delete callback to \fIproc\fR, the \fBTCL_TRACE_DESTROYED\fR bit
is set in \fIflags\fR.
.\" Perhaps need some more comments here? - DKF
.SH "TCL_INTERP_DESTROYED"
.PP
When an interpreter is destroyed, unset traces are called for
all of its commands.
The \fBTCL_INTERP_DESTROYED\fR bit will be set in the \fIflags\fR
argument passed to the trace procedures.
Trace procedures must be extremely careful in what they do if
the \fBTCL_INTERP_DESTROYED\fR bit is set.
It is not safe for the procedures to invoke any Tcl procedures
on the interpreter, since its state is partially deleted.
All that trace procedures should do under these circumstances is
to clean up and free their own internal data structures.
.SH BUGS
.PP
Tcl does not do any error checking to prevent trace procedures
from misusing the interpreter during traces with \fBTCL_INTERP_DESTROYED\fR
set.
.SH KEYWORDS
clientData, trace, command
+8 -8
View File
@@ -3,12 +3,12 @@
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\"
.TH Utf 3 "8.1" Tcl "Tcl Library Procedures"
.so man.macros
.BS
.SH NAME
Tcl_UniChar, Tcl_UniCharCaseMatch, Tcl_UniCharNcasecmp, Tcl_UniCharToUtf, Tcl_UtfToUniChar, Tcl_UniCharToUtfDString, Tcl_UtfToUniCharDString, Tcl_UniCharLen, Tcl_UniCharNcmp, 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_UniCharToUtfDString, Tcl_UtfToUniCharDString, 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
@@ -48,7 +48,7 @@ int
int
\fBTcl_UtfCharComplete\fR(\fIsrc, length\fR)
.sp
int
int
\fBTcl_NumUtfChars\fR(\fIsrc, length\fR)
.sp
const char *
@@ -109,7 +109,7 @@ Pointer to the beginning of a UTF-8 string.
.AP int index in
The index of a character (not byte) in the UTF-8 string.
.AP int *readPtr out
If non-NULL, filled with the number of bytes in the backslash sequence,
If non-NULL, filled with the number of bytes in the backslash sequence,
including the backslash character.
.AP char *dst out
Buffer in which the bytes represented by the backslash sequence are stored.
@@ -142,7 +142,7 @@ end and dereference non-existent or random memory; if the source buffer
is known to be null-terminated, this will not happen. If the input is
not in proper UTF-8 format, \fBTcl_UtfToUniChar\fR will store the first
byte of \fIsrc\fR in \fI*chPtr\fR as a Tcl_UniChar between 0x0000 and
0x00ff and return 1.
0x00ff and return 1.
.PP
\fBTcl_UniCharToUtfDString\fR converts the given Unicode string
to UTF-8, storing the result in a previously initialized \fBTcl_DString\fR.
@@ -210,12 +210,12 @@ length is negative, all bytes up to the first null byte are used.
\fBTcl_UtfFindFirst\fR corresponds to \fBstrchr\fR for UTF-8 strings. It
returns a pointer to the first occurrence of the Tcl_UniChar \fIch\fR
in the null-terminated UTF-8 string \fIsrc\fR. The null terminator is
considered part of the UTF-8 string.
considered part of the UTF-8 string.
.PP
\fBTcl_UtfFindLast\fR corresponds to \fBstrrchr\fR for UTF-8 strings. It
returns a pointer to the last occurrence of the Tcl_UniChar \fIch\fR
in the null-terminated UTF-8 string \fIsrc\fR. The null terminator is
considered part of the UTF-8 string.
considered part of the UTF-8 string.
.PP
Given \fIsrc\fR, a pointer to some location in a UTF-8 string,
\fBTcl_UtfNext\fR returns a pointer to the next UTF-8 character in the
@@ -239,7 +239,7 @@ characters. Behavior is undefined if a negative \fIindex\fR is given.
.PP
\fBTcl_UtfAtIndex\fR returns a pointer to the specified character (not
byte) \fIindex\fR in the UTF-8 string \fIsrc\fR. The source string must
contain at least \fIindex\fR characters. This is equivalent to calling
contain at least \fIindex\fR characters. This is equivalent to calling
\fBTcl_UtfNext\fR \fIindex\fR times. If a negative \fIindex\fR is given,
the return pointer points to the first character in the source string.
.PP
+13 -13
View File
@@ -16,13 +16,13 @@ package require \fBTcl 8.5\fR
.sp
\fBclock format\fR \fItimeVal\fR ?\fI\-option value\fR...?
.sp
\fBclock microseconds\fR
\fBclock microseconds\fR
.sp
\fBclock milliseconds\fR
\fBclock milliseconds\fR
.sp
\fBclock scan\fR \fIinputString\fR ?\fI\-option value\fR...?
.sp
\fBclock seconds\fR
\fBclock seconds\fR
.sp
.BE
.SH "DESCRIPTION"
@@ -58,10 +58,10 @@ Formats a time that is expressed as an integer number of seconds into a format
intended for consumption by users or external programs.
See \fBFORMATTING TIMES\fR for a full description.
.TP
\fBclock microseconds\fR
\fBclock microseconds\fR
Returns the current time as an integer number of microseconds. See \fBHIGH RESOLUTION TIMERS\fR for a full description.
.TP
\fBclock milliseconds\fR
\fBclock milliseconds\fR
Returns the current time as an integer number of milliseconds. See \fBHIGH RESOLUTION TIMERS\fR for a full description.
.TP
\fBclock scan\fR \fIinputString\fR ?\fI\-option value\fR...?
@@ -69,7 +69,7 @@ Scans a time that is expressed as a character string and produces an
integer number of seconds.
See \fBSCANNING TIMES\fR for a full description.
.TP
\fBclock seconds\fR
\fBclock seconds\fR
Returns the current time as an integer number of seconds.
.SS "PARAMETERS"
.TP
@@ -113,7 +113,7 @@ and their interpretation, are described under \fBFORMAT GROUPS\fR.
On \fBclock format\fR, the default format is
.PP
.CS
%a %b %d %H:%M:%S %z %Y
%a %b %d %H:%M:%S %Z %Y
.CE
.PP
On \fBclock scan\fR, the lack of a \fB\-format\fR option indicates that a
@@ -525,7 +525,7 @@ string of the same meaning in the locale, to indicate whether \fB%Y\fR refers
to years before or after Year 1 of the Common Era. On input, accepts
the string \fBB.C.E.\fR, \fBB.C.\fR, \fBC.E.\fR, \fBA.D.\fR, or the
abbreviation appropriate to the current locale, and uses it to fix
whether \fB%Y\fR refers to years before or after Year 1 of the
whether \fB%Y\fR refers to years before or after Year 1 of the
Common Era.
.TP
\fB%Ex\fR
@@ -684,8 +684,8 @@ ISO8601 week number.
\fB%w\fR
On output, produces the ordinal number of the day of the week
(Sunday==0; Saturday==6). On input, accepts a single digit and
interprets it as the day of the week; Sunday may be represented as
either 0 or 7. Note that \fB%w\fR is not the ISO8601 weekday number,
interprets it as the day of the week; Sunday may be represented as
either 0 or 7. Note that \fB%w\fR is not the ISO8601 weekday number,
which is produced and accepted by \fB%u\fR.
.TP
\fB%W\fR
@@ -765,7 +765,7 @@ The local time zone from the Control Panel on Windows systems.
The C library's idea of the local time zone, as defined by the
\fBmktime\fR and \fBlocaltime\fR functions.
.PP
In case [1] \fIonly,\fR the string is tested to see if it is one
In case [1] \fIonly,\fR the string is tested to see if it is one
of the strings:
.PP
.CS
@@ -783,7 +783,7 @@ of the strings:
If it is a string in the above list, it designates a known
time zone, and is interpreted as such.
.PP
For time zones in case [1] that do not match any of the above strings,
For time zones in case [1] that do not match any of the above strings,
and always for cases [2]-[6], the following rules apply.
.PP
If the time zone begins with a colon, it is one of a
@@ -909,7 +909,7 @@ giving an explicit \fB\-format\fR option to the \fBclock scan\fR command.
.TP
\fIrelative time\fR
A specification relative to the current time. The format is \fBnumber
unit\fR. Acceptable units are \fByear\fR, \fBfortnight\fR,
unit\fR. Acceptable units are \fByear\fR, \fBfortnight\fR,
\fBmonth\fR, \fBweek\fR, \fBday\fR,
\fBhour\fR, \fBminute\fR (or \fBmin\fR), and \fBsecond\fR (or \fBsec\fR). The
unit can be specified as a singular or plural, as in \fB3 weeks\fR.
+1 -66
View File
@@ -269,17 +269,13 @@ present, as is done when launching applications under wish. It is desirable
to have console applications hidden and detached. This is a designed-in
limitation as \fBexec\fR wants to communicate over pipes. The Expect
extension addresses this issue when communicating with a TUI application.
.RE
.TP
\fBWindows NT\fR
.
.PP
When attempting to execute an application, \fBexec\fR first searches for
the name as it was specified. Then, in order, \fB.com\fR, \fB.exe\fR, and
\fB.bat\fR are appended to the end of the specified name and it searches
for the longer name. If a directory name was not specified as part of the
application name, the following directories are automatically searched in
order when attempting to locate the application:
.RS
.IP \(bu 3
The directory from which the Tcl executable was loaded.
.IP \(bu 3
@@ -299,67 +295,6 @@ the caller must prepend the desired command with
because built-in commands are not implemented using executables.
.RE
.TP
\fBWindows 9x\fR
.
When attempting to execute an application, \fBexec\fR first searches for
the name as it was specified. Then, in order, \fB.com\fR, \fB.exe\fR, and
\fB.bat\fR are appended to the end of the specified name and it searches
for the longer name. If a directory name was not specified as part of the
application name, the following directories are automatically searched in
order when attempting to locate the application:
.RS
.IP \(bu 3
The directory from which the Tcl executable was loaded.
.IP \(bu 3
The current directory.
.IP \(bu 3
The Windows 9x system directory.
.IP \(bu 3
The Windows 9x home directory.
.IP \(bu 3
The directories listed in the path.
.RE
.RS
.PP
In order to execute shell built-in commands like \fBdir\fR and \fBcopy\fR,
the caller must prepend the desired command with
.QW "\fBcommand.com /c\0\fR"
because built-in commands are not implemented using executables.
.PP
Once a 16-bit DOS application has read standard input from a console and
then quit, all subsequently run 16-bit DOS applications will see the
standard input as already closed. 32-bit applications do not have this
problem and will run correctly, even after a 16-bit DOS application thinks
that standard input is closed. There is no known workaround for this bug
at this time.
.PP
Redirection between the \fBNUL:\fR device and a 16-bit application does not
always work. When redirecting from \fBNUL:\fR, some applications may hang,
others will get an infinite stream of
.QW 0x01
bytes, and some will actually
correctly get an immediate end-of-file; the behavior seems to depend upon
something compiled into the application itself. When redirecting greater than
4K or so to \fBNUL:\fR, some applications will hang. The above problems do not
happen with 32-bit applications.
.PP
All DOS 16-bit applications are run synchronously. All standard input from
a pipe to a 16-bit DOS application is collected into a temporary file; the
other end of the pipe must be closed before the 16-bit DOS application
begins executing. All standard output or error from a 16-bit DOS
application to a pipe is collected into temporary files; the application
must terminate before the temporary files are redirected to the next stage
of the pipeline. This is due to a workaround for a Windows 95 bug in the
implementation of pipes, and is how the standard Windows 95 DOS shell
handles pipes itself.
.PP
Certain applications, such as \fBcommand.com\fR, should not be executed
interactively. Applications which directly access the console window,
rather than reading from their standard input and writing to their standard
output may fail, hang Tcl, or even hang the system if their own private
console window is not available to them.
.RE
.TP
\fBUnix\fR (including Mac OS X)
.
The \fBexec\fR command is fully functional and works as described.
+1 -1
View File
@@ -35,7 +35,7 @@ proc main {} {
if {[catch {main} msg options]} {
puts stderr "unexpected script error: $msg"
if {[info exist env(DEBUG)]} {
if {[info exists env(DEBUG)]} {
puts stderr "---- BEGIN TRACE ----"
puts stderr [dict get $options -errorinfo]
puts stderr "---- END TRACE ----"
+3 -5
View File
@@ -241,11 +241,9 @@ as relative to the cwd). Furthermore,
paths are always expanded
to absolute form. When creating links on filesystems that either do not
support any links, or do not support the specific type requested, an
error message will be returned. In particular Windows 95, 98 and ME do
not support any links at present, but most Unix platforms support both
symbolic and hard links (the latter for files only) and Windows
NT/2000/XP (on NTFS drives) support symbolic
directory links and hard file links.
error message will be returned. Most Unix platforms support both
symbolic and hard links (the latter for files only). Windows
supports symbolic directory links and hard file links on NTFS drives.
.RE
.TP
\fBfile lstat \fIname varName\fR
+2 -2
View File
@@ -4,7 +4,7 @@
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\"
.TH for n "" Tcl "Tcl Built-In Commands"
.so man.macros
.BS
@@ -49,7 +49,7 @@ each loop iteration), so changes in the variables will be visible.
See below for an example:
.SH EXAMPLES
.PP
Print a line for each of the integers from 0 to 10:
Print a line for each of the integers from 0 to 9:
.PP
.CS
\fBfor\fR {set x 0} {$x<10} {incr x} {
+1 -7
View File
@@ -204,13 +204,7 @@ of the form
it refers to the home
directory of the user whose account information resides on the specified NT
domain server. Otherwise, user account information is obtained from
the local computer. On Windows 95 and 98, \fBglob\fR accepted patterns
like
.QW .../
and
.QW ..../
for successively higher up parent directories, but later versions of
Windows do not accept these forms.
the local computer.
.PP
Since the backslash character has a special meaning to the glob
command, glob patterns containing Windows style path separators need
+11 -9
View File
@@ -4,7 +4,7 @@
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\"
.TH library n "8.0" Tcl "Tcl Built-In Commands"
.so man.macros
.BS
@@ -19,7 +19,7 @@ auto_execok, auto_import, auto_load, auto_mkindex, auto_qualify, auto_reset, tcl
\fBauto_qualify \fIcommand namespace\fR
\fBauto_reset\fR
\fBtcl_findLibrary \fIbasename version patch initScript enVarName varName\fR
\fBparray \fIarrayName\fR
\fBparray \fIarrayName\fR ?\fIpattern\fR?
\fBtcl_endOfWord \fIstr start\fR
\fBtcl_startOfNextWord \fIstr start\fR
\fBtcl_startOfPreviousWord \fIstr start\fR
@@ -139,7 +139,7 @@ as its first characters then it is assumed to be a procedure
definition and the next word of the line is taken as the
procedure's name.
Procedure definitions that do not appear in this way (e.g.\ they
have spaces before the \fBproc\fR) will not be indexed. If your
have spaces before the \fBproc\fR) will not be indexed. If your
script contains
.QW dangerous
code, such as global initialization
@@ -178,7 +178,7 @@ performing the actual auto-loading of functions at runtime.
This is a standard search procedure for use by extensions during
their initialization. They call this procedure to look for their
script library in several standard directories.
The last component of the name of the library directory is
The last component of the name of the library directory is
normally \fIbasenameversion\fR
(e.g., tk8.0), but it might be
.QW library
@@ -196,9 +196,11 @@ bin or bin/\fIarch\fR directory;
relative to the executable file in the current build tree;
relative to the executable file in a parallel build tree.
.TP
\fBparray \fIarrayName\fR
Prints on standard output the names and values of all the elements
in the array \fIarrayName\fR.
\fBparray \fIarrayName\fR ?\fIpattern\fR?
Prints on standard output the names and values of all the elements in the
array \fIarrayName\fR, or just the names that match \fIpattern\fR (using the
matching rules of \fBstring match\fR) and their values if \fIpattern\fR is
given.
\fIArrayName\fR must be an array accessible to the caller of \fBparray\fR.
It may be either local or global.
.TP
@@ -283,7 +285,7 @@ a default value is used.
.TP
\fBenv(TCLLIBPATH)\fR
If set, then it must contain a valid Tcl list giving directories to
search during auto-load operations. Directories must be specified in
search during auto-load operations. Directories must be specified in
Tcl format, using
.QW /
as the path separator, regardless of platform.
@@ -312,7 +314,7 @@ Unix, words are comprised of numbers, letters or underscores.
.SH "SEE ALSO"
env(n), info(n), re_syntax(n)
.SH KEYWORDS
auto-exec, auto-load, library, unknown, word, whitespace
auto-exec, auto-load, library, unknown, word, whitespace
'\"Local Variables:
'\"mode: nroff
'\"End:
+1 -1
View File
@@ -35,7 +35,7 @@ by \fIfirst\fR must exist or \fIfirst\fR must indicate before the
start of the list.
.PP
If \fIlast\fR is less than \fIfirst\fR, then any specified elements
will be inserted into the list at the point specified by \fIfirst\fR
will be inserted into the list before the point specified by \fIfirst\fR
with no elements being deleted.
.PP
The \fIelement\fR arguments specify zero or more new arguments to
+286 -20
View File
@@ -13,29 +13,43 @@ msgcat \- Tcl message catalog
.SH SYNOPSIS
\fBpackage require Tcl 8.5\fR
.sp
\fBpackage require msgcat 1.5\fR
\fBpackage require msgcat 1.6\fR
.sp
\fB::msgcat::mc \fIsrc-string\fR ?\fIarg arg ...\fR?
.sp
\fB::msgcat::mcmax ?\fIsrc-string src-string ...\fR?
.sp
.VS "TIP 412"
\fB::msgcat::mcexists\fR ?\fB-exactnamespace\fR? ?\fB-exactlocale\fR? \fIsrc-string\fR
.VE "TIP 412"
.sp
\fB::msgcat::mclocale \fR?\fInewLocale\fR?
.sp
\fB::msgcat::mcpreferences\fR
.sp
.VS "TIP 412"
\fB::msgcat::mcloadedlocales subcommand\fR ?\fIlocale\fR?
.VE "TIP 412"
.sp
\fB::msgcat::mcload \fIdirname\fR
.sp
\fB::msgcat::mcset \fIlocale src-string \fR?\fItranslate-string\fR?
.sp
\fB::msgcat::mcmset \fIlocale src-trans-list\fR
.sp
.VS "TIP 404"
\fB::msgcat::mcflset \fIsrc-string \fR?\fItranslate-string\fR?
.sp
\fB::msgcat::mcflmset \fIsrc-trans-list\fR
.VE "TIP 404"
.sp
\fB::msgcat::mcunknown \fIlocale src-string\fR ?\fIarg arg ...\fR?
.sp
.VS "TIP 412"
\fB::msgcat::mcpackagelocale subcommand\fR ?\fIlocale\fR?
.sp
\fB::msgcat::mcpackageconfig subcommand\fR \fIoption\fR ?\fIvalue\fR?
.sp
\fB::msgcat::mcforgetpackage\fR
.VE "TIP 412"
.BE
.SH DESCRIPTION
.PP
@@ -46,18 +60,23 @@ Text strings are defined in a
which is independent from the application, and
which can be edited or localized without modifying
the application source code. New languages
or locales are provided by adding a new file to
or locales may be provided by adding a new file to
the message catalog.
.PP
Use of the message catalog is optional by any application
or package, but is encouraged if the application or package
wishes to be enabled for multi-lingual applications.
\fBmsgcat\fR distinguises packages by its namespace.
Each package has its own message catalog and configuration settings in \fBmsgcat\fR.
.PP
A \fIlocale\fR is a specification string describing a user language like \fBde_ch\fR for Swiss German.
In \fBmsgcat\fR, there is a global locale initialized by the system locale of the current system.
Each package may decide to use the global locale or to use a package specific locale.
.PP
The global locale may be changed on demand, for example by a user initiated language change or within a multi user application like a web server.
.SH COMMANDS
.TP
\fB::msgcat::mc \fIsrc-string\fR ?\fIarg arg ...\fR?
.
Returns a translation of \fIsrc-string\fR according to the
user's current locale. If additional arguments past \fIsrc-string\fR
current locale. If additional arguments past \fIsrc-string\fR
are given, the \fBformat\fR command is used to substitute the
additional arguments in the translation of \fIsrc-string\fR.
.RS
@@ -84,6 +103,18 @@ of the longest translated string. This is useful when designing
localized GUIs, which may require that all buttons, for example, be a
fixed width (which will be the width of the widest button).
.TP
\fB::msgcat::mcexists\fR ?\fB-exactnamespace\fR? ?\fB-exactlocale\fR? \fIsrc-string\fR
.
.VS "TIP 412"
Return true, if there is a translation for the given \fIsrc-string\fR.
.PP
.RS
The search may be limited by the option \fB\-exactnamespace\fR to only check the current namespace and not any parent namespaces.
.PP
It may also be limited by the option \fB\-exactlocale\fR to only check the first prefered locale (e.g. first element returned by \fB::msgcat::mcpreferences\fR if global locale is used).
.RE
.VE "TIP 412"
.TP
\fB::msgcat::mclocale \fR?\fInewLocale\fR?
.
This function sets the locale to \fInewLocale\fR. If \fInewLocale\fR
@@ -93,6 +124,13 @@ case-insensitive manner, and returns locales in lowercase.
The initial locale is determined by the locale specified in
the user's environment. See \fBLOCALE SPECIFICATION\fR
below for a description of the locale string format.
.RS
.PP
.VS "TIP 412"
If the locale is set, the preference list of locales is evaluated.
Locales in this list are loaded now, if not jet loaded.
.VE "TIP 412"
.RE
.TP
\fB::msgcat::mcpreferences\fR
.
@@ -103,13 +141,26 @@ preference. The list is derived from the current
locale set in msgcat by \fB::msgcat::mclocale\fR, and
cannot be set independently. For example, if the
current locale is en_US_funky, then \fB::msgcat::mcpreferences\fR
returns \fB{en_US_funky en_US en {}}\fR.
returns \fB{en_us_funky en_us en {}}\fR.
.TP
\fB::msgcat:mcloadedlocales subcommand\fR ?\fIlocale\fR?
.
This group of commands manage the list of loaded locales for packages not setting a package locale.
.PP
.RS
The subcommand \fBget\fR returns the list of currently loaded locales.
.PP
The subcommand \fBpresent\fR requires the argument \fIlocale\fR and returns true, if this locale is loaded.
.PP
The subcommand \fBclear\fR removes all locales and their data, which are not in the current preference list.
.RE
.TP
\fB::msgcat::mcload \fIdirname\fR
.
.VS "TIP 412"
Searches the specified directory for files that match
the language specifications returned by \fB::msgcat::mcpreferences\fR
(note that these are all lowercase), extended by the file extension
the language specifications returned by \fB::msgcat::mcloadedlocales get\fR
(or \fBmsgcat::mcpackagelocale preferences\fR if a package locale is set) (note that these are all lowercase), extended by the file extension
.QW .msg .
Each matching file is
read in order, assuming a UTF-8 encoding. The file contents are
@@ -118,6 +169,11 @@ may be present in the message file either directly in their UTF-8
encoded form, or by use of the backslash-u quoting recognized by Tcl
evaluation. The number of message files which matched the specification
and were loaded is returned.
.RS
.PP
In addition, the given folder is stored in the \fBmsgcat\fR package configuration option \fImcfolder\fR to eventually load message catalog files required by a locale change.
.VE "TIP 412"
.RE
.TP
\fB::msgcat::mcset \fIlocale src-string \fR?\fItranslate-string\fR?
.
@@ -138,16 +194,13 @@ faster than multiple invocations of \fB::msgcat::mcset\fR. The function
returns the number of translations set.
.TP
\fB::msgcat::mcflset \fIsrc-string \fR?\fItranslate-string\fR?
.VS "TIP 404"
Sets the translation for \fIsrc-string\fR to \fItranslate-string\fR in the
current namespace for the locale implied by the name of the message catalog
being loaded via \fB::msgcat::mcload\fR. If \fItranslate-string\fR is not
specified, \fIsrc-string\fR is used for both. The function returns
\fItranslate-string\fR.
.VE "TIP 404"
.TP
\fB::msgcat::mcflmset \fIsrc-trans-list\fR
.VS "TIP 404"
Sets the translation for multiple source strings in \fIsrc-trans-list\fR in
the current namespace for the locale implied by the name of the message
catalog being loaded via \fB::msgcat::mcload\fR. \fIsrc-trans-list\fR must
@@ -155,7 +208,6 @@ have an even number of elements and is in the form {\fIsrc-string
translate-string\fR ?\fIsrc-string translate-string ...\fR?}
\fB::msgcat::mcflmset\fR can be significantly faster than multiple invocations
of \fB::msgcat::mcflset\fR. The function returns the number of translations set.
.VE "TIP 404"
.TP
\fB::msgcat::mcunknown \fIlocale src-string\fR ?\fIarg arg ...\fR?
.
@@ -168,7 +220,18 @@ application, for example to log error messages for each unknown
string. The \fB::msgcat::mcunknown\fR procedure is invoked at the
same stack context as the call to \fB::msgcat::mc\fR. The return value
of \fB::msgcat::mcunknown\fR is used as the return value for the call
to \fB::msgcat::mc\fR.
to \fB::msgcat::mc\fR.
.VS "TIP 412"
.RS
.PP
Note that this routine is only called if the concerned package did not set a package locale unknown command name.
.RE
.TP
\fB::msgcat::mcforgetpackage\fR
.
The calling package clears all its state within the \fBmsgcat\fR package including all settings and translations.
.VE "TIP 412"
.PP
.SH "LOCALE SPECIFICATION"
.PP
The locale is specified to \fBmsgcat\fR by a locale string
@@ -217,15 +280,15 @@ When a locale is specified by the user, a
search is performed during string translation. For example, if a user
specifies
en_GB_Funky, the locales
.QW en_GB_Funky ,
.QW en_GB ,
.QW en_gb_funky ,
.QW en_gb ,
.QW en
and
.MT
(the empty string)
are searched in order until a matching translation
string is found. If no translation string is available, then
\fB::msgcat::mcunknown\fR is called.
the unknown handler is called.
.SH "NAMESPACES AND MESSAGE CATALOGS"
.PP
Strings stored in the message catalog are stored relative
@@ -321,7 +384,7 @@ the package. For example, a short \fBes.msg\fR might contain:
.PP
.CS
namespace eval ::mypackage {
\fB::msgcat::mcflset\fR "Free Beer!" "Cerveza Gracias!"
\fB::msgcat::mcflset\fR "Free Beer" "Cerveza Gratis"
}
.CE
.SH "RECOMMENDED MESSAGE SETUP FOR PACKAGES"
@@ -373,6 +436,209 @@ formatting substitution is done directly.
# ... where that key is mapped to one of the
# human-oriented versions by \fBmsgcat::mcset\fR
.CE
.VS "TIP 412"
.SH Package private locale
.PP
A package using \fBmsgcat\fR may choose to use its own package private
locale and its own set of loaded locales, independent to the global
locale set by \fB::msgcat::mclocale\fR.
.PP
This allows a package to change its locale without causing any locales load or removal in other packages and not to invoke the global locale change callback (see below).
.PP
This action is controled by the following ensemble:
.TP
\fB::msgcat::mcpackagelocale set\fR ?\fIlocale\fR?
.
Set or change a package private locale.
The package private locale is set to the given \fIlocale\fR if the \fIlocale\fR is given.
If the option \fIlocale\fR is not given, the package is set to package private locale mode, but no locale is changed (e.g. if the global locale was valid for the package before, it is copied to the package private locale).
.PP
.RS
This command may cause the load of locales.
.RE
.TP
\fB::msgcat::mcpackagelocale get\fR
.
Return the package private locale or the global locale, if no package private locale is set.
.TP
\fB::msgcat::mcpackagelocale preferences\fR
.
Return the package private preferences or the global preferences,
if no package private locale is set.
.TP
\fB::msgcat::mcpackagelocale loaded\fR
.
Return the list of locales loaded for this package.
.TP
\fB::msgcat::mcpackagelocale isset\fR
.
Returns true, if a package private locale is set.
.TP
\fB::msgcat::mcpackagelocale unset\fR
.
Unset the package private locale and use the globale locale.
Load and remove locales to adjust the list of loaded locales for the
package to the global loaded locales list.
.TP
\fB::msgcat::mcpackagelocale present\fR \fIlocale\fR
.
Returns true, if the given locale is loaded for the package.
.TP
\fB::msgcat::mcpackagelocale clear\fR
.
Clear any loaded locales of the package not present in the package preferences.
.PP
.SH Changing package options
.PP
Each package using msgcat has a set of options within \fBmsgcat\fR.
The package options are described in the next sectionPackage options.
Each package option may be set or unset individually using the following ensemble:
.TP
\fB::msgcat::mcpackageconfig get\fR \fIoption\fR
.
Return the current value of the given \fIoption\fR.
This call returns an error if the option is not set for the package.
.TP
\fB::msgcat::mcpackageconfig isset\fR \fIoption\fR
.
Returns 1, if the given \fIoption\fR is set for the package, 0 otherwise.
.TP
\fB::msgcat::mcpackageconfig set\fR \fIoption\fR \fIvalue\fR
.
Set the given \fIoption\fR to the given \fIvalue\fR.
This may invoke additional actions in dependency of the \fIoption\fR.
The return value is 0 or the number of loaded packages for the option \fBmcfolder\fR.
.TP
\fB::msgcat::mcpackageconfig unset\fR \fIoption\fR
.
Unsets the given \fIoption\fR for the package.
No action is taken if the \fIoption\fR is not set for the package.
The empty string is returned.
.SS Package options
.PP
The following package options are available for each package:
.TP
\fBmcfolder\fR
.
This is the message folder of the package. This option is set by mcload and by the subcommand set. Both are identical and both return the number of loaded message catalog files.
.RS
.PP
Setting or changing this value will load all locales contained in the preferences valid for the package. This implies also to invoke any set loadcmd (see below).
.PP
Unsetting this value will disable message file load for the package.
.RE
.TP
\fBloadcmd\fR
.
This callback is invoked before a set of message catalog files are loaded for the package which has this property set.
.PP
.RS
This callback may be used to do any preparation work for message file load or to get the message data from another source like a data base. In this case, no message files are used (mcfolder is unset).
.PP
See section \fBcallback invocation\fR below.
The parameter list appended to this callback is the list of locales to load.
.PP
If this callback is changed, it is called with the preferences valid for the package.
.RE
.TP
\fBchangecmd\fR
.
This callback is invoked when a default local change was performed. Its purpose is to allow a package to update any dependency on the default locale like showing the GUI in another language.
.PP
.RS
See the callback invocation section below.
The parameter list appended to this callback is \fBmcpreferences\fR.
The registered callbacks are invoked in no particular order.
.RE
.TP
\fBunknowncmd\fR
.
Use a package locale mcunknown procedure instead of the standard version supplied by the msgcat package (msgcat::mcunknown).
.PP
.RS
The called procedure must return the formatted message which will finally be returned by msgcat::mc.
.PP
A generic unknown handler is used if set to the empty string. This consists in returning the key if no arguments are given. With given arguments, format is used to process the arguments.
.PP
See section \fBcallback invocation\fR below.
The appended arguments are identical to \fB::msgcat::mcunknown\fR.
.RE
.SS Callback invocation
A package may decide to register one or multiple callbacks, as described above.
.PP
Callbacks are invoked, if:
.PP
1. the callback command is set,
.PP
2. the command is not the empty string,
.PP
3. the registering namespace exists.
.PP
If a called routine fails with an error, the \fBbgerror\fR routine for the interpreter is invoked after command completion.
Only exception is the callback \fBunknowncmd\fR, where an error causes the invoking \fBmc\fR-command to fail with that error.
.PP
.SS Examples
Packages which display a GUI may update their widgets when the global locale changes.
To register to a callback, use:
.CS
namespace eval gui {
msgcat::mcpackageconfig changecmd updateGUI
proc updateGui args {
puts "New locale is '[lindex $args 0]'."
}
}
% msgcat::mclocale fr
fr
% New locale is 'fr'.
.CE
.PP
If locales (or additional locales) are contained in another source like a data base, a package may use the load callback and not mcload:
.CS
namespace eval db {
msgcat::mcpackageconfig loadcmd loadMessages
proc loadMessages args {
foreach locale $args {
if {[LocaleInDB $locale]} {
msgcat::mcmset $locale [GetLocaleList $locale]
}
}
}
}
.CE
.PP
The \fBclock\fR command implementation uses \fBmsgcat\fR with a package locale to implement the command line parameter \fB-locale\fR.
Here are some sketches of the implementation:
.PP
First, a package locale is initialized and the generic unknown function is desactivated:
.CS
msgcat::mcpackagelocale set
msgcat::mcpackageconfig unknowncmd ""
.CE
As an example, the user requires the week day in a certain locale as follows:
.CS
clock format clock seconds -format %A -locale fr
.CE
\fBclock\fR sets the package locale to \fBfr\fR and looks for the day name as follows:
.CS
msgcat::mcpackagelocale set $locale
return [lindex [msgcat::mc DAYS_OF_WEEK_FULL] $day]
### Returns "mercredi"
.CE
Within \fBclock\fR, some message-catalog items are heavy in computation and thus are dynamically cached using:
.CS
proc ::tcl::clock::LocalizeFormat { locale format } {
set key FORMAT_$format
if { [::msgcat::mcexists -exactlocale -exactnamespace $key] } {
return [mc $key]
}
#...expensive computation of format clipped...
mcset $locale $key $format
return $format
}
.CE
.VE "TIP 412"
.SH CREDITS
.PP
The message catalog code was developed by Mark Harrison.
+1 -1
View File
@@ -37,7 +37,7 @@ the \fBoo::object\fR class, which is not publicly visible by default:
oo::class create c {
method count {} {
\fBmy\fR variable counter
print [incr counter]
puts [incr counter]
}
}
c create o
+7 -5
View File
@@ -96,9 +96,11 @@ forward to the proper implementation of the method (which it does by invoking
the \fBnext\fR command as filters are inserted into the front of the method
call chain) and is responsible for returning the result of \fBnext\fR.
.PP
Filters are not invoked when processing an invocation of the \fBunknown\fR
method because of a failure to locate a method implementation, or when
invoking either constructors or destructors.
Filters are invoked when processing an invokation of the \fBunknown\fR
method because of a failure to locate a method implementation, but \fInot\fR
when invoking either constructors or destructors. (Note however that the
\fBdestroy\fR method is a conventional method, and filters are invoked as
normal when it is called.)
.SH EXAMPLES
.PP
This example demonstrates how to use the \fBnext\fR command to call the
@@ -120,7 +122,7 @@ oo::class create theSubclass {
}
}
theSubclass create obj
oo::define obj method example args {
oo::objdefine obj method example args {
puts "per-object method, args = $args"
\fBnext\fR x {*}$args y
\fBnext\fR
@@ -174,7 +176,7 @@ oo::class create cache {
}
oo::object create demo
oo::define demo {
oo::objdefine demo {
mixin cache
method compute {a b c} {
after 3000 \fI;# Simulate deep thought\fR
+13 -48
View File
@@ -361,63 +361,28 @@ may cause this error.
A BREAK condition has been detected by your UART (see above).
.SH "PORTABILITY ISSUES"
.TP
\fBWindows \fR(all versions)
\fBWindows \fR
.
Valid values for \fIfileName\fR to open a serial port are of the form
\fBcom\fIX\fB:\fR, where \fIX\fR is a number, generally from 1 to 4.
This notation only works for serial ports from 1 to 9, if the system
happens to have more than four. An attempt to open a serial port that
\fBcom\fIX\fB\fR, where \fIX\fR is a number, generally from 1 to 9.
A legacy form accepted as well is \fBcom\fIX\fB:\fR. This notation only
works for serial ports from 1 to 9. An attempt to open a serial port that
does not exist or has a number greater than 9 will fail. An alternate
form of opening serial ports is to use the filename \fB\e\e.\ecomX\fR,
where X is any number that corresponds to a serial port; please note
that this method is considerably slower on Windows 95 and Windows 98.
.TP
\fBWindows NT\fR
.
form of opening serial ports is to use the filename \fB//./comX\fR,
where X is any number that corresponds to a serial port.
.PP
.RS
When running Tcl interactively, there may be some strange interactions
between the real console, if one is present, and a command pipeline that uses
standard input or output. If a command pipeline is opened for reading, some
of the lines entered at the console will be sent to the command pipeline and
some will be sent to the Tcl evaluator. If a command pipeline is opened for
writing, keystrokes entered into the console are not visible until the
pipe is closed. This behavior occurs whether the command pipeline is
executing 16-bit or 32-bit applications. These problems only occur because
both Tcl and the child application are competing for the console at
the same time. If the command pipeline is started from a script, so that Tcl
is not accessing the console, or if the command pipeline does not use
standard input or output, but is redirected from or to a file, then the
above problems do not occur.
.TP
\fBWindows 95\fR
.
A command pipeline that executes a 16-bit DOS application cannot be opened
for both reading and writing, since 16-bit DOS applications that receive
standard input from a pipe and send standard output to a pipe run
synchronously. Command pipelines that do not execute 16-bit DOS
applications run asynchronously and can be opened for both reading and
writing.
.RS
.PP
When running Tcl interactively, there may be some strange interactions
between the real console, if one is present, and a command pipeline that uses
standard input or output. If a command pipeline is opened for reading from
a 32-bit application, some of the keystrokes entered at the console will be
sent to the command pipeline and some will be sent to the Tcl evaluator. If
a command pipeline is opened for writing to a 32-bit application, no output
is visible on the console until the pipe is closed. These problems only
occur because both Tcl and the child application are competing for the
console at the same time. If the command pipeline is started from a script,
so that Tcl is not accessing the console, or if the command pipeline does
not use standard input or output, but is redirected from or to a file, then
the above problems do not occur.
.PP
Whether or not Tcl is running interactively, if a command pipeline is opened
for reading from a 16-bit DOS application, the call to \fBopen\fR will not
return until end-of-file has been received from the command pipeline's
standard output. If a command pipeline is opened for writing to a 16-bit DOS
application, no data will be sent to the command pipeline's standard output
until the pipe is actually closed. This problem occurs because 16-bit DOS
applications are run synchronously, as described above.
pipe is closed. These problems only occur because both Tcl and the child
application are competing for the console at the same time. If the command
pipeline is started from a script, so that Tcl is not accessing the console,
or if the command pipeline does not use standard input or output, but is
redirected from or to a file, then the above problems do not occur.
.RE
.TP
\fBUnix\fR\0\0\0\0\0\0\0
+25 -1
View File
@@ -683,9 +683,33 @@ earlier in the RE taking priority over ones starting later. Note that
outer subexpressions thus take priority over their component
subexpressions.
.PP
Note that the quantifiers \fB{1,1}\fR and \fB{1,1}?\fR can be used to
The quantifiers \fB{1,1}\fR and \fB{1,1}?\fR can be used to
force longest and shortest preference, respectively, on a
subexpression or a whole RE.
.RS
.PP
\fBNOTE:\fR This means that you can usually make a RE be non-greedy overall by
putting \fB{1,1}?\fR after one of the first non-constraint atoms or
parenthesized sub-expressions in it. \fIIt pays to experiment\fR with the
placing of this non-greediness override on a suitable range of input texts
when you are writing a RE if you are using this level of complexity.
.PP
For example, this regular expression is non-greedy, and will match the
shortest substring possible given that
.QW \fBabc\fR
will be matched as early as possible (the quantifier does not change that):
.PP
.CS
ab{1,1}?c.*x.*cba
.CE
.PP
The atom
.QW \fBa\fR
has no greediness preference, we explicitly give one for
.QW \fBb\fR ,
and the remaining quantifiers are overridden to be non-greedy by the preceding
non-greedy quantifier.
.RE
.PP
Match lengths are measured in characters, not collating elements. An
empty string is considered longer than no match at all. For example,
+1 -1
View File
@@ -51,7 +51,7 @@ the \fB(?x)\fR embedded option (see the \fBre_syntax\fR manual page).
.TP 15
\fB\-indices\fR
.
Changes what is stored in the \fIsubMatchVar\fRs.
Changes what is stored in the \fImatchVar\fR and \fIsubMatchVar\fRs.
Instead of storing the matching characters from \fIstring\fR,
each variable
will contain a list of two decimal strings giving the indices
+8
View File
@@ -97,6 +97,10 @@ writable channel event on the socket to get notified when the
asynchronous connection has succeeded or failed. See the \fBvwait\fR
and the \fBchan\fR commands for more details on the event loop and
channel events.
.PP
The \fBchan configure\fR option \fB-connecting\fR may be used to check if the connect is still running. To verify a successful connect, the option \fB-error\fR may be checked when \fB-connecting\fR returned 0.
.PP
Operation without the event queue requires at the moment calls to \fBchan configure\fR to advance the internal state machine.
.RE
.SH "SERVER SOCKETS"
.PP
@@ -186,6 +190,10 @@ sockets, this option returns a list of three elements; these are the
address, the host name and the port to which the peer socket is connected
or bound. If the host name cannot be computed, the second element of the
list is identical to the address, its first element.
.TP
\fB\-connecting\fR
.
This option is not supported by server sockets. For client sockets, this option returns 1 if an asyncroneous connect is still in progress, 0 otherwise.
.PP
.SH "EXAMPLES"
.PP
+2
View File
@@ -43,6 +43,8 @@ or
which will be safely substituted by the Tcl interpreter into
.QW ^Z .
.PP
A leading BOM (Byte order mark) contained in the file is ignored for unicode encodings (utf-8, unicode).
.PP
The \fB\-encoding\fR option is used to specify the encoding of
the data stored in \fIfileName\fR. When the \fB\-encoding\fR option
is omitted, the system encoding is assumed.
-9
View File
@@ -143,15 +143,6 @@ incomplete commands.
.SH "STANDARD CHANNELS"
.PP
See \fBTcl_StandardChannels\fR for more explanations.
.SH ZIPVFS
.PP
When a zipfile is concatenated to the end of a \fBtclsh\fR, on
startup the contents of the zip archive will be mounted as the
virtual file system /zvfs. If a top level directory tcl8.6 is
present in the zip archive, it will become the directory loaded
as env(TCL_LIBRARY). If a file named \fBmain.tcl\fR is present
in the top level directory of the zip archive, it will be sourced
instead of the shell's normal command line handing.
.SH "SEE ALSO"
auto_path(n), encoding(n), env(n), fconfigure(n)
.SH KEYWORDS
-8
View File
@@ -642,14 +642,6 @@ This test can only be run on any Windows platform.
.
This test can only be run on any Windows NT platform.
.TP
\fI95\fR
.
This test can only be run on any Windows 95 platform.
.TP
\fI98\fR
.
This test can only be run on any Windows 98 platform.
.TP
\fImac\fR
.
This test can only be run on any Mac platform.
+7 -7
View File
@@ -299,6 +299,11 @@ so extension writers can specify which package to load depending on the
C run-time library that is in use. This is not an indication that this core
contains symbols.
.TP
\fBengine\fR
.
The name of the Tcl language implementation. When the interpreter is first
created, this is always set to the string \fBTcl\fR.
.TP
\fBmachine\fR
.
The instruction set executed by this machine, such as
@@ -308,18 +313,13 @@ is the value returned by \fBuname -m\fR.
\fBos\fR
.
The name of the operating system running on this machine,
such as \fBWindows 95\fR, \fBWindows NT\fR, or \fBSunOS\fR.
such as \fBWindows NT\fR or \fBSunOS\fR.
On UNIX machines, this is the value returned by \fBuname -s\fR.
On Windows 95 and Windows 98, the value returned will be \fBWindows
95\fR to provide better backwards compatibility to Windows 95; to
distinguish between the two, check the \fBosVersion\fR.
.TP
\fBosVersion\fR
.
The version number for the operating system running on this machine.
On UNIX machines, this is the value returned by \fBuname -r\fR. On
Windows 95, the version will be 4.0; on Windows 98, the version will
be 4.10.
On UNIX machines, this is the value returned by \fBuname -r\fR.
.TP
\fBpathSeparator\fR
.VS 8.6
-114
View File
@@ -1,114 +0,0 @@
'\"
'\" Copyright (c) 2014 Sean Woods
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
.TH zvfs n 0.1 Zvfs "Zvfs Commands"
.so man.macros
.BS
'\" Note: do not modify the .SH NAME line immediately below!
.SH NAME
zvfs \- Mount and work with ZIP files within Tcl
.SH SYNOPSIS
.nf
\fBpackage require zvfs \fR?\fB0.1\fR?
.sp
\fB::zvfs::add\fR ?\fB\-fconfigure \fIoptpairs...\fR? \fIarchive file1\fR ?\fIfile2 ...\fR?
\fB::zvfs::append\fR \fIarchive\fR ?\fIsource destination\fR? ?\fIsource destination...\fR?
\fB::zvfs::dump\fR \fIzipfile\fR
\fB::zvfs::exists\fR \fIfilename\fR
\fB::zvfs::info\fR \fIfile\fR
\fB::zvfs::list\fR ?\fB\-glob\fR|\fB\-regexp\fR? ?\fIpattern\fR?
\fB::zvfs::mount ?\fIarchive\fR? ?\fImountpoint\fR?
\fB::zvfs::start\fR \fIzipfile\fR
\fB::zvfs::unmount \fIarchive\fR
.fi
.BE
.SH DESCRIPTION
.PP
The \fBzvfs\fR package provides tcl with the ability to manipulate
the contents of a zip file archive as a virtual file system.
.TP
\fB::zvfs::mount ?\fIarchive\fR? ?\fImountpoint\fR?
.
The \fB::zvfs::mount\fR procedure mounts a zipfile as a VFS.
After this command
executes, files contained in the ZIP archive, \fIarchive\fR, will appear to Tcl to be
regular files at the mount point.
.RS
.PP
With no \fImountpoint\fR, returns the mount point for \fIarchive\fR. With no \fIarchive\fR,
return all archive/mount pairs. If \fImountpoint\fR is specified as an empty
string, mount on file path.
.RE
.TP
\fB::zvfs::unmount \fIarchive\fR
.
Unmounts a previously mounted zip, \fIarchive\fR.
.TP
\fB::zvfs::append\fR \fIarchive\fR ?\fIsource destination\fR? ?\fIsource destination...\fR?
.
This command reads \fIsource\fR files and appends them (using the name
\fIdestination\fR) to the zip archive named \fIarchive\fR. A new zip archive is created
if it does not already exist. If \fIarchive\fR refers to a file which exists but
is not a zip archive, then this command turns \fIarchive\fR into a zip archive by
appending the necessary records and the table of contents. Treat all files
as binary.
.RS
.PP
Note: No duplicate checking is done, so multiple occurances of the same file is
allowed.
.RE
.TP
\fB::zvfs::add\fR ?\fB\-fconfigure \fIoptpairs...\fR? \fIarchive file1\fR ?\fIfile2 ...\fR?
.
This command is similar to \fBzvfs::append\fR in that it adds files to the zip archive
named \fIarchive\fR, however file names are relative the current directory. In
addition, \fBfconfigure\fR is used to apply option pairs to set upon opening of
each file. Otherwise, default translation is allowed for those file
extensions listed in the \fB::zvfs::auto_ext\fR variable. Binary translation will be
used for unknown extensions.
.RS
.PP
NOTE: Use
.QW "\fB\-fconfigure {}\fR"
to use auto translation for all.
.RE
.TP
\fB::zvfs::exists\fR \fIfilename\fR
.
Return TRUE if the given filename exists in the mounted ZVFS and FALSE if it does
not.
.TP
\fB::zvfs::info\fR \fIfile\fR
.
Return information about the given file in the mounted ZVFS. The information
consists of (1) the name of the ZIP archive that contains the file, (2) the
size of the file after decompressions, (3) the compressed size of the file,
and (4) the offset of the compressed data in the archive.
.RS
.PP
Note: querying the mount point gives the start of zip data offset in (4),
which can be used to truncate the zip info off an executable.
.RE
.TP
\fB::zvfs::list\fR ?\fB\-glob\fR|\fB\-regexp\fR? ?\fIpattern\fR?
.
Return a list of all files in the mounted ZVFS. The order of the names in the list
is arbitrary.
.TP
\fB::zvfs::dump\fR \fIzipfile\fR
.
Describe the contents of a zip.
.TP
\fB::zvfs::start\fR \fIzipfile\fR
.
This command strips returns the offset of zip data.
.SH "SEE ALSO"
tclsh(1), file(n), zlib(n)
.SH "KEYWORDS"
compress, filesystem, zip
'\" Local Variables:
'\" mode: nroff
'\" End:
+8 -7
View File
@@ -259,7 +259,7 @@ newcolor(
return COLORLESS; /* too many colors */
}
n = cm->ncds * 2;
if (n < MAX_COLOR + 1) {
if (n > MAX_COLOR + 1) {
n = MAX_COLOR + 1;
}
if (cm->cd == cm->cdspace) {
@@ -777,18 +777,19 @@ dumpcolors(
}
/*
* It's hard to do this more efficiently.
* Unfortunately, it's hard to do this next bit more efficiently.
*
* Spencer's original coding has the loop iterating from CHR_MIN
* to CHR_MAX, but that's utterly unusable for 32-bit chr, or
* even 16-bit. For debugging purposes it seems fine to print
* only chr codes up to 1000 or so.
*/
for (c=CHR_MIN ; c<CHR_MAX ; c++) {
for (c=CHR_MIN ; c<1000 ; c++) {
if (GETCOLOR(cm, c) == co) {
dumpchr(c, f);
}
}
assert(c == CHR_MAX);
if (GETCOLOR(cm, c) == co) {
dumpchr(c, f);
}
fprintf(f, "\n");
}
}
+1
View File
@@ -81,6 +81,7 @@ addchr(
struct cvec *cv, /* character vector */
pchr c) /* character to add */
{
assert(cv->nchrs < cv->chrspace);
cv->chrs[cv->nchrs++] = (chr)c;
}
-18
View File
@@ -1138,24 +1138,6 @@ newline(void)
return CHR('\n');
}
/*
- ch - return the chr sequence for regc_locale.c's fake collating element ch
* This helps confine use of CHR to this source file. Beware that the caller
* knows how long the sequence is.
^ #ifdef REG_DEBUG
^ static const chr *ch(NOPARMS);
^ #endif
*/
#ifdef REG_DEBUG
static const chr *
ch(void)
{
static const chr chstr[] = { CHR('c'), CHR('h'), CHR('\0') };
return chstr;
}
#endif
/*
- chrnamed - return the chr known by a given (chr string) name
* The code is a bit clumsy, but this routine gets only such specialized
+255 -242
View File
@@ -140,7 +140,7 @@ static const crange alphaRangeTable[] = {
{0x3f7, 0x481}, {0x48a, 0x52f}, {0x531, 0x556}, {0x561, 0x587},
{0x5d0, 0x5ea}, {0x5f0, 0x5f2}, {0x620, 0x64a}, {0x671, 0x6d3},
{0x6fa, 0x6fc}, {0x712, 0x72f}, {0x74d, 0x7a5}, {0x7ca, 0x7ea},
{0x800, 0x815}, {0x840, 0x858}, {0x8a0, 0x8b2}, {0x904, 0x939},
{0x800, 0x815}, {0x840, 0x858}, {0x8a0, 0x8b4}, {0x904, 0x939},
{0x958, 0x961}, {0x971, 0x980}, {0x985, 0x98c}, {0x993, 0x9a8},
{0x9aa, 0x9b0}, {0x9b6, 0x9b9}, {0x9df, 0x9e1}, {0xa05, 0xa0a},
{0xa13, 0xa28}, {0xa2a, 0xa30}, {0xa59, 0xa5c}, {0xa72, 0xa74},
@@ -148,55 +148,58 @@ static const crange alphaRangeTable[] = {
{0xab5, 0xab9}, {0xb05, 0xb0c}, {0xb13, 0xb28}, {0xb2a, 0xb30},
{0xb35, 0xb39}, {0xb5f, 0xb61}, {0xb85, 0xb8a}, {0xb8e, 0xb90},
{0xb92, 0xb95}, {0xba8, 0xbaa}, {0xbae, 0xbb9}, {0xc05, 0xc0c},
{0xc0e, 0xc10}, {0xc12, 0xc28}, {0xc2a, 0xc39}, {0xc85, 0xc8c},
{0xc8e, 0xc90}, {0xc92, 0xca8}, {0xcaa, 0xcb3}, {0xcb5, 0xcb9},
{0xd05, 0xd0c}, {0xd0e, 0xd10}, {0xd12, 0xd3a}, {0xd7a, 0xd7f},
{0xd85, 0xd96}, {0xd9a, 0xdb1}, {0xdb3, 0xdbb}, {0xdc0, 0xdc6},
{0xe01, 0xe30}, {0xe40, 0xe46}, {0xe94, 0xe97}, {0xe99, 0xe9f},
{0xea1, 0xea3}, {0xead, 0xeb0}, {0xec0, 0xec4}, {0xedc, 0xedf},
{0xf40, 0xf47}, {0xf49, 0xf6c}, {0xf88, 0xf8c}, {0x1000, 0x102a},
{0x1050, 0x1055}, {0x105a, 0x105d}, {0x106e, 0x1070}, {0x1075, 0x1081},
{0x10a0, 0x10c5}, {0x10d0, 0x10fa}, {0x10fc, 0x1248}, {0x124a, 0x124d},
{0x1250, 0x1256}, {0x125a, 0x125d}, {0x1260, 0x1288}, {0x128a, 0x128d},
{0x1290, 0x12b0}, {0x12b2, 0x12b5}, {0x12b8, 0x12be}, {0x12c2, 0x12c5},
{0x12c8, 0x12d6}, {0x12d8, 0x1310}, {0x1312, 0x1315}, {0x1318, 0x135a},
{0x1380, 0x138f}, {0x13a0, 0x13f4}, {0x1401, 0x166c}, {0x166f, 0x167f},
{0x1681, 0x169a}, {0x16a0, 0x16ea}, {0x16f1, 0x16f8}, {0x1700, 0x170c},
{0x170e, 0x1711}, {0x1720, 0x1731}, {0x1740, 0x1751}, {0x1760, 0x176c},
{0x176e, 0x1770}, {0x1780, 0x17b3}, {0x1820, 0x1877}, {0x1880, 0x18a8},
{0x18b0, 0x18f5}, {0x1900, 0x191e}, {0x1950, 0x196d}, {0x1970, 0x1974},
{0x1980, 0x19ab}, {0x19c1, 0x19c7}, {0x1a00, 0x1a16}, {0x1a20, 0x1a54},
{0x1b05, 0x1b33}, {0x1b45, 0x1b4b}, {0x1b83, 0x1ba0}, {0x1bba, 0x1be5},
{0x1c00, 0x1c23}, {0x1c4d, 0x1c4f}, {0x1c5a, 0x1c7d}, {0x1ce9, 0x1cec},
{0x1cee, 0x1cf1}, {0x1d00, 0x1dbf}, {0x1e00, 0x1f15}, {0x1f18, 0x1f1d},
{0x1f20, 0x1f45}, {0x1f48, 0x1f4d}, {0x1f50, 0x1f57}, {0x1f5f, 0x1f7d},
{0x1f80, 0x1fb4}, {0x1fb6, 0x1fbc}, {0x1fc2, 0x1fc4}, {0x1fc6, 0x1fcc},
{0x1fd0, 0x1fd3}, {0x1fd6, 0x1fdb}, {0x1fe0, 0x1fec}, {0x1ff2, 0x1ff4},
{0x1ff6, 0x1ffc}, {0x2090, 0x209c}, {0x210a, 0x2113}, {0x2119, 0x211d},
{0x212a, 0x212d}, {0x212f, 0x2139}, {0x213c, 0x213f}, {0x2145, 0x2149},
{0x2c00, 0x2c2e}, {0x2c30, 0x2c5e}, {0x2c60, 0x2ce4}, {0x2ceb, 0x2cee},
{0x2d00, 0x2d25}, {0x2d30, 0x2d67}, {0x2d80, 0x2d96}, {0x2da0, 0x2da6},
{0x2da8, 0x2dae}, {0x2db0, 0x2db6}, {0x2db8, 0x2dbe}, {0x2dc0, 0x2dc6},
{0x2dc8, 0x2dce}, {0x2dd0, 0x2dd6}, {0x2dd8, 0x2dde}, {0x3031, 0x3035},
{0x3041, 0x3096}, {0x309d, 0x309f}, {0x30a1, 0x30fa}, {0x30fc, 0x30ff},
{0x3105, 0x312d}, {0x3131, 0x318e}, {0x31a0, 0x31ba}, {0x31f0, 0x31ff},
{0x3400, 0x4db5}, {0x4e00, 0x9fcc}, {0xa000, 0xa48c}, {0xa4d0, 0xa4fd},
{0xa500, 0xa60c}, {0xa610, 0xa61f}, {0xa640, 0xa66e}, {0xa67f, 0xa69d},
{0xa6a0, 0xa6e5}, {0xa717, 0xa71f}, {0xa722, 0xa788}, {0xa78b, 0xa78e},
{0xa790, 0xa7ad}, {0xa7f7, 0xa801}, {0xa803, 0xa805}, {0xa807, 0xa80a},
{0xa80c, 0xa822}, {0xa840, 0xa873}, {0xa882, 0xa8b3}, {0xa8f2, 0xa8f7},
{0xa90a, 0xa925}, {0xa930, 0xa946}, {0xa960, 0xa97c}, {0xa984, 0xa9b2},
{0xa9e0, 0xa9e4}, {0xa9e6, 0xa9ef}, {0xa9fa, 0xa9fe}, {0xaa00, 0xaa28},
{0xaa40, 0xaa42}, {0xaa44, 0xaa4b}, {0xaa60, 0xaa76}, {0xaa7e, 0xaaaf},
{0xaab9, 0xaabd}, {0xaadb, 0xaadd}, {0xaae0, 0xaaea}, {0xaaf2, 0xaaf4},
{0xab01, 0xab06}, {0xab09, 0xab0e}, {0xab11, 0xab16}, {0xab20, 0xab26},
{0xab28, 0xab2e}, {0xab30, 0xab5a}, {0xab5c, 0xab5f}, {0xabc0, 0xabe2},
{0xac00, 0xd7a3}, {0xd7b0, 0xd7c6}, {0xd7cb, 0xd7fb}, {0xf900, 0xfa6d},
{0xfa70, 0xfad9}, {0xfb00, 0xfb06}, {0xfb13, 0xfb17}, {0xfb1f, 0xfb28},
{0xfb2a, 0xfb36}, {0xfb38, 0xfb3c}, {0xfb46, 0xfbb1}, {0xfbd3, 0xfd3d},
{0xfd50, 0xfd8f}, {0xfd92, 0xfdc7}, {0xfdf0, 0xfdfb}, {0xfe70, 0xfe74},
{0xfe76, 0xfefc}, {0xff21, 0xff3a}, {0xff41, 0xff5a}, {0xff66, 0xffbe},
{0xffc2, 0xffc7}, {0xffca, 0xffcf}, {0xffd2, 0xffd7}, {0xffda, 0xffdc}
{0xc0e, 0xc10}, {0xc12, 0xc28}, {0xc2a, 0xc39}, {0xc58, 0xc5a},
{0xc85, 0xc8c}, {0xc8e, 0xc90}, {0xc92, 0xca8}, {0xcaa, 0xcb3},
{0xcb5, 0xcb9}, {0xd05, 0xd0c}, {0xd0e, 0xd10}, {0xd12, 0xd3a},
{0xd5f, 0xd61}, {0xd7a, 0xd7f}, {0xd85, 0xd96}, {0xd9a, 0xdb1},
{0xdb3, 0xdbb}, {0xdc0, 0xdc6}, {0xe01, 0xe30}, {0xe40, 0xe46},
{0xe94, 0xe97}, {0xe99, 0xe9f}, {0xea1, 0xea3}, {0xead, 0xeb0},
{0xec0, 0xec4}, {0xedc, 0xedf}, {0xf40, 0xf47}, {0xf49, 0xf6c},
{0xf88, 0xf8c}, {0x1000, 0x102a}, {0x1050, 0x1055}, {0x105a, 0x105d},
{0x106e, 0x1070}, {0x1075, 0x1081}, {0x10a0, 0x10c5}, {0x10d0, 0x10fa},
{0x10fc, 0x1248}, {0x124a, 0x124d}, {0x1250, 0x1256}, {0x125a, 0x125d},
{0x1260, 0x1288}, {0x128a, 0x128d}, {0x1290, 0x12b0}, {0x12b2, 0x12b5},
{0x12b8, 0x12be}, {0x12c2, 0x12c5}, {0x12c8, 0x12d6}, {0x12d8, 0x1310},
{0x1312, 0x1315}, {0x1318, 0x135a}, {0x1380, 0x138f}, {0x13a0, 0x13f5},
{0x13f8, 0x13fd}, {0x1401, 0x166c}, {0x166f, 0x167f}, {0x1681, 0x169a},
{0x16a0, 0x16ea}, {0x16f1, 0x16f8}, {0x1700, 0x170c}, {0x170e, 0x1711},
{0x1720, 0x1731}, {0x1740, 0x1751}, {0x1760, 0x176c}, {0x176e, 0x1770},
{0x1780, 0x17b3}, {0x1820, 0x1877}, {0x1880, 0x18a8}, {0x18b0, 0x18f5},
{0x1900, 0x191e}, {0x1950, 0x196d}, {0x1970, 0x1974}, {0x1980, 0x19ab},
{0x19b0, 0x19c9}, {0x1a00, 0x1a16}, {0x1a20, 0x1a54}, {0x1b05, 0x1b33},
{0x1b45, 0x1b4b}, {0x1b83, 0x1ba0}, {0x1bba, 0x1be5}, {0x1c00, 0x1c23},
{0x1c4d, 0x1c4f}, {0x1c5a, 0x1c7d}, {0x1ce9, 0x1cec}, {0x1cee, 0x1cf1},
{0x1d00, 0x1dbf}, {0x1e00, 0x1f15}, {0x1f18, 0x1f1d}, {0x1f20, 0x1f45},
{0x1f48, 0x1f4d}, {0x1f50, 0x1f57}, {0x1f5f, 0x1f7d}, {0x1f80, 0x1fb4},
{0x1fb6, 0x1fbc}, {0x1fc2, 0x1fc4}, {0x1fc6, 0x1fcc}, {0x1fd0, 0x1fd3},
{0x1fd6, 0x1fdb}, {0x1fe0, 0x1fec}, {0x1ff2, 0x1ff4}, {0x1ff6, 0x1ffc},
{0x2090, 0x209c}, {0x210a, 0x2113}, {0x2119, 0x211d}, {0x212a, 0x212d},
{0x212f, 0x2139}, {0x213c, 0x213f}, {0x2145, 0x2149}, {0x2c00, 0x2c2e},
{0x2c30, 0x2c5e}, {0x2c60, 0x2ce4}, {0x2ceb, 0x2cee}, {0x2d00, 0x2d25},
{0x2d30, 0x2d67}, {0x2d80, 0x2d96}, {0x2da0, 0x2da6}, {0x2da8, 0x2dae},
{0x2db0, 0x2db6}, {0x2db8, 0x2dbe}, {0x2dc0, 0x2dc6}, {0x2dc8, 0x2dce},
{0x2dd0, 0x2dd6}, {0x2dd8, 0x2dde}, {0x3031, 0x3035}, {0x3041, 0x3096},
{0x309d, 0x309f}, {0x30a1, 0x30fa}, {0x30fc, 0x30ff}, {0x3105, 0x312d},
{0x3131, 0x318e}, {0x31a0, 0x31ba}, {0x31f0, 0x31ff}, {0x3400, 0x4db5},
{0x4e00, 0x9fd5}, {0xa000, 0xa48c}, {0xa4d0, 0xa4fd}, {0xa500, 0xa60c},
{0xa610, 0xa61f}, {0xa640, 0xa66e}, {0xa67f, 0xa69d}, {0xa6a0, 0xa6e5},
{0xa717, 0xa71f}, {0xa722, 0xa788}, {0xa78b, 0xa7ad}, {0xa7b0, 0xa7b7},
{0xa7f7, 0xa801}, {0xa803, 0xa805}, {0xa807, 0xa80a}, {0xa80c, 0xa822},
{0xa840, 0xa873}, {0xa882, 0xa8b3}, {0xa8f2, 0xa8f7}, {0xa90a, 0xa925},
{0xa930, 0xa946}, {0xa960, 0xa97c}, {0xa984, 0xa9b2}, {0xa9e0, 0xa9e4},
{0xa9e6, 0xa9ef}, {0xa9fa, 0xa9fe}, {0xaa00, 0xaa28}, {0xaa40, 0xaa42},
{0xaa44, 0xaa4b}, {0xaa60, 0xaa76}, {0xaa7e, 0xaaaf}, {0xaab9, 0xaabd},
{0xaadb, 0xaadd}, {0xaae0, 0xaaea}, {0xaaf2, 0xaaf4}, {0xab01, 0xab06},
{0xab09, 0xab0e}, {0xab11, 0xab16}, {0xab20, 0xab26}, {0xab28, 0xab2e},
{0xab30, 0xab5a}, {0xab5c, 0xab65}, {0xab70, 0xabe2}, {0xac00, 0xd7a3},
{0xd7b0, 0xd7c6}, {0xd7cb, 0xd7fb}, {0xdc00, 0xdc3e}, {0xdc40, 0xdc7e},
{0xde80, 0xdebe}, {0xdec0, 0xdefe}, {0xdf00, 0xdf3e}, {0xdf40, 0xdf7e},
{0xdf80, 0xdfbe}, {0xdfc0, 0xdffe}, {0xf900, 0xfa6d}, {0xfa70, 0xfad9},
{0xfb00, 0xfb06}, {0xfb13, 0xfb17}, {0xfb1f, 0xfb28}, {0xfb2a, 0xfb36},
{0xfb38, 0xfb3c}, {0xfb46, 0xfbb1}, {0xfbd3, 0xfd3d}, {0xfd50, 0xfd8f},
{0xfd92, 0xfdc7}, {0xfdf0, 0xfdfb}, {0xfe70, 0xfe74}, {0xfe76, 0xfefc},
{0xff21, 0xff3a}, {0xff41, 0xff5a}, {0xff66, 0xffbe}, {0xffc2, 0xffc7},
{0xffca, 0xffcf}, {0xffd2, 0xffd7}, {0xffda, 0xffdc}
#if TCL_UTF_MAX > 4
,{0x10000, 0x1000b}, {0x1000d, 0x10026}, {0x10028, 0x1003a}, {0x1003f, 0x1004d},
{0x10050, 0x1005d}, {0x10080, 0x100fa}, {0x10280, 0x1029c}, {0x102a0, 0x102d0},
@@ -204,30 +207,33 @@ static const crange alphaRangeTable[] = {
{0x10380, 0x1039d}, {0x103a0, 0x103c3}, {0x103c8, 0x103cf}, {0x10400, 0x1049d},
{0x10500, 0x10527}, {0x10530, 0x10563}, {0x10600, 0x10736}, {0x10740, 0x10755},
{0x10760, 0x10767}, {0x10800, 0x10805}, {0x1080a, 0x10835}, {0x1083f, 0x10855},
{0x10860, 0x10876}, {0x10880, 0x1089e}, {0x10900, 0x10915}, {0x10920, 0x10939},
{0x10980, 0x109b7}, {0x10a10, 0x10a13}, {0x10a15, 0x10a17}, {0x10a19, 0x10a33},
{0x10a60, 0x10a7c}, {0x10a80, 0x10a9c}, {0x10ac0, 0x10ac7}, {0x10ac9, 0x10ae4},
{0x10b00, 0x10b35}, {0x10b40, 0x10b55}, {0x10b60, 0x10b72}, {0x10b80, 0x10b91},
{0x10c00, 0x10c48}, {0x11003, 0x11037}, {0x11083, 0x110af}, {0x110d0, 0x110e8},
{0x11103, 0x11126}, {0x11150, 0x11172}, {0x11183, 0x111b2}, {0x111c1, 0x111c4},
{0x11200, 0x11211}, {0x11213, 0x1122b}, {0x112b0, 0x112de}, {0x11305, 0x1130c},
{0x11313, 0x11328}, {0x1132a, 0x11330}, {0x11335, 0x11339}, {0x1135d, 0x11361},
{0x11480, 0x114af}, {0x11580, 0x115ae}, {0x11600, 0x1162f}, {0x11680, 0x116aa},
{0x118a0, 0x118df}, {0x11ac0, 0x11af8}, {0x12000, 0x12398}, {0x13000, 0x1342e},
{0x16800, 0x16a38}, {0x16a40, 0x16a5e}, {0x16ad0, 0x16aed}, {0x16b00, 0x16b2f},
{0x16b40, 0x16b43}, {0x16b63, 0x16b77}, {0x16b7d, 0x16b8f}, {0x16f00, 0x16f44},
{0x16f93, 0x16f9f}, {0x1bc00, 0x1bc6a}, {0x1bc70, 0x1bc7c}, {0x1bc80, 0x1bc88},
{0x1bc90, 0x1bc99}, {0x1d400, 0x1d454}, {0x1d456, 0x1d49c}, {0x1d4a9, 0x1d4ac},
{0x1d4ae, 0x1d4b9}, {0x1d4bd, 0x1d4c3}, {0x1d4c5, 0x1d505}, {0x1d507, 0x1d50a},
{0x1d50d, 0x1d514}, {0x1d516, 0x1d51c}, {0x1d51e, 0x1d539}, {0x1d53b, 0x1d53e},
{0x1d540, 0x1d544}, {0x1d54a, 0x1d550}, {0x1d552, 0x1d6a5}, {0x1d6a8, 0x1d6c0},
{0x1d6c2, 0x1d6da}, {0x1d6dc, 0x1d6fa}, {0x1d6fc, 0x1d714}, {0x1d716, 0x1d734},
{0x1d736, 0x1d74e}, {0x1d750, 0x1d76e}, {0x1d770, 0x1d788}, {0x1d78a, 0x1d7a8},
{0x1d7aa, 0x1d7c2}, {0x1d7c4, 0x1d7cb}, {0x1e800, 0x1e8c4}, {0x1ee00, 0x1ee03},
{0x1ee05, 0x1ee1f}, {0x1ee29, 0x1ee32}, {0x1ee34, 0x1ee37}, {0x1ee4d, 0x1ee4f},
{0x1ee67, 0x1ee6a}, {0x1ee6c, 0x1ee72}, {0x1ee74, 0x1ee77}, {0x1ee79, 0x1ee7c},
{0x1ee80, 0x1ee89}, {0x1ee8b, 0x1ee9b}, {0x1eea1, 0x1eea3}, {0x1eea5, 0x1eea9},
{0x1eeab, 0x1eebb}, {0x20000, 0x2a6d6}, {0x2a700, 0x2b734}, {0x2b740, 0x2b81d},
{0x10860, 0x10876}, {0x10880, 0x1089e}, {0x108e0, 0x108f2}, {0x10900, 0x10915},
{0x10920, 0x10939}, {0x10980, 0x109b7}, {0x10a10, 0x10a13}, {0x10a15, 0x10a17},
{0x10a19, 0x10a33}, {0x10a60, 0x10a7c}, {0x10a80, 0x10a9c}, {0x10ac0, 0x10ac7},
{0x10ac9, 0x10ae4}, {0x10b00, 0x10b35}, {0x10b40, 0x10b55}, {0x10b60, 0x10b72},
{0x10b80, 0x10b91}, {0x10c00, 0x10c48}, {0x10c80, 0x10cb2}, {0x10cc0, 0x10cf2},
{0x11003, 0x11037}, {0x11083, 0x110af}, {0x110d0, 0x110e8}, {0x11103, 0x11126},
{0x11150, 0x11172}, {0x11183, 0x111b2}, {0x111c1, 0x111c4}, {0x11200, 0x11211},
{0x11213, 0x1122b}, {0x11280, 0x11286}, {0x1128a, 0x1128d}, {0x1128f, 0x1129d},
{0x1129f, 0x112a8}, {0x112b0, 0x112de}, {0x11305, 0x1130c}, {0x11313, 0x11328},
{0x1132a, 0x11330}, {0x11335, 0x11339}, {0x1135d, 0x11361}, {0x11480, 0x114af},
{0x11580, 0x115ae}, {0x115d8, 0x115db}, {0x11600, 0x1162f}, {0x11680, 0x116aa},
{0x11700, 0x11719}, {0x118a0, 0x118df}, {0x11ac0, 0x11af8}, {0x12000, 0x12399},
{0x12480, 0x12543}, {0x13000, 0x1342e}, {0x14400, 0x14646}, {0x16800, 0x16a38},
{0x16a40, 0x16a5e}, {0x16ad0, 0x16aed}, {0x16b00, 0x16b2f}, {0x16b40, 0x16b43},
{0x16b63, 0x16b77}, {0x16b7d, 0x16b8f}, {0x16f00, 0x16f44}, {0x16f93, 0x16f9f},
{0x1bc00, 0x1bc6a}, {0x1bc70, 0x1bc7c}, {0x1bc80, 0x1bc88}, {0x1bc90, 0x1bc99},
{0x1d400, 0x1d454}, {0x1d456, 0x1d49c}, {0x1d4a9, 0x1d4ac}, {0x1d4ae, 0x1d4b9},
{0x1d4bd, 0x1d4c3}, {0x1d4c5, 0x1d505}, {0x1d507, 0x1d50a}, {0x1d50d, 0x1d514},
{0x1d516, 0x1d51c}, {0x1d51e, 0x1d539}, {0x1d53b, 0x1d53e}, {0x1d540, 0x1d544},
{0x1d54a, 0x1d550}, {0x1d552, 0x1d6a5}, {0x1d6a8, 0x1d6c0}, {0x1d6c2, 0x1d6da},
{0x1d6dc, 0x1d6fa}, {0x1d6fc, 0x1d714}, {0x1d716, 0x1d734}, {0x1d736, 0x1d74e},
{0x1d750, 0x1d76e}, {0x1d770, 0x1d788}, {0x1d78a, 0x1d7a8}, {0x1d7aa, 0x1d7c2},
{0x1d7c4, 0x1d7cb}, {0x1e800, 0x1e8c4}, {0x1ee00, 0x1ee03}, {0x1ee05, 0x1ee1f},
{0x1ee29, 0x1ee32}, {0x1ee34, 0x1ee37}, {0x1ee4d, 0x1ee4f}, {0x1ee67, 0x1ee6a},
{0x1ee6c, 0x1ee72}, {0x1ee74, 0x1ee77}, {0x1ee79, 0x1ee7c}, {0x1ee80, 0x1ee89},
{0x1ee8b, 0x1ee9b}, {0x1eea1, 0x1eea3}, {0x1eea5, 0x1eea9}, {0x1eeab, 0x1eebb},
{0x20000, 0x2a6d6}, {0x2a700, 0x2b734}, {0x2b740, 0x2b81d}, {0x2b820, 0x2cea1},
{0x2f800, 0x2fa1d}
#endif
};
@@ -240,27 +246,27 @@ static const chr alphaCharTable[] = {
0x6ff, 0x710, 0x7b1, 0x7f4, 0x7f5, 0x7fa, 0x81a, 0x824, 0x828,
0x93d, 0x950, 0x98f, 0x990, 0x9b2, 0x9bd, 0x9ce, 0x9dc, 0x9dd,
0x9f0, 0x9f1, 0xa0f, 0xa10, 0xa32, 0xa33, 0xa35, 0xa36, 0xa38,
0xa39, 0xa5e, 0xab2, 0xab3, 0xabd, 0xad0, 0xae0, 0xae1, 0xb0f,
0xb10, 0xb32, 0xb33, 0xb3d, 0xb5c, 0xb5d, 0xb71, 0xb83, 0xb99,
0xb9a, 0xb9c, 0xb9e, 0xb9f, 0xba3, 0xba4, 0xbd0, 0xc3d, 0xc58,
0xc59, 0xc60, 0xc61, 0xcbd, 0xcde, 0xce0, 0xce1, 0xcf1, 0xcf2,
0xd3d, 0xd4e, 0xd60, 0xd61, 0xdbd, 0xe32, 0xe33, 0xe81, 0xe82,
0xe84, 0xe87, 0xe88, 0xe8a, 0xe8d, 0xea5, 0xea7, 0xeaa, 0xeab,
0xeb2, 0xeb3, 0xebd, 0xec6, 0xf00, 0x103f, 0x1061, 0x1065, 0x1066,
0x108e, 0x10c7, 0x10cd, 0x1258, 0x12c0, 0x17d7, 0x17dc, 0x18aa, 0x1aa7,
0x1bae, 0x1baf, 0x1cf5, 0x1cf6, 0x1f59, 0x1f5b, 0x1f5d, 0x1fbe, 0x2071,
0x207f, 0x2102, 0x2107, 0x2115, 0x2124, 0x2126, 0x2128, 0x214e, 0x2183,
0x2184, 0x2cf2, 0x2cf3, 0x2d27, 0x2d2d, 0x2d6f, 0x2e2f, 0x3005, 0x3006,
0x303b, 0x303c, 0xa62a, 0xa62b, 0xa7b0, 0xa7b1, 0xa8fb, 0xa9cf, 0xaa7a,
0xaab1, 0xaab5, 0xaab6, 0xaac0, 0xaac2, 0xab64, 0xab65, 0xfb1d, 0xfb3e,
0xfb40, 0xfb41, 0xfb43, 0xfb44
0xa39, 0xa5e, 0xab2, 0xab3, 0xabd, 0xad0, 0xae0, 0xae1, 0xaf9,
0xb0f, 0xb10, 0xb32, 0xb33, 0xb3d, 0xb5c, 0xb5d, 0xb71, 0xb83,
0xb99, 0xb9a, 0xb9c, 0xb9e, 0xb9f, 0xba3, 0xba4, 0xbd0, 0xc3d,
0xc60, 0xc61, 0xcbd, 0xcde, 0xce0, 0xce1, 0xcf1, 0xcf2, 0xd3d,
0xd4e, 0xdbd, 0xe32, 0xe33, 0xe81, 0xe82, 0xe84, 0xe87, 0xe88,
0xe8a, 0xe8d, 0xea5, 0xea7, 0xeaa, 0xeab, 0xeb2, 0xeb3, 0xebd,
0xec6, 0xf00, 0x103f, 0x1061, 0x1065, 0x1066, 0x108e, 0x10c7, 0x10cd,
0x1258, 0x12c0, 0x17d7, 0x17dc, 0x18aa, 0x1aa7, 0x1bae, 0x1baf, 0x1cf5,
0x1cf6, 0x1f59, 0x1f5b, 0x1f5d, 0x1fbe, 0x2071, 0x207f, 0x2102, 0x2107,
0x2115, 0x2124, 0x2126, 0x2128, 0x214e, 0x2183, 0x2184, 0x2cf2, 0x2cf3,
0x2d27, 0x2d2d, 0x2d6f, 0x2e2f, 0x3005, 0x3006, 0x303b, 0x303c, 0xa62a,
0xa62b, 0xa8fb, 0xa8fd, 0xa9cf, 0xaa7a, 0xaab1, 0xaab5, 0xaab6, 0xaac0,
0xaac2, 0xfb1d, 0xfb3e, 0xfb40, 0xfb41, 0xfb43, 0xfb44
#if TCL_UTF_MAX > 4
,0x1003c, 0x1003d, 0x10808, 0x10837, 0x10838, 0x1083c, 0x109be, 0x109bf, 0x10a00,
0x11176, 0x111da, 0x1130f, 0x11310, 0x11332, 0x11333, 0x1133d, 0x114c4, 0x114c5,
0x114c7, 0x11644, 0x118ff, 0x16f50, 0x1b000, 0x1b001, 0x1d49e, 0x1d49f, 0x1d4a2,
0x1d4a5, 0x1d4a6, 0x1d4bb, 0x1d546, 0x1ee21, 0x1ee22, 0x1ee24, 0x1ee27, 0x1ee39,
0x1ee3b, 0x1ee42, 0x1ee47, 0x1ee49, 0x1ee4b, 0x1ee51, 0x1ee52, 0x1ee54, 0x1ee57,
0x1ee59, 0x1ee5b, 0x1ee5d, 0x1ee5f, 0x1ee61, 0x1ee62, 0x1ee64, 0x1ee7e
,0x1003c, 0x1003d, 0x10808, 0x10837, 0x10838, 0x1083c, 0x108f4, 0x108f5, 0x109be,
0x109bf, 0x10a00, 0x11176, 0x111da, 0x111dc, 0x11288, 0x1130f, 0x11310, 0x11332,
0x11333, 0x1133d, 0x11350, 0x114c4, 0x114c5, 0x114c7, 0x11644, 0x118ff, 0x16f50,
0x1b000, 0x1b001, 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4bb, 0x1d546,
0x1ee21, 0x1ee22, 0x1ee24, 0x1ee27, 0x1ee39, 0x1ee3b, 0x1ee42, 0x1ee47, 0x1ee49,
0x1ee4b, 0x1ee51, 0x1ee52, 0x1ee54, 0x1ee57, 0x1ee59, 0x1ee5b, 0x1ee5d, 0x1ee5f,
0x1ee61, 0x1ee62, 0x1ee64, 0x1ee7e
#endif
};
@@ -309,8 +315,8 @@ static const crange digitRangeTable[] = {
#if TCL_UTF_MAX > 4
,{0x104a0, 0x104a9}, {0x11066, 0x1106f}, {0x110f0, 0x110f9}, {0x11136, 0x1113f},
{0x111d0, 0x111d9}, {0x112f0, 0x112f9}, {0x114d0, 0x114d9}, {0x11650, 0x11659},
{0x116c0, 0x116c9}, {0x118e0, 0x118e9}, {0x16a60, 0x16a69}, {0x16b50, 0x16b59},
{0x1d7ce, 0x1d7ff}
{0x116c0, 0x116c9}, {0x11730, 0x11739}, {0x118e0, 0x118e9}, {0x16a60, 0x16a69},
{0x16b50, 0x16b59}, {0x1d7ce, 0x1d7ff}
#endif
};
@@ -342,8 +348,9 @@ static const crange punctRangeTable[] = {
#if TCL_UTF_MAX > 4
,{0x10100, 0x10102}, {0x10a50, 0x10a58}, {0x10af0, 0x10af6}, {0x10b39, 0x10b3f},
{0x10b99, 0x10b9c}, {0x11047, 0x1104d}, {0x110be, 0x110c1}, {0x11140, 0x11143},
{0x111c5, 0x111c8}, {0x11238, 0x1123d}, {0x115c1, 0x115c9}, {0x11641, 0x11643},
{0x12470, 0x12474}, {0x16b37, 0x16b3b}
{0x111c5, 0x111c9}, {0x111dd, 0x111df}, {0x11238, 0x1123d}, {0x115c1, 0x115d7},
{0x11641, 0x11643}, {0x1173c, 0x1173e}, {0x12470, 0x12474}, {0x16b37, 0x16b3b},
{0x1da87, 0x1da8b}
#endif
};
@@ -359,12 +366,13 @@ static const chr punctCharTable[] = {
0x1945, 0x1a1e, 0x1a1f, 0x1c7e, 0x1c7f, 0x1cd3, 0x207d, 0x207e, 0x208d,
0x208e, 0x2329, 0x232a, 0x27c5, 0x27c6, 0x29fc, 0x29fd, 0x2cfe, 0x2cff,
0x2d70, 0x3030, 0x303d, 0x30a0, 0x30fb, 0xa4fe, 0xa4ff, 0xa673, 0xa67e,
0xa8ce, 0xa8cf, 0xa92e, 0xa92f, 0xa95f, 0xa9de, 0xa9df, 0xaade, 0xaadf,
0xaaf0, 0xaaf1, 0xabeb, 0xfd3e, 0xfd3f, 0xfe63, 0xfe68, 0xfe6a, 0xfe6b,
0xff1a, 0xff1b, 0xff1f, 0xff20, 0xff3f, 0xff5b, 0xff5d
0xa8ce, 0xa8cf, 0xa8fc, 0xa92e, 0xa92f, 0xa95f, 0xa9de, 0xa9df, 0xaade,
0xaadf, 0xaaf0, 0xaaf1, 0xabeb, 0xfd3e, 0xfd3f, 0xfe63, 0xfe68, 0xfe6a,
0xfe6b, 0xff1a, 0xff1b, 0xff1f, 0xff20, 0xff3f, 0xff5b, 0xff5d
#if TCL_UTF_MAX > 4
,0x1039f, 0x103d0, 0x1056f, 0x10857, 0x1091f, 0x1093f, 0x10a7f, 0x110bb, 0x110bc,
0x11174, 0x11175, 0x111cd, 0x114c6, 0x16a6e, 0x16a6f, 0x16af5, 0x16b44, 0x1bc9f
0x11174, 0x11175, 0x111cd, 0x111db, 0x112a9, 0x114c6, 0x16a6e, 0x16a6f, 0x16af5,
0x16b44, 0x1bc9f
#endif
};
@@ -395,23 +403,25 @@ static const crange lowerRangeTable[] = {
{0x61, 0x7a}, {0xdf, 0xf6}, {0xf8, 0xff}, {0x17e, 0x180},
{0x199, 0x19b}, {0x1bd, 0x1bf}, {0x233, 0x239}, {0x24f, 0x293},
{0x295, 0x2af}, {0x37b, 0x37d}, {0x3ac, 0x3ce}, {0x3d5, 0x3d7},
{0x3ef, 0x3f3}, {0x430, 0x45f}, {0x561, 0x587}, {0x1d00, 0x1d2b},
{0x1d6b, 0x1d77}, {0x1d79, 0x1d9a}, {0x1e95, 0x1e9d}, {0x1eff, 0x1f07},
{0x1f10, 0x1f15}, {0x1f20, 0x1f27}, {0x1f30, 0x1f37}, {0x1f40, 0x1f45},
{0x1f50, 0x1f57}, {0x1f60, 0x1f67}, {0x1f70, 0x1f7d}, {0x1f80, 0x1f87},
{0x1f90, 0x1f97}, {0x1fa0, 0x1fa7}, {0x1fb0, 0x1fb4}, {0x1fc2, 0x1fc4},
{0x1fd0, 0x1fd3}, {0x1fe0, 0x1fe7}, {0x1ff2, 0x1ff4}, {0x2146, 0x2149},
{0x2c30, 0x2c5e}, {0x2c76, 0x2c7b}, {0x2d00, 0x2d25}, {0xa72f, 0xa731},
{0xa771, 0xa778}, {0xa793, 0xa795}, {0xab30, 0xab5a}, {0xfb00, 0xfb06},
{0xfb13, 0xfb17}, {0xff41, 0xff5a}
{0x3ef, 0x3f3}, {0x430, 0x45f}, {0x561, 0x587}, {0x13f8, 0x13fd},
{0x1d00, 0x1d2b}, {0x1d6b, 0x1d77}, {0x1d79, 0x1d9a}, {0x1e95, 0x1e9d},
{0x1eff, 0x1f07}, {0x1f10, 0x1f15}, {0x1f20, 0x1f27}, {0x1f30, 0x1f37},
{0x1f40, 0x1f45}, {0x1f50, 0x1f57}, {0x1f60, 0x1f67}, {0x1f70, 0x1f7d},
{0x1f80, 0x1f87}, {0x1f90, 0x1f97}, {0x1fa0, 0x1fa7}, {0x1fb0, 0x1fb4},
{0x1fc2, 0x1fc4}, {0x1fd0, 0x1fd3}, {0x1fe0, 0x1fe7}, {0x1ff2, 0x1ff4},
{0x2146, 0x2149}, {0x2c30, 0x2c5e}, {0x2c76, 0x2c7b}, {0x2d00, 0x2d25},
{0xa72f, 0xa731}, {0xa771, 0xa778}, {0xa793, 0xa795}, {0xab30, 0xab5a},
{0xab60, 0xab65}, {0xab70, 0xabbf}, {0xfb00, 0xfb06}, {0xfb13, 0xfb17},
{0xff41, 0xff5a}
#if TCL_UTF_MAX > 4
,{0x10428, 0x1044f}, {0x118c0, 0x118df}, {0x1d41a, 0x1d433}, {0x1d44e, 0x1d454},
{0x1d456, 0x1d467}, {0x1d482, 0x1d49b}, {0x1d4b6, 0x1d4b9}, {0x1d4bd, 0x1d4c3},
{0x1d4c5, 0x1d4cf}, {0x1d4ea, 0x1d503}, {0x1d51e, 0x1d537}, {0x1d552, 0x1d56b},
{0x1d586, 0x1d59f}, {0x1d5ba, 0x1d5d3}, {0x1d5ee, 0x1d607}, {0x1d622, 0x1d63b},
{0x1d656, 0x1d66f}, {0x1d68a, 0x1d6a5}, {0x1d6c2, 0x1d6da}, {0x1d6dc, 0x1d6e1},
{0x1d6fc, 0x1d714}, {0x1d716, 0x1d71b}, {0x1d736, 0x1d74e}, {0x1d750, 0x1d755},
{0x1d770, 0x1d788}, {0x1d78a, 0x1d78f}, {0x1d7aa, 0x1d7c2}, {0x1d7c4, 0x1d7c9}
,{0x10428, 0x1044f}, {0x10cc0, 0x10cf2}, {0x118c0, 0x118df}, {0x1d41a, 0x1d433},
{0x1d44e, 0x1d454}, {0x1d456, 0x1d467}, {0x1d482, 0x1d49b}, {0x1d4b6, 0x1d4b9},
{0x1d4bd, 0x1d4c3}, {0x1d4c5, 0x1d4cf}, {0x1d4ea, 0x1d503}, {0x1d51e, 0x1d537},
{0x1d552, 0x1d56b}, {0x1d586, 0x1d59f}, {0x1d5ba, 0x1d5d3}, {0x1d5ee, 0x1d607},
{0x1d622, 0x1d63b}, {0x1d656, 0x1d66f}, {0x1d68a, 0x1d6a5}, {0x1d6c2, 0x1d6da},
{0x1d6dc, 0x1d6e1}, {0x1d6fc, 0x1d714}, {0x1d716, 0x1d71b}, {0x1d736, 0x1d74e},
{0x1d750, 0x1d755}, {0x1d770, 0x1d788}, {0x1d78a, 0x1d78f}, {0x1d7aa, 0x1d7c2},
{0x1d7c4, 0x1d7c9}
#endif
};
@@ -481,7 +491,7 @@ static const chr lowerCharTable[] = {
0xa763, 0xa765, 0xa767, 0xa769, 0xa76b, 0xa76d, 0xa76f, 0xa77a, 0xa77c,
0xa77f, 0xa781, 0xa783, 0xa785, 0xa787, 0xa78c, 0xa78e, 0xa791, 0xa797,
0xa799, 0xa79b, 0xa79d, 0xa79f, 0xa7a1, 0xa7a3, 0xa7a5, 0xa7a7, 0xa7a9,
0xa7fa, 0xab64, 0xab65
0xa7b5, 0xa7b7, 0xa7fa
#if TCL_UTF_MAX > 4
,0x1d4bb, 0x1d7cb
#endif
@@ -498,20 +508,20 @@ static const crange upperRangeTable[] = {
{0x18e, 0x191}, {0x196, 0x198}, {0x1b1, 0x1b3}, {0x1f6, 0x1f8},
{0x243, 0x246}, {0x388, 0x38a}, {0x391, 0x3a1}, {0x3a3, 0x3ab},
{0x3d2, 0x3d4}, {0x3fd, 0x42f}, {0x531, 0x556}, {0x10a0, 0x10c5},
{0x1f08, 0x1f0f}, {0x1f18, 0x1f1d}, {0x1f28, 0x1f2f}, {0x1f38, 0x1f3f},
{0x1f48, 0x1f4d}, {0x1f68, 0x1f6f}, {0x1fb8, 0x1fbb}, {0x1fc8, 0x1fcb},
{0x1fd8, 0x1fdb}, {0x1fe8, 0x1fec}, {0x1ff8, 0x1ffb}, {0x210b, 0x210d},
{0x2110, 0x2112}, {0x2119, 0x211d}, {0x212a, 0x212d}, {0x2130, 0x2133},
{0x2c00, 0x2c2e}, {0x2c62, 0x2c64}, {0x2c6d, 0x2c70}, {0x2c7e, 0x2c80},
{0xa7aa, 0xa7ad}, {0xff21, 0xff3a}
{0x13a0, 0x13f5}, {0x1f08, 0x1f0f}, {0x1f18, 0x1f1d}, {0x1f28, 0x1f2f},
{0x1f38, 0x1f3f}, {0x1f48, 0x1f4d}, {0x1f68, 0x1f6f}, {0x1fb8, 0x1fbb},
{0x1fc8, 0x1fcb}, {0x1fd8, 0x1fdb}, {0x1fe8, 0x1fec}, {0x1ff8, 0x1ffb},
{0x210b, 0x210d}, {0x2110, 0x2112}, {0x2119, 0x211d}, {0x212a, 0x212d},
{0x2130, 0x2133}, {0x2c00, 0x2c2e}, {0x2c62, 0x2c64}, {0x2c6d, 0x2c70},
{0x2c7e, 0x2c80}, {0xa7aa, 0xa7ad}, {0xa7b0, 0xa7b4}, {0xff21, 0xff3a}
#if TCL_UTF_MAX > 4
,{0x10400, 0x10427}, {0x118a0, 0x118bf}, {0x1d400, 0x1d419}, {0x1d434, 0x1d44d},
{0x1d468, 0x1d481}, {0x1d4a9, 0x1d4ac}, {0x1d4ae, 0x1d4b5}, {0x1d4d0, 0x1d4e9},
{0x1d507, 0x1d50a}, {0x1d50d, 0x1d514}, {0x1d516, 0x1d51c}, {0x1d53b, 0x1d53e},
{0x1d540, 0x1d544}, {0x1d54a, 0x1d550}, {0x1d56c, 0x1d585}, {0x1d5a0, 0x1d5b9},
{0x1d5d4, 0x1d5ed}, {0x1d608, 0x1d621}, {0x1d63c, 0x1d655}, {0x1d670, 0x1d689},
{0x1d6a8, 0x1d6c0}, {0x1d6e2, 0x1d6fa}, {0x1d71c, 0x1d734}, {0x1d756, 0x1d76e},
{0x1d790, 0x1d7a8}
,{0x10400, 0x10427}, {0x10c80, 0x10cb2}, {0x118a0, 0x118bf}, {0x1d400, 0x1d419},
{0x1d434, 0x1d44d}, {0x1d468, 0x1d481}, {0x1d4a9, 0x1d4ac}, {0x1d4ae, 0x1d4b5},
{0x1d4d0, 0x1d4e9}, {0x1d507, 0x1d50a}, {0x1d50d, 0x1d514}, {0x1d516, 0x1d51c},
{0x1d53b, 0x1d53e}, {0x1d540, 0x1d544}, {0x1d54a, 0x1d550}, {0x1d56c, 0x1d585},
{0x1d5a0, 0x1d5b9}, {0x1d5d4, 0x1d5ed}, {0x1d608, 0x1d621}, {0x1d63c, 0x1d655},
{0x1d670, 0x1d689}, {0x1d6a8, 0x1d6c0}, {0x1d6e2, 0x1d6fa}, {0x1d71c, 0x1d734},
{0x1d756, 0x1d76e}, {0x1d790, 0x1d7a8}
#endif
};
@@ -580,8 +590,7 @@ static const chr upperCharTable[] = {
0xa756, 0xa758, 0xa75a, 0xa75c, 0xa75e, 0xa760, 0xa762, 0xa764, 0xa766,
0xa768, 0xa76a, 0xa76c, 0xa76e, 0xa779, 0xa77b, 0xa77d, 0xa77e, 0xa780,
0xa782, 0xa784, 0xa786, 0xa78b, 0xa78d, 0xa790, 0xa792, 0xa796, 0xa798,
0xa79a, 0xa79c, 0xa79e, 0xa7a0, 0xa7a2, 0xa7a4, 0xa7a6, 0xa7a8, 0xa7b0,
0xa7b1
0xa79a, 0xa79c, 0xa79e, 0xa7a0, 0xa7a2, 0xa7a4, 0xa7a6, 0xa7a8, 0xa7b6
#if TCL_UTF_MAX > 4
,0x1d49c, 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d504, 0x1d505, 0x1d538,
0x1d539, 0x1d546, 0x1d7ca
@@ -600,8 +609,8 @@ static const crange graphRangeTable[] = {
{0x559, 0x55f}, {0x561, 0x587}, {0x58d, 0x58f}, {0x591, 0x5c7},
{0x5d0, 0x5ea}, {0x5f0, 0x5f4}, {0x606, 0x61b}, {0x61e, 0x6dc},
{0x6de, 0x70d}, {0x710, 0x74a}, {0x74d, 0x7b1}, {0x7c0, 0x7fa},
{0x800, 0x82d}, {0x830, 0x83e}, {0x840, 0x85b}, {0x8a0, 0x8b2},
{0x8e4, 0x983}, {0x985, 0x98c}, {0x993, 0x9a8}, {0x9aa, 0x9b0},
{0x800, 0x82d}, {0x830, 0x83e}, {0x840, 0x85b}, {0x8a0, 0x8b4},
{0x8e3, 0x983}, {0x985, 0x98c}, {0x993, 0x9a8}, {0x9aa, 0x9b0},
{0x9b6, 0x9b9}, {0x9bc, 0x9c4}, {0x9cb, 0x9ce}, {0x9df, 0x9e3},
{0x9e6, 0x9fb}, {0xa01, 0xa03}, {0xa05, 0xa0a}, {0xa13, 0xa28},
{0xa2a, 0xa30}, {0xa3e, 0xa42}, {0xa4b, 0xa4d}, {0xa59, 0xa5c},
@@ -614,66 +623,67 @@ static const crange graphRangeTable[] = {
{0xba8, 0xbaa}, {0xbae, 0xbb9}, {0xbbe, 0xbc2}, {0xbc6, 0xbc8},
{0xbca, 0xbcd}, {0xbe6, 0xbfa}, {0xc00, 0xc03}, {0xc05, 0xc0c},
{0xc0e, 0xc10}, {0xc12, 0xc28}, {0xc2a, 0xc39}, {0xc3d, 0xc44},
{0xc46, 0xc48}, {0xc4a, 0xc4d}, {0xc60, 0xc63}, {0xc66, 0xc6f},
{0xc78, 0xc7f}, {0xc81, 0xc83}, {0xc85, 0xc8c}, {0xc8e, 0xc90},
{0xc92, 0xca8}, {0xcaa, 0xcb3}, {0xcb5, 0xcb9}, {0xcbc, 0xcc4},
{0xcc6, 0xcc8}, {0xcca, 0xccd}, {0xce0, 0xce3}, {0xce6, 0xcef},
{0xd01, 0xd03}, {0xd05, 0xd0c}, {0xd0e, 0xd10}, {0xd12, 0xd3a},
{0xd3d, 0xd44}, {0xd46, 0xd48}, {0xd4a, 0xd4e}, {0xd60, 0xd63},
{0xd66, 0xd75}, {0xd79, 0xd7f}, {0xd85, 0xd96}, {0xd9a, 0xdb1},
{0xdb3, 0xdbb}, {0xdc0, 0xdc6}, {0xdcf, 0xdd4}, {0xdd8, 0xddf},
{0xde6, 0xdef}, {0xdf2, 0xdf4}, {0xe01, 0xe3a}, {0xe3f, 0xe5b},
{0xe94, 0xe97}, {0xe99, 0xe9f}, {0xea1, 0xea3}, {0xead, 0xeb9},
{0xebb, 0xebd}, {0xec0, 0xec4}, {0xec8, 0xecd}, {0xed0, 0xed9},
{0xedc, 0xedf}, {0xf00, 0xf47}, {0xf49, 0xf6c}, {0xf71, 0xf97},
{0xf99, 0xfbc}, {0xfbe, 0xfcc}, {0xfce, 0xfda}, {0x1000, 0x10c5},
{0x10d0, 0x1248}, {0x124a, 0x124d}, {0x1250, 0x1256}, {0x125a, 0x125d},
{0x1260, 0x1288}, {0x128a, 0x128d}, {0x1290, 0x12b0}, {0x12b2, 0x12b5},
{0x12b8, 0x12be}, {0x12c2, 0x12c5}, {0x12c8, 0x12d6}, {0x12d8, 0x1310},
{0x1312, 0x1315}, {0x1318, 0x135a}, {0x135d, 0x137c}, {0x1380, 0x1399},
{0x13a0, 0x13f4}, {0x1400, 0x167f}, {0x1681, 0x169c}, {0x16a0, 0x16f8},
{0x1700, 0x170c}, {0x170e, 0x1714}, {0x1720, 0x1736}, {0x1740, 0x1753},
{0x1760, 0x176c}, {0x176e, 0x1770}, {0x1780, 0x17dd}, {0x17e0, 0x17e9},
{0x17f0, 0x17f9}, {0x1800, 0x180d}, {0x1810, 0x1819}, {0x1820, 0x1877},
{0x1880, 0x18aa}, {0x18b0, 0x18f5}, {0x1900, 0x191e}, {0x1920, 0x192b},
{0x1930, 0x193b}, {0x1944, 0x196d}, {0x1970, 0x1974}, {0x1980, 0x19ab},
{0x19b0, 0x19c9}, {0x19d0, 0x19da}, {0x19de, 0x1a1b}, {0x1a1e, 0x1a5e},
{0x1a60, 0x1a7c}, {0x1a7f, 0x1a89}, {0x1a90, 0x1a99}, {0x1aa0, 0x1aad},
{0x1ab0, 0x1abe}, {0x1b00, 0x1b4b}, {0x1b50, 0x1b7c}, {0x1b80, 0x1bf3},
{0x1bfc, 0x1c37}, {0x1c3b, 0x1c49}, {0x1c4d, 0x1c7f}, {0x1cc0, 0x1cc7},
{0x1cd0, 0x1cf6}, {0x1d00, 0x1df5}, {0x1dfc, 0x1f15}, {0x1f18, 0x1f1d},
{0x1f20, 0x1f45}, {0x1f48, 0x1f4d}, {0x1f50, 0x1f57}, {0x1f5f, 0x1f7d},
{0x1f80, 0x1fb4}, {0x1fb6, 0x1fc4}, {0x1fc6, 0x1fd3}, {0x1fd6, 0x1fdb},
{0x1fdd, 0x1fef}, {0x1ff2, 0x1ff4}, {0x1ff6, 0x1ffe}, {0x2010, 0x2027},
{0x2030, 0x205e}, {0x2074, 0x208e}, {0x2090, 0x209c}, {0x20a0, 0x20bd},
{0x20d0, 0x20f0}, {0x2100, 0x2189}, {0x2190, 0x23fa}, {0x2400, 0x2426},
{0x2440, 0x244a}, {0x2460, 0x2b73}, {0x2b76, 0x2b95}, {0x2b98, 0x2bb9},
{0x2bbd, 0x2bc8}, {0x2bca, 0x2bd1}, {0x2c00, 0x2c2e}, {0x2c30, 0x2c5e},
{0x2c60, 0x2cf3}, {0x2cf9, 0x2d25}, {0x2d30, 0x2d67}, {0x2d7f, 0x2d96},
{0x2da0, 0x2da6}, {0x2da8, 0x2dae}, {0x2db0, 0x2db6}, {0x2db8, 0x2dbe},
{0x2dc0, 0x2dc6}, {0x2dc8, 0x2dce}, {0x2dd0, 0x2dd6}, {0x2dd8, 0x2dde},
{0x2de0, 0x2e42}, {0x2e80, 0x2e99}, {0x2e9b, 0x2ef3}, {0x2f00, 0x2fd5},
{0x2ff0, 0x2ffb}, {0x3001, 0x303f}, {0x3041, 0x3096}, {0x3099, 0x30ff},
{0x3105, 0x312d}, {0x3131, 0x318e}, {0x3190, 0x31ba}, {0x31c0, 0x31e3},
{0x31f0, 0x321e}, {0x3220, 0x32fe}, {0x3300, 0x4db5}, {0x4dc0, 0x9fcc},
{0xa000, 0xa48c}, {0xa490, 0xa4c6}, {0xa4d0, 0xa62b}, {0xa640, 0xa69d},
{0xa69f, 0xa6f7}, {0xa700, 0xa78e}, {0xa790, 0xa7ad}, {0xa7f7, 0xa82b},
{0xa830, 0xa839}, {0xa840, 0xa877}, {0xa880, 0xa8c4}, {0xa8ce, 0xa8d9},
{0xa8e0, 0xa8fb}, {0xa900, 0xa953}, {0xa95f, 0xa97c}, {0xa980, 0xa9cd},
{0xa9cf, 0xa9d9}, {0xa9de, 0xa9fe}, {0xaa00, 0xaa36}, {0xaa40, 0xaa4d},
{0xaa50, 0xaa59}, {0xaa5c, 0xaac2}, {0xaadb, 0xaaf6}, {0xab01, 0xab06},
{0xab09, 0xab0e}, {0xab11, 0xab16}, {0xab20, 0xab26}, {0xab28, 0xab2e},
{0xab30, 0xab5f}, {0xabc0, 0xabed}, {0xabf0, 0xabf9}, {0xac00, 0xd7a3},
{0xd7b0, 0xd7c6}, {0xd7cb, 0xd7fb}, {0xdc00, 0xdc3e}, {0xdc40, 0xdc7e},
{0xdc80, 0xdcbe}, {0xdcc0, 0xdcfe}, {0xdd80, 0xddbe}, {0xddc0, 0xddfe},
{0xde80, 0xdebe}, {0xdec0, 0xdefe}, {0xdf00, 0xdf3e}, {0xdf40, 0xdf7e},
{0xc46, 0xc48}, {0xc4a, 0xc4d}, {0xc58, 0xc5a}, {0xc60, 0xc63},
{0xc66, 0xc6f}, {0xc78, 0xc7f}, {0xc81, 0xc83}, {0xc85, 0xc8c},
{0xc8e, 0xc90}, {0xc92, 0xca8}, {0xcaa, 0xcb3}, {0xcb5, 0xcb9},
{0xcbc, 0xcc4}, {0xcc6, 0xcc8}, {0xcca, 0xccd}, {0xce0, 0xce3},
{0xce6, 0xcef}, {0xd01, 0xd03}, {0xd05, 0xd0c}, {0xd0e, 0xd10},
{0xd12, 0xd3a}, {0xd3d, 0xd44}, {0xd46, 0xd48}, {0xd4a, 0xd4e},
{0xd5f, 0xd63}, {0xd66, 0xd75}, {0xd79, 0xd7f}, {0xd85, 0xd96},
{0xd9a, 0xdb1}, {0xdb3, 0xdbb}, {0xdc0, 0xdc6}, {0xdcf, 0xdd4},
{0xdd8, 0xddf}, {0xde6, 0xdef}, {0xdf2, 0xdf4}, {0xe01, 0xe3a},
{0xe3f, 0xe5b}, {0xe94, 0xe97}, {0xe99, 0xe9f}, {0xea1, 0xea3},
{0xead, 0xeb9}, {0xebb, 0xebd}, {0xec0, 0xec4}, {0xec8, 0xecd},
{0xed0, 0xed9}, {0xedc, 0xedf}, {0xf00, 0xf47}, {0xf49, 0xf6c},
{0xf71, 0xf97}, {0xf99, 0xfbc}, {0xfbe, 0xfcc}, {0xfce, 0xfda},
{0x1000, 0x10c5}, {0x10d0, 0x1248}, {0x124a, 0x124d}, {0x1250, 0x1256},
{0x125a, 0x125d}, {0x1260, 0x1288}, {0x128a, 0x128d}, {0x1290, 0x12b0},
{0x12b2, 0x12b5}, {0x12b8, 0x12be}, {0x12c2, 0x12c5}, {0x12c8, 0x12d6},
{0x12d8, 0x1310}, {0x1312, 0x1315}, {0x1318, 0x135a}, {0x135d, 0x137c},
{0x1380, 0x1399}, {0x13a0, 0x13f5}, {0x13f8, 0x13fd}, {0x1400, 0x167f},
{0x1681, 0x169c}, {0x16a0, 0x16f8}, {0x1700, 0x170c}, {0x170e, 0x1714},
{0x1720, 0x1736}, {0x1740, 0x1753}, {0x1760, 0x176c}, {0x176e, 0x1770},
{0x1780, 0x17dd}, {0x17e0, 0x17e9}, {0x17f0, 0x17f9}, {0x1800, 0x180d},
{0x1810, 0x1819}, {0x1820, 0x1877}, {0x1880, 0x18aa}, {0x18b0, 0x18f5},
{0x1900, 0x191e}, {0x1920, 0x192b}, {0x1930, 0x193b}, {0x1944, 0x196d},
{0x1970, 0x1974}, {0x1980, 0x19ab}, {0x19b0, 0x19c9}, {0x19d0, 0x19da},
{0x19de, 0x1a1b}, {0x1a1e, 0x1a5e}, {0x1a60, 0x1a7c}, {0x1a7f, 0x1a89},
{0x1a90, 0x1a99}, {0x1aa0, 0x1aad}, {0x1ab0, 0x1abe}, {0x1b00, 0x1b4b},
{0x1b50, 0x1b7c}, {0x1b80, 0x1bf3}, {0x1bfc, 0x1c37}, {0x1c3b, 0x1c49},
{0x1c4d, 0x1c7f}, {0x1cc0, 0x1cc7}, {0x1cd0, 0x1cf6}, {0x1d00, 0x1df5},
{0x1dfc, 0x1f15}, {0x1f18, 0x1f1d}, {0x1f20, 0x1f45}, {0x1f48, 0x1f4d},
{0x1f50, 0x1f57}, {0x1f5f, 0x1f7d}, {0x1f80, 0x1fb4}, {0x1fb6, 0x1fc4},
{0x1fc6, 0x1fd3}, {0x1fd6, 0x1fdb}, {0x1fdd, 0x1fef}, {0x1ff2, 0x1ff4},
{0x1ff6, 0x1ffe}, {0x2010, 0x2027}, {0x2030, 0x205e}, {0x2074, 0x208e},
{0x2090, 0x209c}, {0x20a0, 0x20be}, {0x20d0, 0x20f0}, {0x2100, 0x218b},
{0x2190, 0x23fa}, {0x2400, 0x2426}, {0x2440, 0x244a}, {0x2460, 0x2b73},
{0x2b76, 0x2b95}, {0x2b98, 0x2bb9}, {0x2bbd, 0x2bc8}, {0x2bca, 0x2bd1},
{0x2bec, 0x2bef}, {0x2c00, 0x2c2e}, {0x2c30, 0x2c5e}, {0x2c60, 0x2cf3},
{0x2cf9, 0x2d25}, {0x2d30, 0x2d67}, {0x2d7f, 0x2d96}, {0x2da0, 0x2da6},
{0x2da8, 0x2dae}, {0x2db0, 0x2db6}, {0x2db8, 0x2dbe}, {0x2dc0, 0x2dc6},
{0x2dc8, 0x2dce}, {0x2dd0, 0x2dd6}, {0x2dd8, 0x2dde}, {0x2de0, 0x2e42},
{0x2e80, 0x2e99}, {0x2e9b, 0x2ef3}, {0x2f00, 0x2fd5}, {0x2ff0, 0x2ffb},
{0x3001, 0x303f}, {0x3041, 0x3096}, {0x3099, 0x30ff}, {0x3105, 0x312d},
{0x3131, 0x318e}, {0x3190, 0x31ba}, {0x31c0, 0x31e3}, {0x31f0, 0x321e},
{0x3220, 0x32fe}, {0x3300, 0x4db5}, {0x4dc0, 0x9fd5}, {0xa000, 0xa48c},
{0xa490, 0xa4c6}, {0xa4d0, 0xa62b}, {0xa640, 0xa6f7}, {0xa700, 0xa7ad},
{0xa7b0, 0xa7b7}, {0xa7f7, 0xa82b}, {0xa830, 0xa839}, {0xa840, 0xa877},
{0xa880, 0xa8c4}, {0xa8ce, 0xa8d9}, {0xa8e0, 0xa8fd}, {0xa900, 0xa953},
{0xa95f, 0xa97c}, {0xa980, 0xa9cd}, {0xa9cf, 0xa9d9}, {0xa9de, 0xa9fe},
{0xaa00, 0xaa36}, {0xaa40, 0xaa4d}, {0xaa50, 0xaa59}, {0xaa5c, 0xaac2},
{0xaadb, 0xaaf6}, {0xab01, 0xab06}, {0xab09, 0xab0e}, {0xab11, 0xab16},
{0xab20, 0xab26}, {0xab28, 0xab2e}, {0xab30, 0xab65}, {0xab70, 0xabed},
{0xabf0, 0xabf9}, {0xac00, 0xd7a3}, {0xd7b0, 0xd7c6}, {0xd7cb, 0xd7fb},
{0xdc00, 0xdc3e}, {0xdc40, 0xdc7e}, {0xdc80, 0xdcbe}, {0xdcc0, 0xdcfe},
{0xdd00, 0xdd3e}, {0xdd40, 0xdd7e}, {0xdd80, 0xddbe}, {0xddc0, 0xddfe},
{0xde00, 0xde3e}, {0xde40, 0xde7e}, {0xde80, 0xdebe}, {0xdec0, 0xdefe},
{0xdf00, 0xdf3e}, {0xdf40, 0xdf7e}, {0xdf80, 0xdfbe}, {0xdfc0, 0xdffe},
{0xf900, 0xfa6d}, {0xfa70, 0xfad9}, {0xfb00, 0xfb06}, {0xfb13, 0xfb17},
{0xfb1d, 0xfb36}, {0xfb38, 0xfb3c}, {0xfb46, 0xfbc1}, {0xfbd3, 0xfd3f},
{0xfd50, 0xfd8f}, {0xfd92, 0xfdc7}, {0xfdf0, 0xfdfd}, {0xfe00, 0xfe19},
{0xfe20, 0xfe2d}, {0xfe30, 0xfe52}, {0xfe54, 0xfe66}, {0xfe68, 0xfe6b},
{0xfe70, 0xfe74}, {0xfe76, 0xfefc}, {0xff01, 0xffbe}, {0xffc2, 0xffc7},
{0xffca, 0xffcf}, {0xffd2, 0xffd7}, {0xffda, 0xffdc}, {0xffe0, 0xffe6},
{0xffe8, 0xffee}
{0xfe20, 0xfe52}, {0xfe54, 0xfe66}, {0xfe68, 0xfe6b}, {0xfe70, 0xfe74},
{0xfe76, 0xfefc}, {0xff01, 0xffbe}, {0xffc2, 0xffc7}, {0xffca, 0xffcf},
{0xffd2, 0xffd7}, {0xffda, 0xffdc}, {0xffe0, 0xffe6}, {0xffe8, 0xffee}
#if TCL_UTF_MAX > 4
,{0x10000, 0x1000b}, {0x1000d, 0x10026}, {0x10028, 0x1003a}, {0x1003f, 0x1004d},
{0x10050, 0x1005d}, {0x10080, 0x100fa}, {0x10100, 0x10102}, {0x10107, 0x10133},
@@ -683,45 +693,48 @@ static const crange graphRangeTable[] = {
{0x10400, 0x1049d}, {0x104a0, 0x104a9}, {0x10500, 0x10527}, {0x10530, 0x10563},
{0x10600, 0x10736}, {0x10740, 0x10755}, {0x10760, 0x10767}, {0x10800, 0x10805},
{0x1080a, 0x10835}, {0x1083f, 0x10855}, {0x10857, 0x1089e}, {0x108a7, 0x108af},
{0x10900, 0x1091b}, {0x1091f, 0x10939}, {0x10980, 0x109b7}, {0x10a00, 0x10a03},
{0x10a0c, 0x10a13}, {0x10a15, 0x10a17}, {0x10a19, 0x10a33}, {0x10a38, 0x10a3a},
{0x10a3f, 0x10a47}, {0x10a50, 0x10a58}, {0x10a60, 0x10a9f}, {0x10ac0, 0x10ae6},
{0x10aeb, 0x10af6}, {0x10b00, 0x10b35}, {0x10b39, 0x10b55}, {0x10b58, 0x10b72},
{0x10b78, 0x10b91}, {0x10b99, 0x10b9c}, {0x10ba9, 0x10baf}, {0x10c00, 0x10c48},
{0x10e60, 0x10e7e}, {0x11000, 0x1104d}, {0x11052, 0x1106f}, {0x1107f, 0x110bc},
{0x110be, 0x110c1}, {0x110d0, 0x110e8}, {0x110f0, 0x110f9}, {0x11100, 0x11134},
{0x11136, 0x11143}, {0x11150, 0x11176}, {0x11180, 0x111c8}, {0x111d0, 0x111da},
{0x111e1, 0x111f4}, {0x11200, 0x11211}, {0x11213, 0x1123d}, {0x112b0, 0x112ea},
{0x112f0, 0x112f9}, {0x11301, 0x11303}, {0x11305, 0x1130c}, {0x11313, 0x11328},
{0x1132a, 0x11330}, {0x11335, 0x11339}, {0x1133c, 0x11344}, {0x1134b, 0x1134d},
{0x1135d, 0x11363}, {0x11366, 0x1136c}, {0x11370, 0x11374}, {0x11480, 0x114c7},
{0x114d0, 0x114d9}, {0x11580, 0x115b5}, {0x115b8, 0x115c9}, {0x11600, 0x11644},
{0x11650, 0x11659}, {0x11680, 0x116b7}, {0x116c0, 0x116c9}, {0x118a0, 0x118f2},
{0x11ac0, 0x11af8}, {0x12000, 0x12398}, {0x12400, 0x1246e}, {0x12470, 0x12474},
{0x13000, 0x1342e}, {0x16800, 0x16a38}, {0x16a40, 0x16a5e}, {0x16a60, 0x16a69},
{0x16ad0, 0x16aed}, {0x16af0, 0x16af5}, {0x16b00, 0x16b45}, {0x16b50, 0x16b59},
{0x16b5b, 0x16b61}, {0x16b63, 0x16b77}, {0x16b7d, 0x16b8f}, {0x16f00, 0x16f44},
{0x16f50, 0x16f7e}, {0x16f8f, 0x16f9f}, {0x1bc00, 0x1bc6a}, {0x1bc70, 0x1bc7c},
{0x1bc80, 0x1bc88}, {0x1bc90, 0x1bc99}, {0x1bc9c, 0x1bc9f}, {0x1d000, 0x1d0f5},
{0x1d100, 0x1d126}, {0x1d129, 0x1d172}, {0x1d17b, 0x1d1dd}, {0x1d200, 0x1d245},
{0x1d300, 0x1d356}, {0x1d360, 0x1d371}, {0x1d400, 0x1d454}, {0x1d456, 0x1d49c},
{0x1d4a9, 0x1d4ac}, {0x1d4ae, 0x1d4b9}, {0x1d4bd, 0x1d4c3}, {0x1d4c5, 0x1d505},
{0x1d507, 0x1d50a}, {0x1d50d, 0x1d514}, {0x1d516, 0x1d51c}, {0x1d51e, 0x1d539},
{0x1d53b, 0x1d53e}, {0x1d540, 0x1d544}, {0x1d54a, 0x1d550}, {0x1d552, 0x1d6a5},
{0x1d6a8, 0x1d7cb}, {0x1d7ce, 0x1d7ff}, {0x1e800, 0x1e8c4}, {0x1e8c7, 0x1e8d6},
{0x108e0, 0x108f2}, {0x108fb, 0x1091b}, {0x1091f, 0x10939}, {0x10980, 0x109b7},
{0x109bc, 0x109cf}, {0x109d2, 0x10a03}, {0x10a0c, 0x10a13}, {0x10a15, 0x10a17},
{0x10a19, 0x10a33}, {0x10a38, 0x10a3a}, {0x10a3f, 0x10a47}, {0x10a50, 0x10a58},
{0x10a60, 0x10a9f}, {0x10ac0, 0x10ae6}, {0x10aeb, 0x10af6}, {0x10b00, 0x10b35},
{0x10b39, 0x10b55}, {0x10b58, 0x10b72}, {0x10b78, 0x10b91}, {0x10b99, 0x10b9c},
{0x10ba9, 0x10baf}, {0x10c00, 0x10c48}, {0x10c80, 0x10cb2}, {0x10cc0, 0x10cf2},
{0x10cfa, 0x10cff}, {0x10e60, 0x10e7e}, {0x11000, 0x1104d}, {0x11052, 0x1106f},
{0x1107f, 0x110bc}, {0x110be, 0x110c1}, {0x110d0, 0x110e8}, {0x110f0, 0x110f9},
{0x11100, 0x11134}, {0x11136, 0x11143}, {0x11150, 0x11176}, {0x11180, 0x111cd},
{0x111d0, 0x111df}, {0x111e1, 0x111f4}, {0x11200, 0x11211}, {0x11213, 0x1123d},
{0x11280, 0x11286}, {0x1128a, 0x1128d}, {0x1128f, 0x1129d}, {0x1129f, 0x112a9},
{0x112b0, 0x112ea}, {0x112f0, 0x112f9}, {0x11300, 0x11303}, {0x11305, 0x1130c},
{0x11313, 0x11328}, {0x1132a, 0x11330}, {0x11335, 0x11339}, {0x1133c, 0x11344},
{0x1134b, 0x1134d}, {0x1135d, 0x11363}, {0x11366, 0x1136c}, {0x11370, 0x11374},
{0x11480, 0x114c7}, {0x114d0, 0x114d9}, {0x11580, 0x115b5}, {0x115b8, 0x115dd},
{0x11600, 0x11644}, {0x11650, 0x11659}, {0x11680, 0x116b7}, {0x116c0, 0x116c9},
{0x11700, 0x11719}, {0x1171d, 0x1172b}, {0x11730, 0x1173f}, {0x118a0, 0x118f2},
{0x11ac0, 0x11af8}, {0x12000, 0x12399}, {0x12400, 0x1246e}, {0x12470, 0x12474},
{0x12480, 0x12543}, {0x13000, 0x1342e}, {0x14400, 0x14646}, {0x16800, 0x16a38},
{0x16a40, 0x16a5e}, {0x16a60, 0x16a69}, {0x16ad0, 0x16aed}, {0x16af0, 0x16af5},
{0x16b00, 0x16b45}, {0x16b50, 0x16b59}, {0x16b5b, 0x16b61}, {0x16b63, 0x16b77},
{0x16b7d, 0x16b8f}, {0x16f00, 0x16f44}, {0x16f50, 0x16f7e}, {0x16f8f, 0x16f9f},
{0x1bc00, 0x1bc6a}, {0x1bc70, 0x1bc7c}, {0x1bc80, 0x1bc88}, {0x1bc90, 0x1bc99},
{0x1bc9c, 0x1bc9f}, {0x1d000, 0x1d0f5}, {0x1d100, 0x1d126}, {0x1d129, 0x1d172},
{0x1d17b, 0x1d1e8}, {0x1d200, 0x1d245}, {0x1d300, 0x1d356}, {0x1d360, 0x1d371},
{0x1d400, 0x1d454}, {0x1d456, 0x1d49c}, {0x1d4a9, 0x1d4ac}, {0x1d4ae, 0x1d4b9},
{0x1d4bd, 0x1d4c3}, {0x1d4c5, 0x1d505}, {0x1d507, 0x1d50a}, {0x1d50d, 0x1d514},
{0x1d516, 0x1d51c}, {0x1d51e, 0x1d539}, {0x1d53b, 0x1d53e}, {0x1d540, 0x1d544},
{0x1d54a, 0x1d550}, {0x1d552, 0x1d6a5}, {0x1d6a8, 0x1d7cb}, {0x1d7ce, 0x1da8b},
{0x1da9b, 0x1da9f}, {0x1daa1, 0x1daaf}, {0x1e800, 0x1e8c4}, {0x1e8c7, 0x1e8d6},
{0x1ee00, 0x1ee03}, {0x1ee05, 0x1ee1f}, {0x1ee29, 0x1ee32}, {0x1ee34, 0x1ee37},
{0x1ee4d, 0x1ee4f}, {0x1ee67, 0x1ee6a}, {0x1ee6c, 0x1ee72}, {0x1ee74, 0x1ee77},
{0x1ee79, 0x1ee7c}, {0x1ee80, 0x1ee89}, {0x1ee8b, 0x1ee9b}, {0x1eea1, 0x1eea3},
{0x1eea5, 0x1eea9}, {0x1eeab, 0x1eebb}, {0x1f000, 0x1f02b}, {0x1f030, 0x1f093},
{0x1f0a0, 0x1f0ae}, {0x1f0b1, 0x1f0bf}, {0x1f0c1, 0x1f0cf}, {0x1f0d1, 0x1f0f5},
{0x1f100, 0x1f10c}, {0x1f110, 0x1f12e}, {0x1f130, 0x1f16b}, {0x1f170, 0x1f19a},
{0x1f1e6, 0x1f202}, {0x1f210, 0x1f23a}, {0x1f240, 0x1f248}, {0x1f300, 0x1f32c},
{0x1f330, 0x1f37d}, {0x1f380, 0x1f3ce}, {0x1f3d4, 0x1f3f7}, {0x1f400, 0x1f4fe},
{0x1f500, 0x1f54a}, {0x1f550, 0x1f579}, {0x1f57b, 0x1f5a3}, {0x1f5a5, 0x1f642},
{0x1f645, 0x1f6cf}, {0x1f6e0, 0x1f6ec}, {0x1f6f0, 0x1f6f3}, {0x1f700, 0x1f773},
{0x1f780, 0x1f7d4}, {0x1f800, 0x1f80b}, {0x1f810, 0x1f847}, {0x1f850, 0x1f859},
{0x1f860, 0x1f887}, {0x1f890, 0x1f8ad}, {0x20000, 0x2a6d6}, {0x2a700, 0x2b734},
{0x2b740, 0x2b81d}, {0x2f800, 0x2fa1d}, {0xe0100, 0xe01ef}
{0x1f1e6, 0x1f202}, {0x1f210, 0x1f23a}, {0x1f240, 0x1f248}, {0x1f300, 0x1f579},
{0x1f57b, 0x1f5a3}, {0x1f5a5, 0x1f6d0}, {0x1f6e0, 0x1f6ec}, {0x1f6f0, 0x1f6f3},
{0x1f700, 0x1f773}, {0x1f780, 0x1f7d4}, {0x1f800, 0x1f80b}, {0x1f810, 0x1f847},
{0x1f850, 0x1f859}, {0x1f860, 0x1f887}, {0x1f890, 0x1f8ad}, {0x1f910, 0x1f918},
{0x1f980, 0x1f984}, {0x20000, 0x2a6d6}, {0x2a700, 0x2b734}, {0x2b740, 0x2b81d},
{0x2b820, 0x2cea1}, {0x2f800, 0x2fa1d}, {0xe0100, 0xe01ef}
#endif
};
@@ -731,23 +744,23 @@ static const chr graphCharTable[] = {
0x38c, 0x589, 0x58a, 0x85e, 0x98f, 0x990, 0x9b2, 0x9c7, 0x9c8,
0x9d7, 0x9dc, 0x9dd, 0xa0f, 0xa10, 0xa32, 0xa33, 0xa35, 0xa36,
0xa38, 0xa39, 0xa3c, 0xa47, 0xa48, 0xa51, 0xa5e, 0xab2, 0xab3,
0xad0, 0xb0f, 0xb10, 0xb32, 0xb33, 0xb47, 0xb48, 0xb56, 0xb57,
0xb5c, 0xb5d, 0xb82, 0xb83, 0xb99, 0xb9a, 0xb9c, 0xb9e, 0xb9f,
0xba3, 0xba4, 0xbd0, 0xbd7, 0xc55, 0xc56, 0xc58, 0xc59, 0xcd5,
0xcd6, 0xcde, 0xcf1, 0xcf2, 0xd57, 0xd82, 0xd83, 0xdbd, 0xdca,
0xdd6, 0xe81, 0xe82, 0xe84, 0xe87, 0xe88, 0xe8a, 0xe8d, 0xea5,
0xea7, 0xeaa, 0xeab, 0xec6, 0x10c7, 0x10cd, 0x1258, 0x12c0, 0x1772,
0x1773, 0x1940, 0x1cf8, 0x1cf9, 0x1f59, 0x1f5b, 0x1f5d, 0x2070, 0x2071,
0x2d27, 0x2d2d, 0x2d6f, 0x2d70, 0xa7b0, 0xa7b1, 0xab64, 0xab65, 0xfb3e,
0xfb40, 0xfb41, 0xfb43, 0xfb44, 0xfffc, 0xfffd
0xad0, 0xaf9, 0xb0f, 0xb10, 0xb32, 0xb33, 0xb47, 0xb48, 0xb56,
0xb57, 0xb5c, 0xb5d, 0xb82, 0xb83, 0xb99, 0xb9a, 0xb9c, 0xb9e,
0xb9f, 0xba3, 0xba4, 0xbd0, 0xbd7, 0xc55, 0xc56, 0xcd5, 0xcd6,
0xcde, 0xcf1, 0xcf2, 0xd57, 0xd82, 0xd83, 0xdbd, 0xdca, 0xdd6,
0xe81, 0xe82, 0xe84, 0xe87, 0xe88, 0xe8a, 0xe8d, 0xea5, 0xea7,
0xeaa, 0xeab, 0xec6, 0x10c7, 0x10cd, 0x1258, 0x12c0, 0x1772, 0x1773,
0x1940, 0x1cf8, 0x1cf9, 0x1f59, 0x1f5b, 0x1f5d, 0x2070, 0x2071, 0x2d27,
0x2d2d, 0x2d6f, 0x2d70, 0xfb3e, 0xfb40, 0xfb41, 0xfb43, 0xfb44, 0xfffc,
0xfffd
#if TCL_UTF_MAX > 4
,0x1003c, 0x1003d, 0x101a0, 0x1056f, 0x10808, 0x10837, 0x10838, 0x1083c, 0x1093f,
0x109be, 0x109bf, 0x10a05, 0x10a06, 0x111cd, 0x1130f, 0x11310, 0x11332, 0x11333,
0x11347, 0x11348, 0x11357, 0x118ff, 0x16a6e, 0x16a6f, 0x1b000, 0x1b001, 0x1d49e,
0x1d49f, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4bb, 0x1d546, 0x1ee21, 0x1ee22, 0x1ee24,
0x1ee27, 0x1ee39, 0x1ee3b, 0x1ee42, 0x1ee47, 0x1ee49, 0x1ee4b, 0x1ee51, 0x1ee52,
0x1ee54, 0x1ee57, 0x1ee59, 0x1ee5b, 0x1ee5d, 0x1ee5f, 0x1ee61, 0x1ee62, 0x1ee64,
0x1ee7e, 0x1eef0, 0x1eef1, 0x1f250, 0x1f251
,0x1003c, 0x1003d, 0x101a0, 0x1056f, 0x10808, 0x10837, 0x10838, 0x1083c, 0x108f4,
0x108f5, 0x1093f, 0x10a05, 0x10a06, 0x11288, 0x1130f, 0x11310, 0x11332, 0x11333,
0x11347, 0x11348, 0x11350, 0x11357, 0x118ff, 0x16a6e, 0x16a6f, 0x1b000, 0x1b001,
0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4bb, 0x1d546, 0x1ee21, 0x1ee22,
0x1ee24, 0x1ee27, 0x1ee39, 0x1ee3b, 0x1ee42, 0x1ee47, 0x1ee49, 0x1ee4b, 0x1ee51,
0x1ee52, 0x1ee54, 0x1ee57, 0x1ee59, 0x1ee5b, 0x1ee5d, 0x1ee5f, 0x1ee61, 0x1ee62,
0x1ee64, 0x1ee7e, 0x1eef0, 0x1eef1, 0x1f250, 0x1f251, 0x1f9c0
#endif
};
+1565 -396
View File
File diff suppressed because it is too large Load Diff
+148 -98
View File
@@ -83,9 +83,6 @@ static int lexdigits(struct vars *, int, int, int);
static int brenext(struct vars *, pchr);
static void skip(struct vars *);
static chr newline(NOPARMS);
#ifdef REG_DEBUG
static const chr *ch(NOPARMS);
#endif
static chr chrnamed(struct vars *, const chr *, const chr *, pchr);
/* === regc_color.c === */
static void initcm(struct vars *, struct colormap *);
@@ -119,17 +116,22 @@ static void dropstate(struct nfa *, struct state *);
static void freestate(struct nfa *, struct state *);
static void destroystate(struct nfa *, struct state *);
static void newarc(struct nfa *, int, pcolor, struct state *, struct state *);
static void createarc(struct nfa *, int, pcolor, struct state *, struct state *);
static struct arc *allocarc(struct nfa *, struct state *);
static void freearc(struct nfa *, struct arc *);
static void changearctarget(struct arc *, struct state *);
static int hasnonemptyout(struct state *);
static int nonemptyouts(struct state *);
static int nonemptyins(struct state *);
static struct arc *findarc(struct state *, int, pcolor);
static void cparc(struct nfa *, struct arc *, struct state *, struct state *);
static void sortins(struct nfa *, struct state *);
static int sortins_cmp(const void *, const void *);
static void sortouts(struct nfa *, struct state *);
static int sortouts_cmp(const void *, const void *);
static void moveins(struct nfa *, struct state *, struct state *);
static void copyins(struct nfa *, struct state *, struct state *, int);
static void copyins(struct nfa *, struct state *, struct state *);
static void mergeins(struct nfa *, struct state *, struct arc **, int);
static void moveouts(struct nfa *, struct state *, struct state *);
static void copyouts(struct nfa *, struct state *, struct state *, int);
static void copyouts(struct nfa *, struct state *, struct state *);
static void cloneouts(struct nfa *, struct state *, struct state *, struct state *, int);
static void delsub(struct nfa *, struct state *, struct state *);
static void deltraverse(struct nfa *, struct state *, struct state *);
@@ -139,33 +141,40 @@ static void cleartraverse(struct nfa *, struct state *);
static void specialcolors(struct nfa *);
static long optimize(struct nfa *, FILE *);
static void pullback(struct nfa *, FILE *);
static int pull(struct nfa *, struct arc *);
static int pull(struct nfa *, struct arc *, struct state **);
static void pushfwd(struct nfa *, FILE *);
static int push(struct nfa *, struct arc *);
static int push(struct nfa *, struct arc *, struct state **);
#define INCOMPATIBLE 1 /* destroys arc */
#define SATISFIED 2 /* constraint satisfied */
#define COMPATIBLE 3 /* compatible but not satisfied yet */
static int combine(struct arc *, struct arc *);
static void fixempties(struct nfa *, FILE *);
static struct state *emptyreachable(struct state *, struct state *);
static void replaceempty(struct nfa *, struct state *, struct state *);
static struct state *emptyreachable(struct nfa *, struct state *,
struct state *, struct arc **);
static int isconstraintarc(struct arc *);
static int hasconstraintout(struct state *);
static void fixconstraintloops(struct nfa *, FILE *);
static int findconstraintloop(struct nfa *, struct state *);
static void breakconstraintloop(struct nfa *, struct state *);
static void clonesuccessorstates(struct nfa *, struct state *, struct state *,
struct state *, struct arc *, char *, char *, int);
static void cleanup(struct nfa *);
static void markreachable(struct nfa *, struct state *, struct state *, struct state *);
static void markcanreach(struct nfa *, struct state *, struct state *, struct state *);
static long analyze(struct nfa *);
static void compact(struct nfa *, struct cnfa *);
static void carcsort(struct carc *, struct carc *);
static void carcsort(struct carc *, size_t);
static int carc_cmp(const void *, const void *);
static void freecnfa(struct cnfa *);
static void dumpnfa(struct nfa *, FILE *);
#ifdef REG_DEBUG
static void dumpstate(struct state *, FILE *);
static void dumparcs(struct state *, FILE *);
static int dumprarcs(struct arc *, struct state *, FILE *, int);
static void dumparc(struct arc *, struct state *, FILE *);
#endif
static void dumpcnfa(struct cnfa *, FILE *);
#ifdef REG_DEBUG
static void dumpcstate(int, struct carc *, struct cnfa *, FILE *);
static void dumpcstate(int, struct cnfa *, FILE *);
#endif
/* === regc_cvec.c === */
static struct cvec *clearcvec(struct cvec *);
@@ -210,11 +219,12 @@ struct vars {
struct subre *tree; /* subexpression tree */
struct subre *treechain; /* all tree nodes allocated */
struct subre *treefree; /* any free tree nodes */
int ntree; /* number of tree nodes */
int ntree; /* number of tree nodes, plus one */
struct cvec *cv; /* interface cvec */
struct cvec *cv2; /* utility cvec */
struct subre *lacons; /* lookahead-constraint vector */
int nlacons; /* size of lacons */
size_t spaceused; /* approx. space used for compilation */
};
/* parsing macros; most know that `v' is the struct vars pointer */
@@ -223,13 +233,13 @@ struct vars {
#define EAT(t) (SEE(t) && next(v)) /* if next is this, swallow it */
#define VISERR(vv) ((vv)->err != 0)/* have we seen an error yet? */
#define ISERR() VISERR(v)
#define VERR(vv,e) \
((vv)->nexttype = EOS, ((vv)->err) ? (vv)->err : ((vv)->err = (e)))
#define VERR(vv,e) ((vv)->nexttype = EOS, \
(vv)->err = ((vv)->err ? (vv)->err : (e)))
#define ERR(e) VERR(v, e) /* record an error */
#define NOERR() {if (ISERR()) return;} /* if error seen, return */
#define NOERRN() {if (ISERR()) return NULL;} /* NOERR with retval */
#define NOERRZ() {if (ISERR()) return 0;} /* NOERR with retval */
#define INSIST(c, e) ((c) ? 0 : ERR(e)) /* if condition false, error */
#define INSIST(c, e) do { if (!(c)) ERR(e); } while (0) /* error if c false */
#define NOTE(b) (v->re->re_info |= (b)) /* note visible condition */
#define EMPTYARC(x, y) newarc(v->nfa, EMPTY, 0, x, y)
@@ -258,12 +268,14 @@ struct vars {
((a)->type == PLAIN || (a)->type == AHEAD || (a)->type == BEHIND)
/* static function list */
static struct fns functions = {
static const struct fns functions = {
rfree, /* regfree insides */
};
/*
- compile - compile regular expression
* Note: on failure, no resources remain allocated, so regfree()
* need not be applied to re.
^ int compile(regex_t *, const chr *, size_t, int);
*/
int
@@ -324,6 +336,7 @@ compile(
v->cv2 = NULL;
v->lacons = NULL;
v->nlacons = 0;
v->spaceused = 0;
re->re_magic = REMAGIC;
re->re_info = 0; /* bits get set during parse */
re->re_csize = sizeof(chr);
@@ -593,13 +606,15 @@ makesearch(
break;
}
}
if (b != NULL && s->tmp == NULL) {
/*
* Must be split if not already in the list (fixes bugs 505048,
* 230589, 840258, 504785).
*/
s->tmp = slist;
/*
* We want to mark states as being in the list already by having non
* NULL tmp fields, but we can't just store the old slist value in tmp
* because that doesn't work for the first such state. Instead, the
* first list entry gets its own address in tmp.
*/
if (b != NULL && s->tmp == NULL) {
s->tmp = (slist != NULL) ? slist : s;
slist = s;
}
}
@@ -610,8 +625,9 @@ makesearch(
for (s=slist ; s!=NULL ; s=s2) {
s2 = newstate(nfa);
copyouts(nfa, s, s2, 1);
NOERR();
copyouts(nfa, s, s2);
NOERR();
for (a=s->ins ; a!=NULL ; a=b) {
b = a->inchain;
@@ -620,7 +636,7 @@ makesearch(
freearc(nfa, a);
}
}
s2 = s->tmp;
s2 = (s->tmp != s) ? s->tmp : NULL;
s->tmp = NULL; /* clean up while we're at it */
}
}
@@ -982,6 +998,7 @@ parseqatom(
NOERR();
assert(v->nextvalue > 0);
atom = subre(v, 'b', BACKR, lp, rp);
NOERR();
subno = v->nextvalue;
atom->subno = subno;
EMPTYARC(lp, rp); /* temporarily, so there's something */
@@ -996,13 +1013,13 @@ parseqatom(
switch (v->nexttype) {
case '*':
m = 0;
n = INFINITY;
n = DUPINF;
qprefer = (v->nextvalue) ? LONGER : SHORTER;
NEXT();
break;
case '+':
m = 1;
n = INFINITY;
n = DUPINF;
qprefer = (v->nextvalue) ? LONGER : SHORTER;
NEXT();
break;
@@ -1019,7 +1036,7 @@ parseqatom(
if (SEE(DIGIT)) {
n = scannum(v);
} else {
n = INFINITY;
n = DUPINF;
}
if (m > n) {
ERR(REG_BADBR);
@@ -1102,11 +1119,17 @@ parseqatom(
/*
* Prepare a general-purpose state skeleton.
*
* ---> [s] ---prefix---> [begin] ---atom---> [end] ----rest---> [rp]
* / /
* [lp] ----> [s2] ----bypass---------------------
* In the no-backrefs case, we want this:
*
* where bypass is an empty, and prefix is some repetitions of atom
* [lp] ---> [s] ---prefix---> [begin] ---atom---> [end] ---rest---> [rp]
*
* where prefix is some repetitions of atom. In the general case we need
*
* [lp] ---> [s] ---iterator---> [s2] ---rest---> [rp]
*
* where the iterator wraps around [begin] ---atom---> [end]
*
* We make the s state here for both cases; s2 is made below if needed
*/
s = newstate(v->nfa); /* first, new endpoints for the atom */
@@ -1117,11 +1140,9 @@ parseqatom(
NOERR();
atom->begin = s;
atom->end = s2;
s = newstate(v->nfa); /* and spots for prefix and bypass */
s2 = newstate(v->nfa);
s = newstate(v->nfa); /* set up starting state */
NOERR();
EMPTYARC(lp, s);
EMPTYARC(lp, s2);
NOERR();
/*
@@ -1129,6 +1150,7 @@ parseqatom(
*/
t = subre(v, '.', COMBINE(qprefer, atom->flags), lp, rp);
NOERR();
t->left = atom;
atomp = &t->left;
@@ -1142,6 +1164,7 @@ parseqatom(
assert(top->op == '=' && top->left == NULL && top->right == NULL);
top->left = subre(v, '=', top->flags, top->begin, lp);
NOERR();
top->op = '.';
top->right = t;
@@ -1166,27 +1189,8 @@ parseqatom(
}
/*
* It's quantifier time; first, turn x{0,...} into x{1,...}|empty
*/
if (m == 0) {
EMPTYARC(s2, atom->end);/* the bypass */
assert(PREF(qprefer) != 0);
f = COMBINE(qprefer, atom->flags);
t = subre(v, '|', f, lp, atom->end);
NOERR();
t->left = atom;
t->right = subre(v, '|', PREF(f), s2, atom->end);
NOERR();
t->right->left = subre(v, '=', 0, s2, atom->end);
NOERR();
*atomp = t;
atomp = &t->left;
m = 1;
}
/*
* Deal with the rest of the quantifier.
* It's quantifier time. If the atom is just a backref, we'll let it deal
* with quantifiers internally.
*/
if (atomtype == BACKREF) {
@@ -1204,21 +1208,29 @@ parseqatom(
atom->min = (short) m;
atom->max = (short) n;
atom->flags |= COMBINE(qprefer, atom->flags);
/* rest of branch can be strung starting from atom->end */
s2 = atom->end;
} else if (m == 1 && n == 1) {
/*
* No/vacuous quantifier: done.
*/
EMPTYARC(s, atom->begin); /* empty prefix */
} else {
/* rest of branch can be strung starting from atom->end */
s2 = atom->end;
} else if (m > 0 && !(atom->flags & BACKR)) {
/*
* Turn x{m,n} into x{m-1,n-1}x, with capturing parens in only second
* x
* If there's no backrefs involved, we can turn x{m,n} into
* x{m-1,n-1}x, with capturing parens in only the second x. This
* is valid because we only care about capturing matches from the
* final iteration of the quantifier. It's a win because we can
* implement the backref-free left side as a plain DFA node, since
* we don't really care where its submatches are.
*/
dupnfa(v->nfa, atom->begin, atom->end, s, atom->begin);
assert(m >= 1 && m != INFINITY && n >= 1);
repeat(v, s, atom->begin, m-1, (n == INFINITY) ? n : n-1);
assert(m >= 1 && m != DUPINF && n >= 1);
repeat(v, s, atom->begin, m-1, (n == DUPINF) ? n : n-1);
f = COMBINE(qprefer, atom->flags);
t = subre(v, '.', f, s, atom->end); /* prefix and atom */
NOERR();
@@ -1226,6 +1238,24 @@ parseqatom(
NOERR();
t->right = atom;
*atomp = t;
/* rest of branch can be strung starting from atom->end */
s2 = atom->end;
} else {
/* general case: need an iteration node */
s2 = newstate(v->nfa);
NOERR();
moveouts(v->nfa, atom->end, s2);
NOERR();
dupnfa(v->nfa, atom->begin, atom->end, s, s2);
repeat(v, s, s2, m, n);
f = COMBINE(qprefer, atom->flags);
t = subre(v, '*', f, s, s2);
NOERR();
t->min = (short) m;
t->max = (short) n;
t->left = atom;
*atomp = t;
/* rest of branch is to be strung from iteration's end state */
}
/*
@@ -1234,10 +1264,10 @@ parseqatom(
t = top->right;
if (!(SEE('|') || SEE(stopper) || SEE(EOS))) {
t->right = parsebranch(v, stopper, type, atom->end, rp, 1);
t->right = parsebranch(v, stopper, type, s2, rp, 1);
} else {
EMPTYARC(atom->end, rp);
t->right = subre(v, '=', 0, atom->end, rp);
EMPTYARC(s2, rp);
t->right = subre(v, '=', 0, s2, rp);
}
NOERR();
assert(SEE('|') || SEE(stopper) || SEE(EOS));
@@ -1304,6 +1334,8 @@ scannum(
/*
- repeat - replicate subNFA for quantifiers
* The sub-NFA strung from lp to rp is modified to represent m to n
* repetitions of its initial contents.
* The duplication sequences used here are chosen carefully so that any
* pointers starting out pointing into the subexpression end up pointing into
* the last occurrence. (Note that it may not be strung between the same left
@@ -1323,7 +1355,7 @@ repeat(
#define SOME 2
#define INF 3
#define PAIR(x, y) ((x)*4 + (y))
#define REDUCE(x) ( ((x) == INFINITY) ? INF : (((x) > 1) ? SOME : (x)) )
#define REDUCE(x) ( ((x) == DUPINF) ? INF : (((x) > 1) ? SOME : (x)) )
const int rm = REDUCE(m);
const int rn = REDUCE(n);
struct state *s, *s2;
@@ -1713,11 +1745,11 @@ subre(
v->treechain = ret;
}
assert(strchr("|.b(=", op) != NULL);
assert(strchr("=b|.*(", op) != NULL);
ret->op = op;
ret->flags = flags;
ret->retry = 0;
ret->id = 0; /* will be assigned later */
ret->subno = 0;
ret->min = ret->max = 1;
ret->left = NULL;
@@ -1770,7 +1802,8 @@ freesrnode(
}
sr->flags = 0;
if (v != NULL) {
if (v != NULL && v->treechain != NULL) {
/* we're still parsing, maybe we can reuse the subre */
sr->left = v->treefree;
v->treefree = sr;
} else {
@@ -1798,7 +1831,7 @@ optst(
}
/*
- numst - number tree nodes (assigning retry indexes)
- numst - number tree nodes (assigning "id" indexes)
^ static int numst(struct subre *, int);
*/
static int /* next number */
@@ -1811,7 +1844,7 @@ numst(
assert(t != NULL);
i = start;
t->retry = (short) i++;
t->id = (short) i++;
if (t->left != NULL) {
i = numst(t->left, i);
}
@@ -1823,6 +1856,19 @@ numst(
/*
- markst - mark tree nodes as INUSE
* Note: this is a great deal more subtle than it looks. During initial
* parsing of a regex, all subres are linked into the treechain list;
* discarded ones are also linked into the treefree list for possible reuse.
* After we are done creating all subres required for a regex, we run markst()
* then cleanst(), which results in discarding all subres not reachable from
* v->tree. We then clear v->treechain, indicating that subres must be found
* by descending from v->tree. This changes the behavior of freesubre(): it
* will henceforth FREE() unwanted subres rather than sticking them into the
* treefree list. (Doing that any earlier would result in dangling links in
* the treechain list.) This all means that freev() will clean up correctly
* if invoked before or after markst()+cleanst(); but it would not work if
* called partway through this state conversion, so we mustn't error out
* in or between these two functions.
^ static void markst(struct subre *);
*/
static void
@@ -1929,24 +1975,26 @@ newlacon(
struct state *end,
int pos)
{
struct subre *sub;
int n;
struct subre *newlacons;
struct subre *sub;
if (v->nlacons == 0) {
v->lacons = (struct subre *) MALLOC(2 * sizeof(struct subre));
n = 1; /* skip 0th */
v->nlacons = 2;
newlacons = (struct subre *) MALLOC(2 * sizeof(struct subre));
} else {
v->lacons = (struct subre *) REALLOC(v->lacons,
(v->nlacons+1)*sizeof(struct subre));
n = v->nlacons++;
n = v->nlacons;
newlacons = (struct subre *) REALLOC(v->lacons,
(n + 1) * sizeof(struct subre));
}
if (v->lacons == NULL) {
if (newlacons == NULL) {
ERR(REG_ESPACE);
return 0;
}
v->lacons = newlacons;
v->nlacons = n + 1;
sub = &v->lacons[n];
sub->begin = begin;
sub->end = end;
@@ -1994,18 +2042,20 @@ rfree(
g = (struct guts *) re->re_guts;
re->re_guts = NULL;
re->re_fns = NULL;
g->magic = 0;
freecm(&g->cmap);
if (g->tree != NULL) {
freesubre(NULL, g->tree);
if (g != NULL) {
g->magic = 0;
freecm(&g->cmap);
if (g->tree != NULL) {
freesubre(NULL, g->tree);
}
if (g->lacons != NULL) {
freelacons(g->lacons, g->nlacons);
}
if (!NULLCNFA(g->search)) {
freecnfa(&g->search);
}
FREE(g);
}
if (g->lacons != NULL) {
freelacons(g->lacons, g->nlacons);
}
if (!NULLCNFA(g->search)) {
freecnfa(&g->search);
}
FREE(g);
}
/*
@@ -2037,11 +2087,11 @@ dump(
fprintf(f, "\n\n\n========= DUMP ==========\n");
fprintf(f, "nsub %d, info 0%lo, csize %d, ntree %d\n",
re->re_nsub, re->re_info, re->re_csize, g->ntree);
(int) re->re_nsub, re->re_info, re->re_csize, g->ntree);
dumpcolors(&g->cmap, f);
if (!NULLCNFA(g->search)) {
printf("\nsearch:\n");
fprintf(f, "\nsearch:\n");
dumpcnfa(&g->search, f);
}
for (i = 1; i < g->nlacons; i++) {
@@ -2108,7 +2158,7 @@ stdump(
}
if (t->min != 1 || t->max != 1) {
fprintf(f, " {%d,", t->min);
if (t->max != INFINITY) {
if (t->max != DUPINF) {
fprintf(f, "%d", t->max);
}
fprintf(f, "}");
@@ -2146,14 +2196,14 @@ stid(
size_t bufsize)
{
/*
* Big enough for hex int or decimal t->retry?
* Big enough for hex int or decimal t->id?
*/
if (bufsize < sizeof(void*)*2 + 3 || bufsize < sizeof(t->retry)*3 + 1) {
if (bufsize < sizeof(void*)*2 + 3 || bufsize < sizeof(t->id)*3 + 1) {
return "unable";
}
if (t->retry != 0) {
sprintf(buf, "%d", t->retry);
if (t->id != 0) {
sprintf(buf, "%d", t->id);
} else {
sprintf(buf, "%p", t);
}
-8
View File
@@ -60,12 +60,6 @@
#ifdef __REG_REGOFF_T
#undef __REG_REGOFF_T
#endif
#ifdef __REG_VOID_T
#undef __REG_VOID_T
#endif
#ifdef __REG_CONST
#undef __REG_CONST
#endif
#ifdef __REG_NOFRONT
#undef __REG_NOFRONT
#endif
@@ -75,8 +69,6 @@
/* Interface types */
#define __REG_WIDE_T Tcl_UniChar
#define __REG_REGOFF_T long /* Not really right, but good enough... */
#define __REG_VOID_T void
#define __REG_CONST const
/* Names and declarations */
#define __REG_WIDE_COMPILE TclReComp
#define __REG_WIDE_EXEC TclReExec
+15 -14
View File
@@ -84,7 +84,7 @@ longest(
if (v->eflags&REG_FTRACE) {
while (cp < realstop) {
FDEBUG(("+++ at c%d +++\n", css - d->ssets));
FDEBUG(("+++ at c%d +++\n", (int) (css - d->ssets)));
co = GETCOLOR(cm, *cp);
FDEBUG(("char %c, color %ld\n", (char)*cp, (long)co));
ss = css->outs[co];
@@ -118,7 +118,7 @@ longest(
* Shutdown.
*/
FDEBUG(("+++ shutdown at c%d +++\n", css - d->ssets));
FDEBUG(("+++ shutdown at c%d +++\n", (int) (css - d->ssets)));
if (cp == v->stop && stop == v->stop) {
if (hitstopp != NULL) {
*hitstopp = 1;
@@ -213,7 +213,7 @@ shortest(
if (v->eflags&REG_FTRACE) {
while (cp < realmax) {
FDEBUG(("--- at c%d ---\n", css - d->ssets));
FDEBUG(("--- at c%d ---\n", (int) (css - d->ssets)));
co = GETCOLOR(cm, *cp);
FDEBUG(("char %c, color %ld\n", (char)*cp, (long)co));
ss = css->outs[co];
@@ -516,14 +516,14 @@ miss(
gotState = 0;
for (i = 0; i < d->nstates; i++) {
if (ISBSET(css->states, i)) {
for (ca = cnfa->states[i]+1; ca->co != COLORLESS; ca++) {
for (ca = cnfa->states[i]; ca->co != COLORLESS; ca++) {
if (ca->co == co) {
BSET(d->work, ca->to);
gotState = 1;
if (ca->to == cnfa->post) {
isPost = 1;
}
if (!cnfa->states[ca->to]->co) {
if (!(cnfa->stflags[ca->to] & CNFA_NOPROGRESS)) {
noProgress = 0;
}
FDEBUG(("%d -> %d\n", i, ca->to));
@@ -537,8 +537,8 @@ miss(
doLAConstraints = 0;
for (i = 0; i < d->nstates; i++) {
if (ISBSET(d->work, i)) {
for (ca = cnfa->states[i]+1; ca->co != COLORLESS; ca++) {
if (ca->co <= cnfa->ncolors) {
for (ca = cnfa->states[i]; ca->co != COLORLESS; ca++) {
if (ca->co < cnfa->ncolors) {
continue; /* NOTE CONTINUE */
}
sawLAConstraints = 1;
@@ -553,7 +553,7 @@ miss(
if (ca->to == cnfa->post) {
isPost = 1;
}
if (!cnfa->states[ca->to]->co) {
if (!(cnfa->stflags[ca->to] & CNFA_NOPROGRESS)) {
noProgress = 0;
}
FDEBUG(("%d :> %d\n", i, ca->to));
@@ -572,7 +572,7 @@ miss(
for (p = d->ssets, i = d->nssused; i > 0; p++, i--) {
if (HIT(h, d->work, p, d->wordsper)) {
FDEBUG(("cached c%d\n", p - d->ssets));
FDEBUG(("cached c%d\n", (int) (p - d->ssets)));
break; /* NOTE BREAK OUT */
}
}
@@ -594,7 +594,8 @@ miss(
}
if (!sawLAConstraints) { /* lookahead conds. always cache miss */
FDEBUG(("c%d[%d]->c%d\n", css - d->ssets, co, p - d->ssets));
FDEBUG(("c%d[%d]->c%d\n",
(int) (css - d->ssets), co, (int) (p - d->ssets)));
css->outs[co] = p;
css->inchain[co] = p->ins;
p->ins.ss = css;
@@ -663,7 +664,7 @@ getVacantSS(
ap = ss->ins;
while ((p = ap.ss) != NULL) {
co = ap.co;
FDEBUG(("zapping c%d's %ld outarc\n", p - d->ssets, (long)co));
FDEBUG(("zapping c%d's %ld outarc\n", (int) (p - d->ssets), (long)co));
p->outs[co] = NULL;
ap = p->inchain[co];
p->inchain[co].ss = NULL; /* paranoia */
@@ -680,7 +681,7 @@ getVacantSS(
if (p == NULL) {
continue; /* NOTE CONTINUE */
}
FDEBUG(("del outarc %d from c%d's in chn\n", i, p - d->ssets));
FDEBUG(("del outarc %d from c%d's in chn\n", i, (int) (p - d->ssets)));
if (p->ins.ss == ss && p->ins.co == i) {
p->ins = ss->inchain[i];
} else {
@@ -772,7 +773,7 @@ pickNextSS(
if ((ss->lastseen == NULL || ss->lastseen < ancient)
&& !(ss->flags&LOCKED)) {
d->search = ss + 1;
FDEBUG(("replacing c%d\n", ss - d->ssets));
FDEBUG(("replacing c%d\n", (int) (ss - d->ssets)));
return ss;
}
}
@@ -780,7 +781,7 @@ pickNextSS(
if ((ss->lastseen == NULL || ss->lastseen < ancient)
&& !(ss->flags&LOCKED)) {
d->search = ss + 1;
FDEBUG(("replacing c%d\n", ss - d->ssets));
FDEBUG(("replacing c%d\n", (int) (ss - d->ssets)));
return ss;
}
}
+2 -2
View File
@@ -41,7 +41,7 @@ static const char unk[] = "*** unknown regex error code 0x%x ***";
* Struct to map among codes, code names, and explanations.
*/
static struct rerr {
static const struct rerr {
int code;
const char *name;
const char *explain;
@@ -62,7 +62,7 @@ regerror(
char *errbuf, /* Result buffer (unless errbuf_size==0) */
size_t errbuf_size) /* Available space in errbuf, can be 0 */
{
struct rerr *r;
const struct rerr *r;
const char *msg;
char convbuf[sizeof(unk)+50]; /* 50 = plenty for int */
size_t len;
+1 -1
View File
@@ -16,5 +16,5 @@
{ REG_INVARG, "REG_INVARG", "invalid argument to regex function" },
{ REG_MIXED, "REG_MIXED", "character widths of regex and string differ" },
{ REG_BADOPT, "REG_BADOPT", "invalid embedded option" },
{ REG_ETOOBIG, "REG_ETOOBIG", "nfa has too many states" },
{ REG_ETOOBIG, "REG_ETOOBIG", "regular expression is too complex" },
{ REG_ECOLORS, "REG_ECOLORS", "too many colors" },
+17 -45
View File
@@ -92,12 +92,6 @@ extern "C" {
#ifdef __REG_REGOFF_T
#undef __REG_REGOFF_T
#endif
#ifdef __REG_VOID_T
#undef __REG_VOID_T
#endif
#ifdef __REG_CONST
#undef __REG_CONST
#endif
#ifdef __REG_NOFRONT
#undef __REG_NOFRONT
#endif
@@ -107,8 +101,6 @@ extern "C" {
/* interface types */
#define __REG_WIDE_T Tcl_UniChar
#define __REG_REGOFF_T long /* not really right, but good enough... */
#define __REG_VOID_T void
#define __REG_CONST const
/* names and declarations */
#define __REG_WIDE_COMPILE TclReComp
#define __REG_WIDE_EXEC TclReExec
@@ -133,26 +125,6 @@ typedef __REG_REGOFF_T regoff_t;
typedef long regoff_t;
#endif
/*
* For benefit of old compilers, we offer <sys/types.h> the option of
* overriding the `void' type used to declare nonexistent return types.
*/
#ifdef __REG_VOID_T
typedef __REG_VOID_T re_void;
#else
typedef void re_void;
#endif
/*
* Also for benefit of old compilers, <sys/types.h> can supply a macro which
* expands to a substitute for `const'.
*/
#ifndef __REG_CONST
#define __REG_CONST const
#endif
/*
* other interface types
*/
@@ -197,13 +169,13 @@ typedef struct {
/*
* compilation
^ #ifndef __REG_NOCHAR
^ int re_comp(regex_t *, __REG_CONST char *, size_t, int);
^ int re_comp(regex_t *, const char *, size_t, int);
^ #endif
^ #ifndef __REG_NOFRONT
^ int regcomp(regex_t *, __REG_CONST char *, int);
^ int regcomp(regex_t *, const char *, int);
^ #endif
^ #ifdef __REG_WIDE_T
^ int __REG_WIDE_COMPILE(regex_t *, __REG_CONST __REG_WIDE_T *, size_t, int);
^ int __REG_WIDE_COMPILE(regex_t *, const __REG_WIDE_T *, size_t, int);
^ #endif
*/
#define REG_BASIC 000000 /* BREs (convenience) */
@@ -228,14 +200,14 @@ typedef struct {
/*
* execution
^ #ifndef __REG_NOCHAR
^ int re_exec(regex_t *, __REG_CONST char *, size_t,
^ int re_exec(regex_t *, const char *, size_t,
^ rm_detail_t *, size_t, regmatch_t [], int);
^ #endif
^ #ifndef __REG_NOFRONT
^ int regexec(regex_t *, __REG_CONST char *, size_t, regmatch_t [], int);
^ int regexec(regex_t *, const char *, size_t, regmatch_t [], int);
^ #endif
^ #ifdef __REG_WIDE_T
^ int __REG_WIDE_EXEC(regex_t *, __REG_CONST __REG_WIDE_T *, size_t,
^ int __REG_WIDE_EXEC(regex_t *, const __REG_WIDE_T *, size_t,
^ rm_detail_t *, size_t, regmatch_t [], int);
^ #endif
*/
@@ -248,7 +220,7 @@ typedef struct {
/*
* misc generics (may be more functions here eventually)
^ re_void regfree(regex_t *);
^ void regfree(regex_t *);
*/
/*
@@ -260,7 +232,7 @@ typedef struct {
* of character is used for error reports is independent of what kind is used
* in matching.
*
^ extern size_t regerror(int, __REG_CONST regex_t *, char *, size_t);
^ extern size_t regerror(int, const regex_t *, char *, size_t);
*/
#define REG_OKAY 0 /* no errors detected */
#define REG_NOMATCH 1 /* failed to match */
@@ -280,7 +252,7 @@ typedef struct {
#define REG_INVARG 16 /* invalid argument to regex function */
#define REG_MIXED 17 /* character widths of regex and string differ */
#define REG_BADOPT 18 /* invalid embedded option */
#define REG_ETOOBIG 19 /* nfa has too many states */
#define REG_ETOOBIG 19 /* regular expression is too complex */
#define REG_ECOLORS 20 /* too many colors */
/* two specials for debugging and testing */
#define REG_ATOI 101 /* convert error-code name to number */
@@ -293,25 +265,25 @@ typedef struct {
/* automatically gathered by fwd; do not hand-edit */
/* === regproto.h === */
#ifndef __REG_NOCHAR
int re_comp(regex_t *, __REG_CONST char *, size_t, int);
int re_comp(regex_t *, const char *, size_t, int);
#endif
#ifndef __REG_NOFRONT
int regcomp(regex_t *, __REG_CONST char *, int);
int regcomp(regex_t *, const char *, int);
#endif
#ifdef __REG_WIDE_T
MODULE_SCOPE int __REG_WIDE_COMPILE(regex_t *, __REG_CONST __REG_WIDE_T *, size_t, int);
MODULE_SCOPE int __REG_WIDE_COMPILE(regex_t *, const __REG_WIDE_T *, size_t, int);
#endif
#ifndef __REG_NOCHAR
int re_exec(regex_t *, __REG_CONST char *, size_t, rm_detail_t *, size_t, regmatch_t [], int);
int re_exec(regex_t *, const char *, size_t, rm_detail_t *, size_t, regmatch_t [], int);
#endif
#ifndef __REG_NOFRONT
int regexec(regex_t *, __REG_CONST char *, size_t, regmatch_t [], int);
int regexec(regex_t *, const char *, size_t, regmatch_t [], int);
#endif
#ifdef __REG_WIDE_T
MODULE_SCOPE int __REG_WIDE_EXEC(regex_t *, __REG_CONST __REG_WIDE_T *, size_t, rm_detail_t *, size_t, regmatch_t [], int);
MODULE_SCOPE int __REG_WIDE_EXEC(regex_t *, const __REG_WIDE_T *, size_t, rm_detail_t *, size_t, regmatch_t [], int);
#endif
MODULE_SCOPE re_void regfree(regex_t *);
MODULE_SCOPE size_t regerror(int, __REG_CONST regex_t *, char *, size_t);
MODULE_SCOPE void regfree(regex_t *);
MODULE_SCOPE size_t regerror(int, const regex_t *, char *, size_t);
/* automatically gathered by fwd; do not hand-edit */
/* =====^!^===== end forwards =====^!^===== */
+588 -471
View File
File diff suppressed because it is too large Load Diff
+61 -20
View File
@@ -99,7 +99,7 @@
#define xxx 1
#define DUPMAX _POSIX2_RE_DUP_MAX
#define INFINITY (DUPMAX+1)
#define DUPINF (DUPMAX+1)
#define REMAGIC 0xfed7 /* magic number for main struct */
@@ -186,7 +186,14 @@ struct colordesc {
union tree *block; /* block of solid color, if any */
};
/* the color map itself */
/*
* The color map itself
*
* Much of the data in the colormap struct is only used at compile time.
* However, the bulk of the space usage is in the "tree" structure, so it's
* not clear that there's much point in converting the rest to a more compact
* form when compilation is finished.
*/
struct colormap {
int magic;
#define CMMAGIC 0x876
@@ -242,14 +249,15 @@ struct cvec {
struct state;
struct arc {
int type;
#define ARCFREE '\0'
int type; /* 0 if free, else an NFA arc type code */
color co;
struct state *from; /* where it's from (and contained within) */
struct state *to; /* where it's to */
struct arc *outchain; /* *from's outs chain or free chain */
#define freechain outchain
struct arc *outchain; /* link in *from's outs chain or free chain */
struct arc *outchainRev; /* back-link in *from's outs chain */
#define freechain outchain /* we do not maintain "freechainRev" */
struct arc *inchain; /* *to's ins chain */
struct arc *inchainRev; /* back-link in *to's ins chain */
struct arc *colorchain; /* color's arc chain */
struct arc *colorchainRev; /* back-link in color's arc chain */
};
@@ -288,20 +296,28 @@ struct nfa {
struct colormap *cm; /* the color map */
color bos[2]; /* colors, if any, assigned to BOS and BOL */
color eos[2]; /* colors, if any, assigned to EOS and EOL */
size_t size; /* Current NFA size; differs from nstates as
* it also counts the number of states created
* by children of this state. */
struct vars *v; /* simplifies compile error reporting */
struct nfa *parent; /* parent NFA, if any */
};
/*
* definitions for compacted NFA
*
* The main space savings in a compacted NFA is from making the arcs as small
* as possible. We store only the transition color and next-state number for
* each arc. The list of out arcs for each state is an array beginning at
* cnfa.states[statenumber], and terminated by a dummy carc struct with
* co == COLORLESS.
*
* The non-dummy carc structs are of two types: plain arcs and LACON arcs.
* Plain arcs just store the transition color number as "co". LACON arcs
* store the lookahead constraint number plus cnfa.ncolors as "co". LACON
* arcs can be distinguished from plain by testing for co >= cnfa.ncolors.
*/
struct carc {
color co; /* COLORLESS is list terminator */
int to; /* state number */
int to; /* next-state number */
};
struct cnfa {
@@ -313,27 +329,52 @@ struct cnfa {
int post; /* teardown state number */
color bos[2]; /* colors, if any, assigned to BOS and BOL */
color eos[2]; /* colors, if any, assigned to EOS and EOL */
char *stflags; /* vector of per-state flags bytes */
#define CNFA_NOPROGRESS 01 /* flag bit for a no-progress state */
struct carc **states; /* vector of pointers to outarc lists */
/* states[n] are pointers into a single malloc'd array of arcs */
struct carc *arcs; /* the area for the lists */
};
#define ZAPCNFA(cnfa) ((cnfa).nstates = 0)
#define NULLCNFA(cnfa) ((cnfa).nstates == 0)
/*
* Used to limit the maximum NFA size to something sane. [Bug 1810264]
* This symbol limits the transient heap space used by the regex compiler,
* and thereby also the maximum complexity of NFAs that we'll deal with.
* Currently we only count NFA states and arcs against this; the other
* transient data is generally not large enough to notice compared to those.
* Note that we do not charge anything for the final output data structures
* (the compacted NFA and the colormap).
*/
#ifndef REG_MAX_STATES
# define REG_MAX_STATES 100000
#ifndef REG_MAX_COMPILE_SPACE
#define REG_MAX_COMPILE_SPACE \
(100000 * sizeof(struct state) + 100000 * sizeof(struct arcbatch))
#endif
/*
* subexpression tree
*
* "op" is one of:
* '=' plain regex without interesting substructure (implemented as DFA)
* 'b' back-reference (has no substructure either)
* '(' capture node: captures the match of its single child
* '.' concatenation: matches a match for left, then a match for right
* '|' alternation: matches a match for left or a match for right
* '*' iteration: matches some number of matches of its single child
*
* Note: the right child of an alternation must be another alternation or
* NULL; hence, an N-way branch requires N alternation nodes, not N-1 as you
* might expect. This could stand to be changed. Actually I'd rather see
* a single alternation node with N children, but that will take revising
* the representation of struct subre.
*
* Note: when a backref is directly quantified, we stick the min/max counts
* into the backref rather than plastering an iteration node on top. This is
* for efficiency: there is no need to search for possible division points.
*/
struct subre {
char op; /* '|', '.' (concat), 'b' (backref), '(',
* '=' */
char op; /* see type codes above */
char flags;
#define LONGER 01 /* prefers longer match */
#define SHORTER 02 /* prefers shorter match */
@@ -349,10 +390,10 @@ struct subre {
#define PREF(f) ((f)&NOPROP)
#define PREF2(f1, f2) ((PREF(f1) != 0) ? PREF(f1) : PREF(f2))
#define COMBINE(f1, f2) (UP((f1)|(f2)) | PREF2(f1, f2))
short retry; /* index into retry memory */
short id; /* ID of subre (1..ntree-1) */
int subno; /* subexpression number (for 'b' and '(') */
short min; /* min repetitions, for backref only */
short max; /* max repetitions, for backref only */
short min; /* min repetitions for iteration or backref */
short max; /* max repetitions for iteration or backref */
struct subre *left; /* left child, if any (also freelist chain) */
struct subre *right; /* right child, if any */
struct state *begin; /* outarcs from here... */
@@ -382,7 +423,7 @@ struct guts {
size_t nsub; /* copy of re_nsub */
struct subre *tree;
struct cnfa search; /* for fast preliminary search */
int ntree;
int ntree; /* number of subre's, plus one */
struct colormap cmap;
int FUNCPTR(compare, (const chr *, const chr *, size_t));
struct subre *lacons; /* lookahead-constraint vector */
+7 -12
View File
@@ -2,8 +2,8 @@
#
# This file contains the declarations for all supported public
# functions that are exported by the Tcl library via the stubs table.
# This file is used to generate the tclDecls.h, tclPlatDecls.h,
# tclStub.c, and tclPlatStub.c files.
# This file is used to generate the tclDecls.h, tclPlatDecls.h
# and tclStubInit.c files.
#
# Copyright (c) 1998-1999 by Scriptics Corporation.
# Copyright (c) 2001, 2002 by Kevin B. Kenny. All rights reserved.
@@ -37,7 +37,7 @@ declare 1 {
void *clientDataPtr)
}
declare 2 {
void Tcl_Panic(const char *format, ...)
TCL_NORETURN void Tcl_Panic(const char *format, ...)
}
declare 3 {
char *Tcl_Alloc(unsigned int size)
@@ -480,7 +480,7 @@ declare 132 {
void Tcl_EventuallyFree(ClientData clientData, Tcl_FreeProc *freeProc)
}
declare 133 {
void Tcl_Exit(int status)
TCL_NORETURN void Tcl_Exit(int status)
}
declare 134 {
int Tcl_ExposeCommand(Tcl_Interp *interp, const char *hiddenCmdToken,
@@ -815,7 +815,7 @@ declare 229 {
void Tcl_SetMaxBlockTime(const Tcl_Time *timePtr)
}
declare 230 {
void Tcl_SetPanicProc(Tcl_PanicProc *panicProc)
void Tcl_SetPanicProc(TCL_NORETURN1 Tcl_PanicProc *panicProc)
}
declare 231 {
int Tcl_SetRecursionLimit(Tcl_Interp *interp, int depth)
@@ -986,7 +986,7 @@ declare 277 {
Tcl_Pid Tcl_WaitPid(Tcl_Pid pid, int *statPtr, int options)
}
declare 278 {
void Tcl_PanicVA(const char *format, va_list argList)
TCL_NORETURN void Tcl_PanicVA(const char *format, va_list argList)
}
declare 279 {
void Tcl_GetVersion(int *major, int *minor, int *patchLevel, int *type)
@@ -1872,7 +1872,7 @@ declare 518 {
# TIP#121 (exit handler) dkf for Joe Mistachkin
declare 519 {
Tcl_ExitProc *Tcl_SetExitProc(Tcl_ExitProc *proc)
Tcl_ExitProc *Tcl_SetExitProc(TCL_NORETURN1 Tcl_ExitProc *proc)
}
# TIP#143 (resource limits) dkf
@@ -2326,11 +2326,6 @@ declare 630 {
# ----- BASELINE -- FOR -- 8.6.0 ----- #
# ZipVfs
declare 631 {
int Tcl_Zvfs_Boot(Tcl_Interp *interp)
}
##############################################################################
# Define the platform specific public Tcl interface. These functions are only
+46 -32
View File
@@ -56,10 +56,10 @@ extern "C" {
#define TCL_MAJOR_VERSION 8
#define TCL_MINOR_VERSION 6
#define TCL_RELEASE_LEVEL TCL_FINAL_RELEASE
#define TCL_RELEASE_SERIAL 2
#define TCL_RELEASE_SERIAL 4
#define TCL_VERSION "8.6"
#define TCL_PATCH_LEVEL "8.6.2"
#define TCL_PATCH_LEVEL "8.6.4"
/*
*----------------------------------------------------------------------------
@@ -76,16 +76,6 @@ extern "C" {
# endif
#endif
/*
* STRICT: See MSDN Article Q83456
*/
#ifdef _WIN32
# ifndef STRICT
# define STRICT
# endif
#endif /* _WIN32 */
/*
* Utility macros: STRINGIFY takes an argument and wraps it in "" (double
* quotation marks), JOIN joins two arguments.
@@ -153,8 +143,20 @@ extern "C" {
#endif
#if defined(__GNUC__) && (__GNUC__ > 2)
# define TCL_FORMAT_PRINTF(a,b) __attribute__ ((__format__ (__printf__, a, b)))
# define TCL_NORETURN __attribute__ ((noreturn))
# if defined(BUILD_tcl) || defined(BUILD_tk)
# define TCL_NORETURN1 __attribute__ ((noreturn))
# else
# define TCL_NORETURN1 /* nothing */
# endif
#else
# define TCL_FORMAT_PRINTF(a,b)
# if defined(_MSC_VER) && (_MSC_VER >= 1310)
# define TCL_NORETURN _declspec(noreturn)
# else
# define TCL_NORETURN /* nothing */
# endif
# define TCL_NORETURN1 /* nothing */
#endif
/*
@@ -402,16 +404,12 @@ typedef long LONG;
* Don't know what platform it is and configure hasn't discovered what is
* going on for us. Try to guess...
*/
# ifdef NO_LIMITS_H
# error please define either TCL_WIDE_INT_TYPE or TCL_WIDE_INT_IS_LONG
# else /* !NO_LIMITS_H */
# include <limits.h>
# if (INT_MAX < LONG_MAX)
# define TCL_WIDE_INT_IS_LONG 1
# else
# define TCL_WIDE_INT_TYPE long long
# endif
# endif /* NO_LIMITS_H */
# include <limits.h>
# if (INT_MAX < LONG_MAX)
# define TCL_WIDE_INT_IS_LONG 1
# else
# define TCL_WIDE_INT_TYPE long long
# endif
# endif /* _WIN32 */
#endif /* !TCL_WIDE_INT_TYPE & !TCL_WIDE_INT_IS_LONG */
#ifdef TCL_WIDE_INT_IS_LONG
@@ -830,18 +828,19 @@ typedef struct Tcl_Obj {
union { /* The internal representation: */
long longValue; /* - an long integer value. */
double doubleValue; /* - a double-precision floating value. */
void *otherValuePtr; /* - another, type-specific value. */
void *otherValuePtr; /* - another, type-specific value,
not used internally any more. */
Tcl_WideInt wideValue; /* - a long long value. */
struct { /* - internal rep as two pointers. */
struct { /* - internal rep as two pointers.
* the main use of which is a bignum's
* tightly packed fields, where the alloc,
* used and signum flags are packed into
* ptr2 with everything else hung off ptr1. */
void *ptr1;
void *ptr2;
} twoPtrValue;
struct { /* - internal rep as a pointer and a long,
* the main use of which is a bignum's
* tightly packed fields, where the alloc,
* used and signum flags are packed into a
* single word with everything else hung
* off the pointer. */
not used internally any more. */
void *ptr;
unsigned long value;
} ptrAndLongRep;
@@ -2144,11 +2143,28 @@ typedef struct Tcl_EncodingType {
* substituting one or more "close" characters in
* the destination buffer and then continue to
* convert the source.
* TCL_ENCODING_NO_TERMINATE - If set, Tcl_ExternalToUtf will not append a
* terminating NUL byte. Knowing that it will
* not need space to do so, it will fill all
* dstLen bytes with encoded UTF-8 content, as
* other circumstances permit. If clear, the
* default behavior is to reserve a byte in
* the dst space for NUL termination, and to
* append the NUL byte.
* TCL_ENCODING_CHAR_LIMIT - If set and dstCharsPtr is not NULL, then
* Tcl_ExternalToUtf takes the initial value
* of *dstCharsPtr is taken as a limit of the
* maximum number of chars to produce in the
* encoded UTF-8 content. Otherwise, the
* number of chars produced is controlled only
* by other limiting factors.
*/
#define TCL_ENCODING_START 0x01
#define TCL_ENCODING_END 0x02
#define TCL_ENCODING_STOPONERROR 0x04
#define TCL_ENCODING_NO_TERMINATE 0x08
#define TCL_ENCODING_CHAR_LIMIT 0x10
/*
* The following definitions are the error codes returned by the conversion
@@ -2419,9 +2435,7 @@ EXTERN void Tcl_MainEx(int argc, char **argv,
Tcl_AppInitProc *appInitProc, Tcl_Interp *interp);
EXTERN const char * Tcl_PkgInitStubsCheck(Tcl_Interp *interp,
const char *version, int exact);
#if defined(TCL_THREADS) && defined(USE_THREAD_ALLOC)
EXTERN void Tcl_GetMemoryInfo(Tcl_DString *dsPtr);
#endif
/*
*----------------------------------------------------------------------------
@@ -2508,7 +2522,7 @@ EXTERN void Tcl_GetMemoryInfo(Tcl_DString *dsPtr);
# define Tcl_DecrRefCount(objPtr) \
do { \
Tcl_Obj *_objPtr = (objPtr); \
if (--(_objPtr)->refCount <= 0) { \
if ((_objPtr)->refCount-- <= 1) { \
TclFreeObj(_objPtr); \
} \
} while(0)
+1 -1
View File
@@ -31,7 +31,7 @@
* until Tcl uses config.h properly.
*/
#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__BORLANDC__)
#if defined(_MSC_VER) || defined(__MSVCRT__) || defined(__BORLANDC__)
typedef unsigned long caddr_t;
#endif
+94 -52
View File
@@ -22,10 +22,7 @@
#include "tclCompile.h"
#include "tommath.h"
#include <math.h>
#if NRE_ENABLE_ASSERTS
#include <assert.h>
#endif
#define INTERP_STACK_INITIAL_SIZE 2000
#define CORO_STACK_INITIAL_SIZE 200
@@ -472,7 +469,6 @@ Tcl_CreateInterp(void)
#endif /* TCL_COMPILE_STATS */
char mathFuncName[32];
CallFrame *framePtr;
int result;
TclInitSubsystems();
@@ -642,11 +638,8 @@ Tcl_CreateInterp(void)
/* This is needed to satisfy GCC 3.3's strict aliasing rules */
framePtr = ckalloc(sizeof(CallFrame));
result = Tcl_PushCallFrame(interp, (Tcl_CallFrame *) framePtr,
(void) Tcl_PushCallFrame(interp, (Tcl_CallFrame *) framePtr,
(Tcl_Namespace *) iPtr->globalNsPtr, /*isProcCallFrame*/ 0);
if (result != TCL_OK) {
Tcl_Panic("Tcl_CreateInterp: failed to push the root stack frame");
}
framePtr->objc = 0;
iPtr->framePtr = framePtr;
@@ -840,7 +833,9 @@ Tcl_CreateInterp(void)
*/
Tcl_CreateObjCommand(interp, "::tcl::unsupported::disassemble",
Tcl_DisassembleObjCmd, NULL, NULL);
Tcl_DisassembleObjCmd, INT2PTR(0), NULL);
Tcl_CreateObjCommand(interp, "::tcl::unsupported::getbytecode",
Tcl_DisassembleObjCmd, INT2PTR(1), NULL);
Tcl_CreateObjCommand(interp, "::tcl::unsupported::representation",
Tcl_RepresentationCmd, NULL, NULL);
@@ -920,6 +915,13 @@ Tcl_CreateInterp(void)
TclInitEmbeddedConfigurationInformation(interp);
/*
* TIP #440: Declare the name of the script engine to be "Tcl".
*/
Tcl_SetVar2(interp, "tcl_platform", "engine", "Tcl",
TCL_GLOBAL_ONLY);
/*
* Compute the byte order of this machine.
*/
@@ -2258,7 +2260,7 @@ Tcl_CreateObjCommand(
/* Command already exists. */
/*
* [***] This is wrong. See Tcl Bug a16752c252.
* [***] This is wrong. See Tcl Bug a16752c252.
* However, this buggy behavior is kept under particular
* circumstances to accommodate deployed binaries of the
* "tclcompiler" program. http://sourceforge.net/projects/tclpro/
@@ -3082,7 +3084,7 @@ Tcl_DeleteCommandFromToken(
while (tracePtr != NULL) {
CommandTrace *nextPtr = tracePtr->nextPtr;
if ((--tracePtr->refCount) <= 0) {
if (tracePtr->refCount-- <= 1) {
ckfree(tracePtr);
}
tracePtr = nextPtr;
@@ -3268,7 +3270,7 @@ CallCommandTraces(
tracePtr->traceProc(tracePtr->clientData, (Tcl_Interp *) iPtr,
oldName, newName, flags);
cmdPtr->flags &= ~tracePtr->flags;
if ((--tracePtr->refCount) <= 0) {
if (tracePtr->refCount-- <= 1) {
ckfree(tracePtr);
}
}
@@ -4140,8 +4142,9 @@ TclNREvalObjv(
/*
* data[1] stores a marker for use by tailcalls; it will be set to 1 by
* command redirectors (imports, alias, ensembles) so that tailcalls
* finishes the source command and not just the target.
* command redirectors (imports, alias, ensembles) so that tailcall skips
* this callback (that marks the end of the target command) and goes back
* to the end of the source command.
*/
if (iPtr->deferredCallbacks) {
@@ -4169,7 +4172,7 @@ EvalObjvCore(
Interp *iPtr = (Interp *) interp;
Namespace *lookupNsPtr = NULL;
int enterTracesDone = 0;
/*
* Push records for task to be done on return, in INVERSE order. First, if
* needed, the exception handlers (as they should happen last).
@@ -4295,7 +4298,7 @@ EvalObjvCore(
}
}
/*
/*
* Schedule leave traces. Raise the refCount on the resolved
* cmdPtr, so that when it passes to the leave traces we know
* it's still valid.
@@ -4404,9 +4407,9 @@ NRCommand(
iPtr->numLevels--;
/*
* If there is a tailcall, schedule it
* If there is a tailcall, schedule it next
*/
if (data[1] && (data[1] != INT2PTR(1))) {
TclNRAddCallback(interp, TclNRTailcallEval, data[1], NULL, NULL, NULL);
}
@@ -5640,10 +5643,10 @@ TclArgumentBCEnter(
* ensemble dispatch. Ensemble subcommands that lead to script
* evaluation are not supposed to get compiled, because a command
* such as [info level] in the script can expose some of the dispatch
* shenanigans. This means that we don't have to tend to the
* shenanigans. This means that we don't have to tend to the
* housekeeping, and can escape now.
*/
if (ePtr->nline != objc) {
return;
}
@@ -5907,7 +5910,7 @@ Tcl_GlobalEvalObj(
*
* If the flag TCL_EVAL_DIRECT is passed in, the value of invoker
* must be NULL. Support for non-NULL invokers in that mode has
* been removed since it was unused and untested. Failure to
* been removed since it was unused and untested. Failure to
* follow this limitation will lead to an assertion panic.
*
* Results:
@@ -6515,11 +6518,7 @@ TclObjInvokeNamespace(
* command.
*/
result = TclPushStackFrame(interp, &framePtr, nsPtr, /*isProcFrame*/0);
if (result != TCL_OK) {
return TCL_ERROR;
}
(void) TclPushStackFrame(interp, &framePtr, nsPtr, /*isProcFrame*/0);
result = TclObjInvoke(interp, objc, objv, flags);
TclPopStackFrame(interp);
@@ -8168,27 +8167,31 @@ Tcl_NRCmdSwap(
}
/*****************************************************************************
* Stuff for tailcalls
* Tailcall related code
*****************************************************************************
*
* Just to show that IT CAN BE DONE! The precise semantics are not simple,
* require more thought. Possibly need a new Tcl return code to do it right?
* Questions include:
* (1) How is the objc/objv tailcall to be run? My current thinking is that
* it should essentially be
* [tailcall a b c] <=> [uplevel 1 [list a b c]]
* with two caveats
* (a) the current frame is dropped first, after running all pending
* cleanup tasks and saving its namespace
* (b) 'a' is looked up in the returning frame's namespace, but the
* command is run in the context to which we are returning
* Current implementation does this if [tailcall] is called from within
* a proc, errors otherwise.
* (2) Should a tailcall bypass [catch] in the returning frame? Current
* implementation does not (or does it? Changed, test!) - it causes an
* error.
* The steps of the tailcall dance are as follows:
*
* FIXME NRE!
* 1. when [tailcall] is invoked, it stores the corresponding callback in
* the current CallFrame and returns TCL_RETURN
* 2. when the CallFrame is popped, it calls TclSetTailcall to store the
* callback in the proper NRCommand callback - the spot where the command
* that pushed the CallFrame is completely cleaned up
* 3. when the NRCommand callback runs, it schedules the tailcall callback
* to run immediately after it returns
*
* One delicate point is to properly define the NRCommand where the tailcall
* will execute. There are functions whose purpose is to help define the
* precise spot:
* TclMarkTailcall: if the NEXT command to be pushed tailcalls, execution
* should continue right here
* TclSkipTailcall: if the NEXT command to be pushed tailcalls, execution
* should continue after the CURRENT command is fully returned ("skip
* the next command: we are redirecting to it, tailcalls should run
* after WE return")
* TclPushTailcallPoint: the search for a tailcalling spot cannot traverse
* this point. This is special for OO, as some of the oo constructs
* that behave like commands may not push an NRCommand callback.
*/
void
@@ -8222,6 +8225,18 @@ TclPushTailcallPoint(
((Interp *) interp)->numLevels++;
}
/*
*----------------------------------------------------------------------
*
* TclSetTailcall --
*
* Splice a tailcall command in the proper spot of the NRE callback
* stack, so that it runs at the right time.
*
*----------------------------------------------------------------------
*/
void
TclSetTailcall(
Tcl_Interp *interp,
@@ -8246,6 +8261,23 @@ TclSetTailcall(
runPtr->data[1] = listPtr;
}
/*
*----------------------------------------------------------------------
*
* TclNRTailcallObjCmd --
*
* Prepare the tailcall as a list and store it in the current
* varFrame. When the frame is later popped the tailcall will be spliced
* at the proper place.
*
* Results:
* The first NRCommand callback that is not marked to be skipped is
* updated so that its data[1] field contains the tailcall list.
*
*----------------------------------------------------------------------
*/
int
TclNRTailcallObjCmd(
ClientData clientData,
@@ -8260,9 +8292,9 @@ TclNRTailcallObjCmd(
return TCL_ERROR;
}
if (!(iPtr->varFramePtr->isProcCallFrame & 1)) { /* or is upleveled */
if (!(iPtr->varFramePtr->isProcCallFrame & 1)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"tailcall can only be called from a proc or lambda", -1));
"tailcall can only be called from a proc, lambda or method", -1));
Tcl_SetErrorCode(interp, "TCL", "TAILCALL", "ILLEGAL", NULL);
return TCL_ERROR;
}
@@ -8280,8 +8312,7 @@ TclNRTailcallObjCmd(
/*
* Create the callback to actually evaluate the tailcalled
* command, then set it in the varFrame so that PopCallFrame can use it
* at the proper time. Being lazy: exploit the TclNRAddCallBack macro to
* build the callback.
* at the proper time.
*/
if (objc > 1) {
@@ -8291,7 +8322,7 @@ TclNRTailcallObjCmd(
/* The tailcall data is in a Tcl list: the first element is the
* namespace, the rest the command to be tailcalled. */
listPtr = Tcl_NewListObj(objc, objv);
nsObjPtr = Tcl_NewStringObj(nsPtr->fullName, -1);
@@ -8300,12 +8331,23 @@ TclNRTailcallObjCmd(
Tcl_Panic("Tailcall failed to find the proper namespace");
}
TclListObjSetElement(interp, listPtr, 0, nsObjPtr);
iPtr->varFramePtr->tailcallPtr = listPtr;
}
return TCL_RETURN;
}
/*
*----------------------------------------------------------------------
*
* TclNRTailcallEval --
*
* This NREcallback actually causes the tailcall to be evaluated.
*
*----------------------------------------------------------------------
*/
int
TclNRTailcallEval(
ClientData data[],
@@ -8318,9 +8360,9 @@ TclNRTailcallEval(
int objc;
Tcl_Obj **objv;
Tcl_ListObjGetElements(interp, listPtr, &objc, &objv);
Tcl_ListObjGetElements(interp, listPtr, &objc, &objv);
nsObjPtr = objv[0];
if (result == TCL_OK) {
result = TclGetNamespaceFromObj(interp, nsObjPtr, &nsPtr);
}
+5 -4
View File
@@ -2005,22 +2005,23 @@ ClockSecondsObjCmd(
static void
TzsetIfNecessary(void)
{
static char *tzWas = NULL; /* Previous value of TZ, protected by
static char* tzWas = INT2PTR(-1); /* Previous value of TZ, protected by
* clockMutex. */
const char *tzIsNow; /* Current value of TZ */
Tcl_MutexLock(&clockMutex);
tzIsNow = getenv("TZ");
if (tzIsNow != NULL && (tzWas == NULL || strcmp(tzIsNow, tzWas) != 0)) {
if (tzIsNow != NULL && (tzWas == NULL || tzWas == INT2PTR(-1)
|| strcmp(tzIsNow, tzWas) != 0)) {
tzset();
if (tzWas != NULL) {
if (tzWas != NULL && tzWas != INT2PTR(-1)) {
ckfree(tzWas);
}
tzWas = ckalloc(strlen(tzIsNow) + 1);
strcpy(tzWas, tzIsNow);
} else if (tzIsNow == NULL && tzWas != NULL) {
tzset();
ckfree(tzWas);
if (tzWas != INT2PTR(-1)) ckfree(tzWas);
tzWas = NULL;
}
Tcl_MutexUnlock(&clockMutex);
+1 -1
View File
@@ -748,7 +748,7 @@ Tcl_EvalObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
return Tcl_NRCallObjProc(interp, TclNREvalObjCmd, dummy, objc, objv);
return Tcl_NRCallObjProc(interp, TclNREvalObjCmd, dummy, objc, objv);
}
int
+8 -2
View File
@@ -2390,7 +2390,10 @@ Tcl_LinsertObjCmd(
Tcl_ListObjAppendElement(NULL, listPtr, objv[3]);
} else {
Tcl_ListObjReplace(NULL, listPtr, index, 0, (objc-3), &(objv[3]));
if (TCL_OK != Tcl_ListObjReplace(interp, listPtr, index, 0,
(objc-3), &(objv[3]))) {
return TCL_ERROR;
}
}
/*
@@ -2786,7 +2789,10 @@ Tcl_LreplaceObjCmd(
* optimize this case away.
*/
Tcl_ListObjReplace(NULL, listPtr, first, numToDelete, objc-4, objv+4);
if (TCL_OK != Tcl_ListObjReplace(interp, listPtr, first, numToDelete,
objc-4, objv+4)) {
return TCL_ERROR;
}
/*
* Set the interpreter's object result.
+2 -2
View File
@@ -38,7 +38,7 @@ static int UniCharIsHexDigit(int character);
* UTF-8 literal string containing all Unicode space characters [TIP #413]
*/
const char tclDefaultTrimSet[] =
const char tclDefaultTrimSet[] =
"\x09\x0a\x0b\x0c\x0d " /* ASCII */
"\xc0\x80" /* nul (U+0000) */
"\xc2\x85" /* next line (U+0085) */
@@ -2884,7 +2884,7 @@ StringCatCmd(
Tcl_AppendObjToObj(objResultPtr, objv[i]);
}
Tcl_SetObjResult(interp, objResultPtr);
return TCL_OK;
}
+277 -129
View File
@@ -26,14 +26,23 @@ static void FreeDictUpdateInfo(ClientData clientData);
static void PrintDictUpdateInfo(ClientData clientData,
Tcl_Obj *appendObj, ByteCode *codePtr,
unsigned int pcOffset);
static void DisassembleDictUpdateInfo(ClientData clientData,
Tcl_Obj *dictObj, ByteCode *codePtr,
unsigned int pcOffset);
static ClientData DupForeachInfo(ClientData clientData);
static void FreeForeachInfo(ClientData clientData);
static void PrintForeachInfo(ClientData clientData,
Tcl_Obj *appendObj, ByteCode *codePtr,
unsigned int pcOffset);
static void DisassembleForeachInfo(ClientData clientData,
Tcl_Obj *dictObj, ByteCode *codePtr,
unsigned int pcOffset);
static void PrintNewForeachInfo(ClientData clientData,
Tcl_Obj *appendObj, ByteCode *codePtr,
unsigned int pcOffset);
static void DisassembleNewForeachInfo(ClientData clientData,
Tcl_Obj *dictObj, ByteCode *codePtr,
unsigned int pcOffset);
static int CompileEachloopCmd(Tcl_Interp *interp,
Tcl_Parse *parsePtr, Command *cmdPtr,
CompileEnv *envPtr, int collect);
@@ -45,27 +54,63 @@ static int CompileDictEachCmd(Tcl_Interp *interp,
* The structures below define the AuxData types defined in this file.
*/
const AuxDataType tclForeachInfoType = {
static const AuxDataType foreachInfoType = {
"ForeachInfo", /* name */
DupForeachInfo, /* dupProc */
FreeForeachInfo, /* freeProc */
PrintForeachInfo /* printProc */
PrintForeachInfo, /* printProc */
DisassembleForeachInfo /* disassembleProc */
};
const AuxDataType tclNewForeachInfoType = {
static const AuxDataType newForeachInfoType = {
"NewForeachInfo", /* name */
DupForeachInfo, /* dupProc */
FreeForeachInfo, /* freeProc */
PrintNewForeachInfo /* printProc */
PrintNewForeachInfo, /* printProc */
DisassembleNewForeachInfo /* disassembleProc */
};
const AuxDataType tclDictUpdateInfoType = {
static const AuxDataType dictUpdateInfoType = {
"DictUpdateInfo", /* name */
DupDictUpdateInfo, /* dupProc */
FreeDictUpdateInfo, /* freeProc */
PrintDictUpdateInfo /* printProc */
PrintDictUpdateInfo, /* printProc */
DisassembleDictUpdateInfo /* disassembleProc */
};
/*
*----------------------------------------------------------------------
*
* TclGetAuxDataType --
*
* This procedure looks up an Auxdata type by name.
*
* Results:
* If an AuxData type with name matching "typeName" is found, a pointer
* to its AuxDataType structure is returned; otherwise, NULL is returned.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
const AuxDataType *
TclGetAuxDataType(
const char *typeName) /* Name of AuxData type to look up. */
{
if (!strcmp(typeName, foreachInfoType.name)) {
return &foreachInfoType;
} else if (!strcmp(typeName, newForeachInfoType.name)) {
return &newForeachInfoType;
} else if (!strcmp(typeName, dictUpdateInfoType.name)) {
return &dictUpdateInfoType;
} else if (!strcmp(typeName, tclJumptableInfoType.name)) {
return &tclJumptableInfoType;
}
return NULL;
}
/*
*----------------------------------------------------------------------
*
@@ -165,9 +210,9 @@ TclCompileAppendCmd(
*/
varTokenPtr = TokenAfter(parsePtr->tokenPtr);
PushVarNameWord(interp, varTokenPtr, envPtr, TCL_NO_ELEMENT,
&localIndex, &isScalar, 1);
if (!isScalar || localIndex < 0) {
localIndex = LocalScalarFromToken(varTokenPtr, envPtr);
if (localIndex < 0) {
return TCL_ERROR;
}
@@ -289,7 +334,8 @@ TclCompileArraySetCmd(
* a proc, we cannot do a better compile than generic.
*/
if (envPtr->procPtr == NULL && !(isDataEven && len == 0)) {
if ((varTokenPtr->type != TCL_TOKEN_SIMPLE_WORD) ||
(envPtr->procPtr == NULL && !(isDataEven && len == 0))) {
code = TclCompileBasic2ArgCmd(interp, parsePtr, cmdPtr, envPtr);
goto done;
}
@@ -330,14 +376,15 @@ TclCompileArraySetCmd(
* a non-local variable: upvar from a local one! This consumes the
* variable name that was left at stacktop.
*/
localIndex = AnonymousLocal(envPtr);
localIndex = TclFindCompiledLocal(varTokenPtr->start,
varTokenPtr->size, 1, envPtr);
PushStringLiteral(envPtr, "0");
TclEmitInstInt4(INST_REVERSE, 2, envPtr);
TclEmitInstInt4(INST_UPVAR, localIndex, envPtr);
TclEmitOpcode(INST_POP, envPtr);
}
/*
* Prepare for the internal foreach.
*/
@@ -351,7 +398,7 @@ TclCompileArraySetCmd(
infoPtr->varLists[0]->numVars = 2;
infoPtr->varLists[0]->varIndexes[0] = keyVar;
infoPtr->varLists[0]->varIndexes[1] = valVar;
infoIndex = TclCreateAuxData(infoPtr, &tclForeachInfoType, envPtr);
infoIndex = TclCreateAuxData(infoPtr, &newForeachInfoType, envPtr);
/*
* Start issuing instructions to write to the array.
@@ -533,7 +580,7 @@ TclCompileCatchCmd(
int resultIndex, optsIndex, range, dropScript = 0;
DefineLineInformation; /* TIP #280 */
int depth = TclGetStackDepth(envPtr);
/*
* If syntax does not match what we expect for [catch], do not compile.
* Let runtime checks determine if syntax has changed.
@@ -612,7 +659,7 @@ TclCompileCatchCmd(
}
ExceptionRangeEnds(envPtr, range);
/*
* Emit the "no errors" epilogue: push "0" (TCL_OK) as the catch result,
* and jump around the "error case" code.
@@ -622,14 +669,14 @@ TclCompileCatchCmd(
PushStringLiteral(envPtr, "0");
TclEmitForwardJump(envPtr, TCL_UNCONDITIONAL_JUMP, &jumpFixup);
/*
/*
* Emit the "error case" epilogue. Push the interpreter result and the
* return code.
*/
ExceptionRangeTarget(envPtr, range, catchOffset);
TclSetStackDepth(depth + dropScript, envPtr);
if (dropScript) {
TclEmitOpcode( INST_POP, envPtr);
}
@@ -1655,7 +1702,7 @@ TclCompileDictUpdateCmd(
* can't be snagged by literal sharing and forced to shimmer dangerously.
*/
infoIndex = TclCreateAuxData(duiPtr, &tclDictUpdateInfoType, envPtr);
infoIndex = TclCreateAuxData(duiPtr, &dictUpdateInfoType, envPtr);
for (i=0 ; i<numVars ; i++) {
CompileWord(envPtr, keyTokenPtrs[i], interp, 2*i+2);
@@ -2084,11 +2131,13 @@ TclCompileDictWithCmd(
* DupDictUpdateInfo: a copy of the auxiliary data
* FreeDictUpdateInfo: none
* PrintDictUpdateInfo: none
* DisassembleDictUpdateInfo: none
*
* Side effects:
* DupDictUpdateInfo: allocates memory
* FreeDictUpdateInfo: releases memory
* PrintDictUpdateInfo: none
* DisassembleDictUpdateInfo: none
*
*----------------------------------------------------------------------
*/
@@ -2131,6 +2180,25 @@ PrintDictUpdateInfo(
Tcl_AppendPrintfToObj(appendObj, "%%v%u", duiPtr->varIndices[i]);
}
}
static void
DisassembleDictUpdateInfo(
ClientData clientData,
Tcl_Obj *dictObj,
ByteCode *codePtr,
unsigned int pcOffset)
{
DictUpdateInfo *duiPtr = clientData;
int i;
Tcl_Obj *variables = Tcl_NewObj();
for (i=0 ; i<duiPtr->length ; i++) {
Tcl_ListObjAppendElement(NULL, variables,
Tcl_NewIntObj(duiPtr->varIndices[i]));
}
Tcl_DictObjPut(NULL, dictObj, Tcl_NewStringObj("variables", -1),
variables);
}
/*
*----------------------------------------------------------------------
@@ -2368,7 +2436,6 @@ TclCompileForCmd(
SetLineInformation(2);
TclCompileExprWords(interp, testTokenPtr, 1, envPtr);
TclClearNumConversion(envPtr);
jumpDist = CurrentOffset(envPtr) - bodyCodeOffset;
if (jumpDist > 127) {
@@ -2493,24 +2560,16 @@ CompileEachloopCmd(
* (TCL_EACH_*) */
{
Proc *procPtr = envPtr->procPtr;
ForeachInfo *infoPtr; /* Points to the structure describing this
ForeachInfo *infoPtr=NULL; /* Points to the structure describing this
* foreach command. Stored in a AuxData
* record in the ByteCode. */
Tcl_Token *tokenPtr, *bodyTokenPtr;
int jumpBackOffset, infoIndex, range;
int numWords, numLists, numVars, loopIndex, i, j, code;
int numWords, numLists, i, j, code = TCL_OK;
Tcl_Obj *varListObj = NULL;
DefineLineInformation; /* TIP #280 */
/*
* We parse the variable list argument words and create two arrays:
* varcList[i] is number of variables in i-th var list.
* varvList[i] points to array of var names in i-th var list.
*/
int *varcList;
const char ***varvList;
/*
* If the foreach command isn't in a procedure, don't compile it inline:
* the payoff is too small.
@@ -2539,115 +2598,83 @@ CompileEachloopCmd(
}
/*
* Allocate storage for the varcList and varvList arrays if necessary.
* Create and initialize the ForeachInfo and ForeachVarList data
* structures describing this command. Then create a AuxData record
* pointing to the ForeachInfo structure.
*/
numLists = (numWords - 2)/2;
varcList = TclStackAlloc(interp, numLists * sizeof(int));
memset(varcList, 0, numLists * sizeof(int));
varvList = (const char ***) TclStackAlloc(interp,
numLists * sizeof(const char **));
memset((char*) varvList, 0, numLists * sizeof(const char **));
infoPtr = ckalloc(sizeof(ForeachInfo)
+ (numLists - 1) * sizeof(ForeachVarList *));
infoPtr->numLists = 0; /* Count this up as we go */
/*
* Break up each var list and set the varcList and varvList arrays. Don't
* Parse each var list into sequence of var names. Don't
* compile the foreach inline if any var name needs substitutions or isn't
* a scalar, or if any var list needs substitutions.
*/
loopIndex = 0;
varListObj = Tcl_NewObj();
for (i = 0, tokenPtr = parsePtr->tokenPtr;
i < numWords-1;
i++, tokenPtr = TokenAfter(tokenPtr)) {
Tcl_DString varList;
ForeachVarList *varListPtr;
int numVars;
if (i%2 != 1) {
continue;
}
if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) {
code = TCL_ERROR;
goto done;
}
/*
* Lots of copying going on here. Need a ListObj wizard to show a
* better way.
*/
Tcl_DStringInit(&varList);
TclDStringAppendToken(&varList, &tokenPtr[1]);
code = Tcl_SplitList(NULL, Tcl_DStringValue(&varList),
&varcList[loopIndex], &varvList[loopIndex]);
Tcl_DStringFree(&varList);
if (code != TCL_OK) {
code = TCL_ERROR;
goto done;
}
numVars = varcList[loopIndex];
/*
* If the variable list is empty, we can enter an infinite loop when
* the interpreted version would not. Take care to ensure this does
* not happen. [Bug 1671138]
* the interpreted version would not. Take care to ensure this does
* not happen. [Bug 1671138]
*/
if (numVars == 0) {
if (!TclWordKnownAtCompileTime(tokenPtr, varListObj) ||
TCL_OK != Tcl_ListObjLength(NULL, varListObj, &numVars) ||
numVars == 0) {
code = TCL_ERROR;
goto done;
}
for (j = 0; j < numVars; j++) {
const char *varName = varvList[loopIndex][j];
varListPtr = ckalloc(sizeof(ForeachVarList)
+ (numVars - 1) * sizeof(int));
varListPtr->numVars = numVars;
infoPtr->varLists[i/2] = varListPtr;
infoPtr->numLists++;
if (!TclIsLocalScalar(varName, (int) strlen(varName))) {
for (j = 0; j < numVars; j++) {
Tcl_Obj *varNameObj;
const char *bytes;
int numBytes, varIndex;
Tcl_ListObjIndex(NULL, varListObj, j, &varNameObj);
bytes = Tcl_GetStringFromObj(varNameObj, &numBytes);
varIndex = LocalScalar(bytes, numBytes, envPtr);
if (varIndex < 0) {
code = TCL_ERROR;
goto done;
}
varListPtr->varIndexes[j] = varIndex;
}
loopIndex++;
Tcl_SetObjLength(varListObj, 0);
}
/*
* We will compile the foreach command.
*/
code = TCL_OK;
/*
* Create and initialize the ForeachInfo and ForeachVarList data
* structures describing this command. Then create a AuxData record
* pointing to the ForeachInfo structure.
*/
infoPtr = ckalloc(sizeof(ForeachInfo)
+ (numLists - 1) * sizeof(ForeachVarList *));
infoPtr->numLists = numLists;
for (loopIndex = 0; loopIndex < numLists; loopIndex++) {
ForeachVarList *varListPtr;
numVars = varcList[loopIndex];
varListPtr = ckalloc(sizeof(ForeachVarList)
+ (numVars - 1) * sizeof(int));
varListPtr->numVars = numVars;
for (j = 0; j < numVars; j++) {
const char *varName = varvList[loopIndex][j];
int nameChars = strlen(varName);
varListPtr->varIndexes[j] = TclFindCompiledLocal(varName,
nameChars, /*create*/ 1, envPtr);
}
infoPtr->varLists[loopIndex] = varListPtr;
}
infoIndex = TclCreateAuxData(infoPtr, &tclNewForeachInfoType, envPtr);
infoIndex = TclCreateAuxData(infoPtr, &newForeachInfoType, envPtr);
/*
* Create the collecting object, unshared.
*/
if (collect == TCL_EACH_COLLECT) {
TclEmitInstInt4(INST_LIST, 0, envPtr);
}
/*
* Evaluate each value list and leave it on stack.
*/
@@ -2661,7 +2688,7 @@ CompileEachloopCmd(
}
TclEmitInstInt4(INST_FOREACH_START, infoIndex, envPtr);
/*
* Inline compile the loop body.
*/
@@ -2671,7 +2698,7 @@ CompileEachloopCmd(
ExceptionRangeStarts(envPtr, range);
BODY(bodyTokenPtr, numWords - 1);
ExceptionRangeEnds(envPtr, range);
if (collect == TCL_EACH_COLLECT) {
TclEmitOpcode(INST_LMAP_COLLECT, envPtr);
} else {
@@ -2680,7 +2707,7 @@ CompileEachloopCmd(
/*
* Bottom of loop code: assign each loop variable and check whether
* to terminate the loop. Set the loop's break target.
* to terminate the loop. Set the loop's break target.
*/
ExceptionRangeTarget(envPtr, range, continueOffset);
@@ -2694,7 +2721,7 @@ CompileEachloopCmd(
* Set the jumpback distance from INST_FOREACH_STEP to the start of the
* body's code. Misuse loopCtTemp for storing the jump size.
*/
jumpBackOffset = envPtr->exceptArrayPtr[range].continueOffset -
envPtr->exceptArrayPtr[range].codeOffset;
infoPtr->loopCtTemp = -jumpBackOffset;
@@ -2707,15 +2734,12 @@ CompileEachloopCmd(
if (collect != TCL_EACH_COLLECT) {
PushStringLiteral(envPtr, "");
}
done:
for (loopIndex = 0; loopIndex < numLists; loopIndex++) {
if (varvList[loopIndex] != NULL) {
ckfree(varvList[loopIndex]);
}
if (code == TCL_ERROR) {
FreeForeachInfo(infoPtr);
}
TclStackFree(interp, (void *)varvList);
TclStackFree(interp, varcList);
Tcl_DecrRefCount(varListObj);
return code;
}
@@ -2809,10 +2833,10 @@ FreeForeachInfo(
/*
*----------------------------------------------------------------------
*
* PrintForeachInfo --
* PrintForeachInfo, DisassembleForeachInfo --
*
* Function to write a human-readable representation of a ForeachInfo
* structure to stdout for debugging.
* Functions to write a human-readable or script-readablerepresentation
* of a ForeachInfo structure to a Tcl_Obj for debugging.
*
* Results:
* None.
@@ -2892,6 +2916,89 @@ PrintNewForeachInfo(
Tcl_AppendToObj(appendObj, "]", -1);
}
}
static void
DisassembleForeachInfo(
ClientData clientData,
Tcl_Obj *dictObj,
ByteCode *codePtr,
unsigned int pcOffset)
{
register ForeachInfo *infoPtr = clientData;
register ForeachVarList *varsPtr;
int i, j;
Tcl_Obj *objPtr, *innerPtr;
/*
* Data stores.
*/
objPtr = Tcl_NewObj();
for (i=0 ; i<infoPtr->numLists ; i++) {
Tcl_ListObjAppendElement(NULL, objPtr,
Tcl_NewIntObj(infoPtr->firstValueTemp + i));
}
Tcl_DictObjPut(NULL, dictObj, Tcl_NewStringObj("data", -1), objPtr);
/*
* Loop counter.
*/
Tcl_DictObjPut(NULL, dictObj, Tcl_NewStringObj("loop", -1),
Tcl_NewIntObj(infoPtr->loopCtTemp));
/*
* Assignment targets.
*/
objPtr = Tcl_NewObj();
for (i=0 ; i<infoPtr->numLists ; i++) {
innerPtr = Tcl_NewObj();
varsPtr = infoPtr->varLists[i];
for (j=0 ; j<varsPtr->numVars ; j++) {
Tcl_ListObjAppendElement(NULL, innerPtr,
Tcl_NewIntObj(varsPtr->varIndexes[j]));
}
Tcl_ListObjAppendElement(NULL, objPtr, innerPtr);
}
Tcl_DictObjPut(NULL, dictObj, Tcl_NewStringObj("assign", -1), objPtr);
}
static void
DisassembleNewForeachInfo(
ClientData clientData,
Tcl_Obj *dictObj,
ByteCode *codePtr,
unsigned int pcOffset)
{
register ForeachInfo *infoPtr = clientData;
register ForeachVarList *varsPtr;
int i, j;
Tcl_Obj *objPtr, *innerPtr;
/*
* Jump offset.
*/
Tcl_DictObjPut(NULL, dictObj, Tcl_NewStringObj("jumpOffset", -1),
Tcl_NewIntObj(infoPtr->loopCtTemp));
/*
* Assignment targets.
*/
objPtr = Tcl_NewObj();
for (i=0 ; i<infoPtr->numLists ; i++) {
innerPtr = Tcl_NewObj();
varsPtr = infoPtr->varLists[i];
for (j=0 ; j<varsPtr->numVars ; j++) {
Tcl_ListObjAppendElement(NULL, innerPtr,
Tcl_NewIntObj(varsPtr->varIndexes[j]));
}
Tcl_ListObjAppendElement(NULL, objPtr, innerPtr);
}
Tcl_DictObjPut(NULL, dictObj, Tcl_NewStringObj("assign", -1), objPtr);
}
/*
*----------------------------------------------------------------------
@@ -3114,6 +3221,54 @@ TclCompileFormatCmd(
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* TclLocalScalarFromToken --
*
* Get the index into the table of compiled locals that corresponds
* to a local scalar variable name.
*
* Results:
* Returns the non-negative integer index value into the table of
* compiled locals corresponding to a local scalar variable name.
* If the arguments passed in do not identify a local scalar variable
* then return -1.
*
* Side effects:
* May add an entery into the table of compiled locals.
*
*----------------------------------------------------------------------
*/
int
TclLocalScalarFromToken(
Tcl_Token *tokenPtr,
CompileEnv *envPtr)
{
int isScalar, index;
TclPushVarName(NULL, tokenPtr, envPtr, TCL_NO_ELEMENT, &index, &isScalar);
if (!isScalar) {
index = -1;
}
return index;
}
int
TclLocalScalar(
const char *bytes,
int numBytes,
CompileEnv *envPtr)
{
Tcl_Token token[2] = {{TCL_TOKEN_SIMPLE_WORD, NULL, 0, 1},
{TCL_TOKEN_TEXT, NULL, 0, 0}};
token[1].start = bytes;
token[1].size = numBytes;
return TclLocalScalarFromToken(token, envPtr);
}
/*
*----------------------------------------------------------------------
*
@@ -3172,16 +3327,7 @@ TclPushVarName(
nameChars = elNameChars = 0;
localIndex = -1;
/*
* Check not only that the type is TCL_TOKEN_SIMPLE_WORD, but whether
* curly braces surround the variable name. This really matters for array
* elements to handle things like
* set {x($foo)} 5
* which raises an undefined var error if we are not careful here.
*/
if ((varTokenPtr->type == TCL_TOKEN_SIMPLE_WORD) &&
(varTokenPtr->start[0] != '{')) {
if (varTokenPtr->type == TCL_TOKEN_SIMPLE_WORD) {
/*
* A simple variable name. Divide it up into "name" and "elName"
* strings. If it is not a local variable, look it up at runtime.
@@ -3205,7 +3351,7 @@ TclPushVarName(
}
}
if ((elName != NULL) && elNameChars) {
if (!(flags & TCL_NO_ELEMENT) && (elName != NULL) && elNameChars) {
/*
* An array element, the element name is a simple string:
* assemble the corresponding token.
@@ -3220,7 +3366,7 @@ TclPushVarName(
elemTokenCount = 1;
}
}
} else if (((n = varTokenPtr->numComponents) > 1)
} else if (interp && ((n = varTokenPtr->numComponents) > 1)
&& (varTokenPtr[1].type == TCL_TOKEN_TEXT)
&& (varTokenPtr[n].type == TCL_TOKEN_TEXT)
&& (varTokenPtr[n].start[varTokenPtr[n].size - 1] == ')')) {
@@ -3256,9 +3402,10 @@ TclPushVarName(
nameChars = p - varTokenPtr[1].start;
elName = p + 1;
remainingChars = (varTokenPtr[2].start - p) - 1;
elNameChars = (varTokenPtr[n].start-p) + varTokenPtr[n].size - 2;
elNameChars = (varTokenPtr[n].start-p) + varTokenPtr[n].size - 1;
if (remainingChars) {
if (!(flags & TCL_NO_ELEMENT)) {
if (remainingChars) {
/*
* Make a first token with the extra characters in the first
* token.
@@ -3278,13 +3425,14 @@ TclPushVarName(
memcpy(elemTokenPtr+1, varTokenPtr+2,
(n-1) * sizeof(Tcl_Token));
} else {
} else {
/*
* Use the already available tokens.
*/
elemTokenPtr = &varTokenPtr[2];
elemTokenCount = n - 1;
}
}
}
}
@@ -3319,7 +3467,7 @@ TclPushVarName(
localIndex = -1;
}
}
if (localIndex < 0) {
if (interp && localIndex < 0) {
PushLiteral(envPtr, name, nameChars);
}
@@ -3336,7 +3484,7 @@ TclPushVarName(
PushStringLiteral(envPtr, "");
}
}
} else {
} else if (interp) {
/*
* The var name isn't simple: compile and push it.
*/
+31 -33
View File
@@ -144,7 +144,7 @@ TclCompileGlobalCmd(
return TCL_ERROR;
}
/* TODO: Consider what value can pass throug the
/* TODO: Consider what value can pass throug the
* IndexTailVarIfKnown() screen. Full CompileWord()
* likely does not apply here. Push known value instead. */
CompileWord(envPtr, varTokenPtr, interp, i);
@@ -281,7 +281,6 @@ TclCompileIfCmd(
SetLineInformation(wordIdx);
Tcl_ResetResult(interp);
TclCompileExprWords(interp, testTokenPtr, 1, envPtr);
TclClearNumConversion(envPtr);
if (jumpFalseFixupArray.next >= jumpFalseFixupArray.end) {
TclExpandJumpFixupArray(&jumpFalseFixupArray);
}
@@ -531,7 +530,6 @@ TclCompileIncrCmd(
} else {
SetLineInformation(2);
CompileTokens(envPtr, incrTokenPtr, interp);
TclClearNumConversion(envPtr);
}
} else { /* No incr amount given so use 1. */
haveImmValue = 1;
@@ -873,7 +871,7 @@ TclCompileLappendCmd(
/* TODO: Consider support for compiling expanded args. */
numWords = parsePtr->numWords;
if (numWords == 1) {
if (numWords < 3) {
return TCL_ERROR;
}
@@ -1212,20 +1210,7 @@ TclCompileListCmd(
valueTokenPtr = TokenAfter(valueTokenPtr);
}
if (listObj != NULL) {
int len;
const char *bytes = Tcl_GetStringFromObj(listObj, &len);
PushLiteral(envPtr, bytes, len);
Tcl_DecrRefCount(listObj);
if (len > 0) {
/*
* Force list interpretation!
*/
TclEmitOpcode( INST_DUP, envPtr);
TclEmitOpcode( INST_LIST_LENGTH, envPtr);
TclEmitOpcode( INST_POP, envPtr);
}
TclEmitPush(TclAddLiteralObj(envPtr, listObj, NULL), envPtr);
return TCL_OK;
}
@@ -1480,7 +1465,7 @@ TclCompileLreplaceCmd(
Tcl_Token *tokenPtr, *listTokenPtr;
DefineLineInformation; /* TIP #280 */
Tcl_Obj *tmpObj;
int idx1, idx2, i, offset;
int idx1, idx2, i, offset, offset2;
if (parsePtr->numWords < 4) {
return TCL_ERROR;
@@ -1503,6 +1488,10 @@ TclCompileLreplaceCmd(
return TCL_ERROR;
}
if(idx2 != INDEX_END && idx2 >= 0 && idx2 < idx1) {
idx2 = idx1-1;
}
/*
* Work out what this [lreplace] is actually doing.
*/
@@ -1586,12 +1575,18 @@ TclCompileLreplaceCmd(
TclEmitOpcode( INST_GT, envPtr);
offset = CurrentOffset(envPtr);
TclEmitInstInt1( INST_JUMP_TRUE1, 0, envPtr);
TclEmitOpcode( INST_DUP, envPtr);
TclEmitOpcode( INST_LIST_LENGTH, envPtr);
offset2 = CurrentOffset(envPtr);
TclEmitInstInt1( INST_JUMP_FALSE1, 0, envPtr);
TclEmitPush(TclAddLiteralObj(envPtr, Tcl_ObjPrintf(
"list doesn't contain element %d", idx1), NULL), envPtr);
CompileReturnInternal(envPtr, INST_RETURN_IMM, TCL_ERROR, 0,
Tcl_ObjPrintf("-errorcode {TCL OPERATION LREPLACE BADIDX}"));
TclStoreInt1AtPtr(CurrentOffset(envPtr) - offset,
envPtr->codeStart + offset + 1);
TclStoreInt1AtPtr(CurrentOffset(envPtr) - offset2,
envPtr->codeStart + offset2 + 1);
TclAdjustStackDepth(-1, envPtr);
}
TclEmitOpcode( INST_DUP, envPtr);
@@ -1636,12 +1631,18 @@ TclCompileLreplaceCmd(
TclEmitOpcode( INST_GT, envPtr);
offset = CurrentOffset(envPtr);
TclEmitInstInt1( INST_JUMP_TRUE1, 0, envPtr);
TclEmitOpcode( INST_DUP, envPtr);
TclEmitOpcode( INST_LIST_LENGTH, envPtr);
offset2 = CurrentOffset(envPtr);
TclEmitInstInt1( INST_JUMP_TRUE1, 0, envPtr);
TclEmitPush(TclAddLiteralObj(envPtr, Tcl_ObjPrintf(
"list doesn't contain element %d", idx1), NULL), envPtr);
CompileReturnInternal(envPtr, INST_RETURN_IMM, TCL_ERROR, 0,
Tcl_ObjPrintf("-errorcode {TCL OPERATION LREPLACE BADIDX}"));
TclStoreInt1AtPtr(CurrentOffset(envPtr) - offset,
envPtr->codeStart + offset + 1);
TclStoreInt1AtPtr(CurrentOffset(envPtr) - offset2,
envPtr->codeStart + offset2 + 1);
TclAdjustStackDepth(-1, envPtr);
}
TclEmitOpcode( INST_DUP, envPtr);
@@ -2034,7 +2035,7 @@ TclCompileNamespaceUpvarCmd(
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr, *otherTokenPtr, *localTokenPtr;
int isScalar, localIndex, numWords, i;
int localIndex, numWords, i;
DefineLineInformation; /* TIP #280 */
if (envPtr->procPtr == NULL) {
@@ -2069,10 +2070,8 @@ TclCompileNamespaceUpvarCmd(
localTokenPtr = TokenAfter(otherTokenPtr);
CompileWord(envPtr, otherTokenPtr, interp, i);
PushVarNameWord(interp, localTokenPtr, envPtr, 0,
&localIndex, &isScalar, i+1);
if ((localIndex < 0) || !isScalar) {
localIndex = LocalScalarFromToken(localTokenPtr, envPtr);
if (localIndex < 0) {
return TCL_ERROR;
}
TclEmitInstInt4( INST_NSUPVAR, localIndex, envPtr);
@@ -2258,7 +2257,7 @@ TclCompileRegexpCmd(
* converted pattern as a literal.
*/
if (TclReToGlob(NULL, varTokenPtr[1].start, len, &ds, &exact)
if (TclReToGlob(NULL, varTokenPtr[1].start, len, &ds, &exact, NULL)
== TCL_OK) {
simple = 1;
PushLiteral(envPtr, Tcl_DStringValue(&ds),Tcl_DStringLength(&ds));
@@ -2350,7 +2349,7 @@ TclCompileRegsubCmd(
Tcl_Obj *patternObj = NULL, *replacementObj = NULL;
Tcl_DString pattern;
const char *bytes;
int len, exact, result = TCL_ERROR;
int len, exact, quantified, result = TCL_ERROR;
if (parsePtr->numWords < 5 || parsePtr->numWords > 6) {
return TCL_ERROR;
@@ -2410,7 +2409,8 @@ TclCompileRegsubCmd(
*/
bytes = Tcl_GetStringFromObj(patternObj, &len);
if (TclReToGlob(NULL, bytes, len, &pattern, &exact) != TCL_OK || exact) {
if (TclReToGlob(NULL, bytes, len, &pattern, &exact, &quantified)
!= TCL_OK || exact || quantified) {
goto done;
}
bytes = Tcl_DStringValue(&pattern);
@@ -2752,7 +2752,7 @@ TclCompileUpvarCmd(
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr, *otherTokenPtr, *localTokenPtr;
int isScalar, localIndex, numWords, i;
int localIndex, numWords, i;
DefineLineInformation; /* TIP #280 */
Tcl_Obj *objPtr;
@@ -2815,10 +2815,8 @@ TclCompileUpvarCmd(
localTokenPtr = TokenAfter(otherTokenPtr);
CompileWord(envPtr, otherTokenPtr, interp, i);
PushVarNameWord(interp, localTokenPtr, envPtr, 0,
&localIndex, &isScalar, i+1);
if ((localIndex < 0) || !isScalar) {
localIndex = LocalScalarFromToken(localTokenPtr, envPtr);
if (localIndex < 0) {
return TCL_ERROR;
}
TclEmitInstInt4( INST_UPVAR, localIndex, envPtr);
@@ -2892,7 +2890,7 @@ TclCompileVariableCmd(
return TCL_ERROR;
}
/* TODO: Consider what value can pass throug the
/* TODO: Consider what value can pass throug the
* IndexTailVarIfKnown() screen. Full CompileWord()
* likely does not apply here. Push known value instead. */
CompileWord(envPtr, varTokenPtr, interp, i);
+47 -17
View File
@@ -28,6 +28,9 @@ static void FreeJumptableInfo(ClientData clientData);
static void PrintJumptableInfo(ClientData clientData,
Tcl_Obj *appendObj, ByteCode *codePtr,
unsigned int pcOffset);
static void DisassembleJumptableInfo(ClientData clientData,
Tcl_Obj *dictObj, ByteCode *codePtr,
unsigned int pcOffset);
static int CompileAssociativeBinaryOpCmd(Tcl_Interp *interp,
Tcl_Parse *parsePtr, const char *identity,
int instruction, CompileEnv *envPtr);
@@ -72,7 +75,8 @@ const AuxDataType tclJumptableInfoType = {
"JumptableInfo", /* name */
DupJumptableInfo, /* dupProc */
FreeJumptableInfo, /* freeProc */
PrintJumptableInfo /* printProc */
PrintJumptableInfo, /* printProc */
DisassembleJumptableInfo /* disassembleProc */
};
/*
@@ -288,7 +292,7 @@ TclCompileStringCatCmd(
PushStringLiteral(envPtr, "");
return TCL_OK;
}
/* General case: issue CONCAT1's (by chunks of 254 if needed), folding
contiguous constants along the way */
@@ -309,7 +313,7 @@ TclCompileStringCatCmd(
if (folded) {
int len;
const char *bytes = Tcl_GetStringFromObj(folded, &len);
PushLiteral(envPtr, bytes, len);
Tcl_DecrRefCount(folded);
folded = NULL;
@@ -318,8 +322,8 @@ TclCompileStringCatCmd(
CompileWord(envPtr, wordTokenPtr, interp, i);
numArgs ++;
if (numArgs >= 254) { /* 254 to take care of the possible +1 of "folded" above */
TclEmitInstInt1(INST_STR_CONCAT1, 254, envPtr);
numArgs -= 253; /* concat pushes 1 obj, the result */
TclEmitInstInt1(INST_STR_CONCAT1, numArgs, envPtr);
numArgs = 1; /* concat pushes 1 obj, the result */
}
}
wordTokenPtr = TokenAfter(wordTokenPtr);
@@ -327,7 +331,7 @@ TclCompileStringCatCmd(
if (folded) {
int len;
const char *bytes = Tcl_GetStringFromObj(folded, &len);
PushLiteral(envPtr, bytes, len);
Tcl_DecrRefCount(folded);
folded = NULL;
@@ -999,7 +1003,7 @@ TclCompileStringRangeCmd(
/*
* Push the operands onto the stack and then the substring operation.
*/
*/
nonConstantIndices:
CompileWord(envPtr, stringTokenPtr, interp, 1);
@@ -2091,7 +2095,7 @@ IssueSwitchChainedTests(
*/
if (TclReToGlob(NULL, bodyToken[i]->start,
bodyToken[i]->size, &ds, &exact) == TCL_OK) {
bodyToken[i]->size, &ds, &exact, NULL) == TCL_OK){
simple = 1;
PushLiteral(envPtr, Tcl_DStringValue(&ds),
Tcl_DStringLength(&ds));
@@ -2178,7 +2182,7 @@ IssueSwitchChainedTests(
}
/*
* Now do the actual compilation. Note that we do not use BODY()
* Now do the actual compilation. Note that we do not use BODY()
* because we may have synthesized the tokens in a non-standard
* pattern.
*/
@@ -2441,11 +2445,13 @@ IssueSwitchJumpTable(
* DupJumptableInfo: a copy of the jump-table
* FreeJumptableInfo: none
* PrintJumptableInfo: none
* DisassembleJumptableInfo: none
*
* Side effects:
* DupJumptableInfo: allocates memory
* FreeJumptableInfo: releases memory
* PrintJumptableInfo: none
* DisassembleJumptableInfo: none
*
*----------------------------------------------------------------------
*/
@@ -2508,6 +2514,30 @@ PrintJumptableInfo(
keyPtr, pcOffset + offset);
}
}
static void
DisassembleJumptableInfo(
ClientData clientData,
Tcl_Obj *dictObj,
ByteCode *codePtr,
unsigned int pcOffset)
{
register JumptableInfo *jtPtr = clientData;
Tcl_Obj *mapping = Tcl_NewObj();
Tcl_HashEntry *hPtr;
Tcl_HashSearch search;
const char *keyPtr;
int offset;
hPtr = Tcl_FirstHashEntry(&jtPtr->hashTable, &search);
for (; hPtr ; hPtr = Tcl_NextHashEntry(&search)) {
keyPtr = Tcl_GetHashKey(&jtPtr->hashTable, hPtr);
offset = PTR2INT(Tcl_GetHashValue(hPtr));
Tcl_DictObjPut(NULL, mapping, Tcl_NewStringObj(keyPtr, -1),
Tcl_NewIntObj(offset));
}
Tcl_DictObjPut(NULL, dictObj, Tcl_NewStringObj("mapping", -1), mapping);
}
/*
*----------------------------------------------------------------------
@@ -2610,7 +2640,7 @@ TclCompileThrowCmd(
}
CompileWord(envPtr, msgToken, interp, 2);
codeIsList = codeKnown && (TCL_OK ==
codeIsList = codeKnown && (TCL_OK ==
Tcl_ListObjLength(interp, objPtr, &len));
codeIsValid = codeIsList && (len != 0);
@@ -3038,6 +3068,7 @@ IssueTryClausesInstructions(
if (!handlerTokens[i]) {
forwardsNeedFixing = 1;
JUMP4( JUMP, forwardsToFix[i]);
TclAdjustStackDepth(1, envPtr);
} else {
int dontChangeOptions;
@@ -3544,16 +3575,16 @@ TclCompileUnsetCmd(
}
return TCL_ERROR;
}
if (i == 1) {
if (varCount == 0) {
const char *bytes;
int len;
bytes = Tcl_GetStringFromObj(leadingWord, &len);
if (len == 11 && !strncmp("-nocomplain", bytes, 11)) {
if (i == 1 && len == 11 && !strncmp("-nocomplain", bytes, 11)) {
flags = 0;
haveFlags = 1;
} else if (len == 2 && !strncmp("--", bytes, 2)) {
haveFlags = 1;
haveFlags++;
} else if (i == (2 - flags) && len == 2 && !strncmp("--", bytes, 2)) {
haveFlags++;
} else {
varCount++;
}
@@ -3568,7 +3599,7 @@ TclCompileUnsetCmd(
*/
varTokenPtr = TokenAfter(parsePtr->tokenPtr);
if (haveFlags) {
for (i=0; i<haveFlags;i++) {
varTokenPtr = TokenAfter(varTokenPtr);
}
for (i=1+haveFlags ; i<parsePtr->numWords ; i++) {
@@ -3751,7 +3782,6 @@ TclCompileWhileCmd(
}
SetLineInformation(1);
TclCompileExprWords(interp, testTokenPtr, 1, envPtr);
TclClearNumConversion(envPtr);
jumpDist = CurrentOffset(envPtr) - bodyCodeOffset;
if (jumpDist > 127) {
+43 -44
View File
@@ -365,7 +365,7 @@ static const unsigned char prec[] = {
0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0,
0,
/* Unary operator lexemes */
PREC_UNARY, /* UNARY_PLUS */
PREC_UNARY, /* UNARY_MINUS */
@@ -420,7 +420,7 @@ static const unsigned char instruction[] = {
0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0,
0,
/* Unary operator lexemes */
INST_UPLUS, /* UNARY_PLUS */
INST_UMINUS, /* UNARY_MINUS */
@@ -488,7 +488,7 @@ static const unsigned char Lexeme[] = {
typedef struct JumpList {
JumpFixup jump; /* Pass this argument to matching calls of
* TclEmitForwardJump() and
* TclEmitForwardJump() and
* TclFixupForwardJump(). */
struct JumpList *next; /* Point to next item on the stack */
} JumpList;
@@ -663,10 +663,12 @@ ParseExpr(
if (nodesUsed >= nodesAvailable) {
int size = nodesUsed * 2;
OpNode *newPtr;
OpNode *newPtr = NULL;
do {
if (size <= UINT_MAX/sizeof(OpNode)) {
newPtr = attemptckrealloc(nodes, size * sizeof(OpNode));
}
} while ((newPtr == NULL)
&& ((size -= (size - nodesUsed) / 2) > nodesUsed));
if (newPtr == NULL) {
@@ -838,7 +840,7 @@ ParseExpr(
switch (lexeme) {
case NUMBER:
case BOOLEAN:
case BOOLEAN:
/*
* TODO: Consider using a dict or hash to collapse all
* duplicate literals into a single representative value.
@@ -861,7 +863,7 @@ ParseExpr(
start += scanned;
numBytes -= scanned;
continue;
default:
break;
}
@@ -1324,7 +1326,7 @@ ParseExpr(
nodePtr->mark = MARK_LEFT;
nodePtr->left = complete;
/*
/*
* The COMMA operator cannot be optimized, since the function
* needs all of its arguments, and optimization would reduce the
* number. Other binary operators root constant expressions when
@@ -1546,7 +1548,7 @@ ConvertTreeToTokens(
* Tcl_ParseExpr() we do not change them now. Internally, we can
* do better.
*/
int toCopy = tokenPtr->numComponents + 1;
if (tokenPtr->numComponents == tokenPtr[1].numComponents + 1) {
@@ -1562,7 +1564,7 @@ ConvertTreeToTokens(
subExprTokenPtr->type = TCL_TOKEN_SUB_EXPR;
parsePtr->numTokens += toCopy;
} else {
/*
/*
* Multiple element word. Create a TCL_TOKEN_SUB_EXPR token to
* lead, with fields initialized from the leading token, then
* copy entire set of word tokens.
@@ -1611,7 +1613,7 @@ ConvertTreeToTokens(
case COMMA:
case COLON:
/*
/*
* Historical practice has been to have no Tcl_Tokens for
* these operators.
*/
@@ -1747,7 +1749,7 @@ ConvertTreeToTokens(
/*
* Before we leave this node/operator/subexpression for the
* last time, finish up its tokens....
*
*
* Our current position scanning the string is where the
* substring for the subexpression ends.
*/
@@ -1967,7 +1969,7 @@ ParseLexeme(
case 'i':
if ((numBytes > 1) && (start[1] == 'n')
&& ((numBytes == 2) || !isalpha(UCHAR(start[2])))) {
&& ((numBytes == 2) || start[2] & 0x80 || !isalpha(UCHAR(start[2])))) {
/*
* Must make this check so we can tell the difference between the
* "in" operator and the "int" function name and the "infinity"
@@ -1981,14 +1983,15 @@ ParseLexeme(
case 'e':
if ((numBytes > 1) && (start[1] == 'q')
&& ((numBytes == 2) || !isalpha(UCHAR(start[2])))) {
&& ((numBytes == 2) || start[2] & 0x80 || !isalpha(UCHAR(start[2])))) {
*lexemePtr = STREQ;
return 2;
}
break;
case 'n':
if ((numBytes > 1) && ((numBytes == 2) || !isalpha(UCHAR(start[2])))) {
if ((numBytes > 1)
&& ((numBytes == 2) || start[2] & 0x80 || !isalpha(UCHAR(start[2])))) {
switch (start[1]) {
case 'e':
*lexemePtr = STRNEQ;
@@ -2003,9 +2006,8 @@ ParseLexeme(
literal = Tcl_NewObj();
if (TclParseNumber(NULL, literal, NULL, start, numBytes, &end,
TCL_PARSE_NO_WHITESPACE) == TCL_OK) {
if (end < start + numBytes && !isalnum(UCHAR(*end))
&& UCHAR(*end) != '_') {
if (end < start + numBytes && !TclIsBareword(*end)) {
number:
TclInitStringRep(literal, start, end-start);
*lexemePtr = NUMBER;
@@ -2029,9 +2031,9 @@ ParseLexeme(
const char *p = start;
while (p < end) {
if (!isalnum(UCHAR(*p++))) {
if (!TclIsBareword(*p++)) {
/*
* The number has non-bareword characters, so we
* The number has non-bareword characters, so we
* must treat it as a number.
*/
goto number;
@@ -2054,33 +2056,30 @@ ParseLexeme(
}
}
if (Tcl_UtfCharComplete(start, numBytes)) {
scanned = Tcl_UtfToUniChar(start, &ch);
} else {
char utfBytes[TCL_UTF_MAX];
/*
* We reject leading underscores in bareword. No sensible reason why.
* Might be inspired by reserved identifier rules in C, which of course
* have no direct relevance here.
*/
memcpy(utfBytes, start, (size_t) numBytes);
utfBytes[numBytes] = '\0';
scanned = Tcl_UtfToUniChar(utfBytes, &ch);
}
if (!isalnum(UCHAR(ch))) {
if (!TclIsBareword(*start) || *start == '_') {
if (Tcl_UtfCharComplete(start, numBytes)) {
scanned = Tcl_UtfToUniChar(start, &ch);
} else {
char utfBytes[TCL_UTF_MAX];
memcpy(utfBytes, start, (size_t) numBytes);
utfBytes[numBytes] = '\0';
scanned = Tcl_UtfToUniChar(utfBytes, &ch);
}
*lexemePtr = INVALID;
Tcl_DecrRefCount(literal);
return scanned;
}
end = start;
while (isalnum(UCHAR(ch)) || (UCHAR(ch) == '_')) {
end += scanned;
numBytes -= scanned;
if (Tcl_UtfCharComplete(end, numBytes)) {
scanned = Tcl_UtfToUniChar(end, &ch);
} else {
char utfBytes[TCL_UTF_MAX];
memcpy(utfBytes, end, (size_t) numBytes);
utfBytes[numBytes] = '\0';
scanned = Tcl_UtfToUniChar(utfBytes, &ch);
}
while (numBytes && TclIsBareword(*end)) {
end += 1;
numBytes -= 1;
}
*lexemePtr = BAREWORD;
if (literalPtr) {
@@ -2098,7 +2097,7 @@ ParseLexeme(
* TclCompileExpr --
*
* This procedure compiles a string containing a Tcl expression into Tcl
* bytecodes.
* bytecodes.
*
* Results:
* None.
@@ -2333,7 +2332,7 @@ CompileExprTree(
* Use the numWords count we've kept to invoke the function
* command with the correct number of arguments.
*/
if (numWords < 255) {
TclEmitInvoke(envPtr, INST_INVOKE_STK1, numWords);
} else {
@@ -2427,7 +2426,7 @@ CompileExprTree(
const char *bytes = TclGetStringFromObj(literal, &length);
int index = TclRegisterNewLiteral(envPtr, bytes, length);
Tcl_Obj *objPtr = TclFetchLiteral(envPtr, index);
if ((objPtr->typePtr == NULL) && (literal->typePtr != NULL)) {
/*
* Would like to do this:
@@ -2570,7 +2569,7 @@ TclSingleOpCmd(
*
* TclSortingOpCmd --
* Implements the commands:
* <, <=, >, >=, ==, eq
* <, <=, >, >=, ==, eq
* in the ::tcl::mathop namespace. These commands are defined for
* arbitrary number of arguments by computing the AND of the base
* operator applied to all neighbor argument pairs.
+36 -1014
View File
File diff suppressed because it is too large Load Diff
+38 -35
View File
@@ -48,6 +48,13 @@ MODULE_SCOPE int tclTraceCompile;
MODULE_SCOPE int tclTraceExec;
#endif
/*
* The type of lambda expressions. Note that every lambda will *always* have a
* string representation.
*/
MODULE_SCOPE const Tcl_ObjType tclLambdaType;
/*
*------------------------------------------------------------------------
@@ -238,6 +245,16 @@ typedef struct AuxDataType {
AuxDataPrintProc *printProc;/* Callback function to invoke when printing
* the aux data as part of debugging. NULL
* means that the data can't be printed. */
AuxDataPrintProc *disassembleProc;
/* Callback function to invoke when doing a
* disassembly of the aux data (like the
* printProc, except that the output is
* intended to be script-readable). The
* appendObj argument should be filled in with
* a descriptive dictionary; it will start out
* with "name" mapped to the content of the
* name field. NULL means that the printProc
* should be used instead. */
} AuxDataType;
/*
@@ -832,6 +849,12 @@ typedef enum InstOperandType {
* variable table. */
OPERAND_AUX4, /* Four byte unsigned index into the aux data
* table. */
OPERAND_OFFSET1, /* One byte signed jump offset. */
OPERAND_OFFSET4, /* Four byte signed jump offset. */
OPERAND_LIT1, /* One byte unsigned index into table of
* literals. */
OPERAND_LIT4, /* Four byte unsigned index into table of
* literals. */
OPERAND_SCLS1 /* Index into tclStringClassTable. */
} InstOperandType;
@@ -972,12 +995,6 @@ typedef struct ForeachInfo {
* LAST FIELD IN THE STRUCTURE! */
} ForeachInfo;
MODULE_SCOPE const AuxDataType tclForeachInfoType;
MODULE_SCOPE const AuxDataType tclNewForeachInfoType;
#define FOREACHINFO(envPtr, index) \
((ForeachInfo*)((envPtr)->auxDataArrayPtr[TclGetUInt4AtPtr(index)].clientData))
/*
* Structure used to hold information about a switch command that is needed
* during program execution. These structures are stored in CompileEnv and
@@ -1010,11 +1027,6 @@ typedef struct {
* STRUCTURE. */
} DictUpdateInfo;
MODULE_SCOPE const AuxDataType tclDictUpdateInfoType;
#define DICTUPDATEINFO(envPtr, index) \
((DictUpdateInfo*)((envPtr)->auxDataArrayPtr[TclGetUInt4AtPtr(index)].clientData))
/*
* ClientData type used by the math operator commands.
*/
@@ -1100,7 +1112,6 @@ MODULE_SCOPE void TclExpandJumpFixupArray(JumpFixupArray *fixupArrayPtr);
MODULE_SCOPE int TclNRExecuteByteCode(Tcl_Interp *interp,
ByteCode *codePtr);
MODULE_SCOPE Tcl_Obj * TclFetchLiteral(CompileEnv *envPtr, unsigned int index);
MODULE_SCOPE void TclFinalizeAuxDataTypeTable(void);
MODULE_SCOPE int TclFindCompiledLocal(const char *name, int nameChars,
int create, CompileEnv *envPtr);
MODULE_SCOPE int TclFixupForwardJump(CompileEnv *envPtr,
@@ -1108,7 +1119,6 @@ MODULE_SCOPE int TclFixupForwardJump(CompileEnv *envPtr,
int distThreshold);
MODULE_SCOPE void TclFreeCompileEnv(CompileEnv *envPtr);
MODULE_SCOPE void TclFreeJumpFixupArray(JumpFixupArray *fixupArrayPtr);
MODULE_SCOPE void TclInitAuxDataTypeTable(void);
MODULE_SCOPE void TclInitByteCodeObj(Tcl_Obj *objPtr,
CompileEnv *envPtr);
MODULE_SCOPE void TclInitCompileEnv(Tcl_Interp *interp,
@@ -1128,6 +1138,10 @@ MODULE_SCOPE void TclFinalizeLoopExceptionRange(CompileEnv *envPtr,
MODULE_SCOPE char * TclLiteralStats(LiteralTable *tablePtr);
MODULE_SCOPE int TclLog2(int value);
#endif
MODULE_SCOPE int TclLocalScalar(const char *bytes, int numBytes,
CompileEnv *envPtr);
MODULE_SCOPE int TclLocalScalarFromToken(Tcl_Token *tokenPtr,
CompileEnv *envPtr);
MODULE_SCOPE void TclOptimizeBytecode(void *envPtr);
#ifdef TCL_COMPILE_DEBUG
MODULE_SCOPE void TclPrintByteCodeObj(Tcl_Interp *interp,
@@ -1144,7 +1158,7 @@ MODULE_SCOPE void TclPushVarName(Tcl_Interp *interp,
int flags, int *localIndexPtr,
int *isScalarPtr);
MODULE_SCOPE void TclReleaseLiteral(Tcl_Interp *interp, Tcl_Obj *objPtr);
MODULE_SCOPE void TclInvalidateCmdLiteral(Tcl_Interp *interp,
MODULE_SCOPE void TclInvalidateCmdLiteral(Tcl_Interp *interp,
const char *name, Namespace *nsPtr);
MODULE_SCOPE int TclSingleOpCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
@@ -1165,12 +1179,15 @@ MODULE_SCOPE void TclVerifyLocalLiteralTable(CompileEnv *envPtr);
MODULE_SCOPE int TclWordKnownAtCompileTime(Tcl_Token *tokenPtr,
Tcl_Obj *valuePtr);
MODULE_SCOPE void TclLogCommandInfo(Tcl_Interp *interp,
const char *script,
const char *command, int length,
const unsigned char *pc, Tcl_Obj **tosPtr);
const char *script, const char *command,
int length, const unsigned char *pc,
Tcl_Obj **tosPtr);
MODULE_SCOPE Tcl_Obj *TclGetInnerContext(Tcl_Interp *interp,
const unsigned char *pc, Tcl_Obj **tosPtr);
const unsigned char *pc, Tcl_Obj **tosPtr);
MODULE_SCOPE Tcl_Obj *TclNewInstNameObj(unsigned char inst);
MODULE_SCOPE int TclPushProcCallFrame(ClientData clientData,
register Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[], int isLambda);
/*
@@ -1387,18 +1404,6 @@ MODULE_SCOPE Tcl_Obj *TclNewInstNameObj(unsigned char inst);
} \
} while (0)
/*
* If the expr compiler finished with TRY_CONVERT, macro to remove it when the
* job is done by the following instruction.
*/
#define TclClearNumConversion(envPtr) \
do { \
if (*(envPtr->codeNext - 1) == INST_TRY_CVT_TO_NUMERIC) { \
envPtr->codeNext--; \
} \
} while (0)
/*
* Macros to update a (signed or unsigned) integer starting at a pointer. The
* two variants depend on the number of bytes. The ANSI C "prototypes" for
@@ -1642,7 +1647,7 @@ MODULE_SCOPE Tcl_Obj *TclNewInstNameObj(unsigned char inst);
#define PushVarNameWord(i,v,e,f,l,sc,word) \
SetLineInformation(word); \
TclPushVarName(i,v,e,f,l,sc)
TclPushVarName(i,v,e,f,l,sc)
/*
* Often want to issue one of two versions of an instruction based on whether
@@ -1664,11 +1669,9 @@ MODULE_SCOPE Tcl_Obj *TclNewInstNameObj(unsigned char inst);
#define AnonymousLocal(envPtr) \
(TclFindCompiledLocal(NULL, /*nameChars*/ 0, /*create*/ 1, (envPtr)))
#define LocalScalar(chars,len,envPtr) \
(!TclIsLocalScalar((chars), (len)) ? -1 : \
TclFindCompiledLocal((chars), (len), /*create*/ 1, (envPtr)))
TclLocalScalar(chars, len, envPtr)
#define LocalScalarFromToken(tokenPtr,envPtr) \
((tokenPtr)->type != TCL_TOKEN_SIMPLE_WORD ? -1 : \
LocalScalar((tokenPtr)[1].start, (tokenPtr)[1].size, (envPtr)))
TclLocalScalarFromToken(tokenPtr, envPtr)
/*
* Flags bits used by TclPushVarName.
+11 -15
View File
@@ -48,7 +48,7 @@ EXTERN CONST84_RETURN char * Tcl_PkgRequireEx(Tcl_Interp *interp,
const char *name, const char *version,
int exact, void *clientDataPtr);
/* 2 */
EXTERN void Tcl_Panic(const char *format, ...) TCL_FORMAT_PRINTF(1, 2);
EXTERN TCL_NORETURN void Tcl_Panic(const char *format, ...) TCL_FORMAT_PRINTF(1, 2);
/* 3 */
EXTERN char * Tcl_Alloc(unsigned int size);
/* 4 */
@@ -417,7 +417,7 @@ EXTERN int Tcl_EvalObj(Tcl_Interp *interp, Tcl_Obj *objPtr);
EXTERN void Tcl_EventuallyFree(ClientData clientData,
Tcl_FreeProc *freeProc);
/* 133 */
EXTERN void Tcl_Exit(int status);
EXTERN TCL_NORETURN void Tcl_Exit(int status);
/* 134 */
EXTERN int Tcl_ExposeCommand(Tcl_Interp *interp,
const char *hiddenCmdToken,
@@ -686,7 +686,8 @@ EXTERN void Tcl_SetErrorCode(Tcl_Interp *interp, ...);
/* 229 */
EXTERN void Tcl_SetMaxBlockTime(const Tcl_Time *timePtr);
/* 230 */
EXTERN void Tcl_SetPanicProc(Tcl_PanicProc *panicProc);
EXTERN void Tcl_SetPanicProc(
TCL_NORETURN1 Tcl_PanicProc *panicProc);
/* 231 */
EXTERN int Tcl_SetRecursionLimit(Tcl_Interp *interp, int depth);
/* 232 */
@@ -835,7 +836,7 @@ EXTERN int Tcl_VarEvalVA(Tcl_Interp *interp, va_list argList);
/* 277 */
EXTERN Tcl_Pid Tcl_WaitPid(Tcl_Pid pid, int *statPtr, int options);
/* 278 */
EXTERN void Tcl_PanicVA(const char *format, va_list argList);
EXTERN TCL_NORETURN void Tcl_PanicVA(const char *format, va_list argList);
/* 279 */
EXTERN void Tcl_GetVersion(int *major, int *minor,
int *patchLevel, int *type);
@@ -1499,7 +1500,7 @@ EXTERN void Tcl_GetCommandFullName(Tcl_Interp *interp,
EXTERN int Tcl_FSEvalFileEx(Tcl_Interp *interp,
Tcl_Obj *fileName, const char *encodingName);
/* 519 */
EXTERN Tcl_ExitProc * Tcl_SetExitProc(Tcl_ExitProc *proc);
EXTERN Tcl_ExitProc * Tcl_SetExitProc(TCL_NORETURN1 Tcl_ExitProc *proc);
/* 520 */
EXTERN void Tcl_LimitAddHandler(Tcl_Interp *interp, int type,
Tcl_LimitHandlerProc *handlerProc,
@@ -1815,8 +1816,6 @@ EXTERN int Tcl_FSUnloadFile(Tcl_Interp *interp,
EXTERN void Tcl_ZlibStreamSetCompressionDictionary(
Tcl_ZlibStream zhandle,
Tcl_Obj *compressionDictionaryObj);
/* 631 */
EXTERN int Tcl_Zvfs_Boot(Tcl_Interp *interp);
typedef struct {
const struct TclPlatStubs *tclPlatStubs;
@@ -1830,7 +1829,7 @@ typedef struct TclStubs {
int (*tcl_PkgProvideEx) (Tcl_Interp *interp, const char *name, const char *version, const void *clientData); /* 0 */
CONST84_RETURN char * (*tcl_PkgRequireEx) (Tcl_Interp *interp, const char *name, const char *version, int exact, void *clientDataPtr); /* 1 */
void (*tcl_Panic) (const char *format, ...) TCL_FORMAT_PRINTF(1, 2); /* 2 */
TCL_NORETURN1 void (*tcl_Panic) (const char *format, ...) TCL_FORMAT_PRINTF(1, 2); /* 2 */
char * (*tcl_Alloc) (unsigned int size); /* 3 */
void (*tcl_Free) (char *ptr); /* 4 */
char * (*tcl_Realloc) (char *ptr, unsigned int size); /* 5 */
@@ -1977,7 +1976,7 @@ typedef struct TclStubs {
int (*tcl_EvalFile) (Tcl_Interp *interp, const char *fileName); /* 130 */
int (*tcl_EvalObj) (Tcl_Interp *interp, Tcl_Obj *objPtr); /* 131 */
void (*tcl_EventuallyFree) (ClientData clientData, Tcl_FreeProc *freeProc); /* 132 */
void (*tcl_Exit) (int status); /* 133 */
TCL_NORETURN1 void (*tcl_Exit) (int status); /* 133 */
int (*tcl_ExposeCommand) (Tcl_Interp *interp, const char *hiddenCmdToken, const char *cmdName); /* 134 */
int (*tcl_ExprBoolean) (Tcl_Interp *interp, const char *expr, int *ptr); /* 135 */
int (*tcl_ExprBooleanObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *ptr); /* 136 */
@@ -2082,7 +2081,7 @@ typedef struct TclStubs {
void (*tcl_SetErrno) (int err); /* 227 */
void (*tcl_SetErrorCode) (Tcl_Interp *interp, ...); /* 228 */
void (*tcl_SetMaxBlockTime) (const Tcl_Time *timePtr); /* 229 */
void (*tcl_SetPanicProc) (Tcl_PanicProc *panicProc); /* 230 */
void (*tcl_SetPanicProc) (TCL_NORETURN1 Tcl_PanicProc *panicProc); /* 230 */
int (*tcl_SetRecursionLimit) (Tcl_Interp *interp, int depth); /* 231 */
void (*tcl_SetResult) (Tcl_Interp *interp, char *result, Tcl_FreeProc *freeProc); /* 232 */
int (*tcl_SetServiceMode) (int mode); /* 233 */
@@ -2130,7 +2129,7 @@ typedef struct TclStubs {
void (*tcl_SetErrorCodeVA) (Tcl_Interp *interp, va_list argList); /* 275 */
int (*tcl_VarEvalVA) (Tcl_Interp *interp, va_list argList); /* 276 */
Tcl_Pid (*tcl_WaitPid) (Tcl_Pid pid, int *statPtr, int options); /* 277 */
void (*tcl_PanicVA) (const char *format, va_list argList); /* 278 */
TCL_NORETURN1 void (*tcl_PanicVA) (const char *format, va_list argList); /* 278 */
void (*tcl_GetVersion) (int *major, int *minor, int *patchLevel, int *type); /* 279 */
void (*tcl_InitMemory) (Tcl_Interp *interp); /* 280 */
Tcl_Channel (*tcl_StackChannel) (Tcl_Interp *interp, const Tcl_ChannelType *typePtr, ClientData instanceData, int mask, Tcl_Channel prevChan); /* 281 */
@@ -2371,7 +2370,7 @@ typedef struct TclStubs {
Tcl_Command (*tcl_GetCommandFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr); /* 516 */
void (*tcl_GetCommandFullName) (Tcl_Interp *interp, Tcl_Command command, Tcl_Obj *objPtr); /* 517 */
int (*tcl_FSEvalFileEx) (Tcl_Interp *interp, Tcl_Obj *fileName, const char *encodingName); /* 518 */
Tcl_ExitProc * (*tcl_SetExitProc) (Tcl_ExitProc *proc); /* 519 */
Tcl_ExitProc * (*tcl_SetExitProc) (TCL_NORETURN1 Tcl_ExitProc *proc); /* 519 */
void (*tcl_LimitAddHandler) (Tcl_Interp *interp, int type, Tcl_LimitHandlerProc *handlerProc, ClientData clientData, Tcl_LimitHandlerDeleteProc *deleteProc); /* 520 */
void (*tcl_LimitRemoveHandler) (Tcl_Interp *interp, int type, Tcl_LimitHandlerProc *handlerProc, ClientData clientData); /* 521 */
int (*tcl_LimitReady) (Tcl_Interp *interp); /* 522 */
@@ -2483,7 +2482,6 @@ typedef struct TclStubs {
void * (*tcl_FindSymbol) (Tcl_Interp *interp, Tcl_LoadHandle handle, const char *symbol); /* 628 */
int (*tcl_FSUnloadFile) (Tcl_Interp *interp, Tcl_LoadHandle handlePtr); /* 629 */
void (*tcl_ZlibStreamSetCompressionDictionary) (Tcl_ZlibStream zhandle, Tcl_Obj *compressionDictionaryObj); /* 630 */
int (*tcl_Zvfs_Boot) (Tcl_Interp *interp); /* 631 */
} TclStubs;
extern const TclStubs *tclStubsPtr;
@@ -3776,8 +3774,6 @@ extern const TclStubs *tclStubsPtr;
(tclStubsPtr->tcl_FSUnloadFile) /* 629 */
#define Tcl_ZlibStreamSetCompressionDictionary \
(tclStubsPtr->tcl_ZlibStreamSetCompressionDictionary) /* 630 */
#define Tcl_Zvfs_Boot \
(tclStubsPtr->tcl_Zvfs_Boot) /* 631 */
#endif /* defined(USE_TCL_STUBS) */
+3 -3
View File
@@ -631,7 +631,7 @@ SetDictFromAny(
}
for (i=0 ; i<objc ; i+=2) {
/* Store key and value in the hash table we're building. */
hPtr = CreateChainEntry(dict, objv[i], &isNew);
if (!isNew) {
@@ -3051,14 +3051,14 @@ DictFilterCmd(
Tcl_IncrRefCount(valueObj);
if (Tcl_ObjSetVar2(interp, keyVarObj, NULL, keyObj,
TCL_LEAVE_ERR_MSG) == NULL) {
Tcl_AddErrorInfo(interp,
Tcl_AddErrorInfo(interp,
"\n (\"dict filter\" filter script key variable)");
result = TCL_ERROR;
goto abnormalResult;
}
if (Tcl_ObjSetVar2(interp, valueVarObj, NULL, valueObj,
TCL_LEAVE_ERR_MSG) == NULL) {
Tcl_AddErrorInfo(interp,
Tcl_AddErrorInfo(interp,
"\n (\"dict filter\" filter script value variable)");
result = TCL_ERROR;
goto abnormalResult;
File diff suppressed because it is too large Load Diff
+89 -28
View File
@@ -180,9 +180,9 @@ TCL_DECLARE_MUTEX(encodingMutex)
* the system encoding will be used to perform the conversion.
*/
static Tcl_Encoding defaultEncoding;
static Tcl_Encoding systemEncoding;
Tcl_Encoding tclIdentityEncoding;
static Tcl_Encoding defaultEncoding = NULL;
static Tcl_Encoding systemEncoding = NULL;
Tcl_Encoding tclIdentityEncoding = NULL;
/*
* The following variable is used in the sparse matrix code for a
@@ -652,7 +652,10 @@ TclFinalizeEncodingSubsystem(void)
Tcl_MutexLock(&encodingMutex);
encodingsInitialized = 0;
FreeEncoding(systemEncoding);
systemEncoding = NULL;
defaultEncoding = NULL;
FreeEncoding(tclIdentityEncoding);
tclIdentityEncoding = NULL;
hPtr = Tcl_FirstHashEntry(&encodingTable, &search);
while (hPtr != NULL) {
@@ -1203,7 +1206,10 @@ Tcl_ExternalToUtf(
* output buffer. */
{
const Encoding *encodingPtr;
int result, srcRead, dstWrote, dstChars;
int result, srcRead, dstWrote, dstChars = 0;
int noTerminate = flags & TCL_ENCODING_NO_TERMINATE;
int charLimited = (flags & TCL_ENCODING_CHAR_LIMIT) && dstCharsPtr;
int maxChars = INT_MAX;
Tcl_EncodingState state;
if (encoding == NULL) {
@@ -1228,19 +1234,40 @@ Tcl_ExternalToUtf(
}
if (dstCharsPtr == NULL) {
dstCharsPtr = &dstChars;
flags &= ~TCL_ENCODING_CHAR_LIMIT;
} else if (charLimited) {
maxChars = *dstCharsPtr;
}
/*
* If there are any null characters in the middle of the buffer, they will
* converted to the UTF-8 null character (\xC080). To get the actual \0 at
* the end of the destination buffer, we need to append it manually.
*/
if (!noTerminate) {
/*
* If there are any null characters in the middle of the buffer,
* they will converted to the UTF-8 null character (\xC080). To get
* the actual \0 at the end of the destination buffer, we need to
* append it manually. First make room for it...
*/
dstLen--;
result = encodingPtr->toUtfProc(encodingPtr->clientData, src, srcLen,
flags, statePtr, dst, dstLen, srcReadPtr, dstWrotePtr,
dstCharsPtr);
dst[*dstWrotePtr] = '\0';
dstLen--;
}
do {
int savedFlags = flags;
Tcl_EncodingState savedState = *statePtr;
result = encodingPtr->toUtfProc(encodingPtr->clientData, src, srcLen,
flags, statePtr, dst, dstLen, srcReadPtr, dstWrotePtr,
dstCharsPtr);
if (*dstCharsPtr <= maxChars) {
break;
}
dstLen = Tcl_UtfAtIndex(dst, maxChars) - 1 - dst + TCL_UTF_MAX;
flags = savedFlags;
*statePtr = savedState;
} while (1);
if (!noTerminate) {
/* ...and then append it */
dst[*dstWrotePtr] = '\0';
}
return result;
}
@@ -1423,7 +1450,7 @@ Tcl_UtfToExternal(
*
* Side effects:
* The absolute pathname for the application is computed and stored to be
* returned later be [info nameofexecutable].
* returned later by [info nameofexecutable].
*
*---------------------------------------------------------------------------
*/
@@ -2104,6 +2131,9 @@ BinaryProc(
if (dstLen < 0) {
dstLen = 0;
}
if ((flags & TCL_ENCODING_CHAR_LIMIT) && srcLen > *dstCharsPtr) {
srcLen = *dstCharsPtr;
}
if (srcLen > dstLen) {
srcLen = dstLen;
result = TCL_CONVERT_NOSPACE;
@@ -2264,7 +2294,7 @@ UtfToUtfProc(
{
const char *srcStart, *srcEnd, *srcClose;
const char *dstStart, *dstEnd;
int result, numChars;
int result, numChars, charLimit = INT_MAX;
Tcl_UniChar ch;
result = TCL_OK;
@@ -2275,11 +2305,14 @@ UtfToUtfProc(
if ((flags & TCL_ENCODING_END) == 0) {
srcClose -= TCL_UTF_MAX;
}
if (flags & TCL_ENCODING_CHAR_LIMIT) {
charLimit = *dstCharsPtr;
}
dstStart = dst;
dstEnd = dst + dstLen - TCL_UTF_MAX;
for (numChars = 0; src < srcEnd; numChars++) {
for (numChars = 0; src < srcEnd && numChars <= charLimit; numChars++) {
if ((src > srcClose) && (!Tcl_UtfCharComplete(src, srcEnd - src))) {
/*
* If there is more string to follow, this will ensure that the
@@ -2301,7 +2334,7 @@ UtfToUtfProc(
*dst++ = *src++;
} else if (pureNullMode == 1 && UCHAR(*src) == 0xc0 &&
UCHAR(*(src+1)) == 0x80) {
(src + 1 < srcEnd) && UCHAR(*(src+1)) == 0x80) {
/*
* Convert 0xc080 to real nulls when we are in output mode.
*/
@@ -2375,9 +2408,12 @@ UnicodeToUtfProc(
{
const char *srcStart, *srcEnd;
const char *dstEnd, *dstStart;
int result, numChars;
int result, numChars, charLimit = INT_MAX;
Tcl_UniChar ch;
if (flags & TCL_ENCODING_CHAR_LIMIT) {
charLimit = *dstCharsPtr;
}
result = TCL_OK;
if ((srcLen % sizeof(Tcl_UniChar)) != 0) {
result = TCL_CONVERT_MULTIBYTE;
@@ -2391,7 +2427,7 @@ UnicodeToUtfProc(
dstStart = dst;
dstEnd = dst + dstLen - TCL_UTF_MAX;
for (numChars = 0; src < srcEnd; numChars++) {
for (numChars = 0; src < srcEnd && numChars <= charLimit; numChars++) {
if (dst > dstEnd) {
result = TCL_CONVERT_NOSPACE;
break;
@@ -2489,21 +2525,34 @@ UtfToUnicodeProc(
if (dst > dstEnd) {
result = TCL_CONVERT_NOSPACE;
break;
}
}
src += TclUtfToUniChar(src, &ch);
/*
* Need to handle this in a way that won't cause misalignment by
* casting dst to a Tcl_UniChar. [Bug 1122671]
* XXX: This hard-codes the assumed size of Tcl_UniChar as 2.
*/
#ifdef WORDS_BIGENDIAN
#if TCL_UTF_MAX > 4
*dst++ = (ch >> 24);
*dst++ = ((ch >> 16) & 0xFF);
*dst++ = ((ch >> 8) & 0xFF);
*dst++ = (ch & 0xFF);
#else
*dst++ = (ch >> 8);
*dst++ = (ch & 0xFF);
#endif
#else
#if TCL_UTF_MAX > 4
*dst++ = (ch & 0xFF);
*dst++ = ((ch >> 8) & 0xFF);
*dst++ = ((ch >> 16) & 0xFF);
*dst++ = (ch >> 24);
#else
*dst++ = (ch & 0xFF);
*dst++ = (ch >> 8);
#endif
#endif
}
*srcReadPtr = src - srcStart;
@@ -2559,12 +2608,15 @@ TableToUtfProc(
{
const char *srcStart, *srcEnd;
const char *dstEnd, *dstStart, *prefixBytes;
int result, byte, numChars;
int result, byte, numChars, charLimit = INT_MAX;
Tcl_UniChar ch;
const unsigned short *const *toUnicode;
const unsigned short *pageZero;
TableEncodingData *dataPtr = clientData;
if (flags & TCL_ENCODING_CHAR_LIMIT) {
charLimit = *dstCharsPtr;
}
srcStart = src;
srcEnd = src + srcLen;
@@ -2576,7 +2628,7 @@ TableToUtfProc(
pageZero = toUnicode[0];
result = TCL_OK;
for (numChars = 0; src < srcEnd; numChars++) {
for (numChars = 0; src < srcEnd && numChars <= charLimit; numChars++) {
if (dst > dstEnd) {
result = TCL_CONVERT_NOSPACE;
break;
@@ -2790,8 +2842,11 @@ Iso88591ToUtfProc(
{
const char *srcStart, *srcEnd;
const char *dstEnd, *dstStart;
int result, numChars;
int result, numChars, charLimit = INT_MAX;
if (flags & TCL_ENCODING_CHAR_LIMIT) {
charLimit = *dstCharsPtr;
}
srcStart = src;
srcEnd = src + srcLen;
@@ -2799,7 +2854,7 @@ Iso88591ToUtfProc(
dstEnd = dst + dstLen - TCL_UTF_MAX;
result = TCL_OK;
for (numChars = 0; src < srcEnd; numChars++) {
for (numChars = 0; src < srcEnd && numChars <= charLimit; numChars++) {
Tcl_UniChar ch;
if (dst > dstEnd) {
@@ -2960,7 +3015,9 @@ TableFreeProc(
*/
ckfree(dataPtr->toUnicode);
dataPtr->toUnicode = NULL;
ckfree(dataPtr->fromUnicode);
dataPtr->fromUnicode = NULL;
ckfree(dataPtr);
}
@@ -3013,9 +3070,12 @@ EscapeToUtfProc(
const char *prefixBytes, *tablePrefixBytes, *srcStart, *srcEnd;
const unsigned short *const *tableToUnicode;
const Encoding *encodingPtr;
int state, result, numChars;
int state, result, numChars, charLimit = INT_MAX;
const char *dstStart, *dstEnd;
if (flags & TCL_ENCODING_CHAR_LIMIT) {
charLimit = *dstCharsPtr;
}
result = TCL_OK;
tablePrefixBytes = NULL; /* lint. */
tableToUnicode = NULL; /* lint. */
@@ -3033,7 +3093,7 @@ EscapeToUtfProc(
state = 0;
}
for (numChars = 0; src < srcEnd; ) {
for (numChars = 0; src < srcEnd && numChars <= charLimit; ) {
int byte, hi, lo, ch;
if (dst > dstEnd) {
@@ -3433,6 +3493,7 @@ EscapeFreeProc(
subTablePtr = dataPtr->subTables;
for (i = 0; i < dataPtr->numSubTables; i++) {
FreeEncoding((Tcl_Encoding) subTablePtr->encodingPtr);
subTablePtr->encodingPtr = NULL;
subTablePtr++;
}
}
+1 -1
View File
@@ -3115,7 +3115,7 @@ TclAttemptCompileProc(
result = cmdPtr->compileProc(interp, parsePtr, cmdPtr, envPtr);
/*
* Undo the shift.
* Undo the shift.
*/
mapPtr->loc[eclIndex].line -= (depth - 1);
+1 -98
View File
@@ -43,11 +43,6 @@ static char * EnvTraceProc(ClientData clientData, Tcl_Interp *interp,
static void ReplaceString(const char *oldStr, char *newStr);
MODULE_SCOPE void TclSetEnv(const char *name, const char *value);
MODULE_SCOPE void TclUnsetEnv(const char *name);
#if defined(__CYGWIN__)
static void TclCygwinPutenv(char *string);
# define putenv TclCygwinPutenv
#endif
/*
*----------------------------------------------------------------------
@@ -444,7 +439,7 @@ TclUnsetEnv(
* that no = should be included, and Windows requires it.
*/
#if defined(_WIN32) || defined(__CYGWIN__)
#if defined(_WIN32)
string = ckalloc(length + 2);
memcpy(string, name, (size_t) length);
string[length] = '=';
@@ -740,98 +735,6 @@ TclFinalizeEnvironment(void)
}
}
#if defined(__CYGWIN__)
/*
* When using cygwin, when an environment variable changes, we need to synch
* with both the cygwin environment (in case the application C code calls
* fork) and the Windows environment (in case the application TCL code calls
* exec, which calls the Windows CreateProcess function).
*/
DLLIMPORT extern void __stdcall SetEnvironmentVariableA(const char*, const char *);
static void
TclCygwinPutenv(
char *str)
{
char *name, *value;
/*
* Get the name and value, so that we can change the environment variable
* for Windows.
*/
name = alloca(strlen(str) + 1);
strcpy(name, str);
for (value=name ; *value!='=' && *value!='\0' ; ++value) {
/* Empty body */
}
if (*value == '\0') {
/* Can't happen. */
return;
}
*(value++) = '\0';
if (*value == '\0') {
value = NULL;
}
/*
* Set the cygwin environment variable.
*/
#undef putenv
if (value == NULL) {
unsetenv(name);
} else {
putenv(str);
}
/*
* Before changing the environment variable in Windows, if this is PATH,
* we need to convert the value back to a Windows style path.
*
* FIXME: The calling program may know it is running under windows, and
* may have set the path to a Windows path, or, worse, appended or
* prepended a Windows path to PATH.
*/
if (strcmp(name, "PATH") != 0) {
/*
* If this is Path, eliminate any PATH variable, to prevent any
* confusion.
*/
if (strcmp(name, "Path") == 0) {
SetEnvironmentVariableA("PATH", NULL);
unsetenv("PATH");
}
SetEnvironmentVariableA(name, value);
} else {
char *buf;
/*
* Eliminate any Path variable, to prevent any confusion.
*/
SetEnvironmentVariableA("Path", NULL);
unsetenv("Path");
if (value == NULL) {
buf = NULL;
} else {
int size;
size = cygwin_conv_path_list(0, value, NULL, 0);
buf = alloca(size + 1);
cygwin_conv_path_list(0, value, buf, size);
}
SetEnvironmentVariableA(name, buf);
}
}
#endif /* __CYGWIN__ */
/*
* Local Variables:
* mode: c
+41 -36
View File
@@ -89,7 +89,7 @@ static int subsystemsInitialized = 0;
* non-NULL value.
*/
static Tcl_ExitProc *appExitPtr = NULL;
static TCL_NORETURN1 Tcl_ExitProc *appExitPtr = NULL;
typedef struct ThreadSpecificData {
ExitHandler *firstExitPtr; /* First in list of all exit handlers for this
@@ -119,6 +119,7 @@ static char * VwaitVarProc(ClientData clientData,
Tcl_Interp *interp, const char *name1,
const char *name2, int flags);
static void InvokeExitHandlers(void);
static void FinalizeThread(int quick);
/*
*----------------------------------------------------------------------
@@ -262,7 +263,7 @@ HandleBgErrors(
if (errChannel != NULL) {
Tcl_Obj *options = Tcl_GetReturnOptions(interp, code);
Tcl_Obj *keyPtr, *valuePtr;
Tcl_Obj *keyPtr, *valuePtr = NULL;
TclNewLiteralStringObj(keyPtr, "-errorinfo");
Tcl_IncrRefCount(keyPtr);
@@ -314,7 +315,7 @@ TclDefaultBgErrorHandlerObjCmd(
{
Tcl_Obj *keyPtr, *valuePtr;
Tcl_Obj *tempObjv[2];
int code, level;
int result, code, level;
Tcl_InterpState saved;
if (objc != 3) {
@@ -328,9 +329,9 @@ TclDefaultBgErrorHandlerObjCmd(
TclNewLiteralStringObj(keyPtr, "-level");
Tcl_IncrRefCount(keyPtr);
Tcl_DictObjGet(NULL, objv[2], keyPtr, &valuePtr);
result = Tcl_DictObjGet(NULL, objv[2], keyPtr, &valuePtr);
Tcl_DecrRefCount(keyPtr);
if (valuePtr == NULL) {
if (result != TCL_OK || valuePtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"missing return option \"-level\"", -1));
Tcl_SetErrorCode(interp, "TCL", "ARGUMENT", "MISSING", NULL);
@@ -341,9 +342,9 @@ TclDefaultBgErrorHandlerObjCmd(
}
TclNewLiteralStringObj(keyPtr, "-code");
Tcl_IncrRefCount(keyPtr);
Tcl_DictObjGet(NULL, objv[2], keyPtr, &valuePtr);
result = Tcl_DictObjGet(NULL, objv[2], keyPtr, &valuePtr);
Tcl_DecrRefCount(keyPtr);
if (valuePtr == NULL) {
if (result != TCL_OK || valuePtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"missing return option \"-code\"", -1));
Tcl_SetErrorCode(interp, "TCL", "ARGUMENT", "MISSING", NULL);
@@ -406,17 +407,17 @@ TclDefaultBgErrorHandlerObjCmd(
TclNewLiteralStringObj(keyPtr, "-errorcode");
Tcl_IncrRefCount(keyPtr);
Tcl_DictObjGet(NULL, objv[2], keyPtr, &valuePtr);
result = Tcl_DictObjGet(NULL, objv[2], keyPtr, &valuePtr);
Tcl_DecrRefCount(keyPtr);
if (valuePtr) {
if (result == TCL_OK && valuePtr != NULL) {
Tcl_SetObjErrorCode(interp, valuePtr);
}
TclNewLiteralStringObj(keyPtr, "-errorinfo");
Tcl_IncrRefCount(keyPtr);
Tcl_DictObjGet(NULL, objv[2], keyPtr, &valuePtr);
result = Tcl_DictObjGet(NULL, objv[2], keyPtr, &valuePtr);
Tcl_DecrRefCount(keyPtr);
if (valuePtr) {
if (result == TCL_OK && valuePtr != NULL) {
Tcl_AppendObjToErrorInfo(interp, valuePtr);
}
@@ -856,7 +857,7 @@ Tcl_DeleteThreadExitHandler(
Tcl_ExitProc *
Tcl_SetExitProc(
Tcl_ExitProc *proc) /* New exit handler for app or NULL */
TCL_NORETURN1 Tcl_ExitProc *proc) /* New exit handler for app or NULL */
{
Tcl_ExitProc *prevExitProc;
@@ -891,7 +892,7 @@ Tcl_SetExitProc(
*----------------------------------------------------------------------
*/
static void
InvokeExitHandlers(void)
InvokeExitHandlers(void)
{
ExitHandler *exitPtr;
@@ -932,12 +933,12 @@ InvokeExitHandlers(void)
*----------------------------------------------------------------------
*/
void
TCL_NORETURN void
Tcl_Exit(
int status) /* Exit status for application; typically 0
* for normal return, 1 for error return. */
{
Tcl_ExitProc *currentAppExitPtr;
TCL_NORETURN1 Tcl_ExitProc *currentAppExitPtr;
Tcl_MutexLock(&exitMutex);
currentAppExitPtr = appExitPtr;
@@ -967,23 +968,23 @@ Tcl_Exit(
/*
* Fast and deterministic exit (default behavior)
*/
InvokeExitHandlers();
/*
* Ensure the thread-specific data is initialised as it is used in
* Tcl_FinalizeThread()
*/
(void) TCL_TSD_INIT(&dataKey);
/*
* Now finalize the calling thread only (others are not safely
* reachable). Among other things, this triggers a flush of the
* Tcl_Channels that may have data enqueued.
*/
Tcl_FinalizeThread();
FinalizeThread(/* quick */ 1);
}
TclpExit(status);
Tcl_Panic("OS exit failed!");
@@ -1089,7 +1090,7 @@ Tcl_Finalize(void)
* Invoke exit handlers first.
*/
InvokeExitHandlers();
InvokeExitHandlers();
TclpInitLock();
if (subsystemsInitialized == 0) {
@@ -1183,7 +1184,7 @@ Tcl_Finalize(void)
* This fixes the Tcl Bug #990552.
*/
TclFinalizeThreadData();
TclFinalizeThreadData(/* quick */ 0);
/*
* Now we can free constants for conversions to/from double.
@@ -1268,6 +1269,13 @@ Tcl_Finalize(void)
void
Tcl_FinalizeThread(void)
{
FinalizeThread(/* quick */ 0);
}
void
FinalizeThread(
int quick)
{
ExitHandler *exitPtr;
ThreadSpecificData *tsdPtr;
@@ -1299,20 +1307,17 @@ Tcl_FinalizeThread(void)
TclFinalizeAsync();
TclFinalizeThreadObjects();
}
if (TclFullFinalizationRequested()) { /* useless if we are facing a quick-exit */
/*
* Blow away all thread local storage blocks.
*
* Note that Tcl API allows creation of threads which do not use any Tcl
* interp or other Tcl subsytems. Those threads might, however, use thread
* local storage, so we must unconditionally finalize it.
*
* Fix [Bug #571002]
*/
TclFinalizeThreadData();
}
/*
* Blow away all thread local storage blocks.
*
* Note that Tcl API allows creation of threads which do not use any Tcl
* interp or other Tcl subsytems. Those threads might, however, use thread
* local storage, so we must unconditionally finalize it.
*
* Fix [Bug #571002]
*/
TclFinalizeThreadData(quick);
}
/*
+71 -63
View File
@@ -20,10 +20,7 @@
#include "tclOOInt.h"
#include "tommath.h"
#include <math.h>
#if NRE_ENABLE_ASSERTS
#include <assert.h>
#endif
/*
* Hack to determine whether we may expect IEEE floating point. The hack is
@@ -81,9 +78,7 @@ int tclTraceExec = 0;
static const char *const operatorStrings[] = {
"||", "&&", "|", "^", "&", "==", "!=", "<", ">", "<=", ">=", "<<", ">>",
"+", "-", "*", "/", "%", "+", "-", "~", "!",
"BUILTIN FUNCTION", "FUNCTION",
"", "", "", "", "", "", "", "", "eq", "ne"
"+", "-", "*", "/", "%", "+", "-", "~", "!"
};
/*
@@ -200,14 +195,14 @@ typedef struct TEBCdata {
if (auxObjList) { \
objPtr->length += auxObjList->length; \
} \
objPtr->internalRep.ptrAndLongRep.ptr = auxObjList; \
objPtr->internalRep.twoPtrValue.ptr1 = auxObjList; \
auxObjList = objPtr; \
} while (0)
#define POP_TAUX_OBJ() \
do { \
tmpPtr = auxObjList; \
auxObjList = tmpPtr->internalRep.ptrAndLongRep.ptr; \
auxObjList = tmpPtr->internalRep.twoPtrValue.ptr1; \
Tcl_DecrRefCount(tmpPtr); \
} while (0)
@@ -760,7 +755,7 @@ static Tcl_Obj * ExecuteExtendedUnaryMathOp(int opcode,
Tcl_Obj *valuePtr);
static void FreeExprCodeInternalRep(Tcl_Obj *objPtr);
static ExceptionRange * GetExceptRangeForPc(const unsigned char *pc,
int catchOnly, ByteCode *codePtr);
int searchMode, ByteCode *codePtr);
static const char * GetSrcInfoForPc(const unsigned char *pc,
ByteCode *codePtr, int *lengthPtr,
const unsigned char **pcBeg, int *cmdIdxPtr);
@@ -932,7 +927,6 @@ TclCreateExecEnv(
Tcl_MutexLock(&execMutex);
if (!execInitialized) {
TclInitAuxDataTypeTable();
InitByteCodeExecution(interp);
execInitialized = 1;
}
@@ -1031,7 +1025,6 @@ TclFinalizeExecution(void)
Tcl_MutexLock(&execMutex);
execInitialized = 0;
Tcl_MutexUnlock(&execMutex);
TclFinalizeAuxDataTypeTable();
}
/*
@@ -1140,7 +1133,7 @@ GrowEvaluationStack(
}
needed = growth + moveWords + WALLOCALIGN;
/*
* Check if there is enough room in the next stack (if there is one, it
* should be both empty and the last one!)
@@ -1178,7 +1171,7 @@ GrowEvaluationStack(
#else
newElems = needed;
#endif
newBytes = sizeof(ExecStack) + (newElems-1) * sizeof(Tcl_Obj *);
oldPtr = esPtr;
@@ -1651,8 +1644,7 @@ FreeExprCodeInternalRep(
ByteCode *codePtr = objPtr->internalRep.twoPtrValue.ptr1;
objPtr->typePtr = NULL;
codePtr->refCount--;
if (codePtr->refCount <= 0) {
if (codePtr->refCount-- <= 1) {
TclCleanupByteCode(codePtr);
}
}
@@ -2155,7 +2147,7 @@ TEBCresume(
const unsigned char *pc = data[1];
/* The current program counter. */
unsigned char inst; /* The currently running instruction */
/*
* Transfer variables - needed only between opcodes, but not while
* executing an instruction.
@@ -2360,7 +2352,7 @@ TEBCresume(
*/
inst = *pc;
peepholeStart:
#ifdef TCL_COMPILE_STATS
iPtr->stats.instructionCount[*pc]++;
@@ -2380,7 +2372,7 @@ TEBCresume(
#endif /* TCL_COMPILE_DEBUG */
TCL_DTRACE_INST_NEXT();
if (inst == INST_LOAD_SCALAR1) {
goto instLoadScalar1;
} else if (inst == INST_PUSH1) {
@@ -2392,7 +2384,7 @@ TEBCresume(
/*
* Peephole: do not run INST_START_CMD, just skip it
*/
iPtr->cmdCount += TclGetUInt4AtPtr(pc+5);
if (checkInterp) {
checkInterp = 0;
@@ -2413,7 +2405,7 @@ TEBCresume(
}
goto peepholeStart;
}
switch (inst) {
case INST_SYNTAX:
case INST_RETURN_IMM: {
@@ -2560,7 +2552,7 @@ TEBCresume(
/* TIP #280: Record the last piece of info needed by
* 'TclGetSrcInfoForPc', and push the frame.
*/
bcFramePtr->data.tebc.pc = (char *) pc;
iPtr->cmdFramePtr = bcFramePtr;
@@ -2860,7 +2852,7 @@ TEBCresume(
*/
TclNewObj(objPtr);
objPtr->internalRep.ptrAndLongRep.value = CURR_DEPTH;
objPtr->internalRep.twoPtrValue.ptr2 = INT2PTR(CURR_DEPTH);
objPtr->length = 0;
PUSH_TAUX_OBJ(objPtr);
TRACE(("=> mark depth as %d\n", (int) CURR_DEPTH));
@@ -2874,7 +2866,7 @@ TEBCresume(
*/
CLANG_ASSERT(auxObjList);
objc = CURR_DEPTH - auxObjList->internalRep.ptrAndLongRep.value;
objc = CURR_DEPTH - PTR2INT(auxObjList->internalRep.twoPtrValue.ptr2);
POP_TAUX_OBJ();
#ifdef TCL_COMPILE_DEBUG
/* Ugly abuse! */
@@ -2923,7 +2915,6 @@ TEBCresume(
* stack-allocated parameter, update the stack pointers.
*/
esPtr = iPtr->execEnvPtr->execStackPtr;
TD = (TEBCdata *) (((Tcl_Obj **)TD) + moved);
catchTop += moved;
@@ -2975,7 +2966,7 @@ TEBCresume(
case INST_INVOKE_EXPANDED:
CLANG_ASSERT(auxObjList);
objc = CURR_DEPTH - auxObjList->internalRep.ptrAndLongRep.value;
objc = CURR_DEPTH - PTR2INT(auxObjList->internalRep.twoPtrValue.ptr2);
POP_TAUX_OBJ();
if (objc) {
pcAdjustment = 1;
@@ -3187,8 +3178,8 @@ TEBCresume(
pc += 6;
TEBC_YIELD();
TclMarkTailcall(interp);
TclNRAddCallback(interp, TclClearRootEnsemble, NULL,NULL,NULL,NULL);
TclSkipTailcall(interp);
return TclNREvalObjEx(interp, objPtr, TCL_EVAL_INVOKE, NULL, INT_MIN);
/*
@@ -4184,10 +4175,12 @@ TEBCresume(
if (!TclIsVarUndefined(varPtr)) {
TclDecrRefCount(varPtr->value.objPtr);
TclSetVarUndefined(varPtr);
TclClearVarNamespaceVar(varPtr);
TclCleanupVar(varPtr, arrayPtr);
} else if (flags & TCL_LEAVE_ERR_MSG) {
goto slowUnsetArray;
}
varPtr->value.objPtr = NULL;
TRACE_APPEND(("OK\n"));
NEXT_INST_F(6, 1, 0);
} else if (!varPtr && !(flags & TCL_LEAVE_ERR_MSG)) {
@@ -4948,6 +4941,7 @@ TEBCresume(
pc += pcAdjustment;
TEBC_YIELD();
TclPushTailcallPoint(interp);
oPtr = contextPtr->oPtr;
if (oPtr->flags & FILTER_HANDLING) {
TclNRAddCallback(interp, FinalizeOONextFilter,
@@ -5412,8 +5406,8 @@ TEBCresume(
s1 = (char *) Tcl_GetByteArrayFromObj(valuePtr, &s1len);
s2 = (char *) Tcl_GetByteArrayFromObj(value2Ptr, &s2len);
memCmpFn = memcmp;
} else if (((valuePtr->typePtr == &tclStringType)
&& (value2Ptr->typePtr == &tclStringType))) {
} else if ((valuePtr->typePtr == &tclStringType)
&& (value2Ptr->typePtr == &tclStringType)) {
/*
* Do a unicode-specific comparison if both of the args are of
* String type. If the char length == byte length, we can do a
@@ -5424,7 +5418,9 @@ TEBCresume(
s1len = Tcl_GetCharLength(valuePtr);
s2len = Tcl_GetCharLength(value2Ptr);
if ((s1len == valuePtr->length)
&& (s2len == value2Ptr->length)) {
&& (valuePtr->bytes != NULL)
&& (s2len == value2Ptr->length)
&& (value2Ptr->bytes != NULL)) {
s1 = valuePtr->bytes;
s2 = value2Ptr->bytes;
memCmpFn = memcmp;
@@ -5591,7 +5587,7 @@ TEBCresume(
TclNewObj(objResultPtr);
} else if (TclIsPureByteArray(valuePtr)) {
objResultPtr = Tcl_NewByteArrayObj(
Tcl_GetByteArrayFromObj(valuePtr, &length)+index, 1);
Tcl_GetByteArrayFromObj(valuePtr, NULL)+index, 1);
} else if (valuePtr->bytes && length == valuePtr->length) {
objResultPtr = Tcl_NewStringObj((const char *)
valuePtr->bytes+index, 1);
@@ -5763,7 +5759,7 @@ TEBCresume(
* at this point (post Tcl_GetUnicodeFromObj).
*/
((int *) objResultPtr->internalRep.otherValuePtr)[1] = 0;
((int *) objResultPtr->internalRep.twoPtrValue.ptr1)[1] = 0;
}
Tcl_InvalidateStringRep(objResultPtr);
TclDecrRefCount(value3Ptr);
@@ -5790,7 +5786,7 @@ TEBCresume(
* at this point (post Tcl_GetUnicodeFromObj).
*/
((int *) objResultPtr->internalRep.otherValuePtr)[1] = 0;
((int *) objResultPtr->internalRep.twoPtrValue.ptr1)[1] = 0;
}
Tcl_InvalidateStringRep(valuePtr);
TclDecrRefCount(value3Ptr);
@@ -7111,7 +7107,7 @@ TEBCresume(
*/
TclNewObj(tmpPtr);
tmpPtr->internalRep.otherValuePtr = infoPtr;
tmpPtr->internalRep.twoPtrValue.ptr1 = infoPtr;
PUSH_OBJECT(tmpPtr); /* infoPtr object */
TRACE_APPEND(("jump to loop step\n"));
@@ -7129,7 +7125,7 @@ TEBCresume(
*/
tmpPtr = OBJ_AT_TOS;
infoPtr = tmpPtr->internalRep.otherValuePtr;
infoPtr = tmpPtr->internalRep.twoPtrValue.ptr1;
numLists = infoPtr->numLists;
TRACE(("=> "));
@@ -7213,7 +7209,7 @@ TEBCresume(
case INST_FOREACH_END:
/* THIS INSTRUCTION IS ONLY CALLED AS A BREAK TARGET */
tmpPtr = OBJ_AT_TOS;
infoPtr = tmpPtr->internalRep.otherValuePtr;
infoPtr = tmpPtr->internalRep.twoPtrValue.ptr1;
numLists = infoPtr->numLists;
TRACE(("=> loop terminated\n"));
NEXT_INST_V(1, numLists+2, 0);
@@ -7230,10 +7226,10 @@ TEBCresume(
*/
tmpPtr = OBJ_AT_DEPTH(1);
infoPtr = tmpPtr->internalRep.otherValuePtr;
infoPtr = tmpPtr->internalRep.twoPtrValue.ptr1;
numLists = infoPtr->numLists;
TRACE_APPEND(("=> appending to list at depth %d\n", 3 + numLists));
objPtr = OBJ_AT_DEPTH(3 + numLists);
Tcl_ListObjAppendElement(NULL, objPtr, OBJ_AT_TOS);
NEXT_INST_F(1, 1, 0);
@@ -7953,7 +7949,7 @@ TEBCresume(
}
#endif
if ((result == TCL_CONTINUE) || (result == TCL_BREAK)) {
rangePtr = GetExceptRangeForPc(pc, /*catchOnly*/ 0, codePtr);
rangePtr = GetExceptRangeForPc(pc, result, codePtr);
if (rangePtr == NULL) {
TRACE_APPEND(("no encl. loop or catch, returning %s\n",
StringForResultCode(result)));
@@ -8065,7 +8061,7 @@ TEBCresume(
while (auxObjList) {
if ((catchTop != initCatchTop)
&& (*catchTop > (ptrdiff_t)
auxObjList->internalRep.ptrAndLongRep.value)) {
auxObjList->internalRep.twoPtrValue.ptr2)) {
break;
}
POP_TAUX_OBJ();
@@ -8114,7 +8110,7 @@ TEBCresume(
#endif
goto abnormalReturn;
}
rangePtr = GetExceptRangeForPc(pc, /*catchOnly*/ 1, codePtr);
rangePtr = GetExceptRangeForPc(pc, TCL_ERROR, codePtr);
if (rangePtr == NULL) {
/*
* This is only possible when compiling a [catch] that sends its
@@ -8195,7 +8191,7 @@ TEBCresume(
}
iPtr->cmdFramePtr = bcFramePtr->nextPtr;
if (--codePtr->refCount <= 0) {
if (codePtr->refCount-- <= 1) {
TclCleanupByteCode(codePtr);
}
TclStackFree(interp, TD); /* free my stack */
@@ -8234,6 +8230,7 @@ TEBCresume(
bytes = GetSrcInfoForPc(pc, codePtr, &length, NULL, NULL);
opnd = TclGetUInt4AtPtr(pc+1);
pc += (opnd-1);
assert(bytes);
PUSH_OBJECT(Tcl_NewStringObj(bytes, length));
goto instEvalStk;
}
@@ -8247,6 +8244,7 @@ TEBCresume(
#undef auxObjList
#undef catchTop
#undef TCONST
#undef esPtr
static int
FinalizeOONext(
@@ -9773,7 +9771,7 @@ ValidatePcAndStackTop(
(unsigned) opCode, relativePc);
Tcl_Panic("TclNRExecuteByteCode execution failure: bad opcode");
}
if (checkStack &&
if (checkStack &&
((stackTop < 0) || (stackTop > stackUpperBound))) {
int numChars;
const char *cmd = GetSrcInfoForPc(pc, codePtr, &numChars, NULL, NULL);
@@ -9830,7 +9828,7 @@ IllegalExprOperandType(
if (opcode == INST_EXPON) {
operator = "**";
} else if (opcode <= INST_STR_NEQ) {
} else if (opcode <= INST_LNOT) {
operator = operatorStrings[opcode - INST_LOR];
}
@@ -9899,7 +9897,11 @@ TclGetSourceFromFrame(
cfPtr->cmd = GetSrcInfoForPc((unsigned char *)
cfPtr->data.tebc.pc, codePtr, &cfPtr->len, NULL, NULL);
}
cfPtr->cmdObj = Tcl_NewStringObj(cfPtr->cmd, cfPtr->len);
if (cfPtr->cmd) {
cfPtr->cmdObj = Tcl_NewStringObj(cfPtr->cmd, cfPtr->len);
} else {
cfPtr->cmdObj = Tcl_NewListObj(objc, objv);
}
Tcl_IncrRefCount(cfPtr->cmdObj);
}
return cfPtr->cmdObj;
@@ -9981,7 +9983,7 @@ GetSrcInfoForPc(
* where the current instruction starts.
* If NULL; no pointer is stored. */
int *cmdIdxPtr) /* If non-NULL, the location where the index
* of the command containing the pc should
* of the command containing the pc should
* be stored. */
{
register int pcOffset = (pc - codePtr->codeStart);
@@ -9994,10 +9996,8 @@ GetSrcInfoForPc(
int bestSrcLength = -1; /* Initialized to avoid compiler warning. */
int bestCmdIdx = -1;
if ((pcOffset < 0) || (pcOffset >= codePtr->numCodeBytes)) {
if (pcBeg != NULL) *pcBeg = NULL;
return NULL;
}
/* The pc must point within the bytecode */
assert ((pcOffset >= 0) && (pcOffset < codePtr->numCodeBytes));
/*
* Decode the code and source offset and length for each command. The
@@ -10106,13 +10106,14 @@ GetSrcInfoForPc(
* ExceptionRange.
*
* Results:
* In the normal case, catchOnly is 0 (false) and this procedure returns
* a pointer to the most closely enclosing ExceptionRange structure
* regardless of whether it is a loop or catch exception range. This is
* appropriate when processing a TCL_BREAK or TCL_CONTINUE, which will be
* "handled" either by a loop exception range or a closer catch range. If
* catchOnly is nonzero, this procedure ignores loop exception ranges and
* returns a pointer to the closest catch range. If no matching
* If the searchMode is TCL_ERROR, this procedure ignores loop exception
* ranges and returns a pointer to the closest catch range. If the
* searchMode is TCL_BREAK, this procedure returns a pointer to the most
* closely enclosing ExceptionRange regardless of whether it is a loop or
* catch exception range. If the searchMode is TCL_CONTINUE, this
* procedure returns a pointer to the most closely enclosing
* ExceptionRange (of any type) skipping only loop exception ranges if
* they don't have a sensible continueOffset defined. If no matching
* ExceptionRange is found that encloses pc, a NULL is returned.
*
* Side effects:
@@ -10123,14 +10124,16 @@ GetSrcInfoForPc(
static ExceptionRange *
GetExceptRangeForPc(
const unsigned char *pc, /* The program counter value for which to
const unsigned char *pc, /* The program counter value for which to
* search for a closest enclosing exception
* range. This points to a bytecode
* instruction in codePtr's code. */
int catchOnly, /* If 0, consider either loop or catch
* ExceptionRanges in search. If nonzero
int searchMode, /* If TCL_BREAK, consider either loop or catch
* ExceptionRanges in search. If TCL_ERROR
* consider only catch ranges (and ignore any
* closer loop ranges). */
* closer loop ranges). If TCL_CONTINUE, look
* for loop ranges that define a continue
* point or a catch range. */
ByteCode *codePtr) /* Points to the ByteCode in which to search
* for the enclosing ExceptionRange. */
{
@@ -10156,8 +10159,13 @@ GetExceptRangeForPc(
start = rangePtr->codeOffset;
if ((start <= pcOffset) &&
(pcOffset < (start + rangePtr->numCodeBytes))) {
if ((!catchOnly)
|| (rangePtr->type == CATCH_EXCEPTION_RANGE)) {
if (rangePtr->type == CATCH_EXCEPTION_RANGE) {
return rangePtr;
}
if (searchMode == TCL_BREAK) {
return rangePtr;
}
if (searchMode == TCL_CONTINUE && rangePtr->continueOffset != -1){
return rangePtr;
}
}
+2 -2
View File
@@ -120,7 +120,7 @@ FileCopyRename(
}
i++;
if ((objc - i) < 2) {
Tcl_WrongNumArgs(interp, 1, objv,
Tcl_WrongNumArgs(interp, 1, objv,
"?-option value ...? source ?source ...? target");
return TCL_ERROR;
}
@@ -735,7 +735,7 @@ CopyRenameOneFile(
errfile = target;
}
/*
/*
* We now need to reset the result, because the above call,
* may have left set it. (Ideally we would prefer not to pass
* an interpreter in above, but the channel IO code used by
+6 -6
View File
@@ -235,9 +235,9 @@ ExtractWinRoot(
if ((path[0] == 'c' || path[0] == 'C')
&& (path[1] == 'o' || path[1] == 'O')) {
if ((path[2] == 'm' || path[2] == 'M')
&& path[3] >= '1' && path[3] <= '4') {
&& path[3] >= '1' && path[3] <= '9') {
/*
* May have match for 'com[1-4]:?', which is a serial port.
* May have match for 'com[1-9]:?', which is a serial port.
*/
if (path[4] == '\0') {
@@ -257,9 +257,9 @@ ExtractWinRoot(
} else if ((path[0] == 'l' || path[0] == 'L')
&& (path[1] == 'p' || path[1] == 'P')
&& (path[2] == 't' || path[2] == 'T')) {
if (path[3] >= '1' && path[3] <= '3') {
if (path[3] >= '1' && path[3] <= '9') {
/*
* May have match for 'lpt[1-3]:?'
* May have match for 'lpt[1-9]:?'
*/
if (path[4] == '\0') {
@@ -821,10 +821,10 @@ Tcl_FSJoinToPath(
return TclJoinPath(2, pair);
} else {
int elemc = objc + 1;
Tcl_Obj *ret, **elemv = ckalloc(elemc*sizeof(Tcl_Obj **));
Tcl_Obj *ret, **elemv = ckalloc(elemc*sizeof(Tcl_Obj *));
elemv[0] = pathPtr;
memcpy(elemv+1, objv, objc*sizeof(Tcl_Obj **));
memcpy(elemv+1, objv, objc*sizeof(Tcl_Obj *));
ret = TclJoinPath(elemc, elemv);
ckfree(elemv);
return ret;
+2 -2
View File
@@ -33,7 +33,7 @@ MODULE_SCOPE void TclFSSetPathDetails(Tcl_Obj *pathPtr,
const Tcl_Filesystem *fsPtr, ClientData clientData);
MODULE_SCOPE Tcl_Obj * TclFSNormalizeAbsolutePath(Tcl_Interp *interp,
Tcl_Obj *pathPtr);
MODULE_SCOPE int TclFSEpoch(void);
MODULE_SCOPE size_t TclFSEpoch(void);
/*
* Private shared variables for use by tclIOUtil.c and tclPathObj.c
@@ -55,7 +55,7 @@ MODULE_SCOPE Tcl_PathType TclFSNonnativePathType(const char *pathPtr,
MODULE_SCOPE Tcl_PathType TclGetPathType(Tcl_Obj *pathPtr,
const Tcl_Filesystem **filesystemPtrPtr,
int *driveNameLengthPtr, Tcl_Obj **driveNameRef);
MODULE_SCOPE int TclFSEpochOk(int filesystemEpoch);
MODULE_SCOPE int TclFSEpochOk(size_t filesystemEpoch);
MODULE_SCOPE int TclFSCwdIsNative(void);
MODULE_SCOPE Tcl_Obj * TclWinVolumeRelativeNormalize(Tcl_Interp *interp,
const char *path, Tcl_Obj **useThisCwdPtr);
+1 -1
View File
@@ -326,7 +326,7 @@ CreateHashEntry(
continue;
}
#endif
if (compareKeysProc((void *) key, hPtr)) {
if (((void *) key == hPtr) || compareKeysProc((void *) key, hPtr)) {
if (newPtr) {
*newPtr = 0;
}
+2 -2
View File
@@ -161,7 +161,7 @@ Tcl_RecordAndEvalObj(
Tcl_Obj *list[3];
/*
* Do recording by eval'ing a tcl history command: history add $cmd.
* Do recording by eval'ing a tcl history command: history add $cmd.
*/
list[0] = histObjsPtr->historyObj;
@@ -175,7 +175,7 @@ Tcl_RecordAndEvalObj(
/*
* One possible failure mode above: exceeding a resource limit.
*/
if (Tcl_LimitExceeded(interp)) {
return TCL_ERROR;
}
+405 -137
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -126,7 +126,7 @@ typedef struct Channel {
*/
typedef struct ChannelState {
const char *channelName; /* The name of the channel instance in Tcl
char *channelName; /* The name of the channel instance in Tcl
* commands. Storage is owned by the generic
* IO code, is dynamically allocated. */
int flags; /* ORed combination of the flags defined
+21 -10
View File
@@ -187,6 +187,7 @@ struct TransformChannelData {
Tcl_Channel self; /* Our own Channel handle. */
int readIsFlushed; /* Flag to note whether in.flushProc was
* called or not. */
int eofPending; /* Flag: EOF seen down, not raised up */
int flags; /* Currently CHANNEL_ASYNC or zero. */
int watchMask; /* Current watch/event/interest mask. */
int mode; /* Mode of parent channel, OR'ed combination
@@ -292,6 +293,7 @@ TclChannelTransform(
Tcl_DStringInit(&ds);
Tcl_GetChannelOption(interp, chan, "-blocking", &ds);
dataPtr->readIsFlushed = 0;
dataPtr->eofPending = 0;
dataPtr->flags = 0;
if (ds.string[0] == '0') {
dataPtr->flags |= CHANNEL_ASYNC;
@@ -624,7 +626,7 @@ TransformInputProc(
if (toRead == 0 || dataPtr->self == NULL) {
/*
* Catch a no-op.
* Catch a no-op. TODO: Is this a panic()?
*/
return 0;
}
@@ -676,6 +678,17 @@ TransformInputProc(
if (toRead <= 0) {
break;
}
if (dataPtr->eofPending) {
/*
* Already saw EOF from downChan; don't ask again.
* NOTE: Could move this up to avoid the last maxRead
* execution. Believe this would still be correct behavior,
* but the test suite tests the whole command callback
* sequence, so leave it unchanged for now.
*/
break;
}
/*
* Get bytes from the underlying channel.
@@ -711,14 +724,7 @@ TransformInputProc(
* on the down channel.
*/
if (dataPtr->readIsFlushed) {
/*
* Already flushed, nothing to do anymore.
*/
break;
}
dataPtr->eofPending = 1;
dataPtr->readIsFlushed = 1;
ExecuteCallback(dataPtr, NULL, A_FLUSH_READ, NULL, 0,
TRANSMIT_IBUF, P_PRESERVE);
@@ -746,8 +752,11 @@ TransformInputProc(
break;
}
} /* while toRead > 0 */
ReleaseData(dataPtr);
if (gotBytes == 0) {
dataPtr->eofPending = 0;
}
ReleaseData(dataPtr);
return gotBytes;
}
@@ -858,6 +867,7 @@ TransformSeekProc(
P_NO_PRESERVE);
ResultClear(&dataPtr->result);
dataPtr->readIsFlushed = 0;
dataPtr->eofPending = 0;
}
ReleaseData(dataPtr);
@@ -931,6 +941,7 @@ TransformWideSeekProc(
P_NO_PRESERVE);
ResultClear(&dataPtr->result);
dataPtr->readIsFlushed = 0;
dataPtr->eofPending = 0;
}
ReleaseData(dataPtr);
+19 -6
View File
@@ -161,6 +161,7 @@ typedef struct {
int mode; /* Mask of R/W mode */
int nonblocking; /* Flag: Channel is blocking or not. */
int readIsDrained; /* Flag: Read buffers are flushed. */
int eofPending; /* Flag: EOF seen down, but not raised up */
int dead; /* Boolean signal that some operations
* should no longer be attempted. */
ResultBuffer result;
@@ -942,7 +943,7 @@ ReflectClose(
Tcl_EventuallyFree(rtPtr,
(Tcl_FreeProc *) FreeReflectedTransform);
return errorCode;
}
}
#endif /* TCL_THREADS */
errorCodeSet = 1;
goto cleanup;
@@ -956,7 +957,7 @@ ReflectClose(
Tcl_EventuallyFree(rtPtr,
(Tcl_FreeProc *) FreeReflectedTransform);
return errorCode;
}
}
#endif /* TCL_THREADS */
errorCodeSet = 1;
goto cleanup;
@@ -1082,6 +1083,10 @@ ReflectInput(
bufObj = Tcl_NewByteArrayObj(NULL, toRead);
Tcl_IncrRefCount(bufObj);
gotBytes = 0;
if (rtPtr->eofPending) {
goto stop;
}
rtPtr->readIsDrained = 0;
while (toRead > 0) {
/*
* Loop until the request is satisfied (or no data available from
@@ -1097,6 +1102,11 @@ ReflectInput(
goto stop;
}
if (rtPtr->eofPending) {
goto stop;
}
/*
* The buffer is exhausted, but the caller wants even more. We now
* have to go to the underlying channel, get more bytes and then
@@ -1165,10 +1175,8 @@ ReflectInput(
* Zero returned from Tcl_ReadRaw() always indicates EOF
* on the down channel.
*/
if (rtPtr->readIsDrained) {
goto stop;
}
rtPtr->eofPending = 1;
/*
* Now this is a bit different. The partial data waiting is
@@ -1211,6 +1219,9 @@ ReflectInput(
} /* while toRead > 0 */
stop:
if (gotBytes == 0) {
rtPtr->eofPending = 0;
}
Tcl_DecrRefCount(bufObj);
Tcl_Release(rtPtr);
return gotBytes;
@@ -1766,6 +1777,7 @@ NewReflectedTransform(
rtPtr->timer = NULL;
rtPtr->mode = 0;
rtPtr->readIsDrained = 0;
rtPtr->eofPending = 0;
rtPtr->nonblocking =
(((Channel *) parentChan)->state->flags & CHANNEL_NONBLOCKING);
rtPtr->dead = 0;
@@ -3318,6 +3330,7 @@ TransformClear(
(void) InvokeTclMethod(rtPtr, "clear", NULL, NULL, NULL);
rtPtr->readIsDrained = 0;
rtPtr->eofPending = 0;
ResultClear(&rtPtr->result);
}
+24 -12
View File
@@ -12,9 +12,26 @@
#include "tclInt.h"
#if defined(_WIN32) && defined(UNICODE)
/* On Windows, we always need the ASCII version. */
# undef gai_strerror
# define gai_strerror gai_strerrorA
/* On Windows, we need to do proper Unicode->UTF-8 conversion. */
typedef struct ThreadSpecificData {
int initialized;
Tcl_DString errorMsg; /* UTF-8 encoded error-message */
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
#undef gai_strerror
static const char *gai_strerror(int code) {
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
if (tsdPtr->initialized) {
Tcl_DStringFree(&tsdPtr->errorMsg);
} else {
tsdPtr->initialized = 1;
}
Tcl_WinTCharToUtf(gai_strerrorW(code), -1, &tsdPtr->errorMsg);
return Tcl_DStringValue(&tsdPtr->errorMsg);
}
#endif
/*
@@ -154,7 +171,7 @@ TclCreateSocketAddress(
char *native = NULL, portbuf[TCL_INTEGER_SPACE], *portstring;
const char *family = NULL;
Tcl_DString ds;
int result, i;
int result;
if (host != NULL) {
native = Tcl_UtfToExternalDString(NULL, host, -1, &ds);
@@ -170,11 +187,11 @@ TclCreateSocketAddress(
TclFormatInt(portbuf, port);
portstring = portbuf;
}
(void) memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_UNSPEC;
/*
/*
* Magic variable to enforce a certain address family - to be superseded
* by a TIP that adds explicit switches to [socket]
*/
@@ -211,7 +228,7 @@ TclCreateSocketAddress(
if (willBind) {
hints.ai_flags |= AI_PASSIVE;
}
}
result = getaddrinfo(native, portstring, &hints, addrlist);
@@ -262,11 +279,6 @@ TclCreateSocketAddress(
*addrlist = v4head;
}
}
i = 0;
for (p = *addrlist; p != NULL; p = p->ai_next) {
i++;
}
return 1;
}
+66 -29
View File
@@ -59,12 +59,12 @@ typedef struct FilesystemRecord {
typedef struct ThreadSpecificData {
int initialized;
int cwdPathEpoch;
int filesystemEpoch;
size_t cwdPathEpoch;
size_t filesystemEpoch;
Tcl_Obj *cwdPathPtr;
ClientData cwdClientData;
FilesystemRecord *filesystemList;
int claims;
size_t claims;
} ThreadSpecificData;
/*
@@ -215,7 +215,7 @@ static FilesystemRecord nativeFilesystemRecord = {
* trigger cache cleanup in all threads.
*/
static int theFilesystemEpoch = 1;
static size_t theFilesystemEpoch = 1;
/*
* Stores the linked list of filesystems. A 1:1 copy of this list is also
@@ -231,7 +231,7 @@ TCL_DECLARE_MUTEX(filesystemMutex)
*/
static Tcl_Obj *cwdPathPtr = NULL;
static int cwdPathEpoch = 0;
static size_t cwdPathEpoch = 0;
static ClientData cwdClientData = NULL;
TCL_DECLARE_MUTEX(cwdMutex)
@@ -645,7 +645,7 @@ FsGetFirstFilesystem(void)
int
TclFSEpochOk(
int filesystemEpoch)
size_t filesystemEpoch)
{
return (filesystemEpoch == 0 || filesystemEpoch == theFilesystemEpoch);
}
@@ -666,7 +666,7 @@ Disclaim(void)
tsdPtr->claims--;
}
int
size_t
TclFSEpoch(void)
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&fsDataKey);
@@ -713,7 +713,9 @@ FsUpdateCwd(
cwdClientData = TclNativeDupInternalRep(clientData);
}
cwdPathEpoch++;
if (++cwdPathEpoch == 0) {
++cwdPathEpoch;
}
tsdPtr->cwdPathEpoch = cwdPathEpoch;
Tcl_MutexUnlock(&cwdMutex);
@@ -790,7 +792,9 @@ TclFinalizeFilesystem(void)
}
fsRecPtr = tmpFsRecPtr;
}
theFilesystemEpoch++;
if (++theFilesystemEpoch == 0) {
++theFilesystemEpoch;
}
filesystemList = NULL;
/*
@@ -823,7 +827,9 @@ void
TclResetFilesystem(void)
{
filesystemList = &nativeFilesystemRecord;
theFilesystemEpoch++;
if (++theFilesystemEpoch == 0) {
++theFilesystemEpoch;
}
#ifdef _WIN32
/*
@@ -908,7 +914,9 @@ Tcl_FSRegister(
* conceivably now belong to different filesystems.
*/
theFilesystemEpoch++;
if (++theFilesystemEpoch == 0) {
++theFilesystemEpoch;
}
Tcl_MutexUnlock(&filesystemMutex);
return TCL_OK;
@@ -973,7 +981,9 @@ Tcl_FSUnregister(
* (which would of course lead to memory exceptions).
*/
theFilesystemEpoch++;
if (++theFilesystemEpoch == 0) {
++theFilesystemEpoch;
}
ckfree(fsRecPtr);
@@ -1304,7 +1314,9 @@ Tcl_FSMountsChanged(
*/
Tcl_MutexLock(&filesystemMutex);
theFilesystemEpoch++;
if (++theFilesystemEpoch == 0) {
++theFilesystemEpoch;
}
Tcl_MutexUnlock(&filesystemMutex);
}
@@ -2890,9 +2902,13 @@ int
Tcl_FSChdir(
Tcl_Obj *pathPtr)
{
const Tcl_Filesystem *fsPtr;
const Tcl_Filesystem *fsPtr, *oldFsPtr = NULL;
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&fsDataKey);
int retVal = -1;
if (tsdPtr->cwdPathPtr != NULL) {
oldFsPtr = Tcl_FSGetFileSystemForPath(tsdPtr->cwdPathPtr);
}
if (Tcl_FSGetNormalizedPath(NULL, pathPtr) == NULL) {
Tcl_SetErrno(ENOENT);
return retVal;
@@ -2992,7 +3008,6 @@ Tcl_FSChdir(
* instead. This should be examined by someone on Unix.
*/
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&fsDataKey);
ClientData cd;
ClientData oldcd = tsdPtr->cwdClientData;
@@ -3009,6 +3024,14 @@ Tcl_FSChdir(
} else {
FsUpdateCwd(normDirName, NULL);
}
/*
* If the filesystem changed between old and new cwd
* force filesystem refresh on path objects.
*/
if (oldFsPtr != NULL && fsPtr != oldFsPtr) {
Tcl_FSMountsChanged(NULL);
}
}
return retVal;
@@ -3150,7 +3173,7 @@ TclSkipUnlink (Tcl_Obj* shlibFile)
*
* Ad 2: This variable can disable/override the AUFS detection, i.e. for
* testing if a newer AUFS does not have the bug any more.
*
*
* Ad 3: This is conditionally compiled in. Condition currently must be set manually.
* This part needs proper tests in the configure(.in).
*/
@@ -3231,7 +3254,9 @@ Tcl_LoadFile(
if (*handlePtr == NULL) {
return TCL_ERROR;
}
Tcl_ResetResult(interp);
if (interp) {
Tcl_ResetResult(interp);
}
goto resolveSymbols;
}
if (Tcl_GetErrno() != EXDEV) {
@@ -3247,9 +3272,11 @@ Tcl_LoadFile(
*/
if (Tcl_FSAccess(pathPtr, R_OK) != 0) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"couldn't load library \"%s\": %s",
Tcl_GetString(pathPtr), Tcl_PosixError(interp)));
if (interp) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"couldn't load library \"%s\": %s",
Tcl_GetString(pathPtr), Tcl_PosixError(interp)));
}
return TCL_ERROR;
}
@@ -3298,7 +3325,9 @@ Tcl_LoadFile(
}
mustCopyToTempAnyway:
Tcl_ResetResult(interp);
if (interp) {
Tcl_ResetResult(interp);
}
#endif /* TCL_LOAD_FROM_MEMORY */
/*
@@ -3322,8 +3351,10 @@ Tcl_LoadFile(
Tcl_FSDeleteFile(copyToPtr);
Tcl_DecrRefCount(copyToPtr);
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"couldn't load from current filesystem", -1));
if (interp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"couldn't load from current filesystem", -1));
}
return TCL_ERROR;
}
@@ -3363,7 +3394,9 @@ Tcl_LoadFile(
* have stored the number of bytes in the result.
*/
Tcl_ResetResult(interp);
if (interp) {
Tcl_ResetResult(interp);
}
retVal = Tcl_LoadFile(interp, copyToPtr, symbols, flags, procPtrs,
&newLoadHandle);
@@ -3395,7 +3428,9 @@ Tcl_LoadFile(
*/
*handlePtr = newLoadHandle;
Tcl_ResetResult(interp);
if (interp) {
Tcl_ResetResult(interp);
}
return TCL_OK;
}
@@ -3456,11 +3491,13 @@ Tcl_LoadFile(
divertedLoadHandle->unloadFileProcPtr = DivertUnloadFile;
*handlePtr = divertedLoadHandle;
Tcl_ResetResult(interp);
if (interp) {
Tcl_ResetResult(interp);
}
return retVal;
resolveSymbols:
/*
/*
* At this point, *handlePtr is already set up to the handle for the
* loaded library. We now try to resolve the symbols.
*/
@@ -3469,7 +3506,7 @@ Tcl_LoadFile(
for (i=0 ; symbols[i] != NULL; i++) {
procPtrs[i] = Tcl_FindSymbol(interp, *handlePtr, symbols[i]);
if (procPtrs[i] == NULL) {
/*
/*
* At least one symbol in the list was not found. Unload the
* file, and report the problem back to the caller.
* (Tcl_FindSymbol should already have left an appropriate
@@ -3489,7 +3526,7 @@ Tcl_LoadFile(
*----------------------------------------------------------------------
*
* DivertFindSymbol --
*
*
* Find a symbol in a shared library loaded by copy-from-VFS.
*
*----------------------------------------------------------------------

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