Compare commits

...
Author SHA1 Message Date
pooryorick 5e7e1715af Merge unchained branch [22400aa71b] and resolve conflicts. 2023-06-26 07:24:26 +00:00
pooryorick 674dc6d84e Merge trunk-encoding-defaultstrict [c499122331]. 2023-06-18 21:30:00 +00:00
pooryorick f85eb13554 Merge trunk [7dc0ea8ca5]. 2023-06-12 10:19:50 +00:00
pooryorick 50eb79b797 Merge trunk [19e22d9bc5]. 2023-06-11 21:31:59 +00:00
pooryorick dd66ab423e Merge trunk [402ff62239]. 2023-06-11 20:21:28 +00:00
pooryorick 7600da9e6c Merge trunk [07d84ca4b3]. 2023-06-11 19:53:08 +00:00
pooryorick a1300ad826 Merge trunk [3389fba412]. 2023-06-11 19:41:42 +00:00
pooryorick fea0c84f2f Merge trunk [9d2e82fe49]. 2023-06-11 13:10:31 +00:00
pooryorick 25fb9a6a54 Merge trunk [b06ffa0e0e]. 2023-06-11 08:55:29 +00:00
pooryorick baf1eb36e4 Merge trunk [66350977dd]. 2023-06-11 08:07:01 +00:00
pooryorick 6c22f6b730 Merge trunk [20891426a8]. 2023-06-11 07:29:27 +00:00
pooryorick 2071be71b1 Merge trunk [874005b119] 2023-06-11 05:06:54 +00:00
apnadkarni 9cf727affb Tests for invalidly encoded file names and env (TIP 671 motivation) 2023-06-11 02:34:35 +00:00
pointsman 5140d2419c Merge 8.7 2023-06-04 22:58:07 +00:00
pointsman d716e3bd57 Merge 8.6 2023-06-04 22:56:45 +00:00
pointsman 02f302c8cf Fixed a new test added by [72f78b60851]. The test as it was repeated just the previous one. Now it shows what was fixed. Removed development comment. 2023-06-04 22:54:59 +00:00
jan.nijtmans 9ef860c58c Merge 8.7 2023-06-03 20:03:28 +00:00
jan.nijtmans 702bb9ab89 Merge 8.6 2023-06-03 19:59:48 +00:00
jan.nijtmans a7e21b7c56 Fix [af3ebc5fafe0097c]: clock scan and clock add bugs in error cases / with abbreviated options 2023-06-03 19:51:21 +00:00
jan.nijtmans 6b77d746e1 Merge 8.7 2023-06-02 22:12:10 +00:00
jan.nijtmans 7e152743be In TclAttemptInitStringRep(): Don't do a memcpy if attemptckalloc() fails 2023-06-02 22:05:03 +00:00
dkf 0513ad381a More library(n) docs 2023-06-02 15:12:26 +00:00
jan.nijtmans b37dff78c1 Merge 8.7 2023-06-02 14:02:19 +00:00
jan.nijtmans 103eb015c0 Merge 8.7 2023-06-02 13:59:26 +00:00
dgp 73519e9804 silence compiler warning 2023-06-02 13:46:50 +00:00
jan.nijtmans 2867ac2637 New (internal) macro TclAttemptInitStringRep() 2023-06-02 12:00:02 +00:00
jan.nijtmans 3d0413417d Merge 8.7 2023-06-01 21:04:48 +00:00
jan.nijtmans 56d50aec7c Fix [9921778646]: something is wrong in core-8-branch 2023-06-01 20:58:00 +00:00
dkf b1ee2de573 Added some examples to library(n) 2023-06-01 14:37:44 +00:00
jan.nijtmans 5d5b5a4242 merge-mark 2023-05-31 14:13:19 +00:00
jan.nijtmans c8ff4cae81 Use TclDuplicatePureObj() in stead of TclListObjCopy() where appropriate. Backported from 9.0 2023-05-31 14:12:12 +00:00
jan.nijtmans 6104a20928 Merge 8.7 2023-05-31 07:49:17 +00:00
jan.nijtmans b87d0095dc Document hoe Tcl_ReadChars() behaves in "-profile strict" mode when an encoding error happens. 2023-05-31 07:45:52 +00:00
jan.nijtmans 4632c037e3 Merge 8.7 2023-05-31 07:20:18 +00:00
jan.nijtmans 28c9edc49b Fix [c243e7a85e]: TIP #603 implementation broken on Windows 2023-05-31 07:16:04 +00:00
jan.nijtmans 614c8b3360 Let's see if this helps 2023-05-30 21:31:11 +00:00
dkf a4f289d5b5 More typo fixes 2023-05-30 13:57:09 +00:00
jan.nijtmans 75bdb75689 Merge 8.7 2023-05-30 12:22:20 +00:00
jan.nijtmans 13f6f72bb7 Backport IO-related changes from Tcl 9.0. Needed for preparation of TIP #653 2023-05-30 11:25:13 +00:00
jan.nijtmans af838a5d52 Merge 8.7 2023-05-29 19:41:08 +00:00
jan.nijtmans 8091425c93 int -> Tcl_Size, for full Tcl 9 support 2023-05-29 16:27:28 +00:00
dkf 4c03aeaadd Fix typo and outdated comment 2023-05-29 10:49:45 +00:00
fvogel 69ae2a0f03 merge 8.7 2023-05-28 10:39:40 +00:00
fvogel 7988b3f1b6 Fix errors when building the html man page for configurable.n (TIP #558) 2023-05-28 10:38:13 +00:00
fvogel 827a1d3802 Fix errors when building the html man page for configurable.n 2023-05-28 10:37:31 +00:00
jan.nijtmans 0657f97bc5 Eliminate some clang warnings. Only use "testbigdata" if sizeof(Tcl_Size) == sizeof(Tcl_WideInt) 2023-05-25 15:10:55 +00:00
dkf 6598d2eeae TIP 603: Get 'stat' Information of Open Files 2023-05-24 16:04:46 +00:00
dkf 29225e440c merge core-8-branch 2023-05-24 16:02:24 +00:00
jan.nijtmans 231fd112f9 Merge 8.7 2023-05-24 15:29:11 +00:00
jan.nijtmans 70a3d08fc4 Fix regular expression in previous commit 2023-05-24 15:22:00 +00:00
jan.nijtmans c7771a763e Enhance html generation, so it can handle the "©" copy-sign as well 2023-05-24 15:18:05 +00:00
jan.nijtmans 6c1bdd15d6 More size protection for winDde 2023-05-24 15:16:14 +00:00
jan.nijtmans 9a6a7030e8 Remove TCL_SIZE_SMAX, not used anywhere. Some more variable which should have been Tcl_Size 2023-05-24 10:31:56 +00:00
jan.nijtmans 633171eda9 Merge 8.7 2023-05-23 16:15:10 +00:00
jan.nijtmans 2acd355f8d Give Tcl_CreateThread a TCL_HASH_TYPE (unsigned) stackSize parameter 2023-05-23 16:03:29 +00:00
pointsman 73ff912a1f Proposed fix for [af3ebc5fafe0]. 2023-05-22 12:17:44 +00:00
jan.nijtmans b9722ec356 Merge 8.7 2023-05-22 10:13:42 +00:00
dkf f3f254e8ba Small documentation corrections 2023-05-22 07:48:43 +00:00
jan.nijtmans f1e62884ba Merge 8.7 2023-05-21 23:00:20 +00:00
jan.nijtmans e18d096bd7 Unbreak windows symbols build. More int -> Tcl_Size backported from 9.0 2023-05-21 21:19:22 +00:00
griffin 54a1d7e517 Fix test to be stable. 2023-05-21 20:42:14 +00:00
griffin c6cce703b5 Add cleanup to lseq tests. Fix assertion. 2023-05-20 23:24:54 +00:00
pooryorick 51f0bfd5ae Merge "unchained branch [a03cbbdf63] and resolve conflicts. 2023-05-20 20:11:18 +00:00
apnadkarni f19e2665d3 Fix [c9663296fd]. Also refactor memory reallocation. 2023-05-20 16:39:50 +00:00
pooryorick a7c911213a Merge trunk [b60a8ec69f]. 2023-05-20 16:02:09 +00:00
apnadkarni 96d441c29a Minor refactor to combine alloc/realloc 2023-05-20 15:40:17 +00:00
pooryorick 41da2b1489 Merge "unchained" branch [6b0efb4663] and resolve conflicts. 2023-05-20 14:10:31 +00:00
jan.nijtmans 72dfeb60e2 merge-mark 2023-05-20 10:34:14 +00:00
jan.nijtmans b27acbe84f More int/Tcl_Size backport 2023-05-20 10:07:19 +00:00
apnadkarni 1b8701ee3d Merge trunk 2023-05-19 23:07:13 +00:00
apnadkarni 83d22bd1f6 Fix int/Tcl_Size pointer errors 2023-05-19 22:18:51 +00:00
apnadkarni 861c6c226a Fix build - ckalloc/ckfree not in Tcl 9 2023-05-19 21:31:18 +00:00
jan.nijtmans b0bd6fc251 Merge 8.7 2023-05-19 19:50:31 +00:00
jan.nijtmans 6643ceb141 int -> Tcl_Size and other (internal) signature improvements. Most of them backported from 9.0 2023-05-19 19:47:18 +00:00
apnadkarni 16a75f3cbf More refactoring into common code 2023-05-19 16:47:58 +00:00
dkf ed8816500e Improve the synopsis of the transchan manpage so it helps users a bit 2023-05-19 14:15:18 +00:00
dkf 5ef48eba53 Improve the synopsis of the refchan manpage so it helps users a bit 2023-05-19 13:35:19 +00:00
dkf ee48919fcc Merge 8.7 2023-05-19 12:56:28 +00:00
pooryorick b359029baa Merge trunk [c405bdd1f0]. 2023-05-19 12:08:53 +00:00
dkf d6a3425ec6 TIP 558: Basic Configure Support for TclOO 2023-05-19 12:06:05 +00:00
dkf b0f19e41f2 merge core-8-branch 2023-05-19 12:02:49 +00:00
pooryorick c447bf4370 Merge trunk [402ff62239]. 2023-05-19 12:02:13 +00:00
pooryorick 68328fdcd5 Merge "unchained" branch commit [05b72c0b3f] and resolve conflicts. 2023-05-19 11:26:08 +00:00
pooryorick 00dd4a5b56 Improve TclDuplicatePureObj(), remove unnecessary increment/decrement pairs, and add more error checking. 2023-05-17 12:44:46 +00:00
pooryorick ac555b905c New functions: TclUndoRefCount() and TclDictGetSize(). 2023-05-17 12:26:11 +00:00
pooryorick 5990382222 Fix for [5ee01098824881b5], lseq list conversion results in attempt to access
freed memory.
2023-05-17 12:09:27 +00:00
jan.nijtmans c7e670b85f Merge 8.7 2023-05-17 07:33:33 +00:00
jan.nijtmans 86e88cf233 Remove dead code 2023-05-17 07:30:54 +00:00
jan.nijtmans e47cbdc798 Merge 8.6 2023-05-16 16:31:53 +00:00
jan.nijtmans a5297cf7c3 Some more nmakehlp.c tweaks 2023-05-16 16:30:07 +00:00
jan.nijtmans 32ffe00c48 Merge 8.6 2023-05-16 10:26:48 +00:00
jan.nijtmans 8f8a3bc1c0 Only use _snprintf on older MSVC compilers. ZeroMemory -> memset 2023-05-16 10:19:41 +00:00
pooryorick a038d4aad3 Fix memory leaks and remove unnecessary reference count bounce. 2023-05-16 09:33:12 +00:00
jan.nijtmans 17c92b0a7a Merge 8.7 2023-05-16 06:25:19 +00:00
jan.nijtmans 4eb91b8e5b Remove some more references to removed ChangeLog 2023-05-16 06:07:51 +00:00
jan.nijtmans ebcc04616c More int -> Tcl_Size (in tclInt.h) 2023-05-16 06:05:22 +00:00
pooryorick 50dde26caf New function, TclDuplicatePureObj(), doesn't duplicate the string
representation when duplicating an object, unless necessary.  Remove
TclListObjCopy() in favor of TclDuplicatePureObj(), allowing internal
representation to change after the copy rather than before.
2023-05-16 05:25:31 +00:00
apnadkarni 6fa73194d5 Refactor couple more reallocations 2023-05-15 23:08:17 +00:00
pooryorick 49c4458a25 Add Tcl_DecrRefCount() missing from [4b1a20629e]. 2023-05-15 20:49:43 +00:00
apnadkarni 02563b1911 Refactor allocation in Tcl_DStringAppendElement 2023-05-15 20:23:05 +00:00
dgp 54e89ec231 merge 8.7 2023-05-15 17:37:21 +00:00
dgp 8074bcec5e TIP 663 implementation 2023-05-15 17:17:43 +00:00
jan.nijtmans 4db805463e Backport test improvements from 9.0 2023-05-15 15:45:57 +00:00
jan.nijtmans 45dd8baf76 No need to init string rep, if we throw away the object immediately 2023-05-15 15:44:34 +00:00
jan.nijtmans f6f92fd671 Merge 8.7 2023-05-15 11:52:39 +00:00
jan.nijtmans f2f41b4b85 Merge 8.6 2023-05-15 11:45:42 +00:00
jan.nijtmans db43c8cbed One more ckalloc -> attemptckalloc (in compat/waitpid.c), since we can handle the error. 2023-05-15 11:43:15 +00:00
jan.nijtmans 062f4d0529 ckalloc -> attemptckalloc (since return-value is checked). Fix bug in unix/dltest/pkgooa.c, where last NULL-argument was missing 2023-05-15 11:15:28 +00:00
pooryorick 48d6b3d84c Rename TclRelaxRefCount() to TclUndoRefCount(). 2023-05-14 08:21:50 +00:00
pooryorick aafa141509 Add TclRelaxRefCount, and also try to take the fast path more often in byte-compiled [lindex]. 2023-05-13 10:59:32 +00:00
pooryorick d6ed36f134 In tclExecute.c call DECACHE_STACK_INFO() before calling TclLindexList(). 2023-05-12 23:20:26 +00:00
jan.nijtmans 14d2bc5415 Merge 8.7 2023-05-12 08:57:00 +00:00
jan.nijtmans 36cebb89fe Use 'attempt'-functions for libtommath, when built into Tcl 2023-05-11 22:20:17 +00:00
pooryorick c8c0db5f21 Merge trunk [05eeae5d67] and resolve conflicts. 2023-05-11 21:47:17 +00:00
pooryorick c29132ab84 ptrdiff_t to Tcl_Size in tclListObj.c 2023-05-11 20:59:18 +00:00
pooryorick edbf195dff Add TclRelaxRefCount and TclObjGetScalar, and use them to try to take the fast path more often in byte-compiled [lindex].
See: [https://github.com/tcltk/tcl/actions/runs/4956385513] for build failure
2023-05-11 20:25:49 +00:00
pooryorick 4fa1fa29ae Fix failing valgrind suppression for load.test 2023-05-11 17:17:18 +00:00
pooryorick 6fbc88e2a0 Silence valgrind "still reachable" report in cmdAH.test 2023-05-11 17:07:39 +00:00
jan.nijtmans 87ff0e4ee2 put back pragma voor MSVC warning, accidently removed in previous commit 2023-05-11 15:39:30 +00:00
jan.nijtmans 847fdd28f7 Restore warning-free compilation with C++ compiler 2023-05-11 15:30:18 +00:00
pooryorick 01e71bb26c Fix Valgind report of still reachable blocks in aaa_exit.test and other test
files.
2023-05-11 13:08:59 +00:00
jan.nijtmans ce00b07d6b disable on-purpose compiler warning (MSVC) for testcase 2023-05-11 06:31:49 +00:00
apnadkarni 363a6cc4cd Refactor allocation strategy in Tcl_DStringAppend 2023-05-10 21:32:16 +00:00
jan.nijtmans 180af1f9a5 Merge 8.7 2023-05-10 20:53:49 +00:00
jan.nijtmans c03808607b Backport various changes from 9.0 branch 2023-05-10 19:39:20 +00:00
dgp 6c604517d7 TIP 663 implementation 2023-05-10 18:28:30 +00:00
apnadkarni 6802927d5c Merge trunk 2023-05-10 17:25:47 +00:00
jan.nijtmans c0c0164a71 Merge 8.6 2023-05-10 12:28:06 +00:00
jan.nijtmans 284a501487 Backport: docs: function does not "return an error", it returns TCL_ERROR, indicating an error occured 2023-05-10 12:09:07 +00:00
bch 909827f9ee docs: function does not "return an error", it returns TCL_ERROR, indicating an error occured 2023-05-09 22:36:38 +00:00
jan.nijtmans 293c1ff559 Left-over TCL_ENCODING_STRICT, not used any more.
Add "-profile tcl8" for testcases which don't work in strict profile
2023-05-09 16:11:58 +00:00
jan.nijtmans e95d2eea7f Merge 8.7 2023-05-09 13:16:25 +00:00
jan.nijtmans 2e02e1affd Remove useless type-casts. Backport some changes from 9.0 2023-05-09 13:06:02 +00:00
jan.nijtmans 77b454d1b2 size_t -> Tcl_Size (twice) 2023-05-09 09:51:47 +00:00
jan.nijtmans 8f15f09491 Fix [96551aca55]: Avoid pointer arithmetic with NULL in FOREACH_STRUCT(). Some typo's 2023-05-08 14:19:04 +00:00
pooryorick 8d076e6525 Make TclLindexFlat() a litle more straightforward. 2023-05-08 14:08:44 +00:00
jan.nijtmans 133b43a521 Better version, keeping the (undocumented) behavior of 'i' initialization 2023-05-08 13:43:56 +00:00
pooryorick af5bfc68cc Use Tcl_Size instead of size_t in two places in TclIndexEncode. 2023-05-08 11:35:45 +00:00
jan.nijtmans 0d8a08dbf1 Proposed fix for [96551aca55]: Avoid pointer arithmetic with NULL in FOREACH_STRUCT() 2023-05-08 09:35:57 +00:00
jan.nijtmans 1a4e52416f Merge 8.7. Restore Tcl_DStringSetLength() behavior, as suggested in [3837178c25] 2023-05-07 20:34:18 +00:00
jan.nijtmans 4dcdd51adb Merge 8.7 2023-05-07 20:10:58 +00:00
jan.nijtmans 73dbbaaa23 New testcase, contributed by @chrstphrchvz. Many thanks! See [3837178c25] 2023-05-07 20:06:50 +00:00
jan.nijtmans d162c9a16d Merge 8.7 2023-05-05 21:22:29 +00:00
jan.nijtmans ce9f04ddd1 Merge 8.6 2023-05-05 21:16:27 +00:00
jan.nijtmans 8f269fcad1 Update .github files 2023-05-05 21:07:47 +00:00
jan.nijtmans 67b780c161 Remove .github and .travis-related stuff: No need to build this branch any more 2023-05-05 20:55:31 +00:00
pooryorick f4cd60dbb4 A few corrections in comments. 2023-05-05 14:57:38 +00:00
apnadkarni d0ba759e2c Merge trunk 2023-05-05 12:36:45 +00:00
apnadkarni 3f84674ae3 Merge 8.7 - list performance tests 2023-05-05 12:35:21 +00:00
apnadkarni 4e92d998eb Minor fixes for perf tests 2023-05-05 12:34:18 +00:00
pooryorick 3e05a7babe Remove TclArithSeriesObjCopy() and use Tcl_DuplicateObj() instead. 2023-05-05 09:40:38 +00:00
apnadkarni 5940356ced Change reallocation growth to 1.5. 2023-05-05 09:17:17 +00:00
pooryorick cc71607cb8 Make some tests select an encoding profile instead of relying on the default. 2023-05-04 20:26:19 +00:00
dgp 405a099384 merge 8.7 2023-05-04 18:22:37 +00:00
dgp 1ea2b16a8d merge 8.6 2023-05-04 18:21:49 +00:00
dgp f976a32c62 Remove mention of Tcl_GlobalEval() from comment. 2023-05-04 18:21:01 +00:00
apnadkarni 92dd14e77c Refactor reallocation in preparation for experimentation with different growth factors 2023-05-04 17:52:06 +00:00
jan.nijtmans 3f2bb8a029 Merge 8.7 2023-05-04 13:06:15 +00:00
jan.nijtmans e51f7da2ee Backport: Do not build every branch. Too expensive. 2023-05-04 12:58:41 +00:00
jan.nijtmans af320fb41e Fix [9c397da4a9]: AppendPrintfToObjVA(): support 64-bit pointers 2023-05-04 12:53:45 +00:00
dkf e2f55284cf Do not build every branch. Too expensive. 2023-05-04 08:24:01 +00:00
apnadkarni 8a45e47c4c Merge trunk 2023-05-04 05:12:11 +00:00
apnadkarni 4dd7110019 Better fallback on list reallocation failure 2023-05-04 04:48:31 +00:00
pooryorick 6da79937df remove "forceUniChar" from TclStringCat() since it isn't used anymore. 2023-05-03 16:26:27 +00:00
jan.nijtmans 881b147ab5 Merge 8.7 2023-05-03 15:59:09 +00:00
jan.nijtmans b583ea7360 Backport "Comments only. Fix blatantly obsolete ones". And a few more improvements from the same files. 2023-05-03 15:51:10 +00:00
pointsman d40bb9d13a Removed the bug specific test constraint from the tests related to [0306a5563c] because the bug is fixed. 2023-05-03 15:18:17 +00:00
apnadkarni 688c125ec3 Fix bug-c9663296fd (in progress) 2023-05-03 13:18:05 +00:00
pooryorick 66c0809095 Merge [842b3b3949]. 2023-05-03 11:31:30 +00:00
apnadkarni 06cc962945 Comments only. Fix blatantly obsolete ones 2023-05-03 10:01:50 +00:00
pooryorick 88760a8a81 Use Tcl_Size instead of ptrdiff_t in Tcl_ObjCmdProc2(), Tcl_CmdObjTraceProc2, and Tcl_MethodCallProc2(). 2023-05-03 09:31:08 +00:00
apnadkarni aa4247d47b Merge mark 8.7 2023-05-03 04:06:28 +00:00
apnadkarni 81b4fa2fbd Changed CHANNEL_PROFILE_* to ENCODING_PROFILE_* and moved out of tclIO.h. See below.
For whatever reason, these macros were renamed and moved to tclIO.h post-660. This is
inappropriate as those macros deal with *encoding* flags, not *channel* flags and have
relevance outside of I/O making their renaming inappropriate. Further putting them in tclIO.h
forces inclusion of that header in modules that do not otherwise need that header.
2023-05-03 04:03:36 +00:00
apnadkarni 7b688527d7 Changed CHANNEL_PROFILE_* to ENCODING_PROFILE_* and moved out of tclIO.h. See below.
For whatever reason, these macros were renamed and moved to tclIO.h post-660.
This is inappropriate as those macros deal with *encoding* flags, not *channel*
flags and have relevance outside of I/O making their renaming inappropriate. Further
putting them in tclIO.h forces inclusion of that header in modules that do not
otherwise need that header.
2023-05-03 03:31:49 +00:00
pointsman 41aa17e389 Fix for [0306a5563c]. 2023-05-02 22:11:28 +00:00
pointsman 84d939b69a Fix for [0306a5563c]. 2023-05-02 21:50:48 +00:00
pooryorick 5f690c8fae Fix issue [b3628609ad73a105], by allowing TclStringCat to assume that each Tcl_Obj.bytes value is complete, i.e. concatenating such values does not change the interpretatin of any byte in any of the concatenated values. 2023-05-02 19:58:06 +00:00
pooryorick c811b1d642 Merge trunk [480bcbe193]. 2023-05-02 19:51:21 +00:00
pooryorick 50c851a04b Remove "deprecated" constraint in test suite. 2023-05-02 19:42:25 +00:00
apnadkarni 60ba166da0 Merge 8.7 fix [784befb0ba] - tailcall crash 2023-05-02 17:06:38 +00:00
apnadkarni 2dccd2a567 Merge 8.6 - [ab123cfd3d] and [784befb0ba] 2023-05-02 16:48:57 +00:00
apnadkarni df75b91956 Fix [ab123cfd3d] - scan ubsan. Tx chrstphrchvz for patch 2023-05-02 16:33:39 +00:00
apnadkarni 43b5729ddf Fix [784befb0ba] - tailcall crash 2023-05-02 16:08:30 +00:00
pooryorick e1051201ce Merge trunk [6964e7e16a]. 2023-05-02 15:51:01 +00:00
pooryorick 410ffcdefa Fix issue [b3628609ad73a105], by allowing TclStringCat to assume that each
Tcl_Obj.bytes value is complete, i.e. concatenating such values does not change
the interpretatin of any byte in any of the concatenated values.
2023-05-02 12:47:10 +00:00
apnadkarni 1f5d09b497 Fix LISTREP_ASSERT 2023-05-02 11:50:03 +00:00
apnadkarni eb23b011d0 Merge trunk 2023-05-02 11:28:55 +00:00
apnadkarni 03d0f99e6c Fix [bb69c8d17e] compiled string last 2023-05-02 08:42:21 +00:00
apnadkarni 694c4505cd Change realloc strategy on fail, optimize for empty string 2023-05-02 05:38:04 +00:00
jan.nijtmans 28e5ec7db6 Add missing "deprecated" constraint 2023-05-01 15:50:02 +00:00
dkf fea912c676 Remove IDE guff 2023-05-01 15:08:08 +00:00
dkf 7555420166 Add doc comments, fix a typo in a manpage 2023-05-01 14:07:59 +00:00
dkf 10c71dc8b9 Use modern copyright symbol, in line with rest of code 2023-05-01 13:31:30 +00:00
dkf 530e4b3bb9 Merge 8.7 2023-05-01 13:22:24 +00:00
apnadkarni b6bc736eee Tests for [dcac54a685] 2023-05-01 12:39:43 +00:00
apnadkarni fe84f70800 Tests for [ad9361fd20] 2023-05-01 12:16:44 +00:00
apnadkarni c77055a803 Fix [d07f42998d] - argument list truncation 2023-05-01 11:41:48 +00:00
apnadkarni 3b426fffa1 Fix [ab123cfd3d] - ubsan warning in ValidateFormat 2023-05-01 10:38:12 +00:00
pooryorick 09dd330c44 Merge trunk [95cb1987c8]. 2023-05-01 09:46:41 +00:00
apnadkarni 782009ca67 Fix [ab123cfd3d] - ubsan scan warning. 2023-05-01 06:51:51 +00:00
apnadkarni e1f2905dbc Added missing bigdata constraint 2023-05-01 06:41:25 +00:00
pooryorick 3458214e46 Delete related to TCL_BUILD_FOR and all code related to it. 2023-04-30 19:30:36 +00:00
jan.nijtmans dd6950d635 Merge 8.7 2023-04-30 19:21:50 +00:00
jan.nijtmans c3cb435cf4 Fix OPTS=utf16 build for Tcl 9.0 2023-04-30 19:03:12 +00:00
pooryorick 0987bb4b63 Remove all code that is conditioned on TCL_MAJOR_VERSION. 2023-04-30 18:36:31 +00:00
jan.nijtmans 6c4b78cfa8 Eliminate ListSizeT_MAX, since it's the same as TCL_SIZE_MAX 2023-04-30 17:32:25 +00:00
jan.nijtmans 75eea66ef7 Add testcase for TclGetBytesFromObj() 2023-04-30 12:32:20 +00:00
jan.nijtmans 251211e714 Don't test compatibility macro's when TCL_NO_DEPRECATED is defined: this is expected to fail 2023-04-30 12:02:38 +00:00
apnadkarni e313582726 Fix [27b3ce2997] - check INT_MAX limit on script length 2023-04-30 10:20:19 +00:00
apnadkarni a06189323f Fix one more error message for max arg limit 2023-04-30 09:54:16 +00:00
apnadkarni 93f06f4469 Working on [d07f42998d] 2023-04-30 08:08:24 +00:00
apnadkarni 6c973cf9a2 Add tests. Panic on bytecode length limit 2023-04-29 16:16:58 +00:00
jan.nijtmans e393e2694c Add experimental testcase for TclGetBytesFromObj() 2023-04-29 16:10:56 +00:00
jan.nijtmans 1645895629 Eliminate ListSizeT_MAX, since it's the same as TCL_SIZE_MAX 2023-04-29 15:20:12 +00:00
jan.nijtmans ef51b5aacd Resolve a TODO 2023-04-29 14:56:13 +00:00
jan.nijtmans 905633199c Merge 8.7 2023-04-29 14:50:50 +00:00
pointsman 4d289b8084 Updated from trunk. Simplified bug specific tests. 2023-04-29 14:11:36 +00:00
apnadkarni 85a2a91729 Fix [7cddd2845c] - crash with >= INT_MAX operands 2023-04-29 03:15:11 +00:00
apnadkarni 947e3f8405 Limit scripts to INT_MAX-1 bytes 2023-04-29 02:11:48 +00:00
pooryorick 64a0be31b9 Remove all code related to TCL_NO_DEPRECATED, and some related to TCL_MAJOR_VERSION. 2023-04-28 23:57:14 +00:00
pooryorick 2098e71e79 Remove TclUtfToUCS4(), TclUniCharToUCS4(), and TclUCS4Prev(). 2023-04-28 19:19:30 +00:00
pooryorick 4a24561f0b Remove all code related to TCL_UTF_MAX=3. 2023-04-28 17:34:24 +00:00
jan.nijtmans ad7deae634 Remove some (void *) typecasts, which are no longer necessary 2023-04-28 15:02:09 +00:00
pooryorick df1dd156ed Merge trunk. 2023-04-28 12:20:52 +00:00
pooryorick 1a819d1063 Merge trunk. 2023-04-28 09:03:14 +00:00
pooryorick a6d654980e Limit memset() to "TCL_UTF_MAX=3' builds. 2023-04-28 06:43:49 +00:00
pooryorick 2fae9f1746 Add bytearray checking to TclCheckEmptyString(), and then use
TclCheckEmptyString() in Tcl_AppendObjToObj and TclStringCat() to reduce string
generation.
2023-04-27 20:54:21 +00:00
pooryorick 5eb2064b63 Fix for [f5eadcbf9a6b1b4c], passing pointer to uninitialized memory leads
Tcl_UniCharToUtf() to corrupt data.
2023-04-27 20:42:04 +00:00
pooryorick 7f433932f6 memset(0xff) instead of memset(0) to accomodate tests that fill buffer with
0xff.
2023-04-27 20:34:22 +00:00
jan.nijtmans 2e9301202d More size_t -> Tcl_Size, missed by earlier updates 2023-04-27 14:01:37 +00:00
jan.nijtmans 8bfaaa8337 Simplify Tcl 9 compatibility macro's. No change in functionality. 2023-04-27 13:52:42 +00:00
apnadkarni 175931c905 Merge trunk 2023-04-27 13:34:55 +00:00
apnadkarni 18f61eeeeb More checks for exceeding max words 2023-04-27 12:47:08 +00:00
jan.nijtmans 54b8f46097 RingSizeT -> Tcl_Size 2023-04-26 20:24:01 +00:00
jan.nijtmans 372bf74334 Reduce number of needed type-casts. No change in functionality 2023-04-26 19:29:44 +00:00
griffin f9f1724b36 Fix index descrepencies (bug-fa00fbbbabe).
Fix inconsistent rounding (bug-e5f06285de).
2023-04-26 16:18:04 +00:00
jan.nijtmans cd51753d86 More size_t -> Tcl_Size changes, which were missed before. Also (experimental) make the wrapper macro's produce compiler warnings is Tcl_Size is not used. 2023-04-26 15:53:40 +00:00
apnadkarni f227a5d1ff Test fix for [0f98bce669] 2023-04-26 15:45:12 +00:00
apnadkarni 5ddcd8fea9 Fix for [7cddd2845c] (in progress) 2023-04-26 14:56:21 +00:00
jan.nijtmans fe4e51b427 Merge 8.7 2023-04-26 06:51:52 +00:00
jan.nijtmans bd259695f1 Merge 8.6 2023-04-26 06:49:22 +00:00
jan.nijtmans e5eeaadf3c Don't refer to CVS any more 2023-04-26 06:40:14 +00:00
griffin 3aaf8c0544 merge trunk, address some 32-bit issues. 2023-04-26 03:41:57 +00:00
pooryorick 76130df460 Fix for issue [f5eadcbf9a], passing pointer to uninitialized memory leads
Tcl_UniCharToUtf() to corrupt data.
2023-04-25 20:34:03 +00:00
griffin da6df4adde Add fix inconsistent rounding (bug-e5f06285de).
Compute and use the "precision" for sequences of doubles: determine the number of significant digits in the fractional part of the given arguments, and round the results to that limit.
Fix copy bug in DupArithSeriesInternalRep.
2023-04-25 00:36:30 +00:00
pointsman 1ddccee9d3 Added a test for the initial problem and another for the known remaining problem. 2023-04-24 20:21:42 +00:00
pointsman 48570b93a6 Merge trunk. 2023-04-24 20:09:40 +00:00
apnadkarni 025b74f7c7 Fix [2e3fed53ba] - binary encode uuencode 2023-04-24 17:46:14 +00:00
apnadkarni 51043c29db Fix [c719fa8716] - binary encode base64 assertion failure 2023-04-24 17:16:58 +00:00
apnadkarni 553caf0d2c Fix [9369f83649] - binary format/scan for big data 2023-04-24 16:49:34 +00:00
apnadkarni 87e417c1a1 Fix [a814ee5bbd] - string compare/equal -length for long strings 2023-04-24 16:28:21 +00:00
dgp e95eb57666 Adapt signature of TclCompileScript() to fit better after TIP 660. 2023-04-24 15:51:00 +00:00
apnadkarni 3a9a817f67 Fix [d4ede611a7] - scan bigdata 2023-04-24 14:51:20 +00:00
dgp 277effbc04 TIP 422 eliminated va_list arguments from the API of Tcl 9.
However, some of the documentation lingered on.  No more.
2023-04-24 14:22:07 +00:00
apnadkarni 9f102b5b85 Minor change to length limit checks 2023-04-24 13:54:33 +00:00
apnadkarni 642792b1c2 Fix [a550f9710b] (format bigdata) 2023-04-24 12:55:35 +00:00
apnadkarni ef5af05366 Fix for bug [d4ede611a7] (scan) 2023-04-24 10:02:23 +00:00
pointsman 439a4360b3 Fixes the examples given in [0306a5563c]. Still more to do for a full fix. 2023-04-24 09:41:04 +00:00
pooryorick 6ee4d2b394 Merge trunk. 2023-04-24 00:08:18 +00:00
pooryorick 321bff2cd5 Add bytearray checking to TclCheckEmptyString(), and then use
TclCheckEmptyString() in Tcl_AppendObjToObj and TclStringCat() to reduce string
generation.
2023-04-23 23:57:17 +00:00
jan.nijtmans d252076f75 Missing !defined(TCL_NO_DEPRECATED) around TIP #616 macro's. Thanks Rolf for noticing! 2023-04-23 21:59:34 +00:00
pooryorick 26c9f5e773 merge trunk [f867f44c9c]. 2023-04-23 11:48:15 +00:00
pooryorick 466e7c47c6 Set the encoding profile to strict in Tcl_FSEvalFileEx(). This is independent
of TIP 657:  A script to be evaluated must be properly encoded in any case.
2023-04-23 11:39:10 +00:00
pooryorick eb3390224b Add bytearray checking to TclCheckEmptyString(), and then use
TclCheckEmptyString() in Tcl_AppendObjToObj and TclStringCat() to reduce string
generation.

jn: See discussion on mailing list "On the changing the sourcing of scripts to using strict profiles by default" for explanation why this commit is wrong, just as [e6fe76ae6b] and [4a7b807856] (which are similar commits, disguised as different ones).
2023-04-23 11:28:19 +00:00
jan.nijtmans adab48a862 Support combination TCL_UTF_MAX=3 with TCL_NO_DEPRECATED=1 2023-04-23 10:41:40 +00:00
jan.nijtmans 11048e958a Remove TCL_8_COMPAT. No longer necessesary, because of TIP #660 2023-04-23 10:31:18 +00:00
jan.nijtmans f87dbfe42e Backout [3016169b6f], since TIP #657 (Make "-profile strict" the default in Tcl 9.0) is not accepted yet. And when it's accepted, this change won't be necessary any more. 2023-04-23 08:56:48 +00:00
jan.nijtmans dd36d764b7 Backout [e6fe76ae6b]. See build failure with -DTCL_UTF_MAX=3 [https://github.com/tcltk/tcl/actions/runs/4777092335/jobs/8492557766] 2023-04-23 08:53:23 +00:00
apnadkarni 2b41b2d12b Fix gcc type mismatch warnings exposed by disabling casts using disabletcl8api 2023-04-23 08:13:11 +00:00
apnadkarni 6f566fc406 Merge trunk 2023-04-23 07:24:49 +00:00
apnadkarni 9cd23041f3 Merge 8.7 - [d90fee06d0] (lassign) and [203792a48c] (Utf32ToUtf) 2023-04-23 05:23:01 +00:00
apnadkarni 00afea1c26 Bug [d90fee06d0] - lassign performance 2023-04-23 04:18:20 +00:00
apnadkarni f5125db22b Bug [d4ede611a7] (scan) - in progress 2023-04-23 03:25:33 +00:00
pooryorick 08d2d4c09b Make Tcl_AppendObjToObj avoid string generation in a couple more circumstances,
and edit some documentation and comments.
2023-04-22 22:49:50 +00:00
jan.nijtmans f14ee8d1bb Fix [203792a48c]: Avoid signed integer overflow in Utf32ToUtfProc() 2023-04-22 17:55:36 +00:00
jan.nijtmans d425f04462 Merge 8.7 2023-04-22 17:34:11 +00:00
jan.nijtmans c90b84b116 Fill in URL in previous commit 2023-04-22 17:32:52 +00:00
jan.nijtmans 8da10bea0f Register "utf32string" for Python 2023-04-22 17:31:50 +00:00
jan.nijtmans 9ec33349d5 Fix tclTomMath.h (from prev commit) 2023-04-22 17:29:49 +00:00
jan.nijtmans 556c3fc35b Fix [2a5cb49733ff]: Make TCL_NO_TOMMATH_H sufficient for tclTomMathDecls.h 2023-04-22 16:34:56 +00:00
jan.nijtmans 39180cad0e Backout [4a7b807856], It breaks the build. See: [https://github.com/tcltk/tcl/actions/runs/4771586851/jobs/8483606969] 2023-04-22 16:29:07 +00:00
apnadkarni 4402cae446 Use TclListObjRange in lassign for performance reasons 2023-04-22 10:04:53 +00:00
jan.nijtmans 79af33ce68 Merge 8.7 2023-04-21 20:39:19 +00:00
pooryorick a3380d8151 Make Tcl_AppendObjToObj more efficient and avoid unnecessarily generating a
string representation when the object to append to is the empty string.
2023-04-21 20:32:38 +00:00
jan.nijtmans b58023ffa1 Since Tcl_GetSizeIntFromObj is the same as Tcl_GetIntFromObj (in 8.7), it's not worth to spend a stub entry for it 2023-04-21 20:32:26 +00:00
jan.nijtmans e3e6c33969 Add testcases 2023-04-21 20:26:08 +00:00
jan.nijtmans 1fe7d754ed Reduce diff between 8.7 and 9.0. Add some testcases 2023-04-21 20:18:54 +00:00
apnadkarni d39298874a Fix gcc warning about format specifier in error message 2023-04-21 10:07:08 +00:00
pooryorick b794cb03e1 Set the encoding profile to strict in Tcl_FSEvalFileEx(). 2023-04-21 09:19:51 +00:00
apnadkarni c7f27e3c87 Fix warnings generated on disable8api builds 2023-04-21 06:16:53 +00:00
apnadkarni e86259d193 Create new branch named "apn-disabletcl8api-warnings" 2023-04-21 04:56:16 +00:00
griffin 6ca1315df1 merge trunk 2023-04-21 00:35:20 +00:00
griffin b807564e68 sync with trunk. Fix lseq size bugs. 2023-04-20 18:13:36 +00:00
apnadkarni c091b78af6 Bugs [4ce858a049] (lrepeat), [f4d15772f1] (foreach), [6926a21840] (lmap). 2023-04-20 16:44:49 +00:00
dgp e359627a36 TIP 660 changes to stop warnings in --enable-symbols=mem build. 2023-04-19 19:36:40 +00:00
pooryorick 37dceb3922 Merge trunk-encodingdefaultstrict [31278b27ed]. 2023-04-19 17:39:48 +00:00
pooryorick 0c2d0f0ab7 Merge trunk [08fc7dfb36]. 2023-04-19 17:05:58 +00:00
pooryorick 2fb58dc372 Merge trunk [c2d903f6ed]: apn-bigdata-tests. 2023-04-19 16:41:13 +00:00
apnadkarni f22a5b57f7 Fix [a4617c8e90] - lsearch index truncation 2023-04-19 15:49:13 +00:00
apnadkarni 883924f1e8 Minor doc corrections 2023-04-19 14:33:40 +00:00
apnadkarni 11b8f6eb00 Fix [3c04fcdd1a] - join truncates large lists 2023-04-19 13:21:56 +00:00
pooryorick 2c78daa2b0 Fossil merge [1842599320]: TIP 660 accepted. 2023-04-19 12:20:25 +00:00
pooryorick 02c0281379 Merge trunk [883464ea32]. 2023-04-19 12:15:51 +00:00
pooryorick e736d151a0 Merge trunk-encodingdefaultstrict [d325b41eb8] 2023-04-19 12:11:55 +00:00
pooryorick dcb3b835e4 Merge trunk [1ef347e31d]. 2023-04-19 11:28:22 +00:00
pooryorick e027188168 Merge trunk [5995ca9b6c]. 2023-04-19 11:19:06 +00:00
apnadkarni f6830a72ec Merge apn-bigdata-tests 2023-04-19 09:49:01 +00:00
apnadkarni ae3ae231d0 Merge trunk 2023-04-19 09:18:32 +00:00
pooryorick c4c090889c Merge trunk [f9c8bbde44]. 2023-04-19 07:43:57 +00:00
pooryorick 01570cabab Merge trunk [433637e689]. 2023-04-19 07:17:28 +00:00
apnadkarni d4dd40b364 Merge mark with 8.7 TIP 660 manpages 2023-04-19 05:50:25 +00:00
apnadkarni 4c6600039e Fix a few function signatures in manpages for TIP 660. 2023-04-19 05:49:37 +00:00
apnadkarni f3d3725e39 Merge mark with 8.7 TIP 660 changes 2023-04-19 05:21:45 +00:00
apnadkarni 21d90d4f4a TIP 660 accepted 2023-04-19 05:18:04 +00:00
apnadkarni 2f2003c490 Merge 8.7 2023-04-19 04:45:14 +00:00
apnadkarni b98b8f9181 Fix dltest on Unix 2023-04-19 04:20:19 +00:00
apnadkarni aab1aa08f0 Fix missing stddef.h include 2023-04-19 04:00:00 +00:00
apnadkarni e90011ea91 TIP 660 accepted. 2023-04-19 03:36:43 +00:00
apnadkarni f42b2cef2a Pick up lreplace.test and lseq.test from tip-660-with-trunk-testcases 2023-04-19 02:32:33 +00:00
apnadkarni ddefa6b172 Merge trunk 2023-04-19 02:00:26 +00:00
pooryorick 182b7f85f6 Merge trunk [67baae2829]. 2023-04-18 23:57:32 +00:00
pooryorick e1b3b51a8f Merge trunk [32d5cdd8d0]. 2023-04-18 23:25:24 +00:00
pooryorick 23dd40e1a2 Merge trunk [8dba618fe6]. 2023-04-18 23:24:14 +00:00
pooryorick 9af2fb9efe Merge trunk [f9a80c2c9e]. 2023-04-18 23:22:43 +00:00
pooryorick 1a7bbea40c Merge trunk [4fc1f701cc] and resolve conflicts. 2023-04-18 22:56:24 +00:00
pooryorick 9a3cd17eb7 In DoReadChars() reset CHANNEL_ENCODING_ERROR instead of CHANNEL_BLOCKED. 2023-04-18 22:35:58 +00:00
pooryorick df0ddd7b9b Fix for [25cdcb7e8fb381fb]: Incomplete utf-8 sequence followed by eofchar
results in failed assertion.
2023-04-18 22:00:10 +00:00
pooryorick fdaffbc402 Eliminate unnecessary clearance of CHANNEL_STICKY_EOF flag. 2023-04-18 21:16:24 +00:00
jan.nijtmans 5cb63f12bd Almost a merge-mark, just remove one (size_t) cast. 2023-04-18 19:43:37 +00:00
jan.nijtmans 49cfc0317e Adapt TIP's #494/#481/#537/#544/#568/#616/#623/#627/#630 to TIP #660 changes 2023-04-18 19:42:02 +00:00
apnadkarni d87bc3c2f0 Merge trunk 2023-04-18 16:47:40 +00:00
jan.nijtmans b30e837f58 Merge 8.7 2023-04-18 15:46:15 +00:00
pooryorick aec3f90f4d Merge trunk [0d197907c6]. 2023-04-18 15:32:02 +00:00
jan.nijtmans db8e59ed80 Add TCL_T_MODIFIER (from TIP #660). Some header-file clean-up. 2023-04-18 15:23:33 +00:00
pooryorick 198dbe0117 Merge trunk [e7fcdb7611]. 2023-04-18 13:24:40 +00:00
pooryorick 19eccf461d Merge trunk [cbaf88e90a]: Fix iocmd-12.11 testcase. 2023-04-18 13:16:54 +00:00
pooryorick ca96bc096f Merge trunk [a9fc905623] and resolve conflicts and test failures. 2023-04-18 13:05:39 +00:00
pooryorick 034957707a Merge trunk [79cd3ac351]. 2023-04-18 12:24:06 +00:00
pooryorick ce003df1ca Merge trunk [78beedf7e2] and resolve conflicts. 2023-04-18 12:12:41 +00:00
pooryorick 63e2ca9905 Merge trunk [c8983a2a94] and resolve conflicts. 2023-04-18 11:39:12 +00:00
pooryorick 870ad938f7 Correct CHANNEL_BLOCKED to CHANNEL_ENCODING_ERROR in Tcl_GetsObj(). 2023-04-18 10:47:46 +00:00
pooryorick 9512351bc5 Merge trunk [48829d9671]: Fix [d7fd37ebd9]: handling leftover prefix in table
encoding.
2023-04-18 10:29:28 +00:00
pooryorick ce353e21ed Merge trunk [1253dd0211]:` Fix http11 test hang caused by trailing brace in
previous commit.
2023-04-18 08:07:56 +00:00
pooryorick fb61224892 Merge trunk [20cad126cd]: Don't let httpd11 depend on the system encoding any
more: All text files are now stored in utf-8.
2023-04-18 08:02:49 +00:00
pooryorick f10942c112 Merge trunk [b10e2b66a9], Tcl TIP 656 manpages. 2023-04-18 07:43:31 +00:00
apnadkarni c37a94290c Fix io-75.1{4,5} on Windows. Ticket [a7a89d422a] 2023-04-18 05:18:52 +00:00
apnadkarni 60c1da90cc Merge trunk 2023-04-18 02:55:05 +00:00
pooryorick 6f003899fe Make encoding profile explicit in some tests. 2023-04-17 22:01:17 +00:00
pooryorick 62e806dc83 Merge trunk [49a4c8f8fb], "TIP 656 accepted", and resolve conflicts. 2023-04-17 21:33:41 +00:00
jan.nijtmans 75f7e5328a Plug memory leak caused by [46e7091a77b71ed7|this] commit 2023-04-17 20:03:38 +00:00
pooryorick 9831556bf7 Merge trunk [31788d9a4b] and resolve conflicts. 2023-04-17 13:30:36 +00:00
pooryorick e08e6f2733 Correct some test descriptions in encoding.test. 2023-04-17 12:12:42 +00:00
pooryorick 9586d2f54c Merge trunk [1997f71246]. 2023-04-17 11:31:50 +00:00
pooryorick 800f0a1edf Merge trunk [498ef65f88] and resolve conflicts. 2023-04-17 10:58:50 +00:00
pooryorick 87df69042c Fix for [eabcbd08274f2d22], [read] error persists on channel with strict
encoding after encoding is changed to binary.
2023-04-16 23:10:16 +00:00
griffin 2aed8b1bdf Fix bug-fa00fbbbabe - seq / lindex discrepancies
Replace macros with static inline functions.
Limit ArithSeries list size to LIST_MAX. This way, shimmering less likely to fail if it happens.
Speed up UpdateStringOfArithSeries.
Fixed issues around indexing into vary large lseq lists.
2023-04-16 18:36:18 +00:00
pooryorick 304ca9a172 Merge trunk [91094999d0], resolve conflicts, and make Tcl_UtfToExternalDString
strict regarding encoding errors.
2023-04-16 18:30:54 +00:00
jan.nijtmans 0ceb73f34c Merge 8.7 2023-04-16 18:08:08 +00:00
jan.nijtmans 61722ce13d Remove unneeded ENCODING_UTF flags 2023-04-16 18:07:22 +00:00
jan.nijtmans 249b57ef37 some spelling corrections 2023-04-16 17:58:44 +00:00
apnadkarni a9974c36d0 size_t -> ptrdiff_t to match Tcl 9 unsigned->signed change 2023-04-16 17:31:58 +00:00
pooryorick d7fdb20ed5 Merge trunk [f868c40053] and resolve conflicts. 2023-04-16 17:07:15 +00:00
apnadkarni e645e12652 Update manpages for TIP 660. Also one size_t -> Tcl_Size change in public API 2023-04-16 17:05:07 +00:00
pooryorick 6e4c20e3a6 Merge trunk [32c5b5172b]. 2023-04-16 16:58:43 +00:00
pooryorick 704627190d Merge trunk [69fba9fb6b]: Fix [4bea02e811]: encoding convertfrom -strict
ascii \x7f generates exception Many other encodings had the same problem, and
also the reverse happened: encodings which should throw an exception with
-strict but didn't (within range 0x80-0x9F).
2023-04-16 16:40:37 +00:00
pooryorick a8075a956d Merge trunk [355a5e4733] and resolve conflicts and test failures. 2023-04-16 16:23:26 +00:00
pooryorick 898f354492 Remove unneeded ENCODING_UTF flags. 2023-04-16 14:16:51 +00:00
pooryorick ab1a8089de Merge trunk [f64a19cf62] and resolve conflicts. 2023-04-16 14:05:13 +00:00
pooryorick 9c35850e30 Merge trunk [7b54fc6784]: Fix for [885c86a9a0]: convertfrom utf8 breaks for 4
byte utf encodings.
2023-04-16 13:48:59 +00:00
pooryorick 55bb2e9be3 Merge trunk [fc029613d5]. 2023-04-16 13:31:53 +00:00
pooryorick 0033456148 Merge trunk [e90924bb13]: test encoding-16.17. 2023-04-16 13:23:38 +00:00
pooryorick ce60562f86 Merge trunk [de933019a109d3d6]: Fix for [bd1a60eb9c]: convertfrom utf-8 strict
mode allows surrogates in input sequence.
2023-04-16 13:20:58 +00:00
pooryorick 4655526dd7 Fix mistake in test io-75.14 and make some spelling corrections. 2023-04-16 12:58:24 +00:00
apnadkarni cceb3ebdde Merge core-8-branch 2023-04-16 10:55:42 +00:00
pooryorick aad734db91 Merge trunk [2d036d968c] and resolve issues. 2023-04-16 08:29:10 +00:00
apnadkarni c899e77701 Merge trunk 2023-04-16 08:01:49 +00:00
apnadkarni ad32d6ed76 Merge trunk 2023-04-16 07:55:08 +00:00
apnadkarni 713ccc8bb6 Fix VC++ unused variable warning, lappend and join. 2023-04-16 05:44:19 +00:00
pooryorick c1ebc6273f Merge trunk [f118b6370b]. 2023-04-15 23:50:38 +00:00
pooryorick e08e3fbc09 Merge trunk [f9cdaa50ad]: First part of fix for [4a7397e0b3]. Not complete yet. 2023-04-15 22:52:02 +00:00
jan.nijtmans b37682866b Fix indenting 2023-04-15 22:11:48 +00:00
jan.nijtmans 9224a1a6c2 Fix SetResult doc 2023-04-15 19:50:28 +00:00
jan.nijtmans 8248b84e17 Merge 8.7 2023-04-15 19:13:01 +00:00
jan.nijtmans f64db5dae2 Merge 8.6 2023-04-15 19:11:35 +00:00
jan.nijtmans 52425dcf5d Add one more unused stub entry 2023-04-15 19:09:41 +00:00
jan.nijtmans 7882365428 Backout fix for [718de2132f487cf2]: It breaks on MacOS and other systems which don't support the --strip-unneeded option 2023-04-15 19:02:44 +00:00
pooryorick 7962f209ac Extend test io-75.15 to read invalid bytes in binary mode and then use [gets]
to retrieve last two lines.
2023-04-15 13:25:28 +00:00
pooryorick afacee3f07 Fix for [a7a89d422a4f5dd3], Under strict encoding, [gets] returns an error instead of returning the second line.
Also, ensure that position in file does not change if [gets] return an error.
2023-04-15 11:54:27 +00:00
apnadkarni e8326222de Add missing constraint to string-equal/compare test 2023-04-15 02:10:23 +00:00
jan.nijtmans b52ee10fc7 Merge 8.7 2023-04-14 21:42:54 +00:00
jan.nijtmans f82e6059dc int -> Tcl_Size where appropriate in tcl.decls (reducing the diff against Tcl 9.0) 2023-04-14 21:40:50 +00:00
apnadkarni aff6cc9141 Fixed bug-a498006438 2023-04-14 15:07:27 +00:00
apnadkarni 0db2f11f15 Merge trunk 2023-04-14 15:01:18 +00:00
pooryorick 810eabe0ef Fix for issue [718de2132f487cf2], "review use of strip on the stubs library". 2023-04-14 11:49:36 +00:00
pooryorick 3ecc8df3dc Fix for issue [718de2132f487cf2], "review use of strip on the stubs library". 2023-04-14 11:46:27 +00:00
pooryorick 0000e98387 Fix for issue [718de2132f487cf2], "review use of strip on the stubs library". 2023-04-14 11:40:11 +00:00
pooryorick c8259f4fec New test for [gets] with strict encoding. Also add "\" in io-76.9, missing in
last commit.
2023-04-14 09:19:32 +00:00
pooryorick d3bb4906d1 Fix for [0cd1ae596e709259], under strict encoding, [gets] returns an error even
though a complete line is available.
2023-04-14 07:21:48 +00:00
apnadkarni ec63738e5c Merge trunk 2023-04-14 03:24:42 +00:00
apnadkarni dcd5ea5b91 Finish up list tests. Add testbigdata dict command for generating dicts 2023-04-14 03:06:44 +00:00
apnadkarni d8c2bafa2c Few more bigdata tests 2023-04-13 18:05:00 +00:00
jan.nijtmans f7c3a98827 Re-generate unix/configure 2023-04-13 16:58:03 +00:00
jan.nijtmans ee84d52e39 Re-generate unix/configure 2023-04-13 16:56:57 +00:00
jan.nijtmans 50f141d888 re-generate unix/configure 2023-04-13 16:55:51 +00:00
pooryorick d5619e30fe Rewrite documentation file SetResult.3 2023-04-13 14:31:49 +00:00
jan.nijtmans 4307d0a739 Follow-up to previous commit: Let's not break TIP #627 either. Also adapt documentation (will be needed to be done anyway) 2023-04-13 14:02:23 +00:00
jan.nijtmans 12b3b1ee00 Allow Tcl build without the Tcl 8 compat API. Derived from "disabletcl8api" branch (thanks, Rolf), but using the already existing -DTCL_NO_DEPRECATED (in Makefile) or CHECKS=nodep (makefile.vc)
Since there are Github Action builds with -DTCL_NO_DEPRECATED/CHECKS=nodep, we cannot use the Tcl 8 compat API in the core code itself any more.
2023-04-13 13:13:13 +00:00
pooryorick e40a0e13a8 Clean up Tcl_SetObjResult(). 2023-04-13 10:20:21 +00:00
pooryorick a1021c091c Remove unnecessary reference count bump in Tcl_ReadObjCmd(). 2023-04-13 09:18:53 +00:00
pooryorick a6754db559 Remove last reference to -nocomplainencoding and fix some spelling errors. 2023-04-13 07:16:20 +00:00
pooryorick ae955d6d24 merge trunk [77c37636f0]: DoReadChars() and Tcl_SetObjLength(). 2023-04-13 06:52:16 +00:00
jan.nijtmans c3cfa1176e Merge 8.7 2023-04-13 06:18:24 +00:00
jan.nijtmans 023ceb178d cherry-pick from trunk: Remove one unnecesary call to Tcl_SetErrno() in DoReadChars(). 2023-04-13 06:16:05 +00:00
apnadkarni bce26daa76 Fix compilation on macos, test loading on mingw 2023-04-13 02:40:00 +00:00
pooryorick ca227dbb84 Remove one unnecesary call to Tcl_SetErrno() in DoReadChars(). 2023-04-13 00:12:08 +00:00
pooryorick 54ad113891 Correct the documentation of Tcl_SetObjLength. 2023-04-12 20:39:38 +00:00
pooryorick 7d767c4cb9 Remove unnecessary generation of string representation in DoReadChars. 2023-04-12 20:39:00 +00:00
jan.nijtmans f3ea1d46e1 merge-mark 2023-04-12 20:06:23 +00:00
jan.nijtmans 4518ee9a6d Cherry-pick: Rearrange code blocks in DoReadChars to do less work when returning early 2023-04-12 19:52:38 +00:00
pooryorick 786549398b Rearrange code blocks in DoReadChars to do less work when returning early. 2023-04-12 18:37:24 +00:00
jan.nijtmans ae5de56339 merge-mark 2023-04-12 18:19:37 +00:00
jan.nijtmans e4749b5f32 Some more int -> Tcl_Size (which is actually the same in 8.7). Backported from 9.0 2023-04-12 18:17:43 +00:00
apnadkarni b4542dd058 Test cases for more failures 2023-04-12 17:08:02 +00:00
pooryorick 756913ce13 Merge trunk [d65da06a77]: Correct spelling errors in comments and
documentation, but also a non-comment corections in history.tcl and
tcltest.test.
2023-04-12 14:44:08 +00:00
pooryorick 21fec5d3d1 Merge trunk [b921949acd]: More int -> Tcl_Size, so (theoretically) longer
lists could be handled. Thanks, Rolf!
2023-04-12 14:43:18 +00:00
pooryorick 72557b402d Merge trunk [9c60558723]: int -> Tcl_Size for tclWinDde.c/tclWinReg.c, so it
could (theoretically) handle larger lists in Tcl 9.
2023-04-12 14:42:10 +00:00
pooryorick a1d4fac3d8 Merge trunk [e825ea06803d4a61]: Editorial fix in Tcl_Panic() message. 2023-04-12 14:41:04 +00:00
pooryorick b77f43bb11 Correct spelling errors in comments and documentation, but also a non-comment corrections in history.tcl and tcltest.test. 2023-04-12 14:25:41 +00:00
jan.nijtmans 83677a47e7 merge-mark 2023-04-12 13:54:15 +00:00
jan.nijtmans 3d91df2489 More int -> Tcl_Size, so (theoretically) longer lists could be handled. Thanks, Rolf! 2023-04-12 13:51:33 +00:00
pooryorick 2456020044 Undo spelling corrections in compat/zlib. 2023-04-12 13:36:17 +00:00
pooryorick cf6c56c88d Correct spelling errors in comments and documentation, but also a non-comment
corrections in history.tcl and tcltest.test.
2023-04-12 13:30:39 +00:00
jan.nijtmans 55375d0dfe 2 more spelling fixes, but undo fixes in compat/zlib: Please report them upstream, otherwise they will re-appear here every time zlib is updated to a newer version. 2023-04-12 12:48:12 +00:00
pooryorick 3b742b785e Correct spelling errors in comments and documentation, but also non-comment
corrections in history.tcl and tcltest.test.
2023-04-12 09:35:08 +00:00
jan.nijtmans a0d8d381c1 Merge 8.7 2023-04-12 09:11:21 +00:00
jan.nijtmans b571892e4f int -> Tcl_Size for tclWinDde.c/tclWinReg.c, so it could (theoretically) handle larger lists in Tcl 9. 2023-04-12 09:10:26 +00:00
jan.nijtmans 9c0541d0e4 Fix [0b9200888e]: TIP #660 breaks TIP #628/#630 2023-04-12 08:58:03 +00:00
jan.nijtmans bee240eab0 Proposed fix for [0b9200888e]: TIP #660 breaks TIP #628/#630 2023-04-11 22:50:40 +00:00
pointsman 4d067d1cdf Merged disabletcl8api-win in. Which adds optional Tcl 9 API only to the windows build with native tools. And fixed the error with Tcl_GetIndexFromObjStruct(). Simplified the mess in tclDecl a bit. All problems with API calls of the core itself up to now hidden by the Tcl 8 compatibility macros are fixed. Thanks, apnadkarni. 2023-04-11 22:03:23 +00:00
apnadkarni 4acb728d29 Add tests for binary command. Add testlutil command for speeding up list tests. 2023-04-11 16:52:49 +00:00
apnadkarni 7b249ac174 scan, reg*, subst tests 2023-04-10 14:52:44 +00:00
apnadkarni 06e049afdf Fix compiler warnings and crashes. Builds and passes test suite on Windows and Ubuntu for 64-bit 2023-04-10 13:21:02 +00:00
apnadkarni b223689153 Add notcl8api to OPTS to mirror --disable-tcl8api in configure 2023-04-10 13:19:22 +00:00
apnadkarni d90b82d5ce Sloooow progress on testing bigdata 2023-04-09 16:28:02 +00:00
pointsman 7bfc449085 Experimental branch which adds configure option --disable-tcl8api which builds without the Tcl 8 compatibility API. Atm unix only. 2023-04-09 00:09:50 +00:00
apnadkarni f350cdd7cc A few more bigdata tests for strings 2023-04-08 17:19:10 +00:00
apnadkarni 3643909840 Merge 9.0 2023-04-08 08:22:20 +00:00
pointsman 9365f75b61 Editorial fix in Tcl_Panic() message. 2023-04-07 23:14:20 +00:00
pooryorick 3e3ef5f0be Merge trunk [b66d50b4d4]: Merge bug-[fa3d9fd818fa0072]. 2023-04-07 21:07:42 +00:00
pooryorick c70c765bc7 Merge trunk [c53063d69b]: TIP 602 - update manpages. 2023-04-07 20:26:47 +00:00
pooryorick a67d7e8610 Merge trunk [e1baa8ec4a]: Make sure that infoPtr->validMask only contains
TCL_READABLE|TCL_WRITABLE|TCL_EXCEPTION, no other flags.
2023-04-07 20:25:31 +00:00
pooryorick 2b4d8d160a Merge trunk [b27eacb7fc]: Fix [6390566ecd]: Testcase
cmdAH-4.3.13.00DC0000.tail.utf-32.tcl8.a fails sometimes.
2023-04-07 19:42:05 +00:00
pooryorick 3504682d15 Merge trunk [d29e69a635a0dc81]: TIP #628 addendum (various fixes to improve
handling of 8.7 <-> 9.0 header differences).
2023-04-07 18:43:26 +00:00
pooryorick 4d73d1039b Merge bug-[fa3d9fd818fa0072]. 2023-04-06 12:24:28 +00:00
pooryorick edb446d267 Update the documentation for [chan] with regard to binary data. 2023-04-06 12:10:56 +00:00
pooryorick 20d27150a6 Remove obsolete comments. 2023-04-06 10:28:19 +00:00
pooryorick 1c1cbe4444 Further fix for [fa3d9fd818fa0072]. In ChannelState.encoding, NULL no longer
represents the binary encoding.
2023-04-06 10:03:49 +00:00
pooryorick 3749d89fa6 Merge trunk. 2023-04-06 09:41:35 +00:00
apnadkarni 9deff281ee TIP 602 - update manpages 2023-04-05 17:04:05 +00:00
jan.nijtmans 3d9106c78b Merge 8.7 2023-04-05 16:06:52 +00:00
jan.nijtmans fc9cd641eb Make sure that infoPtr->validMask only contains TCL_READABLE|TCL_WRITABLE|TCL_EXCEPTION, no other flags 2023-04-05 16:05:36 +00:00
apnadkarni e49e2ac11d Merge trunk 2023-04-05 15:49:19 +00:00
jan.nijtmans 1c6c9f56e9 Merge 8.7 2023-04-05 15:12:52 +00:00
jan.nijtmans 4df4a598eb Use Tcl_GetIntForIndex() in testcases (tclTestObj.c) in stead of Tcl_GetWideIntFromObj().
Meant for Ashok, to show that we already have Tcl_GetSizeIntFromObj(). (I already planned this conversion for a long time, thanks, Ashok for reminding me)
Also some other cleanups
2023-04-05 14:19:45 +00:00
apnadkarni 0fb466009e Fix tclStubInit gcc warnings with TCL_UTF_MAX=3 2023-04-05 11:44:02 +00:00
apnadkarni 3c2a7e1741 Add TCL_SIZE_MAX and TCL_SIZE_MODIFIER 2023-04-05 11:03:35 +00:00
apnadkarni a066019d75 Export Tcl_GetSizeFromObj in stubs 2023-04-05 10:45:44 +00:00
apnadkarni 1ab82013f2 Tcl_GetSizeIntFromObj 2023-04-05 06:40:43 +00:00
apnadkarni 543bde3f26 Merge 9.0 2023-04-05 04:47:52 +00:00
pooryorick 065cc78833 Merge trunk. 2023-04-04 18:56:27 +00:00
pooryorick 32aba95cdd Merge trunk. 2023-04-04 18:53:00 +00:00
apnadkarni eea17e30ab Some very initial tests for large data 2023-04-04 17:16:51 +00:00
apnadkarni 556b19bf28 Start on tests for large data 2023-04-04 17:14:44 +00:00
pooryorick 15dbbaf497 Merge trunk [dc1e0b5f9a]: Minor fix in winConsole.test. 2023-04-04 14:11:05 +00:00
pooryorick f52fe2c0c0 Merge trunk [cbaf88e90a]: Fix iocmd-12.11 testcase. 2023-04-04 14:10:00 +00:00
pooryorick fc1e6cc187 Merge trunk [a9fc9056236f5775] : Fix [fa128568a5]: EOVERFLOW does not
necessarily mean "file too big". Synchronize many error-messages with what
Linux gives nowadays.
2023-04-04 14:08:38 +00:00
pooryorick dff9e4fbb2 Merge trunk [f8864b9541d149d2]: Merge 8.7. POSIX errors update and minizip fix. 2023-04-04 13:57:32 +00:00
apnadkarni d9bef75f08 Fix gcc warnings from prior 9.0 merge 2023-04-01 11:35:49 +00:00
jan.nijtmans baa549af6a Merge 9.0 2023-04-01 10:27:54 +00:00
apnadkarni a30f4dce67 Fix macos Tcl_MacOSXOpenVersionedBundleResources to use Tcl_Size 2023-03-31 11:09:05 +00:00
apnadkarni 5a1359a5e8 TIP 660. No compiler warnings. Tests suite pass on Win and Ubuntu 2023-03-30 18:01:48 +00:00
apnadkarni edb3e7b8d2 Create new branch named "tip-660" 2023-03-30 17:55:39 +00:00
pooryorick 92aeea296b Merge trunk [0569b8782f] : Remove unneeded parts from test in fileName.test. 2023-03-28 17:54:13 +00:00
pooryorick 42bbf78a33 Merge trunk [92ee031f32]: Make the documentation of [encoding] more concise
and readable.
2023-03-28 17:52:31 +00:00
pooryorick 04ef72b73b Merge trunk [4ebee22ffd]: Update reference-counting advice for Tcl_ObjSetVar2 and friends. 2023-03-28 17:51:26 +00:00
pooryorick e47a1c3779 Merge trunk [f8927d772b]: Avoid msvc "illegal indirection" error. 2023-03-28 16:32:57 +00:00
pooryorick ce09232ac7 Merge trunk [aa1a1096ac]: Fix memory leak in Tcl_JoinObjCmd(). 2023-03-28 16:32:01 +00:00
pooryorick 0a3bf031ac Merge trunk [79cd3ac351]: Update to tzdata 2023b. 2023-03-28 16:31:20 +00:00
pooryorick e78c831950 Merge trunk [7d005e0860]: Fix for [6d4e9d1af5bf5b7d]: Memory leak:
SetFsPathFromAny, assisted by the global literal table, causes a Tcl_Obj to
reference itself.
2023-03-28 16:30:24 +00:00
pooryorick e284637f4c Merge trunk [bb1378370e]: Fix [68417a8bb3]: No result/LF printed for 64-bit
integer type check.
2023-03-28 16:29:25 +00:00
pooryorick 97195d18a9 Merge trunk [6301de2138]: Fix various typos. 2023-03-28 16:27:57 +00:00
pooryorick 99af05cca8 Merge trunk [b29771bb5f]: Fix duplicate test name. 2023-03-28 16:25:38 +00:00
pooryorick 29a34b9b95 Merge trunk [5075be4f0b]: Add valgrind_each to Makefile.in. 2023-03-28 16:24:43 +00:00
pooryorick 30b1f27305 Merge trunk [82107b50c20baa70]: More TCL_INDEX_NONE. 2023-03-28 07:03:14 +00:00
pooryorick b2687dde17 Merge trunk [f25757b233]: Remove knownProfileBug constraint: this is already
fixed.
2023-03-28 06:51:54 +00:00
pooryorick a0ec63efa5 One missing int -> Tcl_Size change 2023-03-27 22:42:33 +00:00
pooryorick e1fca6fb5d Merge trunk [f4cf3c36b4] : Fix [0265750233]: invalid read in cmdAH-4.3.13.C1.solo.utf-8.tcl8 2023-03-27 22:36:04 +00:00
pooryorick 0fcfcc0f88 Merge trunk f8d60e395f: Move (TCL_ENCODING_PROFILE_MASK|GET|SET) from tcl.h to tclIO.h, since those are not public. Some formatting. 2023-03-24 13:27:08 +00:00
pooryorick 1852320cca Merge trunk e1cfef6bfd: Code cleanup: use more *SURROGATE() macros. 2023-03-24 13:25:14 +00:00
pooryorick 79e893e6f2 Merge trunk a9d278979e: Fix longIs64Bit->has64BitLengths else test will not run on 64-bit
Wind.
2023-03-24 13:20:27 +00:00
pooryorick 4232bc484d Merge trunk: Remove unneeded Tcl_IncrRefCount and TclDecrRefCount.
TclPtrSetVarIdx takes ownership of newValuePtr if its refCount is 0, and either
stores or frees it.
2023-03-24 13:19:44 +00:00
pooryorick af2c18d5ea Merge trunk 78beedf7e2: Fix [1bedc53c8c]: synchronous [read] with
-strictencoding does not produce an error on invalid input.
2023-03-24 13:18:51 +00:00
pooryorick fadb579028 Merge trunk c8983a2a94: Fix [154ed7ce56]: Tcl 9: [gets] on -strictencoding 1 configured
channel.
2023-03-24 13:16:26 +00:00
pooryorick ed01d27700 Merge trunk 037b767147: Missing backslashes in macro def. 2023-03-24 13:14:07 +00:00
pooryorick 09b9930667 Merge trunk dd8e66c296: More TclNewIndexObj() usages (for values between -1 and
SIZE_MAX-1).
2023-03-24 13:13:23 +00:00
pooryorick 657095d29a Merge trunk d89991c58b Fix [bdcb5126c0]: Failed assertion in test chan-io-7.3. 2023-03-23 21:38:14 +00:00
pooryorick 05277ab690 Merge trunk 15c9067453: Add longIs64bit constraint to lseq-4.4 (because this
isn't expected to work on 32-bit platforms). Remove some unused constraints.
2023-03-23 21:35:30 +00:00
pooryorick 333b4efa28 Merge trunk 1e23dd4876: Fix [5ae5ffc3f4]: Problem with -failindex on 32-bit platform. 2023-03-23 21:33:03 +00:00
pooryorick adbdca59a9 Merge trunk 1253dd0211: Fix http11 test hang caused by trailing brace in
previous commit.
2023-03-23 21:24:02 +00:00
pooryorick 2918f547d8 Merge trunk 20cad126cd: Don't let httpd11 depend on the system encoding any
more: All text files are now stored in utf-8.
2023-03-23 21:17:33 +00:00
pooryorick c52403ad33 Test TableFromUtfProc() with strict handling of encoding errors. 2023-01-25 19:56:57 +00:00
pooryorick 2b343d0207 Merge trunk. 2023-01-25 00:34:51 +00:00
pooryorick 5363b1f11f Rename [encoding convert*] option "-nocomplain"/"-ignore" to "-pass", and
"-nocomplainencoding"/"-encodingignore" to "-encodingpass".
2023-01-23 21:32:43 +00:00
pooryorick b49efc9ae0 Rename [encoding convert*] option "-nocomplain"/"-ignore" to "-pass", and
"-nocomplainencoding"/"-encodingignore" to  "-encodingpass"
2023-01-23 20:41:47 +00:00
pooryorick 7fe77d7ff8 Per TIP 601, the default behaviour of [encoding convert..] is to require valid input. 2023-01-23 13:53:51 +00:00
pooryorick f54d9a7c69 A branch for fixing TIP 346/601 issues, and other issues related to Unicode
encoding, while retaining the default of not raising an error when invalid data
for the encoding occurs.
2023-01-23 10:48:17 +00:00
pooryorick 9832ae4232 Fix issue with new options parsing in EncodingConvertfromObjCmd
EncodingConverttoObjCmd.
2023-01-22 11:45:56 +00:00
pooryorick 388bc52075 Merge trunk and resolve conflicts, including changing option processing for
EncodingConverttoObjCmd() and EncodingConvertfromObjCmd().
2023-01-20 00:19:38 +00:00
pooryorick 2c039a780e Add tests to verify the default behaviour for encoding errors. 2023-01-12 09:03:40 +00:00
pooryorick 5c70426f61 For [read] and [gets] encoding errors, used "-result read" in return options
dictionary instead of just "-result".
2023-01-08 00:01:50 +00:00
pooryorick d2fa0702bc Fix for [154ed7ce56], Tcl 9: [gets] on -strictencoding 1 configured channel. 2023-01-02 21:07:02 +00:00
pooryorick 530d3a7f83 Merge py-b8f575aa23. 2022-12-31 00:44:04 +00:00
pooryorick f98272ec1e Strict encoding conformance everywhere by default. Full test suite passes. 2022-12-29 18:11:24 +00:00
pooryorick ba64c646ee Unify TCL_ENCODING_STRICT and TCL_ENCODING_NOCOMPLAIN, and make strict encoding
conformance the default everywhere.
2022-12-28 23:35:24 +00:00
jan.nijtmans 528b7b7168 Merge 8.7 2022-09-28 14:08:05 +00:00
jan.nijtmans 0fbdd463cb Merge 8.7 2022-09-27 13:39:16 +00:00
jan.nijtmans dd1dc3c6e8 Merge 8.7 2022-09-26 19:26:11 +00:00
jan.nijtmans 4a3c559932 rebase to latest 8.7 2022-09-22 12:50:32 +00:00
jan.nijtmans cc185b1d76 eliminate some compiler warnings 2022-09-19 11:50:31 +00:00
jan.nijtmans 2ef45b0593 rebase to 8.7 2022-09-19 11:14:50 +00:00
pooryorick f79b9fa715 Add Tcl_ObjTypeVersion(), fix memory errors in integer list functions, adjust
lset.test so that objInterface.test can use its tests.  All linsert.test and
lset.test tests pass for the integer list.
2021-11-13 09:09:00 +00:00
pooryorick 50baebbe77 Adjust [linsert] tests to check both compiled and uncompiled paths, and run
them for the integer list type as well.  All tests pass.
2021-11-03 14:34:17 +00:00
pooryorick 749fefd640 Fix memory errors in the "list replace" proc for the integer list type,
reorganize code, route "linsert" through the type interface, disable
compilation of linsert pending further developmnt,  and add more tests.
2021-11-03 00:34:21 +00:00
jan.nijtmans b6ce0622a6 Merge 8.7 2021-11-01 16:28:15 +00:00
pooryorick 2e12764223 To test object type interfaces, add the beginnings of a list implementation
that stores items as an array of integers and the first few tests.  All tests
pass, and Valgrind reports that no memory leaks are possible.
2021-10-30 19:28:15 +00:00
pooryorick fc2acd077c Add the macro TCL_LENGTH_NONE. 2021-10-26 13:28:11 +00:00
jan.nijtmans e6c0a3dcfb Merge 9.0 2021-10-26 08:54:12 +00:00
jan.nijtmans 962a5361ab typo 2021-10-26 08:42:48 +00:00
pooryorick a15ae048d3 Fix memory errors in lsearch, add the first few string routines to Tcl_ObjType,
modify StringIndexCmd to use to use the Tcl_ObjType interface.  Valgrind
reports no memory errors.
2021-10-24 15:55:24 +00:00
pooryorick f91edb6f99 Add the first few string functions to the Tcl_ObjType interface, move function
declarations out of tclInt.h.
2021-10-18 15:02:39 +00:00
jan.nijtmans 3763c10f23 Adapt Makefile.in and makefile.vc (for Windows) too 2021-10-18 07:43:20 +00:00
jan.nijtmans 84f1110b9d More compiler warnings 2021-10-17 20:55:15 +00:00
jan.nijtmans 6bb895f4c6 Compiler warnings/errors 2021-10-17 15:05:47 +00:00
pooryorick c4329d52b1 Adapt Tcl_LsearchObjCmd to perform efficient binary search on non-finite
Tcl_ObjType list implementations.
2021-10-16 22:04:03 +00:00
jan.nijtmans 86ec6ab749 Make it compile on MacOS too 2021-10-16 11:39:37 +00:00
jan.nijtmans 07235a8a6f at least - make it compile/run on UNIX 2021-10-16 09:45:38 +00:00
pooryorick e36e170f46 Modify Tcl_LsearchObjCmd() to not use TclListObjGetElements. 2021-10-15 19:21:39 +00:00
pooryorick 5f1e5885b7 Add tests for Tcl_ObjType "lrange" interface. 2021-10-14 20:43:04 +00:00
pooryorick f04818aaa8 Modify Tcl_LrangeObjCmd() to handle lists having indeterminate end. Fix typo
in INST_LIST_RANGE_IMM.
2021-10-14 20:08:41 +00:00
pooryorick 2e1f7ff673 Fix TclObjectDispatchNoDefault macro, add a rangeEnd function to the list
interface, improve handling of indeterminate in  
INST_LIST_INDEX_IMM and add similar handling to  INST_LIST_RANGE_IMM,
2021-10-14 14:52:05 +00:00
pooryorick 6d704ccf07 Add "indexEnd" function to Tcl_Obj list interface
table, ditch idea of using ssize_t, add TclObjectDispatchNoDefault for
interface fucntions that have no existing Tcl implemntation, rework
TclLindexFlat to route "end" indices to the indexEnd interface if there is one.
2021-10-13 11:27:45 +00:00
pooryorick fef646d799 Use TCL_INDEX_NONE as the indicator of an invalid index, modify TclLindexFlat
to produce an error when "end" is used as an index of a list having
indeterminate size, and add tests for [lindex] "end" in this case.
2021-10-10 13:00:25 +00:00
pooryorick 2f0b5c46a2 For testing, Add testIndexHexType, a Tcl_ObjType that implements its own list
interface.
2021-10-09 16:46:42 +00:00
pooryorick 03a672aeea Add "interp" argument to TclListRange, add new C procedures "TclLengthIsFinite"
and "TclLindexLast", start using a length of -1 to indicate that a list is
unbounded, and modify TclListObjRange() to be more amenable to unbounded lists,
and modify INST_LIST_RANGE_IMM bytecode routine for the same reason.
2021-10-09 16:39:49 +00:00
pooryorick 3294957eb6 Add length to TclListObjRange since callers alread have it and it makes working
with a Tcl_ObjType interface easier.  Fix tclListType in tclStrToD.c Adapt
INST_LIST_INDEX_IMM in tclExecute.c to work with Tcl_ObjType interfaces.
2021-10-07 21:09:07 +00:00
pooryorick 4789965abd Rework TclLindexFlat to function with Tcl_ObjType interfaces. 2021-10-07 19:36:19 +00:00
pooryorick 9735f7b1a9 For backwards-compatibility, shoehorn Tcl_ObjType interface structure into
existing public interface.
2021-10-05 06:07:38 +00:00
pooryorick 0779620efd Rename the Tcl_ObjType interface.list.append to interface.list.appendlist, use
interface.list.append, and add Tcl_ListObjAppendElement to tclListtype.
2021-09-28 19:26:19 +00:00
pooryorick 69675d1a04 Add remaining list routines to the Tcl_ObjType interface. 2021-09-28 00:12:36 +00:00
pooryorick 57ed822ecb Add an "interface" member to Tcl_ObjType, and plug lindex
and lrange into the interface.
2021-09-27 16:07:11 +00:00
pooryorick 314feacb7c Create new branch named "pyk-objinterface" 2021-09-23 12:56:14 +00:00
dkf 136b650bda Added a basic portable test of [fconfigure -stat] 2021-07-13 19:53:38 +00:00
dkf 65b685deca Added documentation 2021-07-13 19:38:37 +00:00
jan.nijtmans 0865a0b6b0 Merge 8.7. Fix fstat() call in tclUnixChan.c, in case Tcl_StatBuf == struct stat64. 2021-06-29 15:02:53 +00:00
jan.nijtmans 79260bd695 Make tclWinChan.c compile again, fixing obvious implementation problems. Not tested if it actually works. 2021-06-29 08:54:19 +00:00
jan.nijtmans 1a062775d2 Fix iocmd-8.4 testcase 2021-06-28 12:32:35 +00:00
dkf a855be143c merge core-8-branch 2021-06-27 11:26:36 +00:00
dkf 5e07595538 First attempt at Windows implementation.
I don't develop on that platform, so this is extra dodgy!
2021-06-19 20:19:49 +00:00
dkf 5ed49bbc61 Added in missing field 2021-06-19 15:57:41 +00:00
dkf fa0c0e6134 Start of implementing TIP 603: chan configure -stat 2021-06-19 14:59:05 +00:00
jan.nijtmans f3b329dd28 Merge 8.7 2021-01-06 11:52:16 +00:00
dkf 496cff3ee1 merge core-8-branch 2021-01-05 20:41:27 +00:00
dkf 0f93742804 merge core-8-branch 2020-12-06 18:24:00 +00:00
dkf 7dd7fe1b6c merge core-8-branch 2020-02-26 16:56:53 +00:00
dkf bfcd8d392a merge core-8-branch 2020-02-22 12:35:05 +00:00
dkf 004c1e1c8e Less contorted code 2020-02-22 12:31:11 +00:00
dkf 99145db40b There are subtle cases where an append-if-new operation is really useful for a slot. 2020-02-15 10:28:01 +00:00
jan.nijtmans 2569d6f81c Merge 8.7 2020-02-12 13:24:16 +00:00
dkf dafa1487f9 caching is one of the two hard things in CS (along with naming and off-by-one-errors) 2020-02-07 09:21:08 +00:00
dkf 743e0e4e1a Move the TIP 558 tests into their own file 2020-01-01 16:57:08 +00:00
dkf 8249e877df More error cases 2020-01-01 16:46:55 +00:00
dkf b308bd97e6 Check for another tricky edge case 2020-01-01 16:01:36 +00:00
dkf ae24dd87fa merge core-8-branch 2019-12-31 23:27:01 +00:00
dkf 995eed36fd Better error messages when a property has the wrong kind for the type of access desired 2019-12-31 23:25:58 +00:00
dkf c4f94adb46 Other list-returning [info class] subcommands are plurals, so change property -> properties 2019-12-31 22:58:01 +00:00
dkf d4b3d3a460 Added docs 2019-12-31 14:56:32 +00:00
dkf 6eb109c913 Even more tests, this time of the return-code semantics of property getters and setters. 2019-12-30 15:35:51 +00:00
dkf edb3a561eb merge core-8-branch 2019-12-30 10:13:25 +00:00
dkf c15b6135d5 More tests, more fixes 2019-12-30 10:12:16 +00:00
dkf a7a226fc49 Property definitions now work on instances. 2019-12-29 13:23:47 +00:00
dkf 76c3874ad8 Starting to do the testing. 2019-12-28 21:55:56 +00:00
dkf c0eed541eb Implementation of properties for TclOO 2019-12-28 13:24:59 +00:00
326 changed files with 15886 additions and 53336 deletions
+7 -3
View File
@@ -1,5 +1,11 @@
name: Linux
on: [push]
on:
push:
branches:
- "main"
- "core-8-branch"
tags:
- "core-**"
permissions:
contents: read
jobs:
@@ -9,8 +15,6 @@ jobs:
matrix:
cfgopt:
- ""
- "CFLAGS=-DTCL_UTF_MAX=3"
- "CFLAGS=-DTCL_NO_DEPRECATED=1"
- "--disable-shared"
- "--enable-symbols"
- "--enable-symbols=mem"
+7 -1
View File
@@ -1,5 +1,11 @@
name: macOS
on: [push]
on:
push:
branches:
- "main"
- "core-8-branch"
tags:
- "core-**"
permissions:
contents: read
jobs:
+7 -1
View File
@@ -1,5 +1,11 @@
name: Build Binaries
on: [push]
on:
push:
branches:
- "main"
- "core-8-branch"
tags:
- "core-**"
permissions:
contents: read
jobs:
+7 -3
View File
@@ -1,5 +1,11 @@
name: Windows
on: [push]
on:
push:
branches:
- "main"
- "core-8-branch"
tags:
- "core-**"
permissions:
contents: read
env:
@@ -54,8 +60,6 @@ jobs:
matrix:
cfgopt:
- ""
- "CFLAGS=-DTCL_UTF_MAX=3"
- "CFLAGS=-DTCL_NO_DEPRECATED=1"
- "--disable-shared"
- "--enable-symbols"
- "--enable-symbols=mem"
-36
View File
@@ -20,20 +20,12 @@ jobs:
compiler: gcc
env:
- BUILD_DIR=unix
- name: "Linux/GCC/Shared: UTF_MAX=3"
os: linux
dist: focal
compiler: gcc
env:
- BUILD_DIR=unix
- CFGOPT="CFLAGS=-DTCL_UTF_MAX=3"
- name: "Linux/GCC/Shared: NO_DEPRECATED"
os: linux
dist: focal
compiler: gcc
env:
- BUILD_DIR=unix
- CFGOPT="CFLAGS=-DTCL_NO_DEPRECATED=1"
- name: "Linux/GCC/Static"
os: linux
dist: focal
@@ -301,20 +293,6 @@ jobs:
- touch generic/tclStubInit.c generic/tclOOStubInit.c generic/tclOOScript.h
- choco install -y make zip
- cd ${BUILD_DIR}
- name: "Windows/GCC/Shared: UTF_MAX=3"
os: windows
compiler: gcc
env:
- BUILD_DIR=win
- CFGOPT="--enable-64bit CFLAGS=-DTCL_UTF_MAX=3"
before_install: *makepreinst
- name: "Windows/GCC/Shared: NO_DEPRECATED"
os: windows
compiler: gcc
env:
- BUILD_DIR=win
- CFGOPT="--enable-64bit CFLAGS=-DTCL_NO_DEPRECATED=1"
before_install: *makepreinst
- name: "Windows/GCC/Static"
os: windows
compiler: gcc
@@ -343,20 +321,6 @@ jobs:
env:
- BUILD_DIR=win
before_install: *makepreinst
- name: "Windows/GCC-x86/Shared: UTF_MAX=3"
os: windows
compiler: gcc
env:
- BUILD_DIR=win
- CFGOPT="CFLAGS=-DTCL_UTF_MAX=3"
before_install: *makepreinst
- name: "Windows/GCC-x86/Shared: NO_DEPRECATED"
os: windows
compiler: gcc
env:
- BUILD_DIR=win
- CFGOPT="CFLAGS=-DTCL_NO_DEPRECATED=1"
before_install: *makepreinst
- name: "Windows/GCC-x86/Static"
os: windows
compiler: gcc
-8856
View File
File diff suppressed because it is too large Load Diff
-2634
View File
File diff suppressed because it is too large Load Diff
-2539
View File
File diff suppressed because it is too large Load Diff
-3629
View File
File diff suppressed because it is too large Load Diff
-4741
View File
File diff suppressed because it is too large Load Diff
-3349
View File
File diff suppressed because it is too large Load Diff
-4619
View File
File diff suppressed because it is too large Load Diff
-3822
View File
File diff suppressed because it is too large Load Diff
-5921
View File
File diff suppressed because it is too large Load Diff
-3796
View File
File diff suppressed because it is too large Load Diff
+48 -52
View File
@@ -3028,7 +3028,7 @@ in case of errors is required for proper cleanup by the user of fcopy. (BW)
x eval rename foo blotz
x alias foo {}
The problem was that the interp code was not using the actual current name
of the command to be deleted as a result of un-aliasing foo. (JL)
of the command to be deleted as a result of unaliasing foo. (JL)
6/19/97 (feature change) Pass interp down to the ChannelOption and
driver specific calls so system errors can be differentiated from syntax
@@ -4167,7 +4167,7 @@ Only.) This fix included:
the location of the encoding files and libraries. This fix included:
- Adding the TclSetPerInitScript routine.
- Modifying the Tcl_Init routines to evaluate the non-NULL
pre-init script.
preinit script.
- Adding the Tcl_SetdefaultEncodingDir and Tcl_GetDefaultEncodingDir
routines.
- Modifying the TclpInitLibrary routines to append the default
@@ -4650,7 +4650,7 @@ threading may still cause problems on AIX. (hobbs)
9/21/99 (bug fix) fixed bug when setting array in non-existent
namespace. [Bug: 2613] (hobbs)
--- Released 8.2.1, October 04, 1999 --- See ChangeLog for details ---
--- Released 8.2.1, October 04, 1999
10/30/99 (feature enhancement) new regexp engine from Henry Spencer
was patched in - should greatly reduce stack space usage. (spencer)
@@ -4680,7 +4680,7 @@ when indexing into one (test case string-5.16) [Bug: 2871] (hobbs)
10/30/99 (bug fix) fixes for mac UTF filename handling (ingham)
--- Released 8.2.2, November 04, 1999 --- See ChangeLog for details ---
--- Released 8.2.2, November 04, 1999
11/19/99 (feature enhancement) bug fixes for http package as well as
patch required by TLS (SSL) extension that adds http::(un)register
@@ -4705,7 +4705,7 @@ atexit handlers.
12/07/99 (bug fix) fixes for 'expr + {[incr]}' and 'expr + {[error]}'
cases (different causes).
--- Released 8.2.3, December 16, 1999 --- See ChangeLog for details ---
--- Released 8.2.3, December 16, 1999
1999-09-14 (feature enhancement) added -start switch to regexp and regsub.
@@ -4762,7 +4762,7 @@ ExitThread to _endthreadex to prevent 4K mem leak (gravereaux)
1999-12-21 (bug fix) changed thread ids to longs (for 64bit systems)
--- Released 8.3b1, December 22, 1999 --- See ChangeLog for details ---
--- Released 8.3b1, December 22, 1999
2000-01-10 (feature enhancement) clock scan now supports the common
ISO 8601 date/time formats. See docs for details. (melski)
@@ -4788,7 +4788,7 @@ symbolicly (like chmod) in [file attributes $file -permissions ...] (schoebel)
2000-01-13 (bug fix) fixed lsort -dictionary problem when sorting
characters between 'Z' and 'a' (flawed upper/lower comparison logic) (melski)
--- Released 8.3b2, January 13, 2000 --- See ChangeLog for details ---
--- Released 8.3b2, January 13, 2000
2000-01-14 (feature enhancement) clock format %Q added, clock scan updated
@@ -4827,7 +4827,7 @@ mac panic from an error when closing an async socket (steffen, ingham)
2000-02-10 (feature enhancement) improved error reporting for failed
loads on Windows (dejong, hobbs)
--- Released 8.3.0, February 10, 2000 --- See ChangeLog for details ---
--- Released 8.3.0, February 10, 2000
2000-03 (bug fixes, feature enhancement) overhaul of http package for
proper handling of async callbacks (new options), version is now at 2.3
@@ -4870,7 +4870,7 @@ tclLoadDyld.c dl type. (sanchez)
2000-04-24 (bug fix) fixed hang in threaded Unix case when backgrounded
exec process was running (dejong)
--- Released 8.3.1, April 26, 2000 --- See ChangeLog for details ---
--- Released 8.3.1, April 26, 2000
2000-04-26 (doc fix) updated/added documentation for many API's and
commands (melski)
@@ -4920,7 +4920,7 @@ pattern matching for [array names] (gazetta)
2000-05-31 (feature enhancement) added -nocomplain and -- flags to
[unset] to allow for silent unset operation (hobbs)
--- Released 8.4a1, June 6, 2000 --- See ChangeLog for details ---
--- Released 8.4a1, June 6, 2000
2000-05-29 (bug fix) corrected resource cleanup in http error cases.
Improved handling of error cases in http. (tamhankar)
@@ -4959,7 +4959,7 @@ sections. (english)
2000-08-07 (bug fix) new man pages memory.n, TCL_MEM_DEBUG.3, Init.3 and
DumpActiveMemory.3. (melski)
--- Released 8.3.2, August 9, 2000 --- See ChangeLog for details ---
--- Released 8.3.2, August 9, 2000
2000-06 thru 2000-11 (build improvements) Added support for mingw (gcc on
Windows), AIX-5 and Win64 builds (dejong, hobbs)
@@ -5018,7 +5018,7 @@ environment (gravereaux)
2000-11-03 (new feature) Tcl_SetMainLoop enables defining an event loop for
tclsh. This enables Tk as a truly loadable package. (hobbs)
--- Released 8.4a2, November 3, 2000 --- See ChangeLog for details ---
--- Released 8.4a2, November 3, 2000
2000-09-27 (bug fix) fixed a bug introduced by a partial fix in 8.3.2 that
didn't set nonBlocking correctly when resetting the flags for the write
@@ -5076,7 +5076,7 @@ Update of READMEs.
Corrected IRIX-5* configure (english). Added support for AIX-5 (hobbs).
Added support for Win64 (hobbs).
--- Released 8.3.3, April 6, 2001 --- See ChangeLog for details ---
--- Released 8.3.3, April 6, 2001
2000-11-23 (new feature)[TIP 7] higher resolution timer on Windows (kenny)
@@ -5150,7 +5150,7 @@ system. This includes the addition of 'file normalize', 'file system',
* corrected several minor errors noted by Purify (hobbs)
--- Released 8.4a3, August 6, 2001 --- See ChangeLog for details ---
--- Released 8.4a3, August 6, 2001
2001-06-27 (bug fix)[217987] corrected backslash substitution of non-ASCII
characters. (hobbs, riefenstahl)
@@ -5256,7 +5256,7 @@ bundles to standard .dylib dynamic libraries like on other unices.
2001-10-18 (bug fix) corrected off-by-one-day error in clock scan with
relative months and years during swing hours. (lavana)
--- Released 8.3.4, October 19, 2001 --- See ChangeLog for details ---
--- Released 8.3.4, October 19, 2001
2001-08-21 (bug fix)[219184] overagressive compilation of [catch] (sofer)
@@ -5282,8 +5282,6 @@ compiles to 0 bytecodes (sofer)
2001-09-13 (new feature)[TIP 56] Tcl_EvalTokensStandard API (sofer)
2001-09-13 (new feature) Old ChangeLog entries => ChangeLog.1999 (hobbs)
2001-09-17 (new feature) compiling with TCL_COMPILE_DEBUG now required to
enable all compile and execution tracing (sofer)
*** POTENTIAL INCOMPATIBILITY ***
@@ -5368,8 +5366,6 @@ of the Host: header value
2002-01-25 (new feature)[496733] socket options -eofchar and -translation
return read-only values (dejong)
2002-01-28 (new feature) Old ChangeLog entries => ChangeLog.20900 (hobbs)
2002-01-28 (performance enhancement) bytecompiled [regexp] for trivial cases
that amount to string matching. Also -nocase and --. (hobbs)
@@ -5394,7 +5390,7 @@ errored out. (kupries, sofer)
2002-02-15 (new feature)[TIP 72] support for 64-bit integer values on
32-bit platforms and ability to work with >2GiB files. Extends many
commands. See ChangeLog and TIP for details.
commands. See TIP for details.
*** POTENTIAL INCOMPATIBILITY ***
2002-02-22 (bug fix)[476537] Fix panic when loading shared library without
@@ -5435,7 +5431,7 @@ of prior Tcl releases. Others will need to be reconciled.
related to the handling of iso2022 text and finalization of escape-based
encodings. (taguchi, takahashi, hobbs)
--- Released 8.4a4, March 5, 2002 --- See ChangeLog for details ---
--- Released 8.4a4, March 5, 2002
2002-03-06 (new feature)[TIP 80] expanded [lsearch] options (wilkason, fellows)
@@ -5545,7 +5541,7 @@ options to configure (max)
2002-07-03 (bug fix)[577015] [catch] catches even compile errors (sofer)
--- Released 8.4b1, July 5, 2002 --- See ChangeLog for details ---
--- Released 8.4b1, July 5, 2002
2002-07-08 (bug fix) restored compatibility of [viewFile] in tcltest (porter)
@@ -5583,7 +5579,7 @@ options to configure (max)
Many internal bugs fixed.
Considerable cleanup of the test suite.
--- Released 8.4b2, August 9, 2002 --- See ChangeLog for details ---
--- Released 8.4b2, August 9, 2002
2002-08-20 (new feature) --enable-memdebug configure option (kupries)
@@ -5598,7 +5594,7 @@ Considerable cleanup of the test suite.
2002-09-02 (platfrom support) 64-bit compile on HP-11 (martin)
--- Released 8.4.0, September 10, 2002 --- See ChangeLog for details ---
--- Released 8.4.0, September 10, 2002
2002-09-18 (platform support) Updated support for compiling with Cygwin and
either mingw or gcc. (khan, howell, dejong)
@@ -5661,7 +5657,7 @@ dirs to tcl_pkgPath: @executable_path/../Frameworks and
@executable_path/../PrivateFrameworks (if they exist), as well as the dirs
in DYLD_FRAMEWORK_PATH (if set). (steffen)
--- Released 8.4.1, October 22, 2002 --- See ChangeLog for details ---
--- Released 8.4.1, October 22, 2002
2002-10-28 (bug fix)[627660] [package unknown] chaining for platform specifics
@@ -5754,7 +5750,7 @@ packages in multiple interps.
2003-02-27 (bug fix)[694232] stop [lsearch -start 0 {} x] segfault
--- Released 8.4.2, March 3, 2003 --- See ChangeLog for details ---
--- Released 8.4.2, March 3, 2003
2003-03-06 (bug fix)[699042] Correct case-insensitive unicode string
comparison in Tcl_UniCharNcasecmp
@@ -5836,7 +5832,7 @@ encoding for the original. Most uses of gb2312 really mean euc-cn.
2003-05-14 (bug fix)[736421] Corrected another putenv() copy behavior
problem when compiling on Windows and using Microsoft's runtime.
--- Released 8.4.3, May 20, 2003 --- See ChangeLog for details ---
--- Released 8.4.3, May 20, 2003
2003-05-23 (bug fix)[726018] reverted internals change to the
'cmdName' Tcl_ObjType that broke several extensions (TclBlend, e4graph...)
@@ -5877,7 +5873,7 @@ Improved documentation, new tests, and some code cleanup.
[655300, 720634, 735364, 748700, 756112, 756744, 756951, 758488, 760768,
763312, 769895, 771539, 771840, 771947, 771949, 772333]
--- Released 8.4.4, July 22, 2003 --- See ChangeLog for details ---
--- Released 8.4.4, July 22, 2003
2003-07-23 (bug fix)[775976] fix registry compilation for VC7.
@@ -5923,7 +5919,7 @@ asked for writable events by the generic layer.
2003-11-17 (bug fix)[230589, 504785, 505048, 703709, 840258] fixes to
various odd regexp "can't happen" bugs.
--- Released 8.4.5, November 20, 2003 --- See ChangeLog for details ---
--- Released 8.4.5, November 20, 2003
2003-12-02 (bug fix)[851747] object sharing fix in [binary scan]
@@ -5960,7 +5956,7 @@ various odd regexp "can't happen" bugs.
2004-03-01 (platform support)[218561] Allow 64-bit configure on IRIX64-6.5*
--- Released 8.4.6, March 1, 2004 --- See ChangeLog for details ---
--- Released 8.4.6, March 1, 2004
Changes to 8.5a1 include all changes to the 8.4 line through 8.4.6,
plus the following, which focuses on the high-level feature changes
@@ -6046,7 +6042,7 @@ in this changeset (new minor version) rather than bug fixes:
* [TIP #157] leading {expand} syntax on words to cause argument expansion.
This is a safer/cleaner alternative to the use of 'eval'.
--- Released 8.5a1, March 3, 2004 --- See ChangeLog for details ---
--- Released 8.5a1, March 3, 2004
2004-03-04 (new feature) registry package is [unload]able (thoyts)
=> registry 1.1.4
@@ -6070,7 +6066,7 @@ each command/interp validity before executing. (sofer)
2004-04-06 (clean up) refactored Tcl header file #include order. Might
create need for changes in extensions that #include private headers.
Changed source code files should work with older Tcl as well. See ChangeLog.
Changed source code files should work with older Tcl as well.
*** POTENTIAL INCOMPATIBILITY ***
2004-04-07 (bug fix)[920667] install into any Unicode path on Win (hobbs)
@@ -6346,7 +6342,7 @@ Doc improvements [759545,926590,935853,1017072,1018486,1022527,1027849,
1032243,1047928,1048005,1058446,1062647,1065732,1073334,etc.]
Test suite expansion [1036649,1001997,etc.]
--- Released 8.5a2, December 7, 2004 --- See ChangeLog for details ---
--- Released 8.5a2, December 7, 2004
2004-12-13 (bug fix)[1083082] encoding memory leaks (ade,porter)
@@ -6490,7 +6486,7 @@ Can support [load] from memory as well (steffen)
Documentation improvements [1075433,1085127,1117017,1124160,1149605,etc.]
--- Released 8.5a3, June 4, 2005 --- See ChangeLog for details ---
--- Released 8.5a3, June 4, 2005
2005-06-06 (bug fix)[1213678] Windows/gcc: crash in stack.test (kenny)
@@ -6741,7 +6737,7 @@ removed (steffen)
Documentation improvements [1211078,1190891,1292427,1277503,1104682,1359183,
1415725,666770]
--- Released 8.5a4, April 27, 2006 --- See ChangeLog for details ---
--- Released 8.5a4, April 27, 2006
2006-05-04 (bug fix)[1480509] srand() accept wide input (porter,afredd)
@@ -6837,7 +6833,7 @@ URL validity checking against RFC 2986 (hobbs)
2006-10-13 (platform support) get stack size on Darwin (steffen)
--- Released 8.5a5, October 20, 2006 --- See ChangeLog for details ---
--- Released 8.5a5, October 20, 2006
2006-10-20 (configure change) Added autodetection for OS-supplied timezone
files (max)
@@ -6919,7 +6915,7 @@ upvar and namespace upvar (sofer)
2007-04-23 (bug fix) fts_open() crash on 64bit Darwin 8 or earlier (steffen)
--- Released 8.5a6, April 25, 2007 --- See ChangeLog for details ---
--- Released 8.5a6, April 25, 2007
2007-04-30 (bug fix)[1705778] many valgrind-detected leaks corrected
@@ -6977,7 +6973,7 @@ of traced command do not fire (sofer)
2007-08-16 (bug fix)[1773040] ::errorInfo trace crash (janssen,porter)
2007-08-16 (performance)[1564517] pre-compile constant expressions (porter)
2007-08-16 (performance)[1564517] precompile constant expressions (porter)
2007-08-21 (bug fix)[1775878] 'puts \' in interactive tclsh failed to move to
prompt for continuation line (porter)
@@ -7022,7 +7018,7 @@ project for Xcode 3.0 (steffen)
(bug fix)[1066755] Several stack efficiency efforts increases recursion limit
on Windows to be larger than the default [interp recursionlimit] value
--- Released 8.5b1, September 26, 2007 --- See ChangeLog for details ---
--- Released 8.5b1, September 26, 2007
2007-10-02 (bug fix)[1806422] proper [tcl::tm::path] autoload (porter)
@@ -7034,7 +7030,7 @@ on Windows to be larger than the default [interp recursionlimit] value
2007-10-25 (bug fix)[1726873] intermittent crash in threads (vasiljevic)
--- Released 8.5b2, October 26, 2007 --- See ChangeLog for details ---
--- Released 8.5b2, October 26, 2007
2007-10-27 (bug fix)[1821159] fixed broken compile on x86_64 (sofer)
@@ -7070,7 +7066,7 @@ on Windows to be larger than the default [interp recursionlimit] value
Many significant documentation improvements (fellows, sofer)
--- Released 8.5b3, November 19, 2007 --- See ChangeLog for details ---
--- Released 8.5b3, November 19, 2007
2007-11-20 (enhancement) string rep of dict has stable order (fellows)
@@ -7104,7 +7100,7 @@ over-consumption of resources (drewry,lane,ormandy,fellows)
Several documentation and release notes improvements
--- Released 8.5.0, December 20, 2007 --- See ChangeLog for details ---
--- Released 8.5.0, December 20, 2007
2007-12-23 (bug fix)[1857126] restore backref support to regexps (hobbs)
@@ -7126,7 +7122,7 @@ Several documentation and release notes improvements
Several documentation and release notes improvements
--- Released 8.5.1, February 5, 2008 --- See ChangeLog for details ---
--- Released 8.5.1, February 5, 2008
2008-02-06 (enhancement) [clock format] performance (kenny)
@@ -7187,7 +7183,7 @@ variables without "." added to customization hooks (kupries)
2008-03-27 clock tzdata updated to Olson's tzdata2008b (kenny)
--- Released 8.5.2, March 28, 2008 --- See ChangeLog for details ---
--- Released 8.5.2, March 28, 2008
2008-03-30 (bug fix)[1783544] more robust TclIsNaN() (kenny,teterin)
@@ -7242,7 +7238,7 @@ variables without "." added to customization hooks (kupries)
2008-06-25 (bug fix)[1999119] Support TM packages in Safe Base (kupries)
--- Released 8.6a1, June 25, 2008 --- See ChangeLog for details ---
--- Released 8.6a1, June 25, 2008
2008-06-29 (bug fix)[2004480] plug memory leaks (ade,porter,steffen)
@@ -7295,7 +7291,7 @@ in a deleted interp. (porter)
2008-08-21 (bug fix)[2065115] Restored ***= regexp functioning (hobbs,porter)
--- Released 8.6a2, August 25, 2008 --- See ChangeLog for details ---
--- Released 8.6a2, August 25, 2008
2008-08-29 (bug fix)[2082299] Install TclOO header files (fellows)
@@ -7376,7 +7372,7 @@ Tcl_FSFileAttrStringsProc prototype. (nijtmans)
2008-10-10 (bug fix)[2155658] crash in oo method export (fellows)
--- Released 8.6a3, October 10, 2008 --- See ChangeLog for details ---
--- Released 8.6a3, October 10, 2008
2008-10-13 (bug fix) Fix ability to join threads on 64-bit Windows (thoyts)
@@ -7446,7 +7442,7 @@ evaluation in extensions (sofer,kenny)
2008-12-18 (bug fix)[2444274] panic in long commands from {*} (goth,porter)
--- Released 8.6b1, December 19, 2008 --- See ChangeLog for details ---
--- Released 8.6b1, December 19, 2008
2008-12-27 [TIP 234] Tcl_Zlib* interface revisions (fellows)
*** INCOMPATIBILITY with interface of 8.6b1 ***
@@ -7954,7 +7950,7 @@ memory with buffer backup (ferrieux)
Many more Tcl built-in command errors now set an -errorcode.
--- Released 8.6b2, August 8, 2011 --- See ChangeLog for details ---
--- Released 8.6b2, August 8, 2011
2011-07-02 (bug fix)[3349507] correct double(1[string repeat 0 23]) (kenny)
@@ -8115,7 +8111,7 @@ Many revisions to better support a Cygwin environment (nijtmans)
Dropped support for OS X versions less than 10.4 (Tiger) (fellows)
--- Released 8.6b3, September 18, 2012 --- See ChangeLog for details ---
--- Released 8.6b3, September 18, 2012
2012-09-20 (enhancement) full Unicode support (nijtmans)
=> dde 1.4.0
@@ -8162,7 +8158,7 @@ Dropped support for OS X versions less than 10.4 (Tiger) (fellows)
2012-12-13 (bug fix) crash: [zlib gunzip $data -header noSuchNs::var] (porter)
--- Released 8.6.0, December 20, 2012 --- See ChangeLog for details ---
--- Released 8.6.0, December 20, 2012
2012-12-22 (bug fix)[3598150] DString to Tcl_Obj memleak (afredd)
@@ -8685,7 +8681,7 @@ improvements to regexp engine from Postgres (lane,porter,fellows,seltenreich)
2016-07-08 (bug)[a47641] [file normalize] & Windows junctions (nadkarni)
2016-07-09 [ae61a6] [file] handling of Win hardcoded names (CON) (nadkarni)
2016-07-09 [ae61a6] [file] handling of Win hard-coded names (CON) (nadkarni)
*** POTENTIAL INCOMPATIBILITY ***
2016-07-09 [3613671] [file owned] (more) useful on Win (nadkarni)
+1 -2
View File
@@ -28,9 +28,8 @@ opendir(
if ((fd = open(myname, 0, 0)) == -1) {
return NULL;
}
dirp = (DIR *) Tcl_Alloc(sizeof(DIR));
dirp = (DIR *) Tcl_AttemptAlloc(sizeof(DIR));
if (dirp == NULL) {
/* unreachable? */
close(fd);
return NULL;
}
+5 -1
View File
@@ -156,7 +156,11 @@ waitpid(
goto waitAgain;
}
}
waitPtr = (WaitInfo *) Tcl_Alloc(sizeof(WaitInfo));
waitPtr = (WaitInfo *) Tcl_AttemptAlloc(sizeof(WaitInfo));
if (!waitPtr) {
errno = ENOMEM;
return -1;
}
waitPtr->pid = result;
waitPtr->status = status;
waitPtr->nextPtr = deadList;
View File
+6 -9
View File
@@ -54,30 +54,27 @@ For \fBTcl_AddObjErrorInfo\fR,
this points to the first byte of an array of \fIlength\fR bytes
containing a string to append to the \fB\-errorinfo\fR return option.
This byte array may contain embedded null bytes
unless \fIlength\fR is TCL_INDEX_NONE.
unless \fIlength\fR is negative.
.AP Tcl_Obj *objPtr in
A message to be appended to the \fB\-errorinfo\fR return option
in the form of a Tcl_Obj value.
.AP size_t length in
.AP Tcl_Size length in
The number of bytes to copy from \fImessage\fR when
appending to the \fB\-errorinfo\fR return option.
If TCL_INDEX_NONE, all bytes up to the first null byte are used.
If negative, all bytes up to the first null byte are used.
.AP Tcl_Obj *errorObjPtr in
The \fB\-errorcode\fR return option will be set to this value.
.AP "const char" *element in
String to record as one element of the \fB\-errorcode\fR return option.
Last \fIelement\fR argument must be NULL.
.AP va_list argList in
An argument list which must have been initialized using
\fBva_start\fR, and cleared using \fBva_end\fR.
.AP int lineNum
The line number of a script where an error occurred.
.AP "const char" *script in
Pointer to first character in script containing command (must be <= command)
.AP "const char" *command in
Pointer to first character in command that generated the error
.AP size_t commandLength in
Number of bytes in command; TCL_INDEX_NONE means use all bytes up to first null byte
.AP Tcl_Size commandLength in
Number of bytes in command; a negative value means use all bytes up to first null byte
.BE
.SH DESCRIPTION
.PP
@@ -227,7 +224,7 @@ embedded null bytes. This is essentially never a good idea.
If the \fImessage\fR needs to contain the null character \fBU+0000\fR,
Tcl's usual internal encoding rules should be used to avoid
the need for a null byte. If the \fBTcl_AddObjErrorInfo\fR
interface is used at all, it should be with a TCL_INDEX_NONE \fIlength\fR value.
interface is used at all, it should be with a negative \fIlength\fR value.
.PP
The procedure \fBTcl_SetObjErrorCode\fR is used to set the
\fB\-errorcode\fR return option to the list value \fIerrorObjPtr\fR
+4 -4
View File
@@ -34,7 +34,7 @@ unsigned char *
.AP "const unsigned char" *bytes in
The array of bytes used to initialize or set a byte-array value. May be NULL
even if \fInumBytes\fR is non-zero.
.AP size_t numBytes in
.AP Tcl_Size numBytes in
The number of bytes in the array.
.AP Tcl_Obj *objPtr in/out
For \fBTcl_SetByteArrayObj\fR, this points to an unshared value to be
@@ -43,7 +43,7 @@ overwritten by a byte-array value. For \fBTcl_GetBytesFromObj\fR,
to the value from which to extract an array of bytes.
.AP Tcl_Interp *interp in
Interpreter to use for error reporting.
.AP "size_t \&| int" *numBytesPtr out
.AP "Tcl_Size \&| int" *numBytesPtr out
Points to space where the number of bytes in the array may be written.
Caller may pass NULL when it does not need this information.
.BE
@@ -134,8 +134,8 @@ and any string representation is invalidated.
On success, both \fBTcl_GetBytesFromObj\fR and \fBTcl_GetByteArrayFromObj\fR
write the number of bytes in the byte-array value of \fIobjPtr\fR
to the space pointed to by \fInumBytesPtr\fR. This space may be of type
\fBsize_t\fR or of type \fBint\fR. It is recommended that callers provide
a \fBsize_t\fR space for this purpose. If the caller provides only
\fBTcl_Size\fR or of type \fBint\fR. It is recommended that callers provide
a \fBTcl_Size\fR space for this purpose. If the caller provides only
an \fBint\fR space and the number of bytes in the byte-array value of
\fIobjPtr\fR is greater than \fBINT_MAX\fR, the routine will fail due
to being unable to correctly report the byte-array size to the caller.
+2 -2
View File
@@ -26,7 +26,7 @@ Error message to use in the cancellation, or NULL to use a default message. If
not NULL, this object will have its reference count decremented before
\fBTcl_CancelEval\fR returns.
.AP int flags in
ORed combination of flag bits that specify additional options.
OR'ed combination of flag bits that specify additional options.
For \fBTcl_CancelEval\fR, only \fBTCL_CANCEL_UNWIND\fR is currently
supported. For \fBTcl_Canceled\fR, only \fBTCL_LEAVE_ERR_MSG\fR and
\fBTCL_CANCEL_UNWIND\fR are currently supported.
@@ -47,7 +47,7 @@ Extensions can use this function to check to see if they should abort a long
running command. This function is thread sensitive and may only be called
from the thread the interpreter was created in.
.SS "FLAG BITS"
Any ORed combination of the following values may be used for the
Any OR'ed combination of the following values may be used for the
\fIflags\fR argument to procedures such as \fBTcl_CancelEval\fR:
.TP 20
\fBTCL_CANCEL_UNWIND\fR
+2 -2
View File
@@ -81,11 +81,11 @@ automatically selected.
The name of the namespace to create for the object's private use, or NULL if a
new unused name is to be automatically selected. The namespace must not
already exist.
.AP size_t objc in
.AP Tcl_Size objc in
The number of elements in the \fIobjv\fR array.
.AP "Tcl_Obj *const" *objv in
The arguments to the command to create the instance of the class.
.AP size_t skip in
.AP Tcl_Size skip in
The number of arguments at the start of the argument array, \fIobjv\fR, that
are not arguments to any constructors. This allows the generation of correct
error messages even when complicated calling patterns are used (e.g., via the
+1 -1
View File
@@ -18,7 +18,7 @@ const char *
\fBTcl_Concat\fR(\fIargc, argv\fR)
.SH ARGUMENTS
.AS "const char *const" argv[]
.AP size_t argc in
.AP Tcl_Size argc in
Number of strings.
.AP "const char *const" argv[] in
Array of strings to concatenate. Must have \fIargc\fR entries.
+2 -2
View File
@@ -69,12 +69,12 @@ Name of source command for alias.
Interpreter that contains the target command for an alias.
.AP "const char" *targetCmd in
Name of target command for alias in \fItargetInterp\fR.
.AP size_t argc in
.AP Tcl_Size argc in
Count of additional arguments to pass to the alias command.
.AP "const char *const" *argv in
Vector of strings, the additional arguments to pass to the alias command.
This storage is owned by the caller.
.AP size_t objc in
.AP Tcl_Size objc in
Count of additional value arguments to pass to the aliased command.
.AP Tcl_Obj **objv in
Vector of Tcl_Obj structures, the additional value arguments to pass to
+1 -1
View File
@@ -141,7 +141,7 @@ means the output handle is wanted.
.AP void **handlePtr out
Points to the location where the desired OS-specific handle should be
stored.
.AP size_t size in
.AP Tcl_Size size in
The size, in bytes, of buffers to allocate in this channel.
.AP int mask in
An OR-ed combination of \fBTCL_READABLE\fR, \fBTCL_WRITABLE\fR
+1 -1
View File
@@ -187,7 +187,7 @@ except its \fIproc2\fR argument is of type \fBTcl_ObjCmdProc2\fR.
typedef int \fBTcl_ObjCmdProc2\fR(
void *\fIclientData\fR,
Tcl_Interp *\fIinterp\fR,
size_t \fIobjc\fR,
Tcl_Size \fIobjc\fR,
Tcl_Obj *const \fIobjv\fR[]);
.CE
.PP
+3 -3
View File
@@ -29,7 +29,7 @@ Tcl_Trace
.AS Tcl_CmdObjTraceDeleteProc *deleteProc
.AP Tcl_Interp *interp in
Interpreter containing command to be traced or untraced.
.AP size_t level in
.AP Tcl_Size level in
Only commands at or below this nesting level will be traced unless
0 is specified. 1 means
top-level commands only, 2 means top-level commands or those that are
@@ -88,10 +88,10 @@ typedef int \fBTcl_CmdObjTraceProc\fR(
typedef int \fBTcl_CmdObjTraceProc2\fR(
\fBvoid *\fR \fIclientData\fR,
\fBTcl_Interp\fR* \fIinterp\fR,
size_t \fIlevel\fR,
Tcl_Size \fIlevel\fR,
const char *\fIcommand\fR,
\fBTcl_Command\fR \fIcommandToken\fR,
size_t \fIobjc\fR,
Tcl_Size \fIobjc\fR,
\fBTcl_Obj\fR *const \fIobjv\fR[]);
.CE
.PP
+15 -14
View File
@@ -26,7 +26,7 @@ char *
.sp
\fBTcl_DStringEndSublist\fR(\fIdsPtr\fR)
.sp
size_t
Tcl_Size
\fBTcl_DStringLength\fR(\fIdsPtr\fR)
.sp
char *
@@ -51,10 +51,10 @@ Pointer to structure that is used to manage a dynamic string.
Pointer to characters to append to dynamic string.
.AP "const char" *element in
Pointer to characters to append as list element to dynamic string.
.AP size_t length in
Number of bytes from \fIbytes\fR to add to dynamic string. If TCL_INDEX_NONE,
.AP Tcl_Size length in
Number of bytes from \fIbytes\fR to add to dynamic string. If negative,
add all characters up to null terminating character.
.AP size_t newLength in
.AP Tcl_Size newLength in
New length for dynamic string, not including null terminating
character.
.AP Tcl_Interp *interp in/out
@@ -142,7 +142,8 @@ This saves the cost of allocating new memory and copying the string.
an empty string.
Since the dynamic string is reinitialized, there is no need to
further call \fBTcl_DStringFree\fR on it and it can be reused without
calling \fBTcl_DStringInit\fR.
calling \fBTcl_DStringInit\fR. The caller must ensure that the dynamic
string stored in \fIdsPtr\fR is encoded in Tcl's internal UTF-8 format.
.PP
\fBTcl_DStringGetResult\fR does the opposite of \fBTcl_DStringResult\fR.
It sets the value of \fIdsPtr\fR to the result of \fIinterp\fR and
@@ -150,15 +151,15 @@ it clears \fIinterp\fR's result.
If possible it does this by moving a pointer rather than by copying
the string.
.PP
\fBTcl_DStringToObj\fR returns a \fBTcl_Obj\fR containing the value of
the dynamic string given by \fIdsPtr\fR. It does this by moving
a pointer from \fIdsPtr\fR to a newly allocated \fBTcl_Obj\fR
and reinitializing to dynamic string to an empty string.
This saves the cost of allocating new memory and copying the string.
Since the dynamic string is reinitialized, there is no need to
further call \fBTcl_DStringFree\fR on it and it can be reused without
calling \fBTcl_DStringInit\fR.
The returned \fBTcl_Obj\fR has a reference count of 0.
\fBTcl_DStringToObj\fR returns a \fBTcl_Obj\fR containing the value of the
dynamic string given by \fIdsPtr\fR. It does this by moving a pointer from
\fIdsPtr\fR to a newly allocated \fBTcl_Obj\fR and reinitializing to dynamic
string to an empty string. This saves the cost of allocating new memory and
copying the string. Since the dynamic string is reinitialized, there is no need
to further call \fBTcl_DStringFree\fR on it and it can be reused without calling
\fBTcl_DStringInit\fR. The returned \fBTcl_Obj\fR has a reference count of 0.
The caller must ensure that the dynamic string stored in \fIdsPtr\fR is encoded
in Tcl's internal UTF-8 format.
.SH KEYWORDS
append, dynamic string, free, result
+1 -1
View File
@@ -22,7 +22,7 @@ Tcl_Pid
\fBTcl_WaitPid\fR(\fIpid, statusPtr, options\fR)
.SH ARGUMENTS
.AS Tcl_Pid *statusPtr out
.AP size_t numPids in
.AP Tcl_Size numPids in
Number of process ids contained in the array pointed to by \fIpidPtr\fR.
.AP int *pidPtr in
Address of array containing \fInumPids\fR process ids.
+2 -2
View File
@@ -70,7 +70,7 @@ Points to a variable that will have the value from a key/value pair
placed within it. For \fBTcl_DictObjFirst\fR and
\fBTcl_DictObjNext\fR, this may be NULL to indicate that the caller is
not interested in the value.
.AP "size_t \&| int" *sizePtr out
.AP "Tcl_Size \&| int" *sizePtr out
Points to a variable that will have the number of key/value pairs
contained within the dictionary placed within it.
.AP Tcl_DictSearch *searchPtr in/out
@@ -84,7 +84,7 @@ returned, the search record \fImust\fR be passed to
Points to a variable that will have a non-zero value written into it
when the enumeration of the key/value pairs in a dictionary has
completed, and a zero otherwise.
.AP size_t keyc in
.AP Tcl_Size keyc in
Indicates the number of keys that will be supplied in the \fIkeyv\fR
array.
.AP "Tcl_Obj *const" *keyv in
+6 -6
View File
@@ -25,13 +25,13 @@ int
char *
\fBTcl_ExternalToUtfDString\fR(\fIencoding, src, srcLen, dstPtr\fR)
.sp
size_t
int
\fBTcl_ExternalToUtfDStringEx\fR(\fIinterp, encoding, src, srcLen, flags, dstPtr, errorIdxPtr\fR)
.sp
char *
\fBTcl_UtfToExternalDString\fR(\fIencoding, src, srcLen, dstPtr\fR)
.sp
size_t
int
\fBTcl_UtfToExternalDStringEx\fR(\fIinterp, encoding, src, srcLen, flags, dstPtr, errorIdxPtr\fR)
.sp
int
@@ -45,7 +45,7 @@ int
const char *
\fBTcl_GetEncodingName\fR(\fIencoding\fR)
.sp
size_t
Tcl_Size
\fBTcl_GetEncodingNulLength\fR(\fIencoding\fR)
.sp
int
@@ -86,7 +86,7 @@ specified encoding that are to be converted to UTF-8. For the
UTF-8 characters to be converted to the specified encoding.
.AP "const TCHAR" *tsrc in
An array of Windows TCHAR characters to convert to UTF-8.
.AP size_t srcLen in
.AP Tcl_Size srcLen in
Length of \fIsrc\fR or \fItsrc\fR in bytes. If the length is negative, the
encoding-specific length of the string is used.
.AP Tcl_DString *dstPtr out
@@ -347,7 +347,7 @@ typedef struct Tcl_EncodingType {
Tcl_EncodingConvertProc *\fIfromUtfProc\fR;
Tcl_EncodingFreeProc *\fIfreeProc\fR;
void *\fIclientData\fR;
size_t \fInullSize\fR;
Tcl_Size \fInullSize\fR;
} \fBTcl_EncodingType\fR;
.CE
.PP
@@ -590,7 +590,7 @@ with at most one of \fBTCL_ENCODING_PROFILE_TCL8\fR,
\fBTCL_ENCODING_PROFILE_STRICT\fR or \fBTCL_ENCODING_PROFILE_REPLACE\fR.
These correspond to the \fBtcl8\fR, \fBstrict\fR and \fBreplace\fR profiles
respectively. If none are specified, a version-dependent default profile is used.
For Tcl 8.7, the default profile is \fBtcl8\fR.
For Tcl 9.0, the default profile is \fBtcl8\fR.
.PP
For details about profiles, see the \fBPROFILES\fR section in
the documentation of the \fBencoding\fR command.
+2 -2
View File
@@ -69,14 +69,14 @@ The name of the ensemble command to be created.
The namespace to which the ensemble command is to be bound, or NULL
for the current namespace.
.AP int ensFlags in
An ORed set of flag bits describing the basic configuration of the
An OR'ed set of flag bits describing the basic configuration of the
ensemble. Currently only one bit has meaning, \fBTCL_ENSEMBLE_PREFIX\fR,
which is present when the ensemble command should also match
unambiguous prefixes of subcommands.
.AP Tcl_Obj *cmdNameObj in
A value holding the name of the ensemble command to look up.
.AP int flags in
An ORed set of flag bits controlling the behavior of
An OR'ed set of flag bits controlling the behavior of
\fBTcl_FindEnsemble\fR. Currently only \fBTCL_LEAVE_ERR_MSG\fR is supported.
.AP Tcl_Command token in
A normal command token that refers to an ensemble command, or which
+4 -4
View File
@@ -46,11 +46,11 @@ modified to hold the result or error message from the script.
.AP Tcl_Obj *objPtr in
A Tcl value containing the script to execute.
.AP int flags in
ORed combination of flag bits that specify additional options.
OR'ed combination of flag bits that specify additional options.
\fBTCL_EVAL_GLOBAL\fR and \fBTCL_EVAL_DIRECT\fR are currently supported.
.AP "const char" *fileName in
Name of a file containing a Tcl script.
.AP size_t objc in
.AP Tcl_Size objc in
The number of values in the array pointed to by \fIobjv\fR;
this is also the number of words in the command.
.AP Tcl_Obj **objv in
@@ -101,7 +101,7 @@ in code for string comparison, you can use
which will be safely substituted by the Tcl interpreter into
.QW ^Z .
.PP
\fBTcl_EvalObjv\fR executes a single pre-parsed command instead of a
\fBTcl_EvalObjv\fR executes a single preparsed command instead of a
script. The \fIobjc\fR and \fIobjv\fR arguments contain the values
of the words for the Tcl command, one word in each value in
\fIobjv\fR. \fBTcl_EvalObjv\fR evaluates the command and returns
@@ -142,7 +142,7 @@ of arguments. \fBTcl_VarEval\fR is now deprecated.
.SH "FLAG BITS"
.PP
Any ORed combination of the following values may be used for the
Any OR'ed combination of the following values may be used for the
\fIflags\fR argument to procedures such as \fBTcl_EvalObjEx\fR:
.TP 23
\fBTCL_EVAL_DIRECT\fR
+9 -23
View File
@@ -220,9 +220,9 @@ The second of two path values to compare. The value may be converted
to \fBpath\fR type.
.AP Tcl_Obj *listObj in
The list of path elements to operate on with a \fBjoin\fR operation.
.AP size_t elements in
.AP Tcl_Size elements in
The number of elements in the \fIlistObj\fR which should
be joined together. If TCL_INDEX_NONE, then all elements are joined.
be joined together. If negative, then all elements are joined.
.AP Tcl_Obj **errorPtr out
In the case of an error, filled with a value containing the name of
the file which caused an error in the various copy/rename operations.
@@ -233,7 +233,7 @@ The value to set in the operation.
.AP Tcl_Obj **objPtrRef out
Filled with a value containing the result of the operation.
.AP Tcl_Obj *resultPtr out
Pre-allocated value in which to store (using
Preallocated value in which to store (using
\fBTcl_ListObjAppendElement\fR) the list of
files or directories which are successfully matched.
.AP int mode in
@@ -269,11 +269,11 @@ allowed for the \fImode\fR argument to the Tcl \fBopen\fR command.
.AP int permissions in
POSIX-style permission flags such as 0644. If a new file is created, these
permissions will be set on the created file.
.AP "size_t \&| int" *lenPtr out
.AP "Tcl_Size \&| int" *lenPtr out
If non-NULL, filled with the number of elements in the split path.
.AP Tcl_Obj *basePtr in
The base path on to which to join the given elements. May be NULL.
.AP size_t objc in
.AP Tcl_Size objc in
The number of elements in \fIobjv\fR.
.AP "Tcl_Obj *const" objv[] in
The elements to join to the given base path.
@@ -483,7 +483,7 @@ is a Tcl_Obj specifying the contents of the symbolic link given by
by the caller, which should call \fBTcl_DecrRefCount\fR when the result is no
longer needed. If the \fItoPtr\fR is not NULL, Tcl should create a link
of one of the types passed in in the \fIlinkAction\fR flag. This flag is
an ORed combination of \fBTCL_CREATE_SYMBOLIC_LINK\fR and \fBTCL_CREATE_HARD_LINK\fR.
an OR'ed combination of \fBTCL_CREATE_SYMBOLIC_LINK\fR and \fBTCL_CREATE_HARD_LINK\fR.
Where a choice exists (i.e.\ more than one flag is passed in), the Tcl
convention is to prefer symbolic links. When a link is successfully
created, the return value should be \fItoPtr\fR (which is therefore
@@ -678,11 +678,6 @@ of zero, they will be freed when this function returns.
\fBTcl_FSConvertToPathType\fR tries to convert the given Tcl_Obj to a valid
Tcl path type, taking account of the fact that the cwd may have changed
even if this value is already supposedly of the correct type.
The filename may begin with
.QW ~
(to indicate current user's home directory) or
.QW ~<user>
(to indicate any user's home directory).
.PP
If the conversion succeeds (i.e.\ the value is a valid path in one of
the current filesystems), then \fBTCL_OK\fR is returned. Otherwise
@@ -704,14 +699,7 @@ from the given Tcl_Obj.
.PP
If the translation succeeds (i.e.\ the value is a valid path), then it is
returned. Otherwise NULL will be returned, and an error message may be
left in the interpreter. A
.QW translated
path is one which contains no
.QW ~
or
.QW ~user
sequences (these have been expanded to their current
representation in the filesystem). The value returned is owned by the
left in the interpreter. The value returned is owned by the
caller, which must store it or call \fBTcl_DecrRefCount\fR to ensure memory is
freed. This function is of little practical use, and
\fBTcl_FSGetNormalizedPath\fR or \fBTcl_FSGetNativePath\fR are usually
@@ -850,7 +838,7 @@ The \fBTcl_Filesystem\fR structure contains the following fields:
.CS
typedef struct Tcl_Filesystem {
const char *\fItypeName\fR;
size_t \fIstructureLength\fR;
Tcl_Size \fIstructureLength\fR;
Tcl_FSVersion \fIversion\fR;
Tcl_FSPathInFilesystemProc *\fIpathInFilesystemProc\fR;
Tcl_FSDupInternalRepProc *\fIdupInternalRepProc\fR;
@@ -1068,9 +1056,7 @@ must have a single unique
string representation. Depending on the filesystem,
there may be more than one unnormalized string representation which
refers to that path (e.g.\ a relative path, a path with different
character case if the filesystem is case insensitive, a path contain a
reference to a home directory such as
.QW ~ ,
character case if the filesystem is case insensitive,
a path containing symbolic
links, etc). If the very last component in the path is a symbolic
link, it should not be converted into the value it points to (but
+10 -4
View File
@@ -43,6 +43,9 @@ int
int
\fBTcl_GetWideUIntFromObj\fR(\fIinterp, objPtr, uwidePtr\fR)
.sp
int
\fBTcl_GetSizeIntFromObj\fR(\fIinterp, objPtr, sizePtr\fR)
.sp
.sp
\fB#include <tclTomMath.h>\fR
.sp
@@ -61,7 +64,7 @@ int
\fBTcl_InitBignumFromDouble\fR(\fIinterp, doubleValue, bigValue\fR)
.SH ARGUMENTS
.AS Tcl_WideInt doubleValue in/out
.AP size_t endValue in
.AP Tcl_Size endValue in
\fBTcl_GetIntForIndex\fR will return this when the input value is "end".
.AP int intValue in
Integer value used to initialize or set a Tcl value.
@@ -83,12 +86,14 @@ retrieval fails.
Points to place to store the integer value retrieved from \fIobjPtr\fR.
.AP long *longPtr out
Points to place to store the long integer value retrieved from \fIobjPtr\fR.
.AP size_t *indexPtr out
Points to place to store the size_t value retrieved from \fIobjPtr\fR.
.AP Tcl_Size *indexPtr out
Points to place to store the Tcl_Size value retrieved from \fIobjPtr\fR.
.AP Tcl_WideInt *widePtr out
Points to place to store the wide integer value retrieved from \fIobjPtr\fR.
.AP Tcl_WideUInt *uwidePtr out
Points to place to store the unsigned wide integer value retrieved from \fIobjPtr\fR.
.AP Tcl_Size *sizePtr out
Points to place to store the \fBTcl_Size\fR integer value retrieved from \fIobjPtr\fR.
.AP mp_int *bigValue in/out
Points to a multi-precision integer structure declared by the LibTomMath
library.
@@ -138,7 +143,8 @@ of \fIobjPtr\fR may be changed to make subsequent calls to the
same routine more efficient.
.PP
The \fBTcl_GetIntFromObj\fR, \fBTcl_GetLongFromObj\fR,
\fBTcl_GetWideIntFromObj\fR, \fBTcl_GetBignumFromObj\fR, and
\fBTcl_GetWideIntFromObj\fR, \fBTcl_GetSizeIntFromObj\fR,
\fBTcl_GetBignumFromObj\fR, and
\fBTcl_TakeBignumFromObj\fR routines attempt to retrieve an integral
value of the appropriate type from the Tcl value \fIobjPtr\fR. If the
attempt succeeds, then \fBTCL_OK\fR is returned, and the value is
+1 -1
View File
@@ -65,7 +65,7 @@ its limits checked.
.AP int type in
The type of limit that the operation refers to. This must be either
\fBTCL_LIMIT_COMMANDS\fR or \fBTCL_LIMIT_TIME\fR.
.AP size_t commandLimit in
.AP Tcl_Size commandLimit in
The maximum number of commands (as reported by \fBinfo cmdcount\fR)
that may be executed in the interpreter.
.AP Tcl_Time *timeLimitPtr in/out
+1 -1
View File
@@ -59,7 +59,7 @@ In \fBTcl_LinkArray\fR, the additional linked types \fBTCL_LINK_CHARS\fR and
All the above for both functions may be
optionally OR'ed with \fBTCL_LINK_READ_ONLY\fR to make the Tcl
variable read-only.
.AP size_t size in
.AP Tcl_Size size in
.VS "TIP 312"
The number of elements in the C array. Must be greater than zero.
.VE "TIP 312"
+9 -9
View File
@@ -59,13 +59,13 @@ points to the Tcl value that will be appended to \fIlistPtr\fR.
For \fBTcl_SetListObj\fR,
this points to the Tcl value that will be converted to a list value
containing the \fIobjc\fR elements of the array referenced by \fIobjv\fR.
.AP "size_t \&| int" *objcPtr in
.AP "Tcl_Size \&| int" *objcPtr in
Points to location where \fBTcl_ListObjGetElements\fR
stores the number of element values in \fIlistPtr\fR.
.AP Tcl_Obj ***objvPtr out
A location where \fBTcl_ListObjGetElements\fR stores a pointer to an array
of pointers to the element values of \fIlistPtr\fR.
.AP size_t objc in
.AP Tcl_Size objc in
The number of Tcl values that \fBTcl_NewListObj\fR
will insert into a new list value,
and \fBTcl_ListObjReplace\fR will insert into \fIlistPtr\fR.
@@ -76,21 +76,21 @@ An array of pointers to values.
\fBTcl_NewListObj\fR will insert these values into a new list value
and \fBTcl_ListObjReplace\fR will insert them into an existing \fIlistPtr\fR.
Each value will become a separate list element.
.AP "size_t \&| int" *lengthPtr out
.AP "Tcl_Size \&| int" *lengthPtr out
Points to location where \fBTcl_ListObjLength\fR
stores the length of the list.
.AP size_t index in
.AP Tcl_Size index in
Index of the list element that \fBTcl_ListObjIndex\fR
is to return.
The first element has index 0.
.AP Tcl_Obj **objPtrPtr out
Points to place where \fBTcl_ListObjIndex\fR is to store
a pointer to the resulting list element value.
.AP size_t first in
.AP Tcl_Size first in
Index of the starting list element that \fBTcl_ListObjReplace\fR
is to replace.
The list's first element has index 0.
.AP size_t count in
.AP Tcl_Size count in
The number of elements that \fBTcl_ListObjReplace\fR
is to replace.
.BE
@@ -184,7 +184,7 @@ if the conversion fails, it returns \fBTCL_ERROR\fR
and leaves an error message in the interpreter's result value
if \fIinterp\fR is not NULL.
If the index is out of range,
that is, \fIindex\fR is TCL_INDEX_NONE or
that is, \fIindex\fR is negative or
greater than or equal to the number of elements in the list,
\fBTcl_ListObjIndex\fR stores a NULL in \fIobjPtrPtr\fR
and returns \fBTCL_OK\fR.
@@ -203,13 +203,13 @@ and leaves an error message in the interpreter's result value
if \fIinterp\fR is not NULL.
Otherwise, it returns \fBTCL_OK\fR after replacing the values.
If \fIobjv\fR is NULL, no new elements are added.
If the argument \fIfirst\fR is zero or TCL_INDEX_NONE,
If the argument \fIfirst\fR is zero or negative,
it refers to the first element.
If \fIfirst\fR is greater than or equal to the
number of elements in the list, then no elements are deleted;
the new elements are appended to the list.
\fIcount\fR gives the number of elements to replace.
If \fIcount\fR is zero or TCL_INDEX_NONE then no elements are deleted;
If \fIcount\fR is zero or negative then no elements are deleted;
the new elements are simply inserted before the one
designated by \fIfirst\fR.
\fBTcl_ListObjReplace\fR invalidates \fIlistPtr\fR's
+3 -3
View File
@@ -58,7 +58,7 @@ Tcl_Method
Tcl_Object
\fBTcl_ObjectContextObject\fR(\fIcontext\fR)
.sp
size_t
Tcl_Size
\fBTcl_ObjectContextSkippedArgs\fR(\fIcontext\fR)
.SH ARGUMENTS
.AS void *clientData in
@@ -95,11 +95,11 @@ A reference to a method to query.
.AP Tcl_ObjectContext context in
A reference to a method-call context. Note that client code \fImust not\fR
retain a reference to a context.
.AP size_t objc in
.AP Tcl_Size objc in
The number of arguments to pass to the method implementation.
.AP "Tcl_Obj *const" *objv in
An array of arguments to pass to the method implementation.
.AP size_t skip in
.AP Tcl_Size skip in
The number of arguments passed to the method implementation that do not
represent "real" arguments.
.BE
+1 -1
View File
@@ -69,7 +69,7 @@ and \fIobjProc\fR.
.AP Tcl_CmdDeleteProc *deleteProc in/out
Called before \fIcmdName\fR is deleted from the interpreter, allowing for
command-specific cleanup. May be NULL.
.AP size_t objc in
.AP Tcl_Size objc in
Number of items in \fIobjv\fR.
.AP Tcl_Obj **objv in
Words in the command.
+1 -1
View File
@@ -133,7 +133,7 @@ is true.
.PP
\fBTcl_Import\fR imports commands matching a pattern into a
namespace. Note that the pattern must include the name of the
namespace to import from. This function returns an error if
namespace to import from. This function returns TCL_ERROR if
an attempt to import a command over an existing command is made,
unless the \fIallowOverwrite\fR flag has been set.
.PP
+3 -3
View File
@@ -27,9 +27,9 @@ When non-NULL, error information is recorded here when the value is not
in any of the numeric formats recognized by Tcl.
.AP "const char" *bytes in
Points to first byte of the string value to be examined.
.AP size_t numBytes in
.AP Tcl_Size numBytes in
The number of bytes, starting at \fIbytes\fR, that should be examined.
If the value \fBTCL_INDEX_NONE\fR is provided, then all bytes should
If \fBnumBytes\fR is negative, then all bytes should
be examined until the first \fBNUL\fR byte terminates examination.
.AP "void *" *clientDataPtr out
Points to space where a pointer value may be written through which a numeric
@@ -63,7 +63,7 @@ the same function. They differ only in how the arguments present the Tcl
value to be examined. \fBTcl_GetNumber\fR accepts a counted string
value in the arguments \fIbytes\fR and \fInumBytes\fR (or a
\fBNUL\fR-terminated string value when \fInumBytes\fR is
\fBTCL_INDEX_NONE\fR). \fBTcl_GetNumberFromObj\fR accepts the Tcl value
negative). \fBTcl_GetNumberFromObj\fR accepts the Tcl value
in \fIobjPtr\fR.
.PP
Both routines examine the Tcl value and determine whether Tcl recognizes
+2 -2
View File
@@ -111,9 +111,9 @@ which is defined as follows.
.PP
.CS
typedef struct Tcl_Obj {
size_t \fIrefCount\fR;
Tcl_Size \fIrefCount\fR;
char *\fIbytes\fR;
size_t \fIlength\fR;
Tcl_Size \fIlength\fR;
const Tcl_ObjType *\fItypePtr\fR;
union {
long \fIlongValue\fR;
+28 -26
View File
@@ -53,28 +53,28 @@ int
int
\fBTcl_Read\fR(\fIchannel, readBuf, bytesToRead\fR)
.sp
size_t
Tcl_Size
\fBTcl_GetsObj\fR(\fIchannel, lineObjPtr\fR)
.sp
size_t
Tcl_Size
\fBTcl_Gets\fR(\fIchannel, lineRead\fR)
.sp
size_t
Tcl_Size
\fBTcl_Ungets\fR(\fIchannel, input, inputLen, addAtEnd\fR)
.sp
size_t
Tcl_Size
\fBTcl_WriteObj\fR(\fIchannel, writeObjPtr\fR)
.sp
size_t
Tcl_Size
\fBTcl_WriteChars\fR(\fIchannel, charBuf, bytesToWrite\fR)
.sp
size_t
Tcl_Size
\fBTcl_Write\fR(\fIchannel, byteBuf, bytesToWrite\fR)
.sp
size_t
Tcl_Size
\fBTcl_ReadRaw\fR(\fIchannel, readBuf, bytesToRead\fR)
.sp
size_t
Tcl_Size
\fBTcl_WriteRaw\fR(\fIchannel, byteBuf, bytesToWrite\fR)
.sp
int
@@ -119,7 +119,7 @@ allowed for the \fImode\fR argument to the Tcl \fBopen\fR command.
.AP int permissions in
POSIX-style permission flags such as 0644. If a new file is created, these
permissions will be set on the created file.
.AP size_t argc in
.AP Tcl_Size argc in
The number of elements in \fIargv\fR.
.AP "const char" **argv in
Arguments for constructing a command pipeline. These values have the same
@@ -154,7 +154,7 @@ from a procedure such as \fBTcl_OpenFileChannel\fR.
.AP Tcl_Obj *readObjPtr in/out
A pointer to a Tcl value in which to store the characters read from the
channel.
.AP size_t charsToRead in
.AP Tcl_Size charsToRead in
The number of characters to read from the channel. If the channel's encoding
is \fBbinary\fR, this is equivalent to the number of bytes to read from the
channel.
@@ -163,7 +163,7 @@ If non-zero, data read from the channel will be appended to the value.
Otherwise, the data will replace the existing contents of the value.
.AP char *readBuf out
A buffer in which to store the bytes read from the channel.
.AP size_t bytesToRead in
.AP Tcl_Size bytesToRead in
The number of bytes to read from the channel. The buffer \fIreadBuf\fR must
be large enough to hold this many bytes.
.AP Tcl_Obj *lineObjPtr in/out
@@ -176,7 +176,7 @@ channel. Must have been initialized by the caller. The line read will be
appended to any data already in the dynamic string.
.AP "const char" *input in
The input to add to a channel buffer.
.AP size_t inputLen in
.AP Tcl_Size inputLen in
Length of the input
.AP int addAtEnd in
Flag indicating whether the input should be added to the end or
@@ -187,7 +187,7 @@ A pointer to a Tcl value whose contents will be output to the channel.
A buffer containing the characters to output to the channel.
.AP "const char" *byteBuf in
A buffer containing the bytes to output to the channel.
.AP size_t bytesToWrite in
.AP Tcl_Size bytesToWrite in
The number of bytes to consume from \fIcharBuf\fR or \fIbyteBuf\fR and
output to the channel.
.AP "long long" offset in
@@ -406,19 +406,21 @@ to UTF-8 based on the channel's encoding and storing the produced data in
\fIreadObjPtr\fR's string representation. The return value of
\fBTcl_ReadChars\fR is the number of characters, up to \fIcharsToRead\fR,
that were stored in \fIreadObjPtr\fR. If an error occurs while reading, the
return value is TCL_INDEX_NONE and \fBTcl_ReadChars\fR records a POSIX error code that
can be retrieved with \fBTcl_GetErrno\fR.
return value is -1 and \fBTcl_ReadChars\fR records a POSIX error
code that can be retrieved with \fBTcl_GetErrno\fR. If an encoding error happens
while the channel is in blocking mode with -profile strict, the characters
retrieved until the encoding error happened will be stored in \fIreadObjPtr\fR.
.PP
Setting \fIcharsToRead\fR to TCL_INDEX_NONE will cause the command to read
Setting \fIcharsToRead\fR to -1 will cause the command to read
all characters currently available (non-blocking) or everything until
eof (blocking mode).
.PP
The return value may be smaller than the value to read, indicating that less
data than requested was available. This is called a \fIshort read\fR. In
blocking mode, this can only happen on an end-of-file. In nonblocking mode,
a short read can also occur if there is not enough input currently
available: \fBTcl_ReadChars\fR returns a short count rather than waiting
for more data.
a short read can also occur if an encoding error is encountered (with -profile
strict) or if there is not enough input currently available:
\fBTcl_ReadChars\fR returns a short count rather than waiting for more data.
.PP
If the channel is in blocking mode, a return value of zero indicates an
end-of-file condition. If the channel is in nonblocking mode, a return
@@ -471,14 +473,14 @@ character(s) are read and discarded.
.PP
If a line was successfully read, the return value is greater than or equal
to zero and indicates the number of bytes stored in \fIlineObjPtr\fR. If an
error occurs, \fBTcl_GetsObj\fR returns TCL_INDEX_NONE and records a POSIX error code
error occurs, \fBTcl_GetsObj\fR returns -1 and records a POSIX error code
that can be retrieved with \fBTcl_GetErrno\fR. \fBTcl_GetsObj\fR also
returns TCL_INDEX_NONE if the end of the file is reached; the \fBTcl_Eof\fR procedure
returns -1 if the end of the file is reached; the \fBTcl_Eof\fR procedure
can be used to distinguish an error from an end-of-file condition.
.PP
If the channel is in nonblocking mode, the return value can also be TCL_INDEX_NONE
If the channel is in nonblocking mode, the return value can also be -1
if no data was available or the data that was available did not contain an
end-of-line character. When TCL_INDEX_NONE is returned, the \fBTcl_InputBlocked\fR
end-of-line character. When -1 is returned, the \fBTcl_InputBlocked\fR
procedure may be invoked to determine if the channel is blocked because
of input unavailability.
.PP
@@ -496,7 +498,7 @@ head of the queue. If \fIchannel\fR has a
.QW sticky
EOF set, no data will be
added to the input queue. \fBTcl_Ungets\fR returns \fIinputLen\fR or
TCL_INDEX_NONE if an error occurs.
-1 if an error occurs.
.SH "TCL_WRITECHARS, TCL_WRITEOBJ, AND TCL_WRITE"
.PP
\fBTcl_WriteChars\fR accepts \fIbytesToWrite\fR bytes of character data at
@@ -513,7 +515,7 @@ to appear as soon as a complete line is accepted for output, set the
\fB\-buffering\fR option on the channel to \fBline\fR mode.
.PP
The return value of \fBTcl_WriteChars\fR is a count of how many bytes were
accepted for output to the channel. This is either TCL_INDEX_NONE to
accepted for output to the channel. This is either -1 to
indicate that an error occurred or another number greater than
zero to indicate success. If an error occurs, \fBTcl_WriteChars\fR records
a POSIX error code that may be retrieved with \fBTcl_GetErrno\fR.
@@ -599,7 +601,7 @@ their possible values are described in the manual entry for the Tcl
\fBfconfigure\fR command. Other options can be added by each channel type.
These channel type specific options are described in the manual entry for
the Tcl command that creates a channel of that type; for example, the
additional options for TCP based channels are described in the manual entry
additional options for TCP-based channels are described in the manual entry
for the Tcl \fBsocket\fR command.
The procedure normally returns \fBTCL_OK\fR. If an error occurs, it returns
\fBTCL_ERROR\fR and calls \fBTcl_SetErrno\fR to store an appropriate POSIX
-4
View File
@@ -27,10 +27,6 @@ void
A printf-style format string.
.AP "" arg in
Arguments matching the format string.
.AP va_list argList in
An argument list of arguments matching the format string.
Must have been initialized using \fBva_start\fR,
and cleared using \fBva_end\fR.
.AP Tcl_PanicProc *panicProc in
Procedure to report fatal error message and abort.
.BE
+1 -1
View File
@@ -21,7 +21,7 @@ int
Where to store error messages.
.AP "const Tcl_ArgvInfo" *argTable in
Pointer to array of option descriptors.
.AP "size_t \&| int" *objcPtr in/out
.AP "Tcl_Size \&| int" *objcPtr in/out
A pointer to variable holding number of arguments in \fIobjv\fR. Will be
modified to hold number of arguments left in the unprocessed argument list
stored in \fIremObjv\fR.
+7 -7
View File
@@ -45,7 +45,7 @@ For \fBTcl_EvalTokensStandard\fR, determines the context for evaluating
the script and also is used for error reporting; must not be NULL.
.AP "const char" *start in
Pointer to first character in string to parse.
.AP size_t numBytes in
.AP Tcl_Size numBytes in
Number of bytes in string to parse, not including any terminating null
character. If less than 0 then the script consists of all characters
following \fIstart\fR up to the first null character.
@@ -196,20 +196,20 @@ return parse information in two data structures, Tcl_Parse and Tcl_Token:
.CS
typedef struct Tcl_Parse {
const char *\fIcommentStart\fR;
size_t \fIcommentSize\fR;
Tcl_Size \fIcommentSize\fR;
const char *\fIcommandStart\fR;
size_t \fIcommandSize\fR;
size_t \fInumWords\fR;
Tcl_Size \fIcommandSize\fR;
Tcl_Size \fInumWords\fR;
Tcl_Token *\fItokenPtr\fR;
size_t \fInumTokens\fR;
Tcl_Size \fInumTokens\fR;
...
} \fBTcl_Parse\fR;
typedef struct Tcl_Token {
int \fItype\fR;
const char *\fIstart\fR;
size_t \fIsize\fR;
size_t \fInumComponents\fR;
Tcl_Size \fIsize\fR;
Tcl_Size \fInumComponents\fR;
} \fBTcl_Token\fR;
.CE
.PP
+1 -1
View File
@@ -55,7 +55,7 @@ Pointer to place to store the value associated with the matching
package. It is only changed if the pointer is not NULL and the
function completed successfully. The storage can be any pointer
type with the same size as a void pointer.
.AP size_t objc in
.AP Tcl_Size objc in
Number of requirements.
.AP Tcl_Obj* objv[] in
Array of requirements.
+8 -8
View File
@@ -64,7 +64,7 @@ identifies the beginning of the larger string.
If it is not the same as \fItext\fR, then no
.QW \fB^\fR
matches will be allowed.
.AP size_t index in
.AP Tcl_Size index in
Specifies which range is desired: 0 means the range of the entire
match, 1 or greater means the range that matched a parenthesized
sub-expression.
@@ -80,14 +80,14 @@ OR-ed combination of the compilation flags \fBTCL_REG_ADVANCED\fR,
\fBTCL_REG_QUOTE\fR, \fBTCL_REG_NOCASE\fR, \fBTCL_REG_NEWLINE\fR,
\fBTCL_REG_NLSTOP\fR, \fBTCL_REG_NLANCH\fR, \fBTCL_REG_NOSUB\fR, and
\fBTCL_REG_CANMATCH\fR. See below for more information.
.AP size_t offset in
.AP Tcl_Size offset in
The character offset into the text where matching should begin.
The value of the offset has no impact on \fB^\fR matches. This
behavior is controlled by \fIeflags\fR.
.AP size_t nmatches in
.AP Tcl_Size nmatches in
The number of matching subexpressions that should be remembered for
later use. If this value is 0, then no subexpression match
information will be computed. If the value is TCL_INDEX_NONE, then
information will be computed. If the value is negative, then
all of the matching subexpressions will be remembered. Any other
value will be taken as the maximum number of subexpressions to
remember.
@@ -337,9 +337,9 @@ defined as follows:
.PP
.CS
typedef struct Tcl_RegExpInfo {
size_t \fInsubs\fR;
Tcl_Size \fInsubs\fR;
Tcl_RegExpIndices *\fImatches\fR;
size_t \fIextendStart\fR;
Tcl_Size \fIextendStart\fR;
} \fBTcl_RegExpInfo\fR;
.CE
.PP
@@ -355,8 +355,8 @@ follows:
.PP
.CS
typedef struct Tcl_RegExpIndices {
size_t \fIstart\fR;
size_t \fIend\fR;
Tcl_Size \fIstart\fR;
Tcl_Size \fIend\fR;
} \fBTcl_RegExpIndices\fR;
.CE
.PP
+2 -2
View File
@@ -14,14 +14,14 @@ Tcl_SetRecursionLimit \- set maximum allowable nesting depth in interpreter
.nf
\fB#include <tcl.h>\fR
.sp
size_t
Tcl_Size
\fBTcl_SetRecursionLimit\fR(\fIinterp, depth\fR)
.SH ARGUMENTS
.AS Tcl_Interp *interp
.AP Tcl_Interp *interp in
Interpreter whose recursion limit is to be set.
Must be greater than zero.
.AP size_t depth in
.AP Tcl_Size depth in
New limit for nested calls to \fBTcl_Eval\fR for \fIinterp\fR.
.BE
+61 -169
View File
@@ -34,213 +34,105 @@ const char *
.SH ARGUMENTS
.AS Tcl_FreeProc sourceInterp out
.AP Tcl_Interp *interp out
Interpreter whose result is to be modified or read.
The interpreter get or set the result for.
.AP Tcl_Obj *objPtr in
Tcl value to become result for \fIinterp\fR.
A value to set the result to.
.AP char *result in
String value to become result for \fIinterp\fR or to be
appended to the existing result.
The string value set the result to, or to append to the existing result.
.AP "const char" *element in
String value to append as a list element
The string value to append as a list element
to the existing result of \fIinterp\fR.
.AP Tcl_FreeProc *freeProc in
Address of procedure to call to release storage at
\fIresult\fR, or \fBTCL_STATIC\fR, \fBTCL_DYNAMIC\fR, or
\fBTCL_VOLATILE\fR.
.AP va_list argList in
An argument list which must have been initialized using
\fBva_start\fR, and cleared using \fBva_end\fR.
Pointer to a procedure to call to release storage at
\fIresult\fR.
.AP Tcl_Interp *sourceInterp in
Interpreter that the result and return options should be transferred from.
The interpreter to transfer the result and return options from.
.AP Tcl_Interp *targetInterp in
Interpreter that the result and return options should be transferred to.
The interpreter to transfer the result and return options to.
.AP int code in
Return code value that controls transfer of return options.
.BE
.SH DESCRIPTION
.PP
The procedures described here are utilities for manipulating the
result value in a Tcl interpreter.
The interpreter result may be either a Tcl value or a string.
For example, \fBTcl_SetObjResult\fR and \fBTcl_SetResult\fR
set the interpreter result to, respectively, a value and a string.
Similarly, \fBTcl_GetObjResult\fR and \fBTcl_GetStringResult\fR
return the interpreter result as a value and as a string.
The procedures always keep the string and value forms
of the interpreter result consistent.
For example, if \fBTcl_SetObjResult\fR is called to set
the result to a value,
then \fBTcl_GetStringResult\fR is called,
it will return the value's string representation.
These procedures manipulate the result of an interpreter. Some procedures
provide a Tcl_Obj interface while others provide a string interface. For
example, \fBTcl_SetObjResult\fR accepts a Tcl_Obj and \fBTcl_SetResult\fR
accepts a char *. Similarly, \fBTcl_GetObjResult\fR produces a Tcl_Obj * and
\fBTcl_GetStringResult\fR produces a char *. The procedures can be mixed and
matched. For example, if \fBTcl_SetObjResult\fR is called to set the result to
a Tcl_Obj value, and then \fBTcl_GetStringResult\fR is called, it returns a
char * (but see caveats below).
.PP
\fBTcl_SetObjResult\fR
arranges for \fIobjPtr\fR to be the result for \fIinterp\fR,
\fBTcl_SetObjResult\fR sets \fIobjPtr\fR as the result for \fIinterp\fR,
replacing any existing result.
The result is left pointing to the value
referenced by \fIobjPtr\fR.
\fIobjPtr\fR's reference count is incremented
since there is now a new reference to it from \fIinterp\fR.
The reference count for any old result value
is decremented and the old result value is freed if no
references to it remain.
.PP
\fBTcl_GetObjResult\fR returns the result for \fIinterp\fR as a value.
The value's reference count is not incremented;
if the caller needs to retain a long-term pointer to the value
they should use \fBTcl_IncrRefCount\fR to increment its reference count
in order to keep it from being freed too early or accidentally changed.
\fBTcl_GetObjResult\fR returns the result for \fIinterp\fR, without
incrementing its reference count.
.PP
\fBTcl_SetResult\fR
arranges for \fIresult\fR to be the result for the current Tcl
command in \fIinterp\fR, replacing any existing result.
The \fIfreeProc\fR argument specifies how to manage the storage
for the \fIresult\fR argument;
it is discussed in the section
\fBTHE TCL_FREEPROC ARGUMENT TO TCL_SETRESULT\fR below.
If \fIresult\fR is \fBNULL\fR, then \fIfreeProc\fR is ignored
and \fBTcl_SetResult\fR
re-initializes \fIinterp\fR's result to point to an empty string.
\fBTcl_SetResult\fR sets \fIresult\fR as the result for \fIinterp\fR, replacing
any existing result, and calls \fIfreeProc\fR to free \fIresult\fR. See \fBTHE
TCL_FREEPROC ARGUMENT TO TCL_SETRESULT\fR below. If \fIresult\fR is
\fBNULL\fR, ignores \fIfreeProc\fR and sets the result for \fIinterp\fR to
point to the empty string.
.PP
\fBTcl_GetStringResult\fR returns the result for \fIinterp\fR as a string.
If the result was set to a value by a \fBTcl_SetObjResult\fR call,
the value form will be converted to a string and returned.
If the value's string representation contains null bytes,
this conversion will lose information.
For this reason, programmers are encouraged to
write their code to use the new value API procedures
and to call \fBTcl_GetObjResult\fR instead.
\fBTcl_GetStringResult\fR returns the result for \fIinterp\fR as a string, i.e.
the bytes of the Tcl_Obj for the result, which can be decoded using
\fBTcl_UtfToExternal\fR. This value is freed when its corresponding Tcl_Obj is
freed.Programmers are encouraged to use the newer Tcl_Obj API procedures, e.g.
to call \fBTcl_GetObjResult\fR instead.
.PP
\fBTcl_ResetResult\fR clears the result for \fIinterp\fR
and leaves the result in its normal empty initialized state.
If the result is a value,
its reference count is decremented and the result is left
pointing to an unshared value representing an empty string.
If the result is a dynamically allocated string, its memory is free*d
and the result is left as a empty string.
\fBTcl_ResetResult\fR also clears the error state managed by
\fBTcl_AddErrorInfo\fR, \fBTcl_AddObjErrorInfo\fR,
and \fBTcl_SetErrorCode\fR.
\fBTcl_ResetResult\fR sets the empty string as the result for \fIinterp\fR and
clears the error state managed by \fBTcl_AddErrorInfo\fR,
\fBTcl_AddObjErrorInfo\fR, and \fBTcl_SetErrorCode\fR.
.PP
\fBTcl_AppendResult\fR makes it easy to build up Tcl results in pieces.
It takes each of its \fIresult\fR arguments and appends them in order
to the current result associated with \fIinterp\fR.
If the result is in its initialized empty state (e.g. a command procedure
was just invoked or \fBTcl_ResetResult\fR was just called),
then \fBTcl_AppendResult\fR sets the result to the concatenation of
its \fIresult\fR arguments.
\fBTcl_AppendResult\fR may be called repeatedly as additional pieces
of the result are produced.
\fBTcl_AppendResult\fR takes care of all the
storage management issues associated with managing \fIinterp\fR's
result, such as allocating a larger result area if necessary.
It also manages conversion to and from the \fIresult\fR field of the
\fIinterp\fR so as to handle backward-compatibility with old-style
extensions.
Any number of \fIresult\fR arguments may be passed in a single
call; the last argument in the list must be a NULL pointer.
\fBTcl_AppendResult\fR builds up a result from smaller pieces, appending each
\fIresult\fR in order to the current result for \fIinterp\fR. It may be called
repeatedly as additional pieces of the result are produced, and manages the
storage for the \fIinterp\fR's result, allocating a larger result area if
necessary. It also manages conversion to and from the \fIresult\fR field of
the \fIinterp\fR to handle backward-compatibility with old-style extensions.
Any number of \fIresult\fR arguments may be passed in a single call; the last
argument in the list must be a NULL pointer.
.PP
\fBTcl_TransferResult\fR transfers interpreter state from \fIsourceInterp\fR
to \fItargetInterp\fR. The two interpreters must have been created in the
same thread. If \fIsourceInterp\fR and \fItargetInterp\fR are the same,
nothing is done. Otherwise, \fBTcl_TransferResult\fR moves the result
from \fIsourceInterp\fR to \fItargetInterp\fR, and resets the result
in \fIsourceInterp\fR. It also moves the return options dictionary as
controlled by the return code value \fIcode\fR in the same manner
\fBTcl_TransferResult\fR transfers interpreter state from \fIsourceInterp\fR to
\fItargetInterp\fR, both of which must have been created in the same thread,
resets the result in \fIsourceInterp\fR, and moves the return options
dictionary as controlled by the return code value \fIcode\fR in the same manner
as \fBTcl_GetReturnOptions\fR.
.PP
If \fIsourceInterp\fR and \fItargetInterp\fR are the same, nothing is done.
.SH "DEPRECATED INTERFACES"
.SS "OLD STRING PROCEDURES"
.PP
Use of the following procedures is deprecated
since they manipulate the Tcl result as a string.
Procedures such as \fBTcl_SetObjResult\fR
that manipulate the result as a value
can be significantly more efficient.
The following procedures are deprecated since they manipulate the Tcl result as
a string. Procedures such as \fBTcl_SetObjResult\fR can be significantly more
efficient.
.PP
\fBTcl_AppendElement\fR is similar to \fBTcl_AppendResult\fR in
that it allows results to be built up in pieces.
However, \fBTcl_AppendElement\fR takes only a single \fIelement\fR
argument and it appends that argument to the current result
as a proper Tcl list element.
\fBTcl_AppendElement\fR adds backslashes or braces if necessary
to ensure that \fIinterp\fR's result can be parsed as a list and that
\fIelement\fR will be extracted as a single element.
Under normal conditions, \fBTcl_AppendElement\fR will add a space
character to \fIinterp\fR's result just before adding the new
list element, so that the list elements in the result are properly
separated.
However if the new list element is the first in a list or sub-list
(i.e. \fIinterp\fR's current result is empty, or consists of the
single character
\fBTcl_AppendElement\fR is like \fBTcl_AppendResult\fR, but it appends only one
piece, and also appends that piece as a list item.
\fBTcl_AppendElement\fR adds backslashes or braces as necessary to ensure that
\fIelement\fR is properly formatted as a list item. Under normal conditions,
\fBTcl_AppendElement\fR adds a space character to \fIinterp\fR's result just
before adding the new list element, so that the list elements in the result are
properly separated. However if the new list element is the first item in the
list or sublist (i.e. \fIinterp\fR's current result is empty, or consists of
the single character
.QW { ,
or ends in the characters
.QW " {" )
then no space is added.
.SH "THE TCL_FREEPROC ARGUMENT TO TCL_SETRESULT"
.PP
\fBTcl_SetResult\fR's \fIfreeProc\fR argument specifies how
the Tcl system is to manage the storage for the \fIresult\fR argument.
If \fBTcl_SetResult\fR or \fBTcl_SetObjResult\fR are called
at a time when \fIinterp\fR holds a string result,
they do whatever is necessary to dispose of the old string result
(see the \fBTcl_Interp\fR manual entry for details on this).
.PP
If \fIfreeProc\fR is \fBTCL_STATIC\fR it means that \fIresult\fR
refers to an area of static storage that is guaranteed not to be
modified until at least the next call to \fBTcl_Eval\fR.
If \fIfreeProc\fR
is \fBTCL_DYNAMIC\fR it means that \fIresult\fR was allocated with a call
to \fBTcl_Alloc\fR and is now the property of the Tcl system.
\fBTcl_SetResult\fR will arrange for the string's storage to be
released by calling \fBTcl_Free\fR when it is no longer needed.
If \fIfreeProc\fR is \fBTCL_VOLATILE\fR it means that \fIresult\fR
points to an area of memory that is likely to be overwritten when
\fBTcl_SetResult\fR returns (e.g. it points to something in a stack frame).
In this case \fBTcl_SetResult\fR will make a copy of the string in
dynamically allocated storage and arrange for the copy to be the
result for the current Tcl command.
.PP
If \fIfreeProc\fR is not one of the values \fBTCL_STATIC\fR,
\fBTCL_DYNAMIC\fR, and \fBTCL_VOLATILE\fR, then it is the address
of a procedure that Tcl should call to free the string.
This allows applications to use non-standard storage allocators.
When Tcl no longer needs the storage for the string, it will
call \fIfreeProc\fR. \fIFreeProc\fR should have arguments and
result that match the type \fBTcl_FreeProc\fR:
\fIFreeProc\fR has the following type:
.PP
.CS
typedef void \fBTcl_FreeProc\fR(
char *\fIblockPtr\fR);
.CE
.PP
When \fIfreeProc\fR is called, its \fIblockPtr\fR will be set to
the value of \fIresult\fR passed to \fBTcl_SetResult\fR.
When \fIfreeProc\fR is called, \fIblockPtr\fR is the \fIresult\fR value passed
to \fBTcl_SetResult\fR.
.SH "REFERENCE COUNT MANAGEMENT"
.PP
The interpreter result is one of the main places that owns references to
values, along with the bytecode execution stack, argument lists, variables,
and the list and dictionary collection values.
.PP
\fBTcl_SetObjResult\fR takes a value with an arbitrary reference count
\fI(specifically including zero)\fR and guarantees to increment the reference
count. If code wishes to continue using the value after setting it as the
result, it should add its own reference to it with \fBTcl_IncrRefCount\fR.
.PP
\fBTcl_GetObjResult\fR returns the current interpreter result value. This will
have a reference count of at least 1. If the caller wishes to keep the
interpreter result value, it should increment its reference count.
.PP
\fBTcl_GetStringResult\fR does not manipulate reference counts, but the string
it returns is owned by (and has a lifetime controlled by) the current
interpreter result value; it should be copied instead of being relied upon to
persist after the next Tcl API call, as most Tcl operations can modify the
interpreter result.
.PP
\fBTcl_SetResult\fR, \fBTcl_AppendResult\fR, \fBTcl_AppendResultVA\fR,
\fBTcl_AppendElement\fR, and \fBTcl_ResetResult\fR all modify the interpreter
result. They may cause the old interpreter result to have its reference count
decremented and a new interpreter result to be allocated. After they have been
called, the reference count of the interpreter result is guaranteed to be 1.
.SH "SEE ALSO"
Tcl_AddErrorInfo, Tcl_CreateObjCommand, Tcl_SetErrorCode, Tcl_Interp,
Tcl_GetReturnOptions
+8 -8
View File
@@ -20,16 +20,16 @@ int
char *
\fBTcl_Merge\fR(\fIargc, argv\fR)
.sp
size_t
Tcl_Size
\fBTcl_ScanElement\fR(\fIsrc, flagsPtr\fR)
.sp
size_t
Tcl_Size
\fBTcl_ScanCountedElement\fR(\fIsrc, length, flagsPtr\fR)
.sp
size_t
Tcl_Size
\fBTcl_ConvertElement\fR(\fIsrc, dst, flags\fR)
.sp
size_t
Tcl_Size
\fBTcl_ConvertCountedElement\fR(\fIsrc, length, dst, flags\fR)
.SH ARGUMENTS
.AS "const char *const" ***argvPtr out
@@ -38,14 +38,14 @@ Interpreter to use for error reporting. If NULL, then no error message
is left.
.AP "const char" *list in
Pointer to a string with proper list structure.
.AP "size_t \&| int" *argcPtr out
.AP "Tcl_Size \&| int" *argcPtr out
Filled in with number of elements in \fIlist\fR.
.AP "const char" ***argvPtr out
\fI*argvPtr\fR will be filled in with the address of an array of
pointers to the strings that are the extracted elements of \fIlist\fR.
There will be \fI*argcPtr\fR valid entries in the array, followed by
a NULL entry.
.AP size_t argc in
.AP Tcl_Size argc in
Number of elements in \fIargv\fR.
.AP "const char *const" *argv in
Array of strings to merge together into a single list.
@@ -55,7 +55,7 @@ String that is to become an element of a list.
.AP int *flagsPtr in
Pointer to word to fill in with information about \fIsrc\fR.
The value of *\fIflagsPtr\fR must be passed to \fBTcl_ConvertElement\fR.
.AP size_t length in
.AP Tcl_Size length in
Number of bytes in string \fIsrc\fR.
.AP char *dst in
Place to copy converted list element. Must contain enough characters
@@ -81,7 +81,7 @@ For example, suppose that you have called \fBTcl_SplitList\fR with
the following code:
.PP
.CS
size_t argc;
Tcl_Size argc;
int code;
char *string;
char **argv;
+3 -3
View File
@@ -25,14 +25,14 @@ Tcl_PathType
.AP "const char" *path in
File path in a form appropriate for the current platform (see the
\fBfilename\fR manual entry for acceptable forms for path names).
.AP "size_t \&| int" *argcPtr out
.AP "Tcl_Size \&| int" *argcPtr out
Filled in with number of path elements in \fIpath\fR.
.AP "const char" ***argvPtr out
\fI*argvPtr\fR will be filled in with the address of an array of
pointers to the strings that are the extracted elements of \fIpath\fR.
There will be \fI*argcPtr\fR valid entries in the array, followed by
a NULL entry.
.AP size_t argc in
.AP Tcl_Size argc in
Number of elements in \fIargv\fR.
.AP "const char *const" *argv in
Array of path elements to merge together into a single path.
@@ -61,7 +61,7 @@ For example, suppose that you have called \fBTcl_SplitPath\fR with the
following code:
.PP
.CS
size_t argc;
Tcl_Size argc;
char *path;
char **argv;
\&...
+21 -24
View File
@@ -40,7 +40,7 @@ Tcl_UniChar *
int
\fBTcl_GetUniChar\fR(\fIobjPtr, index\fR)
.sp
size_t
Tcl_Size
\fBTcl_GetCharLength\fR(\fIobjPtr\fR)
.sp
Tcl_Obj *
@@ -87,46 +87,43 @@ Tcl_Obj *
Points to the first byte of an array of UTF-8-encoded bytes
used to set or append to a string value.
This byte array may contain embedded null characters
unless \fInumChars\fR is \fBTCL_INDEX_NONE\fR. (Applications needing null bytes
unless \fInumChars\fR is negative. (Applications needing null bytes
should represent them as the two-byte sequence \fI\e300\e200\fR, use
\fBTcl_ExternalToUtf\fR to convert, or \fBTcl_NewByteArrayObj\fR if
the string is a collection of uninterpreted bytes.)
.AP size_t length in
.AP Tcl_Size length in
The number of bytes to copy from \fIbytes\fR when
initializing, setting, or appending to a string value.
If \fBTCL_INDEX_NONE\fR, all bytes up to the first null are used.
If negative, all bytes up to the first null are used.
.AP "const Tcl_UniChar" *unicode in
Points to the first byte of an array of Unicode characters
used to set or append to a string value.
This byte array may contain embedded null characters
unless \fInumChars\fR is \fBTCL_INDEX_NONE\fR.
.AP size_t numChars in
unless \fInumChars\fR is negative.
.AP Tcl_Size numChars in
The number of Unicode characters to copy from \fIunicode\fR when
initializing, setting, or appending to a string value.
If \fBTCL_INDEX_NONE\fR, all characters up to the first null character are used.
.AP size_t index in
If negative, all characters up to the first null character are used.
.AP Tcl_Size index in
The index of the Unicode character to return.
.AP size_t first in
.AP Tcl_Size first in
The index of the first Unicode character in the Unicode range to be
returned as a new value. If \fBTCL_INDEX_NONE\fR, behave the same as if the
returned as a new value. If negative, behave the same as if the
value was 0.
.AP size_t last in
.AP Tcl_Size last in
The index of the last Unicode character in the Unicode range to be
returned as a new value. If \fBTCL_INDEX_NONE\fR, take all characters up to
returned as a new value. If negative, take all characters up to
the last one available.
.AP Tcl_Obj *objPtr in/out
Points to a value to manipulate.
A pointer to a value to read, or to an unshared value to modify.
.AP Tcl_Obj *appendObjPtr in
The value to append to \fIobjPtr\fR in \fBTcl_AppendObjToObj\fR.
.AP "size_t \&| int" *lengthPtr out
.AP "Tcl_Size \&| int" *lengthPtr out
The location where \fBTcl_GetStringFromObj\fR will store the length
of a value's string representation. May be (int *)NULL when not used.
.AP "const char" *string in
Null-terminated string value to append to \fIobjPtr\fR.
.AP va_list argList in
An argument list which must have been initialized using
\fBva_start\fR, and cleared using \fBva_end\fR.
.AP size_t limit in
.AP Tcl_Size limit in
Maximum number of bytes to be appended.
.AP "const char" *ellipsis in
Suffix to append when the limit leads to string truncation.
@@ -135,11 +132,11 @@ If NULL is passed then the suffix
is used.
.AP "const char" *format in
Format control string including % conversion specifiers.
.AP size_t objc in
.AP Tcl_Size objc in
The number of elements to format or concatenate.
.AP Tcl_Obj *objv[] in
The array of values to format or concatenate.
.AP size_t newLength in
.AP Tcl_Size newLength in
New length for the string value of \fIobjPtr\fR, not including the
final null character.
.BE
@@ -213,8 +210,8 @@ it references a low surrogate preceded by a high surrogate, it returns -1;
characters between \fIfirst\fR and \fIlast\fR (inclusive) in the value's
Unicode representation. If the value's Unicode representation
is invalid, the Unicode representation is regenerated from the value's
string representation. If \fIfirst\fR == TCL_INDEX_NONE, then the returned
string starts at the beginning of the value. If \fIlast\fR == TCL_INDEX_NONE,
string representation. If \fIfirst\fR is negative, then the returned
string starts at the beginning of the value. If \fIlast\fR negative,
then the returned string ends at the end of the value.
.PP
\fBTcl_GetCharLength\fR returns the number of characters (as opposed
@@ -263,7 +260,7 @@ all \fIlength\fR bytes that are available from being appended, then the
appending is done so that the last bytes appended are from the
string \fIellipsis\fR. This allows for an indication of the truncation
to be left in the string.
When \fIlength\fR is \fBTCL_INDEX_NONE\fR, all bytes up to the first zero byte are appended,
When \fIlength\fR is negative, all bytes up to the first zero byte are appended,
subject to the limit. When \fIellipsis\fR is NULL, the default
string \fB...\fR is used. When \fIellipsis\fR is non-NULL, it must point
to a zero-byte-terminated string in Tcl's internal UTF encoding.
@@ -306,7 +303,7 @@ functionality is needed.
.CS
char buf[SOME_SUITABLE_LENGTH];
sprintf(buf, format, ...);
\fBTcl_NewStringObj\fR(buf, \fBTCL_INDEX_NONE\fR);
\fBTcl_NewStringObj\fR(buf, -1);
.CE
.PP
but with greater convenience and no need to
+1 -1
View File
@@ -24,7 +24,7 @@ message.
.AP Tcl_Obj *objPtr in
A Tcl value containing the string to perform substitutions on.
.AP int flags in
ORed combination of flag bits that specify which substitutions to
OR'ed combination of flag bits that specify which substitutions to
perform. The flags \fBTCL_SUBST_COMMANDS\fR,
\fBTCL_SUBST_VARIABLES\fR and \fBTCL_SUBST_BACKSLASHES\fR are
currently supported, and \fBTCL_SUBST_ALL\fR is provided as a
+4 -4
View File
@@ -88,7 +88,7 @@ The initial value for the checksum algorithm.
.AP "unsigned char" *bytes in
An array of bytes to run the checksum algorithm over, or NULL to get the
recommended initial value for the checksum algorithm.
.AP size_t length in
.AP Tcl_Size length in
The number of bytes in the array.
.AP int mode in
What mode to operate the stream in. Should be either
@@ -107,8 +107,8 @@ if the currently compressed data must be made available for access using
into a state where the decompressor can recover from on corruption, or
\fBTCL_ZLIB_FINALIZE\fR to ensure that the stream is finished and that any
trailer demanded by the format is written.
.AP size_t count in
The maximum number of bytes to get from the stream, or TCL_INDEX_NONE to get
.AP Tcl_Size count in
The maximum number of bytes to get from the stream, or -1 to get
all remaining bytes from the stream's buffers.
.AP Tcl_Obj *compDict in
A byte array value that is the compression dictionary to use with the stream.
@@ -188,7 +188,7 @@ is used to initialize the compression engine rather than leaving it to create
it on the fly from the data being compressed. Setting a compression dictionary
allows for more efficient compression in the case where the start of the data
is highly regular, but it does require both the compressor and the
decompressor to agreee on the value to use. Compression dictionaries are only
decompressor to agree on the value to use. Compression dictionaries are only
fully supported for zlib-format data; on compression, they must be set before
any data is sent in with \fBTcl_ZlibStreamPut\fR, and on decompression they
should be set when \fBTcl_ZlibStreamGet\fR produces an \fBerror\fR with its
+1 -1
View File
@@ -29,7 +29,7 @@ Tcl_Obj *
\fBTcl_SetMainLoop\fR(\fImainLoopProc\fR)
.SH ARGUMENTS
.AS Tcl_MainLoopProc *mainLoopProc
.AP size_t argc in
.AP Tcl_Size argc in
Number of elements in \fIargv\fR.
.AP char *argv[] in
Array of strings containing command-line arguments. On Windows, when
+1 -1
View File
@@ -69,7 +69,7 @@ This procedure will act as the \fBmain()\fR of the newly created
thread. The specified \fIclientData\fR will be its sole argument.
.AP void *clientData in
Arbitrary information. Passed as sole argument to the \fIproc\fR.
.AP int stackSize in
.AP size_t stackSize in
The size of the stack given to the new thread.
.AP int flags in
Bitmask containing flags allowing the caller to modify behavior of
+3 -3
View File
@@ -22,13 +22,13 @@ int
int
\fBTcl_UniCharToTitle\fR(\fIch\fR)
.sp
size_t
Tcl_Size
\fBTcl_UtfToUpper\fR(\fIstr\fR)
.sp
size_t
Tcl_Size
\fBTcl_UtfToLower\fR(\fIstr\fR)
.sp
size_t
Tcl_Size
\fBTcl_UtfToTitle\fR(\fIstr\fR)
.SH ARGUMENTS
.AS char *str in/out
+1 -2
View File
@@ -21,8 +21,7 @@ char *
.AP Tcl_Interp *interp in
Interpreter in which to report an error, if any.
.AP "const char" *name in
File name, which may start with a
.QW ~ .
File name
.AP Tcl_DString *bufferPtr in/out
If needed, this dynamic string is used to store the new file name.
At the time of the call it should be uninitialized or free. The
+12 -12
View File
@@ -15,16 +15,16 @@ Tcl_UniChar, Tcl_UniCharToUtf, Tcl_UtfToUniChar, Tcl_UtfToChar16, Tcl_UtfToWChar
.sp
typedef ... \fBTcl_UniChar\fR;
.sp
size_t
Tcl_Size
\fBTcl_UniCharToUtf\fR(\fIch, buf\fR)
.sp
size_t
Tcl_Size
\fBTcl_UtfToUniChar\fR(\fIsrc, chPtr\fR)
.sp
size_t
Tcl_Size
\fBTcl_UtfToChar16\fR(\fIsrc, uPtr\fR)
.sp
size_t
Tcl_Size
\fBTcl_UtfToWChar\fR(\fIsrc, wPtr\fR)
.sp
char *
@@ -93,7 +93,7 @@ int
const char *
\fBTcl_UtfAtIndex\fR(\fIsrc, index\fR)
.sp
size_t
Tcl_Size
\fBTcl_UtfBackslash\fR(\fIsrc, readPtr, dst\fR)
.SH ARGUMENTS
.AS "const Tcl_UniChar" *uniPattern in/out
@@ -132,16 +132,16 @@ A null-terminated utf-16 string.
A null-terminated utf-16 string.
.AP "const unsigned short" *utf16Pattern in
A null-terminated utf-16 string.
.AP size_t length in
.AP Tcl_Size length in
The length of the UTF-8 string in bytes (not UTF-8 characters). If
TCL_INDEX_NONE, all bytes up to the first null byte are used.
.AP size_t uniLength in
negative, all bytes up to the first null byte are used.
.AP Tcl_Size uniLength in
The length of the Unicode string in characters.
.AP "Tcl_DString" *dsPtr in/out
A pointer to a previously initialized \fBTcl_DString\fR.
.AP "const char" *start in
Pointer to the beginning of a UTF-8 string.
.AP size_t index in
.AP Tcl_Size index in
The index of a character (not byte) in the UTF-8 string.
.AP int *readPtr out
If non-NULL, filled with the number of bytes in the backslash sequence,
@@ -254,7 +254,7 @@ know if a full Unicode character has been seen.
\fBTcl_NumUtfChars\fR corresponds to \fBstrlen\fR for UTF-8 strings. It
returns the number of Tcl_UniChars that are represented by the UTF-8 string
\fIsrc\fR. The length of the source string is \fIlength\fR bytes. If the
length is TCL_INDEX_NONE, all bytes up to the first null byte are used.
length is negative, all bytes up to the first null byte are used.
.PP
\fBTcl_UtfFindFirst\fR corresponds to \fBstrchr\fR for UTF-8 strings. It
returns a pointer to the first occurrence of the Unicode character \fIch\fR
@@ -299,13 +299,13 @@ byte \fIsrc[0]\fR nor the byte \fIstart[-1]\fR nor the byte
Pascal Ord() function. It returns the Unicode character represented at the
specified character (not byte) \fIindex\fR in the UTF-8 string
\fIsrc\fR. The source string must contain at least \fIindex\fR
characters. If \fIindex\fR is TCL_INDEX_NONE or \fIindex\fR points
characters. If \fIindex\fR is negative or \fIindex\fR points
to the second half of a surrogate pair, it returns -1.
.PP
\fBTcl_UtfAtIndex\fR returns a pointer to the specified character (not
byte) \fIindex\fR in the UTF-8 string \fIsrc\fR. The source string must
contain at least \fIindex\fR characters. This is equivalent to calling
\fBTcl_UtfToUniChar\fR \fIindex\fR times. If \fIindex\fR is TCL_INDEX_NONE,
\fBTcl_UtfToUniChar\fR \fIindex\fR times. If \fIindex\fR is negative,
the return pointer points to the first character in the source string.
.PP
\fBTcl_UtfBackslash\fR is a utility procedure used by several of the Tcl
+1 -1
View File
@@ -19,7 +19,7 @@ Tcl_WrongNumArgs \- generate standard error message for wrong number of argument
.AP Tcl_Interp interp in
Interpreter in which error will be reported: error message gets stored
in its result value.
.AP size_t objc in
.AP Tcl_Size objc in
Number of leading arguments from \fIobjv\fR to include in error
message.
.AP "Tcl_Obj *const" objv[] in
+1 -1
View File
@@ -28,7 +28,7 @@ and all threads.
Change to the home directory of the user \fBfred\fR:
.PP
.CS
\fBcd\fR ~fred
\fBcd\fR [file home fred]
.CE
.PP
Change to the directory \fBlib\fR that is a sibling directory of the
+29 -19
View File
@@ -55,7 +55,9 @@ channel is flushed in the background before finally being closed.
.PP
\fBchan close\fR may return an error if an error occurs while flushing
output. If a process in a command pipeline created by \fBopen\fR returns an
error, \fBchan close\fR generates an error in the same manner as \fBexec\fR.
error (either by returning a non-zero exit code or writing to its standard
error file descriptor), \fBchan close\fR generates an error in the same
manner as \fBexec\fR.
.PP
Closing one side of a socket or command pipeline may lead to the shutdown() or
close() of the underlying system resource, leading to a reaction from whatever
@@ -70,6 +72,17 @@ description of channel sharing.
.PP
When the last interpreter sharing a channel is destroyed, the channel is
switched to blocking mode and fully flushed and then closed.
.PP
Channels are automatically closed when an interpreter is destroyed and
when the process exits.
From 8.6 on (TIP#398), nonblocking channels are no longer switched to
blocking mode when exiting; this guarantees a timely exit even when the
peer or a communication channel is stalled. To ensure proper flushing of
stalled nonblocking channels on exit, one must now either (a) actively
switch them back to blocking or (b) use the environment variable
\fBTCL_FLUSH_NONBLOCKING_ON_EXIT\fR, which when set and not equal to
.QW \fB0\fR
restores the previous behavior.
.RE
.TP
\fBchan configure \fIchannelName\fR ?\fIoptionName\fR? ?\fIvalue\fR? ?\fIoptionName value\fR?...
@@ -124,18 +137,8 @@ returned by \fBencoding names\fR, or
from Unicode to the encoding.
.RS
.PP
\fBbinary\fR is an alias for \fBiso8859-1\fR: Each byte read from the
channel becomes the Unicode character having the same value as that byte, and
each character written to the channel becomes a single byte in the output,
allowing Tcl to work seamlessly with binary data as long as each "character" in
the data remains in the range of 0 to 255 so that there is no distinction between
binary data and text. For example, A JPEG image can be read from a
\fBbinary\fR channel, manipulated, and then written back to a \fBbinary\fR
channel.
For working with binary data \fB\-translation binary\fR is usually used
instead, as it sets the encoding to \fBbinary\fR and also disables other
translations on the channel.
\fBbinary\fR is an alias for \fBiso8859-1\fR. This alone is not sufficient for
working with binary data. Use \fB\-translation binary\fR instead.
.PP
The encoding of a new channel is the value of \fBencoding system\fR,
which returns the platform- and locale-dependent system encoding used to
@@ -196,10 +199,17 @@ platforms it is \fBcrlf\fR for both input and output.
.TP
\fBbinary\fR
.
Like \fBlf\fR, no end-of-line translation is performed, but in addition,
\fB\-eofchar\fR is set to the empty string to disable it, and \fB\-encoding\fR
is set to \fBbinary\fR. With this one setting, a channel is fully configured
for binary input and output.
Like \fBlf\fR, no end-of-line translation is performed, but in addition, sets
\fB\-eofchar\fR to the empty string to disable it, sets \fB\-encoding\fR to
\fBiso8859-1\fR, and sets \fB-profile\fR to \fBstrict\fR so the the channel is
fully configured for binary input and output: Each byte read from the channel
becomes the Unicode character having the same value as that byte, and each
character written to the channel becomes a single byte in the output. This
makes it possible to work seamlessly with binary data as long as each character
in the data remains in the range of 0 to 255 so that there is no distinction
between binary data and text. For example, A JPEG image can be read from a
such a channel, manipulated, and then written back to such a channel.
.TP
\fBcr\fR
.
@@ -351,8 +361,8 @@ first words of a command that provides the interface for a \fBrefchan\fR.
\fBImode\fR is a list of one or more of the strings
.QW \fBread\fR
or
.QW \fBwrite\fR
, indicating whether the channel is a read channel, a write channel, or both.
.QW \fBwrite\fR ,
indicating whether the channel is a read channel, a write channel, or both.
It is an error if the handler does not support the chosen mode.
.PP
The handler is called as needed from the global namespace at the top level, and
+15 -6
View File
@@ -12,11 +12,12 @@
.SH NAME
close \- Close an open channel
.SH SYNOPSIS
\fBclose \fIchannelId\fR ?r(ead)|w(rite)?
\fBclose \fIchannelId\fR ?\fBr\fR(\fBead\fR)|\fBw\fR(\fBrite\fR)?
.BE
.SH DESCRIPTION
.PP
Closes or half-closes the channel given by \fIchannelId\fR.
Closes or half-closes the channel given by \fIchannelId\fR. \fBchan close\fR
is another name for this command.
.PP
\fIChannelId\fR must be an identifier for an open channel such as a
Tcl standard channel (\fBstdin\fR, \fBstdout\fR, or \fBstderr\fR),
@@ -49,12 +50,20 @@ When the last interpreter in which the channel is registered invokes
.PP
Channels are automatically closed when an interpreter is destroyed and
when the process exits.
From 8.6 on (TIP#398), nonblocking channels are no longer switched to blocking mode when exiting; this guarantees a timely exit even when the peer or a communication channel is stalled. To ensure proper flushing of stalled nonblocking channels on exit, one must now either (a) actively switch them back to blocking or (b) use the environment variable TCL_FLUSH_NONBLOCKING_ON_EXIT, which when set and not equal to "0" restores the previous behavior.
From 8.6 on (TIP#398), nonblocking channels are no longer switched to
blocking mode when exiting; this guarantees a timely exit even when the
peer or a communication channel is stalled. To ensure proper flushing of
stalled nonblocking channels on exit, one must now either (a) actively
switch them back to blocking or (b) use the environment variable
\fBTCL_FLUSH_NONBLOCKING_ON_EXIT\fR, which when set and not equal to
.QW \fB0\fR
restores the previous behavior.
.PP
The command returns an empty string, and may generate an error if
an error occurs while flushing output. If a command in a command
pipeline created with \fBopen\fR returns an error, \fBclose\fR
generates an error (similar to the \fBexec\fR command.)
pipeline created with \fBopen\fR returns an error (either by returning a
non-zero exit code or writing to its standard error file descriptor),
\fBclose\fR generates an error (similar to the \fBexec\fR command.)
.PP
The two-argument form is a
.QW "half-close" :
@@ -95,7 +104,7 @@ proc withOpenFile {filename channelVar script} {
}
.CE
.SH "SEE ALSO"
file(n), open(n), socket(n), eof(n), Tcl_StandardChannels(3)
chan(n), file(n), open(n), socket(n), eof(n), Tcl_StandardChannels(3)
.SH KEYWORDS
blocking, channel, close, nonblocking, half-close
'\" Local Variables:
+333
View File
@@ -0,0 +1,333 @@
'\"
'\" Copyright © 2019 Donal K. Fellows
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
.TH configurable n 0.4 TclOO "TclOO Commands"
.so man.macros
.BS
'\" Note: do not modify the .SH NAME line immediately below!
.SH NAME
oo::configurable, configure, property \- class that makes configurable classes and objects, and supports making configurable properties
.SH SYNOPSIS
.nf
package require TclOO
\fBoo::configurable create \fIclass\fR ?\fIdefinitionScript\fR?
\fBoo::define \fIclass\fB {\fR
\fBproperty \fIpropName\fR ?\fIoptions...\fR? ?\fIpropName\fR ?\fIoptions...\fR?...?
\fB}\fR
\fBoo::objdefine \fIobject\fB {\fR
\fBproperty \fIpropName\fR ?\fIoptions...\fR? ?\fIpropName\fR ?\fIoptions...\fR?...?
\fB}\fR
\fIobjectName \fBconfigure\fR
\fIobjectName \fBconfigure\fR \fI\-prop\fR
\fIobjectName \fBconfigure\fR \fI\-prop value\fR ?\fI\-prop value\fR...
.fi
.SH "CLASS HIERARCHY"
.nf
\fBoo::object\fR
\(-> \fBoo::class\fR
\(-> \fBoo::configurable\fR
\fBoo::object\fR
\(-> \fBoo::class\fR
\(-> \fBoo::configurablesupport::configurable\fR
.fi
.BE
.SH DESCRIPTION
.PP
Configurable objects are objects that support being configured with a
\fBconfigure\fR method. Each of the configurable entities of the object is
known as a property of the object. Properties may be defined on classes or
instances; when configuring an object, any of the properties defined by its
classes (direct or indirect) or by the instance itself may be configured.
.PP
The \fBoo::configurable\fR metaclass installs basic support for making
configurable objects into a class. This consists of making a \fBproperty\fR
definition command available in definition scripts for the class and instances
(e.g., from the class's constructor, within \fBoo::define\fR and within
\fBoo::objdefine\fR) and making a \fBconfigure\fR method available within the
instances.
.SS "CONFIGURE METHOD"
.PP
The behavior of the \fBconfigure\fR method is modelled after the
\fBfconfigure\fR/\fBchan configure\fR command.
.PP
If passed no additional arguments, the \fBconfigure\fR method returns an
alphabetically sorted dictionary of all \fIreadable\fR and \fIread-write\fR
properties and their current values.
.PP
If passed a single additional argument, that argument to the \fBconfigure\fR
method must be the name of a property to read (or an unambiguous prefix
thereof); its value is returned.
.PP
Otherwise, if passed an even number of arguments then each pair of arguments
specifies a property name (or an unambiguous prefix thereof) and the value to
set it to. The properties will be set in the order specified, including
duplicates. If the setting of any property fails, the overall \fBconfigure\fR
method fails, the preceding pairs (if any) will continue to have been applied,
and the succeeding pairs (if any) will be not applied. On success, the result
of the \fBconfigure\fR method in this mode operation will be an empty string.
.SS "PROPERTY DEFINITIONS"
.PP
When a class has been manufactured by the \fBoo::configurable\fR metaclass (or
one of its subclasses), it gains an extra definition, \fBproperty\fR. The
\fBproperty\fR definition defines one or more properties that will be exposed
by the class's instances.
.PP
The \fBproperty\fR command takes the name of a property to define first,
\fIwithout a leading hyphen\fR, followed by a number of option-value pairs
that modify the basic behavior of the property. This can then be followed by
an arbitrary number of other property definitions. The supported options are:
.TP
\fB\-get \fIgetterScript\fR
.
This defines the implementation of how to read from the property; the
\fIgetterScript\fR will become the body of a method (taking no arguments)
defined on the class, if the kind of the property is such that the property
can be read from. The method will be named
\fB<ReadProp-\fIpropertyName\fB>\fR, and will default to being a simple read
of the instance variable with the same name as the property (e.g.,
.QW "\fBproperty\fR xyz"
will result in a method
.QW <ReadProp-xyz>
being created).
.TP
\fB\-kind \fIpropertyKind\fR
.
This defines what sort of property is being created. The \fIpropertyKind\fR
must be exactly one of \fBreadable\fR, \fBwritable\fR, or \fBreadwrite\fR
(which is the default) which will make the property read-only, write-only or
read-write, respectively. Read-only properties can only ever be read from,
write-only properties can only ever be written to, and read-write properties
can be both read and written.
.RS
.PP
Note that write-only properties are not particularly discoverable as they are
never reported by the \fBconfigure\fR method other than by error messages when
attempting to write to a property that does not exist.
.RE
.TP
\fB\-set \fIsetterScript\fR
.
This defines the implementation of how to write to the property; the
\fIsetterScript\fR will become the body of a method taking a single argument,
\fIvalue\fR, defined on the class, if the kind of the property is such that
the property can be written to. The method will be named
\fB<WriteProp-\fIpropertyName\fB>\fR, and will default to being a simple write
of the instance variable with the same name as the property (e.g.,
.QW "\fBproperty\fR xyz"
will result in a method
.QW <WriteProp-xyz>
being created).
.PP
Instances of the class that was created by \fBoo::configurable\fR will also
support \fBproperty\fR definitions; the semantics will be exactly as above
except that the properties will be defined on the instance alone.
.PP
Note that the property implementation methods that \fBproperty\fR defines
should not be private, as this makes them inaccessible from the implementation
of \fBconfigure\fR (by design; the property configuration mechanism is
intended for use mainly from outside a class, whereas a class may access
variables directly). The variables accessed by the default implementations of
the properties \fImay\fR be private, if so declared.
.SH "ADVANCED USAGE"
.PP
The configurable class system is comprised of several pieces. The
\fBoo::configurable\fR metaclass works by mixing in a class and setting
definition namespaces during object creation that provide the other bits and
pieces of machinery. The key pieces of the implementation are enumerated here
so that they can be used by other code:
.TP
\fBoo::configuresupport::configurable\fR
.
This is a class that provides the implementation of the \fBconfigure\fR method
(described above in \fBCONFIGURE METHOD\fR).
.TP
\fBoo::configuresupport::configurableclass\fR
.
This is a namespace that contains the definition dialect that provides the
\fBproperty\fR declaration for use in classes (i.e., via \fBoo::define\fR, and
class constructors under normal circumstances), as described above in
\fBPROPERTY DEFINITIONS\fR. It \fBnamespace export\fRs its \fBproperty\fR
command so that it may be used easily in user definition dialects.
.TP
\fBoo::configuresupport::configurableobject\fR
.
This is a namespace that contains the definition dialect that provides the
\fBproperty\fR declaration for use in instance objects (i.e., via
\fBoo::objdefine\fR, and the \fBself\fR declaration in \fBoo::define\fR), as
described above in \fBPROPERTY DEFINITIONS\fR. It \fBnamespace export\fRs its
\fBproperty\fR command so that it may be used easily in user definition
dialects.
.PP
The underlying property discovery mechanism relies on four slots (see
\fBoo::define\fR for what that implies) that list the properties that can be
configured. These slots do not themselves impose any semantics on what the
slots mean other than that they have unique names, no important order, can be
inherited and discovered on classes and instances.
.PP
These slots, and their intended semantics, are:
.TP
\fBoo::configuresupport::readableproperties\fR
.
The set of properties of a class (not including those from its superclasses)
that may be read from when configuring an instance of the class. This slot can
also be read with the \fBinfo class properties\fR command.
.TP
\fBoo::configuresupport::writableproperties\fR
.
The set of properties of a class (not including those from its superclasses)
that may be written to when configuring an instance of the class. This slot
can also be read with the \fBinfo class properties\fR command.
.TP
\fBoo::configuresupport::objreadableproperties\fR
.
The set of properties of an object instance (not including those from its
classes) that may be read from when configuring the object. This slot can
also be read with the \fBinfo object properties\fR command.
.TP
\fBoo::configuresupport::objwritableproperties\fR
.
The set of properties of an object instance (not including those from its
classes) that may be written to when configuring the object. This slot can
also be read with the \fBinfo object properties\fR command.
.PP
Note that though these are slots, they are \fInot\fR in the standard
\fBoo::define\fR or \fBoo::objdefine\fR namespaces; in order to use them
inside a definition script, they need to be referred to by full name. This is
because they are intended to be building bricks of configurable property
system, and not directly used by normal user code.
.SS "IMPLEMENTATION NOTE"
.PP
The implementation of the \fBconfigure\fR method uses
\fBinfo object properties\fR with the \fB\-all\fR option to discover what
properties it may manipulate.
.SH EXAMPLES
.PP
Here we create a simple configurable class and demonstrate how it can be
configured:
.PP
.CS
\fBoo::configurable\fR create Point {
\fBproperty\fR x y
constructor args {
my \fBconfigure\fR -x 0 -y 0 {*}$args
}
variable x y
method print {} {
puts "x=$x, y=$y"
}
}
set pt [Point new -x 27]
$pt print; \fI# x=27, y=0\fR
$pt \fBconfigure\fR -y 42
$pt print; \fI# x=27, y=42\fR
puts "distance from origin: [expr {
hypot([$pt \fBconfigure\fR -x], [$pt \fBconfigure\fR -y])
}]"; \fI# distance from origin: 49.92995093127971\fR
puts [$pt \fBconfigure\fR]
\fI# -x 27 -y 42\fR
.CE
.PP
Such a configurable class can be extended by subclassing, though the subclass
needs to also be created by \fBoo::configurable\fR if it will use the
\fBproperty\fR definition:
.PP
.CS
\fBoo::configurable\fR create Point3D {
superclass Point
\fBproperty\fR z
constructor args {
next -z 0 {*}$args
}
}
set pt2 [Point3D new -x 2 -y 3 -z 4]
puts [$pt2 \fBconfigure\fR]
\fI# -x 2 -y 3 -z 4\fR
.CE
.PP
Once you have a configurable class, you can also add instance properties to
it. (The backing variables for all properties start unset.) Note below that we
are using an unambiguous prefix of a property name when setting it; this is
supported for all properties though full names are normally recommended
because subclasses will not make an unambiguous prefix become ambiguous in
that case.
.PP
.CS
oo::objdefine $pt {
\fBproperty\fR color
}
$pt \fBconfigure\fR -c bisque
puts [$pt \fBconfigure\fR]
\fI# -color bisque -x 27 -y 42\fR
.CE
.PP
You can also do derived properties by making them read-only and supplying a
script that computes them.
.PP
.CS
\fBoo::configurable\fR create PointMk2 {
\fBproperty\fR x y
\fBproperty\fR distance -kind readable -get {
return [expr {hypot($x, $y)}]
}
variable x y
constructor args {
my \fBconfigure\fR -x 0 -y 0 {*}$args
}
}
set pt3 [PointMk2 new -x 3 -y 4]
puts [$pt3 \fBconfigure\fR -distance]
\fI# 5.0\fR
$pt3 \fBconfigure\fR -distance 10
\fI# ERROR: bad property "-distance": must be -x or -y\fR
.CE
.PP
Setters are used to validate the type of a property:
.PP
.CS
\fBoo::configurable\fR create PointMk3 {
\fBproperty\fR x -set {
if {![string is double -strict $value]} {
error "-x property must be a number"
}
set x $value
}
\fBproperty\fR y -set {
if {![string is double -strict $value]} {
error "-y property must be a number"
}
set y $value
}
variable x y
constructor args {
my \fBconfigure\fR -x 0 -y 0 {*}$args
}
}
set pt4 [PointMk3 new]
puts [$pt4 \fBconfigure\fR]
\fI# -x 0 -y 0\fR
$pt4 \fBconfigure\fR -x 3 -y 4
puts [$pt4 \fBconfigure\fR]
\fI# -x 3 -y 4\fR
$pt4 \fBconfigure\fR -x "obviously not a number"
\fI# ERROR: -x property must be a number\fR
.CE
.SH "SEE ALSO"
info(n), oo::class(n), oo::define(n)
.SH KEYWORDS
class, object, properties, configuration
.\" Local variables:
.\" mode: nroff
.\" fill-column: 78
.\" End:
+2 -2
View File
@@ -178,7 +178,7 @@ the start of the application.
package require http
\fBpackage require cookiejar\fR
set cookiedb ~/.tclcookies.db
set cookiedb [file join [file home] cookiejar]
http::configure -cookiejar [\fBhttp::cookiejar new\fR $cookiedb]
# No further explicit steps are required to use cookies
@@ -201,7 +201,7 @@ oo::class create MyCookieJar {
}
}
set cookiedb ~/.tclcookies.db
set cookiedb [file join [file home] cookiejar]
http::configure -cookiejar [MyCookieJar new $cookiedb]
# No further explicit steps are required to use cookies
+6
View File
@@ -493,6 +493,12 @@ the slot:
.
This appends the given \fImember\fR elements to the slot definition.
.TP
\fIslot\fR \fB\-appendifnew\fR ?\fImember ...\fR?
.VS TIP558
This appends the given \fImember\fR elements to the slot definition if they
do not already exist.
.VE TIP558
.TP
\fIslot\fR \fB\-clear\fR
.
This sets the slot definition to the empty list.
+1
View File
@@ -1,5 +1,6 @@
'\"
'\" Copyright (c) 1998 Scriptics Corporation.
'\" Copyright (c) 2023 Nathan Coulter
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+1 -1
View File
@@ -449,7 +449,7 @@ encrypted so that only the current user can access it requires use of
the \fICIPHER\fR command, like this:
.PP
.CS
set secureDir "~/Desktop/Secure Directory"
set secureDir [file join [file home] Desktop/SecureDirectory]
file mkdir $secureDir
\fBexec\fR CIPHER /e /s:[file nativename $secureDir]
.CE
+2 -5
View File
@@ -242,10 +242,7 @@ must be relative to the actual \fIlinkName\fR's location (not to the
cwd), but on all other platforms where relative links are not supported,
target paths will always be converted to absolute, normalized form
before the link is created (and therefore relative paths are interpreted
as relative to the cwd). Furthermore,
.QW ~user
paths are always expanded
to absolute form. When creating links on filesystems that either do not
as relative to the cwd). When creating links on filesystems that either do not
support any links, or do not support the specific type requested, an
error message will be returned. Most Unix platforms support both
symbolic and hard links (the latter for files only). Windows
@@ -571,7 +568,7 @@ interface) but the name passed to the operating system must be in
native format:
.PP
.CS
exec {*}[auto_execok start] {} [\fBfile nativename\fR ~/example.txt]
exec {*}[auto_execok start] {} [\fBfile nativename\fR C:/Users/fred/example.txt]
.CE
.SH "SEE ALSO"
filename(n), open(n), close(n), eof(n), gets(n), tell(n), seek(n),
+3 -19
View File
@@ -72,7 +72,7 @@ is equivalent to
.QW "\fBset pwd [pwd]; cd $dir; glob *; cd $pwd\fR" .
For \fB\-path\fR specifications, the returned names will include the last
path segment, so
.QW "\fBglob \-tails \-path [file rootname ~/foo.tex] .*\fR"
.QW "\fBglob \-tails \-path [file rootname /home/fred/foo.tex] .*\fR"
will return paths like \fBfoo.aux foo.bib foo.tex\fR etc.
.TP
\fB\-types\fR \fItypeList\fR
@@ -168,16 +168,6 @@ which must be matched explicitly (this is to avoid a recursive pattern like
from recursing up the directory hierarchy as well as down). In addition, all
.QW /
characters must be matched explicitly.
.LP
If the first character in a \fIpattern\fR is
.QW ~
then it refers to the home directory for the user whose name follows the
.QW ~ .
If the
.QW ~
is followed immediately by
.QW /
then the value of the HOME environment variable is used.
.PP
The \fBglob\fR command differs from csh globbing in two ways.
First, it does not sort its result list (use the \fBlsort\fR
@@ -188,13 +178,7 @@ contains a ?, *, or [] construct.
.SH "WINDOWS PORTABILITY ISSUES"
.PP
For Windows UNC names, the servername and sharename components of the path
may not contain ?, *, or [] constructs. On Windows NT, if \fIpattern\fR is
of the form
.QW \fB~\fIusername\fB@\fIdomain\fR ,
it refers to the home
directory of the user whose account information resides on the specified NT
domain server. Otherwise, user account information is obtained from
the local computer.
may not contain ?, *, or [] constructs.
.PP
Since the backslash character has a special meaning to the glob
command, glob patterns containing Windows style path separators need
@@ -229,7 +213,7 @@ Find all the Tcl files in the user's home directory, irrespective of
what the current directory is:
.PP
.CS
\fBglob\fR \-directory ~ *.tcl
\fBglob\fR \-directory [file home] *.tcl
.CE
.PP
Find all subdirectories of the current directory:
+48 -1
View File
@@ -172,7 +172,7 @@ The body of a script provided to \fBeval\fR or \fBuplevel\fR.
.TP
\fBprecompiled\fR\0\0\0\0\0\0\0\0
.
A pre-compiled script (loadable by the package
A precompiled script (loadable by the package
\fBtbcload\fR), and no further information is available.
.RE
.TP
@@ -490,6 +490,29 @@ be discovered with \fBinfo class forward\fR.
This subcommand returns a list of all classes that have been mixed into the
class named \fIclass\fR.
.TP
\fBinfo class properties\fI class\fR ?\fIoptions...\fR
.VS "TIP 558"
This subcommand returns a sorted list of properties defined on the class named
\fIclass\fR. The \fIoptions\fR define exactly which properties are returned:
.RS
.TP
\fB\-all\fR
.
With this option, the properties from the superclasses and mixins of the class
are also returned.
.TP
\fB\-readable\fR
.
This option (the default behavior) asks for the readable properties to be
returned. Only readable or writable properties are returned, not both.
.TP
\fB\-writable\fR
.
This option asks for the writable properties to be returned. Only readable or
writable properties are returned, not both.
.RE
.VE "TIP 558"
.TP
\fBinfo class subclasses\fI class\fR ?\fIpattern\fR?
.
This subcommand returns a list of direct subclasses of class \fIclass\fR. If
@@ -679,6 +702,30 @@ object named \fIobject\fR.
This subcommand returns the name of the internal namespace of the object named
\fIobject\fR.
.TP
\fBinfo object properties\fI object\fR ?\fIoptions...\fR
.VS "TIP 558"
This subcommand returns a sorted list of properties defined on the object
named \fIobject\fR. The \fIoptions\fR define exactly which properties are
returned:
.RS
.TP
\fB\-all\fR
.
With this option, the properties from the class, superclasses and mixins of
the object are also returned.
.TP
\fB\-readable\fR
.
This option (the default behavior) asks for the readable properties to be
returned. Only readable or writable properties are returned, not both.
.TP
\fB\-writable\fR
.
This option asks for the writable properties to be returned. Only readable or
writable properties are returned, not both.
.RE
.VE "TIP 558"
.TP
\fBinfo object variables\fI object\fRR ?\fB\-private\fR?
.
This subcommand returns a list of all variables that have been declared for
+13 -13
View File
@@ -24,7 +24,7 @@ Arguments \fIfirst\fR and \fIlast\fR are index values specifying the first and
last elements of the range to replace. They are interpreted
the same as index values for the command \fBstring index\fR,
supporting simple index arithmetic and indices relative to the
end of the list. The index 0 refers to the first element of the
end of the list. The index \fB0\fR refers to the first element of the
list, and \fBend\fR refers to the last element of the list.
.PP
If either \fIfirst\fR or \fIlast\fR is less than zero, it is considered to
@@ -49,33 +49,33 @@ between \fIfirst\fR and \fIlast\fR are simply deleted.
Prepend to a list.
.PP
.CS
% set lst {c d e f g}
c d e f g
% ledit lst -1 -1 a b
a b c d e f g
set lst {c d e f g}
\fI\(-> c d e f g\fR
\fBledit\fR lst -1 -1 a b
\fI\(-> a b c d e f g\fR
.CE
.PP
Append to the list.
.PP
.CS
% ledit lst end+1 end+1 h i
a b c d e f g h i
\fBledit\fR lst end+1 end+1 h i
\fI\(-> a b c d e f g h i\fR
.CE
.PP
Delete third and fourth elements.
.PP
.CS
% ledit lst 2 3
a b e f g h i
\fBledit\fR lst 2 3
\fI\(-> a b e f g h i\fR
.CE
.PP
Replace two elements with three.
.PP
.CS
% ledit lst 2 3 x y z
a b x y z g h i
% set lst
a b x y z g h i
\fBledit\fR lst 2 3 x y z
\fI\(-> a b x y z g h i\fR
set lst
\fI\(-> a b x y z g h i\fR
.CE
.PP
.SH "SEE ALSO"
+111 -3
View File
@@ -58,6 +58,7 @@ the auto-load mechanism defined below.
The following procedures are provided in the Tcl library:
.TP
\fBauto_execok \fIcmd\fR
.
Determines whether there is an executable file or shell builtin
by the name \fIcmd\fR. If so, it returns a list of arguments to be
passed to \fBexec\fR to execute the executable file or shell builtin
@@ -70,8 +71,30 @@ remembers information about previous searches in an array named
\fBauto_execs\fR; this avoids the path search in future calls for the
same \fIcmd\fR. The command \fBauto_reset\fR may be used to force
\fBauto_execok\fR to forget its cached information.
.RS
.PP
For example, to run the \fIumask\fR shell builtin on Linux, you would do:
.PP
.CS
exec {*}[\fBauto_execok\fR umask]
.CE
.PP
To run the \fIDIR\fR shell builtin on Windows, you would do:
.PP
.CS
exec {*}[\fBauto_execok\fR dir]
.CE
.PP
To discover if there is a \fIfrobnicate\fR binary on the user's PATH,
you would do:
.PP
.CS
set mayFrob [expr {[llength [\fBauto_execok\fR frobnicate]] > 0}]
.CE
.RE
.TP
\fBauto_import \fIpattern\fR
.
\fBAuto_import\fR is invoked during \fBnamespace import\fR to see if
the imported commands specified by \fIpattern\fR reside in an
autoloaded library. If so, the commands are loaded so that they will
@@ -79,13 +102,18 @@ be available to the interpreter for creating the import links. If the
commands do not reside in an autoloaded library, \fBauto_import\fR
does nothing. The pattern matching is performed according to the
matching rules of \fBnamespace import\fR.
.RS
.PP
It is not normally necessary to call this command directly.
.RE
.TP
\fBauto_load \fIcmd\fR
.
This command attempts to load the definition for a Tcl command named
\fIcmd\fR. To do this, it searches an \fIauto-load path\fR, which is
a list of one or more directories. The auto-load path is given by the
global variable \fBauto_path\fR if it exists. If there is no
\fBauto_path\fR variable, then the TCLLIBPATH environment variable is
\fBauto_path\fR variable, then the \fBTCLLIBPATH\fR environment variable is
used, if it exists. Otherwise the auto-load path consists of just the
Tcl library directory. Within each directory in the auto-load path
there must be a file \fBtclIndex\fR that describes one or more
@@ -104,6 +132,11 @@ the array \fBauto_index\fR; future calls to \fBauto_load\fR check for
cached index information may be deleted with the command
\fBauto_reset\fR. This will force the next \fBauto_load\fR command to
reload the index database from disk.
.RS
.PP
It is not normally necessary to call this command directly; the
default \fBunknown\fR handler will do so.
.RE
.TP
\fBauto_mkindex \fIdir pattern pattern ...\fR
.
@@ -156,6 +189,7 @@ listed in the auto-load index, so that fresh copies of them will be
loaded the next time that they are used.
.TP
\fBauto_qualify \fIcommand namespace\fR
.
Computes a list of fully qualified names for \fIcommand\fR. This list
mirrors the path a standard Tcl interpreter follows for command
lookups: first it looks for the command in the current namespace, and
@@ -175,6 +209,7 @@ performing the actual auto-loading of functions at runtime.
.RE
.TP
\fBtcl_findLibrary \fIbasename version patch initScript enVarName varName\fR
.
This is a standard search procedure for use by extensions during
their initialization. They call this procedure to look for their
script library in several standard directories.
@@ -197,14 +232,25 @@ relative to the executable file in the current build tree;
relative to the executable file in a parallel build tree.
.TP
\fBparray \fIarrayName\fR ?\fIpattern\fR?
.
Prints on standard output the names and values of all the elements in the
array \fIarrayName\fR, or just the names that match \fIpattern\fR (using the
matching rules of \fBstring match\fR) and their values if \fIpattern\fR is
given.
\fIArrayName\fR must be an array accessible to the caller of \fBparray\fR.
It may be either local or global.
The result of this command is the empty string.
.RS
.PP
For example, to print the contents of the \fBtcl_platform\fR array, do:
.PP
.CS
\fBparray\fR tcl_platform
.CE
.RE
.TP
\fBtcl_endOfWord \fIstr start\fR
.
Returns the index of the first end-of-word location that occurs after
a starting index \fIstart\fR in the string \fIstr\fR. An end-of-word
location is defined to be the first non-word character following the
@@ -215,19 +261,35 @@ for more details on how Tcl determines which characters are word
characters.
.TP
\fBtcl_startOfNextWord \fIstr start\fR
.
Returns the index of the first start-of-word location that occurs
after a starting index \fIstart\fR in the string \fIstr\fR. A
start-of-word location is defined to be the first word character
following a non-word character. Returns \-1 if there are no more
start-of-word locations after the starting point.
.RS
.PP
For example, to print the indices of the starts of each word in a
string according to platform rules:
.PP
.CS
set theString "The quick brown fox"
for {set idx 0} {$idx >= 0} {
set idx [\fBtcl_startOfNextWord\fR $theString $idx]} {
puts "Word start index: $idx"
}
.CE
.RE
.TP
\fBtcl_startOfPreviousWord \fIstr start\fR
.
Returns the index of the first start-of-word location that occurs
before a starting index \fIstart\fR in the string \fIstr\fR. Returns
\-1 if there are no more start-of-word locations before the starting
point.
.TP
\fBtcl_wordBreakAfter \fIstr start\fR
.
Returns the index of the first word boundary after the starting index
\fIstart\fR in the string \fIstr\fR. Returns \-1 if there are no more
boundaries after the starting point in the given string. The index
@@ -235,6 +297,7 @@ returned refers to the second character of the pair that comprises a
boundary.
.TP
\fBtcl_wordBreakBefore \fIstr start\fR
.
Returns the index of the first word boundary before the starting index
\fIstart\fR in the string \fIstr\fR. Returns \-1 if there are no more
boundaries before the starting point in the given string. The index
@@ -248,18 +311,30 @@ commands and packages, and determining what are words.
.SS "AUTOLOADING AND PACKAGE MANAGEMENT VARIABLES"
.TP
\fBauto_execs\fR
.
Used by \fBauto_execok\fR to record information about whether
particular commands exist as executable files.
.RS
.PP
Not normally usefully accessed directly by user code.
.RE
.TP
\fBauto_index\fR
.
Used by \fBauto_load\fR to save the index information read from
disk.
.RS
.PP
Not normally usefully accessed directly by user code.
.RE
.TP
\fBauto_noexec\fR
.
If set to any value, then \fBunknown\fR will not attempt to auto-exec
any commands.
.TP
\fBauto_noload\fR
.
If set to any value, then \fBunknown\fR will not attempt to auto-load
any commands.
.TP
@@ -275,37 +350,70 @@ the parent directory of \fBtcl_library\fR,
the directories listed in the \fBtcl_pkgPath\fR variable.
Additional locations to look for files and package indices should
normally be added to this variable using \fBlappend\fR.
.RS
.PP
For example, to add the \fIlib\fR directory next to the running
script, you would do:
.PP
.CS
lappend \fBauto_path\fR [file dirname [info script]]/lib
.CE
.PP
Note that if the script uses \fBcd\fR, it is advisable to ensure that
entries on the \fBauto_path\fR are \fBfile normalize\fRd.
.RE
.TP
\fBenv(TCL_LIBRARY)\fR
.
If set, then it specifies the location of the directory containing
library scripts (the value of this variable will be
assigned to the \fBtcl_library\fR variable and therefore returned by
the command \fBinfo library\fR). If this variable is not set then
a default value is used.
.RS
.PP
Use of this environment variable is not recommended outside of testing.
Tcl installations should already know where to find their own script
files, as the value is baked in during the build or installation.
.RE
.TP
\fBenv(TCLLIBPATH)\fR
.
If set, then it must contain a valid Tcl list giving directories to
search during auto-load operations. Directories must be specified in
Tcl format, using
.QW /
as the path separator, regardless of platform.
This variable is only used when initializing the \fBauto_path\fR variable.
.RS
.PP
A key consequence of this variable is that it gives a way to let the user
of a script specify the list of places where that script may use
\fBpackage require\fR to read packages from. It is not normally usefully
settable within a Tcl script itself \fIexcept\fR to influence where other
interpreters load from (whether made with \fBinterp create\fR or launched
as their own threads or subprocesses).
.RE
.SS "WORD BOUNDARY DETERMINATION VARIABLES"
These variables are only used in the \fBtcl_endOfWord\fR,
\fBtcl_startOfNextWord\fR, \fBtcl_startOfPreviousWord\fR,
\fBtcl_wordBreakAfter\fR, and \fBtcl_wordBreakBefore\fR commands.
.TP
\fBtcl_nonwordchars\fR
.
This variable contains a regular expression that is used by routines
like \fBtcl_endOfWord\fR to identify whether a character is part of a
word or not. If the pattern matches a character, the character is
considered to be a non-word character. The default is "\\W".
considered to be a non-word character. The default value is
.QW "\\W" .
.TP
\fBtcl_wordchars\fR
.
This variable contains a regular expression that is used by routines
like \fBtcl_endOfWord\fR to identify whether a character is part of a
word or not. If the pattern matches a character, the character is
considered to be a word character. The default is "\\w".
considered to be a word character. The default value is
.QW "\\w" .
.SH "SEE ALSO"
env(n), info(n), re_syntax(n)
.SH KEYWORDS
+7 -7
View File
@@ -52,11 +52,11 @@ oo::class create ABC {
constructor {} {
\fBlink\fR Foo
# The method foo is now directly accessible as foo here
# The method Foo is now directly accessible as Foo here
\fBlink\fR {bar Foo}
# The method foo is now directly accessible as bar
# The method Foo is now directly accessible as bar
\fBlink\fR {::ExternalCall Foo}
# The method foo is now directly accessible in the global
# The method Foo is now directly accessible in the global
# namespace as ExternalCall
}
@@ -71,13 +71,13 @@ oo::class create ABC {
ABC create abc
abc grill
\fI\(-> Step 1:\fR
\fI\(-> This is foo in ::abc\fR
\fI\(-> This is Foo in ::abc\fR
\fI\(-> Step 2:\fR
\fI\(-> This is foo in ::abc\fR
\fI\(-> This is Foo in ::abc\fR
# Direct access via the linked command
puts "Step 3:"; ExternalCall
\fI\(-> Step 3:\fR
\fI\(-> This is foo in ::abc\fR
\fI\(-> This is Foo in ::abc\fR
.CE
.PP
This example shows that multiple linked commands can be made in a call to
@@ -88,7 +88,7 @@ oo::class create Ex {
constructor {} {
\fBlink\fR a b c
# The methods a, b, and c (defined below) are all now
# directly acessible within methods under their own names.
# directly accessible within methods under their own names.
}
method a {} {
+1 -1
View File
@@ -16,7 +16,7 @@ lremove \- Remove elements from a list by index
.SH DESCRIPTION
.PP
\fBlremove\fR returns a new list formed by simultaneously removing zero or
more elements of \fIlist\fR at each of the indices given by an arbirary number
more elements of \fIlist\fR at each of the indices given by an arbitrary number
of \fIindex\fR arguments. The indices may be in any order and may be repeated;
the element at index will only be removed once. The index values are
interpreted the same as index values for the command \fBstring index\fR,
+56 -49
View File
@@ -11,73 +11,80 @@
.SH NAME
lseq \- Build a numeric sequence returned as a list
.SH SYNOPSIS
\fBlseq \fIStart \fR?(\fB..\fR|\fBto\fR)? \fIEnd\fR ??\fBby\fR? \fIStep\fR?
\fBlseq \fIstart \fR?(\fB..\fR|\fBto\fR)? \fIend\fR ??\fBby\fR? \fIstep\fR?
\fBlseq \fIStart \fBcount\fR \fICount\fR ??\fBby\fR? \fIStep\fR?
\fBlseq \fIstart \fBcount\fR \fIcount\fR ??\fBby\fR? \fIstep\fR?
\fBlseq \fICount\fR ?\fBby \fIStep\fR?
\fBlseq \fIcount\fR ?\fBby \fIstep\fR?
.BE
.SH DESCRIPTION
.PP
The \fBlseq\fR command creates a sequence of numeric values using the given
parameters \fIStart\fR, \fIEnd\fR, and \fIStep\fR. The \fIoperation\fR
argument ".." or "to" defines an inclusive range. The "count" option is used
to define a count of the number of elements in the list. The short form with a
single count value will create a range from 0 to count-1.
The numeric arguments, \fIStart\fR, \fIEnd\fR, \fIStep\fR, and \fICount\fR,
can also be a valid expression. the lseq command will evaluate the expression
parameters \fIstart\fR, \fIend\fR, and \fIstep\fR.
The \fIoperation\fR argument
.QW \fB..\fR
or
.QW \fBto\fR
defines an inclusive range; if it is omitted, the range is exclusive.
The \fBcount\fR option is used to define a count of the number of elements in
the list.
The \fIstep\fR (which may be preceded by \fBby\fR) is 1 if not provided.
The short form with a
single \fIcount\fR value will create a range from 0 to \fIcount\fR-1 (i.e.,
\fIcount\fR values).
.PP
The numeric arguments, \fIstart\fR, \fIend\fR, \fIstep\fR, and \fIcount\fR,
can also be a valid expression. the \fBlseq\fR command will evaluate the
expression (as if with \fBexpr\fR)
and use the numeric result, or return an error as with any invalid argument
value. A valid expression is a valid [expr] expression, however, the result
must be numeric; a non-numeric string will result in an error.
value; a non-numeric expression result will result in an error.
.SH EXAMPLES
.CS
.\"
\fBlseq\fR 3
\fI\(-> 0 1 2\fR
lseq 3
\(-> 0 1 2
\fBlseq\fR 3 0
\fI\(-> 3 2 1 0\fR
lseq 3 0
\(-> 3 2 1 0
\fBlseq\fR 10 .. 1 by -2
\fI\(-> 10 8 6 4 2\fR
lseq 10 .. 1 by -2
\(-> 10 8 6 4 2
set l [\fBlseq\fR 0 -5]
\fI\(-> 0 -1 -2 -3 -4 -5\fR
set l [lseq 0 -5]
\(-> 0 -1 -2 -3 -4 -5
foreach i [lseq [llength $l]] {
puts l($i)=[lindex $l $i]
}
\(-> l(0)=0
l(1)=-1
l(2)=-2
l(3)=-3
l(4)=-4
l(5)=-5
foreach i [lseq [llength $l]-1 0] {
foreach i [\fBlseq\fR [llength $l]] {
puts l($i)=[lindex $l $i]
}
\(-> l(5)=-5
l(4)=-4
l(3)=-3
l(2)=-2
l(1)=-1
l(0)=0
}
\fI\(-> l(0)=0\fR
\fI\(-> l(1)=-1\fR
\fI\(-> l(2)=-2\fR
\fI\(-> l(3)=-3\fR
\fI\(-> l(4)=-4\fR
\fI\(-> l(5)=-5\fR
set i 17
\(-> 17
if {$i in [lseq 0 50]} { # equivalent to: (0 <= $i && $i < 50)
puts "Ok"
} else {
puts "outside :("
}
\(-> Ok
foreach i [\fBlseq\fR {[llength $l]-1} 0] {
puts l($i)=[lindex $l $i]
}
\fI\(-> l(5)=-5\fR
\fI\(-> l(4)=-4\fR
\fI\(-> l(3)=-3\fR
\fI\(-> l(2)=-2\fR
\fI\(-> l(1)=-1\fR
\fI\(-> l(0)=0\fR
set sqrs [lmap i [lseq 1 10] {expr $i*$i}]
\(-> 1 4 9 16 25 36 49 64 81 100
set i 17
\fI\(-> 17\fR
if {$i in [\fBlseq\fR 0 50]} { # equivalent to: (0 <= $i && $i < 50)
puts "Ok"
} else {
puts "outside :("
}
\fI\(-> Ok\fR
set sqrs [lmap i [\fBlseq\fR 1 10] { expr {$i*$i} }]
\fI\(-> 1 4 9 16 25 36 49 64 81 100\fR
.\"
.CE
.SH "SEE ALSO"
+1 -1
View File
@@ -41,7 +41,7 @@ of packets and bytes allocated.
.TP
\fBmemory init \fR[\fBon\fR|\fBoff\fR]
.
Turn on or off the pre-initialization of all allocated memory
Turn on or off the preinitialization of all allocated memory
with bogus bytes. Useful for detecting the use of uninitialized
values.
.TP
+1 -1
View File
@@ -161,7 +161,7 @@ this command first finds the matching exported commands.
It then checks whether any of those commands
were previously imported by the current namespace.
If so, this command deletes the corresponding imported commands.
In effect, this un-does the action of a \fBnamespace import\fR command.
In effect, this undoes the action of a \fBnamespace import\fR command.
.TP
\fBnamespace import \fR?\fB\-force\fR? ?\fIpattern\fR \fIpattern ...\fR?
.
+1 -1
View File
@@ -96,7 +96,7 @@ forward to the proper implementation of the method (which it does by invoking
the \fBnext\fR command as filters are inserted into the front of the method
call chain) and is responsible for returning the result of \fBnext\fR.
.PP
Filters are invoked when processing an invokation of the \fBunknown\fR
Filters are invoked when processing an invocation of the \fBunknown\fR
method because of a failure to locate a method implementation, but \fInot\fR
when invoking either constructors or destructors. (Note however that the
\fBdestroy\fR method is a conventional method, and filters are invoked as
+22
View File
@@ -128,6 +128,28 @@ If a new file is created as part of opening it, \fIpermissions\fR
(an integer) is used to set the permissions for the new file in
conjunction with the process's file mode creation mask.
\fIPermissions\fR defaults to 0666.
.PP
.VS "8.7, TIP 603"
When the file opened is an ordinary disk file, the \fBchan configure\fR and
\fBfconfigure\fR commands can be used to query this additional configuration
option:
.TP
\fB\-stat\fR
.
This option, when read, returns a dictionary of values much as is obtained
from the \fBfile stat\fR command, where that stat information relates to the
real opened file. Keys in the dictionary may include \fBatime\fR, \fBctime\fR,
\fBdev\fR, \fBgid\fR, \fBino\fR, \fBmode\fR, \fBmtime\fR, \fBnlink\fR,
\fBsize\fR, \fBtype\fR, and \fBuid\fR among others; the \fBmtime\fR,
\fBsize\fR and \fBtype\fR fields are guaranteed to be present and meaningful
on all platforms; other keys may be present too.
.RS
.PP
\fIImplementation note:\fR This option maps to a call to \fBfstat()\fR on
POSIX platforms, and to a call to \fBGetFileInformationByHandle()\fR on
Windows; the information reported is what those system calls produce.
.RE
.VE "8.7, TIP 603"
.SH "COMMAND PIPELINES"
.PP
If the first character of \fIfileName\fR is
+1 -1
View File
@@ -108,7 +108,7 @@ it immediately upon \fBpackage require\fR. This is not compatible with
the use of \fIauto_reset\fR, and therefore its use is discouraged.
.TP 15
\fB\-load \fIpkgPat\fR
The index process will pre-load any packages that exist in the
The index process will preload any packages that exist in the
current interpreter and match \fIpkgPat\fR into the child interpreter used to
generate the index. The pattern match uses string match rules, but without
making case distinctions.
+14 -1
View File
@@ -11,7 +11,20 @@
.SH NAME
refchan \- command handler API of reflected channels
.SH SYNOPSIS
\fBcmdPrefix \fIoption\fR ?\fIarg arg ...\fR?
.nf
\fBchan create \fImode cmdPrefix\fR
\fIcmdPrefix \fBblocking\fR \fIchannelId mode\fR
\fIcmdPrefix \fBcget\fR \fIchannelId option\fR
\fIcmdPrefix \fBcgetall\fR \fIchannelId\fR
\fIcmdPrefix \fBconfigure\fR \fIchannelId option value\fR
\fIcmdPrefix \fBfinalize\fR \fIchannelId\fR
\fIcmdPrefix \fBinitialize\fR \fIchannelId mode\fR
\fIcmdPrefix \fBread\fR \fIchannelId count\fR
\fIcmdPrefix \fBseek\fR \fIchannelId offset base\fR
\fIcmdPrefix \fBwatch\fR \fIchannelId eventspec\fR
\fIcmdPrefix \fBwrite\fR \fIchannelId data\fR
.fi
.BE
.SH DESCRIPTION
.PP
+2 -2
View File
@@ -625,14 +625,14 @@ the test suite is being run on a Unix platform.
.PP
Each \fBtest\fR should include whatever \fB\-constraints\fR are
required to constrain it to run only where appropriate. Several
constraints are pre-defined in the \fBtcltest\fR package, listed
constraints are predefined in the \fBtcltest\fR package, listed
below. The registration of user-defined constraints is performed
by the \fBtestConstraint\fR command. User-defined constraints
may appear within a test file, or within the script specified
by the \fBconfigure \-load\fR or \fBconfigure \-loadfile\fR
options.
.PP
The following is a list of constraints pre-defined by the
The following is a list of constraints predefined by the
\fBtcltest\fR package itself:
.TP
\fIsingleTestInterp\fR
+5 -5
View File
@@ -73,11 +73,11 @@ The following elements of \fBenv\fR are special to Tcl:
\fBenv(HOME)\fR
.
This environment variable, if set, gives the location of the directory
considered to be the current user's home directory, and to which a
call of \fBcd\fR without arguments or with just
.QW ~
as an argument will change into. Most platforms set this correctly by
default; it does not normally need to be set by user code.
considered to be the current user's home directory. The value of this variable
is returned by the \fBfile home\fR command. Most platforms set this correctly by
default; it does not normally need to be set by user code. On Windows, if not
already set, it is set to the value of the \fBUSERPROFILE\fR environment
variable.
.TP
\fBenv(TCL_LIBRARY)\fR
.
+3 -3
View File
@@ -35,10 +35,10 @@ if \fItime\fR is not specified.
.sp
The parameter \fImax-count\fR could additionally impose a further restriction
by the maximal number of iterations to evaluate the script.
If \fImax-count\fR is specified, the evalution will stop either this count of
If \fImax-count\fR is specified, the evaluation will stop either this count of
iterations is reached or the time is exceeded.
.sp
It will then return a canonical tcl-list of the form:
It will then return a canonical Tcl-list of the form:
.PP
.CS
\fB0.095977 \(mcs/# 52095836 # 10419167 #/sec 5000.000 net-ms\fR
@@ -85,7 +85,7 @@ used to measure the cost of \fBTcl_EvalObjEx\fR, of the invocation of canonical
lists, and of the uncompiled versions of bytecoded commands.
.PP
As opposed to the \fBtime\fR commmand, which runs the tested script for a fixed
number of iterations, the timerate command runs it for a fixed time.
number of iterations, the \fBtimerate\fR command runs it for a fixed time.
Additionally, the compiled variant of the script will be used during the entire
measurement, as if the script were part of a compiled procedure, if the \fB\-direct\fR
option is not specified. The fixed time period and possibility of compilation allow
+12 -1
View File
@@ -11,7 +11,18 @@
.SH NAME
transchan \- command handler API of channel transforms
.SH SYNOPSIS
\fBcmdPrefix \fIoption\fR ?\fIarg arg ...\fR?
.nf
\fBchan push \fIchannelName cmdPrefix\fR
\fIcmdPrefix \fBclear \fIhandle\fR
\fIcmdPrefix \fBdrain \fIhandle\fR
\fIcmdPrefix \fBfinalize \fIhandle\fR
\fIcmdPrefix \fBflush \fIhandle\fR
\fIcmdPrefix \fBinitialize \fIhandle mode\fR
\fIcmdPrefix \fBlimit? \fIhandle\fR
\fIcmdPrefix \fBread \fIhandle buffer\fR
\fIcmdPrefix \fBwrite \fIhandle buffer\fR
.fi
.BE
.SH DESCRIPTION
.PP
+5 -5
View File
@@ -487,7 +487,7 @@ freearc(
/*
* changearctarget - flip an arc to have a different to state
*
* Caller must have verified that there is no pre-existing duplicate arc.
* Caller must have verified that there is no preexisting duplicate arc.
*
* Note that because we store arcs in their from state, we can't easily have
* a similar changearcsource function.
@@ -1515,7 +1515,7 @@ pullback(
* Returns 1 if successful (which it always is unless the source is the
* start state or we have an internal error), 0 if nothing happened.
*
* A significant property of this function is that it deletes no pre-existing
* A significant property of this function is that it deletes no preexisting
* states, and no outarcs of the constraint's from state other than the given
* constraint arc. This makes the loops in pullback() safe, at the cost that
* we may leave useless states behind. Therefore, we leave it to pullback()
@@ -1694,7 +1694,7 @@ pushfwd(
* Returns 1 if successful (which it always is unless the destination is the
* post state or we have an internal error), 0 if nothing happened.
*
* A significant property of this function is that it deletes no pre-existing
* A significant property of this function is that it deletes no preexisting
* states, and no inarcs of the constraint's to state other than the given
* constraint arc. This makes the loops in pushfwd() safe, at the cost that
* we may leave useless states behind. Therefore, we leave it to pushfwd()
@@ -2467,7 +2467,7 @@ breakconstraintloop(struct nfa * nfa, struct state * sinitial)
* have multiple redundant arc pathways). Each donemap is a char array
* indexed by state number. The donemaps are all of the same size "nstates",
* which is nfa->nstates as of the start of the recursion. This is enough to
* have entries for all pre-existing states, but *not* entries for clone
* have entries for all preexisting states, but *not* entries for clone
* states created during the recursion. That's okay since we have no need to
* mark those.
*
@@ -2774,7 +2774,7 @@ markcanreach(
- analyze - ascertain potentially-useful facts about an optimized NFA
^ static long analyze(struct nfa *);
*/
static long /* re_info bits to be ORed in */
static long /* re_info bits to be OR'ed in */
analyze(
struct nfa *nfa)
{
-6
View File
@@ -84,15 +84,9 @@ typedef int celt; /* Type to hold chr, or NOCELT */
#define NOCELT (-1) /* Celt value which is not valid chr */
#define CHR(c) (UCHAR(c)) /* Turn char literal into chr literal */
#define DIGITVAL(c) ((c)-'0') /* Turn chr digit into its value */
#if TCL_UTF_MAX > 3
#define CHRBITS 32 /* Bits in a chr; must not use sizeof */
#define CHR_MIN 0x00000000 /* Smallest and largest chr; the value */
#define CHR_MAX 0x10FFFF /* CHR_MAX-CHR_MIN+1 should fit in uchr */
#else
#define CHRBITS 16 /* Bits in a chr; must not use sizeof */
#define CHR_MIN 0x0000 /* Smallest and largest chr; the value */
#define CHR_MAX 0xFFFF /* CHR_MAX-CHR_MIN+1 should fit in uchr */
#endif
/*
* Functions operating on chr.
+2 -2
View File
@@ -258,10 +258,10 @@ struct state {
};
struct nfa {
struct state *pre; /* pre-initial state */
struct state *pre; /* preinitial state */
struct state *init; /* initial state */
struct state *final; /* final state */
struct state *post; /* post-final state */
struct state *post; /* postfinal state */
size_t nstates; /* for numbering states */
struct state *states; /* state-chain header */
struct state *slast; /* tail of the chain */
+33 -27
View File
@@ -59,7 +59,7 @@ declare 8 {
const char *file, int line)
}
# Tcl_CreateFileHandler and Tcl_DeleteFileHandler are only available on unix,
# Tcl_CreateFileHandler and Tcl_DeleteFileHandler are only available on Unix,
# but they are part of the old generic interface, so we include them here for
# compatibility reasons.
@@ -146,7 +146,7 @@ declare 32 {
}
# Only available in Tcl 8.x, NULL in Tcl 9.0
declare 33 {
unsigned char *TclGetByteArrayFromObj(Tcl_Obj *objPtr, int *numBytesPtr)
unsigned char *TclGetByteArrayFromObj(Tcl_Obj *objPtr, void *numBytesPtr)
}
declare 34 {
int Tcl_GetDouble(Tcl_Interp *interp, const char *src, double *doublePtr)
@@ -173,7 +173,7 @@ declare 40 {
const Tcl_ObjType *Tcl_GetObjType(const char *typeName)
}
declare 41 {
char *TclGetStringFromObj(Tcl_Obj *objPtr, int *lengthPtr)
char *TclGetStringFromObj(Tcl_Obj *objPtr, void *lengthPtr)
}
declare 42 {
void Tcl_InvalidateStringRep(Tcl_Obj *objPtr)
@@ -188,7 +188,7 @@ declare 44 {
}
declare 45 {
int TclListObjGetElements(Tcl_Interp *interp, Tcl_Obj *listPtr,
int *objcPtr, Tcl_Obj ***objvPtr)
void *objcPtr, Tcl_Obj ***objvPtr)
}
declare 46 {
int Tcl_ListObjIndex(Tcl_Interp *interp, Tcl_Obj *listPtr, Tcl_Size index,
@@ -196,7 +196,7 @@ declare 46 {
}
declare 47 {
int TclListObjLength(Tcl_Interp *interp, Tcl_Obj *listPtr,
int *lengthPtr)
void *lengthPtr)
}
declare 48 {
int Tcl_ListObjReplace(Tcl_Interp *interp, Tcl_Obj *listPtr, Tcl_Size first,
@@ -881,12 +881,12 @@ declare 241 {
void Tcl_SourceRCFile(Tcl_Interp *interp)
}
declare 242 {
int TclSplitList(Tcl_Interp *interp, const char *listStr, int *argcPtr,
int TclSplitList(Tcl_Interp *interp, const char *listStr, void *argcPtr,
const char ***argvPtr)
}
# Obsolete, use Tcl_FSSplitPath
declare 243 {
void TclSplitPath(const char *path, int *argcPtr, const char ***argvPtr)
void TclSplitPath(const char *path, void *argcPtr, const char ***argvPtr)
}
# Removed in 9.0 (stub entry only)
#declare 244 {
@@ -1442,7 +1442,7 @@ declare 392 {
}
declare 393 {
int Tcl_CreateThread(Tcl_ThreadId *idPtr, Tcl_ThreadCreateProc *proc,
void *clientData, Tcl_Size stackSize, int flags)
void *clientData, TCL_HASH_TYPE stackSize, int flags)
}
# Introduced in 8.3.2
@@ -1601,7 +1601,7 @@ declare 433 {
# introduced in 8.4a3
declare 434 {
Tcl_UniChar *TclGetUnicodeFromObj(Tcl_Obj *objPtr, int *lengthPtr)
Tcl_UniChar *TclGetUnicodeFromObj(Tcl_Obj *objPtr, void *lengthPtr)
}
# TIP#15 (math function introspection) dkf
@@ -1702,7 +1702,7 @@ declare 460 {
Tcl_Obj *Tcl_FSJoinPath(Tcl_Obj *listObj, Tcl_Size elements)
}
declare 461 {
Tcl_Obj *TclFSSplitPath(Tcl_Obj *pathPtr, int *lenPtr)
Tcl_Obj *TclFSSplitPath(Tcl_Obj *pathPtr, void *lenPtr)
}
declare 462 {
int Tcl_FSEqualPaths(Tcl_Obj *firstPtr, Tcl_Obj *secondPtr)
@@ -1841,7 +1841,7 @@ declare 496 {
Tcl_Obj *keyPtr)
}
declare 497 {
int TclDictObjSize(Tcl_Interp *interp, Tcl_Obj *dictPtr, int *sizePtr)
int TclDictObjSize(Tcl_Interp *interp, Tcl_Obj *dictPtr, void *sizePtr)
}
declare 498 {
int Tcl_DictObjFirst(Tcl_Interp *interp, Tcl_Obj *dictPtr,
@@ -2270,7 +2270,7 @@ declare 603 {
# TIP#265 (option parser) dkf for Sam Bromley
declare 604 {
int TclParseArgsObjv(Tcl_Interp *interp, const Tcl_ArgvInfo *argTable,
int *objcPtr, Tcl_Obj *const *objv, Tcl_Obj ***remObjv)
void *objcPtr, Tcl_Obj *const *objv, Tcl_Obj ***remObjv)
}
# TIP#336 (manipulate the error line) dgp
@@ -2468,23 +2468,23 @@ declare 648 {
# TIP #568
declare 649 {
unsigned char *TclGetBytesFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr,
int *numBytesPtr)
void *numBytesPtr)
}
declare 650 {
unsigned char *Tcl_GetBytesFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr,
size_t *numBytesPtr)
Tcl_Size *numBytesPtr)
}
# TIP #481
declare 651 {
char *Tcl_GetStringFromObj(Tcl_Obj *objPtr, size_t *lengthPtr)
char *Tcl_GetStringFromObj(Tcl_Obj *objPtr, Tcl_Size *lengthPtr)
}
declare 652 {
Tcl_UniChar *Tcl_GetUnicodeFromObj(Tcl_Obj *objPtr, size_t *lengthPtr)
Tcl_UniChar *Tcl_GetUnicodeFromObj(Tcl_Obj *objPtr, Tcl_Size *lengthPtr)
}
# Only available in Tcl 8.x, NULL in Tcl 9.0
declare 653 {
unsigned char *Tcl_GetByteArrayFromObj(Tcl_Obj *objPtr, size_t *numBytesPtr)
unsigned char *Tcl_GetByteArrayFromObj(Tcl_Obj *objPtr, Tcl_Size *numBytesPtr)
}
# TIP #575
@@ -2521,28 +2521,28 @@ declare 660 {
# TIP #616
declare 661 {
int Tcl_ListObjGetElements(Tcl_Interp *interp, Tcl_Obj *listPtr,
size_t *objcPtr, Tcl_Obj ***objvPtr)
Tcl_Size *objcPtr, Tcl_Obj ***objvPtr)
}
declare 662 {
int Tcl_ListObjLength(Tcl_Interp *interp, Tcl_Obj *listPtr,
size_t *lengthPtr)
Tcl_Size *lengthPtr)
}
declare 663 {
int Tcl_DictObjSize(Tcl_Interp *interp, Tcl_Obj *dictPtr, size_t *sizePtr)
int Tcl_DictObjSize(Tcl_Interp *interp, Tcl_Obj *dictPtr, Tcl_Size *sizePtr)
}
declare 664 {
int Tcl_SplitList(Tcl_Interp *interp, const char *listStr, size_t *argcPtr,
int Tcl_SplitList(Tcl_Interp *interp, const char *listStr, Tcl_Size *argcPtr,
const char ***argvPtr)
}
declare 665 {
void Tcl_SplitPath(const char *path, size_t *argcPtr, const char ***argvPtr)
void Tcl_SplitPath(const char *path, Tcl_Size *argcPtr, const char ***argvPtr)
}
declare 666 {
Tcl_Obj *Tcl_FSSplitPath(Tcl_Obj *pathPtr, size_t *lenPtr)
Tcl_Obj *Tcl_FSSplitPath(Tcl_Obj *pathPtr, Tcl_Size *lenPtr)
}
declare 667 {
int Tcl_ParseArgsObjv(Tcl_Interp *interp, const Tcl_ArgvInfo *argTable,
size_t *objcPtr, Tcl_Obj *const *objv, Tcl_Obj ***remObjv)
Tcl_Size *objcPtr, Tcl_Obj *const *objv, Tcl_Obj ***remObjv)
}
# TIP #617
@@ -2592,7 +2592,7 @@ declare 678 {
}
declare 679 {
int Tcl_NRCallObjProc2(Tcl_Interp *interp, Tcl_ObjCmdProc2 *objProc2,
void *clientData, size_t objc, Tcl_Obj *const objv[])
void *clientData, ptrdiff_t objc, Tcl_Obj *const objv[])
}
# TIP #638.
@@ -2601,7 +2601,7 @@ declare 680 {
void **clientDataPtr, int *typePtr)
}
declare 681 {
int Tcl_GetNumber(Tcl_Interp *interp, const char *bytes, size_t numBytes,
int Tcl_GetNumber(Tcl_Interp *interp, const char *bytes, Tcl_Size numBytes,
void **clientDataPtr, int *typePtr)
}
@@ -2626,9 +2626,15 @@ declare 685 {
Tcl_Obj *Tcl_DStringToObj(Tcl_DString *dsPtr)
}
# TIP 660
declare 686 {
int Tcl_GetSizeIntFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr,
Tcl_Size *sizePtr)
}
# ----- BASELINE -- FOR -- 8.7.0 / 9.0.0 ----- #
declare 687 {
declare 688 {
void TclUnusedStubEntry(void)
}
+54 -127
View File
@@ -9,6 +9,7 @@
* Copyright (c) 1994-1998 Sun Microsystems, Inc.
* Copyright (c) 1998-2000 by Scriptics Corporation.
* Copyright (c) 2002 by Kevin B. Kenny. All rights reserved.
* Copyright (c) 2021 by Nathan Coulter. All rights reserved.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -105,6 +106,9 @@ extern "C" {
#include <stdio.h>
#include <stddef.h>
#define TCL_COMMENT(x)
#if defined(__GNUC__) && (__GNUC__ > 2)
# if defined(_WIN32) && defined(__USE_MINGW_ANSI_STDIO) && __USE_MINGW_ANSI_STDIO
# define TCL_FORMAT_PRINTF(a,b) __attribute__ ((__format__ (__MINGW_PRINTF_FORMAT, a, b)))
@@ -208,10 +212,6 @@ extern "C" {
# endif
#endif
#if !defined(CONST86) && !defined(TCL_NO_DEPRECATED)
# define CONST86 const
#endif
/*
* Make sure EXTERN isn't defined elsewhere.
*/
@@ -306,25 +306,27 @@ typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt;
# define TCL_Z_MODIFIER ""
# endif
#endif /* !TCL_Z_MODIFIER */
#ifndef TCL_T_MODIFIER
# if defined(__GNUC__) && !defined(_WIN32)
# define TCL_T_MODIFIER "t"
# elif defined(_WIN64)
# define TCL_T_MODIFIER TCL_LL_MODIFIER
# else
# define TCL_T_MODIFIER TCL_Z_MODIFIER
# endif
#endif /* !TCL_T_MODIFIER */
#define Tcl_WideAsLong(val) ((long)((Tcl_WideInt)(val)))
#define Tcl_LongAsWide(val) ((Tcl_WideInt)((long)(val)))
#define Tcl_WideAsDouble(val) ((double)((Tcl_WideInt)(val)))
#define Tcl_DoubleAsWide(val) ((Tcl_WideInt)((double)(val)))
#if TCL_MAJOR_VERSION < 9
typedef int Tcl_Size;
#else
typedef size_t Tcl_Size;
#endif
typedef ptrdiff_t Tcl_Size;
#define TCL_SIZE_MAX PTRDIFF_MAX
#define TCL_SIZE_MODIFIER TCL_T_MODIFIER
#ifdef _WIN32
# if TCL_MAJOR_VERSION > 8 || defined(_WIN64) || defined(_USE_64BIT_TIME_T)
typedef struct __stat64 Tcl_StatBuf;
# elif defined(_USE_32BIT_TIME_T)
typedef struct _stati64 Tcl_StatBuf;
# else
typedef struct _stat32i64 Tcl_StatBuf;
# endif
typedef struct __stat64 Tcl_StatBuf;
#elif defined(__CYGWIN__)
typedef struct {
unsigned st_dev;
@@ -450,7 +452,6 @@ typedef void (Tcl_ThreadCreateProc) (void *clientData);
* string.
*/
#if TCL_MAJOR_VERSION > 8
typedef struct Tcl_RegExpIndices {
Tcl_Size start; /* Character offset of first character in
* match. */
@@ -465,23 +466,6 @@ typedef struct Tcl_RegExpInfo {
Tcl_Size extendStart; /* The offset at which a subsequent match
* might begin. */
} Tcl_RegExpInfo;
#else
typedef struct Tcl_RegExpIndices {
long start; /* Character offset of first character in
* match. */
long end; /* Character offset of first character after
* the match. */
} Tcl_RegExpIndices;
typedef struct Tcl_RegExpInfo {
int nsubs; /* Number of subexpressions in the compiled
* expression. */
Tcl_RegExpIndices *matches; /* Array of nsubs match offset pairs. */
long extendStart; /* The offset at which a subsequent match
* might begin. */
long reserved; /* Reserved for later use. */
} Tcl_RegExpInfo;
#endif
/*
* Picky compilers complain if this typdef doesn't appear before the struct's
@@ -555,7 +539,7 @@ typedef int (Tcl_CmdObjTraceProc) (void *clientData, Tcl_Interp *interp,
int level, const char *command, Tcl_Command commandInfo, int objc,
struct Tcl_Obj *const *objv);
typedef int (Tcl_CmdObjTraceProc2) (void *clientData, Tcl_Interp *interp,
size_t level, const char *command, Tcl_Command commandInfo, size_t objc,
Tcl_Size level, const char *command, Tcl_Command commandInfo, Tcl_Size objc,
struct Tcl_Obj *const *objv);
typedef void (Tcl_CmdObjTraceDeleteProc) (void *clientData);
typedef void (Tcl_DupInternalRepProc) (struct Tcl_Obj *srcPtr,
@@ -580,7 +564,7 @@ typedef void (Tcl_NamespaceDeleteProc) (void *clientData);
typedef int (Tcl_ObjCmdProc) (void *clientData, Tcl_Interp *interp,
int objc, struct Tcl_Obj *const *objv);
typedef int (Tcl_ObjCmdProc2) (void *clientData, Tcl_Interp *interp,
size_t objc, struct Tcl_Obj *const *objv);
Tcl_Size objc, struct Tcl_Obj *const *objv);
typedef int (Tcl_LibraryInitProc) (Tcl_Interp *interp);
typedef int (Tcl_LibraryUnloadProc) (Tcl_Interp *interp, int flags);
typedef void (Tcl_PanicProc) (const char *format, ...);
@@ -602,10 +586,6 @@ typedef void *(Tcl_InitNotifierProc) (void);
typedef void (Tcl_FinalizeNotifierProc) (void *clientData);
typedef void (Tcl_MainLoopProc) (void);
#ifndef TCL_NO_DEPRECATED
# define Tcl_PackageInitProc Tcl_LibraryInitProc
# define Tcl_PackageUnloadProc Tcl_LibraryUnloadProc
#endif
/*
*----------------------------------------------------------------------------
@@ -614,6 +594,10 @@ typedef void (Tcl_MainLoopProc) (void);
* standard operations on objects of that type.
*/
/* forward declaration */
typedef struct Tcl_Obj Tcl_Obj;
typedef struct Tcl_ObjInterface Tcl_ObjInterface;
typedef struct Tcl_ObjType {
const char *name; /* Name of the type, e.g. "int". */
Tcl_FreeInternalRepProc *freeIntRepProc;
@@ -666,7 +650,7 @@ typedef union Tcl_ObjInternalRep { /* The internal representation: */
* or both.
*/
typedef struct Tcl_Obj {
struct Tcl_Obj {
Tcl_Size refCount; /* When 0 the object will be freed. */
char *bytes; /* This points to the first byte of the
* object's string representation. The array
@@ -686,7 +670,7 @@ typedef struct Tcl_Obj {
* internal rep. NULL indicates the object has
* no internal rep (has no type). */
Tcl_ObjInternalRep internalRep; /* The internal representation: */
} Tcl_Obj;
};
/*
@@ -803,8 +787,8 @@ typedef struct {
typedef struct Tcl_DString {
char *string; /* Points to beginning of string: either
* staticSpace below or a malloced array. */
Tcl_Size length; /* Number of non-NULL characters in the
* string. */
Tcl_Size length; /* Number of bytes in string excluding
* terminating nul */
Tcl_Size spaceAvl; /* Total number of bytes available for the
* string and its terminating NULL char. */
char staticSpace[TCL_DSTRING_STATIC_SIZE];
@@ -877,11 +861,7 @@ typedef struct Tcl_DString {
* TCL_COMBINE Combine surrogates
*/
#if TCL_MAJOR_VERSION > 8
# define TCL_COMBINE 0x1000000
#else
# define TCL_COMBINE 0
#endif
#define TCL_COMBINE 0x1000000
/*
*----------------------------------------------------------------------------
* Flag values passed to Tcl_RecordAndEval, Tcl_EvalObj, Tcl_EvalObjv.
@@ -995,11 +975,7 @@ typedef struct Tcl_DString {
*/
#ifndef TCL_HASH_TYPE
#if TCL_MAJOR_VERSION > 8
# define TCL_HASH_TYPE size_t
#else
# define TCL_HASH_TYPE unsigned
#endif
#define TCL_HASH_TYPE size_t
#endif
typedef struct Tcl_HashKeyType Tcl_HashKeyType;
@@ -1116,15 +1092,10 @@ struct Tcl_HashTable {
* table. */
Tcl_Size rebuildSize; /* Enlarge table when numEntries gets to be
* this large. */
#if TCL_MAJOR_VERSION > 8
size_t mask; /* Mask value used in hashing function. */
#endif
int downShift; /* Shift count used in hashing function.
* Designed to use high-order bits of
* randomized keys. */
#if TCL_MAJOR_VERSION < 9
int mask; /* Mask value used in hashing function. */
#endif
int keyType; /* Type of keys used in this table. It's
* either TCL_CUSTOM_KEYS, TCL_STRING_KEYS,
* TCL_ONE_WORD_KEYS, or an integer giving the
@@ -1290,11 +1261,7 @@ typedef void (Tcl_ScaleTimeProc) (Tcl_Time *timebuf, void *clientData);
* interface.
*/
#if TCL_MAJOR_VERSION > 8
# define TCL_CLOSE2PROC NULL
#else
# define TCL_CLOSE2PROC ((void *) 1)
#endif
#define TCL_CLOSE2PROC NULL
/*
* Channel version tag. This was introduced in 8.3.2/8.4.
@@ -1774,7 +1741,7 @@ typedef struct Tcl_Token {
* TCL_TOKEN_OPERATOR - The token describes one expression operator.
* An operator might be the name of a math
* function such as "abs". A TCL_TOKEN_OPERATOR
* token is always preceeded by one
* token is always preceded by one
* TCL_TOKEN_SUB_EXPR token for the operator's
* subexpression, and is followed by zero or more
* TCL_TOKEN_SUB_EXPR tokens for the operator's
@@ -1844,12 +1811,10 @@ typedef struct Tcl_Parse {
* *tokenPtr. */
int errorType; /* One of the parsing error types defined
* above. */
#if TCL_MAJOR_VERSION > 8
int incomplete; /* This field is set to 1 by Tcl_ParseCommand
* if the command appears to be incomplete.
* This information is used by
* Tcl_CommandComplete. */
#endif
/*
* The fields below are intended only for the private use of the parser.
@@ -1868,9 +1833,6 @@ typedef struct Tcl_Parse {
* beginning of region where the error
* occurred (e.g. the open brace if the close
* brace is missing). */
#if TCL_MAJOR_VERSION < 9
int incomplete;
#endif
Tcl_Token staticTokens[NUM_STATIC_TOKENS];
/* Initial space for tokens for command. This
* space should be large enough to accommodate
@@ -1927,9 +1889,7 @@ typedef struct Tcl_EncodingType {
* reset to an initial state. If the source
* buffer contains the entire input stream to be
* converted, this flag should be set.
* TCL_ENCODING_STRICT - Be more strict in accepting what
* is considered a 'invalid byte sequence'.
* TCL_ENCODING_STOPONERROR - Not used any more.
* TCL_ENCODING_STOPONERROR - Obsolete.
* TCL_ENCODING_NO_TERMINATE - If set, Tcl_ExternalToUtf does not append a
* terminating NUL byte. Since it does not need
* an extra byte for a terminating NUL, it fills
@@ -1954,25 +1914,20 @@ typedef struct Tcl_EncodingType {
#define TCL_ENCODING_START 0x01
#define TCL_ENCODING_END 0x02
#if TCL_MAJOR_VERSION > 8
# define TCL_ENCODING_STOPONERROR 0x0 /* Not used any more */
#else
# define TCL_ENCODING_STOPONERROR 0x04
#endif
#define TCL_ENCODING_STOPONERROR 0x0 /* Not used any more */
#define TCL_ENCODING_NO_TERMINATE 0x08
#define TCL_ENCODING_CHAR_LIMIT 0x10
/* Internal use bits, do not define bits in this space. See above comment */
#define TCL_ENCODING_INTERNAL_USE_MASK 0xFF00
/* Reserve top byte for profile values (disjoint, not a mask) */
/*
* Reserve top byte for profile values (disjoint, not a mask). In case of
* changes, ensure ENCODING_PROFILE_* macros in tclInt.h are modified if
* necessary.
*/
#define TCL_ENCODING_PROFILE_TCL8 0x01000000
#define TCL_ENCODING_PROFILE_STRICT 0x02000000
#define TCL_ENCODING_PROFILE_REPLACE 0x03000000
/* Still being argued - For Tcl9, is the default strict? TODO */
#if TCL_MAJOR_VERSION < 9
#define TCL_ENCODING_PROFILE_DEFAULT TCL_ENCODING_PROFILE_TCL8
#else
#define TCL_ENCODING_PROFILE_DEFAULT TCL_ENCODING_PROFILE_TCL8 /* STRICT? REPLACE? TODO */
#endif
#define TCL_ENCODING_PROFILE_DEFAULT TCL_ENCODING_PROFILE_STRICT
/*
* The following definitions are the error codes returned by the conversion
@@ -2014,11 +1969,7 @@ typedef struct Tcl_EncodingType {
*/
#ifndef TCL_UTF_MAX
#if TCL_MAJOR_VERSION > 8
#define TCL_UTF_MAX 4
#else
#define TCL_UTF_MAX 3
#endif
# define TCL_UTF_MAX 4
#endif
/*
@@ -2026,16 +1977,12 @@ typedef struct Tcl_EncodingType {
* reflected in regcustom.h.
*/
#if TCL_UTF_MAX > 3
/*
* int isn't 100% accurate as it should be a strict 4-byte value
* (perhaps int32_t). ILP64/SILP64 systems may have troubles. The
* size of this value must be reflected correctly in regcustom.h.
*/
/*
* int isn't 100% accurate as it should be a strict 4-byte value
* (perhaps int32_t). ILP64/SILP64 systems may have troubles. The
* size of this value must be reflected correctly in regcustom.h.
*/
typedef int Tcl_UniChar;
#else
typedef unsigned short Tcl_UniChar;
#endif
/*
*----------------------------------------------------------------------------
@@ -2207,6 +2154,7 @@ typedef int (Tcl_ArgvGenFuncProc)(void *clientData, Tcl_Interp *interp,
#define TCL_IO_FAILURE ((Tcl_Size)-1)
#define TCL_AUTO_LENGTH ((Tcl_Size)-1)
#define TCL_INDEX_NONE ((Tcl_Size)-1)
#define TCL_LENGTH_NONE ((Tcl_Size)-1)
/*
*----------------------------------------------------------------------------
@@ -2222,11 +2170,7 @@ typedef int (Tcl_NRPostProc) (void *data[], Tcl_Interp *interp,
* stubs tables.
*/
#if TCL_MAJOR_VERSION > 8
# define TCL_STUB_MAGIC ((int) 0xFCA3BACB + (int) sizeof(void *))
#else
# define TCL_STUB_MAGIC ((int) 0xFCA3BACF)
#endif
#define TCL_STUB_MAGIC ((int) 0xFCA3BACB + (int) sizeof(void *))
/*
* The following function is required to be defined in all stubs aware
@@ -2248,19 +2192,7 @@ void * TclStubCall(void *arg);
#endif
#ifdef USE_TCL_STUBS
#if TCL_MAJOR_VERSION < 9
# if TCL_UTF_MAX < 4
# define Tcl_InitStubs(interp, version, exact) \
(Tcl_InitStubs)(interp, version, \
(exact)|(TCL_MAJOR_VERSION<<8)|(0xFF<<16), \
TCL_STUB_MAGIC)
# else
# define Tcl_InitStubs(interp, version, exact) \
(Tcl_InitStubs)(interp, "8.7.0", \
(exact)|(TCL_MAJOR_VERSION<<8)|(0xFF<<16), \
TCL_STUB_MAGIC)
# endif
#elif TCL_RELEASE_LEVEL == TCL_FINAL_RELEASE
#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), \
@@ -2272,9 +2204,7 @@ void * TclStubCall(void *arg);
TCL_STUB_MAGIC)
#endif
#else
#if TCL_MAJOR_VERSION < 9
# error "Please define -DUSE_TCL_STUBS"
#elif TCL_RELEASE_LEVEL == TCL_FINAL_RELEASE
#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))
@@ -2306,9 +2236,6 @@ EXTERN void Tcl_StaticLibrary(Tcl_Interp *interp,
const char *prefix,
Tcl_LibraryInitProc *initProc,
Tcl_LibraryInitProc *safeInitProc);
#ifndef TCL_NO_DEPRECATED
# define Tcl_StaticPackage Tcl_StaticLibrary
#endif
EXTERN Tcl_ExitProc *Tcl_SetExitProc(TCL_NORETURN1 Tcl_ExitProc *proc);
#ifdef _WIN32
EXTERN const char *TclZipfs_AppHook(int *argc, wchar_t ***argv);
@@ -2320,10 +2247,10 @@ EXTERN const char *TclZipfs_AppHook(int *argc, char ***argv);
# define Tcl_FindExecutable(arg) ((Tcl_FindExecutable)((const char *)(arg)))
#endif
# define Tcl_MainEx Tcl_MainExW
EXTERN TCL_NORETURN void Tcl_MainExW(size_t argc, wchar_t **argv,
EXTERN TCL_NORETURN void Tcl_MainExW(Tcl_Size argc, wchar_t **argv,
Tcl_AppInitProc *appInitProc, Tcl_Interp *interp);
#endif
#if defined(USE_TCL_STUBS) && (TCL_MAJOR_VERSION > 8)
#if defined(USE_TCL_STUBS)
#define Tcl_SetPanicProc(panicProc) \
TclInitStubTable(((const char *(*)(Tcl_PanicProc *))TclStubCall((void *)panicProc))(panicProc))
#define Tcl_InitSubsystems() \
@@ -2333,11 +2260,11 @@ EXTERN const char *TclZipfs_AppHook(int *argc, char ***argv);
#define TclZipfs_AppHook(argcp, argvp) \
TclInitStubTable(((const char *(*)(int *, void *))TclStubCall((void *)3))(argcp, argvp))
#define Tcl_MainExW(argc, argv, appInitProc, interp) \
(void)((const char *(*)(size_t, const void *, Tcl_AppInitProc *, Tcl_Interp *)) \
(void)((const char *(*)(Tcl_Size, const void *, Tcl_AppInitProc *, Tcl_Interp *)) \
TclStubCall((void *)4))(argc, argv, appInitProc, interp)
#if !defined(_WIN32) || !defined(UNICODE)
#define Tcl_MainEx(argc, argv, appInitProc, interp) \
(void)((const char *(*)(size_t, const void *, Tcl_AppInitProc *, Tcl_Interp *)) \
(void)((const char *(*)(Tcl_Size, const void *, Tcl_AppInitProc *, Tcl_Interp *)) \
TclStubCall((void *)5))(argc, argv, appInitProc, interp)
#endif
#define Tcl_StaticLibrary(interp, pkgName, initProc, safeInitProc) \
+3 -3
View File
@@ -116,7 +116,7 @@ static struct block bigBlocks={ /* Big blocks aren't suballocated. */
/*
* The allocator is protected by a special mutex that must be explicitly
* initialized. Futhermore, because Tcl_Alloc may be used before anything else
* initialized. Furthermore, because Tcl_Alloc may be used before anything else
* in Tcl, we make this module self-initializing after all with the allocInit
* variable.
*/
@@ -510,7 +510,7 @@ TclpFree(
void *
TclpRealloc(
void *oldPtr, /* Pointer to alloced block. */
void *oldPtr, /* Pointer to alloc'ed block. */
size_t numBytes) /* New size of memory. */
{
int i;
@@ -609,7 +609,7 @@ TclpRealloc(
}
/*
* Ok, we don't have to copy, it fits as-is
* No need to copy. It fits as-is.
*/
#ifndef NDEBUG
+252 -149
View File
@@ -13,37 +13,102 @@
#include "tclInt.h"
#include "tclArithSeries.h"
#include <assert.h>
#include <math.h>
/* -------------------------- ArithSeries object ---------------------------- */
/*
* Helper functions
*
* - ArithRound -- Round doubles to the number of significant fractional
* digits
* - ArithSeriesIndexDbl -- base list indexing operation for doubles
* - ArithSeriesIndexInt -- " " " " " integers
* - ArithSeriesGetInternalRep -- Return the internal rep from a Tcl_Obj
* - Precision -- determine the number of factional digits for the given
* double value
* - maxPrecision -- Using the values provide, determine the longest percision
* in the arithSeries
*/
static inline double
ArithRound(double d, unsigned int n) {
double scalefactor = pow(10, n);
return round(d*scalefactor)/scalefactor;
}
#define ArithSeriesRepPtr(arithSeriesObjPtr) \
(ArithSeries *) ((arithSeriesObjPtr)->internalRep.twoPtrValue.ptr1)
static inline double
ArithSeriesIndexDbl(
ArithSeries *arithSeriesRepPtr,
Tcl_WideInt index)
{
ArithSeriesDbl *dblRepPtr = (ArithSeriesDbl*)arithSeriesRepPtr;
if (arithSeriesRepPtr->isDouble) {
double d = dblRepPtr->start + (index * dblRepPtr->step);
unsigned n = (dblRepPtr->precision > 0 ? dblRepPtr->precision : 0);
return ArithRound(d, n);
} else {
return (double)(arithSeriesRepPtr->start + (index * arithSeriesRepPtr->step));
}
}
#define ArithSeriesIndexM(arithSeriesRepPtr, index) \
((arithSeriesRepPtr)->isDouble ? \
(((ArithSeriesDbl*)(arithSeriesRepPtr))->start+((index) * ((ArithSeriesDbl*)(arithSeriesRepPtr))->step)) \
: \
((arithSeriesRepPtr)->start+((index) * arithSeriesRepPtr->step)))
static inline Tcl_WideInt
ArithSeriesIndexInt(
ArithSeries *arithSeriesRepPtr,
Tcl_WideInt index)
{
ArithSeriesDbl *dblRepPtr = (ArithSeriesDbl*)arithSeriesRepPtr;
if (arithSeriesRepPtr->isDouble) {
return (Tcl_WideInt)(dblRepPtr->start + ((index) * dblRepPtr->step));
} else {
return (arithSeriesRepPtr->start + (index * arithSeriesRepPtr->step));
}
}
#define ArithSeriesGetInternalRep(objPtr, arithRepPtr) \
do { \
const Tcl_ObjInternalRep *irPtr; \
irPtr = TclFetchInternalRep((objPtr), &tclArithSeriesType.objType); \
(arithRepPtr) = irPtr ? (ArithSeries *)irPtr->twoPtrValue.ptr1 : NULL; \
} while (0)
static inline ArithSeries*
ArithSeriesGetInternalRep(Tcl_Obj *objPtr)
{
const Tcl_ObjInternalRep *irPtr;
irPtr = TclFetchInternalRep((objPtr), tclArithSeriesType);
return irPtr ? (ArithSeries *)irPtr->twoPtrValue.ptr1 : NULL;
}
static inline int
Precision(double d)
{
char tmp[TCL_DOUBLE_SPACE+2], *off;
tmp[0] = 0;
Tcl_PrintDouble(NULL,d,tmp);
off = strchr(tmp, '.');
return (off ? strlen(off+1) : 0);
}
static inline int
maxPrecision(double start, double end, double step)
{
// Find longest number of digits after the decimal point.
int dp = Precision(step);
int i = Precision(start);
dp = i>dp ? i : dp;
i = Precision(end);
dp = i>dp ? i : dp;
return dp;
}
/*
* Prototypes for procedures defined later in this file:
*/
static void DupArithSeriesInternalRep (Tcl_Obj *srcPtr, Tcl_Obj *copyPtr);
static void FreeArithSeriesInternalRep (Tcl_Obj *listPtr);
static int SetArithSeriesFromAny (Tcl_Interp *interp, Tcl_Obj *objPtr);
static void UpdateStringOfArithSeries (Tcl_Obj *arithSeriesObj);
static Tcl_Obj *ArithSeriesObjStep(Tcl_Obj *arithSeriesPtr);
static Tcl_Size ArithSeriesObjLength(Tcl_Obj *arithSeriesPtr);
static void DupArithSeriesInternalRep (Tcl_Obj *srcPtr, Tcl_Obj *copyPtr);
static void FreeArithSeriesInternalRep (Tcl_Obj *listPtr);
static int SetArithSeriesFromAny (Tcl_Interp *interp, Tcl_Obj *objPtr);
static void UpdateStringOfArithSeries (Tcl_Obj *arithSeriesObj);
static Tcl_Obj* ArithSeriesObjStep(Tcl_Obj *arithSeriesPtr);
static int ArithSeriesObjIndex(Tcl_Interp *, Tcl_Obj *,
Tcl_Size index, Tcl_Obj **resultPtr);
static int ArithSeriesObjLength(tclObjTypeInterfaceArgsListLength);
static Tcl_Obj* ArithSeriesObjRange(tclObjTypeInterfaceArgsListRange);
static Tcl_Obj* ArithSeriesObjReverse(tclObjTypeInterfaceArgsListReverse);
static int ArithSeriesGetElements(tclObjTypeInterfaceArgsListAll);
/*
* The structure below defines the arithmetic series Tcl object type by
@@ -72,17 +137,39 @@ static Tcl_Size ArithSeriesObjLength(Tcl_Obj *arithSeriesPtr);
* are valid and will be equivalent to the empty list.
*/
const TclObjTypeWithAbstractList tclArithSeriesType = {
{"arithseries", /* name */
ObjInterface tclArithSeriesInterface = {
1,
{},
{
ArithSeriesGetElements,
NULL,
NULL,
ArithSeriesObjIndex,
NULL,
NULL,
ArithSeriesObjLength,
ArithSeriesObjRange,
NULL,
NULL,
NULL,
ArithSeriesObjReverse,
NULL,
NULL,
},
};
const ObjectType tclArithSeriesObjType = {
"arithseries",
FreeArithSeriesInternalRep, /* freeIntRepProc */
DupArithSeriesInternalRep, /* dupIntRepProc */
UpdateStringOfArithSeries, /* updateStringProc */
SetArithSeriesFromAny, /* setFromAnyProc */
TCL_OBJTYPE_V0_1(
ArithSeriesObjLength
)}
2,
(Tcl_ObjInterface *)&tclArithSeriesInterface
};
MODULE_SCOPE const Tcl_ObjType *tclArithSeriesType
= (Tcl_ObjType *)&tclArithSeriesObjType;
/*
*----------------------------------------------------------------------
*
@@ -107,7 +194,7 @@ const TclObjTypeWithAbstractList tclArithSeriesType = {
*----------------------------------------------------------------------
*/
static Tcl_WideInt
ArithSeriesLen(Tcl_WideInt start, Tcl_WideInt end, Tcl_WideInt step)
ArithSeriesLenInt(Tcl_WideInt start, Tcl_WideInt end, Tcl_WideInt step)
{
Tcl_WideInt len;
@@ -118,6 +205,18 @@ ArithSeriesLen(Tcl_WideInt start, Tcl_WideInt end, Tcl_WideInt step)
return (len < 0) ? -1 : len;
}
static Tcl_WideInt
ArithSeriesLenDbl(double start, double end, double step)
{
Tcl_WideInt len;
if (step == 0) {
return 0;
}
len = ((end-start+step)/step);
return (len < 0) ? -1 : len;
}
/*
*----------------------------------------------------------------------
*
@@ -140,10 +239,13 @@ static
Tcl_Obj *
NewArithSeriesInt(Tcl_WideInt start, Tcl_WideInt end, Tcl_WideInt step, Tcl_WideInt len)
{
Tcl_WideInt length = (len>=0 ? len : ArithSeriesLen(start, end, step));
Tcl_WideInt length;
Tcl_Obj *arithSeriesObj;
ArithSeries *arithSeriesRepPtr;
length = len>=0 ? len : -1;
if (length < 0) length = -1;
TclNewObj(arithSeriesObj);
if (length <= 0) {
@@ -159,7 +261,7 @@ NewArithSeriesInt(Tcl_WideInt start, Tcl_WideInt end, Tcl_WideInt step, Tcl_Wide
arithSeriesRepPtr->elements = NULL;
arithSeriesObj->internalRep.twoPtrValue.ptr1 = arithSeriesRepPtr;
arithSeriesObj->internalRep.twoPtrValue.ptr2 = NULL;
arithSeriesObj->typePtr = &tclArithSeriesType.objType;
arithSeriesObj->typePtr = tclArithSeriesType;
if (length > 0)
Tcl_InvalidateStringRep(arithSeriesObj);
@@ -184,14 +286,20 @@ NewArithSeriesInt(Tcl_WideInt start, Tcl_WideInt end, Tcl_WideInt step, Tcl_Wide
* None.
*----------------------------------------------------------------------
*/
static
Tcl_Obj *
NewArithSeriesDbl(double start, double end, double step, Tcl_WideInt len)
{
Tcl_WideInt length = (len>=0 ? len : ArithSeriesLen(start, end, step));
Tcl_WideInt length;
Tcl_Obj *arithSeriesObj;
ArithSeriesDbl *arithSeriesRepPtr;
length = len>=0 ? len : -1;
if (length < 0) {
length = -1;
}
TclNewObj(arithSeriesObj);
if (length <= 0) {
@@ -205,11 +313,14 @@ NewArithSeriesDbl(double start, double end, double step, Tcl_WideInt len)
arithSeriesRepPtr->step = step;
arithSeriesRepPtr->len = length;
arithSeriesRepPtr->elements = NULL;
arithSeriesRepPtr->precision = maxPrecision(start,end,step);
arithSeriesObj->internalRep.twoPtrValue.ptr1 = arithSeriesRepPtr;
arithSeriesObj->internalRep.twoPtrValue.ptr2 = NULL;
arithSeriesObj->typePtr = &tclArithSeriesType.objType;
if (length > 0)
arithSeriesObj->typePtr = tclArithSeriesType;
if (length > 0) {
Tcl_InvalidateStringRep(arithSeriesObj);
}
return arithSeriesObj;
}
@@ -295,7 +406,7 @@ TclNewArithSeriesObj(
{
double dstart, dend, dstep;
Tcl_WideInt start, end, step;
Tcl_WideInt len;
Tcl_WideInt len = -1;
if (startObj) {
assignNumber(useDoubles, &start, &dstart, startObj);
@@ -311,7 +422,7 @@ TclNewArithSeriesObj(
dstep = step;
}
if (dstep == 0) {
*arithSeriesObj = Tcl_NewObj();
TclNewObj(*arithSeriesObj);
return TCL_OK;
}
}
@@ -337,9 +448,9 @@ TclNewArithSeriesObj(
assert(dstep!=0);
if (!lenObj) {
if (useDoubles) {
len = (dend - dstart + dstep)/dstep;
len = ArithSeriesLenDbl(dstart, dend, dstep);
} else {
len = (end - start + step)/step;
len = ArithSeriesLenInt(start, end, step);
}
}
}
@@ -354,10 +465,10 @@ TclNewArithSeriesObj(
}
}
if (TCL_MAJOR_VERSION < 9 && len > ListSizeT_MAX) {
if (len > TCL_SIZE_MAX) {
Tcl_SetObjResult(
interp,
Tcl_NewStringObj("max length of a Tcl list exceeded", TCL_INDEX_NONE));
Tcl_NewStringObj("max length of a Tcl list exceeded", -1));
Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL);
return TCL_ERROR;
}
@@ -395,10 +506,10 @@ ArithSeriesObjStep(
ArithSeries *arithSeriesRepPtr;
Tcl_Obj *stepObj;
if (arithSeriesObj->typePtr != &tclArithSeriesType.objType) {
if (arithSeriesObj->typePtr != tclArithSeriesType) {
Tcl_Panic("ArithSeriesObjStep called with a not ArithSeries Obj.");
}
arithSeriesRepPtr = ArithSeriesRepPtr(arithSeriesObj);
arithSeriesRepPtr = ArithSeriesGetInternalRep(arithSeriesObj);
if (arithSeriesRepPtr->isDouble) {
TclNewDoubleObj(stepObj, ((ArithSeriesDbl*)(arithSeriesRepPtr))->step);
} else {
@@ -411,49 +522,43 @@ ArithSeriesObjStep(
/*
*----------------------------------------------------------------------
*
* TclArithSeriesObjIndex --
* ArithSeriesObjIndex --
*
* Returns the element with the specified index in the list
* represented by the specified Arithmetic Sequence object.
* If the index is out of range, NULL is returned.
* Stores in **resultPtr the element with the specified index in the list
* represented by the specified Arithmetic Sequence object. If the index
* is out of range.
*
* Results:
*
* The element on success, NULL on index out of range.
*
* Side Effects:
*
* On success, the integer pointed by *element is modified.
* TCL_OK on success, and TCL_ERROR if the index is out of range.
*
*----------------------------------------------------------------------
*/
Tcl_Obj *
TclArithSeriesObjIndex(
Tcl_Interp *interp,
int
ArithSeriesObjIndex(
TCL_UNUSED(Tcl_Interp *),
Tcl_Obj *arithSeriesObj,
Tcl_WideInt index)
Tcl_Size index,
Tcl_Obj **resultPtr)
{
ArithSeries *arithSeriesRepPtr;
if (arithSeriesObj->typePtr != &tclArithSeriesType.objType) {
Tcl_Panic("TclArithSeriesObjIndex called with a not ArithSeries Obj.");
if (arithSeriesObj->typePtr != tclArithSeriesType) {
Tcl_Panic("ArithSeriesObjIndex called with a not ArithSeries Obj.");
}
arithSeriesRepPtr = ArithSeriesRepPtr(arithSeriesObj);
if (index < 0 || (Tcl_Size)index >= arithSeriesRepPtr->len) {
if (interp) {
Tcl_SetObjResult(interp,
Tcl_ObjPrintf("index %" TCL_LL_MODIFIER "d is out of bounds 0 to %"
TCL_Z_MODIFIER "d", index, (arithSeriesRepPtr->len-1)));
Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL);
}
return NULL;
arithSeriesRepPtr = ArithSeriesGetInternalRep(arithSeriesObj);
if (index < 0 || index >= arithSeriesRepPtr->len) {
*resultPtr = Tcl_NewObj();
return TCL_OK;
}
/* List[i] = Start + (Step * index) */
if (arithSeriesRepPtr->isDouble) {
return Tcl_NewDoubleObj(ArithSeriesIndexM(arithSeriesRepPtr, index));
*resultPtr = Tcl_NewDoubleObj(ArithSeriesIndexDbl(arithSeriesRepPtr, index));
return TCL_OK;
} else {
return Tcl_NewWideIntObj(ArithSeriesIndexM(arithSeriesRepPtr, index));
*resultPtr = Tcl_NewWideIntObj(ArithSeriesIndexInt(arithSeriesRepPtr, index));
return TCL_OK;
}
}
@@ -474,11 +579,13 @@ TclArithSeriesObjIndex(
*
*----------------------------------------------------------------------
*/
Tcl_Size ArithSeriesObjLength(Tcl_Obj *arithSeriesObj)
int ArithSeriesObjLength(TCL_UNUSED(Tcl_Interp *),
Tcl_Obj *arithSeriesObj, Tcl_Size *result)
{
ArithSeries *arithSeriesRepPtr = (ArithSeries*)
arithSeriesObj->internalRep.twoPtrValue.ptr1;
return arithSeriesRepPtr->len;
*result = arithSeriesRepPtr->len;
return TCL_OK;
}
/*
@@ -541,18 +648,27 @@ DupArithSeriesInternalRep(
Tcl_Obj *copyPtr) /* Object with internal rep to set. */
{
ArithSeries *srcArithSeriesRepPtr =
(ArithSeries *) srcPtr->internalRep.twoPtrValue.ptr1;
ArithSeries *copyArithSeriesRepPtr;
(ArithSeries *) srcPtr->internalRep.twoPtrValue.ptr1;
/*
* Allocate a new ArithSeries structure. */
copyArithSeriesRepPtr = (ArithSeries*) Tcl_Alloc(sizeof(ArithSeries));
*copyArithSeriesRepPtr = *srcArithSeriesRepPtr;
copyArithSeriesRepPtr->elements = NULL;
copyPtr->internalRep.twoPtrValue.ptr1 = copyArithSeriesRepPtr;
if (srcArithSeriesRepPtr->isDouble) {
ArithSeriesDbl *srcArithSeriesDblRepPtr =
(ArithSeriesDbl *)srcArithSeriesRepPtr;
ArithSeriesDbl *copyArithSeriesDblRepPtr =
(ArithSeriesDbl *) Tcl_Alloc(sizeof(ArithSeriesDbl));
*copyArithSeriesDblRepPtr = *srcArithSeriesDblRepPtr;
copyArithSeriesDblRepPtr->elements = NULL;
copyPtr->internalRep.twoPtrValue.ptr1 = copyArithSeriesDblRepPtr;
} else {
ArithSeries *copyArithSeriesRepPtr =
(ArithSeries *) Tcl_Alloc(sizeof(ArithSeries));
*copyArithSeriesRepPtr = *srcArithSeriesRepPtr;
copyArithSeriesRepPtr->elements = NULL;
copyPtr->internalRep.twoPtrValue.ptr1 = copyArithSeriesRepPtr;
}
copyPtr->internalRep.twoPtrValue.ptr2 = NULL;
copyPtr->typePtr = &tclArithSeriesType.objType;
copyPtr->typePtr = tclArithSeriesType;
}
/*
@@ -591,29 +707,47 @@ UpdateStringOfArithSeries(Tcl_Obj *arithSeriesObj)
char *elem, *p;
Tcl_Obj *elemObj;
Tcl_Size i;
Tcl_WideInt length = 0;
size_t slen;
Tcl_Size length = 0;
Tcl_Size slen;
/*
* Pass 1: estimate space.
*/
for (i = 0; i < arithSeriesRepPtr->len; i++) {
elemObj = TclArithSeriesObjIndex(NULL, arithSeriesObj, i);
elem = Tcl_GetStringFromObj(elemObj, &slen);
Tcl_DecrRefCount(elemObj);
slen += 1; /* + 1 is for the space or the nul-term */
length += slen;
if (!arithSeriesRepPtr->isDouble) {
for (i = 0; i < arithSeriesRepPtr->len; i++) {
double d = ArithSeriesIndexDbl(arithSeriesRepPtr, i);
slen = d>0 ? log10(d)+1 : d<0 ? log10((0-d))+2 : 1;
length += slen;
}
} else {
for (i = 0; i < arithSeriesRepPtr->len; i++) {
double d = ArithSeriesIndexDbl(arithSeriesRepPtr, i);
char tmp[TCL_DOUBLE_SPACE+2];
tmp[0] = 0;
Tcl_PrintDouble(NULL,d,tmp);
if ((length + strlen(tmp)) > TCL_SIZE_MAX) {
break; // overflow
}
length += strlen(tmp);
}
}
length += arithSeriesRepPtr->len; // Space for each separator
/*
* Pass 2: generate the string repr.
*/
p = Tcl_InitStringRep(arithSeriesObj, NULL, length);
if (p == NULL) {
Tcl_Panic("Unable to allocate string size %" TCL_Z_MODIFIER "u", length);
}
for (i = 0; i < arithSeriesRepPtr->len; i++) {
elemObj = TclArithSeriesObjIndex(NULL, arithSeriesObj, i);
ArithSeriesObjIndex(NULL, arithSeriesObj, i, &elemObj);
elem = Tcl_GetStringFromObj(elemObj, &slen);
strcpy(p, elem);
if (((p - arithSeriesObj->bytes)+slen) > length) {
break;
}
strncpy(p, elem, slen);
p[slen] = ' ';
p += slen+1;
Tcl_DecrRefCount(elemObj);
@@ -653,52 +787,6 @@ SetArithSeriesFromAny(
return TCL_ERROR;
}
/*
*----------------------------------------------------------------------
*
* TclArithSeriesObjCopy --
*
* Makes a "pure arithSeries" copy of an ArithSeries value. This provides for the C
* level a counterpart of the [lrange $list 0 end] command, while using
* internals details to be as efficient as possible.
*
* Results:
*
* Normally returns a pointer to a new Tcl_Obj, that contains the same
* arithSeries value as *arithSeriesObj does. The returned Tcl_Obj has a
* refCount of zero. If *arithSeriesObj does not hold an arithSeries,
* NULL is returned, and if interp is non-NULL, an error message is
* recorded there.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
Tcl_Obj *
TclArithSeriesObjCopy(
Tcl_Interp *interp, /* Used to report errors if not NULL. */
Tcl_Obj *arithSeriesObj) /* List object for which an element array is
* to be returned. */
{
Tcl_Obj *copyPtr;
ArithSeries *arithSeriesRepPtr;
ArithSeriesGetInternalRep(arithSeriesObj, arithSeriesRepPtr);
if (NULL == arithSeriesRepPtr) {
if (SetArithSeriesFromAny(interp, arithSeriesObj) != TCL_OK) {
/* We know this is going to panic, but it's the message we want */
return NULL;
}
}
TclNewObj(copyPtr);
TclInvalidateStringRep(copyPtr);
DupArithSeriesInternalRep(arithSeriesObj, copyPtr);
return copyPtr;
}
/*
*----------------------------------------------------------------------
*
@@ -719,7 +807,7 @@ TclArithSeriesObjCopy(
*/
Tcl_Obj *
TclArithSeriesObjRange(
ArithSeriesObjRange(
Tcl_Interp *interp, /* For error message(s) */
Tcl_Obj *arithSeriesObj, /* List object to take a range from. */
Tcl_Size fromIdx, /* Index of first element to include. */
@@ -728,23 +816,36 @@ TclArithSeriesObjRange(
ArithSeries *arithSeriesRepPtr;
Tcl_Obj *startObj, *endObj, *stepObj;
ArithSeriesGetInternalRep(arithSeriesObj, arithSeriesRepPtr);
arithSeriesRepPtr = ArithSeriesGetInternalRep(arithSeriesObj);
if (fromIdx == TCL_INDEX_NONE) {
fromIdx = 0;
}
if (fromIdx > toIdx) {
if (fromIdx > toIdx ||
(toIdx > arithSeriesRepPtr->len-1 &&
fromIdx > arithSeriesRepPtr->len-1)) {
Tcl_Obj *obj;
TclNewObj(obj);
return obj;
}
startObj = TclArithSeriesObjIndex(interp, arithSeriesObj, fromIdx);
if (fromIdx < 0) {
fromIdx = 0;
}
if (toIdx < 0) {
toIdx = 0;
}
if (toIdx > arithSeriesRepPtr->len-1) {
toIdx = arithSeriesRepPtr->len-1;
}
ArithSeriesObjIndex(interp, arithSeriesObj, fromIdx, &startObj);
if (startObj == NULL) {
return NULL;
}
Tcl_IncrRefCount(startObj);
endObj = TclArithSeriesObjIndex(interp, arithSeriesObj, toIdx);
ArithSeriesObjIndex(interp, arithSeriesObj, toIdx, &endObj);
if (endObj == NULL) {
return NULL;
}
@@ -778,15 +879,17 @@ TclArithSeriesObjRange(
TclInvalidateStringRep(arithSeriesObj);
if (arithSeriesRepPtr->isDouble) {
ArithSeriesDbl *arithSeriesDblRepPtr = (ArithSeriesDbl*)arithSeriesObj;
ArithSeriesDbl *arithSeriesDblRepPtr = (ArithSeriesDbl*)arithSeriesRepPtr;
double start, end, step;
Tcl_GetDoubleFromObj(NULL, startObj, &start);
Tcl_GetDoubleFromObj(NULL, endObj, &end);
Tcl_GetDoubleFromObj(NULL, stepObj, &step);
arithSeriesDblRepPtr->start = start;
arithSeriesDblRepPtr->end = end;
arithSeriesDblRepPtr->step = step;
arithSeriesDblRepPtr->len = (end-start+step)/step;
arithSeriesDblRepPtr->precision = maxPrecision(start, end, step);
arithSeriesDblRepPtr->len = ArithSeriesLenDbl(start, end, step);
arithSeriesDblRepPtr->elements = NULL;
} else {
@@ -797,7 +900,7 @@ TclArithSeriesObjRange(
arithSeriesRepPtr->start = start;
arithSeriesRepPtr->end = end;
arithSeriesRepPtr->step = step;
arithSeriesRepPtr->len = (end-start+step)/step;
arithSeriesRepPtr->len = ArithSeriesLenInt(start, end, step);
arithSeriesRepPtr->elements = NULL;
}
@@ -811,7 +914,7 @@ TclArithSeriesObjRange(
/*
*----------------------------------------------------------------------
*
* TclArithSeriesGetElements --
* ArithSeriesGetElements --
*
* This function returns an (objc,objv) array of the elements in a list
* object.
@@ -838,7 +941,7 @@ TclArithSeriesObjRange(
*/
int
TclArithSeriesGetElements(
ArithSeriesGetElements(
Tcl_Interp *interp, /* Used to report errors if not NULL. */
Tcl_Obj *objPtr, /* ArithSeries object for which an element
* array is to be returned. */
@@ -847,12 +950,12 @@ TclArithSeriesGetElements(
Tcl_Obj ***objvPtr) /* Where to store the pointer to an array of
* pointers to the list's objects. */
{
if (TclHasInternalRep(objPtr,&tclArithSeriesType.objType)) {
if (TclHasInternalRep(objPtr,tclArithSeriesType)) {
ArithSeries *arithSeriesRepPtr;
Tcl_Obj **objv;
int i, objc;
ArithSeriesGetInternalRep(objPtr, arithSeriesRepPtr);
arithSeriesRepPtr = ArithSeriesGetInternalRep(objPtr);
objc = arithSeriesRepPtr->len;
if (objc > 0) {
if (arithSeriesRepPtr->elements) {
@@ -865,14 +968,14 @@ TclArithSeriesGetElements(
if (interp) {
Tcl_SetObjResult(
interp,
Tcl_NewStringObj("max length of a Tcl list exceeded", TCL_INDEX_NONE));
Tcl_NewStringObj("max length of a Tcl list exceeded", -1));
Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL);
}
return TCL_ERROR;
}
arithSeriesRepPtr->elements = objv;
for (i = 0; i < objc; i++) {
objv[i] = TclArithSeriesObjIndex(interp, objPtr, i);
ArithSeriesObjIndex(interp, objPtr, i, &objv[i]);
if (objv[i] == NULL) {
return TCL_ERROR;
}
@@ -899,7 +1002,7 @@ TclArithSeriesGetElements(
/*
*----------------------------------------------------------------------
*
* TclArithSeriesObjReverse --
* ArithSeriesObjReverse --
*
* Reverse the order of the ArithSeries value.
* *arithSeriesObj must be known to be a valid list.
@@ -916,7 +1019,7 @@ TclArithSeriesGetElements(
*/
Tcl_Obj *
TclArithSeriesObjReverse(
ArithSeriesObjReverse(
Tcl_Interp *interp, /* For error message(s) */
Tcl_Obj *arithSeriesObj) /* List object to reverse. */
{
@@ -927,14 +1030,14 @@ TclArithSeriesObjReverse(
double dstart, dend, dstep;
int isDouble;
ArithSeriesGetInternalRep(arithSeriesObj, arithSeriesRepPtr);
arithSeriesRepPtr = ArithSeriesGetInternalRep(arithSeriesObj);
isDouble = arithSeriesRepPtr->isDouble;
len = arithSeriesRepPtr->len;
startObj = TclArithSeriesObjIndex(NULL, arithSeriesObj, (len-1));
ArithSeriesObjIndex(NULL, arithSeriesObj, (len-1), &startObj);
Tcl_IncrRefCount(startObj);
endObj = TclArithSeriesObjIndex(NULL, arithSeriesObj, 0);
ArithSeriesObjIndex(NULL, arithSeriesObj, 0, &endObj);
Tcl_IncrRefCount(endObj);
stepObj = ArithSeriesObjStep(arithSeriesObj);
Tcl_IncrRefCount(stepObj);
+3 -12
View File
@@ -16,7 +16,7 @@
* but it's faster to cache it inside the internal representation.
*/
typedef struct {
Tcl_Size len;
Tcl_WideInt len;
Tcl_Obj **elements;
int isDouble;
Tcl_WideInt start;
@@ -24,25 +24,16 @@ typedef struct {
Tcl_WideInt step;
} ArithSeries;
typedef struct {
Tcl_Size len;
Tcl_WideInt len;
Tcl_Obj **elements;
int isDouble;
double start;
double end;
double step;
int precision;
} ArithSeriesDbl;
MODULE_SCOPE Tcl_Obj * TclArithSeriesObjCopy(Tcl_Interp *interp,
Tcl_Obj *arithSeriesPtr);
MODULE_SCOPE Tcl_Obj *TclArithSeriesObjIndex(Tcl_Interp *, Tcl_Obj *,
Tcl_WideInt index);
MODULE_SCOPE Tcl_Obj * TclArithSeriesObjRange(Tcl_Interp *interp,
Tcl_Obj *arithSeriesPtr, Tcl_Size fromIdx, Tcl_Size toIdx);
MODULE_SCOPE Tcl_Obj * TclArithSeriesObjReverse(Tcl_Interp *interp,
Tcl_Obj *arithSeriesPtr);
MODULE_SCOPE int TclArithSeriesGetElements(Tcl_Interp *interp,
Tcl_Obj *objPtr, Tcl_Size *objcPtr, Tcl_Obj ***objvPtr);
MODULE_SCOPE int TclNewArithSeriesObj(Tcl_Interp *interp,
Tcl_Obj **arithSeriesObj, int useDoubles,
Tcl_Obj *startObj, Tcl_Obj *endObj,
+34 -34
View File
@@ -222,7 +222,7 @@ typedef struct AssemblyEnv {
Tcl_HashTable labelHash; /* Hash table whose keys are labels and whose
* values are 'label' objects storing the code
* offsets of the labels. */
size_t cmdLine; /* Current line number within the assembly
Tcl_Size cmdLine; /* Current line number within the assembly
* code */
int* clNext; /* Invisible continuation line for
* [info frame] */
@@ -857,7 +857,7 @@ CompileAssembleObj(
* names in the bytecode resolve */
int status; /* Status return from Tcl_AssembleCode */
const char* source; /* String representation of the source code */
size_t sourceLen; /* Length of the source code in bytes */
Tcl_Size sourceLen; /* Length of the source code in bytes */
/*
* Get the expression ByteCode from the object. If it exists, make sure it
@@ -1269,10 +1269,10 @@ AssembleOneLine(
Tcl_Obj* operand1Obj = NULL;
/* First operand to the instruction */
const char* operand1; /* String rep of the operand */
size_t operand1Len; /* String length of the operand */
Tcl_Size operand1Len; /* String length of the operand */
int opnd; /* Integer representation of an operand */
int litIndex; /* Literal pool index of a constant */
size_t localVar; /* LVT index of a local variable */
Tcl_Size localVar; /* LVT index of a local variable */
int flags; /* Flags for a basic block */
JumptableInfo* jtPtr; /* Pointer to a jumptable */
int infoIndex; /* Index of the jumptable in auxdata */
@@ -1367,7 +1367,7 @@ AssembleOneLine(
goto cleanup;
}
localVar = FindLocalVar(assemEnvPtr, &tokenPtr);
if (localVar == TCL_INDEX_NONE) {
if (localVar < 0) {
goto cleanup;
}
BBEmitInstInt1(assemEnvPtr, tblIdx, opnd, 0);
@@ -1384,7 +1384,7 @@ AssembleOneLine(
}
if (opnd < 0 || opnd > 3) {
Tcl_SetObjResult(interp,
Tcl_NewStringObj("operand must be [0..3]", TCL_INDEX_NONE));
Tcl_NewStringObj("operand must be [0..3]", -1));
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "OPERAND<0,>3", NULL);
goto cleanup;
}
@@ -1427,7 +1427,7 @@ AssembleOneLine(
goto cleanup;
}
localVar = FindLocalVar(assemEnvPtr, &tokenPtr);
if (localVar == TCL_INDEX_NONE) {
if (localVar < 0) {
goto cleanup;
}
BBEmitInstInt4(assemEnvPtr, tblIdx, opnd, opnd+1);
@@ -1444,7 +1444,7 @@ AssembleOneLine(
goto cleanup;
}
localVar = FindLocalVar(assemEnvPtr, &tokenPtr);
if (localVar == TCL_INDEX_NONE) {
if (localVar < 0) {
goto cleanup;
}
BBEmitInstInt4(assemEnvPtr, tblIdx, opnd, opnd);
@@ -1625,7 +1625,7 @@ AssembleOneLine(
if (opnd < 2) {
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
Tcl_SetObjResult(interp,
Tcl_NewStringObj("operand must be >=2", TCL_INDEX_NONE));
Tcl_NewStringObj("operand must be >=2", -1));
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "OPERAND>=2", NULL);
}
goto cleanup;
@@ -1639,7 +1639,7 @@ AssembleOneLine(
goto cleanup;
}
localVar = FindLocalVar(assemEnvPtr, &tokenPtr);
if (localVar == TCL_INDEX_NONE) {
if (localVar < 0) {
goto cleanup;
}
BBEmitInst1or4(assemEnvPtr, tblIdx, localVar, 0);
@@ -1651,7 +1651,7 @@ AssembleOneLine(
goto cleanup;
}
localVar = FindLocalVar(assemEnvPtr, &tokenPtr);
if (localVar == TCL_INDEX_NONE || CheckOneByte(interp, localVar)) {
if (localVar < 0 || CheckOneByte(interp, localVar)) {
goto cleanup;
}
BBEmitInstInt1(assemEnvPtr, tblIdx, localVar, 0);
@@ -1663,7 +1663,7 @@ AssembleOneLine(
goto cleanup;
}
localVar = FindLocalVar(assemEnvPtr, &tokenPtr);
if (localVar == TCL_INDEX_NONE || CheckOneByte(interp, localVar)
if (localVar < 0 || CheckOneByte(interp, localVar)
|| GetIntegerOperand(assemEnvPtr, &tokenPtr, &opnd) != TCL_OK
|| CheckSignedOneByte(interp, opnd)) {
goto cleanup;
@@ -1678,7 +1678,7 @@ AssembleOneLine(
goto cleanup;
}
localVar = FindLocalVar(assemEnvPtr, &tokenPtr);
if (localVar == TCL_INDEX_NONE) {
if (localVar < 0) {
goto cleanup;
}
BBEmitInstInt4(assemEnvPtr, tblIdx, localVar, 0);
@@ -1742,7 +1742,7 @@ AssembleOneLine(
goto cleanup;
}
localVar = FindLocalVar(assemEnvPtr, &tokenPtr);
if (localVar == TCL_INDEX_NONE) {
if (localVar < 0) {
goto cleanup;
}
BBEmitInstInt4(assemEnvPtr, tblIdx, opnd, 0);
@@ -1969,7 +1969,7 @@ CreateMirrorJumpTable(
AssemblyEnv* assemEnvPtr, /* Assembly environment */
Tcl_Obj* jumps) /* List of alternating keywords and labels */
{
size_t objc; /* Number of elements in the 'jumps' list */
Tcl_Size objc; /* Number of elements in the 'jumps' list */
Tcl_Obj** objv; /* Pointers to the elements in the list */
CompileEnv* envPtr = assemEnvPtr->envPtr;
/* Compilation environment */
@@ -1982,7 +1982,7 @@ CreateMirrorJumpTable(
Tcl_HashEntry* hashEntry; /* Entry for a key in the hashtable */
int isNew; /* Flag==1 if the key is not yet in the
* table. */
size_t i;
Tcl_Size i;
if (TclListObjLengthM(interp, jumps, &objc) != TCL_OK) {
return TCL_ERROR;
@@ -2107,7 +2107,7 @@ GetNextOperand(
Tcl_DecrRefCount(operandObj);
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"assembly code may not contain substitutions", TCL_INDEX_NONE));
"assembly code may not contain substitutions", -1));
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "NOSUBST", NULL);
}
return TCL_ERROR;
@@ -2247,7 +2247,7 @@ static int
GetListIndexOperand(
AssemblyEnv* assemEnvPtr, /* Assembly environment */
Tcl_Token** tokenPtrPtr, /* Current token from the parser */
int* result) /* OUTPUT: Integer extracted from the token */
int* result) /* OUTPUT: encoded index derived from the token */
{
CompileEnv* envPtr = assemEnvPtr->envPtr;
/* Compilation environment */
@@ -2313,8 +2313,8 @@ FindLocalVar(
* source code. */
Tcl_Obj* varNameObj; /* Name of the variable */
const char* varNameStr;
size_t varNameLen;
size_t localVar; /* Index of the variable in the LVT */
Tcl_Size varNameLen;
Tcl_Size localVar; /* Index of the variable in the LVT */
if (GetNextOperand(assemEnvPtr, tokenPtrPtr, &varNameObj) != TCL_OK) {
return TCL_INDEX_NONE;
@@ -2326,11 +2326,11 @@ FindLocalVar(
}
localVar = TclFindCompiledLocal(varNameStr, varNameLen, 1, envPtr);
Tcl_DecrRefCount(varNameObj);
if (localVar == TCL_INDEX_NONE) {
if (localVar < 0) {
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"cannot use this instruction to create a variable"
" in a non-proc context", TCL_INDEX_NONE));
" in a non-proc context", -1));
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "LVT", NULL);
}
return TCL_INDEX_NONE;
@@ -2400,7 +2400,7 @@ CheckOneByte(
Tcl_Obj* result; /* Error message */
if (value < 0 || value > 0xFF) {
result = Tcl_NewStringObj("operand does not fit in one byte", TCL_INDEX_NONE);
result = Tcl_NewStringObj("operand does not fit in one byte", -1);
Tcl_SetObjResult(interp, result);
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "1BYTE", NULL);
return TCL_ERROR;
@@ -2435,7 +2435,7 @@ CheckSignedOneByte(
Tcl_Obj* result; /* Error message */
if (value > 0x7F || value < -0x80) {
result = Tcl_NewStringObj("operand does not fit in one byte", TCL_INDEX_NONE);
result = Tcl_NewStringObj("operand does not fit in one byte", -1);
Tcl_SetObjResult(interp, result);
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "1BYTE", NULL);
return TCL_ERROR;
@@ -2468,7 +2468,7 @@ CheckNonNegative(
Tcl_Obj* result; /* Error message */
if (value < 0) {
result = Tcl_NewStringObj("operand must be nonnegative", TCL_INDEX_NONE);
result = Tcl_NewStringObj("operand must be nonnegative", -1);
Tcl_SetObjResult(interp, result);
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "NONNEGATIVE", NULL);
return TCL_ERROR;
@@ -2501,7 +2501,7 @@ CheckStrictlyPositive(
Tcl_Obj* result; /* Error message */
if (value <= 0) {
result = Tcl_NewStringObj("operand must be positive", TCL_INDEX_NONE);
result = Tcl_NewStringObj("operand must be positive", -1);
Tcl_SetObjResult(interp, result);
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "POSITIVE", NULL);
return TCL_ERROR;
@@ -3321,7 +3321,7 @@ CheckStack(
{
CompileEnv* envPtr = assemEnvPtr->envPtr;
/* Compilation environment */
size_t maxDepth; /* Maximum stack depth overall */
Tcl_Size maxDepth; /* Maximum stack depth overall */
/*
* Checking the head block will check all the other blocks recursively.
@@ -3414,7 +3414,7 @@ StackCheckBasicBlock(
}
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"inconsistent stack depths on two execution paths", TCL_INDEX_NONE));
"inconsistent stack depths on two execution paths", -1));
/*
* TODO - add execution trace of both paths
@@ -3443,7 +3443,7 @@ StackCheckBasicBlock(
if (initialStackDepth + blockPtr->minStackDepth < 0) {
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
Tcl_SetObjResult(interp, Tcl_NewStringObj("stack underflow", TCL_INDEX_NONE));
Tcl_SetObjResult(interp, Tcl_NewStringObj("stack underflow", -1));
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "BADSTACK", NULL);
AddBasicBlockRangeToErrorInfo(assemEnvPtr, blockPtr);
Tcl_SetErrorLine(interp, blockPtr->startLine);
@@ -3462,8 +3462,8 @@ StackCheckBasicBlock(
+ blockPtr->enclosingCatch->finalStackDepth)) {
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"code pops stack below level of enclosing catch", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "BADSTACKINCATCH", TCL_INDEX_NONE);
"code pops stack below level of enclosing catch", -1));
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "BADSTACKINCATCH", -1);
AddBasicBlockRangeToErrorInfo(assemEnvPtr, blockPtr);
Tcl_SetErrorLine(interp, blockPtr->startLine);
}
@@ -3734,7 +3734,7 @@ ProcessCatchesInBasicBlock(
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"execution reaches an instruction in inconsistent "
"exception contexts", TCL_INDEX_NONE));
"exception contexts", -1));
Tcl_SetErrorLine(interp, bbPtr->startLine);
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "BADCATCH", NULL);
}
@@ -3793,7 +3793,7 @@ ProcessCatchesInBasicBlock(
if (enclosing == NULL) {
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"endCatch without a corresponding beginCatch", TCL_INDEX_NONE));
"endCatch without a corresponding beginCatch", -1));
Tcl_SetErrorLine(interp, bbPtr->startLine);
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "BADENDCATCH", NULL);
}
@@ -3868,7 +3868,7 @@ CheckForUnclosedCatches(
if (assemEnvPtr->curr_bb->catchState >= BBCS_INCATCH) {
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"catch still active on exit from assembly code", TCL_INDEX_NONE));
"catch still active on exit from assembly code", -1));
Tcl_SetErrorLine(interp,
assemEnvPtr->curr_bb->enclosingCatch->startLine);
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "UNCLOSEDCATCH", NULL);
+139 -120
View File
@@ -93,7 +93,7 @@ typedef struct {
* cancellation. */
char *result; /* The script cancellation result or NULL for
* a default result. */
size_t length; /* Length of the above error message. */
Tcl_Size length; /* Length of the above error message. */
void *clientData; /* Not used. */
int flags; /* Additional flags */
} CancelInfo;
@@ -220,8 +220,8 @@ MODULE_SCOPE const TclStubs tclStubs;
#define CORO_ACTIVATE_YIELD NULL
#define CORO_ACTIVATE_YIELDM INT2PTR(1)
#define COROUTINE_ARGUMENTS_SINGLE_OPTIONAL ((size_t)-1)
#define COROUTINE_ARGUMENTS_ARBITRARY ((size_t)-2)
#define COROUTINE_ARGUMENTS_SINGLE_OPTIONAL (-1)
#define COROUTINE_ARGUMENTS_ARBITRARY (-2)
/*
* The following structure define the commands in the Tcl core.
@@ -613,15 +613,15 @@ static int
buildInfoObjCmd2(
void *clientData,
Tcl_Interp *interp, /* Current interpreter. */
size_t objc, /* Number of arguments. */
Tcl_Size objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
if (objc - 1 > 1) {
if (objc > 2) {
Tcl_WrongNumArgs(interp, 1, objv, "?option?");
return TCL_ERROR;
}
if (objc == 2) {
size_t len;
Tcl_Size len;
const char *arg = Tcl_GetStringFromObj(objv[1], &len);
if (len == 7 && !strcmp(arg, "version")) {
char buf[80];
@@ -702,7 +702,7 @@ buildInfoObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
return buildInfoObjCmd2(clientData, interp, (size_t)objc, objv);
return buildInfoObjCmd2(clientData, interp, objc, objv);
}
/*
@@ -805,7 +805,7 @@ Tcl_CreateInterp(void)
iPtr->legacyFreeProc = (void (*) (void))-1;
iPtr->errorLine = 0;
iPtr->stubTable = &tclStubs;
iPtr->objResultPtr = Tcl_NewObj();
TclNewObj(iPtr->objResultPtr);
Tcl_IncrRefCount(iPtr->objResultPtr);
iPtr->handle = TclHandleCreate(iPtr);
iPtr->globalNsPtr = NULL;
@@ -890,7 +890,7 @@ Tcl_CreateInterp(void)
iPtr->activeInterpTracePtr = NULL;
iPtr->assocData = NULL;
iPtr->execEnvPtr = NULL; /* Set after namespaces initialized. */
iPtr->emptyObjPtr = Tcl_NewObj();
TclNewObj(iPtr->emptyObjPtr);
/* Another empty object. */
Tcl_IncrRefCount(iPtr->emptyObjPtr);
iPtr->threadId = Tcl_GetCurrentThread();
@@ -954,7 +954,7 @@ Tcl_CreateInterp(void)
* TIP #285, Script cancellation support.
*/
iPtr->asyncCancelMsg = Tcl_NewObj();
TclNewObj(iPtr->asyncCancelMsg);
cancelInfo = (CancelInfo *)Tcl_Alloc(sizeof(CancelInfo));
cancelInfo->interp = interp;
@@ -1031,7 +1031,7 @@ Tcl_CreateInterp(void)
/*
* Create the core commands. Do it here, rather than calling
* Tcl_CreateCommand, because it's faster (there's no need to check for a
* pre-existing command by the same name). If a command has a Tcl_CmdProc
* preexisting command by the same name). If a command has a Tcl_CmdProc
* but no Tcl_ObjCmdProc, set the Tcl_ObjCmdProc to
* TclInvokeStringCommand. This is an object-based wrapper function that
* extracts strings, calls the string function, and creates an object for
@@ -1799,7 +1799,7 @@ DeleteInterpProc(
Tcl_HashSearch search;
Tcl_HashTable *hTablePtr;
ResolverScheme *resPtr, *nextResPtr;
size_t i;
Tcl_Size i;
/*
* Punt if there is an error in the Tcl_Release/Tcl_Preserve matchup,
@@ -2152,7 +2152,7 @@ Tcl_HideCommand(
if (strstr(hiddenCmdToken, "::") != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"cannot use namespace qualifiers in hidden command"
" token (rename)", TCL_INDEX_NONE));
" token (rename)", -1));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "HIDDENTOKEN", NULL);
return TCL_ERROR;
}
@@ -2209,15 +2209,15 @@ Tcl_HideCommand(
}
/*
* NB: This code is currently 'like' a rename to a specialy set apart name
* NB: This code is currently 'like' a rename to a special separate name
* table. Changes here and in TclRenameCommand must be kept in synch until
* the common parts are actually factorized out.
*/
/*
* Remove the hash entry for the command from the interpreter command
* table. This is like deleting the command, so bump its command epoch;
* this invalidates any cached references that point to the command.
* table. This is like deleting the command, so bump its command epoch
* to invalidate any cached references that point to the command.
*/
if (cmdPtr->hPtr != NULL) {
@@ -2338,7 +2338,7 @@ Tcl_ExposeCommand(
if (cmdPtr->nsPtr != iPtr->globalNsPtr) {
/*
* This case is theoritically impossible, we might rather Tcl_Panic
* This case is theoretically impossible, we might rather Tcl_Panic
* than 'nicely' erroring out ?
*/
@@ -2444,7 +2444,7 @@ Tcl_ExposeCommand(
* In the future, when cmdName is seen as the name of a command by
* Tcl_Eval, proc will be called. To support the bytecode interpreter,
* the command is created with a wrapper Tcl_ObjCmdProc
* (TclInvokeStringCommand) that eventially calls proc. When the command
* (TclInvokeStringCommand) that eventually calls proc. When the command
* is deleted from the table, deleteProc will be called. See the manual
* entry for details on the calling sequence.
*
@@ -2665,7 +2665,7 @@ static int cmdWrapperProc(void *clientData,
if (objc < 0) {
objc = -1;
}
return info->proc(info->clientData, interp, (size_t)objc, objv);
return info->proc(info->clientData, interp, objc, objv);
}
static void cmdWrapperDeleteProc(void *clientData) {
@@ -3188,11 +3188,11 @@ TclRenameCommand(
*/
Tcl_DStringInit(&newFullName);
Tcl_DStringAppend(&newFullName, newNsPtr->fullName, TCL_INDEX_NONE);
Tcl_DStringAppend(&newFullName, newNsPtr->fullName, -1);
if (newNsPtr != iPtr->globalNsPtr) {
TclDStringAppendLiteral(&newFullName, "::");
}
Tcl_DStringAppend(&newFullName, newTail, TCL_INDEX_NONE);
Tcl_DStringAppend(&newFullName, newTail, -1);
cmdPtr->refCount++;
CallCommandTraces(iPtr, cmdPtr, TclGetString(oldFullName),
Tcl_DStringValue(&newFullName), TCL_TRACE_RENAME);
@@ -3291,14 +3291,14 @@ static int
invokeObj2Command(
void *clientData, /* Points to command's Command structure. */
Tcl_Interp *interp, /* Current interpreter. */
size_t objc, /* Number of arguments. */
Tcl_Size objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
int result;
Command *cmdPtr = (Command *) clientData;
if (objc > INT_MAX) {
objc = TCL_INDEX_NONE;
return TclCommandWordLimitError(interp, objc);
}
if (cmdPtr->objProc != NULL) {
result = cmdPtr->objProc(cmdPtr->objClientData, interp, objc, objv);
@@ -3311,10 +3311,13 @@ invokeObj2Command(
static int cmdWrapper2Proc(void *clientData,
Tcl_Interp *interp,
size_t objc,
Tcl_Size objc,
Tcl_Obj *const objv[])
{
Command *cmdPtr = (Command *)clientData;
if (objc > INT_MAX) {
return TclCommandWordLimitError(interp, objc);
}
return cmdPtr->objProc(cmdPtr->objClientData, interp, objc, objv);
}
@@ -3553,14 +3556,14 @@ Tcl_GetCommandFullName(
if ((cmdPtr != NULL) && TclRoutineHasName(cmdPtr)) {
if (cmdPtr->nsPtr != NULL) {
Tcl_AppendToObj(objPtr, cmdPtr->nsPtr->fullName, TCL_INDEX_NONE);
Tcl_AppendToObj(objPtr, cmdPtr->nsPtr->fullName, -1);
if (cmdPtr->nsPtr != iPtr->globalNsPtr) {
Tcl_AppendToObj(objPtr, "::", 2);
}
}
if (cmdPtr->hPtr != NULL) {
name = (char *)Tcl_GetHashKey(cmdPtr->hPtr->tablePtr, cmdPtr->hPtr);
Tcl_AppendToObj(objPtr, name, TCL_INDEX_NONE);
Tcl_AppendToObj(objPtr, name, -1);
}
}
}
@@ -3931,7 +3934,7 @@ CallCommandTraces(
* The value given for the code argument.
*
* Side effects:
* Transfers a message from the cancelation message to the interpreter.
* Transfers a message from the cancellation message to the interpreter.
*
*----------------------------------------------------------------------
*/
@@ -4061,7 +4064,7 @@ TclInterpReady(
if (iPtr->flags & DELETED) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"attempt to call eval in deleted interpreter", TCL_INDEX_NONE));
"attempt to call eval in deleted interpreter", -1));
Tcl_SetErrorCode(interp, "TCL", "IDELETE",
"attempt to call eval in deleted interpreter", NULL);
return TCL_ERROR;
@@ -4090,7 +4093,7 @@ TclInterpReady(
}
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"too many nested evaluations (infinite loop?)", TCL_INDEX_NONE));
"too many nested evaluations (infinite loop?)", -1));
Tcl_SetErrorCode(interp, "TCL", "LIMIT", "STACK", NULL);
return TCL_ERROR;
}
@@ -4199,7 +4202,7 @@ Tcl_Canceled(
if (flags & TCL_LEAVE_ERR_MSG) {
const char *id, *message = NULL;
size_t length;
Tcl_Size length;
/*
* Setup errorCode variables so that we can differentiate between
@@ -4224,7 +4227,7 @@ Tcl_Canceled(
}
}
Tcl_SetObjResult(interp, Tcl_NewStringObj(message, TCL_INDEX_NONE));
Tcl_SetObjResult(interp, Tcl_NewStringObj(message, -1));
Tcl_SetErrorCode(interp, "TCL", "CANCEL", id, message, NULL);
}
@@ -4370,7 +4373,7 @@ int
Tcl_EvalObjv(
Tcl_Interp *interp, /* Interpreter in which to evaluate the
* command. Also used for error reporting. */
size_t objc, /* Number of words in command. */
Tcl_Size objc, /* Number of words in command. */
Tcl_Obj *const objv[], /* An array of pointers to objects that are
* the words that make up the command. */
int flags) /* Collection of OR-ed bits that control the
@@ -4389,7 +4392,7 @@ int
TclNREvalObjv(
Tcl_Interp *interp, /* Interpreter in which to evaluate the
* command. Also used for error reporting. */
size_t objc, /* Number of words in command. */
Tcl_Size objc, /* Number of words in command. */
Tcl_Obj *const objv[], /* An array of pointers to objects that are
* the words that make up the command. */
int flags, /* Collection of OR-ed bits that control the
@@ -4797,7 +4800,7 @@ TEOV_Error(
Interp *iPtr = (Interp *) interp;
Tcl_Obj *listPtr;
const char *cmdString;
size_t cmdLen;
Tcl_Size cmdLen;
int objc = PTR2INT(data[0]);
Tcl_Obj **objv = (Tcl_Obj **)data[1];
@@ -4826,7 +4829,7 @@ TEOV_NotFound(
{
Command * cmdPtr;
Interp *iPtr = (Interp *) interp;
size_t i, newObjc, handlerObjc;
Tcl_Size i, newObjc, handlerObjc;
Tcl_Obj **newObjv, **handlerObjv;
CallFrame *varFramePtr = iPtr->varFramePtr;
Namespace *currNsPtr = NULL;/* Used to check for and invoke any registered
@@ -4854,7 +4857,7 @@ TEOV_NotFound(
/*
* Get the list of words for the unknown handler and allocate enough space
* to hold both the handler prefix and all words of the command invokation
* to hold both the handler prefix and all words of the command invocation
* itself.
*/
@@ -4953,7 +4956,7 @@ TEOV_RunEnterTraces(
{
Interp *iPtr = (Interp *) interp;
Command *cmdPtr = *cmdPtrPtr;
size_t length, newEpoch, cmdEpoch = cmdPtr->cmdEpoch;
Tcl_Size length, newEpoch, cmdEpoch = cmdPtr->cmdEpoch;
int traceCode = TCL_OK;
const char *command = Tcl_GetStringFromObj(commandPtr, &length);
@@ -5006,7 +5009,7 @@ TEOV_RunLeaveTraces(
Tcl_Obj *commandPtr = (Tcl_Obj *)data[1];
Command *cmdPtr = (Command *)data[2];
Tcl_Obj **objv = (Tcl_Obj **)data[3];
size_t length;
Tcl_Size length;
const char *command = Tcl_GetStringFromObj(commandPtr, &length);
if (!(cmdPtr->flags & CMD_DYING)) {
@@ -5089,7 +5092,7 @@ Tcl_EvalTokensStandard(
* errors. */
Tcl_Token *tokenPtr, /* Pointer to first in an array of tokens to
* evaluate and concatenate. */
size_t count) /* Number of tokens to consider at tokenPtr.
Tcl_Size count) /* Number of tokens to consider at tokenPtr.
* Must be at least 1. */
{
return TclSubstTokens(interp, tokenPtr, count, /* numLeftPtr */ NULL, 1,
@@ -5122,7 +5125,7 @@ Tcl_EvalEx(
Tcl_Interp *interp, /* Interpreter in which to evaluate the
* script. Also used for error reporting. */
const char *script, /* First character of script to evaluate. */
size_t numBytes, /* Number of bytes in script. If -1, the
Tcl_Size numBytes, /* Number of bytes in script. If -1, the
* script consists of all bytes up to the
* first null character. */
int flags) /* Collection of OR-ed bits that control the
@@ -5137,19 +5140,19 @@ TclEvalEx(
Tcl_Interp *interp, /* Interpreter in which to evaluate the
* script. Also used for error reporting. */
const char *script, /* First character of script to evaluate. */
size_t numBytes, /* Number of bytes in script. If -1, the
Tcl_Size numBytes, /* Number of bytes in script. If -1, the
* script consists of all bytes up to the
* first NUL character. */
int flags, /* Collection of OR-ed bits that control the
* evaluation of the script. Only
* TCL_EVAL_GLOBAL is currently supported. */
size_t line, /* The line the script starts on. */
Tcl_Size line, /* The line the script starts on. */
int *clNextOuter, /* Information about an outer context for */
const char *outerScript) /* continuation line data. This is set only in
* TclSubstTokens(), to properly handle
* [...]-nested commands. The 'outerScript'
* refers to the most-outer script containing
* the embedded command, which is refered to
* the embedded command, which is referred to
* by 'script'. The 'clNextOuter' refers to
* the current entry in the table of
* continuation lines in this "main script",
@@ -5164,17 +5167,17 @@ TclEvalEx(
{
Interp *iPtr = (Interp *) interp;
const char *p, *next;
const unsigned int minObjs = 20;
const int minObjs = 20;
Tcl_Obj **objv, **objvSpace;
int *expand, *lines, *lineSpace;
Tcl_Token *tokenPtr;
int bytesLeft, expandRequested, code = TCL_OK;
size_t commandLength;
int expandRequested, code = TCL_OK;
Tcl_Size bytesLeft, commandLength;
CallFrame *savedVarFramePtr;/* Saves old copy of iPtr->varFramePtr in case
* TCL_EVAL_GLOBAL was set. */
int allowExceptions = (iPtr->evalFlags & TCL_ALLOW_EXCEPTIONS);
int gotParse = 0;
TCL_HASH_TYPE i, objectsUsed = 0;
Tcl_Size i, objectsUsed = 0;
/* These variables keep track of how much
* state has been allocated while evaluating
* the script, so that it can be freed
@@ -5203,7 +5206,7 @@ TclEvalEx(
}
}
if (numBytes == TCL_INDEX_NONE) {
if (numBytes < 0) {
numBytes = strlen(script);
}
Tcl_ResetResult(interp);
@@ -5309,11 +5312,11 @@ TclEvalEx(
* per-command parsing.
*/
size_t wordLine = line;
Tcl_Size wordLine = line;
const char *wordStart = parsePtr->commandStart;
int *wordCLNext = clNext;
unsigned int objectsNeeded = 0;
unsigned int numWords = parsePtr->numWords;
Tcl_Size objectsNeeded = 0;
Tcl_Size numWords = parsePtr->numWords;
/*
* Generate an array of objects for the words of the command.
@@ -5332,6 +5335,8 @@ TclEvalEx(
for (objectsUsed = 0, tokenPtr = parsePtr->tokenPtr;
objectsUsed < numWords;
objectsUsed++, tokenPtr += tokenPtr->numComponents+1) {
Tcl_Size additionalObjsCount;
/*
* TIP #280. Track lines to current word. Save the information
* on a per-word basis, signaling dynamic words as needed.
@@ -5364,7 +5369,7 @@ TclEvalEx(
objv[objectsUsed] = Tcl_GetObjResult(interp);
Tcl_IncrRefCount(objv[objectsUsed]);
if (tokenPtr->type == TCL_TOKEN_EXPAND_WORD) {
size_t numElements;
Tcl_Size numElements;
code = TclListObjLengthM(interp, objv[objectsUsed],
&numElements);
@@ -5381,12 +5386,22 @@ TclEvalEx(
expandRequested = 1;
expand[objectsUsed] = 1;
objectsNeeded += (numElements ? numElements : 1);
additionalObjsCount = (numElements ? numElements : 1);
} else {
expand[objectsUsed] = 0;
objectsNeeded++;
additionalObjsCount = 1;
}
/* Currently max command words in INT_MAX */
if (additionalObjsCount > INT_MAX ||
objectsNeeded > (INT_MAX - additionalObjsCount)) {
code = TclCommandWordLimitError(interp, -1);
Tcl_DecrRefCount(objv[objectsUsed]);
break;
}
objectsNeeded += additionalObjsCount;
if (wordCLNext) {
TclContinuationsEnterDerived(objv[objectsUsed],
wordStart - outerScript, wordCLNext);
@@ -5415,7 +5430,7 @@ TclEvalEx(
objectsUsed = 0;
while (wordIdx--) {
if (expand[wordIdx]) {
size_t numElements;
Tcl_Size numElements;
Tcl_Obj **elements, *temp = copy[wordIdx];
TclListObjGetElementsM(NULL, temp, &numElements,
@@ -5608,7 +5623,7 @@ TclEvalEx(
void
TclAdvanceLines(
size_t *line,
Tcl_Size *line,
const char *start,
const char *end)
{
@@ -5643,7 +5658,7 @@ TclAdvanceLines(
void
TclAdvanceContinuations(
size_t *line,
Tcl_Size *line,
int **clNextPtrPtr,
int loc)
{
@@ -5715,8 +5730,8 @@ TclArgumentEnter(
/*
* Ignore argument words without line information (= dynamic). If they
* are variables they may have location information associated with
* that, either through globally recorded 'set' invokations, or
* literals in bytecode. Eitehr way there is no need to record
* that, either through globally recorded 'set' invocations, or
* literals in bytecode. Either way there is no need to record
* something here.
*/
@@ -5823,7 +5838,7 @@ TclArgumentBCEnter(
void *codePtr,
CmdFrame *cfPtr,
int cmd,
size_t pc)
Tcl_Size pc)
{
ExtCmdLoc *eclPtr;
int word;
@@ -5852,7 +5867,7 @@ TclArgumentBCEnter(
* housekeeping, and can escape now.
*/
if (ePtr->nline != (size_t)objc) {
if (ePtr->nline != objc) {
return;
}
@@ -6112,7 +6127,7 @@ TclNREvalObjEx(
if (TclListObjIsCanonical(objPtr)) {
CmdFrame *eoFramePtr = NULL;
size_t objc;
Tcl_Size objc;
Tcl_Obj *listPtr, **objv;
/*
@@ -6137,7 +6152,11 @@ TclNREvalObjEx(
*/
Tcl_IncrRefCount(objPtr);
listPtr = TclListObjCopy(interp, objPtr);
listPtr = TclDuplicatePureObj(interp, objPtr, tclListType);
if (!listPtr) {
Tcl_DecrRefCount(objPtr);
return TCL_ERROR;
}
Tcl_IncrRefCount(listPtr);
if (word != INT_MIN) {
@@ -6222,7 +6241,7 @@ TclNREvalObjEx(
*/
const char *script;
size_t numSrcBytes;
Tcl_Size numSrcBytes;
/*
* Now we check if we have data about invisible continuation lines for
@@ -6276,7 +6295,7 @@ TEOEx_ByteCodeCallback(
}
if ((result != TCL_OK) && (result != TCL_ERROR) && !allowExceptions) {
const char *script;
size_t numSrcBytes;
Tcl_Size numSrcBytes;
ProcessUnexpectedResult(interp, result);
result = TCL_ERROR;
@@ -6361,10 +6380,10 @@ ProcessUnexpectedResult(
Tcl_ResetResult(interp);
if (returnCode == TCL_BREAK) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"invoked \"break\" outside of a loop", TCL_INDEX_NONE));
"invoked \"break\" outside of a loop", -1));
} else if (returnCode == TCL_CONTINUE) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"invoked \"continue\" outside of a loop", TCL_INDEX_NONE));
"invoked \"continue\" outside of a loop", -1));
} else {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"command returned bad code: %d", returnCode));
@@ -6410,7 +6429,7 @@ Tcl_ExprLong(
*ptr = 0;
} else {
exprPtr = Tcl_NewStringObj(exprstring, TCL_INDEX_NONE);
exprPtr = Tcl_NewStringObj(exprstring, -1);
Tcl_IncrRefCount(exprPtr);
result = Tcl_ExprLongObj(interp, exprPtr, ptr);
Tcl_DecrRefCount(exprPtr);
@@ -6435,7 +6454,7 @@ Tcl_ExprDouble(
*ptr = 0.0;
} else {
exprPtr = Tcl_NewStringObj(exprstring, TCL_INDEX_NONE);
exprPtr = Tcl_NewStringObj(exprstring, -1);
Tcl_IncrRefCount(exprPtr);
result = Tcl_ExprDoubleObj(interp, exprPtr, ptr);
Tcl_DecrRefCount(exprPtr);
@@ -6460,7 +6479,7 @@ Tcl_ExprBoolean(
return TCL_OK;
} else {
int result;
Tcl_Obj *exprPtr = Tcl_NewStringObj(exprstring, TCL_INDEX_NONE);
Tcl_Obj *exprPtr = Tcl_NewStringObj(exprstring, -1);
Tcl_IncrRefCount(exprPtr);
result = Tcl_ExprBooleanObj(interp, exprPtr, ptr);
@@ -6673,7 +6692,7 @@ TclObjInvoke(
}
if ((objc < 1) || (objv == NULL)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"illegal argument vector", TCL_INDEX_NONE));
"illegal argument vector", -1));
return TCL_ERROR;
}
if ((flags & TCL_INVOKE_HIDDEN) == 0) {
@@ -6772,7 +6791,7 @@ Tcl_ExprString(
Tcl_SetObjResult(interp, Tcl_NewWideIntObj(0));
} else {
Tcl_Obj *resultPtr, *exprObj = Tcl_NewStringObj(expr, TCL_INDEX_NONE);
Tcl_Obj *resultPtr, *exprObj = Tcl_NewStringObj(expr, -1);
Tcl_IncrRefCount(exprObj);
code = Tcl_ExprObj(interp, exprObj, &resultPtr);
@@ -6810,7 +6829,7 @@ Tcl_AppendObjToErrorInfo(
* pertains. */
Tcl_Obj *objPtr) /* Message to record. */
{
size_t length;
Tcl_Size length;
const char *message = Tcl_GetStringFromObj(objPtr, &length);
Interp *iPtr = (Interp *) interp;
@@ -6886,10 +6905,10 @@ Tcl_VarEval(
if (string == NULL) {
break;
}
Tcl_DStringAppend(&buf, string, TCL_INDEX_NONE);
Tcl_DStringAppend(&buf, string, -1);
}
result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), TCL_INDEX_NONE, 0);
result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, 0);
Tcl_DStringFree(&buf);
return result;
}
@@ -6911,17 +6930,17 @@ Tcl_VarEval(
*----------------------------------------------------------------------
*/
size_t
Tcl_Size
Tcl_SetRecursionLimit(
Tcl_Interp *interp, /* Interpreter whose nesting limit is to be
* set. */
size_t depth) /* New value for maximimum depth. */
Tcl_Size depth) /* New value for maximimum depth. */
{
Interp *iPtr = (Interp *) interp;
size_t old;
Tcl_Size old;
old = iPtr->maxNestingDepth;
if (depth + 1 > 1) {
if (depth > 0) {
iPtr->maxNestingDepth = depth;
}
return old;
@@ -7031,7 +7050,7 @@ ExprCeilFunc(
code = Tcl_GetDoubleFromObj(interp, objv[1], &d);
#ifdef ACCEPT_NAN
if (code != TCL_OK) {
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objv[1], &tclDoubleType.objType);
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objv[1], tclDoubleType);
if (irPtr) {
Tcl_SetObjResult(interp, objv[1]);
@@ -7071,7 +7090,7 @@ ExprFloorFunc(
code = Tcl_GetDoubleFromObj(interp, objv[1], &d);
#ifdef ACCEPT_NAN
if (code != TCL_OK) {
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objv[1], &tclDoubleType.objType);
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objv[1], tclDoubleType);
if (irPtr) {
Tcl_SetObjResult(interp, objv[1]);
@@ -7192,7 +7211,7 @@ ExprIsqrtFunc(
negarg:
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"square root of negative argument", TCL_INDEX_NONE));
"square root of negative argument", -1));
Tcl_SetErrorCode(interp, "ARITH", "DOMAIN",
"domain error: argument not in valid range", NULL);
return TCL_ERROR;
@@ -7217,7 +7236,7 @@ ExprSqrtFunc(
code = Tcl_GetDoubleFromObj(interp, objv[1], &d);
#ifdef ACCEPT_NAN
if (code != TCL_OK) {
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objv[1], &tclDoubleType.objType);
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objv[1], tclDoubleType);
if (irPtr) {
Tcl_SetObjResult(interp, objv[1]);
@@ -7271,7 +7290,7 @@ ExprUnaryFunc(
code = Tcl_GetDoubleFromObj(interp, objv[1], &d);
#ifdef ACCEPT_NAN
if (code != TCL_OK) {
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objv[1], &tclDoubleType.objType);
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objv[1], tclDoubleType);
if (irPtr) {
d = irPtr->doubleValue;
@@ -7335,7 +7354,7 @@ ExprBinaryFunc(
code = Tcl_GetDoubleFromObj(interp, objv[1], &d1);
#ifdef ACCEPT_NAN
if (code != TCL_OK) {
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objv[1], &tclDoubleType.objType);
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objv[1], tclDoubleType);
if (irPtr) {
d1 = irPtr->doubleValue;
@@ -7350,7 +7369,7 @@ ExprBinaryFunc(
code = Tcl_GetDoubleFromObj(interp, objv[2], &d2);
#ifdef ACCEPT_NAN
if (code != TCL_OK) {
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objv[1], &tclDoubleType.objType);
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objv[1], tclDoubleType);
if (irPtr) {
d2 = irPtr->doubleValue;
@@ -7394,7 +7413,7 @@ ExprAbsFunc(
goto unChanged;
} else if (l == 0) {
if (TclHasStringRep(objv[1])) {
size_t numBytes;
Tcl_Size numBytes;
const char *bytes = Tcl_GetStringFromObj(objv[1], &numBytes);
while (numBytes) {
@@ -7511,7 +7530,7 @@ ExprDoubleFunc(
}
if (Tcl_GetDoubleFromObj(interp, objv[1], &dResult) != TCL_OK) {
#ifdef ACCEPT_NAN
if (TclHasInternalRep(objv[1], &tclDoubleType.objType)) {
if (TclHasInternalRep(objv[1], tclDoubleType)) {
Tcl_SetObjResult(interp, objv[1]);
return TCL_OK;
}
@@ -8474,7 +8493,7 @@ Tcl_NRCallObjProc(
Tcl_Interp *interp,
Tcl_ObjCmdProc *objProc,
void *clientData,
size_t objc,
Tcl_Size objc,
Tcl_Obj *const objv[])
{
NRE_callback *rootPtr = TOP_CB(interp);
@@ -8497,7 +8516,7 @@ int wrapperNRObjProc(
if (objc < 0) {
objc = -1;
}
return proc(clientData, interp, (size_t)objc, objv);
return proc(clientData, interp, (Tcl_Size)objc, objv);
}
int
@@ -8505,7 +8524,7 @@ Tcl_NRCallObjProc2(
Tcl_Interp *interp,
Tcl_ObjCmdProc2 *objProc,
void *clientData,
size_t objc,
ptrdiff_t objc,
Tcl_Obj *const objv[])
{
if (objc > INT_MAX) {
@@ -8561,7 +8580,7 @@ static int cmdWrapperNreProc(
if (objc < 0) {
objc = -1;
}
return info->nreProc(info->clientData, interp, (size_t)objc, objv);
return info->nreProc(info->clientData, interp, objc, objv);
}
Tcl_Command
@@ -8657,7 +8676,7 @@ int
Tcl_NREvalObjv(
Tcl_Interp *interp, /* Interpreter in which to evaluate the
* command. Also used for error reporting. */
size_t objc, /* Number of words in command. */
Tcl_Size objc, /* Number of words in command. */
Tcl_Obj *const objv[], /* An array of pointers to objects that are
* the words that make up the command. */
int flags) /* Collection of OR-ed bits that control the
@@ -8672,7 +8691,7 @@ int
Tcl_NRCmdSwap(
Tcl_Interp *interp,
Tcl_Command cmd,
size_t objc,
Tcl_Size objc,
Tcl_Obj *const objv[],
int flags)
{
@@ -8806,7 +8825,7 @@ TclNRTailcallObjCmd(
if (!(iPtr->varFramePtr->isProcCallFrame & 1)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"tailcall can only be called from a proc, lambda or method", TCL_INDEX_NONE));
"tailcall can only be called from a proc, lambda or method", -1));
Tcl_SetErrorCode(interp, "TCL", "TAILCALL", "ILLEGAL", NULL);
return TCL_ERROR;
}
@@ -8836,7 +8855,7 @@ TclNRTailcallObjCmd(
* namespace, the rest the command to be tailcalled.
*/
nsObjPtr = Tcl_NewStringObj(nsPtr->fullName, TCL_INDEX_NONE);
nsObjPtr = Tcl_NewStringObj(nsPtr->fullName, -1);
listPtr = Tcl_NewListObj(objc, objv);
TclListObjSetElement(interp, listPtr, 0, nsObjPtr);
@@ -8864,7 +8883,7 @@ TclNRTailcallEval(
Interp *iPtr = (Interp *) interp;
Tcl_Obj *listPtr = (Tcl_Obj *)data[0], *nsObjPtr;
Tcl_Namespace *nsPtr;
size_t objc;
Tcl_Size objc;
Tcl_Obj **objv;
TclListObjGetElementsM(interp, listPtr, &objc, &objv);
@@ -8968,7 +8987,7 @@ TclNRYieldObjCmd(
if (!corPtr) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"yield can only be called in a coroutine", TCL_INDEX_NONE));
"yield can only be called in a coroutine", -1));
Tcl_SetErrorCode(interp, "TCL", "COROUTINE", "ILLEGAL_YIELD", NULL);
return TCL_ERROR;
}
@@ -9001,14 +9020,14 @@ TclNRYieldToObjCmd(
if (!corPtr) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"yieldto can only be called in a coroutine", TCL_INDEX_NONE));
"yieldto can only be called in a coroutine", -1));
Tcl_SetErrorCode(interp, "TCL", "COROUTINE", "ILLEGAL_YIELD", NULL);
return TCL_ERROR;
}
if (((Namespace *) nsPtr)->flags & NS_DYING) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"yieldto called in deleted namespace", TCL_INDEX_NONE));
"yieldto called in deleted namespace", -1));
Tcl_SetErrorCode(interp, "TCL", "COROUTINE", "YIELDTO_IN_DELETED",
NULL);
return TCL_ERROR;
@@ -9021,7 +9040,7 @@ TclNRYieldToObjCmd(
*/
listPtr = Tcl_NewListObj(objc, objv);
nsObjPtr = Tcl_NewStringObj(nsPtr->fullName, TCL_INDEX_NONE);
nsObjPtr = Tcl_NewStringObj(nsPtr->fullName, -1);
TclListObjSetElement(interp, listPtr, 0, nsObjPtr);
/*
@@ -9212,7 +9231,7 @@ TclNRCoroutineActivateCallback(
*/
corPtr->stackLevel = &corPtr;
size_t numLevels = corPtr->auxNumLevels;
Tcl_Size numLevels = corPtr->auxNumLevels;
corPtr->auxNumLevels = iPtr->numLevels;
SAVE_CONTEXT(corPtr->caller);
@@ -9243,7 +9262,7 @@ TclNRCoroutineActivateCallback(
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"cannot yield: C stack busy", TCL_INDEX_NONE));
"cannot yield: C stack busy", -1));
Tcl_SetErrorCode(interp, "TCL", "COROUTINE", "CANT_YIELD",
NULL);
return TCL_ERROR;
@@ -9261,7 +9280,7 @@ TclNRCoroutineActivateCallback(
corPtr->yieldPtr = NULL;
corPtr->stackLevel = NULL;
size_t numLevels = iPtr->numLevels;
Tcl_Size numLevels = iPtr->numLevels;
iPtr->numLevels = corPtr->auxNumLevels;
corPtr->auxNumLevels = numLevels - corPtr->auxNumLevels;
@@ -9288,7 +9307,7 @@ TclNREvalList(
Tcl_Interp *interp,
TCL_UNUSED(int) /*result*/)
{
size_t objc;
Tcl_Size objc;
Tcl_Obj **objv;
Tcl_Obj *listPtr = (Tcl_Obj *)data[0];
@@ -9332,7 +9351,7 @@ CoroTypeObjCmd(
cmdPtr = (Command *) Tcl_GetCommandFromObj(interp, objv[1]);
if ((!cmdPtr) || (cmdPtr->nreProc != TclNRInterpCoroutine)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"can only get coroutine type of a coroutine", TCL_INDEX_NONE));
"can only get coroutine type of a coroutine", -1));
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "COROUTINE",
TclGetString(objv[1]), NULL);
return TCL_ERROR;
@@ -9345,7 +9364,7 @@ CoroTypeObjCmd(
corPtr = (CoroutineData *)cmdPtr->objClientData;
if (!COR_IS_SUSPENDED(corPtr)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj("active", TCL_INDEX_NONE));
Tcl_SetObjResult(interp, Tcl_NewStringObj("active", -1));
return TCL_OK;
}
@@ -9356,14 +9375,14 @@ CoroTypeObjCmd(
switch (corPtr->nargs) {
case COROUTINE_ARGUMENTS_SINGLE_OPTIONAL:
Tcl_SetObjResult(interp, Tcl_NewStringObj("yield", TCL_INDEX_NONE));
Tcl_SetObjResult(interp, Tcl_NewStringObj("yield", -1));
return TCL_OK;
case COROUTINE_ARGUMENTS_ARBITRARY:
Tcl_SetObjResult(interp, Tcl_NewStringObj("yieldto", TCL_INDEX_NONE));
Tcl_SetObjResult(interp, Tcl_NewStringObj("yieldto", -1));
return TCL_OK;
default:
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"unknown coroutine type", TCL_INDEX_NONE));
"unknown coroutine type", -1));
Tcl_SetErrorCode(interp, "TCL", "COROUTINE", "BAD_TYPE", NULL);
return TCL_ERROR;
}
@@ -9392,7 +9411,7 @@ GetCoroutineFromObj(
Command *cmdPtr = (Command *) Tcl_GetCommandFromObj(interp, objPtr);
if ((!cmdPtr) || (cmdPtr->nreProc != TclNRInterpCoroutine)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(errMsg, TCL_INDEX_NONE));
Tcl_SetObjResult(interp, Tcl_NewStringObj(errMsg, -1));
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "COROUTINE",
TclGetString(objPtr), NULL);
return NULL;
@@ -9426,7 +9445,7 @@ TclNRCoroInjectObjCmd(
}
if (!COR_IS_SUSPENDED(corPtr)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"can only inject a command into a suspended coroutine", TCL_INDEX_NONE));
"can only inject a command into a suspended coroutine", -1));
Tcl_SetErrorCode(interp, "TCL", "COROUTINE", "ACTIVE", NULL);
return TCL_ERROR;
}
@@ -9504,7 +9523,7 @@ TclNRCoroProbeObjCmd(
*/
corPtr->stackLevel = &corPtr;
size_t numLevels = corPtr->auxNumLevels;
Tcl_Size numLevels = corPtr->auxNumLevels;
corPtr->auxNumLevels = iPtr->numLevels;
/*
@@ -9548,9 +9567,9 @@ InjectHandler(
{
CoroutineData *corPtr = (CoroutineData *)data[0];
Tcl_Obj *listPtr = (Tcl_Obj *)data[1];
size_t nargs = PTR2INT(data[2]);
Tcl_Size nargs = PTR2INT(data[2]);
void *isProbe = data[3];
size_t objc;
Tcl_Size objc;
Tcl_Obj **objv;
if (!isProbe) {
@@ -9595,7 +9614,7 @@ InjectHandlerPostCall(
{
CoroutineData *corPtr = (CoroutineData *)data[0];
Tcl_Obj *listPtr = (Tcl_Obj *)data[1];
size_t nargs = PTR2INT(data[2]);
Tcl_Size nargs = PTR2INT(data[2]);
void *isProbe = data[3];
/*
@@ -9618,7 +9637,7 @@ InjectHandlerPostCall(
}
corPtr->nargs = nargs;
corPtr->stackLevel = NULL;
size_t numLevels = iPtr->numLevels;
Tcl_Size numLevels = iPtr->numLevels;
iPtr->numLevels = corPtr->auxNumLevels;
corPtr->auxNumLevels = numLevels - corPtr->auxNumLevels;
iPtr->execEnvPtr = corPtr->callerEEPtr;
@@ -9663,7 +9682,7 @@ NRInjectObjCmd(
}
if (!COR_IS_SUSPENDED(corPtr)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"can only inject a command into a suspended coroutine", TCL_INDEX_NONE));
"can only inject a command into a suspended coroutine", -1));
Tcl_SetErrorCode(interp, "TCL", "COROUTINE", "ACTIVE", NULL);
return TCL_ERROR;
}
@@ -9714,10 +9733,10 @@ TclNRInterpCoroutine(
}
break;
default:
if (corPtr->nargs + 1 != (size_t)objc) {
if (corPtr->nargs + 1 != objc) {
Tcl_SetObjResult(interp,
Tcl_NewStringObj("wrong coro nargs; how did we get here? "
"not implemented!", TCL_INDEX_NONE));
"not implemented!", -1));
Tcl_SetErrorCode(interp, "TCL", "WRONGARGS", NULL);
return TCL_ERROR;
}
+86 -135
View File
@@ -22,11 +22,11 @@
* special conditions in the parsing of a format specifier.
*/
#define BINARY_ALL ((size_t)-1) /* Use all elements in the argument. */
#define BINARY_NOCOUNT ((size_t)-2) /* No count was specified in format. */
#define BINARY_ALL -1 /* Use all elements in the argument. */
#define BINARY_NOCOUNT -2 /* No count was specified in format. */
/*
* The following flags may be ORed together and returned by GetFormatSpec
* The following flags may be OR'ed together and returned by GetFormatSpec
*/
#define BINARY_SIGNED 0 /* Field to be read as signed data */
@@ -37,7 +37,7 @@
* placed in the object cache by 'binary scan' before it bails out and
* switches back to Plan A (creating a new object for each value.)
* Theoretically, it would be possible to keep the cache about for the values
* that are already in it, but that makes the code slower in practise when
* that are already in it, but that makes the code slower in practice when
* overflow happens, and makes little odds the rest of the time (as measured
* on my machine.) It is also slower (on the sample I tried at least) to grow
* the cache to hold all items we might want to put in it; presumably the
@@ -61,10 +61,10 @@ static int FormatNumber(Tcl_Interp *interp, int type,
Tcl_Obj *src, unsigned char **cursorPtr);
static void FreeProperByteArrayInternalRep(Tcl_Obj *objPtr);
static int GetFormatSpec(const char **formatPtr, char *cmdPtr,
size_t *countPtr, int *flagsPtr);
Tcl_Size *countPtr, int *flagsPtr);
static Tcl_Obj * ScanNumber(unsigned char *buffer, int type,
int flags, Tcl_HashTable **numberCachePtr);
static int SetByteArrayFromAny(Tcl_Interp *interp, size_t limit,
static int SetByteArrayFromAny(Tcl_Interp *interp, Tcl_Size limit,
Tcl_Obj *objPtr);
static void UpdateStringOfByteArray(Tcl_Obj *listPtr);
static void DeleteScanNumberCache(Tcl_HashTable *numberCachePtr);
@@ -174,18 +174,19 @@ static const Tcl_ObjType properByteArrayType = {
*/
typedef struct {
size_t used; /* The number of bytes used in the byte
Tcl_Size used; /* The number of bytes used in the byte
* array. */
size_t allocated; /* The amount of space actually allocated
Tcl_Size allocated; /* The amount of space actually allocated
* minus 1 byte. */
unsigned char bytes[TCLFLEXARRAY]; /* The array of bytes. The actual size of this
* field depends on the 'allocated' field
* above. */
} ByteArray;
#define BYTEARRAY_MAX_LEN (TCL_SIZE_MAX - (Tcl_Size)offsetof(ByteArray, bytes))
#define BYTEARRAY_SIZE(len) \
( (offsetof(ByteArray, bytes) + (len) < offsetof(ByteArray, bytes)) \
? (Tcl_Panic("max size of a Tcl value exceeded"), 0) \
( (len < 0 || BYTEARRAY_MAX_LEN < (len)) \
? (Tcl_Panic("negative length specified or max size of a Tcl value exceeded"), 0) \
: (offsetof(ByteArray, bytes) + (len)) )
#define GET_BYTEARRAY(irPtr) ((ByteArray *) (irPtr)->twoPtrValue.ptr1)
#define SET_BYTEARRAY(irPtr, baPtr) \
@@ -222,7 +223,7 @@ Tcl_Obj *
Tcl_NewByteArrayObj(
const unsigned char *bytes, /* The array of bytes used to initialize the
* new object. */
size_t numBytes) /* Number of bytes in the array */
Tcl_Size numBytes) /* Number of bytes in the array */
{
#ifdef TCL_MEM_DEBUG
return Tcl_DbNewByteArrayObj(bytes, numBytes, "unknown", 0);
@@ -265,7 +266,7 @@ Tcl_Obj *
Tcl_DbNewByteArrayObj(
const unsigned char *bytes, /* The array of bytes used to initialize the
* new object. */
size_t numBytes, /* Number of bytes in the array */
Tcl_Size numBytes, /* Number of bytes in the array */
const char *file, /* The name of the source file calling this
* procedure; used for debugging. */
int line) /* Line number in the source file; used for
@@ -282,7 +283,7 @@ Tcl_Obj *
Tcl_DbNewByteArrayObj(
const unsigned char *bytes, /* The array of bytes used to initialize the
* new object. */
size_t numBytes, /* Number of bytes in the array */
Tcl_Size numBytes, /* Number of bytes in the array */
TCL_UNUSED(const char *) /*file*/,
TCL_UNUSED(int) /*line*/)
{
@@ -313,7 +314,8 @@ Tcl_SetByteArrayObj(
Tcl_Obj *objPtr, /* Object to initialize as a ByteArray. */
const unsigned char *bytes, /* The array of bytes to use as the new value.
* May be NULL even if numBytes > 0. */
size_t numBytes) /* Number of bytes in the array */
Tcl_Size numBytes) /* Number of bytes in the array.
* Must be >= 0 */
{
ByteArray *byteArrayPtr;
Tcl_ObjInternalRep ir;
@@ -323,6 +325,7 @@ Tcl_SetByteArrayObj(
}
TclInvalidateStringRep(objPtr);
assert(numBytes >= 0);
byteArrayPtr = (ByteArray *)Tcl_Alloc(BYTEARRAY_SIZE(numBytes));
byteArrayPtr->used = numBytes;
byteArrayPtr->allocated = numBytes;
@@ -357,7 +360,7 @@ unsigned char *
Tcl_GetBytesFromObj(
Tcl_Interp *interp, /* For error reporting */
Tcl_Obj *objPtr, /* Value to extract from */
size_t *numBytesPtr) /* If non-NULL, write the number of bytes
Tcl_Size *numBytesPtr) /* If non-NULL, write the number of bytes
* in the array here */
{
ByteArray *baPtr;
@@ -378,33 +381,6 @@ Tcl_GetBytesFromObj(
return baPtr->bytes;
}
unsigned char *
TclGetBytesFromObj(
Tcl_Interp *interp, /* For error reporting */
Tcl_Obj *objPtr, /* Value to extract from */
int *numBytesPtr) /* If non-NULL, write the number of bytes
* in the array here */
{
size_t numBytes = 0;
unsigned char *bytes = Tcl_GetBytesFromObj(interp, objPtr, &numBytes);
if (bytes && numBytesPtr) {
if (numBytes > INT_MAX) {
/* Caller asked for numBytes to be written to an int, but the
* value is outside the int range. */
if (interp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"byte sequence length exceeds INT_MAX", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "API", "OUTDATED", NULL);
}
return NULL;
} else {
*numBytesPtr = (int) numBytes;
}
}
return bytes;
}
/*
*----------------------------------------------------------------------
@@ -431,11 +407,13 @@ TclGetBytesFromObj(
unsigned char *
Tcl_SetByteArrayLength(
Tcl_Obj *objPtr, /* The ByteArray object. */
size_t numBytes) /* Number of bytes in resized array */
Tcl_Size numBytes) /* Number of bytes in resized array
* Must be >= 0 */
{
ByteArray *byteArrayPtr;
Tcl_ObjInternalRep *irPtr;
assert(numBytes >= 0);
if (Tcl_IsShared(objPtr)) {
Tcl_Panic("%s called with shared object", "Tcl_SetByteArrayLength");
}
@@ -466,8 +444,8 @@ Tcl_SetByteArrayLength(
* MakeByteArray --
*
* Generate a ByteArray internal rep from the string rep of objPtr.
* The generated byte sequence may have no more than limit bytes. The
* value of TCL_INDEX_NONE for limit indicates no limit imposed. If
* The generated byte sequence may have no more than limit bytes.
* A negative value for limit indicates no limit imposed. If
* boolean argument demandProper is true, then no byte sequence should
* be output to the caller (write NULL instead). When no bytes sequence
* is output and interp is not NULL, leave an error message and error
@@ -487,14 +465,13 @@ static int
MakeByteArray(
Tcl_Interp *interp,
Tcl_Obj *objPtr,
size_t limit,
Tcl_Size limit,
int demandProper,
ByteArray **byteArrayPtrPtr)
{
size_t length;
Tcl_Size length;
const char *src = Tcl_GetStringFromObj(objPtr, &length);
size_t numBytes
= (limit != TCL_INDEX_NONE && limit < length) ? limit : length;
Tcl_Size numBytes = (limit >= 0 && limit < length) ? limit : length;
ByteArray *byteArrayPtr = (ByteArray *)Tcl_Alloc(BYTEARRAY_SIZE(numBytes));
unsigned char *dst = byteArrayPtr->bytes;
unsigned char *dstEnd = dst + numBytes;
@@ -503,7 +480,7 @@ MakeByteArray(
for (; src < srcEnd && dst < dstEnd; ) {
int ch;
int count = TclUtfToUCS4(src, &ch);
int count = Tcl_UtfToUniChar(src, &ch);
if (ch > 255) {
proper = 0;
@@ -569,7 +546,7 @@ TclNarrowToBytes(
static int
SetByteArrayFromAny(
Tcl_Interp *interp, /* For error reporting. */
size_t limit, /* Create no more than this many bytes */
Tcl_Size limit, /* Create no more than this many bytes */
Tcl_Obj *objPtr) /* The object to convert to type ByteArray. */
{
ByteArray *byteArrayPtr;
@@ -630,7 +607,7 @@ DupProperByteArrayInternalRep(
Tcl_Obj *srcPtr, /* Object with internal rep to copy. */
Tcl_Obj *copyPtr) /* Object with internal rep to set. */
{
size_t length;
Tcl_Size length;
ByteArray *srcArrayPtr, *copyArrayPtr;
Tcl_ObjInternalRep ir;
@@ -671,8 +648,8 @@ UpdateStringOfByteArray(
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objPtr, &properByteArrayType);
ByteArray *byteArrayPtr = GET_BYTEARRAY(irPtr);
unsigned char *src = byteArrayPtr->bytes;
size_t i, length = byteArrayPtr->used;
size_t size = length;
Tcl_Size i, length = byteArrayPtr->used;
Tcl_Size size = length;
/*
* How much space will string rep need?
@@ -721,16 +698,16 @@ void
TclAppendBytesToByteArray(
Tcl_Obj *objPtr,
const unsigned char *bytes,
size_t len)
Tcl_Size len)
{
ByteArray *byteArrayPtr;
size_t needed;
Tcl_Size needed;
Tcl_ObjInternalRep *irPtr;
if (Tcl_IsShared(objPtr)) {
Tcl_Panic("%s called with shared object","TclAppendBytesToByteArray");
}
if (len == TCL_INDEX_NONE) {
if (len < 0) {
Tcl_Panic("%s must be called with definite number of bytes to append",
"TclAppendBytesToByteArray");
}
@@ -755,46 +732,20 @@ TclAppendBytesToByteArray(
* If we need to, resize the allocated space in the byte array.
*/
needed = byteArrayPtr->used + len;
if (needed < byteArrayPtr->used) {
/* Wrapped around SIZE_MAX!! */
Tcl_Panic("max size of a Tcl value exceeded");
if ((BYTEARRAY_MAX_LEN - byteArrayPtr->used) < len) {
/* Will wrap around !! */
Tcl_Panic("max size of a byte array exceeded");
}
needed = byteArrayPtr->used + len;
if (needed > byteArrayPtr->allocated) {
ByteArray *ptr = NULL;
/*
* Try to allocate double the total space that is needed.
*/
size_t attempt = 2 * needed;
/* Protection just in case we wrapped around SIZE_MAX */
if (attempt >= needed) {
ptr = (ByteArray *) Tcl_AttemptRealloc(byteArrayPtr,
BYTEARRAY_SIZE(attempt));
}
if (ptr == NULL) {
/*
* Try to allocate double the increment that is needed (plus).
*/
attempt = needed + len + TCL_MIN_GROWTH;
if (attempt >= needed) {
ptr = (ByteArray *) Tcl_AttemptRealloc(byteArrayPtr,
BYTEARRAY_SIZE(attempt));
}
}
if (ptr == NULL) {
/*
* Last chance: Try to allocate exactly what is needed.
*/
attempt = needed;
ptr = (ByteArray *)Tcl_Realloc(byteArrayPtr, BYTEARRAY_SIZE(attempt));
}
byteArrayPtr = ptr;
byteArrayPtr->allocated = attempt;
Tcl_Size newCapacity;
byteArrayPtr =
(ByteArray *)TclReallocElemsEx(byteArrayPtr,
needed,
1,
offsetof(ByteArray, bytes),
&newCapacity);
byteArrayPtr->allocated = newCapacity;
SET_BYTEARRAY(irPtr, byteArrayPtr);
}
@@ -861,7 +812,7 @@ BinaryFormatCmd(
int value = 0; /* Current integer value to be packed.
* Initialized to avoid compiler warning. */
char cmd; /* Current format character. */
size_t count; /* Count associated with current format
Tcl_Size count; /* Count associated with current format
* character. */
int flags; /* Format field flags */
const char *format; /* Pointer to current position in format
@@ -873,7 +824,7 @@ BinaryFormatCmd(
* cursor has visited.*/
const char *errorString;
const char *errorValue, *str;
size_t offset, size, length;
Tcl_Size offset, size, length;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "formatString ?arg ...?");
@@ -971,7 +922,7 @@ BinaryFormatCmd(
arg++;
count = 1;
} else {
size_t listc;
Tcl_Size listc;
Tcl_Obj **listv;
/*
@@ -1003,7 +954,7 @@ BinaryFormatCmd(
case 'x':
if (count == BINARY_ALL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"cannot use \"*\" in format string with \"x\"", TCL_INDEX_NONE));
"cannot use \"*\" in format string with \"x\"", -1));
return TCL_ERROR;
} else if (count == BINARY_NOCOUNT) {
count = 1;
@@ -1047,7 +998,7 @@ BinaryFormatCmd(
}
/*
* Prepare the result object by preallocating the caclulated number of
* Prepare the result object by preallocating the calculated number of
* bytes and filling with nulls.
*/
@@ -1253,7 +1204,7 @@ BinaryFormatCmd(
case 'q':
case 'Q':
case 'f': {
size_t listc, i;
Tcl_Size listc, i;
Tcl_Obj **listv;
if (count == BINARY_NOCOUNT) {
@@ -1294,7 +1245,7 @@ BinaryFormatCmd(
if (count == BINARY_NOCOUNT) {
count = 1;
}
if ((count == BINARY_ALL) || (count > (size_t)(cursor - buffer))) {
if ((count == BINARY_ALL) || (count > (cursor - buffer))) {
cursor = buffer;
} else {
cursor -= count;
@@ -1343,7 +1294,7 @@ BinaryFormatCmd(
}
error:
Tcl_SetObjResult(interp, Tcl_NewStringObj(errorString, TCL_INDEX_NONE));
Tcl_SetObjResult(interp, Tcl_NewStringObj(errorString, -1));
return TCL_ERROR;
}
@@ -1374,7 +1325,7 @@ BinaryScanCmd(
int value = 0; /* Current integer value to be packed.
* Initialized to avoid compiler warning. */
char cmd; /* Current format character. */
size_t count; /* Count associated with current format
Tcl_Size count; /* Count associated with current format
* character. */
int flags; /* Format field flags */
const char *format; /* Pointer to current position in format
@@ -1383,7 +1334,7 @@ BinaryScanCmd(
unsigned char *buffer; /* Start of result buffer. */
const char *errorString;
const char *str;
size_t offset, size, length = 0, i;
Tcl_Size offset, size, length = 0, i;
Tcl_Obj *valuePtr, *elementPtr;
Tcl_HashTable numberCacheHash;
@@ -1492,7 +1443,7 @@ BinaryScanCmd(
if (count == BINARY_NOCOUNT) {
count = 1;
}
if (count > (size_t)(length - offset) * 8) {
if (count > (length - offset) * 8) {
goto done;
}
}
@@ -1623,7 +1574,7 @@ BinaryScanCmd(
goto badIndex;
}
if (count == BINARY_NOCOUNT) {
if (length < (size_t)size + offset) {
if (length < size + offset) {
goto done;
}
valuePtr = ScanNumber(buffer+offset, cmd, flags,
@@ -1724,7 +1675,7 @@ BinaryScanCmd(
}
error:
Tcl_SetObjResult(interp, Tcl_NewStringObj(errorString, TCL_INDEX_NONE));
Tcl_SetObjResult(interp, Tcl_NewStringObj(errorString, -1));
return TCL_ERROR;
}
@@ -1753,7 +1704,7 @@ static int
GetFormatSpec(
const char **formatPtr, /* Pointer to format string. */
char *cmdPtr, /* Pointer to location of command char. */
size_t *countPtr, /* Pointer to repeat count value. */
Tcl_Size *countPtr, /* Pointer to repeat count value. */
int *flagsPtr) /* Pointer to field flags */
{
/*
@@ -1786,14 +1737,14 @@ GetFormatSpec(
(*formatPtr)++;
*countPtr = BINARY_ALL;
} else if (isdigit(UCHAR(**formatPtr))) { /* INTL: digit */
unsigned long count;
unsigned long long count;
errno = 0;
count = strtoul(*formatPtr, (char **) formatPtr, 10);
if (errno || (count > (unsigned long) INT_MAX)) {
*countPtr = INT_MAX;
count = strtoull(*formatPtr, (char **) formatPtr, 10);
if (errno || (count > TCL_SIZE_MAX)) {
*countPtr = TCL_SIZE_MAX;
} else {
*countPtr = (int) count;
*countPtr = count;
}
} else {
*countPtr = BINARY_NOCOUNT;
@@ -1808,7 +1759,7 @@ GetFormatSpec(
*
* This routine determines, if bytes of a number need to be re-ordered,
* and returns a numeric code indicating the re-ordering to be done.
* This depends on the endiannes of the machine and the desired format.
* This depends on the endianness of the machine and the desired format.
* It is in effect a table (whose contents depend on the endianness of
* the system) describing whether a value needs reversing or not. Anyone
* porting the code to a big-endian platform should take care to make
@@ -2021,7 +1972,7 @@ FormatNumber(
*/
if (Tcl_GetDoubleFromObj(interp, src, &dvalue) != TCL_OK) {
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(src, &tclDoubleType.objType);
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(src, tclDoubleType);
if (irPtr == NULL) {
return TCL_ERROR;
}
@@ -2041,7 +1992,7 @@ FormatNumber(
*/
if (Tcl_GetDoubleFromObj(interp, src, &dvalue) != TCL_OK) {
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(src, &tclDoubleType.objType);
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(src, tclDoubleType);
if (irPtr == NULL) {
return TCL_ERROR;
@@ -2457,7 +2408,7 @@ BinaryEncodeHex(
Tcl_Obj *resultObj = NULL;
unsigned char *data = NULL;
unsigned char *cursor = NULL;
size_t offset = 0, count = 0;
Tcl_Size offset = 0, count = 0;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "data");
@@ -2506,7 +2457,7 @@ BinaryDecodeHex(
unsigned char *data, *datastart, *dataend;
unsigned char *begin, *cursor, c;
int i, index, value, pure = 1, strict = 0;
size_t size, cut = 0, count = 0;
Tcl_Size size, cut = 0, count = 0;
int ucs4;
enum {OPT_STRICT };
static const char *const optStrings[] = { "-strict", NULL };
@@ -2581,7 +2532,7 @@ BinaryDecodeHex(
if (pure) {
ucs4 = c;
} else {
TclUtfToUCS4((const char *)(data - 1), &ucs4);
Tcl_UtfToUniChar((const char *)(data - 1), &ucs4);
}
TclDecrRefCount(resultObj);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
@@ -2629,11 +2580,11 @@ BinaryEncode64(
{
Tcl_Obj *resultObj;
unsigned char *data, *limit;
int maxlen = 0;
Tcl_Size maxlen = 0;
const char *wrapchar = "\n";
size_t wrapcharlen = 1;
int i, index, size, outindex = 0, purewrap = 1;
size_t offset, count = 0;
Tcl_Size wrapcharlen = 1;
int index, purewrap = 1;
Tcl_Size i, offset, size, outindex = 0, count = 0;
enum { OPT_MAXLEN, OPT_WRAPCHAR };
static const char *const optStrings[] = { "-maxlen", "-wrapchar", NULL };
@@ -2649,12 +2600,12 @@ BinaryEncode64(
}
switch (index) {
case OPT_MAXLEN:
if (Tcl_GetIntFromObj(interp, objv[i + 1], &maxlen) != TCL_OK) {
if (Tcl_GetSizeIntFromObj(interp, objv[i + 1], &maxlen) != TCL_OK) {
return TCL_ERROR;
}
if (maxlen < 0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"line length out of range", TCL_INDEX_NONE));
"line length out of range", -1));
Tcl_SetErrorCode(interp, "TCL", "BINARY", "ENCODE",
"LINE_LENGTH", NULL);
return TCL_ERROR;
@@ -2755,12 +2706,12 @@ BinaryEncodeUu(
{
Tcl_Obj *resultObj;
unsigned char *data, *start, *cursor;
int rawLength, i, bits, index;
int i, bits, index;
unsigned int n;
int lineLength = 61;
const unsigned char SingleNewline[] = { UCHAR('\n') };
const unsigned char *wrapchar = SingleNewline;
size_t j, offset, count = 0, wrapcharlen = sizeof(SingleNewline);
Tcl_Size j, rawLength, offset, count = 0, wrapcharlen = sizeof(SingleNewline);
enum { OPT_MAXLEN, OPT_WRAPCHAR };
static const char *const optStrings[] = { "-maxlen", "-wrapchar", NULL };
@@ -2782,7 +2733,7 @@ BinaryEncodeUu(
}
if (lineLength < 5 || lineLength > 85) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"line length out of range", TCL_INDEX_NONE));
"line length out of range", -1));
Tcl_SetErrorCode(interp, "TCL", "BINARY", "ENCODE",
"LINE_LENGTH", NULL);
return TCL_ERROR;
@@ -2794,7 +2745,7 @@ BinaryEncodeUu(
objv[i + 1], &wrapcharlen);
{
const unsigned char *p = wrapchar;
size_t numBytes = wrapcharlen;
Tcl_Size numBytes = wrapcharlen;
while (numBytes) {
switch (*p) {
@@ -2850,7 +2801,7 @@ BinaryEncodeUu(
*/
while (offset < count) {
int lineLen = count - offset;
Tcl_Size lineLen = count - offset;
if (lineLen > rawLength) {
lineLen = rawLength;
@@ -2909,7 +2860,7 @@ BinaryDecodeUu(
unsigned char *data, *datastart, *dataend;
unsigned char *begin, *cursor;
int i, index, pure = 1, strict = 0, lineLen;
size_t size, count = 0;
Tcl_Size size, count = 0;
unsigned char c;
int ucs4;
enum { OPT_STRICT };
@@ -3046,7 +2997,7 @@ BinaryDecodeUu(
if (pure) {
ucs4 = c;
} else {
TclUtfToUCS4((const char *)(data - 1), &ucs4);
Tcl_UtfToUniChar((const char *)(data - 1), &ucs4);
}
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"invalid uuencode character \"%c\" (U+%06X) at position %"
@@ -3085,7 +3036,7 @@ BinaryDecode64(
unsigned char *cursor = NULL;
int pure = 1, strict = 0;
int i, index, cut = 0;
size_t size, count = 0;
Tcl_Size size, count = 0;
int ucs4;
enum { OPT_STRICT };
static const char *const optStrings[] = { "-strict", NULL };
@@ -3221,7 +3172,7 @@ BinaryDecode64(
* of a multi-byte character. */
/* Safe because we know data is NUL-terminated */
TclUtfToUCS4((const char *)(data - 1), &ucs4);
Tcl_UtfToUniChar((const char *)(data - 1), &ucs4);
}
Tcl_SetObjResult(interp, Tcl_ObjPrintf(

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