Compare commits
657
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
096bdb007c | ||
|
|
04e4a08b83 | ||
|
|
b43e1945fc | ||
|
|
9f3531705c | ||
|
|
d89904d2fe | ||
|
|
903d99d98c | ||
|
|
e53d976912 | ||
|
|
a95df9aeee | ||
|
|
e56dc6b442 | ||
|
|
5fd55c4784 | ||
|
|
6b063a0c78 | ||
|
|
84614e26f6 | ||
|
|
214ccdbc63 | ||
|
|
e7767adf6f | ||
|
|
b90b689b35 | ||
|
|
48f68bff42 | ||
|
|
a16f662aff | ||
|
|
55ad0d7ce0 | ||
|
|
b94257a318 | ||
|
|
4e79189313 | ||
|
|
27007e636c | ||
|
|
5540608440 | ||
|
|
b85307c4ca | ||
|
|
92307fa0a8 | ||
|
|
5b695f9faf | ||
|
|
d20730a7e2 | ||
|
|
24d95c6e7f | ||
|
|
dc83a349ff | ||
|
|
02a84d8fda | ||
|
|
21680d883e | ||
|
|
9983852639 | ||
|
|
263a29e075 | ||
|
|
aba1d3498c | ||
|
|
fc9b5aa28e | ||
|
|
a81e5e2956 | ||
|
|
21e1f40a96 | ||
|
|
795a655275 | ||
|
|
2df49e35c4 | ||
|
|
dd5c862b1b | ||
|
|
0fb0b2b219 | ||
|
|
b699a2d08f | ||
|
|
bfe1df3fa4 | ||
|
|
c3caf61e45 | ||
|
|
d70cd653ee | ||
|
|
335fba1338 | ||
|
|
2c22059268 | ||
|
|
b42fa07ab6 | ||
|
|
8511c33e42 | ||
|
|
06a18b0e9a | ||
|
|
ce8470209a | ||
|
|
05ff84c991 | ||
|
|
df7731011b | ||
|
|
3866ff7895 | ||
|
|
bcde544d5b | ||
|
|
e5fad829c3 | ||
|
|
99bada9fae | ||
|
|
6dc80abf9c | ||
|
|
0be9400a12 | ||
|
|
15dc2f5fe1 | ||
|
|
91a4999ebd | ||
|
|
7b6801dda4 | ||
|
|
ab986365be | ||
|
|
ce5ee0bcd0 | ||
|
|
d9edbc9ea3 | ||
|
|
6f8b82987c | ||
|
|
b241819850 | ||
|
|
2985062b7f | ||
|
|
5512c94971 | ||
|
|
9bb8a823db | ||
|
|
8c7b538ecc | ||
|
|
dc0ef54205 | ||
|
|
06dbabf770 | ||
|
|
f88734a0a5 | ||
|
|
58cce746c4 | ||
|
|
ea312e48ab | ||
|
|
a17e21b023 | ||
|
|
434372f43c | ||
|
|
09ccab6c3d | ||
|
|
09eca925a6 | ||
|
|
a7d25a2f49 | ||
|
|
c064fad168 | ||
|
|
cb6bc60a7f | ||
|
|
6b236aed06 | ||
|
|
e544180383 | ||
|
|
d7b9f29472 | ||
|
|
0f35a9c920 | ||
|
|
c9488b2e72 | ||
|
|
b809cd859c | ||
|
|
1f27464d24 | ||
|
|
d170c6a3a4 | ||
|
|
cd8fa47b72 | ||
|
|
9556d5cb0d | ||
|
|
b4e29b2a99 | ||
|
|
75162e376b | ||
|
|
e746df15a0 | ||
|
|
98c250e7f3 | ||
|
|
3973955a76 | ||
|
|
9bfe9b97e5 | ||
|
|
58dec8bcee | ||
|
|
07ebc93d28 | ||
|
|
23675524fd | ||
|
|
5743dc9687 | ||
|
|
f5a0c6d5d7 | ||
|
|
41f56f6b2b | ||
|
|
55be69aedd | ||
|
|
5866c1f6c8 | ||
|
|
6d05b4e211 | ||
|
|
d69b91894e | ||
|
|
a8ea50d0f0 | ||
|
|
fd5b78904b | ||
|
|
85f2366b39 | ||
|
|
2c18ebbfae | ||
|
|
173d5812bc | ||
|
|
031ca23f9a | ||
|
|
38c0daa01e | ||
|
|
edb2875a4b | ||
|
|
173a426a19 | ||
|
|
0e6ecb6cd9 | ||
|
|
5dac4c8ab7 | ||
|
|
c3d6834a5f | ||
|
|
414dcc479b | ||
|
|
668cdd0983 | ||
|
|
e81b27973b | ||
|
|
7e50a3b43d | ||
|
|
6e253c4205 | ||
|
|
46727719f8 | ||
|
|
9be9550cad | ||
|
|
39752108bc | ||
|
|
dd86ab5f0f | ||
|
|
0c8a5a0489 | ||
|
|
abd4f60628 | ||
|
|
314f2bc995 | ||
|
|
3fb79799c1 | ||
|
|
5a0fefe316 | ||
|
|
d094f7c8e4 | ||
|
|
913b6d7f3c | ||
|
|
558c4c1144 | ||
|
|
4d1048e842 | ||
|
|
7255f92284 | ||
|
|
be321752e8 | ||
|
|
95b46f40ce | ||
|
|
0801a0a39a | ||
|
|
8ec4df9b39 | ||
|
|
9eb417e98d | ||
|
|
bb2cb2f8ea | ||
|
|
dc1149897c | ||
|
|
808682d0b9 | ||
|
|
a2bcc98818 | ||
|
|
44be4619d7 | ||
|
|
fe77b86480 | ||
|
|
888bd3175d | ||
|
|
4e0d4d59d3 | ||
|
|
c04af44110 | ||
|
|
ca9772b219 | ||
|
|
bb07bcc2ab | ||
|
|
5fb5270115 | ||
|
|
bb07849aff | ||
|
|
c02de111d5 | ||
|
|
d51dd80d79 | ||
|
|
9d1d0ad093 | ||
|
|
d276140025 | ||
|
|
8ab493d9b6 | ||
|
|
37bd184f2a | ||
|
|
738cbe6357 | ||
|
|
a304477e34 | ||
|
|
eb05ff855e | ||
|
|
5f7722e673 | ||
|
|
9c307c03e0 | ||
|
|
eadce1bc36 | ||
|
|
4b4a6073b3 | ||
|
|
1f5d8f8b59 | ||
|
|
bbdd2c7000 | ||
|
|
8a18bce67a | ||
|
|
f0beac9fce | ||
|
|
5a85e4a8c2 | ||
|
|
4da1099856 | ||
|
|
103db9d156 | ||
|
|
1fe7dbfbf1 | ||
|
|
47f0a7470c | ||
|
|
01bfb63675 | ||
|
|
fd3a530dcf | ||
|
|
899eb10624 | ||
|
|
486b795f9b | ||
|
|
6f21c9534f | ||
|
|
084e2d8ac4 | ||
|
|
68bd24b417 | ||
|
|
52112d6c37 | ||
|
|
7b4f454bcc | ||
|
|
43531ca027 | ||
|
|
d0a6ccf035 | ||
|
|
cf73e089f3 | ||
|
|
f8dd6c6fed | ||
|
|
483904a250 | ||
|
|
725112bbb1 | ||
|
|
3dda6e3d27 | ||
|
|
b5ff2e7c90 | ||
|
|
888b34cce0 | ||
|
|
acb8c6e3dc | ||
|
|
4ad500f523 | ||
|
|
d94c5745b0 | ||
|
|
1411007962 | ||
|
|
396bc72017 | ||
|
|
35019ed827 | ||
|
|
e1d066aad0 | ||
|
|
a277057794 | ||
|
|
9aada55885 | ||
|
|
270f5a6783 | ||
|
|
4bfe47dedb | ||
|
|
550a91e670 | ||
|
|
b9ab93b943 | ||
|
|
4434e84a99 | ||
|
|
cfb01735e8 | ||
|
|
601b787c14 | ||
|
|
eeace491a2 | ||
|
|
24b419fd5a | ||
|
|
67c2c9592f | ||
|
|
aa0969923c | ||
|
|
7936046685 | ||
|
|
462d5db13c | ||
|
|
29dd4281a9 | ||
|
|
604a5267ce | ||
|
|
8c8aa6827d | ||
|
|
5dbdfc48c0 | ||
|
|
92335538e0 | ||
|
|
a3322d8d74 | ||
|
|
18343a0b05 | ||
|
|
2d3601fdfe | ||
|
|
9b2263fc36 | ||
|
|
6b6d4fd3d8 | ||
|
|
3caa166541 | ||
|
|
160f99ff67 | ||
|
|
216564bc15 | ||
|
|
0fcfd1fd93 | ||
|
|
4e32ce17c7 | ||
|
|
79d1ebdf2e | ||
|
|
f8fc868b27 | ||
|
|
bbb328cf41 | ||
|
|
bba1700dd1 | ||
|
|
37de7db00b | ||
|
|
c95383dec9 | ||
|
|
b3923c05aa | ||
|
|
49866499aa | ||
|
|
4dcc8a7e36 | ||
|
|
045ab17905 | ||
|
|
cddd64df98 | ||
|
|
7b1cfa5b69 | ||
|
|
34a4813f20 | ||
|
|
f61a583807 | ||
|
|
4ed7a9f454 | ||
|
|
1f01feceee | ||
|
|
79165f2443 | ||
|
|
160edc816a | ||
|
|
08e51582df | ||
|
|
7e0465203b | ||
|
|
9117b3d83f | ||
|
|
a261777400 | ||
|
|
80df571355 | ||
|
|
5638d340d6 | ||
|
|
499e12375e | ||
|
|
922979cadf | ||
|
|
51d6bc3bda | ||
|
|
d72083b6aa | ||
|
|
645396c6ad | ||
|
|
4408b39e81 | ||
|
|
e399121e9a | ||
|
|
45428e8d0b | ||
|
|
bf5538c6b2 | ||
|
|
a297a2c3cf | ||
|
|
038eac6721 | ||
|
|
ddde341843 | ||
|
|
f57b75f595 | ||
|
|
b58f9ecf62 | ||
|
|
c367f4009c | ||
|
|
52aab10382 | ||
|
|
da12f8810c | ||
|
|
dd137f2600 | ||
|
|
c9c76c1326 | ||
|
|
25e8d995cd | ||
|
|
f1d084814c | ||
|
|
70e68a56fd | ||
|
|
4598d2596c | ||
|
|
9cb7f17b50 | ||
|
|
c1390f9aac | ||
|
|
c351683fd3 | ||
|
|
b51b2a7350 | ||
|
|
baa6844a34 | ||
|
|
c5d1f1bbc6 | ||
|
|
4626ed6db1 | ||
|
|
af2e80b713 | ||
|
|
f9e7dc7aa1 | ||
|
|
c2d38e038a | ||
|
|
817ad4d5d0 | ||
|
|
f33d3f436d | ||
|
|
23253d52f8 | ||
|
|
2b7717982b | ||
|
|
abbb852d2c | ||
|
|
181a4d55a9 | ||
|
|
811378c6aa | ||
|
|
8f936d115e | ||
|
|
c71932b861 | ||
|
|
c9489171de | ||
|
|
3edb8e7287 | ||
|
|
f9674d607f | ||
|
|
bba05de4a7 | ||
|
|
60a713d196 | ||
|
|
0e8f960484 | ||
|
|
fae8c4cf1b | ||
|
|
39bfe688ce | ||
|
|
bf8aaf69e7 | ||
|
|
e405e32422 | ||
|
|
045557c267 | ||
|
|
1d4da5ab41 | ||
|
|
a08b8003b4 | ||
|
|
6bd64bfe5c | ||
|
|
842dfb0409 | ||
|
|
fbdc0a69c1 | ||
|
|
224961e3b6 | ||
|
|
b2b0138367 | ||
|
|
7b483fc029 | ||
|
|
eb1b9815d7 | ||
|
|
e26829c946 | ||
|
|
3bea22bfe8 | ||
|
|
4e11275992 | ||
|
|
a1676fe1f6 | ||
|
|
3b4ae95368 | ||
|
|
64c3639253 | ||
|
|
1987873e55 | ||
|
|
5d5d097b0a | ||
|
|
8cfc10ebc9 | ||
|
|
0cb7090ca5 | ||
|
|
3764e1a41f | ||
|
|
e46adc9abe | ||
|
|
3fd8e421d9 | ||
|
|
ec13073c29 | ||
|
|
0a9608403a | ||
|
|
f003884af5 | ||
|
|
e840a769c0 | ||
|
|
a22f0a69ed | ||
|
|
a312d4ddc5 | ||
|
|
b39e403b35 | ||
|
|
e224fa38b4 | ||
|
|
d75418d570 | ||
|
|
c8f732ea1b | ||
|
|
3eb87289db | ||
|
|
749ad3ca05 | ||
|
|
eec6ca45f4 | ||
|
|
7f39be055a | ||
|
|
27d5eee770 | ||
|
|
9f93cdc630 | ||
|
|
59f17881a1 | ||
|
|
646c6531f7 | ||
|
|
b7c56072ad | ||
|
|
a4b2eac048 | ||
|
|
7a6855255d | ||
|
|
2909037c6e | ||
|
|
cb843b3c8c | ||
|
|
a3d42cee87 | ||
|
|
e5575744fb | ||
|
|
7166bac2bb | ||
|
|
8b9f9d99fc | ||
|
|
878e2ec5c0 | ||
|
|
e6ce0c2879 | ||
|
|
7e1f59fefa | ||
|
|
e8c0596e2b | ||
|
|
c54d039019 | ||
|
|
47ad992c31 | ||
|
|
8b80e1d943 | ||
|
|
36f030ea0b | ||
|
|
3dd87a3eae | ||
|
|
7cf2992523 | ||
|
|
e6cf4a91c8 | ||
|
|
353d78650b | ||
|
|
aa2e9b0734 | ||
|
|
b25033c093 | ||
|
|
bd2bc30009 | ||
|
|
32c4f04394 | ||
|
|
055f36028a | ||
|
|
e94fb30f90 | ||
|
|
8eb38e1e0d | ||
|
|
a3c3f803d2 | ||
|
|
961233d1bf | ||
|
|
54136d25d0 | ||
|
|
9803c5d84e | ||
|
|
3e8be918cd | ||
|
|
c3e2f4c937 | ||
|
|
e21981b112 | ||
|
|
219279de92 | ||
|
|
c8fad65dd6 | ||
|
|
61c8ce5b04 | ||
|
|
16aaea75d6 | ||
|
|
e383fa566d | ||
|
|
7a1cb1faf2 | ||
|
|
63bbb50d0f | ||
|
|
6c228155c2 | ||
|
|
cb45f3874a | ||
|
|
9d74783887 | ||
|
|
3d797b72ce | ||
|
|
25cd27c5f9 | ||
|
|
78d200433f | ||
|
|
8b34c1a36c | ||
|
|
e24f97b843 | ||
|
|
c35a772d5d | ||
|
|
7e2e92ddd5 | ||
|
|
efbd8da8eb | ||
|
|
8d959b904e | ||
|
|
aecc096eaf | ||
|
|
34923aad0c | ||
|
|
9c0ece4de0 | ||
|
|
fa2f6c6b6c | ||
|
|
97a4df8c73 | ||
|
|
4fb31abfc4 | ||
|
|
a55a11906e | ||
|
|
986b19c86a | ||
|
|
8153c00e31 | ||
|
|
f59f546538 | ||
|
|
e328ea198c | ||
|
|
19e94892e0 | ||
|
|
7f7d0467ab | ||
|
|
1afe0492b4 | ||
|
|
38990bc97e | ||
|
|
f7fffd7237 | ||
|
|
c50eaa4b0a | ||
|
|
569ac18cfc | ||
|
|
23d6e7ce95 | ||
|
|
59439f2638 | ||
|
|
7920d0c42d | ||
|
|
705fd25081 | ||
|
|
2e5e60c430 | ||
|
|
5e88bf4986 | ||
|
|
5ffbb345ba | ||
|
|
2fad98690c | ||
|
|
4886012f52 | ||
|
|
6df4497ef8 | ||
|
|
977b895d47 | ||
|
|
bbbb871980 | ||
|
|
d8d0ab5c6c | ||
|
|
10d426a8df | ||
|
|
427c1a2475 | ||
|
|
140e47e30d | ||
|
|
f4324ec6f3 | ||
|
|
97c05038f1 | ||
|
|
5f972cafbd | ||
|
|
d7b7046db2 | ||
|
|
c7678dac95 | ||
|
|
d4ecd0d697 | ||
|
|
1bd5af9ec7 | ||
|
|
535ac7d037 | ||
|
|
62907b8662 | ||
|
|
7e395e56cc | ||
|
|
e81ec76796 | ||
|
|
1d915dcdb9 | ||
|
|
d72857f7bc | ||
|
|
e0c0f375ee | ||
|
|
a6b3510264 | ||
|
|
1ce5be853c | ||
|
|
6fe4ca16e3 | ||
|
|
cb7d69bd7a | ||
|
|
9900c863e9 | ||
|
|
f1841d637e | ||
|
|
1c918c6558 | ||
|
|
e3d9addf08 | ||
|
|
060ce9e1df | ||
|
|
37430650c7 | ||
|
|
eff01f04b4 | ||
|
|
2433276755 | ||
|
|
2fdbc57b29 | ||
|
|
2c6c84f5ec | ||
|
|
5a2f6b51c2 | ||
|
|
3d82d4b04e | ||
|
|
b99c89e7cd | ||
|
|
f6d1057bc1 | ||
|
|
c86b8f0598 | ||
|
|
81bcc44005 | ||
|
|
c4a863d303 | ||
|
|
a092f8bf5c | ||
|
|
2bd6f328b3 | ||
|
|
32001dc2d5 | ||
|
|
40d7838daa | ||
|
|
078e78572f | ||
|
|
be3a14b3ae | ||
|
|
34072f27e3 | ||
|
|
46207a3404 | ||
|
|
091aed9b44 | ||
|
|
778d4d485c | ||
|
|
8373c448b2 | ||
|
|
c60ff7c67b | ||
|
|
35abedb75b | ||
|
|
5c1b3920a9 | ||
|
|
0b40de9632 | ||
|
|
8008686fcf | ||
|
|
2a0bf91c8e | ||
|
|
ee1404b900 | ||
|
|
dded0b6fee | ||
|
|
d71b04e853 | ||
|
|
65ab3a7a43 | ||
|
|
4e2c8b8502 | ||
|
|
e2fb9a2c2d | ||
|
|
7165b4ee62 | ||
|
|
2646ac67ca | ||
|
|
34016856e9 | ||
|
|
2d164515fb | ||
|
|
64743ec374 | ||
|
|
e6e8236a18 | ||
|
|
e47abb41b4 | ||
|
|
06b4f6325f | ||
|
|
587add1342 | ||
|
|
e95344d288 | ||
|
|
33bb71db85 | ||
|
|
5e102e2169 | ||
|
|
d851fe1055 | ||
|
|
98c801cf7d | ||
|
|
fd4b42019a | ||
|
|
82d1373a50 | ||
|
|
c11b9c40be | ||
|
|
5591ffe45b | ||
|
|
6cf50a9a1e | ||
|
|
130ad34339 | ||
|
|
cda1e32fe2 | ||
|
|
e6a208d52e | ||
|
|
f55c0c81b1 | ||
|
|
f9b06e55e4 | ||
|
|
53450ff282 | ||
|
|
7255484343 | ||
|
|
889eae38ab | ||
|
|
05c2702c68 | ||
|
|
b3a66db1b4 | ||
|
|
4f20ba2206 | ||
|
|
299297e8d3 | ||
|
|
5161ec3c71 | ||
|
|
b593cd6f66 | ||
|
|
5f0bb1af5c | ||
|
|
ce6af05487 | ||
|
|
13e1b59af5 | ||
|
|
c32b5a7274 | ||
|
|
5744713167 | ||
|
|
e01f2fdd89 | ||
|
|
7c0ef33b23 | ||
|
|
ca3c6da4dd | ||
|
|
e335d34357 | ||
|
|
5fdb735dde | ||
|
|
8dbddcbec0 | ||
|
|
4a2c1f7441 | ||
|
|
d7b76b5c91 | ||
|
|
dde32ee5aa | ||
|
|
f15033c5dd | ||
|
|
cef495763e | ||
|
|
1ad604bcbe | ||
|
|
9d3a432631 | ||
|
|
53b6569f4a | ||
|
|
e1d146e4c9 | ||
|
|
27a050c727 | ||
|
|
595ac97f37 | ||
|
|
47b758fa50 | ||
|
|
afc494390f | ||
|
|
381a18837e | ||
|
|
5fe5ad497b | ||
|
|
7a34b9758d | ||
|
|
7cd1f95dff | ||
|
|
d07f2367e5 | ||
|
|
0a7f80e4bc | ||
|
|
8736241841 | ||
|
|
0d2ffb1ea7 | ||
|
|
95c73abd20 | ||
|
|
8c902f559c | ||
|
|
bfa50867f7 | ||
|
|
44fbf6e9de | ||
|
|
c7f70ba9aa | ||
|
|
986984210d | ||
|
|
c100a997e8 | ||
|
|
9373f24f80 | ||
|
|
0d93399127 | ||
|
|
c505d87cb0 | ||
|
|
ec8855a10b | ||
|
|
6d270f2533 | ||
|
|
518268c7f6 | ||
|
|
b1e00491cf | ||
|
|
aaf5bcb043 | ||
|
|
03fab894a0 | ||
|
|
da87c00e5a | ||
|
|
7135e1109c | ||
|
|
bc8d116914 | ||
|
|
e3bc7a0dc9 | ||
|
|
31dd4f4dde | ||
|
|
199d60e691 | ||
|
|
b4a8e96ef3 | ||
|
|
9da038eb4a | ||
|
|
b509bb3fb3 | ||
|
|
8a1c2d84b5 | ||
|
|
61b19c386b | ||
|
|
1462a54867 | ||
|
|
14d10154ce | ||
|
|
6a2fb4641d | ||
|
|
8af55ad2c4 | ||
|
|
ed9a3dc52f | ||
|
|
8b1a146532 | ||
|
|
cac884046b | ||
|
|
a62d4c0961 | ||
|
|
4c8147f3ed | ||
|
|
1d6096986d | ||
|
|
41e317089d | ||
|
|
f2d155da26 | ||
|
|
269aac423c | ||
|
|
4608658cf8 | ||
|
|
ac947d3cf3 | ||
|
|
a77eb843bd | ||
|
|
bea6a51ba7 | ||
|
|
e72b7842e0 | ||
|
|
c4940b3a03 | ||
|
|
b51345a4ed | ||
|
|
6ae5c8aa23 | ||
|
|
56f5c97345 | ||
|
|
b2aa48b08d | ||
|
|
6af3bbdb48 | ||
|
|
c48c8e6b84 | ||
|
|
1652f9484a | ||
|
|
0fb115135e | ||
|
|
743cedb837 | ||
|
|
836dbb11bd | ||
|
|
1819debd34 | ||
|
|
b8db45bc4b | ||
|
|
e29a6b5ee1 | ||
|
|
d6decf26d6 | ||
|
|
209501f25e | ||
|
|
c89c7d0c8d | ||
|
|
b443cf382a | ||
|
|
1055cb934c | ||
|
|
36eb632717 | ||
|
|
7cc98243bf | ||
|
|
7d93c7c51f | ||
|
|
6b326f6e30 | ||
|
|
91ae7925a7 | ||
|
|
1a428b80c2 | ||
|
|
68d740f320 | ||
|
|
43358037e9 | ||
|
|
3273e0a6d6 | ||
|
|
e7c0689f5c | ||
|
|
19ce746b8a | ||
|
|
e55ccca7b1 | ||
|
|
6b6e7c2e1f | ||
|
|
ecb0725970 | ||
|
|
2d08017bdc | ||
|
|
84e694ead5 | ||
|
|
281e3a02ea | ||
|
|
51942f39f5 | ||
|
|
2de227b470 | ||
|
|
511c536af3 | ||
|
|
acb1e35f75 | ||
|
|
2ec73f5cfc | ||
|
|
6f0e01d90a | ||
|
|
8ec9047eaf | ||
|
|
c367d0f59e | ||
|
|
3894865e35 | ||
|
|
465bdaec96 | ||
|
|
f22ee68af2 | ||
|
|
3f275e76b3 | ||
|
|
4019544a72 | ||
|
|
2e378d1fc1 |
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"problemMatcher": [
|
||||
{
|
||||
"owner": "tcltest",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^==== ([-\\w]+) (.+) (FAILED)$",
|
||||
"severity": 3,
|
||||
"message": 2,
|
||||
"code": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -85,7 +85,9 @@ jobs:
|
||||
make runtest SCRIPT=../.github/workflows/info.tcl || echo 'get info failed'
|
||||
- name: Run Tests
|
||||
run: |
|
||||
echo "::add-matcher::.github/tcltest.json"
|
||||
make test
|
||||
echo "::remove-matcher::.github/tcltest.json"
|
||||
env:
|
||||
ERROR_ON_FAILURES: 1
|
||||
timeout-minutes: 30
|
||||
|
||||
@@ -38,7 +38,7 @@ jobs:
|
||||
"--enable-symbols=all"
|
||||
]
|
||||
xcode:
|
||||
runs-on: macos-15
|
||||
runs-on: macos-26
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
@@ -57,13 +57,15 @@ jobs:
|
||||
CFLAGS: -arch x86_64 -arch arm64
|
||||
timeout-minutes: 15
|
||||
- name: Run Tests
|
||||
run: make -j4 test styles=develop
|
||||
run: |
|
||||
echo "::add-matcher::.github/tcltest.json"
|
||||
make -j4 test styles=develop
|
||||
env:
|
||||
ERROR_ON_FAILURES: 1
|
||||
MAC_CI: 1
|
||||
timeout-minutes: 15
|
||||
clang:
|
||||
runs-on: macos-15
|
||||
runs-on: macos-26
|
||||
needs: plan
|
||||
strategy:
|
||||
matrix: ${{ fromJson(needs.plan.outputs.clang) }}
|
||||
@@ -99,6 +101,7 @@ jobs:
|
||||
make runtest SCRIPT=../.github/workflows/info.tcl || echo 'get info failed'
|
||||
- name: Run Tests
|
||||
run: |
|
||||
echo "::add-matcher::.github/tcltest.json"
|
||||
make test
|
||||
env:
|
||||
ERROR_ON_FAILURES: 1
|
||||
|
||||
@@ -88,6 +88,7 @@ jobs:
|
||||
timeout-minutes: 5
|
||||
- name: Run Tests ${{ matrix.config }}
|
||||
run: |
|
||||
Write-Output "::add-matcher::.github/tcltest.json"
|
||||
&nmake -f makefile.vc ${{ matrix.config }} test
|
||||
if ($lastexitcode -ne 0) {
|
||||
throw "nmake exit code: $lastexitcode"
|
||||
@@ -136,7 +137,9 @@ jobs:
|
||||
ulimit -a || echo 'get limit failed'
|
||||
make runtest SCRIPT=../.github/workflows/info.tcl || echo 'get info failed'
|
||||
- name: Run Tests
|
||||
run: make test
|
||||
run: |
|
||||
echo "::add-matcher::.github/tcltest.json"
|
||||
make test
|
||||
timeout-minutes: 30
|
||||
env:
|
||||
ERROR_ON_FAILURES: 1
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>tcl9.0</name>
|
||||
<name>tcl9.1</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# README: Tcl
|
||||
|
||||
This is the **Tcl 9.0.4** source distribution.
|
||||
This is the **Tcl 9.1a1** source distribution.
|
||||
|
||||
You can get any source release of Tcl from [our distribution
|
||||
site](https://sourceforge.net/projects/tcl/files/Tcl/).
|
||||
@@ -51,7 +51,7 @@ and selling it either in whole or in part. See the file
|
||||
## <a id="doc">2.</a> Documentation
|
||||
Extensive documentation is available on our website.
|
||||
The home page for this release, including new features, is
|
||||
[here](https://www.tcl-lang.org/software/tcltk/9.0.html).
|
||||
[here](https://www.tcl-lang.org/software/tcltk/9.1.html).
|
||||
Detailed release notes can be found at the
|
||||
[file distributions page](https://sourceforge.net/projects/tcl/files/Tcl/)
|
||||
by clicking on the relevant version.
|
||||
@@ -61,8 +61,8 @@ Xchange](https://www.tcl-lang.org/about/).
|
||||
There have been many Tcl books on the market. Many are mentioned in
|
||||
[the Wiki](https://wiki.tcl-lang.org/_/ref?N=25206).
|
||||
|
||||
The complete set of reference manual entries for Tcl 9.0 is [online,
|
||||
here](https://www.tcl-lang.org/man/tcl9.0/).
|
||||
The complete set of reference manual entries for Tcl 9.1 is [online,
|
||||
here](https://www.tcl-lang.org/man/tcl9.1/).
|
||||
|
||||
### <a id="doc.unix">2a.</a> Unix Documentation
|
||||
The `doc` subdirectory in this release contains a complete set of
|
||||
|
||||
+24
-257
@@ -4,273 +4,40 @@ changes to the Tcl source code at
|
||||
|
||||
> [Tcl Source Code](https://core.tcl-lang.org/tcl/timeline)
|
||||
|
||||
Release Tcl 9.0.4 arises from the check-in with tag `core-9-0-4`.
|
||||
Release Tcl 9.1a1 arises from the check-in with tag `core-9-1-a1`.
|
||||
|
||||
Tcl patch releases have the primary purpose of delivering bug fixes
|
||||
to the userbase.
|
||||
|
||||
# Bug fixes
|
||||
- [unsupported commands should not be available in safe interpreters](https://core.tcl-lang.org/tcl/tktview/82d12c)
|
||||
- [Check for -municode doesn't work on WSL](https://core.tcl-lang.org/tcl/tktview/632710)
|
||||
- [configure --enable-man-compression error](https://core.tcl-lang.org/tcl/tktview/886549)
|
||||
|
||||
# Updated bundled packages, libraries, standards, data
|
||||
- Itcl 4.3.6
|
||||
- sqlite3 3.51.1
|
||||
- tzdata 2025c
|
||||
|
||||
Release Tcl 9.0.3 arises from the check-in with tag `core-9-0-3`.
|
||||
|
||||
Tcl patch releases have the primary purpose of delivering bug fixes
|
||||
to the userbase.
|
||||
|
||||
# Bug fixes
|
||||
- [On Unix, IsTimeNative() always defined but not always used](https://core.tcl-lang.org/tcl/tktview/6b8e39)
|
||||
- [Tweak install permissions](https://core.tcl-lang.org/tcl/tktview/31d4fa)
|
||||
- [interp creation resets encoding directory search path](https://core.tcl-lang.org/tcl/tktview/87b697)
|
||||
- [Pointer arithmetic with NULL in buildInfoObjCmd()](https://core.tcl-lang.org/tcl/tktview/85fc8b)
|
||||
- [TclPushVarName(): pointer overflow](https://core.tcl-lang.org/tcl/tktview/77059c)
|
||||
- [Add IWYU export pragma annotations](https://core.tcl-lang.org/tcl/tktview/c7dc59)
|
||||
- [Windows: Install man pages](https://core.tcl-lang.org/tcl/tktview/3161b7)
|
||||
- [Windows: Install pkgconfig](https://core.tcl-lang.org/tcl/tktview/1cf49a)
|
||||
- [Non-existent variables are ignored if re is {}](https://core.tcl-lang.org/tcl/tktview/cb03e5)
|
||||
- [bug in single-argument 'max' with bignums](https://core.tcl-lang.org/tcl/tktview/8dd280)
|
||||
|
||||
# Updated bundled packages, libraries, standards, data
|
||||
- Itcl 4.3.5
|
||||
- http 2.10.1
|
||||
- opt 0.4.10
|
||||
- platform 1.1.0
|
||||
- sqlite3 3.51.0
|
||||
- tcltest 2.5.10
|
||||
- Thread 3.0.4
|
||||
- TDBC\* 1.1.13
|
||||
- dde 1.4.6
|
||||
- Unicode 17.0.0
|
||||
|
||||
Release Tcl 9.0.2 arises from the check-in with tag `core-9-0-2`.
|
||||
|
||||
Tcl patch releases have the primary purpose of delivering bug fixes
|
||||
to the userbase.
|
||||
|
||||
# New commands and options
|
||||
- [New command encoding user](https://core.tcl-lang.org/tips/doc/trunk/tip/716.md)
|
||||
- [New exec option -encoding](https://core.tcl-lang.org/tips/doc/trunk/tip/716.md)
|
||||
|
||||
# Bug fixes
|
||||
- [Better error-message than "interpreter uses an incompatible stubs mechanism"](https://core.tcl-lang.org/tcl/tktview/fc3509)
|
||||
- [\[$interp eval $lambda\] after \[eval $lambda\] or vice versa fails](https://core.tcl-lang.org/tcl/tktview/67d5f7)
|
||||
- [tcl::mathfunc::isunordered inconsistency with some integer values](https://core.tcl-lang.org/tcl/tktview/98006f)
|
||||
- [test lseq hangs with -Os](https://core.tcl-lang.org/tcl/tktview/d2a3c5)
|
||||
- [exec does not handle app execution aliases on Windows](https://core.tcl-lang.org/tcl/tktview/4f0b57)
|
||||
- [auto_execok does not find several built-in cmd commands](https://core.tcl-lang.org/tcl/tktview/4e2c8b)
|
||||
- [Panic "Buffer Underflow, BUFFER_PADDING not enough"](https://core.tcl-lang.org/tcl/tktview/73bb42)
|
||||
- [MS-VS build system: pckIndex.tcl when building for 9 misses "t" for TCL 8.6 part](https://core.tcl-lang.org/tcl/tktview/a77029)
|
||||
- [clock format -locale does not look up locale children if parent locale used first](https://core.tcl-lang.org/tcl/tktview/2c0f49)
|
||||
- [Missing libtcl?.?.dll.a in Cygwin](https://core.tcl-lang.org/tcl/tktview/dcedba)
|
||||
- [tclEpollNotfy PlatformEventsControl panics if websocket disconnected](https://core.tcl-lang.org/tcl/tktview/010d8f)
|
||||
- [Tcl_InitStubs compatibility for 9.1](https://core.tcl-lang.org/tcl/tktview/fd8341)
|
||||
- [proc with more than 2**31 variables](https://core.tcl-lang.org/tcl/tktview/92aeb8)
|
||||
- [scan "long mantissa" %g](https://core.tcl-lang.org/tcl/tktview/42d14c)
|
||||
- ["encoding system": wrong result without manifest](https://core.tcl-lang.org/tcl/tktview/8ffd8c)
|
||||
- [lseq crash on out-of-range index](https://core.tcl-lang.org/tcl/tktview/7d3101)
|
||||
- [lseq crash on nested indices](https://core.tcl-lang.org/tcl/tktview/452b10)
|
||||
- [Build broken (trunk branch) tclCompExpr.c tclOOCall.c](https://core.tcl-lang.org/tcl/tktview/1dcda0)
|
||||
- [Memory allocation runaway on truncated iso2022 encoding](https://core.tcl-lang.org/tcl/tktview/7346ad)
|
||||
- [Missing include dir for extensions in non-default locations](https://core.tcl-lang.org/tcl/tktview/333512)
|
||||
- [tcl::tm::path doesn't handle tilde expand](https://core.tcl-lang.org/tcl/tktview/b87673)
|
||||
- [lseq numeric overflow](https://core.tcl-lang.org/tcl/tktview/0ee626)
|
||||
- ["return": broken ordering of nested -options](https://core.tcl-lang.org/tcl/tktview/ecf35c)
|
||||
- [Euro/Tail-sign missing from cp864 encoding](https://core.tcl-lang.org/tcl/tktview/ecafd8)
|
||||
- [use after free on TSD in Winsock](https://core.tcl-lang.org/tcl/tktview/40b181)
|
||||
- [use after free on Windows pipe handles](https://core.tcl-lang.org/tcl/tktview/7c2716)
|
||||
- [tcl::build-info not documented](https://core.tcl-lang.org/tcl/tktview/ef7042)
|
||||
- [Fix 32 bit overflow in interp limit](https://core.tcl-lang.org/tcl/tktview/9dfae3)
|
||||
|
||||
# Incompatibilities
|
||||
- [The ActiveCodePage element has been removed from the Windows executable manifest for tclsh](https://core.tcl-lang.org/tips/doc/trunk/tip/716.md)
|
||||
|
||||
# Updated bundled packages, libraries, standards, data
|
||||
- Itcl 4.3.3
|
||||
- sqlite3 3.49.1
|
||||
- Thread 3.0.2
|
||||
- TDBC\* 1.1.11
|
||||
- tzdata 2025b
|
||||
|
||||
Release Tcl 9.0.1 arises from the check-in with tag `core-9-0-1`.
|
||||
|
||||
Tcl patch releases have the primary purpose of delivering bug fixes
|
||||
to the userbase. As the first patch release in the Tcl 9.0.\* series,
|
||||
Tcl 9.0.1 also includes a small number of interface changes that complete
|
||||
some incomplete features first delivered in Tcl 9.0.0.
|
||||
|
||||
# Completed 9.0 Features and Interfaces
|
||||
- [TIP 701 - Tcl_FSTildeExpand C API](https://core.tcl-lang.org/tips/doc/trunk/tip/701.md)
|
||||
- [TIP 707 - ptrAndSize internal rep in Tcl_Obj](https://core.tcl-lang.org/tips/doc/trunk/tip/707.md)
|
||||
- [Size modifiers j, q, z, t not implemented]( https://core.tcl-lang.org/tcl/info/c4f365)
|
||||
|
||||
# Bug fixes
|
||||
- [regression in tzdata, %z instead of offset TZ-name](https://core.tcl-lang.org/tcl/tktview/2c237b)
|
||||
- [Tcl will not start properly if there is an init.tcl file in the current dir](https://core.tcl-lang.org/tcl/tktview/43c94f)
|
||||
- [clock scan "24:00", ISO-8601 compatibility](https://core.tcl-lang.org/tcl/tktview/aee9f2)
|
||||
- [Temporary folder with file "tcl9registry13.dll" remains after "exit"](https://core.tcl-lang.org/tcl/tktview/6ce3c0)
|
||||
- [Wrong result by "lsearch -stride -subindices -inline -all"](https://core.tcl-lang.org/tcl/info/5a1aaa)
|
||||
- [TIP 609 - required Tcl_ThreadAlert() skipped with nested event loop](https://core.tcl-lang.org/tcl/info/c7e4c4)
|
||||
- [buffer overwrite for non-BMP characters in utf-16](https://core.tcl-lang.org/tcl/tktview/66da4d)
|
||||
- [zipfs info on mountpoint of executable returns zero offset in field 4"](https://core.tcl-lang.org/tcl/info/aaa84f)
|
||||
- [zlib-8.8, zlib-8.16 fail on Fedora 40, gcc 14.1.1](https://core.tcl-lang.org/tcl/tktview/73d5cb)
|
||||
- [install registry and dde in $INSTALL_DIR\lib always](https://core.tcl-lang.org/tcl/tktview/364bd9)
|
||||
- [cannot build .chm help file (Windows)](https://core.tcl-lang.org/tcl/tktview/bb110c)
|
||||
|
||||
# Incompatibilities
|
||||
- No known incompatibilities with the Tcl 9.0.0 public interface.
|
||||
|
||||
# Updated bundled packages, libraries, standards, data
|
||||
- Itcl 4.3.2
|
||||
- sqlite3 3.47.2
|
||||
- Thread 3.0.1
|
||||
- TDBC\* 1.1.10
|
||||
- tcltest 2.5.9
|
||||
- tzdata 2024b, corrected
|
||||
|
||||
Release Tcl 9.0.0 arises from the check-in with tag `core-9-0-0`.
|
||||
|
||||
Highlighted differences between Tcl 9.0 and Tcl 8.6 are summarized below,
|
||||
Highlighted differences between Tcl 9.1 and Tcl 9.0 are summarized below,
|
||||
with focus on changes important to programmers using the Tcl library and
|
||||
writing Tcl scripts.
|
||||
|
||||
# Major Features
|
||||
# New commands and options
|
||||
|
||||
## 64-bit capacity: Data values larger than 2Gb
|
||||
- Strings can be any length (that fits in your available memory)
|
||||
- Lists and dictionaries can have very large numbers of elements
|
||||
- [New options -backslashes, -commands and -variables for subst command](https://core.tcl-lang.org/tips/doc/trunk/tip/712.md)
|
||||
- [New command unicode for Unicode normalization](https://core.tcl-lang.org/tips/doc/trunk/tip/726.md)
|
||||
- [New timer command, switch to monotonic clock and microsecond resolution](https://core.tcl-lang.org/tips/doc/trunk/tip/723.md)
|
||||
|
||||
## Internationalization of text
|
||||
- Full Unicode range of codepoints
|
||||
- New encodings: `utf-16`/`utf-32`/`ucs-2`(`le`|`be`), `CESU-8`, etc.
|
||||
- `encoding` options `-profile`, `-failindex` manage encoding of I/O.
|
||||
- `msgcat` supports custom locale search list
|
||||
- `source` defaults to `-encoding utf-8`
|
||||
# New public C API
|
||||
|
||||
## Zip filesystems and attached archives.
|
||||
- Packaging of the Tcl script library with the Tcl binary library,
|
||||
meaning that the `TCL_LIBRARY` environment variable is usually not required.
|
||||
- Packaging of an application into a virtual filesystem is now a supported
|
||||
core Tcl feature.
|
||||
- [Tcl\_IsEmpty checks if the string representation of a value would be the empty string](https://core.tcl-lang.org/tips/doc/trunk/tip/711.md)
|
||||
- [Tcl\_GetEncodingNameForUser returns name of encoding from user settings](https://core.tcl-lang.org/tips/doc/trunk/tip/716.md)
|
||||
- [Tcl\_AttemptCreateHashEntry - version of Tcl\_CreateHashEntry that returns NULL instead of panic'ing on memory allocation errors](https://core.tcl-lang.org/tips/doc/trunk/tip/717.md)
|
||||
- [Tcl\_ListObjRange, Tcl\_ListObjRepeat, Tcl\_TclListObjReverse - C API for new list operations](https://core.tcl-lang.org/tips/doc/trunk/tip/649.md)
|
||||
- [Tcl\_UtfToNormalized, Tcl\_UtfToNormalizedDString - C API for Unicode normalization](https://core.tcl-lang.org/tips/doc/trunk/tip/726.md)
|
||||
- [Tcl\_UtfToExternalEx and Tcl\_ExternalToUtfEx - C encoding API supporting output buffers larger than INT_MAX](https://core.tcl-lang.org/tips/doc/trunk/tip/737.md)
|
||||
- [New API for monotonic clock and microseconds resolution](https://core.tcl-lang.org/tips/doc/trunk/tip/723.md)
|
||||
|
||||
## Unix notifiers available using `epoll()` or `kqueue()`
|
||||
- This relieves limits on file descriptors imposed by legacy `select()` and fixes a performance bottleneck.
|
||||
# Changes in interpreter initialization
|
||||
|
||||
# Incompatibilities
|
||||
- [Custom applications must call Tcl\_FindExecutable or TclZipfs_AppHook to initialize Tcl](https://core.tcl-lang.org/tips/doc/trunk/tip/732.md) *Potential incompatibility*
|
||||
- [Search path for locating Tcl core script and encodings is changed](https://core.tcl-lang.org/tips/doc/trunk/tip/732.md) *Potential incompatibility*
|
||||
|
||||
## Notable incompatibilities
|
||||
- Unqualified varnames resolved in current namespace, not global.
|
||||
Note that in almost all cases where this causes a change, the change is actually the removal of a latent bug.
|
||||
- No `--disable-threads` build option. Always thread-enabled.
|
||||
- I/O malencoding default response: raise error (`-profile strict`)
|
||||
- Windows platform needs Windows 7 or Windows Server 2008 R2 or later
|
||||
- Ended interpretation of `~` as home directory in pathnames.
|
||||
(See `file home` and `file tildeexpand` for replacements when you need them.)
|
||||
- Removed the `identity` encoding.
|
||||
(There were only ever very few valid use cases for this; almost all uses
|
||||
were systematically wrong.)
|
||||
- Removed the encoding alias `binary` to `iso8859-1`.
|
||||
- `$::tcl_precision` no longer controls string generation of doubles.
|
||||
(If you need a particular precision, use `format`.)
|
||||
- Removed pre-Tcl 8 legacies: `case`, `puts` and `read` variant syntaxes.
|
||||
- Removed subcommands [`trace variable`|`vdelete`|`vinfo`]
|
||||
- Removed `-eofchar` option for write channels.
|
||||
- On Windows 10+ (Version 1903 or higher), system encoding is always utf-8.
|
||||
- `%b`/`%d`/`%o`/`%x` format modifiers (without size modifier) for `format`
|
||||
and `scan` always truncate to 32-bits on all platforms.
|
||||
- `%L` size modifier for `scan` no longer truncates to 64-bit.
|
||||
- Removed command `::tcl::unsupported::inject`.
|
||||
(See `coroinject` and `coroprobe` for supported commands with significantly
|
||||
more comprehensible semantics.)
|
||||
# Performance
|
||||
|
||||
## Incompatibilities in C public interface
|
||||
- Extensions built against Tcl 8.6 and before will not work with Tcl 9.0;
|
||||
ABI compatibility was a non-goal for 9.0. In _most_ cases, rebuilding
|
||||
against Tcl 9.0 should work except when a removed API function is used.
|
||||
- Many arguments expanded type from `int` to `Tcl_Size`, a signed integer type
|
||||
large enough to support 64-bit sized memory objects.
|
||||
The constant `TCL_AUTO_LENGTH` is a value of that type that indicates that
|
||||
the length should be obtained using an appropriate function (typically `strlen()` for `char *` values).
|
||||
- Ended support for `Tcl_ChannelTypeVersion` less than 5
|
||||
- Introduced versioning of the `Tcl_ObjType` struct
|
||||
- Removed macros `CONST*`: Tcl 9 support means dropping Tcl 8.3 support.
|
||||
(Replaced with standard C `const` keyword going forward.)
|
||||
- Removed registration of several `Tcl_ObjType`s.
|
||||
- Removed API functions:
|
||||
- [Memory efficient internal representations](https://core.tcl-lang.org/tcl/wiki?name=New+abstract+list+representations)
|
||||
for list operations on large lists.
|
||||
- [Continued 64-bit capacity: Command line arguments larger than 2Gb](https://core.tcl-lang.org/tips/doc/trunk/tip/626.md)
|
||||
- Speedup in interpreter creation
|
||||
|
||||
`Tcl_Backslash()`,
|
||||
`Tcl_*VA()`,
|
||||
`Tcl_*MathFunc*()`,
|
||||
`Tcl_MakeSafe()`,
|
||||
`Tcl_(Save|Restore|Discard|Free)Result()`,
|
||||
`Tcl_EvalTokens()`,
|
||||
`Tcl_(Get|Set)DefaultEncodingDir()`,
|
||||
`Tcl_UniCharN(case)cmp()`,
|
||||
`Tcl_UniCharCaseMatch()`
|
||||
|
||||
- Revised many internals; beware reliance on undocumented behaviors.
|
||||
|
||||
# New Features
|
||||
|
||||
## New commands
|
||||
- `array default` — Specify default values for arrays (note that this alters the behaviour of `append`, `incr`, `lappend`).
|
||||
- `array for` — Cheap iteration over an array's contents.
|
||||
- `chan isbinary` — Test if a channel is configured to work with binary data.
|
||||
- `coroinject`, `coroprobe` — Interact with paused coroutines.
|
||||
- `clock add weekdays` — Clock arithmetic with week days.
|
||||
- `const`, `info const*` — Commands for defining constants (variables that can't be modified).
|
||||
- `dict getwithdefault` — Define a fallback value to use when `dict get` would otherwise fail.
|
||||
- `file home` — Get the user home directory.
|
||||
- `file tempdir` — Create a temporary directory.
|
||||
- `file tildeexpand` — Expand a file path containing a `~`.
|
||||
- `info commandtype` — Introspection for the kinds of commands.
|
||||
- `ledit` — Equivalent to `lreplace` but on a list in a variable.
|
||||
- `lpop` — Remove an item from a list in a variable.
|
||||
- `lremove` — Remove a sublist from a list in a variable.
|
||||
- `lseq` — Generate a list of numbers in a sequence.
|
||||
- `package files` — Describe the contents of a package.
|
||||
- `string insert` — Insert a string as a substring of another string.
|
||||
- `string is dict` — Test whether a string is a dictionary.
|
||||
- `tcl::process` — Commands for working with subprocesses.
|
||||
- `*::build-info` — Obtain information about the build of Tcl.
|
||||
- `readFile`, `writeFile`, `foreachLine` — Simple procedures for basic working with files.
|
||||
- `tcl::idna::*` — Commands for working with encoded DNS names.
|
||||
|
||||
## New command options
|
||||
- `chan configure ... -inputmode ...` — Support for raw terminal input and reading passwords.
|
||||
- `clock scan ... -validate ...`
|
||||
- `info loaded ... ?prefix?`
|
||||
- `lsearch ... -stride ...` — Search a list by groups of items.
|
||||
- `regsub ... -command ...` — Generate the replacement for a regular expression by calling a command.
|
||||
- `socket ... -nodelay ... -keepalive ...`
|
||||
- `vwait` controlled by several new options
|
||||
- `expr` string comparators `lt`, `gt`, `le`, `ge`
|
||||
- `expr` supports comments inside expressions
|
||||
|
||||
## Numbers
|
||||
- <code>0<i>NNN</i></code> format is no longer octal interpretation. Use <code>0o<i>NNN</i></code>.
|
||||
- <code>0d<i>NNNN</i></code> format to compel decimal interpretation.
|
||||
- <code>NN_NNN_NNN</code>, underscores in numbers for optional readability
|
||||
- Functions: `isinf()`, `isnan()`, `isnormal()`, `issubnormal()`, `isunordered()`
|
||||
- Command: `fpclassify`
|
||||
- Function `int()` no longer truncates to word size
|
||||
|
||||
## TclOO facilities
|
||||
- private variables and methods
|
||||
- class variables and methods
|
||||
- abstract and singleton classes
|
||||
- configurable properties
|
||||
- `method -export`, `method -unexport`
|
||||
|
||||
# Known bugs
|
||||
- [changed behaviour wrt command names, namespaces and resolution](https://core.tcl-lang.org/tcl/tktview/f14b33)
|
||||
- [windows dos device paths inconsistencies and missing functionality](https://core.tcl-lang.org/tcl/tktview/d8f121)
|
||||
- [load library (dll) from zipfs-library causes a leak in temporary folder](https://core.tcl-lang.org/tcl/tktview/a8e4f7)
|
||||
- [lsearch -sorted -inline -subindices incorrect result](https://core.tcl-lang.org/tcl/tktview/bc4ac0)
|
||||
- ["No error" when load fails due to a missing secondary DLL](https://core.tcl-lang.org/tcl/tktview/66aa81c90a)
|
||||
# Bug fixes
|
||||
- [tclEpollNotfy PlatformEventsControl panics if websocket disconnected](https://core.tcl-lang.org/tcl/tktview/010d8f38)
|
||||
|
||||
|
||||
+16
-2
@@ -9,7 +9,7 @@
|
||||
.so man.macros
|
||||
.BS
|
||||
.SH NAME
|
||||
Tcl_CreateTimerHandler, Tcl_DeleteTimerHandler \- call a procedure at a given time
|
||||
Tcl_CreateTimerHandler, TclCreateTimerHandlerMicroSeconds, Tcl_DeleteTimerHandler \- call a procedure at a given time
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
\fB#include <tcl.h>\fR
|
||||
@@ -17,10 +17,15 @@ Tcl_CreateTimerHandler, Tcl_DeleteTimerHandler \- call a procedure at a given ti
|
||||
Tcl_TimerToken
|
||||
\fBTcl_CreateTimerHandler\fR(\fImilliseconds, proc, clientData\fR)
|
||||
.sp
|
||||
Tcl_TimerToken
|
||||
\fBTcl_CreateTimerHandlerMicroSeconds\fR(\fImicroseconds, proc, clientData\fR)
|
||||
.sp
|
||||
\fBTcl_DeleteTimerHandler\fR(\fItoken\fR)
|
||||
.fi
|
||||
.SH ARGUMENTS
|
||||
.AS Tcl_TimerToken milliseconds
|
||||
.AP long_long microseconds in
|
||||
How many microseconds to wait before invoking \fIproc\fR.
|
||||
.AP int milliseconds in
|
||||
How many milliseconds to wait before invoking \fIproc\fR.
|
||||
.AP Tcl_TimerProc *proc in
|
||||
@@ -36,12 +41,15 @@ from some previous call to \fBTcl_CreateTimerHandler\fR).
|
||||
\fBTcl_CreateTimerHandler\fR arranges for \fIproc\fR to be
|
||||
invoked at a time \fImilliseconds\fR milliseconds in the
|
||||
future.
|
||||
\fBTcl_CreateTimerHandlerMicroseconds\fR arranges for \fIproc\fR to be
|
||||
invoked at a time \fImicroseconds\fR microseconds in the
|
||||
future.
|
||||
The callback to \fIproc\fR will be made by \fBTcl_DoOneEvent\fR,
|
||||
so \fBTcl_CreateTimerHandler\fR is only useful in programs that
|
||||
dispatch events through \fBTcl_DoOneEvent\fR or through Tcl commands
|
||||
such as \fBvwait\fR.
|
||||
The call to \fIproc\fR may not be made at the exact time given by
|
||||
\fImilliseconds\fR: it will be made at the next opportunity
|
||||
the parameter: it will be made at the next opportunity
|
||||
after that time. For example, if \fBTcl_DoOneEvent\fR is not
|
||||
called until long after the time has elapsed, or if there
|
||||
are other pending events to process before the call to
|
||||
@@ -62,6 +70,12 @@ was created. Typically, \fIclientData\fR points to a data
|
||||
structure containing application-specific information about
|
||||
what to do in \fIproc\fR.
|
||||
.PP
|
||||
Both functions return a \fBtolken\fR.
|
||||
In case of \fBTcl_CreateTimerHandlerMicroSeconds\fR, the return value is \fBNULL\fR,
|
||||
if the given time interval is to much in the future and may not be
|
||||
represented. This is a theoretical case, as it is in around 26 thousand years.
|
||||
\fBTcl_CreateTimerHandler\fR does not check for overflow and never returns \fBNULL\fR.
|
||||
.PP
|
||||
\fBTcl_DeleteTimerHandler\fR may be called to delete a
|
||||
previously created timer handler. It deletes the handler
|
||||
indicated by \fItoken\fR so that no call to \fIproc\fR
|
||||
|
||||
+213
-143
@@ -8,7 +8,7 @@
|
||||
.so man.macros
|
||||
.BS
|
||||
.SH NAME
|
||||
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
|
||||
Tcl_GetEncoding, Tcl_FreeEncoding, Tcl_GetEncodingFromObj, Tcl_ExternalToUtfDString, Tcl_ExternalToUtfDStringEx, Tcl_ExternalToUtf,Tcl_ExternalToUtfEx, Tcl_UtfToExternalDString, Tcl_UtfToExternalDStringEx, Tcl_UtfToExternal, Tcl_UtfToExternalEx, Tcl_GetEncodingName, Tcl_SetSystemEncoding, Tcl_GetEncodingNameFromEnvironment, Tcl_GetEncodingNameForUser, Tcl_GetEncodingNames, Tcl_CreateEncoding, Tcl_GetEncodingSearchPath, Tcl_SetEncodingSearchPath \- procedures for creating and using encodings
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
\fB#include <tcl.h>\fR
|
||||
@@ -34,10 +34,16 @@ int
|
||||
\fBTcl_UtfToExternalDStringEx\fR(\fIinterp, encoding, src, srcLen, flags, dstPtr, errorIdxPtr\fR)
|
||||
.sp
|
||||
int
|
||||
\fBTcl_ExternalToUtf\fR(\fIinterp, encoding, src, srcLen, flags, statePtr, dst, dstLen, srcReadPtr, dstWrotePtr, dstCharsPtr\fR)
|
||||
\fBTcl_ExternalToUtfEx\fR(\fIinterp, encoding, src, srcLen, flags, statePtr, dst, dstLen, srcReadPtr, dstWrotePtr, dstCharsPtr\fR)
|
||||
.sp
|
||||
int
|
||||
\fBTcl_UtfToExternal\fR(\fIinterp, encoding, src, srcLen, flags, statePtr, dst, dstLen, srcReadPtr, dstWrotePtr, dstCharsPtr\fR)
|
||||
\fBTcl_ExternalToUtf\fR(\fIinterp, encoding, src, srcLen, flags, statePtr, dst, dstLen, srcReadIntPtr, dstWroteIntPtr, dstCharsIntPtr\fR)
|
||||
.sp
|
||||
int
|
||||
\fBTcl_UtfToExternalEx\fR(\fIinterp, encoding, src, srcLen, flags, statePtr, dst, dstLen, srcReadPtr, dstWrotePtr, dstCharsPtr\fR)
|
||||
.sp
|
||||
int
|
||||
\fBTcl_UtfToExternal\fR(\fIinterp, encoding, src, srcLen, flags, statePtr, dst, dstLen, srcReadIntPtr, dstWroteIntPtr, dstCharsIntPtr\fR)
|
||||
.sp
|
||||
const char *
|
||||
\fBTcl_GetEncodingName\fR(\fIencoding\fR)
|
||||
@@ -51,6 +57,9 @@ int
|
||||
const char *
|
||||
\fBTcl_GetEncodingNameFromEnvironment\fR(\fIbufPtr\fR)
|
||||
.sp
|
||||
const char *
|
||||
\fBTcl_GetEncodingNameForUser\fR(\fIbufPtr\fR)
|
||||
.sp
|
||||
\fBTcl_GetEncodingNames\fR(\fIinterp\fR)
|
||||
.sp
|
||||
Tcl_Encoding
|
||||
@@ -63,7 +72,7 @@ int
|
||||
\fBTcl_SetEncodingSearchPath\fR(\fIsearchPath\fR)
|
||||
.fi
|
||||
.SH ARGUMENTS
|
||||
.AS "const Tcl_EncodingType" *dstWrotePtr in/out
|
||||
.AS "const Tcl_EncodingType" *dstWroteIntPtr in/out
|
||||
.AP Tcl_Interp *interp in
|
||||
Interpreter to use for error reporting, or NULL if no error reporting is
|
||||
desired.
|
||||
@@ -91,46 +100,32 @@ Pointer to an uninitialized or free \fBTcl_DString\fR in which the converted
|
||||
result will be stored.
|
||||
.AP int flags in
|
||||
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
|
||||
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. 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.
|
||||
The flag \fBTCL_ENCODING_STOPONERROR\fR has no effect,
|
||||
it only has meaning in Tcl 8.x.
|
||||
Some flags bits may not be usable with some functions as noted in the
|
||||
function descriptions below.
|
||||
Any bits not defined in the function descriptions below should be set to 0 as they
|
||||
are used internally by Tcl.
|
||||
.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
|
||||
state in \fI*statePtr\fR after \fIsrc\fR (the buffer containing the
|
||||
current piece) has been converted; that state information must be passed
|
||||
back when converting the next piece of the stream so the conversion
|
||||
routine knows what state it was in when it left off at the end of the
|
||||
last piece. May be NULL, in which case the value specified for \fIflags\fR
|
||||
is ignored and the source buffer is assumed to contain the complete string to
|
||||
convert.
|
||||
in a piece-by-piece fashion.
|
||||
.AP char *dst out
|
||||
Buffer in which the converted result will be stored. No more than
|
||||
\fIdstLen\fR bytes will be stored in \fIdst\fR.
|
||||
.AP Tcl_Size dstLen in
|
||||
The maximum length of the output buffer \fIdst\fR in bytes.
|
||||
.AP int *srcReadPtr out
|
||||
Filled with the number of bytes from \fIsrc\fR that were actually
|
||||
converted. This may be less than the original source length if there was
|
||||
a problem converting some source characters. May be NULL.
|
||||
.AP int *dstWrotePtr out
|
||||
Filled with the number of bytes that were actually stored in the output
|
||||
.AP Tcl_Size *srcReadPtr out
|
||||
Filled with the number of bytes from \fIsrc\fR that were converted. May be NULL.
|
||||
.AP int *srcReadIntPtr out
|
||||
Filled with the number of bytes from \fIsrc\fR that were converted. May be NULL.
|
||||
.AP Tcl_Size *dstWrotePtr out
|
||||
Filled with the number of bytes that were stored in the output
|
||||
buffer as a result of the conversion. May be NULL.
|
||||
.AP int *dstWroteIntPtr out
|
||||
Filled with the number of bytes that were stored in the output
|
||||
buffer as a result of the conversion. May be NULL.
|
||||
.AP int *dstCharsPtr out
|
||||
.AP Tcl_Size *dstCharsPtr out
|
||||
Filled with the number of characters that correspond to the number of bytes
|
||||
stored in the output buffer. May be NULL.
|
||||
stored in the output buffer. May be NULL.
|
||||
.AP int *dstCharsIntPtr 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.
|
||||
@@ -163,16 +158,15 @@ display routines require.
|
||||
.PP
|
||||
Some basic encodings are compiled into Tcl. Others can be defined by the user or
|
||||
dynamically loaded from encoding files in a platform-independent manner.
|
||||
.SH DESCRIPTION
|
||||
.SH "MANAGING ENCODINGS"
|
||||
.PP
|
||||
\fBTcl_GetEncoding\fR finds an encoding given its \fIname\fR. The name may
|
||||
refer to a built-in Tcl encoding, a user-defined encoding registered by
|
||||
calling \fBTcl_CreateEncoding\fR, or a dynamically-loadable encoding
|
||||
file. The return value is a token that represents the encoding and can be
|
||||
used in subsequent calls to procedures such as \fBTcl_GetEncodingName\fR,
|
||||
\fBTcl_FreeEncoding\fR, and \fBTcl_UtfToExternal\fR. If the name did not
|
||||
refer to any known or loadable encoding, NULL is returned and an error
|
||||
message is returned in \fIinterp\fR.
|
||||
\fBTcl_GetEncoding\fR finds an encoding given its \fIname\fR. The name may refer
|
||||
to a built-in Tcl encoding, a user-defined encoding registered by calling
|
||||
\fBTcl_CreateEncoding\fR, or a dynamically-loadable encoding file. The return
|
||||
value is a token that represents the encoding and can be used in subsequent
|
||||
calls to functions that expect an argument of type \fBTcl_Encoding\fR. If the
|
||||
name did not refer to any known or loadable encoding, NULL is returned and an
|
||||
error message is stored in \fIinterp\fR.
|
||||
.PP
|
||||
The encoding package maintains a database of all encodings currently in use.
|
||||
The first time \fIname\fR is seen, \fBTcl_GetEncoding\fR returns an
|
||||
@@ -199,92 +193,6 @@ writing to \fB*\fR\fIencodingPtr\fR takes place. Just as with
|
||||
on the resulting encoding token when that token will no longer be
|
||||
used.
|
||||
.PP
|
||||
\fBTcl_ExternalToUtfDString\fR converts a source buffer \fIsrc\fR from the
|
||||
specified \fIencoding\fR into TUTF-8. The converted bytes are stored in
|
||||
\fIdstPtr\fR, which is then null-terminated. The caller should eventually
|
||||
call \fBTcl_DStringFree\fR to free any information stored in \fIdstPtr\fR.
|
||||
When converting, if any of the characters in the source buffer cannot be
|
||||
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 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_OK\fR with the
|
||||
converted string stored in \fB*dstPtr\fR. For errors \fIother than conversion
|
||||
errors\fR, such as invalid flags, the function returns \fBTCL_ERROR\fR with an
|
||||
error message in \fBinterp\fR if it is not NULL.
|
||||
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 the decoded data
|
||||
up 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 TUTF-8. Up to \fIsrcLen\fR bytes are converted from the
|
||||
source buffer and up to \fIdstLen\fR converted bytes are stored in \fIdst\fR.
|
||||
In all cases, \fI*srcReadPtr\fR is filled with the number of bytes that were
|
||||
successfully converted from \fIsrc\fR and \fI*dstWrotePtr\fR is filled with
|
||||
the corresponding number of bytes that were stored in \fIdst\fR. The return
|
||||
value is one of the following:
|
||||
.RS
|
||||
.IP \fBTCL_OK\fR 29
|
||||
All bytes of \fIsrc\fR were converted.
|
||||
.IP \fBTCL_CONVERT_NOSPACE\fR 29
|
||||
The destination buffer was not large enough for all of the converted data; as
|
||||
many characters as could fit were converted though.
|
||||
.IP \fBTCL_CONVERT_MULTIBYTE\fR 29
|
||||
The last few bytes in the source buffer were the beginning of a multibyte
|
||||
sequence, but more bytes were needed to complete this sequence. A
|
||||
subsequent call to the conversion routine should pass a buffer containing
|
||||
the unconverted bytes that remained in \fIsrc\fR plus some further bytes
|
||||
from the source stream to properly convert the formerly split-up multibyte
|
||||
sequence.
|
||||
.IP \fBTCL_CONVERT_SYNTAX\fR 29
|
||||
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.
|
||||
.RE
|
||||
.LP
|
||||
\fBTcl_UtfToExternalDString\fR converts a source buffer \fIsrc\fR from TUTF-8
|
||||
into the specified \fIencoding\fR. The converted bytes are stored in
|
||||
\fIdstPtr\fR, which is then terminated with the appropriate encoding-specific
|
||||
null. The caller should eventually call \fBTcl_DStringFree\fR to free any
|
||||
information stored in \fIdstPtr\fR. 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_UtfToExternalDStringEx\fR is an enhanced version of
|
||||
\fBTcl_UtfToExternalDString\fR that transforms TUTF-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.
|
||||
.PP
|
||||
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 TUTF-8 into
|
||||
the specified \fIencoding\fR. Up to \fIsrcLen\fR bytes are converted from
|
||||
the source buffer and up to \fIdstLen\fR converted bytes are stored in
|
||||
\fIdst\fR. In all cases, \fI*srcReadPtr\fR is filled with the number of
|
||||
bytes that were successfully converted from \fIsrc\fR and \fI*dstWrotePtr\fR
|
||||
is filled with the corresponding number of bytes that were stored in
|
||||
\fIdst\fR. The return values are the same as the return values for
|
||||
\fBTcl_ExternalToUtf\fR.
|
||||
.PP
|
||||
\fBTcl_GetEncodingName\fR is roughly the inverse of \fBTcl_GetEncoding\fR.
|
||||
Given an \fIencoding\fR, the return value is the \fIname\fR argument that
|
||||
was used to create the encoding. The string returned by
|
||||
@@ -304,12 +212,22 @@ procedure increments the reference count of the new system encoding,
|
||||
decrements the reference count of the old system encoding, and returns
|
||||
\fBTCL_OK\fR.
|
||||
.PP
|
||||
\fBTcl_GetEncodingNameFromEnvironment\fR provides a means for the Tcl
|
||||
library to report the encoding name it believes to be the correct one
|
||||
to use as the system encoding, based on system calls and examination of
|
||||
the environment suitable for the platform. It accepts \fIbufPtr\fR,
|
||||
a pointer to an uninitialized or freed \fBTcl_DString\fR and writes
|
||||
the encoding name to it. The \fBTcl_DStringValue\fR is returned.
|
||||
\fBTcl_GetEncodingNameFromEnvironment\fR retrieves the encoding name to
|
||||
use as the system encoding. On non-Windows platforms, this is derived
|
||||
from the \fBnl_langinfo\fR system call if available, and environment
|
||||
variables \fBLC_ALL\fR, \fBLC_CTYPE\fR or \fBLANG\fR otherwise. On
|
||||
Windows versions Windows 10 Build 18362 and later the returned value is
|
||||
always \fButf-8\fR. On earlier Windows versions, it is derived from the
|
||||
user settings in the Windows registry. \fBTcl_GetEncodingNameForUser\fR
|
||||
retrieves the encoding name based on the user settings for the current
|
||||
user and is derived in the same manner as
|
||||
\fBTcl_GetEncodingNameFromEnvironment\fR on non-Windows platforms. On
|
||||
Windows, unlike \fBTcl_GetEncodingNameFromEnvironment\fR, it returns the
|
||||
encoding name as per the Windows registry settings irrespective of the
|
||||
Windows version. Both functions accept \fIbufPtr\fR, a pointer to an
|
||||
uninitialized or freed \fBTcl_DString\fR and write the encoding name to
|
||||
it. They return \fBTcl_DStringValue(bufPtr)\fR which points to the stored
|
||||
name.
|
||||
.PP
|
||||
\fBTcl_GetEncodingNames\fR sets the \fIinterp\fR result to a list
|
||||
consisting of the names of all the encodings that are currently defined
|
||||
@@ -317,6 +235,158 @@ or can be dynamically loaded, searching the encoding path specified by
|
||||
\fBTcl_SetEncodingSearchPath\fR. This procedure does not ensure that the
|
||||
dynamically-loadable encoding files contain valid data, but merely that they
|
||||
exist.
|
||||
.SH "CONVERTING BETWEEN TUTF-8 AND OTHER ENCODINGS"
|
||||
.PP
|
||||
There are two sets of functions to convert data between TUTF-8 and any external
|
||||
encoding known to Tcl. They differ primarily in the form in which converted data
|
||||
is returned to the caller. The \fBTcl_ExternalToUtfEx\fR and
|
||||
\fBTcl_UtfToExternalEx\fR functions return the data in buffers supplied by the
|
||||
caller. The \fBTcl_ExternalToUtfDStringEx\fR and
|
||||
\fBTcl_UtfToExternalDStringEx\fR return the data in a \fBTcl_DString\fR
|
||||
structure. For backwards compatibility, Tcl also provides "non-Ex" variants
|
||||
of these such as \fBTcl_ExternalToUtf\fR.
|
||||
.SS "CONVERSION USING OUTPUT BUFFERS"
|
||||
.PP
|
||||
The \fBTcl_ExternalToUtfEx\fR function converts bytes in the encoding
|
||||
\fIencoding\fR at address \fIsrc\fR into TUTF-8 encoding, storing them in the
|
||||
buffer at address \fIdst\fR. Conversely, \fBTcl_UtfToExternalEx\fR converts
|
||||
bytes encoded in TUTF-8 at address \fIsrc\fR into the encoding given by
|
||||
\fIencoding\fR, storing them in the output buffer at address \fIdst\fR. In both
|
||||
cases, \fIsrcLen\fR specifies the number of bytes to be converted and
|
||||
\fIdstLen\fR specifies the size of the output buffer.
|
||||
.PP
|
||||
The \fIflags\fR parameter is a bitmask that controls operation of the conversion
|
||||
and should be a bitwise OR of zero or more of the following values:
|
||||
.RS
|
||||
.IP \fBTCL_ENCODING_PROFILE_xxx\fR 29
|
||||
At most one of the profile selection flags listed in the \fBPROFILES\fR section of
|
||||
this manpage.
|
||||
.IP \fBTCL_ENCODING_NO_TERMINATE\fR 29
|
||||
Disables null termination of the output. By default, the output buffer \fIdst\fR
|
||||
is terminated with an encoding-appropriate null.
|
||||
.IP \fBTCL_ENCODING_START\fR and \fBTCL_ENCODING_END\fR 29
|
||||
Indicate whether the source bytes correspond to the first or last blocks,
|
||||
respectively, in a source stream. \fBTCL_ENCODING_START\fR will cause the
|
||||
conversion routine to reset to an initial state ready to process the first byte
|
||||
of an encoded stream. \fBTCL_ENCODING_END\fR indicates the source buffer is the
|
||||
last block in an input stream allowing any required finalization to be
|
||||
performed. Any incomplete trailing characters will then be treated as per the
|
||||
encoding profile in effect. Both flags may be specified in the same call when
|
||||
all data to be converted is passed in a single block. Both flags are also
|
||||
presumed to be implicitly set if the \fIstatePtr\fR parameter is passed as NULL.
|
||||
.IP \fBTCL_ENCODING_CHAR_LIMIT\fR 29
|
||||
Specifies that the functions should not convert more characters than the number
|
||||
passed through the \fIdstCharsPtr\fR argument, if not NULL. This flag is only
|
||||
supported by the \fBTcl_ExternalToUtfEx\fR function and should not be passed to
|
||||
other functions.
|
||||
.RE
|
||||
.LP
|
||||
The \fIstatePtr\fR parameter is an opaque pointer to a location used by the
|
||||
encoding functions to store intermediate state when the data to be converted is
|
||||
passed in multiple chunks. The same location should be passed in \fIstatePtr\fR
|
||||
for all related calls with the first chunk passed with the
|
||||
\fBTCL_ENCODING_START\fR flag set and the last with \fBTCL_ENCODING_END\fR set.
|
||||
If \fIstatePtr\fR is passed as NULL, all data is presumed to all be contained in
|
||||
that single call and the functions behave as if \fBTCL_ENCODING_START\fR and
|
||||
\fBTCL_ENCODING_END\fR were both set in the \fIflags\fR parameter.
|
||||
.PP
|
||||
The \fIsrcReadPtr\fR, \fIdstWrotePtr\fR and \fIdstCharsPtr\fR point to locations
|
||||
to hold the number of bytes in the source that were processed successfully, the
|
||||
number of bytes written to the output buffer (excluding terminating nulls), and
|
||||
the number of characters written to the output buffer (again excluding
|
||||
terminating nulls) respectively. All three are optional and may be passed as
|
||||
NULL. Further, in the case of the \fBTcl_ExternalToUtfEx\fR function, the
|
||||
\fIdstCharsPtr\fR may be used with the \fBTCL_ENCODING_CHAR_LIMIT\fR flags to
|
||||
limit the number of characters processed as described earlier.
|
||||
.PP
|
||||
With the exceptions noted below, the counts returned in \fIsrcReadPtr\fR,
|
||||
\fIdstWrotePtr\fR and \fIdstCharsPtr\fR are valid for all return codes listed
|
||||
below other than \fBTCL_ERROR\fR.
|
||||
.RS
|
||||
.IP \fBTCL_OK\fR 29
|
||||
The function completed without any exceptional conditions. Note this does not
|
||||
mean all passed input in \fIsrc\fR was processed or verified. In particular, in
|
||||
the case of the caller passing \fBTCL_ENCODING_CHAR_LIMIT\fR to limit the number
|
||||
of characters converted, only the corresponding number of bytes in the source
|
||||
input would have been processed as indicated by the value in \fIsrcReadPtr\fR.
|
||||
.IP \fBTCL_CONVERT_NOSPACE\fR 29
|
||||
The output buffer had insufficient space. The output buffer will contain as much
|
||||
converted data as it could fit and will be null terminated as appropriate unless
|
||||
the buffer was too small to even contain a null terminator by itself.
|
||||
\fIsrcReadPtr\fR will hold number of processed source bytes and caller should
|
||||
call again to process the remaining bytes. *Note: As a quirk of implementation,
|
||||
in some cases the destination buffer needs to be \fBTCL_UTF_MAX\fR bytes greater
|
||||
than the actual size needed. This is an existing quirk present in both 8.6 and
|
||||
9.0 that is not addressed in this TIP.*
|
||||
.IP \fBTCL_CONVERT_MULTIBYTE\fR 29
|
||||
The trailing bytes in the source input formed an incomplete encoding sequence.
|
||||
Caller should call the function again with additional source bytes appended to
|
||||
the tail at offset \fI*srcReadPtr\fR of the original source bytes and with the
|
||||
same \fIstatePtr\fR. Note that if \fIflags\fR had the \fBTCL_ENCODING_END\fR
|
||||
flag set, indicating no more data is forthcoming, the functions will return
|
||||
\fBTCL_CONVERT_SYNTAX\fR instead of \fBTCL_CONVERT_MULTIBYTE\fR.
|
||||
.IP \fBTCL_CONVERT_SYNTAX\fR 29
|
||||
An invalid byte sequence was detected in the source input. What constitutes an
|
||||
"invalid" sequence is subject to the encoding profile as specified by the
|
||||
\fIflags\fR parameter. The \fI*srcReadPtr\fR count will contain the number of
|
||||
bytes successfully processed and is therefore also the offset of the start of
|
||||
the invalid sequence. The output buffer will contain the converted data up to
|
||||
that point.
|
||||
.IP \fBTCL_CONVERT_UNKNOWN\fR 29
|
||||
The input byte sequence represented a character that cannot be encoded in the
|
||||
output encoding for the encoding profile in effect. Treatment is similar to that
|
||||
of \fBTCL_CONVERT_SYNTAX\fR.
|
||||
.IP \fBTCL_ERROR\fR 29
|
||||
An error message is stored in \fIinterp\fR if it is not NULL. The output
|
||||
locations at \fIsrcReadPtr\fR, \fIdstWrotePtr\fR and \fIdstCharsPtr\fR may have
|
||||
been modified but should not be considered valid.
|
||||
.RE
|
||||
.LP
|
||||
The functions \fBTcl_ExternalToUtf\fR and \fBTcl_UtfToExternal\fR are variants
|
||||
of \fBTcl_ExternalToUtfEx\fR and \fBTcl_UtfToExternalEx\fR. They differ in that
|
||||
their output counts have a limit of INT_MAX and therefore cannot handle the full
|
||||
string lengths supported by Tcl on 64-bit platforms. They will return
|
||||
\fBTCL_ERROR\fR in such cases.
|
||||
.SS "CONVERSION USING TCL_DSTRING"
|
||||
.PP
|
||||
\fBTcl_ExternalToUtfDStringEx\fR and \fBTcl_UtfToExternalDStringEx\fR convert
|
||||
\fIsrcLen\fR bytes at address \fIsrc\fR from the specified \fIencoding\fR into
|
||||
TUTF-8 and the reverse respectively. The converted bytes are stored in
|
||||
\fIdstPtr\fR, which is then null-terminated. The caller should eventually call
|
||||
\fBTcl_DStringFree\fR to free any information stored in \fIdstPtr\fR irrespective
|
||||
of the return value from the function.
|
||||
.PP
|
||||
The \fIflags\fR argument to the functions should be 0 or one of the profile
|
||||
selection flags described above to select the profile to use for conversion.
|
||||
The other flags should be cleared. The functions assume the entire source
|
||||
string to be converted is passed into the function.
|
||||
.PP
|
||||
On success, the function returns \fBTCL_OK\fR with the
|
||||
converted string stored in \fB*dstPtr\fR. For errors \fIother than conversion
|
||||
errors\fR, such as invalid flags, the function returns \fBTCL_ERROR\fR with an
|
||||
error message in \fBinterp\fR if it is not NULL.
|
||||
For conversion errors, \fBTcl_ExternalToUtfDStringEx\fR returns one
|
||||
of the \fBTCL_CONVERT_*\fR errors listed above.
|
||||
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 only interested the decoded data
|
||||
up 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
|
||||
\fBTcl_ExternalToUtfDString\fR and \fBTcl_UtfToExternalDString\fR are older,
|
||||
less flexible variants of the above functions that do not support profiles. The
|
||||
return value from the functions is a pointer to the value stored in the
|
||||
\fBTcl_DString\fR. 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. \fBTcl_UtfToExternalDString\fR converts a source buffer \fIsrc\fR from
|
||||
TUTF-8 into the specified \fIencoding\fR. The converted bytes are stored in
|
||||
\fIdstPtr\fR, which is then terminated with the appropriate encoding-specific
|
||||
null. The caller should eventually call \fBTcl_DStringFree\fR to free any
|
||||
information stored in \fIdstPtr\fR. When converting, if any of the characters in
|
||||
the source buffer cannot be represented in the target encoding, an
|
||||
encoding-specific default fallback character will be used.
|
||||
.SH CREATING NEW ENCODINGS
|
||||
.PP
|
||||
\fBTcl_CreateEncoding\fR defines a new encoding and registers the C
|
||||
procedures that are called back to convert between the encoding and
|
||||
@@ -379,9 +449,9 @@ typedef int \fBTcl_EncodingConvertProc\fR(
|
||||
Tcl_EncodingState *\fIstatePtr\fR,
|
||||
char *\fIdst\fR,
|
||||
int \fIdstLen\fR,
|
||||
int *\fIsrcReadPtr\fR,
|
||||
int *\fIdstWrotePtr\fR,
|
||||
int *\fIdstCharsPtr\fR);
|
||||
int *\fIsrcReadIntPtr\fR,
|
||||
int *\fIdstWroteIntPtr\fR,
|
||||
int *\fIdstCharsIntPtr\fR);
|
||||
.CE
|
||||
.PP
|
||||
The \fItoUtfProc\fR and \fIfromUtfProc\fR procedures are called by the
|
||||
@@ -394,10 +464,10 @@ documented at the top, to \fBTcl_ExternalToUtf\fR or
|
||||
\fBTcl_UtfToExternal\fR, with the following exceptions. If the
|
||||
\fIsrcLen\fR argument to one of those high-level functions is negative,
|
||||
the value passed to the callback procedure will be the appropriate
|
||||
encoding-specific string length of \fIsrc\fR. If any of the \fIsrcReadPtr\fR,
|
||||
\fIdstWrotePtr\fR, or \fIdstCharsPtr\fR arguments to one of the high-level
|
||||
functions is NULL, the corresponding value passed to the callback
|
||||
procedure will be a non-NULL location.
|
||||
encoding-specific string length of \fIsrc\fR. The \fIsrcReadIntPtr\fR,
|
||||
\fIdstWroteIntPtr\fR, and \fIdstCharsIntPtr\fR arguments will always be non-NULL,
|
||||
even if the corresponding argument to one of the high-level
|
||||
functions is NULL.
|
||||
.PP
|
||||
The callback procedure \fIfreeProc\fR, if non-NULL, should match the type
|
||||
\fBTcl_EncodingFreeProc\fR:
|
||||
|
||||
+27
-26
@@ -4,7 +4,7 @@
|
||||
'\" See the file "license.terms" for information on usage and redistribution
|
||||
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
'\"
|
||||
.TH Tcl_FindExecutable 3 8.1 Tcl "Tcl Library Procedures"
|
||||
.TH Tcl_FindExecutable 3 9.1 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
.SH NAME
|
||||
@@ -25,36 +25,37 @@ const char *
|
||||
The first command-line argument to the program, which gives the
|
||||
application's name.
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
The \fBTcl_FindExecutable\fR procedure computes the full path name of
|
||||
the executable file from which the application was invoked and saves
|
||||
it for Tcl's internal use.
|
||||
The executable's path name is needed for several purposes in
|
||||
Tcl. For example, it is needed on some platforms in the
|
||||
implementation of the \fBload\fR command.
|
||||
It is also returned by the \fBinfo nameofexecutable\fR command.
|
||||
\fBTcl_FindExecutable\fR is one of two functions, \fBTclZipfs_AppHook\fR
|
||||
being the other, that must be called by an application to initialize
|
||||
Tcl prior to any other calls into Tcl. Applications that wish to use
|
||||
ZipFS-based builds should call \fBTclZipfs_AppHook\fR in preference
|
||||
to this function.
|
||||
.PP
|
||||
The result of \fBTcl_FindExecutable\fR is the full Tcl version with
|
||||
build information (e.g., \fB9.0.0+abcdef...abcdef.gcc-1002\fR).
|
||||
On UNIX platforms, the function should be passed \fIargv[0]\fR as its
|
||||
argument. It is important not to change the working directory before
|
||||
this invocation. \fBTcl_FindExecutable\fR uses \fIargv0\fR together
|
||||
with the \fBPATH\fR environment variable to locate the application's
|
||||
executable, if possible. If it fails to find the binary, subsequent
|
||||
calls to \fBinfo nameofexecutable\fR will return an empty string.
|
||||
.PP
|
||||
On UNIX platforms this procedure is typically invoked as the very
|
||||
first thing in the application's main program; it must be passed
|
||||
\fIargv[0]\fR as its argument. It is important not to change the
|
||||
working directory before the invocation.
|
||||
\fBTcl_FindExecutable\fR uses \fIargv0\fR
|
||||
along with the \fBPATH\fR environment variable to find the
|
||||
application's executable, if possible. If it fails to find
|
||||
the binary, then future calls to \fBinfo nameofexecutable\fR
|
||||
will return an empty string.
|
||||
On Windows platforms, the \fIargv[0]\fR argument is used only to
|
||||
indicate whether the executable has a standard error channel (any
|
||||
non-null value) or not (the value null). If \fBTcl_SetPanicProc\fR is
|
||||
never called and no debugger is running, this setting determines
|
||||
whether a panic message is sent to standard error or displayed in a
|
||||
system dialog.
|
||||
.PP
|
||||
On Windows platforms this procedure is typically invoked as the very
|
||||
first thing in the application's main program as well; Its \fIargv[0]\fR
|
||||
argument is only used to indicate whether the executable has a stderr
|
||||
channel (any non-null value) or not (the value null). If \fBTcl_SetPanicProc\fR
|
||||
is never called and no debugger is running, this determines whether
|
||||
the panic message is sent to stderr or to a standard system dialog.
|
||||
As part of its initialization sequence,
|
||||
\fBTcl_FindExecutable\fR computes the full path name of the executable
|
||||
file from which the application was invoked. This result is saved for
|
||||
Tcl's internal use and is returned by the
|
||||
\fBinfo nameofexecutable\fR command.
|
||||
.PP
|
||||
The result of \fBTcl_FindExecutable\fR is the full Tcl version string,
|
||||
including build information (for example,
|
||||
\fB9.0.0+abcdef...abcdef.gcc-1002\fR).
|
||||
.PP
|
||||
\fBTcl_GetNameOfExecutable\fR simply returns a pointer to the
|
||||
internal full path name of the executable file as computed by
|
||||
|
||||
+21
-46
@@ -8,11 +8,14 @@
|
||||
.so man.macros
|
||||
.BS
|
||||
.SH NAME
|
||||
Tcl_GetTime, Tcl_SetTimeProc, Tcl_QueryTimeProc \- get date and time
|
||||
Tcl_GetMonotonicTime, Tcl_GetTime, Tcl_SetTimeProc, Tcl_QueryTimeProc \- get date and time
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
\fB#include <tcl.h>\fR
|
||||
.sp
|
||||
long long
|
||||
\fBTcl_GetMonotonicTime\fR()
|
||||
.sp
|
||||
\fBTcl_GetTime\fR(\fItimePtr\fR)
|
||||
.sp
|
||||
\fBTcl_SetTimeProc\fR(\fIgetProc, scaleProc, clientData\fR)
|
||||
@@ -39,6 +42,15 @@ Pointer to place the currently registered pass-through value into.
|
||||
.BE
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
The \fBTcl_GetMonotonicTime\fR function returns the current monotonic time.
|
||||
The unit is micro-seconds.
|
||||
Only time differences are defined.
|
||||
The timer value 0 may be the epoc but may also be the start-up of the system.
|
||||
.PP
|
||||
The value is contigous but may jump due to timer virtualization or sleep mode.
|
||||
.PP
|
||||
The precision is system dependent and not guranteed to be micro-second precise.
|
||||
.PP
|
||||
The \fBTcl_GetTime\fR function retrieves the current time as a
|
||||
\fITcl_Time\fR structure in memory the caller provides. This
|
||||
structure has the following definition:
|
||||
@@ -58,53 +70,16 @@ is the point in time of 00:00 UTC, 1 January 1970. This number does
|
||||
.PP
|
||||
The \fIusec\fR member of the structure is filled in with the number of
|
||||
microseconds that have elapsed since the start of the second
|
||||
designated by \fIsec\fR. The Tcl library makes every effort to keep
|
||||
this number as precise as possible, subject to the limitations of the
|
||||
computer system. On multiprocessor variants of Windows, this number
|
||||
may be limited to the 10- or 20-ms granularity of the system clock.
|
||||
(On single-processor Windows systems, the \fIusec\fR field is derived
|
||||
from a performance counter and is highly precise.)
|
||||
designated by \fIsec\fR.
|
||||
.PP
|
||||
This command uses the system wall clock and is not contigous by definition.
|
||||
It may have large jumps in short time, specially if the system is awaked from
|
||||
sleep mode.
|
||||
.SS "VIRTUALIZED TIME"
|
||||
.PP
|
||||
The \fBTcl_SetTimeProc\fR function registers two related handler functions
|
||||
with the core. The first handler function is a replacement for
|
||||
\fBTcl_GetTime\fR, or rather the OS access made by
|
||||
\fBTcl_GetTime\fR. The other handler function is used by the Tcl
|
||||
notifier to convert wait/block times from the virtual domain into real
|
||||
time.
|
||||
.PP
|
||||
The \fBTcl_QueryTimeProc\fR function returns the currently registered
|
||||
handler functions. If no external handlers were set then this will
|
||||
return the standard handlers accessing and processing the native time
|
||||
of the OS. The arguments to the function are allowed to be NULL; and
|
||||
any argument which is NULL is ignored and not set.
|
||||
.PP
|
||||
The signatures of the handler functions are as follows:
|
||||
.PP
|
||||
.CS
|
||||
typedef void \fBTcl_GetTimeProc\fR(
|
||||
Tcl_Time *\fItimebuf\fR,
|
||||
void *\fIclientData\fR);
|
||||
typedef void \fBTcl_ScaleTimeProc\fR(
|
||||
Tcl_Time *\fItimebuf\fR,
|
||||
void *\fIclientData\fR);
|
||||
.CE
|
||||
.PP
|
||||
The \fItimebuf\fR fields contain the time to manipulate, and the
|
||||
\fIclientData\fR fields contain a pointer supplied at the time the handler
|
||||
functions were registered.
|
||||
.PP
|
||||
Any handler pair specified has to return data which is consistent between
|
||||
them. In other words, setting one handler of the pair to something assuming a
|
||||
10-times slowdown, and the other handler of the pair to something assuming a
|
||||
two-times slowdown is wrong and not allowed.
|
||||
.PP
|
||||
The set handler functions are allowed to run the delivered time backwards,
|
||||
however this should be avoided. We have to allow it as the native time can run
|
||||
backwards as the user can fiddle with the system time one way or other. Note
|
||||
that the insertion of the hooks will not change the behavior of the Tcl core
|
||||
with regard to this situation, i.e. the existing behavior is retained.
|
||||
The \fBTcl_SetTimeProc\fR and \fBTcl_QueryTimeProc\fR are not supported since TCL 9.1.
|
||||
They call a \fBTcl_Panic\fR.
|
||||
.SH "SEE ALSO"
|
||||
clock(n)
|
||||
clock(n), timer(n)
|
||||
.SH KEYWORDS
|
||||
date, time
|
||||
|
||||
+11
-2
@@ -9,7 +9,7 @@
|
||||
.so man.macros
|
||||
.BS
|
||||
.SH NAME
|
||||
Tcl_InitHashTable, Tcl_InitCustomHashTable, Tcl_InitObjHashTable, Tcl_DeleteHashTable, Tcl_CreateHashEntry, Tcl_DeleteHashEntry, Tcl_FindHashEntry, Tcl_GetHashValue, Tcl_SetHashValue, Tcl_GetHashKey, Tcl_FirstHashEntry, Tcl_NextHashEntry, Tcl_HashStats \- procedures to manage hash tables
|
||||
Tcl_InitHashTable, Tcl_InitCustomHashTable, Tcl_InitObjHashTable, Tcl_DeleteHashTable, Tcl_CreateHashEntry, Tcl_AttemptCreateHashEntry, Tcl_DeleteHashEntry, Tcl_FindHashEntry, Tcl_GetHashValue, Tcl_SetHashValue, Tcl_GetHashKey, Tcl_FirstHashEntry, Tcl_NextHashEntry, Tcl_HashStats \- procedures to manage hash tables
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
\fB#include <tcl.h>\fR
|
||||
@@ -25,6 +25,9 @@ Tcl_InitHashTable, Tcl_InitCustomHashTable, Tcl_InitObjHashTable, Tcl_DeleteHash
|
||||
Tcl_HashEntry *
|
||||
\fBTcl_CreateHashEntry\fR(\fItablePtr, key, newPtr\fR)
|
||||
.sp
|
||||
Tcl_HashEntry *
|
||||
\fBTcl_AttemptCreateHashEntry\fR(\fItablePtr, key, newPtr\fR)
|
||||
.sp
|
||||
\fBTcl_DeleteHashEntry\fR(\fIentryPtr\fR)
|
||||
.sp
|
||||
Tcl_HashEntry *
|
||||
@@ -170,10 +173,16 @@ If an entry already existed with the given key then \fI*newPtr\fR
|
||||
is set to zero.
|
||||
If a new entry was created, then \fI*newPtr\fR is set to a non-zero
|
||||
value and the value of the new entry will be set to zero.
|
||||
\fI*newPtr\fR is allowed to be NULL.
|
||||
The return value from \fBTcl_CreateHashEntry\fR is a pointer to
|
||||
the entry, which may be used to retrieve and modify the entry's
|
||||
value or to delete the entry from the table.
|
||||
.PP
|
||||
\fBTcl_AttemptCreateHashEntry\fR does the same as
|
||||
\fBTcl_CreateHashEntry\fR, except in case of a memory
|
||||
overflow. \fBTcl_AttemptCreateHashEntry\fR returns NULL
|
||||
in that case while \fBTcl_CreateHashEntry\fR panics.
|
||||
.PP
|
||||
\fBTcl_DeleteHashEntry\fR will remove an existing entry from a
|
||||
table.
|
||||
The memory associated with the entry itself will be freed, but
|
||||
@@ -276,7 +285,7 @@ The \fIhashKeyProc\fR member contains the address of a function called to
|
||||
calculate a hash value for the key.
|
||||
.PP
|
||||
.CS
|
||||
typedef TCL_HASH_TYPE \fBTcl_HashKeyProc\fR(
|
||||
typedef size_t \fBTcl_HashKeyProc\fR(
|
||||
Tcl_HashTable *\fItablePtr\fR,
|
||||
void *\fIkeyPtr\fR);
|
||||
.CE
|
||||
|
||||
+16
-11
@@ -17,20 +17,25 @@ const char *
|
||||
\fBTcl_InitSubsystems\fR()
|
||||
.fi
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
The \fBTcl_InitSubsystems\fR procedure initializes the Tcl
|
||||
library. This procedure is typically invoked as the very
|
||||
first thing in the application's main program.
|
||||
The \fBTcl_InitSubsystems\fR procedure initializes various Tcl subsystems. It
|
||||
should be called by any additional Tcl threads created after the main thread in
|
||||
a Tcl application that wish to use Tcl facilities without creating an
|
||||
interpreter. Threads that create interpreters using \fBTcl_CreateInterp\fR do
|
||||
not need to call this function, provided that \fBTcl_CreateInterp\fR is the
|
||||
first call into Tcl from that thread.
|
||||
.PP
|
||||
The result of \fBTcl_InitSubsystems\fR is the full Tcl version with
|
||||
build information (e.g., \fB9.0.0+abcdef...abcdef.gcc-1002\fR).
|
||||
Note that the main thread must have first called either \fBTclZipfs_AppHook\fR
|
||||
or \fBTcl_FindExecutable\fR to perform application-wide Tcl initialization
|
||||
before additional threads using Tcl are created. \fBTcl_InitSubsystems\fR does
|
||||
not suffice for this purpose and should only be used to initialize Tcl in
|
||||
secondary threads. It need not be called in the main thread invoking one of the
|
||||
two aforementioned functions.
|
||||
.PP
|
||||
\fBTcl_InitSubsystems\fR is very similar in use to
|
||||
\fBTcl_FindExecutable\fR. It can be used when Tcl is
|
||||
used as utility library, no other encodings than utf-8,
|
||||
iso8859-1 or utf-16 are used, and no interest exists in the
|
||||
value of \fBinfo nameofexecutable\fR. The system encoding will not
|
||||
be extracted from the environment, but falls back to utf-8.
|
||||
The result of \fBTcl_InitSubsystems\fR is the full Tcl version string,
|
||||
including build information (for example,
|
||||
\fB9.0.0+abcdef...abcdef.gcc-1002\fR).
|
||||
.SH KEYWORDS
|
||||
binary, executable file
|
||||
|
||||
+81
-31
@@ -4,11 +4,11 @@
|
||||
'\" See the file "license.terms" for information on usage and redistribution
|
||||
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
'\"
|
||||
.TH Tcl_ListObj 3 8.0 Tcl "Tcl Library Procedures"
|
||||
.TH Tcl_ListObj 3 9.1 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
.SH NAME
|
||||
Tcl_ListObjAppendList, Tcl_ListObjAppendElement, Tcl_NewListObj, Tcl_SetListObj, Tcl_ListObjGetElements, Tcl_ListObjLength, Tcl_ListObjIndex, Tcl_ListObjReplace \- manipulate Tcl values as lists
|
||||
Tcl_ListObjAppendList, Tcl_ListObjAppendElement, Tcl_NewListObj, Tcl_SetListObj, Tcl_ListObjGetElements, Tcl_ListObjLength, Tcl_ListObjIndex, Tcl_ListObjReplace, Tcl_ListObjRange, Tcl_ListObjRepeat, Tcl_ListObjReverse \- manipulate Tcl values as lists
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
\fB#include <tcl.h>\fR
|
||||
@@ -35,6 +35,15 @@ int
|
||||
.sp
|
||||
int
|
||||
\fBTcl_ListObjReplace\fR(\fIinterp, listPtr, first, count, objc, objv\fR)
|
||||
.sp
|
||||
int
|
||||
\fBTcl_ListObjRange\fR(\fIinterp, listPtr, first, last, objPtrPtr\fR)
|
||||
.sp
|
||||
int
|
||||
\fBTcl_ListObjRepeat\fR(\fIinterp, count, objc, objv, objPtrPtr\fR)
|
||||
.sp
|
||||
int
|
||||
\fBTcl_ListObjReverse\fR(\fIinterp, listPtr, objPtrPtr\fR)
|
||||
.fi
|
||||
.SH ARGUMENTS
|
||||
.AS "Tcl_Obj *const" *elemListPtr in/out
|
||||
@@ -43,9 +52,12 @@ If an error occurs while converting a value to be a list value,
|
||||
an error message is left in the interpreter's result value
|
||||
unless \fIinterp\fR is NULL.
|
||||
.AP Tcl_Obj *listPtr in/out
|
||||
Points to the list value to be manipulated.
|
||||
Points to the input list value.
|
||||
If \fIlistPtr\fR does not already point to a list value,
|
||||
an attempt will be made to convert it to one.
|
||||
Some functions may store a reference to it internally so
|
||||
care must be taken when managing its reference count.
|
||||
See the \fBREFERENCE COUNT MANAGEMENT\fR section below.
|
||||
.AP Tcl_Obj *elemListPtr in/out
|
||||
For \fBTcl_ListObjAppendList\fR, this points to a list value
|
||||
containing elements to be appended onto \fIlistPtr\fR.
|
||||
@@ -72,16 +84,9 @@ trigger proper error-handling), otherwise expect it to crash.
|
||||
A location where \fBTcl_ListObjGetElements\fR stores a pointer to an array
|
||||
of pointers to the element values of \fIlistPtr\fR.
|
||||
.AP Tcl_Size objc in
|
||||
The number of Tcl values that \fBTcl_NewListObj\fR
|
||||
will insert into a new list value,
|
||||
and \fBTcl_ListObjReplace\fR will insert into \fIlistPtr\fR.
|
||||
For \fBTcl_SetListObj\fR,
|
||||
the number of Tcl values to insert into \fIobjPtr\fR.
|
||||
The number of Tcl values in the \fIobjv\fR array.
|
||||
.AP "Tcl_Obj *const" objv[] in
|
||||
An array of pointers to values.
|
||||
\fBTcl_NewListObj\fR will insert these values into a new list value
|
||||
and \fBTcl_ListObjReplace\fR will insert them into an existing \fIlistPtr\fR.
|
||||
Each value will become a separate list element.
|
||||
An array of pointers to Tcl values.
|
||||
.AP "Tcl_Size \&| int" *lengthPtr out
|
||||
Points to location where \fBTcl_ListObjLength\fR
|
||||
stores the length of the list.
|
||||
@@ -95,23 +100,22 @@ Index of the list element that \fBTcl_ListObjIndex\fR
|
||||
is to return.
|
||||
The first element has index 0.
|
||||
.AP Tcl_Obj **objPtrPtr out
|
||||
Points to place where \fBTcl_ListObjIndex\fR is to store
|
||||
a pointer to the resulting list element value.
|
||||
Points to location to store an output list or element value. No assumptions
|
||||
should be made about the reference count of the returned value.
|
||||
See the \fBREFERENCE COUNT MANAGEMENT\fR section below.
|
||||
.AP Tcl_Size first in
|
||||
Index of the starting list element that \fBTcl_ListObjReplace\fR
|
||||
is to replace.
|
||||
The list's first element has index 0.
|
||||
Index of the first element in a range of elements in a list.
|
||||
.AP Tcl_Size last in
|
||||
Index of the last element in a range of elements in a list.
|
||||
.AP Tcl_Size count in
|
||||
The number of elements that \fBTcl_ListObjReplace\fR
|
||||
is to replace.
|
||||
The number of elements to be operated on or a repetition count.
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
Tcl list values have an internal representation that supports
|
||||
the efficient indexing and appending.
|
||||
The procedures described in this man page are used to
|
||||
create, modify, index, and append to Tcl list values from C code.
|
||||
create, modify, access, and transform Tcl list values from C code.
|
||||
.PP
|
||||
\fBTcl_ListObjAppendList\fR and \fBTcl_ListObjAppendElement\fR
|
||||
both add one or more values
|
||||
@@ -209,7 +213,6 @@ change from Tcl 8 where all list elements always have a reference
|
||||
count of at least 1. (See \fBABSTRACT LIST TYPES\fR, \fBSTORAGE
|
||||
MANAGEMENT OF VALUES\fR, Tcl_BounceRefCount(3), and lseq(n) for more
|
||||
information.)
|
||||
|
||||
.PP
|
||||
\fBTcl_ListObjReplace\fR replaces zero or more elements
|
||||
of the list referenced by \fIlistPtr\fR
|
||||
@@ -268,8 +271,44 @@ with a NULL \fIobjvPtr\fR:
|
||||
result = \fBTcl_ListObjReplace\fR(interp, listPtr, first, count,
|
||||
0, NULL);
|
||||
.CE
|
||||
.PP
|
||||
\fBTcl_ListObjRange\fR stores in \fIobjPtrPtr\fR a pointer to a list value
|
||||
containing all elements in the passed input list \fIlistPtr\fR at indices
|
||||
between \fIfirst\fR and \fIlast\fR, both inclusive. An empty
|
||||
list is returned in the case of \fIfirst\fR being greater than \fIlast\fR.
|
||||
.PP
|
||||
\fBTcl_ListObjRepeat\fR stores in \fIobjPtrPtr\fR a pointer to a list value
|
||||
whose elements are the \fIobjc\fR elements passed in \fIobjv\fR, repeated
|
||||
\fIcount\fR number of times. An error is raised if \fIcount\fR is negative.
|
||||
.PP
|
||||
\fBTcl_ListObjReverse\fR stores in \fIobjPtrPtr\fR a pointer to a list value
|
||||
containing all elements of the input list \fIlistPtr\fR in reverse order.
|
||||
.PP
|
||||
For all three functions, \fBTcl_ListObjRange\fR, \fBTcl_ListObjRepeat\fR and
|
||||
\fBTcl_ListObjReverse\fR, the value passed in \fIlistPtr\fR need not be unshared.
|
||||
The pointer stored at \fIobjPtrPtr\fR is guaranteed to be different from
|
||||
\fIlistPtr\fR but no assumptions should be made about its reference count.
|
||||
In case of errors, the location addressed by \fIobjPtrPtr\fR may have been
|
||||
modified and should be treated by the caller as undefined.
|
||||
.SH "REFERENCE COUNT MANAGEMENT"
|
||||
.PP
|
||||
Care must be taken by callers when managing the reference count
|
||||
of values passed in as well as values returned from the above functions.
|
||||
.PP
|
||||
Unless specified otherwise below, the above functions may internally
|
||||
keep a reference to the value passed in \fIlistPtr\fR and increment its
|
||||
reference count. Therefore, if \fIlistPtr\fR is newly allocated and has
|
||||
a zero reference count, it should not be freed after the call with
|
||||
\fBTcl_DecrRefCount\fR. Rather, use \fBTcl_BounceRefCount\fR instead.
|
||||
Furthermore, if \fIlistPtr\fR was retrieved from the interpreter result
|
||||
(e.g. via \fBTcl_GetObjResult\fR) and that is the only reference to the
|
||||
value, it may be deleted if a function sets the interpreter result on
|
||||
error. The more general and safe method for passing values is to
|
||||
increment their reference counts with \fBTcl_IncrRefCount\fR prior to
|
||||
the call and release them with \fBTcl_DecrRefCount\fR when the call
|
||||
returns. However, this may preclude certain optimizations based on
|
||||
modifying unshared values in-place.
|
||||
.PP
|
||||
\fBTcl_NewListObj\fR always returns a zero-reference object, much like
|
||||
\fBTcl_NewObj\fR. If a non-NULL \fIobjv\fR argument is given, the reference
|
||||
counts of the first \fIobjc\fR values in that array are incremented.
|
||||
@@ -279,20 +318,31 @@ argument, but does require that the object be unshared. The reference counts
|
||||
of the first \fIobjc\fR values in the \fIobjv\fR array are incremented.
|
||||
.PP
|
||||
\fBTcl_ListObjGetElements\fR, \fBTcl_ListObjIndex\fR, and
|
||||
\fBTcl_ListObjLength\fR do not modify the reference count of their
|
||||
\fIlistPtr\fR arguments; they only read. Note however that these three
|
||||
functions may set the interpreter result; if that is the only place that is
|
||||
holding a reference to the object, it will be deleted.
|
||||
\fBTcl_ListObjLength\fR do not modify the reference count of the
|
||||
\fIlistPtr\fR argument except on error when the interpreter
|
||||
result holds a reference to it as described earlier.
|
||||
.PP
|
||||
\fBTcl_ListObjAppendList\fR, \fBTcl_ListObjAppendElement\fR, and
|
||||
\fBTcl_ListObjReplace\fR require an unshared \fIlistPtr\fR argument.
|
||||
\fBTcl_ListObjAppendList\fR only reads its \fIelemListPtr\fR argument.
|
||||
\fBTcl_ListObjAppendElement\fR increments the reference count of its
|
||||
\fIobjPtr\fR on success. \fBTcl_ListObjReplace\fR increments the reference
|
||||
count of the first \fIobjc\fR values in the \fIobjv\fR array on success. Note
|
||||
however that all these three functions may set the interpreter result on
|
||||
failure; if that is the only place that is holding a reference to the object,
|
||||
it will be deleted.
|
||||
\fIobjPtr\fR on success. \fBTcl_ListObjReplace\fR increments the
|
||||
reference count of the first \fIobjc\fR values in the \fIobjv\fR array
|
||||
on success. Note that the same caveat stated earlier applies if the
|
||||
interpreter result holds a reference to \fIlistPtr\fR.
|
||||
.PP
|
||||
The pointer to a result value returned in \fIobjPtrPtr\fR by the
|
||||
functions \fBTcl_ListObjRange\fR,
|
||||
\fBTcl_ListObjRepeat\fR and \fBTcl_ListObjReverse\fR is guaranteed
|
||||
to be different from the \fBlistPtr\fR passed in. It is therefore
|
||||
safe to manage its reference count independently from that of
|
||||
\fBlistPtr\fR. No assumptions should be made about its reference
|
||||
count and the standard reference counting idiom should be followed.
|
||||
The caller can pass it to a function such as \fBTcl_SetObjResult\fR,
|
||||
\fBTcl_ListObjAppendElement\fR etc. which take ownership of
|
||||
its reference count management or dispose of the value itself
|
||||
with either a \fBTcl_IncrRefCount\fR/\fBTcl_DecrRefCount\fR pair or
|
||||
\fBTcl_BounceRefCount\fR.
|
||||
.SH "SEE ALSO"
|
||||
Tcl_NewObj(3), Tcl_DecrRefCount(3), Tcl_IncrRefCount(3), Tcl_GetObjResult(3)
|
||||
.SH KEYWORDS
|
||||
|
||||
@@ -162,7 +162,7 @@ int
|
||||
\fITheCmdOldObjProc\fR(
|
||||
void *clientData,
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
int result;
|
||||
@@ -176,7 +176,7 @@ int
|
||||
|
||||
return result;
|
||||
}
|
||||
\fBTcl_CreateObjCommand\fR(interp, "theCommand",
|
||||
\fBTcl_CreateObjCommand2\fR(interp, "theCommand",
|
||||
\fITheCmdOldObjProc\fR, clientData, TheCmdDeleteProc);
|
||||
.CE
|
||||
.PP
|
||||
@@ -193,10 +193,10 @@ int
|
||||
\fITheCmdOldObjProc\fR(
|
||||
void *clientData,
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
return \fBTcl_NRCallObjProc\fR(interp, \fITheCmdNRObjProc\fR,
|
||||
return \fBTcl_NRCallObjProc2\fR(interp, \fITheCmdNRObjProc\fR,
|
||||
clientData, objc, objv);
|
||||
}
|
||||
.CE
|
||||
@@ -206,7 +206,7 @@ int
|
||||
\fITheCmdNRObjProc\fR
|
||||
void *clientData,
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
Tcl_Obj *objPtr;
|
||||
|
||||
+20
-5
@@ -349,8 +349,9 @@ without converting the value to a List type. This requires the custom
|
||||
type to provide functions that will perform the given operation on the
|
||||
custom data representation. Not all functions are required. In the
|
||||
absence of a particular function (set to NULL), the fallback is to
|
||||
allow the internal List operation to perform the operation, most
|
||||
likely causing the value type to be converted to a traditional list.
|
||||
allow the internal List operation to perform the operation, which
|
||||
may possibly cause the value type to be converted to a traditional
|
||||
list.
|
||||
.SS "SCALAR VALUE TYPES"
|
||||
.PP
|
||||
For a custom value type that is scalar or atomic in nature, i.e., not
|
||||
@@ -364,6 +365,17 @@ Version 2, \fBTCL_OBJTYPE_V2\fR, allows full List support when the
|
||||
functions described below are provided. This allows for script level
|
||||
use of the List commands without causing the type of the Tcl_Obj value
|
||||
to be converted to a list.
|
||||
|
||||
Unless specified otherwise, all functions specific to Version 2 should return
|
||||
\fBTCL_OK\fR on success and \fBTCL_ERROR\fR on failure.
|
||||
|
||||
In the case that a \fBTcl_Obj*\fR is also returned, the reference count of the
|
||||
returned \fBTcl_Obj\fR should not be incremented so, for example, if a new
|
||||
\fBTcl_Obj\fR value is returned it should have a reference count of zero.
|
||||
|
||||
The functions should not assume that any \fBTcl_Obj\fR passed in
|
||||
is unshared.
|
||||
|
||||
.SS "THE LENGTHPROC FIELD"
|
||||
.PP
|
||||
The \fBLengthProc\fR function correlates with the \fBTcl_ListObjLength\fR
|
||||
@@ -378,8 +390,11 @@ typedef Tcl_Size
|
||||
.SS "THE INDEXPROC FIELD"
|
||||
.PP
|
||||
The \fBIndexProc\fR function correlates with with the
|
||||
\fBTcl_ListObjIndex\fR C API. The function returns a Tcl_Obj value for
|
||||
the element at the specified index.
|
||||
\fBTcl_ListObjIndex\fR C API. The function should store a pointer to
|
||||
the element at the specified \fBindex\fR in \fB*elemObj\fR.
|
||||
Indices that are out of bounds should not be treated as errors;
|
||||
rather, the function should store a null pointer and
|
||||
return TCL_OK.
|
||||
.CS
|
||||
typedef int (\fBTcl_ObjTypeIndexProc\fR) (
|
||||
Tcl_Interp *interp,
|
||||
@@ -404,7 +419,7 @@ typedef int (\fBTcl_ObjTypeSliceProc\fR) (
|
||||
.PP
|
||||
The \fBReverseProc\fR correlates with the \fBlreverse\fR command,
|
||||
returning a List or Abstract List that has the same elements as the
|
||||
input Abstract List, with the elements in the reverse order.
|
||||
input Abstract List, but in reverse order.
|
||||
.CS
|
||||
typedef int (\fBTcl_ObjTypeReverseProc\fR) (
|
||||
Tcl_Interp *interp,
|
||||
|
||||
+13
-5
@@ -16,20 +16,28 @@ Tcl_Sleep \- delay execution for a given number of milliseconds
|
||||
.sp
|
||||
\fBTcl_Sleep\fR(\fIms\fR)
|
||||
.fi
|
||||
\fBTcl_SleepMicroSeconds\fR(\fIus\fR)
|
||||
.fi
|
||||
.SH ARGUMENTS
|
||||
.AS int ms
|
||||
.AP int ms in
|
||||
Number of milliseconds to sleep.
|
||||
.AS long long us
|
||||
.AP long long us in
|
||||
Number of micro-seconds to sleep.
|
||||
.BE
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
This procedure delays the calling process by the number of
|
||||
milliseconds given by the \fIms\fR parameter and returns
|
||||
after that time has elapsed. It is typically used for things
|
||||
like flashing a button, where the delay is short and the
|
||||
Those procedures delays the calling process by the given time
|
||||
and return after the time has elapsed.
|
||||
The two variants of the command only differ in thue time unit.
|
||||
\fBTcl_Sleep\fR uses milli-seconds, while, \fBTcl_SleepMicroSeconds\fR
|
||||
uses micro-seconds.
|
||||
They are typically used for things like flashing a button,
|
||||
where the delay is short and the
|
||||
application need not do anything while it waits. For longer
|
||||
delays where the application needs to respond to other events
|
||||
during the delay, the procedure \fBTcl_CreateTimerHandler\fR
|
||||
should be used instead of \fBTcl_Sleep\fR.
|
||||
should be used instead of those commands.
|
||||
.SH KEYWORDS
|
||||
sleep, time, wait
|
||||
|
||||
+11
-1
@@ -8,7 +8,7 @@
|
||||
.so man.macros
|
||||
.BS
|
||||
.SH NAME
|
||||
Tcl_NewStringObj, Tcl_NewUnicodeObj, Tcl_SetStringObj, Tcl_SetUnicodeObj, Tcl_GetStringFromObj, Tcl_GetString, Tcl_GetUnicodeFromObj, Tcl_GetUnicode, Tcl_GetUniChar, Tcl_GetCharLength, Tcl_GetRange, Tcl_AppendToObj, Tcl_AppendUnicodeToObj, Tcl_AppendObjToObj, Tcl_AppendStringsToObj, Tcl_AppendLimitedToObj, Tcl_Format, Tcl_AppendFormatToObj, Tcl_ObjPrintf, Tcl_AppendPrintfToObj, Tcl_SetObjLength, Tcl_AttemptSetObjLength, Tcl_ConcatObj \- manipulate Tcl values as strings
|
||||
Tcl_NewStringObj, Tcl_NewUnicodeObj, Tcl_SetStringObj, Tcl_SetUnicodeObj, Tcl_GetStringFromObj, Tcl_GetString, Tcl_GetUnicodeFromObj, Tcl_GetUnicode, Tcl_GetUniChar, Tcl_GetCharLength, Tcl_GetRange, Tcl_AppendToObj, Tcl_AppendUnicodeToObj, Tcl_AppendObjToObj, Tcl_AppendStringsToObj, Tcl_AppendLimitedToObj, Tcl_Format, Tcl_AppendFormatToObj, Tcl_ObjPrintf, Tcl_AppendPrintfToObj, Tcl_SetObjLength, Tcl_AttemptSetObjLength, Tcl_ConcatObj, Tcl_IsEmpty \- manipulate Tcl values as strings
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
\fB#include <tcl.h>\fR
|
||||
@@ -81,6 +81,9 @@ int
|
||||
.sp
|
||||
Tcl_Obj *
|
||||
\fBTcl_ConcatObj\fR(\fIobjc, objv\fR)
|
||||
.sp
|
||||
int
|
||||
\fBTcl_IsEmpty\fR(\fIfIobjPtr\fR)
|
||||
.fi
|
||||
.SH ARGUMENTS
|
||||
.AS "const Tcl_UniChar" *appendObjPtr in/out
|
||||
@@ -404,6 +407,13 @@ white space, then that value is ignored entirely. This white-space
|
||||
removal was added to make the output of the \fBconcat\fR command
|
||||
cleaner-looking. \fBTcl_ConcatObj\fR returns a pointer to a
|
||||
newly-created value whose ref count is zero.
|
||||
.PP
|
||||
The \fBTcl_IsEmpty\fR function returns 1 if \fIobjPtr\fR is the empty
|
||||
string, 0 otherwise.
|
||||
It doesn't generate the string representation (unless there
|
||||
is no other way to do it), so it can safely be called on lists with
|
||||
billions of elements, or any other data structure for which
|
||||
it is impossible or expensive to construct the string representation.
|
||||
.SH "REFERENCE COUNT MANAGEMENT"
|
||||
.PP
|
||||
\fBTcl_NewStringObj\fR, \fBTcl_NewUnicodeObj\fR, \fBTcl_Format\fR,
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
'\"
|
||||
'\" Copyright (c) 2025 Ashok P. Nadkarni
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution
|
||||
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
'\"
|
||||
.TH Tcl_UtfToNormalized 3 "9.1" Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
.SH NAME
|
||||
Tcl_UtfToNormalized, Tcl_UtfToNormalizedDString \- procedures for Unicode normalization
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
\fB#include <tcl.h>\fR
|
||||
.sp
|
||||
int
|
||||
\fBTcl_UtfToNormalized\fR(\fIinterp, src, numBytes, normForm, profile, dst, dstLen, dstWrotePtr\fR)
|
||||
.sp
|
||||
int
|
||||
\fBTcl_UtfToNormalizedDString\fR(\fIinterp, src, numBytes, normForm, profile, dstPtr\fR)
|
||||
.fi
|
||||
.SH ARGUMENTS
|
||||
.AP Tcl_Interp *interp in
|
||||
Interpreter to use for error reporting, or NULL if no error reporting is
|
||||
desired.
|
||||
.AP "const char" *src in
|
||||
An array of bytes in Tcl's internal UTF-8 based encoding.
|
||||
.AP Tcl_Size numBytes in
|
||||
Length of \fIsrc\fR in bytes. If the length is negative,
|
||||
the length includes all bytes until the first nul byte.
|
||||
.AP char *dst out
|
||||
Buffer in which the converted result will be stored. No more than
|
||||
\fIdstLen\fR bytes will be stored in \fIdst\fR.
|
||||
.AP Tcl_Size dstLen in
|
||||
The size of the output buffer \fIdst\fR in bytes.
|
||||
.AP Tcl_Size *dstWrotePtr out
|
||||
Filled with the number of bytes in the normalized string. This number
|
||||
does not include the terminating nul character.
|
||||
May be NULL.
|
||||
.AP Tcl_UnicodeNormalizationForm normForm in
|
||||
Must be one of the \fBTcl_UnicodeNormalizationForm\fR members
|
||||
\fBTCL_NFC\fR, \fBTCL_NFD\fR, \fBTCL_NFKC\fR or \fBTCL_NFKD\fR specifying
|
||||
the Unicode normalization type.
|
||||
.AP int profile in/out
|
||||
The encoding profile as described in the \fBTcl_GetEncoding\fR documentation.
|
||||
Must be either \fBTCL_ENCODING_PROFILE_STRICT\fR
|
||||
or \fBTCL_ENCODING_PROFILE_REPLACE\fR.
|
||||
.AP Tcl_DString *dstPtr out
|
||||
Pointer to an uninitialized or free \fBTcl_DString\fR in which the converted
|
||||
result, which is also encoded in Tcl's internal UTF-8 encoding, will be stored.
|
||||
The function initializes the storage and caller must call
|
||||
\fBTcl_DStringFree\fR on success.
|
||||
.BE
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
The \fBTcl_UtfToNormalized\fR and \fBTcl_UtfToNormalizedDString\fR functions
|
||||
transform the passed string into one of the standard normalization forms defined
|
||||
in the Unicode standard. The normalization form is specified via the
|
||||
\fInormForm\fR argument which must have one of the values \fBTCL_NFC\fR,
|
||||
\fBTCL_NFD\fR, \fBTCL_NFKC\fR or \fBTCL_NFKD\fR corresponding to the Unicode
|
||||
normalization forms \fBNormalization Form C\fR (NFC), \fBNormalization Form D\fR
|
||||
(NFD), \fBNormalization Form KC\fR (NFKC) and \fBNormalization Form KD\fR (NFKD)
|
||||
respectively. For details on the above normalization forms, refer to Section
|
||||
3.11 of the Unicode standard
|
||||
(https://www.unicode.org/versions/Unicode16.0.0/core-spec/chapter-3/).
|
||||
.PP
|
||||
The \fBTcl_UtfToNormalized\fR function stores the normalized result
|
||||
in the buffer provided by the caller through the \fIdst\fR argument. The
|
||||
result is nul terminated but the nul is not included in the count of
|
||||
stored bytes returned in \fIdstWrotePtr\fR. The function returns TCL_OK
|
||||
on success, TCL_CONVERT_NOSPACE if there is insufficient room in the output
|
||||
buffer and TCL_ERROR in case of other failures. In the latter two cases,
|
||||
an error message is stored in \fIinterp\fR if it is not NULL.
|
||||
.PP
|
||||
The \fBTcl_UtfToNormalizedDString\fR function stores the normalized result
|
||||
in \fIdstPtr\fR which must eventually be freed by caller through
|
||||
\fBTcl_DStringFree\fR. The function returns TCL_OK on success and
|
||||
TCL_ERROR on failure with an error message in \fIinterp\fR if it is not NULL.
|
||||
.SH "SEE ALSO"
|
||||
unicode(n)
|
||||
.SH KEYWORDS
|
||||
utf, Unicode, normalize
|
||||
+20
-4
@@ -24,8 +24,9 @@ after \- Execute a command after a time delay
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
This command is used to delay execution of the program or to execute
|
||||
a command in background sometime in the future. It has several forms,
|
||||
depending on the first argument to the command:
|
||||
a command in background sometime in the future.
|
||||
This command uses a monotonic clock if available.
|
||||
It has several forms, depending on the first argument to the command:
|
||||
.\" METHOD: <none>
|
||||
.TP
|
||||
\fBafter \fIms\fR
|
||||
@@ -62,7 +63,7 @@ which will wait for next round of events).
|
||||
Cancels the execution of a delayed command that
|
||||
was previously scheduled.
|
||||
\fIId\fR indicates which command should be canceled; it must have
|
||||
been the return value from a previous \fBafter\fR command.
|
||||
been the return value from a previous \fBafter\fR or \fBtimer\fR command.
|
||||
If the command given by \fIid\fR has already been executed then
|
||||
the \fBafter cancel\fR command has no effect.
|
||||
.TP
|
||||
@@ -105,6 +106,9 @@ The first element of the list is the script associated
|
||||
with \fIid\fR, and the second element is either
|
||||
\fBidle\fR or \fBtimer\fR to indicate what kind of event
|
||||
handler it is.
|
||||
Monotonic and wall clock events have the kind \fBtimer\fR.
|
||||
Use \fBtimer info\fR to differntiate between the two clocks and to
|
||||
retrieve the scheduled event time.
|
||||
.LP
|
||||
The \fBafter \fIms\fR and \fBafter idle\fR forms of the command
|
||||
assume that the application is event driven: the delayed commands
|
||||
@@ -112,6 +116,10 @@ will not be executed unless the application enters the event loop.
|
||||
In applications that are not normally event-driven, such as
|
||||
\fBtclsh\fR, the event loop can be entered with the \fBvwait\fR
|
||||
and \fBupdate\fR commands.
|
||||
.SH "TIME MAXIMUM VALUE"
|
||||
The argument \fIdelay\fR is bound to a resulting 63 bit monotonic clock value
|
||||
(in unit microseconds).
|
||||
Any higher value (which is after year 294441) will result in a \fBtime to far\fR error.
|
||||
.SH "EXAMPLES"
|
||||
This defines a command to make Tcl do nothing at all for \fIN\fR
|
||||
seconds:
|
||||
@@ -148,8 +156,16 @@ proc doOneStep {} {
|
||||
}
|
||||
doOneStep
|
||||
.CE
|
||||
.SH "MAXIMUM TIME"
|
||||
The maximum supported time point is bound to a 63 bit microseconds value.
|
||||
This is minimum around year 294441.
|
||||
Specifying time delays resulting in larger monotonic time values will raise an error.
|
||||
.SH "COMPATIBILITY"
|
||||
This command uses a monotonic clock if available.
|
||||
All versions prior to 9.1 used a wall clock for this command.
|
||||
The new \fBtimer\fR command features options using the wall clock.
|
||||
.SH "SEE ALSO"
|
||||
concat(n), interp(n), update(n), vwait(n)
|
||||
concat(n), interp(n), timer(n), update(n), vwait(n)
|
||||
.SH KEYWORDS
|
||||
cancel, delay, idle callback, sleep, time
|
||||
'\" Local Variables:
|
||||
|
||||
+13
-5
@@ -9,13 +9,14 @@
|
||||
clock \- Obtain and manipulate dates and times
|
||||
.SH "SYNOPSIS"
|
||||
.nf
|
||||
\fBpackage require Tcl 8.5-\fR
|
||||
\fBpackage require Tcl 9.1-\fR
|
||||
|
||||
\fBclock add\fI timeVal\fR ?\fIcount unit ...\fR? ?\fI\-option value\fR?
|
||||
\fBclock clicks\fR ?\fI\-option\fR?
|
||||
\fBclock format\fI timeVal\fR ?\fI\-option value ...\fR?
|
||||
\fBclock microseconds\fR
|
||||
\fBclock milliseconds\fR
|
||||
\fBclock monotonic\fR
|
||||
\fBclock scan\fI inputString\fR ?\fI\-option value ...\fR?
|
||||
\fBclock seconds\fR
|
||||
.fi
|
||||
@@ -63,13 +64,18 @@ See \fBFORMATTING TIMES\fR for a full description.
|
||||
.TP
|
||||
\fBclock microseconds\fR
|
||||
.
|
||||
Returns the current time as an integer number of microseconds.
|
||||
Returns the current wall clock time as an integer number of microseconds.
|
||||
See \fBHIGH RESOLUTION TIMERS\fR for a full description.
|
||||
.\" METHOD: milliseconds
|
||||
.TP
|
||||
\fBclock milliseconds\fR
|
||||
.
|
||||
Returns the current time as an integer number of milliseconds.
|
||||
Returns the current wall clock time as an integer number of milliseconds.
|
||||
See \fBHIGH RESOLUTION TIMERS\fR for a full description.
|
||||
.TP
|
||||
\fBclock monotonic\fR
|
||||
.
|
||||
Returns the current monontonic clock value in microseconds.
|
||||
See \fBHIGH RESOLUTION TIMERS\fR for a full description.
|
||||
.\" METHOD: scan
|
||||
.TP
|
||||
@@ -82,7 +88,7 @@ See \fBSCANNING TIMES\fR for a full description.
|
||||
.TP
|
||||
\fBclock seconds\fR
|
||||
.
|
||||
Returns the current time as an integer number of seconds.
|
||||
Returns the current wall clock time as an integer number of seconds.
|
||||
.SS "PARAMETERS"
|
||||
.TP
|
||||
\fIcount\fR
|
||||
@@ -322,7 +328,7 @@ are evaluated consecutively, from left to right.
|
||||
.PP
|
||||
Most of the subcommands supported by the \fBclock\fR command deal with
|
||||
times represented as a count of seconds from the epoch time, and this is the
|
||||
representation that \fBclock seconds\fR returns. There are three exceptions,
|
||||
representation that \fBclock seconds\fR returns. There are four exceptions,
|
||||
which are all intended for use where higher-resolution times are required.
|
||||
\fBclock milliseconds\fR returns the count of milliseconds from the
|
||||
epoch time, and \fBclock microseconds\fR returns the count of microseconds
|
||||
@@ -333,6 +339,8 @@ of \fBclock clicks\fR is not guaranteed to be tied to any fixed
|
||||
epoch; it is simply intended to be the most precise interval timer
|
||||
available, and is intended only for relative timing studies such as
|
||||
benchmarks.
|
||||
\fBclock monotonic\fR is a system monotonic clock and has no fixed start value.
|
||||
As a difference to the others, it is guranteed to be contiguous.
|
||||
.SH "FORMATTING TIMES"
|
||||
.PP
|
||||
The \fBclock format\fR command produces times for display to a user
|
||||
|
||||
+1
-1
@@ -83,7 +83,7 @@ A suspended coroutine (i.e., one that has \fByield\fRed or \fByieldto\fR-d)
|
||||
may have its state inspected (or modified) at that point by using
|
||||
\fBcoroprobe\fR to run a command at the point where the coroutine is at. The
|
||||
command takes the name of the coroutine to run the command in, \fIcoroName\fR,
|
||||
and the name of a command (any any arguments it requires) to immediately run
|
||||
and the name of a command (and any arguments it requires) to immediately run
|
||||
at that point. The result of that command is the result of the \fBcoroprobe\fR
|
||||
command, and the gross state of the coroutine remains the same afterwards
|
||||
(i.e., the coroutine is still expecting the results of a \fByield\fR or
|
||||
|
||||
+3
-1
@@ -413,7 +413,9 @@ unless the \fB\-force\fR option is specified. When operating inside a
|
||||
single filesystem, Tcl will rename symbolic links rather than the
|
||||
things that they point to. Trying to overwrite a non-empty directory,
|
||||
overwrite a directory with a file, or a file with a directory will all
|
||||
result in errors. Arguments are processed in the order specified,
|
||||
result in errors. There is no guarantee that metadata such as attributes
|
||||
or access control lists are preserved by the command.
|
||||
Arguments are processed in the order specified,
|
||||
halting at the first error, if any. A \fB\-\|\-\fR marks the end of
|
||||
switches; the argument following the \fB\-\|\-\fR will be treated as a
|
||||
\fIsource\fR even if it starts with a \fB\-\fR.
|
||||
|
||||
@@ -390,6 +390,16 @@ may get stack overflows before reaching the limit set by the command. If
|
||||
this happens, see if there is a mechanism in your system for increasing
|
||||
the maximum size of the C stack.
|
||||
.RE
|
||||
.\" METHOD: set
|
||||
.TP
|
||||
\fBinterp set\fI path varName\fR ?\fIvalue\fR?
|
||||
.VS 9.1
|
||||
Writes to, or reads from, the variable \fIvarName\fR in the interpreter
|
||||
specifed by \fIpath\fR. If \fIvalue\fR is given, writes to the variable and
|
||||
returns its new value; if \fIvalue\fR is omitted, reads from the variable.
|
||||
As with the \fBset\fR command, traces may affect what the value of the
|
||||
variable is.
|
||||
.VE 9.1
|
||||
.\" METHOD: share
|
||||
.TP
|
||||
\fBinterp share\fI srcPath channel destPath\fR
|
||||
@@ -601,6 +611,16 @@ may get stack overflows before reaching the limit set by the command. If
|
||||
this happens, see if there is a mechanism in your system for increasing
|
||||
the maximum size of the C stack.
|
||||
.RE
|
||||
.\" METHOD: set
|
||||
.TP
|
||||
\fIchild \fBset\fR \fIvarName\fR ?\fIvalue\fR?
|
||||
.VS 9.1
|
||||
Writes to, or reads from, the variable \fIvarName\fR in the \fIchild\fR
|
||||
interpreter. If \fIvalue\fR is given, writes to the variable and
|
||||
returns its new value; if \fIvalue\fR is omitted, reads from the variable.
|
||||
As with the \fBset\fR command, traces may affect what the value of the
|
||||
variable is.
|
||||
.VE 9.1
|
||||
.SH "SAFE INTERPRETERS"
|
||||
.PP
|
||||
A safe interpreter is one with restricted functionality, so that
|
||||
|
||||
+2
-2
@@ -150,7 +150,7 @@ The following is a minimal extension:
|
||||
#include <tcl.h>
|
||||
#include <stdio.h>
|
||||
static int fooCmd(void *clientData,
|
||||
Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) {
|
||||
Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) {
|
||||
printf("called with %d arguments\en", objc);
|
||||
return TCL_OK;
|
||||
}
|
||||
@@ -159,7 +159,7 @@ int Foo_Init(Tcl_Interp *interp) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
printf("creating foo command");
|
||||
Tcl_CreateObjCommand(interp, "foo", fooCmd, NULL, NULL);
|
||||
Tcl_CreateObjCommand2(interp, "foo", fooCmd, NULL, NULL);
|
||||
return TCL_OK;
|
||||
}
|
||||
.CE
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@
|
||||
registry \- Manipulate the Windows registry
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
\fBpackage require registry 1.3\fR
|
||||
\fBpackage require registry 1.4\fR
|
||||
|
||||
\fBregistry \fR?\fI\-mode\fR? \fIoption keyName\fR ?\fIarg arg ...\fR?
|
||||
.fi
|
||||
|
||||
+15
@@ -13,7 +13,10 @@
|
||||
.SH NAME
|
||||
subst \- Perform backslash, command, and variable substitutions
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
\fBsubst \fR?\fB\-nobackslashes\fR? ?\fB\-nocommands\fR? ?\fB\-novariables\fR? \fIstring\fR
|
||||
\fBsubst \fR?\fB\-backslashes\fR? ?\fB\-commands\fR? ?\fB\-variables\fR? \fIstring\fR
|
||||
.fi
|
||||
.BE
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
@@ -33,6 +36,18 @@ For example, if \fB\-nocommands\fR is specified, command substitution
|
||||
is not performed: open and close brackets are treated as ordinary characters
|
||||
with no special interpretation.
|
||||
.PP
|
||||
If any of the \fB\-backslashes\fR, \fB\-commands\fR, or
|
||||
\fB\-variables\fR are specified, then only the corresponding
|
||||
substitutions are performed. This means that the following lines are
|
||||
equivalent:
|
||||
.PP
|
||||
.CS
|
||||
\fBsubst\fR -nobackslashes -nocommands $string
|
||||
\fBsubst\fR -variables $string
|
||||
.CE
|
||||
.PP
|
||||
It is not allowed to combine positive and negated options.
|
||||
.PP
|
||||
Note that the substitution of one kind can include substitution of
|
||||
other kinds. For example, even when the \fB\-novariables\fR option
|
||||
is specified, command substitution is performed without restriction.
|
||||
|
||||
+42
-12
@@ -12,46 +12,55 @@
|
||||
.SH NAME
|
||||
switch \- Evaluate one of several scripts, depending on a given value
|
||||
.SH SYNOPSIS
|
||||
\fBswitch \fR?\fIoptions\fR?\fI string pattern body \fR?\fIpattern body ...\fR?
|
||||
\fBswitch \fR?\fIoptions\fR?\fI value pattern body \fR?\fIpattern body ...\fR?
|
||||
.sp
|
||||
\fBswitch \fR?\fIoptions\fR?\fI string \fR{\fIpattern body \fR?\fIpattern body ...\fR?}
|
||||
\fBswitch \fR?\fIoptions\fR?\fI value \fR{\fIpattern body \fR?\fIpattern body ...\fR?}
|
||||
.BE
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
The \fBswitch\fR command matches its \fIstring\fR argument against each of
|
||||
The \fBswitch\fR command matches its \fIvalue\fR argument against each of
|
||||
the \fIpattern\fR arguments in order.
|
||||
As soon as it finds a \fIpattern\fR that matches \fIstring\fR it
|
||||
As soon as it finds a \fIpattern\fR that matches \fIvalue\fR it
|
||||
evaluates the following \fIbody\fR argument by passing it recursively
|
||||
to the Tcl interpreter and returns the result of that evaluation.
|
||||
If the last \fIpattern\fR argument is \fBdefault\fR then it matches
|
||||
anything.
|
||||
If no \fIpattern\fR argument
|
||||
matches \fIstring\fR and no default is given, then the \fBswitch\fR
|
||||
matches \fIvalue\fR and no default is given, then the \fBswitch\fR
|
||||
command returns an empty string.
|
||||
.PP
|
||||
If the initial arguments to \fBswitch\fR start with \fB\-\fR then
|
||||
they are treated as options
|
||||
unless there are exactly two arguments to \fBswitch\fR (in which case the
|
||||
first must the \fIstring\fR and the second must be the
|
||||
first must the \fIvalue\fR and the second must be the
|
||||
\fIpattern\fR/\fIbody\fR list).
|
||||
The following options are currently supported:
|
||||
.\" OPTION: -exact
|
||||
.TP 10
|
||||
\fB\-exact\fR
|
||||
.
|
||||
Use exact matching when comparing \fIstring\fR to a pattern. This
|
||||
Use exact matching when comparing \fIvalue\fR to a pattern. This
|
||||
is the default.
|
||||
.\" OPTION: -glob
|
||||
.TP 10
|
||||
\fB\-glob\fR
|
||||
.
|
||||
When matching \fIstring\fR to the patterns, use glob-style matching
|
||||
When matching \fIvalue\fR to the patterns, use glob-style matching
|
||||
(i.e. the same as implemented by the \fBstring match\fR command).
|
||||
.\" OPTION: -integer
|
||||
.TP 10
|
||||
\fB\-integer\fR
|
||||
.VS 9.1
|
||||
.\" TIP #730
|
||||
When matching \fIvalue\fR to the patterns, use integer comparisons. Note
|
||||
that this makes using a non-integer \fIvalue\fR or \fIpattern\fR (other
|
||||
than a final \fBdefault\fR) into an error.
|
||||
.VE 9.1
|
||||
.\" OPTION: -regexp
|
||||
.TP 10
|
||||
\fB\-regexp\fR
|
||||
.
|
||||
When matching \fIstring\fR to the patterns, use regular
|
||||
When matching \fIvalue\fR to the patterns, use regular
|
||||
expression matching
|
||||
(as described in the \fBre_syntax\fR reference page).
|
||||
.\" OPTION: -nocase
|
||||
@@ -59,6 +68,7 @@ expression matching
|
||||
\fB\-nocase\fR
|
||||
.
|
||||
Causes comparisons to be handled in a case-insensitive manner.
|
||||
Not supported with the \fB\-integer\fR option.
|
||||
.\" OPTION: -matchvar
|
||||
.TP 10
|
||||
\fB\-matchvar\fI varName\fR
|
||||
@@ -67,7 +77,7 @@ This option (only legal when \fB\-regexp\fR is also specified)
|
||||
specifies the name of a variable into which the list of matches
|
||||
found by the regular expression engine will be written. The first
|
||||
element of the list written will be the overall substring of the input
|
||||
string (i.e. the \fIstring\fR argument to \fBswitch\fR) matched, the
|
||||
string (i.e. the \fIvalue\fR argument to \fBswitch\fR) matched, the
|
||||
second element of the list will be the substring matched by the first
|
||||
capturing parenthesis in the regular expression that matched, and so
|
||||
on. When a \fBdefault\fR branch is taken, the variable will have the
|
||||
@@ -84,7 +94,7 @@ found by the regular expression engine will be written. The first
|
||||
element of the list written will be a two-element list specifying the
|
||||
index of the start and index of the first character after the end of
|
||||
the overall substring of the input
|
||||
string (i.e. the \fIstring\fR argument to \fBswitch\fR) matched, in a
|
||||
string (i.e. the \fIvalue\fR argument to \fBswitch\fR) matched, in a
|
||||
similar way to the \fB\-indices\fR option to the \fBregexp\fR can
|
||||
obtain. Similarly, the second element of the list refers to the first
|
||||
capturing parenthesis in the regular expression that matched, and so
|
||||
@@ -96,7 +106,7 @@ time as the \fB\-matchvar\fR option.
|
||||
\fB\-\|\-\fR
|
||||
.
|
||||
Marks the end of options. The argument following this one will
|
||||
be treated as \fIstring\fR even if it starts with a \fB\-\fR.
|
||||
be treated as \fIvalue\fR even if it starts with a \fB\-\fR.
|
||||
This is not required when the matching patterns and bodies are grouped
|
||||
together in a single argument.
|
||||
.PP
|
||||
@@ -184,6 +194,26 @@ exactly matched is easily obtained using the \fB\-matchvar\fR option:
|
||||
}
|
||||
}
|
||||
.CE
|
||||
.PP
|
||||
.VS 9.1
|
||||
Deciding what to do with a procedure based on the number of arguments:
|
||||
.PP
|
||||
.CS
|
||||
proc example args {
|
||||
\fBswitch\fR -integer -- [llength $args] {
|
||||
0 {
|
||||
puts "no arguments"
|
||||
}
|
||||
1 {
|
||||
puts "one argument: [lindex $args 0]"
|
||||
}
|
||||
default {
|
||||
puts "many arguments: $args"
|
||||
}
|
||||
}
|
||||
}
|
||||
.CE
|
||||
.VE 9.1
|
||||
.SH "SEE ALSO"
|
||||
for(n), if(n), regexp(n)
|
||||
.SH KEYWORDS
|
||||
|
||||
+14
-9
@@ -5,7 +5,7 @@
|
||||
'\" See the file "license.terms" for information on usage and redistribution
|
||||
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
'\"
|
||||
.TH tclvars n 8.0 Tcl "Tcl Built-In Commands"
|
||||
.TH tclvars n 9.1 Tcl "Tcl Built-In Commands"
|
||||
.so man.macros
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
@@ -237,7 +237,7 @@ nested Tcl commands that had been invoked at the time of the error.
|
||||
\fBtcl_library\fR
|
||||
.
|
||||
This variable holds the name of a directory containing the
|
||||
system library of Tcl scripts, such as those used for auto-loading.
|
||||
system library of Tcl scripts and encodings.
|
||||
The value of this variable is returned by the \fBinfo library\fR command.
|
||||
See the \fBlibrary\fR manual entry for details of the facilities
|
||||
provided by the Tcl script library.
|
||||
@@ -248,13 +248,18 @@ each application should set a global variable with a name like
|
||||
to hold the network file name for that application's library directory.
|
||||
The initial value of \fBtcl_library\fR is set when an interpreter
|
||||
is created by searching several different directories until one is
|
||||
found that contains an appropriate Tcl startup script.
|
||||
If the \fBTCL_LIBRARY\fR environment variable exists, then
|
||||
the directory it names is checked first.
|
||||
If \fBTCL_LIBRARY\fR is not set or doesn't refer to an appropriate
|
||||
directory, then Tcl checks several other directories based on a
|
||||
compiled-in default location, the location of the binary containing
|
||||
the application, and the current working directory.
|
||||
found that contains an appropriate Tcl startup script. If an
|
||||
application has already set the \fBtcl_library\fR variable in
|
||||
the interpreter, it is used directly. Otherwise,
|
||||
if the \fBTCL_LIBRARY\fR environment variable exists, then
|
||||
the directory it names is used to initialize \fBtcl_library\fR.
|
||||
In both cases, no further directories are searched. If neither
|
||||
of the above is set, Tcl will search several other directories
|
||||
in the following order: the ZipFS archive attached to the application
|
||||
or shared library for ZipFS-enabled builds, a platform specific default
|
||||
directory, the directory configured at build time, the directory
|
||||
\fBlib/tcl\fIVERSION\fR under the parent directory of the directory
|
||||
containing the application executable.
|
||||
.\" VARIABLE: tcl_patchLevel
|
||||
.TP
|
||||
\fBtcl_patchLevel\fR
|
||||
|
||||
+153
@@ -0,0 +1,153 @@
|
||||
'\"
|
||||
'\" Copyright (c) 2025 The TCL Association
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution
|
||||
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
'\"
|
||||
.TH timer n 9.1 Tcl "Tcl Built-In Commands"
|
||||
.so man.macros
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
timer \- timer events for monotonic and wall clock time
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
\fBtimer in\fR \fIdelay\fR \fIunit\fR \fIscript\fR
|
||||
\fBtimer at\fR \fItimepoint\fR \fIunit\fR \fIscript\fR
|
||||
\fBtimer idle\fR \fIscript\fR
|
||||
\fBtimer sleep for\fR \fIdelay\fR ?\fIunit\fR?
|
||||
\fBtimer sleep until\fR \fItimepoint\fR ?\fIunit\fR?
|
||||
\fBtimer cancel\fR \fIid\fR
|
||||
\fBtimer info\fR ?\fIid\fR?
|
||||
.fi
|
||||
.BE
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
This command is used to delay execution of the program or to execute
|
||||
a command in background sometime in the future.
|
||||
Time may be specified by a monotonic time delay or by wall clock time point.
|
||||
It has the following methods:
|
||||
.\" METHOD: in
|
||||
.TP
|
||||
\fBtimer in\fR \fIdelay\fR \fIunit\fR \fIscript\fR
|
||||
.
|
||||
In this form the command returns immediately, but it arranges
|
||||
for a Tcl command to be executed after the given monotonic time \fIdelay\fR elapsed as an
|
||||
event handler.
|
||||
The \fIdelay\fR value is given in the specified \fIunit\fR.
|
||||
See \fBTIME UNITS\fR below for available units.
|
||||
The command will be executed exactly once, after the given time delay.
|
||||
The delayed command is given by the argument \fIscript\fR.
|
||||
The command will be executed at global level (outside the context
|
||||
of any Tcl procedure).
|
||||
If an error occurs while executing the delayed command then
|
||||
the background error will be reported by the command
|
||||
registered with \fBinterp bgerror\fR.
|
||||
The command returns an identifier that can be used
|
||||
to cancel the delayed command using \fBtimer cancel\fR or \fBafter cancel\fR.
|
||||
A \fIdelay\fR value of 0 (or negative) queues the event immediately with
|
||||
priority over other event types (if not installed with an event proc,
|
||||
which will wait for next round of events).
|
||||
.TP
|
||||
The command \fBafter ms script\fR may also be used to register monotonic clock timer events.
|
||||
Theey are handled by the same que as this form of the \fBtimer\fR command.
|
||||
.\" METHOD: at
|
||||
.TP
|
||||
\fBtimer at \fItimepoint\fR \fIunit\fR \fIscript\fR
|
||||
.
|
||||
Same as \fBtimer in\fR, but specifying a wall clock time point (epoc).
|
||||
A typical use-case is to pass result of a \fBclock scan\fR as time point.
|
||||
See example below.
|
||||
.TP
|
||||
Wall clock events have second priority after monotonic clock events.
|
||||
If both fire the same instant, the monotonic clock command is always handled first.
|
||||
.\" METHOD: idle
|
||||
.TP
|
||||
\fBtimer idle \fIscript\fR
|
||||
.
|
||||
Arranges for the \fIscript\fR to be evaluated later as an idle callback.
|
||||
The script will be run exactly once, the next time the event
|
||||
loop is entered and there are no events to process.
|
||||
The command returns an identifier that can be used
|
||||
to cancel the delayed command using \fBtimer cancel\fR or \fBafter cancel\fR.
|
||||
If an error occurs while executing the script then the
|
||||
background error will be reported by the command
|
||||
registered with \fBinterp bgerror\fR.
|
||||
.\" METHOD: wait for
|
||||
.TP
|
||||
\fBtimer wait for \fIdelay\fR ?\fIunit\fR?
|
||||
\fIdelay\fR must be a wide integer giving a time in the given unit (default: \fBmilliseconds\fR).
|
||||
A negative number is treated as 0.
|
||||
The command sleeps for the given monotonic delay and then returns.
|
||||
While the command is sleeping the application does not respond to
|
||||
events.
|
||||
.\" METHOD: wait until
|
||||
.TP
|
||||
\fBtimer wait until \fItimepoint\fR ?\fIunit\fR?
|
||||
\fItimepoint\fR must be a wide integer giving a wall clock time point in the given unit (default: \fBseconds\fR).
|
||||
A negative number is treated as 0.
|
||||
The command sleeps (at least) until the given wall clock time point and then returns.
|
||||
While the command is sleeping the application does not respond to
|
||||
events.
|
||||
.\" METHOD: cancel
|
||||
.TP
|
||||
\fBafter cancel \fIid\fR
|
||||
.
|
||||
Cancels the execution of a delayed command that
|
||||
was previously scheduled.
|
||||
\fIId\fR indicates which command should be canceled; it must have
|
||||
been the return value from a previous \fBtimer\fR or \fBafter\fR command.
|
||||
If the command given by \fIid\fR has already been executed then
|
||||
the \fBtimer cancel\fR command has no effect.
|
||||
.\" METHOD: info
|
||||
.TP
|
||||
\fBtimer info \fR?\fIid\fR?
|
||||
.
|
||||
This command returns information about existing event handlers.
|
||||
If no \fIid\fR argument is supplied, the command returns
|
||||
a list of the identifiers for all existing
|
||||
event handlers created by the \fBtimer\fR and \fBafter\fR command for this
|
||||
interpreter.
|
||||
If \fIid\fR is supplied, it specifies an existing handler;
|
||||
\fIid\fR must have been the return value from some previous call
|
||||
to \fBtimer\fR or \fBafter\fR and it must not have triggered yet or been canceled.
|
||||
In this case the command returns a list with two to three elements.
|
||||
The first element of the list is the script associated
|
||||
with \fIid\fR, and the second element is either
|
||||
\fBidle\fR, \fBmonotonic\fR or \fBwallclock\fR to indicate what kind of event
|
||||
handler it is.
|
||||
A thierd list element is present for the kinds \fB monotonic\fR or \fBwallclock\fR.
|
||||
This element is the scheduled execution time point in microseconds of the given clock type.
|
||||
.LP
|
||||
The \fBtimer in\fR, \fBtimer at\fR and \fBtimer idle\fR forms of the command
|
||||
assume that the application is event driven: the delayed commands
|
||||
will not be executed unless the application enters the event loop.
|
||||
In applications that are not normally event-driven, such as
|
||||
\fBtclsh\fR, the event loop can be entered with the \fBvwait\fR
|
||||
and \fBupdate\fR commands.
|
||||
.LP
|
||||
Note, that the output differs from \fBafter info\fR.
|
||||
.SH "TIME UNITS"
|
||||
Some forms of the command take a time unit.
|
||||
Available units are: \fBus\fR (for microseconds), \fBmicroseconds\fR,
|
||||
\fBms\fR (for milliseconds), \fBmilliseconds\fR,
|
||||
\fBs\fR (for seconds), \fBseconds\fR or any unique abbreviation.
|
||||
.SH "TIME MAXIMUM VALUE"
|
||||
The arguments \fIdelay\fR and \fItimepoint\fR are bound to a resulting 63 bit clock value
|
||||
(in unit microseconds).
|
||||
Any higher value (which is after year 294441) will result in a \fBtime to far\fR error.
|
||||
.SH "EXAMPLES"
|
||||
This arranges for the command \fIwake_up\fR to be run in eight hours
|
||||
wall clock time (providing the event loop is active at that time):
|
||||
.PP
|
||||
.CS
|
||||
\fBtime at\fR [\fBclock add\fR [\fBclock seconds\fR] 24 hours] seconds wake_up
|
||||
.CE
|
||||
.PP
|
||||
.SH "SEE ALSO"
|
||||
concat(n), interp(n), timer(n), update(n), vwait(n)
|
||||
.SH KEYWORDS
|
||||
cancel, delay, idle callback, sleep, time
|
||||
'\" Local Variables:
|
||||
'\" mode: nroff
|
||||
'\" End:
|
||||
@@ -0,0 +1,66 @@
|
||||
'\"
|
||||
'\" Copyright (c) 2025 Ashok P. Nadkarni.
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution
|
||||
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
'\"
|
||||
.TH unicode n "9.1" Tcl "Tcl Built-In Commands"
|
||||
.so man.macros
|
||||
.BS
|
||||
.SH NAME
|
||||
unicode \- Unicode character transforms
|
||||
.SH SYNOPSIS
|
||||
\fBunicode \fIfunction\fR ?\fIoptions\fR? \fIstring\fR
|
||||
.BE
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
The command performs one of several Unicode character transformations, depending on
|
||||
\fIfunction\fR which may take the values described below.
|
||||
.\" METHOD: tonfc
|
||||
.VS "TIP726"
|
||||
.TP
|
||||
\fBunicode tonfc\fR ?\fB-profile\fR \fIprofile\fR? \fIstring\fR
|
||||
.VE "TIP726"
|
||||
.
|
||||
Returns \fIstring\fR normalized as per Unicode \fBNormalization Form C\fR (NFC).
|
||||
.PP
|
||||
.\" METHOD: tonfd
|
||||
.VS "TIP726"
|
||||
.TP
|
||||
\fBunicode tonfd\fR ?\fB-profile\fR \fIprofile\fR? \fIstring\fR
|
||||
.VE "TIP726"
|
||||
.
|
||||
Returns \fIstring\fR normalized as per Unicode \fBNormalization Form D\fR (NFD).
|
||||
.PP
|
||||
.\" METHOD: tonfkc
|
||||
.VS "TIP726"
|
||||
.TP
|
||||
\fBunicode tonfkc\fR ?\fB-profile\fR \fIprofile\fR? \fIstring\fR
|
||||
.VE "TIP726"
|
||||
.
|
||||
Returns \fIstring\fR normalized as per Unicode \fBNormalization Form KC\fR (NFKC).
|
||||
.PP
|
||||
.\" METHOD: tonfkd
|
||||
.VS "TIP726"
|
||||
.TP
|
||||
\fBunicode tonfkd\fR ?\fB-profile\fR \fIprofile\fR? \fIstring\fR
|
||||
.VE "TIP726"
|
||||
.
|
||||
Returns \fIstring\fR normalized as per Unicode \fBNormalization Form KD\fR (NFKD).
|
||||
.PP
|
||||
The normalization forms NFC, NFD, NFKC and NFKD referenced above are defined
|
||||
in \fBSection 3.11\fR of the Unicode standard
|
||||
(see https://www.unicode.org/versions/Unicode16.0.0/core-spec/chapter-3/).
|
||||
.PP
|
||||
The \fB-profile\fR option determines the command behavior in the presence
|
||||
of conversion errors. The passed profile must be \fBstrict\fR or \fBreplace\fR.
|
||||
See the \fBPROFILES\fR section in the documentation
|
||||
of the \fBencoding\fR command for details on profiles.
|
||||
.PP
|
||||
.SH "SEE ALSO"
|
||||
Tcl_UtfToNormalized(3)
|
||||
.SH KEYWORDS
|
||||
Unicode, normalize
|
||||
.\" Local Variables:
|
||||
.\" mode: nroff
|
||||
.\" End:
|
||||
@@ -78,6 +78,7 @@ is or becomes readable the wait operation completes.
|
||||
\fB\-timeout\fI milliseconds\fR
|
||||
.
|
||||
The wait operation is constrained to \fImilliseconds\fR.
|
||||
A monotonic clock is used if available.
|
||||
.\" OPTION: -variable
|
||||
.TP
|
||||
\fB\-variable\fI varName\fR
|
||||
|
||||
+9
-18
@@ -55,31 +55,22 @@ before mounting, allowing the data buffer to be disposed once
|
||||
buffer will be valid to read from for the duration of the mount.
|
||||
.BE
|
||||
.SH DESCRIPTION
|
||||
\fBTclZipfs_AppHook\fR is a utility function to perform standard application
|
||||
initialization procedures, taking into account available ZIP archives as
|
||||
\fBTclZipfs_AppHook\fR performs all functions required to initialize Tcl
|
||||
for use in an application, taking into account available ZIP archives as
|
||||
follows:
|
||||
.IP [1]
|
||||
If the current application has a mountable ZIP archive, that archive is
|
||||
mounted under \fIZIPFS_VOLUME\fB/app\fR as a read-only Tcl virtual file
|
||||
system (VFS). The value of \fIZIPFS_VOLUME\fR can be retrieved using the
|
||||
Tcl command \fBzipfs root\fR.
|
||||
If the current application executable has a mountable ZIP archive, that archive
|
||||
is mounted under \fIZIPFS_VOLUME\fB/app\fR as a read-only Tcl virtual file
|
||||
system (VFS). If the Tcl shared library has a mountable ZIP archive, that
|
||||
archive mounted under \fIZIPFS_VOLUME\fB/lib/tcl\fR as a read-only Tcl VFS. The
|
||||
value of \fIZIPFS_VOLUME\fR can be retrieved using the Tcl command \fBzipfs
|
||||
root\fR. Both are included in the search path for locating Tcl support scripts as
|
||||
described in the \fBtcl_library\fR global variable documentation.
|
||||
.IP [2]
|
||||
If a file named \fBmain.tcl\fR is located in the root directory of that file
|
||||
system (i.e., at \fIZIPFS_VOLUME\fB/app/main.tcl\fR after the ZIP archive is
|
||||
mounted as described above) it is treated as the startup script for the
|
||||
process.
|
||||
.IP [3]
|
||||
If the file \fIZIPFS_VOLUME\fB/app/tcl_library/init.tcl\fR is present, the
|
||||
\fBtcl_library\fR global variable in the initial Tcl interpreter is set to
|
||||
\fIZIPFS_VOLUME\fB/app/tcl_library\fR.
|
||||
.IP [4]
|
||||
If the directory \fBtcl_library\fR was not found in the main application
|
||||
mount, the system will then search for it as either a VFS attached to the
|
||||
application dynamic library, or as a zip archive named
|
||||
\fBlibtcl_\fImajor\fB_\fIminor\fB_\fIpatchlevel\fB.zip\fR either in the
|
||||
present working directory or in the standard Tcl install location. (For
|
||||
example, the Tcl 9.0.2 release would be searched for in a file
|
||||
\fBlibtcl_9_0_2.zip\fR.) That archive, if located, is also mounted read-only.
|
||||
.PP
|
||||
On Windows, \fBTclZipfs_AppHook\fR has a slightly different signature, since
|
||||
it uses WCHAR instead of char. As a result, it requires the application to
|
||||
|
||||
@@ -412,7 +412,7 @@ newsub(
|
||||
sco = cm->cd[co].sub;
|
||||
if (sco == NOSUB) { /* color has no open subcolor */
|
||||
if (cm->cd[co].nchrs == 1) { /* optimization */
|
||||
return co;
|
||||
return (color)co;
|
||||
}
|
||||
sco = newcolor(cm); /* must create subcolor */
|
||||
if (sco == COLORLESS) {
|
||||
|
||||
+15
-15
@@ -592,8 +592,8 @@ sortins(
|
||||
{
|
||||
struct arc **sortarray;
|
||||
struct arc *a;
|
||||
int n = s->nins;
|
||||
int i;
|
||||
size_t n = s->nins;
|
||||
size_t i;
|
||||
|
||||
if (n <= 1) {
|
||||
return; /* nothing to do */
|
||||
@@ -633,8 +633,8 @@ sortins_cmp(
|
||||
const void *a,
|
||||
const void *b)
|
||||
{
|
||||
const struct arc *aa = *((const struct arc * const *) a);
|
||||
const struct arc *bb = *((const struct arc * const *) b);
|
||||
const struct arc *aa = *((const struct arc *const *) a);
|
||||
const struct arc *bb = *((const struct arc *const *) b);
|
||||
|
||||
/* we check the fields in the order they are most likely to be different */
|
||||
if (aa->from->no < bb->from->no) {
|
||||
@@ -668,8 +668,8 @@ sortouts(
|
||||
{
|
||||
struct arc **sortarray;
|
||||
struct arc *a;
|
||||
int n = s->nouts;
|
||||
int i;
|
||||
size_t n = s->nouts;
|
||||
size_t i;
|
||||
|
||||
if (n <= 1) {
|
||||
return; /* nothing to do */
|
||||
@@ -709,8 +709,8 @@ sortouts_cmp(
|
||||
const void *a,
|
||||
const void *b)
|
||||
{
|
||||
const struct arc *aa = *((const struct arc * const *) a);
|
||||
const struct arc *bb = *((const struct arc * const *) b);
|
||||
const struct arc *aa = *((const struct arc *const *) a);
|
||||
const struct arc *bb = *((const struct arc *const *) b);
|
||||
|
||||
/* we check the fields in the order they are most likely to be different */
|
||||
if (aa->to->no < bb->to->no) {
|
||||
@@ -928,11 +928,11 @@ mergeins(
|
||||
struct nfa * nfa,
|
||||
struct state * s,
|
||||
struct arc ** arcarray,
|
||||
int arccount)
|
||||
size_t arccount)
|
||||
{
|
||||
struct arc *na;
|
||||
int i;
|
||||
int j;
|
||||
size_t i;
|
||||
size_t j;
|
||||
|
||||
if (arccount <= 0) {
|
||||
return;
|
||||
@@ -1872,12 +1872,12 @@ fixempties(
|
||||
struct state *nexts;
|
||||
struct arc *a;
|
||||
struct arc *nexta;
|
||||
int totalinarcs;
|
||||
size_t totalinarcs;
|
||||
struct arc **inarcsorig;
|
||||
struct arc **arcarray;
|
||||
int arccount;
|
||||
int prevnins;
|
||||
int nskip;
|
||||
size_t arccount;
|
||||
size_t prevnins;
|
||||
size_t nskip;
|
||||
|
||||
/*
|
||||
* First, get rid of any states whose sole out-arc is an EMPTY,
|
||||
|
||||
+28
-28
@@ -48,7 +48,7 @@ static void parseqatom(struct vars *, int, int, struct state *, struct state *,
|
||||
static void nonword(struct vars *, int, struct state *, struct state *);
|
||||
static void word(struct vars *, int, struct state *, struct state *);
|
||||
static int scannum(struct vars *);
|
||||
static void repeat(struct vars *, struct state *, struct state *, int, int);
|
||||
static void repeat(struct vars *, struct state *, struct state *, size_t, size_t);
|
||||
static void bracket(struct vars *, struct state *, struct state *);
|
||||
static void cbracket(struct vars *, struct state *, struct state *);
|
||||
static void brackpart(struct vars *, struct state *, struct state *);
|
||||
@@ -64,8 +64,8 @@ static void markst(struct subre *);
|
||||
static void cleanst(struct vars *);
|
||||
static long nfatree(struct vars *, struct subre *, FILE *);
|
||||
static long nfanode(struct vars *, struct subre *, FILE *);
|
||||
static int newlacon(struct vars *, struct state *, struct state *, int);
|
||||
static void freelacons(struct subre *, int);
|
||||
static size_t newlacon(struct vars *, struct state *, struct state *, size_t);
|
||||
static void freelacons(struct subre *, size_t);
|
||||
static void rfree(regex_t *);
|
||||
static void dump(regex_t *, FILE *);
|
||||
static void dumpst(struct subre *, FILE *, int);
|
||||
@@ -128,7 +128,7 @@ static void sortouts(struct nfa *, struct state *);
|
||||
static int sortouts_cmp(const void *, const void *);
|
||||
static void moveins(struct nfa *, struct state *, struct state *);
|
||||
static void copyins(struct nfa *, struct state *, struct state *);
|
||||
static void mergeins(struct nfa *, struct state *, struct arc **, int);
|
||||
static void mergeins(struct nfa *, struct state *, struct arc **, size_t);
|
||||
static void moveouts(struct nfa *, struct state *, struct state *);
|
||||
static void copyouts(struct nfa *, struct state *, struct state *);
|
||||
static void cloneouts(struct nfa *, struct state *, struct state *, struct state *, int);
|
||||
@@ -205,7 +205,7 @@ struct vars {
|
||||
int cflags; /* copy of compile flags */
|
||||
int lasttype; /* type of previous token */
|
||||
int nexttype; /* type of next token */
|
||||
size_t nextvalue; /* value (if any) of next token */
|
||||
chr nextvalue; /* value (if any) of next token */
|
||||
int lexcon; /* lexical context type (see lex.c) */
|
||||
size_t nsubexp; /* subexpression count */
|
||||
struct subre **subs; /* subRE pointer vector */
|
||||
@@ -685,7 +685,7 @@ parse(
|
||||
NOERRN();
|
||||
branch->left = parsebranch(v, stopper, type, left, right, 0);
|
||||
NOERRN();
|
||||
branch->flags |= UP(branch->flags | branch->left->flags);
|
||||
branch->flags |= (char)(UP(branch->flags | branch->left->flags));
|
||||
if ((branch->flags &~ branches->flags) != 0) { /* new flags */
|
||||
for (t = branches; t != branch; t = t->right) {
|
||||
t->flags |= branch->flags;
|
||||
@@ -788,12 +788,12 @@ parseqatom(
|
||||
{
|
||||
struct state *s; /* temporaries for new states */
|
||||
struct state *s2;
|
||||
#define ARCV(t, val) newarc(v->nfa, t, val, lp, rp)
|
||||
int m, n;
|
||||
#define ARCV(t, val) newarc(v->nfa, (t), (pcolor)(val), lp, rp)
|
||||
size_t m, n;
|
||||
struct subre *atom; /* atom's subtree */
|
||||
struct subre *t;
|
||||
int cap; /* capturing parens? */
|
||||
int pos; /* positive lookahead? */
|
||||
size_t cap; /* capturing parens? */
|
||||
size_t pos; /* positive lookahead? */
|
||||
size_t subno; /* capturing-parens or backref number */
|
||||
int atomtype;
|
||||
int qprefer; /* quantifier short/long preference */
|
||||
@@ -990,7 +990,7 @@ parseqatom(
|
||||
break;
|
||||
case BACKREF: /* the Feature From The Black Lagoon */
|
||||
INSIST(type != LACON, REG_ESUBREG);
|
||||
INSIST(v->nextvalue < v->nsubs, REG_ESUBREG);
|
||||
INSIST((size_t)v->nextvalue < v->nsubs, REG_ESUBREG);
|
||||
INSIST(v->subs[v->nextvalue] != NULL, REG_ESUBREG);
|
||||
NOERR();
|
||||
assert(v->nextvalue > 0);
|
||||
@@ -1094,7 +1094,7 @@ parseqatom(
|
||||
if (atom != NULL) {
|
||||
freesubre(v, atom);
|
||||
}
|
||||
top->flags = f;
|
||||
top->flags = (char)f;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1204,7 +1204,7 @@ parseqatom(
|
||||
repeat(v, atom->begin, atom->end, m, n);
|
||||
atom->min = (short) m;
|
||||
atom->max = (short) n;
|
||||
atom->flags |= COMBINE(qprefer, atom->flags);
|
||||
atom->flags |= (char)COMBINE(qprefer, atom->flags);
|
||||
/* rest of branch can be strung starting from atom->end */
|
||||
s2 = atom->end;
|
||||
} else if (m == 1 && n == 1) {
|
||||
@@ -1268,8 +1268,8 @@ parseqatom(
|
||||
}
|
||||
NOERR();
|
||||
assert(SEE('|') || SEE(stopper) || SEE(EOS));
|
||||
t->flags |= COMBINE(t->flags, t->right->flags);
|
||||
top->flags |= COMBINE(top->flags, t->flags);
|
||||
t->flags |= (char)COMBINE(t->flags, t->right->flags);
|
||||
top->flags |= (char)COMBINE(top->flags, t->flags);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1346,13 +1346,13 @@ repeat(
|
||||
struct vars *v,
|
||||
struct state *lp,
|
||||
struct state *rp,
|
||||
int m,
|
||||
int n)
|
||||
size_t m,
|
||||
size_t n)
|
||||
{
|
||||
#define SOME 2
|
||||
#define INF 3
|
||||
#define PAIR(x, y) ((x)*4 + (y))
|
||||
#define REDUCE(x) ( ((x) == DUPINF) ? INF : (((x) > 1) ? SOME : (x)) )
|
||||
#define REDUCE(x) ( ((x) == DUPINF) ? INF : (((x) > 1) ? SOME : (int)(x)) )
|
||||
const int rm = REDUCE(m);
|
||||
const int rn = REDUCE(n);
|
||||
struct state *s, *s2;
|
||||
@@ -1660,7 +1660,7 @@ dovec(
|
||||
{
|
||||
chr ch, from, to;
|
||||
const chr *p;
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
for (p = cv->chrs, i = cv->nchrs; i > 0; p++, i--) {
|
||||
ch = *p;
|
||||
@@ -1744,8 +1744,8 @@ sub_re(
|
||||
|
||||
assert(strchr("=b|.*(", op) != NULL);
|
||||
|
||||
ret->op = op;
|
||||
ret->flags = flags;
|
||||
ret->op = (char)op;
|
||||
ret->flags = (char)flags;
|
||||
ret->id = 0; /* will be assigned later */
|
||||
ret->subno = 0;
|
||||
ret->min = ret->max = 1;
|
||||
@@ -1944,16 +1944,16 @@ nfanode(
|
||||
|
||||
/*
|
||||
- newlacon - allocate a lookahead-constraint subRE
|
||||
^ static int newlacon(struct vars *, struct state *, struct state *, int);
|
||||
^ static size_t newlacon(struct vars *, struct state *, struct state *, size_t);
|
||||
*/
|
||||
static int /* lacon number */
|
||||
static size_t /* lacon number */
|
||||
newlacon(
|
||||
struct vars *v,
|
||||
struct state *begin,
|
||||
struct state *end,
|
||||
int pos)
|
||||
size_t pos)
|
||||
{
|
||||
int n;
|
||||
size_t n;
|
||||
struct subre *newlacons;
|
||||
struct subre *sub;
|
||||
|
||||
@@ -1988,10 +1988,10 @@ newlacon(
|
||||
static void
|
||||
freelacons(
|
||||
struct subre *subs,
|
||||
int n)
|
||||
size_t n)
|
||||
{
|
||||
struct subre *sub;
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
assert(n > 0);
|
||||
for (sub=subs+1, i=n-1; i>0; sub++, i--) { /* no 0th */
|
||||
@@ -2135,7 +2135,7 @@ stdump(
|
||||
fprintf(f, " UNUSED");
|
||||
}
|
||||
if (t->subno != 0) {
|
||||
fprintf(f, " (#%d)", t->subno);
|
||||
fprintf(f, " (#%" TCL_Z_MODIFIER "d)", t->subno);
|
||||
}
|
||||
if (t->min != 1 || t->max != 1) {
|
||||
fprintf(f, " {%d,", t->min);
|
||||
|
||||
+3
-3
@@ -414,14 +414,14 @@ freeDFA(
|
||||
/*
|
||||
- hash - construct a hash code for a bitvector
|
||||
* There are probably better ways, but they're more expensive.
|
||||
^ static unsigned hash(unsigned *, int);
|
||||
^ static unsigned hash(unsigned *, size_t);
|
||||
*/
|
||||
static unsigned
|
||||
hash(
|
||||
unsigned *const uv,
|
||||
int n)
|
||||
size_t n)
|
||||
{
|
||||
int i;
|
||||
size_t i;
|
||||
unsigned h;
|
||||
|
||||
h = 0;
|
||||
|
||||
+6
-5
@@ -145,7 +145,7 @@ static chr *shortest(struct vars *const, struct dfa *const, chr *const, chr *con
|
||||
static chr *lastCold(struct vars *const, struct dfa *const);
|
||||
static struct dfa *newDFA(struct vars *const, struct cnfa *const, struct colormap *const, struct smalldfa *);
|
||||
static void freeDFA(struct dfa *const);
|
||||
static unsigned hash(unsigned *const, int);
|
||||
static unsigned hash(unsigned *const, size_t);
|
||||
static struct sset *initialize(struct vars *const, struct dfa *const, chr *const);
|
||||
static struct sset *miss(struct vars *const, struct dfa *const, struct sset *const, const pcolor, chr *const, chr *const);
|
||||
static int checkLAConstraint(struct vars *const, struct cnfa *const, chr *const, const pcolor);
|
||||
@@ -171,8 +171,8 @@ exec(
|
||||
{
|
||||
AllocVars(v);
|
||||
int st, backref;
|
||||
int n;
|
||||
int i;
|
||||
size_t n;
|
||||
size_t i;
|
||||
#define LOCALMAT 20
|
||||
regmatch_t mat[LOCALMAT];
|
||||
#define LOCALDFAS 40
|
||||
@@ -591,7 +591,7 @@ subset(
|
||||
chr *const begin,
|
||||
chr *const end)
|
||||
{
|
||||
int n = sub->subno;
|
||||
size_t n = sub->subno;
|
||||
|
||||
assert(n > 0);
|
||||
if ((size_t)n >= v->nmatch) {
|
||||
@@ -873,7 +873,8 @@ cbrdissect(
|
||||
chr *begin, /* beginning of relevant substring */
|
||||
chr *end) /* end of same */
|
||||
{
|
||||
int n = t->subno, min = t->min, max = t->max;
|
||||
size_t n = t->subno;
|
||||
int min = t->min, max = t->max;
|
||||
size_t numreps;
|
||||
size_t tlen;
|
||||
size_t brlen;
|
||||
|
||||
+1
-1
@@ -364,7 +364,7 @@ struct subre {
|
||||
#define PREF2(f1, f2) ((PREF(f1) != 0) ? PREF(f1) : PREF(f2))
|
||||
#define COMBINE(f1, f2) (UP((f1)|(f2)) | PREF2(f1, f2))
|
||||
short id; /* ID of subre (1..ntree-1) */
|
||||
int subno; /* subexpression number (for 'b' and '(') */
|
||||
size_t subno; /* subexpression number (for 'b' and '(') */
|
||||
short min; /* min repetitions for iteration or backref */
|
||||
short max; /* max repetitions for iteration or backref */
|
||||
struct subre *left; /* left child, if any (also freelist chain) */
|
||||
|
||||
+85
-32
@@ -40,22 +40,22 @@ declare 2 {
|
||||
TCL_NORETURN void Tcl_Panic(const char *format, ...)
|
||||
}
|
||||
declare 3 {
|
||||
void *Tcl_Alloc(TCL_HASH_TYPE size)
|
||||
void *Tcl_Alloc(size_t size)
|
||||
}
|
||||
declare 4 {
|
||||
void Tcl_Free(void *ptr)
|
||||
}
|
||||
declare 5 {
|
||||
void *Tcl_Realloc(void *ptr, TCL_HASH_TYPE size)
|
||||
void *Tcl_Realloc(void *ptr, size_t size)
|
||||
}
|
||||
declare 6 {
|
||||
void *Tcl_DbCkalloc(TCL_HASH_TYPE size, const char *file, int line)
|
||||
void *Tcl_DbCkalloc(size_t size, const char *file, int line)
|
||||
}
|
||||
declare 7 {
|
||||
void Tcl_DbCkfree(void *ptr, const char *file, int line)
|
||||
}
|
||||
declare 8 {
|
||||
void *Tcl_DbCkrealloc(void *ptr, TCL_HASH_TYPE size,
|
||||
void *Tcl_DbCkrealloc(void *ptr, size_t size,
|
||||
const char *file, int line)
|
||||
}
|
||||
|
||||
@@ -129,17 +129,6 @@ declare 29 {
|
||||
declare 30 {
|
||||
void TclFreeObj(Tcl_Obj *objPtr)
|
||||
}
|
||||
declare 31 {
|
||||
int Tcl_GetBoolean(Tcl_Interp *interp, const char *src, int *intPtr)
|
||||
}
|
||||
declare 32 {
|
||||
int Tcl_GetBooleanFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr,
|
||||
int *intPtr)
|
||||
}
|
||||
# Only available in Tcl 8.x, NULL in Tcl 9.0
|
||||
declare 33 {
|
||||
unsigned char *Tcl_GetByteArrayFromObj(Tcl_Obj *objPtr, Tcl_Size *numBytesPtr)
|
||||
}
|
||||
declare 34 {
|
||||
int Tcl_GetDouble(Tcl_Interp *interp, const char *src, double *doublePtr)
|
||||
}
|
||||
@@ -259,10 +248,6 @@ declare 79 {
|
||||
declare 80 {
|
||||
void Tcl_CancelIdleCall(Tcl_IdleProc *idleProc, void *clientData)
|
||||
}
|
||||
# Only available in Tcl 8.x, NULL in Tcl 9.0
|
||||
declare 81 {
|
||||
int Tcl_Close(Tcl_Interp *interp, Tcl_Channel chan)
|
||||
}
|
||||
declare 82 {
|
||||
int Tcl_CommandComplete(const char *cmd)
|
||||
}
|
||||
@@ -1054,7 +1039,14 @@ declare 339 {
|
||||
Tcl_Size Tcl_WriteObj(Tcl_Channel chan, Tcl_Obj *objPtr)
|
||||
}
|
||||
declare 340 {
|
||||
char *Tcl_GetString(Tcl_Obj *objPtr)
|
||||
long long Tcl_GetMonotonicTime(void)
|
||||
}
|
||||
declare 341 {
|
||||
Tcl_TimerToken Tcl_CreateTimerHandlerMicroSeconds(long long microSeconds,
|
||||
Tcl_TimerProc *proc, void *clientData)
|
||||
}
|
||||
declare 342 {
|
||||
void Tcl_SleepMicroSeconds(long long microSeconds)
|
||||
}
|
||||
declare 343 {
|
||||
void Tcl_AlertNotifier(void *clientData)
|
||||
@@ -1133,10 +1125,10 @@ declare 365 {
|
||||
char *Tcl_GetCwd(Tcl_Interp *interp, Tcl_DString *cwdPtr)
|
||||
}
|
||||
declare 366 {
|
||||
int Tcl_Chdir(const char *dirName)
|
||||
int Tcl_Chdir(const char *dirName)
|
||||
}
|
||||
declare 367 {
|
||||
int Tcl_Access(const char *path, int mode)
|
||||
int Tcl_Access(const char *path, int mode)
|
||||
}
|
||||
declare 368 {
|
||||
int Tcl_Stat(const char *path, struct stat *bufPtr)
|
||||
@@ -1217,7 +1209,7 @@ declare 392 {
|
||||
}
|
||||
declare 393 {
|
||||
int Tcl_CreateThread(Tcl_ThreadId *idPtr, Tcl_ThreadCreateProc *proc,
|
||||
void *clientData, TCL_HASH_TYPE stackSize, int flags)
|
||||
void *clientData, size_t stackSize, int flags)
|
||||
}
|
||||
|
||||
# Introduced in 8.3.2
|
||||
@@ -1303,6 +1295,10 @@ declare 417 {
|
||||
declare 418 {
|
||||
int Tcl_IsChannelExisting(const char *channelName)
|
||||
}
|
||||
declare 421 {
|
||||
Tcl_HashEntry *Tcl_DbCreateHashEntry(Tcl_HashTable *tablePtr,
|
||||
const void *key, int *newPtr, const char *file, int line)
|
||||
}
|
||||
declare 422 {
|
||||
Tcl_HashEntry *Tcl_CreateHashEntry(Tcl_HashTable *tablePtr,
|
||||
const void *key, int *newPtr)
|
||||
@@ -1328,16 +1324,16 @@ declare 427 {
|
||||
int flags, Tcl_CommandTraceProc *proc, void *clientData)
|
||||
}
|
||||
declare 428 {
|
||||
void *Tcl_AttemptAlloc(TCL_HASH_TYPE size)
|
||||
void *Tcl_AttemptAlloc(size_t size)
|
||||
}
|
||||
declare 429 {
|
||||
void *Tcl_AttemptDbCkalloc(TCL_HASH_TYPE size, const char *file, int line)
|
||||
void *Tcl_AttemptDbCkalloc(size_t size, const char *file, int line)
|
||||
}
|
||||
declare 430 {
|
||||
void *Tcl_AttemptRealloc(void *ptr, TCL_HASH_TYPE size)
|
||||
void *Tcl_AttemptRealloc(void *ptr, size_t size)
|
||||
}
|
||||
declare 431 {
|
||||
void *Tcl_AttemptDbCkrealloc(void *ptr, TCL_HASH_TYPE size,
|
||||
void *Tcl_AttemptDbCkrealloc(void *ptr, size_t size,
|
||||
const char *file, int line)
|
||||
}
|
||||
declare 432 {
|
||||
@@ -2100,12 +2096,12 @@ declare 626 {
|
||||
# TIP #357 (Export TclLoadFile and TclpFindSymbol) kbk
|
||||
declare 627 {
|
||||
int Tcl_LoadFile(Tcl_Interp *interp, Tcl_Obj *pathPtr,
|
||||
const char *const symv[], int flags, void *procPtrs,
|
||||
Tcl_LoadHandle *handlePtr)
|
||||
const char *const symv[], int flags, void *procPtrs,
|
||||
Tcl_LoadHandle *handlePtr)
|
||||
}
|
||||
declare 628 {
|
||||
void *Tcl_FindSymbol(Tcl_Interp *interp, Tcl_LoadHandle handle,
|
||||
const char *symbol)
|
||||
const char *symbol)
|
||||
}
|
||||
declare 629 {
|
||||
int Tcl_FSUnloadFile(Tcl_Interp *interp, Tcl_LoadHandle handlePtr)
|
||||
@@ -2148,7 +2144,7 @@ declare 636 {
|
||||
}
|
||||
declare 637 {
|
||||
char *Tcl_InitStringRep(Tcl_Obj *objPtr, const char *bytes,
|
||||
TCL_HASH_TYPE numBytes)
|
||||
size_t numBytes)
|
||||
}
|
||||
declare 638 {
|
||||
Tcl_ObjInternalRep *Tcl_FetchInternalRep(Tcl_Obj *objPtr, const Tcl_ObjType *typePtr)
|
||||
@@ -2350,7 +2346,7 @@ declare 682 {
|
||||
|
||||
# TIP 643
|
||||
declare 683 {
|
||||
Tcl_Size Tcl_GetEncodingNulLength(Tcl_Encoding encoding)
|
||||
Tcl_Size Tcl_GetEncodingNulLength(Tcl_Encoding encoding)
|
||||
}
|
||||
|
||||
# TIP #650
|
||||
@@ -2381,7 +2377,64 @@ declare 689 {
|
||||
|
||||
# ----- BASELINE -- FOR -- 9.0.0 ----- #
|
||||
|
||||
# TIP 711
|
||||
declare 690 {
|
||||
int Tcl_IsEmpty(Tcl_Obj *obj)
|
||||
}
|
||||
|
||||
# TIP 716
|
||||
declare 691 {
|
||||
const char *Tcl_GetEncodingNameForUser(Tcl_DString *bufPtr)
|
||||
}
|
||||
|
||||
# TIP 649
|
||||
declare 692 {
|
||||
int Tcl_ListObjReverse(Tcl_Interp *interp, Tcl_Obj *objPtr,
|
||||
Tcl_Obj **resultPtrPtr)
|
||||
}
|
||||
declare 693 {
|
||||
int Tcl_ListObjRepeat(Tcl_Interp *interp, Tcl_Size repeatCount,
|
||||
Tcl_Size objc, Tcl_Obj *const objv[], Tcl_Obj **resultPtrPtr)
|
||||
}
|
||||
declare 694 {
|
||||
int Tcl_ListObjRange(Tcl_Interp *interp, Tcl_Obj *objPtr,
|
||||
Tcl_Size start, Tcl_Size end, Tcl_Obj **resultPtrPtr)
|
||||
}
|
||||
|
||||
# TIP 726
|
||||
declare 695 {
|
||||
int Tcl_UtfToNormalizedDString(Tcl_Interp *interp,
|
||||
const char *bytes, Tcl_Size length,
|
||||
Tcl_UnicodeNormalizationForm normForm, int profile,
|
||||
Tcl_DString *dsPtr)
|
||||
}
|
||||
declare 696 {
|
||||
int Tcl_UtfToNormalized(Tcl_Interp *interp,
|
||||
const char *bytes, Tcl_Size length,
|
||||
Tcl_UnicodeNormalizationForm normForm, int profile,
|
||||
char *bufPtr, Tcl_Size bufLen, Tcl_Size *lengthPtr)
|
||||
}
|
||||
|
||||
# TIP 732
|
||||
declare 697 {
|
||||
int Tcl_ExternalToUtfEx(
|
||||
Tcl_Interp *interp, Tcl_Encoding encoding, const char *src,
|
||||
Tcl_Size srcLen, int flags, Tcl_EncodingState *statePtr, char *dst,
|
||||
Tcl_Size dstLen, Tcl_Size *srcReadPtr, Tcl_Size *dstWrotePtr,
|
||||
Tcl_Size *dstCharsPtr)
|
||||
}
|
||||
|
||||
declare 698 {
|
||||
int Tcl_UtfToExternalEx(
|
||||
Tcl_Interp *interp, Tcl_Encoding encoding, const char *src,
|
||||
Tcl_Size srcLen, int flags, Tcl_EncodingState *statePtr, char *dst,
|
||||
Tcl_Size dstLen, Tcl_Size *srcReadPtr, Tcl_Size *dstWrotePtr,
|
||||
Tcl_Size *dstCharsPtr)
|
||||
}
|
||||
|
||||
# ----- BASELINE -- FOR -- 9.1.0 ----- #
|
||||
|
||||
declare 699 {
|
||||
void TclUnusedStubEntry(void)
|
||||
}
|
||||
|
||||
|
||||
+75
-140
@@ -49,14 +49,15 @@ extern "C" {
|
||||
#if !defined(TCL_MAJOR_VERSION)
|
||||
# define TCL_MAJOR_VERSION 9
|
||||
#endif
|
||||
#if TCL_MAJOR_VERSION == 9
|
||||
# define TCL_MINOR_VERSION 0
|
||||
# define TCL_RELEASE_LEVEL TCL_FINAL_RELEASE
|
||||
# define TCL_RELEASE_SERIAL 4
|
||||
#if TCL_MAJOR_VERSION != 9
|
||||
# error "This header-file is for Tcl 9 only"
|
||||
#endif
|
||||
#define TCL_MINOR_VERSION 1
|
||||
#define TCL_RELEASE_LEVEL TCL_ALPHA_RELEASE
|
||||
#define TCL_RELEASE_SERIAL 1
|
||||
|
||||
# define TCL_VERSION "9.0"
|
||||
# define TCL_PATCH_LEVEL "9.0.4"
|
||||
#endif /* TCL_MAJOR_VERSION */
|
||||
#define TCL_VERSION "9.1"
|
||||
#define TCL_PATCH_LEVEL "9.1a1"
|
||||
|
||||
#if defined(RC_INVOKED)
|
||||
/*
|
||||
@@ -321,30 +322,12 @@ 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
|
||||
# ifndef Tcl_Size
|
||||
typedef int Tcl_Size;
|
||||
# endif
|
||||
# ifndef TCL_SIZE_MAX
|
||||
# define TCL_SIZE_MAX ((int)(((unsigned int)-1)>>1))
|
||||
# endif
|
||||
# ifndef TCL_SIZE_MODIFIER
|
||||
# define TCL_SIZE_MODIFIER ""
|
||||
#endif
|
||||
#else
|
||||
typedef ptrdiff_t Tcl_Size;
|
||||
# define TCL_SIZE_MAX ((Tcl_Size)(((size_t)-1)>>1))
|
||||
# define TCL_SIZE_MODIFIER TCL_T_MODIFIER
|
||||
#endif /* TCL_MAJOR_VERSION */
|
||||
typedef ptrdiff_t Tcl_Size;
|
||||
#define TCL_SIZE_MAX ((Tcl_Size)(((size_t)-1)>>1))
|
||||
#define TCL_SIZE_MODIFIER TCL_T_MODIFIER
|
||||
|
||||
#ifdef _WIN32
|
||||
# if TCL_MAJOR_VERSION > 8 || defined(_WIN64) || defined(_USE_64BIT_TIME_T)
|
||||
typedef struct __stat64 Tcl_StatBuf;
|
||||
# elif defined(_USE_32BIT_TIME_T)
|
||||
typedef struct _stati64 Tcl_StatBuf;
|
||||
# else
|
||||
typedef struct _stat32i64 Tcl_StatBuf;
|
||||
# endif
|
||||
typedef struct __stat64 Tcl_StatBuf;
|
||||
#elif defined(__CYGWIN__)
|
||||
typedef struct {
|
||||
unsigned st_dev;
|
||||
@@ -425,7 +408,7 @@ typedef void (Tcl_ThreadCreateProc) (void *clientData);
|
||||
* given to Tcl_CreateThread.
|
||||
*/
|
||||
|
||||
#define TCL_THREAD_STACK_DEFAULT (0) /* Use default size for stack. */
|
||||
#define TCL_THREAD_STACK_DEFAULT (0) /* Use default size for stack. */
|
||||
#define TCL_THREAD_NOFLAGS (0000) /* Standard flags, default
|
||||
* behaviour. */
|
||||
#define TCL_THREAD_JOINABLE (0001) /* Mark the thread as joinable. */
|
||||
@@ -469,28 +452,18 @@ typedef void (Tcl_ThreadCreateProc) (void *clientData);
|
||||
*/
|
||||
|
||||
typedef struct Tcl_RegExpIndices {
|
||||
#if TCL_MAJOR_VERSION > 8
|
||||
Tcl_Size start; /* Character offset of first character in
|
||||
* match. */
|
||||
Tcl_Size end; /* Character offset of first character after
|
||||
* the match. */
|
||||
#else
|
||||
long start;
|
||||
long end;
|
||||
#endif
|
||||
} Tcl_RegExpIndices;
|
||||
|
||||
typedef struct Tcl_RegExpInfo {
|
||||
Tcl_Size nsubs; /* Number of subexpressions in the compiled
|
||||
* expression. */
|
||||
Tcl_RegExpIndices *matches; /* Array of nsubs match offset pairs. */
|
||||
#if TCL_MAJOR_VERSION > 8
|
||||
Tcl_Size extendStart; /* The offset at which a subsequent match
|
||||
* might begin. */
|
||||
#else
|
||||
long extendStart;
|
||||
long reserved; /* Reserved for later use. */
|
||||
#endif
|
||||
} Tcl_RegExpInfo;
|
||||
|
||||
/*
|
||||
@@ -562,12 +535,14 @@ typedef void (Tcl_CloseProc) (void *data);
|
||||
typedef void (Tcl_CmdDeleteProc) (void *clientData);
|
||||
typedef int (Tcl_CmdProc) (void *clientData, Tcl_Interp *interp,
|
||||
int argc, const char *argv[]);
|
||||
#ifndef TCL_NO_DEPRECATED
|
||||
typedef void (Tcl_CmdTraceProc) (void *clientData, Tcl_Interp *interp,
|
||||
int level, char *command, Tcl_CmdProc *proc,
|
||||
void *cmdClientData, int argc, const char *argv[]);
|
||||
typedef int (Tcl_CmdObjTraceProc) (void *clientData, Tcl_Interp *interp,
|
||||
int level, const char *command, Tcl_Command commandInfo, int objc,
|
||||
struct Tcl_Obj *const *objv);
|
||||
#endif /* TCL_NO_DEPRECATED */
|
||||
typedef void (Tcl_CmdObjTraceDeleteProc) (void *clientData);
|
||||
typedef void (Tcl_DupInternalRepProc) (struct Tcl_Obj *srcPtr,
|
||||
struct Tcl_Obj *dupPtr);
|
||||
@@ -587,9 +562,10 @@ typedef void (Tcl_IdleProc) (void *clientData);
|
||||
typedef void (Tcl_InterpDeleteProc) (void *clientData,
|
||||
Tcl_Interp *interp);
|
||||
typedef void (Tcl_NamespaceDeleteProc) (void *clientData);
|
||||
#ifndef TCL_NO_DEPRECATED
|
||||
typedef int (Tcl_ObjCmdProc) (void *clientData, Tcl_Interp *interp,
|
||||
int objc, struct Tcl_Obj *const *objv);
|
||||
#if TCL_MAJOR_VERSION > 8
|
||||
#endif /* TCL_NO_DEPRECATED */
|
||||
typedef int (Tcl_ObjCmdProc2) (void *clientData, Tcl_Interp *interp,
|
||||
Tcl_Size objc, struct Tcl_Obj *const *objv);
|
||||
typedef int (Tcl_CmdObjTraceProc2) (void *clientData, Tcl_Interp *interp,
|
||||
@@ -600,11 +576,6 @@ typedef void (Tcl_FreeProc) (void *blockPtr);
|
||||
#define Tcl_FileFreeProc Tcl_FreeProc
|
||||
#define Tcl_FileFreeProc Tcl_FreeProc
|
||||
#define Tcl_EncodingFreeProc Tcl_FreeProc
|
||||
#else
|
||||
#define Tcl_ObjCmdProc2 Tcl_ObjCmdProc
|
||||
#define Tcl_CmdObjTraceProc2 Tcl_CmdObjTraceProc
|
||||
typedef void (Tcl_FreeProc) (char *blockPtr);
|
||||
#endif
|
||||
typedef int (Tcl_LibraryInitProc) (Tcl_Interp *interp);
|
||||
typedef int (Tcl_LibraryUnloadProc) (Tcl_Interp *interp, int flags);
|
||||
typedef void (Tcl_PanicProc) (const char *format, ...);
|
||||
@@ -673,7 +644,6 @@ typedef struct Tcl_ObjType {
|
||||
/* Called to convert the object's internal rep
|
||||
* to this type. Frees the internal rep of the
|
||||
* old type. Returns TCL_ERROR on failure. */
|
||||
#if TCL_MAJOR_VERSION > 8
|
||||
size_t version; /* Version field for future-proofing. */
|
||||
|
||||
/* List emulation functions - ObjType Version 1 */
|
||||
@@ -697,21 +667,14 @@ typedef struct Tcl_ObjType {
|
||||
/* "in" and "ni" expr list operation.
|
||||
* Determine if the given string value matches
|
||||
* an element in the list. */
|
||||
#endif
|
||||
} Tcl_ObjType;
|
||||
|
||||
#if TCL_MAJOR_VERSION > 8
|
||||
# define TCL_OBJTYPE_V0 0, \
|
||||
0,0,0,0,0,0,0,0 /* Pre-Tcl 9 */
|
||||
# define TCL_OBJTYPE_V1(a) offsetof(Tcl_ObjType, indexProc), \
|
||||
a,0,0,0,0,0,0,0 /* Tcl 9 Version 1 */
|
||||
# define TCL_OBJTYPE_V2(a,b,c,d,e,f,g,h) sizeof(Tcl_ObjType), \
|
||||
a,b,c,d,e,f,g,h /* Tcl 9 - AbstractLists */
|
||||
#else
|
||||
# define TCL_OBJTYPE_V0 /* just empty */
|
||||
# define TCL_OBJTYPE_V1(a) /* just empty */
|
||||
# define TCL_OBJTYPE_V2(a,b,c,d,e,f,g,h) /* just empty */
|
||||
#endif
|
||||
#define TCL_OBJTYPE_V0 0, \
|
||||
0,0,0,0,0,0,0,0 /* Pre-Tcl 9 */
|
||||
#define TCL_OBJTYPE_V1(a) offsetof(Tcl_ObjType, indexProc), \
|
||||
a,0,0,0,0,0,0,0 /* Tcl 9 Version 1 */
|
||||
#define TCL_OBJTYPE_V2(a,b,c,d,e,f,g,h) sizeof(Tcl_ObjType), \
|
||||
a,b,c,d,e,f,g,h /* Tcl 9 - AbstractLists */
|
||||
|
||||
/*
|
||||
* The following structure stores an internal representation (internalrep) for
|
||||
@@ -720,7 +683,7 @@ typedef struct Tcl_ObjType {
|
||||
* the handling of the internalrep.
|
||||
*/
|
||||
|
||||
typedef union Tcl_ObjInternalRep { /* The internal representation: */
|
||||
typedef union Tcl_ObjInternalRep {/* The internal representation: */
|
||||
long longValue; /* - an long integer value. */
|
||||
double doubleValue; /* - a double-precision floating value. */
|
||||
void *otherValuePtr; /* - another, type-specific value, */
|
||||
@@ -854,8 +817,13 @@ typedef struct {
|
||||
* Tcl_CreateObjCommand; 2 if objProc was registered by
|
||||
* a call to Tcl_CreateObjCommand2; 0 otherwise.
|
||||
* Tcl_SetCmdInfo does not modify this field. */
|
||||
#ifdef TCL_NO_DEPRECATED
|
||||
void *objProcNotUsed; /* Command's object-based function. */
|
||||
void *objClientDataNotUsed; /* ClientData for object proc. */
|
||||
#else
|
||||
Tcl_ObjCmdProc *objProc; /* Command's object-based function. */
|
||||
void *objClientData; /* ClientData for object proc. */
|
||||
#endif
|
||||
Tcl_CmdProc *proc; /* Command's string-based function. */
|
||||
void *clientData; /* ClientData for string proc. */
|
||||
Tcl_CmdDeleteProc *deleteProc;
|
||||
@@ -921,10 +889,10 @@ typedef struct Tcl_DString {
|
||||
* TCL_NUMBER_NAN Value is NaN.
|
||||
*/
|
||||
|
||||
#define TCL_NUMBER_INT 2
|
||||
#define TCL_NUMBER_BIG 3
|
||||
#define TCL_NUMBER_DOUBLE 4
|
||||
#define TCL_NUMBER_NAN 5
|
||||
#define TCL_NUMBER_INT 2
|
||||
#define TCL_NUMBER_BIG 3
|
||||
#define TCL_NUMBER_DOUBLE 4
|
||||
#define TCL_NUMBER_NAN 5
|
||||
|
||||
/*
|
||||
* Flag values passed to Tcl_ConvertElement.
|
||||
@@ -957,11 +925,7 @@ typedef struct Tcl_DString {
|
||||
* TCL_COMBINE Combine surrogates
|
||||
*/
|
||||
|
||||
#if TCL_MAJOR_VERSION > 8
|
||||
# define TCL_COMBINE 0x1000000
|
||||
#else
|
||||
# define TCL_COMBINE 0
|
||||
#endif
|
||||
#define TCL_COMBINE 0x1000000
|
||||
/*
|
||||
*----------------------------------------------------------------------------
|
||||
* Flag values passed to Tcl_RecordAndEval, Tcl_EvalObj, Tcl_EvalObjv.
|
||||
@@ -989,7 +953,7 @@ typedef struct Tcl_DString {
|
||||
#define TCL_EVAL_DIRECT 0x040000
|
||||
#define TCL_EVAL_INVOKE 0x080000
|
||||
#define TCL_CANCEL_UNWIND 0x100000
|
||||
#define TCL_EVAL_NOERR 0x200000
|
||||
#define TCL_EVAL_NOERR 0x200000
|
||||
|
||||
/*
|
||||
* Special freeProc values that may be passed to Tcl_SetResult (see the man
|
||||
@@ -1065,19 +1029,15 @@ typedef struct Tcl_DString {
|
||||
* Forward declarations of Tcl_HashTable and related types.
|
||||
*/
|
||||
|
||||
#ifndef TCL_HASH_TYPE
|
||||
#if TCL_MAJOR_VERSION > 8
|
||||
# define TCL_HASH_TYPE size_t
|
||||
#else
|
||||
# define TCL_HASH_TYPE unsigned
|
||||
#endif
|
||||
#if !defined(TCL_HASH_TYPE) && !defined (TCL_NO_DEPRECATED)
|
||||
# define TCL_HASH_TYPE size_t
|
||||
#endif
|
||||
|
||||
typedef struct Tcl_HashKeyType Tcl_HashKeyType;
|
||||
typedef struct Tcl_HashTable Tcl_HashTable;
|
||||
typedef struct Tcl_HashEntry Tcl_HashEntry;
|
||||
|
||||
typedef TCL_HASH_TYPE (Tcl_HashKeyProc) (Tcl_HashTable *tablePtr, void *keyPtr);
|
||||
typedef size_t (Tcl_HashKeyProc) (Tcl_HashTable *tablePtr, void *keyPtr);
|
||||
typedef int (Tcl_CompareHashKeysProc) (void *keyPtr, Tcl_HashEntry *hPtr);
|
||||
typedef Tcl_HashEntry * (Tcl_AllocHashEntryProc) (Tcl_HashTable *tablePtr,
|
||||
void *keyPtr);
|
||||
@@ -1195,21 +1155,20 @@ struct Tcl_HashTable {
|
||||
* table. */
|
||||
Tcl_Size rebuildSize; /* Enlarge table when numEntries gets to be
|
||||
* this large. */
|
||||
#if TCL_MAJOR_VERSION > 8
|
||||
size_t mask; /* Mask value used in hashing function. */
|
||||
#endif
|
||||
int downShift; /* Shift count used in hashing function.
|
||||
* Designed to use high-order bits of
|
||||
* randomized keys. */
|
||||
#if TCL_MAJOR_VERSION < 9
|
||||
int mask; /* Mask value used in hashing function. */
|
||||
#endif
|
||||
int keyType; /* Type of keys used in this table. It's
|
||||
* either TCL_CUSTOM_KEYS, TCL_STRING_KEYS,
|
||||
* TCL_ONE_WORD_KEYS, or an integer giving the
|
||||
* number of ints that is the size of the
|
||||
* key. */
|
||||
#ifndef TCL_NO_DEPRECATED
|
||||
Tcl_HashEntry *(*findProc) (Tcl_HashTable *tablePtr, const char *key);
|
||||
#else
|
||||
void *unUsed;
|
||||
#endif
|
||||
Tcl_HashEntry *(*createProc) (Tcl_HashTable *tablePtr, const char *key,
|
||||
int *newPtr);
|
||||
const Tcl_HashKeyType *typePtr;
|
||||
@@ -1265,7 +1224,7 @@ typedef struct Tcl_HashSearch {
|
||||
typedef struct {
|
||||
void *next; /* Search position for underlying hash
|
||||
* table. */
|
||||
TCL_HASH_TYPE epoch; /* Epoch marker for dictionary being searched,
|
||||
size_t epoch; /* Epoch marker for dictionary being searched,
|
||||
* or 0 if search has terminated. */
|
||||
Tcl_Dict dictionaryPtr; /* Reference to dictionary being searched. */
|
||||
} Tcl_DictSearch;
|
||||
@@ -1321,12 +1280,8 @@ typedef enum {
|
||||
*/
|
||||
|
||||
typedef struct Tcl_Time {
|
||||
#if TCL_MAJOR_VERSION > 8
|
||||
long long sec; /* Seconds. */
|
||||
#else
|
||||
long sec; /* Seconds. */
|
||||
#endif
|
||||
#if defined(_CYGWIN_) && TCL_MAJOR_VERSION > 8
|
||||
#if defined(_CYGWIN_)
|
||||
int usec; /* Microseconds. */
|
||||
#else
|
||||
long usec; /* Microseconds. */
|
||||
@@ -1338,11 +1293,18 @@ typedef int (Tcl_WaitForEventProc) (const Tcl_Time *timePtr);
|
||||
|
||||
/*
|
||||
* TIP #233 (Virtualized Time)
|
||||
* WARNING: functionality removed, calls TCL_Panic
|
||||
*/
|
||||
|
||||
typedef void (Tcl_GetTimeProc) (Tcl_Time *timebuf, void *clientData);
|
||||
typedef void (Tcl_ScaleTimeProc) (Tcl_Time *timebuf, void *clientData);
|
||||
|
||||
/*
|
||||
* TIP #723 (Monotonic Time)
|
||||
*/
|
||||
|
||||
typedef long long (Tcl_GetMonotonicTimeProc) (void *clientData);
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------------
|
||||
* Bits to pass to Tcl_CreateFileHandler and Tcl_CreateChannelHandler to
|
||||
@@ -1377,11 +1339,7 @@ typedef void (Tcl_ScaleTimeProc) (Tcl_Time *timebuf, void *clientData);
|
||||
* interface.
|
||||
*/
|
||||
|
||||
#if TCL_MAJOR_VERSION > 8
|
||||
# define TCL_CLOSE2PROC NULL
|
||||
#else
|
||||
# define TCL_CLOSE2PROC ((void *) 1)
|
||||
#endif
|
||||
#define TCL_CLOSE2PROC NULL
|
||||
|
||||
/*
|
||||
* Channel version tag. This was introduced in 8.3.2/8.4.
|
||||
@@ -1929,12 +1887,10 @@ typedef struct Tcl_Parse {
|
||||
* *tokenPtr. */
|
||||
int errorType; /* One of the parsing error types defined
|
||||
* above. */
|
||||
#if TCL_MAJOR_VERSION > 8
|
||||
int incomplete; /* This field is set to 1 by Tcl_ParseCommand
|
||||
* if the command appears to be incomplete.
|
||||
* This information is used by
|
||||
* Tcl_CommandComplete. */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The fields below are intended only for the private use of the parser.
|
||||
@@ -1953,9 +1909,6 @@ typedef struct Tcl_Parse {
|
||||
* beginning of region where the error
|
||||
* occurred (e.g. the open brace if the close
|
||||
* brace is missing). */
|
||||
#if TCL_MAJOR_VERSION < 9
|
||||
int incomplete;
|
||||
#endif
|
||||
Tcl_Token staticTokens[NUM_STATIC_TOKENS];
|
||||
/* Initial space for tokens for command. This
|
||||
* space should be large enough to accommodate
|
||||
@@ -2036,11 +1989,7 @@ typedef struct Tcl_EncodingType {
|
||||
|
||||
#define TCL_ENCODING_START 0x01
|
||||
#define TCL_ENCODING_END 0x02
|
||||
#if TCL_MAJOR_VERSION > 8
|
||||
# define TCL_ENCODING_STOPONERROR 0x0 /* Not used any more */
|
||||
#else
|
||||
# define TCL_ENCODING_STOPONERROR 0x04
|
||||
#endif
|
||||
#define TCL_ENCODING_STOPONERROR 0x0 /* Not used any more */
|
||||
#define TCL_ENCODING_NO_TERMINATE 0x08
|
||||
#define TCL_ENCODING_CHAR_LIMIT 0x10
|
||||
/* Internal use bits, do not define bits in this space. See above comment */
|
||||
@@ -2050,7 +1999,7 @@ typedef struct Tcl_EncodingType {
|
||||
* changes, ensure ENCODING_PROFILE_* macros in tclInt.h are modified if
|
||||
* necessary.
|
||||
*/
|
||||
#define TCL_ENCODING_PROFILE_STRICT TCL_ENCODING_STOPONERROR
|
||||
#define TCL_ENCODING_PROFILE_STRICT 0x00000000
|
||||
#define TCL_ENCODING_PROFILE_TCL8 0x01000000
|
||||
#define TCL_ENCODING_PROFILE_REPLACE 0x02000000
|
||||
|
||||
@@ -2093,11 +2042,7 @@ typedef struct Tcl_EncodingType {
|
||||
*/
|
||||
|
||||
#ifndef TCL_UTF_MAX
|
||||
# if defined(BUILD_tcl) || TCL_MAJOR_VERSION > 8
|
||||
# define TCL_UTF_MAX 4
|
||||
# else
|
||||
# define TCL_UTF_MAX 3
|
||||
# endif
|
||||
# define TCL_UTF_MAX 4
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -2105,7 +2050,7 @@ typedef struct Tcl_EncodingType {
|
||||
* reflected in regcustom.h.
|
||||
*/
|
||||
|
||||
#if TCL_UTF_MAX == 4 && TCL_MAJOR_VERSION > 8
|
||||
#if TCL_UTF_MAX == 4
|
||||
/*
|
||||
* int isn't 100% accurate as it should be a strict 4-byte value
|
||||
* (perhaps int32_t). ILP64/SILP64 systems may have troubles. The
|
||||
@@ -2117,6 +2062,13 @@ typedef unsigned short Tcl_UniChar;
|
||||
#else
|
||||
# error "This TCL_UTF_MAX value is not supported"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Specifiers for Unicode normalization forms.
|
||||
*/
|
||||
typedef enum {
|
||||
TCL_NFC, TCL_NFD, TCL_NFKC, TCL_NFKD
|
||||
} Tcl_UnicodeNormalizationForm;
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------------
|
||||
@@ -2146,11 +2098,7 @@ typedef struct Tcl_Config {
|
||||
*/
|
||||
|
||||
typedef void (Tcl_LimitHandlerProc) (void *clientData, Tcl_Interp *interp);
|
||||
#if TCL_MAJOR_VERSION > 8
|
||||
#define Tcl_LimitHandlerDeleteProc Tcl_FreeProc
|
||||
#else
|
||||
typedef void (Tcl_LimitHandlerDeleteProc) (void *clientData);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/*
|
||||
@@ -2298,8 +2246,7 @@ typedef Tcl_Size (Tcl_ArgvGenFuncProc)(void *clientData, Tcl_Interp *interp,
|
||||
* Single public declaration for NRE.
|
||||
*/
|
||||
|
||||
typedef int (Tcl_NRPostProc) (void *data[], Tcl_Interp *interp,
|
||||
int result);
|
||||
typedef int (Tcl_NRPostProc) (void *data[], Tcl_Interp *interp, int result);
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------------
|
||||
@@ -2307,11 +2254,7 @@ typedef int (Tcl_NRPostProc) (void *data[], Tcl_Interp *interp,
|
||||
* stubs tables.
|
||||
*/
|
||||
|
||||
#if TCL_MAJOR_VERSION > 8
|
||||
# define TCL_STUB_MAGIC ((int) 0xFCA3BACB + (int) sizeof(void *))
|
||||
#else
|
||||
# define TCL_STUB_MAGIC ((int) 0xFCA3BACF)
|
||||
#endif
|
||||
#define TCL_STUB_MAGIC ((int) 0xFCA3BACB + (int) sizeof(void *))
|
||||
|
||||
/*
|
||||
* The following function is required to be defined in all stubs aware
|
||||
@@ -2333,28 +2276,15 @@ void * TclStubCall(void *arg);
|
||||
#endif
|
||||
|
||||
#ifdef USE_TCL_STUBS
|
||||
#if TCL_MAJOR_VERSION < 9
|
||||
# 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, version, \
|
||||
(exact)|(TCL_MAJOR_VERSION<<8)|(TCL_MINOR_VERSION<<16), \
|
||||
TCL_STUB_MAGIC)
|
||||
#endif
|
||||
#else
|
||||
#if TCL_MAJOR_VERSION < 9
|
||||
# define Tcl_InitStubs(interp, version, exact) \
|
||||
Tcl_Panic(((void)interp, (void)version, \
|
||||
(void)exact, "Please define -DUSE_TCL_STUBS"))
|
||||
#else
|
||||
# define Tcl_InitStubs(interp, version, exact) \
|
||||
Tcl_PkgInitStubsCheck(interp, version, \
|
||||
(exact)|(TCL_MAJOR_VERSION<<8)|(TCL_MINOR_VERSION<<16))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Public functions that are not accessible via the stubs table.
|
||||
@@ -2394,7 +2324,7 @@ EXTERN const char *TclZipfs_AppHook(int *argc, char ***argv);
|
||||
EXTERN TCL_NORETURN void Tcl_MainExW(Tcl_Size argc, unsigned short **argv,
|
||||
Tcl_AppInitProc *appInitProc, Tcl_Interp *interp);
|
||||
#endif
|
||||
#if defined(USE_TCL_STUBS) && (TCL_MAJOR_VERSION > 8)
|
||||
#if defined(USE_TCL_STUBS)
|
||||
#define Tcl_SetPanicProc(panicProc) \
|
||||
TclInitStubTable(((const char *(*)(Tcl_PanicProc *))TclStubCall((void *)panicProc))(panicProc))
|
||||
#define Tcl_InitSubsystems() \
|
||||
@@ -2505,12 +2435,12 @@ EXTERN const char *TclZipfs_AppHook(int *argc, char ***argv);
|
||||
static inline void
|
||||
TclBounceRefCount(
|
||||
Tcl_Obj* objPtr,
|
||||
const char* fn,
|
||||
const char* file,
|
||||
int line)
|
||||
{
|
||||
if (objPtr) {
|
||||
if ((objPtr)->refCount == 0) {
|
||||
Tcl_DbDecrRefCount(objPtr, fn, line);
|
||||
Tcl_DbDecrRefCount(objPtr, file, line);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2606,9 +2536,14 @@ TclBounceRefCount(
|
||||
*/
|
||||
|
||||
#define Tcl_FindHashEntry(tablePtr, key) \
|
||||
(*((tablePtr)->findProc))(tablePtr, (const char *)(key))
|
||||
#define Tcl_CreateHashEntry(tablePtr, key, newPtr) \
|
||||
(*((tablePtr)->createProc))(tablePtr, (const char *)(key), (int *)-1)
|
||||
#define Tcl_AttemptCreateHashEntry(tablePtr, key, newPtr) \
|
||||
(*((tablePtr)->createProc))(tablePtr, (const char *)(key), newPtr)
|
||||
#ifdef TCL_MEM_DEBUG
|
||||
#undef Tcl_CreateHashEntry
|
||||
#define Tcl_CreateHashEntry(tablePtr, key, newPtr) \
|
||||
Tcl_DbCreateHashEntry(tablePtr, key, newPtr, __FILE__, __LINE__)
|
||||
#endif
|
||||
|
||||
#endif /* RC_INVOKED */
|
||||
|
||||
|
||||
+6
-6
@@ -125,7 +125,7 @@ static struct block bigBlocks={ /* Big blocks aren't suballocated. */
|
||||
#if TCL_THREADS
|
||||
static Tcl_Mutex *allocMutexPtr;
|
||||
#endif
|
||||
static int allocInit = 0;
|
||||
static bool allocInit = false;
|
||||
|
||||
#ifdef MSTATS
|
||||
|
||||
@@ -171,7 +171,7 @@ void
|
||||
TclInitAlloc(void)
|
||||
{
|
||||
if (!allocInit) {
|
||||
allocInit = 1;
|
||||
allocInit = true;
|
||||
#if TCL_THREADS
|
||||
allocMutexPtr = Tcl_GetAllocMutex();
|
||||
#endif
|
||||
@@ -517,7 +517,7 @@ TclpRealloc(
|
||||
int i;
|
||||
union overhead *overPtr;
|
||||
struct block *bigBlockPtr;
|
||||
int expensive;
|
||||
bool expensive;
|
||||
size_t maxSize;
|
||||
|
||||
if (oldPtr == NULL) {
|
||||
@@ -584,11 +584,11 @@ TclpRealloc(
|
||||
return (void *)(overPtr+1);
|
||||
}
|
||||
maxSize = (size_t)1 << (i+3);
|
||||
expensive = 0;
|
||||
expensive = false;
|
||||
if (numBytes+OVERHEAD > maxSize) {
|
||||
expensive = 1;
|
||||
expensive = true;
|
||||
} else if (i>0 && numBytes+OVERHEAD < maxSize/2) {
|
||||
expensive = 1;
|
||||
expensive = true;
|
||||
}
|
||||
|
||||
if (expensive) {
|
||||
|
||||
+97
-98
@@ -47,23 +47,23 @@
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Tcl_Size len;
|
||||
Tcl_Obj **elements;
|
||||
int isDouble;
|
||||
Tcl_Size refCount;
|
||||
Tcl_Size len; // Number of elements.
|
||||
Tcl_Obj **elements; // Allocated element cache; can be NULL.
|
||||
bool isDouble; // Which subtype; Dbl or Int.
|
||||
Tcl_Size refCount; // Internal reference count.
|
||||
} ArithSeries;
|
||||
|
||||
typedef struct {
|
||||
ArithSeries base;
|
||||
Tcl_WideInt start;
|
||||
Tcl_WideInt step;
|
||||
Tcl_WideInt start; // Start of sequence.
|
||||
Tcl_WideInt step; // Step of sequence.
|
||||
} ArithSeriesInt;
|
||||
|
||||
typedef struct {
|
||||
ArithSeries base;
|
||||
double start;
|
||||
double step;
|
||||
unsigned precision; /* Number of decimal places to render. */
|
||||
double start; // Start of sequence.
|
||||
double step; // Step of sequence.
|
||||
unsigned precision; // Number of decimal places to render.
|
||||
} ArithSeriesDbl;
|
||||
|
||||
/* Forward declarations. */
|
||||
@@ -91,20 +91,20 @@ static int ArithSeriesInOperation(Tcl_Interp *interp,
|
||||
/* ------------------------ ArithSeries object type -------------------------- */
|
||||
|
||||
static const Tcl_ObjType arithSeriesType = {
|
||||
"arithseries", /* name */
|
||||
FreeArithSeriesInternalRep, /* freeIntRepProc */
|
||||
DupArithSeriesInternalRep, /* dupIntRepProc */
|
||||
UpdateStringOfArithSeries, /* updateStringProc */
|
||||
NULL, /* setFromAnyProc */
|
||||
"arithseries",
|
||||
FreeArithSeriesInternalRep,
|
||||
DupArithSeriesInternalRep,
|
||||
UpdateStringOfArithSeries,
|
||||
NULL, // SetFromAny
|
||||
TCL_OBJTYPE_V2(
|
||||
ArithSeriesObjLength,
|
||||
TclArithSeriesObjIndex,
|
||||
TclArithSeriesObjRange,
|
||||
TclArithSeriesObjReverse,
|
||||
TclArithSeriesGetElements,
|
||||
NULL, // SetElement
|
||||
NULL, // Replace
|
||||
ArithSeriesInOperation) // "in" operator
|
||||
ArithSeriesObjLength,
|
||||
TclArithSeriesObjIndex,
|
||||
TclArithSeriesObjRange,
|
||||
TclArithSeriesObjReverse,
|
||||
TclArithSeriesGetElements,
|
||||
NULL, // SetElement
|
||||
NULL, // Replace
|
||||
ArithSeriesInOperation)
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -165,7 +165,7 @@ ArithSeriesEndDbl(
|
||||
if (!dblRepPtr->base.len) {
|
||||
return dblRepPtr->start;
|
||||
}
|
||||
d = dblRepPtr->start + ((double)(dblRepPtr->base.len-1) * dblRepPtr->step);
|
||||
d = dblRepPtr->start + ((double)(dblRepPtr->base.len - 1) * dblRepPtr->step);
|
||||
return ArithRound(d, dblRepPtr->precision);
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ ArithSeriesEndInt(
|
||||
if (!intRepPtr->base.len) {
|
||||
return intRepPtr->start;
|
||||
}
|
||||
return intRepPtr->start + ((intRepPtr->base.len-1) * intRepPtr->step);
|
||||
return intRepPtr->start + ((intRepPtr->base.len - 1) * intRepPtr->step);
|
||||
}
|
||||
|
||||
static inline double
|
||||
@@ -188,7 +188,7 @@ ArithSeriesIndexDbl(
|
||||
assert(arithSeriesRepPtr->isDouble);
|
||||
double d = dblRepPtr->start;
|
||||
if (index) {
|
||||
d += ((double)index * dblRepPtr->step);
|
||||
d += (double)index * dblRepPtr->step;
|
||||
}
|
||||
|
||||
return ArithRound(d, dblRepPtr->precision);
|
||||
@@ -214,7 +214,7 @@ ArithSeriesGetInternalRep(
|
||||
}
|
||||
|
||||
/*
|
||||
* Compute number of significant fractional digits
|
||||
* Compute number of significant fractional digits.
|
||||
*/
|
||||
static inline unsigned
|
||||
ObjPrecision(
|
||||
@@ -225,8 +225,7 @@ ObjPrecision(
|
||||
|
||||
if (TclHasInternalRep(numObj, &tclDoubleType) || (
|
||||
Tcl_GetNumberFromObj(NULL, numObj, &ptr, &type) == TCL_OK
|
||||
&& type == TCL_NUMBER_DOUBLE)
|
||||
) { /* TCL_NUMBER_DOUBLE */
|
||||
&& type == TCL_NUMBER_DOUBLE)) {
|
||||
const char *str = TclGetString(numObj);
|
||||
|
||||
if (strchr(str, 'e') == NULL && strchr(str, 'E') == NULL) {
|
||||
@@ -235,7 +234,7 @@ ObjPrecision(
|
||||
}
|
||||
/* don't calculate precision for e-notation */
|
||||
}
|
||||
/* no fraction for TCL_NUMBER_NAN, TCL_NUMBER_INT, TCL_NUMBER_BIG */
|
||||
// no fraction for TCL_NUMBER_NAN, TCL_NUMBER_INT, TCL_NUMBER_BIG
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -272,15 +271,13 @@ maxObjPrecision(
|
||||
*
|
||||
* ArithSeriesLen --
|
||||
*
|
||||
* Compute the length of the equivalent list where
|
||||
* every element is generated starting from *start*,
|
||||
* and adding *step* to generate every successive element
|
||||
* that's < *end* for positive steps, or > *end* for negative
|
||||
* steps.
|
||||
* Compute the length of the equivalent list where every element is
|
||||
* generated starting from *start*, and adding *step* to generate every
|
||||
* successive element that's < *end* for positive steps, or > *end* for
|
||||
* negative steps.
|
||||
*
|
||||
* Results:
|
||||
* The length of the list generated by the given range,
|
||||
* that may be zero.
|
||||
* The length of the list generated by the given range, that may be zero.
|
||||
* The function returns -1 if the list is of length infinite.
|
||||
*
|
||||
* Side effects:
|
||||
@@ -482,7 +479,7 @@ NewArithSeriesInt(
|
||||
}
|
||||
/* First, step*number of intervals should not overflow */
|
||||
if ((UWIDE_MAX / absoluteStep) < (Tcl_WideUInt) numIntervals) {
|
||||
goto invalid_range;
|
||||
goto invalidRange;
|
||||
}
|
||||
if (step > 0) {
|
||||
/*
|
||||
@@ -490,11 +487,11 @@ NewArithSeriesInt(
|
||||
* second term will not underflow a Tcl_WideInt
|
||||
*/
|
||||
if (start > (WIDE_MAX - (step * numIntervals))) {
|
||||
goto invalid_range;
|
||||
goto invalidRange;
|
||||
}
|
||||
} else if (step == WIDE_MIN) {
|
||||
if (numIntervals > 0 || start < 0) {
|
||||
goto invalid_range;
|
||||
goto invalidRange;
|
||||
}
|
||||
} else if (step < 0) {
|
||||
/*
|
||||
@@ -503,7 +500,7 @@ NewArithSeriesInt(
|
||||
* DON'T use absoluteStep here because of unsigned type promotion
|
||||
*/
|
||||
if (start < (WIDE_MIN + ((-step) * numIntervals))) {
|
||||
goto invalid_range;
|
||||
goto invalidRange;
|
||||
}
|
||||
} else /* step == 0 */ {
|
||||
/* TODO - step == 0 && length > 1 should be error? */
|
||||
@@ -513,7 +510,7 @@ NewArithSeriesInt(
|
||||
arithSeriesRepPtr = (ArithSeriesInt *) Tcl_Alloc(sizeof(ArithSeriesInt));
|
||||
arithSeriesRepPtr->base.len = length;
|
||||
arithSeriesRepPtr->base.elements = NULL;
|
||||
arithSeriesRepPtr->base.isDouble = 0;
|
||||
arithSeriesRepPtr->base.isDouble = false;
|
||||
arithSeriesRepPtr->base.refCount = 1;
|
||||
arithSeriesRepPtr->start = start;
|
||||
arithSeriesRepPtr->step = step;
|
||||
@@ -524,7 +521,7 @@ NewArithSeriesInt(
|
||||
|
||||
return arithSeriesObj;
|
||||
|
||||
invalid_range:
|
||||
invalidRange:
|
||||
Tcl_BounceRefCount(arithSeriesObj);
|
||||
return NULL;
|
||||
}
|
||||
@@ -543,6 +540,7 @@ invalid_range:
|
||||
*
|
||||
* Side Effects:
|
||||
* None.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
static Tcl_Obj *
|
||||
@@ -570,7 +568,7 @@ NewArithSeriesDbl(
|
||||
arithSeriesRepPtr = (ArithSeriesDbl *) Tcl_Alloc(sizeof(ArithSeriesDbl));
|
||||
arithSeriesRepPtr->base.len = length;
|
||||
arithSeriesRepPtr->base.elements = NULL;
|
||||
arithSeriesRepPtr->base.isDouble = 1;
|
||||
arithSeriesRepPtr->base.isDouble = true;
|
||||
arithSeriesRepPtr->base.refCount = 1;
|
||||
arithSeriesRepPtr->start = start;
|
||||
arithSeriesRepPtr->step = step;
|
||||
@@ -600,12 +598,13 @@ NewArithSeriesDbl(
|
||||
*
|
||||
* Side Effects:
|
||||
* None.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
static int
|
||||
assignNumber(
|
||||
Tcl_Interp *interp,
|
||||
int useDoubles,
|
||||
bool useDoubles,
|
||||
Tcl_WideInt *intNumberPtr,
|
||||
double *dblNumberPtr,
|
||||
Tcl_Obj *numberObj)
|
||||
@@ -661,12 +660,13 @@ assignNumber(
|
||||
*
|
||||
* Side Effects:
|
||||
* None.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
Tcl_Obj *
|
||||
TclNewArithSeriesObj(
|
||||
Tcl_Interp *interp, /* For error reporting */
|
||||
int useDoubles, /* Flag indicates values start,
|
||||
bool useDoubles, /* Flag indicates values start,
|
||||
* end, step, are treated as doubles */
|
||||
Tcl_Obj *startObj, /* Starting value */
|
||||
Tcl_Obj *endObj, /* Ending limit */
|
||||
@@ -678,6 +678,8 @@ TclNewArithSeriesObj(
|
||||
Tcl_WideInt len = -1;
|
||||
Tcl_Obj *objPtr;
|
||||
unsigned precision = (unsigned)-1; /* unknown precision */
|
||||
const char *description;
|
||||
char tmp[TCL_DOUBLE_SPACE + 2] = {0};
|
||||
|
||||
if (startObj) {
|
||||
if (assignNumber(interp, useDoubles, &start, &dstart, startObj) != TCL_OK) {
|
||||
@@ -696,15 +698,11 @@ TclNewArithSeriesObj(
|
||||
return objPtr;
|
||||
}
|
||||
}
|
||||
if (endObj) {
|
||||
if (assignNumber(interp, useDoubles, &end, &dend, endObj) != TCL_OK) {
|
||||
return NULL;
|
||||
}
|
||||
if (endObj && assignNumber(interp, useDoubles, &end, &dend, endObj) != TCL_OK) {
|
||||
return NULL;
|
||||
}
|
||||
if (lenObj) {
|
||||
if (Tcl_GetWideIntFromObj(interp, lenObj, &len) != TCL_OK) {
|
||||
return NULL;
|
||||
}
|
||||
if (lenObj && Tcl_GetWideIntFromObj(interp, lenObj, &len) != TCL_OK) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (endObj) {
|
||||
@@ -721,24 +719,13 @@ TclNewArithSeriesObj(
|
||||
}
|
||||
}
|
||||
}
|
||||
assert(dstep!=0);
|
||||
assert(dstep != 0);
|
||||
if (!lenObj) {
|
||||
if (useDoubles) {
|
||||
if (isinf(dstart) || isinf(dend)) {
|
||||
goto exceeded;
|
||||
}
|
||||
if (isnan(dstart) || isnan(dend)) {
|
||||
const char *description = "non-numeric floating-point value";
|
||||
char tmp[TCL_DOUBLE_SPACE + 2];
|
||||
|
||||
tmp[0] = '\0';
|
||||
Tcl_PrintDouble(NULL, isnan(dstart)?dstart:dend, tmp);
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"cannot use %s \"%s\" to estimate length of arith-series",
|
||||
description, tmp));
|
||||
Tcl_SetErrorCode(interp, "ARITH", "DOMAIN", description,
|
||||
(char *)NULL);
|
||||
return NULL;
|
||||
} else if (isnan(dstart) || isnan(dend)) {
|
||||
goto notANumber;
|
||||
}
|
||||
precision = maxObjPrecision(startObj, endObj, stepObj);
|
||||
len = ArithSeriesLenDbl(dstart, dend, dstep, precision);
|
||||
@@ -746,16 +733,14 @@ TclNewArithSeriesObj(
|
||||
len = ArithSeriesLenInt(start, end, step);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (useDoubles) {
|
||||
// Compute precision based on given command argument values
|
||||
precision = maxObjPrecision(startObj, NULL, stepObj);
|
||||
} else if (useDoubles) {
|
||||
// Compute precision based on given command argument values
|
||||
precision = maxObjPrecision(startObj, NULL, stepObj);
|
||||
|
||||
dend = dstart + (dstep * (double)(len-1));
|
||||
// Make computed end value match argument(s) precision
|
||||
dend = ArithRound(dend, precision);
|
||||
end = dend;
|
||||
}
|
||||
dend = dstart + (dstep * (double)(len-1));
|
||||
// Make computed end value match argument(s) precision
|
||||
dend = ArithRound(dend, precision);
|
||||
end = dend;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -764,11 +749,7 @@ TclNewArithSeriesObj(
|
||||
* (0x0ffffffffffffffa instead of 0x7fffffffffffffff by 64bit)
|
||||
*/
|
||||
if (len > TCL_SIZE_MAX) {
|
||||
exceeded:
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"max length of a Tcl list exceeded", TCL_AUTO_LENGTH));
|
||||
Tcl_SetErrorCode(interp, "TCL", "MEMORY", (char *)NULL);
|
||||
return NULL;
|
||||
goto exceeded;
|
||||
}
|
||||
|
||||
if (useDoubles) {
|
||||
@@ -776,10 +757,8 @@ TclNewArithSeriesObj(
|
||||
* so simply check the end of it and behave like [expr {Inf - Inf}] */
|
||||
double d = dstart + (double)(len - 1) * dstep;
|
||||
if (isnan(d)) {
|
||||
const char *s = "domain error: argument not in valid range";
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(s, -1));
|
||||
Tcl_SetErrorCode(interp, "ARITH", "DOMAIN", s, (char *)NULL);
|
||||
return NULL;
|
||||
description = "domain error: argument not in valid range";
|
||||
goto domain;
|
||||
}
|
||||
|
||||
if (precision == (unsigned)-1) {
|
||||
@@ -792,11 +771,30 @@ TclNewArithSeriesObj(
|
||||
}
|
||||
|
||||
if (objPtr == NULL && interp) {
|
||||
const char *description = "invalid arithmetic series parameter values";
|
||||
Tcl_SetResult(interp, description, TCL_STATIC);
|
||||
Tcl_SetErrorCode(interp, "ARITH", "DOMAIN", description, (char *)NULL);
|
||||
description = "invalid arithmetic series parameter values";
|
||||
goto domain;
|
||||
}
|
||||
return objPtr;
|
||||
|
||||
exceeded:
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"max length of a Tcl list exceeded", TCL_AUTO_LENGTH));
|
||||
Tcl_SetErrorCode(interp, "TCL", "MEMORY", (char *)NULL);
|
||||
return NULL;
|
||||
|
||||
domain:
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(description, TCL_AUTO_LENGTH));
|
||||
Tcl_SetErrorCode(interp, "ARITH", "DOMAIN", description, (char *)NULL);
|
||||
return NULL;
|
||||
|
||||
notANumber:
|
||||
description = "non-numeric floating-point value";
|
||||
Tcl_PrintDouble(NULL, isnan(dstart) ? dstart : dend, tmp);
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"cannot use %s \"%s\" to estimate length of arith-series",
|
||||
description, tmp));
|
||||
Tcl_SetErrorCode(interp, "ARITH", "DOMAIN", description, (char *)NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -926,7 +924,7 @@ TclArithSeriesObjRange(
|
||||
ArithSeriesDbl *dblRepPtr = (ArithSeriesDbl *)arithSeriesRepPtr;
|
||||
double dstart = ArithSeriesIndexDbl(arithSeriesRepPtr, fromIdx);
|
||||
|
||||
if (Tcl_IsShared(arithSeriesObj) || ((arithSeriesRepPtr->refCount > 1))) {
|
||||
if (Tcl_IsShared(arithSeriesObj) || (arithSeriesRepPtr->refCount > 1)) {
|
||||
/* as new object */
|
||||
*newObjPtr = NewArithSeriesDbl(dstart, dblRepPtr->step, len,
|
||||
dblRepPtr->precision);
|
||||
@@ -948,7 +946,7 @@ TclArithSeriesObjRange(
|
||||
ArithSeriesInt *intRepPtr = (ArithSeriesInt *) arithSeriesRepPtr;
|
||||
Tcl_WideInt start = ArithSeriesIndexInt(arithSeriesRepPtr, fromIdx);
|
||||
|
||||
if (Tcl_IsShared(arithSeriesObj) || ((arithSeriesRepPtr->refCount > 1))) {
|
||||
if (Tcl_IsShared(arithSeriesObj) || (arithSeriesRepPtr->refCount > 1)) {
|
||||
/* as new object */
|
||||
*newObjPtr = NewArithSeriesInt(start, intRepPtr->step, len);
|
||||
} else {
|
||||
@@ -1186,11 +1184,12 @@ UpdateStringOfArithSeries(
|
||||
Tcl_Size elen;
|
||||
|
||||
tmp[0] = '\0';
|
||||
Tcl_PrintDouble(NULL,d,tmp);
|
||||
Tcl_PrintDouble(NULL, d, tmp);
|
||||
elen = strlen(tmp);
|
||||
if (bytlen > TCL_SIZE_MAX - elen) {
|
||||
/* overflow, todo: check we could use some representation instead of the panic
|
||||
* to signal it is too large for string representation, because too heavy */
|
||||
/* overflow, todo: check we could use some representation
|
||||
* instead of the panic to signal it is too large for string
|
||||
* representation, because too heavy */
|
||||
Tcl_Panic("UpdateStringOfArithSeries: too large to represent");
|
||||
}
|
||||
bytlen += elen;
|
||||
@@ -1217,7 +1216,7 @@ UpdateStringOfArithSeries(
|
||||
double d = ArithSeriesIndexDbl(arithSeriesRepPtr, i);
|
||||
|
||||
*p = '\0';
|
||||
Tcl_PrintDouble(NULL,d,p);
|
||||
Tcl_PrintDouble(NULL, d, p);
|
||||
p += strlen(p);
|
||||
assert(p - arithSeriesObjPtr->bytes <= bytlen);
|
||||
*p++ = ' ';
|
||||
@@ -1260,12 +1259,12 @@ ArithSeriesInOperation(
|
||||
if (repPtr->isDouble) {
|
||||
ArithSeriesDbl *dblRepPtr = (ArithSeriesDbl *) repPtr;
|
||||
double y;
|
||||
int test = 0;
|
||||
bool test = false;
|
||||
|
||||
incr = 0; // Check index+incr where incr is 0 and 1
|
||||
status = Tcl_GetDoubleFromObj(interp, valueObj, &y);
|
||||
if (status != TCL_OK) {
|
||||
test = 0;
|
||||
test = false;
|
||||
} else {
|
||||
const char *vstr = TclGetStringFromObj(valueObj, &vlen);
|
||||
index = (y - dblRepPtr->start) / dblRepPtr->step;
|
||||
@@ -1278,7 +1277,7 @@ ArithSeriesInOperation(
|
||||
const char *estr = elemObj ? TclGetStringFromObj(elemObj, &elen) : "";
|
||||
|
||||
/* "in" operation defined as a string compare */
|
||||
test = (elen == vlen) ? (memcmp(estr, vstr, elen) == 0) : 0;
|
||||
test = (elen == vlen) && (memcmp(estr, vstr, elen) == 0);
|
||||
Tcl_BounceRefCount(elemObj);
|
||||
/* Stop if we have a match */
|
||||
if (test) {
|
||||
@@ -1288,7 +1287,7 @@ ArithSeriesInOperation(
|
||||
}
|
||||
}
|
||||
if (boolResult) {
|
||||
*boolResult = test;
|
||||
*boolResult = test ? 1 : 0;
|
||||
}
|
||||
} else {
|
||||
ArithSeriesInt *intRepPtr = (ArithSeriesInt *) repPtr;
|
||||
|
||||
+564
-563
File diff suppressed because it is too large
Load Diff
+19
-20
@@ -22,7 +22,7 @@ struct ThreadSpecificData;
|
||||
*/
|
||||
|
||||
typedef struct AsyncHandler {
|
||||
int ready; /* Non-zero means this handler should be
|
||||
signed char ready; /* Non-zero means this handler should be
|
||||
* invoked in the next call to
|
||||
* Tcl_AsyncInvoke. */
|
||||
struct AsyncHandler *nextPtr, *prevPtr;
|
||||
@@ -30,7 +30,7 @@ typedef struct AsyncHandler {
|
||||
* for the process. */
|
||||
Tcl_AsyncProc *proc; /* Procedure to call when handler is
|
||||
* invoked. */
|
||||
void *clientData; /* Value to pass to handler when it is
|
||||
void *clientData; /* Value to pass to handler when it is
|
||||
* invoked. */
|
||||
struct ThreadSpecificData *originTsd;
|
||||
/* Used in Tcl_AsyncMark to modify thread-
|
||||
@@ -38,17 +38,17 @@ typedef struct AsyncHandler {
|
||||
* associated to. */
|
||||
Tcl_ThreadId originThrdId; /* Origin thread where this token was created
|
||||
* and where it will be yielded. */
|
||||
void *notifierData; /* Platform notifier data or NULL. */
|
||||
void *notifierData; /* Platform notifier data or NULL. */
|
||||
} AsyncHandler;
|
||||
|
||||
typedef struct ThreadSpecificData {
|
||||
int asyncReady; /* This is set to 1 whenever a handler becomes
|
||||
bool asyncReady; /* This is set to 1 whenever a handler becomes
|
||||
* ready and it is cleared to zero whenever
|
||||
* Tcl_AsyncInvoke is called. It can be
|
||||
* checked elsewhere in the application by
|
||||
* calling Tcl_AsyncReady to see if
|
||||
* Tcl_AsyncInvoke should be invoked. */
|
||||
int asyncActive; /* Indicates whether Tcl_AsyncInvoke is
|
||||
bool asyncActive; /* Indicates whether Tcl_AsyncInvoke is
|
||||
* currently working. If so then we won't set
|
||||
* asyncReady again until Tcl_AsyncInvoke
|
||||
* returns. */
|
||||
@@ -142,7 +142,7 @@ Tcl_AsyncHandler
|
||||
Tcl_AsyncCreate(
|
||||
Tcl_AsyncProc *proc, /* Procedure to call when handler is
|
||||
* invoked. */
|
||||
void *clientData) /* Argument to pass to handler. */
|
||||
void *clientData) /* Argument to pass to handler. */
|
||||
{
|
||||
AsyncHandler *asyncPtr;
|
||||
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
|
||||
@@ -190,18 +190,17 @@ Tcl_AsyncCreate(
|
||||
|
||||
void
|
||||
Tcl_AsyncMark(
|
||||
Tcl_AsyncHandler async) /* Token for handler. */
|
||||
Tcl_AsyncHandler async) /* Token for handler. */
|
||||
{
|
||||
AsyncHandler *token = (AsyncHandler *) async;
|
||||
|
||||
Tcl_MutexLock(&asyncMutex);
|
||||
token->ready = 1;
|
||||
if (!token->originTsd->asyncActive) {
|
||||
token->originTsd->asyncReady = 1;
|
||||
token->originTsd->asyncReady = true;
|
||||
Tcl_ThreadAlert(token->originThrdId);
|
||||
}
|
||||
Tcl_MutexUnlock(&asyncMutex);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -224,14 +223,14 @@ Tcl_AsyncMark(
|
||||
|
||||
int
|
||||
Tcl_AsyncMarkFromSignal(
|
||||
Tcl_AsyncHandler async, /* Token for handler. */
|
||||
int sigNumber) /* Signal number. */
|
||||
Tcl_AsyncHandler async, /* Token for handler. */
|
||||
int sigNumber) /* Signal number. */
|
||||
{
|
||||
#if TCL_THREADS
|
||||
AsyncHandler *token = (AsyncHandler *) async;
|
||||
|
||||
return TclAsyncNotifier(sigNumber, token->originThrdId,
|
||||
token->notifierData, &token->ready, -1);
|
||||
token->notifierData, &token->ready, -1) ? 1 : 0;
|
||||
#else
|
||||
(void)sigNumber;
|
||||
|
||||
@@ -268,7 +267,7 @@ TclAsyncMarkFromNotifier(void)
|
||||
if (token->ready == -1) {
|
||||
token->ready = 1;
|
||||
if (!token->originTsd->asyncActive) {
|
||||
token->originTsd->asyncReady = 1;
|
||||
token->originTsd->asyncReady = true;
|
||||
Tcl_ThreadAlert(token->originThrdId);
|
||||
}
|
||||
}
|
||||
@@ -309,12 +308,12 @@ Tcl_AsyncInvoke(
|
||||
|
||||
Tcl_MutexLock(&asyncMutex);
|
||||
|
||||
if (tsdPtr->asyncReady == 0) {
|
||||
if (!tsdPtr->asyncReady) {
|
||||
Tcl_MutexUnlock(&asyncMutex);
|
||||
return code;
|
||||
}
|
||||
tsdPtr->asyncReady = 0;
|
||||
tsdPtr->asyncActive = 1;
|
||||
tsdPtr->asyncReady = false;
|
||||
tsdPtr->asyncActive = true;
|
||||
if (interp == NULL) {
|
||||
code = 0;
|
||||
}
|
||||
@@ -347,7 +346,7 @@ Tcl_AsyncInvoke(
|
||||
code = asyncPtr->proc(asyncPtr->clientData, interp, code);
|
||||
Tcl_MutexLock(&asyncMutex);
|
||||
}
|
||||
tsdPtr->asyncActive = 0;
|
||||
tsdPtr->asyncActive = false;
|
||||
Tcl_MutexUnlock(&asyncMutex);
|
||||
return code;
|
||||
}
|
||||
@@ -378,7 +377,7 @@ Tcl_AsyncInvoke(
|
||||
|
||||
void
|
||||
Tcl_AsyncDelete(
|
||||
Tcl_AsyncHandler async) /* Token for handler to delete. */
|
||||
Tcl_AsyncHandler async) /* Token for handler to delete. */
|
||||
{
|
||||
AsyncHandler *asyncPtr = (AsyncHandler *) async;
|
||||
|
||||
@@ -432,10 +431,10 @@ int
|
||||
Tcl_AsyncReady(void)
|
||||
{
|
||||
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
|
||||
return tsdPtr->asyncReady;
|
||||
return tsdPtr->asyncReady ? 1 : 0;
|
||||
}
|
||||
|
||||
int *
|
||||
bool *
|
||||
TclGetAsyncReadyPtr(void)
|
||||
{
|
||||
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
|
||||
|
||||
+342
-471
File diff suppressed because it is too large
Load Diff
+68
-99
@@ -20,16 +20,18 @@
|
||||
* The following constants are used by GetFormatSpec to indicate various
|
||||
* special conditions in the parsing of a format specifier.
|
||||
*/
|
||||
|
||||
#define BINARY_ALL -1 /* Use all elements in the argument. */
|
||||
#define BINARY_NOCOUNT -2 /* No count was specified in format. */
|
||||
enum GetFormatSpecSpecialCounts {
|
||||
BINARY_ALL = -1, /* Use all elements in the argument. */
|
||||
BINARY_NOCOUNT = -2 /* No count was specified in format. */
|
||||
};
|
||||
|
||||
/*
|
||||
* The following flags may be OR'ed together and returned by GetFormatSpec
|
||||
*/
|
||||
|
||||
#define BINARY_SIGNED 0 /* Field to be read as signed data */
|
||||
#define BINARY_UNSIGNED 1 /* Field to be read as unsigned data */
|
||||
enum GetFormatSpecFlags {
|
||||
BINARY_SIGNED = 0, /* Field to be read as signed data */
|
||||
BINARY_UNSIGNED = 1 /* Field to be read as unsigned data */
|
||||
};
|
||||
|
||||
/*
|
||||
* The following defines the maximum number of different (integer) numbers
|
||||
@@ -71,15 +73,15 @@ static int NeedReversing(int format);
|
||||
static void CopyNumber(const void *from, void *to,
|
||||
size_t length, int type);
|
||||
/* Binary ensemble commands */
|
||||
static Tcl_ObjCmdProc BinaryFormatCmd;
|
||||
static Tcl_ObjCmdProc BinaryScanCmd;
|
||||
static Tcl_ObjCmdProc2 BinaryFormatCmd;
|
||||
static Tcl_ObjCmdProc2 BinaryScanCmd;
|
||||
/* Binary encoding sub-ensemble commands */
|
||||
static Tcl_ObjCmdProc BinaryEncodeHex;
|
||||
static Tcl_ObjCmdProc BinaryDecodeHex;
|
||||
static Tcl_ObjCmdProc BinaryEncode64;
|
||||
static Tcl_ObjCmdProc BinaryDecode64;
|
||||
static Tcl_ObjCmdProc BinaryEncodeUu;
|
||||
static Tcl_ObjCmdProc BinaryDecodeUu;
|
||||
static Tcl_ObjCmdProc2 BinaryEncodeHex;
|
||||
static Tcl_ObjCmdProc2 BinaryDecodeHex;
|
||||
static Tcl_ObjCmdProc2 BinaryEncode64;
|
||||
static Tcl_ObjCmdProc2 BinaryDecode64;
|
||||
static Tcl_ObjCmdProc2 BinaryEncodeUu;
|
||||
static Tcl_ObjCmdProc2 BinaryDecodeUu;
|
||||
|
||||
/*
|
||||
* The following tables are used by the binary encoders
|
||||
@@ -118,20 +120,20 @@ static const char B64Digits[65] = {
|
||||
* How to construct the ensembles.
|
||||
*/
|
||||
|
||||
static const EnsembleImplMap binaryMap[] = {
|
||||
const EnsembleImplMap tclBinaryImplMap[] = {
|
||||
{ "format", BinaryFormatCmd, TclCompileBasicMin1ArgCmd, NULL, NULL, 0 },
|
||||
{ "scan", BinaryScanCmd, TclCompileBasicMin2ArgCmd, NULL, NULL, 0 },
|
||||
{ "scan", BinaryScanCmd, TclCompileBasicMin2ArgCmd, NULL, NULL, 0 }, // TODO: compile?
|
||||
{ "encode", NULL, NULL, NULL, NULL, 0 },
|
||||
{ "decode", NULL, NULL, NULL, NULL, 0 },
|
||||
{ NULL, NULL, NULL, NULL, NULL, 0 }
|
||||
};
|
||||
static const EnsembleImplMap encodeMap[] = {
|
||||
const EnsembleImplMap tclBinaryEncodeImplMap[] = {
|
||||
{ "hex", BinaryEncodeHex, TclCompileBasic1ArgCmd, NULL, NULL, 0 },
|
||||
{ "uuencode", BinaryEncodeUu, NULL, NULL, NULL, 0 },
|
||||
{ "base64", BinaryEncode64, NULL, NULL, NULL, 0 },
|
||||
{ NULL, NULL, NULL, NULL, NULL, 0 }
|
||||
};
|
||||
static const EnsembleImplMap decodeMap[] = {
|
||||
const EnsembleImplMap tclBinaryDecodeImplMap[] = {
|
||||
{ "hex", BinaryDecodeHex, TclCompileBasic1Or2ArgCmd, NULL, NULL, 0 },
|
||||
{ "uuencode", BinaryDecodeUu, TclCompileBasic1Or2ArgCmd, NULL, NULL, 0 },
|
||||
{ "base64", BinaryDecode64, TclCompileBasic1Or2ArgCmd, NULL, NULL, 0 },
|
||||
@@ -161,7 +163,7 @@ static const Tcl_ObjType properByteArrayType = {
|
||||
FreeProperByteArrayInternalRep,
|
||||
DupProperByteArrayInternalRep,
|
||||
UpdateStringOfByteArray,
|
||||
NULL,
|
||||
NULL, // SetFromAny
|
||||
TCL_OBJTYPE_V0
|
||||
};
|
||||
|
||||
@@ -383,7 +385,7 @@ Tcl_GetBytesFromObj(
|
||||
return baPtr->bytes;
|
||||
}
|
||||
|
||||
#if !defined(TCL_NO_DEPRECATED)
|
||||
#ifndef TCL_NO_DEPRECATED
|
||||
unsigned char *
|
||||
TclGetBytesFromObj(
|
||||
Tcl_Interp *interp, /* For error reporting */
|
||||
@@ -492,12 +494,12 @@ Tcl_SetByteArrayLength(
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static int
|
||||
static bool
|
||||
MakeByteArray(
|
||||
Tcl_Interp *interp,
|
||||
Tcl_Obj *objPtr,
|
||||
Tcl_Size limit,
|
||||
int demandProper,
|
||||
bool demandProper,
|
||||
ByteArray **byteArrayPtrPtr)
|
||||
{
|
||||
Tcl_Size length;
|
||||
@@ -507,14 +509,14 @@ MakeByteArray(
|
||||
unsigned char *dst = byteArrayPtr->bytes;
|
||||
unsigned char *dstEnd = dst + numBytes;
|
||||
const char *srcEnd = src + length;
|
||||
int proper = 1;
|
||||
bool proper = true;
|
||||
|
||||
for (; src < srcEnd && dst < dstEnd; ) {
|
||||
int ch;
|
||||
int count = TclUtfToUniChar(src, &ch);
|
||||
Tcl_Size count = TclUtfToUniChar(src, &ch);
|
||||
|
||||
if (ch > 255) {
|
||||
proper = 0;
|
||||
proper = false;
|
||||
if (demandProper) {
|
||||
if (interp) {
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
@@ -546,7 +548,7 @@ TclNarrowToBytes(
|
||||
Tcl_ObjInternalRep ir;
|
||||
ByteArray *byteArrayPtr;
|
||||
|
||||
if (0 == MakeByteArray(NULL, objPtr, TCL_INDEX_NONE, 0, &byteArrayPtr)) {
|
||||
if (!MakeByteArray(NULL, objPtr, TCL_INDEX_NONE, 0, &byteArrayPtr)) {
|
||||
TclNewObj(objPtr);
|
||||
TclInvalidateStringRep(objPtr);
|
||||
}
|
||||
@@ -582,7 +584,7 @@ SetByteArrayFromAny(
|
||||
ByteArray *byteArrayPtr;
|
||||
Tcl_ObjInternalRep ir;
|
||||
|
||||
if (0 == MakeByteArray(interp, objPtr, limit, 1, &byteArrayPtr)) {
|
||||
if (!MakeByteArray(interp, objPtr, limit, 1, &byteArrayPtr)) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
@@ -769,12 +771,9 @@ TclAppendBytesToByteArray(
|
||||
needed = byteArrayPtr->used + len;
|
||||
if (needed > byteArrayPtr->allocated) {
|
||||
Tcl_Size newCapacity;
|
||||
byteArrayPtr =
|
||||
(ByteArray *)TclReallocElemsEx(byteArrayPtr,
|
||||
needed,
|
||||
1,
|
||||
offsetof(ByteArray, bytes),
|
||||
&newCapacity);
|
||||
byteArrayPtr = (ByteArray *)
|
||||
TclReallocElemsEx(byteArrayPtr, needed, 1,
|
||||
offsetof(ByteArray, bytes), &newCapacity);
|
||||
byteArrayPtr->allocated = newCapacity;
|
||||
SET_BYTEARRAY(irPtr, byteArrayPtr);
|
||||
}
|
||||
@@ -786,35 +785,6 @@ TclAppendBytesToByteArray(
|
||||
TclInvalidateStringRep(objPtr);
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* TclInitBinaryCmd --
|
||||
*
|
||||
* This function is called to create the "binary" Tcl command. See the
|
||||
* user documentation for details on what it does.
|
||||
*
|
||||
* Results:
|
||||
* A command token for the new command.
|
||||
*
|
||||
* Side effects:
|
||||
* Creates a new binary command as a mapped ensemble.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
Tcl_Command
|
||||
TclInitBinaryCmd(
|
||||
Tcl_Interp *interp)
|
||||
{
|
||||
Tcl_Command binaryEnsemble;
|
||||
|
||||
binaryEnsemble = TclMakeEnsemble(interp, "binary", binaryMap);
|
||||
TclMakeEnsemble(interp, "binary encode", encodeMap);
|
||||
TclMakeEnsemble(interp, "binary decode", decodeMap);
|
||||
return binaryEnsemble;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
@@ -835,10 +805,10 @@ static int
|
||||
BinaryFormatCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
int arg; /* Index of next argument to consume. */
|
||||
Tcl_Size arg; /* Index of next argument to consume. */
|
||||
int value = 0; /* Current integer value to be packed.
|
||||
* Initialized to avoid compiler warning. */
|
||||
char cmd; /* Current format character. */
|
||||
@@ -1295,22 +1265,22 @@ BinaryFormatCmd(
|
||||
Tcl_SetObjResult(interp, resultPtr);
|
||||
return TCL_OK;
|
||||
|
||||
badValue:
|
||||
badValue:
|
||||
Tcl_ResetResult(interp);
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"expected %s string but got \"%s\" instead",
|
||||
errorString, errorValue));
|
||||
return TCL_ERROR;
|
||||
|
||||
badCount:
|
||||
badCount:
|
||||
errorString = "missing count for \"@\" field specifier";
|
||||
goto error;
|
||||
|
||||
badIndex:
|
||||
badIndex:
|
||||
errorString = "not enough arguments for all format specifiers";
|
||||
goto error;
|
||||
|
||||
badField:
|
||||
badField:
|
||||
{
|
||||
Tcl_UniChar ch = 0;
|
||||
char buf[5] = "";
|
||||
@@ -1322,7 +1292,7 @@ BinaryFormatCmd(
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
error:
|
||||
error:
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(errorString, -1));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -1347,10 +1317,10 @@ static int
|
||||
BinaryScanCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
int arg; /* Index of next argument to consume. */
|
||||
Tcl_Size arg; /* Index of next argument to consume. */
|
||||
int value = 0; /* Current integer value to be packed.
|
||||
* Initialized to avoid compiler warning. */
|
||||
char cmd; /* Current format character. */
|
||||
@@ -1677,21 +1647,21 @@ BinaryScanCmd(
|
||||
* Set the result to the last position of the cursor.
|
||||
*/
|
||||
|
||||
done:
|
||||
done:
|
||||
Tcl_SetObjResult(interp, Tcl_NewWideIntObj(arg - 3));
|
||||
DeleteScanNumberCache(numberCachePtr);
|
||||
|
||||
return TCL_OK;
|
||||
|
||||
badCount:
|
||||
badCount:
|
||||
errorString = "missing count for \"@\" field specifier";
|
||||
goto error;
|
||||
|
||||
badIndex:
|
||||
badIndex:
|
||||
errorString = "not enough arguments for all format specifiers";
|
||||
goto error;
|
||||
|
||||
badField:
|
||||
badField:
|
||||
{
|
||||
Tcl_UniChar ch = 0;
|
||||
char buf[5] = "";
|
||||
@@ -1703,7 +1673,7 @@ BinaryScanCmd(
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
error:
|
||||
error:
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(errorString, -1));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -2431,7 +2401,7 @@ static int
|
||||
BinaryEncodeHex(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
Tcl_Obj *resultObj = NULL;
|
||||
@@ -2479,14 +2449,14 @@ static int
|
||||
BinaryDecodeHex(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
Tcl_Obj *resultObj = NULL;
|
||||
unsigned char *data, *datastart, *dataend;
|
||||
unsigned char *begin, *cursor, c;
|
||||
int i, index, value, pure = 1, strict = 0;
|
||||
Tcl_Size size, cut = 0, count = 0;
|
||||
int index, value, pure = 1, strict = 0;
|
||||
Tcl_Size i, size, cut = 0, count = 0;
|
||||
int ucs4;
|
||||
enum {OPT_STRICT };
|
||||
static const char *const optStrings[] = { "-strict", NULL };
|
||||
@@ -2606,16 +2576,16 @@ static int
|
||||
BinaryEncode64(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
Tcl_Obj *resultObj;
|
||||
unsigned char *data, *limit;
|
||||
Tcl_WideInt maxlen = 0;
|
||||
const char *wrapchar = "\n";
|
||||
Tcl_Size wrapcharlen = 1;
|
||||
Tcl_Size i, wrapcharlen = 1;
|
||||
int index, purewrap = 1;
|
||||
Tcl_Size i, offset, size, outindex = 0, count = 0;
|
||||
Tcl_Size offset, size, outindex = 0, count = 0;
|
||||
enum { OPT_MAXLEN, OPT_WRAPCHAR };
|
||||
static const char *const optStrings[] = { "-maxlen", "-wrapchar", NULL };
|
||||
|
||||
@@ -2668,7 +2638,7 @@ BinaryEncode64(
|
||||
|
||||
size = (((count * 4) / 3) + 3) & ~3; /* ensure 4 byte chunks */
|
||||
if (maxlen > 0 && size > maxlen) {
|
||||
int adjusted = size + (wrapcharlen * (size / maxlen));
|
||||
Tcl_Size adjusted = size + (wrapcharlen * (size / maxlen));
|
||||
|
||||
if (size % maxlen == 0) {
|
||||
adjusted -= wrapcharlen;
|
||||
@@ -2734,17 +2704,16 @@ static int
|
||||
BinaryEncodeUu(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
Tcl_Obj *resultObj;
|
||||
unsigned char *data, *start, *cursor;
|
||||
int i, bits;
|
||||
unsigned int n;
|
||||
int lineLength = 61;
|
||||
int bits, lineLength = 61;
|
||||
Tcl_Size rawLength;
|
||||
const unsigned char SingleNewline[] = { UCHAR('\n') };
|
||||
const unsigned char *wrapchar = SingleNewline;
|
||||
Tcl_Size j, rawLength, offset, count = 0, wrapcharlen = sizeof(SingleNewline);
|
||||
Tcl_Size n, i, j, offset, count = 0, wrapcharlen = sizeof(SingleNewline);
|
||||
enum { OPT_MAXLEN, OPT_WRAPCHAR } index;
|
||||
static const char *const optStrings[] = { "-maxlen", "-wrapchar", NULL };
|
||||
|
||||
@@ -2886,14 +2855,14 @@ static int
|
||||
BinaryDecodeUu(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
Tcl_Obj *resultObj = NULL;
|
||||
unsigned char *data, *datastart, *dataend;
|
||||
unsigned char *begin, *cursor;
|
||||
int i, index, pure = 1, strict = 0, lineLen;
|
||||
Tcl_Size size, count = 0;
|
||||
int index, pure = 1, strict = 0, lineLen;
|
||||
Tcl_Size i, size, count = 0;
|
||||
unsigned char c;
|
||||
int ucs4;
|
||||
enum { OPT_STRICT };
|
||||
@@ -2977,14 +2946,14 @@ BinaryDecodeUu(
|
||||
*/
|
||||
|
||||
if (lineLen > 0) {
|
||||
*cursor++ = (((d[0] - 0x20) & 0x3F) << 2)
|
||||
*cursor++ = (unsigned char)(((d[0] - 0x20) & 0x3F) << 2)
|
||||
| (((d[1] - 0x20) & 0x3F) >> 4);
|
||||
if (--lineLen > 0) {
|
||||
*cursor++ = (((d[1] - 0x20) & 0x3F) << 4)
|
||||
*cursor++ = (unsigned char)(((d[1] - 0x20) & 0x3F) << 4)
|
||||
| (((d[2] - 0x20) & 0x3F) >> 2);
|
||||
if (--lineLen > 0) {
|
||||
*cursor++ = (((d[2] - 0x20) & 0x3F) << 6)
|
||||
| (((d[3] - 0x20) & 0x3F));
|
||||
*cursor++ = (unsigned char)((((d[2] - 0x20) & 0x3F) << 6)
|
||||
| (((d[3] - 0x20) & 0x3F)));
|
||||
lineLen--;
|
||||
}
|
||||
}
|
||||
@@ -3062,7 +3031,7 @@ static int
|
||||
BinaryDecode64(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
Tcl_Obj *resultObj = NULL;
|
||||
@@ -3070,8 +3039,8 @@ BinaryDecode64(
|
||||
unsigned char *begin = NULL;
|
||||
unsigned char *cursor = NULL;
|
||||
int pure = 1, strict = 0;
|
||||
int i, index, cut = 0;
|
||||
Tcl_Size size, count = 0;
|
||||
int index, cut = 0;
|
||||
Tcl_Size i, size, count = 0;
|
||||
int ucs4;
|
||||
enum { OPT_STRICT };
|
||||
static const char *const optStrings[] = { "-strict", NULL };
|
||||
|
||||
+43
-48
@@ -275,7 +275,6 @@ ValidateMemory(
|
||||
memset(memHeaderP->low_guard, 0, LOW_GUARD_SIZE);
|
||||
memset(hiPtr, 0, HIGH_GUARD_SIZE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -798,21 +797,38 @@ static int
|
||||
MemoryCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Obj values of arguments. */
|
||||
{
|
||||
const char *fileName;
|
||||
FILE *fileP;
|
||||
Tcl_DString buffer;
|
||||
int result;
|
||||
Tcl_WideInt value;
|
||||
int result, option;
|
||||
size_t len;
|
||||
static const char *const options[] = {
|
||||
"active", "break_on_malloc", "info",
|
||||
"init", "objs", "onexit",
|
||||
"tag", "trace", "trace_on_at_malloc",
|
||||
"validate", NULL
|
||||
};
|
||||
enum Options {
|
||||
OPT_ACTIVE, OPT_BREAK, OPT_INFO,
|
||||
OPT_INIT, OPT_OBJS, OPT_ONEXIT,
|
||||
OPT_TAG, OPT_TRACE, OPT_TRACEAT,
|
||||
OPT_VALID
|
||||
};
|
||||
|
||||
if (objc < 2) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "option [args..]");
|
||||
return TCL_ERROR;
|
||||
} else if (Tcl_GetIndexFromObj(interp, objv[1], options, "option",
|
||||
TCL_EXACT, &option) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
if (strcmp(TclGetString(objv[1]), "active") == 0 || strcmp(TclGetString(objv[1]), "display") == 0) {
|
||||
switch (option) {
|
||||
case OPT_ACTIVE:
|
||||
if (objc != 3) {
|
||||
Tcl_WrongNumArgs(interp, 2, objv, "file");
|
||||
return TCL_ERROR;
|
||||
@@ -829,9 +845,7 @@ MemoryCmd(
|
||||
return TCL_ERROR;
|
||||
}
|
||||
return TCL_OK;
|
||||
}
|
||||
if (strcmp(TclGetString(objv[1]),"break_on_malloc") == 0) {
|
||||
Tcl_WideInt value;
|
||||
case OPT_BREAK:
|
||||
if (objc != 3) {
|
||||
goto argError;
|
||||
}
|
||||
@@ -840,8 +854,7 @@ MemoryCmd(
|
||||
}
|
||||
break_on_malloc = value;
|
||||
return TCL_OK;
|
||||
}
|
||||
if (strcmp(TclGetString(objv[1]),"info") == 0) {
|
||||
case OPT_INFO:
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"%-25s %10" TCL_Z_MODIFIER "u\n%-25s %10" TCL_Z_MODIFIER "u\n%-25s %10" TCL_Z_MODIFIER "u\n%-25s %10" TCL_Z_MODIFIER "u\n%-25s %10" TCL_Z_MODIFIER "u\n%-25s %10" TCL_Z_MODIFIER "u\n",
|
||||
"total mallocs", total_mallocs, "total frees", total_frees,
|
||||
@@ -850,15 +863,12 @@ MemoryCmd(
|
||||
"maximum packets allocated", maximum_malloc_packets,
|
||||
"maximum bytes allocated", maximum_bytes_malloced));
|
||||
return TCL_OK;
|
||||
}
|
||||
if (strcmp(TclGetString(objv[1]), "init") == 0) {
|
||||
case OPT_INIT:
|
||||
if (objc != 3) {
|
||||
goto bad_suboption;
|
||||
}
|
||||
init_malloced_bodies = (strcmp(TclGetString(objv[2]),"on") == 0);
|
||||
return TCL_OK;
|
||||
}
|
||||
if (strcmp(TclGetString(objv[1]), "objs") == 0) {
|
||||
return Tcl_GetBooleanFromObj(interp, objv[2], &init_malloced_bodies);
|
||||
case OPT_OBJS:
|
||||
if (objc != 3) {
|
||||
Tcl_WrongNumArgs(interp, 2, objv, "file");
|
||||
return TCL_ERROR;
|
||||
@@ -878,8 +888,7 @@ MemoryCmd(
|
||||
fclose(fileP);
|
||||
Tcl_DStringFree(&buffer);
|
||||
return TCL_OK;
|
||||
}
|
||||
if (strcmp(TclGetString(objv[1]),"onexit") == 0) {
|
||||
case OPT_ONEXIT:
|
||||
if (objc != 3) {
|
||||
Tcl_WrongNumArgs(interp, 2, objv, "file");
|
||||
return TCL_ERROR;
|
||||
@@ -892,8 +901,7 @@ MemoryCmd(
|
||||
strcpy(onExitMemDumpFileName,fileName);
|
||||
Tcl_DStringFree(&buffer);
|
||||
return TCL_OK;
|
||||
}
|
||||
if (strcmp(TclGetString(objv[1]),"tag") == 0) {
|
||||
case OPT_TAG:
|
||||
if (objc != 3) {
|
||||
Tcl_WrongNumArgs(interp, 2, objv, "file");
|
||||
return TCL_ERROR;
|
||||
@@ -906,17 +914,12 @@ MemoryCmd(
|
||||
curTagPtr->refCount = 0;
|
||||
memcpy(curTagPtr->string, TclGetString(objv[2]), len + 1);
|
||||
return TCL_OK;
|
||||
}
|
||||
if (strcmp(TclGetString(objv[1]),"trace") == 0) {
|
||||
case OPT_TRACE:
|
||||
if (objc != 3) {
|
||||
goto bad_suboption;
|
||||
}
|
||||
alloc_tracing = (strcmp(TclGetString(objv[2]),"on") == 0);
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
if (strcmp(TclGetString(objv[1]),"trace_on_at_malloc") == 0) {
|
||||
Tcl_WideInt value;
|
||||
return Tcl_GetBooleanFromObj(interp, objv[2], &alloc_tracing);
|
||||
case OPT_TRACEAT:
|
||||
if (objc != 3) {
|
||||
goto argError;
|
||||
}
|
||||
@@ -925,21 +928,15 @@ MemoryCmd(
|
||||
}
|
||||
trace_on_at_malloc = value;
|
||||
return TCL_OK;
|
||||
}
|
||||
if (strcmp(TclGetString(objv[1]),"validate") == 0) {
|
||||
case OPT_VALID:
|
||||
if (objc != 3) {
|
||||
goto bad_suboption;
|
||||
}
|
||||
validate_memory = (strcmp(TclGetString(objv[2]),"on") == 0);
|
||||
return TCL_OK;
|
||||
return Tcl_GetBooleanFromObj(interp, objv[2], &validate_memory);
|
||||
default:
|
||||
TCL_UNREACHABLE();
|
||||
}
|
||||
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"bad option \"%s\": should be active, break_on_malloc, info, "
|
||||
"init, objs, onexit, tag, trace, trace_on_at_malloc, or validate",
|
||||
TclGetString(objv[1])));
|
||||
return TCL_ERROR;
|
||||
|
||||
argError:
|
||||
Tcl_WrongNumArgs(interp, 2, objv, "count");
|
||||
return TCL_ERROR;
|
||||
@@ -970,7 +967,7 @@ static int
|
||||
CheckmemCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Interpreter for evaluation. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Obj values of arguments. */
|
||||
{
|
||||
if (objc != 2) {
|
||||
@@ -1004,8 +1001,8 @@ Tcl_InitMemory(
|
||||
* added */
|
||||
{
|
||||
TclInitDbCkalloc();
|
||||
Tcl_CreateObjCommand(interp, "memory", MemoryCmd, NULL, NULL);
|
||||
Tcl_CreateObjCommand(interp, "checkmem", CheckmemCmd, NULL, NULL);
|
||||
Tcl_CreateObjCommand2(interp, "memory", MemoryCmd, NULL, NULL);
|
||||
Tcl_CreateObjCommand2(interp, "checkmem", CheckmemCmd, NULL, NULL);
|
||||
}
|
||||
|
||||
#else /* TCL_MEM_DEBUG */
|
||||
@@ -1256,12 +1253,11 @@ TclAllocElemsEx(
|
||||
* non-NULL. Only modified on success */
|
||||
{
|
||||
void *ptr = TclAttemptReallocElemsEx(
|
||||
NULL, elemCount, elemSize, leadSize, capacityPtr);
|
||||
NULL, elemCount, elemSize, leadSize, capacityPtr);
|
||||
if (ptr == NULL) {
|
||||
Tcl_Panic("Failed to allocate %" TCL_SIZE_MODIFIER
|
||||
"d elements of size %" TCL_SIZE_MODIFIER "d bytes.",
|
||||
elemCount,
|
||||
elemSize);
|
||||
"d elements of size %" TCL_SIZE_MODIFIER "d bytes.",
|
||||
elemCount, elemSize);
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
@@ -1362,12 +1358,11 @@ TclReallocElemsEx(
|
||||
* non-NULL. Only modified on success */
|
||||
{
|
||||
void *ptr = TclAttemptReallocElemsEx(
|
||||
oldPtr, elemCount, elemSize, leadSize, capacityPtr);
|
||||
oldPtr, elemCount, elemSize, leadSize, capacityPtr);
|
||||
if (ptr == NULL) {
|
||||
Tcl_Panic("Failed to reallocate %" TCL_SIZE_MODIFIER
|
||||
"d elements of size %" TCL_SIZE_MODIFIER "d bytes.",
|
||||
elemCount,
|
||||
elemSize);
|
||||
"d elements of size %" TCL_SIZE_MODIFIER "d bytes.",
|
||||
elemCount, elemSize);
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
+135
-181
@@ -22,6 +22,9 @@
|
||||
#pragma clang diagnostic ignored "-Wc++-keyword"
|
||||
#endif
|
||||
|
||||
/* The namespace containing the [clock] internals. */
|
||||
#define TCL_CLOCK_NS "::tcl::clock"
|
||||
|
||||
/*
|
||||
* Table of the days in each month, leap and common years
|
||||
*/
|
||||
@@ -74,80 +77,100 @@ static int ConvertUTCToLocalUsingC(Tcl_Interp *,
|
||||
static int ConvertLocalToUTC(ClockClientData *, Tcl_Interp *,
|
||||
TclDateFields *, Tcl_Obj *timezoneObj, int);
|
||||
static int ConvertLocalToUTCUsingTable(Tcl_Interp *,
|
||||
TclDateFields *, int, Tcl_Obj *const[],
|
||||
TclDateFields *, Tcl_Size, Tcl_Obj *const[],
|
||||
Tcl_WideInt *rangesVal);
|
||||
static int ConvertLocalToUTCUsingC(Tcl_Interp *,
|
||||
TclDateFields *, int);
|
||||
static Tcl_ObjCmdProc ClockConfigureObjCmd;
|
||||
static Tcl_ObjCmdProc2 ClockConfigureObjCmd;
|
||||
static void GetYearWeekDay(TclDateFields *, int);
|
||||
static void GetGregorianEraYearDay(TclDateFields *, int);
|
||||
static void GetJulianDayFromEraYearMonthDay(
|
||||
TclDateFields *fields, int changeover);
|
||||
static void GetMonthDay(TclDateFields *);
|
||||
static Tcl_WideInt WeekdayOnOrBefore(int, Tcl_WideInt);
|
||||
static Tcl_ObjCmdProc ClockClicksObjCmd;
|
||||
static Tcl_ObjCmdProc ClockConvertlocaltoutcObjCmd;
|
||||
static Tcl_ObjCmdProc2 ClockClicksObjCmd;
|
||||
static Tcl_ObjCmdProc2 ClockConvertlocaltoutcObjCmd;
|
||||
static int ClockGetDateFields(ClockClientData *,
|
||||
Tcl_Interp *interp, TclDateFields *fields,
|
||||
Tcl_Obj *timezoneObj, int changeover);
|
||||
static void GetJulianDayFromEraYearWeekDay(
|
||||
TclDateFields *fields, int changeover);
|
||||
static Tcl_ObjCmdProc ClockGetdatefieldsObjCmd;
|
||||
static Tcl_ObjCmdProc ClockGetjuliandayfromerayearmonthdayObjCmd;
|
||||
static Tcl_ObjCmdProc ClockGetjuliandayfromerayearweekdayObjCmd;
|
||||
static Tcl_ObjCmdProc ClockGetenvObjCmd;
|
||||
static Tcl_ObjCmdProc ClockMicrosecondsObjCmd;
|
||||
static Tcl_ObjCmdProc ClockMillisecondsObjCmd;
|
||||
static Tcl_ObjCmdProc ClockSecondsObjCmd;
|
||||
static Tcl_ObjCmdProc ClockFormatObjCmd;
|
||||
static Tcl_ObjCmdProc ClockScanObjCmd;
|
||||
static Tcl_ObjCmdProc2 ClockGetdatefieldsObjCmd;
|
||||
static Tcl_ObjCmdProc2 ClockGetjuliandayfromerayearmonthdayObjCmd;
|
||||
static Tcl_ObjCmdProc2 ClockGetjuliandayfromerayearweekdayObjCmd;
|
||||
static Tcl_ObjCmdProc2 ClockGetenvObjCmd;
|
||||
static Tcl_ObjCmdProc2 ClockMicrosecondsObjCmd;
|
||||
static Tcl_ObjCmdProc2 ClockMillisecondsObjCmd;
|
||||
static Tcl_ObjCmdProc2 ClockSecondsObjCmd;
|
||||
static Tcl_ObjCmdProc2 ClockMonotonicObjCmd;
|
||||
static Tcl_ObjCmdProc2 ClockFormatObjCmd;
|
||||
static Tcl_ObjCmdProc2 ClockScanObjCmd;
|
||||
static int ClockScanCommit(DateInfo *info,
|
||||
ClockFmtScnCmdArgs *opts);
|
||||
static int ClockFreeScan(DateInfo *info,
|
||||
Tcl_Obj *strObj, ClockFmtScnCmdArgs *opts);
|
||||
static int ClockCalcRelTime(DateInfo *info,
|
||||
ClockFmtScnCmdArgs *opts);
|
||||
static Tcl_ObjCmdProc ClockAddObjCmd;
|
||||
static Tcl_ObjCmdProc2 ClockAddObjCmd;
|
||||
static int ClockValidDate(DateInfo *,
|
||||
ClockFmtScnCmdArgs *, int stage);
|
||||
static struct tm * ThreadSafeLocalTime(const time_t *);
|
||||
static size_t TzsetIfNecessary(void);
|
||||
static void ClockDeleteCmdProc(void *);
|
||||
static Tcl_ObjCmdProc ClockSafeCatchCmd;
|
||||
static void ClockFinalize(void *);
|
||||
|
||||
/*
|
||||
* Structure containing description of "native" clock commands to create.
|
||||
*/
|
||||
|
||||
struct ClockCommand {
|
||||
const char *name; /* The tail of the command name. The full name
|
||||
* is "::tcl::clock::<name>". When NULL marks
|
||||
* the end of the table. */
|
||||
Tcl_ObjCmdProc *objCmdProc; /* Function that implements the command. This
|
||||
Tcl_ObjCmdProc2 *objCmdProc; /* Function that implements the command. This
|
||||
* will always have the ClockClientData sent
|
||||
* to it, but may well ignore this data. */
|
||||
CompileProc *compileProc; /* The compiler for the command. */
|
||||
void *clientData; /* Any clientData to give the command (if NULL
|
||||
* a reference to ClockClientData will be sent) */
|
||||
int useClientData; /* Whether to use the shared ClockClientData
|
||||
* with this command. */
|
||||
};
|
||||
|
||||
/*
|
||||
* Table of command created by this file, excluding the compiled parts of the
|
||||
* [clock] ensemble, as those are defined below (and never need access to the
|
||||
* ClockClientData).
|
||||
*/
|
||||
static const struct ClockCommand clockCommands[] = {
|
||||
{"add", ClockAddObjCmd, TclCompileBasicMin1ArgCmd, NULL},
|
||||
{"clicks", ClockClicksObjCmd, TclCompileClockClicksCmd, NULL},
|
||||
{"format", ClockFormatObjCmd, TclCompileBasicMin1ArgCmd, NULL},
|
||||
{"getenv", ClockGetenvObjCmd, TclCompileBasicMin1ArgCmd, NULL},
|
||||
{"microseconds", ClockMicrosecondsObjCmd,TclCompileClockReadingCmd, INT2PTR(1)},
|
||||
{"milliseconds", ClockMillisecondsObjCmd,TclCompileClockReadingCmd, INT2PTR(2)},
|
||||
{"scan", ClockScanObjCmd, TclCompileBasicMin1ArgCmd, NULL},
|
||||
{"seconds", ClockSecondsObjCmd, TclCompileClockReadingCmd, INT2PTR(3)},
|
||||
{"ConvertLocalToUTC", ClockConvertlocaltoutcObjCmd, NULL, NULL},
|
||||
{"GetDateFields", ClockGetdatefieldsObjCmd, NULL, NULL},
|
||||
{"add", ClockAddObjCmd, TclCompileBasicMin1ArgCmd, 1},
|
||||
{"format", ClockFormatObjCmd, TclCompileBasicMin1ArgCmd, 1},
|
||||
{"getenv", ClockGetenvObjCmd, NULL, 1},
|
||||
{"scan", ClockScanObjCmd, TclCompileBasicMin1ArgCmd, 1},
|
||||
{"ConvertLocalToUTC", ClockConvertlocaltoutcObjCmd, NULL, 1},
|
||||
{"GetDateFields", ClockGetdatefieldsObjCmd, NULL, 1},
|
||||
{"GetJulianDayFromEraYearMonthDay",
|
||||
ClockGetjuliandayfromerayearmonthdayObjCmd, NULL, NULL},
|
||||
ClockGetjuliandayfromerayearmonthdayObjCmd, NULL, 1},
|
||||
{"GetJulianDayFromEraYearWeekDay",
|
||||
ClockGetjuliandayfromerayearweekdayObjCmd, NULL, NULL},
|
||||
{"catch", ClockSafeCatchCmd, TclCompileBasicMin1ArgCmd, NULL},
|
||||
{NULL, NULL, NULL, NULL}
|
||||
ClockGetjuliandayfromerayearweekdayObjCmd, NULL, 1},
|
||||
{"catch", TclSafeCatchCmd, NULL, 0},
|
||||
{NULL, NULL, NULL, 0}
|
||||
};
|
||||
|
||||
/*
|
||||
* Definition of the [clock] ensemble.
|
||||
*
|
||||
* [clock add], [clock format] and [clock scan] have special clientData, so
|
||||
* we just tell the ensemble that they'll be there instead of maxing them at
|
||||
* this point.
|
||||
*/
|
||||
const EnsembleImplMap tclClockImplMap[] = {
|
||||
{"add", NULL, NULL, NULL, NULL, 1},
|
||||
{"clicks", ClockClicksObjCmd, TclCompileClockClicksCmd, NULL, NULL, 0},
|
||||
{"format", NULL, NULL, NULL, NULL, 1},
|
||||
{"microseconds", ClockMicrosecondsObjCmd,TclCompileClockReadingCmd, NULL, INT2PTR(CLOCK_READ_MICROS), 0},
|
||||
{"milliseconds", ClockMillisecondsObjCmd,TclCompileClockReadingCmd, NULL, INT2PTR(CLOCK_READ_MILLIS), 0},
|
||||
{"monotonic", ClockMonotonicObjCmd,TclCompileClockReadingCmd, NULL, INT2PTR(CLOCK_READ_MONOTONIC), 0},
|
||||
{"scan", NULL, NULL, NULL, NULL, 1},
|
||||
{"seconds", ClockSecondsObjCmd, TclCompileClockReadingCmd, NULL, INT2PTR(CLOCK_READ_SECS), 0},
|
||||
{NULL, NULL, NULL, NULL, NULL, 0}
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -172,15 +195,8 @@ void
|
||||
TclClockInit(
|
||||
Tcl_Interp *interp) /* Tcl interpreter */
|
||||
{
|
||||
const struct ClockCommand *clockCmdPtr;
|
||||
char cmdName[50]; /* Buffer large enough to hold the string
|
||||
*::tcl::clock::GetJulianDayFromEraYearMonthDay
|
||||
* plus a terminating NUL. */
|
||||
Command *cmdPtr;
|
||||
ClockClientData *data;
|
||||
int i;
|
||||
|
||||
static int initialized = 0; /* global clock engine initialized (in process) */
|
||||
|
||||
/*
|
||||
* Register handler to finalize clock on exit.
|
||||
*/
|
||||
@@ -202,9 +218,10 @@ TclClockInit(
|
||||
* Create the client data, which is a refcounted literal pool.
|
||||
*/
|
||||
|
||||
data = (ClockClientData *)Tcl_Alloc(sizeof(ClockClientData));
|
||||
ClockClientData *data = (ClockClientData *)Tcl_Alloc(sizeof(ClockClientData));
|
||||
data->refCount = 0;
|
||||
data->literals = (Tcl_Obj **)Tcl_Alloc(LIT__END * sizeof(Tcl_Obj*));
|
||||
int i;
|
||||
for (i = 0; i < LIT__END; ++i) {
|
||||
TclInitObjRef(data->literals[i], Tcl_NewStringObj(
|
||||
Literals[i], TCL_AUTO_LENGTH));
|
||||
@@ -254,27 +271,22 @@ TclClockInit(
|
||||
* Install the commands.
|
||||
*/
|
||||
|
||||
#define TCL_CLOCK_PREFIX_LEN 14 /* == strlen("::tcl::clock::") */
|
||||
memcpy(cmdName, "::tcl::clock::", TCL_CLOCK_PREFIX_LEN);
|
||||
Tcl_Namespace *nsPtr = Tcl_FindNamespace(interp, TCL_CLOCK_NS, NULL, 0);
|
||||
const struct ClockCommand *clockCmdPtr;
|
||||
for (clockCmdPtr=clockCommands ; clockCmdPtr->name!=NULL ; clockCmdPtr++) {
|
||||
void *clientData;
|
||||
|
||||
strcpy(cmdName + TCL_CLOCK_PREFIX_LEN, clockCmdPtr->name);
|
||||
if (!(clientData = clockCmdPtr->clientData)) {
|
||||
void *clientData = NULL;
|
||||
if (clockCmdPtr->useClientData) {
|
||||
clientData = data;
|
||||
data->refCount++;
|
||||
}
|
||||
cmdPtr = (Command *)Tcl_CreateObjCommand(interp, cmdName,
|
||||
clockCmdPtr->objCmdProc, clientData,
|
||||
clockCmdPtr->clientData ? NULL : ClockDeleteCmdProc);
|
||||
cmdPtr->compileProc = clockCmdPtr->compileProc ?
|
||||
clockCmdPtr->compileProc : TclCompileBasicMin0ArgCmd;
|
||||
Command *cmdPtr = (Command *)TclCreateObjCommandInNs(interp,
|
||||
clockCmdPtr->name, nsPtr, clockCmdPtr->objCmdProc, clientData,
|
||||
clientData ? ClockDeleteCmdProc : NULL);
|
||||
cmdPtr->compileProc = clockCmdPtr->compileProc;
|
||||
}
|
||||
cmdPtr = (Command *) Tcl_CreateObjCommand(interp,
|
||||
"::tcl::unsupported::clock::configure",
|
||||
Tcl_CreateObjCommand2(interp, "::tcl::unsupported::clock::configure",
|
||||
ClockConfigureObjCmd, data, ClockDeleteCmdProc);
|
||||
data->refCount++;
|
||||
cmdPtr->compileProc = TclCompileBasicMin0ArgCmd;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -955,21 +967,21 @@ static int
|
||||
ClockConfigureObjCmd(
|
||||
void *clientData, /* Client data containing literal pool */
|
||||
Tcl_Interp *interp, /* Tcl interpreter */
|
||||
int objc, /* Parameter count */
|
||||
Tcl_Size objc, /* Parameter count */
|
||||
Tcl_Obj *const objv[]) /* Parameter vector */
|
||||
{
|
||||
ClockClientData *dataPtr = (ClockClientData *)clientData;
|
||||
static const char *const options[] = {
|
||||
"-default-locale", "-clear", "-current-locale",
|
||||
"-year-century", "-century-switch",
|
||||
"-min-year", "-max-year", "-max-jdn", "-validate",
|
||||
"-init-complete", "-setup-tz", "-system-tz", NULL
|
||||
"-default-locale", "-clear", "-current-locale",
|
||||
"-year-century", "-century-switch",
|
||||
"-min-year", "-max-year", "-max-jdn",
|
||||
"-validate", "-setup-tz", "-system-tz", NULL
|
||||
};
|
||||
enum optionInd {
|
||||
CLOCK_DEFAULT_LOCALE, CLOCK_CLEAR_CACHE, CLOCK_CURRENT_LOCALE,
|
||||
CLOCK_YEAR_CENTURY, CLOCK_CENTURY_SWITCH,
|
||||
CLOCK_MIN_YEAR, CLOCK_MAX_YEAR, CLOCK_MAX_JDN, CLOCK_VALIDATE,
|
||||
CLOCK_INIT_COMPLETE, CLOCK_SETUP_TZ, CLOCK_SYSTEM_TZ
|
||||
CLOCK_SETUP_TZ, CLOCK_SYSTEM_TZ
|
||||
};
|
||||
int optionIndex; /* Index of an option. */
|
||||
Tcl_Size i;
|
||||
@@ -1141,26 +1153,6 @@ ClockConfigureObjCmd(
|
||||
case CLOCK_CLEAR_CACHE:
|
||||
ClockConfigureClear(dataPtr);
|
||||
break;
|
||||
case CLOCK_INIT_COMPLETE: {
|
||||
/*
|
||||
* Init completed.
|
||||
* Compile clock ensemble (performance purposes).
|
||||
*/
|
||||
Tcl_Command token = Tcl_FindCommand(interp, "::clock",
|
||||
NULL, TCL_GLOBAL_ONLY);
|
||||
if (!token) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
int ensFlags = 0;
|
||||
if (Tcl_GetEnsembleFlags(interp, token, &ensFlags) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
ensFlags |= ENSEMBLE_COMPILE;
|
||||
if (Tcl_SetEnsembleFlags(interp, token, ensFlags) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
TCL_UNREACHABLE();
|
||||
}
|
||||
@@ -1410,7 +1402,7 @@ static int
|
||||
ClockConvertlocaltoutcObjCmd(
|
||||
void *clientData, /* Literal table */
|
||||
Tcl_Interp *interp, /* Tcl interpreter */
|
||||
int objc, /* Parameter count */
|
||||
Tcl_Size objc, /* Parameter count */
|
||||
Tcl_Obj *const *objv) /* Parameter vector */
|
||||
{
|
||||
ClockClientData *dataPtr = (ClockClientData *)clientData;
|
||||
@@ -1419,7 +1411,6 @@ ClockConvertlocaltoutcObjCmd(
|
||||
int changeover;
|
||||
TclDateFields fields;
|
||||
int created = 0;
|
||||
int status;
|
||||
|
||||
fields.tzName = NULL;
|
||||
/*
|
||||
@@ -1456,15 +1447,15 @@ ClockConvertlocaltoutcObjCmd(
|
||||
created = 1;
|
||||
Tcl_IncrRefCount(dict);
|
||||
}
|
||||
status = Tcl_DictObjPut(interp, dict, dataPtr->literals[LIT_SECONDS],
|
||||
int result = Tcl_DictObjPut(interp, dict, dataPtr->literals[LIT_SECONDS],
|
||||
Tcl_NewWideIntObj(fields.seconds));
|
||||
if (status == TCL_OK) {
|
||||
if (result == TCL_OK) {
|
||||
Tcl_SetObjResult(interp, dict);
|
||||
}
|
||||
if (created) {
|
||||
Tcl_DecrRefCount(dict);
|
||||
}
|
||||
return status;
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1500,7 +1491,7 @@ int
|
||||
ClockGetdatefieldsObjCmd(
|
||||
void *clientData, /* Opaque pointer to literal pool, etc. */
|
||||
Tcl_Interp *interp, /* Tcl interpreter */
|
||||
int objc, /* Parameter count */
|
||||
Tcl_Size objc, /* Parameter count */
|
||||
Tcl_Obj *const *objv) /* Parameter vector */
|
||||
{
|
||||
TclDateFields fields;
|
||||
@@ -1694,7 +1685,7 @@ static int
|
||||
ClockGetjuliandayfromerayearmonthdayObjCmd(
|
||||
void *clientData, /* Opaque pointer to literal pool, etc. */
|
||||
Tcl_Interp *interp, /* Tcl interpreter */
|
||||
int objc, /* Parameter count */
|
||||
Tcl_Size objc, /* Parameter count */
|
||||
Tcl_Obj *const *objv) /* Parameter vector */
|
||||
{
|
||||
TclDateFields fields;
|
||||
@@ -1703,7 +1694,6 @@ ClockGetjuliandayfromerayearmonthdayObjCmd(
|
||||
Tcl_Obj *const *lit = data->literals;
|
||||
int changeover;
|
||||
int copied = 0;
|
||||
int status;
|
||||
int isBce = 0;
|
||||
|
||||
fields.tzName = NULL;
|
||||
@@ -1748,15 +1738,15 @@ ClockGetjuliandayfromerayearmonthdayObjCmd(
|
||||
Tcl_IncrRefCount(dict);
|
||||
copied = 1;
|
||||
}
|
||||
status = Tcl_DictObjPut(interp, dict, lit[LIT_JULIANDAY],
|
||||
int result = Tcl_DictObjPut(interp, dict, lit[LIT_JULIANDAY],
|
||||
Tcl_NewWideIntObj(fields.julianDay));
|
||||
if (status == TCL_OK) {
|
||||
if (result == TCL_OK) {
|
||||
Tcl_SetObjResult(interp, dict);
|
||||
}
|
||||
if (copied) {
|
||||
Tcl_DecrRefCount(dict);
|
||||
}
|
||||
return status;
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1784,7 +1774,7 @@ static int
|
||||
ClockGetjuliandayfromerayearweekdayObjCmd(
|
||||
void *clientData, /* Opaque pointer to literal pool, etc. */
|
||||
Tcl_Interp *interp, /* Tcl interpreter */
|
||||
int objc, /* Parameter count */
|
||||
Tcl_Size objc, /* Parameter count */
|
||||
Tcl_Obj *const *objv) /* Parameter vector */
|
||||
{
|
||||
TclDateFields fields;
|
||||
@@ -1793,7 +1783,6 @@ ClockGetjuliandayfromerayearweekdayObjCmd(
|
||||
Tcl_Obj *const *lit = data->literals;
|
||||
int changeover;
|
||||
int copied = 0;
|
||||
int status;
|
||||
int isBce = 0;
|
||||
|
||||
fields.tzName = NULL;
|
||||
@@ -1838,15 +1827,15 @@ ClockGetjuliandayfromerayearweekdayObjCmd(
|
||||
Tcl_IncrRefCount(dict);
|
||||
copied = 1;
|
||||
}
|
||||
status = Tcl_DictObjPut(interp, dict, lit[LIT_JULIANDAY],
|
||||
int result = Tcl_DictObjPut(interp, dict, lit[LIT_JULIANDAY],
|
||||
Tcl_NewWideIntObj(fields.julianDay));
|
||||
if (status == TCL_OK) {
|
||||
if (result == TCL_OK) {
|
||||
Tcl_SetObjResult(interp, dict);
|
||||
}
|
||||
if (copied) {
|
||||
Tcl_DecrRefCount(dict);
|
||||
}
|
||||
return status;
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2008,7 +1997,7 @@ static int
|
||||
ConvertLocalToUTCUsingTable(
|
||||
Tcl_Interp *interp, /* Tcl interpreter */
|
||||
TclDateFields *fields, /* Time to convert, with 'seconds' filled in */
|
||||
int rowc, /* Number of points at which time changes */
|
||||
Tcl_Size rowc, /* Number of points at which time changes */
|
||||
Tcl_Obj *const rowv[], /* Points at which time changes */
|
||||
Tcl_WideInt *rangesVal) /* Return bounds for time period */
|
||||
{
|
||||
@@ -3035,7 +3024,7 @@ int
|
||||
ClockGetenvObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
#ifdef _WIN32
|
||||
@@ -3139,7 +3128,7 @@ int
|
||||
ClockClicksObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Tcl interpreter */
|
||||
int objc, /* Parameter count */
|
||||
Tcl_Size objc, /* Parameter count */
|
||||
Tcl_Obj *const *objv) /* Parameter values */
|
||||
{
|
||||
static const char *const clicksSwitches[] = {
|
||||
@@ -3211,7 +3200,7 @@ int
|
||||
ClockMillisecondsObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Tcl interpreter */
|
||||
int objc, /* Parameter count */
|
||||
Tcl_Size objc, /* Parameter count */
|
||||
Tcl_Obj *const *objv) /* Parameter values */
|
||||
{
|
||||
Tcl_Time now;
|
||||
@@ -3250,7 +3239,7 @@ int
|
||||
ClockMicrosecondsObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Tcl interpreter */
|
||||
int objc, /* Parameter count */
|
||||
Tcl_Size objc, /* Parameter count */
|
||||
Tcl_Obj *const *objv) /* Parameter values */
|
||||
{
|
||||
if (objc != 1) {
|
||||
@@ -3261,6 +3250,45 @@ ClockMicrosecondsObjCmd(
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
*
|
||||
* ClockMonotonicObjCmd -
|
||||
*
|
||||
* Returns a count of monotonic microseconds.
|
||||
*
|
||||
* Results:
|
||||
* Returns a standard Tcl result.
|
||||
*
|
||||
* Side effects:
|
||||
* None.
|
||||
*
|
||||
* This function implements the 'clock monotonic' Tcl command. Refer to the
|
||||
* user documentation for details on what it does.
|
||||
*
|
||||
* Note that tclExecute.c contains a byte compiled version.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int
|
||||
ClockMonotonicObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Tcl interpreter */
|
||||
Tcl_Size objc, /* Parameter count */
|
||||
Tcl_Obj *const *objv) /* Parameter values */
|
||||
{
|
||||
Tcl_WideInt us = 0;
|
||||
|
||||
if (objc != 1) {
|
||||
Tcl_WrongNumArgs(interp, 0, objv, "clock monotonic");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
us = Tcl_GetMonotonicTime();
|
||||
Tcl_SetObjResult(interp, Tcl_NewWideIntObj(us));
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
static inline void
|
||||
ClockInitFmtScnArgs(
|
||||
ClockClientData *dataPtr,
|
||||
@@ -3546,7 +3574,7 @@ int
|
||||
ClockFormatObjCmd(
|
||||
void *clientData, /* Client data containing literal pool */
|
||||
Tcl_Interp *interp, /* Tcl interpreter */
|
||||
int objc, /* Parameter count */
|
||||
Tcl_Size objc, /* Parameter count */
|
||||
Tcl_Obj *const objv[]) /* Parameter values */
|
||||
{
|
||||
ClockClientData *dataPtr = (ClockClientData *)clientData;
|
||||
@@ -3615,7 +3643,7 @@ int
|
||||
ClockScanObjCmd(
|
||||
void *clientData, /* Client data containing literal pool */
|
||||
Tcl_Interp *interp, /* Tcl interpreter */
|
||||
int objc, /* Parameter count */
|
||||
Tcl_Size objc, /* Parameter count */
|
||||
Tcl_Obj *const objv[]) /* Parameter values */
|
||||
{
|
||||
ClockClientData *dataPtr = (ClockClientData *)clientData;
|
||||
@@ -4467,7 +4495,7 @@ int
|
||||
ClockAddObjCmd(
|
||||
void *clientData, /* Client data containing literal pool */
|
||||
Tcl_Interp *interp, /* Tcl interpreter */
|
||||
int objc, /* Parameter count */
|
||||
Tcl_Size objc, /* Parameter count */
|
||||
Tcl_Obj *const objv[]) /* Parameter values */
|
||||
{
|
||||
static const char *syntax = "clock add clockval|now ?number units?..."
|
||||
@@ -4650,7 +4678,7 @@ int
|
||||
ClockSecondsObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Tcl interpreter */
|
||||
int objc, /* Parameter count */
|
||||
Tcl_Size objc, /* Parameter count */
|
||||
Tcl_Obj *const *objv) /* Parameter values */
|
||||
{
|
||||
Tcl_Time now;
|
||||
@@ -4667,76 +4695,6 @@ ClockSecondsObjCmd(
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* ClockSafeCatchCmd --
|
||||
*
|
||||
* Same as "::catch" command but avoids overwriting of interp state.
|
||||
*
|
||||
* See [554117edde] for more info (and proper solution).
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
int
|
||||
ClockSafeCatchCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
typedef struct {
|
||||
int status; /* return code status */
|
||||
int flags; /* Each remaining field saves the */
|
||||
int returnLevel; /* corresponding field of the Interp */
|
||||
int returnCode; /* struct. These fields taken together are */
|
||||
Tcl_Obj *errorInfo; /* the "state" of the interp. */
|
||||
Tcl_Obj *errorCode;
|
||||
Tcl_Obj *returnOpts;
|
||||
Tcl_Obj *objResult;
|
||||
Tcl_Obj *errorStack;
|
||||
int resetErrorStack;
|
||||
} InterpState;
|
||||
|
||||
Interp *iPtr = (Interp *)interp;
|
||||
int ret, flags = 0;
|
||||
InterpState *statePtr;
|
||||
|
||||
if (objc == 1) {
|
||||
/* wrong # args : */
|
||||
return Tcl_CatchObjCmd(NULL, interp, objc, objv);
|
||||
}
|
||||
|
||||
statePtr = (InterpState *)Tcl_SaveInterpState(interp, 0);
|
||||
if (!statePtr->errorInfo) {
|
||||
/* todo: avoid traced get of errorInfo here */
|
||||
TclInitObjRef(statePtr->errorInfo,
|
||||
Tcl_ObjGetVar2(interp, iPtr->eiVar, NULL, 0));
|
||||
flags |= ERR_LEGACY_COPY;
|
||||
}
|
||||
if (!statePtr->errorCode) {
|
||||
/* todo: avoid traced get of errorCode here */
|
||||
TclInitObjRef(statePtr->errorCode,
|
||||
Tcl_ObjGetVar2(interp, iPtr->ecVar, NULL, 0));
|
||||
flags |= ERR_LEGACY_COPY;
|
||||
}
|
||||
|
||||
/* original catch */
|
||||
ret = Tcl_CatchObjCmd(NULL, interp, objc, objv);
|
||||
|
||||
if (ret == TCL_ERROR) {
|
||||
Tcl_DiscardInterpState((Tcl_InterpState)statePtr);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
/* overwrite result in state with catch result */
|
||||
TclSetObjRef(statePtr->objResult, Tcl_GetObjResult(interp));
|
||||
/* set result (together with restore state) to interpreter */
|
||||
(void) Tcl_RestoreInterpState(interp, (Tcl_InterpState)statePtr);
|
||||
/* todo: unless ERR_LEGACY_COPY not set in restore (branch [bug-554117edde] not merged yet) */
|
||||
iPtr->flags |= (flags & ERR_LEGACY_COPY);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
@@ -4767,11 +4725,7 @@ ClockSafeCatchCmd(
|
||||
|
||||
typedef struct {
|
||||
WCHAR *was; /* Previous value of TZ. */
|
||||
#if TCL_MAJOR_VERSION > 8
|
||||
long long lastRefresh; /* Used for latency before next refresh. */
|
||||
#else
|
||||
long lastRefresh; /* Used for latency before next refresh. */
|
||||
#endif
|
||||
size_t epoch; /* Epoch, signals that TZ changed. */
|
||||
size_t envEpoch; /* Last env epoch, for faster signaling,
|
||||
* that TZ changed via TCL */
|
||||
|
||||
@@ -559,8 +559,8 @@ ClockFmtScnStorageAllocProc(
|
||||
ClockFmtScnStorage *fss;
|
||||
const char *string = (const char *) keyPtr;
|
||||
Tcl_HashEntry *hPtr;
|
||||
unsigned size = strlen(string) + 1;
|
||||
unsigned allocsize = sizeof(ClockFmtScnStorage) + sizeof(Tcl_HashEntry);
|
||||
size_t size = strlen(string) + 1;
|
||||
size_t allocsize = sizeof(ClockFmtScnStorage) + sizeof(Tcl_HashEntry);
|
||||
|
||||
allocsize += size;
|
||||
if (size > sizeof(hPtr->key)) {
|
||||
@@ -645,11 +645,11 @@ ClockFmtScnStorageDelete(
|
||||
*/
|
||||
|
||||
static const Tcl_ObjType ClockFmtObjType = {
|
||||
"clock-format", /* name */
|
||||
ClockFmtObj_FreeInternalRep, /* freeIntRepProc */
|
||||
ClockFmtObj_DupInternalRep, /* dupIntRepProc */
|
||||
ClockFmtObj_UpdateString, /* updateStringProc */
|
||||
ClockFmtObj_SetFromAny, /* setFromAnyProc */
|
||||
"clock-format",
|
||||
ClockFmtObj_FreeInternalRep,
|
||||
ClockFmtObj_DupInternalRep,
|
||||
ClockFmtObj_UpdateString,
|
||||
ClockFmtObj_SetFromAny,
|
||||
TCL_OBJTYPE_V0
|
||||
};
|
||||
|
||||
@@ -846,7 +846,7 @@ FindOrCreateFmtScnStorage(
|
||||
}
|
||||
|
||||
/* get or create entry (and alocate storage) */
|
||||
hPtr = Tcl_CreateHashEntry(&FmtScnHashTable, strFmt, &isNew);
|
||||
hPtr = Tcl_AttemptCreateHashEntry(&FmtScnHashTable, strFmt, &isNew);
|
||||
if (hPtr != NULL) {
|
||||
fss = FmtScn4HashEntry(hPtr);
|
||||
|
||||
|
||||
+199
-259
@@ -47,13 +47,13 @@ struct ForeachState {
|
||||
|
||||
static int CheckAccess(Tcl_Interp *interp, Tcl_Obj *pathPtr,
|
||||
int mode);
|
||||
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 Tcl_ObjCmdProc EncodingUserObjCmd;
|
||||
static Tcl_ObjCmdProc2 EncodingConvertfromObjCmd;
|
||||
static Tcl_ObjCmdProc2 EncodingConverttoObjCmd;
|
||||
static Tcl_ObjCmdProc2 EncodingDirsObjCmd;
|
||||
static Tcl_ObjCmdProc2 EncodingNamesObjCmd;
|
||||
static Tcl_ObjCmdProc2 EncodingProfilesObjCmd;
|
||||
static Tcl_ObjCmdProc2 EncodingSystemObjCmd;
|
||||
static Tcl_ObjCmdProc2 EncodingUserObjCmd;
|
||||
static inline int ForeachAssignments(Tcl_Interp *interp,
|
||||
struct ForeachState *statePtr);
|
||||
static inline void ForeachCleanup(Tcl_Interp *interp,
|
||||
@@ -64,7 +64,7 @@ static const char * GetTypeFromMode(int mode);
|
||||
static int StoreStatData(Tcl_Interp *interp, Tcl_Obj *varName,
|
||||
Tcl_StatBuf *statPtr);
|
||||
static int EachloopCmd(Tcl_Interp *interp, int collect,
|
||||
int objc, Tcl_Obj *const objv[]);
|
||||
Tcl_Size objc, Tcl_Obj *const objv[]);
|
||||
static Tcl_NRPostProc CatchObjCmdCallback;
|
||||
static Tcl_NRPostProc ExprCallback;
|
||||
static Tcl_NRPostProc ForSetupCallback;
|
||||
@@ -74,31 +74,83 @@ static Tcl_NRPostProc ForPostNextCallback;
|
||||
static Tcl_NRPostProc ForeachLoopStep;
|
||||
static Tcl_NRPostProc EvalCmdErrMsg;
|
||||
|
||||
static Tcl_ObjCmdProc FileAttrAccessTimeCmd;
|
||||
static Tcl_ObjCmdProc FileAttrIsDirectoryCmd;
|
||||
static Tcl_ObjCmdProc FileAttrIsExecutableCmd;
|
||||
static Tcl_ObjCmdProc FileAttrIsExistingCmd;
|
||||
static Tcl_ObjCmdProc FileAttrIsFileCmd;
|
||||
static Tcl_ObjCmdProc FileAttrIsOwnedCmd;
|
||||
static Tcl_ObjCmdProc FileAttrIsReadableCmd;
|
||||
static Tcl_ObjCmdProc FileAttrIsWritableCmd;
|
||||
static Tcl_ObjCmdProc FileAttrLinkStatCmd;
|
||||
static Tcl_ObjCmdProc FileAttrModifyTimeCmd;
|
||||
static Tcl_ObjCmdProc FileAttrSizeCmd;
|
||||
static Tcl_ObjCmdProc FileAttrStatCmd;
|
||||
static Tcl_ObjCmdProc FileAttrTypeCmd;
|
||||
static Tcl_ObjCmdProc FilesystemSeparatorCmd;
|
||||
static Tcl_ObjCmdProc FilesystemVolumesCmd;
|
||||
static Tcl_ObjCmdProc PathDirNameCmd;
|
||||
static Tcl_ObjCmdProc PathExtensionCmd;
|
||||
static Tcl_ObjCmdProc PathFilesystemCmd;
|
||||
static Tcl_ObjCmdProc PathJoinCmd;
|
||||
static Tcl_ObjCmdProc PathNativeNameCmd;
|
||||
static Tcl_ObjCmdProc PathNormalizeCmd;
|
||||
static Tcl_ObjCmdProc PathRootNameCmd;
|
||||
static Tcl_ObjCmdProc PathSplitCmd;
|
||||
static Tcl_ObjCmdProc PathTailCmd;
|
||||
static Tcl_ObjCmdProc PathTypeCmd;
|
||||
static Tcl_ObjCmdProc2 FileAttrAccessTimeCmd;
|
||||
static Tcl_ObjCmdProc2 FileAttrIsDirectoryCmd;
|
||||
static Tcl_ObjCmdProc2 FileAttrIsExecutableCmd;
|
||||
static Tcl_ObjCmdProc2 FileAttrIsExistingCmd;
|
||||
static Tcl_ObjCmdProc2 FileAttrIsFileCmd;
|
||||
static Tcl_ObjCmdProc2 FileAttrIsOwnedCmd;
|
||||
static Tcl_ObjCmdProc2 FileAttrIsReadableCmd;
|
||||
static Tcl_ObjCmdProc2 FileAttrIsWritableCmd;
|
||||
static Tcl_ObjCmdProc2 FileAttrLinkStatCmd;
|
||||
static Tcl_ObjCmdProc2 FileAttrModifyTimeCmd;
|
||||
static Tcl_ObjCmdProc2 FileAttrSizeCmd;
|
||||
static Tcl_ObjCmdProc2 FileAttrStatCmd;
|
||||
static Tcl_ObjCmdProc2 FileAttrTypeCmd;
|
||||
static Tcl_ObjCmdProc2 FilesystemSeparatorCmd;
|
||||
static Tcl_ObjCmdProc2 FilesystemVolumesCmd;
|
||||
static Tcl_ObjCmdProc2 PathDirNameCmd;
|
||||
static Tcl_ObjCmdProc2 PathExtensionCmd;
|
||||
static Tcl_ObjCmdProc2 PathFilesystemCmd;
|
||||
static Tcl_ObjCmdProc2 PathJoinCmd;
|
||||
static Tcl_ObjCmdProc2 PathNativeNameCmd;
|
||||
static Tcl_ObjCmdProc2 PathNormalizeCmd;
|
||||
static Tcl_ObjCmdProc2 PathRootNameCmd;
|
||||
static Tcl_ObjCmdProc2 PathSplitCmd;
|
||||
static Tcl_ObjCmdProc2 PathTailCmd;
|
||||
static Tcl_ObjCmdProc2 PathTypeCmd;
|
||||
|
||||
const EnsembleImplMap tclEncodingImplMap[] = {
|
||||
{"convertfrom", EncodingConvertfromObjCmd, TclCompileBasic1To3ArgCmd, NULL, NULL, 0},
|
||||
{"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},
|
||||
{"user", EncodingUserObjCmd, TclCompileBasic0ArgCmd, NULL, NULL, 0},
|
||||
{NULL, NULL, NULL, NULL, NULL, 0}
|
||||
};
|
||||
|
||||
const EnsembleImplMap tclFileImplMap[] = {
|
||||
{"atime", FileAttrAccessTimeCmd, TclCompileBasic1Or2ArgCmd, NULL, NULL, 1},
|
||||
{"attributes", TclFileAttrsCmd, NULL, NULL, NULL, 1},
|
||||
{"channels", TclChannelNamesCmd, TclCompileBasic0Or1ArgCmd, NULL, NULL, 0},
|
||||
{"copy", TclFileCopyCmd, NULL, NULL, NULL, 1},
|
||||
{"delete", TclFileDeleteCmd, TclCompileBasicMin0ArgCmd, NULL, NULL, 1},
|
||||
{"dirname", PathDirNameCmd, TclCompileBasic1ArgCmd, NULL, NULL, 1},
|
||||
{"executable", FileAttrIsExecutableCmd, TclCompileBasic1ArgCmd, NULL, NULL, 1},
|
||||
{"exists", FileAttrIsExistingCmd, TclCompileBasic1ArgCmd, NULL, NULL, 1},
|
||||
{"extension", PathExtensionCmd, TclCompileBasic1ArgCmd, NULL, NULL, 1},
|
||||
{"home", TclFileHomeCmd, TclCompileBasic0Or1ArgCmd, NULL, NULL, 1},
|
||||
{"isdirectory", FileAttrIsDirectoryCmd, TclCompileBasic1ArgCmd, NULL, NULL, 1},
|
||||
{"isfile", FileAttrIsFileCmd, TclCompileBasic1ArgCmd, NULL, NULL, 1},
|
||||
{"join", PathJoinCmd, TclCompileBasicMin1ArgCmd, NULL, NULL, 0},
|
||||
{"link", TclFileLinkCmd, TclCompileBasic1To3ArgCmd, NULL, NULL, 1},
|
||||
{"lstat", FileAttrLinkStatCmd, TclCompileBasic2ArgCmd, NULL, NULL, 1},
|
||||
{"mtime", FileAttrModifyTimeCmd, TclCompileBasic1Or2ArgCmd, NULL, NULL, 1},
|
||||
{"mkdir", TclFileMakeDirsCmd, TclCompileBasicMin0ArgCmd, NULL, NULL, 1},
|
||||
{"nativename", PathNativeNameCmd, TclCompileBasic1ArgCmd, NULL, NULL, 1},
|
||||
{"normalize", PathNormalizeCmd, TclCompileBasic1ArgCmd, NULL, NULL, 1},
|
||||
{"owned", FileAttrIsOwnedCmd, TclCompileBasic1ArgCmd, NULL, NULL, 1},
|
||||
{"pathtype", PathTypeCmd, TclCompileBasic1ArgCmd, NULL, NULL, 0},
|
||||
{"readable", FileAttrIsReadableCmd, TclCompileBasic1ArgCmd, NULL, NULL, 1},
|
||||
{"readlink", TclFileReadLinkCmd, TclCompileBasic1ArgCmd, NULL, NULL, 1},
|
||||
{"rename", TclFileRenameCmd, NULL, NULL, NULL, 1},
|
||||
{"rootname", PathRootNameCmd, TclCompileBasic1ArgCmd, NULL, NULL, 1},
|
||||
{"separator", FilesystemSeparatorCmd, TclCompileBasic0Or1ArgCmd, NULL, NULL, 0},
|
||||
{"size", FileAttrSizeCmd, TclCompileBasic1ArgCmd, NULL, NULL, 1},
|
||||
{"split", PathSplitCmd, TclCompileBasic1ArgCmd, NULL, NULL, 0},
|
||||
{"stat", FileAttrStatCmd, TclCompileBasic2ArgCmd, NULL, NULL, 1},
|
||||
{"system", PathFilesystemCmd, TclCompileBasic0Or1ArgCmd, NULL, NULL, 0},
|
||||
{"tail", PathTailCmd, TclCompileBasic1ArgCmd, NULL, NULL, 1},
|
||||
{"tempdir", TclFileTempDirCmd, TclCompileBasic0Or1ArgCmd, NULL, NULL, 1},
|
||||
{"tempfile", TclFileTemporaryCmd, TclCompileBasic0To2ArgCmd, NULL, NULL, 1},
|
||||
{"tildeexpand", TclFileTildeExpandCmd, TclCompileBasic1ArgCmd, NULL, NULL, 1},
|
||||
{"type", FileAttrTypeCmd, TclCompileBasic1ArgCmd, NULL, NULL, 1},
|
||||
{"volumes", FilesystemVolumesCmd, TclCompileBasic0ArgCmd, NULL, NULL, 1},
|
||||
{"writable", FileAttrIsWritableCmd, TclCompileBasic1ArgCmd, NULL, NULL, 1},
|
||||
{NULL, NULL, NULL, NULL, NULL, 0}
|
||||
};
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
@@ -125,7 +177,7 @@ int
|
||||
Tcl_BreakObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
if (objc != 1) {
|
||||
@@ -156,17 +208,17 @@ int
|
||||
Tcl_CatchObjCmd(
|
||||
void *clientData,
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
return Tcl_NRCallObjProc(interp, TclNRCatchObjCmd, clientData, objc, objv);
|
||||
return Tcl_NRCallObjProc2(interp, TclNRCatchObjCmd, clientData, objc, objv);
|
||||
}
|
||||
|
||||
int
|
||||
TclNRCatchObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Tcl_Obj *varNamePtr = NULL;
|
||||
@@ -203,7 +255,7 @@ CatchObjCmdCallback(
|
||||
int result)
|
||||
{
|
||||
Interp *iPtr = (Interp *) interp;
|
||||
int objc = PTR2INT(data[0]);
|
||||
Tcl_Size objc = PTR2INT(data[0]);
|
||||
Tcl_Obj *varNamePtr = (Tcl_Obj *)data[1];
|
||||
Tcl_Obj *optionVarNamePtr = (Tcl_Obj *)data[2];
|
||||
int rewind = iPtr->execEnvPtr->rewind;
|
||||
@@ -261,7 +313,7 @@ int
|
||||
Tcl_CdObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Tcl_Obj *dir;
|
||||
@@ -324,7 +376,7 @@ int
|
||||
Tcl_ConcatObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
if (objc >= 2) {
|
||||
@@ -358,7 +410,7 @@ int
|
||||
Tcl_ContinueObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
if (objc != 1) {
|
||||
@@ -368,40 +420,6 @@ Tcl_ContinueObjCmd(
|
||||
return TCL_CONTINUE;
|
||||
}
|
||||
|
||||
/*
|
||||
*-----------------------------------------------------------------------------
|
||||
*
|
||||
* TclInitEncodingCmd --
|
||||
*
|
||||
* This function creates the 'encoding' ensemble.
|
||||
*
|
||||
* Results:
|
||||
* Returns the Tcl_Command so created.
|
||||
*
|
||||
* Side effects:
|
||||
* The ensemble is initialized.
|
||||
*
|
||||
* This command is hidden in a safe interpreter.
|
||||
*/
|
||||
|
||||
Tcl_Command
|
||||
TclInitEncodingCmd(
|
||||
Tcl_Interp* interp) /* Tcl interpreter */
|
||||
{
|
||||
static const EnsembleImplMap encodingImplMap[] = {
|
||||
{"convertfrom", EncodingConvertfromObjCmd, TclCompileBasic1To3ArgCmd, NULL, NULL, 0},
|
||||
{"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},
|
||||
{"user", EncodingUserObjCmd, TclCompileBasic0ArgCmd, NULL, NULL, 1},
|
||||
{NULL, NULL, NULL, NULL, NULL, 0}
|
||||
};
|
||||
|
||||
return TclMakeEnsemble(interp, "encoding", encodingImplMap);
|
||||
}
|
||||
|
||||
/*
|
||||
*------------------------------------------------------------------------
|
||||
*
|
||||
@@ -428,7 +446,7 @@ TclInitEncodingCmd(
|
||||
static int
|
||||
EncodingConvertParseOptions(
|
||||
Tcl_Interp *interp, /* For error messages. May be NULL */
|
||||
int objc, /* Number of arguments */
|
||||
Tcl_Size 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 */
|
||||
@@ -522,13 +540,13 @@ int
|
||||
EncodingConvertfromObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Tcl_Obj *data; /* Byte array to convert */
|
||||
Tcl_DString ds; /* Buffer to hold the string */
|
||||
Tcl_Encoding encoding; /* Encoding to use */
|
||||
Tcl_Size length = 0; /* Length of the byte array being converted */
|
||||
Tcl_Size length = 0; /* Length of the byte array being converted */
|
||||
const char *bytesPtr; /* Pointer to the first byte of the array */
|
||||
int flags;
|
||||
int result;
|
||||
@@ -620,7 +638,7 @@ int
|
||||
EncodingConverttoObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Tcl_Obj *data; /* String to convert */
|
||||
@@ -688,13 +706,12 @@ EncodingConverttoObjCmd(
|
||||
|
||||
result = TCL_OK;
|
||||
|
||||
done:
|
||||
done:
|
||||
Tcl_DStringFree(&ds);
|
||||
if (encoding) {
|
||||
Tcl_FreeEncoding(encoding);
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -717,7 +734,7 @@ int
|
||||
EncodingDirsObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Tcl_Obj *dirListObj;
|
||||
@@ -760,9 +777,9 @@ EncodingDirsObjCmd(
|
||||
int
|
||||
EncodingNamesObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp* interp, /* Tcl interpreter */
|
||||
int objc, /* Number of command line args */
|
||||
Tcl_Obj* const objv[]) /* Vector of command line args */
|
||||
Tcl_Interp* interp, /* Tcl interpreter */
|
||||
Tcl_Size objc, /* Number of command line args */
|
||||
Tcl_Obj *const objv[]) /* Vector of command line args */
|
||||
{
|
||||
if (objc > 1) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, NULL);
|
||||
@@ -788,9 +805,9 @@ EncodingNamesObjCmd(
|
||||
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 */
|
||||
Tcl_Interp* interp, /* Tcl interpreter */
|
||||
Tcl_Size objc, /* Number of command line args */
|
||||
Tcl_Obj *const objv[]) /* Vector of command line args */
|
||||
{
|
||||
if (objc > 1) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, NULL);
|
||||
@@ -819,9 +836,9 @@ EncodingProfilesObjCmd(
|
||||
int
|
||||
EncodingSystemObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp* interp, /* Tcl interpreter */
|
||||
int objc, /* Number of command line args */
|
||||
Tcl_Obj* const objv[]) /* Vector of command line args */
|
||||
Tcl_Interp* interp, /* Tcl interpreter */
|
||||
Tcl_Size objc, /* Number of command line args */
|
||||
Tcl_Obj *const objv[]) /* Vector of command line args */
|
||||
{
|
||||
if (objc > 2) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "?encoding?");
|
||||
@@ -852,9 +869,9 @@ EncodingSystemObjCmd(
|
||||
int
|
||||
EncodingUserObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp* interp, /* Tcl interpreter */
|
||||
int objc, /* Number of command line args */
|
||||
Tcl_Obj* const objv[]) /* Vector of command line args */
|
||||
Tcl_Interp* interp, /* Tcl interpreter */
|
||||
Tcl_Size objc, /* Number of command line args */
|
||||
Tcl_Obj *const objv[]) /* Vector of command line args */
|
||||
{
|
||||
if (objc > 1) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "");
|
||||
@@ -887,7 +904,7 @@ int
|
||||
Tcl_ErrorObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Tcl_Obj *options, *optName;
|
||||
@@ -949,23 +966,23 @@ int
|
||||
Tcl_EvalObjCmd(
|
||||
void *clientData,
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
return Tcl_NRCallObjProc(interp, TclNREvalObjCmd, clientData, objc, objv);
|
||||
return Tcl_NRCallObjProc2(interp, TclNREvalObjCmd, clientData, objc, objv);
|
||||
}
|
||||
|
||||
int
|
||||
TclNREvalObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Tcl_Obj *objPtr;
|
||||
Interp *iPtr = (Interp *) interp;
|
||||
CmdFrame *invoker = NULL;
|
||||
int word = 0;
|
||||
Tcl_Size word = 0;
|
||||
|
||||
if (objc < 2) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "arg ?arg ...?");
|
||||
@@ -1018,7 +1035,7 @@ int
|
||||
Tcl_ExitObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Tcl_WideInt value;
|
||||
@@ -1065,17 +1082,17 @@ int
|
||||
Tcl_ExprObjCmd(
|
||||
void *clientData,
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
return Tcl_NRCallObjProc(interp, TclNRExprObjCmd, clientData, objc, objv);
|
||||
return Tcl_NRCallObjProc2(interp, TclNRExprObjCmd, clientData, objc, objv);
|
||||
}
|
||||
|
||||
int
|
||||
TclNRExprObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Tcl_Obj *resultPtr, *objPtr;
|
||||
@@ -1118,80 +1135,6 @@ ExprCallback(
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* TclInitFileCmd --
|
||||
*
|
||||
* This function builds the "file" Tcl command ensemble. See the user
|
||||
* documentation for details on what that ensemble does.
|
||||
*
|
||||
* PLEASE NOTE THAT THIS FAILS WITH FILENAMES AND PATHS WITH EMBEDDED
|
||||
* NULLS. With the object-based Tcl_FS APIs, the above NOTE may no longer
|
||||
* be true. In any case this assertion should be tested.
|
||||
*
|
||||
* Results:
|
||||
* A standard Tcl result.
|
||||
*
|
||||
* Side effects:
|
||||
* See the user documentation.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
Tcl_Command
|
||||
TclInitFileCmd(
|
||||
Tcl_Interp *interp)
|
||||
{
|
||||
/*
|
||||
* Note that most subcommands are unsafe because either they manipulate
|
||||
* the native filesystem or because they reveal information about the
|
||||
* native filesystem.
|
||||
*/
|
||||
|
||||
static const EnsembleImplMap initMap[] = {
|
||||
{"atime", FileAttrAccessTimeCmd, TclCompileBasic1Or2ArgCmd, NULL, NULL, 1},
|
||||
{"attributes", TclFileAttrsCmd, NULL, NULL, NULL, 1},
|
||||
{"channels", TclChannelNamesCmd, TclCompileBasic0Or1ArgCmd, NULL, NULL, 0},
|
||||
{"copy", TclFileCopyCmd, NULL, NULL, NULL, 1},
|
||||
{"delete", TclFileDeleteCmd, TclCompileBasicMin0ArgCmd, NULL, NULL, 1},
|
||||
{"dirname", PathDirNameCmd, TclCompileBasic1ArgCmd, NULL, NULL, 1},
|
||||
{"executable", FileAttrIsExecutableCmd, TclCompileBasic1ArgCmd, NULL, NULL, 1},
|
||||
{"exists", FileAttrIsExistingCmd, TclCompileBasic1ArgCmd, NULL, NULL, 1},
|
||||
{"extension", PathExtensionCmd, TclCompileBasic1ArgCmd, NULL, NULL, 1},
|
||||
{"home", TclFileHomeCmd, TclCompileBasic0Or1ArgCmd, NULL, NULL, 1},
|
||||
{"isdirectory", FileAttrIsDirectoryCmd, TclCompileBasic1ArgCmd, NULL, NULL, 1},
|
||||
{"isfile", FileAttrIsFileCmd, TclCompileBasic1ArgCmd, NULL, NULL, 1},
|
||||
{"join", PathJoinCmd, TclCompileBasicMin1ArgCmd, NULL, NULL, 0},
|
||||
{"link", TclFileLinkCmd, TclCompileBasic1To3ArgCmd, NULL, NULL, 1},
|
||||
{"lstat", FileAttrLinkStatCmd, TclCompileBasic2ArgCmd, NULL, NULL, 1},
|
||||
{"mtime", FileAttrModifyTimeCmd, TclCompileBasic1Or2ArgCmd, NULL, NULL, 1},
|
||||
{"mkdir", TclFileMakeDirsCmd, TclCompileBasicMin0ArgCmd, NULL, NULL, 1},
|
||||
{"nativename", PathNativeNameCmd, TclCompileBasic1ArgCmd, NULL, NULL, 1},
|
||||
{"normalize", PathNormalizeCmd, TclCompileBasic1ArgCmd, NULL, NULL, 1},
|
||||
{"owned", FileAttrIsOwnedCmd, TclCompileBasic1ArgCmd, NULL, NULL, 1},
|
||||
{"pathtype", PathTypeCmd, TclCompileBasic1ArgCmd, NULL, NULL, 0},
|
||||
{"readable", FileAttrIsReadableCmd, TclCompileBasic1ArgCmd, NULL, NULL, 1},
|
||||
{"readlink", TclFileReadLinkCmd, TclCompileBasic1ArgCmd, NULL, NULL, 1},
|
||||
{"rename", TclFileRenameCmd, NULL, NULL, NULL, 1},
|
||||
{"rootname", PathRootNameCmd, TclCompileBasic1ArgCmd, NULL, NULL, 1},
|
||||
{"separator", FilesystemSeparatorCmd, TclCompileBasic0Or1ArgCmd, NULL, NULL, 0},
|
||||
{"size", FileAttrSizeCmd, TclCompileBasic1ArgCmd, NULL, NULL, 1},
|
||||
{"split", PathSplitCmd, TclCompileBasic1ArgCmd, NULL, NULL, 0},
|
||||
{"stat", FileAttrStatCmd, TclCompileBasic2ArgCmd, NULL, NULL, 1},
|
||||
{"system", PathFilesystemCmd, TclCompileBasic0Or1ArgCmd, NULL, NULL, 0},
|
||||
{"tail", PathTailCmd, TclCompileBasic1ArgCmd, NULL, NULL, 1},
|
||||
{"tempdir", TclFileTempDirCmd, TclCompileBasic0Or1ArgCmd, NULL, NULL, 1},
|
||||
{"tempfile", TclFileTemporaryCmd, TclCompileBasic0To2ArgCmd, NULL, NULL, 1},
|
||||
{"tildeexpand", TclFileTildeExpandCmd, TclCompileBasic1ArgCmd, NULL, NULL, 1},
|
||||
{"type", FileAttrTypeCmd, TclCompileBasic1ArgCmd, NULL, NULL, 1},
|
||||
{"volumes", FilesystemVolumesCmd, TclCompileBasic0ArgCmd, NULL, NULL, 1},
|
||||
{"writable", FileAttrIsWritableCmd, TclCompileBasic1ArgCmd, NULL, NULL, 1},
|
||||
{NULL, NULL, NULL, NULL, NULL, 0}
|
||||
};
|
||||
return TclMakeEnsemble(interp, "file", initMap);
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
@@ -1213,7 +1156,7 @@ static int
|
||||
FileAttrAccessTimeCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
Tcl_StatBuf buf;
|
||||
@@ -1295,7 +1238,7 @@ static int
|
||||
FileAttrModifyTimeCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
Tcl_StatBuf buf;
|
||||
@@ -1374,7 +1317,7 @@ static int
|
||||
FileAttrLinkStatCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
Tcl_StatBuf buf;
|
||||
@@ -1414,7 +1357,7 @@ static int
|
||||
FileAttrStatCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
Tcl_StatBuf buf;
|
||||
@@ -1454,7 +1397,7 @@ static int
|
||||
FileAttrTypeCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
Tcl_StatBuf buf;
|
||||
@@ -1492,7 +1435,7 @@ static int
|
||||
FileAttrSizeCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
Tcl_StatBuf buf;
|
||||
@@ -1529,7 +1472,7 @@ static int
|
||||
FileAttrIsDirectoryCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
Tcl_StatBuf buf;
|
||||
@@ -1567,7 +1510,7 @@ static int
|
||||
FileAttrIsExecutableCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
if (objc != 2) {
|
||||
@@ -1598,7 +1541,7 @@ static int
|
||||
FileAttrIsExistingCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
if (objc != 2) {
|
||||
@@ -1629,7 +1572,7 @@ static int
|
||||
FileAttrIsFileCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
Tcl_StatBuf buf;
|
||||
@@ -1667,7 +1610,7 @@ static int
|
||||
FileAttrIsOwnedCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
#ifdef __CYGWIN__
|
||||
@@ -1729,7 +1672,7 @@ static int
|
||||
FileAttrIsReadableCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
if (objc != 2) {
|
||||
@@ -1760,7 +1703,7 @@ static int
|
||||
FileAttrIsWritableCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
if (objc != 2) {
|
||||
@@ -1791,7 +1734,7 @@ static int
|
||||
PathDirNameCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
Tcl_Obj *dirPtr;
|
||||
@@ -1830,7 +1773,7 @@ static int
|
||||
PathExtensionCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
Tcl_Obj *dirPtr;
|
||||
@@ -1869,7 +1812,7 @@ static int
|
||||
PathRootNameCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
Tcl_Obj *dirPtr;
|
||||
@@ -1908,7 +1851,7 @@ static int
|
||||
PathTailCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
Tcl_Obj *dirPtr;
|
||||
@@ -1947,7 +1890,7 @@ static int
|
||||
PathFilesystemCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
Tcl_Obj *fsInfo;
|
||||
@@ -1988,7 +1931,7 @@ static int
|
||||
PathJoinCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
if (objc < 2) {
|
||||
@@ -2020,7 +1963,7 @@ static int
|
||||
PathNativeNameCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
Tcl_DString ds;
|
||||
@@ -2057,7 +2000,7 @@ static int
|
||||
PathNormalizeCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
Tcl_Obj *fileName;
|
||||
@@ -2095,7 +2038,7 @@ static int
|
||||
PathSplitCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
Tcl_Obj *res;
|
||||
@@ -2138,7 +2081,7 @@ static int
|
||||
PathTypeCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
Tcl_Obj *typeName;
|
||||
@@ -2185,7 +2128,7 @@ static int
|
||||
FilesystemSeparatorCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
if (objc < 1 || objc > 2) {
|
||||
@@ -2240,7 +2183,7 @@ static int
|
||||
FilesystemVolumesCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
if (objc != 1) {
|
||||
@@ -2378,34 +2321,30 @@ StoreStatData(
|
||||
* store in varName. */
|
||||
{
|
||||
Tcl_Obj *field, *value, *result;
|
||||
unsigned short mode;
|
||||
unsigned short modeVal = (unsigned short) statPtr->st_mode;
|
||||
|
||||
if (varName == NULL) {
|
||||
TclNewObj(result);
|
||||
Tcl_IncrRefCount(result);
|
||||
#define DOBJPUT(key, objValue) \
|
||||
Tcl_DictObjPut(NULL, result, \
|
||||
Tcl_NewStringObj((key), -1), \
|
||||
(objValue));
|
||||
DOBJPUT("dev", Tcl_NewWideIntObj((long)statPtr->st_dev));
|
||||
DOBJPUT("ino", Tcl_NewWideIntObj((Tcl_WideInt)statPtr->st_ino));
|
||||
DOBJPUT("nlink", Tcl_NewWideIntObj((long)statPtr->st_nlink));
|
||||
DOBJPUT("uid", Tcl_NewWideIntObj((long)statPtr->st_uid));
|
||||
DOBJPUT("gid", Tcl_NewWideIntObj((long)statPtr->st_gid));
|
||||
DOBJPUT("size", Tcl_NewWideIntObj((Tcl_WideInt)statPtr->st_size));
|
||||
#define D_PUT(key, objValue) TclDictPut(NULL, result, #key, (objValue))
|
||||
D_PUT(dev, Tcl_NewWideIntObj((long)statPtr->st_dev));
|
||||
D_PUT(ino, Tcl_NewWideIntObj((Tcl_WideInt)statPtr->st_ino));
|
||||
D_PUT(nlink, Tcl_NewWideIntObj((long)statPtr->st_nlink));
|
||||
D_PUT(uid, Tcl_NewWideIntObj((long)statPtr->st_uid));
|
||||
D_PUT(gid, Tcl_NewWideIntObj((long)statPtr->st_gid));
|
||||
D_PUT(size, Tcl_NewWideIntObj((Tcl_WideInt)statPtr->st_size));
|
||||
#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
|
||||
DOBJPUT("blocks", Tcl_NewWideIntObj((Tcl_WideInt)statPtr->st_blocks));
|
||||
D_PUT(blocks, Tcl_NewWideIntObj((Tcl_WideInt)statPtr->st_blocks));
|
||||
#endif
|
||||
#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
|
||||
DOBJPUT("blksize", Tcl_NewWideIntObj((long)statPtr->st_blksize));
|
||||
D_PUT(blksize, Tcl_NewWideIntObj((long)statPtr->st_blksize));
|
||||
#endif
|
||||
DOBJPUT("atime", Tcl_NewWideIntObj(Tcl_GetAccessTimeFromStat(statPtr)));
|
||||
DOBJPUT("mtime", Tcl_NewWideIntObj(Tcl_GetModificationTimeFromStat(statPtr)));
|
||||
DOBJPUT("ctime", Tcl_NewWideIntObj(Tcl_GetChangeTimeFromStat(statPtr)));
|
||||
mode = (unsigned short) statPtr->st_mode;
|
||||
DOBJPUT("mode", Tcl_NewWideIntObj(mode));
|
||||
DOBJPUT("type", Tcl_NewStringObj(GetTypeFromMode(mode), -1));
|
||||
#undef DOBJPUT
|
||||
D_PUT(atime, Tcl_NewWideIntObj(Tcl_GetAccessTimeFromStat(statPtr)));
|
||||
D_PUT(mtime, Tcl_NewWideIntObj(Tcl_GetModificationTimeFromStat(statPtr)));
|
||||
D_PUT(ctime, Tcl_NewWideIntObj(Tcl_GetChangeTimeFromStat(statPtr)));
|
||||
D_PUT(mode, Tcl_NewWideIntObj(modeVal));
|
||||
D_PUT(type, Tcl_NewStringObj(GetTypeFromMode(modeVal), -1));
|
||||
#undef D_PUT
|
||||
Tcl_SetObjResult(interp, result);
|
||||
Tcl_DecrRefCount(result);
|
||||
return TCL_OK;
|
||||
@@ -2418,44 +2357,45 @@ StoreStatData(
|
||||
*/
|
||||
|
||||
#define STORE_ARY(fieldName, object) \
|
||||
TclNewLiteralStringObj(field, fieldName); \
|
||||
Tcl_IncrRefCount(field); \
|
||||
value = (object); \
|
||||
if (Tcl_ObjSetVar2(interp,varName,field,value,TCL_LEAVE_ERR_MSG)==NULL) { \
|
||||
do { \
|
||||
TclNewLiteralStringObj(field, #fieldName); \
|
||||
Tcl_IncrRefCount(field); \
|
||||
value = (object); \
|
||||
if (Tcl_ObjSetVar2(interp, varName, field, value, \
|
||||
TCL_LEAVE_ERR_MSG) == NULL) { \
|
||||
TclDecrRefCount(field); \
|
||||
return TCL_ERROR; \
|
||||
} \
|
||||
TclDecrRefCount(field); \
|
||||
return TCL_ERROR; \
|
||||
} \
|
||||
TclDecrRefCount(field);
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* Watch out porters; the inode is meant to be an *unsigned* value, so the
|
||||
* cast might fail when there isn't a real arithmetic 'long long' type...
|
||||
*/
|
||||
|
||||
STORE_ARY("dev", Tcl_NewWideIntObj((long)statPtr->st_dev));
|
||||
STORE_ARY("ino", Tcl_NewWideIntObj(statPtr->st_ino));
|
||||
STORE_ARY("nlink", Tcl_NewWideIntObj((long)statPtr->st_nlink));
|
||||
STORE_ARY("uid", Tcl_NewWideIntObj((long)statPtr->st_uid));
|
||||
STORE_ARY("gid", Tcl_NewWideIntObj((long)statPtr->st_gid));
|
||||
STORE_ARY("size", Tcl_NewWideIntObj(statPtr->st_size));
|
||||
STORE_ARY(dev, Tcl_NewWideIntObj((long)statPtr->st_dev));
|
||||
STORE_ARY(ino, Tcl_NewWideIntObj(statPtr->st_ino));
|
||||
STORE_ARY(nlink, Tcl_NewWideIntObj((long)statPtr->st_nlink));
|
||||
STORE_ARY(uid, Tcl_NewWideIntObj((long)statPtr->st_uid));
|
||||
STORE_ARY(gid, Tcl_NewWideIntObj((long)statPtr->st_gid));
|
||||
STORE_ARY(size, Tcl_NewWideIntObj(statPtr->st_size));
|
||||
#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
|
||||
STORE_ARY("blocks", Tcl_NewWideIntObj(statPtr->st_blocks));
|
||||
STORE_ARY(blocks, Tcl_NewWideIntObj(statPtr->st_blocks));
|
||||
#endif
|
||||
#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
|
||||
STORE_ARY("blksize", Tcl_NewWideIntObj((long)statPtr->st_blksize));
|
||||
STORE_ARY(blksize, Tcl_NewWideIntObj((long)statPtr->st_blksize));
|
||||
#endif
|
||||
#ifdef HAVE_STRUCT_STAT_ST_RDEV
|
||||
if (S_ISCHR(statPtr->st_mode) || S_ISBLK(statPtr->st_mode)) {
|
||||
STORE_ARY("rdev", Tcl_NewWideIntObj((long) statPtr->st_rdev));
|
||||
}
|
||||
#endif
|
||||
STORE_ARY("atime", Tcl_NewWideIntObj(Tcl_GetAccessTimeFromStat(statPtr)));
|
||||
STORE_ARY("mtime", Tcl_NewWideIntObj(
|
||||
Tcl_GetModificationTimeFromStat(statPtr)));
|
||||
STORE_ARY("ctime", Tcl_NewWideIntObj(Tcl_GetChangeTimeFromStat(statPtr)));
|
||||
mode = (unsigned short) statPtr->st_mode;
|
||||
STORE_ARY("mode", Tcl_NewWideIntObj(mode));
|
||||
STORE_ARY("type", Tcl_NewStringObj(GetTypeFromMode(mode), -1));
|
||||
STORE_ARY(atime, Tcl_NewWideIntObj(Tcl_GetAccessTimeFromStat(statPtr)));
|
||||
STORE_ARY(mtime, Tcl_NewWideIntObj(Tcl_GetModificationTimeFromStat(statPtr)));
|
||||
STORE_ARY(ctime, Tcl_NewWideIntObj(Tcl_GetChangeTimeFromStat(statPtr)));
|
||||
STORE_ARY(mode, Tcl_NewWideIntObj(modeVal));
|
||||
STORE_ARY(type, Tcl_NewStringObj(GetTypeFromMode(modeVal), -1));
|
||||
#undef STORE_ARY
|
||||
|
||||
return TCL_OK;
|
||||
@@ -2548,17 +2488,17 @@ int
|
||||
Tcl_ForObjCmd(
|
||||
void *clientData,
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
return Tcl_NRCallObjProc(interp, TclNRForObjCmd, clientData, objc, objv);
|
||||
return Tcl_NRCallObjProc2(interp, TclNRForObjCmd, clientData, objc, objv);
|
||||
}
|
||||
|
||||
int
|
||||
TclNRForObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Interp *iPtr = (Interp *) interp;
|
||||
@@ -2742,17 +2682,17 @@ int
|
||||
Tcl_ForeachObjCmd(
|
||||
void *clientData,
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
return Tcl_NRCallObjProc(interp, TclNRForeachCmd, clientData, objc, objv);
|
||||
return Tcl_NRCallObjProc2(interp, TclNRForeachCmd, clientData, objc, objv);
|
||||
}
|
||||
|
||||
int
|
||||
TclNRForeachCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
return EachloopCmd(interp, TCL_EACH_KEEP_NONE, objc, objv);
|
||||
@@ -2762,17 +2702,17 @@ int
|
||||
Tcl_LmapObjCmd(
|
||||
void *clientData,
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
return Tcl_NRCallObjProc(interp, TclNRLmapCmd, clientData, objc, objv);
|
||||
return Tcl_NRCallObjProc2(interp, TclNRLmapCmd, clientData, objc, objv);
|
||||
}
|
||||
|
||||
int
|
||||
TclNRLmapCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
return EachloopCmd(interp, TCL_EACH_COLLECT, objc, objv);
|
||||
@@ -2784,12 +2724,12 @@ EachloopCmd(
|
||||
* evaluation. */
|
||||
int collect, /* Select collecting or accumulating mode
|
||||
* (TCL_EACH_*) */
|
||||
int objc, /* The arguments being passed in... */
|
||||
Tcl_Size objc, /* The arguments being passed in... */
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
int numLists = (objc-2) / 2;
|
||||
Tcl_Size i, numLists = (objc-2) / 2;
|
||||
struct ForeachState *statePtr;
|
||||
int i, result;
|
||||
int result;
|
||||
Tcl_Size j;
|
||||
|
||||
if (objc < 4 || (objc%2 != 0)) {
|
||||
@@ -2850,7 +2790,7 @@ EachloopCmd(
|
||||
goto done;
|
||||
}
|
||||
result = TclListObjLength(interp, statePtr->vCopyList[i],
|
||||
&statePtr->varcList[i]);
|
||||
&statePtr->varcList[i]);
|
||||
if (result != TCL_OK) {
|
||||
result = TCL_ERROR;
|
||||
goto done;
|
||||
@@ -2866,7 +2806,7 @@ EachloopCmd(
|
||||
goto done;
|
||||
}
|
||||
TclListObjGetElements(NULL, statePtr->vCopyList[i],
|
||||
&statePtr->varcList[i], &statePtr->varvList[i]);
|
||||
&statePtr->varcList[i], &statePtr->varvList[i]);
|
||||
|
||||
/* Values */
|
||||
if (TclObjTypeHasProc(objv[2+i*2],indexProc)) {
|
||||
@@ -3102,7 +3042,7 @@ int
|
||||
Tcl_FormatObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Tcl_Obj *resultPtr; /* Where result is stored finally. */
|
||||
|
||||
+202
-361
File diff suppressed because it is too large
Load Diff
+280
-183
File diff suppressed because it is too large
Load Diff
+815
-1053
File diff suppressed because it is too large
Load Diff
+1071
-497
File diff suppressed because it is too large
Load Diff
+2240
-1299
File diff suppressed because it is too large
Load Diff
+207
-214
@@ -61,11 +61,11 @@ typedef struct {
|
||||
*/
|
||||
|
||||
enum OperandTypes {
|
||||
OT_LITERAL = -3, /* Operand is a literal in the literal list */
|
||||
OT_TOKENS = -2, /* Operand is sequence of Tcl_Tokens */
|
||||
OT_EMPTY = -1 /* "Operand" is an empty string. This is a special
|
||||
* case used only to represent the EMPTY lexeme. See
|
||||
* below. */
|
||||
OT_LITERAL = -3, /* Operand is a literal in the literal list */
|
||||
OT_TOKENS = -2, /* Operand is sequence of Tcl_Tokens */
|
||||
OT_EMPTY = -1 /* "Operand" is an empty string. This is a
|
||||
* special case used only to represent the
|
||||
* EMPTY lexeme. See below. */
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -106,9 +106,9 @@ enum OperandTypes {
|
||||
*/
|
||||
|
||||
enum Marks {
|
||||
MARK_LEFT, /* Next step of traversal is to visit left subtree */
|
||||
MARK_RIGHT, /* Next step of traversal is to visit right subtree */
|
||||
MARK_PARENT /* Next step of traversal is to return to parent */
|
||||
MARK_LEFT, /* Next step of traversal is to visit left subtree */
|
||||
MARK_RIGHT, /* Next step of traversal is to visit right subtree */
|
||||
MARK_PARENT /* Next step of traversal is to return to parent */
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -162,7 +162,7 @@ enum LexemeCodes {
|
||||
* FUNCTION or a parse error according to
|
||||
* context and value. */
|
||||
INCOMPLETE = 4, /* A parse error. Used only when the single
|
||||
* "=" is encountered. */
|
||||
* "=" is encountered. */
|
||||
INVALID = 5, /* A parse error. Used when any punctuation
|
||||
* appears that's not a supported operator. */
|
||||
COMMENT = 6, /* Comment. Lasts to end of line or end of
|
||||
@@ -223,7 +223,7 @@ enum LexemeCodes {
|
||||
* that this operator can only legally appear
|
||||
* at the right places within a function call
|
||||
* argument list are hard coded within
|
||||
* ParseExpr(). */
|
||||
* ParseExpr(). */
|
||||
MULT = BINARY | 4,
|
||||
DIVIDE = BINARY | 5,
|
||||
MOD = BINARY | 6,
|
||||
@@ -292,24 +292,24 @@ enum LexemeCodes {
|
||||
*/
|
||||
|
||||
enum Precedence {
|
||||
PREC_END = 1, /* END */
|
||||
PREC_START, /* START */
|
||||
PREC_CLOSE_PAREN, /* ")" */
|
||||
PREC_OPEN_PAREN, /* "(" */
|
||||
PREC_COMMA, /* "," */
|
||||
PREC_CONDITIONAL, /* "?", ":" */
|
||||
PREC_OR, /* "||" */
|
||||
PREC_AND, /* "&&" */
|
||||
PREC_BIT_OR, /* "|" */
|
||||
PREC_BIT_XOR, /* "^" */
|
||||
PREC_BIT_AND, /* "&" */
|
||||
PREC_EQUAL, /* "==", "!=", "eq", "ne", "in", "ni" */
|
||||
PREC_COMPARE, /* "<", ">", "<=", ">=" */
|
||||
PREC_SHIFT, /* "<<", ">>" */
|
||||
PREC_ADD, /* "+", "-" */
|
||||
PREC_MULT, /* "*", "/", "%" */
|
||||
PREC_EXPON, /* "**" */
|
||||
PREC_UNARY /* "+", "-", FUNCTION, "!", "~" */
|
||||
PREC_END = 1, /* END */
|
||||
PREC_START, /* START */
|
||||
PREC_CLOSE_PAREN, /* ")" */
|
||||
PREC_OPEN_PAREN, /* "(" */
|
||||
PREC_COMMA, /* "," */
|
||||
PREC_CONDITIONAL, /* "?", ":" */
|
||||
PREC_OR, /* "||" */
|
||||
PREC_AND, /* "&&" */
|
||||
PREC_BIT_OR, /* "|" */
|
||||
PREC_BIT_XOR, /* "^" */
|
||||
PREC_BIT_AND, /* "&" */
|
||||
PREC_EQUAL, /* "==", "!=", "eq", "ne", "in", "ni" */
|
||||
PREC_COMPARE, /* "<", ">", "<=", ">=" */
|
||||
PREC_SHIFT, /* "<<", ">>" */
|
||||
PREC_ADD, /* "+", "-" */
|
||||
PREC_MULT, /* "*", "/", "%" */
|
||||
PREC_EXPON, /* "**" */
|
||||
PREC_UNARY /* "+", "-", FUNCTION, "!", "~" */
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -326,49 +326,49 @@ static const unsigned char prec[] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0,
|
||||
/* Binary operator lexemes */
|
||||
PREC_ADD, /* BINARY_PLUS */
|
||||
PREC_ADD, /* BINARY_MINUS */
|
||||
PREC_COMMA, /* COMMA */
|
||||
PREC_MULT, /* MULT */
|
||||
PREC_MULT, /* DIVIDE */
|
||||
PREC_MULT, /* MOD */
|
||||
PREC_COMPARE, /* LESS */
|
||||
PREC_COMPARE, /* GREATER */
|
||||
PREC_BIT_AND, /* BIT_AND */
|
||||
PREC_BIT_XOR, /* BIT_XOR */
|
||||
PREC_BIT_OR, /* BIT_OR */
|
||||
PREC_CONDITIONAL, /* QUESTION */
|
||||
PREC_CONDITIONAL, /* COLON */
|
||||
PREC_SHIFT, /* LEFT_SHIFT */
|
||||
PREC_SHIFT, /* RIGHT_SHIFT */
|
||||
PREC_COMPARE, /* LEQ */
|
||||
PREC_COMPARE, /* GEQ */
|
||||
PREC_EQUAL, /* EQUAL */
|
||||
PREC_EQUAL, /* NEQ */
|
||||
PREC_AND, /* AND */
|
||||
PREC_OR, /* OR */
|
||||
PREC_EQUAL, /* STREQ */
|
||||
PREC_EQUAL, /* STRNEQ */
|
||||
PREC_EXPON, /* EXPON */
|
||||
PREC_EQUAL, /* IN_LIST */
|
||||
PREC_EQUAL, /* NOT_IN_LIST */
|
||||
PREC_CLOSE_PAREN, /* CLOSE_PAREN */
|
||||
PREC_COMPARE, /* STR_LT */
|
||||
PREC_COMPARE, /* STR_GT */
|
||||
PREC_COMPARE, /* STR_LEQ */
|
||||
PREC_COMPARE, /* STR_GEQ */
|
||||
PREC_END, /* END */
|
||||
PREC_ADD, /* BINARY_PLUS */
|
||||
PREC_ADD, /* BINARY_MINUS */
|
||||
PREC_COMMA, /* COMMA */
|
||||
PREC_MULT, /* MULT */
|
||||
PREC_MULT, /* DIVIDE */
|
||||
PREC_MULT, /* MOD */
|
||||
PREC_COMPARE, /* LESS */
|
||||
PREC_COMPARE, /* GREATER */
|
||||
PREC_BIT_AND, /* BIT_AND */
|
||||
PREC_BIT_XOR, /* BIT_XOR */
|
||||
PREC_BIT_OR, /* BIT_OR */
|
||||
PREC_CONDITIONAL, /* QUESTION */
|
||||
PREC_CONDITIONAL, /* COLON */
|
||||
PREC_SHIFT, /* LEFT_SHIFT */
|
||||
PREC_SHIFT, /* RIGHT_SHIFT */
|
||||
PREC_COMPARE, /* LEQ */
|
||||
PREC_COMPARE, /* GEQ */
|
||||
PREC_EQUAL, /* EQUAL */
|
||||
PREC_EQUAL, /* NEQ */
|
||||
PREC_AND, /* AND */
|
||||
PREC_OR, /* OR */
|
||||
PREC_EQUAL, /* STREQ */
|
||||
PREC_EQUAL, /* STRNEQ */
|
||||
PREC_EXPON, /* EXPON */
|
||||
PREC_EQUAL, /* IN_LIST */
|
||||
PREC_EQUAL, /* NOT_IN_LIST */
|
||||
PREC_CLOSE_PAREN, /* CLOSE_PAREN */
|
||||
PREC_COMPARE, /* STR_LT */
|
||||
PREC_COMPARE, /* STR_GT */
|
||||
PREC_COMPARE, /* STR_LEQ */
|
||||
PREC_COMPARE, /* STR_GEQ */
|
||||
PREC_END, /* END */
|
||||
/* Expansion room for more binary operators */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/* Unary operator lexemes */
|
||||
PREC_UNARY, /* UNARY_PLUS */
|
||||
PREC_UNARY, /* UNARY_MINUS */
|
||||
PREC_UNARY, /* FUNCTION */
|
||||
PREC_START, /* START */
|
||||
PREC_OPEN_PAREN, /* OPEN_PAREN */
|
||||
PREC_UNARY, /* NOT*/
|
||||
PREC_UNARY, /* BIT_NOT*/
|
||||
PREC_UNARY, /* UNARY_PLUS */
|
||||
PREC_UNARY, /* UNARY_MINUS */
|
||||
PREC_UNARY, /* FUNCTION */
|
||||
PREC_START, /* START */
|
||||
PREC_OPEN_PAREN, /* OPEN_PAREN */
|
||||
PREC_UNARY, /* NOT*/
|
||||
PREC_UNARY, /* BIT_NOT*/
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -383,49 +383,49 @@ static const unsigned char instruction[] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0,
|
||||
/* Binary operator lexemes */
|
||||
INST_ADD, /* BINARY_PLUS */
|
||||
INST_SUB, /* BINARY_MINUS */
|
||||
0, /* COMMA */
|
||||
INST_MULT, /* MULT */
|
||||
INST_DIV, /* DIVIDE */
|
||||
INST_MOD, /* MOD */
|
||||
INST_LT, /* LESS */
|
||||
INST_GT, /* GREATER */
|
||||
INST_BITAND, /* BIT_AND */
|
||||
INST_BITXOR, /* BIT_XOR */
|
||||
INST_BITOR, /* BIT_OR */
|
||||
0, /* QUESTION */
|
||||
0, /* COLON */
|
||||
INST_LSHIFT, /* LEFT_SHIFT */
|
||||
INST_RSHIFT, /* RIGHT_SHIFT */
|
||||
INST_LE, /* LEQ */
|
||||
INST_GE, /* GEQ */
|
||||
INST_EQ, /* EQUAL */
|
||||
INST_NEQ, /* NEQ */
|
||||
0, /* AND */
|
||||
0, /* OR */
|
||||
INST_STR_EQ, /* STREQ */
|
||||
INST_STR_NEQ, /* STRNEQ */
|
||||
INST_EXPON, /* EXPON */
|
||||
INST_LIST_IN, /* IN_LIST */
|
||||
INST_LIST_NOT_IN, /* NOT_IN_LIST */
|
||||
0, /* CLOSE_PAREN */
|
||||
INST_STR_LT, /* STR_LT */
|
||||
INST_STR_GT, /* STR_GT */
|
||||
INST_STR_LE, /* STR_LEQ */
|
||||
INST_STR_GE, /* STR_GEQ */
|
||||
0, /* END */
|
||||
INST_ADD, /* BINARY_PLUS */
|
||||
INST_SUB, /* BINARY_MINUS */
|
||||
0, /* COMMA */
|
||||
INST_MULT, /* MULT */
|
||||
INST_DIV, /* DIVIDE */
|
||||
INST_MOD, /* MOD */
|
||||
INST_LT, /* LESS */
|
||||
INST_GT, /* GREATER */
|
||||
INST_BITAND, /* BIT_AND */
|
||||
INST_BITXOR, /* BIT_XOR */
|
||||
INST_BITOR, /* BIT_OR */
|
||||
0, /* QUESTION */
|
||||
0, /* COLON */
|
||||
INST_LSHIFT, /* LEFT_SHIFT */
|
||||
INST_RSHIFT, /* RIGHT_SHIFT */
|
||||
INST_LE, /* LEQ */
|
||||
INST_GE, /* GEQ */
|
||||
INST_EQ, /* EQUAL */
|
||||
INST_NEQ, /* NEQ */
|
||||
0, /* AND */
|
||||
0, /* OR */
|
||||
INST_STR_EQ, /* STREQ */
|
||||
INST_STR_NEQ, /* STRNEQ */
|
||||
INST_EXPON, /* EXPON */
|
||||
INST_LIST_IN, /* IN_LIST */
|
||||
INST_LIST_NOT_IN, /* NOT_IN_LIST */
|
||||
0, /* CLOSE_PAREN */
|
||||
INST_STR_LT, /* STR_LT */
|
||||
INST_STR_GT, /* STR_GT */
|
||||
INST_STR_LE, /* STR_LEQ */
|
||||
INST_STR_GE, /* STR_GEQ */
|
||||
0, /* END */
|
||||
/* Expansion room for more binary operators */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/* Unary operator lexemes */
|
||||
INST_UPLUS, /* UNARY_PLUS */
|
||||
INST_UMINUS, /* UNARY_MINUS */
|
||||
0, /* FUNCTION */
|
||||
0, /* START */
|
||||
0, /* OPEN_PAREN */
|
||||
INST_LNOT, /* NOT*/
|
||||
INST_BITNOT, /* BIT_NOT*/
|
||||
INST_UPLUS, /* UNARY_PLUS */
|
||||
INST_UMINUS, /* UNARY_MINUS */
|
||||
0, /* FUNCTION */
|
||||
0, /* START */
|
||||
0, /* OPEN_PAREN */
|
||||
INST_LNOT, /* NOT*/
|
||||
INST_BITNOT, /* BIT_NOT*/
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -495,18 +495,18 @@ typedef struct JumpList {
|
||||
*/
|
||||
|
||||
static void CompileExprTree(Tcl_Interp *interp, OpNode *nodes,
|
||||
int index, Tcl_Obj *const **litObjvPtr,
|
||||
Tcl_Size index, Tcl_Obj *const **litObjvPtr,
|
||||
Tcl_Obj *const *funcObjv, Tcl_Token *tokenPtr,
|
||||
CompileEnv *envPtr, int optimize);
|
||||
CompileEnv *envPtr, bool optimize);
|
||||
static void ConvertTreeToTokens(const char *start, Tcl_Size numBytes,
|
||||
OpNode *nodes, Tcl_Token *tokenPtr,
|
||||
Tcl_Parse *parsePtr);
|
||||
static int ExecConstantExprTree(Tcl_Interp *interp, OpNode *nodes,
|
||||
int index, Tcl_Obj * const **litObjvPtr);
|
||||
Tcl_Size index, Tcl_Obj *const **litObjvPtr);
|
||||
static int ParseExpr(Tcl_Interp *interp, const char *start,
|
||||
Tcl_Size numBytes, OpNode **opTreePtr,
|
||||
Tcl_Obj *litList, Tcl_Obj *funcList,
|
||||
Tcl_Parse *parsePtr, int parseOnly);
|
||||
Tcl_Parse *parsePtr, bool parseOnly);
|
||||
static Tcl_Size ParseLexeme(const char *start, Tcl_Size numBytes,
|
||||
unsigned char *lexemePtr, Tcl_Obj **literalPtr);
|
||||
|
||||
@@ -553,7 +553,7 @@ ParseExpr(
|
||||
Tcl_Parse *parsePtr, /* Structure to fill with tokens representing
|
||||
* those operands that require run time
|
||||
* substitutions. */
|
||||
int parseOnly) /* A boolean indicating whether the caller's
|
||||
bool parseOnly) /* A boolean indicating whether the caller's
|
||||
* aim is just a parse, or whether it will go
|
||||
* on to compile the expression. Different
|
||||
* optimizations are appropriate for the two
|
||||
@@ -721,7 +721,7 @@ ParseExpr(
|
||||
* is a legal literal boolean value, we accept that as well.
|
||||
*/
|
||||
|
||||
if (start[scanned+TclParseAllWhiteSpace(
|
||||
if (literal && start[scanned+TclParseAllWhiteSpace(
|
||||
start+scanned, numBytes-scanned)] == '(') {
|
||||
lexeme = FUNCTION;
|
||||
|
||||
@@ -733,14 +733,14 @@ ParseExpr(
|
||||
*/
|
||||
|
||||
Tcl_ListObjAppendElement(NULL, funcList, literal);
|
||||
} else if (Tcl_GetBooleanFromObj(NULL,literal,&b) == TCL_OK) {
|
||||
} else if (literal && Tcl_GetBooleanFromObj(NULL,literal,&b) == TCL_OK) {
|
||||
lexeme = BOOL_LIT;
|
||||
} else {
|
||||
/*
|
||||
* Tricky case: see test expr-62.10
|
||||
*/
|
||||
|
||||
int scanned2 = scanned;
|
||||
Tcl_Size scanned2 = scanned;
|
||||
do {
|
||||
scanned2 += TclParseAllWhiteSpace(
|
||||
start + scanned2, numBytes - scanned2);
|
||||
@@ -748,7 +748,7 @@ ParseExpr(
|
||||
start + scanned2, numBytes - scanned2, &lexeme,
|
||||
NULL);
|
||||
} while (lexeme == COMMENT);
|
||||
if (lexeme == OPEN_PAREN) {
|
||||
if (literal && lexeme == OPEN_PAREN) {
|
||||
/*
|
||||
* Actually a function call, but with obscuring
|
||||
* comments. Skip to the start of the parentheses.
|
||||
@@ -762,7 +762,9 @@ ParseExpr(
|
||||
break;
|
||||
}
|
||||
|
||||
Tcl_DecrRefCount(literal);
|
||||
if (literal) {
|
||||
Tcl_DecrRefCount(literal);
|
||||
}
|
||||
msg = Tcl_ObjPrintf("invalid bareword \"%.*s%s\"",
|
||||
(int)((scanned < limit) ? scanned : limit - 3), start,
|
||||
(scanned < limit) ? "" : "...");
|
||||
@@ -785,14 +787,16 @@ ParseExpr(
|
||||
switch (start[1]) {
|
||||
case 'b':
|
||||
Tcl_AppendToObj(post,
|
||||
" (invalid binary number?)", -1);
|
||||
" (invalid binary number?)",
|
||||
TCL_AUTO_LENGTH);
|
||||
parsePtr->errorType = TCL_PARSE_BAD_NUMBER;
|
||||
errCode = "BADNUMBER";
|
||||
subErrCode = "BINARY";
|
||||
break;
|
||||
case 'o':
|
||||
Tcl_AppendToObj(post,
|
||||
" (invalid octal number?)", -1);
|
||||
" (invalid octal number?)",
|
||||
TCL_AUTO_LENGTH);
|
||||
parsePtr->errorType = TCL_PARSE_BAD_NUMBER;
|
||||
errCode = "BADNUMBER";
|
||||
subErrCode = "OCTAL";
|
||||
@@ -800,7 +804,8 @@ ParseExpr(
|
||||
default:
|
||||
if (isdigit(UCHAR(start[1]))) {
|
||||
Tcl_AppendToObj(post,
|
||||
" (invalid octal number?)", -1);
|
||||
" (invalid octal number?)",
|
||||
TCL_AUTO_LENGTH);
|
||||
parsePtr->errorType = TCL_PARSE_BAD_NUMBER;
|
||||
errCode = "BADNUMBER";
|
||||
subErrCode = "OCTAL";
|
||||
@@ -842,7 +847,7 @@ ParseExpr(
|
||||
|
||||
Tcl_Token *tokenPtr;
|
||||
const char *end = start;
|
||||
int wordIndex;
|
||||
Tcl_Size wordIndex;
|
||||
int code = TCL_OK;
|
||||
|
||||
/*
|
||||
@@ -1449,7 +1454,7 @@ ParseExpr(
|
||||
*/
|
||||
|
||||
if (post != NULL) {
|
||||
Tcl_AppendToObj(msg, ";\n", -1);
|
||||
Tcl_AppendToObj(msg, ";\n", TCL_AUTO_LENGTH);
|
||||
Tcl_AppendObjToObj(msg, post);
|
||||
Tcl_DecrRefCount(post);
|
||||
}
|
||||
@@ -1504,13 +1509,13 @@ ConvertTreeToTokens(
|
||||
Tcl_Token *tokenPtr,
|
||||
Tcl_Parse *parsePtr)
|
||||
{
|
||||
int subExprTokenIdx = 0;
|
||||
Tcl_Size subExprTokenIdx = 0;
|
||||
OpNode *nodePtr = nodes;
|
||||
int next = nodePtr->right;
|
||||
|
||||
while (1) {
|
||||
Tcl_Token *subExprTokenPtr;
|
||||
int scanned, parentIdx;
|
||||
Tcl_Size scanned, parentIdx;
|
||||
unsigned char lexeme;
|
||||
|
||||
/*
|
||||
@@ -1577,7 +1582,7 @@ ConvertTreeToTokens(
|
||||
* do better.
|
||||
*/
|
||||
|
||||
int toCopy = tokenPtr->numComponents + 1;
|
||||
Tcl_Size toCopy = tokenPtr->numComponents + 1;
|
||||
|
||||
if (tokenPtr->numComponents == tokenPtr[1].numComponents + 1) {
|
||||
/*
|
||||
@@ -1793,7 +1798,7 @@ ConvertTreeToTokens(
|
||||
*/
|
||||
|
||||
subExprTokenPtr->numComponents =
|
||||
((int)parsePtr->numTokens - subExprTokenIdx) - 1;
|
||||
(parsePtr->numTokens - subExprTokenIdx) - 1;
|
||||
|
||||
/*
|
||||
* Finally, as we return up the tree to our parent, pop the
|
||||
@@ -1856,10 +1861,10 @@ Tcl_ParseExpr(
|
||||
{
|
||||
int code;
|
||||
OpNode *opTree = NULL; /* Will point to the tree of operators. */
|
||||
Tcl_Obj *litList; /* List to hold the literals. */
|
||||
Tcl_Obj *funcList; /* List to hold the functon names. */
|
||||
Tcl_Parse *exprParsePtr = (Tcl_Parse *)TclStackAlloc(interp, sizeof(Tcl_Parse));
|
||||
/* Holds the Tcl_Tokens of substitutions. */
|
||||
Tcl_Obj *litList; /* List to hold the literals. */
|
||||
Tcl_Obj *funcList; /* List to hold the functon names. */
|
||||
Tcl_Parse *exprParsePtr = (Tcl_Parse *)TclStackAlloc(interp,
|
||||
sizeof(Tcl_Parse)); /* Holds the Tcl_Tokens of substitutions. */
|
||||
|
||||
TclNewObj(litList);
|
||||
TclNewObj(funcList);
|
||||
@@ -1868,7 +1873,7 @@ Tcl_ParseExpr(
|
||||
}
|
||||
|
||||
code = ParseExpr(interp, start, numBytes, &opTree, litList, funcList,
|
||||
exprParsePtr, 1 /* parseOnly */);
|
||||
exprParsePtr, true /* parseOnly */);
|
||||
Tcl_DecrRefCount(funcList);
|
||||
Tcl_DecrRefCount(litList);
|
||||
|
||||
@@ -2082,7 +2087,10 @@ ParseLexeme(
|
||||
number:
|
||||
*lexemePtr = NUMBER;
|
||||
if (literalPtr) {
|
||||
TclInitStringRep(literal, start, end-start);
|
||||
if(!TclAttemptInitStringRep(literal, start, end-start)) {
|
||||
Tcl_DecrRefCount(literal);
|
||||
literal = NULL;
|
||||
}
|
||||
*literalPtr = literal;
|
||||
} else {
|
||||
Tcl_DecrRefCount(literal);
|
||||
@@ -2186,7 +2194,7 @@ TclCompileExpr(
|
||||
const char *script, /* The source script to compile. */
|
||||
Tcl_Size numBytes, /* Number of bytes in script. */
|
||||
CompileEnv *envPtr, /* Holds resulting instructions. */
|
||||
int optimize) /* 0 for one-off expressions. */
|
||||
bool optimize) /* false for one-off expressions. */
|
||||
{
|
||||
OpNode *opTree = NULL; /* Will point to the tree of operators */
|
||||
Tcl_Obj *litList; /* List to hold the literals */
|
||||
@@ -2198,7 +2206,7 @@ TclCompileExpr(
|
||||
TclNewObj(litList);
|
||||
TclNewObj(funcList);
|
||||
code = ParseExpr(interp, script, numBytes, &opTree, litList,
|
||||
funcList, parsePtr, 0 /* parseOnly */);
|
||||
funcList, parsePtr, false /* parseOnly */);
|
||||
|
||||
if (code == TCL_OK) {
|
||||
/*
|
||||
@@ -2250,7 +2258,7 @@ static int
|
||||
ExecConstantExprTree(
|
||||
Tcl_Interp *interp,
|
||||
OpNode *nodes,
|
||||
int index,
|
||||
Tcl_Size index,
|
||||
Tcl_Obj *const **litObjvPtr)
|
||||
{
|
||||
CompileEnv *envPtr;
|
||||
@@ -2267,8 +2275,8 @@ ExecConstantExprTree(
|
||||
envPtr = (CompileEnv *)TclStackAlloc(interp, sizeof(CompileEnv));
|
||||
TclInitCompileEnv(interp, envPtr, NULL, 0, NULL, 0);
|
||||
CompileExprTree(interp, nodes, index, litObjvPtr, NULL, NULL, envPtr,
|
||||
0 /* optimize */);
|
||||
TclEmitOpcode(INST_DONE, envPtr);
|
||||
false /* optimize */);
|
||||
OP( DONE);
|
||||
byteCodePtr = TclInitByteCode(envPtr);
|
||||
TclFreeCompileEnv(envPtr);
|
||||
TclStackFree(interp, envPtr);
|
||||
@@ -2305,12 +2313,12 @@ static void
|
||||
CompileExprTree(
|
||||
Tcl_Interp *interp,
|
||||
OpNode *nodes,
|
||||
int index,
|
||||
Tcl_Size index,
|
||||
Tcl_Obj *const **litObjvPtr,
|
||||
Tcl_Obj *const *funcObjv,
|
||||
Tcl_Token *tokenPtr,
|
||||
CompileEnv *envPtr,
|
||||
int optimize)
|
||||
bool optimize)
|
||||
{
|
||||
OpNode *nodePtr = nodes + index;
|
||||
OpNode *rootPtr = nodePtr;
|
||||
@@ -2333,19 +2341,12 @@ CompileExprTree(
|
||||
|
||||
switch (nodePtr->lexeme) {
|
||||
case FUNCTION: {
|
||||
Tcl_DString cmdName;
|
||||
const char *p;
|
||||
Tcl_Size length;
|
||||
Tcl_Obj *cmdName;
|
||||
|
||||
Tcl_DStringInit(&cmdName);
|
||||
TclDStringAppendLiteral(&cmdName, "tcl::mathfunc::");
|
||||
p = TclGetStringFromObj(*funcObjv, &length);
|
||||
TclNewLiteralStringObj(cmdName, "tcl::mathfunc::");
|
||||
Tcl_AppendObjToObj(cmdName, *funcObjv);
|
||||
funcObjv++;
|
||||
Tcl_DStringAppend(&cmdName, p, length);
|
||||
TclEmitPush(TclRegisterLiteral(envPtr,
|
||||
Tcl_DStringValue(&cmdName),
|
||||
Tcl_DStringLength(&cmdName), LITERAL_CMD_NAME), envPtr);
|
||||
Tcl_DStringFree(&cmdName);
|
||||
PUSH_OBJ_FLAGS(cmdName, LITERAL_CMD_NAME);
|
||||
|
||||
/*
|
||||
* Start a count of the number of words in this function
|
||||
@@ -2370,7 +2371,7 @@ CompileExprTree(
|
||||
jumpPtr = newJump;
|
||||
TclEmitForwardJump(envPtr, TCL_UNCONDITIONAL_JUMP,
|
||||
&jumpPtr->jump);
|
||||
TclAdjustStackDepth(-1, envPtr);
|
||||
STKDELTA(-1);
|
||||
if (convert) {
|
||||
jumpPtr->jump.jumpType = TCL_TRUE_JUMP;
|
||||
}
|
||||
@@ -2386,13 +2387,14 @@ CompileExprTree(
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
int pc1, pc2, target;
|
||||
Tcl_Size target;
|
||||
Tcl_BytecodeLabel pc1, pc2;
|
||||
|
||||
switch (nodePtr->lexeme) {
|
||||
case START:
|
||||
case QUESTION:
|
||||
if (convert && (nodePtr == rootPtr)) {
|
||||
TclEmitOpcode(INST_TRY_CVT_TO_NUMERIC, envPtr);
|
||||
OP( TRY_CVT_TO_NUMERIC);
|
||||
}
|
||||
break;
|
||||
case OPEN_PAREN:
|
||||
@@ -2405,11 +2407,7 @@ CompileExprTree(
|
||||
* command with the correct number of arguments.
|
||||
*/
|
||||
|
||||
if (numWords < 255) {
|
||||
TclEmitInvoke(envPtr, INST_INVOKE_STK1, numWords);
|
||||
} else {
|
||||
TclEmitInvoke(envPtr, INST_INVOKE_STK4, numWords);
|
||||
}
|
||||
INVOKE4( INVOKE_STK, numWords);
|
||||
|
||||
/*
|
||||
* Restore any saved numWords value.
|
||||
@@ -2431,15 +2429,13 @@ CompileExprTree(
|
||||
jumpPtr->jump.jumpType = TCL_UNCONDITIONAL_JUMP;
|
||||
convert = 1;
|
||||
}
|
||||
target = jumpPtr->jump.codeOffset + 2;
|
||||
if (TclFixupForwardJumpToHere(envPtr, &jumpPtr->jump, 127)) {
|
||||
target += 3;
|
||||
}
|
||||
target = jumpPtr->jump.codeOffset + 5;
|
||||
TclFixupForwardJumpToHere(envPtr, &jumpPtr->jump);
|
||||
freePtr = jumpPtr;
|
||||
jumpPtr = jumpPtr->next;
|
||||
TclStackFree(interp, freePtr);
|
||||
TclFixupForwardJump(envPtr, &jumpPtr->jump,
|
||||
target - jumpPtr->jump.codeOffset, 127);
|
||||
target - jumpPtr->jump.codeOffset);
|
||||
|
||||
freePtr = jumpPtr;
|
||||
jumpPtr = jumpPtr->next;
|
||||
@@ -2448,23 +2444,18 @@ CompileExprTree(
|
||||
case AND:
|
||||
case OR:
|
||||
CLANG_ASSERT(jumpPtr);
|
||||
pc1 = CurrentOffset(envPtr);
|
||||
TclEmitInstInt1((nodePtr->lexeme == AND) ? INST_JUMP_FALSE1
|
||||
: INST_JUMP_TRUE1, 0, envPtr);
|
||||
TclEmitPush(TclRegisterLiteral(envPtr,
|
||||
(nodePtr->lexeme == AND) ? "1" : "0", 1, 0), envPtr);
|
||||
pc2 = CurrentOffset(envPtr);
|
||||
TclEmitInstInt1(INST_JUMP1, 0, envPtr);
|
||||
TclAdjustStackDepth(-1, envPtr);
|
||||
TclStoreInt1AtPtr(CurrentOffset(envPtr) - pc1,
|
||||
envPtr->codeStart + pc1 + 1);
|
||||
if (TclFixupForwardJumpToHere(envPtr, &jumpPtr->jump, 127)) {
|
||||
pc2 += 3;
|
||||
if (nodePtr->lexeme == AND) {
|
||||
FWDJUMP( JUMP_FALSE, pc1);
|
||||
} else {
|
||||
FWDJUMP( JUMP_TRUE, pc1);
|
||||
}
|
||||
TclEmitPush(TclRegisterLiteral(envPtr,
|
||||
(nodePtr->lexeme == AND) ? "0" : "1", 1, 0), envPtr);
|
||||
TclStoreInt1AtPtr(CurrentOffset(envPtr) - pc2,
|
||||
envPtr->codeStart + pc2 + 1);
|
||||
PUSH_STRING( (nodePtr->lexeme == AND) ? "1" : "0");
|
||||
FWDJUMP( JUMP, pc2);
|
||||
STKDELTA(-1);
|
||||
FWDLABEL(pc1);
|
||||
TclFixupForwardJumpToHere(envPtr, &jumpPtr->jump);
|
||||
PUSH_STRING( (nodePtr->lexeme == AND) ? "0" : "1");
|
||||
FWDLABEL(pc2);
|
||||
convert = 0;
|
||||
freePtr = jumpPtr;
|
||||
jumpPtr = jumpPtr->next;
|
||||
@@ -2494,9 +2485,7 @@ CompileExprTree(
|
||||
Tcl_Obj *literal = *litObjv;
|
||||
|
||||
if (optimize) {
|
||||
Tcl_Size length;
|
||||
const char *bytes = TclGetStringFromObj(literal, &length);
|
||||
int idx = TclRegisterLiteral(envPtr, bytes, length, 0);
|
||||
int idx = PUSH_OBJ_FLAGS(literal, 0);
|
||||
Tcl_Obj *objPtr = TclFetchLiteral(envPtr, idx);
|
||||
|
||||
if ((objPtr->typePtr == NULL) && (literal->typePtr != NULL)) {
|
||||
@@ -2517,10 +2506,9 @@ CompileExprTree(
|
||||
objPtr->internalRep = literal->internalRep;
|
||||
literal->typePtr = NULL;
|
||||
}
|
||||
TclEmitPush(idx, envPtr);
|
||||
} else {
|
||||
/*
|
||||
* When optimize==0, we know the expression is a one-off and
|
||||
* When optimize==false, we know the expression is a one-off and
|
||||
* there's nothing to be gained from sharing literals when
|
||||
* they won't live long, and the copies we have already have
|
||||
* an appropriate internalrep. In this case, skip literal
|
||||
@@ -2528,7 +2516,7 @@ CompileExprTree(
|
||||
* that preserves internalreps.
|
||||
*/
|
||||
|
||||
TclEmitPush(TclAddLiteralObj(envPtr, literal, NULL), envPtr);
|
||||
PUSH_OBJ( literal);
|
||||
}
|
||||
(*litObjvPtr)++;
|
||||
break;
|
||||
@@ -2608,7 +2596,7 @@ int
|
||||
TclSingleOpCmd(
|
||||
void *clientData,
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
TclOpCmdClientData *occdPtr = (TclOpCmdClientData *)clientData;
|
||||
@@ -2661,7 +2649,7 @@ int
|
||||
TclSortingOpCmd(
|
||||
void *clientData,
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
int code = TCL_OK;
|
||||
@@ -2672,9 +2660,11 @@ TclSortingOpCmd(
|
||||
TclOpCmdClientData *occdPtr = (TclOpCmdClientData *)clientData;
|
||||
Tcl_Obj **litObjv = (Tcl_Obj **)TclStackAlloc(interp,
|
||||
2 * (objc-2) * sizeof(Tcl_Obj *));
|
||||
OpNode *nodes = (OpNode *)TclStackAlloc(interp, 2 * (objc-2) * sizeof(OpNode));
|
||||
OpNode *nodes = (OpNode *)TclStackAlloc(interp,
|
||||
2 * (objc-2) * sizeof(OpNode));
|
||||
unsigned char lexeme;
|
||||
int i, lastAnd = 1;
|
||||
Tcl_Size i;
|
||||
int lastAnd = 1;
|
||||
Tcl_Obj *const *litObjPtrPtr = litObjv;
|
||||
|
||||
ParseLexeme(occdPtr->op, strlen(occdPtr->op), &lexeme, NULL);
|
||||
@@ -2683,29 +2673,30 @@ TclSortingOpCmd(
|
||||
nodes[0].lexeme = START;
|
||||
nodes[0].mark = MARK_RIGHT;
|
||||
for (i=2; i<objc-1; i++) {
|
||||
litObjv[2*(i-1)-1] = objv[i];
|
||||
nodes[2*(i-1)-1].lexeme = lexeme;
|
||||
nodes[2*(i-1)-1].mark = MARK_LEFT;
|
||||
nodes[2*(i-1)-1].left = OT_LITERAL;
|
||||
nodes[2*(i-1)-1].right = OT_LITERAL;
|
||||
int j = 2 * (i - 1);
|
||||
litObjv[j - 1] = objv[i];
|
||||
nodes[j - 1].lexeme = lexeme;
|
||||
nodes[j - 1].mark = MARK_LEFT;
|
||||
nodes[j - 1].left = OT_LITERAL;
|
||||
nodes[j - 1].right = OT_LITERAL;
|
||||
|
||||
litObjv[2*(i-1)] = objv[i];
|
||||
nodes[2*(i-1)].lexeme = AND;
|
||||
nodes[2*(i-1)].mark = MARK_LEFT;
|
||||
nodes[2*(i-1)].left = lastAnd;
|
||||
nodes[lastAnd].p.parent = 2*(i-1);
|
||||
litObjv[j] = objv[i];
|
||||
nodes[j].lexeme = AND;
|
||||
nodes[j].mark = MARK_LEFT;
|
||||
nodes[j].left = lastAnd;
|
||||
nodes[lastAnd].p.parent = 2*((int)i-1);
|
||||
|
||||
nodes[2*(i-1)].right = 2*(i-1)+1;
|
||||
nodes[2*(i-1)+1].p.parent= 2*(i-1);
|
||||
nodes[2*(i-1)].right = 2*((int)i-1)+1;
|
||||
nodes[2*(i-1)+1].p.parent= 2*((int)i-1);
|
||||
|
||||
lastAnd = 2*(i-1);
|
||||
lastAnd = 2*((int)i-1);
|
||||
}
|
||||
litObjv[2*(objc-2)-1] = objv[objc-1];
|
||||
litObjv[2 * (objc - 2) - 1] = objv[objc - 1];
|
||||
|
||||
nodes[2*(objc-2)-1].lexeme = lexeme;
|
||||
nodes[2*(objc-2)-1].mark = MARK_LEFT;
|
||||
nodes[2*(objc-2)-1].left = OT_LITERAL;
|
||||
nodes[2*(objc-2)-1].right = OT_LITERAL;
|
||||
nodes[2 * (objc - 2) - 1].lexeme = lexeme;
|
||||
nodes[2 * (objc - 2) - 1].mark = MARK_LEFT;
|
||||
nodes[2 * (objc - 2) - 1].left = OT_LITERAL;
|
||||
nodes[2 * (objc - 2) - 1].right = OT_LITERAL;
|
||||
|
||||
nodes[0].right = lastAnd;
|
||||
nodes[lastAnd].p.parent = 0;
|
||||
@@ -2741,7 +2732,7 @@ int
|
||||
TclVariadicOpCmd(
|
||||
void *clientData,
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
TclOpCmdClientData *occdPtr = (TclOpCmdClientData *)clientData;
|
||||
@@ -2799,8 +2790,10 @@ TclVariadicOpCmd(
|
||||
return code;
|
||||
} else {
|
||||
Tcl_Obj *const *litObjv = objv + 1;
|
||||
OpNode *nodes = (OpNode *)TclStackAlloc(interp, (objc-1) * sizeof(OpNode));
|
||||
int i, lastOp = OT_LITERAL;
|
||||
OpNode *nodes = (OpNode *)TclStackAlloc(interp,
|
||||
(objc - 1) * sizeof(OpNode));
|
||||
Tcl_Size i;
|
||||
int lastOp = OT_LITERAL;
|
||||
|
||||
nodes[0].lexeme = START;
|
||||
nodes[0].mark = MARK_RIGHT;
|
||||
@@ -2811,9 +2804,9 @@ TclVariadicOpCmd(
|
||||
nodes[i].left = OT_LITERAL;
|
||||
nodes[i].right = lastOp;
|
||||
if (lastOp >= 0) {
|
||||
nodes[lastOp].p.parent = i;
|
||||
nodes[lastOp].p.parent = (int)i;
|
||||
}
|
||||
lastOp = i;
|
||||
lastOp = (int)i;
|
||||
}
|
||||
} else {
|
||||
for (i=1; i<objc-1; i++) {
|
||||
@@ -2821,10 +2814,10 @@ TclVariadicOpCmd(
|
||||
nodes[i].mark = MARK_LEFT;
|
||||
nodes[i].left = lastOp;
|
||||
if (lastOp >= 0) {
|
||||
nodes[lastOp].p.parent = i;
|
||||
nodes[lastOp].p.parent = (int)i;
|
||||
}
|
||||
nodes[i].right = OT_LITERAL;
|
||||
lastOp = i;
|
||||
lastOp = (int)i;
|
||||
}
|
||||
}
|
||||
nodes[0].right = lastOp;
|
||||
@@ -2860,7 +2853,7 @@ int
|
||||
TclNoIdentOpCmd(
|
||||
void *clientData,
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
TclOpCmdClientData *occdPtr = (TclOpCmdClientData *)clientData;
|
||||
|
||||
+1153
-568
File diff suppressed because it is too large
Load Diff
+846
-345
File diff suppressed because it is too large
Load Diff
+4
-4
@@ -41,7 +41,7 @@ typedef struct {
|
||||
* Static functions in this file:
|
||||
*/
|
||||
|
||||
static Tcl_ObjCmdProc QueryConfigObjCmd;
|
||||
static Tcl_ObjCmdProc2 QueryConfigObjCmd;
|
||||
static Tcl_CmdDeleteProc QueryConfigDelete;
|
||||
static Tcl_InterpDeleteProc ConfigDictDeleteProc;
|
||||
static Tcl_Obj * GetConfigDict(Tcl_Interp *interp);
|
||||
@@ -163,7 +163,7 @@ Tcl_RegisterConfig(
|
||||
|
||||
TclDStringAppendLiteral(&cmdName, "::pkgconfig");
|
||||
|
||||
if (Tcl_CreateObjCommand(interp, Tcl_DStringValue(&cmdName),
|
||||
if (Tcl_CreateObjCommand2(interp, Tcl_DStringValue(&cmdName),
|
||||
QueryConfigObjCmd, cdPtr, QueryConfigDelete) == NULL) {
|
||||
Tcl_Panic("%s: %s", "Tcl_RegisterConfig",
|
||||
"Unable to create query command for package configuration");
|
||||
@@ -193,7 +193,7 @@ static int
|
||||
QueryConfigObjCmd(
|
||||
void *clientData,
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const *objv)
|
||||
{
|
||||
QCCD *cdPtr = (QCCD *)clientData;
|
||||
@@ -390,7 +390,7 @@ GetConfigDict(
|
||||
|
||||
static void
|
||||
ConfigDictDeleteProc(
|
||||
void *clientData, /* Pointer to Tcl_Obj. */
|
||||
void *clientData, /* Pointer to Tcl_Obj. */
|
||||
TCL_UNUSED(Tcl_Interp *))
|
||||
{
|
||||
Tcl_DecrRefCount((Tcl_Obj *)clientData);
|
||||
|
||||
+4
-9
@@ -390,10 +390,8 @@ typedef struct ClockClientData {
|
||||
|
||||
typedef struct ClockScanToken ClockScanToken;
|
||||
|
||||
typedef int ClockScanTokenProc(
|
||||
ClockFmtScnCmdArgs *opts,
|
||||
DateInfo *info,
|
||||
const ClockScanToken *tok);
|
||||
typedef int (ClockScanTokenProc)(ClockFmtScnCmdArgs *opts,
|
||||
DateInfo *info, const ClockScanToken *tok);
|
||||
|
||||
typedef enum {
|
||||
CTOKT_INT = 1, CTOKT_WIDE, CTOKT_PARSER, CTOKT_SPACE, CTOKT_WORD, CTOKT_CHAR,
|
||||
@@ -446,11 +444,8 @@ enum ClockFormatTokenMapFlags {
|
||||
|
||||
typedef struct ClockFormatToken ClockFormatToken;
|
||||
|
||||
typedef int ClockFormatTokenProc(
|
||||
ClockFmtScnCmdArgs *opts,
|
||||
DateFormat *dateFmt,
|
||||
ClockFormatToken *tok,
|
||||
int *val);
|
||||
typedef int (ClockFormatTokenProc)(ClockFmtScnCmdArgs *opts,
|
||||
DateFormat *dateFmt, ClockFormatToken *tok, int *val);
|
||||
|
||||
typedef struct ClockFormatTokenMap {
|
||||
unsigned short type;
|
||||
|
||||
+207
-194
@@ -33,6 +33,11 @@
|
||||
# define TCL_DEPRECATED(msg) EXTERN
|
||||
#endif
|
||||
|
||||
#ifdef TCL_NO_DEPRECATED
|
||||
# define Tcl_ObjCmdProc void
|
||||
# define Tcl_CmdTraceProc void
|
||||
# define Tcl_CmdObjTraceProc void
|
||||
#endif /* TCL_NO_DEPRECATED */
|
||||
|
||||
/*
|
||||
* WARNING: This file is automatically generated by the tools/genStubs.tcl
|
||||
@@ -61,18 +66,18 @@ EXTERN const char * Tcl_PkgRequireEx(Tcl_Interp *interp,
|
||||
/* 2 */
|
||||
EXTERN TCL_NORETURN void Tcl_Panic(const char *format, ...) TCL_FORMAT_PRINTF(1, 2);
|
||||
/* 3 */
|
||||
EXTERN void * Tcl_Alloc(TCL_HASH_TYPE size);
|
||||
EXTERN void * Tcl_Alloc(size_t size);
|
||||
/* 4 */
|
||||
EXTERN void Tcl_Free(void *ptr);
|
||||
/* 5 */
|
||||
EXTERN void * Tcl_Realloc(void *ptr, TCL_HASH_TYPE size);
|
||||
EXTERN void * Tcl_Realloc(void *ptr, size_t size);
|
||||
/* 6 */
|
||||
EXTERN void * Tcl_DbCkalloc(TCL_HASH_TYPE size, const char *file,
|
||||
EXTERN void * Tcl_DbCkalloc(size_t size, const char *file,
|
||||
int line);
|
||||
/* 7 */
|
||||
EXTERN void Tcl_DbCkfree(void *ptr, const char *file, int line);
|
||||
/* 8 */
|
||||
EXTERN void * Tcl_DbCkrealloc(void *ptr, TCL_HASH_TYPE size,
|
||||
EXTERN void * Tcl_DbCkrealloc(void *ptr, size_t size,
|
||||
const char *file, int line);
|
||||
/* 9 */
|
||||
EXTERN void Tcl_CreateFileHandler(int fd, int mask,
|
||||
@@ -128,15 +133,9 @@ EXTERN Tcl_Obj * Tcl_DbNewStringObj(const char *bytes,
|
||||
EXTERN Tcl_Obj * Tcl_DuplicateObj(Tcl_Obj *objPtr);
|
||||
/* 30 */
|
||||
EXTERN void TclFreeObj(Tcl_Obj *objPtr);
|
||||
/* 31 */
|
||||
EXTERN int Tcl_GetBoolean(Tcl_Interp *interp, const char *src,
|
||||
int *intPtr);
|
||||
/* 32 */
|
||||
EXTERN int Tcl_GetBooleanFromObj(Tcl_Interp *interp,
|
||||
Tcl_Obj *objPtr, int *intPtr);
|
||||
/* 33 */
|
||||
EXTERN unsigned char * Tcl_GetByteArrayFromObj(Tcl_Obj *objPtr,
|
||||
Tcl_Size *numBytesPtr);
|
||||
/* Slot 31 is reserved */
|
||||
/* Slot 32 is reserved */
|
||||
/* Slot 33 is reserved */
|
||||
/* 34 */
|
||||
EXTERN int Tcl_GetDouble(Tcl_Interp *interp, const char *src,
|
||||
double *doublePtr);
|
||||
@@ -247,8 +246,7 @@ EXTERN void Tcl_CallWhenDeleted(Tcl_Interp *interp,
|
||||
/* 80 */
|
||||
EXTERN void Tcl_CancelIdleCall(Tcl_IdleProc *idleProc,
|
||||
void *clientData);
|
||||
/* 81 */
|
||||
EXTERN int Tcl_Close(Tcl_Interp *interp, Tcl_Channel chan);
|
||||
/* Slot 81 is reserved */
|
||||
/* 82 */
|
||||
EXTERN int Tcl_CommandComplete(const char *cmd);
|
||||
/* 83 */
|
||||
@@ -902,9 +900,13 @@ EXTERN Tcl_Size Tcl_WriteChars(Tcl_Channel chan, const char *src,
|
||||
/* 339 */
|
||||
EXTERN Tcl_Size Tcl_WriteObj(Tcl_Channel chan, Tcl_Obj *objPtr);
|
||||
/* 340 */
|
||||
EXTERN char * Tcl_GetString(Tcl_Obj *objPtr);
|
||||
/* Slot 341 is reserved */
|
||||
/* Slot 342 is reserved */
|
||||
EXTERN long long Tcl_GetMonotonicTime(void);
|
||||
/* 341 */
|
||||
EXTERN Tcl_TimerToken Tcl_CreateTimerHandlerMicroSeconds(
|
||||
long long microSeconds, Tcl_TimerProc *proc,
|
||||
void *clientData);
|
||||
/* 342 */
|
||||
EXTERN void Tcl_SleepMicroSeconds(long long microSeconds);
|
||||
/* 343 */
|
||||
EXTERN void Tcl_AlertNotifier(void *clientData);
|
||||
/* 344 */
|
||||
@@ -1036,7 +1038,7 @@ EXTERN void Tcl_MutexFinalize(Tcl_Mutex *mutex);
|
||||
/* 393 */
|
||||
EXTERN int Tcl_CreateThread(Tcl_ThreadId *idPtr,
|
||||
Tcl_ThreadCreateProc *proc, void *clientData,
|
||||
TCL_HASH_TYPE stackSize, int flags);
|
||||
size_t stackSize, int flags);
|
||||
/* 394 */
|
||||
EXTERN Tcl_Size Tcl_ReadRaw(Tcl_Channel chan, char *dst,
|
||||
Tcl_Size bytesToRead);
|
||||
@@ -1101,7 +1103,10 @@ EXTERN void Tcl_ClearChannelHandlers(Tcl_Channel channel);
|
||||
EXTERN int Tcl_IsChannelExisting(const char *channelName);
|
||||
/* Slot 419 is reserved */
|
||||
/* Slot 420 is reserved */
|
||||
/* Slot 421 is reserved */
|
||||
/* 421 */
|
||||
EXTERN Tcl_HashEntry * Tcl_DbCreateHashEntry(Tcl_HashTable *tablePtr,
|
||||
const void *key, int *newPtr,
|
||||
const char *file, int line);
|
||||
/* 422 */
|
||||
EXTERN Tcl_HashEntry * Tcl_CreateHashEntry(Tcl_HashTable *tablePtr,
|
||||
const void *key, int *newPtr);
|
||||
@@ -1124,14 +1129,14 @@ EXTERN void Tcl_UntraceCommand(Tcl_Interp *interp,
|
||||
const char *varName, int flags,
|
||||
Tcl_CommandTraceProc *proc, void *clientData);
|
||||
/* 428 */
|
||||
EXTERN void * Tcl_AttemptAlloc(TCL_HASH_TYPE size);
|
||||
EXTERN void * Tcl_AttemptAlloc(size_t size);
|
||||
/* 429 */
|
||||
EXTERN void * Tcl_AttemptDbCkalloc(TCL_HASH_TYPE size,
|
||||
const char *file, int line);
|
||||
EXTERN void * Tcl_AttemptDbCkalloc(size_t size, const char *file,
|
||||
int line);
|
||||
/* 430 */
|
||||
EXTERN void * Tcl_AttemptRealloc(void *ptr, TCL_HASH_TYPE size);
|
||||
EXTERN void * Tcl_AttemptRealloc(void *ptr, size_t size);
|
||||
/* 431 */
|
||||
EXTERN void * Tcl_AttemptDbCkrealloc(void *ptr, TCL_HASH_TYPE size,
|
||||
EXTERN void * Tcl_AttemptDbCkrealloc(void *ptr, size_t size,
|
||||
const char *file, int line);
|
||||
/* 432 */
|
||||
EXTERN int Tcl_AttemptSetObjLength(Tcl_Obj *objPtr,
|
||||
@@ -1713,7 +1718,7 @@ EXTERN int TclZipfs_MountBuffer(Tcl_Interp *interp,
|
||||
EXTERN void Tcl_FreeInternalRep(Tcl_Obj *objPtr);
|
||||
/* 637 */
|
||||
EXTERN char * Tcl_InitStringRep(Tcl_Obj *objPtr, const char *bytes,
|
||||
TCL_HASH_TYPE numBytes);
|
||||
size_t numBytes);
|
||||
/* 638 */
|
||||
EXTERN Tcl_ObjInternalRep * Tcl_FetchInternalRep(Tcl_Obj *objPtr,
|
||||
const Tcl_ObjType *typePtr);
|
||||
@@ -1876,6 +1881,47 @@ EXTERN Tcl_Obj * Tcl_NewWideUIntObj(Tcl_WideUInt wideValue);
|
||||
EXTERN void Tcl_SetWideUIntObj(Tcl_Obj *objPtr,
|
||||
Tcl_WideUInt uwideValue);
|
||||
/* 690 */
|
||||
EXTERN int Tcl_IsEmpty(Tcl_Obj *obj);
|
||||
/* 691 */
|
||||
EXTERN const char * Tcl_GetEncodingNameForUser(Tcl_DString *bufPtr);
|
||||
/* 692 */
|
||||
EXTERN int Tcl_ListObjReverse(Tcl_Interp *interp,
|
||||
Tcl_Obj *objPtr, Tcl_Obj **resultPtrPtr);
|
||||
/* 693 */
|
||||
EXTERN int Tcl_ListObjRepeat(Tcl_Interp *interp,
|
||||
Tcl_Size repeatCount, Tcl_Size objc,
|
||||
Tcl_Obj *const objv[],
|
||||
Tcl_Obj **resultPtrPtr);
|
||||
/* 694 */
|
||||
EXTERN int Tcl_ListObjRange(Tcl_Interp *interp, Tcl_Obj *objPtr,
|
||||
Tcl_Size start, Tcl_Size end,
|
||||
Tcl_Obj **resultPtrPtr);
|
||||
/* 695 */
|
||||
EXTERN int Tcl_UtfToNormalizedDString(Tcl_Interp *interp,
|
||||
const char *bytes, Tcl_Size length,
|
||||
Tcl_UnicodeNormalizationForm normForm,
|
||||
int profile, Tcl_DString *dsPtr);
|
||||
/* 696 */
|
||||
EXTERN int Tcl_UtfToNormalized(Tcl_Interp *interp,
|
||||
const char *bytes, Tcl_Size length,
|
||||
Tcl_UnicodeNormalizationForm normForm,
|
||||
int profile, char *bufPtr, Tcl_Size bufLen,
|
||||
Tcl_Size *lengthPtr);
|
||||
/* 697 */
|
||||
EXTERN int Tcl_ExternalToUtfEx(Tcl_Interp *interp,
|
||||
Tcl_Encoding encoding, const char *src,
|
||||
Tcl_Size srcLen, int flags,
|
||||
Tcl_EncodingState *statePtr, char *dst,
|
||||
Tcl_Size dstLen, Tcl_Size *srcReadPtr,
|
||||
Tcl_Size *dstWrotePtr, Tcl_Size *dstCharsPtr);
|
||||
/* 698 */
|
||||
EXTERN int Tcl_UtfToExternalEx(Tcl_Interp *interp,
|
||||
Tcl_Encoding encoding, const char *src,
|
||||
Tcl_Size srcLen, int flags,
|
||||
Tcl_EncodingState *statePtr, char *dst,
|
||||
Tcl_Size dstLen, Tcl_Size *srcReadPtr,
|
||||
Tcl_Size *dstWrotePtr, Tcl_Size *dstCharsPtr);
|
||||
/* 699 */
|
||||
EXTERN void TclUnusedStubEntry(void);
|
||||
|
||||
typedef struct {
|
||||
@@ -1891,12 +1937,12 @@ typedef struct TclStubs {
|
||||
int (*tcl_PkgProvideEx) (Tcl_Interp *interp, const char *name, const char *version, const void *clientData); /* 0 */
|
||||
const char * (*tcl_PkgRequireEx) (Tcl_Interp *interp, const char *name, const char *version, int exact, void *clientDataPtr); /* 1 */
|
||||
TCL_NORETURN1 void (*tcl_Panic) (const char *format, ...) TCL_FORMAT_PRINTF(1, 2); /* 2 */
|
||||
void * (*tcl_Alloc) (TCL_HASH_TYPE size); /* 3 */
|
||||
void * (*tcl_Alloc) (size_t size); /* 3 */
|
||||
void (*tcl_Free) (void *ptr); /* 4 */
|
||||
void * (*tcl_Realloc) (void *ptr, TCL_HASH_TYPE size); /* 5 */
|
||||
void * (*tcl_DbCkalloc) (TCL_HASH_TYPE size, const char *file, int line); /* 6 */
|
||||
void * (*tcl_Realloc) (void *ptr, size_t size); /* 5 */
|
||||
void * (*tcl_DbCkalloc) (size_t size, const char *file, int line); /* 6 */
|
||||
void (*tcl_DbCkfree) (void *ptr, const char *file, int line); /* 7 */
|
||||
void * (*tcl_DbCkrealloc) (void *ptr, TCL_HASH_TYPE size, const char *file, int line); /* 8 */
|
||||
void * (*tcl_DbCkrealloc) (void *ptr, size_t size, const char *file, int line); /* 8 */
|
||||
void (*tcl_CreateFileHandler) (int fd, int mask, Tcl_FileProc *proc, void *clientData); /* 9 */
|
||||
void (*tcl_DeleteFileHandler) (int fd); /* 10 */
|
||||
void (*tcl_SetTimer) (const Tcl_Time *timePtr); /* 11 */
|
||||
@@ -1919,9 +1965,9 @@ typedef struct TclStubs {
|
||||
Tcl_Obj * (*tcl_DbNewStringObj) (const char *bytes, Tcl_Size length, const char *file, int line); /* 28 */
|
||||
Tcl_Obj * (*tcl_DuplicateObj) (Tcl_Obj *objPtr); /* 29 */
|
||||
void (*tclFreeObj) (Tcl_Obj *objPtr); /* 30 */
|
||||
int (*tcl_GetBoolean) (Tcl_Interp *interp, const char *src, int *intPtr); /* 31 */
|
||||
int (*tcl_GetBooleanFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *intPtr); /* 32 */
|
||||
unsigned char * (*tcl_GetByteArrayFromObj) (Tcl_Obj *objPtr, Tcl_Size *numBytesPtr); /* 33 */
|
||||
void (*reserved31)(void);
|
||||
void (*reserved32)(void);
|
||||
void (*reserved33)(void);
|
||||
int (*tcl_GetDouble) (Tcl_Interp *interp, const char *src, double *doublePtr); /* 34 */
|
||||
int (*tcl_GetDoubleFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, double *doublePtr); /* 35 */
|
||||
void (*reserved36)(void);
|
||||
@@ -1969,7 +2015,7 @@ typedef struct TclStubs {
|
||||
int (*tcl_BadChannelOption) (Tcl_Interp *interp, const char *optionName, const char *optionList); /* 78 */
|
||||
void (*tcl_CallWhenDeleted) (Tcl_Interp *interp, Tcl_InterpDeleteProc *proc, void *clientData); /* 79 */
|
||||
void (*tcl_CancelIdleCall) (Tcl_IdleProc *idleProc, void *clientData); /* 80 */
|
||||
int (*tcl_Close) (Tcl_Interp *interp, Tcl_Channel chan); /* 81 */
|
||||
void (*reserved81)(void);
|
||||
int (*tcl_CommandComplete) (const char *cmd); /* 82 */
|
||||
char * (*tcl_Concat) (Tcl_Size argc, const char *const *argv); /* 83 */
|
||||
Tcl_Size (*tcl_ConvertElement) (const char *src, char *dst, int flags); /* 84 */
|
||||
@@ -2228,9 +2274,9 @@ typedef struct TclStubs {
|
||||
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 */
|
||||
void (*reserved341)(void);
|
||||
void (*reserved342)(void);
|
||||
long long (*tcl_GetMonotonicTime) (void); /* 340 */
|
||||
Tcl_TimerToken (*tcl_CreateTimerHandlerMicroSeconds) (long long microSeconds, Tcl_TimerProc *proc, void *clientData); /* 341 */
|
||||
void (*tcl_SleepMicroSeconds) (long long microSeconds); /* 342 */
|
||||
void (*tcl_AlertNotifier) (void *clientData); /* 343 */
|
||||
void (*tcl_ServiceModeHook) (int mode); /* 344 */
|
||||
int (*tcl_UniCharIsAlnum) (int ch); /* 345 */
|
||||
@@ -2281,7 +2327,7 @@ typedef struct TclStubs {
|
||||
int (*tcl_ProcObjCmd) (void *clientData, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); /* 390 */
|
||||
void (*tcl_ConditionFinalize) (Tcl_Condition *condPtr); /* 391 */
|
||||
void (*tcl_MutexFinalize) (Tcl_Mutex *mutex); /* 392 */
|
||||
int (*tcl_CreateThread) (Tcl_ThreadId *idPtr, Tcl_ThreadCreateProc *proc, void *clientData, TCL_HASH_TYPE stackSize, int flags); /* 393 */
|
||||
int (*tcl_CreateThread) (Tcl_ThreadId *idPtr, Tcl_ThreadCreateProc *proc, void *clientData, size_t stackSize, int flags); /* 393 */
|
||||
Tcl_Size (*tcl_ReadRaw) (Tcl_Channel chan, char *dst, Tcl_Size bytesToRead); /* 394 */
|
||||
Tcl_Size (*tcl_WriteRaw) (Tcl_Channel chan, const char *src, Tcl_Size srcLen); /* 395 */
|
||||
Tcl_Channel (*tcl_GetTopChannel) (Tcl_Channel chan); /* 396 */
|
||||
@@ -2309,17 +2355,17 @@ typedef struct TclStubs {
|
||||
int (*tcl_IsChannelExisting) (const char *channelName); /* 418 */
|
||||
void (*reserved419)(void);
|
||||
void (*reserved420)(void);
|
||||
void (*reserved421)(void);
|
||||
Tcl_HashEntry * (*tcl_DbCreateHashEntry) (Tcl_HashTable *tablePtr, const void *key, int *newPtr, const char *file, int line); /* 421 */
|
||||
Tcl_HashEntry * (*tcl_CreateHashEntry) (Tcl_HashTable *tablePtr, const void *key, int *newPtr); /* 422 */
|
||||
void (*tcl_InitCustomHashTable) (Tcl_HashTable *tablePtr, int keyType, const Tcl_HashKeyType *typePtr); /* 423 */
|
||||
void (*tcl_InitObjHashTable) (Tcl_HashTable *tablePtr); /* 424 */
|
||||
void * (*tcl_CommandTraceInfo) (Tcl_Interp *interp, const char *varName, int flags, Tcl_CommandTraceProc *procPtr, void *prevClientData); /* 425 */
|
||||
int (*tcl_TraceCommand) (Tcl_Interp *interp, const char *varName, int flags, Tcl_CommandTraceProc *proc, void *clientData); /* 426 */
|
||||
void (*tcl_UntraceCommand) (Tcl_Interp *interp, const char *varName, int flags, Tcl_CommandTraceProc *proc, void *clientData); /* 427 */
|
||||
void * (*tcl_AttemptAlloc) (TCL_HASH_TYPE size); /* 428 */
|
||||
void * (*tcl_AttemptDbCkalloc) (TCL_HASH_TYPE size, const char *file, int line); /* 429 */
|
||||
void * (*tcl_AttemptRealloc) (void *ptr, TCL_HASH_TYPE size); /* 430 */
|
||||
void * (*tcl_AttemptDbCkrealloc) (void *ptr, TCL_HASH_TYPE size, const char *file, int line); /* 431 */
|
||||
void * (*tcl_AttemptAlloc) (size_t size); /* 428 */
|
||||
void * (*tcl_AttemptDbCkalloc) (size_t size, const char *file, int line); /* 429 */
|
||||
void * (*tcl_AttemptRealloc) (void *ptr, size_t size); /* 430 */
|
||||
void * (*tcl_AttemptDbCkrealloc) (void *ptr, size_t size, const char *file, int line); /* 431 */
|
||||
int (*tcl_AttemptSetObjLength) (Tcl_Obj *objPtr, Tcl_Size length); /* 432 */
|
||||
Tcl_ThreadId (*tcl_GetChannelThread) (Tcl_Channel channel); /* 433 */
|
||||
Tcl_UniChar * (*tclGetUnicodeFromObj) (Tcl_Obj *objPtr, void *lengthPtr); /* 434 */
|
||||
@@ -2525,7 +2571,7 @@ typedef struct TclStubs {
|
||||
Tcl_Obj * (*tclZipfs_TclLibrary) (void); /* 634 */
|
||||
int (*tclZipfs_MountBuffer) (Tcl_Interp *interp, const void *data, size_t datalen, const char *mountPoint, int copy); /* 635 */
|
||||
void (*tcl_FreeInternalRep) (Tcl_Obj *objPtr); /* 636 */
|
||||
char * (*tcl_InitStringRep) (Tcl_Obj *objPtr, const char *bytes, TCL_HASH_TYPE numBytes); /* 637 */
|
||||
char * (*tcl_InitStringRep) (Tcl_Obj *objPtr, const char *bytes, size_t numBytes); /* 637 */
|
||||
Tcl_ObjInternalRep * (*tcl_FetchInternalRep) (Tcl_Obj *objPtr, const Tcl_ObjType *typePtr); /* 638 */
|
||||
void (*tcl_StoreInternalRep) (Tcl_Obj *objPtr, const Tcl_ObjType *typePtr, const Tcl_ObjInternalRep *irPtr); /* 639 */
|
||||
int (*tcl_HasStringRep) (Tcl_Obj *objPtr); /* 640 */
|
||||
@@ -2578,7 +2624,16 @@ typedef struct TclStubs {
|
||||
int (*tcl_UtfNcasecmp) (const char *s1, const char *s2, size_t n); /* 687 */
|
||||
Tcl_Obj * (*tcl_NewWideUIntObj) (Tcl_WideUInt wideValue); /* 688 */
|
||||
void (*tcl_SetWideUIntObj) (Tcl_Obj *objPtr, Tcl_WideUInt uwideValue); /* 689 */
|
||||
void (*tclUnusedStubEntry) (void); /* 690 */
|
||||
int (*tcl_IsEmpty) (Tcl_Obj *obj); /* 690 */
|
||||
const char * (*tcl_GetEncodingNameForUser) (Tcl_DString *bufPtr); /* 691 */
|
||||
int (*tcl_ListObjReverse) (Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_Obj **resultPtrPtr); /* 692 */
|
||||
int (*tcl_ListObjRepeat) (Tcl_Interp *interp, Tcl_Size repeatCount, Tcl_Size objc, Tcl_Obj *const objv[], Tcl_Obj **resultPtrPtr); /* 693 */
|
||||
int (*tcl_ListObjRange) (Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_Size start, Tcl_Size end, Tcl_Obj **resultPtrPtr); /* 694 */
|
||||
int (*tcl_UtfToNormalizedDString) (Tcl_Interp *interp, const char *bytes, Tcl_Size length, Tcl_UnicodeNormalizationForm normForm, int profile, Tcl_DString *dsPtr); /* 695 */
|
||||
int (*tcl_UtfToNormalized) (Tcl_Interp *interp, const char *bytes, Tcl_Size length, Tcl_UnicodeNormalizationForm normForm, int profile, char *bufPtr, Tcl_Size bufLen, Tcl_Size *lengthPtr); /* 696 */
|
||||
int (*tcl_ExternalToUtfEx) (Tcl_Interp *interp, Tcl_Encoding encoding, const char *src, Tcl_Size srcLen, int flags, Tcl_EncodingState *statePtr, char *dst, Tcl_Size dstLen, Tcl_Size *srcReadPtr, Tcl_Size *dstWrotePtr, Tcl_Size *dstCharsPtr); /* 697 */
|
||||
int (*tcl_UtfToExternalEx) (Tcl_Interp *interp, Tcl_Encoding encoding, const char *src, Tcl_Size srcLen, int flags, Tcl_EncodingState *statePtr, char *dst, Tcl_Size dstLen, Tcl_Size *srcReadPtr, Tcl_Size *dstWrotePtr, Tcl_Size *dstCharsPtr); /* 698 */
|
||||
void (*tclUnusedStubEntry) (void); /* 699 */
|
||||
} TclStubs;
|
||||
|
||||
extern const TclStubs *tclStubsPtr;
|
||||
@@ -2653,12 +2708,9 @@ extern const TclStubs *tclStubsPtr;
|
||||
(tclStubsPtr->tcl_DuplicateObj) /* 29 */
|
||||
#define TclFreeObj \
|
||||
(tclStubsPtr->tclFreeObj) /* 30 */
|
||||
#define Tcl_GetBoolean \
|
||||
(tclStubsPtr->tcl_GetBoolean) /* 31 */
|
||||
#define Tcl_GetBooleanFromObj \
|
||||
(tclStubsPtr->tcl_GetBooleanFromObj) /* 32 */
|
||||
#define Tcl_GetByteArrayFromObj \
|
||||
(tclStubsPtr->tcl_GetByteArrayFromObj) /* 33 */
|
||||
/* Slot 31 is reserved */
|
||||
/* Slot 32 is reserved */
|
||||
/* Slot 33 is reserved */
|
||||
#define Tcl_GetDouble \
|
||||
(tclStubsPtr->tcl_GetDouble) /* 34 */
|
||||
#define Tcl_GetDoubleFromObj \
|
||||
@@ -2742,8 +2794,7 @@ extern const TclStubs *tclStubsPtr;
|
||||
(tclStubsPtr->tcl_CallWhenDeleted) /* 79 */
|
||||
#define Tcl_CancelIdleCall \
|
||||
(tclStubsPtr->tcl_CancelIdleCall) /* 80 */
|
||||
#define Tcl_Close \
|
||||
(tclStubsPtr->tcl_Close) /* 81 */
|
||||
/* Slot 81 is reserved */
|
||||
#define Tcl_CommandComplete \
|
||||
(tclStubsPtr->tcl_CommandComplete) /* 82 */
|
||||
#define Tcl_Concat \
|
||||
@@ -3225,10 +3276,12 @@ extern const TclStubs *tclStubsPtr;
|
||||
(tclStubsPtr->tcl_WriteChars) /* 338 */
|
||||
#define Tcl_WriteObj \
|
||||
(tclStubsPtr->tcl_WriteObj) /* 339 */
|
||||
#define Tcl_GetString \
|
||||
(tclStubsPtr->tcl_GetString) /* 340 */
|
||||
/* Slot 341 is reserved */
|
||||
/* Slot 342 is reserved */
|
||||
#define Tcl_GetMonotonicTime \
|
||||
(tclStubsPtr->tcl_GetMonotonicTime) /* 340 */
|
||||
#define Tcl_CreateTimerHandlerMicroSeconds \
|
||||
(tclStubsPtr->tcl_CreateTimerHandlerMicroSeconds) /* 341 */
|
||||
#define Tcl_SleepMicroSeconds \
|
||||
(tclStubsPtr->tcl_SleepMicroSeconds) /* 342 */
|
||||
#define Tcl_AlertNotifier \
|
||||
(tclStubsPtr->tcl_AlertNotifier) /* 343 */
|
||||
#define Tcl_ServiceModeHook \
|
||||
@@ -3378,7 +3431,8 @@ extern const TclStubs *tclStubsPtr;
|
||||
(tclStubsPtr->tcl_IsChannelExisting) /* 418 */
|
||||
/* Slot 419 is reserved */
|
||||
/* Slot 420 is reserved */
|
||||
/* Slot 421 is reserved */
|
||||
#define Tcl_DbCreateHashEntry \
|
||||
(tclStubsPtr->tcl_DbCreateHashEntry) /* 421 */
|
||||
#define Tcl_CreateHashEntry \
|
||||
(tclStubsPtr->tcl_CreateHashEntry) /* 422 */
|
||||
#define Tcl_InitCustomHashTable \
|
||||
@@ -3912,8 +3966,26 @@ extern const TclStubs *tclStubsPtr;
|
||||
(tclStubsPtr->tcl_NewWideUIntObj) /* 688 */
|
||||
#define Tcl_SetWideUIntObj \
|
||||
(tclStubsPtr->tcl_SetWideUIntObj) /* 689 */
|
||||
#define Tcl_IsEmpty \
|
||||
(tclStubsPtr->tcl_IsEmpty) /* 690 */
|
||||
#define Tcl_GetEncodingNameForUser \
|
||||
(tclStubsPtr->tcl_GetEncodingNameForUser) /* 691 */
|
||||
#define Tcl_ListObjReverse \
|
||||
(tclStubsPtr->tcl_ListObjReverse) /* 692 */
|
||||
#define Tcl_ListObjRepeat \
|
||||
(tclStubsPtr->tcl_ListObjRepeat) /* 693 */
|
||||
#define Tcl_ListObjRange \
|
||||
(tclStubsPtr->tcl_ListObjRange) /* 694 */
|
||||
#define Tcl_UtfToNormalizedDString \
|
||||
(tclStubsPtr->tcl_UtfToNormalizedDString) /* 695 */
|
||||
#define Tcl_UtfToNormalized \
|
||||
(tclStubsPtr->tcl_UtfToNormalized) /* 696 */
|
||||
#define Tcl_ExternalToUtfEx \
|
||||
(tclStubsPtr->tcl_ExternalToUtfEx) /* 697 */
|
||||
#define Tcl_UtfToExternalEx \
|
||||
(tclStubsPtr->tcl_UtfToExternalEx) /* 698 */
|
||||
#define TclUnusedStubEntry \
|
||||
(tclStubsPtr->tclUnusedStubEntry) /* 690 */
|
||||
(tclStubsPtr->tclUnusedStubEntry) /* 699 */
|
||||
|
||||
#endif /* defined(USE_TCL_STUBS) */
|
||||
|
||||
@@ -3921,6 +3993,12 @@ extern const TclStubs *tclStubsPtr;
|
||||
|
||||
#undef TclUnusedStubEntry
|
||||
|
||||
#ifdef TCL_NO_DEPRECATED
|
||||
# undef Tcl_ObjCmdProc
|
||||
# undef Tcl_CmdTraceProc
|
||||
# undef Tcl_CmdObjTraceProc
|
||||
#endif /* TCL_NO_DEPRECATED */
|
||||
|
||||
#ifdef _WIN32
|
||||
# undef Tcl_CreateFileHandler
|
||||
# undef Tcl_DeleteFileHandler
|
||||
@@ -3983,23 +4061,6 @@ extern const TclStubs *tclStubsPtr;
|
||||
} while(0)
|
||||
|
||||
#if defined(USE_TCL_STUBS)
|
||||
# if defined(_WIN32) && defined(_WIN64) && TCL_MAJOR_VERSION < 9
|
||||
# undef Tcl_GetTime
|
||||
/* Handle Win64 tk.dll being loaded in Cygwin64 (only needed for Tcl 8). */
|
||||
# define Tcl_GetTime(t) \
|
||||
do { \
|
||||
struct { \
|
||||
Tcl_Time now; \
|
||||
long long reserved; \
|
||||
} _t; \
|
||||
_t.reserved = -1; \
|
||||
tclStubsPtr->tcl_GetTime((&_t.now)); \
|
||||
if (_t.reserved != -1) { \
|
||||
_t.now.usec = (long) _t.reserved; \
|
||||
} \
|
||||
*(t) = _t.now; \
|
||||
} while (0)
|
||||
# endif
|
||||
# if defined(__CYGWIN__) && defined(TCL_WIDE_INT_IS_LONG)
|
||||
/* On Cygwin64, long is 64-bit while on Win64 long is 32-bit. Therefore
|
||||
* we have to make sure that all stub entries on Cygwin64 follow the
|
||||
@@ -4029,18 +4090,11 @@ extern const TclStubs *tclStubsPtr;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#undef Tcl_GetString
|
||||
#undef Tcl_GetUnicode
|
||||
#undef Tcl_CreateHashEntry
|
||||
#define Tcl_GetString(objPtr) \
|
||||
Tcl_GetStringFromObj(objPtr, (Tcl_Size *)NULL)
|
||||
#define Tcl_GetUnicode(objPtr) \
|
||||
Tcl_GetUnicodeFromObj(objPtr, (Tcl_Size *)NULL)
|
||||
#undef Tcl_GetIndexFromObjStruct
|
||||
#if TCL_MAJOR_VERSION > 8
|
||||
# undef Tcl_GetBooleanFromObj
|
||||
# undef Tcl_GetBoolean
|
||||
#endif
|
||||
#if !defined(TCLBOOLWARNING)
|
||||
#if !defined(__cplusplus) && !defined(BUILD_tcl) && !defined(BUILD_tk) && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
|
||||
# define TCLBOOLWARNING(boolPtr) (void)(sizeof(struct {_Static_assert(sizeof(*(boolPtr)) <= sizeof(int), "sizeof(boolPtr) too large");int dummy;})),
|
||||
@@ -4055,26 +4109,22 @@ extern const TclStubs *tclStubsPtr;
|
||||
#define Tcl_GetIndexFromObjStruct(interp, objPtr, tablePtr, offset, msg, flags, indexPtr) \
|
||||
(tclStubsPtr->tcl_GetIndexFromObjStruct((interp), (objPtr), (tablePtr), (offset), (msg), \
|
||||
(flags)|(int)(sizeof(*(indexPtr))<<1), (indexPtr)))
|
||||
#if TCL_MAJOR_VERSION > 8
|
||||
#define Tcl_GetBooleanFromObj(interp, objPtr, boolPtr) \
|
||||
((sizeof(*(boolPtr)) <= sizeof(int)) ? Tcl_GetBoolFromObj(interp, objPtr, (TCL_NULL_OK-2)&(int)sizeof((*(boolPtr))), (char *)(boolPtr)) : \
|
||||
(TCLBOOLWARNING(boolPtr)Tcl_Panic("sizeof(%s) must be <= sizeof(int)", & #boolPtr [1]),TCL_ERROR))
|
||||
#define Tcl_GetBoolean(interp, src, boolPtr) \
|
||||
((sizeof(*(boolPtr)) <= sizeof(int)) ? Tcl_GetBool(interp, src, (TCL_NULL_OK-2)&(int)sizeof((*(boolPtr))), (char *)(boolPtr)) : \
|
||||
(TCLBOOLWARNING(boolPtr)Tcl_Panic("sizeof(%s) must be <= sizeof(int)", & #boolPtr [1]),TCL_ERROR))
|
||||
#endif
|
||||
#define Tcl_GetBooleanFromObj(interp, objPtr, boolPtr) ((sizeof(*(boolPtr)) <= sizeof(int)) \
|
||||
? Tcl_GetBoolFromObj(interp, objPtr, (TCL_NULL_OK-2)&(int)sizeof((*(boolPtr))), (char *)(boolPtr)) \
|
||||
: (TCLBOOLWARNING(boolPtr)Tcl_Panic("sizeof(%s) must be <= sizeof(int)", & #boolPtr [1]),TCL_ERROR))
|
||||
#define Tcl_GetBoolean(interp, src, boolPtr) ((sizeof(*(boolPtr)) <= sizeof(int)) \
|
||||
? Tcl_GetBool(interp, src, (TCL_NULL_OK-2)&(int)sizeof((*(boolPtr))), (char *)(boolPtr)) \
|
||||
: (TCLBOOLWARNING(boolPtr)Tcl_Panic("sizeof(%s) must be <= sizeof(int)", & #boolPtr [1]),TCL_ERROR))
|
||||
#else
|
||||
#define Tcl_GetIndexFromObjStruct(interp, objPtr, tablePtr, offset, msg, flags, indexPtr) \
|
||||
((Tcl_GetIndexFromObjStruct)((interp), (objPtr), (tablePtr), (offset), (msg), \
|
||||
(flags)|(int)(sizeof(*(indexPtr))<<1), (indexPtr)))
|
||||
#if TCL_MAJOR_VERSION > 8
|
||||
#define Tcl_GetBooleanFromObj(interp, objPtr, boolPtr) \
|
||||
((sizeof(*(boolPtr)) <= sizeof(int)) ? Tcl_GetBoolFromObj(interp, objPtr, (TCL_NULL_OK-2)&(int)sizeof((*(boolPtr))), (char *)(boolPtr)) : \
|
||||
(TCLBOOLWARNING(boolPtr)Tcl_Panic("sizeof(%s) must be <= sizeof(int)", & #boolPtr [1]),TCL_ERROR))
|
||||
#define Tcl_GetBoolean(interp, src, boolPtr) \
|
||||
((sizeof(*(boolPtr)) <= sizeof(int)) ? Tcl_GetBool(interp, src, (TCL_NULL_OK-2)&(int)sizeof((*(boolPtr))), (char *)(boolPtr)) : \
|
||||
(TCLBOOLWARNING(boolPtr)Tcl_Panic("sizeof(%s) must be <= sizeof(int)", & #boolPtr [1]),TCL_ERROR))
|
||||
#endif
|
||||
#define Tcl_GetBooleanFromObj(interp, objPtr, boolPtr) ((sizeof(*(boolPtr)) <= sizeof(int)) \
|
||||
? Tcl_GetBoolFromObj(interp, objPtr, (TCL_NULL_OK-2)&(int)sizeof((*(boolPtr))), (char *)(boolPtr)) \
|
||||
: (TCLBOOLWARNING(boolPtr)Tcl_Panic("sizeof(%s) must be <= sizeof(int)", & #boolPtr [1]),TCL_ERROR))
|
||||
#define Tcl_GetBoolean(interp, src, boolPtr) ((sizeof(*(boolPtr)) <= sizeof(int)) \
|
||||
? Tcl_GetBool(interp, src, (TCL_NULL_OK-2)&(int)sizeof((*(boolPtr))), (char *)(boolPtr)) \
|
||||
: (TCLBOOLWARNING(boolPtr)Tcl_Panic("sizeof(%s) must be <= sizeof(int)", & #boolPtr [1]),TCL_ERROR))
|
||||
#endif
|
||||
|
||||
#ifdef TCL_MEM_DEBUG
|
||||
@@ -4135,8 +4185,7 @@ extern const TclStubs *tclStubsPtr;
|
||||
# undef Tcl_UtfNcasecmp
|
||||
# define Tcl_UtfNcasecmp TclUtfNcasecmp
|
||||
#endif
|
||||
#if TCL_MAJOR_VERSION > 8
|
||||
# if defined(USE_TCL_STUBS)
|
||||
#if defined(USE_TCL_STUBS)
|
||||
# define Tcl_WCharToUtfDString (sizeof(wchar_t) != sizeof(short) \
|
||||
? (char *(*)(const wchar_t *, Tcl_Size, Tcl_DString *))tclStubsPtr->tcl_UniCharToUtfDString \
|
||||
: (char *(*)(const wchar_t *, Tcl_Size, Tcl_DString *))Tcl_Char16ToUtfDString)
|
||||
@@ -4149,7 +4198,7 @@ extern const TclStubs *tclStubsPtr;
|
||||
# define Tcl_WCharLen (sizeof(wchar_t) != sizeof(short) \
|
||||
? (Tcl_Size (*)(wchar_t *))tclStubsPtr->tcl_UniCharLen \
|
||||
: (Tcl_Size (*)(wchar_t *))Tcl_Char16Len)
|
||||
# else
|
||||
#else
|
||||
# define Tcl_WCharToUtfDString (sizeof(wchar_t) != sizeof(short) \
|
||||
? (char *(*)(const wchar_t *, Tcl_Size, Tcl_DString *))Tcl_UniCharToUtfDString \
|
||||
: (char *(*)(const wchar_t *, Tcl_Size, Tcl_DString *))Tcl_Char16ToUtfDString)
|
||||
@@ -4162,7 +4211,6 @@ extern const TclStubs *tclStubsPtr;
|
||||
# define Tcl_WCharLen (sizeof(wchar_t) != sizeof(short) \
|
||||
? (Tcl_Size (*)(wchar_t *))Tcl_UniCharLen \
|
||||
: (Tcl_Size (*)(wchar_t *))Tcl_Char16Len)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -4173,16 +4221,18 @@ extern const TclStubs *tclStubsPtr;
|
||||
Tcl_EvalObjEx(interp, objPtr, 0)
|
||||
#define Tcl_GlobalEvalObj(interp, objPtr) \
|
||||
Tcl_EvalObjEx(interp, objPtr, TCL_EVAL_GLOBAL)
|
||||
|
||||
#if TCL_MAJOR_VERSION > 8
|
||||
# undef Tcl_Close
|
||||
# define Tcl_Close(interp, chan) Tcl_CloseEx(interp, chan, 0)
|
||||
#endif
|
||||
#define Tcl_Close(interp, chan) Tcl_CloseEx(interp, chan, 0)
|
||||
|
||||
#undef TclUtfCharComplete
|
||||
#undef TclUtfNext
|
||||
#undef TclUtfPrev
|
||||
#ifndef TCL_NO_DEPRECATED
|
||||
#ifdef TCL_NO_DEPRECATED
|
||||
# undef Tcl_CreateObjCommand
|
||||
# undef Tcl_CreateTrace
|
||||
# undef Tcl_CreateObjTrace
|
||||
# undef Tcl_NRCallObjProc
|
||||
# undef Tcl_NRCreateCommand
|
||||
#else
|
||||
# define Tcl_CreateSlave Tcl_CreateChild
|
||||
# define Tcl_GetSlave Tcl_GetChild
|
||||
# define Tcl_GetMaster Tcl_GetParent
|
||||
@@ -4201,81 +4251,7 @@ extern const TclStubs *tclStubsPtr;
|
||||
#undef TclParseArgsObjv
|
||||
#undef TclGetAliasObj
|
||||
|
||||
#if TCL_MAJOR_VERSION < 9
|
||||
/* TIP #627 */
|
||||
# undef Tcl_CreateObjCommand2
|
||||
# define Tcl_CreateObjCommand2 Tcl_CreateObjCommand
|
||||
# undef Tcl_CreateObjTrace2
|
||||
# define Tcl_CreateObjTrace2 Tcl_CreateObjTrace
|
||||
# undef Tcl_NRCreateCommand2
|
||||
# define Tcl_NRCreateCommand2 Tcl_NRCreateCommand
|
||||
# undef Tcl_NRCallObjProc2
|
||||
# define Tcl_NRCallObjProc2 Tcl_NRCallObjProc
|
||||
/* TIP #660 */
|
||||
# undef Tcl_GetSizeIntFromObj
|
||||
# define Tcl_GetSizeIntFromObj Tcl_GetIntFromObj
|
||||
|
||||
# undef Tcl_GetBytesFromObj
|
||||
# define Tcl_GetBytesFromObj(interp, objPtr, sizePtr) \
|
||||
tclStubsPtr->tclGetBytesFromObj((interp), (objPtr), (sizePtr))
|
||||
# undef Tcl_GetStringFromObj
|
||||
# define Tcl_GetStringFromObj(objPtr, sizePtr) \
|
||||
tclStubsPtr->tclGetStringFromObj((objPtr), (sizePtr))
|
||||
# undef Tcl_GetUnicodeFromObj
|
||||
# define Tcl_GetUnicodeFromObj(objPtr, sizePtr) \
|
||||
tclStubsPtr->tclGetUnicodeFromObj((objPtr), (sizePtr))
|
||||
# undef Tcl_ListObjGetElements
|
||||
# define Tcl_ListObjGetElements(interp, listPtr, objcPtr, objvPtr) \
|
||||
tclStubsPtr->tclListObjGetElements((interp), (listPtr), (objcPtr), (objvPtr))
|
||||
# undef Tcl_ListObjLength
|
||||
# define Tcl_ListObjLength(interp, listPtr, lengthPtr) \
|
||||
tclStubsPtr->tclListObjLength((interp), (listPtr), (lengthPtr))
|
||||
# undef Tcl_DictObjSize
|
||||
# define Tcl_DictObjSize(interp, dictPtr, sizePtr) \
|
||||
tclStubsPtr->tclDictObjSize((interp), (dictPtr), (sizePtr))
|
||||
# undef Tcl_SplitList
|
||||
# define Tcl_SplitList(interp, listStr, argcPtr, argvPtr) \
|
||||
tclStubsPtr->tclSplitList((interp), (listStr), (argcPtr), (argvPtr))
|
||||
# undef Tcl_SplitPath
|
||||
# define Tcl_SplitPath(path, argcPtr, argvPtr) \
|
||||
tclStubsPtr->tclSplitPath((path), (argcPtr), (argvPtr))
|
||||
# undef Tcl_FSSplitPath
|
||||
# define Tcl_FSSplitPath(pathPtr, lenPtr) \
|
||||
tclStubsPtr->tclFSSplitPath((pathPtr), (lenPtr))
|
||||
# undef Tcl_ParseArgsObjv
|
||||
# define Tcl_ParseArgsObjv(interp, argTable, objcPtr, objv, remObjv) \
|
||||
tclStubsPtr->tclParseArgsObjv((interp), (argTable), (objcPtr), (objv), (remObjv))
|
||||
# undef Tcl_GetAliasObj
|
||||
# define Tcl_GetAliasObj(interp, childCmd, targetInterpPtr, targetCmdPtr, objcPtr, objv) \
|
||||
tclStubsPtr->tclGetAliasObj((interp), (childCmd), (targetInterpPtr), (targetCmdPtr), (objcPtr), (objv))
|
||||
# undef Tcl_OpenTcpServerEx
|
||||
# undef TclZipfs_Mount
|
||||
# undef TclZipfs_Unmount
|
||||
# undef TclZipfs_TclLibrary
|
||||
# undef TclZipfs_MountBuffer
|
||||
# undef Tcl_FreeInternalRep
|
||||
# undef Tcl_InitStringRep
|
||||
# undef Tcl_FetchInternalRep
|
||||
# undef Tcl_StoreInternalRep
|
||||
# undef Tcl_HasStringRep
|
||||
# undef Tcl_LinkArray
|
||||
# undef Tcl_GetIntForIndex
|
||||
# undef Tcl_FSTildeExpand
|
||||
# undef Tcl_ExternalToUtfDStringEx
|
||||
# undef Tcl_UtfToExternalDStringEx
|
||||
# undef Tcl_AsyncMarkFromSignal
|
||||
# undef Tcl_GetBool
|
||||
# undef Tcl_GetBoolFromObj
|
||||
# undef Tcl_GetNumberFromObj
|
||||
# undef Tcl_GetNumber
|
||||
# undef Tcl_RemoveChannelMode
|
||||
# undef Tcl_GetEncodingNulLength
|
||||
# undef Tcl_GetWideUIntFromObj
|
||||
# undef Tcl_DStringToObj
|
||||
# undef Tcl_NewWideUIntObj
|
||||
# undef Tcl_SetWideUIntObj
|
||||
#elif defined(TCL_8_API)
|
||||
# undef Tcl_GetByteArrayFromObj
|
||||
#if defined(TCL_8_API)
|
||||
# undef Tcl_GetBytesFromObj
|
||||
# undef Tcl_GetStringFromObj
|
||||
# undef Tcl_GetUnicodeFromObj
|
||||
@@ -4288,9 +4264,6 @@ extern const TclStubs *tclStubsPtr;
|
||||
# undef Tcl_ParseArgsObjv
|
||||
# undef Tcl_GetAliasObj
|
||||
# if !defined(USE_TCL_STUBS)
|
||||
# define Tcl_GetByteArrayFromObj(objPtr, sizePtr) (sizeof(*(sizePtr)) <= sizeof(int) ? \
|
||||
TclGetBytesFromObj(NULL, (objPtr), (sizePtr)) : \
|
||||
(Tcl_GetBytesFromObj)(NULL, (objPtr), (Tcl_Size *)(void *)(sizePtr)))
|
||||
# define Tcl_GetBytesFromObj(interp, objPtr, sizePtr) (sizeof(*(sizePtr)) <= sizeof(int) ? \
|
||||
TclGetBytesFromObj((interp), (objPtr), (sizePtr)) : \
|
||||
(Tcl_GetBytesFromObj)((interp), (objPtr), (Tcl_Size *)(void *)(sizePtr)))
|
||||
@@ -4325,9 +4298,6 @@ extern const TclStubs *tclStubsPtr;
|
||||
TclGetAliasObj((interp), (childCmd), (targetInterpPtr), (targetCmdPtr), (objcPtr), (objv)) : \
|
||||
(Tcl_GetAliasObj)((interp), (childCmd), (targetInterpPtr), (targetCmdPtr), (Tcl_Size *)(void *)(objcPtr), (objv)))
|
||||
# elif !defined(BUILD_tcl)
|
||||
# define Tcl_GetByteArrayFromObj(objPtr, sizePtr) (sizeof(*(sizePtr)) <= sizeof(int) ? \
|
||||
tclStubsPtr->tclGetBytesFromObj(NULL, (objPtr), (sizePtr)) : \
|
||||
tclStubsPtr->tcl_GetBytesFromObj(NULL, (objPtr), (Tcl_Size *)(void *)(sizePtr)))
|
||||
# define Tcl_GetBytesFromObj(interp, objPtr, sizePtr) (sizeof(*(sizePtr)) <= sizeof(int) ? \
|
||||
tclStubsPtr->tclGetBytesFromObj((interp), (objPtr), (sizePtr)) : \
|
||||
tclStubsPtr->tcl_GetBytesFromObj((interp), (objPtr), (Tcl_Size *)(void *)(sizePtr)))
|
||||
@@ -4362,10 +4332,53 @@ extern const TclStubs *tclStubsPtr;
|
||||
tclStubsPtr->tclGetAliasObj((interp), (childCmd), (targetInterpPtr), (targetCmdPtr), (objcPtr), (objv)) : \
|
||||
tclStubsPtr->tcl_GetAliasObj((interp), (childCmd), (targetInterpPtr), (targetCmdPtr), (Tcl_Size *)(void *)(objcPtr), (objv)))
|
||||
# endif /* defined(USE_TCL_STUBS) */
|
||||
#else /* !defined(TCL_8_API) */
|
||||
# undef Tcl_GetByteArrayFromObj
|
||||
# define Tcl_GetByteArrayFromObj(objPtr, sizePtr) \
|
||||
Tcl_GetBytesFromObj(NULL, (objPtr), (sizePtr))
|
||||
#endif /* defined(TCL_8_API) */
|
||||
#define Tcl_GetByteArrayFromObj(objPtr, sizePtr) \
|
||||
Tcl_GetBytesFromObj(NULL, (objPtr), (sizePtr))
|
||||
|
||||
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
|
||||
/* Select method based on type of argument. */
|
||||
#define TclProc2Generic(typePtr, impl) \
|
||||
_Generic(typePtr, Tcl_ObjCmdProc2 *: impl ## 2, default: impl)
|
||||
#define TclTraceProc2Generic(typePtr, impl) \
|
||||
_Generic(typePtr, Tcl_CmdObjTraceProc2 *: impl ## 2, default: impl)
|
||||
|
||||
#ifdef USE_TCL_STUBS
|
||||
|
||||
#undef Tcl_CreateObjCommand
|
||||
#define Tcl_CreateObjCommand(interp, cmdName, typePtr, clientData, deleteProc) \
|
||||
(TclProc2Generic((typePtr), tclStubsPtr->tcl_CreateObjCommand) \
|
||||
((interp), (cmdName), (typePtr), (clientData), (deleteProc)))
|
||||
#undef Tcl_CreateObjTrace
|
||||
#define Tcl_CreateObjTrace(interp, level, flags, typePtr, clientData, deleteProc) \
|
||||
(TclTraceProc2Generic((typePtr), tclStubsPtr->tcl_CreateObjTrace) \
|
||||
((interp), (level), (flags), (typePtr), (clientData), (deleteProc)))
|
||||
#undef Tcl_NRCreateCommand
|
||||
#define Tcl_NRCreateCommand(interp, cmdName, typePtr, nreProc, clientData, deleteProc) \
|
||||
(TclProc2Generic((typePtr), tclStubsPtr->tcl_NRCreateCommand) \
|
||||
((interp), (cmdName), (typePtr), (nreProc), (clientData), (deleteProc)))
|
||||
#undef Tcl_NRCallObjProc
|
||||
#define Tcl_NRCallObjProc(interp, typePtr, clientData, objc, objv) \
|
||||
(TclProc2Generic((typePtr), tclStubsPtr->tcl_NRCallObjProc) \
|
||||
((interp), (typePtr), (clientData), (objc), (objv)))
|
||||
#else
|
||||
#define Tcl_CreateObjCommand(interp, cmdName, typePtr, clientData, deleteProc) \
|
||||
(TclProc2Generic((typePtr), Tcl_CreateObjCommand) \
|
||||
((interp), (cmdName), (typePtr), (clientData), (deleteProc)))
|
||||
#define Tcl_CreateObjTrace(interp, level, flags, typePtr, clientData, deleteProc) \
|
||||
(TclTraceProc2Generic((typePtr), Tcl_CreateObjTrace) \
|
||||
((interp), (level), (flags), (typePtr), (clientData), (deleteProc)))
|
||||
#define Tcl_NRCreateCommand(interp, cmdName, typePtr, nreProc, clientData, deleteProc) \
|
||||
(TclProc2Generic((typePtr), Tcl_NRCreateCommand) \
|
||||
((interp), (cmdName), (typePtr), (nreProc), (clientData), (deleteProc)))
|
||||
#define Tcl_NRCallObjProc(interp, typePtr, clientData, objc, objv) \
|
||||
(TclProc2Generic((typePtr), Tcl_NRCallObjProc) \
|
||||
((interp), (typePtr), (clientData), (objc), (objv)))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if TCL_MINOR_VERSION < 1
|
||||
# undef Tcl_IsEmpty
|
||||
#endif
|
||||
|
||||
#endif /* _TCLDECLS */
|
||||
|
||||
+75
-98
@@ -23,25 +23,25 @@ struct Dict;
|
||||
*/
|
||||
|
||||
static void DeleteDict(struct Dict *dict);
|
||||
static Tcl_ObjCmdProc DictAppendCmd;
|
||||
static Tcl_ObjCmdProc DictCreateCmd;
|
||||
static Tcl_ObjCmdProc DictExistsCmd;
|
||||
static Tcl_ObjCmdProc DictFilterCmd;
|
||||
static Tcl_ObjCmdProc DictGetCmd;
|
||||
static Tcl_ObjCmdProc DictGetDefCmd;
|
||||
static Tcl_ObjCmdProc DictIncrCmd;
|
||||
static Tcl_ObjCmdProc DictInfoCmd;
|
||||
static Tcl_ObjCmdProc DictKeysCmd;
|
||||
static Tcl_ObjCmdProc DictLappendCmd;
|
||||
static Tcl_ObjCmdProc DictMergeCmd;
|
||||
static Tcl_ObjCmdProc DictRemoveCmd;
|
||||
static Tcl_ObjCmdProc DictReplaceCmd;
|
||||
static Tcl_ObjCmdProc DictSetCmd;
|
||||
static Tcl_ObjCmdProc DictSizeCmd;
|
||||
static Tcl_ObjCmdProc DictUnsetCmd;
|
||||
static Tcl_ObjCmdProc DictUpdateCmd;
|
||||
static Tcl_ObjCmdProc DictValuesCmd;
|
||||
static Tcl_ObjCmdProc DictWithCmd;
|
||||
static Tcl_ObjCmdProc2 DictAppendCmd;
|
||||
static Tcl_ObjCmdProc2 DictCreateCmd;
|
||||
static Tcl_ObjCmdProc2 DictExistsCmd;
|
||||
static Tcl_ObjCmdProc2 DictFilterCmd;
|
||||
static Tcl_ObjCmdProc2 DictGetCmd;
|
||||
static Tcl_ObjCmdProc2 DictGetDefCmd;
|
||||
static Tcl_ObjCmdProc2 DictIncrCmd;
|
||||
static Tcl_ObjCmdProc2 DictInfoCmd;
|
||||
static Tcl_ObjCmdProc2 DictKeysCmd;
|
||||
static Tcl_ObjCmdProc2 DictLappendCmd;
|
||||
static Tcl_ObjCmdProc2 DictMergeCmd;
|
||||
static Tcl_ObjCmdProc2 DictRemoveCmd;
|
||||
static Tcl_ObjCmdProc2 DictReplaceCmd;
|
||||
static Tcl_ObjCmdProc2 DictSetCmd;
|
||||
static Tcl_ObjCmdProc2 DictSizeCmd;
|
||||
static Tcl_ObjCmdProc2 DictUnsetCmd;
|
||||
static Tcl_ObjCmdProc2 DictUpdateCmd;
|
||||
static Tcl_ObjCmdProc2 DictValuesCmd;
|
||||
static Tcl_ObjCmdProc2 DictWithCmd;
|
||||
static Tcl_DupInternalRepProc DupDictInternalRep;
|
||||
static Tcl_FreeInternalRepProc FreeDictInternalRep;
|
||||
static void InvalidateDictChain(Tcl_Obj *dictObj);
|
||||
@@ -56,8 +56,8 @@ static inline int DeleteChainEntry(struct Dict *dict,
|
||||
Tcl_Obj *keyPtr);
|
||||
static Tcl_NRPostProc FinalizeDictUpdate;
|
||||
static Tcl_NRPostProc FinalizeDictWith;
|
||||
static Tcl_ObjCmdProc DictForNRCmd;
|
||||
static Tcl_ObjCmdProc DictMapNRCmd;
|
||||
static Tcl_ObjCmdProc2 DictForNRCmd;
|
||||
static Tcl_ObjCmdProc2 DictMapNRCmd;
|
||||
static Tcl_NRPostProc DictForLoopCallback;
|
||||
static Tcl_NRPostProc DictMapLoopCallback;
|
||||
|
||||
@@ -65,7 +65,7 @@ static Tcl_NRPostProc DictMapLoopCallback;
|
||||
* Table of dict subcommand names and implementations.
|
||||
*/
|
||||
|
||||
static const EnsembleImplMap implementationMap[] = {
|
||||
const EnsembleImplMap tclDictImplMap[] = {
|
||||
{"append", DictAppendCmd, TclCompileDictAppendCmd, NULL, NULL, 0 },
|
||||
{"create", DictCreateCmd, TclCompileDictCreateCmd, NULL, NULL, 0 },
|
||||
{"exists", DictExistsCmd, TclCompileDictExistsCmd, NULL, NULL, 0 },
|
||||
@@ -81,8 +81,8 @@ static const EnsembleImplMap implementationMap[] = {
|
||||
{"lappend", DictLappendCmd, TclCompileDictLappendCmd, NULL, NULL, 0 },
|
||||
{"map", NULL, TclCompileDictMapCmd, DictMapNRCmd, NULL, 0 },
|
||||
{"merge", DictMergeCmd, TclCompileDictMergeCmd, NULL, NULL, 0 },
|
||||
{"remove", DictRemoveCmd, TclCompileBasicMin1ArgCmd, NULL, NULL, 0 },
|
||||
{"replace", DictReplaceCmd, NULL, NULL, NULL, 0 },
|
||||
{"remove", DictRemoveCmd, TclCompileDictRemoveCmd, NULL, NULL, 0 },
|
||||
{"replace", DictReplaceCmd, TclCompileDictReplaceCmd, NULL, NULL, 0 },
|
||||
{"set", DictSetCmd, TclCompileDictSetCmd, NULL, NULL, 0 },
|
||||
{"size", DictSizeCmd, TclCompileBasic1ArgCmd, NULL, NULL, 0 },
|
||||
{"unset", DictUnsetCmd, TclCompileDictUnsetCmd, NULL, NULL, 0 },
|
||||
@@ -142,23 +142,23 @@ typedef struct Dict {
|
||||
|
||||
const Tcl_ObjType tclDictType = {
|
||||
"dict",
|
||||
FreeDictInternalRep, /* freeIntRepProc */
|
||||
DupDictInternalRep, /* dupIntRepProc */
|
||||
UpdateStringOfDict, /* updateStringProc */
|
||||
SetDictFromAny, /* setFromAnyProc */
|
||||
FreeDictInternalRep,
|
||||
DupDictInternalRep,
|
||||
UpdateStringOfDict,
|
||||
SetDictFromAny,
|
||||
TCL_OBJTYPE_V0
|
||||
};
|
||||
|
||||
#define DictSetInternalRep(objPtr, dictRepPtr) \
|
||||
do { \
|
||||
#define DictSetInternalRep(objPtr, dictRepPtr) \
|
||||
do { \
|
||||
Tcl_ObjInternalRep ir; \
|
||||
ir.twoPtrValue.ptr1 = (dictRepPtr); \
|
||||
ir.twoPtrValue.ptr2 = NULL; \
|
||||
ir.twoPtrValue.ptr1 = (dictRepPtr); \
|
||||
ir.twoPtrValue.ptr2 = NULL; \
|
||||
Tcl_StoreInternalRep((objPtr), &tclDictType, &ir); \
|
||||
} while (0)
|
||||
|
||||
#define DictGetInternalRep(objPtr, dictRepPtr) \
|
||||
do { \
|
||||
#define DictGetInternalRep(objPtr, dictRepPtr) \
|
||||
do { \
|
||||
const Tcl_ObjInternalRep *irPtr; \
|
||||
irPtr = TclFetchInternalRep((objPtr), &tclDictType); \
|
||||
(dictRepPtr) = irPtr ? (Dict *)irPtr->twoPtrValue.ptr1 : NULL; \
|
||||
@@ -176,7 +176,7 @@ const Tcl_ObjType tclDictType = {
|
||||
|
||||
static const Tcl_HashKeyType chainHashType = {
|
||||
TCL_HASH_KEY_TYPE_VERSION,
|
||||
TCL_HASH_KEY_DIRECT_COMPARE, /* allows compare keys by pointers */
|
||||
TCL_HASH_KEY_DIRECT_COMPARE, /* allows compare keys by pointers */
|
||||
TclHashObjKey,
|
||||
TclCompareObjKeys,
|
||||
AllocChainEntry,
|
||||
@@ -545,7 +545,9 @@ UpdateStringOfDict(
|
||||
dst = Tcl_InitStringRep(dictPtr, NULL, bytesNeeded - 1);
|
||||
TclOOM(dst, bytesNeeded);
|
||||
for (i=0,cPtr=dict->entryChainHead; i<numElems; i+=2,cPtr=cPtr->nextPtr) {
|
||||
flagPtr[i] |= ( i ? TCL_DONT_QUOTE_HASH : 0 );
|
||||
if (i) {
|
||||
flagPtr[i] |= TCL_DONT_QUOTE_HASH;
|
||||
}
|
||||
keyPtr = (Tcl_Obj *)Tcl_GetHashKey(&dict->table, &cPtr->entry);
|
||||
elem = TclGetStringFromObj(keyPtr, &length);
|
||||
dst += TclConvertElement(elem, length, dst, flagPtr[i]);
|
||||
@@ -1264,7 +1266,7 @@ Tcl_DictObjNext(
|
||||
|
||||
void
|
||||
Tcl_DictObjDone(
|
||||
Tcl_DictSearch *searchPtr) /* Pointer to a hash search context. */
|
||||
Tcl_DictSearch *searchPtr) /* Pointer to a hash search context. */
|
||||
{
|
||||
Dict *dict;
|
||||
|
||||
@@ -1469,7 +1471,7 @@ Tcl_DbNewDictObj(
|
||||
|
||||
TclDbNewObj(dictPtr, file, line);
|
||||
TclInvalidateStringRep(dictPtr);
|
||||
dict = (Dict *)Tcl_Alloc(sizeof(Dict));
|
||||
dict = (Dict *)Tcl_DbCkalloc(sizeof(Dict), file, line);
|
||||
InitChainTable(dict);
|
||||
dict->epoch = 1;
|
||||
dict->chain = NULL;
|
||||
@@ -1658,11 +1660,11 @@ static int
|
||||
DictCreateCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const *objv)
|
||||
{
|
||||
Tcl_Obj *dictObj;
|
||||
int i;
|
||||
Tcl_Size i;
|
||||
|
||||
/*
|
||||
* Must have an even number of arguments; note that number of preceding
|
||||
@@ -1708,7 +1710,7 @@ static int
|
||||
DictGetCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const *objv)
|
||||
{
|
||||
Tcl_Obj *dictPtr, *valuePtr = NULL;
|
||||
@@ -1801,12 +1803,12 @@ static int
|
||||
DictGetDefCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const *objv)
|
||||
{
|
||||
Tcl_Obj *dictPtr, *keyPtr, *valuePtr, *defaultPtr;
|
||||
Tcl_Obj *const *keyPath;
|
||||
int numKeys;
|
||||
Tcl_Size numKeys;
|
||||
|
||||
if (objc < 4) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "dictionary ?key ...? key default");
|
||||
@@ -1866,11 +1868,11 @@ static int
|
||||
DictReplaceCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const *objv)
|
||||
{
|
||||
Tcl_Obj *dictPtr;
|
||||
int i;
|
||||
Tcl_Size i;
|
||||
|
||||
if ((objc < 2) || (objc & 1)) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "dictionary ?key value ...?");
|
||||
@@ -1914,11 +1916,11 @@ static int
|
||||
DictRemoveCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const *objv)
|
||||
{
|
||||
Tcl_Obj *dictPtr;
|
||||
int i;
|
||||
Tcl_Size i;
|
||||
|
||||
if (objc < 2) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "dictionary ?key ...?");
|
||||
@@ -1962,12 +1964,12 @@ static int
|
||||
DictMergeCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const *objv)
|
||||
{
|
||||
Tcl_Obj *targetObj, *keyObj = NULL, *valueObj = NULL;
|
||||
int allocatedDict = 0;
|
||||
int i, done;
|
||||
int done, allocatedDict = 0;
|
||||
Tcl_Size i;
|
||||
Tcl_DictSearch search;
|
||||
|
||||
if (objc == 1) {
|
||||
@@ -2049,7 +2051,7 @@ static int
|
||||
DictKeysCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const *objv)
|
||||
{
|
||||
Tcl_Obj *listPtr;
|
||||
@@ -2128,7 +2130,7 @@ static int
|
||||
DictValuesCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const *objv)
|
||||
{
|
||||
Tcl_Obj *valuePtr = NULL, *listPtr;
|
||||
@@ -2188,7 +2190,7 @@ static int
|
||||
DictSizeCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const *objv)
|
||||
{
|
||||
int result;
|
||||
@@ -2281,7 +2283,7 @@ static int
|
||||
DictExistsCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const *objv)
|
||||
{
|
||||
Tcl_Obj *dictPtr, *valuePtr;
|
||||
@@ -2323,7 +2325,7 @@ static int
|
||||
DictInfoCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const *objv)
|
||||
{
|
||||
Dict *dict;
|
||||
@@ -2367,7 +2369,7 @@ static int
|
||||
DictIncrCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const *objv)
|
||||
{
|
||||
int code = TCL_OK;
|
||||
@@ -2488,11 +2490,12 @@ static int
|
||||
DictLappendCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const *objv)
|
||||
{
|
||||
Tcl_Obj *dictPtr, *valuePtr, *resultPtr;
|
||||
int i, allocatedDict = 0, allocatedValue = 0;
|
||||
int allocatedDict = 0, allocatedValue = 0;
|
||||
Tcl_Size i;
|
||||
|
||||
if (objc < 3) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "dictVarName key ?value ...?");
|
||||
@@ -2575,7 +2578,7 @@ static int
|
||||
DictAppendCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const *objv)
|
||||
{
|
||||
Tcl_Obj *dictPtr, *valuePtr, *resultPtr;
|
||||
@@ -2677,7 +2680,7 @@ static int
|
||||
DictForNRCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const *objv)
|
||||
{
|
||||
Interp *iPtr = (Interp *) interp;
|
||||
@@ -2873,7 +2876,7 @@ static int
|
||||
DictMapNRCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const *objv)
|
||||
{
|
||||
Interp *iPtr = (Interp *) interp;
|
||||
@@ -3086,7 +3089,7 @@ static int
|
||||
DictSetCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const *objv)
|
||||
{
|
||||
Tcl_Obj *dictPtr, *resultPtr;
|
||||
@@ -3146,7 +3149,7 @@ static int
|
||||
DictUnsetCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const *objv)
|
||||
{
|
||||
Tcl_Obj *dictPtr, *resultPtr;
|
||||
@@ -3205,7 +3208,7 @@ static int
|
||||
DictFilterCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const *objv)
|
||||
{
|
||||
Interp *iPtr = (Interp *) interp;
|
||||
@@ -3227,7 +3230,7 @@ DictFilterCmd(
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (Tcl_GetIndexFromObj(interp, objv[2], filters, "filterType",
|
||||
0, &index) != TCL_OK) {
|
||||
0, &index) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
@@ -3279,7 +3282,7 @@ DictFilterCmd(
|
||||
|
||||
resultObj = Tcl_NewDictObj();
|
||||
while (!done) {
|
||||
int i;
|
||||
Tcl_Size i;
|
||||
|
||||
for (i=3 ; i<objc ; i++) {
|
||||
pattern = TclGetString(objv[i]);
|
||||
@@ -3305,7 +3308,7 @@ DictFilterCmd(
|
||||
}
|
||||
resultObj = Tcl_NewDictObj();
|
||||
while (!done) {
|
||||
int i;
|
||||
Tcl_Size i;
|
||||
|
||||
for (i=3 ; i<objc ; i++) {
|
||||
pattern = TclGetString(objv[i]);
|
||||
@@ -3490,13 +3493,12 @@ static int
|
||||
DictUpdateCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const *objv)
|
||||
{
|
||||
Interp *iPtr = (Interp *) interp;
|
||||
Tcl_Obj *dictPtr, *objPtr;
|
||||
int i;
|
||||
Tcl_Size dummy;
|
||||
Tcl_Size i, dummy;
|
||||
|
||||
if (objc < 5 || !(objc & 1)) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv,
|
||||
@@ -3649,7 +3651,7 @@ static int
|
||||
DictWithCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const *objv)
|
||||
{
|
||||
Interp *iPtr = (Interp *) interp;
|
||||
@@ -3853,10 +3855,10 @@ TclDictWithFinish(
|
||||
* parameter is >= 0 */
|
||||
Tcl_Obj *part2Ptr, /* If non-NULL, gives the name of an element
|
||||
* in the array part1. */
|
||||
int index, /* Index into the local variable table of the
|
||||
Tcl_Size index, /* Index into the local variable table of the
|
||||
* variable, or -1. Only used when part1Ptr is
|
||||
* NULL. */
|
||||
int pathc, /* The number of elements in the path into the
|
||||
Tcl_Size pathc, /* The number of elements in the path into the
|
||||
* dictionary. */
|
||||
Tcl_Obj *const pathv[], /* The elements of the path to the subdict. */
|
||||
Tcl_Obj *keysPtr) /* List of keys to be synchronized. This is
|
||||
@@ -3963,31 +3965,6 @@ TclDictWithFinish(
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* TclInitDictCmd --
|
||||
*
|
||||
* This function is create the "dict" Tcl command. See the user
|
||||
* documentation for details on what it does, and TIP#111 for the formal
|
||||
* specification.
|
||||
*
|
||||
* Results:
|
||||
* A Tcl command handle.
|
||||
*
|
||||
* Side effects:
|
||||
* May advance compilation epoch.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
Tcl_Command
|
||||
TclInitDictCmd(
|
||||
Tcl_Interp *interp)
|
||||
{
|
||||
return TclMakeEnsemble(interp, "dict", implementationMap);
|
||||
}
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: c
|
||||
|
||||
+165
-126
@@ -13,6 +13,7 @@
|
||||
*/
|
||||
|
||||
#include "tclInt.h"
|
||||
#define ALLOW_DEPRECATED_OPCODES
|
||||
#include "tclCompile.h"
|
||||
#include "tclOOInt.h"
|
||||
|
||||
@@ -36,11 +37,11 @@ static void UpdateStringOfInstName(Tcl_Obj *objPtr);
|
||||
*/
|
||||
|
||||
static const Tcl_ObjType instNameType = {
|
||||
"instname", /* name */
|
||||
NULL, /* freeIntRepProc */
|
||||
NULL, /* dupIntRepProc */
|
||||
UpdateStringOfInstName, /* updateStringProc */
|
||||
NULL, /* setFromAnyProc */
|
||||
"instname",
|
||||
NULL, // FreeIntRep
|
||||
NULL, // DupIntRep
|
||||
UpdateStringOfInstName,
|
||||
NULL, // SetFromAny
|
||||
TCL_OBJTYPE_V0
|
||||
};
|
||||
|
||||
@@ -131,7 +132,7 @@ void
|
||||
TclDebugPrintByteCodeObj(
|
||||
Tcl_Obj *objPtr) /* The bytecode object to disassemble. */
|
||||
{
|
||||
if (tclTraceCompile >= 2) {
|
||||
if (tclTraceCompile >= TCL_TRACE_BYTECODE_COMPILE_DETAIL) {
|
||||
Tcl_Obj *bufPtr = DisassembleByteCodeObj(objPtr);
|
||||
|
||||
fprintf(stdout, "\n%s", TclGetString(bufPtr));
|
||||
@@ -279,8 +280,11 @@ DisassembleByteCodeObj(
|
||||
*/
|
||||
|
||||
Tcl_AppendPrintfToObj(bufferObj,
|
||||
"ByteCode %p, refCt %" TCL_SIZE_MODIFIER "d, epoch %" TCL_SIZE_MODIFIER "d, interp %p (epoch %" TCL_SIZE_MODIFIER "d)\n",
|
||||
codePtr, codePtr->refCount, codePtr->compileEpoch, iPtr, iPtr->compileEpoch);
|
||||
"ByteCode %p, refCt %" TCL_SIZE_MODIFIER "d, "
|
||||
"epoch %" TCL_SIZE_MODIFIER "d, interp %p "
|
||||
"(epoch %" TCL_SIZE_MODIFIER "d)\n",
|
||||
codePtr, codePtr->refCount, codePtr->compileEpoch, iPtr,
|
||||
iPtr->compileEpoch);
|
||||
Tcl_AppendToObj(bufferObj, " Source ", -1);
|
||||
PrintSourceToObj(bufferObj, codePtr->source,
|
||||
TclMin(codePtr->numSrcBytes, 55));
|
||||
@@ -290,7 +294,10 @@ DisassembleByteCodeObj(
|
||||
TclGetString(fileObj), line);
|
||||
}
|
||||
Tcl_AppendPrintfToObj(bufferObj,
|
||||
"\n Cmds %d, src %" TCL_SIZE_MODIFIER "d, inst %" TCL_SIZE_MODIFIER "d, litObjs %" TCL_SIZE_MODIFIER "d, aux %" TCL_SIZE_MODIFIER "d, stkDepth %" TCL_SIZE_MODIFIER "d, code/src %.2f\n",
|
||||
"\n Cmds %d, src %" TCL_SIZE_MODIFIER "d, "
|
||||
"inst %" TCL_SIZE_MODIFIER "d, litObjs %" TCL_SIZE_MODIFIER "d, "
|
||||
"aux %" TCL_SIZE_MODIFIER "d, stkDepth %" TCL_SIZE_MODIFIER "d, "
|
||||
"code/src %.2f\n",
|
||||
numCmds, codePtr->numSrcBytes, codePtr->numCodeBytes,
|
||||
codePtr->numLitObjects, codePtr->numAuxDataItems,
|
||||
codePtr->maxStackDepth,
|
||||
@@ -302,8 +309,10 @@ DisassembleByteCodeObj(
|
||||
|
||||
#ifdef TCL_COMPILE_STATS
|
||||
Tcl_AppendPrintfToObj(bufferObj,
|
||||
" Code %" TCL_Z_MODIFIER "u = header %" TCL_Z_MODIFIER "u+inst %" TCL_SIZE_MODIFIER "d+litObj %"
|
||||
TCL_Z_MODIFIER "u+exc %" TCL_Z_MODIFIER "u+aux %" TCL_Z_MODIFIER "u+cmdMap %" TCL_SIZE_MODIFIER "d\n",
|
||||
" Code %" TCL_Z_MODIFIER "u = header %" TCL_Z_MODIFIER "u+"
|
||||
"inst %" TCL_SIZE_MODIFIER "d+litObj %" TCL_Z_MODIFIER "u+"
|
||||
"exc %" TCL_Z_MODIFIER "u+aux %" TCL_Z_MODIFIER "u+"
|
||||
"cmdMap %" TCL_SIZE_MODIFIER "d\n",
|
||||
codePtr->structureSize,
|
||||
offsetof(ByteCode, localCachePtr),
|
||||
codePtr->numCodeBytes,
|
||||
@@ -324,7 +333,9 @@ DisassembleByteCodeObj(
|
||||
Tcl_Size numCompiledLocals = procPtr->numCompiledLocals;
|
||||
|
||||
Tcl_AppendPrintfToObj(bufferObj,
|
||||
" Proc %p, refCt %" TCL_SIZE_MODIFIER "d, args %" TCL_SIZE_MODIFIER "d, compiled locals %" TCL_SIZE_MODIFIER "d\n",
|
||||
" Proc %p, refCt %" TCL_SIZE_MODIFIER "d, "
|
||||
"args %" TCL_SIZE_MODIFIER "d, "
|
||||
"compiled locals %" TCL_SIZE_MODIFIER "d\n",
|
||||
procPtr, procPtr->refCount, procPtr->numArgs,
|
||||
numCompiledLocals);
|
||||
if (numCompiledLocals > 0) {
|
||||
@@ -355,24 +366,31 @@ DisassembleByteCodeObj(
|
||||
*/
|
||||
|
||||
if ((int)codePtr->numExceptRanges > 0) {
|
||||
Tcl_AppendPrintfToObj(bufferObj, " Exception ranges %" TCL_SIZE_MODIFIER "d, depth %" TCL_SIZE_MODIFIER "d:\n",
|
||||
Tcl_AppendPrintfToObj(bufferObj,
|
||||
" Exception ranges %" TCL_SIZE_MODIFIER "d, "
|
||||
"depth %" TCL_SIZE_MODIFIER "d:\n",
|
||||
codePtr->numExceptRanges, codePtr->maxExceptDepth);
|
||||
for (i = 0; i < (int)codePtr->numExceptRanges; i++) {
|
||||
ExceptionRange *rangePtr = &codePtr->exceptArrayPtr[i];
|
||||
|
||||
Tcl_AppendPrintfToObj(bufferObj,
|
||||
" %" TCL_SIZE_MODIFIER "d: level %" TCL_SIZE_MODIFIER "d, %s, pc %" TCL_SIZE_MODIFIER "d-%" TCL_SIZE_MODIFIER "d, ",
|
||||
" %" TCL_SIZE_MODIFIER "d: "
|
||||
"level %" TCL_SIZE_MODIFIER "d, %s, "
|
||||
"pc %" TCL_SIZE_MODIFIER "d-%" TCL_SIZE_MODIFIER "d, ",
|
||||
i, rangePtr->nestingLevel,
|
||||
(rangePtr->type==LOOP_EXCEPTION_RANGE ? "loop" : "catch"),
|
||||
rangePtr->codeOffset,
|
||||
(rangePtr->codeOffset + rangePtr->numCodeBytes - 1));
|
||||
switch (rangePtr->type) {
|
||||
case LOOP_EXCEPTION_RANGE:
|
||||
Tcl_AppendPrintfToObj(bufferObj, "continue %" TCL_SIZE_MODIFIER "d, break %" TCL_SIZE_MODIFIER "d\n",
|
||||
Tcl_AppendPrintfToObj(bufferObj,
|
||||
"continue %" TCL_SIZE_MODIFIER "d, "
|
||||
"break %" TCL_SIZE_MODIFIER "d\n",
|
||||
rangePtr->continueOffset, rangePtr->breakOffset);
|
||||
break;
|
||||
case CATCH_EXCEPTION_RANGE:
|
||||
Tcl_AppendPrintfToObj(bufferObj, "catch %" TCL_SIZE_MODIFIER "d\n",
|
||||
Tcl_AppendPrintfToObj(bufferObj,
|
||||
"catch %" TCL_SIZE_MODIFIER "d\n",
|
||||
rangePtr->catchOffset);
|
||||
break;
|
||||
default:
|
||||
@@ -446,7 +464,8 @@ DisassembleByteCodeObj(
|
||||
srcLengthNext++;
|
||||
}
|
||||
|
||||
Tcl_AppendPrintfToObj(bufferObj, "%s%4" TCL_SIZE_MODIFIER "d: pc %d-%d, src %d-%d",
|
||||
Tcl_AppendPrintfToObj(bufferObj,
|
||||
"%s%4" TCL_SIZE_MODIFIER "d: pc %d-%d, src %d-%d",
|
||||
((i % 2)? " " : "\n "),
|
||||
(i+1), codeOffset, (codeOffset + codeLen - 1),
|
||||
srcOffset, (srcOffset + srcLen - 1));
|
||||
@@ -558,56 +577,69 @@ FormatInstruction(
|
||||
for (i = 0; i < instDesc->numOperands; i++) {
|
||||
switch (instDesc->opTypes[i]) {
|
||||
case OPERAND_INT1:
|
||||
opnd = TclGetInt1AtPtr(pc+numBytes); numBytes++;
|
||||
opnd = TclGetInt1AtPtr(pc+numBytes);
|
||||
numBytes++;
|
||||
Tcl_AppendPrintfToObj(bufferObj, "%+d ", opnd);
|
||||
break;
|
||||
case OPERAND_INT4:
|
||||
opnd = TclGetInt4AtPtr(pc+numBytes); numBytes += 4;
|
||||
opnd = TclGetInt4AtPtr(pc+numBytes);
|
||||
numBytes += 4;
|
||||
Tcl_AppendPrintfToObj(bufferObj, "%+d ", opnd);
|
||||
break;
|
||||
case OPERAND_UINT1:
|
||||
opnd = TclGetUInt1AtPtr(pc+numBytes); numBytes++;
|
||||
opnd = TclGetUInt1AtPtr(pc+numBytes);
|
||||
numBytes++;
|
||||
Tcl_AppendPrintfToObj(bufferObj, "%u ", opnd);
|
||||
break;
|
||||
case OPERAND_UINT4:
|
||||
opnd = TclGetUInt4AtPtr(pc+numBytes); numBytes += 4;
|
||||
opnd = TclGetUInt4AtPtr(pc+numBytes);
|
||||
numBytes += 4;
|
||||
if (opCode == INST_START_CMD) {
|
||||
snprintf(suffixBuffer+strlen(suffixBuffer), sizeof(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++;
|
||||
opnd = TclGetInt1AtPtr(pc+numBytes);
|
||||
numBytes++;
|
||||
snprintf(suffixBuffer, sizeof(suffixBuffer), "pc %u", pcOffset+opnd);
|
||||
Tcl_AppendPrintfToObj(bufferObj, "%+d ", opnd);
|
||||
break;
|
||||
case OPERAND_OFFSET4:
|
||||
opnd = TclGetInt4AtPtr(pc+numBytes); numBytes += 4;
|
||||
opnd = TclGetInt4AtPtr(pc+numBytes);
|
||||
numBytes += 4;
|
||||
if (opCode == INST_START_CMD) {
|
||||
snprintf(suffixBuffer, sizeof(suffixBuffer), "next cmd at pc %u", pcOffset+opnd);
|
||||
snprintf(suffixBuffer, sizeof(suffixBuffer),
|
||||
"next cmd at pc %u", pcOffset+opnd);
|
||||
} else {
|
||||
snprintf(suffixBuffer, sizeof(suffixBuffer), "pc %u", pcOffset+opnd);
|
||||
snprintf(suffixBuffer, sizeof(suffixBuffer),
|
||||
"pc %u", pcOffset+opnd);
|
||||
}
|
||||
Tcl_AppendPrintfToObj(bufferObj, "%+d ", opnd);
|
||||
break;
|
||||
case OPERAND_LIT1:
|
||||
opnd = TclGetUInt1AtPtr(pc+numBytes); numBytes++;
|
||||
opnd = TclGetUInt1AtPtr(pc+numBytes);
|
||||
numBytes++;
|
||||
suffixObj = codePtr->objArrayPtr[opnd];
|
||||
Tcl_AppendPrintfToObj(bufferObj, "%u ", opnd);
|
||||
break;
|
||||
case OPERAND_LIT4:
|
||||
opnd = TclGetUInt4AtPtr(pc+numBytes); numBytes += 4;
|
||||
opnd = TclGetUInt4AtPtr(pc+numBytes);
|
||||
numBytes += 4;
|
||||
suffixObj = codePtr->objArrayPtr[opnd];
|
||||
Tcl_AppendPrintfToObj(bufferObj, "%u ", opnd);
|
||||
break;
|
||||
case OPERAND_AUX4:
|
||||
opnd = TclGetUInt4AtPtr(pc+numBytes); numBytes += 4;
|
||||
opnd = TclGetUInt4AtPtr(pc+numBytes);
|
||||
numBytes += 4;
|
||||
Tcl_AppendPrintfToObj(bufferObj, "%u ", opnd);
|
||||
auxPtr = &codePtr->auxDataArrayPtr[opnd];
|
||||
break;
|
||||
case OPERAND_IDX4:
|
||||
opnd = TclGetInt4AtPtr(pc+numBytes); numBytes += 4;
|
||||
opnd = TclGetInt4AtPtr(pc+numBytes);
|
||||
numBytes += 4;
|
||||
if (opnd >= -1) {
|
||||
Tcl_AppendPrintfToObj(bufferObj, "%d ", opnd);
|
||||
} else if (opnd == -2) {
|
||||
@@ -626,14 +658,16 @@ FormatInstruction(
|
||||
printLVTindex:
|
||||
if (localPtr != NULL) {
|
||||
if (opnd >= localCt) {
|
||||
Tcl_Panic("FormatInstruction: bad local var index %u (%" TCL_SIZE_MODIFIER "d locals)",
|
||||
Tcl_Panic("FormatInstruction: bad local var index %u "
|
||||
"(%" TCL_SIZE_MODIFIER "d locals)",
|
||||
opnd, localCt);
|
||||
}
|
||||
for (j = 0; j < opnd; j++) {
|
||||
localPtr = localPtr->nextPtr;
|
||||
}
|
||||
if (TclIsVarTemporary(localPtr)) {
|
||||
snprintf(suffixBuffer, sizeof(suffixBuffer), "temp var %u", opnd);
|
||||
snprintf(suffixBuffer, sizeof(suffixBuffer),
|
||||
"temp var %u", opnd);
|
||||
} else {
|
||||
snprintf(suffixBuffer, sizeof(suffixBuffer), "var ");
|
||||
suffixSrc = localPtr->name;
|
||||
@@ -642,10 +676,57 @@ FormatInstruction(
|
||||
Tcl_AppendPrintfToObj(bufferObj, "%%v%u ", opnd);
|
||||
break;
|
||||
case OPERAND_SCLS1:
|
||||
opnd = TclGetUInt1AtPtr(pc+numBytes); numBytes++;
|
||||
opnd = TclGetUInt1AtPtr(pc+numBytes);
|
||||
numBytes++;
|
||||
Tcl_AppendPrintfToObj(bufferObj, "%s ",
|
||||
tclStringClassTable[opnd].name);
|
||||
break;
|
||||
case OPERAND_UNSF1:
|
||||
opnd = TclGetUInt1AtPtr(pc+numBytes);
|
||||
numBytes++;
|
||||
Tcl_AppendPrintfToObj(bufferObj, "silent=%s ", opnd?"no":"yes");
|
||||
break;
|
||||
case OPERAND_CLK1:
|
||||
opnd = TclGetUInt1AtPtr(pc+numBytes);
|
||||
numBytes++;
|
||||
switch (opnd) {
|
||||
case CLOCK_READ_CLICKS:
|
||||
Tcl_AppendPrintfToObj(bufferObj, "clicks " );
|
||||
break;
|
||||
case CLOCK_READ_MICROS:
|
||||
Tcl_AppendPrintfToObj(bufferObj, "micros " );
|
||||
break;
|
||||
case CLOCK_READ_MILLIS:
|
||||
Tcl_AppendPrintfToObj(bufferObj, "millis " );
|
||||
break;
|
||||
case CLOCK_READ_SECS:
|
||||
Tcl_AppendPrintfToObj(bufferObj, "secs " );
|
||||
break;
|
||||
default:
|
||||
Tcl_Panic("unknown clock type");
|
||||
}
|
||||
break;
|
||||
case OPERAND_LRPL1:
|
||||
opnd = TclGetUInt1AtPtr(pc+numBytes);
|
||||
numBytes++;
|
||||
switch (opnd) {
|
||||
case 0:
|
||||
Tcl_AppendPrintfToObj(bufferObj, "0 ");
|
||||
break;
|
||||
case TCL_LREPLACE_END_IS_LAST:
|
||||
Tcl_AppendPrintfToObj(bufferObj, "endLast ");
|
||||
break;
|
||||
case TCL_LREPLACE_SINGLE_INDEX:
|
||||
Tcl_AppendPrintfToObj(bufferObj, "singleIdx ");
|
||||
break;
|
||||
case TCL_LREPLACE_END_IS_LAST | TCL_LREPLACE_NEED_IN_RANGE:
|
||||
Tcl_AppendPrintfToObj(bufferObj, "endLast,indexTest ");
|
||||
break;
|
||||
default:
|
||||
Tcl_AppendPrintfToObj(bufferObj, "endLast,singleIdx ");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case OPERAND_NONE:
|
||||
default:
|
||||
break;
|
||||
@@ -745,13 +826,15 @@ TclGetInnerContext(
|
||||
objc = 2;
|
||||
break;
|
||||
|
||||
case INST_INVOKE_STK4:
|
||||
objc = TclGetUInt4AtPtr(pc+1);
|
||||
case INST_INVOKE_STK:
|
||||
objc = TclGetUInt4AtPtr(pc + 1);
|
||||
break;
|
||||
|
||||
#ifndef REMOVE_DEPRECATED_OPCODES
|
||||
case INST_INVOKE_STK1:
|
||||
objc = TclGetUInt1AtPtr(pc+1);
|
||||
objc = TclGetUInt1AtPtr(pc + 1);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
result = iPtr->innerContext;
|
||||
@@ -1025,6 +1108,9 @@ DisassembleByteCodeAsDicts(
|
||||
val = TclGetInt1AtPtr(opnd);
|
||||
opnd += 1;
|
||||
goto formatNumber;
|
||||
case OPERAND_UNSF1: // TODO: decode
|
||||
case OPERAND_CLK1: // TODO: decode
|
||||
case OPERAND_LRPL1: // TODO: decode
|
||||
case OPERAND_UINT1:
|
||||
val = TclGetUInt1AtPtr(opnd);
|
||||
opnd += 1;
|
||||
@@ -1147,14 +1233,19 @@ DisassembleByteCodeAsDicts(
|
||||
switch (rangePtr->type) {
|
||||
case LOOP_EXCEPTION_RANGE:
|
||||
Tcl_ListObjAppendElement(NULL, exn, Tcl_ObjPrintf(
|
||||
"type %s level %" TCL_SIZE_MODIFIER "d from %" TCL_SIZE_MODIFIER "d to %" TCL_SIZE_MODIFIER "d break %" TCL_SIZE_MODIFIER "d continue %" TCL_SIZE_MODIFIER "d",
|
||||
"type %s level %" TCL_SIZE_MODIFIER "d "
|
||||
"from %" TCL_SIZE_MODIFIER "d to %" TCL_SIZE_MODIFIER "d "
|
||||
"break %" TCL_SIZE_MODIFIER "d "
|
||||
"continue %" TCL_SIZE_MODIFIER "d",
|
||||
"loop", rangePtr->nestingLevel, rangePtr->codeOffset,
|
||||
rangePtr->codeOffset + rangePtr->numCodeBytes - 1,
|
||||
rangePtr->breakOffset, rangePtr->continueOffset));
|
||||
break;
|
||||
case CATCH_EXCEPTION_RANGE:
|
||||
Tcl_ListObjAppendElement(NULL, exn, Tcl_ObjPrintf(
|
||||
"type %s level %" TCL_SIZE_MODIFIER "d from %" TCL_SIZE_MODIFIER "d to %" TCL_SIZE_MODIFIER "d catch %" TCL_SIZE_MODIFIER "d",
|
||||
"type %s level %" TCL_SIZE_MODIFIER "d "
|
||||
"from %" TCL_SIZE_MODIFIER "d to %" TCL_SIZE_MODIFIER "d "
|
||||
"catch %" TCL_SIZE_MODIFIER "d",
|
||||
"catch", rangePtr->nestingLevel, rangePtr->codeOffset,
|
||||
rangePtr->codeOffset + rangePtr->numCodeBytes - 1,
|
||||
rangePtr->catchOffset));
|
||||
@@ -1262,7 +1353,7 @@ int
|
||||
Tcl_DisassembleObjCmd(
|
||||
void *clientData, /* What type of operation. */
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
static const char *const types[] = {
|
||||
@@ -1278,9 +1369,12 @@ Tcl_DisassembleObjCmd(
|
||||
Tcl_Obj *codeObjPtr = NULL;
|
||||
Proc *procPtr = NULL;
|
||||
Tcl_HashEntry *hPtr;
|
||||
Tcl_Obj *ooWhat = NULL;
|
||||
Object *oPtr;
|
||||
Class *classPtr;
|
||||
ByteCode *codePtr;
|
||||
Method *methodPtr;
|
||||
const char *bodyType;
|
||||
|
||||
if (objc < 2) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "type ...");
|
||||
@@ -1378,23 +1472,17 @@ Tcl_DisassembleObjCmd(
|
||||
* Look up the body of a constructor.
|
||||
*/
|
||||
|
||||
oPtr = (Object *) Tcl_GetObjectFromObj(interp, objv[2]);
|
||||
if (oPtr == NULL) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (oPtr->classPtr == NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"\"%s\" is not a class", TclGetString(objv[2])));
|
||||
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "CLASS",
|
||||
TclGetString(objv[2]), (char *)NULL);
|
||||
ooWhat = objv[2];
|
||||
classPtr = TclOOGetClassFromObj(interp, ooWhat);
|
||||
if (classPtr == NULL) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
methodPtr = oPtr->classPtr->constructorPtr;
|
||||
methodPtr = classPtr->constructorPtr;
|
||||
if (methodPtr == NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"\"%s\" has no defined constructor",
|
||||
TclGetString(objv[2])));
|
||||
TclGetString(ooWhat)));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "DISASSEMBLE",
|
||||
"CONSRUCTOR", (char *)NULL);
|
||||
return TCL_ERROR;
|
||||
@@ -1408,30 +1496,9 @@ Tcl_DisassembleObjCmd(
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
* Compile if necessary.
|
||||
*/
|
||||
|
||||
if (!TclHasInternalRep(procPtr->bodyPtr, &tclByteCodeType)) {
|
||||
Command cmd;
|
||||
|
||||
/*
|
||||
* Yes, this is ugly, but we need to pass the namespace in to the
|
||||
* compiler in two places.
|
||||
*/
|
||||
|
||||
cmd.nsPtr = (Namespace *) oPtr->namespacePtr;
|
||||
procPtr->cmdPtr = &cmd;
|
||||
result = TclProcCompileProc(interp, procPtr, procPtr->bodyPtr,
|
||||
(Namespace *) oPtr->namespacePtr, "body of constructor",
|
||||
TclGetString(objv[2]));
|
||||
procPtr->cmdPtr = NULL;
|
||||
if (result != TCL_OK) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
codeObjPtr = procPtr->bodyPtr;
|
||||
break;
|
||||
oPtr = classPtr->thisPtr;
|
||||
bodyType = "body of constructor";
|
||||
goto compileMethodIfNeeded;
|
||||
|
||||
case DISAS_CLASS_DESTRUCTOR:
|
||||
if (objc != 3) {
|
||||
@@ -1443,23 +1510,17 @@ Tcl_DisassembleObjCmd(
|
||||
* Look up the body of a destructor.
|
||||
*/
|
||||
|
||||
oPtr = (Object *) Tcl_GetObjectFromObj(interp, objv[2]);
|
||||
if (oPtr == NULL) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (oPtr->classPtr == NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"\"%s\" is not a class", TclGetString(objv[2])));
|
||||
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "CLASS",
|
||||
TclGetString(objv[2]), (char *)NULL);
|
||||
ooWhat = objv[2];
|
||||
classPtr = TclOOGetClassFromObj(interp, ooWhat);
|
||||
if (classPtr == NULL) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
methodPtr = oPtr->classPtr->destructorPtr;
|
||||
methodPtr = classPtr->destructorPtr;
|
||||
if (methodPtr == NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"\"%s\" has no defined destructor",
|
||||
TclGetString(objv[2])));
|
||||
TclGetString(ooWhat)));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "DISASSEMBLE",
|
||||
"DESRUCTOR", (char *)NULL);
|
||||
return TCL_ERROR;
|
||||
@@ -1473,30 +1534,9 @@ Tcl_DisassembleObjCmd(
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
* Compile if necessary.
|
||||
*/
|
||||
|
||||
if (!TclHasInternalRep(procPtr->bodyPtr, &tclByteCodeType)) {
|
||||
Command cmd;
|
||||
|
||||
/*
|
||||
* Yes, this is ugly, but we need to pass the namespace in to the
|
||||
* compiler in two places.
|
||||
*/
|
||||
|
||||
cmd.nsPtr = (Namespace *) oPtr->namespacePtr;
|
||||
procPtr->cmdPtr = &cmd;
|
||||
result = TclProcCompileProc(interp, procPtr, procPtr->bodyPtr,
|
||||
(Namespace *) oPtr->namespacePtr, "body of destructor",
|
||||
TclGetString(objv[2]));
|
||||
procPtr->cmdPtr = NULL;
|
||||
if (result != TCL_OK) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
codeObjPtr = procPtr->bodyPtr;
|
||||
break;
|
||||
oPtr = classPtr->thisPtr;
|
||||
bodyType = "body of destructor";
|
||||
goto compileMethodIfNeeded;
|
||||
|
||||
case DISAS_CLASS_METHOD:
|
||||
if (objc != 4) {
|
||||
@@ -1508,19 +1548,13 @@ Tcl_DisassembleObjCmd(
|
||||
* Look up the body of a class method.
|
||||
*/
|
||||
|
||||
oPtr = (Object *) Tcl_GetObjectFromObj(interp, objv[2]);
|
||||
if (oPtr == NULL) {
|
||||
ooWhat = objv[3];
|
||||
classPtr = TclOOGetClassFromObj(interp, objv[2]);
|
||||
if (classPtr == NULL) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (oPtr->classPtr == NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"\"%s\" is not a class", TclGetString(objv[2])));
|
||||
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "CLASS",
|
||||
TclGetString(objv[2]), (char *)NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
hPtr = Tcl_FindHashEntry(&oPtr->classPtr->classMethods,
|
||||
objv[3]);
|
||||
oPtr = classPtr->thisPtr;
|
||||
hPtr = Tcl_FindHashEntry(&classPtr->classMethods, ooWhat);
|
||||
goto methodBody;
|
||||
case DISAS_OBJECT_METHOD:
|
||||
if (objc != 4) {
|
||||
@@ -1532,14 +1566,16 @@ Tcl_DisassembleObjCmd(
|
||||
* Look up the body of an instance method.
|
||||
*/
|
||||
|
||||
ooWhat = objv[3];
|
||||
oPtr = (Object *) Tcl_GetObjectFromObj(interp, objv[2]);
|
||||
if (oPtr == NULL) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
ooWhat = objv[3];
|
||||
if (oPtr->methodsPtr == NULL) {
|
||||
goto unknownMethod;
|
||||
}
|
||||
hPtr = Tcl_FindHashEntry(oPtr->methodsPtr, objv[3]);
|
||||
hPtr = Tcl_FindHashEntry(oPtr->methodsPtr, ooWhat);
|
||||
|
||||
/*
|
||||
* Compile (if necessary) and disassemble a method body.
|
||||
@@ -1549,9 +1585,9 @@ Tcl_DisassembleObjCmd(
|
||||
if (hPtr == NULL) {
|
||||
unknownMethod:
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"unknown method \"%s\"", TclGetString(objv[3])));
|
||||
"unknown method \"%s\"", TclGetString(ooWhat)));
|
||||
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "METHOD",
|
||||
TclGetString(objv[3]), (char *)NULL);
|
||||
TclGetString(ooWhat), (char *)NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
procPtr = TclOOGetProcFromMethod((Method *)Tcl_GetHashValue(hPtr));
|
||||
@@ -1562,6 +1598,9 @@ Tcl_DisassembleObjCmd(
|
||||
"METHODTYPE", (char *)NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
bodyType = "body of method";
|
||||
|
||||
compileMethodIfNeeded:
|
||||
if (!TclHasInternalRep(procPtr->bodyPtr, &tclByteCodeType)) {
|
||||
Command cmd;
|
||||
|
||||
@@ -1573,8 +1612,8 @@ Tcl_DisassembleObjCmd(
|
||||
cmd.nsPtr = (Namespace *) oPtr->namespacePtr;
|
||||
procPtr->cmdPtr = &cmd;
|
||||
result = TclProcCompileProc(interp, procPtr, procPtr->bodyPtr,
|
||||
(Namespace *) oPtr->namespacePtr, "body of method",
|
||||
TclGetString(objv[3]));
|
||||
(Namespace *) oPtr->namespacePtr, bodyType,
|
||||
TclGetString(ooWhat));
|
||||
procPtr->cmdPtr = NULL;
|
||||
if (result != TCL_OK) {
|
||||
return result;
|
||||
@@ -1583,7 +1622,7 @@ Tcl_DisassembleObjCmd(
|
||||
codeObjPtr = procPtr->bodyPtr;
|
||||
break;
|
||||
default:
|
||||
CLANG_ASSERT(0);
|
||||
TCL_UNREACHABLE();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+961
-156
File diff suppressed because it is too large
Load Diff
+49
-63
@@ -18,19 +18,19 @@
|
||||
*/
|
||||
|
||||
static Tcl_Command InitEnsembleFromOptions(Tcl_Interp *interp,
|
||||
int objc, Tcl_Obj *const objv[]);
|
||||
Tcl_Size objc, Tcl_Obj *const objv[]);
|
||||
static int ReadOneEnsembleOption(Tcl_Interp *interp,
|
||||
Tcl_Command token, Tcl_Obj *optionObj);
|
||||
static int ReadAllEnsembleOptions(Tcl_Interp *interp,
|
||||
Tcl_Command token);
|
||||
static int SetEnsembleConfigOptions(Tcl_Interp *interp,
|
||||
Tcl_Command token, int objc,
|
||||
Tcl_Command token, Tcl_Size objc,
|
||||
Tcl_Obj *const objv[]);
|
||||
static inline int EnsembleUnknownCallback(Tcl_Interp *interp,
|
||||
EnsembleConfig *ensemblePtr, int objc,
|
||||
EnsembleConfig *ensemblePtr, Tcl_Size objc,
|
||||
Tcl_Obj *const objv[], Tcl_Obj **prefixObjPtr);
|
||||
static int NsEnsembleImplementationCmdNR(void *clientData,
|
||||
Tcl_Interp *interp,int objc,Tcl_Obj *const objv[]);
|
||||
Tcl_Interp *interp,Tcl_Size objc,Tcl_Obj *const objv[]);
|
||||
static void BuildEnsembleConfig(EnsembleConfig *ensemblePtr);
|
||||
static int NsEnsembleStringOrder(const void *strPtr1,
|
||||
const void *strPtr2);
|
||||
@@ -85,11 +85,11 @@ enum EnsConfigOpts {
|
||||
*/
|
||||
|
||||
static const Tcl_ObjType ensembleCmdType = {
|
||||
"ensembleCommand", /* the type's name */
|
||||
FreeEnsembleCmdRep, /* freeIntRepProc */
|
||||
DupEnsembleCmdRep, /* dupIntRepProc */
|
||||
NULL, /* updateStringProc */
|
||||
NULL, /* setFromAnyProc */
|
||||
"ensembleCommand",
|
||||
FreeEnsembleCmdRep,
|
||||
DupEnsembleCmdRep,
|
||||
NULL, // UpdateString
|
||||
NULL, // SetFromAny
|
||||
TCL_OBJTYPE_V0
|
||||
};
|
||||
|
||||
@@ -151,7 +151,7 @@ int
|
||||
TclNamespaceEnsembleCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
Namespace *nsPtr = (Namespace *) TclGetCurrentNamespace(interp);
|
||||
@@ -258,7 +258,7 @@ TclNamespaceEnsembleCmd(
|
||||
static Tcl_Command
|
||||
InitEnsembleFromOptions(
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
Namespace *nsPtr = (Namespace *) TclGetCurrentNamespace(interp);
|
||||
@@ -588,7 +588,7 @@ static int
|
||||
SetEnsembleConfigOptions(
|
||||
Tcl_Interp *interp,
|
||||
Tcl_Command token, /* The ensemble to configure. */
|
||||
int objc, /* The count of option-related arguments. */
|
||||
Tcl_Size objc, /* The count of option-related arguments. */
|
||||
Tcl_Obj *const objv[]) /* Option-related arguments. */
|
||||
{
|
||||
Tcl_Size len;
|
||||
@@ -873,7 +873,7 @@ GetEnsembleFromCommand(
|
||||
{
|
||||
Command *cmdPtr = (Command *) token;
|
||||
|
||||
if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
|
||||
if (cmdPtr->objProc2 != TclEnsembleImplementationCmd) {
|
||||
if (interp != NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"command is not an ensemble", TCL_AUTO_LENGTH));
|
||||
@@ -882,7 +882,7 @@ GetEnsembleFromCommand(
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
return (EnsembleConfig *) cmdPtr->objClientData;
|
||||
return (EnsembleConfig *)cmdPtr->objClientData2;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1485,7 +1485,7 @@ Tcl_FindEnsemble(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (((Command *) token)->objProc != TclEnsembleImplementationCmd) {
|
||||
if (((Command *) token)->objProc2 != TclEnsembleImplementationCmd) {
|
||||
/*
|
||||
* Reuse existing infrastructure for following import link chains
|
||||
* rather than duplicating it.
|
||||
@@ -1494,7 +1494,7 @@ Tcl_FindEnsemble(
|
||||
token = TclGetOriginalCommand(token);
|
||||
|
||||
if (token == NULL ||
|
||||
((Command *) token)->objProc != TclEnsembleImplementationCmd) {
|
||||
((Command *) token)->objProc2 != TclEnsembleImplementationCmd) {
|
||||
if (flags & TCL_LEAVE_ERR_MSG) {
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"\"%s\" is not an ensemble command",
|
||||
@@ -1532,11 +1532,11 @@ Tcl_IsEnsemble(
|
||||
{
|
||||
Command *cmdPtr = (Command *) token;
|
||||
|
||||
if (cmdPtr->objProc == TclEnsembleImplementationCmd) {
|
||||
if (cmdPtr->objProc2 == TclEnsembleImplementationCmd) {
|
||||
return 1;
|
||||
}
|
||||
cmdPtr = (Command *) TclGetOriginalCommand((Tcl_Command) cmdPtr);
|
||||
if (cmdPtr == NULL || cmdPtr->objProc != TclEnsembleImplementationCmd) {
|
||||
if (cmdPtr == NULL || cmdPtr->objProc2 != TclEnsembleImplementationCmd) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
@@ -1583,7 +1583,8 @@ TclMakeEnsemble(
|
||||
const char **nameParts = NULL;
|
||||
const char *cmdName = NULL;
|
||||
Tcl_Size i, nameCount = 0;
|
||||
int ensembleFlags = 0, hiddenLen;
|
||||
int ensembleFlags = 0;
|
||||
Tcl_Size hiddenLen;
|
||||
|
||||
/*
|
||||
* Construct the path for the ensemble namespace and create it.
|
||||
@@ -1667,7 +1668,7 @@ TclMakeEnsemble(
|
||||
Tcl_AppendToObj(toObj, map[i].name, TCL_AUTO_LENGTH);
|
||||
TclDictPut(NULL, mapDict, map[i].name, toObj);
|
||||
|
||||
if (map[i].proc || map[i].nreProc) {
|
||||
if (map[i].proc2 || map[i].nreProc2) {
|
||||
/*
|
||||
* If the command is unsafe, hide it when we're in a safe
|
||||
* interpreter. The code to do this is really hokey! It also
|
||||
@@ -1678,8 +1679,8 @@ TclMakeEnsemble(
|
||||
|
||||
if (map[i].unsafe && Tcl_IsSafe(interp)) {
|
||||
cmdPtr = (Command *)
|
||||
Tcl_NRCreateCommand(interp, "___tmp", map[i].proc,
|
||||
map[i].nreProc, map[i].clientData, NULL);
|
||||
Tcl_NRCreateCommand2(interp, "___tmp", map[i].proc2,
|
||||
map[i].nreProc2, map[i].clientData, NULL);
|
||||
Tcl_DStringSetLength(&hiddenBuf, hiddenLen);
|
||||
if (Tcl_HideCommand(interp, "___tmp",
|
||||
Tcl_DStringAppend(&hiddenBuf, map[i].name,
|
||||
@@ -1694,8 +1695,8 @@ TclMakeEnsemble(
|
||||
*/
|
||||
|
||||
cmdPtr = (Command *)
|
||||
Tcl_NRCreateCommand(interp, TclGetString(toObj),
|
||||
map[i].proc, map[i].nreProc, map[i].clientData,
|
||||
Tcl_NRCreateCommand2(interp, TclGetString(toObj),
|
||||
map[i].proc2, map[i].nreProc2, map[i].clientData,
|
||||
NULL);
|
||||
cmdPtr->compileProc = map[i].compileProc;
|
||||
}
|
||||
@@ -1738,10 +1739,10 @@ int
|
||||
TclEnsembleImplementationCmd(
|
||||
void *clientData,
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
return Tcl_NRCallObjProc(interp, NsEnsembleImplementationCmdNR,
|
||||
return Tcl_NRCallObjProc2(interp, NsEnsembleImplementationCmdNR,
|
||||
clientData, objc, objv);
|
||||
}
|
||||
|
||||
@@ -1749,7 +1750,7 @@ static int
|
||||
NsEnsembleImplementationCmdNR(
|
||||
void *clientData, /* The ensemble this is the impl. of. */
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
EnsembleConfig *ensemblePtr = (EnsembleConfig *) clientData;
|
||||
@@ -2346,7 +2347,7 @@ static inline int
|
||||
EnsembleUnknownCallback(
|
||||
Tcl_Interp *interp,
|
||||
EnsembleConfig *ensemblePtr,/* The ensemble structure. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[], /* Actual arguments. */
|
||||
Tcl_Obj **prefixObjPtr) /* Where to write the prefix suggested by the
|
||||
* unknown callback. Must not be NULL. Only has
|
||||
@@ -2748,7 +2749,7 @@ BuildEnsembleConfig(
|
||||
while (!done) {
|
||||
const char *name = TclGetString(keyObj);
|
||||
|
||||
hPtr = Tcl_CreateHashEntry(hash, name, &isNew);
|
||||
hPtr = Tcl_CreateHashEntry(hash, name, NULL);
|
||||
Tcl_SetHashValue(hPtr, valueObj);
|
||||
Tcl_IncrRefCount(valueObj);
|
||||
Tcl_DictObjNext(&dictSearch, &keyObj, &valueObj, &done);
|
||||
@@ -3226,7 +3227,7 @@ TclCompileEnsemble(
|
||||
|
||||
if (cmdPtr->compileProc == TclCompileEnsemble) {
|
||||
tokenPtr = TokenAfter(tokenPtr);
|
||||
if ((int)parsePtr->numWords < depth + 1
|
||||
if (parsePtr->numWords < depth + 1
|
||||
|| tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) {
|
||||
/*
|
||||
* Too hard because the user has done something unpleasant like
|
||||
@@ -3259,18 +3260,7 @@ TclCompileEnsemble(
|
||||
* Throw out any line information generated by the failed compile attempt.
|
||||
*/
|
||||
|
||||
while (mapPtr->nuloc > eclIndex + 1) {
|
||||
mapPtr->nuloc--;
|
||||
Tcl_Free(mapPtr->loc[mapPtr->nuloc].line);
|
||||
mapPtr->loc[mapPtr->nuloc].line = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Reset the index of next command. Toss out any from failed nested
|
||||
* partial compiles.
|
||||
*/
|
||||
|
||||
envPtr->numCommands = mapPtr->nuloc;
|
||||
ClearFailedCompile(envPtr);
|
||||
|
||||
/*
|
||||
* Failed to do a full compile for some reason. Try to do a direct invoke
|
||||
@@ -3330,7 +3320,7 @@ TclAttemptCompileProc(
|
||||
Tcl_Size i;
|
||||
Tcl_Token *saveTokenPtr = parsePtr->tokenPtr;
|
||||
Tcl_Size savedStackDepth = envPtr->currStackDepth;
|
||||
Tcl_Size savedCodeNext = envPtr->codeNext - envPtr->codeStart;
|
||||
Tcl_Size savedCodeNext = CurrentOffset(envPtr);
|
||||
Tcl_Size savedAuxDataArrayNext = envPtr->auxDataArrayNext;
|
||||
Tcl_Size savedExceptArrayNext = envPtr->exceptArrayNext;
|
||||
#ifdef TCL_COMPILE_DEBUG
|
||||
@@ -3358,8 +3348,8 @@ TclAttemptCompileProc(
|
||||
* index values.
|
||||
*/
|
||||
|
||||
mapPtr->loc[eclIndex].line += (depth - 1);
|
||||
mapPtr->loc[eclIndex].next += (depth - 1);
|
||||
ExtCmdLocation.line += (depth - 1);
|
||||
ExtCmdLocation.next += (depth - 1);
|
||||
|
||||
/*
|
||||
* Hand off compilation to the subcommand compiler. At last!
|
||||
@@ -3371,8 +3361,8 @@ TclAttemptCompileProc(
|
||||
* Undo the shift.
|
||||
*/
|
||||
|
||||
mapPtr->loc[eclIndex].line -= (depth - 1);
|
||||
mapPtr->loc[eclIndex].next -= (depth - 1);
|
||||
ExtCmdLocation.line -= (depth - 1);
|
||||
ExtCmdLocation.next -= (depth - 1);
|
||||
|
||||
parsePtr->numWords += (depth - 1);
|
||||
parsePtr->tokenPtr = saveTokenPtr;
|
||||
@@ -3462,9 +3452,8 @@ CompileToInvokedCommand(
|
||||
DefineLineInformation;
|
||||
Tcl_Token *tokPtr;
|
||||
Tcl_Obj *objPtr, **words;
|
||||
const char *bytes;
|
||||
int cmdLit, extraLiteralFlags = LITERAL_CMD_NAME;
|
||||
Tcl_Size i, numWords, length;
|
||||
Tcl_Size i, numWords;
|
||||
|
||||
/*
|
||||
* Push the words of the command. Take care; the command words may be
|
||||
@@ -3476,15 +3465,13 @@ CompileToInvokedCommand(
|
||||
for (i = 0, tokPtr = parsePtr->tokenPtr; i < parsePtr->numWords;
|
||||
i++, tokPtr = TokenAfter(tokPtr)) {
|
||||
if (i > 0 && i <= numWords) {
|
||||
bytes = TclGetStringFromObj(words[i - 1], &length);
|
||||
PushLiteral(envPtr, bytes, length);
|
||||
PUSH_OBJ( words[i - 1]);
|
||||
continue;
|
||||
}
|
||||
|
||||
SetLineInformation(i);
|
||||
if (tokPtr->type == TCL_TOKEN_SIMPLE_WORD) {
|
||||
int literal = TclRegisterLiteral(envPtr,
|
||||
tokPtr[1].start, tokPtr[1].size, 0);
|
||||
int literal = PUSH_SIMPLE_TOKEN(tokPtr);
|
||||
|
||||
if (envPtr->clNext) {
|
||||
TclContinuationsEnterDerived(
|
||||
@@ -3492,7 +3479,6 @@ CompileToInvokedCommand(
|
||||
tokPtr[1].start - envPtr->source,
|
||||
envPtr->clNext);
|
||||
}
|
||||
TclEmitPush(literal, envPtr);
|
||||
} else {
|
||||
CompileTokens(envPtr, tokPtr, interp);
|
||||
}
|
||||
@@ -3505,21 +3491,17 @@ CompileToInvokedCommand(
|
||||
|
||||
TclNewObj(objPtr);
|
||||
Tcl_GetCommandFullName(interp, (Tcl_Command) cmdPtr, objPtr);
|
||||
bytes = TclGetStringFromObj(objPtr, &length);
|
||||
if ((cmdPtr != NULL) && (cmdPtr->flags & CMD_VIA_RESOLVER)) {
|
||||
extraLiteralFlags |= LITERAL_UNSHARED;
|
||||
}
|
||||
cmdLit = TclRegisterLiteral(envPtr, bytes, length, extraLiteralFlags);
|
||||
cmdLit = PUSH_OBJ_FLAGS(objPtr, extraLiteralFlags);
|
||||
TclSetCmdNameObj(interp, TclFetchLiteral(envPtr, cmdLit), cmdPtr);
|
||||
TclEmitPush(cmdLit, envPtr);
|
||||
TclDecrRefCount(objPtr);
|
||||
|
||||
/*
|
||||
* Do the replacing dispatch.
|
||||
*/
|
||||
|
||||
TclEmitInvoke(envPtr, INST_INVOKE_REPLACE, parsePtr->numWords,
|
||||
numWords + 1);
|
||||
INVOKE41( INVOKE_REPLACE, parsePtr->numWords, numWords+1);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3545,6 +3527,10 @@ CompileBasicNArgCommand(
|
||||
{
|
||||
Tcl_Obj *objPtr;
|
||||
|
||||
if (parsePtr->numWords > INT_MAX) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
TclNewObj(objPtr);
|
||||
Tcl_IncrRefCount(objPtr);
|
||||
Tcl_GetCommandFullName(interp, (Tcl_Command) cmdPtr, objPtr);
|
||||
@@ -3767,7 +3753,7 @@ TclCompileBasicMin0ArgCmd(
|
||||
* which is the only code that sees the shenanigans of ensemble dispatch.
|
||||
*/
|
||||
|
||||
if ((int)parsePtr->numWords < 1) {
|
||||
if (parsePtr->numWords < 1) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
@@ -3789,7 +3775,7 @@ TclCompileBasicMin1ArgCmd(
|
||||
* which is the only code that sees the shenanigans of ensemble dispatch.
|
||||
*/
|
||||
|
||||
if ((int)parsePtr->numWords < 2) {
|
||||
if (parsePtr->numWords < 2) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
@@ -3811,7 +3797,7 @@ TclCompileBasicMin2ArgCmd(
|
||||
* which is the only code that sees the shenanigans of ensemble dispatch.
|
||||
*/
|
||||
|
||||
if ((int)parsePtr->numWords < 3) {
|
||||
if (parsePtr->numWords < 3) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ static struct {
|
||||
char **cache; /* Array containing all of the environment
|
||||
* strings that Tcl has allocated. */
|
||||
#ifndef USE_PUTENV
|
||||
techar **ourEnviron; /* Cache of the array that we allocate. We
|
||||
techar **ourEnviron; /* Cache of the array that we allocate. We
|
||||
* need to track this in case another
|
||||
* subsystem swaps around the environ array
|
||||
* like we do. */
|
||||
|
||||
+71
-31
@@ -35,6 +35,13 @@ typedef struct BgError {
|
||||
* list. */
|
||||
} BgError;
|
||||
|
||||
/*
|
||||
* The assoc data key used in this file. The data associated with it is a
|
||||
* reference to an ErrAssocData structure, and will be deallocated with
|
||||
* BgErrorDeleteProc at the appropriate time.
|
||||
*/
|
||||
#define ASSOC_KEY "tclBgError"
|
||||
|
||||
/*
|
||||
* One of the structures below is associated with the "tclBgError" assoc data
|
||||
* for each interpreter. It keeps track of the head and tail of the list of
|
||||
@@ -58,8 +65,8 @@ typedef struct {
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
int *donePtr; /* Pointer to flag to signal or NULL. */
|
||||
int sequence; /* Order of occurrence. */
|
||||
Tcl_Size *donePtr; /* Pointer to flag to signal or NULL. */
|
||||
Tcl_Size sequence; /* Order of occurrence. */
|
||||
int mask; /* 0, or TCL_READABLE/TCL_WRITABLE. */
|
||||
Tcl_Obj *sourceObj; /* Name of the event source, either a
|
||||
* variable name or channel name. */
|
||||
@@ -72,7 +79,7 @@ typedef struct {
|
||||
|
||||
typedef struct ExitHandler {
|
||||
Tcl_ExitProc *proc; /* Function to call when process exits. */
|
||||
void *clientData; /* One word of information to pass to proc. */
|
||||
void *clientData; /* One word of information to pass to proc. */
|
||||
struct ExitHandler *nextPtr;/* Next in list of all exit handlers for this
|
||||
* application, or NULL for end of list. */
|
||||
} ExitHandler;
|
||||
@@ -122,7 +129,7 @@ static Tcl_ThreadDataKey dataKey;
|
||||
#if TCL_THREADS
|
||||
typedef struct {
|
||||
Tcl_ThreadCreateProc *proc; /* Main() function of the thread */
|
||||
void *clientData; /* The one argument to Main() */
|
||||
void *clientData; /* The one argument to Main() */
|
||||
} ThreadClientData;
|
||||
static Tcl_ThreadCreateType NewThreadProc(void *clientData);
|
||||
#endif /* TCL_THREADS */
|
||||
@@ -182,7 +189,7 @@ Tcl_BackgroundException(
|
||||
errPtr->nextPtr = NULL;
|
||||
|
||||
(void) TclGetBgErrorHandler(interp);
|
||||
assocPtr = (ErrAssocData *)Tcl_GetAssocData(interp, "tclBgError", NULL);
|
||||
assocPtr = (ErrAssocData *)Tcl_GetAssocData(interp, ASSOC_KEY, NULL);
|
||||
if (assocPtr->firstBgPtr == NULL) {
|
||||
assocPtr->firstBgPtr = errPtr;
|
||||
Tcl_DoWhenIdle(HandleBgErrors, assocPtr);
|
||||
@@ -212,7 +219,7 @@ Tcl_BackgroundException(
|
||||
|
||||
static void
|
||||
HandleBgErrors(
|
||||
void *clientData) /* Pointer to ErrAssocData structure. */
|
||||
void *clientData) /* Pointer to ErrAssocData structure. */
|
||||
{
|
||||
ErrAssocData *assocPtr = (ErrAssocData *)clientData;
|
||||
Tcl_Interp *interp = assocPtr->interp;
|
||||
@@ -325,7 +332,7 @@ int
|
||||
TclDefaultBgErrorHandlerObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Tcl_Obj *valuePtr;
|
||||
@@ -454,7 +461,7 @@ TclDefaultBgErrorHandlerObjCmd(
|
||||
|
||||
if (Tcl_IsSafe(interp)) {
|
||||
Tcl_RestoreInterpState(interp, saved);
|
||||
TclObjInvoke(interp, 2, tempObjv, TCL_INVOKE_HIDDEN);
|
||||
Tcl_NRCallObjProc2(interp, TclNRInvoke, NULL, 2, tempObjv);
|
||||
} else {
|
||||
Tcl_Channel errChannel = Tcl_GetStdChannel(TCL_STDERR);
|
||||
|
||||
@@ -522,7 +529,7 @@ TclSetBgErrorHandler(
|
||||
Tcl_Interp *interp,
|
||||
Tcl_Obj *cmdPrefix)
|
||||
{
|
||||
ErrAssocData *assocPtr = (ErrAssocData *)Tcl_GetAssocData(interp, "tclBgError", NULL);
|
||||
ErrAssocData *assocPtr = (ErrAssocData *)Tcl_GetAssocData(interp, ASSOC_KEY, NULL);
|
||||
|
||||
if (cmdPrefix == NULL) {
|
||||
Tcl_Panic("TclSetBgErrorHandler: NULL cmdPrefix argument");
|
||||
@@ -537,7 +544,7 @@ TclSetBgErrorHandler(
|
||||
assocPtr->cmdPrefix = NULL;
|
||||
assocPtr->firstBgPtr = NULL;
|
||||
assocPtr->lastBgPtr = NULL;
|
||||
Tcl_SetAssocData(interp, "tclBgError", BgErrorDeleteProc, assocPtr);
|
||||
Tcl_SetAssocData(interp, ASSOC_KEY, BgErrorDeleteProc, assocPtr);
|
||||
}
|
||||
if (assocPtr->cmdPrefix) {
|
||||
Tcl_DecrRefCount(assocPtr->cmdPrefix);
|
||||
@@ -567,14 +574,14 @@ Tcl_Obj *
|
||||
TclGetBgErrorHandler(
|
||||
Tcl_Interp *interp)
|
||||
{
|
||||
ErrAssocData *assocPtr = (ErrAssocData *)Tcl_GetAssocData(interp, "tclBgError", NULL);
|
||||
ErrAssocData *assocPtr = (ErrAssocData *)Tcl_GetAssocData(interp, ASSOC_KEY, NULL);
|
||||
|
||||
if (assocPtr == NULL) {
|
||||
Tcl_Obj *bgerrorObj;
|
||||
|
||||
TclNewLiteralStringObj(bgerrorObj, "::tcl::Bgerror");
|
||||
TclSetBgErrorHandler(interp, bgerrorObj);
|
||||
assocPtr = (ErrAssocData *)Tcl_GetAssocData(interp, "tclBgError", NULL);
|
||||
assocPtr = (ErrAssocData *)Tcl_GetAssocData(interp, ASSOC_KEY, NULL);
|
||||
}
|
||||
return assocPtr->cmdPrefix;
|
||||
}
|
||||
@@ -600,7 +607,7 @@ TclGetBgErrorHandler(
|
||||
|
||||
static void
|
||||
BgErrorDeleteProc(
|
||||
void *clientData, /* Pointer to ErrAssocData structure. */
|
||||
void *clientData, /* Pointer to ErrAssocData structure. */
|
||||
TCL_UNUSED(Tcl_Interp *))
|
||||
{
|
||||
ErrAssocData *assocPtr = (ErrAssocData *)clientData;
|
||||
@@ -639,7 +646,7 @@ BgErrorDeleteProc(
|
||||
void
|
||||
Tcl_CreateExitHandler(
|
||||
Tcl_ExitProc *proc, /* Function to invoke. */
|
||||
void *clientData) /* Arbitrary value to pass to proc. */
|
||||
void *clientData) /* Arbitrary value to pass to proc. */
|
||||
{
|
||||
ExitHandler *exitPtr = (ExitHandler*)Tcl_Alloc(sizeof(ExitHandler));
|
||||
|
||||
@@ -672,7 +679,7 @@ Tcl_CreateExitHandler(
|
||||
void
|
||||
TclCreateLateExitHandler(
|
||||
Tcl_ExitProc *proc, /* Function to invoke. */
|
||||
void *clientData) /* Arbitrary value to pass to proc. */
|
||||
void *clientData) /* Arbitrary value to pass to proc. */
|
||||
{
|
||||
ExitHandler *exitPtr = (ExitHandler*)Tcl_Alloc(sizeof(ExitHandler));
|
||||
|
||||
@@ -705,7 +712,7 @@ TclCreateLateExitHandler(
|
||||
void
|
||||
Tcl_DeleteExitHandler(
|
||||
Tcl_ExitProc *proc, /* Function that was previously registered. */
|
||||
void *clientData) /* Arbitrary value to pass to proc. */
|
||||
void *clientData) /* Arbitrary value to pass to proc. */
|
||||
{
|
||||
ExitHandler *exitPtr, *prevPtr;
|
||||
|
||||
@@ -748,7 +755,7 @@ Tcl_DeleteExitHandler(
|
||||
void
|
||||
TclDeleteLateExitHandler(
|
||||
Tcl_ExitProc *proc, /* Function that was previously registered. */
|
||||
void *clientData) /* Arbitrary value to pass to proc. */
|
||||
void *clientData) /* Arbitrary value to pass to proc. */
|
||||
{
|
||||
ExitHandler *exitPtr, *prevPtr;
|
||||
|
||||
@@ -791,7 +798,7 @@ TclDeleteLateExitHandler(
|
||||
void
|
||||
Tcl_CreateThreadExitHandler(
|
||||
Tcl_ExitProc *proc, /* Function to invoke. */
|
||||
void *clientData) /* Arbitrary value to pass to proc. */
|
||||
void *clientData) /* Arbitrary value to pass to proc. */
|
||||
{
|
||||
ExitHandler *exitPtr;
|
||||
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
|
||||
@@ -824,7 +831,7 @@ Tcl_CreateThreadExitHandler(
|
||||
void
|
||||
Tcl_DeleteThreadExitHandler(
|
||||
Tcl_ExitProc *proc, /* Function that was previously registered. */
|
||||
void *clientData) /* Arbitrary value to pass to proc. */
|
||||
void *clientData) /* Arbitrary value to pass to proc. */
|
||||
{
|
||||
ExitHandler *exitPtr, *prevPtr;
|
||||
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
|
||||
@@ -1121,6 +1128,16 @@ static const struct {
|
||||
#endif // TCL_WITH_INTERNAL_ZLIB
|
||||
}};
|
||||
|
||||
/*
|
||||
* Wrapper to retrieve version+build to other modules.
|
||||
*/
|
||||
const char *
|
||||
TclGetBuildInfo()
|
||||
{
|
||||
return stubInfo.version;
|
||||
}
|
||||
|
||||
|
||||
const char *
|
||||
Tcl_InitSubsystems(void)
|
||||
{
|
||||
@@ -1156,6 +1173,27 @@ Tcl_InitSubsystems(void)
|
||||
#endif
|
||||
|
||||
TclpInitPlatform(); /* Creates signal handler(s) */
|
||||
|
||||
/*
|
||||
* Initialize the C library's locale subsystem. This is required for input
|
||||
* methods to work properly on X11. We only do this for LC_CTYPE because
|
||||
* that's the necessary one, and we don't want to affect LC_TIME here.
|
||||
* The side effect of setting the default locale should be to load any
|
||||
* locale specific modules that are needed by X. [BUG: 5422 3345 4236 2522
|
||||
* 2521].
|
||||
*/
|
||||
|
||||
setlocale(LC_CTYPE, "");
|
||||
|
||||
/*
|
||||
* In case the initial locale is not "C", ensure that the numeric
|
||||
* processing is done in "C" locale regardless. This is needed because Tcl
|
||||
* relies on routines like strtol/strtoul, but should not have locale dependent
|
||||
* behavior.
|
||||
*/
|
||||
|
||||
setlocale(LC_NUMERIC, "C");
|
||||
|
||||
TclInitDoubleConversion(); /* Initializes constants for
|
||||
* converting to/from double. */
|
||||
TclInitObjSubsystem(); /* Register obj types, create
|
||||
@@ -1163,12 +1201,13 @@ Tcl_InitSubsystems(void)
|
||||
TclInitIOSubsystem(); /* Inits a tsd key (noop). */
|
||||
TclInitEncodingSubsystem(); /* Process wide encoding init. */
|
||||
TclInitNamespaceSubsystem();/* Register ns obj type (mutexed). */
|
||||
TclZipfsInit(); /* Initialize zipfs subsystem */
|
||||
subsystemsInitialized = 1;
|
||||
}
|
||||
TclpInitUnlock();
|
||||
}
|
||||
TclInitNotifier();
|
||||
return stubInfo.version;
|
||||
return TclGetBuildInfo();
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1498,11 +1537,12 @@ int
|
||||
Tcl_VwaitObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
int i, done = 0, timedOut = 0, foundEvent, any = 1, timeout = 0;
|
||||
int numItems = 0, extended = 0, result, mode, mask = TCL_ALL_EVENTS;
|
||||
Tcl_Size i, done = 0, numItems = 0, timedOut = 0;
|
||||
int foundEvent, any = 1, timeout = 0;
|
||||
int extended = 0, result, mode, mask = TCL_ALL_EVENTS;
|
||||
Tcl_InterpState saved = NULL;
|
||||
Tcl_TimerToken timer = NULL;
|
||||
Tcl_Time before, after;
|
||||
@@ -1600,7 +1640,7 @@ Tcl_VwaitObjCmd(
|
||||
goto done;
|
||||
}
|
||||
vwaitItems[numItems].donePtr = &done;
|
||||
vwaitItems[numItems].sequence = -1;
|
||||
vwaitItems[numItems].sequence = TCL_INDEX_NONE;
|
||||
vwaitItems[numItems].mask = 0;
|
||||
vwaitItems[numItems].sourceObj = objv[i];
|
||||
numItems++;
|
||||
@@ -1624,7 +1664,7 @@ Tcl_VwaitObjCmd(
|
||||
Tcl_CreateChannelHandler(chan, TCL_READABLE,
|
||||
VwaitChannelReadProc, &vwaitItems[numItems]);
|
||||
vwaitItems[numItems].donePtr = &done;
|
||||
vwaitItems[numItems].sequence = -1;
|
||||
vwaitItems[numItems].sequence = TCL_INDEX_NONE;
|
||||
vwaitItems[numItems].mask = TCL_READABLE;
|
||||
vwaitItems[numItems].sourceObj = objv[i];
|
||||
numItems++;
|
||||
@@ -1648,7 +1688,7 @@ Tcl_VwaitObjCmd(
|
||||
Tcl_CreateChannelHandler(chan, TCL_WRITABLE,
|
||||
VwaitChannelWriteProc, &vwaitItems[numItems]);
|
||||
vwaitItems[numItems].donePtr = &done;
|
||||
vwaitItems[numItems].sequence = -1;
|
||||
vwaitItems[numItems].sequence = TCL_INDEX_NONE;
|
||||
vwaitItems[numItems].mask = TCL_WRITABLE;
|
||||
vwaitItems[numItems].sourceObj = objv[i];
|
||||
numItems++;
|
||||
@@ -1684,7 +1724,7 @@ Tcl_VwaitObjCmd(
|
||||
break;
|
||||
}
|
||||
vwaitItems[numItems].donePtr = &done;
|
||||
vwaitItems[numItems].sequence = -1;
|
||||
vwaitItems[numItems].sequence = TCL_INDEX_NONE;
|
||||
vwaitItems[numItems].mask = 0;
|
||||
vwaitItems[numItems].sourceObj = objv[i];
|
||||
numItems++;
|
||||
@@ -1708,7 +1748,7 @@ Tcl_VwaitObjCmd(
|
||||
|
||||
if (timeout > 0) {
|
||||
vwaitItems[numItems].donePtr = &timedOut;
|
||||
vwaitItems[numItems].sequence = -1;
|
||||
vwaitItems[numItems].sequence = TCL_INDEX_NONE;
|
||||
vwaitItems[numItems].mask = 0;
|
||||
vwaitItems[numItems].sourceObj = NULL;
|
||||
timer = Tcl_CreateTimerHandler(timeout, VwaitTimeoutProc,
|
||||
@@ -1730,7 +1770,7 @@ Tcl_VwaitObjCmd(
|
||||
|
||||
foundEvent = 1;
|
||||
while (!timedOut && foundEvent &&
|
||||
((!any && (done < numItems)) || (any && !done))) {
|
||||
((!any && (done < numItems)) || (any && !done))) {
|
||||
foundEvent = Tcl_DoOneEvent(mask);
|
||||
if (Tcl_Canceled(interp, TCL_LEAVE_ERR_MSG) == TCL_ERROR) {
|
||||
break;
|
||||
@@ -1826,7 +1866,7 @@ Tcl_VwaitObjCmd(
|
||||
|
||||
if (result == TCL_OK) {
|
||||
if (extended) {
|
||||
int k;
|
||||
Tcl_Size k;
|
||||
Tcl_Obj *listObj, *keyObj;
|
||||
|
||||
TclNewObj(listObj);
|
||||
@@ -1953,7 +1993,7 @@ int
|
||||
Tcl_UpdateObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
int flags = 0; /* Initialized to avoid compiler warning. */
|
||||
|
||||
+2133
-1593
File diff suppressed because it is too large
Load Diff
+67
-69
@@ -22,9 +22,37 @@ static int CopyRenameOneFile(Tcl_Interp *interp,
|
||||
int copyFlag, int force);
|
||||
static Tcl_Obj * FileBasename(Tcl_Interp *interp, Tcl_Obj *pathPtr);
|
||||
static int FileCopyRename(Tcl_Interp *interp,
|
||||
int objc, Tcl_Obj *const objv[], int copyFlag);
|
||||
static int FileForceOption(Tcl_Interp *interp,
|
||||
int objc, Tcl_Obj *const objv[], int *forcePtr);
|
||||
Tcl_Size objc, Tcl_Obj *const objv[], int copyFlag);
|
||||
static size_t FileForceOption(Tcl_Interp *interp,
|
||||
Tcl_Size objc, Tcl_Obj *const objv[], int *forcePtr);
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
*
|
||||
* CheckFilenameEncodable
|
||||
*
|
||||
* This checks if a filename can be encoded on the target platform,
|
||||
* disallowing things like naked surrogates, etc.
|
||||
*
|
||||
* Results:
|
||||
* A standard Tcl result.
|
||||
*
|
||||
* Side effects:
|
||||
* May update the interpreter result with an error message on failure.
|
||||
*
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
static inline int
|
||||
CheckFilenameEncodable(
|
||||
Tcl_Interp *interp,
|
||||
Tcl_Obj *fileName)
|
||||
{
|
||||
Tcl_DString ds;
|
||||
int code = Tcl_UtfToExternalDStringEx(interp, TCLFSENCODING,
|
||||
TclGetString(fileName), TCL_INDEX_NONE, 0, &ds, NULL);
|
||||
Tcl_DStringFree(&ds);
|
||||
return code == TCL_OK ? TCL_OK : TCL_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
@@ -50,7 +78,7 @@ TclFileRenameCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Interp for error reporting or recursive
|
||||
* calls in the case of a tricky rename. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument strings passed to Tcl_FileCmd. */
|
||||
{
|
||||
return FileCopyRename(interp, objc, objv, 0);
|
||||
@@ -79,7 +107,7 @@ TclFileCopyCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Used for error reporting or recursive calls
|
||||
* in the case of a tricky copy. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument strings passed to Tcl_FileCmd. */
|
||||
{
|
||||
return FileCopyRename(interp, objc, objv, 1);
|
||||
@@ -105,18 +133,18 @@ TclFileCopyCmd(
|
||||
static int
|
||||
FileCopyRename(
|
||||
Tcl_Interp *interp, /* Used for error reporting. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[], /* Argument strings passed to Tcl_FileCmd. */
|
||||
int copyFlag) /* If non-zero, copy source(s). Otherwise,
|
||||
* rename them. */
|
||||
{
|
||||
int i, result, force;
|
||||
int result, force;
|
||||
Tcl_Size i;
|
||||
Tcl_StatBuf statBuf;
|
||||
Tcl_Obj *target;
|
||||
Tcl_DString ds;
|
||||
|
||||
i = FileForceOption(interp, objc - 1, objv + 1, &force);
|
||||
if (i < 0) {
|
||||
if (i == TCL_INDEX_NONE) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
i++;
|
||||
@@ -135,12 +163,9 @@ FileCopyRename(
|
||||
if (Tcl_FSConvertToPathType(interp, target) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (Tcl_UtfToExternalDStringEx(interp, TCLFSENCODING, TclGetString(target),
|
||||
TCL_INDEX_NONE, 0, &ds, NULL) != TCL_OK) {
|
||||
Tcl_DStringFree(&ds);
|
||||
if (CheckFilenameEncodable(interp, target) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
Tcl_DStringFree(&ds);
|
||||
|
||||
result = TCL_OK;
|
||||
|
||||
@@ -223,16 +248,15 @@ int
|
||||
TclFileMakeDirsCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Used for error reporting. */
|
||||
int objc, /* Number of arguments */
|
||||
Tcl_Size objc, /* Number of arguments */
|
||||
Tcl_Obj *const objv[]) /* Argument strings passed to Tcl_FileCmd. */
|
||||
{
|
||||
Tcl_Obj *errfile = NULL;
|
||||
int result, i;
|
||||
Tcl_Size j, pobjc;
|
||||
int result;
|
||||
Tcl_Size i, j, pobjc;
|
||||
Tcl_Obj *split = NULL;
|
||||
Tcl_Obj *target = NULL;
|
||||
Tcl_StatBuf statBuf;
|
||||
Tcl_DString ds;
|
||||
|
||||
result = TCL_OK;
|
||||
for (i = 1; i < objc; i++) {
|
||||
@@ -240,13 +264,10 @@ TclFileMakeDirsCmd(
|
||||
result = TCL_ERROR;
|
||||
break;
|
||||
}
|
||||
if (Tcl_UtfToExternalDStringEx(interp, TCLFSENCODING, TclGetString(objv[i]),
|
||||
TCL_INDEX_NONE, 0, &ds, NULL) != TCL_OK) {
|
||||
Tcl_DStringFree(&ds);
|
||||
if (CheckFilenameEncodable(interp, objv[i]) != TCL_OK) {
|
||||
result = TCL_ERROR;
|
||||
break;
|
||||
}
|
||||
Tcl_DStringFree(&ds);
|
||||
|
||||
split = Tcl_FSSplitPath(objv[i], &pobjc);
|
||||
Tcl_IncrRefCount(split);
|
||||
@@ -356,16 +377,16 @@ int
|
||||
TclFileDeleteCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Used for error reporting */
|
||||
int objc, /* Number of arguments */
|
||||
Tcl_Size objc, /* Number of arguments */
|
||||
Tcl_Obj *const objv[]) /* Argument strings passed to Tcl_FileCmd. */
|
||||
{
|
||||
int i, force, result;
|
||||
int force, result;
|
||||
Tcl_Size i;
|
||||
Tcl_Obj *errfile;
|
||||
Tcl_Obj *errorBuffer = NULL;
|
||||
Tcl_DString ds;
|
||||
|
||||
i = FileForceOption(interp, objc - 1, objv + 1, &force);
|
||||
if (i < 0) {
|
||||
if (i == TCL_INDEX_NONE) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
@@ -380,13 +401,10 @@ TclFileDeleteCmd(
|
||||
result = TCL_ERROR;
|
||||
goto done;
|
||||
}
|
||||
if (Tcl_UtfToExternalDStringEx(interp, TCLFSENCODING, TclGetString(objv[i]),
|
||||
TCL_INDEX_NONE, 0, &ds, NULL) != TCL_OK) {
|
||||
Tcl_DStringFree(&ds);
|
||||
if (CheckFilenameEncodable(interp, objv[i]) != TCL_OK) {
|
||||
result = TCL_ERROR;
|
||||
goto done;
|
||||
}
|
||||
Tcl_DStringFree(&ds);
|
||||
|
||||
/*
|
||||
* Call lstat() to get info so can delete symbolic link itself.
|
||||
@@ -506,26 +524,19 @@ CopyRenameOneFile(
|
||||
Tcl_Obj *actualSource=NULL; /* If source is a link, then this is the real
|
||||
* file/directory. */
|
||||
Tcl_StatBuf sourceStatBuf, targetStatBuf;
|
||||
Tcl_DString ds;
|
||||
|
||||
if (Tcl_FSConvertToPathType(interp, source) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (Tcl_UtfToExternalDStringEx(interp, TCLFSENCODING, TclGetString(source),
|
||||
TCL_INDEX_NONE, 0, &ds, NULL) != TCL_OK) {
|
||||
Tcl_DStringFree(&ds);
|
||||
if (CheckFilenameEncodable(interp, source) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
Tcl_DStringFree(&ds);
|
||||
if (Tcl_FSConvertToPathType(interp, target) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (Tcl_UtfToExternalDStringEx(interp, TCLFSENCODING, TclGetString(target),
|
||||
TCL_INDEX_NONE, 0, &ds, NULL) != TCL_OK) {
|
||||
Tcl_DStringFree(&ds);
|
||||
if (CheckFilenameEncodable(interp, target) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
Tcl_DStringFree(&ds);
|
||||
|
||||
errfile = NULL;
|
||||
errorBuffer = NULL;
|
||||
@@ -852,16 +863,17 @@ CopyRenameOneFile(
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static int
|
||||
static size_t
|
||||
FileForceOption(
|
||||
Tcl_Interp *interp, /* Interp, for error return. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[], /* Argument strings. First command line
|
||||
* option, if it exists, begins at 0. */
|
||||
int *forcePtr) /* If the "-force" was specified, *forcePtr is
|
||||
* filled with 1, otherwise with 0. */
|
||||
{
|
||||
int force, i, idx;
|
||||
int force, idx;
|
||||
Tcl_Size i;
|
||||
static const char *const options[] = {
|
||||
"-force", "--", NULL
|
||||
};
|
||||
@@ -873,7 +885,7 @@ FileForceOption(
|
||||
}
|
||||
if (Tcl_GetIndexFromObj(interp, objv[i], options, "option", TCL_EXACT,
|
||||
&idx) != TCL_OK) {
|
||||
return -1;
|
||||
return TCL_INDEX_NONE;
|
||||
}
|
||||
if (idx == 0 /* -force */) {
|
||||
force = 1;
|
||||
@@ -976,7 +988,7 @@ int
|
||||
TclFileAttrsCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* The interpreter for error reporting. */
|
||||
int objc, /* Number of command line arguments. */
|
||||
Tcl_Size objc, /* Number of command line arguments. */
|
||||
Tcl_Obj *const objv[]) /* The command line objects. */
|
||||
{
|
||||
int result;
|
||||
@@ -985,7 +997,6 @@ TclFileAttrsCmd(
|
||||
Tcl_Obj *objStrings = NULL;
|
||||
Tcl_Size numObjStrings = TCL_INDEX_NONE;
|
||||
Tcl_Obj *filePtr;
|
||||
Tcl_DString ds;
|
||||
|
||||
if (objc < 2) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "name ?-option value ...?");
|
||||
@@ -996,12 +1007,9 @@ TclFileAttrsCmd(
|
||||
if (Tcl_FSConvertToPathType(interp, filePtr) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (Tcl_UtfToExternalDStringEx(interp, TCLFSENCODING, TclGetString(filePtr),
|
||||
TCL_INDEX_NONE, 0, &ds, NULL) != TCL_OK) {
|
||||
Tcl_DStringFree(&ds);
|
||||
if (CheckFilenameEncodable(interp, filePtr) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
Tcl_DStringFree(&ds);
|
||||
|
||||
objc -= 2;
|
||||
objv += 2;
|
||||
@@ -1133,7 +1141,8 @@ TclFileAttrsCmd(
|
||||
* Set option/value pairs.
|
||||
*/
|
||||
|
||||
int i, index;
|
||||
Tcl_Size i;
|
||||
int index;
|
||||
|
||||
if (numObjStrings == 0) {
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
@@ -1199,12 +1208,11 @@ int
|
||||
TclFileLinkCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
Tcl_Obj *contents;
|
||||
int index;
|
||||
Tcl_DString ds;
|
||||
|
||||
if (objc < 2 || objc > 4) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "?-linktype? linkname ?target?");
|
||||
@@ -1247,12 +1255,9 @@ TclFileLinkCmd(
|
||||
if (Tcl_FSConvertToPathType(interp, objv[index]) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (Tcl_UtfToExternalDStringEx(interp, TCLFSENCODING, TclGetString(objv[index]),
|
||||
TCL_INDEX_NONE, 0, &ds, NULL) != TCL_OK) {
|
||||
Tcl_DStringFree(&ds);
|
||||
if (CheckFilenameEncodable(interp, objv[index]) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
Tcl_DStringFree(&ds);
|
||||
|
||||
/*
|
||||
* Create link from source to target.
|
||||
@@ -1310,12 +1315,9 @@ TclFileLinkCmd(
|
||||
if (Tcl_FSConvertToPathType(interp, objv[index]) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (Tcl_UtfToExternalDStringEx(interp, TCLFSENCODING, TclGetString(objv[index]),
|
||||
TCL_INDEX_NONE, 0, &ds, NULL) != TCL_OK) {
|
||||
Tcl_DStringFree(&ds);
|
||||
if (CheckFilenameEncodable(interp, objv[index]) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
Tcl_DStringFree(&ds);
|
||||
|
||||
/*
|
||||
* Read link
|
||||
@@ -1363,11 +1365,10 @@ int
|
||||
TclFileReadLinkCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
Tcl_Obj *contents;
|
||||
Tcl_DString ds;
|
||||
|
||||
if (objc != 2) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "name");
|
||||
@@ -1377,12 +1378,9 @@ TclFileReadLinkCmd(
|
||||
if (Tcl_FSConvertToPathType(interp, objv[1]) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (Tcl_UtfToExternalDStringEx(interp, TCLFSENCODING, TclGetString(objv[1]),
|
||||
TCL_INDEX_NONE, 0, &ds, NULL) != TCL_OK) {
|
||||
Tcl_DStringFree(&ds);
|
||||
if (CheckFilenameEncodable(interp, objv[1]) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
Tcl_DStringFree(&ds);
|
||||
|
||||
contents = Tcl_FSLink(objv[1], NULL, 0);
|
||||
|
||||
@@ -1421,7 +1419,7 @@ int
|
||||
TclFileTemporaryCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
Tcl_Obj *nameVarObj = NULL; /* Variable to store the name of the temporary
|
||||
@@ -1580,7 +1578,7 @@ int
|
||||
TclFileTempDirCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
Tcl_Obj *dirNameObj; /* Object that will contain the directory
|
||||
@@ -1725,7 +1723,7 @@ int
|
||||
TclFileHomeCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
Tcl_Obj *homeDirObj;
|
||||
@@ -1763,7 +1761,7 @@ int
|
||||
TclFileTildeExpandCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
Tcl_Obj *expandedPathObj;
|
||||
|
||||
+10
-7
@@ -40,9 +40,10 @@ static int TclGlob(Tcl_Interp *interp, char *pattern,
|
||||
Tcl_GlobTypeData *types);
|
||||
|
||||
/* Flag values used by TclGlob() */
|
||||
|
||||
#define TCL_GLOBMODE_DIR 4
|
||||
#define TCL_GLOBMODE_TAILS 8
|
||||
enum GlobModeFlags {
|
||||
TCL_GLOBMODE_DIR = 4,
|
||||
TCL_GLOBMODE_TAILS = 8
|
||||
};
|
||||
|
||||
/*
|
||||
* When there is no support for getting the block size of a file in a stat()
|
||||
@@ -583,7 +584,9 @@ Tcl_SplitPath(
|
||||
|
||||
for (i = 0; i < *argcPtr; i++) {
|
||||
(*argvPtr)[i] = p;
|
||||
while (*(p++) != '\0');
|
||||
while (*(p++) != '\0') {
|
||||
// Empty body
|
||||
}
|
||||
}
|
||||
(*argvPtr)[i] = NULL;
|
||||
|
||||
@@ -1114,11 +1117,11 @@ int
|
||||
Tcl_GlobObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
int i, globFlags, join, dir, result;
|
||||
Tcl_Size length;
|
||||
int globFlags, join, dir, result;
|
||||
Tcl_Size i, length;
|
||||
char *string;
|
||||
const char *separators;
|
||||
Tcl_Obj *typePtr, *look;
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
*/
|
||||
|
||||
MODULE_SCOPE int TclFSCwdPointerEquals(Tcl_Obj **pathPtrPtr);
|
||||
MODULE_SCOPE int TclFSNormalizeToUniquePath(Tcl_Interp *interp,
|
||||
Tcl_Obj *pathPtr, int startAt);
|
||||
MODULE_SCOPE Tcl_Size TclFSNormalizeToUniquePath(Tcl_Interp *interp,
|
||||
Tcl_Obj *pathPtr, Tcl_Size startAt);
|
||||
MODULE_SCOPE Tcl_Obj * TclFSMakePathRelative(Tcl_Interp *interp,
|
||||
Tcl_Obj *pathPtr, Tcl_Obj *cwdPtr);
|
||||
MODULE_SCOPE int TclFSEnsureEpochOk(Tcl_Obj *pathPtr,
|
||||
|
||||
+65
-42
@@ -55,12 +55,13 @@ static Tcl_HashEntry * AllocStringEntry(Tcl_HashTable *tablePtr,
|
||||
* Function prototypes for static functions in this file:
|
||||
*/
|
||||
|
||||
static Tcl_HashEntry * BogusFind(Tcl_HashTable *tablePtr, const char *key);
|
||||
static Tcl_HashEntry * BogusCreate(Tcl_HashTable *tablePtr, const char *key,
|
||||
int *newPtr);
|
||||
static Tcl_HashEntry * CreateHashEntry(Tcl_HashTable *tablePtr, const char *key,
|
||||
int *newPtr);
|
||||
#ifndef TCL_NO_DEPRECATED
|
||||
static Tcl_HashEntry * FindHashEntry(Tcl_HashTable *tablePtr, const char *key);
|
||||
#endif
|
||||
static void RebuildTable(Tcl_HashTable *tablePtr);
|
||||
|
||||
const Tcl_HashKeyType tclArrayHashKeyType = {
|
||||
@@ -170,7 +171,9 @@ Tcl_InitCustomHashTable(
|
||||
tablePtr->downShift = 28;
|
||||
tablePtr->mask = 3;
|
||||
tablePtr->keyType = keyType;
|
||||
#ifndef TCL_NO_DEPRECATED
|
||||
tablePtr->findProc = FindHashEntry;
|
||||
#endif
|
||||
tablePtr->createProc = CreateHashEntry;
|
||||
|
||||
if (typePtr == NULL) {
|
||||
@@ -209,18 +212,20 @@ Tcl_InitCustomHashTable(
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef TCL_NO_DEPRECATED
|
||||
static Tcl_HashEntry *
|
||||
FindHashEntry(
|
||||
Tcl_HashTable *tablePtr, /* Table in which to lookup entry. */
|
||||
const char *key) /* Key to use to find matching entry. */
|
||||
{
|
||||
return CreateHashEntry(tablePtr, key, NULL);
|
||||
return tablePtr->createProc(tablePtr, key, TCL_HASH_FIND);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* CreateHashEntry --
|
||||
* Tcl_CreateHashEntry --
|
||||
*
|
||||
* Given a hash table with string keys, and a string key, find the entry
|
||||
* with a matching key. If there is no matching entry, then create a new
|
||||
@@ -238,6 +243,38 @@ FindHashEntry(
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
Tcl_HashEntry *
|
||||
Tcl_CreateHashEntry(
|
||||
Tcl_HashTable *tablePtr, /* Table in which to lookup entry. */
|
||||
const void *key, /* Key to use to find or create matching
|
||||
* entry. */
|
||||
int *newPtr) /* Store info here telling whether a new entry
|
||||
* was created. */
|
||||
{
|
||||
Tcl_HashEntry *entry = (*((tablePtr)->createProc))(tablePtr, (const char *)key, newPtr);
|
||||
if (!entry) {
|
||||
Tcl_Panic("%s: Memory overflow", "Tcl_CreateHashEntry");
|
||||
}
|
||||
return entry;
|
||||
}
|
||||
|
||||
Tcl_HashEntry *
|
||||
Tcl_DbCreateHashEntry(
|
||||
Tcl_HashTable *tablePtr, /* Table in which to lookup entry. */
|
||||
const void *key, /* Key to use to find or create matching
|
||||
* entry. */
|
||||
int *newPtr, /* Store info here telling whether a new entry
|
||||
* was created. */
|
||||
const char *file,
|
||||
int line)
|
||||
{
|
||||
Tcl_HashEntry *entry = (*((tablePtr)->createProc))(tablePtr, (const char *)key, newPtr);
|
||||
if (!entry) {
|
||||
Tcl_Panic("%s: Memory overflow in file %s:%d", "Tcl_CreateHashEntry", file, line);
|
||||
}
|
||||
return entry;
|
||||
}
|
||||
|
||||
static Tcl_HashEntry *
|
||||
CreateHashEntry(
|
||||
Tcl_HashTable *tablePtr, /* Table in which to lookup entry. */
|
||||
@@ -325,7 +362,7 @@ CreateHashEntry(
|
||||
}
|
||||
}
|
||||
|
||||
if (!newPtr || (newPtr == TCL_HASH_FIND)) {
|
||||
if (newPtr == TCL_HASH_FIND) {
|
||||
/* This is the findProc functionality, so we are done. */
|
||||
return NULL;
|
||||
}
|
||||
@@ -334,11 +371,16 @@ CreateHashEntry(
|
||||
* Entry not found. Add a new one to the bucket.
|
||||
*/
|
||||
|
||||
*newPtr = 1;
|
||||
if (newPtr) {
|
||||
*newPtr = 1;
|
||||
}
|
||||
if (typePtr->allocEntryProc) {
|
||||
hPtr = typePtr->allocEntryProc(tablePtr, (void *) key);
|
||||
} else {
|
||||
hPtr = (Tcl_HashEntry *)Tcl_Alloc(sizeof(Tcl_HashEntry));
|
||||
hPtr = (Tcl_HashEntry *)Tcl_AttemptAlloc(sizeof(Tcl_HashEntry));
|
||||
if (!hPtr) {
|
||||
return NULL;
|
||||
}
|
||||
hPtr->key.oneWordValue = (char *) key;
|
||||
Tcl_SetHashValue(hPtr, NULL);
|
||||
}
|
||||
@@ -502,7 +544,9 @@ Tcl_DeleteHashTable(
|
||||
* re-initialization.
|
||||
*/
|
||||
|
||||
tablePtr->findProc = BogusFind;
|
||||
#ifndef TCL_NO_DEPRECATED
|
||||
tablePtr->findProc = FindHashEntry;
|
||||
#endif
|
||||
tablePtr->createProc = BogusCreate;
|
||||
}
|
||||
|
||||
@@ -682,10 +726,12 @@ AllocArrayEntry(
|
||||
if (size < sizeof(Tcl_HashEntry)) {
|
||||
size = sizeof(Tcl_HashEntry);
|
||||
}
|
||||
hPtr = (Tcl_HashEntry *)Tcl_Alloc(size);
|
||||
hPtr = (Tcl_HashEntry *)Tcl_AttemptAlloc(size);
|
||||
|
||||
memcpy(hPtr->key.string, keyPtr, count);
|
||||
Tcl_SetHashValue(hPtr, NULL);
|
||||
if (hPtr) {
|
||||
memcpy(hPtr->key.string, keyPtr, count);
|
||||
Tcl_SetHashValue(hPtr, NULL);
|
||||
}
|
||||
|
||||
return hPtr;
|
||||
}
|
||||
@@ -780,10 +826,12 @@ AllocStringEntry(
|
||||
if (size < sizeof(hPtr->key)) {
|
||||
allocsize = sizeof(hPtr->key);
|
||||
}
|
||||
hPtr = (Tcl_HashEntry *)Tcl_Alloc(offsetof(Tcl_HashEntry, key) + allocsize);
|
||||
memset(hPtr, 0, offsetof(Tcl_HashEntry, key) + allocsize);
|
||||
memcpy(hPtr->key.string, string, size);
|
||||
Tcl_SetHashValue(hPtr, NULL);
|
||||
hPtr = (Tcl_HashEntry *)Tcl_AttemptAlloc(offsetof(Tcl_HashEntry, key) + allocsize);
|
||||
if (hPtr) {
|
||||
memset(hPtr, 0, offsetof(Tcl_HashEntry, key) + allocsize);
|
||||
memcpy(hPtr->key.string, string, size);
|
||||
Tcl_SetHashValue(hPtr, NULL);
|
||||
}
|
||||
return hPtr;
|
||||
}
|
||||
|
||||
@@ -878,32 +926,6 @@ TclHashStringKey(
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* BogusFind --
|
||||
*
|
||||
* This function is invoked when Tcl_FindHashEntry is called on a
|
||||
* table that has been deleted.
|
||||
*
|
||||
* Results:
|
||||
* If Tcl_Panic returns (which it shouldn't) this function returns NULL.
|
||||
*
|
||||
* Side effects:
|
||||
* Generates a panic.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static Tcl_HashEntry *
|
||||
BogusFind(
|
||||
TCL_UNUSED(Tcl_HashTable *),
|
||||
TCL_UNUSED(const char *))
|
||||
{
|
||||
Tcl_Panic("called %s on deleted table", "Tcl_FindHashEntry");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
@@ -925,9 +947,10 @@ static Tcl_HashEntry *
|
||||
BogusCreate(
|
||||
TCL_UNUSED(Tcl_HashTable *),
|
||||
TCL_UNUSED(const char *),
|
||||
TCL_UNUSED(int *))
|
||||
int *isNew)
|
||||
{
|
||||
Tcl_Panic("called %s on deleted table", "Tcl_CreateHashEntry");
|
||||
Tcl_Panic("called %s on deleted table",
|
||||
(isNew != TCL_HASH_FIND)? "Tcl_CreateHashEntry" : "Tcl_FindHashEntry");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ Tcl_RecordAndEvalObj(
|
||||
|
||||
result = Tcl_GetCommandInfo(interp, "::history", &info);
|
||||
if (result && (info.deleteProc == TclProcDeleteProc)) {
|
||||
Proc *procPtr = (Proc *) info.objClientData;
|
||||
Proc *procPtr = (Proc *) info.objClientData2;
|
||||
call = (procPtr->cmdPtr->compileProc != TclCompileNoOp);
|
||||
}
|
||||
|
||||
|
||||
+57
-36
@@ -136,6 +136,12 @@ typedef struct {
|
||||
|
||||
static Tcl_ThreadDataKey dataKey;
|
||||
|
||||
/*
|
||||
* Key for looking up the channel table (a Tcl_HashTable indexed by channel
|
||||
* name) in the interpreter's associated data table.
|
||||
*/
|
||||
#define ASSOC_KEY "tclIO"
|
||||
|
||||
/*
|
||||
* Structure to record a close callback. One such record exists for
|
||||
* each close callback registered for a channel.
|
||||
@@ -230,12 +236,12 @@ static Tcl_Size Write(Channel *chanPtr, const char *src,
|
||||
static Tcl_Obj * FixLevelCode(Tcl_Obj *msg);
|
||||
static void SpliceChannel(Tcl_Channel chan);
|
||||
static void CutChannel(Tcl_Channel chan);
|
||||
static int WillRead(Channel *chanPtr);
|
||||
static int WillRead(Channel *chanPtr);
|
||||
|
||||
#define WriteChars(chanPtr, src, srcLen) \
|
||||
Write(chanPtr, src, srcLen, chanPtr->state->encoding)
|
||||
Write(chanPtr, src, srcLen, chanPtr->state->encoding)
|
||||
#define WriteBytes(chanPtr, src, srcLen) \
|
||||
Write(chanPtr, src, srcLen, tclIdentityEncoding)
|
||||
Write(chanPtr, src, srcLen, tclIdentityEncoding)
|
||||
|
||||
/*
|
||||
* Simplifying helper macros. All may use their argument(s) multiple times.
|
||||
@@ -334,11 +340,11 @@ static void DupChannelInternalRep(Tcl_Obj *objPtr, Tcl_Obj *copyPtr);
|
||||
static void FreeChannelInternalRep(Tcl_Obj *objPtr);
|
||||
|
||||
static const Tcl_ObjType chanObjType = {
|
||||
"channel", /* name for this type */
|
||||
FreeChannelInternalRep, /* freeIntRepProc */
|
||||
DupChannelInternalRep, /* dupIntRepProc */
|
||||
NULL, /* updateStringProc */
|
||||
NULL, /* setFromAnyProc */
|
||||
"channel",
|
||||
FreeChannelInternalRep,
|
||||
DupChannelInternalRep,
|
||||
NULL, // UpdateString
|
||||
NULL, // SetFromAny
|
||||
TCL_OBJTYPE_V0
|
||||
};
|
||||
|
||||
@@ -359,8 +365,8 @@ static const Tcl_ObjType chanObjType = {
|
||||
} while (0)
|
||||
|
||||
#define BUSY_STATE(st, fl) \
|
||||
((((st)->csPtrR) && ((fl) & TCL_READABLE)) || \
|
||||
(((st)->csPtrW) && ((fl) & TCL_WRITABLE)))
|
||||
((((st)->csPtrR) && ((fl) & TCL_READABLE)) || \
|
||||
(((st)->csPtrW) && ((fl) & TCL_WRITABLE)))
|
||||
|
||||
#define MAX_CHANNEL_BUFFER_SIZE (1024*1024)
|
||||
|
||||
@@ -737,8 +743,10 @@ Tcl_SetStdChannel(
|
||||
tsdPtr->stderrInitialized = init;
|
||||
tsdPtr->stderrChannel = channel;
|
||||
if (channel) {
|
||||
ENCODING_PROFILE_SET(((Channel *)channel)->state->inputEncodingFlags, TCL_ENCODING_PROFILE_REPLACE);
|
||||
ENCODING_PROFILE_SET(((Channel *)channel)->state->outputEncodingFlags, TCL_ENCODING_PROFILE_REPLACE);
|
||||
ENCODING_PROFILE_SET(((Channel *)channel)->state->inputEncodingFlags,
|
||||
TCL_ENCODING_PROFILE_REPLACE);
|
||||
ENCODING_PROFILE_SET(((Channel *)channel)->state->outputEncodingFlags,
|
||||
TCL_ENCODING_PROFILE_REPLACE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -810,8 +818,10 @@ Tcl_GetStdChannel(
|
||||
tsdPtr->stderrInitialized = -1;
|
||||
tsdPtr->stderrChannel = TclpGetDefaultStdChannel(TCL_STDERR);
|
||||
if (tsdPtr->stderrChannel != NULL) {
|
||||
ENCODING_PROFILE_SET(((Channel *)tsdPtr->stderrChannel)->state->inputEncodingFlags, TCL_ENCODING_PROFILE_REPLACE);
|
||||
ENCODING_PROFILE_SET(((Channel *)tsdPtr->stderrChannel)->state->outputEncodingFlags, TCL_ENCODING_PROFILE_REPLACE);
|
||||
ENCODING_PROFILE_SET(((Channel *)tsdPtr->stderrChannel)->state->inputEncodingFlags,
|
||||
TCL_ENCODING_PROFILE_REPLACE);
|
||||
ENCODING_PROFILE_SET(((Channel *)tsdPtr->stderrChannel)->state->outputEncodingFlags,
|
||||
TCL_ENCODING_PROFILE_REPLACE);
|
||||
tsdPtr->stderrInitialized = 1;
|
||||
Tcl_RegisterChannel(NULL, tsdPtr->stderrChannel);
|
||||
}
|
||||
@@ -931,11 +941,11 @@ GetChannelTable(
|
||||
Tcl_HashTable *hTblPtr; /* Hash table of channels. */
|
||||
Tcl_Channel stdinChan, stdoutChan, stderrChan;
|
||||
|
||||
hTblPtr = (Tcl_HashTable *)Tcl_GetAssocData(interp, "tclIO", NULL);
|
||||
hTblPtr = (Tcl_HashTable *)Tcl_GetAssocData(interp, ASSOC_KEY, NULL);
|
||||
if (hTblPtr == NULL) {
|
||||
hTblPtr = (Tcl_HashTable *)Tcl_Alloc(sizeof(Tcl_HashTable));
|
||||
Tcl_InitHashTable(hTblPtr, TCL_STRING_KEYS);
|
||||
Tcl_SetAssocData(interp, "tclIO",
|
||||
Tcl_SetAssocData(interp, ASSOC_KEY,
|
||||
(Tcl_InterpDeleteProc *) DeleteChannelTable, hTblPtr);
|
||||
|
||||
/*
|
||||
@@ -1371,7 +1381,7 @@ DetachChannel(
|
||||
statePtr = chanPtr->state;
|
||||
|
||||
if (interp != NULL) {
|
||||
hTblPtr = (Tcl_HashTable *)Tcl_GetAssocData(interp, "tclIO", NULL);
|
||||
hTblPtr = (Tcl_HashTable *)Tcl_GetAssocData(interp, ASSOC_KEY, NULL);
|
||||
if (hTblPtr == NULL) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -1616,10 +1626,12 @@ Tcl_CreateChannel(
|
||||
Tcl_Panic("channel type %s must define close2Proc", typePtr->typeName);
|
||||
}
|
||||
if ((TCL_READABLE & mask) && (NULL == typePtr->inputProc)) {
|
||||
Tcl_Panic("channel type %s must define inputProc when used for reader channel", typePtr->typeName);
|
||||
Tcl_Panic("channel type %s must define inputProc when used for reader channel",
|
||||
typePtr->typeName);
|
||||
}
|
||||
if ((TCL_WRITABLE & mask) && (NULL == typePtr->outputProc)) {
|
||||
Tcl_Panic("channel type %s must define outputProc when used for writer channel", typePtr->typeName);
|
||||
Tcl_Panic("channel type %s must define outputProc when used for writer channel",
|
||||
typePtr->typeName);
|
||||
}
|
||||
if (NULL == typePtr->watchProc) {
|
||||
Tcl_Panic("channel type %s must define watchProc", typePtr->typeName);
|
||||
@@ -1643,7 +1655,7 @@ Tcl_CreateChannel(
|
||||
*/
|
||||
|
||||
if (chanName != NULL) {
|
||||
unsigned len = strlen(chanName) + 1;
|
||||
size_t len = strlen(chanName) + 1;
|
||||
|
||||
/*
|
||||
* Make sure we allocate at least 7 bytes, so it fits for "stdout"
|
||||
@@ -2437,9 +2449,9 @@ Tcl_GetChannelHandle(
|
||||
|
||||
int
|
||||
Tcl_RemoveChannelMode(
|
||||
Tcl_Interp *interp, /* The interp for an error message. Allowed to be NULL. */
|
||||
Tcl_Channel chan, /* The channel which is modified. */
|
||||
int mode) /* The access mode to drop from the channel */
|
||||
Tcl_Interp *interp, /* The interp for an error message. Allowed to be NULL. */
|
||||
Tcl_Channel chan, /* The channel which is modified. */
|
||||
int mode) /* The access mode to drop from the channel */
|
||||
{
|
||||
const char* emsg;
|
||||
ChannelState *statePtr = ((Channel *) chan)->state;
|
||||
@@ -2457,7 +2469,7 @@ Tcl_RemoveChannelMode(
|
||||
ResetFlag(statePtr, mode);
|
||||
return TCL_OK;
|
||||
|
||||
error:
|
||||
error:
|
||||
if (interp != NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"Tcl_RemoveChannelMode error: %s. Channel: \"%s\"",
|
||||
@@ -2801,7 +2813,7 @@ FlushChannel(
|
||||
*/
|
||||
|
||||
PreserveChannelBuffer(bufPtr);
|
||||
written = ChanWrite(chanPtr, RemovePoint(bufPtr), BytesLeft(bufPtr),
|
||||
written = (int)ChanWrite(chanPtr, RemovePoint(bufPtr), BytesLeft(bufPtr),
|
||||
&errorCode);
|
||||
|
||||
/*
|
||||
@@ -6441,7 +6453,7 @@ ReadChars(
|
||||
* we only have the one decoded char?
|
||||
*/
|
||||
|
||||
if (code != TCL_OK) {
|
||||
if (1 || code != TCL_OK) {
|
||||
int read, decoded, count;
|
||||
char buffer[TCL_UTF_MAX + 1];
|
||||
|
||||
@@ -6473,7 +6485,16 @@ ReadChars(
|
||||
code = TCL_OK;
|
||||
}
|
||||
|
||||
if (count == 2) {
|
||||
assert(count <= 2);
|
||||
if (count == 1) {
|
||||
assert(buffer[0] == '\r');
|
||||
if (GotFlag(statePtr, CHANNEL_EOF)) {
|
||||
dst[0] = '\r';
|
||||
bufPtr->nextRemoved = bufPtr->nextAdded;
|
||||
Tcl_SetObjLength(objPtr, numBytes + 1);
|
||||
return 1;
|
||||
}
|
||||
} else if (count == 2) {
|
||||
if (buffer[1] == '\n') {
|
||||
/* \r\n translate to \n */
|
||||
dst[0] = '\n';
|
||||
@@ -6488,7 +6509,6 @@ ReadChars(
|
||||
Tcl_SetObjLength(objPtr, numBytes + 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
} else if (GotFlag(statePtr, CHANNEL_EOF)) {
|
||||
/*
|
||||
* The bare \r is the only char and we will never read a
|
||||
@@ -8056,7 +8076,7 @@ Tcl_GetChannelOption(
|
||||
Tcl_DStringAppendElement(dsPtr, "-encoding");
|
||||
}
|
||||
Tcl_DStringAppendElement(dsPtr,
|
||||
Tcl_GetEncodingName(statePtr->encoding));
|
||||
Tcl_GetEncodingName(statePtr->encoding));
|
||||
if (len > 0) {
|
||||
return TCL_OK;
|
||||
}
|
||||
@@ -9229,7 +9249,7 @@ Tcl_FileEventObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Interpreter in which the channel for which
|
||||
* to create the handler is found. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Channel *chanPtr; /* The channel to create the handler for. */
|
||||
@@ -9422,7 +9442,8 @@ TclCopyChannel(
|
||||
* completed.
|
||||
*/
|
||||
|
||||
csPtr = (CopyState *)Tcl_Alloc(offsetof(CopyState, buffer) + 1U + !moveBytes * inStatePtr->bufSize);
|
||||
csPtr = (CopyState *)
|
||||
Tcl_Alloc(offsetof(CopyState, buffer) + 1U + !moveBytes * inStatePtr->bufSize);
|
||||
csPtr->bufSize = !moveBytes * inStatePtr->bufSize;
|
||||
csPtr->readPtr = inPtr;
|
||||
csPtr->writePtr = outPtr;
|
||||
@@ -9801,7 +9822,7 @@ CopyData(
|
||||
|
||||
if (moveBytes) {
|
||||
size = DoRead(inStatePtr->topChanPtr, csPtr->buffer, sizeb,
|
||||
!GotFlag(inStatePtr, CHANNEL_NONBLOCKING));
|
||||
!GotFlag(inStatePtr, CHANNEL_NONBLOCKING));
|
||||
} else {
|
||||
size = DoReadChars(inStatePtr->topChanPtr, bufObj, sizeb,
|
||||
!GotFlag(inStatePtr, CHANNEL_NONBLOCKING)
|
||||
@@ -10164,8 +10185,7 @@ DoRead(
|
||||
}
|
||||
|
||||
if (!bufPtr) {
|
||||
readErr:
|
||||
|
||||
readErr:
|
||||
UpdateInterest(chanPtr);
|
||||
TclChannelRelease((Tcl_Channel)chanPtr);
|
||||
return -1;
|
||||
@@ -10701,7 +10721,7 @@ Tcl_IsChannelRegistered(
|
||||
chanPtr = ((Channel *) chan)->state->bottomChanPtr;
|
||||
statePtr = chanPtr->state;
|
||||
|
||||
hTblPtr = (Tcl_HashTable *)Tcl_GetAssocData(interp, "tclIO", NULL);
|
||||
hTblPtr = (Tcl_HashTable *)Tcl_GetAssocData(interp, ASSOC_KEY, NULL);
|
||||
if (hTblPtr == NULL) {
|
||||
return 0;
|
||||
}
|
||||
@@ -11521,7 +11541,8 @@ DumpFlags(
|
||||
int i = 0;
|
||||
char buf[24];
|
||||
|
||||
#define ChanFlag(chr, bit) (buf[i++] = ((flags & (bit)) ? (chr) : '_'))
|
||||
#define ChanFlag(chr, bit) \
|
||||
(buf[i++] = ((flags & (bit)) ? (chr) : '_'))
|
||||
|
||||
ChanFlag('r', TCL_READABLE);
|
||||
ChanFlag('w', TCL_WRITABLE);
|
||||
|
||||
+51
-63
@@ -95,7 +95,7 @@ typedef struct EventScriptRecord {
|
||||
*/
|
||||
|
||||
typedef struct Channel {
|
||||
struct ChannelState *state; /* Split out state information */
|
||||
struct ChannelState *state; /* Split out state information */
|
||||
void *instanceData; /* Instance-specific data provided by creator
|
||||
* of channel. */
|
||||
const Tcl_ChannelType *typePtr; /* Pointer to channel type structure. */
|
||||
@@ -158,11 +158,6 @@ typedef struct ChannelState {
|
||||
* of line sequences in output? */
|
||||
int inEofChar; /* If nonzero, use this as a signal of EOF on
|
||||
* input. */
|
||||
#if TCL_MAJOR_VERSION < 9
|
||||
int outEofChar; /* If nonzero, append this to the channel when
|
||||
* it is closed if it is open for writing.
|
||||
* For Tcl 8.x only */
|
||||
#endif
|
||||
int unreportedError; /* Non-zero if an error report was deferred
|
||||
* because it happened in the background. The
|
||||
* value is the POSIX error code. */
|
||||
@@ -232,63 +227,56 @@ typedef struct ChannelState {
|
||||
* options and state bits about the channel. In addition to the flags below,
|
||||
* the channel can also have TCL_READABLE (1<<1) and TCL_WRITABLE (1<<2) set.
|
||||
*/
|
||||
|
||||
#define CHANNEL_NONBLOCKING (1<<6) /* Channel is currently in nonblocking
|
||||
* mode. */
|
||||
#define BG_FLUSH_SCHEDULED (1<<7) /* A background flush of the queued
|
||||
* output buffers has been
|
||||
* scheduled. */
|
||||
#define CHANNEL_CLOSED (1<<8) /* Channel has been closed. No further
|
||||
* Tcl-level IO on the channel is
|
||||
* allowed. */
|
||||
#define CHANNEL_EOF (1<<9) /* EOF occurred on this channel. This
|
||||
* bit is cleared before every input
|
||||
* operation. */
|
||||
#define CHANNEL_STICKY_EOF (1<<10) /* EOF occurred on this channel
|
||||
* because we saw the input
|
||||
* eofChar. This bit prevents clearing
|
||||
* of the EOF bit before every input
|
||||
* operation. */
|
||||
#define CHANNEL_BLOCKED (1<<11) /* EWOULDBLOCK or EAGAIN occurred on
|
||||
* this channel. This bit is cleared
|
||||
* before every input or output
|
||||
* operation. */
|
||||
#define INPUT_SAW_CR (1<<12) /* Channel is in CRLF eol input
|
||||
* translation mode and the last byte
|
||||
* seen was a "\r". */
|
||||
#define CHANNEL_DEAD (1<<13) /* The channel has been closed by the
|
||||
* exit handler (on exit) but not
|
||||
* deallocated. When any IO operation
|
||||
* sees this flag on a channel, it
|
||||
* does not call driver level
|
||||
* functions to avoid referring to
|
||||
* deallocated data. */
|
||||
#define CHANNEL_NEED_MORE_DATA (1<<14) /* The last input operation failed
|
||||
* because there was not enough data
|
||||
* to complete the operation. This
|
||||
* flag is set when gets fails to get
|
||||
* a complete line or when read fails
|
||||
* to get a complete character. When
|
||||
* set, file events will not be
|
||||
* 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_LINEBUFFERED (1<<17) /* Output to the channel must be
|
||||
* flushed after every newline. */
|
||||
#define CHANNEL_UNBUFFERED (1<<18) /* Output to the channel must always
|
||||
* be flushed immediately. */
|
||||
#define CHANNEL_INCLOSE (1<<19) /* Channel is currently being closed.
|
||||
* Its structures are still live and
|
||||
* usable, but it may not be closed
|
||||
* again from within the close
|
||||
* handler. */
|
||||
#define CHANNEL_CLOSEDWRITE (1<<21) /* Channel write side has been closed.
|
||||
* No further Tcl-level write IO on
|
||||
* the channel is allowed. */
|
||||
enum ChannelStateFlags {
|
||||
CHANNEL_NONBLOCKING = 1<<6, /* Channel is currently in nonblocking mode. */
|
||||
BG_FLUSH_SCHEDULED = 1<<7, /* A background flush of the queued output
|
||||
* buffers has been scheduled. */
|
||||
CHANNEL_CLOSED = 1<<8, /* Channel has been closed. No further
|
||||
* Tcl-level IO on the channel is allowed. */
|
||||
CHANNEL_EOF = 1<<9, /* EOF occurred on this channel. This bit is
|
||||
* cleared before every input operation. */
|
||||
CHANNEL_STICKY_EOF = 1<<10, /* EOF occurred on this channel because we saw
|
||||
* the input eofChar. This bit prevents
|
||||
* clearing of the EOF bit before every input
|
||||
* operation. */
|
||||
CHANNEL_BLOCKED = 1<<11, /* EWOULDBLOCK or EAGAIN occurred on this
|
||||
* channel. This bit is cleared before every
|
||||
* input or output operation. */
|
||||
INPUT_SAW_CR = 1<<12, /* Channel is in CRLF eol input translation
|
||||
* mode and the last byte seen was a "\r". */
|
||||
CHANNEL_DEAD = 1<<13, /* The channel has been closed by the exit
|
||||
* handler (on exit) but not deallocated. When
|
||||
* any IO operation sees this flag on a
|
||||
* channel, it does not call driver level
|
||||
* functions to avoid referring to
|
||||
* deallocated data. */
|
||||
CHANNEL_NEED_MORE_DATA = 1<<14,
|
||||
/* The last input operation failed because
|
||||
* there was not enough data to complete the
|
||||
* operation. This flag is set when gets fails
|
||||
* to get a complete line or when read fails
|
||||
* to get a complete character. When set, file
|
||||
* events will not be delivered for buffered
|
||||
* data until the state of the channel
|
||||
* changes. */
|
||||
CHANNEL_ENCODING_ERROR = 1<<15,
|
||||
/* Set if the channel encountered an
|
||||
* encoding error. */
|
||||
CHANNEL_RAW_MODE = 1<<16, /* When set, notes that the Raw API is
|
||||
* being used. */
|
||||
CHANNEL_LINEBUFFERED = 1<<17,
|
||||
/* Output to the channel must be flushed
|
||||
* after every newline. */
|
||||
CHANNEL_UNBUFFERED = 1<<18, /* Output to the channel must always be
|
||||
* flushed immediately. */
|
||||
CHANNEL_INCLOSE = 1<<19, /* Channel is currently being closed. Its
|
||||
* structures are still live and usable, but
|
||||
* it may not be closed again from within the
|
||||
* close handler. */
|
||||
CHANNEL_CLOSEDWRITE = 1<<21 /* Channel write side has been closed. No
|
||||
* further Tcl-level write IO on the channel
|
||||
* is allowed. */
|
||||
};
|
||||
|
||||
/*
|
||||
* The length of time to wait between synthetic timer events. Must be zero or
|
||||
|
||||
+93
-93
@@ -34,14 +34,23 @@ typedef struct {
|
||||
|
||||
static Tcl_ThreadDataKey dataKey;
|
||||
|
||||
/*
|
||||
* Key for looking up the table of registered TCP accept callbacks, a hash
|
||||
* table indexed by AcceptCallback references, used as a set (values are
|
||||
* meaningless).
|
||||
*/
|
||||
#define ASSOC_KEY "tclTCPAcceptCallbacks"
|
||||
|
||||
/*
|
||||
* Static functions for this file:
|
||||
*/
|
||||
|
||||
static Tcl_ExitProc FinalizeIOCmdTSD;
|
||||
static Tcl_TcpAcceptProc AcceptCallbackProc;
|
||||
static Tcl_ObjCmdProc ChanPendingObjCmd;
|
||||
static Tcl_ObjCmdProc ChanTruncateObjCmd;
|
||||
static Tcl_ExitProc FinalizeIOCmdTSD;
|
||||
static Tcl_TcpAcceptProc AcceptCallbackProc;
|
||||
static Tcl_ObjCmdProc2 ChanIsBinaryCmd;
|
||||
static Tcl_ObjCmdProc2 ChanPendingObjCmd;
|
||||
static Tcl_ObjCmdProc2 ChanPipeObjCmd;
|
||||
static Tcl_ObjCmdProc2 ChanTruncateObjCmd;
|
||||
static void RegisterTcpServerInterpCleanup(
|
||||
Tcl_Interp *interp,
|
||||
AcceptCallback *acceptCallbackPtr);
|
||||
@@ -50,6 +59,34 @@ static void TcpServerCloseProc(void *callbackData);
|
||||
static void UnregisterTcpServerInterpCleanupProc(
|
||||
Tcl_Interp *interp,
|
||||
AcceptCallback *acceptCallbackPtr);
|
||||
|
||||
/*
|
||||
* The basic description of the parts of the [chan] ensemble.
|
||||
* Also contains [chan configure], which is [fconfigure].
|
||||
*/
|
||||
const EnsembleImplMap tclChanImplMap[] = {
|
||||
{"blocked", Tcl_FblockedObjCmd, TclCompileBasic1ArgCmd, NULL, NULL, 0},
|
||||
{"close", Tcl_CloseObjCmd, TclCompileBasic1Or2ArgCmd, NULL, NULL, 0},
|
||||
{"copy", Tcl_FcopyObjCmd, NULL, NULL, NULL, 0},
|
||||
{"create", TclChanCreateObjCmd, TclCompileBasic2ArgCmd, NULL, NULL, 0}, /* TIP #219 */
|
||||
{"eof", Tcl_EofObjCmd, TclCompileBasic1ArgCmd, NULL, NULL, 0},
|
||||
{"event", Tcl_FileEventObjCmd, TclCompileBasic2Or3ArgCmd, NULL, NULL, 0},
|
||||
{"flush", Tcl_FlushObjCmd, TclCompileBasic1ArgCmd, NULL, NULL, 0},
|
||||
{"gets", Tcl_GetsObjCmd, TclCompileBasic1Or2ArgCmd, NULL, NULL, 0},
|
||||
{"isbinary", ChanIsBinaryCmd, TclCompileBasic1ArgCmd, NULL, NULL, 0},
|
||||
{"names", TclChannelNamesCmd, TclCompileBasic0Or1ArgCmd, NULL, NULL, 0},
|
||||
{"pending", ChanPendingObjCmd, TclCompileBasic2ArgCmd, NULL, NULL, 0}, /* TIP #287 */
|
||||
{"pipe", ChanPipeObjCmd, TclCompileBasic0ArgCmd, NULL, NULL, 0}, /* TIP #304 */
|
||||
{"pop", TclChanPopObjCmd, TclCompileBasic1ArgCmd, NULL, NULL, 0}, /* TIP #230 */
|
||||
{"postevent", TclChanPostEventObjCmd, TclCompileBasic2ArgCmd, NULL, NULL, 0}, /* TIP #219 */
|
||||
{"push", TclChanPushObjCmd, TclCompileBasic2ArgCmd, NULL, NULL, 0}, /* TIP #230 */
|
||||
{"puts", Tcl_PutsObjCmd, NULL, NULL, NULL, 0},
|
||||
{"read", Tcl_ReadObjCmd, NULL, NULL, NULL, 0},
|
||||
{"seek", Tcl_SeekObjCmd, TclCompileBasic2Or3ArgCmd, NULL, NULL, 0},
|
||||
{"tell", Tcl_TellObjCmd, TclCompileBasic1ArgCmd, NULL, NULL, 0},
|
||||
{"truncate", ChanTruncateObjCmd, TclCompileBasic1Or2ArgCmd, NULL, NULL, 0}, /* TIP #208 */
|
||||
{NULL, NULL, NULL, NULL, NULL, 0}
|
||||
};
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
@@ -101,7 +138,7 @@ int
|
||||
Tcl_PutsObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Tcl_Channel chan; /* The channel to puts on. */
|
||||
@@ -214,7 +251,7 @@ int
|
||||
Tcl_FlushObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Tcl_Obj *chanObjPtr;
|
||||
@@ -278,7 +315,7 @@ int
|
||||
Tcl_GetsObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Tcl_Channel chan; /* The channel to read from. */
|
||||
@@ -364,14 +401,15 @@ int
|
||||
Tcl_ReadObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Tcl_Channel chan; /* The channel to read from. */
|
||||
int newline, i; /* Discard newline at end? */
|
||||
Tcl_WideInt toRead; /* How many bytes to read? */
|
||||
Tcl_Size charactersRead; /* How many characters were read? */
|
||||
int newline; /* Discard newline at end? */
|
||||
Tcl_WideInt toRead; /* How many bytes to read? */
|
||||
Tcl_Size charactersRead; /* How many characters were read? */
|
||||
int mode; /* Mode in which channel is opened. */
|
||||
Tcl_Size i;
|
||||
Tcl_Obj *resultPtr, *chanObjPtr;
|
||||
|
||||
if ((objc != 2) && (objc != 3)) {
|
||||
@@ -501,7 +539,7 @@ int
|
||||
Tcl_SeekObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Tcl_Channel chan; /* The channel to tell on. */
|
||||
@@ -576,7 +614,7 @@ int
|
||||
Tcl_TellObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Tcl_Channel chan; /* The channel to tell on. */
|
||||
@@ -637,7 +675,7 @@ int
|
||||
Tcl_CloseObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Tcl_Channel chan; /* The channel to close. */
|
||||
@@ -745,12 +783,12 @@ int
|
||||
Tcl_FconfigureObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
const char *optionName, *valueName;
|
||||
Tcl_Channel chan; /* The channel to set a mode on. */
|
||||
int i; /* Iterate over arg-value pairs. */
|
||||
Tcl_Size i; /* Iterate over arg-value pairs. */
|
||||
|
||||
if ((objc < 2) || (((objc % 2) == 1) && (objc != 3))) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "channel ?-option value ...?");
|
||||
@@ -820,7 +858,7 @@ int
|
||||
Tcl_EofObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Tcl_Channel chan;
|
||||
@@ -860,7 +898,7 @@ static int
|
||||
ChanIsBinaryCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Tcl_Channel chan;
|
||||
@@ -899,7 +937,7 @@ int
|
||||
Tcl_ExecObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Tcl_Obj *resultPtr;
|
||||
@@ -907,8 +945,8 @@ Tcl_ExecObjCmd(
|
||||
* on the _Tcl_ stack. */
|
||||
const char *string;
|
||||
Tcl_Channel chan;
|
||||
int argc, background, i, index, keepNewline, result, skip, ignoreStderr;
|
||||
Tcl_Size length;
|
||||
int background, i, index, keepNewline, result, ignoreStderr;
|
||||
Tcl_Size argc, length, skip;
|
||||
static const char *const options[] = {
|
||||
"-ignorestderr", "-keepnewline", "-encoding", "--", NULL
|
||||
};
|
||||
@@ -945,8 +983,7 @@ Tcl_ExecObjCmd(
|
||||
break;
|
||||
case EXEC_ENCODING:
|
||||
if (++skip >= objc) {
|
||||
Tcl_SetResult(interp, "No value given for option -encoding.",
|
||||
TCL_STATIC);
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj("No value given for option -encoding", -1));
|
||||
return TCL_ERROR;
|
||||
} else {
|
||||
Tcl_Encoding encoding;
|
||||
@@ -1027,8 +1064,8 @@ Tcl_ExecObjCmd(
|
||||
|
||||
/* TIP 716 */
|
||||
if (encodingObj &&
|
||||
Tcl_SetChannelOption(interp, chan, "-encoding",
|
||||
Tcl_GetString(encodingObj)) != TCL_OK) {
|
||||
Tcl_SetChannelOption(interp, chan, "-encoding",
|
||||
Tcl_GetString(encodingObj)) != TCL_OK) {
|
||||
goto errorWithOpenChannel;
|
||||
}
|
||||
|
||||
@@ -1104,7 +1141,7 @@ int
|
||||
Tcl_FblockedObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Tcl_Channel chan;
|
||||
@@ -1150,7 +1187,7 @@ int
|
||||
Tcl_OpenObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
int pipeline, prot;
|
||||
@@ -1169,7 +1206,7 @@ Tcl_OpenObjCmd(
|
||||
if (objc == 4) {
|
||||
const char *permString = TclGetString(objv[3]);
|
||||
int code = TCL_ERROR;
|
||||
int scanned = TclParseAllWhiteSpace(permString, -1);
|
||||
Tcl_Size scanned = TclParseAllWhiteSpace(permString, -1);
|
||||
|
||||
/*
|
||||
* Support legacy octal numbers.
|
||||
@@ -1272,7 +1309,7 @@ Tcl_OpenObjCmd(
|
||||
|
||||
static void
|
||||
TcpAcceptCallbacksDeleteProc(
|
||||
void *clientData, /* Data which was passed when the assocdata
|
||||
void *clientData, /* Data which was passed when the assocdata
|
||||
* was registered. */
|
||||
TCL_UNUSED(Tcl_Interp *))
|
||||
{
|
||||
@@ -1324,12 +1361,12 @@ RegisterTcpServerInterpCleanup(
|
||||
Tcl_HashEntry *hPtr; /* Entry for this record. */
|
||||
int isNew; /* Is the entry new? */
|
||||
|
||||
hTblPtr = (Tcl_HashTable *)Tcl_GetAssocData(interp, "tclTCPAcceptCallbacks", NULL);
|
||||
hTblPtr = (Tcl_HashTable *)Tcl_GetAssocData(interp, ASSOC_KEY, NULL);
|
||||
|
||||
if (hTblPtr == NULL) {
|
||||
hTblPtr = (Tcl_HashTable *)Tcl_Alloc(sizeof(Tcl_HashTable));
|
||||
Tcl_InitHashTable(hTblPtr, TCL_ONE_WORD_KEYS);
|
||||
Tcl_SetAssocData(interp, "tclTCPAcceptCallbacks",
|
||||
Tcl_SetAssocData(interp, ASSOC_KEY,
|
||||
TcpAcceptCallbacksDeleteProc, hTblPtr);
|
||||
}
|
||||
|
||||
@@ -1370,7 +1407,7 @@ UnregisterTcpServerInterpCleanupProc(
|
||||
Tcl_HashTable *hTblPtr;
|
||||
Tcl_HashEntry *hPtr;
|
||||
|
||||
hTblPtr = (Tcl_HashTable *)Tcl_GetAssocData(interp, "tclTCPAcceptCallbacks", NULL);
|
||||
hTblPtr = (Tcl_HashTable *)Tcl_GetAssocData(interp, ASSOC_KEY, NULL);
|
||||
if (hTblPtr == NULL) {
|
||||
return;
|
||||
}
|
||||
@@ -1400,7 +1437,7 @@ UnregisterTcpServerInterpCleanupProc(
|
||||
|
||||
static void
|
||||
AcceptCallbackProc(
|
||||
void *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
|
||||
@@ -1491,7 +1528,7 @@ AcceptCallbackProc(
|
||||
|
||||
static void
|
||||
TcpServerCloseProc(
|
||||
void *callbackData) /* The data passed in the call to
|
||||
void *callbackData) /* The data passed in the call to
|
||||
* Tcl_CreateCloseHandler. */
|
||||
{
|
||||
AcceptCallback *acceptCallbackPtr = (AcceptCallback *)callbackData;
|
||||
@@ -1526,7 +1563,7 @@ int
|
||||
Tcl_SocketObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
static const char *const socketOptions[] = {
|
||||
@@ -1537,8 +1574,8 @@ Tcl_SocketObjCmd(
|
||||
SKT_ASYNC, SKT_BACKLOG, SKT_MYADDR, SKT_MYPORT, SKT_REUSEADDR,
|
||||
SKT_REUSEPORT, SKT_SERVER
|
||||
} optionIndex;
|
||||
int a, server = 0, myport = 0, async = 0, reusep = -1,
|
||||
reusea = -1, backlog = -1;
|
||||
int server = 0, myport = 0, async = 0, reusep = -1, reusea = -1, backlog = -1;
|
||||
Tcl_Size a;
|
||||
unsigned int flags = 0;
|
||||
const char *host, *port, *myaddr = NULL;
|
||||
Tcl_Obj *script = NULL;
|
||||
@@ -1777,11 +1814,12 @@ int
|
||||
Tcl_FcopyObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Tcl_Channel inChan, outChan;
|
||||
int mode, i, index;
|
||||
int mode, index;
|
||||
Tcl_Size i;
|
||||
Tcl_WideInt toRead;
|
||||
Tcl_Obj *cmdPtr;
|
||||
static const char *const switches[] = { "-size", "-command", NULL };
|
||||
@@ -1874,7 +1912,7 @@ static int
|
||||
ChanPendingObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Tcl_Channel chan;
|
||||
@@ -1938,7 +1976,7 @@ static int
|
||||
ChanTruncateObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Tcl_Channel chan;
|
||||
@@ -2011,7 +2049,7 @@ static int
|
||||
ChanPipeObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Tcl_Channel rchan, wchan;
|
||||
@@ -2062,7 +2100,7 @@ int
|
||||
TclChannelNamesCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
if (objc < 1 || objc > 2) {
|
||||
@@ -2076,73 +2114,35 @@ TclChannelNamesCmd(
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* TclInitChanCmd --
|
||||
* TclSetUpChanCmd --
|
||||
*
|
||||
* This function is invoked to create the "chan" Tcl command. See the
|
||||
* This function is invoked to set up the "chan" Tcl command. See the
|
||||
* user documentation for details on what it does.
|
||||
*
|
||||
* Results:
|
||||
* A Tcl command handle.
|
||||
* Tcl result code.
|
||||
*
|
||||
* Side effects:
|
||||
* None (since nothing is byte-compiled).
|
||||
* None.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
Tcl_Command
|
||||
TclInitChanCmd(
|
||||
Tcl_Interp *interp)
|
||||
int
|
||||
TclSetUpChanCmd(
|
||||
Tcl_Interp *interp,
|
||||
Tcl_Command ensemble)
|
||||
{
|
||||
/*
|
||||
* Most commands are plugged directly together, but some are done via
|
||||
* alias-like rewriting; [chan configure] is this way for security reasons
|
||||
* (want overwriting of [fconfigure] to control that nicely), and [chan
|
||||
* names] because the functionality isn't available as a separate command
|
||||
* function at the moment.
|
||||
* (want overwriting of [fconfigure] to control that nicely).
|
||||
*/
|
||||
static const EnsembleImplMap initMap[] = {
|
||||
{"blocked", Tcl_FblockedObjCmd, TclCompileBasic1ArgCmd, NULL, NULL, 0},
|
||||
{"close", Tcl_CloseObjCmd, TclCompileBasic1Or2ArgCmd, NULL, NULL, 0},
|
||||
{"copy", Tcl_FcopyObjCmd, NULL, NULL, NULL, 0},
|
||||
{"create", TclChanCreateObjCmd, TclCompileBasic2ArgCmd, NULL, NULL, 0}, /* TIP #219 */
|
||||
{"eof", Tcl_EofObjCmd, TclCompileBasic1ArgCmd, NULL, NULL, 0},
|
||||
{"event", Tcl_FileEventObjCmd, TclCompileBasic2Or3ArgCmd, NULL, NULL, 0},
|
||||
{"flush", Tcl_FlushObjCmd, TclCompileBasic1ArgCmd, NULL, NULL, 0},
|
||||
{"gets", Tcl_GetsObjCmd, TclCompileBasic1Or2ArgCmd, NULL, NULL, 0},
|
||||
{"isbinary", ChanIsBinaryCmd, TclCompileBasic1ArgCmd, NULL, NULL, 0},
|
||||
{"names", TclChannelNamesCmd, TclCompileBasic0Or1ArgCmd, NULL, NULL, 0},
|
||||
{"pending", ChanPendingObjCmd, TclCompileBasic2ArgCmd, NULL, NULL, 0}, /* TIP #287 */
|
||||
{"pipe", ChanPipeObjCmd, TclCompileBasic0ArgCmd, NULL, NULL, 0}, /* TIP #304 */
|
||||
{"pop", TclChanPopObjCmd, TclCompileBasic1ArgCmd, NULL, NULL, 0}, /* TIP #230 */
|
||||
{"postevent", TclChanPostEventObjCmd, TclCompileBasic2ArgCmd, NULL, NULL, 0}, /* TIP #219 */
|
||||
{"push", TclChanPushObjCmd, TclCompileBasic2ArgCmd, NULL, NULL, 0}, /* TIP #230 */
|
||||
{"puts", Tcl_PutsObjCmd, NULL, NULL, NULL, 0},
|
||||
{"read", Tcl_ReadObjCmd, NULL, NULL, NULL, 0},
|
||||
{"seek", Tcl_SeekObjCmd, TclCompileBasic2Or3ArgCmd, NULL, NULL, 0},
|
||||
{"tell", Tcl_TellObjCmd, TclCompileBasic1ArgCmd, NULL, NULL, 0},
|
||||
{"truncate", ChanTruncateObjCmd, TclCompileBasic1Or2ArgCmd, NULL, NULL, 0}, /* TIP #208 */
|
||||
{NULL, NULL, NULL, NULL, NULL, 0}
|
||||
};
|
||||
static const char *const extras[] = {
|
||||
"configure", "::fconfigure",
|
||||
NULL
|
||||
};
|
||||
Tcl_Command ensemble;
|
||||
|
||||
Tcl_Obj *mapObj;
|
||||
int i;
|
||||
|
||||
ensemble = TclMakeEnsemble(interp, "chan", initMap);
|
||||
Tcl_GetEnsembleMappingDict(NULL, ensemble, &mapObj);
|
||||
for (i=0 ; extras[i] ; i+=2) {
|
||||
/*
|
||||
* Can assume that reference counts are all incremented.
|
||||
*/
|
||||
|
||||
TclDictPutString(NULL, mapObj, extras[i], extras[i + 1]);
|
||||
}
|
||||
Tcl_SetEnsembleMappingDict(interp, ensemble, mapObj);
|
||||
return ensemble;
|
||||
TclDictPutString(NULL, mapObj, "configure", "::fconfigure");
|
||||
return Tcl_SetEnsembleMappingDict(interp, ensemble, mapObj);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+26
-22
@@ -56,26 +56,28 @@ typedef struct TransformChannelData TransformChannelData;
|
||||
|
||||
static int ExecuteCallback(TransformChannelData *ctrl,
|
||||
Tcl_Interp *interp, unsigned char *op,
|
||||
unsigned char *buf, int bufLen, int transmit,
|
||||
unsigned char *buf, Tcl_Size bufLen, int transmit,
|
||||
int preserve);
|
||||
|
||||
/*
|
||||
* Action codes to give to 'ExecuteCallback' (argument 'transmit'), telling
|
||||
* the procedure what to do with the result of the script it calls.
|
||||
*/
|
||||
|
||||
#define TRANSMIT_DONT 0 /* No transfer to do. */
|
||||
#define TRANSMIT_DOWN 1 /* Transfer to the underlying channel. */
|
||||
#define TRANSMIT_SELF 2 /* Transfer into our channel. */
|
||||
#define TRANSMIT_IBUF 3 /* Transfer to internal input buffer. */
|
||||
#define TRANSMIT_NUM 4 /* Transfer number to 'maxRead'. */
|
||||
enum ExecuteCallbackActionCodes {
|
||||
TRANSMIT_DONT = 0, /* No transfer to do. */
|
||||
TRANSMIT_DOWN = 1, /* Transfer to the underlying channel. */
|
||||
TRANSMIT_SELF = 2, /* Transfer into our channel. */
|
||||
TRANSMIT_IBUF = 3, /* Transfer to internal input buffer. */
|
||||
TRANSMIT_NUM = 4 /* Transfer number to 'maxRead'. */
|
||||
};
|
||||
|
||||
/*
|
||||
* Codes for 'preserve' of 'ExecuteCallback'.
|
||||
*/
|
||||
|
||||
#define P_PRESERVE 1
|
||||
#define P_NO_PRESERVE 0
|
||||
enum ExecuteCallbackPreserveFlag {
|
||||
P_PRESERVE = 1,
|
||||
P_NO_PRESERVE = 0
|
||||
};
|
||||
|
||||
/*
|
||||
* Strings for the action codes delivered to the script implementing a
|
||||
@@ -137,8 +139,9 @@ static const Tcl_ChannelType transformChannelType = {
|
||||
/*
|
||||
* Possible values for 'flags' field in control structure, see below.
|
||||
*/
|
||||
|
||||
#define CHANNEL_ASYNC (1<<0) /* Non-blocking mode. */
|
||||
enum TransformChannelDataFlags {
|
||||
CHANNEL_ASYNC = (1<<0) /* Non-blocking mode. */
|
||||
};
|
||||
|
||||
/*
|
||||
* Definition of the structure containing the information about the internal
|
||||
@@ -267,8 +270,8 @@ TclChannelTransform(
|
||||
}
|
||||
|
||||
if (TCL_OK != TclListObjLength(interp, cmdObjPtr, &objc)) {
|
||||
Tcl_SetObjResult(interp,
|
||||
Tcl_NewStringObj("-command value is not a list", -1));
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"-command value is not a list", -1));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
@@ -366,7 +369,7 @@ ExecuteCallback(
|
||||
Tcl_Interp *interp, /* Current interpreter, possibly NULL. */
|
||||
unsigned char *op, /* Operation invoking the callback. */
|
||||
unsigned char *buf, /* Buffer to give to the script. */
|
||||
int bufLen, /* And its length. */
|
||||
Tcl_Size bufLen, /* And its length. */
|
||||
int transmit, /* Flag, determines whether the result of the
|
||||
* callback is sent to the underlying channel
|
||||
* or not. */
|
||||
@@ -515,7 +518,7 @@ ExecuteCallback(
|
||||
|
||||
static int
|
||||
TransformBlockModeProc(
|
||||
void *instanceData, /* State of transformation. */
|
||||
void *instanceData, /* State of transformation. */
|
||||
int mode) /* New blocking mode. */
|
||||
{
|
||||
TransformChannelData *dataPtr = (TransformChannelData *)instanceData;
|
||||
@@ -637,7 +640,8 @@ TransformInputProc(
|
||||
int *errorCodePtr)
|
||||
{
|
||||
TransformChannelData *dataPtr = (TransformChannelData *)instanceData;
|
||||
int gotBytes, read, copied;
|
||||
int gotBytes, copied;
|
||||
Tcl_Size read;
|
||||
Tcl_Channel downChan;
|
||||
|
||||
/*
|
||||
@@ -1013,7 +1017,7 @@ TransformGetOptionProc(
|
||||
|
||||
static void
|
||||
TransformWatchProc(
|
||||
void *instanceData, /* Channel to watch. */
|
||||
void *instanceData, /* Channel to watch. */
|
||||
int mask) /* Events of interest. */
|
||||
{
|
||||
TransformChannelData *dataPtr = (TransformChannelData *)instanceData;
|
||||
@@ -1091,9 +1095,9 @@ TransformWatchProc(
|
||||
|
||||
static int
|
||||
TransformGetFileHandleProc(
|
||||
void *instanceData, /* Channel to query. */
|
||||
void *instanceData, /* Channel to query. */
|
||||
int direction, /* Direction of interest. */
|
||||
void **handlePtr) /* Place to store the handle into. */
|
||||
void **handlePtr) /* Place to store the handle into. */
|
||||
{
|
||||
TransformChannelData *dataPtr = (TransformChannelData *)instanceData;
|
||||
|
||||
@@ -1125,7 +1129,7 @@ TransformGetFileHandleProc(
|
||||
|
||||
static int
|
||||
TransformNotifyProc(
|
||||
void *clientData, /* The state of the notified
|
||||
void *clientData, /* The state of the notified
|
||||
* transformation. */
|
||||
int mask) /* The mask of occurring events. */
|
||||
{
|
||||
@@ -1170,7 +1174,7 @@ TransformNotifyProc(
|
||||
|
||||
static void
|
||||
TransformChannelHandlerTimer(
|
||||
void *clientData) /* Transformation to query. */
|
||||
void *clientData) /* Transformation to query. */
|
||||
{
|
||||
TransformChannelData *dataPtr = (TransformChannelData *)clientData;
|
||||
|
||||
|
||||
+61
-49
@@ -161,7 +161,7 @@ typedef enum {
|
||||
static const char *const methodNames[] = {
|
||||
"blocking", /* OPT */
|
||||
"cget", /* OPT \/ Together or none */
|
||||
"cgetall", /* OPT /\ of these two */
|
||||
"cgetall", /* OPT /\ of these two. */
|
||||
"configure", /* OPT */
|
||||
"finalize", /* */
|
||||
"initialize", /* */
|
||||
@@ -390,26 +390,37 @@ static int ForwardProc(Tcl_Event *evPtr, int mask);
|
||||
static void SrcExitProc(void *clientData);
|
||||
|
||||
#define FreeReceivedError(p) \
|
||||
if ((p)->base.mustFree) { \
|
||||
Tcl_Free((p)->base.msgStr); \
|
||||
}
|
||||
#define PassReceivedErrorInterp(i,p) \
|
||||
if ((i) != NULL) { \
|
||||
Tcl_SetChannelErrorInterp((i), \
|
||||
Tcl_NewStringObj((p)->base.msgStr, -1)); \
|
||||
} \
|
||||
FreeReceivedError(p)
|
||||
#define PassReceivedError(c,p) \
|
||||
Tcl_SetChannelError((c), Tcl_NewStringObj((p)->base.msgStr, -1)); \
|
||||
FreeReceivedError(p)
|
||||
#define ForwardSetStaticError(p,emsg) \
|
||||
(p)->base.code = TCL_ERROR; \
|
||||
(p)->base.mustFree = 0; \
|
||||
(p)->base.msgStr = (char *) (emsg)
|
||||
#define ForwardSetDynamicError(p,emsg) \
|
||||
(p)->base.code = TCL_ERROR; \
|
||||
(p)->base.mustFree = 1; \
|
||||
(p)->base.msgStr = (char *) (emsg)
|
||||
do { \
|
||||
if ((p)->base.mustFree) { \
|
||||
Tcl_Free((p)->base.msgStr); \
|
||||
} \
|
||||
} while (0)
|
||||
#define PassReceivedErrorInterp(interp, p) \
|
||||
do { \
|
||||
if ((interp) != NULL) { \
|
||||
Tcl_SetChannelErrorInterp((interp), \
|
||||
Tcl_NewStringObj((p)->base.msgStr, -1)); \
|
||||
} \
|
||||
FreeReceivedError(p); \
|
||||
} while (0)
|
||||
#define PassReceivedError(chan, p) \
|
||||
do { \
|
||||
Tcl_SetChannelError((chan), \
|
||||
Tcl_NewStringObj((p)->base.msgStr, -1)); \
|
||||
FreeReceivedError(p); \
|
||||
} while (0)
|
||||
#define ForwardSetStaticError(p, emsg) \
|
||||
do { \
|
||||
(p)->base.code = TCL_ERROR; \
|
||||
(p)->base.mustFree = 0; \
|
||||
(p)->base.msgStr = (char *) (emsg); \
|
||||
} while (0)
|
||||
#define ForwardSetDynamicError(p, emsg) \
|
||||
do { \
|
||||
(p)->base.code = TCL_ERROR; \
|
||||
(p)->base.mustFree = 1; \
|
||||
(p)->base.msgStr = (char *) (emsg); \
|
||||
} while (0)
|
||||
|
||||
static void ForwardSetObjError(ForwardParam *p, Tcl_Obj *objPtr);
|
||||
|
||||
@@ -460,8 +471,9 @@ static const char *msg_seek_beforestart = "{Tried to seek before origin}";
|
||||
#if TCL_THREADS
|
||||
static const char *msg_send_originlost = "{Channel thread lost}";
|
||||
#endif /* TCL_THREADS */
|
||||
static const char *msg_send_dstlost = "{Owner lost}";
|
||||
static const char *msg_dstlost = "-code 1 -level 0 -errorcode NONE -errorinfo {} -errorline 1 {Owner lost}";
|
||||
static const char *msg_send_dstlost = "{Owner lost}";
|
||||
static const char *msg_dstlost =
|
||||
"-code 1 -level 0 -errorcode NONE -errorinfo {} -errorline 1 {Owner lost}";
|
||||
|
||||
/*
|
||||
* Main methods to plug into the 'chan' ensemble'. ==================
|
||||
@@ -489,7 +501,7 @@ int
|
||||
TclChanCreateObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const *objv)
|
||||
{
|
||||
ReflectedChannel *rcPtr; /* Instance data of the new channel */
|
||||
@@ -721,7 +733,7 @@ TclChanCreateObjCmd(
|
||||
#if TCL_THREADS
|
||||
rcmPtr = GetThreadReflectedChannelMap();
|
||||
hPtr = Tcl_CreateHashEntry(&rcmPtr->map, chanPtr->state->channelName,
|
||||
&isNew);
|
||||
NULL);
|
||||
Tcl_SetHashValue(hPtr, chan);
|
||||
#endif
|
||||
|
||||
@@ -809,7 +821,7 @@ int
|
||||
TclChanPostEventObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const *objv)
|
||||
{
|
||||
/*
|
||||
@@ -912,8 +924,8 @@ TclChanPostEventObjCmd(
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (events == 0) {
|
||||
Tcl_SetObjResult(interp,
|
||||
Tcl_NewStringObj("bad event list: is empty", -1));
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"bad event list: is empty", -1));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
@@ -1309,7 +1321,7 @@ ReflectInput(
|
||||
*errorCodePtr = EOK;
|
||||
}
|
||||
|
||||
return p.input.toRead;
|
||||
return (int)p.input.toRead;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1349,14 +1361,14 @@ ReflectInput(
|
||||
memcpy(buf, bytev, bytec);
|
||||
}
|
||||
|
||||
stop:
|
||||
stop:
|
||||
Tcl_DecrRefCount(toReadObj);
|
||||
Tcl_DecrRefCount(resObj); /* Remove reference held from invoke */
|
||||
Tcl_Release(rcPtr);
|
||||
return bytec;
|
||||
invalid:
|
||||
return (int)bytec;
|
||||
invalid:
|
||||
*errorCodePtr = EINVAL;
|
||||
error:
|
||||
error:
|
||||
bytec = -1;
|
||||
goto stop;
|
||||
}
|
||||
@@ -1418,7 +1430,7 @@ ReflectOutput(
|
||||
*errorCodePtr = EOK;
|
||||
}
|
||||
|
||||
return p.output.toWrite;
|
||||
return (int)p.output.toWrite;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1477,15 +1489,15 @@ ReflectOutput(
|
||||
}
|
||||
|
||||
*errorCodePtr = EOK;
|
||||
stop:
|
||||
stop:
|
||||
Tcl_DecrRefCount(bufObj);
|
||||
Tcl_DecrRefCount(resObj); /* Remove reference held from invoke */
|
||||
Tcl_Release(rcPtr->interp);
|
||||
Tcl_Release(rcPtr);
|
||||
return written;
|
||||
invalid:
|
||||
invalid:
|
||||
*errorCodePtr = EINVAL;
|
||||
error:
|
||||
error:
|
||||
written = -1;
|
||||
goto stop;
|
||||
}
|
||||
@@ -1570,13 +1582,13 @@ ReflectSeekWide(
|
||||
}
|
||||
|
||||
*errorCodePtr = EOK;
|
||||
stop:
|
||||
stop:
|
||||
Tcl_DecrRefCount(offObj);
|
||||
Tcl_DecrRefCount(baseObj);
|
||||
Tcl_DecrRefCount(resObj); /* Remove reference held from invoke */
|
||||
Tcl_Release(rcPtr);
|
||||
return newLoc;
|
||||
invalid:
|
||||
invalid:
|
||||
*errorCodePtr = EINVAL;
|
||||
newLoc = -1;
|
||||
goto stop;
|
||||
@@ -1777,7 +1789,7 @@ ReflectThread(
|
||||
|
||||
static int
|
||||
ReflectSetOption(
|
||||
void *clientData, /* Channel to query */
|
||||
void *clientData, /* Channel to query */
|
||||
Tcl_Interp *interp, /* Interpreter to leave error messages in */
|
||||
const char *optionName, /* Name of requested option */
|
||||
const char *newValue) /* The new value */
|
||||
@@ -1849,7 +1861,7 @@ ReflectSetOption(
|
||||
|
||||
static int
|
||||
ReflectGetOption(
|
||||
void *clientData, /* Channel to query */
|
||||
void *clientData, /* Channel to query */
|
||||
Tcl_Interp *interp, /* Interpreter to leave error messages in */
|
||||
const char *optionName, /* Name of reuqested option */
|
||||
Tcl_DString *dsPtr) /* String to place the result into */
|
||||
@@ -1970,16 +1982,16 @@ ReflectGetOption(
|
||||
goto ok;
|
||||
}
|
||||
|
||||
ok:
|
||||
ok:
|
||||
result = TCL_OK;
|
||||
stop:
|
||||
stop:
|
||||
if (optionObj) {
|
||||
Tcl_DecrRefCount(optionObj);
|
||||
}
|
||||
Tcl_DecrRefCount(resObj); /* Remove reference held from invoke */
|
||||
Tcl_Release(rcPtr);
|
||||
return result;
|
||||
error:
|
||||
error:
|
||||
result = TCL_ERROR;
|
||||
goto stop;
|
||||
}
|
||||
@@ -2002,7 +2014,7 @@ ReflectGetOption(
|
||||
|
||||
static int
|
||||
ReflectTruncate(
|
||||
void *clientData, /* Channel to query */
|
||||
void *clientData, /* Channel to query */
|
||||
long long length) /* Length to truncate to. */
|
||||
{
|
||||
ReflectedChannel *rcPtr = (ReflectedChannel *)clientData;
|
||||
@@ -2085,7 +2097,7 @@ EncodeEventMask(
|
||||
int *mask)
|
||||
{
|
||||
int events; /* Mask of events to post */
|
||||
Tcl_Size listc; /* #elements in eventspec list */
|
||||
Tcl_Size listc; /* #elements in eventspec list */
|
||||
Tcl_Obj **listv; /* Elements of eventspec list */
|
||||
int evIndex; /* Id of event for an element of the eventspec
|
||||
* list. */
|
||||
@@ -2564,13 +2576,13 @@ MarkDead(
|
||||
|
||||
static void
|
||||
DeleteReflectedChannelMap(
|
||||
void *clientData, /* The per-interpreter data structure. */
|
||||
void *clientData, /* The per-interpreter data structure. */
|
||||
Tcl_Interp *interp) /* The interpreter being deleted. */
|
||||
{
|
||||
ReflectedChannelMap *rcmPtr = (ReflectedChannelMap *)clientData;
|
||||
/* The map */
|
||||
Tcl_HashSearch hSearch; /* Search variable. */
|
||||
Tcl_HashEntry *hPtr; /* Search variable. */
|
||||
Tcl_HashSearch hSearch; /* Search variable. */
|
||||
Tcl_HashEntry *hPtr; /* Search variable. */
|
||||
ReflectedChannel *rcPtr;
|
||||
Tcl_Channel chan;
|
||||
#if TCL_THREADS
|
||||
|
||||
+55
-54
@@ -136,7 +136,7 @@ typedef struct {
|
||||
* CT = Belongs to the 'Command handler Thread'.
|
||||
*/
|
||||
|
||||
int argc; /* Number of preallocated words - 2. */
|
||||
Tcl_Size argc; /* Number of preallocated words - 2. */
|
||||
Tcl_Obj **argv; /* Preallocated array for calling the handler.
|
||||
* args[0] is placeholder for cmd word.
|
||||
* Followed by the arguments in the prefix,
|
||||
@@ -356,37 +356,37 @@ static int ForwardProc(Tcl_Event *evPtr, int mask);
|
||||
static void SrcExitProc(void *clientData);
|
||||
|
||||
#define FreeReceivedError(p) \
|
||||
do { \
|
||||
if ((p)->base.mustFree) { \
|
||||
Tcl_Free((p)->base.msgStr); \
|
||||
} \
|
||||
} while (0)
|
||||
#define PassReceivedErrorInterp(i,p) \
|
||||
do { \
|
||||
if ((i) != NULL) { \
|
||||
Tcl_SetChannelErrorInterp((i), \
|
||||
Tcl_NewStringObj((p)->base.msgStr, -1)); \
|
||||
} \
|
||||
FreeReceivedError(p); \
|
||||
} while (0)
|
||||
#define PassReceivedError(c,p) \
|
||||
do { \
|
||||
Tcl_SetChannelError((c), \
|
||||
Tcl_NewStringObj((p)->base.msgStr, -1)); \
|
||||
FreeReceivedError(p); \
|
||||
} while (0)
|
||||
#define ForwardSetStaticError(p,emsg) \
|
||||
do { \
|
||||
(p)->base.code = TCL_ERROR; \
|
||||
(p)->base.mustFree = 0; \
|
||||
(p)->base.msgStr = (char *) (emsg); \
|
||||
} while (0)
|
||||
#define ForwardSetDynamicError(p,emsg) \
|
||||
do { \
|
||||
(p)->base.code = TCL_ERROR; \
|
||||
(p)->base.mustFree = 1; \
|
||||
(p)->base.msgStr = (char *) (emsg); \
|
||||
} while (0)
|
||||
do { \
|
||||
if ((p)->base.mustFree) { \
|
||||
Tcl_Free((p)->base.msgStr); \
|
||||
} \
|
||||
} while (0)
|
||||
#define PassReceivedErrorInterp(interp, p) \
|
||||
do { \
|
||||
if ((interp) != NULL) { \
|
||||
Tcl_SetChannelErrorInterp((interp), \
|
||||
Tcl_NewStringObj((p)->base.msgStr, -1)); \
|
||||
} \
|
||||
FreeReceivedError(p); \
|
||||
} while (0)
|
||||
#define PassReceivedError(chan, p) \
|
||||
do { \
|
||||
Tcl_SetChannelError((chan), \
|
||||
Tcl_NewStringObj((p)->base.msgStr, -1)); \
|
||||
FreeReceivedError(p); \
|
||||
} while (0)
|
||||
#define ForwardSetStaticError(p, emsg) \
|
||||
do { \
|
||||
(p)->base.code = TCL_ERROR; \
|
||||
(p)->base.mustFree = 0; \
|
||||
(p)->base.msgStr = (char *) (emsg); \
|
||||
} while (0)
|
||||
#define ForwardSetDynamicError(p, emsg) \
|
||||
do { \
|
||||
(p)->base.code = TCL_ERROR; \
|
||||
(p)->base.mustFree = 1; \
|
||||
(p)->base.msgStr = (char *) (emsg); \
|
||||
} while (0)
|
||||
|
||||
static void ForwardSetObjError(ForwardParam *p,
|
||||
Tcl_Obj *objPtr);
|
||||
@@ -465,9 +465,10 @@ static int TransformLimit(ReflectedTransform *rtPtr,
|
||||
/*
|
||||
* Operation codes for TransformFlush().
|
||||
*/
|
||||
|
||||
#define FLUSH_WRITE 1
|
||||
#define FLUSH_DISCARD 0
|
||||
enum TransformFlushOperations {
|
||||
FLUSH_WRITE = 1,
|
||||
FLUSH_DISCARD = 0
|
||||
};
|
||||
|
||||
/*
|
||||
* Main methods to plug into the 'chan' ensemble'. ==================
|
||||
@@ -495,7 +496,7 @@ int
|
||||
TclChanPushObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const *objv)
|
||||
{
|
||||
ReflectedTransform *rtPtr; /* Instance data of the new (transform)
|
||||
@@ -694,7 +695,7 @@ TclChanPushObjCmd(
|
||||
Tcl_SetHashValue(hPtr, rtPtr);
|
||||
#if TCL_THREADS
|
||||
rtmPtr = GetThreadReflectedTransformMap();
|
||||
hPtr = Tcl_CreateHashEntry(&rtmPtr->map, TclGetString(rtId), &isNew);
|
||||
hPtr = Tcl_CreateHashEntry(&rtmPtr->map, TclGetString(rtId), NULL);
|
||||
Tcl_SetHashValue(hPtr, rtPtr);
|
||||
#endif /* TCL_THREADS */
|
||||
|
||||
@@ -738,7 +739,7 @@ int
|
||||
TclChanPopObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const *objv)
|
||||
{
|
||||
/*
|
||||
@@ -1087,7 +1088,7 @@ ReflectInput(
|
||||
* below, possibly EOF).
|
||||
*/
|
||||
|
||||
copied = ResultCopy(&rtPtr->result, UCHARP(buf), toRead);
|
||||
copied = (int)ResultCopy(&rtPtr->result, UCHARP(buf), toRead);
|
||||
toRead -= copied;
|
||||
buf += copied;
|
||||
gotBytes += copied;
|
||||
@@ -1135,7 +1136,7 @@ ReflectInput(
|
||||
goto stop;
|
||||
}
|
||||
|
||||
readBytes = Tcl_ReadRaw(rtPtr->parent,
|
||||
readBytes = (int)Tcl_ReadRaw(rtPtr->parent,
|
||||
(char *) Tcl_SetByteArrayLength(bufObj, toRead), toRead);
|
||||
if (readBytes < 0) {
|
||||
if (Tcl_InputBlocked(rtPtr->parent) && (gotBytes > 0)) {
|
||||
@@ -1210,7 +1211,7 @@ ReflectInput(
|
||||
Tcl_SetByteArrayLength(bufObj, 0);
|
||||
} /* while toRead > 0 */
|
||||
|
||||
stop:
|
||||
stop:
|
||||
if (gotBytes == 0) {
|
||||
rtPtr->eofPending = 0;
|
||||
}
|
||||
@@ -1218,7 +1219,7 @@ ReflectInput(
|
||||
Tcl_Release(rtPtr);
|
||||
return gotBytes;
|
||||
|
||||
error:
|
||||
error:
|
||||
gotBytes = -1;
|
||||
goto stop;
|
||||
}
|
||||
@@ -1838,7 +1839,7 @@ static void
|
||||
FreeReflectedTransformArgs(
|
||||
ReflectedTransform *rtPtr)
|
||||
{
|
||||
int i, n = rtPtr->argc - 2;
|
||||
Tcl_Size i, n = rtPtr->argc - 2;
|
||||
|
||||
if (n < 0) {
|
||||
return;
|
||||
@@ -1909,7 +1910,7 @@ InvokeTclMethod(
|
||||
Tcl_Obj *argTwoObj, /* NULL'able */
|
||||
Tcl_Obj **resultObjPtr) /* NULL'able */
|
||||
{
|
||||
int cmdc; /* #words in constructed command */
|
||||
Tcl_Size cmdc; /* #words in constructed command */
|
||||
Tcl_Obj *methObj = NULL; /* Method name in object form */
|
||||
Tcl_InterpState sr; /* State of handler interp */
|
||||
int result; /* Result code of method invocation */
|
||||
@@ -2105,8 +2106,8 @@ DeleteReflectedTransformMap(
|
||||
Tcl_Interp *interp) /* The interpreter being deleted. */
|
||||
{
|
||||
ReflectedTransformMap *rtmPtr; /* The map */
|
||||
Tcl_HashSearch hSearch; /* Search variable. */
|
||||
Tcl_HashEntry *hPtr; /* Search variable. */
|
||||
Tcl_HashSearch hSearch; /* Search variable. */
|
||||
Tcl_HashEntry *hPtr; /* Search variable. */
|
||||
ReflectedTransform *rtPtr;
|
||||
#if TCL_THREADS
|
||||
ForwardingResult *resultPtr;
|
||||
@@ -2267,8 +2268,8 @@ static void
|
||||
DeleteThreadReflectedTransformMap(
|
||||
TCL_UNUSED(void *))
|
||||
{
|
||||
Tcl_HashSearch hSearch; /* Search variable. */
|
||||
Tcl_HashEntry *hPtr; /* Search variable. */
|
||||
Tcl_HashSearch hSearch; /* Search variable. */
|
||||
Tcl_HashEntry *hPtr; /* Search variable. */
|
||||
Tcl_ThreadId self = Tcl_GetCurrentThread();
|
||||
ReflectedTransformMap *rtmPtr; /* The map */
|
||||
ForwardingResult *resultPtr;
|
||||
@@ -3004,7 +3005,7 @@ ResultCopy(
|
||||
|
||||
memcpy(buf, rPtr->buf, toRead);
|
||||
rPtr->used = 0;
|
||||
copied = toRead;
|
||||
copied = (int)toRead;
|
||||
} else if (rPtr->used > (size_t)toRead) {
|
||||
/*
|
||||
* The internal buffer contains more than requested. Copy the
|
||||
@@ -3015,7 +3016,7 @@ ResultCopy(
|
||||
memmove(rPtr->buf, rPtr->buf + toRead, rPtr->used - toRead);
|
||||
|
||||
rPtr->used -= toRead;
|
||||
copied = toRead;
|
||||
copied = (int)toRead;
|
||||
} else {
|
||||
/*
|
||||
* There is not enough in the buffer to satisfy the caller, so take
|
||||
@@ -3025,7 +3026,7 @@ ResultCopy(
|
||||
memcpy(buf, rPtr->buf, rPtr->used);
|
||||
toRead = rPtr->used;
|
||||
rPtr->used = 0;
|
||||
copied = toRead;
|
||||
copied = (int)toRead;
|
||||
}
|
||||
|
||||
/* -- common postwork code ------- */
|
||||
@@ -3097,7 +3098,7 @@ TransformWrite(
|
||||
Tcl_Obj *resObj;
|
||||
Tcl_Size bytec = 0; /* Number of returned bytes */
|
||||
unsigned char *bytev; /* Array of returned bytes */
|
||||
int res;
|
||||
Tcl_Size res;
|
||||
|
||||
/*
|
||||
* Are we in the correct thread?
|
||||
@@ -3107,7 +3108,7 @@ TransformWrite(
|
||||
if (rtPtr->thread != Tcl_GetCurrentThread()) {
|
||||
ForwardParam p;
|
||||
|
||||
p.transform.buf = (char *) buf;
|
||||
p.transform.buf = (char *)buf;
|
||||
p.transform.size = toWrite;
|
||||
|
||||
ForwardOpToOwnerThread(rtPtr, ForwardedOutput, &p);
|
||||
@@ -3213,7 +3214,7 @@ TransformFlush(
|
||||
Tcl_Obj *resObj;
|
||||
Tcl_Size bytec = 0; /* Number of returned bytes */
|
||||
unsigned char *bytev; /* Array of returned bytes */
|
||||
int res;
|
||||
Tcl_Size res;
|
||||
|
||||
/*
|
||||
* Are we in the correct thread?
|
||||
|
||||
+20
-1
@@ -129,7 +129,7 @@ TclSockMinimumBuffers(
|
||||
{
|
||||
int current;
|
||||
socklen_t len;
|
||||
int size = size1;
|
||||
int size = (int)size1;
|
||||
|
||||
if (size != size1) {
|
||||
return TCL_ERROR;
|
||||
@@ -339,6 +339,25 @@ Tcl_OpenTcpServer(
|
||||
-1, acceptProc, callbackData);
|
||||
}
|
||||
|
||||
#ifdef TCL_SOCK_PRINTF_DEBUGGING
|
||||
/* printf debugging */
|
||||
void
|
||||
printaddrinfo(
|
||||
struct addrinfo *addrlist,
|
||||
char *prefix)
|
||||
{
|
||||
char host[NI_MAXHOST], port[NI_MAXSERV];
|
||||
struct addrinfo *ai;
|
||||
|
||||
for (ai = addrlist; ai != NULL; ai = ai->ai_next) {
|
||||
getnameinfo(ai->ai_addr, ai->ai_addrlen,
|
||||
host, sizeof(host), port, sizeof(port),
|
||||
NI_NUMERICHOST|NI_NUMERICSERV);
|
||||
fprintf(stderr,"%s: %s:%s\n", prefix, host, port);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: c
|
||||
|
||||
+34
-30
@@ -208,8 +208,8 @@ TCL_DECLARE_MUTEX(filesystemMutex)
|
||||
* A files-system indepent sense of the current directory.
|
||||
*/
|
||||
|
||||
static Tcl_Obj *cwdPathPtr = NULL;
|
||||
static size_t cwdPathEpoch = 0; /* The pathname of the current directory */
|
||||
static Tcl_Obj *cwdPathPtr = NULL; /* The pathname of the current directory */
|
||||
static size_t cwdPathEpoch = 0;
|
||||
static void *cwdClientData = NULL;
|
||||
TCL_DECLARE_MUTEX(cwdMutex)
|
||||
|
||||
@@ -255,8 +255,7 @@ Tcl_Stat(
|
||||
Tcl_WideInt tmp1, tmp2, tmp3 = 0;
|
||||
|
||||
# define OUT_OF_RANGE(x) \
|
||||
(((Tcl_WideInt)(x)) < LONG_MIN || \
|
||||
((Tcl_WideInt)(x)) > LONG_MAX)
|
||||
(((Tcl_WideInt)(x)) < LONG_MIN || ((Tcl_WideInt)(x)) > LONG_MAX)
|
||||
# define OUT_OF_URANGE(x) \
|
||||
(((Tcl_WideUInt)(x)) > ((Tcl_WideUInt)ULONG_MAX))
|
||||
|
||||
@@ -453,7 +452,9 @@ TclFSCwdIsNative(void)
|
||||
/* if not yet initialized - ensure we'll once obtain cwd */
|
||||
if (!tsdPtr->cwdPathEpoch) {
|
||||
Tcl_Obj *temp = Tcl_FSGetCwd(NULL);
|
||||
if (temp) { Tcl_DecrRefCount(temp); }
|
||||
if (temp) {
|
||||
Tcl_DecrRefCount(temp);
|
||||
}
|
||||
}
|
||||
|
||||
if (tsdPtr->cwdClientData != NULL) {
|
||||
@@ -1315,16 +1316,16 @@ Tcl_FSData(
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int
|
||||
Tcl_Size
|
||||
TclFSNormalizeToUniquePath(
|
||||
Tcl_Interp *interp, /* Used for error messages. */
|
||||
Tcl_Obj *pathPtr, /* An Pathname to normalize in-place. Must be
|
||||
* unshared. */
|
||||
int startAt) /* Offset the string of pathPtr to start at.
|
||||
Tcl_Size startAt) /* Offset the string of pathPtr to start at.
|
||||
* Must either be 0 or offset of a directory
|
||||
* separator at the end of a pathname part that
|
||||
* is already normalized, I.e. not the index of
|
||||
* the byte just after the separator. */
|
||||
* is already normalized, i.e. not the index of
|
||||
* the byte just after the separator. */
|
||||
{
|
||||
FilesystemRecord *fsRecPtr, *firstFsRecPtr;
|
||||
|
||||
@@ -1383,9 +1384,9 @@ TclFSNormalizeToUniquePath(
|
||||
* always exist.
|
||||
*/
|
||||
|
||||
if (fsRecPtr->fsPtr->normalizePathProc != NULL) {
|
||||
if (fsRecPtr->fsPtr->normalizePathProc != NULL && startAt < INT_MAX) {
|
||||
startAt = fsRecPtr->fsPtr->normalizePathProc(interp, pathPtr,
|
||||
startAt);
|
||||
(int)startAt);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1399,9 +1400,9 @@ TclFSNormalizeToUniquePath(
|
||||
continue;
|
||||
}
|
||||
|
||||
if (fsRecPtr->fsPtr->normalizePathProc != NULL) {
|
||||
if (fsRecPtr->fsPtr->normalizePathProc != NULL && startAt < INT_MAX) {
|
||||
startAt = fsRecPtr->fsPtr->normalizePathProc(interp, pathPtr,
|
||||
startAt);
|
||||
(int)startAt);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2491,7 +2492,7 @@ TclFSFileAttrIndex(
|
||||
for (i=0 ; i<objc ; i++) {
|
||||
if (!strcmp(attributeName, TclGetString(objv[i]))) {
|
||||
TclDecrRefCount(listObj);
|
||||
*indexPtr = i;
|
||||
*indexPtr = (int)i;
|
||||
return TCL_OK;
|
||||
}
|
||||
}
|
||||
@@ -2783,7 +2784,7 @@ Tcl_FSGetCwd(
|
||||
norm = TclFSNormalizeAbsolutePath(interp, retVal);
|
||||
|
||||
if (norm == NULL) {
|
||||
/*
|
||||
/*
|
||||
* 'norm' shouldn't ever be NULL, but we are careful.
|
||||
*/
|
||||
|
||||
@@ -2794,7 +2795,7 @@ Tcl_FSGetCwd(
|
||||
} else if (norm == tsdPtr->cwdPathPtr) {
|
||||
goto cdEqual;
|
||||
} else {
|
||||
/*
|
||||
/*
|
||||
* Determine whether the filesystem's answer is the same as the
|
||||
* cached local value. Since both 'norm' and 'tsdPtr->cwdPathPtr'
|
||||
* are normalized pathnames, do something more efficient than
|
||||
@@ -2900,7 +2901,7 @@ Tcl_FSChdir(
|
||||
|
||||
retVal = 0;
|
||||
} else {
|
||||
/*
|
||||
/*
|
||||
* 'Tcl_SetErrno()' has already been called.
|
||||
*/
|
||||
}
|
||||
@@ -2910,9 +2911,8 @@ Tcl_FSChdir(
|
||||
}
|
||||
|
||||
if (retVal == 0) {
|
||||
|
||||
/* Assume that the cwd was actually changed to the normalized value
|
||||
* just calculated, and cache that information. */
|
||||
/* Assume that the cwd was actually changed to the normalized value
|
||||
* just calculated, and cache that information. */
|
||||
|
||||
/*
|
||||
* If the filesystem epoch changed recently, the normalized pathname or
|
||||
@@ -2929,7 +2929,9 @@ Tcl_FSChdir(
|
||||
Tcl_SetErrno(ENOENT);
|
||||
return -1;
|
||||
}
|
||||
if (normDirName != pathPtr) { Tcl_IncrRefCount(normDirName); }
|
||||
if (normDirName != pathPtr) {
|
||||
Tcl_IncrRefCount(normDirName);
|
||||
}
|
||||
|
||||
if (fsPtr == &tclNativeFilesystem) {
|
||||
void *cd;
|
||||
@@ -2981,7 +2983,9 @@ Tcl_FSChdir(
|
||||
*/
|
||||
Tcl_FSMountsChanged(NULL);
|
||||
}
|
||||
if (normDirName != pathPtr) { Tcl_DecrRefCount(normDirName); }
|
||||
if (normDirName != pathPtr) {
|
||||
Tcl_DecrRefCount(normDirName);
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* The current directory is now changed or an error occurred and an
|
||||
@@ -3096,7 +3100,7 @@ Tcl_FSLoadFile(
|
||||
#endif
|
||||
|
||||
static int
|
||||
skipUnlink(
|
||||
SkipUnlink(
|
||||
Tcl_Obj *shlibFile)
|
||||
{
|
||||
/*
|
||||
@@ -3286,9 +3290,9 @@ Tcl_LoadFile(
|
||||
* load further.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Try to delete the file we probably created and then exit.
|
||||
*/
|
||||
/*
|
||||
* Try to delete the file we probably created and then exit.
|
||||
*/
|
||||
|
||||
Tcl_FSDeleteFile(copyToPtr);
|
||||
Tcl_DecrRefCount(copyToPtr);
|
||||
@@ -3347,7 +3351,7 @@ Tcl_LoadFile(
|
||||
* and it avoids leaving the copy laying around after exit.
|
||||
*/
|
||||
|
||||
if (!skipUnlink(copyToPtr) &&
|
||||
if (!SkipUnlink(copyToPtr) &&
|
||||
(Tcl_FSDeleteFile(copyToPtr) == TCL_OK)) {
|
||||
Tcl_DecrRefCount(copyToPtr);
|
||||
|
||||
@@ -3379,7 +3383,7 @@ Tcl_LoadFile(
|
||||
tvdlPtr->unloadProcPtr = newUnloadProcPtr;
|
||||
|
||||
if (copyFsPtr != &tclNativeFilesystem) {
|
||||
/* refCount of copyToPtr is already incremented. */
|
||||
/* refCount of copyToPtr is already incremented. */
|
||||
tvdlPtr->divertedFile = copyToPtr;
|
||||
|
||||
/*
|
||||
@@ -4343,7 +4347,7 @@ Tcl_FSRemoveDirectory(
|
||||
Tcl_Obj *pathPtr, /* The pathname of the directory to be removed. */
|
||||
int recursive, /* If zero, removes only an empty directory.
|
||||
* Otherwise, removes the directory and all its
|
||||
* contents. */
|
||||
* contents. */
|
||||
Tcl_Obj **errorPtr) /* If not NULL and an error occurs, stores a
|
||||
* place to store a pointer to a new
|
||||
* object having a refCount of 1 and containing
|
||||
@@ -4462,7 +4466,7 @@ Tcl_FSGetFileSystemForPath(
|
||||
/* This is the filesystem for pathPtr. Assume the type of pathPtr
|
||||
* hasn't been changed by the above call to the
|
||||
* pathInFilesystemProc, and cache this result in the internal
|
||||
* representation of pathPtr. */
|
||||
* representation of pathPtr. */
|
||||
|
||||
TclFSSetPathDetails(pathPtr, fsRecPtr->fsPtr, clientData);
|
||||
Disclaim();
|
||||
|
||||
+98
-133
@@ -45,9 +45,9 @@ typedef enum {
|
||||
} UConverterCallbackReasonx;
|
||||
|
||||
typedef enum UNormalizationCheckResultx {
|
||||
UNORM_NO,
|
||||
UNORM_YES,
|
||||
UNORM_MAYBE
|
||||
UNORM_NO,
|
||||
UNORM_YES,
|
||||
UNORM_MAYBE
|
||||
} UNormalizationCheckResultx;
|
||||
|
||||
typedef struct UEnumeration UEnumeration;
|
||||
@@ -59,50 +59,31 @@ typedef struct UConverter UConverter;
|
||||
typedef struct UConverterFromUnicodeArgs UConverterFromUnicodeArgs;
|
||||
typedef struct UConverterToUnicodeArgs UConverterToUnicodeArgs;
|
||||
typedef void (*UConverterFromUCallback)(const void *context,
|
||||
UConverterFromUnicodeArgs *args,
|
||||
const UCharx *codeUnits,
|
||||
int32_t length, UChar32x codePoint,
|
||||
UConverterCallbackReasonx reason,
|
||||
UErrorCodex *pErrorCode);
|
||||
UConverterFromUnicodeArgs *args, const UCharx *codeUnits,
|
||||
int32_t length, UChar32x codePoint, UConverterCallbackReasonx reason,
|
||||
UErrorCodex *pErrorCode);
|
||||
typedef void (*UConverterToUCallback)(const void *context,
|
||||
UConverterToUnicodeArgs *args,
|
||||
const char *codeUnits,
|
||||
int32_t length,
|
||||
UConverterCallbackReasonx reason,
|
||||
UErrorCodex *pErrorCode);
|
||||
UConverterToUnicodeArgs *args, const char *codeUnits,
|
||||
int32_t length, UConverterCallbackReasonx reason,
|
||||
UErrorCodex *pErrorCode);
|
||||
/*
|
||||
* Prototypes for ICU functions sorted by category.
|
||||
*/
|
||||
typedef void (*fn_u_cleanup)(void);
|
||||
typedef const char *(*fn_u_errorName)(UErrorCodex);
|
||||
typedef UCharx *(*fn_u_strFromUTF32)(UCharx *dest,
|
||||
int32_t destCapacity,
|
||||
int32_t *pDestLength,
|
||||
const UChar32x *src,
|
||||
int32_t srcLength,
|
||||
UErrorCodex *pErrorCode);
|
||||
typedef UCharx *(*fn_u_strFromUTF32WithSub)(UCharx *dest,
|
||||
int32_t destCapacity,
|
||||
int32_t *pDestLength,
|
||||
const UChar32x *src,
|
||||
int32_t srcLength,
|
||||
UChar32x subchar,
|
||||
int32_t *pNumSubstitutions,
|
||||
UErrorCodex *pErrorCode);
|
||||
typedef UChar32x *(*fn_u_strToUTF32)(UChar32x *dest,
|
||||
int32_t destCapacity,
|
||||
int32_t *pDestLength,
|
||||
const UCharx *src,
|
||||
int32_t srcLength,
|
||||
UErrorCodex *pErrorCode);
|
||||
typedef UCharx *(*fn_u_strFromUTF32)(UCharx *dest, int32_t destCapacity,
|
||||
int32_t *pDestLength, const UChar32x *src, int32_t srcLength,
|
||||
UErrorCodex *pErrorCode);
|
||||
typedef UCharx *(*fn_u_strFromUTF32WithSub)(UCharx *dest, int32_t destCapacity,
|
||||
int32_t *pDestLength, const UChar32x *src, int32_t srcLength,
|
||||
UChar32x subchar, int32_t *pNumSubstitutions, UErrorCodex *pErrorCode);
|
||||
typedef UChar32x *(*fn_u_strToUTF32)(UChar32x *dest, int32_t destCapacity,
|
||||
int32_t *pDestLength, const UCharx *src, int32_t srcLength,
|
||||
UErrorCodex *pErrorCode);
|
||||
typedef UChar32x *(*fn_u_strToUTF32WithSub)(UChar32x *dest,
|
||||
int32_t destCapacity,
|
||||
int32_t *pDestLength,
|
||||
const UCharx *src,
|
||||
int32_t srcLength,
|
||||
UChar32x subchar,
|
||||
int32_t *pNumSubstitutions,
|
||||
UErrorCodex *pErrorCode);
|
||||
int32_t destCapacity, int32_t *pDestLength, const UCharx *src,
|
||||
int32_t srcLength, UChar32x subchar, int32_t *pNumSubstitutions,
|
||||
UErrorCodex *pErrorCode);
|
||||
|
||||
typedef void (*fn_ucnv_close)(UConverter *);
|
||||
typedef uint16_t (*fn_ucnv_countAliases)(const char *, UErrorCodex *);
|
||||
@@ -113,19 +94,15 @@ typedef const char *(*fn_ucnv_getAlias)(const char *, uint16_t, UErrorCodex *);
|
||||
typedef const char *(*fn_ucnv_getAvailableName)(int32_t);
|
||||
typedef UConverter *(*fn_ucnv_open)(const char *converterName, UErrorCodex *);
|
||||
typedef void (*fn_ucnv_setFromUCallBack)(UConverter *,
|
||||
UConverterFromUCallback newAction,
|
||||
const void *newContext,
|
||||
UConverterFromUCallback *oldAction,
|
||||
const void **oldContext,
|
||||
UErrorCodex *err);
|
||||
UConverterFromUCallback newAction, const void *newContext,
|
||||
UConverterFromUCallback *oldAction, const void **oldContext,
|
||||
UErrorCodex *err);
|
||||
typedef void (*fn_ucnv_setToUCallBack)(UConverter *,
|
||||
UConverterToUCallback newAction,
|
||||
const void *newContext,
|
||||
UConverterToUCallback *oldAction,
|
||||
const void **oldContext,
|
||||
UErrorCodex *err);
|
||||
UConverterToUCallback newAction, const void *newContext,
|
||||
UConverterToUCallback *oldAction, const void **oldContext,
|
||||
UErrorCodex *err);
|
||||
typedef int32_t (*fn_ucnv_toUChars)(UConverter *, UCharx *dest,
|
||||
int32_t destCapacity, const char *src, int32_t srcLen, UErrorCodex *);
|
||||
int32_t destCapacity, const char *src, int32_t srcLen, UErrorCodex *);
|
||||
typedef UConverterFromUCallback fn_UCNV_FROM_U_CALLBACK_STOP;
|
||||
typedef UConverterToUCallback fn_UCNV_TO_U_CALLBACK_STOP;
|
||||
|
||||
@@ -161,12 +138,8 @@ typedef UNormalizer2 *(*fn_unorm2_getNFCInstance)(UErrorCodex *);
|
||||
typedef UNormalizer2 *(*fn_unorm2_getNFDInstance)(UErrorCodex *);
|
||||
typedef UNormalizer2 *(*fn_unorm2_getNFKCInstance)(UErrorCodex *);
|
||||
typedef UNormalizer2 *(*fn_unorm2_getNFKDInstance)(UErrorCodex *);
|
||||
typedef int32_t (*fn_unorm2_normalize)(const UNormalizer2 *,
|
||||
const UCharx *,
|
||||
int32_t,
|
||||
UCharx *,
|
||||
int32_t,
|
||||
UErrorCodex *);
|
||||
typedef int32_t (*fn_unorm2_normalize)(const UNormalizer2 *, const UCharx *,
|
||||
int32_t, UCharx *, int32_t, UErrorCodex *);
|
||||
|
||||
#define FIELD(name) fn_ ## name _ ## name
|
||||
|
||||
@@ -354,8 +327,8 @@ DetectEncoding(
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (len > INT_MAX) {
|
||||
Tcl_SetObjResult(interp,
|
||||
Tcl_NewStringObj("Max length supported by ICU exceeded.", TCL_INDEX_NONE));
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"Max length supported by ICU exceeded.", TCL_INDEX_NONE));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
UErrorCodex status = U_ZERO_ERRORZ;
|
||||
@@ -499,14 +472,9 @@ IcuObjToUCharDString(
|
||||
char *s;
|
||||
Tcl_Size len;
|
||||
s = Tcl_GetStringFromObj(objPtr, &len);
|
||||
result = Tcl_UtfToExternalDStringEx(interp,
|
||||
encoding,
|
||||
s,
|
||||
len,
|
||||
strict ? TCL_ENCODING_PROFILE_STRICT
|
||||
: TCL_ENCODING_PROFILE_REPLACE,
|
||||
dsPtr,
|
||||
NULL);
|
||||
result = Tcl_UtfToExternalDStringEx(interp, encoding, s, len,
|
||||
strict ? TCL_ENCODING_PROFILE_STRICT : TCL_ENCODING_PROFILE_REPLACE,
|
||||
dsPtr, NULL);
|
||||
if (result != TCL_OK) {
|
||||
Tcl_DStringFree(dsPtr); /* Must be done on error */
|
||||
/* TCL_CONVER_* errors -> TCL_ERROR */
|
||||
@@ -554,14 +522,9 @@ IcuObjFromUCharDString(
|
||||
Tcl_Size len = Tcl_DStringLength(dsPtr);
|
||||
Tcl_DString dsOut;
|
||||
int result;
|
||||
result = Tcl_ExternalToUtfDStringEx(interp,
|
||||
encoding,
|
||||
s,
|
||||
len,
|
||||
strict ? TCL_ENCODING_PROFILE_STRICT
|
||||
: TCL_ENCODING_PROFILE_REPLACE,
|
||||
&dsOut,
|
||||
NULL);
|
||||
result = Tcl_ExternalToUtfDStringEx(interp, encoding, s, len,
|
||||
strict ? TCL_ENCODING_PROFILE_STRICT : TCL_ENCODING_PROFILE_REPLACE,
|
||||
&dsOut, NULL);
|
||||
|
||||
if (result == TCL_OK) {
|
||||
objPtr = Tcl_DStringToObj(&dsOut); /* Clears dsPtr! */
|
||||
@@ -593,7 +556,7 @@ static int
|
||||
IcuDetectObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
if (objc > 3) {
|
||||
@@ -639,7 +602,7 @@ static int
|
||||
IcuConverterNamesObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
|
||||
@@ -689,7 +652,7 @@ static int
|
||||
IcuConverterAliasesObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
if (objc != 2) {
|
||||
@@ -776,8 +739,8 @@ IcuConverttoDString(
|
||||
Tcl_Size utf16len = Tcl_DStringLength(dsInPtr) / sizeof(UCharx);
|
||||
Tcl_Size dstLen, dstCapacity;
|
||||
if (utf16len > INT_MAX) {
|
||||
Tcl_SetObjResult(interp,
|
||||
Tcl_NewStringObj("Max length supported by ICU exceeded.", TCL_INDEX_NONE));
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"Max length supported by ICU exceeded.", TCL_INDEX_NONE));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
@@ -785,7 +748,7 @@ IcuConverttoDString(
|
||||
Tcl_DStringInit(dsOutPtr);
|
||||
Tcl_DStringSetLength(dsOutPtr, dstCapacity);
|
||||
dstLen = ucnv_fromUChars(ucnvPtr, Tcl_DStringValue(dsOutPtr), (int)dstCapacity,
|
||||
utf16, (int)utf16len, &status);
|
||||
utf16, (int)utf16len, &status);
|
||||
if (U_FAILURE(status)) {
|
||||
switch (status) {
|
||||
case U_STRING_NOT_TERMINATED_WARNING:
|
||||
@@ -794,7 +757,7 @@ IcuConverttoDString(
|
||||
Tcl_DStringSetLength(dsOutPtr, (int)dstLen);
|
||||
status = U_ZERO_ERRORZ; /* Reset before call */
|
||||
dstLen = ucnv_fromUChars(ucnvPtr, Tcl_DStringValue(dsOutPtr), (int)dstLen,
|
||||
utf16, (int)utf16len, &status);
|
||||
utf16, (int)utf16len, &status);
|
||||
if (U_SUCCESS(status)) {
|
||||
break;
|
||||
}
|
||||
@@ -840,8 +803,8 @@ IcuBytesToUCharDString(
|
||||
}
|
||||
|
||||
if (nbytes > INT_MAX) {
|
||||
Tcl_SetObjResult(interp,
|
||||
Tcl_NewStringObj("Max length supported by ICU exceeded.", TCL_INDEX_NONE));
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"Max length supported by ICU exceeded.", TCL_INDEX_NONE));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
@@ -864,7 +827,7 @@ IcuBytesToUCharDString(
|
||||
Tcl_DStringInit(dsOutPtr);
|
||||
Tcl_DStringSetLength(dsOutPtr, dstCapacity);
|
||||
dstLen = ucnv_toUChars(ucnvPtr, (UCharx *)Tcl_DStringValue(dsOutPtr), dstCapacity,
|
||||
(const char *)bytes, (int)nbytes, &status);
|
||||
(const char *)bytes, (int)nbytes, &status);
|
||||
if (U_FAILURE(status)) {
|
||||
switch (status) {
|
||||
case U_STRING_NOT_TERMINATED_WARNING:
|
||||
@@ -874,7 +837,7 @@ IcuBytesToUCharDString(
|
||||
Tcl_DStringSetLength(dsOutPtr, dstCapacity);
|
||||
status = U_ZERO_ERRORZ; /* Reset before call */
|
||||
dstLen = ucnv_toUChars(ucnvPtr, (UCharx *)Tcl_DStringValue(dsOutPtr), dstCapacity,
|
||||
(const char *)bytes, (int)nbytes, &status);
|
||||
(const char *)bytes, (int)nbytes, &status);
|
||||
if (U_SUCCESS(status)) {
|
||||
break;
|
||||
}
|
||||
@@ -949,8 +912,8 @@ IcuNormalizeUCharDString(
|
||||
utf16 = (UCharx *) Tcl_DStringValue(dsInPtr);
|
||||
utf16len = Tcl_DStringLength(dsInPtr) / sizeof(UCharx);
|
||||
if (utf16len > INT_MAX) {
|
||||
Tcl_SetObjResult(interp,
|
||||
Tcl_NewStringObj("Max length supported by ICU exceeded.", TCL_INDEX_NONE));
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"Max length supported by ICU exceeded.", TCL_INDEX_NONE));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
Tcl_DStringInit(dsOutPtr);
|
||||
@@ -988,9 +951,10 @@ IcuNormalizeUCharDString(
|
||||
/*
|
||||
* Common function for parsing convert options.
|
||||
*/
|
||||
static int IcuParseConvertOptions(
|
||||
static int
|
||||
IcuParseConvertOptions(
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const objv[],
|
||||
int *strictPtr,
|
||||
Tcl_Obj **failindexVarPtr)
|
||||
@@ -1014,9 +978,9 @@ static int IcuParseConvertOptions(
|
||||
}
|
||||
++i;
|
||||
if (i == objc) {
|
||||
Tcl_SetObjResult(interp,
|
||||
Tcl_ObjPrintf("Missing value for option %s.",
|
||||
Tcl_GetString(objv[i - 1])));
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"Missing value for option %s.",
|
||||
Tcl_GetString(objv[i - 1])));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
const char *s = Tcl_GetString(objv[i]);
|
||||
@@ -1025,17 +989,17 @@ static int IcuParseConvertOptions(
|
||||
if (!strcmp(s, "replace")) {
|
||||
strict = 0;
|
||||
} else if (strcmp(s, "strict")) {
|
||||
Tcl_SetObjResult(interp,
|
||||
Tcl_ObjPrintf("Invalid value \"%s\" supplied for option"
|
||||
" \"-profile\". Must be \"strict\" or \"replace\".",
|
||||
s));
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"Invalid value \"%s\" supplied for option"
|
||||
" \"-profile\". Must be \"strict\" or \"replace\".",
|
||||
s));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
break;
|
||||
case OPT_FAILINDEX:
|
||||
/* TBD */
|
||||
Tcl_SetObjResult(interp,
|
||||
Tcl_NewStringObj("Option -failindex not implemented.", TCL_INDEX_NONE));
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"Option -failindex not implemented.", TCL_INDEX_NONE));
|
||||
return TCL_ERROR;
|
||||
default:
|
||||
TCL_UNREACHABLE();
|
||||
@@ -1067,7 +1031,7 @@ static int
|
||||
IcuConvertfromObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
int strict;
|
||||
@@ -1118,7 +1082,7 @@ static int
|
||||
IcuConverttoObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
int strict;
|
||||
@@ -1131,13 +1095,13 @@ IcuConverttoObjCmd(
|
||||
Tcl_DString dsIn;
|
||||
Tcl_DString dsOut;
|
||||
if (IcuObjToUCharDString(interp, objv[objc - 1], strict, &dsIn) != TCL_OK ||
|
||||
IcuConverttoDString(interp, &dsIn,
|
||||
Tcl_GetString(objv[objc-2]), strict, &dsOut) != TCL_OK) {
|
||||
IcuConverttoDString(interp, &dsIn,
|
||||
Tcl_GetString(objv[objc-2]), strict, &dsOut) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
Tcl_SetObjResult(interp,
|
||||
Tcl_NewByteArrayObj((unsigned char *)Tcl_DStringValue(&dsOut),
|
||||
Tcl_DStringLength(&dsOut)));
|
||||
Tcl_SetObjResult(interp, Tcl_NewByteArrayObj(
|
||||
(unsigned char *)Tcl_DStringValue(&dsOut),
|
||||
Tcl_DStringLength(&dsOut)));
|
||||
Tcl_DStringFree(&dsOut);
|
||||
return TCL_OK;
|
||||
}
|
||||
@@ -1163,7 +1127,7 @@ static int
|
||||
IcuNormalizeObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
static const char *const optNames[] = {"-profile", "-mode", NULL};
|
||||
@@ -1184,9 +1148,9 @@ IcuNormalizeObjCmd(
|
||||
}
|
||||
++i;
|
||||
if (i == (objc-1)) {
|
||||
Tcl_SetObjResult(interp,
|
||||
Tcl_ObjPrintf("Missing value for option %s.",
|
||||
Tcl_GetString(objv[i - 1])));
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"Missing value for option %s.",
|
||||
Tcl_GetString(objv[i - 1])));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
const char *s = Tcl_GetString(objv[i]);
|
||||
@@ -1195,15 +1159,16 @@ IcuNormalizeObjCmd(
|
||||
if (!strcmp(s, "replace")) {
|
||||
strict = 0;
|
||||
} else if (strcmp(s, "strict")) {
|
||||
Tcl_SetObjResult(interp,
|
||||
Tcl_ObjPrintf("Invalid value \"%s\" supplied for option \"-profile\". Must be "
|
||||
"\"strict\" or \"replace\".",
|
||||
s));
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"Invalid value \"%s\" supplied for option \"-profile\". "
|
||||
"Must be \"strict\" or \"replace\".",
|
||||
s));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
break;
|
||||
case OPT_MODE:
|
||||
if (Tcl_GetIndexFromObj(interp, objv[i], normalizationForms, "normalization mode", 0, &mode) != TCL_OK) {
|
||||
if (Tcl_GetIndexFromObj(interp, objv[i], normalizationForms,
|
||||
"normalization mode", 0, &mode) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
break;
|
||||
@@ -1340,7 +1305,7 @@ TclIcuInit(
|
||||
if (icu_fns.nopen == 0) {
|
||||
int i = 0;
|
||||
Tcl_Obj *nameobj;
|
||||
static const char * const iculibs[] = {
|
||||
static const char *const iculibs[] = {
|
||||
#if defined(_WIN32)
|
||||
# define DLLNAME "icu%s%s.dll"
|
||||
"icuuc??.dll", /* Windows, user-provided */
|
||||
@@ -1442,10 +1407,10 @@ TclIcuInit(
|
||||
|
||||
/* Symbol may have version (Linux), or not (Windows, FreeBSD) */
|
||||
|
||||
#define ICUUC_SYM(name) \
|
||||
do { \
|
||||
icu_fns._##name = \
|
||||
(fn_##name)IcuFindSymbol(icu_fns.libs[0], #name, icuversion); \
|
||||
#define ICUUC_SYM(name) \
|
||||
do { \
|
||||
icu_fns._##name = (fn_##name) \
|
||||
IcuFindSymbol(icu_fns.libs[0], #name, icuversion); \
|
||||
} while (0)
|
||||
|
||||
if (icu_fns.libs[0] != NULL) {
|
||||
@@ -1489,10 +1454,10 @@ TclIcuInit(
|
||||
#undef ICUUC_SYM
|
||||
}
|
||||
|
||||
#define ICUIN_SYM(name) \
|
||||
do { \
|
||||
icu_fns._##name = \
|
||||
(fn_##name)IcuFindSymbol(icu_fns.libs[1], #name, icuversion); \
|
||||
#define ICUIN_SYM(name) \
|
||||
do { \
|
||||
icu_fns._##name = (fn_##name) \
|
||||
IcuFindSymbol(icu_fns.libs[1], #name, icuversion); \
|
||||
} while (0)
|
||||
|
||||
if (icu_fns.libs[1] != NULL) {
|
||||
@@ -1517,11 +1482,11 @@ TclIcuInit(
|
||||
|
||||
/* Ref count number of commands */
|
||||
icu_fns.nopen += 3;
|
||||
Tcl_CreateObjCommand(interp, "::tcl::unsupported::icu::convertto",
|
||||
IcuConverttoObjCmd, 0, TclIcuCleanup);
|
||||
Tcl_CreateObjCommand(interp, "::tcl::unsupported::icu::convertfrom",
|
||||
IcuConvertfromObjCmd, 0, TclIcuCleanup);
|
||||
Tcl_CreateObjCommand(interp, "::tcl::unsupported::icu::detect",
|
||||
Tcl_CreateObjCommand2(interp, "::tcl::unsupported::icu::convertto",
|
||||
IcuConverttoObjCmd, 0, TclIcuCleanup);
|
||||
Tcl_CreateObjCommand2(interp, "::tcl::unsupported::icu::convertfrom",
|
||||
IcuConvertfromObjCmd, 0, TclIcuCleanup);
|
||||
Tcl_CreateObjCommand2(interp, "::tcl::unsupported::icu::detect",
|
||||
IcuDetectObjCmd, 0, TclIcuCleanup);
|
||||
}
|
||||
|
||||
@@ -1529,11 +1494,11 @@ TclIcuInit(
|
||||
|
||||
/* Ref count number of commands */
|
||||
icu_fns.nopen += 3; /* UPDATE AS CMDS ADDED/DELETED BELOW */
|
||||
Tcl_CreateObjCommand(interp, "::tcl::unsupported::icu::converters",
|
||||
Tcl_CreateObjCommand2(interp, "::tcl::unsupported::icu::converters",
|
||||
IcuConverterNamesObjCmd, 0, TclIcuCleanup);
|
||||
Tcl_CreateObjCommand(interp, "::tcl::unsupported::icu::aliases",
|
||||
Tcl_CreateObjCommand2(interp, "::tcl::unsupported::icu::aliases",
|
||||
IcuConverterAliasesObjCmd, 0, TclIcuCleanup);
|
||||
Tcl_CreateObjCommand(interp, "::tcl::unsupported::icu::normalize",
|
||||
Tcl_CreateObjCommand2(interp, "::tcl::unsupported::icu::normalize",
|
||||
IcuNormalizeObjCmd, 0, TclIcuCleanup);
|
||||
}
|
||||
|
||||
@@ -1560,7 +1525,7 @@ int
|
||||
TclLoadIcuObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
if (objc != 1) {
|
||||
|
||||
+46
-49
@@ -25,23 +25,30 @@ static int GetIndexFromObjList(Tcl_Interp *interp,
|
||||
static void UpdateStringOfIndex(Tcl_Obj *objPtr);
|
||||
static void DupIndex(Tcl_Obj *srcPtr, Tcl_Obj *dupPtr);
|
||||
static void FreeIndex(Tcl_Obj *objPtr);
|
||||
static Tcl_ObjCmdProc PrefixAllObjCmd;
|
||||
static Tcl_ObjCmdProc PrefixLongestObjCmd;
|
||||
static Tcl_ObjCmdProc PrefixMatchObjCmd;
|
||||
static Tcl_ObjCmdProc2 PrefixAllObjCmd;
|
||||
static Tcl_ObjCmdProc2 PrefixLongestObjCmd;
|
||||
static Tcl_ObjCmdProc2 PrefixMatchObjCmd;
|
||||
static void PrintUsage(Tcl_Interp *interp,
|
||||
const Tcl_ArgvInfo *argTable);
|
||||
|
||||
const EnsembleImplMap tclPrefixImplMap[] = {
|
||||
{"all", PrefixAllObjCmd, TclCompileBasic2ArgCmd, NULL, NULL, 0},
|
||||
{"longest", PrefixLongestObjCmd, TclCompileBasic2ArgCmd, NULL, NULL, 0},
|
||||
{"match", PrefixMatchObjCmd, TclCompileBasicMin2ArgCmd, NULL, NULL, 0},
|
||||
{NULL, NULL, NULL, NULL, NULL, 0}
|
||||
};
|
||||
|
||||
/*
|
||||
* The structure below defines the index Tcl object type by means of functions
|
||||
* that can be invoked by generic object code.
|
||||
*/
|
||||
|
||||
const Tcl_ObjType tclIndexType = {
|
||||
"index", /* name */
|
||||
FreeIndex, /* freeIntRepProc */
|
||||
DupIndex, /* dupIntRepProc */
|
||||
UpdateStringOfIndex, /* updateStringProc */
|
||||
NULL, /* setFromAnyProc */
|
||||
"index",
|
||||
FreeIndex,
|
||||
DupIndex,
|
||||
UpdateStringOfIndex,
|
||||
NULL, // SetFromAny
|
||||
TCL_OBJTYPE_V0
|
||||
};
|
||||
|
||||
@@ -55,7 +62,7 @@ const Tcl_ObjType tclIndexType = {
|
||||
|
||||
typedef struct {
|
||||
void *tablePtr; /* Pointer to the table of strings */
|
||||
Tcl_Size offset; /* Offset between table entries */
|
||||
Tcl_Size offset; /* Offset between table entries */
|
||||
Tcl_Size index; /* Selected index into table. */
|
||||
} IndexRep;
|
||||
|
||||
@@ -68,7 +75,9 @@ typedef struct {
|
||||
#define NEXT_ENTRY(table, offset) \
|
||||
(&(STRING_AT(table, offset)))
|
||||
#define EXPAND_OF(indexRep) \
|
||||
(((indexRep)->index != TCL_INDEX_NONE) ? STRING_AT((indexRep)->tablePtr, (indexRep)->offset*(indexRep)->index) : "")
|
||||
(((indexRep)->index != TCL_INDEX_NONE) ? \
|
||||
STRING_AT((indexRep)->tablePtr, (indexRep)->offset*(indexRep)->index) : \
|
||||
"")
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
@@ -303,20 +312,20 @@ Tcl_GetIndexFromObjStruct(
|
||||
flags &= (30-(int)(sizeof(int)<<1));
|
||||
if (flags) {
|
||||
if (flags == sizeof(uint16_t)<<1) {
|
||||
*(uint16_t *)indexPtr = index;
|
||||
*(uint16_t *)indexPtr = (uint16_t)index;
|
||||
return TCL_OK;
|
||||
} else if (flags == (int)(sizeof(uint8_t)<<1)) {
|
||||
*(uint8_t *)indexPtr = index;
|
||||
*(uint8_t *)indexPtr = (uint8_t)index;
|
||||
return TCL_OK;
|
||||
} else if (flags == (int)(sizeof(int64_t)<<1)) {
|
||||
*(int64_t *)indexPtr = index;
|
||||
return TCL_OK;
|
||||
} else if (flags == (int)(sizeof(int32_t)<<1)) {
|
||||
*(int32_t *)indexPtr = index;
|
||||
*(int32_t *)indexPtr = (int32_t)index;
|
||||
return TCL_OK;
|
||||
}
|
||||
}
|
||||
*(int *)indexPtr = index;
|
||||
*(int *)indexPtr = (int)index;
|
||||
}
|
||||
return TCL_OK;
|
||||
|
||||
@@ -363,7 +372,8 @@ Tcl_GetIndexFromObjStruct(
|
||||
}
|
||||
/* #define again, needed below */
|
||||
#define Tcl_GetIndexFromObjStruct(interp, objPtr, tablePtr, offset, msg, flags, indexPtr) \
|
||||
((Tcl_GetIndexFromObjStruct)((interp), (objPtr), (tablePtr), (offset), (msg), (flags)|(int)(sizeof(*(indexPtr))<<1), (indexPtr)))
|
||||
((Tcl_GetIndexFromObjStruct)((interp), (objPtr), (tablePtr), (offset), \
|
||||
(msg), (flags)|(int)(sizeof(*(indexPtr))<<1), (indexPtr)))
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
@@ -386,7 +396,8 @@ static void
|
||||
UpdateStringOfIndex(
|
||||
Tcl_Obj *objPtr)
|
||||
{
|
||||
IndexRep *indexRep = (IndexRep *)TclFetchInternalRep(objPtr, &tclIndexType)->twoPtrValue.ptr1;
|
||||
IndexRep *indexRep = (IndexRep *)
|
||||
TclFetchInternalRep(objPtr, &tclIndexType)->twoPtrValue.ptr1;
|
||||
const char *indexStr = EXPAND_OF(indexRep);
|
||||
size_t len = strlen(indexStr);
|
||||
|
||||
@@ -454,13 +465,13 @@ FreeIndex(
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* TclInitPrefixCmd --
|
||||
* TclSetUpPrefixCmd --
|
||||
*
|
||||
* This procedure creates the "prefix" Tcl command. See the user
|
||||
* This procedure sets up the "prefix" Tcl command. See the user
|
||||
* documentation for details on what it does.
|
||||
*
|
||||
* Results:
|
||||
* A standard Tcl result.
|
||||
* Tcl result code.
|
||||
*
|
||||
* Side effects:
|
||||
* See the user documentation.
|
||||
@@ -468,22 +479,13 @@ FreeIndex(
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
Tcl_Command
|
||||
TclInitPrefixCmd(
|
||||
Tcl_Interp *interp) /* Current interpreter. */
|
||||
int
|
||||
TclSetUpPrefixCmd(
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
Tcl_Command ensemble) /* The prefix ensemble. */
|
||||
{
|
||||
static const EnsembleImplMap prefixImplMap[] = {
|
||||
{"all", PrefixAllObjCmd, TclCompileBasic2ArgCmd, NULL, NULL, 0},
|
||||
{"longest", PrefixLongestObjCmd,TclCompileBasic2ArgCmd, NULL, NULL, 0},
|
||||
{"match", PrefixMatchObjCmd, TclCompileBasicMin2ArgCmd, NULL, NULL, 0},
|
||||
{NULL, NULL, NULL, NULL, NULL, 0}
|
||||
};
|
||||
Tcl_Command prefixCmd;
|
||||
|
||||
prefixCmd = TclMakeEnsemble(interp, "::tcl::prefix", prefixImplMap);
|
||||
Tcl_Export(interp, Tcl_FindNamespace(interp, "::tcl", NULL, 0),
|
||||
return Tcl_Export(interp, (Tcl_Namespace*)((Command *)ensemble)->nsPtr,
|
||||
"prefix", 0);
|
||||
return prefixCmd;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
@@ -506,7 +508,7 @@ static int
|
||||
PrefixMatchObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
int flags = 0, result;
|
||||
@@ -630,7 +632,7 @@ static int
|
||||
PrefixAllObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
int result;
|
||||
@@ -688,7 +690,7 @@ static int
|
||||
PrefixLongestObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
int result;
|
||||
@@ -807,7 +809,7 @@ PrefixLongestObjCmd(
|
||||
void
|
||||
Tcl_WrongNumArgs(
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
Tcl_Size 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
|
||||
@@ -1010,13 +1012,13 @@ Tcl_ParseArgsObjv(
|
||||
/* Descriptor that matches current argument */
|
||||
Tcl_Obj *curArg; /* Current argument */
|
||||
const char *str = NULL;
|
||||
char c; /* Second character of current arg (used for
|
||||
char c; /* Second character of current arg (used for
|
||||
* quick check for matching; use 2nd char.
|
||||
* because first char. will almost always be
|
||||
* '-'). */
|
||||
Tcl_Size srcIndex; /* Location from which to read next argument
|
||||
Tcl_Size srcIndex; /* Location from which to read next argument
|
||||
* from objv. */
|
||||
Tcl_Size dstIndex; /* Used to keep track of current arguments
|
||||
Tcl_Size dstIndex; /* Used to keep track of current arguments
|
||||
* being processed, primarily for error
|
||||
* reporting. */
|
||||
Tcl_Size objc; /* # arguments in objv still to process. */
|
||||
@@ -1108,7 +1110,7 @@ Tcl_ParseArgsObjv(
|
||||
infoPtr = matchPtr;
|
||||
switch (infoPtr->type) {
|
||||
case TCL_ARGV_CONSTANT:
|
||||
*((int *) infoPtr->dstPtr) = PTR2INT(infoPtr->srcPtr);
|
||||
*((int *)infoPtr->dstPtr) = (int)PTR2INT(infoPtr->srcPtr);
|
||||
break;
|
||||
case TCL_ARGV_INT:
|
||||
if (objc == 0) {
|
||||
@@ -1140,7 +1142,7 @@ Tcl_ParseArgsObjv(
|
||||
*/
|
||||
|
||||
if (infoPtr->dstPtr != NULL) {
|
||||
*((int *) infoPtr->dstPtr) = dstIndex;
|
||||
*((int *)infoPtr->dstPtr) = (int)dstIndex;
|
||||
}
|
||||
goto argsDone;
|
||||
case TCL_ARGV_FLOAT:
|
||||
@@ -1148,7 +1150,7 @@ Tcl_ParseArgsObjv(
|
||||
goto missingArg;
|
||||
}
|
||||
if (Tcl_GetDoubleFromObj(interp, objv[srcIndex],
|
||||
(double *) infoPtr->dstPtr) == TCL_ERROR) {
|
||||
(double *)infoPtr->dstPtr) == TCL_ERROR) {
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"expected floating-point argument for \"%s\" but got \"%s\"",
|
||||
infoPtr->keyStr, TclGetString(objv[srcIndex])));
|
||||
@@ -1175,11 +1177,6 @@ Tcl_ParseArgsObjv(
|
||||
}
|
||||
case TCL_ARGV_GENFUNC: {
|
||||
|
||||
if (objc > INT_MAX) {
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"too many (%" TCL_SIZE_MODIFIER "d) arguments for TCL_ARGV_GENFUNC", objc));
|
||||
goto error;
|
||||
}
|
||||
Tcl_ArgvGenFuncProc *handlerProc = (Tcl_ArgvGenFuncProc *)
|
||||
infoPtr->srcPtr;
|
||||
|
||||
@@ -1269,7 +1266,7 @@ PrintUsage(
|
||||
* descriptions. */
|
||||
{
|
||||
const Tcl_ArgvInfo *infoPtr;
|
||||
int width, numSpaces;
|
||||
Tcl_Size width, numSpaces;
|
||||
#define NUM_SPACES 20
|
||||
static const char spaces[] = " ";
|
||||
Tcl_Obj *msg;
|
||||
|
||||
+9
-14
@@ -158,17 +158,12 @@ declare 61 {
|
||||
declare 62 {
|
||||
int TclObjCommandComplete(Tcl_Obj *cmdPtr)
|
||||
}
|
||||
# Removed in 9.0:
|
||||
#declare 63 {
|
||||
# int TclObjInterpProc(void *clientData, Tcl_Interp *interp,
|
||||
# Tcl_Size objc, Tcl_Obj *const objv[])
|
||||
#}
|
||||
declare 64 {
|
||||
int TclObjInvoke(Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[],
|
||||
int flags)
|
||||
}
|
||||
declare 69 {
|
||||
void *TclpAlloc(TCL_HASH_TYPE size)
|
||||
void *TclpAlloc(size_t size)
|
||||
}
|
||||
declare 74 {
|
||||
void TclpFree(void *ptr)
|
||||
@@ -184,7 +179,7 @@ declare 76 {
|
||||
# void TclpGetTime(Tcl_Time *time)
|
||||
#}
|
||||
declare 81 {
|
||||
void *TclpRealloc(void *ptr, TCL_HASH_TYPE size)
|
||||
void *TclpRealloc(void *ptr, size_t size)
|
||||
}
|
||||
# Removed in 9.0:
|
||||
#declare 88 {
|
||||
@@ -465,7 +460,7 @@ declare 214 {
|
||||
void TclSetObjNameOfExecutable(Tcl_Obj *name, Tcl_Encoding encoding)
|
||||
}
|
||||
declare 215 {
|
||||
void *TclStackAlloc(Tcl_Interp *interp, TCL_HASH_TYPE numBytes)
|
||||
void *TclStackAlloc(Tcl_Interp *interp, size_t numBytes)
|
||||
}
|
||||
declare 216 {
|
||||
void TclStackFree(Tcl_Interp *interp, void *freePtr)
|
||||
@@ -513,7 +508,7 @@ declare 227 {
|
||||
}
|
||||
declare 229 {
|
||||
int TclPtrMakeUpvar(Tcl_Interp *interp, Var *otherP1Ptr,
|
||||
const char *myName, int myFlags, int index)
|
||||
const char *myName, int myFlags, Tcl_Size index)
|
||||
}
|
||||
declare 230 {
|
||||
Var *TclObjLookupVar(Tcl_Interp *interp, Tcl_Obj *part1Ptr,
|
||||
@@ -528,7 +523,7 @@ declare 231 {
|
||||
# Bits and pieces of TIP#280's guts
|
||||
declare 232 {
|
||||
int TclEvalObjEx(Tcl_Interp *interp, Tcl_Obj *objPtr, int flags,
|
||||
const CmdFrame *invoker, int word)
|
||||
const CmdFrame *invoker, Tcl_Size word)
|
||||
}
|
||||
declare 233 {
|
||||
void TclGetSrcInfoForPc(CmdFrame *contextPtr)
|
||||
@@ -560,15 +555,15 @@ declare 239 {
|
||||
}
|
||||
declare 240 {
|
||||
int TclNRRunCallbacks(Tcl_Interp *interp, int result,
|
||||
struct NRE_callback *rootPtr)
|
||||
NRE_callback *rootPtr)
|
||||
}
|
||||
declare 241 {
|
||||
int TclNREvalObjEx(Tcl_Interp *interp, Tcl_Obj *objPtr, int flags,
|
||||
const CmdFrame *invoker, int word)
|
||||
const CmdFrame *invoker, Tcl_Size word)
|
||||
}
|
||||
declare 242 {
|
||||
int TclNREvalObjv(Tcl_Interp *interp, Tcl_Size objc,
|
||||
Tcl_Obj *const objv[], int flags, Command *cmdPtr)
|
||||
Tcl_Obj *const objv[], int flags, Command *cmdPtr)
|
||||
}
|
||||
|
||||
# Tcl_Obj leak detection support.
|
||||
@@ -598,7 +593,7 @@ declare 248 {
|
||||
|
||||
declare 249 {
|
||||
char *TclDoubleDigits(double dv, int ndigits, int flags,
|
||||
int *decpt, int *signum, char **endPtr)
|
||||
int *decpt, int *signum, char **endPtr)
|
||||
}
|
||||
# TIP #285: Script cancellation support.
|
||||
declare 250 {
|
||||
|
||||
+624
-626
File diff suppressed because it is too large
Load Diff
+26
-26
@@ -27,6 +27,10 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef TCL_NO_DEPRECATED
|
||||
#define Tcl_ObjCmdProc void
|
||||
#endif
|
||||
|
||||
/*
|
||||
* WARNING: This file is automatically generated by the tools/genStubs.tcl
|
||||
* script. Any modifications to the function declarations below should be made
|
||||
@@ -171,7 +175,7 @@ EXTERN int TclObjInvoke(Tcl_Interp *interp, Tcl_Size objc,
|
||||
/* Slot 67 is reserved */
|
||||
/* Slot 68 is reserved */
|
||||
/* 69 */
|
||||
EXTERN void * TclpAlloc(TCL_HASH_TYPE size);
|
||||
EXTERN void * TclpAlloc(size_t size);
|
||||
/* Slot 70 is reserved */
|
||||
/* Slot 71 is reserved */
|
||||
/* Slot 72 is reserved */
|
||||
@@ -187,7 +191,7 @@ EXTERN unsigned long long TclpGetSeconds(void);
|
||||
/* Slot 79 is reserved */
|
||||
/* Slot 80 is reserved */
|
||||
/* 81 */
|
||||
EXTERN void * TclpRealloc(void *ptr, TCL_HASH_TYPE size);
|
||||
EXTERN void * TclpRealloc(void *ptr, size_t size);
|
||||
/* Slot 82 is reserved */
|
||||
/* Slot 83 is reserved */
|
||||
/* Slot 84 is reserved */
|
||||
@@ -440,8 +444,7 @@ EXTERN Tcl_Obj * TclGetObjNameOfExecutable(void);
|
||||
EXTERN void TclSetObjNameOfExecutable(Tcl_Obj *name,
|
||||
Tcl_Encoding encoding);
|
||||
/* 215 */
|
||||
EXTERN void * TclStackAlloc(Tcl_Interp *interp,
|
||||
TCL_HASH_TYPE numBytes);
|
||||
EXTERN void * TclStackAlloc(Tcl_Interp *interp, size_t numBytes);
|
||||
/* 216 */
|
||||
EXTERN void TclStackFree(Tcl_Interp *interp, void *freePtr);
|
||||
/* 217 */
|
||||
@@ -477,7 +480,8 @@ EXTERN void TclSetNsPath(Namespace *nsPtr, Tcl_Size pathLength,
|
||||
/* Slot 228 is reserved */
|
||||
/* 229 */
|
||||
EXTERN int TclPtrMakeUpvar(Tcl_Interp *interp, Var *otherP1Ptr,
|
||||
const char *myName, int myFlags, int index);
|
||||
const char *myName, int myFlags,
|
||||
Tcl_Size index);
|
||||
/* 230 */
|
||||
EXTERN Var * TclObjLookupVar(Tcl_Interp *interp,
|
||||
Tcl_Obj *part1Ptr, const char *part2,
|
||||
@@ -488,7 +492,8 @@ EXTERN int TclGetNamespaceFromObj(Tcl_Interp *interp,
|
||||
Tcl_Obj *objPtr, Tcl_Namespace **nsPtrPtr);
|
||||
/* 232 */
|
||||
EXTERN int TclEvalObjEx(Tcl_Interp *interp, Tcl_Obj *objPtr,
|
||||
int flags, const CmdFrame *invoker, int word);
|
||||
int flags, const CmdFrame *invoker,
|
||||
Tcl_Size word);
|
||||
/* 233 */
|
||||
EXTERN void TclGetSrcInfoForPc(CmdFrame *contextPtr);
|
||||
/* 234 */
|
||||
@@ -509,10 +514,11 @@ EXTERN int TclNRInterpProcCore(Tcl_Interp *interp,
|
||||
ProcErrorProc *errorProc);
|
||||
/* 240 */
|
||||
EXTERN int TclNRRunCallbacks(Tcl_Interp *interp, int result,
|
||||
struct NRE_callback *rootPtr);
|
||||
NRE_callback *rootPtr);
|
||||
/* 241 */
|
||||
EXTERN int TclNREvalObjEx(Tcl_Interp *interp, Tcl_Obj *objPtr,
|
||||
int flags, const CmdFrame *invoker, int word);
|
||||
int flags, const CmdFrame *invoker,
|
||||
Tcl_Size word);
|
||||
/* 242 */
|
||||
EXTERN int TclNREvalObjv(Tcl_Interp *interp, Tcl_Size objc,
|
||||
Tcl_Obj *const objv[], int flags,
|
||||
@@ -650,7 +656,7 @@ typedef struct TclIntStubs {
|
||||
void (*reserved66)(void);
|
||||
void (*reserved67)(void);
|
||||
void (*reserved68)(void);
|
||||
void * (*tclpAlloc) (TCL_HASH_TYPE size); /* 69 */
|
||||
void * (*tclpAlloc) (size_t size); /* 69 */
|
||||
void (*reserved70)(void);
|
||||
void (*reserved71)(void);
|
||||
void (*reserved72)(void);
|
||||
@@ -662,7 +668,7 @@ typedef struct TclIntStubs {
|
||||
void (*reserved78)(void);
|
||||
void (*reserved79)(void);
|
||||
void (*reserved80)(void);
|
||||
void * (*tclpRealloc) (void *ptr, TCL_HASH_TYPE size); /* 81 */
|
||||
void * (*tclpRealloc) (void *ptr, size_t size); /* 81 */
|
||||
void (*reserved82)(void);
|
||||
void (*reserved83)(void);
|
||||
void (*reserved84)(void);
|
||||
@@ -796,7 +802,7 @@ typedef struct TclIntStubs {
|
||||
void (*tclpFindExecutable) (const char *argv0); /* 212 */
|
||||
Tcl_Obj * (*tclGetObjNameOfExecutable) (void); /* 213 */
|
||||
void (*tclSetObjNameOfExecutable) (Tcl_Obj *name, Tcl_Encoding encoding); /* 214 */
|
||||
void * (*tclStackAlloc) (Tcl_Interp *interp, TCL_HASH_TYPE numBytes); /* 215 */
|
||||
void * (*tclStackAlloc) (Tcl_Interp *interp, size_t numBytes); /* 215 */
|
||||
void (*tclStackFree) (Tcl_Interp *interp, void *freePtr); /* 216 */
|
||||
int (*tclPushStackFrame) (Tcl_Interp *interp, Tcl_CallFrame **framePtrPtr, Tcl_Namespace *namespacePtr, int isProcCallFrame); /* 217 */
|
||||
void (*tclPopStackFrame) (Tcl_Interp *interp); /* 218 */
|
||||
@@ -810,10 +816,10 @@ typedef struct TclIntStubs {
|
||||
int (*tclObjBeingDeleted) (Tcl_Obj *objPtr); /* 226 */
|
||||
void (*tclSetNsPath) (Namespace *nsPtr, Tcl_Size pathLength, Tcl_Namespace *pathAry[]); /* 227 */
|
||||
void (*reserved228)(void);
|
||||
int (*tclPtrMakeUpvar) (Tcl_Interp *interp, Var *otherP1Ptr, const char *myName, int myFlags, int index); /* 229 */
|
||||
int (*tclPtrMakeUpvar) (Tcl_Interp *interp, Var *otherP1Ptr, const char *myName, int myFlags, Tcl_Size index); /* 229 */
|
||||
Var * (*tclObjLookupVar) (Tcl_Interp *interp, Tcl_Obj *part1Ptr, const char *part2, int flags, const char *msg, int createPart1, int createPart2, Var **arrayPtrPtr); /* 230 */
|
||||
int (*tclGetNamespaceFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_Namespace **nsPtrPtr); /* 231 */
|
||||
int (*tclEvalObjEx) (Tcl_Interp *interp, Tcl_Obj *objPtr, int flags, const CmdFrame *invoker, int word); /* 232 */
|
||||
int (*tclEvalObjEx) (Tcl_Interp *interp, Tcl_Obj *objPtr, int flags, const CmdFrame *invoker, Tcl_Size word); /* 232 */
|
||||
void (*tclGetSrcInfoForPc) (CmdFrame *contextPtr); /* 233 */
|
||||
Var * (*tclVarHashCreateVar) (TclVarHashTable *tablePtr, const char *key, int *newPtr); /* 234 */
|
||||
void (*tclInitVarHashTable) (TclVarHashTable *tablePtr, Namespace *nsPtr); /* 235 */
|
||||
@@ -821,8 +827,8 @@ typedef struct TclIntStubs {
|
||||
int (*tclResetCancellation) (Tcl_Interp *interp, int force); /* 237 */
|
||||
int (*tclNRInterpProc) (void *clientData, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); /* 238 */
|
||||
int (*tclNRInterpProcCore) (Tcl_Interp *interp, Tcl_Obj *procNameObj, Tcl_Size skip, ProcErrorProc *errorProc); /* 239 */
|
||||
int (*tclNRRunCallbacks) (Tcl_Interp *interp, int result, struct NRE_callback *rootPtr); /* 240 */
|
||||
int (*tclNREvalObjEx) (Tcl_Interp *interp, Tcl_Obj *objPtr, int flags, const CmdFrame *invoker, int word); /* 241 */
|
||||
int (*tclNRRunCallbacks) (Tcl_Interp *interp, int result, NRE_callback *rootPtr); /* 240 */
|
||||
int (*tclNREvalObjEx) (Tcl_Interp *interp, Tcl_Obj *objPtr, int flags, const CmdFrame *invoker, Tcl_Size word); /* 241 */
|
||||
int (*tclNREvalObjv) (Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[], int flags, Command *cmdPtr); /* 242 */
|
||||
void (*tclDbDumpActiveObjects) (FILE *outFile); /* 243 */
|
||||
Tcl_HashTable * (*tclGetNamespaceChildTable) (Tcl_Namespace *nsPtr); /* 244 */
|
||||
@@ -1265,23 +1271,17 @@ extern const TclIntStubs *tclIntStubsPtr;
|
||||
|
||||
/* !END!: Do not edit above this line. */
|
||||
|
||||
#ifdef TCL_NO_DEPRECATED
|
||||
#undef Tcl_ObjCmdProc
|
||||
#undef TclGetObjInterpProc
|
||||
#endif
|
||||
|
||||
#if defined(USE_TCL_STUBS)
|
||||
#undef Tcl_StaticLibrary
|
||||
#define Tcl_StaticLibrary \
|
||||
(tclIntStubsPtr->tclStaticLibrary)
|
||||
#endif /* defined(USE_TCL_STUBS) */
|
||||
|
||||
#if (TCL_MAJOR_VERSION < 9) && defined(USE_TCL_STUBS)
|
||||
#undef TclpGetClicks
|
||||
#define TclpGetClicks() \
|
||||
((unsigned long)tclIntStubsPtr->tclpGetClicks())
|
||||
#undef TclpGetSeconds
|
||||
#define TclpGetSeconds() \
|
||||
((unsigned long)tclIntStubsPtr->tclpGetSeconds())
|
||||
#undef TclGetObjInterpProc2
|
||||
#define TclGetObjInterpProc2 TclGetObjInterpProc
|
||||
#endif
|
||||
|
||||
#undef TclUnusedStubEntry
|
||||
#define TclObjInterpProc TclGetObjInterpProc()
|
||||
#define TclObjInterpProc2 TclGetObjInterpProc2()
|
||||
|
||||
+1
-488
@@ -30,492 +30,6 @@
|
||||
* in the generic/tclInt.decls script.
|
||||
*/
|
||||
|
||||
#if TCL_MAJOR_VERSION < 9
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Exported function declarations:
|
||||
*/
|
||||
|
||||
#if !defined(_WIN32) && !defined(__CYGWIN__) && !defined(MAC_OSX_TCL) /* UNIX */
|
||||
/* 0 */
|
||||
EXTERN void TclGetAndDetachPids(Tcl_Interp *interp,
|
||||
Tcl_Channel chan);
|
||||
/* 1 */
|
||||
EXTERN int TclpCloseFile(TclFile file);
|
||||
/* 2 */
|
||||
EXTERN Tcl_Channel TclpCreateCommandChannel(TclFile readFile,
|
||||
TclFile writeFile, TclFile errorFile,
|
||||
int numPids, Tcl_Pid *pidPtr);
|
||||
/* 3 */
|
||||
EXTERN int TclpCreatePipe(TclFile *readPipe, TclFile *writePipe);
|
||||
/* 4 */
|
||||
EXTERN int TclpCreateProcess(Tcl_Interp *interp, int argc,
|
||||
const char **argv, TclFile inputFile,
|
||||
TclFile outputFile, TclFile errorFile,
|
||||
Tcl_Pid *pidPtr);
|
||||
/* Slot 5 is reserved */
|
||||
/* 6 */
|
||||
EXTERN TclFile TclpMakeFile(Tcl_Channel channel, int direction);
|
||||
/* 7 */
|
||||
EXTERN TclFile TclpOpenFile(const char *fname, int mode);
|
||||
/* 8 */
|
||||
EXTERN int TclUnixWaitForFile(int fd, int mask, int timeout);
|
||||
/* 9 */
|
||||
EXTERN TclFile TclpCreateTempFile(const char *contents);
|
||||
/* 10 */
|
||||
EXTERN Tcl_DirEntry * TclpReaddir(TclDIR *dir);
|
||||
/* Slot 11 is reserved */
|
||||
/* Slot 12 is reserved */
|
||||
/* Slot 13 is reserved */
|
||||
/* 14 */
|
||||
EXTERN int TclUnixCopyFile(const char *src, const char *dst,
|
||||
const Tcl_StatBuf *statBufPtr,
|
||||
int dontCopyAtts);
|
||||
/* 15 */
|
||||
EXTERN int TclMacOSXGetFileAttribute(Tcl_Interp *interp,
|
||||
int objIndex, Tcl_Obj *fileName,
|
||||
Tcl_Obj **attributePtrPtr);
|
||||
/* 16 */
|
||||
EXTERN int TclMacOSXSetFileAttribute(Tcl_Interp *interp,
|
||||
int objIndex, Tcl_Obj *fileName,
|
||||
Tcl_Obj *attributePtr);
|
||||
/* 17 */
|
||||
EXTERN int TclMacOSXCopyFileAttributes(const char *src,
|
||||
const char *dst,
|
||||
const Tcl_StatBuf *statBufPtr);
|
||||
/* 18 */
|
||||
EXTERN int TclMacOSXMatchType(Tcl_Interp *interp,
|
||||
const char *pathName, const char *fileName,
|
||||
Tcl_StatBuf *statBufPtr,
|
||||
Tcl_GlobTypeData *types);
|
||||
/* 19 */
|
||||
EXTERN void TclMacOSXNotifierAddRunLoopMode(
|
||||
const void *runLoopMode);
|
||||
/* Slot 20 is reserved */
|
||||
/* Slot 21 is reserved */
|
||||
/* Slot 22 is reserved */
|
||||
/* Slot 23 is reserved */
|
||||
/* Slot 24 is reserved */
|
||||
/* Slot 25 is reserved */
|
||||
/* Slot 26 is reserved */
|
||||
/* Slot 27 is reserved */
|
||||
/* Slot 28 is reserved */
|
||||
/* 29 */
|
||||
EXTERN int TclWinCPUID(int index, int *regs);
|
||||
/* 30 */
|
||||
EXTERN int TclUnixOpenTemporaryFile(Tcl_Obj *dirObj,
|
||||
Tcl_Obj *basenameObj, Tcl_Obj *extensionObj,
|
||||
Tcl_Obj *resultingNameObj);
|
||||
#endif /* UNIX */
|
||||
#if defined(_WIN32) || defined(__CYGWIN__) /* WIN */
|
||||
/* Slot 0 is reserved */
|
||||
/* Slot 1 is reserved */
|
||||
/* Slot 2 is reserved */
|
||||
/* Slot 3 is reserved */
|
||||
/* 4 */
|
||||
EXTERN void * TclWinGetTclInstance(void);
|
||||
/* 5 */
|
||||
EXTERN int TclUnixWaitForFile(int fd, int mask, int timeout);
|
||||
/* Slot 6 is reserved */
|
||||
/* Slot 7 is reserved */
|
||||
/* 8 */
|
||||
EXTERN Tcl_Size TclpGetPid(Tcl_Pid pid);
|
||||
/* Slot 9 is reserved */
|
||||
/* Slot 10 is reserved */
|
||||
/* 11 */
|
||||
EXTERN void TclGetAndDetachPids(Tcl_Interp *interp,
|
||||
Tcl_Channel chan);
|
||||
/* 12 */
|
||||
EXTERN int TclpCloseFile(TclFile file);
|
||||
/* 13 */
|
||||
EXTERN Tcl_Channel TclpCreateCommandChannel(TclFile readFile,
|
||||
TclFile writeFile, TclFile errorFile,
|
||||
int numPids, Tcl_Pid *pidPtr);
|
||||
/* 14 */
|
||||
EXTERN int TclpCreatePipe(TclFile *readPipe, TclFile *writePipe);
|
||||
/* 15 */
|
||||
EXTERN int TclpCreateProcess(Tcl_Interp *interp, int argc,
|
||||
const char **argv, TclFile inputFile,
|
||||
TclFile outputFile, TclFile errorFile,
|
||||
Tcl_Pid *pidPtr);
|
||||
/* 16 */
|
||||
EXTERN int TclpIsAtty(int fd);
|
||||
/* 17 */
|
||||
EXTERN int TclUnixCopyFile(const char *src, const char *dst,
|
||||
const Tcl_StatBuf *statBufPtr,
|
||||
int dontCopyAtts);
|
||||
/* 18 */
|
||||
EXTERN TclFile TclpMakeFile(Tcl_Channel channel, int direction);
|
||||
/* 19 */
|
||||
EXTERN TclFile TclpOpenFile(const char *fname, int mode);
|
||||
/* 20 */
|
||||
EXTERN void TclWinAddProcess(void *hProcess, Tcl_Size id);
|
||||
/* Slot 21 is reserved */
|
||||
/* 22 */
|
||||
EXTERN TclFile TclpCreateTempFile(const char *contents);
|
||||
/* Slot 23 is reserved */
|
||||
/* 24 */
|
||||
EXTERN char * TclWinNoBackslash(char *path);
|
||||
/* Slot 25 is reserved */
|
||||
/* Slot 26 is reserved */
|
||||
/* 27 */
|
||||
EXTERN void TclWinFlushDirtyChannels(void);
|
||||
/* Slot 28 is reserved */
|
||||
/* 29 */
|
||||
EXTERN int TclWinCPUID(int index, int *regs);
|
||||
/* 30 */
|
||||
EXTERN int TclUnixOpenTemporaryFile(Tcl_Obj *dirObj,
|
||||
Tcl_Obj *basenameObj, Tcl_Obj *extensionObj,
|
||||
Tcl_Obj *resultingNameObj);
|
||||
#endif /* WIN */
|
||||
#ifdef MAC_OSX_TCL /* MACOSX */
|
||||
/* 0 */
|
||||
EXTERN void TclGetAndDetachPids(Tcl_Interp *interp,
|
||||
Tcl_Channel chan);
|
||||
/* 1 */
|
||||
EXTERN int TclpCloseFile(TclFile file);
|
||||
/* 2 */
|
||||
EXTERN Tcl_Channel TclpCreateCommandChannel(TclFile readFile,
|
||||
TclFile writeFile, TclFile errorFile,
|
||||
int numPids, Tcl_Pid *pidPtr);
|
||||
/* 3 */
|
||||
EXTERN int TclpCreatePipe(TclFile *readPipe, TclFile *writePipe);
|
||||
/* 4 */
|
||||
EXTERN int TclpCreateProcess(Tcl_Interp *interp, int argc,
|
||||
const char **argv, TclFile inputFile,
|
||||
TclFile outputFile, TclFile errorFile,
|
||||
Tcl_Pid *pidPtr);
|
||||
/* Slot 5 is reserved */
|
||||
/* 6 */
|
||||
EXTERN TclFile TclpMakeFile(Tcl_Channel channel, int direction);
|
||||
/* 7 */
|
||||
EXTERN TclFile TclpOpenFile(const char *fname, int mode);
|
||||
/* 8 */
|
||||
EXTERN int TclUnixWaitForFile(int fd, int mask, int timeout);
|
||||
/* 9 */
|
||||
EXTERN TclFile TclpCreateTempFile(const char *contents);
|
||||
/* 10 */
|
||||
EXTERN Tcl_DirEntry * TclpReaddir(TclDIR *dir);
|
||||
/* Slot 13 is reserved */
|
||||
/* 14 */
|
||||
EXTERN int TclUnixCopyFile(const char *src, const char *dst,
|
||||
const Tcl_StatBuf *statBufPtr,
|
||||
int dontCopyAtts);
|
||||
/* 15 */
|
||||
EXTERN int TclMacOSXGetFileAttribute(Tcl_Interp *interp,
|
||||
int objIndex, Tcl_Obj *fileName,
|
||||
Tcl_Obj **attributePtrPtr);
|
||||
/* 16 */
|
||||
EXTERN int TclMacOSXSetFileAttribute(Tcl_Interp *interp,
|
||||
int objIndex, Tcl_Obj *fileName,
|
||||
Tcl_Obj *attributePtr);
|
||||
/* 17 */
|
||||
EXTERN int TclMacOSXCopyFileAttributes(const char *src,
|
||||
const char *dst,
|
||||
const Tcl_StatBuf *statBufPtr);
|
||||
/* 18 */
|
||||
EXTERN int TclMacOSXMatchType(Tcl_Interp *interp,
|
||||
const char *pathName, const char *fileName,
|
||||
Tcl_StatBuf *statBufPtr,
|
||||
Tcl_GlobTypeData *types);
|
||||
/* 19 */
|
||||
EXTERN void TclMacOSXNotifierAddRunLoopMode(
|
||||
const void *runLoopMode);
|
||||
/* Slot 20 is reserved */
|
||||
/* Slot 21 is reserved */
|
||||
/* Slot 22 is reserved */
|
||||
/* Slot 23 is reserved */
|
||||
/* Slot 24 is reserved */
|
||||
/* Slot 25 is reserved */
|
||||
/* Slot 26 is reserved */
|
||||
/* Slot 27 is reserved */
|
||||
/* Slot 28 is reserved */
|
||||
/* 29 */
|
||||
EXTERN int TclWinCPUID(int index, int *regs);
|
||||
/* 30 */
|
||||
EXTERN int TclUnixOpenTemporaryFile(Tcl_Obj *dirObj,
|
||||
Tcl_Obj *basenameObj, Tcl_Obj *extensionObj,
|
||||
Tcl_Obj *resultingNameObj);
|
||||
#endif /* MACOSX */
|
||||
|
||||
typedef struct TclIntPlatStubs {
|
||||
int magic;
|
||||
void *hooks;
|
||||
|
||||
#if !defined(_WIN32) && !defined(__CYGWIN__) && !defined(MAC_OSX_TCL) /* UNIX */
|
||||
void (*tclGetAndDetachPids) (Tcl_Interp *interp, Tcl_Channel chan); /* 0 */
|
||||
int (*tclpCloseFile) (TclFile file); /* 1 */
|
||||
Tcl_Channel (*tclpCreateCommandChannel) (TclFile readFile, TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr); /* 2 */
|
||||
int (*tclpCreatePipe) (TclFile *readPipe, TclFile *writePipe); /* 3 */
|
||||
int (*tclpCreateProcess) (Tcl_Interp *interp, int argc, const char **argv, TclFile inputFile, TclFile outputFile, TclFile errorFile, Tcl_Pid *pidPtr); /* 4 */
|
||||
int (*tclUnixWaitForFile_) (int fd, int mask, int timeout); /* 5 */
|
||||
TclFile (*tclpMakeFile) (Tcl_Channel channel, int direction); /* 6 */
|
||||
TclFile (*tclpOpenFile) (const char *fname, int mode); /* 7 */
|
||||
int (*tclUnixWaitForFile) (int fd, int mask, int timeout); /* 8 */
|
||||
TclFile (*tclpCreateTempFile) (const char *contents); /* 9 */
|
||||
Tcl_DirEntry * (*tclpReaddir) (TclDIR *dir); /* 10 */
|
||||
void (*reserved11)(void);
|
||||
void (*reserved12)(void);
|
||||
void (*reserved13)(void);
|
||||
int (*tclUnixCopyFile) (const char *src, const char *dst, const Tcl_StatBuf *statBufPtr, int dontCopyAtts); /* 14 */
|
||||
int (*tclMacOSXGetFileAttribute) (Tcl_Interp *interp, int objIndex, Tcl_Obj *fileName, Tcl_Obj **attributePtrPtr); /* 15 */
|
||||
int (*tclMacOSXSetFileAttribute) (Tcl_Interp *interp, int objIndex, Tcl_Obj *fileName, Tcl_Obj *attributePtr); /* 16 */
|
||||
int (*tclMacOSXCopyFileAttributes) (const char *src, const char *dst, const Tcl_StatBuf *statBufPtr); /* 17 */
|
||||
int (*tclMacOSXMatchType) (Tcl_Interp *interp, const char *pathName, const char *fileName, Tcl_StatBuf *statBufPtr, Tcl_GlobTypeData *types); /* 18 */
|
||||
void (*tclMacOSXNotifierAddRunLoopMode) (const void *runLoopMode); /* 19 */
|
||||
void (*reserved20)(void);
|
||||
void (*reserved21)(void);
|
||||
TclFile (*tclpCreateTempFile_) (const char *contents); /* 22 */
|
||||
void (*reserved23)(void);
|
||||
void (*reserved24)(void);
|
||||
void (*reserved25)(void);
|
||||
void (*reserved26)(void);
|
||||
void (*reserved27)(void);
|
||||
void (*reserved28)(void);
|
||||
int (*tclWinCPUID) (int index, int *regs); /* 29 */
|
||||
int (*tclUnixOpenTemporaryFile) (Tcl_Obj *dirObj, Tcl_Obj *basenameObj, Tcl_Obj *extensionObj, Tcl_Obj *resultingNameObj); /* 30 */
|
||||
#endif /* UNIX */
|
||||
#if defined(_WIN32) || defined(__CYGWIN__) /* WIN */
|
||||
void (*reserved0)(void);
|
||||
void (*reserved1)(void);
|
||||
void (*reserved2)(void);
|
||||
void (*reserved3)(void);
|
||||
void * (*tclWinGetTclInstance) (void); /* 4 */
|
||||
int (*tclUnixWaitForFile) (int fd, int mask, int timeout); /* 5 */
|
||||
void (*reserved6)(void);
|
||||
void (*reserved7)(void);
|
||||
Tcl_Size (*tclpGetPid) (Tcl_Pid pid); /* 8 */
|
||||
void (*reserved9)(void);
|
||||
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 */
|
||||
int (*tclpCreatePipe) (TclFile *readPipe, TclFile *writePipe); /* 14 */
|
||||
int (*tclpCreateProcess) (Tcl_Interp *interp, int argc, const char **argv, TclFile inputFile, TclFile outputFile, TclFile errorFile, Tcl_Pid *pidPtr); /* 15 */
|
||||
int (*tclpIsAtty) (int fd); /* 16 */
|
||||
int (*tclUnixCopyFile) (const char *src, const char *dst, const Tcl_StatBuf *statBufPtr, int dontCopyAtts); /* 17 */
|
||||
TclFile (*tclpMakeFile) (Tcl_Channel channel, int direction); /* 18 */
|
||||
TclFile (*tclpOpenFile) (const char *fname, int mode); /* 19 */
|
||||
void (*tclWinAddProcess) (void *hProcess, Tcl_Size id); /* 20 */
|
||||
void (*reserved21)(void);
|
||||
TclFile (*tclpCreateTempFile) (const char *contents); /* 22 */
|
||||
void (*reserved23)(void);
|
||||
char * (*tclWinNoBackslash) (char *path); /* 24 */
|
||||
void (*reserved25)(void);
|
||||
void (*reserved26)(void);
|
||||
void (*tclWinFlushDirtyChannels) (void); /* 27 */
|
||||
void (*reserved28)(void);
|
||||
int (*tclWinCPUID) (int index, int *regs); /* 29 */
|
||||
int (*tclUnixOpenTemporaryFile) (Tcl_Obj *dirObj, Tcl_Obj *basenameObj, Tcl_Obj *extensionObj, Tcl_Obj *resultingNameObj); /* 30 */
|
||||
#endif /* WIN */
|
||||
#ifdef MAC_OSX_TCL /* MACOSX */
|
||||
void (*tclGetAndDetachPids) (Tcl_Interp *interp, Tcl_Channel chan); /* 0 */
|
||||
int (*tclpCloseFile) (TclFile file); /* 1 */
|
||||
Tcl_Channel (*tclpCreateCommandChannel) (TclFile readFile, TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr); /* 2 */
|
||||
int (*tclpCreatePipe) (TclFile *readPipe, TclFile *writePipe); /* 3 */
|
||||
int (*tclpCreateProcess) (Tcl_Interp *interp, int argc, const char **argv, TclFile inputFile, TclFile outputFile, TclFile errorFile, Tcl_Pid *pidPtr); /* 4 */
|
||||
int (*tclUnixWaitForFile_) (int fd, int mask, int timeout); /* 5 */
|
||||
TclFile (*tclpMakeFile) (Tcl_Channel channel, int direction); /* 6 */
|
||||
TclFile (*tclpOpenFile) (const char *fname, int mode); /* 7 */
|
||||
int (*tclUnixWaitForFile) (int fd, int mask, int timeout); /* 8 */
|
||||
TclFile (*tclpCreateTempFile) (const char *contents); /* 9 */
|
||||
Tcl_DirEntry * (*tclpReaddir) (TclDIR *dir); /* 10 */
|
||||
void (*reserved11)(void);
|
||||
void (*reserved12)(void);
|
||||
void (*reserved13)(void);
|
||||
int (*tclUnixCopyFile) (const char *src, const char *dst, const Tcl_StatBuf *statBufPtr, int dontCopyAtts); /* 14 */
|
||||
int (*tclMacOSXGetFileAttribute) (Tcl_Interp *interp, int objIndex, Tcl_Obj *fileName, Tcl_Obj **attributePtrPtr); /* 15 */
|
||||
int (*tclMacOSXSetFileAttribute) (Tcl_Interp *interp, int objIndex, Tcl_Obj *fileName, Tcl_Obj *attributePtr); /* 16 */
|
||||
int (*tclMacOSXCopyFileAttributes) (const char *src, const char *dst, const Tcl_StatBuf *statBufPtr); /* 17 */
|
||||
int (*tclMacOSXMatchType) (Tcl_Interp *interp, const char *pathName, const char *fileName, Tcl_StatBuf *statBufPtr, Tcl_GlobTypeData *types); /* 18 */
|
||||
void (*tclMacOSXNotifierAddRunLoopMode) (const void *runLoopMode); /* 19 */
|
||||
void (*reserved20)(void);
|
||||
void (*reserved21)(void);
|
||||
TclFile (*tclpCreateTempFile_) (const char *contents); /* 22 */
|
||||
void (*reserved23)(void);
|
||||
void (*reserved24)(void);
|
||||
void (*reserved25)(void);
|
||||
void (*reserved26)(void);
|
||||
void (*reserved27)(void);
|
||||
void (*reserved28)(void);
|
||||
int (*tclWinCPUID) (int index, int *regs); /* 29 */
|
||||
int (*tclUnixOpenTemporaryFile) (Tcl_Obj *dirObj, Tcl_Obj *basenameObj, Tcl_Obj *extensionObj, Tcl_Obj *resultingNameObj); /* 30 */
|
||||
#endif /* MACOSX */
|
||||
} TclIntPlatStubs;
|
||||
|
||||
extern const TclIntPlatStubs *tclIntPlatStubsPtr;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(USE_TCL_STUBS)
|
||||
|
||||
/*
|
||||
* Inline function declarations:
|
||||
*/
|
||||
|
||||
#if !defined(_WIN32) && !defined(__CYGWIN__) && !defined(MAC_OSX_TCL) /* UNIX */
|
||||
#define TclGetAndDetachPids \
|
||||
(tclIntPlatStubsPtr->tclGetAndDetachPids) /* 0 */
|
||||
#define TclpCloseFile \
|
||||
(tclIntPlatStubsPtr->tclpCloseFile) /* 1 */
|
||||
#define TclpCreateCommandChannel \
|
||||
(tclIntPlatStubsPtr->tclpCreateCommandChannel) /* 2 */
|
||||
#define TclpCreatePipe \
|
||||
(tclIntPlatStubsPtr->tclpCreatePipe) /* 3 */
|
||||
#define TclpCreateProcess \
|
||||
(tclIntPlatStubsPtr->tclpCreateProcess) /* 4 */
|
||||
/* Slot 5 is reserved */
|
||||
#define TclpMakeFile \
|
||||
(tclIntPlatStubsPtr->tclpMakeFile) /* 6 */
|
||||
#define TclpOpenFile \
|
||||
(tclIntPlatStubsPtr->tclpOpenFile) /* 7 */
|
||||
#define TclUnixWaitForFile \
|
||||
(tclIntPlatStubsPtr->tclUnixWaitForFile) /* 8 */
|
||||
#define TclpCreateTempFile \
|
||||
(tclIntPlatStubsPtr->tclpCreateTempFile) /* 9 */
|
||||
#define TclpReaddir \
|
||||
(tclIntPlatStubsPtr->tclpReaddir) /* 10 */
|
||||
/* Slot 11 is reserved */
|
||||
/* Slot 12 is reserved */
|
||||
/* Slot 13 is reserved */
|
||||
#define TclUnixCopyFile \
|
||||
(tclIntPlatStubsPtr->tclUnixCopyFile) /* 14 */
|
||||
#define TclMacOSXGetFileAttribute \
|
||||
(tclIntPlatStubsPtr->tclMacOSXGetFileAttribute) /* 15 */
|
||||
#define TclMacOSXSetFileAttribute \
|
||||
(tclIntPlatStubsPtr->tclMacOSXSetFileAttribute) /* 16 */
|
||||
#define TclMacOSXCopyFileAttributes \
|
||||
(tclIntPlatStubsPtr->tclMacOSXCopyFileAttributes) /* 17 */
|
||||
#define TclMacOSXMatchType \
|
||||
(tclIntPlatStubsPtr->tclMacOSXMatchType) /* 18 */
|
||||
#define TclMacOSXNotifierAddRunLoopMode \
|
||||
(tclIntPlatStubsPtr->tclMacOSXNotifierAddRunLoopMode) /* 19 */
|
||||
/* Slot 20 is reserved */
|
||||
/* Slot 21 is reserved */
|
||||
/* Slot 22 is reserved */
|
||||
/* Slot 23 is reserved */
|
||||
/* Slot 24 is reserved */
|
||||
/* Slot 25 is reserved */
|
||||
/* Slot 26 is reserved */
|
||||
/* Slot 27 is reserved */
|
||||
/* Slot 28 is reserved */
|
||||
#define TclWinCPUID \
|
||||
(tclIntPlatStubsPtr->tclWinCPUID) /* 29 */
|
||||
#define TclUnixOpenTemporaryFile \
|
||||
(tclIntPlatStubsPtr->tclUnixOpenTemporaryFile) /* 30 */
|
||||
#endif /* UNIX */
|
||||
#if defined(_WIN32) || defined(__CYGWIN__) /* WIN */
|
||||
/* Slot 0 is reserved */
|
||||
/* Slot 1 is reserved */
|
||||
/* Slot 2 is reserved */
|
||||
/* Slot 3 is reserved */
|
||||
#define TclWinGetTclInstance \
|
||||
(tclIntPlatStubsPtr->tclWinGetTclInstance) /* 4 */
|
||||
#define TclUnixWaitForFile \
|
||||
(tclIntPlatStubsPtr->tclUnixWaitForFile) /* 5 */
|
||||
/* Slot 6 is reserved */
|
||||
/* Slot 7 is reserved */
|
||||
#define TclpGetPid \
|
||||
(tclIntPlatStubsPtr->tclpGetPid) /* 8 */
|
||||
/* Slot 9 is reserved */
|
||||
/* Slot 10 is reserved */
|
||||
#define TclGetAndDetachPids \
|
||||
(tclIntPlatStubsPtr->tclGetAndDetachPids) /* 11 */
|
||||
#define TclpCloseFile \
|
||||
(tclIntPlatStubsPtr->tclpCloseFile) /* 12 */
|
||||
#define TclpCreateCommandChannel \
|
||||
(tclIntPlatStubsPtr->tclpCreateCommandChannel) /* 13 */
|
||||
#define TclpCreatePipe \
|
||||
(tclIntPlatStubsPtr->tclpCreatePipe) /* 14 */
|
||||
#define TclpCreateProcess \
|
||||
(tclIntPlatStubsPtr->tclpCreateProcess) /* 15 */
|
||||
#define TclpIsAtty \
|
||||
(tclIntPlatStubsPtr->tclpIsAtty) /* 16 */
|
||||
#define TclUnixCopyFile \
|
||||
(tclIntPlatStubsPtr->tclUnixCopyFile) /* 17 */
|
||||
#define TclpMakeFile \
|
||||
(tclIntPlatStubsPtr->tclpMakeFile) /* 18 */
|
||||
#define TclpOpenFile \
|
||||
(tclIntPlatStubsPtr->tclpOpenFile) /* 19 */
|
||||
#define TclWinAddProcess \
|
||||
(tclIntPlatStubsPtr->tclWinAddProcess) /* 20 */
|
||||
/* Slot 21 is reserved */
|
||||
#define TclpCreateTempFile \
|
||||
(tclIntPlatStubsPtr->tclpCreateTempFile) /* 22 */
|
||||
/* Slot 23 is reserved */
|
||||
#define TclWinNoBackslash \
|
||||
(tclIntPlatStubsPtr->tclWinNoBackslash) /* 24 */
|
||||
/* Slot 25 is reserved */
|
||||
/* Slot 26 is reserved */
|
||||
#define TclWinFlushDirtyChannels \
|
||||
(tclIntPlatStubsPtr->tclWinFlushDirtyChannels) /* 27 */
|
||||
/* Slot 28 is reserved */
|
||||
#define TclWinCPUID \
|
||||
(tclIntPlatStubsPtr->tclWinCPUID) /* 29 */
|
||||
#define TclUnixOpenTemporaryFile \
|
||||
(tclIntPlatStubsPtr->tclUnixOpenTemporaryFile) /* 30 */
|
||||
#endif /* WIN */
|
||||
#ifdef MAC_OSX_TCL /* MACOSX */
|
||||
#define TclGetAndDetachPids \
|
||||
(tclIntPlatStubsPtr->tclGetAndDetachPids) /* 0 */
|
||||
#define TclpCloseFile \
|
||||
(tclIntPlatStubsPtr->tclpCloseFile) /* 1 */
|
||||
#define TclpCreateCommandChannel \
|
||||
(tclIntPlatStubsPtr->tclpCreateCommandChannel) /* 2 */
|
||||
#define TclpCreatePipe \
|
||||
(tclIntPlatStubsPtr->tclpCreatePipe) /* 3 */
|
||||
#define TclpCreateProcess \
|
||||
(tclIntPlatStubsPtr->tclpCreateProcess) /* 4 */
|
||||
/* Slot 5 is reserved */
|
||||
#define TclpMakeFile \
|
||||
(tclIntPlatStubsPtr->tclpMakeFile) /* 6 */
|
||||
#define TclpOpenFile \
|
||||
(tclIntPlatStubsPtr->tclpOpenFile) /* 7 */
|
||||
#define TclUnixWaitForFile \
|
||||
(tclIntPlatStubsPtr->tclUnixWaitForFile) /* 8 */
|
||||
#define TclpCreateTempFile \
|
||||
(tclIntPlatStubsPtr->tclpCreateTempFile) /* 9 */
|
||||
#define TclpReaddir \
|
||||
(tclIntPlatStubsPtr->tclpReaddir) /* 10 */
|
||||
/* Slot 11 is reserved */
|
||||
/* Slot 12 is reserved */
|
||||
/* Slot 13 is reserved */
|
||||
#define TclUnixCopyFile \
|
||||
(tclIntPlatStubsPtr->tclUnixCopyFile) /* 14 */
|
||||
#define TclMacOSXGetFileAttribute \
|
||||
(tclIntPlatStubsPtr->tclMacOSXGetFileAttribute) /* 15 */
|
||||
#define TclMacOSXSetFileAttribute \
|
||||
(tclIntPlatStubsPtr->tclMacOSXSetFileAttribute) /* 16 */
|
||||
#define TclMacOSXCopyFileAttributes \
|
||||
(tclIntPlatStubsPtr->tclMacOSXCopyFileAttributes) /* 17 */
|
||||
#define TclMacOSXMatchType \
|
||||
(tclIntPlatStubsPtr->tclMacOSXMatchType) /* 18 */
|
||||
#define TclMacOSXNotifierAddRunLoopMode \
|
||||
(tclIntPlatStubsPtr->tclMacOSXNotifierAddRunLoopMode) /* 19 */
|
||||
/* Slot 20 is reserved */
|
||||
/* Slot 21 is reserved */
|
||||
/* Slot 22 is reserved */
|
||||
/* Slot 23 is reserved */
|
||||
/* Slot 24 is reserved */
|
||||
/* Slot 25 is reserved */
|
||||
/* Slot 26 is reserved */
|
||||
/* Slot 27 is reserved */
|
||||
/* Slot 28 is reserved */
|
||||
#define TclWinCPUID \
|
||||
(tclIntPlatStubsPtr->tclWinCPUID) /* 29 */
|
||||
#define TclUnixOpenTemporaryFile \
|
||||
(tclIntPlatStubsPtr->tclUnixOpenTemporaryFile) /* 30 */
|
||||
#endif /* MACOSX */
|
||||
|
||||
#endif /* defined(USE_TCL_STUBS) */
|
||||
|
||||
#else /* TCL_MAJOR_VERSION > 8 */
|
||||
/* !BEGIN!: Do not edit below this line. */
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -688,7 +202,6 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr;
|
||||
#endif /* defined(USE_TCL_STUBS) */
|
||||
|
||||
/* !END!: Do not edit above this line. */
|
||||
#endif /* TCL_MAJOR_VERSION */
|
||||
|
||||
#undef TCL_STORAGE_CLASS
|
||||
#define TCL_STORAGE_CLASS DLLIMPORT
|
||||
@@ -719,7 +232,7 @@ MODULE_SCOPE int TclMacOSXMatchType(Tcl_Interp *interp,
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
# if !defined(TCL_NO_DEPRECATED)
|
||||
# ifndef TCL_NO_DEPRECATED
|
||||
# define TclWinConvertError Tcl_WinConvertError
|
||||
# define TclWinConvertWSAError Tcl_WinConvertError
|
||||
# define TclWinNToHS ntohs
|
||||
|
||||
+512
-161
@@ -12,6 +12,7 @@
|
||||
*/
|
||||
|
||||
#include "tclInt.h"
|
||||
#include <assert.h>
|
||||
|
||||
/*
|
||||
* A pointer to a string that holds an initialization script that if non-NULL
|
||||
@@ -226,7 +227,7 @@ static int AliasDelete(Tcl_Interp *interp,
|
||||
static int AliasDescribe(Tcl_Interp *interp,
|
||||
Tcl_Interp *childInterp, Tcl_Obj *objPtr);
|
||||
static int AliasList(Tcl_Interp *interp, Tcl_Interp *childInterp);
|
||||
static Tcl_ObjCmdProc AliasNRCmd;
|
||||
static Tcl_ObjCmdProc2 AliasNRCmd;
|
||||
static Tcl_CmdDeleteProc AliasObjCmdDeleteProc;
|
||||
static Tcl_Interp * GetInterp(Tcl_Interp *interp, Tcl_Obj *pathPtr);
|
||||
static Tcl_Interp * GetInterp2(Tcl_Interp *interp, Tcl_Size objc,
|
||||
@@ -256,6 +257,9 @@ static int ChildInvokeHidden(Tcl_Interp *interp,
|
||||
static int ChildMarkTrusted(Tcl_Interp *interp,
|
||||
Tcl_Interp *childInterp);
|
||||
static Tcl_CmdDeleteProc ChildObjCmdDeleteProc;
|
||||
static int ChildSet(Tcl_Interp *interp,
|
||||
Tcl_Interp *childInterp, Tcl_Obj *varNameObj,
|
||||
Tcl_Obj *valueObj);
|
||||
static int ChildRecursionLimit(Tcl_Interp *interp,
|
||||
Tcl_Interp *childInterp, Tcl_Size objc,
|
||||
Tcl_Obj *const objv[]);
|
||||
@@ -276,11 +280,15 @@ static void MakeSafe(Tcl_Interp *interp);
|
||||
static void RunLimitHandlers(LimitHandler *handlerPtr,
|
||||
Tcl_Interp *interp);
|
||||
static void TimeLimitCallback(void *clientData);
|
||||
static int RunPreInitScript(Tcl_Interp *interp);
|
||||
static Tcl_Obj * LocatePreInitScript(Tcl_Interp *interp);
|
||||
static Tcl_ObjCmdProc2 InitAutoPathObjCmd;
|
||||
#define INIT_AUTO_PATH_CMD "::tcl::InitAutoPath"
|
||||
|
||||
/* NRE enabling */
|
||||
static Tcl_NRPostProc NRPostInvokeHidden;
|
||||
static Tcl_ObjCmdProc NRInterpCmd;
|
||||
static Tcl_ObjCmdProc NRChildCmd;
|
||||
static Tcl_ObjCmdProc2 NRInterpCmd;
|
||||
static Tcl_ObjCmdProc2 NRChildCmd;
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
@@ -308,6 +316,387 @@ Tcl_SetPreInitScript(
|
||||
return prevString;
|
||||
}
|
||||
|
||||
/*
|
||||
* CheckForFileInDir --
|
||||
*
|
||||
* Little helper to check if a file exists within a directory and is readable.
|
||||
*
|
||||
* Results:
|
||||
* Returns path to the file if it exists, NULL if not. Reference count
|
||||
* of returned Tcl_Obj is incremented before returning to account for the
|
||||
* caller owning a reference.
|
||||
*/
|
||||
static Tcl_Obj *
|
||||
CheckForFileInDir(
|
||||
Tcl_Obj *dirPathPtr,
|
||||
Tcl_Obj *fileNamePtr)
|
||||
{
|
||||
Tcl_Obj *path[2];
|
||||
path[0] = dirPathPtr;
|
||||
path[1] = fileNamePtr;
|
||||
Tcl_Obj *fullPathPtr = TclJoinPath(2, path, 0);
|
||||
Tcl_IncrRefCount(fullPathPtr);
|
||||
if (Tcl_FSAccess(fullPathPtr, R_OK) == 0) {
|
||||
return fullPathPtr;
|
||||
}
|
||||
Tcl_DecrRefCount(fullPathPtr);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* LocatePreInitScript --
|
||||
*
|
||||
* Locates the Tcl initialization script, "init.tcl".
|
||||
*
|
||||
* Results:
|
||||
* Returns a Tcl_Obj containing the path or NULL if not found.
|
||||
* Reference count of returned Tcl_Obj is incremented before returning
|
||||
* to account for the caller owning a reference.
|
||||
*
|
||||
* Side effects:
|
||||
* Sets the tcl_library variable to the directory containing init.tcl.
|
||||
*/
|
||||
Tcl_Obj *
|
||||
LocatePreInitScript(Tcl_Interp *interp)
|
||||
{
|
||||
/*
|
||||
* The search order for the init.tcl is as follows:
|
||||
*
|
||||
* $tcl_library -
|
||||
* Can specify a primary location, if set, no other locations will be
|
||||
* checked. This is the recommended way for a program that embeds Tcl
|
||||
* to specifically tell Tcl where to find an init.tcl file.
|
||||
*
|
||||
* $env(TCL_LIBRARY) -
|
||||
* Highest priority so user can always override the search path unless
|
||||
* the application has specified an exact directory above
|
||||
*
|
||||
* $tclDefaultLibrary -
|
||||
* INTERNAL: This variable is set by Tcl on those platforms where it
|
||||
* can determine at runtime the directory where it expects the init.tcl
|
||||
* file to be. If set, this value is unset after use. External users of
|
||||
* Tcl should not make use of the variable to customize this function.
|
||||
*
|
||||
* [tcl::pkgconfig get scriptdir,runtime] -
|
||||
* The directory determined by configure to be the place where Tcl's
|
||||
* script library is to be installed.
|
||||
*
|
||||
* ancestor directories of the executable -
|
||||
* The lib and library subdirectories of the parent and grand-parent
|
||||
* directories of the directory containing the executable.
|
||||
*
|
||||
* The first directory on this path that contains a init.tcl script
|
||||
* will be set as the value of tcl_library and the init.tcl file sourced.
|
||||
*
|
||||
* Note the following differences from Tcl 9.0 where this functionality
|
||||
* was implemented as a Tcl script.
|
||||
*
|
||||
* - the $tcl_libPath variable is no longer used. It was maked OBSOLETE
|
||||
* and not supposed to be used. Applications that embed Tcl and want
|
||||
* to customize should set tcl_library or call Tcl_PreInitScript
|
||||
* instead.
|
||||
*/
|
||||
|
||||
Tcl_Obj *dirPtr;
|
||||
Tcl_Obj *searchedDirs;
|
||||
Tcl_Obj *initScriptPathPtr = NULL;
|
||||
Tcl_Obj *pathParts[3] = {NULL, NULL, NULL};
|
||||
Tcl_Obj *exeDirPtr;
|
||||
Tcl_Obj *exePtr;
|
||||
|
||||
/*
|
||||
* Need to track checked directories for error reporting. As a side
|
||||
* benefit, because they are tracked here we can keep overwriting dirPtr
|
||||
* without leaking memory.
|
||||
*/
|
||||
searchedDirs = Tcl_NewListObj(0, NULL);
|
||||
|
||||
Tcl_Obj *initNamePtr = Tcl_NewStringObj("init.tcl", 8);
|
||||
Tcl_IncrRefCount(initNamePtr);
|
||||
|
||||
/*
|
||||
* Would be more elegant to use a loop over possible paths and check
|
||||
* file existence in the body but that means paths that never get used
|
||||
* are constructed. Instead we use a macro to reduce code duplication.
|
||||
*/
|
||||
#define TRY_PATH(dirarg_) \
|
||||
do { \
|
||||
dirPtr = (dirarg_); \
|
||||
if (dirPtr) { \
|
||||
Tcl_ListObjAppendElement(NULL, searchedDirs, dirPtr); \
|
||||
/* Tcl_IsEmpty check - bug 465d4546e2 */ \
|
||||
if (!Tcl_IsEmpty(dirPtr)) { \
|
||||
initScriptPathPtr = \
|
||||
CheckForFileInDir(dirPtr, initNamePtr); \
|
||||
if (initScriptPathPtr != NULL) { \
|
||||
goto done; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
TRY_PATH(Tcl_GetVar2Ex(interp, "tcl_library", NULL, TCL_GLOBAL_ONLY));
|
||||
if (dirPtr && !Tcl_IsEmpty(dirPtr)) {
|
||||
/* Do not look further irrespective of whether init.tcl was found. */
|
||||
goto done;
|
||||
}
|
||||
|
||||
TRY_PATH(Tcl_GetVar2Ex(interp, "env", "TCL_LIBRARY", TCL_GLOBAL_ONLY));
|
||||
if (dirPtr && !Tcl_IsEmpty(dirPtr)) {
|
||||
/* Do not look further irrespective of whether init.tcl was found. */
|
||||
goto done;
|
||||
}
|
||||
|
||||
TRY_PATH(TclZipfs_TclLibrary());
|
||||
|
||||
TRY_PATH(Tcl_GetVar2Ex(interp, "tclDefaultLibrary", NULL, TCL_GLOBAL_ONLY));
|
||||
/* tcl::pkgconfig get scriptdir,runtime */
|
||||
#ifdef CFG_RUNTIME_SCRDIR
|
||||
TRY_PATH(Tcl_NewStringObj(CFG_RUNTIME_SCRDIR, -1));
|
||||
#endif
|
||||
|
||||
assert(initScriptPathPtr == NULL);
|
||||
|
||||
/* Try parent/lib/tclVERSION */
|
||||
|
||||
/* Reminder - TclGetObjNameOfExecutable return need not be released */
|
||||
exePtr = TclGetObjNameOfExecutable();
|
||||
if (exePtr == NULL) {
|
||||
goto done;
|
||||
}
|
||||
exeDirPtr = TclPathPart(interp, exePtr, TCL_PATH_DIRNAME);
|
||||
if (exeDirPtr == NULL) {
|
||||
goto done;
|
||||
}
|
||||
/*
|
||||
* pathParts[0] is the parent of the directory containing the
|
||||
* executable (i.e. "parent" in the above comment).
|
||||
*/
|
||||
pathParts[0] = TclPathPart(interp, exeDirPtr, TCL_PATH_DIRNAME);
|
||||
Tcl_DecrRefCount(exeDirPtr);
|
||||
/*
|
||||
* Note: pathParts[] freed at function end. TclPathPart returns
|
||||
* Tcl_Obj with ref count incremented so do not incr ref pathParts[0] here.
|
||||
*/
|
||||
if (pathParts[0] == NULL) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
pathParts[1] = Tcl_NewStringObj("lib", 3);
|
||||
Tcl_IncrRefCount(pathParts[1]);
|
||||
pathParts[2] = Tcl_NewStringObj("tcl" TCL_VERSION, -1);
|
||||
Tcl_IncrRefCount(pathParts[2]);
|
||||
|
||||
TRY_PATH(TclJoinPath(3, pathParts, 0));
|
||||
|
||||
done: /* initScriptPtr != NULL => dirPtr holds dir of init.tcl */
|
||||
if (initScriptPathPtr == NULL) {
|
||||
Tcl_SetObjResult(interp,
|
||||
Tcl_ObjPrintf(
|
||||
"Cannot find a usable init.tcl in the following directories: \n"
|
||||
" %s\n\n"
|
||||
"This probably means that Tcl wasn't installed properly.\n",
|
||||
Tcl_GetString(searchedDirs)));
|
||||
} else {
|
||||
Tcl_SetVar2Ex(interp, "tcl_library", NULL, dirPtr, TCL_GLOBAL_ONLY);
|
||||
}
|
||||
if (initNamePtr != NULL) {
|
||||
Tcl_DecrRefCount(initNamePtr);
|
||||
}
|
||||
for (size_t i = 0; i < sizeof(pathParts)/sizeof(pathParts[0]); i++) {
|
||||
if (pathParts[i] != NULL) {
|
||||
Tcl_DecrRefCount(pathParts[i]);
|
||||
}
|
||||
}
|
||||
/* Note all examined dirPtr values get freed with searchedDirs */
|
||||
Tcl_DecrRefCount(searchedDirs);
|
||||
return initScriptPathPtr;
|
||||
#undef TRY_PATH
|
||||
}
|
||||
|
||||
/*
|
||||
* RunPreInitScript --
|
||||
*
|
||||
* Locates and invokes the Tcl initialization script, "init.tcl".
|
||||
*
|
||||
* Results:
|
||||
* Returns a standard Tcl completion code.
|
||||
*
|
||||
* Side effects:
|
||||
* Pretty much anything, depending on the contents of the script.
|
||||
*/
|
||||
int
|
||||
RunPreInitScript(Tcl_Interp *interp)
|
||||
{
|
||||
/*
|
||||
* Note the following differences from 9.0. If a init.tcl is found and
|
||||
* sourced, further directories are NOT searched even if the init.tcl
|
||||
* sourcing raised errors. This is by design as it is indicative of some
|
||||
* configuration error and attempting a fix through trial and error is
|
||||
* not a robust solution.
|
||||
*
|
||||
* Further, this search mechanism cannot be bypassed by defining an
|
||||
* alternate tclInit command before calling Tcl_Init() as was the case
|
||||
* in Tcl 9.0. Use the Tcl_SetPreInitScript function to instead.
|
||||
*/
|
||||
Tcl_Obj *initScriptPathPtr = LocatePreInitScript(interp);
|
||||
/* Note initScriptPathPtr reference count already incremented */
|
||||
if (initScriptPathPtr == NULL) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
int result = Tcl_FSEvalFile(interp, initScriptPathPtr);
|
||||
Tcl_DecrRefCount(initScriptPathPtr);
|
||||
if (result != TCL_OK) {
|
||||
Tcl_ObjPrintf("Error sourcing Tcl initialization script from %s:\n%s",
|
||||
Tcl_GetString(initScriptPathPtr),
|
||||
Tcl_GetString(Tcl_GetObjResult(interp)));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int
|
||||
AddPathsInVarToList(
|
||||
Tcl_Interp *interp,
|
||||
const char *name1,
|
||||
const char *name2,
|
||||
Tcl_Obj *toListPtr,
|
||||
int doTildeExpand
|
||||
)
|
||||
{
|
||||
Tcl_Obj **elems;
|
||||
Tcl_Size nelems;
|
||||
Tcl_Obj *fromListPtr= Tcl_GetVar2Ex(interp, name1, name2, TCL_GLOBAL_ONLY);
|
||||
if (fromListPtr) {
|
||||
if (TclListObjGetElements(interp, fromListPtr, &nelems, &elems) !=
|
||||
TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
for (Tcl_Size i = 0; i < nelems; ++i) {
|
||||
Tcl_Obj *pathPtr = elems[i];
|
||||
if (doTildeExpand) {
|
||||
pathPtr = TclResolveTildePath(NULL, pathPtr);
|
||||
if (pathPtr == NULL) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
/* Note: TclListObjAppendIfAbsent handles 0 and non-0 ref counts */
|
||||
if (TclListObjAppendIfAbsent(interp, toListPtr, pathPtr) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* InitAutoPathObjCmd --
|
||||
*
|
||||
* Initializes the auto_path variable in an interpreter. In safe interps,
|
||||
* it is set to empty. In unsafe interps, the following are added to it
|
||||
*
|
||||
* - If auto_path does not exist, it is initialized with the content
|
||||
* of the TCLLIBPATH environment variable with tilde expansion
|
||||
* - The tcl_library directory and its parent
|
||||
* - The lib subdirectory in the parent directory of the directory
|
||||
* containing the executable
|
||||
* - The elements of tcl_pkgPath
|
||||
*
|
||||
* The function also adds the encoding subdirectory of tcl_library
|
||||
* to the encodings search path if not already present.
|
||||
*
|
||||
* Results:
|
||||
* A standard Tcl result.
|
||||
*/
|
||||
int
|
||||
InitAutoPathObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument vector. */
|
||||
{
|
||||
if (objc != 1) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
Tcl_Obj *autoPathPtr;
|
||||
|
||||
autoPathPtr = Tcl_GetVar2Ex(interp, "auto_path", NULL, TCL_GLOBAL_ONLY);
|
||||
|
||||
/* Safe interps get empty auto_path if it does not exist. */
|
||||
if (Tcl_IsSafe(interp)) {
|
||||
if (autoPathPtr == NULL) {
|
||||
Tcl_SetVar2Ex(interp, "auto_path", NULL, Tcl_NewObj(),
|
||||
TCL_GLOBAL_ONLY);
|
||||
}
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Paths are added only if they do not exist. N**2 complexity but lengths
|
||||
* should be short so not worth hashed lookups.
|
||||
*/
|
||||
|
||||
int result;
|
||||
|
||||
/* Initialize from TCLLIBPATH only if auto_path did not already exist */
|
||||
if (autoPathPtr == NULL) {
|
||||
autoPathPtr = Tcl_NewObj();
|
||||
if (AddPathsInVarToList(interp, "env", "TCLLIBPATH", autoPathPtr, 1) != TCL_OK) {
|
||||
Tcl_DecrRefCount(autoPathPtr);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/* tcl_library and its parent */
|
||||
Tcl_Obj *objPtr =
|
||||
Tcl_GetVar2Ex(interp, "tcl_library", NULL, TCL_GLOBAL_ONLY);
|
||||
if (objPtr) {
|
||||
if (TclListObjAppendIfAbsent(interp, autoPathPtr, objPtr) != TCL_OK) {
|
||||
Tcl_DecrRefCount(autoPathPtr);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
objPtr = TclPathPart(interp, objPtr, TCL_PATH_DIRNAME);
|
||||
if (objPtr) {
|
||||
result = TclListObjAppendIfAbsent(interp, autoPathPtr, objPtr);
|
||||
Tcl_DecrRefCount(objPtr); /* TclPathPart returns a reference */
|
||||
if (result != TCL_OK) {
|
||||
Tcl_DecrRefCount(autoPathPtr);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* parent/lib */
|
||||
Tcl_Obj *dirs[3] = {NULL, NULL, NULL}; /* exedir, exedirparent, lib */
|
||||
Tcl_Size dirCount = TclGetObjExecutableAncestors(interp, 2, dirs);
|
||||
if (dirCount == 2) {
|
||||
assert(dirs[1]);
|
||||
dirs[2] = Tcl_NewStringObj("lib", 3);
|
||||
Tcl_IncrRefCount(dirs[2]);
|
||||
objPtr = TclJoinPath(2, &dirs[1], 0);
|
||||
if (objPtr != NULL) {
|
||||
/* Note: TclListObjAppendIfAbsent handles 0 and non-0 ref counts */
|
||||
(void) TclListObjAppendIfAbsent(NULL, autoPathPtr, objPtr);
|
||||
}
|
||||
}
|
||||
for (size_t i = 0; i < sizeof(dirs) / sizeof(dirs[0]); ++i) {
|
||||
if (dirs[i] != NULL) {
|
||||
Tcl_DecrRefCount(dirs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/* tcl_pkgPath. Errors ignored like original. Note no tildeexpand */
|
||||
(void) AddPathsInVarToList(interp, "tcl_pkgPath", NULL, autoPathPtr, 0);
|
||||
autoPathPtr =
|
||||
Tcl_SetVar2Ex(interp, "auto_path", NULL, autoPathPtr, TCL_GLOBAL_ONLY);
|
||||
if (autoPathPtr) {
|
||||
Tcl_SetObjResult(interp, autoPathPtr);
|
||||
return TCL_OK;
|
||||
} else {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
@@ -336,8 +725,8 @@ Tcl_Init(
|
||||
* pre-init and init scripts are running. The real version of this struct
|
||||
* is in tclPkg.c.
|
||||
*/
|
||||
typedef struct PkgName_ {
|
||||
struct PkgName_ *nextPtr;/* Next in list of package names being
|
||||
typedef struct PkgNameStruct {
|
||||
struct PkgNameStruct *nextPtr;/* Next in list of package names being
|
||||
* initialized. */
|
||||
char name[4]; /* Enough space for "tcl". The *real* version
|
||||
* of this structure uses a flex array. */
|
||||
@@ -356,112 +745,7 @@ Tcl_Init(
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* In order to find init.tcl during initialization, the following script
|
||||
* is invoked by Tcl_Init(). It looks in several different directories:
|
||||
*
|
||||
* $tcl_library - can specify a primary location, if set, no
|
||||
* other locations will be checked. This is the
|
||||
* recommended way for a program that embeds
|
||||
* Tcl to specifically tell Tcl where to find
|
||||
* an init.tcl file.
|
||||
*
|
||||
* $env(TCL_LIBRARY) - highest priority so user can always override
|
||||
* the search path unless the application has
|
||||
* specified an exact directory above
|
||||
*
|
||||
* $tclDefaultLibrary - INTERNAL: This variable is set by Tcl on
|
||||
* those platforms where it can determine at
|
||||
* runtime the directory where it expects the
|
||||
* init.tcl file to be. After [tclInit] reads
|
||||
* and uses this value, it [unset]s it.
|
||||
* External users of Tcl should not make use of
|
||||
* the variable to customize [tclInit].
|
||||
*
|
||||
* $tcl_libPath - OBSOLETE: This variable is no longer set by
|
||||
* Tcl itself, but [tclInit] examines it in
|
||||
* case some program that embeds Tcl is
|
||||
* customizing [tclInit] by setting this
|
||||
* variable to a list of directories in which
|
||||
* to search.
|
||||
*
|
||||
* [tcl::pkgconfig get scriptdir,runtime]
|
||||
* - the directory determined by configure to be
|
||||
* the place where Tcl's script library is to
|
||||
* be installed.
|
||||
*
|
||||
* The first directory on this path that contains a valid init.tcl script
|
||||
* will be set as the value of tcl_library.
|
||||
*
|
||||
* Note that this entire search mechanism can be bypassed by defining an
|
||||
* alternate tclInit command before calling Tcl_Init().
|
||||
*/
|
||||
|
||||
result = Tcl_EvalEx(interp,
|
||||
"if {[namespace which -command tclInit] eq \"\"} {\n"
|
||||
" proc tclInit {} {\n"
|
||||
" global tcl_libPath tcl_library env tclDefaultLibrary\n"
|
||||
" rename tclInit {}\n"
|
||||
" if {[info exists tcl_library]} {\n"
|
||||
" set scripts {{set tcl_library}}\n"
|
||||
" } else {\n"
|
||||
" set scripts {}\n"
|
||||
" if {[info exists env(TCL_LIBRARY)] && ($env(TCL_LIBRARY) ne {})} {\n"
|
||||
" lappend scripts {set env(TCL_LIBRARY)}\n"
|
||||
" lappend scripts {\n"
|
||||
"if {[regexp ^tcl(.*)$ [file tail $env(TCL_LIBRARY)] -> tail] == 0} continue\n"
|
||||
"if {$tail eq [info tclversion]} continue\n"
|
||||
"file join [file dirname $env(TCL_LIBRARY)] tcl[info tclversion]}\n"
|
||||
" }\n"
|
||||
" lappend scripts {::tcl::zipfs::tcl_library_init}\n"
|
||||
" if {[info exists tclDefaultLibrary]} {\n"
|
||||
" lappend scripts {set tclDefaultLibrary}\n"
|
||||
" } else {\n"
|
||||
" lappend scripts {::tcl::pkgconfig get scriptdir,runtime}\n"
|
||||
" }\n"
|
||||
" lappend scripts {\n"
|
||||
"set parentDir [file dirname [file dirname [info nameofexecutable]]]\n"
|
||||
"set grandParentDir [file dirname $parentDir]\n"
|
||||
"file join $parentDir lib tcl[info tclversion]} \\\n"
|
||||
" {file join $grandParentDir lib tcl[info tclversion]} \\\n"
|
||||
" {file join $parentDir library} \\\n"
|
||||
" {file join $grandParentDir library} \\\n"
|
||||
" {file join $grandParentDir tcl[info tclversion] library} \\\n"
|
||||
" {file join $grandParentDir tcl[info patchlevel] library} \\\n"
|
||||
" {\n"
|
||||
"file join [file dirname $grandParentDir] tcl[info patchlevel] library}\n"
|
||||
" if {[info exists tcl_libPath]\n"
|
||||
" && [catch {llength $tcl_libPath} len] == 0} {\n"
|
||||
" for {set i 0} {$i < $len} {incr i} {\n"
|
||||
" lappend scripts [list lindex \\$tcl_libPath $i]\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
" set dirs {}\n"
|
||||
" set errors {}\n"
|
||||
" foreach script $scripts {\n"
|
||||
" if {[set tcl_library [eval $script]] eq \"\"} continue\n"
|
||||
" set tclfile [file join $tcl_library init.tcl]\n"
|
||||
" if {[file exists $tclfile]} {\n"
|
||||
" if {[catch {uplevel #0 [list source $tclfile]} msg opts]} {\n"
|
||||
" append errors \"$tclfile: $msg\n\"\n"
|
||||
" append errors \"[dict get $opts -errorinfo]\n\"\n"
|
||||
" continue\n"
|
||||
" }\n"
|
||||
" unset -nocomplain tclDefaultLibrary\n"
|
||||
" return\n"
|
||||
" }\n"
|
||||
" lappend dirs $tcl_library\n"
|
||||
" }\n"
|
||||
" unset -nocomplain tclDefaultLibrary\n"
|
||||
" set msg \"Cannot find a usable init.tcl in the following directories: \n\"\n"
|
||||
" append msg \" $dirs\n\n\"\n"
|
||||
" append msg \"$errors\n\n\"\n"
|
||||
" append msg \"This probably means that Tcl wasn't installed properly.\n\"\n"
|
||||
" error $msg\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
"tclInit", TCL_INDEX_NONE, 0);
|
||||
result = RunPreInitScript(interp);
|
||||
TclpSetInitialEncodings();
|
||||
end:
|
||||
*names = (*names)->nextPtr;
|
||||
@@ -509,9 +793,10 @@ TclInterpInit(
|
||||
childPtr->interpCmd = NULL;
|
||||
Tcl_InitHashTable(&childPtr->aliasTable, TCL_STRING_KEYS);
|
||||
|
||||
Tcl_NRCreateCommand(interp, "interp", Tcl_InterpObjCmd, NRInterpCmd,
|
||||
Tcl_NRCreateCommand2(interp, "interp", Tcl_InterpObjCmd, NRInterpCmd,
|
||||
NULL, NULL);
|
||||
Tcl_CreateObjCommand2(interp, INIT_AUTO_PATH_CMD, InitAutoPathObjCmd,
|
||||
NULL, NULL);
|
||||
|
||||
Tcl_CallWhenDeleted(interp, InterpInfoDeleteProc, NULL);
|
||||
return TCL_OK;
|
||||
}
|
||||
@@ -615,17 +900,17 @@ int
|
||||
Tcl_InterpObjCmd(
|
||||
void *clientData,
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
return Tcl_NRCallObjProc(interp, NRInterpCmd, clientData, objc, objv);
|
||||
return Tcl_NRCallObjProc2(interp, NRInterpCmd, clientData, objc, objv);
|
||||
}
|
||||
|
||||
static int
|
||||
NRInterpCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Tcl_Interp *childInterp;
|
||||
@@ -635,7 +920,7 @@ NRInterpCmd(
|
||||
"eval", "exists", "expose", "hide",
|
||||
"hidden", "issafe", "invokehidden",
|
||||
"limit", "marktrusted", "recursionlimit",
|
||||
"share",
|
||||
"set", "share",
|
||||
#ifndef TCL_NO_DEPRECATED
|
||||
"slaves",
|
||||
#endif
|
||||
@@ -647,7 +932,7 @@ NRInterpCmd(
|
||||
"eval", "exists", "expose",
|
||||
"hide", "hidden", "issafe",
|
||||
"invokehidden", "limit", "marktrusted", "recursionlimit",
|
||||
"share", "target", "transfer",
|
||||
"set", "share", "target", "transfer",
|
||||
NULL
|
||||
};
|
||||
enum interpOptionEnum {
|
||||
@@ -655,7 +940,8 @@ NRInterpCmd(
|
||||
OPT_CHILDREN, OPT_CREATE, OPT_DEBUG, OPT_DELETE,
|
||||
OPT_EVAL, OPT_EXISTS, OPT_EXPOSE, OPT_HIDE,
|
||||
OPT_HIDDEN, OPT_ISSAFE, OPT_INVOKEHID,
|
||||
OPT_LIMIT, OPT_MARKTRUSTED, OPT_RECLIMIT, OPT_SHARE,
|
||||
OPT_LIMIT, OPT_MARKTRUSTED, OPT_RECLIMIT, OPT_SET,
|
||||
OPT_SHARE,
|
||||
#ifndef TCL_NO_DEPRECATED
|
||||
OPT_SLAVES,
|
||||
#endif
|
||||
@@ -903,6 +1189,17 @@ NRInterpCmd(
|
||||
return TCL_ERROR;
|
||||
}
|
||||
return ChildEval(interp, childInterp, objc - 3, objv + 3);
|
||||
case OPT_SET:
|
||||
if (objc < 4 || objc > 5) {
|
||||
Tcl_WrongNumArgs(interp, 2, objv, "path varName ?value?");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
childInterp = GetInterp(interp, objv[2]);
|
||||
if (childInterp == NULL) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
return ChildSet(interp, childInterp, objv[3],
|
||||
objc > 4 ? objv[4] : NULL);
|
||||
case OPT_EXISTS: {
|
||||
int exists = 1;
|
||||
|
||||
@@ -1381,8 +1678,8 @@ TclPreventAliasLoop(
|
||||
* create or rename the command.
|
||||
*/
|
||||
|
||||
if (cmdPtr->objProc != TclAliasObjCmd
|
||||
&& cmdPtr->objProc != TclLocalAliasObjCmd) {
|
||||
if (cmdPtr->objProc2 != TclAliasObjCmd
|
||||
&& cmdPtr->objProc2 != TclLocalAliasObjCmd) {
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
@@ -1392,7 +1689,7 @@ TclPreventAliasLoop(
|
||||
* chain then we have a loop.
|
||||
*/
|
||||
|
||||
aliasPtr = (Alias *) cmdPtr->objClientData;
|
||||
aliasPtr = (Alias *)cmdPtr->objClientData2;
|
||||
nextAliasPtr = aliasPtr;
|
||||
while (1) {
|
||||
Tcl_Obj *cmdNamePtr;
|
||||
@@ -1437,11 +1734,11 @@ TclPreventAliasLoop(
|
||||
* Otherwise we do not have a loop.
|
||||
*/
|
||||
|
||||
if (aliasCmdPtr->objProc != TclAliasObjCmd
|
||||
&& aliasCmdPtr->objProc != TclLocalAliasObjCmd) {
|
||||
if (aliasCmdPtr->objProc2 != TclAliasObjCmd
|
||||
&& aliasCmdPtr->objProc2 != TclLocalAliasObjCmd) {
|
||||
return TCL_OK;
|
||||
}
|
||||
nextAliasPtr = (Alias *) aliasCmdPtr->objClientData;
|
||||
nextAliasPtr = (Alias *)aliasCmdPtr->objClientData2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1502,11 +1799,11 @@ TclAliasCreate(
|
||||
Tcl_Preserve(parentInterp);
|
||||
|
||||
if (childInterp == parentInterp) {
|
||||
aliasPtr->childCmd = Tcl_NRCreateCommand(childInterp,
|
||||
aliasPtr->childCmd = Tcl_NRCreateCommand2(childInterp,
|
||||
TclGetString(namePtr), TclLocalAliasObjCmd, AliasNRCmd,
|
||||
aliasPtr, AliasObjCmdDeleteProc);
|
||||
} else {
|
||||
aliasPtr->childCmd = Tcl_CreateObjCommand(childInterp,
|
||||
aliasPtr->childCmd = Tcl_CreateObjCommand2(childInterp,
|
||||
TclGetString(namePtr), TclAliasObjCmd, aliasPtr,
|
||||
AliasObjCmdDeleteProc);
|
||||
}
|
||||
@@ -1773,7 +2070,7 @@ static int
|
||||
AliasNRCmd(
|
||||
void *clientData, /* Alias record. */
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument vector. */
|
||||
{
|
||||
Alias *aliasPtr = (Alias *) clientData;
|
||||
@@ -1826,7 +2123,7 @@ int
|
||||
TclAliasObjCmd(
|
||||
void *clientData, /* Alias record. */
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument vector. */
|
||||
{
|
||||
#define ALIAS_CMDV_PREALLOC 10
|
||||
@@ -1917,7 +2214,7 @@ int
|
||||
TclLocalAliasObjCmd(
|
||||
void *clientData, /* Alias record. */
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument vector. */
|
||||
{
|
||||
#define ALIAS_CMDV_PREALLOC 10
|
||||
@@ -2418,7 +2715,7 @@ ChildCreate(
|
||||
childPtr->parentInterp = parentInterp;
|
||||
childPtr->childEntryPtr = hPtr;
|
||||
childPtr->childInterp = childInterp;
|
||||
childPtr->interpCmd = Tcl_NRCreateCommand(parentInterp, path,
|
||||
childPtr->interpCmd = Tcl_NRCreateCommand2(parentInterp, path,
|
||||
TclChildObjCmd, NRChildCmd, childInterp, ChildObjCmdDeleteProc);
|
||||
Tcl_InitHashTable(&childPtr->aliasTable, TCL_STRING_KEYS);
|
||||
Tcl_SetHashValue(hPtr, childPtr);
|
||||
@@ -2503,17 +2800,17 @@ int
|
||||
TclChildObjCmd(
|
||||
void *clientData, /* Child interpreter. */
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
return Tcl_NRCallObjProc(interp, NRChildCmd, clientData, objc, objv);
|
||||
return Tcl_NRCallObjProc2(interp, NRChildCmd, clientData, objc, objv);
|
||||
}
|
||||
|
||||
static int
|
||||
NRChildCmd(
|
||||
void *clientData, /* Child interpreter. */
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Tcl_Interp *childInterp = (Tcl_Interp *) clientData;
|
||||
@@ -2521,13 +2818,13 @@ NRChildCmd(
|
||||
"alias", "aliases", "bgerror", "debug",
|
||||
"eval", "expose", "hide", "hidden",
|
||||
"issafe", "invokehidden", "limit", "marktrusted",
|
||||
"recursionlimit", NULL
|
||||
"recursionlimit", "set", NULL
|
||||
};
|
||||
enum childCmdOptionsEnum {
|
||||
OPT_ALIAS, OPT_ALIASES, OPT_BGERROR, OPT_DEBUG,
|
||||
OPT_EVAL, OPT_EXPOSE, OPT_HIDE, OPT_HIDDEN,
|
||||
OPT_ISSAFE, OPT_INVOKEHIDDEN, OPT_LIMIT, OPT_MARKTRUSTED,
|
||||
OPT_RECLIMIT
|
||||
OPT_RECLIMIT, OPT_SET
|
||||
} index;
|
||||
|
||||
if (childInterp == NULL) {
|
||||
@@ -2689,6 +2986,12 @@ NRChildCmd(
|
||||
return TCL_ERROR;
|
||||
}
|
||||
return ChildRecursionLimit(interp, childInterp, objc - 2, objv + 2);
|
||||
case OPT_SET:
|
||||
if (objc < 3 || objc > 4) {
|
||||
Tcl_WrongNumArgs(interp, 2, objv, "varName ?value?");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
return ChildSet(interp, childInterp, objv[2], objc>3 ? objv[3] : NULL);
|
||||
default:
|
||||
TCL_UNREACHABLE();
|
||||
}
|
||||
@@ -2861,7 +3164,7 @@ ChildEval(
|
||||
|
||||
Interp *iPtr = (Interp *) interp;
|
||||
CmdFrame *invoker = iPtr->cmdFramePtr;
|
||||
int word = 0;
|
||||
Tcl_Size word = 0;
|
||||
|
||||
TclArgumentGet(interp, objv[0], &invoker, &word);
|
||||
|
||||
@@ -2878,6 +3181,51 @@ ChildEval(
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* ChildSet --
|
||||
*
|
||||
* Helper function to read and write a variable in a child interpreter.
|
||||
*
|
||||
* Results:
|
||||
* A standard Tcl result.
|
||||
*
|
||||
* Side effects:
|
||||
* Depends on whether the variable has traces. If so, this can have
|
||||
* extensive arbitrary side effects.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
static int
|
||||
ChildSet(
|
||||
Tcl_Interp *interp,
|
||||
Tcl_Interp *childInterp,
|
||||
Tcl_Obj *varNameObj,
|
||||
Tcl_Obj *valueObj)
|
||||
{
|
||||
int result = TCL_ERROR;
|
||||
Tcl_Obj *resultObj;
|
||||
Tcl_Preserve(childInterp);
|
||||
|
||||
// Modelled after the guts of Tcl_SetObjCmd().
|
||||
if (valueObj) {
|
||||
resultObj = Tcl_ObjSetVar2(childInterp, varNameObj, NULL, valueObj,
|
||||
TCL_LEAVE_ERR_MSG);
|
||||
} else {
|
||||
resultObj = Tcl_ObjGetVar2(childInterp, varNameObj, NULL,
|
||||
TCL_LEAVE_ERR_MSG);
|
||||
}
|
||||
if (resultObj) {
|
||||
Tcl_SetObjResult(childInterp, resultObj);
|
||||
result = TCL_OK;
|
||||
}
|
||||
|
||||
Tcl_TransferResult(childInterp, result, interp);
|
||||
Tcl_Release(childInterp);
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
@@ -3094,8 +3442,6 @@ ChildInvokeHidden(
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
int result = TCL_OK;
|
||||
|
||||
if (Tcl_IsSafe(interp)) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"not allowed to invoke hidden commands from safe interpreter",
|
||||
@@ -3111,29 +3457,28 @@ ChildInvokeHidden(
|
||||
Tcl_Preserve(childInterp);
|
||||
Tcl_AllowExceptions(childInterp);
|
||||
|
||||
if (namespaceName == NULL) {
|
||||
NRE_callback *rootPtr = TOP_CB(childInterp);
|
||||
|
||||
Tcl_NRAddCallback(interp, NRPostInvokeHidden, childInterp,
|
||||
rootPtr, NULL, NULL);
|
||||
return TclNRInvoke(NULL, childInterp, objc, objv);
|
||||
} else {
|
||||
// Push the namespace if one has been requested.
|
||||
Tcl_CallFrame *framePtr = NULL;
|
||||
if (namespaceName != NULL) {
|
||||
Namespace *nsPtr, *dummy1, *dummy2;
|
||||
const char *tail;
|
||||
|
||||
result = TclGetNamespaceForQualName(childInterp, namespaceName, NULL,
|
||||
int result = TclGetNamespaceForQualName(childInterp, namespaceName, NULL,
|
||||
TCL_FIND_ONLY_NS | TCL_GLOBAL_ONLY | TCL_LEAVE_ERR_MSG
|
||||
| TCL_CREATE_NS_IF_UNKNOWN, &nsPtr, &dummy1, &dummy2, &tail);
|
||||
if (result == TCL_OK) {
|
||||
result = TclObjInvokeNamespace(childInterp, objc, objv,
|
||||
(Tcl_Namespace *) nsPtr, TCL_INVOKE_HIDDEN);
|
||||
if (result != TCL_OK) {
|
||||
Tcl_TransferResult(childInterp, result, interp);
|
||||
Tcl_Release(childInterp);
|
||||
return result;
|
||||
}
|
||||
|
||||
(void) TclPushStackFrame(childInterp, &framePtr, (Tcl_Namespace *) nsPtr,
|
||||
/*isProcFrame*/ 0);
|
||||
}
|
||||
|
||||
Tcl_TransferResult(childInterp, result, interp);
|
||||
|
||||
Tcl_Release(childInterp);
|
||||
return result;
|
||||
Tcl_NRAddCallback(interp, NRPostInvokeHidden, childInterp,
|
||||
TOP_CB(childInterp), framePtr, NULL);
|
||||
return TclNRInvoke(NULL, childInterp, objc, objv);
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -3144,11 +3489,15 @@ NRPostInvokeHidden(
|
||||
{
|
||||
Tcl_Interp *childInterp = (Tcl_Interp *) data[0];
|
||||
NRE_callback *rootPtr = (NRE_callback *) data[1];
|
||||
CallFrame *framePtr = (CallFrame *) data[2];
|
||||
|
||||
if (interp != childInterp) {
|
||||
result = TclNRRunCallbacks(childInterp, result, rootPtr);
|
||||
Tcl_TransferResult(childInterp, result, interp);
|
||||
}
|
||||
if (framePtr) {
|
||||
TclPopStackFrame(childInterp);
|
||||
}
|
||||
Tcl_Release(childInterp);
|
||||
return result;
|
||||
}
|
||||
@@ -3998,19 +4347,21 @@ Tcl_LimitSetTime(
|
||||
Tcl_Time *timeLimitPtr)
|
||||
{
|
||||
Interp *iPtr = (Interp *) interp;
|
||||
Tcl_Time nextMoment;
|
||||
long long nextMoment;
|
||||
|
||||
|
||||
memcpy(&iPtr->limit.time, timeLimitPtr, sizeof(Tcl_Time));
|
||||
if (iPtr->limit.timeEvent != NULL) {
|
||||
Tcl_DeleteTimerHandler(iPtr->limit.timeEvent);
|
||||
}
|
||||
nextMoment.sec = timeLimitPtr->sec;
|
||||
nextMoment.usec = timeLimitPtr->usec+10;
|
||||
if (nextMoment.usec >= 1000000) {
|
||||
nextMoment.sec++;
|
||||
nextMoment.usec -= 1000000;
|
||||
if (timeLimitPtr->sec >= LLONG_MAX / 1000000 + 10) {
|
||||
nextMoment = LLONG_MAX;
|
||||
} else {
|
||||
nextMoment = timeLimitPtr->sec * 1000000 +
|
||||
(timeLimitPtr->usec % 1000000) + 10;
|
||||
}
|
||||
iPtr->limit.timeEvent = TclCreateAbsoluteTimerHandler(&nextMoment,
|
||||
|
||||
iPtr->limit.timeEvent = TclCreateAbsoluteTimerHandler(nextMoment,
|
||||
TimeLimitCallback, interp);
|
||||
iPtr->limit.exceeded &= ~TCL_LIMIT_TIME;
|
||||
}
|
||||
|
||||
+18
-21
@@ -36,7 +36,7 @@ typedef struct {
|
||||
Tcl_Size bytes; /* Size of C variable array. This is 0 when
|
||||
* single variables, and >0 used for array
|
||||
* variables. */
|
||||
Tcl_Size numElems; /* Number of elements in C variable array.
|
||||
Tcl_Size numElems; /* Number of elements in C variable array.
|
||||
* Zero for single variables. */
|
||||
int type; /* Type of link (TCL_LINK_INT, etc.). */
|
||||
union {
|
||||
@@ -75,21 +75,18 @@ typedef struct {
|
||||
|
||||
/*
|
||||
* Definitions for flag bits:
|
||||
* LINK_READ_ONLY - 1 means errors should be generated if Tcl
|
||||
* script attempts to write variable.
|
||||
* LINK_BEING_UPDATED - 1 means that a call to Tcl_UpdateLinkedVar is
|
||||
* in progress for this variable, so trace
|
||||
* callbacks on the variable should be ignored.
|
||||
* LINK_ALLOC_ADDR - 1 means linkPtr->addr was allocated on the
|
||||
* heap.
|
||||
* LINK_ALLOC_LAST - 1 means linkPtr->valueLast.p was allocated on
|
||||
* the heap.
|
||||
*/
|
||||
|
||||
#define LINK_READ_ONLY 1
|
||||
#define LINK_BEING_UPDATED 2
|
||||
#define LINK_ALLOC_ADDR 4
|
||||
#define LINK_ALLOC_LAST 8
|
||||
enum LinkFlags {
|
||||
LINK_READ_ONLY = 1, /* Errors should be generated if Tcl script
|
||||
* attempts to write variable. */
|
||||
LINK_BEING_UPDATED = 2, /* A call to Tcl_UpdateLinkedVar() is in
|
||||
* progress for this variable, so trace
|
||||
* callbacks on the variable should be
|
||||
* ignored. */
|
||||
LINK_ALLOC_ADDR = 4, /* linkPtr->addr was allocated on the heap. */
|
||||
LINK_ALLOC_LAST = 8 /* linkPtr->valueLast.p was allocated on the
|
||||
* heap. */
|
||||
};
|
||||
|
||||
/*
|
||||
* Forward references to functions defined later in this file:
|
||||
@@ -110,11 +107,11 @@ static int SetInvalidRealFromAny(Tcl_Interp *interp,
|
||||
*/
|
||||
|
||||
static const Tcl_ObjType invalidRealType = {
|
||||
"invalidReal", /* name */
|
||||
NULL, /* freeIntRepProc */
|
||||
NULL, /* dupIntRepProc */
|
||||
NULL, /* updateStringProc */
|
||||
NULL, /* setFromAnyProc */
|
||||
"invalidReal",
|
||||
NULL, // FreeIntRep
|
||||
NULL, // DupIntRep
|
||||
NULL, // UpdateString
|
||||
NULL, // SetFromAny
|
||||
TCL_OBJTYPE_V1(TclLengthOne)
|
||||
};
|
||||
|
||||
@@ -680,7 +677,7 @@ GetInvalidDoubleFromObj(
|
||||
|
||||
static char *
|
||||
LinkTraceProc(
|
||||
void *clientData, /* Contains information about the link. */
|
||||
void *clientData, /* Contains information about the link. */
|
||||
Tcl_Interp *interp, /* Interpreter containing Tcl variable. */
|
||||
TCL_UNUSED(const char *) /*name1*/,
|
||||
TCL_UNUSED(const char *) /*name2*/,
|
||||
|
||||
@@ -150,11 +150,11 @@ static Tcl_Size ListLength(Tcl_Obj *listPtr);
|
||||
*/
|
||||
|
||||
const Tcl_ObjType tclListType = {
|
||||
"list", /* name */
|
||||
FreeListInternalRep, /* freeIntRepProc */
|
||||
DupListInternalRep, /* dupIntRepProc */
|
||||
UpdateStringOfList, /* updateStringProc */
|
||||
SetListFromAny, /* setFromAnyProc */
|
||||
"list",
|
||||
FreeListInternalRep,
|
||||
DupListInternalRep,
|
||||
UpdateStringOfList,
|
||||
SetListFromAny,
|
||||
TCL_OBJTYPE_V1(ListLength)
|
||||
};
|
||||
|
||||
@@ -369,7 +369,7 @@ ListRepFreeUnreferenced(
|
||||
*/
|
||||
static inline void
|
||||
ObjArrayIncrRefs(
|
||||
Tcl_Obj * const *objv, /* Pointer to the array */
|
||||
Tcl_Obj *const *objv, /* Pointer to the array */
|
||||
Tcl_Size startIdx, /* Starting index of subarray within objv */
|
||||
Tcl_Size count) /* Number of elements in the subarray */
|
||||
{
|
||||
@@ -401,11 +401,11 @@ ObjArrayIncrRefs(
|
||||
*/
|
||||
static inline void
|
||||
ObjArrayDecrRefs(
|
||||
Tcl_Obj * const *objv, /* Pointer to the array */
|
||||
Tcl_Obj *const *objv, /* Pointer to the array */
|
||||
Tcl_Size startIdx, /* Starting index of subarray within objv */
|
||||
Tcl_Size count) /* Number of elements in the subarray */
|
||||
{
|
||||
Tcl_Obj * const *end;
|
||||
Tcl_Obj *const *end;
|
||||
LIST_INDEX_ASSERT(startIdx);
|
||||
LIST_COUNT_ASSERT(count);
|
||||
objv += startIdx;
|
||||
@@ -1763,7 +1763,7 @@ TclListObjAppendElements(
|
||||
Tcl_Interp *interp, /* Used to report errors if not NULL. */
|
||||
Tcl_Obj *toObj, /* List object to append */
|
||||
Tcl_Size elemCount, /* Number of elements in elemObjs[] */
|
||||
Tcl_Obj * const elemObjv[]) /* Objects to append to toObj's list. */
|
||||
Tcl_Obj *const elemObjv[]) /* Objects to append to toObj's list. */
|
||||
{
|
||||
ListRep listRep;
|
||||
Tcl_Obj **toObjv;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+68
-27
@@ -29,9 +29,9 @@
|
||||
*/
|
||||
|
||||
static size_t AddLocalLiteralEntry(CompileEnv *envPtr,
|
||||
Tcl_Obj *objPtr, int localHash);
|
||||
Tcl_Obj *objPtr, size_t localHash);
|
||||
static void ExpandLocalLiteralArray(CompileEnv *envPtr);
|
||||
static size_t HashString(const char *string, size_t length);
|
||||
static size_t HashString(const char *string, Tcl_Size length);
|
||||
#ifdef TCL_COMPILE_DEBUG
|
||||
static LiteralEntry * LookupLiteralEntry(Tcl_Interp *interp,
|
||||
Tcl_Obj *objPtr);
|
||||
@@ -58,8 +58,7 @@ static void RebuildLiteralTable(LiteralTable *tablePtr);
|
||||
|
||||
void
|
||||
TclInitLiteralTable(
|
||||
LiteralTable *tablePtr)
|
||||
/* Pointer to table structure, which is
|
||||
LiteralTable *tablePtr) /* Pointer to table structure, which is
|
||||
* supplied by the caller. */
|
||||
{
|
||||
#if (TCL_SMALL_HASH_TABLE != 4)
|
||||
@@ -176,11 +175,11 @@ TclDeleteLiteralTable(
|
||||
Tcl_Obj *
|
||||
TclCreateLiteral(
|
||||
Interp *iPtr,
|
||||
const char *bytes, /* The start of the string. Note that this is
|
||||
const char *bytes, /* The start of the string. Note that this is
|
||||
* not a NUL-terminated string. */
|
||||
Tcl_Size length, /* Number of bytes in the string. */
|
||||
size_t hash, /* The string's hash. If the value is
|
||||
* TCL_INDEX_NONE, it will be computed here. */
|
||||
Tcl_Size length, /* Number of bytes in the string. */
|
||||
size_t hash, /* The string's hash. If the value is
|
||||
* TCL_INDEX_NONE, it will be computed here. */
|
||||
int *newPtr,
|
||||
Namespace *nsPtr,
|
||||
int flags,
|
||||
@@ -251,8 +250,9 @@ TclCreateLiteral(
|
||||
if ((flags & LITERAL_ON_HEAP)) {
|
||||
objPtr->bytes = (char *) bytes;
|
||||
objPtr->length = length;
|
||||
} else {
|
||||
TclInitStringRep(objPtr, bytes, length);
|
||||
} else if (!TclAttemptInitStringRep(objPtr, bytes, length)) {
|
||||
Tcl_DecrRefCount(objPtr);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Should the new literal be shared globally? */
|
||||
@@ -389,12 +389,12 @@ TclFetchLiteral(
|
||||
|
||||
int /* Do NOT change this type. Should not be wider than TclEmitPush operand*/
|
||||
TclRegisterLiteral(
|
||||
void *ePtr, /* Points to the CompileEnv in whose object
|
||||
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
|
||||
const char *bytes, /* Points to string for which to find or
|
||||
* create an object in CompileEnv's object
|
||||
* array. */
|
||||
Tcl_Size length, /* Number of bytes in the string. If -1, the
|
||||
Tcl_Size length, /* Number of bytes in the string. If -1, the
|
||||
* string consists of all bytes up to the
|
||||
* first null character. */
|
||||
int flags) /* If LITERAL_ON_HEAP then the caller already
|
||||
@@ -440,7 +440,7 @@ TclRegisterLiteral(
|
||||
if (objIndex > INT_MAX) {
|
||||
Tcl_Panic("Literal table index too large. Cannot be handled by TclEmitPush");
|
||||
}
|
||||
return objIndex;
|
||||
return (int)objIndex;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -482,7 +482,7 @@ TclRegisterLiteral(
|
||||
Tcl_Panic(
|
||||
"Literal table index too large. Cannot be handled by TclEmitPush");
|
||||
}
|
||||
return objIndex;
|
||||
return (int)objIndex;
|
||||
}
|
||||
|
||||
#ifdef TCL_COMPILE_DEBUG
|
||||
@@ -507,7 +507,7 @@ static LiteralEntry *
|
||||
LookupLiteralEntry(
|
||||
Tcl_Interp *interp, /* Interpreter for which objPtr was created to
|
||||
* hold a literal. */
|
||||
Tcl_Obj *objPtr) /* Points to a Tcl object holding a literal
|
||||
Tcl_Obj *objPtr) /* Points to a Tcl object holding a literal
|
||||
* that was previously created by a call to
|
||||
* TclRegisterLiteral. */
|
||||
{
|
||||
@@ -553,7 +553,7 @@ void
|
||||
TclHideLiteral(
|
||||
Tcl_Interp *interp, /* Interpreter for which objPtr was created to
|
||||
* hold a literal. */
|
||||
CompileEnv *envPtr,/* Points to CompileEnv whose literal array
|
||||
CompileEnv *envPtr, /* Points to CompileEnv whose literal array
|
||||
* contains the entry being hidden. */
|
||||
int index) /* The index of the entry in the literal
|
||||
* array. */
|
||||
@@ -617,7 +617,7 @@ TclHideLiteral(
|
||||
|
||||
int
|
||||
TclAddLiteralObj(
|
||||
CompileEnv *envPtr,/* Points to CompileEnv in whose literal array
|
||||
CompileEnv *envPtr, /* Points to CompileEnv in whose literal array
|
||||
* the object is to be inserted. */
|
||||
Tcl_Obj *objPtr, /* The object to insert into the array. */
|
||||
LiteralEntry **litPtrPtr) /* The location where the pointer to the new
|
||||
@@ -647,7 +647,49 @@ TclAddLiteralObj(
|
||||
*litPtrPtr = lPtr;
|
||||
}
|
||||
|
||||
return objIndex;
|
||||
return (int)objIndex;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* TclRegisterLiteralObj --
|
||||
*
|
||||
* Find, or if necessary create, an object in a CompileEnv literal array
|
||||
* that has a string representation matching the argument object.
|
||||
*
|
||||
* Results:
|
||||
* The index in the CompileEnv's literal array that references a shared
|
||||
* literal matching the string. The object is created if necessary.
|
||||
*
|
||||
* Side effects:
|
||||
* To maximize sharing, we look up the string in the interpreter's global
|
||||
* literal table. If not found, we create a new shared literal in the
|
||||
* global table. We then add a reference to the shared literal in the
|
||||
* CompileEnv's literal array.
|
||||
*
|
||||
* The reference count of the argument object is bounced, so that the
|
||||
* normal case where the object is zero ref count (as it is really acting
|
||||
* as a local worker buffer) doesn't need explicit refcount handling by
|
||||
* the caller.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
int
|
||||
TclRegisterLiteralObj(
|
||||
CompileEnv *envPtr, /* Points to CompileEnv in whose literal array
|
||||
* the object is to be inserted. */
|
||||
Tcl_Obj *objPtr, /* The object to insert into the array. */
|
||||
int flags) /* If LITERAL_CMD_NAME then the literal should
|
||||
* not be shared across namespaces.
|
||||
* LITERAL_ON_HEAP is unsupported/ignored. */
|
||||
{
|
||||
Tcl_Size length;
|
||||
const char *bytes = Tcl_GetStringFromObj(objPtr, &length);
|
||||
int num = TclRegisterLiteral(envPtr, bytes, length,
|
||||
flags & ~LITERAL_ON_HEAP);
|
||||
Tcl_BounceRefCount(objPtr);
|
||||
return num;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -670,10 +712,10 @@ TclAddLiteralObj(
|
||||
|
||||
static size_t
|
||||
AddLocalLiteralEntry(
|
||||
CompileEnv *envPtr,/* Points to CompileEnv in whose literal array
|
||||
CompileEnv *envPtr, /* Points to CompileEnv in whose literal array
|
||||
* the object is to be inserted. */
|
||||
Tcl_Obj *objPtr, /* The literal to add to the CompileEnv. */
|
||||
int localHash) /* Hash value for the literal's string. */
|
||||
size_t localHash) /* Hash value for the literal's string. */
|
||||
{
|
||||
LiteralTable *localTablePtr = &envPtr->localLitTable;
|
||||
LiteralEntry *localPtr;
|
||||
@@ -749,7 +791,7 @@ AddLocalLiteralEntry(
|
||||
|
||||
static void
|
||||
ExpandLocalLiteralArray(
|
||||
CompileEnv *envPtr)/* Points to the CompileEnv whose object array
|
||||
CompileEnv *envPtr) /* Points to the CompileEnv whose object array
|
||||
* must be enlarged. */
|
||||
{
|
||||
/*
|
||||
@@ -831,7 +873,7 @@ void
|
||||
TclReleaseLiteral(
|
||||
Tcl_Interp *interp, /* Interpreter for which objPtr was created to
|
||||
* hold a literal. */
|
||||
Tcl_Obj *objPtr) /* Points to a literal object that was
|
||||
Tcl_Obj *objPtr) /* Points to a literal object that was
|
||||
* previously created by a call to
|
||||
* TclRegisterLiteral. */
|
||||
{
|
||||
@@ -911,8 +953,8 @@ TclReleaseLiteral(
|
||||
|
||||
static size_t
|
||||
HashString(
|
||||
const char *string, /* String for which to compute hash value. */
|
||||
size_t length) /* Number of bytes in the string. */
|
||||
const char *string, /* String for which to compute hash value. */
|
||||
Tcl_Size length) /* Number of bytes in the string. */
|
||||
{
|
||||
size_t result = 0;
|
||||
|
||||
@@ -975,8 +1017,7 @@ HashString(
|
||||
|
||||
static void
|
||||
RebuildLiteralTable(
|
||||
LiteralTable *tablePtr)
|
||||
/* Local or global table to enlarge. */
|
||||
LiteralTable *tablePtr) /* Local or global table to enlarge. */
|
||||
{
|
||||
LiteralEntry **oldBuckets;
|
||||
LiteralEntry **oldChainPtr, **newChainPtr;
|
||||
|
||||
+21
-13
@@ -85,6 +85,12 @@ typedef struct InterpLibrary {
|
||||
* for end of list. */
|
||||
} InterpLibrary;
|
||||
|
||||
/*
|
||||
* Associated data key used to look up the linked list of libraries registered
|
||||
* in the interpreter.
|
||||
*/
|
||||
#define ASSOC_KEY "tclLoad"
|
||||
|
||||
/*
|
||||
* Prototypes for functions that are private to this file:
|
||||
*/
|
||||
@@ -124,7 +130,7 @@ int
|
||||
Tcl_LoadObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Tcl_Interp *target;
|
||||
@@ -132,7 +138,8 @@ Tcl_LoadObjCmd(
|
||||
Tcl_DString pfx, tmp, initName, safeInitName;
|
||||
Tcl_DString unloadName, safeUnloadName;
|
||||
InterpLibrary *ipFirstPtr, *ipPtr;
|
||||
int code, namesMatch, filesMatch, offset;
|
||||
int code, namesMatch, filesMatch;
|
||||
Tcl_Size offset;
|
||||
const char *symbols[2];
|
||||
Tcl_LibraryInitProc *initProc;
|
||||
const char *p, *fullFileName, *prefix;
|
||||
@@ -278,7 +285,7 @@ Tcl_LoadObjCmd(
|
||||
*/
|
||||
|
||||
if (libraryPtr != NULL) {
|
||||
ipFirstPtr = (InterpLibrary *)Tcl_GetAssocData(target, "tclLoad", NULL);
|
||||
ipFirstPtr = (InterpLibrary *)Tcl_GetAssocData(target, ASSOC_KEY, NULL);
|
||||
for (ipPtr = ipFirstPtr; ipPtr != NULL; ipPtr = ipPtr->nextPtr) {
|
||||
if (ipPtr->libraryPtr == libraryPtr) {
|
||||
code = TCL_OK;
|
||||
@@ -514,11 +521,11 @@ Tcl_LoadObjCmd(
|
||||
* static libraries at the head of the linked list!
|
||||
*/
|
||||
|
||||
ipFirstPtr = (InterpLibrary *)Tcl_GetAssocData(target, "tclLoad", NULL);
|
||||
ipFirstPtr = (InterpLibrary *)Tcl_GetAssocData(target, ASSOC_KEY, NULL);
|
||||
ipPtr = (InterpLibrary *)Tcl_Alloc(sizeof(InterpLibrary));
|
||||
ipPtr->libraryPtr = libraryPtr;
|
||||
ipPtr->nextPtr = ipFirstPtr;
|
||||
Tcl_SetAssocData(target, "tclLoad", LoadCleanupProc, ipPtr);
|
||||
Tcl_SetAssocData(target, ASSOC_KEY, LoadCleanupProc, ipPtr);
|
||||
|
||||
done:
|
||||
Tcl_DStringFree(&pfx);
|
||||
@@ -551,14 +558,15 @@ int
|
||||
Tcl_UnloadObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Tcl_Interp *target; /* Which interpreter to unload from. */
|
||||
LoadedLibrary *libraryPtr;
|
||||
Tcl_DString pfx, tmp;
|
||||
InterpLibrary *ipFirstPtr, *ipPtr;
|
||||
int i, code, complain = 1, keepLibrary = 0;
|
||||
Tcl_Size i;
|
||||
int code, complain = 1, keepLibrary = 0;
|
||||
const char *fullFileName = "";
|
||||
const char *prefix;
|
||||
static const char *const options[] = {
|
||||
@@ -721,7 +729,7 @@ Tcl_UnloadObjCmd(
|
||||
|
||||
code = TCL_ERROR;
|
||||
if (libraryPtr != NULL) {
|
||||
ipFirstPtr = (InterpLibrary *)Tcl_GetAssocData(target, "tclLoad", NULL);
|
||||
ipFirstPtr = (InterpLibrary *)Tcl_GetAssocData(target, ASSOC_KEY, NULL);
|
||||
for (ipPtr = ipFirstPtr; ipPtr != NULL; ipPtr = ipPtr->nextPtr) {
|
||||
if (ipPtr->libraryPtr == libraryPtr) {
|
||||
code = TCL_OK;
|
||||
@@ -863,7 +871,7 @@ UnloadLibrary(
|
||||
*/
|
||||
|
||||
if (!interpExiting) {
|
||||
ipFirstPtr = (InterpLibrary *)Tcl_GetAssocData(target, "tclLoad", NULL);
|
||||
ipFirstPtr = (InterpLibrary *)Tcl_GetAssocData(target, ASSOC_KEY, NULL);
|
||||
if (ipFirstPtr) {
|
||||
ipPtr = ipFirstPtr;
|
||||
if (ipPtr->libraryPtr == libraryPtr) {
|
||||
@@ -880,7 +888,7 @@ UnloadLibrary(
|
||||
}
|
||||
}
|
||||
Tcl_Free(ipPtr);
|
||||
Tcl_SetAssocData(target, "tclLoad", LoadCleanupProc, ipFirstPtr);
|
||||
Tcl_SetAssocData(target, ASSOC_KEY, LoadCleanupProc, ipFirstPtr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1057,7 +1065,7 @@ Tcl_StaticLibrary(
|
||||
* it's already loaded.
|
||||
*/
|
||||
|
||||
ipFirstPtr = (InterpLibrary *)Tcl_GetAssocData(interp, "tclLoad", NULL);
|
||||
ipFirstPtr = (InterpLibrary *)Tcl_GetAssocData(interp, ASSOC_KEY, NULL);
|
||||
for (ipPtr = ipFirstPtr; ipPtr != NULL; ipPtr = ipPtr->nextPtr) {
|
||||
if (ipPtr->libraryPtr == libraryPtr) {
|
||||
return;
|
||||
@@ -1072,7 +1080,7 @@ Tcl_StaticLibrary(
|
||||
ipPtr = (InterpLibrary *)Tcl_Alloc(sizeof(InterpLibrary));
|
||||
ipPtr->libraryPtr = libraryPtr;
|
||||
ipPtr->nextPtr = ipFirstPtr;
|
||||
Tcl_SetAssocData(interp, "tclLoad", LoadCleanupProc, ipPtr);
|
||||
Tcl_SetAssocData(interp, ASSOC_KEY, LoadCleanupProc, ipPtr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1132,7 +1140,7 @@ TclGetLoadedLibraries(
|
||||
if (target == NULL) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
ipPtr = (InterpLibrary *)Tcl_GetAssocData(target, "tclLoad", NULL);
|
||||
ipPtr = (InterpLibrary *)Tcl_GetAssocData(target, ASSOC_KEY, NULL);
|
||||
|
||||
/*
|
||||
* Return information about all of the available libraries.
|
||||
|
||||
+2
-5
@@ -280,7 +280,7 @@ Tcl_SourceRCFile(
|
||||
|
||||
TCL_NORETURN void
|
||||
Tcl_MainEx(
|
||||
Tcl_Size argc, /* Number of arguments. */
|
||||
Tcl_Size argc, /* Number of arguments. */
|
||||
TCHAR **argv, /* Array of argument strings. */
|
||||
Tcl_AppInitProc *appInitProc,
|
||||
/* Application-specific initialization
|
||||
@@ -296,13 +296,10 @@ Tcl_MainEx(
|
||||
Tcl_Channel chan;
|
||||
InteractiveState is;
|
||||
|
||||
TclpSetInitialEncodings();
|
||||
if (argc > 0) {
|
||||
--argc; /* consume argv[0] */
|
||||
++i;
|
||||
}
|
||||
TclpFindExecutable((const char *)argv[0]); /* nb: this could be NULL
|
||||
* w/ (eg) an empty argv supplied to execve() */
|
||||
|
||||
Tcl_InitMemory(interp);
|
||||
|
||||
@@ -739,7 +736,7 @@ TclFullFinalizationRequested(void)
|
||||
|
||||
static void
|
||||
StdinProc(
|
||||
void *clientData, /* The state of interactive cmd line */
|
||||
void *clientData, /* The state of interactive cmd line */
|
||||
TCL_UNUSED(int) /*mask*/)
|
||||
{
|
||||
int code;
|
||||
|
||||
@@ -147,7 +147,7 @@ static int
|
||||
TestMutexObjCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
static const char *const mutexOptions[] = {
|
||||
@@ -559,7 +559,7 @@ int
|
||||
TclMutex_Init(
|
||||
Tcl_Interp *interp) /* The current Tcl interpreter */
|
||||
{
|
||||
Tcl_CreateObjCommand(interp, "testmutex", TestMutexObjCmd, NULL, NULL);
|
||||
Tcl_CreateObjCommand2(interp, "testmutex", TestMutexObjCmd, NULL, NULL);
|
||||
return TCL_OK;
|
||||
}
|
||||
#endif /* TCL_THREADS */
|
||||
|
||||
+85
-110
@@ -91,29 +91,29 @@ static void FreeNsNameInternalRep(Tcl_Obj *objPtr);
|
||||
static int GetNamespaceFromObj(Tcl_Interp *interp,
|
||||
Tcl_Obj *objPtr, Tcl_Namespace **nsPtrPtr);
|
||||
static int InvokeImportedNRCmd(void *clientData,
|
||||
Tcl_Interp *interp, int objc,
|
||||
Tcl_Interp *interp, Tcl_Size objc,
|
||||
Tcl_Obj *const objv[]);
|
||||
static Tcl_ObjCmdProc NamespaceChildrenCmd;
|
||||
static Tcl_ObjCmdProc NamespaceCodeCmd;
|
||||
static Tcl_ObjCmdProc NamespaceCurrentCmd;
|
||||
static Tcl_ObjCmdProc NamespaceDeleteCmd;
|
||||
static Tcl_ObjCmdProc NamespaceEvalCmd;
|
||||
static Tcl_ObjCmdProc NRNamespaceEvalCmd;
|
||||
static Tcl_ObjCmdProc NamespaceExistsCmd;
|
||||
static Tcl_ObjCmdProc NamespaceExportCmd;
|
||||
static Tcl_ObjCmdProc NamespaceForgetCmd;
|
||||
static Tcl_ObjCmdProc2 NamespaceChildrenCmd;
|
||||
static Tcl_ObjCmdProc2 NamespaceCodeCmd;
|
||||
static Tcl_ObjCmdProc2 NamespaceCurrentCmd;
|
||||
static Tcl_ObjCmdProc2 NamespaceDeleteCmd;
|
||||
static Tcl_ObjCmdProc2 NamespaceEvalCmd;
|
||||
static Tcl_ObjCmdProc2 NRNamespaceEvalCmd;
|
||||
static Tcl_ObjCmdProc2 NamespaceExistsCmd;
|
||||
static Tcl_ObjCmdProc2 NamespaceExportCmd;
|
||||
static Tcl_ObjCmdProc2 NamespaceForgetCmd;
|
||||
static void NamespaceFree(Namespace *nsPtr);
|
||||
static Tcl_ObjCmdProc NamespaceImportCmd;
|
||||
static Tcl_ObjCmdProc NamespaceInscopeCmd;
|
||||
static Tcl_ObjCmdProc NRNamespaceInscopeCmd;
|
||||
static Tcl_ObjCmdProc NamespaceOriginCmd;
|
||||
static Tcl_ObjCmdProc NamespaceParentCmd;
|
||||
static Tcl_ObjCmdProc NamespacePathCmd;
|
||||
static Tcl_ObjCmdProc NamespaceQualifiersCmd;
|
||||
static Tcl_ObjCmdProc NamespaceTailCmd;
|
||||
static Tcl_ObjCmdProc NamespaceUpvarCmd;
|
||||
static Tcl_ObjCmdProc NamespaceUnknownCmd;
|
||||
static Tcl_ObjCmdProc NamespaceWhichCmd;
|
||||
static Tcl_ObjCmdProc2 NamespaceImportCmd;
|
||||
static Tcl_ObjCmdProc2 NamespaceInscopeCmd;
|
||||
static Tcl_ObjCmdProc2 NRNamespaceInscopeCmd;
|
||||
static Tcl_ObjCmdProc2 NamespaceOriginCmd;
|
||||
static Tcl_ObjCmdProc2 NamespaceParentCmd;
|
||||
static Tcl_ObjCmdProc2 NamespacePathCmd;
|
||||
static Tcl_ObjCmdProc2 NamespaceQualifiersCmd;
|
||||
static Tcl_ObjCmdProc2 NamespaceTailCmd;
|
||||
static Tcl_ObjCmdProc2 NamespaceUpvarCmd;
|
||||
static Tcl_ObjCmdProc2 NamespaceUnknownCmd;
|
||||
static Tcl_ObjCmdProc2 NamespaceWhichCmd;
|
||||
static int SetNsNameFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr);
|
||||
static void UnlinkNsPath(Namespace *nsPtr);
|
||||
|
||||
@@ -127,11 +127,11 @@ static Tcl_NRPostProc NsEval_Callback;
|
||||
*/
|
||||
|
||||
static const Tcl_ObjType nsNameType = {
|
||||
"nsName", /* the type's name */
|
||||
FreeNsNameInternalRep, /* freeIntRepProc */
|
||||
DupNsNameInternalRep, /* dupIntRepProc */
|
||||
NULL, /* updateStringProc */
|
||||
SetNsNameFromAny, /* setFromAnyProc */
|
||||
"nsName",
|
||||
FreeNsNameInternalRep,
|
||||
DupNsNameInternalRep,
|
||||
NULL, // UpdateString
|
||||
SetNsNameFromAny,
|
||||
TCL_OBJTYPE_V0
|
||||
};
|
||||
|
||||
@@ -142,34 +142,34 @@ static const Tcl_ObjType nsNameType = {
|
||||
ir.twoPtrValue.ptr1 = (nnPtr); \
|
||||
ir.twoPtrValue.ptr2 = NULL; \
|
||||
Tcl_StoreInternalRep((objPtr), &nsNameType, &ir); \
|
||||
} while (0)
|
||||
} while (false)
|
||||
|
||||
#define NsNameGetInternalRep(objPtr, nnPtr) \
|
||||
do { \
|
||||
const Tcl_ObjInternalRep *irPtr; \
|
||||
irPtr = TclFetchInternalRep((objPtr), &nsNameType); \
|
||||
(nnPtr) = irPtr ? (ResolvedNsName *) irPtr->twoPtrValue.ptr1 : NULL; \
|
||||
} while (0)
|
||||
} while (false)
|
||||
|
||||
/*
|
||||
* Array of values describing how to implement each standard subcommand of the
|
||||
* "namespace" command.
|
||||
*/
|
||||
|
||||
static const EnsembleImplMap defaultNamespaceMap[] = {
|
||||
const EnsembleImplMap tclNamespaceImplMap[] = {
|
||||
{"children", NamespaceChildrenCmd, TclCompileBasic0To2ArgCmd, NULL, NULL, 0},
|
||||
{"code", NamespaceCodeCmd, TclCompileNamespaceCodeCmd, NULL, NULL, 0},
|
||||
{"current", NamespaceCurrentCmd, TclCompileNamespaceCurrentCmd, NULL, NULL, 0},
|
||||
{"delete", NamespaceDeleteCmd, TclCompileBasicMin0ArgCmd, NULL, NULL, 0},
|
||||
{"ensemble", TclNamespaceEnsembleCmd, NULL, NULL, NULL, 0},
|
||||
{"eval", NamespaceEvalCmd, NULL, NRNamespaceEvalCmd, NULL, 0},
|
||||
{"exists", NamespaceExistsCmd, TclCompileBasic1ArgCmd, NULL, NULL, 0},
|
||||
{"exists", NamespaceExistsCmd, TclCompileBasic1ArgCmd, NULL, NULL, 0}, // TODO: compile?
|
||||
{"export", NamespaceExportCmd, TclCompileBasicMin0ArgCmd, NULL, NULL, 0},
|
||||
{"forget", NamespaceForgetCmd, TclCompileBasicMin0ArgCmd, NULL, NULL, 0},
|
||||
{"import", NamespaceImportCmd, TclCompileBasicMin0ArgCmd, NULL, NULL, 0},
|
||||
{"inscope", NamespaceInscopeCmd, NULL, NRNamespaceInscopeCmd, NULL, 0},
|
||||
{"origin", NamespaceOriginCmd, TclCompileNamespaceOriginCmd, NULL, NULL, 0},
|
||||
{"parent", NamespaceParentCmd, TclCompileBasic0Or1ArgCmd, NULL, NULL, 0},
|
||||
{"parent", NamespaceParentCmd, TclCompileBasic0Or1ArgCmd, NULL, NULL, 0}, // TODO: compile?
|
||||
{"path", NamespacePathCmd, TclCompileBasic0Or1ArgCmd, NULL, NULL, 0},
|
||||
{"qualifiers", NamespaceQualifiersCmd, TclCompileNamespaceQualifiersCmd, NULL, NULL, 0},
|
||||
{"tail", NamespaceTailCmd, TclCompileNamespaceTailCmd, NULL, NULL, 0},
|
||||
@@ -200,16 +200,15 @@ CreateChildEntry(
|
||||
Namespace *nsPtr, /* Parent namespace. */
|
||||
const char *name) /* Simple name to look for. */
|
||||
{
|
||||
int newEntry;
|
||||
#ifndef BREAK_NAMESPACE_COMPAT
|
||||
return Tcl_CreateHashEntry(&nsPtr->childTable, name, &newEntry);
|
||||
return Tcl_CreateHashEntry(&nsPtr->childTable, name, NULL);
|
||||
#else
|
||||
if (nsPtr->childTablePtr == NULL) {
|
||||
nsPtr->childTablePtr = (Tcl_HashTable *)
|
||||
Tcl_Alloc(sizeof(Tcl_HashTable));
|
||||
Tcl_InitHashTable(nsPtr->childTablePtr, TCL_STRING_KEYS);
|
||||
}
|
||||
return Tcl_CreateHashEntry(nsPtr->childTablePtr, name, &newEntry);
|
||||
return Tcl_CreateHashEntry(nsPtr->childTablePtr, name, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1057,7 +1056,7 @@ Tcl_DeleteNamespace(
|
||||
for (entryPtr = Tcl_FirstHashEntry(&nsPtr->cmdTable, &search);
|
||||
entryPtr != NULL;) {
|
||||
cmdPtr = (Command *) Tcl_GetHashValue(entryPtr);
|
||||
if (cmdPtr->nreProc == TclNRInterpCoroutine) {
|
||||
if (cmdPtr->nreProc2 == TclNRInterpCoroutine) {
|
||||
Tcl_DeleteCommandFromToken(interp, (Tcl_Command) cmdPtr);
|
||||
entryPtr = Tcl_FirstHashEntry(&nsPtr->cmdTable, &search);
|
||||
} else {
|
||||
@@ -1188,7 +1187,7 @@ TclDeleteNamespaceChildren(
|
||||
Tcl_Interp *interp = nsPtr->interp;
|
||||
Tcl_HashEntry *entryPtr;
|
||||
size_t i;
|
||||
int unchecked;
|
||||
bool unchecked;
|
||||
Tcl_HashSearch search;
|
||||
|
||||
/*
|
||||
@@ -1218,10 +1217,10 @@ TclDeleteNamespaceChildren(
|
||||
children[i]->refCount++;
|
||||
i++;
|
||||
}
|
||||
unchecked = 0;
|
||||
unchecked = false;
|
||||
for (i = 0 ; i < length ; i++) {
|
||||
if (!(children[i]->flags & NS_DYING)) {
|
||||
unchecked = 1;
|
||||
unchecked = true;
|
||||
Tcl_DeleteNamespace((Tcl_Namespace *) children[i]);
|
||||
TclNsDecrRefCount(children[i]);
|
||||
}
|
||||
@@ -1851,7 +1850,7 @@ DoImport(
|
||||
Command *linkCmd = cmdPtr;
|
||||
|
||||
while (linkCmd->deleteProc == DeleteImportedCmd) {
|
||||
dataPtr = (ImportedCmdData *) linkCmd->objClientData;
|
||||
dataPtr = (ImportedCmdData *)linkCmd->objClientData2;
|
||||
linkCmd = dataPtr->realCmdPtr;
|
||||
if (overwrite == linkCmd) {
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
@@ -1866,7 +1865,7 @@ DoImport(
|
||||
}
|
||||
|
||||
dataPtr = (ImportedCmdData *) Tcl_Alloc(sizeof(ImportedCmdData));
|
||||
importedCmd = Tcl_NRCreateCommand(interp, Tcl_DStringValue(&ds),
|
||||
importedCmd = Tcl_NRCreateCommand2(interp, Tcl_DStringValue(&ds),
|
||||
TclInvokeImportedCmd, InvokeImportedNRCmd, dataPtr,
|
||||
DeleteImportedCmd);
|
||||
dataPtr->realCmdPtr = cmdPtr;
|
||||
@@ -1889,8 +1888,7 @@ DoImport(
|
||||
Command *overwrite = (Command *) Tcl_GetHashValue(found);
|
||||
|
||||
if (overwrite->deleteProc == DeleteImportedCmd) {
|
||||
ImportedCmdData *dataPtr = (ImportedCmdData *)
|
||||
overwrite->objClientData;
|
||||
ImportedCmdData *dataPtr = (ImportedCmdData *)overwrite->objClientData2;
|
||||
|
||||
if (dataPtr->realCmdPtr == Tcl_GetHashValue(hPtr)) {
|
||||
/*
|
||||
@@ -2027,8 +2025,7 @@ Tcl_ForgetImport(
|
||||
*/
|
||||
|
||||
Command *cmdPtr = (Command *) token;
|
||||
ImportedCmdData *dataPtr = (ImportedCmdData *)
|
||||
cmdPtr->objClientData;
|
||||
ImportedCmdData *dataPtr = (ImportedCmdData *)cmdPtr->objClientData2;
|
||||
Tcl_Command firstToken = (Tcl_Command) dataPtr->realCmdPtr;
|
||||
|
||||
if (firstToken == origin) {
|
||||
@@ -2082,7 +2079,7 @@ TclGetOriginalCommand(
|
||||
}
|
||||
|
||||
while (cmdPtr->deleteProc == DeleteImportedCmd) {
|
||||
ImportedCmdData *dataPtr = (ImportedCmdData *) cmdPtr->objClientData;
|
||||
ImportedCmdData *dataPtr = (ImportedCmdData *) cmdPtr->objClientData2;
|
||||
cmdPtr = dataPtr->realCmdPtr;
|
||||
}
|
||||
return (Tcl_Command) cmdPtr;
|
||||
@@ -2112,7 +2109,7 @@ InvokeImportedNRCmd(
|
||||
void *clientData, /* Points to the imported command's
|
||||
* ImportedCmdData structure. */
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* The argument objects. */
|
||||
{
|
||||
ImportedCmdData *dataPtr = (ImportedCmdData *) clientData;
|
||||
@@ -2127,10 +2124,10 @@ TclInvokeImportedCmd(
|
||||
void *clientData, /* Points to the imported command's
|
||||
* ImportedCmdData structure. */
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* The argument objects. */
|
||||
{
|
||||
return Tcl_NRCallObjProc(interp, InvokeImportedNRCmd, clientData,
|
||||
return Tcl_NRCallObjProc2(interp, InvokeImportedNRCmd, clientData,
|
||||
objc, objv);
|
||||
}
|
||||
|
||||
@@ -2301,7 +2298,7 @@ TclGetNamespaceForQualName(
|
||||
* namespace if TCL_GLOBAL_ONLY was specified,
|
||||
* or the current namespace if cxtNsPtr was
|
||||
* NULL. */
|
||||
const char **simpleNamePtr) /* Address where function stores the simple
|
||||
const char **simpleNamePtr) /* Address where function stores the simple
|
||||
* name at end of the qualName, or NULL if
|
||||
* qualName is "::" or the flag
|
||||
* TCL_FIND_ONLY_NS was specified. */
|
||||
@@ -2543,7 +2540,7 @@ TclEnsureNamespace(
|
||||
{
|
||||
Namespace *nsPtr = (Namespace *) namespacePtr;
|
||||
if (!(nsPtr->flags & NS_DYING)) {
|
||||
return namespacePtr;
|
||||
return namespacePtr;
|
||||
}
|
||||
return Tcl_CreateNamespace(interp, nsPtr->fullName, NULL, NULL);
|
||||
}
|
||||
@@ -2840,7 +2837,8 @@ TclResetShadowedCmdRefs(
|
||||
Namespace *nsPtr;
|
||||
Namespace *trailNsPtr, *shadowNsPtr;
|
||||
Namespace *globalNsPtr = (Namespace *) TclGetGlobalNamespace(interp);
|
||||
int found, i;
|
||||
int i;
|
||||
bool found;
|
||||
int trailFront = -1;
|
||||
int trailSize = 5; /* Formerly NUM_TRAIL_ELEMS. */
|
||||
Namespace **trailPtr = (Namespace **) TclStackAlloc(interp,
|
||||
@@ -2876,7 +2874,7 @@ TclResetShadowedCmdRefs(
|
||||
* contains a command cmdName.
|
||||
*/
|
||||
|
||||
found = 1;
|
||||
found = true;
|
||||
shadowNsPtr = globalNsPtr;
|
||||
|
||||
for (i = trailFront; i >= 0; i--) {
|
||||
@@ -2885,7 +2883,7 @@ TclResetShadowedCmdRefs(
|
||||
if (hPtr != NULL) {
|
||||
shadowNsPtr = (Namespace *) Tcl_GetHashValue(hPtr);
|
||||
} else {
|
||||
found = 0;
|
||||
found = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -3081,30 +3079,6 @@ TclNewNamespaceObj(
|
||||
return objPtr;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* TclInitNamespaceCmd --
|
||||
*
|
||||
* This function is called to create the "namespace" Tcl command. See the
|
||||
* user documentation for details on what it does.
|
||||
*
|
||||
* Results:
|
||||
* Handle for the namespace command, or NULL on failure.
|
||||
*
|
||||
* Side effects:
|
||||
* none
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
Tcl_Command
|
||||
TclInitNamespaceCmd(
|
||||
Tcl_Interp *interp) /* Current interpreter. */
|
||||
{
|
||||
return TclMakeEnsemble(interp, "namespace", defaultNamespaceMap);
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
@@ -3130,7 +3104,7 @@ static int
|
||||
NamespaceChildrenCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Tcl_Namespace *namespacePtr;
|
||||
@@ -3248,7 +3222,7 @@ static int
|
||||
NamespaceCodeCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Tcl_Obj *listPtr, *objPtr;
|
||||
@@ -3265,7 +3239,7 @@ NamespaceCodeCmd(
|
||||
* Take care to only check for scoping in precisely the style that
|
||||
* [::namespace code] generates it. Anything more forgiving can have
|
||||
* the effect of failing in namespaces that contain their own custom
|
||||
" "namespace" command. [Bug 3202171].
|
||||
* "namespace" command. [Bug 3202171].
|
||||
*/
|
||||
|
||||
arg = TclGetStringFromObj(objv[1], &length);
|
||||
@@ -3323,7 +3297,7 @@ static int
|
||||
NamespaceCurrentCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
if (objc != 1) {
|
||||
@@ -3382,12 +3356,12 @@ static int
|
||||
NamespaceDeleteCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Tcl_Namespace *namespacePtr;
|
||||
const char *name;
|
||||
int i;
|
||||
Tcl_Size i;
|
||||
|
||||
if (objc < 1) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "?name name...?");
|
||||
@@ -3459,10 +3433,10 @@ static int
|
||||
NamespaceEvalCmd(
|
||||
void *clientData, /* Arbitrary value passed to cmd. */
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
return Tcl_NRCallObjProc(interp, NRNamespaceEvalCmd, clientData, objc,
|
||||
return Tcl_NRCallObjProc2(interp, NRNamespaceEvalCmd, clientData, objc,
|
||||
objv);
|
||||
}
|
||||
|
||||
@@ -3470,12 +3444,12 @@ static int
|
||||
NRNamespaceEvalCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Interp *iPtr = (Interp *) interp;
|
||||
CmdFrame *invoker;
|
||||
int word;
|
||||
Tcl_Size word;
|
||||
Tcl_Namespace *namespacePtr;
|
||||
CallFrame *framePtr, **framePtrPtr;
|
||||
Tcl_Obj *objPtr;
|
||||
@@ -3602,7 +3576,7 @@ static int
|
||||
NamespaceExistsCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Tcl_Namespace *namespacePtr;
|
||||
@@ -3657,10 +3631,10 @@ static int
|
||||
NamespaceExportCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
int firstArg, i;
|
||||
Tcl_Size firstArg, i;
|
||||
|
||||
if (objc < 1) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "?-clear? ?pattern pattern...?");
|
||||
@@ -3739,11 +3713,12 @@ static int
|
||||
NamespaceForgetCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
const char *pattern;
|
||||
int i, result;
|
||||
Tcl_Size i;
|
||||
int result;
|
||||
|
||||
if (objc < 1) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "?pattern pattern...?");
|
||||
@@ -3804,13 +3779,13 @@ static int
|
||||
NamespaceImportCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
int allowOverwrite = 0;
|
||||
bool allowOverwrite = false;
|
||||
const char *string, *pattern;
|
||||
int i, result;
|
||||
int firstArg;
|
||||
Tcl_Size i, firstArg;
|
||||
int result;
|
||||
|
||||
if (objc < 1) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "?-force? ?pattern pattern...?");
|
||||
@@ -3825,7 +3800,7 @@ NamespaceImportCmd(
|
||||
if (firstArg < objc) {
|
||||
string = TclGetString(objv[firstArg]);
|
||||
if ((*string == '-') && (strcmp(string, "-force") == 0)) {
|
||||
allowOverwrite = 1;
|
||||
allowOverwrite = true;
|
||||
firstArg++;
|
||||
}
|
||||
} else {
|
||||
@@ -3908,10 +3883,10 @@ static int
|
||||
NamespaceInscopeCmd(
|
||||
void *clientData, /* Arbitrary value passed to cmd. */
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
return Tcl_NRCallObjProc(interp, NRNamespaceInscopeCmd, clientData, objc,
|
||||
return Tcl_NRCallObjProc2(interp, NRNamespaceInscopeCmd, clientData, objc,
|
||||
objv);
|
||||
}
|
||||
|
||||
@@ -3919,7 +3894,7 @@ static int
|
||||
NRNamespaceInscopeCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Tcl_Namespace *namespacePtr;
|
||||
@@ -4006,7 +3981,7 @@ static int
|
||||
NamespaceOriginCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Tcl_Command cmd, origCmd;
|
||||
@@ -4067,7 +4042,7 @@ static int
|
||||
NamespaceParentCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Tcl_Namespace *nsPtr;
|
||||
@@ -4124,7 +4099,7 @@ static int
|
||||
NamespacePathCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Namespace *nsPtr = (Namespace *) TclGetCurrentNamespace(interp);
|
||||
@@ -4351,7 +4326,7 @@ static int
|
||||
NamespaceQualifiersCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
const char *name, *p;
|
||||
@@ -4419,7 +4394,7 @@ static int
|
||||
NamespaceUnknownCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Tcl_Namespace *currNsPtr;
|
||||
@@ -4606,7 +4581,7 @@ static int
|
||||
NamespaceTailCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
const char *name, *p;
|
||||
@@ -4664,7 +4639,7 @@ static int
|
||||
NamespaceUpvarCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Interp *iPtr = (Interp *) interp;
|
||||
@@ -4738,7 +4713,7 @@ static int
|
||||
NamespaceWhichCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Size objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
static const char *const opts[] = {
|
||||
@@ -4908,7 +4883,7 @@ SetNsNameFromAny(
|
||||
|
||||
name = TclGetString(objPtr);
|
||||
TclGetNamespaceForQualName(interp, name, NULL, TCL_FIND_ONLY_NS,
|
||||
&nsPtr, &dummy1Ptr, &dummy2Ptr, &dummy);
|
||||
&nsPtr, &dummy1Ptr, &dummy2Ptr, &dummy);
|
||||
|
||||
if ((nsPtr == NULL) || (nsPtr->flags & NS_DYING)) {
|
||||
return TCL_ERROR;
|
||||
@@ -5019,7 +4994,7 @@ TclLogCommandInfo(
|
||||
* the error. */
|
||||
Tcl_Size length, /* Number of bytes in command (< 0 means use
|
||||
* all bytes up to first null byte). */
|
||||
const unsigned char *pc, /* Current pc of bytecode execution context */
|
||||
const unsigned char *pc, /* Current pc of bytecode execution context */
|
||||
Tcl_Obj **tosPtr) /* Current stack of bytecode execution
|
||||
* context */
|
||||
{
|
||||
|
||||
+12
-12
@@ -74,7 +74,7 @@ typedef struct ThreadSpecificData {
|
||||
/* Pointer to first event source in list of
|
||||
* event sources for this thread. */
|
||||
Tcl_ThreadId threadId; /* Thread that owns this notifier instance. */
|
||||
void *clientData; /* Opaque handle for platform specific
|
||||
void *clientData; /* Opaque handle for platform specific
|
||||
* notifier. */
|
||||
struct ThreadSpecificData *nextPtr;
|
||||
/* Next notifier in global list of notifiers.
|
||||
@@ -308,7 +308,7 @@ Tcl_CreateEventSource(
|
||||
Tcl_EventCheckProc *checkProc,
|
||||
/* Function to call after waiting to see what
|
||||
* happened. */
|
||||
void *clientData) /* One-word argument to pass to setupProc and
|
||||
void *clientData) /* One-word argument to pass to setupProc and
|
||||
* checkProc. */
|
||||
{
|
||||
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
|
||||
@@ -347,7 +347,7 @@ Tcl_DeleteEventSource(
|
||||
Tcl_EventCheckProc *checkProc,
|
||||
/* Function to call after waiting to see what
|
||||
* happened. */
|
||||
void *clientData) /* One-word argument to pass to setupProc and
|
||||
void *clientData) /* One-word argument to pass to setupProc and
|
||||
* checkProc. */
|
||||
{
|
||||
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
|
||||
@@ -390,11 +390,11 @@ Tcl_DeleteEventSource(
|
||||
void
|
||||
Tcl_QueueEvent(
|
||||
Tcl_Event *evPtr, /* Event to add to queue. The storage space
|
||||
* must have been allocated the caller with
|
||||
* must have been allocated by the caller with
|
||||
* malloc (Tcl_Alloc), and it becomes the
|
||||
* property of the event queue. It will be
|
||||
* freed after the event has been handled. */
|
||||
int position) /* One of TCL_QUEUE_TAIL, TCL_QUEUE_HEAD, TCL_QUEUE_MARK,
|
||||
int position) /* One of TCL_QUEUE_TAIL, TCL_QUEUE_HEAD, TCL_QUEUE_MARK,
|
||||
* possibly combined with TCL_QUEUE_ALERT_IF_EMPTY. */
|
||||
{
|
||||
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
|
||||
@@ -426,7 +426,7 @@ Tcl_ThreadQueueEvent(
|
||||
* malloc (Tcl_Alloc), and it becomes the
|
||||
* property of the event queue. It will be
|
||||
* freed after the event has been handled. */
|
||||
int position) /* One of TCL_QUEUE_TAIL, TCL_QUEUE_HEAD, TCL_QUEUE_MARK,
|
||||
int position) /* One of TCL_QUEUE_TAIL, TCL_QUEUE_HEAD, TCL_QUEUE_MARK,
|
||||
* possibly combined with TCL_QUEUE_ALERT_IF_EMPTY. */
|
||||
{
|
||||
ThreadSpecificData *tsdPtr;
|
||||
@@ -486,7 +486,7 @@ QueueEvent(
|
||||
* malloc (Tcl_Alloc), and it becomes the
|
||||
* property of the event queue. It will be
|
||||
* freed after the event has been handled. */
|
||||
int position) /* One of TCL_QUEUE_TAIL, TCL_QUEUE_HEAD, TCL_QUEUE_MARK,
|
||||
int position) /* One of TCL_QUEUE_TAIL, TCL_QUEUE_HEAD, TCL_QUEUE_MARK,
|
||||
* possibly combined with TCL_QUEUE_ALERT_IF_EMPTY */
|
||||
{
|
||||
int wasEmpty = 0;
|
||||
@@ -562,7 +562,7 @@ QueueEvent(
|
||||
void
|
||||
Tcl_DeleteEvents(
|
||||
Tcl_EventDeleteProc *proc, /* The function to call. */
|
||||
void *clientData) /* The type-specific data. */
|
||||
void *clientData) /* The type-specific data. */
|
||||
{
|
||||
Tcl_Event *evPtr; /* Pointer to the event being examined */
|
||||
Tcl_Event *prevPtr; /* Pointer to evPtr's predecessor, or NULL if
|
||||
@@ -1270,7 +1270,7 @@ Tcl_FinalizeNotifier(
|
||||
|
||||
void
|
||||
Tcl_AlertNotifier(
|
||||
void *clientData) /* Pointer to thread data. */
|
||||
void *clientData) /* Pointer to thread data. */
|
||||
{
|
||||
if (tclNotifierHooks.alertNotifierProc) {
|
||||
tclNotifierHooks.alertNotifierProc(clientData);
|
||||
@@ -1327,7 +1327,7 @@ Tcl_ServiceModeHook(
|
||||
|
||||
void
|
||||
Tcl_SetTimer(
|
||||
const Tcl_Time *timePtr) /* Timeout value, may be NULL. */
|
||||
const Tcl_Time *timePtr) /* Timeout value, may be NULL. */
|
||||
{
|
||||
if (tclNotifierHooks.setTimerProc) {
|
||||
tclNotifierHooks.setTimerProc(timePtr);
|
||||
@@ -1358,7 +1358,7 @@ Tcl_SetTimer(
|
||||
|
||||
int
|
||||
Tcl_WaitForEvent(
|
||||
const Tcl_Time *timePtr) /* Maximum block time, or NULL. */
|
||||
const Tcl_Time *timePtr) /* Maximum block time, or NULL. */
|
||||
{
|
||||
if (tclNotifierHooks.waitForEventProc) {
|
||||
return tclNotifierHooks.waitForEventProc(timePtr);
|
||||
@@ -1397,7 +1397,7 @@ Tcl_CreateFileHandler(
|
||||
* called. */
|
||||
Tcl_FileProc *proc, /* Function to call for each selected
|
||||
* event. */
|
||||
void *clientData) /* Arbitrary data to pass to proc. */
|
||||
void *clientData) /* Arbitrary data to pass to proc. */
|
||||
{
|
||||
if (tclNotifierHooks.createFileHandlerProc) {
|
||||
tclNotifierHooks.createFileHandlerProc(fd, mask, proc, clientData);
|
||||
|
||||
+129
-165
@@ -22,24 +22,25 @@
|
||||
|
||||
static const struct StdCommands {
|
||||
const char *name;
|
||||
Tcl_ObjCmdProc *objProc;
|
||||
Tcl_ObjCmdProc *nreProc;
|
||||
Tcl_ObjCmdProc2 *objProc;
|
||||
Tcl_ObjCmdProc2 *nreProc;
|
||||
CompileProc *compileProc;
|
||||
int flags;
|
||||
} ooCmds[] = {
|
||||
{"define", TclOODefineObjCmd, NULL, NULL},
|
||||
{"objdefine", TclOOObjDefObjCmd, NULL, NULL},
|
||||
{"copy", TclOOCopyObjectCmd, NULL, NULL},
|
||||
{"DelegateName", TclOODelegateNameObjCmd, NULL, NULL},
|
||||
{NULL, NULL, NULL, NULL}
|
||||
{"define", TclOODefineObjCmd, NULL, NULL, 0},
|
||||
{"objdefine", TclOOObjDefObjCmd, NULL, NULL, 0},
|
||||
{"copy", TclOOCopyObjectCmd, NULL, NULL, 0},
|
||||
{"DelegateName", TclOODelegateNameObjCmd, NULL, NULL, 0},
|
||||
{NULL, NULL, NULL, NULL, 0}
|
||||
}, helpCmds[] = {
|
||||
{"callback", TclOOCallbackObjCmd, NULL, NULL},
|
||||
{"mymethod", TclOOCallbackObjCmd, NULL, NULL},
|
||||
{"classvariable", TclOOClassVariableObjCmd, NULL, NULL},
|
||||
{"link", TclOOLinkObjCmd, NULL, NULL},
|
||||
{"next", NULL, TclOONextObjCmd, TclCompileObjectNextCmd},
|
||||
{"nextto", NULL, TclOONextToObjCmd, TclCompileObjectNextToCmd},
|
||||
{"self", TclOOSelfObjCmd, NULL, TclCompileObjectSelfCmd},
|
||||
{NULL, NULL, NULL, NULL}
|
||||
{"callback", TclOOCallbackObjCmd, NULL, NULL, 0},
|
||||
{"mymethod", TclOOCallbackObjCmd, NULL, NULL, 0},
|
||||
{"classvariable", TclOOClassVariableObjCmd, NULL, NULL, 0},
|
||||
{"link", TclOOLinkObjCmd, NULL, NULL, 0},
|
||||
{"next", NULL, TclOONextObjCmd, TclCompileObjectNextCmd, CMD_COMPILES_EXPANDED},
|
||||
{"nextto", NULL, TclOONextToObjCmd, TclCompileObjectNextToCmd, CMD_COMPILES_EXPANDED},
|
||||
{"self", TclOOSelfObjCmd, NULL, TclCompileObjectSelfCmd, 0},
|
||||
{NULL, NULL, NULL, NULL, 0}
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -48,7 +49,7 @@ static const struct StdCommands {
|
||||
|
||||
static const struct DefineCommands {
|
||||
const char *name;
|
||||
Tcl_ObjCmdProc *objProc;
|
||||
Tcl_ObjCmdProc2 *objProc;
|
||||
int flag;
|
||||
} defineCmds[] = {
|
||||
{"classmethod", TclOODefineClassMethodObjCmd, 0},
|
||||
@@ -115,9 +116,9 @@ 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 Tcl_ObjCmdProc PublicNRObjectCmd;
|
||||
static Tcl_ObjCmdProc PrivateNRObjectCmd;
|
||||
static Tcl_ObjCmdProc MyClassNRObjCmd;
|
||||
static Tcl_ObjCmdProc2 PublicNRObjectCmd;
|
||||
static Tcl_ObjCmdProc2 PrivateNRObjectCmd;
|
||||
static Tcl_ObjCmdProc2 MyClassNRObjCmd;
|
||||
static Tcl_CmdDeleteProc MyClassDeleted;
|
||||
|
||||
/*
|
||||
@@ -130,40 +131,40 @@ static Tcl_CmdDeleteProc MyClassDeleted;
|
||||
|
||||
#define DCM(name,visibility,proc) \
|
||||
{name,visibility,\
|
||||
{TCL_OO_METHOD_VERSION_CURRENT,"core method: "#name,proc,NULL,NULL}}
|
||||
{TCL_OO_METHOD_VERSION_2,"core method: "#name,proc,NULL,NULL}}
|
||||
|
||||
static const DeclaredClassMethod objMethods[] = {
|
||||
DCM("<cloned>", 0, TclOO_Object_Cloned),
|
||||
DCM("destroy", 1, TclOO_Object_Destroy),
|
||||
DCM("eval", 0, TclOO_Object_Eval),
|
||||
DCM("unknown", 0, TclOO_Object_Unknown),
|
||||
DCM("variable", 0, TclOO_Object_LinkVar),
|
||||
DCM("varname", 0, TclOO_Object_VarName),
|
||||
{NULL, 0, {0, NULL, NULL, NULL, NULL}}
|
||||
DCM("<cloned>", false, TclOO_Object_Cloned),
|
||||
DCM("destroy", true, TclOO_Object_Destroy),
|
||||
DCM("eval", false, TclOO_Object_Eval),
|
||||
DCM("unknown", false, TclOO_Object_Unknown),
|
||||
DCM("variable", false, TclOO_Object_LinkVar),
|
||||
DCM("varname", false, TclOO_Object_VarName),
|
||||
{NULL, false, {0, NULL, NULL, NULL, NULL}}
|
||||
}, clsMethods[] = {
|
||||
DCM("<cloned>", 0, TclOO_Class_Cloned),
|
||||
DCM("create", 1, TclOO_Class_Create),
|
||||
DCM("new", 1, TclOO_Class_New),
|
||||
DCM("createWithNamespace", 0, TclOO_Class_CreateNs),
|
||||
{NULL, 0, {0, NULL, NULL, NULL, NULL}}
|
||||
DCM("<cloned>", false, TclOO_Class_Cloned),
|
||||
DCM("create", true, TclOO_Class_Create),
|
||||
DCM("new", true, TclOO_Class_New),
|
||||
DCM("createWithNamespace", false, TclOO_Class_CreateNs),
|
||||
{NULL, false, {0, NULL, NULL, NULL, NULL}}
|
||||
}, cfgMethods[] = {
|
||||
DCM("configure", 1, TclOO_Configurable_Configure),
|
||||
{NULL, 0, {0, NULL, NULL, NULL, NULL}}
|
||||
DCM("configure", true, TclOO_Configurable_Configure),
|
||||
{NULL, false, {0, NULL, NULL, NULL, NULL}}
|
||||
}, singletonMethods[] = {
|
||||
DCM("new", 1, TclOO_Singleton_New),
|
||||
{NULL, 0, {0, NULL, NULL, NULL, NULL}}
|
||||
DCM("new", true, TclOO_Singleton_New),
|
||||
{NULL, false, {0, NULL, NULL, NULL, NULL}}
|
||||
}, singletonInstanceMethods[] = {
|
||||
DCM("<cloned>", 0, TclOO_SingletonInstance_Cloned),
|
||||
DCM("destroy", 1, TclOO_SingletonInstance_Destroy),
|
||||
{NULL, 0, {0, NULL, NULL, NULL, NULL}}
|
||||
DCM("<cloned>", false, TclOO_SingletonInstance_Cloned),
|
||||
DCM("destroy", true, TclOO_SingletonInstance_Destroy),
|
||||
{NULL, false, {0, NULL, NULL, NULL, NULL}}
|
||||
};
|
||||
|
||||
/*
|
||||
* And for the oo::class constructor...
|
||||
*/
|
||||
|
||||
static const Tcl_MethodType classConstructor = {
|
||||
TCL_OO_METHOD_VERSION_CURRENT,
|
||||
static const Tcl_MethodType2 classConstructor = {
|
||||
TCL_OO_METHOD_VERSION_2,
|
||||
"oo::class constructor",
|
||||
TclOO_Class_Constructor, NULL, NULL
|
||||
};
|
||||
@@ -172,8 +173,8 @@ static const Tcl_MethodType classConstructor = {
|
||||
* And the oo::configurable constructor...
|
||||
*/
|
||||
|
||||
static const Tcl_MethodType configurableConstructor = {
|
||||
TCL_OO_METHOD_VERSION_CURRENT,
|
||||
static const Tcl_MethodType2 configurableConstructor = {
|
||||
TCL_OO_METHOD_VERSION_2,
|
||||
"oo::configurable constructor",
|
||||
TclOO_Configurable_Constructor, NULL, NULL
|
||||
};
|
||||
@@ -338,9 +339,10 @@ CreateCmdInNS(
|
||||
Tcl_Interp *interp,
|
||||
Tcl_Namespace *namespacePtr,
|
||||
const char *name,
|
||||
Tcl_ObjCmdProc *cmdProc,
|
||||
Tcl_ObjCmdProc *nreProc,
|
||||
CompileProc *compileProc)
|
||||
Tcl_ObjCmdProc2 *cmdProc,
|
||||
Tcl_ObjCmdProc2 *nreProc,
|
||||
CompileProc *compileProc,
|
||||
int flags)
|
||||
{
|
||||
Command *cmdPtr;
|
||||
|
||||
@@ -349,8 +351,9 @@ CreateCmdInNS(
|
||||
}
|
||||
cmdPtr = (Command *) TclCreateObjCommandInNs(interp, name,
|
||||
namespacePtr, cmdProc, NULL, NULL);
|
||||
cmdPtr->nreProc = nreProc;
|
||||
cmdPtr->nreProc2 = nreProc;
|
||||
cmdPtr->compileProc = compileProc;
|
||||
cmdPtr->flags |= flags;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -366,9 +369,9 @@ CreateCmdInNS(
|
||||
static inline void
|
||||
CreateConstantInNSStr(
|
||||
Tcl_Interp *interp,
|
||||
Tcl_Namespace *namespacePtr,/* The namespace to contain the constant. */
|
||||
const char *nameStr, /* The unqualified name of the constant. */
|
||||
const char *valueStr) /* The value to put in the constant. */
|
||||
Tcl_Namespace *namespacePtr,// The namespace to contain the constant.
|
||||
const char *nameStr, // The unqualified name of the constant.
|
||||
const char *valueStr) // The value to put in the constant.
|
||||
{
|
||||
Tcl_Obj *nameObj = Tcl_NewStringObj(nameStr, TCL_AUTO_LENGTH);
|
||||
Tcl_IncrRefCount(nameObj);
|
||||
@@ -486,7 +489,7 @@ InitFoundation(
|
||||
|
||||
TclNewLiteralStringObj(namePtr, "new");
|
||||
TclNewInstanceMethod(interp, (Tcl_Object) fPtr->classCls->thisPtr,
|
||||
namePtr /* keeps ref */, 0 /* private */, NULL, NULL);
|
||||
namePtr /*keeps ref*/, 0 /*private*/, NULL, NULL);
|
||||
Tcl_BounceRefCount(namePtr);
|
||||
fPtr->classCls->constructorPtr = (Method *) TclNewMethod(
|
||||
(Tcl_Class) fPtr->classCls, NULL, 0, &classConstructor, NULL);
|
||||
@@ -499,12 +502,12 @@ InitFoundation(
|
||||
for (i = 0 ; helpCmds[i].name ; i++) {
|
||||
CreateCmdInNS(interp, fPtr->helpersNs, helpCmds[i].name,
|
||||
helpCmds[i].objProc, helpCmds[i].nreProc,
|
||||
helpCmds[i].compileProc);
|
||||
helpCmds[i].compileProc, helpCmds[i].flags);
|
||||
}
|
||||
for (i = 0 ; ooCmds[i].name ; i++) {
|
||||
CreateCmdInNS(interp, fPtr->ooNs, ooCmds[i].name,
|
||||
ooCmds[i].objProc, ooCmds[i].nreProc,
|
||||
ooCmds[i].compileProc);
|
||||
ooCmds[i].compileProc, ooCmds[i].flags);
|
||||
}
|
||||
|
||||
TclOOInitInfo(interp);
|
||||
@@ -652,62 +655,43 @@ MakeAdditionalClasses(
|
||||
Tcl_Namespace *objDefineNs)
|
||||
{
|
||||
Tcl_Interp *interp = fPtr->interp;
|
||||
Object *singletonObj; /* A metaclass that is used to make classes
|
||||
* that only permit one instance of them to
|
||||
* exist. See singleton(n). */
|
||||
Object *singletonInst; /* A mixin used to make an object so it won't
|
||||
* be destroyed or cloned (or at least not
|
||||
* easily). */
|
||||
Object *abstractCls; /* A metaclass that is used to make classes
|
||||
* that can't be directly instantiated. See
|
||||
* abstract(n). */
|
||||
Object *cfgSupObj; /* The class that contains the implementation
|
||||
* of the actual 'configure' method (mixed into
|
||||
* actually configurable classes). The
|
||||
* 'configure' method is in tclOOBasic.c. */
|
||||
Object *configurableObj; /* A metaclass that is used to make classes
|
||||
* that can be configured in their creation
|
||||
* phase (and later too). All the metaclass
|
||||
* itself does is arrange for the class created
|
||||
* to have a 'configure' method and for
|
||||
* oo::define and oo::objdefine (on the class
|
||||
* and its instances) to have a property
|
||||
* definition for setting things up for
|
||||
* 'configure'. */
|
||||
Class *singletonCls, *cfgSupCls, *configurableCls;
|
||||
Tcl_Namespace *cfgObjNs, *cfgClsNs;
|
||||
Tcl_Obj *nsName;
|
||||
|
||||
/*
|
||||
* Make the oo::singleton class, the SingletonInstance class, and install
|
||||
* their standard defined methods.
|
||||
* Make the singleton class, the SingletonInstance class, and install their
|
||||
* standard defined methods.
|
||||
*/
|
||||
|
||||
singletonObj = (Object *) Tcl_NewObjectInstance(interp,
|
||||
// A metaclass that is used to make classes that only permit one instance
|
||||
// of them to exist. See singleton(n).
|
||||
Object *singletonObj = (Object *) Tcl_NewObjectInstance(interp,
|
||||
(Tcl_Class) fPtr->classCls, "::oo::singleton",
|
||||
NULL, TCL_INDEX_NONE, NULL, 0);
|
||||
singletonCls = singletonObj->classPtr;
|
||||
Class *singletonCls = singletonObj->classPtr;
|
||||
TclOODefineBasicMethods(singletonCls, singletonMethods);
|
||||
/* Set the superclass to oo::class */
|
||||
// Set the superclass to oo::class
|
||||
MarkAsMetaclass(fPtr, singletonCls);
|
||||
/* Unexport methods */
|
||||
// Unexport methods
|
||||
TclOOUnexportMethods(singletonCls, "create", "createWithNamespace", NULL);
|
||||
|
||||
singletonInst = (Object *) Tcl_NewObjectInstance(interp,
|
||||
// A mixin used to make an object so it won't be destroyed or cloned (or
|
||||
// at least not easily).
|
||||
Object *singletonInst = (Object *) Tcl_NewObjectInstance(interp,
|
||||
(Tcl_Class) fPtr->classCls, "::oo::SingletonInstance",
|
||||
NULL, TCL_INDEX_NONE, NULL, 0);
|
||||
TclOODefineBasicMethods(singletonInst->classPtr, singletonInstanceMethods);
|
||||
|
||||
/*
|
||||
* Make the oo::abstract class.
|
||||
* Make the abstract class.
|
||||
*/
|
||||
|
||||
abstractCls = (Object *) Tcl_NewObjectInstance(interp,
|
||||
// A metaclass that is used to make classes that can't be directly
|
||||
// instantiated. See abstract(n).
|
||||
Object *abstractCls = (Object *) Tcl_NewObjectInstance(interp,
|
||||
(Tcl_Class) fPtr->classCls, "::oo::abstract",
|
||||
NULL, TCL_INDEX_NONE, NULL, 0);
|
||||
/* Set the superclass to oo::class */
|
||||
// Set the superclass to oo::class
|
||||
MarkAsMetaclass(fPtr, abstractCls->classPtr);
|
||||
/* Unexport methods */
|
||||
// Unexport methods
|
||||
TclOOUnexportMethods(abstractCls->classPtr,
|
||||
"create", "createWithNamespace", "new", NULL);
|
||||
|
||||
@@ -715,18 +699,21 @@ MakeAdditionalClasses(
|
||||
* Make the configurable class and install its standard defined method.
|
||||
*/
|
||||
|
||||
cfgSupObj = (Object *) Tcl_NewObjectInstance(interp,
|
||||
// The class that contains the implementation of the actual
|
||||
// 'configure' method (mixed into actually configurable classes).
|
||||
// The 'configure' method is in tclOOBasic.c.
|
||||
Object *cfgSupObj = (Object *) Tcl_NewObjectInstance(interp,
|
||||
(Tcl_Class) fPtr->classCls, "::oo::configuresupport::configurable",
|
||||
NULL, TCL_INDEX_NONE, NULL, 0);
|
||||
cfgSupCls = cfgSupObj->classPtr;
|
||||
Class *cfgSupCls = cfgSupObj->classPtr;
|
||||
TclOODefineBasicMethods(cfgSupCls, cfgMethods);
|
||||
|
||||
/* Namespaces used as implementation vectors for oo::define and
|
||||
* oo::objdefine when the class/instance is configurable.
|
||||
* Note that these also contain commands implemented in C,
|
||||
* especially the [property] definition command. */
|
||||
// Namespaces used as implementation vectors for oo::define and
|
||||
// oo::objdefine when the class/instance is configurable.
|
||||
// Note that these also contain commands implemented in C,
|
||||
// especially the [property] definition command.
|
||||
|
||||
cfgObjNs = Tcl_CreateNamespace(interp,
|
||||
Tcl_Namespace *cfgObjNs = Tcl_CreateNamespace(interp,
|
||||
"::oo::configuresupport::configurableobject", NULL, NULL);
|
||||
TclCreateObjCommandInNs(interp, "property", cfgObjNs,
|
||||
TclOODefinePropertyCmd, INT2PTR(1) /*useInstance*/, NULL);
|
||||
@@ -735,7 +722,7 @@ MakeAdditionalClasses(
|
||||
Tcl_Export(interp, cfgObjNs, "property", /*reset*/1);
|
||||
TclSetNsPath((Namespace *) cfgObjNs, 1, &objDefineNs);
|
||||
|
||||
cfgClsNs = Tcl_CreateNamespace(interp,
|
||||
Tcl_Namespace *cfgClsNs = Tcl_CreateNamespace(interp,
|
||||
"::oo::configuresupport::configurableclass", NULL, NULL);
|
||||
TclCreateObjCommandInNs(interp, "property", cfgClsNs,
|
||||
TclOODefinePropertyCmd, INT2PTR(0) /*useInstance*/, NULL);
|
||||
@@ -744,21 +731,21 @@ MakeAdditionalClasses(
|
||||
Tcl_Export(interp, cfgClsNs, "property", /*reset*/1);
|
||||
TclSetNsPath((Namespace *) cfgClsNs, 1, &defineNs);
|
||||
|
||||
/* The oo::configurable class itself, a metaclass to apply
|
||||
* oo::configuresupport::configurable correctly. */
|
||||
|
||||
configurableObj = (Object *) Tcl_NewObjectInstance(interp,
|
||||
// A metaclass that is used to make classes that can be configured in
|
||||
// their creation phase (and later too). All the metaclass itself does is
|
||||
// arrange for the class created to have a 'configure' method and for
|
||||
// oo::define and oo::objdefine (on the class and its instances) to have
|
||||
// a property definition for setting things up for 'configure'.
|
||||
Object *configurableObj = (Object *) Tcl_NewObjectInstance(interp,
|
||||
(Tcl_Class) fPtr->classCls, "::oo::configurable",
|
||||
NULL, TCL_INDEX_NONE, NULL, 0);
|
||||
configurableCls = configurableObj->classPtr;
|
||||
Class *configurableCls = configurableObj->classPtr;
|
||||
MarkAsMetaclass(fPtr, configurableCls);
|
||||
Tcl_ClassSetConstructor(interp, (Tcl_Class) configurableCls, TclNewMethod(
|
||||
(Tcl_Class) configurableCls, NULL, 0, &configurableConstructor, NULL));
|
||||
|
||||
/* Set the definition namespaces of oo::configurable and
|
||||
* oo::configuresupport::configurable. */
|
||||
|
||||
nsName = TclNewNamespaceObj(cfgClsNs);
|
||||
Tcl_Obj *nsName = Tcl_NewStringObj("::oo::configuresupport::configurableclass",
|
||||
TCL_AUTO_LENGTH);
|
||||
Tcl_IncrRefCount(nsName);
|
||||
if (cfgSupCls->clsDefinitionNs != NULL) {
|
||||
Tcl_DecrRefCount(cfgSupCls->clsDefinitionNs);
|
||||
@@ -770,7 +757,8 @@ MakeAdditionalClasses(
|
||||
}
|
||||
configurableCls->clsDefinitionNs = nsName;
|
||||
|
||||
nsName = TclNewNamespaceObj(cfgObjNs);
|
||||
nsName = Tcl_NewStringObj("::oo::configuresupport::configurableobject",
|
||||
TCL_AUTO_LENGTH);
|
||||
Tcl_IncrRefCount(nsName);
|
||||
if (cfgSupCls->objDefinitionNs != NULL) {
|
||||
Tcl_DecrRefCount(cfgSupCls->objDefinitionNs);
|
||||
@@ -996,7 +984,7 @@ AllocObject(
|
||||
*/
|
||||
|
||||
cmdPtr = (Command *) oPtr->command;
|
||||
cmdPtr->nreProc = PublicNRObjectCmd;
|
||||
cmdPtr->nreProc2 = PublicNRObjectCmd;
|
||||
cmdPtr->tracePtr = tracePtr = (CommandTrace *)
|
||||
Tcl_Alloc(sizeof(CommandTrace));
|
||||
tracePtr->traceProc = ObjectRenamedTrace;
|
||||
@@ -1054,13 +1042,13 @@ MyDeleted(
|
||||
* squelched. */
|
||||
{
|
||||
Object *oPtr = (Object *) clientData;
|
||||
Tcl_Size linkc, i;
|
||||
Tcl_Obj **linkv, *link;
|
||||
|
||||
if (oPtr->linkedCmdsList) {
|
||||
Tcl_Size linkc, i;
|
||||
Tcl_Obj **linkv;
|
||||
TclListObjGetElements(NULL, oPtr->linkedCmdsList, &linkc, &linkv);
|
||||
for (i=0 ; i<linkc ; i++) {
|
||||
link = linkv[i];
|
||||
Tcl_Obj *link = linkv[i];
|
||||
(void) Tcl_DeleteCommand(oPtr->fPtr->interp, TclGetString(link));
|
||||
}
|
||||
Tcl_DecrRefCount(oPtr->linkedCmdsList);
|
||||
@@ -1449,7 +1437,7 @@ ObjectNamespaceDeleted(
|
||||
contextPtr->callPtr->flags |= DESTRUCTOR;
|
||||
contextPtr->skip = 0;
|
||||
state = Tcl_SaveInterpState(interp, TCL_OK);
|
||||
result = Tcl_NRCallObjProc(interp, TclOOInvokeContext,
|
||||
result = Tcl_NRCallObjProc2(interp, TclOOInvokeContext,
|
||||
contextPtr, 0, NULL);
|
||||
if (result != TCL_OK) {
|
||||
Tcl_BackgroundException(interp, result);
|
||||
@@ -1613,7 +1601,6 @@ TclOODecrRefCount(
|
||||
Object *oPtr)
|
||||
{
|
||||
if (oPtr->refCount-- <= 1) {
|
||||
|
||||
if (oPtr->classPtr != NULL) {
|
||||
Tcl_Free(oPtr->classPtr);
|
||||
}
|
||||
@@ -2005,7 +1992,7 @@ Tcl_NewObjectInstance(
|
||||
*/
|
||||
|
||||
isRoot = TclInitRewriteEnsemble(interp, skip, skip, objv);
|
||||
result = Tcl_NRCallObjProc(interp, TclOOInvokeContext, contextPtr,
|
||||
result = Tcl_NRCallObjProc2(interp, TclOOInvokeContext, contextPtr,
|
||||
objc, objv);
|
||||
|
||||
if (isRoot) {
|
||||
@@ -2538,7 +2525,7 @@ Tcl_CopyObjectInstance(
|
||||
Tcl_IncrRefCount(args[0]);
|
||||
Tcl_IncrRefCount(args[1]);
|
||||
Tcl_IncrRefCount(args[2]);
|
||||
result = Tcl_NRCallObjProc(interp, TclOOInvokeContext, contextPtr, 3,
|
||||
result = Tcl_NRCallObjProc2(interp, TclOOInvokeContext, contextPtr, 3,
|
||||
args);
|
||||
TclDecrRefCount(args[0]);
|
||||
TclDecrRefCount(args[1]);
|
||||
@@ -2576,21 +2563,21 @@ CloneObjectMethod(
|
||||
Method *mPtr,
|
||||
Tcl_Obj *namePtr)
|
||||
{
|
||||
if (mPtr->typePtr == NULL) {
|
||||
if (mPtr->type2Ptr == NULL) {
|
||||
TclNewInstanceMethod(interp, (Tcl_Object) oPtr, namePtr,
|
||||
mPtr->flags & PUBLIC_METHOD, NULL, NULL);
|
||||
} else if (mPtr->typePtr->cloneProc) {
|
||||
} else if (mPtr->type2Ptr->cloneProc) {
|
||||
void *newClientData;
|
||||
|
||||
if (mPtr->typePtr->cloneProc(interp, mPtr->clientData,
|
||||
if (mPtr->type2Ptr->cloneProc(interp, mPtr->clientData,
|
||||
&newClientData) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
TclNewInstanceMethod(interp, (Tcl_Object) oPtr, namePtr,
|
||||
mPtr->flags & PUBLIC_METHOD, mPtr->typePtr, newClientData);
|
||||
mPtr->flags & PUBLIC_METHOD, mPtr->type2Ptr, newClientData);
|
||||
} else {
|
||||
TclNewInstanceMethod(interp, (Tcl_Object) oPtr, namePtr,
|
||||
mPtr->flags & PUBLIC_METHOD, mPtr->typePtr, mPtr->clientData);
|
||||
mPtr->flags & PUBLIC_METHOD, mPtr->type2Ptr, mPtr->clientData);
|
||||
}
|
||||
return TCL_OK;
|
||||
}
|
||||
@@ -2605,22 +2592,22 @@ CloneClassMethod(
|
||||
{
|
||||
Method *m2Ptr;
|
||||
|
||||
if (mPtr->typePtr == NULL) {
|
||||
if (mPtr->type2Ptr == NULL) {
|
||||
m2Ptr = (Method *) TclNewMethod((Tcl_Class) clsPtr,
|
||||
namePtr, mPtr->flags & PUBLIC_METHOD, NULL, NULL);
|
||||
} else if (mPtr->typePtr->cloneProc) {
|
||||
} else if (mPtr->type2Ptr->cloneProc) {
|
||||
void *newClientData;
|
||||
|
||||
if (mPtr->typePtr->cloneProc(interp, mPtr->clientData,
|
||||
if (mPtr->type2Ptr->cloneProc(interp, mPtr->clientData,
|
||||
&newClientData) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
m2Ptr = (Method *) TclNewMethod((Tcl_Class) clsPtr,
|
||||
namePtr, mPtr->flags & PUBLIC_METHOD, mPtr->typePtr,
|
||||
namePtr, mPtr->flags & PUBLIC_METHOD, mPtr->type2Ptr,
|
||||
newClientData);
|
||||
} else {
|
||||
m2Ptr = (Method *) TclNewMethod((Tcl_Class) clsPtr,
|
||||
namePtr, mPtr->flags & PUBLIC_METHOD, mPtr->typePtr,
|
||||
namePtr, mPtr->flags & PUBLIC_METHOD, mPtr->type2Ptr,
|
||||
mPtr->clientData);
|
||||
}
|
||||
if (m2PtrPtr != NULL) {
|
||||
@@ -2833,17 +2820,17 @@ int
|
||||
TclOOPublicObjectCmd(
|
||||
void *clientData,
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const *objv)
|
||||
{
|
||||
return Tcl_NRCallObjProc(interp, PublicNRObjectCmd, clientData, objc, objv);
|
||||
return Tcl_NRCallObjProc2(interp, PublicNRObjectCmd, clientData, objc, objv);
|
||||
}
|
||||
|
||||
static int
|
||||
PublicNRObjectCmd(
|
||||
void *clientData,
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const *objv)
|
||||
{
|
||||
return TclOOObjectCmdCore((Object *) clientData, interp, objc, objv,
|
||||
@@ -2854,17 +2841,17 @@ int
|
||||
TclOOPrivateObjectCmd(
|
||||
void *clientData,
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const *objv)
|
||||
{
|
||||
return Tcl_NRCallObjProc(interp, PrivateNRObjectCmd, clientData, objc, objv);
|
||||
return Tcl_NRCallObjProc2(interp, PrivateNRObjectCmd, clientData, objc, objv);
|
||||
}
|
||||
|
||||
static int
|
||||
PrivateNRObjectCmd(
|
||||
void *clientData,
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const *objv)
|
||||
{
|
||||
return TclOOObjectCmdCore((Object *) clientData, interp, objc, objv, 0, NULL);
|
||||
@@ -2915,17 +2902,17 @@ int
|
||||
TclOOMyClassObjCmd(
|
||||
void *clientData,
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const *objv)
|
||||
{
|
||||
return Tcl_NRCallObjProc(interp, MyClassNRObjCmd, clientData, objc, objv);
|
||||
return Tcl_NRCallObjProc2(interp, MyClassNRObjCmd, clientData, objc, objv);
|
||||
}
|
||||
|
||||
static int
|
||||
MyClassNRObjCmd(
|
||||
void *clientData,
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Size objc,
|
||||
Tcl_Obj *const *objv)
|
||||
{
|
||||
Object *oPtr = (Object *) clientData;
|
||||
@@ -3132,7 +3119,6 @@ Tcl_ObjectContextInvokeNext(
|
||||
CallContext *contextPtr = (CallContext *) context;
|
||||
size_t savedIndex = contextPtr->index;
|
||||
size_t savedSkip = contextPtr->skip;
|
||||
int result;
|
||||
|
||||
if (contextPtr->index + 1 >= contextPtr->callPtr->numChain) {
|
||||
/*
|
||||
@@ -3142,22 +3128,11 @@ Tcl_ObjectContextInvokeNext(
|
||||
* unexpectedly.
|
||||
*/
|
||||
|
||||
const char *methodType;
|
||||
|
||||
if (Tcl_InterpDeleted(interp)) {
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
if (contextPtr->callPtr->flags & CONSTRUCTOR) {
|
||||
methodType = "constructor";
|
||||
} else if (contextPtr->callPtr->flags & DESTRUCTOR) {
|
||||
methodType = "destructor";
|
||||
} else {
|
||||
methodType = "method";
|
||||
}
|
||||
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"no next %s implementation", methodType));
|
||||
"no next %s implementation", TclOOContextTypeName(contextPtr)));
|
||||
OO_ERROR(interp, NOTHING_NEXT);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -3179,8 +3154,8 @@ Tcl_ObjectContextInvokeNext(
|
||||
* Invoke the (advanced) method call context in the caller context.
|
||||
*/
|
||||
|
||||
result = Tcl_NRCallObjProc(interp, TclOOInvokeContext, contextPtr, objc,
|
||||
objv);
|
||||
int result = Tcl_NRCallObjProc2(interp, TclOOInvokeContext, contextPtr,
|
||||
objc, objv);
|
||||
|
||||
/*
|
||||
* Restore the call chain context index as we've finished the inner invoke
|
||||
@@ -3211,22 +3186,11 @@ TclNRObjectContextInvokeNext(
|
||||
* unexpectedly.
|
||||
*/
|
||||
|
||||
const char *methodType;
|
||||
|
||||
if (Tcl_InterpDeleted(interp)) {
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
if (contextPtr->callPtr->flags & CONSTRUCTOR) {
|
||||
methodType = "constructor";
|
||||
} else if (contextPtr->callPtr->flags & DESTRUCTOR) {
|
||||
methodType = "destructor";
|
||||
} else {
|
||||
methodType = "method";
|
||||
}
|
||||
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"no next %s implementation", methodType));
|
||||
"no next %s implementation", TclOOContextTypeName(contextPtr)));
|
||||
OO_ERROR(interp, NOTHING_NEXT);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -3294,13 +3258,13 @@ Tcl_GetObjectFromObj(
|
||||
if (cmdPtr == NULL) {
|
||||
goto notAnObject;
|
||||
}
|
||||
if (cmdPtr->objProc != TclOOPublicObjectCmd) {
|
||||
if (cmdPtr->objProc2 != TclOOPublicObjectCmd) {
|
||||
cmdPtr = (Command *) TclGetOriginalCommand((Tcl_Command) cmdPtr);
|
||||
if (cmdPtr == NULL || cmdPtr->objProc != TclOOPublicObjectCmd) {
|
||||
if (cmdPtr == NULL || cmdPtr->objProc2 != TclOOPublicObjectCmd) {
|
||||
goto notAnObject;
|
||||
}
|
||||
}
|
||||
return (Tcl_Object) cmdPtr->objClientData;
|
||||
return (Tcl_Object) cmdPtr->objClientData2;
|
||||
|
||||
notAnObject:
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
@@ -3403,10 +3367,10 @@ TclOOObjectMyName(
|
||||
Tcl_Interp *interp,
|
||||
Object *oPtr)
|
||||
{
|
||||
Tcl_Obj *namePtr;
|
||||
if (!oPtr->myCommand) {
|
||||
return NULL;
|
||||
}
|
||||
Tcl_Obj *namePtr;
|
||||
TclNewObj(namePtr);
|
||||
Tcl_GetCommandFullName(interp, oPtr->myCommand, namePtr);
|
||||
return namePtr;
|
||||
|
||||
+7
-8
@@ -61,12 +61,12 @@ typedef struct Tcl_ObjectContext_ *Tcl_ObjectContext;
|
||||
* and to allow the attachment of arbitrary data to objects and classes.
|
||||
*/
|
||||
|
||||
#ifndef TCL_NO_DEPRECATED
|
||||
typedef int (Tcl_MethodCallProc)(void *clientData, Tcl_Interp *interp,
|
||||
Tcl_ObjectContext objectContext, int objc, Tcl_Obj *const *objv);
|
||||
#if TCL_MAJOR_VERSION > 8
|
||||
#endif /* TCL_NO_DEPRECATED */
|
||||
typedef int (Tcl_MethodCallProc2)(void *clientData, Tcl_Interp *interp,
|
||||
Tcl_ObjectContext objectContext, Tcl_Size objc, Tcl_Obj *const *objv);
|
||||
#endif
|
||||
typedef void (Tcl_MethodDeleteProc)(void *clientData);
|
||||
typedef int (Tcl_CloneProc)(Tcl_Interp *interp, void *oldClientData,
|
||||
void **newClientData);
|
||||
@@ -80,6 +80,7 @@ typedef int (Tcl_ObjectMapMethodNameProc)(Tcl_Interp *interp,
|
||||
* how to create a clone of it (when the object or class is copied).
|
||||
*/
|
||||
|
||||
#ifndef TCL_NO_DEPRECATED
|
||||
typedef struct Tcl_MethodType {
|
||||
int version; /* Structure version field. Always to be equal
|
||||
* to TCL_OO_METHOD_VERSION_(1|CURRENT) in
|
||||
@@ -96,8 +97,8 @@ typedef struct Tcl_MethodType {
|
||||
* data, or NULL if the type-specific data can
|
||||
* be copied directly. */
|
||||
} Tcl_MethodType;
|
||||
#endif /* TCL_NO_DEPRECATED */
|
||||
|
||||
#if TCL_MAJOR_VERSION > 8
|
||||
typedef struct Tcl_MethodType2 {
|
||||
int version; /* Structure version field. Always to be equal
|
||||
* to TCL_OO_METHOD_VERSION_2 in
|
||||
@@ -114,7 +115,6 @@ typedef struct Tcl_MethodType2 {
|
||||
* data, or NULL if the type-specific data can
|
||||
* be copied directly. */
|
||||
} Tcl_MethodType2;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The correct value for the version field of the Tcl_MethodType structure.
|
||||
@@ -122,12 +122,11 @@ typedef struct Tcl_MethodType2 {
|
||||
* binary compatibility.
|
||||
*/
|
||||
enum TclOOMethodVersion {
|
||||
TCL_OO_METHOD_VERSION_CURRENT = 1
|
||||
#if TCL_MAJOR_VERSION > 8
|
||||
,
|
||||
#ifndef TCL_NO_DEPRECATED
|
||||
TCL_OO_METHOD_VERSION_CURRENT = 1,
|
||||
TCL_OO_METHOD_VERSION_1 = 1,
|
||||
#endif /* TCL_NO_DEPRECATED */
|
||||
TCL_OO_METHOD_VERSION_2 = 2
|
||||
#endif
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user