Compare commits
986
Commits
rc4
...
dkf-command-type
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6ec7c04557 | ||
|
|
bfdc5233eb | ||
|
|
1146932b9e | ||
|
|
00d5f9266b | ||
|
|
efa79f01e6 | ||
|
|
9f745ab1cd | ||
|
|
f0ab769a7c | ||
|
|
59f808eb7a | ||
|
|
9aa47b2cfa | ||
|
|
761a7867d5 | ||
|
|
46c087f956 | ||
|
|
3b77852126 | ||
|
|
f0f3d8a55b | ||
|
|
b1f92f4888 | ||
|
|
beac2287a9 | ||
|
|
7b0e9cef60 | ||
|
|
76e2e078e3 | ||
|
|
036cd8c9be | ||
|
|
ac61d77a41 | ||
|
|
d0fab95780 | ||
|
|
4719e1f68d | ||
|
|
be629669a5 | ||
|
|
8a6dda8529 | ||
|
|
243ea5f7a3 | ||
|
|
fbdc68b6a2 | ||
|
|
d6a9a5d664 | ||
|
|
9f9a9e291d | ||
|
|
4ec357c743 | ||
|
|
31b9d1f712 | ||
|
|
25ac7e62ba | ||
|
|
854cf964d2 | ||
|
|
df89a7f211 | ||
|
|
d025ae5c08 | ||
|
|
bd42171094 | ||
|
|
c5943ec574 | ||
|
|
f11320b6b0 | ||
|
|
1775284940 | ||
|
|
3200ec75ef | ||
|
|
9b45aaa5b0 | ||
|
|
1a3cef4874 | ||
|
|
90e3bdc291 | ||
|
|
4f17861678 | ||
|
|
0babbf966b | ||
|
|
a35eba4ac2 | ||
|
|
0d73b8a7c0 | ||
|
|
945b10776d | ||
|
|
4b7caf2e4a | ||
|
|
e94df65350 | ||
|
|
b8d2426e1b | ||
|
|
833b02bc83 | ||
|
|
6269e32c3b | ||
|
|
3e7ffcaf4b | ||
|
|
5c9968a001 | ||
|
|
fbef9aa840 | ||
|
|
fdf1df3b29 | ||
|
|
2f2b7f6ac7 | ||
|
|
5f1bd2f2e3 | ||
|
|
0787b1d152 | ||
|
|
6dfe3f5de6 | ||
|
|
d4d1014e7d | ||
|
|
b3993adcfb | ||
|
|
9b285dde85 | ||
|
|
e5270637c0 | ||
|
|
f5efc84600 | ||
|
|
245151ad96 | ||
|
|
65f3d0f56b | ||
|
|
18c102aa70 | ||
|
|
e53f3cf9c6 | ||
|
|
12647cc4fb | ||
|
|
620b4d531d | ||
|
|
ed3e9c60ba | ||
|
|
d87884d51b | ||
|
|
40947c7d3e | ||
|
|
cff4a9d980 | ||
|
|
ad757b50dc | ||
|
|
304b569170 | ||
|
|
7633450128 | ||
|
|
54fbd7dbcb | ||
|
|
772d2da10b | ||
|
|
0ae1df9bfc | ||
|
|
6667ddcb54 | ||
|
|
77aceb5c5f | ||
|
|
8a7c004dbc | ||
|
|
87e508c590 | ||
|
|
a76637248c | ||
|
|
d0f8889c8f | ||
|
|
27110774bd | ||
|
|
5a06fd4bcf | ||
|
|
969f9f571c | ||
|
|
64cbe6e187 | ||
|
|
6982ae0ca7 | ||
|
|
da7eafc83b | ||
|
|
414bcee273 | ||
|
|
d11660acfe | ||
|
|
5c7ba37901 | ||
|
|
1d1e95e779 | ||
|
|
bffb982059 | ||
|
|
0978bd50ce | ||
|
|
3f8c7d5d40 | ||
|
|
4c24e60418 | ||
|
|
8219fb2632 | ||
|
|
082e8c6d7a | ||
|
|
7a9d97826e | ||
|
|
9683822257 | ||
|
|
bf884c9bc9 | ||
|
|
fdee46ab16 | ||
|
|
94f9cf81ed | ||
|
|
05209c57d3 | ||
|
|
5c87050dd8 | ||
|
|
8e696a5e5d | ||
|
|
9e511d7874 | ||
|
|
5af99f55b2 | ||
|
|
1f91c778bb | ||
|
|
dd713ee96e | ||
|
|
7bf68c2335 | ||
|
|
c9802b0230 | ||
|
|
15f804e04e | ||
|
|
e5de25734f | ||
|
|
33b8401436 | ||
|
|
d62033b7e2 | ||
|
|
1b3a0a73ae | ||
|
|
9e3e0498e7 | ||
|
|
b5e61d9f54 | ||
|
|
bae4992913 | ||
|
|
f8b9cb869d | ||
|
|
4755be8f41 | ||
|
|
c2e16d9b1f | ||
|
|
3b14a4b0ed | ||
|
|
a3fdad2b4f | ||
|
|
38be8d3de6 | ||
|
|
ddd37fb237 | ||
|
|
63be474164 | ||
|
|
fa47c96ac2 | ||
|
|
5e3ca11761 | ||
|
|
6ab540f5ff | ||
|
|
63b0fef31a | ||
|
|
bb503004b6 | ||
|
|
267cdaec03 | ||
|
|
bb5d24622f | ||
|
|
813979693c | ||
|
|
c8da3bbfaf | ||
|
|
35f5b82868 | ||
|
|
66ef201ad7 | ||
|
|
1ab67324ca | ||
|
|
edb38932e8 | ||
|
|
46aab3eb09 | ||
|
|
ce025f259b | ||
|
|
f6af18a947 | ||
|
|
b729965a3c | ||
|
|
0cab7d260b | ||
|
|
708eadd19e | ||
|
|
7bbadfe0e0 | ||
|
|
4523d8df2c | ||
|
|
791f1c2741 | ||
|
|
d431841a06 | ||
|
|
4f1ea4779b | ||
|
|
e6fdfbe93b | ||
|
|
bd706be303 | ||
|
|
4e12ee1bc4 | ||
|
|
c2fceada6c | ||
|
|
6ba27f887c | ||
|
|
5eef06ea24 | ||
|
|
9333525d11 | ||
|
|
911c1c6237 | ||
|
|
49a9e59311 | ||
|
|
242d4d7095 | ||
|
|
c744824995 | ||
|
|
9cb3b15616 | ||
|
|
388266030b | ||
|
|
d3fd405e6b | ||
|
|
eed54b6281 | ||
|
|
6dbdfc31d2 | ||
|
|
35d6c2453e | ||
|
|
7855612da6 | ||
|
|
7f26fedbcc | ||
|
|
08f43a1ff4 | ||
|
|
1f71d7079b | ||
|
|
5cef8b0f8e | ||
|
|
5500074eff | ||
|
|
66525c95ee | ||
|
|
13bdb0305c | ||
|
|
2a19591dc7 | ||
|
|
411bfad9f4 | ||
|
|
f58e9ed842 | ||
|
|
215b091d17 | ||
|
|
ce396e8f68 | ||
|
|
ccf2e7a979 | ||
|
|
c326a21131 | ||
|
|
51208ca53e | ||
|
|
bfc5a0090f | ||
|
|
5238a999d5 | ||
|
|
ab49bdfd12 | ||
|
|
9e733498f1 | ||
|
|
859bcc9f86 | ||
|
|
fec8aee1a1 | ||
|
|
27c2e432b5 | ||
|
|
523d6ea42c | ||
|
|
95f2469359 | ||
|
|
dc6bc431e9 | ||
|
|
24d501cb0d | ||
|
|
ca5638e01f | ||
|
|
5c2ea0542f | ||
|
|
346eec1892 | ||
|
|
ddb7bbe66c | ||
|
|
567fb6cc27 | ||
|
|
f44e7c1795 | ||
|
|
28ac086633 | ||
|
|
31a291920a | ||
|
|
47fc4afd86 | ||
|
|
08d704bbb1 | ||
|
|
04604552b2 | ||
|
|
b5d6b4f138 | ||
|
|
2d5be38603 | ||
|
|
ad02c0b532 | ||
|
|
28e500cbf9 | ||
|
|
637c7dbc7e | ||
|
|
49879791f4 | ||
|
|
8262e514d0 | ||
|
|
994ba283c9 | ||
|
|
019016e71a | ||
|
|
4647cfb665 | ||
|
|
634c443219 | ||
|
|
43507f353b | ||
|
|
eb8817687f | ||
|
|
0ad3b13e26 | ||
|
|
5a8d06b076 | ||
|
|
d525fa6f68 | ||
|
|
008f1c98d0 | ||
|
|
42a2b87f32 | ||
|
|
a5d6e9657a | ||
|
|
a27e0ef2ce | ||
|
|
220d2d7d9c | ||
|
|
08dc58ce40 | ||
|
|
3abde0eac5 | ||
|
|
29f8e6add3 | ||
|
|
919a1c67ab | ||
|
|
dc07332444 | ||
|
|
bac2aebf10 | ||
|
|
383c53f80e | ||
|
|
ba9cf35aa3 | ||
|
|
db41a49d9c | ||
|
|
cbbab84b71 | ||
|
|
df06afadcf | ||
|
|
55a65632d0 | ||
|
|
7435702d63 | ||
|
|
c120622483 | ||
|
|
a8ffcb0b4c | ||
|
|
47152d94c1 | ||
|
|
aa199edba6 | ||
|
|
5d355c0fd9 | ||
|
|
e6e44fb3b8 | ||
|
|
6fcbcd9f12 | ||
|
|
4751bcf256 | ||
|
|
d0bce3e99f | ||
|
|
43f670e530 | ||
|
|
2d87ed6d29 | ||
|
|
3cda2dc805 | ||
|
|
0a3e263036 | ||
|
|
864d754a8a | ||
|
|
17e2ed6919 | ||
|
|
15bfd5756e | ||
|
|
62079a5c69 | ||
|
|
41ed3e0e2b | ||
|
|
9ac074bd09 | ||
|
|
bbae63cfa9 | ||
|
|
962427e8cd | ||
|
|
2ae2445072 | ||
|
|
8bd4a8cf2c | ||
|
|
5ff641a603 | ||
|
|
71618ce230 | ||
|
|
f35817ce5a | ||
|
|
3af272b07a | ||
|
|
67a242e003 | ||
|
|
4ba8623115 | ||
|
|
410bda416e | ||
|
|
861217dbe3 | ||
|
|
f52d25e68a | ||
|
|
9b9635f82e | ||
|
|
45f5143205 | ||
|
|
e7be4a19a0 | ||
|
|
d660f467cb | ||
|
|
6b5d0e5d8d | ||
|
|
4dc5255a8e | ||
|
|
b4d6691add | ||
|
|
3492c92f3d | ||
|
|
405b9175e6 | ||
|
|
6de6ee8aa9 | ||
|
|
0254080ca0 | ||
|
|
a735b5d3ac | ||
|
|
d2d193de11 | ||
|
|
77d58c5993 | ||
|
|
6bb961ffc6 | ||
|
|
0d33258649 | ||
|
|
f406561f40 | ||
|
|
80c3bfdcaa | ||
|
|
96e07632d9 | ||
|
|
4d47b7f97f | ||
|
|
b1e6769ef3 | ||
|
|
0e5d21e88f | ||
|
|
0c568099ee | ||
|
|
5753c7a42b | ||
|
|
914d6e1546 | ||
|
|
e9c0312caf | ||
|
|
9a809e614a | ||
|
|
0bceead396 | ||
|
|
5b5bd699ff | ||
|
|
6faf2feff2 | ||
|
|
9090aca429 | ||
|
|
fe83175465 | ||
|
|
4ad7747c62 | ||
|
|
812174d578 | ||
|
|
471d356605 | ||
|
|
2d54b68224 | ||
|
|
cce4368ace | ||
|
|
7a1cc7e3b3 | ||
|
|
0b90c0b92e | ||
|
|
0af226b20a | ||
|
|
e62743b6ee | ||
|
|
0b96f3fb32 | ||
|
|
3971514c1b | ||
|
|
c64afc94f1 | ||
|
|
55898c44b9 | ||
|
|
c329006b1a | ||
|
|
dc74da2f56 | ||
|
|
01a9d5c7cc | ||
|
|
4a6163c6a6 | ||
|
|
0031252bf1 | ||
|
|
4d73b33b87 | ||
|
|
e2877119cd | ||
|
|
451c384456 | ||
|
|
ffae8c82da | ||
|
|
4cff9271ac | ||
|
|
3f2c5cd5aa | ||
|
|
185cdc39c6 | ||
|
|
365ee5bb13 | ||
|
|
f674720166 | ||
|
|
a37e29cf85 | ||
|
|
fde3c52d29 | ||
|
|
99ca63a80a | ||
|
|
25fcbf685d | ||
|
|
2567185fd2 | ||
|
|
ca5e7c5b63 | ||
|
|
836fa11775 | ||
|
|
3be49723fc | ||
|
|
da7f77f96f | ||
|
|
98887219c2 | ||
|
|
93310b9171 | ||
|
|
73eb8eb8d1 | ||
|
|
77821adfe8 | ||
|
|
4f918b61b0 | ||
|
|
1a98844412 | ||
|
|
876f2d5b63 | ||
|
|
fa7659336c | ||
|
|
175fe8c23f | ||
|
|
d98ee54c8d | ||
|
|
2eba1ce11e | ||
|
|
6cd01fd0f8 | ||
|
|
46e8af13b6 | ||
|
|
b0fce7a700 | ||
|
|
d20d1e603b | ||
|
|
83df36ac41 | ||
|
|
eb9e2858c1 | ||
|
|
68214211b7 | ||
|
|
92aca935b3 | ||
|
|
8a7371192a | ||
|
|
6904b0f77f | ||
|
|
0abda82b1e | ||
|
|
92c0d0a011 | ||
|
|
fb10dc69ee | ||
|
|
03a71b0706 | ||
|
|
a4953f93f4 | ||
|
|
1c35ed873a | ||
|
|
69868ee129 | ||
|
|
e16df96d28 | ||
|
|
bed15f1d81 | ||
|
|
ac67b57981 | ||
|
|
608373fcb1 | ||
|
|
7ea11c7f98 | ||
|
|
e755aba59f | ||
|
|
a866c42f19 | ||
|
|
3502aebe10 | ||
|
|
7c60d44ce6 | ||
|
|
e89d1e331e | ||
|
|
9a892a33b7 | ||
|
|
8e6fe27ecc | ||
|
|
e841295386 | ||
|
|
87c12599bf | ||
|
|
eaacc9bb56 | ||
|
|
ecaec63f48 | ||
|
|
f0b9b9fbb6 | ||
|
|
e1ffd3f005 | ||
|
|
2cfe8bb561 | ||
|
|
e9f2695255 | ||
|
|
c8219a9a29 | ||
|
|
1fda13591a | ||
|
|
9947048fbd | ||
|
|
27e7f096b2 | ||
|
|
244885a03e | ||
|
|
eb3422673f | ||
|
|
3b5858bcd2 | ||
|
|
2a8fce94bd | ||
|
|
48d6a20861 | ||
|
|
04d3db5592 | ||
|
|
3889f63614 | ||
|
|
498f069f0e | ||
|
|
37b48e808c | ||
|
|
3fc7771456 | ||
|
|
48456596ff | ||
|
|
6d9902632c | ||
|
|
fafc11d6e0 | ||
|
|
4a5058fc1b | ||
|
|
7e4261e22c | ||
|
|
eb1212a3c1 | ||
|
|
6c799d891d | ||
|
|
7aa147800f | ||
|
|
32f3dce79d | ||
|
|
fc03549d34 | ||
|
|
54590627ee | ||
|
|
b533731c50 | ||
|
|
983b089edb | ||
|
|
651697f7cd | ||
|
|
daa36e9a1b | ||
|
|
b0898beca6 | ||
|
|
a922e9fd15 | ||
|
|
6631e46bd3 | ||
|
|
47c7771af1 | ||
|
|
0f6d3fd959 | ||
|
|
815ebb9a0f | ||
|
|
4a038240c4 | ||
|
|
7a13be75b6 | ||
|
|
a27cc004d2 | ||
|
|
ca634be831 | ||
|
|
e71f41cf89 | ||
|
|
b0e6ac7da9 | ||
|
|
9a9b619c9f | ||
|
|
0b3bf9e30d | ||
|
|
1dd89810eb | ||
|
|
9977b3e79c | ||
|
|
cae732bd8d | ||
|
|
444ba0a874 | ||
|
|
189c6453b4 | ||
|
|
53795bd199 | ||
|
|
5a190dd003 | ||
|
|
5bcb4bc9a0 | ||
|
|
5e11793221 | ||
|
|
dc40e6f797 | ||
|
|
b6f5c15189 | ||
|
|
34c238c152 | ||
|
|
07c71d17a2 | ||
|
|
051a7ec3ae | ||
|
|
ee66488c36 | ||
|
|
f64bba0499 | ||
|
|
dbe18af9ea | ||
|
|
52dc6e55e5 | ||
|
|
03e581e857 | ||
|
|
72af38dd32 | ||
|
|
7f1c241ea2 | ||
|
|
45a3c74a04 | ||
|
|
71cf0dba40 | ||
|
|
aecff8b1e7 | ||
|
|
67f6f5cdb1 | ||
|
|
603e23c2a9 | ||
|
|
4fb66d5d55 | ||
|
|
3f03f8189e | ||
|
|
c576cbec93 | ||
|
|
5c4f8d88b5 | ||
|
|
9c5c1a721f | ||
|
|
556dc3036e | ||
|
|
2756d01872 | ||
|
|
3ddcb1cfb5 | ||
|
|
191ea171cb | ||
|
|
137a89f1e2 | ||
|
|
0239e7e77f | ||
|
|
dddf400b7e | ||
|
|
bf868c1c56 | ||
|
|
2555e0d7e6 | ||
|
|
dfeacc8edb | ||
|
|
9ef7f0a940 | ||
|
|
54ae4feac8 | ||
|
|
a3daf1a6d1 | ||
|
|
7573551ccb | ||
|
|
4644a04ee3 | ||
|
|
21877b851c | ||
|
|
d7ed325913 | ||
|
|
a69614b432 | ||
|
|
3f1dfde45f | ||
|
|
c15cc5c510 | ||
|
|
99e890b52c | ||
|
|
72f0f0b346 | ||
|
|
f0d821a83c | ||
|
|
9b47336cbd | ||
|
|
1a237e67df | ||
|
|
db726dc570 | ||
|
|
88233497ab | ||
|
|
b96b6a46ba | ||
|
|
0efada5548 | ||
|
|
99798b2202 | ||
|
|
f327b7e9dc | ||
|
|
72998869a3 | ||
|
|
c47ba70f45 | ||
|
|
4190501ec7 | ||
|
|
c032f5043e | ||
|
|
7ecb945209 | ||
|
|
79b5a0a716 | ||
|
|
03c66864aa | ||
|
|
3af16acbcb | ||
|
|
eef0b72b5e | ||
|
|
9b22762d4c | ||
|
|
0951ca5344 | ||
|
|
8396e878da | ||
|
|
bb48fae153 | ||
|
|
fe65a79d19 | ||
|
|
a8a602d3ff | ||
|
|
2930169517 | ||
|
|
d95ab0247a | ||
|
|
20dedcd841 | ||
|
|
ae2707f558 | ||
|
|
811ec68434 | ||
|
|
c2e98a86d4 | ||
|
|
48fb6e2c88 | ||
|
|
99dc87a51d | ||
|
|
7154cc9c47 | ||
|
|
b3ff8cc20c | ||
|
|
2fcfa34fcf | ||
|
|
ca83d59e10 | ||
|
|
160a58238a | ||
|
|
dd0e9cf6b1 | ||
|
|
2d811a0adf | ||
|
|
3c23d21835 | ||
|
|
fac696b394 | ||
|
|
09f849cabd | ||
|
|
d997aa477d | ||
|
|
8225859a93 | ||
|
|
9215c2610c | ||
|
|
35adf8c728 | ||
|
|
119652bd95 | ||
|
|
011dd7b0f6 | ||
|
|
334149646f | ||
|
|
d8a921174e | ||
|
|
d7b40297d2 | ||
|
|
9ef614086a | ||
|
|
6b40a5dc5a | ||
|
|
3cd8b86e50 | ||
|
|
d2fc7a6ed5 | ||
|
|
12a14f4954 | ||
|
|
1f34b918b9 | ||
|
|
4a8bb308e8 | ||
|
|
3640513caf | ||
|
|
4e97c16367 | ||
|
|
52b098ca11 | ||
|
|
82877a8aa3 | ||
|
|
61536390c5 | ||
|
|
3a7618f91e | ||
|
|
a1bc5b8a2b | ||
|
|
c19490026d | ||
|
|
bc3e198cba | ||
|
|
b946ce971f | ||
|
|
c2eeda3f09 | ||
|
|
280b6aa62e | ||
|
|
fe346634a7 | ||
|
|
1d444f5610 | ||
|
|
30938251a2 | ||
|
|
157e55c7bc | ||
|
|
d8a0c08bbc | ||
|
|
3730061388 | ||
|
|
b171f5cc41 | ||
|
|
02a019458f | ||
|
|
b59255450b | ||
|
|
c6d82079ea | ||
|
|
2ea8f0fe98 | ||
|
|
b832920adb | ||
|
|
52d32b1033 | ||
|
|
f85da9c9fd | ||
|
|
f20b58c6a9 | ||
|
|
9513859f8c | ||
|
|
f81c2ae724 | ||
|
|
7c1f63bb60 | ||
|
|
4515103846 | ||
|
|
87d37d3101 | ||
|
|
da76cd286c | ||
|
|
3c532f6336 | ||
|
|
ded3368d3c | ||
|
|
e84763748b | ||
|
|
8079a467a7 | ||
|
|
be47788793 | ||
|
|
4eed307023 | ||
|
|
0dd94666f5 | ||
|
|
1ed5a135ed | ||
|
|
f6a35fe784 | ||
|
|
62fbfd89d7 | ||
|
|
932afb0105 | ||
|
|
dfbe0053d1 | ||
|
|
b7e5592df1 | ||
|
|
944a3d95ff | ||
|
|
29dda71bad | ||
|
|
0faadee83c | ||
|
|
a037934e21 | ||
|
|
56e7df256a | ||
|
|
429acda3ee | ||
|
|
cf4d5a8cfe | ||
|
|
b2722c42b1 | ||
|
|
ed20823380 | ||
|
|
e82d7fb753 | ||
|
|
3b989eefe0 | ||
|
|
a982dd11fa | ||
|
|
2c1224dce7 | ||
|
|
c2dfae0758 | ||
|
|
23440fcbd7 | ||
|
|
399ff79e21 | ||
|
|
338e92cb28 | ||
|
|
433dff0c14 | ||
|
|
a7ba08158b | ||
|
|
42764c99be | ||
|
|
2ad54a6f6e | ||
|
|
f941597e43 | ||
|
|
c1e89d73fd | ||
|
|
48b529209c | ||
|
|
47b333303e | ||
|
|
27e8f4db3d | ||
|
|
9b30058284 | ||
|
|
6fff25ecbc | ||
|
|
cf516b0eb8 | ||
|
|
8c4d8a4f14 | ||
|
|
d52223f024 | ||
|
|
88451d16ba | ||
|
|
3691ae66b6 | ||
|
|
203cbf2ea0 | ||
|
|
b6c2770a30 | ||
|
|
1a0c2e24eb | ||
|
|
735d38cd7c | ||
|
|
9e2ed8b729 | ||
|
|
adc216698f | ||
|
|
1cbd95eeee | ||
|
|
db930a501f | ||
|
|
2f2459e120 | ||
|
|
8fd76cb873 | ||
|
|
c8fbbd8f3e | ||
|
|
b0a9f6c55b | ||
|
|
b8b341fea6 | ||
|
|
9a322ef016 | ||
|
|
312263821f | ||
|
|
9e80ee005e | ||
|
|
3aa68b1a0b | ||
|
|
ca470c3d4e | ||
|
|
6642181b9d | ||
|
|
a67fec7324 | ||
|
|
aad24c7ffc | ||
|
|
fe508fa3b5 | ||
|
|
fcc5b3486f | ||
|
|
d8cae66217 | ||
|
|
40ce2eccbc | ||
|
|
16976013d1 | ||
|
|
ef7ea2c390 | ||
|
|
172896b15a | ||
|
|
5470f13299 | ||
|
|
c0effc5b46 | ||
|
|
fc947a1ad4 | ||
|
|
ef82c5073a | ||
|
|
237b4d22a2 | ||
|
|
a72fed191e | ||
|
|
5015dd8a1f | ||
|
|
5abbd5b2da | ||
|
|
54bc992b81 | ||
|
|
e55f59bd83 | ||
|
|
943b46881e | ||
|
|
757012c289 | ||
|
|
15f27ca8f2 | ||
|
|
c55b8ed591 | ||
|
|
522456ba98 | ||
|
|
0a8718312d | ||
|
|
68b53cfb25 | ||
|
|
935e991786 | ||
|
|
43c89a019c | ||
|
|
57aa77515a | ||
|
|
8dd2373a08 | ||
|
|
03470df2ff | ||
|
|
5aaef06572 | ||
|
|
0b8e964f45 | ||
|
|
c86a23de04 | ||
|
|
ca0b2a012e | ||
|
|
4401a58b2a | ||
|
|
ccabb2af0c | ||
|
|
875f1b248d | ||
|
|
b1c5e807ca | ||
|
|
cf30ba443c | ||
|
|
8c62a9c228 | ||
|
|
b5273bc1fa | ||
|
|
3bde30215b | ||
|
|
46db6e4a00 | ||
|
|
cddb5b612f | ||
|
|
d56986e037 | ||
|
|
e9b2f70238 | ||
|
|
de59a00a30 | ||
|
|
7eea851880 | ||
|
|
0515becf7a | ||
|
|
6b2a58ffcd | ||
|
|
30cebba4d6 | ||
|
|
afc0ba5cdc | ||
|
|
cf3f133df1 | ||
|
|
eb03584c16 | ||
|
|
f0aac87b35 | ||
|
|
627f0a4d6a | ||
|
|
b645469c95 | ||
|
|
e295641767 | ||
|
|
c3a18ac8f4 | ||
|
|
f9dda45e97 | ||
|
|
a5c310f993 | ||
|
|
80d9aa777b | ||
|
|
c745f44e3a | ||
|
|
21d4596064 | ||
|
|
5f738db586 | ||
|
|
76bb4d1ea4 | ||
|
|
4db368d595 | ||
|
|
9dfe53af4a | ||
|
|
e58a9dabbe | ||
|
|
3e0c5c6c90 | ||
|
|
e9e40f5f02 | ||
|
|
a4dbdda700 | ||
|
|
5bf83d86b6 | ||
|
|
3c85e6e0ef | ||
|
|
58ab27bf86 | ||
|
|
824b71f959 | ||
|
|
c3c935369d | ||
|
|
e14a1e9e3d | ||
|
|
5c93243c18 | ||
|
|
bd1370959e | ||
|
|
a852495cf6 | ||
|
|
9a7f1bd48c | ||
|
|
47cb19c83f | ||
|
|
f4cc5617a6 | ||
|
|
e48602d674 | ||
|
|
e9a8c42972 | ||
|
|
5bcc7fa342 | ||
|
|
b0c45c3ad0 | ||
|
|
e1e49c9dd1 | ||
|
|
18ba46bf37 | ||
|
|
5b719a2281 | ||
|
|
edbf30e23a | ||
|
|
395d0889b0 | ||
|
|
ba0d107038 | ||
|
|
763f9dff55 | ||
|
|
bbcef5b648 | ||
|
|
b3b6f6ff99 | ||
|
|
71b97d16f3 | ||
|
|
25d1f4aa03 | ||
|
|
22f5c55560 | ||
|
|
3cf33e9e9f | ||
|
|
a288c5e54a | ||
|
|
c3e9d3205f | ||
|
|
227fbec0fc | ||
|
|
dc21089720 | ||
|
|
f6bb864fc7 | ||
|
|
bd7d14f293 | ||
|
|
982211da16 | ||
|
|
a1740d9766 | ||
|
|
e9795fb407 | ||
|
|
299924e512 | ||
|
|
a03e74efc1 | ||
|
|
3c03a492f9 | ||
|
|
56c5833c4a | ||
|
|
63b07461da | ||
|
|
1c3288f038 | ||
|
|
8ecd6aeb5b | ||
|
|
4d00715902 | ||
|
|
95aeb2a3d6 | ||
|
|
b0a98f480d | ||
|
|
cb73551e8d | ||
|
|
4d946107e7 | ||
|
|
c795f44ea5 | ||
|
|
ecd9567624 | ||
|
|
d6fdfa4624 | ||
|
|
58ace2b1dc | ||
|
|
8f6089f225 | ||
|
|
19627fed47 | ||
|
|
83145e2bb1 | ||
|
|
621c76324a | ||
|
|
e961e1c08a | ||
|
|
e740674cb8 | ||
|
|
23ced66a6b | ||
|
|
b637222a5d | ||
|
|
9a0f7dd2c8 | ||
|
|
440e5fc7dc | ||
|
|
74ed7238b0 | ||
|
|
38d734ddcf | ||
|
|
cbeed9da92 | ||
|
|
a369d46795 | ||
|
|
1956f4b66b | ||
|
|
90b38da321 | ||
|
|
4594b4f27a | ||
|
|
ff3f0131bd | ||
|
|
5b793fef99 | ||
|
|
13aa1642ac | ||
|
|
d905cc4737 | ||
|
|
d954f3c4ee | ||
|
|
c770024ce1 | ||
|
|
c1f95640c4 | ||
|
|
48ef2b50eb | ||
|
|
071aa09c6e | ||
|
|
10cd3c906d | ||
|
|
0fca37f803 | ||
|
|
9dd94f7396 | ||
|
|
ce65c7b396 | ||
|
|
a80a084de9 | ||
|
|
ddc625f2fe | ||
|
|
842b15b839 | ||
|
|
4506b4536b | ||
|
|
dbe627594e | ||
|
|
130fe11f2b | ||
|
|
3bce1ab6f2 | ||
|
|
fe773c0a46 | ||
|
|
ecc90e3787 | ||
|
|
6e0d4b6761 | ||
|
|
53ad2ab17d | ||
|
|
a2a59dfb75 | ||
|
|
829af34165 | ||
|
|
1579eae899 | ||
|
|
6fcdce9c74 | ||
|
|
ac785323be | ||
|
|
d68207f7ca | ||
|
|
ddc615491d | ||
|
|
b1031c0d07 | ||
|
|
cdba31b9d5 | ||
|
|
83da0d6374 | ||
|
|
bb504b06b4 | ||
|
|
55717aeaea | ||
|
|
e886aae69e | ||
|
|
adceea62b6 | ||
|
|
348f13ad57 | ||
|
|
e448db56ee | ||
|
|
dd60d52814 | ||
|
|
428c3163c5 | ||
|
|
339d4879a0 | ||
|
|
ded95f89d3 | ||
|
|
5949095693 | ||
|
|
410178bb88 | ||
|
|
9cbfbd034e | ||
|
|
3b50f8bcd6 | ||
|
|
85442c797c | ||
|
|
3e723b7f5e | ||
|
|
6b423f0d9e | ||
|
|
bdc43f8241 | ||
|
|
9171dde346 | ||
|
|
6826dbab46 | ||
|
|
b2164040ac | ||
|
|
307bb5f72d | ||
|
|
963de5ae2a | ||
|
|
2b022e6979 | ||
|
|
cfd9edb0fe | ||
|
|
74b45809d1 | ||
|
|
507bab4b21 | ||
|
|
f45b6c1066 | ||
|
|
ebebb29be9 | ||
|
|
2e0b2484a9 | ||
|
|
ff7a13136d | ||
|
|
4b8398a6ed | ||
|
|
a684c1a281 | ||
|
|
b25f4f5272 | ||
|
|
c003b95ed4 | ||
|
|
0cbfed0c55 | ||
|
|
ee30b1c0ab | ||
|
|
b3362b7dfd | ||
|
|
99d72ae892 | ||
|
|
39145d45d1 | ||
|
|
627a5bfa73 | ||
|
|
ab35383fda | ||
|
|
9f12483ed2 | ||
|
|
4e331e27f8 | ||
|
|
71e02d5298 | ||
|
|
0008ed9ea4 | ||
|
|
3bd1370dbc | ||
|
|
a426ba29d5 | ||
|
|
a813938bef | ||
|
|
295272b73c | ||
|
|
703177e26a | ||
|
|
b992e62207 | ||
|
|
4691bea988 | ||
|
|
fce753c3d5 | ||
|
|
670a31f84f | ||
|
|
25358e0ba4 | ||
|
|
b6f9bc7ca8 | ||
|
|
79ccab2fd2 | ||
|
|
8d1d673760 | ||
|
|
6c2512bc35 | ||
|
|
2c1a55d314 | ||
|
|
e88bbb7296 | ||
|
|
06547a29be | ||
|
|
8ca1a78b1a | ||
|
|
6c59decfba | ||
|
|
732a963e04 | ||
|
|
cd9922f497 | ||
|
|
9554b52dba | ||
|
|
8c90b3ae99 | ||
|
|
811d367c49 | ||
|
|
1d9824ec60 | ||
|
|
5c6730bd0f | ||
|
|
78b3c04320 | ||
|
|
0ce217e309 | ||
|
|
d1536b7378 | ||
|
|
eb664a3d72 | ||
|
|
96dd5baf98 | ||
|
|
18eed1d727 | ||
|
|
ce72e40607 | ||
|
|
8615597984 | ||
|
|
a333bbaa12 | ||
|
|
2bc847ac57 | ||
|
|
24197ad684 | ||
|
|
92323ee89f | ||
|
|
0f2d93b3a6 | ||
|
|
f96b9f2783 | ||
|
|
f370c68d92 | ||
|
|
f8e147cb73 | ||
|
|
ceb88b82f1 | ||
|
|
a6c0992f47 | ||
|
|
9283692888 | ||
|
|
9acc153698 | ||
|
|
017b8b10b6 | ||
|
|
4ddfe70ae2 | ||
|
|
53dc25e532 | ||
|
|
542b57cf21 | ||
|
|
afd4d17b3c | ||
|
|
82132b6c4c | ||
|
|
21d8621d11 | ||
|
|
e36fd891e4 | ||
|
|
954b241f34 | ||
|
|
f038b7fc3d | ||
|
|
3f56494834 | ||
|
|
6a811b97b9 | ||
|
|
30dbc0a75b | ||
|
|
1900da6d24 | ||
|
|
8f38d12eee | ||
|
|
3f5f45f002 | ||
|
|
e6528cb48d | ||
|
|
041184928d | ||
|
|
b108063f75 | ||
|
|
9ce336b3d1 | ||
|
|
b5da760544 | ||
|
|
7e520e2089 | ||
|
|
07af7d5337 | ||
|
|
696a9ba3f9 | ||
|
|
9db6776dbe | ||
|
|
1c6a242b2e | ||
|
|
a58db736cf | ||
|
|
449ea43718 | ||
|
|
260c2634b9 | ||
|
|
6d0db57c02 | ||
|
|
11593d64b8 | ||
|
|
e4a0b9dbfd | ||
|
|
bb770e33f8 | ||
|
|
d048128004 | ||
|
|
eecece2afe | ||
|
|
74c7068a25 | ||
|
|
59360240b3 | ||
|
|
57d33c5027 | ||
|
|
e1c5526cb2 | ||
|
|
290c2ef84f | ||
|
|
91ba235b3c | ||
|
|
d13fe1e431 | ||
|
|
f361c1805c | ||
|
|
52b8ad45d1 | ||
|
|
9b6c85d82e | ||
|
|
88b8fc30a2 | ||
|
|
1a0463ea04 | ||
|
|
cab91124b4 | ||
|
|
8d9ea7c132 | ||
|
|
c5558280d7 | ||
|
|
3913f5f7ae | ||
|
|
e8c69aa654 | ||
|
|
b2b37d97cf | ||
|
|
4796adf5cb | ||
|
|
2c02c2ae5d | ||
|
|
ef824b7395 | ||
|
|
2930daf68c | ||
|
|
0481e3ca74 | ||
|
|
073618d375 | ||
|
|
5ddf03d324 | ||
|
|
ac98be85ce | ||
|
|
048fae9de6 | ||
|
|
81735df1fa | ||
|
|
9c32ab0d8b | ||
|
|
861e75f503 | ||
|
|
e891120584 | ||
|
|
2045bb3c21 | ||
|
|
a498488c59 | ||
|
|
dd43ee3dbf | ||
|
|
39ad9eb8f3 | ||
|
|
b30ba5a92b |
@@ -4,6 +4,7 @@ compat/zlib/win64/zdll.lib
|
||||
compat/zlib/win64/zlib1.dll
|
||||
compat/zlib/win64/libz.dll.a
|
||||
compat/zlib/zlib.3.pdf
|
||||
tools/empty.zip
|
||||
*.bmp
|
||||
*.gif
|
||||
*.png
|
||||
@@ -44,5 +44,6 @@ unix/pkgs/*
|
||||
win/Debug*
|
||||
win/Release*
|
||||
win/pkgs/*
|
||||
win/coffbase.txt
|
||||
win/tcl.hpj
|
||||
win/nmhlp-out.txt
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
Important Note
|
||||
==========
|
||||
Please do not file issues with Tcl on Github. They are unlikely to be noticed in a timely fashion. Tcl issues are hosted in the [tcl fossil repository on core.tcl.tk](https://core.tcl.tk/tcl/tktnew); please post them there.
|
||||
@@ -0,0 +1,3 @@
|
||||
Important Note
|
||||
==========
|
||||
Please do not file pull requests with Tcl on Github. They are unlikely to be noticed in a timely fashion. Tcl issues (including patches) are hosted in the [tcl fossil repository on core.tcl.tk](https://core.tcl.tk/tcl/tktnew); please post them there.
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>tcl8.6</name>
|
||||
<name>tcl8</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
README: Tcl
|
||||
This is the Tcl 8.6.8 source distribution.
|
||||
This is the Tcl 8.7a2 source distribution.
|
||||
http://sourceforge.net/projects/tcl/files/Tcl/
|
||||
You can get any source release of Tcl from the URL above.
|
||||
|
||||
@@ -49,7 +49,7 @@ and selling it either in whole or in part. See the file
|
||||
|
||||
Extensive documentation is available at our website.
|
||||
The home page for this release, including new features, is
|
||||
http://www.tcl.tk/software/tcltk/8.6.html
|
||||
http://www.tcl.tk/software/tcltk/8.7.html
|
||||
|
||||
Detailed release notes can be found at the file distributions page
|
||||
by clicking on the relevant version.
|
||||
@@ -61,9 +61,9 @@ Information about Tcl itself can be found at
|
||||
There have been many Tcl books on the market. Many are mentioned in the Wiki:
|
||||
http://wiki.tcl.tk/_/ref?N=25206
|
||||
|
||||
To view the complete set of reference manual entries for Tcl 8.6 online,
|
||||
To view the complete set of reference manual entries for Tcl 8.7 online,
|
||||
visit the URL:
|
||||
http://www.tcl.tk/man/tcl8.6/
|
||||
http://www.tcl.tk/man/tcl8.7/
|
||||
|
||||
2a. Unix Documentation
|
||||
----------------------
|
||||
|
||||
@@ -8830,3 +8830,57 @@ improvements to regexp engine from Postgres (lane,porter,fellows,seltenreich)
|
||||
2017-12-19 (bug)[586e71] EvalObjv exception handling at level #0 (sebres,porter)
|
||||
|
||||
--- Released 8.6.8, December 22, 2017 --- http://core.tcl.tk/tcl/ for details
|
||||
|
||||
Changes to 8.7a1 include all changes to the 8.6 line through 8.6.7,
|
||||
plus the following, which focuses on the high-level feature changes
|
||||
in this changeset (new minor version) rather than bug fixes:
|
||||
|
||||
2016-03-17 (bug)[0b8c38] socket accept callbacks always in global ns (porter)
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
2016-07-01 Hack accommodations for legacy Itcl 3 disabled (porter)
|
||||
|
||||
2016-07-12 Make TCL_HASH_TYPE build-time configurable (nijtmans)
|
||||
|
||||
2016-07-19 (bug)[0363f0] Partial array search ID reform (porter)
|
||||
|
||||
2016-07-19 (feature removed) Tcl_ObjType "array search" unregistered (porter)
|
||||
*** POTENTIAL INCOMPATIBILITY for Tcl_GetObjType("array search") ***
|
||||
|
||||
2016-10-04 Server socket on port 0 chooses port supporting IPv4 * IPv6 (max)
|
||||
|
||||
2016-11-25 [array named -regexp] supports backrefs (goth)
|
||||
|
||||
2017-01-04 (TIP 456) New routine Tcl_OpenTcpServerEx() (limeboy)
|
||||
|
||||
2017-01-04 (TIP 459) New subcommand [package files] (nijtmans)
|
||||
|
||||
2017-01-16 threaded allocator initialization repair (vasiljevic,nijtmans)
|
||||
|
||||
2017-01-30 Add to Win shell builtins: assoc ftype move (ashok)
|
||||
|
||||
2017-03-31 TCL_MEM_DEBUG facilities better support 64-bit memory (nijtmans)
|
||||
|
||||
2017-04-13 \u escaped content in msg files converted to true utf-8 (nijtmans)
|
||||
|
||||
2017-05-18 (TIP 458) New epoll or kqueue notifiers are default (alborboz)
|
||||
|
||||
2017-05-31 Purge build support for SunOS-4.* (stu)
|
||||
|
||||
2017-06-22 (TIP 463) New option [regsub ... -command ...] (fellows)
|
||||
|
||||
2017-06-22 (TIP 470) Tcl_GetDefineContextObject();[oo::define [self]] (fellows)
|
||||
=> TclOO 1.2.0
|
||||
|
||||
2017-06-23 (TIP 472) Support 0d as prefix of decimal numbers (iyer,griffin)
|
||||
|
||||
2017-08-31 (bug)[2a9465] http state 100 continue handling broken (oehlmann)
|
||||
|
||||
2017-09-02 (bug)[0e4d88] replace command, delete trace kills namespace (porter)
|
||||
|
||||
--- Released 8.7a1, September 8, 2017 --- http://core.tcl.tk/tcl/ for details
|
||||
|
||||
2018-03-12 (TIP 490) add oo support for msgcat => msgcat 1.7.0 (oehlmann)
|
||||
|
||||
2018-03-12 (TIP 499) custom locale preference list (oehlmann)
|
||||
=> msgcat 1.7.0
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
/*
|
||||
* float.h --
|
||||
*
|
||||
* This is a dummy header file to #include in Tcl when there
|
||||
* is no float.h in /usr/include. Right now this file is empty:
|
||||
* Tcl contains #ifdefs to deal with the lack of definitions;
|
||||
* all it needs is for the #include statement to work.
|
||||
*
|
||||
* Copyright (c) 1993 The Regents of the University of California.
|
||||
* Copyright (c) 1994 Sun Microsystems, Inc.
|
||||
*
|
||||
* See the file "license.terms" for information on usage and redistribution
|
||||
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
*/
|
||||
+1
-1
@@ -106,5 +106,5 @@ closedir(
|
||||
close(dirp->dd_fd);
|
||||
dirp->dd_fd = -1;
|
||||
dirp->dd_loc = 0;
|
||||
ckfree((char *) dirp);
|
||||
ckfree(dirp);
|
||||
}
|
||||
|
||||
+1
-1
@@ -100,7 +100,7 @@ waitpid(
|
||||
} else {
|
||||
prevPtr->nextPtr = waitPtr->nextPtr;
|
||||
}
|
||||
ckfree((char *) waitPtr);
|
||||
ckfree(waitPtr);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
|
||||
*/
|
||||
|
||||
|
||||
#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__))
|
||||
#ifndef __USE_FILE_OFFSET64
|
||||
#define __USE_FILE_OFFSET64
|
||||
@@ -39,8 +38,7 @@
|
||||
#define FSEEKO_FUNC(stream, offset, origin) fseeko64(stream, offset, origin)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#include "tinydir.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -172,6 +170,7 @@ void do_banner()
|
||||
void do_help()
|
||||
{
|
||||
printf("Usage : minizip [-o] [-a] [-0 to -9] [-p password] [-j] file.zip [files_to_add]\n\n" \
|
||||
" -r Scan directories recursively\n" \
|
||||
" -o Overwrite existing file.zip\n" \
|
||||
" -a Append to existing file.zip\n" \
|
||||
" -0 Store only\n" \
|
||||
@@ -243,12 +242,153 @@ int isLargeFile(const char* filename)
|
||||
return largeFile;
|
||||
}
|
||||
|
||||
void addFileToZip(zipFile zf, const char *filenameinzip, const char *password, int opt_exclude_path,int opt_compress_level) {
|
||||
FILE * fin;
|
||||
int size_read;
|
||||
const char *savefilenameinzip;
|
||||
zip_fileinfo zi;
|
||||
unsigned long crcFile=0;
|
||||
int zip64 = 0;
|
||||
int err=0;
|
||||
int size_buf=WRITEBUFFERSIZE;
|
||||
unsigned char buf[WRITEBUFFERSIZE];
|
||||
zi.tmz_date.tm_sec = zi.tmz_date.tm_min = zi.tmz_date.tm_hour =
|
||||
zi.tmz_date.tm_mday = zi.tmz_date.tm_mon = zi.tmz_date.tm_year = 0;
|
||||
zi.dosDate = 0;
|
||||
zi.internal_fa = 0;
|
||||
zi.external_fa = 0;
|
||||
filetime(filenameinzip,&zi.tmz_date,&zi.dosDate);
|
||||
|
||||
/*
|
||||
err = zipOpenNewFileInZip(zf,filenameinzip,&zi,
|
||||
NULL,0,NULL,0,NULL / * comment * /,
|
||||
(opt_compress_level != 0) ? Z_DEFLATED : 0,
|
||||
opt_compress_level);
|
||||
*/
|
||||
if ((password != NULL) && (err==ZIP_OK))
|
||||
err = getFileCrc(filenameinzip,buf,size_buf,&crcFile);
|
||||
|
||||
zip64 = isLargeFile(filenameinzip);
|
||||
|
||||
/* The path name saved, should not include a leading slash. */
|
||||
/*if it did, windows/xp and dynazip couldn't read the zip file. */
|
||||
savefilenameinzip = filenameinzip;
|
||||
while( savefilenameinzip[0] == '\\' || savefilenameinzip[0] == '/' )
|
||||
{
|
||||
savefilenameinzip++;
|
||||
}
|
||||
|
||||
/*should the zip file contain any path at all?*/
|
||||
if( opt_exclude_path )
|
||||
{
|
||||
const char *tmpptr;
|
||||
const char *lastslash = 0;
|
||||
for( tmpptr = savefilenameinzip; *tmpptr; tmpptr++)
|
||||
{
|
||||
if( *tmpptr == '\\' || *tmpptr == '/')
|
||||
{
|
||||
lastslash = tmpptr;
|
||||
}
|
||||
}
|
||||
if( lastslash != NULL )
|
||||
{
|
||||
savefilenameinzip = lastslash+1; // base filename follows last slash.
|
||||
}
|
||||
}
|
||||
|
||||
/**/
|
||||
err = zipOpenNewFileInZip3_64(zf,savefilenameinzip,&zi,
|
||||
NULL,0,NULL,0,NULL /* comment*/,
|
||||
(opt_compress_level != 0) ? Z_DEFLATED : 0,
|
||||
opt_compress_level,0,
|
||||
/* -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, */
|
||||
-MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
|
||||
password,crcFile, zip64);
|
||||
|
||||
if (err != ZIP_OK)
|
||||
printf("error in opening %s in zipfile\n",filenameinzip);
|
||||
else
|
||||
{
|
||||
fin = FOPEN_FUNC(filenameinzip,"rb");
|
||||
if (fin==NULL)
|
||||
{
|
||||
err=ZIP_ERRNO;
|
||||
printf("error in opening %s for reading\n",filenameinzip);
|
||||
}
|
||||
}
|
||||
|
||||
if (err == ZIP_OK)
|
||||
do
|
||||
{
|
||||
err = ZIP_OK;
|
||||
size_read = (int)fread(buf,1,size_buf,fin);
|
||||
if (size_read < size_buf)
|
||||
if (feof(fin)==0)
|
||||
{
|
||||
printf("error in reading %s\n",filenameinzip);
|
||||
err = ZIP_ERRNO;
|
||||
}
|
||||
|
||||
if (size_read>0)
|
||||
{
|
||||
err = zipWriteInFileInZip (zf,buf,size_read);
|
||||
if (err<0)
|
||||
{
|
||||
printf("error in writing %s in the zipfile\n",
|
||||
filenameinzip);
|
||||
}
|
||||
|
||||
}
|
||||
} while ((err == ZIP_OK) && (size_read>0));
|
||||
|
||||
if (fin)
|
||||
fclose(fin);
|
||||
|
||||
if (err<0)
|
||||
err=ZIP_ERRNO;
|
||||
else
|
||||
{
|
||||
err = zipCloseFileInZip(zf);
|
||||
if (err!=ZIP_OK)
|
||||
printf("error in closing %s in the zipfile\n",
|
||||
filenameinzip);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void addPathToZip(zipFile zf, const char *filenameinzip, const char *password, int opt_exclude_path,int opt_compress_level) {
|
||||
tinydir_dir dir;
|
||||
int i;
|
||||
char *newname[512];
|
||||
|
||||
tinydir_open_sorted(&dir, filenameinzip);
|
||||
|
||||
for (i = 0; i < dir.n_files; i++)
|
||||
{
|
||||
tinydir_file file;
|
||||
tinydir_readfile_n(&dir, &file, i);
|
||||
if(strcmp(file.name,".")==0) continue;
|
||||
if(strcmp(file.name,"..")==0) continue;
|
||||
sprintf(newname,"%s/%s",dir.path,file.name);
|
||||
if (file.is_dir)
|
||||
{
|
||||
addPathToZip(zf,newname,password,opt_exclude_path,opt_compress_level);
|
||||
} else {
|
||||
addFileToZip(zf,newname,password,opt_exclude_path,opt_compress_level);
|
||||
}
|
||||
}
|
||||
|
||||
tinydir_close(&dir);
|
||||
}
|
||||
|
||||
|
||||
int main(argc,argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
int i;
|
||||
int opt_overwrite=0;
|
||||
int opt_recursive=0;
|
||||
int opt_overwrite=1;
|
||||
int opt_compress_level=Z_DEFAULT_COMPRESSION;
|
||||
int opt_exclude_path=0;
|
||||
int zipfilenamearg = 0;
|
||||
@@ -285,7 +425,8 @@ int main(argc,argv)
|
||||
opt_compress_level = c-'0';
|
||||
if ((c=='j') || (c=='J'))
|
||||
opt_exclude_path = 1;
|
||||
|
||||
if ((c=='r') || (c=='R'))
|
||||
opt_recursive = 1;
|
||||
if (((c=='p') || (c=='P')) && (i+1<argc))
|
||||
{
|
||||
password=argv[i+1];
|
||||
@@ -392,117 +533,14 @@ int main(argc,argv)
|
||||
((argv[i][1]=='o') || (argv[i][1]=='O') ||
|
||||
(argv[i][1]=='a') || (argv[i][1]=='A') ||
|
||||
(argv[i][1]=='p') || (argv[i][1]=='P') ||
|
||||
(argv[i][1]=='r') || (argv[i][1]=='R') ||
|
||||
((argv[i][1]>='0') || (argv[i][1]<='9'))) &&
|
||||
(strlen(argv[i]) == 2)))
|
||||
{
|
||||
FILE * fin;
|
||||
int size_read;
|
||||
const char* filenameinzip = argv[i];
|
||||
const char *savefilenameinzip;
|
||||
zip_fileinfo zi;
|
||||
unsigned long crcFile=0;
|
||||
int zip64 = 0;
|
||||
|
||||
zi.tmz_date.tm_sec = zi.tmz_date.tm_min = zi.tmz_date.tm_hour =
|
||||
zi.tmz_date.tm_mday = zi.tmz_date.tm_mon = zi.tmz_date.tm_year = 0;
|
||||
zi.dosDate = 0;
|
||||
zi.internal_fa = 0;
|
||||
zi.external_fa = 0;
|
||||
filetime(filenameinzip,&zi.tmz_date,&zi.dosDate);
|
||||
|
||||
/*
|
||||
err = zipOpenNewFileInZip(zf,filenameinzip,&zi,
|
||||
NULL,0,NULL,0,NULL / * comment * /,
|
||||
(opt_compress_level != 0) ? Z_DEFLATED : 0,
|
||||
opt_compress_level);
|
||||
*/
|
||||
if ((password != NULL) && (err==ZIP_OK))
|
||||
err = getFileCrc(filenameinzip,buf,size_buf,&crcFile);
|
||||
|
||||
zip64 = isLargeFile(filenameinzip);
|
||||
|
||||
/* The path name saved, should not include a leading slash. */
|
||||
/*if it did, windows/xp and dynazip couldn't read the zip file. */
|
||||
savefilenameinzip = filenameinzip;
|
||||
while( savefilenameinzip[0] == '\\' || savefilenameinzip[0] == '/' )
|
||||
{
|
||||
savefilenameinzip++;
|
||||
}
|
||||
|
||||
/*should the zip file contain any path at all?*/
|
||||
if( opt_exclude_path )
|
||||
{
|
||||
const char *tmpptr;
|
||||
const char *lastslash = 0;
|
||||
for( tmpptr = savefilenameinzip; *tmpptr; tmpptr++)
|
||||
{
|
||||
if( *tmpptr == '\\' || *tmpptr == '/')
|
||||
{
|
||||
lastslash = tmpptr;
|
||||
}
|
||||
}
|
||||
if( lastslash != NULL )
|
||||
{
|
||||
savefilenameinzip = lastslash+1; // base filename follows last slash.
|
||||
}
|
||||
}
|
||||
|
||||
/**/
|
||||
err = zipOpenNewFileInZip3_64(zf,savefilenameinzip,&zi,
|
||||
NULL,0,NULL,0,NULL /* comment*/,
|
||||
(opt_compress_level != 0) ? Z_DEFLATED : 0,
|
||||
opt_compress_level,0,
|
||||
/* -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, */
|
||||
-MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
|
||||
password,crcFile, zip64);
|
||||
|
||||
if (err != ZIP_OK)
|
||||
printf("error in opening %s in zipfile\n",filenameinzip);
|
||||
else
|
||||
{
|
||||
fin = FOPEN_FUNC(filenameinzip,"rb");
|
||||
if (fin==NULL)
|
||||
{
|
||||
err=ZIP_ERRNO;
|
||||
printf("error in opening %s for reading\n",filenameinzip);
|
||||
}
|
||||
}
|
||||
|
||||
if (err == ZIP_OK)
|
||||
do
|
||||
{
|
||||
err = ZIP_OK;
|
||||
size_read = (int)fread(buf,1,size_buf,fin);
|
||||
if (size_read < size_buf)
|
||||
if (feof(fin)==0)
|
||||
{
|
||||
printf("error in reading %s\n",filenameinzip);
|
||||
err = ZIP_ERRNO;
|
||||
}
|
||||
|
||||
if (size_read>0)
|
||||
{
|
||||
err = zipWriteInFileInZip (zf,buf,size_read);
|
||||
if (err<0)
|
||||
{
|
||||
printf("error in writing %s in the zipfile\n",
|
||||
filenameinzip);
|
||||
}
|
||||
|
||||
}
|
||||
} while ((err == ZIP_OK) && (size_read>0));
|
||||
|
||||
if (fin)
|
||||
fclose(fin);
|
||||
|
||||
if (err<0)
|
||||
err=ZIP_ERRNO;
|
||||
else
|
||||
{
|
||||
err = zipCloseFileInZip(zf);
|
||||
if (err!=ZIP_OK)
|
||||
printf("error in closing %s in the zipfile\n",
|
||||
filenameinzip);
|
||||
if(opt_recursive) {
|
||||
addPathToZip(zf,argv[i],password,opt_exclude_path,opt_compress_level);
|
||||
} else {
|
||||
addFileToZip(zf,argv[i],password,opt_exclude_path,opt_compress_level);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Executable
+816
@@ -0,0 +1,816 @@
|
||||
/*
|
||||
Copyright (c) 2013-2017, tinydir authors:
|
||||
- Cong Xu
|
||||
- Lautis Sun
|
||||
- Baudouin Feildel
|
||||
- Andargor <andargor@yahoo.com>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef TINYDIR_H
|
||||
#define TINYDIR_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if ((defined _UNICODE) && !(defined UNICODE))
|
||||
#define UNICODE
|
||||
#endif
|
||||
|
||||
#if ((defined UNICODE) && !(defined _UNICODE))
|
||||
#define _UNICODE
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#ifdef _MSC_VER
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
# include <tchar.h>
|
||||
# pragma warning(push)
|
||||
# pragma warning (disable : 4996)
|
||||
#else
|
||||
# include <dirent.h>
|
||||
# include <libgen.h>
|
||||
# include <sys/stat.h>
|
||||
# include <stddef.h>
|
||||
#endif
|
||||
#ifdef __MINGW32__
|
||||
# include <tchar.h>
|
||||
#endif
|
||||
|
||||
|
||||
/* types */
|
||||
|
||||
/* Windows UNICODE wide character support */
|
||||
#if defined _MSC_VER || defined __MINGW32__
|
||||
# define _tinydir_char_t TCHAR
|
||||
# define TINYDIR_STRING(s) _TEXT(s)
|
||||
# define _tinydir_strlen _tcslen
|
||||
# define _tinydir_strcpy _tcscpy
|
||||
# define _tinydir_strcat _tcscat
|
||||
# define _tinydir_strcmp _tcscmp
|
||||
# define _tinydir_strrchr _tcsrchr
|
||||
# define _tinydir_strncmp _tcsncmp
|
||||
#else
|
||||
# define _tinydir_char_t char
|
||||
# define TINYDIR_STRING(s) s
|
||||
# define _tinydir_strlen strlen
|
||||
# define _tinydir_strcpy strcpy
|
||||
# define _tinydir_strcat strcat
|
||||
# define _tinydir_strcmp strcmp
|
||||
# define _tinydir_strrchr strrchr
|
||||
# define _tinydir_strncmp strncmp
|
||||
#endif
|
||||
|
||||
#if (defined _MSC_VER || defined __MINGW32__)
|
||||
# include <windows.h>
|
||||
# define _TINYDIR_PATH_MAX MAX_PATH
|
||||
#elif defined __linux__
|
||||
# include <limits.h>
|
||||
# define _TINYDIR_PATH_MAX PATH_MAX
|
||||
#elif defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
|
||||
# include <sys/param.h>
|
||||
# if defined(BSD)
|
||||
# include <limits.h>
|
||||
# define _TINYDIR_PATH_MAX PATH_MAX
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef _TINYDIR_PATH_MAX
|
||||
#define _TINYDIR_PATH_MAX 4096
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
/* extra chars for the "\\*" mask */
|
||||
# define _TINYDIR_PATH_EXTRA 2
|
||||
#else
|
||||
# define _TINYDIR_PATH_EXTRA 0
|
||||
#endif
|
||||
|
||||
#define _TINYDIR_FILENAME_MAX 256
|
||||
|
||||
#if (defined _MSC_VER || defined __MINGW32__)
|
||||
#define _TINYDIR_DRIVE_MAX 3
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# define _TINYDIR_FUNC static __inline
|
||||
#elif !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L
|
||||
# define _TINYDIR_FUNC static __inline__
|
||||
#else
|
||||
# define _TINYDIR_FUNC static inline
|
||||
#endif
|
||||
|
||||
/* readdir_r usage; define TINYDIR_USE_READDIR_R to use it (if supported) */
|
||||
#ifdef TINYDIR_USE_READDIR_R
|
||||
|
||||
/* readdir_r is a POSIX-only function, and may not be available under various
|
||||
* environments/settings, e.g. MinGW. Use readdir fallback */
|
||||
#if _POSIX_C_SOURCE >= 1 || _XOPEN_SOURCE || _BSD_SOURCE || _SVID_SOURCE ||\
|
||||
_POSIX_SOURCE
|
||||
# define _TINYDIR_HAS_READDIR_R
|
||||
#endif
|
||||
#if _POSIX_C_SOURCE >= 200112L
|
||||
# define _TINYDIR_HAS_FPATHCONF
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#if _BSD_SOURCE || _SVID_SOURCE || \
|
||||
(_POSIX_C_SOURCE >= 200809L || _XOPEN_SOURCE >= 700)
|
||||
# define _TINYDIR_HAS_DIRFD
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
#if defined _TINYDIR_HAS_FPATHCONF && defined _TINYDIR_HAS_DIRFD &&\
|
||||
defined _PC_NAME_MAX
|
||||
# define _TINYDIR_USE_FPATHCONF
|
||||
#endif
|
||||
#if defined __MINGW32__ || !defined _TINYDIR_HAS_READDIR_R ||\
|
||||
!(defined _TINYDIR_USE_FPATHCONF || defined NAME_MAX)
|
||||
# define _TINYDIR_USE_READDIR
|
||||
#endif
|
||||
|
||||
/* Use readdir by default */
|
||||
#else
|
||||
# define _TINYDIR_USE_READDIR
|
||||
#endif
|
||||
|
||||
/* MINGW32 has two versions of dirent, ASCII and UNICODE*/
|
||||
#ifndef _MSC_VER
|
||||
#if (defined __MINGW32__) && (defined _UNICODE)
|
||||
#define _TINYDIR_DIR _WDIR
|
||||
#define _tinydir_dirent _wdirent
|
||||
#define _tinydir_opendir _wopendir
|
||||
#define _tinydir_readdir _wreaddir
|
||||
#define _tinydir_closedir _wclosedir
|
||||
#else
|
||||
#define _TINYDIR_DIR DIR
|
||||
#define _tinydir_dirent dirent
|
||||
#define _tinydir_opendir opendir
|
||||
#define _tinydir_readdir readdir
|
||||
#define _tinydir_closedir closedir
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Allow user to use a custom allocator by defining _TINYDIR_MALLOC and _TINYDIR_FREE. */
|
||||
#if defined(_TINYDIR_MALLOC) && defined(_TINYDIR_FREE)
|
||||
#elif !defined(_TINYDIR_MALLOC) && !defined(_TINYDIR_FREE)
|
||||
#else
|
||||
#error "Either define both alloc and free or none of them!"
|
||||
#endif
|
||||
|
||||
#if !defined(_TINYDIR_MALLOC)
|
||||
#define _TINYDIR_MALLOC(_size) malloc(_size)
|
||||
#define _TINYDIR_FREE(_ptr) free(_ptr)
|
||||
#endif /* !defined(_TINYDIR_MALLOC) */
|
||||
|
||||
typedef struct tinydir_file
|
||||
{
|
||||
_tinydir_char_t path[_TINYDIR_PATH_MAX];
|
||||
_tinydir_char_t name[_TINYDIR_FILENAME_MAX];
|
||||
_tinydir_char_t *extension;
|
||||
int is_dir;
|
||||
int is_reg;
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#ifdef __MINGW32__
|
||||
struct _stat _s;
|
||||
#else
|
||||
struct stat _s;
|
||||
#endif
|
||||
#endif
|
||||
} tinydir_file;
|
||||
|
||||
typedef struct tinydir_dir
|
||||
{
|
||||
_tinydir_char_t path[_TINYDIR_PATH_MAX];
|
||||
int has_next;
|
||||
size_t n_files;
|
||||
|
||||
tinydir_file *_files;
|
||||
#ifdef _MSC_VER
|
||||
HANDLE _h;
|
||||
WIN32_FIND_DATA _f;
|
||||
#else
|
||||
_TINYDIR_DIR *_d;
|
||||
struct _tinydir_dirent *_e;
|
||||
#ifndef _TINYDIR_USE_READDIR
|
||||
struct _tinydir_dirent *_ep;
|
||||
#endif
|
||||
#endif
|
||||
} tinydir_dir;
|
||||
|
||||
|
||||
/* declarations */
|
||||
|
||||
_TINYDIR_FUNC
|
||||
int tinydir_open(tinydir_dir *dir, const _tinydir_char_t *path);
|
||||
_TINYDIR_FUNC
|
||||
int tinydir_open_sorted(tinydir_dir *dir, const _tinydir_char_t *path);
|
||||
_TINYDIR_FUNC
|
||||
void tinydir_close(tinydir_dir *dir);
|
||||
|
||||
_TINYDIR_FUNC
|
||||
int tinydir_next(tinydir_dir *dir);
|
||||
_TINYDIR_FUNC
|
||||
int tinydir_readfile(const tinydir_dir *dir, tinydir_file *file);
|
||||
_TINYDIR_FUNC
|
||||
int tinydir_readfile_n(const tinydir_dir *dir, tinydir_file *file, size_t i);
|
||||
_TINYDIR_FUNC
|
||||
int tinydir_open_subdir_n(tinydir_dir *dir, size_t i);
|
||||
|
||||
_TINYDIR_FUNC
|
||||
int tinydir_file_open(tinydir_file *file, const _tinydir_char_t *path);
|
||||
_TINYDIR_FUNC
|
||||
void _tinydir_get_ext(tinydir_file *file);
|
||||
_TINYDIR_FUNC
|
||||
int _tinydir_file_cmp(const void *a, const void *b);
|
||||
#ifndef _MSC_VER
|
||||
#ifndef _TINYDIR_USE_READDIR
|
||||
_TINYDIR_FUNC
|
||||
size_t _tinydir_dirent_buf_size(_TINYDIR_DIR *dirp);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* definitions*/
|
||||
|
||||
_TINYDIR_FUNC
|
||||
int tinydir_open(tinydir_dir *dir, const _tinydir_char_t *path)
|
||||
{
|
||||
#ifndef _MSC_VER
|
||||
#ifndef _TINYDIR_USE_READDIR
|
||||
int error;
|
||||
int size; /* using int size */
|
||||
#endif
|
||||
#else
|
||||
_tinydir_char_t path_buf[_TINYDIR_PATH_MAX];
|
||||
#endif
|
||||
_tinydir_char_t *pathp;
|
||||
|
||||
if (dir == NULL || path == NULL || _tinydir_strlen(path) == 0)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
if (_tinydir_strlen(path) + _TINYDIR_PATH_EXTRA >= _TINYDIR_PATH_MAX)
|
||||
{
|
||||
errno = ENAMETOOLONG;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* initialise dir */
|
||||
dir->_files = NULL;
|
||||
#ifdef _MSC_VER
|
||||
dir->_h = INVALID_HANDLE_VALUE;
|
||||
#else
|
||||
dir->_d = NULL;
|
||||
#ifndef _TINYDIR_USE_READDIR
|
||||
dir->_ep = NULL;
|
||||
#endif
|
||||
#endif
|
||||
tinydir_close(dir);
|
||||
|
||||
_tinydir_strcpy(dir->path, path);
|
||||
/* Remove trailing slashes */
|
||||
pathp = &dir->path[_tinydir_strlen(dir->path) - 1];
|
||||
while (pathp != dir->path && (*pathp == TINYDIR_STRING('\\') || *pathp == TINYDIR_STRING('/')))
|
||||
{
|
||||
*pathp = TINYDIR_STRING('\0');
|
||||
pathp++;
|
||||
}
|
||||
#ifdef _MSC_VER
|
||||
_tinydir_strcpy(path_buf, dir->path);
|
||||
_tinydir_strcat(path_buf, TINYDIR_STRING("\\*"));
|
||||
#if (defined WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP)
|
||||
dir->_h = FindFirstFileEx(path_buf, FindExInfoStandard, &dir->_f, FindExSearchNameMatch, NULL, 0);
|
||||
#else
|
||||
dir->_h = FindFirstFile(path_buf, &dir->_f);
|
||||
#endif
|
||||
if (dir->_h == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
errno = ENOENT;
|
||||
#else
|
||||
dir->_d = _tinydir_opendir(path);
|
||||
if (dir->_d == NULL)
|
||||
{
|
||||
#endif
|
||||
goto bail;
|
||||
}
|
||||
|
||||
/* read first file */
|
||||
dir->has_next = 1;
|
||||
#ifndef _MSC_VER
|
||||
#ifdef _TINYDIR_USE_READDIR
|
||||
dir->_e = _tinydir_readdir(dir->_d);
|
||||
#else
|
||||
/* allocate dirent buffer for readdir_r */
|
||||
size = _tinydir_dirent_buf_size(dir->_d); /* conversion to int */
|
||||
if (size == -1) return -1;
|
||||
dir->_ep = (struct _tinydir_dirent*)_TINYDIR_MALLOC(size);
|
||||
if (dir->_ep == NULL) return -1;
|
||||
|
||||
error = readdir_r(dir->_d, dir->_ep, &dir->_e);
|
||||
if (error != 0) return -1;
|
||||
#endif
|
||||
if (dir->_e == NULL)
|
||||
{
|
||||
dir->has_next = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
bail:
|
||||
tinydir_close(dir);
|
||||
return -1;
|
||||
}
|
||||
|
||||
_TINYDIR_FUNC
|
||||
int tinydir_open_sorted(tinydir_dir *dir, const _tinydir_char_t *path)
|
||||
{
|
||||
/* Count the number of files first, to pre-allocate the files array */
|
||||
size_t n_files = 0;
|
||||
if (tinydir_open(dir, path) == -1)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
while (dir->has_next)
|
||||
{
|
||||
n_files++;
|
||||
if (tinydir_next(dir) == -1)
|
||||
{
|
||||
goto bail;
|
||||
}
|
||||
}
|
||||
tinydir_close(dir);
|
||||
|
||||
if (tinydir_open(dir, path) == -1)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
dir->n_files = 0;
|
||||
dir->_files = (tinydir_file *)_TINYDIR_MALLOC(sizeof *dir->_files * n_files);
|
||||
if (dir->_files == NULL)
|
||||
{
|
||||
goto bail;
|
||||
}
|
||||
while (dir->has_next)
|
||||
{
|
||||
tinydir_file *p_file;
|
||||
dir->n_files++;
|
||||
|
||||
p_file = &dir->_files[dir->n_files - 1];
|
||||
if (tinydir_readfile(dir, p_file) == -1)
|
||||
{
|
||||
goto bail;
|
||||
}
|
||||
|
||||
if (tinydir_next(dir) == -1)
|
||||
{
|
||||
goto bail;
|
||||
}
|
||||
|
||||
/* Just in case the number of files has changed between the first and
|
||||
second reads, terminate without writing into unallocated memory */
|
||||
if (dir->n_files == n_files)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
qsort(dir->_files, dir->n_files, sizeof(tinydir_file), _tinydir_file_cmp);
|
||||
|
||||
return 0;
|
||||
|
||||
bail:
|
||||
tinydir_close(dir);
|
||||
return -1;
|
||||
}
|
||||
|
||||
_TINYDIR_FUNC
|
||||
void tinydir_close(tinydir_dir *dir)
|
||||
{
|
||||
if (dir == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
memset(dir->path, 0, sizeof(dir->path));
|
||||
dir->has_next = 0;
|
||||
dir->n_files = 0;
|
||||
_TINYDIR_FREE(dir->_files);
|
||||
dir->_files = NULL;
|
||||
#ifdef _MSC_VER
|
||||
if (dir->_h != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
FindClose(dir->_h);
|
||||
}
|
||||
dir->_h = INVALID_HANDLE_VALUE;
|
||||
#else
|
||||
if (dir->_d)
|
||||
{
|
||||
_tinydir_closedir(dir->_d);
|
||||
}
|
||||
dir->_d = NULL;
|
||||
dir->_e = NULL;
|
||||
#ifndef _TINYDIR_USE_READDIR
|
||||
_TINYDIR_FREE(dir->_ep);
|
||||
dir->_ep = NULL;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
_TINYDIR_FUNC
|
||||
int tinydir_next(tinydir_dir *dir)
|
||||
{
|
||||
if (dir == NULL)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
if (!dir->has_next)
|
||||
{
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
if (FindNextFile(dir->_h, &dir->_f) == 0)
|
||||
#else
|
||||
#ifdef _TINYDIR_USE_READDIR
|
||||
dir->_e = _tinydir_readdir(dir->_d);
|
||||
#else
|
||||
if (dir->_ep == NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
if (readdir_r(dir->_d, dir->_ep, &dir->_e) != 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
if (dir->_e == NULL)
|
||||
#endif
|
||||
{
|
||||
dir->has_next = 0;
|
||||
#ifdef _MSC_VER
|
||||
if (GetLastError() != ERROR_SUCCESS &&
|
||||
GetLastError() != ERROR_NO_MORE_FILES)
|
||||
{
|
||||
tinydir_close(dir);
|
||||
errno = EIO;
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
_TINYDIR_FUNC
|
||||
int tinydir_readfile(const tinydir_dir *dir, tinydir_file *file)
|
||||
{
|
||||
if (dir == NULL || file == NULL)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
#ifdef _MSC_VER
|
||||
if (dir->_h == INVALID_HANDLE_VALUE)
|
||||
#else
|
||||
if (dir->_e == NULL)
|
||||
#endif
|
||||
{
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
if (_tinydir_strlen(dir->path) +
|
||||
_tinydir_strlen(
|
||||
#ifdef _MSC_VER
|
||||
dir->_f.cFileName
|
||||
#else
|
||||
dir->_e->d_name
|
||||
#endif
|
||||
) + 1 + _TINYDIR_PATH_EXTRA >=
|
||||
_TINYDIR_PATH_MAX)
|
||||
{
|
||||
/* the path for the file will be too long */
|
||||
errno = ENAMETOOLONG;
|
||||
return -1;
|
||||
}
|
||||
if (_tinydir_strlen(
|
||||
#ifdef _MSC_VER
|
||||
dir->_f.cFileName
|
||||
#else
|
||||
dir->_e->d_name
|
||||
#endif
|
||||
) >= _TINYDIR_FILENAME_MAX)
|
||||
{
|
||||
errno = ENAMETOOLONG;
|
||||
return -1;
|
||||
}
|
||||
|
||||
_tinydir_strcpy(file->path, dir->path);
|
||||
_tinydir_strcat(file->path, TINYDIR_STRING("/"));
|
||||
_tinydir_strcpy(file->name,
|
||||
#ifdef _MSC_VER
|
||||
dir->_f.cFileName
|
||||
#else
|
||||
dir->_e->d_name
|
||||
#endif
|
||||
);
|
||||
_tinydir_strcat(file->path, file->name);
|
||||
#ifndef _MSC_VER
|
||||
#ifdef __MINGW32__
|
||||
if (_tstat(
|
||||
#else
|
||||
if (stat(
|
||||
#endif
|
||||
file->path, &file->_s) == -1)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
_tinydir_get_ext(file);
|
||||
|
||||
file->is_dir =
|
||||
#ifdef _MSC_VER
|
||||
!!(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY);
|
||||
#else
|
||||
S_ISDIR(file->_s.st_mode);
|
||||
#endif
|
||||
file->is_reg =
|
||||
#ifdef _MSC_VER
|
||||
!!(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_NORMAL) ||
|
||||
(
|
||||
!(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_DEVICE) &&
|
||||
!(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) &&
|
||||
!(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_ENCRYPTED) &&
|
||||
#ifdef FILE_ATTRIBUTE_INTEGRITY_STREAM
|
||||
!(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_INTEGRITY_STREAM) &&
|
||||
#endif
|
||||
#ifdef FILE_ATTRIBUTE_NO_SCRUB_DATA
|
||||
!(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_NO_SCRUB_DATA) &&
|
||||
#endif
|
||||
!(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_OFFLINE) &&
|
||||
!(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_TEMPORARY));
|
||||
#else
|
||||
S_ISREG(file->_s.st_mode);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
_TINYDIR_FUNC
|
||||
int tinydir_readfile_n(const tinydir_dir *dir, tinydir_file *file, size_t i)
|
||||
{
|
||||
if (dir == NULL || file == NULL)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
if (i >= dir->n_files)
|
||||
{
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
memcpy(file, &dir->_files[i], sizeof(tinydir_file));
|
||||
_tinydir_get_ext(file);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
_TINYDIR_FUNC
|
||||
int tinydir_open_subdir_n(tinydir_dir *dir, size_t i)
|
||||
{
|
||||
_tinydir_char_t path[_TINYDIR_PATH_MAX];
|
||||
if (dir == NULL)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
if (i >= dir->n_files || !dir->_files[i].is_dir)
|
||||
{
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
_tinydir_strcpy(path, dir->_files[i].path);
|
||||
tinydir_close(dir);
|
||||
if (tinydir_open_sorted(dir, path) == -1)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Open a single file given its path */
|
||||
_TINYDIR_FUNC
|
||||
int tinydir_file_open(tinydir_file *file, const _tinydir_char_t *path)
|
||||
{
|
||||
tinydir_dir dir;
|
||||
int result = 0;
|
||||
int found = 0;
|
||||
_tinydir_char_t dir_name_buf[_TINYDIR_PATH_MAX];
|
||||
_tinydir_char_t file_name_buf[_TINYDIR_FILENAME_MAX];
|
||||
_tinydir_char_t *dir_name;
|
||||
_tinydir_char_t *base_name;
|
||||
#if (defined _MSC_VER || defined __MINGW32__)
|
||||
_tinydir_char_t drive_buf[_TINYDIR_PATH_MAX];
|
||||
_tinydir_char_t ext_buf[_TINYDIR_FILENAME_MAX];
|
||||
#endif
|
||||
|
||||
if (file == NULL || path == NULL || _tinydir_strlen(path) == 0)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
if (_tinydir_strlen(path) + _TINYDIR_PATH_EXTRA >= _TINYDIR_PATH_MAX)
|
||||
{
|
||||
errno = ENAMETOOLONG;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Get the parent path */
|
||||
#if (defined _MSC_VER || defined __MINGW32__)
|
||||
#if ((defined _MSC_VER) && (_MSC_VER >= 1400))
|
||||
_tsplitpath_s(
|
||||
path,
|
||||
drive_buf, _TINYDIR_DRIVE_MAX,
|
||||
dir_name_buf, _TINYDIR_FILENAME_MAX,
|
||||
file_name_buf, _TINYDIR_FILENAME_MAX,
|
||||
ext_buf, _TINYDIR_FILENAME_MAX);
|
||||
#else
|
||||
_tsplitpath(
|
||||
path,
|
||||
drive_buf,
|
||||
dir_name_buf,
|
||||
file_name_buf,
|
||||
ext_buf);
|
||||
#endif
|
||||
|
||||
/* _splitpath_s not work fine with only filename and widechar support */
|
||||
#ifdef _UNICODE
|
||||
if (drive_buf[0] == L'\xFEFE')
|
||||
drive_buf[0] = '\0';
|
||||
if (dir_name_buf[0] == L'\xFEFE')
|
||||
dir_name_buf[0] = '\0';
|
||||
#endif
|
||||
|
||||
if (errno)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
/* Emulate the behavior of dirname by returning "." for dir name if it's
|
||||
empty */
|
||||
if (drive_buf[0] == '\0' && dir_name_buf[0] == '\0')
|
||||
{
|
||||
_tinydir_strcpy(dir_name_buf, TINYDIR_STRING("."));
|
||||
}
|
||||
/* Concatenate the drive letter and dir name to form full dir name */
|
||||
_tinydir_strcat(drive_buf, dir_name_buf);
|
||||
dir_name = drive_buf;
|
||||
/* Concatenate the file name and extension to form base name */
|
||||
_tinydir_strcat(file_name_buf, ext_buf);
|
||||
base_name = file_name_buf;
|
||||
#else
|
||||
_tinydir_strcpy(dir_name_buf, path);
|
||||
dir_name = dirname(dir_name_buf);
|
||||
_tinydir_strcpy(file_name_buf, path);
|
||||
base_name =basename(file_name_buf);
|
||||
#endif
|
||||
|
||||
/* Open the parent directory */
|
||||
if (tinydir_open(&dir, dir_name) == -1)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Read through the parent directory and look for the file */
|
||||
while (dir.has_next)
|
||||
{
|
||||
if (tinydir_readfile(&dir, file) == -1)
|
||||
{
|
||||
result = -1;
|
||||
goto bail;
|
||||
}
|
||||
if (_tinydir_strcmp(file->name, base_name) == 0)
|
||||
{
|
||||
/* File found */
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
tinydir_next(&dir);
|
||||
}
|
||||
if (!found)
|
||||
{
|
||||
result = -1;
|
||||
errno = ENOENT;
|
||||
}
|
||||
|
||||
bail:
|
||||
tinydir_close(&dir);
|
||||
return result;
|
||||
}
|
||||
|
||||
_TINYDIR_FUNC
|
||||
void _tinydir_get_ext(tinydir_file *file)
|
||||
{
|
||||
_tinydir_char_t *period = _tinydir_strrchr(file->name, TINYDIR_STRING('.'));
|
||||
if (period == NULL)
|
||||
{
|
||||
file->extension = &(file->name[_tinydir_strlen(file->name)]);
|
||||
}
|
||||
else
|
||||
{
|
||||
file->extension = period + 1;
|
||||
}
|
||||
}
|
||||
|
||||
_TINYDIR_FUNC
|
||||
int _tinydir_file_cmp(const void *a, const void *b)
|
||||
{
|
||||
const tinydir_file *fa = (const tinydir_file *)a;
|
||||
const tinydir_file *fb = (const tinydir_file *)b;
|
||||
if (fa->is_dir != fb->is_dir)
|
||||
{
|
||||
return -(fa->is_dir - fb->is_dir);
|
||||
}
|
||||
return _tinydir_strncmp(fa->name, fb->name, _TINYDIR_FILENAME_MAX);
|
||||
}
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#ifndef _TINYDIR_USE_READDIR
|
||||
/*
|
||||
The following authored by Ben Hutchings <ben@decadent.org.uk>
|
||||
from https://womble.decadent.org.uk/readdir_r-advisory.html
|
||||
*/
|
||||
/* Calculate the required buffer size (in bytes) for directory *
|
||||
* entries read from the given directory handle. Return -1 if this *
|
||||
* this cannot be done. *
|
||||
* *
|
||||
* This code does not trust values of NAME_MAX that are less than *
|
||||
* 255, since some systems (including at least HP-UX) incorrectly *
|
||||
* define it to be a smaller value. */
|
||||
_TINYDIR_FUNC
|
||||
size_t _tinydir_dirent_buf_size(_TINYDIR_DIR *dirp)
|
||||
{
|
||||
long name_max;
|
||||
size_t name_end;
|
||||
/* parameter may be unused */
|
||||
(void)dirp;
|
||||
|
||||
#if defined _TINYDIR_USE_FPATHCONF
|
||||
name_max = fpathconf(dirfd(dirp), _PC_NAME_MAX);
|
||||
if (name_max == -1)
|
||||
#if defined(NAME_MAX)
|
||||
name_max = (NAME_MAX > 255) ? NAME_MAX : 255;
|
||||
#else
|
||||
return (size_t)(-1);
|
||||
#endif
|
||||
#elif defined(NAME_MAX)
|
||||
name_max = (NAME_MAX > 255) ? NAME_MAX : 255;
|
||||
#else
|
||||
#error "buffer size for readdir_r cannot be determined"
|
||||
#endif
|
||||
name_end = (size_t)offsetof(struct _tinydir_dirent, d_name) + name_max + 1;
|
||||
return (name_end > sizeof(struct _tinydir_dirent) ?
|
||||
name_end : sizeof(struct _tinydir_dirent));
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
# if defined (_MSC_VER)
|
||||
# pragma warning(pop)
|
||||
# endif
|
||||
|
||||
#endif
|
||||
+1
-1
@@ -119,7 +119,7 @@ retrieve the stack trace when script evaluation returns
|
||||
\fBTCL_ERROR\fR, like so:
|
||||
.PP
|
||||
.CS
|
||||
int code = Tcl_Eval(interp, script);
|
||||
int code = Tcl_EvalEx(interp, script, -1, 0);
|
||||
if (code == TCL_ERROR) {
|
||||
Tcl_Obj *options = \fBTcl_GetReturnOptions\fR(interp, code);
|
||||
Tcl_Obj *key = Tcl_NewStringObj("-errorinfo", -1);
|
||||
|
||||
+1
-1
@@ -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_CallWhenDeleted 3 7.0 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+1
-1
@@ -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_CommandComplete 3 "" Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+1
-1
@@ -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_Concat 3 7.5 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+1
-1
@@ -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_CreateFileHandler 3 8.0 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+1
-1
@@ -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_CreateInterp 3 7.5 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+28
-1
@@ -8,7 +8,7 @@
|
||||
.so man.macros
|
||||
.BS
|
||||
.SH NAME
|
||||
Tcl_CreateObjCommand, Tcl_DeleteCommand, Tcl_DeleteCommandFromToken, Tcl_GetCommandInfo, Tcl_GetCommandInfoFromToken, Tcl_SetCommandInfo, Tcl_SetCommandInfoFromToken, Tcl_GetCommandName, Tcl_GetCommandFullName, Tcl_GetCommandFromObj \- implement new commands in C
|
||||
Tcl_CreateObjCommand, Tcl_DeleteCommand, Tcl_DeleteCommandFromToken, Tcl_GetCommandInfo, Tcl_GetCommandInfoFromToken, Tcl_SetCommandInfo, Tcl_SetCommandInfoFromToken, Tcl_GetCommandName, Tcl_GetCommandFullName, Tcl_GetCommandFromObj Tcl_RegisterCommandTypeName, Tcl_GetCommandTypeName \- implement new commands in C
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
\fB#include <tcl.h>\fR
|
||||
@@ -42,6 +42,14 @@ void
|
||||
.sp
|
||||
Tcl_Command
|
||||
\fBTcl_GetCommandFromObj\fR(\fIinterp, objPtr\fR)
|
||||
.sp
|
||||
.VS "info cmdtype feature"
|
||||
void
|
||||
\fBTcl_RegisterCommandTypeName\fR(\fIproc, typeName\fR)
|
||||
.sp
|
||||
const char *
|
||||
\fBTcl_GetCommandTypeName\fR(\fItoken\fR)
|
||||
.VE "info cmdtype feature"
|
||||
.SH ARGUMENTS
|
||||
.AS Tcl_CmdDeleteProc *deleteProc in/out
|
||||
.AP Tcl_Interp *interp in
|
||||
@@ -65,6 +73,9 @@ Pointer to structure containing various information about a
|
||||
Tcl command.
|
||||
.AP Tcl_Obj *objPtr in
|
||||
Value containing the name of a Tcl command.
|
||||
.AP "const char" *typeName in
|
||||
Indicates the name of the type of command implementation associated
|
||||
with a particular \fIproc\fR, or NULL to break the association.
|
||||
.BE
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
@@ -296,6 +307,22 @@ is appended to the value specified by \fIobjPtr\fR.
|
||||
specified by the name in a \fBTcl_Obj\fR.
|
||||
The command name is resolved relative to the current namespace.
|
||||
Returns NULL if the command is not found.
|
||||
.PP
|
||||
.VS "info cmdtype feature"
|
||||
\fBTcl_RegisterCommandTypeName\fR is used to associate a name (the
|
||||
\fItypeName\fR argument) with a particular implementation function so that it
|
||||
can then be looked up with \fBTcl_GetCommandTypeName\fR, which in turn is
|
||||
called with a command token that information is wanted for and which returns
|
||||
the name of the type that was registered for the implementation function used
|
||||
for that command. (The lookup functionality is surfaced virtually directly in Tcl via
|
||||
\fBinfo cmdtype\fR.) If there is no function registered for a particular
|
||||
function, the result will be the string literal
|
||||
.QW \fBnative\fR .
|
||||
The registration of a name can be undone by registering a mapping to NULL
|
||||
instead. The result from \fBTcl_GetCommandTypeName\fR will be exactly that
|
||||
string which was registered, and not a copy; use of a compile-time constant
|
||||
string is \fIstrongly recommended\fR.
|
||||
.VE "info cmdtype feature"
|
||||
.SH "SEE ALSO"
|
||||
Tcl_CreateCommand(3), Tcl_ResetResult(3), Tcl_SetObjResult(3)
|
||||
.SH KEYWORDS
|
||||
|
||||
+1
-1
@@ -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_CreateTimerHandler 3 7.5 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+1
-1
@@ -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_DetachPids 3 "" Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution
|
||||
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
'\"
|
||||
'\"
|
||||
.TH Tcl_DictObj 3 8.5 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+1
-1
@@ -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_DoWhenIdle 3 7.5 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution
|
||||
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
'\"
|
||||
'\"
|
||||
.TH Tcl_PutEnv 3 "7.5" Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution
|
||||
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
'\"
|
||||
'\"
|
||||
.TH Tcl_ExprLongObj 3 8.0 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution
|
||||
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
'\"
|
||||
'\"
|
||||
.TH Tcl_FindExecutable 3 8.1 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution
|
||||
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
'\"
|
||||
'\"
|
||||
.TH Tcl_GetCwd 3 8.1 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution
|
||||
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
'\"
|
||||
'\"
|
||||
.TH Tcl_GetIndexFromObj 3 8.1 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+5
-2
@@ -57,6 +57,9 @@ after the optional white space and sign are
|
||||
.QW \fB0x\fR
|
||||
then \fIsrc\fR is expected to be in hexadecimal form; otherwise,
|
||||
if the first such characters are
|
||||
.QW \fB0d\fR
|
||||
then \fIsrc\fR is expected to be in decimal form; otherwise,
|
||||
if the first such characters are
|
||||
.QW \fB0o\fR
|
||||
then \fIsrc\fR is expected to be in octal form; otherwise,
|
||||
if the first such characters are
|
||||
@@ -65,8 +68,8 @@ then \fIsrc\fR is expected to be in binary form; otherwise,
|
||||
if the first such character is
|
||||
.QW \fB0\fR
|
||||
then \fIsrc\fR
|
||||
is expected to be in octal form; otherwise, \fIsrc\fR is
|
||||
expected to be in decimal form.
|
||||
is expected to be in octal form; otherwise, \fIsrc\fR
|
||||
is expected to be in decimal form.
|
||||
.PP
|
||||
\fBTcl_GetDouble\fR expects \fIsrc\fR to consist of a floating-point
|
||||
number, which is: white space; a sign; a sequence of digits; a
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution
|
||||
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
'\"
|
||||
'\"
|
||||
.TH Tcl_GetOpenFile 3 8.0 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution
|
||||
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
'\"
|
||||
'\"
|
||||
.TH Tcl_GetTime 3 8.4 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+1
-1
@@ -281,7 +281,7 @@ The \fIhashKeyProc\fR member contains the address of a function called to
|
||||
calculate a hash value for the key.
|
||||
.PP
|
||||
.CS
|
||||
typedef unsigned int \fBTcl_HashKeyProc\fR(
|
||||
typedef TCL_HASH_TYPE \fBTcl_HashKeyProc\fR(
|
||||
Tcl_HashTable *\fItablePtr\fR,
|
||||
void *\fIkeyPtr\fR);
|
||||
.CE
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1998-2000 by Scriptics Corporation.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\"
|
||||
.TH Tcl_Init 3 8.0 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+4
-4
@@ -3,7 +3,7 @@
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution
|
||||
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
'\"
|
||||
'\"
|
||||
.TH Tcl_InitStubs 3 8.1 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
@@ -23,11 +23,11 @@ Tcl interpreter handle.
|
||||
A version string consisting of one or more decimal numbers
|
||||
separated by dots.
|
||||
.AP int exact in
|
||||
Non-zero means that only the particular version specified by
|
||||
1 means that only the particular version specified by
|
||||
\fIversion\fR is acceptable.
|
||||
Zero means that versions newer than \fIversion\fR are also
|
||||
0 means that versions newer than \fIversion\fR are also
|
||||
acceptable as long as they have the same major version number
|
||||
as \fIversion\fR.
|
||||
as \fIversion\fR. Other bits have no effect.
|
||||
.BE
|
||||
.SH INTRODUCTION
|
||||
.PP
|
||||
|
||||
+1
-1
@@ -97,7 +97,7 @@ are provided by the C language standard. The \fBTcl_WideInt\fR type is a
|
||||
typedef defined to be whatever signed integral type covers at least the
|
||||
64-bit integer range (-9223372036854775808 to 9223372036854775807). Depending
|
||||
on the platform and the C compiler, the actual type might be
|
||||
\fBlong int\fR, \fBlong long int\fR, \fB__int64\fR, or something else.
|
||||
\fBlong long int\fR, \fB__int64\fR, or something else.
|
||||
The \fBmp_int\fR type is a multiple-precision integer type defined
|
||||
by the LibTomMath multiple-precision integer library.
|
||||
.PP
|
||||
|
||||
+1
-1
@@ -101,7 +101,7 @@ the command. The \fIfreeProc\fR field will be initialized to zero,
|
||||
and \fIinterp->result\fR will point to an empty string. Commands that
|
||||
do not return any value can simply leave the fields alone.
|
||||
Furthermore, the empty string pointed to by \fIresult\fR is actually
|
||||
part of an array of \fBTCL_RESULT_SIZE\fR characters (approximately 200).
|
||||
part of an array of approximately 200 characters.
|
||||
If a command wishes to return a short string, it can simply copy
|
||||
it to the area pointed to by \fIinterp->result\fR. Or, it can use
|
||||
the sprintf procedure to generate a short result string at the location
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution
|
||||
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
'\"
|
||||
'\"
|
||||
.TH Tcl_LimitCheck 3 8.5 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+1
-1
@@ -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 Load 3 8.6 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+31
-13
@@ -9,18 +9,18 @@
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
Tcl_ClassSetConstructor, Tcl_ClassSetDestructor, Tcl_MethodDeclarerClass, Tcl_MethodDeclarerObject, Tcl_MethodIsPublic, Tcl_MethodIsType, Tcl_MethodName, Tcl_NewInstanceMethod, Tcl_NewMethod, Tcl_ObjectContextInvokeNext, Tcl_ObjectContextIsFiltering, Tcl_ObjectContextMethod, Tcl_ObjectContextObject, Tcl_ObjectContextSkippedArgs \- manipulate methods and method-call contexts
|
||||
Tcl_ClassSetConstructor, Tcl_ClassSetDestructor, Tcl_MethodDeclarerClass, Tcl_MethodDeclarerObject, Tcl_MethodIsPublic, Tcl_MethodIsPrivate, Tcl_MethodIsType, Tcl_MethodName, Tcl_NewInstanceMethod, Tcl_NewMethod, Tcl_ObjectContextInvokeNext, Tcl_ObjectContextIsFiltering, Tcl_ObjectContextMethod, Tcl_ObjectContextObject, Tcl_ObjectContextSkippedArgs \- manipulate methods and method-call contexts
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
\fB#include <tclOO.h>\fR
|
||||
.sp
|
||||
Tcl_Method
|
||||
\fBTcl_NewMethod\fR(\fIinterp, class, nameObj, isPublic,
|
||||
methodTypePtr, clientData\fR)
|
||||
\fBTcl_NewMethod\fR(\fIinterp, class, nameObj, flags, methodTypePtr,
|
||||
clientData\fR)
|
||||
.sp
|
||||
Tcl_Method
|
||||
\fBTcl_NewInstanceMethod\fR(\fIinterp, object, nameObj, isPublic,
|
||||
methodTypePtr, clientData\fR)
|
||||
\fBTcl_NewInstanceMethod\fR(\fIinterp, object, nameObj, flags, methodTypePtr,
|
||||
clientData\fR)
|
||||
.sp
|
||||
\fBTcl_ClassSetConstructor\fR(\fIinterp, class, method\fR)
|
||||
.sp
|
||||
@@ -35,8 +35,13 @@ Tcl_Object
|
||||
Tcl_Obj *
|
||||
\fBTcl_MethodName\fR(\fImethod\fR)
|
||||
.sp
|
||||
.VS TIP500
|
||||
int
|
||||
\fBTcl_MethodIsPublic\fR(\fImethod\fR)
|
||||
.VE TIP500
|
||||
.sp
|
||||
int
|
||||
\fBTcl_MethodIsPrivate\fR(\fImethod\fR)
|
||||
.sp
|
||||
int
|
||||
\fBTcl_MethodIsType\fR(\fImethod, methodTypePtr, clientDataPtr\fR)
|
||||
@@ -66,10 +71,15 @@ The class to create the method in.
|
||||
.AP Tcl_Obj *nameObj in
|
||||
The name of the method to create. Should not be NULL unless creating
|
||||
constructors or destructors.
|
||||
.AP int isPublic in
|
||||
A flag saying what the visibility of the method is. The only supported public
|
||||
values of this flag are 0 for a non-exported method, and 1 for an exported
|
||||
method.
|
||||
.AP int flags in
|
||||
A flag saying (currently) what the visibility of the method is. The supported
|
||||
public values of this flag are \fBTCL_OO_METHOD_PUBLIC\fR (which is fixed at 1
|
||||
for backward compatibility) for an exported method,
|
||||
\fBTCL_OO_METHOD_UNEXPORTED\fR (which is fixed at 0 for backward
|
||||
compatibility) for a non-exported method,
|
||||
.VS TIP500
|
||||
and \fBTCL_OO_METHOD_PRIVATE\fR for a private method.
|
||||
.VE TIP500
|
||||
.AP Tcl_MethodType *methodTypePtr in
|
||||
A description of the type of the method to create, or the type of method to
|
||||
compare against.
|
||||
@@ -105,8 +115,12 @@ Given a method, the entity that declared it can be found using
|
||||
attached to (or NULL if the method is not attached to any class) and
|
||||
\fBTcl_MethodDeclarerObject\fR which returns the object that the method is
|
||||
attached to (or NULL if the method is not attached to an object). The name of
|
||||
the method can be retrieved with \fBTcl_MethodName\fR and whether the method
|
||||
is exported is retrieved with \fBTcl_MethodIsPublic\fR. The type of the method
|
||||
the method can be retrieved with \fBTcl_MethodName\fR, whether the method
|
||||
is exported is retrieved with \fBTcl_MethodIsPublic\fR,
|
||||
.VS TIP500
|
||||
and whether the method is private is retrieved with \fBTcl_MethodIsPrivate\fR.
|
||||
.VE TIP500
|
||||
The type of the method
|
||||
can also be introspected upon to a limited degree; the function
|
||||
\fBTcl_MethodIsType\fR returns whether a method is of a particular type,
|
||||
assigning the per-method \fIclientData\fR to the variable pointed to by
|
||||
@@ -117,8 +131,12 @@ Methods are created by \fBTcl_NewMethod\fR and \fBTcl_NewInstanceMethod\fR,
|
||||
which
|
||||
create a method attached to a class or an object respectively. In both cases,
|
||||
the \fInameObj\fR argument gives the name of the method to create, the
|
||||
\fIisPublic\fR argument states whether the method should be exported
|
||||
initially, the \fImethodTypePtr\fR argument describes the implementation of
|
||||
\fIflags\fR argument states whether the method should be exported
|
||||
initially
|
||||
.VS TIP500
|
||||
or be marked as a private method,
|
||||
.VE TIP500
|
||||
the \fImethodTypePtr\fR argument describes the implementation of
|
||||
the method (see the \fBMETHOD TYPES\fR section below) and the \fIclientData\fR
|
||||
argument gives some implementation-specific data that is passed on to the
|
||||
implementation of the method when it is called.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
.\"
|
||||
.\" Copyright (c) 2008 by Kevin B. Kenny.
|
||||
.\" Copyright (c) 2018 by Nathan Coulter.
|
||||
.\" Copyright (c) 2018 by Nathan Coulter.
|
||||
.\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution
|
||||
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
|
||||
+2
-2
@@ -3,10 +3,10 @@
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution
|
||||
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
'\"
|
||||
'\"
|
||||
'\" Note that some of these functions do not seem to belong, but they
|
||||
'\" were all introduced with the same TIP (#139)
|
||||
'\"
|
||||
'\"
|
||||
.TH Tcl_Namespace 3 8.5 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+17
-3
@@ -4,12 +4,12 @@
|
||||
'\" See the file "license.terms" for information on usage and redistribution
|
||||
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
'\"
|
||||
.TH Tcl_OpenTcpClient 3 8.0 Tcl "Tcl Library Procedures"
|
||||
.TH Tcl_OpenTcpClient 3 8.7 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
Tcl_OpenTcpClient, Tcl_MakeTcpClientChannel, Tcl_OpenTcpServer \- procedures to open channels using TCP sockets
|
||||
Tcl_OpenTcpClient, Tcl_MakeTcpClientChannel, Tcl_OpenTcpServer, Tcl_OpenTcpServerEx \- procedures to open channels using TCP sockets
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
\fB#include <tcl.h> \fR
|
||||
@@ -23,6 +23,9 @@ Tcl_Channel
|
||||
Tcl_Channel
|
||||
\fBTcl_OpenTcpServer\fR(\fIinterp, port, myaddr, proc, clientData\fR)
|
||||
.sp
|
||||
Tcl_Channel
|
||||
\fBTcl_OpenTcpServerEx\fR(\fIinterp, service, myaddr, flags, proc, clientData\fR)
|
||||
.sp
|
||||
.SH ARGUMENTS
|
||||
.AS Tcl_TcpAcceptProc clientData
|
||||
.AP Tcl_Interp *interp in
|
||||
@@ -30,6 +33,9 @@ Tcl interpreter to use for error reporting. If non-NULL and an
|
||||
error occurs, an error message is left in the interpreter's result.
|
||||
.AP int port in
|
||||
A port number to connect to as a client or to listen on as a server.
|
||||
.AP "const char" *service in
|
||||
A string specifying the port number to connect to as a client or to listen on as
|
||||
a server.
|
||||
.AP "const char" *host in
|
||||
A string specifying a host name or address for the remote end of the connection.
|
||||
.AP int myport in
|
||||
@@ -41,6 +47,9 @@ for the local end of the connection. If NULL, a default interface is
|
||||
chosen.
|
||||
.AP int async in
|
||||
If nonzero, the client socket is connected asynchronously to the server.
|
||||
.AP "unsigned int" flags in
|
||||
ORed combination of \fBTCL_TCPSERVER\fR flags that specify additional
|
||||
informations about the socket being created.
|
||||
.AP ClientData sock in
|
||||
Platform-specific handle for client TCP socket.
|
||||
.AP Tcl_TcpAcceptProc *proc in
|
||||
@@ -130,7 +139,7 @@ for the new channel, \fIhostName\fR points to a string containing
|
||||
the name of the client host making the connection, and \fIport\fR
|
||||
will contain the client's port number.
|
||||
The new channel
|
||||
is opened for both input and output.
|
||||
is opened for both input and output.
|
||||
If \fIproc\fR raises an error, the connection is closed automatically.
|
||||
\fIProc\fR has no return value, but if it wishes to reject the
|
||||
connection it can close \fIchannel\fR.
|
||||
@@ -158,6 +167,11 @@ register it, use \fBTcl_RegisterChannel\fR.
|
||||
If one of the standard channels, \fBstdin\fR, \fBstdout\fR or \fBstderr\fR was
|
||||
previously closed, the act of creating the new channel also assigns it as a
|
||||
replacement for the standard channel.
|
||||
.SS TCL_OPENTCPSERVEREX
|
||||
.PP
|
||||
\fBTcl_OpenTcpServerEx\fR behaviour is identical to \fBTcl_OpenTcpServer\fR but
|
||||
gives more flexibility to the user by providing a mean to further customize some
|
||||
aspects of the socket via the \fIflags\fR parameter.
|
||||
.SH "PLATFORM ISSUES"
|
||||
.PP
|
||||
On Unix platforms, the socket handle is a Unix file descriptor as
|
||||
|
||||
+12
-1
@@ -7,7 +7,7 @@
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
Tcl_Panic, Tcl_PanicVA, Tcl_SetPanicProc \- report fatal error and abort
|
||||
Tcl_Panic, Tcl_PanicVA, Tcl_SetPanicProc, Tcl_ConsolePanic \- report fatal error and abort
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
\fB#include <tcl.h>\fR
|
||||
@@ -21,6 +21,9 @@ void
|
||||
void
|
||||
\fBTcl_SetPanicProc\fR(\fIpanicProc\fR)
|
||||
.sp
|
||||
void
|
||||
\fBTcl_ConsolePanic\fR(\fIformat\fR, \fIarg\fR, \fIarg\fR, \fI...\fR)
|
||||
.sp
|
||||
.SH ARGUMENTS
|
||||
.AS Tcl_PanicProc *panicProc
|
||||
.AP "const char*" format in
|
||||
@@ -54,6 +57,14 @@ message is sent to the debugger in stead. If the windows executable
|
||||
does not have a stderr channel (e.g. \fBwish.exe\fR), then a
|
||||
system dialog box is used to display the panic message.
|
||||
.PP
|
||||
If your application doesn't use \fBTcl_Main\fR or \fBTk_Main\fR
|
||||
and you want to implicitly use the stderr channel of your
|
||||
application's C runtime (in stead of the stderr channel of the
|
||||
C runtime used by Tcl), you can call \fBTcl_SetPanicProc\fR
|
||||
with \fBTcl_ConsolePanic\fR as its argument. On platforms which
|
||||
only have one C runtime (almost all platforms except Windows)
|
||||
\fBTcl_ConsolePanic\fR is equivalent to NULL.
|
||||
.PP
|
||||
\fBTcl_SetPanicProc\fR may be used to modify the behavior of
|
||||
\fBTcl_Panic\fR. The \fIpanicProc\fR argument should match the
|
||||
type \fBTcl_PanicProc\fR:
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution
|
||||
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
'\"
|
||||
'\"
|
||||
.TH Tcl_ParseArgsObjv 3 8.6 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+1
-1
@@ -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_Preserve 3 7.5 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+1
-1
@@ -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_PrintDouble 3 8.0 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+1
-3
@@ -3,7 +3,7 @@
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution
|
||||
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
'\"
|
||||
'\"
|
||||
.TH Tcl_RecordAndEvalObj 3 8.0 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
@@ -32,8 +32,6 @@ the command at global level instead of the current stack level.
|
||||
.PP
|
||||
\fBTcl_RecordAndEvalObj\fR is invoked to record a command as an event
|
||||
on the history list and then execute it using \fBTcl_EvalObjEx\fR
|
||||
(or \fBTcl_GlobalEvalObj\fR if the \fBTCL_EVAL_GLOBAL\fR bit is set
|
||||
in \fIflags\fR).
|
||||
It returns a completion code such as \fBTCL_OK\fR just like \fBTcl_EvalObjEx\fR,
|
||||
as well as a result value containing additional information
|
||||
(a result value or error message)
|
||||
|
||||
+1
-1
@@ -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_RecordAndEval 3 7.4 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+36
-71
@@ -1,6 +1,7 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1997 by Sun Microsystems, Inc.
|
||||
'\" Contributions from Don Porter, NIST, 2004. (not subject to US copyright)
|
||||
'\" Copyright (c) 2018 Nathan Coulter.
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution
|
||||
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
@@ -9,7 +10,9 @@
|
||||
.so man.macros
|
||||
.BS
|
||||
.SH NAME
|
||||
Tcl_SaveInterpState, Tcl_RestoreInterpState, Tcl_DiscardInterpState, Tcl_SaveResult, Tcl_RestoreResult, Tcl_DiscardResult \- save and restore an interpreter's state
|
||||
Tcl_SaveInterpState, Tcl_RestoreInterpState, Tcl_DiscardInterpState,
|
||||
Tcl_SaveResult, Tcl_RestoreResult, Tcl_DiscardResult \- Save and restore the
|
||||
state of an an interpreter.
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
\fB#include <tcl.h>\fR
|
||||
@@ -30,91 +33,53 @@ int
|
||||
.SH ARGUMENTS
|
||||
.AS Tcl_InterpState savedPtr
|
||||
.AP Tcl_Interp *interp in
|
||||
Interpreter for which state should be saved.
|
||||
The interpreter for the operation.
|
||||
.AP int status in
|
||||
Return code value to save as part of interpreter state.
|
||||
The return code for the state.
|
||||
.AP Tcl_InterpState state in
|
||||
Saved state token to be restored or discarded.
|
||||
A token for saved state.
|
||||
.AP Tcl_SavedResult *savedPtr in
|
||||
Pointer to location where interpreter result should be saved or restored.
|
||||
A pointer to storage for saved state.
|
||||
.BE
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
These routines allows a C procedure to take a snapshot of the current
|
||||
state of an interpreter so that it can be restored after a call
|
||||
to \fBTcl_Eval\fR or some other routine that modifies the interpreter
|
||||
state. There are two triplets of routines meant to work together.
|
||||
These routines save the state of an interpreter before a call to a routine such
|
||||
as \fBTcl_Eval\fR, and restore the state afterwards.
|
||||
.PP
|
||||
The first triplet stores the snapshot of interpreter state in
|
||||
an opaque token returned by \fBTcl_SaveInterpState\fR. That token
|
||||
value may then be passed back to one of \fBTcl_RestoreInterpState\fR
|
||||
or \fBTcl_DiscardInterpState\fR, depending on whether the interp
|
||||
state is to be restored. So long as one of the latter two routines
|
||||
is called, Tcl will take care of memory management.
|
||||
\fBTcl_SaveInterpState\fR saves the parts of \fIinterp\fR that comprise the
|
||||
result of a script, including the resulting value, the return code passed as
|
||||
\fIstatus\fR, and any options such as \fB\-errorinfo\fR and \fB\-errorcode\fR.
|
||||
It returns a token for the saved state. The interpreter result is not reset
|
||||
and no interpreter state is changed.
|
||||
.PP
|
||||
The second triplet stores the snapshot of only the interpreter
|
||||
result (not its complete state) in memory allocated by the caller.
|
||||
These routines are passed a pointer to \fBTcl_SavedResult\fR
|
||||
that is used to store enough information to restore the interpreter result.
|
||||
\fBTcl_SavedResult\fR can be allocated on the stack of the calling
|
||||
procedure. These routines do not save the state of any error
|
||||
information in the interpreter (e.g. the \fB\-errorcode\fR or
|
||||
\fB\-errorinfo\fR return options, when an error is in progress).
|
||||
\fBTcl_RestoreInterpState\fR restores the state indicated by \fIstate\fR and
|
||||
returns the \fIstatus\fR originally passed in the corresponding call to
|
||||
\fBTcl_SaveInterpState\fR.
|
||||
.PP
|
||||
Because the routines \fBTcl_SaveInterpState\fR,
|
||||
\fBTcl_RestoreInterpState\fR, and \fBTcl_DiscardInterpState\fR perform
|
||||
a superset of the functions provided by the other routines,
|
||||
any new code should only make use of the more powerful routines.
|
||||
The older, weaker routines \fBTcl_SaveResult\fR, \fBTcl_RestoreResult\fR,
|
||||
and \fBTcl_DiscardResult\fR continue to exist only for the sake
|
||||
of existing programs that may already be using them.
|
||||
If a saved state is not restored, \fBTcl_DiscardInterpState\fR must be called
|
||||
to release it. A token used to discard or restore state must not be used
|
||||
again.
|
||||
.PP
|
||||
\fBTcl_SaveInterpState\fR takes a snapshot of those portions of
|
||||
interpreter state that make up the full result of script evaluation.
|
||||
This include the interpreter result, the return code (passed in
|
||||
as the \fIstatus\fR argument, and any return options, including
|
||||
\fB\-errorinfo\fR and \fB\-errorcode\fR when an error is in progress.
|
||||
This snapshot is returned as an opaque token of type \fBTcl_InterpState\fR.
|
||||
The call to \fBTcl_SaveInterpState\fR does not itself change the
|
||||
state of the interpreter. Unlike \fBTcl_SaveResult\fR, it does
|
||||
not reset the interpreter.
|
||||
\fBTcl_SaveResult\fR, \fBTcl_RestoreResult\fR, and \fBTcl_DiscardResult\fR are
|
||||
deprecated. Instead use \fBTcl_SaveInterpState\fR,
|
||||
\fBTcl_RestoreInterpState\fR, and \fBTcl_DiscardInterpState\fR, which are more
|
||||
capable.
|
||||
.PP
|
||||
\fBTcl_RestoreInterpState\fR accepts a \fBTcl_InterpState\fR token
|
||||
previously returned by \fBTcl_SaveInterpState\fR and restores the
|
||||
state of the interp to the state held in that snapshot. The return
|
||||
value of \fBTcl_RestoreInterpState\fR is the status value originally
|
||||
passed to \fBTcl_SaveInterpState\fR when the snapshot token was
|
||||
created.
|
||||
\fBTcl_SaveResult\fR moves the result of \fIinterp\fR to the location
|
||||
\fIstatePtr\fR points to and returns the interpreter result to its initial
|
||||
state. It does not save options such as \fB\-errorcode\fR or
|
||||
\fB\-errorinfo\fR.
|
||||
.PP
|
||||
\fBTcl_DiscardInterpState\fR is called to release a \fBTcl_InterpState\fR
|
||||
token previously returned by \fBTcl_SaveInterpState\fR when that
|
||||
snapshot is not to be restored to an interp.
|
||||
.PP
|
||||
The \fBTcl_InterpState\fR token returned by \fBTcl_SaveInterpState\fR
|
||||
must eventually be passed to either \fBTcl_RestoreInterpState\fR
|
||||
or \fBTcl_DiscardInterpState\fR to avoid a memory leak. Once
|
||||
the \fBTcl_InterpState\fR token is passed to one of them, the
|
||||
token is no longer valid and should not be used anymore.
|
||||
.PP
|
||||
\fBTcl_SaveResult\fR moves the string and value results
|
||||
of \fIinterp\fR into the location specified by \fIstatePtr\fR.
|
||||
\fBTcl_SaveResult\fR clears the result for \fIinterp\fR and
|
||||
leaves the result in its normal empty initialized state.
|
||||
.PP
|
||||
\fBTcl_RestoreResult\fR moves the string and value results from
|
||||
\fIstatePtr\fR back into \fIinterp\fR. Any result or error that was
|
||||
already in the interpreter will be cleared. The \fIstatePtr\fR is left
|
||||
in an uninitialized state and cannot be used until another call to
|
||||
\fBTcl_RestoreResult\fR clears any existing result or error in \fIinterp\fR and
|
||||
moves the result from \fIstatePtr\fR back to \fIinterp\fR. \fIstatePtr\fR is
|
||||
then in an undefined state and must not be used until passed again to
|
||||
\fBTcl_SaveResult\fR.
|
||||
.PP
|
||||
\fBTcl_DiscardResult\fR releases the saved interpreter state
|
||||
stored at \fBstatePtr\fR. The state structure is left in an
|
||||
uninitialized state and cannot be used until another call to
|
||||
\fBTcl_DiscardResult\fR releases the state stored at \fBstatePtr\fR, which is
|
||||
then in an undefined state and must not be used until passed again to
|
||||
\fBTcl_SaveResult\fR.
|
||||
.PP
|
||||
Once \fBTcl_SaveResult\fR is called to save the interpreter
|
||||
result, either \fBTcl_RestoreResult\fR or
|
||||
\fBTcl_DiscardResult\fR must be called to properly clean up the
|
||||
memory associated with the saved state.
|
||||
If a saved result is not restored, \fBTcl_DiscardResult\fR must be called to
|
||||
release it.
|
||||
.SH KEYWORDS
|
||||
result, state, interp
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution
|
||||
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
'\"
|
||||
'\"
|
||||
.TH Tcl_SetErrno 3 8.3 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+1
-1
@@ -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_SetRecursionLimit 3 7.0 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution
|
||||
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
'\"
|
||||
'\"
|
||||
.TH Tcl_SignalId 3 8.3 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+1
-1
@@ -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_Sleep 3 7.5 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+1
-1
@@ -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_SplitList 3 8.0 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution
|
||||
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
'\"
|
||||
'\"
|
||||
.TH Tcl_SplitPath 3 7.5 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution
|
||||
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
'\"
|
||||
'\"
|
||||
.TH Tcl_StaticPackage 3 7.5 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution
|
||||
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
'\"
|
||||
'\"
|
||||
.TH "Standard Channels" 3 7.5 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+1
-1
@@ -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_StringMatch 3 8.5 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+3
-2
@@ -37,7 +37,7 @@ Tcl_UniChar *
|
||||
Tcl_UniChar *
|
||||
\fBTcl_GetUnicode\fR(\fIobjPtr\fR)
|
||||
.sp
|
||||
Tcl_UniChar
|
||||
int
|
||||
\fBTcl_GetUniChar\fR(\fIobjPtr, index\fR)
|
||||
.sp
|
||||
int
|
||||
@@ -204,7 +204,8 @@ where the caller does not need the length of the unicode string
|
||||
representation.
|
||||
.PP
|
||||
\fBTcl_GetUniChar\fR returns the \fIindex\fR'th character in the
|
||||
value's Unicode representation.
|
||||
value's Unicode representation. If the index is out of range or
|
||||
it references a low surrogate preceded by a high surrogate, it returns -1;
|
||||
.PP
|
||||
\fBTcl_GetRange\fR returns a newly created value comprised of the
|
||||
characters between \fIfirst\fR and \fIlast\fR (inclusive) in the
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution
|
||||
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
'\"
|
||||
'\"
|
||||
.TH Tcl_SubstObj 3 8.4 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
'\"
|
||||
'\"
|
||||
'\" Copyright (c) 1992-1999 Karl Lehenbauer and Mark Diekhans.
|
||||
'\" Copyright (c) 2000 by Scriptics Corporation.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\"
|
||||
.TH TCL_MEM_DEBUG 3 8.1 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution
|
||||
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
'\"
|
||||
'\"
|
||||
.TH TclZlib 3 8.6 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+3
-3
@@ -13,13 +13,13 @@ Tcl_UniCharToUpper, Tcl_UniCharToLower, Tcl_UniCharToTitle, Tcl_UtfToUpper, Tcl_
|
||||
.nf
|
||||
\fB#include <tcl.h>\fR
|
||||
.sp
|
||||
Tcl_UniChar
|
||||
int
|
||||
\fBTcl_UniCharToUpper\fR(\fIch\fR)
|
||||
.sp
|
||||
Tcl_UniChar
|
||||
int
|
||||
\fBTcl_UniCharToLower\fR(\fIch\fR)
|
||||
.sp
|
||||
Tcl_UniChar
|
||||
int
|
||||
\fBTcl_UniCharToTitle\fR(\fIch\fR)
|
||||
.sp
|
||||
int
|
||||
|
||||
@@ -48,7 +48,7 @@ int
|
||||
.SH ARGUMENTS
|
||||
.AS int ch
|
||||
.AP int ch in
|
||||
The Tcl_UniChar to be examined.
|
||||
The Unicode character to be examined.
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
|
||||
@@ -63,7 +63,7 @@ const char *
|
||||
const char *
|
||||
\fBTcl_UtfPrev\fR(\fIsrc, start\fR)
|
||||
.sp
|
||||
Tcl_UniChar
|
||||
int
|
||||
\fBTcl_UniCharAtIndex\fR(\fIsrc, index\fR)
|
||||
.sp
|
||||
const char *
|
||||
@@ -121,8 +121,8 @@ case-insensitive (1).
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
These routines convert between UTF-8 strings and Tcl_UniChars. A
|
||||
Tcl_UniChar is a Unicode character represented as an unsigned, fixed-size
|
||||
These routines convert between UTF-8 strings and Unicode characters. An
|
||||
Unicode character represented as an unsigned, fixed-size
|
||||
quantity. A UTF-8 character is a Unicode character represented as
|
||||
a varying-length sequence of up to \fBTCL_UTF_MAX\fR bytes. A multibyte UTF-8
|
||||
sequence consists of a lead byte followed by some number of trail bytes.
|
||||
@@ -130,9 +130,12 @@ sequence consists of a lead byte followed by some number of trail bytes.
|
||||
\fBTCL_UTF_MAX\fR is the maximum number of bytes that it takes to
|
||||
represent one Unicode character in the UTF-8 representation.
|
||||
.PP
|
||||
\fBTcl_UniCharToUtf\fR stores the Tcl_UniChar \fIch\fR as a UTF-8 string
|
||||
\fBTcl_UniCharToUtf\fR stores the character \fIch\fR as a UTF-8 string
|
||||
in starting at \fIbuf\fR. The return value is the number of bytes stored
|
||||
in \fIbuf\fR.
|
||||
in \fIbuf\fR. If ch is an upper surrogate (range U+D800 - U+DBFF), then
|
||||
the return value will be 0 and nothing will be stored. If you still
|
||||
want to produce UTF-8 output for it (even though knowing it's an illegal
|
||||
code-point on its own), just call \fBTcl_UniCharToUtf\fR again using ch = -1.
|
||||
.PP
|
||||
\fBTcl_UtfToUniChar\fR reads one UTF-8 character starting at \fIsrc\fR
|
||||
and stores it as a Tcl_UniChar in \fI*chPtr\fR. The return value is the
|
||||
@@ -140,6 +143,9 @@ number of bytes read from \fIsrc\fR. The caller must ensure that the
|
||||
source buffer is long enough such that this routine does not run off the
|
||||
end and dereference non-existent or random memory; if the source buffer
|
||||
is known to be null-terminated, this will not happen. If the input is
|
||||
a byte in the range 0x80 - 0x9F, \fBTcl_UtfToUniChar\fR assumes the
|
||||
cp1252 encoding, stores the corresponding Tcl_UniChar in \fI*chPtr\fR
|
||||
and returns 1. If the input is otherwise
|
||||
not in proper UTF-8 format, \fBTcl_UtfToUniChar\fR will store the first
|
||||
byte of \fIsrc\fR in \fI*chPtr\fR as a Tcl_UniChar between 0x0000 and
|
||||
0x00ff and return 1.
|
||||
@@ -200,7 +206,7 @@ of \fIlength\fR bytes is long enough to be decoded by
|
||||
\fBTcl_UtfToUniChar\fR, or 0 otherwise. This function does not guarantee
|
||||
that the UTF-8 string is properly formed. This routine is used by
|
||||
procedures that are operating on a byte at a time and need to know if a
|
||||
full Tcl_UniChar has been seen.
|
||||
full Unicode character has been seen.
|
||||
.PP
|
||||
\fBTcl_NumUtfChars\fR corresponds to \fBstrlen\fR for UTF-8 strings. It
|
||||
returns the number of Tcl_UniChars that are represented by the UTF-8 string
|
||||
@@ -208,12 +214,12 @@ returns the number of Tcl_UniChars that are represented by the UTF-8 string
|
||||
length is negative, all bytes up to the first null byte are used.
|
||||
.PP
|
||||
\fBTcl_UtfFindFirst\fR corresponds to \fBstrchr\fR for UTF-8 strings. It
|
||||
returns a pointer to the first occurrence of the Tcl_UniChar \fIch\fR
|
||||
returns a pointer to the first occurrence of the Unicode character \fIch\fR
|
||||
in the null-terminated UTF-8 string \fIsrc\fR. The null terminator is
|
||||
considered part of the UTF-8 string.
|
||||
.PP
|
||||
\fBTcl_UtfFindLast\fR corresponds to \fBstrrchr\fR for UTF-8 strings. It
|
||||
returns a pointer to the last occurrence of the Tcl_UniChar \fIch\fR
|
||||
returns a pointer to the last occurrence of the Unicode character \fIch\fR
|
||||
in the null-terminated UTF-8 string \fIsrc\fR. The null terminator is
|
||||
considered part of the UTF-8 string.
|
||||
.PP
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
'\"
|
||||
'\" Copyright (c) 2018 Donal K. Fellows
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution
|
||||
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
'\"
|
||||
.TH abstract n 0.3 TclOO "TclOO Commands"
|
||||
.so man.macros
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
oo::abstract \- a class that does not allow direct instances of itself
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
package require TclOO
|
||||
|
||||
\fBoo::abstract\fI method \fR?\fIarg ...\fR?
|
||||
.fi
|
||||
.SH "CLASS HIERARCHY"
|
||||
.nf
|
||||
\fBoo::object\fR
|
||||
\(-> \fBoo::class\fR
|
||||
\(-> \fBoo::abstract\fR
|
||||
.fi
|
||||
.BE
|
||||
.SH DESCRIPTION
|
||||
Abstract classes are classes that can contain definitions, but which cannot be
|
||||
directly manufactured; they are intended to only ever be inherited from and
|
||||
instantiated indirectly. The characteristic methods of \fBoo::class\fR
|
||||
(\fBcreate\fR and \fBnew\fR) are not exported by an instance of
|
||||
\fBoo::abstract\fR.
|
||||
.PP
|
||||
Note that \fBoo::abstract\fR is not itself an instance of \fBoo::abstract\fR.
|
||||
.SS CONSTRUCTOR
|
||||
The \fBoo::abstract\fR class does not define an explicit constructor; this
|
||||
means that it is effectively the same as the constructor of the
|
||||
\fBoo::class\fR class.
|
||||
.SS DESTRUCTOR
|
||||
The \fBoo::abstract\fR class does not define an explicit destructor;
|
||||
destroying an instance of it is just like destroying an ordinary class (and
|
||||
will destroy all its subclasses).
|
||||
.SS "EXPORTED METHODS"
|
||||
The \fBoo::abstract\fR class defines no new exported methods.
|
||||
.SS "NON-EXPORTED METHODS"
|
||||
The \fBoo::abstract\fR class explicitly states that \fBcreate\fR,
|
||||
\fBcreateWithNamespace\fR, and \fBnew\fR are unexported.
|
||||
.SH EXAMPLES
|
||||
.PP
|
||||
This example defines a simple class hierarchy and creates a new instance of
|
||||
it. It then invokes a method of the object before destroying the hierarchy and
|
||||
showing that the destruction is transitive.
|
||||
.PP
|
||||
.CS
|
||||
\fBoo::abstract\fR create fruit {
|
||||
method eat {} {
|
||||
puts "yummy!"
|
||||
}
|
||||
}
|
||||
oo::class create banana {
|
||||
superclass fruit
|
||||
method peel {} {
|
||||
puts "skin now off"
|
||||
}
|
||||
}
|
||||
set b [banana \fBnew\fR]
|
||||
$b peel \fI\(-> prints 'skin now off'\fR
|
||||
$b eat \fI\(-> prints 'yummy!'\fR
|
||||
set f [fruit new] \fI\(-> error 'unknown method "new"...'\fR
|
||||
.CE
|
||||
.SH "SEE ALSO"
|
||||
oo::define(n), oo::object(n)
|
||||
.SH KEYWORDS
|
||||
abstract class, class, metaclass, object
|
||||
.\" Local variables:
|
||||
.\" mode: nroff
|
||||
.\" fill-column: 78
|
||||
.\" End:
|
||||
+9
-3
@@ -20,6 +20,11 @@ Append all of the \fIvalue\fR arguments to the current value
|
||||
of variable \fIvarName\fR. If \fIvarName\fR does not exist,
|
||||
it is given a value equal to the concatenation of all the
|
||||
\fIvalue\fR arguments.
|
||||
.VS TIP508
|
||||
If \fIvarName\fR indicate an element that does not exist of an array that has
|
||||
a default value set, the concatenation of the default value and all the
|
||||
\fIvalue\fR arguments will be stored in the array element.
|
||||
.VE TIP508
|
||||
The result of this command is the new value stored in variable
|
||||
\fIvarName\fR.
|
||||
This command provides an efficient way to build up long
|
||||
@@ -44,6 +49,7 @@ puts $var
|
||||
concat(n), lappend(n)
|
||||
.SH KEYWORDS
|
||||
append, variable
|
||||
'\" Local Variables:
|
||||
'\" mode: nroff
|
||||
'\" End:
|
||||
.\" Local variables:
|
||||
.\" mode: nroff
|
||||
.\" fill-column: 78
|
||||
.\" End:
|
||||
|
||||
+61
-1
@@ -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 array n 8.3 Tcl "Tcl Built-In Commands"
|
||||
.TH array n 8.7 Tcl "Tcl Built-In Commands"
|
||||
.so man.macros
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
@@ -36,6 +36,53 @@ with an empty name, since the return value from
|
||||
\fBarray nextelement\fR will not indicate whether the search
|
||||
has been completed.
|
||||
.TP
|
||||
\fBarray default \fIsubcommand arrayName args...\fR
|
||||
.VS TIP508
|
||||
Manages the default value of the array. Arrays initially have no default
|
||||
value, but this command allows you to set one; the default value will be
|
||||
returned when reading from an element of the array \farrayName\fR if the read
|
||||
would otherwise result in an error. Note that this may cause the \fBappend\fR,
|
||||
\fBdict\fR, \fBincr\fR and \fBlappend\fR commands to change their behavior in
|
||||
relation to non-existing array elements.
|
||||
.RS
|
||||
.PP
|
||||
The \fIsubcommand\fR argument controls what exact operation will be performed
|
||||
on the default value of \fIarrayName\fR. Supported \fIsubcommand\fRs are:
|
||||
.VE TIP508
|
||||
.TP
|
||||
\fBarray default exists \fIarrayName\fR
|
||||
.VS TIP508
|
||||
This returns a boolean value indicating whether a default value has been set
|
||||
for the array \fIarrayName\fR. Returns a false value if \fIarrayName\fR does
|
||||
not exist. Raises an error if \fIarrayName\fR is an existing variable that is
|
||||
not an array.
|
||||
.VE TIP508
|
||||
.TP
|
||||
\fBarray default get \fIarrayName\fR
|
||||
.VS TIP508
|
||||
This returns the current default value for the array \fIarrayName\fR. Raises
|
||||
an error if \fIarrayName\fR is an existing variable that is not an array, or
|
||||
if \fIarrayName\fR is an array without a default value.
|
||||
.VE TIP508
|
||||
.TP
|
||||
\fBarray default set \fIarrayName value\fR
|
||||
.VS TIP508
|
||||
This sets the default value for the array \fIarrayName\fR to \fIvalue\fR.
|
||||
Returns the empty string. Raises an error if \fIarrayName\fR is an existing
|
||||
variable that is not an array, or if \fIarrayName\fR is an illegal name for an
|
||||
array. If \fIarrayName\fR does not currently exist, it is created as an empty
|
||||
array as well as having its default value set.
|
||||
.VE TIP508
|
||||
.TP
|
||||
\fBarray default unset \fIarrayName\fR
|
||||
.VS TIP508
|
||||
This removes the default value for the array \fIarrayName\fR and returns the
|
||||
empty string. Does nothing if \fIarrayName\fR does not have a default
|
||||
value. Raises an error if \fIarrayName\fR is an existing variable that is not
|
||||
an array.
|
||||
.VE TIP508
|
||||
.RE
|
||||
.TP
|
||||
\fBarray donesearch \fIarrayName searchId\fR
|
||||
This command terminates an array search and destroys all the
|
||||
state associated with that search. \fISearchId\fR indicates
|
||||
@@ -47,6 +94,15 @@ been the return value from a previous invocation of
|
||||
Returns 1 if \fIarrayName\fR is an array variable, 0 if there
|
||||
is no variable by that name or if it is a scalar variable.
|
||||
.TP
|
||||
\fBarray for {\fIkeyVariable valueVariable\fB} \fIarrayName body\fP
|
||||
The first argument is a two element list of variable names for the
|
||||
key and value of each entry in the array. The second argument is the
|
||||
array name to iterate over. The third argument is the body to execute
|
||||
for each key and value returned.
|
||||
The ordering of the returned keys is undefined.
|
||||
If an array element is deleted or a new array element is inserted during
|
||||
the \fIarray for\fP process, the command will terminate with an error.
|
||||
.TP
|
||||
\fBarray get \fIarrayName\fR ?\fIpattern\fR?
|
||||
Returns a list containing pairs of elements. The first
|
||||
element in each pair is the name of an element in \fIarrayName\fR
|
||||
@@ -185,3 +241,7 @@ foreach color [lsort [\fBarray names\fR colorcount]] {
|
||||
list(n), string(n), variable(n), trace(n), foreach(n)
|
||||
.SH KEYWORDS
|
||||
array, element names, search
|
||||
.\" Local variables:
|
||||
.\" mode: nroff
|
||||
.\" fill-column: 78
|
||||
.\" End:
|
||||
|
||||
+1
-1
@@ -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 break n "" Tcl "Tcl Built-In Commands"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
'\"
|
||||
'\" Copyright (c) 2018 Donal K. Fellows
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution
|
||||
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
'\"
|
||||
.TH callback n 0.3 TclOO "TclOO Commands"
|
||||
.so man.macros
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
callback, mymethod \- generate callbacks to methods
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
package require TclOO
|
||||
|
||||
\fBcallback\fR \fImethodName\fR ?\fIarg ...\fR?
|
||||
\fBmymethod\fR \fImethodName\fR ?\fIarg ...\fR?
|
||||
.fi
|
||||
.BE
|
||||
.SH DESCRIPTION
|
||||
The \fBcallback\fR command,
|
||||
'\" Based on notes in the tcllib docs, we know the provenance of mymethod
|
||||
also called \fBmymethod\fR for compatibility with the ooutil and snit packages
|
||||
of Tcllib,
|
||||
and which should only be used from within the context of a call to a method
|
||||
(i.e. inside a method, constructor or destructor body) is used to generate a
|
||||
script fragment that will invoke the method, \fImethodName\fR, on the current
|
||||
object (as reported by \fBself\fR) when executed. Any additional arguments
|
||||
provided will be provided as leading arguments to the callback. The resulting
|
||||
script fragment shall be a proper list.
|
||||
.PP
|
||||
Note that it is up to the caller to ensure that the current object is able to
|
||||
handle the call of \fImethodName\fR; this command does not check that.
|
||||
\fImethodName\fR may refer to any exported or unexported method, but may not
|
||||
refer to a private method as those can only be invoked directly from within
|
||||
methods. If there is no such method present at the point when the callback is
|
||||
invoked, the standard \fBunknown\fR method handler will be called.
|
||||
.SH EXAMPLE
|
||||
This is a simple echo server class. The \fBcallback\fR command is used in two
|
||||
places, to arrange for the incoming socket connections to be handled by the
|
||||
\fIAccept\fR method, and to arrange for the incoming bytes on those
|
||||
connections to be handled by the \fIReceive\fR method.
|
||||
.PP
|
||||
.CS
|
||||
oo::class create EchoServer {
|
||||
variable server clients
|
||||
constructor {port} {
|
||||
set server [socket -server [\fBcallback\fR Accept] $port]
|
||||
set clients {}
|
||||
}
|
||||
destructor {
|
||||
chan close $server
|
||||
foreach client [dict keys $clients] {
|
||||
chan close $client
|
||||
}
|
||||
}
|
||||
|
||||
method Accept {channel clientAddress clientPort} {
|
||||
dict set clients $channel [dict create \e
|
||||
address $clientAddress port $clientPort]
|
||||
chan event $channel readable [\fBcallback\fR Receive $channel]
|
||||
}
|
||||
method Receive {channel} {
|
||||
if {[chan gets $channel line] >= 0} {
|
||||
my echo $channel $line
|
||||
} else {
|
||||
chan close $channel
|
||||
dict unset clients $channel
|
||||
}
|
||||
}
|
||||
|
||||
method echo {channel line} {
|
||||
dict with clients $channel {
|
||||
chan puts $channel \e
|
||||
[format {[%s:%d] %s} $address $port $line]
|
||||
}
|
||||
}
|
||||
}
|
||||
.CE
|
||||
.SH "SEE ALSO"
|
||||
chan(n), fileevent(n), my(n), self(n), socket(n), trace(n)
|
||||
.SH KEYWORDS
|
||||
callback, object
|
||||
.\" Local Variables:
|
||||
.\" mode: nroff
|
||||
.\" fill-column: 78
|
||||
.\" End:
|
||||
+1
-1
@@ -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 case n 7.0 Tcl "Tcl Built-In Commands"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
@@ -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 cd n "" Tcl "Tcl Built-In Commands"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
'\"
|
||||
'\" Copyright (c) 2011-2015 Andreas Kupries
|
||||
'\" Copyright (c) 2018 Donal K. Fellows
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution
|
||||
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
'\"
|
||||
.TH classvariable n 0.3 TclOO "TclOO Commands"
|
||||
.so man.macros
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
classvariable \- create link from local variable to variable in class
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
package require TclOO
|
||||
|
||||
\fBclassvariable\fR \fIvariableName\fR ?\fI...\fR?
|
||||
.fi
|
||||
.BE
|
||||
.SH DESCRIPTION
|
||||
The \fBclassvariable\fR command is available within methods. It takes a series
|
||||
of one or more variable names and makes them available in the method's scope;
|
||||
those variable names must not be qualified and must not refer to array
|
||||
elements. The originating scope for the variables is the namespace of the
|
||||
class that the method was defined by. In other words, the referenced variables
|
||||
are shared between all instances of that class.
|
||||
.PP
|
||||
Note: This command is equivalent to the command \fBtypevariable\fR provided by
|
||||
the snit package in tcllib for approximately the same purpose. If used in a
|
||||
method defined directly on a class instance (e.g., through the
|
||||
\fBoo::objdefine\fR \fBmethod\fR definition) this is very much like just
|
||||
using:
|
||||
.PP
|
||||
.CS
|
||||
namespace upvar [namespace current] $var $var
|
||||
.CE
|
||||
.PP
|
||||
for each variable listed to \fBclassvariable\fR.
|
||||
.SH EXAMPLE
|
||||
This class counts how many instances of it have been made.
|
||||
.PP
|
||||
.CS
|
||||
oo::class create Counted {
|
||||
initialise {
|
||||
variable count 0
|
||||
}
|
||||
|
||||
variable number
|
||||
constructor {} {
|
||||
\fBclassvariable\fR count
|
||||
set number [incr count]
|
||||
}
|
||||
|
||||
method report {} {
|
||||
\fBclassvariable\fR count
|
||||
puts "This is instance $number of $count"
|
||||
}
|
||||
}
|
||||
|
||||
set a [Counted new]
|
||||
set b [Counted new]
|
||||
$a report
|
||||
\fI\(-> This is instance 1 of 2\fR
|
||||
set c [Counted new]
|
||||
$b report
|
||||
\fI\(-> This is instance 2 of 3\fR
|
||||
$c report
|
||||
\fI\(-> This is instance 3 of 3\fR
|
||||
.CE
|
||||
.SH "SEE ALSO"
|
||||
global(n), namespace(n), oo::class(n), oo::define(n), upvar(n), variable(n)
|
||||
.SH KEYWORDS
|
||||
class, class variable, variable
|
||||
.\" Local Variables:
|
||||
.\" mode: nroff
|
||||
.\" fill-column: 78
|
||||
.\" End:
|
||||
+7
-8
@@ -89,10 +89,9 @@ have 59 or 61 seconds.
|
||||
.TP
|
||||
\fIunit\fR
|
||||
One of the words, \fBseconds\fR, \fBminutes\fR, \fBhours\fR,
|
||||
\fBdays\fR, \fBweeks\fR, \fBmonths\fR, or \fByears\fR, or
|
||||
any unique prefix of such a word. Used in conjunction with \fIcount\fR
|
||||
to identify an interval of time, for example, \fI3 seconds\fR or
|
||||
\fI1 year\fR.
|
||||
\fBdays\fR, \fBweekdays\fR, \fBweeks\fR, \fBmonths\fR, or \fByears\fR.
|
||||
Used in conjunction with \fIcount\fR to identify an interval of time,
|
||||
for example, \fI3 seconds\fR or \fI1 year\fR.
|
||||
.SS "OPTIONS"
|
||||
.TP
|
||||
\fB\-base\fR time
|
||||
@@ -175,8 +174,7 @@ given as its first argument. The remaining arguments (other than the
|
||||
possible \fB\-timezone\fR, \fB\-locale\fR and \fB\-gmt\fR options)
|
||||
are integers and keywords in alternation, where the keywords are chosen
|
||||
from \fBseconds\fR, \fBminutes\fR, \fBhours\fR,
|
||||
\fBdays\fR, \fBweeks\fR, \fBmonths\fR, or \fByears\fR, or
|
||||
any unique prefix of such a word.
|
||||
\fBdays\fR, \fBweekdays\fR, \fBweeks\fR, \fBmonths\fR, or \fByears\fR.
|
||||
.PP
|
||||
Addition of seconds, minutes and hours is fairly straightforward;
|
||||
the given time increment (times sixty for minutes, or 3600 for hours)
|
||||
@@ -213,7 +211,8 @@ the given time to a calendar day and time of day in the appropriate
|
||||
time zone and locale. The requisite number of days (weeks are converted
|
||||
to days by multiplying by seven) is added to the calendar day, and
|
||||
the date and time are then converted back to a count of seconds from
|
||||
the epoch time.
|
||||
the epoch time. The \fBweekdays\fR keyword is similar to \fBdays\fR,
|
||||
with the only difference that weekends - Saturdays and Sundays - are skipped.
|
||||
.PP
|
||||
Adding and subtracting a given number of days across the point that
|
||||
the time changes at the start or end of summer time (Daylight Saving Time)
|
||||
@@ -465,7 +464,7 @@ a Daylight Saving Time change skips over that time, or an ambiguous
|
||||
time because a Daylight Saving Time change skips back so that the clock
|
||||
observes the given time twice, and no time zone specifier (\fB%z\fR
|
||||
or \fB%Z\fR) is present in the format, the time is interpreted as
|
||||
if the clock had not changed.
|
||||
if the clock had not changed.
|
||||
.SH "FORMAT GROUPS"
|
||||
.PP
|
||||
The following format groups are recognized by the \fBclock scan\fR and
|
||||
|
||||
+1
-1
@@ -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 close n 7.5 Tcl "Tcl Built-In Commands"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+1
-1
@@ -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 concat n 8.3 Tcl "Tcl Built-In Commands"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+2
-2
@@ -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 continue n "" Tcl "Tcl Built-In Commands"
|
||||
.so man.macros
|
||||
.BS
|
||||
@@ -23,7 +23,7 @@ exception to occur.
|
||||
The exception causes the current script to be aborted
|
||||
out to the innermost containing loop command, which then
|
||||
continues with the next iteration of the loop.
|
||||
Catch exceptions are also handled in a few other situations, such
|
||||
Continue exceptions are also handled in a few other situations, such
|
||||
as the \fBcatch\fR command and the outermost scripts of procedure
|
||||
bodies.
|
||||
.SH EXAMPLE
|
||||
|
||||
+3
-3
@@ -33,9 +33,9 @@ as the empty string, a new name is chosen. Names, unless specified, are
|
||||
chosen with the same algorithm used by the \fBnew\fR method of
|
||||
\fBoo::class\fR.
|
||||
.VE TIP473
|
||||
The copied object will be of the same class as the source object, and will have
|
||||
all its per-object methods copied. If it is a class, it will also have all the
|
||||
class methods in the class copied, but it will not have any of its instances
|
||||
The copied object will be of the same class as the source object, and will have
|
||||
all its per-object methods copied. If it is a class, it will also have all the
|
||||
class methods in the class copied, but it will not have any of its instances
|
||||
copied.
|
||||
.PP
|
||||
.VS
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution
|
||||
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
'\"
|
||||
'\"
|
||||
.TH coroutine n 8.6 Tcl "Tcl Built-In Commands"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+307
-42
@@ -1,5 +1,5 @@
|
||||
'\"
|
||||
'\" Copyright (c) 2007 Donal K. Fellows
|
||||
'\" Copyright (c) 2007-2018 Donal K. Fellows
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution
|
||||
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
@@ -39,6 +39,27 @@ used as the \fIdefScript\fR argument.
|
||||
The following commands are supported in the \fIdefScript\fR for
|
||||
\fBoo::define\fR, each of which may also be used in the \fIsubcommand\fR form:
|
||||
.TP
|
||||
\fBclassmethod\fI name\fR ?\fIargList bodyScrip\fR?
|
||||
.VS TIP478
|
||||
This creates a class method, or (if \fIargList\fR and \fIbodyScript\fR are
|
||||
omitted) promotes an existing method on the class object to be a class
|
||||
method. The \fIname\fR, \fIargList\fR and \fIbodyScript\fR arguments are as in
|
||||
the \fBmethod\fR definition, below.
|
||||
.RS
|
||||
.PP
|
||||
Class methods can be called on either the class itself or on the instances of
|
||||
that class. When they are called, the current object (see the \fBself\R and
|
||||
\fBmy\fR commands) is the class on which they are called or the class of the
|
||||
instance on which they are called, depending on whether they are called on the
|
||||
class or an instance of the class, respectively. If called on a subclass or
|
||||
instance of the subclass, the current object is the subclass.
|
||||
.PP
|
||||
In a private definition context, the methods as invoked on classes are
|
||||
\fInot\fR private, but the methods as invoked on instances of classes are
|
||||
private.
|
||||
.RE
|
||||
.VE TIP478
|
||||
.TP
|
||||
\fBconstructor\fI argList bodyScript\fR
|
||||
.
|
||||
This creates or updates the constructor for a class. The formal arguments to
|
||||
@@ -82,17 +103,14 @@ by a superclass; subclass exports override superclass visibility, and may in
|
||||
turn be overridden by instances.
|
||||
.TP
|
||||
\fBfilter\fR ?\fI\-slotOperation\fR? ?\fImethodName ...\fR?
|
||||
.VS
|
||||
.
|
||||
This slot (see \fBSLOTTED DEFINITIONS\fR below)
|
||||
.VE
|
||||
sets or updates the list of method names that are used to guard whether
|
||||
method call to instances of the class may be called and what the method's
|
||||
results are. Each \fImethodName\fR names a single filtering method (which may
|
||||
be exposed or not exposed); it is not an error for a non-existent method to be
|
||||
named since they may be defined by subclasses.
|
||||
.VS
|
||||
By default, this slot works by appending.
|
||||
.VE
|
||||
.TP
|
||||
\fBforward\fI name cmdName \fR?\fIarg ...\fR?
|
||||
.
|
||||
@@ -105,6 +123,22 @@ fully-qualified, the command will be searched for in each object's namespace,
|
||||
using the instances' namespace's path, or by looking in the global namespace.
|
||||
The method will be exported if \fIname\fR starts with a lower-case letter, and
|
||||
non-exported otherwise.
|
||||
.RS
|
||||
.PP
|
||||
.VS TIP500
|
||||
If in a private definition context (see the \fBprivate\fR definition command,
|
||||
below), this command creates private forwarded methods.
|
||||
.VE TIP500
|
||||
.RE
|
||||
.TP
|
||||
\fBinitialise\fI script\fR
|
||||
.TP
|
||||
\fBinitialize\fI script\fR
|
||||
.VS TIP478
|
||||
This evaluates \fIscript\fR in a context which supports local variables and
|
||||
where the current namespace is the instance namespace of the class object
|
||||
itself. This is useful for setting up, e.g., class-scoped variables.
|
||||
.VE TIP478
|
||||
.TP
|
||||
\fBmethod\fI name argList bodyScript\fR
|
||||
.
|
||||
@@ -117,17 +151,40 @@ be a namespace that is unique to the current object. The method will be
|
||||
exported if \fIname\fR starts with a lower-case letter, and non-exported
|
||||
otherwise; this behavior can be overridden via \fBexport\fR and
|
||||
\fBunexport\fR.
|
||||
.RS
|
||||
.PP
|
||||
.VS TIP500
|
||||
If in a private definition context (see the \fBprivate\fR definition command,
|
||||
below), this command creates private procedure-like methods.
|
||||
.VE TIP500
|
||||
.RE
|
||||
.TP
|
||||
\fBmixin\fR ?\fI\-slotOperation\fR? ?\fIclassName ...\fR?
|
||||
.VS
|
||||
.
|
||||
This slot (see \fBSLOTTED DEFINITIONS\fR below)
|
||||
.VE
|
||||
sets or updates the list of additional classes that are to be mixed into
|
||||
all the instances of the class being defined. Each \fIclassName\fR argument
|
||||
names a single class that is to be mixed in.
|
||||
.VS
|
||||
By default, this slot works by replacement.
|
||||
.VE
|
||||
.TP
|
||||
\fBprivate \fIcmd arg...\fR
|
||||
.TP
|
||||
\fBprivate \fIscript\fR
|
||||
.
|
||||
.VS TIP500
|
||||
This evaluates the \fIscript\fR (or the list of command and arguments given by
|
||||
\fIcmd\fR and \fIarg\fRs) in a context where the definitions made on the
|
||||
current class will be private definitions.
|
||||
.RS
|
||||
.PP
|
||||
The following class definition commands are affected by \fBprivate\fR:
|
||||
\fBforward\fR, \fBmethod\fR, \fBself\fR, and \fBvariable\fR. Nesting
|
||||
\fBprivate\fR inside \fBprivate\fR has no cumulative effect; the innermost
|
||||
definition context is just a private definition context. All other definition
|
||||
commands have no difference in behavior when used in a private definition
|
||||
context.
|
||||
.RE
|
||||
.VE TIP500
|
||||
.TP
|
||||
\fBrenamemethod\fI fromName toName\fR
|
||||
.
|
||||
@@ -142,6 +199,8 @@ be afterwards.
|
||||
\fBself\fI subcommand arg ...\fR
|
||||
.TP
|
||||
\fBself\fI script\fR
|
||||
.TP
|
||||
\fBself\fR
|
||||
.
|
||||
This command is equivalent to calling \fBoo::objdefine\fR on the class being
|
||||
defined (see \fBCONFIGURING OBJECTS\fR below for a description of the
|
||||
@@ -151,20 +210,29 @@ and
|
||||
.QW "\fBoo::define \fIcls \fBself \fIsubcommand ...\fR"
|
||||
operates identically to
|
||||
.QW "\fBoo::objdefine \fIcls subcommand ...\fR" .
|
||||
.RS
|
||||
.PP
|
||||
.VS TIP470
|
||||
If no arguments at all are used, this gives the name of the class currently
|
||||
being configured.
|
||||
.VE TIP470
|
||||
.VS TIP500
|
||||
If in a private definition context (see the \fBprivate\fR definition command,
|
||||
below), the definitions on the class object will also be made in a private
|
||||
definition context.
|
||||
.VE TIP500
|
||||
.RE
|
||||
.TP
|
||||
\fBsuperclass\fR ?\fI\-slotOperation\fR? ?\fIclassName ...\fR?
|
||||
.VS
|
||||
.
|
||||
This slot (see \fBSLOTTED DEFINITIONS\fR below)
|
||||
.VE
|
||||
allows the alteration of the superclasses of the class being defined.
|
||||
Each \fIclassName\fR argument names one class that is to be a superclass of
|
||||
the defined class. Note that objects must not be changed from being classes to
|
||||
being non-classes or vice-versa, that an empty parent class is equivalent to
|
||||
\fBoo::object\fR, and that the parent classes of \fBoo::object\fR and
|
||||
\fBoo::class\fR may not be modified.
|
||||
.VS
|
||||
By default, this slot works by replacement.
|
||||
.VE
|
||||
.TP
|
||||
\fBunexport\fI name \fR?\fIname ...\fR?
|
||||
.
|
||||
@@ -176,18 +244,31 @@ actually defined by a superclass; subclass unexports override superclass
|
||||
visibility, and may be overridden by instance unexports.
|
||||
.TP
|
||||
\fBvariable\fR ?\fI\-slotOperation\fR? ?\fIname ...\fR?
|
||||
.VS
|
||||
.
|
||||
This slot (see \fBSLOTTED DEFINITIONS\fR below) arranges for each of the named
|
||||
variables to be automatically made
|
||||
available in the methods, constructor and destructor declared by the class
|
||||
being defined. Each variable name must not have any namespace
|
||||
separators and must not look like an array access. All variables will be
|
||||
actually present in the instance object on which the method is executed. Note
|
||||
actually present in the namespace of the instance object on which the method
|
||||
is executed. Note
|
||||
that the variable lists declared by a superclass or subclass are completely
|
||||
disjoint, as are variable lists declared by instances; the list of variable
|
||||
names is just for methods (and constructors and destructors) declared by this
|
||||
class. By default, this slot works by appending.
|
||||
.VE
|
||||
.RS
|
||||
.PP
|
||||
.VS TIP500
|
||||
If in a private definition context (see the \fBprivate\fR definition command,
|
||||
below), this slot manipulates the list of private variable bindings for this
|
||||
class. In a private variable binding, the name of the variable within the
|
||||
instance object is different to the name given in the definition; the name
|
||||
used in the definition is the name that you use to access the variable within
|
||||
the methods of this class, and the name of the variable in the instance
|
||||
namespace has a unique prefix that makes accidental use from other classes
|
||||
extremely unlikely.
|
||||
.VE TIP500
|
||||
.RE
|
||||
.SS "CONFIGURING OBJECTS"
|
||||
.PP
|
||||
The following commands are supported in the \fIdefScript\fR for
|
||||
@@ -214,18 +295,15 @@ being defined. Note that the methods themselves may be actually defined by a
|
||||
class or superclass; object exports override class visibility.
|
||||
.TP
|
||||
\fBfilter\fR ?\fI\-slotOperation\fR? ?\fImethodName ...\fR?
|
||||
.VS
|
||||
.
|
||||
This slot (see \fBSLOTTED DEFINITIONS\fR below)
|
||||
.VE
|
||||
sets or updates the list of method names that are used to guard whether a
|
||||
method call to the object may be called and what the method's results are.
|
||||
Each \fImethodName\fR names a single filtering method (which may be exposed or
|
||||
not exposed); it is not an error for a non-existent method to be named. Note
|
||||
that the actual list of filters also depends on the filters set upon any
|
||||
classes that the object is an instance of.
|
||||
.VS
|
||||
By default, this slot works by appending.
|
||||
.VE
|
||||
.TP
|
||||
\fBforward\fI name cmdName \fR?\fIarg ...\fR?
|
||||
.
|
||||
@@ -235,6 +313,13 @@ additional arguments, \fIarg\fR etc., added before those arguments specified
|
||||
by the caller of the method. Forwarded methods should be deleted using the
|
||||
\fBmethod\fR subcommand. The method will be exported if \fIname\fR starts with
|
||||
a lower-case letter, and non-exported otherwise.
|
||||
.RS
|
||||
.PP
|
||||
.VS TIP500
|
||||
If in a private definition context (see the \fBprivate\fR definition command,
|
||||
below), this command creates private forwarded methods.
|
||||
.VE TIP500
|
||||
.RE
|
||||
.TP
|
||||
\fBmethod\fI name argList bodyScript\fR
|
||||
.
|
||||
@@ -245,17 +330,38 @@ method will be \fIbodyScript\fR. When the body of the method is evaluated, the
|
||||
current namespace of the method will be a namespace that is unique to the
|
||||
object. The method will be exported if \fIname\fR starts with a lower-case
|
||||
letter, and non-exported otherwise.
|
||||
.RS
|
||||
.PP
|
||||
.VS TIP500
|
||||
If in a private definition context (see the \fBprivate\fR definition command,
|
||||
below), this command creates private procedure-like methods.
|
||||
.VE TIP500
|
||||
.RE
|
||||
.TP
|
||||
\fBmixin\fR ?\fI\-slotOperation\fR? ?\fIclassName ...\fR?
|
||||
.VS
|
||||
.
|
||||
This slot (see \fBSLOTTED DEFINITIONS\fR below)
|
||||
.VE
|
||||
sets or updates a per-object list of additional classes that are to be
|
||||
mixed into the object. Each argument, \fIclassName\fR, names a single class
|
||||
that is to be mixed in.
|
||||
.VS
|
||||
By default, this slot works by replacement.
|
||||
.VE
|
||||
.TP
|
||||
\fBprivate \fIcmd arg...\fR
|
||||
.TP
|
||||
\fBprivate \fIscript\fR
|
||||
.VS TIP500
|
||||
This evaluates the \fIscript\fR (or the list of command and arguments given by
|
||||
\fIcmd\fR and \fIarg\fRs) in a context where the definitions made on the
|
||||
current object will be private definitions.
|
||||
.RS
|
||||
.PP
|
||||
The following class definition commands are affected by \fBprivate\fR:
|
||||
\fBforward\fR, \fBmethod\fR, and \fBvariable\fR. Nesting \fBprivate\fR inside
|
||||
\fBprivate\fR has no cumulative effect; the innermost definition context is
|
||||
just a private definition context. All other definition commands have no
|
||||
difference in behavior when used in a private definition context.
|
||||
.RE
|
||||
.VE TIP500
|
||||
.TP
|
||||
\fBrenamemethod\fI fromName toName\fR
|
||||
.
|
||||
@@ -265,6 +371,11 @@ not previously refer to a method in that object. Does not affect the classes
|
||||
that the object is an instance of. Does not change the export status of the
|
||||
method; if it was exported before, it will be afterwards.
|
||||
.TP
|
||||
\fBself \fR
|
||||
.VS TIP470
|
||||
This gives the name of the object currently being configured.
|
||||
.VE TIP470
|
||||
.TP
|
||||
\fBunexport\fI name \fR?\fIname ...\fR?
|
||||
.
|
||||
This arranges for each of the named methods, \fIname\fR, to be not exported
|
||||
@@ -274,36 +385,70 @@ object being defined. Note that the methods themselves may be actually defined
|
||||
by a class; instance unexports override class visibility.
|
||||
.TP
|
||||
\fBvariable\fR ?\fI\-slotOperation\fR? ?\fIname ...\fR?
|
||||
.VS
|
||||
.
|
||||
This slot (see \fBSLOTTED DEFINITIONS\fR below) arranges for each of the named
|
||||
variables to be automatically made available in the methods declared by the
|
||||
object being defined. Each variable name must not have any namespace
|
||||
separators and must not look like an array access. All variables will be
|
||||
actually present in the object on which the method is executed. Note that the
|
||||
actually present in the namespace of the object on which the method is
|
||||
executed. Note that the
|
||||
variable lists declared by the classes and mixins of which the object is an
|
||||
instance are completely disjoint; the list of variable names is just for
|
||||
methods declared by this object. By default, this slot works by appending.
|
||||
.RS
|
||||
.PP
|
||||
.VS TIP500
|
||||
If in a private definition context (see the \fBprivate\fR definition command,
|
||||
below), this slot manipulates the list of private variable bindings for this
|
||||
object. In a private variable binding, the name of the variable within the
|
||||
instance object is different to the name given in the definition; the name
|
||||
used in the definition is the name that you use to access the variable within
|
||||
the methods of this instance object, and the name of the variable in the
|
||||
instance namespace has a unique prefix that makes accidental use from
|
||||
superclass methods extremely unlikely.
|
||||
.VE TIP500
|
||||
.RE
|
||||
.SH "PRIVATE METHODS"
|
||||
.VS TIP500
|
||||
When a class or instance has a private method, that private method can only be
|
||||
invoked from within methods of that class or instance. Other callers of the
|
||||
object's methods \fIcannot\fR invoke private methods, it is as if the private
|
||||
methods do not exist. However, a private method of a class \fIcan\fR be
|
||||
invoked from the class's methods when those methods are being used on another
|
||||
instance object; this means that a class can use them to coordinate behaviour
|
||||
between several instances of itself without interfering with how other
|
||||
classes (especially either subclasses or superclasses) interact. Private
|
||||
methods precede all mixed in classes in the method call order (as reported by
|
||||
\fBself call\fR).
|
||||
.VE TIP500
|
||||
.SH "SLOTTED DEFINITIONS"
|
||||
Some of the configurable definitions of a class or object are \fIslotted
|
||||
definitions\fR. This means that the configuration is implemented by a slot
|
||||
object, that is an instance of the class \fBoo::Slot\fR, which manages a list
|
||||
of values (class names, variable names, etc.) that comprises the contents of
|
||||
the slot. The class defines three operations (as methods) that may be done on
|
||||
the slot. The class defines five operations (as methods) that may be done on
|
||||
the slot:
|
||||
.VE
|
||||
.TP
|
||||
\fIslot\fR \fB\-append\fR ?\fImember ...\fR?
|
||||
.VS
|
||||
.
|
||||
This appends the given \fImember\fR elements to the slot definition.
|
||||
.VE
|
||||
.TP
|
||||
\fIslot\fR \fB\-clear\fR
|
||||
.VS
|
||||
.
|
||||
This sets the slot definition to the empty list.
|
||||
.VE
|
||||
.TP
|
||||
\fIslot\fR \fB\-prepend\fR ?\fImember ...\fR?
|
||||
.VS TIP516
|
||||
This prepends the given \fImember\fR elements to the slot definition.
|
||||
.VE TIP516
|
||||
.TP
|
||||
\fIslot\fR \fB\-remove\fR ?\fImember ...\fR?
|
||||
.VS TIP516
|
||||
This removes the given \fImember\fR elements from the slot definition.
|
||||
.VE TIP516
|
||||
.TP
|
||||
\fIslot\fR \fB\-set\fR ?\fImember ...\fR?
|
||||
.VS
|
||||
.
|
||||
This replaces the slot definition with the given \fImember\fR elements.
|
||||
.PP
|
||||
A consequence of this is that any use of a slot's default operation where the
|
||||
@@ -316,20 +461,55 @@ which is forwarded to the default operation of the slot (thus, for the class
|
||||
slot, this is forwarded to
|
||||
.QW "\fBmy \-append\fR" ),
|
||||
and these methods which provide the implementation interface:
|
||||
.VE
|
||||
.TP
|
||||
\fIslot\fR \fBGet\fR
|
||||
.VS
|
||||
Returns a list that is the current contents of the slot. This method must
|
||||
always be called from a stack frame created by a call to \fBoo::define\fR or
|
||||
\fBoo::objdefine\fR.
|
||||
.VE
|
||||
.
|
||||
Returns a list that is the current contents of the slot, but does not modify
|
||||
the slot. This method must always be called from a stack frame created by a
|
||||
call to \fBoo::define\fR or \fBoo::objdefine\fR. This method \fIshould not\fR
|
||||
return an error unless it is called from outside a definition context or with
|
||||
the wrong number of arguments.
|
||||
.RS
|
||||
.PP
|
||||
.VS TIP516
|
||||
The elements of the list should be fully resolved, if that is a meaningful
|
||||
concept to the slot.
|
||||
.VE TIP516
|
||||
.RE
|
||||
.TP
|
||||
\fIslot\fR \fBResolve\fR \fIslotElement\fR
|
||||
.VS TIP516
|
||||
Returns \fIslotElement\fR with a resolution operation applied to it, but does
|
||||
not modify the slot. For slots of simple strings, this is an operation that
|
||||
does nothing, whereas for slots of classes, this maps a class name to its
|
||||
fully-qualified class name. This method must always be called from a stack
|
||||
frame created by a call to \fBoo::define\fR or \fBoo::objdefine\fR. This
|
||||
method \fIshould not\fR return an error unless it is called from outside a
|
||||
definition context or with the wrong number of arguments; unresolvable
|
||||
arguments should be returned as is (as not all slot operations strictly
|
||||
require that values are resolvable to work).
|
||||
.RS
|
||||
.PP
|
||||
Implementations \fIshould not\fR enforce uniqueness and ordering constraints
|
||||
in this method; that is the responsibility of the \fBSet\fR method.
|
||||
.RE
|
||||
.VE TIP516
|
||||
.TP
|
||||
\fIslot\fR \fBSet \fIelementList\fR
|
||||
.VS
|
||||
.
|
||||
Sets the contents of the slot to the list \fIelementList\fR and returns the
|
||||
empty string. This method must always be called from a stack frame created by
|
||||
a call to \fBoo::define\fR or \fBoo::objdefine\fR.
|
||||
a call to \fBoo::define\fR or \fBoo::objdefine\fR. This method may return an
|
||||
error if it rejects the change to the slot contents (e.g., because of invalid
|
||||
values) as well as if it is called from outside a definition context or with
|
||||
the wrong number of arguments.
|
||||
.RS
|
||||
.PP
|
||||
This method \fImay\fR reorder and filter the elements if this is necessary in
|
||||
order to satisfy the underlying constraints of the slot. (For example, slots
|
||||
of classes enforce a uniqueness constraint that places each element in the
|
||||
earliest location in the slot that it can.)
|
||||
.RE
|
||||
.PP
|
||||
The implementation of these methods is slot-dependent (and responsible for
|
||||
accessing the correct part of the class or object definition). Slots also have
|
||||
@@ -337,7 +517,14 @@ an unknown method handler to tie all these pieces together, and they hide
|
||||
their \fBdestroy\fR method so that it is not invoked inadvertently. It is
|
||||
\fIrecommended\fR that any user changes to the slot mechanism be restricted to
|
||||
defining new operations whose names start with a hyphen.
|
||||
.VE
|
||||
.PP
|
||||
.VS TIP516
|
||||
Most slot operations will initially \fBResolve\fR their argument list, combine
|
||||
it with the results of the \fBGet\fR method, and then \fBSet\fR the result.
|
||||
Some operations omit one or both of the first two steps; omitting the third
|
||||
would result in an idempotent read-only operation (but the standard mechanism
|
||||
for reading from slots is via \fBinfo class\fR and \fBinfo object\fR).
|
||||
.VE TIP516
|
||||
.SH EXAMPLES
|
||||
This example demonstrates how to use both forms of the \fBoo::define\fR and
|
||||
\fBoo::objdefine\fR commands (they work in the same way), as well as
|
||||
@@ -394,6 +581,84 @@ oo::class create B {
|
||||
inst m1 \fI\(-> prints "red brick"\fR
|
||||
inst m2 \fI\(-> prints "blue brick"\fR
|
||||
.CE
|
||||
.PP
|
||||
.VS TIP478
|
||||
This example shows how to create and use class variables. It is a class that
|
||||
counts how many instances of itself have been made.
|
||||
.PP
|
||||
.CS
|
||||
oo::class create Counted
|
||||
\fBoo::define\fR Counted {
|
||||
\fBinitialise\fR {
|
||||
variable count 0
|
||||
}
|
||||
|
||||
\fBvariable\fR number
|
||||
\fBconstructor\fR {} {
|
||||
classvariable count
|
||||
set number [incr count]
|
||||
}
|
||||
|
||||
\fBmethod\fR report {} {
|
||||
classvariable count
|
||||
puts "This is instance $number of $count"
|
||||
}
|
||||
}
|
||||
|
||||
set a [Counted new]
|
||||
set b [Counted new]
|
||||
$a report
|
||||
\fI\(-> This is instance 1 of 2\fR
|
||||
set c [Counted new]
|
||||
$b report
|
||||
\fI\(-> This is instance 2 of 3\fR
|
||||
$c report
|
||||
\fI\(-> This is instance 3 of 3\fR
|
||||
.CE
|
||||
.PP
|
||||
This example demonstrates how to use class methods. (Note that the constructor
|
||||
for \fBoo::class\fR calls \fBoo::define\fR on the class.)
|
||||
.PP
|
||||
.CS
|
||||
oo::class create DBTable {
|
||||
\fBclassmethod\fR find {description} {
|
||||
puts "DB: locate row from [self] matching $description"
|
||||
return [my new]
|
||||
}
|
||||
\fBclassmethod\fR insert {description} {
|
||||
puts "DB: create row in [self] matching $description"
|
||||
return [my new]
|
||||
}
|
||||
\fBmethod\fR update {description} {
|
||||
puts "DB: update row [self] with $description"
|
||||
}
|
||||
\fBmethod\fR delete {} {
|
||||
puts "DB: delete row [self]"
|
||||
my destroy; # Just delete the object, not the DB row
|
||||
}
|
||||
}
|
||||
|
||||
oo::class create Users {
|
||||
\fBsuperclass\fR DBTable
|
||||
}
|
||||
oo::class create Groups {
|
||||
\fBsuperclass\fR DBTable
|
||||
}
|
||||
|
||||
set u1 [Users insert "username=abc"]
|
||||
\fI\(-> DB: create row from ::Users matching username=abc\fR
|
||||
set u2 [Users insert "username=def"]
|
||||
\fI\(-> DB: create row from ::Users matching username=def\fR
|
||||
$u2 update "group=NULL"
|
||||
\fI\(-> DB: update row ::oo::Obj124 with group=NULL\fR
|
||||
$u1 delete
|
||||
\fI\(-> DB: delete row ::oo::Obj123\fR
|
||||
set g [Group find "groupname=webadmins"]
|
||||
\fI\(-> DB: locate row ::Group with groupname=webadmins\fR
|
||||
$g update "emailaddress=admins"
|
||||
\fI\(-> DB: update row ::oo::Obj125 with emailaddress=admins\fR
|
||||
.CE
|
||||
.VE TIP478
|
||||
.SH "SEE ALSO"
|
||||
next(n), oo::class(n), oo::object(n)
|
||||
.SH KEYWORDS
|
||||
|
||||
+35
@@ -27,6 +27,11 @@ key maps to in the dictionary value contained in the given variable,
|
||||
writing the resulting dictionary value back to that variable.
|
||||
Non-existent keys are treated as if they map to an empty string. The
|
||||
updated dictionary value is returned.
|
||||
.VS TIP508
|
||||
If \fIdictionaryVarable\fR indicates an element that does not exist of an
|
||||
array that has a default value set, the default value and will be used as the
|
||||
value of the dictionary prior to the appending operation.
|
||||
.VE TIP508
|
||||
.TP
|
||||
\fBdict create \fR?\fIkey value ...\fR?
|
||||
.
|
||||
@@ -124,6 +129,11 @@ resulting dictionary value back to that variable. Non-existent keys
|
||||
are treated as if they map to 0. It is an error to increment a value
|
||||
for an existing key if that value is not an integer. The updated
|
||||
dictionary value is returned.
|
||||
.VS TIP508
|
||||
If \fIdictionaryVarable\fR indicates an element that does not exist of an
|
||||
array that has a default value set, the default value and will be used as the
|
||||
value of the dictionary prior to the incrementing operation.
|
||||
.VE TIP508
|
||||
.TP
|
||||
\fBdict info \fIdictionaryValue\fR
|
||||
.
|
||||
@@ -149,6 +159,11 @@ keys are treated as if they map to an empty list, and it is legal for
|
||||
there to be no items to append to the list. It is an error for the
|
||||
value that the key maps to to not be representable as a list. The
|
||||
updated dictionary value is returned.
|
||||
.VS TIP508
|
||||
If \fIdictionaryVarable\fR indicates an element that does not exist of an
|
||||
array that has a default value set, the default value and will be used as the
|
||||
value of the dictionary prior to the list-appending operation.
|
||||
.VE TIP508
|
||||
.TP
|
||||
\fBdict map \fR{\fIkeyVariable valueVariable\fR} \fIdictionaryValue body\fR
|
||||
.
|
||||
@@ -206,6 +221,11 @@ value and places an updated dictionary value in that variable
|
||||
containing a mapping from the given key to the given value. When
|
||||
multiple keys are present, this operation creates or updates a chain
|
||||
of nested dictionaries. The updated dictionary value is returned.
|
||||
.VS TIP508
|
||||
If \fIdictionaryVarable\fR indicates an element that does not exist of an
|
||||
array that has a default value set, the default value and will be used as the
|
||||
value of the dictionary prior to the value insert/update operation.
|
||||
.VE TIP508
|
||||
.TP
|
||||
\fBdict size \fIdictionaryValue\fR
|
||||
.
|
||||
@@ -221,6 +241,11 @@ through nested dictionaries to the mapping to remove. At least one key
|
||||
must be specified, but the last key on the key-path need not exist.
|
||||
All other components on the path must exist. The updated dictionary
|
||||
value is returned.
|
||||
.VS TIP508
|
||||
If \fIdictionaryVarable\fR indicates an element that does not exist of an
|
||||
array that has a default value set, the default value and will be used as the
|
||||
value of the dictionary prior to the value remove operation.
|
||||
.VE TIP508
|
||||
.TP
|
||||
\fBdict update \fIdictionaryVariable key varName \fR?\fIkey varName ...\fR? \fIbody\fR
|
||||
.
|
||||
@@ -236,6 +261,11 @@ are silently discarded), even if the result of \fIbody\fR is an error
|
||||
or some other kind of exceptional exit. The result of \fBdict
|
||||
update\fR is (unless some kind of error occurs) the result of the
|
||||
evaluation of \fIbody\fR.
|
||||
.VS TIP508
|
||||
If \fIdictionaryVarable\fR indicates an element that does not exist of an
|
||||
array that has a default value set, the default value and will be used as the
|
||||
value of the dictionary prior to the update operation.
|
||||
.VE TIP508
|
||||
.RS
|
||||
.PP
|
||||
Each \fIvarName\fR is mapped in the scope enclosing the \fBdict update\fR;
|
||||
@@ -270,6 +300,11 @@ dictionary be discarded, and this also happens if the contents of
|
||||
dictionaries no longer exists. The result of \fBdict with\fR is
|
||||
(unless some kind of error occurs) the result of the evaluation of
|
||||
\fIbody\fR.
|
||||
.VS TIP508
|
||||
If \fIdictionaryVarable\fR indicates an element that does not exist of an
|
||||
array that has a default value set, the default value and will be used as the
|
||||
value of the dictionary prior to the updating operation.
|
||||
.VE TIP508
|
||||
.RS
|
||||
.PP
|
||||
The variables are mapped in the scope enclosing the \fBdict with\fR;
|
||||
|
||||
@@ -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 eof n 7.5 Tcl "Tcl Built-In Commands"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+1
-1
@@ -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 eval n "" Tcl "Tcl Built-In Commands"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+1
-1
@@ -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 exit n "" Tcl "Tcl Built-In Commands"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+172
-214
@@ -17,14 +17,14 @@ expr \- Evaluate an expression
|
||||
.BE
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
Concatenates \fIarg\fRs (adding separator spaces between them),
|
||||
evaluates the result as a Tcl expression, and returns the value.
|
||||
The operators permitted in Tcl expressions include a subset of
|
||||
Concatenates \fIarg\fRs, separated by a space, into an expression, and evaluates
|
||||
that expression, returning its value.
|
||||
The operators permitted in an expression include a subset of
|
||||
the operators permitted in C expressions. For those operators
|
||||
common to both Tcl and C, Tcl applies the same meaning and precedence
|
||||
as the corresponding C operators.
|
||||
Expressions almost always yield numeric results
|
||||
(integer or floating-point values).
|
||||
The value of an expression is often a numeric result, either an integer or a
|
||||
floating-point value, but may also be a non-numeric value.
|
||||
For example, the expression
|
||||
.PP
|
||||
.CS
|
||||
@@ -32,78 +32,69 @@ For example, the expression
|
||||
.CE
|
||||
.PP
|
||||
evaluates to 14.2.
|
||||
Tcl expressions differ from C expressions in the way that
|
||||
operands are specified. Also, Tcl expressions support
|
||||
non-numeric operands and string comparisons, as well as some
|
||||
Expressions differ from C expressions in the way that
|
||||
operands are specified. Expressions also support
|
||||
non-numeric operands, string comparisons, and some
|
||||
additional operators not found in C.
|
||||
.PP
|
||||
When an expression evaluates to an integer, the value is the decimal form of
|
||||
the integer, and when an expression evaluates to a floating-point number, the
|
||||
value is the form produced by the \fB%g\fR format specifier of Tcl's
|
||||
\fBformat\fR command.
|
||||
.SS OPERANDS
|
||||
.PP
|
||||
A Tcl expression consists of a combination of operands, operators,
|
||||
parentheses and commas.
|
||||
White space may be used between the operands and operators and
|
||||
parentheses (or commas); it is ignored by the expression's instructions.
|
||||
Where possible, operands are interpreted as integer values.
|
||||
Integer values may be specified in decimal (the normal case), in binary
|
||||
(if the first two characters of the operand are \fB0b\fR), in octal
|
||||
(if the first two characters of the operand are \fB0o\fR), or in hexadecimal
|
||||
(if the first two characters of the operand are \fB0x\fR). For
|
||||
compatibility with older Tcl releases, an octal integer value is also
|
||||
indicated simply when the first character of the operand is \fB0\fR,
|
||||
whether or not the second character is also \fBo\fR.
|
||||
If an operand does not have one of the integer formats given
|
||||
above, then it is treated as a floating-point number if that is
|
||||
possible. Floating-point numbers may be specified in any of several
|
||||
common formats making use of the decimal digits, the decimal point \fB.\fR,
|
||||
the characters \fBe\fR or \fBE\fR indicating scientific notation, and
|
||||
the sign characters \fB+\fR or \fB\-\fR. For example, all of the
|
||||
following are valid floating-point numbers: 2.1, 3., 6e4, 7.91e+16.
|
||||
Also recognized as floating point values are the strings \fBInf\fR
|
||||
and \fBNaN\fR making use of any case for each character.
|
||||
If no numeric interpretation is possible (note that all literal
|
||||
operands that are not numeric or boolean must be quoted with either
|
||||
braces or with double quotes), then an operand is left as a string
|
||||
(and only a limited set of operators may be applied to it).
|
||||
An expression consists of a combination of operands, operators, parentheses and
|
||||
commas, possibly with whitespace between any of these elements, which is
|
||||
ignored.
|
||||
An integer operand may be specified in decimal (the normal case, the optional
|
||||
first two characters are \fB0d\fR), binary
|
||||
(the first two characters are \fB0b\fR), octal
|
||||
(the first two characters are \fB0o\fR), or hexadecimal
|
||||
(the first two characters are \fB0x\fR) form. For
|
||||
compatibility with older Tcl releases, an operand that begins with \fB0\fR is
|
||||
interpreted as an octal integer even if the second character is not \fBo\fR.
|
||||
A floating-point number may be specified in any of several
|
||||
common decimal formats, and may use the decimal point \fB.\fR,
|
||||
\fBe\fR or \fBE\fR for scientific notation, and
|
||||
the sign characters \fB+\fR and \fB\-\fR. The
|
||||
following are all valid floating-point numbers: 2.1, 3., 6e4, 7.91e+16.
|
||||
The strings \fBInf\fR
|
||||
and \fBNaN\fR, in any combination of case, are also recognized as floating point
|
||||
values. An operand that doesn't have a numeric interpretation must be quoted
|
||||
with either braces or with double quotes.
|
||||
.PP
|
||||
Operands may be specified in any of the following ways:
|
||||
An operand may be specified in any of the following ways:
|
||||
.IP [1]
|
||||
As a numeric value, either integer or floating-point.
|
||||
.IP [2]
|
||||
As a boolean value, using any form understood by \fBstring is\fR
|
||||
\fBboolean\fR.
|
||||
.IP [3]
|
||||
As a Tcl variable, using standard \fB$\fR notation.
|
||||
The variable's value will be used as the operand.
|
||||
As a variable, using standard \fB$\fR notation.
|
||||
The value of the variable is then the value of the operand.
|
||||
.IP [4]
|
||||
As a string enclosed in double-quotes.
|
||||
The expression parser will perform backslash, variable, and
|
||||
command substitutions on the information between the quotes,
|
||||
and use the resulting value as the operand
|
||||
Backslash, variable, and command substitution are performed as described in
|
||||
\fBTcl\fR.
|
||||
.IP [5]
|
||||
As a string enclosed in braces.
|
||||
The characters between the open brace and matching close brace
|
||||
will be used as the operand without any substitutions.
|
||||
The operand is treated as a braced value as described in \fBTcl\fR.
|
||||
.IP [6]
|
||||
As a Tcl command enclosed in brackets.
|
||||
The command will be executed and its result will be used as
|
||||
the operand.
|
||||
Command substitution is performed as described in \fBTcl\fR.
|
||||
.IP [7]
|
||||
As a mathematical function whose arguments have any of the above
|
||||
forms for operands, such as \fBsin($x)\fR. See \fBMATH FUNCTIONS\fR below for
|
||||
As a mathematical function such as \fBsin($x)\fR, whose arguments have any of the above
|
||||
forms for operands. See \fBMATH FUNCTIONS\fR below for
|
||||
a discussion of how mathematical functions are handled.
|
||||
.PP
|
||||
Where the above substitutions occur (e.g. inside quoted strings), they
|
||||
are performed by the expression's instructions.
|
||||
However, the command parser may already have performed one round of
|
||||
substitution before the expression processor was called.
|
||||
As discussed below, it is usually best to enclose expressions
|
||||
in braces to prevent the command parser from performing substitutions
|
||||
on the contents.
|
||||
Because \fBexpr\fR parses and performs substitutions on values that have
|
||||
already been parsed and substituted by \fBTcl\fR, it is usually best to enclose
|
||||
expressions in braces to avoid the first round of substitutions by
|
||||
\fBTcl\fR.
|
||||
.PP
|
||||
For some examples of simple expressions, suppose the variable
|
||||
\fBa\fR has the value 3 and
|
||||
the variable \fBb\fR has the value 6.
|
||||
Then the command on the left side of each of the lines below
|
||||
will produce the value on the right side of the line:
|
||||
Below are some examples of simple expressions where the value of \fBa\fR is 3
|
||||
and the value of \fBb\fR is 6. The command on the left side of each line
|
||||
produces the value on the right side.
|
||||
.PP
|
||||
.CS
|
||||
.ta 6c
|
||||
@@ -114,34 +105,41 @@ will produce the value on the right side of the line:
|
||||
.CE
|
||||
.SS OPERATORS
|
||||
.PP
|
||||
The valid operators (most of which are also available as commands in
|
||||
the \fBtcl::mathop\fR namespace; see the \fBmathop\fR(n) manual page
|
||||
for details) are listed below, grouped in decreasing order of precedence:
|
||||
For operators having both a numeric mode and a string mode, the numeric mode is
|
||||
chosen when all operands have a numeric interpretation. The integer
|
||||
interpretation of an operand is preferred over the floating-point
|
||||
interpretation. To ensure string operations on arbitrary values it is generally a
|
||||
good idea to use \fBeq\fR, \fBne\fR, or the \fBstring\fR command instead of
|
||||
more versatile operators such as \fB==\fR.
|
||||
.PP
|
||||
Unless otherwise specified, operators accept non-numeric operands. The value
|
||||
of a boolean operation is 1 if true, 0 otherwise. See also \fBstring is\fR
|
||||
\fBboolean\fR. The valid operators, most of which are also available as
|
||||
commands in the \fBtcl::mathop\fR namespace (see \fBmathop\fR(n)), are listed
|
||||
below, grouped in decreasing order of precedence:
|
||||
.TP 20
|
||||
\fB\-\0\0+\0\0~\0\0!\fR
|
||||
.
|
||||
Unary minus, unary plus, bit-wise NOT, logical NOT. None of these operators
|
||||
may be applied to string operands, and bit-wise NOT may be
|
||||
applied only to integers.
|
||||
Unary minus, unary plus, bit-wise NOT, logical NOT. These operators
|
||||
may only be applied to numeric operands, and bit-wise NOT may only be
|
||||
applied to integers.
|
||||
.TP 20
|
||||
\fB**\fR
|
||||
.
|
||||
Exponentiation. Valid for any numeric operands.
|
||||
Exponentiation. Valid for numeric operands.
|
||||
.TP 20
|
||||
\fB*\0\0/\0\0%\fR
|
||||
.
|
||||
Multiply, divide, remainder. None of these operators may be
|
||||
applied to string operands, and remainder may be applied only
|
||||
to integers.
|
||||
The remainder will always have the same sign as the divisor and
|
||||
an absolute value smaller than the absolute value of the divisor.
|
||||
Multiply and divide, which are valid for numeric operands, and remainder, which
|
||||
is valid for integers. The remainder, an absolute value smaller than the
|
||||
absolute value of the divisor, has the same sign as the divisor.
|
||||
.RS
|
||||
.PP
|
||||
When applied to integers, the division and remainder operators can be
|
||||
considered to partition the number line into a sequence of equal-sized
|
||||
adjacent non-overlapping pieces where each piece is the size of the divisor;
|
||||
the division result identifies which piece the divisor lay within, and the
|
||||
remainder result identifies where within that piece the divisor lay. A
|
||||
When applied to integers, division and remainder can be
|
||||
considered to partition the number line into a sequence of
|
||||
adjacent non-overlapping pieces, where each piece is the size of the divisor;
|
||||
the quotient identifies which piece the dividend lies within, and the
|
||||
remainder identifies where within that piece the dividend lies. A
|
||||
consequence of this is that the result of
|
||||
.QW "-57 \fB/\fR 10"
|
||||
is always -6, and the result of
|
||||
@@ -151,177 +149,157 @@ is always 3.
|
||||
.TP 20
|
||||
\fB+\0\0\-\fR
|
||||
.
|
||||
Add and subtract. Valid for any numeric operands.
|
||||
Add and subtract. Valid for numeric operands.
|
||||
.TP 20
|
||||
\fB<<\0\0>>\fR
|
||||
.
|
||||
Left and right shift. Valid for integer operands only.
|
||||
Left and right shift. Valid for integers.
|
||||
A right shift always propagates the sign bit.
|
||||
.TP 20
|
||||
\fB<\0\0>\0\0<=\0\0>=\fR
|
||||
.
|
||||
Boolean less, greater, less than or equal, and greater than or equal.
|
||||
Each operator produces 1 if the condition is true, 0 otherwise.
|
||||
These operators may be applied to strings as well as numeric operands,
|
||||
in which case string comparison is used.
|
||||
Boolean less than, greater than, less than or equal, and greater than or equal.
|
||||
.TP 20
|
||||
\fB==\0\0!=\fR
|
||||
.
|
||||
Boolean equal and not equal. Each operator produces a zero/one result.
|
||||
Valid for all operand types.
|
||||
Boolean equal and not equal.
|
||||
.TP 20
|
||||
\fBeq\0\0ne\fR
|
||||
.
|
||||
Boolean string equal and string not equal. Each operator produces a
|
||||
zero/one result. The operand types are interpreted only as strings.
|
||||
Boolean string equal and string not equal.
|
||||
.TP 20
|
||||
\fBin\0\0ni\fR
|
||||
.
|
||||
List containment and negated list containment. Each operator produces
|
||||
a zero/one result and treats its first argument as a string and its
|
||||
second argument as a Tcl list. The \fBin\fR operator indicates
|
||||
whether the first argument is a member of the second argument list;
|
||||
the \fBni\fR operator inverts the sense of the result.
|
||||
List containment and negated list containment. The first argument is
|
||||
interpreted as a string, the second as a list. \fBin\fR tests for membership
|
||||
in the list, and \fBni\fR is the inverse.
|
||||
.TP 20
|
||||
\fB&\fR
|
||||
.
|
||||
Bit-wise AND. Valid for integer operands only.
|
||||
Bit-wise AND. Valid for integer operands.
|
||||
.TP 20
|
||||
\fB^\fR
|
||||
.
|
||||
Bit-wise exclusive OR. Valid for integer operands only.
|
||||
Bit-wise exclusive OR. Valid for integer operands.
|
||||
.TP 20
|
||||
\fB|\fR
|
||||
.
|
||||
Bit-wise OR. Valid for integer operands only.
|
||||
Bit-wise OR. Valid for integer operands.
|
||||
.TP 20
|
||||
\fB&&\fR
|
||||
.
|
||||
Logical AND. Produces a 1 result if both operands are non-zero,
|
||||
0 otherwise.
|
||||
Valid for boolean and numeric (integers or floating-point) operands only.
|
||||
Logical AND. If both operands are true, the result is 1, or 0 otherwise.
|
||||
|
||||
.TP 20
|
||||
\fB||\fR
|
||||
.
|
||||
Logical OR. Produces a 0 result if both operands are zero, 1 otherwise.
|
||||
Valid for boolean and numeric (integers or floating-point) operands only.
|
||||
Logical OR. If both operands are false, the result is 0, or 1 otherwise.
|
||||
.TP 20
|
||||
\fIx\fB?\fIy\fB:\fIz\fR
|
||||
.
|
||||
If-then-else, as in C. If \fIx\fR
|
||||
evaluates to non-zero, then the result is the value of \fIy\fR.
|
||||
Otherwise the result is the value of \fIz\fR.
|
||||
The \fIx\fR operand must have a boolean or numeric value.
|
||||
If-then-else, as in C. If \fIx\fR is false , the result is the value of
|
||||
\fIy\fR. Otherwise the result is the value of \fIz\fR.
|
||||
.PP
|
||||
See the C manual for more details on the results
|
||||
produced by each operator.
|
||||
The exponentiation operator promotes types like the multiply and
|
||||
divide operators, and produces a result that is the same as the output
|
||||
of the \fBpow\fR function (after any type conversions.)
|
||||
All of the binary operators but exponentiation group left-to-right
|
||||
within the same precedence level; exponentiation groups right-to-left. For example, the command
|
||||
The exponentiation operator promotes types in the same way that the multiply
|
||||
and divide operators do, and the result is is the same as the result of
|
||||
\fBpow\fR.
|
||||
Exponentiation groups right-to-left within a precedence level. Other binary
|
||||
operators group left-to-right. For example, the value of
|
||||
.PP
|
||||
.CS
|
||||
\fBexpr\fR {4*2 < 7}
|
||||
.CE
|
||||
.PP
|
||||
returns 0, while
|
||||
is 0, while the value of
|
||||
.PP
|
||||
.CS
|
||||
\fBexpr\fR {2**3**2}
|
||||
.CE
|
||||
.PP
|
||||
returns 512.
|
||||
is 512.
|
||||
.PP
|
||||
The \fB&&\fR, \fB||\fR, and \fB?:\fR operators have
|
||||
As in C, \fB&&\fR, \fB||\fR, and \fB?:\fR feature
|
||||
.QW "lazy evaluation" ,
|
||||
just as in C, which means that operands are not evaluated if they are
|
||||
not needed to determine the outcome. For example, in the command
|
||||
which means that operands are not evaluated if they are
|
||||
not needed to determine the outcome. For example, in
|
||||
.PP
|
||||
.CS
|
||||
\fBexpr\fR {$v ? [a] : [b]}
|
||||
.CE
|
||||
.PP
|
||||
only one of
|
||||
.QW \fB[a]\fR
|
||||
or
|
||||
.QW \fB[b]\fR
|
||||
will actually be evaluated,
|
||||
depending on the value of \fB$v\fR. Note, however, that this is
|
||||
only true if the entire expression is enclosed in braces; otherwise
|
||||
the Tcl parser will evaluate both
|
||||
.QW \fB[a]\fR
|
||||
and
|
||||
.QW \fB[b]\fR
|
||||
before invoking the \fBexpr\fR command.
|
||||
only one of \fB[a]\fR or \fB[b]\fR is evaluated,
|
||||
depending on the value of \fB$v\fR. This is not true of the normal Tcl parser,
|
||||
so it is normally recommended to enclose the arguments to \fBexpr\fR in braces.
|
||||
Without braces, as in
|
||||
\fBexpr\fR $v ? [a] : [b]
|
||||
both \fB[a]\fR and \fB[b]\fR are evaluated before \fBexpr\fR is even called.
|
||||
.PP
|
||||
For more details on the results
|
||||
produced by each operator, see the documentation for C.
|
||||
.SS "MATH FUNCTIONS"
|
||||
.PP
|
||||
When the expression parser encounters a mathematical function
|
||||
such as \fBsin($x)\fR, it replaces it with a call to an ordinary
|
||||
Tcl function in the \fBtcl::mathfunc\fR namespace. The processing
|
||||
of an expression such as:
|
||||
A mathematical function such as \fBsin($x)\fR is replaced with a call to an ordinary
|
||||
Tcl command in the \fBtcl::mathfunc\fR namespace. The evaluation
|
||||
of an expression such as
|
||||
.PP
|
||||
.CS
|
||||
\fBexpr\fR {sin($x+$y)}
|
||||
.CE
|
||||
.PP
|
||||
is the same in every way as the processing of:
|
||||
is the same in every way as the evaluation of
|
||||
.PP
|
||||
.CS
|
||||
\fBexpr\fR {[tcl::mathfunc::sin [\fBexpr\fR {$x+$y}]]}
|
||||
.CE
|
||||
.PP
|
||||
which in turn is the same as the processing of:
|
||||
which in turn is the same as the evaluation of
|
||||
.PP
|
||||
.CS
|
||||
tcl::mathfunc::sin [\fBexpr\fR {$x+$y}]
|
||||
.CE
|
||||
.PP
|
||||
The executor will search for \fBtcl::mathfunc::sin\fR using the usual
|
||||
rules for resolving functions in namespaces. Either
|
||||
\fB::tcl::mathfunc::sin\fR or \fB[namespace
|
||||
current]::tcl::mathfunc::sin\fR will satisfy the request, and others
|
||||
may as well (depending on the current \fBnamespace path\fR setting).
|
||||
\fBtcl::mathfunc::sin\fR is resolved as described in
|
||||
\fBNAMESPACE RESOLUTION\fR in the \fBnamespace\fR(n) documentation. Given the
|
||||
default value of \fBnamespace path\fR, \fB[namespace
|
||||
current]::tcl::mathfunc::sin\fR or \fB::tcl::mathfunc::sin\fR are the typical
|
||||
resolutions.
|
||||
.PP
|
||||
Some mathematical functions have several arguments, separated by commas like in C. Thus:
|
||||
As in C, a mathematical function may accept multiple arguments separated by commas. Thus,
|
||||
.PP
|
||||
.CS
|
||||
\fBexpr\fR {hypot($x,$y)}
|
||||
.CE
|
||||
.PP
|
||||
ends up as
|
||||
becomes
|
||||
.PP
|
||||
.CS
|
||||
tcl::mathfunc::hypot $x $y
|
||||
.CE
|
||||
.PP
|
||||
See the \fBmathfunc\fR(n) manual page for the math functions that are
|
||||
See the \fBmathfunc\fR(n) documentation for the math functions that are
|
||||
available by default.
|
||||
.SS "TYPES, OVERFLOW, AND PRECISION"
|
||||
.PP
|
||||
All internal computations involving integers are done calling on the
|
||||
LibTomMath multiple precision integer library as required so that all
|
||||
integer calculations are performed exactly. Note that in Tcl releases
|
||||
prior to 8.5, integer calculations were performed with one of the C types
|
||||
When needed to guarantee exact performance, internal computations involving
|
||||
integers use the LibTomMath multiple precision integer library. In Tcl releases
|
||||
prior to 8.5, integer calculations were performed using one of the C types
|
||||
\fIlong int\fR or \fITcl_WideInt\fR, causing implicit range truncation
|
||||
in those calculations where values overflowed the range of those types.
|
||||
Any code that relied on these implicit truncations will need to explicitly
|
||||
add \fBint()\fR or \fBwide()\fR function calls to expressions at the points
|
||||
where such truncation is required to take place.
|
||||
Any code that relied on these implicit truncations should instead call
|
||||
\fBint()\fR or \fBwide()\fR, which do truncate.
|
||||
.PP
|
||||
All internal computations involving floating-point are
|
||||
done with the C type \fIdouble\fR.
|
||||
When converting a string to floating-point, exponent overflow is
|
||||
Internal floating-point computations are
|
||||
performed using the \fIdouble\fR C type.
|
||||
When converting a string to floating-point value, exponent overflow is
|
||||
detected and results in the \fIdouble\fR value of \fBInf\fR or
|
||||
\fB\-Inf\fR as appropriate. Floating-point overflow and underflow
|
||||
are detected to the degree supported by the hardware, which is generally
|
||||
pretty reliable.
|
||||
fairly reliable.
|
||||
.PP
|
||||
Conversion among internal representations for integer, floating-point,
|
||||
and string operands is done automatically as needed.
|
||||
For arithmetic computations, integers are used until some
|
||||
floating-point number is introduced, after which floating-point is used.
|
||||
For example,
|
||||
Conversion among internal representations for integer, floating-point, and
|
||||
string operands is done automatically as needed. For arithmetic computations,
|
||||
integers are used until some floating-point number is introduced, after which
|
||||
floating-point values are used. For example,
|
||||
.PP
|
||||
.CS
|
||||
\fBexpr\fR {5 / 4}
|
||||
@@ -335,82 +313,62 @@ returns 1, while
|
||||
.CE
|
||||
.PP
|
||||
both return 1.25.
|
||||
Floating-point values are always returned with a
|
||||
A floating-point result can be distinguished from an integer result by the
|
||||
presence of either
|
||||
.QW \fB.\fR
|
||||
or an
|
||||
or
|
||||
.QW \fBe\fR
|
||||
so that they will not look like integer values. For example,
|
||||
.PP
|
||||
. For example,
|
||||
.PP
|
||||
.CS
|
||||
\fBexpr\fR {20.0/5.0}
|
||||
.CE
|
||||
.PP
|
||||
returns \fB4.0\fR, not \fB4\fR.
|
||||
.SS "STRING OPERATIONS"
|
||||
.PP
|
||||
String values may be used as operands of the comparison operators,
|
||||
although the expression evaluator tries to do comparisons as integer
|
||||
or floating-point when it can,
|
||||
i.e., when all arguments to the operator allow numeric interpretations,
|
||||
except in the case of the \fBeq\fR and \fBne\fR operators.
|
||||
If one of the operands of a comparison is a string and the other
|
||||
has a numeric value, a canonical string representation of the numeric
|
||||
operand value is generated to compare with the string operand.
|
||||
Canonical string representation for integer values is a decimal string
|
||||
format. Canonical string representation for floating-point values
|
||||
is that produced by the \fB%g\fR format specifier of Tcl's
|
||||
\fBformat\fR command. For example, the commands
|
||||
.PP
|
||||
.CS
|
||||
\fBexpr\fR {"0x03" > "2"}
|
||||
\fBexpr\fR {"0y" > "0x12"}
|
||||
.CE
|
||||
.PP
|
||||
both return 1. The first comparison is done using integer
|
||||
comparison, and the second is done using string comparison.
|
||||
Because of Tcl's tendency to treat values as numbers whenever
|
||||
possible, it is not generally a good idea to use operators like \fB==\fR
|
||||
when you really want string comparison and the values of the
|
||||
operands could be arbitrary; it is better in these cases to use
|
||||
the \fBeq\fR or \fBne\fR operators, or the \fBstring\fR command instead.
|
||||
.SH "PERFORMANCE CONSIDERATIONS"
|
||||
.PP
|
||||
Enclose expressions in braces for the best speed and the smallest
|
||||
storage requirements.
|
||||
This allows the Tcl bytecode compiler to generate the best code.
|
||||
.PP
|
||||
As mentioned above, expressions are substituted twice:
|
||||
once by the Tcl parser and once by the \fBexpr\fR command.
|
||||
For example, the commands
|
||||
Where an expression contains syntax that Tcl would otherwise perform
|
||||
substitutions on, enclosing an expression in braces or otherwise quoting it
|
||||
so that it's a static value allows the Tcl compiler to generate bytecode for
|
||||
the expression, resulting in better speed and smaller storage requirements.
|
||||
This also avoids issues that can arise if Tcl is allowed to perform
|
||||
substitution on the value before \fBexpr\fR is called.
|
||||
.PP
|
||||
In the following example, the value of the expression is 11 because the Tcl parser first
|
||||
substitutes \fB$b\fR and \fBexpr\fR then substitutes \fB$a\fR. Enclosing the
|
||||
expression in braces would result in a syntax error.
|
||||
.CS
|
||||
set a 3
|
||||
set b {$a + 2}
|
||||
\fBexpr\fR $b*4
|
||||
.CE
|
||||
.PP
|
||||
return 11, not a multiple of 4.
|
||||
This is because the Tcl parser will first substitute \fB$a + 2\fR for
|
||||
the variable \fBb\fR,
|
||||
then the \fBexpr\fR command will evaluate the expression \fB$a + 2*4\fR.
|
||||
.PP
|
||||
Most expressions do not require a second round of substitutions.
|
||||
Either they are enclosed in braces or, if not,
|
||||
their variable and command substitutions yield numbers or strings
|
||||
that do not themselves require substitutions.
|
||||
However, because a few unbraced expressions
|
||||
need two rounds of substitutions,
|
||||
the bytecode compiler must emit
|
||||
additional instructions to handle this situation.
|
||||
The most expensive code is required for
|
||||
unbraced expressions that contain command substitutions.
|
||||
These expressions must be implemented by generating new code
|
||||
each time the expression is executed.
|
||||
When the expression is unbraced to allow the substitution of a function or
|
||||
operator, consider using the commands documented in the \fBmathfunc\fR(n) or
|
||||
\fBmathop\fR(n) manual pages directly instead.
|
||||
|
||||
When an expression is generated at runtime, like the one above is, the bytcode
|
||||
compiler must ensure that new code is generated each time the expression
|
||||
is evaluated. This is the most costly kind of expression from a performance
|
||||
perspective. In such cases, consider directly using the commands described in
|
||||
the \fBmathfunc\fR(n) or \fBmathop\fR(n) documentation instead of \fBexpr\fR.
|
||||
|
||||
Most expressions are not formed at runtime, but are literal strings or contain
|
||||
substitutions that don't introduce other substitutions. To allow the bytecode
|
||||
compiler to work with an expression as a string literal at compilation time,
|
||||
ensure that it contains no substitutions or that it is enclosed in braces or
|
||||
otherwise quoted to prevent Tcl from performing substitutions, allowing
|
||||
\fBexpr\fR to perform them instead.
|
||||
.SH EXAMPLES
|
||||
.PP
|
||||
A numeric comparison whose result is 1:
|
||||
.CS
|
||||
\fBexpr\fR {"0x03" > "2"}
|
||||
.CE
|
||||
.PP
|
||||
A string comparison whose result is 1:
|
||||
.CS
|
||||
\fBexpr\fR {"0y" > "0x12"}
|
||||
.CE
|
||||
.PP
|
||||
Define a procedure that computes an
|
||||
.QW interesting
|
||||
mathematical function:
|
||||
@@ -444,8 +402,8 @@ each other:
|
||||
puts "a and b are [\fBexpr\fR {$a eq $b ? {equal} : {different}}]"
|
||||
.CE
|
||||
.PP
|
||||
Set a variable to whether an environment variable is both defined at
|
||||
all and also set to a true boolean value:
|
||||
Set a variable indicating whether an environment variable is defined and has
|
||||
value of true:
|
||||
.PP
|
||||
.CS
|
||||
set isTrue [\fBexpr\fR {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
'\"
|
||||
'\"
|
||||
'\" Copyright (c) 1996 Sun Microsystems, Inc.
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution
|
||||
|
||||
+1
-1
@@ -390,7 +390,7 @@ that use the third component do not attempt to perform tilde
|
||||
substitution.
|
||||
.RE
|
||||
.TP
|
||||
\fBfile stat \fIname varName\fR
|
||||
\fBfile stat \fIname varName\fR
|
||||
.
|
||||
Invokes the \fBstat\fR kernel call on \fIname\fR, and uses the variable
|
||||
given by \fIvarName\fR to hold information returned from the kernel call.
|
||||
|
||||
+1
-1
@@ -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 flush n 7.5 Tcl "Tcl Built-In Commands"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+1
-1
@@ -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 foreach n "" Tcl "Tcl Built-In Commands"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+22
-7
@@ -83,12 +83,15 @@ Specifies that the number should be padded on the left with
|
||||
zeroes instead of spaces.
|
||||
.TP 10
|
||||
\fB#\fR
|
||||
Requests an alternate output form. For \fBo\fR
|
||||
conversions it guarantees that the first digit is always \fB0\fR.
|
||||
For \fBx\fR or \fBX\fR conversions, \fB0x\fR or \fB0X\fR (respectively)
|
||||
Requests an alternate output form. For \fBo\fR conversions,
|
||||
\fB0o\fR will be added to the beginning of the result unless
|
||||
it is zero. For \fBx\fR or \fBX\fR conversions, \fB0x\fR
|
||||
will be added to the beginning of the result unless it is zero.
|
||||
For \fBb\fR conversions, \fB0b\fR
|
||||
will be added to the beginning of the result unless it is zero.
|
||||
For \fBd\fR conversions, \fB0d\fR there is no effect unless
|
||||
the \fB0\fR specifier is used as well: In that case, \fB0d\fR
|
||||
will be added to the beginning.
|
||||
For all floating-point conversions (\fBe\fR, \fBE\fR, \fBf\fR,
|
||||
\fBg\fR, and \fBG\fR) it guarantees that the result always
|
||||
has a decimal point.
|
||||
@@ -130,7 +133,7 @@ it must be a numeric string.
|
||||
.SS "OPTIONAL SIZE MODIFIER"
|
||||
.PP
|
||||
The fifth part of a conversion specifier is a size modifier,
|
||||
which must be \fBll\fR, \fBh\fR, or \fBl\fR.
|
||||
which must be \fBll\fR, \fBh\fR, \fBl\fR, or \fBL\fR.
|
||||
If it is \fBll\fR it specifies that an integer value is taken
|
||||
without truncation for conversion to a formatted substring.
|
||||
If it is \fBh\fR it specifies that an integer value is
|
||||
@@ -138,7 +141,9 @@ truncated to a 16-bit range before converting. This option is rarely useful.
|
||||
If it is \fBl\fR it specifies that the integer value is
|
||||
truncated to the same range as that produced by the \fBwide()\fR
|
||||
function of the \fBexpr\fR command (at least a 64-bit range).
|
||||
If neither \fBh\fR nor \fBl\fR are present, the integer value is
|
||||
If it is \fBL\fR it specifies that an integer or double value is taken
|
||||
without truncation for conversion to a formatted substring.
|
||||
If neither \fBh\fR nor \fBl\fR nor \fBL\fR are present, the integer value is
|
||||
truncated to the same range as that produced by the \fBint()\fR
|
||||
function of the \fBexpr\fR command (at least a 32-bit range, but
|
||||
determined by the value of the \fBwordSize\fR element of the
|
||||
@@ -198,8 +203,19 @@ precision, then convert number as for \fB%e\fR or
|
||||
Otherwise convert as for \fB%f\fR.
|
||||
Trailing zeroes and a trailing decimal point are omitted.
|
||||
.TP 10
|
||||
\fBa\fR or \fBA\fR
|
||||
Convert double to hexadecimal notation in the form
|
||||
\fI0x1.yyy\fBp\(+-\fIzz\fR, where the number of \fIy\fR's is
|
||||
determined by the precision (default: 13).
|
||||
If the \fBA\fR form is used then the hex characters
|
||||
are printed in uppercase.
|
||||
.TP 10
|
||||
\fB%\fR
|
||||
No conversion: just insert \fB%\fR.
|
||||
.TP 10
|
||||
\fBp\fR
|
||||
Shorthand form for \fB0x%zx\fR, so it outputs the integer in
|
||||
hexadecimal form with \fB0x\fR prefix.
|
||||
.SH "DIFFERENCES FROM ANSI SPRINTF"
|
||||
.PP
|
||||
The behavior of the format command is the same as the
|
||||
@@ -208,13 +224,12 @@ differences:
|
||||
.IP [1]
|
||||
Tcl guarantees that it will be working with UNICODE characters.
|
||||
.IP [2]
|
||||
\fB%p\fR and \fB%n\fR specifiers are not supported.
|
||||
\fB%n\fR specifier is not supported.
|
||||
.IP [3]
|
||||
For \fB%c\fR conversions the argument must be an integer value,
|
||||
which will then be converted to the corresponding character value.
|
||||
.IP [4]
|
||||
The size modifiers are ignored when formatting floating-point values.
|
||||
The \fBll\fR modifier has no \fBsprintf\fR counterpart.
|
||||
The \fBb\fR specifier has no \fBsprintf\fR counterpart.
|
||||
.SH EXAMPLES
|
||||
.PP
|
||||
|
||||
+1
-1
@@ -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 gets n 7.5 Tcl "Tcl Built-In Commands"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+1
-1
@@ -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 history n "" Tcl "Tcl Built-In Commands"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
@@ -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 if n "" Tcl "Tcl Built-In Commands"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+10
-1
@@ -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 incr n "" Tcl "Tcl Built-In Commands"
|
||||
.so man.macros
|
||||
.BS
|
||||
@@ -27,6 +27,11 @@ and also returned as result.
|
||||
Starting with the Tcl 8.5 release, the variable \fIvarName\fR passed
|
||||
to \fBincr\fR may be unset, and in that case, it will be set to
|
||||
the value \fIincrement\fR or to the default increment value of \fB1\fR.
|
||||
.VS TIP508
|
||||
If \fIvarName\fR indicate an element that does not exist of an array that has
|
||||
a default value set, the sum of the default value and the \fIincrement\fR (or
|
||||
1) will be stored in the array element.
|
||||
.VE TIP508
|
||||
.SH EXAMPLES
|
||||
.PP
|
||||
Add one to the contents of the variable \fIx\fR:
|
||||
@@ -59,3 +64,7 @@ an error if it is not):
|
||||
expr(n), set(n)
|
||||
.SH KEYWORDS
|
||||
add, increment, variable, value
|
||||
.\" Local variables:
|
||||
.\" mode: nroff
|
||||
.\" fill-column: 78
|
||||
.\" End:
|
||||
|
||||
+193
-102
@@ -7,7 +7,7 @@
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution
|
||||
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
'\"
|
||||
'\"
|
||||
.TH info n 8.4 Tcl "Tcl Built-In Commands"
|
||||
.so man.macros
|
||||
.BS
|
||||
@@ -35,16 +35,51 @@ Returns the body of procedure \fIprocname\fR. \fIProcname\fR must be
|
||||
the name of a Tcl command procedure.
|
||||
.TP
|
||||
\fBinfo class\fI subcommand class\fR ?\fIarg ...\fR
|
||||
.VS 8.6
|
||||
.
|
||||
Returns information about the class, \fIclass\fR. The \fIsubcommand\fRs are
|
||||
described in \fBCLASS INTROSPECTION\fR below.
|
||||
.VE 8.6
|
||||
.TP
|
||||
\fBinfo cmdcount\fR
|
||||
.
|
||||
Returns a count of the total number of commands that have been invoked
|
||||
in this interpreter.
|
||||
.TP
|
||||
\fBinfo cmdtype \fIcommandName\fR
|
||||
.VS TIP426
|
||||
Returns a description of the kind of command named by \fIcommandName\fR. The
|
||||
supported types are:
|
||||
.RS
|
||||
.IP \fBalias\fR
|
||||
Indicates that \fIcommandName\fR was created by \fBinterp alias\fR. Note that
|
||||
safe interpreters can only see a subset of aliases (specifically those between
|
||||
two commands within themselves).
|
||||
.IP \fBcoroutine\fR
|
||||
Indicates that \fIcommandName\fR was created by \fBcoroutine\fR.
|
||||
.IP \fBensemble\fR
|
||||
Indicates that \fIcommandName\fR was created by \fBnamespace ensemble\fR.
|
||||
.IP \fBimport\fR
|
||||
Indicates that \fIcommandName\fR was created by \fBnamespace import\fR.
|
||||
.IP \fBnative\fR
|
||||
Indicates that \fIcommandName\fR was created by the \fBTcl_CreateObjProc\fR
|
||||
interface directly without further registration of the type of command.
|
||||
.IP \fBobject\fR
|
||||
Indicates that \fIcommandName\fR is the public command that represents an
|
||||
instance of \fBoo::object\fR or one of its subclasses.
|
||||
.IP \fBprivateObject\fR
|
||||
Indicates that \fIcommandName\fR is the private command (\fBmy\fR by default)
|
||||
that represents an instance of \fBoo::object\fR or one of its subclasses.
|
||||
.IP \fBproc\fR
|
||||
Indicates that \fIcommandName\fR was created by \fBproc\fR.
|
||||
.IP \fBslave\fR
|
||||
Indicates that \fIcommandName\fR was created by \fBinterp create\fR.
|
||||
.IP \fBzlibStream\fR
|
||||
Indicates that \fIcommandName\fR was created by \fBzlib stream\fR.
|
||||
.PP
|
||||
There may be other registered types as well; this is a set that is extensible
|
||||
at the implementation level with \fBTcl_RegisterCommandTypeName\fR.
|
||||
.RE
|
||||
.VE TIP426
|
||||
.TP
|
||||
\fBinfo commands \fR?\fIpattern\fR?
|
||||
.
|
||||
If \fIpattern\fR is not specified,
|
||||
@@ -78,11 +113,10 @@ command is not complete, the script can delay evaluating it until additional
|
||||
lines have been typed to complete the command.
|
||||
.TP
|
||||
\fBinfo coroutine\fR
|
||||
.VS 8.6
|
||||
.
|
||||
Returns the name of the currently executing \fBcoroutine\fR, or the empty
|
||||
string if either no coroutine is currently executing, or the current coroutine
|
||||
has been deleted (but has not yet returned or yielded since deletion).
|
||||
.VE 8.6
|
||||
.TP
|
||||
\fBinfo default \fIprocname arg varname\fR
|
||||
.
|
||||
@@ -93,7 +127,7 @@ Otherwise it returns \fB1\fR and places the default value of \fIarg\fR
|
||||
into variable \fIvarname\fR.
|
||||
.TP
|
||||
\fBinfo errorstack \fR?\fIinterp\fR?
|
||||
.VS 8.6
|
||||
.
|
||||
Returns, in a form that is programmatically easy to parse, the function names
|
||||
and arguments at each level from the call stack of the last error in the given
|
||||
\fIinterp\fR, or in the current one if not specified.
|
||||
@@ -118,7 +152,6 @@ options dictionary returned by 3-argument \fBcatch\fR; \fBinfo errorstack\fR
|
||||
is a convenient way of retrieving it for uncaught errors at top-level in an
|
||||
interactive \fBtclsh\fR.
|
||||
.RE
|
||||
.VE 8.6
|
||||
.TP
|
||||
\fBinfo exists \fIvarName\fR
|
||||
.
|
||||
@@ -297,10 +330,11 @@ scripts are stored.
|
||||
This is actually the value of the \fBtcl_library\fR
|
||||
variable and may be changed by setting \fBtcl_library\fR.
|
||||
.TP
|
||||
\fBinfo loaded \fR?\fIinterp\fR?
|
||||
\fBinfo loaded \fR?\fIinterp\fR? ?\fIpackage\fR?
|
||||
.
|
||||
Returns a list describing all of the packages that have been loaded into
|
||||
\fIinterp\fR with the \fBload\fR command.
|
||||
Returns the filename loaded as part of \fIpackage\fR. If \fIpackage\fR
|
||||
is not specified, returns a list describing all of the packages
|
||||
that have been loaded into \fIinterp\fR with the \fBload\fR command.
|
||||
Each list element is a sub-list with two elements consisting of the
|
||||
name of the file from which the package was loaded and the name of
|
||||
the package.
|
||||
@@ -328,10 +362,9 @@ was invoked. If Tcl was unable to identify the file, then an empty
|
||||
string is returned.
|
||||
.TP
|
||||
\fBinfo object\fI subcommand object\fR ?\fIarg ...\fR
|
||||
.VS 8.6
|
||||
.
|
||||
Returns information about the object, \fIobject\fR. The \fIsubcommand\fRs are
|
||||
described in \fBOBJECT INTROSPECTION\fR below.
|
||||
.VE 8.6
|
||||
.TP
|
||||
\fBinfo patchlevel\fR
|
||||
.
|
||||
@@ -398,20 +431,22 @@ Note that a currently-visible variable may not yet
|
||||
if it has not
|
||||
been set (e.g. a variable declared but not set by \fBvariable\fR).
|
||||
.SS "CLASS INTROSPECTION"
|
||||
.VS 8.6
|
||||
.PP
|
||||
The following \fIsubcommand\fR values are supported by \fBinfo class\fR:
|
||||
.VE 8.6
|
||||
.TP
|
||||
\fBinfo class call\fI class method\fR
|
||||
.VS
|
||||
.
|
||||
Returns a description of the method implementations that are used to provide a
|
||||
stereotypical instance of \fIclass\fR's implementation of \fImethod\fR
|
||||
(stereotypical instances being objects instantiated by a class without having
|
||||
any object-specific definitions added). This consists of a list of lists of
|
||||
four elements, where each sublist consists of a word that describes the
|
||||
general type of method implementation (being one of \fBmethod\fR for an
|
||||
ordinary method, \fBfilter\fR for an applied filter, and \fBunknown\fR for a
|
||||
ordinary method, \fBfilter\fR for an applied filter,
|
||||
.VS TIP500
|
||||
\fBprivate\fR for a private method,
|
||||
.VE TIP500
|
||||
and \fBunknown\fR for a
|
||||
method that is invoked as part of unknown method handling), a word giving the
|
||||
name of the particular method invoked (which is always the same as
|
||||
\fImethod\fR for the \fBmethod\fR type, and
|
||||
@@ -422,122 +457,149 @@ implementation (see \fBinfo class methodtype\fR).
|
||||
.RS
|
||||
.PP
|
||||
Note that there is no inspection of whether the method implementations
|
||||
actually use \fBnext\fR to transfer control along the call chain.
|
||||
actually use \fBnext\fR to transfer control along the call chain,
|
||||
.VS TIP500
|
||||
and the call chains that this command files do not actually contain private
|
||||
methods.
|
||||
.VE TIP500
|
||||
.RE
|
||||
.VE 8.6
|
||||
.TP
|
||||
\fBinfo class constructor\fI class\fR
|
||||
.VS 8.6
|
||||
.
|
||||
This subcommand returns a description of the definition of the constructor of
|
||||
class \fIclass\fR. The definition is described as a two element list; the first
|
||||
element is the list of arguments to the constructor in a form suitable for
|
||||
passing to another call to \fBproc\fR or a method definition, and the second
|
||||
element is the body of the constructor. If no constructor is present, this
|
||||
returns the empty list.
|
||||
.VE 8.6
|
||||
.TP
|
||||
\fBinfo class definition\fI class method\fR
|
||||
.VS 8.6
|
||||
.
|
||||
This subcommand returns a description of the definition of the method named
|
||||
\fImethod\fR of class \fIclass\fR. The definition is described as a two element
|
||||
list; the first element is the list of arguments to the method in a form
|
||||
suitable for passing to another call to \fBproc\fR or a method definition, and
|
||||
the second element is the body of the method.
|
||||
.VE 8.6
|
||||
.TP
|
||||
\fBinfo class destructor\fI class\fR
|
||||
.VS 8.6
|
||||
.
|
||||
This subcommand returns the body of the destructor of class \fIclass\fR. If no
|
||||
destructor is present, this returns the empty string.
|
||||
.VE 8.6
|
||||
.TP
|
||||
\fBinfo class filters\fI class\fR
|
||||
.VS 8.6
|
||||
.
|
||||
This subcommand returns the list of filter methods set on the class.
|
||||
.VE 8.6
|
||||
.TP
|
||||
\fBinfo class forward\fI class method\fR
|
||||
.VS 8.6
|
||||
.
|
||||
This subcommand returns the argument list for the method forwarding called
|
||||
\fImethod\fR that is set on the class called \fIclass\fR.
|
||||
.VE 8.6
|
||||
.TP
|
||||
\fBinfo class instances\fI class\fR ?\fIpattern\fR?
|
||||
.VS 8.6
|
||||
.
|
||||
This subcommand returns a list of instances of class \fIclass\fR. If the
|
||||
optional \fIpattern\fR argument is present, it constrains the list of returned
|
||||
instances to those that match it according to the rules of \fBstring match\fR.
|
||||
.VE 8.6
|
||||
.TP
|
||||
\fBinfo class methods\fI class\fR ?\fIoptions...\fR?
|
||||
.VS 8.6
|
||||
.
|
||||
This subcommand returns a list of all public (i.e. exported) methods of the
|
||||
class called \fIclass\fR. Any of the following \fIoption\fRs may be
|
||||
specified, controlling exactly which method names are returned:
|
||||
.RS
|
||||
.VE 8.6
|
||||
.TP
|
||||
\fB\-all\fR
|
||||
.VS 8.6
|
||||
If the \fB\-all\fR flag is given, the list of methods will include those
|
||||
.
|
||||
If the \fB\-all\fR flag is given,
|
||||
.VS TIP500
|
||||
and the \fB\-scope\fR flag is not given,
|
||||
.VE TIP500
|
||||
the list of methods will include those
|
||||
methods defined not just by the class, but also by the class's superclasses
|
||||
and mixins.
|
||||
.VE 8.6
|
||||
.TP
|
||||
\fB\-private\fR
|
||||
.VS 8.6
|
||||
If the \fB\-private\fR flag is given, the list of methods will also include
|
||||
the private (i.e. non-exported) methods of the class (and superclasses and
|
||||
.
|
||||
If the \fB\-private\fR flag is given,
|
||||
.VS TIP500
|
||||
and the \fB\-scope\fR flag is not given,
|
||||
.VE TIP500
|
||||
the list of methods will also include
|
||||
the non-exported methods of the class (and superclasses and
|
||||
mixins, if \fB\-all\fR is also given).
|
||||
.VS TIP500
|
||||
Note that this naming is an unfortunate clash with true private methods; this
|
||||
option name is retained for backward compatibility.
|
||||
.VE TIP500
|
||||
.TP
|
||||
\fB\-scope\fI scope\fR
|
||||
.VS TIP500
|
||||
Returns a list of all methods on \fIclass\fR that have the given visibility
|
||||
\fIscope\fR. When this option is supplied, both the \fB\-all\fR and
|
||||
\fB\-private\fR options are ignored. The valid values for \fIscope\fR are:
|
||||
.RS
|
||||
.IP \fBpublic\fR 3
|
||||
Only methods with \fIpublic\fR scope (i.e., callable from anywhere by any instance
|
||||
of this class) are to be returned.
|
||||
.IP \fBunexported\fR 3
|
||||
Only methods with \fIunexported\fR scope (i.e., only callable via \fBmy\fR) are to
|
||||
be returned.
|
||||
.IP \fBprivate\fR 3
|
||||
Only methods with \fIprivate\fR scope (i.e., only callable from within this class's
|
||||
methods) are to be returned.
|
||||
.RE
|
||||
.VE TIP500
|
||||
.RE
|
||||
.VE 8.6
|
||||
.TP
|
||||
\fBinfo class methodtype\fI class method\fR
|
||||
.VS 8.6
|
||||
.
|
||||
This subcommand returns a description of the type of implementation used for
|
||||
the method named \fImethod\fR of class \fIclass\fR. When the result is
|
||||
\fBmethod\fR, further information can be discovered with \fBinfo class
|
||||
definition\fR, and when the result is \fBforward\fR, further information can
|
||||
be discovered with \fBinfo class forward\fR.
|
||||
.VE 8.6
|
||||
.TP
|
||||
\fBinfo class mixins\fI class\fR
|
||||
.VS 8.6
|
||||
.
|
||||
This subcommand returns a list of all classes that have been mixed into the
|
||||
class named \fIclass\fR.
|
||||
.VE 8.6
|
||||
.TP
|
||||
\fBinfo class subclasses\fI class\fR ?\fIpattern\fR?
|
||||
.VS 8.6
|
||||
.
|
||||
This subcommand returns a list of direct subclasses of class \fIclass\fR. If
|
||||
the optional \fIpattern\fR argument is present, it constrains the list of
|
||||
returned classes to those that match it according to the rules of
|
||||
\fBstring match\fR.
|
||||
.VE 8.6
|
||||
.TP
|
||||
\fBinfo class superclasses\fI class\fR
|
||||
.VS 8.6
|
||||
.
|
||||
This subcommand returns a list of direct superclasses of class \fIclass\fR in
|
||||
inheritance precedence order.
|
||||
.VE 8.6
|
||||
.TP
|
||||
\fBinfo class variables\fI class\fR
|
||||
.VS 8.6
|
||||
\fBinfo class variables\fI class\fR ?\fB\-private\fR?
|
||||
.
|
||||
This subcommand returns a list of all variables that have been declared for
|
||||
the class named \fIclass\fR (i.e. that are automatically present in the
|
||||
class's methods, constructor and destructor).
|
||||
.VS TIP500
|
||||
If the \fB\-private\fR option is specified, this lists the private variables
|
||||
declared instead.
|
||||
.VE TIP500
|
||||
.SS "OBJECT INTROSPECTION"
|
||||
.PP
|
||||
The following \fIsubcommand\fR values are supported by \fBinfo object\fR:
|
||||
.VE 8.6
|
||||
.TP
|
||||
\fBinfo object call\fI object method\fR
|
||||
.VS 8.6
|
||||
.
|
||||
Returns a description of the method implementations that are used to provide
|
||||
\fIobject\fR's implementation of \fImethod\fR. This consists of a list of
|
||||
lists of four elements, where each sublist consists of a word that describes
|
||||
the general type of method implementation (being one of \fBmethod\fR for an
|
||||
ordinary method, \fBfilter\fR for an applied filter, and \fBunknown\fR for a
|
||||
ordinary method, \fBfilter\fR for an applied filter,
|
||||
.VS TIP500
|
||||
\fBprivate\fR for a private method,
|
||||
.VE TIP500
|
||||
and \fBunknown\fR for a
|
||||
method that is invoked as part of unknown method handling), a word giving the
|
||||
name of the particular method invoked (which is always the same as
|
||||
\fImethod\fR for the \fBmethod\fR type, and
|
||||
@@ -549,128 +611,160 @@ implementation (see \fBinfo object methodtype\fR).
|
||||
.RS
|
||||
.PP
|
||||
Note that there is no inspection of whether the method implementations
|
||||
actually use \fBnext\fR to transfer control along the call chain.
|
||||
actually use \fBnext\fR to transfer control along the call chain,
|
||||
.VS TIP500
|
||||
and the call chains that this command files do not actually contain private
|
||||
methods.
|
||||
.VE TIP500
|
||||
.RE
|
||||
.VE 8.6
|
||||
.TP
|
||||
\fBinfo object class\fI object\fR ?\fIclassName\fR?
|
||||
.VS 8.6
|
||||
.
|
||||
If \fIclassName\fR is unspecified, this subcommand returns class of the
|
||||
\fIobject\fR object. If \fIclassName\fR is present, this subcommand returns a
|
||||
boolean value indicating whether the \fIobject\fR is of that class.
|
||||
.VE 8.6
|
||||
.TP
|
||||
\fBinfo object creationid\fI object\fR
|
||||
.VS TIP500
|
||||
Returns the unique creation identifier for the \fIobject\fR object. This
|
||||
creation identifier is unique to the object (within a Tcl interpreter) and
|
||||
cannot be controlled at object creation time or altered afterwards.
|
||||
.RS
|
||||
.PP
|
||||
\fIImplementation note:\fR the creation identifier is used to generate unique
|
||||
identifiers associated with the object, especially for private variables.
|
||||
.RE
|
||||
.VE TIP500
|
||||
.TP
|
||||
\fBinfo object definition\fI object method\fR
|
||||
.VS 8.6
|
||||
.
|
||||
This subcommand returns a description of the definition of the method named
|
||||
\fImethod\fR of object \fIobject\fR. The definition is described as a two
|
||||
element list; the first element is the list of arguments to the method in a
|
||||
form suitable for passing to another call to \fBproc\fR or a method definition,
|
||||
and the second element is the body of the method.
|
||||
.VE 8.6
|
||||
.TP
|
||||
\fBinfo object filters\fI object\fR
|
||||
.VS 8.6
|
||||
.
|
||||
This subcommand returns the list of filter methods set on the object.
|
||||
.VE 8.6
|
||||
.TP
|
||||
\fBinfo object forward\fI object method\fR
|
||||
.VS 8.6
|
||||
.
|
||||
This subcommand returns the argument list for the method forwarding called
|
||||
\fImethod\fR that is set on the object called \fIobject\fR.
|
||||
.VE 8.6
|
||||
.TP
|
||||
\fBinfo object isa\fI category object\fR ?\fIarg\fR?
|
||||
.VS 8.6
|
||||
.
|
||||
This subcommand tests whether an object belongs to a particular category,
|
||||
returning a boolean value that indicates whether the \fIobject\fR argument
|
||||
meets the criteria for the category. The supported categories are:
|
||||
.VE 8.6
|
||||
.RS
|
||||
.TP
|
||||
\fBinfo object isa class\fI object\fR
|
||||
.VS 8.6
|
||||
.
|
||||
This returns whether \fIobject\fR is a class (i.e. an instance of
|
||||
\fBoo::class\fR or one of its subclasses).
|
||||
.VE 8.6
|
||||
.TP
|
||||
\fBinfo object isa metaclass\fI object\fR
|
||||
.VS 8.6
|
||||
.
|
||||
This returns whether \fIobject\fR is a class that can manufacture classes
|
||||
(i.e. is \fBoo::class\fR or a subclass of it).
|
||||
.VE 8.6
|
||||
.TP
|
||||
\fBinfo object isa mixin\fI object class\fR
|
||||
.VS 8.6
|
||||
.
|
||||
This returns whether \fIclass\fR is directly mixed into \fIobject\fR.
|
||||
.VE 8.6
|
||||
.TP
|
||||
\fBinfo object isa object\fI object\fR
|
||||
.VS 8.6
|
||||
.
|
||||
This returns whether \fIobject\fR really is an object.
|
||||
.VE 8.6
|
||||
.TP
|
||||
\fBinfo object isa typeof\fI object class\fR
|
||||
.VS 8.6
|
||||
.
|
||||
This returns whether \fIclass\fR is the type of \fIobject\fR (i.e. whether
|
||||
\fIobject\fR is an instance of \fIclass\fR or one of its subclasses, whether
|
||||
direct or indirect).
|
||||
.RE
|
||||
.VE 8.6
|
||||
.TP
|
||||
\fBinfo object methods\fI object\fR ?\fIoption...\fR?
|
||||
.VS 8.6
|
||||
.
|
||||
This subcommand returns a list of all public (i.e. exported) methods of the
|
||||
object called \fIobject\fR. Any of the following \fIoption\fRs may be
|
||||
specified, controlling exactly which method names are returned:
|
||||
.RS
|
||||
.VE 8.6
|
||||
.TP
|
||||
\fB\-all\fR
|
||||
.VS 8.6
|
||||
If the \fB\-all\fR flag is given, the list of methods will include those
|
||||
.
|
||||
If the \fB\-all\fR flag is given,
|
||||
.VS TIP500
|
||||
and the \fB\-scope\fR flag is not given,
|
||||
.VE TIP500
|
||||
the list of methods will include those
|
||||
methods defined not just by the object, but also by the object's class and
|
||||
mixins, plus the superclasses of those classes.
|
||||
.VE 8.6
|
||||
.TP
|
||||
\fB\-private\fR
|
||||
.VS 8.6
|
||||
If the \fB\-private\fR flag is given, the list of methods will also include
|
||||
the private (i.e. non-exported) methods of the object (and classes, if
|
||||
.
|
||||
If the \fB\-private\fR flag is given,
|
||||
.VS TIP500
|
||||
and the \fB\-scope\fR flag is not given,
|
||||
.VE TIP500
|
||||
the list of methods will also include
|
||||
the non-exported methods of the object (and classes, if
|
||||
\fB\-all\fR is also given).
|
||||
.VS TIP500
|
||||
Note that this naming is an unfortunate clash with true private methods; this
|
||||
option name is retained for backward compatibility.
|
||||
.VE TIP500
|
||||
.TP
|
||||
\fB\-scope\fI scope\fR
|
||||
.VS TIP500
|
||||
Returns a list of all methods on \fIobject\fR that have the given visibility
|
||||
\fIscope\fR. When this option is supplied, both the \fB\-all\fR and
|
||||
\fB\-private\fR options are ignored. The valid values for \fIscope\fR are:
|
||||
.RS
|
||||
.IP \fBpublic\fR 3
|
||||
Only methods with \fIpublic\fR scope (i.e., callable from anywhere) are to be
|
||||
returned.
|
||||
.IP \fBunexported\fR 3
|
||||
Only methods with \fIunexported\fR scope (i.e., only callable via \fBmy\fR) are to
|
||||
be returned.
|
||||
.IP \fBprivate\fR 3
|
||||
Only methods with \fIprivate\fR scope (i.e., only callable from within this object's
|
||||
instance methods) are to be returned.
|
||||
.RE
|
||||
.VE TIP500
|
||||
.RE
|
||||
.VE 8.6
|
||||
.TP
|
||||
\fBinfo object methodtype\fI object method\fR
|
||||
.VS 8.6
|
||||
.
|
||||
This subcommand returns a description of the type of implementation used for
|
||||
the method named \fImethod\fR of object \fIobject\fR. When the result is
|
||||
\fBmethod\fR, further information can be discovered with \fBinfo object
|
||||
definition\fR, and when the result is \fBforward\fR, further information can
|
||||
be discovered with \fBinfo object forward\fR.
|
||||
.VE 8.6
|
||||
.TP
|
||||
\fBinfo object mixins\fI object\fR
|
||||
.VS 8.6
|
||||
.
|
||||
This subcommand returns a list of all classes that have been mixed into the
|
||||
object named \fIobject\fR.
|
||||
.VE 8.6
|
||||
.TP
|
||||
\fBinfo object namespace\fI object\fR
|
||||
.VS 8.6
|
||||
.
|
||||
This subcommand returns the name of the internal namespace of the object named
|
||||
\fIobject\fR.
|
||||
.VE 8.6
|
||||
.TP
|
||||
\fBinfo object variables\fI object\fR
|
||||
.VS 8.6
|
||||
\fBinfo object variables\fI object\fRR ?\fB\-private\fR?
|
||||
.
|
||||
This subcommand returns a list of all variables that have been declared for
|
||||
the object named \fIobject\fR (i.e. that are automatically present in the
|
||||
object's methods).
|
||||
.VE 8.6
|
||||
.VS TIP500
|
||||
If the \fB\-private\fR option is specified, this lists the private variables
|
||||
declared instead.
|
||||
.VE TIP500
|
||||
.TP
|
||||
\fBinfo object vars\fI object\fR ?\fIpattern\fR?
|
||||
.VS 8.6
|
||||
.
|
||||
This subcommand returns a list of all variables in the private namespace of
|
||||
the object named \fIobject\fR. If the optional \fIpattern\fR argument is
|
||||
given, it is a filter (in the syntax of a \fBstring match\fR glob pattern)
|
||||
@@ -679,7 +773,6 @@ from the list returned by \fBinfo object variables\fR; that can include
|
||||
variables that are currently unset, whereas this can include variables that
|
||||
are not automatically included by any of \fIobject\fR's methods (or those of
|
||||
its class, superclasses or mixins).
|
||||
.VE 8.6
|
||||
.SH EXAMPLES
|
||||
.PP
|
||||
This command prints out a procedure suitable for saving in a Tcl
|
||||
@@ -702,7 +795,6 @@ proc printProc {procName} {
|
||||
}
|
||||
.CE
|
||||
.SS "EXAMPLES WITH OBJECTS"
|
||||
.VS 8.6
|
||||
.PP
|
||||
Every object necessarily knows what its class is; this information is
|
||||
trivially extractable through introspection:
|
||||
@@ -723,8 +815,10 @@ method and get how it is defined. This procedure illustrates how:
|
||||
proc getDef {obj method} {
|
||||
foreach inf [\fBinfo object call\fR $obj $method] {
|
||||
lassign $inf calltype name locus methodtype
|
||||
|
||||
# Assume no forwards or filters, and hence no $calltype
|
||||
# or $methodtype checks...
|
||||
|
||||
if {$locus eq "object"} {
|
||||
return [\fBinfo object definition\fR $obj $name]
|
||||
} else {
|
||||
@@ -747,7 +841,9 @@ proc getDef {obj method} {
|
||||
# Assume no forwards
|
||||
return [\fBinfo object definition\fR $obj $method]
|
||||
}
|
||||
|
||||
set cls [\fBinfo object class\fR $obj]
|
||||
|
||||
while {$method ni [\fBinfo class methods\fR $cls]} {
|
||||
# Assume the simple case
|
||||
set cls [lindex [\fBinfo class superclass\fR $cls] 0]
|
||||
@@ -755,22 +851,17 @@ proc getDef {obj method} {
|
||||
error "no definition for $method"
|
||||
}
|
||||
}
|
||||
|
||||
# Assume no forwards
|
||||
return [\fBinfo class definition\fR $cls $method]
|
||||
}
|
||||
.CE
|
||||
.VE 8.6
|
||||
.SH "SEE ALSO"
|
||||
.VS 8.6
|
||||
global(n), oo::class(n), oo::define(n), oo::object(n), proc(n), self(n),
|
||||
.VE 8.6
|
||||
tcl_library(n), tcl_patchLevel(n), tcl_version(n)
|
||||
.SH KEYWORDS
|
||||
command, information, interpreter, introspection, level, namespace,
|
||||
.VS 8.6
|
||||
object,
|
||||
.VE 8.6
|
||||
procedure, variable
|
||||
object, procedure, variable
|
||||
'\" Local Variables:
|
||||
'\" mode: nroff
|
||||
'\" fill-column: 78
|
||||
|
||||
+1
-1
@@ -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 interp n 8.6 Tcl "Tcl Built-In Commands"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+1
-1
@@ -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 join n "" Tcl "Tcl Built-In Commands"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+11
-1
@@ -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 lappend n "" Tcl "Tcl Built-In Commands"
|
||||
.so man.macros
|
||||
.BS
|
||||
@@ -22,6 +22,12 @@ and appends each of the \fIvalue\fR arguments to that list as a separate
|
||||
element, with spaces between elements.
|
||||
If \fIvarName\fR does not exist, it is created as a list with elements
|
||||
given by the \fIvalue\fR arguments.
|
||||
.VS TIP508
|
||||
If \fIvarName\fR indicate an element that does not exist of an array that has
|
||||
a default value set, list that is comprised of the default value with all the
|
||||
\fIvalue\fR arguments appended as elements will be stored in the array
|
||||
element.
|
||||
.VE TIP508
|
||||
\fBLappend\fR is similar to \fBappend\fR except that the \fIvalue\fRs
|
||||
are appended as list elements rather than raw text.
|
||||
This command provides a relatively efficient way to build up
|
||||
@@ -47,3 +53,7 @@ list(n), lindex(n), linsert(n), llength(n), lset(n),
|
||||
lsort(n), lrange(n)
|
||||
.SH KEYWORDS
|
||||
append, element, list, variable
|
||||
.\" Local variables:
|
||||
.\" mode: nroff
|
||||
.\" fill-column: 78
|
||||
.\" End:
|
||||
|
||||
+1
-1
@@ -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 lassign n 8.5 Tcl "Tcl Built-In Commands"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+124
@@ -0,0 +1,124 @@
|
||||
'\"
|
||||
'\" Copyright (c) 2011-2015 Andreas Kupries
|
||||
'\" Copyright (c) 2018 Donal K. Fellows
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution
|
||||
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
'\"
|
||||
.TH link n 0.3 TclOO "TclOO Commands"
|
||||
.so man.macros
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
link \- create link from command to method of object
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
package require TclOO
|
||||
|
||||
\fBlink\fR \fImethodName\fR ?\fI...\fR?
|
||||
\fBlink\fR \fB{\fIcommandName methodName\fB}\fR ?\fI...\fR?
|
||||
.fi
|
||||
.BE
|
||||
.SH DESCRIPTION
|
||||
The \fBlink\fR command is available within methods. It takes a series of one
|
||||
or more method names (\fImethodName ...\fR) and/or pairs of command- and
|
||||
method-name (\fB{\fIcommandName methodName\fB}\fR) and makes the named methods
|
||||
available as commands without requiring the explicit use of the name of the
|
||||
object or the \fBmy\fR command. The method does not need to exist at the time
|
||||
that the link is made; if the link command is invoked when the method does not
|
||||
exist, the standard \fBunknown\fR method handling system is used.
|
||||
.PP
|
||||
The command name under which the method becomes available defaults to the
|
||||
method name, except where explicitly specified through an alias/method pair.
|
||||
Formally, every argument must be a list; if the list has two elements, the
|
||||
first element is the name of the command to create and the second element is
|
||||
the name of the method of the current object to which the command links;
|
||||
otherwise, the name of the command and the name of the method are the same
|
||||
string (the first element of the list).
|
||||
.PP
|
||||
If the name of the command is not a fully-qualified command name, it will be
|
||||
resolved with respect to the current namespace (i.e., the object namespace).
|
||||
.SH EXAMPLES
|
||||
This demonstrates linking a single method in various ways. First it makes a
|
||||
simple link, then a renamed link, then an external link. Note that the method
|
||||
itself is unexported, but that it can still be called directly from outside
|
||||
the class.
|
||||
.PP
|
||||
.CS
|
||||
oo::class create ABC {
|
||||
method Foo {} {
|
||||
puts "This is Foo in [self]"
|
||||
}
|
||||
|
||||
constructor {} {
|
||||
\fBlink\fR Foo
|
||||
# The method foo is now directly accessible as foo here
|
||||
\fBlink\fR {bar Foo}
|
||||
# The method foo is now directly accessible as bar
|
||||
\fBlink\fR {::ExternalCall Foo}
|
||||
# The method foo is now directly accessible in the global
|
||||
# namespace as ExternalCall
|
||||
}
|
||||
|
||||
method grill {} {
|
||||
puts "Step 1:"
|
||||
Foo
|
||||
puts "Step 2:"
|
||||
bar
|
||||
}
|
||||
}
|
||||
|
||||
ABC create abc
|
||||
abc grill
|
||||
\fI\(-> Step 1:\fR
|
||||
\fI\(-> This is foo in ::abc\fR
|
||||
\fI\(-> Step 2:\fR
|
||||
\fI\(-> This is foo in ::abc\fR
|
||||
# Direct access via the linked command
|
||||
puts "Step 3:"; ExternalCall
|
||||
\fI\(-> Step 3:\fR
|
||||
\fI\(-> This is foo in ::abc\fR
|
||||
.CE
|
||||
.PP
|
||||
This example shows that multiple linked commands can be made in a call to
|
||||
\fBlink\fR, and that they can handle arguments.
|
||||
.PP
|
||||
.CS
|
||||
oo::class create Ex {
|
||||
constructor {} {
|
||||
\fBlink\fR a b c
|
||||
# The methods a, b, and c (defined below) are all now
|
||||
# directly acessible within methods under their own names.
|
||||
}
|
||||
|
||||
method a {} {
|
||||
puts "This is a"
|
||||
}
|
||||
method b {x} {
|
||||
puts "This is b($x)"
|
||||
}
|
||||
method c {y z} {
|
||||
puts "This is c($y,$z)"
|
||||
}
|
||||
|
||||
method call {p q r} {
|
||||
a
|
||||
b $p
|
||||
c $q $r
|
||||
}
|
||||
}
|
||||
|
||||
set o [Ex new]
|
||||
$o 3 5 7
|
||||
\fI\(-> This is a\fR
|
||||
\fI\(-> This is b(3)\fR
|
||||
\fI\(-> This is c(5,7)\fR
|
||||
.CE
|
||||
.SH "SEE ALSO"
|
||||
interp(n), my(n), oo::class(n), oo::define(n)
|
||||
.SH KEYWORDS
|
||||
command, method, object
|
||||
.\" Local Variables:
|
||||
.\" mode: nroff
|
||||
.\" fill-column: 78
|
||||
.\" End:
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user