Compare commits

...
445 Commits
Author SHA1 Message Date
dgp daa36e9a1b Use http 2 instead of http 1 for Safe Base testing. 2017-12-29 17:47:50 +00:00
dgp b0898beca6 Remove http 1.0 tests. 2017-12-29 17:38:10 +00:00
dgp a922e9fd15 Remove http 1.0 files from fossil management. 2017-12-29 16:54:50 +00:00
dgp 6631e46bd3 Remove handling of http 1.0 package files from Makefiles. 2017-12-29 16:49:47 +00:00
jan.nijtmans 4a038240c4 merge core-8-6-branch 2017-12-28 21:15:20 +00:00
jan.nijtmans ad43c617e3 Fix bug introduced in [0dd0d14489258621] (only for TCL_UTF_MAX > 3): If len parameter = -1, returned size includes terminating 0-byte. So, account for that.
Also, fix some comments which were not accurate any more, now that Windows 95/98 is not supported any more.
2017-12-28 21:14:40 +00:00
jan.nijtmans a27cc004d2 merge core-8-6-branch 2017-12-28 18:51:12 +00:00
jan.nijtmans 301f6bcb83 Fix handling of surrogates (when TCL_UTF_MAX > 3) in Tcl_UtfNcmp()/Tcl_UtfNcasecmp()/TclUtfCasecmp(). Backported from core-8-branch, where this was fixed already. 2017-12-28 18:49:24 +00:00
jan.nijtmans 9a7ce78e96 Make Tcl_WinTCharToUtf/Tcl_WinUtfToTChar work when TCL_UTF_MAX > 3, mainly when sizeof(Tcl_UniChar) != 2. 2017-12-28 18:45:16 +00:00
pooryorick 9a9b619c9f TclOO: Remove unneeded name manipulation from TclOOCopyObjectCmd. 2017-12-26 12:27:14 +00:00
apnadkarni 0b3bf9e30d Merged core-8-6-branch: replace ifdef TCLDIR with compare against empty string 2017-12-26 03:32:05 +00:00
apnadkarni 82cd662f00 Safer to compare TCLDIR against "" rather than ifdef as recursive nmakes
can pass TCLDIR as defined but with an empty value.
2017-12-26 03:30:22 +00:00
jan.nijtmans cae732bd8d merge core-8-6-branch (changes file only) 2017-12-23 18:40:21 +00:00
jan.nijtmans f2f7b85f88 merge release 2017-12-23 18:33:36 +00:00
apnadkarni 444ba0a874 Merge nmake rules 1.1 2017-12-23 08:02:20 +00:00
apnadkarni 71df313773 Look for Tcl and Tk import libraries with or without "t" suffix convention
when building extensions. Bump nmake rules version to 1.1 accordingly.
2017-12-23 07:56:49 +00:00
jan.nijtmans 189c6453b4 Change a few (internal) refCount/mask variables to unsigned type. 2017-12-22 15:45:05 +00:00
jan.nijtmans 5a190dd003 Remove use of compiler option "opt:nowin98". Don't use "t" as suffix any more when building extensions (but still use it for Tcl and Tk). 2017-12-21 13:23:38 +00:00
jan.nijtmans 5bcb4bc9a0 merge-mark 2017-12-21 07:50:27 +00:00
pooryorick 28361a2bfe Further fix for issue [ba1419303b4c]: Delete a namespace for an ensemble having a
deletion trace deletes its namespace: segmentation fault.
2017-12-20 18:28:10 +00:00
pooryorick c1f84789ba Fix for issue [ba1419303b4c]: Delete a namespace for an ensemble having a deletion
trace deletes its namespace: segmentation fault.
2017-12-20 18:26:40 +00:00
pooryorick 5e11793221 Further fix for issue [ba1419303b4c]: Delete a namespace for an ensemble having a
deletion trace deletes its namespace: segmentation fault.
2017-12-20 18:25:08 +00:00
pooryorick dc40e6f797 Fix for issue [ba1419303b4c]: Delete a namespace for an ensemble having a deletion
trace deletes its namespace: segmentation fault.
2017-12-20 11:28:25 +00:00
dgp b6f5c15189 [586e71dce4] Exeception handling at level #0 by EvalObjv 2017-12-19 21:00:17 +00:00
dgp 1725b74695 merge 8.6; update changes 2017-12-19 20:53:27 +00:00
dgp e10cd2e0a5 [586e71dce4] Exeception handling at level #0 by EvalObjv 2017-12-19 20:48:52 +00:00
dgp f4cc39572c update changes 2017-12-19 14:46:31 +00:00
jan.nijtmans ee66488c36 Make TclEnsureNamespace() MODULE_SCOPE. Also change some refCount fields from type "int" to "unsigned int" for increased range. 2017-12-19 11:23:13 +00:00
jan.nijtmans f64bba0499 Minor simplification on Cygwin, since we only support Windows NT now 2017-12-19 11:21:33 +00:00
jan.nijtmans dbe18af9ea No need any more to check for "Windows NT" here, since the minimum is XP now. 2017-12-18 14:33:11 +00:00
dgp 9acbab2c0e merge 8.6 2017-12-18 14:06:37 +00:00
jan.nijtmans 52dc6e55e5 merge core-8-6-branch 2017-12-18 13:58:05 +00:00
jan.nijtmans 0fb81cb5dd (cherry-pick): Added assoc, ftype and move as auto_execok shell built-ins on Windows. 2017-12-18 13:56:30 +00:00
jan.nijtmans 03e581e857 merge core-8-6-branch. Remove win/coffbase.txt, which isn't used any more. 2017-12-18 11:47:35 +00:00
jan.nijtmans e0360a8c34 Add win/rules-ext.vc and win/targets.vc to "make dist". Reported by Paul Overmeier. Thanks! 2017-12-18 11:41:31 +00:00
jan.nijtmans aecff8b1e7 Revert a few more (int -> size_t) transitions, which could effect extensions (such as Itcl 3.4) which use internal Tcl header files. Better wait until 9.0 for this.
What we _can_ do is change some (internal) fields to 'unsigned': that doubles the epoch range without further danger. Thanks, Don, for pointing this out!
2017-12-15 21:27:14 +00:00
dgp 67f6f5cdb1 Revert the (int -> size_t) transition of the "cmdEpoch" field of
the struct Command that was part of [ff3f6a12a8d099ef], and related changes.

This change broke the ability of Itcl 3.4 built against Tcl 8.6 headers
to successfully [load] into and operate in a Tcl 8.7 interp.

"Command" is a private struct, and Itcl 3 should have respected that, but
it has not, and changing the size of the cmdEpoch field broke the ability
of Itcl 3 to operate on later fields of the struct, notably the deleteProc,
which it makes extensive use of.

I believe we should keep the change in the Tcl 9 sources.
2017-12-15 16:50:50 +00:00
jan.nijtmans 4fb66d5d55 Mark TclPrecTraceProc() as deprecated, and remove it when compiling with -DTCL_NO_DEPRECATED. See TIP #488 2017-12-15 14:46:11 +00:00
dgp 50bb6253da merge 8.6 2017-12-14 13:32:50 +00:00
jan.nijtmans 556dc3036e Fix (harmless) compiler warning with Visual Studio 2017-12-14 12:02:13 +00:00
apnadkarni 191ea171cb core-8-6-branch merge: Use nmakehlp -L to locate directories 2017-12-13 10:31:02 +00:00
apnadkarni 48549d55b0 Updated nmake system to make use of the new nmakehlp -L option for
locating dependencies.
2017-12-13 10:03:54 +00:00
apnadkarni 137a89f1e2 Add -L option to nmakehlp to locate directories 2017-12-12 17:33:21 +00:00
apnadkarni 8c866ee6be Add -L option to nmakehlp to locate directories 2017-12-12 17:32:21 +00:00
apnadkarni dddf400b7e Merge from core-8-6-branch - install stubs and headers where present 2017-12-11 16:40:30 +00:00
apnadkarni c220b0dcfa Allow standard targets to be selectively disabled.
Automatic install for extension stubs and public headers if present.
Print installation dir, remove useless partial print of preprocessor defines.
2017-12-11 16:26:24 +00:00
jan.nijtmans dfeacc8edb Fix [040586323610be22f8617962377324f4ddc9bc02|0405863236]: wrong field checked in struct pollfd in TclUnixWaitForFile 2017-12-10 14:35:02 +00:00
jan.nijtmans 9ef7f0a940 merge core-8-6-branch 2017-12-09 15:32:46 +00:00
jan.nijtmans 5cddfdcda6 Undo latest change to tcl.rc, since the autoconf-based windows build doesn't know about PRJLIBNAME 2017-12-09 15:31:58 +00:00
apnadkarni 54ae4feac8 TIP477 merge: nmake build reform 2017-12-08 15:27:49 +00:00
apnadkarni a2c5ea2c08 Merge TIP 477 implementation 2017-12-08 13:54:42 +00:00
jan.nijtmans a3daf1a6d1 TIP #487: Stop support for Pre-XP Windows 2017-12-07 12:14:23 +00:00
dgp 6c313a5846 update changes 2017-12-07 02:01:30 +00:00
dgp bbaba520ab changes WIP 2017-12-06 21:59:13 +00:00
dgp a0a62d119d merge 8.6 2017-12-06 21:03:02 +00:00
dgp 7573551ccb Plug memleak recently put into [package require]. 2017-12-06 20:48:12 +00:00
dgp 5d11ad1e8a Plug memleak recently put into [package require]. 2017-12-06 20:46:47 +00:00
dgp cd525c7bb1 Plug memleak recently put into [package require]. 2017-12-06 20:44:32 +00:00
dgp 4644a04ee3 merge 8.6 2017-12-06 20:02:46 +00:00
dgp 0af956fe7e merge 8.6 2017-12-06 19:58:40 +00:00
dgp 9ba4b4f901 [0e4d88b650] Added enough refcounting to stop make valgrind complaints about
"Invalid read".  This is not a complete fix. Things are still broken.
A working system of Namespace lifetime management looks like an 8.7 project.
2017-12-06 19:57:59 +00:00
jan.nijtmans cf3348e41c (cherry-pick from core-8-6-8-rc): Duplicate test names 2017-12-06 16:04:22 +00:00
dgp 7b04f399b0 Duplicate test names 2017-12-06 15:30:27 +00:00
dgp 3aab0c568b Start RC branch for Tcl 8.6.8 2017-12-06 15:27:28 +00:00
dgp 21877b851c Adapt the bytearray accommodation of Tcl_CharLength() for 8.7+. 2017-12-06 13:28:12 +00:00
dgp d7ed325913 [ce3a211dcb] Failed file normalize when tail is empty string. 2017-12-06 13:06:47 +00:00
dgp 07aa7381a9 [ce3a211dcb] Failed file normalize when tail is empty string. 2017-12-06 13:05:51 +00:00
dgp bb1c5fe833 [ce3a211dcb] Failed file normalize when tail is empty string. 2017-12-06 13:02:32 +00:00
dgp 72f0f0b346 [4f6a1ebd64] Stop crash when same value passed to the -map and -subcommands options of ensemble configuration. 2017-12-05 15:52:55 +00:00
dgp f3af86c67e [4f6a1ebd64] Stop crash when same value passed to the -map and -subcommands options of ensemble configuration. 2017-12-05 15:27:21 +00:00
dgp 3eef9fcea1 Factor clearing of ensemble subcommand table into utility routine. 2017-12-05 15:12:05 +00:00
dgp 906cf353b2 [4f6a1ebd64] Stop crash when same value passed to the -map and -subcommands options of ensemble configuration. 2017-12-05 14:57:05 +00:00
dgp 8a44c35e8c Another revised fix, much closer to sebres' patch now. 2017-12-05 14:36:33 +00:00
apnadkarni 3e34d38b2d Use PRJ_PACKAGE_TCLNAME instead of PROJECT when generating TEA based pkgindex 2017-12-05 14:29:47 +00:00
dgp 92f8ce13df [4f6a1ebd64] Different fix for the problem. Re-order the filling of the
subcommand table so there is no longer a conflict where multiple intreps of
a single value are sought. If the mapDict and exportList are the same,
then each key in the mapDict is known to be an element of the exportList
without needing to check.
2017-12-04 18:36:14 +00:00
jan.nijtmans f0d821a83c merge core-8-6-branch 2017-12-01 12:48:26 +00:00
jan.nijtmans b8fbe8c1d3 Fix [4f51e1c5dcf75de22f5907f7b66361e4bcab02e2|4f51e1c5dc]: patch to correct linker flag sequence 2017-12-01 12:47:12 +00:00
jan.nijtmans 1a237e67df Simpler solution for Itcl 3.4 build (compatibilty) problem. Thanks to Don Porter for bringing this to my attention! 2017-12-01 10:38:04 +00:00
dgp db726dc570 [5808081213] Permit all bytearrays (including impure ones) to report length without shimmering 2017-11-30 17:21:12 +00:00
dgp 4bbfdee3db [5808081213] Permit all bytearrays (including impure ones) to report length without shimmering 2017-11-30 17:10:37 +00:00
jan.nijtmans b96b6a46ba merge core-8-branch 2017-11-30 16:08:03 +00:00
jan.nijtmans 0efada5548 Eliminate use of certain unnecessary struct names. Also white-spacing. Nothing functional. 2017-11-30 16:03:01 +00:00
jan.nijtmans 99798b2202 Fix build of test-suite, after previous commit 2017-11-30 15:24:39 +00:00
jan.nijtmans f327b7e9dc merge core-8-6-branch.
Provide compatibility macro's, compensating for the internal stub table change, so Itcl 3.4 builds again. Thanks to Don Porter for bringing this to my attention!
2017-11-30 14:36:16 +00:00
jan.nijtmans d7d31d6041 Don't provide the setFromAnyProc through the invalidRealType objType. This is a Tcl internal type, extensions shouldn't be able to convert their own Tcl_Obj to this. This shouldn't have been exposed to begin with. Tcl itself never calls it this way. 2017-11-30 14:14:01 +00:00
jan.nijtmans 72998869a3 Fix [8e1e31eac0fd6b6c4452bc108a98ab08c6b64588|8e1e31eac0]: lsort treats NUL chars strangely. Also fix various initializations, which only make a difference when TCL_UTF_MAX == 4.
Add new test-cases which demonstrate the fix. For TCL_UTF_MAX == 4, surrogates will now be handled as expected as well when sorting.
2017-11-30 13:14:43 +00:00
pooryorick c47ba70f45 Add TCL_CREATE_NS_IF_UNKNOWN back into Tcl_CreateEnsemble(). 2017-11-29 18:35:51 +00:00
sebres e68b491806 Cherry-picked test-cases from [046a5af026]: fix for issue [4f6a1ebd64]: ensemble: segmentation fault when -subcommand and
-map values are the same object.
2017-11-29 13:59:42 +00:00
jan.nijtmans 4190501ec7 merge core-8-6-branch 2017-11-29 12:28:21 +00:00
jan.nijtmans e87d0bcdf4 Fix Tcl_UtfFindFirst()/Tcl_UtfFindLast(), which were broken by [83c0c569d6]. Not detected, because those functions aren't used anywhere in Tcl.
So, added new test-cases, makeing sure this doesn't happen again.
2017-11-29 12:27:22 +00:00
pooryorick c032f5043e Fix for [6bca38d59b], TclOO segmentation fault cleaning up objects that that
have mixed themselves into themselves.
2017-11-29 12:01:21 +00:00
jan.nijtmans 79b5a0a716 merge core-8-6-branch 2017-11-29 11:05:15 +00:00
jan.nijtmans 4fc9a4c991 Update some functions in tclUtf.c to handle surrogate pairs when TCL_UTF_MAX == 4. Also update documentation to distinguish better between "Tcl_UniChar" and "Unicode character": Those are not necessary the same when TCL_UTF_MAX == 4.
No change when TCL_UTF_MAX == 4 or TCL_UTF_MAX == 6.
2017-11-29 11:04:20 +00:00
pooryorick 8396e878da Fix for issue [6cf568a21b]: Tcl_Eval() causes new segfault (TclOO object
creation by qualified name).
2017-11-28 23:33:14 +00:00
pooryorick fe65a79d19 Minor refactoring of TclOO object reference count booking during object
creation.
2017-11-28 15:43:41 +00:00
pooryorick a8a602d3ff Eliminate some duplicate code in tclOO.c/Tcl_NewObjectInstance(). 2017-11-27 23:30:57 +00:00
pooryorick 2930169517 Streamline TclOO object cleanup routines. 2017-11-27 19:45:40 +00:00
jan.nijtmans d95ab0247a missed some more failing test-cases 2017-11-27 14:11:16 +00:00
jan.nijtmans 20dedcd841 Fix test-cases in safe.test, failing due to changes in min/max math functions. 2017-11-27 13:52:18 +00:00
pooryorick 811ec68434 Add missing parenthesis to an expression in TclEnsureNamespace. 2017-11-25 18:24:10 +00:00
pooryorick c2e98a86d4 merge pyk-command-named-colon 2017-11-25 16:53:59 +00:00
pooryorick 48fb6e2c88 Fix for issue [4f6a1ebd64]: ensemble: segmentation fault when -subcommand and
-map values are the same object.
2017-11-25 16:36:22 +00:00
pooryorick 9b1ecce298 Move return type to its own line. 2017-11-23 18:24:09 +00:00
jan.nijtmans 160a58238a If compiled with -DTCL_NO_DEPRECATED, remove stub entry for TclWinGetPlatformId() 2017-11-23 12:21:35 +00:00
jan.nijtmans dd0e9cf6b1 Remove more pre-XP stuff. 2017-11-23 12:04:33 +00:00
jan.nijtmans 3c23d21835 Re-base "stop-ce" branch to core-8-branch. This is what will be proposed for 8.7 in TIP #487. 2017-11-23 08:30:10 +00:00
pspjuth fac696b394 merge pspjuth-cminmax 2017-11-21 22:46:35 +00:00
jan.nijtmans 9215c2610c Drop Windows CE support, since it doesn't appear to work anyway. 2017-11-21 14:59:04 +00:00
jan.nijtmans a1bc5b8a2b If Tcl is compiled with -DTCL_NO_DEPRECATED, remove a lot of (internal) stub entries which correspond to functions which will be removed in Tcl 9.
This commit should have been part of [7849f573c0e7d758|this] earlier commit. 
No effect when Tcl is not compiled with -DTCL_NO_DEPRECATED.
2017-11-20 12:07:08 +00:00
jan.nijtmans c19490026d Re-base to core-8-branch: This change is fine as-is for Tcl 8.7, I wouldn't recommend it for 8.6 (even though it's only for the changed error-message) 2017-11-20 10:30:02 +00:00
jan.nijtmans bc3e198cba Fix error-message for min/math functions: "to" -> "for", for consistancy with the error-messages for other math functions. 2017-11-20 10:15:59 +00:00
jan.nijtmans b946ce971f Fix [e058307eef73cf21cf6805ad7c778e1024f9eb7d|e058307eef]: Use of values.h breaks build of Tk trunk on macOS 2017-11-20 08:58:39 +00:00
pspjuth c2eeda3f09 Changed math functions min and max to C implementations. 2017-11-19 18:40:13 +00:00
pooryorick 75924256c1 Fix segmentation fault in TclOO that was noted in [16fe1b5807]. Update
coroutine and TclOO object creation routines to use TclCreateObjCommandInNs.
2017-11-19 00:06:51 +00:00
pooryorick 42c80667fd Lift the restriction on command names names that begin with ":". 2017-11-17 23:42:16 +00:00
pooryorick 3c942c50d9 Fix [16fe1b5807]: namespace ensemble command named ":" is mistakenly given the
empty string as its name.
2017-11-17 22:30:06 +00:00
apnadkarni 335305de9c Added back nothreads option. 2017-11-17 15:46:23 +00:00
jan.nijtmans 48047bb120 merge core-8-6-branch 2017-11-17 15:30:02 +00:00
jan.nijtmans b44ffcf5e2 Fix [fab92486a1b05ba6f7cfe8677da95b9efb3beff0|fab92486a1]: Windows error 14 "Out of memory" mapping to Posix EFAULT "Bad address in system call argument" feels wrong 2017-11-17 15:29:07 +00:00
jan.nijtmans ff436137df Fix [fab92486a1b05ba6f7cfe8677da95b9efb3beff0|fab92486a1]: Windows error 14 "Out of memory" mapping to Posix EFAULT "Bad address in system call argument" feels wrong 2017-11-17 15:28:09 +00:00
jan.nijtmans 42236b435f Fix ignore-glob versioned setting (something went wrong in previous merge). Also convert rules-ext.vc and targets.vc to CRLF line-endings. 2017-11-17 11:35:26 +00:00
jan.nijtmans a27501598a merge core-8-6-branch 2017-11-17 11:27:13 +00:00
jan.nijtmans 28017c14e3 TIP #422, Tcl 8.7 part: Mark all *VA functions as deprecated. They will be removed in Tcl 9.0. 2017-11-17 10:23:14 +00:00
jan.nijtmans ac3259b669 Suggested patch for [4f51e1c5dc]: patch to correct linker flag sequence. Same change done for a few other platforms where it might matter. 2017-11-17 08:32:16 +00:00
apnadkarni 5560b9198b Check for existence of targets.vc, not rules.vc to determine nmake support dir. 2017-11-17 07:05:23 +00:00
apnadkarni 51319d2cae Add PRJ_PACKAGE_TCLNAME and other minor changes.
Also:
Change ifdef checks to check for empty string instead.
Quote include paths.
2017-11-17 06:52:48 +00:00
jan.nijtmans 5ff5853a6e merge core-8-6-branch 2017-11-16 08:45:54 +00:00
jan.nijtmans 24d7fa6401 No longer document (even though it's only in an example) that Tcl_SavedResult is a struct, and that the internal representation of an int is stored in the object's internalRep.longValue member. That might no longer be true in the future. 2017-11-16 08:42:32 +00:00
jan.nijtmans 65007a4d02 No longer document (even though it's only in an example) that Tcl_SavedResult is a struct, and that the internal representation of an int is stored in the object's internalRep.longValue member. That might no longer be true in the future. 2017-11-16 08:39:41 +00:00
apnadkarni c4d4363abd Loosen restriction on where rules-ext.vc file is located. 2017-11-15 13:18:00 +00:00
apnadkarni 0197a30845 Include PKGNAMEFLAGS in stubscflags as some extension stubs use it 2017-11-15 11:47:16 +00:00
jan.nijtmans 346cce5745 Remove compat/float.h and related machinery. The last system known where this was needed was SunOS-4, which is not supported by Tcl any more for a long ... long time ....
Also, fix a typo in generic/tclInt.h and remove some end-of-line spacing.
2017-11-15 09:42:07 +00:00
jan.nijtmans e3439b6af2 Change signature of (internal) TclScanElement() function. This saves memory allocation and the possibility for panic's in dict and list handling, requiring 1/4 of memory for internal allocation of temporary storage. No change to external API. 2017-11-15 08:55:18 +00:00
jan.nijtmans 59ebc49f0f Change signature of (internal) TclScanElement() function. This saves memory allocation and the possibility for panic's in dict and list handling, requiring 1/4 of memory for internal allocation of temporary storage. No change to external API. 2017-11-15 08:54:13 +00:00
apnadkarni ca86fd3219 Added default-install-stubs target.
Make presence of nmake support files in extension directory optional
(except for rules-ext.vc). This requires them to only build against
a Tcl with the new nmake build system.
2017-11-15 07:54:08 +00:00
dgp 9f65735813 Repair lost of broken [package prefer] testing. 2017-11-14 17:09:49 +00:00
dgp 2ea108ae28 [5d6de65036] [package require] with [package prefer stable] was not choosing available stable package. 2017-11-14 14:48:21 +00:00
dgp d7b5cde35f [5d6de65036] [package require] with [package prefer stable] was not choosing available stable package. 2017-11-14 14:17:57 +00:00
dgp ba9e81068e [5d6de65036] [package require] with [package prefer stable] was not choosing
available stable package.
2017-11-14 13:36:59 +00:00
aku a7b6d60948 Ticket [5d65e65036]. My fix. Do not skip the second check for stable versions even when the main check fails. Avoided radical changes to the structure (kept single search loop, with selection after). 2017-11-13 18:58:16 +00:00
jan.nijtmans eb2a9484b8 Merge core-8-6-branch 2017-11-13 11:15:44 +00:00
jan.nijtmans a92e1c508f No longer mark Tcl_EvalFile() as obsolete, since it will continue to be supported in Tcl 9.0 2017-11-13 10:51:39 +00:00
jan.nijtmans 0fc6533fcb No longer mark Tcl_EvalFile() as obsolete, since it will continue to be supported in Tcl 9.0 2017-11-13 10:49:25 +00:00
jan.nijtmans 01fd6594cf Add a lot of "deprecation" marks to internal API which will be removed in Tcl 9.0 (see also tcl-9-cleanup branch). Extensions still using this API will get a compiler warning, but everything will continue to work fine for all future 8.x releases. 2017-11-13 08:37:55 +00:00
jan.nijtmans 752cfbe04c merge core-8-6-branch 2017-11-10 08:49:54 +00:00
jan.nijtmans 1ffeaf24ef Make "string split" and "string is (alpha|graph|...)" work as expected with Unicode chars > U+ffff, when Tcl is compiled with TCL_UTF_MAX == 4. No effect when TCL_UTF_MAX == 3 or TCL_UTF_MAX == 6.
Test-case added for "string split".
2017-11-10 08:40:45 +00:00
jan.nijtmans 78374f18a4 merge core-8-6-branch 2017-11-09 12:50:43 +00:00
jan.nijtmans 729fcd5f09 Make "scan %c" and the internal function ExtendUnicodeRepWithString() work as expected for TCL_UTF_MAX == 4 when handling characters > U+ffff. No effect when TCL_UTF_MAX == 3 or TCL_UTF_MAX == 6 2017-11-09 12:48:54 +00:00
jan.nijtmans c59b3f3bc1 For alpha/beta versions of Tcl, stub-enabled extensions are only allowed to run on the EXACT the same Tcl versions as compiled: The stubs might still be in flux, they are not guaranteed to work on future Tcl versions anyway.
Backported from "novem" (which already had this special protection). For final releases (8.7.0) everything works as before.
2017-11-09 12:37:20 +00:00
jan.nijtmans 12d3a7d307 Change "epoch" field for dicts from "int" to "unsigned int". This doubles the number of available epoch's before overflow. Also make 0 the special value in stead of -1, meaning "dict search done". That also means that epoch counting starts with 1. 2017-11-08 09:37:31 +00:00
dgp 5188d1d927 compiler warning 2017-11-08 02:57:58 +00:00
dgp b8bf04f5ec compiler warning 2017-11-08 02:53:57 +00:00
dgp f31af075d0 compiler warning 2017-11-08 02:50:28 +00:00
dgp a2d6ec1119 merge 8.6 2017-11-08 02:26:07 +00:00
dgp 2ba5fab30e Modify TclCreateProc to handle arbitrary argument names, not just ASCII. 2017-11-08 02:25:40 +00:00
dgp f74bde3e62 [3298012] Stop RebuildTable asking ckalloc for more than it can give. 2017-11-08 02:23:46 +00:00
dgp 98c6b22c10 TclOO object allocation: Set classPtr to NULL if it wasn't otherwise set. 2017-11-08 02:21:49 +00:00
dgp be0c5786a0 [3298012] Stop RebuildTable asking ckalloc for more than it can give. 2017-11-08 02:18:25 +00:00
dgp fd61a8e89e Attempted bug fix. 2017-11-07 21:32:04 +00:00
apnadkarni c7530621ad Fix inclusion of custom resource files to match TIP spec 2017-11-07 16:47:35 +00:00
jan.nijtmans d0665d7a12 merge core-8-6-branch 2017-11-07 13:29:28 +00:00
jan.nijtmans ac4fb39a73 Don't use Unicode character \udead in test-cases, because it is an invalid Unicode code-point (lower surrogate). This will cause test-failures with TIP #389. Just use \ud0ad in stead. Also fix some other test-cases which fail for TCL_UTF_MAX == 4. 2017-11-07 13:19:37 +00:00
jan.nijtmans 45808db8dc TIP #422 implementation, Tcl 8.7 part. 2017-11-07 09:08:48 +00:00
jan.nijtmans c06751fdf8 Fix version number of Windows Help file (not sure if it's actually used, but better safe than sorry) 2017-11-06 14:46:49 +00:00
dgp 22719c6596 Test case for Bug 5d65e65036. 2017-11-06 00:10:21 +00:00
jan.nijtmans ded2a79966 update .project file with branch name. Make clear that optparse doesnt work with 8.4 any more 2017-11-05 14:14:23 +00:00
dkf 4030616bbf [0d902eadd6] Ensure that [string first] handles ASCII in Unicode correctly. 2017-11-04 00:44:14 +00:00
dkf b55d5cc57e Fix for the weird [string first] behaviour. 2017-11-04 00:34:48 +00:00
dkf e4356f7d64 Detected bug in [string first] with unicode. Pat Thoyts found it. 2017-11-04 00:25:43 +00:00
dgp 0480b5d79b Revise a few stray packages not yet ready to tolerate a Tcl 9 bump. 2017-11-03 17:02:49 +00:00
dgp 10a9305777 TIP 345 Implementation. 2017-11-03 16:48:44 +00:00
jan.nijtmans d8596e5583 merge core-8-6-branch 2017-11-03 12:59:07 +00:00
jan.nijtmans 5528e1c1a2 Fix [6f2f83cc149e9918884faffefebc8dfa695f4ea0|6f2f83cc14]: tclWinload.c robustness. And fix a minor possible memory leak in TclSetupEnv() as well. Thanks to Christian Werner for both suggestions, backported from Androwish. 2017-11-03 12:57:15 +00:00
jan.nijtmans 785f1059e4 merge core-8-6-branch 2017-11-03 12:15:08 +00:00
jan.nijtmans 274ab123a8 Better versions of TclGetIntFromObj and TclGetIntForIndexM macro's, which give advantage for platforms where longs are not ints (e.g. linux64) 2017-11-03 12:14:01 +00:00
pooryorick d33ee7bc07 Unit test for issue 3c32a3f8bd, Segmentation fault in
TclOO.c/ReleaseClassContents() for a class mixed into one of its instances.
2017-11-01 22:21:50 +00:00
pooryorick 8bb421f959 Fix bug 3c32a3f8bd, segmentation fault in TclOO.c/ReleaseClassContents()
for a class mixed into one of its instances.
2017-11-01 21:05:32 +00:00
dgp 2ff3ecb534 merge trunk 2017-10-30 12:02:48 +00:00
pooryorick e0578530b0 merge bug-fc1409fc91. 2017-10-30 05:25:19 +00:00
pooryorick a79bc3c8ce Fix for issue 9fd5c629c1, TclOO - aborts when a trace on command deletion
deletes the object's namespace.
2017-10-30 05:19:55 +00:00
dgp 30c40c4540 merge 8.6 2017-10-30 03:23:59 +00:00
dgp c5865fcd24 More test rewrites for robust var resolution. 2017-10-30 03:23:28 +00:00
dgp c8342af338 merge 8.6 2017-10-30 03:01:46 +00:00
dgp 1d0751deb7 Revise tests that relied on deprecated variable resolution rules. 2017-10-30 02:55:30 +00:00
apnadkarni 2318b70929 Minor edits 2017-10-28 17:18:58 +00:00
dgp bed6e18d15 merge trunk 2017-10-27 13:12:09 +00:00
dgp c668ed46ec oops 2017-10-27 12:57:45 +00:00
dgp 0a3f9ca6fc oops 2017-10-27 12:57:15 +00:00
dgp 261012ce98 Update tests that were still written on the outdated premise that Tcl's encoding subsystem had to initialize starting in the identity encoding. 2017-10-27 12:51:14 +00:00
dgp 2f8bbbe141 Update tests that were still written on the outdated premise that Tcl's encoding subsystem had to initialize starting in the identity encoding. 2017-10-27 12:50:38 +00:00
dgp 4ab9cb5418 Update tests that were still written on the outdated premise that Tcl's
encoding subsystem had to initialize starting in the identity encoding.
2017-10-27 12:23:28 +00:00
dgp 3888c4fda4 merge mark 2017-10-27 12:04:53 +00:00
jan.nijtmans fa2e7e8949 Fix timeout calculation in epoll-based notifier. Proposed fix for [1a6a36d901dedead248ea96df09d5dc159532652|1a6a36d901]. Patch by Lucio Andrés Illanes Albornoz. Thanks! 2017-10-27 07:26:15 +00:00
apnadkarni c324bb3eff Reworked build command macros (MAKEBINCMD, CCPKGCMD etc.) and purged old comments. 2017-10-26 15:07:16 +00:00
dgp 053a74e0fa Create new testing command [teststringbytes] to probe the things that
otherwise require [encoding convertto identity]. adapt encoding-15.3 to use.
2017-10-26 02:08:27 +00:00
apnadkarni ff1c348970 Updated comments. 2017-10-25 02:59:46 +00:00
dgp 30c6827ee1 Convert remaining tests to use [testbytestring].
encoding-15.3 still needs replacement for [encoding convertto identity].
That is, some testing command to expose objPtr->bytes.
2017-10-25 02:54:24 +00:00
dgp eb2cfa3e6f Repair Tcl_CreateEncoding(); Modernize [testencoding];
Update most tests toying with identity encoding.
2017-10-25 02:23:12 +00:00
dgp 40d9b81e23 Stop using "identity" as an encoding to test basic functionng of the
[encoding] command. "iso8859-1" is another one always available.
2017-10-24 23:30:35 +00:00
dgp 1552384787 Extend Tcl_CreateEncoding() to be able to create an encoding without
registering it when it has no name.  Then use this to create "identity"
encoding without naming it "identity". Then no one can look it up by that name.
2017-10-24 23:16:23 +00:00
dkf 9306fa604c Cherrypick: [fc1409fc91] Method cloning needs to be careful with body representations. 2017-10-24 14:11:16 +00:00
jan.nijtmans d5f679a3f6 Change (internal) refCount field from TclRegexp to type size_t: this allows more references on 64-bit platforms. Remove unused macro "xxx" in regguts.h. Remove superflouous eol-space in oo.test. 2017-10-24 13:56:26 +00:00
Kevin B Kenny e532a0de84 Historical change affecting tests: Detroit did not observe Daylight Saving Time in 1967 2017-10-24 13:32:54 +00:00
Kevin B Kenny 745b43f627 Historical change affecting tests: Detroit did not observe Daylight Saving Time in 1967 2017-10-24 13:30:41 +00:00
Kevin B Kenny f18d453679 Historical change affecting tests: Detroit did not observe Daylight Saving Time in 1967 2017-10-24 13:24:25 +00:00
Kevin B Kenny 2332ac45ca Update to tzdata2017c 2017-10-24 13:18:51 +00:00
dkf 634213a9c8 [fc1409fc91] Method cloning needs to be careful with body representations. 2017-10-24 11:25:29 +00:00
dkf 8e537759cf Added test case. 2017-10-24 11:23:54 +00:00
pooryorick fada619052 [fc1409fc91]: TclOO method with non-literal value for body argument causes segmentation fault 2017-10-24 08:38:17 +00:00
dgp 319b71965b backout initial commit; need more care.
Binary writes internally make use of this encoding.  Need to hide it
instead of destroy it.
2017-10-23 17:58:07 +00:00
José Ignacio Marín 47a0727695 Update TZ info to tzcode2017c. 2017-10-23 17:10:19 +00:00
dgp 45d0977a5c Implementation branch for TIP 345: Kill the "identity" encoding.
This checkin, completely does that.  Bad news is it causes huge failures.
We're still making a lot of use of this encoding, and cannot complete
this TIP until the branch is repaired.
2017-10-23 17:06:57 +00:00
José Ignacio Marín 4407704316 Update TZ info to tzcode2017c. 2017-10-23 16:59:20 +00:00
apnadkarni fe8915122a Eliminate loimpact and tclalloc options. 2017-10-23 13:53:51 +00:00
jan.nijtmans e9b584f81b merge core-8-6-branch 2017-10-23 12:10:42 +00:00
jan.nijtmans cdb25d8946 Fix [b58e6897034fc5292c9d36ba8099d9a835c98172|b58e689703]: Return value of 'Tcl_Flush' 2017-10-23 12:09:48 +00:00
apnadkarni 7db056b75a Fully qualify OUT_DIR and TMP_DIR paths so that the test target can
change directories and not break relative paths to the built extension.
2017-10-21 12:14:25 +00:00
apnadkarni 6f23316c4a Added test and shell targets. 2017-10-20 15:32:22 +00:00
dkf 56d6e9480f [1a56550e96] Ensure that method list introspection finds methods from mixins in all cases. 2017-10-19 09:30:16 +00:00
dkf df974e71f9 Oops; put the code in the wrong place. Mixins have priority when deciding method visibility. 2017-10-19 09:28:16 +00:00
dkf 7393032d5e [1a56550e96] Ensure that method list introspection finds methods from mixins in all cases. 2017-10-19 09:24:12 +00:00
dkf 252f75d8c8 Ensure that method list introspection finds methods from mixins in all cases. Use better approach for preventing excessive iteration. 2017-10-19 09:22:05 +00:00
dkf 69030a86c8 [1a56550e96] Mixins aren't being searched correctly by [info class methods -all] 2017-10-18 18:23:38 +00:00
apnadkarni fa7141288f Update RCFILE to PRJ_RCFILE. 2017-10-18 16:04:13 +00:00
apnadkarni 63a9fcf2e7 Fix resource file compilation when makefile specifies PRJ_RCFILE 2017-10-18 16:03:08 +00:00
apnadkarni b6f90aaf1f Add PRJ_MANIFEST to support manifest generation. 2017-10-17 15:01:56 +00:00
apnadkarni 4ef03a8950 Fixed reversed check for implicit rules 2017-10-16 12:46:53 +00:00
apnadkarni 823edbf0ab Permit application makefile to define RCFILE.
Change PROJECT_REQUIRES_TK to use value instead of ifdef.
Change MAKERESCMD macro not to specify included input files.
2017-10-15 06:58:20 +00:00
dgp 8a910c1a53 Plug some memleaks. 2017-10-13 16:15:52 +00:00
jan.nijtmans e7582d10c6 Eliminate variable which is only used once. And a minor end-of-line space reduction. No functional change. 2017-10-12 15:20:42 +00:00
jan.nijtmans 5064777d16 merge core-8-6-branch 2017-10-09 14:27:31 +00:00
jan.nijtmans 5b74714749 In nmakehlp -v, return non-0 exit code if version is not found. (taken from vc-reform branch) 2017-10-09 14:25:24 +00:00
jan.nijtmans 15a7950c9e In nmakehlp -v, return non-0 exit code if version is not found. (taken from vc-reform branch) 2017-10-09 14:23:39 +00:00
jan.nijtmans c925a86988 Merge core-8-6-branch 2017-10-09 12:54:39 +00:00
jan.nijtmans 75ecb090c6 Add visual-studio related entries to ignore-glob. Taken over from reform-vc branch 2017-10-09 12:53:46 +00:00
jan.nijtmans b8e5e2909e Add visual-studio related entries to ignore-glob. Taken over from reform-vc branch 2017-10-09 12:52:14 +00:00
apnadkarni 0c646bc3d1 Fix RC template dependency to not generate it every time 2017-10-08 16:12:23 +00:00
apnadkarni f4e4349cad Fix htmlhelp generation on 64-bit systems 2017-10-08 14:25:19 +00:00
apnadkarni 9845cc7c9c Add default rc template so extensions do not have to write their own 2017-10-08 13:18:15 +00:00
apnadkarni fdc29e53d3 Was not setting VERSION for extensions. 2017-10-07 17:16:20 +00:00
apnadkarni a0f84e1b73 Fix ignore glob for Visual C++ output directories. 2017-10-07 13:33:13 +00:00
apnadkarni 21379b0cf5 Move standard predefined targets to targets.vc as this allows the master
makefile to modify macros if required before the targets are defined.
2017-10-06 13:38:26 +00:00
apnadkarni 65895760ea Added standard target for generating pkgIndex.tcl.
Added PKGNAMEFLAGS to pass PACKAGE_NAME and PACKAGE_VERSION.
2017-10-05 17:00:39 +00:00
apnadkarni 20730e0afb Added default-pkgindex target and split DISABLE_DEFAULT_TARGETS to
DISABLE_{STANDARD,CLEAN}_TARGETS.
2017-10-05 14:19:50 +00:00
apnadkarni c0295836a8 Add default-* targets 2017-10-04 01:57:51 +00:00
apnadkarni 8c50df7bbf Extract version numbers from TEA files so do not have to be separately defined. 2017-10-03 13:44:49 +00:00
apnadkarni ec0fc7f816 Have nmakehlp return non-0 exit code if version string not located with -V option 2017-10-03 13:41:53 +00:00
jan.nijtmans fd6a064ee7 Merge latest 'const'ification changes from libtommath (develop branch, will be in next release). None of those are used in Tcl. 2017-10-03 09:11:05 +00:00
apnadkarni f5c6b07246 Remove use of any macros used in rules.vc from rules-ext.vc
Added USE_WIDECHAR_API to control usage of Windows wide API's.
2017-10-03 08:06:30 +00:00
apnadkarni 35256f809e Introduce rules-ext.vc file for extensions to select most recent rules.vc 2017-10-02 17:09:56 +00:00
jan.nijtmans 6881a1a274 'const'ify all libtommath functions, will appear in next libtommath version. See: pull request [https://github.com/libtom/libtommath/pull/88|88] 2017-10-02 15:22:27 +00:00
apnadkarni 01201582b7 Fix initialization of _TCLDIR and use MAKE*CMD macros in makefile.vc
Fixed initialization of _TCLDIR when it is not defined by caller when
building an extension. _INSTALLDIR is modified AFTER it is used to
initialize _TCLDIR. However, nmake expands late so we have to init
_TCLDIR relative to the *modified* _INSTALLDIR.
2017-09-30 14:11:08 +00:00
apnadkarni 24b65fbe41 Added MAKEEXTCMD macro.
Fixed couple of syntax errors when building extensions.
2017-09-30 08:34:31 +00:00
apnadkarni 457587f033 Added standard macros LIBDIR and DEMODIR. Also set common Tk related names and paths 2017-09-30 06:20:33 +00:00
apnadkarni 78cf383197 Permit definition of implicit rules and standard targets to be disabled 2017-09-29 14:23:17 +00:00
apnadkarni 71c784c8bc Added implicit rule for compiling resources.
Added Tcl import libraries to link macro.
2017-09-29 12:41:02 +00:00
apnadkarni e4269a7140 Updated for Tk compatibility.
Removed extraneous quotes in macro definitions. Macros should be quoted at 
*use* time, not *definition* time.
Added _nostubs versions of pkgcflags and appcflags.
2017-09-29 06:12:04 +00:00
apnadkarni 3734937878 Add pkgcflags, appcflags and stubscflags to reflect different compilation modes.
Packages compile (at least) three types of objects files - the shared library
extension (e.g. tk86.dll), application programs (e.g. wish) and a static 
stubs library (tkstub86.lib). Thus we need to construct three different sets
of compilation flags accordingly.

Also updated makefile header comments to reflect modern usage.
2017-09-28 12:22:41 +00:00
apnadkarni 07c1c221cb Include rules.vc and nmakehlp.c as part of install.
Work toward not having to keep updating extensions with the latest version
of rules.vc and nmakehlp. Extension makefiles can instead use the 
installed files instead.

Also added some basic sanity checks to rules.vc to warn if extensions are
being compiled with options incompatible with those used to build Tcl.
2017-09-26 12:22:42 +00:00
apnadkarni 246e599142 Eliminate obsolete winhelp style documentation and fix Html Help doc build
to work on 64-bit systems.
2017-09-25 17:35:29 +00:00
apnadkarni f1aa04858d Eliminated /base option on linking as not recommended with ASLR 2017-09-25 16:33:20 +00:00
apnadkarni 301208c889 Unify build commands with MAKE{LIB,DLL,CON,GUI}CMD macros 2017-09-25 16:23:34 +00:00
apnadkarni b5e3779cf2 Move TCLSH and TCLSH_NATIVE macros to rules.vc 2017-09-25 13:45:34 +00:00
apnadkarni 56e2bd0be4 Added project-specific include paths and preprocessor defines. 2017-09-25 10:41:22 +00:00
apnadkarni 34cb030c7b Move clean target to rules.vc to avoid repetition in every extension 2017-09-24 14:25:48 +00:00
apnadkarni a91099b33b Move installation dir macros to rules.vc 2017-09-24 12:13:29 +00:00
apnadkarni ad9a3b8b45 Moved generic compiler and linker flags completely into rules.vc so
extensions do not have to repeat the verbage.

Special case Tk as a Tcl extension and add default for locating Tcl source.

Both Tcl and Tk compile with new rules.
2017-09-24 06:03:34 +00:00
apnadkarni c7e43807bf More refactoring. Moved defines that are Tcl-specific to makefile.vc as
rules.vc is common to extensions. Reworked parsing of STATS and CHECKS.
2017-09-23 07:35:32 +00:00
apnadkarni d8e7cf09b1 First step in complete refactoring.
Breaking up into logical sections with comments.
Fix floating point option selection to be the same on debug and release.
Pick up nmakehlp.c from installed Tcl if available when building extensions.
Mods to allow extensions to use the same exact rules.vc file.
2017-09-22 13:26:14 +00:00
jan.nijtmans b0fe49c36d Make libtommath's "make" work in Tcl environment (for testing). Eliminate internal s_is_power_of_two(), which can better be done inline. Fix tommath.h for _MSC_VER. 2017-09-22 08:48:23 +00:00
apnadkarni a52f0db3e4 Merged core-8-6-branch to pick up 32/64-bit DLL mismatch error message.
Actually already cherrypicked but redoing because that does not show
up on timeline and a full merge recommended on the chat.
2017-09-22 02:17:02 +00:00
apnadkarni 4bf8f43b3a RFE [566a999189] - better error message for 32/64 bit mismatch on load. 2017-09-21 19:05:11 +00:00
apnadkarni d45863129f RFE [566a999189] - better error message for 32/64 bit mismatch on load. 2017-09-21 18:47:45 +00:00
apnadkarni 4f406d752d First cut at making application-independent compile and link flags
common to all extensions defined in a single place - rules.vc -
instead of having each extension cut and paste the same code.
2017-09-20 12:58:59 +00:00
jan.nijtmans 1b28405773 Move fast return from s_is_power_of_two() to mp_div_d(). This saves a function call in the common case where b is not a power of 2. 2017-09-20 09:21:54 +00:00
jan.nijtmans 65703d1f87 Further astyle formatting of libtommath. No functional changes. 2017-09-20 09:07:35 +00:00
apnadkarni 6d85564696 Disable pointer<->int warnings related to cast between different sizes
There are a gadzillion of these due to use of ClientData and clutter up compiler
output increasing chance of a real warning getting lost. So disable them.
Eventually some day, Tcl will be 64-bit clean.
2017-09-19 16:43:19 +00:00
apnadkarni 071f38c482 Eliminated some obsolete checks (Win98, IA64 etc.) to reduce the noise. 2017-09-19 16:07:14 +00:00
apnadkarni b81c66b4c7 Do not permit nothreads in OPTS as sockets, registry and dde require threading. 2017-09-19 15:12:52 +00:00
apnadkarni 0e5d15e072 Fix mapping of VCVERSION to VCVER. The simplistic calculation no longer
holds for new versions of the compiler. Instead directly use the internal
compiler version for these.
2017-09-19 12:50:25 +00:00
apnadkarni 78a20a11b2 Remove /Gs which enables _chkstk on *every* function call. The normal default
behaviour (without the option) checks only local variable space exceeds
page size. This is what Microsoft recommends.

Also moved -O2 to rules.vc file so as to keep all optimization flags 
in one location. 

Removed optimizations switches subsumed by -O2.
2017-09-19 12:10:25 +00:00
apnadkarni 54431f3360 Create new branch named "vc-reform" 2017-09-19 10:49:37 +00:00
jan.nijtmans f75f76c9d4 Finish libtommath's constification work. All done (hopefully). And make sure that C preprocessor directives have the '#' as first character on the line. 2017-09-18 14:38:26 +00:00
jan.nijtmans f5ea63343e Another round of libtommath const'ification. To be submitted to the libtommath folks 2017-09-18 12:53:48 +00:00
jan.nijtmans a708ae2da2 Merge libtommath upstream changes (astyle formatting only). No functional changes. All Tcl-specific modifications are kept. 2017-09-18 08:31:55 +00:00
jan.nijtmans d4e73bcab5 re-format everything through astyle. Taken from libtom/libtommath (pull request [https://github.com/libtom/libtommath/pull/85|85]) 2017-09-15 14:44:00 +00:00
jan.nijtmans 8f339500a2 'const'ify more libtommath functions. All functions in generic/tclTomMath.decls (used by Tcl) are done now. 2017-09-15 13:08:31 +00:00
dgp bf01a303da Move new declarations to more conventional place for tidier merging. 2017-09-14 14:02:12 +00:00
jan.nijtmans 99d940211c Remove some unnecessary #if 0 sections. Fix comments and panic messages. No functional changes. 2017-09-14 08:05:32 +00:00
jan.nijtmans 7b8b406719 Fix [f5da3d30e096a1c3486fbc480a6ece01fcb277a6|f5da3d30e0]: clerical error in comments 2017-09-14 07:42:38 +00:00
jan.nijtmans db3273f346 Fix [f5da3d30e096a1c3486fbc480a6ece01fcb277a6|f5da3d30e0]: clerical error in comments 2017-09-14 07:41:09 +00:00
jan.nijtmans c659b044b1 Make mp_get_long and mp_set_long available to tommath-enabled Tcl extensions. Deprecate the internal TclBNInitBignumFrom* functions, in favor of the official tommath functions with the same purpose. 2017-09-13 10:14:31 +00:00
jan.nijtmans 3e55dbb18c Many 'const' addtions in libtommath where it makes sense. To be submitted back to the libtommath guys. 2017-09-11 10:38:07 +00:00
jan.nijtmans b2446d8d41 Add some more functions from libtommath for availability within Tcl (mainly the 'long long' variants). Add more 'const' keywords there too. 2017-09-08 14:15:13 +00:00
gahr e86e8a501d Be consistent about how I am referred to. 2017-09-08 13:30:29 +00:00
dgp d03a4dcc88 Bump to 8.7a2 to distinguish trunk from 8.7a1 release. 2017-09-08 13:13:15 +00:00
dgp 4ce5b276eb merge release 2017-09-08 12:50:06 +00:00
dgp 877e9d6b11 merge trunk; rc1 2017-09-07 12:59:14 +00:00
jan.nijtmans 413fe66650 Fix use of "long long" (manually) in MSVC 2017-09-06 15:02:24 +00:00
dgp ca70072a99 update changes 2017-09-05 15:38:02 +00:00
dgp d9f2bf1d17 merge trunk 2017-09-05 12:41:10 +00:00
jan.nijtmans c2846c0f5c Merge core-8-6-branch to trunk, especially the 1.6.0 -> 1.6.1 renumbering from msgcat 2017-09-04 14:01:45 +00:00
jan.nijtmans a15279ffd1 Make pkgIndex.tcl from msgcat work for Tcl 9.0 (not really necessary, but for consistancy) 2017-09-04 13:59:04 +00:00
jan.nijtmans b74f59a5b4 merge core-8-6-branch 2017-09-04 12:38:14 +00:00
jan.nijtmans e08c86934d Typo's (Thanks to Gustaf Neumann), nothing functional. 2017-09-04 12:37:04 +00:00
dgp a3dfc55957 [0e4d88b650] Allow command overwrite when deletion callback deletes namespace. 2017-09-02 22:10:59 +00:00
dgp e3f7bc2783 [0e4d88b650] Allow command overwrite when deletion callback deletes namespace. 2017-09-02 22:03:03 +00:00
dgp 564b991088 [0e4d88b650] Allow command overwrite when deletion callback deletes namespace. 2017-09-02 21:48:05 +00:00
dgp 0ff317501d merge 8.5 2017-09-02 21:36:57 +00:00
dgp f42f0060be Add test 2017-09-02 21:14:55 +00:00
dgp 3ec5b35deb Similar fix to Tcl_CreateCommand(). 2017-09-02 20:40:44 +00:00
dgp 7afc6b1c17 Tidy up. 2017-09-02 20:17:26 +00:00
dgp ce58cdff9f [Bug 0e4d88b650] First draft fix. Re-resolve namespace after cmd deletion. 2017-09-02 19:35:22 +00:00
jan.nijtmans 4b9e6d92be Merge core-8-6-branch 2017-09-01 13:49:55 +00:00
jan.nijtmans e28f1eece4 Handle Unicode surrogates correctly in Tcl_AppendFormatToObj() and BuildCharSet(). Only makes a difference for TCL_UTF_MAX=4, when surrogates are used in the format string ... highly unlikely corner-case. 2017-09-01 13:48:56 +00:00
dgp 4ce83fdb43 merge trunk 2017-09-01 01:44:09 +00:00
jan.nijtmans ce32fdecb2 Ignore libtommath/doc directory. Add some VS-related makefiles, useful for testing 2017-08-31 15:07:57 +00:00
jan.nijtmans 105a61c09b Merge core-8-6-branch. Remove all git tag information for libtommath, so we don't have useless file differences with every libtommath release. 2017-08-31 13:56:30 +00:00
jan.nijtmans 25b97a7df9 Adapt .fossil-settings/crlf-glob, for 5 libtommath-related files which have crlf ending 2017-08-31 13:43:17 +00:00
jan.nijtmans 432e75210f Undo tag removal (just get libtommath directly from GitHUB), so we don't have useless file changes with every new release 2017-08-31 13:32:52 +00:00
jan.nijtmans 595e613479 (merge-mark core-8-6-branch).
Give state to UtfToUtfProc() and UnicodeToUtfProc() in which the last (intermediate) Tcl_UniChar can be remembered: This way those functions can produce 4-byte UTF-8 sequences built from surrogate pairs if Tcl is compiled with TCL_UTF_MAX=4. For TCL_UTF_MAX=3 and TCL_UTF_MAX=6 this has no effect.
2017-08-31 12:21:43 +00:00
oehhar c0e413055e http state 100 continue handling broken [2a94652ee1] 2017-08-31 09:35:52 +00:00
oehhar 11719ccf59 http state 100 continue handling broken [2a94652ee1] 2017-08-31 09:32:05 +00:00
oehhar 7c7a396fc5 http state 100 continue handling broken [2a94652ee1] 2017-08-31 06:31:05 +00:00
andy 7aafa756ac Cherrypick string.test [de104ef5ab] 2017-08-30 15:29:16 +00:00
jan.nijtmans 6d8b0c705f Tweak libtommath building, such that it doesn't depend on uint64_t any more. (handle mp_word in the same way as mp_digit) 2017-08-30 12:37:50 +00:00
jan.nijtmans faaf0a0fe6 Adapt libtommath's "changes.txt", and other text-files. Adapt bn_mp_read_radix.c to latest libtommaths 'tcl-fixes' commit (harmless for Tcl). 2017-08-30 11:46:33 +00:00
jan.nijtmans 07bcf919d6 Cherry-pick [https://github.com/libtom/libtommath/commit/a0a86c696a7182f8be4b10bb79a1c5c971dc9561]: Merge branch 'tcl-fixes' into develop
Remove many files, which are not used in Tcl.
Modify "changelog.txt", with real release-date of 1.0.1 version
2017-08-30 11:20:19 +00:00
jan.nijtmans f70c0ac860 a few missing bits after previous commit 2017-08-29 21:27:56 +00:00
jan.nijtmans 97d25d7902 Forgot a few files from libtommath 1.0.1 2017-08-29 21:16:54 +00:00
jan.nijtmans c3d5808cdd upgrade to libtommath 1.0.1 (With all Tcl-specific changes - as far as needed - intact) 2017-08-29 20:45:34 +00:00
jan.nijtmans 187a67149b Merge libtommath 1.0.1 final 2017-08-29 20:43:48 +00:00
jan.nijtmans 2d65cb7514 libtommath 1.0.1 2017-08-29 20:39:15 +00:00
jan.nijtmans 92a05930af libtommath 1.0.1 rc2, for test purposes only 2017-08-29 20:25:53 +00:00
jan.nijtmans 1ef0babc38 Fix eol-style (fossil warning: mixed line endings) 2017-08-29 19:55:52 +00:00
jan.nijtmans 92265d56a3 libtommath 1.0.1 rc 2 2017-08-29 19:52:35 +00:00
jan.nijtmans 4264a4f6ab merge-mark 2017-08-29 09:25:17 +00:00
jan.nijtmans a95a7dd265 (cherry-pick): Fix [b50fb21410dababca95baa122964b2e312cb9d8a|b50fb214] : exec redirection to append stdout and stderr to the same file 2017-08-29 09:24:29 +00:00
ferrieux 2e9194366a Fix [b50fb214] : add to 2>> the same O_APPEND that was added to >> back in 2005. 2017-08-24 16:56:51 +00:00
jan.nijtmans ce72664606 merge core-8-6-branch 2017-08-22 12:41:18 +00:00
jan.nijtmans 5210283d10 Fix [d2612a2fa193196787aab33bb57f69b1eef9e30c|d2612a2fa1]: Build breaks because of gcc error. Only use "#pragma GCC diagnostic" if the compiler supports this.
Also re-format tclUnixSock.c without further functional changes.
2017-08-22 12:12:11 +00:00
jan.nijtmans 0eb18d8f91 merge core-8-6-branch 2017-08-18 22:06:54 +00:00
jan.nijtmans 29be40bf89 RFE [http://core.tcl.tk/tk/info/6c0d7aec67|6c0d7aec67]: Better surrogate handling for TCL_UTF_MAX==4. No change when TCL_UTF_MAX==3. (This commit is actually meant for androwish, in order to improve surrogate handling for TCL_UTF_MAX==4) 2017-08-18 21:39:16 +00:00
jan.nijtmans e6336bb806 Merge core-8-6-branch. Update outdated comment (cherry-pick [d5dec2b0514639f44929cbbba9c4130798a8a54a|d5dec2b051]) 2017-08-17 22:50:16 +00:00
jan.nijtmans a04094e9a5 Adopt some harmless changes from the 'irontcl' branch. Left 2 changes behind which I'm not so sure about (but I could be convinced ...). Ticket with explanation would be appreciated! 2017-08-17 22:26:48 +00:00
jan.nijtmans 922d8a71a5 merge core-8-6-branch 2017-08-17 21:56:51 +00:00
jan.nijtmans 13d9910fd6 '#if' -> '#ifdef' in tclUnixPort.h. Suggested by Gustaf Neumann. Reduces the number of gcc warnings, when compiling Tcl with -Wundef. Harmless. 2017-08-17 21:52:42 +00:00
dgp 277f101d7f [f2336c116b] Move pragmas to make gcc happy; it is pickier than clang. 2017-08-14 15:33:03 +00:00
Joe Mistachkin a50a381b04 The 'clean' target should delete the generated 'nmhlp-out.txt' file as well. 2017-08-13 22:31:19 +00:00
Joe Mistachkin e513ec3916 Always define '_USING_V110_SDK71_', in case targeting the pre-Windows 8.x SDKs. 2017-08-13 22:15:30 +00:00
Joe Mistachkin 89fcfadbbf Support cross-compiling Tcl for 'Win32 on ARM' using Visual Studio. 2017-08-13 22:05:25 +00:00
andy 89ce4defb5 Correct longstanding typo in continue man page 2017-08-12 19:45:04 +00:00
dgp ad9bc7297d Add 8.7 -only changes to the changes file. 2017-08-10 19:14:15 +00:00
dgp 0079285837 Update outdated comment. 2017-08-10 17:34:31 +00:00
dgp 8ccd8d10ef Backport [array names -regexp] should support backrefs 2017-08-10 17:03:53 +00:00
dgp aedd652645 Bring changes up to the 8.6.7 release. 2017-08-10 14:56:23 +00:00
dgp 4056a4dc4b Release candidate branch for Tcl 8.7a1. 2017-08-10 14:29:11 +00:00
dgp ffaeeeddaa merge 8.6 2017-08-10 14:17:01 +00:00
dgp c2982f8f62 Silence compiler warning in --disable-threads build 2017-08-10 13:28:48 +00:00
dgp 587206a660 merge mark 2017-08-09 16:38:35 +00:00
dgp 545f5e64be merge mark 2017-08-09 16:29:45 +00:00
dgp 385b618c74 merge release 2017-08-09 16:28:33 +00:00
dgp 3a07a6d26f bump release date 2017-08-09 14:41:19 +00:00
andy df9ea61fbf Cherrypick [527d354828] 2017-08-08 16:45:47 +00:00
andy 5f7ca471e4 Merge core-8-6-branch 2017-08-08 16:42:24 +00:00
andy ac8ddf5d4a Cherrypick [527d354828] 2017-08-08 16:42:05 +00:00
andy 664774bec4 [5bfe3de008]: Modify [source] to set input EOF character but not output EOF character. This avoids having ^Z being appended to the sourced file when it is an always-writable [tcl::chan::variable] in a custom VFS. Tested by adding this same change as a patch to Tcl 8.6.6 in KitCreator because that seems to be the easiest way to get custom VFS capability exposed as script commands. Original problem introduced by [03cdfc3a86] 2000-05-11 00:16:52. 2017-08-07 01:16:39 +00:00
dgp 3cf11a1ce9 merge 8.6 2017-08-04 13:18:37 +00:00
dgp 6da97c627b merge 8.6 2017-08-03 14:40:48 +00:00
dgp 735ca3d3a8 Improved test http-4.16. 2017-08-03 14:39:59 +00:00
dkf 72396a1929 Fix weird hangs in macOS Sierra on some networks. Name resolution timeouts not what we want to test in the http package. 2017-08-02 23:38:20 +00:00
dgp 816674cdb7 update changes 2017-08-01 16:05:13 +00:00
dgp 6bcfd54d3a merge 8.6 2017-07-18 12:58:27 +00:00
jan.nijtmans bb331bf1d8 merge core-8-6-branch 2017-07-17 08:04:57 +00:00
jan.nijtmans b095f046e6 Fix [fb2208172c671f29d60e9ac928d9ded45d01d8b8|fb2208172c]: tclIndex varies across builds from auto_mkindex 2017-07-17 08:04:15 +00:00
jan.nijtmans cee94b0658 Fix [fb2208172c671f29d60e9ac928d9ded45d01d8b8|fb2208172c]: tclIndex varies across builds from auto_mkindex 2017-07-17 08:01:11 +00:00
jan.nijtmans f94f5914a8 merge core-8-6-branch 2017-07-14 14:48:17 +00:00
jan.nijtmans 9dd9b629b3 merge core-8-6-branch 2017-07-13 15:07:39 +00:00
jan.nijtmans 440dbbf620 Fix [293344d4f3]: Regression in SQLite test-suite. Long-standing bug in implementation of TclUtfToUniChar() macro. 2017-07-13 15:06:07 +00:00
jan.nijtmans b1243f2603 Fix [293344d4f3]: Regression in SQLite test-suite. Long-standing bug in implementation of TclUtfToUniChar() macro. 2017-07-13 15:03:27 +00:00
dgp f553fe3b01 merge 8.6 2017-07-06 16:47:21 +00:00
dgp 457f43e25b merge 8.6 2017-07-06 16:40:38 +00:00
dgp 578eeb06bc [adb198c256] Switch to an alternative fix for file join memleaks. 2017-07-06 16:34:56 +00:00
dgp 515f0f32c0 Pull out of the loop a block of code that can only run in first iteration. 2017-07-06 16:00:46 +00:00
dgp bcb9c34521 Alternative fix for memleaks in fs path join machinery. 2017-07-06 15:46:58 +00:00
jan.nijtmans af0816e0ca merge core-8-6-branch 2017-07-03 12:45:44 +00:00
jan.nijtmans ac0fdb5bf8 merge core-8-6-branch 2017-07-03 12:32:38 +00:00
sebres 2ee7180448 resolve 8.6-fork 2017-07-03 09:23:17 +00:00
sebres 5541cc57f7 tclPathObj: fixed TclJoinPath - usage of released object and object leakage.
closes [adb198c256df8c4192838cc3c1112fb2821314e9]
2017-07-03 09:19:41 +00:00
sebres 692ea37c40 tclPathObj: fixed TclJoinPath (backported from 8.6) - usage of released object and object leakage.
closes [adb198c256df8c4192838cc3c1112fb2821314e9]
2017-07-03 09:15:23 +00:00
jan.nijtmans 58dd15c51d merge core-8-6-branch 2017-07-03 08:30:43 +00:00
jan.nijtmans d0996f3402 'inline static' -> 'static inline' and 'INLINE' -> 'inline', for consistancy. 2017-07-03 08:27:42 +00:00
dgp 39356c4079 merge 8.6 2017-06-29 11:19:39 +00:00
jan.nijtmans a646f081bc merge core-8-6-branch 2017-06-28 13:44:23 +00:00
jan.nijtmans 89f6884455 Eliminate use of (expensive) Tcl_UtfToUpper() from "format": Just generate the expected uppercase characters right away from the start. No change in functionality, just code optimization. 2017-06-28 13:32:16 +00:00
dgp 45cf14ed03 Merge 8.6; Bump to TclOO 1.2.0. 2017-06-26 20:00:35 +00:00
dgp 5314bbe0ef update changes 2017-06-26 19:56:37 +00:00
dgp 5b2c81a0f3 merge 8.6 2017-06-26 19:51:48 +00:00
dgp f242dd36bd Bump to TclOO 1.1.0 2017-06-26 19:37:34 +00:00
dgp fb2aa596ab merge 8.6 2017-06-26 19:22:29 +00:00
dgp 5621809b18 [46f801ea5a] Make autoloader less fragile when it cannot manufacture a
known consistent stack trace. Value inconsistency over failure.
2017-06-26 19:18:42 +00:00
dgp 7a8a4b15c4 Try to make good stack trace. Fallback to making not-so-good stack trace.
Stop failing altogether. Test in test suite, not program fragility.
2017-06-26 19:17:12 +00:00
dgp f4615ea166 Test demonstrating autoloader fragility. 2017-06-26 17:30:15 +00:00
jan.nijtmans 2bd7095b87 No longer split tests for longIs32bit/longIs64bit, since the results should be identical 2017-06-23 15:04:44 +00:00
dgp 400f9d27f5 typo fix 2017-06-23 13:11:37 +00:00
dgp 5d68b7ef56 Rewrite the documentation of [regsub -command] so it's not quite such a mess. 2017-06-23 13:09:23 +00:00
dgp ba387de8cd repair broken tests 2017-06-23 12:39:13 +00:00
dgp 70d12096d5 Repair compiler warning about uninitialized value. 2017-06-23 12:28:57 +00:00
jan.nijtmans 3dedad17ed TIP #472 implementation: Add Support for 0d Radix Prefix to Integer Literals 2017-06-23 08:11:42 +00:00
jan.nijtmans 6454bee19b Merge core-8-6-branch 2017-06-22 08:16:41 +00:00
dgp 9983a05a80 merge 8.6 2017-06-19 17:31:17 +00:00
dgp 952acc3754 Merge 8.6; update changes. 2017-06-16 20:17:33 +00:00
jan.nijtmans 94754be1d7 merge core-8-6-branch 2017-06-16 14:31:47 +00:00
jan.nijtmans 56ea73145f Merge core-8-6-branch.
Fix gcc warning: tclStrToD.c:1180:2: warning: enumeration value ‘ZERO_D’ not handled in switch [-Wswitch]
  switch (acceptState) {
2017-06-15 11:01:58 +00:00
jan.nijtmans e8d9fe8ebe Rebase to core-8-6-branch (who told that fossil doesn't know how to rebase ....) 2017-06-14 07:54:51 +00:00
jan.nijtmans 6168d91b0e merge core-8-6-branch 2017-06-13 12:18:16 +00:00
griffin 2712a556fb Add support of 0d in the format %# conversion flag. Add tests for same. 2017-06-12 14:04:29 +00:00
jan.nijtmans 16f3f234e8 Better UTF-8 surrogate handling, only functional when TCL_UTF_MAX>3 2017-06-08 08:26:58 +00:00
dgp f8bc248cc3 merge 8.6 2017-06-06 13:03:31 +00:00
dgp f165025992 Merge 8.6; update changes. 2017-06-05 17:22:31 +00:00
griffin 919fc57599 0d in LinkVar 2017-05-28 16:06:29 +00:00
griffin 5badb6535f Implement proposed 0d decimal radix prefix to compliment 0x,0b,0o. 2017-05-27 22:17:21 +00:00
dgp 8a90be9a10 merge 8.6 2017-05-23 13:25:07 +00:00
dgp 2f9e40fef1 merge 8.6 2017-05-19 12:53:52 +00:00
dgp 0d218fca03 Merge 8.6; update changes. 2017-05-09 12:12:26 +00:00
dgp f9d42ebf8c Merge 8.6; update changes. 2017-05-08 16:07:58 +00:00
dgp 0177abb172 merge 8.6 2017-05-04 20:40:15 +00:00
dgp 77822d9462 merge 8.6; update changes 2017-04-28 18:09:46 +00:00
dgp 78a7a5b561 merge 8.6 2017-04-27 12:06:47 +00:00
dgp 7fde7fcf7b merge 8.6 2017-04-21 12:19:07 +00:00
dgp cdccb19d1c merge 8.6 2017-04-19 15:22:22 +00:00
dgp a3fdca376e merge 8.6 2017-04-17 12:10:42 +00:00
dgp d2595ccfea Bump TclOO 1.0.6; finish changes. 2017-04-13 16:39:15 +00:00
dgp 5b059dfd6b Bump msgcat and tcl tests and continue updates to changes. 2017-04-12 20:23:56 +00:00
dgp 1a3c0d9be9 merge 8.6 2017-04-12 19:19:05 +00:00
dgp 1e22d92c69 More changes work 2017-04-11 19:11:27 +00:00
dgp f3a4ae987d merge 8.6 2017-04-03 16:53:26 +00:00
dgp 5e45fd7662 merge 8.6 2017-03-31 12:30:27 +00:00
dgp d7802b428a New(ish) test interp-14.11 was missing its -cleanup. 2017-03-22 19:45:41 +00:00
dgp b8d35358ad merge 8.6 2017-03-17 12:51:53 +00:00
dgp daac4e5d34 Different solution to silencing the non-useful valgrind alerts. 2017-03-13 17:03:50 +00:00
dgp 57ceb807ca merge 8.6 2017-03-10 17:22:26 +00:00
dgp 91d32c4556 Silence valgrind complaints from [representation]. 2017-03-10 16:41:32 +00:00
dgp e9e0f57d92 Dup test name 2017-03-10 15:28:46 +00:00
dgp f090fee89b Start RC branch for Tcl 8.6.7 2017-03-10 15:22:08 +00:00
327 changed files with 27774 additions and 20362 deletions
+5
View File
@@ -3,12 +3,17 @@ compat/zlib/contrib/vstudio/readme.txt
compat/zlib/contrib/vstudio/*/zlib.rc
compat/zlib/win32/*.txt
compat/zlib/win64/*.txt
libtommath/*.dsp
libtommath/*.sln
libtommath/*.vcproj
tools/tcl.hpj.in
tools/tcl.wse.in
win/buildall.vc.bat
win/coffbase.txt
win/makefile.vc
win/rules.vc
win/rules-ext.vc
win/targets.vc
win/tcl.dsp
win/tcl.dsw
win/tcl.hpj.in
+5
View File
@@ -3,12 +3,17 @@ compat/zlib/contrib/vstudio/readme.txt
compat/zlib/contrib/vstudio/*/zlib.rc
compat/zlib/win32/*.txt
compat/zlib/win64/*.txt
libtommath/*.dsp
libtommath/*.sln
libtommath/*.vcproj
tools/tcl.hpj.in
tools/tcl.wse.in
win/buildall.vc.bat
win/coffbase.txt
win/makefile.vc
win/rules.vc
win/rules-ext.vc
win/targets.vc
win/tcl.dsp
win/tcl.dsw
win/tcl.hpj.in
+6 -3
View File
@@ -18,6 +18,7 @@
*/tclsh*
*/tcltest*
*/versions.vc
*/version.vc
html
libtommath/bn.ilg
libtommath/bn.ind
@@ -40,7 +41,9 @@ unix/dltest.marker
unix/tcl.pc
unix/tclIndex
unix/pkgs/*
win/Debug_VC*
win/Release_VC*
win/Debug*
win/Release*
win/pkgs/*
win/tcl.hpj
win/coffbase.txt
win/tcl.hpj
win/nmhlp-out.txt
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>tcl8.7</name>
<name>tcl8</name>
<comment></comment>
<projects>
</projects>
+1 -1
View File
@@ -1,5 +1,5 @@
README: Tcl
This is the Tcl 8.7a0 source distribution.
This is the Tcl 8.7a2 source distribution.
http://sourceforge.net/projects/tcl/files/Tcl/
You can get any source release of Tcl from the URL above.
+255
View File
@@ -8624,3 +8624,258 @@ improvements to regexp engine from Postgres (lane,porter,fellows,seltenreich)
2016-02-22 (bug)[9b4702] [info exists env(missing)] kills trace (nijtmans)
--- Released 8.6.5, February 29, 2016 --- http://core.tcl.tk/tcl/ for details
2016-03-01 (bug)[803042] mem leak due to reference cycle (porter)
2016-03-08 (bug)[bbc304] reflected watch race condition (porter)
2016-03-17 (bug)[fadc99] compile-5.3 (rodriguez,porter)
2016-03-17 (enhancement)[1a25fd] compile [variable ${ns}::v] (porter)
2016-03-20 (bug)[1af8de] crash in compiled [string replace] (harder,fellows)
2016-03-21 (bug)[d30718] segv in notifier finalize (hirofumi,nijtmans)
2016-03-23 (enhancement)[7d0db7] parallel make (yarda,nijtmans)
2016-03-23 [f12535] enable test bindings customization (vogel,nijtmans)
2016-04-04 (bug)[47ac84] compiled [lreplace] fixes (aspect,ferrieux,fellows)
*** POTENTIAL INCOMPATIBILITY ***
2016-04-08 (bug)[866368] RE \w includes 'Punctuation Connector' (nijtmans)
2016-04-08 (bug)[2538f3] Win crash Tcl_OpenTcpServer() (griffin)
2016-04-10 [07d13d] Restore TclBlend support lost in 8.6.1 (buratti)
2016-05-13 (bug)[3154ea] Mem corruption in assembler exceptions (tkob,kenny)
2016-05-13 (bug) registry package support any Unicode env (nijtmans)
=> registry 1.3.2
2016-05-21 (bug)[f7d4e] [namespace delete] performance (fellows)
2016-06-02 (TIP 447) execution time verbosity option (cerutti)
=> tcltest 2.4.0
2016-06-16 (bug)[16828b] crash due to [vwait] trace undo fail (dah,porter)
2016-06-16 (enhancement)[4b61af] good [info frame] from more cases (beric)
2016-06-21 (bug)[c383eb] crash in [glob -path a] (oehlmann,porter)
2016-06-21 (update) Update Unicode data to 9.0 (nijtmans)
*** POTENTIAL INCOMPATIBILITY ***
2016-06-22 (bug)[16896d] Tcl_DString tolerate append to self. (dah,porter)
2016-06-23 (bug)[d55322] crash in [dict update] (yorick,fellows)
2016-06-27 (bug)[dd260a] crash in [chan configure -dictionary] (madden,aspect)
2016-07-02 (bug)[f961d7] usage message with parameters with spaces (porter)
*** POTENTIAL INCOMPATIBILITY ***
2016-07-02 (enhancement)[09fabc] Sort order of -relateddir (lanam)
2016-07-07 (bug)[5d7ca0] Win: [file executable] for .cmd and .ps1 (nadkarni)
*** POTENTIAL INCOMPATIBILITY ***
2016-07-08 (bug)[a47641] [file normalize] & Windows junctions (nadkarni)
2016-07-09 [ae61a6] [file] handling of Win hardcoded names (CON) (nadkarni)
*** POTENTIAL INCOMPATIBILITY ***
2016-07-09 [3613671] [file owned] (more) useful on Win (nadkarni)
2016-07-09 (bug)[1493a4] [namespace upvar] use of resolvers (beric,fellows)
*** POTENTIAL INCOMPATIBILITY ***
2016-07-10 (bug)[da340d] integer division in clock math (nadkarni)
2016-07-20 tzdata updated to Olson's tzdata2016f (venkat)
--- Released 8.6.6, July 27, 2016 --- http://core.tcl.tk/tcl/ for details
2016-09-07 (bug)[c09edf] Bad caching with custom resolver (neumann,nijtmans)
2016-09-07 (bug)[4dbdd9] Memleak in test var-8.3 (mr_calvin,porter)
2016-10-03 (bug)[2bf561] Allow empty command as alias target (yorick,nijtmans)
*** POTENTIAL INCOMPATIBILITY ***
2016-10-04 (bug)[4d5ae7] Crash in async connects host no address (gahr,fellows)
2016-10-08 (bug)[838e99] treat application/xml as text (gahr,fellows)
=> http 2.8.10
2016-10-11 (bug)[3cc1d9] Thread finalization crash in zippy (neumann)
2016-10-12 (bug)[be003d] Fix [scan 0x1 %b], [scan 0x1 %o] (porter)
2016-10-14 (bug)[eb6b68] Fix stringComp-14.5 (porter)
2016-10-30 (bug)[b26e38] Fix zlib-7.8 (fellows)
2016-10-30 (bug)[1ae129] Fix memleak in [history] destruction (fellows)
2016-11-04 (feature) Provisional Tcl 9 support in msgcat and tcltest (nijtmans)
=> msgcat 1.6.1
=> tcltest 2.4.1
2016-11-04 (bug)[824752] Crash in Tcl_ListObjReplace() (gahr,porter)
2016-11-11 (bug)[79614f] invalidate VFS mounts on sytem encoding change (yorick)
2016-11-14 OSX: End panic() as legacy support macro; system conflicts (nijtmans)
*** POTENTIAL INCOMPATIBILITY ***
2016-11-15 (bug) TclOO fix stops crash mixing Itcl and snit (fellows)
2016-11-17 (update) Reconcile libtommath updates; purge unused files (nijtmans)
*** POTENTIAL INCOMPATIBILITY ***
2017-01-09 (bug)[b87ad7] Repair drifts in timer clock (sebres)
2017-01-17 (update) => zlib 1.2.11 (nijtmans)
2017-01-31 (bug)[39f630] Revise Tcl_LinkVar to tolerate some prefixes (nijtmans)
*** POTENTIAL INCOMPATIBILITY ***
2017-02-01 (bug)[d0f7ba] Improper NAN optimization. expr-22.1[01] (aspect)
2017-02-26 (bug)[25842c] zlib stream finalization (aspect)
2017-03-07 (deprecate) Remove unmaintained makefile.bc file (nijtmans)
*** POTENTIAL INCOMPATIBILITY ***
2017-03-14 (enhancement) [clock] and [encoding] are now ensembles (kenny)
2017-03-15 (enhancement) several [clock] subcommands bytecoded (kenny)
2017-03-23 tzdata updated to Olson's tzdata2017b (jima)
2017-03-29 (bug)[900cb0] Fix OO unexport introspection (napier)
2017-04-12 (bug)[42202b] Nesting imbalance in coro injection (nadkarni,sebres)
2017-04-18 (bug)[bc4322] http package support for safe interps (nash,nijtmans)
2017-04-28 (bug)[f34cf8] [file join a //b] => /b (neumann,porter)
2017-05-01 (bug)[8bd13f] Windows threads and pipes (sebres,nijtmans)
2017-05-01 (bug)[f9fe90] [file join //a b] EIAS violation (aspect,porter)
2017-05-04 (bug) Make test filesystem-1.52 pass on Windows (nijtmans)
2017-05-05 (bug)[601522] [binary] field spec overflow -> segfault (porter)
2017-05-08 (bug)[6ca52a] http memleak handling keep-alive (aspect,nijtmans)
=> http 2.8.11
2017-05-29 (bug)[a3fb33] crash in [lsort] on long lists (sebres)
2017-06-05 (bug)[67aa9a] Tcl_UtfToUniChar() revised handling invalid UTF-8 (nijtmans)
*** POTENTIAL INCOMPATIBILITY ***
2017-06-08 (bug)[2738427] Tcl_NumUtfChars() corner case utf-4.9 (nijtmans)
2017-06-22 (update) Update Unicode data to 10.0 (nijtmans)
*** POTENTIAL INCOMPATIBILITY ***
2017-06-22 (TIP 473) Let [oo::copy] specify target namespace (fellows)
2017-06-26 (bug)[46f801] Repair autoloader fragility (porter)
2017-07-06 (bug)[adb198] Plug memleak in TclJoinPath (sebres,porter)
2017-07-17 (bug)[fb2208] Repeatable tclIndex generation (wiedemann,nijtmans)
--- Released 8.6.7, August 9, 2017 --- http://core.tcl.tk/tcl/ for details
2017-08-10 [array names -regexp] supports backrefs (goth)
2017-08-10 Fix gcc build failures due to #pragma placement (cassoff,fellows)
2017-08-29 (bug)[b50fb2] exec redir append stdout and stderr to file (coulter)
2017-08-31 (bug)[2a9465] http state 100 continue handling broken (oehlmann)
=> http 2.8.12
2017-09-02 (bug)[0e4d88] replace command, delete trace kills namespace (porter)
2017-10-19 (bug)[1a5655] [info * methods] includes mixins (fellows)
2017-10-23 tzdata updated to Olson's tzdata2017c (jima)
2017-10-24 (bug)[fc1409] segfault in method cloning, oo-15.15 (coulter,fellows)
2017-11-03 (bug)[6f2f83] More robust [load] for ReactOS (werner)
2017-11-08 (bug)[3298012] Stop crash when hash tables overflow 32 bits (porter)
2017-11-14 (bug)[5d6de6] Close failing case of [package prefer stable] (kupries)
2017-11-17 (bug)[fab924] Fix misleading [load] message on Windows (oehlmann)
2017-12-05 (bug)[4f6a1e] Crash when ensemble map and list are same (sebres)
2017-12-06 (bug)[ce3a21] file normalize failure when tail is empty (porter)
2017-12-08 (new)[TIP 477] nmake build system reform (nadkarni)
2017-12-19 (bug)[586e71] EvalObjv exception handling at level #0 (sebres,porter)
--- Released 8.6.8, December 22, 2017 --- http://core.tcl.tk/tcl/ for details
Changes to 8.7a1 include all changes to the 8.6 line through 8.6.7,
plus the following, which focuses on the high-level feature changes
in this changeset (new minor version) rather than bug fixes:
2016-03-17 (bug)[0b8c38] socket accept callbacks always in global ns (porter)
*** POTENTIAL INCOMPATIBILITY ***
2016-07-01 Hack accommodations for legacy Itcl 3 disabled (porter)
2016-07-12 Make TCL_HASH_TYPE build-time configurable (nijtmans)
2016-07-19 (bug)[0363f0] Partial array search ID reform (porter)
2016-07-19 (feature removed) Tcl_ObjType "array search" unregistered (porter)
*** POTENTIAL INCOMPATIBILITY for Tcl_GetObjType("array search") ***
2016-10-04 Server socket on port 0 chooses port supporting IPv4 * IPv6 (max)
2016-11-25 [array named -regexp] supports backrefs (goth)
2017-01-04 (TIP 456) New routine Tcl_OpenTcpServerEx() (limeboy)
2017-01-04 (TIP 459) New subcommand [package files] (nijtmans)
2017-01-16 threaded allocator initialization repair (vasiljevic,nijtmans)
2017-01-30 Add to Win shell builtins: assoc ftype move (ashok)
2017-03-31 TCL_MEM_DEBUG facilities better support 64-bit memory (nijtmans)
2017-04-13 \u escaped content in msg files converted to true utf-8 (nijtmans)
2017-05-18 (TIP 458) New epoll or kqueue notifiers are default (alborboz)
2017-05-31 Purge build support for SunOS-4.* (stu)
2017-06-22 (TIP 463) New option [regsub ... -command ...] (fellows)
2017-06-22 (TIP 470) Tcl_GetDefineContextObject();[oo::define [self]] (fellows)
=> TclOO 1.2.0
2017-06-23 (TIP 472) Support 0d as prefix of decimal numbers (iyer,griffin)
2017-08-31 (bug)[2a9465] http state 100 continue handling broken (oehlmann)
2017-09-02 (bug)[0e4d88] replace command, delete trace kills namespace (porter)
--- Released 8.7a1, September 8, 2017 --- http://core.tcl.tk/tcl/ for details
-14
View File
@@ -1,14 +0,0 @@
/*
* float.h --
*
* This is a dummy header file to #include in Tcl when there
* is no float.h in /usr/include. Right now this file is empty:
* Tcl contains #ifdefs to deal with the lack of definitions;
* all it needs is for the #include statement to work.
*
* Copyright (c) 1993 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.
*/
-4
View File
@@ -260,10 +260,6 @@ Windows-only convenience
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
+5 -2
View File
@@ -57,6 +57,9 @@ after the optional white space and sign are
.QW \fB0x\fR
then \fIsrc\fR is expected to be in hexadecimal form; otherwise,
if the first such characters are
.QW \fB0d\fR
then \fIsrc\fR is expected to be in decimal form; otherwise,
if the first such characters are
.QW \fB0o\fR
then \fIsrc\fR is expected to be in octal form; otherwise,
if the first such characters are
@@ -65,8 +68,8 @@ then \fIsrc\fR is expected to be in binary form; otherwise,
if the first such character is
.QW \fB0\fR
then \fIsrc\fR
is expected to be in octal form; otherwise, \fIsrc\fR is
expected to be in decimal form.
is expected to be in octal form; otherwise, \fIsrc\fR
is expected to be in decimal form.
.PP
\fBTcl_GetDouble\fR expects \fIsrc\fR to consist of a floating-point
number, which is: white space; a sign; a sequence of digits; a
+1 -1
View File
@@ -257,7 +257,7 @@ The \fBincr\fR command first gets an integer from \fIx\fR's value
by calling \fBTcl_GetIntFromObj\fR.
This procedure checks whether the value is already an integer value.
Since it is not, it converts the value
by setting the value's \fIinternalRep.longValue\fR member
by setting the value's internal representation
to the integer \fB123\fR
and setting the value's \fItypePtr\fR
to point to the integer Tcl_ObjType structure.
+2 -2
View File
@@ -54,9 +54,9 @@ is called, Tcl will take care of memory management.
.PP
The second triplet stores the snapshot of only the interpreter
result (not its complete state) in memory allocated by the caller.
These routines are passed a pointer to a \fBTcl_SavedResult\fR structure
These routines are passed a pointer to \fBTcl_SavedResult\fR
that is used to store enough information to restore the interpreter result.
This structure can be allocated on the stack of the calling
\fBTcl_SavedResult\fR can be allocated on the stack of the calling
procedure. These routines do not save the state of any error
information in the interpreter (e.g. the \fB\-errorcode\fR or
\fB\-errorinfo\fR return options, when an error is in progress).
+1 -1
View File
@@ -33,7 +33,7 @@ int
.SH ARGUMENTS
.AS char *str in/out
.AP int ch in
The Tcl_UniChar to be converted.
The Unicode character to be converted.
.AP char *str in/out
Pointer to UTF-8 string to be converted in place.
.BE
+2 -5
View File
@@ -48,19 +48,16 @@ int
.SH ARGUMENTS
.AS int ch
.AP int ch in
The Tcl_UniChar to be examined.
The Unicode character to be examined.
.BE
.SH DESCRIPTION
.PP
All of the routines described examine Tcl_UniChars and return a
All of the routines described examine Unicode characters and return a
boolean value. A non-zero return value means that the character does
belong to the character class associated with the called routine. The
rest of this document just describes the character classes associated
with the various routines.
.PP
Note: A Tcl_UniChar is a Unicode character represented as an unsigned,
fixed-size quantity.
.SH "CHARACTER CLASSES"
.PP
+1 -1
View File
@@ -77,7 +77,7 @@ int
Buffer in which the UTF-8 representation of the Tcl_UniChar is stored. At most
\fBTCL_UTF_MAX\fR bytes are stored in the buffer.
.AP int ch in
The Tcl_UniChar to be converted or examined.
The Unicode character to be converted or examined.
.AP Tcl_UniChar *chPtr out
Filled with the Tcl_UniChar represented by the head of the UTF-8 string.
.AP "const char" *src in
+1 -1
View File
@@ -23,7 +23,7 @@ exception to occur.
The exception causes the current script to be aborted
out to the innermost containing loop command, which then
continues with the next iteration of the loop.
Catch exceptions are also handled in a few other situations, such
Continue exceptions are also handled in a few other situations, such
as the \fBcatch\fR command and the outermost scripts of procedure
bodies.
.SH EXAMPLE
+3 -3
View File
@@ -33,9 +33,9 @@ as the empty string, a new name is chosen. Names, unless specified, are
chosen with the same algorithm used by the \fBnew\fR method of
\fBoo::class\fR.
.VE TIP473
The copied object will be of the same class as the source object, and will have
all its per-object methods copied. If it is a class, it will also have all the
class methods in the class copied, but it will not have any of its instances
The copied object will be of the same class as the source object, and will have
all its per-object methods copied. If it is a class, it will also have all the
class methods in the class copied, but it will not have any of its instances
copied.
.PP
.VS
+2 -1
View File
@@ -46,7 +46,8 @@ value is the form produced by the \fB%g\fR format specifier of Tcl's
An expression consists of a combination of operands, operators, parentheses and
commas, possibly with whitespace between any of these elements, which is
ignored.
An integer operand may be specified in decimal, binary
An integer operand may be specified in decimal (the normal case, the optional
first two characters are \fB0d\fR), binary
(the first two characters are \fB0b\fR), octal
(the first two characters are \fB0o\fR), or hexadecimal
(the first two characters are \fB0x\fR) form. For
+2
View File
@@ -89,6 +89,8 @@ For \fBx\fR or \fBX\fR conversions, \fB0x\fR or \fB0X\fR (respectively)
will be added to the beginning of the result unless it is zero.
For \fBb\fR conversions, \fB0b\fR
will be added to the beginning of the result unless it is zero.
For \fBd\fR conversions, \fB0d\fR will be added to the beginning
of the result unless it is zero.
For all floating-point conversions (\fBe\fR, \fBE\fR, \fBf\fR,
\fBg\fR, and \fBG\fR) it guarantees that the result always
has a decimal point.
+12 -10
View File
@@ -70,18 +70,20 @@ from the corresponding match.
.TP
\fB\-command\fR
.VS 8.7
Changes the handling of the substitution string so that it no longer treats
Changes the handling of \fIsubSpec\fR so that it is not treated
as a template for a substitution string and the substrings
.QW &
and
.QW \e
as special characters, but instead uses them as a non-empty list of words.
Each time a substitution is processed, another complete Tcl word is appended
to that list for each substitution value (the first such argument represents
the overall matched substring, the subsequent arguments will be one per
capturing sub-RE, much as are returned from \fBregexp\fR \fB\-inline\fR) and
the overall list is then evaluated as a Tcl command call. If the command
finishes successfully, the result of command call is substituted into the
resulting string.
.QW \e\fIn\fR
no longer have special meaning. Instead \fIsubSpec\fR must be a
command prefix, that is, a non-empty list. The substring of \fIstring\fR
that matches \fIexp\fR, and then each substring that matches each
capturing sub-RE within \fIexp\fR are appended as additional elements
to that list. (The items appended to the list are much like what
\fBregexp\fR \fB-inline\fR would return). The completed list is then
evaluated as a Tcl command, and the result of that command is the
substitution string. Any error or exception from command evaluation
becomes an error or exception from the \fBregsub\fR command.
.RS
.PP
If \fB\-all\fR is not also given, the command callback will be invoked at most
-1
View File
@@ -70,7 +70,6 @@
*/
#define NOTREACHED 0
#define xxx 1
#define DUPMAX _POSIX2_RE_DUP_MAX
#define DUPINF (DUPMAX+1)
+7 -10
View File
@@ -469,7 +469,6 @@ declare 128 {
declare 129 {
int Tcl_Eval(Tcl_Interp *interp, const char *script)
}
# This is obsolete, use Tcl_FSEvalFile
declare 130 {
int Tcl_EvalFile(Tcl_Interp *interp, const char *fileName)
}
@@ -780,8 +779,7 @@ declare 218 {
declare 219 {
int Tcl_ScanCountedElement(const char *src, int length, int *flagPtr)
}
# Obsolete
declare 220 {
declare 220 {deprecated {}} {
int Tcl_SeekOld(Tcl_Channel chan, int offset, int mode)
}
declare 221 {
@@ -868,8 +866,7 @@ declare 244 {
declare 245 {
int Tcl_StringMatch(const char *str, const char *pattern)
}
# Obsolete
declare 246 {
declare 246 {deprecated {}} {
int Tcl_TellOld(Tcl_Channel chan)
}
declare 247 {
@@ -945,10 +942,10 @@ declare 265 {
declare 266 {
void Tcl_ValidateAllMemory(const char *file, int line)
}
declare 267 {
declare 267 {deprecated {see TIP #422}} {
void Tcl_AppendResultVA(Tcl_Interp *interp, va_list argList)
}
declare 268 {
declare 268 {deprecated {see TIP #422}} {
void Tcl_AppendStringsToObjVA(Tcl_Obj *objPtr, va_list argList)
}
declare 269 {
@@ -976,16 +973,16 @@ declare 274 {
CONST84_RETURN char *Tcl_PkgRequire(Tcl_Interp *interp, const char *name,
const char *version, int exact)
}
declare 275 {
declare 275 {deprecated {see TIP #422}} {
void Tcl_SetErrorCodeVA(Tcl_Interp *interp, va_list argList)
}
declare 276 {
declare 276 {deprecated {see TIP #422}} {
int Tcl_VarEvalVA(Tcl_Interp *interp, va_list argList)
}
declare 277 {
Tcl_Pid Tcl_WaitPid(Tcl_Pid pid, int *statPtr, int options)
}
declare 278 {
declare 278 {deprecated {see TIP #422}} {
TCL_NORETURN void Tcl_PanicVA(const char *format, va_list argList)
}
declare 279 {
+24 -9
View File
@@ -55,10 +55,10 @@ extern "C" {
#define TCL_MAJOR_VERSION 8
#define TCL_MINOR_VERSION 7
#define TCL_RELEASE_LEVEL TCL_ALPHA_RELEASE
#define TCL_RELEASE_SERIAL 0
#define TCL_RELEASE_SERIAL 2
#define TCL_VERSION "8.7"
#define TCL_PATCH_LEVEL "8.7a0"
#define TCL_PATCH_LEVEL "8.7a2"
#if !defined(TCL_NO_DEPRECATED) || defined(RC_INVOKED)
/*
@@ -1344,8 +1344,8 @@ typedef struct Tcl_HashSearch {
typedef struct {
void *next; /* Search position for underlying hash
* table. */
int epoch; /* Epoch marker for dictionary being searched,
* or -1 if search has terminated. */
unsigned int epoch; /* Epoch marker for dictionary being searched,
* or 0 if search has terminated. */
Tcl_Dict dictionaryPtr; /* Reference to dictionary being searched. */
} Tcl_DictSearch;
@@ -2263,6 +2263,8 @@ typedef struct mp_int mp_int;
#define MP_INT_DECLARED
typedef unsigned int mp_digit;
#define MP_DIGIT_DECLARED
typedef unsigned TCL_WIDE_INT_TYPE mp_word;
#define MP_WORD_DECLARED
/*
*----------------------------------------------------------------------------
@@ -2407,14 +2409,27 @@ const char * TclTomMathInitializeStubs(Tcl_Interp *interp,
const char *version, int epoch, int revision);
#ifdef USE_TCL_STUBS
#define Tcl_InitStubs(interp, version, exact) \
(Tcl_InitStubs)(interp, version, \
#if TCL_RELEASE_LEVEL == TCL_FINAL_RELEASE
# define Tcl_InitStubs(interp, version, exact) \
(Tcl_InitStubs)(interp, version, \
(exact)|(TCL_MAJOR_VERSION<<8)|(TCL_MINOR_VERSION<<16), \
TCL_STUB_MAGIC)
#else
#define Tcl_InitStubs(interp, version, exact) \
Tcl_PkgInitStubsCheck(interp, version, \
(exact)|(TCL_MAJOR_VERSION<<8)|(TCL_MINOR_VERSION<<16))
# define Tcl_InitStubs(interp, version, exact) \
(Tcl_InitStubs)(interp, TCL_PATCH_LEVEL, \
1|(TCL_MAJOR_VERSION<<8)|(TCL_MINOR_VERSION<<16), \
TCL_STUB_MAGIC)
#endif
#else
#if TCL_RELEASE_LEVEL == TCL_FINAL_RELEASE
# define Tcl_InitStubs(interp, version, exact) \
Tcl_PkgInitStubsCheck(interp, version, \
(exact)|(TCL_MAJOR_VERSION<<8)|(TCL_MINOR_VERSION<<16))
#else
# define Tcl_InitStubs(interp, version, exact) \
Tcl_PkgInitStubsCheck(interp, TCL_PATCH_LEVEL, \
1|(TCL_MAJOR_VERSION<<8)|(TCL_MINOR_VERSION<<16))
#endif
#endif
/*
+232 -98
View File
@@ -118,6 +118,8 @@ static Tcl_ObjCmdProc ExprEntierFunc;
static Tcl_ObjCmdProc ExprFloorFunc;
static Tcl_ObjCmdProc ExprIntFunc;
static Tcl_ObjCmdProc ExprIsqrtFunc;
static Tcl_ObjCmdProc ExprMaxFunc;
static Tcl_ObjCmdProc ExprMinFunc;
static Tcl_ObjCmdProc ExprRandFunc;
static Tcl_ObjCmdProc ExprRoundFunc;
static Tcl_ObjCmdProc ExprSqrtFunc;
@@ -321,6 +323,8 @@ static const BuiltinFuncDef BuiltinFuncTable[] = {
{ "isqrt", ExprIsqrtFunc, NULL },
{ "log", ExprUnaryFunc, (ClientData) log },
{ "log10", ExprUnaryFunc, (ClientData) log10 },
{ "max", ExprMaxFunc, NULL },
{ "min", ExprMinFunc, NULL },
{ "pow", ExprBinaryFunc, (ClientData) pow },
{ "rand", ExprRandFunc, NULL },
{ "round", ExprRoundFunc, NULL },
@@ -950,9 +954,11 @@ Tcl_CreateInterp(void)
Tcl_SetVar2(interp, "tcl_patchLevel", NULL, TCL_PATCH_LEVEL, TCL_GLOBAL_ONLY);
Tcl_SetVar2(interp, "tcl_version", NULL, TCL_VERSION, TCL_GLOBAL_ONLY);
#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
Tcl_TraceVar2(interp, "tcl_precision", NULL,
TCL_GLOBAL_ONLY|TCL_TRACE_READS|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
TclPrecTraceProc, NULL);
#endif /* !TCL_NO_DEPRECATED */
TclpSetVariables(interp);
#ifdef TCL_THREADS
@@ -2053,11 +2059,11 @@ Tcl_CreateCommand(
{
Interp *iPtr = (Interp *) interp;
ImportRef *oldRefPtr = NULL;
Namespace *nsPtr, *dummy1, *dummy2;
Command *cmdPtr, *refCmdPtr;
Namespace *nsPtr;
Command *cmdPtr;
Tcl_HashEntry *hPtr;
const char *tail;
int isNew;
int isNew = 0, deleted = 0;
ImportedCmdData *dataPtr;
if (iPtr->flags & DELETED) {
@@ -2070,32 +2076,52 @@ Tcl_CreateCommand(
}
/*
* Determine where the command should reside. If its name contains
* namespace qualifiers, we put it in the specified namespace; otherwise,
* we always put it in the global namespace.
* If the command name we seek to create already exists, we need to
* delete that first. That can be tricky in the presence of traces.
* Loop until we no longer find an existing command in the way, or
* until we've deleted one command and that didn't finish the job.
*/
if (strstr(cmdName, "::") != NULL) {
TclGetNamespaceForQualName(interp, cmdName, NULL,
TCL_CREATE_NS_IF_UNKNOWN, &nsPtr, &dummy1, &dummy2, &tail);
if ((nsPtr == NULL) || (tail == NULL)) {
return (Tcl_Command) NULL;
while (1) {
/*
* Determine where the command should reside. If its name contains
* namespace qualifiers, we put it in the specified namespace;
* otherwise, we always put it in the global namespace.
*/
if (strstr(cmdName, "::") != NULL) {
Namespace *dummy1, *dummy2;
TclGetNamespaceForQualName(interp, cmdName, NULL,
TCL_CREATE_NS_IF_UNKNOWN, &nsPtr, &dummy1, &dummy2, &tail);
if ((nsPtr == NULL) || (tail == NULL)) {
return (Tcl_Command) NULL;
}
} else {
nsPtr = iPtr->globalNsPtr;
tail = cmdName;
}
hPtr = Tcl_CreateHashEntry(&nsPtr->cmdTable, tail, &isNew);
if (isNew || deleted) {
/*
* isNew - No conflict with existing command.
* deleted - We've already deleted a conflicting command
*/
break;
}
} else {
nsPtr = iPtr->globalNsPtr;
tail = cmdName;
}
/* An existing command conflicts. Try to delete it.. */
cmdPtr = Tcl_GetHashValue(hPtr);
hPtr = Tcl_CreateHashEntry(&nsPtr->cmdTable, tail, &isNew);
if (!isNew) {
/*
* Command already exists. Delete the old one. Be careful to preserve
* Be careful to preserve
* any existing import links so we can restore them down below. That
* way, you can redefine a command and its import status will remain
* intact.
*/
cmdPtr = Tcl_GetHashValue(hPtr);
cmdPtr->refCount++;
if (cmdPtr->importRefPtr) {
cmdPtr->flags |= CMD_REDEF_IN_PROGRESS;
@@ -2108,18 +2134,21 @@ Tcl_CreateCommand(
cmdPtr->importRefPtr = NULL;
}
TclCleanupCommandMacro(cmdPtr);
deleted = 1;
}
hPtr = Tcl_CreateHashEntry(&nsPtr->cmdTable, tail, &isNew);
if (!isNew) {
/*
* If the deletion callback recreated the command, just throw away
* the new command (if we try to delete it again, we could get
* stuck in an infinite loop).
*/
if (!isNew) {
/*
* If the deletion callback recreated the command, just throw away
* the new command (if we try to delete it again, we could get
* stuck in an infinite loop).
*/
ckfree(Tcl_GetHashValue(hPtr));
}
if (!deleted) {
ckfree(Tcl_GetHashValue(hPtr));
}
} else {
/*
* Command resolvers (per-interp, per-namespace) might have resolved
* to a command for the given namespace scope with this command not
@@ -2167,7 +2196,7 @@ Tcl_CreateCommand(
if (oldRefPtr != NULL) {
cmdPtr->importRefPtr = oldRefPtr;
while (oldRefPtr != NULL) {
refCmdPtr = oldRefPtr->importedCmdPtr;
Command *refCmdPtr = oldRefPtr->importedCmdPtr;
dataPtr = refCmdPtr->objClientData;
dataPtr->realCmdPtr = cmdPtr;
oldRefPtr = oldRefPtr->nextPtr;
@@ -2222,37 +2251,34 @@ Tcl_CreateObjCommand(
* name. */
ClientData clientData, /* Arbitrary value to pass to object
* function. */
Tcl_CmdDeleteProc *deleteProc)
Tcl_CmdDeleteProc *deleteProc
/* If not NULL, gives a function to call when
* this command is deleted. */
)
{
Interp *iPtr = (Interp *) interp;
ImportRef *oldRefPtr = NULL;
Namespace *nsPtr, *dummy1, *dummy2;
Command *cmdPtr, *refCmdPtr;
Tcl_HashEntry *hPtr;
Namespace *nsPtr;
const char *tail;
int isNew;
ImportedCmdData *dataPtr;
if (iPtr->flags & DELETED) {
/*
* The interpreter is being deleted. Don't create any new commands;
* it's not safe to muck with the interpreter anymore.
*/
return (Tcl_Command) NULL;
}
/*
* Determine where the command should reside. If its name contains
* namespace qualifiers, we put it in the specified namespace; otherwise,
* we always put it in the global namespace.
* namespace qualifiers, we put it in the specified namespace;
* otherwise, we always put it in the global namespace.
*/
if (strstr(cmdName, "::") != NULL) {
Namespace *dummy1, *dummy2;
TclGetNamespaceForQualName(interp, cmdName, NULL,
TCL_CREATE_NS_IF_UNKNOWN, &nsPtr, &dummy1, &dummy2, &tail);
TCL_CREATE_NS_IF_UNKNOWN, &nsPtr, &dummy1, &dummy2, &tail);
if ((nsPtr == NULL) || (tail == NULL)) {
return (Tcl_Command) NULL;
}
@@ -2261,12 +2287,49 @@ Tcl_CreateObjCommand(
tail = cmdName;
}
hPtr = Tcl_CreateHashEntry(&nsPtr->cmdTable, tail, &isNew);
TclInvalidateNsPath(nsPtr);
if (!isNew) {
cmdPtr = Tcl_GetHashValue(hPtr);
return TclCreateObjCommandInNs(interp, tail, (Tcl_Namespace *) nsPtr,
proc, clientData, deleteProc);
}
/* Command already exists. */
Tcl_Command
TclCreateObjCommandInNs (
Tcl_Interp *interp,
const char *cmdName, /* Name of command, without any namespace components */
Tcl_Namespace *namespace, /* The namespace to create the command in */
Tcl_ObjCmdProc *proc, /* Object-based function to associate with
* name. */
ClientData clientData, /* Arbitrary value to pass to object
* function. */
Tcl_CmdDeleteProc *deleteProc
/* If not NULL, gives a function to call when
* this command is deleted. */
) {
int deleted = 0, isNew = 0;
Command *cmdPtr;
ImportRef *oldRefPtr = NULL;
ImportedCmdData *dataPtr;
Tcl_HashEntry *hPtr;
Namespace *nsPtr = (Namespace *) namespace;
/*
* If the command name we seek to create already exists, we need to
* delete that first. That can be tricky in the presence of traces.
* Loop until we no longer find an existing command in the way, or
* until we've deleted one command and that didn't finish the job.
*/
while (1) {
hPtr = Tcl_CreateHashEntry(&nsPtr->cmdTable, cmdName, &isNew);
if (isNew || deleted) {
/*
* isNew - No conflict with existing command.
* deleted - We've already deleted a conflicting command
*/
break;
}
/* An existing command conflicts. Try to delete it.. */
cmdPtr = Tcl_GetHashValue(hPtr);
/*
* [***] This is wrong. See Tcl Bug a16752c252.
@@ -2297,25 +2360,32 @@ Tcl_CreateObjCommand(
cmdPtr->flags |= CMD_REDEF_IN_PROGRESS;
}
/* Make sure namespace doesn't get deallocated. */
cmdPtr->nsPtr->refCount++;
Tcl_DeleteCommandFromToken(interp, (Tcl_Command) cmdPtr);
nsPtr = (Namespace *) TclEnsureNamespace(interp,
(Tcl_Namespace *)cmdPtr->nsPtr);
TclNsDecrRefCount(cmdPtr->nsPtr);
if (cmdPtr->flags & CMD_REDEF_IN_PROGRESS) {
oldRefPtr = cmdPtr->importRefPtr;
cmdPtr->importRefPtr = NULL;
}
TclCleanupCommandMacro(cmdPtr);
deleted = 1;
}
if (!isNew) {
/*
* If the deletion callback recreated the command, just throw away
* the new command (if we try to delete it again, we could get
* stuck in an infinite loop).
*/
hPtr = Tcl_CreateHashEntry(&nsPtr->cmdTable, tail, &isNew);
if (!isNew) {
/*
* If the deletion callback recreated the command, just throw away
* the new command (if we try to delete it again, we could get
* stuck in an infinite loop).
*/
ckfree(Tcl_GetHashValue(hPtr));
}
ckfree(Tcl_GetHashValue(hPtr));
}
} else {
if (!deleted) {
/*
* Command resolvers (per-interp, per-namespace) might have resolved
* to a command for the given namespace scope with this command not
@@ -2326,7 +2396,7 @@ Tcl_CreateObjCommand(
* commands.
*/
TclInvalidateCmdLiteral(interp, tail, nsPtr);
TclInvalidateCmdLiteral(interp, cmdName, nsPtr);
/*
* The list of command exported from the namespace might have changed.
@@ -2335,6 +2405,7 @@ Tcl_CreateObjCommand(
*/
TclInvalidateNsCmdLookup(nsPtr);
TclInvalidateNsPath(nsPtr);
}
cmdPtr = ckalloc(sizeof(Command));
Tcl_SetHashValue(hPtr, cmdPtr);
@@ -2362,7 +2433,7 @@ Tcl_CreateObjCommand(
if (oldRefPtr != NULL) {
cmdPtr->importRefPtr = oldRefPtr;
while (oldRefPtr != NULL) {
refCmdPtr = oldRefPtr->importedCmdPtr;
Command *refCmdPtr = oldRefPtr->importedCmdPtr;
dataPtr = refCmdPtr->objClientData;
dataPtr->realCmdPtr = cmdPtr;
oldRefPtr = oldRefPtr->nextPtr;
@@ -3070,7 +3141,7 @@ Tcl_DeleteCommandFromToken(
/*
* We must delete this command, even though both traces and delete procs
* may try to avoid this (renaming the command etc). Also traces and
* delete procs may try to delete the command themsevles. This flag
* delete procs may try to delete the command themselves. This flag
* declares that a delete is in progress and that recursive deletes should
* be ignored.
*/
@@ -3082,6 +3153,7 @@ Tcl_DeleteCommandFromToken(
* traces.
*/
cmdPtr->nsPtr->refCount++;
if (cmdPtr->tracePtr != NULL) {
CommandTrace *tracePtr;
CallCommandTraces(iPtr,cmdPtr,NULL,NULL,TCL_TRACE_DELETE);
@@ -3109,6 +3181,7 @@ Tcl_DeleteCommandFromToken(
*/
TclInvalidateNsCmdLookup(cmdPtr->nsPtr);
TclNsDecrRefCount(cmdPtr->nsPtr);
/*
* If the command being deleted has a compile function, increment the
@@ -4535,7 +4608,7 @@ TEOV_Exception(
if (result == TCL_RETURN) {
result = TclUpdateReturnInfo(iPtr);
}
if ((result != TCL_ERROR) && !allowExceptions) {
if ((result != TCL_OK) && (result != TCL_ERROR) && !allowExceptions) {
ProcessUnexpectedResult(interp, result);
result = TCL_ERROR;
}
@@ -4716,7 +4789,7 @@ TEOV_RunEnterTraces(
{
Interp *iPtr = (Interp *) interp;
Command *cmdPtr = *cmdPtrPtr;
size_t newEpoch, cmdEpoch = cmdPtr->cmdEpoch;
unsigned int newEpoch, cmdEpoch = cmdPtr->cmdEpoch;
int length, traceCode = TCL_OK;
const char *command = TclGetStringFromObj(commandPtr, &length);
@@ -7418,7 +7491,7 @@ ExprAbsFunc(
}
goto unChanged;
} else if (l == LONG_MIN) {
TclBNInitBignumFromLong(&big, l);
TclInitBignumFromLong(&big, l);
goto tooLarge;
}
Tcl_SetObjResult(interp, Tcl_NewLongObj(-l));
@@ -7453,7 +7526,7 @@ ExprAbsFunc(
goto unChanged;
}
if (w == LLONG_MIN) {
TclBNInitBignumFromWideInt(&big, w);
TclInitBignumFromWideInt(&big, w);
goto tooLarge;
}
Tcl_SetObjResult(interp, Tcl_NewWideIntObj(-w));
@@ -7657,6 +7730,71 @@ ExprWideFunc(
return TCL_OK;
}
/*
* Common implmentation of max() and min().
*/
static int
ExprMaxMinFunc(
ClientData clientData, /* Ignored. */
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count. */
Tcl_Obj *const *objv, /* Actual parameter vector. */
int op) /* Comparison direction */
{
Tcl_Obj *res;
double d;
int type, i;
ClientData ptr;
if (objc < 2) {
MathFuncWrongNumArgs(interp, 2, objc, objv);
return TCL_ERROR;
}
res = objv[1];
for (i = 1; i < objc; i++) {
if (TclGetNumberFromObj(interp, objv[i], &ptr, &type) != TCL_OK) {
return TCL_ERROR;
}
if (type == TCL_NUMBER_NAN) {
/*
* Get the error message for NaN.
*/
Tcl_GetDoubleFromObj(interp, objv[i], &d);
return TCL_ERROR;
}
if (TclCompareTwoNumbers(objv[i], res) == op) {
res = objv[i];
}
}
Tcl_SetObjResult(interp, res);
return TCL_OK;
}
static int
ExprMaxFunc(
ClientData clientData, /* Ignored. */
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count. */
Tcl_Obj *const *objv) /* Actual parameter vector. */
{
return ExprMaxMinFunc(clientData, interp, objc, objv, MP_GT);
}
static int
ExprMinFunc(
ClientData clientData, /* Ignored. */
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count. */
Tcl_Obj *const *objv) /* Actual parameter vector. */
{
return ExprMaxMinFunc(clientData, interp, objc, objv, MP_LT);
}
static int
ExprRandFunc(
ClientData clientData, /* Ignored. */
@@ -7680,8 +7818,8 @@ ExprRandFunc(
iPtr->flags |= RAND_SEED_INITIALIZED;
/*
* Take into consideration the thread this interp is running in order
* to insure different seeds in different threads (bug #416643)
* To ensure different seeds in different threads (bug #416643),
* take into consideration the thread this interp is running in.
*/
iPtr->randSeed = TclpGetClicks() + (PTR2INT(Tcl_GetCurrentThread())<<12);
@@ -8145,6 +8283,22 @@ Tcl_NRCreateCommand(
cmdPtr->nreProc = nreProc;
return (Tcl_Command) cmdPtr;
}
Tcl_Command
TclNRCreateCommandInNs (
Tcl_Interp *interp,
const char *cmdName,
Tcl_Namespace *nsPtr,
Tcl_ObjCmdProc *proc,
Tcl_ObjCmdProc *nreProc,
ClientData clientData,
Tcl_CmdDeleteProc *deleteProc) {
Command *cmdPtr = (Command *)
TclCreateObjCommandInNs(interp,cmdName,nsPtr,proc,clientData,deleteProc);
cmdPtr->nreProc = nreProc;
return (Tcl_Command) cmdPtr;
}
/****************************************************************************
* Stuff for the public api
@@ -8930,9 +9084,9 @@ TclNRCoroutineObjCmd(
{
Command *cmdPtr;
CoroutineData *corPtr;
const char *fullName, *procName;
Namespace *nsPtr, *altNsPtr, *cxtNsPtr;
Tcl_DString ds;
const char *procName, *simpleName;
Namespace *nsPtr, *altNsPtr, *cxtNsPtr,
*inNsPtr = (Namespace *)TclGetCurrentNamespace(interp);
Namespace *lookupNsPtr = iPtr->varFramePtr->nsPtr;
if (objc < 3) {
@@ -8940,34 +9094,21 @@ TclNRCoroutineObjCmd(
return TCL_ERROR;
}
/*
* FIXME: this is copy/pasted from Tcl_ProcObjCommand. Should have
* something in tclUtil.c to find the FQ name.
*/
fullName = TclGetString(objv[1]);
TclGetNamespaceForQualName(interp, fullName, NULL, 0,
&nsPtr, &altNsPtr, &cxtNsPtr, &procName);
procName = TclGetString(objv[1]);
TclGetNamespaceForQualName(interp, procName, inNsPtr, 0,
&nsPtr, &altNsPtr, &cxtNsPtr, &simpleName);
if (nsPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't create procedure \"%s\": unknown namespace",
fullName));
procName));
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "NAMESPACE", NULL);
return TCL_ERROR;
}
if (procName == NULL) {
if (simpleName == NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't create procedure \"%s\": bad procedure name",
fullName));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "COMMAND", fullName, NULL);
return TCL_ERROR;
}
if ((nsPtr != iPtr->globalNsPtr)
&& (procName != NULL) && (procName[0] == ':')) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't create procedure \"%s\" in non-global namespace with"
" name starting with \":\"", procName));
procName));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "COMMAND", procName, NULL);
return TCL_ERROR;
}
@@ -8979,16 +9120,9 @@ TclNRCoroutineObjCmd(
corPtr = ckalloc(sizeof(CoroutineData));
Tcl_DStringInit(&ds);
if (nsPtr != iPtr->globalNsPtr) {
Tcl_DStringAppend(&ds, nsPtr->fullName, -1);
TclDStringAppendLiteral(&ds, "::");
}
Tcl_DStringAppend(&ds, procName, -1);
cmdPtr = (Command *) Tcl_NRCreateCommand(interp, Tcl_DStringValue(&ds),
/*objProc*/ NULL, TclNRInterpCoroutine, corPtr, DeleteCoroutine);
Tcl_DStringFree(&ds);
cmdPtr = (Command *) TclNRCreateCommandInNs(interp, simpleName,
(Tcl_Namespace *)nsPtr, /*objProc*/ NULL, TclNRInterpCoroutine,
corPtr, DeleteCoroutine);
corPtr->cmdPtr = cmdPtr;
cmdPtr->refCount++;
@@ -9049,7 +9183,7 @@ TclNRCoroutineObjCmd(
TclNRAddCallback(interp, NRCoroutineExitCallback, corPtr,
NULL, NULL, NULL);
/* insure that the command is looked up in the correct namespace */
/* ensure that the command is looked up in the correct namespace */
iPtr->lookupNsPtr = lookupNsPtr;
Tcl_NREvalObj(interp, Tcl_NewListObj(objc-2, objv+2), 0);
iPtr->numLevels--;
+4 -4
View File
@@ -536,7 +536,7 @@ SetByteArrayFromAny(
const char *src, *srcEnd;
unsigned char *dst;
ByteArray *byteArrayPtr;
Tcl_UniChar ch;
Tcl_UniChar ch = 0;
if (objPtr->typePtr == &properByteArrayType) {
return TCL_OK;
@@ -1300,7 +1300,7 @@ BinaryFormatCmd(
badField:
{
Tcl_UniChar ch;
Tcl_UniChar ch = 0;
char buf[TCL_UTF_MAX + 1];
TclUtfToUniChar(errorString, &ch);
@@ -1670,7 +1670,7 @@ BinaryScanCmd(
badField:
{
Tcl_UniChar ch;
Tcl_UniChar ch = 0;
char buf[TCL_UTF_MAX + 1];
TclUtfToUniChar(errorString, &ch);
@@ -2284,7 +2284,7 @@ ScanNumber(
Tcl_Obj *bigObj = NULL;
mp_int big;
TclBNInitBignumFromWideUInt(&big, uwvalue);
TclInitBignumFromWideUInt(&big, uwvalue);
bigObj = Tcl_NewBignumObj(&big);
return bigObj;
}
+3 -3
View File
@@ -2945,7 +2945,7 @@ Tcl_LsearchObjCmd(
double patDouble, objDouble;
SortInfo sortInfo;
Tcl_Obj *patObj, **listv, *listPtr, *startPtr, *itemPtr;
SortStrCmpFn_t strCmpFn = strcmp;
SortStrCmpFn_t strCmpFn = TclUtfCmp;
Tcl_RegExp regexp = NULL;
static const char *const options[] = {
"-all", "-ascii", "-bisect", "-decreasing", "-dictionary",
@@ -4263,7 +4263,7 @@ SortCompare(
int order = 0;
if (infoPtr->sortMode == SORTMODE_ASCII) {
order = strcmp(elemPtr1->collationKey.strValuePtr,
order = TclUtfCmp(elemPtr1->collationKey.strValuePtr,
elemPtr2->collationKey.strValuePtr);
} else if (infoPtr->sortMode == SORTMODE_ASCII_NC) {
order = TclUtfCasecmp(elemPtr1->collationKey.strValuePtr,
@@ -4370,7 +4370,7 @@ static int
DictionaryCompare(
const char *left, const char *right) /* The strings to compare. */
{
Tcl_UniChar uniLeft, uniRight, uniLeftLower, uniRightLower;
Tcl_UniChar uniLeft = 0, uniRight = 0, uniLeftLower, uniRightLower;
int diff, zeros;
int secondaryDiff = 0;
+36 -21
View File
@@ -309,7 +309,7 @@ Tcl_RegexpObjCmd(
eflags = 0;
} else if (offset > stringLength) {
eflags = TCL_REG_NOTBOL;
} else if (Tcl_GetUniChar(objPtr, offset-1) == (Tcl_UniChar)'\n') {
} else if (Tcl_GetUniChar(objPtr, offset-1) == '\n') {
eflags = 0;
} else {
eflags = TCL_REG_NOTBOL;
@@ -487,11 +487,10 @@ Tcl_RegsubObjCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
int idx, result, cflags, all, wlen, wsublen, numMatches, offset;
int start, end, subStart, subEnd, match, command, numParts, numArgs;
int start, end, subStart, subEnd, match, command, numParts;
Tcl_RegExp regExpr;
Tcl_RegExpInfo info;
Tcl_Obj *resultPtr, *subPtr, *objPtr, *startIndex = NULL;
Tcl_Obj **args = NULL, **parts;
Tcl_UniChar ch, *wsrc, *wfirstChar, *wstring, *wsubspec, *wend;
static const char *const options[] = {
@@ -773,12 +772,13 @@ Tcl_RegsubObjCmd(
*/
if (command) {
if (args == NULL) {
Tcl_ListObjGetElements(interp, subPtr, &numParts, &parts);
numArgs = numParts + info.nsubs + 1;
args = ckalloc(sizeof(Tcl_Obj*) * numArgs);
memcpy(args, parts, sizeof(Tcl_Obj*) * numParts);
}
Tcl_Obj **args = NULL, **parts;
int numArgs;
Tcl_ListObjGetElements(interp, subPtr, &numParts, &parts);
numArgs = numParts + info.nsubs + 1;
args = ckalloc(sizeof(Tcl_Obj*) * numArgs);
memcpy(args, parts, sizeof(Tcl_Obj*) * numParts);
for (idx = 0 ; idx <= info.nsubs ; idx++) {
subStart = info.matches[idx].start;
@@ -800,13 +800,14 @@ Tcl_RegsubObjCmd(
* because Tcl_EvalObjv is "hairy monster" in terms of refcount
* handling, being able to optionally add references to any of its
* argument words. We'll drop the local refs immediately
* afterwarsds; subPtr is handled in the main exit stanza.
* afterwards; subPtr is handled in the main exit stanza.
*/
result = Tcl_EvalObjv(interp, numArgs, args, 0);
for (idx = 0 ; idx <= info.nsubs ; idx++) {
TclDecrRefCount(args[idx + numParts]);
}
ckfree(args);
if (result != TCL_OK) {
if (result == TCL_ERROR) {
Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
@@ -975,9 +976,6 @@ Tcl_RegsubObjCmd(
if (subPtr && (objv[2] == objv[0])) {
Tcl_DecrRefCount(subPtr);
}
if (args) {
ckfree(args);
}
if (resultPtr) {
Tcl_DecrRefCount(resultPtr);
}
@@ -1175,7 +1173,7 @@ Tcl_SplitObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tcl_UniChar ch;
Tcl_UniChar ch = 0;
int len;
const char *splitChars;
const char *stringPtr;
@@ -1218,13 +1216,22 @@ Tcl_SplitObjCmd(
Tcl_InitHashTable(&charReuseTable, TCL_ONE_WORD_KEYS);
for ( ; stringPtr < end; stringPtr += len) {
int fullchar;
len = TclUtfToUniChar(stringPtr, &ch);
fullchar = ch;
#if TCL_UTF_MAX == 4
if (!len) {
len += TclUtfToUniChar(stringPtr, &ch);
fullchar = (((fullchar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000;
}
#endif
/*
* Assume Tcl_UniChar is an integral type...
*/
hPtr = Tcl_CreateHashEntry(&charReuseTable, INT2PTR((int) ch),
hPtr = Tcl_CreateHashEntry(&charReuseTable, INT2PTR(fullchar),
&isNew);
if (isNew) {
TclNewStringObj(objPtr, stringPtr, len);
@@ -1260,7 +1267,7 @@ Tcl_SplitObjCmd(
} else {
const char *element, *p, *splitEnd;
int splitLen;
Tcl_UniChar splitChar;
Tcl_UniChar splitChar = 0;
/*
* Normal case: split on any of a given set of characters. Discard
@@ -1484,7 +1491,7 @@ StringIsCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
const char *string1, *end, *stop;
Tcl_UniChar ch;
Tcl_UniChar ch = 0;
int (*chcomp)(int) = NULL; /* The UniChar comparison function. */
int i, failat = 0, result = 1, strict = 0, index, length1, length2;
Tcl_Obj *objPtr, *failVarObj = NULL;
@@ -1816,8 +1823,16 @@ StringIsCmd(
}
end = string1 + length1;
for (; string1 < end; string1 += length2, failat++) {
int fullchar;
length2 = TclUtfToUniChar(string1, &ch);
if (!chcomp(ch)) {
fullchar = ch;
#if TCL_UTF_MAX == 4
if (!length2) {
length2 = TclUtfToUniChar(string1, &ch);
fullchar = (((fullchar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000;
}
#endif
if (!chcomp(fullchar)) {
result = 0;
break;
}
@@ -2412,7 +2427,7 @@ StringStartCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tcl_UniChar ch;
Tcl_UniChar ch = 0;
const char *p, *string;
int cur, index, length, numChars;
@@ -2473,7 +2488,7 @@ StringEndCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tcl_UniChar ch;
Tcl_UniChar ch = 0;
const char *p, *end, *string;
int cur, index, length, numChars;
@@ -3532,7 +3547,7 @@ TclNRSwitchObjCmd(
OPT_LAST
};
typedef int (*strCmpFn_t)(const char *, const char *);
strCmpFn_t strCmpFn = strcmp;
strCmpFn_t strCmpFn = TclUtfCmp;
mode = OPT_EXACT;
foundmode = 0;
+1 -1
View File
@@ -1885,7 +1885,7 @@ ParseLexeme(
{
const char *end;
int scanned;
Tcl_UniChar ch;
Tcl_UniChar ch = 0;
Tcl_Obj *literal = NULL;
unsigned char byte;
+2 -2
View File
@@ -425,11 +425,11 @@ typedef struct ByteCode {
* compiled. If the code is executed if a
* different namespace, it must be
* recompiled. */
size_t nsEpoch; /* Value of nsPtr->resolverEpoch when this
unsigned int nsEpoch; /* Value of nsPtr->resolverEpoch when this
* ByteCode was compiled. Used to invalidate
* code when new namespace resolution rules
* are put into effect. */
int refCount; /* Reference count: set 1 when created plus 1
unsigned int refCount; /* Reference count: set 1 when created plus 1
* for each execution of the code currently
* active. This structure can be freed when
* refCount becomes zero. */
+30 -14
View File
@@ -23,6 +23,15 @@
# endif
#endif
#if !defined(BUILD_tcl)
# define TCL_DEPRECATED(msg) EXTERN TCL_DEPRECATED_API(msg)
#elif defined(TCL_NO_DEPRECATED)
# define TCL_DEPRECATED(msg) MODULE_SCOPE
#else
# define TCL_DEPRECATED(msg) EXTERN
#endif
/*
* WARNING: This file is automatically generated by the tools/genStubs.tcl
* script. Any modifications to the function declarations below should be made
@@ -660,7 +669,8 @@ EXTERN int Tcl_ScanElement(const char *src, int *flagPtr);
EXTERN int Tcl_ScanCountedElement(const char *src, int length,
int *flagPtr);
/* 220 */
EXTERN int Tcl_SeekOld(Tcl_Channel chan, int offset, int mode);
TCL_DEPRECATED("")
int Tcl_SeekOld(Tcl_Channel chan, int offset, int mode);
/* 221 */
EXTERN int Tcl_ServiceAll(void);
/* 222 */
@@ -732,7 +742,8 @@ EXTERN void Tcl_StaticPackage(Tcl_Interp *interp,
/* 245 */
EXTERN int Tcl_StringMatch(const char *str, const char *pattern);
/* 246 */
EXTERN int Tcl_TellOld(Tcl_Channel chan);
TCL_DEPRECATED("")
int Tcl_TellOld(Tcl_Channel chan);
/* 247 */
EXTERN int Tcl_TraceVar(Tcl_Interp *interp, const char *varName,
int flags, Tcl_VarTraceProc *proc,
@@ -803,10 +814,12 @@ EXTERN int Tcl_DumpActiveMemory(const char *fileName);
/* 266 */
EXTERN void Tcl_ValidateAllMemory(const char *file, int line);
/* 267 */
EXTERN void Tcl_AppendResultVA(Tcl_Interp *interp,
TCL_DEPRECATED("see TIP #422")
void Tcl_AppendResultVA(Tcl_Interp *interp,
va_list argList);
/* 268 */
EXTERN void Tcl_AppendStringsToObjVA(Tcl_Obj *objPtr,
TCL_DEPRECATED("see TIP #422")
void Tcl_AppendStringsToObjVA(Tcl_Obj *objPtr,
va_list argList);
/* 269 */
EXTERN char * Tcl_HashStats(Tcl_HashTable *tablePtr);
@@ -829,14 +842,17 @@ EXTERN CONST84_RETURN char * Tcl_PkgRequire(Tcl_Interp *interp,
const char *name, const char *version,
int exact);
/* 275 */
EXTERN void Tcl_SetErrorCodeVA(Tcl_Interp *interp,
TCL_DEPRECATED("see TIP #422")
void Tcl_SetErrorCodeVA(Tcl_Interp *interp,
va_list argList);
/* 276 */
EXTERN int Tcl_VarEvalVA(Tcl_Interp *interp, va_list argList);
TCL_DEPRECATED("see TIP #422")
int Tcl_VarEvalVA(Tcl_Interp *interp, va_list argList);
/* 277 */
EXTERN Tcl_Pid Tcl_WaitPid(Tcl_Pid pid, int *statPtr, int options);
/* 278 */
EXTERN TCL_NORETURN void Tcl_PanicVA(const char *format, va_list argList);
TCL_DEPRECATED("see TIP #422")
TCL_NORETURN void Tcl_PanicVA(const char *format, va_list argList);
/* 279 */
EXTERN void Tcl_GetVersion(int *major, int *minor,
int *patchLevel, int *type);
@@ -2077,7 +2093,7 @@ typedef struct TclStubs {
void (*tcl_ResetResult) (Tcl_Interp *interp); /* 217 */
int (*tcl_ScanElement) (const char *src, int *flagPtr); /* 218 */
int (*tcl_ScanCountedElement) (const char *src, int length, int *flagPtr); /* 219 */
int (*tcl_SeekOld) (Tcl_Channel chan, int offset, int mode); /* 220 */
TCL_DEPRECATED_API("") int (*tcl_SeekOld) (Tcl_Channel chan, int offset, int mode); /* 220 */
int (*tcl_ServiceAll) (void); /* 221 */
int (*tcl_ServiceEvent) (int flags); /* 222 */
void (*tcl_SetAssocData) (Tcl_Interp *interp, const char *name, Tcl_InterpDeleteProc *proc, ClientData clientData); /* 223 */
@@ -2103,7 +2119,7 @@ typedef struct TclStubs {
void (*tcl_SplitPath) (const char *path, int *argcPtr, CONST84 char ***argvPtr); /* 243 */
void (*tcl_StaticPackage) (Tcl_Interp *interp, const char *pkgName, Tcl_PackageInitProc *initProc, Tcl_PackageInitProc *safeInitProc); /* 244 */
int (*tcl_StringMatch) (const char *str, const char *pattern); /* 245 */
int (*tcl_TellOld) (Tcl_Channel chan); /* 246 */
TCL_DEPRECATED_API("") int (*tcl_TellOld) (Tcl_Channel chan); /* 246 */
int (*tcl_TraceVar) (Tcl_Interp *interp, const char *varName, int flags, Tcl_VarTraceProc *proc, ClientData clientData); /* 247 */
int (*tcl_TraceVar2) (Tcl_Interp *interp, const char *part1, const char *part2, int flags, Tcl_VarTraceProc *proc, ClientData clientData); /* 248 */
char * (*tcl_TranslateFileName) (Tcl_Interp *interp, const char *name, Tcl_DString *bufferPtr); /* 249 */
@@ -2124,18 +2140,18 @@ typedef struct TclStubs {
void (*tcl_WrongNumArgs) (Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], const char *message); /* 264 */
int (*tcl_DumpActiveMemory) (const char *fileName); /* 265 */
void (*tcl_ValidateAllMemory) (const char *file, int line); /* 266 */
void (*tcl_AppendResultVA) (Tcl_Interp *interp, va_list argList); /* 267 */
void (*tcl_AppendStringsToObjVA) (Tcl_Obj *objPtr, va_list argList); /* 268 */
TCL_DEPRECATED_API("see TIP #422") void (*tcl_AppendResultVA) (Tcl_Interp *interp, va_list argList); /* 267 */
TCL_DEPRECATED_API("see TIP #422") void (*tcl_AppendStringsToObjVA) (Tcl_Obj *objPtr, va_list argList); /* 268 */
char * (*tcl_HashStats) (Tcl_HashTable *tablePtr); /* 269 */
CONST84_RETURN char * (*tcl_ParseVar) (Tcl_Interp *interp, const char *start, CONST84 char **termPtr); /* 270 */
CONST84_RETURN char * (*tcl_PkgPresent) (Tcl_Interp *interp, const char *name, const char *version, int exact); /* 271 */
CONST84_RETURN char * (*tcl_PkgPresentEx) (Tcl_Interp *interp, const char *name, const char *version, int exact, void *clientDataPtr); /* 272 */
int (*tcl_PkgProvide) (Tcl_Interp *interp, const char *name, const char *version); /* 273 */
CONST84_RETURN char * (*tcl_PkgRequire) (Tcl_Interp *interp, const char *name, const char *version, int exact); /* 274 */
void (*tcl_SetErrorCodeVA) (Tcl_Interp *interp, va_list argList); /* 275 */
int (*tcl_VarEvalVA) (Tcl_Interp *interp, va_list argList); /* 276 */
TCL_DEPRECATED_API("see TIP #422") void (*tcl_SetErrorCodeVA) (Tcl_Interp *interp, va_list argList); /* 275 */
TCL_DEPRECATED_API("see TIP #422") int (*tcl_VarEvalVA) (Tcl_Interp *interp, va_list argList); /* 276 */
Tcl_Pid (*tcl_WaitPid) (Tcl_Pid pid, int *statPtr, int options); /* 277 */
TCL_NORETURN1 void (*tcl_PanicVA) (const char *format, va_list argList); /* 278 */
TCL_DEPRECATED_API("see TIP #422") 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 */
+14 -15
View File
@@ -141,7 +141,7 @@ typedef struct Dict {
* the dictionary. Used for doing traversal of
* the entries in the order that they are
* created. */
int epoch; /* Epoch counter */
unsigned int epoch; /* Epoch counter */
size_t refCount; /* Reference counter (see above) */
Tcl_Obj *chain; /* Linked list used for invalidating the
* string representations of updated nested
@@ -390,7 +390,7 @@ DupDictInternalRep(
* Initialise other fields.
*/
newDict->epoch = 0;
newDict->epoch = 1;
newDict->chain = NULL;
newDict->refCount = 1;
@@ -487,15 +487,14 @@ static void
UpdateStringOfDict(
Tcl_Obj *dictPtr)
{
#define LOCAL_SIZE 20
int localFlags[LOCAL_SIZE], *flagPtr = NULL;
#define LOCAL_SIZE 64
char localFlags[LOCAL_SIZE], *flagPtr = NULL;
Dict *dict = DICT(dictPtr);
ChainEntry *cPtr;
Tcl_Obj *keyPtr, *valuePtr;
int i, length, bytesNeeded = 0;
const char *elem;
char *dst;
const int maxFlags = UINT_MAX / sizeof(int);
/*
* This field is the most useful one in the whole hash structure, and it
@@ -517,10 +516,8 @@ UpdateStringOfDict(
if (numElems <= LOCAL_SIZE) {
flagPtr = localFlags;
} else if (numElems > maxFlags) {
Tcl_Panic("max size for a Tcl value (%d bytes) exceeded", INT_MAX);
} else {
flagPtr = ckalloc(numElems * sizeof(int));
flagPtr = ckalloc(numElems);
}
for (i=0,cPtr=dict->entryChainHead; i<numElems; i+=2,cPtr=cPtr->nextPtr) {
/*
@@ -710,7 +707,7 @@ SetDictFromAny(
*/
TclFreeIntRep(objPtr);
dict->epoch = 0;
dict->epoch = 1;
dict->chain = NULL;
dict->refCount = 1;
DICT(objPtr) = dict;
@@ -1109,7 +1106,7 @@ Tcl_DictObjFirst(
dict = DICT(dictPtr);
cPtr = dict->entryChainHead;
if (cPtr == NULL) {
searchPtr->epoch = -1;
searchPtr->epoch = 0;
*donePtr = 1;
} else {
*donePtr = 0;
@@ -1170,7 +1167,7 @@ Tcl_DictObjNext(
* If the searh is done; we do no work.
*/
if (searchPtr->epoch == -1) {
if (!searchPtr->epoch) {
*donePtr = 1;
return;
}
@@ -1227,8 +1224,8 @@ Tcl_DictObjDone(
{
Dict *dict;
if (searchPtr->epoch != -1) {
searchPtr->epoch = -1;
if (searchPtr->epoch) {
searchPtr->epoch = 0;
dict = (Dict *) searchPtr->dictionaryPtr;
if (dict->refCount-- <= 1) {
DeleteDict(dict);
@@ -1380,7 +1377,7 @@ Tcl_NewDictObj(void)
TclInvalidateStringRep(dictPtr);
dict = ckalloc(sizeof(Dict));
InitChainTable(dict);
dict->epoch = 0;
dict->epoch = 1;
dict->chain = NULL;
dict->refCount = 1;
DICT(dictPtr) = dict;
@@ -1430,7 +1427,7 @@ Tcl_DbNewDictObj(
TclInvalidateStringRep(dictPtr);
dict = ckalloc(sizeof(Dict));
InitChainTable(dict);
dict->epoch = 0;
dict->epoch = 1;
dict->chain = NULL;
dict->refCount = 1;
DICT(dictPtr) = dict;
@@ -2331,7 +2328,9 @@ DictAppendCmd(
valuePtr = Tcl_DuplicateObj(valuePtr);
}
Tcl_IncrRefCount(appendObjPtr);
Tcl_AppendObjToObj(valuePtr, appendObjPtr);
Tcl_DecrRefCount(appendObjPtr);
}
Tcl_DictObjPut(NULL, dictPtr, objv[2], valuePtr);
+2 -2
View File
@@ -254,7 +254,7 @@ DisassembleByteCodeObj(
Tcl_Obj *bufferObj, *fileObj;
TclNewObj(bufferObj);
if (codePtr->refCount <= 0) {
if (!codePtr->refCount) {
return bufferObj; /* Already freed. */
}
@@ -312,7 +312,7 @@ DisassembleByteCodeObj(
int numCompiledLocals = procPtr->numCompiledLocals;
Tcl_AppendPrintfToObj(bufferObj,
" Proc %p, refCt %d, args %d, compiled locals %d\n",
" Proc %p, refCt %u, args %d, compiled locals %d\n",
procPtr, procPtr->refCount, procPtr->numArgs,
numCompiledLocals);
if (numCompiledLocals > 0) {
+75 -62
View File
@@ -18,7 +18,7 @@ typedef size_t (LengthProc)(const char *src);
* convert between various character sets and UTF-8.
*/
typedef struct Encoding {
typedef struct {
char *name; /* Name of encoding. Malloced because (1) hash
* table entry that owns this encoding may be
* freed prior to this encoding being freed,
@@ -57,7 +57,7 @@ typedef struct Encoding {
* encoding.
*/
typedef struct TableEncodingData {
typedef struct {
int fallback; /* Character (in this encoding) to substitute
* when this encoding cannot represent a UTF-8
* character. */
@@ -91,7 +91,7 @@ typedef struct TableEncodingData {
* for switching character sets.
*/
typedef struct EscapeSubTable {
typedef struct {
unsigned sequenceLen; /* Length of following string. */
char sequence[16]; /* Escape code that marks this encoding. */
char name[32]; /* Name for encoding. */
@@ -100,7 +100,7 @@ typedef struct EscapeSubTable {
* yet. */
} EscapeSubTable;
typedef struct EscapeEncodingData {
typedef struct {
int fallback; /* Character (in this encoding) to substitute
* when this encoding cannot represent a UTF-8
* character. */
@@ -563,7 +563,7 @@ TclInitEncodingSubsystem(void)
* formed UTF-8 into a properly formed stream.
*/
type.encodingName = "identity";
type.encodingName = NULL;
type.toUtfProc = BinaryProc;
type.fromUtfProc = BinaryProc;
type.freeProc = NULL;
@@ -851,7 +851,9 @@ FreeEncoding(
if (encodingPtr->hPtr != NULL) {
Tcl_DeleteHashEntry(encodingPtr->hPtr);
}
ckfree(encodingPtr->name);
if (encodingPtr->name) {
ckfree(encodingPtr->name);
}
ckfree(encodingPtr);
}
}
@@ -1040,27 +1042,8 @@ Tcl_CreateEncoding(
const Tcl_EncodingType *typePtr)
/* The encoding type. */
{
Tcl_HashEntry *hPtr;
int isNew;
Encoding *encodingPtr;
char *name;
Tcl_MutexLock(&encodingMutex);
hPtr = Tcl_CreateHashEntry(&encodingTable, typePtr->encodingName, &isNew);
if (isNew == 0) {
/*
* Remove old encoding from hash table, but don't delete it until last
* reference goes away.
*/
encodingPtr = Tcl_GetHashValue(hPtr);
encodingPtr->hPtr = NULL;
}
name = ckalloc(strlen(typePtr->encodingName) + 1);
encodingPtr = ckalloc(sizeof(Encoding));
encodingPtr->name = strcpy(name, typePtr->encodingName);
Encoding *encodingPtr = ckalloc(sizeof(Encoding));
encodingPtr->name = NULL;
encodingPtr->toUtfProc = typePtr->toUtfProc;
encodingPtr->fromUtfProc = typePtr->fromUtfProc;
encodingPtr->freeProc = typePtr->freeProc;
@@ -1072,11 +1055,32 @@ Tcl_CreateEncoding(
encodingPtr->lengthProc = (LengthProc *) unilen;
}
encodingPtr->refCount = 1;
encodingPtr->hPtr = NULL;
if (typePtr->encodingName) {
Tcl_HashEntry *hPtr;
int isNew;
char *name;
Tcl_MutexLock(&encodingMutex);
hPtr = Tcl_CreateHashEntry(&encodingTable, typePtr->encodingName, &isNew);
if (isNew == 0) {
/*
* Remove old encoding from hash table, but don't delete it until last
* reference goes away.
*/
Encoding *replaceMe = Tcl_GetHashValue(hPtr);
replaceMe->hPtr = NULL;
}
name = ckalloc(strlen(typePtr->encodingName) + 1);
encodingPtr->name = strcpy(name, typePtr->encodingName);
encodingPtr->hPtr = hPtr;
Tcl_SetHashValue(hPtr, encodingPtr);
Tcl_MutexUnlock(&encodingMutex);
}
return (Tcl_Encoding) encodingPtr;
}
@@ -2293,8 +2297,11 @@ UtfToUtfProc(
const char *srcStart, *srcEnd, *srcClose;
const char *dstStart, *dstEnd;
int result, numChars, charLimit = INT_MAX;
Tcl_UniChar ch;
Tcl_UniChar *chPtr = (Tcl_UniChar *) statePtr;
if (flags & TCL_ENCODING_START) {
*statePtr = 0;
}
result = TCL_OK;
srcStart = src;
@@ -2326,7 +2333,7 @@ UtfToUtfProc(
}
if (UCHAR(*src) < 0x80 && !(UCHAR(*src) == 0 && pureNullMode == 0)) {
/*
* Copy 7bit chatacters, but skip null-bytes when we are in input
* Copy 7bit characters, but skip null-bytes when we are in input
* mode, so that they get converted to 0xc080.
*/
@@ -2342,16 +2349,16 @@ UtfToUtfProc(
} else if (!Tcl_UtfCharComplete(src, srcEnd - src)) {
/*
* Always check before using TclUtfToUniChar. Not doing can so
* cause it run beyond the endof the buffer! If we happen such an
* incomplete char its byts are made to represent themselves.
* cause it run beyond the end of the buffer! If we happen such an
* incomplete char its bytes are made to represent themselves.
*/
ch = (unsigned char) *src;
*chPtr = (unsigned char) *src;
src += 1;
dst += Tcl_UniCharToUtf(ch, dst);
dst += Tcl_UniCharToUtf(*chPtr, dst);
} else {
src += TclUtfToUniChar(src, &ch);
dst += Tcl_UniCharToUtf(ch, dst);
src += TclUtfToUniChar(src, chPtr);
dst += Tcl_UniCharToUtf(*chPtr, dst);
}
}
@@ -2407,8 +2414,11 @@ UnicodeToUtfProc(
const char *srcStart, *srcEnd;
const char *dstEnd, *dstStart;
int result, numChars, charLimit = INT_MAX;
Tcl_UniChar ch;
Tcl_UniChar *chPtr = (Tcl_UniChar *) statePtr;
if (flags & TCL_ENCODING_START) {
*statePtr = 0;
}
if (flags & TCL_ENCODING_CHAR_LIMIT) {
charLimit = *dstCharsPtr;
}
@@ -2436,11 +2446,11 @@ UnicodeToUtfProc(
* Tcl_UniChar-size data.
*/
ch = *(Tcl_UniChar *)src;
if (ch && ch < 0x80) {
*dst++ = (ch & 0xFF);
*chPtr = *(Tcl_UniChar *)src;
if (*chPtr && *chPtr < 0x80) {
*dst++ = (*chPtr & 0xFF);
} else {
dst += Tcl_UniCharToUtf(ch, dst);
dst += Tcl_UniCharToUtf(*chPtr, dst);
}
src += sizeof(Tcl_UniChar);
}
@@ -2497,8 +2507,11 @@ UtfToUnicodeProc(
{
const char *srcStart, *srcEnd, *srcClose, *dstStart, *dstEnd;
int result, numChars;
Tcl_UniChar ch;
Tcl_UniChar *chPtr = (Tcl_UniChar *) statePtr;
if (flags & TCL_ENCODING_START) {
*statePtr = 0;
}
srcStart = src;
srcEnd = src + srcLen;
srcClose = srcEnd;
@@ -2524,7 +2537,7 @@ UtfToUnicodeProc(
result = TCL_CONVERT_NOSPACE;
break;
}
src += TclUtfToUniChar(src, &ch);
src += TclUtfToUniChar(src, chPtr);
/*
* Need to handle this in a way that won't cause misalignment by
@@ -2533,23 +2546,23 @@ UtfToUnicodeProc(
#ifdef WORDS_BIGENDIAN
#if TCL_UTF_MAX > 4
*dst++ = (ch >> 24);
*dst++ = ((ch >> 16) & 0xFF);
*dst++ = ((ch >> 8) & 0xFF);
*dst++ = (ch & 0xFF);
*dst++ = (*chPtr >> 24);
*dst++ = ((*chPtr >> 16) & 0xFF);
*dst++ = ((*chPtr >> 8) & 0xFF);
*dst++ = (*chPtr & 0xFF);
#else
*dst++ = (ch >> 8);
*dst++ = (ch & 0xFF);
*dst++ = (*chPtr >> 8);
*dst++ = (*chPtr & 0xFF);
#endif
#else
#if TCL_UTF_MAX > 4
*dst++ = (ch & 0xFF);
*dst++ = ((ch >> 8) & 0xFF);
*dst++ = ((ch >> 16) & 0xFF);
*dst++ = (ch >> 24);
*dst++ = (*chPtr & 0xFF);
*dst++ = ((*chPtr >> 8) & 0xFF);
*dst++ = ((*chPtr >> 16) & 0xFF);
*dst++ = (*chPtr >> 24);
#else
*dst++ = (ch & 0xFF);
*dst++ = (ch >> 8);
*dst++ = (*chPtr & 0xFF);
*dst++ = (*chPtr >> 8);
#endif
#endif
}
@@ -2607,7 +2620,7 @@ TableToUtfProc(
const char *srcStart, *srcEnd;
const char *dstEnd, *dstStart, *prefixBytes;
int result, byte, numChars, charLimit = INT_MAX;
Tcl_UniChar ch;
Tcl_UniChar ch = 0;
const unsigned short *const *toUnicode;
const unsigned short *pageZero;
TableEncodingData *dataPtr = clientData;
@@ -2719,7 +2732,7 @@ TableFromUtfProc(
{
const char *srcStart, *srcEnd, *srcClose;
const char *dstStart, *dstEnd, *prefixBytes;
Tcl_UniChar ch;
Tcl_UniChar ch = 0;
int result, len, word, numChars;
TableEncodingData *dataPtr = clientData;
const unsigned short *const *fromUnicode;
@@ -2853,7 +2866,7 @@ Iso88591ToUtfProc(
result = TCL_OK;
for (numChars = 0; src < srcEnd && numChars <= charLimit; numChars++) {
Tcl_UniChar ch;
Tcl_UniChar ch = 0;
if (dst > dstEnd) {
result = TCL_CONVERT_NOSPACE;
@@ -2939,7 +2952,7 @@ Iso88591FromUtfProc(
dstEnd = dst + dstLen - 1;
for (numChars = 0; src < srcEnd; numChars++) {
Tcl_UniChar ch;
Tcl_UniChar ch = 0;
int len;
if ((src > srcClose) && (!Tcl_UtfCharComplete(src, srcEnd - src))) {
@@ -3326,7 +3339,7 @@ EscapeFromUtfProc(
for (numChars = 0; src < srcEnd; numChars++) {
unsigned len;
int word;
Tcl_UniChar ch;
Tcl_UniChar ch = 0;
if ((src > srcClose) && (!Tcl_UtfCharComplete(src, srcEnd - src))) {
/*
@@ -3371,7 +3384,7 @@ EscapeFromUtfProc(
/*
* The state variable has the value of oldState when word is 0.
* In this case, the escape sequense should not be copied to dst
* In this case, the escape sequence should not be copied to dst
* because the current character set is not changed.
*/
@@ -3596,7 +3609,7 @@ unilen(
static void
InitializeEncodingSearchPath(
char **valuePtr,
size_t *lengthPtr,
unsigned int *lengthPtr,
Tcl_Encoding *encodingPtr)
{
const char *bytes;
+188 -150
View File
@@ -92,7 +92,7 @@ static const Tcl_ObjType ensembleCmdType = {
*/
typedef struct {
size_t epoch; /* Used to confirm when the data in this
unsigned int epoch; /* Used to confirm when the data in this
* really structure matches up with the
* ensemble. */
Command *token; /* Reference to the command for which this
@@ -146,10 +146,12 @@ TclNamespaceEnsembleCmd(
Tcl_Obj *const objv[])
{
Tcl_Namespace *namespacePtr;
Namespace *nsPtr = (Namespace *) TclGetCurrentNamespace(interp);
Namespace *nsPtr = (Namespace *) TclGetCurrentNamespace(interp), *cxtPtr,
*foundNsPtr, *altFoundNsPtr, *actualCxtPtr;
Tcl_Command token;
Tcl_DictSearch search;
Tcl_Obj *listObj;
const char *simpleName;
int index, done;
if (nsPtr == NULL || nsPtr->flags & NS_DYING) {
@@ -195,13 +197,8 @@ TclNamespaceEnsembleCmd(
objv += 2;
objc -= 2;
/*
* Work out what name to use for the command to create. If supplied,
* it is either fully specified or relative to the current namespace.
* If not supplied, it is exactly the name of the current namespace.
*/
name = nsPtr->fullName;
name = nsPtr->name;
cxtPtr = (Namespace *) nsPtr->parentPtr;
/*
* Parse the option list, applying type checks as we go. Note that we
@@ -221,6 +218,7 @@ TclNamespaceEnsembleCmd(
switch ((enum EnsCreateOpts) index) {
case CRT_CMD:
name = TclGetString(objv[1]);
cxtPtr = nsPtr;
continue;
case CRT_SUBCMDS:
if (TclListObjLength(interp, objv[1], &len) != TCL_OK) {
@@ -337,6 +335,10 @@ TclNamespaceEnsembleCmd(
}
}
TclGetNamespaceForQualName(interp, name, cxtPtr,
TCL_CREATE_NS_IF_UNKNOWN, &foundNsPtr, &altFoundNsPtr, &actualCxtPtr,
&simpleName);
/*
* Create the ensemble. Note that this might delete another ensemble
* linked to the same namespace, so we must be careful. However, we
@@ -344,8 +346,9 @@ TclNamespaceEnsembleCmd(
* we've created it (and after any deletions have occurred.)
*/
token = Tcl_CreateEnsemble(interp, name, NULL,
(permitPrefix ? TCL_ENSEMBLE_PREFIX : 0));
token = TclCreateEnsembleInNs(interp, simpleName,
(Tcl_Namespace *) foundNsPtr, (Tcl_Namespace *) nsPtr,
(permitPrefix ? TCL_ENSEMBLE_PREFIX : 0));
Tcl_SetEnsembleSubcommandList(interp, token, subcmdObj);
Tcl_SetEnsembleMappingDict(interp, token, mapObj);
Tcl_SetEnsembleUnknownHandler(interp, token, unknownObj);
@@ -636,48 +639,38 @@ TclNamespaceEnsembleCmd(
/*
*----------------------------------------------------------------------
*
* Tcl_CreateEnsemble --
* TclCreateEnsembleInNs --
*
* Create a simple ensemble attached to the given namespace.
*
* Results:
* The token for the command created.
*
* Side effects:
* The ensemble is created and marked for compilation.
* Like Tcl_CreateEnsemble, but additionally accepts as an argument the
* name of the namespace to create the command in.
*
*----------------------------------------------------------------------
*/
Tcl_Command
Tcl_CreateEnsemble(
TclCreateEnsembleInNs(
Tcl_Interp *interp,
const char *name,
Tcl_Namespace *namespacePtr,
int flags)
const char *name, /* Simple name of command to create (no */
/* namespace components). */
Tcl_Namespace /* Name of namespace to create the command in. */
*nameNsPtr,
Tcl_Namespace
*ensembleNsPtr, /* Name of the namespace for the ensemble. */
int flags
)
{
Namespace *nsPtr = (Namespace *) namespacePtr;
EnsembleConfig *ensemblePtr = ckalloc(sizeof(EnsembleConfig));
Tcl_Obj *nameObj = NULL;
Namespace *nsPtr = (Namespace *) ensembleNsPtr;
EnsembleConfig *ensemblePtr;
Tcl_Command token;
if (nsPtr == NULL) {
nsPtr = (Namespace *) TclGetCurrentNamespace(interp);
}
/*
* Make the name of the ensemble into a fully qualified name. This might
* allocate a temporary object.
*/
if (!(name[0] == ':' && name[1] == ':')) {
nameObj = NewNsObj((Tcl_Namespace *) nsPtr);
if (nsPtr->parentPtr == NULL) {
Tcl_AppendStringsToObj(nameObj, name, NULL);
} else {
Tcl_AppendStringsToObj(nameObj, "::", name, NULL);
}
Tcl_IncrRefCount(nameObj);
name = TclGetString(nameObj);
ensemblePtr = ckalloc(sizeof(EnsembleConfig));
token = TclNRCreateCommandInNs(interp, name,
(Tcl_Namespace *) nameNsPtr, NsEnsembleImplementationCmd,
NsEnsembleImplementationCmdNR, ensemblePtr, DeleteEnsembleConfig);
if (token == NULL) {
ckfree(ensemblePtr);
return NULL;
}
ensemblePtr->nsPtr = nsPtr;
@@ -690,9 +683,7 @@ Tcl_CreateEnsemble(
ensemblePtr->numParameters = 0;
ensemblePtr->parameterList = NULL;
ensemblePtr->unknownHandler = NULL;
ensemblePtr->token = Tcl_NRCreateCommand(interp, name,
NsEnsembleImplementationCmd, NsEnsembleImplementationCmdNR,
ensemblePtr, DeleteEnsembleConfig);
ensemblePtr->token = token;
ensemblePtr->next = (EnsembleConfig *) nsPtr->ensembles;
nsPtr->ensembles = (Tcl_Ensemble *) ensemblePtr;
@@ -709,11 +700,52 @@ Tcl_CreateEnsemble(
((Command *) ensemblePtr->token)->compileProc = TclCompileEnsemble;
}
if (nameObj != NULL) {
TclDecrRefCount(nameObj);
}
return ensemblePtr->token;
}
/*
*----------------------------------------------------------------------
*
* Tcl_CreateEnsemble
*
* Create a simple ensemble attached to the given namespace.
*
* Deprecated by TclCreateEnsembleInNs.
*
* Value
*
* The token for the command created.
*
* Effect
* The ensemble is created and marked for compilation.
*
*
*----------------------------------------------------------------------
*/
Tcl_Command
Tcl_CreateEnsemble(
Tcl_Interp *interp,
const char *name,
Tcl_Namespace *namespacePtr,
int flags)
{
Namespace *nsPtr = (Namespace *)namespacePtr, *foundNsPtr, *altNsPtr,
*actualNsPtr;
const char * simpleName;
if (nsPtr == NULL) {
nsPtr = (Namespace *) TclGetCurrentNamespace(interp);
}
TclGetNamespaceForQualName(interp, name, nsPtr, TCL_CREATE_NS_IF_UNKNOWN,
&foundNsPtr, &altNsPtr, &actualNsPtr, &simpleName);
return TclCreateEnsembleInNs(interp, simpleName,
(Tcl_Namespace *) foundNsPtr, (Tcl_Namespace *) nsPtr, flags);
}
/*
*----------------------------------------------------------------------
@@ -1885,6 +1917,7 @@ NsEnsembleImplementationCmdNR(
TclSkipTailcall(interp);
Tcl_ListObjGetElements(NULL, copyPtr, &copyObjc, &copyObjv);
((Interp *)interp)->lookupNsPtr = ensemblePtr->nsPtr;
return TclNREvalObjv(interp, copyObjc, copyObjv, TCL_EVAL_INVOKE, NULL);
}
@@ -2398,14 +2431,32 @@ MakeCachedEnsembleCommand(
*----------------------------------------------------------------------
*/
static void
ClearTable(
EnsembleConfig *ensemblePtr)
{
Tcl_HashTable *hash = &ensemblePtr->subcommandTable;
if (hash->numEntries != 0) {
Tcl_HashSearch search;
Tcl_HashEntry *hPtr = Tcl_FirstHashEntry(hash, &search);
while (hPtr != NULL) {
Tcl_Obj *prefixObj = Tcl_GetHashValue(hPtr);
Tcl_DecrRefCount(prefixObj);
hPtr = Tcl_NextHashEntry(&search);
}
ckfree((char *) ensemblePtr->subcommandArrayPtr);
}
Tcl_DeleteHashTable(hash);
}
static void
DeleteEnsembleConfig(
ClientData clientData)
{
EnsembleConfig *ensemblePtr = clientData;
Namespace *nsPtr = ensemblePtr->nsPtr;
Tcl_HashSearch search;
Tcl_HashEntry *hEnt;
/*
* Unlink from the ensemble chain if it has not been marked as having been
@@ -2439,17 +2490,7 @@ DeleteEnsembleConfig(
* Kill the pointer-containing fields.
*/
if (ensemblePtr->subcommandTable.numEntries != 0) {
ckfree(ensemblePtr->subcommandArrayPtr);
}
hEnt = Tcl_FirstHashEntry(&ensemblePtr->subcommandTable, &search);
while (hEnt != NULL) {
Tcl_Obj *prefixObj = Tcl_GetHashValue(hEnt);
Tcl_DecrRefCount(prefixObj);
hEnt = Tcl_NextHashEntry(&search);
}
Tcl_DeleteHashTable(&ensemblePtr->subcommandTable);
ClearTable(ensemblePtr);
if (ensemblePtr->subcmdList != NULL) {
Tcl_DecrRefCount(ensemblePtr->subcmdList);
}
@@ -2505,100 +2546,101 @@ BuildEnsembleConfig(
int i, j, isNew;
Tcl_HashTable *hash = &ensemblePtr->subcommandTable;
Tcl_HashEntry *hPtr;
Tcl_Obj *mapDict = ensemblePtr->subcommandDict;
Tcl_Obj *subList = ensemblePtr->subcmdList;
if (hash->numEntries != 0) {
/*
* Remove pre-existing table.
*/
ClearTable(ensemblePtr);
Tcl_InitHashTable(hash, TCL_STRING_KEYS);
ckfree(ensemblePtr->subcommandArrayPtr);
hPtr = Tcl_FirstHashEntry(hash, &search);
while (hPtr != NULL) {
Tcl_Obj *prefixObj = Tcl_GetHashValue(hPtr);
if (subList) {
int subc;
Tcl_Obj **subv, *target, *cmdObj, *cmdPrefixObj;
char *name;
Tcl_DecrRefCount(prefixObj);
hPtr = Tcl_NextHashEntry(&search);
}
Tcl_DeleteHashTable(hash);
Tcl_InitHashTable(hash, TCL_STRING_KEYS);
}
/*
* There is a list of exactly what subcommands go in the table.
* Must determine the target for each.
*/
/*
* See if we've got an export list. If so, we will only export exactly
* those commands, which may be either implemented by the prefix in the
* subcommandDict or mapped directly onto the namespace's commands.
*/
Tcl_ListObjGetElements(NULL, subList, &subc, &subv);
if (subList == mapDict) {
/*
* Strange case where explicit list of subcommands is same value
* as the dict mapping to targets.
*/
if (ensemblePtr->subcmdList != NULL) {
Tcl_Obj **subcmdv, *target, *cmdObj, *cmdPrefixObj;
int subcmdc;
for (i = 0; i < subc; i += 2) {
name = TclGetString(subv[i]);
hPtr = Tcl_CreateHashEntry(hash, name, &isNew);
if (!isNew) {
cmdObj = (Tcl_Obj *)Tcl_GetHashValue(hPtr);
Tcl_DecrRefCount(cmdObj);
}
Tcl_SetHashValue(hPtr, subv[i+1]);
Tcl_IncrRefCount(subv[i+1]);
TclListObjGetElements(NULL, ensemblePtr->subcmdList, &subcmdc,
&subcmdv);
for (i=0 ; i<subcmdc ; i++) {
const char *name = TclGetString(subcmdv[i]);
name = TclGetString(subv[i+1]);
hPtr = Tcl_CreateHashEntry(hash, name, &isNew);
if (isNew) {
cmdObj = Tcl_NewStringObj(name, -1);
cmdPrefixObj = Tcl_NewListObj(1, &cmdObj);
Tcl_SetHashValue(hPtr, cmdPrefixObj);
Tcl_IncrRefCount(cmdPrefixObj);
}
}
} else {
/* Usual case where we can freely act on the list and dict. */
hPtr = Tcl_CreateHashEntry(hash, name, &isNew);
for (i = 0; i < subc; i++) {
name = TclGetString(subv[i]);
hPtr = Tcl_CreateHashEntry(hash, name, &isNew);
if (!isNew) {
continue;
}
/*
* Skip non-unique cases.
*/
/* Lookup target in the dictionary */
if (mapDict) {
Tcl_DictObjGet(NULL, mapDict, subv[i], &target);
if (target) {
Tcl_SetHashValue(hPtr, target);
Tcl_IncrRefCount(target);
continue;
}
}
if (!isNew) {
continue;
}
/*
* target was not in the dictionary so map onto the namespace.
* Note in this case that we do not guarantee that the
* command is actually there; that is the programmer's
* responsibility (or [::unknown] of course).
*/
cmdObj = Tcl_NewStringObj(name, -1);
cmdPrefixObj = Tcl_NewListObj(1, &cmdObj);
Tcl_SetHashValue(hPtr, cmdPrefixObj);
Tcl_IncrRefCount(cmdPrefixObj);
}
}
} else if (mapDict) {
/*
* No subcmd list, but we do have a mapping dictionary so we should
* use the keys of that. Convert the dictionary's contents into the
* form required for the ensemble's internal hashtable.
*/
/*
* Look in our dictionary (if present) for the command.
*/
Tcl_DictSearch dictSearch;
Tcl_Obj *keyObj, *valueObj;
int done;
if (ensemblePtr->subcommandDict != NULL) {
Tcl_DictObjGet(NULL, ensemblePtr->subcommandDict, subcmdv[i],
&target);
if (target != NULL) {
Tcl_SetHashValue(hPtr, target);
Tcl_IncrRefCount(target);
continue;
}
}
Tcl_DictObjFirst(NULL, ensemblePtr->subcommandDict, &dictSearch,
&keyObj, &valueObj, &done);
while (!done) {
char *name = TclGetString(keyObj);
/*
* Not there, so map onto the namespace. Note in this case that we
* do not guarantee that the command is actually there; that is
* the programmer's responsibility (or [::unknown] of course).
*/
cmdObj = NewNsObj((Tcl_Namespace *) ensemblePtr->nsPtr);
if (ensemblePtr->nsPtr->parentPtr != NULL) {
Tcl_AppendStringsToObj(cmdObj, "::", name, NULL);
} else {
Tcl_AppendStringsToObj(cmdObj, name, NULL);
}
cmdPrefixObj = Tcl_NewListObj(1, &cmdObj);
Tcl_SetHashValue(hPtr, cmdPrefixObj);
Tcl_IncrRefCount(cmdPrefixObj);
}
} else if (ensemblePtr->subcommandDict != NULL) {
/*
* No subcmd list, but we do have a mapping dictionary so we should
* use the keys of that. Convert the dictionary's contents into the
* form required for the ensemble's internal hashtable.
*/
Tcl_DictSearch dictSearch;
Tcl_Obj *keyObj, *valueObj;
int done;
Tcl_DictObjFirst(NULL, ensemblePtr->subcommandDict, &dictSearch,
&keyObj, &valueObj, &done);
while (!done) {
const char *name = TclGetString(keyObj);
hPtr = Tcl_CreateHashEntry(hash, name, &isNew);
Tcl_SetHashValue(hPtr, valueObj);
Tcl_IncrRefCount(valueObj);
Tcl_DictObjNext(&dictSearch, &keyObj, &valueObj, &done);
}
hPtr = Tcl_CreateHashEntry(hash, name, &isNew);
Tcl_SetHashValue(hPtr, valueObj);
Tcl_IncrRefCount(valueObj);
Tcl_DictObjNext(&dictSearch, &keyObj, &valueObj, &done);
}
} else {
/*
* Discover what commands are actually exported by the namespace.
@@ -2634,11 +2676,7 @@ BuildEnsembleConfig(
if (isNew) {
Tcl_Obj *cmdObj, *cmdPrefixObj;
TclNewObj(cmdObj);
Tcl_AppendStringsToObj(cmdObj,
ensemblePtr->nsPtr->fullName,
(ensemblePtr->nsPtr->parentPtr ? "::" : ""),
nsCmdName, NULL);
cmdObj = Tcl_NewStringObj(nsCmdName, -1);
cmdPrefixObj = Tcl_NewListObj(1, &cmdObj);
Tcl_SetHashValue(hPtr, cmdPrefixObj);
Tcl_IncrRefCount(cmdPrefixObj);
+1
View File
@@ -130,6 +130,7 @@ TclSetupEnv(
* '='; ignore the entry.
*/
Tcl_DStringFree(&envString);
continue;
}
p2++;
+8 -10
View File
@@ -744,8 +744,6 @@ static ByteCode * CompileExprObj(Tcl_Interp *interp, Tcl_Obj *objPtr);
static void DeleteExecStack(ExecStack *esPtr);
static void DupExprCodeInternalRep(Tcl_Obj *srcPtr,
Tcl_Obj *copyPtr);
MODULE_SCOPE int TclCompareTwoNumbers(Tcl_Obj *valuePtr,
Tcl_Obj *value2Ptr);
static Tcl_Obj * ExecuteExtendedBinaryMathOp(Tcl_Interp *interp,
int opcode, Tcl_Obj **constants,
Tcl_Obj *valuePtr, Tcl_Obj *value2Ptr);
@@ -1333,12 +1331,12 @@ TclStackAlloc(
int numBytes)
{
Interp *iPtr = (Interp *) interp;
int numWords = (numBytes + (sizeof(Tcl_Obj *) - 1))/sizeof(Tcl_Obj *);
int numWords;
if (iPtr == NULL || iPtr->execEnvPtr == NULL) {
return (void *) ckalloc(numBytes);
}
numWords = (numBytes + (sizeof(Tcl_Obj *) - 1))/sizeof(Tcl_Obj *);
return (void *) StackAllocWords(interp, numWords);
}
@@ -8218,7 +8216,7 @@ ExecuteExtendedBinaryMathOp(
* Arguments are opposite sign; remainder is sum.
*/
TclBNInitBignumFromWideInt(&big1, w1);
TclInitBignumFromWideInt(&big1, w1);
mp_add(&big2, &big1, &big2);
mp_clear(&big1);
BIG_RESULT(&big2);
@@ -9184,7 +9182,7 @@ ExecuteExtendedUnaryMathOp(
if (w != LLONG_MIN) {
WIDE_RESULT(-w);
}
TclBNInitBignumFromLong(&big, *(const long *) ptr);
TclInitBignumFromLong(&big, *(const long *) ptr);
break;
#ifndef TCL_WIDE_INT_IS_LONG
case TCL_NUMBER_WIDE:
@@ -9192,7 +9190,7 @@ ExecuteExtendedUnaryMathOp(
if (w != LLONG_MIN) {
WIDE_RESULT(-w);
}
TclBNInitBignumFromWideInt(&big, w);
TclInitBignumFromWideInt(&big, w);
break;
#endif
default:
@@ -9478,9 +9476,9 @@ PrintByteCodeInfo(
Proc *procPtr = codePtr->procPtr;
Interp *iPtr = (Interp *) *codePtr->interpHandle;
fprintf(stdout, "\nExecuting ByteCode 0x%p, refCt %" TCL_LL_MODIFIER "u, epoch %" TCL_LL_MODIFIER "u, interp 0x%p (epoch %" TCL_LL_MODIFIER "u)\n",
codePtr, (Tcl_WideInt)codePtr->refCount, (Tcl_WideInt)codePtr->compileEpoch, iPtr,
(Tcl_WideInt)iPtr->compileEpoch);
fprintf(stdout, "\nExecuting ByteCode 0x%p, refCt %" TCL_LL_MODIFIER "u, epoch %u, interp 0x%p (epoch %u)\n",
codePtr, (Tcl_WideInt)codePtr->refCount, codePtr->compileEpoch, iPtr,
iPtr->compileEpoch);
fprintf(stdout, " Source: ");
TclPrintSource(stdout, codePtr->source, 60);
+1 -1
View File
@@ -1904,7 +1904,7 @@ TclGlob(
}
/*
* To process a [glob] invokation, this function may be called multiple
* To process a [glob] invocation, this function may be called multiple
* times. Each time, the previously discovered filenames are in the
* interpreter result. We stash that away here so the result is free for
* error messsages.
+8 -18
View File
@@ -45,19 +45,6 @@ static Tcl_HashEntry * AllocArrayEntry(Tcl_HashTable *tablePtr, void *keyPtr);
static int CompareArrayKeys(void *keyPtr, Tcl_HashEntry *hPtr);
static TCL_HASH_TYPE HashArrayKey(Tcl_HashTable *tablePtr, void *keyPtr);
/*
* Prototypes for the one word hash key methods. Not actually declared because
* this is a critical path that is implemented in the core hash table access
* function.
*/
#if 0
static Tcl_HashEntry * AllocOneWordEntry(Tcl_HashTable *tablePtr,
void *keyPtr);
static int CompareOneWordKeys(void *keyPtr, Tcl_HashEntry *hPtr);
static unsigned int HashOneWordKey(Tcl_HashTable *tablePtr, void *keyPtr);
#endif
/*
* Prototypes for the string hash key methods.
*/
@@ -998,12 +985,18 @@ static void
RebuildTable(
register Tcl_HashTable *tablePtr) /* Table to enlarge. */
{
int oldSize, count, index;
Tcl_HashEntry **oldBuckets;
int count, index, oldSize = tablePtr->numBuckets;
Tcl_HashEntry **oldBuckets = tablePtr->buckets;
register Tcl_HashEntry **oldChainPtr, **newChainPtr;
register Tcl_HashEntry *hPtr;
const Tcl_HashKeyType *typePtr;
/* Avoid outgrowing capability of the memory allocators */
if (oldSize > (int)(UINT_MAX / (4 * sizeof(Tcl_HashEntry *)))) {
tablePtr->rebuildSize = INT_MAX;
return;
}
if (tablePtr->keyType == TCL_STRING_KEYS) {
typePtr = &tclStringHashKeyType;
} else if (tablePtr->keyType == TCL_ONE_WORD_KEYS) {
@@ -1015,9 +1008,6 @@ RebuildTable(
typePtr = &tclArrayHashKeyType;
}
oldSize = tablePtr->numBuckets;
oldBuckets = tablePtr->buckets;
/*
* Allocate and initialize the new bucket array, and set up hashing
* constants for new array size.
+3 -1
View File
@@ -6708,7 +6708,7 @@ Tcl_Flush(
chanPtr = statePtr->topChanPtr;
if (CheckChannelErrors(statePtr, TCL_WRITABLE) != 0) {
return -1;
return TCL_ERROR;
}
result = FlushChannel(NULL, chanPtr, 0);
@@ -9032,6 +9032,7 @@ ZeroTransferTimerProc(
*----------------------------------------------------------------------
*/
#if !defined(TCL_NO_DEPRECATED)
int
TclCopyChannelOld(
Tcl_Interp *interp, /* Current interpreter. */
@@ -9043,6 +9044,7 @@ TclCopyChannelOld(
return TclCopyChannel(interp, inChan, outChan, (Tcl_WideInt) toRead,
cmdPtr);
}
#endif
int
TclCopyChannel(
+4
View File
@@ -41,6 +41,8 @@ static void ReflectWatch(ClientData clientData, int mask);
static int ReflectBlock(ClientData clientData, int mode);
#ifdef TCL_THREADS
static void ReflectThread(ClientData clientData, int action);
static int ReflectEventRun(Tcl_Event *ev, int flags);
static int ReflectEventDelete(Tcl_Event *ev, ClientData cd);
#endif
static Tcl_WideInt ReflectSeekWide(ClientData clientData,
Tcl_WideInt offset, int mode, int *errorCodePtr);
@@ -748,6 +750,7 @@ TclChanCreateObjCmd(
*----------------------------------------------------------------------
*/
#ifdef TCL_THREADS
typedef struct {
Tcl_Event header;
ReflectedChannel *rcPtr;
@@ -791,6 +794,7 @@ ReflectEventDelete(
}
return 1;
}
#endif
int
TclChanPostEventObjCmd(
+3 -3
View File
@@ -87,7 +87,7 @@ static const Tcl_ChannelType tclRTransformType = {
* layers upon reading from the channel, plus the functions to manage such.
*/
typedef struct _ResultBuffer_ {
typedef struct {
unsigned char *buf; /* Reference to the buffer area. */
int allocated; /* Allocated size of the buffer area. */
int used; /* Number of bytes in the buffer,
@@ -253,7 +253,7 @@ typedef enum {
* sharing problems.
*/
typedef struct ForwardParamBase {
typedef struct {
int code; /* O: Ok/Fail of the cmd handler */
char *msgStr; /* O: Error message for handler failure */
int mustFree; /* O: True if msgStr is allocated, false if
@@ -298,7 +298,7 @@ typedef struct ForwardingResult ForwardingResult;
* General event structure, with reference to operation specific data.
*/
typedef struct ForwardingEvent {
typedef struct {
Tcl_Event event; /* Basic event data, has to be first item */
ForwardingResult *resultPtr;
ForwardedOperation op; /* Forwarded driver operation */
+3 -4
View File
@@ -245,7 +245,7 @@ static Tcl_ThreadDataKey fsDataKey;
* code.
*/
typedef struct FsDivertLoad {
typedef struct {
Tcl_LoadHandle loadHandle;
Tcl_FSUnloadFileProc *unloadProcPtr;
Tcl_Obj *divertedFile;
@@ -412,7 +412,6 @@ Tcl_GetCwd(
return Tcl_DStringValue(cwdPtr);
}
/* Obsolete */
int
Tcl_EvalFile(
Tcl_Interp *interp, /* Interpreter in which to process file. */
@@ -1764,7 +1763,7 @@ Tcl_FSEvalFileEx(
* this cross-platform to allow for scripted documents. [Bug: 2040]
*/
Tcl_SetChannelOption(interp, chan, "-eofchar", "\32");
Tcl_SetChannelOption(interp, chan, "-eofchar", "\32 {}");
/*
* If the encoding is specified, set it for the channel. Else don't touch
@@ -1899,7 +1898,7 @@ TclNREvalFile(
* this cross-platform to allow for scripted documents. [Bug: 2040]
*/
Tcl_SetChannelOption(interp, chan, "-eofchar", "\32");
Tcl_SetChannelOption(interp, chan, "-eofchar", "\32 {}");
/*
* If the encoding is specified, set it for the channel. Else don't touch
+2 -1
View File
@@ -876,7 +876,8 @@ Tcl_WrongNumArgs(
* NULL. */
{
Tcl_Obj *objPtr;
int i, len, elemLen, flags;
int i, len, elemLen;
char flags;
Interp *iPtr = (Interp *) interp;
const char *elementStr;
+36 -50
View File
@@ -50,7 +50,7 @@ declare 6 {
declare 7 {
int TclCopyAndCollapse(int count, const char *src, char *dst)
}
declare 8 {
declare 8 {deprecated {}} {
int TclCopyChannelOld(Tcl_Interp *interp, Tcl_Channel inChan,
Tcl_Channel outChan, int toRead, Tcl_Obj *cmdPtr)
}
@@ -73,7 +73,7 @@ declare 11 {
declare 12 {
void TclDeleteVars(Interp *iPtr, TclVarHashTable *tablePtr)
}
# Removed in 8.5
# Removed in 8.5:
#declare 13 {
# int TclDoGlob(Tcl_Interp *interp, char *separators,
# Tcl_DString *headPtr, char *tail, Tcl_GlobTypeData *types)
@@ -88,7 +88,7 @@ declare 14 {
declare 16 {
void TclExprFloatError(Tcl_Interp *interp, double value)
}
# Removed in 8.4
# Removed in 8.4:
#declare 17 {
# int TclFileAttrsCmd(Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
#}
@@ -123,7 +123,7 @@ declare 25 {
# declare 26 {
# char *TclGetCwd(Tcl_Interp *interp)
# }
# Removed in 8.5
# Removed in 8.5:
#declare 27 {
# int TclGetDate(char *p, unsigned long now, long zone,
# unsigned long *timePtr)
@@ -147,7 +147,7 @@ declare 32 {
int TclGetFrame(Tcl_Interp *interp, const char *str,
CallFrame **framePtrPtr)
}
# Removed in Tcl 8.5
# Removed in 8.5:
#declare 33 {
# TclCmdProcType TclGetInterpProc(void)
#}
@@ -160,7 +160,7 @@ declare 34 {
# Tcl_Obj *TclGetIndexedScalar(Tcl_Interp *interp, int localIndex,
# int flags)
#}
# Removed in 8.6a2
# Removed in 8.6a2:
#declare 36 {
# int TclGetLong(Tcl_Interp *interp, const char *str, long *longPtr)
#}
@@ -185,7 +185,7 @@ declare 41 {
declare 42 {
CONST86 char *TclpGetUserHome(const char *name, Tcl_DString *bufferPtr)
}
# Removed in Tcl 8.5a2
# Removed in 8.5a2:
#declare 43 {
# int TclGlobalInvoke(Tcl_Interp *interp, int argc, CONST84 char **argv,
# int flags)
@@ -220,7 +220,7 @@ declare 50 {
declare 51 {
int TclInterpInit(Tcl_Interp *interp)
}
# Removed in Tcl 8.5a2
# Removed in 8.5a2:
#declare 52 {
# int TclInvoke(Tcl_Interp *interp, int argc, CONST84 char **argv,
# int flags)
@@ -273,7 +273,7 @@ declare 64 {
int TclObjInvoke(Tcl_Interp *interp, int objc, Tcl_Obj *const objv[],
int flags)
}
# Removed in Tcl 8.5a2
# Removed in 8.5a2:
#declare 65 {
# int TclObjInvokeGlobal(Tcl_Interp *interp, int objc,
# Tcl_Obj *const objv[], int flags)
@@ -313,9 +313,7 @@ declare 75 {
declare 76 {
unsigned long TclpGetSeconds(void)
}
# deprecated
declare 77 {
declare 77 {deprecated {}} {
void TclpGetTime(Tcl_Time *time)
}
# Removed in 8.6:
@@ -357,7 +355,7 @@ declare 81 {
# declare 87 {
# void TclPlatformInit(Tcl_Interp *interp)
# }
declare 88 {
declare 88 {deprecated {}} {
char *TclPrecTraceProc(ClientData clientData, Tcl_Interp *interp,
const char *name1, const char *name2, int flags)
}
@@ -380,7 +378,7 @@ declare 92 {
declare 93 {
void TclProcDeleteProc(ClientData clientData)
}
# Removed in Tcl 8.5:
# Removed in 8.5:
#declare 94 {
# int TclProcInterpProc(ClientData clientData, Tcl_Interp *interp,
# int argc, const char **argv)
@@ -419,7 +417,7 @@ declare 103 {
int TclSockGetPort(Tcl_Interp *interp, const char *str, const char *proto,
int *portPtr)
}
declare 104 {
declare 104 {deprecated {}} {
int TclSockMinimumBuffersOld(int sock, int size)
}
# Replaced by Tcl_FSStat in 8.4:
@@ -455,26 +453,26 @@ declare 111 {
Tcl_ResolveCompiledVarProc *compiledVarProc)
}
declare 112 {
int Tcl_AppendExportList(Tcl_Interp *interp, Tcl_Namespace *nsPtr,
int TclAppendExportList(Tcl_Interp *interp, Tcl_Namespace *nsPtr,
Tcl_Obj *objPtr)
}
declare 113 {
Tcl_Namespace *Tcl_CreateNamespace(Tcl_Interp *interp, const char *name,
Tcl_Namespace *TclCreateNamespace(Tcl_Interp *interp, const char *name,
ClientData clientData, Tcl_NamespaceDeleteProc *deleteProc)
}
declare 114 {
void Tcl_DeleteNamespace(Tcl_Namespace *nsPtr)
void TclDeleteNamespace(Tcl_Namespace *nsPtr)
}
declare 115 {
int Tcl_Export(Tcl_Interp *interp, Tcl_Namespace *nsPtr,
int TclExport(Tcl_Interp *interp, Tcl_Namespace *nsPtr,
const char *pattern, int resetListFirst)
}
declare 116 {
Tcl_Command Tcl_FindCommand(Tcl_Interp *interp, const char *name,
Tcl_Command TclFindCommand(Tcl_Interp *interp, const char *name,
Tcl_Namespace *contextNsPtr, int flags)
}
declare 117 {
Tcl_Namespace *Tcl_FindNamespace(Tcl_Interp *interp, const char *name,
Tcl_Namespace *TclFindNamespace(Tcl_Interp *interp, const char *name,
Tcl_Namespace *contextNsPtr, int flags)
}
declare 118 {
@@ -490,28 +488,28 @@ declare 120 {
Tcl_Namespace *contextNsPtr, int flags)
}
declare 121 {
int Tcl_ForgetImport(Tcl_Interp *interp, Tcl_Namespace *nsPtr,
int TclForgetImport(Tcl_Interp *interp, Tcl_Namespace *nsPtr,
const char *pattern)
}
declare 122 {
Tcl_Command Tcl_GetCommandFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr)
Tcl_Command TclGetCommandFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr)
}
declare 123 {
void Tcl_GetCommandFullName(Tcl_Interp *interp, Tcl_Command command,
void TclGetCommandFullName(Tcl_Interp *interp, Tcl_Command command,
Tcl_Obj *objPtr)
}
declare 124 {
Tcl_Namespace *Tcl_GetCurrentNamespace(Tcl_Interp *interp)
Tcl_Namespace *TclGetCurrentNamespace_(Tcl_Interp *interp)
}
declare 125 {
Tcl_Namespace *Tcl_GetGlobalNamespace(Tcl_Interp *interp)
Tcl_Namespace *TclGetGlobalNamespace_(Tcl_Interp *interp)
}
declare 126 {
void Tcl_GetVariableFullName(Tcl_Interp *interp, Tcl_Var variable,
Tcl_Obj *objPtr)
}
declare 127 {
int Tcl_Import(Tcl_Interp *interp, Tcl_Namespace *nsPtr,
int TclImport(Tcl_Interp *interp, Tcl_Namespace *nsPtr,
const char *pattern, int allowOverwrite)
}
declare 128 {
@@ -532,7 +530,7 @@ declare 131 {
declare 132 {
int TclpHasSockets(Tcl_Interp *interp)
}
declare 133 {
declare 133 {deprecated {}} {
struct tm *TclpGetDate(const time_t *time, int useGMT)
}
# Removed in 8.5
@@ -625,12 +623,10 @@ declare 156 {
declare 157 {
Var *TclVarTraceExists(Tcl_Interp *interp, const char *varName)
}
# REMOVED (except from stub table) - use public Tcl_SetStartupScript()
declare 158 {
declare 158 {deprecated {use public Tcl_SetStartupScript()}} {
void TclSetStartupScriptFileName(const char *filename)
}
# REMOVED (except from stub table) - use public Tcl_GetStartupScript()
declare 159 {
declare 159 {deprecated {use public Tcl_GetStartupScript()}} {
const char *TclGetStartupScriptFileName(void)
}
#declare 160 {
@@ -676,13 +672,10 @@ declare 166 {
int index, Tcl_Obj *valuePtr)
}
# VFS-aware versions of Tcl*StartupScriptFileName (158 and 159 above)
# REMOVED (except from stub table) - use public Tcl_SetStartupScript()
declare 167 {
declare 167 {deprecated {use public Tcl_SetStartupScript()}} {
void TclSetStartupScriptPath(Tcl_Obj *pathPtr)
}
# REMOVED (except from stub table) - use public Tcl_GetStartupScript()
declare 168 {
declare 168 {deprecated {use public Tcl_GetStartupScript()}} {
Tcl_Obj *TclGetStartupScriptPath(void)
}
# variant of Tcl_UtfNCmp that takes n as bytes, not chars
@@ -730,12 +723,11 @@ declare 177 {
void TclVarErrMsg(Tcl_Interp *interp, const char *part1, const char *part2,
const char *operation, const char *reason)
}
# TIP 338 made these public - now declared in tcl.h too
declare 178 {
void Tcl_SetStartupScript(Tcl_Obj *pathPtr, const char *encodingName)
void TclSetStartupScript(Tcl_Obj *pathPtr, const char *encodingName)
}
declare 179 {
Tcl_Obj *Tcl_GetStartupScript(const char **encodingNamePtr)
Tcl_Obj *TclGetStartupScript(const char **encodingNamePtr)
}
# REMOVED
@@ -748,12 +740,10 @@ declare 179 {
# const char *file, int line)
#}
# TclpGmtime and TclpLocaltime promoted to the generic interface from unix
declare 182 {
declare 182 {deprecated {}} {
struct tm *TclpLocaltime(const time_t *clock)
}
declare 183 {
declare 183 {deprecated {}} {
struct tm *TclpGmtime(const time_t *clock)
}
@@ -937,10 +927,7 @@ declare 234 {
declare 235 {
void TclInitVarHashTable(TclVarHashTable *tablePtr, Namespace *nsPtr)
}
# TIP 337 made this one public
declare 236 {
declare 236 {deprecated {use Tcl_BackgroundException}} {
void TclBackgroundException(Tcl_Interp *interp, int code)
}
@@ -1090,7 +1077,7 @@ declare 9 win {
declare 10 win {
Tcl_DirEntry *TclpReaddir(DIR *dir)
}
# Removed in 8.3.1 (for Win32s only)
# Removed in 8.3.1 (for Win32s only):
#declare 10 win {
# int TclWinSynchSpawn(void *args, int type, void **trans, Tcl_Pid *pidPtr)
#}
@@ -1140,7 +1127,6 @@ declare 19 win {
declare 20 win {
void TclWinAddProcess(HANDLE hProcess, DWORD id)
}
# new for 8.4.20+/8.5.12+
declare 21 win {
char *TclpInetNtoa(struct in_addr addr)
}
+69 -31
View File
@@ -265,7 +265,7 @@ typedef struct Namespace {
* strings; values have type (Namespace *). If
* NULL, there are no children. */
#endif
size_t nsId; /* Unique id for the namespace. */
unsigned long nsId; /* Unique id for the namespace. */
Tcl_Interp *interp; /* The interpreter containing this
* namespace. */
int flags; /* OR-ed combination of the namespace status
@@ -274,7 +274,7 @@ typedef struct Namespace {
* frames for this namespace that are on the
* Tcl call stack. The namespace won't be
* freed until activationCount becomes zero. */
int refCount; /* Count of references by namespaceName
unsigned int refCount; /* Count of references by namespaceName
* objects. The namespace can't be freed until
* refCount becomes zero. */
Tcl_HashTable cmdTable; /* Contains all the commands currently
@@ -299,12 +299,12 @@ typedef struct Namespace {
* registered using "namespace export". */
int maxExportPatterns; /* Mumber of export patterns for which space
* is currently allocated. */
size_t cmdRefEpoch; /* Incremented if a newly added command
unsigned int cmdRefEpoch; /* Incremented if a newly added command
* shadows a command for which this namespace
* has already cached a Command* pointer; this
* causes all its cached Command* pointers to
* be invalidated. */
size_t resolverEpoch; /* Incremented whenever (a) the name
unsigned int resolverEpoch; /* Incremented whenever (a) the name
* resolution rules change for this namespace
* or (b) a newly added command shadows a
* command that is compiled to bytecodes. This
@@ -331,7 +331,7 @@ typedef struct Namespace {
* LookupCompiledLocal to resolve variable
* references within the namespace at compile
* time. */
size_t exportLookupEpoch; /* Incremented whenever a command is added to
unsigned int exportLookupEpoch; /* Incremented whenever a command is added to
* a namespace, removed from a namespace or
* the exports of a namespace are changed.
* Allows TIP#112-driven command lists to be
@@ -432,7 +432,7 @@ typedef struct EnsembleConfig {
* if the command has been deleted (or never
* existed; the global namespace never has an
* ensemble command.) */
size_t epoch; /* The epoch at which this ensemble's table of
unsigned int epoch; /* The epoch at which this ensemble's table of
* exported commands is valid. */
char **subcommandArrayPtr; /* Array of ensemble subcommand names. At all
* consistent points, this will have the same
@@ -545,7 +545,7 @@ typedef struct CommandTrace {
struct CommandTrace *nextPtr;
/* Next in list of traces associated with a
* particular command. */
int refCount; /* Used to ensure this structure is not
size_t refCount; /* Used to ensure this structure is not
* deleted too early. Keeps track of how many
* pieces of code have a pointer to this
* structure. */
@@ -618,7 +618,7 @@ typedef struct Var {
typedef struct VarInHash {
Var var;
int refCount; /* Counts number of active uses of this
unsigned int refCount; /* Counts number of active uses of this
* variable: 1 for the entry in the hash
* table, 1 for each additional variable whose
* linkPtr points here, 1 for each nested
@@ -950,7 +950,7 @@ typedef struct CompiledLocal {
typedef struct Proc {
struct Interp *iPtr; /* Interpreter for which this command is
* defined. */
int refCount; /* Reference count: 1 if still present in
unsigned int refCount; /* Reference count: 1 if still present in
* command table plus 1 for each call to the
* procedure that is currently active. This
* structure can be freed when refCount
@@ -1067,7 +1067,7 @@ typedef struct AssocData {
*/
typedef struct LocalCache {
int refCount;
unsigned int refCount;
int numVars;
Tcl_Obj *varName0;
} LocalCache;
@@ -1229,7 +1229,7 @@ typedef struct CmdFrame {
typedef struct CFWord {
CmdFrame *framePtr; /* CmdFrame to access. */
int word; /* Index of the word in the command. */
int refCount; /* Number of times the word is on the
unsigned int refCount; /* Number of times the word is on the
* stack. */
} CFWord;
@@ -1492,11 +1492,11 @@ typedef struct LiteralEntry {
* NULL if end of chain. */
Tcl_Obj *objPtr; /* Points to Tcl object that holds the
* literal's bytes and length. */
int refCount; /* If in an interpreter's global literal
size_t refCount; /* If in an interpreter's global literal
* table, the number of ByteCode structures
* that share the literal object; the literal
* entry can be freed when refCount drops to
* 0. If in a local literal table, -1. */
* 0. If in a local literal table, (size_t)-1. */
Namespace *nsPtr; /* Namespace in which this literal is used. We
* try to avoid sharing literal non-FQ command
* names among different namespaces to reduce
@@ -1516,7 +1516,7 @@ typedef struct LiteralTable {
* table. */
int rebuildSize; /* Enlarge table when numEntries gets to be
* this large. */
int mask; /* Mask value used in hashing function. */
unsigned int mask; /* Mask value used in hashing function. */
} LiteralTable;
/*
@@ -1634,12 +1634,12 @@ typedef struct Command {
* recreated). */
Namespace *nsPtr; /* Points to the namespace containing this
* command. */
int refCount; /* 1 if in command hashtable plus 1 for each
unsigned int refCount; /* 1 if in command hashtable plus 1 for each
* reference from a CmdName Tcl object
* representing a command's name in a ByteCode
* instruction sequence. This structure can be
* freed when refCount becomes zero. */
size_t cmdEpoch; /* Incremented to invalidate any references
unsigned int cmdEpoch; /* Incremented to invalidate any references
* that point to this command when it is
* renamed, deleted, hidden, or exposed. */
CompileProc *compileProc; /* Procedure called to compile command. NULL
@@ -2384,7 +2384,7 @@ typedef enum TclEolTranslation {
*/
typedef struct List {
int refCount;
unsigned int refCount;
int maxElemCount; /* Total number of element array slots. */
int elemCount; /* Current number of list elements. */
int canonicalFlag; /* Set if the string representation was
@@ -2445,8 +2445,8 @@ typedef struct List {
#define TCL_EACH_COLLECT 1 /* Collect iteration result like [lmap] */
/*
* Macros providing a faster path to integers: Tcl_GetLongFromObj everywhere,
* Tcl_GetIntFromObj and TclGetIntForIndex on platforms where longs are ints.
* Macros providing a faster path to integers: Tcl_GetLongFromObj,
* Tcl_GetIntFromObj and TclGetIntForIndex.
*
* WARNING: these macros eval their args more than once.
*/
@@ -2467,9 +2467,17 @@ typedef struct List {
: TclGetIntForIndex((interp), (objPtr), (endValue), (idxPtr)))
#else
#define TclGetIntFromObj(interp, objPtr, intPtr) \
Tcl_GetIntFromObj((interp), (objPtr), (intPtr))
#define TclGetIntForIndexM(interp, objPtr, ignore, idxPtr) \
TclGetIntForIndex(interp, objPtr, ignore, idxPtr)
(((objPtr)->typePtr == &tclIntType \
&& (objPtr)->internalRep.longValue >= -(Tcl_WideInt)(UINT_MAX) \
&& (objPtr)->internalRep.longValue <= (Tcl_WideInt)(UINT_MAX)) \
? ((*(intPtr) = (objPtr)->internalRep.longValue), TCL_OK) \
: Tcl_GetIntFromObj((interp), (objPtr), (intPtr)))
#define TclGetIntForIndexM(interp, objPtr, endValue, idxPtr) \
(((objPtr)->typePtr == &tclIntType \
&& (objPtr)->internalRep.longValue >= INT_MIN \
&& (objPtr)->internalRep.longValue <= INT_MAX) \
? ((*(idxPtr) = (objPtr)->internalRep.longValue), TCL_OK) \
: TclGetIntForIndex((interp), (objPtr), (endValue), (idxPtr)))
#endif
/*
@@ -2618,7 +2626,7 @@ typedef Tcl_ObjCmdProc *TclObjCmdProcType;
*----------------------------------------------------------------
*/
typedef void (TclInitProcessGlobalValueProc)(char **valuePtr, size_t *lengthPtr,
typedef void (TclInitProcessGlobalValueProc)(char **valuePtr, unsigned int *lengthPtr,
Tcl_Encoding *encodingPtr);
/*
@@ -2630,9 +2638,9 @@ typedef void (TclInitProcessGlobalValueProc)(char **valuePtr, size_t *lengthPtr,
*/
typedef struct ProcessGlobalValue {
size_t epoch; /* Epoch counter to detect changes in the
unsigned int epoch; /* Epoch counter to detect changes in the
* master value. */
size_t numBytes; /* Length of the master string. */
unsigned int numBytes; /* Length of the master string. */
char *value; /* The master string value. */
Tcl_Encoding encoding; /* system encoding when master string was
* initialized. */
@@ -2900,6 +2908,8 @@ MODULE_SCOPE int TclChanCaughtErrorBypass(Tcl_Interp *interp,
Tcl_Channel chan);
MODULE_SCOPE Tcl_ObjCmdProc TclChannelNamesCmd;
MODULE_SCOPE Tcl_NRPostProc TclClearRootEnsemble;
MODULE_SCOPE int TclCompareTwoNumbers(Tcl_Obj *valuePtr,
Tcl_Obj *value2Ptr);
MODULE_SCOPE ContLineLoc *TclContinuationsEnter(Tcl_Obj *objPtr, int num,
int *loc);
MODULE_SCOPE void TclContinuationsEnterDerived(Tcl_Obj *objPtr,
@@ -2909,12 +2919,25 @@ MODULE_SCOPE void TclContinuationsCopy(Tcl_Obj *objPtr,
Tcl_Obj *originObjPtr);
MODULE_SCOPE int TclConvertElement(const char *src, int length,
char *dst, int flags);
MODULE_SCOPE Tcl_Command TclCreateObjCommandInNs (
Tcl_Interp *interp,
const char *cmdName,
Tcl_Namespace *nsPtr,
Tcl_ObjCmdProc *proc,
ClientData clientData,
Tcl_CmdDeleteProc *deleteProc);
MODULE_SCOPE Tcl_Command TclCreateEnsembleInNs(
Tcl_Interp *interp,
const char *name,
Tcl_Namespace *nameNamespacePtr,
Tcl_Namespace *ensembleNamespacePtr,
int flags);
MODULE_SCOPE void TclDeleteNamespaceVars(Namespace *nsPtr);
MODULE_SCOPE int TclFindDictElement(Tcl_Interp *interp,
const char *dict, int dictLength,
const char **elementPtr, const char **nextPtr,
int *sizePtr, int *literalPtr);
/* TIP #280 - Modified token based evulation, with line information. */
/* TIP #280 - Modified token based evaluation, with line information. */
MODULE_SCOPE int TclEvalEx(Tcl_Interp *interp, const char *script,
int numBytes, int flags, int line,
int *clNextOuter, const char *outerScript);
@@ -2937,6 +2960,8 @@ MODULE_SCOPE char * TclDStringAppendDString(Tcl_DString *dsPtr,
MODULE_SCOPE Tcl_Obj * TclDStringToObj(Tcl_DString *dsPtr);
MODULE_SCOPE Tcl_Obj *const * TclFetchEnsembleRoot(Tcl_Interp *interp,
Tcl_Obj *const *objv, int objc, int *objcPtr);
MODULE_SCOPE Tcl_Namespace * TclEnsureNamespace(Tcl_Interp *interp,
Tcl_Namespace *namespacePtr);
MODULE_SCOPE void TclFinalizeAllocSubsystem(void);
MODULE_SCOPE void TclFinalizeAsync(void);
MODULE_SCOPE void TclFinalizeDoubleConversion(void);
@@ -2963,6 +2988,15 @@ MODULE_SCOPE double TclFloor(const mp_int *a);
MODULE_SCOPE void TclFormatNaN(double value, char *buffer);
MODULE_SCOPE int TclFSFileAttrIndex(Tcl_Obj *pathPtr,
const char *attributeName, int *indexPtr);
MODULE_SCOPE Tcl_Command TclNRCreateCommandInNs (
Tcl_Interp *interp,
const char *cmdName,
Tcl_Namespace *nsPtr,
Tcl_ObjCmdProc *proc,
Tcl_ObjCmdProc *nreProc,
ClientData clientData,
Tcl_CmdDeleteProc *deleteProc);
MODULE_SCOPE int TclNREvalFile(Tcl_Interp *interp, Tcl_Obj *pathPtr,
const char *encodingName);
MODULE_SCOPE void TclFSUnloadTempFile(Tcl_LoadHandle loadHandle);
@@ -3007,6 +3041,9 @@ MODULE_SCOPE int TclInfoLocalsCmd(ClientData dummy, Tcl_Interp *interp,
MODULE_SCOPE int TclInfoVarsCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
MODULE_SCOPE void TclInitAlloc(void);
MODULE_SCOPE void TclInitBignumFromLong(mp_int *, long);
MODULE_SCOPE void TclInitBignumFromWideInt(mp_int *, Tcl_WideInt);
MODULE_SCOPE void TclInitBignumFromWideUInt(mp_int *, Tcl_WideUInt);
MODULE_SCOPE void TclInitDbCkalloc(void);
MODULE_SCOPE void TclInitDoubleConversion(void);
MODULE_SCOPE void TclInitEmbeddedConfigurationInformation(
@@ -3086,7 +3123,7 @@ MODULE_SCOPE int TclpThreadCreate(Tcl_ThreadId *idPtr,
int stackSize, int flags);
MODULE_SCOPE int TclpFindVariable(const char *name, int *lengthPtr);
MODULE_SCOPE void TclpInitLibraryPath(char **valuePtr,
size_t *lengthPtr, Tcl_Encoding *encodingPtr);
unsigned int *lengthPtr, Tcl_Encoding *encodingPtr);
MODULE_SCOPE void TclpInitLock(void);
MODULE_SCOPE void TclpInitPlatform(void);
MODULE_SCOPE void TclpInitUnlock(void);
@@ -3134,7 +3171,7 @@ MODULE_SCOPE int TclReToGlob(Tcl_Interp *interp, const char *reStr,
int reStrLen, Tcl_DString *dsPtr, int *flagsPtr,
int *quantifiersFoundPtr);
MODULE_SCOPE int TclScanElement(const char *string, int length,
int *flagPtr);
char *flagPtr);
MODULE_SCOPE void TclSetBgErrorHandler(Tcl_Interp *interp,
Tcl_Obj *cmdPrefix);
MODULE_SCOPE void TclSetBignumIntRep(Tcl_Obj *objPtr,
@@ -3180,6 +3217,7 @@ MODULE_SCOPE int TclTrimLeft(const char *bytes, int numBytes,
const char *trim, int numTrim);
MODULE_SCOPE int TclTrimRight(const char *bytes, int numBytes,
const char *trim, int numTrim);
MODULE_SCOPE int TclUtfCmp(const char *cs, const char *ct);
MODULE_SCOPE int TclUtfCasecmp(const char *cs, const char *ct);
MODULE_SCOPE int TclUtfCount(int ch);
MODULE_SCOPE Tcl_Obj * TclpNativeToNormalized(ClientData clientData);
@@ -4407,8 +4445,8 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file,
*/
#define TclUtfToUniChar(str, chPtr) \
((((unsigned char) *(str)) < 0xC0) ? \
((*(chPtr) = (Tcl_UniChar) *(str)), 1) \
((((unsigned char) *(str)) < 0x80) ? \
((*(chPtr) = (unsigned char) *(str)), 1) \
: Tcl_UtfToUniChar(str, chPtr))
/*
@@ -4472,7 +4510,7 @@ MODULE_SCOPE int TclIsPureByteArray(Tcl_Obj *objPtr);
/*
*----------------------------------------------------------------
* Macro used by the Tcl core to increment a namespace's export export epoch
* Macro used by the Tcl core to increment a namespace's export epoch
* counter. The ANSI C "prototype" for this macro is:
*
* MODULE_SCOPE void TclInvalidateNsCmdLookup(Namespace *nsPtr);
+129 -147
View File
@@ -28,21 +28,21 @@
# endif
#endif
/* [Bug #803489] Tcl_FindNamespace problem in the Stubs table */
#undef Tcl_CreateNamespace
#undef Tcl_DeleteNamespace
#undef Tcl_AppendExportList
#undef Tcl_Export
#undef Tcl_Import
#undef Tcl_ForgetImport
#undef Tcl_GetCurrentNamespace
#undef Tcl_GetGlobalNamespace
#undef Tcl_FindNamespace
#undef Tcl_FindCommand
#undef Tcl_GetCommandFromObj
#undef Tcl_GetCommandFullName
#undef Tcl_SetStartupScript
#undef Tcl_GetStartupScript
#if !defined(TCL_NO_DEPRECATED) && (TCL_MAJOR_VERSION < 9)
/* Those macro's are especially for Itcl 3.4 compatibility */
# define tclCreateNamespace tcl_CreateNamespace
# define tclDeleteNamespace tcl_DeleteNamespace
# define tclAppendExportList tcl_AppendExportList
# define tclExport tcl_Export
# define tclImport tcl_Import
# define tclForgetImport tcl_ForgetImport
# define tclGetCurrentNamespace_ tcl_GetCurrentNamespace
# define tclGetGlobalNamespace_ tcl_GetGlobalNamespace
# define tclFindNamespace tcl_FindNamespace
# define tclFindCommand tcl_FindCommand
# define tclGetCommandFromObj tcl_GetCommandFromObj
# define tclGetCommandFullName tcl_GetCommandFullName
#endif /* !defined(TCL_NO_DEPRECATED) */
/*
* WARNING: This file is automatically generated by the tools/genStubs.tcl
@@ -75,7 +75,8 @@ EXTERN void TclCleanupCommand(Command *cmdPtr);
EXTERN int TclCopyAndCollapse(int count, const char *src,
char *dst);
/* 8 */
EXTERN int TclCopyChannelOld(Tcl_Interp *interp,
TCL_DEPRECATED("")
int TclCopyChannelOld(Tcl_Interp *interp,
Tcl_Channel inChan, Tcl_Channel outChan,
int toRead, Tcl_Obj *cmdPtr);
/* 9 */
@@ -218,7 +219,8 @@ EXTERN unsigned long TclpGetClicks(void);
/* 76 */
EXTERN unsigned long TclpGetSeconds(void);
/* 77 */
EXTERN void TclpGetTime(Tcl_Time *time);
TCL_DEPRECATED("")
void TclpGetTime(Tcl_Time *time);
/* Slot 78 is reserved */
/* Slot 79 is reserved */
/* Slot 80 is reserved */
@@ -231,7 +233,8 @@ EXTERN char * TclpRealloc(char *ptr, unsigned int size);
/* Slot 86 is reserved */
/* Slot 87 is reserved */
/* 88 */
EXTERN char * TclPrecTraceProc(ClientData clientData,
TCL_DEPRECATED("")
char * TclPrecTraceProc(ClientData clientData,
Tcl_Interp *interp, const char *name1,
const char *name2, int flags);
/* 89 */
@@ -267,7 +270,8 @@ EXTERN void TclSetupEnv(Tcl_Interp *interp);
EXTERN int TclSockGetPort(Tcl_Interp *interp, const char *str,
const char *proto, int *portPtr);
/* 104 */
EXTERN int TclSockMinimumBuffersOld(int sock, int size);
TCL_DEPRECATED("")
int TclSockMinimumBuffersOld(int sock, int size);
/* Slot 105 is reserved */
/* Slot 106 is reserved */
/* Slot 107 is reserved */
@@ -284,22 +288,22 @@ EXTERN void Tcl_AddInterpResolvers(Tcl_Interp *interp,
Tcl_ResolveVarProc *varProc,
Tcl_ResolveCompiledVarProc *compiledVarProc);
/* 112 */
EXTERN int Tcl_AppendExportList(Tcl_Interp *interp,
EXTERN int TclAppendExportList(Tcl_Interp *interp,
Tcl_Namespace *nsPtr, Tcl_Obj *objPtr);
/* 113 */
EXTERN Tcl_Namespace * Tcl_CreateNamespace(Tcl_Interp *interp,
EXTERN Tcl_Namespace * TclCreateNamespace(Tcl_Interp *interp,
const char *name, ClientData clientData,
Tcl_NamespaceDeleteProc *deleteProc);
/* 114 */
EXTERN void Tcl_DeleteNamespace(Tcl_Namespace *nsPtr);
EXTERN void TclDeleteNamespace(Tcl_Namespace *nsPtr);
/* 115 */
EXTERN int Tcl_Export(Tcl_Interp *interp, Tcl_Namespace *nsPtr,
EXTERN int TclExport(Tcl_Interp *interp, Tcl_Namespace *nsPtr,
const char *pattern, int resetListFirst);
/* 116 */
EXTERN Tcl_Command Tcl_FindCommand(Tcl_Interp *interp, const char *name,
EXTERN Tcl_Command TclFindCommand(Tcl_Interp *interp, const char *name,
Tcl_Namespace *contextNsPtr, int flags);
/* 117 */
EXTERN Tcl_Namespace * Tcl_FindNamespace(Tcl_Interp *interp,
EXTERN Tcl_Namespace * TclFindNamespace(Tcl_Interp *interp,
const char *name,
Tcl_Namespace *contextNsPtr, int flags);
/* 118 */
@@ -314,23 +318,23 @@ EXTERN Tcl_Var Tcl_FindNamespaceVar(Tcl_Interp *interp,
const char *name,
Tcl_Namespace *contextNsPtr, int flags);
/* 121 */
EXTERN int Tcl_ForgetImport(Tcl_Interp *interp,
EXTERN int TclForgetImport(Tcl_Interp *interp,
Tcl_Namespace *nsPtr, const char *pattern);
/* 122 */
EXTERN Tcl_Command Tcl_GetCommandFromObj(Tcl_Interp *interp,
EXTERN Tcl_Command TclGetCommandFromObj(Tcl_Interp *interp,
Tcl_Obj *objPtr);
/* 123 */
EXTERN void Tcl_GetCommandFullName(Tcl_Interp *interp,
EXTERN void TclGetCommandFullName(Tcl_Interp *interp,
Tcl_Command command, Tcl_Obj *objPtr);
/* 124 */
EXTERN Tcl_Namespace * Tcl_GetCurrentNamespace(Tcl_Interp *interp);
EXTERN Tcl_Namespace * TclGetCurrentNamespace_(Tcl_Interp *interp);
/* 125 */
EXTERN Tcl_Namespace * Tcl_GetGlobalNamespace(Tcl_Interp *interp);
EXTERN Tcl_Namespace * TclGetGlobalNamespace_(Tcl_Interp *interp);
/* 126 */
EXTERN void Tcl_GetVariableFullName(Tcl_Interp *interp,
Tcl_Var variable, Tcl_Obj *objPtr);
/* 127 */
EXTERN int Tcl_Import(Tcl_Interp *interp, Tcl_Namespace *nsPtr,
EXTERN int TclImport(Tcl_Interp *interp, Tcl_Namespace *nsPtr,
const char *pattern, int allowOverwrite);
/* 128 */
EXTERN void Tcl_PopCallFrame(Tcl_Interp *interp);
@@ -350,7 +354,8 @@ EXTERN void Tcl_SetNamespaceResolvers(
/* 132 */
EXTERN int TclpHasSockets(Tcl_Interp *interp);
/* 133 */
EXTERN struct tm * TclpGetDate(const time_t *time, int useGMT);
TCL_DEPRECATED("")
struct tm * TclpGetDate(const time_t *time, int useGMT);
/* Slot 134 is reserved */
/* Slot 135 is reserved */
/* Slot 136 is reserved */
@@ -401,9 +406,11 @@ EXTERN void TclRegError(Tcl_Interp *interp, const char *msg,
EXTERN Var * TclVarTraceExists(Tcl_Interp *interp,
const char *varName);
/* 158 */
EXTERN void TclSetStartupScriptFileName(const char *filename);
TCL_DEPRECATED("use public Tcl_SetStartupScript()")
void TclSetStartupScriptFileName(const char *filename);
/* 159 */
EXTERN const char * TclGetStartupScriptFileName(void);
TCL_DEPRECATED("use public Tcl_GetStartupScript()")
const char * TclGetStartupScriptFileName(void);
/* Slot 160 is reserved */
/* 161 */
EXTERN int TclChannelTransform(Tcl_Interp *interp,
@@ -422,9 +429,11 @@ EXTERN int TclListObjSetElement(Tcl_Interp *interp,
Tcl_Obj *listPtr, int index,
Tcl_Obj *valuePtr);
/* 167 */
EXTERN void TclSetStartupScriptPath(Tcl_Obj *pathPtr);
TCL_DEPRECATED("use public Tcl_SetStartupScript()")
void TclSetStartupScriptPath(Tcl_Obj *pathPtr);
/* 168 */
EXTERN Tcl_Obj * TclGetStartupScriptPath(void);
TCL_DEPRECATED("use public Tcl_GetStartupScript()")
Tcl_Obj * TclGetStartupScriptPath(void);
/* 169 */
EXTERN int TclpUtfNcmp2(const char *s1, const char *s2,
unsigned long n);
@@ -457,16 +466,18 @@ EXTERN void TclVarErrMsg(Tcl_Interp *interp, const char *part1,
const char *part2, const char *operation,
const char *reason);
/* 178 */
EXTERN void Tcl_SetStartupScript(Tcl_Obj *pathPtr,
EXTERN void TclSetStartupScript(Tcl_Obj *pathPtr,
const char *encodingName);
/* 179 */
EXTERN Tcl_Obj * Tcl_GetStartupScript(const char **encodingNamePtr);
EXTERN Tcl_Obj * TclGetStartupScript(const char **encodingNamePtr);
/* Slot 180 is reserved */
/* Slot 181 is reserved */
/* 182 */
EXTERN struct tm * TclpLocaltime(const time_t *clock);
TCL_DEPRECATED("")
struct tm * TclpLocaltime(const time_t *clock);
/* 183 */
EXTERN struct tm * TclpGmtime(const time_t *clock);
TCL_DEPRECATED("")
struct tm * TclpGmtime(const time_t *clock);
/* Slot 184 is reserved */
/* Slot 185 is reserved */
/* Slot 186 is reserved */
@@ -570,7 +581,8 @@ EXTERN Var * TclVarHashCreateVar(TclVarHashTable *tablePtr,
EXTERN void TclInitVarHashTable(TclVarHashTable *tablePtr,
Namespace *nsPtr);
/* 236 */
EXTERN void TclBackgroundException(Tcl_Interp *interp, int code);
TCL_DEPRECATED("use Tcl_BackgroundException")
void TclBackgroundException(Tcl_Interp *interp, int code);
/* 237 */
EXTERN int TclResetCancellation(Tcl_Interp *interp, int force);
/* 238 */
@@ -652,7 +664,7 @@ typedef struct TclIntStubs {
int (*tclCleanupChildren) (Tcl_Interp *interp, int numPids, Tcl_Pid *pidPtr, Tcl_Channel errorChan); /* 5 */
void (*tclCleanupCommand) (Command *cmdPtr); /* 6 */
int (*tclCopyAndCollapse) (int count, const char *src, char *dst); /* 7 */
int (*tclCopyChannelOld) (Tcl_Interp *interp, Tcl_Channel inChan, Tcl_Channel outChan, int toRead, Tcl_Obj *cmdPtr); /* 8 */
TCL_DEPRECATED_API("") int (*tclCopyChannelOld) (Tcl_Interp *interp, Tcl_Channel inChan, Tcl_Channel outChan, int toRead, Tcl_Obj *cmdPtr); /* 8 */
int (*tclCreatePipeline) (Tcl_Interp *interp, int argc, const char **argv, Tcl_Pid **pidArrayPtr, TclFile *inPipePtr, TclFile *outPipePtr, TclFile *errFilePtr); /* 9 */
int (*tclCreateProc) (Tcl_Interp *interp, Namespace *nsPtr, const char *procName, Tcl_Obj *argsPtr, Tcl_Obj *bodyPtr, Proc **procPtrPtr); /* 10 */
void (*tclDeleteCompiledLocalVars) (Interp *iPtr, CallFrame *framePtr); /* 11 */
@@ -721,7 +733,7 @@ typedef struct TclIntStubs {
void (*tclpFree) (char *ptr); /* 74 */
unsigned long (*tclpGetClicks) (void); /* 75 */
unsigned long (*tclpGetSeconds) (void); /* 76 */
void (*tclpGetTime) (Tcl_Time *time); /* 77 */
TCL_DEPRECATED_API("") void (*tclpGetTime) (Tcl_Time *time); /* 77 */
void (*reserved78)(void);
void (*reserved79)(void);
void (*reserved80)(void);
@@ -732,7 +744,7 @@ typedef struct TclIntStubs {
void (*reserved85)(void);
void (*reserved86)(void);
void (*reserved87)(void);
char * (*tclPrecTraceProc) (ClientData clientData, Tcl_Interp *interp, const char *name1, const char *name2, int flags); /* 88 */
TCL_DEPRECATED_API("") char * (*tclPrecTraceProc) (ClientData clientData, Tcl_Interp *interp, const char *name1, const char *name2, int flags); /* 88 */
int (*tclPreventAliasLoop) (Tcl_Interp *interp, Tcl_Interp *cmdInterp, Tcl_Command cmd); /* 89 */
void (*reserved90)(void);
void (*tclProcCleanupProc) (Proc *procPtr); /* 91 */
@@ -748,7 +760,7 @@ typedef struct TclIntStubs {
CONST86 char * (*tclSetPreInitScript) (const char *string); /* 101 */
void (*tclSetupEnv) (Tcl_Interp *interp); /* 102 */
int (*tclSockGetPort) (Tcl_Interp *interp, const char *str, const char *proto, int *portPtr); /* 103 */
int (*tclSockMinimumBuffersOld) (int sock, int size); /* 104 */
TCL_DEPRECATED_API("") int (*tclSockMinimumBuffersOld) (int sock, int size); /* 104 */
void (*reserved105)(void);
void (*reserved106)(void);
void (*reserved107)(void);
@@ -756,28 +768,28 @@ typedef struct TclIntStubs {
int (*tclUpdateReturnInfo) (Interp *iPtr); /* 109 */
int (*tclSockMinimumBuffers) (void *sock, int size); /* 110 */
void (*tcl_AddInterpResolvers) (Tcl_Interp *interp, const char *name, Tcl_ResolveCmdProc *cmdProc, Tcl_ResolveVarProc *varProc, Tcl_ResolveCompiledVarProc *compiledVarProc); /* 111 */
int (*tcl_AppendExportList) (Tcl_Interp *interp, Tcl_Namespace *nsPtr, Tcl_Obj *objPtr); /* 112 */
Tcl_Namespace * (*tcl_CreateNamespace) (Tcl_Interp *interp, const char *name, ClientData clientData, Tcl_NamespaceDeleteProc *deleteProc); /* 113 */
void (*tcl_DeleteNamespace) (Tcl_Namespace *nsPtr); /* 114 */
int (*tcl_Export) (Tcl_Interp *interp, Tcl_Namespace *nsPtr, const char *pattern, int resetListFirst); /* 115 */
Tcl_Command (*tcl_FindCommand) (Tcl_Interp *interp, const char *name, Tcl_Namespace *contextNsPtr, int flags); /* 116 */
Tcl_Namespace * (*tcl_FindNamespace) (Tcl_Interp *interp, const char *name, Tcl_Namespace *contextNsPtr, int flags); /* 117 */
int (*tclAppendExportList) (Tcl_Interp *interp, Tcl_Namespace *nsPtr, Tcl_Obj *objPtr); /* 112 */
Tcl_Namespace * (*tclCreateNamespace) (Tcl_Interp *interp, const char *name, ClientData clientData, Tcl_NamespaceDeleteProc *deleteProc); /* 113 */
void (*tclDeleteNamespace) (Tcl_Namespace *nsPtr); /* 114 */
int (*tclExport) (Tcl_Interp *interp, Tcl_Namespace *nsPtr, const char *pattern, int resetListFirst); /* 115 */
Tcl_Command (*tclFindCommand) (Tcl_Interp *interp, const char *name, Tcl_Namespace *contextNsPtr, int flags); /* 116 */
Tcl_Namespace * (*tclFindNamespace) (Tcl_Interp *interp, const char *name, Tcl_Namespace *contextNsPtr, int flags); /* 117 */
int (*tcl_GetInterpResolvers) (Tcl_Interp *interp, const char *name, Tcl_ResolverInfo *resInfo); /* 118 */
int (*tcl_GetNamespaceResolvers) (Tcl_Namespace *namespacePtr, Tcl_ResolverInfo *resInfo); /* 119 */
Tcl_Var (*tcl_FindNamespaceVar) (Tcl_Interp *interp, const char *name, Tcl_Namespace *contextNsPtr, int flags); /* 120 */
int (*tcl_ForgetImport) (Tcl_Interp *interp, Tcl_Namespace *nsPtr, const char *pattern); /* 121 */
Tcl_Command (*tcl_GetCommandFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr); /* 122 */
void (*tcl_GetCommandFullName) (Tcl_Interp *interp, Tcl_Command command, Tcl_Obj *objPtr); /* 123 */
Tcl_Namespace * (*tcl_GetCurrentNamespace) (Tcl_Interp *interp); /* 124 */
Tcl_Namespace * (*tcl_GetGlobalNamespace) (Tcl_Interp *interp); /* 125 */
int (*tclForgetImport) (Tcl_Interp *interp, Tcl_Namespace *nsPtr, const char *pattern); /* 121 */
Tcl_Command (*tclGetCommandFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr); /* 122 */
void (*tclGetCommandFullName) (Tcl_Interp *interp, Tcl_Command command, Tcl_Obj *objPtr); /* 123 */
Tcl_Namespace * (*tclGetCurrentNamespace_) (Tcl_Interp *interp); /* 124 */
Tcl_Namespace * (*tclGetGlobalNamespace_) (Tcl_Interp *interp); /* 125 */
void (*tcl_GetVariableFullName) (Tcl_Interp *interp, Tcl_Var variable, Tcl_Obj *objPtr); /* 126 */
int (*tcl_Import) (Tcl_Interp *interp, Tcl_Namespace *nsPtr, const char *pattern, int allowOverwrite); /* 127 */
int (*tclImport) (Tcl_Interp *interp, Tcl_Namespace *nsPtr, const char *pattern, int allowOverwrite); /* 127 */
void (*tcl_PopCallFrame) (Tcl_Interp *interp); /* 128 */
int (*tcl_PushCallFrame) (Tcl_Interp *interp, Tcl_CallFrame *framePtr, Tcl_Namespace *nsPtr, int isProcCallFrame); /* 129 */
int (*tcl_RemoveInterpResolvers) (Tcl_Interp *interp, const char *name); /* 130 */
void (*tcl_SetNamespaceResolvers) (Tcl_Namespace *namespacePtr, Tcl_ResolveCmdProc *cmdProc, Tcl_ResolveVarProc *varProc, Tcl_ResolveCompiledVarProc *compiledVarProc); /* 131 */
int (*tclpHasSockets) (Tcl_Interp *interp); /* 132 */
struct tm * (*tclpGetDate) (const time_t *time, int useGMT); /* 133 */
TCL_DEPRECATED_API("") struct tm * (*tclpGetDate) (const time_t *time, int useGMT); /* 133 */
void (*reserved134)(void);
void (*reserved135)(void);
void (*reserved136)(void);
@@ -802,8 +814,8 @@ typedef struct TclIntStubs {
void (*reserved155)(void);
void (*tclRegError) (Tcl_Interp *interp, const char *msg, int status); /* 156 */
Var * (*tclVarTraceExists) (Tcl_Interp *interp, const char *varName); /* 157 */
void (*tclSetStartupScriptFileName) (const char *filename); /* 158 */
const char * (*tclGetStartupScriptFileName) (void); /* 159 */
TCL_DEPRECATED_API("use public Tcl_SetStartupScript()") void (*tclSetStartupScriptFileName) (const char *filename); /* 158 */
TCL_DEPRECATED_API("use public Tcl_GetStartupScript()") const char * (*tclGetStartupScriptFileName) (void); /* 159 */
void (*reserved160)(void);
int (*tclChannelTransform) (Tcl_Interp *interp, Tcl_Channel chan, Tcl_Obj *cmdObjPtr); /* 161 */
void (*tclChannelEventScriptInvoker) (ClientData clientData, int flags); /* 162 */
@@ -811,8 +823,8 @@ typedef struct TclIntStubs {
void (*tclExpandCodeArray) (void *envPtr); /* 164 */
void (*tclpSetInitialEncodings) (void); /* 165 */
int (*tclListObjSetElement) (Tcl_Interp *interp, Tcl_Obj *listPtr, int index, Tcl_Obj *valuePtr); /* 166 */
void (*tclSetStartupScriptPath) (Tcl_Obj *pathPtr); /* 167 */
Tcl_Obj * (*tclGetStartupScriptPath) (void); /* 168 */
TCL_DEPRECATED_API("use public Tcl_SetStartupScript()") void (*tclSetStartupScriptPath) (Tcl_Obj *pathPtr); /* 167 */
TCL_DEPRECATED_API("use public Tcl_GetStartupScript()") Tcl_Obj * (*tclGetStartupScriptPath) (void); /* 168 */
int (*tclpUtfNcmp2) (const char *s1, const char *s2, unsigned long n); /* 169 */
int (*tclCheckInterpTraces) (Tcl_Interp *interp, const char *command, int numChars, Command *cmdPtr, int result, int traceFlags, int objc, Tcl_Obj *const objv[]); /* 170 */
int (*tclCheckExecutionTraces) (Tcl_Interp *interp, const char *command, int numChars, Command *cmdPtr, int result, int traceFlags, int objc, Tcl_Obj *const objv[]); /* 171 */
@@ -822,12 +834,12 @@ typedef struct TclIntStubs {
int (*tclCallVarTraces) (Interp *iPtr, Var *arrayPtr, Var *varPtr, const char *part1, const char *part2, int flags, int leaveErrMsg); /* 175 */
void (*tclCleanupVar) (Var *varPtr, Var *arrayPtr); /* 176 */
void (*tclVarErrMsg) (Tcl_Interp *interp, const char *part1, const char *part2, const char *operation, const char *reason); /* 177 */
void (*tcl_SetStartupScript) (Tcl_Obj *pathPtr, const char *encodingName); /* 178 */
Tcl_Obj * (*tcl_GetStartupScript) (const char **encodingNamePtr); /* 179 */
void (*tclSetStartupScript) (Tcl_Obj *pathPtr, const char *encodingName); /* 178 */
Tcl_Obj * (*tclGetStartupScript) (const char **encodingNamePtr); /* 179 */
void (*reserved180)(void);
void (*reserved181)(void);
struct tm * (*tclpLocaltime) (const time_t *clock); /* 182 */
struct tm * (*tclpGmtime) (const time_t *clock); /* 183 */
TCL_DEPRECATED_API("") struct tm * (*tclpLocaltime) (const time_t *clock); /* 182 */
TCL_DEPRECATED_API("") struct tm * (*tclpGmtime) (const time_t *clock); /* 183 */
void (*reserved184)(void);
void (*reserved185)(void);
void (*reserved186)(void);
@@ -880,7 +892,7 @@ typedef struct TclIntStubs {
void (*tclGetSrcInfoForPc) (CmdFrame *contextPtr); /* 233 */
Var * (*tclVarHashCreateVar) (TclVarHashTable *tablePtr, const char *key, int *newPtr); /* 234 */
void (*tclInitVarHashTable) (TclVarHashTable *tablePtr, Namespace *nsPtr); /* 235 */
void (*tclBackgroundException) (Tcl_Interp *interp, int code); /* 236 */
TCL_DEPRECATED_API("use Tcl_BackgroundException") void (*tclBackgroundException) (Tcl_Interp *interp, int code); /* 236 */
int (*tclResetCancellation) (Tcl_Interp *interp, int force); /* 237 */
int (*tclNRInterpProc) (ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* 238 */
int (*tclNRInterpProcCore) (Tcl_Interp *interp, Tcl_Obj *procNameObj, int skip, ProcErrorProc *errorProc); /* 239 */
@@ -1088,38 +1100,38 @@ extern const TclIntStubs *tclIntStubsPtr;
(tclIntStubsPtr->tclSockMinimumBuffers) /* 110 */
#define Tcl_AddInterpResolvers \
(tclIntStubsPtr->tcl_AddInterpResolvers) /* 111 */
#define Tcl_AppendExportList \
(tclIntStubsPtr->tcl_AppendExportList) /* 112 */
#define Tcl_CreateNamespace \
(tclIntStubsPtr->tcl_CreateNamespace) /* 113 */
#define Tcl_DeleteNamespace \
(tclIntStubsPtr->tcl_DeleteNamespace) /* 114 */
#define Tcl_Export \
(tclIntStubsPtr->tcl_Export) /* 115 */
#define Tcl_FindCommand \
(tclIntStubsPtr->tcl_FindCommand) /* 116 */
#define Tcl_FindNamespace \
(tclIntStubsPtr->tcl_FindNamespace) /* 117 */
#define TclAppendExportList \
(tclIntStubsPtr->tclAppendExportList) /* 112 */
#define TclCreateNamespace \
(tclIntStubsPtr->tclCreateNamespace) /* 113 */
#define TclDeleteNamespace \
(tclIntStubsPtr->tclDeleteNamespace) /* 114 */
#define TclExport \
(tclIntStubsPtr->tclExport) /* 115 */
#define TclFindCommand \
(tclIntStubsPtr->tclFindCommand) /* 116 */
#define TclFindNamespace \
(tclIntStubsPtr->tclFindNamespace) /* 117 */
#define Tcl_GetInterpResolvers \
(tclIntStubsPtr->tcl_GetInterpResolvers) /* 118 */
#define Tcl_GetNamespaceResolvers \
(tclIntStubsPtr->tcl_GetNamespaceResolvers) /* 119 */
#define Tcl_FindNamespaceVar \
(tclIntStubsPtr->tcl_FindNamespaceVar) /* 120 */
#define Tcl_ForgetImport \
(tclIntStubsPtr->tcl_ForgetImport) /* 121 */
#define Tcl_GetCommandFromObj \
(tclIntStubsPtr->tcl_GetCommandFromObj) /* 122 */
#define Tcl_GetCommandFullName \
(tclIntStubsPtr->tcl_GetCommandFullName) /* 123 */
#define Tcl_GetCurrentNamespace \
(tclIntStubsPtr->tcl_GetCurrentNamespace) /* 124 */
#define Tcl_GetGlobalNamespace \
(tclIntStubsPtr->tcl_GetGlobalNamespace) /* 125 */
#define TclForgetImport \
(tclIntStubsPtr->tclForgetImport) /* 121 */
#define TclGetCommandFromObj \
(tclIntStubsPtr->tclGetCommandFromObj) /* 122 */
#define TclGetCommandFullName \
(tclIntStubsPtr->tclGetCommandFullName) /* 123 */
#define TclGetCurrentNamespace_ \
(tclIntStubsPtr->tclGetCurrentNamespace_) /* 124 */
#define TclGetGlobalNamespace_ \
(tclIntStubsPtr->tclGetGlobalNamespace_) /* 125 */
#define Tcl_GetVariableFullName \
(tclIntStubsPtr->tcl_GetVariableFullName) /* 126 */
#define Tcl_Import \
(tclIntStubsPtr->tcl_Import) /* 127 */
#define TclImport \
(tclIntStubsPtr->tclImport) /* 127 */
#define Tcl_PopCallFrame \
(tclIntStubsPtr->tcl_PopCallFrame) /* 128 */
#define Tcl_PushCallFrame \
@@ -1210,10 +1222,10 @@ extern const TclIntStubs *tclIntStubsPtr;
(tclIntStubsPtr->tclCleanupVar) /* 176 */
#define TclVarErrMsg \
(tclIntStubsPtr->tclVarErrMsg) /* 177 */
#define Tcl_SetStartupScript \
(tclIntStubsPtr->tcl_SetStartupScript) /* 178 */
#define Tcl_GetStartupScript \
(tclIntStubsPtr->tcl_GetStartupScript) /* 179 */
#define TclSetStartupScript \
(tclIntStubsPtr->tclSetStartupScript) /* 178 */
#define TclGetStartupScript \
(tclIntStubsPtr->tclGetStartupScript) /* 179 */
/* Slot 180 is reserved */
/* Slot 181 is reserved */
#define TclpLocaltime \
@@ -1350,58 +1362,28 @@ extern const TclIntStubs *tclIntStubsPtr;
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLIMPORT
#undef TclGetStartupScriptFileName
#undef TclSetStartupScriptFileName
#undef TclGetStartupScriptPath
#undef TclSetStartupScriptPath
#undef TclBackgroundException
#if defined(USE_TCL_STUBS) && defined(TCL_NO_DEPRECATED)
# undef Tcl_SetStartupScript
# define Tcl_SetStartupScript \
(tclStubsPtr->tcl_SetStartupScript) /* 622 */
# undef Tcl_GetStartupScript
# define Tcl_GetStartupScript \
(tclStubsPtr->tcl_GetStartupScript) /* 623 */
# undef Tcl_CreateNamespace
# define Tcl_CreateNamespace \
(tclStubsPtr->tcl_CreateNamespace) /* 506 */
# undef Tcl_DeleteNamespace
# define Tcl_DeleteNamespace \
(tclStubsPtr->tcl_DeleteNamespace) /* 507 */
# undef Tcl_AppendExportList
# define Tcl_AppendExportList \
(tclStubsPtr->tcl_AppendExportList) /* 508 */
# undef Tcl_Export
# define Tcl_Export \
(tclStubsPtr->tcl_Export) /* 509 */
# undef Tcl_Import
# define Tcl_Import \
(tclStubsPtr->tcl_Import) /* 510 */
# undef Tcl_ForgetImport
# define Tcl_ForgetImport \
(tclStubsPtr->tcl_ForgetImport) /* 511 */
# undef Tcl_GetCurrentNamespace
# define Tcl_GetCurrentNamespace \
(tclStubsPtr->tcl_GetCurrentNamespace) /* 512 */
# undef Tcl_GetGlobalNamespace
# define Tcl_GetGlobalNamespace \
(tclStubsPtr->tcl_GetGlobalNamespace) /* 513 */
# undef Tcl_FindNamespace
# define Tcl_FindNamespace \
(tclStubsPtr->tcl_FindNamespace) /* 514 */
# undef Tcl_FindCommand
# define Tcl_FindCommand \
(tclStubsPtr->tcl_FindCommand) /* 515 */
# undef Tcl_GetCommandFromObj
# define Tcl_GetCommandFromObj \
(tclStubsPtr->tcl_GetCommandFromObj) /* 516 */
# undef Tcl_GetCommandFullName
# define Tcl_GetCommandFullName \
(tclStubsPtr->tcl_GetCommandFullName) /* 517 */
#if defined(USE_TCL_STUBS)
# undef TclGetStartupScriptFileName
# undef TclSetStartupScriptFileName
# undef TclGetStartupScriptPath
# undef TclSetStartupScriptPath
# undef TclBackgroundException
# undef TclSetStartupScript
# undef TclGetStartupScript
# undef TclCreateNamespace
# undef TclDeleteNamespace
# undef TclAppendExportList
# undef TclExport
# undef TclImport
# undef TclForgetImport
# undef TclGetCurrentNamespace_
# undef TclGetGlobalNamespace_
# undef TclFindNamespace
# undef TclFindCommand
# undef TclGetCommandFromObj
# undef TclGetCommandFullName
# undef TclCopyChannelOld
# undef TclSockMinimumBuffersOld
#endif
#undef TclCopyChannelOld
#undef TclSockMinimumBuffersOld
#endif /* _TCLINTDECLS */
+2
View File
@@ -559,6 +559,8 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr;
# define TclWinGetServByName getservbyname
# define TclWinGetSockOpt getsockopt
# define TclWinSetSockOpt setsockopt
# undef TclWinGetPlatformId
# define TclWinGetPlatformId() (2) /* VER_PLATFORM_WIN32_NT */
#else
# undef TclpGetPid
# define TclpGetPid(pid) ((unsigned long) (pid))
-4
View File
@@ -3208,10 +3208,6 @@ Tcl_MakeSafe(
(void) Tcl_EvalEx(interp,
"namespace eval ::tcl {namespace eval mathfunc {}}", -1, 0);
(void) Tcl_CreateAlias(interp, "::tcl::mathfunc::min", master,
"::tcl::mathfunc::min", 0, NULL);
(void) Tcl_CreateAlias(interp, "::tcl::mathfunc::max", master,
"::tcl::mathfunc::max", 0, NULL);
}
iPtr->flags |= SAFE_INTERP;
+3 -3
View File
@@ -654,7 +654,7 @@ static Tcl_ObjType invalidRealType = {
NULL, /* freeIntRepProc */
NULL, /* dupIntRepProc */
NULL, /* updateStringProc */
SetInvalidRealFromAny /* setFromAnyProc */
NULL /* setFromAnyProc */
};
static int
@@ -692,7 +692,7 @@ SetInvalidRealFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr) {
/*
* This function checks for integer representations, which are valid
* when linking with C variables, but which are invalid in other
* contexts in Tcl. Handled are "+", "-", "", "0x", "0b" and "0o"
* contexts in Tcl. Handled are "+", "-", "", "0x", "0b", "0d" and "0o"
* (upperand lowercase). See bug [39f6304c2e].
*/
int
@@ -701,7 +701,7 @@ GetInvalidIntFromObj(Tcl_Obj *objPtr, int *intPtr)
const char *str = TclGetString(objPtr);
if ((objPtr->length == 0) ||
((objPtr->length == 2) && (str[0] == '0') && strchr("xXbBoO", str[1]))) {
((objPtr->length == 2) && (str[0] == '0') && strchr("xXbBoOdD", str[1]))) {
*intPtr = 0;
return TCL_OK;
} else if ((objPtr->length == 1) && strchr("+-", str[0])) {
+3 -3
View File
@@ -1957,8 +1957,8 @@ static void
UpdateStringOfList(
Tcl_Obj *listPtr) /* List object with string rep to update. */
{
# define LOCAL_SIZE 20
int localFlags[LOCAL_SIZE], *flagPtr = NULL;
# define LOCAL_SIZE 64
char localFlags[LOCAL_SIZE], *flagPtr = NULL;
List *listRepPtr = ListRepPtr(listPtr);
int numElems = listRepPtr->elemCount;
int i, length, bytesNeeded = 0;
@@ -1995,7 +1995,7 @@ UpdateStringOfList(
* We know numElems <= LIST_MAX, so this is safe.
*/
flagPtr = ckalloc(numElems * sizeof(int));
flagPtr = ckalloc(numElems);
}
elemPtrs = &listRepPtr->elements;
for (i = 0; i < numElems; i++) {
+12 -11
View File
@@ -186,7 +186,7 @@ TclCreateLiteral(
{
LiteralTable *globalTablePtr = &iPtr->literalTable;
LiteralEntry *globalPtr;
int globalHash;
unsigned int globalHash;
Tcl_Obj *objPtr;
/*
@@ -393,7 +393,8 @@ TclRegisterLiteral(
LiteralEntry *globalPtr, *localPtr;
Tcl_Obj *objPtr;
unsigned hash;
int localHash, objIndex, new;
unsigned int localHash;
int objIndex, new;
Namespace *nsPtr;
if (length < 0) {
@@ -537,7 +538,8 @@ TclHideLiteral(
{
LiteralEntry **nextPtrPtr, *entryPtr, *lPtr;
LiteralTable *localTablePtr = &envPtr->localLitTable;
int localHash, length;
unsigned int localHash;
int length;
const char *bytes;
Tcl_Obj *newObjPtr;
@@ -556,7 +558,7 @@ TclHideLiteral(
lPtr->objPtr = newObjPtr;
bytes = TclGetStringFromObj(newObjPtr, &length);
localHash = (HashString(bytes, length) & localTablePtr->mask);
localHash = HashString(bytes, length) & localTablePtr->mask;
nextPtrPtr = &localTablePtr->buckets[localHash];
for (entryPtr=*nextPtrPtr ; entryPtr!=NULL ; entryPtr=*nextPtrPtr) {
@@ -612,7 +614,7 @@ TclAddLiteralObj(
lPtr = &envPtr->literalArrayPtr[objIndex];
lPtr->objPtr = objPtr;
Tcl_IncrRefCount(objPtr);
lPtr->refCount = -1; /* i.e., unused */
lPtr->refCount = (size_t)-1; /* i.e., unused */
lPtr->nextPtr = NULL;
if (litPtrPtr) {
@@ -809,7 +811,8 @@ TclReleaseLiteral(
LiteralTable *globalTablePtr;
register LiteralEntry *entryPtr, *prevPtr;
const char *bytes;
int length, index;
int length;
unsigned int index;
if (iPtr == NULL) {
goto done;
@@ -828,15 +831,13 @@ TclReleaseLiteral(
for (prevPtr=NULL, entryPtr=globalTablePtr->buckets[index];
entryPtr!=NULL ; prevPtr=entryPtr, entryPtr=entryPtr->nextPtr) {
if (entryPtr->objPtr == objPtr) {
entryPtr->refCount--;
/*
* If the literal is no longer being used by any ByteCode, delete
* the entry then remove the reference corresponding to the global
* literal table entry (decrement the ref count of the object).
*/
if (entryPtr->refCount == 0) {
if (entryPtr->refCount-- <= 1) {
if (prevPtr == NULL) {
globalTablePtr->buckets[index] = entryPtr->nextPtr;
} else {
@@ -954,8 +955,8 @@ RebuildLiteralTable(
register LiteralEntry *entryPtr;
LiteralEntry **bucketPtr;
const char *bytes;
unsigned int oldSize;
int count, index, length;
unsigned int oldSize, index;
int count, length;
oldSize = tablePtr->numBuckets;
oldBuckets = tablePtr->buckets;
+1 -1
View File
@@ -130,7 +130,7 @@ Tcl_LoadObjCmd(
Tcl_PackageInitProc *initProc;
const char *p, *fullFileName, *packageName;
Tcl_LoadHandle loadHandle;
Tcl_UniChar ch;
Tcl_UniChar ch = 0;
unsigned len;
int index, flags = 0;
Tcl_Obj *const *savedobjv = objv;
+1 -5
View File
@@ -266,18 +266,14 @@ Tcl_SourceRCFile(
c = Tcl_OpenFileChannel(NULL, fullName, "r", 0);
if (c != NULL) {
Tcl_Obj *fullNameObj = Tcl_NewStringObj(fullName, -1);
Tcl_Close(NULL, c);
Tcl_IncrRefCount(fullNameObj);
if (Tcl_FSEvalFileEx(interp, fullNameObj, NULL) != TCL_OK) {
if (Tcl_EvalFile(interp, fullName) != TCL_OK) {
chan = Tcl_GetStdChannel(TCL_STDERR);
if (chan) {
Tcl_WriteObj(chan, Tcl_GetObjResult(interp));
Tcl_WriteChars(chan, "\n", 1);
}
}
Tcl_DecrRefCount(fullNameObj);
}
}
Tcl_DStringFree(&temp);
+39 -13
View File
@@ -32,7 +32,7 @@
*/
typedef struct {
size_t numNsCreated; /* Count of the number of namespaces created
unsigned long numNsCreated; /* Count of the number of namespaces created
* within the thread. This value is used as a
* unique id for each namespace. Cannot be
* per-interp because the nsId is used to
@@ -402,7 +402,7 @@ Tcl_PopCallFrame(
}
if (framePtr->numCompiledLocals > 0) {
TclDeleteCompiledLocalVars(iPtr, framePtr);
if (--framePtr->localCachePtr->refCount == 0) {
if (framePtr->localCachePtr->refCount-- <= 1) {
TclFreeLocalCache(interp, framePtr->localCachePtr);
}
framePtr->localCachePtr = NULL;
@@ -915,6 +915,11 @@ Tcl_DeleteNamespace(
Tcl_HashSearch search;
Command *cmdPtr;
/*
* Ensure that this namespace doesn't get deallocated in the meantime.
*/
nsPtr->refCount++;
/*
* Give anyone interested - notably TclOO - a chance to use this namespace
* normally despite the fact that the namespace is going to go. Allows the
@@ -1047,16 +1052,7 @@ Tcl_DeleteNamespace(
#endif
Tcl_DeleteHashTable(&nsPtr->cmdTable);
/*
* If the reference count is 0, then discard the namespace.
* Otherwise, mark it as "dead" so that it can't be used.
*/
if (nsPtr->refCount == 0) {
NamespaceFree(nsPtr);
} else {
nsPtr->flags |= NS_DEAD;
}
nsPtr ->flags |= NS_DEAD;
} else {
/*
* Restore the ::errorInfo and ::errorCode traces.
@@ -1073,6 +1069,7 @@ Tcl_DeleteNamespace(
nsPtr->flags &= ~(NS_DYING|NS_KILLED);
}
}
TclNsDecrRefCount(nsPtr);
}
/*
@@ -2421,6 +2418,35 @@ TclGetNamespaceForQualName(
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* TclEnsureNamespace --
*
* Provide a namespace that is not deleted.
*
* Value
*
* namespacePtr, if it is not scheduled for deletion, or a pointer to a
* new namespace with the same name otherwise.
*
* Effect
* None.
*
*----------------------------------------------------------------------
*/
Tcl_Namespace *
TclEnsureNamespace(
Tcl_Interp *interp,
Tcl_Namespace *namespacePtr)
{
Namespace *nsPtr = (Namespace *) namespacePtr;
if (!(nsPtr->flags & NS_DYING)) {
return namespacePtr;
}
return Tcl_CreateNamespace(interp, nsPtr->fullName, NULL, NULL);
}
/*
*----------------------------------------------------------------------
*
@@ -2638,7 +2664,7 @@ Tcl_FindCommand(
Namespace *nsPtr[2];
register int search;
TclGetNamespaceForQualName(interp, name, (Namespace *) contextNsPtr,
TclGetNamespaceForQualName(interp, name, cxtNsPtr,
flags, &nsPtr[0], &nsPtr[1], &cxtNsPtr, &simpleName);
/*
+308 -343
View File
@@ -4,6 +4,7 @@
* This file contains the object-system core (NB: not Tcl_Obj, but ::oo)
*
* Copyright (c) 2005-2012 by Donal K. Fellows
* Copyright (c) 2017 by Nathan Coulter
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -58,7 +59,7 @@ static const struct {
static Class * AllocClass(Tcl_Interp *interp, Object *useThisObj);
static Object * AllocObject(Tcl_Interp *interp, const char *nameStr,
const char *nsNameStr);
Namespace *nsPtr, const char *nsNameStr);
static void ClearMixins(Class *clsPtr);
static void ClearSuperclasses(Class *clsPtr);
static int CloneClassMethod(Tcl_Interp *interp, Class *clsPtr,
@@ -82,7 +83,6 @@ static void ObjectRenamedTrace(ClientData clientData,
const char *newName, int flags);
static void ReleaseClassContents(Tcl_Interp *interp,Object *oPtr);
static inline void SquelchCachedName(Object *oPtr);
static void SquelchedNsFirst(ClientData clientData);
static int PublicObjectCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
@@ -380,9 +380,9 @@ InitFoundation(
*/
fPtr->objectCls = AllocClass(interp,
AllocObject(interp, "::oo::object", NULL));
AllocObject(interp, "object", (Namespace *)fPtr->ooNs, NULL));
fPtr->classCls = AllocClass(interp,
AllocObject(interp, "::oo::class", NULL));
AllocObject(interp, "class", (Namespace *)fPtr->ooNs, NULL));
fPtr->objectCls->thisPtr->selfCls = fPtr->classCls;
fPtr->objectCls->thisPtr->flags |= ROOT_OBJECT;
fPtr->objectCls->flags |= ROOT_OBJECT;
@@ -538,7 +538,8 @@ KillFoundation(
* AllocObject --
*
* Allocate an object of basic type. Does not splice the object into its
* class's instance list.
* class's instance list. The caller must set the classPtr on the object,
* either to a class or to NULL.
*
* ----------------------------------------------------------------------
*/
@@ -551,6 +552,8 @@ AllocObject(
* if the OO system should pick the object
* name itself (equal to the namespace
* name). */
Namespace *nsPtr, /* The namespace to create the object in,
or NULL if *nameStr is NULL */
const char *nsNameStr) /* The name of the namespace to create, or
* NULL if the OO system should pick a unique
* name itself. If this is non-NULL but names
@@ -579,8 +582,7 @@ AllocObject(
*/
if (nsNameStr != NULL) {
oPtr->namespacePtr = Tcl_CreateNamespace(interp, nsNameStr, oPtr,
ObjectNamespaceDeleted);
oPtr->namespacePtr = Tcl_CreateNamespace(interp, nsNameStr, oPtr, NULL);
if (oPtr->namespacePtr != NULL) {
creationEpoch = ++fPtr->tsdPtr->nsCount;
goto configNamespace;
@@ -592,8 +594,7 @@ AllocObject(
char objName[10 + TCL_INTEGER_SPACE];
sprintf(objName, "::oo::Obj%d", ++fPtr->tsdPtr->nsCount);
oPtr->namespacePtr = Tcl_CreateNamespace(interp, objName, oPtr,
ObjectNamespaceDeleted);
oPtr->namespacePtr = Tcl_CreateNamespace(interp, objName, oPtr, NULL);
if (oPtr->namespacePtr != NULL) {
creationEpoch = fPtr->tsdPtr->nsCount;
break;
@@ -633,7 +634,7 @@ AllocObject(
* access variables in it. [Bug 2950259]
*/
((Namespace *) oPtr->namespacePtr)->earlyDeleteProc = SquelchedNsFirst;
((Namespace *) oPtr->namespacePtr)->earlyDeleteProc = ObjectNamespaceDeleted;
/*
* Fill in the rest of the non-zero/NULL parts of the structure.
@@ -652,23 +653,11 @@ AllocObject(
*/
if (!nameStr) {
oPtr->command = Tcl_CreateObjCommand(interp,
oPtr->namespacePtr->fullName, PublicObjectCmd, oPtr, NULL);
} else if (nameStr[0] == ':' && nameStr[1] == ':') {
oPtr->command = Tcl_CreateObjCommand(interp, nameStr,
PublicObjectCmd, oPtr, NULL);
} else {
Tcl_DString buffer;
Tcl_DStringInit(&buffer);
Tcl_DStringAppend(&buffer,
Tcl_GetCurrentNamespace(interp)->fullName, -1);
TclDStringAppendLiteral(&buffer, "::");
Tcl_DStringAppend(&buffer, nameStr, -1);
oPtr->command = Tcl_CreateObjCommand(interp,
Tcl_DStringValue(&buffer), PublicObjectCmd, oPtr, NULL);
Tcl_DStringFree(&buffer);
nameStr = oPtr->namespacePtr->name;
nsPtr = (Namespace *)oPtr->namespacePtr;
}
oPtr->command = TclCreateObjCommandInNs(interp, nameStr,
(Tcl_Namespace *)nsPtr, PublicObjectCmd, oPtr, NULL);
/*
* Add the NRE command and trace directly. While this breaks a number of
@@ -751,30 +740,6 @@ MyDeleted(
oPtr->myCommand = NULL;
}
/*
* ----------------------------------------------------------------------
*
* SquelchedNsFirst --
*
* This callback is triggered when the object's namespace is deleted by
* any mechanism. It deletes the object's public command if it has not
* already been deleted, so ensuring that destructors get run at an
* appropriate time. [Bug 2950259]
*
* ----------------------------------------------------------------------
*/
static void
SquelchedNsFirst(
ClientData clientData)
{
Object *oPtr = clientData;
if (oPtr->command) {
Tcl_DeleteCommandFromToken(oPtr->fPtr->interp, oPtr->command);
}
}
/*
* ----------------------------------------------------------------------
*
@@ -797,8 +762,6 @@ ObjectRenamedTrace(
int flags) /* Why was the object deleted? */
{
Object *oPtr = clientData;
Foundation *fPtr = oPtr->fPtr;
/*
* If this is a rename and not a delete of the object, we just flush the
* cache of the object name.
@@ -810,87 +773,35 @@ ObjectRenamedTrace(
}
/*
* Oh dear, the object really is being deleted. Handle this by running the
* destructors and deleting the object's namespace, which in turn causes
* the real object structures to be deleted.
*
* Note that it is possible for the namespace to be deleted before the
* command. Because of that case, we must take care here to mark the
* command as being deleted so that if we return here we don't run into
* reentrancy problems.
*
* We also do not run destructors on the core class objects when the
* interpreter is being deleted; their incestuous nature causes problems
* in that case when the destructor is partially deleted before the uses
* of it have gone. [Bug 2949397]
* The namespace is only deleted if it hasn't already been deleted. [Bug
* 2950259]. If the namespace has already been deleted, then
* ObjectNamespaceDeleted() has already cleaned up this command.
*/
AddRef(oPtr);
AddRef(fPtr->classCls);
AddRef(fPtr->objectCls);
AddRef(fPtr->classCls->thisPtr);
AddRef(fPtr->objectCls->thisPtr);
oPtr->command = NULL;
if (!(oPtr->flags & DESTRUCTOR_CALLED) && !Tcl_InterpDeleted(interp)) {
CallContext *contextPtr =
TclOOGetCallContext(oPtr, NULL, DESTRUCTOR, NULL);
int result;
Tcl_InterpState state;
oPtr->flags |= DESTRUCTOR_CALLED;
if (contextPtr != NULL) {
contextPtr->callPtr->flags |= DESTRUCTOR;
contextPtr->skip = 0;
state = Tcl_SaveInterpState(interp, TCL_OK);
result = Tcl_NRCallObjProc(interp, TclOOInvokeContext,
contextPtr, 0, NULL);
if (result != TCL_OK) {
Tcl_BackgroundException(interp, result);
}
Tcl_RestoreInterpState(interp, state);
TclOODeleteContext(contextPtr);
if (oPtr->namespacePtr == NULL) {
/*
* ObjectNamespaceDeleted() has already done all the cleanup, but
* detected that the command was in the process of being deleted, and
* left the pointer allocated for us.
*/
DelRef(oPtr);
} else {
if (((Namespace *) oPtr->namespacePtr)->earlyDeleteProc == NULL) {
/*
* ObjectNamespaceDeleted() called us, and still has some work to
* do, so we leave the pointer allocated for it to finish, and then
* it will deallocate the pointer.
*/
} else {
Tcl_DeleteNamespace(oPtr->namespacePtr);
/*
* ObjectNamespaceDeleted() doesn't know it was us that just
* called, so it left the pointer allocated.
*/
DelRef(oPtr);
}
}
/*
* OK, the destructor's been run. Time to splat the class data (if any)
* and nuke the namespace (which triggers the final crushing of the object
* structure itself).
*
* The class of objects needs some special care; if it is deleted (and
* we're not killing the whole interpreter) we force the delete of the
* class of classes now as well. Due to the incestuous nature of those two
* classes, if one goes the other must too and yet the tangle can
* sometimes not go away automatically; we force it here. [Bug 2962664]
*/
if (!Tcl_InterpDeleted(interp) && IsRootObject(oPtr)
&& !Deleted(fPtr->classCls->thisPtr)) {
Tcl_DeleteCommandFromToken(interp, fPtr->classCls->thisPtr->command);
}
if (oPtr->classPtr != NULL) {
AddRef(oPtr->classPtr);
ReleaseClassContents(interp, oPtr);
}
/*
* The namespace is only deleted if it hasn't already been deleted. [Bug
* 2950259]
*/
if (((Namespace *) oPtr->namespacePtr)->earlyDeleteProc != NULL) {
Tcl_DeleteNamespace(oPtr->namespacePtr);
}
if (oPtr->classPtr) {
DelRef(oPtr->classPtr);
}
DelRef(fPtr->classCls->thisPtr);
DelRef(fPtr->objectCls->thisPtr);
DelRef(fPtr->classCls);
DelRef(fPtr->objectCls);
DelRef(oPtr);
return;
}
/*
@@ -962,7 +873,9 @@ ReleaseClassContents(
int i;
Class *clsPtr = oPtr->classPtr, *mixinSubclassPtr, *subclassPtr;
Object *instancePtr;
Method *mPtr;
Foundation *fPtr = oPtr->fPtr;
Tcl_Obj *variableObj;
/*
* Sanity check!
@@ -1000,18 +913,30 @@ ReleaseClassContents(
}
if (!IsRootClass(oPtr)) {
FOREACH(instancePtr, clsPtr->instances) {
int j;
if (instancePtr->selfCls == clsPtr) {
instancePtr->flags |= CLASS_GONE;
}
for(j=0 ; j<instancePtr->mixins.num ; j++) {
Class *mixin = instancePtr->mixins.list[j];
if (mixin == clsPtr) {
instancePtr->mixins.list[j] = NULL;
if (instancePtr != oPtr) {
int j;
if (instancePtr->selfCls == clsPtr) {
instancePtr->flags |= CLASS_GONE;
}
for(j=0 ; j<instancePtr->mixins.num ; j++) {
Class *mixin = instancePtr->mixins.list[j];
Class *nextMixin = NULL;
if (mixin == clsPtr) {
if (j < instancePtr->mixins.num - 1) {
nextMixin = instancePtr->mixins.list[j+1];
}
if (j == 0) {
instancePtr->mixins.num = 0;
instancePtr->mixins.list = NULL;
} else {
instancePtr->mixins.list[j-1] = nextMixin;
}
instancePtr->mixins.num -= 1;
}
}
if (instancePtr != NULL && !IsRoot(instancePtr)) {
AddRef(instancePtr);
}
}
if (instancePtr != NULL && !IsRoot(instancePtr)) {
AddRef(instancePtr);
}
}
}
@@ -1021,13 +946,15 @@ ReleaseClassContents(
*/
FOREACH(mixinSubclassPtr, clsPtr->mixinSubs) {
if (!Deleted(mixinSubclassPtr->thisPtr)) {
Tcl_DeleteCommandFromToken(interp,
mixinSubclassPtr->thisPtr->command);
if (mixinSubclassPtr != clsPtr) {
if (!Deleted(mixinSubclassPtr->thisPtr)) {
Tcl_DeleteCommandFromToken(interp,
mixinSubclassPtr->thisPtr->command);
}
ClearMixins(mixinSubclassPtr);
DelRef(mixinSubclassPtr->thisPtr);
DelRef(mixinSubclassPtr);
}
ClearMixins(mixinSubclassPtr);
DelRef(mixinSubclassPtr->thisPtr);
DelRef(mixinSubclassPtr);
}
if (clsPtr->mixinSubs.list != NULL) {
ckfree(clsPtr->mixinSubs.list);
@@ -1062,19 +989,21 @@ ReleaseClassContents(
if (!IsRootClass(oPtr)) {
FOREACH(instancePtr, clsPtr->instances) {
if (instancePtr == NULL || IsRoot(instancePtr)) {
continue;
if (instancePtr != oPtr) {
if (instancePtr == NULL || IsRoot(instancePtr)) {
continue;
}
if (!Deleted(instancePtr)) {
Tcl_DeleteCommandFromToken(interp, instancePtr->command);
/*
* Tcl_DeleteCommandFromToken() may have done to whole
* job for us. Roll back and check again.
*/
i--;
continue;
}
DelRef(instancePtr);
}
if (!Deleted(instancePtr)) {
Tcl_DeleteCommandFromToken(interp, instancePtr->command);
/*
* Tcl_DeleteCommandFromToken() may have done to whole
* job for us. Roll back and check again.
*/
i--;
continue;
}
DelRef(instancePtr);
}
}
if (clsPtr->instances.list != NULL) {
@@ -1143,6 +1072,30 @@ ReleaseClassContents(
ckfree(clsPtr->metadataPtr);
clsPtr->metadataPtr = NULL;
}
ClearMixins(clsPtr);
ClearSuperclasses(clsPtr);
FOREACH_HASH_VALUE(mPtr, &clsPtr->classMethods) {
TclOODelMethodRef(mPtr);
}
Tcl_DeleteHashTable(&clsPtr->classMethods);
TclOODelMethodRef(clsPtr->constructorPtr);
TclOODelMethodRef(clsPtr->destructorPtr);
FOREACH(variableObj, clsPtr->variables) {
TclDecrRefCount(variableObj);
}
if (i) {
ckfree(clsPtr->variables.list);
}
/* Tell oPtr that it's class is gone so that it doesn't try to remove
* itself from it's classe's list of instances
*/
oPtr->flags |= CLASS_GONE;
DelRef(clsPtr);
}
/*
@@ -1164,22 +1117,71 @@ ObjectNamespaceDeleted(
* being deleted. */
{
Object *oPtr = clientData;
Foundation *fPtr = oPtr->fPtr;
FOREACH_HASH_DECLS;
Class *clsPtr = oPtr->classPtr, *mixinPtr;
Class *mixinPtr;
Method *mPtr;
Tcl_Obj *filterObj, *variableObj;
int i;
Tcl_Interp *interp = oPtr->fPtr->interp;
int finished = 0, i;
AddRef(fPtr->classCls);
AddRef(fPtr->objectCls);
AddRef(fPtr->classCls->thisPtr);
AddRef(fPtr->objectCls->thisPtr);
/*
* We do not run destructors on the core class objects when the
* interpreter is being deleted; their incestuous nature causes problems
* in that case when the destructor is partially deleted before the uses
* of it have gone. [Bug 2949397]
*/
if (!(oPtr->flags & DESTRUCTOR_CALLED) && !Tcl_InterpDeleted(interp)) {
CallContext *contextPtr =
TclOOGetCallContext(oPtr, NULL, DESTRUCTOR, NULL);
int result;
Tcl_InterpState state;
oPtr->flags |= DESTRUCTOR_CALLED;
if (contextPtr != NULL) {
contextPtr->callPtr->flags |= DESTRUCTOR;
contextPtr->skip = 0;
state = Tcl_SaveInterpState(interp, TCL_OK);
result = Tcl_NRCallObjProc(interp, TclOOInvokeContext,
contextPtr, 0, NULL);
if (result != TCL_OK) {
Tcl_BackgroundException(interp, result);
}
Tcl_RestoreInterpState(interp, state);
TclOODeleteContext(contextPtr);
}
}
/*
* Instruct everyone to no longer use any allocated fields of the object.
* Also delete the commands that refer to the object at this point (if
* they still exist) because otherwise their references to the object
* point into freed memory, allowing crashes.
* Also delete the command that refers to the object at this point (if
* it still exists) because otherwise its pointer to the object
* points into freed memory.
*/
if (oPtr->command) {
if ((((Command *)oPtr->command)->flags && CMD_IS_DELETED)) {
/*
* Something has already started the command deletion process. We can
* go ahead and clean up the the namespace,
*/
} else {
/*
* The namespace must have been deleted directly. Delete the command
* as well.
*/
Tcl_DeleteCommandFromToken(oPtr->fPtr->interp, oPtr->command);
finished = 1;
}
oPtr->command = NULL;
if (oPtr->myCommand) {
Tcl_DeleteCommandFromToken(oPtr->fPtr->interp, oPtr->myCommand);
}
@@ -1194,7 +1196,7 @@ ObjectNamespaceDeleted(
}
FOREACH(mixinPtr, oPtr->mixins) {
if (mixinPtr) {
if (mixinPtr && mixinPtr != oPtr->classPtr) {
TclOORemoveFromInstances(oPtr, mixinPtr);
}
}
@@ -1243,69 +1245,52 @@ ObjectNamespaceDeleted(
}
/*
* If this was a class, there's additional deletion work to do.
* Because an object can be a class that is an instance of itself, the
* A class object's class structure should only be cleaned after most of
* the cleanup on the object is done.
*/
if (clsPtr != NULL) {
Tcl_ObjectMetadataType *metadataTypePtr;
ClientData value;
if (clsPtr->metadataPtr != NULL) {
FOREACH_HASH(metadataTypePtr, value, clsPtr->metadataPtr) {
metadataTypePtr->deleteProc(value);
}
Tcl_DeleteHashTable(clsPtr->metadataPtr);
ckfree(clsPtr->metadataPtr);
clsPtr->metadataPtr = NULL;
}
FOREACH(filterObj, clsPtr->filters) {
TclDecrRefCount(filterObj);
}
if (i) {
ckfree(clsPtr->filters.list);
clsPtr->filters.num = 0;
}
ClearMixins(clsPtr);
ClearSuperclasses(clsPtr);
if (clsPtr->subclasses.list) {
ckfree(clsPtr->subclasses.list);
clsPtr->subclasses.num = 0;
}
if (clsPtr->instances.list) {
ckfree(clsPtr->instances.list);
clsPtr->instances.num = 0;
}
if (clsPtr->mixinSubs.list) {
ckfree(clsPtr->mixinSubs.list);
clsPtr->mixinSubs.num = 0;
}
FOREACH_HASH_VALUE(mPtr, &clsPtr->classMethods) {
TclOODelMethodRef(mPtr);
}
Tcl_DeleteHashTable(&clsPtr->classMethods);
TclOODelMethodRef(clsPtr->constructorPtr);
TclOODelMethodRef(clsPtr->destructorPtr);
FOREACH(variableObj, clsPtr->variables) {
TclDecrRefCount(variableObj);
}
if (i) {
ckfree(clsPtr->variables.list);
}
DelRef(clsPtr);
/*
* The class of objects needs some special care; if it is deleted (and
* we're not killing the whole interpreter) we force the delete of the
* class of classes now as well. Due to the incestuous nature of those two
* classes, if one goes the other must too and yet the tangle can
* sometimes not go away automatically; we force it here. [Bug 2962664]
*/
if (!Tcl_InterpDeleted(interp) && IsRootObject(oPtr)
&& !Deleted(fPtr->classCls->thisPtr)) {
Tcl_DeleteCommandFromToken(interp, fPtr->classCls->thisPtr->command);
}
if (oPtr->classPtr != NULL) {
ReleaseClassContents(interp, oPtr);
}
/*
* Delete the object structure itself.
*/
DelRef(oPtr);
oPtr->classPtr = NULL;
oPtr->namespacePtr = NULL;
DelRef(fPtr->classCls->thisPtr);
DelRef(fPtr->objectCls->thisPtr);
DelRef(fPtr->classCls);
DelRef(fPtr->objectCls);
if (finished) {
/*
* ObjectRenamedTrace called us, and not the other way around.
*/
DelRef(oPtr);
} else {
/*
* ObjectRenamedTrace will call DelRef(oPtr).
*/
}
return;
}
/*
@@ -1398,7 +1383,7 @@ TclOOAddToInstances(
void
TclOORemoveFromSubclasses(
Class *subPtr, /* The subclass to remove. */
Class *superPtr) /* The superclass to (possibly) remove the
Class *superPtr) /* The superclass to possibly remove the
* subclass reference from. */
{
int i;
@@ -1469,7 +1454,7 @@ TclOOAddToSubclasses(
void
TclOORemoveFromMixinSubs(
Class *subPtr, /* The subclass to remove. */
Class *superPtr) /* The superclass to (possibly) remove the
Class *superPtr) /* The superclass to possibly remove the
* subclass reference from. */
{
int i;
@@ -1543,7 +1528,7 @@ AllocClass(
* class. */
Object *useThisObj) /* Object that is to act as the class
* representation, or NULL if a new object
* (with automatic name) is to be used. */
* with automatic name is to be used. */
{
Foundation *fPtr = GetFoundation(interp);
Class *clsPtr = ckalloc(sizeof(Class));
@@ -1554,7 +1539,7 @@ AllocClass(
memset(clsPtr, 0, sizeof(Class));
if (useThisObj == NULL) {
clsPtr->thisPtr = AllocObject(interp, NULL, NULL);
clsPtr->thisPtr = AllocObject(interp, NULL, NULL, NULL);
} else {
clsPtr->thisPtr = useThisObj;
}
@@ -1615,7 +1600,6 @@ AllocClass(
*
* ----------------------------------------------------------------------
*/
Tcl_Object
Tcl_NewObjectInstance(
Tcl_Interp *interp, /* Interpreter context. */
@@ -1632,52 +1616,15 @@ Tcl_NewObjectInstance(
* constructor. */
{
register Class *classPtr = (Class *) cls;
Foundation *fPtr = GetFoundation(interp);
Object *oPtr;
ClientData clientData[4];
oPtr = TclNewObjectInstanceCommon(interp, classPtr, nameStr, nsNameStr);
if (oPtr == NULL) {return NULL;}
/*
* Check if we're going to create an object over an existing command;
* that's not allowed.
*/
if (nameStr && Tcl_FindCommand(interp, nameStr, NULL,
TCL_NAMESPACE_ONLY)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't create object \"%s\": command already exists with"
" that name", nameStr));
Tcl_SetErrorCode(interp, "TCL", "OO", "OVERWRITE_OBJECT", NULL);
return NULL;
}
/*
* Create the object.
*/
oPtr = AllocObject(interp, nameStr, nsNameStr);
oPtr->selfCls = classPtr;
TclOOAddToInstances(oPtr, classPtr);
/*
* Check to see if we're really creating a class. If so, allocate the
* class structure as well.
*/
if (TclOOIsReachable(fPtr->classCls, classPtr)) {
/*
* Is a class, so attach a class structure. Note that the AllocClass
* function splices the structure into the object, so we don't have
* to. Once that's done, we need to repatch the object to have the
* right class since AllocClass interferes with that.
*/
AllocClass(interp, oPtr);
oPtr->selfCls = classPtr;
TclOOAddToSubclasses(oPtr->classPtr, fPtr->objectCls);
}
/*
* Run constructors, except when objc < 0 (a special flag case used for
* object cloning only).
* Run constructors, except when objc < 0, which is a special flag case
* used for object cloning only.
*/
if (objc >= 0) {
@@ -1704,36 +1651,16 @@ Tcl_NewObjectInstance(
TclResetRewriteEnsemble(interp, 1);
}
/*
* It's an error if the object was whacked in the constructor.
* Force this if it isn't already an error (don't want to lose
* errors by accident...) [Bug 2903011]
*/
clientData[0] = contextPtr;
clientData[1] = oPtr;
clientData[2] = state;
clientData[3] = &oPtr;
if (result != TCL_ERROR && Deleted(oPtr)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"object deleted in constructor", -1));
Tcl_SetErrorCode(interp, "TCL", "OO", "STILLBORN", NULL);
result = TCL_ERROR;
}
TclOODeleteContext(contextPtr);
AddRef(oPtr);
result = FinalizeAlloc(clientData, interp, result);
if (result != TCL_OK) {
Tcl_DiscardInterpState(state);
/*
* Take care to not delete a deleted object; that would be
* bad. [Bug 2903011] Also take care to make sure that we have
* the name of the command before we delete it. [Bug
* 9dd1bd7a74]
*/
if (!Deleted(oPtr)) {
(void) TclOOObjectName(interp, oPtr);
Tcl_DeleteCommandFromToken(interp, oPtr->command);
}
return NULL;
}
Tcl_RestoreInterpState(interp, state);
}
}
@@ -1758,50 +1685,12 @@ TclNRNewObjectInstance(
* successful allocation. */
{
register Class *classPtr = (Class *) cls;
Foundation *fPtr = GetFoundation(interp);
CallContext *contextPtr;
Tcl_InterpState state;
Object *oPtr;
/*
* Check if we're going to create an object over an existing command;
* that's not allowed.
*/
if (nameStr && Tcl_FindCommand(interp, nameStr, NULL,
TCL_NAMESPACE_ONLY)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't create object \"%s\": command already exists with"
" that name", nameStr));
Tcl_SetErrorCode(interp, "TCL", "OO", "OVERWRITE_OBJECT", NULL);
return TCL_ERROR;
}
/*
* Create the object.
*/
oPtr = AllocObject(interp, nameStr, nsNameStr);
oPtr->selfCls = classPtr;
TclOOAddToInstances(oPtr, classPtr);
/*
* Check to see if we're really creating a class. If so, allocate the
* class structure as well.
*/
if (TclOOIsReachable(fPtr->classCls, classPtr)) {
/*
* Is a class, so attach a class structure. Note that the AllocClass
* function splices the structure into the object, so we don't have
* to. Once that's done, we need to repatch the object to have the
* right class since AllocClass interferes with that.
*/
AllocClass(interp, oPtr);
oPtr->selfCls = classPtr;
TclOOAddToSubclasses(oPtr->classPtr, fPtr->objectCls);
}
oPtr = TclNewObjectInstanceCommon(interp, classPtr, nameStr, nsNameStr);
if (oPtr == NULL) {return TCL_ERROR;}
/*
* Run constructors, except when objc < 0 (a special flag case used for
@@ -1823,7 +1712,7 @@ TclNRNewObjectInstance(
contextPtr->skip = skip;
/*
* Adjust the ensmble tracking record if necessary. [Bug 3514761]
* Adjust the ensemble tracking record if necessary. [Bug 3514761]
*/
if (TclInitRewriteEnsemble(interp, skip, skip, objv)) {
@@ -1841,6 +1730,83 @@ TclNRNewObjectInstance(
return TclOOInvokeContext(contextPtr, interp, objc, objv);
}
Object *
TclNewObjectInstanceCommon(
Tcl_Interp *interp,
Class *classPtr,
const char *nameStr,
const char *nsNameStr)
{
Tcl_HashEntry *hPtr;
Foundation *fPtr = GetFoundation(interp);
Object *oPtr;
const char *simpleName = NULL;
Namespace *nsPtr = NULL, *dummy,
*inNsPtr = (Namespace *)TclGetCurrentNamespace(interp);
int isNew;
if (nameStr) {
TclGetNamespaceForQualName(interp, nameStr, inNsPtr, TCL_CREATE_NS_IF_UNKNOWN,
&nsPtr, &dummy, &dummy, &simpleName);
/*
* Disallow creation of an object over an existing command.
*/
hPtr = Tcl_CreateHashEntry(&nsPtr->cmdTable, simpleName, &isNew);
if (isNew) {
/* Just kidding */
Tcl_DeleteHashEntry(hPtr);
} else {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't create object \"%s\": command already exists with"
" that name", nameStr));
Tcl_SetErrorCode(interp, "TCL", "OO", "OVERWRITE_OBJECT", NULL);
return NULL;
}
}
/*
* Create the object.
*/
/*
* The command for the object could have the same name as the command
* associated with classPtr, so protect the structure from deallocation
* here.
*/
AddRef(classPtr);
oPtr = AllocObject(interp, simpleName, nsPtr, nsNameStr);
DelRef(classPtr);
oPtr->selfCls = classPtr;
TclOOAddToInstances(oPtr, classPtr);
/*
* Check to see if we're really creating a class. If so, allocate the
* class structure as well.
*/
if (TclOOIsReachable(fPtr->classCls, classPtr)) {
/*
* Is a class, so attach a class structure. Note that the AllocClass
* function splices the structure into the object, so we don't have
* to. Once that's done, we need to repatch the object to have the
* right class since AllocClass interferes with that.
*/
AllocClass(interp, oPtr);
oPtr->selfCls = classPtr;
TclOOAddToSubclasses(oPtr->classPtr, fPtr->objectCls);
} else {
oPtr->classPtr = NULL;
}
return oPtr;
}
static int
FinalizeAlloc(
ClientData data[],
@@ -1853,9 +1819,8 @@ FinalizeAlloc(
Tcl_Object *objectPtr = data[3];
/*
* It's an error if the object was whacked in the constructor. Force this
* if it isn't already an error (don't want to lose errors by accident...)
* [Bug 2903011]
* Ensure an error if the object was deleted in the constructor.
* Don't want to lose errors by accident. [Bug 2903011]
*/
if (result != TCL_ERROR && Deleted(oPtr)) {
@@ -2433,7 +2398,7 @@ Tcl_ObjectSetMetadata(
*
* PublicObjectCmd, PrivateObjectCmd, TclOOInvokeObject --
*
* Main entry point for object invokations. The Public* and Private*
* Main entry point for object invocations. The Public* and Private*
* wrapper functions (implementations of both object instance commands
* and [my]) are just thin wrappers round the main TclOOObjectCmdCore
* function. Note that the core is function is NRE-aware.
@@ -2518,8 +2483,8 @@ TclOOInvokeObject(
*
* TclOOObjectCmdCore, FinalizeObjectCall --
*
* Main function for object invokations. Does call chain creation,
* management and invokation. The function FinalizeObjectCall exists to
* Main function for object invocations. Does call chain creation,
* management and invocation. The function FinalizeObjectCall exists to
* clean up after the non-recursive processing of TclOOObjectCmdCore.
*
* ----------------------------------------------------------------------
@@ -2531,7 +2496,7 @@ TclOOObjectCmdCore(
Tcl_Interp *interp, /* The interpreter containing the object. */
int objc, /* How many arguments are being passed in. */
Tcl_Obj *const *objv, /* The array of arguments. */
int flags, /* Whether this is an invokation through the
int flags, /* Whether this is an invocation through the
* public or the private command interface. */
Class *startCls) /* Where to start in the call chain, or NULL
* if we are to start at the front with
@@ -2720,7 +2685,7 @@ Tcl_ObjectContextInvokeNext(
* call context while we process the body. However, need to adjust the
* argument-skip control because we're guaranteed to have a single prefix
* arg (i.e., 'next') and not the variable amount that can happen because
* method invokations (i.e., '$obj meth' and 'my meth'), constructors
* method invocations (i.e., '$obj meth' and 'my meth'), constructors
* (i.e., '$cls new' and '$cls create obj') and destructors (no args at
* all) come through the same code.
*/
@@ -2789,7 +2754,7 @@ TclNRObjectContextInvokeNext(
* call context while we process the body. However, need to adjust the
* argument-skip control because we're guaranteed to have a single prefix
* arg (i.e., 'next') and not the variable amount that can happen because
* method invokations (i.e., '$obj meth' and 'my meth'), constructors
* method invocations (i.e., '$obj meth' and 'my meth'), constructors
* (i.e., '$cls new' and '$cls create obj') and destructors (no args at
* all) come through the same code.
*/
+1 -1
View File
@@ -24,7 +24,7 @@
* win/tclooConfig.sh
*/
#define TCLOO_VERSION "1.0.4"
#define TCLOO_VERSION "1.2.0"
#define TCLOO_PATCHLEVEL TCLOO_VERSION
#include "tcl.h"
-13
View File
@@ -1206,22 +1206,10 @@ TclOOCopyObjectCmd(
o2Ptr = Tcl_CopyObjectInstance(interp, oPtr, NULL, NULL);
} else {
const char *name, *namespaceName;
Tcl_DString buffer;
name = TclGetString(objv[2]);
Tcl_DStringInit(&buffer);
if (name[0] == '\0') {
name = NULL;
} else if (name[0]!=':' || name[1]!=':') {
Interp *iPtr = (Interp *) interp;
if (iPtr->varFramePtr != NULL) {
Tcl_DStringAppend(&buffer,
iPtr->varFramePtr->nsPtr->fullName, -1);
}
TclDStringAppendLiteral(&buffer, "::");
Tcl_DStringAppend(&buffer, name, -1);
name = Tcl_DStringValue(&buffer);
}
/*
@@ -1243,7 +1231,6 @@ TclOOCopyObjectCmd(
}
o2Ptr = Tcl_CopyObjectInstance(interp, oPtr, name, namespaceName);
Tcl_DStringFree(&buffer);
}
if (o2Ptr == NULL) {
+60 -23
View File
@@ -53,7 +53,8 @@ static void AddClassFiltersToCallContext(Object *const oPtr,
Class *clsPtr, struct ChainBuilder *const cbPtr,
Tcl_HashTable *const doneFilters, int flags);
static void AddClassMethodNames(Class *clsPtr, const int flags,
Tcl_HashTable *const namesPtr);
Tcl_HashTable *const namesPtr,
Tcl_HashTable *const examinedClassesPtr);
static inline void AddMethodToCallChain(Method *const mPtr,
struct ChainBuilder *const cbPtr,
Tcl_HashTable *const doneFilters,
@@ -232,7 +233,7 @@ FreeMethodNameRep(
* TclOOInvokeContext --
*
* Invokes a single step along a method call-chain context. Note that the
* invokation of a step along the chain can cause further steps along the
* invocation of a step along the chain can cause further steps along the
* chain to be invoked. Note that this function is written to be as light
* in stack usage as possible.
*
@@ -367,6 +368,10 @@ TclOOGetSortedMethodList(
{
Tcl_HashTable names; /* Tcl_Obj* method name to "wanted in list"
* mapping. */
Tcl_HashTable examinedClasses;
/* Used to track what classes have been looked
* at. Is set-like in nature and keyed by
* pointer to class. */
FOREACH_HASH_DECLS;
int i;
Class *mixinPtr;
@@ -376,6 +381,7 @@ TclOOGetSortedMethodList(
void *isWanted;
Tcl_InitObjHashTable(&names);
Tcl_InitHashTable(&examinedClasses, TCL_ONE_WORD_KEYS);
/*
* Name the bits used in the names table values.
@@ -436,11 +442,14 @@ TclOOGetSortedMethodList(
* hierarchy.
*/
AddClassMethodNames(oPtr->selfCls, flags, &names);
AddClassMethodNames(oPtr->selfCls, flags, &names, &examinedClasses);
FOREACH(mixinPtr, oPtr->mixins) {
AddClassMethodNames(mixinPtr, flags|TRAVERSED_MIXIN, &names);
AddClassMethodNames(mixinPtr, flags|TRAVERSED_MIXIN, &names,
&examinedClasses);
}
Tcl_DeleteHashTable(&examinedClasses);
/*
* See how many (visible) method names there are. If none, we do not (and
* should not) try to sort the list of them.
@@ -495,18 +504,24 @@ TclOOGetSortedClassMethodList(
{
Tcl_HashTable names; /* Tcl_Obj* method name to "wanted in list"
* mapping. */
Tcl_HashTable examinedClasses;
/* Used to track what classes have been looked
* at. Is set-like in nature and keyed by
* pointer to class. */
FOREACH_HASH_DECLS;
int i;
Tcl_Obj *namePtr;
void *isWanted;
Tcl_InitObjHashTable(&names);
Tcl_InitHashTable(&examinedClasses, TCL_ONE_WORD_KEYS);
/*
* Process method names from the class hierarchy and the mixin hierarchy.
*/
AddClassMethodNames(clsPtr, flags, &names);
AddClassMethodNames(clsPtr, flags, &names, &examinedClasses);
Tcl_DeleteHashTable(&examinedClasses);
/*
* See how many (visible) method names there are. If none, we do not (and
@@ -581,14 +596,28 @@ AddClassMethodNames(
Class *clsPtr, /* Class to get method names from. */
const int flags, /* Whether we are interested in just the
* public method names. */
Tcl_HashTable *const namesPtr)
Tcl_HashTable *const namesPtr,
/* Reference to the hash table to put the
* information in. The hash table maps the
* Tcl_Obj * method name to an integral value
* describing whether the method is wanted.
* This ensures that public/private override
* semantics are handled correctly.*/
* semantics are handled correctly. */
Tcl_HashTable *const examinedClassesPtr)
/* Hash table that tracks what classes have
* already been looked at. The keys are the
* pointers to the classes, and the values are
* immaterial. */
{
/*
* If we've already started looking at this class, stop working on it now
* to prevent repeated work.
*/
if (Tcl_FindHashEntry(examinedClassesPtr, (char *) clsPtr)) {
return;
}
/*
* Scope all declarations so that the compiler can stand a good chance of
* making the recursive step highly efficient. We also hand-implement the
@@ -596,24 +625,31 @@ AddClassMethodNames(
* tail-recursion optimization usefully.
*/
if (clsPtr->mixins.num != 0) {
Class *mixinPtr;
int i;
/* TODO: Beware of infinite loops! */
FOREACH(mixinPtr, clsPtr->mixins) {
AddClassMethodNames(mixinPtr, flags|TRAVERSED_MIXIN, namesPtr);
}
}
while (1) {
FOREACH_HASH_DECLS;
Tcl_Obj *namePtr;
Method *mPtr;
int isNew;
(void) Tcl_CreateHashEntry(examinedClassesPtr, (char *) clsPtr,
&isNew);
if (!isNew) {
break;
}
if (clsPtr->mixins.num != 0) {
Class *mixinPtr;
int i;
FOREACH(mixinPtr, clsPtr->mixins) {
if (mixinPtr != clsPtr) {
AddClassMethodNames(mixinPtr, flags|TRAVERSED_MIXIN,
namesPtr, examinedClassesPtr);
}
}
}
FOREACH_HASH(namePtr, mPtr, &clsPtr->classMethods) {
int isNew;
hPtr = Tcl_CreateHashEntry(namesPtr, (char *) namePtr, &isNew);
if (isNew) {
int isWanted = (!(flags & PUBLIC_METHOD)
@@ -640,7 +676,8 @@ AddClassMethodNames(
int i;
FOREACH(superPtr, clsPtr->superclasses) {
AddClassMethodNames(superPtr, flags, namesPtr);
AddClassMethodNames(superPtr, flags, namesPtr,
examinedClassesPtr);
}
}
}
@@ -793,7 +830,7 @@ AddMethodToCallChain(
* Call chain semantics states that methods come as *late* in the
* call chain as possible. This is done by copying down the
* following methods. Note that this does not change the number of
* method invokations in the call chain; it just rearranges them.
* method invocations in the call chain; it just rearranges them.
*/
Class *declCls = callPtr->chain[i].filterDeclarer;
@@ -898,7 +935,7 @@ IsStillValid(
* TclOOGetCallContext --
*
* Responsible for constructing the call context, an ordered list of all
* method implementations to be called as part of a method invokation.
* method implementations to be called as part of a method invocation.
* This method is central to the whole operation of the OO system.
*
* ----------------------------------------------------------------------
@@ -1480,7 +1517,7 @@ TclOORenderCallChain(
/*
* Do the actual construction of the descriptions. They consist of a list
* of triples that describe the details of how a method is understood. For
* each triple, the first word is the type of invokation ("method" is
* each triple, the first word is the type of invocation ("method" is
* normal, "unknown" is special because it adds the method name as an
* extra argument when handled by some method types, and "filter" is
* special because it's a filter method). The second word is the name of
+12 -8
View File
@@ -149,8 +149,8 @@ typedef struct Object {
struct Foundation *fPtr; /* The basis for the object system. Putting
* this here allows the avoidance of quite a
* lot of hash lookups on the critical path
* for object invokation and creation. */
Tcl_Namespace *namespacePtr;/* This object's tame namespace. */
* for object invocation and creation. */
Tcl_Namespace *namespacePtr;/* This object's namespace. */
Tcl_Command command; /* Reference to this object's public
* command. */
Tcl_Command myCommand; /* Reference to this object's internal
@@ -162,12 +162,12 @@ typedef struct Object {
/* Classes mixed into this object. */
LIST_STATIC(Tcl_Obj *) filters;
/* List of filter names. */
struct Class *classPtr; /* All classes have this non-NULL; it points
* to the class structure. Everything else has
* this NULL. */
struct Class *classPtr; /* This is non-NULL for all classes, and NULL
* for everything else. It points to the class
* structure. */
int refCount; /* Number of strong references to this object.
* Note that there may be many more weak
* references; this mechanism is there to
* references; this mechanism exists to
* avoid Tcl_Preserve. */
int flags;
int creationEpoch; /* Unique value to make comparisons of objects
@@ -323,7 +323,7 @@ typedef struct Foundation {
} Foundation;
/*
* A call context structure is built when a method is called. They contain the
* A call context structure is built when a method is called. It contains the
* chain of method implementations that are to be invoked by a particular
* call, and the process of calling walks the chain, with the [next] command
* proceeding to the next entry in the chain.
@@ -334,7 +334,7 @@ typedef struct Foundation {
struct MInvoke {
Method *mPtr; /* Reference to the method implementation
* record. */
int isFilter; /* Whether this is a filter invokation. */
int isFilter; /* Whether this is a filter invocation. */
Class *filterDeclarer; /* What class decided to add the filter; if
* NULL, it was added by the object. */
};
@@ -495,6 +495,10 @@ MODULE_SCOPE int TclNRNewObjectInstance(Tcl_Interp *interp,
const char *nsNameStr, int objc,
Tcl_Obj *const *objv, int skip,
Tcl_Object *objectPtr);
MODULE_SCOPE Object * TclNewObjectInstanceCommon(Tcl_Interp *interp,
Class *classPtr,
const char *nameStr,
const char *nsNameStr);
MODULE_SCOPE int TclOODefineSlots(Foundation *fPtr);
MODULE_SCOPE void TclOODeleteChain(CallChain *callPtr);
MODULE_SCOPE void TclOODeleteChainCache(Tcl_HashTable *tablePtr);
+1
View File
@@ -1314,6 +1314,7 @@ CloneProcedureMethod(
*/
bodyObj = Tcl_DuplicateObj(pmPtr->procPtr->bodyPtr);
Tcl_GetString(bodyObj);
TclFreeIntRep(bodyObj);
/*
+6 -6
View File
@@ -344,17 +344,17 @@ typedef struct ResolvedCmdName {
* reference (not the namespace that contains
* the referenced command). NULL if the name
* is fully qualified.*/
size_t refNsId; /* refNsPtr's unique namespace id. Used to
unsigned long refNsId; /* refNsPtr's unique namespace id. Used to
* verify that refNsPtr is still valid (e.g.,
* it's possible that the cmd's containing
* namespace was deleted and a new one created
* at the same address). */
size_t refNsCmdEpoch; /* Value of the referencing namespace's
unsigned int refNsCmdEpoch; /* Value of the referencing namespace's
* cmdRefEpoch when the pointer was cached.
* Before using the cached pointer, we check
* if the namespace's epoch was incremented;
* if so, this cached pointer is invalid. */
size_t cmdEpoch; /* Value of the command's cmdEpoch when this
unsigned int cmdEpoch; /* Value of the command's cmdEpoch when this
* pointer was cached. Before using the cached
* pointer, we check if the cmd's epoch was
* incremented; if so, the cmd was renamed,
@@ -3038,7 +3038,7 @@ Tcl_SetWideIntObj(
#else
mp_int big;
TclBNInitBignumFromWideInt(&big, wideValue);
TclInitBignumFromWideInt(&big, wideValue);
Tcl_SetBignumObj(objPtr, &big);
#endif
}
@@ -3402,12 +3402,12 @@ GetBignumFromObj(
return TCL_OK;
}
if (objPtr->typePtr == &tclIntType) {
TclBNInitBignumFromLong(bignumValue, objPtr->internalRep.longValue);
TclInitBignumFromLong(bignumValue, objPtr->internalRep.longValue);
return TCL_OK;
}
#ifndef TCL_WIDE_INT_IS_LONG
if (objPtr->typePtr == &tclWideIntType) {
TclBNInitBignumFromWideInt(bignumValue,
TclInitBignumFromWideInt(bignumValue,
objPtr->internalRep.wideValue);
return TCL_OK;
}
+1 -1
View File
@@ -111,7 +111,7 @@ Tcl_PanicVA(
__builtin_trap();
# elif defined(_WIN64)
__debugbreak();
# elif defined(_MSC_VER)
# elif defined(_MSC_VER) && defined (_M_IX86)
_asm {int 3}
# else
DebugBreak();
+1 -1
View File
@@ -829,7 +829,7 @@ TclParseBackslash(
* written there. */
{
register const char *p = src+1;
Tcl_UniChar unichar;
Tcl_UniChar unichar = 0;
int result;
int count;
char buf[TCL_UTF_MAX];
+33 -36
View File
@@ -13,6 +13,7 @@
#include "tclInt.h"
#include "tclFileSystem.h"
#include <assert.h>
/*
* Prototypes for functions defined later in this file.
@@ -849,18 +850,20 @@ TclJoinPath(
int elements,
Tcl_Obj * const objv[])
{
Tcl_Obj *res;
Tcl_Obj *res = NULL;
int i;
const Tcl_Filesystem *fsPtr = NULL;
res = NULL;
assert ( elements >= 0 );
for (i = 0; i < elements; i++) {
int driveNameLength, strEltLen, length;
Tcl_PathType type;
char *strElt, *ptr;
Tcl_Obj *driveName = NULL;
Tcl_Obj *elt = objv[i];
if (elements == 0) {
return Tcl_NewObj();
}
assert ( elements > 0 );
if (elements == 2) {
Tcl_Obj *elt = objv[0];
/*
* This is a special case where we can be much more efficient, where
@@ -869,18 +872,17 @@ TclJoinPath(
* object which can be normalized more efficiently. Currently we only
* use the special case when we have exactly two elements, but we
* could expand that in the future.
*
* Bugfix [a47641a0]. TclNewFSPathObj requires first argument
* to be an absolute path. Added a check for that elt is absolute.
*
* Bugfix [a47641a0]. TclNewFSPathObj requires first argument
* to be an absolute path. Added a check for that elt is absolute.
*/
if ((i == (elements-2)) && (i == 0)
&& (elt->typePtr == &tclFsPathType)
if ((elt->typePtr == &tclFsPathType)
&& !((elt->bytes != NULL) && (elt->bytes[0] == '\0'))
&& TclGetPathType(elt, NULL, NULL, NULL) == TCL_PATH_ABSOLUTE) {
Tcl_Obj *tailObj = objv[i+1];
Tcl_Obj *tailObj = objv[1];
Tcl_PathType type = TclGetPathType(tailObj, NULL, NULL, NULL);
type = TclGetPathType(tailObj, NULL, NULL, NULL);
if (type == TCL_PATH_RELATIVE) {
const char *str;
int len;
@@ -893,9 +895,6 @@ TclJoinPath(
* the base itself is just fine!
*/
if (res != NULL) {
TclDecrRefCount(res);
}
return elt;
}
@@ -918,9 +917,6 @@ TclJoinPath(
if ((tclPlatform != TCL_PLATFORM_WINDOWS)
|| (strchr(Tcl_GetString(elt), '\\') == NULL)) {
if (res != NULL) {
TclDecrRefCount(res);
}
if (PATHFLAGS(elt)) {
return TclNewFSPathObj(elt, str, len);
@@ -940,23 +936,28 @@ TclJoinPath(
* more general code below handle things.
*/
} else if (tclPlatform == TCL_PLATFORM_UNIX) {
if (res != NULL) {
TclDecrRefCount(res);
}
return tailObj;
} else {
const char *str = TclGetString(tailObj);
if (tclPlatform == TCL_PLATFORM_WINDOWS) {
if (strchr(str, '\\') == NULL) {
if (res != NULL) {
TclDecrRefCount(res);
}
return tailObj;
}
}
}
}
}
assert ( res == NULL );
for (i = 0; i < elements; i++) {
int driveNameLength, strEltLen, length;
Tcl_PathType type;
char *strElt, *ptr;
Tcl_Obj *driveName = NULL;
Tcl_Obj *elt = objv[i];
strElt = TclGetStringFromObj(elt, &strEltLen);
driveNameLength = 0;
type = TclGetPathType(elt, &fsPtr, &driveNameLength, &driveName);
@@ -1051,10 +1052,8 @@ TclJoinPath(
noQuickReturn:
if (res == NULL) {
res = Tcl_NewObj();
ptr = TclGetStringFromObj(res, &length);
} else {
ptr = TclGetStringFromObj(res, &length);
}
ptr = TclGetStringFromObj(res, &length);
/*
* Strip off any './' before a tilde, unless this is the beginning of
@@ -1087,6 +1086,7 @@ TclJoinPath(
if (sep != NULL) {
separator = TclGetString(sep)[0];
TclDecrRefCount(sep);
}
/* Safety check in case the VFS driver caused sharing */
if (Tcl_IsShared(res)) {
@@ -1122,9 +1122,7 @@ TclJoinPath(
Tcl_SetObjLength(res, length);
}
}
if (res == NULL) {
res = Tcl_NewObj();
}
assert ( res != NULL );
return res;
}
@@ -1811,7 +1809,6 @@ Tcl_FSGetNormalizedPath(
*/
(void) TclGetStringFromObj(dir, &cwdLen);
cwdLen += (Tcl_GetString(copy)[cwdLen] == '/');
/* Normalize the combined string. */
@@ -1833,12 +1830,12 @@ Tcl_FSGetNormalizedPath(
* normalized head, we can more efficiently normalize the combined
* path by passing over only the unnormalized tail portion. When
* this is sufficient, prior developers claim this should be much
* faster. We use 'cwdLen-1' so that we are already pointing at
* faster. We use 'cwdLen' so that we are already pointing at
* the dir-separator that we know about. The normalization code
* will actually start off directly after that separator.
*/
TclFSNormalizeToUniquePath(interp, copy, cwdLen-1);
TclFSNormalizeToUniquePath(interp, copy, cwdLen);
}
/* Now we need to construct the new path object. */
+7 -1
View File
@@ -668,7 +668,13 @@ TclCreatePipeline(
if (*p == '>') {
p++;
atOK = 0;
flags = O_WRONLY | O_CREAT;
/*
* Note that the O_APPEND flag only has an effect on POSIX
* platforms. On Windows, we just have to carry on regardless.
*/
flags = O_WRONLY | O_CREAT | O_APPEND;
}
if (errorClose != 0) {
errorClose = 0;
+68 -48
View File
@@ -331,8 +331,8 @@ Tcl_PkgRequireEx(
*
* Second, how does this work? If we reach this point, then the global
* variable tclEmptyStringRep has the value NULL. Compare that with
* the definition of tclEmptyStringRep near the top of the file
* generic/tclObj.c. It clearly should not have the value NULL; it
* the definition of tclEmptyStringRep near the top of this file.
* It clearly should not have the value NULL; it
* should point to the char tclEmptyString. If we see it having the
* value NULL, then somehow we are seeing a Tcl library that isn't
* completely initialized, and that's an indicator for the error
@@ -348,18 +348,11 @@ Tcl_PkgRequireEx(
* After all, two Tcl libraries can't be a good thing!)
*
* Trouble is that's going to be tricky. We're now using a Tcl library
* that's not fully initialized. In particular, it doesn't have a
* proper value for tclEmptyStringRep. The Tcl_Obj system heavily
* depends on the value of tclEmptyStringRep and all of Tcl depends
* (increasingly) on the Tcl_Obj system, we need to correct that flaw
* before making the calls to set the interpreter result to the error
* message. That's the only flaw corrected; other problems with
* initialization of the Tcl library are not remedied, so be very
* careful about adding any other calls here without checking how they
* behave when initialization is incomplete.
* that's not fully initialized. Functions in it may not work
* reliably, so be very careful about adding any other calls here
* without checking how they behave when initialization is incomplete.
*/
tclEmptyStringRep = &tclEmptyString;
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"Cannot load package \"%s\" in standalone executable:"
" This package is not compiled with stub support", name));
@@ -425,7 +418,7 @@ PkgRequireCore(
Interp *iPtr = (Interp *) interp;
Package *pkgPtr;
PkgAvail *availPtr, *bestPtr, *bestStablePtr;
char *availVersion, *bestVersion;
char *availVersion, *bestVersion, *bestStableVersion;
/* Internal rep. of versions */
int availStable, code, satisfies, pass;
char *script, *pkgVersionI;
@@ -473,6 +466,7 @@ PkgRequireCore(
bestPtr = NULL;
bestStablePtr = NULL;
bestVersion = NULL;
bestStableVersion = NULL;
for (availPtr = pkgPtr->availPtr; availPtr != NULL;
availPtr = availPtr->nextPtr) {
@@ -487,32 +481,8 @@ PkgRequireCore(
continue;
}
if (bestPtr != NULL) {
int res = CompareVersions(availVersion, bestVersion, NULL);
/*
* Note: Use internal reps!
*/
if (res <= 0) {
/*
* The version of the package sought is not as good as the
* currently selected version. Ignore it.
*/
ckfree(availVersion);
availVersion = NULL;
continue;
}
}
/*
* We have found a version which is better than our max.
*/
/* Check satisfaction of requirements before considering the current version further. */
if (reqc > 0) {
/* Check satisfaction of requirements. */
satisfies = SomeRequirementSatisfied(availVersion, reqc, reqv);
if (!satisfies) {
ckfree(availVersion);
@@ -521,25 +491,75 @@ PkgRequireCore(
}
}
bestPtr = availPtr;
if (bestPtr != NULL) {
int res = CompareVersions(availVersion, bestVersion, NULL);
if (bestVersion != NULL) {
ckfree(bestVersion);
/*
* Note: Used internal reps in the comparison!
*/
if (res > 0) {
/*
* The version of the package sought is better than the
* currently selected version.
*/
ckfree(bestVersion);
bestVersion = NULL;
goto newbest;
}
} else {
newbest:
/* We have found a version which is better than our max. */
bestPtr = availPtr;
CheckVersionAndConvert(interp, bestPtr->version, &bestVersion, NULL);
}
bestVersion = availVersion;
/*
* If this new best version is stable then it also has to be
* better than the max stable version found so far.
*/
if (!availStable) {
ckfree(availVersion);
availVersion = NULL;
continue;
}
if (availStable) {
if (bestStablePtr != NULL) {
int res = CompareVersions(availVersion, bestStableVersion, NULL);
/*
* Note: Used internal reps in the comparison!
*/
if (res > 0) {
/*
* This stable version of the package sought is better
* than the currently selected stable version.
*/
ckfree(bestStableVersion);
bestStableVersion = NULL;
goto newstable;
}
} else {
newstable:
/* We have found a stable version which is better than our max stable. */
bestStablePtr = availPtr;
CheckVersionAndConvert(interp, bestStablePtr->version, &bestStableVersion, NULL);
}
}
ckfree(availVersion);
availVersion = NULL;
} /* end for */
/*
* Clean up memorized internal reps, if any.
*/
if (bestVersion != NULL) {
ckfree(bestVersion);
bestVersion = NULL;
}
if (bestStableVersion != NULL) {
ckfree(bestStableVersion);
bestStableVersion = NULL;
}
/*
+55 -91
View File
@@ -124,11 +124,10 @@ Tcl_ProcObjCmd(
{
register Interp *iPtr = (Interp *) interp;
Proc *procPtr;
const char *fullName;
const char *procName, *procArgs, *procBody;
const char *procName;
const char *simpleName, *procArgs, *procBody;
Namespace *nsPtr, *altNsPtr, *cxtNsPtr;
Tcl_Command cmd;
Tcl_DString ds;
if (objc != 4) {
Tcl_WrongNumArgs(interp, 1, objv, "name args body");
@@ -141,29 +140,21 @@ Tcl_ProcObjCmd(
* namespace.
*/
fullName = TclGetString(objv[1]);
TclGetNamespaceForQualName(interp, fullName, NULL, 0,
&nsPtr, &altNsPtr, &cxtNsPtr, &procName);
procName = TclGetString(objv[1]);
TclGetNamespaceForQualName(interp, procName, NULL, 0,
&nsPtr, &altNsPtr, &cxtNsPtr, &simpleName);
if (nsPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't create procedure \"%s\": unknown namespace",
fullName));
procName));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "COMMAND", NULL);
return TCL_ERROR;
}
if (procName == NULL) {
if (simpleName == NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't create procedure \"%s\": bad procedure name",
fullName));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "COMMAND", NULL);
return TCL_ERROR;
}
if ((nsPtr != iPtr->globalNsPtr)
&& (procName != NULL) && (procName[0] == ':')) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't create procedure \"%s\" in non-global namespace with"
" name starting with \":\"", procName));
procName));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "COMMAND", NULL);
return TCL_ERROR;
}
@@ -172,31 +163,16 @@ Tcl_ProcObjCmd(
* Create the data structure to represent the procedure.
*/
if (TclCreateProc(interp, nsPtr, procName, objv[2], objv[3],
if (TclCreateProc(interp, nsPtr, simpleName, objv[2], objv[3],
&procPtr) != TCL_OK) {
Tcl_AddErrorInfo(interp, "\n (creating proc \"");
Tcl_AddErrorInfo(interp, procName);
Tcl_AddErrorInfo(interp, simpleName);
Tcl_AddErrorInfo(interp, "\")");
return TCL_ERROR;
}
/*
* Now create a command for the procedure. This will initially be in the
* current namespace unless the procedure's name included namespace
* qualifiers. To create the new command in the right namespace, we
* generate a fully qualified name for it.
*/
Tcl_DStringInit(&ds);
if (nsPtr != iPtr->globalNsPtr) {
Tcl_DStringAppend(&ds, nsPtr->fullName, -1);
TclDStringAppendLiteral(&ds, "::");
}
Tcl_DStringAppend(&ds, procName, -1);
cmd = Tcl_NRCreateCommand(interp, Tcl_DStringValue(&ds), TclObjInterpProc,
TclNRInterpProc, procPtr, TclProcDeleteProc);
Tcl_DStringFree(&ds);
cmd = TclNRCreateCommandInNs(interp, simpleName, (Tcl_Namespace *) nsPtr,
TclObjInterpProc, TclNRInterpProc, procPtr, TclProcDeleteProc);
/*
* Now initialize the new procedure's cmdPtr field. This will be used
@@ -393,13 +369,13 @@ TclCreateProc(
Proc **procPtrPtr) /* Returns: pointer to proc data. */
{
Interp *iPtr = (Interp *) interp;
const char **argArray = NULL;
register Proc *procPtr;
int i, length, result, numArgs;
const char *args, *bytes, *p;
int i, result, numArgs, plen;
const char *bytes, *argname, *argnamei;
char argnamelast;
register CompiledLocal *localPtr = NULL;
Tcl_Obj *defPtr;
Tcl_Obj *defPtr, *errorObj, **argArray;
int precompiled = 0;
if (bodyPtr->typePtr == &tclProcBodyType) {
@@ -436,6 +412,7 @@ TclCreateProc(
*/
if (Tcl_IsShared(bodyPtr)) {
int length;
Tcl_Obj *sharedBodyPtr = bodyPtr;
bytes = TclGetStringFromObj(bodyPtr, &length);
@@ -473,12 +450,9 @@ TclCreateProc(
* argument specifier. If the body is precompiled, processing is limited
* to checking that the parsed argument is consistent with the one stored
* in the Proc.
*
* THIS FAILS IF THE ARG LIST OBJECT'S STRING REP CONTAINS NULS.
*/
args = TclGetStringFromObj(argsPtr, &length);
result = Tcl_SplitList(interp, args, &numArgs, &argArray);
result = Tcl_ListObjGetElements(interp , argsPtr ,&numArgs ,&argArray);
if (result != TCL_OK) {
goto procError;
}
@@ -502,28 +476,28 @@ TclCreateProc(
for (i = 0; i < numArgs; i++) {
int fieldCount, nameLength;
size_t valueLength;
const char **fieldValues;
Tcl_Obj **fieldValues;
/*
* Now divide the specifier up into name and default.
*/
result = Tcl_SplitList(interp, argArray[i], &fieldCount,
result = Tcl_ListObjGetElements(interp, argArray[i], &fieldCount,
&fieldValues);
if (result != TCL_OK) {
goto procError;
}
if (fieldCount > 2) {
ckfree(fieldValues);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"too many fields in argument specifier \"%s\"",
argArray[i]));
errorObj = Tcl_NewStringObj(
"too many fields in argument specifier \"", -1);
Tcl_AppendObjToObj(errorObj, argArray[i]);
Tcl_AppendToObj(errorObj, "\"", -1);
Tcl_SetObjResult(interp, errorObj);
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC",
"FORMALARGUMENTFORMAT", NULL);
goto procError;
}
if ((fieldCount == 0) || (*fieldValues[0] == 0)) {
ckfree(fieldValues);
if ((fieldCount == 0) || (fieldValues[0]->length == 0)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"argument with no name", -1));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC",
@@ -531,9 +505,10 @@ TclCreateProc(
goto procError;
}
nameLength = strlen(fieldValues[0]);
nameLength = Tcl_NumUtfChars(Tcl_GetString(fieldValues[0]), fieldValues[0]->length);
if (fieldCount == 2) {
valueLength = strlen(fieldValues[1]);
valueLength = Tcl_NumUtfChars(Tcl_GetString(fieldValues[1]),
fieldValues[1]->length);
} else {
valueLength = 0;
}
@@ -542,33 +517,29 @@ TclCreateProc(
* Check that the formal parameter name is a scalar.
*/
p = fieldValues[0];
while (*p != '\0') {
if (*p == '(') {
const char *q = p;
do {
q++;
} while (*q != '\0');
q--;
if (*q == ')') { /* We have an array element. */
argname = Tcl_GetStringFromObj(fieldValues[0], &plen);
argnamei = argname;
argnamelast = argname[plen-1];
while (plen--) {
if (argnamei[0] == '(') {
if (argnamelast == ')') { /* We have an array element. */
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"formal parameter \"%s\" is an array element",
fieldValues[0]));
ckfree(fieldValues);
Tcl_GetString(fieldValues[0])));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC",
"FORMALARGUMENTFORMAT", NULL);
goto procError;
}
} else if ((*p == ':') && (*(p+1) == ':')) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"formal parameter \"%s\" is not a simple name",
fieldValues[0]));
ckfree(fieldValues);
} else if ((argnamei[0] == ':') && (argnamei[1] == ':')) {
errorObj = Tcl_NewStringObj("formal parameter \"", -1);
Tcl_AppendObjToObj(errorObj, fieldValues[0]);
Tcl_AppendToObj(errorObj, "\" is not a simple name", -1);
Tcl_SetObjResult(interp, errorObj);
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC",
"FORMALARGUMENTFORMAT", NULL);
goto procError;
}
p++;
argnamei = Tcl_UtfNext(argnamei);
}
if (precompiled) {
@@ -584,7 +555,7 @@ TclCreateProc(
*/
if ((localPtr->nameLength != nameLength)
|| (strcmp(localPtr->name, fieldValues[0]))
|| (Tcl_UtfNcmp(localPtr->name, argname, nameLength))
|| (localPtr->frameIndex != i)
|| !(localPtr->flags & VAR_ARGUMENT)
|| (localPtr->defValuePtr == NULL && fieldCount == 2)
@@ -592,7 +563,6 @@ TclCreateProc(
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"procedure \"%s\": formal parameter %d is "
"inconsistent with precompiled body", procName, i));
ckfree(fieldValues);
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC",
"BYTECODELIES", NULL);
goto procError;
@@ -607,12 +577,13 @@ TclCreateProc(
size_t tmpLength = localPtr->defValuePtr->length;
if ((valueLength != tmpLength) ||
strncmp(fieldValues[1], tmpPtr, tmpLength)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"procedure \"%s\": formal parameter \"%s\" has "
"default value inconsistent with precompiled body",
procName, fieldValues[0]));
ckfree(fieldValues);
Tcl_UtfNcmp(Tcl_GetString(fieldValues[1]), tmpPtr, tmpLength)) {
errorObj = Tcl_ObjPrintf(
"procedure \"%s\": formal parameter \"" ,procName);
Tcl_AppendObjToObj(errorObj, fieldValues[0]);
Tcl_AppendToObj(errorObj, "\" has "
"default value inconsistent with precompiled body", -1);
Tcl_SetObjResult(interp, errorObj);
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC",
"BYTECODELIES", NULL);
goto procError;
@@ -632,7 +603,7 @@ TclCreateProc(
* local variables for the argument.
*/
localPtr = ckalloc(TclOffset(CompiledLocal, name) + nameLength+1);
localPtr = ckalloc(TclOffset(CompiledLocal, name) + fieldValues[0]->length +1);
if (procPtr->firstLocalPtr == NULL) {
procPtr->firstLocalPtr = procPtr->lastLocalPtr = localPtr;
} else {
@@ -640,19 +611,18 @@ TclCreateProc(
procPtr->lastLocalPtr = localPtr;
}
localPtr->nextPtr = NULL;
localPtr->nameLength = nameLength;
localPtr->nameLength = Tcl_NumUtfChars(argname, fieldValues[0]->length);
localPtr->frameIndex = i;
localPtr->flags = VAR_ARGUMENT;
localPtr->resolveInfo = NULL;
if (fieldCount == 2) {
localPtr->defValuePtr =
Tcl_NewStringObj(fieldValues[1], valueLength);
localPtr->defValuePtr = fieldValues[1];
Tcl_IncrRefCount(localPtr->defValuePtr);
} else {
localPtr->defValuePtr = NULL;
}
memcpy(localPtr->name, fieldValues[0], nameLength + 1);
memcpy(localPtr->name, argname, fieldValues[0]->length + 1);
if ((i == numArgs - 1)
&& (localPtr->nameLength == 4)
&& (localPtr->name[0] == 'a')
@@ -660,12 +630,9 @@ TclCreateProc(
localPtr->flags |= VAR_IS_ARGS;
}
}
ckfree(fieldValues);
}
*procPtrPtr = procPtr;
ckfree(argArray);
return TCL_OK;
procError:
@@ -686,9 +653,6 @@ TclCreateProc(
}
ckfree(procPtr);
}
if (argArray != NULL) {
ckfree(argArray);
}
return TCL_ERROR;
}
@@ -2416,7 +2380,7 @@ FreeLambdaInternalRep(
Proc *procPtr = objPtr->internalRep.twoPtrValue.ptr1;
Tcl_Obj *nsObjPtr = objPtr->internalRep.twoPtrValue.ptr2;
if (procPtr->refCount-- == 1) {
if (procPtr->refCount-- <= 1) {
TclProcCleanupProc(procPtr);
}
TclDecrRefCount(nsObjPtr);
+1 -1
View File
@@ -37,7 +37,7 @@ typedef struct TclRegexp {
* of subexpressions. */
rm_detail_t details; /* Detailed information on match (currently
* used only for REG_EXPECT). */
unsigned int refCount; /* Count of number of references to this
size_t refCount; /* Count of number of references to this
* compiled regexp. */
} TclRegexp;
+13 -5
View File
@@ -72,7 +72,7 @@ BuildCharSet(
CharSet *cset,
const char *format) /* Points to first char of set. */
{
Tcl_UniChar ch, start;
Tcl_UniChar ch = 0, start;
int offset, nranges;
const char *end;
@@ -257,7 +257,7 @@ ValidateFormat(
{
int gotXpg, gotSequential, value, i, flags;
char *end;
Tcl_UniChar ch;
Tcl_UniChar ch = 0;
int objIndex, xpgSize, nspace = numVars;
int *nassign = TclStackAlloc(interp, nspace * sizeof(int));
char buf[TCL_UTF_MAX+1];
@@ -582,7 +582,7 @@ Tcl_ScanObjCmd(
char op = 0;
int width, underflow = 0;
Tcl_WideInt wideValue;
Tcl_UniChar ch, sch;
Tcl_UniChar ch = 0, sch = 0;
Tcl_Obj **objs = NULL, *objPtr = NULL;
int flags;
char buf[513]; /* Temporary buffer to hold scanned number
@@ -885,9 +885,17 @@ Tcl_ScanObjCmd(
* Scan a single Unicode character.
*/
string += TclUtfToUniChar(string, &sch);
offset = TclUtfToUniChar(string, &sch);
i = (int)sch;
#if TCL_UTF_MAX == 4
if (!offset) {
offset = TclUtfToUniChar(string, &sch);
i = (((i<<10) & 0x0FFC00) + 0x10000) + (sch & 0x3FF);
}
#endif
string += offset;
if (!(flags & SCAN_SUPPRESS)) {
objPtr = Tcl_NewIntObj((int)sch);
objPtr = Tcl_NewIntObj(i);
Tcl_IncrRefCount(objPtr);
CLANG_ASSERT(objs);
objs[objIndex++] = objPtr;
+58 -43
View File
@@ -482,7 +482,7 @@ TclParseNumber(
{
enum State {
INITIAL, SIGNUM, ZERO, ZERO_X,
ZERO_O, ZERO_B, BINARY,
ZERO_O, ZERO_B, ZERO_D, BINARY,
HEXADECIMAL, OCTAL, BAD_OCTAL, DECIMAL,
LEADING_RADIX_POINT, FRACTION,
EXPONENT_START, EXPONENT_SIGNUM, EXPONENT,
@@ -664,6 +664,10 @@ TclParseNumber(
state = ZERO_O;
break;
}
if (c == 'd' || c == 'D') {
state = ZERO_D;
break;
}
#ifdef TCL_NO_DEPRECATED
goto decimal;
#endif
@@ -707,7 +711,7 @@ TclParseNumber(
|| (octalSignificandWide >
(~(Tcl_WideUInt)0 >> shift)))) {
octalSignificandOverflow = 1;
TclBNInitBignumFromWideUInt(&octalSignificandBig,
TclInitBignumFromWideUInt(&octalSignificandBig,
octalSignificandWide);
}
}
@@ -824,7 +828,7 @@ TclParseNumber(
((size_t)shift >= CHAR_BIT*sizeof(Tcl_WideUInt) ||
significandWide > (~(Tcl_WideUInt)0 >> shift))) {
significandOverflow = 1;
TclBNInitBignumFromWideUInt(&significandBig,
TclInitBignumFromWideUInt(&significandBig,
significandWide);
}
}
@@ -865,7 +869,7 @@ TclParseNumber(
((size_t)shift >= CHAR_BIT*sizeof(Tcl_WideUInt) ||
significandWide > (~(Tcl_WideUInt)0 >> shift))) {
significandOverflow = 1;
TclBNInitBignumFromWideUInt(&significandBig,
TclInitBignumFromWideUInt(&significandBig,
significandWide);
}
}
@@ -880,6 +884,16 @@ TclParseNumber(
state = BINARY;
break;
case ZERO_D:
if (c == '0') {
numTrailZeros++;
} else if ( ! isdigit(UCHAR(c))) {
goto endgame;
}
state = DECIMAL;
flags |= TCL_PARSE_INTEGER_ONLY;
/* FALLTHROUGH */
case DECIMAL:
/*
* Scanned an optional + or - followed by a string of decimal
@@ -1176,6 +1190,7 @@ TclParseNumber(
case ZERO_X:
case ZERO_O:
case ZERO_B:
case ZERO_D:
case LEADING_RADIX_POINT:
case EXPONENT_START:
case EXPONENT_SIGNUM:
@@ -1199,7 +1214,7 @@ TclParseNumber(
((size_t)shift >= CHAR_BIT*sizeof(Tcl_WideUInt) ||
significandWide > (MOST_BITS + signum) >> shift)) {
significandOverflow = 1;
TclBNInitBignumFromWideUInt(&significandBig, significandWide);
TclInitBignumFromWideUInt(&significandBig, significandWide);
}
if (shift) {
if (!significandOverflow) {
@@ -1220,7 +1235,7 @@ TclParseNumber(
((size_t)shift >= CHAR_BIT*sizeof(Tcl_WideUInt) ||
significandWide > (MOST_BITS + signum) >> shift)) {
significandOverflow = 1;
TclBNInitBignumFromWideUInt(&significandBig, significandWide);
TclInitBignumFromWideUInt(&significandBig, significandWide);
}
if (shift) {
if (!significandOverflow) {
@@ -1241,7 +1256,7 @@ TclParseNumber(
((size_t)shift >= CHAR_BIT*sizeof(Tcl_WideUInt) ||
octalSignificandWide > (MOST_BITS + signum) >> shift)) {
octalSignificandOverflow = 1;
TclBNInitBignumFromWideUInt(&octalSignificandBig,
TclInitBignumFromWideUInt(&octalSignificandBig,
octalSignificandWide);
}
if (shift) {
@@ -1268,7 +1283,7 @@ TclParseNumber(
break;
}
#endif
TclBNInitBignumFromWideUInt(&octalSignificandBig,
TclInitBignumFromWideUInt(&octalSignificandBig,
octalSignificandWide);
octalSignificandOverflow = 1;
} else {
@@ -1296,7 +1311,7 @@ TclParseNumber(
&significandWide, &significandBig, significandOverflow);
if (!significandOverflow && (significandWide > MOST_BITS+signum)){
significandOverflow = 1;
TclBNInitBignumFromWideUInt(&significandBig, significandWide);
TclInitBignumFromWideUInt(&significandBig, significandWide);
}
returnInteger:
if (!significandOverflow) {
@@ -1315,7 +1330,7 @@ TclParseNumber(
break;
}
#endif
TclBNInitBignumFromWideUInt(&significandBig,
TclInitBignumFromWideUInt(&significandBig,
significandWide);
significandOverflow = 1;
} else {
@@ -1470,7 +1485,7 @@ AccumulateDecimalDigit(
* bignum and fall through into the bignum case.
*/
TclBNInitBignumFromWideUInt(bignumRepPtr, w);
TclInitBignumFromWideUInt(bignumRepPtr, w);
} else {
/*
* Wide multiplication.
@@ -1613,7 +1628,7 @@ MakeLowPrecisionDouble(
* call MakeHighPrecisionDouble to do it the hard way.
*/
TclBNInitBignumFromWideUInt(&significandBig, significand);
TclInitBignumFromWideUInt(&significandBig, significand);
retval = MakeHighPrecisionDouble(0, &significandBig, numSigDigs,
exponent);
mp_clear(&significandBig);
@@ -1980,7 +1995,7 @@ RefineApproximation(
*----------------------------------------------------------------------
*/
inline static void
static inline void
MulPow5(
mp_int *base, /* Number to multiply. */
unsigned n, /* Power of 5 to multiply by. */
@@ -2025,7 +2040,7 @@ MulPow5(
*----------------------------------------------------------------------
*/
inline static int
static inline int
NormalizeRightward(
Tcl_WideUInt *wPtr) /* INOUT: Number to shift. */
{
@@ -2116,7 +2131,7 @@ RequiredPrecision(
*----------------------------------------------------------------------
*/
inline static void
static inline void
DoubleToExpAndSig(
double dv, /* Number to convert. */
Tcl_WideUInt *significand, /* OUTPUT: Significand of the number. */
@@ -2164,7 +2179,7 @@ DoubleToExpAndSig(
*----------------------------------------------------------------------
*/
inline static void
static inline void
TakeAbsoluteValue(
Double *d, /* Number to replace with absolute value. */
int *sign) /* Place to put the signum. */
@@ -2195,7 +2210,7 @@ TakeAbsoluteValue(
*----------------------------------------------------------------------
*/
inline static char *
static inline char *
FormatInfAndNaN(
Double *d, /* Exceptional number to format. */
int *decpt, /* Decimal point to set to a bogus value. */
@@ -2237,7 +2252,7 @@ FormatInfAndNaN(
*----------------------------------------------------------------------
*/
inline static char *
static inline char *
FormatZero(
int *decpt, /* Location of the decimal point. */
char **endPtr) /* Pointer to the end of the formatted data */
@@ -2267,7 +2282,7 @@ FormatZero(
*----------------------------------------------------------------------
*/
inline static int
static inline int
ApproximateLog10(
Tcl_WideUInt bw, /* Integer significand of the number. */
int be, /* Power of two to scale bw. */
@@ -2315,7 +2330,7 @@ ApproximateLog10(
*----------------------------------------------------------------------
*/
inline static int
static inline int
BetterLog10(
double d, /* Original number to format. */
int k, /* Characteristic(Log base 10) of the
@@ -2358,7 +2373,7 @@ BetterLog10(
*----------------------------------------------------------------------
*/
inline static void
static inline void
ComputeScale(
int be, /* Exponent part of number: d = bw * 2**be. */
int k, /* Characteristic of log10(number). */
@@ -2421,7 +2436,7 @@ ComputeScale(
*----------------------------------------------------------------------
*/
inline static void
static inline void
SetPrecisionLimits(
int convType, /* Type of conversion: TCL_DD_SHORTEST,
* TCL_DD_STEELE0, TCL_DD_E_FMT,
@@ -2482,7 +2497,7 @@ SetPrecisionLimits(
*----------------------------------------------------------------------
*/
inline static char *
static inline char *
BumpUp(
char *s, /* Cursor pointing one past the end of the
* string. */
@@ -2516,7 +2531,7 @@ BumpUp(
*----------------------------------------------------------------------
*/
inline static int
static inline int
AdjustRange(
double *dPtr, /* INOUT: Number to adjust. */
int k) /* IN: floor(log10(d)) */
@@ -2589,7 +2604,7 @@ AdjustRange(
*----------------------------------------------------------------------
*/
inline static char *
static inline char *
ShorteningQuickFormat(
double d, /* Number to convert. */
int k, /* floor(log10(d)) */
@@ -2664,7 +2679,7 @@ ShorteningQuickFormat(
*----------------------------------------------------------------------
*/
inline static char *
static inline char *
StrictQuickFormat(
double d, /* Number to convert. */
int k, /* floor(log10(d)) */
@@ -2738,7 +2753,7 @@ StrictQuickFormat(
*----------------------------------------------------------------------
*/
inline static char *
static inline char *
QuickConversion(
double e, /* Number to format. */
int k, /* floor(log10(d)), approximately. */
@@ -2843,7 +2858,7 @@ QuickConversion(
*----------------------------------------------------------------------
*/
inline static void
static inline void
CastOutPowersOf2(
int *b2, /* Power of 2 to multiply the significand. */
int *m2, /* Power of 2 to multiply 1/2 ulp. */
@@ -2887,7 +2902,7 @@ CastOutPowersOf2(
*----------------------------------------------------------------------
*/
inline static char *
static inline char *
ShorteningInt64Conversion(
Double *dPtr, /* Original number to convert. */
int convType, /* Type of conversion (shortest, Steele,
@@ -3056,7 +3071,7 @@ ShorteningInt64Conversion(
*----------------------------------------------------------------------
*/
inline static char *
static inline char *
StrictInt64Conversion(
Double *dPtr, /* Original number to convert. */
int convType, /* Type of conversion (shortest, Steele,
@@ -3162,7 +3177,7 @@ StrictInt64Conversion(
*----------------------------------------------------------------------
*/
inline static int
static inline int
ShouldBankerRoundUpPowD(
mp_int *b, /* Numerator of the fraction. */
int sd, /* Denominator is 2**(sd*DIGIT_BIT). */
@@ -3200,7 +3215,7 @@ ShouldBankerRoundUpPowD(
*----------------------------------------------------------------------
*/
inline static int
static inline int
ShouldBankerRoundUpToNextPowD(
mp_int *b, /* Numerator of the fraction. */
mp_int *m, /* Numerator of the rounding tolerance. */
@@ -3263,7 +3278,7 @@ ShouldBankerRoundUpToNextPowD(
*----------------------------------------------------------------------
*/
inline static char *
static inline char *
ShorteningBignumConversionPowD(
Double *dPtr, /* Original number to convert. */
int convType, /* Type of conversion (shortest, Steele,
@@ -3300,7 +3315,7 @@ ShorteningBignumConversionPowD(
* mminus = 5**m5
*/
TclBNInitBignumFromWideUInt(&b, bw);
TclInitBignumFromWideUInt(&b, bw);
mp_init_set_int(&mminus, 1);
MulPow5(&b, b5, &b);
mp_mul_2d(&b, b2, &b);
@@ -3456,7 +3471,7 @@ ShorteningBignumConversionPowD(
*----------------------------------------------------------------------
*/
inline static char *
static inline char *
StrictBignumConversionPowD(
Double *dPtr, /* Original number to convert. */
int convType, /* Type of conversion (shortest, Steele,
@@ -3487,7 +3502,7 @@ StrictBignumConversionPowD(
* b = bw * 2**b2 * 5**b5
*/
TclBNInitBignumFromWideUInt(&b, bw);
TclInitBignumFromWideUInt(&b, bw);
MulPow5(&b, b5, &b);
mp_mul_2d(&b, b2, &b);
@@ -3572,7 +3587,7 @@ StrictBignumConversionPowD(
*----------------------------------------------------------------------
*/
inline static int
static inline int
ShouldBankerRoundUp(
mp_int *twor, /* 2x the remainder from thd division that
* produced the last digit. */
@@ -3607,7 +3622,7 @@ ShouldBankerRoundUp(
*----------------------------------------------------------------------
*/
inline static int
static inline int
ShouldBankerRoundUpToNext(
mp_int *b, /* Remainder from the division that produced
* the last digit. */
@@ -3661,7 +3676,7 @@ ShouldBankerRoundUpToNext(
*----------------------------------------------------------------------
*/
inline static char *
static inline char *
ShorteningBignumConversion(
Double *dPtr, /* Original number being converted. */
int convType, /* Conversion type. */
@@ -3695,7 +3710,7 @@ ShorteningBignumConversion(
* S = 2**s2 * 5*s5
*/
TclBNInitBignumFromWideUInt(&b, bw);
TclInitBignumFromWideUInt(&b, bw);
mp_mul_2d(&b, b2, &b);
mp_init_set_int(&S, 1);
MulPow5(&S, s5, &S); mp_mul_2d(&S, s2, &S);
@@ -3877,7 +3892,7 @@ ShorteningBignumConversion(
*----------------------------------------------------------------------
*/
inline static char *
static inline char *
StrictBignumConversion(
Double *dPtr, /* Original number being converted. */
int convType, /* Conversion type. */
@@ -3908,7 +3923,7 @@ StrictBignumConversion(
*/
mp_init_multi(&temp, &dig, NULL);
TclBNInitBignumFromWideUInt(&b, bw);
TclInitBignumFromWideUInt(&b, bw);
mp_mul_2d(&b, b2, &b);
mp_init_set_int(&S, 1);
MulPow5(&S, s5, &S); mp_mul_2d(&S, s2, &S);
@@ -4564,7 +4579,7 @@ Tcl_InitBignumFromDouble(
Tcl_WideInt w = (Tcl_WideInt) ldexp(fract, mantBits);
int shift = expt - mantBits;
TclBNInitBignumFromWideInt(b, w);
TclInitBignumFromWideInt(b, w);
if (shift < 0) {
mp_div_2d(b, -shift, b, NULL);
} else if (shift > 0) {
+56 -42
View File
@@ -418,9 +418,14 @@ Tcl_GetCharLength(
}
/*
* Optimize the case where we're really dealing with a bytearray object
* without string representation; we don't need to convert to a string to
* perform the get-length operation.
* Optimize the case where we're really dealing with a bytearray object;
* we don't need to convert to a string to perform the get-length operation.
*
* Starting in Tcl 8.7, we check for a "pure" bytearray, because the
* machinery behind that test is using a proper bytearray ObjType. We
* could also compute length of an improper bytearray without shimmering
* but there's no value in that. We *want* to shimmer an improper bytearray
* because improper bytearrays have worthless internal reps.
*/
if (TclIsPureByteArray(objPtr)) {
@@ -1650,6 +1655,7 @@ Tcl_AppendFormatToObj(
const char *span = format, *msg, *errCode;
int numBytes = 0, objIndex = 0, gotXpg = 0, gotSequential = 0;
int originalLength, limit;
Tcl_UniChar ch = 0;
static const char *mixedXPG =
"cannot mix \"%\" and \"%n$\" conversion specifiers";
static const char *const badIndex[2] = {
@@ -1677,7 +1683,6 @@ Tcl_AppendFormatToObj(
#endif
int newXpg, numChars, allocSegment = 0, segmentLimit, segmentNumBytes;
Tcl_Obj *segment;
Tcl_UniChar ch;
int step = TclUtfToUniChar(format, &ch);
format += step;
@@ -1869,20 +1874,20 @@ Tcl_AppendFormatToObj(
} else if (ch == 'I') {
if ((format[1] == '6') && (format[2] == '4')) {
format += (step + 2);
step = Tcl_UtfToUniChar(format, &ch);
step = TclUtfToUniChar(format, &ch);
#ifndef TCL_WIDE_INT_IS_LONG
useWide = 1;
#endif
} else if ((format[1] == '3') && (format[2] == '2')) {
format += (step + 2);
step = Tcl_UtfToUniChar(format, &ch);
step = TclUtfToUniChar(format, &ch);
} else {
format += step;
step = Tcl_UtfToUniChar(format, &ch);
step = TclUtfToUniChar(format, &ch);
}
} else if ((ch == 't') || (ch == 'z')) {
format += step;
step = Tcl_UtfToUniChar(format, &ch);
step = TclUtfToUniChar(format, &ch);
#ifndef TCL_WIDE_INT_IS_LONG
if (sizeof(size_t) > sizeof(int)) {
useWide = 1;
@@ -1890,7 +1895,7 @@ Tcl_AppendFormatToObj(
#endif
} else if ((ch == 'q') ||(ch == 'j')) {
format += step;
step = Tcl_UtfToUniChar(format, &ch);
step = TclUtfToUniChar(format, &ch);
#ifndef TCL_WIDE_INT_IS_LONG
useWide = 1;
#endif
@@ -2029,9 +2034,12 @@ Tcl_AppendFormatToObj(
segmentLimit -= 1;
precision--;
break;
case 'X':
Tcl_AppendToObj(segment, "0X", 2);
segmentLimit -= 2;
break;
case 'p':
case 'x':
case 'X':
Tcl_AppendToObj(segment, "0x", 2);
segmentLimit -= 2;
break;
@@ -2039,6 +2047,10 @@ Tcl_AppendFormatToObj(
Tcl_AppendToObj(segment, "0b", 2);
segmentLimit -= 2;
break;
case 'd':
Tcl_AppendToObj(segment, "0d", 2);
segmentLimit -= 2;
break;
}
}
@@ -2196,7 +2208,11 @@ Tcl_AppendFormatToObj(
}
digitOffset = (int) (bits % base);
if (digitOffset > 9) {
bytes[numDigits] = 'a' + digitOffset - 10;
if (ch == 'X') {
bytes[numDigits] = 'A' + digitOffset - 10;
} else {
bytes[numDigits] = 'a' + digitOffset - 10;
}
} else {
bytes[numDigits] = '0' + digitOffset;
}
@@ -2318,14 +2334,6 @@ Tcl_AppendFormatToObj(
goto error;
}
switch (ch) {
case 'E':
case 'G':
case 'X': {
Tcl_SetObjLength(segment, Tcl_UtfToUpper(TclGetString(segment)));
}
}
if (width>0 && numChars<0) {
numChars = Tcl_GetCharLength(segment);
}
@@ -3099,6 +3107,7 @@ TclStringCatObjv(
/* Ugly interface! No scheme to init array size. */
objResultPtr = Tcl_NewUnicodeObj(&ch, 0); /* PANIC? */
if (0 == Tcl_AttemptSetObjLength(objResultPtr, length)) {
Tcl_DecrRefCount(objResultPtr);
if (interp) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"concatenation failed: unable to alloc %"
@@ -3146,6 +3155,7 @@ TclStringCatObjv(
} else {
objResultPtr = Tcl_NewObj(); /* PANIC? */
if (0 == Tcl_AttemptSetObjLength(objResultPtr, length)) {
Tcl_DecrRefCount(objResultPtr);
if (interp) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"concatenation failed: unable to alloc %u bytes",
@@ -3237,40 +3247,44 @@ TclStringFind(
return -1;
}
/*
* Check if we have two strings of single-byte characters. If we have, we
* can use strstr() to do the search. Note that we can sometimes have
* multibyte characters when the string could be minimally represented
* using single byte characters; we can't assume that a mismatch here
* means no match.
*/
lh = Tcl_GetCharLength(haystack);
if (haystack->bytes && (lh == haystack->length)) {
/* haystack is all single-byte chars */
if (haystack->bytes && (lh == haystack->length) && needle->bytes
&& (ln == needle->length)) {
/*
* Both haystack and needle are all single-byte chars.
*/
if (needle->bytes && (ln == needle->length)) {
/* needle is also all single-byte chars */
char *found = strstr(haystack->bytes + start, needle->bytes);
char *found = strstr(haystack->bytes + start, needle->bytes);
if (found) {
return (found - haystack->bytes);
} else {
return -1;
}
if (found) {
return (found - haystack->bytes);
} else {
/*
* Cannot find substring with a multi-byte char inside
* a string with no multi-byte chars.
*/
return -1;
}
} else {
/*
* Do the search on the unicode representation for simplicity.
*/
Tcl_UniChar *try, *end, *uh;
Tcl_UniChar *un = Tcl_GetUnicodeFromObj(needle, &ln);
uh = Tcl_GetUnicodeFromObj(haystack, &lh);
end = uh + lh;
try = uh + start;
while (try + ln <= end) {
if ((*try == *un)
&& (0 == memcmp(try+1, un+1, (ln-1)*sizeof(Tcl_UniChar)))) {
for (try = uh + start; try + ln <= end; try++) {
if ((*try == *un) && (0 ==
memcmp(try + 1, un + 1, (ln-1) * sizeof(Tcl_UniChar)))) {
return (try - uh);
}
try++;
}
return -1;
}
@@ -3425,7 +3439,7 @@ TclStringObjReverse(
Tcl_Obj *objPtr)
{
String *stringPtr;
Tcl_UniChar ch;
Tcl_UniChar ch = 0;
if (TclIsPureByteArray(objPtr)) {
int numBytes;
@@ -3453,7 +3467,6 @@ TclStringObjReverse(
* Tcl_SetObjLength into growing the unicode rep buffer.
*/
ch = 0;
objPtr = Tcl_NewUnicodeObj(&ch, 1);
Tcl_SetObjLength(objPtr, stringPtr->numChars);
to = Tcl_GetUnicode(objPtr);
@@ -3556,7 +3569,7 @@ ExtendUnicodeRepWithString(
{
String *stringPtr = GET_STRING(objPtr);
int needed, numOrigChars = 0;
Tcl_UniChar *dst;
Tcl_UniChar *dst, unichar = 0;
if (stringPtr->hasUnicode) {
numOrigChars = stringPtr->numChars;
@@ -3579,7 +3592,8 @@ ExtendUnicodeRepWithString(
numAppendChars = 0;
}
for (dst=stringPtr->unicode + numOrigChars; numAppendChars-- > 0; dst++) {
bytes += TclUtfToUniChar(bytes, dst);
bytes += TclUtfToUniChar(bytes, &unichar);
*dst = unichar;
}
*dst = 0;
}
+111 -28
View File
@@ -49,7 +49,7 @@
#undef TclWinNToHS
/* See bug 510001: TclSockMinimumBuffers needs plat imp */
#if defined(_WIN64) || defined(TCL_NO_DEPRECATED)
#if defined(_WIN64) || defined(TCL_NO_DEPRECATED) || TCL_MAJOR_VERSION > 8
# define TclSockMinimumBuffersOld 0
#else
#define TclSockMinimumBuffersOld sockMinimumBuffersOld
@@ -59,16 +59,21 @@ static int TclSockMinimumBuffersOld(int sock, int size)
}
#endif
#if defined(TCL_NO_DEPRECATED)
#if defined(TCL_NO_DEPRECATED) || TCL_MAJOR_VERSION > 8
# define TclSetStartupScriptPath 0
# define TclGetStartupScriptPath 0
# define TclSetStartupScriptFileName 0
# define TclGetStartupScriptFileName 0
# define TclPrecTraceProc 0
# define TclpInetNtoa 0
# define TclWinGetServByName 0
# define TclWinGetSockOpt 0
# define TclWinSetSockOpt 0
# define TclWinNToHS 0
# define TclWinGetPlatformId 0
# define TclBNInitBignumFromWideUInt 0
# define TclBNInitBignumFromWideInt 0
# define TclBNInitBignumFromLong 0
#else
#define TclSetStartupScriptPath setStartupScriptPath
static void TclSetStartupScriptPath(Tcl_Obj *path)
@@ -98,11 +103,26 @@ static const char *TclGetStartupScriptFileName(void)
#if defined(_WIN32) || defined(__CYGWIN__)
#undef TclWinNToHS
#undef TclWinGetPlatformId
#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
#define TclWinNToHS winNToHS
static unsigned short TclWinNToHS(unsigned short ns) {
return ntohs(ns);
}
#define TclWinGetPlatformId winGetPlatformId
static int
TclWinGetPlatformId(void)
{
return 2; /* VER_PLATFORM_WIN32_NT */;
}
#else
#define TclWinNToHS 0
#define TclWinGetPlatformId 0
#endif
#endif
# define TclBNInitBignumFromWideUInt TclInitBignumFromWideUInt
# define TclBNInitBignumFromWideInt TclInitBignumFromWideInt
# define TclBNInitBignumFromLong TclInitBignumFromLong
#endif /* TCL_NO_DEPRECATED */
#ifdef _WIN32
@@ -118,7 +138,9 @@ static unsigned short TclWinNToHS(unsigned short ns) {
# define TclWinFlushDirtyChannels doNothing
# define TclWinResetInterfaces doNothing
#if TCL_UTF_MAX < 4
static Tcl_Encoding winTCharEncoding;
#endif
static int
TclpIsAtty(int fd)
@@ -126,24 +148,15 @@ TclpIsAtty(int fd)
return isatty(fd);
}
#define TclWinGetPlatformId winGetPlatformId
static int
TclWinGetPlatformId()
{
/* Don't bother to determine the real platform on cygwin,
* because VER_PLATFORM_WIN32_NT is the only supported platform */
return 2; /* VER_PLATFORM_WIN32_NT */;
}
void *TclWinGetTclInstance()
{
void *hInstance = NULL;
GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
(const char *)&winTCharEncoding, &hInstance);
(const char *)&TclpIsAtty, &hInstance);
return hInstance;
}
#ifndef TCL_NO_DEPRECATED
#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
#define TclWinSetSockOpt winSetSockOpt
static int
TclWinSetSockOpt(SOCKET s, int level, int optname,
@@ -200,11 +213,25 @@ Tcl_WinUtfToTChar(
int len,
Tcl_DString *dsPtr)
{
#if TCL_UTF_MAX > 3
WCHAR *wp;
int size = MultiByteToWideChar(CP_UTF8, 0, string, len, 0, 0);
Tcl_DStringInit(dsPtr);
Tcl_DStringSetLength(dsPtr, 2*size+2);
wp = (WCHAR *)Tcl_DStringValue(dsPtr);
MultiByteToWideChar(CP_UTF8, 0, string, len, wp, size+1);
if (len == -1) --size; /* account for 0-byte at string end */
Tcl_DStringSetLength(dsPtr, 2*size);
wp[size] = 0;
return (char *)wp;
#else
if (!winTCharEncoding) {
winTCharEncoding = Tcl_GetEncoding(0, "unicode");
}
return Tcl_UtfToExternalDString(winTCharEncoding,
string, len, dsPtr);
#endif
}
char *
@@ -213,11 +240,29 @@ Tcl_WinTCharToUtf(
int len,
Tcl_DString *dsPtr)
{
#if TCL_UTF_MAX > 3
char *p;
int size;
if (len > 0) {
len /= 2;
}
size = WideCharToMultiByte(CP_UTF8, 0, string, len, 0, 0, NULL, NULL);
Tcl_DStringInit(dsPtr);
Tcl_DStringSetLength(dsPtr, size+1);
p = (char *)Tcl_DStringValue(dsPtr);
WideCharToMultiByte(CP_UTF8, 0, string, len, p, size, NULL, NULL);
if (len == -1) --size; /* account for 0-byte at string end */
Tcl_DStringSetLength(dsPtr, size);
p[size] = 0;
return p;
#else
if (!winTCharEncoding) {
winTCharEncoding = Tcl_GetEncoding(0, "unicode");
}
return Tcl_ExternalToUtfDString(winTCharEncoding,
string, len, dsPtr);
#endif
}
#if defined(TCL_WIDE_INT_IS_LONG)
@@ -305,7 +350,7 @@ static int formatInt(char *buffer, int n){
#endif /* __CYGWIN__ */
#ifdef TCL_NO_DEPRECATED
#if defined(TCL_NO_DEPRECATED)
# define Tcl_SeekOld 0
# define Tcl_TellOld 0
# undef Tcl_SetBooleanObj
@@ -360,6 +405,26 @@ static int formatInt(char *buffer, int n){
# define TclBackgroundException 0
# undef TclpReaddir
# define TclpReaddir 0
# define TclSetStartupScript 0
# define TclGetStartupScript 0
# define TclCreateNamespace 0
# define TclDeleteNamespace 0
# define TclAppendExportList 0
# define TclExport 0
# define TclImport 0
# define TclForgetImport 0
# define TclGetCurrentNamespace_ 0
# define TclGetGlobalNamespace_ 0
# define TclFindNamespace 0
# define TclFindCommand 0
# define TclGetCommandFromObj 0
# define TclGetCommandFullName 0
# define TclCopyChannelOld 0
# define Tcl_AppendResultVA 0
# define Tcl_AppendStringsToObjVA 0
# define Tcl_SetErrorCodeVA 0
# define Tcl_PanicVA 0
# define Tcl_VarEvalVA 0
# undef TclpGetDate
# define TclpGetDate 0
# undef TclpLocaltime
@@ -372,6 +437,20 @@ static int formatInt(char *buffer, int n){
# define Tcl_SeekOld seekOld
# define Tcl_TellOld tellOld
# define TclBackgroundException Tcl_BackgroundException
# define TclSetStartupScript Tcl_SetStartupScript
# define TclGetStartupScript Tcl_GetStartupScript
# define TclCreateNamespace Tcl_CreateNamespace
# define TclDeleteNamespace Tcl_DeleteNamespace
# define TclAppendExportList Tcl_AppendExportList
# define TclExport Tcl_Export
# define TclImport Tcl_Import
# define TclForgetImport Tcl_ForgetImport
# define TclGetCurrentNamespace_ Tcl_GetCurrentNamespace
# define TclGetGlobalNamespace_ Tcl_GetGlobalNamespace
# define TclFindNamespace Tcl_FindNamespace
# define TclFindCommand Tcl_FindCommand
# define TclGetCommandFromObj Tcl_GetCommandFromObj
# define TclGetCommandFullName Tcl_GetCommandFullName
# define TclpLocaltime_unix TclpLocaltime
# define TclpGmtime_unix TclpGmtime
@@ -524,22 +603,22 @@ static const TclIntStubs tclIntStubs = {
TclUpdateReturnInfo, /* 109 */
TclSockMinimumBuffers, /* 110 */
Tcl_AddInterpResolvers, /* 111 */
Tcl_AppendExportList, /* 112 */
Tcl_CreateNamespace, /* 113 */
Tcl_DeleteNamespace, /* 114 */
Tcl_Export, /* 115 */
Tcl_FindCommand, /* 116 */
Tcl_FindNamespace, /* 117 */
TclAppendExportList, /* 112 */
TclCreateNamespace, /* 113 */
TclDeleteNamespace, /* 114 */
TclExport, /* 115 */
TclFindCommand, /* 116 */
TclFindNamespace, /* 117 */
Tcl_GetInterpResolvers, /* 118 */
Tcl_GetNamespaceResolvers, /* 119 */
Tcl_FindNamespaceVar, /* 120 */
Tcl_ForgetImport, /* 121 */
Tcl_GetCommandFromObj, /* 122 */
Tcl_GetCommandFullName, /* 123 */
Tcl_GetCurrentNamespace, /* 124 */
Tcl_GetGlobalNamespace, /* 125 */
TclForgetImport, /* 121 */
TclGetCommandFromObj, /* 122 */
TclGetCommandFullName, /* 123 */
TclGetCurrentNamespace_, /* 124 */
TclGetGlobalNamespace_, /* 125 */
Tcl_GetVariableFullName, /* 126 */
Tcl_Import, /* 127 */
TclImport, /* 127 */
Tcl_PopCallFrame, /* 128 */
Tcl_PushCallFrame, /* 129 */
Tcl_RemoveInterpResolvers, /* 130 */
@@ -590,8 +669,8 @@ static const TclIntStubs tclIntStubs = {
TclCallVarTraces, /* 175 */
TclCleanupVar, /* 176 */
TclVarErrMsg, /* 177 */
Tcl_SetStartupScript, /* 178 */
Tcl_GetStartupScript, /* 179 */
TclSetStartupScript, /* 178 */
TclGetStartupScript, /* 179 */
0, /* 180 */
0, /* 181 */
TclpLocaltime, /* 182 */
@@ -859,6 +938,10 @@ const TclTomMathStubs tclTomMathStubs = {
TclBNInitBignumFromWideInt, /* 65 */
TclBNInitBignumFromWideUInt, /* 66 */
TclBN_mp_expt_d_ex, /* 67 */
TclBN_mp_set_long_long, /* 68 */
TclBN_mp_get_long_long, /* 69 */
TclBN_mp_set_long, /* 70 */
TclBN_mp_get_long, /* 71 */
};
static const TclStubHooks tclStubHooks = {
+98 -3
View File
@@ -227,6 +227,9 @@ static int TestasyncCmd(ClientData dummy,
static int TestbytestringObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
static int TeststringbytesObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
static int TestcmdinfoCmd(ClientData dummy,
Tcl_Interp *interp, int argc, const char **argv);
static int TestcmdtokenCmd(ClientData dummy,
@@ -421,6 +424,12 @@ static Tcl_FSMatchInDirectoryProc SimpleMatchInDirectory;
static int TestNumUtfCharsCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
static int TestFindFirstCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
static int TestFindLastCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
static int TestHashSystemHashCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
@@ -581,6 +590,7 @@ Tcltest_Init(
Tcl_CreateCommand(interp, "noop", NoopCmd, NULL, NULL);
Tcl_CreateObjCommand(interp, "noop", NoopObjCmd, NULL, NULL);
Tcl_CreateObjCommand(interp, "testbytestring", TestbytestringObjCmd, NULL, NULL);
Tcl_CreateObjCommand(interp, "teststringbytes", TeststringbytesObjCmd, NULL, NULL);
Tcl_CreateObjCommand(interp, "testwrongnumargs", TestWrongNumArgsObjCmd,
NULL, NULL);
Tcl_CreateObjCommand(interp, "testfilesystem", TestFilesystemObjCmd,
@@ -688,6 +698,10 @@ Tcltest_Init(
TestsetobjerrorcodeCmd, NULL, NULL);
Tcl_CreateObjCommand(interp, "testnumutfchars",
TestNumUtfCharsCmd, NULL, NULL);
Tcl_CreateObjCommand(interp, "testfindfirst",
TestFindFirstCmd, NULL, NULL);
Tcl_CreateObjCommand(interp, "testfindlast",
TestFindLastCmd, NULL, NULL);
Tcl_CreateCommand(interp, "testsetplatform", TestsetplatformCmd,
NULL, NULL);
Tcl_CreateCommand(interp, "testsocket", TestSocketCmd,
@@ -1985,9 +1999,12 @@ TestencodingObjCmd(
if (objc != 3) {
return TCL_ERROR;
}
encoding = Tcl_GetEncoding(NULL, Tcl_GetString(objv[2]));
Tcl_FreeEncoding(encoding);
Tcl_FreeEncoding(encoding);
if (TCL_OK != Tcl_GetEncodingFromObj(interp, objv[2], &encoding)) {
return TCL_ERROR;
}
Tcl_FreeEncoding(encoding); /* Free returned reference */
Tcl_FreeEncoding(encoding); /* Free to match CREATE */
TclFreeIntRep(objv[2]); /* Free the cached ref */
break;
}
return TCL_OK;
@@ -5043,6 +5060,40 @@ NoopObjCmd(
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* TeststringbytesObjCmd --
* Returns bytearray value of the bytes in argument string rep
*
* Results:
* Returns the TCL_OK result code.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
static int
TeststringbytesObjCmd(
ClientData unused, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* The argument objects. */
{
int n;
const unsigned char *p;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "value");
return TCL_ERROR;
}
p = (const unsigned char *)Tcl_GetStringFromObj(objv[1], &n);
Tcl_SetObjResult(interp, Tcl_NewByteArrayObj(p, n));
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
@@ -6844,6 +6895,50 @@ TestNumUtfCharsCmd(
return TCL_OK;
}
/*
* Used to check correct operation of Tcl_UtfFindFirst
*/
static int
TestFindFirstCmd(
ClientData clientData,
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
if (objc > 1) {
int len = -1;
if (objc > 2) {
(void) Tcl_GetIntFromObj(interp, objv[2], &len);
}
Tcl_SetObjResult(interp, Tcl_NewStringObj(Tcl_UtfFindFirst(Tcl_GetString(objv[1]), len), -1));
}
return TCL_OK;
}
/*
* Used to check correct operation of Tcl_UtfFindLast
*/
static int
TestFindLastCmd(
ClientData clientData,
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
if (objc > 1) {
int len = -1;
if (objc > 2) {
(void) Tcl_GetIntFromObj(interp, objv[2], &len);
}
Tcl_SetObjResult(interp, Tcl_NewStringObj(Tcl_UtfFindLast(Tcl_GetString(objv[1]), len), -1));
}
return TCL_OK;
}
#if defined(HAVE_CPUID) || defined(_WIN32)
/*
*----------------------------------------------------------------------
+49 -36
View File
@@ -30,13 +30,13 @@ declare 1 {
}
declare 2 {
int TclBN_mp_add(mp_int *a, mp_int *b, mp_int *c)
int TclBN_mp_add(const mp_int *a, const mp_int *b, mp_int *c)
}
declare 3 {
int TclBN_mp_add_d(mp_int *a, mp_digit b, mp_int *c)
int TclBN_mp_add_d(const mp_int *a, mp_digit b, mp_int *c)
}
declare 4 {
int TclBN_mp_and(mp_int *a, mp_int *b, mp_int *c)
int TclBN_mp_and(const mp_int *a, const mp_int *b, mp_int *c)
}
declare 5 {
void TclBN_mp_clamp(mp_int *a)
@@ -63,25 +63,25 @@ declare 12 {
int TclBN_mp_count_bits(const mp_int *a)
}
declare 13 {
int TclBN_mp_div(mp_int *a, mp_int *b, mp_int *q, mp_int *r)
int TclBN_mp_div(const mp_int *a, const mp_int *b, mp_int *q, mp_int *r)
}
declare 14 {
int TclBN_mp_div_d(mp_int *a, mp_digit b, mp_int *q, mp_digit *r)
int TclBN_mp_div_d(const mp_int *a, mp_digit b, mp_int *q, mp_digit *r)
}
declare 15 {
int TclBN_mp_div_2(mp_int *a, mp_int *q)
int TclBN_mp_div_2(const mp_int *a, mp_int *q)
}
declare 16 {
int TclBN_mp_div_2d(const mp_int *a, int b, mp_int *q, mp_int *r)
}
declare 17 {
int TclBN_mp_div_3(mp_int *a, mp_int *q, mp_digit *r)
int TclBN_mp_div_3(const mp_int *a, mp_int *q, mp_digit *r)
}
declare 18 {
void TclBN_mp_exch(mp_int *a, mp_int *b)
}
declare 19 {
int TclBN_mp_expt_d(mp_int *a, mp_digit b, mp_int *c)
int TclBN_mp_expt_d(const mp_int *a, mp_digit b, mp_int *c)
}
declare 20 {
int TclBN_mp_grow(mp_int *a, int size)
@@ -105,19 +105,19 @@ declare 26 {
int TclBN_mp_lshd(mp_int *a, int shift)
}
declare 27 {
int TclBN_mp_mod(mp_int *a, mp_int *b, mp_int *r)
int TclBN_mp_mod(const mp_int *a, const mp_int *b, mp_int *r)
}
declare 28 {
int TclBN_mp_mod_2d(const mp_int *a, int b, mp_int *r)
}
declare 29 {
int TclBN_mp_mul(mp_int *a, mp_int *b, mp_int *p)
int TclBN_mp_mul(const mp_int *a, const mp_int *b, mp_int *p)
}
declare 30 {
int TclBN_mp_mul_d(mp_int *a, mp_digit b, mp_int *p)
int TclBN_mp_mul_d(const mp_int *a, mp_digit b, mp_int *p)
}
declare 31 {
int TclBN_mp_mul_2(mp_int *a, mp_int *p)
int TclBN_mp_mul_2(const mp_int *a, mp_int *p)
}
declare 32 {
int TclBN_mp_mul_2d(const mp_int *a, int d, mp_int *p)
@@ -126,7 +126,7 @@ declare 33 {
int TclBN_mp_neg(const mp_int *a, mp_int *b)
}
declare 34 {
int TclBN_mp_or(mp_int *a, mp_int *b, mp_int *c)
int TclBN_mp_or(const mp_int *a, const mp_int *b, mp_int *c)
}
declare 35 {
int TclBN_mp_radix_size(const mp_int *a, int radix, int *size)
@@ -144,32 +144,32 @@ declare 39 {
void TclBN_mp_set(mp_int *a, mp_digit b)
}
declare 40 {
int TclBN_mp_sqr(mp_int *a, mp_int *b)
int TclBN_mp_sqr(const mp_int *a, mp_int *b)
}
declare 41 {
int TclBN_mp_sqrt(mp_int *a, mp_int *b)
int TclBN_mp_sqrt(const mp_int *a, mp_int *b)
}
declare 42 {
int TclBN_mp_sub(mp_int *a, mp_int *b, mp_int *c)
int TclBN_mp_sub(const mp_int *a, const mp_int *b, mp_int *c)
}
declare 43 {
int TclBN_mp_sub_d(mp_int *a, mp_digit b, mp_int *c)
int TclBN_mp_sub_d(const mp_int *a, mp_digit b, mp_int *c)
}
declare 44 {
int TclBN_mp_to_unsigned_bin(mp_int *a, unsigned char *b)
int TclBN_mp_to_unsigned_bin(const mp_int *a, unsigned char *b)
}
declare 45 {
int TclBN_mp_to_unsigned_bin_n(mp_int *a, unsigned char *b,
int TclBN_mp_to_unsigned_bin_n(const mp_int *a, unsigned char *b,
unsigned long *outlen)
}
declare 46 {
int TclBN_mp_toradix_n(mp_int *a, char *str, int radix, int maxlen)
int TclBN_mp_toradix_n(const mp_int *a, char *str, int radix, int maxlen)
}
declare 47 {
int TclBN_mp_unsigned_bin_size(mp_int *a)
int TclBN_mp_unsigned_bin_size(const mp_int *a)
}
declare 48 {
int TclBN_mp_xor(mp_int *a, mp_int *b, mp_int *c)
int TclBN_mp_xor(const mp_int *a, const mp_int *b, mp_int *c)
}
declare 49 {
void TclBN_mp_zero(mp_int *a)
@@ -182,34 +182,34 @@ declare 50 {
void TclBN_reverse(unsigned char *s, int len)
}
declare 51 {
int TclBN_fast_s_mp_mul_digs(mp_int *a, mp_int *b, mp_int *c, int digs)
int TclBN_fast_s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs)
}
declare 52 {
int TclBN_fast_s_mp_sqr(mp_int *a, mp_int *b)
int TclBN_fast_s_mp_sqr(const mp_int *a, mp_int *b)
}
declare 53 {
int TclBN_mp_karatsuba_mul(mp_int *a, mp_int *b, mp_int *c)
int TclBN_mp_karatsuba_mul(const mp_int *a, const mp_int *b, mp_int *c)
}
declare 54 {
int TclBN_mp_karatsuba_sqr(mp_int *a, mp_int *b)
int TclBN_mp_karatsuba_sqr(const mp_int *a, mp_int *b)
}
declare 55 {
int TclBN_mp_toom_mul(mp_int *a, mp_int *b, mp_int *c)
int TclBN_mp_toom_mul(const mp_int *a, const mp_int *b, mp_int *c)
}
declare 56 {
int TclBN_mp_toom_sqr(mp_int *a, mp_int *b)
int TclBN_mp_toom_sqr(const mp_int *a, mp_int *b)
}
declare 57 {
int TclBN_s_mp_add(mp_int *a, mp_int *b, mp_int *c)
int TclBN_s_mp_add(const mp_int *a, const mp_int *b, mp_int *c)
}
declare 58 {
int TclBN_s_mp_mul_digs(mp_int *a, mp_int *b, mp_int *c, int digs)
int TclBN_s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs)
}
declare 59 {
int TclBN_s_mp_sqr(mp_int *a, mp_int *b)
int TclBN_s_mp_sqr(const mp_int *a, mp_int *b)
}
declare 60 {
int TclBN_s_mp_sub(mp_int *a, mp_int *b, mp_int *c)
int TclBN_s_mp_sub(const mp_int *a, const mp_int *b, mp_int *c)
}
declare 61 {
int TclBN_mp_init_set_int(mp_int *a, unsigned long i)
@@ -223,19 +223,32 @@ declare 63 {
# Formerly internal API to allow initialisation of bignums without knowing the
# typedefs of how a bignum works internally.
declare 64 {
declare 64 {deprecated {Use mp_init() + mp_set_long_long()}} {
void TclBNInitBignumFromLong(mp_int *bignum, long initVal)
}
declare 65 {
declare 65 {deprecated {Use mp_init() + mp_set_long_long()}} {
void TclBNInitBignumFromWideInt(mp_int *bignum, Tcl_WideInt initVal)
}
declare 66 {
declare 66 {deprecated {Use mp_init() + mp_set_long_long()}} {
void TclBNInitBignumFromWideUInt(mp_int *bignum, Tcl_WideUInt initVal)
}
# Added in libtommath 1.0
declare 67 {
int TclBN_mp_expt_d_ex(mp_int *a, mp_digit b, mp_int *c, int fast)
int TclBN_mp_expt_d_ex(const mp_int *a, mp_digit b, mp_int *c, int fast)
}
# Added in libtommath 1.0.1
declare 68 {
int TclBN_mp_set_long_long(mp_int *a, Tcl_WideUInt i)
}
declare 69 {
Tcl_WideUInt TclBN_mp_get_long_long(const mp_int *a)
}
declare 70 {
int TclBN_mp_set_long(mp_int *a, unsigned long i)
}
declare 71 {
unsigned long TclBN_mp_get_long(const mp_int *a)
}
# Local Variables:
+159 -148
View File
@@ -27,10 +27,10 @@ extern "C" {
#endif
/* detect 64-bit mode if possible */
#if defined(NEVER) /* 128-bit ints fail in too many places */
#if !(defined(MP_32BIT) || defined(MP_16BIT) || defined(MP_8BIT))
#define MP_64BIT
#endif
#if defined(NEVER) /* 128-bit ints fail in too many places */
# if !(defined(MP_32BIT) || defined(MP_16BIT) || defined(MP_8BIT))
# define MP_64BIT
# endif
#endif
/* some default configurations.
@@ -43,89 +43,94 @@ extern "C" {
*/
#ifdef MP_8BIT
#ifndef MP_DIGIT_DECLARED
typedef uint8_t mp_digit;
typedef uint8_t mp_digit;
#define MP_DIGIT_DECLARED
#endif
typedef uint16_t mp_word;
#define MP_SIZEOF_MP_DIGIT 1
#ifdef DIGIT_BIT
#error You must not define DIGIT_BIT when using MP_8BIT
#ifndef MP_WORD_DECLARED
typedef uint16_t mp_word;
#define MP_WORD_DECLARED
#endif
# define MP_SIZEOF_MP_DIGIT 1
# ifdef DIGIT_BIT
# error You must not define DIGIT_BIT when using MP_8BIT
# endif
#elif defined(MP_16BIT)
#ifndef MP_DIGIT_DECLARED
typedef uint16_t mp_digit;
typedef uint16_t mp_digit;
#define MP_DIGIT_DECLARED
#endif
typedef uint32_t mp_word;
#define MP_SIZEOF_MP_DIGIT 2
#ifdef DIGIT_BIT
#error You must not define DIGIT_BIT when using MP_16BIT
#ifndef MP_WORD_DECLARED
typedef uint32_t mp_word;
#define MP_WORD_DECLARED
#endif
# define MP_SIZEOF_MP_DIGIT 2
# ifdef DIGIT_BIT
# error You must not define DIGIT_BIT when using MP_16BIT
# endif
#elif defined(MP_64BIT)
/* for GCC only on supported platforms */
#ifndef CRYPT
typedef unsigned long long ulong64;
typedef signed long long long64;
#endif
/* for GCC only on supported platforms */
#ifndef MP_DIGIT_DECLARED
typedef ulong64 mp_digit;
typedef uint64_t mp_digit;
#define MP_DIGIT_DECLARED
#endif
#if defined(_WIN32)
typedef unsigned __int128 mp_word;
#elif defined(__GNUC__)
typedef unsigned long mp_word __attribute__ ((mode(TI)));
#else
/* it seems you have a problem
* but we assume you can somewhere define your own uint128_t */
typedef uint128_t mp_word;
# if defined(_WIN32)
#ifndef MP_WORD_DECLARED
typedef unsigned __int128 mp_word;
#define MP_WORD_DECLARED
#endif
#define DIGIT_BIT 60
#else
/* this is the default case, 28-bit digits */
/* this is to make porting into LibTomCrypt easier :-) */
#ifndef CRYPT
typedef unsigned long long ulong64;
typedef signed long long long64;
# elif defined(__GNUC__)
typedef unsigned long mp_word __attribute__((mode(TI)));
# else
/* it seems you have a problem
* but we assume you can somewhere define your own uint128_t */
#ifndef MP_WORD_DECLARED
typedef uint128_t mp_word;
#define MP_WORD_DECLARED
#endif
# endif
# define DIGIT_BIT 60
#else
/* this is the default case, 28-bit digits */
/* this is to make porting into LibTomCrypt easier :-) */
#ifndef MP_DIGIT_DECLARED
typedef uint32_t mp_digit;
typedef uint32_t mp_digit;
#define MP_DIGIT_DECLARED
#endif
typedef ulong64 mp_word;
#ifdef MP_31BIT
/* this is an extension that uses 31-bit digits */
#define DIGIT_BIT 31
#else
/* default case is 28-bit digits, defines MP_28BIT as a handy macro to test */
#define DIGIT_BIT 28
#define MP_28BIT
#ifndef MP_WORD_DECLARED
typedef uint64_t mp_word;
#define MP_WORD_DECLARED
#endif
# ifdef MP_31BIT
/* this is an extension that uses 31-bit digits */
# define DIGIT_BIT 31
# else
/* default case is 28-bit digits, defines MP_28BIT as a handy macro to test */
# define DIGIT_BIT 28
# define MP_28BIT
# endif
#endif
/* otherwise the bits per digit is calculated automatically from the size of a mp_digit */
#ifndef DIGIT_BIT
#define DIGIT_BIT (((CHAR_BIT * MP_SIZEOF_MP_DIGIT) - 1)) /* bits per digit */
typedef uint_least32_t mp_min_u32;
# define DIGIT_BIT (((CHAR_BIT * MP_SIZEOF_MP_DIGIT) - 1)) /* bits per digit */
typedef uint_least32_t mp_min_u32;
#else
typedef mp_digit mp_min_u32;
#endif
/* platforms that can use a better rand function */
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
#define MP_USE_ALT_RAND 1
typedef mp_digit mp_min_u32;
#endif
/* use arc4random on platforms that support it */
#ifdef MP_USE_ALT_RAND
#define MP_GEN_RANDOM() arc4random()
#else
#define MP_GEN_RANDOM() rand()
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
# define MP_GEN_RANDOM() arc4random()
# define MP_GEN_RANDOM_MAX 0xffffffff
#endif
/* use rand() as fall-back if there's no better rand function */
#ifndef MP_GEN_RANDOM
# define MP_GEN_RANDOM() rand()
# define MP_GEN_RANDOM_MAX RAND_MAX
#endif
#define MP_DIGIT_BIT DIGIT_BIT
@@ -158,9 +163,9 @@ typedef int mp_err;
/* you'll have to tune these... */
#if defined(BUILD_tcl) || !defined(_WIN32)
MODULE_SCOPE int KARATSUBA_MUL_CUTOFF,
KARATSUBA_SQR_CUTOFF,
TOOM_MUL_CUTOFF,
TOOM_SQR_CUTOFF;
KARATSUBA_SQR_CUTOFF,
TOOM_MUL_CUTOFF,
TOOM_SQR_CUTOFF;
#endif
/* define this to use lower memory usage routines (exptmods mostly) */
@@ -168,11 +173,11 @@ MODULE_SCOPE int KARATSUBA_MUL_CUTOFF,
/* default precision */
#ifndef MP_PREC
#ifndef MP_LOW_MEM
#define MP_PREC 32 /* default digits of precision */
#else
#define MP_PREC 8 /* default digits of precision */
#endif
# ifndef MP_LOW_MEM
# define MP_PREC 32 /* default digits of precision */
# else
# define MP_PREC 8 /* default digits of precision */
# endif
#endif
/* size of comba arrays, should be at least 2 * 2**(BITS_PER_WORD - BITS_PER_DIGIT*2) */
@@ -184,17 +189,17 @@ MODULE_SCOPE int KARATSUBA_MUL_CUTOFF,
typedef struct mp_int mp_int;
#endif
struct mp_int {
int used, alloc, sign;
mp_digit *dp;
int used, alloc, sign;
mp_digit *dp;
};
/* callback for mp_prime_random, should fill dst with random bytes and return how many read [upto len] */
typedef int ltm_prime_callback(unsigned char *dst, int len, void *dat);
#define USED(m) ((m)->used)
#define DIGIT(m,k) ((m)->dp[(k)])
#define SIGN(m) ((m)->sign)
#define USED(m) ((m)->used)
#define DIGIT(m, k) ((m)->dp[(k)])
#define SIGN(m) ((m)->sign)
/* error code to char* string */
const char *mp_error_to_string(int code);
@@ -272,22 +277,28 @@ int mp_set_long_long(mp_int *a, unsigned long long b);
*/
/* get a 32-bit value */
unsigned long mp_get_int(mp_int * a);
/*
unsigned long mp_get_int(const mp_int *a);
*/
/* get a platform dependent unsigned long value */
unsigned long mp_get_long(mp_int * a);
/*
unsigned long mp_get_long(const mp_int *a);
*/
/* get a platform dependent unsigned long long value */
unsigned long long mp_get_long_long(mp_int * a);
/*
unsigned long long mp_get_long_long(const mp_int *a);
*/
/* initialize and set a digit */
/*
int mp_init_set (mp_int * a, mp_digit b);
int mp_init_set(mp_int *a, mp_digit b);
*/
/* initialize and set 32-bit value */
/*
int mp_init_set_int (mp_int * a, unsigned long b);
int mp_init_set_int(mp_int *a, unsigned long b);
*/
/* copy, b = a */
@@ -307,12 +318,12 @@ void mp_clamp(mp_int *a);
/* import binary data */
/*
int mp_import(mp_int* rop, size_t count, int order, size_t size, int endian, size_t nails, const void* op);
int mp_import(mp_int *rop, size_t count, int order, size_t size, int endian, size_t nails, const void *op);
*/
/* export binary data */
/*
int mp_export(void* rop, size_t* countp, int order, size_t size, int endian, size_t nails, mp_int* op);
int mp_export(void *rop, size_t *countp, int order, size_t size, int endian, size_t nails, const mp_int *op);
*/
/* ---> digit manipulation <--- */
@@ -334,7 +345,7 @@ int mp_div_2d(const mp_int *a, int b, mp_int *c, mp_int *d);
/* b = a/2 */
/*
int mp_div_2(mp_int *a, mp_int *b);
int mp_div_2(const mp_int *a, mp_int *b);
*/
/* c = a * 2**b, implemented as c = a << b */
@@ -344,7 +355,7 @@ int mp_mul_2d(const mp_int *a, int b, mp_int *c);
/* b = a*2 */
/*
int mp_mul_2(mp_int *a, mp_int *b);
int mp_mul_2(const mp_int *a, mp_int *b);
*/
/* c = a mod 2**b */
@@ -372,17 +383,17 @@ int mp_rand(mp_int *a, int digits);
/* ---> binary operations <--- */
/* c = a XOR b */
/*
int mp_xor(mp_int *a, mp_int *b, mp_int *c);
int mp_xor(const mp_int *a, const mp_int *b, mp_int *c);
*/
/* c = a OR b */
/*
int mp_or(mp_int *a, mp_int *b, mp_int *c);
int mp_or(const mp_int *a, const mp_int *b, mp_int *c);
*/
/* c = a AND b */
/*
int mp_and(mp_int *a, mp_int *b, mp_int *c);
int mp_and(const mp_int *a, const mp_int *b, mp_int *c);
*/
/* ---> Basic arithmetic <--- */
@@ -394,7 +405,7 @@ int mp_neg(const mp_int *a, mp_int *b);
/* b = |a| */
/*
int mp_abs(mp_int *a, mp_int *b);
int mp_abs(const mp_int *a, mp_int *b);
*/
/* compare a to b */
@@ -409,32 +420,32 @@ int mp_cmp_mag(const mp_int *a, const mp_int *b);
/* c = a + b */
/*
int mp_add(mp_int *a, mp_int *b, mp_int *c);
int mp_add(const mp_int *a, const mp_int *b, mp_int *c);
*/
/* c = a - b */
/*
int mp_sub(mp_int *a, mp_int *b, mp_int *c);
int mp_sub(const mp_int *a, const mp_int *b, mp_int *c);
*/
/* c = a * b */
/*
int mp_mul(mp_int *a, mp_int *b, mp_int *c);
int mp_mul(const mp_int *a, const mp_int *b, mp_int *c);
*/
/* b = a*a */
/*
int mp_sqr(mp_int *a, mp_int *b);
int mp_sqr(const mp_int *a, mp_int *b);
*/
/* a/b => cb + d == a */
/*
int mp_div(mp_int *a, mp_int *b, mp_int *c, mp_int *d);
int mp_div(const mp_int *a, const mp_int *b, mp_int *c, mp_int *d);
*/
/* c = a mod b, 0 <= c < b */
/*
int mp_mod(mp_int *a, mp_int *b, mp_int *c);
int mp_mod(const mp_int *a, const mp_int *b, mp_int *c);
*/
/* ---> single digit functions <--- */
@@ -446,82 +457,82 @@ int mp_cmp_d(const mp_int *a, mp_digit b);
/* c = a + b */
/*
int mp_add_d(mp_int *a, mp_digit b, mp_int *c);
int mp_add_d(const mp_int *a, mp_digit b, mp_int *c);
*/
/* c = a - b */
/*
int mp_sub_d(mp_int *a, mp_digit b, mp_int *c);
int mp_sub_d(const mp_int *a, mp_digit b, mp_int *c);
*/
/* c = a * b */
/*
int mp_mul_d(mp_int *a, mp_digit b, mp_int *c);
int mp_mul_d(const mp_int *a, mp_digit b, mp_int *c);
*/
/* a/b => cb + d == a */
/*
int mp_div_d(mp_int *a, mp_digit b, mp_int *c, mp_digit *d);
int mp_div_d(const mp_int *a, mp_digit b, mp_int *c, mp_digit *d);
*/
/* a/3 => 3c + d == a */
/*
int mp_div_3(mp_int *a, mp_int *c, mp_digit *d);
int mp_div_3(const mp_int *a, mp_int *c, mp_digit *d);
*/
/* c = a**b */
/*
int mp_expt_d(mp_int *a, mp_digit b, mp_int *c);
int mp_expt_d(const mp_int *a, mp_digit b, mp_int *c);
*/
/*
int mp_expt_d_ex (mp_int * a, mp_digit b, mp_int * c, int fast);
int mp_expt_d_ex(const mp_int *a, mp_digit b, mp_int *c, int fast);
*/
/* c = a mod b, 0 <= c < b */
/*
int mp_mod_d(mp_int *a, mp_digit b, mp_digit *c);
int mp_mod_d(const mp_int *a, mp_digit b, mp_digit *c);
*/
/* ---> number theory <--- */
/* d = a + b (mod c) */
/*
int mp_addmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d);
int mp_addmod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d);
*/
/* d = a - b (mod c) */
/*
int mp_submod(mp_int *a, mp_int *b, mp_int *c, mp_int *d);
int mp_submod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d);
*/
/* d = a * b (mod c) */
/*
int mp_mulmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d);
int mp_mulmod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d);
*/
/* c = a * a (mod b) */
/*
int mp_sqrmod(mp_int *a, mp_int *b, mp_int *c);
int mp_sqrmod(const mp_int *a, const mp_int *b, mp_int *c);
*/
/* c = 1/a (mod b) */
/*
int mp_invmod(mp_int *a, mp_int *b, mp_int *c);
int mp_invmod(const mp_int *a, const mp_int *b, mp_int *c);
*/
/* c = (a, b) */
/*
int mp_gcd(mp_int *a, mp_int *b, mp_int *c);
int mp_gcd(const mp_int *a, const mp_int *b, mp_int *c);
*/
/* produces value such that U1*a + U2*b = U3 */
/*
int mp_exteuclid(mp_int *a, mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3);
int mp_exteuclid(const mp_int *a, const mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3);
*/
/* c = [a, b] or (a*b)/(a, b) */
/*
int mp_lcm(mp_int *a, mp_int *b, mp_int *c);
int mp_lcm(const mp_int *a, const mp_int *b, mp_int *c);
*/
/* finds one of the b'th root of a, such that |c|**b <= |a|
@@ -529,35 +540,35 @@ int mp_lcm(mp_int *a, mp_int *b, mp_int *c);
* returns error if a < 0 and b is even
*/
/*
int mp_n_root(mp_int *a, mp_digit b, mp_int *c);
int mp_n_root(const mp_int *a, mp_digit b, mp_int *c);
*/
/*
int mp_n_root_ex (mp_int * a, mp_digit b, mp_int * c, int fast);
int mp_n_root_ex(const mp_int *a, mp_digit b, mp_int *c, int fast);
*/
/* special sqrt algo */
/*
int mp_sqrt(mp_int *arg, mp_int *ret);
int mp_sqrt(const mp_int *arg, mp_int *ret);
*/
/* special sqrt (mod prime) */
/*
int mp_sqrtmod_prime(mp_int *arg, mp_int *prime, mp_int *ret);
int mp_sqrtmod_prime(const mp_int *arg, const mp_int *prime, mp_int *ret);
*/
/* is number a square? */
/*
int mp_is_square(mp_int *arg, int *ret);
int mp_is_square(const mp_int *arg, int *ret);
*/
/* computes the jacobi c = (a | n) (or Legendre if b is prime) */
/*
int mp_jacobi(mp_int *a, mp_int *n, int *c);
int mp_jacobi(const mp_int *a, const mp_int *n, int *c);
*/
/* used to setup the Barrett reduction for a given modulus b */
/*
int mp_reduce_setup(mp_int *a, mp_int *b);
int mp_reduce_setup(mp_int *a, const mp_int *b);
*/
/* Barrett Reduction, computes a (mod b) with a precomputed value c
@@ -566,83 +577,83 @@ int mp_reduce_setup(mp_int *a, mp_int *b);
* compute the reduction as -1 * mp_reduce(mp_abs(a)) [pseudo code].
*/
/*
int mp_reduce(mp_int *a, mp_int *b, mp_int *c);
int mp_reduce(mp_int *a, const mp_int *b, const mp_int *c);
*/
/* setups the montgomery reduction */
/*
int mp_montgomery_setup(mp_int *a, mp_digit *mp);
int mp_montgomery_setup(const mp_int *a, mp_digit *mp);
*/
/* computes a = B**n mod b without division or multiplication useful for
* normalizing numbers in a Montgomery system.
*/
/*
int mp_montgomery_calc_normalization(mp_int *a, mp_int *b);
int mp_montgomery_calc_normalization(mp_int *a, const mp_int *b);
*/
/* computes x/R == x (mod N) via Montgomery Reduction */
/*
int mp_montgomery_reduce(mp_int *a, mp_int *m, mp_digit mp);
int mp_montgomery_reduce(mp_int *a, const mp_int *m, mp_digit mp);
*/
/* returns 1 if a is a valid DR modulus */
/*
int mp_dr_is_modulus(mp_int *a);
int mp_dr_is_modulus(const mp_int *a);
*/
/* sets the value of "d" required for mp_dr_reduce */
/*
void mp_dr_setup(mp_int *a, mp_digit *d);
void mp_dr_setup(const mp_int *a, mp_digit *d);
*/
/* reduces a modulo b using the Diminished Radix method */
/*
int mp_dr_reduce(mp_int *a, mp_int *b, mp_digit mp);
int mp_dr_reduce(mp_int *a, const mp_int *b, mp_digit mp);
*/
/* returns true if a can be reduced with mp_reduce_2k */
/*
int mp_reduce_is_2k(mp_int *a);
int mp_reduce_is_2k(const mp_int *a);
*/
/* determines k value for 2k reduction */
/*
int mp_reduce_2k_setup(mp_int *a, mp_digit *d);
int mp_reduce_2k_setup(const mp_int *a, mp_digit *d);
*/
/* reduces a modulo b where b is of the form 2**p - k [0 <= a] */
/*
int mp_reduce_2k(mp_int *a, mp_int *n, mp_digit d);
int mp_reduce_2k(mp_int *a, const mp_int *n, mp_digit d);
*/
/* returns true if a can be reduced with mp_reduce_2k_l */
/*
int mp_reduce_is_2k_l(mp_int *a);
int mp_reduce_is_2k_l(const mp_int *a);
*/
/* determines k value for 2k reduction */
/*
int mp_reduce_2k_setup_l(mp_int *a, mp_int *d);
int mp_reduce_2k_setup_l(const mp_int *a, mp_int *d);
*/
/* reduces a modulo b where b is of the form 2**p - k [0 <= a] */
/*
int mp_reduce_2k_l(mp_int *a, mp_int *n, mp_int *d);
int mp_reduce_2k_l(mp_int *a, const mp_int *n, const mp_int *d);
*/
/* d = a**b (mod c) */
/*
int mp_exptmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d);
int mp_exptmod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d);
*/
/* ---> Primes <--- */
/* number of primes */
#ifdef MP_8BIT
# define PRIME_SIZE 31
# define PRIME_SIZE 31
#else
# define PRIME_SIZE 256
# define PRIME_SIZE 256
#endif
/* table of first PRIME_SIZE primes */
@@ -652,21 +663,21 @@ MODULE_SCOPE const mp_digit ltm_prime_tab[PRIME_SIZE];
/* result=1 if a is divisible by one of the first PRIME_SIZE primes */
/*
int mp_prime_is_divisible(mp_int *a, int *result);
int mp_prime_is_divisible(const mp_int *a, int *result);
*/
/* performs one Fermat test of "a" using base "b".
* Sets result to 0 if composite or 1 if probable prime
*/
/*
int mp_prime_fermat(mp_int *a, mp_int *b, int *result);
int mp_prime_fermat(const mp_int *a, const mp_int *b, int *result);
*/
/* performs one Miller-Rabin test of "a" using base "b".
* Sets result to 0 if composite or 1 if probable prime
*/
/*
int mp_prime_miller_rabin(mp_int *a, mp_int *b, int *result);
int mp_prime_miller_rabin(const mp_int *a, const mp_int *b, int *result);
*/
/* This gives [for a given bit size] the number of trials required
@@ -684,7 +695,7 @@ int mp_prime_rabin_miller_trials(int size);
* Sets result to 1 if probably prime, 0 otherwise
*/
/*
int mp_prime_is_prime(mp_int *a, int t, int *result);
int mp_prime_is_prime(const mp_int *a, int t, int *result);
*/
/* finds the next prime after the number "a" using "t" trials
@@ -730,39 +741,39 @@ int mp_count_bits(const mp_int *a);
*/
/*
int mp_unsigned_bin_size(mp_int *a);
int mp_unsigned_bin_size(const mp_int *a);
*/
/*
int mp_read_unsigned_bin(mp_int *a, const unsigned char *b, int c);
*/
/*
int mp_to_unsigned_bin(mp_int *a, unsigned char *b);
int mp_to_unsigned_bin(const mp_int *a, unsigned char *b);
*/
/*
int mp_to_unsigned_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen);
int mp_to_unsigned_bin_n(const mp_int *a, unsigned char *b, unsigned long *outlen);
*/
/*
int mp_signed_bin_size(mp_int *a);
int mp_signed_bin_size(const mp_int *a);
*/
/*
int mp_read_signed_bin(mp_int *a, const unsigned char *b, int c);
*/
/*
int mp_to_signed_bin(mp_int *a, unsigned char *b);
int mp_to_signed_bin(const mp_int *a, unsigned char *b);
*/
/*
int mp_to_signed_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen);
int mp_to_signed_bin_n(const mp_int *a, unsigned char *b, unsigned long *outlen);
*/
/*
int mp_read_radix(mp_int *a, const char *str, int radix);
*/
/*
int mp_toradix(mp_int *a, char *str, int radix);
int mp_toradix(const mp_int *a, char *str, int radix);
*/
/*
int mp_toradix_n(mp_int * a, char *str, int radix, int maxlen);
int mp_toradix_n(const mp_int *a, char *str, int radix, int maxlen);
*/
/*
int mp_radix_size(const mp_int *a, int radix, int *size);
@@ -773,7 +784,7 @@ int mp_radix_size(const mp_int *a, int radix, int *size);
int mp_fread(mp_int *a, int radix, FILE *stream);
*/
/*
int mp_fwrite(mp_int *a, int radix, FILE *stream);
int mp_fwrite(const mp_int *a, int radix, FILE *stream);
*/
#endif
@@ -790,13 +801,13 @@ int mp_fwrite(mp_int *a, int radix, FILE *stream);
#define mp_tohex(M, S) mp_toradix((M), (S), 16)
#ifdef __cplusplus
}
}
#endif
#endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */
/* ref: $Format:%D$ */
/* git commit: $Format:%H$ */
/* commit time: $Format:%ai$ */
+123 -79
View File
@@ -74,6 +74,9 @@
#define mp_exch TclBN_mp_exch
#define mp_expt_d TclBN_mp_expt_d
#define mp_expt_d_ex TclBN_mp_expt_d_ex
#define mp_get_int TclBN_mp_get_int
#define mp_get_long TclBN_mp_get_long
#define mp_get_long_long TclBN_mp_get_long_long
#define mp_grow TclBN_mp_grow
#define mp_init TclBN_mp_init
#define mp_init_copy TclBN_mp_init_copy
@@ -98,6 +101,8 @@
#define mp_s_rmap TclBNMpSRmap
#define mp_set TclBN_mp_set
#define mp_set_int TclBN_mp_set_int
#define mp_set_long TclBN_mp_set_long
#define mp_set_long_long TclBN_mp_set_long_long
#define mp_shrink TclBN_mp_shrink
#define mp_sqr TclBN_mp_sqr
#define mp_sqrt TclBN_mp_sqrt
@@ -148,11 +153,14 @@ EXTERN int TclBN_epoch(void);
/* 1 */
EXTERN int TclBN_revision(void);
/* 2 */
EXTERN int TclBN_mp_add(mp_int *a, mp_int *b, mp_int *c);
EXTERN int TclBN_mp_add(const mp_int *a, const mp_int *b,
mp_int *c);
/* 3 */
EXTERN int TclBN_mp_add_d(mp_int *a, mp_digit b, mp_int *c);
EXTERN int TclBN_mp_add_d(const mp_int *a, mp_digit b,
mp_int *c);
/* 4 */
EXTERN int TclBN_mp_and(mp_int *a, mp_int *b, mp_int *c);
EXTERN int TclBN_mp_and(const mp_int *a, const mp_int *b,
mp_int *c);
/* 5 */
EXTERN void TclBN_mp_clamp(mp_int *a);
/* 6 */
@@ -170,22 +178,24 @@ EXTERN int TclBN_mp_copy(const mp_int *a, mp_int *b);
/* 12 */
EXTERN int TclBN_mp_count_bits(const mp_int *a);
/* 13 */
EXTERN int TclBN_mp_div(mp_int *a, mp_int *b, mp_int *q,
mp_int *r);
EXTERN int TclBN_mp_div(const mp_int *a, const mp_int *b,
mp_int *q, mp_int *r);
/* 14 */
EXTERN int TclBN_mp_div_d(mp_int *a, mp_digit b, mp_int *q,
mp_digit *r);
EXTERN int TclBN_mp_div_d(const mp_int *a, mp_digit b,
mp_int *q, mp_digit *r);
/* 15 */
EXTERN int TclBN_mp_div_2(mp_int *a, mp_int *q);
EXTERN int TclBN_mp_div_2(const mp_int *a, mp_int *q);
/* 16 */
EXTERN int TclBN_mp_div_2d(const mp_int *a, int b, mp_int *q,
mp_int *r);
/* 17 */
EXTERN int TclBN_mp_div_3(mp_int *a, mp_int *q, mp_digit *r);
EXTERN int TclBN_mp_div_3(const mp_int *a, mp_int *q,
mp_digit *r);
/* 18 */
EXTERN void TclBN_mp_exch(mp_int *a, mp_int *b);
/* 19 */
EXTERN int TclBN_mp_expt_d(mp_int *a, mp_digit b, mp_int *c);
EXTERN int TclBN_mp_expt_d(const mp_int *a, mp_digit b,
mp_int *c);
/* 20 */
EXTERN int TclBN_mp_grow(mp_int *a, int size);
/* 21 */
@@ -201,21 +211,25 @@ EXTERN int TclBN_mp_init_size(mp_int *a, int size);
/* 26 */
EXTERN int TclBN_mp_lshd(mp_int *a, int shift);
/* 27 */
EXTERN int TclBN_mp_mod(mp_int *a, mp_int *b, mp_int *r);
EXTERN int TclBN_mp_mod(const mp_int *a, const mp_int *b,
mp_int *r);
/* 28 */
EXTERN int TclBN_mp_mod_2d(const mp_int *a, int b, mp_int *r);
/* 29 */
EXTERN int TclBN_mp_mul(mp_int *a, mp_int *b, mp_int *p);
EXTERN int TclBN_mp_mul(const mp_int *a, const mp_int *b,
mp_int *p);
/* 30 */
EXTERN int TclBN_mp_mul_d(mp_int *a, mp_digit b, mp_int *p);
EXTERN int TclBN_mp_mul_d(const mp_int *a, mp_digit b,
mp_int *p);
/* 31 */
EXTERN int TclBN_mp_mul_2(mp_int *a, mp_int *p);
EXTERN int TclBN_mp_mul_2(const mp_int *a, mp_int *p);
/* 32 */
EXTERN int TclBN_mp_mul_2d(const mp_int *a, int d, mp_int *p);
/* 33 */
EXTERN int TclBN_mp_neg(const mp_int *a, mp_int *b);
/* 34 */
EXTERN int TclBN_mp_or(mp_int *a, mp_int *b, mp_int *c);
EXTERN int TclBN_mp_or(const mp_int *a, const mp_int *b,
mp_int *c);
/* 35 */
EXTERN int TclBN_mp_radix_size(const mp_int *a, int radix,
int *size);
@@ -229,52 +243,59 @@ EXTERN int TclBN_mp_shrink(mp_int *a);
/* 39 */
EXTERN void TclBN_mp_set(mp_int *a, mp_digit b);
/* 40 */
EXTERN int TclBN_mp_sqr(mp_int *a, mp_int *b);
EXTERN int TclBN_mp_sqr(const mp_int *a, mp_int *b);
/* 41 */
EXTERN int TclBN_mp_sqrt(mp_int *a, mp_int *b);
EXTERN int TclBN_mp_sqrt(const mp_int *a, mp_int *b);
/* 42 */
EXTERN int TclBN_mp_sub(mp_int *a, mp_int *b, mp_int *c);
EXTERN int TclBN_mp_sub(const mp_int *a, const mp_int *b,
mp_int *c);
/* 43 */
EXTERN int TclBN_mp_sub_d(mp_int *a, mp_digit b, mp_int *c);
EXTERN int TclBN_mp_sub_d(const mp_int *a, mp_digit b,
mp_int *c);
/* 44 */
EXTERN int TclBN_mp_to_unsigned_bin(mp_int *a, unsigned char *b);
EXTERN int TclBN_mp_to_unsigned_bin(const mp_int *a,
unsigned char *b);
/* 45 */
EXTERN int TclBN_mp_to_unsigned_bin_n(mp_int *a,
EXTERN int TclBN_mp_to_unsigned_bin_n(const mp_int *a,
unsigned char *b, unsigned long *outlen);
/* 46 */
EXTERN int TclBN_mp_toradix_n(mp_int *a, char *str, int radix,
int maxlen);
EXTERN int TclBN_mp_toradix_n(const mp_int *a, char *str,
int radix, int maxlen);
/* 47 */
EXTERN int TclBN_mp_unsigned_bin_size(mp_int *a);
EXTERN int TclBN_mp_unsigned_bin_size(const mp_int *a);
/* 48 */
EXTERN int TclBN_mp_xor(mp_int *a, mp_int *b, mp_int *c);
EXTERN int TclBN_mp_xor(const mp_int *a, const mp_int *b,
mp_int *c);
/* 49 */
EXTERN void TclBN_mp_zero(mp_int *a);
/* 50 */
EXTERN void TclBN_reverse(unsigned char *s, int len);
/* 51 */
EXTERN int TclBN_fast_s_mp_mul_digs(mp_int *a, mp_int *b,
mp_int *c, int digs);
EXTERN int TclBN_fast_s_mp_mul_digs(const mp_int *a,
const mp_int *b, mp_int *c, int digs);
/* 52 */
EXTERN int TclBN_fast_s_mp_sqr(mp_int *a, mp_int *b);
EXTERN int TclBN_fast_s_mp_sqr(const mp_int *a, mp_int *b);
/* 53 */
EXTERN int TclBN_mp_karatsuba_mul(mp_int *a, mp_int *b,
mp_int *c);
EXTERN int TclBN_mp_karatsuba_mul(const mp_int *a,
const mp_int *b, mp_int *c);
/* 54 */
EXTERN int TclBN_mp_karatsuba_sqr(mp_int *a, mp_int *b);
EXTERN int TclBN_mp_karatsuba_sqr(const mp_int *a, mp_int *b);
/* 55 */
EXTERN int TclBN_mp_toom_mul(mp_int *a, mp_int *b, mp_int *c);
EXTERN int TclBN_mp_toom_mul(const mp_int *a, const mp_int *b,
mp_int *c);
/* 56 */
EXTERN int TclBN_mp_toom_sqr(mp_int *a, mp_int *b);
EXTERN int TclBN_mp_toom_sqr(const mp_int *a, mp_int *b);
/* 57 */
EXTERN int TclBN_s_mp_add(mp_int *a, mp_int *b, mp_int *c);
EXTERN int TclBN_s_mp_add(const mp_int *a, const mp_int *b,
mp_int *c);
/* 58 */
EXTERN int TclBN_s_mp_mul_digs(mp_int *a, mp_int *b, mp_int *c,
int digs);
EXTERN int TclBN_s_mp_mul_digs(const mp_int *a, const mp_int *b,
mp_int *c, int digs);
/* 59 */
EXTERN int TclBN_s_mp_sqr(mp_int *a, mp_int *b);
EXTERN int TclBN_s_mp_sqr(const mp_int *a, mp_int *b);
/* 60 */
EXTERN int TclBN_s_mp_sub(mp_int *a, mp_int *b, mp_int *c);
EXTERN int TclBN_s_mp_sub(const mp_int *a, const mp_int *b,
mp_int *c);
/* 61 */
EXTERN int TclBN_mp_init_set_int(mp_int *a, unsigned long i);
/* 62 */
@@ -282,16 +303,27 @@ EXTERN int TclBN_mp_set_int(mp_int *a, unsigned long i);
/* 63 */
EXTERN int TclBN_mp_cnt_lsb(const mp_int *a);
/* 64 */
EXTERN void TclBNInitBignumFromLong(mp_int *bignum, long initVal);
TCL_DEPRECATED("Use mp_init() + mp_set_long_long()")
void TclBNInitBignumFromLong(mp_int *bignum, long initVal);
/* 65 */
EXTERN void TclBNInitBignumFromWideInt(mp_int *bignum,
TCL_DEPRECATED("Use mp_init() + mp_set_long_long()")
void TclBNInitBignumFromWideInt(mp_int *bignum,
Tcl_WideInt initVal);
/* 66 */
EXTERN void TclBNInitBignumFromWideUInt(mp_int *bignum,
TCL_DEPRECATED("Use mp_init() + mp_set_long_long()")
void TclBNInitBignumFromWideUInt(mp_int *bignum,
Tcl_WideUInt initVal);
/* 67 */
EXTERN int TclBN_mp_expt_d_ex(mp_int *a, mp_digit b, mp_int *c,
int fast);
EXTERN int TclBN_mp_expt_d_ex(const mp_int *a, mp_digit b,
mp_int *c, int fast);
/* 68 */
EXTERN int TclBN_mp_set_long_long(mp_int *a, Tcl_WideUInt i);
/* 69 */
EXTERN Tcl_WideUInt TclBN_mp_get_long_long(const mp_int *a);
/* 70 */
EXTERN int TclBN_mp_set_long(mp_int *a, unsigned long i);
/* 71 */
EXTERN unsigned long TclBN_mp_get_long(const mp_int *a);
typedef struct TclTomMathStubs {
int magic;
@@ -299,9 +331,9 @@ typedef struct TclTomMathStubs {
int (*tclBN_epoch) (void); /* 0 */
int (*tclBN_revision) (void); /* 1 */
int (*tclBN_mp_add) (mp_int *a, mp_int *b, mp_int *c); /* 2 */
int (*tclBN_mp_add_d) (mp_int *a, mp_digit b, mp_int *c); /* 3 */
int (*tclBN_mp_and) (mp_int *a, mp_int *b, mp_int *c); /* 4 */
int (*tclBN_mp_add) (const mp_int *a, const mp_int *b, mp_int *c); /* 2 */
int (*tclBN_mp_add_d) (const mp_int *a, mp_digit b, mp_int *c); /* 3 */
int (*tclBN_mp_and) (const mp_int *a, const mp_int *b, mp_int *c); /* 4 */
void (*tclBN_mp_clamp) (mp_int *a); /* 5 */
void (*tclBN_mp_clear) (mp_int *a); /* 6 */
void (*tclBN_mp_clear_multi) (mp_int *a, ...); /* 7 */
@@ -310,13 +342,13 @@ typedef struct TclTomMathStubs {
int (*tclBN_mp_cmp_mag) (const mp_int *a, const mp_int *b); /* 10 */
int (*tclBN_mp_copy) (const mp_int *a, mp_int *b); /* 11 */
int (*tclBN_mp_count_bits) (const mp_int *a); /* 12 */
int (*tclBN_mp_div) (mp_int *a, mp_int *b, mp_int *q, mp_int *r); /* 13 */
int (*tclBN_mp_div_d) (mp_int *a, mp_digit b, mp_int *q, mp_digit *r); /* 14 */
int (*tclBN_mp_div_2) (mp_int *a, mp_int *q); /* 15 */
int (*tclBN_mp_div) (const mp_int *a, const mp_int *b, mp_int *q, mp_int *r); /* 13 */
int (*tclBN_mp_div_d) (const mp_int *a, mp_digit b, mp_int *q, mp_digit *r); /* 14 */
int (*tclBN_mp_div_2) (const mp_int *a, mp_int *q); /* 15 */
int (*tclBN_mp_div_2d) (const mp_int *a, int b, mp_int *q, mp_int *r); /* 16 */
int (*tclBN_mp_div_3) (mp_int *a, mp_int *q, mp_digit *r); /* 17 */
int (*tclBN_mp_div_3) (const mp_int *a, mp_int *q, mp_digit *r); /* 17 */
void (*tclBN_mp_exch) (mp_int *a, mp_int *b); /* 18 */
int (*tclBN_mp_expt_d) (mp_int *a, mp_digit b, mp_int *c); /* 19 */
int (*tclBN_mp_expt_d) (const mp_int *a, mp_digit b, mp_int *c); /* 19 */
int (*tclBN_mp_grow) (mp_int *a, int size); /* 20 */
int (*tclBN_mp_init) (mp_int *a); /* 21 */
int (*tclBN_mp_init_copy) (mp_int *a, const mp_int *b); /* 22 */
@@ -324,47 +356,51 @@ typedef struct TclTomMathStubs {
int (*tclBN_mp_init_set) (mp_int *a, mp_digit b); /* 24 */
int (*tclBN_mp_init_size) (mp_int *a, int size); /* 25 */
int (*tclBN_mp_lshd) (mp_int *a, int shift); /* 26 */
int (*tclBN_mp_mod) (mp_int *a, mp_int *b, mp_int *r); /* 27 */
int (*tclBN_mp_mod) (const mp_int *a, const mp_int *b, mp_int *r); /* 27 */
int (*tclBN_mp_mod_2d) (const mp_int *a, int b, mp_int *r); /* 28 */
int (*tclBN_mp_mul) (mp_int *a, mp_int *b, mp_int *p); /* 29 */
int (*tclBN_mp_mul_d) (mp_int *a, mp_digit b, mp_int *p); /* 30 */
int (*tclBN_mp_mul_2) (mp_int *a, mp_int *p); /* 31 */
int (*tclBN_mp_mul) (const mp_int *a, const mp_int *b, mp_int *p); /* 29 */
int (*tclBN_mp_mul_d) (const mp_int *a, mp_digit b, mp_int *p); /* 30 */
int (*tclBN_mp_mul_2) (const mp_int *a, mp_int *p); /* 31 */
int (*tclBN_mp_mul_2d) (const mp_int *a, int d, mp_int *p); /* 32 */
int (*tclBN_mp_neg) (const mp_int *a, mp_int *b); /* 33 */
int (*tclBN_mp_or) (mp_int *a, mp_int *b, mp_int *c); /* 34 */
int (*tclBN_mp_or) (const mp_int *a, const mp_int *b, mp_int *c); /* 34 */
int (*tclBN_mp_radix_size) (const mp_int *a, int radix, int *size); /* 35 */
int (*tclBN_mp_read_radix) (mp_int *a, const char *str, int radix); /* 36 */
void (*tclBN_mp_rshd) (mp_int *a, int shift); /* 37 */
int (*tclBN_mp_shrink) (mp_int *a); /* 38 */
void (*tclBN_mp_set) (mp_int *a, mp_digit b); /* 39 */
int (*tclBN_mp_sqr) (mp_int *a, mp_int *b); /* 40 */
int (*tclBN_mp_sqrt) (mp_int *a, mp_int *b); /* 41 */
int (*tclBN_mp_sub) (mp_int *a, mp_int *b, mp_int *c); /* 42 */
int (*tclBN_mp_sub_d) (mp_int *a, mp_digit b, mp_int *c); /* 43 */
int (*tclBN_mp_to_unsigned_bin) (mp_int *a, unsigned char *b); /* 44 */
int (*tclBN_mp_to_unsigned_bin_n) (mp_int *a, unsigned char *b, unsigned long *outlen); /* 45 */
int (*tclBN_mp_toradix_n) (mp_int *a, char *str, int radix, int maxlen); /* 46 */
int (*tclBN_mp_unsigned_bin_size) (mp_int *a); /* 47 */
int (*tclBN_mp_xor) (mp_int *a, mp_int *b, mp_int *c); /* 48 */
int (*tclBN_mp_sqr) (const mp_int *a, mp_int *b); /* 40 */
int (*tclBN_mp_sqrt) (const mp_int *a, mp_int *b); /* 41 */
int (*tclBN_mp_sub) (const mp_int *a, const mp_int *b, mp_int *c); /* 42 */
int (*tclBN_mp_sub_d) (const mp_int *a, mp_digit b, mp_int *c); /* 43 */
int (*tclBN_mp_to_unsigned_bin) (const mp_int *a, unsigned char *b); /* 44 */
int (*tclBN_mp_to_unsigned_bin_n) (const mp_int *a, unsigned char *b, unsigned long *outlen); /* 45 */
int (*tclBN_mp_toradix_n) (const mp_int *a, char *str, int radix, int maxlen); /* 46 */
int (*tclBN_mp_unsigned_bin_size) (const mp_int *a); /* 47 */
int (*tclBN_mp_xor) (const mp_int *a, const mp_int *b, mp_int *c); /* 48 */
void (*tclBN_mp_zero) (mp_int *a); /* 49 */
void (*tclBN_reverse) (unsigned char *s, int len); /* 50 */
int (*tclBN_fast_s_mp_mul_digs) (mp_int *a, mp_int *b, mp_int *c, int digs); /* 51 */
int (*tclBN_fast_s_mp_sqr) (mp_int *a, mp_int *b); /* 52 */
int (*tclBN_mp_karatsuba_mul) (mp_int *a, mp_int *b, mp_int *c); /* 53 */
int (*tclBN_mp_karatsuba_sqr) (mp_int *a, mp_int *b); /* 54 */
int (*tclBN_mp_toom_mul) (mp_int *a, mp_int *b, mp_int *c); /* 55 */
int (*tclBN_mp_toom_sqr) (mp_int *a, mp_int *b); /* 56 */
int (*tclBN_s_mp_add) (mp_int *a, mp_int *b, mp_int *c); /* 57 */
int (*tclBN_s_mp_mul_digs) (mp_int *a, mp_int *b, mp_int *c, int digs); /* 58 */
int (*tclBN_s_mp_sqr) (mp_int *a, mp_int *b); /* 59 */
int (*tclBN_s_mp_sub) (mp_int *a, mp_int *b, mp_int *c); /* 60 */
int (*tclBN_fast_s_mp_mul_digs) (const mp_int *a, const mp_int *b, mp_int *c, int digs); /* 51 */
int (*tclBN_fast_s_mp_sqr) (const mp_int *a, mp_int *b); /* 52 */
int (*tclBN_mp_karatsuba_mul) (const mp_int *a, const mp_int *b, mp_int *c); /* 53 */
int (*tclBN_mp_karatsuba_sqr) (const mp_int *a, mp_int *b); /* 54 */
int (*tclBN_mp_toom_mul) (const mp_int *a, const mp_int *b, mp_int *c); /* 55 */
int (*tclBN_mp_toom_sqr) (const mp_int *a, mp_int *b); /* 56 */
int (*tclBN_s_mp_add) (const mp_int *a, const mp_int *b, mp_int *c); /* 57 */
int (*tclBN_s_mp_mul_digs) (const mp_int *a, const mp_int *b, mp_int *c, int digs); /* 58 */
int (*tclBN_s_mp_sqr) (const mp_int *a, mp_int *b); /* 59 */
int (*tclBN_s_mp_sub) (const mp_int *a, const mp_int *b, mp_int *c); /* 60 */
int (*tclBN_mp_init_set_int) (mp_int *a, unsigned long i); /* 61 */
int (*tclBN_mp_set_int) (mp_int *a, unsigned long i); /* 62 */
int (*tclBN_mp_cnt_lsb) (const mp_int *a); /* 63 */
void (*tclBNInitBignumFromLong) (mp_int *bignum, long initVal); /* 64 */
void (*tclBNInitBignumFromWideInt) (mp_int *bignum, Tcl_WideInt initVal); /* 65 */
void (*tclBNInitBignumFromWideUInt) (mp_int *bignum, Tcl_WideUInt initVal); /* 66 */
int (*tclBN_mp_expt_d_ex) (mp_int *a, mp_digit b, mp_int *c, int fast); /* 67 */
TCL_DEPRECATED_API("Use mp_init() + mp_set_long_long()") void (*tclBNInitBignumFromLong) (mp_int *bignum, long initVal); /* 64 */
TCL_DEPRECATED_API("Use mp_init() + mp_set_long_long()") void (*tclBNInitBignumFromWideInt) (mp_int *bignum, Tcl_WideInt initVal); /* 65 */
TCL_DEPRECATED_API("Use mp_init() + mp_set_long_long()") void (*tclBNInitBignumFromWideUInt) (mp_int *bignum, Tcl_WideUInt initVal); /* 66 */
int (*tclBN_mp_expt_d_ex) (const mp_int *a, mp_digit b, mp_int *c, int fast); /* 67 */
int (*tclBN_mp_set_long_long) (mp_int *a, Tcl_WideUInt i); /* 68 */
Tcl_WideUInt (*tclBN_mp_get_long_long) (const mp_int *a); /* 69 */
int (*tclBN_mp_set_long) (mp_int *a, unsigned long i); /* 70 */
unsigned long (*tclBN_mp_get_long) (const mp_int *a); /* 71 */
} TclTomMathStubs;
extern const TclTomMathStubs *tclTomMathStubsPtr;
@@ -515,6 +551,14 @@ extern const TclTomMathStubs *tclTomMathStubsPtr;
(tclTomMathStubsPtr->tclBNInitBignumFromWideUInt) /* 66 */
#define TclBN_mp_expt_d_ex \
(tclTomMathStubsPtr->tclBN_mp_expt_d_ex) /* 67 */
#define TclBN_mp_set_long_long \
(tclTomMathStubsPtr->tclBN_mp_set_long_long) /* 68 */
#define TclBN_mp_get_long_long \
(tclTomMathStubsPtr->tclBN_mp_get_long_long) /* 69 */
#define TclBN_mp_set_long \
(tclTomMathStubsPtr->tclBN_mp_set_long) /* 70 */
#define TclBN_mp_get_long \
(tclTomMathStubsPtr->tclBN_mp_get_long) /* 71 */
#endif /* defined(USE_TCL_STUBS) */
+23 -143
View File
@@ -89,86 +89,11 @@ TclBN_revision(void)
{
return TCLTOMMATH_REVISION;
}
#if 0
/*
*----------------------------------------------------------------------
*
* TclBNAlloc --
*
* Allocate memory for libtommath.
*
* Results:
* Returns a pointer to the allocated block.
*
* This procedure is a wrapper around Tcl_Alloc, needed because of a
* mismatched type signature between Tcl_Alloc and malloc.
*
*----------------------------------------------------------------------
*/
extern void *
TclBNAlloc(
size_t x)
{
return (void *) ckalloc((unsigned int) x);
}
/*
*----------------------------------------------------------------------
*
* TclBNRealloc --
*
* Change the size of an allocated block of memory in libtommath
*
* Results:
* Returns a pointer to the allocated block.
*
* This procedure is a wrapper around Tcl_Realloc, needed because of a
* mismatched type signature between Tcl_Realloc and realloc.
*
*----------------------------------------------------------------------
*/
void *
TclBNRealloc(
void *p,
size_t s)
{
return (void *) ckrealloc((char *) p, (unsigned int) s);
}
/*
*----------------------------------------------------------------------
*
* TclBNFree --
*
* Free allocated memory in libtommath.
*
* Results:
* None.
*
* Side effects:
* Memory is freed.
*
* This function is simply a wrapper around Tcl_Free, needed in libtommath
* because of a type mismatch between free and Tcl_Free.
*
*----------------------------------------------------------------------
*/
extern void
TclBNFree(
void *p)
{
ckree((char *) p);
}
#endif
/*
*----------------------------------------------------------------------
*
* TclBNInitBignumFromLong --
* TclInitBignumFromLong --
*
* Allocate and initialize a 'bignum' from a native 'long'.
*
@@ -181,47 +106,20 @@ TclBNFree(
*----------------------------------------------------------------------
*/
extern void
TclBNInitBignumFromLong(
void
TclInitBignumFromLong(
mp_int *a,
long initVal)
long v)
{
int status;
unsigned long v;
mp_digit *p;
/*
* Allocate enough memory to hold the largest possible long
*/
status = mp_init_size(a,
(CHAR_BIT * sizeof(long) + DIGIT_BIT - 1) / DIGIT_BIT);
if (status != MP_OKAY) {
Tcl_Panic("initialization failure in TclBNInitBignumFromLong");
if (mp_init_size(a, (CHAR_BIT * sizeof(long) + DIGIT_BIT - 1) / DIGIT_BIT) != MP_OKAY) {
Tcl_Panic("initialization failure in TclInitBignumFromLong");
}
/*
* Convert arg to sign and magnitude.
*/
if (initVal < 0) {
a->sign = MP_NEG;
v = -initVal;
if (v < (long)0) {
mp_set_long_long(a, (Tcl_WideUInt)(-(Tcl_WideInt)v));
mp_neg(a, a);
} else {
a->sign = MP_ZPOS;
v = initVal;
mp_set_long_long(a, (Tcl_WideUInt)v);
}
/*
* Store the magnitude in the bignum.
*/
p = a->dp;
while (v) {
*p++ = (mp_digit) (v & MP_MASK);
v >>= MP_DIGIT_BIT;
}
a->used = p - a->dp;
}
/*
@@ -240,16 +138,19 @@ TclBNInitBignumFromLong(
*----------------------------------------------------------------------
*/
extern void
TclBNInitBignumFromWideInt(
void
TclInitBignumFromWideInt(
mp_int *a, /* Bignum to initialize */
Tcl_WideInt v) /* Initial value */
{
if (mp_init_size(a, (CHAR_BIT * sizeof(Tcl_WideUInt) + DIGIT_BIT - 1) / DIGIT_BIT) != MP_OKAY) {
Tcl_Panic("initialization failure in TclInitBignumFromWideInt");
}
if (v < (Tcl_WideInt)0) {
TclBNInitBignumFromWideUInt(a, (Tcl_WideUInt)(-v));
mp_set_long_long(a, (Tcl_WideUInt)(-v));
mp_neg(a, a);
} else {
TclBNInitBignumFromWideUInt(a, (Tcl_WideUInt)v);
mp_set_long_long(a, (Tcl_WideUInt)v);
}
}
@@ -269,36 +170,15 @@ TclBNInitBignumFromWideInt(
*----------------------------------------------------------------------
*/
extern void
TclBNInitBignumFromWideUInt(
void
TclInitBignumFromWideUInt(
mp_int *a, /* Bignum to initialize */
Tcl_WideUInt v) /* Initial value */
{
int status;
mp_digit *p;
/*
* Allocate enough memory to hold the largest possible Tcl_WideUInt.
*/
status = mp_init_size(a,
(CHAR_BIT * sizeof(Tcl_WideUInt) + DIGIT_BIT - 1) / DIGIT_BIT);
if (status != MP_OKAY) {
Tcl_Panic("initialization failure in TclBNInitBignumFromWideUInt");
}
a->sign = MP_ZPOS;
/*
* Store the magnitude in the bignum.
*/
p = a->dp;
while (v) {
*p++ = (mp_digit) (v & MP_MASK);
v >>= MP_DIGIT_BIT;
}
a->used = p - a->dp;
if (mp_init_size(a, (CHAR_BIT * sizeof(Tcl_WideUInt) + DIGIT_BIT - 1) / DIGIT_BIT) != MP_OKAY) {
Tcl_Panic("initialization failure in TclInitBignumFromWideUInt");
}
mp_set_long_long(a, v);
}
/*
+163 -46
View File
@@ -94,7 +94,7 @@ static const unsigned char totalBytes[256] = {
int
TclUtfCount(
int ch) /* The Tcl_UniChar whose size is returned. */
int ch) /* The Unicode character whose size is returned. */
{
if ((unsigned)(ch - 1) < (UNICODE_SELF - 1)) {
return 1;
@@ -253,6 +253,15 @@ Tcl_UniCharToUtfDString(
* Tcl_UtfCharComplete() before calling this routine to ensure that
* enough bytes remain in the string.
*
* If TCL_UTF_MAX == 4, special handling of Surrogate pairs is done:
* For any UTF-8 string containing a character outside of the BMP, the
* first call to this function will fill *chPtr with the high surrogate
* and generate a return value of 0. Calling Tcl_UtfToUniChar again
* will produce the low surrogate and a return value of 4. Because *chPtr
* is used to remember whether the high surrogate is already produced, it
* is recommended to initialize the variable it points to as 0 before
* the first call to Tcl_UtfToUniChar is done.
*
* Results:
* *chPtr is filled with the Tcl_UniChar, and the return value is the
* number of bytes from the UTF-8 string that were consumed.
@@ -272,7 +281,7 @@ Tcl_UtfToUniChar(
register int byte;
/*
* Unroll 1 to 3 byte UTF-8 sequences, use loop to handle longer ones.
* Unroll 1 to 3 (or 4) byte UTF-8 sequences.
*/
byte = *((unsigned char *) src);
@@ -325,12 +334,30 @@ Tcl_UtfToUniChar(
/*
* Four-byte-character lead byte followed by three trail bytes.
*/
#if TCL_UTF_MAX == 4
Tcl_UniChar surrogate;
byte = (((byte & 0x07) << 18) | ((src[1] & 0x3F) << 12)
| ((src[2] & 0x3F) << 6) | (src[3] & 0x3F)) - 0x10000;
surrogate = (Tcl_UniChar) (0xD800 + (byte >> 10));
if (byte & 0x100000) {
/* out of range, < 0x10000 or > 0x10ffff */
} else if (*chPtr != surrogate) {
/* produce high surrogate, but don't advance source pointer */
*chPtr = surrogate;
return 0;
} else {
/* produce low surrogate, and advance source pointer */
*chPtr = (Tcl_UniChar) (0xDC00 | (byte & 0x3FF));
return 4;
}
#else
*chPtr = (Tcl_UniChar) (((byte & 0x07) << 18) | ((src[1] & 0x3F) << 12)
| ((src[2] & 0x3F) << 6) | (src[3] & 0x3F));
if ((unsigned)(*chPtr - 0x10000) <= 0xFFFFF) {
return 4;
}
#endif
}
/*
@@ -371,7 +398,7 @@ Tcl_UtfToUniCharDString(
* appended to this previously initialized
* DString. */
{
Tcl_UniChar *w, *wString;
Tcl_UniChar ch = 0, *w, *wString;
const char *p, *end;
int oldLength;
@@ -393,8 +420,8 @@ Tcl_UtfToUniCharDString(
w = wString;
end = src + length;
for (p = src; p < end; ) {
p += TclUtfToUniChar(p, w);
w++;
p += TclUtfToUniChar(p, &ch);
*w++ = ch;
}
*w = '\0';
Tcl_DStringSetLength(dsPtr,
@@ -428,10 +455,7 @@ Tcl_UtfCharComplete(
* a complete UTF-8 character. */
int length) /* Length of above string in bytes. */
{
int ch;
ch = *((unsigned char *) src);
return length >= totalBytes[ch];
return length >= totalBytes[(unsigned char)*src];
}
/*
@@ -458,8 +482,8 @@ Tcl_NumUtfChars(
int length) /* The length of the string in bytes, or -1
* for strlen(string). */
{
Tcl_UniChar ch;
register int i;
Tcl_UniChar ch = 0;
register int i = 0;
/*
* The separate implementations are faster.
@@ -468,7 +492,6 @@ Tcl_NumUtfChars(
* single-byte char case specially.
*/
i = 0;
if (length < 0) {
while (*src != '\0') {
src += TclUtfToUniChar(src, &ch);
@@ -499,13 +522,13 @@ Tcl_NumUtfChars(
*
* Tcl_UtfFindFirst --
*
* Returns a pointer to the first occurance of the given Tcl_UniChar in
* the NULL-terminated UTF-8 string. The NULL terminator is considered
* Returns a pointer to the first occurance of the given Unicode character
* in the NULL-terminated UTF-8 string. The NULL terminator is considered
* part of the UTF-8 string. Equivalent to Plan 9 utfrune().
*
* Results:
* As above. If the Tcl_UniChar does not exist in the given string, the
* return value is NULL.
* As above. If the Unicode character does not exist in the given string,
* the return value is NULL.
*
* Side effects:
* None.
@@ -516,14 +539,21 @@ Tcl_NumUtfChars(
const char *
Tcl_UtfFindFirst(
const char *src, /* The UTF-8 string to be searched. */
int ch) /* The Tcl_UniChar to search for. */
int ch) /* The Unicode character to search for. */
{
int len;
Tcl_UniChar find;
int len, fullchar;
Tcl_UniChar find = 0;
while (1) {
len = TclUtfToUniChar(src, &find);
if (find == ch) {
fullchar = find;
#if TCL_UTF_MAX == 4
if (!len) {
len += TclUtfToUniChar(src, &find);
fullchar = (((fullchar & 0x3ff) << 10) | (find & 0x3ff)) + 0x10000;
}
#endif
if (fullchar == ch) {
return src;
}
if (*src == '\0') {
@@ -538,12 +568,12 @@ Tcl_UtfFindFirst(
*
* Tcl_UtfFindLast --
*
* Returns a pointer to the last occurance of the given Tcl_UniChar in
* the NULL-terminated UTF-8 string. The NULL terminator is considered
* Returns a pointer to the last occurance of the given Unicode character
* in the NULL-terminated UTF-8 string. The NULL terminator is considered
* part of the UTF-8 string. Equivalent to Plan 9 utfrrune().
*
* Results:
* As above. If the Tcl_UniChar does not exist in the given string, the
* As above. If the Unicode character does not exist in the given string, the
* return value is NULL.
*
* Side effects:
@@ -555,16 +585,23 @@ Tcl_UtfFindFirst(
const char *
Tcl_UtfFindLast(
const char *src, /* The UTF-8 string to be searched. */
int ch) /* The Tcl_UniChar to search for. */
int ch) /* The Unicode character to search for. */
{
int len;
Tcl_UniChar find;
int len, fullchar;
Tcl_UniChar find = 0;
const char *last;
last = NULL;
while (1) {
len = TclUtfToUniChar(src, &find);
if (find == ch) {
fullchar = find;
#if TCL_UTF_MAX == 4
if (!len) {
len += TclUtfToUniChar(src, &find);
fullchar = (((fullchar & 0x3ff) << 10) | (find & 0x3ff)) + 0x10000;
}
#endif
if (fullchar == ch) {
last = src;
}
if (*src == '\0') {
@@ -598,9 +635,15 @@ const char *
Tcl_UtfNext(
const char *src) /* The current location in the string. */
{
Tcl_UniChar ch;
Tcl_UniChar ch = 0;
int len = TclUtfToUniChar(src, &ch);
return src + TclUtfToUniChar(src, &ch);
#if TCL_UTF_MAX == 4
if (len == 0) {
len = TclUtfToUniChar(src, &ch);
}
#endif
return src + len;
}
/*
@@ -633,8 +676,7 @@ Tcl_UtfPrev(
const char *look;
int i, byte;
src--;
look = src;
look = --src;
for (i = 0; i < TCL_UTF_MAX; i++) {
if (look < start) {
if (src < start) {
@@ -659,7 +701,7 @@ Tcl_UtfPrev(
*
* Tcl_UniCharAtIndex --
*
* Returns the Unicode character represented at the specified character
* Returns the Tcl_UniChar represented at the specified character
* (not byte) position in the UTF-8 string.
*
* Results:
@@ -678,8 +720,7 @@ Tcl_UniCharAtIndex(
{
Tcl_UniChar ch = 0;
while (index >= 0) {
index--;
while (index-- >= 0) {
src += TclUtfToUniChar(src, &ch);
}
return ch;
@@ -707,10 +748,9 @@ Tcl_UtfAtIndex(
register const char *src, /* The UTF-8 string. */
register int index) /* The position of the desired character. */
{
Tcl_UniChar ch;
Tcl_UniChar ch = 0;
while (index > 0) {
index--;
while (index-- > 0) {
src += TclUtfToUniChar(src, &ch);
}
return src;
@@ -791,7 +831,7 @@ int
Tcl_UtfToUpper(
char *str) /* String to convert in place. */
{
Tcl_UniChar ch, upChar;
Tcl_UniChar ch = 0, upChar;
char *src, *dst;
int bytes;
@@ -844,7 +884,7 @@ int
Tcl_UtfToLower(
char *str) /* String to convert in place. */
{
Tcl_UniChar ch, lowChar;
Tcl_UniChar ch = 0, lowChar;
char *src, *dst;
int bytes;
@@ -898,7 +938,7 @@ int
Tcl_UtfToTitle(
char *str) /* String to convert in place. */
{
Tcl_UniChar ch, titleChar, lowChar;
Tcl_UniChar ch = 0, titleChar, lowChar;
char *src, *dst;
int bytes;
@@ -1007,7 +1047,7 @@ Tcl_UtfNcmp(
const char *ct, /* UTF string cs is compared to. */
unsigned long numChars) /* Number of UTF chars to compare. */
{
Tcl_UniChar ch1, ch2;
Tcl_UniChar ch1 = 0, ch2 = 0;
/*
* Cannot use 'memcmp(cs, ct, n);' as byte representation of \u0000 (the
@@ -1025,6 +1065,16 @@ Tcl_UtfNcmp(
cs += TclUtfToUniChar(cs, &ch1);
ct += TclUtfToUniChar(ct, &ch2);
if (ch1 != ch2) {
#if TCL_UTF_MAX == 4
/* Surrogates always report higher than non-surrogates */
if (((ch1 & 0xFC00) == 0xD800)) {
if ((ch2 & 0xFC00) != 0xD800) {
return ch1;
}
} else if ((ch2 & 0xFC00) == 0xD800) {
return -ch2;
}
#endif
return (ch1 - ch2);
}
}
@@ -1055,7 +1105,8 @@ Tcl_UtfNcasecmp(
const char *ct, /* UTF string cs is compared to. */
unsigned long numChars) /* Number of UTF chars to compare. */
{
Tcl_UniChar ch1, ch2;
Tcl_UniChar ch1 = 0, ch2 = 0;
while (numChars-- > 0) {
/*
* n must be interpreted as chars, not bytes.
@@ -1065,6 +1116,16 @@ Tcl_UtfNcasecmp(
cs += TclUtfToUniChar(cs, &ch1);
ct += TclUtfToUniChar(ct, &ch2);
if (ch1 != ch2) {
#if TCL_UTF_MAX == 4
/* Surrogates always report higher than non-surrogates */
if (((ch1 & 0xFC00) == 0xD800)) {
if ((ch2 & 0xFC00) != 0xD800) {
return ch1;
}
} else if ((ch2 & 0xFC00) == 0xD800) {
return -ch2;
}
#endif
ch1 = Tcl_UniCharToLower(ch1);
ch2 = Tcl_UniCharToLower(ch2);
if (ch1 != ch2) {
@@ -1074,11 +1135,57 @@ Tcl_UtfNcasecmp(
}
return 0;
}
/*
*----------------------------------------------------------------------
*
* Tcl_UtfCmp --
*
* Compare UTF chars of string cs to string ct case sensitively.
* Replacement for strcmp in Tcl core, in places where UTF-8 should
* be handled.
*
* Results:
* Return <0 if cs < ct, 0 if cs == ct, or >0 if cs > ct.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
int
TclUtfCmp(
const char *cs, /* UTF string to compare to ct. */
const char *ct) /* UTF string cs is compared to. */
{
Tcl_UniChar ch1 = 0, ch2 = 0;
while (*cs && *ct) {
cs += TclUtfToUniChar(cs, &ch1);
ct += TclUtfToUniChar(ct, &ch2);
if (ch1 != ch2) {
#if TCL_UTF_MAX == 4
/* Surrogates always report higher than non-surrogates */
if (((ch1 & 0xFC00) == 0xD800)) {
if ((ch2 & 0xFC00) != 0xD800) {
return ch1;
}
} else if ((ch2 & 0xFC00) == 0xD800) {
return -ch2;
}
#endif
return ch1 - ch2;
}
}
return UCHAR(*cs) - UCHAR(*ct);
}
/*
*----------------------------------------------------------------------
*
* Tcl_UtfNcasecmp --
* TclUtfCasecmp --
*
* Compare UTF chars of string cs to string ct case insensitively.
* Replacement for strcasecmp in Tcl core, in places where UTF-8 should
@@ -1098,12 +1205,22 @@ TclUtfCasecmp(
const char *cs, /* UTF string to compare to ct. */
const char *ct) /* UTF string cs is compared to. */
{
while (*cs && *ct) {
Tcl_UniChar ch1, ch2;
Tcl_UniChar ch1 = 0, ch2 = 0;
while (*cs && *ct) {
cs += TclUtfToUniChar(cs, &ch1);
ct += TclUtfToUniChar(ct, &ch2);
if (ch1 != ch2) {
#if TCL_UTF_MAX == 4
/* Surrogates always report higher than non-surrogates */
if (((ch1 & 0xFC00) == 0xD800)) {
if ((ch2 & 0xFC00) != 0xD800) {
return ch1;
}
} else if ((ch2 & 0xFC00) == 0xD800) {
return -ch2;
}
#endif
ch1 = Tcl_UniCharToLower(ch1);
ch2 = Tcl_UniCharToLower(ch2);
if (ch1 != ch2) {
@@ -1684,7 +1801,7 @@ Tcl_UniCharCaseMatch(
* characters. */
int nocase) /* 0 for case sensitive, 1 for insensitive */
{
Tcl_UniChar ch1, p;
Tcl_UniChar ch1 = 0, p;
while (1) {
p = *uniPattern;
+17 -32
View File
@@ -974,7 +974,7 @@ Tcl_ScanCountedElement(
int *flagPtr) /* Where to store information to guide
* Tcl_ConvertElement. */
{
int flags = CONVERT_ANY;
char flags = CONVERT_ANY;
int numBytes = TclScanElement(src, length, &flags);
*flagPtr = flags;
@@ -1015,7 +1015,7 @@ int
TclScanElement(
const char *src, /* String to convert to Tcl list element. */
int length, /* Number of bytes in src, or -1. */
int *flagPtr) /* Where to store information to guide
char *flagPtr) /* Where to store information to guide
* Tcl_ConvertElement. */
{
const char *p = src;
@@ -1547,11 +1547,10 @@ Tcl_Merge(
int argc, /* How many strings to merge. */
const char *const *argv) /* Array of string values. */
{
#define LOCAL_SIZE 20
int localFlags[LOCAL_SIZE], *flagPtr = NULL;
#define LOCAL_SIZE 64
char localFlags[LOCAL_SIZE], *flagPtr = NULL;
int i, bytesNeeded = 0;
char *result, *dst;
const int maxFlags = UINT_MAX / sizeof(int);
/*
* Handle empty list case first, so logic of the general case can be
@@ -1570,22 +1569,8 @@ Tcl_Merge(
if (argc <= LOCAL_SIZE) {
flagPtr = localFlags;
} else if (argc > maxFlags) {
/*
* We cannot allocate a large enough flag array to format this list in
* one pass. We could imagine converting this routine to a multi-pass
* implementation, but for sizeof(int) == 4, the limit is a max of
* 2^30 list elements and since each element is at least one byte
* formatted, and requires one byte space between it and the next one,
* that a minimum space requirement of 2^31 bytes, which is already
* INT_MAX. If we tried to format a list of > maxFlags elements, we're
* just going to overflow the size limits on the formatted string
* anyway, so just issue that same panic early.
*/
Tcl_Panic("max size for a Tcl value (%d bytes) exceeded", INT_MAX);
} else {
flagPtr = ckalloc(argc * sizeof(int));
flagPtr = ckalloc(argc);
}
for (i = 0; i < argc; i++) {
flagPtr[i] = ( i ? TCL_DONT_QUOTE_HASH : 0 );
@@ -1646,7 +1631,7 @@ Tcl_Backslash(
* src, unless NULL. */
{
char buf[TCL_UTF_MAX];
Tcl_UniChar ch;
Tcl_UniChar ch = 0;
Tcl_UtfBackslash(src, readPtr, buf);
TclUtfToUniChar(buf, &ch);
@@ -1680,6 +1665,7 @@ TclTrimRight(
{
const char *p = bytes + numBytes;
int pInc;
Tcl_UniChar ch1 = 0, ch2 = 0;
if ((bytes[numBytes] != '\0') || (trim[numTrim] != '\0')) {
Tcl_Panic("TclTrimRight works only on null-terminated strings");
@@ -1698,7 +1684,6 @@ TclTrimRight(
*/
do {
Tcl_UniChar ch1;
const char *q = trim;
int bytesLeft = numTrim;
@@ -1710,7 +1695,6 @@ TclTrimRight(
*/
do {
Tcl_UniChar ch2;
int qInc = TclUtfToUniChar(q, &ch2);
if (ch1 == ch2) {
@@ -1760,6 +1744,7 @@ TclTrimLeft(
int numTrim) /* ...and its length in bytes */
{
const char *p = bytes;
Tcl_UniChar ch1 = 0, ch2 = 0;
if ((bytes[numBytes] != '\0') || (trim[numTrim] != '\0')) {
Tcl_Panic("TclTrimLeft works only on null-terminated strings");
@@ -1778,7 +1763,6 @@ TclTrimLeft(
*/
do {
Tcl_UniChar ch1;
int pInc = TclUtfToUniChar(p, &ch1);
const char *q = trim;
int bytesLeft = numTrim;
@@ -1788,7 +1772,6 @@ TclTrimLeft(
*/
do {
Tcl_UniChar ch2;
int qInc = TclUtfToUniChar(q, &ch2);
if (ch1 == ch2) {
@@ -2122,7 +2105,7 @@ Tcl_StringCaseMatch(
{
int p, charLen;
const char *pstart = pattern;
Tcl_UniChar ch1, ch2;
Tcl_UniChar ch1 = 0, ch2 = 0;
while (1) {
p = *pattern;
@@ -2232,7 +2215,7 @@ Tcl_StringCaseMatch(
*/
if (p == '[') {
Tcl_UniChar startChar, endChar;
Tcl_UniChar startChar = 0, endChar = 0;
pattern++;
if (UCHAR(*str) < 0x80) {
@@ -2717,7 +2700,7 @@ Tcl_DStringAppendElement(
{
char *dst = dsPtr->string + dsPtr->length;
int needSpace = TclNeedSpace(dsPtr->string, dst);
int flags = needSpace ? TCL_DONT_QUOTE_HASH : 0;
char flags = needSpace ? TCL_DONT_QUOTE_HASH : 0;
int newSize = dsPtr->length + needSpace
+ TclScanElement(element, -1, &flags);
@@ -3315,6 +3298,7 @@ Tcl_PrintDouble(
*----------------------------------------------------------------------
*/
#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
/* ARGSUSED */
char *
TclPrecTraceProc(
@@ -3372,6 +3356,7 @@ TclPrecTraceProc(
*precisionPtr = prec;
return NULL;
}
#endif /* !TCL_NO_DEPRECATED)*/
/*
*----------------------------------------------------------------------
@@ -4027,7 +4012,7 @@ TclSetProcessGlobalValue(
Tcl_IncrRefCount(newValue);
cacheMap = GetThreadHash(&pgvPtr->key);
ClearHash(cacheMap);
hPtr = Tcl_CreateHashEntry(cacheMap, (void *)(pgvPtr->epoch), &dummy);
hPtr = Tcl_CreateHashEntry(cacheMap, (void *)(size_t)(pgvPtr->epoch), &dummy);
Tcl_SetHashValue(hPtr, newValue);
Tcl_MutexUnlock(&pgvPtr->mutex);
}
@@ -4053,7 +4038,7 @@ TclGetProcessGlobalValue(
Tcl_Obj *value = NULL;
Tcl_HashTable *cacheMap;
Tcl_HashEntry *hPtr;
size_t epoch = pgvPtr->epoch;
unsigned int epoch = pgvPtr->epoch;
if (pgvPtr->encoding) {
Tcl_Encoding current = Tcl_GetEncoding(NULL, NULL);
@@ -4087,7 +4072,7 @@ TclGetProcessGlobalValue(
}
}
cacheMap = GetThreadHash(&pgvPtr->key);
hPtr = Tcl_FindHashEntry(cacheMap, (void *) (epoch));
hPtr = Tcl_FindHashEntry(cacheMap, (void *)(size_t)epoch);
if (NULL == hPtr) {
int dummy;
@@ -4120,7 +4105,7 @@ TclGetProcessGlobalValue(
value = Tcl_NewStringObj(pgvPtr->value, pgvPtr->numBytes);
hPtr = Tcl_CreateHashEntry(cacheMap,
(void *)(pgvPtr->epoch), &dummy);
(void *)(size_t)(pgvPtr->epoch), &dummy);
Tcl_MutexUnlock(&pgvPtr->mutex);
Tcl_SetHashValue(hPtr, value);
Tcl_IncrRefCount(value);
+2 -2
View File
@@ -203,7 +203,7 @@ proc auto_mkindex {dir args} {
}
auto_mkindex_parser::init
foreach file [glob -- {*}$args] {
foreach file [lsort [glob -- {*}$args]] {
try {
append index [auto_mkindex_parser::mkindex $file]
} on error {msg opts} {
@@ -236,7 +236,7 @@ proc auto_mkindex_old {dir args} {
if {![llength $args]} {
set args *.tcl
}
foreach file [glob -- {*}$args] {
foreach file [lsort [glob -- {*}$args]] {
set f ""
set error [catch {
set f [open $file]
+2 -1
View File
@@ -11,7 +11,7 @@
package require Tcl 8.6-
# Keep this in sync with pkgIndex.tcl and with the install directories in
# Makefiles
package provide http 2.8.11
package provide http 2.8.12
namespace eval http {
# Allow resourcing to not clobber existing data
@@ -1027,6 +1027,7 @@ proc http::Event {sock token} {
# We have now read all headers
# We ignore HTTP/1.1 100 Continue returns. RFC2616 sec 8.2.3
if {$state(http) == "" || ([regexp {^\S+\s(\d+)} $state(http) {} x] && $x == 100)} {
set state(state) "connecting"
return
}
+1 -1
View File
@@ -1,2 +1,2 @@
if {![package vsatisfies [package provide Tcl] 8.6-]} {return}
package ifneeded http 2.8.11 [list tclPkgSetup $dir http 2.8.11 {{http.tcl source {::http::config ::http::formatQuery ::http::geturl ::http::reset ::http::wait ::http::register ::http::unregister ::http::mapReply}}}]
package ifneeded http 2.8.12 [list tclPkgSetup $dir http 2.8.12 {{http.tcl source {::http::config ::http::formatQuery ::http::geturl ::http::reset ::http::wait ::http::register ::http::unregister ::http::mapReply}}}]
-377
View File
@@ -1,377 +0,0 @@
# http.tcl
# Client-side HTTP for GET, POST, and HEAD commands.
# These routines can be used in untrusted code that uses the Safesock
# security policy.
# These procedures use a callback interface to avoid using vwait,
# which is not defined in the safe base.
#
# See the http.n man page for documentation
package provide http 1.0
array set http {
-accept */*
-proxyhost {}
-proxyport {}
-useragent {Tcl http client package 1.0}
-proxyfilter httpProxyRequired
}
proc http_config {args} {
global http
set options [lsort [array names http -*]]
set usage [join $options ", "]
if {[llength $args] == 0} {
set result {}
foreach name $options {
lappend result $name $http($name)
}
return $result
}
regsub -all -- - $options {} options
set pat ^-([join $options |])$
if {[llength $args] == 1} {
set flag [lindex $args 0]
if {[regexp -- $pat $flag]} {
return $http($flag)
} else {
return -code error "Unknown option $flag, must be: $usage"
}
} else {
foreach {flag value} $args {
if {[regexp -- $pat $flag]} {
set http($flag) $value
} else {
return -code error "Unknown option $flag, must be: $usage"
}
}
}
}
proc httpFinish { token {errormsg ""} } {
upvar #0 $token state
global errorInfo errorCode
if {[string length $errormsg] != 0} {
set state(error) [list $errormsg $errorInfo $errorCode]
set state(status) error
}
catch {close $state(sock)}
catch {after cancel $state(after)}
if {[info exists state(-command)]} {
if {[catch {eval $state(-command) {$token}} err]} {
if {[string length $errormsg] == 0} {
set state(error) [list $err $errorInfo $errorCode]
set state(status) error
}
}
unset state(-command)
}
}
proc http_reset { token {why reset} } {
upvar #0 $token state
set state(status) $why
catch {fileevent $state(sock) readable {}}
httpFinish $token
if {[info exists state(error)]} {
set errorlist $state(error)
unset state(error)
eval error $errorlist
}
}
proc http_get { url args } {
global http
if {![info exists http(uid)]} {
set http(uid) 0
}
set token http#[incr http(uid)]
upvar #0 $token state
http_reset $token
array set state {
-blocksize 8192
-validate 0
-headers {}
-timeout 0
state header
meta {}
currentsize 0
totalsize 0
type text/html
body {}
status ""
}
set options {-blocksize -channel -command -handler -headers \
-progress -query -validate -timeout}
set usage [join $options ", "]
regsub -all -- - $options {} options
set pat ^-([join $options |])$
foreach {flag value} $args {
if {[regexp $pat $flag]} {
# Validate numbers
if {[info exists state($flag)] && \
[regexp {^[0-9]+$} $state($flag)] && \
![regexp {^[0-9]+$} $value]} {
return -code error "Bad value for $flag ($value), must be integer"
}
set state($flag) $value
} else {
return -code error "Unknown option $flag, can be: $usage"
}
}
if {! [regexp -nocase {^(http://)?([^/:]+)(:([0-9]+))?(/.*)?$} $url \
x proto host y port srvurl]} {
error "Unsupported URL: $url"
}
if {[string length $port] == 0} {
set port 80
}
if {[string length $srvurl] == 0} {
set srvurl /
}
if {[string length $proto] == 0} {
set url http://$url
}
set state(url) $url
if {![catch {$http(-proxyfilter) $host} proxy]} {
set phost [lindex $proxy 0]
set pport [lindex $proxy 1]
}
if {$state(-timeout) > 0} {
set state(after) [after $state(-timeout) [list http_reset $token timeout]]
}
if {[info exists phost] && [string length $phost]} {
set srvurl $url
set s [socket $phost $pport]
} else {
set s [socket $host $port]
}
set state(sock) $s
# Send data in cr-lf format, but accept any line terminators
fconfigure $s -translation {auto crlf} -buffersize $state(-blocksize)
# The following is disallowed in safe interpreters, but the socket
# is already in non-blocking mode in that case.
catch {fconfigure $s -blocking off}
set len 0
set how GET
if {[info exists state(-query)]} {
set len [string length $state(-query)]
if {$len > 0} {
set how POST
}
} elseif {$state(-validate)} {
set how HEAD
}
puts $s "$how $srvurl HTTP/1.0"
puts $s "Accept: $http(-accept)"
puts $s "Host: $host"
puts $s "User-Agent: $http(-useragent)"
foreach {key value} $state(-headers) {
regsub -all \[\n\r\] $value {} value
set key [string trim $key]
if {[string length $key]} {
puts $s "$key: $value"
}
}
if {$len > 0} {
puts $s "Content-Length: $len"
puts $s "Content-Type: application/x-www-form-urlencoded"
puts $s ""
fconfigure $s -translation {auto binary}
puts -nonewline $s $state(-query)
} else {
puts $s ""
}
flush $s
fileevent $s readable [list httpEvent $token]
if {! [info exists state(-command)]} {
http_wait $token
}
return $token
}
proc http_data {token} {
upvar #0 $token state
return $state(body)
}
proc http_status {token} {
upvar #0 $token state
return $state(status)
}
proc http_code {token} {
upvar #0 $token state
return $state(http)
}
proc http_size {token} {
upvar #0 $token state
return $state(currentsize)
}
proc httpEvent {token} {
upvar #0 $token state
set s $state(sock)
if {[eof $s]} {
httpEof $token
return
}
if {$state(state) == "header"} {
set n [gets $s line]
if {$n == 0} {
set state(state) body
if {![regexp -nocase ^text $state(type)]} {
# Turn off conversions for non-text data
fconfigure $s -translation binary
if {[info exists state(-channel)]} {
fconfigure $state(-channel) -translation binary
}
}
if {[info exists state(-channel)] &&
![info exists state(-handler)]} {
# Initiate a sequence of background fcopies
fileevent $s readable {}
httpCopyStart $s $token
}
} elseif {$n > 0} {
if {[regexp -nocase {^content-type:(.+)$} $line x type]} {
set state(type) [string trim $type]
}
if {[regexp -nocase {^content-length:(.+)$} $line x length]} {
set state(totalsize) [string trim $length]
}
if {[regexp -nocase {^([^:]+):(.+)$} $line x key value]} {
lappend state(meta) $key $value
} elseif {[regexp ^HTTP $line]} {
set state(http) $line
}
}
} else {
if {[catch {
if {[info exists state(-handler)]} {
set n [eval $state(-handler) {$s $token}]
} else {
set block [read $s $state(-blocksize)]
set n [string length $block]
if {$n >= 0} {
append state(body) $block
}
}
if {$n >= 0} {
incr state(currentsize) $n
}
} err]} {
httpFinish $token $err
} else {
if {[info exists state(-progress)]} {
eval $state(-progress) {$token $state(totalsize) $state(currentsize)}
}
}
}
}
proc httpCopyStart {s token} {
upvar #0 $token state
if {[catch {
fcopy $s $state(-channel) -size $state(-blocksize) -command \
[list httpCopyDone $token]
} err]} {
httpFinish $token $err
}
}
proc httpCopyDone {token count {error {}}} {
upvar #0 $token state
set s $state(sock)
incr state(currentsize) $count
if {[info exists state(-progress)]} {
eval $state(-progress) {$token $state(totalsize) $state(currentsize)}
}
if {([string length $error] != 0)} {
httpFinish $token $error
} elseif {[eof $s]} {
httpEof $token
} else {
httpCopyStart $s $token
}
}
proc httpEof {token} {
upvar #0 $token state
if {$state(state) == "header"} {
# Premature eof
set state(status) eof
} else {
set state(status) ok
}
set state(state) eof
httpFinish $token
}
proc http_wait {token} {
upvar #0 $token state
if {![info exists state(status)] || [string length $state(status)] == 0} {
vwait $token\(status)
}
if {[info exists state(error)]} {
set errorlist $state(error)
unset state(error)
eval error $errorlist
}
return $state(status)
}
# Call http_formatQuery with an even number of arguments, where the first is
# a name, the second is a value, the third is another name, and so on.
proc http_formatQuery {args} {
set result ""
set sep ""
foreach i $args {
append result $sep [httpMapReply $i]
if {$sep != "="} {
set sep =
} else {
set sep &
}
}
return $result
}
# do x-www-urlencoded character mapping
# The spec says: "non-alphanumeric characters are replaced by '%HH'"
# 1 leave alphanumerics characters alone
# 2 Convert every other character to an array lookup
# 3 Escape constructs that are "special" to the tcl parser
# 4 "subst" the result, doing all the array substitutions
proc httpMapReply {string} {
global httpFormMap
set alphanumeric a-zA-Z0-9
if {![info exists httpFormMap]} {
for {set i 1} {$i <= 256} {incr i} {
set c [format %c $i]
if {![string match \[$alphanumeric\] $c]} {
set httpFormMap($c) %[format %.2x $i]
}
}
# These are handled specially
array set httpFormMap {
" " + \n %0d%0a
}
}
regsub -all \[^$alphanumeric\] $string {$httpFormMap(&)} string
regsub -all \n $string {\\n} string
regsub -all \t $string {\\t} string
regsub -all {[][{})\\]\)} $string {\\&} string
return [subst $string]
}
# Default proxy filter.
proc httpProxyRequired {host} {
global http
if {[info exists http(-proxyhost)] && [string length $http(-proxyhost)]} {
if {![info exists http(-proxyport)] || ![string length $http(-proxyport)]} {
set http(-proxyport) 8080
}
return [list $http(-proxyhost) $http(-proxyport)]
} else {
return {}
}
}
-11
View File
@@ -1,11 +0,0 @@
# Tcl package index file, version 1.0
# This file is generated by the "pkg_mkIndex" command
# and sourced either when an application starts up or
# by a "package unknown" script. It invokes the
# "package ifneeded" command to set up package-related
# information so that packages will be loaded automatically
# in response to "package require" commands. When this
# script is sourced, the variable $dir must contain the
# full path name of this file's directory.
package ifneeded http 1.0 [list tclPkgSetup $dir http 1.0 {{http.tcl source {httpCopyDone httpCopyStart httpEof httpEvent httpFinish httpMapReply httpProxyRequired http_code http_config http_data http_formatQuery http_get http_reset http_size http_status http_wait}}}]
+32 -67
View File
@@ -16,7 +16,7 @@
if {[info commands package] == ""} {
error "version mismatch: library\nscripts expect Tcl version 7.5b1 or later but the loaded version is\nonly [info patchlevel]"
}
package require -exact Tcl 8.7a0
package require -exact Tcl 8.7a2
# Compute the auto path to use in this interpreter.
# The values on the path come from several locations:
@@ -73,43 +73,6 @@ namespace eval tcl {
encoding dirs $Path
}
}
# TIP #255 min and max functions
namespace eval mathfunc {
proc min {args} {
if {![llength $args]} {
return -code error \
"too few arguments to math function \"min\""
}
set val Inf
foreach arg $args {
# This will handle forcing the numeric value without
# ruining the internal type of a numeric object
if {[catch {expr {double($arg)}} err]} {
return -code error $err
}
if {$arg < $val} {set val $arg}
}
return $val
}
proc max {args} {
if {![llength $args]} {
return -code error \
"too few arguments to math function \"max\""
}
set val -Inf
foreach arg $args {
# This will handle forcing the numeric value without
# ruining the internal type of a numeric object
if {[catch {expr {double($arg)}} err]} {
return -code error $err
}
if {$arg > $val} {set val $arg}
}
return $val
}
namespace export min max
}
}
namespace eval tcl::Pkg {}
@@ -286,14 +249,9 @@ proc unknown args {
}
append cinfo ...
}
append cinfo "\"\n (\"uplevel\" body line 1)"
append cinfo "\n invoked from within"
append cinfo "\n\"uplevel 1 \$args\""
#
# Try each possible form of the stack trace
# and trim the extra contribution from the matching case
#
set expect "$msg\n while executing\n\"$cinfo"
set tail "\n (\"uplevel\" body line 1)\n invoked\
from within\n\"uplevel 1 \$args\""
set expect "$msg\n while executing\n\"$cinfo\"$tail"
if {$errInfo eq $expect} {
#
# The stack has only the eval from the expanded command
@@ -307,21 +265,32 @@ proc unknown args {
# Stack trace is nested, trim off just the contribution
# from the extra "eval" of $args due to the "catch" above.
#
set expect "\n invoked from within\n\"$cinfo"
set exlen [string length $expect]
set eilen [string length $errInfo]
set i [expr {$eilen - $exlen - 1}]
set einfo [string range $errInfo 0 $i]
#
# For now verify that $errInfo consists of what we are about
# to return plus what we expected to trim off.
#
if {$errInfo ne "$einfo$expect"} {
error "Tcl bug: unexpected stack trace in \"unknown\"" {} \
[list CORE UNKNOWN BADTRACE $einfo $expect $errInfo]
set last [string last $tail $errInfo]
if {$last + [string length $tail] != [string length $errInfo]} {
# Very likely cannot happen
return -options $opts $msg
}
return -code error -errorcode $errCode \
-errorinfo $einfo $msg
set errInfo [string range $errInfo 0 $last-1]
set tail "\"$cinfo\""
set last [string last $tail $errInfo]
if {$last + [string length $tail] != [string length $errInfo]} {
return -code error -errorcode $errCode \
-errorinfo $errInfo $msg
}
set errInfo [string range $errInfo 0 $last-1]
set tail "\n invoked from within\n"
set last [string last $tail $errInfo]
if {$last + [string length $tail] == [string length $errInfo]} {
return -code error -errorcode $errCode \
-errorinfo [string range $errInfo 0 $last-1] $msg
}
set tail "\n while executing\n"
set last [string last $tail $errInfo]
if {$last + [string length $tail] == [string length $errInfo]} {
return -code error -errorcode $errCode \
-errorinfo [string range $errInfo 0 $last-1] $msg
}
return -options $opts $msg
} else {
dict incr opts -level
return -options $opts $msg
@@ -636,7 +605,7 @@ proc auto_import {pattern} {
if {$tcl_platform(platform) eq "windows"} {
# Windows version.
#
# Note that info executable doesn't work under Windows, so we have to
# Note that file executable doesn't work under Windows, so we have to
# look for files with .exe, .com, or .bat extensions. Also, the path
# may be in the Path or PATH environment variables, and path
# components are separated with semicolons, not colons as under Unix.
@@ -650,8 +619,7 @@ proc auto_execok name {
set auto_execs($name) ""
set shellBuiltins [list assoc cls copy date del dir echo erase ftype \
md mkdir mklink move rd ren rename rmdir start \
time type ver vol]
md mkdir mklink move rd ren rename rmdir start time type ver vol]
if {[info exists env(PATHEXT)]} {
# Add an initial ; to have the {} extension check first.
set execExtensions [split ";$env(PATHEXT)" ";"]
@@ -685,10 +653,7 @@ proc auto_execok name {
set windir $env(WINDIR)
}
if {[info exists windir]} {
if {$tcl_platform(os) eq "Windows NT"} {
append path "$windir/system32;"
}
append path "$windir/system;$windir;"
append path "$windir/system32;$windir/system;$windir;"
}
foreach var {PATH Path path} {
+1 -1
View File
@@ -14,7 +14,7 @@
package require Tcl 8.5-
# When the version number changes, be sure to update the pkgIndex.tcl file,
# and the installation directory in the Makefiles.
package provide msgcat 1.6.0
package provide msgcat 1.6.1
namespace eval msgcat {
namespace export mc mcexists mcload mclocale mcmax mcmset mcpreferences mcset\
+2 -2
View File
@@ -1,2 +1,2 @@
if {![package vsatisfies [package provide Tcl] 8.5]} {return}
package ifneeded msgcat 1.6.0 [list source [file join $dir msgcat.tcl]]
if {![package vsatisfies [package provide Tcl] 8.5-]} {return}
package ifneeded msgcat 1.6.1 [list source [file join $dir msgcat.tcl]]
+2 -2
View File
@@ -8,10 +8,10 @@
# on it. If your code does rely on this package you
# may directly incorporate this code into your application.
package require Tcl 8.2
package require Tcl 8.5-
# When this version number changes, update the pkgIndex.tcl file
# and the install directory in the Makefiles.
package provide opt 0.4.6
package provide opt 0.4.7
namespace eval ::tcl {
+2 -2
View File
@@ -8,5 +8,5 @@
# script is sourced, the variable $dir must contain the
# full path name of this file's directory.
if {![package vsatisfies [package provide Tcl] 8.2]} {return}
package ifneeded opt 0.4.6 [list source [file join $dir optparse.tcl]]
if {![package vsatisfies [package provide Tcl] 8.5-]} {return}
package ifneeded opt 0.4.7 [list source [file join $dir optparse.tcl]]
+2 -2
View File
@@ -8,5 +8,5 @@
# script is sourced, the variable $dir must contain the
# full path name of this file's directory.
if {![package vsatisfies [package provide Tcl] 8.5]} {return}
package ifneeded tcltest 2.4.0 [list source [file join $dir tcltest.tcl]]
if {![package vsatisfies [package provide Tcl] 8.5-]} {return}
package ifneeded tcltest 2.4.1 [list source [file join $dir tcltest.tcl]]
+1 -1
View File
@@ -22,7 +22,7 @@ namespace eval tcltest {
# When the version number changes, be sure to update the pkgIndex.tcl file,
# and the install directory in the Makefiles. When the minor version
# changes (new feature) be sure to update the man page as well.
variable Version 2.4.0
variable Version 2.4.1
# Compatibility support for dumb variables defined in tcltest 1
# Do not use these. Call [package provide Tcl] and [info patchlevel]
+37 -3
View File
@@ -1,5 +1,39 @@
# created by tools/tclZIC.tcl - do not edit
if {![info exists TZData(Africa/Khartoum)]} {
LoadTimeZoneFile Africa/Khartoum
set TZData(:Africa/Juba) {
{-9223372036854775808 7588 0 LMT}
{-1230775588 7200 0 CAT}
{10360800 10800 1 CAST}
{24786000 7200 0 CAT}
{41810400 10800 1 CAST}
{56322000 7200 0 CAT}
{73432800 10800 1 CAST}
{87944400 7200 0 CAT}
{104882400 10800 1 CAST}
{119480400 7200 0 CAT}
{136332000 10800 1 CAST}
{151016400 7200 0 CAT}
{167781600 10800 1 CAST}
{182552400 7200 0 CAT}
{199231200 10800 1 CAST}
{214174800 7200 0 CAT}
{230680800 10800 1 CAST}
{245710800 7200 0 CAT}
{262735200 10800 1 CAST}
{277246800 7200 0 CAT}
{294184800 10800 1 CAST}
{308782800 7200 0 CAT}
{325634400 10800 1 CAST}
{340405200 7200 0 CAT}
{357084000 10800 1 CAST}
{371941200 7200 0 CAT}
{388533600 10800 1 CAST}
{403477200 7200 0 CAT}
{419983200 10800 1 CAST}
{435013200 7200 0 CAT}
{452037600 10800 1 CAST}
{466635600 7200 0 CAT}
{483487200 10800 1 CAST}
{498171600 7200 0 CAT}
{947930400 10800 0 EAT}
}
set TZData(:Africa/Juba) $TZData(:Africa/Khartoum)
+1
View File
@@ -36,4 +36,5 @@ set TZData(:Africa/Khartoum) {
{483487200 10800 1 CAST}
{498171600 7200 0 CAT}
{947930400 10800 0 EAT}
{1509483600 7200 0 CAT}
}
+3 -166
View File
@@ -7,7 +7,8 @@ set TZData(:Africa/Windhoek) {
{-860976000 10800 1 SAST}
{-845254800 7200 0 SAST}
{637970400 7200 0 CAT}
{765324000 3600 0 WAT}
{764200800 3600 0 WAT}
{764204400 3600 0 WAT}
{778640400 7200 1 WAST}
{796780800 3600 0 WAT}
{810090000 7200 1 WAST}
@@ -54,169 +55,5 @@ set TZData(:Africa/Windhoek) {
{1459641600 3600 0 WAT}
{1472950800 7200 1 WAST}
{1491091200 3600 0 WAT}
{1504400400 7200 1 WAST}
{1522540800 3600 0 WAT}
{1535850000 7200 1 WAST}
{1554595200 3600 0 WAT}
{1567299600 7200 1 WAST}
{1586044800 3600 0 WAT}
{1599354000 7200 1 WAST}
{1617494400 3600 0 WAT}
{1630803600 7200 1 WAST}
{1648944000 3600 0 WAT}
{1662253200 7200 1 WAST}
{1680393600 3600 0 WAT}
{1693702800 7200 1 WAST}
{1712448000 3600 0 WAT}
{1725152400 7200 1 WAST}
{1743897600 3600 0 WAT}
{1757206800 7200 1 WAST}
{1775347200 3600 0 WAT}
{1788656400 7200 1 WAST}
{1806796800 3600 0 WAT}
{1820106000 7200 1 WAST}
{1838246400 3600 0 WAT}
{1851555600 7200 1 WAST}
{1869696000 3600 0 WAT}
{1883005200 7200 1 WAST}
{1901750400 3600 0 WAT}
{1914454800 7200 1 WAST}
{1933200000 3600 0 WAT}
{1946509200 7200 1 WAST}
{1964649600 3600 0 WAT}
{1977958800 7200 1 WAST}
{1996099200 3600 0 WAT}
{2009408400 7200 1 WAST}
{2027548800 3600 0 WAT}
{2040858000 7200 1 WAST}
{2058998400 3600 0 WAT}
{2072307600 7200 1 WAST}
{2091052800 3600 0 WAT}
{2104362000 7200 1 WAST}
{2122502400 3600 0 WAT}
{2135811600 7200 1 WAST}
{2153952000 3600 0 WAT}
{2167261200 7200 1 WAST}
{2185401600 3600 0 WAT}
{2198710800 7200 1 WAST}
{2216851200 3600 0 WAT}
{2230160400 7200 1 WAST}
{2248905600 3600 0 WAT}
{2261610000 7200 1 WAST}
{2280355200 3600 0 WAT}
{2293664400 7200 1 WAST}
{2311804800 3600 0 WAT}
{2325114000 7200 1 WAST}
{2343254400 3600 0 WAT}
{2356563600 7200 1 WAST}
{2374704000 3600 0 WAT}
{2388013200 7200 1 WAST}
{2406153600 3600 0 WAT}
{2419462800 7200 1 WAST}
{2438208000 3600 0 WAT}
{2450912400 7200 1 WAST}
{2469657600 3600 0 WAT}
{2482966800 7200 1 WAST}
{2501107200 3600 0 WAT}
{2514416400 7200 1 WAST}
{2532556800 3600 0 WAT}
{2545866000 7200 1 WAST}
{2564006400 3600 0 WAT}
{2577315600 7200 1 WAST}
{2596060800 3600 0 WAT}
{2608765200 7200 1 WAST}
{2627510400 3600 0 WAT}
{2640819600 7200 1 WAST}
{2658960000 3600 0 WAT}
{2672269200 7200 1 WAST}
{2690409600 3600 0 WAT}
{2703718800 7200 1 WAST}
{2721859200 3600 0 WAT}
{2735168400 7200 1 WAST}
{2753308800 3600 0 WAT}
{2766618000 7200 1 WAST}
{2785363200 3600 0 WAT}
{2798067600 7200 1 WAST}
{2816812800 3600 0 WAT}
{2830122000 7200 1 WAST}
{2848262400 3600 0 WAT}
{2861571600 7200 1 WAST}
{2879712000 3600 0 WAT}
{2893021200 7200 1 WAST}
{2911161600 3600 0 WAT}
{2924470800 7200 1 WAST}
{2942611200 3600 0 WAT}
{2955920400 7200 1 WAST}
{2974665600 3600 0 WAT}
{2987974800 7200 1 WAST}
{3006115200 3600 0 WAT}
{3019424400 7200 1 WAST}
{3037564800 3600 0 WAT}
{3050874000 7200 1 WAST}
{3069014400 3600 0 WAT}
{3082323600 7200 1 WAST}
{3100464000 3600 0 WAT}
{3113773200 7200 1 WAST}
{3132518400 3600 0 WAT}
{3145222800 7200 1 WAST}
{3163968000 3600 0 WAT}
{3177277200 7200 1 WAST}
{3195417600 3600 0 WAT}
{3208726800 7200 1 WAST}
{3226867200 3600 0 WAT}
{3240176400 7200 1 WAST}
{3258316800 3600 0 WAT}
{3271626000 7200 1 WAST}
{3289766400 3600 0 WAT}
{3303075600 7200 1 WAST}
{3321820800 3600 0 WAT}
{3334525200 7200 1 WAST}
{3353270400 3600 0 WAT}
{3366579600 7200 1 WAST}
{3384720000 3600 0 WAT}
{3398029200 7200 1 WAST}
{3416169600 3600 0 WAT}
{3429478800 7200 1 WAST}
{3447619200 3600 0 WAT}
{3460928400 7200 1 WAST}
{3479673600 3600 0 WAT}
{3492378000 7200 1 WAST}
{3511123200 3600 0 WAT}
{3524432400 7200 1 WAST}
{3542572800 3600 0 WAT}
{3555882000 7200 1 WAST}
{3574022400 3600 0 WAT}
{3587331600 7200 1 WAST}
{3605472000 3600 0 WAT}
{3618781200 7200 1 WAST}
{3636921600 3600 0 WAT}
{3650230800 7200 1 WAST}
{3668976000 3600 0 WAT}
{3681680400 7200 1 WAST}
{3700425600 3600 0 WAT}
{3713734800 7200 1 WAST}
{3731875200 3600 0 WAT}
{3745184400 7200 1 WAST}
{3763324800 3600 0 WAT}
{3776634000 7200 1 WAST}
{3794774400 3600 0 WAT}
{3808083600 7200 1 WAST}
{3826224000 3600 0 WAT}
{3839533200 7200 1 WAST}
{3858278400 3600 0 WAT}
{3871587600 7200 1 WAST}
{3889728000 3600 0 WAT}
{3903037200 7200 1 WAST}
{3921177600 3600 0 WAT}
{3934486800 7200 1 WAST}
{3952627200 3600 0 WAT}
{3965936400 7200 1 WAST}
{3984076800 3600 0 WAT}
{3997386000 7200 1 WAST}
{4016131200 3600 0 WAT}
{4028835600 7200 1 WAST}
{4047580800 3600 0 WAT}
{4060890000 7200 1 WAST}
{4079030400 3600 0 WAT}
{4092339600 7200 1 WAST}
{1504400400 7200 0 CAT}
}
+2 -2
View File
@@ -1,8 +1,8 @@
# created by tools/tclZIC.tcl - do not edit
set TZData(:America/Adak) {
{-9223372036854775808 44001 0 LMT}
{-3225356001 -42398 0 LMT}
{-9223372036854775808 44002 0 LMT}
{-3225223727 -42398 0 LMT}
{-2188944802 -39600 0 NST}
{-883573200 -39600 0 NST}
{-880196400 -36000 1 NWT}
+1 -1
View File
@@ -2,7 +2,7 @@
set TZData(:America/Anchorage) {
{-9223372036854775808 50424 0 LMT}
{-3225362424 -35976 0 LMT}
{-3225223727 -35976 0 LMT}
{-2188951224 -36000 0 AST}
{-883576800 -36000 0 AST}
{-880200000 -32400 1 AWT}
-2
View File
@@ -11,8 +11,6 @@ set TZData(:America/Detroit) {
{-757364400 -18000 0 EST}
{-684349200 -14400 1 EDT}
{-671047200 -18000 0 EST}
{-80499600 -14400 1 EDT}
{-68666400 -18000 0 EST}
{94712400 -18000 0 EST}
{104914800 -14400 1 EDT}
{120636000 -18000 0 EST}
+164
View File
@@ -79,4 +79,168 @@ set TZData(:America/Grand_Turk) {
{1414908000 -18000 0 EST}
{1425798000 -14400 1 EDT}
{1446361200 -14400 0 AST}
{1520751600 -14400 0 EDT}
{1541311200 -18000 0 EST}
{1552201200 -14400 1 EDT}
{1572760800 -18000 0 EST}
{1583650800 -14400 1 EDT}
{1604210400 -18000 0 EST}
{1615705200 -14400 1 EDT}
{1636264800 -18000 0 EST}
{1647154800 -14400 1 EDT}
{1667714400 -18000 0 EST}
{1678604400 -14400 1 EDT}
{1699164000 -18000 0 EST}
{1710054000 -14400 1 EDT}
{1730613600 -18000 0 EST}
{1741503600 -14400 1 EDT}
{1762063200 -18000 0 EST}
{1772953200 -14400 1 EDT}
{1793512800 -18000 0 EST}
{1805007600 -14400 1 EDT}
{1825567200 -18000 0 EST}
{1836457200 -14400 1 EDT}
{1857016800 -18000 0 EST}
{1867906800 -14400 1 EDT}
{1888466400 -18000 0 EST}
{1899356400 -14400 1 EDT}
{1919916000 -18000 0 EST}
{1930806000 -14400 1 EDT}
{1951365600 -18000 0 EST}
{1962860400 -14400 1 EDT}
{1983420000 -18000 0 EST}
{1994310000 -14400 1 EDT}
{2014869600 -18000 0 EST}
{2025759600 -14400 1 EDT}
{2046319200 -18000 0 EST}
{2057209200 -14400 1 EDT}
{2077768800 -18000 0 EST}
{2088658800 -14400 1 EDT}
{2109218400 -18000 0 EST}
{2120108400 -14400 1 EDT}
{2140668000 -18000 0 EST}
{2152162800 -14400 1 EDT}
{2172722400 -18000 0 EST}
{2183612400 -14400 1 EDT}
{2204172000 -18000 0 EST}
{2215062000 -14400 1 EDT}
{2235621600 -18000 0 EST}
{2246511600 -14400 1 EDT}
{2267071200 -18000 0 EST}
{2277961200 -14400 1 EDT}
{2298520800 -18000 0 EST}
{2309410800 -14400 1 EDT}
{2329970400 -18000 0 EST}
{2341465200 -14400 1 EDT}
{2362024800 -18000 0 EST}
{2372914800 -14400 1 EDT}
{2393474400 -18000 0 EST}
{2404364400 -14400 1 EDT}
{2424924000 -18000 0 EST}
{2435814000 -14400 1 EDT}
{2456373600 -18000 0 EST}
{2467263600 -14400 1 EDT}
{2487823200 -18000 0 EST}
{2499318000 -14400 1 EDT}
{2519877600 -18000 0 EST}
{2530767600 -14400 1 EDT}
{2551327200 -18000 0 EST}
{2562217200 -14400 1 EDT}
{2582776800 -18000 0 EST}
{2593666800 -14400 1 EDT}
{2614226400 -18000 0 EST}
{2625116400 -14400 1 EDT}
{2645676000 -18000 0 EST}
{2656566000 -14400 1 EDT}
{2677125600 -18000 0 EST}
{2688620400 -14400 1 EDT}
{2709180000 -18000 0 EST}
{2720070000 -14400 1 EDT}
{2740629600 -18000 0 EST}
{2751519600 -14400 1 EDT}
{2772079200 -18000 0 EST}
{2782969200 -14400 1 EDT}
{2803528800 -18000 0 EST}
{2814418800 -14400 1 EDT}
{2834978400 -18000 0 EST}
{2846473200 -14400 1 EDT}
{2867032800 -18000 0 EST}
{2877922800 -14400 1 EDT}
{2898482400 -18000 0 EST}
{2909372400 -14400 1 EDT}
{2929932000 -18000 0 EST}
{2940822000 -14400 1 EDT}
{2961381600 -18000 0 EST}
{2972271600 -14400 1 EDT}
{2992831200 -18000 0 EST}
{3003721200 -14400 1 EDT}
{3024280800 -18000 0 EST}
{3035775600 -14400 1 EDT}
{3056335200 -18000 0 EST}
{3067225200 -14400 1 EDT}
{3087784800 -18000 0 EST}
{3098674800 -14400 1 EDT}
{3119234400 -18000 0 EST}
{3130124400 -14400 1 EDT}
{3150684000 -18000 0 EST}
{3161574000 -14400 1 EDT}
{3182133600 -18000 0 EST}
{3193023600 -14400 1 EDT}
{3213583200 -18000 0 EST}
{3225078000 -14400 1 EDT}
{3245637600 -18000 0 EST}
{3256527600 -14400 1 EDT}
{3277087200 -18000 0 EST}
{3287977200 -14400 1 EDT}
{3308536800 -18000 0 EST}
{3319426800 -14400 1 EDT}
{3339986400 -18000 0 EST}
{3350876400 -14400 1 EDT}
{3371436000 -18000 0 EST}
{3382930800 -14400 1 EDT}
{3403490400 -18000 0 EST}
{3414380400 -14400 1 EDT}
{3434940000 -18000 0 EST}
{3445830000 -14400 1 EDT}
{3466389600 -18000 0 EST}
{3477279600 -14400 1 EDT}
{3497839200 -18000 0 EST}
{3508729200 -14400 1 EDT}
{3529288800 -18000 0 EST}
{3540178800 -14400 1 EDT}
{3560738400 -18000 0 EST}
{3572233200 -14400 1 EDT}
{3592792800 -18000 0 EST}
{3603682800 -14400 1 EDT}
{3624242400 -18000 0 EST}
{3635132400 -14400 1 EDT}
{3655692000 -18000 0 EST}
{3666582000 -14400 1 EDT}
{3687141600 -18000 0 EST}
{3698031600 -14400 1 EDT}
{3718591200 -18000 0 EST}
{3730086000 -14400 1 EDT}
{3750645600 -18000 0 EST}
{3761535600 -14400 1 EDT}
{3782095200 -18000 0 EST}
{3792985200 -14400 1 EDT}
{3813544800 -18000 0 EST}
{3824434800 -14400 1 EDT}
{3844994400 -18000 0 EST}
{3855884400 -14400 1 EDT}
{3876444000 -18000 0 EST}
{3887334000 -14400 1 EDT}
{3907893600 -18000 0 EST}
{3919388400 -14400 1 EDT}
{3939948000 -18000 0 EST}
{3950838000 -14400 1 EDT}
{3971397600 -18000 0 EST}
{3982287600 -14400 1 EDT}
{4002847200 -18000 0 EST}
{4013737200 -14400 1 EDT}
{4034296800 -18000 0 EST}
{4045186800 -14400 1 EDT}
{4065746400 -18000 0 EST}
{4076636400 -14400 1 EDT}
{4097196000 -18000 0 EST}
}
+1 -1
View File
@@ -2,7 +2,7 @@
set TZData(:America/Juneau) {
{-9223372036854775808 54139 0 LMT}
{-3225366139 -32261 0 LMT}
{-3225223727 -32261 0 LMT}
{-2188954939 -28800 0 PST}
{-883584000 -28800 0 PST}
{-880207200 -25200 1 PWT}
+1 -1
View File
@@ -2,7 +2,7 @@
set TZData(:America/Metlakatla) {
{-9223372036854775808 54822 0 LMT}
{-3225366822 -31578 0 LMT}
{-3225223727 -31578 0 LMT}
{-2188955622 -28800 0 PST}
{-883584000 -28800 0 PST}
{-880207200 -25200 1 PWT}
+2 -2
View File
@@ -1,8 +1,8 @@
# created by tools/tclZIC.tcl - do not edit
set TZData(:America/Nome) {
{-9223372036854775808 46701 0 LMT}
{-3225358701 -39698 0 LMT}
{-9223372036854775808 46702 0 LMT}
{-3225223727 -39698 0 LMT}
{-2188947502 -39600 0 NST}
{-883573200 -39600 0 NST}
{-880196400 -36000 1 NWT}

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