Compare commits
892
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5e7a3f6899 | ||
|
|
ba612dd4f8 | ||
|
|
096c6ef84f | ||
|
|
4312e760d0 | ||
|
|
2948220674 | ||
|
|
e5aed17b9d | ||
|
|
d206ee3c75 | ||
|
|
ef765324c9 | ||
|
|
e8ada42c8d | ||
|
|
8528cc5323 | ||
|
|
e1420101e1 | ||
|
|
5d3ba90d87 | ||
|
|
530c3b8f01 | ||
|
|
1203f8d384 | ||
|
|
1215212601 | ||
|
|
3e6eaa5776 | ||
|
|
465fa239eb | ||
|
|
169cbd38fe | ||
|
|
5e5a852fe0 | ||
|
|
17d857c579 | ||
|
|
81999e0554 | ||
|
|
ce04b407d9 | ||
|
|
0726ae90db | ||
|
|
7d1613ac75 | ||
|
|
b6a444f634 | ||
|
|
21c787abd0 | ||
|
|
efc68f3008 | ||
|
|
0fd5957429 | ||
|
|
9a89f0e222 | ||
|
|
fc78297f13 | ||
|
|
c5d4ce7c51 | ||
|
|
90f77cbdf1 | ||
|
|
3eb5ddf1da | ||
|
|
cc936d0713 | ||
|
|
6bdd668a7c | ||
|
|
726c679083 | ||
|
|
feac96c8b3 | ||
|
|
ed24f448c7 | ||
|
|
dc5930bc81 | ||
|
|
1861455786 | ||
|
|
191fecdc87 | ||
|
|
67ced52076 | ||
|
|
f8b9e919c9 | ||
|
|
784535a35c | ||
|
|
5b6755494d | ||
|
|
7d527f91fd | ||
|
|
ef16c107bf | ||
|
|
24d6b91453 | ||
|
|
ef52a3851a | ||
|
|
9576a35d02 | ||
|
|
4d14a84353 | ||
|
|
7854b03fa2 | ||
|
|
2445b5d59b | ||
|
|
dca79c0aca | ||
|
|
9d87e5b616 | ||
|
|
02ed0444e9 | ||
|
|
2616ef0ef1 | ||
|
|
82098d2dca | ||
|
|
91fa419271 | ||
|
|
0899e9d020 | ||
|
|
bc060f980c | ||
|
|
7f39dac888 | ||
|
|
f3e40e67d4 | ||
|
|
ac324e9b0b | ||
|
|
5ffb8a5035 | ||
|
|
3faf228237 | ||
|
|
e0df4408c7 | ||
|
|
d531e7af51 | ||
|
|
2524a62bb6 | ||
|
|
587c1ebdba | ||
|
|
b026d900d3 | ||
|
|
e1fdad425a | ||
|
|
49b6ecfb4e | ||
|
|
38a87927cf | ||
|
|
1df3dc0ae2 | ||
|
|
cc28ac83dd | ||
|
|
7a84646588 | ||
|
|
d2fc2aa765 | ||
|
|
83740bf7d7 | ||
|
|
ad4011e1c8 | ||
|
|
e18f327808 | ||
|
|
30428a50c8 | ||
|
|
1df48c6782 | ||
|
|
0fd20aeeaa | ||
|
|
2002e0f0f0 | ||
|
|
2122f0eb09 | ||
|
|
5c40bd9a6c | ||
|
|
fc30e5e704 | ||
|
|
414896d31f | ||
|
|
f49e4099fe | ||
|
|
220282500b | ||
|
|
e27c66d81a | ||
|
|
de08e1a143 | ||
|
|
b0a23df7d6 | ||
|
|
ae9ebe2176 | ||
|
|
b726273bbe | ||
|
|
5e0c34678e | ||
|
|
3985945f96 | ||
|
|
ed66664f84 | ||
|
|
a51afb0e46 | ||
|
|
da0251a1f4 | ||
|
|
4576880f96 | ||
|
|
10423ea0ca | ||
|
|
25a166a77a | ||
|
|
99a897fb41 | ||
|
|
40a90d5fce | ||
|
|
e66310792a | ||
|
|
9837f0e993 | ||
|
|
3f624f6af0 | ||
|
|
4dcd70c967 | ||
|
|
9d432523a6 | ||
|
|
7f3849495a | ||
|
|
d984134999 | ||
|
|
17937238e2 | ||
|
|
f4a64c89a2 | ||
|
|
6fec8f2b6c | ||
|
|
1451fc7537 | ||
|
|
c103cb5d10 | ||
|
|
178c9d17be | ||
|
|
a4b2c694ce | ||
|
|
ff8b3d5c27 | ||
|
|
dedbaf0009 | ||
|
|
511ae7efcb | ||
|
|
5aedb72b9c | ||
|
|
364b4e65bf | ||
|
|
e038969b66 | ||
|
|
46d59bb7db | ||
|
|
30cce986ca | ||
|
|
4fdc61a1f6 | ||
|
|
120806ee03 | ||
|
|
bc309ba006 | ||
|
|
629aea4b6a | ||
|
|
5df2af1808 | ||
|
|
f8a7412ae3 | ||
|
|
eaad662c18 | ||
|
|
ccf567f6a8 | ||
|
|
796370fa55 | ||
|
|
96b80a42ae | ||
|
|
479247a5f0 | ||
|
|
e882c87033 | ||
|
|
2239eb3a90 | ||
|
|
ce1b091802 | ||
|
|
636a6d0ea9 | ||
|
|
ce9c1b59e5 | ||
|
|
d462ed2dd9 | ||
|
|
2a7d240b80 | ||
|
|
ec7356be4c | ||
|
|
631b9cae2e | ||
|
|
88caedc3ce | ||
|
|
dc7946e162 | ||
|
|
e21761aab7 | ||
|
|
a19bc41c3a | ||
|
|
a78ce452f2 | ||
|
|
438dbba007 | ||
|
|
6c33026c8c | ||
|
|
0fc4d3ef81 | ||
|
|
bb933cb954 | ||
|
|
b523637e3b | ||
|
|
ae0f696f21 | ||
|
|
e1e66d9209 | ||
|
|
84ad8e1eae | ||
|
|
8602bafbb8 | ||
|
|
b12a433518 | ||
|
|
8f8776b56b | ||
|
|
12fbbf9df9 | ||
|
|
7a69ce0ac4 | ||
|
|
7b07b1df54 | ||
|
|
a182a5bf20 | ||
|
|
097fff3b0d | ||
|
|
574c6392d0 | ||
|
|
b14bccc65d | ||
|
|
ac8cf85039 | ||
|
|
85461b74b3 | ||
|
|
30e195d456 | ||
|
|
a23d9c4dac | ||
|
|
965d3fae6a | ||
|
|
8088657ecc | ||
|
|
b2f6161a18 | ||
|
|
c258128087 | ||
|
|
1a13ddd24b | ||
|
|
aeafdad0a9 | ||
|
|
ae0658c370 | ||
|
|
3c37f824cc | ||
|
|
cb4d5ce631 | ||
|
|
167878d3af | ||
|
|
32860a2742 | ||
|
|
f1fafe7c16 | ||
|
|
c9bc915417 | ||
|
|
79bc1e0416 | ||
|
|
44357a2534 | ||
|
|
1e95b894cf | ||
|
|
133af7524b | ||
|
|
e0d5199463 | ||
|
|
e7c416995e | ||
|
|
ac8ac73e77 | ||
|
|
0fcb3ce5dc | ||
|
|
4f5ae9bf24 | ||
|
|
9152d5eec0 | ||
|
|
d63d524e1d | ||
|
|
48dcbfcc5b | ||
|
|
afdd59e358 | ||
|
|
8f3fb2f85e | ||
|
|
6ff9d841db | ||
|
|
f5c47e4402 | ||
|
|
4ea926a40b | ||
|
|
28add0c150 | ||
|
|
88f1825232 | ||
|
|
8133df3b6d | ||
|
|
8b0dc386ba | ||
|
|
5319a7d93f | ||
|
|
cc2747afa8 | ||
|
|
d103b73dba | ||
|
|
b273a9c1d4 | ||
|
|
2475fa8cb8 | ||
|
|
5d63902332 | ||
|
|
921b0dfdea | ||
|
|
75664c655d | ||
|
|
2d9a47cff1 | ||
|
|
1876fe215d | ||
|
|
78c295898e | ||
|
|
449998d358 | ||
|
|
203f1d691d | ||
|
|
800d78f04d | ||
|
|
8e6d7429e9 | ||
|
|
291ff6db1b | ||
|
|
d5ac687adb | ||
|
|
7834acd2e4 | ||
|
|
5e2a39d626 | ||
|
|
cb121886a4 | ||
|
|
278b807336 | ||
|
|
036b676c8b | ||
|
|
5fbaf44ecf | ||
|
|
43218725b3 | ||
|
|
c6b740609a | ||
|
|
64c45c10a9 | ||
|
|
1a75f270bd | ||
|
|
e89caee68c | ||
|
|
b90a2e051c | ||
|
|
6134622b61 | ||
|
|
4ce715f36a | ||
|
|
bdad96ab69 | ||
|
|
c0a02fd487 | ||
|
|
453c27a88e | ||
|
|
ac93862047 | ||
|
|
2d75729976 | ||
|
|
e9ccf557eb | ||
|
|
5b8c37d24f | ||
|
|
13b1529c7b | ||
|
|
1ee3af2d3d | ||
|
|
87b6456684 | ||
|
|
4f2de3dfc9 | ||
|
|
4aa63fcc25 | ||
|
|
72deb9db89 | ||
|
|
3d439d74da | ||
|
|
9c8a1292c0 | ||
|
|
d81f257f99 | ||
|
|
3129864cc2 | ||
|
|
aa14feed8b | ||
|
|
e7fc2e1e1d | ||
|
|
527e79c3a8 | ||
|
|
5655318f50 | ||
|
|
05262be331 | ||
|
|
88f9f54d4c | ||
|
|
ae0471127e | ||
|
|
1a6f1d5c40 | ||
|
|
1eefaec471 | ||
|
|
e019e5bd1d | ||
|
|
93ce80a916 | ||
|
|
5846b1666f | ||
|
|
4d978a00ed | ||
|
|
a3c59e320d | ||
|
|
70cf69246f | ||
|
|
6f4eba042c | ||
|
|
7543a1313f | ||
|
|
e0e09638fe | ||
|
|
a0be72dbca | ||
|
|
6d3b66ad23 | ||
|
|
6bd8763c2d | ||
|
|
f378b48b06 | ||
|
|
23a421a9c1 | ||
|
|
ba737587a8 | ||
|
|
ea9a0277a2 | ||
|
|
6ded4b92be | ||
|
|
6cf4a0dea3 | ||
|
|
fdcb9621bb | ||
|
|
3aef0c58f9 | ||
|
|
c5d0535121 | ||
|
|
87b3bcc550 | ||
|
|
76526242c0 | ||
|
|
b05b4cf948 | ||
|
|
18a99f2522 | ||
|
|
4c26d23f06 | ||
|
|
953a44bc6e | ||
|
|
5094fb7825 | ||
|
|
95158a2d57 | ||
|
|
5c3377f2e1 | ||
|
|
d53dfb14c7 | ||
|
|
6d74232282 | ||
|
|
df8a3a6ea4 | ||
|
|
967e55306e | ||
|
|
844792f3bb | ||
|
|
22239fb7d2 | ||
|
|
ab2c6de1ed | ||
|
|
131176ce2f | ||
|
|
aee8588fbc | ||
|
|
eeee744ee2 | ||
|
|
63b29d841b | ||
|
|
77e951f2b8 | ||
|
|
9fb3d5754a | ||
|
|
a16eb9ac30 | ||
|
|
8bf2e2ace2 | ||
|
|
ed8932a4eb | ||
|
|
b7f151f126 | ||
|
|
8c5fc11b5a | ||
|
|
1889ded114 | ||
|
|
5533596329 | ||
|
|
6f85588bab | ||
|
|
93160df498 | ||
|
|
21388fa31e | ||
|
|
0951d3f692 | ||
|
|
93bf87ed85 | ||
|
|
d06a38ae5d | ||
|
|
e9b9864f56 | ||
|
|
494b4c8127 | ||
|
|
56f5c7751c | ||
|
|
bd3a6be21b | ||
|
|
962d8aed89 | ||
|
|
5b0be62536 | ||
|
|
a1fb554585 | ||
|
|
552d2bb53f | ||
|
|
1b7f525ec7 | ||
|
|
38555b60a2 | ||
|
|
9f1cf8d5ef | ||
|
|
23becaa71a | ||
|
|
c3da6c8fed | ||
|
|
468e5148b3 | ||
|
|
7ed7017d94 | ||
|
|
10f4d4565d | ||
|
|
fa28b1f243 | ||
|
|
3203978c65 | ||
|
|
ebfa9b6f2d | ||
|
|
8dbd350305 | ||
|
|
73229a7e53 | ||
|
|
9aea48988c | ||
|
|
0e0d74624b | ||
|
|
fffb0bdce5 | ||
|
|
82acd6a35a | ||
|
|
5cf1eed910 | ||
|
|
8c5476848a | ||
|
|
4df874dd7f | ||
|
|
906268caa7 | ||
|
|
1ae5fd8198 | ||
|
|
01d6e02666 | ||
|
|
e10915b565 | ||
|
|
03618f8c95 | ||
|
|
071917e1b2 | ||
|
|
1f6cec5ff3 | ||
|
|
fe7ee54772 | ||
|
|
f5ba8a8478 | ||
|
|
f4450abcf9 | ||
|
|
5e095a3a4d | ||
|
|
3eb68691b8 | ||
|
|
f0e415c1e1 | ||
|
|
cfa443421b | ||
|
|
296e4767ea | ||
|
|
fa795b478a | ||
|
|
40e214cd76 | ||
|
|
7ec4501d37 | ||
|
|
9e0cc9d630 | ||
|
|
9d2cc36a0e | ||
|
|
e4e1062338 | ||
|
|
0968aa6de7 | ||
|
|
f736bb9d86 | ||
|
|
6e7d72c158 | ||
|
|
1f7d2aae34 | ||
|
|
76edd58c3e | ||
|
|
923ff1e3ca | ||
|
|
33d81b98be | ||
|
|
234394e2df | ||
|
|
7b3ef36925 | ||
|
|
c862e57095 | ||
|
|
0229ba1283 | ||
|
|
4e84e02684 | ||
|
|
80b392ba8e | ||
|
|
e13edcba86 | ||
|
|
e95b015990 | ||
|
|
aebb7627f5 | ||
|
|
6285c13367 | ||
|
|
8f18e27691 | ||
|
|
7f3d1257ff | ||
|
|
e7b37f1737 | ||
|
|
18385b8363 | ||
|
|
d3aa6839f4 | ||
|
|
cb3d36ad5a | ||
|
|
f4618fc2d9 | ||
|
|
1ad16ea481 | ||
|
|
b464703493 | ||
|
|
4d67456953 | ||
|
|
44fdf09f7b | ||
|
|
ad8dae7587 | ||
|
|
806babb932 | ||
|
|
f736321295 | ||
|
|
b2cdedcec2 | ||
|
|
a0beeb8a76 | ||
|
|
1d9ebbc740 | ||
|
|
5a3e0c869e | ||
|
|
64e7f77040 | ||
|
|
cc5dd09db3 | ||
|
|
30a9b333ba | ||
|
|
261c174d97 | ||
|
|
0f06bb38e8 | ||
|
|
a6b4ef3d29 | ||
|
|
9522e37880 | ||
|
|
00e1068c03 | ||
|
|
74b7d6bc14 | ||
|
|
3d177bd8b5 | ||
|
|
62d9150ef5 | ||
|
|
4227ef37bb | ||
|
|
1652c942d8 | ||
|
|
5d56a5b435 | ||
|
|
7c9fe49b51 | ||
|
|
bb80189110 | ||
|
|
1eac8ab060 | ||
|
|
1923d22832 | ||
|
|
70e40dd53d | ||
|
|
7661972907 | ||
|
|
bb2f06fc73 | ||
|
|
fadb24f26a | ||
|
|
5d8ae9bf17 | ||
|
|
8e139e5cd7 | ||
|
|
da55e192ba | ||
|
|
57d266423a | ||
|
|
d29598480f | ||
|
|
7d6cf09e02 | ||
|
|
8b417f0e1e | ||
|
|
e743d3e487 | ||
|
|
b914843dfc | ||
|
|
a947270ff7 | ||
|
|
a1fe72fa4a | ||
|
|
2c3a9f451b | ||
|
|
85bf0db1e8 | ||
|
|
c6bb33407a | ||
|
|
e2d89615d5 | ||
|
|
ed360ca42f | ||
|
|
6b172a2131 | ||
|
|
e7b8b9d2dd | ||
|
|
152d7203ac | ||
|
|
baf9b5e9bb | ||
|
|
cbda5cb9b2 | ||
|
|
6ab1efe806 | ||
|
|
08a6b105e5 | ||
|
|
8fdf20ec2b | ||
|
|
4e6558b44a | ||
|
|
5ffda39949 | ||
|
|
79cbdf745a | ||
|
|
deec081e74 | ||
|
|
2fb6b99620 | ||
|
|
7b0b2ebd37 | ||
|
|
2a5b403768 | ||
|
|
aa2b48262b | ||
|
|
a826e66f11 | ||
|
|
8390c51fca | ||
|
|
4207c3d5c3 | ||
|
|
f0f2ee57f9 | ||
|
|
50cafc9f13 | ||
|
|
58db3d68eb | ||
|
|
99a24e7883 | ||
|
|
76adf3151b | ||
|
|
854369a67c | ||
|
|
d5e9da898f | ||
|
|
1c3c25097b | ||
|
|
485bc2fd88 | ||
|
|
fe5707421f | ||
|
|
6caf484379 | ||
|
|
10c559acbf | ||
|
|
186cc71273 | ||
|
|
da915fdadf | ||
|
|
e469cdf190 | ||
|
|
190f9219d5 | ||
|
|
956059093c | ||
|
|
ce349b05df | ||
|
|
bf7b1adb89 | ||
|
|
d1920b380d | ||
|
|
9ae7f4dc4f | ||
|
|
1d76ffb03b | ||
|
|
7c6f71019a | ||
|
|
8f37d5c24e | ||
|
|
c3e063b0aa | ||
|
|
320eaab501 | ||
|
|
2935048126 | ||
|
|
12345dfed8 | ||
|
|
78db448fff | ||
|
|
58f1209a70 | ||
|
|
e106525498 | ||
|
|
f0284298ad | ||
|
|
03a9d6928d | ||
|
|
5219c94af5 | ||
|
|
a970bffd00 | ||
|
|
f95599f4d4 | ||
|
|
c606ae1574 | ||
|
|
9b8fa27457 | ||
|
|
42956f6f09 | ||
|
|
417f868693 | ||
|
|
4d644dfb73 | ||
|
|
3315012c95 | ||
|
|
8660fd1af2 | ||
|
|
280034d2ab | ||
|
|
fa9ac8a850 | ||
|
|
41af9f9e84 | ||
|
|
23d9ca0ec4 | ||
|
|
9f595d2fa3 | ||
|
|
41c5d1cd91 | ||
|
|
933e1c8e0c | ||
|
|
3d2dc70845 | ||
|
|
0892c6f37c | ||
|
|
c731ca1ffd | ||
|
|
fdbb12eced | ||
|
|
359092510b | ||
|
|
45796af99d | ||
|
|
6bcdbfbf84 | ||
|
|
6d674a96a1 | ||
|
|
a3f58db271 | ||
|
|
2c3252bc5c | ||
|
|
d790e81db2 | ||
|
|
684cbb8f5c | ||
|
|
0563a78902 | ||
|
|
5053891183 | ||
|
|
f06c5e7af1 | ||
|
|
96e60d29b7 | ||
|
|
7fb1760f42 | ||
|
|
4c2d834fca | ||
|
|
6aed3e7d30 | ||
|
|
fb260e8382 | ||
|
|
5040a69c28 | ||
|
|
38df355850 | ||
|
|
891d60a9ad | ||
|
|
a750ed2c24 | ||
|
|
85320f8fd0 | ||
|
|
2974b57279 | ||
|
|
0c306c8f81 | ||
|
|
05f4bc701f | ||
|
|
86d84d444c | ||
|
|
0c764d2b03 | ||
|
|
bf448a6421 | ||
|
|
b5095134df | ||
|
|
bfaa709c2e | ||
|
|
3954b7c2a3 | ||
|
|
727887b6dc | ||
|
|
c2f0e2f8da | ||
|
|
bab9170bdc | ||
|
|
e26214c287 | ||
|
|
fd83fb931e | ||
|
|
9d1ba01f11 | ||
|
|
d46a244159 | ||
|
|
b185a55c3b | ||
|
|
4294befd8b | ||
|
|
d04dfba748 | ||
|
|
615082f1fa | ||
|
|
b741dab392 | ||
|
|
e0ee29b9b6 | ||
|
|
694ae19131 | ||
|
|
f5f5ff4257 | ||
|
|
597d3b9e7b | ||
|
|
f238eb1dbc | ||
|
|
4b5b655e61 | ||
|
|
52fc9a970c | ||
|
|
100d8ce724 | ||
|
|
e31133e3b0 | ||
|
|
26e89b4b3c | ||
|
|
637e7224c9 | ||
|
|
c529405c65 | ||
|
|
de0a637d7c | ||
|
|
536651d954 | ||
|
|
b9c893dbc9 | ||
|
|
6b6d121149 | ||
|
|
3eaad4bbc9 | ||
|
|
44dd5d86bc | ||
|
|
537c8e77ba | ||
|
|
5866ef6d2a | ||
|
|
f365be7f4d | ||
|
|
0184ebda4f | ||
|
|
078a694834 | ||
|
|
e5272c9be6 | ||
|
|
596e33bb9e | ||
|
|
081c085c0f | ||
|
|
64e3a23bfd | ||
|
|
0219b700b1 | ||
|
|
a70ce8697c | ||
|
|
7a5be2cdbd | ||
|
|
58446472bb | ||
|
|
d3dae9eba4 | ||
|
|
8c0f76a7de | ||
|
|
4d235ca93a | ||
|
|
5b86b255d4 | ||
|
|
468b1a4346 | ||
|
|
7f87f0f8ea | ||
|
|
5d13f6b527 | ||
|
|
0318ff75d9 | ||
|
|
06de3a9ba1 | ||
|
|
d838764849 | ||
|
|
8ea5f2cfce | ||
|
|
23e46e5885 | ||
|
|
d271c9f407 | ||
|
|
7426076e0f | ||
|
|
ca4e244cca | ||
|
|
97041036d3 | ||
|
|
1dd572d476 | ||
|
|
20ace1aa6c | ||
|
|
ef42e37c44 | ||
|
|
42b0b497a1 | ||
|
|
46dcc60e41 | ||
|
|
c5f7f66ceb | ||
|
|
b31d886479 | ||
|
|
c08798d0f4 | ||
|
|
04eb2cc696 | ||
|
|
2b516939bd | ||
|
|
47b385e3db | ||
|
|
4ef7c0c4b8 | ||
|
|
119519c4df | ||
|
|
52948a790c | ||
|
|
792c57a7fb | ||
|
|
073e6715d1 | ||
|
|
c611835152 | ||
|
|
22657ad365 | ||
|
|
02838226fe | ||
|
|
1c6b1c9e6c | ||
|
|
6c8d9886b5 | ||
|
|
45bfcbb267 | ||
|
|
c18f5f7f8c | ||
|
|
31226696c3 | ||
|
|
5d50502a29 | ||
|
|
925f00c5ca | ||
|
|
5c38cce8df | ||
|
|
6efbc1b278 | ||
|
|
40b6b98401 | ||
|
|
5021d1c11f | ||
|
|
ca87000eac | ||
|
|
56bcf3dcbe | ||
|
|
7faef9ce70 | ||
|
|
81262438a7 | ||
|
|
b9537d1098 | ||
|
|
25f6837582 | ||
|
|
5aef206d2d | ||
|
|
24656c2805 | ||
|
|
33f4149ee5 | ||
|
|
805fa175fc | ||
|
|
95e7615fc4 | ||
|
|
ba6fe47daa | ||
|
|
cf560b3fb9 | ||
|
|
507af3b425 | ||
|
|
72eb4e4229 | ||
|
|
ce9fb3bcfb | ||
|
|
985ea00b16 | ||
|
|
8494cde084 | ||
|
|
9ab6f4a7c5 | ||
|
|
7be69be5fe | ||
|
|
3919b0a0b4 | ||
|
|
63e04b3c2d | ||
|
|
a801c2d474 | ||
|
|
3b45005127 | ||
|
|
23d30205a5 | ||
|
|
0f0fc59c9f | ||
|
|
f2cc84c99a | ||
|
|
dbd4edc3d5 | ||
|
|
4a8b2cf10f | ||
|
|
a1de562f5c | ||
|
|
6a1c2d8f52 | ||
|
|
ecaf98ffad | ||
|
|
a01390fa0b | ||
|
|
1faa0cca77 | ||
|
|
e872538a2e | ||
|
|
7561bdb176 | ||
|
|
ac4faee232 | ||
|
|
af98d8fa20 | ||
|
|
d61473e631 | ||
|
|
5db223f8ec | ||
|
|
9dabd6f1ac | ||
|
|
002511bea4 | ||
|
|
8b3ccee931 | ||
|
|
553147da53 | ||
|
|
c05419204a | ||
|
|
42eb37a48c | ||
|
|
b82707b4a1 | ||
|
|
2031d40f81 | ||
|
|
d748e3debf | ||
|
|
0846deb770 | ||
|
|
f632ecb406 | ||
|
|
5d7537b823 | ||
|
|
fd98096770 | ||
|
|
4cca4b0b1c | ||
|
|
edee881fb2 | ||
|
|
d762cb9331 | ||
|
|
a06b13bb4a | ||
|
|
c78879e707 | ||
|
|
94c928a859 | ||
|
|
9faf91402b | ||
|
|
10775523d9 | ||
|
|
7b36aa11b6 | ||
|
|
532559323e | ||
|
|
2e1db6850f | ||
|
|
d9baa9e3de | ||
|
|
53b2a5fdf9 | ||
|
|
89be5d2d3d | ||
|
|
3251fdbab4 | ||
|
|
196f704d08 | ||
|
|
3b293d276c | ||
|
|
4aa0db664d | ||
|
|
b81e0a5459 | ||
|
|
4f69a6f297 | ||
|
|
ae31cee4ae | ||
|
|
768fa22c43 | ||
|
|
1a21edb592 | ||
|
|
62c5b0bfb7 | ||
|
|
a58f5f14b0 | ||
|
|
7b53037339 | ||
|
|
b8c736d82c | ||
|
|
d8d1a902ef | ||
|
|
ba427c0bc2 | ||
|
|
b1af92a6e9 | ||
|
|
b58aa65f02 | ||
|
|
f029161eb7 | ||
|
|
635dd1a696 | ||
|
|
25b3cffdd2 | ||
|
|
ae11579286 | ||
|
|
975b7c5dcb | ||
|
|
ef8a00717e | ||
|
|
b3838ea445 | ||
|
|
36c94773b4 | ||
|
|
fdb4ca1567 | ||
|
|
6c7ad3b118 | ||
|
|
4d23589861 | ||
|
|
a7d6b92abf | ||
|
|
5cb9dc5ddc | ||
|
|
c157333a7d | ||
|
|
f9ded1a928 | ||
|
|
99e3536c5d | ||
|
|
521b3bfb0e | ||
|
|
111352203a | ||
|
|
a744c509d4 | ||
|
|
e648065fe1 | ||
|
|
6d6996d99f | ||
|
|
4813d492ca | ||
|
|
426dd171f6 | ||
|
|
11af978f51 | ||
|
|
cdb467ed61 | ||
|
|
8b03ef0b29 | ||
|
|
71b0ad990c | ||
|
|
dabfa1a053 | ||
|
|
8f6442b0c9 | ||
|
|
da196c3345 | ||
|
|
85f19595dc | ||
|
|
18f90309e4 | ||
|
|
82fb7b1d55 | ||
|
|
513b2d5031 | ||
|
|
bfe8928bed | ||
|
|
ba490472b5 | ||
|
|
d0d0e3642f | ||
|
|
bc23abb929 | ||
|
|
481aa42029 | ||
|
|
b816a585c0 | ||
|
|
7bf0253a43 | ||
|
|
73116e2c54 | ||
|
|
66e2117d20 | ||
|
|
0bc6d7d341 | ||
|
|
d6fedf7854 | ||
|
|
191fa0458a | ||
|
|
21920649b5 | ||
|
|
9faff5cc94 | ||
|
|
a4ac44fccc | ||
|
|
3795a0f7dc | ||
|
|
ec4cf7a995 | ||
|
|
ddf4a5f158 | ||
|
|
2a569c94ef | ||
|
|
6932d0c2d0 | ||
|
|
9c802c440b | ||
|
|
e4f687d978 | ||
|
|
826db93d76 | ||
|
|
d8dac38437 | ||
|
|
b432766202 | ||
|
|
52aada907a | ||
|
|
5b4f454e1c | ||
|
|
42dae31b61 | ||
|
|
86f51a0a0b | ||
|
|
7129a50b10 | ||
|
|
e57b9fe9c3 | ||
|
|
13eb211d5a | ||
|
|
e37308d78c | ||
|
|
b5e5883c33 | ||
|
|
096106f202 | ||
|
|
ff294480b9 | ||
|
|
02892b17b9 | ||
|
|
d942525e22 | ||
|
|
976fff1b3a | ||
|
|
95cac7dd26 | ||
|
|
eddb2b2801 | ||
|
|
ef78b1558f | ||
|
|
c1e4942181 | ||
|
|
b1432e6e0d | ||
|
|
948fd24ddb | ||
|
|
0fd21c5dd0 | ||
|
|
8a4e71640b | ||
|
|
338c669267 | ||
|
|
654f4d3b58 | ||
|
|
23ef10a6a4 | ||
|
|
91e64fb475 | ||
|
|
e9cf2c8707 | ||
|
|
e82a18be40 | ||
|
|
49cb764a5a | ||
|
|
8f9ddfae66 | ||
|
|
a53281f50b | ||
|
|
2ba1a5f081 | ||
|
|
bfdd211de9 | ||
|
|
b71ebc2746 | ||
|
|
f39cef2590 | ||
|
|
4e1d89f819 | ||
|
|
a1a443ef1d | ||
|
|
66386bc18b | ||
|
|
0666836834 | ||
|
|
0c93e6a978 | ||
|
|
124340611e | ||
|
|
43d67c651c | ||
|
|
797aa89a30 | ||
|
|
90d13253bd | ||
|
|
1c1ee1c59d | ||
|
|
0bcca87681 | ||
|
|
4245f0e5a3 | ||
|
|
90a23f176d | ||
|
|
2e64df7857 | ||
|
|
78bce4ec93 | ||
|
|
10a5b6e4c7 | ||
|
|
3e4ac217aa | ||
|
|
ae54d4dd89 | ||
|
|
2eebbe64ab | ||
|
|
a65db858ff | ||
|
|
dc6366fef8 | ||
|
|
b669079dd6 | ||
|
|
0824522016 | ||
|
|
8b9fe0fa53 | ||
|
|
e0becc6161 | ||
|
|
2a62e1f0dd | ||
|
|
00c7d174e4 | ||
|
|
197060f097 | ||
|
|
f9c4e3a8b2 | ||
|
|
640c0098d1 | ||
|
|
c432e303c0 | ||
|
|
a6680c4b9f | ||
|
|
bc7b50deb0 | ||
|
|
b3caf035b4 | ||
|
|
5f892535a1 | ||
|
|
9d2a40a826 | ||
|
|
d13a3cd502 | ||
|
|
1412e9b9f0 | ||
|
|
870cb82c96 | ||
|
|
386c7ea2d3 | ||
|
|
c381a17784 | ||
|
|
79f559fdb5 | ||
|
|
1a3ade0a6f | ||
|
|
2a1443e0e0 | ||
|
|
369b286297 | ||
|
|
14225bf184 | ||
|
|
7c58993680 | ||
|
|
c837d06e2b | ||
|
|
d3cc950d62 | ||
|
|
949e577fe0 | ||
|
|
237a5ad333 | ||
|
|
6e31c76fb5 | ||
|
|
a77ee23ce2 | ||
|
|
0d62ec8715 | ||
|
|
4d0d124928 | ||
|
|
c84fb00aed | ||
|
|
d04ef78cd6 | ||
|
|
7e5d03d4cc | ||
|
|
18aaf57faf | ||
|
|
b17bb4724c | ||
|
|
d516bc4611 | ||
|
|
55a1074384 | ||
|
|
54c6432df5 | ||
|
|
170a21862b | ||
|
|
3116cddfd5 | ||
|
|
f5300c9a09 | ||
|
|
fe7a8b7742 | ||
|
|
60d91fb699 | ||
|
|
b2fe600f53 | ||
|
|
fbd6220149 | ||
|
|
63505a86ca | ||
|
|
9c7a5755f2 | ||
|
|
7c1a9c588c | ||
|
|
707c03da77 | ||
|
|
599cd8496e | ||
|
|
527f510103 | ||
|
|
02669f7c03 | ||
|
|
9b1a7da59b |
@@ -19,7 +19,7 @@ jobs:
|
||||
- name: Build
|
||||
run: make all
|
||||
env:
|
||||
CFLAGS: -arch x86_64 -arch arm64e
|
||||
CFLAGS: -arch x86_64 -arch arm64
|
||||
- name: Run Tests
|
||||
run: make test styles=develop
|
||||
env:
|
||||
@@ -51,13 +51,13 @@ jobs:
|
||||
# Note that macOS is always a 64 bit platform
|
||||
run: ./configure --enable-dtrace --enable-framework ${CFGOPT} "--prefix=$HOME/install" || (cat config.log && exit 1)
|
||||
env:
|
||||
CFLAGS: -arch x86_64 -arch arm64e
|
||||
CFLAGS: -arch x86_64 -arch arm64
|
||||
CFGOPT: ${{ matrix.cfgopt }}
|
||||
- name: Build
|
||||
run: |
|
||||
make all tcltest
|
||||
env:
|
||||
CFLAGS: -arch x86_64 -arch arm64e
|
||||
CFLAGS: -arch x86_64 -arch arm64
|
||||
- name: Run Tests
|
||||
run: |
|
||||
make test
|
||||
|
||||
@@ -62,7 +62,7 @@ jobs:
|
||||
sudo chmod a+x /usr/local/bin/macher
|
||||
echo "VER_PATH=$(cd tools; pwd)/addVerToFile.tcl" >> $GITHUB_ENV
|
||||
echo "CREATE_DMG=$(cd create-dmg;pwd)/create-dmg" >> $GITHUB_ENV
|
||||
echo "CFLAGS=-arch x86_64 -arch arm64e" >> $GITHUB_ENV
|
||||
echo "CFLAGS=-arch x86_64 -arch arm64" >> $GITHUB_ENV
|
||||
- name: Configure
|
||||
run: ./configure --disable-symbols --disable-shared --enable-zipfs
|
||||
working-directory: unix
|
||||
|
||||
+2
-2
@@ -2331,7 +2331,7 @@
|
||||
argument, the Tcl_Interp struct loses its termOffset field and the
|
||||
TCL_BRACKET_TERM flag in the evalFlags field, all of which were only
|
||||
used (indirectly) by Tcl_SubstObj(). Tests subst-8.7,8.8,11.4,11.5
|
||||
modified to accomodate the only behavior change: reporting of parse
|
||||
modified to accommodate the only behavior change: reporting of parse
|
||||
errors now takes precedence over [return] and [continue] exceptions.
|
||||
All other behavior should remain compatible. [RFE 536831,684982] [Bug
|
||||
685106]
|
||||
@@ -2571,7 +2571,7 @@
|
||||
2003-02-25 Don Porter <dgp@users.sourceforge.net>
|
||||
|
||||
* doc/pkgMkIndex.n: Modified [pkg_mkIndex] to use -nocase matching
|
||||
* library/package.tcl: of -load patterns, to better accomodate common
|
||||
* library/package.tcl: of -load patterns, to better accommodate common
|
||||
user errors due to confusion between [package names] names and [info
|
||||
loaded] names.
|
||||
|
||||
|
||||
@@ -2486,7 +2486,7 @@ interpreter. (JL)
|
||||
installing and requesting security policies, purely in Tcl code. Overloads
|
||||
the package command to also allow an interpreter to "require" a policy. The
|
||||
following new library commands are provided:
|
||||
tcl_safeCreateInterp -- creates a slave an initializes the
|
||||
tcl_safeCreateInterp -- creates a slave and initializes the
|
||||
policy mechanism.
|
||||
tcl_safeInitInterp -- initializes an existing slave with the
|
||||
policy mechanism.
|
||||
@@ -9413,3 +9413,54 @@ Many internal changes to broaden support for sizes beyond 32-bits.
|
||||
2021-10-27 tzdata updated to Olson's tzdata2021e (nijtmans)
|
||||
|
||||
- Released 8.6.12, Nov 5, 2021 - details at https://core.tcl-lang.org/tcl/ -
|
||||
|
||||
2021-12-08 (update) tcltest package to version 2.5.4
|
||||
|
||||
2022-01-13 (bug)[26f132] Crash when sizeof(int) < sizeof(void *) (Plan 9 port)
|
||||
|
||||
2022-01-19 (TIP 623)[e9a271] Tcl_GetRange index args < 0 (petasis,nijtmans)
|
||||
|
||||
2022-03-08 (bug) test string-5.22 (porter)
|
||||
|
||||
2022-03-11 (bug)[8a7ec8] fat binary compile on Mac M1 (davis, nijtmans)
|
||||
|
||||
2022-04-04 (bug)[e5ed1b] numeric IPv6 in URLs (nijtmans)
|
||||
=> http 2.9.6
|
||||
|
||||
2022-04-26 (bug)[27520c] test error-9.6 (goth,sebres)
|
||||
|
||||
2022-05-04 (bug)[8eb64b] http package tolerant again invalid reply header
|
||||
|
||||
2022-05-11 (bug)[6898f9] http package failed detection of shiftjis charset
|
||||
|
||||
2022-05-25 (bug)[76ad7a] tests string-6.13[23] (mistachkin, nijtmans)
|
||||
|
||||
2022-06-20 (bug)[55bf73] Avoid connection reuse after response code 101.
|
||||
=> http 2.9.8
|
||||
|
||||
2022-07-22 (bug)[713653] FP rounding exposed by x86 musl (rubicon,sebres)
|
||||
|
||||
2022-07-22 More portable notation of microseconds in verbose output (sebres)
|
||||
=> tcltest 2.5.5
|
||||
|
||||
2022-07-27 (bug)[b3977d] Process CR-LF split across packets (nadkarni,sebres)
|
||||
|
||||
2022-07-29 (bug)[4eb3a1] crash due to undetected bytecode invalidity (nadkarni)
|
||||
|
||||
2022-08-23 (new)[371080] Portability to CHERI-enabled Morello processor (jrtc27)
|
||||
|
||||
2022-09-06 (bug)[55a02f] Fallback init env(HOME) from USERPROFILE (nadkarni)
|
||||
|
||||
2022-09-13 (bug)[1073da] crash writing invalid utf-8 (nijtmans)
|
||||
|
||||
2022-09-14 (new) Update to Unicode-15 (nijtmans)
|
||||
|
||||
2022-10-14 tzdata updated to Olson's tzdata2022e (nijtmans)
|
||||
|
||||
Update bundled zlib to 1.2.13
|
||||
|
||||
Update bundled libtommath
|
||||
|
||||
Many code fixes to avoid overflow or undefined behavior. Thanks chrstphrchvz.
|
||||
|
||||
- Released 8.6.13, Nov 22, 2022 - details at https://core.tcl-lang.org/tcl/ -
|
||||
|
||||
@@ -66,6 +66,9 @@
|
||||
#ifdef _WIN32
|
||||
#define USEWIN32IOAPI
|
||||
#include "iowin32.h"
|
||||
# if defined(_MSC_VER)
|
||||
# define snprintf _snprintf
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -365,7 +368,7 @@ void addFileToZip(zipFile zf, const char *filenameinzip, const char *password, i
|
||||
void addPathToZip(zipFile zf, const char *filenameinzip, const char *password, int opt_exclude_path,int opt_compress_level) {
|
||||
tinydir_dir dir;
|
||||
int i;
|
||||
char newname[512];
|
||||
char newname[MAXFILENAME+1+MAXFILENAME+1];
|
||||
|
||||
tinydir_open_sorted(&dir, filenameinzip);
|
||||
|
||||
@@ -375,7 +378,7 @@ void addPathToZip(zipFile zf, const char *filenameinzip, const char *password, i
|
||||
tinydir_readfile_n(&dir, &file, i);
|
||||
if(strcmp(file.name,".")==0) continue;
|
||||
if(strcmp(file.name,"..")==0) continue;
|
||||
sprintf(newname,"%s/%s",dir.path,file.name);
|
||||
snprintf(newname, sizeof(newname), "%.*s/%.*s", MAXFILENAME, dir.path, MAXFILENAME, file.name);
|
||||
if (file.is_dir)
|
||||
{
|
||||
addPathToZip(zf,newname,password,opt_exclude_path,opt_compress_level);
|
||||
|
||||
@@ -39,6 +39,10 @@ char *
|
||||
\fBTcl_DStringResult\fR(\fIinterp, dsPtr\fR)
|
||||
.sp
|
||||
\fBTcl_DStringGetResult\fR(\fIinterp, dsPtr\fR)
|
||||
.sp
|
||||
Tcl_Obj *
|
||||
\fBTcl_DStringToObj\fR(\fIdsPtr\fR)
|
||||
.sp
|
||||
.SH ARGUMENTS
|
||||
.AS Tcl_DString newLength in/out
|
||||
.AP Tcl_DString *dsPtr in/out
|
||||
@@ -136,12 +140,25 @@ a pointer from \fIdsPtr\fR to the interpreter's result.
|
||||
This saves the cost of allocating new memory and copying the string.
|
||||
\fBTcl_DStringResult\fR also reinitializes the dynamic string to
|
||||
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.
|
||||
.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
|
||||
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.
|
||||
|
||||
.SH KEYWORDS
|
||||
append, dynamic string, free, result
|
||||
|
||||
+61
-26
@@ -8,7 +8,7 @@
|
||||
.so man.macros
|
||||
.BS
|
||||
.SH NAME
|
||||
Tcl_GetEncoding, Tcl_FreeEncoding, Tcl_GetEncodingFromObj, Tcl_ExternalToUtfDString, Tcl_ExternalToUtf, Tcl_UtfToExternalDString, Tcl_UtfToExternal, Tcl_GetEncodingName, Tcl_SetSystemEncoding, Tcl_GetEncodingNameFromEnvironment, Tcl_GetEncodingNames, Tcl_CreateEncoding, Tcl_GetEncodingSearchPath, Tcl_SetEncodingSearchPath \- procedures for creating and using encodings
|
||||
Tcl_GetEncoding, Tcl_FreeEncoding, Tcl_GetEncodingFromObj, Tcl_ExternalToUtfDString, Tcl_ExternalToUtfDStringEx, Tcl_ExternalToUtf, Tcl_UtfToExternalDString, Tcl_UtfToExternalDStringEx, Tcl_UtfToExternal, Tcl_GetEncodingName, Tcl_SetSystemEncoding, Tcl_GetEncodingNameFromEnvironment, Tcl_GetEncodingNames, Tcl_CreateEncoding, Tcl_GetEncodingSearchPath, Tcl_SetEncodingSearchPath \- procedures for creating and using encodings
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
\fB#include <tcl.h>\fR
|
||||
@@ -26,13 +26,13 @@ char *
|
||||
\fBTcl_ExternalToUtfDString\fR(\fIencoding, src, srcLen, dstPtr\fR)
|
||||
.sp
|
||||
size_t
|
||||
\fBTcl_ExternalToUtfDStringEx\fR(\fIencoding, src, srcLen, flags, dstPtr\fR)
|
||||
\fBTcl_ExternalToUtfDStringEx\fR(\fIinterp, encoding, src, srcLen, flags, dstPtr, errorIdxPtr\fR)
|
||||
.sp
|
||||
char *
|
||||
\fBTcl_UtfToExternalDString\fR(\fIencoding, src, srcLen, dstPtr\fR)
|
||||
.sp
|
||||
size_t
|
||||
\fBTcl_UtfToExternalDStringEx\fR(\fIencoding, src, srcLen, flags, dstPtr\fR)
|
||||
\fBTcl_UtfToExternalDStringEx\fR(\fIinterp, encoding, src, srcLen, flags, dstPtr, errorIdxPtr\fR)
|
||||
.sp
|
||||
int
|
||||
\fBTcl_ExternalToUtf\fR(\fIinterp, encoding, src, srcLen, flags, statePtr,
|
||||
@@ -45,7 +45,7 @@ int
|
||||
const char *
|
||||
\fBTcl_GetEncodingName\fR(\fIencoding\fR)
|
||||
.sp
|
||||
int
|
||||
size_t
|
||||
\fBTcl_GetEncodingNulLength\fR(\fIencoding\fR)
|
||||
.sp
|
||||
int
|
||||
@@ -93,7 +93,7 @@ encoding-specific length of the string is used.
|
||||
Pointer to an uninitialized or free \fBTcl_DString\fR in which the converted
|
||||
result will be stored.
|
||||
.AP int flags in
|
||||
Various flag bits OR-ed together.
|
||||
This is a bit mask passed in to control the operation of the encoding functions.
|
||||
\fBTCL_ENCODING_START\fR signifies that the
|
||||
source buffer is the first block in a (potentially multi-block) input
|
||||
stream, telling the conversion routine to reset to an initial state and
|
||||
@@ -101,16 +101,15 @@ perform any initialization that needs to occur before the first byte is
|
||||
converted. \fBTCL_ENCODING_END\fR signifies that the source buffer is the last
|
||||
block in a (potentially multi-block) input stream, telling the conversion
|
||||
routine to perform any finalization that needs to occur after the last
|
||||
byte is converted and then to reset to an initial state.
|
||||
\fBTCL_ENCODING_NOCOMPLAIN\fR signifies that the conversion routine should
|
||||
not return immediately upon reading a source character that does not exist in
|
||||
the target encoding, but it will substitute a default fallback character for
|
||||
all of such characters. The flag \fBTCL_ENCODING_STOPONERROR\fR has no effect,
|
||||
it only has meaning in Tcl 8.x. The flag \fBTCL_ENCODING_STRICT\fR makes the
|
||||
encoder/decoder more strict in what it considers to be an invalid byte
|
||||
sequence. The flag \fBTCL_ENCODING_MODIFIED\fR makes
|
||||
\fBTcl_UtfToExternalDStringEx\fR and \fBTcl_UtfToExternal\fR produce the byte
|
||||
sequence \exC0\ex80 in stead of \ex00, for the utf-8/cesu-8 encoders.
|
||||
byte is converted and then to reset to an initial state. The
|
||||
\fBTCL_PROFILE_*\fR bits defined in the \fBPROFILES\fR section below
|
||||
control the encoding profile to be used for dealing with invalid data or
|
||||
other errors in the encoding transform.
|
||||
\fBTCL_ENCODING_STOPONERROR\fR is present for backward compatibility with
|
||||
Tcl 8.6 and forces the encoding profile to \fBstrict\fR.
|
||||
|
||||
Some flags bits may not be usable with some functions as noted in the
|
||||
function descriptions below.
|
||||
.AP Tcl_EncodingState *statePtr in/out
|
||||
Used when converting a (generally long or indefinite length) byte stream
|
||||
in a piece-by-piece fashion. The conversion routine stores its current
|
||||
@@ -136,6 +135,9 @@ buffer as a result of the conversion. May be NULL.
|
||||
.AP int *dstCharsPtr out
|
||||
Filled with the number of characters that correspond to the number of bytes
|
||||
stored in the output buffer. May be NULL.
|
||||
.AP Tcl_Size *errorIdxPtr out
|
||||
Filled with the index of the byte or character that caused the encoding transform
|
||||
to fail. May be NULL.
|
||||
.AP Tcl_DString *bufPtr out
|
||||
Storage for the prescribed system encoding name.
|
||||
.AP "const Tcl_EncodingType" *typePtr in
|
||||
@@ -210,10 +212,27 @@ When converting, if any of the characters in the source buffer cannot be
|
||||
represented in the target encoding, a default fallback character will be
|
||||
used. The return value is a pointer to the value stored in the DString.
|
||||
.PP
|
||||
\fBTcl_ExternalToUtfDStringEx\fR is the same as \fBTcl_ExternalToUtfDString\fR,
|
||||
but it has an additional flags parameter. The return value is the index of
|
||||
the first byte in the input string causing a conversion error.
|
||||
Or TCL_INDEX_NONE if all is OK.
|
||||
\fBTcl_ExternalToUtfDStringEx\fR is a more flexible version of older
|
||||
\fBTcl_ExternalToUtfDString\fR function. It takes three additional parameters,
|
||||
\fBinterp\fR, \fBflags\fR and \fBerrorIdxPtr\fR. The \fBflags\fR parameter may
|
||||
be used to specify the profile to be used for the transform. The
|
||||
\fBTCL_ENCODING_START\fR and \fBTCL_ENCODING_END\fR bits in \fBflags\fR are
|
||||
ignored as the function assumes the entire source string to be decoded is passed
|
||||
into the function. On success, the function returns \fBTCL_ERROR\fR with the
|
||||
converted string stored in \fB*dstPtr\fR. For errors other than conversion
|
||||
errors, such as invalid flags, the function returns \fBTCL_OK\fR with an error
|
||||
message in \fBinterp\fR if it is not NULL.
|
||||
.PP
|
||||
For conversion errors, \fBTcl_ExternalToUtfDStringEx\fR returns one
|
||||
of the \fBTCL_CONVERT_*\fR errors listed below for \fBTcl_ExternalToUtf\fR.
|
||||
When one of these conversion errors is returned, an error message is
|
||||
stored in \fBinterp\fR only if \fBerrorIdxPtr\fR is NULL. Otherwise, no error message
|
||||
is stored as the function expects the caller is interested whatever is
|
||||
decoded to that point and not treating this as an immediate error condition.
|
||||
The index of the error location is stored in \fB*errorIdxPtr\fR.
|
||||
.PP
|
||||
The caller must call \fBTcl_DStringFree\fR to free up the \fB*dstPtr\fR resources
|
||||
irrespective of the return value from the function.
|
||||
.PP
|
||||
\fBTcl_ExternalToUtf\fR converts a source buffer \fIsrc\fR from the specified
|
||||
\fIencoding\fR into UTF-8. Up to \fIsrcLen\fR bytes are converted from the
|
||||
@@ -236,12 +255,12 @@ the unconverted bytes that remained in \fIsrc\fR plus some further bytes
|
||||
from the source stream to properly convert the formerly split-up multibyte
|
||||
sequence.
|
||||
.IP \fBTCL_CONVERT_SYNTAX\fR 29
|
||||
The source buffer contained an invalid character sequence. This may occur
|
||||
The source buffer contained an invalid byte or character sequence. This may occur
|
||||
if the input stream has been damaged or if the input encoding method was
|
||||
misidentified.
|
||||
.IP \fBTCL_CONVERT_UNKNOWN\fR 29
|
||||
The source buffer contained a character that could not be represented in
|
||||
the target encoding and \fBTCL_ENCODING_NOCOMPLAIN\fR was not specified.
|
||||
the target encoding.
|
||||
.RE
|
||||
.LP
|
||||
\fBTcl_UtfToExternalDString\fR converts a source buffer \fIsrc\fR from UTF-8
|
||||
@@ -253,10 +272,14 @@ characters in the source buffer cannot be represented in the target
|
||||
encoding, a default fallback character will be used. The return value is
|
||||
a pointer to the value stored in the DString.
|
||||
.PP
|
||||
\fBTcl_UtfToExternalDStringEx\fR is the same as \fBTcl_UtfToExternalDString\fR,
|
||||
but it has an additional flags parameter. The return value is the index of
|
||||
the first byte of an utf-8 byte-sequence in the input string causing a
|
||||
conversion error. Or TCL_INDEX_NONE if all is OK.
|
||||
\fBTcl_UtfToExternalDStringEx\fR is an enhanced version of
|
||||
\fBTcl_UtfToExternalDString\fR that transforms UTF-8 encoded source data to a specified
|
||||
\fIencoding\fR. Except for the direction of the transform, the parameters and
|
||||
return values are identical to those of \fBTcl_ExternalToUtfDStringEx\fR. See
|
||||
that function above for details about the same.
|
||||
|
||||
Irrespective of the return code from the function, the caller must free
|
||||
resources associated with \fB*dstPtr\fR when the function returns.
|
||||
.PP
|
||||
\fBTcl_UtfToExternal\fR converts a source buffer \fIsrc\fR from UTF-8 into
|
||||
the specified \fIencoding\fR. Up to \fIsrcLen\fR bytes are converted from
|
||||
@@ -324,7 +347,7 @@ typedef struct Tcl_EncodingType {
|
||||
Tcl_EncodingConvertProc *\fIfromUtfProc\fR;
|
||||
Tcl_EncodingFreeProc *\fIfreeProc\fR;
|
||||
void *\fIclientData\fR;
|
||||
int \fInullSize\fR;
|
||||
size_t \fInullSize\fR;
|
||||
} \fBTcl_EncodingType\fR;
|
||||
.CE
|
||||
.PP
|
||||
@@ -559,6 +582,18 @@ to the object, it will be deleted.
|
||||
.PP
|
||||
\fBTcl_GetEncodingSearchPath\fR returns an object with a reference count of at
|
||||
least 1.
|
||||
.SH "PROFILES"
|
||||
Encoding profiles define the manner in which errors in the encoding transforms
|
||||
are handled by the encoding functions. An application can specify the profile
|
||||
to be used by OR-ing the \fBflags\fR parameter passed to the function
|
||||
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.
|
||||
.PP
|
||||
For details about profiles, see the \fBPROFILES\fR section in
|
||||
the documentation of the \fBencoding\fR command.
|
||||
.SH "SEE ALSO"
|
||||
encoding(n)
|
||||
.SH KEYWORDS
|
||||
|
||||
+6
-1
@@ -8,7 +8,7 @@
|
||||
.so man.macros
|
||||
.BS
|
||||
.SH NAME
|
||||
Tcl_NewIntObj, Tcl_NewLongObj, Tcl_NewWideIntObj, Tcl_SetIntObj, Tcl_SetLongObj, Tcl_SetWideIntObj, Tcl_GetIntFromObj, Tcl_GetIntForIndex, Tcl_GetLongFromObj, Tcl_GetWideIntFromObj, Tcl_NewBignumObj, Tcl_SetBignumObj, Tcl_GetBignumFromObj, Tcl_TakeBignumFromObj \- manipulate Tcl values as integers
|
||||
Tcl_NewIntObj, Tcl_NewLongObj, Tcl_NewWideIntObj, Tcl_SetIntObj, Tcl_SetLongObj, Tcl_SetWideIntObj, Tcl_GetIntFromObj, Tcl_GetIntForIndex, Tcl_GetLongFromObj, Tcl_GetWideIntFromObj, Tcl_GetWideUIntFromObj, Tcl_NewBignumObj, Tcl_SetBignumObj, Tcl_GetBignumFromObj, Tcl_TakeBignumFromObj \- manipulate Tcl values as integers
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
\fB#include <tcl.h>\fR
|
||||
@@ -40,6 +40,9 @@ int
|
||||
int
|
||||
\fBTcl_GetWideIntFromObj\fR(\fIinterp, objPtr, widePtr\fR)
|
||||
.sp
|
||||
int
|
||||
\fBTcl_GetWideUIntFromObj\fR(\fIinterp, objPtr, uwidePtr\fR)
|
||||
.sp
|
||||
.sp
|
||||
\fB#include <tclTomMath.h>\fR
|
||||
.sp
|
||||
@@ -84,6 +87,8 @@ Points to place to store the long integer value retrieved from \fIobjPtr\fR.
|
||||
Points to place to store the size_t 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 mp_int *bigValue in/out
|
||||
Points to a multi-precision integer structure declared by the LibTomMath
|
||||
library.
|
||||
|
||||
+1
-3
@@ -239,9 +239,7 @@ The C variable, or each element of the C array, is of type \fBTcl_WideUInt\fR
|
||||
(which is an unsigned integer type at least 64-bits wide on all platforms that
|
||||
can support it.)
|
||||
Any value written into the Tcl variable must have a proper unsigned
|
||||
integer form acceptable to \fBTcl_GetWideIntFromObj\fR (it will be
|
||||
cast to unsigned);
|
||||
.\" FIXME! Use bignums instead.
|
||||
wideinteger form acceptable to \fBTcl_GetWideUIntFromObj\fR;
|
||||
attempts to write non-integer values into \fIvarName\fR will be
|
||||
rejected with Tcl errors. Incomplete integer representations (like
|
||||
the empty string, '+', '-' or the hex/octal/decimal/binary prefix) are accepted
|
||||
|
||||
+12
-12
@@ -406,10 +406,10 @@ 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 \-1 and \fBTcl_ReadChars\fR records a POSIX error code that
|
||||
return value is TCL_INDEX_NONE and \fBTcl_ReadChars\fR records a POSIX error code that
|
||||
can be retrieved with \fBTcl_GetErrno\fR.
|
||||
.PP
|
||||
Setting \fIcharsToRead\fR to \fB\-1\fR will cause the command to read
|
||||
Setting \fIcharsToRead\fR to TCL_INDEX_NONE will cause the command to read
|
||||
all characters currently available (non-blocking) or everything until
|
||||
eof (blocking mode).
|
||||
.PP
|
||||
@@ -471,14 +471,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 \-1 and records a POSIX error code
|
||||
error occurs, \fBTcl_GetsObj\fR returns TCL_INDEX_NONE and records a POSIX error code
|
||||
that can be retrieved with \fBTcl_GetErrno\fR. \fBTcl_GetsObj\fR also
|
||||
returns \-1 if the end of the file is reached; the \fBTcl_Eof\fR procedure
|
||||
returns TCL_INDEX_NONE 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 \-1 if
|
||||
no data was available or the data that was available did not contain an
|
||||
end-of-line character. When \-1 is returned, the \fBTcl_InputBlocked\fR
|
||||
If the channel is in nonblocking mode, the return value can also be TCL_INDEX_NONE
|
||||
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
|
||||
procedure may be invoked to determine if the channel is blocked because
|
||||
of input unavailability.
|
||||
.PP
|
||||
@@ -496,7 +496,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
|
||||
\-1 if an error occurs.
|
||||
TCL_INDEX_NONE 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,10 +513,10 @@ 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 greater than zero to
|
||||
indicate success or \-1 to indicate that an error occurred. If an error
|
||||
occurs, \fBTcl_WriteChars\fR records a POSIX error code that may be
|
||||
retrieved with \fBTcl_GetErrno\fR.
|
||||
accepted for output to the channel. This is either TCL_INDEX_NONE 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.
|
||||
.PP
|
||||
Newline characters in the output data are translated to platform-specific
|
||||
end-of-line sequences according to the \fB\-translation\fR option for the
|
||||
|
||||
+9
-9
@@ -250,18 +250,18 @@ and \fBTcl_ObjGetVar2\fR is (if non-NULL) a value with a reference of at least
|
||||
operated upon.
|
||||
.PP
|
||||
The \fInewValuePtr\fR argument to \fBTcl_SetVar2Ex\fR and \fBTcl_ObjSetVar2\fR
|
||||
may be an arbitrary reference count value; its reference count will be
|
||||
incremented on success. However, it is recommended to not use a zero reference
|
||||
count value, as that makes correct handling of the error case tricky.
|
||||
may be an arbitrary reference count value. Its reference count is
|
||||
incremented on success. On failure, if its reference count is zero, it is
|
||||
decremented and freed so the caller need do nothing with it.
|
||||
.PP
|
||||
The \fIpart1\fR argument to \fBTcl_ObjSetVar2\fR and \fBTcl_ObjGetVar2\fR can
|
||||
have any reference count; these functions never modify it. It is recommended
|
||||
to not use a zero reference count for this argument.
|
||||
The \fIpart1Ptr\fR argument to \fBTcl_ObjSetVar2\fR and \fBTcl_ObjGetVar2\fR can
|
||||
have any reference count. These functions never modify it.
|
||||
.PP
|
||||
The \fIpart2\fR argument to \fBTcl_ObjSetVar2\fR and \fBTcl_ObjGetVar2\fR, if
|
||||
The \fIpart2Ptr\fR argument to \fBTcl_ObjSetVar2\fR and \fBTcl_ObjGetVar2\fR, if
|
||||
non-NULL, should not have a zero reference count as these functions may
|
||||
retain a reference to it (particularly when it is used to create an array
|
||||
element that did not previously exist).
|
||||
retain a reference to it, particularly when it is used to create an array
|
||||
element that did not previously exist, and decrementing the reference count
|
||||
later would leave them pointing to a freed Tcl_Obj.
|
||||
|
||||
.SH "SEE ALSO"
|
||||
Tcl_GetObjResult, Tcl_GetStringResult, Tcl_TraceVar
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1993 The Regents of the University of California.
|
||||
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
|
||||
'\" 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.
|
||||
@@ -16,176 +17,152 @@ Summary of Tcl language syntax.
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
The following rules define the syntax and semantics of the Tcl language:
|
||||
.IP "[1] \fBCommands.\fR"
|
||||
A Tcl script is a string containing one or more commands.
|
||||
Semi-colons and newlines are command separators unless quoted as
|
||||
described below.
|
||||
Close brackets are command terminators during command substitution
|
||||
(see below) unless quoted.
|
||||
.IP "[2] \fBEvaluation.\fR"
|
||||
A command is evaluated in two steps.
|
||||
First, the Tcl interpreter breaks the command into \fIwords\fR
|
||||
and performs substitutions as described below.
|
||||
These substitutions are performed in the same way for all
|
||||
commands.
|
||||
Secondly, the first word is used to locate a routine to
|
||||
carry out the command, and the remaining words of the command are
|
||||
passed to that routine.
|
||||
The routine is free to interpret each of its words
|
||||
in any way it likes, such as an integer, variable name, list,
|
||||
or Tcl script.
|
||||
Different commands interpret their words differently.
|
||||
.IP "[3] \fBWords.\fR"
|
||||
Words of a command are separated by white space (except for
|
||||
newlines, which are command separators).
|
||||
.IP "[4] \fBDouble quotes.\fR"
|
||||
If the first character of a word is double-quote
|
||||
.PQ \N'34'
|
||||
then the word is terminated by the next double-quote character.
|
||||
If semi-colons, close brackets, or white space characters
|
||||
(including newlines) appear between the quotes then they are treated
|
||||
as ordinary characters and included in the word.
|
||||
Command substitution, variable substitution, and backslash substitution
|
||||
are performed on the characters between the quotes as described below.
|
||||
The double-quotes are not retained as part of the word.
|
||||
.IP "[5] \fBArgument expansion.\fR"
|
||||
If a word starts with the string
|
||||
.QW {*}
|
||||
followed by a non-whitespace character, then the leading
|
||||
.QW {*}
|
||||
is removed and the rest of the word is parsed and substituted as any other
|
||||
word. After substitution, the word is parsed as a list (without command or
|
||||
variable substitutions; backslash substitutions are performed as is normal for
|
||||
a list and individual internal words may be surrounded by either braces or
|
||||
double-quote characters), and its words are added to the command being
|
||||
substituted. For instance,
|
||||
.QW "cmd a {*}{b [c]} d {*}{$e f {g h}}"
|
||||
is equivalent to
|
||||
.QW "cmd a b {[c]} d {$e} f {g h}" .
|
||||
.IP "[6] \fBBraces.\fR"
|
||||
If the first character of a word is an open brace
|
||||
.
|
||||
.IP "[1] \fBScript.\fR"
|
||||
A script is composed of zero or more commands delimited by semi-colons or
|
||||
newlines.
|
||||
.IP "[2] \fBCommand.\fR"
|
||||
A command is composed of zero or more words delimited by whitespace. The
|
||||
replacement for a substitution is included verbatim in the word. For example, a
|
||||
space in the replacement is included in the word rather than becoming a
|
||||
delimiter, and \fI\\\\\fR becomes a single backslash in the word. Each word is
|
||||
processed from left to right and each substitution is performed as soon as it
|
||||
is complete.
|
||||
For example, the command
|
||||
.RS
|
||||
.PP
|
||||
.CS
|
||||
set y [set x 0][incr x][incr x]
|
||||
.CE
|
||||
.PP
|
||||
is composed of three words, and sets the value of \fIy\fR to \fI012\fR.
|
||||
.PP
|
||||
If hash
|
||||
.PQ #
|
||||
is the first character of what would otherwise be the first word of a command,
|
||||
all characters up to the next newline are ignored.
|
||||
.RE
|
||||
.
|
||||
.IP "[3] \fBBraced word.\fR"
|
||||
If a word is enclosed in braces
|
||||
.PQ {
|
||||
and rule [5] does not apply, then
|
||||
the word is terminated by the matching close brace
|
||||
.PQ } "" .
|
||||
Braces nest within the word: for each additional open
|
||||
brace there must be an additional close brace (however,
|
||||
if an open brace or close brace within the word is
|
||||
quoted with a backslash then it is not counted in locating the
|
||||
matching close brace).
|
||||
No substitutions are performed on the characters between the
|
||||
braces except for backslash-newline substitutions described
|
||||
below, nor do semi-colons, newlines, close brackets,
|
||||
or white space receive any special interpretation.
|
||||
The word will consist of exactly the characters between the
|
||||
outer braces, not including the braces themselves.
|
||||
.IP "[7] \fBCommand substitution.\fR"
|
||||
If a word contains an open bracket
|
||||
and
|
||||
.PQ } ""
|
||||
, the braces are removed and the enclosed characters become the word. No
|
||||
substitutions are performed. Nested pairs of braces may occur within the word.
|
||||
A brace preceded by an odd number of backslashes is not considered part of a
|
||||
pair, and neither brace nor the backslashes are removed from the word.
|
||||
.
|
||||
.IP "[4] \fBQuoted word.\fR"
|
||||
If a word is enclosed in double quotes
|
||||
.PQ \N'34'
|
||||
, the double quotes are removed and the enclosed characters become the word.
|
||||
Substitutions are performed.
|
||||
.
|
||||
.IP "[5] \fBList.\fR"
|
||||
A list has the form of a single command. Newline is whitespace, and semicolon
|
||||
has no special interpretation. There is no script evaluation so there is no
|
||||
argument expansion, variable substitution, or command substitution: Dollar-sign
|
||||
and open bracket have no special interpretation, and what would be argument
|
||||
expansion in a script is invalid in a list.
|
||||
.
|
||||
.IP "[6] \fBArgument expansion.\fR"
|
||||
If
|
||||
.QW {*}
|
||||
prefixes a word, it is removed. After any remaining enclosing braces or quotes
|
||||
are processed and applicable substitutions performed, the word, which must
|
||||
be a list, is removed from the command, and in its place each word in the
|
||||
list becomes an additional word in the command. For example,
|
||||
.CS
|
||||
cmd a {*}{b [c]} d {*}{$e f {g h}}
|
||||
.CE
|
||||
is equivalent to
|
||||
.CS
|
||||
cmd a b {[c]} d {$e} f {g h} .
|
||||
.CE
|
||||
.
|
||||
.IP "[7] \fBEvaluation.\fR"
|
||||
To evaluate a script, an interpreter evaluates each successive command. The
|
||||
first word identifies a procedure, and the remaining words are passed to that
|
||||
procedure for further evaluation. The procedure interprets each argument in
|
||||
its own way, e.g. as an integer, variable name, list, mathematical expression,
|
||||
script, or in some other arbitrary way. The result of the last command is the
|
||||
result of the script.
|
||||
.
|
||||
.IP "[8] \fBCommand substitution.\fR"
|
||||
Each pair of brackets
|
||||
.PQ [
|
||||
then Tcl performs \fIcommand substitution\fR.
|
||||
To do this it invokes the Tcl interpreter recursively to process
|
||||
the characters following the open bracket as a Tcl script.
|
||||
The script may contain any number of commands and must be terminated
|
||||
by a close bracket
|
||||
.PQ ] "" .
|
||||
The result of the script (i.e. the result of its last command) is
|
||||
substituted into the word in place of the brackets and all of the
|
||||
characters between them.
|
||||
There may be any number of command substitutions in a single word.
|
||||
Command substitution is not performed on words enclosed in braces.
|
||||
.IP "[8] \fBVariable substitution.\fR"
|
||||
If a word contains a dollar-sign
|
||||
and
|
||||
.PQ ] ""
|
||||
encloses a script and is replaced by the result of that script.
|
||||
.IP "[9] \fBVariable substitution.\fR"
|
||||
Each of the following forms begins with dollar sign
|
||||
.PQ $
|
||||
followed by one of the forms
|
||||
described below, then Tcl performs \fIvariable
|
||||
substitution\fR: the dollar-sign and the following characters are
|
||||
replaced in the word by the value of a variable.
|
||||
Variable substitution may take any of the following forms:
|
||||
and is replaced by the value of the identified variable. \fIname\fR names the
|
||||
variable and is composed of ASCII letters (\fBA\fR\(en\fBZ\fR and
|
||||
\fBa\fR\(en\fBz\fR), digits (\fB0\fR\(en\fB9\fR), underscores, or namespace
|
||||
delimiters (two or more colons). \fIindex\fR is the name of an individual
|
||||
variable within an array variable, and may be empty.
|
||||
.RS
|
||||
.TP 15
|
||||
\fB$\fIname\fR
|
||||
.
|
||||
\fIName\fR is the name of a scalar variable; the name is a sequence
|
||||
of one or more characters that are a letter, digit, underscore,
|
||||
or namespace separators (two or more colons).
|
||||
Letters and digits are \fIonly\fR the standard ASCII ones (\fB0\fR\(en\fB9\fR,
|
||||
\fBA\fR\(en\fBZ\fR and \fBa\fR\(en\fBz\fR).
|
||||
\fIname\fR may not be empty.
|
||||
|
||||
.TP 15
|
||||
\fB$\fIname\fB(\fIindex\fB)\fR
|
||||
.
|
||||
\fIName\fR gives the name of an array variable and \fIindex\fR gives
|
||||
the name of an element within that array.
|
||||
\fIName\fR must contain only letters, digits, underscores, and
|
||||
namespace separators, and may be an empty string.
|
||||
Letters and digits are \fIonly\fR the standard ASCII ones (\fB0\fR\(en\fB9\fR,
|
||||
\fBA\fR\(en\fBZ\fR and \fBa\fR\(en\fBz\fR).
|
||||
Command substitutions, variable substitutions, and backslash
|
||||
substitutions are performed on the characters of \fIindex\fR.
|
||||
\fIname\fR may be empty. Substitutions are performed on \fIindex\fR.
|
||||
.TP 15
|
||||
\fB${\fIname\fB}\fR
|
||||
\fIname\fR may be empty.
|
||||
.TP 15
|
||||
\fB${\fIname(index)\fB}\fR
|
||||
.
|
||||
\fIName\fR is the name of a scalar variable or array element. It may contain
|
||||
any characters whatsoever except for close braces. It indicates an array
|
||||
element if \fIname\fR is in the form
|
||||
.QW \fIarrayName\fB(\fIindex\fB)\fR
|
||||
where \fIarrayName\fR does not contain any open parenthesis characters,
|
||||
.QW \fB(\fR ,
|
||||
or close brace characters,
|
||||
.QW \fB}\fR ,
|
||||
and \fIindex\fR can be any sequence of characters except for close brace
|
||||
characters. No further
|
||||
substitutions are performed during the parsing of \fIname\fR.
|
||||
.PP
|
||||
There may be any number of variable substitutions in a single word.
|
||||
Variable substitution is not performed on words enclosed in braces.
|
||||
.PP
|
||||
Note that variables may contain character sequences other than those listed
|
||||
above, but in that case other mechanisms must be used to access them (e.g.,
|
||||
via the \fBset\fR command's single-argument form).
|
||||
\fIname\fR may be empty. No substitutions are performed.
|
||||
.RE
|
||||
.IP "[9] \fBBackslash substitution.\fR"
|
||||
If a backslash
|
||||
Variables that are not accessible through one of the forms above may be
|
||||
accessed through other mechanisms, e.g. the \fBset\fR command.
|
||||
.IP "[10] \fBBackslash substitution.\fR"
|
||||
Each backslash
|
||||
.PQ \e
|
||||
appears within a word then \fIbackslash substitution\fR occurs.
|
||||
In all cases but those described below the backslash is dropped and
|
||||
the following character is treated as an ordinary
|
||||
character and included in the word.
|
||||
This allows characters such as double quotes, close brackets,
|
||||
and dollar signs to be included in words without triggering
|
||||
special processing.
|
||||
The following table lists the backslash sequences that are
|
||||
handled specially, along with the value that replaces each sequence.
|
||||
that is not part of one of the forms listed below is removed, and the next
|
||||
character is included in the word verbatim, which allows the inclusion of
|
||||
characters that would normally be interpreted, namely whitespace, braces,
|
||||
brackets, double quote, dollar sign, and backslash. The following sequences
|
||||
are replaced as described:
|
||||
.RS
|
||||
.RS
|
||||
.RS
|
||||
.TP 7
|
||||
\e\fBa\fR
|
||||
Audible alert (bell) (Unicode U+000007).
|
||||
Audible alert (bell) (U+7).
|
||||
.TP 7
|
||||
\e\fBb\fR
|
||||
Backspace (Unicode U+000008).
|
||||
Backspace (U+8).
|
||||
.TP 7
|
||||
\e\fBf\fR
|
||||
Form feed (Unicode U+00000C).
|
||||
Form feed (U+C).
|
||||
.TP 7
|
||||
\e\fBn\fR
|
||||
Newline (Unicode U+00000A).
|
||||
Newline (U+A).
|
||||
.TP 7
|
||||
\e\fBr\fR
|
||||
Carriage-return (Unicode U+00000D).
|
||||
Carriage-return (U+D).
|
||||
.TP 7
|
||||
\e\fBt\fR
|
||||
Tab (Unicode U+000009).
|
||||
Tab (U+9).
|
||||
.TP 7
|
||||
\e\fBv\fR
|
||||
Vertical tab (Unicode U+00000B).
|
||||
Vertical tab (U+B).
|
||||
.TP 7
|
||||
\e\fB<newline>\fIwhiteSpace\fR
|
||||
.
|
||||
A single space character replaces the backslash, newline, and all spaces
|
||||
and tabs after the newline. This backslash sequence is unique in that it
|
||||
is replaced in a separate pre-pass before the command is actually parsed.
|
||||
This means that it will be replaced even when it occurs between braces,
|
||||
and the resulting space will be treated as a word separator if it is not
|
||||
in braces or quotes.
|
||||
Newline preceded by an odd number of backslashes, along with the consecutive
|
||||
spaces and tabs that immediately follow it, is replaced by a single space.
|
||||
Because this happens before the command is split into words, it occurs even
|
||||
within braced words, and if the resulting space may subsequently be treated as
|
||||
a word delimiter.
|
||||
.TP 7
|
||||
\e\e
|
||||
Backslash
|
||||
@@ -193,83 +170,30 @@ Backslash
|
||||
.TP 7
|
||||
\e\fIooo\fR
|
||||
.
|
||||
The digits \fIooo\fR (one, two, or three of them) give a eight-bit octal
|
||||
value for the Unicode character that will be inserted, in the range
|
||||
\fI000\fR\(en\fI377\fR (i.e., the range U+000000\(enU+0000FF).
|
||||
The parser will stop just before this range overflows, or when
|
||||
the maximum of three digits is reached. The upper bits of the Unicode
|
||||
character will be 0.
|
||||
Up to three octal digits form an eight-bit value for a Unicode character in the
|
||||
range \fI0\fR\(en\fI377\fR, i.e. U+0\(enU+FF. Only the digits that result in a
|
||||
number in this range are consumed.
|
||||
.TP 7
|
||||
\e\fBx\fIhh\fR
|
||||
.
|
||||
The hexadecimal digits \fIhh\fR (one or two of them) give an eight-bit
|
||||
hexadecimal value for the Unicode character that will be inserted. The upper
|
||||
bits of the Unicode character will be 0 (i.e., the character will be in the
|
||||
range U+000000\(enU+0000FF).
|
||||
Up to two hexadecimal digits form an eight-bit value for a Unicode character in
|
||||
the range \fI0\fR\(en\fIFF\fR.
|
||||
.TP 7
|
||||
\e\fBu\fIhhhh\fR
|
||||
.
|
||||
The hexadecimal digits \fIhhhh\fR (one, two, three, or four of them) give a
|
||||
sixteen-bit hexadecimal value for the Unicode character that will be
|
||||
inserted. The upper bits of the Unicode character will be 0 (i.e., the
|
||||
character will be in the range U+000000\(enU+00FFFF).
|
||||
Up to four hexadecimal digits form a 16-bit value for a Unicode character in
|
||||
the range \fI0\fR\(en\fIFFFF\fR.
|
||||
.TP 7
|
||||
\e\fBU\fIhhhhhhhh\fR
|
||||
.
|
||||
The hexadecimal digits \fIhhhhhhhh\fR (one up to eight of them) give a
|
||||
twenty-one-bit hexadecimal value for the Unicode character that will be
|
||||
inserted, in the range U+000000\(enU+10FFFF. The parser will stop just
|
||||
before this range overflows, or when the maximum of eight digits
|
||||
is reached. The upper bits of the Unicode character will be 0.
|
||||
.RS
|
||||
.PP
|
||||
The range U+00D800\(enU+00DFFF is reserved for surrogates, which
|
||||
are illegal on their own. Therefore, such sequences will result in
|
||||
the replacement character U+FFFD. Surrogate pairs should be
|
||||
encoded as single \e\fBU\fIhhhhhhhh\fR character.
|
||||
Up to eight hexadecimal digits form a 21-bit value for a Unicode character in
|
||||
the range \fI0\fR\(en\fI10FFFF\fR. Only the digits that result in a number in
|
||||
this range are consumed.
|
||||
.RE
|
||||
.RE
|
||||
.PP
|
||||
Backslash substitution is not performed on words enclosed in braces,
|
||||
except for backslash-newline as described above.
|
||||
.RE
|
||||
.IP "[10] \fBComments.\fR"
|
||||
If a hash character
|
||||
.PQ #
|
||||
appears at a point where Tcl is
|
||||
expecting the first character of the first word of a command,
|
||||
then the hash character and the characters that follow it, up
|
||||
through the next newline, are treated as a comment and ignored.
|
||||
The comment character only has significance when it appears
|
||||
at the beginning of a command.
|
||||
.IP "[11] \fBOrder of substitution.\fR"
|
||||
Each character is processed exactly once by the Tcl interpreter
|
||||
as part of creating the words of a command.
|
||||
For example, if variable substitution occurs then no further
|
||||
substitutions are performed on the value of the variable; the
|
||||
value is inserted into the word verbatim.
|
||||
If command substitution occurs then the nested command is
|
||||
processed entirely by the recursive call to the Tcl interpreter;
|
||||
no substitutions are performed before making the recursive
|
||||
call and no additional substitutions are performed on the result
|
||||
of the nested script.
|
||||
.RS
|
||||
.PP
|
||||
Substitutions take place from left to right, and each substitution is
|
||||
evaluated completely before attempting to evaluate the next. Thus, a
|
||||
sequence like
|
||||
.PP
|
||||
.CS
|
||||
set y [set x 0][incr x][incr x]
|
||||
.CE
|
||||
.PP
|
||||
will always set the variable \fIy\fR to the value, \fI012\fR.
|
||||
.RE
|
||||
.IP "[12] \fBSubstitution and word boundaries.\fR"
|
||||
Substitutions do not affect the word boundaries of a command,
|
||||
except for argument expansion as specified in rule [5].
|
||||
For example, during variable substitution the entire value of
|
||||
the variable becomes part of a single word, even if the variable's
|
||||
value contains spaces.
|
||||
.
|
||||
.SH KEYWORDS
|
||||
backslash, command, comment, script, substitution, variable
|
||||
'\" Local Variables:
|
||||
|
||||
+3
-3
@@ -22,13 +22,13 @@ int
|
||||
int
|
||||
\fBTcl_UniCharToTitle\fR(\fIch\fR)
|
||||
.sp
|
||||
int
|
||||
size_t
|
||||
\fBTcl_UtfToUpper\fR(\fIstr\fR)
|
||||
.sp
|
||||
int
|
||||
size_t
|
||||
\fBTcl_UtfToLower\fR(\fIstr\fR)
|
||||
.sp
|
||||
int
|
||||
size_t
|
||||
\fBTcl_UtfToTitle\fR(\fIstr\fR)
|
||||
.SH ARGUMENTS
|
||||
.AS char *str in/out
|
||||
|
||||
@@ -15,16 +15,16 @@ Tcl_UniChar, Tcl_UniCharToUtf, Tcl_UtfToUniChar, Tcl_UtfToChar16, Tcl_UtfToWChar
|
||||
.sp
|
||||
typedef ... \fBTcl_UniChar\fR;
|
||||
.sp
|
||||
int
|
||||
size_t
|
||||
\fBTcl_UniCharToUtf\fR(\fIch, buf\fR)
|
||||
.sp
|
||||
int
|
||||
size_t
|
||||
\fBTcl_UtfToUniChar\fR(\fIsrc, chPtr\fR)
|
||||
.sp
|
||||
int
|
||||
size_t
|
||||
\fBTcl_UtfToChar16\fR(\fIsrc, uPtr\fR)
|
||||
.sp
|
||||
int
|
||||
size_t
|
||||
\fBTcl_UtfToWChar\fR(\fIsrc, wPtr\fR)
|
||||
.sp
|
||||
char *
|
||||
|
||||
+116
-37
@@ -150,6 +150,16 @@ the end of the data.
|
||||
|
||||
The default value is the empty string. The acceptable range is \ex01 -
|
||||
\ex7f. A value outside this range results in an error.
|
||||
.VS "TCL8.7 TIP656"
|
||||
.TP
|
||||
\fB\-profile\fR \fIprofile\fR
|
||||
.
|
||||
Specifies the encoding profile to be used on the channel. The encoding
|
||||
transforms in use for the channel's input and output will then be subject to the
|
||||
rules of that profile. Any failures will result in a channel error. See
|
||||
\fBPROFILES\fR in the \fBencoding(n)\fR documentation for details about encoding
|
||||
profiles.
|
||||
.VE "TCL8.7 TIP656"
|
||||
.TP
|
||||
\fB\-translation\fR \fItranslation\fR
|
||||
.TP
|
||||
@@ -216,50 +226,119 @@ typically used on UNIX platforms,
|
||||
.TP
|
||||
\fBchan copy \fIinputChan outputChan\fR ?\fB\-size \fIsize\fR? ?\fB\-command \fIcallback\fR?
|
||||
.
|
||||
Copies data from \fIinputChan\fR to \fIoutputChan\fR, leveraging internal
|
||||
buffers to avoid extra copies and to avoid buffering too much data in main
|
||||
memory when copying large files to slow destinations like network sockets.
|
||||
Reads characters from \fIinputChan\fR and writes them to \fIoutputChan\fR until
|
||||
all characters are copied, blocking until the copy is complete and returning
|
||||
the number of characters copied. Leverages internal buffers to avoid extra
|
||||
copies and to avoid buffering too much data in main memory when copying large
|
||||
files to slow destinations like network sockets.
|
||||
.RS
|
||||
.PP
|
||||
If \fB\-size\fR is given, the size is in bytes if the two channels have the
|
||||
same encoding and in characters otherwise, and only that amount is copied.
|
||||
Otherwise, all data until the end of the file is copied.
|
||||
|
||||
\fBchan copy\fR blocks until the copy is complete and returns the number of
|
||||
bytes or characters written to \fIoutputChan\fR.
|
||||
\fB\-size\fR limits the number of characters copied.
|
||||
.PP
|
||||
If \fB\-command\fR is given, \fBchan copy\fR returns immediately, the copy is
|
||||
carried out in the background, and then \fIcallback\fR is called with the
|
||||
number of bytes written to \fIoutputChan\fR as its first argument, and the
|
||||
error message for any error that occurred as its second argument.
|
||||
\fIinputChan\fR and \fIoutputChan\fR are automatically configured for
|
||||
non-blocking mode if needed. Background copying only works correctly if the
|
||||
event loop is active, e.g. via \fBvwait\fR or Tk.
|
||||
If \fB\-command\fR is gviven, \fBchan copy\fR returns immediately, works in the
|
||||
background, and calls \fIcallback\fR when the copy completes, providing as an
|
||||
additional argument the number of characters written to \fIoutputChan\fR. If
|
||||
an error occurres during the background copy, another argument provides message
|
||||
for the error. \fIinputChan\fR and \fIoutputChan\fR are automatically
|
||||
configured for non-blocking mode if needed. Background copying only works
|
||||
correctly if events are being processed, e.g. via \fBvwait\fR or Tk.
|
||||
.PP
|
||||
During a background copy no other read or write operation may be performed on
|
||||
\fIinputChan\fR or \fIoutputChan\fR. If either \fIinputChan\fR or
|
||||
\fIoutputChan\fR is closed while the copy is in progress copying ceases and
|
||||
\fBno\fR callback is made. If \fIinputChan\fR is closed all data already queued
|
||||
is written to \fIoutputChan\fR.
|
||||
During a background copy no other read operation may be performed on
|
||||
\fIinputChan\fR, and no write operation may be performed on
|
||||
\fIoutputChan\fR. However, write operations may by performed on
|
||||
\fIinputChan\fR and read operations may be performed on \fIoutputChan\fR, as
|
||||
exhibited by the bidirectional copy example below.
|
||||
.PP
|
||||
The should be no event handler established for \fIinputChan\fR because it may
|
||||
become readable during a background copy. An attempt to read or write
|
||||
from within an event handler results result in the error, "channel busy".
|
||||
If either \fIinputChan\fR or \fIoutputChan\fR is closed while the copy is in
|
||||
progress, copying ceases and \fBno\fR callback is made. If \fIinputChan\fR is
|
||||
closed all data already queued is written to \fIoutputChan\fR.
|
||||
.PP
|
||||
Due to end-of-line translation the number of bytes read from \fIinputChan\fR
|
||||
may be different than the number of bytes written to \fIoutputChan\fR. Only
|
||||
the number of bytes written to \fIoutputChan\fR is reported.
|
||||
There should be no event handler established for \fIinputChan\fR because it
|
||||
may become readable during a background copy. An attempt to read or write from
|
||||
within an event handler results result in the error, "channel busy". Any
|
||||
wrong-sided I/O attempted (by a \fBfileevent\fR handler or otherwise) results
|
||||
in a
|
||||
.QW "channel busy"
|
||||
error.
|
||||
.PP
|
||||
\fBChan copy\fR reads the data according to the \fB\-encoding\fR,
|
||||
\fB\-translation\fR, and \fB\-eofchar\fR of the source and writes to the
|
||||
destination according to the configuration for that channel. If the encoding
|
||||
and translation of both channels is \fBbinary\fR and the \fB\-eofchar\fR of
|
||||
both channels is the empty string, an identical copy is made. If only the
|
||||
encoding of the destination is \fBbinary\fR, Tcl's internal modified UTF-8
|
||||
representation of the characters read from the source is written to the
|
||||
destination. If only the encoding of the source is \fBbinary\fR, each byte read
|
||||
becomes one Unicode character in the range of 0 to 255, and that character is
|
||||
subject to the encoding and translation of the destination as it is written.
|
||||
.PP
|
||||
.IP \fBEXAMPLES\fR
|
||||
.PP
|
||||
The first example transfers the contents of one channel exactly to
|
||||
another. Note that when copying one file to another, it is better to
|
||||
use \fBfile copy\fR which also copies file metadata (e.g. the file
|
||||
access permissions) where possible.
|
||||
.PP
|
||||
.CS
|
||||
fconfigure $in -translation binary
|
||||
fconfigure $out -translation binary
|
||||
\fBfcopy\fR $in $out
|
||||
.CE
|
||||
.PP
|
||||
This second example shows how the callback gets
|
||||
passed the number of bytes transferred.
|
||||
It also uses vwait to put the application into the event loop.
|
||||
Of course, this simplified example could be done without the command
|
||||
callback.
|
||||
.PP
|
||||
.CS
|
||||
proc Cleanup {in out bytes {error {}}} {
|
||||
global total
|
||||
set total $bytes
|
||||
close $in
|
||||
close $out
|
||||
if {[string length $error] != 0} {
|
||||
# error occurred during the copy
|
||||
}
|
||||
}
|
||||
set in [open $file1]
|
||||
set out [socket $server $port]
|
||||
\fBfcopy\fR $in $out -command [list Cleanup $in $out]
|
||||
vwait total
|
||||
.CE
|
||||
.PP
|
||||
The third example copies in chunks and tests for end of file
|
||||
in the command callback.
|
||||
.PP
|
||||
.CS
|
||||
proc CopyMore {in out chunk bytes {error {}}} {
|
||||
global total done
|
||||
incr total $bytes
|
||||
if {([string length $error] != 0) || [eof $in]} {
|
||||
set done $total
|
||||
close $in
|
||||
close $out
|
||||
} else {
|
||||
\fBfcopy\fR $in $out -size $chunk \e
|
||||
-command [list CopyMore $in $out $chunk]
|
||||
}
|
||||
}
|
||||
set in [open $file1]
|
||||
set out [socket $server $port]
|
||||
set chunk 1024
|
||||
set total 0
|
||||
\fBfcopy\fR $in $out -size $chunk \e
|
||||
-command [list CopyMore $in $out $chunk]
|
||||
vwait done
|
||||
.CE
|
||||
.PP
|
||||
The fourth example starts an asynchronous, bidirectional fcopy between
|
||||
two sockets. Those could also be pipes from two [open "|hal 9000" r+]
|
||||
(though their conversation would remain secret to the script, since
|
||||
all four fileevent slots are busy).
|
||||
.PP
|
||||
.CS
|
||||
set flows 2
|
||||
proc Done {dir args} {
|
||||
global flows done
|
||||
puts "$dir is over."
|
||||
incr flows -1
|
||||
if {$flows<=0} {set done 1}
|
||||
}
|
||||
\fBfcopy\fR $sok1 $sok2 -command [list Done UP]
|
||||
\fBfcopy\fR $sok2 $sok1 -command [list Done DOWN]
|
||||
vwait done
|
||||
.CE
|
||||
.RE
|
||||
.TP
|
||||
\fBchan create \fImode cmdPrefix\fR
|
||||
|
||||
+146
-110
@@ -8,160 +8,196 @@
|
||||
.so man.macros
|
||||
.BS
|
||||
.SH NAME
|
||||
encoding \- Manipulate encodings
|
||||
encoding \- Work with encodings
|
||||
.SH SYNOPSIS
|
||||
\fBencoding \fIoption\fR ?\fIarg arg ...\fR?
|
||||
\fBencoding \fIoperation\fR ?\fIarg arg ...\fR?
|
||||
.BE
|
||||
.SH INTRODUCTION
|
||||
.PP
|
||||
Strings in Tcl are logically a sequence of Unicode characters.
|
||||
These strings are represented in memory as a sequence of bytes that
|
||||
may be in one of several encodings: modified UTF\-8 (which uses 1 to 4
|
||||
bytes per character), or a custom encoding start as 8 bit binary data.
|
||||
In Tcl every string is composed of Unicode values. Text may be encoded into an
|
||||
encoding such as cp1252, iso8859-1, Shitf\-JIS, utf-8, utf-16, etc. Not every
|
||||
Unicode vealue is encodable in every encoding, and some encodings can encode
|
||||
values that are not available in Unicode.
|
||||
.PP
|
||||
Different operating system interfaces or applications may generate
|
||||
strings in other encodings such as Shift\-JIS. The \fBencoding\fR
|
||||
command helps to bridge the gap between Unicode and these other
|
||||
formats.
|
||||
Even though Unicode is for encoding the written texts of human languages, any
|
||||
sequence of bytes can be encoded as the first 255 Unicode values. iso8859-1 an
|
||||
encoding for a subset of Unicode in which each byte is a Unicode value of 255
|
||||
or less. Thus, any sequence of bytes can be considered to be a Unicode string
|
||||
encoded in iso8859-1. To work with binary data in Tcl, decode it from
|
||||
iso8859-1 when reading it in, and encode it into iso8859-1 when writing it out,
|
||||
ensuring that each character in the string has a value of 255 or less.
|
||||
Decoding such a string does nothing, and encoding encoding such a string also
|
||||
does nothing.
|
||||
.PP
|
||||
For example, the following is true:
|
||||
.CS
|
||||
set text {In Tcl binary data is treated as Unicode text and it just works.}
|
||||
set encoded [encoding convertto iso8859-1 $text]
|
||||
expr {$text eq $encoded}; #-> 1
|
||||
.CE
|
||||
The following is also true:
|
||||
.CS
|
||||
set decoded [encoding convertfrom iso8859-1 $text]
|
||||
expr {$text eq $decoded}; #-> 1
|
||||
.CE
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
Performs one of several encoding related operations, depending on
|
||||
\fIoption\fR. The legal \fIoption\fRs are:
|
||||
Performs one of the following encoding \fIoperations\fR:
|
||||
.TP
|
||||
\fBencoding convertfrom\fR ?\fB-nocomplain\fR? ?\fB-failindex var\fR? ?\fB-strict\fR? ?\fIencoding\fR? \fIdata\fR
|
||||
.
|
||||
Convert \fIdata\fR to a Unicode string from the specified \fIencoding\fR. The
|
||||
characters in \fIdata\fR are 8 bit binary data. The resulting
|
||||
sequence of bytes is a string created by applying the given \fIencoding\fR
|
||||
to the data. If \fIencoding\fR is not specified, the current
|
||||
system encoding is used.
|
||||
.VS "TCL8.7 TIP346, TIP607, TIP601"
|
||||
.PP
|
||||
.RS
|
||||
If the option \fB-nocomplain\fR is given, the command does not fail on
|
||||
encoding errors. Instead, any not convertable bytes (like incomplete UTF-8
|
||||
sequences, see example below) are put as byte values into the output stream.
|
||||
If the option \fB-nocomplain\fR is not given, the command will fail with an
|
||||
appropriate error message.
|
||||
.PP
|
||||
If the option \fB-failindex\fR with a variable name is given, the error reporting
|
||||
is changed in the following manner:
|
||||
in case of a conversion error, the position of the input byte causing the error
|
||||
is returned in the given variable. The return value of the command are the
|
||||
converted characters until the first error position. No error condition is raised.
|
||||
In case of no error, the value \fI-1\fR is written to the variable. This option
|
||||
may not be used together with \fB-nocomplain\fR.
|
||||
.PP
|
||||
The \fB-strict\fR option followes more strict rules in conversion. Currently, only
|
||||
the sequence \fB\\xC0\\x80\fR in \fButf-8\fR encoding is disallowed. Additional rules
|
||||
may follow.
|
||||
.VE "TCL8.7 TIP346, TIP607, TIP601"
|
||||
.RE
|
||||
\fBencoding convertfrom\fR ?\fIencoding\fR? \fIdata\fR
|
||||
.TP
|
||||
\fBencoding convertto\fR ?\fB-nocomplain\fR? ?\fB-failindex var\fR? ?\fB-strict\fR? ?\fIencoding\fR? \fIstring\fR
|
||||
\fBencoding convertfrom\fR ?\fB-profile \fIprofile\fR? ?\fB-failindex var\fR? \fIencoding\fR \fIdata\fR
|
||||
.
|
||||
Convert \fIstring\fR from Unicode to the specified \fIencoding\fR.
|
||||
The result is a sequence of bytes that represents the converted
|
||||
string. Each byte is stored in the lower 8-bits of a Unicode
|
||||
character (indeed, the resulting string is a binary string as far as
|
||||
Tcl is concerned, at least initially). If \fIencoding\fR is not
|
||||
specified, the current system encoding is used.
|
||||
.VS "TCL8.7 TIP346, TIP607, TIP601"
|
||||
.PP
|
||||
.RS
|
||||
If the option \fB-nocomplain\fR is given, the command does not fail on
|
||||
encoding errors. Instead, the replacement character \fB?\fR is output
|
||||
for any not representable character (like the dot \fB\\U2022\fR
|
||||
in \fBiso-8859-1\fR encoding, see example below).
|
||||
If the option \fB-nocomplain\fR is not given, the command will fail with an
|
||||
appropriate error message.
|
||||
.PP
|
||||
If the option \fB-failindex\fR with a variable name is given, the error reporting
|
||||
is changed in the following manner:
|
||||
in case of a conversion error, the position of the input character causing the error
|
||||
is returned in the given variable. The return value of the command are the
|
||||
converted bytes until the first error position. No error condition is raised.
|
||||
In case of no error, the value \fI-1\fR is written to the variable. This option
|
||||
may not be used together with \fB-nocomplain\fR.
|
||||
.PP
|
||||
The \fB-strict\fR option followes more strict rules in conversion. Currently, it has
|
||||
no effect but may be used in future to add additional encoding checks.
|
||||
.VE "TCL8.7 TIP346, TIP607, TIP601"
|
||||
.RE
|
||||
Decodes \fIdata\fR encoded in \fIencoding\fR. If \fIencoding\fR is not
|
||||
specified the current system encoding is used.
|
||||
|
||||
.VS "TCL8.7 TIP607, TIP656"
|
||||
\fB-profile\fR determines how invalid data for the encoding are handled. See
|
||||
the \fBPROFILES\fR section below for details. Returns an error if decoding
|
||||
fails. However, if \fB-failindex\fR given, returns the result of the
|
||||
conversion up to the point of termination, and stores in \fBvar\fR the index of
|
||||
the character that could not be converted. If no errors are encountered the
|
||||
entire result of the conversion is returned and the value \fB-1\fR is stored in
|
||||
\fBvar\fR.
|
||||
.VE "TCL8.7 TIP607, TIP656"
|
||||
.TP
|
||||
\fBencoding convertto\fR ?\fIencoding\fR? \fIdata\fR
|
||||
.TP
|
||||
\fBencoding convertto\fR ?\fB-profile \fIprofile\fR? ?\fB-failindex var\fR? \fIencoding\fR \fIdata\fR
|
||||
.
|
||||
Converts \fIstring\fR to \fIencoding\fR. If \fIencoding\fR is not given, the
|
||||
current system encoding is used.
|
||||
|
||||
.VS "TCL8.7 TIP607, TIP656"
|
||||
See \fBencoding convertfrom\fR for the meaning of \fB-profile\fR and \fB-failindex\fR.
|
||||
.VE "TCL8.7 TIP607, TIP656"
|
||||
.TP
|
||||
\fBencoding dirs\fR ?\fIdirectoryList\fR?
|
||||
.
|
||||
Tcl can load encoding data files from the file system that describe
|
||||
additional encodings for it to work with. This command sets the search
|
||||
path for \fB*.enc\fR encoding data files to the list of directories
|
||||
\fIdirectoryList\fR. If \fIdirectoryList\fR is omitted then the
|
||||
command returns the current list of directories that make up the
|
||||
search path. It is an error for \fIdirectoryList\fR to not be a valid
|
||||
list. If, when a search for an encoding data file is happening, an
|
||||
element in \fIdirectoryList\fR does not refer to a readable,
|
||||
searchable directory, that element is ignored.
|
||||
Sets the search path for \fB*.enc\fR encoding data files to the list of
|
||||
directories given by \fIdirectoryList\fR. If \fIdirectoryList\fR is not given,
|
||||
returns the current list of directories that make up the search path. It is
|
||||
not an error for an item in \fIdirectoryList\fR to not refer to a readable,
|
||||
searchable directory.
|
||||
.TP
|
||||
\fBencoding names\fR
|
||||
.
|
||||
Returns a list containing the names of all of the encodings that are
|
||||
currently available.
|
||||
Returns a list of the names of available encodings.
|
||||
The encodings
|
||||
.QW utf-8
|
||||
and
|
||||
.QW iso8859-1
|
||||
are guaranteed to be present in the list.
|
||||
.VS "TCL8.7 TIP656"
|
||||
.TP
|
||||
\fBencoding profiles\fR
|
||||
Returns a list of names of available encoding profiles. See \fBPROFILES\fR
|
||||
below.
|
||||
.VE "TCL8.7 TIP656"
|
||||
.TP
|
||||
\fBencoding system\fR ?\fIencoding\fR?
|
||||
.
|
||||
Set the system encoding to \fIencoding\fR. If \fIencoding\fR is
|
||||
omitted then the command returns the current system encoding. The
|
||||
system encoding is used whenever Tcl passes strings to system calls.
|
||||
.SH EXAMPLE
|
||||
Sets the system encoding to \fIencoding\fR. If \fIencoding\fR is not given,
|
||||
returns the current system encoding. The system encoding is used to pass
|
||||
strings to system calls.
|
||||
.\" Do not put .VS on whole section as that messes up the bullet list alignment
|
||||
.SH PROFILES
|
||||
.PP
|
||||
Example 1: convert a byte sequence in Japanese euc-jp encoding to a TCL string:
|
||||
.VS "TCL8.7 TIP656"
|
||||
Each \fIprofile\fR is a distinct strategy for dealing with invalid data for an
|
||||
encoding.
|
||||
.PP
|
||||
The following profiles are currently implemented.
|
||||
.VS "TCL8.7 TIP656"
|
||||
.TP
|
||||
\fBtcl8\fR
|
||||
.
|
||||
The default profile. Provides for behaviour identical to that of Tcl 8.6: When
|
||||
decoding, for encodings \fBother than utf-8\fR, each invalid byte is interpreted
|
||||
as the Unicode value given by that one byte. For example, the byte 0x80, which
|
||||
is invalid in the ASCII encoding would be mapped to the Unicode value U+0080.
|
||||
For \fButf-8\fR, each invalid byte that is a valid CP1252 character is
|
||||
interpreted as the Unicode value for that character, while each byte that is
|
||||
not is treated as the Unicode value given by that one byte. For example, byte
|
||||
0x80 is defined by CP1252 and is therefore mapped to its Unicode equivalent
|
||||
U+20AC while byte 0x81 which is not defined by CP1252 is mapped to U+0081. As
|
||||
an additional special case, the sequence 0xC0 0x80 is mapped to U+0000.
|
||||
|
||||
When encoding, each character that cannot be represented in the encoding is
|
||||
replaced by an encoding-dependent character, usually the question mark \fB?\fR.
|
||||
.TP
|
||||
\fBstrict\fR
|
||||
.
|
||||
The operation fails when invalid data for the encoding are encountered.
|
||||
.TP
|
||||
\fBreplace\fR
|
||||
.
|
||||
When decoding, invalid bytes are replaced by U+FFFD, the Unicode REPLACEMENT
|
||||
CHARACTER.
|
||||
|
||||
When encoding, Unicode values that cannot be represented in the target encoding
|
||||
are transformed to an encoding-specific fallback character, U+FFFD REPLACEMENT
|
||||
CHARACTER for UTF targets, and generally `?` for other encodings.
|
||||
.VE "TCL8.7 TIP656"
|
||||
.SH EXAMPLES
|
||||
.PP
|
||||
These examples use the utility proc below that prints the Unicode value for
|
||||
each character in a string.
|
||||
.PP
|
||||
.CS
|
||||
set s [\fBencoding convertfrom\fR euc-jp "\exA4\exCF"]
|
||||
proc codepoints s {join [lmap c [split $s {}] {
|
||||
string cat U+ [format %.6X [scan $c %c]]}]
|
||||
}
|
||||
.CE
|
||||
.PP
|
||||
The result is the unicode codepoint:
|
||||
Example 1: Convert from euc-jp:
|
||||
.PP
|
||||
.CS
|
||||
% codepoints [\fBencoding convertfrom\fR euc-jp \exA4\exCF]
|
||||
U+00306F
|
||||
.CE
|
||||
.PP
|
||||
The result is the Unicode value
|
||||
.QW "\eu306F" ,
|
||||
which is the Hiragana letter HA.
|
||||
.VS "TCL8.7 TIP346, TIP607, TIP601"
|
||||
.VS "TCL8.7 TIP607, TIP656"
|
||||
.PP
|
||||
Example 2: detect the error location in an incomplete UTF-8 sequence:
|
||||
Example 2: Error handling based on profiles:
|
||||
.PP
|
||||
The letter \fBA\fR is Unicode character U+0041 and the byte "\ex80" is invalid
|
||||
in ASCII encoding.
|
||||
.PP
|
||||
.CS
|
||||
% set s [\fBencoding convertfrom\fR -failindex i utf-8 "A\exC3"]
|
||||
A
|
||||
% set i
|
||||
1
|
||||
% codepoints [encoding convertfrom -profile tcl8 ascii A\ex80]
|
||||
U+000041 U+000080
|
||||
% codepoints [encoding convertfrom -profile replace ascii A\ex80]
|
||||
U+000041 U+00FFFD
|
||||
% codepoints [encoding convertfrom -profile strict ascii A\ex80]
|
||||
unexpected byte sequence starting at index 1: '\ex80'
|
||||
.CE
|
||||
.PP
|
||||
Example 3: return the incomplete UTF-8 sequence by raw bytes:
|
||||
Example 3: Get partial data and the error location:
|
||||
.PP
|
||||
.CS
|
||||
% set s [\fBencoding convertfrom\fR -nocomplain utf-8 "A\exC3"]
|
||||
.CE
|
||||
The result is "A" followed by the byte \exC3.
|
||||
.PP
|
||||
Example 4: detect the error location while transforming to ISO8859-1
|
||||
(ISO-Latin 1):
|
||||
.PP
|
||||
.CS
|
||||
% set s [\fBencoding convertto\fR -failindex i utf-8 "A\eu0141"]
|
||||
A
|
||||
% set i
|
||||
1
|
||||
% codepoints [encoding convertfrom -profile strict -failindex idx ascii AB\ex80]
|
||||
U+000041 U+000042
|
||||
% set idx
|
||||
2
|
||||
.CE
|
||||
.PP
|
||||
Example 5: replace a not representable character by the replacement character:
|
||||
Example 4: Encode a character that is not representable in ISO8859-1:
|
||||
.PP
|
||||
.CS
|
||||
% set s [\fBencoding convertto\fR -nocomplain utf-8 "A\eu0141"]
|
||||
% encoding convertto iso8859-1 A\eu0141
|
||||
A?
|
||||
% encoding convertto -profile strict iso8859-1 A\eu0141
|
||||
unexpected character at index 1: 'U+000141'
|
||||
% encoding convertto -profile strict -failindex idx iso8859-1 A\eu0141
|
||||
A
|
||||
% set idx
|
||||
1
|
||||
.CE
|
||||
.VE "TCL8.7 TIP346, TIP607, TIP601"
|
||||
.VE "TCL8.7 TIP607, TIP656"
|
||||
.PP
|
||||
.SH "SEE ALSO"
|
||||
Tcl_GetEncoding(3), fconfigure(n)
|
||||
|
||||
+9
-26
@@ -112,33 +112,16 @@ string.
|
||||
The acceptable range for \fB\-eofchar\fR values is \ex01 - \ex7F;
|
||||
attempting to set \fB\-eofchar\fR to a value outside of this range will
|
||||
generate an error.
|
||||
.VS "TCL9.0 TIP633"
|
||||
.VS "TCL8.7 TIP656"
|
||||
.TP
|
||||
\fB\-nocomplainencoding\fR \fIbool\fR
|
||||
\fB\-profile\fR \fIprofile\fR
|
||||
.
|
||||
Reporting mode of encoding errors.
|
||||
If set to a \fItrue\fR value, encoding errors are resolved by a replacement
|
||||
character (output) or verbatim bytes (input). No error is thrown.
|
||||
If set to a \fIfalse\fR value, errors are thrown in case of encoding errors.
|
||||
.RS
|
||||
.PP
|
||||
The default value is \fIfalse\fR starting from TCL 9.0 and \fItrue\fR on TCL 8.7.
|
||||
This option was introduced with TCL 8.7 and has the fix value \fItrue\fR.
|
||||
.PP
|
||||
See the \fI\-nocomplain\fR option of the \fBencoding\fR command for more information.
|
||||
.RE
|
||||
.VE "TCL9.0 TIP633"
|
||||
.VS "TCL8.7 TIP346"
|
||||
.TP
|
||||
\fB\-strictencoding\fR \fIbool\fR
|
||||
.
|
||||
Activate additional stricter encoding application rules.
|
||||
Default value is \fIfalse\fR.
|
||||
.RS
|
||||
.PP
|
||||
See the \fI\-strict\fR option of the \fBencoding\fR command for more information.
|
||||
.VE "TCL8.7 TIP346"
|
||||
.RE
|
||||
Specifies the encoding profile to be used on the channel. The encoding
|
||||
transforms in use for the channel's input and output will then be subject to the
|
||||
rules of that profile. Any failures will result in a channel error. See
|
||||
\fBPROFILES\fR in the \fBencoding(n)\fR documentation for details about encoding
|
||||
profiles.
|
||||
.VE "TCL8.7 TIP656"
|
||||
.TP
|
||||
\fB\-translation\fR \fImode\fR
|
||||
.TP
|
||||
@@ -299,7 +282,7 @@ close(n), encoding(n), flush(n), gets(n), open(n), puts(n), read(n), socket(n),
|
||||
Tcl_StandardChannels(3)
|
||||
.SH KEYWORDS
|
||||
blocking, buffering, carriage return, end of line, encoding, flushing, linemode,
|
||||
newline, nonblocking, platform, translation, encoding, filter, byte array,
|
||||
newline, nonblocking, platform, profile, translation, encoding, filter, byte array,
|
||||
binary
|
||||
'\" Local Variables:
|
||||
'\" mode: nroff
|
||||
|
||||
+29
-75
@@ -12,90 +12,44 @@
|
||||
.SH NAME
|
||||
fcopy \- Copy data from one channel to another
|
||||
.SH SYNOPSIS
|
||||
\fBfcopy \fIinchan\fR \fIoutchan\fR ?\fB\-size \fIsize\fR? ?\fB\-command \fIcallback\fR?
|
||||
\fBfcopy \fIinputChan\fR \fIoutputChan\fR ?\fB\-size \fIsize\fR? ?\fB\-command \fIcallback\fR?
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
The \fBfcopy\fR command copies data from one I/O channel, \fIinchan\fR to another I/O channel, \fIoutchan\fR.
|
||||
The \fBfcopy\fR command leverages the buffering in the Tcl I/O system to
|
||||
avoid extra copies and to avoid buffering too much data in
|
||||
main memory when copying large files to slow destinations like
|
||||
network sockets.
|
||||
Reads characters from \fIinputChan\fR and writes them to \fIoutputChan\fR until
|
||||
all characters are copied, blocking until the copy is complete and returning
|
||||
the number of characters copied. Leverages internal buffers to avoid extra
|
||||
copies and to avoid buffering too much data in main memory when copying large
|
||||
files to slow destinations like network sockets.
|
||||
.PP
|
||||
The \fBfcopy\fR
|
||||
command transfers data from \fIinchan\fR until end of file
|
||||
or \fIsize\fR bytes or characters have been
|
||||
transferred; \fIsize\fR is in bytes if the two channels are using the
|
||||
same encoding, and is in characters otherwise.
|
||||
If no \fB\-size\fR argument is given,
|
||||
then the copy goes until end of file.
|
||||
All the data read from \fIinchan\fR is copied to \fIoutchan\fR.
|
||||
Without the \fB\-command\fR option, \fBfcopy\fR blocks until the copy is complete
|
||||
and returns the number of bytes or characters (using the same rules as
|
||||
for the \fB\-size\fR option) written to \fIoutchan\fR.
|
||||
\fB\-size\fR limits the number of characters copied.
|
||||
.PP
|
||||
The \fB\-command\fR argument makes \fBfcopy\fR work in the background.
|
||||
In this case it returns immediately and the \fIcallback\fR is invoked
|
||||
later when the copy completes.
|
||||
The \fIcallback\fR is called with
|
||||
one or two additional
|
||||
arguments that indicates how many bytes were written to \fIoutchan\fR.
|
||||
If an error occurred during the background copy, the second argument is the
|
||||
error string associated with the error.
|
||||
With a background copy,
|
||||
it is not necessary to put \fIinchan\fR or \fIoutchan\fR into
|
||||
non-blocking mode; the \fBfcopy\fR command takes care of that automatically.
|
||||
However, it is necessary to enter the event loop by using
|
||||
the \fBvwait\fR command or by using Tk.
|
||||
\fB\-command\fR makes \fBfcopy\fR return immediately, work in the background,
|
||||
and call \fIcallback\fR when the copy completes, providing as an additional
|
||||
argument the number of characters written to \fIoutputChan\fR. If an error
|
||||
occurres during the background copy, another argument provides the message for
|
||||
the error. \fIinputChan\fR and \fIoutputChan\fR are automatically configured
|
||||
for non-blocking mode if needed. Background copying only works correctly if
|
||||
events are being processed e.g. via \fBvwait\fR or Tk.
|
||||
.PP
|
||||
You are not allowed to do other input operations with \fIinchan\fR, or
|
||||
output operations with \fIoutchan\fR, during a background
|
||||
\fBfcopy\fR. The converse is entirely legitimate, as exhibited by the
|
||||
bidirectional fcopy example below.
|
||||
During a background copy no other read operation may be performed on
|
||||
\fIinputChan\fR, and no other write operation may be performed on
|
||||
\fIoutputChan\fR. However, write operations may by performed on
|
||||
\fIinputChan\fR and read operations may be performed on \fIoutputChan\fR, as
|
||||
exhibited by the bidirectional copy example below.
|
||||
.PP
|
||||
If either \fIinchan\fR or \fIoutchan\fR get closed
|
||||
while the copy is in progress, the current copy is stopped
|
||||
and the command callback is \fInot\fR made.
|
||||
If \fIinchan\fR is closed,
|
||||
then all data already queued for \fIoutchan\fR is written out.
|
||||
If either \fIinputChan\fR or \fIoutputChan\fR is closed while the copy is in
|
||||
progress, copying ceases and \fBno\fR callback is made. If \fIinputChan\fR is
|
||||
closed all data already queued is written to \fIoutputChan\fR.
|
||||
.PP
|
||||
Note that \fIinchan\fR can become readable during a background copy.
|
||||
You should turn off any \fBfileevent\fR handlers during a background
|
||||
copy so those handlers do not interfere with the copy.
|
||||
Any wrong-sided I/O attempted (by a \fBfileevent\fR handler or otherwise) will get a
|
||||
There should be no event handler established for \fIinputChan\fR because it
|
||||
may become readable during a background copy. An attempt to read or write from
|
||||
within an event handler results result in the error, "channel busy". Any
|
||||
wrong-sided I/O attempted (by a \fBfileevent\fR handler or otherwise) results
|
||||
in a
|
||||
.QW "channel busy"
|
||||
error.
|
||||
.PP
|
||||
\fBFcopy\fR translates end-of-line sequences in \fIinchan\fR and \fIoutchan\fR
|
||||
according to the \fB\-translation\fR option
|
||||
for these channels.
|
||||
See the manual entry for \fBfconfigure\fR for details on the
|
||||
\fB\-translation\fR option.
|
||||
The translations mean that the number of bytes read from \fIinchan\fR
|
||||
can be different than the number of bytes written to \fIoutchan\fR.
|
||||
Only the number of bytes written to \fIoutchan\fR is reported,
|
||||
either as the return value of a synchronous \fBfcopy\fR or
|
||||
as the argument to the callback for an asynchronous \fBfcopy\fR.
|
||||
.PP
|
||||
\fBFcopy\fR obeys the encodings and character translations configured
|
||||
for the channels. This
|
||||
means that the incoming characters are converted internally first
|
||||
UTF-8 and then into the encoding of the channel \fBfcopy\fR writes
|
||||
to. See the manual entry for \fBfconfigure\fR for details on the
|
||||
\fB\-encoding\fR and \fB\-translation\fR options. No conversion is
|
||||
done if both channels are
|
||||
set to encoding
|
||||
.QW binary
|
||||
and have matching translations. If only the output channel is set to encoding
|
||||
.QW binary
|
||||
the system will write the internal UTF-8 representation of the incoming
|
||||
characters. If only the input channel is set to encoding
|
||||
.QW binary
|
||||
the system will assume that the incoming
|
||||
bytes are valid UTF-8 characters and convert them according to the
|
||||
output encoding. The behaviour of the system for bytes which are not
|
||||
valid UTF-8 characters is undefined in this case.
|
||||
.SH EXAMPLES
|
||||
.PP
|
||||
The first example transfers the contents of one channel exactly to
|
||||
@@ -144,7 +98,7 @@ proc CopyMore {in out chunk bytes {error {}}} {
|
||||
close $out
|
||||
} else {
|
||||
\fBfcopy\fR $in $out -size $chunk \e
|
||||
-command [list CopyMore $in $out $chunk]
|
||||
-command [list CopyMore $in $out $chunk]
|
||||
}
|
||||
}
|
||||
set in [open $file1]
|
||||
@@ -152,7 +106,7 @@ set out [socket $server $port]
|
||||
set chunk 1024
|
||||
set total 0
|
||||
\fBfcopy\fR $in $out -size $chunk \e
|
||||
-command [list CopyMore $in $out $chunk]
|
||||
-command [list CopyMore $in $out $chunk]
|
||||
vwait done
|
||||
.CE
|
||||
.PP
|
||||
|
||||
+2
-2
@@ -53,8 +53,8 @@ here, then the \fBfinalize\fR subcommand will not be called.
|
||||
.PP
|
||||
The \fImode\fR argument tells the handler whether the channel was
|
||||
opened for reading, writing, or both. It is a list containing any of
|
||||
the strings \fBread\fR or \fBwrite\fR. The list will always
|
||||
contain at least one element.
|
||||
the strings \fBread\fR or \fBwrite\fR. The list may be empty, but
|
||||
will usually contain at least one element.
|
||||
.PP
|
||||
The subcommand must throw an error if the chosen mode is not
|
||||
supported by the \fIcmdPrefix\fR.
|
||||
|
||||
+2
-2
@@ -2184,9 +2184,9 @@ stid(
|
||||
return "unable";
|
||||
}
|
||||
if (t->id != 0) {
|
||||
sprintf(buf, "%d", t->id);
|
||||
snprintf(buf, bufsize, "%d", t->id);
|
||||
} else {
|
||||
sprintf(buf, "%p", t);
|
||||
snprintf(buf, bufsize, "%p", t);
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
+3
-3
@@ -73,7 +73,7 @@ regerror(
|
||||
break;
|
||||
}
|
||||
}
|
||||
sprintf(convbuf, "%d", r->code); /* -1 for unknown */
|
||||
snprintf(convbuf, sizeof(convbuf), "%d", r->code); /* -1 for unknown */
|
||||
msg = convbuf;
|
||||
break;
|
||||
case REG_ITOA: /* Convert number to name */
|
||||
@@ -86,7 +86,7 @@ regerror(
|
||||
if (r->code >= 0) {
|
||||
msg = r->name;
|
||||
} else { /* Unknown; tell him the number */
|
||||
sprintf(convbuf, "REG_%u", icode);
|
||||
snprintf(convbuf, sizeof(convbuf), "REG_%u", icode);
|
||||
msg = convbuf;
|
||||
}
|
||||
break;
|
||||
@@ -99,7 +99,7 @@ regerror(
|
||||
if (r->code >= 0) {
|
||||
msg = r->explain;
|
||||
} else { /* Unknown; say so */
|
||||
sprintf(convbuf, unk, code);
|
||||
snprintf(convbuf, sizeof(convbuf), unk, code);
|
||||
msg = convbuf;
|
||||
}
|
||||
break;
|
||||
|
||||
+33
-13
@@ -1205,7 +1205,7 @@ declare 323 {
|
||||
int Tcl_UniCharToUpper(int ch)
|
||||
}
|
||||
declare 324 {
|
||||
int Tcl_UniCharToUtf(int ch, char *buf)
|
||||
Tcl_Size Tcl_UniCharToUtf(int ch, char *buf)
|
||||
}
|
||||
declare 325 {
|
||||
const char *TclUtfAtIndex(const char *src, Tcl_Size index)
|
||||
@@ -1239,16 +1239,16 @@ declare 333 {
|
||||
const char *src, Tcl_Size srcLen, Tcl_DString *dsPtr)
|
||||
}
|
||||
declare 334 {
|
||||
int Tcl_UtfToLower(char *src)
|
||||
Tcl_Size Tcl_UtfToLower(char *src)
|
||||
}
|
||||
declare 335 {
|
||||
int Tcl_UtfToTitle(char *src)
|
||||
Tcl_Size Tcl_UtfToTitle(char *src)
|
||||
}
|
||||
declare 336 {
|
||||
int Tcl_UtfToChar16(const char *src, unsigned short *chPtr)
|
||||
Tcl_Size Tcl_UtfToChar16(const char *src, unsigned short *chPtr)
|
||||
}
|
||||
declare 337 {
|
||||
int Tcl_UtfToUpper(char *src)
|
||||
Tcl_Size Tcl_UtfToUpper(char *src)
|
||||
}
|
||||
declare 338 {
|
||||
Tcl_Size Tcl_WriteChars(Tcl_Channel chan, const char *src, Tcl_Size srcLen)
|
||||
@@ -2454,7 +2454,7 @@ declare 645 {
|
||||
|
||||
# TIP #548
|
||||
declare 646 {
|
||||
int Tcl_UtfToUniChar(const char *src, int *chPtr)
|
||||
Tcl_Size Tcl_UtfToUniChar(const char *src, int *chPtr)
|
||||
}
|
||||
declare 647 {
|
||||
char *Tcl_UniCharToUtfDString(const int *uniStr,
|
||||
@@ -2500,13 +2500,17 @@ declare 656 {
|
||||
declare 657 {
|
||||
int Tcl_UniCharIsUnicode(int ch)
|
||||
}
|
||||
|
||||
# TIP 656
|
||||
declare 658 {
|
||||
Tcl_Size Tcl_ExternalToUtfDStringEx(Tcl_Encoding encoding,
|
||||
const char *src, Tcl_Size srcLen, int flags, Tcl_DString *dsPtr)
|
||||
int Tcl_ExternalToUtfDStringEx(Tcl_Interp *interp, Tcl_Encoding encoding,
|
||||
const char *src, Tcl_Size srcLen, int flags, Tcl_DString *dsPtr,
|
||||
Tcl_Size *errorLocationPtr)
|
||||
}
|
||||
declare 659 {
|
||||
Tcl_Size Tcl_UtfToExternalDStringEx(Tcl_Encoding encoding,
|
||||
const char *src, Tcl_Size srcLen, int flags, Tcl_DString *dsPtr)
|
||||
int Tcl_UtfToExternalDStringEx(Tcl_Interp *interp, Tcl_Encoding encoding,
|
||||
const char *src, Tcl_Size srcLen, int flags, Tcl_DString *dsPtr,
|
||||
Tcl_Size *errorLocationPtr)
|
||||
}
|
||||
|
||||
# TIP #511
|
||||
@@ -2608,10 +2612,25 @@ declare 682 {
|
||||
|
||||
# TIP 643
|
||||
declare 683 {
|
||||
int Tcl_GetEncodingNulLength(Tcl_Encoding encoding)
|
||||
Tcl_Size Tcl_GetEncodingNulLength(Tcl_Encoding encoding)
|
||||
}
|
||||
|
||||
# ----- BASELINE -- FOR -- 8.7.0 ----- #
|
||||
# TIP #650
|
||||
declare 684 {
|
||||
int Tcl_GetWideUIntFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr,
|
||||
Tcl_WideUInt *uwidePtr)
|
||||
}
|
||||
|
||||
# TIP 651
|
||||
declare 685 {
|
||||
Tcl_Obj *Tcl_DStringToObj(Tcl_DString *dsPtr)
|
||||
}
|
||||
|
||||
# ----- BASELINE -- FOR -- 8.7.0 / 9.0.0 ----- #
|
||||
|
||||
declare 687 {
|
||||
void TclUnusedStubEntry(void)
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
|
||||
@@ -2630,7 +2649,7 @@ interface tclPlat
|
||||
declare 1 {
|
||||
int Tcl_MacOSXOpenVersionedBundleResources(Tcl_Interp *interp,
|
||||
const char *bundleName, const char *bundleVersion,
|
||||
int hasResourceFile, size_t maxPathLen, char *libraryPath)
|
||||
int hasResourceFile, Tcl_Size maxPathLen, char *libraryPath)
|
||||
}
|
||||
declare 2 {
|
||||
void Tcl_MacOSXNotifierAddRunLoopMode(const void *runLoopMode)
|
||||
@@ -2685,6 +2704,7 @@ export {
|
||||
const char *TclZipfs_AppHook(int *argc, char ***argv)
|
||||
}
|
||||
|
||||
|
||||
# Local Variables:
|
||||
# mode: tcl
|
||||
# End:
|
||||
|
||||
+71
-49
@@ -311,10 +311,23 @@ typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt;
|
||||
#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;
|
||||
#define TCL_SIZE_ISNEG(index) ((index) < 0)
|
||||
#elif defined(TCL_SIGNED_SIZE) && !defined(BUILD_tcl)
|
||||
typedef ptrdiff_t Tcl_Size;
|
||||
#define TCL_SIZE_ISNEG(index) (((index) == TCL_INDEX_NONE) \
|
||||
|| ((sizeof(int) != sizeof(size_t)) && ((ptrdiff_t)(index) < 0) \
|
||||
&& (Tcl_Panic("Tcl_Size overflow %s:%d", __FILE__, __LINE__), 1)))
|
||||
#else
|
||||
typedef size_t Tcl_Size;
|
||||
#define TCL_SIZE_ISNEG(index) (((index) == TCL_INDEX_NONE) \
|
||||
|| ((sizeof(int) != sizeof(size_t)) && ((ptrdiff_t)(index) < 0) \
|
||||
&& (Tcl_Panic("Tcl_Size overflow %s:%d", __FILE__, __LINE__), 1)))
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
# if TCL_MAJOR_VERSION > 8
|
||||
typedef struct __stat64 Tcl_StatBuf;
|
||||
# elif defined(_WIN64) || defined(_USE_64BIT_TIME_T)
|
||||
# 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;
|
||||
@@ -323,26 +336,19 @@ typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt;
|
||||
# endif
|
||||
#elif defined(__CYGWIN__)
|
||||
typedef struct {
|
||||
dev_t st_dev;
|
||||
unsigned st_dev;
|
||||
unsigned short st_ino;
|
||||
unsigned short st_mode;
|
||||
short st_nlink;
|
||||
short st_uid;
|
||||
short st_gid;
|
||||
/* Here is a 2-byte gap */
|
||||
dev_t st_rdev;
|
||||
unsigned st_rdev;
|
||||
/* Here is a 4-byte gap */
|
||||
long long st_size;
|
||||
#if TCL_MAJOR_VERSION > 8
|
||||
struct {long long tv_sec;} st_atim;
|
||||
struct {long long tv_sec;} st_mtim;
|
||||
struct {long long tv_sec;} st_ctim;
|
||||
#else
|
||||
struct {long tv_sec;} st_atim;
|
||||
struct {long tv_sec;} st_mtim;
|
||||
struct {long tv_sec;} st_ctim;
|
||||
/* Here is a 4-byte gap */
|
||||
#endif
|
||||
} Tcl_StatBuf;
|
||||
#elif defined(HAVE_STRUCT_STAT64) && !defined(__APPLE__)
|
||||
typedef struct stat64 Tcl_StatBuf;
|
||||
@@ -455,17 +461,17 @@ typedef void (Tcl_ThreadCreateProc) (void *clientData);
|
||||
|
||||
#if TCL_MAJOR_VERSION > 8
|
||||
typedef struct Tcl_RegExpIndices {
|
||||
size_t start; /* Character offset of first character in
|
||||
Tcl_Size start; /* Character offset of first character in
|
||||
* match. */
|
||||
size_t end; /* Character offset of first character after
|
||||
Tcl_Size end; /* Character offset of first character after
|
||||
* the match. */
|
||||
} Tcl_RegExpIndices;
|
||||
|
||||
typedef struct Tcl_RegExpInfo {
|
||||
size_t nsubs; /* Number of subexpressions in the compiled
|
||||
Tcl_Size nsubs; /* Number of subexpressions in the compiled
|
||||
* expression. */
|
||||
Tcl_RegExpIndices *matches; /* Array of nsubs match offset pairs. */
|
||||
size_t extendStart; /* The offset at which a subsequent match
|
||||
Tcl_Size extendStart; /* The offset at which a subsequent match
|
||||
* might begin. */
|
||||
} Tcl_RegExpInfo;
|
||||
#else
|
||||
@@ -557,9 +563,15 @@ typedef void (Tcl_CmdTraceProc) (void *clientData, Tcl_Interp *interp,
|
||||
typedef int (Tcl_CmdObjTraceProc) (void *clientData, Tcl_Interp *interp,
|
||||
int level, const char *command, Tcl_Command commandInfo, int objc,
|
||||
struct Tcl_Obj *const *objv);
|
||||
#if defined(TCL_SIGNED_SIZE) && !defined(BUILD_tcl)
|
||||
typedef int (Tcl_CmdObjTraceProc2) (void *clientData, Tcl_Interp *interp,
|
||||
ptrdiff_t level, const char *command, Tcl_Command commandInfo, ptrdiff_t objc,
|
||||
struct Tcl_Obj *const *objv);
|
||||
#else
|
||||
typedef int (Tcl_CmdObjTraceProc2) (void *clientData, Tcl_Interp *interp,
|
||||
size_t level, const char *command, Tcl_Command commandInfo, size_t objc,
|
||||
struct Tcl_Obj *const *objv);
|
||||
#endif
|
||||
typedef void (Tcl_CmdObjTraceDeleteProc) (void *clientData);
|
||||
typedef void (Tcl_DupInternalRepProc) (struct Tcl_Obj *srcPtr,
|
||||
struct Tcl_Obj *dupPtr);
|
||||
@@ -582,8 +594,13 @@ typedef void (Tcl_InterpDeleteProc) (void *clientData,
|
||||
typedef void (Tcl_NamespaceDeleteProc) (void *clientData);
|
||||
typedef int (Tcl_ObjCmdProc) (void *clientData, Tcl_Interp *interp,
|
||||
int objc, struct Tcl_Obj *const *objv);
|
||||
#if defined(TCL_SIGNED_SIZE) && !defined(BUILD_tcl)
|
||||
typedef int (Tcl_ObjCmdProc2) (void *clientData, Tcl_Interp *interp,
|
||||
ptrdiff_t objc, struct Tcl_Obj *const *objv);
|
||||
#else
|
||||
typedef int (Tcl_ObjCmdProc2) (void *clientData, Tcl_Interp *interp,
|
||||
size_t objc, struct Tcl_Obj *const *objv);
|
||||
#endif
|
||||
typedef int (Tcl_LibraryInitProc) (Tcl_Interp *interp);
|
||||
typedef int (Tcl_LibraryUnloadProc) (Tcl_Interp *interp, int flags);
|
||||
typedef void (Tcl_PanicProc) (const char *format, ...);
|
||||
@@ -668,12 +685,6 @@ typedef union Tcl_ObjInternalRep { /* The internal representation: */
|
||||
* An object stores a value as either a string, some internal representation,
|
||||
* or both.
|
||||
*/
|
||||
#if TCL_MAJOR_VERSION > 8
|
||||
typedef size_t Tcl_Size;
|
||||
#else
|
||||
typedef int Tcl_Size;
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct Tcl_Obj {
|
||||
Tcl_Size refCount; /* When 0 the object will be freed. */
|
||||
@@ -688,7 +699,7 @@ typedef struct Tcl_Obj {
|
||||
* should use Tcl_GetStringFromObj or
|
||||
* Tcl_GetString to get a pointer to the byte
|
||||
* array as a readonly value. */
|
||||
Tcl_Size length; /* The number of bytes at *bytes, not
|
||||
Tcl_Size length; /* The number of bytes at *bytes, not
|
||||
* including the terminating null. */
|
||||
const Tcl_ObjType *typePtr; /* Denotes the object's type. Always
|
||||
* corresponds to the type of the object's
|
||||
@@ -1909,11 +1920,11 @@ typedef struct Tcl_EncodingType {
|
||||
* encoding is deleted. */
|
||||
void *clientData; /* Arbitrary value associated with encoding
|
||||
* type. Passed to conversion functions. */
|
||||
int nullSize; /* Number of zero bytes that signify
|
||||
Tcl_Size nullSize; /* Number of zero bytes that signify
|
||||
* end-of-string in this encoding. This number
|
||||
* is used to determine the source string
|
||||
* length when the srcLen argument is
|
||||
* negative. Must be 1 or 2. */
|
||||
* negative. Must be 1, 2, or 4. */
|
||||
} Tcl_EncodingType;
|
||||
|
||||
/*
|
||||
@@ -1953,33 +1964,35 @@ typedef struct Tcl_EncodingType {
|
||||
* content. Otherwise, the number of chars
|
||||
* produced is controlled only by other limiting
|
||||
* factors.
|
||||
* TCL_ENCODING_MODIFIED - Convert NULL bytes to \xC0\x80 in stead of
|
||||
* 0x00. Only valid for "utf-8" and "cesu-8".
|
||||
* This flag is implicit for external -> internal conversions,
|
||||
* optional for internal -> external conversions.
|
||||
* TCL_ENCODING_NOCOMPLAIN - If set, the converter
|
||||
* substitutes the problematic character(s) with
|
||||
* one or more "close" characters in the
|
||||
* destination buffer and then continues to
|
||||
* convert the source. If clear, the converter returns
|
||||
* immediately upon encountering an invalid byte sequence
|
||||
* or a source character that has no mapping in the
|
||||
* target encoding. Only for Tcl 9.x.
|
||||
* TCL_ENCODING_PROFILE_* - Mutually exclusive encoding profile ids. Note
|
||||
* these are bit masks.
|
||||
*
|
||||
* NOTE: THESE BIT DEFINITIONS SHOULD NOT OVERLAP WITH INTERNAL USE BITS
|
||||
* DEFINED IN tclEncoding.c (ENCODING_INPUT et al). Be cognizant of this
|
||||
* when adding bits.
|
||||
*/
|
||||
|
||||
#define TCL_ENCODING_START 0x01
|
||||
#define TCL_ENCODING_END 0x02
|
||||
#if TCL_MAJOR_VERSION > 8
|
||||
# define TCL_ENCODING_STRICT 0x04
|
||||
# define TCL_ENCODING_STOPONERROR 0x0 /* Not used any more */
|
||||
#else
|
||||
# define TCL_ENCODING_STRICT 0x44
|
||||
# define TCL_ENCODING_STOPONERROR 0x04
|
||||
#endif
|
||||
#define TCL_ENCODING_NO_TERMINATE 0x08
|
||||
#define TCL_ENCODING_CHAR_LIMIT 0x10
|
||||
#define TCL_ENCODING_MODIFIED 0x20
|
||||
#define TCL_ENCODING_NOCOMPLAIN 0x40
|
||||
/* 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) */
|
||||
#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
|
||||
|
||||
/*
|
||||
* The following definitions are the error codes returned by the conversion
|
||||
@@ -2000,13 +2013,10 @@ typedef struct Tcl_EncodingType {
|
||||
* TCL_CONVERT_SYNTAX - The source stream contained an invalid
|
||||
* character sequence. This may occur if the
|
||||
* input stream has been damaged or if the input
|
||||
* encoding method was misidentified. This error
|
||||
* is reported unless if TCL_ENCODING_NOCOMPLAIN
|
||||
* was specified.
|
||||
* encoding method was misidentified.
|
||||
* TCL_CONVERT_UNKNOWN - The source string contained a character that
|
||||
* could not be represented in the target
|
||||
* encoding. This error is reported unless if
|
||||
* TCL_ENCODING_NOCOMPLAIN was specified.
|
||||
* encoding.
|
||||
*/
|
||||
|
||||
#define TCL_CONVERT_MULTIBYTE (-1)
|
||||
@@ -2259,10 +2269,17 @@ void * TclStubCall(void *arg);
|
||||
|
||||
#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
|
||||
# define Tcl_InitStubs(interp, version, exact) \
|
||||
(Tcl_InitStubs)(interp, version, \
|
||||
@@ -2323,9 +2340,14 @@ EXTERN const char *TclZipfs_AppHook(int *argc, char ***argv);
|
||||
# define Tcl_FindExecutable(arg) ((Tcl_FindExecutable)((const char *)(arg)))
|
||||
#endif
|
||||
# define Tcl_MainEx Tcl_MainExW
|
||||
#if defined(TCL_SIGNED_SIZE) && !defined(BUILD_tcl)
|
||||
EXTERN TCL_NORETURN void Tcl_MainExW(ptrdiff_t argc, wchar_t **argv,
|
||||
Tcl_AppInitProc *appInitProc, Tcl_Interp *interp);
|
||||
#else
|
||||
EXTERN TCL_NORETURN void Tcl_MainExW(size_t argc, wchar_t **argv,
|
||||
Tcl_AppInitProc *appInitProc, Tcl_Interp *interp);
|
||||
#endif
|
||||
#endif
|
||||
#if defined(USE_TCL_STUBS) && (TCL_MAJOR_VERSION > 8)
|
||||
#define Tcl_SetPanicProc(panicProc) \
|
||||
TclInitStubTable(((const char *(*)(Tcl_PanicProc *))TclStubCall((void *)panicProc))(panicProc))
|
||||
@@ -2386,9 +2408,9 @@ EXTERN const char *TclZipfs_AppHook(int *argc, char ***argv);
|
||||
# define attemptckalloc Tcl_AttemptAlloc
|
||||
# ifdef _MSC_VER
|
||||
/* Silence invalid C4090 warnings */
|
||||
# define ckfree(a) Tcl_Free((char *)(a))
|
||||
# define ckrealloc(a,b) Tcl_Realloc((char *)(a),(b))
|
||||
# define attemptckrealloc(a,b) Tcl_AttemptRealloc((char *)(a),(b))
|
||||
# define ckfree(a) Tcl_Free((void *)(a))
|
||||
# define ckrealloc(a,b) Tcl_Realloc((void *)(a),(b))
|
||||
# define attemptckrealloc(a,b) Tcl_AttemptRealloc((void *)(a),(b))
|
||||
# else
|
||||
# define ckfree Tcl_Free
|
||||
# define ckrealloc Tcl_Realloc
|
||||
|
||||
+2
-2
@@ -251,7 +251,7 @@ TclFinalizeAllocSubsystem(void)
|
||||
|
||||
void *
|
||||
TclpAlloc(
|
||||
size_t numBytes) /* Number of bytes to allocate. */
|
||||
TCL_HASH_TYPE numBytes) /* Number of bytes to allocate. */
|
||||
{
|
||||
union overhead *overPtr;
|
||||
size_t bucket;
|
||||
@@ -694,7 +694,7 @@ mstats(
|
||||
#undef TclpAlloc
|
||||
void *
|
||||
TclpAlloc(
|
||||
size_t numBytes) /* Number of bytes to allocate. */
|
||||
TCL_HASH_TYPE numBytes) /* Number of bytes to allocate. */
|
||||
{
|
||||
return malloc(numBytes);
|
||||
}
|
||||
|
||||
+138
-132
@@ -29,7 +29,7 @@
|
||||
#define ArithSeriesGetInternalRep(objPtr, arithRepPtr) \
|
||||
do { \
|
||||
const Tcl_ObjInternalRep *irPtr; \
|
||||
irPtr = TclFetchInternalRep((objPtr), &tclArithSeriesType); \
|
||||
irPtr = TclFetchInternalRep((objPtr), &tclArithSeriesType.objType); \
|
||||
(arithRepPtr) = irPtr ? (ArithSeries *)irPtr->twoPtrValue.ptr1 : NULL; \
|
||||
} while (0)
|
||||
|
||||
@@ -41,7 +41,9 @@
|
||||
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 *listPtr);
|
||||
static void UpdateStringOfArithSeries (Tcl_Obj *arithSeriesObj);
|
||||
static Tcl_Obj *ArithSeriesObjStep(Tcl_Obj *arithSeriesPtr);
|
||||
static size_t ArithSeriesObjLength(Tcl_Obj *arithSeriesPtr);
|
||||
|
||||
/*
|
||||
* The structure below defines the arithmetic series Tcl object type by
|
||||
@@ -64,19 +66,21 @@ static void UpdateStringOfArithSeries (Tcl_Obj *listPtr);
|
||||
* And where the equivalent's list I-th element is calculated
|
||||
* as:
|
||||
*
|
||||
* LIST[i] = START+(STEP*i)
|
||||
* LIST[i] = START + (STEP * i)
|
||||
*
|
||||
* Zero elements ranges, like in the case of START=10 END=10 STEP=1
|
||||
* are valid and will be equivalent to the empty list.
|
||||
*/
|
||||
|
||||
const Tcl_ObjType tclArithSeriesType = {
|
||||
"arithseries", /* name */
|
||||
const TclObjTypeWithAbstractList tclArithSeriesType = {
|
||||
{"arithseries", /* name */
|
||||
FreeArithSeriesInternalRep, /* freeIntRepProc */
|
||||
DupArithSeriesInternalRep, /* dupIntRepProc */
|
||||
UpdateStringOfArithSeries, /* updateStringProc */
|
||||
SetArithSeriesFromAny, /* setFromAnyProc */
|
||||
TCL_OBJTYPE_V0
|
||||
TCL_OBJTYPE_V0_1(
|
||||
ArithSeriesObjLength
|
||||
)}
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -117,7 +121,7 @@ ArithSeriesLen(Tcl_WideInt start, Tcl_WideInt end, Tcl_WideInt step)
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* TclNewArithSeriesInt --
|
||||
* NewArithSeriesInt --
|
||||
*
|
||||
* Creates a new ArithSeries object. The returned object has
|
||||
* refcount = 0.
|
||||
@@ -132,17 +136,18 @@ ArithSeriesLen(Tcl_WideInt start, Tcl_WideInt end, Tcl_WideInt step)
|
||||
* None.
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
static
|
||||
Tcl_Obj *
|
||||
TclNewArithSeriesInt(Tcl_WideInt start, Tcl_WideInt end, Tcl_WideInt step, Tcl_WideInt len)
|
||||
NewArithSeriesInt(Tcl_WideInt start, Tcl_WideInt end, Tcl_WideInt step, Tcl_WideInt len)
|
||||
{
|
||||
Tcl_WideInt length = (len>=0 ? len : ArithSeriesLen(start, end, step));
|
||||
Tcl_Obj *arithSeriesPtr;
|
||||
Tcl_Obj *arithSeriesObj;
|
||||
ArithSeries *arithSeriesRepPtr;
|
||||
|
||||
TclNewObj(arithSeriesPtr);
|
||||
TclNewObj(arithSeriesObj);
|
||||
|
||||
if (length <= 0) {
|
||||
return arithSeriesPtr;
|
||||
return arithSeriesObj;
|
||||
}
|
||||
|
||||
arithSeriesRepPtr = (ArithSeries*) Tcl_Alloc(sizeof (ArithSeries));
|
||||
@@ -152,19 +157,19 @@ TclNewArithSeriesInt(Tcl_WideInt start, Tcl_WideInt end, Tcl_WideInt step, Tcl_W
|
||||
arithSeriesRepPtr->step = step;
|
||||
arithSeriesRepPtr->len = length;
|
||||
arithSeriesRepPtr->elements = NULL;
|
||||
arithSeriesPtr->internalRep.twoPtrValue.ptr1 = arithSeriesRepPtr;
|
||||
arithSeriesPtr->internalRep.twoPtrValue.ptr2 = NULL;
|
||||
arithSeriesPtr->typePtr = &tclArithSeriesType;
|
||||
arithSeriesObj->internalRep.twoPtrValue.ptr1 = arithSeriesRepPtr;
|
||||
arithSeriesObj->internalRep.twoPtrValue.ptr2 = NULL;
|
||||
arithSeriesObj->typePtr = &tclArithSeriesType.objType;
|
||||
if (length > 0)
|
||||
Tcl_InvalidateStringRep(arithSeriesPtr);
|
||||
Tcl_InvalidateStringRep(arithSeriesObj);
|
||||
|
||||
return arithSeriesPtr;
|
||||
return arithSeriesObj;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* TclNewArithSeriesDbl --
|
||||
* NewArithSeriesDbl --
|
||||
*
|
||||
* Creates a new ArithSeries object with doubles. The returned object has
|
||||
* refcount = 0.
|
||||
@@ -179,17 +184,18 @@ TclNewArithSeriesInt(Tcl_WideInt start, Tcl_WideInt end, Tcl_WideInt step, Tcl_W
|
||||
* None.
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
static
|
||||
Tcl_Obj *
|
||||
TclNewArithSeriesDbl(double start, double end, double step, Tcl_WideInt len)
|
||||
NewArithSeriesDbl(double start, double end, double step, Tcl_WideInt len)
|
||||
{
|
||||
Tcl_WideInt length = (len>=0 ? len : ArithSeriesLen(start, end, step));
|
||||
Tcl_Obj *arithSeriesPtr;
|
||||
Tcl_Obj *arithSeriesObj;
|
||||
ArithSeriesDbl *arithSeriesRepPtr;
|
||||
|
||||
TclNewObj(arithSeriesPtr);
|
||||
TclNewObj(arithSeriesObj);
|
||||
|
||||
if (length <= 0) {
|
||||
return arithSeriesPtr;
|
||||
return arithSeriesObj;
|
||||
}
|
||||
|
||||
arithSeriesRepPtr = (ArithSeriesDbl*) Tcl_Alloc(sizeof (ArithSeriesDbl));
|
||||
@@ -199,13 +205,13 @@ TclNewArithSeriesDbl(double start, double end, double step, Tcl_WideInt len)
|
||||
arithSeriesRepPtr->step = step;
|
||||
arithSeriesRepPtr->len = length;
|
||||
arithSeriesRepPtr->elements = NULL;
|
||||
arithSeriesPtr->internalRep.twoPtrValue.ptr1 = arithSeriesRepPtr;
|
||||
arithSeriesPtr->internalRep.twoPtrValue.ptr2 = NULL;
|
||||
arithSeriesPtr->typePtr = &tclArithSeriesType;
|
||||
arithSeriesObj->internalRep.twoPtrValue.ptr1 = arithSeriesRepPtr;
|
||||
arithSeriesObj->internalRep.twoPtrValue.ptr2 = NULL;
|
||||
arithSeriesObj->typePtr = &tclArithSeriesType.objType;
|
||||
if (length > 0)
|
||||
Tcl_InvalidateStringRep(arithSeriesPtr);
|
||||
Tcl_InvalidateStringRep(arithSeriesObj);
|
||||
|
||||
return arithSeriesPtr;
|
||||
return arithSeriesObj;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -228,7 +234,11 @@ TclNewArithSeriesDbl(double start, double end, double step, Tcl_WideInt len)
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
static void
|
||||
assignNumber(int useDoubles, Tcl_WideInt *intNumberPtr, double *dblNumberPtr, Tcl_Obj *numberObj)
|
||||
assignNumber(
|
||||
int useDoubles,
|
||||
Tcl_WideInt *intNumberPtr,
|
||||
double *dblNumberPtr,
|
||||
Tcl_Obj *numberObj)
|
||||
{
|
||||
void *clientData;
|
||||
int tcl_number_type;
|
||||
@@ -271,6 +281,7 @@ assignNumber(int useDoubles, Tcl_WideInt *intNumberPtr, double *dblNumberPtr, Tc
|
||||
* None.
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int
|
||||
TclNewArithSeriesObj(
|
||||
Tcl_Interp *interp, /* For error reporting */
|
||||
@@ -346,15 +357,15 @@ TclNewArithSeriesObj(
|
||||
if (TCL_MAJOR_VERSION < 9 && len > ListSizeT_MAX) {
|
||||
Tcl_SetObjResult(
|
||||
interp,
|
||||
Tcl_NewStringObj("max length of a Tcl list exceeded", -1));
|
||||
Tcl_NewStringObj("max length of a Tcl list exceeded", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
if (arithSeriesObj) {
|
||||
*arithSeriesObj = (useDoubles)
|
||||
? TclNewArithSeriesDbl(dstart, dend, dstep, len)
|
||||
: TclNewArithSeriesInt(start, end, step, len);
|
||||
? NewArithSeriesDbl(dstart, dend, dstep, len)
|
||||
: NewArithSeriesInt(start, end, step, len);
|
||||
}
|
||||
return TCL_OK;
|
||||
}
|
||||
@@ -362,7 +373,7 @@ TclNewArithSeriesObj(
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* TclArithSeriesObjStep --
|
||||
* ArithSeriesObjStep --
|
||||
*
|
||||
* Return a Tcl_Obj with the step value from the give ArithSeries Obj.
|
||||
* refcount = 0.
|
||||
@@ -377,26 +388,23 @@ TclNewArithSeriesObj(
|
||||
* None.
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
* TclArithSeriesObjStep --
|
||||
*/
|
||||
int
|
||||
TclArithSeriesObjStep(
|
||||
Tcl_Obj *arithSeriesPtr,
|
||||
Tcl_Obj **stepObj)
|
||||
Tcl_Obj *
|
||||
ArithSeriesObjStep(
|
||||
Tcl_Obj *arithSeriesObj)
|
||||
{
|
||||
ArithSeries *arithSeriesRepPtr;
|
||||
Tcl_Obj *stepObj;
|
||||
|
||||
if (arithSeriesPtr->typePtr != &tclArithSeriesType) {
|
||||
Tcl_Panic("TclArithSeriesObjIndex called with a not ArithSeries Obj.");
|
||||
if (arithSeriesObj->typePtr != &tclArithSeriesType.objType) {
|
||||
Tcl_Panic("ArithSeriesObjStep called with a not ArithSeries Obj.");
|
||||
}
|
||||
arithSeriesRepPtr = ArithSeriesRepPtr(arithSeriesPtr);
|
||||
arithSeriesRepPtr = ArithSeriesRepPtr(arithSeriesObj);
|
||||
if (arithSeriesRepPtr->isDouble) {
|
||||
*stepObj = Tcl_NewDoubleObj(((ArithSeriesDbl*)(arithSeriesRepPtr))->step);
|
||||
TclNewDoubleObj(stepObj, ((ArithSeriesDbl*)(arithSeriesRepPtr))->step);
|
||||
} else {
|
||||
*stepObj = Tcl_NewWideIntObj(arithSeriesRepPtr->step);
|
||||
TclNewIntObj(stepObj, arithSeriesRepPtr->step);
|
||||
}
|
||||
return TCL_OK;
|
||||
return stepObj;
|
||||
}
|
||||
|
||||
|
||||
@@ -407,13 +415,11 @@ TclArithSeriesObjStep(
|
||||
*
|
||||
* Returns the element with the specified index in the list
|
||||
* represented by the specified Arithmetic Sequence object.
|
||||
* If the index is out of range, TCL_ERROR is returned,
|
||||
* otherwise TCL_OK is returned and the integer value of the
|
||||
* element is stored in *element.
|
||||
* If the index is out of range, NULL is returned.
|
||||
*
|
||||
* Results:
|
||||
*
|
||||
* TCL_OK on success, TCL_ERROR on index out of range.
|
||||
* The element on success, NULL on index out of range.
|
||||
*
|
||||
* Side Effects:
|
||||
*
|
||||
@@ -422,31 +428,39 @@ TclArithSeriesObjStep(
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int
|
||||
TclArithSeriesObjIndex(Tcl_Obj *arithSeriesPtr, Tcl_WideInt index, Tcl_Obj **elementObj)
|
||||
Tcl_Obj *
|
||||
TclArithSeriesObjIndex(
|
||||
Tcl_Interp *interp,
|
||||
Tcl_Obj *arithSeriesObj,
|
||||
Tcl_WideInt index)
|
||||
{
|
||||
ArithSeries *arithSeriesRepPtr;
|
||||
|
||||
if (arithSeriesPtr->typePtr != &tclArithSeriesType) {
|
||||
if (arithSeriesObj->typePtr != &tclArithSeriesType.objType) {
|
||||
Tcl_Panic("TclArithSeriesObjIndex called with a not ArithSeries Obj.");
|
||||
}
|
||||
arithSeriesRepPtr = ArithSeriesRepPtr(arithSeriesPtr);
|
||||
if (index < 0 || index >= arithSeriesRepPtr->len) {
|
||||
return TCL_ERROR;
|
||||
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;
|
||||
}
|
||||
/* List[i] = Start + (Step * index) */
|
||||
if (arithSeriesRepPtr->isDouble) {
|
||||
*elementObj = Tcl_NewDoubleObj(ArithSeriesIndexM(arithSeriesRepPtr, index));
|
||||
return Tcl_NewDoubleObj(ArithSeriesIndexM(arithSeriesRepPtr, index));
|
||||
} else {
|
||||
*elementObj = Tcl_NewWideIntObj(ArithSeriesIndexM(arithSeriesRepPtr, index));
|
||||
return Tcl_NewWideIntObj(ArithSeriesIndexM(arithSeriesRepPtr, index));
|
||||
}
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* TclArithSeriesObjLength
|
||||
* ArithSeriesObjLength
|
||||
*
|
||||
* Returns the length of the arithmetic series.
|
||||
*
|
||||
@@ -460,10 +474,10 @@ TclArithSeriesObjIndex(Tcl_Obj *arithSeriesPtr, Tcl_WideInt index, Tcl_Obj **ele
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
Tcl_WideInt TclArithSeriesObjLength(Tcl_Obj *arithSeriesPtr)
|
||||
size_t ArithSeriesObjLength(Tcl_Obj *arithSeriesObj)
|
||||
{
|
||||
ArithSeries *arithSeriesRepPtr = (ArithSeries*)
|
||||
arithSeriesPtr->internalRep.twoPtrValue.ptr1;
|
||||
arithSeriesObj->internalRep.twoPtrValue.ptr1;
|
||||
return arithSeriesRepPtr->len;
|
||||
}
|
||||
|
||||
@@ -479,19 +493,19 @@ Tcl_WideInt TclArithSeriesObjLength(Tcl_Obj *arithSeriesPtr)
|
||||
* None.
|
||||
*
|
||||
* Side effects:
|
||||
* Frees arithSeriesPtr's ArithSeries* internal representation and
|
||||
* Frees arithSeriesObj's ArithSeries* internal representation and
|
||||
* sets listPtr's internalRep.twoPtrValue.ptr1 to NULL.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static void
|
||||
FreeArithSeriesInternalRep(Tcl_Obj *arithSeriesPtr)
|
||||
FreeArithSeriesInternalRep(Tcl_Obj *arithSeriesObj)
|
||||
{
|
||||
ArithSeries *arithSeriesRepPtr =
|
||||
(ArithSeries *) arithSeriesPtr->internalRep.twoPtrValue.ptr1;
|
||||
(ArithSeries *) arithSeriesObj->internalRep.twoPtrValue.ptr1;
|
||||
if (arithSeriesRepPtr->elements) {
|
||||
Tcl_WideInt i;
|
||||
Tcl_Size i;
|
||||
Tcl_Obj**elmts = arithSeriesRepPtr->elements;
|
||||
for(i=0; i<arithSeriesRepPtr->len; i++) {
|
||||
if (elmts[i]) {
|
||||
@@ -501,7 +515,7 @@ FreeArithSeriesInternalRep(Tcl_Obj *arithSeriesPtr)
|
||||
Tcl_Free((char *) arithSeriesRepPtr->elements);
|
||||
}
|
||||
Tcl_Free((char *) arithSeriesRepPtr);
|
||||
arithSeriesPtr->internalRep.twoPtrValue.ptr1 = NULL;
|
||||
arithSeriesObj->internalRep.twoPtrValue.ptr1 = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -538,7 +552,7 @@ DupArithSeriesInternalRep(
|
||||
copyArithSeriesRepPtr->elements = NULL;
|
||||
copyPtr->internalRep.twoPtrValue.ptr1 = copyArithSeriesRepPtr;
|
||||
copyPtr->internalRep.twoPtrValue.ptr2 = NULL;
|
||||
copyPtr->typePtr = &tclArithSeriesType;
|
||||
copyPtr->typePtr = &tclArithSeriesType.objType;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -570,22 +584,22 @@ DupArithSeriesInternalRep(
|
||||
*/
|
||||
|
||||
static void
|
||||
UpdateStringOfArithSeries(Tcl_Obj *arithSeriesPtr)
|
||||
UpdateStringOfArithSeries(Tcl_Obj *arithSeriesObj)
|
||||
{
|
||||
ArithSeries *arithSeriesRepPtr =
|
||||
(ArithSeries*) arithSeriesPtr->internalRep.twoPtrValue.ptr1;
|
||||
(ArithSeries*) arithSeriesObj->internalRep.twoPtrValue.ptr1;
|
||||
char *elem, *p;
|
||||
Tcl_Obj *elemObj;
|
||||
Tcl_WideInt i;
|
||||
Tcl_Size i;
|
||||
Tcl_WideInt length = 0;
|
||||
int slen;
|
||||
size_t slen;
|
||||
|
||||
/*
|
||||
* Pass 1: estimate space.
|
||||
*/
|
||||
for (i = 0; i < arithSeriesRepPtr->len; i++) {
|
||||
TclArithSeriesObjIndex(arithSeriesPtr, i, &elemObj);
|
||||
elem = TclGetStringFromObj(elemObj, &slen);
|
||||
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;
|
||||
@@ -595,17 +609,17 @@ UpdateStringOfArithSeries(Tcl_Obj *arithSeriesPtr)
|
||||
* Pass 2: generate the string repr.
|
||||
*/
|
||||
|
||||
p = Tcl_InitStringRep(arithSeriesPtr, NULL, length);
|
||||
p = Tcl_InitStringRep(arithSeriesObj, NULL, length);
|
||||
for (i = 0; i < arithSeriesRepPtr->len; i++) {
|
||||
TclArithSeriesObjIndex(arithSeriesPtr, i, &elemObj);
|
||||
elem = TclGetStringFromObj(elemObj, &slen);
|
||||
elemObj = TclArithSeriesObjIndex(NULL, arithSeriesObj, i);
|
||||
elem = Tcl_GetStringFromObj(elemObj, &slen);
|
||||
strcpy(p, elem);
|
||||
p[slen] = ' ';
|
||||
p += slen+1;
|
||||
Tcl_DecrRefCount(elemObj);
|
||||
}
|
||||
if (length > 0) arithSeriesPtr->bytes[length-1] = '\0';
|
||||
arithSeriesPtr->length = length-1;
|
||||
if (length > 0) arithSeriesObj->bytes[length-1] = '\0';
|
||||
arithSeriesObj->length = length-1;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -651,8 +665,8 @@ SetArithSeriesFromAny(
|
||||
* Results:
|
||||
*
|
||||
* Normally returns a pointer to a new Tcl_Obj, that contains the same
|
||||
* arithSeries value as *arithSeriesPtr does. The returned Tcl_Obj has a
|
||||
* refCount of zero. If *arithSeriesPtr does not hold an arithSeries,
|
||||
* 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.
|
||||
*
|
||||
@@ -665,15 +679,15 @@ SetArithSeriesFromAny(
|
||||
Tcl_Obj *
|
||||
TclArithSeriesObjCopy(
|
||||
Tcl_Interp *interp, /* Used to report errors if not NULL. */
|
||||
Tcl_Obj *arithSeriesPtr) /* List object for which an element array is
|
||||
Tcl_Obj *arithSeriesObj) /* List object for which an element array is
|
||||
* to be returned. */
|
||||
{
|
||||
Tcl_Obj *copyPtr;
|
||||
ArithSeries *arithSeriesRepPtr;
|
||||
|
||||
ArithSeriesGetInternalRep(arithSeriesPtr, arithSeriesRepPtr);
|
||||
ArithSeriesGetInternalRep(arithSeriesObj, arithSeriesRepPtr);
|
||||
if (NULL == arithSeriesRepPtr) {
|
||||
if (SetArithSeriesFromAny(interp, arithSeriesPtr) != TCL_OK) {
|
||||
if (SetArithSeriesFromAny(interp, arithSeriesObj) != TCL_OK) {
|
||||
/* We know this is going to panic, but it's the message we want */
|
||||
return NULL;
|
||||
}
|
||||
@@ -681,7 +695,7 @@ TclArithSeriesObjCopy(
|
||||
|
||||
TclNewObj(copyPtr);
|
||||
TclInvalidateStringRep(copyPtr);
|
||||
DupArithSeriesInternalRep(arithSeriesPtr, copyPtr);
|
||||
DupArithSeriesInternalRep(arithSeriesObj, copyPtr);
|
||||
return copyPtr;
|
||||
}
|
||||
|
||||
@@ -691,7 +705,7 @@ TclArithSeriesObjCopy(
|
||||
* TclArithSeriesObjRange --
|
||||
*
|
||||
* Makes a slice of an ArithSeries value.
|
||||
* *arithSeriesPtr must be known to be a valid list.
|
||||
* *arithSeriesObj must be known to be a valid list.
|
||||
*
|
||||
* Results:
|
||||
* Returns a pointer to the sliced series.
|
||||
@@ -707,16 +721,16 @@ TclArithSeriesObjCopy(
|
||||
Tcl_Obj *
|
||||
TclArithSeriesObjRange(
|
||||
Tcl_Interp *interp, /* For error message(s) */
|
||||
Tcl_Obj *arithSeriesPtr, /* List object to take a range from. */
|
||||
Tcl_Obj *arithSeriesObj, /* List object to take a range from. */
|
||||
Tcl_Size fromIdx, /* Index of first element to include. */
|
||||
Tcl_Size toIdx) /* Index of last element to include. */
|
||||
Tcl_Size toIdx) /* Index of last element to include. */
|
||||
{
|
||||
ArithSeries *arithSeriesRepPtr;
|
||||
Tcl_Obj *startObj, *endObj, *stepObj;
|
||||
|
||||
ArithSeriesGetInternalRep(arithSeriesPtr, arithSeriesRepPtr);
|
||||
ArithSeriesGetInternalRep(arithSeriesObj, arithSeriesRepPtr);
|
||||
|
||||
if (fromIdx == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(fromIdx)) {
|
||||
fromIdx = 0;
|
||||
}
|
||||
if (fromIdx > toIdx) {
|
||||
@@ -725,33 +739,21 @@ TclArithSeriesObjRange(
|
||||
return obj;
|
||||
}
|
||||
|
||||
if (TclArithSeriesObjIndex(arithSeriesPtr, fromIdx, &startObj) != TCL_OK) {
|
||||
if (interp) {
|
||||
Tcl_SetObjResult(
|
||||
interp,
|
||||
Tcl_ObjPrintf("index %" TCL_Z_MODIFIER "u is out of bounds 0 to %"
|
||||
TCL_LL_MODIFIER "d", fromIdx, (arithSeriesRepPtr->len-1)));
|
||||
Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL);
|
||||
}
|
||||
startObj = TclArithSeriesObjIndex(interp, arithSeriesObj, fromIdx);
|
||||
if (startObj == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
Tcl_IncrRefCount(startObj);
|
||||
if (TclArithSeriesObjIndex(arithSeriesPtr, toIdx, &endObj) != TCL_OK) {
|
||||
if (interp) {
|
||||
Tcl_SetObjResult(
|
||||
interp,
|
||||
Tcl_ObjPrintf("index %" TCL_Z_MODIFIER "u is out of bounds 0 to %"
|
||||
TCL_LL_MODIFIER "d", fromIdx, (arithSeriesRepPtr->len-1)));
|
||||
Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL);
|
||||
}
|
||||
endObj = TclArithSeriesObjIndex(interp, arithSeriesObj, toIdx);
|
||||
if (endObj == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
Tcl_IncrRefCount(endObj);
|
||||
TclArithSeriesObjStep(arithSeriesPtr, &stepObj);
|
||||
stepObj = ArithSeriesObjStep(arithSeriesObj);
|
||||
Tcl_IncrRefCount(stepObj);
|
||||
|
||||
if (Tcl_IsShared(arithSeriesPtr) ||
|
||||
((arithSeriesPtr->refCount > 1))) {
|
||||
if (Tcl_IsShared(arithSeriesObj) ||
|
||||
((arithSeriesObj->refCount > 1))) {
|
||||
Tcl_Obj *newSlicePtr;
|
||||
if (TclNewArithSeriesObj(interp, &newSlicePtr,
|
||||
arithSeriesRepPtr->isDouble, startObj, endObj,
|
||||
@@ -773,10 +775,10 @@ TclArithSeriesObjRange(
|
||||
* string-canonizing effect of [lrange 0 end].
|
||||
*/
|
||||
|
||||
TclInvalidateStringRep(arithSeriesPtr);
|
||||
TclInvalidateStringRep(arithSeriesObj);
|
||||
|
||||
if (arithSeriesRepPtr->isDouble) {
|
||||
ArithSeriesDbl *arithSeriesDblRepPtr = (ArithSeriesDbl*)arithSeriesPtr;
|
||||
ArithSeriesDbl *arithSeriesDblRepPtr = (ArithSeriesDbl*)arithSeriesObj;
|
||||
double start, end, step;
|
||||
Tcl_GetDoubleFromObj(NULL, startObj, &start);
|
||||
Tcl_GetDoubleFromObj(NULL, endObj, &end);
|
||||
@@ -803,7 +805,7 @@ TclArithSeriesObjRange(
|
||||
Tcl_DecrRefCount(endObj);
|
||||
Tcl_DecrRefCount(stepObj);
|
||||
|
||||
return arithSeriesPtr;
|
||||
return arithSeriesObj;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -838,14 +840,14 @@ TclArithSeriesObjRange(
|
||||
int
|
||||
TclArithSeriesGetElements(
|
||||
Tcl_Interp *interp, /* Used to report errors if not NULL. */
|
||||
Tcl_Obj *objPtr, /* AbstractList object for which an element
|
||||
Tcl_Obj *objPtr, /* ArithSeries object for which an element
|
||||
* array is to be returned. */
|
||||
Tcl_Size *objcPtr, /* Where to store the count of objects
|
||||
* referenced by objv. */
|
||||
Tcl_Obj ***objvPtr) /* Where to store the pointer to an array of
|
||||
* pointers to the list's objects. */
|
||||
{
|
||||
if (TclHasInternalRep(objPtr,&tclArithSeriesType)) {
|
||||
if (TclHasInternalRep(objPtr,&tclArithSeriesType.objType)) {
|
||||
ArithSeries *arithSeriesRepPtr;
|
||||
Tcl_Obj **objv;
|
||||
int i, objc;
|
||||
@@ -863,20 +865,15 @@ TclArithSeriesGetElements(
|
||||
if (interp) {
|
||||
Tcl_SetObjResult(
|
||||
interp,
|
||||
Tcl_NewStringObj("max length of a Tcl list exceeded", -1));
|
||||
Tcl_NewStringObj("max length of a Tcl list exceeded", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL);
|
||||
}
|
||||
return TCL_ERROR;
|
||||
}
|
||||
arithSeriesRepPtr->elements = objv;
|
||||
for (i = 0; i < objc; i++) {
|
||||
if (TclArithSeriesObjIndex(objPtr, i, &objv[i]) != TCL_OK) {
|
||||
if (interp) {
|
||||
Tcl_SetObjResult(
|
||||
interp,
|
||||
Tcl_NewStringObj("indexing error", -1));
|
||||
Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL);
|
||||
}
|
||||
objv[i] = TclArithSeriesObjIndex(interp, objPtr, i);
|
||||
if (objv[i] == NULL) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
Tcl_IncrRefCount(objv[i]);
|
||||
@@ -905,7 +902,7 @@ TclArithSeriesGetElements(
|
||||
* TclArithSeriesObjReverse --
|
||||
*
|
||||
* Reverse the order of the ArithSeries value.
|
||||
* *arithSeriesPtr must be known to be a valid list.
|
||||
* *arithSeriesObj must be known to be a valid list.
|
||||
*
|
||||
* Results:
|
||||
* Returns a pointer to the reordered series.
|
||||
@@ -921,7 +918,7 @@ TclArithSeriesGetElements(
|
||||
Tcl_Obj *
|
||||
TclArithSeriesObjReverse(
|
||||
Tcl_Interp *interp, /* For error message(s) */
|
||||
Tcl_Obj *arithSeriesPtr) /* List object to reverse. */
|
||||
Tcl_Obj *arithSeriesObj) /* List object to reverse. */
|
||||
{
|
||||
ArithSeries *arithSeriesRepPtr;
|
||||
Tcl_Obj *startObj, *endObj, *stepObj;
|
||||
@@ -930,16 +927,16 @@ TclArithSeriesObjReverse(
|
||||
double dstart, dend, dstep;
|
||||
int isDouble;
|
||||
|
||||
ArithSeriesGetInternalRep(arithSeriesPtr, arithSeriesRepPtr);
|
||||
ArithSeriesGetInternalRep(arithSeriesObj, arithSeriesRepPtr);
|
||||
|
||||
isDouble = arithSeriesRepPtr->isDouble;
|
||||
len = arithSeriesRepPtr->len;
|
||||
|
||||
TclArithSeriesObjIndex(arithSeriesPtr, (len-1), &startObj);
|
||||
startObj = TclArithSeriesObjIndex(NULL, arithSeriesObj, (len-1));
|
||||
Tcl_IncrRefCount(startObj);
|
||||
TclArithSeriesObjIndex(arithSeriesPtr, 0, &endObj);
|
||||
endObj = TclArithSeriesObjIndex(NULL, arithSeriesObj, 0);
|
||||
Tcl_IncrRefCount(endObj);
|
||||
TclArithSeriesObjStep(arithSeriesPtr, &stepObj);
|
||||
stepObj = ArithSeriesObjStep(arithSeriesObj);
|
||||
Tcl_IncrRefCount(stepObj);
|
||||
|
||||
if (isDouble) {
|
||||
@@ -956,9 +953,10 @@ TclArithSeriesObjReverse(
|
||||
TclSetIntObj(stepObj, step);
|
||||
}
|
||||
|
||||
if (Tcl_IsShared(arithSeriesPtr) ||
|
||||
((arithSeriesPtr->refCount > 1))) {
|
||||
Tcl_Obj *lenObj = Tcl_NewWideIntObj(len);
|
||||
if (Tcl_IsShared(arithSeriesObj) ||
|
||||
((arithSeriesObj->refCount > 1))) {
|
||||
Tcl_Obj *lenObj;
|
||||
TclNewIntObj(lenObj, len);
|
||||
if (TclNewArithSeriesObj(interp, &resultObj,
|
||||
isDouble, startObj, endObj, stepObj, lenObj) != TCL_OK) {
|
||||
resultObj = NULL;
|
||||
@@ -970,7 +968,7 @@ TclArithSeriesObjReverse(
|
||||
* In-place is possible.
|
||||
*/
|
||||
|
||||
TclInvalidateStringRep(arithSeriesPtr);
|
||||
TclInvalidateStringRep(arithSeriesObj);
|
||||
|
||||
if (isDouble) {
|
||||
ArithSeriesDbl *arithSeriesDblRepPtr =
|
||||
@@ -992,7 +990,7 @@ TclArithSeriesObjReverse(
|
||||
}
|
||||
arithSeriesRepPtr->elements = NULL;
|
||||
|
||||
resultObj = arithSeriesPtr;
|
||||
resultObj = arithSeriesObj;
|
||||
}
|
||||
|
||||
Tcl_DecrRefCount(startObj);
|
||||
@@ -1001,3 +999,11 @@ TclArithSeriesObjReverse(
|
||||
|
||||
return resultObj;
|
||||
}
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: c
|
||||
* c-basic-offset: 4
|
||||
* fill-column: 78
|
||||
* End:
|
||||
*/
|
||||
|
||||
+17
-17
@@ -15,43 +15,43 @@
|
||||
* Note that the len can in theory be always computed by start,end,step
|
||||
* but it's faster to cache it inside the internal representation.
|
||||
*/
|
||||
typedef struct ArithSeries {
|
||||
typedef struct {
|
||||
Tcl_Size len;
|
||||
Tcl_Obj **elements;
|
||||
int isDouble;
|
||||
Tcl_WideInt start;
|
||||
Tcl_WideInt end;
|
||||
Tcl_WideInt step;
|
||||
Tcl_WideInt len;
|
||||
} ArithSeries;
|
||||
typedef struct {
|
||||
Tcl_Size len;
|
||||
Tcl_Obj **elements;
|
||||
int isDouble;
|
||||
} ArithSeries;
|
||||
typedef struct ArithSeriesDbl {
|
||||
double start;
|
||||
double end;
|
||||
double step;
|
||||
Tcl_WideInt len;
|
||||
Tcl_Obj **elements;
|
||||
int isDouble;
|
||||
} ArithSeriesDbl;
|
||||
|
||||
|
||||
MODULE_SCOPE Tcl_Obj * TclArithSeriesObjCopy(Tcl_Interp *interp,
|
||||
Tcl_Obj *arithSeriesPtr);
|
||||
MODULE_SCOPE int TclArithSeriesObjStep(Tcl_Obj *arithSeriesPtr,
|
||||
Tcl_Obj **stepObj);
|
||||
MODULE_SCOPE int TclArithSeriesObjIndex(Tcl_Obj *arithSeriesPtr,
|
||||
Tcl_WideInt index, Tcl_Obj **elementObj);
|
||||
MODULE_SCOPE Tcl_WideInt TclArithSeriesObjLength(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 Tcl_Obj * TclNewArithSeriesInt(Tcl_WideInt start,
|
||||
Tcl_WideInt end, Tcl_WideInt step,
|
||||
Tcl_WideInt len);
|
||||
MODULE_SCOPE Tcl_Obj * TclNewArithSeriesDbl(double start, double end,
|
||||
double step, Tcl_WideInt len);
|
||||
MODULE_SCOPE int TclNewArithSeriesObj(Tcl_Interp *interp,
|
||||
Tcl_Obj **arithSeriesObj, int useDoubles,
|
||||
Tcl_Obj *startObj, Tcl_Obj *endObj,
|
||||
Tcl_Obj *stepObj, Tcl_Obj *lenObj);
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: c
|
||||
* c-basic-offset: 4
|
||||
* fill-column: 78
|
||||
* End:
|
||||
*/
|
||||
|
||||
+28
-25
@@ -1367,7 +1367,7 @@ AssembleOneLine(
|
||||
goto cleanup;
|
||||
}
|
||||
localVar = FindLocalVar(assemEnvPtr, &tokenPtr);
|
||||
if (localVar == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(localVar)) {
|
||||
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]", -1));
|
||||
Tcl_NewStringObj("operand must be [0..3]", TCL_INDEX_NONE));
|
||||
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 (TCL_SIZE_ISNEG(localVar)) {
|
||||
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 (TCL_SIZE_ISNEG(localVar)) {
|
||||
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", -1));
|
||||
Tcl_NewStringObj("operand must be >=2", TCL_INDEX_NONE));
|
||||
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 (TCL_SIZE_ISNEG(localVar)) {
|
||||
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 (TCL_SIZE_ISNEG(localVar) || 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 (TCL_SIZE_ISNEG(localVar) || 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 (TCL_SIZE_ISNEG(localVar)) {
|
||||
goto cleanup;
|
||||
}
|
||||
BBEmitInstInt4(assemEnvPtr, tblIdx, localVar, 0);
|
||||
@@ -1742,7 +1742,7 @@ AssembleOneLine(
|
||||
goto cleanup;
|
||||
}
|
||||
localVar = FindLocalVar(assemEnvPtr, &tokenPtr);
|
||||
if (localVar == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(localVar)) {
|
||||
goto cleanup;
|
||||
}
|
||||
BBEmitInstInt4(assemEnvPtr, tblIdx, opnd, 0);
|
||||
@@ -1984,7 +1984,7 @@ CreateMirrorJumpTable(
|
||||
* table. */
|
||||
size_t i;
|
||||
|
||||
if (TclListObjGetElementsM(interp, jumps, &objc, &objv) != TCL_OK) {
|
||||
if (TclListObjLengthM(interp, jumps, &objc) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (objc % 2 != 0) {
|
||||
@@ -1996,6 +1996,9 @@ CreateMirrorJumpTable(
|
||||
}
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (TclListObjGetElementsM(interp, jumps, &objc, &objv) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate the jumptable.
|
||||
@@ -2104,7 +2107,7 @@ GetNextOperand(
|
||||
Tcl_DecrRefCount(operandObj);
|
||||
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"assembly code may not contain substitutions", -1));
|
||||
"assembly code may not contain substitutions", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "NOSUBST", NULL);
|
||||
}
|
||||
return TCL_ERROR;
|
||||
@@ -2323,11 +2326,11 @@ FindLocalVar(
|
||||
}
|
||||
localVar = TclFindCompiledLocal(varNameStr, varNameLen, 1, envPtr);
|
||||
Tcl_DecrRefCount(varNameObj);
|
||||
if (localVar == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(localVar)) {
|
||||
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"cannot use this instruction to create a variable"
|
||||
" in a non-proc context", -1));
|
||||
" in a non-proc context", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "LVT", NULL);
|
||||
}
|
||||
return TCL_INDEX_NONE;
|
||||
@@ -2397,7 +2400,7 @@ CheckOneByte(
|
||||
Tcl_Obj* result; /* Error message */
|
||||
|
||||
if (value < 0 || value > 0xFF) {
|
||||
result = Tcl_NewStringObj("operand does not fit in one byte", -1);
|
||||
result = Tcl_NewStringObj("operand does not fit in one byte", TCL_INDEX_NONE);
|
||||
Tcl_SetObjResult(interp, result);
|
||||
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "1BYTE", NULL);
|
||||
return TCL_ERROR;
|
||||
@@ -2432,7 +2435,7 @@ CheckSignedOneByte(
|
||||
Tcl_Obj* result; /* Error message */
|
||||
|
||||
if (value > 0x7F || value < -0x80) {
|
||||
result = Tcl_NewStringObj("operand does not fit in one byte", -1);
|
||||
result = Tcl_NewStringObj("operand does not fit in one byte", TCL_INDEX_NONE);
|
||||
Tcl_SetObjResult(interp, result);
|
||||
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "1BYTE", NULL);
|
||||
return TCL_ERROR;
|
||||
@@ -2465,7 +2468,7 @@ CheckNonNegative(
|
||||
Tcl_Obj* result; /* Error message */
|
||||
|
||||
if (value < 0) {
|
||||
result = Tcl_NewStringObj("operand must be nonnegative", -1);
|
||||
result = Tcl_NewStringObj("operand must be nonnegative", TCL_INDEX_NONE);
|
||||
Tcl_SetObjResult(interp, result);
|
||||
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "NONNEGATIVE", NULL);
|
||||
return TCL_ERROR;
|
||||
@@ -2498,7 +2501,7 @@ CheckStrictlyPositive(
|
||||
Tcl_Obj* result; /* Error message */
|
||||
|
||||
if (value <= 0) {
|
||||
result = Tcl_NewStringObj("operand must be positive", -1);
|
||||
result = Tcl_NewStringObj("operand must be positive", TCL_INDEX_NONE);
|
||||
Tcl_SetObjResult(interp, result);
|
||||
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "POSITIVE", NULL);
|
||||
return TCL_ERROR;
|
||||
@@ -3411,7 +3414,7 @@ StackCheckBasicBlock(
|
||||
}
|
||||
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"inconsistent stack depths on two execution paths", -1));
|
||||
"inconsistent stack depths on two execution paths", TCL_INDEX_NONE));
|
||||
|
||||
/*
|
||||
* TODO - add execution trace of both paths
|
||||
@@ -3440,7 +3443,7 @@ StackCheckBasicBlock(
|
||||
|
||||
if (initialStackDepth + blockPtr->minStackDepth < 0) {
|
||||
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj("stack underflow", -1));
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj("stack underflow", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "BADSTACK", NULL);
|
||||
AddBasicBlockRangeToErrorInfo(assemEnvPtr, blockPtr);
|
||||
Tcl_SetErrorLine(interp, blockPtr->startLine);
|
||||
@@ -3459,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", -1));
|
||||
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "BADSTACKINCATCH", -1);
|
||||
"code pops stack below level of enclosing catch", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "BADSTACKINCATCH", TCL_INDEX_NONE);
|
||||
AddBasicBlockRangeToErrorInfo(assemEnvPtr, blockPtr);
|
||||
Tcl_SetErrorLine(interp, blockPtr->startLine);
|
||||
}
|
||||
@@ -3731,7 +3734,7 @@ ProcessCatchesInBasicBlock(
|
||||
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"execution reaches an instruction in inconsistent "
|
||||
"exception contexts", -1));
|
||||
"exception contexts", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorLine(interp, bbPtr->startLine);
|
||||
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "BADCATCH", NULL);
|
||||
}
|
||||
@@ -3790,7 +3793,7 @@ ProcessCatchesInBasicBlock(
|
||||
if (enclosing == NULL) {
|
||||
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"endCatch without a corresponding beginCatch", -1));
|
||||
"endCatch without a corresponding beginCatch", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorLine(interp, bbPtr->startLine);
|
||||
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "BADENDCATCH", NULL);
|
||||
}
|
||||
@@ -3865,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", -1));
|
||||
"catch still active on exit from assembly code", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorLine(interp,
|
||||
assemEnvPtr->curr_bb->enclosingCatch->startLine);
|
||||
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "UNCLOSEDCATCH", NULL);
|
||||
|
||||
+82
-79
@@ -613,7 +613,7 @@ 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) {
|
||||
@@ -621,8 +621,8 @@ buildInfoObjCmd2(
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (objc == 2) {
|
||||
int len;
|
||||
const char *arg = TclGetStringFromObj(objv[1], &len);
|
||||
size_t len;
|
||||
const char *arg = Tcl_GetStringFromObj(objv[1], &len);
|
||||
if (len == 7 && !strcmp(arg, "version")) {
|
||||
char buf[80];
|
||||
const char *p = strchr((char *)clientData, '.');
|
||||
@@ -1499,7 +1499,7 @@ Tcl_CallWhenDeleted(
|
||||
AssocData *dPtr = (AssocData *)Tcl_Alloc(sizeof(AssocData));
|
||||
Tcl_HashEntry *hPtr;
|
||||
|
||||
sprintf(buffer, "Assoc Data Key #%d", *assocDataCounterPtr);
|
||||
snprintf(buffer, sizeof(buffer), "Assoc Data Key #%d", *assocDataCounterPtr);
|
||||
(*assocDataCounterPtr)++;
|
||||
|
||||
if (iPtr->assocData == NULL) {
|
||||
@@ -2152,7 +2152,7 @@ Tcl_HideCommand(
|
||||
if (strstr(hiddenCmdToken, "::") != NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"cannot use namespace qualifiers in hidden command"
|
||||
" token (rename)", -1));
|
||||
" token (rename)", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "VALUE", "HIDDENTOKEN", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -3188,11 +3188,11 @@ TclRenameCommand(
|
||||
*/
|
||||
|
||||
Tcl_DStringInit(&newFullName);
|
||||
Tcl_DStringAppend(&newFullName, newNsPtr->fullName, -1);
|
||||
Tcl_DStringAppend(&newFullName, newNsPtr->fullName, TCL_INDEX_NONE);
|
||||
if (newNsPtr != iPtr->globalNsPtr) {
|
||||
TclDStringAppendLiteral(&newFullName, "::");
|
||||
}
|
||||
Tcl_DStringAppend(&newFullName, newTail, -1);
|
||||
Tcl_DStringAppend(&newFullName, newTail, TCL_INDEX_NONE);
|
||||
cmdPtr->refCount++;
|
||||
CallCommandTraces(iPtr, cmdPtr, TclGetString(oldFullName),
|
||||
Tcl_DStringValue(&newFullName), TCL_TRACE_RENAME);
|
||||
@@ -3291,7 +3291,7 @@ 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;
|
||||
@@ -3311,7 +3311,7 @@ invokeObj2Command(
|
||||
|
||||
static int cmdWrapper2Proc(void *clientData,
|
||||
Tcl_Interp *interp,
|
||||
size_t objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
Command *cmdPtr = (Command *)clientData;
|
||||
@@ -3553,14 +3553,14 @@ Tcl_GetCommandFullName(
|
||||
|
||||
if ((cmdPtr != NULL) && TclRoutineHasName(cmdPtr)) {
|
||||
if (cmdPtr->nsPtr != NULL) {
|
||||
Tcl_AppendToObj(objPtr, cmdPtr->nsPtr->fullName, -1);
|
||||
Tcl_AppendToObj(objPtr, cmdPtr->nsPtr->fullName, TCL_INDEX_NONE);
|
||||
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, -1);
|
||||
Tcl_AppendToObj(objPtr, name, TCL_INDEX_NONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4061,7 +4061,7 @@ TclInterpReady(
|
||||
|
||||
if (iPtr->flags & DELETED) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"attempt to call eval in deleted interpreter", -1));
|
||||
"attempt to call eval in deleted interpreter", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "IDELETE",
|
||||
"attempt to call eval in deleted interpreter", NULL);
|
||||
return TCL_ERROR;
|
||||
@@ -4090,7 +4090,7 @@ TclInterpReady(
|
||||
}
|
||||
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"too many nested evaluations (infinite loop?)", -1));
|
||||
"too many nested evaluations (infinite loop?)", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "LIMIT", "STACK", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -4224,7 +4224,7 @@ Tcl_Canceled(
|
||||
}
|
||||
}
|
||||
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(message, -1));
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(message, TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "CANCEL", id, message, NULL);
|
||||
}
|
||||
|
||||
@@ -4370,7 +4370,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 +4389,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
|
||||
@@ -5089,7 +5089,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 +5122,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 TCL_INDEX_NONE, the
|
||||
* script consists of all bytes up to the
|
||||
* first null character. */
|
||||
int flags) /* Collection of OR-ed bits that control the
|
||||
@@ -5137,7 +5137,7 @@ 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
|
||||
size_t numBytes, /* Number of bytes in script. If TCL_INDEX_NONE, the
|
||||
* script consists of all bytes up to the
|
||||
* first NUL character. */
|
||||
int flags, /* Collection of OR-ed bits that control the
|
||||
@@ -5203,7 +5203,7 @@ TclEvalEx(
|
||||
}
|
||||
}
|
||||
|
||||
if (numBytes == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(numBytes)) {
|
||||
numBytes = strlen(script);
|
||||
}
|
||||
Tcl_ResetResult(interp);
|
||||
@@ -5852,7 +5852,7 @@ TclArgumentBCEnter(
|
||||
* housekeeping, and can escape now.
|
||||
*/
|
||||
|
||||
if (ePtr->nline != (size_t)objc) {
|
||||
if (ePtr->nline != (Tcl_Size)objc) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -6361,15 +6361,15 @@ ProcessUnexpectedResult(
|
||||
Tcl_ResetResult(interp);
|
||||
if (returnCode == TCL_BREAK) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"invoked \"break\" outside of a loop", -1));
|
||||
"invoked \"break\" outside of a loop", TCL_INDEX_NONE));
|
||||
} else if (returnCode == TCL_CONTINUE) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"invoked \"continue\" outside of a loop", -1));
|
||||
"invoked \"continue\" outside of a loop", TCL_INDEX_NONE));
|
||||
} else {
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"command returned bad code: %d", returnCode));
|
||||
}
|
||||
sprintf(buf, "%d", returnCode);
|
||||
snprintf(buf, sizeof(buf), "%d", returnCode);
|
||||
Tcl_SetErrorCode(interp, "TCL", "UNEXPECTED_RESULT_CODE", buf, NULL);
|
||||
}
|
||||
|
||||
@@ -6410,7 +6410,7 @@ Tcl_ExprLong(
|
||||
|
||||
*ptr = 0;
|
||||
} else {
|
||||
exprPtr = Tcl_NewStringObj(exprstring, -1);
|
||||
exprPtr = Tcl_NewStringObj(exprstring, TCL_INDEX_NONE);
|
||||
Tcl_IncrRefCount(exprPtr);
|
||||
result = Tcl_ExprLongObj(interp, exprPtr, ptr);
|
||||
Tcl_DecrRefCount(exprPtr);
|
||||
@@ -6435,7 +6435,7 @@ Tcl_ExprDouble(
|
||||
|
||||
*ptr = 0.0;
|
||||
} else {
|
||||
exprPtr = Tcl_NewStringObj(exprstring, -1);
|
||||
exprPtr = Tcl_NewStringObj(exprstring, TCL_INDEX_NONE);
|
||||
Tcl_IncrRefCount(exprPtr);
|
||||
result = Tcl_ExprDoubleObj(interp, exprPtr, ptr);
|
||||
Tcl_DecrRefCount(exprPtr);
|
||||
@@ -6460,7 +6460,7 @@ Tcl_ExprBoolean(
|
||||
return TCL_OK;
|
||||
} else {
|
||||
int result;
|
||||
Tcl_Obj *exprPtr = Tcl_NewStringObj(exprstring, -1);
|
||||
Tcl_Obj *exprPtr = Tcl_NewStringObj(exprstring, TCL_INDEX_NONE);
|
||||
|
||||
Tcl_IncrRefCount(exprPtr);
|
||||
result = Tcl_ExprBooleanObj(interp, exprPtr, ptr);
|
||||
@@ -6673,7 +6673,7 @@ TclObjInvoke(
|
||||
}
|
||||
if ((objc < 1) || (objv == NULL)) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"illegal argument vector", -1));
|
||||
"illegal argument vector", TCL_INDEX_NONE));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if ((flags & TCL_INVOKE_HIDDEN) == 0) {
|
||||
@@ -6772,7 +6772,7 @@ Tcl_ExprString(
|
||||
|
||||
Tcl_SetObjResult(interp, Tcl_NewWideIntObj(0));
|
||||
} else {
|
||||
Tcl_Obj *resultPtr, *exprObj = Tcl_NewStringObj(expr, -1);
|
||||
Tcl_Obj *resultPtr, *exprObj = Tcl_NewStringObj(expr, TCL_INDEX_NONE);
|
||||
|
||||
Tcl_IncrRefCount(exprObj);
|
||||
code = Tcl_ExprObj(interp, exprObj, &resultPtr);
|
||||
@@ -6886,10 +6886,10 @@ Tcl_VarEval(
|
||||
if (string == NULL) {
|
||||
break;
|
||||
}
|
||||
Tcl_DStringAppend(&buf, string, -1);
|
||||
Tcl_DStringAppend(&buf, string, TCL_INDEX_NONE);
|
||||
}
|
||||
|
||||
result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, 0);
|
||||
result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), TCL_INDEX_NONE, 0);
|
||||
Tcl_DStringFree(&buf);
|
||||
return result;
|
||||
}
|
||||
@@ -6911,14 +6911,14 @@ 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) {
|
||||
@@ -7031,7 +7031,7 @@ ExprCeilFunc(
|
||||
code = Tcl_GetDoubleFromObj(interp, objv[1], &d);
|
||||
#ifdef ACCEPT_NAN
|
||||
if (code != TCL_OK) {
|
||||
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objv[1], &tclDoubleType);
|
||||
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objv[1], &tclDoubleType.objType);
|
||||
|
||||
if (irPtr) {
|
||||
Tcl_SetObjResult(interp, objv[1]);
|
||||
@@ -7071,7 +7071,7 @@ ExprFloorFunc(
|
||||
code = Tcl_GetDoubleFromObj(interp, objv[1], &d);
|
||||
#ifdef ACCEPT_NAN
|
||||
if (code != TCL_OK) {
|
||||
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objv[1], &tclDoubleType);
|
||||
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objv[1], &tclDoubleType.objType);
|
||||
|
||||
if (irPtr) {
|
||||
Tcl_SetObjResult(interp, objv[1]);
|
||||
@@ -7192,7 +7192,7 @@ ExprIsqrtFunc(
|
||||
|
||||
negarg:
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"square root of negative argument", -1));
|
||||
"square root of negative argument", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "ARITH", "DOMAIN",
|
||||
"domain error: argument not in valid range", NULL);
|
||||
return TCL_ERROR;
|
||||
@@ -7217,7 +7217,7 @@ ExprSqrtFunc(
|
||||
code = Tcl_GetDoubleFromObj(interp, objv[1], &d);
|
||||
#ifdef ACCEPT_NAN
|
||||
if (code != TCL_OK) {
|
||||
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objv[1], &tclDoubleType);
|
||||
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objv[1], &tclDoubleType.objType);
|
||||
|
||||
if (irPtr) {
|
||||
Tcl_SetObjResult(interp, objv[1]);
|
||||
@@ -7271,7 +7271,7 @@ ExprUnaryFunc(
|
||||
code = Tcl_GetDoubleFromObj(interp, objv[1], &d);
|
||||
#ifdef ACCEPT_NAN
|
||||
if (code != TCL_OK) {
|
||||
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objv[1], &tclDoubleType);
|
||||
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objv[1], &tclDoubleType.objType);
|
||||
|
||||
if (irPtr) {
|
||||
d = irPtr->doubleValue;
|
||||
@@ -7335,7 +7335,7 @@ ExprBinaryFunc(
|
||||
code = Tcl_GetDoubleFromObj(interp, objv[1], &d1);
|
||||
#ifdef ACCEPT_NAN
|
||||
if (code != TCL_OK) {
|
||||
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objv[1], &tclDoubleType);
|
||||
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objv[1], &tclDoubleType.objType);
|
||||
|
||||
if (irPtr) {
|
||||
d1 = irPtr->doubleValue;
|
||||
@@ -7350,7 +7350,7 @@ ExprBinaryFunc(
|
||||
code = Tcl_GetDoubleFromObj(interp, objv[2], &d2);
|
||||
#ifdef ACCEPT_NAN
|
||||
if (code != TCL_OK) {
|
||||
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objv[1], &tclDoubleType);
|
||||
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objv[1], &tclDoubleType.objType);
|
||||
|
||||
if (irPtr) {
|
||||
d2 = irPtr->doubleValue;
|
||||
@@ -7511,7 +7511,7 @@ ExprDoubleFunc(
|
||||
}
|
||||
if (Tcl_GetDoubleFromObj(interp, objv[1], &dResult) != TCL_OK) {
|
||||
#ifdef ACCEPT_NAN
|
||||
if (TclHasInternalRep(objv[1], &tclDoubleType)) {
|
||||
if (TclHasInternalRep(objv[1], &tclDoubleType.objType)) {
|
||||
Tcl_SetObjResult(interp, objv[1]);
|
||||
return TCL_OK;
|
||||
}
|
||||
@@ -8474,7 +8474,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);
|
||||
@@ -8657,7 +8657,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 +8672,7 @@ int
|
||||
Tcl_NRCmdSwap(
|
||||
Tcl_Interp *interp,
|
||||
Tcl_Command cmd,
|
||||
size_t objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[],
|
||||
int flags)
|
||||
{
|
||||
@@ -8806,7 +8806,7 @@ TclNRTailcallObjCmd(
|
||||
|
||||
if (!(iPtr->varFramePtr->isProcCallFrame & 1)) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"tailcall can only be called from a proc, lambda or method", -1));
|
||||
"tailcall can only be called from a proc, lambda or method", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "TAILCALL", "ILLEGAL", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -8836,7 +8836,7 @@ TclNRTailcallObjCmd(
|
||||
* namespace, the rest the command to be tailcalled.
|
||||
*/
|
||||
|
||||
nsObjPtr = Tcl_NewStringObj(nsPtr->fullName, -1);
|
||||
nsObjPtr = Tcl_NewStringObj(nsPtr->fullName, TCL_INDEX_NONE);
|
||||
listPtr = Tcl_NewListObj(objc, objv);
|
||||
TclListObjSetElement(interp, listPtr, 0, nsObjPtr);
|
||||
|
||||
@@ -8968,7 +8968,7 @@ TclNRYieldObjCmd(
|
||||
|
||||
if (!corPtr) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"yield can only be called in a coroutine", -1));
|
||||
"yield can only be called in a coroutine", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "COROUTINE", "ILLEGAL_YIELD", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -9001,14 +9001,14 @@ TclNRYieldToObjCmd(
|
||||
|
||||
if (!corPtr) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"yieldto can only be called in a coroutine", -1));
|
||||
"yieldto can only be called in a coroutine", TCL_INDEX_NONE));
|
||||
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", -1));
|
||||
"yieldto called in deleted namespace", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "COROUTINE", "YIELDTO_IN_DELETED",
|
||||
NULL);
|
||||
return TCL_ERROR;
|
||||
@@ -9021,7 +9021,7 @@ TclNRYieldToObjCmd(
|
||||
*/
|
||||
|
||||
listPtr = Tcl_NewListObj(objc, objv);
|
||||
nsObjPtr = Tcl_NewStringObj(nsPtr->fullName, -1);
|
||||
nsObjPtr = Tcl_NewStringObj(nsPtr->fullName, TCL_INDEX_NONE);
|
||||
TclListObjSetElement(interp, listPtr, 0, nsObjPtr);
|
||||
|
||||
/*
|
||||
@@ -9029,6 +9029,7 @@ TclNRYieldToObjCmd(
|
||||
*/
|
||||
|
||||
iPtr->execEnvPtr = corPtr->callerEEPtr;
|
||||
/* Not calling Tcl_IncrRefCount(listPtr) here because listPtr is private */
|
||||
TclSetTailcall(interp, listPtr);
|
||||
corPtr->yieldPtr = listPtr;
|
||||
iPtr->execEnvPtr = corPtr->eePtr;
|
||||
@@ -9231,8 +9232,8 @@ TclNRCoroutineActivateCallback(
|
||||
if (corPtr->yieldPtr) {
|
||||
for (runPtr = TOP_CB(interp); runPtr; runPtr = runPtr->nextPtr) {
|
||||
if (runPtr->data[1] == corPtr->yieldPtr) {
|
||||
Tcl_DecrRefCount((Tcl_Obj *)runPtr->data[1]);
|
||||
runPtr->data[1] = NULL;
|
||||
Tcl_DecrRefCount(corPtr->yieldPtr);
|
||||
corPtr->yieldPtr = NULL;
|
||||
break;
|
||||
}
|
||||
@@ -9242,7 +9243,7 @@ TclNRCoroutineActivateCallback(
|
||||
|
||||
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"cannot yield: C stack busy", -1));
|
||||
"cannot yield: C stack busy", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "COROUTINE", "CANT_YIELD",
|
||||
NULL);
|
||||
return TCL_ERROR;
|
||||
@@ -9331,7 +9332,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", -1));
|
||||
"can only get coroutine type of a coroutine", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "COROUTINE",
|
||||
TclGetString(objv[1]), NULL);
|
||||
return TCL_ERROR;
|
||||
@@ -9344,7 +9345,7 @@ CoroTypeObjCmd(
|
||||
|
||||
corPtr = (CoroutineData *)cmdPtr->objClientData;
|
||||
if (!COR_IS_SUSPENDED(corPtr)) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj("active", -1));
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj("active", TCL_INDEX_NONE));
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
@@ -9355,14 +9356,14 @@ CoroTypeObjCmd(
|
||||
|
||||
switch (corPtr->nargs) {
|
||||
case COROUTINE_ARGUMENTS_SINGLE_OPTIONAL:
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj("yield", -1));
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj("yield", TCL_INDEX_NONE));
|
||||
return TCL_OK;
|
||||
case COROUTINE_ARGUMENTS_ARBITRARY:
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj("yieldto", -1));
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj("yieldto", TCL_INDEX_NONE));
|
||||
return TCL_OK;
|
||||
default:
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"unknown coroutine type", -1));
|
||||
"unknown coroutine type", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "COROUTINE", "BAD_TYPE", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -9391,7 +9392,7 @@ GetCoroutineFromObj(
|
||||
Command *cmdPtr = (Command *) Tcl_GetCommandFromObj(interp, objPtr);
|
||||
|
||||
if ((!cmdPtr) || (cmdPtr->nreProc != TclNRInterpCoroutine)) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(errMsg, -1));
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(errMsg, TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "COROUTINE",
|
||||
TclGetString(objPtr), NULL);
|
||||
return NULL;
|
||||
@@ -9425,7 +9426,7 @@ TclNRCoroInjectObjCmd(
|
||||
}
|
||||
if (!COR_IS_SUSPENDED(corPtr)) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"can only inject a command into a suspended coroutine", -1));
|
||||
"can only inject a command into a suspended coroutine", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "COROUTINE", "ACTIVE", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -9553,24 +9554,25 @@ InjectHandler(
|
||||
Tcl_Obj **objv;
|
||||
|
||||
if (!isProbe) {
|
||||
/*
|
||||
* If this is [coroinject], add the extra arguments now.
|
||||
*/
|
||||
/*
|
||||
* If this is [coroinject], add the extra arguments now.
|
||||
*/
|
||||
|
||||
if (nargs == COROUTINE_ARGUMENTS_SINGLE_OPTIONAL) {
|
||||
Tcl_ListObjAppendElement(NULL, listPtr,
|
||||
Tcl_NewStringObj("yield", -1));
|
||||
} else if (nargs == COROUTINE_ARGUMENTS_ARBITRARY) {
|
||||
Tcl_ListObjAppendElement(NULL, listPtr,
|
||||
Tcl_NewStringObj("yieldto", -1));
|
||||
} else {
|
||||
/*
|
||||
* I don't think this is reachable...
|
||||
*/
|
||||
|
||||
Tcl_ListObjAppendElement(NULL, listPtr, Tcl_NewWideIntObj((Tcl_WideInt)(nargs + 1U) - 1));
|
||||
}
|
||||
Tcl_ListObjAppendElement(NULL, listPtr, Tcl_GetObjResult(interp));
|
||||
if (nargs == COROUTINE_ARGUMENTS_SINGLE_OPTIONAL) {
|
||||
Tcl_ListObjAppendElement(NULL, listPtr,
|
||||
Tcl_NewStringObj("yield", TCL_INDEX_NONE));
|
||||
} else if (nargs == COROUTINE_ARGUMENTS_ARBITRARY) {
|
||||
Tcl_ListObjAppendElement(NULL, listPtr,
|
||||
Tcl_NewStringObj("yieldto", TCL_INDEX_NONE));
|
||||
} else {
|
||||
/*
|
||||
* I don't think this is reachable...
|
||||
*/
|
||||
Tcl_Obj *nargsObj;
|
||||
TclNewIndexObj(nargsObj, nargs);
|
||||
Tcl_ListObjAppendElement(NULL, listPtr, nargsObj);
|
||||
}
|
||||
Tcl_ListObjAppendElement(NULL, listPtr, Tcl_GetObjResult(interp));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -9661,7 +9663,7 @@ NRInjectObjCmd(
|
||||
}
|
||||
if (!COR_IS_SUSPENDED(corPtr)) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"can only inject a command into a suspended coroutine", -1));
|
||||
"can only inject a command into a suspended coroutine", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "COROUTINE", "ACTIVE", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -9715,7 +9717,7 @@ TclNRInterpCoroutine(
|
||||
if (corPtr->nargs + 1 != (size_t)objc) {
|
||||
Tcl_SetObjResult(interp,
|
||||
Tcl_NewStringObj("wrong coro nargs; how did we get here? "
|
||||
"not implemented!", -1));
|
||||
"not implemented!", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "WRONGARGS", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -9833,6 +9835,7 @@ TclNRCoroutineObjCmd(
|
||||
corPtr->running.lineLABCPtr = corPtr->lineLABCPtr;
|
||||
corPtr->stackLevel = NULL;
|
||||
corPtr->auxNumLevels = 0;
|
||||
corPtr->yieldPtr = NULL;
|
||||
|
||||
/*
|
||||
* Create the coro's execEnv, switch to it to push the exit and coro
|
||||
|
||||
+31
-27
@@ -222,7 +222,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 +265,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 +282,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 +313,7 @@ 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 */
|
||||
{
|
||||
ByteArray *byteArrayPtr;
|
||||
Tcl_ObjInternalRep ir;
|
||||
@@ -395,7 +395,7 @@ TclGetBytesFromObj(
|
||||
|
||||
if (interp) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"byte sequence length exceeds INT_MAX", -1));
|
||||
"byte sequence length exceeds INT_MAX", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "API", "OUTDATED", NULL);
|
||||
}
|
||||
return NULL;
|
||||
@@ -431,7 +431,7 @@ 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 */
|
||||
{
|
||||
ByteArray *byteArrayPtr;
|
||||
Tcl_ObjInternalRep *irPtr;
|
||||
@@ -494,7 +494,7 @@ MakeByteArray(
|
||||
size_t length;
|
||||
const char *src = Tcl_GetStringFromObj(objPtr, &length);
|
||||
size_t numBytes
|
||||
= (limit != TCL_INDEX_NONE && limit < length) ? limit : length;
|
||||
= (!TCL_SIZE_ISNEG(limit) && limit < length) ? limit : length;
|
||||
ByteArray *byteArrayPtr = (ByteArray *)Tcl_Alloc(BYTEARRAY_SIZE(numBytes));
|
||||
unsigned char *dst = byteArrayPtr->bytes;
|
||||
unsigned char *dstEnd = dst + numBytes;
|
||||
@@ -530,7 +530,7 @@ MakeByteArray(
|
||||
return proper;
|
||||
}
|
||||
|
||||
Tcl_Obj *
|
||||
static Tcl_Obj *
|
||||
TclNarrowToBytes(
|
||||
Tcl_Obj *objPtr)
|
||||
{
|
||||
@@ -730,7 +730,7 @@ TclAppendBytesToByteArray(
|
||||
if (Tcl_IsShared(objPtr)) {
|
||||
Tcl_Panic("%s called with shared object","TclAppendBytesToByteArray");
|
||||
}
|
||||
if (len == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(len)) {
|
||||
Tcl_Panic("%s must be called with definite number of bytes to append",
|
||||
"TclAppendBytesToByteArray");
|
||||
}
|
||||
@@ -912,9 +912,9 @@ BinaryFormatCmd(
|
||||
goto badIndex;
|
||||
}
|
||||
if (count == BINARY_ALL) {
|
||||
Tcl_Obj *copy = TclNarrowToBytes(objv[arg]);
|
||||
(void)Tcl_GetByteArrayFromObj(copy, &count);
|
||||
Tcl_DecrRefCount(copy);
|
||||
if (Tcl_GetByteArrayFromObj(objv[arg], &count) == NULL) {
|
||||
count = Tcl_GetCharLength(objv[arg]);
|
||||
}
|
||||
} else if (count == BINARY_NOCOUNT) {
|
||||
count = 1;
|
||||
}
|
||||
@@ -978,20 +978,24 @@ BinaryFormatCmd(
|
||||
* The macro evals its args more than once: avoid arg++
|
||||
*/
|
||||
|
||||
if (TclListObjGetElementsM(interp, objv[arg], &listc,
|
||||
&listv) != TCL_OK) {
|
||||
if (TclListObjLengthM(interp, objv[arg], &listc
|
||||
) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
arg++;
|
||||
|
||||
if (count == BINARY_ALL) {
|
||||
count = listc;
|
||||
} else if (count > listc) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"number of elements in list does not match count",
|
||||
-1));
|
||||
TCL_INDEX_NONE));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (TclListObjGetElementsM(interp, objv[arg], &listc,
|
||||
&listv) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
arg++;
|
||||
}
|
||||
offset += count*size;
|
||||
break;
|
||||
@@ -999,7 +1003,7 @@ BinaryFormatCmd(
|
||||
case 'x':
|
||||
if (count == BINARY_ALL) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"cannot use \"*\" in format string with \"x\"", -1));
|
||||
"cannot use \"*\" in format string with \"x\"", TCL_INDEX_NONE));
|
||||
return TCL_ERROR;
|
||||
} else if (count == BINARY_NOCOUNT) {
|
||||
count = 1;
|
||||
@@ -1339,7 +1343,7 @@ BinaryFormatCmd(
|
||||
}
|
||||
|
||||
error:
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(errorString, -1));
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(errorString, TCL_INDEX_NONE));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
@@ -1720,7 +1724,7 @@ BinaryScanCmd(
|
||||
}
|
||||
|
||||
error:
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(errorString, -1));
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(errorString, TCL_INDEX_NONE));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
@@ -2017,7 +2021,7 @@ FormatNumber(
|
||||
*/
|
||||
|
||||
if (Tcl_GetDoubleFromObj(interp, src, &dvalue) != TCL_OK) {
|
||||
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(src, &tclDoubleType);
|
||||
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(src, &tclDoubleType.objType);
|
||||
if (irPtr == NULL) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -2037,7 +2041,7 @@ FormatNumber(
|
||||
*/
|
||||
|
||||
if (Tcl_GetDoubleFromObj(interp, src, &dvalue) != TCL_OK) {
|
||||
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(src, &tclDoubleType);
|
||||
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(src, &tclDoubleType.objType);
|
||||
|
||||
if (irPtr == NULL) {
|
||||
return TCL_ERROR;
|
||||
@@ -2524,7 +2528,7 @@ BinaryDecodeHex(
|
||||
}
|
||||
|
||||
TclNewObj(resultObj);
|
||||
data = Tcl_GetBytesFromObj(NULL, objv[objc - 1], &count);
|
||||
data = Tcl_GetByteArrayFromObj(objv[objc - 1], &count);
|
||||
if (data == NULL) {
|
||||
pure = 0;
|
||||
data = (unsigned char *) Tcl_GetStringFromObj(objv[objc - 1], &count);
|
||||
@@ -2650,14 +2654,14 @@ BinaryEncode64(
|
||||
}
|
||||
if (maxlen < 0) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"line length out of range", -1));
|
||||
"line length out of range", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "BINARY", "ENCODE",
|
||||
"LINE_LENGTH", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
break;
|
||||
case OPT_WRAPCHAR:
|
||||
wrapchar = (const char *)Tcl_GetBytesFromObj(NULL,
|
||||
wrapchar = (const char *)Tcl_GetByteArrayFromObj(
|
||||
objv[i + 1], &wrapcharlen);
|
||||
if (wrapchar == NULL) {
|
||||
purewrap = 0;
|
||||
@@ -2778,7 +2782,7 @@ BinaryEncodeUu(
|
||||
}
|
||||
if (lineLength < 5 || lineLength > 85) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"line length out of range", -1));
|
||||
"line length out of range", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "BINARY", "ENCODE",
|
||||
"LINE_LENGTH", NULL);
|
||||
return TCL_ERROR;
|
||||
@@ -2928,7 +2932,7 @@ BinaryDecodeUu(
|
||||
}
|
||||
|
||||
TclNewObj(resultObj);
|
||||
data = Tcl_GetBytesFromObj(NULL, objv[objc - 1], &count);
|
||||
data = Tcl_GetByteArrayFromObj(objv[objc - 1], &count);
|
||||
if (data == NULL) {
|
||||
pure = 0;
|
||||
data = (unsigned char *) Tcl_GetStringFromObj(objv[objc - 1], &count);
|
||||
@@ -3103,7 +3107,7 @@ BinaryDecode64(
|
||||
}
|
||||
|
||||
TclNewObj(resultObj);
|
||||
data = Tcl_GetBytesFromObj(NULL, objv[objc - 1], &count);
|
||||
data = Tcl_GetByteArrayFromObj(objv[objc - 1], &count);
|
||||
if (data == NULL) {
|
||||
pure = 0;
|
||||
data = (unsigned char *) Tcl_GetStringFromObj(objv[objc - 1], &count);
|
||||
|
||||
+18
-18
@@ -172,7 +172,7 @@ TclDumpMemoryInfo(
|
||||
if (clientData == NULL) {
|
||||
return 0;
|
||||
}
|
||||
sprintf(buf,
|
||||
snprintf(buf, sizeof(buf),
|
||||
"total mallocs %10" TCL_Z_MODIFIER "u\n"
|
||||
"total frees %10" TCL_Z_MODIFIER "u\n"
|
||||
"current packets allocated %10" TCL_Z_MODIFIER "u\n"
|
||||
@@ -189,7 +189,7 @@ TclDumpMemoryInfo(
|
||||
fprintf((FILE *)clientData, "%s", buf);
|
||||
} else {
|
||||
/* Assume objPtr to append to */
|
||||
Tcl_AppendToObj((Tcl_Obj *) clientData, buf, -1);
|
||||
Tcl_AppendToObj((Tcl_Obj *) clientData, buf, TCL_INDEX_NONE);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@@ -382,7 +382,7 @@ Tcl_DumpActiveMemory(
|
||||
|
||||
void *
|
||||
Tcl_DbCkalloc(
|
||||
size_t size,
|
||||
TCL_HASH_TYPE size,
|
||||
const char *file,
|
||||
int line)
|
||||
{
|
||||
@@ -472,7 +472,7 @@ Tcl_DbCkalloc(
|
||||
|
||||
void *
|
||||
Tcl_AttemptDbCkalloc(
|
||||
size_t size,
|
||||
TCL_HASH_TYPE size,
|
||||
const char *file,
|
||||
int line)
|
||||
{
|
||||
@@ -657,7 +657,7 @@ Tcl_DbCkfree(
|
||||
void *
|
||||
Tcl_DbCkrealloc(
|
||||
void *ptr,
|
||||
size_t size,
|
||||
TCL_HASH_TYPE size,
|
||||
const char *file,
|
||||
int line)
|
||||
{
|
||||
@@ -688,7 +688,7 @@ Tcl_DbCkrealloc(
|
||||
void *
|
||||
Tcl_AttemptDbCkrealloc(
|
||||
void *ptr,
|
||||
size_t size,
|
||||
TCL_HASH_TYPE size,
|
||||
const char *file,
|
||||
int line)
|
||||
{
|
||||
@@ -739,14 +739,14 @@ Tcl_AttemptDbCkrealloc(
|
||||
|
||||
void *
|
||||
Tcl_Alloc(
|
||||
size_t size)
|
||||
TCL_HASH_TYPE size)
|
||||
{
|
||||
return Tcl_DbCkalloc(size, "unknown", 0);
|
||||
}
|
||||
|
||||
void *
|
||||
Tcl_AttemptAlloc(
|
||||
size_t size)
|
||||
TCL_HASH_TYPE size)
|
||||
{
|
||||
return Tcl_AttemptDbCkalloc(size, "unknown", 0);
|
||||
}
|
||||
@@ -761,14 +761,14 @@ Tcl_Free(
|
||||
void *
|
||||
Tcl_Realloc(
|
||||
void *ptr,
|
||||
size_t size)
|
||||
TCL_HASH_TYPE size)
|
||||
{
|
||||
return Tcl_DbCkrealloc(ptr, size, "unknown", 0);
|
||||
}
|
||||
void *
|
||||
Tcl_AttemptRealloc(
|
||||
void *ptr,
|
||||
size_t size)
|
||||
TCL_HASH_TYPE size)
|
||||
{
|
||||
return Tcl_AttemptDbCkrealloc(ptr, size, "unknown", 0);
|
||||
}
|
||||
@@ -1032,7 +1032,7 @@ Tcl_InitMemory(
|
||||
|
||||
void *
|
||||
Tcl_Alloc(
|
||||
size_t size)
|
||||
TCL_HASH_TYPE size)
|
||||
{
|
||||
void *result = TclpAlloc(size);
|
||||
|
||||
@@ -1054,7 +1054,7 @@ Tcl_Alloc(
|
||||
|
||||
void *
|
||||
Tcl_DbCkalloc(
|
||||
size_t size,
|
||||
TCL_HASH_TYPE size,
|
||||
const char *file,
|
||||
int line)
|
||||
{
|
||||
@@ -1081,14 +1081,14 @@ Tcl_DbCkalloc(
|
||||
|
||||
void *
|
||||
Tcl_AttemptAlloc(
|
||||
size_t size)
|
||||
TCL_HASH_TYPE size)
|
||||
{
|
||||
return (char *)TclpAlloc(size);
|
||||
}
|
||||
|
||||
void *
|
||||
Tcl_AttemptDbCkalloc(
|
||||
size_t size,
|
||||
TCL_HASH_TYPE size,
|
||||
TCL_UNUSED(const char *) /*file*/,
|
||||
TCL_UNUSED(int) /*line*/)
|
||||
{
|
||||
@@ -1109,7 +1109,7 @@ Tcl_AttemptDbCkalloc(
|
||||
void *
|
||||
Tcl_Realloc(
|
||||
void *ptr,
|
||||
size_t size)
|
||||
TCL_HASH_TYPE size)
|
||||
{
|
||||
void *result = TclpRealloc(ptr, size);
|
||||
|
||||
@@ -1122,7 +1122,7 @@ Tcl_Realloc(
|
||||
void *
|
||||
Tcl_DbCkrealloc(
|
||||
void *ptr,
|
||||
size_t size,
|
||||
TCL_HASH_TYPE size,
|
||||
const char *file,
|
||||
int line)
|
||||
{
|
||||
@@ -1150,7 +1150,7 @@ Tcl_DbCkrealloc(
|
||||
void *
|
||||
Tcl_AttemptRealloc(
|
||||
void *ptr,
|
||||
size_t size)
|
||||
TCL_HASH_TYPE size)
|
||||
{
|
||||
return (char *)TclpRealloc(ptr, size);
|
||||
}
|
||||
@@ -1158,7 +1158,7 @@ Tcl_AttemptRealloc(
|
||||
void *
|
||||
Tcl_AttemptDbCkrealloc(
|
||||
void *ptr,
|
||||
size_t size,
|
||||
TCL_HASH_TYPE size,
|
||||
TCL_UNUSED(const char *) /*file*/,
|
||||
TCL_UNUSED(int) /*line*/)
|
||||
{
|
||||
|
||||
+13
-7
@@ -14,6 +14,7 @@
|
||||
*/
|
||||
|
||||
#include "tclInt.h"
|
||||
#include "tclTomMath.h"
|
||||
|
||||
/*
|
||||
* Windows has mktime. The configurators do not check.
|
||||
@@ -432,7 +433,7 @@ ClockGetdatefieldsObjCmd(
|
||||
* that it isn't.
|
||||
*/
|
||||
|
||||
if (TclHasInternalRep(objv[1], &tclBignumType)) {
|
||||
if (TclHasInternalRep(objv[1], &tclBignumType.objType)) {
|
||||
Tcl_SetObjResult(interp, lit[LIT_INTEGER_VALUE_TOO_LARGE]);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -1085,12 +1086,12 @@ ConvertUTCToLocalUsingC(
|
||||
} else {
|
||||
*buffer = '+';
|
||||
}
|
||||
sprintf(buffer+1, "%02d", diff / 3600);
|
||||
snprintf(buffer+1, sizeof(buffer) - 1, "%02d", diff / 3600);
|
||||
diff %= 3600;
|
||||
sprintf(buffer+3, "%02d", diff / 60);
|
||||
snprintf(buffer+3, sizeof(buffer) - 3, "%02d", diff / 60);
|
||||
diff %= 60;
|
||||
if (diff > 0) {
|
||||
sprintf(buffer+5, "%02d", diff);
|
||||
snprintf(buffer+5, sizeof(buffer) - 5, "%02d", diff);
|
||||
}
|
||||
fields->tzName = Tcl_NewStringObj(buffer, -1);
|
||||
Tcl_IncrRefCount(fields->tzName);
|
||||
@@ -1804,14 +1805,16 @@ ClockMillisecondsObjCmd(
|
||||
Tcl_Obj *const *objv) /* Parameter values */
|
||||
{
|
||||
Tcl_Time now;
|
||||
Tcl_Obj *timeObj;
|
||||
|
||||
if (objc != 1) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
Tcl_GetTime(&now);
|
||||
Tcl_SetObjResult(interp, Tcl_NewWideIntObj((Tcl_WideInt)
|
||||
now.sec * 1000 + now.usec / 1000));
|
||||
TclNewUIntObj(timeObj, (Tcl_WideUInt)
|
||||
now.sec * 1000 + now.usec / 1000);
|
||||
Tcl_SetObjResult(interp, timeObj);
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
@@ -1992,13 +1995,16 @@ ClockSecondsObjCmd(
|
||||
Tcl_Obj *const *objv) /* Parameter values */
|
||||
{
|
||||
Tcl_Time now;
|
||||
Tcl_Obj *timeObj;
|
||||
|
||||
if (objc != 1) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
Tcl_GetTime(&now);
|
||||
Tcl_SetObjResult(interp, Tcl_NewWideIntObj((Tcl_WideInt) now.sec));
|
||||
TclNewUIntObj(timeObj, (Tcl_WideUInt)now.sec);
|
||||
|
||||
Tcl_SetObjResult(interp, timeObj);
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
|
||||
+247
-164
@@ -12,6 +12,8 @@
|
||||
*/
|
||||
|
||||
#include "tclInt.h"
|
||||
#include "tclIO.h"
|
||||
#include "tclTomMath.h"
|
||||
#ifdef _WIN32
|
||||
# include "tclWinInt.h"
|
||||
#endif
|
||||
@@ -50,6 +52,7 @@ static Tcl_ObjCmdProc EncodingConvertfromObjCmd;
|
||||
static Tcl_ObjCmdProc EncodingConverttoObjCmd;
|
||||
static Tcl_ObjCmdProc EncodingDirsObjCmd;
|
||||
static Tcl_ObjCmdProc EncodingNamesObjCmd;
|
||||
static Tcl_ObjCmdProc EncodingProfilesObjCmd;
|
||||
static Tcl_ObjCmdProc EncodingSystemObjCmd;
|
||||
static inline int ForeachAssignments(Tcl_Interp *interp,
|
||||
struct ForeachState *statePtr);
|
||||
@@ -385,6 +388,7 @@ TclInitEncodingCmd(
|
||||
{"convertto", EncodingConverttoObjCmd, TclCompileBasic1To3ArgCmd, NULL, NULL, 0},
|
||||
{"dirs", EncodingDirsObjCmd, TclCompileBasic0Or1ArgCmd, NULL, NULL, 1},
|
||||
{"names", EncodingNamesObjCmd, TclCompileBasic0ArgCmd, NULL, NULL, 0},
|
||||
{"profiles", EncodingProfilesObjCmd, TclCompileBasic0ArgCmd, NULL, NULL, 0},
|
||||
{"system", EncodingSystemObjCmd, TclCompileBasic0Or1ArgCmd, NULL, NULL, 1},
|
||||
{NULL, NULL, NULL, NULL, NULL, 0}
|
||||
};
|
||||
@@ -392,6 +396,116 @@ TclInitEncodingCmd(
|
||||
return TclMakeEnsemble(interp, "encoding", encodingImplMap);
|
||||
}
|
||||
|
||||
/*
|
||||
*------------------------------------------------------------------------
|
||||
*
|
||||
* EncodingConvertParseOptions --
|
||||
*
|
||||
* Common routine for parsing arguments passed to encoding convertfrom
|
||||
* and encoding convertto.
|
||||
*
|
||||
* Results:
|
||||
* TCL_OK or TCL_ERROR.
|
||||
*
|
||||
* Side effects:
|
||||
* On success,
|
||||
* - *encPtr is set to the encoding. Must be freed with Tcl_FreeEncoding
|
||||
* if non-NULL
|
||||
* - *dataObjPtr is set to the Tcl_Obj containing the data to encode or
|
||||
* decode
|
||||
* - *profilePtr is set to encoding error handling profile
|
||||
* - *failVarPtr is set to -failindex option value or NULL
|
||||
* On error, all of the above are uninitialized.
|
||||
*
|
||||
*------------------------------------------------------------------------
|
||||
*/
|
||||
static int
|
||||
EncodingConvertParseOptions (
|
||||
Tcl_Interp *interp, /* For error messages. May be NULL */
|
||||
int objc, /* Number of arguments */
|
||||
Tcl_Obj *const objv[], /* Argument objects as passed to command. */
|
||||
Tcl_Encoding *encPtr, /* Where to store the encoding */
|
||||
Tcl_Obj **dataObjPtr, /* Where to store ptr to Tcl_Obj containing data */
|
||||
int *profilePtr, /* Bit mask of encoding option profile */
|
||||
Tcl_Obj **failVarPtr /* Where to store -failindex option value */
|
||||
)
|
||||
{
|
||||
static const char *const options[] = {"-profile", "-failindex", NULL};
|
||||
enum convertfromOptions { PROFILE, FAILINDEX } optIndex;
|
||||
Tcl_Encoding encoding;
|
||||
Tcl_Obj *dataObj;
|
||||
Tcl_Obj *failVarObj;
|
||||
#if TCL_MAJOR_VERSION > 8 || defined(TCL_NO_DEPRECATED)
|
||||
int profile = TCL_ENCODING_PROFILE_TCL8; /* TODO - default for Tcl9? */
|
||||
#else
|
||||
int profile = TCL_ENCODING_PROFILE_TCL8;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Possible combinations:
|
||||
* 1) data -> objc = 2
|
||||
* 2) ?options? encoding data -> objc >= 3
|
||||
* It is intentional that specifying option forces encoding to be
|
||||
* specified. Less prone to user error. This should have always been
|
||||
* the case even in 8.6 imho where there were no options (ie (1)
|
||||
* should never have been allowed)
|
||||
*/
|
||||
|
||||
if (objc == 1) {
|
||||
numArgsError: /* ONLY jump here if nothing needs to be freed!!! */
|
||||
Tcl_WrongNumArgs(interp,
|
||||
1,
|
||||
objv,
|
||||
"?-profile profile? ?-failindex var? encoding data");
|
||||
((Interp *)interp)->flags |= INTERP_ALTERNATE_WRONG_ARGS;
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "data");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
failVarObj = NULL;
|
||||
if (objc == 2) {
|
||||
encoding = Tcl_GetEncoding(interp, NULL);
|
||||
dataObj = objv[1];
|
||||
} else {
|
||||
int argIndex;
|
||||
for (argIndex = 1; argIndex < (objc-2); ++argIndex) {
|
||||
if (Tcl_GetIndexFromObj(
|
||||
interp, objv[argIndex], options, "option", 0, &optIndex)
|
||||
!= TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (++argIndex == (objc - 2)) {
|
||||
goto numArgsError;
|
||||
}
|
||||
switch (optIndex) {
|
||||
case PROFILE:
|
||||
if (TclEncodingProfileNameToId(interp,
|
||||
Tcl_GetString(objv[argIndex]),
|
||||
&profile) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
break;
|
||||
case FAILINDEX:
|
||||
failVarObj = objv[argIndex];
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* Get encoding after opts so no need to free it on option error */
|
||||
if (Tcl_GetEncodingFromObj(interp, objv[objc - 2], &encoding)
|
||||
!= TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
dataObj = objv[objc - 1];
|
||||
}
|
||||
|
||||
*encPtr = encoding;
|
||||
*dataObjPtr = dataObj;
|
||||
*profilePtr = profile;
|
||||
*failVarPtr = failVarObj;
|
||||
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
@@ -418,104 +532,74 @@ EncodingConvertfromObjCmd(
|
||||
Tcl_Encoding encoding; /* Encoding to use */
|
||||
size_t length = 0; /* Length of the byte array being converted */
|
||||
const char *bytesPtr; /* Pointer to the first byte of the array */
|
||||
int flags = 0;
|
||||
size_t result;
|
||||
Tcl_Obj *failVarObj = NULL;
|
||||
/*
|
||||
* Decode parameters:
|
||||
* Possible combinations:
|
||||
* 1) data -> objc = 2
|
||||
* 2) encoding data -> objc = 3
|
||||
* 3) -nocomplain data -> objc = 3
|
||||
* 4) -nocomplain encoding data -> objc = 4
|
||||
* 5) -strict data -> objc = 3
|
||||
* 6) -strict encoding data -> objc = 4
|
||||
* 7) -failindex val data -> objc = 4
|
||||
* 8) -failindex val encoding data -> objc = 5
|
||||
*/
|
||||
int flags;
|
||||
int result;
|
||||
Tcl_Obj *failVarObj;
|
||||
Tcl_Size errorLocation;
|
||||
|
||||
if (objc == 2) {
|
||||
encoding = Tcl_GetEncoding(interp, NULL);
|
||||
data = objv[1];
|
||||
} else if (objc > 2 && objc < 6) {
|
||||
int objcUnprocessed = objc;
|
||||
data = objv[objc - 1];
|
||||
bytesPtr = Tcl_GetString(objv[1]);
|
||||
if (bytesPtr[0] == '-' && bytesPtr[1] == 'n'
|
||||
&& !strncmp(bytesPtr, "-nocomplain", strlen(bytesPtr))) {
|
||||
flags = TCL_ENCODING_NOCOMPLAIN;
|
||||
objcUnprocessed--;
|
||||
} else if (bytesPtr[0] == '-' && bytesPtr[1] == 's'
|
||||
&& !strncmp(bytesPtr, "-strict", strlen(bytesPtr))) {
|
||||
flags = TCL_ENCODING_STRICT;
|
||||
objcUnprocessed--;
|
||||
} else if (bytesPtr[0] == '-' && bytesPtr[1] == 'f'
|
||||
&& !strncmp(bytesPtr, "-failindex", strlen(bytesPtr))) {
|
||||
/* at least two additional arguments needed */
|
||||
if (objc < 4) {
|
||||
goto encConvFromError;
|
||||
}
|
||||
failVarObj = objv[2];
|
||||
objcUnprocessed -= 2;
|
||||
}
|
||||
switch (objcUnprocessed) {
|
||||
case 3:
|
||||
if (Tcl_GetEncodingFromObj(interp, objv[objc - 2], &encoding) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
encoding = Tcl_GetEncoding(interp, NULL);
|
||||
break;
|
||||
default:
|
||||
goto encConvFromError;
|
||||
}
|
||||
} else {
|
||||
encConvFromError:
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "?-nocomplain? ?-strict? ?-failindex var? ?encoding? data");
|
||||
if (EncodingConvertParseOptions(
|
||||
interp, objc, objv, &encoding, &data, &flags, &failVarObj)
|
||||
!= TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert the string into a byte array in 'ds'
|
||||
* Convert the string into a byte array in 'ds'.
|
||||
*/
|
||||
bytesPtr = (char *) Tcl_GetBytesFromObj(interp, data, &length);
|
||||
|
||||
if (bytesPtr == NULL) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
result = Tcl_ExternalToUtfDStringEx(encoding, bytesPtr, length,
|
||||
flags, &ds);
|
||||
if ((!(flags & TCL_ENCODING_NOCOMPLAIN) || ((flags & TCL_ENCODING_STRICT) == TCL_ENCODING_STRICT)) && (result != TCL_INDEX_NONE)) {
|
||||
if (failVarObj != NULL) {
|
||||
if (Tcl_ObjSetVar2(interp, failVarObj, NULL, Tcl_NewWideIntObj(result), TCL_LEAVE_ERR_MSG) == NULL) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
} else {
|
||||
char buf[TCL_INTEGER_SPACE];
|
||||
sprintf(buf, "%" TCL_Z_MODIFIER "u", result);
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf("unexpected byte sequence starting at index %"
|
||||
TCL_Z_MODIFIER "u: '\\x%X'", result, UCHAR(bytesPtr[result])));
|
||||
Tcl_SetErrorCode(interp, "TCL", "ENCODING", "ILLEGALSEQUENCE",
|
||||
buf, NULL);
|
||||
result = Tcl_ExternalToUtfDStringEx(interp, encoding, bytesPtr, length, flags,
|
||||
&ds, failVarObj ? &errorLocation : NULL);
|
||||
/* NOTE: ds must be freed beyond this point even on error */
|
||||
switch (result) {
|
||||
case TCL_OK:
|
||||
errorLocation = TCL_INDEX_NONE;
|
||||
break;
|
||||
case TCL_ERROR:
|
||||
/* Error in parameters. Should not happen. interp will have error */
|
||||
Tcl_DStringFree(&ds);
|
||||
return TCL_ERROR;
|
||||
default:
|
||||
/*
|
||||
* One of the TCL_CONVERT_* errors. If we were not interested in the
|
||||
* error location, interp result would already have been filled in
|
||||
* and we can just return the error. Otherwise, we have to return
|
||||
* what could be decoded and the returned error location.
|
||||
*/
|
||||
if (failVarObj == NULL) {
|
||||
Tcl_DStringFree(&ds);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* TCL_OK or a TCL_CONVERT_* error where the caller wants back as much
|
||||
* data as was converted.
|
||||
*/
|
||||
if (failVarObj) {
|
||||
Tcl_Obj *failIndex;
|
||||
TclNewIndexObj(failIndex, errorLocation);
|
||||
if (Tcl_ObjSetVar2(interp,
|
||||
failVarObj,
|
||||
NULL,
|
||||
failIndex,
|
||||
TCL_LEAVE_ERR_MSG) == NULL) {
|
||||
Tcl_DStringFree(&ds);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
} else if (failVarObj != NULL) {
|
||||
if (Tcl_ObjSetVar2(interp, failVarObj, NULL, Tcl_NewIntObj(-1), TCL_LEAVE_ERR_MSG) == NULL) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Note that we cannot use Tcl_DStringResult here because it will
|
||||
* truncate the string at the first null byte.
|
||||
*/
|
||||
|
||||
Tcl_SetObjResult(interp, TclDStringToObj(&ds));
|
||||
Tcl_SetObjResult(interp, Tcl_DStringToObj(&ds));
|
||||
|
||||
/*
|
||||
* We're done with the encoding
|
||||
*/
|
||||
/* We're done with the encoding */
|
||||
|
||||
Tcl_FreeEncoding(encoding);
|
||||
return TCL_OK;
|
||||
@@ -548,60 +632,14 @@ EncodingConverttoObjCmd(
|
||||
Tcl_Encoding encoding; /* Encoding to use */
|
||||
size_t length; /* Length of the string being converted */
|
||||
const char *stringPtr; /* Pointer to the first byte of the string */
|
||||
size_t result;
|
||||
int flags = 0;
|
||||
Tcl_Obj *failVarObj = NULL;
|
||||
int result;
|
||||
int flags;
|
||||
Tcl_Obj *failVarObj;
|
||||
Tcl_Size errorLocation;
|
||||
|
||||
/*
|
||||
* Decode parameters:
|
||||
* Possible combinations:
|
||||
* 1) data -> objc = 2
|
||||
* 2) encoding data -> objc = 3
|
||||
* 3) -nocomplain data -> objc = 3
|
||||
* 4) -nocomplain encoding data -> objc = 4
|
||||
* 5) -failindex val data -> objc = 4
|
||||
* 6) -failindex val encoding data -> objc = 5
|
||||
*/
|
||||
|
||||
if (objc == 2) {
|
||||
encoding = Tcl_GetEncoding(interp, NULL);
|
||||
data = objv[1];
|
||||
} else if (objc > 2 && objc < 6) {
|
||||
int objcUnprocessed = objc;
|
||||
data = objv[objc - 1];
|
||||
stringPtr = Tcl_GetString(objv[1]);
|
||||
if (stringPtr[0] == '-' && stringPtr[1] == 'n'
|
||||
&& !strncmp(stringPtr, "-nocomplain", strlen(stringPtr))) {
|
||||
flags = TCL_ENCODING_NOCOMPLAIN;
|
||||
objcUnprocessed--;
|
||||
} else if (stringPtr[0] == '-' && stringPtr[1] == 's'
|
||||
&& !strncmp(stringPtr, "-strict", strlen(stringPtr))) {
|
||||
flags = TCL_ENCODING_STRICT;
|
||||
objcUnprocessed--;
|
||||
} else if (stringPtr[0] == '-' && stringPtr[1] == 'f'
|
||||
&& !strncmp(stringPtr, "-failindex", strlen(stringPtr))) {
|
||||
/* at least two additional arguments needed */
|
||||
if (objc < 4) {
|
||||
goto encConvToError;
|
||||
}
|
||||
failVarObj = objv[2];
|
||||
objcUnprocessed -= 2;
|
||||
}
|
||||
switch (objcUnprocessed) {
|
||||
case 3:
|
||||
if (Tcl_GetEncodingFromObj(interp, objv[objc - 2], &encoding) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
encoding = Tcl_GetEncoding(interp, NULL);
|
||||
break;
|
||||
default:
|
||||
goto encConvToError;
|
||||
}
|
||||
} else {
|
||||
encConvToError:
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "?-nocomplain? ?-strict? ?-failindex var? ?encoding? data");
|
||||
if (EncodingConvertParseOptions(
|
||||
interp, objc, objv, &encoding, &data, &flags, &failVarObj)
|
||||
!= TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
@@ -610,40 +648,54 @@ EncodingConverttoObjCmd(
|
||||
*/
|
||||
|
||||
stringPtr = Tcl_GetStringFromObj(data, &length);
|
||||
result = Tcl_UtfToExternalDStringEx(encoding, stringPtr, length,
|
||||
flags, &ds);
|
||||
if ((!(flags & TCL_ENCODING_NOCOMPLAIN) || ((flags & TCL_ENCODING_STRICT) == TCL_ENCODING_STRICT)) && (result != TCL_INDEX_NONE)) {
|
||||
if (failVarObj != NULL) {
|
||||
/* I hope, wide int will cover size_t data type */
|
||||
if (Tcl_ObjSetVar2(interp, failVarObj, NULL, Tcl_NewWideIntObj(result), TCL_LEAVE_ERR_MSG) == NULL) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
} else {
|
||||
size_t pos = Tcl_NumUtfChars(stringPtr, result);
|
||||
int ucs4;
|
||||
char buf[TCL_INTEGER_SPACE];
|
||||
TclUtfToUCS4(&stringPtr[result], &ucs4);
|
||||
sprintf(buf, "%" TCL_Z_MODIFIER "u", result);
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf("unexpected character at index %"
|
||||
TCL_Z_MODIFIER "u: 'U+%06X'", pos, ucs4));
|
||||
Tcl_SetErrorCode(interp, "TCL", "ENCODING", "ILLEGALSEQUENCE",
|
||||
buf, NULL);
|
||||
result = Tcl_UtfToExternalDStringEx(interp, encoding, stringPtr, length, flags,
|
||||
&ds, failVarObj ? &errorLocation : NULL);
|
||||
/* NOTE: ds must be freed beyond this point even on error */
|
||||
|
||||
switch (result) {
|
||||
case TCL_OK:
|
||||
errorLocation = TCL_INDEX_NONE;
|
||||
break;
|
||||
case TCL_ERROR:
|
||||
/* Error in parameters. Should not happen. interp will have error */
|
||||
Tcl_DStringFree(&ds);
|
||||
return TCL_ERROR;
|
||||
default:
|
||||
/*
|
||||
* One of the TCL_CONVERT_* errors. If we were not interested in the
|
||||
* error location, interp result would already have been filled in
|
||||
* and we can just return the error. Otherwise, we have to return
|
||||
* what could be decoded and the returned error location.
|
||||
*/
|
||||
if (failVarObj == NULL) {
|
||||
Tcl_DStringFree(&ds);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
break;
|
||||
}
|
||||
/*
|
||||
* TCL_OK or a TCL_CONVERT_* error where the caller wants back as much
|
||||
* data as was converted.
|
||||
*/
|
||||
if (failVarObj) {
|
||||
Tcl_Obj *failIndex;
|
||||
TclNewIndexObj(failIndex, errorLocation);
|
||||
if (Tcl_ObjSetVar2(interp,
|
||||
failVarObj,
|
||||
NULL,
|
||||
failIndex,
|
||||
TCL_LEAVE_ERR_MSG) == NULL) {
|
||||
Tcl_DStringFree(&ds);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
} else if (failVarObj != NULL) {
|
||||
if (Tcl_ObjSetVar2(interp, failVarObj, NULL, Tcl_NewIntObj(-1), TCL_LEAVE_ERR_MSG) == NULL) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
Tcl_SetObjResult(interp,
|
||||
Tcl_NewByteArrayObj((unsigned char*) Tcl_DStringValue(&ds),
|
||||
Tcl_DStringLength(&ds)));
|
||||
Tcl_DStringFree(&ds);
|
||||
|
||||
/*
|
||||
* We're done with the encoding
|
||||
*/
|
||||
/* We're done with the encoding */
|
||||
|
||||
Tcl_FreeEncoding(encoding);
|
||||
return TCL_OK;
|
||||
@@ -725,6 +777,34 @@ EncodingNamesObjCmd(
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
*-----------------------------------------------------------------------------
|
||||
*
|
||||
* EncodingProfilesObjCmd --
|
||||
*
|
||||
* This command returns a list of the available encoding profiles
|
||||
*
|
||||
* Results:
|
||||
* Returns a standard Tcl result
|
||||
*
|
||||
*-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int
|
||||
EncodingProfilesObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp* interp, /* Tcl interpreter */
|
||||
int objc, /* Number of command line args */
|
||||
Tcl_Obj* const objv[]) /* Vector of command line args */
|
||||
{
|
||||
if (objc > 1) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
TclGetEncodingProfiles(interp);
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
*-----------------------------------------------------------------------------
|
||||
*
|
||||
@@ -1912,7 +1992,7 @@ PathNativeNameCmd(
|
||||
if (Tcl_TranslateFileName(interp, TclGetString(objv[1]), &ds) == NULL) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
Tcl_SetObjResult(interp, TclDStringToObj(&ds));
|
||||
Tcl_SetObjResult(interp, Tcl_DStringToObj(&ds));
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
@@ -2712,8 +2792,8 @@ EachloopCmd(
|
||||
result = TCL_ERROR;
|
||||
goto done;
|
||||
}
|
||||
TclListObjGetElementsM(NULL, statePtr->vCopyList[i],
|
||||
&statePtr->varcList[i], &statePtr->varvList[i]);
|
||||
TclListObjLengthM(NULL, statePtr->vCopyList[i],
|
||||
&statePtr->varcList[i]);
|
||||
if (statePtr->varcList[i] < 1) {
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"%s varlist is empty",
|
||||
@@ -2724,17 +2804,19 @@ EachloopCmd(
|
||||
result = TCL_ERROR;
|
||||
goto done;
|
||||
}
|
||||
TclListObjGetElementsM(NULL, statePtr->vCopyList[i],
|
||||
&statePtr->varcList[i], &statePtr->varvList[i]);
|
||||
|
||||
/* Values */
|
||||
if (TclHasInternalRep(objv[2+i*2],&tclArithSeriesType)) {
|
||||
if (TclHasInternalRep(objv[2+i*2],&tclArithSeriesType.objType)) {
|
||||
/* Special case for Arith Series */
|
||||
statePtr->aCopyList[i] = TclArithSeriesObjCopy(interp, objv[2+i*2]);
|
||||
if (statePtr->aCopyList[i] == NULL) {
|
||||
result = TCL_ERROR;
|
||||
goto done;
|
||||
}
|
||||
/* Don't compute values here, wait until the last momement */
|
||||
statePtr->argcList[i] = TclArithSeriesObjLength(statePtr->aCopyList[i]);
|
||||
/* Don't compute values here, wait until the last moment */
|
||||
statePtr->argcList[i] = ABSTRACTLIST_PROC(statePtr->aCopyList[i], lengthProc)(statePtr->aCopyList[i]);
|
||||
} else {
|
||||
/* List values */
|
||||
statePtr->aCopyList[i] = TclListObjCopy(interp, objv[2+i*2]);
|
||||
@@ -2868,12 +2950,13 @@ ForeachAssignments(
|
||||
Tcl_Obj *valuePtr, *varValuePtr;
|
||||
|
||||
for (i=0 ; i<statePtr->numLists ; i++) {
|
||||
int isarithseries = TclHasInternalRep(statePtr->aCopyList[i],&tclArithSeriesType);
|
||||
int isarithseries = TclHasInternalRep(statePtr->aCopyList[i],&tclArithSeriesType.objType);
|
||||
for (v=0 ; v<statePtr->varcList[i] ; v++) {
|
||||
k = statePtr->index[i]++;
|
||||
if (k < statePtr->argcList[i]) {
|
||||
if (isarithseries) {
|
||||
if (TclArithSeriesObjIndex(statePtr->aCopyList[i], k, &valuePtr) != TCL_OK) {
|
||||
valuePtr = TclArithSeriesObjIndex(interp, statePtr->aCopyList[i], k);
|
||||
if (valuePtr == NULL) {
|
||||
Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
|
||||
"\n (setting %s loop variable \"%s\")",
|
||||
(statePtr->resultList != NULL ? "lmap" : "foreach"),
|
||||
|
||||
+58
-53
@@ -504,7 +504,7 @@ InfoArgsCmd(
|
||||
localPtr = localPtr->nextPtr) {
|
||||
if (TclIsVarArgument(localPtr)) {
|
||||
Tcl_ListObjAppendElement(interp, listObjPtr,
|
||||
Tcl_NewStringObj(localPtr->name, -1));
|
||||
Tcl_NewStringObj(localPtr->name, TCL_INDEX_NONE));
|
||||
}
|
||||
}
|
||||
Tcl_SetObjResult(interp, listObjPtr);
|
||||
@@ -716,7 +716,7 @@ InfoCommandsCmd(
|
||||
Tcl_GetCommandFullName(interp, cmd, elemObjPtr);
|
||||
} else {
|
||||
cmdName = (const char *)Tcl_GetHashKey(&nsPtr->cmdTable, entryPtr);
|
||||
elemObjPtr = Tcl_NewStringObj(cmdName, -1);
|
||||
elemObjPtr = Tcl_NewStringObj(cmdName, TCL_INDEX_NONE);
|
||||
}
|
||||
Tcl_ListObjAppendElement(interp, listPtr, elemObjPtr);
|
||||
Tcl_SetObjResult(interp, listPtr);
|
||||
@@ -744,7 +744,7 @@ InfoCommandsCmd(
|
||||
if (entryPtr != NULL) {
|
||||
cmdName = (const char *)Tcl_GetHashKey(tablePtr, entryPtr);
|
||||
Tcl_ListObjAppendElement(interp, listPtr,
|
||||
Tcl_NewStringObj(cmdName, -1));
|
||||
Tcl_NewStringObj(cmdName, TCL_INDEX_NONE));
|
||||
Tcl_SetObjResult(interp, listPtr);
|
||||
return TCL_OK;
|
||||
}
|
||||
@@ -766,7 +766,7 @@ InfoCommandsCmd(
|
||||
elemObjPtr = Tcl_NewObj();
|
||||
Tcl_GetCommandFullName(interp, cmd, elemObjPtr);
|
||||
} else {
|
||||
elemObjPtr = Tcl_NewStringObj(cmdName, -1);
|
||||
elemObjPtr = Tcl_NewStringObj(cmdName, TCL_INDEX_NONE);
|
||||
}
|
||||
Tcl_ListObjAppendElement(interp, listPtr, elemObjPtr);
|
||||
}
|
||||
@@ -789,7 +789,7 @@ InfoCommandsCmd(
|
||||
|| Tcl_StringMatch(cmdName, simplePattern)) {
|
||||
if (Tcl_FindHashEntry(&nsPtr->cmdTable,cmdName) == NULL) {
|
||||
Tcl_ListObjAppendElement(interp, listPtr,
|
||||
Tcl_NewStringObj(cmdName, -1));
|
||||
Tcl_NewStringObj(cmdName, TCL_INDEX_NONE));
|
||||
}
|
||||
}
|
||||
entryPtr = Tcl_NextHashEntry(&search);
|
||||
@@ -818,7 +818,7 @@ InfoCommandsCmd(
|
||||
cmdName = (const char *)Tcl_GetHashKey(&nsPtr->cmdTable, entryPtr);
|
||||
if ((simplePattern == NULL)
|
||||
|| Tcl_StringMatch(cmdName, simplePattern)) {
|
||||
elemObjPtr = Tcl_NewStringObj(cmdName, -1);
|
||||
elemObjPtr = Tcl_NewStringObj(cmdName, TCL_INDEX_NONE);
|
||||
Tcl_ListObjAppendElement(interp, listPtr, elemObjPtr);
|
||||
(void) Tcl_CreateHashEntry(&addedCommandsTable,
|
||||
elemObjPtr, &isNew);
|
||||
@@ -844,7 +844,7 @@ InfoCommandsCmd(
|
||||
cmdName = (const char *)Tcl_GetHashKey(&pathNsPtr->cmdTable, entryPtr);
|
||||
if ((simplePattern == NULL)
|
||||
|| Tcl_StringMatch(cmdName, simplePattern)) {
|
||||
elemObjPtr = Tcl_NewStringObj(cmdName, -1);
|
||||
elemObjPtr = Tcl_NewStringObj(cmdName, TCL_INDEX_NONE);
|
||||
(void) Tcl_CreateHashEntry(&addedCommandsTable,
|
||||
elemObjPtr, &isNew);
|
||||
if (isNew) {
|
||||
@@ -871,7 +871,7 @@ InfoCommandsCmd(
|
||||
cmdName = (const char *)Tcl_GetHashKey(&globalNsPtr->cmdTable, entryPtr);
|
||||
if ((simplePattern == NULL)
|
||||
|| Tcl_StringMatch(cmdName, simplePattern)) {
|
||||
elemObjPtr = Tcl_NewStringObj(cmdName, -1);
|
||||
elemObjPtr = Tcl_NewStringObj(cmdName, TCL_INDEX_NONE);
|
||||
if (Tcl_FindHashEntry(&addedCommandsTable,
|
||||
(char *) elemObjPtr) == NULL) {
|
||||
Tcl_ListObjAppendElement(interp, listPtr, elemObjPtr);
|
||||
@@ -1291,7 +1291,7 @@ TclInfoFrame(
|
||||
* str.
|
||||
*/
|
||||
|
||||
ADD_PAIR("type", Tcl_NewStringObj(typeString[framePtr->type], -1));
|
||||
ADD_PAIR("type", Tcl_NewStringObj(typeString[framePtr->type], TCL_INDEX_NONE));
|
||||
if (framePtr->line) {
|
||||
ADD_PAIR("line", Tcl_NewWideIntObj(framePtr->line[0]));
|
||||
} else {
|
||||
@@ -1305,7 +1305,7 @@ TclInfoFrame(
|
||||
* Precompiled. Result contains the type as signal, nothing else.
|
||||
*/
|
||||
|
||||
ADD_PAIR("type", Tcl_NewStringObj(typeString[framePtr->type], -1));
|
||||
ADD_PAIR("type", Tcl_NewStringObj(typeString[framePtr->type], TCL_INDEX_NONE));
|
||||
break;
|
||||
|
||||
case TCL_LOCATION_BC: {
|
||||
@@ -1330,7 +1330,7 @@ TclInfoFrame(
|
||||
* Possibly modified: type, path!
|
||||
*/
|
||||
|
||||
ADD_PAIR("type", Tcl_NewStringObj(typeString[fPtr->type], -1));
|
||||
ADD_PAIR("type", Tcl_NewStringObj(typeString[fPtr->type], TCL_INDEX_NONE));
|
||||
if (fPtr->line) {
|
||||
ADD_PAIR("line", Tcl_NewWideIntObj(fPtr->line[0]));
|
||||
}
|
||||
@@ -1358,7 +1358,7 @@ TclInfoFrame(
|
||||
* Evaluation of a script file.
|
||||
*/
|
||||
|
||||
ADD_PAIR("type", Tcl_NewStringObj(typeString[framePtr->type], -1));
|
||||
ADD_PAIR("type", Tcl_NewStringObj(typeString[framePtr->type], TCL_INDEX_NONE));
|
||||
ADD_PAIR("line", Tcl_NewWideIntObj(framePtr->line[0]));
|
||||
ADD_PAIR("file", framePtr->data.eval.path);
|
||||
|
||||
@@ -1404,7 +1404,7 @@ TclInfoFrame(
|
||||
*/
|
||||
|
||||
for (i=0 ; i<efiPtr->length ; i++) {
|
||||
lv[lc++] = Tcl_NewStringObj(efiPtr->fields[i].name, -1);
|
||||
lv[lc++] = Tcl_NewStringObj(efiPtr->fields[i].name, TCL_INDEX_NONE);
|
||||
if (efiPtr->fields[i].proc) {
|
||||
lv[lc++] =
|
||||
efiPtr->fields[i].proc(efiPtr->fields[i].clientData);
|
||||
@@ -1492,7 +1492,7 @@ InfoFunctionsCmd(
|
||||
" }\n"
|
||||
" }\n"
|
||||
" ::return $cmds\n"
|
||||
" } [::namespace current]] ", -1);
|
||||
" } [::namespace current]] ", TCL_INDEX_NONE);
|
||||
|
||||
if (objc == 2) {
|
||||
Tcl_Obj *arg = Tcl_NewListObj(1, &(objv[1]));
|
||||
@@ -1545,12 +1545,12 @@ InfoHostnameCmd(
|
||||
|
||||
name = Tcl_GetHostName();
|
||||
if (name) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(name, -1));
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(name, TCL_INDEX_NONE));
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"unable to determine name of host", -1));
|
||||
"unable to determine name of host", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "HOSTNAME", "UNKNOWN", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -1665,12 +1665,12 @@ InfoLibraryCmd(
|
||||
|
||||
libDirName = Tcl_GetVar2(interp, "tcl_library", NULL, TCL_GLOBAL_ONLY);
|
||||
if (libDirName != NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(libDirName, -1));
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(libDirName, TCL_INDEX_NONE));
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"no library has been specified for Tcl", -1));
|
||||
"no library has been specified for Tcl", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "VARIABLE", "tcl_library",NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -1797,7 +1797,7 @@ InfoPatchLevelCmd(
|
||||
patchlevel = Tcl_GetVar2(interp, "tcl_patchLevel", NULL,
|
||||
(TCL_GLOBAL_ONLY | TCL_LEAVE_ERR_MSG));
|
||||
if (patchlevel != NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(patchlevel, -1));
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(patchlevel, TCL_INDEX_NONE));
|
||||
return TCL_OK;
|
||||
}
|
||||
return TCL_ERROR;
|
||||
@@ -1910,7 +1910,7 @@ InfoProcsCmd(
|
||||
Tcl_GetCommandFullName(interp, (Tcl_Command) cmdPtr,
|
||||
elemObjPtr);
|
||||
} else {
|
||||
elemObjPtr = Tcl_NewStringObj(simplePattern, -1);
|
||||
elemObjPtr = Tcl_NewStringObj(simplePattern, TCL_INDEX_NONE);
|
||||
}
|
||||
Tcl_ListObjAppendElement(interp, listPtr, elemObjPtr);
|
||||
}
|
||||
@@ -1938,7 +1938,7 @@ InfoProcsCmd(
|
||||
Tcl_GetCommandFullName(interp, (Tcl_Command) cmdPtr,
|
||||
elemObjPtr);
|
||||
} else {
|
||||
elemObjPtr = Tcl_NewStringObj(cmdName, -1);
|
||||
elemObjPtr = Tcl_NewStringObj(cmdName, TCL_INDEX_NONE);
|
||||
}
|
||||
Tcl_ListObjAppendElement(interp, listPtr, elemObjPtr);
|
||||
}
|
||||
@@ -1977,7 +1977,7 @@ InfoProcsCmd(
|
||||
if (TclIsProc(cmdPtr) || ((realCmdPtr != NULL)
|
||||
&& TclIsProc(realCmdPtr))) {
|
||||
Tcl_ListObjAppendElement(interp, listPtr,
|
||||
Tcl_NewStringObj(cmdName, -1));
|
||||
Tcl_NewStringObj(cmdName, TCL_INDEX_NONE));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2075,7 +2075,7 @@ InfoSharedlibCmd(
|
||||
}
|
||||
|
||||
#ifdef TCL_SHLIB_EXT
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(TCL_SHLIB_EXT, -1));
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(TCL_SHLIB_EXT, TCL_INDEX_NONE));
|
||||
#endif
|
||||
return TCL_OK;
|
||||
}
|
||||
@@ -2172,7 +2172,7 @@ InfoCmdTypeCmd(
|
||||
Tcl_AppendResult(interp, "native", NULL);
|
||||
} else {
|
||||
Tcl_SetObjResult(interp,
|
||||
Tcl_NewStringObj(TclGetCommandTypeName(command), -1));
|
||||
Tcl_NewStringObj(TclGetCommandTypeName(command), TCL_INDEX_NONE));
|
||||
}
|
||||
return TCL_OK;
|
||||
}
|
||||
@@ -2215,9 +2215,9 @@ Tcl_JoinObjCmd(
|
||||
* pointer to its array of element pointers.
|
||||
*/
|
||||
|
||||
if (TclHasInternalRep(objv[1],&tclArithSeriesType)) {
|
||||
if (TclHasInternalRep(objv[1],&tclArithSeriesType.objType)) {
|
||||
isArithSeries = 1;
|
||||
listLen = TclArithSeriesObjLength(objv[1]);
|
||||
listLen = ABSTRACTLIST_PROC(objv[1], lengthProc)(objv[1]);
|
||||
} else {
|
||||
if (TclListObjGetElementsM(interp, objv[1], &listLen,
|
||||
&elemPtrs) != TCL_OK) {
|
||||
@@ -2232,8 +2232,8 @@ Tcl_JoinObjCmd(
|
||||
if (listLen == 1) {
|
||||
/* One element; return it */
|
||||
if (isArithSeries) {
|
||||
Tcl_Obj *valueObj;
|
||||
if (TclArithSeriesObjIndex(objv[1], 0, &valueObj) != TCL_OK) {
|
||||
Tcl_Obj *valueObj = TclArithSeriesObjIndex(interp, objv[1], 0);
|
||||
if (valueObj == NULL) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
Tcl_SetObjResult(interp, valueObj);
|
||||
@@ -2267,10 +2267,12 @@ Tcl_JoinObjCmd(
|
||||
|
||||
Tcl_AppendObjToObj(resObjPtr, joinObjPtr);
|
||||
}
|
||||
if (TclArithSeriesObjIndex(objv[1], i, &valueObj) != TCL_OK) {
|
||||
valueObj = TclArithSeriesObjIndex(interp, objv[1], i);
|
||||
if (valueObj == NULL) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
Tcl_AppendObjToObj(resObjPtr, valueObj);
|
||||
Tcl_DecrRefCount(valueObj);
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < listLen; i++) {
|
||||
@@ -2575,6 +2577,7 @@ Tcl_LlengthObjCmd(
|
||||
{
|
||||
size_t listLen;
|
||||
int result;
|
||||
Tcl_Obj *objPtr;
|
||||
|
||||
if (objc != 2) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "list");
|
||||
@@ -2591,7 +2594,8 @@ Tcl_LlengthObjCmd(
|
||||
* length.
|
||||
*/
|
||||
|
||||
Tcl_SetObjResult(interp, Tcl_NewWideIntObj(listLen));
|
||||
TclNewUIntObj(objPtr, listLen);
|
||||
Tcl_SetObjResult(interp, objPtr);
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
@@ -2649,7 +2653,7 @@ Tcl_LpopObjCmd(
|
||||
if (!listLen) {
|
||||
/* empty list, throw the same error as with index "end" */
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"index \"end\" out of range", -1));
|
||||
"index \"end\" out of range", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "VALUE", "INDEX"
|
||||
"OUTOFRANGE", NULL);
|
||||
return TCL_ERROR;
|
||||
@@ -2723,7 +2727,7 @@ Tcl_LrangeObjCmd(
|
||||
/* Argument objects. */
|
||||
{
|
||||
int result;
|
||||
size_t listLen, first, last;
|
||||
Tcl_Size listLen, first, last;
|
||||
if (objc != 4) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "list first last");
|
||||
return TCL_ERROR;
|
||||
@@ -2746,7 +2750,7 @@ Tcl_LrangeObjCmd(
|
||||
return result;
|
||||
}
|
||||
|
||||
if (TclHasInternalRep(objv[1],&tclArithSeriesType)) {
|
||||
if (TclHasInternalRep(objv[1],&tclArithSeriesType.objType)) {
|
||||
Tcl_Obj *rangeObj;
|
||||
rangeObj = TclArithSeriesObjRange(interp, objv[1], first, last);
|
||||
if (rangeObj) {
|
||||
@@ -3145,7 +3149,7 @@ Tcl_LreverseObjCmd(
|
||||
* Handle ArithSeries special case - don't shimmer a series into a list
|
||||
* just to reverse it.
|
||||
*/
|
||||
if (TclHasInternalRep(objv[1],&tclArithSeriesType)) {
|
||||
if (TclHasInternalRep(objv[1],&tclArithSeriesType.objType)) {
|
||||
Tcl_Obj *resObj = TclArithSeriesObjReverse(interp, objv[1]);
|
||||
if (resObj) {
|
||||
Tcl_SetObjResult(interp, resObj);
|
||||
@@ -3156,7 +3160,7 @@ Tcl_LreverseObjCmd(
|
||||
} /* end ArithSeries */
|
||||
|
||||
/* True List */
|
||||
if (TclListObjGetElementsM(interp, objv[1], &elemc, &elemv) != TCL_OK) {
|
||||
if (TclListObjLengthM(interp, objv[1], &elemc) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
@@ -3168,6 +3172,9 @@ Tcl_LreverseObjCmd(
|
||||
Tcl_SetObjResult(interp, objv[1]);
|
||||
return TCL_OK;
|
||||
}
|
||||
if (TclListObjGetElementsM(interp, objv[1], &elemc, &elemv) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
if (Tcl_IsShared(objv[1])
|
||||
|| ListObjRepIsShared(objv[1])) { /* Bug 1675044 */
|
||||
@@ -3368,7 +3375,7 @@ Tcl_LsearchObjCmd(
|
||||
}
|
||||
if (i + 4 > (size_t)objc) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"missing starting index", -1));
|
||||
"missing starting index", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "ARGUMENT", "MISSING", NULL);
|
||||
result = TCL_ERROR;
|
||||
goto done;
|
||||
@@ -3392,7 +3399,7 @@ Tcl_LsearchObjCmd(
|
||||
if (i + 4 > (size_t)objc) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"\"-stride\" option must be "
|
||||
"followed by stride length", -1));
|
||||
"followed by stride length", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "ARGUMENT", "MISSING", NULL);
|
||||
result = TCL_ERROR;
|
||||
goto done;
|
||||
@@ -3403,7 +3410,7 @@ Tcl_LsearchObjCmd(
|
||||
}
|
||||
if (wide < 1) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"stride length must be at least 1", -1));
|
||||
"stride length must be at least 1", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LSEARCH",
|
||||
"BADSTRIDE", NULL);
|
||||
result = TCL_ERROR;
|
||||
@@ -3493,7 +3500,7 @@ Tcl_LsearchObjCmd(
|
||||
|
||||
if (returnSubindices && sortInfo.indexc==0) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"-subindices cannot be used without -index option", -1));
|
||||
"-subindices cannot be used without -index option", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LSEARCH",
|
||||
"BAD_OPTION_MIX", NULL);
|
||||
result = TCL_ERROR;
|
||||
@@ -3502,7 +3509,7 @@ Tcl_LsearchObjCmd(
|
||||
|
||||
if (bisect && (allMatches || negatedMatch)) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"-bisect is not compatible with -all or -not", -1));
|
||||
"-bisect is not compatible with -all or -not", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LSEARCH",
|
||||
"BAD_OPTION_MIX", NULL);
|
||||
result = TCL_ERROR;
|
||||
@@ -3572,7 +3579,7 @@ Tcl_LsearchObjCmd(
|
||||
if (groupOffset >= groupSize) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"when used with \"-stride\", the leading \"-index\""
|
||||
" value must be within the group", -1));
|
||||
" value must be within the group", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LSEARCH",
|
||||
"BADINDEX", NULL);
|
||||
result = TCL_ERROR;
|
||||
@@ -3905,8 +3912,7 @@ Tcl_LsearchObjCmd(
|
||||
TclNewIndexObj(itemPtr, i+groupOffset);
|
||||
for (j=0 ; j<sortInfo.indexc ; j++) {
|
||||
Tcl_Obj *elObj;
|
||||
size_t elValue = TclIndexDecode(sortInfo.indexv[j], listc);
|
||||
TclNewIndexObj(elObj, elValue);
|
||||
TclNewIndexObj(elObj, TclIndexDecode(sortInfo.indexv[j], listc));
|
||||
Tcl_ListObjAppendElement(interp, itemPtr, elObj);
|
||||
}
|
||||
Tcl_ListObjAppendElement(interp, listPtr, itemPtr);
|
||||
@@ -3929,8 +3935,7 @@ Tcl_LsearchObjCmd(
|
||||
TclNewIndexObj(itemPtr, index+groupOffset);
|
||||
for (j=0 ; j<sortInfo.indexc ; j++) {
|
||||
Tcl_Obj *elObj;
|
||||
size_t elValue = TclIndexDecode(sortInfo.indexv[j], listc);
|
||||
TclNewIndexObj(elObj, elValue);
|
||||
TclNewIndexObj(elObj, TclIndexDecode(sortInfo.indexv[j], listc));
|
||||
Tcl_ListObjAppendElement(interp, itemPtr, elObj);
|
||||
}
|
||||
Tcl_SetObjResult(interp, itemPtr);
|
||||
@@ -4111,10 +4116,10 @@ SequenceIdentifyArgument(
|
||||
exprValueObj = argPtr;
|
||||
} else {
|
||||
if (floor(dvalue) == dvalue) {
|
||||
exprValueObj = Tcl_NewWideIntObj(value);
|
||||
TclNewIntObj(exprValueObj, value);
|
||||
keyword = TCL_NUMBER_INT;
|
||||
} else {
|
||||
exprValueObj = Tcl_NewDoubleObj(dvalue);
|
||||
TclNewDoubleObj(exprValueObj, dvalue);
|
||||
keyword = TCL_NUMBER_DOUBLE;
|
||||
}
|
||||
}
|
||||
@@ -4545,7 +4550,7 @@ Tcl_LsortObjCmd(
|
||||
if (i + 2 == (size_t)objc) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"\"-command\" option must be followed "
|
||||
"by comparison command", -1));
|
||||
"by comparison command", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "ARGUMENT", "MISSING", NULL);
|
||||
sortInfo.resultCode = TCL_ERROR;
|
||||
goto done;
|
||||
@@ -4632,7 +4637,7 @@ Tcl_LsortObjCmd(
|
||||
if (i + 2 == (size_t)objc) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"\"-stride\" option must be "
|
||||
"followed by stride length", -1));
|
||||
"followed by stride length", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "ARGUMENT", "MISSING", NULL);
|
||||
sortInfo.resultCode = TCL_ERROR;
|
||||
goto done;
|
||||
@@ -4643,7 +4648,7 @@ Tcl_LsortObjCmd(
|
||||
}
|
||||
if (wide < 2) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"stride length must be at least 2", -1));
|
||||
"stride length must be at least 2", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LSORT",
|
||||
"BADSTRIDE", NULL);
|
||||
sortInfo.resultCode = TCL_ERROR;
|
||||
@@ -4728,7 +4733,7 @@ Tcl_LsortObjCmd(
|
||||
sortInfo.compareCmdPtr = newCommandPtr;
|
||||
}
|
||||
|
||||
if (TclHasInternalRep(listObj,&tclArithSeriesType)) {
|
||||
if (TclHasInternalRep(listObj,&tclArithSeriesType.objType)) {
|
||||
sortInfo.resultCode = TclArithSeriesGetElements(interp,
|
||||
listObj, &length, &listObjPtrs);
|
||||
} else {
|
||||
@@ -4765,7 +4770,7 @@ Tcl_LsortObjCmd(
|
||||
if (groupOffset >= groupSize) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"when used with \"-stride\", the leading \"-index\""
|
||||
" value must be within the group", -1));
|
||||
" value must be within the group", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LSORT",
|
||||
"BADINDEX", NULL);
|
||||
sortInfo.resultCode = TCL_ERROR;
|
||||
@@ -5292,7 +5297,7 @@ SortCompare(
|
||||
if (TclGetIntFromObj(infoPtr->interp,
|
||||
Tcl_GetObjResult(infoPtr->interp), &order) != TCL_OK) {
|
||||
Tcl_SetObjResult(infoPtr->interp, Tcl_NewStringObj(
|
||||
"-compare command returned non-integer result", -1));
|
||||
"-compare command returned non-integer result", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(infoPtr->interp, "TCL", "OPERATION", "LSORT",
|
||||
"COMPARISONFAILED", NULL);
|
||||
infoPtr->resultCode = TCL_ERROR;
|
||||
|
||||
+44
-41
@@ -227,7 +227,7 @@ Tcl_RegexpObjCmd(
|
||||
|
||||
if (doinline && ((objc - 2) != 0)) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"regexp match variables not allowed when using -inline", -1));
|
||||
"regexp match variables not allowed when using -inline", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "REGEXP",
|
||||
"MIX_VAR_INLINE", NULL);
|
||||
goto optionError;
|
||||
@@ -261,7 +261,7 @@ Tcl_RegexpObjCmd(
|
||||
if (startIndex) {
|
||||
TclGetIntForIndexM(interp, startIndex, stringLength, &offset);
|
||||
Tcl_DecrRefCount(startIndex);
|
||||
if (offset == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(offset)) {
|
||||
offset = TCL_INDEX_START;
|
||||
}
|
||||
}
|
||||
@@ -372,7 +372,7 @@ Tcl_RegexpObjCmd(
|
||||
* area. (Scriptics Bug 4391/SF Bug #219232)
|
||||
*/
|
||||
|
||||
if (i <= (int)info.nsubs && info.matches[i].start != TCL_INDEX_NONE) {
|
||||
if (i <= (int)info.nsubs && !TCL_SIZE_ISNEG(info.matches[i].start)) {
|
||||
start = offset + info.matches[i].start;
|
||||
end = offset + info.matches[i].end;
|
||||
|
||||
@@ -585,7 +585,7 @@ Tcl_RegsubObjCmd(
|
||||
|
||||
TclGetIntForIndexM(interp, startIndex, stringLength, &offset);
|
||||
Tcl_DecrRefCount(startIndex);
|
||||
if (offset == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(offset)) {
|
||||
offset = TCL_INDEX_START;
|
||||
}
|
||||
}
|
||||
@@ -784,7 +784,7 @@ Tcl_RegsubObjCmd(
|
||||
for (idx = 0 ; idx <= info.nsubs ; idx++) {
|
||||
subStart = info.matches[idx].start;
|
||||
subEnd = info.matches[idx].end;
|
||||
if ((subStart != TCL_INDEX_NONE) && (subEnd != TCL_INDEX_NONE)) {
|
||||
if (!TCL_SIZE_ISNEG(subStart) && !TCL_SIZE_ISNEG(subEnd)) {
|
||||
args[idx + numParts] = Tcl_NewUnicodeObj(
|
||||
wstring + offset + subStart, subEnd - subStart);
|
||||
} else {
|
||||
@@ -888,7 +888,7 @@ Tcl_RegsubObjCmd(
|
||||
if (idx <= info.nsubs) {
|
||||
subStart = info.matches[idx].start;
|
||||
subEnd = info.matches[idx].end;
|
||||
if ((subStart != TCL_INDEX_NONE) && (subEnd != TCL_INDEX_NONE)) {
|
||||
if (!TCL_SIZE_ISNEG(subStart) && !TCL_SIZE_ISNEG(subEnd)) {
|
||||
Tcl_AppendUnicodeToObj(resultPtr,
|
||||
wstring + offset + subStart, subEnd - subStart);
|
||||
}
|
||||
@@ -1411,7 +1411,7 @@ StringIndexCmd(
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
if ((index != TCL_INDEX_NONE) && (index + 1 <= end + 1)) {
|
||||
if (!TCL_SIZE_ISNEG(index) && (index + 1 <= end + 1)) {
|
||||
int ch = Tcl_GetUniChar(objv[1], index);
|
||||
|
||||
if (ch == -1) {
|
||||
@@ -1481,7 +1481,7 @@ StringInsertCmd(
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
if (index == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(index)) {
|
||||
index = TCL_INDEX_START;
|
||||
}
|
||||
if (index > length) {
|
||||
@@ -1612,7 +1612,7 @@ StringIsCmd(
|
||||
case STR_IS_BOOL:
|
||||
case STR_IS_TRUE:
|
||||
case STR_IS_FALSE:
|
||||
if (!TclHasInternalRep(objPtr, &tclBooleanType)
|
||||
if (!TclHasInternalRep(objPtr, &tclBooleanType.objType)
|
||||
&& (TCL_OK != TclSetBooleanFromAny(NULL, objPtr))) {
|
||||
if (strict) {
|
||||
result = 0;
|
||||
@@ -1682,9 +1682,9 @@ StringIsCmd(
|
||||
chcomp = Tcl_UniCharIsDigit;
|
||||
break;
|
||||
case STR_IS_DOUBLE: {
|
||||
if (TclHasInternalRep(objPtr, &tclDoubleType) ||
|
||||
TclHasInternalRep(objPtr, &tclIntType) ||
|
||||
TclHasInternalRep(objPtr, &tclBignumType)) {
|
||||
if (TclHasInternalRep(objPtr, &tclDoubleType.objType) ||
|
||||
TclHasInternalRep(objPtr, &tclIntType.objType) ||
|
||||
TclHasInternalRep(objPtr, &tclBignumType.objType)) {
|
||||
break;
|
||||
}
|
||||
string1 = Tcl_GetStringFromObj(objPtr, &length1);
|
||||
@@ -1695,7 +1695,7 @@ StringIsCmd(
|
||||
goto str_is_done;
|
||||
}
|
||||
end = string1 + length1;
|
||||
if (TclParseNumber(NULL, objPtr, NULL, NULL, -1,
|
||||
if (TclParseNumber(NULL, objPtr, NULL, NULL, TCL_INDEX_NONE,
|
||||
(const char **) &stop, 0) != TCL_OK) {
|
||||
result = 0;
|
||||
failat = 0;
|
||||
@@ -1713,8 +1713,8 @@ StringIsCmd(
|
||||
break;
|
||||
case STR_IS_INT:
|
||||
case STR_IS_ENTIER:
|
||||
if (TclHasInternalRep(objPtr, &tclIntType) ||
|
||||
TclHasInternalRep(objPtr, &tclBignumType)) {
|
||||
if (TclHasInternalRep(objPtr, &tclIntType.objType) ||
|
||||
TclHasInternalRep(objPtr, &tclBignumType.objType)) {
|
||||
break;
|
||||
}
|
||||
string1 = Tcl_GetStringFromObj(objPtr, &length1);
|
||||
@@ -1725,7 +1725,7 @@ StringIsCmd(
|
||||
goto str_is_done;
|
||||
}
|
||||
end = string1 + length1;
|
||||
if (TclParseNumber(NULL, objPtr, NULL, NULL, -1,
|
||||
if (TclParseNumber(NULL, objPtr, NULL, NULL, TCL_INDEX_NONE,
|
||||
(const char **) &stop, TCL_PARSE_INTEGER_ONLY) == TCL_OK) {
|
||||
if (stop == end) {
|
||||
/*
|
||||
@@ -1776,7 +1776,7 @@ StringIsCmd(
|
||||
break;
|
||||
}
|
||||
end = string1 + length1;
|
||||
if (TclParseNumber(NULL, objPtr, NULL, NULL, -1,
|
||||
if (TclParseNumber(NULL, objPtr, NULL, NULL, TCL_INDEX_NONE,
|
||||
(const char **) &stop, TCL_PARSE_INTEGER_ONLY) == TCL_OK) {
|
||||
if (stop == end) {
|
||||
/*
|
||||
@@ -2047,7 +2047,7 @@ StringMapCmd(
|
||||
*/
|
||||
|
||||
Tcl_SetObjResult(interp,
|
||||
Tcl_NewStringObj("char map list unbalanced", -1));
|
||||
Tcl_NewStringObj("char map list unbalanced", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "MAP",
|
||||
"UNBALANCED", NULL);
|
||||
return TCL_ERROR;
|
||||
@@ -2307,7 +2307,7 @@ StringRangeCmd(
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
if (last != TCL_INDEX_NONE) {
|
||||
if (!TCL_SIZE_ISNEG(last)) {
|
||||
Tcl_SetObjResult(interp, Tcl_GetRange(objv[1], first, last));
|
||||
}
|
||||
return TCL_OK;
|
||||
@@ -2414,7 +2414,7 @@ StringRplcCmd(
|
||||
* result is the original string.
|
||||
*/
|
||||
|
||||
if ((last == TCL_INDEX_NONE) || /* Range ends before start of string */
|
||||
if (TCL_SIZE_ISNEG(last) || /* Range ends before start of string */
|
||||
(first + 1 > end + 1) || /* Range begins after end of string */
|
||||
(last + 1 < first + 1)) { /* Range begins after it starts */
|
||||
/*
|
||||
@@ -2427,7 +2427,7 @@ StringRplcCmd(
|
||||
} else {
|
||||
Tcl_Obj *resultPtr;
|
||||
|
||||
if (first == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(first)) {
|
||||
first = TCL_INDEX_START;
|
||||
}
|
||||
if (last + 1 > end + 1) {
|
||||
@@ -2526,7 +2526,7 @@ StringStartCmd(
|
||||
p = &string[index];
|
||||
|
||||
(void)TclUniCharToUCS4(p, &ch);
|
||||
for (cur = index; cur != TCL_INDEX_NONE; cur--) {
|
||||
for (cur = index; !TCL_SIZE_ISNEG(cur); cur--) {
|
||||
int delta = 0;
|
||||
const Tcl_UniChar *next;
|
||||
|
||||
@@ -2588,7 +2588,7 @@ StringEndCmd(
|
||||
if (TclGetIntForIndexM(interp, objv[2], length-1, &index) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (index == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(index)) {
|
||||
index = TCL_INDEX_START;
|
||||
}
|
||||
if (index + 1 <= length + 1) {
|
||||
@@ -2682,7 +2682,7 @@ StringEqualCmd(
|
||||
*/
|
||||
|
||||
objv += objc-2;
|
||||
match = TclStringCmp(objv[0], objv[1], 0, nocase, reqlength);
|
||||
match = TclStringCmp(objv[0], objv[1], 1, nocase, reqlength);
|
||||
Tcl_SetObjResult(interp, Tcl_NewBooleanObj(match ? 0 : 1));
|
||||
return TCL_OK;
|
||||
}
|
||||
@@ -2906,7 +2906,7 @@ StringLowerCmd(
|
||||
if (TclGetIntForIndexM(interp,objv[2],length1, &first) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (first == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(first)) {
|
||||
first = 0;
|
||||
}
|
||||
last = first;
|
||||
@@ -2933,7 +2933,7 @@ StringLowerCmd(
|
||||
length2 = Tcl_UtfToLower(string2);
|
||||
Tcl_SetObjLength(resultPtr, length2 + (start - string1));
|
||||
|
||||
Tcl_AppendToObj(resultPtr, end, -1);
|
||||
Tcl_AppendToObj(resultPtr, end, TCL_INDEX_NONE);
|
||||
Tcl_SetObjResult(interp, resultPtr);
|
||||
}
|
||||
|
||||
@@ -2991,7 +2991,7 @@ StringUpperCmd(
|
||||
if (TclGetIntForIndexM(interp,objv[2],length1, &first) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (first == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(first)) {
|
||||
first = TCL_INDEX_START;
|
||||
}
|
||||
last = first;
|
||||
@@ -3018,7 +3018,7 @@ StringUpperCmd(
|
||||
length2 = Tcl_UtfToUpper(string2);
|
||||
Tcl_SetObjLength(resultPtr, length2 + (start - string1));
|
||||
|
||||
Tcl_AppendToObj(resultPtr, end, -1);
|
||||
Tcl_AppendToObj(resultPtr, end, TCL_INDEX_NONE);
|
||||
Tcl_SetObjResult(interp, resultPtr);
|
||||
}
|
||||
|
||||
@@ -3076,7 +3076,7 @@ StringTitleCmd(
|
||||
if (TclGetIntForIndexM(interp,objv[2],length1, &first) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (first == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(first)) {
|
||||
first = TCL_INDEX_START;
|
||||
}
|
||||
last = first;
|
||||
@@ -3103,7 +3103,7 @@ StringTitleCmd(
|
||||
length2 = Tcl_UtfToTitle(string2);
|
||||
Tcl_SetObjLength(resultPtr, length2 + (start - string1));
|
||||
|
||||
Tcl_AppendToObj(resultPtr, end, -1);
|
||||
Tcl_AppendToObj(resultPtr, end, TCL_INDEX_NONE);
|
||||
Tcl_SetObjResult(interp, resultPtr);
|
||||
}
|
||||
|
||||
@@ -3583,7 +3583,7 @@ TclNRSwitchObjCmd(
|
||||
size_t listc;
|
||||
|
||||
blist = objv[0];
|
||||
if (TclListObjGetElementsM(interp, objv[0], &listc, &listv) != TCL_OK) {
|
||||
if (TclListObjLengthM(interp, objv[0], &listc) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
@@ -3596,6 +3596,9 @@ TclNRSwitchObjCmd(
|
||||
"?-option ...? string {?pattern body ...? ?default body?}");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (TclListObjGetElementsM(interp, objv[0], &listc, &listv) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
objc = listc;
|
||||
objv = listv;
|
||||
splitObjs = 1;
|
||||
@@ -3609,7 +3612,7 @@ TclNRSwitchObjCmd(
|
||||
if (objc % 2) {
|
||||
Tcl_ResetResult(interp);
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"extra switch pattern with no body", -1));
|
||||
"extra switch pattern with no body", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "SWITCH", "BADARM",
|
||||
NULL);
|
||||
|
||||
@@ -3627,7 +3630,7 @@ TclNRSwitchObjCmd(
|
||||
Tcl_AppendToObj(Tcl_GetObjResult(interp),
|
||||
", this may be due to a comment incorrectly"
|
||||
" placed outside of a switch body - see the"
|
||||
" \"switch\" documentation", -1);
|
||||
" \"switch\" documentation", TCL_INDEX_NONE);
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "SWITCH",
|
||||
"BADARM", "COMMENT?", NULL);
|
||||
break;
|
||||
@@ -3977,7 +3980,7 @@ Tcl_ThrowObjCmd(
|
||||
return TCL_ERROR;
|
||||
} else if (len < 1) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"type must be non-empty list", -1));
|
||||
"type must be non-empty list", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "THROW", "BADEXCEPTION",
|
||||
NULL);
|
||||
return TCL_ERROR;
|
||||
@@ -4073,9 +4076,9 @@ Tcl_TimeObjCmd(
|
||||
* Use int obj since we know time is not fractional. [Bug 1202178]
|
||||
*/
|
||||
|
||||
objs[0] = Tcl_NewWideIntObj((count <= 0) ? 0 : (Tcl_WideInt)totalMicroSec);
|
||||
TclNewIntObj(objs[0], (count <= 0) ? 0 : (Tcl_WideInt)totalMicroSec);
|
||||
} else {
|
||||
objs[0] = Tcl_NewDoubleObj(totalMicroSec/count);
|
||||
TclNewDoubleObj(objs[0], totalMicroSec/count);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -4560,7 +4563,7 @@ Tcl_TimeRateObjCmd(
|
||||
if (measureOverhead > ((double) usec) / count) {
|
||||
measureOverhead = ((double) usec) / count;
|
||||
}
|
||||
objs[0] = Tcl_NewDoubleObj(measureOverhead);
|
||||
TclNewDoubleObj(objs[0], measureOverhead);
|
||||
TclNewLiteralStringObj(objs[1], "\xC2\xB5s/#-overhead"); /* mics */
|
||||
objs += 2;
|
||||
}
|
||||
@@ -4715,7 +4718,7 @@ TclNRTryObjCmd(
|
||||
case TryFinally: /* finally script */
|
||||
if (i < objc-2) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"finally clause must be last", -1));
|
||||
"finally clause must be last", TCL_INDEX_NONE));
|
||||
Tcl_DecrRefCount(handlersObj);
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "TRY", "FINALLY",
|
||||
"NONTERMINAL", NULL);
|
||||
@@ -4723,7 +4726,7 @@ TclNRTryObjCmd(
|
||||
} else if (i == objc-1) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"wrong # args to finally clause: must be"
|
||||
" \"... finally script\"", -1));
|
||||
" \"... finally script\"", TCL_INDEX_NONE));
|
||||
Tcl_DecrRefCount(handlersObj);
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "TRY", "FINALLY",
|
||||
"ARGUMENT", NULL);
|
||||
@@ -4736,7 +4739,7 @@ TclNRTryObjCmd(
|
||||
if (i > objc-4) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"wrong # args to on clause: must be \"... on code"
|
||||
" variableList script\"", -1));
|
||||
" variableList script\"", TCL_INDEX_NONE));
|
||||
Tcl_DecrRefCount(handlersObj);
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "TRY", "ON",
|
||||
"ARGUMENT", NULL);
|
||||
@@ -4797,7 +4800,7 @@ TclNRTryObjCmd(
|
||||
}
|
||||
if (bodyShared) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"last non-finally clause must not have a body of \"-\"", -1));
|
||||
"last non-finally clause must not have a body of \"-\"", TCL_INDEX_NONE));
|
||||
Tcl_DecrRefCount(handlersObj);
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "TRY", "BADFALLTHROUGH",
|
||||
NULL);
|
||||
|
||||
+38
-38
@@ -287,7 +287,7 @@ TclCompileArraySetCmd(
|
||||
Tcl_Token *varTokenPtr, *dataTokenPtr;
|
||||
int isScalar, localIndex, code = TCL_OK;
|
||||
int isDataLiteral, isDataValid, isDataEven;
|
||||
size_t len;
|
||||
Tcl_Size len;
|
||||
int keyVar, valVar, infoIndex;
|
||||
int fwd, offsetBack, offsetFwd;
|
||||
Tcl_Obj *literalObj;
|
||||
@@ -393,7 +393,7 @@ TclCompileArraySetCmd(
|
||||
|
||||
infoPtr = (ForeachInfo *)Tcl_Alloc(offsetof(ForeachInfo, varLists) + sizeof(ForeachVarList *));
|
||||
infoPtr->numLists = 1;
|
||||
infoPtr->varLists[0] = (ForeachVarList *)Tcl_Alloc(offsetof(ForeachVarList, varIndexes) + 2 * sizeof(size_t));
|
||||
infoPtr->varLists[0] = (ForeachVarList *)Tcl_Alloc(offsetof(ForeachVarList, varIndexes) + 2 * sizeof(Tcl_Size));
|
||||
infoPtr->varLists[0]->numVars = 2;
|
||||
infoPtr->varLists[0]->varIndexes[0] = keyVar;
|
||||
infoPtr->varLists[0]->varIndexes[1] = valVar;
|
||||
@@ -891,7 +891,7 @@ TclCompileConcatCmd(
|
||||
if (listObj != NULL) {
|
||||
Tcl_Obj **objs;
|
||||
const char *bytes;
|
||||
size_t len, slen;
|
||||
Tcl_Size len, slen;
|
||||
|
||||
TclListObjGetElementsM(NULL, listObj, &len, &objs);
|
||||
objPtr = Tcl_ConcatObj(len, objs);
|
||||
@@ -1078,7 +1078,7 @@ TclCompileDictIncrCmd(
|
||||
|
||||
if (parsePtr->numWords == 4) {
|
||||
const char *word;
|
||||
size_t numBytes;
|
||||
Tcl_Size numBytes;
|
||||
int code;
|
||||
Tcl_Token *incrTokenPtr;
|
||||
Tcl_Obj *intObj;
|
||||
@@ -1293,7 +1293,7 @@ TclCompileDictCreateCmd(
|
||||
Tcl_Obj *keyObj, *valueObj, *dictObj;
|
||||
const char *bytes;
|
||||
int i;
|
||||
size_t len;
|
||||
Tcl_Size len;
|
||||
|
||||
if ((parsePtr->numWords & 1) == 0) {
|
||||
return TCL_ERROR;
|
||||
@@ -1528,7 +1528,7 @@ CompileDictEachCmd(
|
||||
Tcl_Token *varsTokenPtr, *dictTokenPtr, *bodyTokenPtr;
|
||||
int keyVarIndex, valueVarIndex, nameChars, loopRange, catchRange;
|
||||
int infoIndex, jumpDisplacement, bodyTargetOffset, emptyTargetOffset;
|
||||
size_t numVars;
|
||||
Tcl_Size numVars;
|
||||
int endTargetOffset;
|
||||
int collectVar = -1; /* Index of temp var holding the result
|
||||
* dict. */
|
||||
@@ -2293,14 +2293,14 @@ PrintDictUpdateInfo(
|
||||
void *clientData,
|
||||
Tcl_Obj *appendObj,
|
||||
TCL_UNUSED(ByteCode *),
|
||||
TCL_UNUSED(size_t))
|
||||
TCL_UNUSED(TCL_HASH_TYPE))
|
||||
{
|
||||
DictUpdateInfo *duiPtr = (DictUpdateInfo *)clientData;
|
||||
size_t i;
|
||||
Tcl_Size i;
|
||||
|
||||
for (i=0 ; i<duiPtr->length ; i++) {
|
||||
if (i) {
|
||||
Tcl_AppendToObj(appendObj, ", ", -1);
|
||||
Tcl_AppendToObj(appendObj, ", ", TCL_INDEX_NONE);
|
||||
}
|
||||
Tcl_AppendPrintfToObj(appendObj, "%%v%" TCL_Z_MODIFIER "u", duiPtr->varIndices[i]);
|
||||
}
|
||||
@@ -2311,10 +2311,10 @@ DisassembleDictUpdateInfo(
|
||||
void *clientData,
|
||||
Tcl_Obj *dictObj,
|
||||
TCL_UNUSED(ByteCode *),
|
||||
TCL_UNUSED(size_t))
|
||||
TCL_UNUSED(TCL_HASH_TYPE))
|
||||
{
|
||||
DictUpdateInfo *duiPtr = (DictUpdateInfo *)clientData;
|
||||
size_t i;
|
||||
Tcl_Size i;
|
||||
Tcl_Obj *variables;
|
||||
|
||||
TclNewObj(variables);
|
||||
@@ -2322,7 +2322,7 @@ DisassembleDictUpdateInfo(
|
||||
Tcl_ListObjAppendElement(NULL, variables,
|
||||
Tcl_NewWideIntObj(duiPtr->varIndices[i]));
|
||||
}
|
||||
Tcl_DictObjPut(NULL, dictObj, Tcl_NewStringObj("variables", -1),
|
||||
Tcl_DictObjPut(NULL, dictObj, Tcl_NewStringObj("variables", TCL_INDEX_NONE),
|
||||
variables);
|
||||
}
|
||||
|
||||
@@ -2690,7 +2690,7 @@ CompileEachloopCmd(
|
||||
Tcl_Token *tokenPtr, *bodyTokenPtr;
|
||||
int jumpBackOffset, infoIndex, range;
|
||||
int numWords, numLists, i, code = TCL_OK;
|
||||
size_t j;
|
||||
Tcl_Size j;
|
||||
Tcl_Obj *varListObj = NULL;
|
||||
|
||||
/*
|
||||
@@ -2742,7 +2742,7 @@ CompileEachloopCmd(
|
||||
i < numWords-1;
|
||||
i++, tokenPtr = TokenAfter(tokenPtr)) {
|
||||
ForeachVarList *varListPtr;
|
||||
size_t numVars;
|
||||
Tcl_Size numVars;
|
||||
|
||||
if (i%2 != 1) {
|
||||
continue;
|
||||
@@ -2762,7 +2762,7 @@ CompileEachloopCmd(
|
||||
}
|
||||
|
||||
varListPtr = (ForeachVarList *)Tcl_Alloc(offsetof(ForeachVarList, varIndexes)
|
||||
+ numVars * sizeof(size_t));
|
||||
+ numVars * sizeof(Tcl_Size));
|
||||
varListPtr->numVars = numVars;
|
||||
infoPtr->varLists[i/2] = varListPtr;
|
||||
infoPtr->numLists++;
|
||||
@@ -2771,7 +2771,7 @@ CompileEachloopCmd(
|
||||
Tcl_Obj *varNameObj;
|
||||
const char *bytes;
|
||||
int varIndex;
|
||||
size_t length;
|
||||
Tcl_Size length;
|
||||
|
||||
|
||||
Tcl_ListObjIndex(NULL, varListObj, j, &varNameObj);
|
||||
@@ -2976,17 +2976,17 @@ PrintForeachInfo(
|
||||
void *clientData,
|
||||
Tcl_Obj *appendObj,
|
||||
TCL_UNUSED(ByteCode *),
|
||||
TCL_UNUSED(size_t))
|
||||
TCL_UNUSED(TCL_HASH_TYPE))
|
||||
{
|
||||
ForeachInfo *infoPtr = (ForeachInfo *)clientData;
|
||||
ForeachVarList *varsPtr;
|
||||
size_t i, j;
|
||||
Tcl_Size i, j;
|
||||
|
||||
Tcl_AppendToObj(appendObj, "data=[", -1);
|
||||
Tcl_AppendToObj(appendObj, "data=[", TCL_INDEX_NONE);
|
||||
|
||||
for (i=0 ; i<infoPtr->numLists ; i++) {
|
||||
if (i) {
|
||||
Tcl_AppendToObj(appendObj, ", ", -1);
|
||||
Tcl_AppendToObj(appendObj, ", ", TCL_INDEX_NONE);
|
||||
}
|
||||
Tcl_AppendPrintfToObj(appendObj, "%%v%" TCL_Z_MODIFIER "u",
|
||||
(infoPtr->firstValueTemp + i));
|
||||
@@ -2995,19 +2995,19 @@ PrintForeachInfo(
|
||||
infoPtr->loopCtTemp);
|
||||
for (i=0 ; i<infoPtr->numLists ; i++) {
|
||||
if (i) {
|
||||
Tcl_AppendToObj(appendObj, ",", -1);
|
||||
Tcl_AppendToObj(appendObj, ",", TCL_INDEX_NONE);
|
||||
}
|
||||
Tcl_AppendPrintfToObj(appendObj, "\n\t\t it%%v%" TCL_Z_MODIFIER "u\t[",
|
||||
(infoPtr->firstValueTemp + i));
|
||||
varsPtr = infoPtr->varLists[i];
|
||||
for (j=0 ; j<varsPtr->numVars ; j++) {
|
||||
if (j) {
|
||||
Tcl_AppendToObj(appendObj, ", ", -1);
|
||||
Tcl_AppendToObj(appendObj, ", ", TCL_INDEX_NONE);
|
||||
}
|
||||
Tcl_AppendPrintfToObj(appendObj, "%%v%" TCL_Z_MODIFIER "u",
|
||||
varsPtr->varIndexes[j]);
|
||||
}
|
||||
Tcl_AppendToObj(appendObj, "]", -1);
|
||||
Tcl_AppendToObj(appendObj, "]", TCL_INDEX_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3016,28 +3016,28 @@ PrintNewForeachInfo(
|
||||
void *clientData,
|
||||
Tcl_Obj *appendObj,
|
||||
TCL_UNUSED(ByteCode *),
|
||||
TCL_UNUSED(size_t))
|
||||
TCL_UNUSED(TCL_HASH_TYPE))
|
||||
{
|
||||
ForeachInfo *infoPtr = (ForeachInfo *)clientData;
|
||||
ForeachVarList *varsPtr;
|
||||
size_t i, j;
|
||||
Tcl_Size i, j;
|
||||
|
||||
Tcl_AppendPrintfToObj(appendObj, "jumpOffset=%+" TCL_Z_MODIFIER "d, vars=",
|
||||
infoPtr->loopCtTemp);
|
||||
for (i=0 ; i<infoPtr->numLists ; i++) {
|
||||
if (i) {
|
||||
Tcl_AppendToObj(appendObj, ",", -1);
|
||||
Tcl_AppendToObj(appendObj, ",", TCL_INDEX_NONE);
|
||||
}
|
||||
Tcl_AppendToObj(appendObj, "[", -1);
|
||||
Tcl_AppendToObj(appendObj, "[", TCL_INDEX_NONE);
|
||||
varsPtr = infoPtr->varLists[i];
|
||||
for (j=0 ; j<varsPtr->numVars ; j++) {
|
||||
if (j) {
|
||||
Tcl_AppendToObj(appendObj, ",", -1);
|
||||
Tcl_AppendToObj(appendObj, ",", TCL_INDEX_NONE);
|
||||
}
|
||||
Tcl_AppendPrintfToObj(appendObj, "%%v%" TCL_Z_MODIFIER "u",
|
||||
varsPtr->varIndexes[j]);
|
||||
}
|
||||
Tcl_AppendToObj(appendObj, "]", -1);
|
||||
Tcl_AppendToObj(appendObj, "]", TCL_INDEX_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3046,11 +3046,11 @@ DisassembleForeachInfo(
|
||||
void *clientData,
|
||||
Tcl_Obj *dictObj,
|
||||
TCL_UNUSED(ByteCode *),
|
||||
TCL_UNUSED(size_t))
|
||||
TCL_UNUSED(TCL_HASH_TYPE))
|
||||
{
|
||||
ForeachInfo *infoPtr = (ForeachInfo *)clientData;
|
||||
ForeachVarList *varsPtr;
|
||||
size_t i, j;
|
||||
Tcl_Size i, j;
|
||||
Tcl_Obj *objPtr, *innerPtr;
|
||||
|
||||
/*
|
||||
@@ -3062,13 +3062,13 @@ DisassembleForeachInfo(
|
||||
Tcl_ListObjAppendElement(NULL, objPtr,
|
||||
Tcl_NewWideIntObj(infoPtr->firstValueTemp + i));
|
||||
}
|
||||
Tcl_DictObjPut(NULL, dictObj, Tcl_NewStringObj("data", -1), objPtr);
|
||||
Tcl_DictObjPut(NULL, dictObj, Tcl_NewStringObj("data", TCL_INDEX_NONE), objPtr);
|
||||
|
||||
/*
|
||||
* Loop counter.
|
||||
*/
|
||||
|
||||
Tcl_DictObjPut(NULL, dictObj, Tcl_NewStringObj("loop", -1),
|
||||
Tcl_DictObjPut(NULL, dictObj, Tcl_NewStringObj("loop", TCL_INDEX_NONE),
|
||||
Tcl_NewWideIntObj(infoPtr->loopCtTemp));
|
||||
|
||||
/*
|
||||
@@ -3085,7 +3085,7 @@ DisassembleForeachInfo(
|
||||
}
|
||||
Tcl_ListObjAppendElement(NULL, objPtr, innerPtr);
|
||||
}
|
||||
Tcl_DictObjPut(NULL, dictObj, Tcl_NewStringObj("assign", -1), objPtr);
|
||||
Tcl_DictObjPut(NULL, dictObj, Tcl_NewStringObj("assign", TCL_INDEX_NONE), objPtr);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -3093,18 +3093,18 @@ DisassembleNewForeachInfo(
|
||||
void *clientData,
|
||||
Tcl_Obj *dictObj,
|
||||
TCL_UNUSED(ByteCode *),
|
||||
TCL_UNUSED(size_t))
|
||||
TCL_UNUSED(TCL_HASH_TYPE))
|
||||
{
|
||||
ForeachInfo *infoPtr = (ForeachInfo *)clientData;
|
||||
ForeachVarList *varsPtr;
|
||||
size_t i, j;
|
||||
Tcl_Size i, j;
|
||||
Tcl_Obj *objPtr, *innerPtr;
|
||||
|
||||
/*
|
||||
* Jump offset.
|
||||
*/
|
||||
|
||||
Tcl_DictObjPut(NULL, dictObj, Tcl_NewStringObj("jumpOffset", -1),
|
||||
Tcl_DictObjPut(NULL, dictObj, Tcl_NewStringObj("jumpOffset", TCL_INDEX_NONE),
|
||||
Tcl_NewWideIntObj(infoPtr->loopCtTemp));
|
||||
|
||||
/*
|
||||
@@ -3121,7 +3121,7 @@ DisassembleNewForeachInfo(
|
||||
}
|
||||
Tcl_ListObjAppendElement(NULL, objPtr, innerPtr);
|
||||
}
|
||||
Tcl_DictObjPut(NULL, dictObj, Tcl_NewStringObj("assign", -1), objPtr);
|
||||
Tcl_DictObjPut(NULL, dictObj, Tcl_NewStringObj("assign", TCL_INDEX_NONE), objPtr);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -2378,7 +2378,7 @@ TclCompileReturnCmd(
|
||||
ExceptionRange range = envPtr->exceptArrayPtr[index];
|
||||
|
||||
if ((range.type == CATCH_EXCEPTION_RANGE)
|
||||
&& (range.catchOffset == TCL_INDEX_NONE)) {
|
||||
&& TCL_SIZE_ISNEG(range.catchOffset)) {
|
||||
enclosingCatch = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
+31
-31
@@ -897,7 +897,7 @@ TclCompileStringLenCmd(
|
||||
char buf[TCL_INTEGER_SPACE];
|
||||
size_t len = Tcl_GetCharLength(objPtr);
|
||||
|
||||
len = sprintf(buf, "%" TCL_Z_MODIFIER "u", len);
|
||||
len = snprintf(buf, sizeof(buf), "%" TCL_Z_MODIFIER "u", len);
|
||||
PushLiteral(envPtr, buf, len);
|
||||
} else {
|
||||
SetLineInformation(1);
|
||||
@@ -921,7 +921,7 @@ TclCompileStringMapCmd(
|
||||
Tcl_Token *mapTokenPtr, *stringTokenPtr;
|
||||
Tcl_Obj *mapObj, **objv;
|
||||
const char *bytes;
|
||||
size_t len, slen;
|
||||
Tcl_Size len, slen;
|
||||
|
||||
/*
|
||||
* We only handle the case:
|
||||
@@ -1524,7 +1524,7 @@ TclSubstCompile(
|
||||
{
|
||||
Tcl_Token *endTokenPtr, *tokenPtr;
|
||||
int breakOffset = 0, count = 0;
|
||||
size_t bline = line;
|
||||
Tcl_Size bline = line;
|
||||
Tcl_Parse parse;
|
||||
Tcl_InterpState state = NULL;
|
||||
|
||||
@@ -1549,7 +1549,7 @@ TclSubstCompile(
|
||||
|
||||
for (endTokenPtr = tokenPtr + parse.numTokens;
|
||||
tokenPtr < endTokenPtr; tokenPtr = TokenAfter(tokenPtr)) {
|
||||
size_t length;
|
||||
Tcl_Size length;
|
||||
int literal, catchRange, breakJump;
|
||||
char buf[4] = "";
|
||||
JumpFixup startFixup, okFixup, returnFixup, breakFixup;
|
||||
@@ -1581,7 +1581,7 @@ TclSubstCompile(
|
||||
*/
|
||||
|
||||
if (tokenPtr->numComponents > 1) {
|
||||
size_t i;
|
||||
Tcl_Size i;
|
||||
int foundCommand = 0;
|
||||
|
||||
for (i=2 ; i<=tokenPtr->numComponents ; i++) {
|
||||
@@ -1945,8 +1945,8 @@ TclCompileSwitchCmd(
|
||||
|
||||
if (numWords == 1) {
|
||||
const char *bytes;
|
||||
size_t maxLen, numBytes;
|
||||
size_t bline; /* TIP #280: line of the pattern/action list,
|
||||
Tcl_Size maxLen, numBytes;
|
||||
Tcl_Size bline; /* TIP #280: line of the pattern/action list,
|
||||
* and start of list for when tracking the
|
||||
* location. This list comes immediately after
|
||||
* the value we switch on. */
|
||||
@@ -2590,7 +2590,7 @@ PrintJumptableInfo(
|
||||
void *clientData,
|
||||
Tcl_Obj *appendObj,
|
||||
TCL_UNUSED(ByteCode *),
|
||||
size_t pcOffset)
|
||||
TCL_HASH_TYPE pcOffset)
|
||||
{
|
||||
JumptableInfo *jtPtr = (JumptableInfo *)clientData;
|
||||
Tcl_HashEntry *hPtr;
|
||||
@@ -2604,9 +2604,9 @@ PrintJumptableInfo(
|
||||
offset = PTR2INT(Tcl_GetHashValue(hPtr));
|
||||
|
||||
if (i++) {
|
||||
Tcl_AppendToObj(appendObj, ", ", -1);
|
||||
Tcl_AppendToObj(appendObj, ", ", TCL_INDEX_NONE);
|
||||
if (i%4==0) {
|
||||
Tcl_AppendToObj(appendObj, "\n\t\t", -1);
|
||||
Tcl_AppendToObj(appendObj, "\n\t\t", TCL_INDEX_NONE);
|
||||
}
|
||||
}
|
||||
Tcl_AppendPrintfToObj(appendObj, "\"%s\"->pc %" TCL_Z_MODIFIER "u",
|
||||
@@ -2619,7 +2619,7 @@ DisassembleJumptableInfo(
|
||||
void *clientData,
|
||||
Tcl_Obj *dictObj,
|
||||
TCL_UNUSED(ByteCode *),
|
||||
TCL_UNUSED(size_t))
|
||||
TCL_UNUSED(TCL_HASH_TYPE))
|
||||
{
|
||||
JumptableInfo *jtPtr = (JumptableInfo *)clientData;
|
||||
Tcl_Obj *mapping;
|
||||
@@ -2633,10 +2633,10 @@ DisassembleJumptableInfo(
|
||||
for (; hPtr ; hPtr = Tcl_NextHashEntry(&search)) {
|
||||
keyPtr = (const char *)Tcl_GetHashKey(&jtPtr->hashTable, hPtr);
|
||||
offset = PTR2INT(Tcl_GetHashValue(hPtr));
|
||||
Tcl_DictObjPut(NULL, mapping, Tcl_NewStringObj(keyPtr, -1),
|
||||
Tcl_DictObjPut(NULL, mapping, Tcl_NewStringObj(keyPtr, TCL_INDEX_NONE),
|
||||
Tcl_NewWideIntObj(offset));
|
||||
}
|
||||
Tcl_DictObjPut(NULL, dictObj, Tcl_NewStringObj("mapping", -1), mapping);
|
||||
Tcl_DictObjPut(NULL, dictObj, Tcl_NewStringObj("mapping", TCL_INDEX_NONE), mapping);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2716,7 +2716,7 @@ TclCompileThrowCmd(
|
||||
Tcl_Token *codeToken, *msgToken;
|
||||
Tcl_Obj *objPtr;
|
||||
int codeKnown, codeIsList, codeIsValid;
|
||||
size_t len;
|
||||
Tcl_Size len;
|
||||
|
||||
if (numWords != 3) {
|
||||
return TCL_ERROR;
|
||||
@@ -2857,7 +2857,7 @@ TclCompileTryCmd(
|
||||
|
||||
for (i=0 ; i<numHandlers ; i++) {
|
||||
Tcl_Obj *tmpObj, **objv;
|
||||
size_t objc;
|
||||
Tcl_Size objc;
|
||||
|
||||
if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) {
|
||||
goto failedToCompile;
|
||||
@@ -2922,7 +2922,7 @@ TclCompileTryCmd(
|
||||
goto failedToCompile;
|
||||
}
|
||||
if (objc > 0) {
|
||||
size_t len;
|
||||
Tcl_Size len;
|
||||
const char *varname = Tcl_GetStringFromObj(objv[0], &len);
|
||||
|
||||
resultVarIndices[i] = LocalScalar(varname, len, envPtr);
|
||||
@@ -2934,7 +2934,7 @@ TclCompileTryCmd(
|
||||
resultVarIndices[i] = -1;
|
||||
}
|
||||
if (objc == 2) {
|
||||
size_t len;
|
||||
Tcl_Size len;
|
||||
const char *varname = Tcl_GetStringFromObj(objv[1], &len);
|
||||
|
||||
optionVarIndices[i] = LocalScalar(varname, len, envPtr);
|
||||
@@ -3056,7 +3056,7 @@ IssueTryClausesInstructions(
|
||||
DefineLineInformation; /* TIP #280 */
|
||||
int range, resultVar, optionsVar;
|
||||
int i, j, forwardsNeedFixing = 0, trapZero = 0, afterBody = 0;
|
||||
size_t slen, len;
|
||||
Tcl_Size slen, len;
|
||||
int *addrsToFix, *forwardsToFix, notCodeJumpSource, notECJumpSource;
|
||||
int *noError;
|
||||
char buf[TCL_INTEGER_SPACE];
|
||||
@@ -3124,7 +3124,7 @@ IssueTryClausesInstructions(
|
||||
|
||||
for (i=0 ; i<numHandlers ; i++) {
|
||||
noError[i] = -1;
|
||||
sprintf(buf, "%d", matchCodes[i]);
|
||||
snprintf(buf, sizeof(buf), "%d", matchCodes[i]);
|
||||
OP( DUP);
|
||||
PushLiteral(envPtr, buf, strlen(buf));
|
||||
OP( EQ);
|
||||
@@ -3270,7 +3270,7 @@ IssueTryClausesFinallyInstructions(
|
||||
int trapZero = 0, afterBody = 0, finalOK, finalError, noFinalError;
|
||||
int *addrsToFix, *forwardsToFix, notCodeJumpSource, notECJumpSource;
|
||||
char buf[TCL_INTEGER_SPACE];
|
||||
size_t slen, len;
|
||||
Tcl_Size slen, len;
|
||||
|
||||
resultVar = AnonymousLocal(envPtr);
|
||||
optionsVar = AnonymousLocal(envPtr);
|
||||
@@ -3337,7 +3337,7 @@ IssueTryClausesFinallyInstructions(
|
||||
int noTrapError, trapError;
|
||||
const char *p;
|
||||
|
||||
sprintf(buf, "%d", matchCodes[i]);
|
||||
snprintf(buf, sizeof(buf), "%d", matchCodes[i]);
|
||||
OP( DUP);
|
||||
PushLiteral(envPtr, buf, strlen(buf));
|
||||
OP( EQ);
|
||||
@@ -3680,7 +3680,7 @@ TclCompileUnsetCmd(
|
||||
}
|
||||
if (varCount == 0) {
|
||||
const char *bytes;
|
||||
size_t len;
|
||||
Tcl_Size len;
|
||||
|
||||
bytes = Tcl_GetStringFromObj(leadingWord, &len);
|
||||
if (i == 1 && len == 11 && !strncmp("-nocomplain", bytes, 11)) {
|
||||
@@ -4073,7 +4073,7 @@ CompileAssociativeBinaryOpCmd(
|
||||
{
|
||||
DefineLineInformation; /* TIP #280 */
|
||||
Tcl_Token *tokenPtr = parsePtr->tokenPtr;
|
||||
size_t words;
|
||||
Tcl_Size words;
|
||||
|
||||
/* TODO: Consider support for compiling expanded args. */
|
||||
for (words=1 ; words<parsePtr->numWords ; words++) {
|
||||
@@ -4081,13 +4081,13 @@ CompileAssociativeBinaryOpCmd(
|
||||
CompileWord(envPtr, tokenPtr, interp, words);
|
||||
}
|
||||
if (parsePtr->numWords <= 2) {
|
||||
PushLiteral(envPtr, identity, -1);
|
||||
PushLiteral(envPtr, identity, TCL_INDEX_NONE);
|
||||
words++;
|
||||
}
|
||||
if (words > 3) {
|
||||
/*
|
||||
* Reverse order of arguments to get precise agreement with [expr] in
|
||||
* calcuations, including roundoff errors.
|
||||
* calculations, including roundoff errors.
|
||||
*/
|
||||
|
||||
OP4( REVERSE, words-1);
|
||||
@@ -4176,7 +4176,7 @@ CompileComparisonOpCmd(
|
||||
return TCL_ERROR;
|
||||
} else {
|
||||
int tmpIndex = AnonymousLocal(envPtr);
|
||||
size_t words;
|
||||
Tcl_Size words;
|
||||
|
||||
tokenPtr = TokenAfter(parsePtr->tokenPtr);
|
||||
CompileWord(envPtr, tokenPtr, interp, 1);
|
||||
@@ -4312,7 +4312,7 @@ TclCompilePowOpCmd(
|
||||
{
|
||||
DefineLineInformation; /* TIP #280 */
|
||||
Tcl_Token *tokenPtr = parsePtr->tokenPtr;
|
||||
size_t words;
|
||||
Tcl_Size words;
|
||||
|
||||
/*
|
||||
* This one has its own implementation because the ** operator is the only
|
||||
@@ -4513,7 +4513,7 @@ TclCompileMinusOpCmd(
|
||||
{
|
||||
DefineLineInformation; /* TIP #280 */
|
||||
Tcl_Token *tokenPtr = parsePtr->tokenPtr;
|
||||
size_t words;
|
||||
Tcl_Size words;
|
||||
|
||||
/* TODO: Consider support for compiling expanded args. */
|
||||
if (parsePtr->numWords == 1) {
|
||||
@@ -4538,7 +4538,7 @@ TclCompileMinusOpCmd(
|
||||
|
||||
/*
|
||||
* Reverse order of arguments to get precise agreement with [expr] in
|
||||
* calcuations, including roundoff errors.
|
||||
* calculations, including roundoff errors.
|
||||
*/
|
||||
|
||||
TclEmitInstInt4(INST_REVERSE, words-1, envPtr);
|
||||
@@ -4558,7 +4558,7 @@ TclCompileDivOpCmd(
|
||||
{
|
||||
DefineLineInformation; /* TIP #280 */
|
||||
Tcl_Token *tokenPtr = parsePtr->tokenPtr;
|
||||
size_t words;
|
||||
Tcl_Size words;
|
||||
|
||||
/* TODO: Consider support for compiling expanded args. */
|
||||
if (parsePtr->numWords == 1) {
|
||||
@@ -4582,7 +4582,7 @@ TclCompileDivOpCmd(
|
||||
|
||||
/*
|
||||
* Reverse order of arguments to get precise agreement with [expr] in
|
||||
* calcuations, including roundoff errors.
|
||||
* calculations, including roundoff errors.
|
||||
*/
|
||||
|
||||
TclEmitInstInt4(INST_REVERSE, words-1, envPtr);
|
||||
|
||||
@@ -798,14 +798,14 @@ ParseExpr(
|
||||
switch (start[1]) {
|
||||
case 'b':
|
||||
Tcl_AppendToObj(post,
|
||||
" (invalid binary number?)", -1);
|
||||
" (invalid binary number?)", TCL_INDEX_NONE);
|
||||
parsePtr->errorType = TCL_PARSE_BAD_NUMBER;
|
||||
errCode = "BADNUMBER";
|
||||
subErrCode = "BINARY";
|
||||
break;
|
||||
case 'o':
|
||||
Tcl_AppendToObj(post,
|
||||
" (invalid octal number?)", -1);
|
||||
" (invalid octal number?)", TCL_INDEX_NONE);
|
||||
parsePtr->errorType = TCL_PARSE_BAD_NUMBER;
|
||||
errCode = "BADNUMBER";
|
||||
subErrCode = "OCTAL";
|
||||
@@ -813,7 +813,7 @@ ParseExpr(
|
||||
default:
|
||||
if (isdigit(UCHAR(start[1]))) {
|
||||
Tcl_AppendToObj(post,
|
||||
" (invalid octal number?)", -1);
|
||||
" (invalid octal number?)", TCL_INDEX_NONE);
|
||||
parsePtr->errorType = TCL_PARSE_BAD_NUMBER;
|
||||
errCode = "BADNUMBER";
|
||||
subErrCode = "OCTAL";
|
||||
@@ -1462,7 +1462,7 @@ ParseExpr(
|
||||
*/
|
||||
|
||||
if (post != NULL) {
|
||||
Tcl_AppendToObj(msg, ";\n", -1);
|
||||
Tcl_AppendToObj(msg, ";\n", TCL_INDEX_NONE);
|
||||
Tcl_AppendObjToObj(msg, post);
|
||||
Tcl_DecrRefCount(post);
|
||||
}
|
||||
@@ -1860,7 +1860,7 @@ int
|
||||
Tcl_ParseExpr(
|
||||
Tcl_Interp *interp, /* Used for error reporting. */
|
||||
const char *start, /* Start of source string to parse. */
|
||||
size_t numBytes, /* Number of bytes in string. If -1, the
|
||||
Tcl_Size numBytes, /* Number of bytes in string. If -1, the
|
||||
* string consists of all bytes up to the
|
||||
* first null character. */
|
||||
Tcl_Parse *parsePtr) /* Structure to fill with information about
|
||||
@@ -1876,7 +1876,7 @@ Tcl_ParseExpr(
|
||||
|
||||
TclNewObj(litList);
|
||||
TclNewObj(funcList);
|
||||
if (numBytes == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(numBytes)) {
|
||||
numBytes = (start ? strlen(start) : 0);
|
||||
}
|
||||
|
||||
@@ -2111,7 +2111,7 @@ ParseLexeme(
|
||||
* Example: Inf + luence + () becomes a valid function call.
|
||||
* [Bug 3401704]
|
||||
*/
|
||||
if (TclHasInternalRep(literal, &tclDoubleType)) {
|
||||
if (TclHasInternalRep(literal, &tclDoubleType.objType)) {
|
||||
const char *p = start;
|
||||
|
||||
while (p < end) {
|
||||
@@ -2197,7 +2197,7 @@ void
|
||||
TclCompileExpr(
|
||||
Tcl_Interp *interp, /* Used for error reporting. */
|
||||
const char *script, /* The source script to compile. */
|
||||
size_t numBytes, /* Number of bytes in script. */
|
||||
Tcl_Size numBytes, /* Number of bytes in script. */
|
||||
CompileEnv *envPtr, /* Holds resulting instructions. */
|
||||
int optimize) /* 0 for one-off expressions. */
|
||||
{
|
||||
@@ -2790,7 +2790,7 @@ TclVariadicOpCmd(
|
||||
nodes[1].p.parent = 0;
|
||||
} else {
|
||||
if (lexeme == DIVIDE) {
|
||||
litObjv[0] = Tcl_NewDoubleObj(1.0);
|
||||
TclNewDoubleObj(litObjv[0], 1.0);
|
||||
} else {
|
||||
TclNewIntObj(litObjv[0], occdPtr->i.identity);
|
||||
}
|
||||
|
||||
+47
-47
@@ -680,9 +680,9 @@ static void DupByteCodeInternalRep(Tcl_Obj *srcPtr,
|
||||
static unsigned char * EncodeCmdLocMap(CompileEnv *envPtr,
|
||||
ByteCode *codePtr, unsigned char *startPtr);
|
||||
static void EnterCmdExtentData(CompileEnv *envPtr,
|
||||
size_t cmdNumber, size_t numSrcBytes, size_t numCodeBytes);
|
||||
Tcl_Size cmdNumber, Tcl_Size numSrcBytes, Tcl_Size numCodeBytes);
|
||||
static void EnterCmdStartData(CompileEnv *envPtr,
|
||||
size_t cmdNumber, size_t srcOffset, size_t codeOffset);
|
||||
Tcl_Size cmdNumber, Tcl_Size srcOffset, Tcl_Size codeOffset);
|
||||
static void FreeByteCodeInternalRep(Tcl_Obj *objPtr);
|
||||
static void FreeSubstCodeInternalRep(Tcl_Obj *objPtr);
|
||||
static int GetCmdLocEncodingSize(CompileEnv *envPtr);
|
||||
@@ -699,9 +699,9 @@ static void StartExpanding(CompileEnv *envPtr);
|
||||
* TIP #280: Helper for building the per-word line information of all compiled
|
||||
* commands.
|
||||
*/
|
||||
static void EnterCmdWordData(ExtCmdLoc *eclPtr, size_t srcOffset,
|
||||
static void EnterCmdWordData(ExtCmdLoc *eclPtr, Tcl_Size srcOffset,
|
||||
Tcl_Token *tokenPtr, const char *cmd,
|
||||
size_t numWords, size_t line, int *clNext, int **lines,
|
||||
Tcl_Size numWords, Tcl_Size line, int *clNext, int **lines,
|
||||
CompileEnv *envPtr);
|
||||
static void ReleaseCmdWordData(ExtCmdLoc *eclPtr);
|
||||
|
||||
@@ -776,7 +776,7 @@ TclSetByteCodeFromAny(
|
||||
Interp *iPtr = (Interp *) interp;
|
||||
CompileEnv compEnv; /* Compilation environment structure allocated
|
||||
* in frame. */
|
||||
size_t length;
|
||||
Tcl_Size length;
|
||||
int result = TCL_OK;
|
||||
const char *stringPtr;
|
||||
Proc *procPtr = iPtr->compiledProcPtr;
|
||||
@@ -1391,7 +1391,7 @@ static void
|
||||
ReleaseCmdWordData(
|
||||
ExtCmdLoc *eclPtr)
|
||||
{
|
||||
size_t i;
|
||||
Tcl_Size i;
|
||||
|
||||
if (eclPtr->type == TCL_LOCATION_SOURCE) {
|
||||
Tcl_DecrRefCount(eclPtr->path);
|
||||
@@ -1553,7 +1553,7 @@ TclInitCompileEnv(
|
||||
pc = 1;
|
||||
}
|
||||
|
||||
if ((ctxPtr->nline <= (size_t)word) || (ctxPtr->line[word] < 0)) {
|
||||
if ((ctxPtr->nline <= (Tcl_Size)word) || (ctxPtr->line[word] < 0)) {
|
||||
/*
|
||||
* Word is not a literal, relative counting.
|
||||
*/
|
||||
@@ -1647,7 +1647,7 @@ TclFreeCompileEnv(
|
||||
* have transferred to it.
|
||||
*/
|
||||
|
||||
size_t i;
|
||||
Tcl_Size i;
|
||||
LiteralEntry *entryPtr = envPtr->literalArrayPtr;
|
||||
AuxData *auxDataPtr = envPtr->auxDataArrayPtr;
|
||||
|
||||
@@ -1748,7 +1748,7 @@ TclWordKnownAtCompileTime(
|
||||
case TCL_TOKEN_BS:
|
||||
if (tempPtr != NULL) {
|
||||
char utfBuf[4] = "";
|
||||
size_t length = TclParseBackslash(tokenPtr->start,
|
||||
Tcl_Size length = TclParseBackslash(tokenPtr->start,
|
||||
tokenPtr->size, NULL, utfBuf);
|
||||
|
||||
Tcl_AppendToObj(tempPtr, utfBuf, length);
|
||||
@@ -1812,7 +1812,7 @@ CompileCmdLiteral(
|
||||
const char *bytes;
|
||||
Command *cmdPtr;
|
||||
int cmdLitIdx, extraLiteralFlags = LITERAL_CMD_NAME;
|
||||
size_t length;
|
||||
Tcl_Size length;
|
||||
|
||||
cmdPtr = (Command *) Tcl_GetCommandFromObj(interp, cmdObj);
|
||||
if ((cmdPtr != NULL) && (cmdPtr->flags & CMD_VIA_RESOLVER)) {
|
||||
@@ -2161,7 +2161,7 @@ TclCompileScript(
|
||||
*/
|
||||
if (iPtr->numLevels / 5 > iPtr->maxNestingDepth / 4) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"too many nested compilations (infinite loop?)", -1));
|
||||
"too many nested compilations (infinite loop?)", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "LIMIT", "STACK", NULL);
|
||||
TclCompileSyntaxError(interp, envPtr);
|
||||
return;
|
||||
@@ -2323,8 +2323,8 @@ TclCompileVarSubst(
|
||||
CompileEnv *envPtr)
|
||||
{
|
||||
const char *p, *name = tokenPtr[1].start;
|
||||
size_t i, nameBytes = tokenPtr[1].size;
|
||||
size_t localVar;
|
||||
Tcl_Size i, nameBytes = tokenPtr[1].size;
|
||||
Tcl_Size localVar;
|
||||
int localVarName = 1;
|
||||
|
||||
/*
|
||||
@@ -2356,7 +2356,7 @@ TclCompileVarSubst(
|
||||
if (localVarName != -1) {
|
||||
localVar = TclFindCompiledLocal(name, nameBytes, localVarName, envPtr);
|
||||
}
|
||||
if (localVar == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(localVar)) {
|
||||
PushLiteral(envPtr, name, nameBytes);
|
||||
}
|
||||
|
||||
@@ -2368,7 +2368,7 @@ TclCompileVarSubst(
|
||||
tokenPtr[1].start + tokenPtr[1].size);
|
||||
|
||||
if (tokenPtr->numComponents == 1) {
|
||||
if (localVar == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(localVar)) {
|
||||
TclEmitOpcode(INST_LOAD_STK, envPtr);
|
||||
} else if (localVar <= 255) {
|
||||
TclEmitInstInt1(INST_LOAD_SCALAR1, localVar, envPtr);
|
||||
@@ -2377,7 +2377,7 @@ TclCompileVarSubst(
|
||||
}
|
||||
} else {
|
||||
TclCompileTokens(interp, tokenPtr+2, tokenPtr->numComponents-1, envPtr);
|
||||
if (localVar == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(localVar)) {
|
||||
TclEmitOpcode(INST_LOAD_ARRAY_STK, envPtr);
|
||||
} else if (localVar <= 255) {
|
||||
TclEmitInstInt1(INST_LOAD_ARRAY1, localVar, envPtr);
|
||||
@@ -2400,7 +2400,7 @@ TclCompileTokens(
|
||||
* TCL_TOKEN_TEXT, TCL_TOKEN_BS tokens. */
|
||||
char buffer[4] = "";
|
||||
int i, numObjsToConcat, adjust;
|
||||
size_t length;
|
||||
Tcl_Size length;
|
||||
unsigned char *entryCodeNext = envPtr->codeNext;
|
||||
#define NUM_STATIC_POS 20
|
||||
int isLiteral, maxNumCL, numCL;
|
||||
@@ -2776,7 +2776,7 @@ PreventCycle(
|
||||
Tcl_Obj *objPtr,
|
||||
CompileEnv *envPtr)
|
||||
{
|
||||
size_t i;
|
||||
Tcl_Size i;
|
||||
|
||||
for (i = 0; i < envPtr->literalArrayNext; i++) {
|
||||
if (objPtr == TclFetchLiteral(envPtr, i)) {
|
||||
@@ -2791,7 +2791,7 @@ PreventCycle(
|
||||
* can be sure we do not have any lingering cycles hiding in
|
||||
* the internalrep.
|
||||
*/
|
||||
size_t numBytes;
|
||||
Tcl_Size numBytes;
|
||||
const char *bytes = Tcl_GetStringFromObj(objPtr, &numBytes);
|
||||
Tcl_Obj *copyPtr = Tcl_NewStringObj(bytes, numBytes);
|
||||
|
||||
@@ -2993,19 +2993,19 @@ TclInitByteCodeObj(
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
size_t
|
||||
Tcl_Size
|
||||
TclFindCompiledLocal(
|
||||
const char *name, /* Points to first character of the name of a
|
||||
* scalar or array variable. If NULL, a
|
||||
* temporary var should be created. */
|
||||
size_t nameBytes, /* Number of bytes in the name. */
|
||||
Tcl_Size nameBytes, /* Number of bytes in the name. */
|
||||
int create, /* If 1, allocate a local frame entry for the
|
||||
* variable if it is new. */
|
||||
CompileEnv *envPtr) /* Points to the current compile environment*/
|
||||
{
|
||||
CompiledLocal *localPtr;
|
||||
size_t localVar = TCL_INDEX_NONE;
|
||||
size_t i;
|
||||
Tcl_Size localVar = TCL_INDEX_NONE;
|
||||
Tcl_Size i;
|
||||
Proc *procPtr;
|
||||
|
||||
/*
|
||||
@@ -3024,7 +3024,7 @@ TclFindCompiledLocal(
|
||||
LocalCache *cachePtr = envPtr->iPtr->varFramePtr->localCachePtr;
|
||||
const char *localName;
|
||||
Tcl_Obj **varNamePtr;
|
||||
size_t len;
|
||||
Tcl_Size len;
|
||||
|
||||
if (!cachePtr || !name) {
|
||||
return TCL_INDEX_NONE;
|
||||
@@ -3043,7 +3043,7 @@ TclFindCompiledLocal(
|
||||
}
|
||||
|
||||
if (name != NULL) {
|
||||
size_t localCt = procPtr->numCompiledLocals;
|
||||
Tcl_Size localCt = procPtr->numCompiledLocals;
|
||||
|
||||
localPtr = procPtr->firstLocalPtr;
|
||||
for (i = 0; i < localCt; i++) {
|
||||
@@ -3171,14 +3171,14 @@ EnterCmdStartData(
|
||||
CompileEnv *envPtr, /* Points to the compilation environment
|
||||
* structure in which to enter command
|
||||
* location information. */
|
||||
size_t cmdIndex, /* Index of the command whose start data is
|
||||
Tcl_Size cmdIndex, /* Index of the command whose start data is
|
||||
* being set. */
|
||||
size_t srcOffset, /* Offset of first char of the command. */
|
||||
size_t codeOffset) /* Offset of first byte of command code. */
|
||||
Tcl_Size srcOffset, /* Offset of first char of the command. */
|
||||
Tcl_Size codeOffset) /* Offset of first byte of command code. */
|
||||
{
|
||||
CmdLocation *cmdLocPtr;
|
||||
|
||||
if (cmdIndex >= envPtr->numCommands) {
|
||||
if (TCL_SIZE_ISNEG(cmdIndex) || (cmdIndex >= envPtr->numCommands)) {
|
||||
Tcl_Panic("EnterCmdStartData: bad command index %" TCL_Z_MODIFIER "u", cmdIndex);
|
||||
}
|
||||
|
||||
@@ -3250,14 +3250,14 @@ EnterCmdExtentData(
|
||||
CompileEnv *envPtr, /* Points to the compilation environment
|
||||
* structure in which to enter command
|
||||
* location information. */
|
||||
size_t cmdIndex, /* Index of the command whose source and code
|
||||
Tcl_Size cmdIndex, /* Index of the command whose source and code
|
||||
* length data is being set. */
|
||||
size_t numSrcBytes, /* Number of command source chars. */
|
||||
size_t numCodeBytes) /* Offset of last byte of command code. */
|
||||
Tcl_Size numSrcBytes, /* Number of command source chars. */
|
||||
Tcl_Size numCodeBytes) /* Offset of last byte of command code. */
|
||||
{
|
||||
CmdLocation *cmdLocPtr;
|
||||
|
||||
if (cmdIndex >= envPtr->numCommands) {
|
||||
if (TCL_SIZE_ISNEG(cmdIndex) || (cmdIndex >= envPtr->numCommands)) {
|
||||
Tcl_Panic("EnterCmdExtentData: bad command index %" TCL_Z_MODIFIER "u", cmdIndex);
|
||||
}
|
||||
|
||||
@@ -3296,18 +3296,18 @@ EnterCmdWordData(
|
||||
ExtCmdLoc *eclPtr, /* Points to the map environment structure in
|
||||
* which to enter command location
|
||||
* information. */
|
||||
size_t srcOffset, /* Offset of first char of the command. */
|
||||
Tcl_Size srcOffset, /* Offset of first char of the command. */
|
||||
Tcl_Token *tokenPtr,
|
||||
const char *cmd,
|
||||
size_t numWords,
|
||||
size_t line,
|
||||
Tcl_Size numWords,
|
||||
Tcl_Size line,
|
||||
int *clNext,
|
||||
int **wlines,
|
||||
CompileEnv *envPtr)
|
||||
{
|
||||
ECL *ePtr;
|
||||
const char *last;
|
||||
size_t wordIdx, wordLine;
|
||||
Tcl_Size wordIdx, wordLine;
|
||||
int *wwlines, *wordNext;
|
||||
|
||||
if (eclPtr->nuloc >= eclPtr->nloc) {
|
||||
@@ -3373,7 +3373,7 @@ EnterCmdWordData(
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
size_t
|
||||
Tcl_Size
|
||||
TclCreateExceptRange(
|
||||
ExceptionRangeType type, /* The kind of ExceptionRange desired. */
|
||||
CompileEnv *envPtr)/* Points to CompileEnv for which to create a
|
||||
@@ -3381,7 +3381,7 @@ TclCreateExceptRange(
|
||||
{
|
||||
ExceptionRange *rangePtr;
|
||||
ExceptionAux *auxPtr;
|
||||
size_t index = envPtr->exceptArrayNext;
|
||||
Tcl_Size index = envPtr->exceptArrayNext;
|
||||
|
||||
if (index >= envPtr->exceptArrayEnd) {
|
||||
/*
|
||||
@@ -3512,7 +3512,7 @@ TclAddLoopBreakFixup(
|
||||
auxPtr->allocBreakTargets *= 2;
|
||||
auxPtr->allocBreakTargets += 2;
|
||||
if (auxPtr->breakTargets) {
|
||||
auxPtr->breakTargets = (size_t *)Tcl_Realloc(auxPtr->breakTargets,
|
||||
auxPtr->breakTargets = (TCL_HASH_TYPE *)Tcl_Realloc(auxPtr->breakTargets,
|
||||
sizeof(size_t) * auxPtr->allocBreakTargets);
|
||||
} else {
|
||||
auxPtr->breakTargets =
|
||||
@@ -3734,7 +3734,7 @@ TclFinalizeLoopExceptionRange(
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
size_t
|
||||
Tcl_Size
|
||||
TclCreateAuxData(
|
||||
void *clientData, /* The compilation auxiliary data to store in
|
||||
* the new aux data record. */
|
||||
@@ -3743,7 +3743,7 @@ TclCreateAuxData(
|
||||
CompileEnv *envPtr)/* Points to the CompileEnv for which a new
|
||||
* aux data structure is to be allocated. */
|
||||
{
|
||||
size_t index; /* Index for the new AuxData structure. */
|
||||
Tcl_Size index; /* Index for the new AuxData structure. */
|
||||
AuxData *auxDataPtr;
|
||||
/* Points to the new AuxData structure */
|
||||
|
||||
@@ -4416,8 +4416,8 @@ EncodeCmdLocMap(
|
||||
* is to be stored. */
|
||||
{
|
||||
CmdLocation *mapPtr = envPtr->cmdMapPtr;
|
||||
size_t i, codeDelta, codeLen, srcLen, prevOffset;
|
||||
size_t numCmds = envPtr->numCommands;
|
||||
Tcl_Size i, codeDelta, codeLen, srcLen, prevOffset;
|
||||
Tcl_Size numCmds = envPtr->numCommands;
|
||||
unsigned char *p = startPtr;
|
||||
int srcDelta;
|
||||
|
||||
@@ -4429,7 +4429,7 @@ EncodeCmdLocMap(
|
||||
prevOffset = 0;
|
||||
for (i = 0; i < numCmds; i++) {
|
||||
codeDelta = mapPtr[i].codeOffset - prevOffset;
|
||||
if (codeDelta == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(codeDelta)) {
|
||||
Tcl_Panic("EncodeCmdLocMap: bad code offset");
|
||||
} else if (codeDelta <= 127) {
|
||||
TclStoreInt1AtPtr(codeDelta, p);
|
||||
@@ -4450,7 +4450,7 @@ EncodeCmdLocMap(
|
||||
codePtr->codeLengthStart = p;
|
||||
for (i = 0; i < numCmds; i++) {
|
||||
codeLen = mapPtr[i].numCodeBytes;
|
||||
if (codeLen == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(codeLen)) {
|
||||
Tcl_Panic("EncodeCmdLocMap: bad code length");
|
||||
} else if (codeLen <= 127) {
|
||||
TclStoreInt1AtPtr(codeLen, p);
|
||||
@@ -4490,7 +4490,7 @@ EncodeCmdLocMap(
|
||||
codePtr->srcLengthStart = p;
|
||||
for (i = 0; i < numCmds; i++) {
|
||||
srcLen = mapPtr[i].numSrcBytes;
|
||||
if (srcLen == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(srcLen)) {
|
||||
Tcl_Panic("EncodeCmdLocMap: bad source length");
|
||||
} else if (srcLen <= 127) {
|
||||
TclStoreInt1AtPtr(srcLen, p);
|
||||
|
||||
+12
-12
@@ -1084,7 +1084,7 @@ MODULE_SCOPE ByteCode * TclCompileObj(Tcl_Interp *interp, Tcl_Obj *objPtr,
|
||||
*/
|
||||
|
||||
MODULE_SCOPE int TclAttemptCompileProc(Tcl_Interp *interp,
|
||||
Tcl_Parse *parsePtr, size_t depth, Command *cmdPtr,
|
||||
Tcl_Parse *parsePtr, Tcl_Size depth, Command *cmdPtr,
|
||||
CompileEnv *envPtr);
|
||||
MODULE_SCOPE void TclCleanupStackForBreakContinue(CompileEnv *envPtr,
|
||||
ExceptionAux *auxPtr);
|
||||
@@ -1092,7 +1092,7 @@ MODULE_SCOPE void TclCompileCmdWord(Tcl_Interp *interp,
|
||||
Tcl_Token *tokenPtr, size_t count,
|
||||
CompileEnv *envPtr);
|
||||
MODULE_SCOPE void TclCompileExpr(Tcl_Interp *interp, const char *script,
|
||||
size_t numBytes, CompileEnv *envPtr, int optimize);
|
||||
Tcl_Size numBytes, CompileEnv *envPtr, int optimize);
|
||||
MODULE_SCOPE void TclCompileExprWords(Tcl_Interp *interp,
|
||||
Tcl_Token *tokenPtr, size_t numWords,
|
||||
CompileEnv *envPtr);
|
||||
@@ -1109,13 +1109,13 @@ MODULE_SCOPE void TclCompileTokens(Tcl_Interp *interp,
|
||||
CompileEnv *envPtr);
|
||||
MODULE_SCOPE void TclCompileVarSubst(Tcl_Interp *interp,
|
||||
Tcl_Token *tokenPtr, CompileEnv *envPtr);
|
||||
MODULE_SCOPE size_t TclCreateAuxData(void *clientData,
|
||||
MODULE_SCOPE Tcl_Size TclCreateAuxData(void *clientData,
|
||||
const AuxDataType *typePtr, CompileEnv *envPtr);
|
||||
MODULE_SCOPE size_t TclCreateExceptRange(ExceptionRangeType type,
|
||||
MODULE_SCOPE Tcl_Size TclCreateExceptRange(ExceptionRangeType type,
|
||||
CompileEnv *envPtr);
|
||||
MODULE_SCOPE ExecEnv * TclCreateExecEnv(Tcl_Interp *interp, size_t size);
|
||||
MODULE_SCOPE Tcl_Obj * TclCreateLiteral(Interp *iPtr, const char *bytes,
|
||||
size_t length, TCL_HASH_TYPE hash, int *newPtr,
|
||||
size_t length, size_t hash, int *newPtr,
|
||||
Namespace *nsPtr, int flags,
|
||||
LiteralEntry **globalPtrPtr);
|
||||
MODULE_SCOPE void TclDeleteExecEnv(ExecEnv *eePtr);
|
||||
@@ -1129,8 +1129,8 @@ MODULE_SCOPE ExceptionRange * TclGetExceptionRangeForPc(unsigned char *pc,
|
||||
MODULE_SCOPE void TclExpandJumpFixupArray(JumpFixupArray *fixupArrayPtr);
|
||||
MODULE_SCOPE int TclNRExecuteByteCode(Tcl_Interp *interp,
|
||||
ByteCode *codePtr);
|
||||
MODULE_SCOPE Tcl_Obj * TclFetchLiteral(CompileEnv *envPtr, TCL_HASH_TYPE index);
|
||||
MODULE_SCOPE size_t TclFindCompiledLocal(const char *name, size_t nameChars,
|
||||
MODULE_SCOPE Tcl_Obj * TclFetchLiteral(CompileEnv *envPtr, Tcl_Size index);
|
||||
MODULE_SCOPE Tcl_Size TclFindCompiledLocal(const char *name, Tcl_Size nameChars,
|
||||
int create, CompileEnv *envPtr);
|
||||
MODULE_SCOPE int TclFixupForwardJump(CompileEnv *envPtr,
|
||||
JumpFixup *jumpFixupPtr, int jumpDist,
|
||||
@@ -1171,9 +1171,9 @@ MODULE_SCOPE void TclPrintByteCodeObj(Tcl_Interp *interp,
|
||||
MODULE_SCOPE int TclPrintInstruction(ByteCode *codePtr,
|
||||
const unsigned char *pc);
|
||||
MODULE_SCOPE void TclPrintObject(FILE *outFile,
|
||||
Tcl_Obj *objPtr, size_t maxChars);
|
||||
Tcl_Obj *objPtr, Tcl_Size maxChars);
|
||||
MODULE_SCOPE void TclPrintSource(FILE *outFile,
|
||||
const char *string, size_t maxChars);
|
||||
const char *string, Tcl_Size maxChars);
|
||||
MODULE_SCOPE void TclPushVarName(Tcl_Interp *interp,
|
||||
Tcl_Token *varTokenPtr, CompileEnv *envPtr,
|
||||
int flags, int *localIndexPtr,
|
||||
@@ -1195,13 +1195,13 @@ MODULE_SCOPE int TclWordKnownAtCompileTime(Tcl_Token *tokenPtr,
|
||||
Tcl_Obj *valuePtr);
|
||||
MODULE_SCOPE void TclLogCommandInfo(Tcl_Interp *interp,
|
||||
const char *script, const char *command,
|
||||
size_t length, const unsigned char *pc,
|
||||
Tcl_Size length, const unsigned char *pc,
|
||||
Tcl_Obj **tosPtr);
|
||||
MODULE_SCOPE Tcl_Obj *TclGetInnerContext(Tcl_Interp *interp,
|
||||
const unsigned char *pc, Tcl_Obj **tosPtr);
|
||||
MODULE_SCOPE Tcl_Obj *TclNewInstNameObj(unsigned char inst);
|
||||
MODULE_SCOPE int TclPushProcCallFrame(void *clientData,
|
||||
Tcl_Interp *interp, size_t objc,
|
||||
Tcl_Interp *interp, Tcl_Size objc,
|
||||
Tcl_Obj *const objv[], int isLambda);
|
||||
#endif /* TCL_MAJOR_VERSION > 8 */
|
||||
|
||||
@@ -1817,7 +1817,7 @@ MODULE_SCOPE void TclDTraceInfo(Tcl_Obj *info, const char **args, int *argsi);
|
||||
FILE *tclDTraceDebugLog = NULL; \
|
||||
void TclDTraceOpenDebugLog(void) { \
|
||||
char n[35]; \
|
||||
sprintf(n, "/tmp/tclDTraceDebug-%" TCL_Z_MODIFIER "u.log", \
|
||||
snprintf(n, sizeof(n), "/tmp/tclDTraceDebug-%" TCL_Z_MODIFIER "u.log", \
|
||||
(size_t) getpid()); \
|
||||
tclDTraceDebugLog = fopen(n, "a"); \
|
||||
}
|
||||
|
||||
+10
-7
@@ -85,7 +85,7 @@ Tcl_RegisterConfig(
|
||||
} else {
|
||||
cdPtr->encoding = NULL;
|
||||
}
|
||||
cdPtr->pkg = Tcl_NewStringObj(pkgName, -1);
|
||||
cdPtr->pkg = Tcl_NewStringObj(pkgName, TCL_INDEX_NONE);
|
||||
|
||||
/*
|
||||
* Phase I: Adding the provided information to the internal database of
|
||||
@@ -127,7 +127,7 @@ Tcl_RegisterConfig(
|
||||
*/
|
||||
|
||||
for (cfg=configuration ; cfg->key!=NULL && cfg->key[0]!='\0' ; cfg++) {
|
||||
Tcl_DictObjPut(interp, pkgDict, Tcl_NewStringObj(cfg->key, -1),
|
||||
Tcl_DictObjPut(interp, pkgDict, Tcl_NewStringObj(cfg->key, TCL_INDEX_NONE),
|
||||
Tcl_NewByteArrayObj((unsigned char *)cfg->value, strlen(cfg->value)));
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ Tcl_RegisterConfig(
|
||||
|
||||
Tcl_DStringInit(&cmdName);
|
||||
TclDStringAppendLiteral(&cmdName, "::");
|
||||
Tcl_DStringAppend(&cmdName, pkgName, -1);
|
||||
Tcl_DStringAppend(&cmdName, pkgName, TCL_INDEX_NONE);
|
||||
|
||||
/*
|
||||
* The incomplete command name is the name of the namespace to place it
|
||||
@@ -227,7 +227,7 @@ QueryConfigObjCmd(
|
||||
* present.
|
||||
*/
|
||||
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj("package not known", -1));
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj("package not known", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "FATAL", "PKGCFG_BASE",
|
||||
TclGetString(pkgName), NULL);
|
||||
return TCL_ERROR;
|
||||
@@ -242,7 +242,7 @@ QueryConfigObjCmd(
|
||||
|
||||
if (Tcl_DictObjGet(interp, pkgDict, objv[2], &val) != TCL_OK
|
||||
|| val == NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj("key not known", -1));
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj("key not known", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "CONFIG",
|
||||
TclGetString(objv[2]), NULL);
|
||||
return TCL_ERROR;
|
||||
@@ -258,7 +258,10 @@ QueryConfigObjCmd(
|
||||
* Value is stored as-is in a byte array, see Bug [9b2e636361],
|
||||
* so we have to decode it first.
|
||||
*/
|
||||
value = (const char *) Tcl_GetByteArrayFromObj(val, &n);
|
||||
value = (const char *) Tcl_GetBytesFromObj(interp, val, &n);
|
||||
if (value == NULL) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
value = Tcl_ExternalToUtfDString(venc, value, n, &conv);
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(value,
|
||||
Tcl_DStringLength(&conv)));
|
||||
@@ -276,7 +279,7 @@ QueryConfigObjCmd(
|
||||
|
||||
if (!listPtr) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"insufficient memory to create list", -1));
|
||||
"insufficient memory to create list", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
+58
-33
@@ -860,7 +860,7 @@ EXTERN int Tcl_UniCharToTitle(int ch);
|
||||
/* 323 */
|
||||
EXTERN int Tcl_UniCharToUpper(int ch);
|
||||
/* 324 */
|
||||
EXTERN int Tcl_UniCharToUtf(int ch, char *buf);
|
||||
EXTERN Tcl_Size Tcl_UniCharToUtf(int ch, char *buf);
|
||||
/* 325 */
|
||||
EXTERN const char * TclUtfAtIndex(const char *src, Tcl_Size index);
|
||||
/* 326 */
|
||||
@@ -888,14 +888,14 @@ EXTERN char * Tcl_UtfToExternalDString(Tcl_Encoding encoding,
|
||||
const char *src, Tcl_Size srcLen,
|
||||
Tcl_DString *dsPtr);
|
||||
/* 334 */
|
||||
EXTERN int Tcl_UtfToLower(char *src);
|
||||
EXTERN Tcl_Size Tcl_UtfToLower(char *src);
|
||||
/* 335 */
|
||||
EXTERN int Tcl_UtfToTitle(char *src);
|
||||
EXTERN Tcl_Size Tcl_UtfToTitle(char *src);
|
||||
/* 336 */
|
||||
EXTERN int Tcl_UtfToChar16(const char *src,
|
||||
EXTERN Tcl_Size Tcl_UtfToChar16(const char *src,
|
||||
unsigned short *chPtr);
|
||||
/* 337 */
|
||||
EXTERN int Tcl_UtfToUpper(char *src);
|
||||
EXTERN Tcl_Size Tcl_UtfToUpper(char *src);
|
||||
/* 338 */
|
||||
EXTERN Tcl_Size Tcl_WriteChars(Tcl_Channel chan, const char *src,
|
||||
Tcl_Size srcLen);
|
||||
@@ -1735,7 +1735,7 @@ EXTERN int Tcl_GetIntForIndex(Tcl_Interp *interp,
|
||||
Tcl_Obj *objPtr, Tcl_Size endValue,
|
||||
Tcl_Size *indexPtr);
|
||||
/* 646 */
|
||||
EXTERN int Tcl_UtfToUniChar(const char *src, int *chPtr);
|
||||
EXTERN Tcl_Size Tcl_UtfToUniChar(const char *src, int *chPtr);
|
||||
/* 647 */
|
||||
EXTERN char * Tcl_UniCharToUtfDString(const int *uniStr,
|
||||
Tcl_Size uniLength, Tcl_DString *dsPtr);
|
||||
@@ -1766,13 +1766,17 @@ EXTERN const char * Tcl_UtfPrev(const char *src, const char *start);
|
||||
/* 657 */
|
||||
EXTERN int Tcl_UniCharIsUnicode(int ch);
|
||||
/* 658 */
|
||||
EXTERN Tcl_Size Tcl_ExternalToUtfDStringEx(Tcl_Encoding encoding,
|
||||
const char *src, Tcl_Size srcLen, int flags,
|
||||
Tcl_DString *dsPtr);
|
||||
EXTERN int Tcl_ExternalToUtfDStringEx(Tcl_Interp *interp,
|
||||
Tcl_Encoding encoding, const char *src,
|
||||
Tcl_Size srcLen, int flags,
|
||||
Tcl_DString *dsPtr,
|
||||
Tcl_Size *errorLocationPtr);
|
||||
/* 659 */
|
||||
EXTERN Tcl_Size Tcl_UtfToExternalDStringEx(Tcl_Encoding encoding,
|
||||
const char *src, Tcl_Size srcLen, int flags,
|
||||
Tcl_DString *dsPtr);
|
||||
EXTERN int Tcl_UtfToExternalDStringEx(Tcl_Interp *interp,
|
||||
Tcl_Encoding encoding, const char *src,
|
||||
Tcl_Size srcLen, int flags,
|
||||
Tcl_DString *dsPtr,
|
||||
Tcl_Size *errorLocationPtr);
|
||||
/* 660 */
|
||||
EXTERN int Tcl_AsyncMarkFromSignal(Tcl_AsyncHandler async,
|
||||
int sigNumber);
|
||||
@@ -1851,7 +1855,15 @@ EXTERN int Tcl_GetNumber(Tcl_Interp *interp, const char *bytes,
|
||||
EXTERN int Tcl_RemoveChannelMode(Tcl_Interp *interp,
|
||||
Tcl_Channel chan, int mode);
|
||||
/* 683 */
|
||||
EXTERN int Tcl_GetEncodingNulLength(Tcl_Encoding encoding);
|
||||
EXTERN Tcl_Size Tcl_GetEncodingNulLength(Tcl_Encoding encoding);
|
||||
/* 684 */
|
||||
EXTERN int Tcl_GetWideUIntFromObj(Tcl_Interp *interp,
|
||||
Tcl_Obj *objPtr, Tcl_WideUInt *uwidePtr);
|
||||
/* 685 */
|
||||
EXTERN Tcl_Obj * Tcl_DStringToObj(Tcl_DString *dsPtr);
|
||||
/* Slot 686 is reserved */
|
||||
/* 687 */
|
||||
EXTERN void TclUnusedStubEntry(void);
|
||||
|
||||
typedef struct {
|
||||
const struct TclPlatStubs *tclPlatStubs;
|
||||
@@ -2187,7 +2199,7 @@ typedef struct TclStubs {
|
||||
int (*tcl_UniCharToLower) (int ch); /* 321 */
|
||||
int (*tcl_UniCharToTitle) (int ch); /* 322 */
|
||||
int (*tcl_UniCharToUpper) (int ch); /* 323 */
|
||||
int (*tcl_UniCharToUtf) (int ch, char *buf); /* 324 */
|
||||
Tcl_Size (*tcl_UniCharToUtf) (int ch, char *buf); /* 324 */
|
||||
const char * (*tclUtfAtIndex) (const char *src, Tcl_Size index); /* 325 */
|
||||
int (*tclUtfCharComplete) (const char *src, Tcl_Size length); /* 326 */
|
||||
Tcl_Size (*tcl_UtfBackslash) (const char *src, int *readPtr, char *dst); /* 327 */
|
||||
@@ -2197,10 +2209,10 @@ typedef struct TclStubs {
|
||||
const char * (*tclUtfPrev) (const char *src, const char *start); /* 331 */
|
||||
int (*tcl_UtfToExternal) (Tcl_Interp *interp, Tcl_Encoding encoding, const char *src, Tcl_Size srcLen, int flags, Tcl_EncodingState *statePtr, char *dst, Tcl_Size dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr); /* 332 */
|
||||
char * (*tcl_UtfToExternalDString) (Tcl_Encoding encoding, const char *src, Tcl_Size srcLen, Tcl_DString *dsPtr); /* 333 */
|
||||
int (*tcl_UtfToLower) (char *src); /* 334 */
|
||||
int (*tcl_UtfToTitle) (char *src); /* 335 */
|
||||
int (*tcl_UtfToChar16) (const char *src, unsigned short *chPtr); /* 336 */
|
||||
int (*tcl_UtfToUpper) (char *src); /* 337 */
|
||||
Tcl_Size (*tcl_UtfToLower) (char *src); /* 334 */
|
||||
Tcl_Size (*tcl_UtfToTitle) (char *src); /* 335 */
|
||||
Tcl_Size (*tcl_UtfToChar16) (const char *src, unsigned short *chPtr); /* 336 */
|
||||
Tcl_Size (*tcl_UtfToUpper) (char *src); /* 337 */
|
||||
Tcl_Size (*tcl_WriteChars) (Tcl_Channel chan, const char *src, Tcl_Size srcLen); /* 338 */
|
||||
Tcl_Size (*tcl_WriteObj) (Tcl_Channel chan, Tcl_Obj *objPtr); /* 339 */
|
||||
char * (*tcl_GetString) (Tcl_Obj *objPtr); /* 340 */
|
||||
@@ -2509,7 +2521,7 @@ typedef struct TclStubs {
|
||||
int (*tcl_IsShared) (Tcl_Obj *objPtr); /* 643 */
|
||||
int (*tcl_LinkArray) (Tcl_Interp *interp, const char *varName, void *addr, int type, Tcl_Size size); /* 644 */
|
||||
int (*tcl_GetIntForIndex) (Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_Size endValue, Tcl_Size *indexPtr); /* 645 */
|
||||
int (*tcl_UtfToUniChar) (const char *src, int *chPtr); /* 646 */
|
||||
Tcl_Size (*tcl_UtfToUniChar) (const char *src, int *chPtr); /* 646 */
|
||||
char * (*tcl_UniCharToUtfDString) (const int *uniStr, Tcl_Size uniLength, Tcl_DString *dsPtr); /* 647 */
|
||||
int * (*tcl_UtfToUniCharDString) (const char *src, Tcl_Size length, Tcl_DString *dsPtr); /* 648 */
|
||||
unsigned char * (*tclGetBytesFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *numBytesPtr); /* 649 */
|
||||
@@ -2521,8 +2533,8 @@ typedef struct TclStubs {
|
||||
const char * (*tcl_UtfNext) (const char *src); /* 655 */
|
||||
const char * (*tcl_UtfPrev) (const char *src, const char *start); /* 656 */
|
||||
int (*tcl_UniCharIsUnicode) (int ch); /* 657 */
|
||||
Tcl_Size (*tcl_ExternalToUtfDStringEx) (Tcl_Encoding encoding, const char *src, Tcl_Size srcLen, int flags, Tcl_DString *dsPtr); /* 658 */
|
||||
Tcl_Size (*tcl_UtfToExternalDStringEx) (Tcl_Encoding encoding, const char *src, Tcl_Size srcLen, int flags, Tcl_DString *dsPtr); /* 659 */
|
||||
int (*tcl_ExternalToUtfDStringEx) (Tcl_Interp *interp, Tcl_Encoding encoding, const char *src, Tcl_Size srcLen, int flags, Tcl_DString *dsPtr, Tcl_Size *errorLocationPtr); /* 658 */
|
||||
int (*tcl_UtfToExternalDStringEx) (Tcl_Interp *interp, Tcl_Encoding encoding, const char *src, Tcl_Size srcLen, int flags, Tcl_DString *dsPtr, Tcl_Size *errorLocationPtr); /* 659 */
|
||||
int (*tcl_AsyncMarkFromSignal) (Tcl_AsyncHandler async, int sigNumber); /* 660 */
|
||||
int (*tcl_ListObjGetElements) (Tcl_Interp *interp, Tcl_Obj *listPtr, size_t *objcPtr, Tcl_Obj ***objvPtr); /* 661 */
|
||||
int (*tcl_ListObjLength) (Tcl_Interp *interp, Tcl_Obj *listPtr, size_t *lengthPtr); /* 662 */
|
||||
@@ -2546,7 +2558,11 @@ typedef struct TclStubs {
|
||||
int (*tcl_GetNumberFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, void **clientDataPtr, int *typePtr); /* 680 */
|
||||
int (*tcl_GetNumber) (Tcl_Interp *interp, const char *bytes, size_t numBytes, void **clientDataPtr, int *typePtr); /* 681 */
|
||||
int (*tcl_RemoveChannelMode) (Tcl_Interp *interp, Tcl_Channel chan, int mode); /* 682 */
|
||||
int (*tcl_GetEncodingNulLength) (Tcl_Encoding encoding); /* 683 */
|
||||
Tcl_Size (*tcl_GetEncodingNulLength) (Tcl_Encoding encoding); /* 683 */
|
||||
int (*tcl_GetWideUIntFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_WideUInt *uwidePtr); /* 684 */
|
||||
Tcl_Obj * (*tcl_DStringToObj) (Tcl_DString *dsPtr); /* 685 */
|
||||
void (*reserved686)(void);
|
||||
void (*tclUnusedStubEntry) (void); /* 687 */
|
||||
} TclStubs;
|
||||
|
||||
extern const TclStubs *tclStubsPtr;
|
||||
@@ -3867,11 +3883,20 @@ extern const TclStubs *tclStubsPtr;
|
||||
(tclStubsPtr->tcl_RemoveChannelMode) /* 682 */
|
||||
#define Tcl_GetEncodingNulLength \
|
||||
(tclStubsPtr->tcl_GetEncodingNulLength) /* 683 */
|
||||
#define Tcl_GetWideUIntFromObj \
|
||||
(tclStubsPtr->tcl_GetWideUIntFromObj) /* 684 */
|
||||
#define Tcl_DStringToObj \
|
||||
(tclStubsPtr->tcl_DStringToObj) /* 685 */
|
||||
/* Slot 686 is reserved */
|
||||
#define TclUnusedStubEntry \
|
||||
(tclStubsPtr->tclUnusedStubEntry) /* 687 */
|
||||
|
||||
#endif /* defined(USE_TCL_STUBS) */
|
||||
|
||||
/* !END!: Do not edit above this line. */
|
||||
|
||||
#undef TclUnusedStubEntry
|
||||
|
||||
#ifdef _WIN32
|
||||
# undef Tcl_CreateFileHandler
|
||||
# undef Tcl_DeleteFileHandler
|
||||
@@ -3935,12 +3960,12 @@ extern const TclStubs *tclStubsPtr;
|
||||
|
||||
#undef Tcl_UtfToExternalDString
|
||||
#define Tcl_UtfToExternalDString(encoding, src, len, ds) \
|
||||
(Tcl_UtfToExternalDStringEx((encoding), (src), (len), \
|
||||
TCL_ENCODING_NOCOMPLAIN, (ds)), Tcl_DStringValue(ds))
|
||||
(Tcl_UtfToExternalDStringEx(NULL, (encoding), (src), (len), \
|
||||
TCL_ENCODING_PROFILE_TCL8, (ds), NULL), Tcl_DStringValue(ds))
|
||||
#undef Tcl_ExternalToUtfDString
|
||||
#define Tcl_ExternalToUtfDString(encoding, src, len, ds) \
|
||||
(Tcl_ExternalToUtfDStringEx((encoding), (src), (len), \
|
||||
TCL_ENCODING_NOCOMPLAIN, (ds)), Tcl_DStringValue(ds))
|
||||
(Tcl_ExternalToUtfDStringEx(NULL, (encoding), (src), (len), \
|
||||
TCL_ENCODING_PROFILE_TCL8, (ds), NULL), Tcl_DStringValue(ds))
|
||||
|
||||
#if defined(USE_TCL_STUBS)
|
||||
# if defined(_WIN32) && defined(_WIN64)
|
||||
@@ -3948,14 +3973,14 @@ extern const TclStubs *tclStubsPtr;
|
||||
/* Handle Win64 tk.dll being loaded in Cygwin64. */
|
||||
# define Tcl_GetTime(t) \
|
||||
do { \
|
||||
union { \
|
||||
struct { \
|
||||
Tcl_Time now; \
|
||||
long long reserved; \
|
||||
} _t; \
|
||||
_t.reserved = -1; \
|
||||
tclStubsPtr->tcl_GetTime((&_t.now)); \
|
||||
if (_t.reserved != -1) { \
|
||||
_t.now.usec = _t.reserved; \
|
||||
_t.now.usec = (long) _t.reserved; \
|
||||
} \
|
||||
*(t) = _t.now; \
|
||||
} while (0)
|
||||
@@ -4128,8 +4153,8 @@ extern const TclStubs *tclStubsPtr;
|
||||
? (wchar_t *(*)(const char *, Tcl_Size, Tcl_DString *))tclStubsPtr->tcl_UtfToUniCharDString \
|
||||
: (wchar_t *(*)(const char *, Tcl_Size, Tcl_DString *))Tcl_UtfToChar16DString)
|
||||
# define Tcl_UtfToWChar (sizeof(wchar_t) != sizeof(short) \
|
||||
? (int (*)(const char *, wchar_t *))tclStubsPtr->tcl_UtfToUniChar \
|
||||
: (int (*)(const char *, wchar_t *))Tcl_UtfToChar16)
|
||||
? (Tcl_Size (*)(const char *, wchar_t *))tclStubsPtr->tcl_UtfToUniChar \
|
||||
: (Tcl_Size (*)(const char *, wchar_t *))Tcl_UtfToChar16)
|
||||
# define Tcl_WCharLen (sizeof(wchar_t) != sizeof(short) \
|
||||
? (Tcl_Size (*)(wchar_t *))tclStubsPtr->tcl_UniCharLen \
|
||||
: (Tcl_Size (*)(wchar_t *))Tcl_Char16Len)
|
||||
@@ -4169,8 +4194,8 @@ extern const TclStubs *tclStubsPtr;
|
||||
? (wchar_t *(*)(const char *, Tcl_Size, Tcl_DString *))Tcl_UtfToUniCharDString \
|
||||
: (wchar_t *(*)(const char *, Tcl_Size, Tcl_DString *))Tcl_UtfToChar16DString)
|
||||
# define Tcl_UtfToWChar (sizeof(wchar_t) != sizeof(short) \
|
||||
? (int (*)(const char *, wchar_t *))Tcl_UtfToUniChar \
|
||||
: (int (*)(const char *, wchar_t *))Tcl_UtfToChar16)
|
||||
? (Tcl_Size (*)(const char *, wchar_t *))Tcl_UtfToUniChar \
|
||||
: (Tcl_Size (*)(const char *, wchar_t *))Tcl_UtfToChar16)
|
||||
# define Tcl_WCharLen (sizeof(wchar_t) != sizeof(short) \
|
||||
? (Tcl_Size (*)(wchar_t *))Tcl_UniCharLen \
|
||||
: (Tcl_Size (*)(wchar_t *))Tcl_Char16Len)
|
||||
@@ -4208,7 +4233,7 @@ extern const TclStubs *tclStubsPtr;
|
||||
#define Tcl_GlobalEvalObj(interp, objPtr) \
|
||||
Tcl_EvalObjEx(interp, objPtr, TCL_EVAL_GLOBAL)
|
||||
|
||||
#if defined(TCL_8_COMPAT) && !defined(BUILD_tcl)
|
||||
#if defined(TCL_SIGNED_SIZE) && !defined(BUILD_tcl) && TCL_MAJOR_VERSION > 8
|
||||
# ifdef USE_TCL_STUBS
|
||||
# undef Tcl_Gets
|
||||
# undef Tcl_GetsObj
|
||||
|
||||
+10
-10
@@ -603,7 +603,7 @@ SetDictFromAny(
|
||||
* the conversion from lists to dictionaries.
|
||||
*/
|
||||
|
||||
if (TclHasInternalRep(objPtr, &tclListType)) {
|
||||
if (TclHasInternalRep(objPtr, &tclListType.objType)) {
|
||||
size_t objc, i;
|
||||
Tcl_Obj **objv;
|
||||
|
||||
@@ -717,7 +717,7 @@ SetDictFromAny(
|
||||
missingValue:
|
||||
if (interp != NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"missing value to go with key", -1));
|
||||
"missing value to go with key", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "VALUE", "DICTIONARY", NULL);
|
||||
}
|
||||
errorInFindDictElement:
|
||||
@@ -779,12 +779,12 @@ Tcl_Obj *
|
||||
TclTraceDictPath(
|
||||
Tcl_Interp *interp,
|
||||
Tcl_Obj *dictPtr,
|
||||
size_t keyc,
|
||||
Tcl_Size keyc,
|
||||
Tcl_Obj *const keyv[],
|
||||
int flags)
|
||||
{
|
||||
Dict *dict, *newDict;
|
||||
size_t i;
|
||||
Tcl_Size i;
|
||||
|
||||
DictGetInternalRep(dictPtr, dict);
|
||||
if (dict == NULL) {
|
||||
@@ -1281,7 +1281,7 @@ int
|
||||
Tcl_DictObjPutKeyList(
|
||||
Tcl_Interp *interp,
|
||||
Tcl_Obj *dictPtr,
|
||||
size_t keyc,
|
||||
Tcl_Size keyc,
|
||||
Tcl_Obj *const keyv[],
|
||||
Tcl_Obj *valuePtr)
|
||||
{
|
||||
@@ -1342,7 +1342,7 @@ int
|
||||
Tcl_DictObjRemoveKeyList(
|
||||
Tcl_Interp *interp,
|
||||
Tcl_Obj *dictPtr,
|
||||
size_t keyc,
|
||||
Tcl_Size keyc,
|
||||
Tcl_Obj *const keyv[])
|
||||
{
|
||||
Dict *dict;
|
||||
@@ -2119,7 +2119,7 @@ DictInfoCmd(
|
||||
}
|
||||
|
||||
statsStr = Tcl_HashStats(&dict->table);
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(statsStr, -1));
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(statsStr, TCL_INDEX_NONE));
|
||||
Tcl_Free(statsStr);
|
||||
return TCL_OK;
|
||||
}
|
||||
@@ -2481,7 +2481,7 @@ DictForNRCmd(
|
||||
}
|
||||
if (varc != 2) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"must have exactly two variable names", -1));
|
||||
"must have exactly two variable names", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "SYNTAX", "dict", "for", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -2676,7 +2676,7 @@ DictMapNRCmd(
|
||||
}
|
||||
if (varc != 2) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"must have exactly two variable names", -1));
|
||||
"must have exactly two variable names", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "SYNTAX", "dict", "map", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -3116,7 +3116,7 @@ DictFilterCmd(
|
||||
}
|
||||
if (varc != 2) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"must have exactly two variable names", -1));
|
||||
"must have exactly two variable names", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "SYNTAX", "dict", "filter", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
+61
-61
@@ -280,7 +280,7 @@ DisassembleByteCodeObj(
|
||||
Tcl_AppendPrintfToObj(bufferObj,
|
||||
"ByteCode %p, refCt %" TCL_Z_MODIFIER "u, epoch %" TCL_Z_MODIFIER "u, interp %p (epoch %" TCL_Z_MODIFIER "u)\n",
|
||||
codePtr, codePtr->refCount, codePtr->compileEpoch, iPtr, iPtr->compileEpoch);
|
||||
Tcl_AppendToObj(bufferObj, " Source ", -1);
|
||||
Tcl_AppendToObj(bufferObj, " Source ", TCL_INDEX_NONE);
|
||||
PrintSourceToObj(bufferObj, codePtr->source,
|
||||
TclMin(codePtr->numSrcBytes, 55));
|
||||
GetLocationInformation(codePtr->procPtr, &fileObj, &line);
|
||||
@@ -339,7 +339,7 @@ DisassembleByteCodeObj(
|
||||
(localPtr->flags & VAR_TEMPORARY) ? ", temp" : "",
|
||||
(localPtr->flags & VAR_RESOLVED) ? ", resolved" : "");
|
||||
if (TclIsVarTemporary(localPtr)) {
|
||||
Tcl_AppendToObj(bufferObj, "\n", -1);
|
||||
Tcl_AppendToObj(bufferObj, "\n", TCL_INDEX_NONE);
|
||||
} else {
|
||||
Tcl_AppendPrintfToObj(bufferObj, ", \"%s\"\n",
|
||||
localPtr->name);
|
||||
@@ -389,7 +389,7 @@ DisassembleByteCodeObj(
|
||||
if (numCmds == 0) {
|
||||
pc = codeStart;
|
||||
while (pc < codeLimit) {
|
||||
Tcl_AppendToObj(bufferObj, " ", -1);
|
||||
Tcl_AppendToObj(bufferObj, " ", TCL_INDEX_NONE);
|
||||
pc += FormatInstruction(codePtr, pc, bufferObj);
|
||||
}
|
||||
return bufferObj;
|
||||
@@ -451,7 +451,7 @@ DisassembleByteCodeObj(
|
||||
srcOffset, (srcOffset + srcLen - 1));
|
||||
}
|
||||
if (numCmds > 0) {
|
||||
Tcl_AppendToObj(bufferObj, "\n", -1);
|
||||
Tcl_AppendToObj(bufferObj, "\n", TCL_INDEX_NONE);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -500,14 +500,14 @@ DisassembleByteCodeObj(
|
||||
*/
|
||||
|
||||
while ((pc-codeStart) < codeOffset) {
|
||||
Tcl_AppendToObj(bufferObj, " ", -1);
|
||||
Tcl_AppendToObj(bufferObj, " ", TCL_INDEX_NONE);
|
||||
pc += FormatInstruction(codePtr, pc, bufferObj);
|
||||
}
|
||||
|
||||
Tcl_AppendPrintfToObj(bufferObj, " Command %d: ", i+1);
|
||||
PrintSourceToObj(bufferObj, (codePtr->source + srcOffset),
|
||||
TclMin(srcLen, 55));
|
||||
Tcl_AppendToObj(bufferObj, "\n", -1);
|
||||
Tcl_AppendToObj(bufferObj, "\n", TCL_INDEX_NONE);
|
||||
}
|
||||
if (pc < codeLimit) {
|
||||
/*
|
||||
@@ -515,7 +515,7 @@ DisassembleByteCodeObj(
|
||||
*/
|
||||
|
||||
while (pc < codeLimit) {
|
||||
Tcl_AppendToObj(bufferObj, " ", -1);
|
||||
Tcl_AppendToObj(bufferObj, " ", TCL_INDEX_NONE);
|
||||
pc += FormatInstruction(codePtr, pc, bufferObj);
|
||||
}
|
||||
}
|
||||
@@ -571,22 +571,22 @@ FormatInstruction(
|
||||
case OPERAND_UINT4:
|
||||
opnd = TclGetUInt4AtPtr(pc+numBytes); numBytes += 4;
|
||||
if (opCode == INST_START_CMD) {
|
||||
sprintf(suffixBuffer+strlen(suffixBuffer),
|
||||
snprintf(suffixBuffer+strlen(suffixBuffer), sizeof(suffixBuffer) - strlen(suffixBuffer),
|
||||
", %u cmds start here", opnd);
|
||||
}
|
||||
Tcl_AppendPrintfToObj(bufferObj, "%u ", opnd);
|
||||
break;
|
||||
case OPERAND_OFFSET1:
|
||||
opnd = TclGetInt1AtPtr(pc+numBytes); numBytes++;
|
||||
sprintf(suffixBuffer, "pc %u", pcOffset+opnd);
|
||||
snprintf(suffixBuffer, sizeof(suffixBuffer), "pc %u", pcOffset+opnd);
|
||||
Tcl_AppendPrintfToObj(bufferObj, "%+d ", opnd);
|
||||
break;
|
||||
case OPERAND_OFFSET4:
|
||||
opnd = TclGetInt4AtPtr(pc+numBytes); numBytes += 4;
|
||||
if (opCode == INST_START_CMD) {
|
||||
sprintf(suffixBuffer, "next cmd at pc %u", pcOffset+opnd);
|
||||
snprintf(suffixBuffer, sizeof(suffixBuffer), "next cmd at pc %u", pcOffset+opnd);
|
||||
} else {
|
||||
sprintf(suffixBuffer, "pc %u", pcOffset+opnd);
|
||||
snprintf(suffixBuffer, sizeof(suffixBuffer), "pc %u", pcOffset+opnd);
|
||||
}
|
||||
Tcl_AppendPrintfToObj(bufferObj, "%+d ", opnd);
|
||||
break;
|
||||
@@ -632,9 +632,9 @@ FormatInstruction(
|
||||
localPtr = localPtr->nextPtr;
|
||||
}
|
||||
if (TclIsVarTemporary(localPtr)) {
|
||||
sprintf(suffixBuffer, "temp var %u", opnd);
|
||||
snprintf(suffixBuffer, sizeof(suffixBuffer), "temp var %u", opnd);
|
||||
} else {
|
||||
sprintf(suffixBuffer, "var ");
|
||||
snprintf(suffixBuffer, sizeof(suffixBuffer), "var ");
|
||||
suffixSrc = localPtr->name;
|
||||
}
|
||||
}
|
||||
@@ -654,7 +654,7 @@ FormatInstruction(
|
||||
const char *bytes;
|
||||
size_t length;
|
||||
|
||||
Tcl_AppendToObj(bufferObj, "\t# ", -1);
|
||||
Tcl_AppendToObj(bufferObj, "\t# ", TCL_INDEX_NONE);
|
||||
bytes = Tcl_GetStringFromObj(codePtr->objArrayPtr[opnd], &length);
|
||||
PrintSourceToObj(bufferObj, bytes, TclMin(length, 40));
|
||||
} else if (suffixBuffer[0]) {
|
||||
@@ -663,12 +663,12 @@ FormatInstruction(
|
||||
PrintSourceToObj(bufferObj, suffixSrc, 40);
|
||||
}
|
||||
}
|
||||
Tcl_AppendToObj(bufferObj, "\n", -1);
|
||||
Tcl_AppendToObj(bufferObj, "\n", TCL_INDEX_NONE);
|
||||
if (auxPtr && auxPtr->type->printProc) {
|
||||
Tcl_AppendToObj(bufferObj, "\t\t[", -1);
|
||||
Tcl_AppendToObj(bufferObj, "\t\t[", TCL_INDEX_NONE);
|
||||
auxPtr->type->printProc(auxPtr->clientData, bufferObj, codePtr,
|
||||
pcOffset);
|
||||
Tcl_AppendToObj(bufferObj, "]\n", -1);
|
||||
Tcl_AppendToObj(bufferObj, "]\n", TCL_INDEX_NONE);
|
||||
}
|
||||
return numBytes;
|
||||
}
|
||||
@@ -836,7 +836,7 @@ UpdateStringOfInstName(
|
||||
if (inst >= LAST_INST_OPCODE) {
|
||||
dst = Tcl_InitStringRep(objPtr, NULL, TCL_INTEGER_SPACE + 5);
|
||||
TclOOM(dst, TCL_INTEGER_SPACE + 5);
|
||||
sprintf(dst, "inst_%" TCL_Z_MODIFIER "u", inst);
|
||||
snprintf(dst, TCL_INTEGER_SPACE + 5, "inst_%" TCL_Z_MODIFIER "u", inst);
|
||||
(void) Tcl_InitStringRep(objPtr, NULL, strlen(dst));
|
||||
} else {
|
||||
const char *s = tclInstructionTable[inst].name;
|
||||
@@ -866,11 +866,11 @@ PrintSourceToObj(
|
||||
size_t i = 0, len;
|
||||
|
||||
if (stringPtr == NULL) {
|
||||
Tcl_AppendToObj(appendObj, "\"\"", -1);
|
||||
Tcl_AppendToObj(appendObj, "\"\"", TCL_INDEX_NONE);
|
||||
return;
|
||||
}
|
||||
|
||||
Tcl_AppendToObj(appendObj, "\"", -1);
|
||||
Tcl_AppendToObj(appendObj, "\"", TCL_INDEX_NONE);
|
||||
p = stringPtr;
|
||||
for (; (*p != '\0') && (i < maxChars); p+=len) {
|
||||
int ucs4;
|
||||
@@ -878,27 +878,27 @@ PrintSourceToObj(
|
||||
len = TclUtfToUCS4(p, &ucs4);
|
||||
switch (ucs4) {
|
||||
case '"':
|
||||
Tcl_AppendToObj(appendObj, "\\\"", -1);
|
||||
Tcl_AppendToObj(appendObj, "\\\"", TCL_INDEX_NONE);
|
||||
i += 2;
|
||||
continue;
|
||||
case '\f':
|
||||
Tcl_AppendToObj(appendObj, "\\f", -1);
|
||||
Tcl_AppendToObj(appendObj, "\\f", TCL_INDEX_NONE);
|
||||
i += 2;
|
||||
continue;
|
||||
case '\n':
|
||||
Tcl_AppendToObj(appendObj, "\\n", -1);
|
||||
Tcl_AppendToObj(appendObj, "\\n", TCL_INDEX_NONE);
|
||||
i += 2;
|
||||
continue;
|
||||
case '\r':
|
||||
Tcl_AppendToObj(appendObj, "\\r", -1);
|
||||
Tcl_AppendToObj(appendObj, "\\r", TCL_INDEX_NONE);
|
||||
i += 2;
|
||||
continue;
|
||||
case '\t':
|
||||
Tcl_AppendToObj(appendObj, "\\t", -1);
|
||||
Tcl_AppendToObj(appendObj, "\\t", TCL_INDEX_NONE);
|
||||
i += 2;
|
||||
continue;
|
||||
case '\v':
|
||||
Tcl_AppendToObj(appendObj, "\\v", -1);
|
||||
Tcl_AppendToObj(appendObj, "\\v", TCL_INDEX_NONE);
|
||||
i += 2;
|
||||
continue;
|
||||
default:
|
||||
@@ -916,9 +916,9 @@ PrintSourceToObj(
|
||||
}
|
||||
}
|
||||
if (*p != '\0') {
|
||||
Tcl_AppendToObj(appendObj, "...", -1);
|
||||
Tcl_AppendToObj(appendObj, "...", TCL_INDEX_NONE);
|
||||
}
|
||||
Tcl_AppendToObj(appendObj, "\"", -1);
|
||||
Tcl_AppendToObj(appendObj, "\"", TCL_INDEX_NONE);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -972,33 +972,33 @@ DisassembleByteCodeAsDicts(
|
||||
TclNewObj(descriptor[0]);
|
||||
if (!(localPtr->flags & (VAR_ARRAY|VAR_LINK))) {
|
||||
Tcl_ListObjAppendElement(NULL, descriptor[0],
|
||||
Tcl_NewStringObj("scalar", -1));
|
||||
Tcl_NewStringObj("scalar", TCL_INDEX_NONE));
|
||||
}
|
||||
if (localPtr->flags & VAR_ARRAY) {
|
||||
Tcl_ListObjAppendElement(NULL, descriptor[0],
|
||||
Tcl_NewStringObj("array", -1));
|
||||
Tcl_NewStringObj("array", TCL_INDEX_NONE));
|
||||
}
|
||||
if (localPtr->flags & VAR_LINK) {
|
||||
Tcl_ListObjAppendElement(NULL, descriptor[0],
|
||||
Tcl_NewStringObj("link", -1));
|
||||
Tcl_NewStringObj("link", TCL_INDEX_NONE));
|
||||
}
|
||||
if (localPtr->flags & VAR_ARGUMENT) {
|
||||
Tcl_ListObjAppendElement(NULL, descriptor[0],
|
||||
Tcl_NewStringObj("arg", -1));
|
||||
Tcl_NewStringObj("arg", TCL_INDEX_NONE));
|
||||
}
|
||||
if (localPtr->flags & VAR_TEMPORARY) {
|
||||
Tcl_ListObjAppendElement(NULL, descriptor[0],
|
||||
Tcl_NewStringObj("temp", -1));
|
||||
Tcl_NewStringObj("temp", TCL_INDEX_NONE));
|
||||
}
|
||||
if (localPtr->flags & VAR_RESOLVED) {
|
||||
Tcl_ListObjAppendElement(NULL, descriptor[0],
|
||||
Tcl_NewStringObj("resolved", -1));
|
||||
Tcl_NewStringObj("resolved", TCL_INDEX_NONE));
|
||||
}
|
||||
if (localPtr->flags & VAR_TEMPORARY) {
|
||||
Tcl_ListObjAppendElement(NULL, variables,
|
||||
Tcl_NewListObj(1, descriptor));
|
||||
} else {
|
||||
descriptor[1] = Tcl_NewStringObj(localPtr->name, -1);
|
||||
descriptor[1] = Tcl_NewStringObj(localPtr->name, TCL_INDEX_NONE);
|
||||
Tcl_ListObjAppendElement(NULL, variables,
|
||||
Tcl_NewListObj(2, descriptor));
|
||||
}
|
||||
@@ -1016,7 +1016,7 @@ DisassembleByteCodeAsDicts(
|
||||
|
||||
TclNewObj(inst);
|
||||
Tcl_ListObjAppendElement(NULL, inst, Tcl_NewStringObj(
|
||||
instDesc->name, -1));
|
||||
instDesc->name, TCL_INDEX_NONE));
|
||||
opnd = pc + 1;
|
||||
for (i=0 ; i<instDesc->numOperands ; i++) {
|
||||
switch (instDesc->opTypes[i]) {
|
||||
@@ -1082,7 +1082,7 @@ DisassembleByteCodeAsDicts(
|
||||
".%d", val));
|
||||
} else if (val == -2) {
|
||||
Tcl_ListObjAppendElement(NULL, inst, Tcl_NewStringObj(
|
||||
".end", -1));
|
||||
".end", TCL_INDEX_NONE));
|
||||
} else {
|
||||
Tcl_ListObjAppendElement(NULL, inst, Tcl_ObjPrintf(
|
||||
".end-%d", -2-val));
|
||||
@@ -1115,13 +1115,13 @@ DisassembleByteCodeAsDicts(
|
||||
TclNewObj(aux);
|
||||
for (i=0 ; i<(int)codePtr->numAuxDataItems ; i++) {
|
||||
AuxData *auxData = &codePtr->auxDataArrayPtr[i];
|
||||
Tcl_Obj *auxDesc = Tcl_NewStringObj(auxData->type->name, -1);
|
||||
Tcl_Obj *auxDesc = Tcl_NewStringObj(auxData->type->name, TCL_INDEX_NONE);
|
||||
|
||||
if (auxData->type->disassembleProc) {
|
||||
Tcl_Obj *desc;
|
||||
|
||||
TclNewObj(desc);
|
||||
Tcl_DictObjPut(NULL, desc, Tcl_NewStringObj("name", -1), auxDesc);
|
||||
Tcl_DictObjPut(NULL, desc, Tcl_NewStringObj("name", TCL_INDEX_NONE), auxDesc);
|
||||
auxDesc = desc;
|
||||
auxData->type->disassembleProc(auxData->clientData, auxDesc,
|
||||
codePtr, 0);
|
||||
@@ -1188,9 +1188,9 @@ DisassembleByteCodeAsDicts(
|
||||
sourceOffset += Decode(srcOffPtr);
|
||||
sourceLength = Decode(srcLenPtr);
|
||||
TclNewObj(cmd);
|
||||
Tcl_DictObjPut(NULL, cmd, Tcl_NewStringObj("codefrom", -1),
|
||||
Tcl_DictObjPut(NULL, cmd, Tcl_NewStringObj("codefrom", TCL_INDEX_NONE),
|
||||
Tcl_NewWideIntObj(codeOffset));
|
||||
Tcl_DictObjPut(NULL, cmd, Tcl_NewStringObj("codeto", -1),
|
||||
Tcl_DictObjPut(NULL, cmd, Tcl_NewStringObj("codeto", TCL_INDEX_NONE),
|
||||
Tcl_NewWideIntObj(codeOffset + codeLength - 1));
|
||||
|
||||
/*
|
||||
@@ -1198,13 +1198,13 @@ DisassembleByteCodeAsDicts(
|
||||
* characters are present in the source!
|
||||
*/
|
||||
|
||||
Tcl_DictObjPut(NULL, cmd, Tcl_NewStringObj("scriptfrom", -1),
|
||||
Tcl_DictObjPut(NULL, cmd, Tcl_NewStringObj("scriptfrom", TCL_INDEX_NONE),
|
||||
Tcl_NewWideIntObj(Tcl_NumUtfChars(codePtr->source,
|
||||
sourceOffset)));
|
||||
Tcl_DictObjPut(NULL, cmd, Tcl_NewStringObj("scriptto", -1),
|
||||
Tcl_DictObjPut(NULL, cmd, Tcl_NewStringObj("scriptto", TCL_INDEX_NONE),
|
||||
Tcl_NewWideIntObj(Tcl_NumUtfChars(codePtr->source,
|
||||
sourceOffset + sourceLength - 1)));
|
||||
Tcl_DictObjPut(NULL, cmd, Tcl_NewStringObj("script", -1),
|
||||
Tcl_DictObjPut(NULL, cmd, Tcl_NewStringObj("script", TCL_INDEX_NONE),
|
||||
Tcl_NewStringObj(codePtr->source+sourceOffset, sourceLength));
|
||||
Tcl_ListObjAppendElement(NULL, commands, cmd);
|
||||
}
|
||||
@@ -1223,32 +1223,32 @@ DisassembleByteCodeAsDicts(
|
||||
*/
|
||||
|
||||
TclNewObj(description);
|
||||
Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("literals", -1),
|
||||
Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("literals", TCL_INDEX_NONE),
|
||||
literals);
|
||||
Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("variables", -1),
|
||||
Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("variables", TCL_INDEX_NONE),
|
||||
variables);
|
||||
Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("exception", -1), exn);
|
||||
Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("instructions", -1),
|
||||
Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("exception", TCL_INDEX_NONE), exn);
|
||||
Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("instructions", TCL_INDEX_NONE),
|
||||
instructions);
|
||||
Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("auxiliary", -1), aux);
|
||||
Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("commands", -1),
|
||||
Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("auxiliary", TCL_INDEX_NONE), aux);
|
||||
Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("commands", TCL_INDEX_NONE),
|
||||
commands);
|
||||
Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("script", -1),
|
||||
Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("script", TCL_INDEX_NONE),
|
||||
Tcl_NewStringObj(codePtr->source, codePtr->numSrcBytes));
|
||||
Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("namespace", -1),
|
||||
Tcl_NewStringObj(codePtr->nsPtr->fullName, -1));
|
||||
Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("stackdepth", -1),
|
||||
Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("namespace", TCL_INDEX_NONE),
|
||||
Tcl_NewStringObj(codePtr->nsPtr->fullName, TCL_INDEX_NONE));
|
||||
Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("stackdepth", TCL_INDEX_NONE),
|
||||
Tcl_NewWideIntObj(codePtr->maxStackDepth));
|
||||
Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("exceptdepth", -1),
|
||||
Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("exceptdepth", TCL_INDEX_NONE),
|
||||
Tcl_NewWideIntObj(codePtr->maxExceptDepth));
|
||||
if (line >= 0) {
|
||||
Tcl_DictObjPut(NULL, description,
|
||||
Tcl_NewStringObj("initiallinenumber", -1),
|
||||
Tcl_NewStringObj("initiallinenumber", TCL_INDEX_NONE),
|
||||
Tcl_NewWideIntObj(line));
|
||||
}
|
||||
if (file) {
|
||||
Tcl_DictObjPut(NULL, description,
|
||||
Tcl_NewStringObj("sourcefile", -1), file);
|
||||
Tcl_NewStringObj("sourcefile", TCL_INDEX_NONE), file);
|
||||
}
|
||||
return description;
|
||||
}
|
||||
@@ -1410,7 +1410,7 @@ Tcl_DisassembleObjCmd(
|
||||
procPtr = TclOOGetProcFromMethod(methodPtr);
|
||||
if (procPtr == NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"body not available for this kind of constructor", -1));
|
||||
"body not available for this kind of constructor", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "DISASSEMBLE",
|
||||
"METHODTYPE", NULL);
|
||||
return TCL_ERROR;
|
||||
@@ -1475,7 +1475,7 @@ Tcl_DisassembleObjCmd(
|
||||
procPtr = TclOOGetProcFromMethod(methodPtr);
|
||||
if (procPtr == NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"body not available for this kind of destructor", -1));
|
||||
"body not available for this kind of destructor", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "DISASSEMBLE",
|
||||
"METHODTYPE", NULL);
|
||||
return TCL_ERROR;
|
||||
@@ -1565,7 +1565,7 @@ Tcl_DisassembleObjCmd(
|
||||
procPtr = TclOOGetProcFromMethod((Method *)Tcl_GetHashValue(hPtr));
|
||||
if (procPtr == NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"body not available for this kind of method", -1));
|
||||
"body not available for this kind of method", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "DISASSEMBLE",
|
||||
"METHODTYPE", NULL);
|
||||
return TCL_ERROR;
|
||||
@@ -1602,7 +1602,7 @@ Tcl_DisassembleObjCmd(
|
||||
|
||||
if (codePtr->flags & TCL_BYTECODE_PRECOMPILED) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"may not disassemble prebuilt bytecode", -1));
|
||||
"may not disassemble prebuilt bytecode", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "DISASSEMBLE",
|
||||
"BYTECODE", NULL);
|
||||
return TCL_ERROR;
|
||||
|
||||
+821
-202
File diff suppressed because it is too large
Load Diff
+80
-72
@@ -106,7 +106,7 @@ static const Tcl_ObjType ensembleCmdType = {
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
size_t epoch; /* Used to confirm when the data in this
|
||||
Tcl_Size epoch; /* Used to confirm when the data in this
|
||||
* really structure matches up with the
|
||||
* ensemble. */
|
||||
Command *token; /* Reference to the command for which this
|
||||
@@ -125,7 +125,7 @@ NewNsObj(
|
||||
if (namespacePtr == TclGetGlobalNamespace(nsPtr->interp)) {
|
||||
return Tcl_NewStringObj("::", 2);
|
||||
}
|
||||
return Tcl_NewStringObj(nsPtr->fullName, -1);
|
||||
return Tcl_NewStringObj(nsPtr->fullName, TCL_INDEX_NONE);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -189,7 +189,7 @@ TclNamespaceEnsembleCmd(
|
||||
switch (index) {
|
||||
case ENS_CREATE: {
|
||||
const char *name;
|
||||
size_t len;
|
||||
Tcl_Size len;
|
||||
int allocatedMapFlag = 0;
|
||||
/*
|
||||
* Defaults
|
||||
@@ -289,7 +289,7 @@ TclNamespaceEnsembleCmd(
|
||||
if (len < 1) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"ensemble subcommand implementations "
|
||||
"must be non-empty lists", -1));
|
||||
"must be non-empty lists", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "ENSEMBLE",
|
||||
"EMPTY_TARGET", NULL);
|
||||
Tcl_DictObjDone(&search);
|
||||
@@ -460,7 +460,7 @@ TclNamespaceEnsembleCmd(
|
||||
|
||||
/* -map option */
|
||||
Tcl_ListObjAppendElement(NULL, resultObj,
|
||||
Tcl_NewStringObj(ensembleConfigOptions[CONF_MAP], -1));
|
||||
Tcl_NewStringObj(ensembleConfigOptions[CONF_MAP], TCL_INDEX_NONE));
|
||||
Tcl_GetEnsembleMappingDict(NULL, token, &tmpObj);
|
||||
Tcl_ListObjAppendElement(NULL, resultObj,
|
||||
(tmpObj != NULL) ? tmpObj : Tcl_NewObj());
|
||||
@@ -475,14 +475,14 @@ TclNamespaceEnsembleCmd(
|
||||
|
||||
/* -parameters option */
|
||||
Tcl_ListObjAppendElement(NULL, resultObj,
|
||||
Tcl_NewStringObj(ensembleConfigOptions[CONF_PARAM], -1));
|
||||
Tcl_NewStringObj(ensembleConfigOptions[CONF_PARAM], TCL_INDEX_NONE));
|
||||
Tcl_GetEnsembleParameterList(NULL, token, &tmpObj);
|
||||
Tcl_ListObjAppendElement(NULL, resultObj,
|
||||
(tmpObj != NULL) ? tmpObj : Tcl_NewObj());
|
||||
|
||||
/* -prefix option */
|
||||
Tcl_ListObjAppendElement(NULL, resultObj,
|
||||
Tcl_NewStringObj(ensembleConfigOptions[CONF_PREFIX], -1));
|
||||
Tcl_NewStringObj(ensembleConfigOptions[CONF_PREFIX], TCL_INDEX_NONE));
|
||||
Tcl_GetEnsembleFlags(NULL, token, &flags);
|
||||
Tcl_ListObjAppendElement(NULL, resultObj,
|
||||
Tcl_NewBooleanObj(flags & TCL_ENSEMBLE_PREFIX));
|
||||
@@ -503,7 +503,7 @@ TclNamespaceEnsembleCmd(
|
||||
|
||||
Tcl_SetObjResult(interp, resultObj);
|
||||
} else {
|
||||
size_t len;
|
||||
Tcl_Size len;
|
||||
int allocatedMapFlag = 0;
|
||||
Tcl_Obj *subcmdObj = NULL, *mapObj = NULL, *paramObj = NULL,
|
||||
*unknownObj = NULL; /* Defaults, silence gcc 4 warnings */
|
||||
@@ -566,8 +566,8 @@ TclNamespaceEnsembleCmd(
|
||||
continue;
|
||||
}
|
||||
do {
|
||||
if (TclListObjGetElementsM(interp, listObj, &len,
|
||||
&listv) != TCL_OK) {
|
||||
if (TclListObjLengthM(interp, listObj, &len
|
||||
) != TCL_OK) {
|
||||
Tcl_DictObjDone(&search);
|
||||
if (patchedDict) {
|
||||
Tcl_DecrRefCount(patchedDict);
|
||||
@@ -577,7 +577,7 @@ TclNamespaceEnsembleCmd(
|
||||
if (len < 1) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"ensemble subcommand implementations "
|
||||
"must be non-empty lists", -1));
|
||||
"must be non-empty lists", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "ENSEMBLE",
|
||||
"EMPTY_TARGET", NULL);
|
||||
Tcl_DictObjDone(&search);
|
||||
@@ -586,6 +586,14 @@ TclNamespaceEnsembleCmd(
|
||||
}
|
||||
goto freeMapAndError;
|
||||
}
|
||||
if (TclListObjGetElementsM(interp, listObj, &len,
|
||||
&listv) != TCL_OK) {
|
||||
Tcl_DictObjDone(&search);
|
||||
if (patchedDict) {
|
||||
Tcl_DecrRefCount(patchedDict);
|
||||
}
|
||||
goto freeMapAndError;
|
||||
}
|
||||
cmd = TclGetString(listv[0]);
|
||||
if (!(cmd[0] == ':' && cmd[1] == ':')) {
|
||||
Tcl_Obj *newList = Tcl_DuplicateObj(listObj);
|
||||
@@ -617,7 +625,7 @@ TclNamespaceEnsembleCmd(
|
||||
}
|
||||
case CONF_NAMESPACE:
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"option -namespace is read-only", -1));
|
||||
"option -namespace is read-only", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "ENSEMBLE", "READ_ONLY",
|
||||
NULL);
|
||||
goto freeMapAndError;
|
||||
@@ -790,12 +798,12 @@ Tcl_SetEnsembleSubcommandList(
|
||||
|
||||
if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"command is not an ensemble", -1));
|
||||
"command is not an ensemble", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "ENSEMBLE", "NOT_ENSEMBLE", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (subcmdList != NULL) {
|
||||
size_t length;
|
||||
Tcl_Size length;
|
||||
|
||||
if (TclListObjLengthM(interp, subcmdList, &length) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
@@ -862,11 +870,11 @@ Tcl_SetEnsembleParameterList(
|
||||
Command *cmdPtr = (Command *) token;
|
||||
EnsembleConfig *ensemblePtr;
|
||||
Tcl_Obj *oldList;
|
||||
size_t length;
|
||||
Tcl_Size length;
|
||||
|
||||
if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"command is not an ensemble", -1));
|
||||
"command is not an ensemble", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "ENSEMBLE", "NOT_ENSEMBLE", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -942,12 +950,12 @@ Tcl_SetEnsembleMappingDict(
|
||||
|
||||
if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"command is not an ensemble", -1));
|
||||
"command is not an ensemble", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "ENSEMBLE", "NOT_ENSEMBLE", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (mapDict != NULL) {
|
||||
size_t size;
|
||||
Tcl_Size size;
|
||||
int done;
|
||||
Tcl_DictSearch search;
|
||||
Tcl_Obj *valuePtr;
|
||||
@@ -1042,12 +1050,12 @@ Tcl_SetEnsembleUnknownHandler(
|
||||
|
||||
if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"command is not an ensemble", -1));
|
||||
"command is not an ensemble", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "ENSEMBLE", "NOT_ENSEMBLE", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (unknownList != NULL) {
|
||||
size_t length;
|
||||
Tcl_Size length;
|
||||
|
||||
if (TclListObjLengthM(interp, unknownList, &length) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
@@ -1108,7 +1116,7 @@ Tcl_SetEnsembleFlags(
|
||||
|
||||
if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"command is not an ensemble", -1));
|
||||
"command is not an ensemble", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "ENSEMBLE", "NOT_ENSEMBLE", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -1185,7 +1193,7 @@ Tcl_GetEnsembleSubcommandList(
|
||||
if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
|
||||
if (interp != NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"command is not an ensemble", -1));
|
||||
"command is not an ensemble", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "ENSEMBLE", "NOT_ENSEMBLE", NULL);
|
||||
}
|
||||
return TCL_ERROR;
|
||||
@@ -1227,7 +1235,7 @@ Tcl_GetEnsembleParameterList(
|
||||
if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
|
||||
if (interp != NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"command is not an ensemble", -1));
|
||||
"command is not an ensemble", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "ENSEMBLE", "NOT_ENSEMBLE", NULL);
|
||||
}
|
||||
return TCL_ERROR;
|
||||
@@ -1269,7 +1277,7 @@ Tcl_GetEnsembleMappingDict(
|
||||
if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
|
||||
if (interp != NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"command is not an ensemble", -1));
|
||||
"command is not an ensemble", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "ENSEMBLE", "NOT_ENSEMBLE", NULL);
|
||||
}
|
||||
return TCL_ERROR;
|
||||
@@ -1310,7 +1318,7 @@ Tcl_GetEnsembleUnknownHandler(
|
||||
if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
|
||||
if (interp != NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"command is not an ensemble", -1));
|
||||
"command is not an ensemble", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "ENSEMBLE", "NOT_ENSEMBLE", NULL);
|
||||
}
|
||||
return TCL_ERROR;
|
||||
@@ -1351,7 +1359,7 @@ Tcl_GetEnsembleFlags(
|
||||
if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
|
||||
if (interp != NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"command is not an ensemble", -1));
|
||||
"command is not an ensemble", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "ENSEMBLE", "NOT_ENSEMBLE", NULL);
|
||||
}
|
||||
return TCL_ERROR;
|
||||
@@ -1392,7 +1400,7 @@ Tcl_GetEnsembleNamespace(
|
||||
if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
|
||||
if (interp != NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"command is not an ensemble", -1));
|
||||
"command is not an ensemble", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "ENSEMBLE", "NOT_ENSEMBLE", NULL);
|
||||
}
|
||||
return TCL_ERROR;
|
||||
@@ -1531,7 +1539,7 @@ TclMakeEnsemble(
|
||||
Tcl_DString buf, hiddenBuf;
|
||||
const char **nameParts = NULL;
|
||||
const char *cmdName = NULL;
|
||||
size_t i, nameCount = 0;
|
||||
Tcl_Size i, nameCount = 0;
|
||||
int ensembleFlags = 0, hiddenLen;
|
||||
|
||||
/*
|
||||
@@ -1541,7 +1549,7 @@ TclMakeEnsemble(
|
||||
Tcl_DStringInit(&buf);
|
||||
Tcl_DStringInit(&hiddenBuf);
|
||||
TclDStringAppendLiteral(&hiddenBuf, "tcl:");
|
||||
Tcl_DStringAppend(&hiddenBuf, name, -1);
|
||||
Tcl_DStringAppend(&hiddenBuf, name, TCL_INDEX_NONE);
|
||||
TclDStringAppendLiteral(&hiddenBuf, ":");
|
||||
hiddenLen = Tcl_DStringLength(&hiddenBuf);
|
||||
if (name[0] == ':' && name[1] == ':') {
|
||||
@@ -1550,7 +1558,7 @@ TclMakeEnsemble(
|
||||
*/
|
||||
|
||||
cmdName = name;
|
||||
Tcl_DStringAppend(&buf, name, -1);
|
||||
Tcl_DStringAppend(&buf, name, TCL_INDEX_NONE);
|
||||
ensembleFlags = TCL_ENSEMBLE_PREFIX;
|
||||
} else {
|
||||
/*
|
||||
@@ -1566,7 +1574,7 @@ TclMakeEnsemble(
|
||||
|
||||
for (i = 0; i < nameCount; ++i) {
|
||||
TclDStringAppendLiteral(&buf, "::");
|
||||
Tcl_DStringAppend(&buf, nameParts[i], -1);
|
||||
Tcl_DStringAppend(&buf, nameParts[i], TCL_INDEX_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1611,10 +1619,10 @@ TclMakeEnsemble(
|
||||
TclDStringAppendLiteral(&buf, "::");
|
||||
TclNewObj(mapDict);
|
||||
for (i=0 ; map[i].name != NULL ; i++) {
|
||||
fromObj = Tcl_NewStringObj(map[i].name, -1);
|
||||
fromObj = Tcl_NewStringObj(map[i].name, TCL_INDEX_NONE);
|
||||
TclNewStringObj(toObj, Tcl_DStringValue(&buf),
|
||||
Tcl_DStringLength(&buf));
|
||||
Tcl_AppendToObj(toObj, map[i].name, -1);
|
||||
Tcl_AppendToObj(toObj, map[i].name, TCL_INDEX_NONE);
|
||||
Tcl_DictObjPut(NULL, mapDict, fromObj, toObj);
|
||||
|
||||
if (map[i].proc || map[i].nreProc) {
|
||||
@@ -1632,7 +1640,7 @@ TclMakeEnsemble(
|
||||
map[i].nreProc, map[i].clientData, NULL);
|
||||
Tcl_DStringSetLength(&hiddenBuf, hiddenLen);
|
||||
if (Tcl_HideCommand(interp, "___tmp",
|
||||
Tcl_DStringAppend(&hiddenBuf, map[i].name, -1))) {
|
||||
Tcl_DStringAppend(&hiddenBuf, map[i].name, TCL_INDEX_NONE))) {
|
||||
Tcl_Panic("%s", Tcl_GetStringResult(interp));
|
||||
}
|
||||
} else {
|
||||
@@ -1710,7 +1718,7 @@ NsEnsembleImplementationCmdNR(
|
||||
int reparseCount = 0; /* Number of reparses. */
|
||||
Tcl_Obj *errorObj; /* Used for building error messages. */
|
||||
Tcl_Obj *subObj;
|
||||
size_t subIdx;
|
||||
Tcl_Size subIdx;
|
||||
|
||||
/*
|
||||
* Must recheck objc since numParameters might have changed. See test
|
||||
@@ -1719,7 +1727,7 @@ NsEnsembleImplementationCmdNR(
|
||||
|
||||
restartEnsembleParse:
|
||||
subIdx = 1 + ensemblePtr->numParameters;
|
||||
if ((size_t)objc < subIdx + 1) {
|
||||
if ((Tcl_Size)objc < subIdx + 1) {
|
||||
/*
|
||||
* No subcommand argument. Make error message.
|
||||
*/
|
||||
@@ -1729,7 +1737,7 @@ NsEnsembleImplementationCmdNR(
|
||||
Tcl_DStringInit(&buf);
|
||||
if (ensemblePtr->parameterList) {
|
||||
Tcl_DStringAppend(&buf,
|
||||
TclGetString(ensemblePtr->parameterList), -1);
|
||||
TclGetString(ensemblePtr->parameterList), TCL_INDEX_NONE);
|
||||
TclDStringAppendLiteral(&buf, " ");
|
||||
}
|
||||
TclDStringAppendLiteral(&buf, "subcommand ?arg ...?");
|
||||
@@ -1746,7 +1754,7 @@ NsEnsembleImplementationCmdNR(
|
||||
|
||||
if (!Tcl_InterpDeleted(interp)) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"ensemble activated for deleted namespace", -1));
|
||||
"ensemble activated for deleted namespace", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "ENSEMBLE", "DEAD", NULL);
|
||||
}
|
||||
return TCL_ERROR;
|
||||
@@ -1813,8 +1821,8 @@ NsEnsembleImplementationCmdNR(
|
||||
* it (a non-unique prefix produces an error).
|
||||
*/
|
||||
char *fullName = NULL; /* Full name of the subcommand. */
|
||||
size_t stringLength, i;
|
||||
size_t tableLength = ensemblePtr->subcommandTable.numEntries;
|
||||
Tcl_Size stringLength, i;
|
||||
Tcl_Size tableLength = ensemblePtr->subcommandTable.numEntries;
|
||||
Tcl_Obj *fix;
|
||||
|
||||
subcmdName = Tcl_GetStringFromObj(subObj, &stringLength);
|
||||
@@ -1861,7 +1869,7 @@ NsEnsembleImplementationCmdNR(
|
||||
* Record the spelling correction for usage message.
|
||||
*/
|
||||
|
||||
fix = Tcl_NewStringObj(fullName, -1);
|
||||
fix = Tcl_NewStringObj(fullName, TCL_INDEX_NONE);
|
||||
|
||||
/*
|
||||
* Cache for later in the subcommand object.
|
||||
@@ -1891,7 +1899,7 @@ NsEnsembleImplementationCmdNR(
|
||||
Tcl_Obj *copyPtr; /* The list of words to dispatch on.
|
||||
* Will be freed by the dispatch engine. */
|
||||
Tcl_Obj **copyObjv;
|
||||
size_t copyObjc, prefixObjc;
|
||||
Tcl_Size copyObjc, prefixObjc;
|
||||
|
||||
TclListObjLengthM(NULL, prefixObj, &prefixObjc);
|
||||
|
||||
@@ -1972,12 +1980,12 @@ NsEnsembleImplementationCmdNR(
|
||||
(ensemblePtr->flags & TCL_ENSEMBLE_PREFIX ? " or ambiguous" : ""),
|
||||
TclGetString(subObj));
|
||||
if (ensemblePtr->subcommandTable.numEntries == 1) {
|
||||
Tcl_AppendToObj(errorObj, ensemblePtr->subcommandArrayPtr[0], -1);
|
||||
Tcl_AppendToObj(errorObj, ensemblePtr->subcommandArrayPtr[0], TCL_INDEX_NONE);
|
||||
} else {
|
||||
size_t i;
|
||||
Tcl_Size i;
|
||||
|
||||
for (i=0 ; i<ensemblePtr->subcommandTable.numEntries-1 ; i++) {
|
||||
Tcl_AppendToObj(errorObj, ensemblePtr->subcommandArrayPtr[i], -1);
|
||||
Tcl_AppendToObj(errorObj, ensemblePtr->subcommandArrayPtr[i], TCL_INDEX_NONE);
|
||||
Tcl_AppendToObj(errorObj, ", ", 2);
|
||||
}
|
||||
Tcl_AppendPrintfToObj(errorObj, "or %s",
|
||||
@@ -2019,8 +2027,8 @@ TclClearRootEnsemble(
|
||||
int
|
||||
TclInitRewriteEnsemble(
|
||||
Tcl_Interp *interp,
|
||||
size_t numRemoved,
|
||||
size_t numInserted,
|
||||
Tcl_Size numRemoved,
|
||||
Tcl_Size numInserted,
|
||||
Tcl_Obj *const *objv)
|
||||
{
|
||||
Interp *iPtr = (Interp *) interp;
|
||||
@@ -2032,7 +2040,7 @@ TclInitRewriteEnsemble(
|
||||
iPtr->ensembleRewrite.numRemovedObjs = numRemoved;
|
||||
iPtr->ensembleRewrite.numInsertedObjs = numInserted;
|
||||
} else {
|
||||
size_t numIns = iPtr->ensembleRewrite.numInsertedObjs;
|
||||
Tcl_Size numIns = iPtr->ensembleRewrite.numInsertedObjs;
|
||||
|
||||
if (numIns < numRemoved) {
|
||||
iPtr->ensembleRewrite.numRemovedObjs += numRemoved - numIns;
|
||||
@@ -2119,8 +2127,8 @@ TclSpellFix(
|
||||
Interp *iPtr = (Interp *) interp;
|
||||
Tcl_Obj *const *search;
|
||||
Tcl_Obj **store;
|
||||
size_t idx;
|
||||
size_t size;
|
||||
Tcl_Size idx;
|
||||
Tcl_Size size;
|
||||
|
||||
if (iPtr->ensembleRewrite.sourceObjs == NULL) {
|
||||
iPtr->ensembleRewrite.sourceObjs = objv;
|
||||
@@ -2287,9 +2295,9 @@ EnsembleUnknownCallback(
|
||||
Tcl_Obj *const objv[],
|
||||
Tcl_Obj **prefixObjPtr)
|
||||
{
|
||||
size_t paramc;
|
||||
Tcl_Size paramc;
|
||||
int result;
|
||||
size_t i, prefixObjc;
|
||||
Tcl_Size i, prefixObjc;
|
||||
Tcl_Obj **paramv, *unknownCmd, *ensObj;
|
||||
|
||||
/*
|
||||
@@ -2300,7 +2308,7 @@ EnsembleUnknownCallback(
|
||||
TclNewObj(ensObj);
|
||||
Tcl_GetCommandFullName(interp, ensemblePtr->token, ensObj);
|
||||
Tcl_ListObjAppendElement(NULL, unknownCmd, ensObj);
|
||||
for (i = 1 ; i < (size_t)objc ; i++) {
|
||||
for (i = 1 ; i < (Tcl_Size)objc ; i++) {
|
||||
Tcl_ListObjAppendElement(NULL, unknownCmd, objv[i]);
|
||||
}
|
||||
TclListObjGetElementsM(NULL, unknownCmd, ¶mc, ¶mv);
|
||||
@@ -2318,7 +2326,7 @@ EnsembleUnknownCallback(
|
||||
if ((result == TCL_OK) && (ensemblePtr->flags & ENSEMBLE_DEAD)) {
|
||||
if (!Tcl_InterpDeleted(interp)) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"unknown subcommand handler deleted its ensemble", -1));
|
||||
"unknown subcommand handler deleted its ensemble", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "ENSEMBLE", "UNKNOWN_DELETED",
|
||||
NULL);
|
||||
}
|
||||
@@ -2366,16 +2374,16 @@ EnsembleUnknownCallback(
|
||||
if (result != TCL_ERROR) {
|
||||
Tcl_ResetResult(interp);
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"unknown subcommand handler returned bad code: ", -1));
|
||||
"unknown subcommand handler returned bad code: ", TCL_INDEX_NONE));
|
||||
switch (result) {
|
||||
case TCL_RETURN:
|
||||
Tcl_AppendToObj(Tcl_GetObjResult(interp), "return", -1);
|
||||
Tcl_AppendToObj(Tcl_GetObjResult(interp), "return", TCL_INDEX_NONE);
|
||||
break;
|
||||
case TCL_BREAK:
|
||||
Tcl_AppendToObj(Tcl_GetObjResult(interp), "break", -1);
|
||||
Tcl_AppendToObj(Tcl_GetObjResult(interp), "break", TCL_INDEX_NONE);
|
||||
break;
|
||||
case TCL_CONTINUE:
|
||||
Tcl_AppendToObj(Tcl_GetObjResult(interp), "continue", -1);
|
||||
Tcl_AppendToObj(Tcl_GetObjResult(interp), "continue", TCL_INDEX_NONE);
|
||||
break;
|
||||
default:
|
||||
Tcl_AppendPrintfToObj(Tcl_GetObjResult(interp), "%d", result);
|
||||
@@ -2577,7 +2585,7 @@ BuildEnsembleConfig(
|
||||
{
|
||||
Tcl_HashSearch search; /* Used for scanning the commands in
|
||||
* the namespace for this ensemble. */
|
||||
size_t i, j;
|
||||
Tcl_Size i, j;
|
||||
int isNew;
|
||||
Tcl_HashTable *hash = &ensemblePtr->subcommandTable;
|
||||
Tcl_HashEntry *hPtr;
|
||||
@@ -2588,7 +2596,7 @@ BuildEnsembleConfig(
|
||||
Tcl_InitHashTable(hash, TCL_STRING_KEYS);
|
||||
|
||||
if (subList) {
|
||||
size_t subc;
|
||||
Tcl_Size subc;
|
||||
Tcl_Obj **subv, *target, *cmdObj, *cmdPrefixObj;
|
||||
const char *name;
|
||||
|
||||
@@ -2617,7 +2625,7 @@ BuildEnsembleConfig(
|
||||
name = TclGetString(subv[i+1]);
|
||||
hPtr = Tcl_CreateHashEntry(hash, name, &isNew);
|
||||
if (isNew) {
|
||||
cmdObj = Tcl_NewStringObj(name, -1);
|
||||
cmdObj = Tcl_NewStringObj(name, TCL_INDEX_NONE);
|
||||
cmdPrefixObj = Tcl_NewListObj(1, &cmdObj);
|
||||
Tcl_SetHashValue(hPtr, cmdPrefixObj);
|
||||
Tcl_IncrRefCount(cmdPrefixObj);
|
||||
@@ -2655,7 +2663,7 @@ BuildEnsembleConfig(
|
||||
* programmer (or [::unknown] of course) to provide the procedure.
|
||||
*/
|
||||
|
||||
cmdObj = Tcl_NewStringObj(name, -1);
|
||||
cmdObj = Tcl_NewStringObj(name, TCL_INDEX_NONE);
|
||||
cmdPrefixObj = Tcl_NewListObj(1, &cmdObj);
|
||||
Tcl_SetHashValue(hPtr, cmdPrefixObj);
|
||||
Tcl_IncrRefCount(cmdPrefixObj);
|
||||
@@ -2920,7 +2928,7 @@ TclCompileEnsemble(
|
||||
Command *oldCmdPtr = cmdPtr, *newCmdPtr;
|
||||
int result, flags = 0, depth = 1, invokeAnyway = 0;
|
||||
int ourResult = TCL_ERROR;
|
||||
size_t i, len, numBytes;
|
||||
Tcl_Size i, len, numBytes;
|
||||
const char *word;
|
||||
|
||||
TclNewObj(replaced);
|
||||
@@ -2990,7 +2998,7 @@ TclCompileEnsemble(
|
||||
|
||||
(void) Tcl_GetEnsembleSubcommandList(NULL, ensemble, &listObj);
|
||||
if (listObj != NULL) {
|
||||
size_t sclen;
|
||||
Tcl_Size sclen;
|
||||
const char *str;
|
||||
Tcl_Obj *matchObj = NULL;
|
||||
|
||||
@@ -3247,20 +3255,20 @@ int
|
||||
TclAttemptCompileProc(
|
||||
Tcl_Interp *interp,
|
||||
Tcl_Parse *parsePtr,
|
||||
size_t depth,
|
||||
Tcl_Size depth,
|
||||
Command *cmdPtr,
|
||||
CompileEnv *envPtr) /* Holds resulting instructions. */
|
||||
{
|
||||
DefineLineInformation;
|
||||
int result;
|
||||
size_t i;
|
||||
Tcl_Size i;
|
||||
Tcl_Token *saveTokenPtr = parsePtr->tokenPtr;
|
||||
size_t savedStackDepth = envPtr->currStackDepth;
|
||||
unsigned savedCodeNext = envPtr->codeNext - envPtr->codeStart;
|
||||
size_t savedAuxDataArrayNext = envPtr->auxDataArrayNext;
|
||||
size_t savedExceptArrayNext = envPtr->exceptArrayNext;
|
||||
Tcl_Size savedStackDepth = envPtr->currStackDepth;
|
||||
TCL_HASH_TYPE savedCodeNext = envPtr->codeNext - envPtr->codeStart;
|
||||
Tcl_Size savedAuxDataArrayNext = envPtr->auxDataArrayNext;
|
||||
Tcl_Size savedExceptArrayNext = envPtr->exceptArrayNext;
|
||||
#ifdef TCL_COMPILE_DEBUG
|
||||
size_t savedExceptDepth = envPtr->exceptDepth;
|
||||
Tcl_Size savedExceptDepth = envPtr->exceptDepth;
|
||||
#endif
|
||||
|
||||
if (cmdPtr->compileProc == NULL) {
|
||||
@@ -3390,7 +3398,7 @@ CompileToInvokedCommand(
|
||||
Tcl_Obj *objPtr, **words;
|
||||
const char *bytes;
|
||||
int cmdLit, extraLiteralFlags = LITERAL_CMD_NAME;
|
||||
size_t i, numWords, length;
|
||||
Tcl_Size i, numWords, length;
|
||||
|
||||
/*
|
||||
* Push the words of the command. Take care; the command words may be
|
||||
|
||||
+8
-8
@@ -185,8 +185,8 @@ TclSetupEnv(
|
||||
p1 = "COMSPEC";
|
||||
}
|
||||
#endif
|
||||
obj1 = Tcl_NewStringObj(p1, -1);
|
||||
obj2 = Tcl_NewStringObj(p2, -1);
|
||||
obj1 = Tcl_NewStringObj(p1, TCL_INDEX_NONE);
|
||||
obj2 = Tcl_NewStringObj(p2, TCL_INDEX_NONE);
|
||||
Tcl_DStringFree(&envString);
|
||||
|
||||
Tcl_IncrRefCount(obj1);
|
||||
@@ -267,7 +267,7 @@ TclSetEnv(
|
||||
Tcl_MutexLock(&envMutex);
|
||||
index = TclpFindVariable(name, &length);
|
||||
|
||||
if (index == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(index)) {
|
||||
#ifndef USE_PUTENV
|
||||
/*
|
||||
* We need to handle the case where the environment may be changed
|
||||
@@ -351,7 +351,7 @@ TclSetEnv(
|
||||
* string in the cache.
|
||||
*/
|
||||
|
||||
if ((index != TCL_INDEX_NONE) && (tenviron[index] == (techar *)p)) {
|
||||
if (!TCL_SIZE_ISNEG(index) && (tenviron[index] == (techar *)p)) {
|
||||
ReplaceString(oldValue, p);
|
||||
#ifdef HAVE_PUTENV_THAT_COPIES
|
||||
} else {
|
||||
@@ -406,7 +406,7 @@ Tcl_PutEnv(
|
||||
* name and value parts, and call TclSetEnv to do all of the real work.
|
||||
*/
|
||||
|
||||
name = Tcl_ExternalToUtfDString(NULL, assignment, -1, &nameString);
|
||||
name = Tcl_ExternalToUtfDString(NULL, assignment, TCL_INDEX_NONE, &nameString);
|
||||
value = (char *)strchr(name, '=');
|
||||
|
||||
if ((value != NULL) && (value != name)) {
|
||||
@@ -469,7 +469,7 @@ TclUnsetEnv(
|
||||
* needless work and to avoid recursion on the unset.
|
||||
*/
|
||||
|
||||
if (index == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(index)) {
|
||||
Tcl_MutexUnlock(&envMutex);
|
||||
return;
|
||||
}
|
||||
@@ -574,7 +574,7 @@ TclGetEnv(
|
||||
Tcl_MutexLock(&envMutex);
|
||||
index = TclpFindVariable(name, &length);
|
||||
result = NULL;
|
||||
if (index != TCL_INDEX_NONE) {
|
||||
if (!TCL_SIZE_ISNEG(index)) {
|
||||
Tcl_DString envStr;
|
||||
|
||||
result = tenviron2utfdstr(tenviron[index], -1, &envStr);
|
||||
@@ -582,7 +582,7 @@ TclGetEnv(
|
||||
if (*result == '=') {
|
||||
result++;
|
||||
Tcl_DStringInit(valuePtr);
|
||||
Tcl_DStringAppend(valuePtr, result, -1);
|
||||
Tcl_DStringAppend(valuePtr, result, TCL_INDEX_NONE);
|
||||
result = Tcl_DStringValue(valuePtr);
|
||||
} else {
|
||||
result = NULL;
|
||||
|
||||
+19
-19
@@ -224,7 +224,7 @@ HandleBgErrors(
|
||||
Tcl_Preserve(interp);
|
||||
while (assocPtr->firstBgPtr != NULL) {
|
||||
int code;
|
||||
size_t prefixObjc;
|
||||
Tcl_Size prefixObjc;
|
||||
Tcl_Obj **prefixObjv, **tempObjv;
|
||||
|
||||
/*
|
||||
@@ -281,7 +281,7 @@ HandleBgErrors(
|
||||
Tcl_DecrRefCount(keyPtr);
|
||||
|
||||
Tcl_WriteChars(errChannel,
|
||||
"error in background error handler:\n", -1);
|
||||
"error in background error handler:\n", TCL_INDEX_NONE);
|
||||
if (valuePtr) {
|
||||
Tcl_WriteObj(errChannel, valuePtr);
|
||||
} else {
|
||||
@@ -343,7 +343,7 @@ TclDefaultBgErrorHandlerObjCmd(
|
||||
Tcl_DecrRefCount(keyPtr);
|
||||
if (result != TCL_OK || valuePtr == NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"missing return option \"-level\"", -1));
|
||||
"missing return option \"-level\"", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "ARGUMENT", "MISSING", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -356,7 +356,7 @@ TclDefaultBgErrorHandlerObjCmd(
|
||||
Tcl_DecrRefCount(keyPtr);
|
||||
if (result != TCL_OK || valuePtr == NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"missing return option \"-code\"", -1));
|
||||
"missing return option \"-code\"", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "ARGUMENT", "MISSING", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -474,17 +474,17 @@ TclDefaultBgErrorHandlerObjCmd(
|
||||
Tcl_RestoreInterpState(interp, saved);
|
||||
Tcl_WriteObj(errChannel, Tcl_GetVar2Ex(interp,
|
||||
"errorInfo", NULL, TCL_GLOBAL_ONLY));
|
||||
Tcl_WriteChars(errChannel, "\n", -1);
|
||||
Tcl_WriteChars(errChannel, "\n", TCL_INDEX_NONE);
|
||||
} else {
|
||||
Tcl_DiscardInterpState(saved);
|
||||
Tcl_WriteChars(errChannel,
|
||||
"bgerror failed to handle background error.\n",-1);
|
||||
Tcl_WriteChars(errChannel, " Original error: ", -1);
|
||||
"bgerror failed to handle background error.\n", TCL_INDEX_NONE);
|
||||
Tcl_WriteChars(errChannel, " Original error: ", TCL_INDEX_NONE);
|
||||
Tcl_WriteObj(errChannel, tempObjv[1]);
|
||||
Tcl_WriteChars(errChannel, "\n", -1);
|
||||
Tcl_WriteChars(errChannel, " Error in bgerror: ", -1);
|
||||
Tcl_WriteChars(errChannel, "\n", TCL_INDEX_NONE);
|
||||
Tcl_WriteChars(errChannel, " Error in bgerror: ", TCL_INDEX_NONE);
|
||||
Tcl_WriteObj(errChannel, resultPtr);
|
||||
Tcl_WriteChars(errChannel, "\n", -1);
|
||||
Tcl_WriteChars(errChannel, "\n", TCL_INDEX_NONE);
|
||||
}
|
||||
Tcl_DecrRefCount(resultPtr);
|
||||
Tcl_Flush(errChannel);
|
||||
@@ -957,7 +957,7 @@ Tcl_Exit(
|
||||
/*
|
||||
* Warning: this function SHOULD NOT return, as there is code that depends
|
||||
* on Tcl_Exit never returning. In fact, we will Tcl_Panic if anyone
|
||||
* returns, so critical is this dependcy.
|
||||
* returns, so critical is this dependency.
|
||||
*
|
||||
* If subsystems are not (yet) initialized, proper Tcl-finalization is
|
||||
* impossible, so fallback to system exit, see bug-[f8a33ce3db5d8cc2].
|
||||
@@ -1572,7 +1572,7 @@ Tcl_VwaitObjCmd(
|
||||
if (timeout < 0) {
|
||||
Tcl_ResetResult(interp);
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"timeout must be positive", -1));
|
||||
"timeout must be positive", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "EVENT", "NEGTIME", NULL);
|
||||
result = TCL_ERROR;
|
||||
goto done;
|
||||
@@ -1652,7 +1652,7 @@ Tcl_VwaitObjCmd(
|
||||
if ((mask & (TCL_FILE_EVENTS | TCL_IDLE_EVENTS |
|
||||
TCL_TIMER_EVENTS | TCL_WINDOW_EVENTS)) == 0) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"can't wait: would block forever", -1));
|
||||
"can't wait: would block forever", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "EVENT", "NO_SOURCES", NULL);
|
||||
result = TCL_ERROR;
|
||||
goto done;
|
||||
@@ -1660,7 +1660,7 @@ Tcl_VwaitObjCmd(
|
||||
|
||||
if ((timeout > 0) && ((mask & TCL_TIMER_EVENTS) == 0)) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"timer events disabled with timeout specified", -1));
|
||||
"timer events disabled with timeout specified", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "EVENT", "NO_TIME", NULL);
|
||||
result = TCL_ERROR;
|
||||
goto done;
|
||||
@@ -1688,7 +1688,7 @@ Tcl_VwaitObjCmd(
|
||||
for (i = 0; i < numItems; i++) {
|
||||
if (vwaitItems[i].mask) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"file events disabled with channel(s) specified", -1));
|
||||
"file events disabled with channel(s) specified", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "EVENT", "NO_FILE_EVENT", NULL);
|
||||
result = TCL_ERROR;
|
||||
goto done;
|
||||
@@ -1727,7 +1727,7 @@ Tcl_VwaitObjCmd(
|
||||
}
|
||||
if (Tcl_LimitExceeded(interp)) {
|
||||
Tcl_ResetResult(interp);
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj("limit exceeded", -1));
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj("limit exceeded", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "EVENT", "LIMIT", NULL);
|
||||
break;
|
||||
}
|
||||
@@ -1975,7 +1975,7 @@ Tcl_UpdateObjCmd(
|
||||
}
|
||||
if (Tcl_LimitExceeded(interp)) {
|
||||
Tcl_ResetResult(interp);
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj("limit exceeded", -1));
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj("limit exceeded", TCL_INDEX_NONE));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
}
|
||||
@@ -2047,8 +2047,8 @@ int
|
||||
Tcl_CreateThread(
|
||||
Tcl_ThreadId *idPtr, /* Return, the ID of the thread */
|
||||
Tcl_ThreadCreateProc *proc, /* Main() function of the thread */
|
||||
void *clientData, /* The one argument to Main() */
|
||||
size_t stackSize, /* Size of stack for the new thread */
|
||||
void *clientData, /* The one argument to Main() */
|
||||
Tcl_Size stackSize, /* Size of stack for the new thread */
|
||||
int flags) /* Flags controlling behaviour of the new
|
||||
* thread. */
|
||||
{
|
||||
|
||||
+54
-56
@@ -452,11 +452,11 @@ VarHashCreateVar(
|
||||
*/
|
||||
|
||||
#define GetNumberFromObj(interp, objPtr, ptrPtr, tPtr) \
|
||||
((TclHasInternalRep((objPtr), &tclIntType)) \
|
||||
((TclHasInternalRep((objPtr), &tclIntType.objType)) \
|
||||
? (*(tPtr) = TCL_NUMBER_INT, \
|
||||
*(ptrPtr) = (void *) \
|
||||
(&((objPtr)->internalRep.wideValue)), TCL_OK) : \
|
||||
TclHasInternalRep((objPtr), &tclDoubleType) \
|
||||
TclHasInternalRep((objPtr), &tclDoubleType.objType) \
|
||||
? (((isnan((objPtr)->internalRep.doubleValue)) \
|
||||
? (*(tPtr) = TCL_NUMBER_NAN) \
|
||||
: (*(tPtr) = TCL_NUMBER_DOUBLE)), \
|
||||
@@ -1224,10 +1224,10 @@ TclStackFree(
|
||||
void *
|
||||
TclStackAlloc(
|
||||
Tcl_Interp *interp,
|
||||
size_t numBytes)
|
||||
Tcl_Size numBytes)
|
||||
{
|
||||
Interp *iPtr = (Interp *) interp;
|
||||
size_t numWords;
|
||||
Tcl_Size numWords;
|
||||
|
||||
if (iPtr == NULL || iPtr->execEnvPtr == NULL) {
|
||||
return (void *) Tcl_Alloc(numBytes);
|
||||
@@ -1742,7 +1742,7 @@ TclCompileObj(
|
||||
* of course).
|
||||
*
|
||||
* Side effects:
|
||||
* valuePtr gets the new incrmented value.
|
||||
* valuePtr gets the new incremented value.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
@@ -2377,7 +2377,7 @@ TEBCresume(
|
||||
if (!corPtr) {
|
||||
TRACE_APPEND(("ERROR: yield outside coroutine\n"));
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"yield can only be called in a coroutine", -1));
|
||||
"yield can only be called in a coroutine", TCL_INDEX_NONE));
|
||||
DECACHE_STACK_INFO();
|
||||
Tcl_SetErrorCode(interp, "TCL", "COROUTINE", "ILLEGAL_YIELD",
|
||||
NULL);
|
||||
@@ -2408,7 +2408,7 @@ TEBCresume(
|
||||
TRACE(("[%.30s] => ERROR: yield outside coroutine\n",
|
||||
O2S(valuePtr)));
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"yieldto can only be called in a coroutine", -1));
|
||||
"yieldto can only be called in a coroutine", TCL_INDEX_NONE));
|
||||
DECACHE_STACK_INFO();
|
||||
Tcl_SetErrorCode(interp, "TCL", "COROUTINE", "ILLEGAL_YIELD",
|
||||
NULL);
|
||||
@@ -2419,7 +2419,7 @@ TEBCresume(
|
||||
TRACE(("[%.30s] => ERROR: yield in deleted\n",
|
||||
O2S(valuePtr)));
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"yieldto called in deleted namespace", -1));
|
||||
"yieldto called in deleted namespace", TCL_INDEX_NONE));
|
||||
DECACHE_STACK_INFO();
|
||||
Tcl_SetErrorCode(interp, "TCL", "COROUTINE", "YIELDTO_IN_DELETED",
|
||||
NULL);
|
||||
@@ -2447,8 +2447,8 @@ TEBCresume(
|
||||
* 'yieldParameter').
|
||||
*/
|
||||
|
||||
Tcl_IncrRefCount(valuePtr);
|
||||
iPtr->execEnvPtr = corPtr->callerEEPtr;
|
||||
Tcl_IncrRefCount(valuePtr);
|
||||
TclSetTailcall(interp, valuePtr);
|
||||
corPtr->yieldPtr = valuePtr;
|
||||
iPtr->execEnvPtr = corPtr->eePtr;
|
||||
@@ -2482,7 +2482,7 @@ TEBCresume(
|
||||
if (!(iPtr->varFramePtr->isProcCallFrame & 1)) {
|
||||
TRACE(("%d => ERROR: tailcall in non-proc context\n", opnd));
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"tailcall can only be called from a proc or lambda", -1));
|
||||
"tailcall can only be called from a proc or lambda", TCL_INDEX_NONE));
|
||||
DECACHE_STACK_INFO();
|
||||
Tcl_SetErrorCode(interp, "TCL", "TAILCALL", "ILLEGAL", NULL);
|
||||
CACHE_STACK_INFO();
|
||||
@@ -2511,7 +2511,7 @@ TEBCresume(
|
||||
*/
|
||||
|
||||
listPtr = Tcl_NewListObj(opnd, &OBJ_AT_DEPTH(opnd-1));
|
||||
nsObjPtr = Tcl_NewStringObj(iPtr->varFramePtr->nsPtr->fullName, -1);
|
||||
nsObjPtr = Tcl_NewStringObj(iPtr->varFramePtr->nsPtr->fullName, TCL_INDEX_NONE);
|
||||
TclListObjSetElement(interp, listPtr, 0, nsObjPtr);
|
||||
if (iPtr->varFramePtr->tailcallPtr) {
|
||||
Tcl_DecrRefCount(iPtr->varFramePtr->tailcallPtr);
|
||||
@@ -3444,10 +3444,8 @@ TEBCresume(
|
||||
}
|
||||
}
|
||||
DECACHE_STACK_INFO();
|
||||
Tcl_IncrRefCount(valueToAssign);
|
||||
objResultPtr = TclPtrSetVarIdx(interp, varPtr, arrayPtr, part1Ptr,
|
||||
part2Ptr, valueToAssign, TCL_LEAVE_ERR_MSG, opnd);
|
||||
TclDecrRefCount(valueToAssign);
|
||||
CACHE_STACK_INFO();
|
||||
if (!objResultPtr) {
|
||||
errorInLappendListPtr:
|
||||
@@ -4455,7 +4453,7 @@ TEBCresume(
|
||||
|
||||
TRACE_APPEND(("ERROR: \"%.30s\" not on reachable chain\n",
|
||||
O2S(valuePtr)));
|
||||
for (i = contextPtr->index ; i != TCL_INDEX_NONE ; i--) {
|
||||
for (i = contextPtr->index ; !TCL_SIZE_ISNEG(i) ; i--) {
|
||||
miPtr = contextPtr->callPtr->chain + i;
|
||||
if (miPtr->isFilter
|
||||
|| miPtr->mPtr->declaringClassPtr != classPtr) {
|
||||
@@ -4649,7 +4647,7 @@ TEBCresume(
|
||||
TRACE_ERROR(interp);
|
||||
goto gotError;
|
||||
}
|
||||
TclNewIntObj(objResultPtr, length);
|
||||
TclNewUIntObj(objResultPtr, length);
|
||||
TRACE_APPEND(("%" TCL_Z_MODIFIER "u\n", length));
|
||||
NEXT_INST_F(1, 1, 1);
|
||||
|
||||
@@ -4660,14 +4658,15 @@ TEBCresume(
|
||||
|
||||
|
||||
/* special case for ArithSeries */
|
||||
if (TclHasInternalRep(valuePtr,&tclArithSeriesType)) {
|
||||
length = TclArithSeriesObjLength(valuePtr);
|
||||
if (TclHasInternalRep(valuePtr,&tclArithSeriesType.objType)) {
|
||||
length = ABSTRACTLIST_PROC(valuePtr, lengthProc)(valuePtr);
|
||||
if (TclGetIntForIndexM(interp, value2Ptr, length-1, &index)!=TCL_OK) {
|
||||
CACHE_STACK_INFO();
|
||||
TRACE_ERROR(interp);
|
||||
goto gotError;
|
||||
}
|
||||
if (TclArithSeriesObjIndex(valuePtr, index, &objResultPtr) != TCL_OK) {
|
||||
objResultPtr = TclArithSeriesObjIndex(interp, valuePtr, index);
|
||||
if (objResultPtr == NULL) {
|
||||
CACHE_STACK_INFO();
|
||||
TRACE_ERROR(interp);
|
||||
goto gotError;
|
||||
@@ -4681,7 +4680,7 @@ TEBCresume(
|
||||
*/
|
||||
|
||||
if ((TclListObjGetElementsM(interp, valuePtr, &objc, &objv) == TCL_OK)
|
||||
&& !TclHasInternalRep(value2Ptr, &tclListType)) {
|
||||
&& !TclHasInternalRep(value2Ptr, &tclListType.objType)) {
|
||||
int code;
|
||||
|
||||
DECACHE_STACK_INFO();
|
||||
@@ -4723,8 +4722,8 @@ TEBCresume(
|
||||
TRACE(("\"%.30s\" %d => ", O2S(valuePtr), opnd));
|
||||
|
||||
/* special case for ArithSeries */
|
||||
if (TclHasInternalRep(valuePtr,&tclArithSeriesType)) {
|
||||
length = TclArithSeriesObjLength(valuePtr);
|
||||
if (TclHasInternalRep(valuePtr,&tclArithSeriesType.objType)) {
|
||||
length = ABSTRACTLIST_PROC(valuePtr, lengthProc)(valuePtr);
|
||||
|
||||
/* Decode end-offset index values. */
|
||||
|
||||
@@ -4732,7 +4731,8 @@ TEBCresume(
|
||||
|
||||
/* Compute value @ index */
|
||||
if (index < length) {
|
||||
if (TclArithSeriesObjIndex(valuePtr, index, &objResultPtr) != TCL_OK) {
|
||||
objResultPtr = TclArithSeriesObjIndex(interp, valuePtr, index);
|
||||
if (objResultPtr == NULL) {
|
||||
CACHE_STACK_INFO();
|
||||
TRACE_ERROR(interp);
|
||||
goto gotError;
|
||||
@@ -4943,7 +4943,7 @@ TEBCresume(
|
||||
|
||||
fromIdx = TclIndexDecode(fromIdx, objc - 1);
|
||||
|
||||
if (TclHasInternalRep(valuePtr,&tclArithSeriesType)) {
|
||||
if (TclHasInternalRep(valuePtr,&tclArithSeriesType.objType)) {
|
||||
objResultPtr = TclArithSeriesObjRange(interp, valuePtr, fromIdx, toIdx);
|
||||
if (objResultPtr == NULL) {
|
||||
TRACE_ERROR(interp);
|
||||
@@ -4971,14 +4971,14 @@ TEBCresume(
|
||||
if (length > 0) {
|
||||
size_t i = 0;
|
||||
Tcl_Obj *o;
|
||||
int isArithSeries = TclHasInternalRep(value2Ptr,&tclArithSeriesType);
|
||||
int isArithSeries = TclHasInternalRep(value2Ptr,&tclArithSeriesType.objType);
|
||||
/*
|
||||
* An empty list doesn't match anything.
|
||||
*/
|
||||
|
||||
do {
|
||||
if (isArithSeries) {
|
||||
TclArithSeriesObjIndex(value2Ptr, i, &o);
|
||||
o = TclArithSeriesObjIndex(NULL, value2Ptr, i);
|
||||
} else {
|
||||
Tcl_ListObjIndex(NULL, value2Ptr, i, &o);
|
||||
}
|
||||
@@ -5037,7 +5037,7 @@ TEBCresume(
|
||||
|
||||
case INST_LREPLACE4:
|
||||
{
|
||||
Tcl_Size numToDelete, numNewElems;
|
||||
size_t numToDelete, numNewElems;
|
||||
int end_indicator;
|
||||
int haveSecondIndex, flags;
|
||||
Tcl_Obj *fromIdxObj, *toIdxObj;
|
||||
@@ -5071,8 +5071,7 @@ TEBCresume(
|
||||
}
|
||||
if (fromIdx == TCL_INDEX_NONE) {
|
||||
fromIdx = 0;
|
||||
}
|
||||
else if (fromIdx > length) {
|
||||
} else if (fromIdx > length) {
|
||||
fromIdx = length;
|
||||
}
|
||||
numToDelete = 0;
|
||||
@@ -5111,8 +5110,7 @@ TEBCresume(
|
||||
}
|
||||
TRACE_APPEND(("\"%.30s\"\n", O2S(objResultPtr)));
|
||||
NEXT_INST_V(6, opnd, 1);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (Tcl_ListObjReplace(interp,
|
||||
valuePtr,
|
||||
fromIdx,
|
||||
@@ -5148,7 +5146,7 @@ TEBCresume(
|
||||
{
|
||||
int checkEq = ((*pc == INST_EQ) || (*pc == INST_NEQ)
|
||||
|| (*pc == INST_STR_EQ) || (*pc == INST_STR_NEQ));
|
||||
match = TclStringCmp(valuePtr, value2Ptr, checkEq, 0, -1);
|
||||
match = TclStringCmp(valuePtr, value2Ptr, checkEq, 0, TCL_INDEX_NONE);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -5274,7 +5272,7 @@ TEBCresume(
|
||||
TclNewObj(objResultPtr);
|
||||
} else if (TclIsPureByteArray(valuePtr)) {
|
||||
objResultPtr = Tcl_NewByteArrayObj(
|
||||
Tcl_GetBytesFromObj(NULL, valuePtr, (size_t *)NULL)+index, 1);
|
||||
Tcl_GetByteArrayFromObj(valuePtr, (size_t *)NULL)+index, 1);
|
||||
} else if (valuePtr->bytes && slength == valuePtr->length) {
|
||||
objResultPtr = Tcl_NewStringObj((const char *)
|
||||
valuePtr->bytes+index, 1);
|
||||
@@ -5348,7 +5346,7 @@ TEBCresume(
|
||||
|
||||
toIdx = TclIndexDecode(toIdx, slength - 1);
|
||||
fromIdx = TclIndexDecode(fromIdx, slength - 1);
|
||||
if (toIdx == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(toIdx)) {
|
||||
TclNewObj(objResultPtr);
|
||||
} else {
|
||||
objResultPtr = Tcl_GetRange(valuePtr, fromIdx, toIdx);
|
||||
@@ -5383,7 +5381,7 @@ TEBCresume(
|
||||
TclDecrRefCount(OBJ_AT_TOS);
|
||||
(void) POP_OBJECT();
|
||||
|
||||
if ((toIdx == TCL_INDEX_NONE) ||
|
||||
if (TCL_SIZE_ISNEG(toIdx) ||
|
||||
(fromIdx + 1 > slength + 1) ||
|
||||
(toIdx + 1 < fromIdx + 1)) {
|
||||
TRACE_APPEND(("\"%.30s\"\n", O2S(valuePtr)));
|
||||
@@ -5391,7 +5389,7 @@ TEBCresume(
|
||||
NEXT_INST_F(1, 0, 0);
|
||||
}
|
||||
|
||||
if (fromIdx == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(fromIdx)) {
|
||||
fromIdx = TCL_INDEX_START;
|
||||
}
|
||||
|
||||
@@ -5536,7 +5534,7 @@ TEBCresume(
|
||||
ustring2 = Tcl_GetUnicodeFromObj(value2Ptr, &length2);
|
||||
match = TclUniCharMatch(ustring1, slength, ustring2, length2,
|
||||
nocase);
|
||||
} else if (TclIsPureByteArray(valuePtr) && !nocase) {
|
||||
} else if (TclIsPureByteArray(valuePtr) && TclIsPureByteArray(value2Ptr) && !nocase) {
|
||||
unsigned char *bytes1, *bytes2;
|
||||
size_t wlen1 = 0, wlen2 = 0;
|
||||
|
||||
@@ -5842,7 +5840,7 @@ TEBCresume(
|
||||
case INST_RSHIFT:
|
||||
if (w2 < 0) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"negative shift argument", -1));
|
||||
"negative shift argument", TCL_INDEX_NONE));
|
||||
#ifdef ERROR_CODE_FOR_EARLY_DETECTED_ARITH_ERROR
|
||||
DECACHE_STACK_INFO();
|
||||
Tcl_SetErrorCode(interp, "ARITH", "DOMAIN",
|
||||
@@ -5891,7 +5889,7 @@ TEBCresume(
|
||||
case INST_LSHIFT:
|
||||
if (w2 < 0) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"negative shift argument", -1));
|
||||
"negative shift argument", TCL_INDEX_NONE));
|
||||
#ifdef ERROR_CODE_FOR_EARLY_DETECTED_ARITH_ERROR
|
||||
DECACHE_STACK_INFO();
|
||||
Tcl_SetErrorCode(interp, "ARITH", "DOMAIN",
|
||||
@@ -5914,7 +5912,7 @@ TEBCresume(
|
||||
*/
|
||||
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"integer value too large to represent", -1));
|
||||
"integer value too large to represent", TCL_INDEX_NONE));
|
||||
#ifdef ERROR_CODE_FOR_EARLY_DETECTED_ARITH_ERROR
|
||||
DECACHE_STACK_INFO();
|
||||
Tcl_SetErrorCode(interp, "ARITH", "IOVERFLOW",
|
||||
@@ -6337,7 +6335,7 @@ TEBCresume(
|
||||
|
||||
case INST_TRY_CVT_TO_BOOLEAN:
|
||||
valuePtr = OBJ_AT_TOS;
|
||||
if (TclHasInternalRep(valuePtr, &tclBooleanType)) {
|
||||
if (TclHasInternalRep(valuePtr, &tclBooleanType.objType)) {
|
||||
objResultPtr = TCONST(1);
|
||||
} else {
|
||||
int res = (TclSetBooleanFromAny(NULL, valuePtr) == TCL_OK);
|
||||
@@ -7388,7 +7386,7 @@ TEBCresume(
|
||||
rangePtr->codeOffset, rangePtr->breakOffset));
|
||||
NEXT_INST_F(0, 0, 0);
|
||||
}
|
||||
if (rangePtr->continueOffset == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(rangePtr->continueOffset)) {
|
||||
TRACE_APPEND(("%s, loop w/o continue, checking for catch\n",
|
||||
StringForResultCode(result)));
|
||||
goto checkForCatch;
|
||||
@@ -7420,14 +7418,14 @@ TEBCresume(
|
||||
*/
|
||||
|
||||
divideByZero:
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj("divide by zero", -1));
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj("divide by zero", TCL_INDEX_NONE));
|
||||
DECACHE_STACK_INFO();
|
||||
Tcl_SetErrorCode(interp, "ARITH", "DIVZERO", "divide by zero", NULL);
|
||||
CACHE_STACK_INFO();
|
||||
goto gotError;
|
||||
|
||||
outOfMemory:
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj("out of memory", -1));
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj("out of memory", TCL_INDEX_NONE));
|
||||
DECACHE_STACK_INFO();
|
||||
Tcl_SetErrorCode(interp, "ARITH", "OUTOFMEMORY", "out of memory", NULL);
|
||||
CACHE_STACK_INFO();
|
||||
@@ -7440,7 +7438,7 @@ TEBCresume(
|
||||
|
||||
exponOfZero:
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"exponentiation of zero by negative power", -1));
|
||||
"exponentiation of zero by negative power", TCL_INDEX_NONE));
|
||||
DECACHE_STACK_INFO();
|
||||
Tcl_SetErrorCode(interp, "ARITH", "DOMAIN",
|
||||
"exponentiation of zero by negative power", NULL);
|
||||
@@ -8001,7 +7999,7 @@ ExecuteExtendedBinaryMathOp(
|
||||
}
|
||||
if (invalid) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"negative shift argument", -1));
|
||||
"negative shift argument", TCL_INDEX_NONE));
|
||||
return GENERAL_ARITHMETIC_ERROR;
|
||||
}
|
||||
|
||||
@@ -8032,7 +8030,7 @@ ExecuteExtendedBinaryMathOp(
|
||||
*/
|
||||
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"integer value too large to represent", -1));
|
||||
"integer value too large to represent", TCL_INDEX_NONE));
|
||||
return GENERAL_ARITHMETIC_ERROR;
|
||||
}
|
||||
shift = (int)(*((const Tcl_WideInt *)ptr2));
|
||||
@@ -8280,7 +8278,7 @@ ExecuteExtendedBinaryMathOp(
|
||||
|
||||
if (type2 != TCL_NUMBER_INT) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"exponent too large", -1));
|
||||
"exponent too large", TCL_INDEX_NONE));
|
||||
return GENERAL_ARITHMETIC_ERROR;
|
||||
}
|
||||
|
||||
@@ -8357,10 +8355,10 @@ ExecuteExtendedBinaryMathOp(
|
||||
overflowExpon:
|
||||
|
||||
if ((TclGetWideIntFromObj(NULL, value2Ptr, &w2) != TCL_OK)
|
||||
|| (value2Ptr->typePtr != &tclIntType)
|
||||
|| (value2Ptr->typePtr != &tclIntType.objType)
|
||||
|| (Tcl_WideUInt)w2 >= (1<<28)) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"exponent too large", -1));
|
||||
"exponent too large", TCL_INDEX_NONE));
|
||||
return GENERAL_ARITHMETIC_ERROR;
|
||||
}
|
||||
Tcl_TakeBignumFromObj(NULL, valuePtr, &big1);
|
||||
@@ -9302,7 +9300,7 @@ GetExceptRangeForPc(
|
||||
if (searchMode == TCL_BREAK) {
|
||||
return rangePtr;
|
||||
}
|
||||
if (searchMode == TCL_CONTINUE && rangePtr->continueOffset != TCL_INDEX_NONE){
|
||||
if (searchMode == TCL_CONTINUE && !TCL_SIZE_ISNEG(rangePtr->continueOffset)){
|
||||
return rangePtr;
|
||||
}
|
||||
}
|
||||
@@ -9367,16 +9365,16 @@ TclExprFloatError(
|
||||
|
||||
if ((errno == EDOM) || isnan(value)) {
|
||||
s = "domain error: argument not in valid range";
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(s, -1));
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(s, TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "ARITH", "DOMAIN", s, NULL);
|
||||
} else if ((errno == ERANGE) || isinf(value)) {
|
||||
if (value == 0.0) {
|
||||
s = "floating-point value too small to represent";
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(s, -1));
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(s, TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "ARITH", "UNDERFLOW", s, NULL);
|
||||
} else {
|
||||
s = "floating-point value too large to represent";
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(s, -1));
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(s, TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "ARITH", "OVERFLOW", s, NULL);
|
||||
}
|
||||
} else {
|
||||
@@ -9736,7 +9734,7 @@ EvalStatsCmd(
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (i = 31; i != TCL_INDEX_NONE; i--) {
|
||||
for (i = 31; !TCL_SIZE_ISNEG(i); i--) {
|
||||
if (statsPtr->srcCount[i] > 0) {
|
||||
break; /* maxSizeDecade to consume 'i' value
|
||||
* below... */
|
||||
@@ -9760,7 +9758,7 @@ EvalStatsCmd(
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (i = 31; i != TCL_INDEX_NONE; i--) {
|
||||
for (i = 31; !TCL_SIZE_ISNEG(i); i--) {
|
||||
if (statsPtr->byteCodeCount[i] > 0) {
|
||||
break; /* maxSizeDecade to consume 'i' value
|
||||
* below... */
|
||||
@@ -9784,7 +9782,7 @@ EvalStatsCmd(
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (i = 31; i != TCL_INDEX_NONE; i--) {
|
||||
for (i = 31; !TCL_SIZE_ISNEG(i); i--) {
|
||||
if (statsPtr->lifetimeCount[i] > 0) {
|
||||
break; /* maxSizeDecade to consume 'i' value
|
||||
* below... */
|
||||
|
||||
+3
-3
@@ -426,7 +426,7 @@ TclFileDeleteCmd(
|
||||
if (result != TCL_OK) {
|
||||
if (errfile == NULL) {
|
||||
/*
|
||||
* We try to accomodate poor error results from our Tcl_FS calls.
|
||||
* We try to accommodate poor error results from our Tcl_FS calls.
|
||||
*/
|
||||
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
@@ -1042,7 +1042,7 @@ TclFileAttrsCmd(
|
||||
res = Tcl_FSFileAttrsGet(interp, index, filePtr, &objPtrAttr);
|
||||
if (res == TCL_OK) {
|
||||
Tcl_Obj *objPtr =
|
||||
Tcl_NewStringObj(attributeStrings[index], -1);
|
||||
Tcl_NewStringObj(attributeStrings[index], TCL_INDEX_NONE);
|
||||
|
||||
Tcl_ListObjAppendElement(interp, listPtr, objPtr);
|
||||
Tcl_ListObjAppendElement(interp, listPtr, objPtrAttr);
|
||||
@@ -1492,7 +1492,7 @@ TclFileTemporaryCmd(
|
||||
return TCL_ERROR;
|
||||
}
|
||||
}
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(Tcl_GetChannelName(chan), -1));
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(Tcl_GetChannelName(chan), TCL_INDEX_NONE));
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
|
||||
+20
-20
@@ -428,7 +428,7 @@ TclpGetNativePathType(
|
||||
if ((rootEnd != path) && (driveNameLengthPtr != NULL)) {
|
||||
*driveNameLengthPtr = rootEnd - path;
|
||||
if (driveNameRef != NULL) {
|
||||
*driveNameRef = TclDStringToObj(&ds);
|
||||
*driveNameRef = Tcl_DStringToObj(&ds);
|
||||
Tcl_IncrRefCount(*driveNameRef);
|
||||
}
|
||||
}
|
||||
@@ -537,7 +537,7 @@ Tcl_SplitPath(
|
||||
* Perform the splitting, using objectified, vfs-aware code.
|
||||
*/
|
||||
|
||||
tmpPtr = Tcl_NewStringObj(path, -1);
|
||||
tmpPtr = Tcl_NewStringObj(path, TCL_INDEX_NONE);
|
||||
Tcl_IncrRefCount(tmpPtr);
|
||||
resultPtr = Tcl_FSSplitPath(tmpPtr, argcPtr);
|
||||
Tcl_IncrRefCount(resultPtr);
|
||||
@@ -701,7 +701,7 @@ SplitWinPath(
|
||||
*/
|
||||
|
||||
if (p != path) {
|
||||
Tcl_ListObjAppendElement(NULL, result, TclDStringToObj(&buf));
|
||||
Tcl_ListObjAppendElement(NULL, result, Tcl_DStringToObj(&buf));
|
||||
}
|
||||
Tcl_DStringFree(&buf);
|
||||
|
||||
@@ -758,7 +758,7 @@ SplitWinPath(
|
||||
Tcl_Obj *
|
||||
Tcl_FSJoinToPath(
|
||||
Tcl_Obj *pathPtr, /* Valid path or NULL. */
|
||||
size_t objc, /* Number of array elements to join */
|
||||
Tcl_Size objc, /* Number of array elements to join */
|
||||
Tcl_Obj *const objv[]) /* Path elements to join. */
|
||||
{
|
||||
if (pathPtr == NULL) {
|
||||
@@ -927,11 +927,11 @@ TclpNativeJoinPath(
|
||||
|
||||
char *
|
||||
Tcl_JoinPath(
|
||||
size_t argc,
|
||||
Tcl_Size argc,
|
||||
const char *const *argv,
|
||||
Tcl_DString *resultPtr) /* Pointer to previously initialized DString */
|
||||
{
|
||||
size_t i, len;
|
||||
Tcl_Size i, len;
|
||||
Tcl_Obj *listObj;
|
||||
Tcl_Obj *resultObj;
|
||||
const char *resultStr;
|
||||
@@ -943,7 +943,7 @@ Tcl_JoinPath(
|
||||
TclNewObj(listObj);
|
||||
for (i = 0; i < argc; i++) {
|
||||
Tcl_ListObjAppendElement(NULL, listObj,
|
||||
Tcl_NewStringObj(argv[i], -1));
|
||||
Tcl_NewStringObj(argv[i], TCL_INDEX_NONE));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1003,7 +1003,7 @@ Tcl_TranslateFileName(
|
||||
Tcl_DString *bufferPtr) /* Uninitialized or free DString filled with
|
||||
* name. */
|
||||
{
|
||||
Tcl_Obj *path = Tcl_NewStringObj(name, -1);
|
||||
Tcl_Obj *path = Tcl_NewStringObj(name, TCL_INDEX_NONE);
|
||||
Tcl_Obj *transPtr;
|
||||
|
||||
Tcl_IncrRefCount(path);
|
||||
@@ -1171,7 +1171,7 @@ Tcl_GlobObjCmd(
|
||||
case GLOB_DIR: /* -dir */
|
||||
if (i == (objc-1)) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"missing argument to \"-directory\"", -1));
|
||||
"missing argument to \"-directory\"", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "ARGUMENT", "MISSING", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -1199,7 +1199,7 @@ Tcl_GlobObjCmd(
|
||||
case GLOB_PATH: /* -path */
|
||||
if (i == (objc-1)) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"missing argument to \"-path\"", -1));
|
||||
"missing argument to \"-path\"", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "ARGUMENT", "MISSING", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -1220,7 +1220,7 @@ Tcl_GlobObjCmd(
|
||||
case GLOB_TYPE: /* -types */
|
||||
if (i == (objc-1)) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"missing argument to \"-types\"", -1));
|
||||
"missing argument to \"-types\"", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "ARGUMENT", "MISSING", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -1240,7 +1240,7 @@ Tcl_GlobObjCmd(
|
||||
if ((globFlags & TCL_GLOBMODE_TAILS) && (pathOrDir == NULL)) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"\"-tails\" must be used with either "
|
||||
"\"-directory\" or \"-path\"", -1));
|
||||
"\"-directory\" or \"-path\"", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "GLOB",
|
||||
"BADOPTIONCOMBINATION", NULL);
|
||||
return TCL_ERROR;
|
||||
@@ -1291,7 +1291,7 @@ Tcl_GlobObjCmd(
|
||||
* in TclGlob requires a non-NULL pathOrDir.
|
||||
*/
|
||||
|
||||
Tcl_DStringAppend(&pref, first, -1);
|
||||
Tcl_DStringAppend(&pref, first, TCL_INDEX_NONE);
|
||||
globFlags &= ~TCL_GLOBMODE_TAILS;
|
||||
pathOrDir = NULL;
|
||||
} else {
|
||||
@@ -1330,7 +1330,7 @@ Tcl_GlobObjCmd(
|
||||
}
|
||||
}
|
||||
if (*search != '\0') {
|
||||
Tcl_DStringAppend(&prefix, search, -1);
|
||||
Tcl_DStringAppend(&prefix, search, TCL_INDEX_NONE);
|
||||
}
|
||||
Tcl_DStringFree(&pref);
|
||||
}
|
||||
@@ -1460,7 +1460,7 @@ Tcl_GlobObjCmd(
|
||||
badMacTypesArg:
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"only one MacOS type or creator argument"
|
||||
" to \"-types\" allowed", -1));
|
||||
" to \"-types\" allowed", TCL_INDEX_NONE));
|
||||
result = TCL_ERROR;
|
||||
Tcl_SetErrorCode(interp, "TCL", "ARGUMENT", "BAD", NULL);
|
||||
join = 0;
|
||||
@@ -1642,7 +1642,7 @@ TclGlob(
|
||||
|| (tail[0] == '\\' && tail[1] == '\\'))) {
|
||||
size_t driveNameLen;
|
||||
Tcl_Obj *driveName;
|
||||
Tcl_Obj *temp = Tcl_NewStringObj(tail, -1);
|
||||
Tcl_Obj *temp = Tcl_NewStringObj(tail, TCL_INDEX_NONE);
|
||||
Tcl_IncrRefCount(temp);
|
||||
|
||||
switch (TclGetPathType(temp, NULL, &driveNameLen, &driveName)) {
|
||||
@@ -2033,14 +2033,14 @@ DoGlob(
|
||||
break;
|
||||
}
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"unmatched open-brace in file name", -1));
|
||||
"unmatched open-brace in file name", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "GLOB", "BALANCE",
|
||||
NULL);
|
||||
return TCL_ERROR;
|
||||
|
||||
} else if (*p == '}') {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"unmatched close-brace in file name", -1));
|
||||
"unmatched close-brace in file name", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "GLOB", "BALANCE",
|
||||
NULL);
|
||||
return TCL_ERROR;
|
||||
@@ -2072,7 +2072,7 @@ DoGlob(
|
||||
SkipToChar(&p, ',');
|
||||
Tcl_DStringSetLength(&newName, baseLength);
|
||||
Tcl_DStringAppend(&newName, element, p-element);
|
||||
Tcl_DStringAppend(&newName, closeBrace+1, -1);
|
||||
Tcl_DStringAppend(&newName, closeBrace+1, TCL_INDEX_NONE);
|
||||
result = DoGlob(interp, matchesObj, separators, pathPtr, flags,
|
||||
Tcl_DStringValue(&newName), types);
|
||||
if (result != TCL_OK) {
|
||||
@@ -2241,7 +2241,7 @@ DoGlob(
|
||||
*/
|
||||
|
||||
if (pathPtr == NULL) {
|
||||
joinedPtr = TclDStringToObj(&append);
|
||||
joinedPtr = Tcl_DStringToObj(&append);
|
||||
} else if (flags) {
|
||||
joinedPtr = TclNewFSPathObj(pathPtr, Tcl_DStringValue(&append),
|
||||
Tcl_DStringLength(&append));
|
||||
|
||||
+4
-4
@@ -623,18 +623,18 @@ Tcl_HashStats(
|
||||
*/
|
||||
|
||||
result = (char *)Tcl_Alloc((NUM_COUNTERS * 60) + 300);
|
||||
sprintf(result, "%" TCL_Z_MODIFIER "u entries in table, %" TCL_Z_MODIFIER "u buckets\n",
|
||||
snprintf(result, 60, "%" TCL_Z_MODIFIER "u entries in table, %" TCL_Z_MODIFIER "u buckets\n",
|
||||
tablePtr->numEntries, tablePtr->numBuckets);
|
||||
p = result + strlen(result);
|
||||
for (i = 0; i < NUM_COUNTERS; i++) {
|
||||
sprintf(p, "number of buckets with %" TCL_Z_MODIFIER "u entries: %" TCL_Z_MODIFIER "u\n",
|
||||
snprintf(p, 60, "number of buckets with %" TCL_Z_MODIFIER "u entries: %" TCL_Z_MODIFIER "u\n",
|
||||
i, count[i]);
|
||||
p += strlen(p);
|
||||
}
|
||||
sprintf(p, "number of buckets with %d or more entries: %" TCL_Z_MODIFIER "u\n",
|
||||
snprintf(p, 60, "number of buckets with %d or more entries: %" TCL_Z_MODIFIER "u\n",
|
||||
NUM_COUNTERS, overflow);
|
||||
p += strlen(p);
|
||||
sprintf(p, "average search distance for entry: %.1f", average);
|
||||
snprintf(p, 60, "average search distance for entry: %.1f", average);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ Tcl_RecordAndEval(
|
||||
* Call Tcl_RecordAndEvalObj to do the actual work.
|
||||
*/
|
||||
|
||||
cmdPtr = Tcl_NewStringObj(cmd, -1);
|
||||
cmdPtr = Tcl_NewStringObj(cmd, TCL_INDEX_NONE);
|
||||
Tcl_IncrRefCount(cmdPtr);
|
||||
result = Tcl_RecordAndEvalObj(interp, cmdPtr, flags);
|
||||
|
||||
|
||||
+409
-299
File diff suppressed because it is too large
Load Diff
+19
-11
@@ -36,12 +36,12 @@
|
||||
*/
|
||||
|
||||
typedef struct ChannelBuffer {
|
||||
size_t refCount; /* Current uses count */
|
||||
size_t nextAdded; /* The next position into which a character
|
||||
Tcl_Size refCount; /* Current uses count */
|
||||
Tcl_Size nextAdded; /* The next position into which a character
|
||||
* will be put in the buffer. */
|
||||
size_t nextRemoved; /* Position of next byte to be removed from
|
||||
Tcl_Size nextRemoved; /* Position of next byte to be removed from
|
||||
* the buffer. */
|
||||
size_t bufLength; /* How big is the buffer? */
|
||||
Tcl_Size bufLength; /* How big is the buffer? */
|
||||
struct ChannelBuffer *nextPtr;
|
||||
/* Next buffer in chain. */
|
||||
char buf[TCLFLEXARRAY]; /* Placeholder for real buffer. The real
|
||||
@@ -113,7 +113,7 @@ typedef struct Channel {
|
||||
ChannelBuffer *inQueueHead; /* Points at first buffer in input queue. */
|
||||
ChannelBuffer *inQueueTail; /* Points at last buffer in input queue. */
|
||||
|
||||
size_t refCount;
|
||||
Tcl_Size refCount;
|
||||
} Channel;
|
||||
|
||||
/*
|
||||
@@ -165,7 +165,7 @@ typedef struct ChannelState {
|
||||
int unreportedError; /* Non-zero if an error report was deferred
|
||||
* because it happened in the background. The
|
||||
* value is the POSIX error code. */
|
||||
size_t refCount; /* How many interpreters hold references to
|
||||
Tcl_Size refCount; /* How many interpreters hold references to
|
||||
* this IO channel? */
|
||||
struct CloseCallback *closeCbPtr;
|
||||
/* Callbacks registered to be called when the
|
||||
@@ -188,8 +188,11 @@ typedef struct ChannelState {
|
||||
EventScriptRecord *scriptRecordPtr;
|
||||
/* Chain of all scripts registered for event
|
||||
* handlers ("fileevent") on this channel. */
|
||||
size_t bufSize; /* What size buffers to allocate? */
|
||||
Tcl_Size bufSize; /* What size buffers to allocate? */
|
||||
Tcl_TimerToken timer; /* Handle to wakeup timer for this channel. */
|
||||
Channel *timerChanPtr; /* Needed in order to decrement the refCount of
|
||||
the right channel when the timer is
|
||||
deleted. */
|
||||
struct CopyState *csPtrR; /* State of background copy for which channel
|
||||
* is input, or NULL. */
|
||||
struct CopyState *csPtrW; /* State of background copy for which channel
|
||||
@@ -273,12 +276,10 @@ typedef struct ChannelState {
|
||||
* delivered for buffered data until
|
||||
* the state of the channel
|
||||
* changes. */
|
||||
#define CHANNEL_ENCODING_ERROR (1<<15) /* set if channel
|
||||
* encountered an encoding error */
|
||||
#define CHANNEL_RAW_MODE (1<<16) /* When set, notes that the Raw API is
|
||||
* being used. */
|
||||
#define CHANNEL_ENCODING_NOCOMPLAIN (1<<17) /* set if option
|
||||
* -nocomplainencoding is set to 1 */
|
||||
#define CHANNEL_ENCODING_STRICT (1<<18) /* set if option
|
||||
* -strictencoding is set to 1 */
|
||||
#define CHANNEL_INCLOSE (1<<19) /* Channel is currently being closed.
|
||||
* Its structures are still live and
|
||||
* usable, but it may not be closed
|
||||
@@ -287,6 +288,13 @@ typedef struct ChannelState {
|
||||
#define CHANNEL_CLOSEDWRITE (1<<21) /* Channel write side has been closed.
|
||||
* No further Tcl-level write IO on
|
||||
* the channel is allowed. */
|
||||
#define CHANNEL_PROFILE_MASK 0xFF000000
|
||||
#define CHANNEL_PROFILE_GET(flags_) ((flags_) & CHANNEL_PROFILE_MASK)
|
||||
#define CHANNEL_PROFILE_SET(flags_, profile_) \
|
||||
do { \
|
||||
(flags_) &= ~CHANNEL_PROFILE_MASK; \
|
||||
(flags_) |= profile_; \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* The length of time to wait between synthetic timer events. Must be zero or
|
||||
|
||||
+12
-9
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
|
||||
#include "tclInt.h"
|
||||
#include "tclTomMath.h"
|
||||
|
||||
/*
|
||||
* Callback structure for accept callback in a TCP server.
|
||||
@@ -44,7 +45,7 @@ static void RegisterTcpServerInterpCleanup(
|
||||
Tcl_Interp *interp,
|
||||
AcceptCallback *acceptCallbackPtr);
|
||||
static Tcl_InterpDeleteProc TcpAcceptCallbacksDeleteProc;
|
||||
static void TcpServerCloseProc(ClientData callbackData);
|
||||
static void TcpServerCloseProc(void *callbackData);
|
||||
static void UnregisterTcpServerInterpCleanupProc(
|
||||
Tcl_Interp *interp,
|
||||
AcceptCallback *acceptCallbackPtr);
|
||||
@@ -106,7 +107,7 @@ Tcl_PutsObjCmd(
|
||||
Tcl_Obj *string; /* String to write. */
|
||||
Tcl_Obj *chanObjPtr = NULL; /* channel object. */
|
||||
int newline; /* Add a newline at end? */
|
||||
int result; /* Result of puts operation. */
|
||||
size_t result; /* Result of puts operation. */
|
||||
int mode; /* Mode in which channel is opened. */
|
||||
|
||||
switch (objc) {
|
||||
@@ -163,12 +164,12 @@ Tcl_PutsObjCmd(
|
||||
|
||||
TclChannelPreserve(chan);
|
||||
result = Tcl_WriteObj(chan, string);
|
||||
if (result == -1) {
|
||||
if (TCL_SIZE_ISNEG(result)) {
|
||||
goto error;
|
||||
}
|
||||
if (newline != 0) {
|
||||
result = Tcl_WriteChars(chan, "\n", 1);
|
||||
if (result == -1) {
|
||||
if (TCL_SIZE_ISNEG(result)) {
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
@@ -330,7 +331,9 @@ Tcl_GetsObjCmd(
|
||||
code = TCL_ERROR;
|
||||
goto done;
|
||||
}
|
||||
Tcl_SetObjResult(interp, Tcl_NewWideIntObj((Tcl_WideInt)((Tcl_WideUInt)(lineLen + 1U)) - 1));
|
||||
Tcl_Obj *lineLenObj;
|
||||
TclNewIndexObj(lineLenObj, lineLen);
|
||||
Tcl_SetObjResult(interp, lineLenObj);
|
||||
} else {
|
||||
Tcl_SetObjResult(interp, linePtr);
|
||||
}
|
||||
@@ -1080,7 +1083,7 @@ Tcl_OpenObjCmd(
|
||||
if (objc == 4) {
|
||||
const char *permString = TclGetString(objv[3]);
|
||||
int code = TCL_ERROR;
|
||||
int scanned = TclParseAllWhiteSpace(permString, -1);
|
||||
int scanned = TclParseAllWhiteSpace(permString, TCL_INDEX_NONE);
|
||||
|
||||
/*
|
||||
* Support legacy octal numbers.
|
||||
@@ -1183,7 +1186,7 @@ Tcl_OpenObjCmd(
|
||||
|
||||
static void
|
||||
TcpAcceptCallbacksDeleteProc(
|
||||
ClientData clientData, /* Data which was passed when the assocdata
|
||||
void *clientData, /* Data which was passed when the assocdata
|
||||
* was registered. */
|
||||
TCL_UNUSED(Tcl_Interp *))
|
||||
{
|
||||
@@ -1311,7 +1314,7 @@ UnregisterTcpServerInterpCleanupProc(
|
||||
|
||||
static void
|
||||
AcceptCallbackProc(
|
||||
ClientData callbackData, /* The data stored when the callback was
|
||||
void *callbackData, /* The data stored when the callback was
|
||||
* created in the call to
|
||||
* Tcl_OpenTcpServer. */
|
||||
Tcl_Channel chan, /* Channel for the newly accepted
|
||||
@@ -1402,7 +1405,7 @@ AcceptCallbackProc(
|
||||
|
||||
static void
|
||||
TcpServerCloseProc(
|
||||
ClientData callbackData) /* The data passed in the call to
|
||||
void *callbackData) /* The data passed in the call to
|
||||
* Tcl_CreateCloseHandler. */
|
||||
{
|
||||
AcceptCallback *acceptCallbackPtr = (AcceptCallback *)callbackData;
|
||||
|
||||
+26
-26
@@ -19,25 +19,25 @@
|
||||
* the transformation.
|
||||
*/
|
||||
|
||||
static int TransformBlockModeProc(ClientData instanceData,
|
||||
static int TransformBlockModeProc(void *instanceData,
|
||||
int mode);
|
||||
static int TransformCloseProc(ClientData instanceData,
|
||||
static int TransformCloseProc(void *instanceData,
|
||||
Tcl_Interp *interp, int flags);
|
||||
static int TransformInputProc(ClientData instanceData, char *buf,
|
||||
static int TransformInputProc(void *instanceData, char *buf,
|
||||
int toRead, int *errorCodePtr);
|
||||
static int TransformOutputProc(ClientData instanceData,
|
||||
static int TransformOutputProc(void *instanceData,
|
||||
const char *buf, int toWrite, int *errorCodePtr);
|
||||
static int TransformSetOptionProc(ClientData instanceData,
|
||||
static int TransformSetOptionProc(void *instanceData,
|
||||
Tcl_Interp *interp, const char *optionName,
|
||||
const char *value);
|
||||
static int TransformGetOptionProc(ClientData instanceData,
|
||||
static int TransformGetOptionProc(void *instanceData,
|
||||
Tcl_Interp *interp, const char *optionName,
|
||||
Tcl_DString *dsPtr);
|
||||
static void TransformWatchProc(ClientData instanceData, int mask);
|
||||
static int TransformGetFileHandleProc(ClientData instanceData,
|
||||
int direction, ClientData *handlePtr);
|
||||
static int TransformNotifyProc(ClientData instanceData, int mask);
|
||||
static long long TransformWideSeekProc(ClientData instanceData,
|
||||
static void TransformWatchProc(void *instanceData, int mask);
|
||||
static int TransformGetFileHandleProc(void *instanceData,
|
||||
int direction, void **handlePtr);
|
||||
static int TransformNotifyProc(void *instanceData, int mask);
|
||||
static long long TransformWideSeekProc(void *instanceData,
|
||||
long long offset, int mode, int *errorCodePtr);
|
||||
|
||||
/*
|
||||
@@ -45,7 +45,7 @@ static long long TransformWideSeekProc(ClientData instanceData,
|
||||
* handling and generating fileeevents.
|
||||
*/
|
||||
|
||||
static void TransformChannelHandlerTimer(ClientData clientData);
|
||||
static void TransformChannelHandlerTimer(void *clientData);
|
||||
|
||||
/*
|
||||
* Forward declarations of internal procedures. Third, helper procedures
|
||||
@@ -268,7 +268,7 @@ TclChannelTransform(
|
||||
|
||||
if (TCL_OK != TclListObjLengthM(interp, cmdObjPtr, &objc)) {
|
||||
Tcl_SetObjResult(interp,
|
||||
Tcl_NewStringObj("-command value is not a list", -1));
|
||||
Tcl_NewStringObj("-command value is not a list", TCL_INDEX_NONE));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
@@ -397,7 +397,7 @@ ExecuteCallback(
|
||||
}
|
||||
|
||||
Tcl_IncrRefCount(command);
|
||||
Tcl_ListObjAppendElement(NULL, command, Tcl_NewStringObj((char *) op, -1));
|
||||
Tcl_ListObjAppendElement(NULL, command, Tcl_NewStringObj((char *) op, TCL_INDEX_NONE));
|
||||
|
||||
/*
|
||||
* Use a byte-array to prevent the misinterpretation of binary data coming
|
||||
@@ -510,7 +510,7 @@ ExecuteCallback(
|
||||
|
||||
static int
|
||||
TransformBlockModeProc(
|
||||
ClientData instanceData, /* State of transformation. */
|
||||
void *instanceData, /* State of transformation. */
|
||||
int mode) /* New blocking mode. */
|
||||
{
|
||||
TransformChannelData *dataPtr = (TransformChannelData *)instanceData;
|
||||
@@ -542,7 +542,7 @@ TransformBlockModeProc(
|
||||
|
||||
static int
|
||||
TransformCloseProc(
|
||||
ClientData instanceData,
|
||||
void *instanceData,
|
||||
Tcl_Interp *interp,
|
||||
int flags)
|
||||
{
|
||||
@@ -626,7 +626,7 @@ TransformCloseProc(
|
||||
|
||||
static int
|
||||
TransformInputProc(
|
||||
ClientData instanceData,
|
||||
void *instanceData,
|
||||
char *buf,
|
||||
int toRead,
|
||||
int *errorCodePtr)
|
||||
@@ -793,7 +793,7 @@ TransformInputProc(
|
||||
|
||||
static int
|
||||
TransformOutputProc(
|
||||
ClientData instanceData,
|
||||
void *instanceData,
|
||||
const char *buf,
|
||||
int toWrite,
|
||||
int *errorCodePtr)
|
||||
@@ -845,7 +845,7 @@ TransformOutputProc(
|
||||
|
||||
static long long
|
||||
TransformWideSeekProc(
|
||||
ClientData instanceData, /* The channel to manipulate. */
|
||||
void *instanceData, /* The channel to manipulate. */
|
||||
long long offset, /* Size of movement. */
|
||||
int mode, /* How to move. */
|
||||
int *errorCodePtr) /* Location of error flag. */
|
||||
@@ -923,7 +923,7 @@ TransformWideSeekProc(
|
||||
|
||||
static int
|
||||
TransformSetOptionProc(
|
||||
ClientData instanceData,
|
||||
void *instanceData,
|
||||
Tcl_Interp *interp,
|
||||
const char *optionName,
|
||||
const char *value)
|
||||
@@ -961,7 +961,7 @@ TransformSetOptionProc(
|
||||
|
||||
static int
|
||||
TransformGetOptionProc(
|
||||
ClientData instanceData,
|
||||
void *instanceData,
|
||||
Tcl_Interp *interp,
|
||||
const char *optionName,
|
||||
Tcl_DString *dsPtr)
|
||||
@@ -1008,7 +1008,7 @@ TransformGetOptionProc(
|
||||
|
||||
static void
|
||||
TransformWatchProc(
|
||||
ClientData instanceData, /* Channel to watch. */
|
||||
void *instanceData, /* Channel to watch. */
|
||||
int mask) /* Events of interest. */
|
||||
{
|
||||
TransformChannelData *dataPtr = (TransformChannelData *)instanceData;
|
||||
@@ -1086,9 +1086,9 @@ TransformWatchProc(
|
||||
|
||||
static int
|
||||
TransformGetFileHandleProc(
|
||||
ClientData instanceData, /* Channel to query. */
|
||||
void *instanceData, /* Channel to query. */
|
||||
int direction, /* Direction of interest. */
|
||||
ClientData *handlePtr) /* Place to store the handle into. */
|
||||
void **handlePtr) /* Place to store the handle into. */
|
||||
{
|
||||
TransformChannelData *dataPtr = (TransformChannelData *)instanceData;
|
||||
|
||||
@@ -1120,7 +1120,7 @@ TransformGetFileHandleProc(
|
||||
|
||||
static int
|
||||
TransformNotifyProc(
|
||||
ClientData clientData, /* The state of the notified
|
||||
void *clientData, /* The state of the notified
|
||||
* transformation. */
|
||||
int mask) /* The mask of occuring events. */
|
||||
{
|
||||
@@ -1165,7 +1165,7 @@ TransformNotifyProc(
|
||||
|
||||
static void
|
||||
TransformChannelHandlerTimer(
|
||||
ClientData clientData) /* Transformation to query. */
|
||||
void *clientData) /* Transformation to query. */
|
||||
{
|
||||
TransformChannelData *dataPtr = (TransformChannelData *)clientData;
|
||||
|
||||
|
||||
+14
-13
@@ -549,7 +549,7 @@ TclChanCreateObjCmd(
|
||||
|
||||
/*
|
||||
* First argument is a list of modes. Allowed entries are "read", "write".
|
||||
* Expect at least one list element. Abbreviations are ok.
|
||||
* Empty list is uncommon, but allowed. Abbreviations are ok.
|
||||
*/
|
||||
|
||||
modeObj = objv[MODE];
|
||||
@@ -922,6 +922,11 @@ TclChanPostEventObjCmd(
|
||||
if (EncodeEventMask(interp, "event", objv[EVENT], &events) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (events == 0) {
|
||||
Tcl_SetObjResult(interp,
|
||||
Tcl_NewStringObj("bad event list: is empty", -1));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check that the channel is actually interested in the provided events.
|
||||
@@ -1387,7 +1392,7 @@ ReflectInput(
|
||||
|
||||
if (bytev == NULL) {
|
||||
SetChannelErrorStr(rcPtr->chan, msg_read_nonbyte);
|
||||
goto invalid;
|
||||
goto invalid;
|
||||
} else if ((size_t)toRead < bytec) {
|
||||
SetChannelErrorStr(rcPtr->chan, msg_read_toomuch);
|
||||
goto invalid;
|
||||
@@ -2111,10 +2116,10 @@ ReflectTruncate(
|
||||
* EncodeEventMask --
|
||||
*
|
||||
* This function takes a list of event items and constructs the
|
||||
* equivalent internal bitmask. The list must contain at least one
|
||||
* element. Elements are "read", "write", or any unique abbreviation of
|
||||
* them. Note that the bitmask is not changed if problems are
|
||||
* encountered.
|
||||
* equivalent internal bitmask. The list may be empty but will usually
|
||||
* contain at least one element. Valid elements are "read", "write", or
|
||||
* any unique abbreviation of them. Note that the bitmask is not changed
|
||||
* if problems are encountered.
|
||||
*
|
||||
* Results:
|
||||
* A standard Tcl error code. A bitmask where TCL_READABLE and/or
|
||||
@@ -2144,12 +2149,6 @@ EncodeEventMask(
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
if (listc < 1) {
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"bad %s list: is empty", objName));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
events = 0;
|
||||
while (listc > 0) {
|
||||
if (Tcl_GetIndexFromObj(interp, listv[listc-1], eventOptions,
|
||||
@@ -2804,6 +2803,7 @@ DeleteThreadReflectedChannelMap(
|
||||
Tcl_ThreadId self = Tcl_GetCurrentThread();
|
||||
ReflectedChannelMap *rcmPtr; /* The map */
|
||||
ForwardingResult *resultPtr;
|
||||
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
|
||||
|
||||
/*
|
||||
* The origin thread for one or more reflected channels is gone.
|
||||
@@ -2883,6 +2883,7 @@ DeleteThreadReflectedChannelMap(
|
||||
*/
|
||||
|
||||
rcmPtr = GetThreadReflectedChannelMap();
|
||||
tsdPtr->rcmPtr = NULL;
|
||||
for (hPtr = Tcl_FirstHashEntry(&rcmPtr->map, &hSearch);
|
||||
hPtr != NULL;
|
||||
hPtr = Tcl_FirstHashEntry(&rcmPtr->map, &hSearch)) {
|
||||
@@ -3319,7 +3320,7 @@ ForwardProc(
|
||||
*/
|
||||
|
||||
char *buf = (char *)Tcl_Alloc(200);
|
||||
sprintf(buf,
|
||||
snprintf(buf, 200,
|
||||
"{Expected list with even number of elements, got %" TCL_Z_MODIFIER "u %s instead}",
|
||||
listc, (listc == 1 ? "element" : "elements"));
|
||||
|
||||
|
||||
+3
-3
@@ -117,13 +117,13 @@ TclSockGetPort(
|
||||
int
|
||||
TclSockMinimumBuffers(
|
||||
void *sock, /* Socket file descriptor */
|
||||
size_t size1) /* Minimum buffer size */
|
||||
Tcl_Size size1) /* Minimum buffer size */
|
||||
{
|
||||
int current;
|
||||
socklen_t len;
|
||||
int size = size1;
|
||||
|
||||
if ((size_t)size != size1) {
|
||||
if ((Tcl_Size)size != size1) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
len = sizeof(int);
|
||||
@@ -317,7 +317,7 @@ Tcl_OpenTcpServer(
|
||||
int port,
|
||||
const char *host,
|
||||
Tcl_TcpAcceptProc *acceptProc,
|
||||
ClientData callbackData)
|
||||
void *callbackData)
|
||||
{
|
||||
char portbuf[TCL_INTEGER_SPACE];
|
||||
|
||||
|
||||
+6
-6
@@ -178,7 +178,7 @@ const Tcl_Filesystem tclNativeFilesystem = {
|
||||
/*
|
||||
* An initial record in the linked list for the native filesystem. Remains at
|
||||
* the tail of the list and is never freed. Currently the native filesystem is
|
||||
* hard-coded. It may make sense to modify this to accomodate unconventional
|
||||
* hard-coded. It may make sense to modify this to accommodate unconventional
|
||||
* uses of Tcl that provide no native filesystem.
|
||||
*/
|
||||
|
||||
@@ -1756,7 +1756,7 @@ Tcl_FSEvalFileEx(
|
||||
* Otherwise, replace them. [Bug 3466099]
|
||||
*/
|
||||
|
||||
if (Tcl_ReadChars(chan, objPtr, -1,
|
||||
if (Tcl_ReadChars(chan, objPtr, TCL_INDEX_NONE,
|
||||
memcmp(string, "\xEF\xBB\xBF", 3)) == TCL_IO_FAILURE) {
|
||||
Tcl_CloseEx(interp, chan, 0);
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
@@ -1893,7 +1893,7 @@ TclNREvalFile(
|
||||
* Otherwise, replace them. [Bug 3466099]
|
||||
*/
|
||||
|
||||
if (Tcl_ReadChars(chan, objPtr, -1,
|
||||
if (Tcl_ReadChars(chan, objPtr, TCL_INDEX_NONE,
|
||||
memcmp(string, "\xEF\xBB\xBF", 3)) == TCL_IO_FAILURE) {
|
||||
Tcl_CloseEx(interp, chan, 0);
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
@@ -2459,7 +2459,7 @@ TclFSFileAttrIndex(
|
||||
* It's a constant attribute table, so use T_GIFO.
|
||||
*/
|
||||
|
||||
Tcl_Obj *tmpObj = Tcl_NewStringObj(attributeName, -1);
|
||||
Tcl_Obj *tmpObj = Tcl_NewStringObj(attributeName, TCL_INDEX_NONE);
|
||||
int result;
|
||||
|
||||
result = Tcl_GetIndexFromObj(NULL, tmpObj, attrTable, NULL, TCL_EXACT,
|
||||
@@ -3292,7 +3292,7 @@ Tcl_LoadFile(
|
||||
Tcl_DecrRefCount(copyToPtr);
|
||||
if (interp) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"couldn't load from current filesystem", -1));
|
||||
"couldn't load from current filesystem", TCL_INDEX_NONE));
|
||||
}
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -4612,7 +4612,7 @@ Tcl_FSFileSystemInfo(
|
||||
|
||||
resPtr = Tcl_NewListObj(0, NULL);
|
||||
Tcl_ListObjAppendElement(NULL, resPtr,
|
||||
Tcl_NewStringObj(fsPtr->typeName, -1));
|
||||
Tcl_NewStringObj(fsPtr->typeName, TCL_INDEX_NONE));
|
||||
|
||||
if (fsPtr->filesystemPathTypeProc != NULL) {
|
||||
Tcl_Obj *typePtr = fsPtr->filesystemPathTypeProc(pathPtr);
|
||||
|
||||
+27
-27
@@ -55,8 +55,8 @@ static const Tcl_ObjType indexType = {
|
||||
|
||||
typedef struct {
|
||||
void *tablePtr; /* Pointer to the table of strings */
|
||||
size_t offset; /* Offset between table entries */
|
||||
size_t index; /* Selected index into table. */
|
||||
Tcl_Size offset; /* Offset between table entries */
|
||||
Tcl_Size index; /* Selected index into table. */
|
||||
} IndexRep;
|
||||
|
||||
/*
|
||||
@@ -107,7 +107,7 @@ GetIndexFromObjList(
|
||||
int *indexPtr) /* Place to store resulting integer index. */
|
||||
{
|
||||
|
||||
size_t objc, t;
|
||||
Tcl_Size objc, t;
|
||||
int result;
|
||||
Tcl_Obj **objv;
|
||||
const char **tablePtr;
|
||||
@@ -187,13 +187,13 @@ Tcl_GetIndexFromObjStruct(
|
||||
* offset, the third plus the offset again,
|
||||
* etc. The last entry must be NULL and there
|
||||
* must not be duplicate entries. */
|
||||
size_t offset, /* The number of bytes between entries */
|
||||
Tcl_Size offset, /* The number of bytes between entries */
|
||||
const char *msg, /* Identifying word to use in error
|
||||
* messages. */
|
||||
int flags, /* 0, TCL_EXACT, TCL_NULL_OK or TCL_INDEX_TEMP_TABLE */
|
||||
void *indexPtr) /* Place to store resulting index. */
|
||||
{
|
||||
size_t index, idx, numAbbrev;
|
||||
Tcl_Size index, idx, numAbbrev;
|
||||
const char *key, *p1;
|
||||
const char *p2;
|
||||
const char *const *entryPtr;
|
||||
@@ -202,7 +202,7 @@ Tcl_GetIndexFromObjStruct(
|
||||
const Tcl_ObjInternalRep *irPtr;
|
||||
|
||||
/* Protect against invalid values, like TCL_INDEX_NONE or 0. */
|
||||
if (offset+1 <= sizeof(char *)) {
|
||||
if (offset + 1 <= sizeof(char *)) {
|
||||
offset = sizeof(char *);
|
||||
}
|
||||
/*
|
||||
@@ -505,7 +505,7 @@ PrefixMatchObjCmd(
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
int flags = 0, result, dummy, i;
|
||||
size_t dummyLength, errorLength;
|
||||
Tcl_Size dummyLength, errorLength;
|
||||
Tcl_Obj *errorPtr = NULL;
|
||||
const char *message = "option";
|
||||
Tcl_Obj *tablePtr, *objPtr, *resultPtr;
|
||||
@@ -533,7 +533,7 @@ PrefixMatchObjCmd(
|
||||
case PRFMATCH_MESSAGE:
|
||||
if (i > objc-4) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"missing value for -message", -1));
|
||||
"missing value for -message", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "NOARG", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -543,7 +543,7 @@ PrefixMatchObjCmd(
|
||||
case PRFMATCH_ERROR:
|
||||
if (i > objc-4) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"missing value for -error", -1));
|
||||
"missing value for -error", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "NOARG", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -629,7 +629,7 @@ PrefixAllObjCmd(
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
int result;
|
||||
size_t length, elemLength, tableObjc, t;
|
||||
Tcl_Size length, elemLength, tableObjc, t;
|
||||
const char *string, *elemString;
|
||||
Tcl_Obj **tableObjv, *resultPtr;
|
||||
|
||||
@@ -687,7 +687,7 @@ PrefixLongestObjCmd(
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
int result;
|
||||
size_t i, length, elemLength, resultLength, tableObjc, t;
|
||||
Tcl_Size i, length, elemLength, resultLength, tableObjc, t;
|
||||
const char *string, *elemString, *resultString;
|
||||
Tcl_Obj **tableObjv;
|
||||
|
||||
@@ -802,7 +802,7 @@ PrefixLongestObjCmd(
|
||||
void
|
||||
Tcl_WrongNumArgs(
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
size_t objc, /* Number of arguments to print from objv. */
|
||||
Tcl_Size objc, /* Number of arguments to print from objv. */
|
||||
Tcl_Obj *const objv[], /* Initial argument objects, which should be
|
||||
* included in the error message. */
|
||||
const char *message) /* Error message to print after the leading
|
||||
@@ -810,7 +810,7 @@ Tcl_WrongNumArgs(
|
||||
* NULL. */
|
||||
{
|
||||
Tcl_Obj *objPtr;
|
||||
size_t i, len, elemLen;
|
||||
Tcl_Size i, len, elemLen;
|
||||
char flags;
|
||||
Interp *iPtr = (Interp *)interp;
|
||||
const char *elementStr;
|
||||
@@ -819,9 +819,9 @@ Tcl_WrongNumArgs(
|
||||
if (iPtr->flags & INTERP_ALTERNATE_WRONG_ARGS) {
|
||||
iPtr->flags &= ~INTERP_ALTERNATE_WRONG_ARGS;
|
||||
Tcl_AppendObjToObj(objPtr, Tcl_GetObjResult(interp));
|
||||
Tcl_AppendToObj(objPtr, " or \"", -1);
|
||||
Tcl_AppendToObj(objPtr, " or \"", TCL_INDEX_NONE);
|
||||
} else {
|
||||
Tcl_AppendToObj(objPtr, "wrong # args: should be \"", -1);
|
||||
Tcl_AppendToObj(objPtr, "wrong # args: should be \"", TCL_INDEX_NONE);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -830,8 +830,8 @@ Tcl_WrongNumArgs(
|
||||
*/
|
||||
|
||||
if (iPtr->ensembleRewrite.sourceObjs != NULL) {
|
||||
size_t toSkip = iPtr->ensembleRewrite.numInsertedObjs;
|
||||
size_t toPrint = iPtr->ensembleRewrite.numRemovedObjs;
|
||||
Tcl_Size toSkip = iPtr->ensembleRewrite.numInsertedObjs;
|
||||
Tcl_Size toPrint = iPtr->ensembleRewrite.numRemovedObjs;
|
||||
Tcl_Obj *const *origObjv = TclEnsembleGetRewriteValues(interp);
|
||||
|
||||
/*
|
||||
@@ -889,7 +889,7 @@ Tcl_WrongNumArgs(
|
||||
* moderately complex condition here).
|
||||
*/
|
||||
|
||||
if (i+1<toPrint || objc!=0 || message!=NULL) {
|
||||
if (i + 1 < toPrint || objc!=0 || message!=NULL) {
|
||||
Tcl_AppendStringsToObj(objPtr, " ", NULL);
|
||||
}
|
||||
}
|
||||
@@ -997,7 +997,7 @@ Tcl_ParseArgsObjv(
|
||||
Tcl_Obj **leftovers; /* Array to write back to remObjv on
|
||||
* successful exit. Will include the name of
|
||||
* the command. */
|
||||
size_t nrem; /* Size of leftovers.*/
|
||||
Tcl_Size nrem; /* Size of leftovers.*/
|
||||
const Tcl_ArgvInfo *infoPtr;
|
||||
/* Pointer to the current entry in the table
|
||||
* of argument descriptions. */
|
||||
@@ -1009,13 +1009,13 @@ Tcl_ParseArgsObjv(
|
||||
* quick check for matching; use 2nd char.
|
||||
* because first char. will almost always be
|
||||
* '-'). */
|
||||
size_t srcIndex; /* Location from which to read next argument
|
||||
Tcl_Size srcIndex; /* Location from which to read next argument
|
||||
* from objv. */
|
||||
size_t dstIndex; /* Used to keep track of current arguments
|
||||
Tcl_Size dstIndex; /* Used to keep track of current arguments
|
||||
* being processed, primarily for error
|
||||
* reporting. */
|
||||
size_t objc; /* # arguments in objv still to process. */
|
||||
size_t length; /* Number of characters in current argument */
|
||||
Tcl_Size objc; /* # arguments in objv still to process. */
|
||||
Tcl_Size length; /* Number of characters in current argument */
|
||||
|
||||
if (remObjv != NULL) {
|
||||
/*
|
||||
@@ -1274,13 +1274,13 @@ PrintUsage(
|
||||
|
||||
width = 4;
|
||||
for (infoPtr = argTable; infoPtr->type != TCL_ARGV_END; infoPtr++) {
|
||||
size_t length;
|
||||
Tcl_Size length;
|
||||
|
||||
if (infoPtr->keyStr == NULL) {
|
||||
continue;
|
||||
}
|
||||
length = strlen(infoPtr->keyStr);
|
||||
if (length > (size_t)width) {
|
||||
if (length > (Tcl_Size)width) {
|
||||
width = length;
|
||||
}
|
||||
}
|
||||
@@ -1289,7 +1289,7 @@ PrintUsage(
|
||||
* Now add the option information, with pretty-printing.
|
||||
*/
|
||||
|
||||
msg = Tcl_NewStringObj("Command-specific options:", -1);
|
||||
msg = Tcl_NewStringObj("Command-specific options:", TCL_INDEX_NONE);
|
||||
for (infoPtr = argTable; infoPtr->type != TCL_ARGV_END; infoPtr++) {
|
||||
if ((infoPtr->type == TCL_ARGV_HELP) && (infoPtr->keyStr == NULL)) {
|
||||
Tcl_AppendPrintfToObj(msg, "\n%s", infoPtr->helpStr);
|
||||
@@ -1305,7 +1305,7 @@ PrintUsage(
|
||||
}
|
||||
numSpaces -= NUM_SPACES;
|
||||
}
|
||||
Tcl_AppendToObj(msg, infoPtr->helpStr, -1);
|
||||
Tcl_AppendToObj(msg, infoPtr->helpStr, TCL_INDEX_NONE);
|
||||
switch (infoPtr->type) {
|
||||
case TCL_ARGV_INT:
|
||||
Tcl_AppendPrintfToObj(msg, "\n\t\tDefault value: %d",
|
||||
|
||||
@@ -706,7 +706,7 @@ declare 258 {
|
||||
|
||||
# TIP 625: for unit testing - create list objects with span
|
||||
declare 260 {
|
||||
Tcl_Obj *TclListTestObj(int length, int leadingSpace, int endSpace)
|
||||
Tcl_Obj *TclListTestObj(size_t length, size_t leadingSpace, size_t endSpace)
|
||||
}
|
||||
|
||||
# TIP 625: for unit testing - check list invariants
|
||||
|
||||
+119
-89
@@ -131,6 +131,7 @@
|
||||
|
||||
#if defined(_WIN32) && defined(_MSC_VER)
|
||||
# define vsnprintf _vsnprintf
|
||||
# define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
#if !defined(TCL_THREADS)
|
||||
@@ -1091,6 +1092,20 @@ typedef struct ActiveInterpTrace {
|
||||
#define TCL_TRACE_ENTER_EXEC 1
|
||||
#define TCL_TRACE_LEAVE_EXEC 2
|
||||
|
||||
typedef struct { /* For internal core use only */
|
||||
Tcl_ObjType objType;
|
||||
struct {
|
||||
size_t (*lengthProc)(Tcl_Obj *obj);
|
||||
} abstractList;
|
||||
} TclObjTypeWithAbstractList;
|
||||
#define TCL_OBJTYPE_V0_1(lengthProc) (sizeof(TclObjTypeWithAbstractList)) \
|
||||
}, {lengthProc /* For internal core use only */
|
||||
#define ABSTRACTLIST_PROC(objPtr, proc) (((objPtr)->typePtr \
|
||||
&& ((objPtr)->typePtr->version > offsetof(TclObjTypeWithAbstractList, abstractList.proc))) ? \
|
||||
((const TclObjTypeWithAbstractList *)(objPtr)->typePtr)->abstractList.proc : NULL)
|
||||
|
||||
MODULE_SCOPE size_t TclLengthOne(Tcl_Obj *);
|
||||
|
||||
/*
|
||||
* The structure below defines an entry in the assocData hash table which is
|
||||
* associated with an interpreter. The entry contains a pointer to a function
|
||||
@@ -1450,12 +1465,8 @@ struct CompileEnv;
|
||||
* reporting is deferred until the actual runtime,
|
||||
* because by then changes in the interp state may allow
|
||||
* the command to be successfully evaluated.
|
||||
* TCL_OUT_LINE_COMPILE A source-compatible alias for TCL_ERROR, kept for the
|
||||
* sake of old code only.
|
||||
*/
|
||||
|
||||
#define TCL_OUT_LINE_COMPILE TCL_ERROR
|
||||
|
||||
typedef int (CompileProc)(Tcl_Interp *interp, Tcl_Parse *parsePtr,
|
||||
struct Command *cmdPtr, struct CompileEnv *compEnvPtr);
|
||||
|
||||
@@ -2617,7 +2628,7 @@ typedef struct ListRep {
|
||||
* converted to a list.
|
||||
*/
|
||||
#define TclListObjGetElementsM(interp_, listObj_, objcPtr_, objvPtr_) \
|
||||
(((listObj_)->typePtr == &tclListType) \
|
||||
(((listObj_)->typePtr == &tclListType.objType) \
|
||||
? ((ListObjGetElements((listObj_), *(objcPtr_), *(objvPtr_))), \
|
||||
TCL_OK) \
|
||||
: Tcl_ListObjGetElements( \
|
||||
@@ -2629,12 +2640,12 @@ typedef struct ListRep {
|
||||
* Tcl_Obj cannot be converted to a list.
|
||||
*/
|
||||
#define TclListObjLengthM(interp_, listObj_, lenPtr_) \
|
||||
(((listObj_)->typePtr == &tclListType) \
|
||||
(((listObj_)->typePtr == &tclListType.objType) \
|
||||
? ((ListObjLength((listObj_), *(lenPtr_))), TCL_OK) \
|
||||
: Tcl_ListObjLength((interp_), (listObj_), (lenPtr_)))
|
||||
|
||||
#define TclListObjIsCanonical(listObj_) \
|
||||
(((listObj_)->typePtr == &tclListType) ? ListObjIsCanonical((listObj_)) : 0)
|
||||
(((listObj_)->typePtr == &tclListType.objType) ? ListObjIsCanonical((listObj_)) : 0)
|
||||
|
||||
/*
|
||||
* Modes for collecting (or not) in the implementations of TclNRForeachCmd,
|
||||
@@ -2654,27 +2665,27 @@ typedef struct ListRep {
|
||||
|
||||
#if TCL_MAJOR_VERSION > 8
|
||||
#define TclGetBooleanFromObj(interp, objPtr, intPtr) \
|
||||
(((objPtr)->typePtr == &tclIntType \
|
||||
|| (objPtr)->typePtr == &tclBooleanType) \
|
||||
(((objPtr)->typePtr == &tclIntType.objType \
|
||||
|| (objPtr)->typePtr == &tclBooleanType.objType) \
|
||||
? (*(intPtr) = ((objPtr)->internalRep.wideValue!=0), TCL_OK) \
|
||||
: Tcl_GetBooleanFromObj((interp), (objPtr), (intPtr)))
|
||||
#else
|
||||
#define TclGetBooleanFromObj(interp, objPtr, intPtr) \
|
||||
(((objPtr)->typePtr == &tclIntType) \
|
||||
(((objPtr)->typePtr == &tclIntType.objType) \
|
||||
? (*(intPtr) = ((objPtr)->internalRep.wideValue!=0), TCL_OK) \
|
||||
: ((objPtr)->typePtr == &tclBooleanType) \
|
||||
: ((objPtr)->typePtr == &tclBooleanType.objType) \
|
||||
? (*(intPtr) = ((objPtr)->internalRep.longValue!=0), TCL_OK) \
|
||||
: Tcl_GetBooleanFromObj((interp), (objPtr), (intPtr)))
|
||||
#endif
|
||||
|
||||
#ifdef TCL_WIDE_INT_IS_LONG
|
||||
#define TclGetLongFromObj(interp, objPtr, longPtr) \
|
||||
(((objPtr)->typePtr == &tclIntType) \
|
||||
(((objPtr)->typePtr == &tclIntType.objType) \
|
||||
? ((*(longPtr) = (objPtr)->internalRep.wideValue), TCL_OK) \
|
||||
: Tcl_GetLongFromObj((interp), (objPtr), (longPtr)))
|
||||
#else
|
||||
#define TclGetLongFromObj(interp, objPtr, longPtr) \
|
||||
(((objPtr)->typePtr == &tclIntType \
|
||||
(((objPtr)->typePtr == &tclIntType.objType \
|
||||
&& (objPtr)->internalRep.wideValue >= (Tcl_WideInt)(LONG_MIN) \
|
||||
&& (objPtr)->internalRep.wideValue <= (Tcl_WideInt)(LONG_MAX)) \
|
||||
? ((*(longPtr) = (long)(objPtr)->internalRep.wideValue), TCL_OK) \
|
||||
@@ -2682,13 +2693,13 @@ typedef struct ListRep {
|
||||
#endif
|
||||
|
||||
#define TclGetIntFromObj(interp, objPtr, intPtr) \
|
||||
(((objPtr)->typePtr == &tclIntType \
|
||||
(((objPtr)->typePtr == &tclIntType.objType \
|
||||
&& (objPtr)->internalRep.wideValue >= (Tcl_WideInt)(INT_MIN) \
|
||||
&& (objPtr)->internalRep.wideValue <= (Tcl_WideInt)(INT_MAX)) \
|
||||
? ((*(intPtr) = (int)(objPtr)->internalRep.wideValue), TCL_OK) \
|
||||
: Tcl_GetIntFromObj((interp), (objPtr), (intPtr)))
|
||||
#define TclGetIntForIndexM(interp, objPtr, endValue, idxPtr) \
|
||||
((((objPtr)->typePtr == &tclIntType) && ((objPtr)->internalRep.wideValue >= 0) \
|
||||
((((objPtr)->typePtr == &tclIntType.objType) && ((objPtr)->internalRep.wideValue >= 0) \
|
||||
&& ((Tcl_WideUInt)(objPtr)->internalRep.wideValue <= (Tcl_WideUInt)(endValue + 1))) \
|
||||
? ((*(idxPtr) = (objPtr)->internalRep.wideValue), TCL_OK) \
|
||||
: Tcl_GetIntForIndex((interp), (objPtr), (endValue), (idxPtr)))
|
||||
@@ -2702,7 +2713,7 @@ typedef struct ListRep {
|
||||
*/
|
||||
|
||||
#define TclGetWideIntFromObj(interp, objPtr, wideIntPtr) \
|
||||
(((objPtr)->typePtr == &tclIntType) \
|
||||
(((objPtr)->typePtr == &tclIntType.objType) \
|
||||
? (*(wideIntPtr) = \
|
||||
((objPtr)->internalRep.wideValue), TCL_OK) : \
|
||||
Tcl_GetWideIntFromObj((interp), (objPtr), (wideIntPtr)))
|
||||
@@ -2865,7 +2876,19 @@ MODULE_SCOPE int tclFindExecutableSearchDone;
|
||||
MODULE_SCOPE char *tclMemDumpFileName;
|
||||
MODULE_SCOPE TclPlatformType tclPlatform;
|
||||
|
||||
/*
|
||||
* Declarations related to internal encoding functions.
|
||||
*/
|
||||
|
||||
MODULE_SCOPE Tcl_Encoding tclIdentityEncoding;
|
||||
MODULE_SCOPE int
|
||||
TclEncodingProfileNameToId(Tcl_Interp *interp,
|
||||
const char *profileName,
|
||||
int *profilePtr);
|
||||
MODULE_SCOPE const char *TclEncodingProfileIdToName(Tcl_Interp *interp,
|
||||
int profileId);
|
||||
MODULE_SCOPE int TclEncodingSetProfileFlags(int flags);
|
||||
MODULE_SCOPE void TclGetEncodingProfiles(Tcl_Interp *interp);
|
||||
|
||||
/*
|
||||
* TIP #233 (Virtualized Time)
|
||||
@@ -2880,13 +2903,13 @@ MODULE_SCOPE void *tclTimeClientData;
|
||||
* Variables denoting the Tcl object types defined in the core.
|
||||
*/
|
||||
|
||||
MODULE_SCOPE const Tcl_ObjType tclBignumType;
|
||||
MODULE_SCOPE const Tcl_ObjType tclBooleanType;
|
||||
MODULE_SCOPE const TclObjTypeWithAbstractList tclBignumType;
|
||||
MODULE_SCOPE const TclObjTypeWithAbstractList tclBooleanType;
|
||||
MODULE_SCOPE const Tcl_ObjType tclByteCodeType;
|
||||
MODULE_SCOPE const Tcl_ObjType tclDoubleType;
|
||||
MODULE_SCOPE const Tcl_ObjType tclIntType;
|
||||
MODULE_SCOPE const Tcl_ObjType tclListType;
|
||||
MODULE_SCOPE const Tcl_ObjType tclArithSeriesType;
|
||||
MODULE_SCOPE const TclObjTypeWithAbstractList tclDoubleType;
|
||||
MODULE_SCOPE const TclObjTypeWithAbstractList tclIntType;
|
||||
MODULE_SCOPE const TclObjTypeWithAbstractList tclListType;
|
||||
MODULE_SCOPE const TclObjTypeWithAbstractList tclArithSeriesType;
|
||||
MODULE_SCOPE const Tcl_ObjType tclDictType;
|
||||
MODULE_SCOPE const Tcl_ObjType tclProcBodyType;
|
||||
MODULE_SCOPE const Tcl_ObjType tclStringType;
|
||||
@@ -3031,12 +3054,12 @@ struct Tcl_LoadHandle_ {
|
||||
|
||||
#if TCL_MAJOR_VERSION > 8
|
||||
MODULE_SCOPE void TclAppendBytesToByteArray(Tcl_Obj *objPtr,
|
||||
const unsigned char *bytes, size_t len);
|
||||
const unsigned char *bytes, Tcl_Size len);
|
||||
MODULE_SCOPE int TclNREvalCmd(Tcl_Interp *interp, Tcl_Obj *objPtr,
|
||||
int flags);
|
||||
MODULE_SCOPE void TclAdvanceContinuations(size_t *line, int **next,
|
||||
MODULE_SCOPE void TclAdvanceContinuations(Tcl_Size *line, int **next,
|
||||
int loc);
|
||||
MODULE_SCOPE void TclAdvanceLines(size_t *line, const char *start,
|
||||
MODULE_SCOPE void TclAdvanceLines(Tcl_Size *line, const char *start,
|
||||
const char *end);
|
||||
MODULE_SCOPE void TclArgumentEnter(Tcl_Interp *interp,
|
||||
Tcl_Obj *objv[], int objc, CmdFrame *cf);
|
||||
@@ -3044,7 +3067,7 @@ MODULE_SCOPE void TclArgumentRelease(Tcl_Interp *interp,
|
||||
Tcl_Obj *objv[], int objc);
|
||||
MODULE_SCOPE void TclArgumentBCEnter(Tcl_Interp *interp,
|
||||
Tcl_Obj *objv[], int objc,
|
||||
void *codePtr, CmdFrame *cfPtr, int cmd, size_t pc);
|
||||
void *codePtr, CmdFrame *cfPtr, int cmd, Tcl_Size pc);
|
||||
MODULE_SCOPE void TclArgumentBCRelease(Tcl_Interp *interp,
|
||||
CmdFrame *cfPtr);
|
||||
MODULE_SCOPE void TclArgumentGet(Tcl_Interp *interp, Tcl_Obj *obj,
|
||||
@@ -3054,8 +3077,8 @@ MODULE_SCOPE int TclAsyncNotifier(int sigNumber, Tcl_ThreadId threadId,
|
||||
MODULE_SCOPE void TclAsyncMarkFromNotifier(void);
|
||||
MODULE_SCOPE double TclBignumToDouble(const void *bignum);
|
||||
MODULE_SCOPE int TclByteArrayMatch(const unsigned char *string,
|
||||
size_t strLen, const unsigned char *pattern,
|
||||
size_t ptnLen, int flags);
|
||||
Tcl_Size strLen, const unsigned char *pattern,
|
||||
Tcl_Size ptnLen, int flags);
|
||||
MODULE_SCOPE double TclCeil(const void *a);
|
||||
MODULE_SCOPE void TclChannelPreserve(Tcl_Channel chan);
|
||||
MODULE_SCOPE void TclChannelRelease(Tcl_Channel chan);
|
||||
@@ -3068,14 +3091,14 @@ MODULE_SCOPE Tcl_ObjCmdProc TclChannelNamesCmd;
|
||||
MODULE_SCOPE Tcl_NRPostProc TclClearRootEnsemble;
|
||||
MODULE_SCOPE int TclCompareTwoNumbers(Tcl_Obj *valuePtr,
|
||||
Tcl_Obj *value2Ptr);
|
||||
MODULE_SCOPE ContLineLoc *TclContinuationsEnter(Tcl_Obj *objPtr, size_t num,
|
||||
MODULE_SCOPE ContLineLoc *TclContinuationsEnter(Tcl_Obj *objPtr, Tcl_Size num,
|
||||
int *loc);
|
||||
MODULE_SCOPE void TclContinuationsEnterDerived(Tcl_Obj *objPtr,
|
||||
int start, int *clNext);
|
||||
MODULE_SCOPE ContLineLoc *TclContinuationsGet(Tcl_Obj *objPtr);
|
||||
MODULE_SCOPE void TclContinuationsCopy(Tcl_Obj *objPtr,
|
||||
Tcl_Obj *originObjPtr);
|
||||
MODULE_SCOPE size_t TclConvertElement(const char *src, size_t length,
|
||||
MODULE_SCOPE Tcl_Size TclConvertElement(const char *src, Tcl_Size length,
|
||||
char *dst, int flags);
|
||||
MODULE_SCOPE Tcl_Command TclCreateObjCommandInNs(Tcl_Interp *interp,
|
||||
const char *cmdName, Tcl_Namespace *nsPtr,
|
||||
@@ -3087,12 +3110,12 @@ MODULE_SCOPE Tcl_Command TclCreateEnsembleInNs(Tcl_Interp *interp,
|
||||
MODULE_SCOPE void TclDeleteNamespaceVars(Namespace *nsPtr);
|
||||
MODULE_SCOPE void TclDeleteNamespaceChildren(Namespace *nsPtr);
|
||||
MODULE_SCOPE int TclFindDictElement(Tcl_Interp *interp,
|
||||
const char *dict, size_t dictLength,
|
||||
const char *dict, Tcl_Size dictLength,
|
||||
const char **elementPtr, const char **nextPtr,
|
||||
size_t *sizePtr, int *literalPtr);
|
||||
Tcl_Size *sizePtr, int *literalPtr);
|
||||
/* TIP #280 - Modified token based evaluation, with line information. */
|
||||
MODULE_SCOPE int TclEvalEx(Tcl_Interp *interp, const char *script,
|
||||
size_t numBytes, int flags, size_t line,
|
||||
Tcl_Size numBytes, int flags, Tcl_Size line,
|
||||
int *clNextOuter, const char *outerScript);
|
||||
MODULE_SCOPE Tcl_ObjCmdProc TclFileAttrsCmd;
|
||||
MODULE_SCOPE Tcl_ObjCmdProc TclFileCopyCmd;
|
||||
@@ -3113,9 +3136,8 @@ MODULE_SCOPE char * TclDStringAppendObj(Tcl_DString *dsPtr,
|
||||
Tcl_Obj *objPtr);
|
||||
MODULE_SCOPE char * TclDStringAppendDString(Tcl_DString *dsPtr,
|
||||
Tcl_DString *toAppendPtr);
|
||||
MODULE_SCOPE Tcl_Obj * TclDStringToObj(Tcl_DString *dsPtr);
|
||||
MODULE_SCOPE Tcl_Obj *const *TclFetchEnsembleRoot(Tcl_Interp *interp,
|
||||
Tcl_Obj *const *objv, size_t objc, size_t *objcPtr);
|
||||
Tcl_Obj *const *objv, Tcl_Size objc, Tcl_Size *objcPtr);
|
||||
MODULE_SCOPE Tcl_Obj *const *TclEnsembleGetRewriteValues(Tcl_Interp *interp);
|
||||
MODULE_SCOPE Tcl_Namespace *TclEnsureNamespace(Tcl_Interp *interp,
|
||||
Tcl_Namespace *namespacePtr);
|
||||
@@ -3169,7 +3191,7 @@ MODULE_SCOPE Tcl_Obj * TclGetProcessGlobalValue(ProcessGlobalValue *pgvPtr);
|
||||
MODULE_SCOPE Tcl_Obj * TclGetSourceFromFrame(CmdFrame *cfPtr, int objc,
|
||||
Tcl_Obj *const objv[]);
|
||||
MODULE_SCOPE char * TclGetStringStorage(Tcl_Obj *objPtr,
|
||||
TCL_HASH_TYPE *sizePtr);
|
||||
Tcl_Size *sizePtr);
|
||||
MODULE_SCOPE int TclGetLoadedLibraries(Tcl_Interp *interp,
|
||||
const char *targetName,
|
||||
const char *packageName);
|
||||
@@ -3199,7 +3221,7 @@ MODULE_SCOPE void TclInitObjSubsystem(void);
|
||||
MODULE_SCOPE int TclInterpReady(Tcl_Interp *interp);
|
||||
MODULE_SCOPE int TclIsDigitProc(int byte);
|
||||
MODULE_SCOPE int TclIsBareword(int byte);
|
||||
MODULE_SCOPE Tcl_Obj * TclJoinPath(size_t elements, Tcl_Obj * const objv[],
|
||||
MODULE_SCOPE Tcl_Obj * TclJoinPath(Tcl_Size elements, Tcl_Obj * const objv[],
|
||||
int forceRelative);
|
||||
MODULE_SCOPE int MakeTildeRelativePath(Tcl_Interp *interp, const char *user,
|
||||
const char *subPath, Tcl_DString *dsPtr);
|
||||
@@ -3212,30 +3234,29 @@ MODULE_SCOPE void TclLimitRemoveAllHandlers(Tcl_Interp *interp);
|
||||
MODULE_SCOPE Tcl_Obj * TclLindexList(Tcl_Interp *interp,
|
||||
Tcl_Obj *listPtr, Tcl_Obj *argPtr);
|
||||
MODULE_SCOPE Tcl_Obj * TclLindexFlat(Tcl_Interp *interp, Tcl_Obj *listPtr,
|
||||
size_t indexCount, Tcl_Obj *const indexArray[]);
|
||||
Tcl_Size indexCount, Tcl_Obj *const indexArray[]);
|
||||
/* TIP #280 */
|
||||
MODULE_SCOPE void TclListLines(Tcl_Obj *listObj, size_t line, int n,
|
||||
MODULE_SCOPE void TclListLines(Tcl_Obj *listObj, Tcl_Size line, int n,
|
||||
int *lines, Tcl_Obj *const *elems);
|
||||
MODULE_SCOPE Tcl_Obj * TclListObjCopy(Tcl_Interp *interp, Tcl_Obj *listPtr);
|
||||
MODULE_SCOPE int TclListObjAppendElements(Tcl_Interp *interp,
|
||||
Tcl_Obj *toObj, size_t elemCount,
|
||||
Tcl_Obj *toObj, Tcl_Size elemCount,
|
||||
Tcl_Obj *const elemObjv[]);
|
||||
MODULE_SCOPE Tcl_Obj * TclListObjRange(Tcl_Obj *listPtr, size_t fromIdx,
|
||||
size_t toIdx);
|
||||
MODULE_SCOPE Tcl_Obj * TclListObjRange(Tcl_Obj *listPtr, Tcl_Size fromIdx,
|
||||
Tcl_Size toIdx);
|
||||
MODULE_SCOPE Tcl_Obj * TclLsetList(Tcl_Interp *interp, Tcl_Obj *listPtr,
|
||||
Tcl_Obj *indexPtr, Tcl_Obj *valuePtr);
|
||||
MODULE_SCOPE Tcl_Obj * TclLsetFlat(Tcl_Interp *interp, Tcl_Obj *listPtr,
|
||||
size_t indexCount, Tcl_Obj *const indexArray[],
|
||||
Tcl_Size indexCount, Tcl_Obj *const indexArray[],
|
||||
Tcl_Obj *valuePtr);
|
||||
MODULE_SCOPE Tcl_Command TclMakeEnsemble(Tcl_Interp *interp, const char *name,
|
||||
const EnsembleImplMap map[]);
|
||||
MODULE_SCOPE int TclMakeSafe(Tcl_Interp *interp);
|
||||
MODULE_SCOPE int TclMaxListLength(const char *bytes, size_t numBytes,
|
||||
MODULE_SCOPE Tcl_Size TclMaxListLength(const char *bytes, Tcl_Size numBytes,
|
||||
const char **endPtr);
|
||||
MODULE_SCOPE int TclMergeReturnOptions(Tcl_Interp *interp, int objc,
|
||||
Tcl_Obj *const objv[], Tcl_Obj **optionsPtrPtr,
|
||||
int *codePtr, int *levelPtr);
|
||||
MODULE_SCOPE Tcl_Obj * TclNarrowToBytes(Tcl_Obj *objPtr);
|
||||
MODULE_SCOPE Tcl_Obj * TclNoErrorStack(Tcl_Interp *interp, Tcl_Obj *options);
|
||||
MODULE_SCOPE int TclNokia770Doubles(void);
|
||||
MODULE_SCOPE void TclNsDecrRefCount(Namespace *nsPtr);
|
||||
@@ -3249,15 +3270,15 @@ MODULE_SCOPE int TclObjInvokeNamespace(Tcl_Interp *interp,
|
||||
MODULE_SCOPE int TclObjUnsetVar2(Tcl_Interp *interp,
|
||||
Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, int flags);
|
||||
MODULE_SCOPE int TclParseBackslash(const char *src,
|
||||
size_t numBytes, size_t *readPtr, char *dst);
|
||||
MODULE_SCOPE int TclParseHex(const char *src, size_t numBytes,
|
||||
Tcl_Size numBytes, Tcl_Size *readPtr, char *dst);
|
||||
MODULE_SCOPE int TclParseHex(const char *src, Tcl_Size numBytes,
|
||||
int *resultPtr);
|
||||
MODULE_SCOPE int TclParseNumber(Tcl_Interp *interp, Tcl_Obj *objPtr,
|
||||
const char *expected, const char *bytes,
|
||||
size_t numBytes, const char **endPtrPtr, int flags);
|
||||
Tcl_Size numBytes, const char **endPtrPtr, int flags);
|
||||
MODULE_SCOPE void TclParseInit(Tcl_Interp *interp, const char *string,
|
||||
size_t numBytes, Tcl_Parse *parsePtr);
|
||||
MODULE_SCOPE size_t TclParseAllWhiteSpace(const char *src, size_t numBytes);
|
||||
Tcl_Size numBytes, Tcl_Parse *parsePtr);
|
||||
MODULE_SCOPE Tcl_Size TclParseAllWhiteSpace(const char *src, Tcl_Size numBytes);
|
||||
MODULE_SCOPE int TclProcessReturn(Tcl_Interp *interp,
|
||||
int code, int level, Tcl_Obj *returnOpts);
|
||||
MODULE_SCOPE int TclpObjLstat(Tcl_Obj *pathPtr, Tcl_StatBuf *buf);
|
||||
@@ -3265,7 +3286,7 @@ MODULE_SCOPE Tcl_Obj * TclpTempFileName(void);
|
||||
MODULE_SCOPE Tcl_Obj * TclpTempFileNameForLibrary(Tcl_Interp *interp,
|
||||
Tcl_Obj* pathPtr);
|
||||
MODULE_SCOPE Tcl_Obj * TclNewFSPathObj(Tcl_Obj *dirPtr, const char *addStrRep,
|
||||
size_t len);
|
||||
Tcl_Size len);
|
||||
MODULE_SCOPE void TclpAlertNotifier(void *clientData);
|
||||
MODULE_SCOPE void *TclpNotifierData(void);
|
||||
MODULE_SCOPE void TclpServiceModeHook(int mode);
|
||||
@@ -3291,10 +3312,10 @@ MODULE_SCOPE int TclCreateSocketAddress(Tcl_Interp *interp,
|
||||
const char **errorMsgPtr);
|
||||
MODULE_SCOPE int TclpThreadCreate(Tcl_ThreadId *idPtr,
|
||||
Tcl_ThreadCreateProc *proc, void *clientData,
|
||||
size_t stackSize, int flags);
|
||||
MODULE_SCOPE size_t TclpFindVariable(const char *name, size_t *lengthPtr);
|
||||
Tcl_Size stackSize, int flags);
|
||||
MODULE_SCOPE Tcl_Size TclpFindVariable(const char *name, Tcl_Size *lengthPtr);
|
||||
MODULE_SCOPE void TclpInitLibraryPath(char **valuePtr,
|
||||
TCL_HASH_TYPE *lengthPtr, Tcl_Encoding *encodingPtr);
|
||||
Tcl_Size *lengthPtr, Tcl_Encoding *encodingPtr);
|
||||
MODULE_SCOPE void TclpInitLock(void);
|
||||
MODULE_SCOPE void *TclpInitNotifier(void);
|
||||
MODULE_SCOPE void TclpInitPlatform(void);
|
||||
@@ -3307,9 +3328,9 @@ MODULE_SCOPE int TclpMatchFiles(Tcl_Interp *interp, char *separators,
|
||||
MODULE_SCOPE int TclpObjNormalizePath(Tcl_Interp *interp,
|
||||
Tcl_Obj *pathPtr, int nextCheckpoint);
|
||||
MODULE_SCOPE void TclpNativeJoinPath(Tcl_Obj *prefix, const char *joining);
|
||||
MODULE_SCOPE Tcl_Obj * TclpNativeSplitPath(Tcl_Obj *pathPtr, size_t *lenPtr);
|
||||
MODULE_SCOPE Tcl_Obj * TclpNativeSplitPath(Tcl_Obj *pathPtr, Tcl_Size *lenPtr);
|
||||
MODULE_SCOPE Tcl_PathType TclpGetNativePathType(Tcl_Obj *pathPtr,
|
||||
size_t *driveNameLengthPtr, Tcl_Obj **driveNameRef);
|
||||
Tcl_Size *driveNameLengthPtr, Tcl_Obj **driveNameRef);
|
||||
MODULE_SCOPE int TclCrossFilesystemCopy(Tcl_Interp *interp,
|
||||
Tcl_Obj *source, Tcl_Obj *target);
|
||||
MODULE_SCOPE int TclpMatchInDirectory(Tcl_Interp *interp,
|
||||
@@ -3340,9 +3361,9 @@ MODULE_SCOPE void TclRememberJoinableThread(Tcl_ThreadId id);
|
||||
MODULE_SCOPE void TclRememberMutex(Tcl_Mutex *mutex);
|
||||
MODULE_SCOPE void TclRemoveScriptLimitCallbacks(Tcl_Interp *interp);
|
||||
MODULE_SCOPE int TclReToGlob(Tcl_Interp *interp, const char *reStr,
|
||||
size_t reStrLen, Tcl_DString *dsPtr, int *flagsPtr,
|
||||
Tcl_Size reStrLen, Tcl_DString *dsPtr, int *flagsPtr,
|
||||
int *quantifiersFoundPtr);
|
||||
MODULE_SCOPE TCL_HASH_TYPE TclScanElement(const char *string, size_t length,
|
||||
MODULE_SCOPE Tcl_Size TclScanElement(const char *string, Tcl_Size length,
|
||||
char *flagPtr);
|
||||
MODULE_SCOPE void TclSetBgErrorHandler(Tcl_Interp *interp,
|
||||
Tcl_Obj *cmdPrefix);
|
||||
@@ -3357,44 +3378,44 @@ MODULE_SCOPE void TclSetProcessGlobalValue(ProcessGlobalValue *pgvPtr,
|
||||
Tcl_Obj *newValue, Tcl_Encoding encoding);
|
||||
MODULE_SCOPE void TclSignalExitThread(Tcl_ThreadId id, int result);
|
||||
MODULE_SCOPE void TclSpellFix(Tcl_Interp *interp,
|
||||
Tcl_Obj *const *objv, size_t objc, size_t subIdx,
|
||||
Tcl_Obj *const *objv, Tcl_Size objc, Tcl_Size subIdx,
|
||||
Tcl_Obj *bad, Tcl_Obj *fix);
|
||||
MODULE_SCOPE void * TclStackRealloc(Tcl_Interp *interp, void *ptr,
|
||||
size_t numBytes);
|
||||
Tcl_Size numBytes);
|
||||
typedef int (*memCmpFn_t)(const void*, const void*, size_t);
|
||||
MODULE_SCOPE int TclStringCmp(Tcl_Obj *value1Ptr, Tcl_Obj *value2Ptr,
|
||||
int checkEq, int nocase, size_t reqlength);
|
||||
int checkEq, int nocase, Tcl_Size reqlength);
|
||||
MODULE_SCOPE int TclStringCmpOpts(Tcl_Interp *interp, int objc,
|
||||
Tcl_Obj *const objv[], int *nocase,
|
||||
int *reqlength);
|
||||
MODULE_SCOPE int TclStringMatch(const char *str, size_t strLen,
|
||||
MODULE_SCOPE int TclStringMatch(const char *str, Tcl_Size strLen,
|
||||
const char *pattern, int ptnLen, int flags);
|
||||
MODULE_SCOPE int TclStringMatchObj(Tcl_Obj *stringObj,
|
||||
Tcl_Obj *patternObj, int flags);
|
||||
MODULE_SCOPE void TclSubstCompile(Tcl_Interp *interp, const char *bytes,
|
||||
size_t numBytes, int flags, size_t line,
|
||||
Tcl_Size numBytes, int flags, Tcl_Size line,
|
||||
struct CompileEnv *envPtr);
|
||||
MODULE_SCOPE int TclSubstOptions(Tcl_Interp *interp, size_t numOpts,
|
||||
MODULE_SCOPE int TclSubstOptions(Tcl_Interp *interp, Tcl_Size numOpts,
|
||||
Tcl_Obj *const opts[], int *flagPtr);
|
||||
MODULE_SCOPE void TclSubstParse(Tcl_Interp *interp, const char *bytes,
|
||||
size_t numBytes, int flags, Tcl_Parse *parsePtr,
|
||||
Tcl_Size numBytes, int flags, Tcl_Parse *parsePtr,
|
||||
Tcl_InterpState *statePtr);
|
||||
MODULE_SCOPE int TclSubstTokens(Tcl_Interp *interp, Tcl_Token *tokenPtr,
|
||||
size_t count, int *tokensLeftPtr, size_t line,
|
||||
Tcl_Size count, int *tokensLeftPtr, Tcl_Size line,
|
||||
int *clNextOuter, const char *outerScript);
|
||||
MODULE_SCOPE size_t TclTrim(const char *bytes, size_t numBytes,
|
||||
const char *trim, size_t numTrim, size_t *trimRight);
|
||||
MODULE_SCOPE size_t TclTrimLeft(const char *bytes, size_t numBytes,
|
||||
const char *trim, size_t numTrim);
|
||||
MODULE_SCOPE size_t TclTrimRight(const char *bytes, size_t numBytes,
|
||||
const char *trim, size_t numTrim);
|
||||
MODULE_SCOPE Tcl_Size TclTrim(const char *bytes, Tcl_Size numBytes,
|
||||
const char *trim, Tcl_Size numTrim, Tcl_Size *trimRight);
|
||||
MODULE_SCOPE Tcl_Size TclTrimLeft(const char *bytes, Tcl_Size numBytes,
|
||||
const char *trim, Tcl_Size numTrim);
|
||||
MODULE_SCOPE Tcl_Size TclTrimRight(const char *bytes, Tcl_Size numBytes,
|
||||
const char *trim, Tcl_Size numTrim);
|
||||
MODULE_SCOPE const char*TclGetCommandTypeName(Tcl_Command command);
|
||||
MODULE_SCOPE void TclRegisterCommandTypeName(
|
||||
Tcl_ObjCmdProc *implementationProc,
|
||||
const char *nameStr);
|
||||
MODULE_SCOPE int TclUtfCmp(const char *cs, const char *ct);
|
||||
MODULE_SCOPE int TclUtfCasecmp(const char *cs, const char *ct);
|
||||
MODULE_SCOPE size_t TclUtfCount(int ch);
|
||||
MODULE_SCOPE Tcl_Size TclUtfCount(int ch);
|
||||
#if TCL_UTF_MAX > 3
|
||||
# define TclUtfToUCS4 Tcl_UtfToUniChar
|
||||
# define TclUniCharToUCS4(src, ptr) (*ptr = *(src),1)
|
||||
@@ -3441,7 +3462,7 @@ MODULE_SCOPE void TclpThreadDeleteKey(void *keyPtr);
|
||||
MODULE_SCOPE void TclpThreadSetGlobalTSD(void *tsdKeyPtr, void *ptr);
|
||||
MODULE_SCOPE void * TclpThreadGetGlobalTSD(void *tsdKeyPtr);
|
||||
MODULE_SCOPE void TclErrorStackResetIf(Tcl_Interp *interp,
|
||||
const char *msg, size_t length);
|
||||
const char *msg, Tcl_Size length);
|
||||
/* Tip 430 */
|
||||
MODULE_SCOPE int TclZipfs_Init(Tcl_Interp *interp);
|
||||
|
||||
@@ -3490,7 +3511,7 @@ MODULE_SCOPE int TclDictWithFinish(Tcl_Interp *interp, Var *varPtr,
|
||||
Tcl_Obj *part2Ptr, int index, int pathc,
|
||||
Tcl_Obj *const pathv[], Tcl_Obj *keysPtr);
|
||||
MODULE_SCOPE Tcl_Obj * TclDictWithInit(Tcl_Interp *interp, Tcl_Obj *dictPtr,
|
||||
size_t pathc, Tcl_Obj *const pathv[]);
|
||||
Tcl_Size pathc, Tcl_Obj *const pathv[]);
|
||||
MODULE_SCOPE Tcl_ObjCmdProc Tcl_DisassembleObjCmd;
|
||||
|
||||
/* Assemble command function */
|
||||
@@ -4016,13 +4037,13 @@ MODULE_SCOPE int TclCompileAssembleCmd(Tcl_Interp *interp,
|
||||
MODULE_SCOPE Tcl_Obj * TclStringCat(Tcl_Interp *interp, int objc,
|
||||
Tcl_Obj *const objv[], int flags);
|
||||
MODULE_SCOPE Tcl_Obj * TclStringFirst(Tcl_Obj *needle, Tcl_Obj *haystack,
|
||||
size_t start);
|
||||
Tcl_Size start);
|
||||
MODULE_SCOPE Tcl_Obj * TclStringLast(Tcl_Obj *needle, Tcl_Obj *haystack,
|
||||
size_t last);
|
||||
Tcl_Size last);
|
||||
MODULE_SCOPE Tcl_Obj * TclStringRepeat(Tcl_Interp *interp, Tcl_Obj *objPtr,
|
||||
size_t count, int flags);
|
||||
Tcl_Size count, int flags);
|
||||
MODULE_SCOPE Tcl_Obj * TclStringReplace(Tcl_Interp *interp, Tcl_Obj *objPtr,
|
||||
size_t first, size_t count, Tcl_Obj *insertPtr,
|
||||
Tcl_Size first, Tcl_Size count, Tcl_Obj *insertPtr,
|
||||
int flags);
|
||||
MODULE_SCOPE Tcl_Obj * TclStringReverse(Tcl_Obj *objPtr, int flags);
|
||||
|
||||
@@ -4149,8 +4170,8 @@ MODULE_SCOPE Tcl_Obj * TclGetArrayDefault(Var *arrayPtr);
|
||||
*/
|
||||
|
||||
MODULE_SCOPE int TclIndexEncode(Tcl_Interp *interp, Tcl_Obj *objPtr,
|
||||
size_t before, size_t after, int *indexPtr);
|
||||
MODULE_SCOPE size_t TclIndexDecode(int encoded, size_t endValue);
|
||||
Tcl_Size before, Tcl_Size after, int *indexPtr);
|
||||
MODULE_SCOPE Tcl_Size TclIndexDecode(int encoded, Tcl_Size endValue);
|
||||
#endif /* TCL_MAJOR_VERSION > 8 */
|
||||
|
||||
/* Constants used in index value encoding routines. */
|
||||
@@ -4740,6 +4761,8 @@ MODULE_SCOPE Tcl_LibraryInitProc TclThread_Init;
|
||||
MODULE_SCOPE Tcl_LibraryInitProc Procbodytest_Init;
|
||||
MODULE_SCOPE Tcl_LibraryInitProc Procbodytest_SafeInit;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------
|
||||
* Macro used by the Tcl core to check whether a pattern has any characters
|
||||
@@ -4769,7 +4792,7 @@ MODULE_SCOPE Tcl_LibraryInitProc Procbodytest_SafeInit;
|
||||
Tcl_ObjInternalRep ir; \
|
||||
ir.wideValue = (Tcl_WideInt) i; \
|
||||
TclInvalidateStringRep(objPtr); \
|
||||
Tcl_StoreInternalRep(objPtr, &tclIntType, &ir); \
|
||||
Tcl_StoreInternalRep(objPtr, &tclIntType.objType, &ir); \
|
||||
} while (0)
|
||||
|
||||
#define TclSetDoubleObj(objPtr, d) \
|
||||
@@ -4777,7 +4800,7 @@ MODULE_SCOPE Tcl_LibraryInitProc Procbodytest_SafeInit;
|
||||
Tcl_ObjInternalRep ir; \
|
||||
ir.doubleValue = (double) d; \
|
||||
TclInvalidateStringRep(objPtr); \
|
||||
Tcl_StoreInternalRep(objPtr, &tclDoubleType, &ir); \
|
||||
Tcl_StoreInternalRep(objPtr, &tclDoubleType.objType, &ir); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
@@ -4802,7 +4825,7 @@ MODULE_SCOPE Tcl_LibraryInitProc Procbodytest_SafeInit;
|
||||
(objPtr)->refCount = 0; \
|
||||
(objPtr)->bytes = NULL; \
|
||||
(objPtr)->internalRep.wideValue = (Tcl_WideInt)(w); \
|
||||
(objPtr)->typePtr = &tclIntType; \
|
||||
(objPtr)->typePtr = &tclIntType.objType; \
|
||||
TCL_DTRACE_OBJ_CREATE(objPtr); \
|
||||
} while (0)
|
||||
|
||||
@@ -4821,7 +4844,7 @@ MODULE_SCOPE Tcl_LibraryInitProc Procbodytest_SafeInit;
|
||||
TclSetBignumInternalRep((objPtr), &bignumValue_); \
|
||||
} else { \
|
||||
(objPtr)->internalRep.wideValue = (Tcl_WideInt)(uw_); \
|
||||
(objPtr)->typePtr = &tclIntType; \
|
||||
(objPtr)->typePtr = &tclIntType.objType; \
|
||||
} \
|
||||
TCL_DTRACE_OBJ_CREATE(objPtr); \
|
||||
} while (0)
|
||||
@@ -4835,7 +4858,7 @@ MODULE_SCOPE Tcl_LibraryInitProc Procbodytest_SafeInit;
|
||||
Tcl_WideUInt uw_ = (uw); \
|
||||
if (uw_ >= TCL_INDEX_NONE) { \
|
||||
(objPtr)->internalRep.wideValue = -1; \
|
||||
(objPtr)->typePtr = &tclIntType; \
|
||||
(objPtr)->typePtr = &tclIntType.objType; \
|
||||
} else if (uw_ > WIDE_MAX) { \
|
||||
mp_int bignumValue_; \
|
||||
if (mp_init_u64(&bignumValue_, uw_) != MP_OKAY) { \
|
||||
@@ -4844,7 +4867,7 @@ MODULE_SCOPE Tcl_LibraryInitProc Procbodytest_SafeInit;
|
||||
TclSetBignumInternalRep((objPtr), &bignumValue_); \
|
||||
} else { \
|
||||
(objPtr)->internalRep.wideValue = (Tcl_WideInt)(uw_); \
|
||||
(objPtr)->typePtr = &tclIntType; \
|
||||
(objPtr)->typePtr = &tclIntType.objType; \
|
||||
} \
|
||||
TCL_DTRACE_OBJ_CREATE(objPtr); \
|
||||
} while (0)
|
||||
@@ -4856,7 +4879,7 @@ MODULE_SCOPE Tcl_LibraryInitProc Procbodytest_SafeInit;
|
||||
(objPtr)->refCount = 0; \
|
||||
(objPtr)->bytes = NULL; \
|
||||
(objPtr)->internalRep.doubleValue = (double)(d); \
|
||||
(objPtr)->typePtr = &tclDoubleType; \
|
||||
(objPtr)->typePtr = &tclDoubleType.objType; \
|
||||
TCL_DTRACE_OBJ_CREATE(objPtr); \
|
||||
} while (0)
|
||||
|
||||
@@ -4890,7 +4913,14 @@ MODULE_SCOPE Tcl_LibraryInitProc Procbodytest_SafeInit;
|
||||
} while (0)
|
||||
|
||||
#define TclNewIndexObj(objPtr, w) \
|
||||
(objPtr) = (((Tcl_WideUInt)w) >= TCL_INDEX_NONE) ? Tcl_NewWideIntObj(-1) : Tcl_NewWideIntObj(w)
|
||||
do { \
|
||||
Tcl_WideUInt _uw = (Tcl_WideUInt)(w); \
|
||||
if (_uw >= TCL_INDEX_NONE) { \
|
||||
TclNewIntObj(objPtr, -1); \
|
||||
} else { \
|
||||
TclNewUIntObj(objPtr, _uw); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define TclNewDoubleObj(objPtr, d) \
|
||||
(objPtr) = Tcl_NewDoubleObj(d)
|
||||
|
||||
@@ -578,8 +578,8 @@ EXTERN Tcl_Obj * TclpCreateTemporaryDirectory(Tcl_Obj *dirObj,
|
||||
Tcl_Obj *basenameObj);
|
||||
/* Slot 259 is reserved */
|
||||
/* 260 */
|
||||
EXTERN Tcl_Obj * TclListTestObj(int length, int leadingSpace,
|
||||
int endSpace);
|
||||
EXTERN Tcl_Obj * TclListTestObj(size_t length, size_t leadingSpace,
|
||||
size_t endSpace);
|
||||
/* 261 */
|
||||
EXTERN void TclListObjValidate(Tcl_Interp *interp,
|
||||
Tcl_Obj *listObj);
|
||||
@@ -848,7 +848,7 @@ typedef struct TclIntStubs {
|
||||
void (*tclStaticLibrary) (Tcl_Interp *interp, const char *prefix, Tcl_LibraryInitProc *initProc, Tcl_LibraryInitProc *safeInitProc); /* 257 */
|
||||
Tcl_Obj * (*tclpCreateTemporaryDirectory) (Tcl_Obj *dirObj, Tcl_Obj *basenameObj); /* 258 */
|
||||
void (*reserved259)(void);
|
||||
Tcl_Obj * (*tclListTestObj) (int length, int leadingSpace, int endSpace); /* 260 */
|
||||
Tcl_Obj * (*tclListTestObj) (size_t length, size_t leadingSpace, size_t endSpace); /* 260 */
|
||||
void (*tclListObjValidate) (Tcl_Interp *interp, Tcl_Obj *listObj); /* 261 */
|
||||
} TclIntStubs;
|
||||
|
||||
|
||||
@@ -140,8 +140,6 @@ EXTERN int TclWinSetSockOpt(SOCKET s, int level, int optname,
|
||||
EXTERN int TclpGetPid(Tcl_Pid pid);
|
||||
/* 9 */
|
||||
EXTERN int TclWinGetPlatformId(void);
|
||||
/* 10 */
|
||||
EXTERN Tcl_DirEntry * TclpReaddir(TclDIR *dir);
|
||||
/* 11 */
|
||||
EXTERN void TclGetAndDetachPids(Tcl_Interp *interp,
|
||||
Tcl_Channel chan);
|
||||
@@ -316,7 +314,7 @@ typedef struct TclIntPlatStubs {
|
||||
int (*tclWinSetSockOpt) (SOCKET s, int level, int optname, const char *optval, int optlen); /* 7 */
|
||||
int (*tclpGetPid) (Tcl_Pid pid); /* 8 */
|
||||
int (*tclWinGetPlatformId) (void); /* 9 */
|
||||
Tcl_DirEntry * (*tclpReaddir) (TclDIR *dir); /* 10 */
|
||||
void *(*tclpReaddir) (void *dir); /* 10 */
|
||||
void (*tclGetAndDetachPids) (Tcl_Interp *interp, Tcl_Channel chan); /* 11 */
|
||||
int (*tclpCloseFile) (TclFile file); /* 12 */
|
||||
Tcl_Channel (*tclpCreateCommandChannel) (TclFile readFile, TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr); /* 13 */
|
||||
@@ -462,8 +460,6 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr;
|
||||
(tclIntPlatStubsPtr->tclpGetPid) /* 8 */
|
||||
#define TclWinGetPlatformId \
|
||||
(tclIntPlatStubsPtr->tclWinGetPlatformId) /* 9 */
|
||||
#define TclpReaddir \
|
||||
(tclIntPlatStubsPtr->tclpReaddir) /* 10 */
|
||||
#define TclGetAndDetachPids \
|
||||
(tclIntPlatStubsPtr->tclGetAndDetachPids) /* 11 */
|
||||
#define TclpCloseFile \
|
||||
|
||||
+63
-63
@@ -60,7 +60,7 @@ typedef struct {
|
||||
Tcl_Obj *objPtr; /* The first actual prefix object - the target
|
||||
* command name; this has to be at the end of
|
||||
* the structure, which will be extended to
|
||||
* accomodate the remaining objects in the
|
||||
* accommodate the remaining objects in the
|
||||
* prefix. */
|
||||
} Alias;
|
||||
|
||||
@@ -186,7 +186,7 @@ struct LimitHandler {
|
||||
int flags; /* The state of this particular handler. */
|
||||
Tcl_LimitHandlerProc *handlerProc;
|
||||
/* The handler callback. */
|
||||
ClientData clientData; /* Opaque argument to the handler callback. */
|
||||
void *clientData; /* Opaque argument to the handler callback. */
|
||||
Tcl_LimitHandlerDeleteProc *deleteProc;
|
||||
/* How to delete the clientData. */
|
||||
LimitHandler *prevPtr; /* Previous item in linked list of
|
||||
@@ -265,12 +265,12 @@ static void InheritLimitsFromParent(Tcl_Interp *childInterp,
|
||||
Tcl_Interp *parentInterp);
|
||||
static void SetScriptLimitCallback(Tcl_Interp *interp, int type,
|
||||
Tcl_Interp *targetInterp, Tcl_Obj *scriptObj);
|
||||
static void CallScriptLimitCallback(ClientData clientData,
|
||||
static void CallScriptLimitCallback(void *clientData,
|
||||
Tcl_Interp *interp);
|
||||
static void DeleteScriptLimitCallback(ClientData clientData);
|
||||
static void DeleteScriptLimitCallback(void *clientData);
|
||||
static void RunLimitHandlers(LimitHandler *handlerPtr,
|
||||
Tcl_Interp *interp);
|
||||
static void TimeLimitCallback(ClientData clientData);
|
||||
static void TimeLimitCallback(void *clientData);
|
||||
|
||||
/* NRE enabling */
|
||||
static Tcl_NRPostProc NRPostInvokeHidden;
|
||||
@@ -339,7 +339,7 @@ Tcl_Init(
|
||||
pkgName.nextPtr = *names;
|
||||
*names = &pkgName;
|
||||
if (tclPreInitScript != NULL) {
|
||||
if (Tcl_EvalEx(interp, tclPreInitScript, -1, 0) == TCL_ERROR) {
|
||||
if (Tcl_EvalEx(interp, tclPreInitScript, TCL_INDEX_NONE, 0) == TCL_ERROR) {
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
@@ -449,7 +449,7 @@ Tcl_Init(
|
||||
" error $msg\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
"tclInit", -1, 0);
|
||||
"tclInit", TCL_INDEX_NONE, 0);
|
||||
|
||||
end:
|
||||
*names = (*names)->nextPtr;
|
||||
@@ -601,7 +601,7 @@ InterpInfoDeleteProc(
|
||||
|
||||
int
|
||||
Tcl_InterpObjCmd(
|
||||
ClientData clientData,
|
||||
void *clientData,
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
@@ -832,12 +832,12 @@ NRInterpCmd(
|
||||
for (i = 0; ; i++) {
|
||||
Tcl_CmdInfo cmdInfo;
|
||||
|
||||
sprintf(buf, "interp%d", i);
|
||||
snprintf(buf, sizeof(buf), "interp%d", i);
|
||||
if (Tcl_GetCommandInfo(interp, buf, &cmdInfo) == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
childPtr = Tcl_NewStringObj(buf, -1);
|
||||
childPtr = Tcl_NewStringObj(buf, TCL_INDEX_NONE);
|
||||
}
|
||||
if (ChildCreate(interp, childPtr, safe) == NULL) {
|
||||
if (buf[0] != '\0') {
|
||||
@@ -872,7 +872,7 @@ NRInterpCmd(
|
||||
return TCL_ERROR;
|
||||
} else if (childInterp == interp) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"cannot delete the current interpreter", -1));
|
||||
"cannot delete the current interpreter", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "INTERP",
|
||||
"DELETESELF", NULL);
|
||||
return TCL_ERROR;
|
||||
@@ -1053,7 +1053,7 @@ NRInterpCmd(
|
||||
for ( ; hPtr != NULL; hPtr = Tcl_NextHashEntry(&hashSearch)) {
|
||||
string = (char *)Tcl_GetHashKey(&iiPtr->parent.childTable, hPtr);
|
||||
Tcl_ListObjAppendElement(NULL, resultPtr,
|
||||
Tcl_NewStringObj(string, -1));
|
||||
Tcl_NewStringObj(string, TCL_INDEX_NONE));
|
||||
}
|
||||
Tcl_SetObjResult(interp, resultPtr);
|
||||
return TCL_OK;
|
||||
@@ -1197,7 +1197,7 @@ Tcl_CreateAlias(
|
||||
const char *childCmd, /* Command to install in child. */
|
||||
Tcl_Interp *targetInterp, /* Interpreter for target command. */
|
||||
const char *targetCmd, /* Name of target command. */
|
||||
size_t argc, /* How many additional arguments? */
|
||||
Tcl_Size argc, /* How many additional arguments? */
|
||||
const char *const *argv) /* These are the additional args. */
|
||||
{
|
||||
Tcl_Obj *childObjPtr, *targetObjPtr;
|
||||
@@ -1207,14 +1207,14 @@ Tcl_CreateAlias(
|
||||
|
||||
objv = (Tcl_Obj **)TclStackAlloc(childInterp, sizeof(Tcl_Obj *) * argc);
|
||||
for (i = 0; i < argc; i++) {
|
||||
objv[i] = Tcl_NewStringObj(argv[i], -1);
|
||||
objv[i] = Tcl_NewStringObj(argv[i], TCL_INDEX_NONE);
|
||||
Tcl_IncrRefCount(objv[i]);
|
||||
}
|
||||
|
||||
childObjPtr = Tcl_NewStringObj(childCmd, -1);
|
||||
childObjPtr = Tcl_NewStringObj(childCmd, TCL_INDEX_NONE);
|
||||
Tcl_IncrRefCount(childObjPtr);
|
||||
|
||||
targetObjPtr = Tcl_NewStringObj(targetCmd, -1);
|
||||
targetObjPtr = Tcl_NewStringObj(targetCmd, TCL_INDEX_NONE);
|
||||
Tcl_IncrRefCount(targetObjPtr);
|
||||
|
||||
result = AliasCreate(childInterp, childInterp, targetInterp, childObjPtr,
|
||||
@@ -1252,16 +1252,16 @@ Tcl_CreateAliasObj(
|
||||
const char *childCmd, /* Command to install in child. */
|
||||
Tcl_Interp *targetInterp, /* Interpreter for target command. */
|
||||
const char *targetCmd, /* Name of target command. */
|
||||
size_t objc, /* How many additional arguments? */
|
||||
Tcl_Size objc, /* How many additional arguments? */
|
||||
Tcl_Obj *const objv[]) /* Argument vector. */
|
||||
{
|
||||
Tcl_Obj *childObjPtr, *targetObjPtr;
|
||||
int result;
|
||||
|
||||
childObjPtr = Tcl_NewStringObj(childCmd, -1);
|
||||
childObjPtr = Tcl_NewStringObj(childCmd, TCL_INDEX_NONE);
|
||||
Tcl_IncrRefCount(childObjPtr);
|
||||
|
||||
targetObjPtr = Tcl_NewStringObj(targetCmd, -1);
|
||||
targetObjPtr = Tcl_NewStringObj(targetCmd, TCL_INDEX_NONE);
|
||||
Tcl_IncrRefCount(targetObjPtr);
|
||||
|
||||
result = AliasCreate(childInterp, childInterp, targetInterp, childObjPtr,
|
||||
@@ -1820,7 +1820,7 @@ AliasList(
|
||||
|
||||
static int
|
||||
AliasNRCmd(
|
||||
ClientData clientData, /* Alias record. */
|
||||
void *clientData, /* Alias record. */
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument vector. */
|
||||
@@ -1873,7 +1873,7 @@ AliasNRCmd(
|
||||
|
||||
int
|
||||
TclAliasObjCmd(
|
||||
ClientData clientData, /* Alias record. */
|
||||
void *clientData, /* Alias record. */
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument vector. */
|
||||
@@ -1964,7 +1964,7 @@ TclAliasObjCmd(
|
||||
|
||||
int
|
||||
TclLocalAliasObjCmd(
|
||||
ClientData clientData, /* Alias record. */
|
||||
void *clientData, /* Alias record. */
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument vector. */
|
||||
@@ -2049,7 +2049,7 @@ TclLocalAliasObjCmd(
|
||||
|
||||
static void
|
||||
AliasObjCmdDeleteProc(
|
||||
ClientData clientData) /* The alias record for this alias. */
|
||||
void *clientData) /* The alias record for this alias. */
|
||||
{
|
||||
Alias *aliasPtr = (Alias *)clientData;
|
||||
Target *targetPtr;
|
||||
@@ -2116,7 +2116,7 @@ Tcl_CreateChild(
|
||||
Tcl_Obj *pathPtr;
|
||||
Tcl_Interp *childInterp;
|
||||
|
||||
pathPtr = Tcl_NewStringObj(childPath, -1);
|
||||
pathPtr = Tcl_NewStringObj(childPath, TCL_INDEX_NONE);
|
||||
childInterp = ChildCreate(interp, pathPtr, isSafe);
|
||||
Tcl_DecrRefCount(pathPtr);
|
||||
|
||||
@@ -2147,7 +2147,7 @@ Tcl_GetChild(
|
||||
Tcl_Obj *pathPtr;
|
||||
Tcl_Interp *childInterp;
|
||||
|
||||
pathPtr = Tcl_NewStringObj(childPath, -1);
|
||||
pathPtr = Tcl_NewStringObj(childPath, TCL_INDEX_NONE);
|
||||
childInterp = GetInterp(interp, pathPtr);
|
||||
Tcl_DecrRefCount(pathPtr);
|
||||
|
||||
@@ -2293,7 +2293,7 @@ Tcl_GetInterpPath(
|
||||
}
|
||||
Tcl_ListObjAppendElement(NULL, Tcl_GetObjResult(interp),
|
||||
Tcl_NewStringObj((const char *)Tcl_GetHashKey(&iiPtr->parent.childTable,
|
||||
iiPtr->child.childEntryPtr), -1));
|
||||
iiPtr->child.childEntryPtr), TCL_INDEX_NONE));
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
@@ -2386,7 +2386,7 @@ ChildBgerror(
|
||||
if (TCL_ERROR == TclListObjLengthM(NULL, objv[0], &length)
|
||||
|| (length < 1)) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"cmdPrefix must be list of length >= 1", -1));
|
||||
"cmdPrefix must be list of length >= 1", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "INTERP",
|
||||
"BGERRORFORMAT", NULL);
|
||||
return TCL_ERROR;
|
||||
@@ -2552,7 +2552,7 @@ ChildCreate(
|
||||
|
||||
int
|
||||
TclChildObjCmd(
|
||||
ClientData clientData, /* Child interpreter. */
|
||||
void *clientData, /* Child interpreter. */
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
@@ -2562,7 +2562,7 @@ TclChildObjCmd(
|
||||
|
||||
static int
|
||||
NRChildCmd(
|
||||
ClientData clientData, /* Child interpreter. */
|
||||
void *clientData, /* Child interpreter. */
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
@@ -2766,7 +2766,7 @@ NRChildCmd(
|
||||
|
||||
static void
|
||||
ChildObjCmdDeleteProc(
|
||||
ClientData clientData) /* The ChildRecord for the command. */
|
||||
void *clientData) /* The ChildRecord for the command. */
|
||||
{
|
||||
Child *childPtr; /* Interim storage for Child record. */
|
||||
Tcl_Interp *childInterp = (Tcl_Interp *)clientData;
|
||||
@@ -2831,7 +2831,7 @@ ChildDebugCmd(
|
||||
if (objc == 0) {
|
||||
TclNewObj(resultPtr);
|
||||
Tcl_ListObjAppendElement(NULL, resultPtr,
|
||||
Tcl_NewStringObj("-frame", -1));
|
||||
Tcl_NewStringObj("-frame", TCL_INDEX_NONE));
|
||||
Tcl_ListObjAppendElement(NULL, resultPtr,
|
||||
Tcl_NewBooleanObj(iPtr->flags & INTERP_DEBUG_FRAME));
|
||||
Tcl_SetObjResult(interp, resultPtr);
|
||||
@@ -3001,7 +3001,7 @@ ChildRecursionLimit(
|
||||
if (objc) {
|
||||
if (Tcl_IsSafe(interp)) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj("permission denied: "
|
||||
"safe interpreters cannot change recursion limit", -1));
|
||||
"safe interpreters cannot change recursion limit", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "INTERP", "UNSAFE",
|
||||
NULL);
|
||||
return TCL_ERROR;
|
||||
@@ -3020,7 +3020,7 @@ ChildRecursionLimit(
|
||||
iPtr = (Interp *) childInterp;
|
||||
if (interp == childInterp && iPtr->numLevels > (size_t)limit) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"falling back due to new recursion limit", -1));
|
||||
"falling back due to new recursion limit", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "RECURSION", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -3110,7 +3110,7 @@ ChildHidden(
|
||||
hPtr != NULL;
|
||||
hPtr = Tcl_NextHashEntry(&hSearch)) {
|
||||
Tcl_ListObjAppendElement(NULL, listObjPtr,
|
||||
Tcl_NewStringObj((const char *)Tcl_GetHashKey(hTblPtr, hPtr), -1));
|
||||
Tcl_NewStringObj((const char *)Tcl_GetHashKey(hTblPtr, hPtr), TCL_INDEX_NONE));
|
||||
}
|
||||
}
|
||||
Tcl_SetObjResult(interp, listObjPtr);
|
||||
@@ -3183,7 +3183,7 @@ ChildInvokeHidden(
|
||||
|
||||
static int
|
||||
NRPostInvokeHidden(
|
||||
ClientData data[],
|
||||
void *data[],
|
||||
Tcl_Interp *interp,
|
||||
int result)
|
||||
{
|
||||
@@ -3299,7 +3299,7 @@ TclMakeSafe(
|
||||
*/
|
||||
|
||||
(void) Tcl_EvalEx(interp,
|
||||
"namespace eval ::tcl {namespace eval mathfunc {}}", -1, 0);
|
||||
"namespace eval ::tcl {namespace eval mathfunc {}}", TCL_INDEX_NONE, 0);
|
||||
}
|
||||
|
||||
iPtr->flags |= SAFE_INTERP;
|
||||
@@ -3479,7 +3479,7 @@ Tcl_LimitCheck(
|
||||
iPtr->limit.exceeded &= ~TCL_LIMIT_COMMANDS;
|
||||
} else if (iPtr->limit.exceeded & TCL_LIMIT_COMMANDS) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"command count limit exceeded", -1));
|
||||
"command count limit exceeded", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "LIMIT", "COMMANDS", NULL);
|
||||
Tcl_Release(interp);
|
||||
return TCL_ERROR;
|
||||
@@ -3505,7 +3505,7 @@ Tcl_LimitCheck(
|
||||
iPtr->limit.exceeded &= ~TCL_LIMIT_TIME;
|
||||
} else if (iPtr->limit.exceeded & TCL_LIMIT_TIME) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"time limit exceeded", -1));
|
||||
"time limit exceeded", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "LIMIT", "TIME", NULL);
|
||||
Tcl_Release(interp);
|
||||
return TCL_ERROR;
|
||||
@@ -3608,7 +3608,7 @@ Tcl_LimitAddHandler(
|
||||
Tcl_Interp *interp,
|
||||
int type,
|
||||
Tcl_LimitHandlerProc *handlerProc,
|
||||
ClientData clientData,
|
||||
void *clientData,
|
||||
Tcl_LimitHandlerDeleteProc *deleteProc)
|
||||
{
|
||||
Interp *iPtr = (Interp *) interp;
|
||||
@@ -3682,7 +3682,7 @@ Tcl_LimitRemoveHandler(
|
||||
Tcl_Interp *interp,
|
||||
int type,
|
||||
Tcl_LimitHandlerProc *handlerProc,
|
||||
ClientData clientData)
|
||||
void *clientData)
|
||||
{
|
||||
Interp *iPtr = (Interp *) interp;
|
||||
LimitHandler *handlerPtr;
|
||||
@@ -3985,7 +3985,7 @@ Tcl_LimitTypeReset(
|
||||
void
|
||||
Tcl_LimitSetCommands(
|
||||
Tcl_Interp *interp,
|
||||
size_t commandLimit)
|
||||
Tcl_Size commandLimit)
|
||||
{
|
||||
Interp *iPtr = (Interp *) interp;
|
||||
|
||||
@@ -4081,7 +4081,7 @@ Tcl_LimitSetTime(
|
||||
|
||||
static void
|
||||
TimeLimitCallback(
|
||||
ClientData clientData)
|
||||
void *clientData)
|
||||
{
|
||||
Tcl_Interp *interp = (Tcl_Interp *)clientData;
|
||||
Interp *iPtr = (Interp *)clientData;
|
||||
@@ -4225,7 +4225,7 @@ Tcl_LimitGetGranularity(
|
||||
|
||||
static void
|
||||
DeleteScriptLimitCallback(
|
||||
ClientData clientData)
|
||||
void *clientData)
|
||||
{
|
||||
ScriptLimitCallback *limitCBPtr = (ScriptLimitCallback *)clientData;
|
||||
|
||||
@@ -4256,7 +4256,7 @@ DeleteScriptLimitCallback(
|
||||
|
||||
static void
|
||||
CallScriptLimitCallback(
|
||||
ClientData clientData,
|
||||
void *clientData,
|
||||
TCL_UNUSED(Tcl_Interp *))
|
||||
{
|
||||
ScriptLimitCallback *limitCBPtr = (ScriptLimitCallback *)clientData;
|
||||
@@ -4508,7 +4508,7 @@ ChildCommandLimitCmd(
|
||||
|
||||
if (interp == childInterp) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"limits on current interpreter inaccessible", -1));
|
||||
"limits on current interpreter inaccessible", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "INTERP", "SELF", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -4523,7 +4523,7 @@ ChildCommandLimitCmd(
|
||||
if (hPtr != NULL) {
|
||||
limitCBPtr = (ScriptLimitCallback *)Tcl_GetHashValue(hPtr);
|
||||
if (limitCBPtr != NULL && limitCBPtr->scriptObj != NULL) {
|
||||
Tcl_DictObjPut(NULL, dictPtr, Tcl_NewStringObj(options[0], -1),
|
||||
Tcl_DictObjPut(NULL, dictPtr, Tcl_NewStringObj(options[0], TCL_INDEX_NONE),
|
||||
limitCBPtr->scriptObj);
|
||||
} else {
|
||||
goto putEmptyCommandInDict;
|
||||
@@ -4534,21 +4534,21 @@ ChildCommandLimitCmd(
|
||||
putEmptyCommandInDict:
|
||||
TclNewObj(empty);
|
||||
Tcl_DictObjPut(NULL, dictPtr,
|
||||
Tcl_NewStringObj(options[0], -1), empty);
|
||||
Tcl_NewStringObj(options[0], TCL_INDEX_NONE), empty);
|
||||
}
|
||||
Tcl_DictObjPut(NULL, dictPtr, Tcl_NewStringObj(options[1], -1),
|
||||
Tcl_DictObjPut(NULL, dictPtr, Tcl_NewStringObj(options[1], TCL_INDEX_NONE),
|
||||
Tcl_NewWideIntObj(Tcl_LimitGetGranularity(childInterp,
|
||||
TCL_LIMIT_COMMANDS)));
|
||||
|
||||
if (Tcl_LimitTypeEnabled(childInterp, TCL_LIMIT_COMMANDS)) {
|
||||
Tcl_DictObjPut(NULL, dictPtr, Tcl_NewStringObj(options[2], -1),
|
||||
Tcl_DictObjPut(NULL, dictPtr, Tcl_NewStringObj(options[2], TCL_INDEX_NONE),
|
||||
Tcl_NewWideIntObj(Tcl_LimitGetCommands(childInterp)));
|
||||
} else {
|
||||
Tcl_Obj *empty;
|
||||
|
||||
TclNewObj(empty);
|
||||
Tcl_DictObjPut(NULL, dictPtr,
|
||||
Tcl_NewStringObj(options[2], -1), empty);
|
||||
Tcl_NewStringObj(options[2], TCL_INDEX_NONE), empty);
|
||||
}
|
||||
Tcl_SetObjResult(interp, dictPtr);
|
||||
return TCL_OK;
|
||||
@@ -4607,7 +4607,7 @@ ChildCommandLimitCmd(
|
||||
}
|
||||
if (gran < 1) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"granularity must be at least 1", -1));
|
||||
"granularity must be at least 1", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "INTERP",
|
||||
"BADVALUE", NULL);
|
||||
return TCL_ERROR;
|
||||
@@ -4624,7 +4624,7 @@ ChildCommandLimitCmd(
|
||||
}
|
||||
if (limit < 0) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"command limit value must be at least 0", -1));
|
||||
"command limit value must be at least 0", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "INTERP",
|
||||
"BADVALUE", NULL);
|
||||
return TCL_ERROR;
|
||||
@@ -4696,7 +4696,7 @@ ChildTimeLimitCmd(
|
||||
|
||||
if (interp == childInterp) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"limits on current interpreter inaccessible", -1));
|
||||
"limits on current interpreter inaccessible", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "INTERP", "SELF", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -4711,7 +4711,7 @@ ChildTimeLimitCmd(
|
||||
if (hPtr != NULL) {
|
||||
limitCBPtr = (ScriptLimitCallback *)Tcl_GetHashValue(hPtr);
|
||||
if (limitCBPtr != NULL && limitCBPtr->scriptObj != NULL) {
|
||||
Tcl_DictObjPut(NULL, dictPtr, Tcl_NewStringObj(options[0], -1),
|
||||
Tcl_DictObjPut(NULL, dictPtr, Tcl_NewStringObj(options[0], TCL_INDEX_NONE),
|
||||
limitCBPtr->scriptObj);
|
||||
} else {
|
||||
goto putEmptyCommandInDict;
|
||||
@@ -4721,9 +4721,9 @@ ChildTimeLimitCmd(
|
||||
putEmptyCommandInDict:
|
||||
TclNewObj(empty);
|
||||
Tcl_DictObjPut(NULL, dictPtr,
|
||||
Tcl_NewStringObj(options[0], -1), empty);
|
||||
Tcl_NewStringObj(options[0], TCL_INDEX_NONE), empty);
|
||||
}
|
||||
Tcl_DictObjPut(NULL, dictPtr, Tcl_NewStringObj(options[1], -1),
|
||||
Tcl_DictObjPut(NULL, dictPtr, Tcl_NewStringObj(options[1], TCL_INDEX_NONE),
|
||||
Tcl_NewWideIntObj(Tcl_LimitGetGranularity(childInterp,
|
||||
TCL_LIMIT_TIME)));
|
||||
|
||||
@@ -4731,18 +4731,18 @@ ChildTimeLimitCmd(
|
||||
Tcl_Time limitMoment;
|
||||
|
||||
Tcl_LimitGetTime(childInterp, &limitMoment);
|
||||
Tcl_DictObjPut(NULL, dictPtr, Tcl_NewStringObj(options[2], -1),
|
||||
Tcl_DictObjPut(NULL, dictPtr, Tcl_NewStringObj(options[2], TCL_INDEX_NONE),
|
||||
Tcl_NewWideIntObj(limitMoment.usec/1000));
|
||||
Tcl_DictObjPut(NULL, dictPtr, Tcl_NewStringObj(options[3], -1),
|
||||
Tcl_DictObjPut(NULL, dictPtr, Tcl_NewStringObj(options[3], TCL_INDEX_NONE),
|
||||
Tcl_NewWideIntObj(limitMoment.sec));
|
||||
} else {
|
||||
Tcl_Obj *empty;
|
||||
|
||||
TclNewObj(empty);
|
||||
Tcl_DictObjPut(NULL, dictPtr,
|
||||
Tcl_NewStringObj(options[2], -1), empty);
|
||||
Tcl_NewStringObj(options[2], TCL_INDEX_NONE), empty);
|
||||
Tcl_DictObjPut(NULL, dictPtr,
|
||||
Tcl_NewStringObj(options[3], -1), empty);
|
||||
Tcl_NewStringObj(options[3], TCL_INDEX_NONE), empty);
|
||||
}
|
||||
Tcl_SetObjResult(interp, dictPtr);
|
||||
return TCL_OK;
|
||||
@@ -4816,7 +4816,7 @@ ChildTimeLimitCmd(
|
||||
}
|
||||
if (gran < 1) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"granularity must be at least 1", -1));
|
||||
"granularity must be at least 1", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "INTERP",
|
||||
"BADVALUE", NULL);
|
||||
return TCL_ERROR;
|
||||
@@ -4870,7 +4870,7 @@ ChildTimeLimitCmd(
|
||||
if (secObj != NULL && secLen == 0 && milliLen > 0) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"may only set -milliseconds if -seconds is not "
|
||||
"also being reset", -1));
|
||||
"also being reset", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "INTERP",
|
||||
"BADUSAGE", NULL);
|
||||
return TCL_ERROR;
|
||||
@@ -4878,7 +4878,7 @@ ChildTimeLimitCmd(
|
||||
if (milliLen == 0 && (secObj == NULL || secLen > 0)) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"may only reset -milliseconds if -seconds is "
|
||||
"also being reset", -1));
|
||||
"also being reset", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "INTERP",
|
||||
"BADUSAGE", NULL);
|
||||
return TCL_ERROR;
|
||||
|
||||
+19
-60
@@ -175,7 +175,7 @@ Tcl_LinkVar(
|
||||
linkPtr = (Link *)Tcl_Alloc(sizeof(Link));
|
||||
linkPtr->interp = interp;
|
||||
linkPtr->nsPtr = NULL;
|
||||
linkPtr->varName = Tcl_NewStringObj(varName, -1);
|
||||
linkPtr->varName = Tcl_NewStringObj(varName, TCL_INDEX_NONE);
|
||||
Tcl_IncrRefCount(linkPtr->varName);
|
||||
linkPtr->addr = addr;
|
||||
linkPtr->type = type & ~TCL_LINK_READ_ONLY;
|
||||
@@ -246,7 +246,7 @@ Tcl_LinkArray(
|
||||
* interpreter result. */
|
||||
int type, /* Type of C variable: TCL_LINK_INT, etc. Also
|
||||
* may have TCL_LINK_READ_ONLY OR'ed in. */
|
||||
size_t size) /* Size of C variable array, >1 if array */
|
||||
Tcl_Size size) /* Size of C variable array, >1 if array */
|
||||
{
|
||||
Tcl_Obj *objPtr;
|
||||
Link *linkPtr;
|
||||
@@ -254,9 +254,9 @@ Tcl_LinkArray(
|
||||
const char *name;
|
||||
int code;
|
||||
|
||||
if (size < 1) {
|
||||
if (TCL_SIZE_ISNEG(size) || size < 1) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"wrong array size given", -1));
|
||||
"wrong array size given", TCL_INDEX_NONE));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
@@ -340,7 +340,7 @@ Tcl_LinkArray(
|
||||
default:
|
||||
LinkFree(linkPtr);
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"bad linked array variable type", -1));
|
||||
"bad linked array variable type", TCL_INDEX_NONE));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
@@ -380,7 +380,7 @@ Tcl_LinkArray(
|
||||
*/
|
||||
|
||||
linkPtr->interp = interp;
|
||||
linkPtr->varName = Tcl_NewStringObj(varName, -1);
|
||||
linkPtr->varName = Tcl_NewStringObj(varName, TCL_INDEX_NONE);
|
||||
Tcl_IncrRefCount(linkPtr->varName);
|
||||
|
||||
TclGetNamespaceForQualName(interp, varName, NULL, TCL_GLOBAL_ONLY,
|
||||
@@ -527,56 +527,14 @@ GetUWide(
|
||||
Tcl_Obj *objPtr,
|
||||
Tcl_WideUInt *uwidePtr)
|
||||
{
|
||||
Tcl_WideInt *widePtr = (Tcl_WideInt *) uwidePtr;
|
||||
void *clientData;
|
||||
int type, intValue;
|
||||
if (Tcl_GetWideUIntFromObj(NULL, objPtr, uwidePtr) != TCL_OK) {
|
||||
int intValue;
|
||||
|
||||
if (Tcl_GetNumberFromObj(NULL, objPtr, &clientData, &type) == TCL_OK) {
|
||||
if (type == TCL_NUMBER_INT) {
|
||||
*widePtr = *((const Tcl_WideInt *) clientData);
|
||||
return (*widePtr < 0);
|
||||
} else if (type == TCL_NUMBER_BIG) {
|
||||
mp_int *numPtr = (mp_int *)clientData;
|
||||
Tcl_WideUInt value = 0;
|
||||
union {
|
||||
Tcl_WideUInt value;
|
||||
unsigned char bytes[sizeof(Tcl_WideUInt)];
|
||||
} scratch;
|
||||
size_t numBytes;
|
||||
unsigned char *bytes = scratch.bytes;
|
||||
|
||||
if (numPtr->sign || (MP_OKAY != mp_to_ubin(numPtr,
|
||||
bytes, sizeof(Tcl_WideUInt), &numBytes))) {
|
||||
/*
|
||||
* If the sign bit is set (a negative value) or if the value
|
||||
* can't possibly fit in the bits of an unsigned wide, there's
|
||||
* no point in doing further conversion.
|
||||
*/
|
||||
return 1;
|
||||
}
|
||||
#ifndef WORDS_BIGENDIAN
|
||||
while (numBytes-- > 0) {
|
||||
value = (value << CHAR_BIT) | *bytes++;
|
||||
}
|
||||
#else /* WORDS_BIGENDIAN */
|
||||
/*
|
||||
* Big-endian can read the value directly.
|
||||
*/
|
||||
value = scratch.value;
|
||||
#endif /* WORDS_BIGENDIAN */
|
||||
*uwidePtr = value;
|
||||
return 0;
|
||||
if (GetInvalidIntFromObj(objPtr, &intValue) != TCL_OK) {
|
||||
return 1;
|
||||
}
|
||||
*uwidePtr = intValue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Evil edge case fallback.
|
||||
*/
|
||||
|
||||
if (GetInvalidIntFromObj(objPtr, &intValue) != TCL_OK) {
|
||||
return 1;
|
||||
}
|
||||
*uwidePtr = intValue;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -589,7 +547,7 @@ GetDouble(
|
||||
return 0;
|
||||
} else {
|
||||
#ifdef ACCEPT_NAN
|
||||
Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objPtr, &tclDoubleType);
|
||||
Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objPtr, &tclDoubleType.objType);
|
||||
|
||||
if (irPtr != NULL) {
|
||||
*dblPtr = irPtr->doubleValue;
|
||||
@@ -922,7 +880,9 @@ LinkTraceProc(
|
||||
|
||||
case TCL_LINK_BINARY:
|
||||
value = (char *) Tcl_GetByteArrayFromObj(valueObj, &valueLength);
|
||||
if (valueLength != linkPtr->bytes) {
|
||||
if (value == NULL) {
|
||||
return (char *) "invalid binary value";
|
||||
} else if (valueLength != linkPtr->bytes) {
|
||||
return (char *) "wrong size of binary value";
|
||||
}
|
||||
if (linkPtr->flags & LINK_ALLOC_LAST) {
|
||||
@@ -1323,7 +1283,7 @@ ObjValue(
|
||||
memcpy(linkPtr->lastValue.aryPtr, linkPtr->addr, linkPtr->bytes);
|
||||
objv = (Tcl_Obj **)Tcl_Alloc(linkPtr->numElems * sizeof(Tcl_Obj *));
|
||||
for (i=0; i < linkPtr->numElems; i++) {
|
||||
objv[i] = Tcl_NewDoubleObj(linkPtr->lastValue.dPtr[i]);
|
||||
TclNewDoubleObj(objv[i], linkPtr->lastValue.dPtr[i]);
|
||||
}
|
||||
resultObj = Tcl_NewListObj(linkPtr->numElems, objv);
|
||||
Tcl_Free(objv);
|
||||
@@ -1442,7 +1402,7 @@ ObjValue(
|
||||
memcpy(linkPtr->lastValue.aryPtr, linkPtr->addr, linkPtr->bytes);
|
||||
objv = (Tcl_Obj **)Tcl_Alloc(linkPtr->numElems * sizeof(Tcl_Obj *));
|
||||
for (i=0; i < linkPtr->numElems; i++) {
|
||||
objv[i] = Tcl_NewDoubleObj(linkPtr->lastValue.fPtr[i]);
|
||||
TclNewDoubleObj(objv[i], linkPtr->lastValue.fPtr[i]);
|
||||
}
|
||||
resultObj = Tcl_NewListObj(linkPtr->numElems, objv);
|
||||
Tcl_Free(objv);
|
||||
@@ -1455,8 +1415,7 @@ ObjValue(
|
||||
memcpy(linkPtr->lastValue.aryPtr, linkPtr->addr, linkPtr->bytes);
|
||||
objv = (Tcl_Obj **)Tcl_Alloc(linkPtr->numElems * sizeof(Tcl_Obj *));
|
||||
for (i=0; i < linkPtr->numElems; i++) {
|
||||
TclNewUIntObj(objv[i],
|
||||
linkPtr->lastValue.uwPtr[i]);
|
||||
TclNewUIntObj(objv[i], linkPtr->lastValue.uwPtr[i]);
|
||||
}
|
||||
resultObj = Tcl_NewListObj(linkPtr->numElems, objv);
|
||||
Tcl_Free(objv);
|
||||
@@ -1474,7 +1433,7 @@ ObjValue(
|
||||
TclNewLiteralStringObj(resultObj, "NULL");
|
||||
return resultObj;
|
||||
}
|
||||
return Tcl_NewStringObj(p, -1);
|
||||
return Tcl_NewStringObj(p, TCL_INDEX_NONE);
|
||||
|
||||
case TCL_LINK_CHARS:
|
||||
if (linkPtr->flags & LINK_ALLOC_LAST) {
|
||||
|
||||
+46
-35
@@ -11,6 +11,7 @@
|
||||
|
||||
#include <assert.h>
|
||||
#include "tclInt.h"
|
||||
#include "tclTomMath.h"
|
||||
#include "tclArithSeries.h"
|
||||
|
||||
/*
|
||||
@@ -68,7 +69,7 @@
|
||||
|
||||
/* Checks for when caller should have already converted to internal list type */
|
||||
#define LIST_ASSERT_TYPE(listObj_) \
|
||||
LIST_ASSERT((listObj_)->typePtr == &tclListType);
|
||||
LIST_ASSERT((listObj_)->typePtr == &tclListType.objType);
|
||||
|
||||
|
||||
/*
|
||||
@@ -142,6 +143,7 @@ static void DupListInternalRep(Tcl_Obj *srcPtr, Tcl_Obj *copyPtr);
|
||||
static void FreeListInternalRep(Tcl_Obj *listPtr);
|
||||
static int SetListFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr);
|
||||
static void UpdateStringOfList(Tcl_Obj *listPtr);
|
||||
static size_t ListLength(Tcl_Obj *listPtr);
|
||||
|
||||
/*
|
||||
* The structure below defines the list Tcl object type by means of functions
|
||||
@@ -150,13 +152,15 @@ static void UpdateStringOfList(Tcl_Obj *listPtr);
|
||||
* The internal representation of a list object is ListRep defined in tcl.h.
|
||||
*/
|
||||
|
||||
const Tcl_ObjType tclListType = {
|
||||
"list", /* name */
|
||||
const TclObjTypeWithAbstractList tclListType = {
|
||||
{"list", /* name */
|
||||
FreeListInternalRep, /* freeIntRepProc */
|
||||
DupListInternalRep, /* dupIntRepProc */
|
||||
UpdateStringOfList, /* updateStringProc */
|
||||
SetListFromAny, /* setFromAnyProc */
|
||||
TCL_OBJTYPE_V0
|
||||
TCL_OBJTYPE_V0_1(
|
||||
ListLength
|
||||
)}
|
||||
};
|
||||
|
||||
/* Macros to manipulate the List internal rep */
|
||||
@@ -202,7 +206,7 @@ const Tcl_ObjType tclListType = {
|
||||
do { \
|
||||
(objPtr_)->internalRep.twoPtrValue.ptr1 = (repPtr_)->storePtr; \
|
||||
(objPtr_)->internalRep.twoPtrValue.ptr2 = (repPtr_)->spanPtr; \
|
||||
(objPtr_)->typePtr = &tclListType; \
|
||||
(objPtr_)->typePtr = &tclListType.objType; \
|
||||
} while (0)
|
||||
|
||||
#define ListObjOverwriteRep(objPtr_, repPtr_) \
|
||||
@@ -522,7 +526,7 @@ ListLimitExceededError(Tcl_Interp *interp)
|
||||
if (interp != NULL) {
|
||||
Tcl_SetObjResult(
|
||||
interp,
|
||||
Tcl_NewStringObj("max length of a Tcl list exceeded", -1));
|
||||
Tcl_NewStringObj("max length of a Tcl list exceeded", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL);
|
||||
}
|
||||
return TCL_ERROR;
|
||||
@@ -1272,7 +1276,7 @@ TclListObjGetRep(
|
||||
* to be returned. */
|
||||
ListRep *repPtr) /* Location to store descriptor */
|
||||
{
|
||||
if (!TclHasInternalRep(listObj, &tclListType)) {
|
||||
if (!TclHasInternalRep(listObj, &tclListType.objType)) {
|
||||
int result;
|
||||
result = SetListFromAny(interp, listObj);
|
||||
if (result != TCL_OK) {
|
||||
@@ -1366,8 +1370,8 @@ TclListObjCopy(
|
||||
{
|
||||
Tcl_Obj *copyObj;
|
||||
|
||||
if (!TclHasInternalRep(listObj, &tclListType)) {
|
||||
if (TclHasInternalRep(listObj,&tclArithSeriesType)) {
|
||||
if (!TclHasInternalRep(listObj, &tclListType.objType)) {
|
||||
if (TclHasInternalRep(listObj,&tclArithSeriesType.objType)) {
|
||||
return TclArithSeriesObjCopy(interp, listObj);
|
||||
}
|
||||
if (SetListFromAny(interp, listObj) != TCL_OK) {
|
||||
@@ -1656,14 +1660,14 @@ Tcl_ListObjGetElements(
|
||||
Tcl_Interp *interp, /* Used to report errors if not NULL. */
|
||||
Tcl_Obj *objPtr, /* List object for which an element array is
|
||||
* to be returned. */
|
||||
Tcl_Size *objcPtr, /* Where to store the count of objects
|
||||
size_t *objcPtr, /* Where to store the count of objects
|
||||
* referenced by objv. */
|
||||
Tcl_Obj ***objvPtr) /* Where to store the pointer to an array of
|
||||
* pointers to the list's objects. */
|
||||
{
|
||||
ListRep listRep;
|
||||
|
||||
if (TclHasInternalRep(objPtr,&tclArithSeriesType)) {
|
||||
if (TclHasInternalRep(objPtr,&tclArithSeriesType.objType)) {
|
||||
return TclArithSeriesGetElements(interp, objPtr, objcPtr, objvPtr);
|
||||
}
|
||||
|
||||
@@ -1989,12 +1993,13 @@ int
|
||||
Tcl_ListObjLength(
|
||||
Tcl_Interp *interp, /* Used to report errors if not NULL. */
|
||||
Tcl_Obj *listObj, /* List object whose #elements to return. */
|
||||
Tcl_Size *lenPtr) /* The resulting int is stored here. */
|
||||
size_t *lenPtr) /* The resulting length is stored here. */
|
||||
{
|
||||
ListRep listRep;
|
||||
|
||||
if (TclHasInternalRep(listObj,&tclArithSeriesType)) {
|
||||
*lenPtr = TclArithSeriesObjLength(listObj);
|
||||
size_t (*lengthProc)(Tcl_Obj *obj) = ABSTRACTLIST_PROC(listObj, lengthProc);
|
||||
if (lengthProc) {
|
||||
*lenPtr = lengthProc(listObj);
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
@@ -2011,6 +2016,15 @@ Tcl_ListObjLength(
|
||||
*lenPtr = ListRepLength(&listRep);
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
size_t ListLength(
|
||||
Tcl_Obj *listPtr)
|
||||
{
|
||||
ListRep listRep;
|
||||
ListObjGetRep(listPtr, &listRep);
|
||||
|
||||
return ListRepLength(&listRep);
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
@@ -2330,7 +2344,7 @@ Tcl_ListObjReplace(
|
||||
*/
|
||||
|
||||
/*
|
||||
* Calculate shifts if necessary to accomodate insertions.
|
||||
* Calculate shifts if necessary to accommodate insertions.
|
||||
* NOTE: all indices are relative to listObjs which is not necessarily the
|
||||
* start of the ListStore storage area.
|
||||
*
|
||||
@@ -2553,7 +2567,7 @@ TclLindexList(
|
||||
* shimmering; if internal rep is already a list do not shimmer it.
|
||||
* see TIP#22 and TIP#33 for the details.
|
||||
*/
|
||||
if (!TclHasInternalRep(argObj, &tclListType)
|
||||
if (!TclHasInternalRep(argObj, &tclListType.objType)
|
||||
&& TclGetIntForIndexM(NULL, argObj, ListSizeT_MAX - 1, &index)
|
||||
== TCL_OK) {
|
||||
/*
|
||||
@@ -2626,8 +2640,8 @@ TclLindexFlat(
|
||||
Tcl_Size i;
|
||||
|
||||
/* Handle ArithSeries as special case */
|
||||
if (TclHasInternalRep(listObj,&tclArithSeriesType)) {
|
||||
Tcl_WideInt listLen = TclArithSeriesObjLength(listObj);
|
||||
if (TclHasInternalRep(listObj,&tclArithSeriesType.objType)) {
|
||||
Tcl_Size listLen = ABSTRACTLIST_PROC(listObj, lengthProc)(listObj);
|
||||
Tcl_Size index;
|
||||
Tcl_Obj *elemObj = NULL;
|
||||
for (i=0 ; i<indexCount && listObj ; i++) {
|
||||
@@ -2635,7 +2649,7 @@ TclLindexFlat(
|
||||
&index) == TCL_OK) {
|
||||
}
|
||||
if (i==0) {
|
||||
TclArithSeriesObjIndex(listObj, index, &elemObj);
|
||||
elemObj = TclArithSeriesObjIndex(NULL, listObj, index);
|
||||
} else if (index > 0) {
|
||||
/* ArithSeries cannot be a list of lists */
|
||||
Tcl_DecrRefCount(elemObj);
|
||||
@@ -2744,7 +2758,7 @@ TclLsetList(
|
||||
* shimmering; see TIP #22 and #23 for details.
|
||||
*/
|
||||
|
||||
if (!TclHasInternalRep(indexArgObj, &tclListType)
|
||||
if (!TclHasInternalRep(indexArgObj, &tclListType.objType)
|
||||
&& TclGetIntForIndexM(NULL, indexArgObj, ListSizeT_MAX - 1, &index)
|
||||
== TCL_OK) {
|
||||
/* indexArgPtr designates a single index. */
|
||||
@@ -3274,13 +3288,13 @@ SetListFromAny(
|
||||
Tcl_IncrRefCount(valuePtr);
|
||||
Tcl_DictObjNext(&search, &keyPtr, &valuePtr, &done);
|
||||
}
|
||||
} else if (TclHasInternalRep(objPtr,&tclArithSeriesType)) {
|
||||
} else if (TclHasInternalRep(objPtr,&tclArithSeriesType.objType)) {
|
||||
/*
|
||||
* Convertion from Arithmetic Series is a special case
|
||||
* because it can be done an order of magnitude faster
|
||||
* and may occur frequently.
|
||||
*/
|
||||
Tcl_Size j, size = TclArithSeriesObjLength(objPtr);
|
||||
Tcl_Size j, size = ABSTRACTLIST_PROC(objPtr, lengthProc)(objPtr);
|
||||
|
||||
/* TODO - leave space in front and/or back? */
|
||||
if (ListRepInitAttempt(
|
||||
@@ -3296,7 +3310,8 @@ SetListFromAny(
|
||||
listRep.storePtr->numUsed = size;
|
||||
elemPtrs = listRep.storePtr->slots;
|
||||
for (j = 0; j < size; j++) {
|
||||
if (TclArithSeriesObjIndex(objPtr, j, &elemPtrs[j]) != TCL_OK) {
|
||||
elemPtrs[j] = TclArithSeriesObjIndex(interp, objPtr, j);
|
||||
if (elemPtrs[j] == NULL) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
}
|
||||
@@ -3382,7 +3397,7 @@ fail:
|
||||
TclFreeInternalRep(objPtr);
|
||||
objPtr->internalRep.twoPtrValue.ptr1 = listRep.storePtr;
|
||||
objPtr->internalRep.twoPtrValue.ptr2 = listRep.spanPtr;
|
||||
objPtr->typePtr = &tclListType;
|
||||
objPtr->typePtr = &tclListType.objType;
|
||||
|
||||
return TCL_OK;
|
||||
}
|
||||
@@ -3507,17 +3522,10 @@ UpdateStringOfList(
|
||||
*------------------------------------------------------------------------
|
||||
*/
|
||||
Tcl_Obj *
|
||||
TclListTestObj (int length, int leadingSpace, int endSpace)
|
||||
TclListTestObj(size_t length, size_t leadingSpace, size_t endSpace)
|
||||
{
|
||||
if (length < 0)
|
||||
length = 0;
|
||||
if (leadingSpace < 0)
|
||||
leadingSpace = 0;
|
||||
if (endSpace < 0)
|
||||
endSpace = 0;
|
||||
|
||||
ListRep listRep;
|
||||
Tcl_Size capacity;
|
||||
size_t capacity;
|
||||
Tcl_Obj *listObj;
|
||||
|
||||
TclNewObj(listObj);
|
||||
@@ -3527,13 +3535,16 @@ TclListTestObj (int length, int leadingSpace, int endSpace)
|
||||
if (capacity == 0) {
|
||||
return listObj;
|
||||
}
|
||||
if (capacity > LIST_MAX) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ListRepInit(capacity, NULL, 0, &listRep);
|
||||
|
||||
ListStore *storePtr = listRep.storePtr;
|
||||
int i;
|
||||
size_t i;
|
||||
for (i = 0; i < length; ++i) {
|
||||
storePtr->slots[i + leadingSpace] = Tcl_NewIntObj(i);
|
||||
TclNewUIntObj(storePtr->slots[i + leadingSpace], i);
|
||||
Tcl_IncrRefCount(storePtr->slots[i + leadingSpace]);
|
||||
}
|
||||
storePtr->firstUsed = leadingSpace;
|
||||
|
||||
+18
-18
@@ -179,8 +179,8 @@ TclCreateLiteral(
|
||||
const char *bytes, /* The start of the string. Note that this is
|
||||
* not a NUL-terminated string. */
|
||||
size_t length, /* Number of bytes in the string. */
|
||||
size_t hash, /* The string's hash. If -1, it will be
|
||||
* computed here. */
|
||||
TCL_HASH_TYPE hash, /* The string's hash. If the value is
|
||||
* TCL_INDEX_NONE, it will be computed here. */
|
||||
int *newPtr,
|
||||
Namespace *nsPtr,
|
||||
int flags,
|
||||
@@ -229,7 +229,7 @@ TclCreateLiteral(
|
||||
if (flags & LITERAL_ON_HEAP) {
|
||||
Tcl_Free((void *)bytes);
|
||||
}
|
||||
if (globalPtr->refCount != TCL_INDEX_NONE) {
|
||||
if (!TCL_SIZE_ISNEG(globalPtr->refCount)) {
|
||||
globalPtr->refCount++;
|
||||
}
|
||||
return objPtr;
|
||||
@@ -351,7 +351,7 @@ Tcl_Obj *
|
||||
TclFetchLiteral(
|
||||
CompileEnv *envPtr, /* Points to the CompileEnv from which to
|
||||
* fetch the registered literal value. */
|
||||
size_t index) /* Index of the desired literal, as returned
|
||||
Tcl_Size index) /* Index of the desired literal, as returned
|
||||
* by prior call to TclRegisterLiteral() */
|
||||
{
|
||||
if (index >= envPtr->literalArrayNext) {
|
||||
@@ -387,16 +387,16 @@ TclFetchLiteral(
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
size_t
|
||||
Tcl_Size
|
||||
TclRegisterLiteral(
|
||||
void *ePtr, /* Points to the CompileEnv in whose object
|
||||
* array an object is found or created. */
|
||||
const char *bytes, /* Points to string for which to find or
|
||||
* create an object in CompileEnv's object
|
||||
* array. */
|
||||
size_t length, /* Number of bytes in the string. If -1, the
|
||||
* string consists of all bytes up to the
|
||||
* first null character. */
|
||||
Tcl_Size length, /* Number of bytes in the string. If
|
||||
* TCL_INDEX_NONE, the string consists of all bytes
|
||||
* up to the first null character. */
|
||||
int flags) /* If LITERAL_ON_HEAP then the caller already
|
||||
* malloc'd bytes and ownership is passed to
|
||||
* this function. If LITERAL_CMD_NAME then
|
||||
@@ -412,7 +412,7 @@ TclRegisterLiteral(
|
||||
int isNew;
|
||||
Namespace *nsPtr;
|
||||
|
||||
if (length == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(length)) {
|
||||
length = (bytes ? strlen(bytes) : 0);
|
||||
}
|
||||
hash = HashString(bytes, length);
|
||||
@@ -607,7 +607,7 @@ TclHideLiteral(
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
size_t
|
||||
Tcl_Size
|
||||
TclAddLiteralObj(
|
||||
CompileEnv *envPtr,/* Points to CompileEnv in whose literal array
|
||||
* the object is to be inserted. */
|
||||
@@ -617,7 +617,7 @@ TclAddLiteralObj(
|
||||
* NULL. */
|
||||
{
|
||||
LiteralEntry *lPtr;
|
||||
size_t objIndex;
|
||||
Tcl_Size objIndex;
|
||||
|
||||
if (envPtr->literalArrayNext >= envPtr->literalArrayEnd) {
|
||||
ExpandLocalLiteralArray(envPtr);
|
||||
@@ -851,7 +851,7 @@ TclReleaseLiteral(
|
||||
* literal table entry (decrement the ref count of the object).
|
||||
*/
|
||||
|
||||
if ((entryPtr->refCount != TCL_INDEX_NONE) && (entryPtr->refCount-- <= 1)) {
|
||||
if (!TCL_SIZE_ISNEG((entryPtr->refCount)) && (entryPtr->refCount-- <= 1)) {
|
||||
if (prevPtr == NULL) {
|
||||
globalTablePtr->buckets[index] = entryPtr->nextPtr;
|
||||
} else {
|
||||
@@ -1057,7 +1057,7 @@ TclInvalidateCmdLiteral(
|
||||
{
|
||||
Interp *iPtr = (Interp *) interp;
|
||||
Tcl_Obj *literalObjPtr = TclCreateLiteral(iPtr, name,
|
||||
strlen(name), -1, NULL, nsPtr, 0, NULL);
|
||||
strlen(name), TCL_INDEX_NONE, NULL, nsPtr, 0, NULL);
|
||||
|
||||
if (literalObjPtr != NULL) {
|
||||
if (TclHasInternalRep(literalObjPtr, &tclCmdNameType)) {
|
||||
@@ -1128,18 +1128,18 @@ TclLiteralStats(
|
||||
*/
|
||||
|
||||
result = (char *)Tcl_Alloc(NUM_COUNTERS*60 + 300);
|
||||
sprintf(result, "%" TCL_Z_MODIFIER "u entries in table, %" TCL_Z_MODIFIER "u buckets\n",
|
||||
snprintf(result, 60, "%" TCL_Z_MODIFIER "u entries in table, %" TCL_Z_MODIFIER "u buckets\n",
|
||||
tablePtr->numEntries, tablePtr->numBuckets);
|
||||
p = result + strlen(result);
|
||||
for (i=0 ; i<NUM_COUNTERS ; i++) {
|
||||
sprintf(p, "number of buckets with %" TCL_Z_MODIFIER "u entries: %" TCL_Z_MODIFIER "u\n",
|
||||
snprintf(p, 60, "number of buckets with %" TCL_Z_MODIFIER "u entries: %" TCL_Z_MODIFIER "u\n",
|
||||
i, count[i]);
|
||||
p += strlen(p);
|
||||
}
|
||||
sprintf(p, "number of buckets with %d or more entries: %" TCL_Z_MODIFIER "u\n",
|
||||
snprintf(p, 60, "number of buckets with %d or more entries: %" TCL_Z_MODIFIER "u\n",
|
||||
NUM_COUNTERS, overflow);
|
||||
p += strlen(p);
|
||||
sprintf(p, "average search distance for entry: %.1f", average);
|
||||
snprintf(p, 60, "average search distance for entry: %.1f", average);
|
||||
return result;
|
||||
}
|
||||
#endif /*TCL_COMPILE_STATS*/
|
||||
@@ -1175,7 +1175,7 @@ TclVerifyLocalLiteralTable(
|
||||
for (localPtr=localTablePtr->buckets[i] ; localPtr!=NULL;
|
||||
localPtr=localPtr->nextPtr) {
|
||||
count++;
|
||||
if (localPtr->refCount != TCL_INDEX_NONE) {
|
||||
if (!TCL_SIZE_ISNEG(localPtr->refCount)) {
|
||||
bytes = Tcl_GetStringFromObj(localPtr->objPtr, &length);
|
||||
Tcl_Panic("%s: local literal \"%.*s\" had bad refCount %" TCL_Z_MODIFIER "u",
|
||||
"TclVerifyLocalLiteralTable",
|
||||
|
||||
+13
-13
@@ -192,7 +192,7 @@ Tcl_LoadObjCmd(
|
||||
}
|
||||
if ((fullFileName[0] == 0) && (prefix == NULL)) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"must specify either file name or prefix", -1));
|
||||
"must specify either file name or prefix", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LOAD", "NOLIBRARY",
|
||||
NULL);
|
||||
code = TCL_ERROR;
|
||||
@@ -232,9 +232,9 @@ Tcl_LoadObjCmd(
|
||||
namesMatch = 0;
|
||||
} else {
|
||||
TclDStringClear(&pfx);
|
||||
Tcl_DStringAppend(&pfx, prefix, -1);
|
||||
Tcl_DStringAppend(&pfx, prefix, TCL_INDEX_NONE);
|
||||
TclDStringClear(&tmp);
|
||||
Tcl_DStringAppend(&tmp, libraryPtr->prefix, -1);
|
||||
Tcl_DStringAppend(&tmp, libraryPtr->prefix, TCL_INDEX_NONE);
|
||||
if (strcmp(Tcl_DStringValue(&tmp),
|
||||
Tcl_DStringValue(&pfx)) == 0) {
|
||||
namesMatch = 1;
|
||||
@@ -307,7 +307,7 @@ Tcl_LoadObjCmd(
|
||||
*/
|
||||
|
||||
if (prefix != NULL) {
|
||||
Tcl_DStringAppend(&pfx, prefix, -1);
|
||||
Tcl_DStringAppend(&pfx, prefix, TCL_INDEX_NONE);
|
||||
} else {
|
||||
Tcl_Obj *splitPtr, *pkgGuessPtr;
|
||||
size_t pElements;
|
||||
@@ -487,7 +487,7 @@ Tcl_LoadObjCmd(
|
||||
* this interp are incompatible in their stubs mechanisms, and
|
||||
* recorded the error in the oldest legacy place we have to do so.
|
||||
*/
|
||||
Tcl_SetObjResult(target, Tcl_NewStringObj(iPtr->legacyResult, -1));
|
||||
Tcl_SetObjResult(target, Tcl_NewStringObj(iPtr->legacyResult, TCL_INDEX_NONE));
|
||||
iPtr->legacyResult = NULL;
|
||||
iPtr->legacyFreeProc = (void (*) (void))-1;
|
||||
}
|
||||
@@ -625,7 +625,7 @@ Tcl_UnloadObjCmd(
|
||||
}
|
||||
if ((fullFileName[0] == 0) && (prefix == NULL)) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"must specify either file name or prefix", -1));
|
||||
"must specify either file name or prefix", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "UNLOAD", "NOLIBRARY",
|
||||
NULL);
|
||||
code = TCL_ERROR;
|
||||
@@ -665,9 +665,9 @@ Tcl_UnloadObjCmd(
|
||||
namesMatch = 0;
|
||||
} else {
|
||||
TclDStringClear(&pfx);
|
||||
Tcl_DStringAppend(&pfx, prefix, -1);
|
||||
Tcl_DStringAppend(&pfx, prefix, TCL_INDEX_NONE);
|
||||
TclDStringClear(&tmp);
|
||||
Tcl_DStringAppend(&tmp, libraryPtr->prefix, -1);
|
||||
Tcl_DStringAppend(&tmp, libraryPtr->prefix, TCL_INDEX_NONE);
|
||||
if (strcmp(Tcl_DStringValue(&tmp),
|
||||
Tcl_DStringValue(&pfx)) == 0) {
|
||||
namesMatch = 1;
|
||||
@@ -1121,8 +1121,8 @@ TclGetLoadedLibraries(
|
||||
Tcl_MutexLock(&libraryMutex);
|
||||
for (libraryPtr = firstLibraryPtr; libraryPtr != NULL;
|
||||
libraryPtr = libraryPtr->nextPtr) {
|
||||
pkgDesc[0] = Tcl_NewStringObj(libraryPtr->fileName, -1);
|
||||
pkgDesc[1] = Tcl_NewStringObj(libraryPtr->prefix, -1);
|
||||
pkgDesc[0] = Tcl_NewStringObj(libraryPtr->fileName, TCL_INDEX_NONE);
|
||||
pkgDesc[1] = Tcl_NewStringObj(libraryPtr->prefix, TCL_INDEX_NONE);
|
||||
Tcl_ListObjAppendElement(NULL, resultObj,
|
||||
Tcl_NewListObj(2, pkgDesc));
|
||||
}
|
||||
@@ -1147,7 +1147,7 @@ TclGetLoadedLibraries(
|
||||
libraryPtr = ipPtr->libraryPtr;
|
||||
|
||||
if (!strcmp(prefix, libraryPtr->prefix)) {
|
||||
resultObj = Tcl_NewStringObj(libraryPtr->fileName, -1);
|
||||
resultObj = Tcl_NewStringObj(libraryPtr->fileName, TCL_INDEX_NONE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1166,8 +1166,8 @@ TclGetLoadedLibraries(
|
||||
TclNewObj(resultObj);
|
||||
for (; ipPtr != NULL; ipPtr = ipPtr->nextPtr) {
|
||||
libraryPtr = ipPtr->libraryPtr;
|
||||
pkgDesc[0] = Tcl_NewStringObj(libraryPtr->fileName, -1);
|
||||
pkgDesc[1] = Tcl_NewStringObj(libraryPtr->prefix, -1);
|
||||
pkgDesc[0] = Tcl_NewStringObj(libraryPtr->fileName, TCL_INDEX_NONE);
|
||||
pkgDesc[1] = Tcl_NewStringObj(libraryPtr->prefix, TCL_INDEX_NONE);
|
||||
Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewListObj(2, pkgDesc));
|
||||
}
|
||||
Tcl_SetObjResult(interp, resultObj);
|
||||
|
||||
@@ -81,7 +81,7 @@ TclpLoadMemory(
|
||||
{
|
||||
if (interp) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj("dynamic loading from memory "
|
||||
"is not available on this system", -1));
|
||||
"is not available on this system", TCL_INDEX_NONE));
|
||||
}
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
+7
-7
@@ -55,7 +55,7 @@ NewNativeObj(
|
||||
#else
|
||||
(void)Tcl_ExternalToUtfDString(NULL, (char *)string, -1, &ds);
|
||||
#endif
|
||||
return TclDStringToObj(&ds);
|
||||
return Tcl_DStringToObj(&ds);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -280,7 +280,7 @@ Tcl_SourceRCFile(
|
||||
|
||||
TCL_NORETURN void
|
||||
Tcl_MainEx(
|
||||
size_t argc, /* Number of arguments. */
|
||||
Tcl_Size argc, /* Number of arguments. */
|
||||
TCHAR **argv, /* Array of argument strings. */
|
||||
Tcl_AppInitProc *appInitProc,
|
||||
/* Application-specific initialization
|
||||
@@ -288,7 +288,7 @@ Tcl_MainEx(
|
||||
* but before starting to execute commands. */
|
||||
Tcl_Interp *interp)
|
||||
{
|
||||
size_t i=0; /* argv[i] index */
|
||||
Tcl_Size i=0; /* argv[i] index */
|
||||
Tcl_Obj *path, *resultPtr, *argvPtr, *appName;
|
||||
const char *encodingName = NULL;
|
||||
int code, exitCode = 0;
|
||||
@@ -454,7 +454,7 @@ Tcl_MainEx(
|
||||
while ((is.input != NULL) && !Tcl_InterpDeleted(interp)) {
|
||||
mainLoopProc = TclGetMainLoop();
|
||||
if (mainLoopProc == NULL) {
|
||||
size_t length;
|
||||
Tcl_Size length;
|
||||
|
||||
if (is.tty) {
|
||||
Prompt(interp, &is);
|
||||
@@ -475,7 +475,7 @@ Tcl_MainEx(
|
||||
Tcl_IncrRefCount(is.commandPtr);
|
||||
}
|
||||
length = Tcl_GetsObj(is.input, is.commandPtr);
|
||||
if (length == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(length)) {
|
||||
if (Tcl_InputBlocked(is.input)) {
|
||||
/*
|
||||
* This can only happen if stdin has been set to
|
||||
@@ -740,7 +740,7 @@ StdinProc(
|
||||
TCL_UNUSED(int) /*mask*/)
|
||||
{
|
||||
int code;
|
||||
size_t length;
|
||||
Tcl_Size length;
|
||||
InteractiveState *isPtr = (InteractiveState *)clientData;
|
||||
Tcl_Channel chan = isPtr->input;
|
||||
Tcl_Obj *commandPtr = isPtr->commandPtr;
|
||||
@@ -752,7 +752,7 @@ StdinProc(
|
||||
Tcl_IncrRefCount(commandPtr);
|
||||
}
|
||||
length = Tcl_GetsObj(chan, commandPtr);
|
||||
if (length == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(length)) {
|
||||
if (Tcl_InputBlocked(chan)) {
|
||||
return;
|
||||
}
|
||||
|
||||
+49
-47
@@ -71,26 +71,26 @@ typedef struct {
|
||||
* Declarations for functions local to this file:
|
||||
*/
|
||||
|
||||
static void DeleteImportedCmd(ClientData clientData);
|
||||
static void DeleteImportedCmd(void *clientData);
|
||||
static int DoImport(Tcl_Interp *interp,
|
||||
Namespace *nsPtr, Tcl_HashEntry *hPtr,
|
||||
const char *cmdName, const char *pattern,
|
||||
Namespace *importNsPtr, int allowOverwrite);
|
||||
static void DupNsNameInternalRep(Tcl_Obj *objPtr,Tcl_Obj *copyPtr);
|
||||
static char * ErrorCodeRead(ClientData clientData,Tcl_Interp *interp,
|
||||
static char * ErrorCodeRead(void *clientData,Tcl_Interp *interp,
|
||||
const char *name1, const char *name2, int flags);
|
||||
static char * ErrorInfoRead(ClientData clientData,Tcl_Interp *interp,
|
||||
static char * ErrorInfoRead(void *clientData,Tcl_Interp *interp,
|
||||
const char *name1, const char *name2, int flags);
|
||||
static char * EstablishErrorCodeTraces(ClientData clientData,
|
||||
static char * EstablishErrorCodeTraces(void *clientData,
|
||||
Tcl_Interp *interp, const char *name1,
|
||||
const char *name2, int flags);
|
||||
static char * EstablishErrorInfoTraces(ClientData clientData,
|
||||
static char * EstablishErrorInfoTraces(void *clientData,
|
||||
Tcl_Interp *interp, const char *name1,
|
||||
const char *name2, int flags);
|
||||
static void FreeNsNameInternalRep(Tcl_Obj *objPtr);
|
||||
static int GetNamespaceFromObj(Tcl_Interp *interp,
|
||||
Tcl_Obj *objPtr, Tcl_Namespace **nsPtrPtr);
|
||||
static int InvokeImportedNRCmd(ClientData clientData,
|
||||
static int InvokeImportedNRCmd(void *clientData,
|
||||
Tcl_Interp *interp,int objc,Tcl_Obj *const objv[]);
|
||||
static Tcl_ObjCmdProc NamespaceChildrenCmd;
|
||||
static Tcl_ObjCmdProc NamespaceCodeCmd;
|
||||
@@ -417,6 +417,8 @@ Tcl_PopCallFrame(
|
||||
framePtr->nsPtr = NULL;
|
||||
|
||||
if (framePtr->tailcallPtr) {
|
||||
/* Reusing the existing reference count from framePtr->tailcallPtr, so
|
||||
* no need to Tcl_IncrRefCount(framePtr->tailcallPtr)*/
|
||||
TclSetTailcall(interp, framePtr->tailcallPtr);
|
||||
}
|
||||
}
|
||||
@@ -651,7 +653,7 @@ Tcl_CreateNamespace(
|
||||
const char *name, /* Name for the new namespace. May be a
|
||||
* qualified name with names of ancestor
|
||||
* namespaces separated by "::"s. */
|
||||
ClientData clientData, /* One-word value to store with namespace. */
|
||||
void *clientData, /* One-word value to store with namespace. */
|
||||
Tcl_NamespaceDeleteProc *deleteProc)
|
||||
/* Function called to delete client data when
|
||||
* the namespace is deleted. NULL if no
|
||||
@@ -696,7 +698,7 @@ Tcl_CreateNamespace(
|
||||
if (deleteProc != NULL) {
|
||||
nameStr = name + strlen(name) - 2;
|
||||
if (nameStr >= name && nameStr[1] == ':' && nameStr[0] == ':') {
|
||||
Tcl_DStringAppend(&tmpBuffer, name, -1);
|
||||
Tcl_DStringAppend(&tmpBuffer, name, TCL_INDEX_NONE);
|
||||
while ((nameLen = Tcl_DStringLength(&tmpBuffer)) > 0
|
||||
&& Tcl_DStringValue(&tmpBuffer)[nameLen-1] == ':') {
|
||||
Tcl_DStringSetLength(&tmpBuffer, nameLen-1);
|
||||
@@ -713,7 +715,7 @@ Tcl_CreateNamespace(
|
||||
|
||||
if (*name == '\0') {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj("can't create namespace"
|
||||
" \"\": only global namespace can have empty name", -1));
|
||||
" \"\": only global namespace can have empty name", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "NAMESPACE",
|
||||
"CREATEGLOBAL", NULL);
|
||||
Tcl_DStringFree(&tmpBuffer);
|
||||
@@ -831,7 +833,7 @@ Tcl_CreateNamespace(
|
||||
Tcl_DString *tempPtr = namePtr;
|
||||
|
||||
TclDStringAppendLiteral(buffPtr, "::");
|
||||
Tcl_DStringAppend(buffPtr, ancestorPtr->name, -1);
|
||||
Tcl_DStringAppend(buffPtr, ancestorPtr->name, TCL_INDEX_NONE);
|
||||
TclDStringAppendDString(buffPtr, namePtr);
|
||||
|
||||
/*
|
||||
@@ -1183,7 +1185,7 @@ TclTeardownNamespace(
|
||||
Interp *iPtr = (Interp *) nsPtr->interp;
|
||||
Tcl_HashEntry *entryPtr;
|
||||
Tcl_HashSearch search;
|
||||
size_t i;
|
||||
Tcl_Size i;
|
||||
|
||||
/*
|
||||
* Start by destroying the namespace's variable table, since variables
|
||||
@@ -1204,7 +1206,7 @@ TclTeardownNamespace(
|
||||
*/
|
||||
|
||||
while (nsPtr->cmdTable.numEntries > 0) {
|
||||
size_t length = nsPtr->cmdTable.numEntries;
|
||||
Tcl_Size length = nsPtr->cmdTable.numEntries;
|
||||
Command **cmds = (Command **)TclStackAlloc((Tcl_Interp *) iPtr,
|
||||
sizeof(Command *) * length);
|
||||
|
||||
@@ -1394,7 +1396,7 @@ Tcl_Export(
|
||||
Namespace *currNsPtr = (Namespace *) TclGetCurrentNamespace(interp);
|
||||
const char *simplePattern;
|
||||
char *patternCpy;
|
||||
size_t neededElems, len, i;
|
||||
Tcl_Size neededElems, len, i;
|
||||
|
||||
/*
|
||||
* If the specified namespace is NULL, use the current namespace.
|
||||
@@ -1521,7 +1523,7 @@ Tcl_AppendExportList(
|
||||
* export pattern list is appended. */
|
||||
{
|
||||
Namespace *nsPtr;
|
||||
size_t i;
|
||||
Tcl_Size i;
|
||||
int result;
|
||||
|
||||
/*
|
||||
@@ -1540,7 +1542,7 @@ Tcl_AppendExportList(
|
||||
|
||||
for (i = 0; i < nsPtr->numExportPatterns; i++) {
|
||||
result = Tcl_ListObjAppendElement(interp, objPtr,
|
||||
Tcl_NewStringObj(nsPtr->exportArrayPtr[i], -1));
|
||||
Tcl_NewStringObj(nsPtr->exportArrayPtr[i], TCL_INDEX_NONE));
|
||||
if (result != TCL_OK) {
|
||||
return result;
|
||||
}
|
||||
@@ -1619,7 +1621,7 @@ Tcl_Import(
|
||||
int result;
|
||||
|
||||
TclNewLiteralStringObj(objv[0], "auto_import");
|
||||
objv[1] = Tcl_NewStringObj(pattern, -1);
|
||||
objv[1] = Tcl_NewStringObj(pattern, TCL_INDEX_NONE);
|
||||
|
||||
Tcl_IncrRefCount(objv[0]);
|
||||
Tcl_IncrRefCount(objv[1]);
|
||||
@@ -1724,7 +1726,7 @@ DoImport(
|
||||
Namespace *importNsPtr,
|
||||
int allowOverwrite)
|
||||
{
|
||||
size_t i = 0, exported = 0;
|
||||
Tcl_Size i = 0, exported = 0;
|
||||
Tcl_HashEntry *found;
|
||||
|
||||
/*
|
||||
@@ -1760,11 +1762,11 @@ DoImport(
|
||||
ImportRef *refPtr;
|
||||
|
||||
Tcl_DStringInit(&ds);
|
||||
Tcl_DStringAppend(&ds, nsPtr->fullName, -1);
|
||||
Tcl_DStringAppend(&ds, nsPtr->fullName, TCL_INDEX_NONE);
|
||||
if (nsPtr != ((Interp *) interp)->globalNsPtr) {
|
||||
TclDStringAppendLiteral(&ds, "::");
|
||||
}
|
||||
Tcl_DStringAppend(&ds, cmdName, -1);
|
||||
Tcl_DStringAppend(&ds, cmdName, TCL_INDEX_NONE);
|
||||
|
||||
/*
|
||||
* Check whether creating the new imported command in the current
|
||||
@@ -2034,7 +2036,7 @@ TclGetOriginalCommand(
|
||||
|
||||
static int
|
||||
InvokeImportedNRCmd(
|
||||
ClientData clientData, /* Points to the imported command's
|
||||
void *clientData, /* Points to the imported command's
|
||||
* ImportedCmdData structure. */
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
@@ -2049,7 +2051,7 @@ InvokeImportedNRCmd(
|
||||
|
||||
int
|
||||
TclInvokeImportedCmd(
|
||||
ClientData clientData, /* Points to the imported command's
|
||||
void *clientData, /* Points to the imported command's
|
||||
* ImportedCmdData structure. */
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
@@ -2082,7 +2084,7 @@ TclInvokeImportedCmd(
|
||||
|
||||
static void
|
||||
DeleteImportedCmd(
|
||||
ClientData clientData) /* Points to the imported command's
|
||||
void *clientData) /* Points to the imported command's
|
||||
* ImportedCmdData structure. */
|
||||
{
|
||||
ImportedCmdData *dataPtr = (ImportedCmdData *)clientData;
|
||||
@@ -2636,7 +2638,7 @@ Tcl_FindCommand(
|
||||
cmdPtr = NULL;
|
||||
if (cxtNsPtr->commandPathLength!=0 && strncmp(name, "::", 2)
|
||||
&& !(flags & TCL_NAMESPACE_ONLY)) {
|
||||
size_t i;
|
||||
Tcl_Size i;
|
||||
Namespace *pathNsPtr, *realNsPtr, *dummyNsPtr;
|
||||
|
||||
(void) TclGetNamespaceForQualName(interp, name, cxtNsPtr,
|
||||
@@ -3047,11 +3049,11 @@ NamespaceChildrenCmd(
|
||||
if ((*name == ':') && (*(name+1) == ':')) {
|
||||
pattern = name;
|
||||
} else {
|
||||
Tcl_DStringAppend(&buffer, nsPtr->fullName, -1);
|
||||
Tcl_DStringAppend(&buffer, nsPtr->fullName, TCL_INDEX_NONE);
|
||||
if (nsPtr != globalNsPtr) {
|
||||
TclDStringAppendLiteral(&buffer, "::");
|
||||
}
|
||||
Tcl_DStringAppend(&buffer, name, -1);
|
||||
Tcl_DStringAppend(&buffer, name, TCL_INDEX_NONE);
|
||||
pattern = Tcl_DStringValue(&buffer);
|
||||
}
|
||||
}
|
||||
@@ -3077,7 +3079,7 @@ NamespaceChildrenCmd(
|
||||
#endif
|
||||
) {
|
||||
Tcl_ListObjAppendElement(interp, listPtr,
|
||||
Tcl_NewStringObj(pattern, -1));
|
||||
Tcl_NewStringObj(pattern, TCL_INDEX_NONE));
|
||||
}
|
||||
goto searchDone;
|
||||
}
|
||||
@@ -3093,7 +3095,7 @@ NamespaceChildrenCmd(
|
||||
childNsPtr = (Namespace *)Tcl_GetHashValue(entryPtr);
|
||||
if ((pattern == NULL)
|
||||
|| Tcl_StringMatch(childNsPtr->fullName, pattern)) {
|
||||
elemPtr = Tcl_NewStringObj(childNsPtr->fullName, -1);
|
||||
elemPtr = Tcl_NewStringObj(childNsPtr->fullName, TCL_INDEX_NONE);
|
||||
Tcl_ListObjAppendElement(interp, listPtr, elemPtr);
|
||||
}
|
||||
entryPtr = Tcl_NextHashEntry(&search);
|
||||
@@ -3183,7 +3185,7 @@ NamespaceCodeCmd(
|
||||
if (currNsPtr == (Namespace *) TclGetGlobalNamespace(interp)) {
|
||||
TclNewLiteralStringObj(objPtr, "::");
|
||||
} else {
|
||||
objPtr = Tcl_NewStringObj(currNsPtr->fullName, -1);
|
||||
objPtr = Tcl_NewStringObj(currNsPtr->fullName, TCL_INDEX_NONE);
|
||||
}
|
||||
Tcl_ListObjAppendElement(interp, listPtr, objPtr);
|
||||
|
||||
@@ -3241,7 +3243,7 @@ NamespaceCurrentCmd(
|
||||
if (currNsPtr == (Namespace *) TclGetGlobalNamespace(interp)) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj("::", 2));
|
||||
} else {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(currNsPtr->fullName, -1));
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(currNsPtr->fullName, TCL_INDEX_NONE));
|
||||
}
|
||||
return TCL_OK;
|
||||
}
|
||||
@@ -3356,7 +3358,7 @@ NamespaceDeleteCmd(
|
||||
|
||||
static int
|
||||
NamespaceEvalCmd(
|
||||
ClientData clientData, /* Arbitrary value passed to cmd. */
|
||||
void *clientData, /* Arbitrary value passed to cmd. */
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
@@ -3449,7 +3451,7 @@ NRNamespaceEvalCmd(
|
||||
|
||||
static int
|
||||
NsEval_Callback(
|
||||
ClientData data[],
|
||||
void *data[],
|
||||
Tcl_Interp *interp,
|
||||
int result)
|
||||
{
|
||||
@@ -3805,7 +3807,7 @@ NamespaceImportCmd(
|
||||
|
||||
static int
|
||||
NamespaceInscopeCmd(
|
||||
ClientData clientData, /* Arbitrary value passed to cmd. */
|
||||
void *clientData, /* Arbitrary value passed to cmd. */
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
@@ -3997,7 +3999,7 @@ NamespaceParentCmd(
|
||||
|
||||
if (nsPtr->parentPtr != NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
nsPtr->parentPtr->fullName, -1));
|
||||
nsPtr->parentPtr->fullName, TCL_INDEX_NONE));
|
||||
}
|
||||
return TCL_OK;
|
||||
}
|
||||
@@ -4037,7 +4039,7 @@ NamespacePathCmd(
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Namespace *nsPtr = (Namespace *) TclGetCurrentNamespace(interp);
|
||||
size_t nsObjc, i;
|
||||
Tcl_Size nsObjc, i;
|
||||
int result = TCL_ERROR;
|
||||
Tcl_Obj **nsObjv;
|
||||
Tcl_Namespace **namespaceList = NULL;
|
||||
@@ -4058,7 +4060,7 @@ NamespacePathCmd(
|
||||
for (i=0 ; i<nsPtr->commandPathLength ; i++) {
|
||||
if (nsPtr->commandPathArray[i].nsPtr != NULL) {
|
||||
Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj(
|
||||
nsPtr->commandPathArray[i].nsPtr->fullName, -1));
|
||||
nsPtr->commandPathArray[i].nsPtr->fullName, TCL_INDEX_NONE));
|
||||
}
|
||||
}
|
||||
Tcl_SetObjResult(interp, resultObj);
|
||||
@@ -4121,13 +4123,13 @@ NamespacePathCmd(
|
||||
void
|
||||
TclSetNsPath(
|
||||
Namespace *nsPtr, /* Namespace whose path is to be set. */
|
||||
size_t pathLength, /* Length of pathAry. */
|
||||
Tcl_Size pathLength, /* Length of pathAry. */
|
||||
Tcl_Namespace *pathAry[]) /* Array of namespaces that are the path. */
|
||||
{
|
||||
if (pathLength != 0) {
|
||||
NamespacePathEntry *tmpPathArray =
|
||||
(NamespacePathEntry *)Tcl_Alloc(sizeof(NamespacePathEntry) * pathLength);
|
||||
size_t i;
|
||||
Tcl_Size i;
|
||||
|
||||
for (i=0 ; i<pathLength ; i++) {
|
||||
tmpPathArray[i].nsPtr = (Namespace *) pathAry[i];
|
||||
@@ -4178,7 +4180,7 @@ static void
|
||||
UnlinkNsPath(
|
||||
Namespace *nsPtr)
|
||||
{
|
||||
size_t i;
|
||||
Tcl_Size i;
|
||||
for (i=0 ; i<nsPtr->commandPathLength ; i++) {
|
||||
NamespacePathEntry *nsPathPtr = &nsPtr->commandPathArray[i];
|
||||
|
||||
@@ -4429,7 +4431,7 @@ Tcl_SetNamespaceUnknownHandler(
|
||||
Tcl_Namespace *nsPtr, /* Namespace which is being updated. */
|
||||
Tcl_Obj *handlerPtr) /* The new handler, or NULL to reset. */
|
||||
{
|
||||
size_t lstlen = 0;
|
||||
Tcl_Size lstlen = 0;
|
||||
Namespace *currNsPtr = (Namespace *) nsPtr;
|
||||
|
||||
/*
|
||||
@@ -4542,7 +4544,7 @@ NamespaceTailCmd(
|
||||
}
|
||||
|
||||
if (p >= name) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(p, -1));
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(p, TCL_INDEX_NONE));
|
||||
}
|
||||
return TCL_OK;
|
||||
}
|
||||
@@ -4925,7 +4927,7 @@ TclLogCommandInfo(
|
||||
* command (must be <= command). */
|
||||
const char *command, /* First character in command that generated
|
||||
* the error. */
|
||||
size_t length, /* Number of bytes in command (TCL_INDEX_NONE
|
||||
Tcl_Size length, /* Number of bytes in command (TCL_INDEX_NONE
|
||||
* means use all bytes up to first null byte).
|
||||
*/
|
||||
const unsigned char *pc, /* Current pc of bytecode execution context */
|
||||
@@ -4958,10 +4960,10 @@ TclLogCommandInfo(
|
||||
}
|
||||
}
|
||||
|
||||
if (length == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(length)) {
|
||||
length = strlen(command);
|
||||
}
|
||||
overflow = (length > (size_t)limit);
|
||||
overflow = (length > (Tcl_Size)limit);
|
||||
Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
|
||||
"\n %s\n\"%.*s%s\"", ((iPtr->errorInfo == NULL)
|
||||
? "while executing" : "invoked from within"),
|
||||
@@ -5011,7 +5013,7 @@ TclLogCommandInfo(
|
||||
iPtr->errorStack = newObj;
|
||||
}
|
||||
if (iPtr->resetErrorStack) {
|
||||
size_t len;
|
||||
Tcl_Size len;
|
||||
|
||||
iPtr->resetErrorStack = 0;
|
||||
TclListObjLengthM(interp, iPtr->errorStack, &len);
|
||||
@@ -5083,7 +5085,7 @@ void
|
||||
TclErrorStackResetIf(
|
||||
Tcl_Interp *interp,
|
||||
const char *msg,
|
||||
size_t length)
|
||||
Tcl_Size length)
|
||||
{
|
||||
Interp *iPtr = (Interp *) interp;
|
||||
|
||||
@@ -5096,7 +5098,7 @@ TclErrorStackResetIf(
|
||||
iPtr->errorStack = newObj;
|
||||
}
|
||||
if (iPtr->resetErrorStack) {
|
||||
size_t len;
|
||||
Tcl_Size len;
|
||||
|
||||
iPtr->resetErrorStack = 0;
|
||||
TclListObjLengthM(interp, iPtr->errorStack, &len);
|
||||
@@ -5138,7 +5140,7 @@ Tcl_LogCommandInfo(
|
||||
* command (must be <= command). */
|
||||
const char *command, /* First character in command that generated
|
||||
* the error. */
|
||||
size_t length) /* Number of bytes in command (-1 means use
|
||||
Tcl_Size length) /* Number of bytes in command (-1 means use
|
||||
* all bytes up to first null byte). */
|
||||
{
|
||||
TclLogCommandInfo(interp, script, command, length, NULL, NULL);
|
||||
|
||||
+57
-57
@@ -67,9 +67,9 @@ static int CloneClassMethod(Tcl_Interp *interp, Class *clsPtr,
|
||||
Method **newMPtrPtr);
|
||||
static int CloneObjectMethod(Tcl_Interp *interp, Object *oPtr,
|
||||
Method *mPtr, Tcl_Obj *namePtr);
|
||||
static void DeletedDefineNamespace(ClientData clientData);
|
||||
static void DeletedObjdefNamespace(ClientData clientData);
|
||||
static void DeletedHelpersNamespace(ClientData clientData);
|
||||
static void DeletedDefineNamespace(void *clientData);
|
||||
static void DeletedObjdefNamespace(void *clientData);
|
||||
static void DeletedHelpersNamespace(void *clientData);
|
||||
static Tcl_NRPostProc FinalizeAlloc;
|
||||
static Tcl_NRPostProc FinalizeNext;
|
||||
static Tcl_NRPostProc FinalizeObjectCall;
|
||||
@@ -78,23 +78,23 @@ static void InitClassSystemRoots(Tcl_Interp *interp,
|
||||
Foundation *fPtr);
|
||||
static int InitFoundation(Tcl_Interp *interp);
|
||||
static Tcl_InterpDeleteProc KillFoundation;
|
||||
static void MyDeleted(ClientData clientData);
|
||||
static void ObjectNamespaceDeleted(ClientData clientData);
|
||||
static void MyDeleted(void *clientData);
|
||||
static void ObjectNamespaceDeleted(void *clientData);
|
||||
static Tcl_CommandTraceProc ObjectRenamedTrace;
|
||||
static inline void RemoveClass(Class **list, int num, int idx);
|
||||
static inline void RemoveObject(Object **list, int num, int idx);
|
||||
static inline void RemoveClass(Class **list, size_t num, size_t idx);
|
||||
static inline void RemoveObject(Object **list, size_t num, size_t idx);
|
||||
static inline void SquelchCachedName(Object *oPtr);
|
||||
|
||||
static int PublicNRObjectCmd(ClientData clientData,
|
||||
static int PublicNRObjectCmd(void *clientData,
|
||||
Tcl_Interp *interp, int objc,
|
||||
Tcl_Obj *const *objv);
|
||||
static int PrivateNRObjectCmd(ClientData clientData,
|
||||
static int PrivateNRObjectCmd(void *clientData,
|
||||
Tcl_Interp *interp, int objc,
|
||||
Tcl_Obj *const *objv);
|
||||
static int MyClassNRObjCmd(ClientData clientData,
|
||||
static int MyClassNRObjCmd(void *clientData,
|
||||
Tcl_Interp *interp, int objc,
|
||||
Tcl_Obj *const *objv);
|
||||
static void MyClassDeleted(ClientData clientData);
|
||||
static void MyClassDeleted(void *clientData);
|
||||
|
||||
/*
|
||||
* Methods in the oo::object and oo::class classes. First, we define a helper
|
||||
@@ -201,10 +201,10 @@ MODULE_SCOPE const TclOOStubs tclOOStubs;
|
||||
static inline void
|
||||
RemoveClass(
|
||||
Class **list,
|
||||
int num,
|
||||
int idx)
|
||||
size_t num,
|
||||
size_t idx)
|
||||
{
|
||||
for (; idx < num - 1; idx++) {
|
||||
for (; idx + 1 < num; idx++) {
|
||||
list[idx] = list[idx + 1];
|
||||
}
|
||||
list[idx] = NULL;
|
||||
@@ -213,10 +213,10 @@ RemoveClass(
|
||||
static inline void
|
||||
RemoveObject(
|
||||
Object **list,
|
||||
int num,
|
||||
int idx)
|
||||
size_t num,
|
||||
size_t idx)
|
||||
{
|
||||
for (; idx < num - 1; idx++) {
|
||||
for (; idx + 1 < num; idx++) {
|
||||
list[idx] = list[idx + 1];
|
||||
}
|
||||
list[idx] = NULL;
|
||||
@@ -256,7 +256,7 @@ TclOOInit(
|
||||
* to be fully provided.
|
||||
*/
|
||||
|
||||
if (Tcl_EvalEx(interp, initScript, -1, 0) != TCL_OK) {
|
||||
if (Tcl_EvalEx(interp, initScript, TCL_INDEX_NONE, 0) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
@@ -352,14 +352,14 @@ InitFoundation(
|
||||
Tcl_DStringInit(&buffer);
|
||||
for (i = 0 ; defineCmds[i].name ; i++) {
|
||||
TclDStringAppendLiteral(&buffer, "::oo::define::");
|
||||
Tcl_DStringAppend(&buffer, defineCmds[i].name, -1);
|
||||
Tcl_DStringAppend(&buffer, defineCmds[i].name, TCL_INDEX_NONE);
|
||||
Tcl_CreateObjCommand(interp, Tcl_DStringValue(&buffer),
|
||||
defineCmds[i].objProc, INT2PTR(defineCmds[i].flag), NULL);
|
||||
Tcl_DStringFree(&buffer);
|
||||
}
|
||||
for (i = 0 ; objdefCmds[i].name ; i++) {
|
||||
TclDStringAppendLiteral(&buffer, "::oo::objdefine::");
|
||||
Tcl_DStringAppend(&buffer, objdefCmds[i].name, -1);
|
||||
Tcl_DStringAppend(&buffer, objdefCmds[i].name, TCL_INDEX_NONE);
|
||||
Tcl_CreateObjCommand(interp, Tcl_DStringValue(&buffer),
|
||||
objdefCmds[i].objProc, INT2PTR(objdefCmds[i].flag), NULL);
|
||||
Tcl_DStringFree(&buffer);
|
||||
@@ -429,7 +429,7 @@ InitFoundation(
|
||||
* Evaluate the remaining definitions, which are a compiled-in Tcl script.
|
||||
*/
|
||||
|
||||
return Tcl_EvalEx(interp, tclOOSetupScript, -1, 0);
|
||||
return Tcl_EvalEx(interp, tclOOSetupScript, TCL_INDEX_NONE, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -535,7 +535,7 @@ InitClassSystemRoots(
|
||||
|
||||
static void
|
||||
DeletedDefineNamespace(
|
||||
ClientData clientData)
|
||||
void *clientData)
|
||||
{
|
||||
Foundation *fPtr = (Foundation *)clientData;
|
||||
|
||||
@@ -544,7 +544,7 @@ DeletedDefineNamespace(
|
||||
|
||||
static void
|
||||
DeletedObjdefNamespace(
|
||||
ClientData clientData)
|
||||
void *clientData)
|
||||
{
|
||||
Foundation *fPtr = (Foundation *)clientData;
|
||||
|
||||
@@ -553,7 +553,7 @@ DeletedObjdefNamespace(
|
||||
|
||||
static void
|
||||
DeletedHelpersNamespace(
|
||||
ClientData clientData)
|
||||
void *clientData)
|
||||
{
|
||||
Foundation *fPtr = (Foundation *)clientData;
|
||||
|
||||
@@ -654,7 +654,7 @@ AllocObject(
|
||||
while (1) {
|
||||
char objName[10 + TCL_INTEGER_SPACE];
|
||||
|
||||
sprintf(objName, "::oo::Obj%" TCL_Z_MODIFIER "u", ++fPtr->tsdPtr->nsCount);
|
||||
snprintf(objName, sizeof(objName), "::oo::Obj%" TCL_Z_MODIFIER "u", ++fPtr->tsdPtr->nsCount);
|
||||
oPtr->namespacePtr = Tcl_CreateNamespace(interp, objName, oPtr, NULL);
|
||||
if (oPtr->namespacePtr != NULL) {
|
||||
creationEpoch = fPtr->tsdPtr->nsCount;
|
||||
@@ -789,7 +789,7 @@ SquelchCachedName(
|
||||
|
||||
static void
|
||||
MyDeleted(
|
||||
ClientData clientData) /* Reference to the object whose [my] has been
|
||||
void *clientData) /* Reference to the object whose [my] has been
|
||||
* squelched. */
|
||||
{
|
||||
Object *oPtr = (Object *)clientData;
|
||||
@@ -799,7 +799,7 @@ MyDeleted(
|
||||
|
||||
static void
|
||||
MyClassDeleted(
|
||||
ClientData clientData)
|
||||
void *clientData)
|
||||
{
|
||||
Object *oPtr = (Object *)clientData;
|
||||
oPtr->myclassCommand = NULL;
|
||||
@@ -820,7 +820,7 @@ MyClassDeleted(
|
||||
|
||||
static void
|
||||
ObjectRenamedTrace(
|
||||
ClientData clientData, /* The object being deleted. */
|
||||
void *clientData, /* The object being deleted. */
|
||||
TCL_UNUSED(Tcl_Interp *),
|
||||
TCL_UNUSED(const char *) /*oldName*/,
|
||||
TCL_UNUSED(const char *) /*newName*/,
|
||||
@@ -1038,7 +1038,7 @@ TclOOReleaseClassContents(
|
||||
|
||||
if (clsPtr->metadataPtr != NULL) {
|
||||
Tcl_ObjectMetadataType *metadataTypePtr;
|
||||
ClientData value;
|
||||
void *value;
|
||||
|
||||
FOREACH_HASH(metadataTypePtr, value, clsPtr->metadataPtr) {
|
||||
metadataTypePtr->deleteProc(value);
|
||||
@@ -1110,7 +1110,7 @@ TclOOReleaseClassContents(
|
||||
|
||||
static void
|
||||
ObjectNamespaceDeleted(
|
||||
ClientData clientData) /* Pointer to the class whose namespace is
|
||||
void *clientData) /* Pointer to the class whose namespace is
|
||||
* being deleted. */
|
||||
{
|
||||
Object *oPtr = (Object *)clientData;
|
||||
@@ -1261,7 +1261,7 @@ ObjectNamespaceDeleted(
|
||||
|
||||
if (oPtr->metadataPtr != NULL) {
|
||||
Tcl_ObjectMetadataType *metadataTypePtr;
|
||||
ClientData value;
|
||||
void *value;
|
||||
|
||||
FOREACH_HASH(metadataTypePtr, value, oPtr->metadataPtr) {
|
||||
metadataTypePtr->deleteProc(value);
|
||||
@@ -1675,7 +1675,7 @@ Tcl_NewObjectInstance(
|
||||
{
|
||||
Class *classPtr = (Class *) cls;
|
||||
Object *oPtr;
|
||||
ClientData clientData[4];
|
||||
void *clientData[4];
|
||||
|
||||
oPtr = TclNewObjectInstanceCommon(interp, classPtr, nameStr, nsNameStr);
|
||||
if (oPtr == NULL) {
|
||||
@@ -1687,7 +1687,7 @@ Tcl_NewObjectInstance(
|
||||
* used for object cloning only.
|
||||
*/
|
||||
|
||||
if (objc != TCL_INDEX_NONE) {
|
||||
if (!TCL_SIZE_ISNEG(objc)) {
|
||||
CallContext *contextPtr =
|
||||
TclOOGetCallContext(oPtr, NULL, CONSTRUCTOR, NULL, NULL, NULL);
|
||||
|
||||
@@ -1758,7 +1758,7 @@ TclNRNewObjectInstance(
|
||||
* object cloning only). If there aren't any constructors, we do nothing.
|
||||
*/
|
||||
|
||||
if (objc == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(objc)) {
|
||||
*objectPtr = (Tcl_Object) oPtr;
|
||||
return TCL_OK;
|
||||
}
|
||||
@@ -1854,7 +1854,7 @@ TclNewObjectInstanceCommon(
|
||||
|
||||
static int
|
||||
FinalizeAlloc(
|
||||
ClientData data[],
|
||||
void *data[],
|
||||
Tcl_Interp *interp,
|
||||
int result)
|
||||
{
|
||||
@@ -1870,7 +1870,7 @@ FinalizeAlloc(
|
||||
|
||||
if (result != TCL_ERROR && Destructing(oPtr)) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"object deleted in constructor", -1));
|
||||
"object deleted in constructor", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OO", "STILLBORN", NULL);
|
||||
result = TCL_ERROR;
|
||||
}
|
||||
@@ -1941,7 +1941,7 @@ Tcl_CopyObjectInstance(
|
||||
|
||||
if (IsRootClass(oPtr)) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"may not clone the class of classes", -1));
|
||||
"may not clone the class of classes", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OO", "CLONING_CLASS", NULL);
|
||||
return NULL;
|
||||
}
|
||||
@@ -1951,8 +1951,8 @@ Tcl_CopyObjectInstance(
|
||||
*/
|
||||
|
||||
o2Ptr = (Object *) Tcl_NewObjectInstance(interp,
|
||||
(Tcl_Class) oPtr->selfCls, targetName, targetNamespaceName, -1,
|
||||
NULL, -1);
|
||||
(Tcl_Class) oPtr->selfCls, targetName, targetNamespaceName, TCL_INDEX_NONE,
|
||||
NULL, TCL_INDEX_NONE);
|
||||
if (o2Ptr == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -2037,7 +2037,7 @@ Tcl_CopyObjectInstance(
|
||||
|
||||
if (oPtr->metadataPtr != NULL) {
|
||||
Tcl_ObjectMetadataType *metadataTypePtr;
|
||||
ClientData value, duplicate;
|
||||
void *value, *duplicate;
|
||||
|
||||
FOREACH_HASH(metadataTypePtr, value, oPtr->metadataPtr) {
|
||||
if (metadataTypePtr->cloneProc == NULL) {
|
||||
@@ -2182,7 +2182,7 @@ Tcl_CopyObjectInstance(
|
||||
|
||||
if (clsPtr->metadataPtr != NULL) {
|
||||
Tcl_ObjectMetadataType *metadataTypePtr;
|
||||
ClientData value, duplicate;
|
||||
void *value, *duplicate;
|
||||
|
||||
FOREACH_HASH(metadataTypePtr, value, clsPtr->metadataPtr) {
|
||||
if (metadataTypePtr->cloneProc == NULL) {
|
||||
@@ -2254,7 +2254,7 @@ CloneObjectMethod(
|
||||
TclNewInstanceMethod(interp, (Tcl_Object) oPtr, namePtr,
|
||||
mPtr->flags & PUBLIC_METHOD, NULL, NULL);
|
||||
} else if (mPtr->typePtr->cloneProc) {
|
||||
ClientData newClientData;
|
||||
void *newClientData;
|
||||
|
||||
if (mPtr->typePtr->cloneProc(interp, mPtr->clientData,
|
||||
&newClientData) != TCL_OK) {
|
||||
@@ -2283,7 +2283,7 @@ CloneClassMethod(
|
||||
m2Ptr = (Method *) TclNewMethod(interp, (Tcl_Class) clsPtr,
|
||||
namePtr, mPtr->flags & PUBLIC_METHOD, NULL, NULL);
|
||||
} else if (mPtr->typePtr->cloneProc) {
|
||||
ClientData newClientData;
|
||||
void *newClientData;
|
||||
|
||||
if (mPtr->typePtr->cloneProc(interp, mPtr->clientData,
|
||||
&newClientData) != TCL_OK) {
|
||||
@@ -2329,7 +2329,7 @@ CloneClassMethod(
|
||||
* ----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
ClientData
|
||||
void *
|
||||
Tcl_ClassGetMetadata(
|
||||
Tcl_Class clazz,
|
||||
const Tcl_ObjectMetadataType *typePtr)
|
||||
@@ -2366,7 +2366,7 @@ void
|
||||
Tcl_ClassSetMetadata(
|
||||
Tcl_Class clazz,
|
||||
const Tcl_ObjectMetadataType *typePtr,
|
||||
ClientData metadata)
|
||||
void *metadata)
|
||||
{
|
||||
Class *clsPtr = (Class *) clazz;
|
||||
Tcl_HashEntry *hPtr;
|
||||
@@ -2409,7 +2409,7 @@ Tcl_ClassSetMetadata(
|
||||
Tcl_SetHashValue(hPtr, metadata);
|
||||
}
|
||||
|
||||
ClientData
|
||||
void *
|
||||
Tcl_ObjectGetMetadata(
|
||||
Tcl_Object object,
|
||||
const Tcl_ObjectMetadataType *typePtr)
|
||||
@@ -2446,7 +2446,7 @@ void
|
||||
Tcl_ObjectSetMetadata(
|
||||
Tcl_Object object,
|
||||
const Tcl_ObjectMetadataType *typePtr,
|
||||
ClientData metadata)
|
||||
void *metadata)
|
||||
{
|
||||
Object *oPtr = (Object *) object;
|
||||
Tcl_HashEntry *hPtr;
|
||||
@@ -2504,7 +2504,7 @@ Tcl_ObjectSetMetadata(
|
||||
|
||||
int
|
||||
TclOOPublicObjectCmd(
|
||||
ClientData clientData,
|
||||
void *clientData,
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Obj *const *objv)
|
||||
@@ -2514,7 +2514,7 @@ TclOOPublicObjectCmd(
|
||||
|
||||
static int
|
||||
PublicNRObjectCmd(
|
||||
ClientData clientData,
|
||||
void *clientData,
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Obj *const *objv)
|
||||
@@ -2525,7 +2525,7 @@ PublicNRObjectCmd(
|
||||
|
||||
int
|
||||
TclOOPrivateObjectCmd(
|
||||
ClientData clientData,
|
||||
void *clientData,
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Obj *const *objv)
|
||||
@@ -2535,7 +2535,7 @@ TclOOPrivateObjectCmd(
|
||||
|
||||
static int
|
||||
PrivateNRObjectCmd(
|
||||
ClientData clientData,
|
||||
void *clientData,
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Obj *const *objv)
|
||||
@@ -2586,7 +2586,7 @@ TclOOInvokeObject(
|
||||
|
||||
int
|
||||
TclOOMyClassObjCmd(
|
||||
ClientData clientData,
|
||||
void *clientData,
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Obj *const *objv)
|
||||
@@ -2596,7 +2596,7 @@ TclOOMyClassObjCmd(
|
||||
|
||||
static int
|
||||
MyClassNRObjCmd(
|
||||
ClientData clientData,
|
||||
void *clientData,
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Obj *const *objv)
|
||||
@@ -2627,7 +2627,7 @@ int
|
||||
TclOOObjectCmdCore(
|
||||
Object *oPtr, /* The object being invoked. */
|
||||
Tcl_Interp *interp, /* The interpreter containing the object. */
|
||||
size_t objc, /* How many arguments are being passed in. */
|
||||
Tcl_Size objc, /* How many arguments are being passed in. */
|
||||
Tcl_Obj *const *objv, /* The array of arguments. */
|
||||
int flags, /* Whether this is an invocation through the
|
||||
* public or the private command interface. */
|
||||
@@ -2749,7 +2749,7 @@ TclOOObjectCmdCore(
|
||||
}
|
||||
if (contextPtr->index >= contextPtr->callPtr->numChain) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"no valid method implementation", -1));
|
||||
"no valid method implementation", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "METHOD",
|
||||
TclGetString(methodNamePtr), NULL);
|
||||
TclOODeleteContext(contextPtr);
|
||||
@@ -2768,7 +2768,7 @@ TclOOObjectCmdCore(
|
||||
|
||||
static int
|
||||
FinalizeObjectCall(
|
||||
ClientData data[],
|
||||
void *data[],
|
||||
TCL_UNUSED(Tcl_Interp *),
|
||||
int result)
|
||||
{
|
||||
@@ -2929,7 +2929,7 @@ TclNRObjectContextInvokeNext(
|
||||
|
||||
static int
|
||||
FinalizeNext(
|
||||
ClientData data[],
|
||||
void *data[],
|
||||
TCL_UNUSED(Tcl_Interp *),
|
||||
int result)
|
||||
{
|
||||
|
||||
+11
-11
@@ -68,8 +68,8 @@ declare 12 {
|
||||
}
|
||||
declare 13 {
|
||||
Tcl_Object Tcl_NewObjectInstance(Tcl_Interp *interp, Tcl_Class cls,
|
||||
const char *nameStr, const char *nsNameStr, size_t objc,
|
||||
Tcl_Obj *const *objv, size_t skip)
|
||||
const char *nameStr, const char *nsNameStr, Tcl_Size objc,
|
||||
Tcl_Obj *const *objv, Tcl_Size skip)
|
||||
}
|
||||
declare 14 {
|
||||
int Tcl_ObjectDeleted(Tcl_Object object)
|
||||
@@ -84,7 +84,7 @@ declare 17 {
|
||||
Tcl_Object Tcl_ObjectContextObject(Tcl_ObjectContext context)
|
||||
}
|
||||
declare 18 {
|
||||
size_t Tcl_ObjectContextSkippedArgs(Tcl_ObjectContext context)
|
||||
Tcl_Size Tcl_ObjectContextSkippedArgs(Tcl_ObjectContext context)
|
||||
}
|
||||
declare 19 {
|
||||
void *Tcl_ClassGetMetadata(Tcl_Class clazz,
|
||||
@@ -104,8 +104,8 @@ declare 22 {
|
||||
}
|
||||
declare 23 {
|
||||
int Tcl_ObjectContextInvokeNext(Tcl_Interp *interp,
|
||||
Tcl_ObjectContext context, size_t objc, Tcl_Obj *const *objv,
|
||||
size_t skip)
|
||||
Tcl_ObjectContext context, Tcl_Size objc, Tcl_Obj *const *objv,
|
||||
Tcl_Size skip)
|
||||
}
|
||||
declare 24 {
|
||||
Tcl_ObjectMapMethodNameProc *Tcl_ObjectGetMethodNameMapper(
|
||||
@@ -184,7 +184,7 @@ declare 4 {
|
||||
ProcedureMethod **pmPtrPtr)
|
||||
}
|
||||
declare 5 {
|
||||
int TclOOObjectCmdCore(Object *oPtr, Tcl_Interp *interp, size_t objc,
|
||||
int TclOOObjectCmdCore(Object *oPtr, Tcl_Interp *interp, Tcl_Size objc,
|
||||
Tcl_Obj *const *objv, int publicOnly, Class *startCls)
|
||||
}
|
||||
declare 6 {
|
||||
@@ -214,24 +214,24 @@ declare 10 {
|
||||
}
|
||||
declare 11 {
|
||||
int TclOOInvokeObject(Tcl_Interp *interp, Tcl_Object object,
|
||||
Tcl_Class startCls, int publicPrivate, size_t objc,
|
||||
Tcl_Class startCls, int publicPrivate, Tcl_Size objc,
|
||||
Tcl_Obj *const *objv)
|
||||
}
|
||||
declare 12 {
|
||||
void TclOOObjectSetFilters(Object *oPtr, size_t numFilters,
|
||||
void TclOOObjectSetFilters(Object *oPtr, Tcl_Size numFilters,
|
||||
Tcl_Obj *const *filters)
|
||||
}
|
||||
declare 13 {
|
||||
void TclOOClassSetFilters(Tcl_Interp *interp, Class *classPtr,
|
||||
size_t numFilters, Tcl_Obj *const *filters)
|
||||
Tcl_Size numFilters, Tcl_Obj *const *filters)
|
||||
}
|
||||
declare 14 {
|
||||
void TclOOObjectSetMixins(Object *oPtr, size_t numMixins,
|
||||
void TclOOObjectSetMixins(Object *oPtr, Tcl_Size numMixins,
|
||||
Class *const *mixins)
|
||||
}
|
||||
declare 15 {
|
||||
void TclOOClassSetMixins(Tcl_Interp *interp, Class *classPtr,
|
||||
size_t numMixins, Class *const *mixins)
|
||||
Tcl_Size numMixins, Class *const *mixins)
|
||||
}
|
||||
|
||||
return
|
||||
|
||||
+44
-42
@@ -52,7 +52,7 @@ AddConstructionFinalizer(
|
||||
|
||||
static int
|
||||
FinalizeConstruction(
|
||||
ClientData data[],
|
||||
void *data[],
|
||||
Tcl_Interp *interp,
|
||||
int result)
|
||||
{
|
||||
@@ -86,11 +86,12 @@ TclOO_Class_Constructor(
|
||||
Object *oPtr = (Object *) Tcl_ObjectContextObject(context);
|
||||
Tcl_Obj **invoke, *nameObj;
|
||||
|
||||
if (objc-1 > (int)Tcl_ObjectContextSkippedArgs(context)) {
|
||||
Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv,
|
||||
size_t skip = Tcl_ObjectContextSkippedArgs(context);
|
||||
if ((size_t)objc > skip + 1) {
|
||||
Tcl_WrongNumArgs(interp, skip, objv,
|
||||
"?definitionScript?");
|
||||
return TCL_ERROR;
|
||||
} else if (objc == (int)Tcl_ObjectContextSkippedArgs(context)) {
|
||||
} else if ((size_t)objc == skip) {
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
@@ -99,10 +100,10 @@ TclOO_Class_Constructor(
|
||||
* here (and the class definition delegate doesn't run any constructors).
|
||||
*/
|
||||
|
||||
nameObj = Tcl_NewStringObj(oPtr->namespacePtr->fullName, -1);
|
||||
Tcl_AppendToObj(nameObj, ":: oo ::delegate", -1);
|
||||
nameObj = Tcl_NewStringObj(oPtr->namespacePtr->fullName, TCL_INDEX_NONE);
|
||||
Tcl_AppendToObj(nameObj, ":: oo ::delegate", TCL_INDEX_NONE);
|
||||
Tcl_NewObjectInstance(interp, (Tcl_Class) oPtr->fPtr->classCls,
|
||||
TclGetString(nameObj), NULL, -1, NULL, -1);
|
||||
TclGetString(nameObj), NULL, TCL_INDEX_NONE, NULL, TCL_INDEX_NONE);
|
||||
Tcl_DecrRefCount(nameObj);
|
||||
|
||||
/*
|
||||
@@ -135,7 +136,7 @@ TclOO_Class_Constructor(
|
||||
|
||||
static int
|
||||
DecrRefsPostClassConstructor(
|
||||
ClientData data[],
|
||||
void *data[],
|
||||
Tcl_Interp *interp,
|
||||
int result)
|
||||
{
|
||||
@@ -147,7 +148,7 @@ DecrRefsPostClassConstructor(
|
||||
TclDecrRefCount(invoke[0]);
|
||||
TclDecrRefCount(invoke[1]);
|
||||
TclDecrRefCount(invoke[2]);
|
||||
invoke[0] = Tcl_NewStringObj("::oo::MixinClassDelegates", -1);
|
||||
invoke[0] = Tcl_NewStringObj("::oo::MixinClassDelegates", TCL_INDEX_NONE);
|
||||
invoke[1] = TclOOObjectName(interp, oPtr);
|
||||
Tcl_IncrRefCount(invoke[0]);
|
||||
Tcl_IncrRefCount(invoke[1]);
|
||||
@@ -204,7 +205,7 @@ TclOO_Class_Create(
|
||||
* Check we have the right number of (sensible) arguments.
|
||||
*/
|
||||
|
||||
if (objc - Tcl_ObjectContextSkippedArgs(context) < 1) {
|
||||
if ((size_t)objc < 1 + Tcl_ObjectContextSkippedArgs(context)) {
|
||||
Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv,
|
||||
"objectName ?arg ...?");
|
||||
return TCL_ERROR;
|
||||
@@ -213,7 +214,7 @@ TclOO_Class_Create(
|
||||
objv[Tcl_ObjectContextSkippedArgs(context)], &len);
|
||||
if (len == 0) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"object name must not be empty", -1));
|
||||
"object name must not be empty", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OO", "EMPTY_NAME", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -269,7 +270,7 @@ TclOO_Class_CreateNs(
|
||||
* Check we have the right number of (sensible) arguments.
|
||||
*/
|
||||
|
||||
if (objc - Tcl_ObjectContextSkippedArgs(context) < 2) {
|
||||
if ((size_t)objc + 1 < Tcl_ObjectContextSkippedArgs(context) + 3) {
|
||||
Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv,
|
||||
"objectName namespaceName ?arg ...?");
|
||||
return TCL_ERROR;
|
||||
@@ -278,7 +279,7 @@ TclOO_Class_CreateNs(
|
||||
objv[Tcl_ObjectContextSkippedArgs(context)], &len);
|
||||
if (len == 0) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"object name must not be empty", -1));
|
||||
"object name must not be empty", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OO", "EMPTY_NAME", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -286,7 +287,7 @@ TclOO_Class_CreateNs(
|
||||
objv[Tcl_ObjectContextSkippedArgs(context)+1], &len);
|
||||
if (len == 0) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"namespace name must not be empty", -1));
|
||||
"namespace name must not be empty", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OO", "EMPTY_NAME", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -393,7 +394,7 @@ TclOO_Object_Destroy(
|
||||
|
||||
static int
|
||||
AfterNRDestructor(
|
||||
ClientData data[],
|
||||
void *data[],
|
||||
Tcl_Interp *interp,
|
||||
int result)
|
||||
{
|
||||
@@ -427,12 +428,12 @@ TclOO_Object_Eval(
|
||||
{
|
||||
CallContext *contextPtr = (CallContext *) context;
|
||||
Tcl_Object object = Tcl_ObjectContextObject(context);
|
||||
const int skip = Tcl_ObjectContextSkippedArgs(context);
|
||||
size_t skip = Tcl_ObjectContextSkippedArgs(context);
|
||||
CallFrame *framePtr, **framePtrPtr = &framePtr;
|
||||
Tcl_Obj *scriptPtr;
|
||||
CmdFrame *invoker;
|
||||
|
||||
if (objc-1 < skip) {
|
||||
if ((size_t)objc < skip + 1) {
|
||||
Tcl_WrongNumArgs(interp, skip, objv, "arg ?arg ...?");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -460,7 +461,7 @@ TclOO_Object_Eval(
|
||||
* object when it decrements its refcount after eval'ing it.
|
||||
*/
|
||||
|
||||
if (objc != skip+1) {
|
||||
if ((size_t)objc != skip+1) {
|
||||
scriptPtr = Tcl_ConcatObj(objc-skip, objv+skip);
|
||||
invoker = NULL;
|
||||
} else {
|
||||
@@ -479,7 +480,7 @@ TclOO_Object_Eval(
|
||||
|
||||
static int
|
||||
FinalizeEval(
|
||||
ClientData data[],
|
||||
void *data[],
|
||||
Tcl_Interp *interp,
|
||||
int result)
|
||||
{
|
||||
@@ -531,7 +532,8 @@ TclOO_Object_Unknown(
|
||||
Class *callerCls = NULL;
|
||||
Object *oPtr = contextPtr->oPtr;
|
||||
const char **methodNames;
|
||||
int numMethodNames, i, skip = Tcl_ObjectContextSkippedArgs(context);
|
||||
int numMethodNames, i;
|
||||
size_t skip = Tcl_ObjectContextSkippedArgs(context);
|
||||
CallFrame *framePtr = ((Interp *) interp)->varFramePtr;
|
||||
Tcl_Obj *errorMsg;
|
||||
|
||||
@@ -541,7 +543,7 @@ TclOO_Object_Unknown(
|
||||
* name without an error).
|
||||
*/
|
||||
|
||||
if (objc < skip+1) {
|
||||
if ((size_t)objc < skip+1) {
|
||||
Tcl_WrongNumArgs(interp, skip, objv, "method ?arg ...?");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -598,14 +600,14 @@ TclOO_Object_Unknown(
|
||||
TclGetString(objv[skip]));
|
||||
for (i=0 ; i<numMethodNames-1 ; i++) {
|
||||
if (i) {
|
||||
Tcl_AppendToObj(errorMsg, ", ", -1);
|
||||
Tcl_AppendToObj(errorMsg, ", ", TCL_INDEX_NONE);
|
||||
}
|
||||
Tcl_AppendToObj(errorMsg, methodNames[i], -1);
|
||||
Tcl_AppendToObj(errorMsg, methodNames[i], TCL_INDEX_NONE);
|
||||
}
|
||||
if (i) {
|
||||
Tcl_AppendToObj(errorMsg, " or ", -1);
|
||||
Tcl_AppendToObj(errorMsg, " or ", TCL_INDEX_NONE);
|
||||
}
|
||||
Tcl_AppendToObj(errorMsg, methodNames[i], -1);
|
||||
Tcl_AppendToObj(errorMsg, methodNames[i], TCL_INDEX_NONE);
|
||||
Tcl_Free((void *)methodNames);
|
||||
Tcl_SetObjResult(interp, errorMsg);
|
||||
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "METHOD",
|
||||
@@ -635,7 +637,7 @@ TclOO_Object_LinkVar(
|
||||
Interp *iPtr = (Interp *) interp;
|
||||
Tcl_Object object = Tcl_ObjectContextObject(context);
|
||||
Namespace *savedNsPtr;
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
if ((size_t)objc < Tcl_ObjectContextSkippedArgs(context)) {
|
||||
Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv,
|
||||
@@ -653,7 +655,7 @@ TclOO_Object_LinkVar(
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
for (i=Tcl_ObjectContextSkippedArgs(context) ; i<objc ; i++) {
|
||||
for (i = Tcl_ObjectContextSkippedArgs(context) ; i < (size_t)objc ; i++) {
|
||||
Var *varPtr, *aryPtr;
|
||||
const char *varName = TclGetString(objv[i]);
|
||||
|
||||
@@ -814,7 +816,7 @@ TclOO_Object_VarName(
|
||||
}
|
||||
}
|
||||
|
||||
varNamePtr = Tcl_NewStringObj(namespacePtr->fullName, -1);
|
||||
varNamePtr = Tcl_NewStringObj(namespacePtr->fullName, TCL_INDEX_NONE);
|
||||
Tcl_AppendToObj(varNamePtr, "::", 2);
|
||||
Tcl_AppendObjToObj(varNamePtr, argPtr);
|
||||
}
|
||||
@@ -840,10 +842,10 @@ TclOO_Object_VarName(
|
||||
* WARNING! This code pokes inside the implementation of hash tables!
|
||||
*/
|
||||
|
||||
Tcl_AppendToObj(varNamePtr, "(", -1);
|
||||
Tcl_AppendToObj(varNamePtr, "(", TCL_INDEX_NONE);
|
||||
Tcl_AppendObjToObj(varNamePtr, ((VarInHash *)
|
||||
varPtr)->entry.key.objPtr);
|
||||
Tcl_AppendToObj(varNamePtr, ")", -1);
|
||||
Tcl_AppendToObj(varNamePtr, ")", TCL_INDEX_NONE);
|
||||
} else {
|
||||
Tcl_GetVariableFullName(interp, (Tcl_Var) varPtr, varNamePtr);
|
||||
}
|
||||
@@ -986,7 +988,7 @@ TclOONextToObjCmd(
|
||||
methodType = "method";
|
||||
}
|
||||
|
||||
for (i=contextPtr->index ; i != TCL_INDEX_NONE ; i--) {
|
||||
for (i=contextPtr->index ; !TCL_SIZE_ISNEG(i) ; i--) {
|
||||
struct MInvoke *miPtr = contextPtr->callPtr->chain + i;
|
||||
|
||||
if (!miPtr->isFilter && miPtr->mPtr->declaringClassPtr == classPtr) {
|
||||
@@ -1007,7 +1009,7 @@ TclOONextToObjCmd(
|
||||
|
||||
static int
|
||||
NextRestoreFrame(
|
||||
ClientData data[],
|
||||
void *data[],
|
||||
Tcl_Interp *interp,
|
||||
int result)
|
||||
{
|
||||
@@ -1016,7 +1018,7 @@ NextRestoreFrame(
|
||||
|
||||
iPtr->varFramePtr = (CallFrame *)data[0];
|
||||
if (contextPtr != NULL) {
|
||||
contextPtr->index = PTR2INT(data[2]);
|
||||
contextPtr->index = PTR2UINT(data[2]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -1090,14 +1092,14 @@ TclOOSelfObjCmd(
|
||||
return TCL_OK;
|
||||
case SELF_NS:
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
contextPtr->oPtr->namespacePtr->fullName,-1));
|
||||
contextPtr->oPtr->namespacePtr->fullName, TCL_INDEX_NONE));
|
||||
return TCL_OK;
|
||||
case SELF_CLASS: {
|
||||
Class *clsPtr = CurrentlyInvoked(contextPtr).mPtr->declaringClassPtr;
|
||||
|
||||
if (clsPtr == NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"method not defined by a class", -1));
|
||||
"method not defined by a class", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OO", "UNMATCHED_CONTEXT", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -1118,7 +1120,7 @@ TclOOSelfObjCmd(
|
||||
case SELF_FILTER:
|
||||
if (!CurrentlyInvoked(contextPtr).isFilter) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"not inside a filtering context", -1));
|
||||
"not inside a filtering context", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OO", "UNMATCHED_CONTEXT", NULL);
|
||||
return TCL_ERROR;
|
||||
} else {
|
||||
@@ -1135,7 +1137,7 @@ TclOOSelfObjCmd(
|
||||
}
|
||||
|
||||
result[0] = TclOOObjectName(interp, oPtr);
|
||||
result[1] = Tcl_NewStringObj(type, -1);
|
||||
result[1] = Tcl_NewStringObj(type, TCL_INDEX_NONE);
|
||||
result[2] = miPtr->mPtr->namePtr;
|
||||
Tcl_SetObjResult(interp, Tcl_NewListObj(3, result));
|
||||
return TCL_OK;
|
||||
@@ -1144,7 +1146,7 @@ TclOOSelfObjCmd(
|
||||
if ((framePtr->callerVarPtr == NULL) ||
|
||||
!(framePtr->callerVarPtr->isProcCallFrame & FRAME_IS_METHOD)){
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"caller is not an object", -1));
|
||||
"caller is not an object", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OO", "CONTEXT_REQUIRED", NULL);
|
||||
return TCL_ERROR;
|
||||
} else {
|
||||
@@ -1162,7 +1164,7 @@ TclOOSelfObjCmd(
|
||||
*/
|
||||
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"method without declarer!", -1));
|
||||
"method without declarer!", TCL_INDEX_NONE));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
@@ -1194,7 +1196,7 @@ TclOOSelfObjCmd(
|
||||
*/
|
||||
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"method without declarer!", -1));
|
||||
"method without declarer!", TCL_INDEX_NONE));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
@@ -1212,7 +1214,7 @@ TclOOSelfObjCmd(
|
||||
case SELF_TARGET:
|
||||
if (!CurrentlyInvoked(contextPtr).isFilter) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"not inside a filtering context", -1));
|
||||
"not inside a filtering context", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OO", "UNMATCHED_CONTEXT", NULL);
|
||||
return TCL_ERROR;
|
||||
} else {
|
||||
@@ -1239,7 +1241,7 @@ TclOOSelfObjCmd(
|
||||
*/
|
||||
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"method without declarer!", -1));
|
||||
"method without declarer!", TCL_INDEX_NONE));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
result[0] = TclOOObjectName(interp, declarerPtr);
|
||||
|
||||
+1
-1
@@ -1848,7 +1848,7 @@ TclOORenderCallChain(
|
||||
? Tcl_GetObjectName(interp,
|
||||
(Tcl_Object) miPtr->mPtr->declaringClassPtr->thisPtr)
|
||||
: objectLiteral;
|
||||
descObjs[3] = Tcl_NewStringObj(miPtr->mPtr->typePtr->name, -1);
|
||||
descObjs[3] = Tcl_NewStringObj(miPtr->mPtr->typePtr->name, TCL_INDEX_NONE);
|
||||
|
||||
objv[i] = Tcl_NewListObj(4, descObjs);
|
||||
}
|
||||
|
||||
@@ -69,8 +69,8 @@ TCLAPI Tcl_Method Tcl_NewMethod(Tcl_Interp *interp, Tcl_Class cls,
|
||||
/* 13 */
|
||||
TCLAPI Tcl_Object Tcl_NewObjectInstance(Tcl_Interp *interp,
|
||||
Tcl_Class cls, const char *nameStr,
|
||||
const char *nsNameStr, size_t objc,
|
||||
Tcl_Obj *const *objv, size_t skip);
|
||||
const char *nsNameStr, Tcl_Size objc,
|
||||
Tcl_Obj *const *objv, Tcl_Size skip);
|
||||
/* 14 */
|
||||
TCLAPI int Tcl_ObjectDeleted(Tcl_Object object);
|
||||
/* 15 */
|
||||
@@ -81,7 +81,7 @@ TCLAPI Tcl_Method Tcl_ObjectContextMethod(Tcl_ObjectContext context);
|
||||
/* 17 */
|
||||
TCLAPI Tcl_Object Tcl_ObjectContextObject(Tcl_ObjectContext context);
|
||||
/* 18 */
|
||||
TCLAPI size_t Tcl_ObjectContextSkippedArgs(
|
||||
TCLAPI Tcl_Size Tcl_ObjectContextSkippedArgs(
|
||||
Tcl_ObjectContext context);
|
||||
/* 19 */
|
||||
TCLAPI void * Tcl_ClassGetMetadata(Tcl_Class clazz,
|
||||
@@ -99,8 +99,8 @@ TCLAPI void Tcl_ObjectSetMetadata(Tcl_Object object,
|
||||
void *metadata);
|
||||
/* 23 */
|
||||
TCLAPI int Tcl_ObjectContextInvokeNext(Tcl_Interp *interp,
|
||||
Tcl_ObjectContext context, size_t objc,
|
||||
Tcl_Obj *const *objv, size_t skip);
|
||||
Tcl_ObjectContext context, Tcl_Size objc,
|
||||
Tcl_Obj *const *objv, Tcl_Size skip);
|
||||
/* 24 */
|
||||
TCLAPI Tcl_ObjectMapMethodNameProc * Tcl_ObjectGetMethodNameMapper(
|
||||
Tcl_Object object);
|
||||
@@ -159,17 +159,17 @@ typedef struct TclOOStubs {
|
||||
Tcl_Obj * (*tcl_MethodName) (Tcl_Method method); /* 10 */
|
||||
Tcl_Method (*tcl_NewInstanceMethod) (Tcl_Interp *interp, Tcl_Object object, Tcl_Obj *nameObj, int flags, const Tcl_MethodType *typePtr, void *clientData); /* 11 */
|
||||
Tcl_Method (*tcl_NewMethod) (Tcl_Interp *interp, Tcl_Class cls, Tcl_Obj *nameObj, int flags, const Tcl_MethodType *typePtr, void *clientData); /* 12 */
|
||||
Tcl_Object (*tcl_NewObjectInstance) (Tcl_Interp *interp, Tcl_Class cls, const char *nameStr, const char *nsNameStr, size_t objc, Tcl_Obj *const *objv, size_t skip); /* 13 */
|
||||
Tcl_Object (*tcl_NewObjectInstance) (Tcl_Interp *interp, Tcl_Class cls, const char *nameStr, const char *nsNameStr, Tcl_Size objc, Tcl_Obj *const *objv, Tcl_Size skip); /* 13 */
|
||||
int (*tcl_ObjectDeleted) (Tcl_Object object); /* 14 */
|
||||
int (*tcl_ObjectContextIsFiltering) (Tcl_ObjectContext context); /* 15 */
|
||||
Tcl_Method (*tcl_ObjectContextMethod) (Tcl_ObjectContext context); /* 16 */
|
||||
Tcl_Object (*tcl_ObjectContextObject) (Tcl_ObjectContext context); /* 17 */
|
||||
size_t (*tcl_ObjectContextSkippedArgs) (Tcl_ObjectContext context); /* 18 */
|
||||
Tcl_Size (*tcl_ObjectContextSkippedArgs) (Tcl_ObjectContext context); /* 18 */
|
||||
void * (*tcl_ClassGetMetadata) (Tcl_Class clazz, const Tcl_ObjectMetadataType *typePtr); /* 19 */
|
||||
void (*tcl_ClassSetMetadata) (Tcl_Class clazz, const Tcl_ObjectMetadataType *typePtr, void *metadata); /* 20 */
|
||||
void * (*tcl_ObjectGetMetadata) (Tcl_Object object, const Tcl_ObjectMetadataType *typePtr); /* 21 */
|
||||
void (*tcl_ObjectSetMetadata) (Tcl_Object object, const Tcl_ObjectMetadataType *typePtr, void *metadata); /* 22 */
|
||||
int (*tcl_ObjectContextInvokeNext) (Tcl_Interp *interp, Tcl_ObjectContext context, size_t objc, Tcl_Obj *const *objv, size_t skip); /* 23 */
|
||||
int (*tcl_ObjectContextInvokeNext) (Tcl_Interp *interp, Tcl_ObjectContext context, Tcl_Size objc, Tcl_Obj *const *objv, Tcl_Size skip); /* 23 */
|
||||
Tcl_ObjectMapMethodNameProc * (*tcl_ObjectGetMethodNameMapper) (Tcl_Object object); /* 24 */
|
||||
void (*tcl_ObjectSetMethodNameMapper) (Tcl_Object object, Tcl_ObjectMapMethodNameProc *mapMethodNameProc); /* 25 */
|
||||
void (*tcl_ClassSetConstructor) (Tcl_Interp *interp, Tcl_Class clazz, Tcl_Method method); /* 26 */
|
||||
|
||||
+56
-56
@@ -78,49 +78,49 @@ static inline void RecomputeClassCacheFlag(Object *oPtr);
|
||||
static int RenameDeleteMethod(Tcl_Interp *interp, Object *oPtr,
|
||||
int useClass, Tcl_Obj *const fromPtr,
|
||||
Tcl_Obj *const toPtr);
|
||||
static int ClassFilterGet(ClientData clientData,
|
||||
static int ClassFilterGet(void *clientData,
|
||||
Tcl_Interp *interp, Tcl_ObjectContext context,
|
||||
int objc, Tcl_Obj *const *objv);
|
||||
static int ClassFilterSet(ClientData clientData,
|
||||
static int ClassFilterSet(void *clientData,
|
||||
Tcl_Interp *interp, Tcl_ObjectContext context,
|
||||
int objc, Tcl_Obj *const *objv);
|
||||
static int ClassMixinGet(ClientData clientData,
|
||||
static int ClassMixinGet(void *clientData,
|
||||
Tcl_Interp *interp, Tcl_ObjectContext context,
|
||||
int objc, Tcl_Obj *const *objv);
|
||||
static int ClassMixinSet(ClientData clientData,
|
||||
static int ClassMixinSet(void *clientData,
|
||||
Tcl_Interp *interp, Tcl_ObjectContext context,
|
||||
int objc, Tcl_Obj *const *objv);
|
||||
static int ClassSuperGet(ClientData clientData,
|
||||
static int ClassSuperGet(void *clientData,
|
||||
Tcl_Interp *interp, Tcl_ObjectContext context,
|
||||
int objc, Tcl_Obj *const *objv);
|
||||
static int ClassSuperSet(ClientData clientData,
|
||||
static int ClassSuperSet(void *clientData,
|
||||
Tcl_Interp *interp, Tcl_ObjectContext context,
|
||||
int objc, Tcl_Obj *const *objv);
|
||||
static int ClassVarsGet(ClientData clientData,
|
||||
static int ClassVarsGet(void *clientData,
|
||||
Tcl_Interp *interp, Tcl_ObjectContext context,
|
||||
int objc, Tcl_Obj *const *objv);
|
||||
static int ClassVarsSet(ClientData clientData,
|
||||
static int ClassVarsSet(void *clientData,
|
||||
Tcl_Interp *interp, Tcl_ObjectContext context,
|
||||
int objc, Tcl_Obj *const *objv);
|
||||
static int ObjFilterGet(ClientData clientData,
|
||||
static int ObjFilterGet(void *clientData,
|
||||
Tcl_Interp *interp, Tcl_ObjectContext context,
|
||||
int objc, Tcl_Obj *const *objv);
|
||||
static int ObjFilterSet(ClientData clientData,
|
||||
static int ObjFilterSet(void *clientData,
|
||||
Tcl_Interp *interp, Tcl_ObjectContext context,
|
||||
int objc, Tcl_Obj *const *objv);
|
||||
static int ObjMixinGet(ClientData clientData,
|
||||
static int ObjMixinGet(void *clientData,
|
||||
Tcl_Interp *interp, Tcl_ObjectContext context,
|
||||
int objc, Tcl_Obj *const *objv);
|
||||
static int ObjMixinSet(ClientData clientData,
|
||||
static int ObjMixinSet(void *clientData,
|
||||
Tcl_Interp *interp, Tcl_ObjectContext context,
|
||||
int objc, Tcl_Obj *const *objv);
|
||||
static int ObjVarsGet(ClientData clientData,
|
||||
static int ObjVarsGet(void *clientData,
|
||||
Tcl_Interp *interp, Tcl_ObjectContext context,
|
||||
int objc, Tcl_Obj *const *objv);
|
||||
static int ObjVarsSet(ClientData clientData,
|
||||
static int ObjVarsSet(void *clientData,
|
||||
Tcl_Interp *interp, Tcl_ObjectContext context,
|
||||
int objc, Tcl_Obj *const *objv);
|
||||
static int ResolveClass(ClientData clientData,
|
||||
static int ResolveClass(void *clientData,
|
||||
Tcl_Interp *interp, Tcl_ObjectContext context,
|
||||
int objc, Tcl_Obj *const *objv);
|
||||
|
||||
@@ -633,7 +633,7 @@ RenameDeleteMethod(
|
||||
if (hPtr == newHPtr) {
|
||||
renameToSelf:
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"cannot rename method to itself", -1));
|
||||
"cannot rename method to itself", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OO", "RENAME_TO_SELF", NULL);
|
||||
return TCL_ERROR;
|
||||
} else if (!isNew) {
|
||||
@@ -709,7 +709,7 @@ TclOOUnknownDefinition(
|
||||
|
||||
if (objc < 2) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"bad call of unknown handler", -1));
|
||||
"bad call of unknown handler", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OO", "BAD_UNKNOWN", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -743,7 +743,7 @@ TclOOUnknownDefinition(
|
||||
TclStackAlloc(interp, sizeof(Tcl_Obj*) * (objc - 1));
|
||||
int result;
|
||||
|
||||
newObjv[0] = Tcl_NewStringObj(matchedStr, -1);
|
||||
newObjv[0] = Tcl_NewStringObj(matchedStr, TCL_INDEX_NONE);
|
||||
Tcl_IncrRefCount(newObjv[0]);
|
||||
if (objc > 2) {
|
||||
memcpy(newObjv + 1, objv + 2, sizeof(Tcl_Obj *) * (objc - 2));
|
||||
@@ -846,7 +846,7 @@ InitDefineContext(
|
||||
|
||||
if (namespacePtr == NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"no definition namespace available", -1));
|
||||
"no definition namespace available", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -887,7 +887,7 @@ TclOOGetDefineCmdContext(
|
||||
&& iPtr->varFramePtr->isProcCallFrame != PRIVATE_FRAME)) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"this command may only be called from within the context of"
|
||||
" an ::oo::define or ::oo::objdefine command", -1));
|
||||
" an ::oo::define or ::oo::objdefine command", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
|
||||
return NULL;
|
||||
}
|
||||
@@ -895,7 +895,7 @@ TclOOGetDefineCmdContext(
|
||||
if (Tcl_ObjectDeleted(object)) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"this command cannot be called when the object has been"
|
||||
" deleted", -1));
|
||||
" deleted", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
|
||||
return NULL;
|
||||
}
|
||||
@@ -938,7 +938,7 @@ GetClassInOuterContext(
|
||||
return NULL;
|
||||
}
|
||||
if (oPtr->classPtr == NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(errMsg, -1));
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(errMsg, TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "CLASS",
|
||||
TclGetString(className), NULL);
|
||||
return NULL;
|
||||
@@ -1344,7 +1344,7 @@ TclOODefineObjSelfObjCmd(
|
||||
|
||||
int
|
||||
TclOODefinePrivateObjCmd(
|
||||
ClientData clientData,
|
||||
void *clientData,
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Obj *const *objv)
|
||||
@@ -1437,13 +1437,13 @@ TclOODefineClassObjCmd(
|
||||
}
|
||||
if (oPtr->flags & ROOT_OBJECT) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"may not modify the class of the root object class", -1));
|
||||
"may not modify the class of the root object class", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (oPtr->flags & ROOT_CLASS) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"may not modify the class of the class of classes", -1));
|
||||
"may not modify the class of the class of classes", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -1463,7 +1463,7 @@ TclOODefineClassObjCmd(
|
||||
}
|
||||
if (oPtr == clsPtr->thisPtr) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"may not change classes into an instance of themselves", -1));
|
||||
"may not change classes into an instance of themselves", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -1616,7 +1616,7 @@ TclOODefineDefnNsObjCmd(
|
||||
}
|
||||
if (!oPtr->classPtr) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"attempt to misuse API", -1));
|
||||
"attempt to misuse API", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -1647,7 +1647,7 @@ TclOODefineDefnNsObjCmd(
|
||||
if (nsPtr == NULL) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
nsNamePtr = Tcl_NewStringObj(nsPtr->fullName, -1);
|
||||
nsNamePtr = Tcl_NewStringObj(nsPtr->fullName, TCL_INDEX_NONE);
|
||||
Tcl_IncrRefCount(nsNamePtr);
|
||||
}
|
||||
|
||||
@@ -1680,7 +1680,7 @@ TclOODefineDefnNsObjCmd(
|
||||
|
||||
int
|
||||
TclOODefineDeleteMethodObjCmd(
|
||||
ClientData clientData,
|
||||
void *clientData,
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Obj *const *objv)
|
||||
@@ -1700,7 +1700,7 @@ TclOODefineDeleteMethodObjCmd(
|
||||
}
|
||||
if (!isInstanceDeleteMethod && !oPtr->classPtr) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"attempt to misuse API", -1));
|
||||
"attempt to misuse API", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -1802,7 +1802,7 @@ TclOODefineDestructorObjCmd(
|
||||
|
||||
int
|
||||
TclOODefineExportObjCmd(
|
||||
ClientData clientData,
|
||||
void *clientData,
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Obj *const *objv)
|
||||
@@ -1826,7 +1826,7 @@ TclOODefineExportObjCmd(
|
||||
clsPtr = oPtr->classPtr;
|
||||
if (!isInstanceExport && !clsPtr) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"attempt to misuse API", -1));
|
||||
"attempt to misuse API", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -1898,7 +1898,7 @@ TclOODefineExportObjCmd(
|
||||
|
||||
int
|
||||
TclOODefineForwardObjCmd(
|
||||
ClientData clientData,
|
||||
void *clientData,
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Obj *const *objv)
|
||||
@@ -1920,7 +1920,7 @@ TclOODefineForwardObjCmd(
|
||||
}
|
||||
if (!isInstanceForward && !oPtr->classPtr) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"attempt to misuse API", -1));
|
||||
"attempt to misuse API", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -1962,7 +1962,7 @@ TclOODefineForwardObjCmd(
|
||||
|
||||
int
|
||||
TclOODefineMethodObjCmd(
|
||||
ClientData clientData,
|
||||
void *clientData,
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Obj *const *objv)
|
||||
@@ -1998,7 +1998,7 @@ TclOODefineMethodObjCmd(
|
||||
}
|
||||
if (!isInstanceMethod && !oPtr->classPtr) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"attempt to misuse API", -1));
|
||||
"attempt to misuse API", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -2058,7 +2058,7 @@ TclOODefineMethodObjCmd(
|
||||
|
||||
int
|
||||
TclOODefineRenameMethodObjCmd(
|
||||
ClientData clientData,
|
||||
void *clientData,
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Obj *const *objv)
|
||||
@@ -2077,7 +2077,7 @@ TclOODefineRenameMethodObjCmd(
|
||||
}
|
||||
if (!isInstanceRenameMethod && !oPtr->classPtr) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"attempt to misuse API", -1));
|
||||
"attempt to misuse API", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -2115,7 +2115,7 @@ TclOODefineRenameMethodObjCmd(
|
||||
|
||||
int
|
||||
TclOODefineUnexportObjCmd(
|
||||
ClientData clientData,
|
||||
void *clientData,
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Obj *const *objv)
|
||||
@@ -2139,7 +2139,7 @@ TclOODefineUnexportObjCmd(
|
||||
clsPtr = oPtr->classPtr;
|
||||
if (!isInstanceUnexport && !clsPtr) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"attempt to misuse API", -1));
|
||||
"attempt to misuse API", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -2268,13 +2268,13 @@ TclOODefineSlots(
|
||||
Foundation *fPtr)
|
||||
{
|
||||
const struct DeclaredSlot *slotInfoPtr;
|
||||
Tcl_Obj *getName = Tcl_NewStringObj("Get", -1);
|
||||
Tcl_Obj *setName = Tcl_NewStringObj("Set", -1);
|
||||
Tcl_Obj *resolveName = Tcl_NewStringObj("Resolve", -1);
|
||||
Tcl_Obj *getName = Tcl_NewStringObj("Get", TCL_INDEX_NONE);
|
||||
Tcl_Obj *setName = Tcl_NewStringObj("Set", TCL_INDEX_NONE);
|
||||
Tcl_Obj *resolveName = Tcl_NewStringObj("Resolve", TCL_INDEX_NONE);
|
||||
Class *slotCls;
|
||||
|
||||
slotCls = ((Object *) Tcl_NewObjectInstance(fPtr->interp, (Tcl_Class)
|
||||
fPtr->classCls, "::oo::Slot", NULL, -1, NULL, 0))->classPtr;
|
||||
fPtr->classCls, "::oo::Slot", NULL, TCL_INDEX_NONE, NULL, 0))->classPtr;
|
||||
if (slotCls == NULL) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -2283,7 +2283,7 @@ TclOODefineSlots(
|
||||
Tcl_IncrRefCount(resolveName);
|
||||
for (slotInfoPtr = slots ; slotInfoPtr->name ; slotInfoPtr++) {
|
||||
Tcl_Object slotObject = Tcl_NewObjectInstance(fPtr->interp,
|
||||
(Tcl_Class) slotCls, slotInfoPtr->name, NULL, -1, NULL, 0);
|
||||
(Tcl_Class) slotCls, slotInfoPtr->name, NULL, TCL_INDEX_NONE, NULL, 0);
|
||||
|
||||
if (slotObject == NULL) {
|
||||
continue;
|
||||
@@ -2335,7 +2335,7 @@ ClassFilterGet(
|
||||
return TCL_ERROR;
|
||||
} else if (!oPtr->classPtr) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"attempt to misuse API", -1));
|
||||
"attempt to misuse API", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -2371,7 +2371,7 @@ ClassFilterSet(
|
||||
return TCL_ERROR;
|
||||
} else if (!oPtr->classPtr) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"attempt to misuse API", -1));
|
||||
"attempt to misuse API", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
|
||||
return TCL_ERROR;
|
||||
} else if (TclListObjGetElementsM(interp, objv[0], &filterc,
|
||||
@@ -2416,7 +2416,7 @@ ClassMixinGet(
|
||||
return TCL_ERROR;
|
||||
} else if (!oPtr->classPtr) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"attempt to misuse API", -1));
|
||||
"attempt to misuse API", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -2455,7 +2455,7 @@ ClassMixinSet(
|
||||
return TCL_ERROR;
|
||||
} else if (!oPtr->classPtr) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"attempt to misuse API", -1));
|
||||
"attempt to misuse API", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
|
||||
return TCL_ERROR;
|
||||
} else if (TclListObjGetElementsM(interp, objv[0], &mixinc,
|
||||
@@ -2474,7 +2474,7 @@ ClassMixinSet(
|
||||
}
|
||||
if (TclOOIsReachable(oPtr->classPtr, mixins[i])) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"may not mix a class into itself", -1));
|
||||
"may not mix a class into itself", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OO", "SELF_MIXIN", NULL);
|
||||
goto freeAndError;
|
||||
}
|
||||
@@ -2522,7 +2522,7 @@ ClassSuperGet(
|
||||
return TCL_ERROR;
|
||||
} else if (!oPtr->classPtr) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"attempt to misuse API", -1));
|
||||
"attempt to misuse API", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -2561,12 +2561,12 @@ ClassSuperSet(
|
||||
return TCL_ERROR;
|
||||
} else if (!oPtr->classPtr) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"attempt to misuse API", -1));
|
||||
"attempt to misuse API", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
|
||||
return TCL_ERROR;
|
||||
} else if (oPtr == oPtr->fPtr->objectCls->thisPtr) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"may not modify the superclass of the root object", -1));
|
||||
"may not modify the superclass of the root object", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
|
||||
return TCL_ERROR;
|
||||
} else if (TclListObjGetElementsM(interp, objv[0], &superc,
|
||||
@@ -2614,7 +2614,7 @@ ClassSuperSet(
|
||||
}
|
||||
if (TclOOIsReachable(oPtr->classPtr, superclasses[i])) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"attempt to form circular dependency graph", -1));
|
||||
"attempt to form circular dependency graph", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OO", "CIRCULARITY", NULL);
|
||||
failedAfterAlloc:
|
||||
for (; i-- > 0 ;) {
|
||||
@@ -2689,7 +2689,7 @@ ClassVarsGet(
|
||||
return TCL_ERROR;
|
||||
} else if (!oPtr->classPtr) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"attempt to misuse API", -1));
|
||||
"attempt to misuse API", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -2736,7 +2736,7 @@ ClassVarsSet(
|
||||
return TCL_ERROR;
|
||||
} else if (!oPtr->classPtr) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"attempt to misuse API", -1));
|
||||
"attempt to misuse API", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
|
||||
return TCL_ERROR;
|
||||
} else if (TclListObjGetElementsM(interp, objv[0], &varc,
|
||||
|
||||
+18
-18
@@ -120,10 +120,10 @@ TclOOInitInfo(
|
||||
infoCmd = Tcl_FindCommand(interp, "info", NULL, TCL_GLOBAL_ONLY);
|
||||
if (infoCmd) {
|
||||
Tcl_GetEnsembleMappingDict(NULL, infoCmd, &mapDict);
|
||||
Tcl_DictObjPut(NULL, mapDict, Tcl_NewStringObj("object", -1),
|
||||
Tcl_NewStringObj("::oo::InfoObject", -1));
|
||||
Tcl_DictObjPut(NULL, mapDict, Tcl_NewStringObj("class", -1),
|
||||
Tcl_NewStringObj("::oo::InfoClass", -1));
|
||||
Tcl_DictObjPut(NULL, mapDict, Tcl_NewStringObj("object", TCL_INDEX_NONE),
|
||||
Tcl_NewStringObj("::oo::InfoObject", TCL_INDEX_NONE));
|
||||
Tcl_DictObjPut(NULL, mapDict, Tcl_NewStringObj("class", TCL_INDEX_NONE),
|
||||
Tcl_NewStringObj("::oo::InfoClass", TCL_INDEX_NONE));
|
||||
Tcl_SetEnsembleMappingDict(interp, infoCmd, mapDict);
|
||||
}
|
||||
}
|
||||
@@ -264,7 +264,7 @@ InfoObjectDefnCmd(
|
||||
procPtr = TclOOGetProcFromMethod((Method *)Tcl_GetHashValue(hPtr));
|
||||
if (procPtr == NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"definition not available for this kind of method", -1));
|
||||
"definition not available for this kind of method", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "METHOD",
|
||||
TclGetString(objv[2]), NULL);
|
||||
return TCL_ERROR;
|
||||
@@ -278,7 +278,7 @@ InfoObjectDefnCmd(
|
||||
|
||||
TclNewObj(argObj);
|
||||
Tcl_ListObjAppendElement(NULL, argObj,
|
||||
Tcl_NewStringObj(localPtr->name, -1));
|
||||
Tcl_NewStringObj(localPtr->name, TCL_INDEX_NONE));
|
||||
if (localPtr->defValuePtr != NULL) {
|
||||
Tcl_ListObjAppendElement(NULL, argObj, localPtr->defValuePtr);
|
||||
}
|
||||
@@ -610,7 +610,7 @@ InfoObjectMethodsCmd(
|
||||
|
||||
for (i=0 ; i<numNames ; i++) {
|
||||
Tcl_ListObjAppendElement(NULL, resultObj,
|
||||
Tcl_NewStringObj(names[i], -1));
|
||||
Tcl_NewStringObj(names[i], TCL_INDEX_NONE));
|
||||
}
|
||||
if (numNames > 0) {
|
||||
Tcl_Free((void *)names);
|
||||
@@ -679,7 +679,7 @@ InfoObjectMethodTypeCmd(
|
||||
goto unknownMethod;
|
||||
}
|
||||
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(mPtr->typePtr->name, -1));
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(mPtr->typePtr->name, TCL_INDEX_NONE));
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
@@ -787,7 +787,7 @@ InfoObjectNsCmd(
|
||||
}
|
||||
|
||||
Tcl_SetObjResult(interp,
|
||||
Tcl_NewStringObj(oPtr->namespacePtr->fullName, -1));
|
||||
Tcl_NewStringObj(oPtr->namespacePtr->fullName, TCL_INDEX_NONE));
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
@@ -943,7 +943,7 @@ InfoClassConstrCmd(
|
||||
procPtr = TclOOGetProcFromMethod(clsPtr->constructorPtr);
|
||||
if (procPtr == NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"definition not available for this kind of method", -1));
|
||||
"definition not available for this kind of method", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OO", "METHOD_TYPE", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -956,7 +956,7 @@ InfoClassConstrCmd(
|
||||
|
||||
TclNewObj(argObj);
|
||||
Tcl_ListObjAppendElement(NULL, argObj,
|
||||
Tcl_NewStringObj(localPtr->name, -1));
|
||||
Tcl_NewStringObj(localPtr->name, TCL_INDEX_NONE));
|
||||
if (localPtr->defValuePtr != NULL) {
|
||||
Tcl_ListObjAppendElement(NULL, argObj, localPtr->defValuePtr);
|
||||
}
|
||||
@@ -1010,7 +1010,7 @@ InfoClassDefnCmd(
|
||||
procPtr = TclOOGetProcFromMethod((Method *)Tcl_GetHashValue(hPtr));
|
||||
if (procPtr == NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"definition not available for this kind of method", -1));
|
||||
"definition not available for this kind of method", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "METHOD",
|
||||
TclGetString(objv[2]), NULL);
|
||||
return TCL_ERROR;
|
||||
@@ -1024,7 +1024,7 @@ InfoClassDefnCmd(
|
||||
|
||||
TclNewObj(argObj);
|
||||
Tcl_ListObjAppendElement(NULL, argObj,
|
||||
Tcl_NewStringObj(localPtr->name, -1));
|
||||
Tcl_NewStringObj(localPtr->name, TCL_INDEX_NONE));
|
||||
if (localPtr->defValuePtr != NULL) {
|
||||
Tcl_ListObjAppendElement(NULL, argObj, localPtr->defValuePtr);
|
||||
}
|
||||
@@ -1121,7 +1121,7 @@ InfoClassDestrCmd(
|
||||
procPtr = TclOOGetProcFromMethod(clsPtr->destructorPtr);
|
||||
if (procPtr == NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"definition not available for this kind of method", -1));
|
||||
"definition not available for this kind of method", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OO", "METHOD_TYPE", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -1365,7 +1365,7 @@ InfoClassMethodsCmd(
|
||||
|
||||
for (i=0 ; i<numNames ; i++) {
|
||||
Tcl_ListObjAppendElement(NULL, resultObj,
|
||||
Tcl_NewStringObj(names[i], -1));
|
||||
Tcl_NewStringObj(names[i], TCL_INDEX_NONE));
|
||||
}
|
||||
if (numNames > 0) {
|
||||
Tcl_Free((void *)names);
|
||||
@@ -1431,7 +1431,7 @@ InfoClassMethodTypeCmd(
|
||||
|
||||
goto unknownMethod;
|
||||
}
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(mPtr->typePtr->name, -1));
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(mPtr->typePtr->name, TCL_INDEX_NONE));
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
@@ -1663,7 +1663,7 @@ InfoObjectCallCmd(
|
||||
NULL);
|
||||
if (contextPtr == NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"cannot construct any call chain", -1));
|
||||
"cannot construct any call chain", TCL_INDEX_NONE));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
Tcl_SetObjResult(interp,
|
||||
@@ -1708,7 +1708,7 @@ InfoClassCallCmd(
|
||||
callPtr = TclOOGetStereotypeCallChain(clsPtr, objv[2], PUBLIC_METHOD);
|
||||
if (callPtr == NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"cannot construct any call chain", -1));
|
||||
"cannot construct any call chain", TCL_INDEX_NONE));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
Tcl_SetObjResult(interp, TclOORenderCallChain(interp, callPtr));
|
||||
|
||||
+18
-18
@@ -46,7 +46,7 @@ typedef struct Method {
|
||||
/* The type of method. If NULL, this is a
|
||||
* special flag record which is just used for
|
||||
* the setting of the flags field. */
|
||||
size_t refCount;
|
||||
Tcl_Size refCount;
|
||||
void *clientData; /* Type-specific data. */
|
||||
Tcl_Obj *namePtr; /* Name of the method. */
|
||||
struct Object *declaringObjectPtr;
|
||||
@@ -83,7 +83,7 @@ typedef struct ProcedureMethod {
|
||||
* includes the argument definition and the
|
||||
* body bytecodes. */
|
||||
int flags; /* Flags to control features. */
|
||||
size_t refCount;
|
||||
Tcl_Size refCount;
|
||||
void *clientData;
|
||||
TclOO_PmCDDeleteProc *deleteClientdataProc;
|
||||
TclOO_PmCDCloneProc *cloneClientdataProc;
|
||||
@@ -149,9 +149,9 @@ typedef struct {
|
||||
*/
|
||||
|
||||
#define LIST_STATIC(listType_t) \
|
||||
struct { size_t num; listType_t *list; }
|
||||
struct { Tcl_Size num; listType_t *list; }
|
||||
#define LIST_DYNAMIC(listType_t) \
|
||||
struct { size_t num, size; listType_t *list; }
|
||||
struct { Tcl_Size num, size; listType_t *list; }
|
||||
|
||||
/*
|
||||
* These types are needed in function arguments.
|
||||
@@ -184,14 +184,14 @@ typedef struct Object {
|
||||
struct Class *classPtr; /* This is non-NULL for all classes, and NULL
|
||||
* for everything else. It points to the class
|
||||
* structure. */
|
||||
size_t refCount; /* Number of strong references to this object.
|
||||
Tcl_Size refCount; /* Number of strong references to this object.
|
||||
* Note that there may be many more weak
|
||||
* references; this mechanism exists to
|
||||
* avoid Tcl_Preserve. */
|
||||
int flags;
|
||||
size_t creationEpoch; /* Unique value to make comparisons of objects
|
||||
Tcl_Size creationEpoch; /* Unique value to make comparisons of objects
|
||||
* easier. */
|
||||
size_t epoch; /* Per-object epoch, incremented when the way
|
||||
Tcl_Size epoch; /* Per-object epoch, incremented when the way
|
||||
* an object should resolve call chains is
|
||||
* changed. */
|
||||
Tcl_HashTable *metadataPtr; /* Mapping from pointers to metadata type to
|
||||
@@ -329,7 +329,7 @@ typedef struct Class {
|
||||
*/
|
||||
|
||||
typedef struct ThreadLocalData {
|
||||
size_t nsCount; /* Epoch counter is used for keeping
|
||||
Tcl_Size nsCount; /* Epoch counter is used for keeping
|
||||
* the values used in Tcl_Obj internal
|
||||
* representations sane. Must be thread-local
|
||||
* because Tcl_Objs can cross interpreter
|
||||
@@ -353,7 +353,7 @@ typedef struct Foundation {
|
||||
Tcl_Namespace *helpersNs; /* Namespace containing the commands that are
|
||||
* only valid when executing inside a
|
||||
* procedural method. */
|
||||
size_t epoch; /* Used to invalidate method chains when the
|
||||
Tcl_Size epoch; /* Used to invalidate method chains when the
|
||||
* class structure changes. */
|
||||
ThreadLocalData *tsdPtr; /* Counter so we can allocate a unique
|
||||
* namespace to each object. */
|
||||
@@ -387,16 +387,16 @@ struct MInvoke {
|
||||
};
|
||||
|
||||
typedef struct CallChain {
|
||||
size_t objectCreationEpoch; /* The object's creation epoch. Note that the
|
||||
Tcl_Size objectCreationEpoch; /* The object's creation epoch. Note that the
|
||||
* object reference is not stored in the call
|
||||
* chain; it is in the call context. */
|
||||
size_t objectEpoch; /* Local (object structure) epoch counter
|
||||
Tcl_Size objectEpoch; /* Local (object structure) epoch counter
|
||||
* snapshot. */
|
||||
size_t epoch; /* Global (class structure) epoch counter
|
||||
Tcl_Size epoch; /* Global (class structure) epoch counter
|
||||
* snapshot. */
|
||||
int flags; /* Assorted flags, see below. */
|
||||
size_t refCount; /* Reference count. */
|
||||
size_t numChain; /* Size of the call chain. */
|
||||
Tcl_Size refCount; /* Reference count. */
|
||||
Tcl_Size numChain; /* Size of the call chain. */
|
||||
struct MInvoke *chain; /* Array of call chain entries. May point to
|
||||
* staticChain if the number of entries is
|
||||
* small. */
|
||||
@@ -405,9 +405,9 @@ typedef struct CallChain {
|
||||
|
||||
typedef struct CallContext {
|
||||
Object *oPtr; /* The object associated with this call. */
|
||||
size_t index; /* Index into the call chain of the currently
|
||||
Tcl_Size index; /* Index into the call chain of the currently
|
||||
* executing method implementation. */
|
||||
size_t skip; /* Current number of arguments to skip; can
|
||||
Tcl_Size skip; /* Current number of arguments to skip; can
|
||||
* vary depending on whether it is a direct
|
||||
* method call or a continuation via the
|
||||
* [next] command. */
|
||||
@@ -578,7 +578,7 @@ MODULE_SCOPE void TclOOSetupVariableResolver(Tcl_Namespace *nsPtr);
|
||||
/*
|
||||
* A convenience macro for iterating through the lists used in the internal
|
||||
* memory management of objects.
|
||||
* REQUIRES DECLARATION: size_t i;
|
||||
* REQUIRES DECLARATION: Tcl_Size i;
|
||||
*/
|
||||
|
||||
#define FOREACH(var,ary) \
|
||||
@@ -590,7 +590,7 @@ MODULE_SCOPE void TclOOSetupVariableResolver(Tcl_Namespace *nsPtr);
|
||||
* A variation where the array is an array of structs. There's no issue with
|
||||
* possible NULLs; every element of the array will be iterated over and the
|
||||
* varable set to a pointer to each of those elements in turn.
|
||||
* REQUIRES DECLARATION: size_t i;
|
||||
* REQUIRES DECLARATION: Tcl_Size i;
|
||||
*/
|
||||
|
||||
#define FOREACH_STRUCT(var,ary) \
|
||||
|
||||
+13
-13
@@ -42,7 +42,7 @@ TCLAPI Method * TclOONewProcMethod(Tcl_Interp *interp, Class *clsPtr,
|
||||
ProcedureMethod **pmPtrPtr);
|
||||
/* 5 */
|
||||
TCLAPI int TclOOObjectCmdCore(Object *oPtr, Tcl_Interp *interp,
|
||||
size_t objc, Tcl_Obj *const *objv,
|
||||
Tcl_Size objc, Tcl_Obj *const *objv,
|
||||
int publicOnly, Class *startCls);
|
||||
/* 6 */
|
||||
TCLAPI int TclOOIsReachable(Class *targetPtr, Class *startPtr);
|
||||
@@ -75,21 +75,21 @@ TCLAPI Tcl_Method TclOONewProcMethodEx(Tcl_Interp *interp,
|
||||
/* 11 */
|
||||
TCLAPI int TclOOInvokeObject(Tcl_Interp *interp,
|
||||
Tcl_Object object, Tcl_Class startCls,
|
||||
int publicPrivate, size_t objc,
|
||||
int publicPrivate, Tcl_Size objc,
|
||||
Tcl_Obj *const *objv);
|
||||
/* 12 */
|
||||
TCLAPI void TclOOObjectSetFilters(Object *oPtr,
|
||||
size_t numFilters, Tcl_Obj *const *filters);
|
||||
Tcl_Size numFilters, Tcl_Obj *const *filters);
|
||||
/* 13 */
|
||||
TCLAPI void TclOOClassSetFilters(Tcl_Interp *interp,
|
||||
Class *classPtr, size_t numFilters,
|
||||
Class *classPtr, Tcl_Size numFilters,
|
||||
Tcl_Obj *const *filters);
|
||||
/* 14 */
|
||||
TCLAPI void TclOOObjectSetMixins(Object *oPtr, size_t numMixins,
|
||||
Class *const *mixins);
|
||||
TCLAPI void TclOOObjectSetMixins(Object *oPtr,
|
||||
Tcl_Size numMixins, Class *const *mixins);
|
||||
/* 15 */
|
||||
TCLAPI void TclOOClassSetMixins(Tcl_Interp *interp,
|
||||
Class *classPtr, size_t numMixins,
|
||||
Class *classPtr, Tcl_Size numMixins,
|
||||
Class *const *mixins);
|
||||
|
||||
typedef struct TclOOIntStubs {
|
||||
@@ -101,17 +101,17 @@ typedef struct TclOOIntStubs {
|
||||
Tcl_Method (*tclOOMakeProcMethod) (Tcl_Interp *interp, Class *clsPtr, int flags, Tcl_Obj *nameObj, const char *namePtr, Tcl_Obj *argsObj, Tcl_Obj *bodyObj, const Tcl_MethodType *typePtr, void *clientData, Proc **procPtrPtr); /* 2 */
|
||||
Method * (*tclOONewProcInstanceMethod) (Tcl_Interp *interp, Object *oPtr, int flags, Tcl_Obj *nameObj, Tcl_Obj *argsObj, Tcl_Obj *bodyObj, ProcedureMethod **pmPtrPtr); /* 3 */
|
||||
Method * (*tclOONewProcMethod) (Tcl_Interp *interp, Class *clsPtr, int flags, Tcl_Obj *nameObj, Tcl_Obj *argsObj, Tcl_Obj *bodyObj, ProcedureMethod **pmPtrPtr); /* 4 */
|
||||
int (*tclOOObjectCmdCore) (Object *oPtr, Tcl_Interp *interp, size_t objc, Tcl_Obj *const *objv, int publicOnly, Class *startCls); /* 5 */
|
||||
int (*tclOOObjectCmdCore) (Object *oPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const *objv, int publicOnly, Class *startCls); /* 5 */
|
||||
int (*tclOOIsReachable) (Class *targetPtr, Class *startPtr); /* 6 */
|
||||
Method * (*tclOONewForwardMethod) (Tcl_Interp *interp, Class *clsPtr, int isPublic, Tcl_Obj *nameObj, Tcl_Obj *prefixObj); /* 7 */
|
||||
Method * (*tclOONewForwardInstanceMethod) (Tcl_Interp *interp, Object *oPtr, int isPublic, Tcl_Obj *nameObj, Tcl_Obj *prefixObj); /* 8 */
|
||||
Tcl_Method (*tclOONewProcInstanceMethodEx) (Tcl_Interp *interp, Tcl_Object oPtr, TclOO_PreCallProc *preCallPtr, TclOO_PostCallProc *postCallPtr, ProcErrorProc *errProc, void *clientData, Tcl_Obj *nameObj, Tcl_Obj *argsObj, Tcl_Obj *bodyObj, int flags, void **internalTokenPtr); /* 9 */
|
||||
Tcl_Method (*tclOONewProcMethodEx) (Tcl_Interp *interp, Tcl_Class clsPtr, TclOO_PreCallProc *preCallPtr, TclOO_PostCallProc *postCallPtr, ProcErrorProc *errProc, void *clientData, Tcl_Obj *nameObj, Tcl_Obj *argsObj, Tcl_Obj *bodyObj, int flags, void **internalTokenPtr); /* 10 */
|
||||
int (*tclOOInvokeObject) (Tcl_Interp *interp, Tcl_Object object, Tcl_Class startCls, int publicPrivate, size_t objc, Tcl_Obj *const *objv); /* 11 */
|
||||
void (*tclOOObjectSetFilters) (Object *oPtr, size_t numFilters, Tcl_Obj *const *filters); /* 12 */
|
||||
void (*tclOOClassSetFilters) (Tcl_Interp *interp, Class *classPtr, size_t numFilters, Tcl_Obj *const *filters); /* 13 */
|
||||
void (*tclOOObjectSetMixins) (Object *oPtr, size_t numMixins, Class *const *mixins); /* 14 */
|
||||
void (*tclOOClassSetMixins) (Tcl_Interp *interp, Class *classPtr, size_t numMixins, Class *const *mixins); /* 15 */
|
||||
int (*tclOOInvokeObject) (Tcl_Interp *interp, Tcl_Object object, Tcl_Class startCls, int publicPrivate, Tcl_Size objc, Tcl_Obj *const *objv); /* 11 */
|
||||
void (*tclOOObjectSetFilters) (Object *oPtr, Tcl_Size numFilters, Tcl_Obj *const *filters); /* 12 */
|
||||
void (*tclOOClassSetFilters) (Tcl_Interp *interp, Class *classPtr, Tcl_Size numFilters, Tcl_Obj *const *filters); /* 13 */
|
||||
void (*tclOOObjectSetMixins) (Object *oPtr, Tcl_Size numMixins, Class *const *mixins); /* 14 */
|
||||
void (*tclOOClassSetMixins) (Tcl_Interp *interp, Class *classPtr, Tcl_Size numMixins, Class *const *mixins); /* 15 */
|
||||
} TclOOIntStubs;
|
||||
|
||||
extern const TclOOIntStubs *tclOOIntStubsPtr;
|
||||
|
||||
@@ -387,7 +387,7 @@ TclOONewBasicMethod(
|
||||
/* Name of the method, whether it is public,
|
||||
* and the function to implement it. */
|
||||
{
|
||||
Tcl_Obj *namePtr = Tcl_NewStringObj(dcm->name, -1);
|
||||
Tcl_Obj *namePtr = Tcl_NewStringObj(dcm->name, TCL_INDEX_NONE);
|
||||
|
||||
Tcl_IncrRefCount(namePtr);
|
||||
TclNewMethod(interp, (Tcl_Class) clsPtr, namePtr,
|
||||
@@ -498,7 +498,7 @@ TclOONewProcMethod(
|
||||
method = TclOOMakeProcMethod(interp, clsPtr, flags, nameObj, procName,
|
||||
argsObj, bodyObj, &procMethodType, pmPtr, &pmPtr->procPtr);
|
||||
|
||||
if (argsLen == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(argsLen)) {
|
||||
Tcl_DecrRefCount(argsObj);
|
||||
}
|
||||
if (method == NULL) {
|
||||
@@ -1188,7 +1188,7 @@ static int
|
||||
ProcedureMethodCompiledVarResolver(
|
||||
TCL_UNUSED(Tcl_Interp *),
|
||||
const char *varName,
|
||||
size_t length,
|
||||
Tcl_Size length,
|
||||
TCL_UNUSED(Tcl_Namespace *),
|
||||
Tcl_ResolvedVarInfo **rPtrPtr)
|
||||
{
|
||||
@@ -1410,7 +1410,7 @@ CloneProcedureMethod(
|
||||
|
||||
TclNewObj(argObj);
|
||||
Tcl_ListObjAppendElement(NULL, argObj,
|
||||
Tcl_NewStringObj(localPtr->name, -1));
|
||||
Tcl_NewStringObj(localPtr->name, TCL_INDEX_NONE));
|
||||
if (localPtr->defValuePtr != NULL) {
|
||||
Tcl_ListObjAppendElement(NULL, argObj, localPtr->defValuePtr);
|
||||
}
|
||||
@@ -1481,7 +1481,7 @@ TclOONewForwardInstanceMethod(
|
||||
}
|
||||
if (prefixLen < 1) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"method forward prefix must be non-empty", -1));
|
||||
"method forward prefix must be non-empty", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OO", "BAD_FORWARD", NULL);
|
||||
return NULL;
|
||||
}
|
||||
@@ -1520,7 +1520,7 @@ TclOONewForwardMethod(
|
||||
}
|
||||
if (prefixLen < 1) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"method forward prefix must be non-empty", -1));
|
||||
"method forward prefix must be non-empty", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OO", "BAD_FORWARD", NULL);
|
||||
return NULL;
|
||||
}
|
||||
@@ -1707,7 +1707,7 @@ InitEnsembleRewrite(
|
||||
int *lengthPtr) /* Where to write the resulting length of the
|
||||
* array of rewritten arguments. */
|
||||
{
|
||||
unsigned len = rewriteLength + objc - toRewrite;
|
||||
size_t len = rewriteLength + objc - toRewrite;
|
||||
Tcl_Obj **argObjs = (Tcl_Obj **)TclStackAlloc(interp, sizeof(Tcl_Obj *) * len);
|
||||
|
||||
memcpy(argObjs, rewriteObjs, rewriteLength * sizeof(Tcl_Obj *));
|
||||
|
||||
+171
-67
@@ -225,37 +225,45 @@ static int SetCmdNameFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr);
|
||||
* implementations.
|
||||
*/
|
||||
|
||||
const Tcl_ObjType tclBooleanType = {
|
||||
"boolean", /* name */
|
||||
const TclObjTypeWithAbstractList tclBooleanType= {
|
||||
{"boolean", /* name */
|
||||
NULL, /* freeIntRepProc */
|
||||
NULL, /* dupIntRepProc */
|
||||
NULL, /* updateStringProc */
|
||||
TclSetBooleanFromAny, /* setFromAnyProc */
|
||||
TCL_OBJTYPE_V0
|
||||
TCL_OBJTYPE_V0_1(
|
||||
TclLengthOne
|
||||
)}
|
||||
};
|
||||
const Tcl_ObjType tclDoubleType = {
|
||||
"double", /* name */
|
||||
const TclObjTypeWithAbstractList tclDoubleType= {
|
||||
{"double", /* name */
|
||||
NULL, /* freeIntRepProc */
|
||||
NULL, /* dupIntRepProc */
|
||||
UpdateStringOfDouble, /* updateStringProc */
|
||||
SetDoubleFromAny, /* setFromAnyProc */
|
||||
TCL_OBJTYPE_V0
|
||||
TCL_OBJTYPE_V0_1(
|
||||
TclLengthOne
|
||||
)}
|
||||
};
|
||||
const Tcl_ObjType tclIntType = {
|
||||
"int", /* name */
|
||||
const TclObjTypeWithAbstractList tclIntType = {
|
||||
{"int", /* name */
|
||||
NULL, /* freeIntRepProc */
|
||||
NULL, /* dupIntRepProc */
|
||||
UpdateStringOfInt, /* updateStringProc */
|
||||
SetIntFromAny, /* setFromAnyProc */
|
||||
TCL_OBJTYPE_V0
|
||||
TCL_OBJTYPE_V0_1(
|
||||
TclLengthOne
|
||||
)}
|
||||
};
|
||||
const Tcl_ObjType tclBignumType = {
|
||||
"bignum", /* name */
|
||||
const TclObjTypeWithAbstractList tclBignumType = {
|
||||
{"bignum", /* name */
|
||||
FreeBignum, /* freeIntRepProc */
|
||||
DupBignum, /* dupIntRepProc */
|
||||
UpdateStringOfBignum, /* updateStringProc */
|
||||
NULL, /* setFromAnyProc */
|
||||
TCL_OBJTYPE_V0
|
||||
TCL_OBJTYPE_V0_1(
|
||||
TclLengthOne
|
||||
)}
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -338,6 +346,18 @@ typedef struct ResolvedCmdName {
|
||||
* structure can be freed when refCount
|
||||
* becomes zero. */
|
||||
} ResolvedCmdName;
|
||||
|
||||
#ifdef TCL_MEM_DEBUG
|
||||
/*
|
||||
* Filler matches the value used for filling freed memory in tclCkalloc.
|
||||
* On 32-bit systems, the ref counts do not cross 0x7fffffff. On 64-bit
|
||||
* implementations, ref counts will never reach this value (unless explicitly
|
||||
* incremented without actual references!)
|
||||
*/
|
||||
#define FREEDREFCOUNTFILLER \
|
||||
(sizeof(objPtr->refCount) == 4 ? 0xe8e8e8e8 : 0xe8e8e8e8e8e8e8e8)
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
*-------------------------------------------------------------------------
|
||||
@@ -365,9 +385,9 @@ TclInitObjSubsystem(void)
|
||||
Tcl_InitHashTable(&typeTable, TCL_STRING_KEYS);
|
||||
Tcl_MutexUnlock(&tableMutex);
|
||||
|
||||
Tcl_RegisterObjType(&tclDoubleType);
|
||||
Tcl_RegisterObjType(&tclDoubleType.objType);
|
||||
Tcl_RegisterObjType(&tclStringType);
|
||||
Tcl_RegisterObjType(&tclListType);
|
||||
Tcl_RegisterObjType(&tclListType.objType);
|
||||
Tcl_RegisterObjType(&tclDictType);
|
||||
Tcl_RegisterObjType(&tclByteCodeType);
|
||||
Tcl_RegisterObjType(&tclCmdNameType);
|
||||
@@ -859,7 +879,7 @@ Tcl_AppendAllObjTypes(
|
||||
for (hPtr = Tcl_FirstHashEntry(&typeTable, &search);
|
||||
hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
|
||||
Tcl_ListObjAppendElement(NULL, objPtr,
|
||||
Tcl_NewStringObj((char *)Tcl_GetHashKey(&typeTable, hPtr), -1));
|
||||
Tcl_NewStringObj((char *)Tcl_GetHashKey(&typeTable, hPtr), TCL_INDEX_NONE));
|
||||
}
|
||||
Tcl_MutexUnlock(&tableMutex);
|
||||
return TCL_OK;
|
||||
@@ -1008,7 +1028,7 @@ TclDbDumpActiveObjects(
|
||||
*
|
||||
* Called via the TclNewObj or TclDbNewObj macros when TCL_MEM_DEBUG is
|
||||
* enabled. This function will initialize the members of a Tcl_Obj
|
||||
* struct. Initilization would be done inline via the TclNewObj macro
|
||||
* struct. Initialization would be done inline via the TclNewObj macro
|
||||
* when compiling without TCL_MEM_DEBUG.
|
||||
*
|
||||
* Results:
|
||||
@@ -1492,7 +1512,7 @@ int
|
||||
TclObjBeingDeleted(
|
||||
Tcl_Obj *objPtr)
|
||||
{
|
||||
return (objPtr->length == TCL_INDEX_NONE);
|
||||
return (TCL_SIZE_ISNEG(objPtr->length));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1612,7 +1632,7 @@ Tcl_GetString(
|
||||
objPtr->typePtr->name);
|
||||
}
|
||||
objPtr->typePtr->updateStringProc(objPtr);
|
||||
if (objPtr->bytes == NULL || objPtr->length == TCL_INDEX_NONE
|
||||
if (objPtr->bytes == NULL || TCL_SIZE_ISNEG(objPtr->length)
|
||||
|| objPtr->bytes[objPtr->length] != '\0') {
|
||||
Tcl_Panic("UpdateStringProc for type '%s' "
|
||||
"failed to create a valid string rep",
|
||||
@@ -1672,7 +1692,7 @@ TclGetStringFromObj(
|
||||
objPtr->typePtr->name);
|
||||
}
|
||||
objPtr->typePtr->updateStringProc(objPtr);
|
||||
if (objPtr->bytes == NULL || objPtr->length == TCL_INDEX_NONE
|
||||
if (objPtr->bytes == NULL || TCL_SIZE_ISNEG(objPtr->length)
|
||||
|| objPtr->bytes[objPtr->length] != '\0') {
|
||||
Tcl_Panic("UpdateStringProc for type '%s' "
|
||||
"failed to create a valid string rep",
|
||||
@@ -1778,7 +1798,7 @@ char *
|
||||
Tcl_InitStringRep(
|
||||
Tcl_Obj *objPtr, /* Object whose string rep is to be set */
|
||||
const char *bytes,
|
||||
size_t numBytes)
|
||||
TCL_HASH_TYPE numBytes)
|
||||
{
|
||||
assert(objPtr->bytes == NULL || bytes == NULL);
|
||||
|
||||
@@ -2001,17 +2021,17 @@ Tcl_GetBoolFromObj(
|
||||
if (interp) {
|
||||
TclNewObj(objPtr);
|
||||
TclParseNumber(interp, objPtr, (flags & TCL_NULL_OK)
|
||||
? "boolean value or \"\"" : "boolean value", NULL, -1, NULL, 0);
|
||||
? "boolean value or \"\"" : "boolean value", NULL, TCL_INDEX_NONE, NULL, 0);
|
||||
Tcl_DecrRefCount(objPtr);
|
||||
}
|
||||
return TCL_ERROR;
|
||||
}
|
||||
do {
|
||||
if (objPtr->typePtr == &tclIntType || objPtr->typePtr == &tclBooleanType) {
|
||||
if (objPtr->typePtr == &tclIntType.objType || objPtr->typePtr == &tclBooleanType.objType) {
|
||||
result = (objPtr->internalRep.wideValue != 0);
|
||||
goto boolEnd;
|
||||
}
|
||||
if (objPtr->typePtr == &tclDoubleType) {
|
||||
if (objPtr->typePtr == &tclDoubleType.objType) {
|
||||
/*
|
||||
* Caution: Don't be tempted to check directly for the "double"
|
||||
* Tcl_ObjType and then compare the internalrep to 0.0. This isn't
|
||||
@@ -2028,7 +2048,7 @@ Tcl_GetBoolFromObj(
|
||||
result = (d != 0.0);
|
||||
goto boolEnd;
|
||||
}
|
||||
if (objPtr->typePtr == &tclBignumType) {
|
||||
if (objPtr->typePtr == &tclBignumType.objType) {
|
||||
result = 1;
|
||||
boolEnd:
|
||||
if (charPtr != NULL) {
|
||||
@@ -2096,18 +2116,18 @@ TclSetBooleanFromAny(
|
||||
*/
|
||||
|
||||
if (objPtr->bytes == NULL) {
|
||||
if (objPtr->typePtr == &tclIntType) {
|
||||
if (objPtr->typePtr == &tclIntType.objType) {
|
||||
if ((Tcl_WideUInt)objPtr->internalRep.wideValue < 2) {
|
||||
return TCL_OK;
|
||||
}
|
||||
goto badBoolean;
|
||||
}
|
||||
|
||||
if (objPtr->typePtr == &tclBignumType) {
|
||||
if (objPtr->typePtr == &tclBignumType.objType) {
|
||||
goto badBoolean;
|
||||
}
|
||||
|
||||
if (objPtr->typePtr == &tclDoubleType) {
|
||||
if (objPtr->typePtr == &tclDoubleType.objType) {
|
||||
goto badBoolean;
|
||||
}
|
||||
}
|
||||
@@ -2124,7 +2144,7 @@ TclSetBooleanFromAny(
|
||||
|
||||
TclNewLiteralStringObj(msg, "expected boolean value but got \"");
|
||||
Tcl_AppendLimitedToObj(msg, str, length, 50, "");
|
||||
Tcl_AppendToObj(msg, "\"", -1);
|
||||
Tcl_AppendToObj(msg, "\"", TCL_INDEX_NONE);
|
||||
Tcl_SetObjResult(interp, msg);
|
||||
Tcl_SetErrorCode(interp, "TCL", "VALUE", "BOOLEAN", NULL);
|
||||
}
|
||||
@@ -2238,13 +2258,13 @@ ParseBoolean(
|
||||
goodBoolean:
|
||||
TclFreeInternalRep(objPtr);
|
||||
objPtr->internalRep.wideValue = newBool;
|
||||
objPtr->typePtr = &tclBooleanType;
|
||||
objPtr->typePtr = &tclBooleanType.objType;
|
||||
return TCL_OK;
|
||||
|
||||
numericBoolean:
|
||||
TclFreeInternalRep(objPtr);
|
||||
objPtr->internalRep.wideValue = newBool;
|
||||
objPtr->typePtr = &tclIntType;
|
||||
objPtr->typePtr = &tclIntType.objType;
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
@@ -2336,7 +2356,7 @@ Tcl_DbNewDoubleObj(
|
||||
objPtr->bytes = NULL;
|
||||
|
||||
objPtr->internalRep.doubleValue = dblValue;
|
||||
objPtr->typePtr = &tclDoubleType;
|
||||
objPtr->typePtr = &tclDoubleType.objType;
|
||||
return objPtr;
|
||||
}
|
||||
|
||||
@@ -2409,11 +2429,11 @@ Tcl_GetDoubleFromObj(
|
||||
double *dblPtr) /* Place to store resulting double. */
|
||||
{
|
||||
do {
|
||||
if (objPtr->typePtr == &tclDoubleType) {
|
||||
if (objPtr->typePtr == &tclDoubleType.objType) {
|
||||
if (isnan(objPtr->internalRep.doubleValue)) {
|
||||
if (interp != NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"floating point value is Not a Number", -1));
|
||||
"floating point value is Not a Number", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "VALUE", "DOUBLE", "NAN",
|
||||
NULL);
|
||||
}
|
||||
@@ -2422,11 +2442,11 @@ Tcl_GetDoubleFromObj(
|
||||
*dblPtr = (double) objPtr->internalRep.doubleValue;
|
||||
return TCL_OK;
|
||||
}
|
||||
if (objPtr->typePtr == &tclIntType) {
|
||||
if (objPtr->typePtr == &tclIntType.objType) {
|
||||
*dblPtr = (double) objPtr->internalRep.wideValue;
|
||||
return TCL_OK;
|
||||
}
|
||||
if (objPtr->typePtr == &tclBignumType) {
|
||||
if (objPtr->typePtr == &tclBignumType.objType) {
|
||||
mp_int big;
|
||||
|
||||
TclUnpackBignum(objPtr, big);
|
||||
@@ -2545,7 +2565,7 @@ Tcl_GetIntFromObj(
|
||||
if (interp != NULL) {
|
||||
const char *s =
|
||||
"integer value too large to represent";
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(s, -1));
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(s, TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "ARITH", "IOVERFLOW", s, NULL);
|
||||
}
|
||||
return TCL_ERROR;
|
||||
@@ -2640,12 +2660,12 @@ Tcl_GetLongFromObj(
|
||||
{
|
||||
do {
|
||||
#ifdef TCL_WIDE_INT_IS_LONG
|
||||
if (objPtr->typePtr == &tclIntType) {
|
||||
if (objPtr->typePtr == &tclIntType.objType) {
|
||||
*longPtr = objPtr->internalRep.wideValue;
|
||||
return TCL_OK;
|
||||
}
|
||||
#else
|
||||
if (objPtr->typePtr == &tclIntType) {
|
||||
if (objPtr->typePtr == &tclIntType.objType) {
|
||||
/*
|
||||
* We return any integer in the range LONG_MIN to ULONG_MAX
|
||||
* converted to a long, ignoring overflow. The rule preserves
|
||||
@@ -2664,7 +2684,7 @@ Tcl_GetLongFromObj(
|
||||
goto tooLarge;
|
||||
}
|
||||
#endif
|
||||
if (objPtr->typePtr == &tclDoubleType) {
|
||||
if (objPtr->typePtr == &tclDoubleType.objType) {
|
||||
if (interp != NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"expected integer but got \"%s\"",
|
||||
@@ -2673,7 +2693,7 @@ Tcl_GetLongFromObj(
|
||||
}
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (objPtr->typePtr == &tclBignumType) {
|
||||
if (objPtr->typePtr == &tclBignumType.objType) {
|
||||
/*
|
||||
* Must check for those bignum values that can fit in a long, even
|
||||
* when auto-narrowing is enabled. Only those values in the signed
|
||||
@@ -2710,7 +2730,7 @@ Tcl_GetLongFromObj(
|
||||
#endif
|
||||
if (interp != NULL) {
|
||||
const char *s = "integer value too large to represent";
|
||||
Tcl_Obj *msg = Tcl_NewStringObj(s, -1);
|
||||
Tcl_Obj *msg = Tcl_NewStringObj(s, TCL_INDEX_NONE);
|
||||
|
||||
Tcl_SetObjResult(interp, msg);
|
||||
Tcl_SetErrorCode(interp, "ARITH", "IOVERFLOW", s, NULL);
|
||||
@@ -2901,11 +2921,11 @@ Tcl_GetWideIntFromObj(
|
||||
/* Place to store resulting long. */
|
||||
{
|
||||
do {
|
||||
if (objPtr->typePtr == &tclIntType) {
|
||||
if (objPtr->typePtr == &tclIntType.objType) {
|
||||
*wideIntPtr = objPtr->internalRep.wideValue;
|
||||
return TCL_OK;
|
||||
}
|
||||
if (objPtr->typePtr == &tclDoubleType) {
|
||||
if (objPtr->typePtr == &tclDoubleType.objType) {
|
||||
if (interp != NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"expected integer but got \"%s\"",
|
||||
@@ -2914,7 +2934,7 @@ Tcl_GetWideIntFromObj(
|
||||
}
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (objPtr->typePtr == &tclBignumType) {
|
||||
if (objPtr->typePtr == &tclBignumType.objType) {
|
||||
/*
|
||||
* Must check for those bignum values that can fit in a
|
||||
* Tcl_WideInt, even when auto-narrowing is enabled.
|
||||
@@ -2945,7 +2965,7 @@ Tcl_GetWideIntFromObj(
|
||||
}
|
||||
if (interp != NULL) {
|
||||
const char *s = "integer value too large to represent";
|
||||
Tcl_Obj *msg = Tcl_NewStringObj(s, -1);
|
||||
Tcl_Obj *msg = Tcl_NewStringObj(s, TCL_INDEX_NONE);
|
||||
|
||||
Tcl_SetObjResult(interp, msg);
|
||||
Tcl_SetErrorCode(interp, "ARITH", "IOVERFLOW", s, NULL);
|
||||
@@ -2957,6 +2977,90 @@ Tcl_GetWideIntFromObj(
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* Tcl_GetWideUIntFromObj --
|
||||
*
|
||||
* Attempt to return a unsigned wide integer from the Tcl object "objPtr". If the
|
||||
* object is not already a wide int object or a bignum object, an attempt will
|
||||
* be made to convert it to one.
|
||||
*
|
||||
* Results:
|
||||
* The return value is a standard Tcl object result. If an error occurs
|
||||
* during conversion, an error message is left in the interpreter's
|
||||
* result unless "interp" is NULL.
|
||||
*
|
||||
* Side effects:
|
||||
* If the object is not already an int object, the conversion will free
|
||||
* any old internal representation.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int
|
||||
Tcl_GetWideUIntFromObj(
|
||||
Tcl_Interp *interp, /* Used for error reporting if not NULL. */
|
||||
Tcl_Obj *objPtr, /* Object from which to get a wide int. */
|
||||
Tcl_WideUInt *wideUIntPtr)
|
||||
/* Place to store resulting long. */
|
||||
{
|
||||
do {
|
||||
if (objPtr->typePtr == &tclIntType.objType) {
|
||||
if (objPtr->internalRep.wideValue < 0) {
|
||||
wideUIntOutOfRange:
|
||||
if (interp != NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"expected unsigned integer but got \"%s\"",
|
||||
TclGetString(objPtr)));
|
||||
Tcl_SetErrorCode(interp, "TCL", "VALUE", "INTEGER", NULL);
|
||||
}
|
||||
return TCL_ERROR;
|
||||
}
|
||||
*wideUIntPtr = (Tcl_WideUInt)objPtr->internalRep.wideValue;
|
||||
return TCL_OK;
|
||||
}
|
||||
if (objPtr->typePtr == &tclDoubleType.objType) {
|
||||
goto wideUIntOutOfRange;
|
||||
}
|
||||
if (objPtr->typePtr == &tclBignumType.objType) {
|
||||
/*
|
||||
* Must check for those bignum values that can fit in a
|
||||
* Tcl_WideUInt, even when auto-narrowing is enabled.
|
||||
*/
|
||||
|
||||
mp_int big;
|
||||
Tcl_WideUInt value = 0;
|
||||
size_t numBytes;
|
||||
Tcl_WideUInt scratch;
|
||||
unsigned char *bytes = (unsigned char *) &scratch;
|
||||
|
||||
TclUnpackBignum(objPtr, big);
|
||||
if (big.sign == MP_NEG) {
|
||||
goto wideUIntOutOfRange;
|
||||
}
|
||||
if (mp_to_ubin(&big, bytes, sizeof(Tcl_WideUInt), &numBytes) == MP_OKAY) {
|
||||
while (numBytes-- > 0) {
|
||||
value = (value << CHAR_BIT) | *bytes++;
|
||||
}
|
||||
*wideUIntPtr = (Tcl_WideUInt)value;
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
if (interp != NULL) {
|
||||
const char *s = "integer value too large to represent";
|
||||
Tcl_Obj *msg = Tcl_NewStringObj(s, TCL_INDEX_NONE);
|
||||
|
||||
Tcl_SetObjResult(interp, msg);
|
||||
Tcl_SetErrorCode(interp, "ARITH", "IOVERFLOW", s, NULL);
|
||||
}
|
||||
return TCL_ERROR;
|
||||
}
|
||||
} while (TclParseNumber(interp, objPtr, "integer", NULL, -1, NULL,
|
||||
TCL_PARSE_INTEGER_ONLY)==TCL_OK);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
@@ -2986,11 +3090,11 @@ TclGetWideBitsFromObj(
|
||||
Tcl_WideInt *wideIntPtr) /* Place to store resulting wide integer. */
|
||||
{
|
||||
do {
|
||||
if (objPtr->typePtr == &tclIntType) {
|
||||
if (objPtr->typePtr == &tclIntType.objType) {
|
||||
*wideIntPtr = objPtr->internalRep.wideValue;
|
||||
return TCL_OK;
|
||||
}
|
||||
if (objPtr->typePtr == &tclDoubleType) {
|
||||
if (objPtr->typePtr == &tclDoubleType.objType) {
|
||||
if (interp != NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"expected integer but got \"%s\"",
|
||||
@@ -2999,7 +3103,7 @@ TclGetWideBitsFromObj(
|
||||
}
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (objPtr->typePtr == &tclBignumType) {
|
||||
if (objPtr->typePtr == &tclBignumType.objType) {
|
||||
mp_int big;
|
||||
mp_err err;
|
||||
|
||||
@@ -3065,7 +3169,7 @@ FreeBignum(
|
||||
* None.
|
||||
*
|
||||
* Side effects:
|
||||
* The destination object receies a copy of the source object
|
||||
* The destination object receives a copy of the source object
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
@@ -3078,7 +3182,7 @@ DupBignum(
|
||||
mp_int bignumVal;
|
||||
mp_int bignumCopy;
|
||||
|
||||
copyPtr->typePtr = &tclBignumType;
|
||||
copyPtr->typePtr = &tclBignumType.objType;
|
||||
TclUnpackBignum(srcPtr, bignumVal);
|
||||
if (mp_init_copy(&bignumCopy, &bignumVal) != MP_OKAY) {
|
||||
Tcl_Panic("initialization failure in DupBignum");
|
||||
@@ -3144,7 +3248,7 @@ UpdateStringOfBignum(
|
||||
*
|
||||
* Tcl_NewBignumObj --
|
||||
*
|
||||
* Creates an initializes a bignum object.
|
||||
* Creates and initializes a bignum object.
|
||||
*
|
||||
* Results:
|
||||
* Returns the newly created object.
|
||||
@@ -3248,7 +3352,7 @@ GetBignumFromObj(
|
||||
mp_int *bignumValue) /* Returned bignum value. */
|
||||
{
|
||||
do {
|
||||
if (objPtr->typePtr == &tclBignumType) {
|
||||
if (objPtr->typePtr == &tclBignumType.objType) {
|
||||
if (copy || Tcl_IsShared(objPtr)) {
|
||||
mp_int temp;
|
||||
|
||||
@@ -3273,14 +3377,14 @@ GetBignumFromObj(
|
||||
}
|
||||
return TCL_OK;
|
||||
}
|
||||
if (objPtr->typePtr == &tclIntType) {
|
||||
if (objPtr->typePtr == &tclIntType.objType) {
|
||||
if (mp_init_i64(bignumValue,
|
||||
objPtr->internalRep.wideValue) != MP_OKAY) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
return TCL_OK;
|
||||
}
|
||||
if (objPtr->typePtr == &tclDoubleType) {
|
||||
if (objPtr->typePtr == &tclDoubleType.objType) {
|
||||
if (interp != NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"expected integer but got \"%s\"",
|
||||
@@ -3440,7 +3544,7 @@ TclSetBignumInternalRep(
|
||||
void *big)
|
||||
{
|
||||
mp_int *bignumValue = (mp_int *)big;
|
||||
objPtr->typePtr = &tclBignumType;
|
||||
objPtr->typePtr = &tclBignumType.objType;
|
||||
PACK_BIGNUM(*bignumValue, objPtr);
|
||||
|
||||
/*
|
||||
@@ -3483,7 +3587,7 @@ Tcl_GetNumberFromObj(
|
||||
int *typePtr)
|
||||
{
|
||||
do {
|
||||
if (objPtr->typePtr == &tclDoubleType) {
|
||||
if (objPtr->typePtr == &tclDoubleType.objType) {
|
||||
if (isnan(objPtr->internalRep.doubleValue)) {
|
||||
*typePtr = TCL_NUMBER_NAN;
|
||||
} else {
|
||||
@@ -3492,12 +3596,12 @@ Tcl_GetNumberFromObj(
|
||||
*clientDataPtr = &objPtr->internalRep.doubleValue;
|
||||
return TCL_OK;
|
||||
}
|
||||
if (objPtr->typePtr == &tclIntType) {
|
||||
if (objPtr->typePtr == &tclIntType.objType) {
|
||||
*typePtr = TCL_NUMBER_INT;
|
||||
*clientDataPtr = &objPtr->internalRep.wideValue;
|
||||
return TCL_OK;
|
||||
}
|
||||
if (objPtr->typePtr == &tclBignumType) {
|
||||
if (objPtr->typePtr == &tclBignumType.objType) {
|
||||
static Tcl_ThreadDataKey bignumKey;
|
||||
mp_int *bigPtr = (mp_int *)Tcl_GetThreadData(&bignumKey,
|
||||
sizeof(mp_int));
|
||||
@@ -3644,7 +3748,7 @@ Tcl_DbIncrRefCount(
|
||||
int line) /* Line number in the source file; used for
|
||||
* debugging. */
|
||||
{
|
||||
if (objPtr->refCount == 0x61616161) {
|
||||
if (objPtr->refCount == FREEDREFCOUNTFILLER) {
|
||||
fprintf(stderr, "file = %s, line = %d\n", file, line);
|
||||
fflush(stderr);
|
||||
Tcl_Panic("incrementing refCount of previously disposed object");
|
||||
@@ -3717,7 +3821,7 @@ Tcl_DbDecrRefCount(
|
||||
int line) /* Line number in the source file; used for
|
||||
* debugging. */
|
||||
{
|
||||
if (objPtr->refCount == 0x61616161) {
|
||||
if (objPtr->refCount == FREEDREFCOUNTFILLER) {
|
||||
fprintf(stderr, "file = %s, line = %d\n", file, line);
|
||||
fflush(stderr);
|
||||
Tcl_Panic("decrementing refCount of previously disposed object");
|
||||
@@ -3799,7 +3903,7 @@ Tcl_DbIsShared(
|
||||
#endif
|
||||
{
|
||||
#ifdef TCL_MEM_DEBUG
|
||||
if (objPtr->refCount == 0x61616161) {
|
||||
if (objPtr->refCount == FREEDREFCOUNTFILLER) {
|
||||
fprintf(stderr, "file = %s, line = %d\n", file, line);
|
||||
fflush(stderr);
|
||||
Tcl_Panic("checking whether previously disposed object is shared");
|
||||
@@ -4015,7 +4119,7 @@ TclHashObjKey(
|
||||
void *keyPtr) /* Key from which to compute hash value. */
|
||||
{
|
||||
Tcl_Obj *objPtr = (Tcl_Obj *)keyPtr;
|
||||
size_t length;
|
||||
Tcl_Size length;
|
||||
const char *string = Tcl_GetStringFromObj(objPtr, &length);
|
||||
TCL_HASH_TYPE result = 0;
|
||||
|
||||
@@ -4156,7 +4260,7 @@ Tcl_GetCommandFromObj(
|
||||
* None.
|
||||
*
|
||||
* Side effects:
|
||||
* The object's old internal rep is freed. It's string rep is not
|
||||
* The object's old internal rep is freed. Its string rep is not
|
||||
* changed. The refcount in the Command structure is incremented to keep
|
||||
* it from being freed if the command is later deleted until
|
||||
* TclNRExecuteByteCode has a chance to recognize that it was deleted.
|
||||
@@ -4436,7 +4540,7 @@ Tcl_RepresentationCmd(
|
||||
objv[1]->refCount, objv[1]);
|
||||
|
||||
if (objv[1]->typePtr) {
|
||||
if (objv[1]->typePtr == &tclDoubleType) {
|
||||
if (objv[1]->typePtr == &tclDoubleType.objType) {
|
||||
Tcl_AppendPrintfToObj(descObj, ", internal representation %g",
|
||||
objv[1]->internalRep.doubleValue);
|
||||
} else {
|
||||
@@ -4447,12 +4551,12 @@ Tcl_RepresentationCmd(
|
||||
}
|
||||
|
||||
if (objv[1]->bytes) {
|
||||
Tcl_AppendToObj(descObj, ", string representation \"", -1);
|
||||
Tcl_AppendToObj(descObj, ", string representation \"", TCL_INDEX_NONE);
|
||||
Tcl_AppendLimitedToObj(descObj, objv[1]->bytes, objv[1]->length,
|
||||
16, "...");
|
||||
Tcl_AppendToObj(descObj, "\"", -1);
|
||||
Tcl_AppendToObj(descObj, "\"", TCL_INDEX_NONE);
|
||||
} else {
|
||||
Tcl_AppendToObj(descObj, ", no string representation", -1);
|
||||
Tcl_AppendToObj(descObj, ", no string representation", TCL_INDEX_NONE);
|
||||
}
|
||||
|
||||
Tcl_SetObjResult(interp, descObj);
|
||||
|
||||
@@ -134,7 +134,7 @@ LocateTargetAddresses(
|
||||
} else {
|
||||
targetInstPtr = envPtr->codeStart + rangePtr->breakOffset;
|
||||
DefineTargetAddress(tablePtr, targetInstPtr);
|
||||
if (rangePtr->continueOffset != TCL_INDEX_NONE) {
|
||||
if (!TCL_SIZE_ISNEG(rangePtr->continueOffset)) {
|
||||
targetInstPtr = envPtr->codeStart + rangePtr->continueOffset;
|
||||
DefineTargetAddress(tablePtr, targetInstPtr);
|
||||
}
|
||||
|
||||
+21
-21
@@ -39,7 +39,7 @@
|
||||
* TYPE_BRACE - Character is a curly brace (either left or right).
|
||||
*/
|
||||
|
||||
const char tclCharTypeTable[] = {
|
||||
const unsigned char tclCharTypeTable[] = {
|
||||
|
||||
/*
|
||||
* Positive character values, from 0-127:
|
||||
@@ -198,7 +198,7 @@ Tcl_ParseCommand(
|
||||
* NULL, then no error message is provided. */
|
||||
const char *start, /* First character of string containing one or
|
||||
* more Tcl commands. */
|
||||
size_t numBytes, /* Total number of bytes in string. If -1,
|
||||
Tcl_Size numBytes, /* Total number of bytes in string. If TCL_INDEX_NONE,
|
||||
* the script consists of all bytes up to the
|
||||
* first null character. */
|
||||
int nested, /* Non-zero means this is a nested command:
|
||||
@@ -221,14 +221,14 @@ Tcl_ParseCommand(
|
||||
* point to char after terminating one. */
|
||||
size_t scanned;
|
||||
|
||||
if (numBytes == TCL_INDEX_NONE && start) {
|
||||
if (TCL_SIZE_ISNEG(numBytes) && start) {
|
||||
numBytes = strlen(start);
|
||||
}
|
||||
TclParseInit(interp, start, numBytes, parsePtr);
|
||||
if ((start == NULL) && (numBytes != 0)) {
|
||||
if (interp != NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"can't parse a NULL pointer", -1));
|
||||
"can't parse a NULL pointer", TCL_INDEX_NONE));
|
||||
}
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -282,13 +282,13 @@ Tcl_ParseCommand(
|
||||
if (src[-1] == '"') {
|
||||
if (interp != NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"extra characters after close-quote", -1));
|
||||
"extra characters after close-quote", TCL_INDEX_NONE));
|
||||
}
|
||||
parsePtr->errorType = TCL_PARSE_QUOTE_EXTRA;
|
||||
} else {
|
||||
if (interp != NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"extra characters after close-brace", -1));
|
||||
"extra characters after close-brace", TCL_INDEX_NONE));
|
||||
}
|
||||
parsePtr->errorType = TCL_PARSE_BRACE_EXTRA;
|
||||
}
|
||||
@@ -1179,7 +1179,7 @@ ParseTokens(
|
||||
if (numBytes == 0) {
|
||||
if (parsePtr->interp != NULL) {
|
||||
Tcl_SetObjResult(parsePtr->interp, Tcl_NewStringObj(
|
||||
"missing close-bracket", -1));
|
||||
"missing close-bracket", TCL_INDEX_NONE));
|
||||
}
|
||||
parsePtr->errorType = TCL_PARSE_MISSING_BRACKET;
|
||||
parsePtr->term = tokenPtr->start;
|
||||
@@ -1335,7 +1335,7 @@ Tcl_ParseVarName(
|
||||
* NULL, then no error message is provided. */
|
||||
const char *start, /* Start of variable substitution string.
|
||||
* First character must be "$". */
|
||||
size_t numBytes, /* Total number of bytes in string. If -1,
|
||||
Tcl_Size numBytes, /* Total number of bytes in string. If TCL_INDEX_NONE,
|
||||
* the string consists of all bytes up to the
|
||||
* first null character. */
|
||||
Tcl_Parse *parsePtr, /* Structure to fill in with information about
|
||||
@@ -1350,7 +1350,7 @@ Tcl_ParseVarName(
|
||||
int varIndex;
|
||||
unsigned array;
|
||||
|
||||
if (numBytes == TCL_INDEX_NONE && start) {
|
||||
if (TCL_SIZE_ISNEG(numBytes) && start) {
|
||||
numBytes = strlen(start);
|
||||
}
|
||||
if (!append) {
|
||||
@@ -1425,7 +1425,7 @@ Tcl_ParseVarName(
|
||||
if (numBytes == 0) {
|
||||
if (parsePtr->interp != NULL) {
|
||||
Tcl_SetObjResult(parsePtr->interp, Tcl_NewStringObj(
|
||||
"missing close-brace for variable name", -1));
|
||||
"missing close-brace for variable name", TCL_INDEX_NONE));
|
||||
}
|
||||
parsePtr->errorType = TCL_PARSE_MISSING_VAR_BRACE;
|
||||
parsePtr->term = tokenPtr->start-1;
|
||||
@@ -1483,7 +1483,7 @@ Tcl_ParseVarName(
|
||||
if (parsePtr->term == src+numBytes){
|
||||
if (parsePtr->interp != NULL) {
|
||||
Tcl_SetObjResult(parsePtr->interp, Tcl_NewStringObj(
|
||||
"missing )", -1));
|
||||
"missing )", TCL_INDEX_NONE));
|
||||
}
|
||||
parsePtr->errorType = TCL_PARSE_MISSING_PAREN;
|
||||
parsePtr->term = src;
|
||||
@@ -1492,7 +1492,7 @@ Tcl_ParseVarName(
|
||||
} else if ((*parsePtr->term != ')')){
|
||||
if (parsePtr->interp != NULL) {
|
||||
Tcl_SetObjResult(parsePtr->interp, Tcl_NewStringObj(
|
||||
"invalid character in array index", -1));
|
||||
"invalid character in array index", TCL_INDEX_NONE));
|
||||
}
|
||||
parsePtr->errorType = TCL_PARSE_SYNTAX;
|
||||
parsePtr->term = src;
|
||||
@@ -1558,7 +1558,7 @@ Tcl_ParseVar(
|
||||
int code;
|
||||
Tcl_Parse *parsePtr = (Tcl_Parse *)TclStackAlloc(interp, sizeof(Tcl_Parse));
|
||||
|
||||
if (Tcl_ParseVarName(interp, start, -1, parsePtr, 0) != TCL_OK) {
|
||||
if (Tcl_ParseVarName(interp, start, TCL_INDEX_NONE, parsePtr, 0) != TCL_OK) {
|
||||
TclStackFree(interp, parsePtr);
|
||||
return NULL;
|
||||
}
|
||||
@@ -1633,7 +1633,7 @@ Tcl_ParseBraces(
|
||||
* NULL, then no error message is provided. */
|
||||
const char *start, /* Start of string enclosed in braces. The
|
||||
* first character must be {'. */
|
||||
size_t numBytes, /* Total number of bytes in string. If -1,
|
||||
Tcl_Size numBytes, /* Total number of bytes in string. If TCL_INDEX_NONE,
|
||||
* the string consists of all bytes up to the
|
||||
* first null character. */
|
||||
Tcl_Parse *parsePtr,
|
||||
@@ -1651,9 +1651,9 @@ Tcl_ParseBraces(
|
||||
Tcl_Token *tokenPtr;
|
||||
const char *src;
|
||||
int startIndex, level;
|
||||
size_t length;
|
||||
Tcl_Size length;
|
||||
|
||||
if (numBytes == TCL_INDEX_NONE && start) {
|
||||
if (TCL_SIZE_ISNEG(numBytes) && start) {
|
||||
numBytes = strlen(start);
|
||||
}
|
||||
if (!append) {
|
||||
@@ -1765,7 +1765,7 @@ Tcl_ParseBraces(
|
||||
}
|
||||
|
||||
Tcl_SetObjResult(parsePtr->interp, Tcl_NewStringObj(
|
||||
"missing close-brace", -1));
|
||||
"missing close-brace", TCL_INDEX_NONE));
|
||||
|
||||
/*
|
||||
* Guess if the problem is due to comments by searching the source string
|
||||
@@ -1788,7 +1788,7 @@ Tcl_ParseBraces(
|
||||
case '#' :
|
||||
if (openBrace && TclIsSpaceProcM(src[-1])) {
|
||||
Tcl_AppendToObj(Tcl_GetObjResult(parsePtr->interp),
|
||||
": possible unbalanced brace in comment", -1);
|
||||
": possible unbalanced brace in comment", TCL_INDEX_NONE);
|
||||
goto error;
|
||||
}
|
||||
break;
|
||||
@@ -1835,7 +1835,7 @@ Tcl_ParseQuotedString(
|
||||
* NULL, then no error message is provided. */
|
||||
const char *start, /* Start of the quoted string. The first
|
||||
* character must be '"'. */
|
||||
size_t numBytes, /* Total number of bytes in string. If -1,
|
||||
Tcl_Size numBytes, /* Total number of bytes in string. If TCL_INDEX_NONE,
|
||||
* the string consists of all bytes up to the
|
||||
* first null character. */
|
||||
Tcl_Parse *parsePtr,
|
||||
@@ -1850,7 +1850,7 @@ Tcl_ParseQuotedString(
|
||||
* the quoted string's terminating close-quote
|
||||
* if the parse succeeds. */
|
||||
{
|
||||
if (numBytes == TCL_INDEX_NONE && start) {
|
||||
if (TCL_SIZE_ISNEG(numBytes) && start) {
|
||||
numBytes = strlen(start);
|
||||
}
|
||||
if (!append) {
|
||||
@@ -1867,7 +1867,7 @@ Tcl_ParseQuotedString(
|
||||
if (*parsePtr->term != '"') {
|
||||
if (parsePtr->interp != NULL) {
|
||||
Tcl_SetObjResult(parsePtr->interp, Tcl_NewStringObj(
|
||||
"missing \"", -1));
|
||||
"missing \"", TCL_INDEX_NONE));
|
||||
}
|
||||
parsePtr->errorType = TCL_PARSE_MISSING_QUOTE;
|
||||
parsePtr->term = start;
|
||||
|
||||
+1
-1
@@ -16,4 +16,4 @@
|
||||
|
||||
#define CHAR_TYPE(c) tclCharTypeTable[(unsigned char)(c)]
|
||||
|
||||
MODULE_SCOPE const char tclCharTypeTable[];
|
||||
MODULE_SCOPE const unsigned char tclCharTypeTable[];
|
||||
|
||||
+19
-17
@@ -65,7 +65,7 @@ typedef struct {
|
||||
* normPathPtr exists and is absolute. */
|
||||
int flags; /* Flags to describe interpretation - see
|
||||
* below. */
|
||||
ClientData nativePathPtr; /* Native representation of this path, which
|
||||
void *nativePathPtr; /* Native representation of this path, which
|
||||
* is filesystem dependent. */
|
||||
size_t filesystemEpoch; /* Used to ensure the path representation was
|
||||
* generated during the correct filesystem
|
||||
@@ -624,7 +624,7 @@ TclPathPart(
|
||||
return GetExtension(fsPathPtr->normPathPtr);
|
||||
case TCL_PATH_ROOT: {
|
||||
const char *fileName, *extension;
|
||||
size_t length;
|
||||
Tcl_Size length;
|
||||
|
||||
fileName = Tcl_GetStringFromObj(fsPathPtr->normPathPtr,
|
||||
&length);
|
||||
@@ -751,7 +751,7 @@ GetExtension(
|
||||
if (extension == NULL) {
|
||||
TclNewObj(ret);
|
||||
} else {
|
||||
ret = Tcl_NewStringObj(extension, -1);
|
||||
ret = Tcl_NewStringObj(extension, TCL_INDEX_NONE);
|
||||
}
|
||||
Tcl_IncrRefCount(ret);
|
||||
return ret;
|
||||
@@ -795,17 +795,17 @@ Tcl_Obj *
|
||||
Tcl_FSJoinPath(
|
||||
Tcl_Obj *listObj, /* Path elements to join, may have a zero
|
||||
* reference count. */
|
||||
size_t elements) /* Number of elements to use (-1 = all) */
|
||||
Tcl_Size elements) /* Number of elements to use (TCL_INDEX_NONE = all) */
|
||||
{
|
||||
Tcl_Obj *res;
|
||||
size_t objc;
|
||||
Tcl_Size objc;
|
||||
Tcl_Obj **objv;
|
||||
|
||||
if (TclListObjLengthM(NULL, listObj, &objc) != TCL_OK) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
elements = ((elements != TCL_INDEX_NONE) && (elements <= objc)) ? elements : objc;
|
||||
elements = (!TCL_SIZE_ISNEG(elements) && (elements <= objc)) ? elements : objc;
|
||||
TclListObjGetElementsM(NULL, listObj, &objc, &objv);
|
||||
res = TclJoinPath(elements, objv, 0);
|
||||
return res;
|
||||
@@ -813,13 +813,13 @@ Tcl_FSJoinPath(
|
||||
|
||||
Tcl_Obj *
|
||||
TclJoinPath(
|
||||
size_t elements, /* Number of elements to use */
|
||||
Tcl_Size elements, /* Number of elements to use */
|
||||
Tcl_Obj * const objv[], /* Path elements to join */
|
||||
int forceRelative) /* If non-zero, assume all more paths are
|
||||
* relative (e. g. simple normalization) */
|
||||
{
|
||||
Tcl_Obj *res = NULL;
|
||||
size_t i;
|
||||
Tcl_Size i;
|
||||
const Tcl_Filesystem *fsPtr = NULL;
|
||||
|
||||
if (elements == 0) {
|
||||
@@ -1489,7 +1489,7 @@ MakePathFromNormalized(
|
||||
Tcl_Obj *
|
||||
Tcl_FSNewNativePath(
|
||||
const Tcl_Filesystem *fromFilesystem,
|
||||
ClientData clientData)
|
||||
void *clientData)
|
||||
{
|
||||
Tcl_Obj *pathPtr = NULL;
|
||||
FsPath *fsPathPtr;
|
||||
@@ -1927,7 +1927,7 @@ Tcl_FSGetNormalizedPath(
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
ClientData
|
||||
void *
|
||||
Tcl_FSGetInternalRep(
|
||||
Tcl_Obj *pathPtr,
|
||||
const Tcl_Filesystem *fsPtr)
|
||||
@@ -2074,7 +2074,7 @@ void
|
||||
TclFSSetPathDetails(
|
||||
Tcl_Obj *pathPtr,
|
||||
const Tcl_Filesystem *fsPtr,
|
||||
ClientData clientData)
|
||||
void *clientData)
|
||||
{
|
||||
FsPath *srcFsPathPtr;
|
||||
|
||||
@@ -2207,10 +2207,12 @@ SetFsPathFromAny(
|
||||
fsPathPtr = (FsPath *)Tcl_Alloc(sizeof(FsPath));
|
||||
|
||||
if (transPtr == pathPtr) {
|
||||
transPtr = Tcl_DuplicateObj(pathPtr);
|
||||
fsPathPtr->filesystemEpoch = 0;
|
||||
(void) Tcl_GetString(pathPtr);
|
||||
TclFreeInternalRep(pathPtr);
|
||||
transPtr = Tcl_DuplicateObj(pathPtr);
|
||||
fsPathPtr->filesystemEpoch = 0;
|
||||
} else {
|
||||
fsPathPtr->filesystemEpoch = TclFSEpoch();
|
||||
fsPathPtr->filesystemEpoch = TclFSEpoch();
|
||||
}
|
||||
Tcl_IncrRefCount(transPtr);
|
||||
fsPathPtr->translatedPathPtr = transPtr;
|
||||
@@ -2368,7 +2370,7 @@ UpdateStringOfFsPath(
|
||||
int
|
||||
TclNativePathInFilesystem(
|
||||
Tcl_Obj *pathPtr,
|
||||
TCL_UNUSED(ClientData *))
|
||||
TCL_UNUSED(void **))
|
||||
{
|
||||
/*
|
||||
* A special case is required to handle the empty path "". This is a valid
|
||||
@@ -2514,7 +2516,7 @@ TclGetHomeDirObj(
|
||||
if (MakeTildeRelativePath(interp, user, NULL, &dirString) != TCL_OK) {
|
||||
return NULL;
|
||||
}
|
||||
return TclDStringToObj(&dirString);
|
||||
return Tcl_DStringToObj(&dirString);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2586,7 +2588,7 @@ TclResolveTildePath(
|
||||
}
|
||||
Tcl_DStringFree(&userName);
|
||||
}
|
||||
return TclDStringToObj(&resolvedPath);
|
||||
return Tcl_DStringToObj(&resolvedPath);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+15
-15
@@ -179,12 +179,12 @@ FileForRedirect(
|
||||
|
||||
void
|
||||
Tcl_DetachPids(
|
||||
size_t numPids, /* Number of pids to detach: gives size of
|
||||
Tcl_Size numPids, /* Number of pids to detach: gives size of
|
||||
* array pointed to by pidPtr. */
|
||||
Tcl_Pid *pidPtr) /* Array of pids to detach. */
|
||||
{
|
||||
Detached *detPtr;
|
||||
size_t i;
|
||||
Tcl_Size i;
|
||||
|
||||
Tcl_MutexLock(&pipeMutex);
|
||||
for (i = 0; i < numPids; i++) {
|
||||
@@ -269,7 +269,7 @@ Tcl_ReapDetachedProcs(void)
|
||||
int
|
||||
TclCleanupChildren(
|
||||
Tcl_Interp *interp, /* Used for error messages. */
|
||||
size_t numPids, /* Number of entries in pidPtr array. */
|
||||
Tcl_Size numPids, /* Number of entries in pidPtr array. */
|
||||
Tcl_Pid *pidPtr, /* Array of process ids of children. */
|
||||
Tcl_Channel errorChan) /* Channel for file containing stderr output
|
||||
* from pipeline. NULL means there isn't any
|
||||
@@ -278,7 +278,7 @@ TclCleanupChildren(
|
||||
int result = TCL_OK;
|
||||
int code, abnormalExit, anyErrorInfo;
|
||||
TclProcessWaitStatus waitStatus;
|
||||
size_t i;
|
||||
Tcl_Size i;
|
||||
Tcl_Obj *msg, *error;
|
||||
|
||||
abnormalExit = 0;
|
||||
@@ -335,7 +335,7 @@ TclCleanupChildren(
|
||||
|
||||
Tcl_Seek(errorChan, 0, SEEK_SET);
|
||||
TclNewObj(objPtr);
|
||||
count = Tcl_ReadChars(errorChan, objPtr, -1, 0);
|
||||
count = Tcl_ReadChars(errorChan, objPtr, TCL_INDEX_NONE, 0);
|
||||
if (count == -1) {
|
||||
result = TCL_ERROR;
|
||||
Tcl_DecrRefCount(objPtr);
|
||||
@@ -361,7 +361,7 @@ TclCleanupChildren(
|
||||
|
||||
if ((abnormalExit != 0) && (anyErrorInfo == 0) && (interp != NULL)) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"child process exited abnormally", -1));
|
||||
"child process exited abnormally", TCL_INDEX_NONE));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -395,10 +395,10 @@ TclCleanupChildren(
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
size_t
|
||||
Tcl_Size
|
||||
TclCreatePipeline(
|
||||
Tcl_Interp *interp, /* Interpreter to use for error reporting. */
|
||||
size_t argc, /* Number of entries in argv. */
|
||||
Tcl_Size argc, /* Number of entries in argv. */
|
||||
const char **argv, /* Array of strings describing commands in
|
||||
* pipeline plus I/O redirection with <, <<,
|
||||
* >, etc. Argv[argc] must be NULL. */
|
||||
@@ -512,7 +512,7 @@ TclCreatePipeline(
|
||||
if (*p == '\0') {
|
||||
if ((i == (lastBar + 1)) || (i == (argc - 1))) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"illegal use of | or |& in command", -1));
|
||||
"illegal use of | or |& in command", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "EXEC",
|
||||
"PIPESYNTAX", NULL);
|
||||
goto error;
|
||||
@@ -700,7 +700,7 @@ TclCreatePipeline(
|
||||
*/
|
||||
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"illegal use of | or |& in command", -1));
|
||||
"illegal use of | or |& in command", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "EXEC", "PIPESYNTAX",
|
||||
NULL);
|
||||
goto error;
|
||||
@@ -1021,7 +1021,7 @@ Tcl_Channel
|
||||
Tcl_OpenCommandChannel(
|
||||
Tcl_Interp *interp, /* Interpreter for error reporting. Can NOT be
|
||||
* NULL. */
|
||||
size_t argc, /* How many arguments. */
|
||||
Tcl_Size argc, /* How many arguments. */
|
||||
const char **argv, /* Array of arguments for command pipe. */
|
||||
int flags) /* Or'ed combination of TCL_STDIN, TCL_STDOUT,
|
||||
* TCL_STDERR, and TCL_ENFORCE_MODE. */
|
||||
@@ -1041,7 +1041,7 @@ Tcl_OpenCommandChannel(
|
||||
numPids = TclCreatePipeline(interp, argc, argv, &pidPtr, inPipePtr,
|
||||
outPipePtr, errFilePtr);
|
||||
|
||||
if (numPids == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(numPids)) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -1054,7 +1054,7 @@ Tcl_OpenCommandChannel(
|
||||
if ((flags & TCL_STDOUT) && (outPipe == NULL)) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"can't read output from command:"
|
||||
" standard output was redirected", -1));
|
||||
" standard output was redirected", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "EXEC",
|
||||
"BADREDIRECT", NULL);
|
||||
goto error;
|
||||
@@ -1062,7 +1062,7 @@ Tcl_OpenCommandChannel(
|
||||
if ((flags & TCL_STDIN) && (inPipe == NULL)) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"can't write input to command:"
|
||||
" standard input was redirected", -1));
|
||||
" standard input was redirected", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "EXEC",
|
||||
"BADREDIRECT", NULL);
|
||||
goto error;
|
||||
@@ -1074,7 +1074,7 @@ Tcl_OpenCommandChannel(
|
||||
|
||||
if (channel == NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"pipe for command could not be created", -1));
|
||||
"pipe for command could not be created", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "EXEC", "NOPIPE", NULL);
|
||||
goto error;
|
||||
}
|
||||
|
||||
+43
-43
@@ -96,15 +96,15 @@ static void AddRequirementsToResult(Tcl_Interp *interp, int reqc,
|
||||
static void AddRequirementsToDString(Tcl_DString *dstring,
|
||||
int reqc, Tcl_Obj *const reqv[]);
|
||||
static Package * FindPackage(Tcl_Interp *interp, const char *name);
|
||||
static int PkgRequireCore(ClientData data[], Tcl_Interp *interp, int result);
|
||||
static int PkgRequireCoreFinal(ClientData data[], Tcl_Interp *interp, int result);
|
||||
static int PkgRequireCoreCleanup(ClientData data[], Tcl_Interp *interp, int result);
|
||||
static int PkgRequireCoreStep1(ClientData data[], Tcl_Interp *interp, int result);
|
||||
static int PkgRequireCoreStep2(ClientData data[], Tcl_Interp *interp, int result);
|
||||
static int TclNRPkgRequireProc(ClientData clientData, Tcl_Interp *interp, int reqc, Tcl_Obj *const reqv[]);
|
||||
static int SelectPackage(ClientData data[], Tcl_Interp *interp, int result);
|
||||
static int SelectPackageFinal(ClientData data[], Tcl_Interp *interp, int result);
|
||||
static int TclNRPackageObjCmdCleanup(ClientData data[], Tcl_Interp *interp, int result);
|
||||
static int PkgRequireCore(void *data[], Tcl_Interp *interp, int result);
|
||||
static int PkgRequireCoreFinal(void *data[], Tcl_Interp *interp, int result);
|
||||
static int PkgRequireCoreCleanup(void *data[], Tcl_Interp *interp, int result);
|
||||
static int PkgRequireCoreStep1(void *data[], Tcl_Interp *interp, int result);
|
||||
static int PkgRequireCoreStep2(void *data[], Tcl_Interp *interp, int result);
|
||||
static int TclNRPkgRequireProc(void *clientData, Tcl_Interp *interp, int reqc, Tcl_Obj *const reqv[]);
|
||||
static int SelectPackage(void *data[], Tcl_Interp *interp, int result);
|
||||
static int SelectPackageFinal(void *data[], Tcl_Interp *interp, int result);
|
||||
static int TclNRPackageObjCmdCleanup(void *data[], Tcl_Interp *interp, int result);
|
||||
|
||||
/*
|
||||
* Helper macros.
|
||||
@@ -165,7 +165,7 @@ Tcl_PkgProvideEx(
|
||||
|
||||
pkgPtr = FindPackage(interp, name);
|
||||
if (pkgPtr->version == NULL) {
|
||||
pkgPtr->version = Tcl_NewStringObj(version, -1);
|
||||
pkgPtr->version = Tcl_NewStringObj(version, TCL_INDEX_NONE);
|
||||
Tcl_IncrRefCount(pkgPtr->version);
|
||||
pkgPtr->clientData = clientData;
|
||||
return TCL_OK;
|
||||
@@ -225,7 +225,7 @@ Tcl_PkgProvideEx(
|
||||
|
||||
static void
|
||||
PkgFilesCleanupProc(
|
||||
ClientData clientData,
|
||||
void *clientData,
|
||||
TCL_UNUSED(Tcl_Interp *))
|
||||
{
|
||||
PkgFiles *pkgFiles = (PkgFiles *) clientData;
|
||||
@@ -291,7 +291,7 @@ TclPkgFileSeen(
|
||||
} else {
|
||||
list = (Tcl_Obj *)Tcl_GetHashValue(entry);
|
||||
}
|
||||
Tcl_ListObjAppendElement(interp, list, Tcl_NewStringObj(fileName, -1));
|
||||
Tcl_ListObjAppendElement(interp, list, Tcl_NewStringObj(fileName, TCL_INDEX_NONE));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -399,7 +399,7 @@ Tcl_PkgRequireEx(
|
||||
|
||||
if (version == NULL) {
|
||||
if (Tcl_PkgRequireProc(interp, name, 0, NULL, clientDataPtr) == TCL_OK) {
|
||||
result = Tcl_GetString(Tcl_GetObjResult(interp));
|
||||
result = Tcl_GetStringResult(interp);
|
||||
Tcl_ResetResult(interp);
|
||||
}
|
||||
} else {
|
||||
@@ -407,13 +407,13 @@ Tcl_PkgRequireEx(
|
||||
!= CheckVersionAndConvert(interp, version, NULL, NULL)) {
|
||||
return NULL;
|
||||
}
|
||||
ov = Tcl_NewStringObj(version, -1);
|
||||
ov = Tcl_NewStringObj(version, TCL_INDEX_NONE);
|
||||
if (exact) {
|
||||
Tcl_AppendStringsToObj(ov, "-", version, NULL);
|
||||
}
|
||||
Tcl_IncrRefCount(ov);
|
||||
if (Tcl_PkgRequireProc(interp, name, 1, &ov, clientDataPtr) == TCL_OK) {
|
||||
result = Tcl_GetString(Tcl_GetObjResult(interp));
|
||||
result = Tcl_GetStringResult(interp);
|
||||
Tcl_ResetResult(interp);
|
||||
}
|
||||
TclDecrRefCount(ov);
|
||||
@@ -426,7 +426,7 @@ Tcl_PkgRequireProc(
|
||||
Tcl_Interp *interp, /* Interpreter in which package is now
|
||||
* available. */
|
||||
const char *name, /* Name of desired package. */
|
||||
size_t reqc, /* Requirements constraining the desired
|
||||
Tcl_Size reqc, /* Requirements constraining the desired
|
||||
* version. */
|
||||
Tcl_Obj *const reqv[], /* 0 means to use the latest version
|
||||
* available. */
|
||||
@@ -442,7 +442,7 @@ Tcl_PkgRequireProc(
|
||||
|
||||
static int
|
||||
TclNRPkgRequireProc(
|
||||
ClientData clientData,
|
||||
void *clientData,
|
||||
Tcl_Interp *interp,
|
||||
int reqc,
|
||||
Tcl_Obj *const reqv[])
|
||||
@@ -457,12 +457,12 @@ TclNRPkgRequireProc(
|
||||
|
||||
static int
|
||||
PkgRequireCore(
|
||||
ClientData data[],
|
||||
void *data[],
|
||||
Tcl_Interp *interp,
|
||||
TCL_UNUSED(int))
|
||||
{
|
||||
const char *name = (const char *)data[0];
|
||||
int reqc = PTR2INT(data[1]);
|
||||
int reqc = (int)PTR2INT(data[1]);
|
||||
Tcl_Obj **reqv = (Tcl_Obj **)data[2];
|
||||
int code = CheckAllRequirements(interp, reqc, reqv);
|
||||
Require *reqPtr;
|
||||
@@ -488,14 +488,14 @@ PkgRequireCore(
|
||||
|
||||
static int
|
||||
PkgRequireCoreStep1(
|
||||
ClientData data[],
|
||||
void *data[],
|
||||
Tcl_Interp *interp,
|
||||
TCL_UNUSED(int))
|
||||
{
|
||||
Tcl_DString command;
|
||||
char *script;
|
||||
Require *reqPtr = (Require *)data[0];
|
||||
int reqc = PTR2INT(data[1]);
|
||||
int reqc = (int)PTR2INT(data[1]);
|
||||
Tcl_Obj **const reqv = (Tcl_Obj **)data[2];
|
||||
const char *name = reqPtr->name /* Name of desired package. */;
|
||||
|
||||
@@ -531,7 +531,7 @@ PkgRequireCoreStep1(
|
||||
*/
|
||||
|
||||
Tcl_DStringInit(&command);
|
||||
Tcl_DStringAppend(&command, script, -1);
|
||||
Tcl_DStringAppend(&command, script, TCL_INDEX_NONE);
|
||||
Tcl_DStringAppendElement(&command, name);
|
||||
AddRequirementsToDString(&command, reqc, reqv);
|
||||
|
||||
@@ -547,12 +547,12 @@ PkgRequireCoreStep1(
|
||||
|
||||
static int
|
||||
PkgRequireCoreStep2(
|
||||
ClientData data[],
|
||||
void *data[],
|
||||
Tcl_Interp *interp,
|
||||
int result)
|
||||
{
|
||||
Require *reqPtr = (Require *)data[0];
|
||||
int reqc = PTR2INT(data[1]);
|
||||
int reqc = (int)PTR2INT(data[1]);
|
||||
Tcl_Obj **const reqv = (Tcl_Obj **)data[2];
|
||||
const char *name = reqPtr->name; /* Name of desired package. */
|
||||
|
||||
@@ -582,12 +582,12 @@ PkgRequireCoreStep2(
|
||||
|
||||
static int
|
||||
PkgRequireCoreFinal(
|
||||
ClientData data[],
|
||||
void *data[],
|
||||
Tcl_Interp *interp,
|
||||
TCL_UNUSED(int))
|
||||
{
|
||||
Require *reqPtr = (Require *)data[0];
|
||||
int reqc = PTR2INT(data[1]), satisfies;
|
||||
int reqc = (int)PTR2INT(data[1]), satisfies;
|
||||
Tcl_Obj **const reqv = (Tcl_Obj **)data[2];
|
||||
char *pkgVersionI;
|
||||
void *clientDataPtr = reqPtr->clientDataPtr;
|
||||
@@ -634,7 +634,7 @@ PkgRequireCoreFinal(
|
||||
|
||||
static int
|
||||
PkgRequireCoreCleanup(
|
||||
ClientData data[],
|
||||
void *data[],
|
||||
TCL_UNUSED(Tcl_Interp *),
|
||||
int result)
|
||||
{
|
||||
@@ -644,7 +644,7 @@ PkgRequireCoreCleanup(
|
||||
|
||||
static int
|
||||
SelectPackage(
|
||||
ClientData data[],
|
||||
void *data[],
|
||||
Tcl_Interp *interp,
|
||||
TCL_UNUSED(int))
|
||||
{
|
||||
@@ -653,7 +653,7 @@ SelectPackage(
|
||||
/* Internal rep. of versions */
|
||||
int availStable, satisfies;
|
||||
Require *reqPtr = (Require *)data[0];
|
||||
int reqc = PTR2INT(data[1]);
|
||||
int reqc = (int)PTR2INT(data[1]);
|
||||
Tcl_Obj **const reqv = (Tcl_Obj **)data[2];
|
||||
const char *name = reqPtr->name;
|
||||
Package *pkgPtr = reqPtr->pkgPtr;
|
||||
@@ -839,7 +839,7 @@ SelectPackage(
|
||||
Tcl_NRAddCallback(interp,
|
||||
SelectPackageFinal, reqPtr, INT2PTR(reqc), (void *)reqv,
|
||||
data[3]);
|
||||
Tcl_NREvalObj(interp, Tcl_NewStringObj(bestPtr->script, -1),
|
||||
Tcl_NREvalObj(interp, Tcl_NewStringObj(bestPtr->script, TCL_INDEX_NONE),
|
||||
TCL_EVAL_GLOBAL);
|
||||
}
|
||||
return TCL_OK;
|
||||
@@ -847,12 +847,12 @@ SelectPackage(
|
||||
|
||||
static int
|
||||
SelectPackageFinal(
|
||||
ClientData data[],
|
||||
void *data[],
|
||||
Tcl_Interp *interp,
|
||||
int result)
|
||||
{
|
||||
Require *reqPtr = (Require *)data[0];
|
||||
int reqc = PTR2INT(data[1]);
|
||||
int reqc = (int)PTR2INT(data[1]);
|
||||
Tcl_Obj **const reqv = (Tcl_Obj **)data[2];
|
||||
const char *name = reqPtr->name;
|
||||
char *versionToProvide = reqPtr->versionToProvide;
|
||||
@@ -1053,7 +1053,7 @@ Tcl_PkgPresentEx(
|
||||
*/
|
||||
int
|
||||
Tcl_PackageObjCmd(
|
||||
ClientData clientData,
|
||||
void *clientData,
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
@@ -1160,7 +1160,7 @@ TclNRPackageObjCmd(
|
||||
break;
|
||||
}
|
||||
case PKG_IFNEEDED: {
|
||||
size_t length;
|
||||
Tcl_Size length;
|
||||
int res;
|
||||
char *argv3i, *avi;
|
||||
|
||||
@@ -1200,7 +1200,7 @@ TclNRPackageObjCmd(
|
||||
if (objc == 4) {
|
||||
Tcl_Free(argv3i);
|
||||
Tcl_SetObjResult(interp,
|
||||
Tcl_NewStringObj(availPtr->script, -1));
|
||||
Tcl_NewStringObj(availPtr->script, TCL_INDEX_NONE));
|
||||
return TCL_OK;
|
||||
}
|
||||
Tcl_EventuallyFree(availPtr->script, TCL_DYNAMIC);
|
||||
@@ -1251,7 +1251,7 @@ TclNRPackageObjCmd(
|
||||
pkgPtr = (Package *)Tcl_GetHashValue(hPtr);
|
||||
if ((pkgPtr->version != NULL) || (pkgPtr->availPtr != NULL)) {
|
||||
Tcl_ListObjAppendElement(NULL,resultObj, Tcl_NewStringObj(
|
||||
(char *)Tcl_GetHashKey(tablePtr, hPtr), -1));
|
||||
(char *)Tcl_GetHashKey(tablePtr, hPtr), TCL_INDEX_NONE));
|
||||
}
|
||||
}
|
||||
Tcl_SetObjResult(interp, resultObj);
|
||||
@@ -1353,7 +1353,7 @@ TclNRPackageObjCmd(
|
||||
* Create a new-style requirement for the exact version.
|
||||
*/
|
||||
|
||||
ov = Tcl_NewStringObj(version, -1);
|
||||
ov = Tcl_NewStringObj(version, TCL_INDEX_NONE);
|
||||
Tcl_AppendStringsToObj(ov, "-", version, NULL);
|
||||
version = NULL;
|
||||
argv3 = TclGetString(objv[3]);
|
||||
@@ -1399,12 +1399,12 @@ TclNRPackageObjCmd(
|
||||
}
|
||||
break;
|
||||
case PKG_UNKNOWN: {
|
||||
size_t length;
|
||||
Tcl_Size length;
|
||||
|
||||
if (objc == 2) {
|
||||
if (iPtr->packageUnknown != NULL) {
|
||||
Tcl_SetObjResult(interp,
|
||||
Tcl_NewStringObj(iPtr->packageUnknown, -1));
|
||||
Tcl_NewStringObj(iPtr->packageUnknown, TCL_INDEX_NONE));
|
||||
}
|
||||
} else if (objc == 3) {
|
||||
if (iPtr->packageUnknown != NULL) {
|
||||
@@ -1456,7 +1456,7 @@ TclNRPackageObjCmd(
|
||||
*/
|
||||
|
||||
Tcl_SetObjResult(interp,
|
||||
Tcl_NewStringObj(pkgPreferOptions[iPtr->packagePrefer], -1));
|
||||
Tcl_NewStringObj(pkgPreferOptions[iPtr->packagePrefer], TCL_INDEX_NONE));
|
||||
break;
|
||||
}
|
||||
case PKG_VCOMPARE:
|
||||
@@ -1503,7 +1503,7 @@ TclNRPackageObjCmd(
|
||||
for (availPtr = pkgPtr->availPtr; availPtr != NULL;
|
||||
availPtr = availPtr->nextPtr) {
|
||||
Tcl_ListObjAppendElement(NULL, resultObj,
|
||||
Tcl_NewStringObj(availPtr->version, -1));
|
||||
Tcl_NewStringObj(availPtr->version, TCL_INDEX_NONE));
|
||||
}
|
||||
}
|
||||
Tcl_SetObjResult(interp, resultObj);
|
||||
@@ -1539,7 +1539,7 @@ TclNRPackageObjCmd(
|
||||
|
||||
static int
|
||||
TclNRPackageObjCmdCleanup(
|
||||
ClientData data[],
|
||||
void *data[],
|
||||
TCL_UNUSED(Tcl_Interp *),
|
||||
int result)
|
||||
{
|
||||
@@ -2072,7 +2072,7 @@ AddRequirementsToResult(
|
||||
{
|
||||
Tcl_Obj *result = Tcl_GetObjResult(interp);
|
||||
int i;
|
||||
size_t length;
|
||||
Tcl_Size length;
|
||||
|
||||
for (i = 0; i < reqc; i++) {
|
||||
const char *v = Tcl_GetStringFromObj(reqv[i], &length);
|
||||
|
||||
@@ -151,7 +151,7 @@ extern "C" {
|
||||
EXTERN int Tcl_MacOSXOpenVersionedBundleResources(
|
||||
Tcl_Interp *interp, const char *bundleName,
|
||||
const char *bundleVersion,
|
||||
int hasResourceFile, size_t maxPathLen,
|
||||
int hasResourceFile, Tcl_Size maxPathLen,
|
||||
char *libraryPath);
|
||||
/* 2 */
|
||||
EXTERN void Tcl_MacOSXNotifierAddRunLoopMode(
|
||||
@@ -164,7 +164,7 @@ typedef struct TclPlatStubs {
|
||||
void *hooks;
|
||||
|
||||
void (*reserved0)(void);
|
||||
int (*tcl_MacOSXOpenVersionedBundleResources) (Tcl_Interp *interp, const char *bundleName, const char *bundleVersion, int hasResourceFile, size_t maxPathLen, char *libraryPath); /* 1 */
|
||||
int (*tcl_MacOSXOpenVersionedBundleResources) (Tcl_Interp *interp, const char *bundleName, const char *bundleVersion, int hasResourceFile, Tcl_Size maxPathLen, char *libraryPath); /* 1 */
|
||||
void (*tcl_MacOSXNotifierAddRunLoopMode) (const void *runLoopMode); /* 2 */
|
||||
void (*tcl_WinConvertError) (unsigned errCode); /* 3 */
|
||||
} TclPlatStubs;
|
||||
|
||||
+127
-64
@@ -62,6 +62,9 @@ Tcl_ErrnoId(void)
|
||||
#if defined(EALREADY) && (!defined(EBUSY) || (EALREADY != EBUSY))
|
||||
case EALREADY: return "EALREADY";
|
||||
#endif
|
||||
#ifdef EBADCAT
|
||||
case EBADCAT: return "EBADCAT";
|
||||
#endif
|
||||
#ifdef EBADE
|
||||
case EBADE: return "EBADE";
|
||||
#endif
|
||||
@@ -74,9 +77,6 @@ Tcl_ErrnoId(void)
|
||||
#ifdef EBADMSG
|
||||
case EBADMSG: return "EBADMSG";
|
||||
#endif
|
||||
#ifdef ECANCELED
|
||||
case ECANCELED: return "ECANCELED";
|
||||
#endif
|
||||
#ifdef EBADR
|
||||
case EBADR: return "EBADR";
|
||||
#endif
|
||||
@@ -95,6 +95,12 @@ Tcl_ErrnoId(void)
|
||||
#ifdef EBUSY
|
||||
case EBUSY: return "EBUSY";
|
||||
#endif
|
||||
#ifdef ECANCELED
|
||||
case ECANCELED: return "ECANCELED";
|
||||
#endif
|
||||
#ifdef ECASECLASH
|
||||
case ECASECLASH: return "ECASECLASH";
|
||||
#endif
|
||||
#ifdef ECHILD
|
||||
case ECHILD: return "ECHILD";
|
||||
#endif
|
||||
@@ -140,12 +146,18 @@ Tcl_ErrnoId(void)
|
||||
#ifdef EEXIST
|
||||
case EEXIST: return "EEXIST";
|
||||
#endif
|
||||
#ifdef EFAIL
|
||||
case EFAIL: return "EFAIL";
|
||||
#endif
|
||||
#ifdef EFAULT
|
||||
case EFAULT: return "EFAULT";
|
||||
#endif
|
||||
#ifdef EFBIG
|
||||
case EFBIG: return "EFBIG";
|
||||
#endif
|
||||
#ifdef EFTYPE
|
||||
case EFTYPE: return "EFTYPE";
|
||||
#endif
|
||||
#ifdef EHOSTDOWN
|
||||
case EHOSTDOWN: return "EHOSTDOWN";
|
||||
#endif
|
||||
@@ -161,6 +173,9 @@ Tcl_ErrnoId(void)
|
||||
#ifdef EILSEQ
|
||||
case EILSEQ: return "EILSEQ";
|
||||
#endif
|
||||
#ifdef EINPROG
|
||||
case EINPROG: return "EINPROG";
|
||||
#endif
|
||||
#ifdef EINPROGRESS
|
||||
case EINPROGRESS: return "EINPROGRESS";
|
||||
#endif
|
||||
@@ -179,12 +194,9 @@ Tcl_ErrnoId(void)
|
||||
#ifdef EISDIR
|
||||
case EISDIR: return "EISDIR";
|
||||
#endif
|
||||
#ifdef EISNAME
|
||||
#ifdef EISNAM
|
||||
case EISNAM: return "EISNAM";
|
||||
#endif
|
||||
#ifdef ELBIN
|
||||
case ELBIN: return "ELBIN";
|
||||
#endif
|
||||
#ifdef EL2HLT
|
||||
case EL2HLT: return "EL2HLT";
|
||||
#endif
|
||||
@@ -197,6 +209,9 @@ Tcl_ErrnoId(void)
|
||||
#ifdef EL3RST
|
||||
case EL3RST: return "EL3RST";
|
||||
#endif
|
||||
#ifdef ELBIN
|
||||
case ELBIN: return "ELBIN";
|
||||
#endif
|
||||
#ifdef ELIBACC
|
||||
case ELIBACC: return "ELIBACC";
|
||||
#endif
|
||||
@@ -218,6 +233,9 @@ Tcl_ErrnoId(void)
|
||||
#if defined(ELOOP) && (!defined(ENOENT) || (ELOOP != ENOENT))
|
||||
case ELOOP: return "ELOOP";
|
||||
#endif
|
||||
#ifdef EMEDIUMTYPE
|
||||
case EMEDIUMTYPE: return "EMEDIUMTYPE";
|
||||
#endif
|
||||
#ifdef EMFILE
|
||||
case EMFILE: return "EMFILE";
|
||||
#endif
|
||||
@@ -236,9 +254,6 @@ Tcl_ErrnoId(void)
|
||||
#ifdef ENAVAIL
|
||||
case ENAVAIL: return "ENAVAIL";
|
||||
#endif
|
||||
#ifdef ENET
|
||||
case ENET: return "ENET";
|
||||
#endif
|
||||
#ifdef ENETDOWN
|
||||
case ENETDOWN: return "ENETDOWN";
|
||||
#endif
|
||||
@@ -251,6 +266,9 @@ Tcl_ErrnoId(void)
|
||||
#ifdef ENFILE
|
||||
case ENFILE: return "ENFILE";
|
||||
#endif
|
||||
#ifdef ENMFILE
|
||||
case ENMFILE: return "ENMFILE";
|
||||
#endif
|
||||
#ifdef ENOANO
|
||||
case ENOANO: return "ENOANO";
|
||||
#endif
|
||||
@@ -281,6 +299,9 @@ Tcl_ErrnoId(void)
|
||||
#ifdef ENOMEM
|
||||
case ENOMEM: return "ENOMEM";
|
||||
#endif
|
||||
#ifdef ENOMEDIUM
|
||||
case ENOMEDIUM: return "ENOMEDIUM";
|
||||
#endif
|
||||
#ifdef ENOMSG
|
||||
case ENOMSG: return "ENOMSG";
|
||||
#endif
|
||||
@@ -293,6 +314,9 @@ Tcl_ErrnoId(void)
|
||||
#ifdef ENOPROTOOPT
|
||||
case ENOPROTOOPT: return "ENOPROTOOPT";
|
||||
#endif
|
||||
#ifdef ENOSHARE
|
||||
case ENOSHARE: return "ENOSHARE";
|
||||
#endif
|
||||
#ifdef ENOSPC
|
||||
case ENOSPC: return "ENOSPC";
|
||||
#endif
|
||||
@@ -338,6 +362,9 @@ Tcl_ErrnoId(void)
|
||||
#ifdef ENOTUNIQ
|
||||
case ENOTUNIQ: return "ENOTUNIQ";
|
||||
#endif
|
||||
#ifdef ENWAIT
|
||||
case ENWAIT: return "ENWAIT";
|
||||
#endif
|
||||
#ifdef ENXIO
|
||||
case ENXIO: return "ENXIO";
|
||||
#endif
|
||||
@@ -404,6 +431,9 @@ Tcl_ErrnoId(void)
|
||||
#ifdef EREMOTERELEASE
|
||||
case EREMOTERELEASE: return "EREMOTERELEASE";
|
||||
#endif
|
||||
#ifdef ERESTART
|
||||
case ERESTART: return "ERESTART";
|
||||
#endif
|
||||
#ifdef EROFS
|
||||
case EROFS: return "EROFS";
|
||||
#endif
|
||||
@@ -519,34 +549,34 @@ Tcl_ErrnoMsg(
|
||||
case EAGAIN: return "resource temporarily unavailable";
|
||||
#endif
|
||||
#ifdef EALIGN
|
||||
case EALIGN: return "EALIGN";
|
||||
case EALIGN: return "alignment error";
|
||||
#endif
|
||||
#if defined(EALREADY) && (!defined(EBUSY) || (EALREADY != EBUSY))
|
||||
case EALREADY: return "operation already in progress";
|
||||
#endif
|
||||
#ifdef EBADCAT
|
||||
case EBADCAT: return "bad message catalogue format";
|
||||
#endif
|
||||
#ifdef EBADE
|
||||
case EBADE: return "bad exchange descriptor";
|
||||
case EBADE: return "invalid exchange";
|
||||
#endif
|
||||
#ifdef EBADF
|
||||
case EBADF: return "bad file number";
|
||||
case EBADF: return "bad file descriptor";
|
||||
#endif
|
||||
#ifdef EBADFD
|
||||
case EBADFD: return "file descriptor in bad state";
|
||||
#endif
|
||||
#ifdef EBADMSG
|
||||
case EBADMSG: return "not a data message";
|
||||
#endif
|
||||
#ifdef ECANCELED
|
||||
case ECANCELED: return "operation canceled";
|
||||
case EBADMSG: return "bad message";
|
||||
#endif
|
||||
#ifdef EBADR
|
||||
case EBADR: return "bad request descriptor";
|
||||
case EBADR: return "invalid request descriptor";
|
||||
#endif
|
||||
#ifdef EBADRPC
|
||||
case EBADRPC: return "RPC structure is bad";
|
||||
#endif
|
||||
#ifdef EBADRQC
|
||||
case EBADRQC: return "bad request code";
|
||||
case EBADRQC: return "invalid request code";
|
||||
#endif
|
||||
#ifdef EBADSLT
|
||||
case EBADSLT: return "invalid slot";
|
||||
@@ -555,10 +585,16 @@ Tcl_ErrnoMsg(
|
||||
case EBFONT: return "bad font file format";
|
||||
#endif
|
||||
#ifdef EBUSY
|
||||
case EBUSY: return "file busy";
|
||||
case EBUSY: return "device or resource busy";
|
||||
#endif
|
||||
#ifdef ECANCELED
|
||||
case ECANCELED: return "operation canceled";
|
||||
#endif
|
||||
#ifdef ECASECLASH
|
||||
case ECASECLASH: return "filename exists with different case";
|
||||
#endif
|
||||
#ifdef ECHILD
|
||||
case ECHILD: return "no children";
|
||||
case ECHILD: return "no child processes";
|
||||
#endif
|
||||
#ifdef ECHRNG
|
||||
case ECHRNG: return "channel number out of range";
|
||||
@@ -588,7 +624,7 @@ Tcl_ErrnoMsg(
|
||||
case EDIRTY: return "mounting a dirty fs w/o force";
|
||||
#endif
|
||||
#ifdef EDOM
|
||||
case EDOM: return "math argument out of range";
|
||||
case EDOM: return "numerical argument out of domain";
|
||||
#endif
|
||||
#ifdef EDOTDOT
|
||||
case EDOTDOT: return "cross mount point";
|
||||
@@ -600,19 +636,25 @@ Tcl_ErrnoMsg(
|
||||
case EDUPPKG: return "duplicate package name";
|
||||
#endif
|
||||
#ifdef EEXIST
|
||||
case EEXIST: return "file already exists";
|
||||
case EEXIST: return "file exists";
|
||||
#endif
|
||||
#ifdef EFAIL
|
||||
case EFAIL: return "cannot start operation";
|
||||
#endif
|
||||
#ifdef EFAULT
|
||||
case EFAULT: return "bad address in system call argument";
|
||||
case EFAULT: return "bad address";
|
||||
#endif
|
||||
#ifdef EFBIG
|
||||
case EFBIG: return "file too large";
|
||||
#endif
|
||||
#ifdef EFTYPE
|
||||
case EFTYPE: return "inappropriate file type or format";
|
||||
#endif
|
||||
#ifdef EHOSTDOWN
|
||||
case EHOSTDOWN: return "host is down";
|
||||
#endif
|
||||
#ifdef EHOSTUNREACH
|
||||
case EHOSTUNREACH: return "host is unreachable";
|
||||
case EHOSTUNREACH: return "no route to host";
|
||||
#endif
|
||||
#if defined(EIDRM) && (!defined(EINPROGRESS) || (EIDRM != EINPROGRESS))
|
||||
case EIDRM: return "identifier removed";
|
||||
@@ -621,7 +663,10 @@ Tcl_ErrnoMsg(
|
||||
case EINIT: return "initialization error";
|
||||
#endif
|
||||
#ifdef EILSEQ
|
||||
case EILSEQ: return "illegal byte sequence";
|
||||
case EILSEQ: return "invalid or incomplete multibyte or wide character";
|
||||
#endif
|
||||
#ifdef EINPROG
|
||||
case EINPROG: return "asynchronous operation in progress";
|
||||
#endif
|
||||
#ifdef EINPROGRESS
|
||||
case EINPROGRESS: return "operation now in progress";
|
||||
@@ -633,19 +678,16 @@ Tcl_ErrnoMsg(
|
||||
case EINVAL: return "invalid argument";
|
||||
#endif
|
||||
#ifdef EIO
|
||||
case EIO: return "I/O error";
|
||||
case EIO: return "input/output error";
|
||||
#endif
|
||||
#ifdef EISCONN
|
||||
case EISCONN: return "socket is already connected";
|
||||
case EISCONN: return "transport endpoint is already connected";
|
||||
#endif
|
||||
#ifdef EISDIR
|
||||
case EISDIR: return "illegal operation on a directory";
|
||||
case EISDIR: return "is a directory";
|
||||
#endif
|
||||
#ifdef EISNAME
|
||||
case EISNAM: return "is a name file";
|
||||
#endif
|
||||
#ifdef ELBIN
|
||||
case ELBIN: return "ELBIN";
|
||||
#ifdef EISNAM
|
||||
case EISNAM: return "is a named type file";
|
||||
#endif
|
||||
#ifdef EL2HLT
|
||||
case EL2HLT: return "level 2 halted";
|
||||
@@ -659,8 +701,11 @@ Tcl_ErrnoMsg(
|
||||
#ifdef EL3RST
|
||||
case EL3RST: return "level 3 reset";
|
||||
#endif
|
||||
#ifdef ELBIN
|
||||
case ELBIN: return "inode is remote";
|
||||
#endif
|
||||
#ifdef ELIBACC
|
||||
case ELIBACC: return "cannot access a needed shared library";
|
||||
case ELIBACC: return "can not access a needed shared library";
|
||||
#endif
|
||||
#ifdef ELIBBAD
|
||||
case ELIBBAD: return "accessing a corrupted shared library";
|
||||
@@ -670,7 +715,7 @@ Tcl_ErrnoMsg(
|
||||
#endif
|
||||
#if defined(ELIBMAX) && (!defined(ECANCELED) || (ELIBMAX != ECANCELED))
|
||||
case ELIBMAX: return
|
||||
"attempting to link in more shared libraries than system limit";
|
||||
"attempting to link in too many shared libraries";
|
||||
#endif
|
||||
#ifdef ELIBSCN
|
||||
case ELIBSCN: return ".lib section in a.out corrupted";
|
||||
@@ -681,6 +726,9 @@ Tcl_ErrnoMsg(
|
||||
#if defined(ELOOP) && (!defined(ENOENT) || (ELOOP != ENOENT))
|
||||
case ELOOP: return "too many levels of symbolic links";
|
||||
#endif
|
||||
#ifdef EMEDIUMTYPE
|
||||
case EMEDIUMTYPE: return "wrong medium type";
|
||||
#endif
|
||||
#ifdef EMFILE
|
||||
case EMFILE: return "too many open files";
|
||||
#endif
|
||||
@@ -699,9 +747,6 @@ Tcl_ErrnoMsg(
|
||||
#ifdef ENAVAIL
|
||||
case ENAVAIL: return "not available";
|
||||
#endif
|
||||
#ifdef ENET
|
||||
case ENET: return "ENET";
|
||||
#endif
|
||||
#ifdef ENETDOWN
|
||||
case ENETDOWN: return "network is down";
|
||||
#endif
|
||||
@@ -712,10 +757,13 @@ Tcl_ErrnoMsg(
|
||||
case ENETUNREACH: return "network is unreachable";
|
||||
#endif
|
||||
#ifdef ENFILE
|
||||
case ENFILE: return "file table overflow";
|
||||
case ENFILE: return "too many open files in system";
|
||||
#endif
|
||||
#ifdef ENMFILE
|
||||
case ENMFILE: return "no more files";
|
||||
#endif
|
||||
#ifdef ENOANO
|
||||
case ENOANO: return "anode table overflow";
|
||||
case ENOANO: return "no anode";
|
||||
#endif
|
||||
#if defined(ENOBUFS) && (!defined(ENOSR) || (ENOBUFS != ENOSR))
|
||||
case ENOBUFS: return "no buffer space available";
|
||||
@@ -742,7 +790,10 @@ Tcl_ErrnoMsg(
|
||||
case ENOLINK: return "link has been severed";
|
||||
#endif
|
||||
#ifdef ENOMEM
|
||||
case ENOMEM: return "not enough memory";
|
||||
case ENOMEM: return "cannot allocate memory";
|
||||
#endif
|
||||
#ifdef ENOMEDIUM
|
||||
case ENOMEDIUM: return "no medium found";
|
||||
#endif
|
||||
#ifdef ENOMSG
|
||||
case ENOMSG: return "no message of desired type";
|
||||
@@ -754,16 +805,19 @@ Tcl_ErrnoMsg(
|
||||
case ENOPKG: return "package not installed";
|
||||
#endif
|
||||
#ifdef ENOPROTOOPT
|
||||
case ENOPROTOOPT: return "bad protocol option";
|
||||
case ENOPROTOOPT: return "protocol not available";
|
||||
#endif
|
||||
#ifdef ENOSHARE
|
||||
case ENOSHARE: return "no such host or network path";
|
||||
#endif
|
||||
#ifdef ENOSPC
|
||||
case ENOSPC: return "no space left on device";
|
||||
#endif
|
||||
#if defined(ENOSR) && (!defined(ENAMETOOLONG) || (ENAMETOOLONG != ENOSR))
|
||||
case ENOSR: return "out of stream resources";
|
||||
case ENOSR: return "out of streams resources";
|
||||
#endif
|
||||
#if defined(ENOSTR) && (!defined(ENOTTY) || (ENOTTY != ENOSTR))
|
||||
case ENOSTR: return "not a stream device";
|
||||
case ENOSTR: return "device not a stream";
|
||||
#endif
|
||||
#ifdef ENOSYM
|
||||
case ENOSYM: return "unresolved symbol name";
|
||||
@@ -775,10 +829,7 @@ Tcl_ErrnoMsg(
|
||||
case ENOTBLK: return "block device required";
|
||||
#endif
|
||||
#ifdef ENOTCONN
|
||||
case ENOTCONN: return "socket is not connected";
|
||||
#endif
|
||||
#ifdef ENOTRECOVERABLE
|
||||
case ENOTRECOVERABLE: return "state not recoverable";
|
||||
case ENOTCONN: return "transport endpoint is not connected";
|
||||
#endif
|
||||
#ifdef ENOTDIR
|
||||
case ENOTDIR: return "not a directory";
|
||||
@@ -789,6 +840,9 @@ Tcl_ErrnoMsg(
|
||||
#ifdef ENOTNAM
|
||||
case ENOTNAM: return "not a name file";
|
||||
#endif
|
||||
#ifdef ENOTRECOVERABLE
|
||||
case ENOTRECOVERABLE: return "state not recoverable";
|
||||
#endif
|
||||
#ifdef ENOTSOCK
|
||||
case ENOTSOCK: return "socket operation on non-socket";
|
||||
#endif
|
||||
@@ -796,11 +850,14 @@ Tcl_ErrnoMsg(
|
||||
case ENOTSUP: return "operation not supported";
|
||||
#endif
|
||||
#ifdef ENOTTY
|
||||
case ENOTTY: return "inappropriate device for ioctl";
|
||||
case ENOTTY: return "inappropriate ioctl for device";
|
||||
#endif
|
||||
#ifdef ENOTUNIQ
|
||||
case ENOTUNIQ: return "name not unique on network";
|
||||
#endif
|
||||
#ifdef ENWAIT
|
||||
case ENWAIT: return "No waiting processes";
|
||||
#endif
|
||||
#ifdef ENXIO
|
||||
case ENXIO: return "no such device or address";
|
||||
#endif
|
||||
@@ -811,13 +868,13 @@ Tcl_ErrnoMsg(
|
||||
case EOTHER: return "other error";
|
||||
#endif
|
||||
#if defined(EOVERFLOW) && (!defined(EFBIG) || (EOVERFLOW != EFBIG)) && (!defined(EINVAL) || (EOVERFLOW != EINVAL))
|
||||
case EOVERFLOW: return "file too big";
|
||||
case EOVERFLOW: return "value too large for defined data type";
|
||||
#endif
|
||||
#ifdef EOWNERDEAD
|
||||
case EOWNERDEAD: return "owner died";
|
||||
#endif
|
||||
#ifdef EPERM
|
||||
case EPERM: return "not owner";
|
||||
case EPERM: return "operation not permitted";
|
||||
#endif
|
||||
#if defined(EPFNOSUPPORT) && (!defined(ENOLCK) || (ENOLCK != EPFNOSUPPORT))
|
||||
case EPFNOSUPPORT: return "protocol family not supported";
|
||||
@@ -847,10 +904,10 @@ Tcl_ErrnoMsg(
|
||||
case EPROTOTYPE: return "protocol wrong type for socket";
|
||||
#endif
|
||||
#ifdef ERANGE
|
||||
case ERANGE: return "math result unrepresentable";
|
||||
case ERANGE: return "numerical result out of range";
|
||||
#endif
|
||||
#if defined(EREFUSED) && (!defined(ECONNREFUSED) || (EREFUSED != ECONNREFUSED))
|
||||
case EREFUSED: return "EREFUSED";
|
||||
case EREFUSED: return "connection refused";
|
||||
#endif
|
||||
#ifdef EREMCHG
|
||||
case EREMCHG: return "remote address changed";
|
||||
@@ -859,13 +916,16 @@ Tcl_ErrnoMsg(
|
||||
case EREMDEV: return "remote device";
|
||||
#endif
|
||||
#ifdef EREMOTE
|
||||
case EREMOTE: return "pathname hit remote file system";
|
||||
case EREMOTE: return "object is remote";
|
||||
#endif
|
||||
#ifdef EREMOTEIO
|
||||
case EREMOTEIO: return "remote i/o error";
|
||||
case EREMOTEIO: return "remote I/O error";
|
||||
#endif
|
||||
#ifdef EREMOTERELEASE
|
||||
case EREMOTERELEASE: return "EREMOTERELEASE";
|
||||
case EREMOTERELEASE: return "remote peer released connection";
|
||||
#endif
|
||||
#ifdef ERESTART
|
||||
case ERESTART: return "interrupted system call should be restarted";
|
||||
#endif
|
||||
#ifdef EROFS
|
||||
case EROFS: return "read-only file system";
|
||||
@@ -877,13 +937,13 @@ Tcl_ErrnoMsg(
|
||||
case ERREMOTE: return "object is remote";
|
||||
#endif
|
||||
#ifdef ESHUTDOWN
|
||||
case ESHUTDOWN: return "cannot send after socket shutdown";
|
||||
case ESHUTDOWN: return "cannot send after transport endpoint shutdown";
|
||||
#endif
|
||||
#ifdef ESOCKTNOSUPPORT
|
||||
case ESOCKTNOSUPPORT: return "socket type not supported";
|
||||
#endif
|
||||
#ifdef ESPIPE
|
||||
case ESPIPE: return "invalid seek";
|
||||
case ESPIPE: return "illegal seek";
|
||||
#endif
|
||||
#ifdef ESRCH
|
||||
case ESRCH: return "no such process";
|
||||
@@ -892,10 +952,13 @@ Tcl_ErrnoMsg(
|
||||
case ESRMNT: return "srmount error";
|
||||
#endif
|
||||
#ifdef ESTALE
|
||||
case ESTALE: return "stale remote file handle";
|
||||
case ESTALE: return "stale file handle";
|
||||
#endif
|
||||
#ifdef ESTRPIPE
|
||||
case ESTRPIPE: return "streams pipe error";
|
||||
#endif
|
||||
#ifdef ESUCCESS
|
||||
case ESUCCESS: return "Error 0";
|
||||
case ESUCCESS: return "success";
|
||||
#endif
|
||||
#if defined(ETIME) && (!defined(ELOOP) || (ETIME != ELOOP))
|
||||
case ETIME: return "timer expired";
|
||||
@@ -907,7 +970,7 @@ Tcl_ErrnoMsg(
|
||||
case ETOOMANYREFS: return "too many references: cannot splice";
|
||||
#endif
|
||||
#ifdef ETXTBSY
|
||||
case ETXTBSY: return "text file or pseudo-device busy";
|
||||
case ETXTBSY: return "text file busy";
|
||||
#endif
|
||||
#ifdef EUCLEAN
|
||||
case EUCLEAN: return "structure needs cleaning";
|
||||
@@ -925,10 +988,10 @@ Tcl_ErrnoMsg(
|
||||
case EWOULDBLOCK: return "operation would block";
|
||||
#endif
|
||||
#ifdef EXDEV
|
||||
case EXDEV: return "cross-domain link";
|
||||
case EXDEV: return "invalid cross-device link";
|
||||
#endif
|
||||
#ifdef EXFULL
|
||||
case EXFULL: return "message tables full";
|
||||
case EXFULL: return "exchange full";
|
||||
#endif
|
||||
default:
|
||||
#ifdef NO_STRERROR
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
ClientData clientData; /* Address of preserved block. */
|
||||
void *clientData; /* Address of preserved block. */
|
||||
size_t refCount; /* Number of Tcl_Preserve calls in effect for
|
||||
* block. */
|
||||
int mustFree; /* Non-zero means Tcl_EventuallyFree was
|
||||
@@ -117,7 +117,7 @@ TclFinalizePreserve(void)
|
||||
|
||||
void
|
||||
Tcl_Preserve(
|
||||
ClientData clientData) /* Pointer to malloc'ed block of memory. */
|
||||
void *clientData) /* Pointer to malloc'ed block of memory. */
|
||||
{
|
||||
Reference *refPtr;
|
||||
size_t i;
|
||||
@@ -180,7 +180,7 @@ Tcl_Preserve(
|
||||
|
||||
void
|
||||
Tcl_Release(
|
||||
ClientData clientData) /* Pointer to malloc'ed block of memory. */
|
||||
void *clientData) /* Pointer to malloc'ed block of memory. */
|
||||
{
|
||||
Reference *refPtr;
|
||||
size_t i;
|
||||
@@ -259,7 +259,7 @@ Tcl_Release(
|
||||
|
||||
void
|
||||
Tcl_EventuallyFree(
|
||||
ClientData clientData, /* Pointer to malloc'ed block of memory. */
|
||||
void *clientData, /* Pointer to malloc'ed block of memory. */
|
||||
Tcl_FreeProc *freeProc) /* Function to actually do free. */
|
||||
{
|
||||
Reference *refPtr;
|
||||
|
||||
+18
-10
@@ -524,9 +524,9 @@ TclCreateProc(
|
||||
}
|
||||
if (fieldCount > 2) {
|
||||
Tcl_Obj *errorObj = Tcl_NewStringObj(
|
||||
"too many fields in argument specifier \"", -1);
|
||||
"too many fields in argument specifier \"", TCL_INDEX_NONE);
|
||||
Tcl_AppendObjToObj(errorObj, argArray[i]);
|
||||
Tcl_AppendToObj(errorObj, "\"", -1);
|
||||
Tcl_AppendToObj(errorObj, "\"", TCL_INDEX_NONE);
|
||||
Tcl_SetObjResult(interp, errorObj);
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC",
|
||||
"FORMALARGUMENTFORMAT", NULL);
|
||||
@@ -534,7 +534,7 @@ TclCreateProc(
|
||||
}
|
||||
if ((fieldCount == 0) || (Tcl_GetCharLength(fieldValues[0]) == 0)) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"argument with no name", -1));
|
||||
"argument with no name", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC",
|
||||
"FORMALARGUMENTFORMAT", NULL);
|
||||
goto procError;
|
||||
@@ -560,9 +560,9 @@ TclCreateProc(
|
||||
}
|
||||
} else if (*argnamei == ':' && *(argnamei+1) == ':') {
|
||||
Tcl_Obj *errorObj = Tcl_NewStringObj(
|
||||
"formal parameter \"", -1);
|
||||
"formal parameter \"", TCL_INDEX_NONE);
|
||||
Tcl_AppendObjToObj(errorObj, fieldValues[0]);
|
||||
Tcl_AppendToObj(errorObj, "\" is not a simple name", -1);
|
||||
Tcl_AppendToObj(errorObj, "\" is not a simple name", TCL_INDEX_NONE);
|
||||
Tcl_SetObjResult(interp, errorObj);
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC",
|
||||
"FORMALARGUMENTFORMAT", NULL);
|
||||
@@ -613,7 +613,7 @@ TclCreateProc(
|
||||
"procedure \"%s\": formal parameter \"", procName);
|
||||
Tcl_AppendObjToObj(errorObj, fieldValues[0]);
|
||||
Tcl_AppendToObj(errorObj, "\" has "
|
||||
"default value inconsistent with precompiled body", -1);
|
||||
"default value inconsistent with precompiled body", TCL_INDEX_NONE);
|
||||
Tcl_SetObjResult(interp, errorObj);
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC",
|
||||
"BYTECODELIES", NULL);
|
||||
@@ -1080,7 +1080,7 @@ ProcWrongNumArgs(
|
||||
sizeof(Tcl_Obj *) * (numArgs+1));
|
||||
|
||||
if (framePtr->isProcCallFrame & FRAME_IS_LAMBDA) {
|
||||
desiredObjs[0] = Tcl_NewStringObj("lambdaExpr", -1);
|
||||
desiredObjs[0] = Tcl_NewStringObj("lambdaExpr", TCL_INDEX_NONE);
|
||||
} else {
|
||||
desiredObjs[0] = framePtr->objv[skip-1];
|
||||
}
|
||||
@@ -1298,7 +1298,7 @@ InitLocalCache(
|
||||
*namePtr = NULL;
|
||||
} else {
|
||||
*namePtr = TclCreateLiteral(iPtr, localPtr->name,
|
||||
localPtr->nameLength, /* hash */ (size_t) -1,
|
||||
localPtr->nameLength, /* hash */ TCL_INDEX_NONE,
|
||||
&isNew, /* nsPtr */ NULL, 0, NULL);
|
||||
Tcl_IncrRefCount(*namePtr);
|
||||
}
|
||||
@@ -1941,7 +1941,7 @@ TclProcCompileProc(
|
||||
if (codePtr->flags & TCL_BYTECODE_PRECOMPILED) {
|
||||
if ((Interp *) *codePtr->interpHandle != iPtr) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"a precompiled script jumped interps", -1));
|
||||
"a precompiled script jumped interps", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC",
|
||||
"CROSSINTERPBYTECODE", NULL);
|
||||
return TCL_ERROR;
|
||||
@@ -1969,7 +1969,7 @@ TclProcCompileProc(
|
||||
TclNewLiteralStringObj(message, "Compiling ");
|
||||
Tcl_IncrRefCount(message);
|
||||
Tcl_AppendStringsToObj(message, description, " \"", NULL);
|
||||
Tcl_AppendLimitedToObj(message, procName, -1, 50, NULL);
|
||||
Tcl_AppendLimitedToObj(message, procName, TCL_INDEX_NONE, 50, NULL);
|
||||
fprintf(stdout, "%s\"\n", TclGetString(message));
|
||||
Tcl_DecrRefCount(message);
|
||||
}
|
||||
@@ -2456,6 +2456,14 @@ SetLambdaFromAny(
|
||||
* length is not 2, then it cannot be converted to lambdaType.
|
||||
*/
|
||||
|
||||
result = TclListObjLengthM(NULL, objPtr, &objc);
|
||||
if ((result != TCL_OK) || ((objc != 2) && (objc != 3))) {
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"can't interpret \"%s\" as a lambda expression",
|
||||
Tcl_GetString(objPtr)));
|
||||
Tcl_SetErrorCode(interp, "TCL", "VALUE", "LAMBDA", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
result = TclListObjGetElementsM(NULL, objPtr, &objc, &objv);
|
||||
if ((result != TCL_OK) || ((objc != 2) && (objc != 3))) {
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
|
||||
+16
-16
@@ -233,9 +233,9 @@ WaitProcessStatus(
|
||||
if (msgObjPtr) *msgObjPtr = Tcl_ObjPrintf(
|
||||
"error waiting for process to exit: %s", msg);
|
||||
if (errorObjPtr) {
|
||||
errorStrings[0] = Tcl_NewStringObj("POSIX", -1);
|
||||
errorStrings[1] = Tcl_NewStringObj(Tcl_ErrnoId(), -1);
|
||||
errorStrings[2] = Tcl_NewStringObj(msg, -1);
|
||||
errorStrings[0] = Tcl_NewStringObj("POSIX", TCL_INDEX_NONE);
|
||||
errorStrings[1] = Tcl_NewStringObj(Tcl_ErrnoId(), TCL_INDEX_NONE);
|
||||
errorStrings[2] = Tcl_NewStringObj(msg, TCL_INDEX_NONE);
|
||||
*errorObjPtr = Tcl_NewListObj(3, errorStrings);
|
||||
}
|
||||
return TCL_PROCESS_ERROR;
|
||||
@@ -256,9 +256,9 @@ WaitProcessStatus(
|
||||
*/
|
||||
|
||||
if (msgObjPtr) *msgObjPtr = Tcl_NewStringObj(
|
||||
"child process exited abnormally", -1);
|
||||
"child process exited abnormally", TCL_INDEX_NONE);
|
||||
if (errorObjPtr) {
|
||||
errorStrings[0] = Tcl_NewStringObj("CHILDSTATUS", -1);
|
||||
errorStrings[0] = Tcl_NewStringObj("CHILDSTATUS", TCL_INDEX_NONE);
|
||||
TclNewIntObj(errorStrings[1], resolvedPid);
|
||||
TclNewIntObj(errorStrings[2], WEXITSTATUS(waitStatus));
|
||||
*errorObjPtr = Tcl_NewListObj(3, errorStrings);
|
||||
@@ -277,10 +277,10 @@ WaitProcessStatus(
|
||||
if (msgObjPtr) *msgObjPtr = Tcl_ObjPrintf(
|
||||
"child killed: %s", msg);
|
||||
if (errorObjPtr) {
|
||||
errorStrings[0] = Tcl_NewStringObj("CHILDKILLED", -1);
|
||||
errorStrings[0] = Tcl_NewStringObj("CHILDKILLED", TCL_INDEX_NONE);
|
||||
TclNewIntObj(errorStrings[1], resolvedPid);
|
||||
errorStrings[2] = Tcl_NewStringObj(Tcl_SignalId(WTERMSIG(waitStatus)), -1);
|
||||
errorStrings[3] = Tcl_NewStringObj(msg, -1);
|
||||
errorStrings[2] = Tcl_NewStringObj(Tcl_SignalId(WTERMSIG(waitStatus)), TCL_INDEX_NONE);
|
||||
errorStrings[3] = Tcl_NewStringObj(msg, TCL_INDEX_NONE);
|
||||
*errorObjPtr = Tcl_NewListObj(4, errorStrings);
|
||||
}
|
||||
return TCL_PROCESS_SIGNALED;
|
||||
@@ -296,10 +296,10 @@ WaitProcessStatus(
|
||||
if (msgObjPtr) *msgObjPtr = Tcl_ObjPrintf(
|
||||
"child suspended: %s", msg);
|
||||
if (errorObjPtr) {
|
||||
errorStrings[0] = Tcl_NewStringObj("CHILDSUSP", -1);
|
||||
errorStrings[0] = Tcl_NewStringObj("CHILDSUSP", TCL_INDEX_NONE);
|
||||
TclNewIntObj(errorStrings[1], resolvedPid);
|
||||
errorStrings[2] = Tcl_NewStringObj(Tcl_SignalId(WSTOPSIG(waitStatus)), -1);
|
||||
errorStrings[3] = Tcl_NewStringObj(msg, -1);
|
||||
errorStrings[2] = Tcl_NewStringObj(Tcl_SignalId(WSTOPSIG(waitStatus)), TCL_INDEX_NONE);
|
||||
errorStrings[3] = Tcl_NewStringObj(msg, TCL_INDEX_NONE);
|
||||
*errorObjPtr = Tcl_NewListObj(4, errorStrings);
|
||||
}
|
||||
return TCL_PROCESS_STOPPED;
|
||||
@@ -312,12 +312,12 @@ WaitProcessStatus(
|
||||
|
||||
if (codePtr) *codePtr = waitStatus;
|
||||
if (msgObjPtr) *msgObjPtr = Tcl_NewStringObj(
|
||||
"child wait status didn't make sense\n", -1);
|
||||
"child wait status didn't make sense\n", TCL_INDEX_NONE);
|
||||
if (errorObjPtr) {
|
||||
errorStrings[0] = Tcl_NewStringObj("TCL", -1);
|
||||
errorStrings[1] = Tcl_NewStringObj("OPERATION", -1);
|
||||
errorStrings[2] = Tcl_NewStringObj("EXEC", -1);
|
||||
errorStrings[3] = Tcl_NewStringObj("ODDWAITRESULT", -1);
|
||||
errorStrings[0] = Tcl_NewStringObj("TCL", TCL_INDEX_NONE);
|
||||
errorStrings[1] = Tcl_NewStringObj("OPERATION", TCL_INDEX_NONE);
|
||||
errorStrings[2] = Tcl_NewStringObj("EXEC", TCL_INDEX_NONE);
|
||||
errorStrings[3] = Tcl_NewStringObj("ODDWAITRESULT", TCL_INDEX_NONE);
|
||||
TclNewIntObj(errorStrings[4], resolvedPid);
|
||||
*errorObjPtr = Tcl_NewListObj(5, errorStrings);
|
||||
}
|
||||
|
||||
+15
-15
@@ -221,9 +221,9 @@ Tcl_RegExpExec(
|
||||
*/
|
||||
|
||||
Tcl_DStringInit(&ds);
|
||||
ustr = Tcl_UtfToUniCharDString(text, -1, &ds);
|
||||
ustr = Tcl_UtfToUniCharDString(text, TCL_INDEX_NONE, &ds);
|
||||
numChars = Tcl_DStringLength(&ds) / sizeof(Tcl_UniChar);
|
||||
result = RegExpExecUniChar(interp, re, ustr, numChars, -1 /* nmatches */,
|
||||
result = RegExpExecUniChar(interp, re, ustr, numChars, TCL_INDEX_NONE /* nmatches */,
|
||||
flags);
|
||||
Tcl_DStringFree(&ds);
|
||||
|
||||
@@ -253,7 +253,7 @@ void
|
||||
Tcl_RegExpRange(
|
||||
Tcl_RegExp re, /* Compiled regular expression that has been
|
||||
* passed to Tcl_RegExpExec. */
|
||||
size_t index, /* 0 means give the range of the entire match,
|
||||
Tcl_Size index, /* 0 means give the range of the entire match,
|
||||
* > 0 means give the range of a matching
|
||||
* subrange. */
|
||||
const char **startPtr, /* Store address of first character in
|
||||
@@ -266,7 +266,7 @@ Tcl_RegExpRange(
|
||||
|
||||
if (index > regexpPtr->re.re_nsub) {
|
||||
*startPtr = *endPtr = NULL;
|
||||
} else if (regexpPtr->matches[index].rm_so == TCL_INDEX_NONE) {
|
||||
} else if (TCL_SIZE_ISNEG(regexpPtr->matches[index].rm_so)) {
|
||||
*startPtr = *endPtr = NULL;
|
||||
} else {
|
||||
if (regexpPtr->objPtr) {
|
||||
@@ -363,18 +363,18 @@ void
|
||||
TclRegExpRangeUniChar(
|
||||
Tcl_RegExp re, /* Compiled regular expression that has been
|
||||
* passed to Tcl_RegExpExec. */
|
||||
size_t index, /* 0 means give the range of the entire match,
|
||||
Tcl_Size index, /* 0 means give the range of the entire match,
|
||||
* > 0 means give the range of a matching
|
||||
* subrange, TCL_INDEX_NONE means the range of the
|
||||
* rm_extend field. */
|
||||
size_t *startPtr, /* Store address of first character in
|
||||
Tcl_Size *startPtr, /* Store address of first character in
|
||||
* (sub-)range here. */
|
||||
size_t *endPtr) /* Store address of character just after last
|
||||
Tcl_Size *endPtr) /* Store address of character just after last
|
||||
* in (sub-)range here. */
|
||||
{
|
||||
TclRegexp *regexpPtr = (TclRegexp *) re;
|
||||
|
||||
if ((regexpPtr->flags®_EXPECT) && (index == TCL_INDEX_NONE)) {
|
||||
if ((regexpPtr->flags®_EXPECT) && TCL_SIZE_ISNEG(index)) {
|
||||
*startPtr = regexpPtr->details.rm_extend.rm_so;
|
||||
*endPtr = regexpPtr->details.rm_extend.rm_eo;
|
||||
} else if (index + 1 > regexpPtr->re.re_nsub + 1) {
|
||||
@@ -443,16 +443,16 @@ Tcl_RegExpExecObj(
|
||||
* returned by previous call to
|
||||
* Tcl_GetRegExpFromObj. */
|
||||
Tcl_Obj *textObj, /* Text against which to match re. */
|
||||
size_t offset, /* Character index that marks where matching
|
||||
Tcl_Size offset, /* Character index that marks where matching
|
||||
* should begin. */
|
||||
size_t nmatches, /* How many subexpression matches (counting
|
||||
Tcl_Size nmatches, /* How many subexpression matches (counting
|
||||
* the whole match as subexpression 0) are of
|
||||
* interest. -1 means all of them. */
|
||||
* interest. TCL_INDEX_NONE means all of them. */
|
||||
int flags) /* Regular expression execution flags. */
|
||||
{
|
||||
TclRegexp *regexpPtr = (TclRegexp *) re;
|
||||
Tcl_UniChar *udata;
|
||||
size_t length;
|
||||
Tcl_Size length;
|
||||
int reflags = regexpPtr->flags;
|
||||
#define TCL_REG_GLOBOK_FLAGS \
|
||||
(TCL_REG_ADVANCED | TCL_REG_NOSUB | TCL_REG_NOCASE)
|
||||
@@ -689,7 +689,7 @@ TclRegAbout(
|
||||
for (inf=infonames ; inf->bit != 0 ; inf++) {
|
||||
if (regexpPtr->re.re_info & inf->bit) {
|
||||
Tcl_ListObjAppendElement(NULL, infoObj,
|
||||
Tcl_NewStringObj(inf->text, -1));
|
||||
Tcl_NewStringObj(inf->text, TCL_INDEX_NONE));
|
||||
}
|
||||
}
|
||||
Tcl_ListObjAppendElement(NULL, resultObj, infoObj);
|
||||
@@ -730,7 +730,7 @@ TclRegError(
|
||||
p = (n > sizeof(buf)) ? "..." : "";
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf("%s%s%s", msg, buf, p));
|
||||
|
||||
sprintf(cbuf, "%d", status);
|
||||
snprintf(cbuf, sizeof(cbuf), "%d", status);
|
||||
(void) TclReError(REG_ITOA, cbuf, sizeof(cbuf));
|
||||
Tcl_SetErrorCode(interp, "REGEXP", cbuf, buf, NULL);
|
||||
}
|
||||
@@ -960,7 +960,7 @@ CompileRegexp(
|
||||
|
||||
if (TclReToGlob(NULL, string, length, &stringBuf, &exact,
|
||||
NULL) == TCL_OK) {
|
||||
regexpPtr->globObjPtr = TclDStringToObj(&stringBuf);
|
||||
regexpPtr->globObjPtr = Tcl_DStringToObj(&stringBuf);
|
||||
Tcl_IncrRefCount(regexpPtr->globObjPtr);
|
||||
} else {
|
||||
regexpPtr->globObjPtr = NULL;
|
||||
|
||||
+7
-7
@@ -317,7 +317,7 @@ Tcl_AppendResult(
|
||||
if (bytes == NULL) {
|
||||
break;
|
||||
}
|
||||
Tcl_AppendToObj(objPtr, bytes, -1);
|
||||
Tcl_AppendToObj(objPtr, bytes, TCL_INDEX_NONE);
|
||||
}
|
||||
Tcl_SetObjResult(interp, objPtr);
|
||||
va_end(argList);
|
||||
@@ -354,10 +354,10 @@ Tcl_AppendElement(
|
||||
* to result. */
|
||||
{
|
||||
Interp *iPtr = (Interp *) interp;
|
||||
Tcl_Obj *elementPtr = Tcl_NewStringObj(element, -1);
|
||||
Tcl_Obj *elementPtr = Tcl_NewStringObj(element, TCL_INDEX_NONE);
|
||||
Tcl_Obj *listPtr = Tcl_NewListObj(1, &elementPtr);
|
||||
const char *bytes;
|
||||
size_t length;
|
||||
Tcl_Size length;
|
||||
|
||||
if (Tcl_IsShared(iPtr->objResultPtr)) {
|
||||
Tcl_SetObjResult(interp, Tcl_DuplicateObj(iPtr->objResultPtr));
|
||||
@@ -511,7 +511,7 @@ Tcl_SetErrorCode(
|
||||
if (elem == NULL) {
|
||||
break;
|
||||
}
|
||||
Tcl_ListObjAppendElement(NULL, errorObj, Tcl_NewStringObj(elem, -1));
|
||||
Tcl_ListObjAppendElement(NULL, errorObj, Tcl_NewStringObj(elem, TCL_INDEX_NONE));
|
||||
}
|
||||
Tcl_SetObjErrorCode(interp, errorObj);
|
||||
va_end(argList);
|
||||
@@ -721,7 +721,7 @@ TclProcessReturn(
|
||||
Tcl_DictObjGet(NULL, iPtr->returnOpts, keys[KEY_ERRORINFO],
|
||||
&valuePtr);
|
||||
if (valuePtr != NULL) {
|
||||
size_t length;
|
||||
Tcl_Size length;
|
||||
|
||||
(void) Tcl_GetStringFromObj(valuePtr, &length);
|
||||
if (length) {
|
||||
@@ -910,7 +910,7 @@ TclMergeReturnOptions(
|
||||
|
||||
Tcl_DictObjGet(NULL, returnOpts, keys[KEY_ERRORCODE], &valuePtr);
|
||||
if (valuePtr != NULL) {
|
||||
size_t length;
|
||||
Tcl_Size length;
|
||||
|
||||
if (TCL_ERROR == TclListObjLengthM(NULL, valuePtr, &length )) {
|
||||
/*
|
||||
@@ -932,7 +932,7 @@ TclMergeReturnOptions(
|
||||
|
||||
Tcl_DictObjGet(NULL, returnOpts, keys[KEY_ERRORSTACK], &valuePtr);
|
||||
if (valuePtr != NULL) {
|
||||
size_t length;
|
||||
Tcl_Size length;
|
||||
|
||||
if (TCL_ERROR == TclListObjLengthM(NULL, valuePtr, &length)) {
|
||||
/*
|
||||
|
||||
+14
-14
@@ -397,9 +397,9 @@ ValidateFormat(
|
||||
invalidFieldSize:
|
||||
buf[Tcl_UniCharToUtf(ch, buf)] = '\0';
|
||||
errorMsg = Tcl_NewStringObj(
|
||||
"field size modifier may not be specified in %", -1);
|
||||
Tcl_AppendToObj(errorMsg, buf, -1);
|
||||
Tcl_AppendToObj(errorMsg, " conversion", -1);
|
||||
"field size modifier may not be specified in %", TCL_INDEX_NONE);
|
||||
Tcl_AppendToObj(errorMsg, buf, TCL_INDEX_NONE);
|
||||
Tcl_AppendToObj(errorMsg, " conversion", TCL_INDEX_NONE);
|
||||
Tcl_SetObjResult(interp, errorMsg);
|
||||
Tcl_SetErrorCode(interp, "TCL", "FORMAT", "BADSIZE", NULL);
|
||||
goto error;
|
||||
@@ -452,15 +452,15 @@ ValidateFormat(
|
||||
break;
|
||||
badSet:
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"unmatched [ in format string", -1));
|
||||
"unmatched [ in format string", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "FORMAT", "BRACKET", NULL);
|
||||
goto error;
|
||||
default:
|
||||
buf[Tcl_UniCharToUtf(ch, buf)] = '\0';
|
||||
errorMsg = Tcl_NewStringObj(
|
||||
"bad scan conversion character \"", -1);
|
||||
Tcl_AppendToObj(errorMsg, buf, -1);
|
||||
Tcl_AppendToObj(errorMsg, "\"", -1);
|
||||
"bad scan conversion character \"", TCL_INDEX_NONE);
|
||||
Tcl_AppendToObj(errorMsg, buf, TCL_INDEX_NONE);
|
||||
Tcl_AppendToObj(errorMsg, "\"", TCL_INDEX_NONE);
|
||||
Tcl_SetObjResult(interp, errorMsg);
|
||||
Tcl_SetErrorCode(interp, "TCL", "FORMAT", "BADTYPE", NULL);
|
||||
goto error;
|
||||
@@ -531,7 +531,7 @@ ValidateFormat(
|
||||
badIndex:
|
||||
if (gotXpg) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"\"%n$\" argument index out of range", -1));
|
||||
"\"%n$\" argument index out of range", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "FORMAT", "INDEXRANGE", NULL);
|
||||
} else {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
@@ -926,7 +926,7 @@ Tcl_ScanObjCmd(
|
||||
mp_int big;
|
||||
if (mp_init_u64(&big, (Tcl_WideUInt)wideValue) != MP_OKAY) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"insufficient memory to create bignum", -1));
|
||||
"insufficient memory to create bignum", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL);
|
||||
return TCL_ERROR;
|
||||
} else {
|
||||
@@ -953,7 +953,7 @@ Tcl_ScanObjCmd(
|
||||
}
|
||||
Tcl_DecrRefCount(objPtr);
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"unsigned bignum scans are invalid", -1));
|
||||
"unsigned bignum scans are invalid", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "FORMAT",
|
||||
"BADUNSIGNED",NULL);
|
||||
return TCL_ERROR;
|
||||
@@ -972,7 +972,7 @@ Tcl_ScanObjCmd(
|
||||
mp_int big;
|
||||
if (mp_init_u64(&big, (unsigned long)value) != MP_OKAY) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"insufficient memory to create bignum", -1));
|
||||
"insufficient memory to create bignum", TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL);
|
||||
return TCL_ERROR;
|
||||
} else {
|
||||
@@ -993,7 +993,7 @@ Tcl_ScanObjCmd(
|
||||
* Scan a floating point number
|
||||
*/
|
||||
|
||||
objPtr = Tcl_NewDoubleObj(0.0);
|
||||
TclNewDoubleObj(objPtr, 0.0);
|
||||
Tcl_IncrRefCount(objPtr);
|
||||
if (width == 0) {
|
||||
width = ~0;
|
||||
@@ -1019,7 +1019,7 @@ Tcl_ScanObjCmd(
|
||||
if (Tcl_GetDoubleFromObj(NULL, objPtr, &dvalue) != TCL_OK) {
|
||||
#ifdef ACCEPT_NAN
|
||||
const Tcl_ObjInternalRep *irPtr
|
||||
= TclFetchInternalRep(objPtr, &tclDoubleType);
|
||||
= TclFetchInternalRep(objPtr, &tclDoubleType.objType);
|
||||
if (irPtr) {
|
||||
dvalue = irPtr->doubleValue;
|
||||
} else
|
||||
@@ -1090,7 +1090,7 @@ Tcl_ScanObjCmd(
|
||||
if (code == TCL_OK) {
|
||||
if (underflow && (nconversions == 0)) {
|
||||
if (numVars) {
|
||||
TclNewIndexObj(objPtr, TCL_INDEX_NONE);
|
||||
TclNewIntObj(objPtr, -1);
|
||||
} else {
|
||||
if (objPtr) {
|
||||
Tcl_SetListObj(objPtr, 0, NULL);
|
||||
|
||||
+40
-39
@@ -261,34 +261,35 @@ static const int log2pow5[27] = {
|
||||
};
|
||||
#define N_LOG2POW5 27
|
||||
|
||||
static const Tcl_WideUInt wuipow5[27] = {
|
||||
(Tcl_WideUInt) 1, /* 5**0 */
|
||||
(Tcl_WideUInt) 5,
|
||||
(Tcl_WideUInt) 25,
|
||||
(Tcl_WideUInt) 125,
|
||||
(Tcl_WideUInt) 625,
|
||||
(Tcl_WideUInt) 3125, /* 5**5 */
|
||||
(Tcl_WideUInt) 3125*5,
|
||||
(Tcl_WideUInt) 3125*25,
|
||||
(Tcl_WideUInt) 3125*125,
|
||||
(Tcl_WideUInt) 3125*625,
|
||||
(Tcl_WideUInt) 3125*3125, /* 5**10 */
|
||||
(Tcl_WideUInt) 3125*3125*5,
|
||||
(Tcl_WideUInt) 3125*3125*25,
|
||||
(Tcl_WideUInt) 3125*3125*125,
|
||||
(Tcl_WideUInt) 3125*3125*625,
|
||||
(Tcl_WideUInt) 3125*3125*3125, /* 5**15 */
|
||||
(Tcl_WideUInt) 3125*3125*3125*5,
|
||||
(Tcl_WideUInt) 3125*3125*3125*25,
|
||||
(Tcl_WideUInt) 3125*3125*3125*125,
|
||||
(Tcl_WideUInt) 3125*3125*3125*625,
|
||||
(Tcl_WideUInt) 3125*3125*3125*3125, /* 5**20 */
|
||||
(Tcl_WideUInt) 3125*3125*3125*3125*5,
|
||||
(Tcl_WideUInt) 3125*3125*3125*3125*25,
|
||||
(Tcl_WideUInt) 3125*3125*3125*3125*125,
|
||||
(Tcl_WideUInt) 3125*3125*3125*3125*625,
|
||||
(Tcl_WideUInt) 3125*3125*3125*3125*3125, /* 5**25 */
|
||||
(Tcl_WideUInt) 3125*3125*3125*3125*3125*5 /* 5**26 */
|
||||
static const Tcl_WideUInt wuipow5[] = {
|
||||
(Tcl_WideUInt) 1U, /* 5**0 */
|
||||
(Tcl_WideUInt) 5U,
|
||||
(Tcl_WideUInt) 25U,
|
||||
(Tcl_WideUInt) 125U,
|
||||
(Tcl_WideUInt) 625U,
|
||||
(Tcl_WideUInt) 3125U, /* 5**5 */
|
||||
(Tcl_WideUInt) 3125U*5U,
|
||||
(Tcl_WideUInt) 3125U*25U,
|
||||
(Tcl_WideUInt) 3125U*125U,
|
||||
(Tcl_WideUInt) 3125U*625U,
|
||||
(Tcl_WideUInt) 3125U*3125U, /* 5**10 */
|
||||
(Tcl_WideUInt) 3125U*3125U*5U,
|
||||
(Tcl_WideUInt) 3125U*3125U*25U,
|
||||
(Tcl_WideUInt) 3125U*3125U*125U,
|
||||
(Tcl_WideUInt) 3125U*3125U*625U,
|
||||
(Tcl_WideUInt) 3125U*3125U*3125U, /* 5**15 */
|
||||
(Tcl_WideUInt) 3125U*3125U*3125U*5U,
|
||||
(Tcl_WideUInt) 3125U*3125U*3125U*25U,
|
||||
(Tcl_WideUInt) 3125U*3125U*3125U*125U,
|
||||
(Tcl_WideUInt) 3125U*3125U*3125U*625U,
|
||||
(Tcl_WideUInt) 3125U*3125U*3125U*3125U, /* 5**20 */
|
||||
(Tcl_WideUInt) 3125U*3125U*3125U*3125U*5U,
|
||||
(Tcl_WideUInt) 3125U*3125U*3125U*3125U*25U,
|
||||
(Tcl_WideUInt) 3125U*3125U*3125U*3125U*125U,
|
||||
(Tcl_WideUInt) 3125U*3125U*3125U*3125U*625U,
|
||||
(Tcl_WideUInt) 3125U*3125U*3125U*3125U*3125U, /* 5**25 */
|
||||
(Tcl_WideUInt) 3125U*3125U*3125U*3125U*3125U*5U,
|
||||
(Tcl_WideUInt) 3125U*3125U*3125U*3125U*3125U*25U /* 5**27 */
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -554,7 +555,7 @@ TclParseNumber(
|
||||
/* A dict can never be a (single) number */
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (TclHasInternalRep(objPtr, &tclListType)) {
|
||||
if (TclHasInternalRep(objPtr, &tclListType.objType)) {
|
||||
size_t length;
|
||||
/* A list can only be a (single) number if its length == 1 */
|
||||
TclListObjLengthM(NULL, objPtr, &length);
|
||||
@@ -1377,7 +1378,7 @@ TclParseNumber(
|
||||
octalSignificandWide);
|
||||
octalSignificandOverflow = 1;
|
||||
} else {
|
||||
objPtr->typePtr = &tclIntType;
|
||||
objPtr->typePtr = &tclIntType.objType;
|
||||
if (signum) {
|
||||
objPtr->internalRep.wideValue =
|
||||
(Tcl_WideInt)(-octalSignificandWide);
|
||||
@@ -1413,7 +1414,7 @@ TclParseNumber(
|
||||
significandWide);
|
||||
significandOverflow = 1;
|
||||
} else {
|
||||
objPtr->typePtr = &tclIntType;
|
||||
objPtr->typePtr = &tclIntType.objType;
|
||||
if (signum) {
|
||||
objPtr->internalRep.wideValue =
|
||||
(Tcl_WideInt)(-significandWide);
|
||||
@@ -1445,7 +1446,7 @@ TclParseNumber(
|
||||
* k = numTrailZeros+exponent-numDigitsAfterDp.
|
||||
*/
|
||||
|
||||
objPtr->typePtr = &tclDoubleType;
|
||||
objPtr->typePtr = &tclDoubleType.objType;
|
||||
if (exponentSignum) {
|
||||
/*
|
||||
* At this point exponent>=0, so the following calculation
|
||||
@@ -1496,14 +1497,14 @@ TclParseNumber(
|
||||
} else {
|
||||
objPtr->internalRep.doubleValue = HUGE_VAL;
|
||||
}
|
||||
objPtr->typePtr = &tclDoubleType;
|
||||
objPtr->typePtr = &tclDoubleType.objType;
|
||||
break;
|
||||
|
||||
#ifdef IEEE_FLOATING_POINT
|
||||
case sNAN:
|
||||
case sNANFINISH:
|
||||
objPtr->internalRep.doubleValue = MakeNaN(signum, significandWide);
|
||||
objPtr->typePtr = &tclDoubleType;
|
||||
objPtr->typePtr = &tclDoubleType.objType;
|
||||
break;
|
||||
#endif
|
||||
case INITIAL:
|
||||
@@ -1522,7 +1523,7 @@ TclParseNumber(
|
||||
expected);
|
||||
|
||||
Tcl_AppendLimitedToObj(msg, bytes, numBytes, 50, "");
|
||||
Tcl_AppendToObj(msg, "\"", -1);
|
||||
Tcl_AppendToObj(msg, "\"", TCL_INDEX_NONE);
|
||||
Tcl_SetObjResult(interp, msg);
|
||||
Tcl_SetErrorCode(interp, "TCL", "VALUE", "NUMBER", NULL);
|
||||
}
|
||||
@@ -4484,7 +4485,7 @@ TclDoubleDigits(
|
||||
++m2plus;
|
||||
}
|
||||
|
||||
if (s5+1 < N_LOG2POW5 && s2+1 + log2pow5[s5+1] <= 64) {
|
||||
if (s5+1 < N_LOG2POW5 && s2+1 + log2pow5[s5+1] < 64) {
|
||||
/*
|
||||
* If 10*2**s2*5**s5 == 2**(s2+1)+5**(s5+1) fits in a 64-bit word,
|
||||
* then all our intermediate calculations can be done using exact
|
||||
@@ -4541,7 +4542,7 @@ TclDoubleDigits(
|
||||
s2 -= b2; b2 = 0;
|
||||
}
|
||||
|
||||
if (s5+1 < N_LOG2POW5 && s2+1 + log2pow5[s5+1] <= 64) {
|
||||
if (s5+1 < N_LOG2POW5 && s2+1 + log2pow5[s5+1] < 64) {
|
||||
/*
|
||||
* If 10*2**s2*5**s5 == 2**(s2+1)+5**(s5+1) fits in a 64-bit word,
|
||||
* then all our intermediate calculations can be done using exact
|
||||
@@ -4786,7 +4787,7 @@ Tcl_InitBignumFromDouble(
|
||||
if (interp != NULL) {
|
||||
const char *s = "integer value too large to represent";
|
||||
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(s, -1));
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(s, TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "ARITH", "IOVERFLOW", s, NULL);
|
||||
}
|
||||
return TCL_ERROR;
|
||||
@@ -5272,7 +5273,7 @@ TclFormatNaN(
|
||||
*buffer++ = 'N';
|
||||
bitwhack.iv &= ((UINT64_C(1)) << 51) - 1;
|
||||
if (bitwhack.iv != 0) {
|
||||
sprintf(buffer, "(%" PRIx64 ")", bitwhack.iv);
|
||||
snprintf(buffer, TCL_DOUBLE_SPACE, "(%" PRIx64 ")", bitwhack.iv);
|
||||
} else {
|
||||
*buffer = '\0';
|
||||
}
|
||||
|
||||
+108
-96
@@ -257,7 +257,7 @@ Tcl_Obj *
|
||||
Tcl_NewStringObj(
|
||||
const char *bytes, /* Points to the first of the length bytes
|
||||
* used to initialize the new object. */
|
||||
size_t length) /* The number of bytes to copy from "bytes"
|
||||
Tcl_Size length) /* The number of bytes to copy from "bytes"
|
||||
* when initializing the new object. If
|
||||
* TCL_INDEX_NONE, use bytes up to the first NUL
|
||||
* byte. */
|
||||
@@ -269,13 +269,13 @@ Tcl_Obj *
|
||||
Tcl_NewStringObj(
|
||||
const char *bytes, /* Points to the first of the length bytes
|
||||
* used to initialize the new object. */
|
||||
size_t length) /* The number of bytes to copy from "bytes"
|
||||
* when initializing the new object. If -1,
|
||||
Tcl_Size length) /* The number of bytes to copy from "bytes"
|
||||
* when initializing the new object. If TCL_INDEX_NONE,
|
||||
* use bytes up to the first NUL byte. */
|
||||
{
|
||||
Tcl_Obj *objPtr;
|
||||
|
||||
if (length == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(length)) {
|
||||
length = (bytes? strlen(bytes) : 0);
|
||||
}
|
||||
TclNewStringObj(objPtr, bytes, length);
|
||||
@@ -317,7 +317,7 @@ Tcl_Obj *
|
||||
Tcl_DbNewStringObj(
|
||||
const char *bytes, /* Points to the first of the length bytes
|
||||
* used to initialize the new object. */
|
||||
size_t length, /* The number of bytes to copy from "bytes"
|
||||
Tcl_Size length, /* The number of bytes to copy from "bytes"
|
||||
* when initializing the new object. If -1,
|
||||
* use bytes up to the first NUL byte. */
|
||||
const char *file, /* The name of the source file calling this
|
||||
@@ -327,7 +327,7 @@ Tcl_DbNewStringObj(
|
||||
{
|
||||
Tcl_Obj *objPtr;
|
||||
|
||||
if (length == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(length)) {
|
||||
length = (bytes? strlen(bytes) : 0);
|
||||
}
|
||||
TclDbNewObj(objPtr, file, line);
|
||||
@@ -339,7 +339,7 @@ Tcl_Obj *
|
||||
Tcl_DbNewStringObj(
|
||||
const char *bytes, /* Points to the first of the length bytes
|
||||
* used to initialize the new object. */
|
||||
size_t length, /* The number of bytes to copy from "bytes"
|
||||
Tcl_Size length, /* The number of bytes to copy from "bytes"
|
||||
* when initializing the new object. If -1,
|
||||
* use bytes up to the first NUL byte. */
|
||||
TCL_UNUSED(const char *) /*file*/,
|
||||
@@ -372,7 +372,7 @@ Tcl_Obj *
|
||||
Tcl_NewUnicodeObj(
|
||||
const Tcl_UniChar *unicode, /* The unicode string used to initialize the
|
||||
* new object. */
|
||||
size_t numChars) /* Number of characters in the unicode
|
||||
Tcl_Size numChars) /* Number of characters in the unicode
|
||||
* string. */
|
||||
{
|
||||
Tcl_Obj *objPtr;
|
||||
@@ -399,13 +399,13 @@ Tcl_NewUnicodeObj(
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
size_t
|
||||
Tcl_Size
|
||||
Tcl_GetCharLength(
|
||||
Tcl_Obj *objPtr) /* The String object to get the num chars
|
||||
* of. */
|
||||
{
|
||||
String *stringPtr;
|
||||
size_t numChars = 0;
|
||||
Tcl_Size numChars = 0;
|
||||
|
||||
/*
|
||||
* Quick, no-shimmer return for short string reps.
|
||||
@@ -444,19 +444,19 @@ Tcl_GetCharLength(
|
||||
* If numChars is unknown, compute it.
|
||||
*/
|
||||
|
||||
if (numChars == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(numChars)) {
|
||||
TclNumUtfCharsM(numChars, objPtr->bytes, objPtr->length);
|
||||
stringPtr->numChars = numChars;
|
||||
}
|
||||
return numChars;
|
||||
}
|
||||
|
||||
size_t
|
||||
Tcl_Size
|
||||
TclGetCharLength(
|
||||
Tcl_Obj *objPtr) /* The String object to get the num chars
|
||||
* of. */
|
||||
{
|
||||
size_t numChars = 0;
|
||||
Tcl_Size numChars = 0;
|
||||
|
||||
/*
|
||||
* Quick, no-shimmer return for short string reps.
|
||||
@@ -509,7 +509,7 @@ int
|
||||
TclCheckEmptyString(
|
||||
Tcl_Obj *objPtr)
|
||||
{
|
||||
size_t length = TCL_INDEX_NONE;
|
||||
Tcl_Size length = TCL_INDEX_NONE;
|
||||
|
||||
if (objPtr->bytes == &tclEmptyString) {
|
||||
return TCL_EMPTYSTRING_YES;
|
||||
@@ -553,7 +553,7 @@ int
|
||||
Tcl_GetUniChar(
|
||||
Tcl_Obj *objPtr, /* The object to get the Unicode charater
|
||||
* from. */
|
||||
size_t index) /* Get the index'th Unicode character. */
|
||||
Tcl_Size index) /* Get the index'th Unicode character. */
|
||||
{
|
||||
String *stringPtr;
|
||||
int ch;
|
||||
@@ -564,7 +564,7 @@ Tcl_GetUniChar(
|
||||
*/
|
||||
|
||||
if (TclIsPureByteArray(objPtr)) {
|
||||
size_t length = 0;
|
||||
Tcl_Size length = 0;
|
||||
unsigned char *bytes = Tcl_GetByteArrayFromObj(objPtr, &length);
|
||||
if (index >= length) {
|
||||
return -1;
|
||||
@@ -585,7 +585,7 @@ Tcl_GetUniChar(
|
||||
* If numChars is unknown, compute it.
|
||||
*/
|
||||
|
||||
if (stringPtr->numChars == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(stringPtr->numChars)) {
|
||||
TclNumUtfCharsM(stringPtr->numChars, objPtr->bytes, objPtr->length);
|
||||
}
|
||||
if (stringPtr->numChars == objPtr->length) {
|
||||
@@ -622,7 +622,7 @@ int
|
||||
TclGetUniChar(
|
||||
Tcl_Obj *objPtr, /* The object to get the Unicode charater
|
||||
* from. */
|
||||
size_t index) /* Get the index'th Unicode character. */
|
||||
Tcl_Size index) /* Get the index'th Unicode character. */
|
||||
{
|
||||
int ch = 0;
|
||||
|
||||
@@ -632,7 +632,7 @@ TclGetUniChar(
|
||||
*/
|
||||
|
||||
if (TclIsPureByteArray(objPtr)) {
|
||||
size_t length = 0;
|
||||
Tcl_Size length = 0;
|
||||
unsigned char *bytes = Tcl_GetByteArrayFromObj(objPtr, &length);
|
||||
if (index >= length) {
|
||||
return -1;
|
||||
@@ -641,7 +641,7 @@ TclGetUniChar(
|
||||
return bytes[index];
|
||||
}
|
||||
|
||||
size_t numChars = TclNumUtfChars(objPtr->bytes, objPtr->length);
|
||||
Tcl_Size numChars = TclNumUtfChars(objPtr->bytes, objPtr->length);
|
||||
|
||||
if (index >= numChars) {
|
||||
return -1;
|
||||
@@ -693,7 +693,7 @@ TclGetUnicodeFromObj(
|
||||
if (lengthPtr != NULL) {
|
||||
if (stringPtr->numChars > INT_MAX) {
|
||||
Tcl_Panic("Tcl_GetUnicodeFromObj with 'int' lengthPtr"
|
||||
"cannot handle such long strings. Please use 'size_t'");
|
||||
"cannot handle such long strings. Please use 'Tcl_Size'");
|
||||
}
|
||||
*lengthPtr = (int)stringPtr->numChars;
|
||||
}
|
||||
@@ -747,14 +747,14 @@ Tcl_GetUnicodeFromObj(
|
||||
Tcl_Obj *
|
||||
Tcl_GetRange(
|
||||
Tcl_Obj *objPtr, /* The Tcl object to find the range of. */
|
||||
size_t first, /* First index of the range. */
|
||||
size_t last) /* Last index of the range. */
|
||||
Tcl_Size first, /* First index of the range. */
|
||||
Tcl_Size last) /* Last index of the range. */
|
||||
{
|
||||
Tcl_Obj *newObjPtr; /* The Tcl object to find the range of. */
|
||||
String *stringPtr;
|
||||
size_t length = 0;
|
||||
Tcl_Size length = 0;
|
||||
|
||||
if (first == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(first)) {
|
||||
first = TCL_INDEX_START;
|
||||
}
|
||||
|
||||
@@ -788,7 +788,7 @@ Tcl_GetRange(
|
||||
* If numChars is unknown, compute it.
|
||||
*/
|
||||
|
||||
if (stringPtr->numChars == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(stringPtr->numChars)) {
|
||||
TclNumUtfCharsM(stringPtr->numChars, objPtr->bytes, objPtr->length);
|
||||
}
|
||||
if (stringPtr->numChars == objPtr->length) {
|
||||
@@ -838,13 +838,13 @@ Tcl_GetRange(
|
||||
Tcl_Obj *
|
||||
TclGetRange(
|
||||
Tcl_Obj *objPtr, /* The Tcl object to find the range of. */
|
||||
size_t first, /* First index of the range. */
|
||||
size_t last) /* Last index of the range. */
|
||||
Tcl_Size first, /* First index of the range. */
|
||||
Tcl_Size last) /* Last index of the range. */
|
||||
{
|
||||
Tcl_Obj *newObjPtr; /* The Tcl object to find the range of. */
|
||||
size_t length = 0;
|
||||
Tcl_Size length = 0;
|
||||
|
||||
if (first == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(first)) {
|
||||
first = TCL_INDEX_START;
|
||||
}
|
||||
|
||||
@@ -866,7 +866,7 @@ TclGetRange(
|
||||
return Tcl_NewByteArrayObj(bytes + first, last - first + 1);
|
||||
}
|
||||
|
||||
size_t numChars = TclNumUtfChars(objPtr->bytes, objPtr->length);
|
||||
Tcl_Size numChars = TclNumUtfChars(objPtr->bytes, objPtr->length);
|
||||
|
||||
if (last >= numChars) {
|
||||
last = numChars - 1;
|
||||
@@ -906,8 +906,8 @@ Tcl_SetStringObj(
|
||||
Tcl_Obj *objPtr, /* Object whose internal rep to init. */
|
||||
const char *bytes, /* Points to the first of the length bytes
|
||||
* used to initialize the object. */
|
||||
size_t length) /* The number of bytes to copy from "bytes"
|
||||
* when initializing the object. If -1,
|
||||
Tcl_Size length) /* The number of bytes to copy from "bytes"
|
||||
* when initializing the object. If TCL_INDEX_NONE,
|
||||
* use bytes up to the first NUL byte.*/
|
||||
{
|
||||
if (Tcl_IsShared(objPtr)) {
|
||||
@@ -926,7 +926,7 @@ Tcl_SetStringObj(
|
||||
*/
|
||||
|
||||
TclInvalidateStringRep(objPtr);
|
||||
if (length == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(length)) {
|
||||
length = (bytes? strlen(bytes) : 0);
|
||||
}
|
||||
TclInitStringRep(objPtr, bytes, length);
|
||||
@@ -959,7 +959,7 @@ void
|
||||
Tcl_SetObjLength(
|
||||
Tcl_Obj *objPtr, /* Pointer to object. This object must not
|
||||
* currently be shared. */
|
||||
size_t length) /* Number of bytes desired for string
|
||||
Tcl_Size length) /* Number of bytes desired for string
|
||||
* representation of object, not including
|
||||
* terminating null byte. */
|
||||
{
|
||||
@@ -1050,7 +1050,7 @@ int
|
||||
Tcl_AttemptSetObjLength(
|
||||
Tcl_Obj *objPtr, /* Pointer to object. This object must not
|
||||
* currently be shared. */
|
||||
size_t length) /* Number of bytes desired for string
|
||||
Tcl_Size length) /* Number of bytes desired for string
|
||||
* representation of object, not including
|
||||
* terminating null byte. */
|
||||
{
|
||||
@@ -1149,7 +1149,7 @@ Tcl_SetUnicodeObj(
|
||||
Tcl_Obj *objPtr, /* The object to set the string of. */
|
||||
const Tcl_UniChar *unicode, /* The unicode string used to initialize the
|
||||
* object. */
|
||||
size_t numChars) /* Number of characters in the unicode
|
||||
Tcl_Size numChars) /* Number of characters in the unicode
|
||||
* string. */
|
||||
{
|
||||
if (Tcl_IsShared(objPtr)) {
|
||||
@@ -1163,10 +1163,10 @@ static size_t
|
||||
UnicodeLength(
|
||||
const Tcl_UniChar *unicode)
|
||||
{
|
||||
size_t numChars = 0;
|
||||
Tcl_Size numChars = 0;
|
||||
|
||||
if (unicode) {
|
||||
while ((numChars != TCL_INDEX_NONE) && (unicode[numChars] != 0)) {
|
||||
while (!TCL_SIZE_ISNEG(numChars) && (unicode[numChars] != 0)) {
|
||||
numChars++;
|
||||
}
|
||||
}
|
||||
@@ -1183,8 +1183,8 @@ SetUnicodeObj(
|
||||
{
|
||||
String *stringPtr;
|
||||
|
||||
if (numChars == TCL_INDEX_NONE) {
|
||||
numChars = UnicodeLength(unicode);
|
||||
if (TCL_SIZE_ISNEG(numChars)) {
|
||||
numChars = UnicodeLength(unicode);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1228,10 +1228,10 @@ Tcl_AppendLimitedToObj(
|
||||
Tcl_Obj *objPtr, /* Points to the object to append to. */
|
||||
const char *bytes, /* Points to the bytes to append to the
|
||||
* object. */
|
||||
size_t length, /* The number of bytes available to be
|
||||
* appended from "bytes". If -1, then
|
||||
Tcl_Size length, /* The number of bytes available to be
|
||||
* appended from "bytes". If TCL_INDEX_NONE, then
|
||||
* all bytes up to a NUL byte are available. */
|
||||
size_t limit, /* The maximum number of bytes to append to
|
||||
Tcl_Size limit, /* The maximum number of bytes to append to
|
||||
* the object. */
|
||||
const char *ellipsis) /* Ellipsis marker string, appended to the
|
||||
* object to indicate not all available bytes
|
||||
@@ -1241,7 +1241,7 @@ Tcl_AppendLimitedToObj(
|
||||
size_t toCopy = 0;
|
||||
size_t eLen = 0;
|
||||
|
||||
if (length == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(length)) {
|
||||
length = (bytes ? strlen(bytes) : 0);
|
||||
}
|
||||
if (length == 0) {
|
||||
@@ -1324,7 +1324,7 @@ Tcl_AppendToObj(
|
||||
Tcl_Obj *objPtr, /* Points to the object to append to. */
|
||||
const char *bytes, /* Points to the bytes to append to the
|
||||
* object. */
|
||||
size_t length) /* The number of bytes to append from "bytes".
|
||||
Tcl_Size length) /* The number of bytes to append from "bytes".
|
||||
* If TCL_INDEX_NONE, then append all bytes up to NUL
|
||||
* byte. */
|
||||
{
|
||||
@@ -1353,7 +1353,7 @@ Tcl_AppendUnicodeToObj(
|
||||
Tcl_Obj *objPtr, /* Points to the object to append to. */
|
||||
const Tcl_UniChar *unicode, /* The unicode string to append to the
|
||||
* object. */
|
||||
size_t length) /* Number of chars in "unicode". */
|
||||
Tcl_Size length) /* Number of chars in "unicode". */
|
||||
{
|
||||
String *stringPtr;
|
||||
|
||||
@@ -1407,7 +1407,7 @@ Tcl_AppendObjToObj(
|
||||
Tcl_Obj *appendObjPtr) /* Object to append. */
|
||||
{
|
||||
String *stringPtr;
|
||||
size_t length = 0, numChars;
|
||||
Tcl_Size length = 0, numChars;
|
||||
size_t appendNumChars = TCL_INDEX_NONE;
|
||||
const char *bytes;
|
||||
|
||||
@@ -1448,7 +1448,7 @@ Tcl_AppendObjToObj(
|
||||
* First, get the lengths.
|
||||
*/
|
||||
|
||||
size_t lengthSrc = 0;
|
||||
Tcl_Size lengthSrc = 0;
|
||||
|
||||
(void) Tcl_GetByteArrayFromObj(objPtr, &length);
|
||||
(void) Tcl_GetByteArrayFromObj(appendObjPtr, &lengthSrc);
|
||||
@@ -1471,7 +1471,7 @@ Tcl_AppendObjToObj(
|
||||
*/
|
||||
|
||||
TclAppendBytesToByteArray(objPtr,
|
||||
Tcl_GetBytesFromObj(NULL, appendObjPtr, (size_t *)NULL), lengthSrc);
|
||||
Tcl_GetByteArrayFromObj(appendObjPtr, (size_t *)NULL), lengthSrc);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1520,7 +1520,7 @@ Tcl_AppendObjToObj(
|
||||
bytes = Tcl_GetStringFromObj(appendObjPtr, &length);
|
||||
|
||||
numChars = stringPtr->numChars;
|
||||
if ((numChars != TCL_INDEX_NONE) && TclHasInternalRep(appendObjPtr, &tclStringType)) {
|
||||
if (!TCL_SIZE_ISNEG(numChars) && TclHasInternalRep(appendObjPtr, &tclStringType)) {
|
||||
String *appendStringPtr = GET_STRING(appendObjPtr);
|
||||
|
||||
appendNumChars = appendStringPtr->numChars;
|
||||
@@ -1528,7 +1528,7 @@ Tcl_AppendObjToObj(
|
||||
|
||||
AppendUtfToUtfRep(objPtr, bytes, length);
|
||||
|
||||
if ((numChars != TCL_INDEX_NONE) && (appendNumChars != TCL_INDEX_NONE)) {
|
||||
if (!TCL_SIZE_ISNEG(numChars) && !TCL_SIZE_ISNEG(appendNumChars)) {
|
||||
stringPtr->numChars = numChars + appendNumChars;
|
||||
}
|
||||
}
|
||||
@@ -1559,7 +1559,7 @@ AppendUnicodeToUnicodeRep(
|
||||
String *stringPtr;
|
||||
size_t numChars;
|
||||
|
||||
if (appendNumChars == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(appendNumChars)) {
|
||||
appendNumChars = UnicodeLength(unicode);
|
||||
}
|
||||
if (appendNumChars == 0) {
|
||||
@@ -1600,7 +1600,7 @@ AppendUnicodeToUnicodeRep(
|
||||
* Relocate unicode if needed; see above.
|
||||
*/
|
||||
|
||||
if (index != TCL_INDEX_NONE) {
|
||||
if (!TCL_SIZE_ISNEG(index)) {
|
||||
unicode = stringPtr->unicode + index;
|
||||
}
|
||||
}
|
||||
@@ -1648,7 +1648,7 @@ AppendUnicodeToUtfRep(
|
||||
|
||||
numChars = ExtendStringRepWithUnicode(objPtr, unicode, numChars);
|
||||
|
||||
if (stringPtr->numChars != TCL_INDEX_NONE) {
|
||||
if (!TCL_SIZE_ISNEG(stringPtr->numChars)) {
|
||||
stringPtr->numChars += numChars;
|
||||
}
|
||||
}
|
||||
@@ -1683,7 +1683,7 @@ AppendUtfToUnicodeRep(
|
||||
return;
|
||||
}
|
||||
|
||||
ExtendUnicodeRepWithString(objPtr, bytes, numBytes, -1);
|
||||
ExtendUnicodeRepWithString(objPtr, bytes, numBytes, TCL_INDEX_NONE);
|
||||
TclInvalidateStringRep(objPtr);
|
||||
stringPtr = GET_STRING(objPtr);
|
||||
stringPtr->allocated = 0;
|
||||
@@ -1757,7 +1757,7 @@ AppendUtfToUtfRep(
|
||||
* Relocate bytes if needed; see above.
|
||||
*/
|
||||
|
||||
if (offset != TCL_INDEX_NONE) {
|
||||
if (!TCL_SIZE_ISNEG(offset)) {
|
||||
bytes = objPtr->bytes + offset;
|
||||
}
|
||||
}
|
||||
@@ -1812,7 +1812,7 @@ Tcl_AppendStringsToObj(
|
||||
if (bytes == NULL) {
|
||||
break;
|
||||
}
|
||||
Tcl_AppendToObj(objPtr, bytes, -1);
|
||||
Tcl_AppendToObj(objPtr, bytes, TCL_INDEX_NONE);
|
||||
}
|
||||
va_end(argList);
|
||||
}
|
||||
@@ -1842,12 +1842,12 @@ Tcl_AppendFormatToObj(
|
||||
Tcl_Interp *interp,
|
||||
Tcl_Obj *appendObj,
|
||||
const char *format,
|
||||
size_t objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
const char *span = format, *msg, *errCode;
|
||||
int gotXpg = 0, gotSequential = 0;
|
||||
size_t objIndex = 0, originalLength, limit, numBytes = 0;
|
||||
Tcl_Size objIndex = 0, originalLength, limit, numBytes = 0;
|
||||
Tcl_UniChar ch = 0;
|
||||
static const char *mixedXPG =
|
||||
"cannot mix \"%\" and \"%n$\" conversion specifiers";
|
||||
@@ -2130,6 +2130,9 @@ Tcl_AppendFormatToObj(
|
||||
if (TclGetIntFromObj(interp, segment, &code) != TCL_OK) {
|
||||
goto error;
|
||||
}
|
||||
if ((unsigned)code > 0x10FFFF) {
|
||||
code = 0xFFFD;
|
||||
}
|
||||
length = Tcl_UniCharToUtf(code, buf);
|
||||
#if TCL_UTF_MAX < 4
|
||||
if ((code >= 0xD800) && (length < 3)) {
|
||||
@@ -2244,7 +2247,7 @@ Tcl_AppendFormatToObj(
|
||||
|
||||
switch (ch) {
|
||||
case 'd': {
|
||||
size_t length;
|
||||
Tcl_Size length;
|
||||
Tcl_Obj *pure;
|
||||
const char *bytes;
|
||||
|
||||
@@ -2317,7 +2320,7 @@ Tcl_AppendFormatToObj(
|
||||
Tcl_WideUInt bits = 0;
|
||||
Tcl_WideInt numDigits = 0;
|
||||
int numBits = 4, base = 16, index = 0, shift = 0;
|
||||
size_t length;
|
||||
Tcl_Size length;
|
||||
Tcl_Obj *pure;
|
||||
char *bytes;
|
||||
|
||||
@@ -2478,14 +2481,14 @@ Tcl_AppendFormatToObj(
|
||||
*p++ = '+';
|
||||
}
|
||||
if (width) {
|
||||
p += sprintf(p, "%d", width);
|
||||
p += snprintf(p, TCL_INTEGER_SPACE, "%d", width);
|
||||
if (width > length) {
|
||||
length = width;
|
||||
}
|
||||
}
|
||||
if (gotPrecision) {
|
||||
*p++ = '.';
|
||||
p += sprintf(p, "%d", precision);
|
||||
p += snprintf(p, TCL_INTEGER_SPACE, "%d", precision);
|
||||
if (precision > INT_MAX - length) {
|
||||
msg = overflow;
|
||||
errCode = "OVERFLOW";
|
||||
@@ -2509,7 +2512,7 @@ Tcl_AppendFormatToObj(
|
||||
goto errorMsg;
|
||||
}
|
||||
bytes = TclGetString(segment);
|
||||
if (!Tcl_AttemptSetObjLength(segment, sprintf(bytes, spec, d))) {
|
||||
if (!Tcl_AttemptSetObjLength(segment, snprintf(bytes, segment->length, spec, d))) {
|
||||
msg = overflow;
|
||||
errCode = "OVERFLOW";
|
||||
goto errorMsg;
|
||||
@@ -2585,7 +2588,7 @@ Tcl_AppendFormatToObj(
|
||||
|
||||
errorMsg:
|
||||
if (interp != NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(msg, -1));
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(msg, TCL_INDEX_NONE));
|
||||
Tcl_SetErrorCode(interp, "TCL", "FORMAT", errCode, NULL);
|
||||
}
|
||||
error:
|
||||
@@ -2611,7 +2614,7 @@ Tcl_Obj *
|
||||
Tcl_Format(
|
||||
Tcl_Interp *interp,
|
||||
const char *format,
|
||||
size_t objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
int result;
|
||||
@@ -2892,7 +2895,7 @@ Tcl_ObjPrintf(
|
||||
char *
|
||||
TclGetStringStorage(
|
||||
Tcl_Obj *objPtr,
|
||||
size_t *sizePtr)
|
||||
Tcl_Size *sizePtr)
|
||||
{
|
||||
String *stringPtr;
|
||||
|
||||
@@ -2931,7 +2934,7 @@ TclStringRepeat(
|
||||
{
|
||||
Tcl_Obj *objResultPtr;
|
||||
int inPlace = flags & TCL_STRING_IN_PLACE;
|
||||
size_t length = 0, unichar = 0, done = 1;
|
||||
Tcl_Size length = 0, unichar = 0, done = 1;
|
||||
int binary = TclIsPureByteArray(objPtr);
|
||||
size_t maxCount;
|
||||
|
||||
@@ -2957,13 +2960,11 @@ TclStringRepeat(
|
||||
/* Result will be pure byte array. Pre-size it */
|
||||
(void)Tcl_GetByteArrayFromObj(objPtr, &length);
|
||||
maxCount = TCL_SIZE_SMAX;
|
||||
}
|
||||
else if (unichar) {
|
||||
} else if (unichar) {
|
||||
/* Result will be pure Tcl_UniChar array. Pre-size it. */
|
||||
(void)Tcl_GetUnicodeFromObj(objPtr, &length);
|
||||
maxCount = TCL_SIZE_SMAX/sizeof(Tcl_UniChar);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
/* Result will be concat of string reps. Pre-size it. */
|
||||
(void)Tcl_GetStringFromObj(objPtr, &length);
|
||||
maxCount = TCL_SIZE_SMAX;
|
||||
@@ -3000,7 +3001,7 @@ TclStringRepeat(
|
||||
done *= 2;
|
||||
}
|
||||
TclAppendBytesToByteArray(objResultPtr,
|
||||
Tcl_GetBytesFromObj(NULL, objResultPtr, (size_t *)NULL),
|
||||
Tcl_GetByteArrayFromObj(objResultPtr, (size_t *)NULL),
|
||||
(count - done) * length);
|
||||
} else if (unichar) {
|
||||
/*
|
||||
@@ -3089,7 +3090,7 @@ TclStringCat(
|
||||
{
|
||||
Tcl_Obj *objResultPtr, * const *ov;
|
||||
int oc, binary = 1;
|
||||
size_t length = 0;
|
||||
Tcl_Size length = 0;
|
||||
int allowUniChar = 1, requestUniChar = 0, forceUniChar = 0;
|
||||
int first = objc - 1; /* Index of first value possibly not empty */
|
||||
int last = 0; /* Index of last value possibly not empty */
|
||||
@@ -3468,11 +3469,12 @@ TclStringCmp(
|
||||
Tcl_Obj *value2Ptr,
|
||||
int checkEq, /* comparison is only for equality */
|
||||
int nocase, /* comparison is not case sensitive */
|
||||
size_t reqlength) /* requested length */
|
||||
size_t reqlength) /* requested length in characters;
|
||||
* TCL_INDEX_NONE to compare whole strings */
|
||||
{
|
||||
char *s1, *s2;
|
||||
const char *s1, *s2;
|
||||
int empty, match;
|
||||
size_t length, s1len = 0, s2len = 0;
|
||||
Tcl_Size length, s1len = 0, s2len = 0;
|
||||
memCmpFn_t memCmpFn;
|
||||
|
||||
if ((reqlength == 0) || (value1Ptr == value2Ptr)) {
|
||||
@@ -3496,10 +3498,10 @@ TclStringCmp(
|
||||
} else if (TclHasInternalRep(value1Ptr, &tclStringType)
|
||||
&& TclHasInternalRep(value2Ptr, &tclStringType)) {
|
||||
/*
|
||||
* Do a unicode-specific comparison if both of the args are of
|
||||
* String type. If the char length == byte length, we can do a
|
||||
* memcmp. In benchmark testing this proved the most efficient
|
||||
* check between the unicode and string comparison operations.
|
||||
* Do a Unicode-specific comparison if both of the args are of String
|
||||
* type. If the char length == byte length, we can do a memcmp. In
|
||||
* benchmark testing this proved the most efficient check between the
|
||||
* Unicode and string comparison operations.
|
||||
*/
|
||||
|
||||
if (nocase) {
|
||||
@@ -3513,6 +3515,9 @@ TclStringCmp(
|
||||
&& (value1Ptr->bytes != NULL)
|
||||
&& (s2len == value2Ptr->length)
|
||||
&& (value2Ptr->bytes != NULL)) {
|
||||
/* each byte represents one character so s1l3n, s2l3n, and
|
||||
* reqlength are in both bytes and characters
|
||||
*/
|
||||
s1 = value1Ptr->bytes;
|
||||
s2 = value2Ptr->bytes;
|
||||
memCmpFn = memcmp;
|
||||
@@ -3529,6 +3534,9 @@ TclStringCmp(
|
||||
memCmpFn = memcmp;
|
||||
s1len *= sizeof(Tcl_UniChar);
|
||||
s2len *= sizeof(Tcl_UniChar);
|
||||
if (!TCL_SIZE_ISNEG(reqlength)) {
|
||||
reqlength *= sizeof(Tcl_UniChar);
|
||||
}
|
||||
} else {
|
||||
memCmpFn = (memCmpFn_t) TclUniCharNcmp;
|
||||
}
|
||||
@@ -3570,7 +3578,7 @@ TclStringCmp(
|
||||
s1 = Tcl_GetStringFromObj(value1Ptr, &s1len);
|
||||
s2 = Tcl_GetStringFromObj(value2Ptr, &s2len);
|
||||
}
|
||||
if (!nocase && checkEq) {
|
||||
if (!nocase && checkEq && TCL_SIZE_ISNEG(reqlength)) {
|
||||
/*
|
||||
* When we have equal-length we can check only for
|
||||
* (in)equality. We can use memcmp in all (n)eq cases because
|
||||
@@ -3587,7 +3595,7 @@ TclStringCmp(
|
||||
* length was requested.
|
||||
*/
|
||||
|
||||
if ((reqlength == TCL_INDEX_NONE) && !nocase) {
|
||||
if (TCL_SIZE_ISNEG(reqlength) && !nocase) {
|
||||
memCmpFn = (memCmpFn_t) TclpUtfNcmp2;
|
||||
} else {
|
||||
s1len = Tcl_NumUtfChars(s1, s1len);
|
||||
@@ -3598,11 +3606,15 @@ TclStringCmp(
|
||||
}
|
||||
}
|
||||
|
||||
/* At this point s1len, s2len, and reqlength should by now have been
|
||||
* adjusted so that they are all in the units expected by the selected
|
||||
* comparison function.
|
||||
*/
|
||||
length = (s1len < s2len) ? s1len : s2len;
|
||||
if (reqlength == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(reqlength)) {
|
||||
/*
|
||||
* The requested length is negative, so we ignore it by setting it
|
||||
* to length + 1 so we correct the match var.
|
||||
* The requested length is negative, so ignore it by setting it
|
||||
* to length + 1 to correct the match var.
|
||||
*/
|
||||
|
||||
reqlength = length + 1;
|
||||
@@ -3610,7 +3622,7 @@ TclStringCmp(
|
||||
length = reqlength;
|
||||
}
|
||||
|
||||
if (checkEq && (s1len != s2len)) {
|
||||
if (checkEq && TCL_SIZE_ISNEG(reqlength) && (s1len != s2len)) {
|
||||
match = 1; /* This will be reversed below. */
|
||||
} else {
|
||||
/*
|
||||
@@ -3658,7 +3670,7 @@ TclStringFirst(
|
||||
Tcl_UniChar *checkStr, *endStr, *uh, *un;
|
||||
Tcl_Obj *obj;
|
||||
|
||||
if (start == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(start)) {
|
||||
start = 0;
|
||||
}
|
||||
if (ln == 0) {
|
||||
@@ -3884,7 +3896,7 @@ TclStringReverse(
|
||||
if (!inPlace || Tcl_IsShared(objPtr)) {
|
||||
objPtr = Tcl_NewByteArrayObj(NULL, numBytes);
|
||||
}
|
||||
ReverseBytes(Tcl_GetBytesFromObj(NULL, objPtr, (size_t *)NULL), from, numBytes);
|
||||
ReverseBytes(Tcl_GetByteArrayFromObj(objPtr, (size_t *)NULL), from, numBytes);
|
||||
return objPtr;
|
||||
}
|
||||
|
||||
@@ -3969,7 +3981,7 @@ TclStringReverse(
|
||||
}
|
||||
to = objPtr->bytes;
|
||||
|
||||
if ((numChars == TCL_INDEX_NONE) || (numChars < numBytes)) {
|
||||
if (TCL_SIZE_ISNEG(numChars) || (numChars < numBytes)) {
|
||||
/*
|
||||
* Either numChars == -1 and we don't know how many chars are
|
||||
* represented by objPtr->bytes and we need Pass 1 just in case,
|
||||
@@ -4154,7 +4166,7 @@ TclStringReplace(
|
||||
* FillUnicodeRep --
|
||||
*
|
||||
* Populate the Unicode internal rep with the Unicode form of its string
|
||||
* rep. The object must alread have a "String" internal rep.
|
||||
* rep. The object must already have a "String" internal rep.
|
||||
*
|
||||
* Results:
|
||||
* None.
|
||||
@@ -4190,7 +4202,7 @@ ExtendUnicodeRepWithString(
|
||||
if (stringPtr->hasUnicode) {
|
||||
numOrigChars = stringPtr->numChars;
|
||||
}
|
||||
if (numAppendChars == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(numAppendChars)) {
|
||||
TclNumUtfCharsM(numAppendChars, bytes, numBytes);
|
||||
}
|
||||
needed = numOrigChars + numAppendChars;
|
||||
@@ -4246,7 +4258,7 @@ DupStringInternalRep(
|
||||
String *srcStringPtr = GET_STRING(srcPtr);
|
||||
String *copyStringPtr = NULL;
|
||||
|
||||
if (srcStringPtr->numChars == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(srcStringPtr->numChars)) {
|
||||
/*
|
||||
* The String struct in the source value holds zero useful data. Don't
|
||||
* bother copying it. Don't even bother allocating space in which to
|
||||
@@ -4304,7 +4316,7 @@ DupStringInternalRep(
|
||||
* This operation always succeeds and returns TCL_OK.
|
||||
*
|
||||
* Side effects:
|
||||
* Any old internal reputation for objPtr is freed and the internal
|
||||
* Any old internal representation for objPtr is freed and the internal
|
||||
* representation is set to "String".
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
@@ -4396,7 +4408,7 @@ ExtendStringRepWithUnicode(
|
||||
char *dst;
|
||||
String *stringPtr = GET_STRING(objPtr);
|
||||
|
||||
if (numChars == TCL_INDEX_NONE) {
|
||||
if (TCL_SIZE_ISNEG(numChars)) {
|
||||
numChars = UnicodeLength(unicode);
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user