Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9f7a96643d | ||
|
|
c361023404 | ||
|
|
b3c0cd4c86 | ||
|
|
b1b31a3289 | ||
|
|
106d4730fd | ||
|
|
bd80c9f645 | ||
|
|
12a6b6de59 | ||
|
|
7fd882e910 | ||
|
|
3f788ef33b | ||
|
|
bd7229a87d | ||
|
|
c0bf770206 | ||
|
|
d01a3bf002 | ||
|
|
07418c9b93 | ||
|
|
f09740fae5 | ||
|
|
a25ea98e5c | ||
|
|
4ae2c37a12 | ||
|
|
365c85d20f | ||
|
|
902d8b663f | ||
|
|
9a802144f5 | ||
|
|
7a58b59b2d | ||
|
|
47c35ac594 | ||
|
|
4c3e91b842 | ||
|
|
8b001f80e4 | ||
|
|
0fad32deac | ||
|
|
f51482578d | ||
|
|
727efcf012 | ||
|
|
4df5497f65 | ||
|
|
37fed62502 | ||
|
|
c3dccf7196 | ||
|
|
3aa54d6d7a | ||
|
|
af6bc3e860 | ||
|
|
8365a58070 | ||
|
|
8cd2dd2b45 | ||
|
|
ab508359ae | ||
|
|
fe1ab20fb7 | ||
|
|
e52d82d888 | ||
|
|
c610c39100 | ||
|
|
76cf0cf48d | ||
|
|
b25cb7d39a | ||
|
|
02b32be1a7 | ||
|
|
3e8ea3960b | ||
|
|
d533bb6a26 | ||
|
|
972aafc741 | ||
|
|
3c9ec7f76f | ||
|
|
be81d9e977 | ||
|
|
044f0ead3d | ||
|
|
e39b986e81 | ||
|
|
605aff99c9 | ||
|
|
6df8a636f8 | ||
|
|
72dd32a3ca | ||
|
|
0b00017862 | ||
|
|
e3a26ef9f6 | ||
|
|
2e57446fb4 | ||
|
|
456e333da9 | ||
|
|
6c1d8b86ca | ||
|
|
a2b2c6bfc4 | ||
|
|
c7c95d77f8 | ||
|
|
e6fa255ed5 | ||
|
|
4dd62bd6ed | ||
|
|
d06ef17019 | ||
|
|
99ba912ceb | ||
|
|
9782f13f46 | ||
|
|
e922cb1cd3 | ||
|
|
a166c55da0 | ||
|
|
7e6cdc9cc4 | ||
|
|
94b81dda49 | ||
|
|
f4b65459ef | ||
|
|
81ee44ac3b | ||
|
|
c3e6dcaa67 | ||
|
|
f89b8b1e2d | ||
|
|
4e12f02a75 | ||
|
|
8f1f92264a | ||
|
|
d85dd92c27 | ||
|
|
9965b67d8e | ||
|
|
533f349b01 | ||
|
|
f3a2810d20 | ||
|
|
04d1b41522 | ||
|
|
a2efc41118 | ||
|
|
91ec2f6354 | ||
|
|
f98d4ff859 | ||
|
|
58e31795d0 | ||
|
|
2a20e200df | ||
|
|
383da62572 | ||
|
|
500fbe92e6 | ||
|
|
3fc99c04f6 | ||
|
|
56bf715712 | ||
|
|
422eaa2077 | ||
|
|
e8786f8348 | ||
|
|
d1f3fe0de0 | ||
|
|
a29de0a577 | ||
|
|
116ec0f471 | ||
|
|
4028edd571 | ||
|
|
828abac60a | ||
|
|
f5599d7f8d | ||
|
|
b421519004 | ||
|
|
c6fd11389a | ||
|
|
a231dcf0ac | ||
|
|
c0a4d1371a | ||
|
|
990b376ae1 | ||
|
|
7640d1e898 | ||
|
|
cf8194b6a0 | ||
|
|
1636c5d39a | ||
|
|
33180e74dd | ||
|
|
f51da6d726 | ||
|
|
6c297ad438 | ||
|
|
1ead60af0b | ||
|
|
d5029136c1 | ||
|
|
c0ab3b7128 | ||
|
|
ef1cf6b99b | ||
|
|
44deaab456 | ||
|
|
dfb834e395 | ||
|
|
463aed9329 | ||
|
|
c6511f8d77 | ||
|
|
8f5f70cbb1 | ||
|
|
e19283c7d5 | ||
|
|
f0ba2933f2 | ||
|
|
0519b566b8 | ||
|
|
96ba10aa41 | ||
|
|
5767ab9581 | ||
|
|
efecaa64e2 | ||
|
|
8d774cfa0b | ||
|
|
fe2ac816b0 | ||
|
|
ffeedbcbca | ||
|
|
aaa3242a11 | ||
|
|
6524bed322 | ||
|
|
cfea006a9d | ||
|
|
3a680cc449 | ||
|
|
7c5ea5b5f1 | ||
|
|
601fa19fab | ||
|
|
ecd0d69efb | ||
|
|
ef310f81a0 | ||
|
|
4c6eb20ea5 | ||
|
|
6a0634acc9 | ||
|
|
6e716af3b7 | ||
|
|
db1ca42627 | ||
|
|
677ffa1104 | ||
|
|
a82b49336a | ||
|
|
e24d246c87 | ||
|
|
56a99d9dd9 | ||
|
|
4cabc332b4 | ||
|
|
7d9ccac72d | ||
|
|
3449d223d1 | ||
|
|
0036891363 | ||
|
|
c6f5daec40 | ||
|
|
9c536234a9 | ||
|
|
0ad034c3c6 | ||
|
|
e39c8e6b26 | ||
|
|
829e5981d2 | ||
|
|
b381dafa84 | ||
|
|
bb34bee773 | ||
|
|
1f6b04d51b | ||
|
|
27989920c5 | ||
|
|
faef5b981f | ||
|
|
92b0e12403 | ||
|
|
856c560b71 | ||
|
|
daa0c940b8 | ||
|
|
c3eea370e5 | ||
|
|
c3805dda91 | ||
|
|
02960a691f | ||
|
|
c222d15bd1 | ||
|
|
93695198d8 | ||
|
|
f2a99f6167 | ||
|
|
049bb5ecaa | ||
|
|
8d4e35dc59 | ||
|
|
9bcf18e010 | ||
|
|
df9835efa1 | ||
|
|
bac8bd28c0 | ||
|
|
4067fb322f | ||
|
|
1d9460e1e6 | ||
|
|
001513fa18 | ||
|
|
2b9d31917d | ||
|
|
cdf813e288 | ||
|
|
9b08e4775f | ||
|
|
e014381903 | ||
|
|
256865fe12 | ||
|
|
4669ea6d0c | ||
|
|
87744f43c9 | ||
|
|
a6f9ef29ae | ||
|
|
d32ca76ec2 | ||
|
|
0371108cbf | ||
|
|
b29f3e80a5 | ||
|
|
05956b6b36 | ||
|
|
1ee459aa14 | ||
|
|
9f4810e640 | ||
|
|
85699b47e7 | ||
|
|
0e03c742fa | ||
|
|
4c98b8717b | ||
|
|
2841bb1300 | ||
|
|
4792d8fa00 | ||
|
|
d9762826b9 | ||
|
|
932409d7aa | ||
|
|
b13ad88718 | ||
|
|
cdee0fcd74 | ||
|
|
b3892c4018 | ||
|
|
a3c3dc2581 | ||
|
|
3d8fa193f4 | ||
|
|
6dfc99d7f2 | ||
|
|
1439f39555 | ||
|
|
cc771f1b47 | ||
|
|
62addcfa82 | ||
|
|
6e58473427 | ||
|
|
570eb6b10d | ||
|
|
f08cbe00fd | ||
|
|
63ba958fe4 | ||
|
|
2974c8e22c | ||
|
|
2da34cb738 | ||
|
|
9f8346d54f | ||
|
|
bd0d616070 | ||
|
|
5dc66dd0c9 | ||
|
|
023624c3c9 | ||
|
|
da2329ba8b | ||
|
|
6916d195ce | ||
|
|
c892bc1f1d | ||
|
|
2e4ba03817 | ||
|
|
b8a93e8423 | ||
|
|
5f6beb1bd2 | ||
|
|
341ea00aaa | ||
|
|
c6028b1641 | ||
|
|
cdcc22a92d | ||
|
|
85469aaecf | ||
|
|
3ad3a0eae3 | ||
|
|
57e43137bd | ||
|
|
ed005a749a | ||
|
|
1cc03c884b | ||
|
|
cababb3290 | ||
|
|
ec3c0c79fb | ||
|
|
656a0f78c7 | ||
|
|
b50f18b840 | ||
|
|
32a9dde838 | ||
|
|
faa471576e | ||
|
|
de133cb36a | ||
|
|
c24688ad4f | ||
|
|
d1ab32cd40 | ||
|
|
70c0fd83e8 | ||
|
|
ff00a132ab | ||
|
|
7e228aa961 | ||
|
|
4e411a89fe | ||
|
|
9d7f20adc5 | ||
|
|
93b515b360 | ||
|
|
034f00bf1b | ||
|
|
29603179f4 | ||
|
|
33a7feeefd | ||
|
|
f795c9e131 | ||
|
|
743ef38cdc | ||
|
|
b62b6bd490 | ||
|
|
90beed4f41 | ||
|
|
f4fe4153ee | ||
|
|
0b6ed354d1 | ||
|
|
a6c191c2ea | ||
|
|
7dfee7792b | ||
|
|
a16827f77e | ||
|
|
e91db44e66 | ||
|
|
aa7b8f6ccb | ||
|
|
7578a2c2bd | ||
|
|
7d2d8c6e11 | ||
|
|
fff7447683 | ||
|
|
d17930c875 | ||
|
|
dfd5e62014 | ||
|
|
c4bd26e054 | ||
|
|
5bb79143c1 | ||
|
|
67b1d52de2 | ||
|
|
dd3c1d71f7 | ||
|
|
324a884128 | ||
|
|
90fbc0fe78 | ||
|
|
db73017a4a | ||
|
|
1a4e6b5d92 | ||
|
|
60a6f1779d | ||
|
|
7b49d1632e | ||
|
|
a7f9c92001 | ||
|
|
5500c15d8a | ||
|
|
1b5d2f150d | ||
|
|
444cb185b8 | ||
|
|
22932eb228 | ||
|
|
2ee3ddac8a | ||
|
|
8037d27915 | ||
|
|
4ce2c3e6e7 | ||
|
|
b00e732483 | ||
|
|
20dafdc09e | ||
|
|
9aa3e85104 | ||
|
|
fb6b7a8d8d | ||
|
|
4cd9155ae9 | ||
|
|
0918bf8c7b | ||
|
|
fec1116ba7 | ||
|
|
261a4a6282 | ||
|
|
bbb80087ae | ||
|
|
73484694b5 | ||
|
|
6af49e65ad | ||
|
|
12cc9a424d | ||
|
|
f63cfcaea3 | ||
|
|
502287c9dd | ||
|
|
63aa951254 | ||
|
|
0698861f80 | ||
|
|
352740916d | ||
|
|
987b08480c | ||
|
|
b87531a583 | ||
|
|
52f920ba57 | ||
|
|
14476f18e0 | ||
|
|
2b81ec85d4 | ||
|
|
c56e67115f | ||
|
|
14f9ede961 | ||
|
|
50ccb92ce7 | ||
|
|
d150ddf591 | ||
|
|
3ea3c1f2f9 | ||
|
|
71ef3ba082 | ||
|
|
51adf20eaf | ||
|
|
fde157fe11 | ||
|
|
c793ae92e4 | ||
|
|
2972e0894d | ||
|
|
9c52f7a98a | ||
|
|
0985259acd | ||
|
|
0132d11834 | ||
|
|
ad6cba5a8e | ||
|
|
f43007cdd8 | ||
|
|
e6c567a325 | ||
|
|
7ba021af61 | ||
|
|
d4bb7bdf65 | ||
|
|
5fc6bbc782 | ||
|
|
d948ee6daa | ||
|
|
e008d75c19 | ||
|
|
ea9f9ac81e | ||
|
|
e99979bfcf | ||
|
|
2d6d821ea4 | ||
|
|
5c4acfb73f | ||
|
|
4c5f334c06 | ||
|
|
51bbc67659 | ||
|
|
0f3896176d | ||
|
|
2e30712093 | ||
|
|
9cfa94b1da | ||
|
|
810baa10b8 | ||
|
|
6f63d23863 | ||
|
|
aef7e0d6d9 | ||
|
|
94d9bfa884 | ||
|
|
6f959222be | ||
|
|
8f43773d55 | ||
|
|
b4cd8e5d9c | ||
|
|
15c03f09c9 | ||
|
|
7f5f2ddc7f | ||
|
|
d249a8af5d | ||
|
|
e8d057ad67 | ||
|
|
450b7aafd0 | ||
|
|
a0d647ab06 | ||
|
|
8c32ef71da | ||
|
|
756d989440 | ||
|
|
d93aaadc5e | ||
|
|
17420ef9f0 | ||
|
|
907aebaab8 | ||
|
|
967856b8f8 | ||
|
|
2ce1ce01c5 | ||
|
|
babd0b88a0 | ||
|
|
0f54d7701d | ||
|
|
bd81f35273 | ||
|
|
deaa520c80 | ||
|
|
acdb6bc384 | ||
|
|
6be68f173f | ||
|
|
0ae5b5b3c1 | ||
|
|
0dd03dfef9 | ||
|
|
2e3d1fac48 | ||
|
|
fdf990faf5 | ||
|
|
58f3361635 | ||
|
|
282b159f3b | ||
|
|
e403d82b18 | ||
|
|
c489e47329 | ||
|
|
a32cc9b49b | ||
|
|
e3a528bc44 | ||
|
|
12d28d084d | ||
|
|
fc49271c0a | ||
|
|
8c1c07d4bf | ||
|
|
4240cb00f0 | ||
|
|
1a30606518 | ||
|
|
99cc729bd2 | ||
|
|
9d64916f18 | ||
|
|
c9e70a3901 | ||
|
|
c11a7a6b08 | ||
|
|
6135265f5c | ||
|
|
1913208e18 | ||
|
|
73deb43f4f | ||
|
|
205345779a | ||
|
|
92ce12cc43 | ||
|
|
1754a9a311 | ||
|
|
91d8b69074 | ||
|
|
d3e04b3a76 | ||
|
|
3b743160f6 | ||
|
|
09d67aff95 | ||
|
|
227d96bf13 | ||
|
|
fd9d40cb5b | ||
|
|
f108505a5b | ||
|
|
90b9288358 | ||
|
|
5ecd3fa2b6 | ||
|
|
a46cd743dd | ||
|
|
ae445193f4 | ||
|
|
459a48dc5c | ||
|
|
1590eb50c5 | ||
|
|
c3f11e7741 | ||
|
|
9f710e45a9 | ||
|
|
c472223773 | ||
|
|
7f030a6b44 | ||
|
|
de7a370d58 | ||
|
|
63f824a7e9 | ||
|
|
805cd597f9 | ||
|
|
1f2fb4cf5b | ||
|
|
3d5869fb4b | ||
|
|
6d6afda39d | ||
|
|
7fc61f369b | ||
|
|
c6e6569dfe | ||
|
|
bc7e4c5d68 | ||
|
|
cd70770139 | ||
|
|
63e0947392 | ||
|
|
4ed03a1f4b | ||
|
|
ee626d5909 | ||
|
|
d4166a6b3a | ||
|
|
e325a4742e | ||
|
|
2cc11d4918 | ||
|
|
7dbf5ed0b0 | ||
|
|
1292a0d927 | ||
|
|
6003e823bf | ||
|
|
50426ba9c5 | ||
|
|
f399206c21 | ||
|
|
b2c41c81e4 | ||
|
|
0e5a1e2642 | ||
|
|
74708147ba | ||
|
|
b199b80ba8 | ||
|
|
226278b0ac | ||
|
|
2c4d707b8f | ||
|
|
544df0c1b8 | ||
|
|
8c7378b541 | ||
|
|
4f07b18244 | ||
|
|
f396811dd5 | ||
|
|
83f6249875 | ||
|
|
27503d10cd | ||
|
|
761a093174 | ||
|
|
97739f4d09 | ||
|
|
f14d6cb130 | ||
|
|
07bc28e627 | ||
|
|
4a22756b41 | ||
|
|
94f2309f51 | ||
|
|
dfc57be3b1 | ||
|
|
ec9c80bba9 | ||
|
|
7e79080ed7 | ||
|
|
75e1a82785 | ||
|
|
434f351abc | ||
|
|
8104f5f53d | ||
|
|
b3e2027137 | ||
|
|
28fe834bc3 | ||
|
|
2919fd5221 | ||
|
|
e4089d79b3 | ||
|
|
87e36a4aa9 | ||
|
|
6d6598bbcb | ||
|
|
bb005f26e4 | ||
|
|
b8674e42d2 | ||
|
|
48650316e3 | ||
|
|
b1ad5d16a7 | ||
|
|
d90a15ace1 | ||
|
|
fc506f9ca9 | ||
|
|
48bab372b9 | ||
|
|
f6b7fa43d6 | ||
|
|
4214c7a3a9 | ||
|
|
02cc7437b2 | ||
|
|
9d3e75eb7a | ||
|
|
4d7ebbdc94 | ||
|
|
22ce6aeb4b | ||
|
|
2fabe1cead | ||
|
|
4b3f548c27 | ||
|
|
3f9555d4c2 | ||
|
|
8acaf40209 | ||
|
|
8ee4bdf94d | ||
|
|
579463bcec | ||
|
|
2f36a2d349 | ||
|
|
6a233e935b | ||
|
|
4d5ff6cd13 | ||
|
|
acad581479 | ||
|
|
52d37c087d | ||
|
|
5e6453d592 | ||
|
|
f16ec6e776 | ||
|
|
42c1a1e15a | ||
|
|
5cd16427f7 | ||
|
|
1ddabb17f9 | ||
|
|
a3babfe12a | ||
|
|
b6fecacc22 | ||
|
|
360b5c41ee | ||
|
|
5a6443d00e | ||
|
|
7134cd9399 | ||
|
|
1a92fb378c | ||
|
|
ef6f1ba2c3 | ||
|
|
b0078c8129 | ||
|
|
49e7d0262b | ||
|
|
2cbec4bf44 | ||
|
|
7ac39417f1 | ||
|
|
3faf4cc3b8 | ||
|
|
9f699d22a2 | ||
|
|
13667e8096 | ||
|
|
51f7688e96 | ||
|
|
f6d6b394eb | ||
|
|
7e44dabec3 | ||
|
|
cfefe7127b | ||
|
|
2613112a13 | ||
|
|
18131f9c09 | ||
|
|
baf649278a | ||
|
|
88ec3c9772 | ||
|
|
ad19550909 | ||
|
|
aed72bee30 | ||
|
|
f65cb994d8 | ||
|
|
893c9c7302 | ||
|
|
24817641b1 | ||
|
|
89e6a65411 | ||
|
|
f664d633e6 | ||
|
|
d56e61b246 | ||
|
|
8dd58baa04 | ||
|
|
559113cc4c | ||
|
|
5dafefe112 | ||
|
|
955507f635 | ||
|
|
e942227f6e | ||
|
|
68b5780dde | ||
|
|
3b7664e77f | ||
|
|
b47b88af9b | ||
|
|
d7a9d63520 | ||
|
|
f716d8815b | ||
|
|
4e0313afe2 | ||
|
|
d9b30b94b8 | ||
|
|
2f8ea1be7c | ||
|
|
59cb45cc16 | ||
|
|
ee5c231ff5 | ||
|
|
604faa265f | ||
|
|
8e80c62f6f | ||
|
|
a417c667a5 | ||
|
|
26326004c6 | ||
|
|
0318c256ed | ||
|
|
704532c57a | ||
|
|
2d415cbf59 | ||
|
|
916f1716f3 | ||
|
|
d297273a13 | ||
|
|
b27238fbbb | ||
|
|
7466351c90 | ||
|
|
58bde2cb77 | ||
|
|
40420634aa | ||
|
|
b52476a5cd | ||
|
|
bc8ffb3922 | ||
|
|
bfb321eb38 | ||
|
|
5c1b9fefdf | ||
|
|
6d936db4a3 | ||
|
|
dd4c175c81 | ||
|
|
29b10229de | ||
|
|
bff00baca2 | ||
|
|
7dfd9c5a96 | ||
|
|
05971adca4 | ||
|
|
2f3edeea43 | ||
|
|
0c0be35710 | ||
|
|
137e142be2 | ||
|
|
8694763c10 | ||
|
|
58cd08bb7d | ||
|
|
730a9a132c | ||
|
|
d7cf041bab | ||
|
|
03f0d60f88 | ||
|
|
92402afe21 | ||
|
|
d9465a5be2 | ||
|
|
52bcb866e5 | ||
|
|
7f5ddf43ee | ||
|
|
484de8b987 | ||
|
|
2b3e403550 | ||
|
|
fa8d5668aa | ||
|
|
24d57ad4ff | ||
|
|
3185389da2 | ||
|
|
164250cf86 | ||
|
|
9c2149012b | ||
|
|
6e056b1e14 | ||
|
|
99ee3e86d7 | ||
|
|
3bbc2317b3 | ||
|
|
7d10d699c7 | ||
|
|
620cf6fa02 | ||
|
|
98e4ac55d2 | ||
|
|
eb64ed3cf0 | ||
|
|
5e0d1d6bc5 | ||
|
|
7565b9ff1e | ||
|
|
10dc783c93 | ||
|
|
0c027bb706 | ||
|
|
c658976cc3 | ||
|
|
1db5ff8c2c | ||
|
|
fbba7d0b1e | ||
|
|
559b8ab9de | ||
|
|
60ef43cb8c | ||
|
|
5c6717b7d5 | ||
|
|
2f8dae1cec | ||
|
|
dac552ac0b | ||
|
|
53ae611583 | ||
|
|
57de194b09 | ||
|
|
5204910c12 | ||
|
|
71d27bd9c6 | ||
|
|
3fa4ffc77a | ||
|
|
d2b69b306e | ||
|
|
db9946ccc3 | ||
|
|
cb0895755d | ||
|
|
b14c2f49d2 | ||
|
|
48ab03f3cd | ||
|
|
de82a1a99e | ||
|
|
7ec17e20d3 | ||
|
|
d95273cf0e | ||
|
|
f87735c127 | ||
|
|
1e769e4b57 | ||
|
|
a8dc863399 | ||
|
|
476a68cbe5 | ||
|
|
54d2883694 | ||
|
|
5a9b116846 | ||
|
|
df4391e23f | ||
|
|
717a98747d | ||
|
|
915359ddce | ||
|
|
999c88ea06 | ||
|
|
790fed46bb | ||
|
|
da01ebeabe | ||
|
|
91d5ac9d0b | ||
|
|
adff5bc1c6 | ||
|
|
eee56ee95a | ||
|
|
9cf7e2a336 | ||
|
|
93082a74a2 | ||
|
|
9f2c3815f7 | ||
|
|
592ab670f3 | ||
|
|
c0e8db49d5 | ||
|
|
d7604e5728 | ||
|
|
8e5b3b87a5 | ||
|
|
d31d858702 | ||
|
|
1234267c92 | ||
|
|
59491ce8ca | ||
|
|
ef89704696 | ||
|
|
1ce240e90f | ||
|
|
c132978e4b | ||
|
|
59f2031ac5 | ||
|
|
f85490f4e1 | ||
|
|
c2be2a28e0 | ||
|
|
4977df535f | ||
|
|
182bace1e3 | ||
|
|
1f33c7ae12 | ||
|
|
78c2c1cedf | ||
|
|
186ecf8003 | ||
|
|
56c0b11912 | ||
|
|
1df1505d69 | ||
|
|
1a08ae6fb4 | ||
|
|
891a0ade43 | ||
|
|
29d06499aa | ||
|
|
ea97de415f | ||
|
|
b327c90dcc | ||
|
|
cd1372b52d | ||
|
|
3b4cf982e3 | ||
|
|
7c4da917a7 | ||
|
|
e36d384130 | ||
|
|
5e53c4c296 | ||
|
|
78fcaa3580 | ||
|
|
11db57d058 | ||
|
|
822a2b50f7 | ||
|
|
fc21aee814 | ||
|
|
d06897f3ea | ||
|
|
1598658a83 | ||
|
|
192fa71096 | ||
|
|
76db7c5c04 | ||
|
|
85f3786d9c | ||
|
|
5e0835667d | ||
|
|
26fe5fff38 | ||
|
|
d75135cca1 | ||
|
|
a5dd225e78 | ||
|
|
5f9519213f | ||
|
|
7bce68fe3b | ||
|
|
600ace1c4b | ||
|
|
62004c9fb4 | ||
|
|
976c48a7f1 | ||
|
|
a3b501f125 | ||
|
|
13d8cae724 | ||
|
|
303cced03d | ||
|
|
3f8809d6ec | ||
|
|
b47df5123e | ||
|
|
996c102b1f | ||
|
|
2e512ffbe8 | ||
|
|
aa2667b729 | ||
|
|
0bab3624a9 | ||
|
|
c0726f8f4f | ||
|
|
39ddd8c91b | ||
|
|
d69c1d382b | ||
|
|
14b32b82e1 | ||
|
|
3f60452ac2 | ||
|
|
75b361386e | ||
|
|
f3dba34e63 | ||
|
|
36a7db47de | ||
|
|
97323cd8a0 | ||
|
|
8fa124afba | ||
|
|
df623b6abe | ||
|
|
3ef97fba38 | ||
|
|
a261f7d413 | ||
|
|
50cc521ee3 | ||
|
|
48205fa50d | ||
|
|
9fb06ec1c9 | ||
|
|
f9e188bad3 | ||
|
|
6b65756937 | ||
|
|
a74538b064 | ||
|
|
55787f4f08 | ||
|
|
0d59c187fe | ||
|
|
4d2add8f0f | ||
|
|
a4ced94ae6 | ||
|
|
496eb965ff | ||
|
|
c2423634f2 |
@@ -0,0 +1,10 @@
|
||||
tools/tcl.hpj.in
|
||||
tools/tcl.wse.in
|
||||
win/buildall.vc.bat
|
||||
win/coffbase.txt
|
||||
win/makefile.bc
|
||||
win/makefile.vc
|
||||
win/rules.vc
|
||||
win/tcl.dsp
|
||||
win/tcl.dsw
|
||||
win/tcl.hpj.in
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
tools/tcl.hpj.in
|
||||
tools/tcl.wse.in
|
||||
win/buildall.vc.bat
|
||||
win/coffbase.txt
|
||||
win/makefile.bc
|
||||
win/makefile.vc
|
||||
win/rules.vc
|
||||
win/tcl.dsp
|
||||
win/tcl.dsw
|
||||
win/tcl.hpj.in
|
||||
@@ -913,6 +913,14 @@ a better first place to look now.
|
||||
* win/nmakehlp.c: Let "nmakehlp -V" start searching digits after the
|
||||
found match (suggested by Harald Oehlmann).
|
||||
|
||||
2012-09-19 Harald Oehlmann <oehhar@users.sf.net>
|
||||
|
||||
IMPLEMENTATION OF TIP#412.
|
||||
|
||||
* library/msgcat/msgcat.tcl: dynamic locale change with mc file
|
||||
* library/clock.tcl: load on locale change.
|
||||
clock uses new msgcat features.
|
||||
|
||||
2012-09-07 Harald Oehlmann <oehhar@users.sf.net>
|
||||
|
||||
*** 8.6b3 TAGGED FOR RELEASE ***
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
README: Tcl
|
||||
This is the Tcl 8.6.2 source distribution.
|
||||
This is the Tcl 8.6.5 source distribution.
|
||||
http://sourceforge.net/projects/tcl/files/Tcl/
|
||||
You can get any source release of Tcl from the URL above.
|
||||
|
||||
|
||||
@@ -8303,11 +8303,11 @@ reported usage of large expressions (porter)
|
||||
|
||||
Many optmizations, improvements, and tightened stack management in bytecode.
|
||||
|
||||
--- Released 8.6.1, September 20, 2013 --- http://core.tcl.tk/tcl/ for details
|
||||
--- Released 8.6.1, September 20, 2013 --- http://core.tcl.tk/tcl/ for details
|
||||
|
||||
2013-09-27 (enhancement) improved ::env synchronization (fellows)
|
||||
|
||||
2013-10-20 (bug fix)[2835313] segfault from
|
||||
2013-10-20 (bug fix)[2835313] segfault from
|
||||
[apply {{} {while 1 {a {*}[return -level 0 -code continue]}}}] (fellows)
|
||||
|
||||
2013-10-22 (bug fix)[3556215] [scan %E%G%X] support (fellows)
|
||||
@@ -8451,6 +8451,176 @@ include ::oo::class (fellows)
|
||||
|
||||
2014-08-25 (TIP 429) New command [string cat] (leitgeb,ferrieux)
|
||||
|
||||
--- Released 8.6.2, August 27, 2014 --- http://core.tcl.tk/tcl/ for details
|
||||
--- Released 8.6.2, August 27, 2014 --- http://core.tcl.tk/tcl/ for details
|
||||
|
||||
2014-08-29 (TIP TBD) Added a C Implementation of ZipVFS to provide Tcl/Wishkit building capbilities in the core (hypnotoad)
|
||||
2014-08-28 (bug)[b9e1a3] Correct Method Search Order (nadkarni,fellows)
|
||||
=> TclOO 1.0.3
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
2014-09-05 (bug)[ccc2c2] Regression [lreplace {} 1 1] (bron,fellows)
|
||||
|
||||
2014-09-08 (bug)<oo-1.18.2> Crash regression in [oo::class destroy] (porter)
|
||||
|
||||
2014-09-09 (bug)[84af11] Regress [regsub -all {\(.*} a(b) {}] (fellows)
|
||||
|
||||
2014-09-10 (bug)[cee90e] [try {} on ok {} - on return {} {}] panic (porter)
|
||||
|
||||
2014-09-20 (feature) [tcl::unsupported::getbytecode] disassember (fellows)
|
||||
|
||||
2014-09-27 (enhancement) [string cat] bytecode optimization (leitgeb,ferrieux)
|
||||
|
||||
2014-09-27 (bug)[82521b] segfault in mangled bytecode (ogilvie,sofer)
|
||||
|
||||
2014-10-02 (bug)[bc5b79] Hang in some [read]s of limited size (rogers,porter)
|
||||
|
||||
2014-10-03 (bug)[bc1a96] segfault in [array set] of traced array (tab,porter)
|
||||
|
||||
2014-10-08 (bug)[59a2e7] MSVC14 compile support (dower,nijtmans)
|
||||
|
||||
2014-10-10 (bug)[ed29c4] [fcopy] treats [blocked] as error (rowen,porter)
|
||||
|
||||
2014-10-10 (bug)[bf7135] regression in Tcl_Write() interface (porter)
|
||||
|
||||
2014-10-18 (bug)[10dc6d] fix [gets] on non-blocking channels (fassel,porter)
|
||||
|
||||
2014-10-26 Support for Windows 10 (nijtmans)
|
||||
|
||||
2014-10-31 (bug)[dcc034] restore [open comX: r+] (lll,nijtmans)
|
||||
|
||||
2014-11-05 (bug)[214cc0] Restore [lappend v] return value (sayers,porter)
|
||||
|
||||
2014-11-06 (bug)[5adc35] Stop forcing EOF to be permanent (porter)
|
||||
|
||||
--- Released 8.6.3, November 12, 2014 --- http://core.tcl.tk/tcl/ for details
|
||||
|
||||
2014-11-21 (bug)[743338] Win: socket error encoding (ladayaroslav,nijtmans)
|
||||
|
||||
2014-12-01 (bug) restore tbcload/tclcompiler support (kupries)
|
||||
|
||||
2014-12-03 (bug)[0c043a] Fix compiled [set var($) val] (porter)
|
||||
|
||||
2014-12-04 (bug)[d2ffcc] Limit $... and bareword parsing to ASCII (ladayaroslav,porter)
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
2014-12-06 (bug)[c6cd4a] Win: hang in async socket connection (shults,nadkarni)
|
||||
|
||||
2014-12-10 tzdata updated to Olson's tzdata2014j (venkat)
|
||||
|
||||
2014-12-13 fix header files installation on OS X (houben)
|
||||
|
||||
2014-12-17 (TIP 427) [fconfigure $h -connecting, -peername, -sockname] (oehlmann,rmax)
|
||||
|
||||
2014-12-18 (bug)[af08c8] Crash in full finalize encoding teardown (porter)
|
||||
|
||||
2014-12-18 (bug)[7c187a] [chan copy] crash (io-53.17) (benno,porter)
|
||||
|
||||
2015-01-26 (bug)[df0848] Trouble with INFINITY macro (dower,nijtmans)
|
||||
|
||||
2015-01-29 (bug) Stop crashes when extension var resolvers misbehave (porter)
|
||||
|
||||
2015-01-29 (bug)[088727] [read] past EOF (io-73.4) (fenugrec,porter)
|
||||
|
||||
2015-02-11 tzdata updated to Olson's tzdata2015a (venkat)
|
||||
|
||||
2015-02-20 (bug)[32b615] Fix compiled [lreplace] (lreplace-4.[345]) (aspect)
|
||||
|
||||
2015-03-10 (enhancement) Revise OS X notifier for better Cocoa (walzer)
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
--- Released 8.6.4, March 12, 2015 --- http://core.tcl.tk/tcl/ for details
|
||||
|
||||
2015-03-19 (bug)[e66e44] Win: Ctrl-C/Ctrl-Break in console not EOF (nadkarni)
|
||||
|
||||
2015-03-21 (bug)[d87cb1] Proper tailcall from compiled ensembles (sofer)
|
||||
|
||||
2015-04-23 (bug)[19ea02] Win: shared read from linked dirs (bogdan,oehhar)
|
||||
|
||||
2015-04-24 (bug)[879a07] Incomplete chars @ buffer ends (leunissen,porter)
|
||||
|
||||
2015-04-29 (bug)[894da1] Hang flushing blocking channels (yorick)
|
||||
|
||||
2015-05-14 (enhance)[b9d043] Default use of gzip transfer encoding (fellows)
|
||||
=> http 2.8.9
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
2015-05-15 (bug)[9dd1bd] destructor [self] after failed constructor (calvo,fellows)
|
||||
|
||||
2015-05-15 (bug)[0f42ff] [tailcall] combined with [next] (aspect,fellows)
|
||||
|
||||
2015-05-18 (bug)[c11a51] http: race condition in -accept option (fellows)
|
||||
|
||||
2015-05-19 (enhance) More pure lists from compiled [list] (porter,fellows)
|
||||
|
||||
2015-05-27 (enhancement) Relax memdebug constraint on extensions (kupries)
|
||||
|
||||
2015-06-03 (bug)[268b23] crash in traced [expr] (execute-11.2)(tomkinson,porter)
|
||||
|
||||
2015-06-11 (bug)[478c44] Memleak in zlib compresion errors (mistachkin)
|
||||
|
||||
2015-06-16 (bug)[e770d9] Higher baud on serial channels (woods,nijtmans)
|
||||
|
||||
2015-06-18 (update) Update Unicode data to 8.0 (nijtmans)
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
2015-06-18 (bug)[a4cb3f] compiled [lreplace] handling of end (bron,aspect)
|
||||
|
||||
2015-06-23 (enhance) Use Unicode SendMessageTimeout() (nijtmans)
|
||||
=> registry 1.3.1
|
||||
|
||||
2015-06-25 (TIP 412) msgcat dynamic locale change and package private locale (oehlmann)
|
||||
=> msgcat 1.6.0
|
||||
|
||||
2015-07-05 (bug)[a0ece9] crash in traced [expr] (execute-11.3) (hans,porter)
|
||||
|
||||
2015-07-10 (TIP 436) [info object isa] favors 'false' over error (fellows)
|
||||
=> TclOO 1.0.4
|
||||
|
||||
2015-07-15 (bug)[b1534b][9bad63] writes beyond buffer bounds (hanno,porter)
|
||||
|
||||
2015-07-18 (bug)[a3309d] Memleak in compiled [unset a($i)] (jeff,porter)
|
||||
|
||||
2015-07-23 (bug)[57945b] lock in forking/multi-threading (neumann,mistachkin)
|
||||
|
||||
2015-07-29 (bug)[3e7eca] Allocation overflow in expr parsing (rickyb,porter)
|
||||
|
||||
2015-07-30 (bug)[f00009] Win: Memleak in [file] (rp,sebres)
|
||||
|
||||
2015-07-31 (bug) Correct problems found in Coverity audit (sofer)
|
||||
|
||||
2015-08-19 (bug)[00189c] MSVC 14: semi-static UCRT support (dower,nijtmans)
|
||||
|
||||
2015-08-26 (bug)[0df7a1] Tolerate getcwd() failures (cato,nijtmans)
|
||||
|
||||
2015-09-21 (bug)[1115587][a3c350][d7ea9f][0e0e15][187d7f] Many fixes and
|
||||
improvements to regexp engine from Postgres (lane,porter,fellows,seltenreich)
|
||||
|
||||
2015-09-23 (enhance) hash lookup microoptimization (hipp)
|
||||
|
||||
2015-09-23 (bug)[e0a7b3] Input buffer draining & file events (griffin,porter)
|
||||
|
||||
2015-09-29 (bug)[219866] Cygwin support error (yorick,nijtmans)
|
||||
=> platform 1.0.14
|
||||
|
||||
2015-10-06 (bug)[b42a85] Win: [file normalize ~user] wrong dir (nadkarni)
|
||||
|
||||
2015-10-21 (bug)[1080042][8f2450] More regexp from Postgres (lane,porter)
|
||||
|
||||
2015-10-23 (bug)[4a0c16] [clock] react to msgcat locale change (oehlmann)
|
||||
|
||||
2015-11-10 (bug)[261a8a] Overflow segfault in I/O translation (brooks,porter)
|
||||
|
||||
2015-11-20 (bug)[40f628] ListObjReplace callers fail to detect max (porter)
|
||||
|
||||
2015-11-30 (enhance)[32c574] Improve list growth performance (brooks,porter)
|
||||
|
||||
2015-12-11 (bug)[c9eb6b] tolerate unset ::env(TZ) (gahr, nijtmans)
|
||||
|
||||
2016-01-29 (TIP 440) tcl_platform(engine) -- Tcl implementation (mistachkin)
|
||||
|
||||
2016-02-03 (bug)[25842c] stream [zlib deflate] fails with 0 input (ade,fellows)
|
||||
|
||||
2016-02-04 (bug)[3d96b7][593baa][cf74de] crashes in OO teardown (porter,fellows)
|
||||
|
||||
2016-02-22 (bug)[9b4702] [info exists env(missing)] kills trace (nijtmans)
|
||||
|
||||
--- Released 8.6.5, February 29, 2016 --- http://core.tcl.tk/tcl/ for details
|
||||
|
||||
+16
-16
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 2000-2003 Damien Miller. All rights reserved.
|
||||
* Copyright (C) 1999 WIDE Project. All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
@@ -13,7 +13,7 @@
|
||||
* 3. Neither the name of the project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PROJECT 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
|
||||
@@ -67,7 +67,7 @@ strlcpy(char *dst, const char *src, size_t siz)
|
||||
}
|
||||
#endif
|
||||
|
||||
int fake_getnameinfo(const struct sockaddr *sa, size_t salen, char *host,
|
||||
int fake_getnameinfo(const struct sockaddr *sa, size_t salen, char *host,
|
||||
size_t hostlen, char *serv, size_t servlen, int flags)
|
||||
{
|
||||
struct sockaddr_in *sin = (struct sockaddr_in *)sa;
|
||||
@@ -96,7 +96,7 @@ int fake_getnameinfo(const struct sockaddr *sa, size_t salen, char *host,
|
||||
} else {
|
||||
int ret;
|
||||
Tcl_MutexLock(&netdbMutex);
|
||||
hp = gethostbyaddr((char *)&sin->sin_addr,
|
||||
hp = gethostbyaddr((char *)&sin->sin_addr,
|
||||
sizeof(struct in_addr), AF_INET);
|
||||
if (hp == NULL) {
|
||||
ret = EAI_NODATA;
|
||||
@@ -130,7 +130,7 @@ fake_gai_strerror(int err)
|
||||
default:
|
||||
return ("unknown/invalid error.");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* !HAVE_GAI_STRERROR */
|
||||
|
||||
#ifndef HAVE_FREEADDRINFO
|
||||
@@ -156,9 +156,9 @@ addrinfo *malloc_ai(int port, u_long addr, const struct addrinfo *hints)
|
||||
ai = malloc(sizeof(*ai) + sizeof(struct sockaddr_in));
|
||||
if (ai == NULL)
|
||||
return (NULL);
|
||||
|
||||
|
||||
memset(ai, '\0', sizeof(*ai) + sizeof(struct sockaddr_in));
|
||||
|
||||
|
||||
ai->ai_addr = (struct sockaddr *)(ai + 1);
|
||||
/* XXX -- ssh doesn't use sa_len */
|
||||
ai->ai_addrlen = sizeof(struct sockaddr_in);
|
||||
@@ -166,7 +166,7 @@ addrinfo *malloc_ai(int port, u_long addr, const struct addrinfo *hints)
|
||||
|
||||
((struct sockaddr_in *)(ai)->ai_addr)->sin_port = port;
|
||||
((struct sockaddr_in *)(ai)->ai_addr)->sin_addr.s_addr = addr;
|
||||
|
||||
|
||||
/* XXX: the following is not generally correct, but does what we want */
|
||||
if (hints->ai_socktype)
|
||||
ai->ai_socktype = hints->ai_socktype;
|
||||
@@ -180,7 +180,7 @@ addrinfo *malloc_ai(int port, u_long addr, const struct addrinfo *hints)
|
||||
}
|
||||
|
||||
int
|
||||
fake_getaddrinfo(const char *hostname, const char *servname,
|
||||
fake_getaddrinfo(const char *hostname, const char *servname,
|
||||
const struct addrinfo *hints, struct addrinfo **res)
|
||||
{
|
||||
struct hostent *hp;
|
||||
@@ -211,29 +211,29 @@ fake_getaddrinfo(const char *hostname, const char *servname,
|
||||
if (hostname && inet_aton(hostname, &in) != 0)
|
||||
addr = in.s_addr;
|
||||
*res = malloc_ai(port, addr, hints);
|
||||
if (*res == NULL)
|
||||
if (*res == NULL)
|
||||
return (EAI_MEMORY);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
if (!hostname) {
|
||||
*res = malloc_ai(port, htonl(0x7f000001), hints);
|
||||
if (*res == NULL)
|
||||
if (*res == NULL)
|
||||
return (EAI_MEMORY);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
if (inet_aton(hostname, &in)) {
|
||||
*res = malloc_ai(port, in.s_addr, hints);
|
||||
if (*res == NULL)
|
||||
if (*res == NULL)
|
||||
return (EAI_MEMORY);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/* Don't try DNS if AI_NUMERICHOST is set */
|
||||
if (hints && hints->ai_flags & AI_NUMERICHOST)
|
||||
return (EAI_NONAME);
|
||||
|
||||
|
||||
Tcl_MutexLock(&netdbMutex);
|
||||
hp = gethostbyname(hostname);
|
||||
if (hp && hp->h_name && hp->h_name[0] && hp->h_addr_list[0]) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 2000-2003 Damien Miller. All rights reserved.
|
||||
* Copyright (C) 1999 WIDE Project. All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
@@ -13,7 +13,7 @@
|
||||
* 3. Neither the name of the project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PROJECT 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
|
||||
@@ -39,7 +39,7 @@
|
||||
#define _FAKE_RFC2553_H
|
||||
|
||||
/*
|
||||
* First, socket and INET6 related definitions
|
||||
* First, socket and INET6 related definitions
|
||||
*/
|
||||
#ifndef HAVE_STRUCT_SOCKADDR_STORAGE
|
||||
# define _SS_MAXSIZE 128 /* Implementation specific max size */
|
||||
@@ -146,7 +146,7 @@ struct addrinfo {
|
||||
# undef getaddrinfo
|
||||
#endif
|
||||
#define getaddrinfo(a,b,c,d) (fake_getaddrinfo(a,b,c,d))
|
||||
int getaddrinfo(const char *, const char *,
|
||||
int getaddrinfo(const char *, const char *,
|
||||
const struct addrinfo *, struct addrinfo **);
|
||||
#endif /* !HAVE_GETADDRINFO */
|
||||
|
||||
@@ -162,7 +162,7 @@ void freeaddrinfo(struct addrinfo *);
|
||||
|
||||
#ifndef HAVE_GETNAMEINFO
|
||||
#define getnameinfo(a,b,c,d,e,f,g) (fake_getnameinfo(a,b,c,d,e,f,g))
|
||||
int getnameinfo(const struct sockaddr *, size_t, char *, size_t,
|
||||
int getnameinfo(const struct sockaddr *, size_t, char *, size_t,
|
||||
char *, size_t, int);
|
||||
#endif /* !HAVE_GETNAMEINFO */
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* fixstrtod.c --
|
||||
*
|
||||
* Source code for the "fixstrtod" procedure. This procedure is
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* gettod.c --
|
||||
*
|
||||
* This file provides the gettimeofday function on systems
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
/*
|
||||
* limits.h --
|
||||
*
|
||||
* This is a dummy header file to #include in Tcl when there
|
||||
* is no limits.h in /usr/include. There are only a few
|
||||
* definitions here; also see tclPort.h, which already
|
||||
* #defines some of the things here if they're not arleady
|
||||
* defined.
|
||||
*
|
||||
* Copyright (c) 1991 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.
|
||||
*/
|
||||
|
||||
#define LONG_MIN 0x80000000
|
||||
#define LONG_MAX 0x7fffffff
|
||||
#define INT_MIN 0x80000000
|
||||
#define INT_MAX 0x7fffffff
|
||||
#define SHRT_MIN 0x8000
|
||||
#define SHRT_MAX 0x7fff
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* mkstemp.c --
|
||||
*
|
||||
* Source code for the "mkstemp" library routine.
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* opendir.c --
|
||||
*
|
||||
* This file provides dirent-style directory-reading procedures for V7
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* strncasecmp.c --
|
||||
*
|
||||
* Source code for the "strncasecmp" library routine.
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* strstr.c --
|
||||
*
|
||||
* Source code for the "strstr" library routine.
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* strtod.c --
|
||||
*
|
||||
* Source code for the "strtod" library procedure.
|
||||
@@ -137,7 +137,7 @@ strtod(
|
||||
* has more than 18 digits, ignore the extras, since they can't affect the
|
||||
* value anyway.
|
||||
*/
|
||||
|
||||
|
||||
pExp = p;
|
||||
p -= mantSize;
|
||||
if (decPt < 0) {
|
||||
@@ -217,7 +217,7 @@ strtod(
|
||||
* by processing the exponent one bit at a time to combine many powers of
|
||||
* 2 of 10. Then combine the exponent with the fraction.
|
||||
*/
|
||||
|
||||
|
||||
if (exp < 0) {
|
||||
expSign = TRUE;
|
||||
exp = -exp;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* strtol.c --
|
||||
*
|
||||
* Source code for the "strtol" library procedure.
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* strtoul.c --
|
||||
*
|
||||
* Source code for the "strtoul" library procedure.
|
||||
@@ -90,7 +90,7 @@ strtoul(
|
||||
* If no base was provided, pick one from the leading characters of the
|
||||
* string.
|
||||
*/
|
||||
|
||||
|
||||
if (base == 0) {
|
||||
if (*p == '0') {
|
||||
p += 1;
|
||||
@@ -206,7 +206,7 @@ strtoul(
|
||||
if (overflow) {
|
||||
errno = ERANGE;
|
||||
return ULONG_MAX;
|
||||
}
|
||||
}
|
||||
if (negative) {
|
||||
return -result;
|
||||
}
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
/*
|
||||
* Strict POSIX stuff goes here. Extensions go down below, in the ifndef
|
||||
* _POSIX_SOURCE section.
|
||||
*/
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* waitpid.c --
|
||||
*
|
||||
* This procedure emulates the POSIX waitpid kernel call on BSD systems
|
||||
|
||||
Binary file not shown.
+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_AddErrorInfo 3 8.5 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+13
-5
@@ -13,20 +13,25 @@ Tcl_CancelEval, Tcl_Canceled \- cancel Tcl scripts
|
||||
.nf
|
||||
\fB#include <tcl.h>\fR
|
||||
int
|
||||
\fBTcl_CancelEval\fR(\fIinterp, clientData, flags\fR)
|
||||
\fBTcl_CancelEval\fR(\fIinterp, resultObjPtr, clientData, flags\fR)
|
||||
.sp
|
||||
int
|
||||
\fBTcl_Canceled\fR(\fIinterp, flags\fR)
|
||||
.SH ARGUMENTS
|
||||
.AS Tcl_Interp *interp
|
||||
.AP Tcl_Interp *interp in
|
||||
Interpreter in which to cancel the script.
|
||||
.AP Tcl_Obj *resultObjPtr in
|
||||
Error message to use in the cancellation, or NULL to use a default message. If
|
||||
not NULL, this object will have its reference count decremented before
|
||||
\fBTcl_CancelEval\fR returns.
|
||||
.AP int flags in
|
||||
ORed combination of flag bits that specify additional options.
|
||||
For \fBTcl_CancelEval\fR, only \fBTCL_CANCEL_UNWIND\fR is currently
|
||||
supported. For \fBTcl_Canceled\fR, only \fBTCL_LEAVE_ERR_MSG\fR and
|
||||
\fBTCL_CANCEL_UNWIND\fR are currently supported.
|
||||
.AP ClientData clientData in
|
||||
Currently, reserved for future use.
|
||||
Currently reserved for future use.
|
||||
It should be set to NULL.
|
||||
.BE
|
||||
.SH DESCRIPTION
|
||||
@@ -41,19 +46,21 @@ returns \fBTCL_ERROR\fR if it has. Otherwise, \fBTCL_OK\fR is returned.
|
||||
Extensions can use this function to check to see if they should abort a long
|
||||
running command. This function is thread sensitive and may only be called
|
||||
from the thread the interpreter was created in.
|
||||
.SH "FLAG BITS"
|
||||
.SS "FLAG BITS"
|
||||
Any ORed combination of the following values may be used for the
|
||||
\fIflags\fR argument to procedures such as \fBTcl_CancelEval\fR:
|
||||
.TP 23
|
||||
.TP 20
|
||||
\fBTCL_CANCEL_UNWIND\fR
|
||||
.
|
||||
This flag is used by \fBTcl_CancelEval\fR and \fBTcl_Canceled\fR.
|
||||
For \fBTcl_CancelEval\fR, if this flag is set, the script in progress
|
||||
is canceled and the evaluation stack for the interpreter is unwound.
|
||||
For \fBTcl_Canceled\fR, if this flag is set, the script in progress
|
||||
is considered to be canceled only if the evaluation stack for the
|
||||
interpreter is being unwound.
|
||||
.TP 23
|
||||
.TP 20
|
||||
\fBTCL_LEAVE_ERR_MSG\fR
|
||||
.
|
||||
This flag is only used by \fBTcl_Canceled\fR; it is ignored by
|
||||
other procedures. If an error is returned and this bit is set in
|
||||
\fIflags\fR, then an error message will be left in the interpreter's
|
||||
@@ -61,6 +68,7 @@ result, where it can be retrieved with \fBTcl_GetObjResult\fR or
|
||||
\fBTcl_GetStringResult\fR. If this flag bit is not set then no error
|
||||
message is left and the interpreter's result will not be modified.
|
||||
.SH "SEE ALSO"
|
||||
interp(n), Tcl_Eval(3),
|
||||
TIP 285
|
||||
.SH KEYWORDS
|
||||
cancel, unwind
|
||||
|
||||
+2
-1
@@ -71,7 +71,8 @@ The name of the object to create, or NULL if a new unused name is to be
|
||||
automatically selected.
|
||||
.AP "const char" *nsName in
|
||||
The name of the namespace to create for the object's private use, or NULL if a
|
||||
new unused name is to be automatically selected.
|
||||
new unused name is to be automatically selected. The namespace must not
|
||||
already exist.
|
||||
.AP int objc in
|
||||
The number of elements in the \fIobjv\fR array.
|
||||
.AP "Tcl_Obj *const" *objv in
|
||||
|
||||
+1
-1
@@ -336,7 +336,7 @@ typedef struct Tcl_ChannelType {
|
||||
It is not necessary to provide implementations for all channel
|
||||
operations. Those which are not necessary may be set to NULL in the
|
||||
struct: \fIblockModeProc\fR, \fIseekProc\fR, \fIsetOptionProc\fR,
|
||||
\fIgetOptionProc\fR, and \fIclose2Proc\fR, in addition to
|
||||
\fIgetOptionProc\fR, \fIgetHandleProc\fR, and \fIclose2Proc\fR, in addition to
|
||||
\fIflushProc\fR, \fIhandlerProc\fR, \fIthreadActionProc\fR, and
|
||||
\fItruncateProc\fR. Other functions that cannot be implemented in a
|
||||
meaningful way should return \fBEINVAL\fR when called, to indicate
|
||||
|
||||
+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_DString 3 7.4 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+40
-74
@@ -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_GetEncoding 3 "8.1" Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
@@ -76,7 +76,7 @@ desired.
|
||||
.AP "const char" *name in
|
||||
Name of encoding to load.
|
||||
.AP Tcl_Encoding encoding in
|
||||
The encoding to query, free, or use for converting text. If \fIencoding\fR is
|
||||
The encoding to query, free, or use for converting text. If \fIencoding\fR is
|
||||
NULL, the current system encoding is used.
|
||||
.AP Tcl_Obj *objPtr in
|
||||
Name of encoding to get token for.
|
||||
@@ -86,17 +86,17 @@ Points to storage where encoding token is to be written.
|
||||
For the \fBTcl_ExternalToUtf\fR functions, an array of bytes in the
|
||||
specified encoding that are to be converted to UTF-8. For the
|
||||
\fBTcl_UtfToExternal\fR and \fBTcl_WinUtfToTChar\fR functions, an array of
|
||||
UTF-8 characters to be converted to the specified encoding.
|
||||
UTF-8 characters to be converted to the specified encoding.
|
||||
.AP "const TCHAR" *tsrc in
|
||||
An array of Windows TCHAR characters to convert to UTF-8.
|
||||
.AP int srcLen in
|
||||
Length of \fIsrc\fR or \fItsrc\fR in bytes. If the length is negative, the
|
||||
.AP int srcLen in
|
||||
Length of \fIsrc\fR or \fItsrc\fR in bytes. If the length is negative, the
|
||||
encoding-specific length of the string is used.
|
||||
.AP Tcl_DString *dstPtr out
|
||||
Pointer to an uninitialized or free \fBTcl_DString\fR in which the converted
|
||||
result will be stored.
|
||||
.AP int flags in
|
||||
Various flag bits OR-ed together.
|
||||
Various flag bits OR-ed together.
|
||||
\fBTCL_ENCODING_START\fR signifies that the
|
||||
source buffer is the first block in a (potentially multi-block) input
|
||||
stream, telling the conversion routine to reset to an initial state and
|
||||
@@ -108,7 +108,7 @@ byte is converted and then to reset to an initial state.
|
||||
\fBTCL_ENCODING_STOPONERROR\fR signifies that the conversion routine should
|
||||
return immediately upon reading a source character that does not exist in
|
||||
the target encoding; otherwise a default fallback character will
|
||||
automatically be substituted.
|
||||
automatically be substituted.
|
||||
.AP Tcl_EncodingState *statePtr in/out
|
||||
Used when converting a (generally long or indefinite length) byte stream
|
||||
in a piece-by-piece fashion. The conversion routine stores its current
|
||||
@@ -116,7 +116,7 @@ state in \fI*statePtr\fR after \fIsrc\fR (the buffer containing the
|
||||
current piece) has been converted; that state information must be passed
|
||||
back when converting the next piece of the stream so the conversion
|
||||
routine knows what state it was in when it left off at the end of the
|
||||
last piece. May be NULL, in which case the value specified for \fIflags\fR
|
||||
last piece. May be NULL, in which case the value specified for \fIflags\fR
|
||||
is ignored and the source buffer is assumed to contain the complete string to
|
||||
convert.
|
||||
.AP char *dst out
|
||||
@@ -137,11 +137,11 @@ stored in the output buffer. May be NULL.
|
||||
.AP Tcl_DString *bufPtr out
|
||||
Storage for the prescribed system encoding name.
|
||||
.AP "const Tcl_EncodingType" *typePtr in
|
||||
Structure that defines a new type of encoding.
|
||||
Structure that defines a new type of encoding.
|
||||
.AP Tcl_Obj *searchPath in
|
||||
List of filesystem directories in which to search for encoding data files.
|
||||
.AP "const char" *path in
|
||||
A path to the location of the encoding file.
|
||||
A path to the location of the encoding file.
|
||||
.BE
|
||||
.SH INTRODUCTION
|
||||
.PP
|
||||
@@ -180,13 +180,13 @@ The first time \fIname\fR is seen, \fBTcl_GetEncoding\fR returns an
|
||||
encoding with a reference count of 1. If the same \fIname\fR is requested
|
||||
further times, then the reference count for that encoding is incremented
|
||||
without the overhead of allocating a new encoding and all its associated
|
||||
data structures.
|
||||
data structures.
|
||||
.PP
|
||||
When an \fIencoding\fR is no longer needed, \fBTcl_FreeEncoding\fR
|
||||
should be called to release it. When an \fIencoding\fR is no longer in use
|
||||
anywhere (i.e., it has been freed as many times as it has been gotten)
|
||||
\fBTcl_FreeEncoding\fR will release all storage the encoding was using
|
||||
and delete it from the database.
|
||||
and delete it from the database.
|
||||
.PP
|
||||
\fBTcl_GetEncodingFromObj\fR treats the string representation of
|
||||
\fIobjPtr\fR as an encoding name, and finds an encoding with that
|
||||
@@ -201,7 +201,7 @@ on the resulting encoding token when that token will no longer be
|
||||
used.
|
||||
.PP
|
||||
\fBTcl_ExternalToUtfDString\fR converts a source buffer \fIsrc\fR from the
|
||||
specified \fIencoding\fR into UTF-8. The converted bytes are stored in
|
||||
specified \fIencoding\fR into UTF-8. The converted bytes are stored in
|
||||
\fIdstPtr\fR, which is then null-terminated. The caller should eventually
|
||||
call \fBTcl_DStringFree\fR to free any information stored in \fIdstPtr\fR.
|
||||
When converting, if any of the characters in the source buffer cannot be
|
||||
@@ -227,17 +227,17 @@ sequence, but more bytes were needed to complete this sequence. A
|
||||
subsequent call to the conversion routine should pass a buffer containing
|
||||
the unconverted bytes that remained in \fIsrc\fR plus some further bytes
|
||||
from the source stream to properly convert the formerly split-up multibyte
|
||||
sequence.
|
||||
sequence.
|
||||
.IP \fBTCL_CONVERT_SYNTAX\fR 29
|
||||
The source buffer contained an invalid character sequence. This may occur
|
||||
if the input stream has been damaged or if the input encoding method was
|
||||
misidentified.
|
||||
.IP \fBTCL_CONVERT_UNKNOWN\fR 29
|
||||
The source buffer contained a character that could not be represented in
|
||||
the target encoding and \fBTCL_ENCODING_STOPONERROR\fR was specified.
|
||||
the target encoding and \fBTCL_ENCODING_STOPONERROR\fR was specified.
|
||||
.RE
|
||||
.LP
|
||||
\fBTcl_UtfToExternalDString\fR converts a source buffer \fIsrc\fR from UTF-8
|
||||
\fBTcl_UtfToExternalDString\fR converts a source buffer \fIsrc\fR from UTF-8
|
||||
into the specified \fIencoding\fR. The converted bytes are stored in
|
||||
\fIdstPtr\fR, which is then terminated with the appropriate encoding-specific
|
||||
null. The caller should eventually call \fBTcl_DStringFree\fR to free any
|
||||
@@ -257,51 +257,17 @@ is filled with the corresponding number of bytes that were stored in
|
||||
.PP
|
||||
\fBTcl_WinUtfToTChar\fR and \fBTcl_WinTCharToUtf\fR are
|
||||
Windows-only convenience
|
||||
functions for converting between UTF-8 and Windows strings. On Windows 95
|
||||
(as with the Unix operating system),
|
||||
all strings exchanged between Tcl and the operating system are
|
||||
.QW "char"
|
||||
based. On Windows NT, some strings exchanged between Tcl and the
|
||||
operating system are
|
||||
.QW "char"
|
||||
oriented while others are in Unicode. By
|
||||
convention, in Windows a TCHAR is a character in the ANSI code page
|
||||
on Windows 95 and a Unicode character on Windows NT.
|
||||
.PP
|
||||
If you planned to use the same
|
||||
.QW "char"
|
||||
based interfaces on both Windows
|
||||
95 and Windows NT, you could use \fBTcl_UtfToExternal\fR and
|
||||
\fBTcl_ExternalToUtf\fR (or their \fBTcl_DString\fR equivalents) with an
|
||||
encoding of NULL (the current system encoding). On the other hand,
|
||||
if you planned to use the Unicode interface when running on Windows NT
|
||||
and the
|
||||
.QW "char"
|
||||
interfaces when running on Windows 95, you would have
|
||||
to perform the following type of test over and over in your program
|
||||
(as represented in pseudo-code):
|
||||
.PP
|
||||
.CS
|
||||
if (running NT) {
|
||||
encoding <- Tcl_GetEncoding("unicode");
|
||||
nativeBuffer <- Tcl_UtfToExternal(encoding, utfBuffer);
|
||||
Tcl_FreeEncoding(encoding);
|
||||
} else {
|
||||
nativeBuffer <- Tcl_UtfToExternal(NULL, utfBuffer);
|
||||
}
|
||||
.CE
|
||||
.PP
|
||||
\fBTcl_WinUtfToTChar\fR and \fBTcl_WinTCharToUtf\fR automatically
|
||||
handle this test and use the proper encoding based on the current
|
||||
operating system. \fBTcl_WinUtfToTChar\fR returns a pointer to
|
||||
a TCHAR string, and \fBTcl_WinTCharToUtf\fR expects a TCHAR string
|
||||
pointer as the \fIsrc\fR string. Otherwise, these functions
|
||||
behave identically to \fBTcl_UtfToExternalDString\fR and
|
||||
\fBTcl_ExternalToUtfDString\fR.
|
||||
functions for converting between UTF-8 and Windows strings
|
||||
based on the TCHAR type which is by convention
|
||||
a Unicode character on Windows NT.
|
||||
These functions are essentially wrappers around
|
||||
\fBTcl_UtfToExternalDString\fR and
|
||||
\fBTcl_ExternalToUtfDString\fR that convert to and from the
|
||||
Unicode encoding.
|
||||
.PP
|
||||
\fBTcl_GetEncodingName\fR is roughly the inverse of \fBTcl_GetEncoding\fR.
|
||||
Given an \fIencoding\fR, the return value is the \fIname\fR argument that
|
||||
was used to create the encoding. The string returned by
|
||||
was used to create the encoding. The string returned by
|
||||
\fBTcl_GetEncodingName\fR is only guaranteed to persist until the
|
||||
\fIencoding\fR is deleted. The caller must not modify this string.
|
||||
.PP
|
||||
@@ -340,9 +306,9 @@ reference count of 1. If an encoding with the specified \fIname\fR
|
||||
already exists, then its entry in the database is replaced with the new
|
||||
encoding; the token for the old encoding will remain valid and continue
|
||||
to behave as before, but users of the new token will now call the new
|
||||
encoding procedures.
|
||||
encoding procedures.
|
||||
.PP
|
||||
The \fItypePtr\fR argument to \fBTcl_CreateEncoding\fR contains information
|
||||
The \fItypePtr\fR argument to \fBTcl_CreateEncoding\fR contains information
|
||||
about the name of the encoding and the procedures that will be called to
|
||||
convert between this encoding and UTF-8. It is defined as follows:
|
||||
.PP
|
||||
@@ -354,7 +320,7 @@ typedef struct Tcl_EncodingType {
|
||||
Tcl_EncodingFreeProc *\fIfreeProc\fR;
|
||||
ClientData \fIclientData\fR;
|
||||
int \fInullSize\fR;
|
||||
} \fBTcl_EncodingType\fR;
|
||||
} \fBTcl_EncodingType\fR;
|
||||
.CE
|
||||
.PP
|
||||
The \fIencodingName\fR provides a string name for the encoding, by
|
||||
@@ -384,12 +350,12 @@ type \fBTcl_EncodingConvertProc\fR:
|
||||
.CS
|
||||
typedef int \fBTcl_EncodingConvertProc\fR(
|
||||
ClientData \fIclientData\fR,
|
||||
const char *\fIsrc\fR,
|
||||
int \fIsrcLen\fR,
|
||||
int \fIflags\fR,
|
||||
const char *\fIsrc\fR,
|
||||
int \fIsrcLen\fR,
|
||||
int \fIflags\fR,
|
||||
Tcl_EncodingState *\fIstatePtr\fR,
|
||||
char *\fIdst\fR,
|
||||
int \fIdstLen\fR,
|
||||
char *\fIdst\fR,
|
||||
int \fIdstLen\fR,
|
||||
int *\fIsrcReadPtr\fR,
|
||||
int *\fIdstWrotePtr\fR,
|
||||
int *\fIdstCharsPtr\fR);
|
||||
@@ -405,12 +371,12 @@ documented at the top, to \fBTcl_ExternalToUtf\fR or
|
||||
\fBTcl_UtfToExternal\fR, with the following exceptions. If the
|
||||
\fIsrcLen\fR argument to one of those high-level functions is negative,
|
||||
the value passed to the callback procedure will be the appropriate
|
||||
encoding-specific string length of \fIsrc\fR. If any of the \fIsrcReadPtr\fR,
|
||||
encoding-specific string length of \fIsrc\fR. If any of the \fIsrcReadPtr\fR,
|
||||
\fIdstWrotePtr\fR, or \fIdstCharsPtr\fR arguments to one of the high-level
|
||||
functions is NULL, the corresponding value passed to the callback
|
||||
procedure will be a non-NULL location.
|
||||
.PP
|
||||
The callback procedure \fIfreeProc\fR, if non-NULL, should match the type
|
||||
The callback procedure \fIfreeProc\fR, if non-NULL, should match the type
|
||||
\fBTcl_EncodingFreeProc\fR:
|
||||
.PP
|
||||
.CS
|
||||
@@ -420,11 +386,11 @@ typedef void \fBTcl_EncodingFreeProc\fR(
|
||||
.PP
|
||||
This \fIfreeProc\fR function is called when the encoding is deleted. The
|
||||
\fIclientData\fR parameter is the same as the \fIclientData\fR field
|
||||
specified to \fBTcl_CreateEncoding\fR when the encoding was created.
|
||||
specified to \fBTcl_CreateEncoding\fR when the encoding was created.
|
||||
.PP
|
||||
\fBTcl_GetEncodingSearchPath\fR and \fBTcl_SetEncodingSearchPath\fR
|
||||
are called to access and set the list of filesystem directories searched
|
||||
for encoding data files.
|
||||
for encoding data files.
|
||||
.PP
|
||||
The value returned by \fBTcl_GetEncodingSearchPath\fR
|
||||
is the value stored by the last successful call to
|
||||
@@ -457,7 +423,7 @@ encoding files that can be loaded using the same mechanism. These
|
||||
encoding files contain information about the tables and/or escape
|
||||
sequences used to map between an external encoding and Unicode. The
|
||||
external encoding may consist of single-byte, multi-byte, or double-byte
|
||||
characters.
|
||||
characters.
|
||||
.PP
|
||||
Each dynamically-loadable encoding is represented as a text file. The
|
||||
initial line of the file, beginning with a
|
||||
@@ -481,9 +447,9 @@ many Japanese computers.
|
||||
.IP "[4] \fBE\fR"
|
||||
An escape-sequence encoding, specifying that certain sequences of bytes
|
||||
do not represent characters, but commands that describe how following bytes
|
||||
should be interpreted.
|
||||
should be interpreted.
|
||||
.PP
|
||||
The rest of the lines in the file depend on the type.
|
||||
The rest of the lines in the file depend on the type.
|
||||
.PP
|
||||
Cases [1], [2], and [3] are collectively referred to as table-based encoding
|
||||
files. The lines in a table-based encoding file are in the same
|
||||
@@ -534,7 +500,7 @@ The third line of the file is three numbers. The first number is the
|
||||
fallback character (in base 16) to use when converting from UTF-8 to this
|
||||
encoding. The second number is a \fB1\fR if this file represents the
|
||||
encoding for a symbol font, or \fB0\fR otherwise. The last number (in base
|
||||
10) is how many pages of data follow.
|
||||
10) is how many pages of data follow.
|
||||
.PP
|
||||
Subsequent lines in the example above are pages that describe how to map
|
||||
from the encoding into 2-byte Unicode. The first line in a page identifies
|
||||
|
||||
+3441
File diff suppressed because it is too large
Load Diff
Executable
+253
@@ -0,0 +1,253 @@
|
||||
#!../../unix/tclsh
|
||||
|
||||
int
|
||||
main(string av[])
|
||||
{
|
||||
FILE f;
|
||||
int i, ul;
|
||||
int space = 0, dd = 0, p = 0, pre = 0;
|
||||
string buf, c, tmp, title, trim, all[];
|
||||
|
||||
/*
|
||||
* -t<title> or --title=<title>
|
||||
*/
|
||||
while (c = getopt(av, "t:", {"title:"})) {
|
||||
switch (c) {
|
||||
case "t":
|
||||
case "title":
|
||||
title = optarg;
|
||||
break;
|
||||
}
|
||||
}
|
||||
unless (av[optind] && (f = fopen(av[optind], "r"))) {
|
||||
die("usage: ${av[0]} filename");
|
||||
}
|
||||
unless (title) title = av[optind];
|
||||
|
||||
header(title);
|
||||
|
||||
/*
|
||||
* Load up the whole file in all[] and spit out the index.
|
||||
*/
|
||||
puts("<ul>");
|
||||
ul = 1;
|
||||
while (buf = <f>) {
|
||||
push(&all, buf);
|
||||
if (buf =~ /^=head(\d+)\s+(.*)/) {
|
||||
i = (int)$1;
|
||||
while (ul > i) {
|
||||
puts("</ul>");
|
||||
ul--;
|
||||
}
|
||||
while (i > ul) {
|
||||
puts("<ul>");
|
||||
ul++;
|
||||
}
|
||||
tmp = $2;
|
||||
tmp =~ s/\s+/_/g;
|
||||
buf =~ s/^=head(\d+)\s+//;
|
||||
puts("<li><a href=\"#${tmp}\">${buf}</a></li>");
|
||||
}
|
||||
}
|
||||
while (ul--) puts("</ul>");
|
||||
fclose(f);
|
||||
|
||||
/*
|
||||
* Now walk all[] and process the markup. We currently handle:
|
||||
* =head%d title
|
||||
* =over
|
||||
* =item name
|
||||
* =proto return_type func(args)
|
||||
* =back
|
||||
* <blank line>
|
||||
* B<bold this>
|
||||
* C<some code>
|
||||
* I<italics>
|
||||
*/
|
||||
// The <= is intentional to run an empty string through at the end
|
||||
// to kick out any final </pre> etc.
|
||||
for (i = 0; i <= length(all); i++) {
|
||||
buf = inline(all[i]);
|
||||
if (buf =~ /^=head(\d+)\s+(.*)/) {
|
||||
if ((int)$1 == 1) puts("<HR>");
|
||||
tmp = $2;
|
||||
tmp =~ s/\s+/_/g;
|
||||
printf("<H%d><a name=\"%s\">%s</a></H%d>\n",
|
||||
$1, tmp, $2, $1);
|
||||
} else if (buf =~ /^=over/) {
|
||||
puts("<dl>");
|
||||
} else if (buf =~ /^=item\s+(.*)/) {
|
||||
if (dd) {
|
||||
puts("</dd>");
|
||||
dd--;
|
||||
}
|
||||
puts("<dt><strong>${$1}</strong></dt><dd>");
|
||||
dd++;
|
||||
} else if (buf =~ /^=proto\s+([^ \t]+)\s+(.*)/) {
|
||||
if (dd) {
|
||||
puts("</dd>");
|
||||
dd--;
|
||||
}
|
||||
puts("<dt><b>${$1} ${$2}</b></dt><dd>");
|
||||
dd++;
|
||||
} else if (buf =~ /^=back/) {
|
||||
if (dd) {
|
||||
puts("</dd>");
|
||||
dd--;
|
||||
}
|
||||
puts("</dl>");
|
||||
} else if (buf =~ /^\s*$/) {
|
||||
if (p) {
|
||||
puts("</p>");
|
||||
p = 0;
|
||||
}
|
||||
if (pre) {
|
||||
/*
|
||||
* If we see a blank line in a preformatted
|
||||
* block, we don't want to stop the pre
|
||||
* unless the next line is not indented.
|
||||
* So peek ahead.
|
||||
*/
|
||||
if (defined(buf = all[i+1]) && (buf =~ /^\s/)) {
|
||||
puts("");
|
||||
continue;
|
||||
}
|
||||
puts("</pre>");
|
||||
pre = 0;
|
||||
trim = undef;
|
||||
}
|
||||
space = 1;
|
||||
} else {
|
||||
if (space) {
|
||||
if (buf =~ /^(\s+)[^ \t]+/) {
|
||||
trim = $1;
|
||||
puts("<pre>");
|
||||
pre = 1;
|
||||
} else {
|
||||
puts("<p>");
|
||||
p = 1;
|
||||
}
|
||||
space = 0;
|
||||
}
|
||||
if (defined(trim)) buf =~ s/^${trim}//;
|
||||
puts(buf);
|
||||
}
|
||||
}
|
||||
puts("</body></html>");
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* header and style sheet
|
||||
*/
|
||||
void
|
||||
header(string title)
|
||||
{
|
||||
string head = <<EOF
|
||||
<html>
|
||||
<head>
|
||||
<title>${title}</title>
|
||||
<style>
|
||||
pre {
|
||||
background: #eeeedd;
|
||||
border-width: 1px;
|
||||
border-style: solid solid solid solid;
|
||||
border-color: #ccc;
|
||||
padding: 5px 5px 5px 5px;
|
||||
font-family: monospace;
|
||||
font-weight: bolder;
|
||||
}
|
||||
body {
|
||||
padding-left: 10px;
|
||||
}
|
||||
dt {
|
||||
font-size: large;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
EOF
|
||||
puts(head);
|
||||
puts("<h1>${title}</h1>");
|
||||
}
|
||||
|
||||
/*
|
||||
* Process B<bold>, C<code>, I<italic>, F<italic>, L<link>, S<non-breaking>.
|
||||
* This will handle nested stuff like C<if (!I<condition>)>
|
||||
* but dies if there are nested ones of the same type, i.e.,
|
||||
* C<whatever C<some more>>
|
||||
*/
|
||||
string
|
||||
inline(string buf)
|
||||
{
|
||||
string c, prev, result = "", link, stack[];
|
||||
int B = 0, C = 0, I = 0, L = 0, S = 0;
|
||||
|
||||
unless (buf) buf = "";
|
||||
foreach (c in buf) {
|
||||
if ((c == "<") && prev) {
|
||||
if (prev == "B") {
|
||||
if (B++) die("Nested B<> unsupported: ${buf}");
|
||||
result[END] = "";
|
||||
result .= "<B>";
|
||||
push(&stack, "B");
|
||||
} else if (prev == "C") {
|
||||
if (C++) die("Nested C<> unsupported: ${buf}");
|
||||
result[END] = "";
|
||||
result .= "<CODE>";
|
||||
push(&stack, "CODE");
|
||||
} else if (prev == "I" || prev == "F") {
|
||||
if (I++) die("Nested I<> unsupported: ${buf}");
|
||||
result[END] = "";
|
||||
result .= "<I>";
|
||||
push(&stack, "I");
|
||||
} else if (prev == "L") {
|
||||
if (L++) die("Nested L<> unsupported: ${buf}");
|
||||
result[END] = "";
|
||||
result .= "<a href=\"";
|
||||
link = "";
|
||||
push(&stack, "L");
|
||||
} else if (prev == "S") {
|
||||
if (S++) die("Nested S<> unsupported: ${buf}");
|
||||
result[END] = "";
|
||||
push(&stack, "S");
|
||||
} else {
|
||||
result .= "<";
|
||||
prev = c;
|
||||
}
|
||||
} else if ((c == ">") && length(stack)) {
|
||||
c = pop(&stack);
|
||||
if (c == "B") {
|
||||
B--;
|
||||
} else if (c == "CODE") {
|
||||
C--;
|
||||
} else if (c == "I") {
|
||||
I--;
|
||||
} else if (c == "L") {
|
||||
L--;
|
||||
result .= "\">${link}</a>";
|
||||
c = undef;
|
||||
} else {
|
||||
S--;
|
||||
c = undef;
|
||||
}
|
||||
if (c) {
|
||||
result .= "</" . c . ">";
|
||||
}
|
||||
prev = undef;
|
||||
} else {
|
||||
if (S && isspace(c)) {
|
||||
result .= " ";
|
||||
} else if (c == "<") {
|
||||
result .= "<";
|
||||
} else if (c == ">") {
|
||||
result .= ">";
|
||||
} else {
|
||||
result .= c;
|
||||
}
|
||||
if (L) link .= c;
|
||||
prev = c;
|
||||
}
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
Executable
+513
@@ -0,0 +1,513 @@
|
||||
#!/usr/bin/perl
|
||||
eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
|
||||
if $running_under_some_shell;
|
||||
|
||||
# pod2man -- Convert POD data to formatted *roff input.
|
||||
# $Id: pod2man.PL,v 1.10 2002/07/15 05:45:56 eagle Exp $
|
||||
#
|
||||
# Copyright 1999, 2000, 2001 by Russ Allbery <rra@stanford.edu>
|
||||
#
|
||||
# This program is free software; you may redistribute it and/or modify it
|
||||
# under the same terms as Perl itself.
|
||||
|
||||
require 5.004;
|
||||
|
||||
use Getopt::Long qw(GetOptions);
|
||||
use Pod::Man ();
|
||||
use Pod::Usage qw(pod2usage);
|
||||
|
||||
use strict;
|
||||
|
||||
# Silence -w warnings.
|
||||
use vars qw($running_under_some_shell);
|
||||
|
||||
# Insert -- into @ARGV before any single dash argument to hide it from
|
||||
# Getopt::Long; we want to interpret it as meaning stdin (which Pod::Parser
|
||||
# does correctly).
|
||||
my $stdin;
|
||||
@ARGV = map { $_ eq '-' && !$stdin++ ? ('--', $_) : $_ } @ARGV;
|
||||
|
||||
# Parse our options, trying to retain backwards compatibility with pod2man but
|
||||
# allowing short forms as well. --lax is currently ignored.
|
||||
my %options;
|
||||
Getopt::Long::config ('bundling_override');
|
||||
GetOptions (\%options, 'section|s=s', 'release|r:s', 'center|c=s',
|
||||
'date|d=s', 'fixed=s', 'fixedbold=s', 'fixeditalic=s',
|
||||
'fixedbolditalic=s', 'name|n=s', 'official|o', 'quotes|q=s',
|
||||
'lax|l', 'help|h', 'verbose|v') or exit 1;
|
||||
pod2usage (0) if $options{help};
|
||||
|
||||
# Official sets --center, but don't override things explicitly set.
|
||||
if ($options{official} && !defined $options{center}) {
|
||||
$options{center} = 'Perl Programmers Reference Guide';
|
||||
}
|
||||
|
||||
# Verbose is only our flag, not a Pod::Man flag.
|
||||
my $verbose = $options{verbose};
|
||||
delete $options{verbose};
|
||||
|
||||
# This isn't a valid Pod::Man option and is only accepted for backwards
|
||||
# compatibility.
|
||||
delete $options{lax};
|
||||
|
||||
# Initialize and run the formatter, pulling a pair of input and output off at
|
||||
# a time.
|
||||
my $parser = Pod::Man->new (%options);
|
||||
my @files;
|
||||
do {
|
||||
@files = splice (@ARGV, 0, 2);
|
||||
print " $files[1]\n" if $verbose;
|
||||
$parser->parse_from_file (@files);
|
||||
} while (@ARGV);
|
||||
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
pod2man - Convert POD data to formatted *roff input
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
pod2man [B<--section>=I<manext>] [B<--release>=I<version>]
|
||||
[B<--center>=I<string>] [B<--date>=I<string>] [B<--fixed>=I<font>]
|
||||
[B<--fixedbold>=I<font>] [B<--fixeditalic>=I<font>]
|
||||
[B<--fixedbolditalic>=I<font>] [B<--name>=I<name>] [B<--official>]
|
||||
[B<--lax>] [B<--quotes>=I<quotes>] [B<--verbose>]
|
||||
[I<input> [I<output>] ...]
|
||||
|
||||
pod2man B<--help>
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
B<pod2man> is a front-end for Pod::Man, using it to generate *roff input
|
||||
from POD source. The resulting *roff code is suitable for display on a
|
||||
terminal using nroff(1), normally via man(1), or printing using troff(1).
|
||||
|
||||
I<input> is the file to read for POD source (the POD can be embedded in
|
||||
code). If I<input> isn't given, it defaults to STDIN. I<output>, if given,
|
||||
is the file to which to write the formatted output. If I<output> isn't
|
||||
given, the formatted output is written to STDOUT. Several POD files can be
|
||||
processed in the same B<pod2man> invocation (saving module load and compile
|
||||
times) by providing multiple pairs of I<input> and I<output> files on the
|
||||
command line.
|
||||
|
||||
B<--section>, B<--release>, B<--center>, B<--date>, and B<--official> can be
|
||||
used to set the headers and footers to use; if not given, Pod::Man will
|
||||
assume various defaults. See below or L<Pod::Man> for details.
|
||||
|
||||
B<pod2man> assumes that your *roff formatters have a fixed-width font named
|
||||
CW. If yours is called something else (like CR), use B<--fixed> to specify
|
||||
it. This generally only matters for troff output for printing. Similarly,
|
||||
you can set the fonts used for bold, italic, and bold italic fixed-width
|
||||
output.
|
||||
|
||||
Besides the obvious pod conversions, Pod::Man, and therefore pod2man also
|
||||
takes care of formatting func(), func(n), and simple variable references
|
||||
like $foo or @bar so you don't have to use code escapes for them; complex
|
||||
expressions like C<$fred{'stuff'}> will still need to be escaped, though.
|
||||
It also translates dashes that aren't used as hyphens into en dashes, makes
|
||||
long dashes--like this--into proper em dashes, fixes "paired quotes," and
|
||||
takes care of several other troff-specific tweaks. See L<Pod::Man> for
|
||||
complete information.
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
=over 4
|
||||
|
||||
=item B<-c> I<string>, B<--center>=I<string>
|
||||
|
||||
Sets the centered page header to I<string>. The default is "User
|
||||
Contributed Perl Documentation", but also see B<--official> below.
|
||||
|
||||
=item B<-d> I<string>, B<--date>=I<string>
|
||||
|
||||
Set the left-hand footer string to this value. By default, the modification
|
||||
date of the input file will be used, or the current date if input comes from
|
||||
STDIN.
|
||||
|
||||
=item B<--fixed>=I<font>
|
||||
|
||||
The fixed-width font to use for vertabim text and code. Defaults to CW.
|
||||
Some systems may want CR instead. Only matters for troff(1) output.
|
||||
|
||||
=item B<--fixedbold>=I<font>
|
||||
|
||||
Bold version of the fixed-width font. Defaults to CB. Only matters for
|
||||
troff(1) output.
|
||||
|
||||
=item B<--fixeditalic>=I<font>
|
||||
|
||||
Italic version of the fixed-width font (actually, something of a misnomer,
|
||||
since most fixed-width fonts only have an oblique version, not an italic
|
||||
version). Defaults to CI. Only matters for troff(1) output.
|
||||
|
||||
=item B<--fixedbolditalic>=I<font>
|
||||
|
||||
Bold italic (probably actually oblique) version of the fixed-width font.
|
||||
Pod::Man doesn't assume you have this, and defaults to CB. Some systems
|
||||
(such as Solaris) have this font available as CX. Only matters for troff(1)
|
||||
output.
|
||||
|
||||
=item B<-h>, B<--help>
|
||||
|
||||
Print out usage information.
|
||||
|
||||
=item B<-l>, B<--lax>
|
||||
|
||||
No longer used. B<pod2man> used to check its input for validity as a manual
|
||||
page, but this should now be done by L<podchecker(1)> instead. Accepted for
|
||||
backwards compatibility; this option no longer does anything.
|
||||
|
||||
=item B<-n> I<name>, B<--name>=I<name>
|
||||
|
||||
Set the name of the manual page to I<name>. Without this option, the manual
|
||||
name is set to the uppercased base name of the file being converted unless
|
||||
the manual section is 3, in which case the path is parsed to see if it is a
|
||||
Perl module path. If it is, a path like C<.../lib/Pod/Man.pm> is converted
|
||||
into a name like C<Pod::Man>. This option, if given, overrides any
|
||||
automatic determination of the name.
|
||||
|
||||
Note that this option is probably not useful when converting multiple POD
|
||||
files at once. The convention for Unix man pages for commands is for the
|
||||
man page title to be in all-uppercase even if the command isn't.
|
||||
|
||||
=item B<-o>, B<--official>
|
||||
|
||||
Set the default header to indicate that this page is part of the standard
|
||||
Perl release, if B<--center> is not also given.
|
||||
|
||||
=item B<-q> I<quotes>, B<--quotes>=I<quotes>
|
||||
|
||||
Sets the quote marks used to surround CE<lt>> text to I<quotes>. If
|
||||
I<quotes> is a single character, it is used as both the left and right
|
||||
quote; if I<quotes> is two characters, the first character is used as the
|
||||
left quote and the second as the right quoted; and if I<quotes> is four
|
||||
characters, the first two are used as the left quote and the second two as
|
||||
the right quote.
|
||||
|
||||
I<quotes> may also be set to the special value C<none>, in which case no
|
||||
quote marks are added around CE<lt>> text (but the font is still changed for
|
||||
troff output).
|
||||
|
||||
=item B<-r>, B<--release>
|
||||
|
||||
Set the centered footer. By default, this is the version of Perl you run
|
||||
B<pod2man> under. Note that some system an macro sets assume that the
|
||||
centered footer will be a modification date and will prepend something like
|
||||
"Last modified: "; if this is the case, you may want to set B<--release> to
|
||||
the last modified date and B<--date> to the version number.
|
||||
|
||||
=item B<-s>, B<--section>
|
||||
|
||||
Set the section for the C<.TH> macro. The standard section numbering
|
||||
convention is to use 1 for user commands, 2 for system calls, 3 for
|
||||
functions, 4 for devices, 5 for file formats, 6 for games, 7 for
|
||||
miscellaneous information, and 8 for administrator commands. There is a lot
|
||||
of variation here, however; some systems (like Solaris) use 4 for file
|
||||
formats, 5 for miscellaneous information, and 7 for devices. Still others
|
||||
use 1m instead of 8, or some mix of both. About the only section numbers
|
||||
that are reliably consistent are 1, 2, and 3.
|
||||
|
||||
By default, section 1 will be used unless the file ends in .pm in which case
|
||||
section 3 will be selected.
|
||||
|
||||
=item B<-v>, B<--verbose>
|
||||
|
||||
Print out the name of each output file as it is being generated.
|
||||
|
||||
=back
|
||||
|
||||
=head1 DIAGNOSTICS
|
||||
|
||||
If B<pod2man> fails with errors, see L<Pod::Man> and L<Pod::Parser> for
|
||||
information about what those errors might mean.
|
||||
|
||||
=head1 EXAMPLES
|
||||
|
||||
pod2man program > program.1
|
||||
pod2man SomeModule.pm /usr/perl/man/man3/SomeModule.3
|
||||
pod2man --section=7 note.pod > note.7
|
||||
|
||||
If you would like to print out a lot of man page continuously, you probably
|
||||
want to set the C and D registers to set contiguous page numbering and
|
||||
even/odd paging, at least on some versions of man(7).
|
||||
|
||||
troff -man -rC1 -rD1 perl.1 perldata.1 perlsyn.1 ...
|
||||
|
||||
To get index entries on stderr, turn on the F register, as in:
|
||||
|
||||
troff -man -rF1 perl.1
|
||||
|
||||
The indexing merely outputs messages via C<.tm> for each major page,
|
||||
section, subsection, item, and any C<XE<lt>E<gt>> directives. See
|
||||
L<Pod::Man> for more details.
|
||||
|
||||
=head1 BUGS
|
||||
|
||||
Lots of this documentation is duplicated from L<Pod::Man>.
|
||||
|
||||
=head1 NOTES
|
||||
|
||||
For those not sure of the proper layout of a man page, here are some notes
|
||||
on writing a proper man page.
|
||||
|
||||
The name of the program being documented is conventionally written in bold
|
||||
(using BE<lt>E<gt>) wherever it occurs, as are all program options.
|
||||
Arguments should be written in italics (IE<lt>E<gt>). Functions are
|
||||
traditionally written in italics; if you write a function as function(),
|
||||
Pod::Man will take care of this for you. Literal code or commands should
|
||||
be in CE<lt>E<gt>. References to other man pages should be in the form
|
||||
C<manpage(section)>, and Pod::Man will automatically format those
|
||||
appropriately. As an exception, it's traditional not to use this form when
|
||||
referring to module documentation; use C<LE<lt>Module::NameE<gt>> instead.
|
||||
|
||||
References to other programs or functions are normally in the form of man
|
||||
page references so that cross-referencing tools can provide the user with
|
||||
links and the like. It's possible to overdo this, though, so be careful not
|
||||
to clutter your documentation with too much markup.
|
||||
|
||||
The major headers should be set out using a C<=head1> directive, and are
|
||||
historically written in the rather startling ALL UPPER CASE format, although
|
||||
this is not mandatory. Minor headers may be included using C<=head2>, and
|
||||
are typically in mixed case.
|
||||
|
||||
The standard sections of a manual page are:
|
||||
|
||||
=over 4
|
||||
|
||||
=item NAME
|
||||
|
||||
Mandatory section; should be a comma-separated list of programs or functions
|
||||
documented by this podpage, such as:
|
||||
|
||||
foo, bar - programs to do something
|
||||
|
||||
Manual page indexers are often extremely picky about the format of this
|
||||
section, so don't put anything in it except this line. A single dash, and
|
||||
only a single dash, should separate the list of programs or functions from
|
||||
the description. Functions should not be qualified with C<()> or the like.
|
||||
The description should ideally fit on a single line, even if a man program
|
||||
replaces the dash with a few tabs.
|
||||
|
||||
=item SYNOPSIS
|
||||
|
||||
A short usage summary for programs and functions. This section is mandatory
|
||||
for section 3 pages.
|
||||
|
||||
=item DESCRIPTION
|
||||
|
||||
Extended description and discussion of the program or functions, or the body
|
||||
of the documentation for man pages that document something else. If
|
||||
particularly long, it's a good idea to break this up into subsections
|
||||
C<=head2> directives like:
|
||||
|
||||
=head2 Normal Usage
|
||||
|
||||
=head2 Advanced Features
|
||||
|
||||
=head2 Writing Configuration Files
|
||||
|
||||
or whatever is appropriate for your documentation.
|
||||
|
||||
=item OPTIONS
|
||||
|
||||
Detailed description of each of the command-line options taken by the
|
||||
program. This should be separate from the description for the use of things
|
||||
like L<Pod::Usage|Pod::Usage>. This is normally presented as a list, with
|
||||
each option as a separate C<=item>. The specific option string should be
|
||||
enclosed in BE<lt>E<gt>. Any values that the option takes should be
|
||||
enclosed in IE<lt>E<gt>. For example, the section for the option
|
||||
B<--section>=I<manext> would be introduced with:
|
||||
|
||||
=item B<--section>=I<manext>
|
||||
|
||||
Synonymous options (like both the short and long forms) are separated by a
|
||||
comma and a space on the same C<=item> line, or optionally listed as their
|
||||
own item with a reference to the canonical name. For example, since
|
||||
B<--section> can also be written as B<-s>, the above would be:
|
||||
|
||||
=item B<-s> I<manext>, B<--section>=I<manext>
|
||||
|
||||
(Writing the short option first is arguably easier to read, since the long
|
||||
option is long enough to draw the eye to it anyway and the short option can
|
||||
otherwise get lost in visual noise.)
|
||||
|
||||
=item RETURN VALUE
|
||||
|
||||
What the program or function returns, if successful. This section can be
|
||||
omitted for programs whose precise exit codes aren't important, provided
|
||||
they return 0 on success as is standard. It should always be present for
|
||||
functions.
|
||||
|
||||
=item ERRORS
|
||||
|
||||
Exceptions, error return codes, exit statuses, and errno settings.
|
||||
Typically used for function documentation; program documentation uses
|
||||
DIAGNOSTICS instead. The general rule of thumb is that errors printed to
|
||||
STDOUT or STDERR and intended for the end user are documented in DIAGNOSTICS
|
||||
while errors passed internal to the calling program and intended for other
|
||||
programmers are documented in ERRORS. When documenting a function that sets
|
||||
errno, a full list of the possible errno values should be given here.
|
||||
|
||||
=item DIAGNOSTICS
|
||||
|
||||
All possible messages the program can print out--and what they mean. You
|
||||
may wish to follow the same documentation style as the Perl documentation;
|
||||
see perldiag(1) for more details (and look at the POD source as well).
|
||||
|
||||
If applicable, please include details on what the user should do to correct
|
||||
the error; documenting an error as indicating "the input buffer is too
|
||||
small" without telling the user how to increase the size of the input buffer
|
||||
(or at least telling them that it isn't possible) aren't very useful.
|
||||
|
||||
=item EXAMPLES
|
||||
|
||||
Give some example uses of the program or function. Don't skimp; users often
|
||||
find this the most useful part of the documentation. The examples are
|
||||
generally given as verbatim paragraphs.
|
||||
|
||||
Don't just present an example without explaining what it does. Adding a
|
||||
short paragraph saying what the example will do can increase the value of
|
||||
the example immensely.
|
||||
|
||||
=item ENVIRONMENT
|
||||
|
||||
Environment variables that the program cares about, normally presented as a
|
||||
list using C<=over>, C<=item>, and C<=back>. For example:
|
||||
|
||||
=over 6
|
||||
|
||||
=item HOME
|
||||
|
||||
Used to determine the user's home directory. F<.foorc> in this
|
||||
directory is read for configuration details, if it exists.
|
||||
|
||||
=back
|
||||
|
||||
Since environment variables are normally in all uppercase, no additional
|
||||
special formatting is generally needed; they're glaring enough as it is.
|
||||
|
||||
=item FILES
|
||||
|
||||
All files used by the program or function, normally presented as a list, and
|
||||
what it uses them for. File names should be enclosed in FE<lt>E<gt>. It's
|
||||
particularly important to document files that will be potentially modified.
|
||||
|
||||
=item CAVEATS
|
||||
|
||||
Things to take special care with, sometimes called WARNINGS.
|
||||
|
||||
=item BUGS
|
||||
|
||||
Things that are broken or just don't work quite right.
|
||||
|
||||
=item RESTRICTIONS
|
||||
|
||||
Bugs you don't plan to fix. :-)
|
||||
|
||||
=item NOTES
|
||||
|
||||
Miscellaneous commentary.
|
||||
|
||||
=item SEE ALSO
|
||||
|
||||
Other man pages to check out, like man(1), man(7), makewhatis(8), or
|
||||
catman(8). Normally a simple list of man pages separated by commas, or a
|
||||
paragraph giving the name of a reference work. Man page references, if they
|
||||
use the standard C<name(section)> form, don't have to be enclosed in
|
||||
LE<lt>E<gt> (although it's recommended), but other things in this section
|
||||
probably should be when appropriate.
|
||||
|
||||
If the package has a mailing list, include a URL or subscription
|
||||
instructions here.
|
||||
|
||||
If the package has a web site, include a URL here.
|
||||
|
||||
=item AUTHOR
|
||||
|
||||
Who wrote it (use AUTHORS for multiple people). Including your current
|
||||
e-mail address (or some e-mail address to which bug reports should be sent)
|
||||
so that users have a way of contacting you is a good idea. Remember that
|
||||
program documentation tends to roam the wild for far longer than you expect
|
||||
and pick an e-mail address that's likely to last if possible.
|
||||
|
||||
=item COPYRIGHT AND LICENSE
|
||||
|
||||
For copyright
|
||||
|
||||
Copyright YEAR(s) by YOUR NAME(s)
|
||||
|
||||
(No, (C) is not needed. No, "all rights reserved" is not needed.)
|
||||
|
||||
For licensing the easiest way is to use the same licensing as Perl itself:
|
||||
|
||||
This library is free software; you may redistribute it and/or modify
|
||||
it under the same terms as Perl itself.
|
||||
|
||||
This makes it easy for people to use your module with Perl. Note that
|
||||
this licensing is neither an endorsement or a requirement, you are of
|
||||
course free to choose any licensing.
|
||||
|
||||
=item HISTORY
|
||||
|
||||
Programs derived from other sources sometimes have this, or you might keep
|
||||
a modification log here. If the log gets overly long or detailed,
|
||||
consider maintaining it in a separate file, though.
|
||||
|
||||
=back
|
||||
|
||||
In addition, some systems use CONFORMING TO to note conformance to relevant
|
||||
standards and MT-LEVEL to note safeness for use in threaded programs or
|
||||
signal handlers. These headings are primarily useful when documenting parts
|
||||
of a C library. Documentation of object-oriented libraries or modules may
|
||||
use CONSTRUCTORS and METHODS sections for detailed documentation of the
|
||||
parts of the library and save the DESCRIPTION section for an overview; other
|
||||
large modules may use FUNCTIONS for similar reasons. Some people use
|
||||
OVERVIEW to summarize the description if it's quite long.
|
||||
|
||||
Section ordering varies, although NAME should I<always> be the first section
|
||||
(you'll break some man page systems otherwise), and NAME, SYNOPSIS,
|
||||
DESCRIPTION, and OPTIONS generally always occur first and in that order if
|
||||
present. In general, SEE ALSO, AUTHOR, and similar material should be left
|
||||
for last. Some systems also move WARNINGS and NOTES to last. The order
|
||||
given above should be reasonable for most purposes.
|
||||
|
||||
Finally, as a general note, try not to use an excessive amount of markup.
|
||||
As documented here and in L<Pod::Man>, you can safely leave Perl variables,
|
||||
function names, man page references, and the like unadorned by markup and
|
||||
the POD translators will figure it out for you. This makes it much easier
|
||||
to later edit the documentation. Note that many existing translators
|
||||
(including this one currently) will do the wrong thing with e-mail addresses
|
||||
or URLs when wrapped in LE<lt>E<gt>, so don't do that.
|
||||
|
||||
For additional information that may be more accurate for your specific
|
||||
system, see either L<man(5)> or L<man(7)> depending on your system manual
|
||||
section numbering conventions.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<Pod::Man>, L<Pod::Parser>, L<man(1)>, L<nroff(1)>, L<podchecker(1)>,
|
||||
L<troff(1)>, L<man(7)>
|
||||
|
||||
The man page documenting the an macro set may be L<man(5)> instead of
|
||||
L<man(7)> on your system.
|
||||
|
||||
The current version of this script is always available from its web site at
|
||||
L<http://www.eyrie.org/~eagle/software/podlators/>. It is also part of the
|
||||
Perl core distribution as of 5.6.0.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Russ Allbery <rra@stanford.edu>, based I<very> heavily on the original
|
||||
B<pod2man> by Larry Wall and Tom Christiansen. Large portions of this
|
||||
documentation, particularly the sections on the anatomy of a proper man
|
||||
page, are taken from the B<pod2man> documentation by Tom.
|
||||
|
||||
=head1 COPYRIGHT AND LICENSE
|
||||
|
||||
Copyright 1999, 2000, 2001 by Russ Allbery <rra@stanford.edu>.
|
||||
|
||||
This program is free software; you may redistribute it and/or modify it
|
||||
under the same terms as Perl itself.
|
||||
|
||||
=cut
|
||||
+3
-1
@@ -67,7 +67,9 @@ The class to create the method in.
|
||||
The name of the method to create. Should not be NULL unless creating
|
||||
constructors or destructors.
|
||||
.AP int isPublic in
|
||||
A boolean flag saying whether the method is to be exported.
|
||||
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 Tcl_MethodType *methodTypePtr in
|
||||
A description of the type of the method to create, or the type of method to
|
||||
compare against.
|
||||
|
||||
+2
-2
@@ -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_Obj 3 8.5 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
@@ -94,7 +94,7 @@ Also, most Tcl values are only read and never modified.
|
||||
This is especially true for procedure arguments,
|
||||
which can be shared between the caller and the called procedure.
|
||||
Assignment and argument binding is done by
|
||||
simply assigning a pointer to the value.
|
||||
simply assigning a pointer to the value.
|
||||
Reference counting is used to determine when it is safe to
|
||||
reclaim a value's storage.
|
||||
.PP
|
||||
|
||||
+13
-13
@@ -115,7 +115,7 @@ Used for error reporting and to look up a channel registered in it.
|
||||
The name of a local or network file.
|
||||
.AP "const char" *mode in
|
||||
Specifies how the file is to be accessed. May have any of the values
|
||||
allowed for the \fImode\fR argument to the Tcl \fBopen\fR command.
|
||||
allowed for the \fImode\fR argument to the Tcl \fBopen\fR command.
|
||||
.AP int permissions in
|
||||
POSIX-style permission flags such as 0644. If a new file is created, these
|
||||
permissions will be set on the created file.
|
||||
@@ -141,7 +141,7 @@ file descriptor, for Windows it is a HANDLE.
|
||||
OR-ed combination of \fBTCL_READABLE\fR and \fBTCL_WRITABLE\fR to indicate
|
||||
what operations are valid on \fIhandle\fR.
|
||||
.AP "const char" *channelName in
|
||||
The name of the channel.
|
||||
The name of the channel.
|
||||
.AP int *modePtr out
|
||||
Points at an integer variable that will receive an OR-ed combination of
|
||||
\fBTCL_READABLE\fR and \fBTCL_WRITABLE\fR denoting whether the channel is
|
||||
@@ -155,8 +155,8 @@ from a procedure such as \fBTcl_OpenFileChannel\fR.
|
||||
A pointer to a Tcl value in which to store the characters read from the
|
||||
channel.
|
||||
.AP int charsToRead in
|
||||
The number of characters to read from the channel. If the channel's encoding
|
||||
is \fBbinary\fR, this is equivalent to the number of bytes to read from the
|
||||
The number of characters to read from the channel. If the channel's encoding
|
||||
is \fBbinary\fR, this is equivalent to the number of bytes to read from the
|
||||
channel.
|
||||
.AP int appendFlag in
|
||||
If non-zero, data read from the channel will be appended to the value.
|
||||
@@ -169,7 +169,7 @@ be large enough to hold this many bytes.
|
||||
.AP Tcl_Obj *lineObjPtr in/out
|
||||
A pointer to a Tcl value in which to store the line read from the
|
||||
channel. The line read will be appended to the current value of the
|
||||
value.
|
||||
value.
|
||||
.AP Tcl_DString *lineRead in/out
|
||||
A pointer to a Tcl dynamic string in which to store the line read from the
|
||||
channel. Must have been initialized by the caller. The line read will be
|
||||
@@ -238,8 +238,8 @@ If an error occurs while opening the channel, \fBTcl_OpenFileChannel\fR
|
||||
returns NULL and records a POSIX error code that can be
|
||||
retrieved with \fBTcl_GetErrno\fR.
|
||||
In addition, if \fIinterp\fR is non-NULL, \fBTcl_OpenFileChannel\fR
|
||||
leaves an error message in \fIinterp\fR's result after any error.
|
||||
As of Tcl 8.4, the value-based API \fBTcl_FSOpenFileChannel\fR should
|
||||
leaves an error message in \fIinterp\fR's result after any error.
|
||||
As of Tcl 8.4, the value-based API \fBTcl_FSOpenFileChannel\fR should
|
||||
be used in preference to \fBTcl_OpenFileChannel\fR wherever possible.
|
||||
.PP
|
||||
The newly created channel is not registered in the supplied interpreter; to
|
||||
@@ -360,7 +360,7 @@ the standard channels (\fBstdout\fR, \fBstderr\fR, \fBstdin\fR), and will return
|
||||
Code not associated with a Tcl interpreter can call
|
||||
\fBTcl_DetachChannel\fR with \fIinterp\fR as NULL, to indicate to Tcl
|
||||
that it no longer holds a reference to that channel. If this is the last
|
||||
reference to the channel, unlike \fBTcl_UnregisterChannel\fR,
|
||||
reference to the channel, unlike \fBTcl_UnregisterChannel\fR,
|
||||
it will not be closed.
|
||||
.SH TCL_ISSTANDARDCHANNEL
|
||||
.PP
|
||||
@@ -368,7 +368,7 @@ it will not be closed.
|
||||
three standard channels, \fBstdin\fR, \fBstdout\fR or \fBstderr\fR.
|
||||
If so, it returns 1, otherwise 0.
|
||||
.PP
|
||||
No attempt is made to check whether the given channel or the standard
|
||||
No attempt is made to check whether the given channel or the standard
|
||||
channels are initialized or otherwise valid.
|
||||
.SH TCL_CLOSE
|
||||
.PP
|
||||
@@ -402,7 +402,7 @@ corresponding calls to \fBTcl_UnregisterChannel\fR.
|
||||
.SH "TCL_READCHARS AND TCL_READ"
|
||||
.PP
|
||||
\fBTcl_ReadChars\fR consumes bytes from \fIchannel\fR, converting the bytes
|
||||
to UTF-8 based on the channel's encoding and storing the produced data in
|
||||
to UTF-8 based on the channel's encoding and storing the produced data in
|
||||
\fIreadObjPtr\fR's string representation. The return value of
|
||||
\fBTcl_ReadChars\fR is the number of characters, up to \fIcharsToRead\fR,
|
||||
that were stored in \fIreadObjPtr\fR. If an error occurs while reading, the
|
||||
@@ -450,7 +450,7 @@ extensions. It consumes bytes from \fIchannel\fR and stores them in
|
||||
of \fBTcl_Read\fR is the number of bytes, up to \fIbytesToRead\fR, written in
|
||||
\fIreadBuf\fR. The buffer produced by \fBTcl_Read\fR is not null-terminated.
|
||||
Its contents are valid from the zeroth position up to and excluding the
|
||||
position indicated by the return value.
|
||||
position indicated by the return value.
|
||||
.PP
|
||||
\fBTcl_ReadRaw\fR is the same as \fBTcl_Read\fR but does not
|
||||
compensate for stacking. While \fBTcl_Read\fR (and the other functions
|
||||
@@ -507,7 +507,7 @@ to be null-terminated and it outputs everything up to the null.
|
||||
.PP
|
||||
Data queued for output may not appear on the output device immediately, due
|
||||
to internal buffering. If the data should appear immediately, call
|
||||
\fBTcl_Flush\fR after the call to \fBTcl_WriteChars\fR, or set the
|
||||
\fBTcl_Flush\fR after the call to \fBTcl_WriteChars\fR, or set the
|
||||
\fB\-buffering\fR option on the channel to \fBnone\fR. If you wish the data
|
||||
to appear as soon as a complete line is accepted for output, set the
|
||||
\fB\-buffering\fR option on the channel to \fBline\fR mode.
|
||||
@@ -525,7 +525,7 @@ channel. This is done even if the channel has no encoding.
|
||||
\fBTcl_WriteObj\fR is similar to \fBTcl_WriteChars\fR except it
|
||||
accepts a Tcl value whose contents will be output to the channel. The
|
||||
UTF-8 characters in \fIwriteObjPtr\fR's string representation are converted
|
||||
to the channel's encoding and queued for output to \fIchannel\fR.
|
||||
to the channel's encoding and queued for output to \fIchannel\fR.
|
||||
As a performance optimization, when writing to a channel with the encoding
|
||||
\fBbinary\fR, UTF-8 characters are not converted as they are written.
|
||||
Instead, the bytes in \fIwriteObjPtr\fR's internal representation as a
|
||||
|
||||
+9
-9
@@ -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_ParseCommand 3 8.3 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
@@ -56,7 +56,7 @@ following \fIstart\fR up to the first null character.
|
||||
.AP int nested in
|
||||
Non-zero means that the script is part of a command substitution so an
|
||||
unquoted close bracket should be treated as a command terminator. If zero,
|
||||
close brackets have no special meaning.
|
||||
close brackets have no special meaning.
|
||||
.AP int append in
|
||||
Non-zero means that \fI*parsePtr\fR already contains valid tokens; the new
|
||||
tokens should be appended to those already present. Zero means that
|
||||
@@ -118,7 +118,7 @@ result, and no information is left at \fI*parsePtr\fR.
|
||||
enclosed in braces such as
|
||||
\fB{hello}\fR or \fB{string \et with \et tabs}\fR
|
||||
from the beginning of its argument \fIstart\fR.
|
||||
The first character of \fIstart\fR must be \fB{\fR.
|
||||
The first character of \fIstart\fR must be \fB{\fR.
|
||||
If the braced string was parsed successfully,
|
||||
\fBTcl_ParseBraces\fR returns \fBTCL_OK\fR,
|
||||
fills in the structure pointed to by \fIparsePtr\fR
|
||||
@@ -134,7 +134,7 @@ and no information is left at \fI*parsePtr\fR or \fI*termPtr\fR.
|
||||
\fBTcl_ParseQuotedString\fR parses a double-quoted string such as
|
||||
\fB"sum is [expr {$a+$b}]"\fR
|
||||
from the beginning of the argument \fIstart\fR.
|
||||
The first character of \fIstart\fR must be \fB\N'34'\fR.
|
||||
The first character of \fIstart\fR must be \fB\N'34'\fR.
|
||||
If the double-quoted string was parsed successfully,
|
||||
\fBTcl_ParseQuotedString\fR returns \fBTCL_OK\fR,
|
||||
fills in the structure pointed to by \fIparsePtr\fR
|
||||
@@ -150,7 +150,7 @@ and no information is left at \fI*parsePtr\fR or \fI*termPtr\fR.
|
||||
\fBTcl_ParseVarName\fR parses a Tcl variable reference such as
|
||||
\fB$abc\fR or \fB$x([expr {$index + 1}])\fR from the beginning of its
|
||||
\fIstart\fR argument.
|
||||
The first character of \fIstart\fR must be \fB$\fR.
|
||||
The first character of \fIstart\fR must be \fB$\fR.
|
||||
If a variable name was parsed successfully, \fBTcl_ParseVarName\fR
|
||||
returns \fBTCL_OK\fR and fills in the structure pointed to by
|
||||
\fIparsePtr\fR with information about the structure of the variable name
|
||||
@@ -184,7 +184,7 @@ a Tcl_Parse structure. The tokens typically consist
|
||||
of all the tokens in a word or all the tokens that make up the index for
|
||||
a reference to an array variable. \fBTcl_EvalTokensStandard\fR performs the
|
||||
substitutions requested by the tokens and concatenates the
|
||||
resulting values.
|
||||
resulting values.
|
||||
The return value from \fBTcl_EvalTokensStandard\fR is a Tcl completion
|
||||
code with one of the values \fBTCL_OK\fR, \fBTCL_ERROR\fR,
|
||||
\fBTCL_RETURN\fR, \fBTCL_BREAK\fR, or \fBTCL_CONTINUE\fR, or possibly
|
||||
@@ -242,7 +242,7 @@ character that terminates the last comment.
|
||||
If the command is not preceded by any comments, \fIcommentSize\fR is 0.
|
||||
\fBTcl_ParseCommand\fR also sets the \fIcommandStart\fR field
|
||||
to point to the first character of the first
|
||||
word in the command (skipping any comments and leading space) and
|
||||
word in the command (skipping any comments and leading space) and
|
||||
\fIcommandSize\fR gives the total number of bytes in the command,
|
||||
including the character pointed to by \fIcommandStart\fR up to and
|
||||
including the newline, close bracket, or semicolon character that
|
||||
@@ -350,7 +350,7 @@ just the \fBTCL_TOKEN_OPERATOR\fR token.
|
||||
Each operand is described by a \fBTCL_TOKEN_SUB_EXPR\fR token.
|
||||
Otherwise, the subexpression is a value described by
|
||||
one of the token types \fBTCL_TOKEN_WORD\fR, \fBTCL_TOKEN_TEXT\fR,
|
||||
\fBTCL_TOKEN_BS\fR, \fBTCL_TOKEN_COMMAND\fR,
|
||||
\fBTCL_TOKEN_BS\fR, \fBTCL_TOKEN_COMMAND\fR,
|
||||
\fBTCL_TOKEN_VARIABLE\fR, and \fBTCL_TOKEN_SUB_EXPR\fR.
|
||||
The \fInumComponents\fR field
|
||||
counts the total number of sub-tokens that make up the subexpression;
|
||||
@@ -389,7 +389,7 @@ is always 0.
|
||||
After \fBTcl_ParseCommand\fR returns, the first token pointed to by
|
||||
the \fItokenPtr\fR field of the
|
||||
Tcl_Parse structure always has type \fBTCL_TOKEN_WORD\fR or
|
||||
\fBTCL_TOKEN_SIMPLE_WORD\fR or \fBTCL_TOKEN_EXPAND_WORD\fR.
|
||||
\fBTCL_TOKEN_SIMPLE_WORD\fR or \fBTCL_TOKEN_EXPAND_WORD\fR.
|
||||
It is followed by the sub-tokens
|
||||
that must be concatenated to produce the value of that word.
|
||||
The next token is the \fBTCL_TOKEN_WORD\fR or \fBTCL_TOKEN_SIMPLE_WORD\fR
|
||||
|
||||
+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_StringObj 3 8.1 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
@@ -308,7 +308,7 @@ sprintf(buf, format, ...);
|
||||
\fBTcl_NewStringObj\fR(buf, -1);
|
||||
.CE
|
||||
.PP
|
||||
but with greater convenience and no need to
|
||||
but with greater convenience and no need to
|
||||
determine \fBSOME_SUITABLE_LENGTH\fR. The formatting is done with the same
|
||||
core formatting engine used by \fBTcl_Format\fR. This means the set of
|
||||
supported conversion specifiers is that of the \fBformat\fR command and
|
||||
@@ -329,8 +329,8 @@ Tcl_Obj *objPtr = \fBTcl_ObjPrintf\fR("Value is %d", x);
|
||||
.PP
|
||||
If the value of \fIformat\fR contains internal inconsistencies or invalid
|
||||
specifier formats, the formatted string result produced by
|
||||
\fBTcl_ObjPrintf\fR will be an error message describing the error.
|
||||
It is impossible however to provide runtime protection against
|
||||
\fBTcl_ObjPrintf\fR will be an error message describing the error.
|
||||
It is impossible however to provide runtime protection against
|
||||
mismatches between the format and any subsequent arguments.
|
||||
Compile-time protection may be provided by some compilers.
|
||||
.PP
|
||||
|
||||
+6
-5
@@ -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 Threads 3 "8.1" Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
@@ -79,9 +79,10 @@ waited upon into it.
|
||||
.SH INTRODUCTION
|
||||
Beginning with the 8.1 release, the Tcl core is thread safe, which
|
||||
allows you to incorporate Tcl into multithreaded applications without
|
||||
customizing the Tcl core. To enable Tcl multithreading support,
|
||||
you must include the \fB\-\|\-enable-threads\fR option to \fBconfigure\fR
|
||||
when you configure and compile your Tcl core.
|
||||
customizing the Tcl core. Starting with the 8.6 release, Tcl
|
||||
multithreading support is on by default. To disable Tcl multithreading
|
||||
support, you must include the \fB\-\|\-disable-threads\fR option to
|
||||
\fBconfigure\fR when you configure and compile your Tcl core.
|
||||
.PP
|
||||
An important constraint of the Tcl threads implementation is that
|
||||
\fIonly the thread that created a Tcl interpreter can use that
|
||||
@@ -126,7 +127,7 @@ will cause a memory leak.
|
||||
.PP
|
||||
The \fBTcl_GetThreadData\fR call returns a pointer to a block of
|
||||
thread-private data. Its argument is a key that is shared by all threads
|
||||
and a size for the block of storage. The storage is automatically
|
||||
and a size for the block of storage. The storage is automatically
|
||||
allocated and initialized to all zeros the first time each thread asks for it.
|
||||
The storage is automatically deallocated by \fBTcl_FinalizeThread\fR.
|
||||
.SS "SYNCHRONIZATION AND COMMUNICATION"
|
||||
|
||||
+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_UtfToUpper 3 "8.1" Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
|
||||
+11
-24
@@ -78,7 +78,7 @@ created. \fIClientData\fR typically points to an application-specific
|
||||
data structure that describes what to do when \fIproc\fR is invoked.
|
||||
\fIOldName\fR gives the name of the command being renamed, and
|
||||
\fInewName\fR gives the name that the command is being renamed to (or
|
||||
an empty string or NULL when the command is being deleted.)
|
||||
NULL when the command is being deleted.)
|
||||
\fIFlags\fR is an OR'ed combination of bits potentially providing
|
||||
several pieces of information. One of the bits \fBTCL_TRACE_RENAME\fR and
|
||||
\fBTCL_TRACE_DELETE\fR will be set in \fIflags\fR to indicate which
|
||||
@@ -86,11 +86,14 @@ operation is being performed on the command. The bit
|
||||
\fBTCL_TRACE_DESTROYED\fR will be set in \fIflags\fR if the trace is about
|
||||
to be destroyed; this information may be useful to \fIproc\fR so that
|
||||
it can clean up its own internal data structures (see the section
|
||||
\fBTCL_TRACE_DESTROYED\fR below for more details). Lastly, the bit
|
||||
\fBTCL_INTERP_DESTROYED\fR will be set if the entire interpreter is being
|
||||
destroyed. When this bit is set, \fIproc\fR must be especially
|
||||
careful in the things it does (see the section \fBTCL_INTERP_DESTROYED\fR
|
||||
below).
|
||||
\fBTCL_TRACE_DESTROYED\fR below for more details). Because the
|
||||
deletion of commands can take place as part of the deletion of the interp
|
||||
that contains them, \fIproc\fR must be careful about checking what
|
||||
the passed in \fIinterp\fR value can be called upon to do.
|
||||
The routine \fBTcl_InterpDeleted\fR is an important tool for this.
|
||||
When \fBTcl_InterpDeleted\fR returns 1, \fIproc\fR will not be able
|
||||
to invoke any scripts in \fIinterp\fR. The function of \fIproc\fR
|
||||
in that circumstance is limited to the cleanup of its own data structures.
|
||||
.PP
|
||||
\fBTcl_UntraceCommand\fR may be used to remove a trace. If the
|
||||
command specified by \fIinterp\fR, \fIcmdName\fR, and \fIflags\fR has
|
||||
@@ -123,7 +126,8 @@ traces for a given command that have the same \fIproc\fR.
|
||||
.PP
|
||||
During rename traces, the command being renamed is visible with both
|
||||
names simultaneously, and the command still exists during delete
|
||||
traces (if \fBTCL_INTERP_DESTROYED\fR is not set). However, there is no
|
||||
traces, unless the interp that contains it is being deleted.
|
||||
However, there is no
|
||||
mechanism for signaling that an error occurred in a trace procedure,
|
||||
so great care should be taken that errors do not get silently lost.
|
||||
.SH "MULTIPLE TRACES"
|
||||
@@ -142,22 +146,5 @@ rename the command, the last renaming takes precedence.
|
||||
In a delete callback to \fIproc\fR, the \fBTCL_TRACE_DESTROYED\fR bit
|
||||
is set in \fIflags\fR.
|
||||
.\" Perhaps need some more comments here? - DKF
|
||||
.SH "TCL_INTERP_DESTROYED"
|
||||
.PP
|
||||
When an interpreter is destroyed, unset traces are called for
|
||||
all of its commands.
|
||||
The \fBTCL_INTERP_DESTROYED\fR bit will be set in the \fIflags\fR
|
||||
argument passed to the trace procedures.
|
||||
Trace procedures must be extremely careful in what they do if
|
||||
the \fBTCL_INTERP_DESTROYED\fR bit is set.
|
||||
It is not safe for the procedures to invoke any Tcl procedures
|
||||
on the interpreter, since its state is partially deleted.
|
||||
All that trace procedures should do under these circumstances is
|
||||
to clean up and free their own internal data structures.
|
||||
.SH BUGS
|
||||
.PP
|
||||
Tcl does not do any error checking to prevent trace procedures
|
||||
from misusing the interpreter during traces with \fBTCL_INTERP_DESTROYED\fR
|
||||
set.
|
||||
.SH KEYWORDS
|
||||
clientData, trace, command
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution
|
||||
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
'\"
|
||||
'\"
|
||||
.TH Utf 3 "8.1" Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
.SH NAME
|
||||
Tcl_UniChar, Tcl_UniCharCaseMatch, Tcl_UniCharNcasecmp, Tcl_UniCharToUtf, Tcl_UtfToUniChar, Tcl_UniCharToUtfDString, Tcl_UtfToUniCharDString, Tcl_UniCharLen, Tcl_UniCharNcmp, Tcl_UtfCharComplete, Tcl_NumUtfChars, Tcl_UtfFindFirst, Tcl_UtfFindLast, Tcl_UtfNext, Tcl_UtfPrev, Tcl_UniCharAtIndex, Tcl_UtfAtIndex, Tcl_UtfBackslash \- routines for manipulating UTF-8 strings
|
||||
Tcl_UniChar, Tcl_UniCharToUtf, Tcl_UtfToUniChar, Tcl_UniCharToUtfDString, Tcl_UtfToUniCharDString, Tcl_UniCharLen, Tcl_UniCharNcmp, Tcl_UniCharNcasecmp, Tcl_UniCharCaseMatch, Tcl_UtfNcmp, Tcl_UtfNcasecmp, Tcl_UtfCharComplete, Tcl_NumUtfChars, Tcl_UtfFindFirst, Tcl_UtfFindLast, Tcl_UtfNext, Tcl_UtfPrev, Tcl_UniCharAtIndex, Tcl_UtfAtIndex, Tcl_UtfBackslash \- routines for manipulating UTF-8 strings
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
\fB#include <tcl.h>\fR
|
||||
@@ -48,7 +48,7 @@ int
|
||||
int
|
||||
\fBTcl_UtfCharComplete\fR(\fIsrc, length\fR)
|
||||
.sp
|
||||
int
|
||||
int
|
||||
\fBTcl_NumUtfChars\fR(\fIsrc, length\fR)
|
||||
.sp
|
||||
const char *
|
||||
@@ -109,7 +109,7 @@ Pointer to the beginning of a UTF-8 string.
|
||||
.AP int index in
|
||||
The index of a character (not byte) in the UTF-8 string.
|
||||
.AP int *readPtr out
|
||||
If non-NULL, filled with the number of bytes in the backslash sequence,
|
||||
If non-NULL, filled with the number of bytes in the backslash sequence,
|
||||
including the backslash character.
|
||||
.AP char *dst out
|
||||
Buffer in which the bytes represented by the backslash sequence are stored.
|
||||
@@ -142,7 +142,7 @@ 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
|
||||
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.
|
||||
0x00ff and return 1.
|
||||
.PP
|
||||
\fBTcl_UniCharToUtfDString\fR converts the given Unicode string
|
||||
to UTF-8, storing the result in a previously initialized \fBTcl_DString\fR.
|
||||
@@ -210,12 +210,12 @@ length is negative, all bytes up to the first null byte are used.
|
||||
\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
|
||||
in the null-terminated UTF-8 string \fIsrc\fR. The null terminator is
|
||||
considered part of the UTF-8 string.
|
||||
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
|
||||
in the null-terminated UTF-8 string \fIsrc\fR. The null terminator is
|
||||
considered part of the UTF-8 string.
|
||||
considered part of the UTF-8 string.
|
||||
.PP
|
||||
Given \fIsrc\fR, a pointer to some location in a UTF-8 string,
|
||||
\fBTcl_UtfNext\fR returns a pointer to the next UTF-8 character in the
|
||||
@@ -239,7 +239,7 @@ characters. Behavior is undefined if a negative \fIindex\fR is given.
|
||||
.PP
|
||||
\fBTcl_UtfAtIndex\fR returns a pointer to the specified character (not
|
||||
byte) \fIindex\fR in the UTF-8 string \fIsrc\fR. The source string must
|
||||
contain at least \fIindex\fR characters. This is equivalent to calling
|
||||
contain at least \fIindex\fR characters. This is equivalent to calling
|
||||
\fBTcl_UtfNext\fR \fIindex\fR times. If a negative \fIindex\fR is given,
|
||||
the return pointer points to the first character in the source string.
|
||||
.PP
|
||||
|
||||
+13
-13
@@ -16,13 +16,13 @@ package require \fBTcl 8.5\fR
|
||||
.sp
|
||||
\fBclock format\fR \fItimeVal\fR ?\fI\-option value\fR...?
|
||||
.sp
|
||||
\fBclock microseconds\fR
|
||||
\fBclock microseconds\fR
|
||||
.sp
|
||||
\fBclock milliseconds\fR
|
||||
\fBclock milliseconds\fR
|
||||
.sp
|
||||
\fBclock scan\fR \fIinputString\fR ?\fI\-option value\fR...?
|
||||
.sp
|
||||
\fBclock seconds\fR
|
||||
\fBclock seconds\fR
|
||||
.sp
|
||||
.BE
|
||||
.SH "DESCRIPTION"
|
||||
@@ -58,10 +58,10 @@ Formats a time that is expressed as an integer number of seconds into a format
|
||||
intended for consumption by users or external programs.
|
||||
See \fBFORMATTING TIMES\fR for a full description.
|
||||
.TP
|
||||
\fBclock microseconds\fR
|
||||
\fBclock microseconds\fR
|
||||
Returns the current time as an integer number of microseconds. See \fBHIGH RESOLUTION TIMERS\fR for a full description.
|
||||
.TP
|
||||
\fBclock milliseconds\fR
|
||||
\fBclock milliseconds\fR
|
||||
Returns the current time as an integer number of milliseconds. See \fBHIGH RESOLUTION TIMERS\fR for a full description.
|
||||
.TP
|
||||
\fBclock scan\fR \fIinputString\fR ?\fI\-option value\fR...?
|
||||
@@ -69,7 +69,7 @@ Scans a time that is expressed as a character string and produces an
|
||||
integer number of seconds.
|
||||
See \fBSCANNING TIMES\fR for a full description.
|
||||
.TP
|
||||
\fBclock seconds\fR
|
||||
\fBclock seconds\fR
|
||||
Returns the current time as an integer number of seconds.
|
||||
.SS "PARAMETERS"
|
||||
.TP
|
||||
@@ -113,7 +113,7 @@ and their interpretation, are described under \fBFORMAT GROUPS\fR.
|
||||
On \fBclock format\fR, the default format is
|
||||
.PP
|
||||
.CS
|
||||
%a %b %d %H:%M:%S %z %Y
|
||||
%a %b %d %H:%M:%S %Z %Y
|
||||
.CE
|
||||
.PP
|
||||
On \fBclock scan\fR, the lack of a \fB\-format\fR option indicates that a
|
||||
@@ -525,7 +525,7 @@ string of the same meaning in the locale, to indicate whether \fB%Y\fR refers
|
||||
to years before or after Year 1 of the Common Era. On input, accepts
|
||||
the string \fBB.C.E.\fR, \fBB.C.\fR, \fBC.E.\fR, \fBA.D.\fR, or the
|
||||
abbreviation appropriate to the current locale, and uses it to fix
|
||||
whether \fB%Y\fR refers to years before or after Year 1 of the
|
||||
whether \fB%Y\fR refers to years before or after Year 1 of the
|
||||
Common Era.
|
||||
.TP
|
||||
\fB%Ex\fR
|
||||
@@ -684,8 +684,8 @@ ISO8601 week number.
|
||||
\fB%w\fR
|
||||
On output, produces the ordinal number of the day of the week
|
||||
(Sunday==0; Saturday==6). On input, accepts a single digit and
|
||||
interprets it as the day of the week; Sunday may be represented as
|
||||
either 0 or 7. Note that \fB%w\fR is not the ISO8601 weekday number,
|
||||
interprets it as the day of the week; Sunday may be represented as
|
||||
either 0 or 7. Note that \fB%w\fR is not the ISO8601 weekday number,
|
||||
which is produced and accepted by \fB%u\fR.
|
||||
.TP
|
||||
\fB%W\fR
|
||||
@@ -765,7 +765,7 @@ The local time zone from the Control Panel on Windows systems.
|
||||
The C library's idea of the local time zone, as defined by the
|
||||
\fBmktime\fR and \fBlocaltime\fR functions.
|
||||
.PP
|
||||
In case [1] \fIonly,\fR the string is tested to see if it is one
|
||||
In case [1] \fIonly,\fR the string is tested to see if it is one
|
||||
of the strings:
|
||||
.PP
|
||||
.CS
|
||||
@@ -783,7 +783,7 @@ of the strings:
|
||||
If it is a string in the above list, it designates a known
|
||||
time zone, and is interpreted as such.
|
||||
.PP
|
||||
For time zones in case [1] that do not match any of the above strings,
|
||||
For time zones in case [1] that do not match any of the above strings,
|
||||
and always for cases [2]-[6], the following rules apply.
|
||||
.PP
|
||||
If the time zone begins with a colon, it is one of a
|
||||
@@ -909,7 +909,7 @@ giving an explicit \fB\-format\fR option to the \fBclock scan\fR command.
|
||||
.TP
|
||||
\fIrelative time\fR
|
||||
A specification relative to the current time. The format is \fBnumber
|
||||
unit\fR. Acceptable units are \fByear\fR, \fBfortnight\fR,
|
||||
unit\fR. Acceptable units are \fByear\fR, \fBfortnight\fR,
|
||||
\fBmonth\fR, \fBweek\fR, \fBday\fR,
|
||||
\fBhour\fR, \fBminute\fR (or \fBmin\fR), and \fBsecond\fR (or \fBsec\fR). The
|
||||
unit can be specified as a singular or plural, as in \fB3 weeks\fR.
|
||||
|
||||
+1
-66
@@ -269,17 +269,13 @@ present, as is done when launching applications under wish. It is desirable
|
||||
to have console applications hidden and detached. This is a designed-in
|
||||
limitation as \fBexec\fR wants to communicate over pipes. The Expect
|
||||
extension addresses this issue when communicating with a TUI application.
|
||||
.RE
|
||||
.TP
|
||||
\fBWindows NT\fR
|
||||
.
|
||||
.PP
|
||||
When attempting to execute an application, \fBexec\fR first searches for
|
||||
the name as it was specified. Then, in order, \fB.com\fR, \fB.exe\fR, and
|
||||
\fB.bat\fR are appended to the end of the specified name and it searches
|
||||
for the longer name. If a directory name was not specified as part of the
|
||||
application name, the following directories are automatically searched in
|
||||
order when attempting to locate the application:
|
||||
.RS
|
||||
.IP \(bu 3
|
||||
The directory from which the Tcl executable was loaded.
|
||||
.IP \(bu 3
|
||||
@@ -299,67 +295,6 @@ the caller must prepend the desired command with
|
||||
because built-in commands are not implemented using executables.
|
||||
.RE
|
||||
.TP
|
||||
\fBWindows 9x\fR
|
||||
.
|
||||
When attempting to execute an application, \fBexec\fR first searches for
|
||||
the name as it was specified. Then, in order, \fB.com\fR, \fB.exe\fR, and
|
||||
\fB.bat\fR are appended to the end of the specified name and it searches
|
||||
for the longer name. If a directory name was not specified as part of the
|
||||
application name, the following directories are automatically searched in
|
||||
order when attempting to locate the application:
|
||||
.RS
|
||||
.IP \(bu 3
|
||||
The directory from which the Tcl executable was loaded.
|
||||
.IP \(bu 3
|
||||
The current directory.
|
||||
.IP \(bu 3
|
||||
The Windows 9x system directory.
|
||||
.IP \(bu 3
|
||||
The Windows 9x home directory.
|
||||
.IP \(bu 3
|
||||
The directories listed in the path.
|
||||
.RE
|
||||
.RS
|
||||
.PP
|
||||
In order to execute shell built-in commands like \fBdir\fR and \fBcopy\fR,
|
||||
the caller must prepend the desired command with
|
||||
.QW "\fBcommand.com /c\0\fR"
|
||||
because built-in commands are not implemented using executables.
|
||||
.PP
|
||||
Once a 16-bit DOS application has read standard input from a console and
|
||||
then quit, all subsequently run 16-bit DOS applications will see the
|
||||
standard input as already closed. 32-bit applications do not have this
|
||||
problem and will run correctly, even after a 16-bit DOS application thinks
|
||||
that standard input is closed. There is no known workaround for this bug
|
||||
at this time.
|
||||
.PP
|
||||
Redirection between the \fBNUL:\fR device and a 16-bit application does not
|
||||
always work. When redirecting from \fBNUL:\fR, some applications may hang,
|
||||
others will get an infinite stream of
|
||||
.QW 0x01
|
||||
bytes, and some will actually
|
||||
correctly get an immediate end-of-file; the behavior seems to depend upon
|
||||
something compiled into the application itself. When redirecting greater than
|
||||
4K or so to \fBNUL:\fR, some applications will hang. The above problems do not
|
||||
happen with 32-bit applications.
|
||||
.PP
|
||||
All DOS 16-bit applications are run synchronously. All standard input from
|
||||
a pipe to a 16-bit DOS application is collected into a temporary file; the
|
||||
other end of the pipe must be closed before the 16-bit DOS application
|
||||
begins executing. All standard output or error from a 16-bit DOS
|
||||
application to a pipe is collected into temporary files; the application
|
||||
must terminate before the temporary files are redirected to the next stage
|
||||
of the pipeline. This is due to a workaround for a Windows 95 bug in the
|
||||
implementation of pipes, and is how the standard Windows 95 DOS shell
|
||||
handles pipes itself.
|
||||
.PP
|
||||
Certain applications, such as \fBcommand.com\fR, should not be executed
|
||||
interactively. Applications which directly access the console window,
|
||||
rather than reading from their standard input and writing to their standard
|
||||
output may fail, hang Tcl, or even hang the system if their own private
|
||||
console window is not available to them.
|
||||
.RE
|
||||
.TP
|
||||
\fBUnix\fR (including Mac OS X)
|
||||
.
|
||||
The \fBexec\fR command is fully functional and works as described.
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ proc main {} {
|
||||
|
||||
if {[catch {main} msg options]} {
|
||||
puts stderr "unexpected script error: $msg"
|
||||
if {[info exist env(DEBUG)]} {
|
||||
if {[info exists env(DEBUG)]} {
|
||||
puts stderr "---- BEGIN TRACE ----"
|
||||
puts stderr [dict get $options -errorinfo]
|
||||
puts stderr "---- END TRACE ----"
|
||||
|
||||
+9
-11
@@ -23,7 +23,7 @@ substitution is done before executing the command (see the manual entry for
|
||||
file name. Any unique abbreviation for \fIoption\fR is acceptable. The
|
||||
valid options are:
|
||||
.TP
|
||||
\fBfile atime \fIname\fR ?\fBtime\fR?
|
||||
\fBfile atime \fIname\fR ?\fItime\fR?
|
||||
.
|
||||
Returns a decimal string giving the time at which file \fIname\fR was last
|
||||
accessed. If \fItime\fR is specified, it is an access time to set
|
||||
@@ -34,9 +34,9 @@ generated. On Windows, FAT file systems do not support access time.
|
||||
.TP
|
||||
\fBfile attributes \fIname\fR
|
||||
.TP
|
||||
\fBfile attributes \fIname\fR ?\fBoption\fR?
|
||||
\fBfile attributes \fIname\fR ?\fIoption\fR?
|
||||
.TP
|
||||
\fBfile attributes \fIname\fR ?\fBoption value option value...\fR?
|
||||
\fBfile attributes \fIname\fR ?\fIoption value option value...\fR?
|
||||
.
|
||||
This subcommand returns or sets platform specific values associated
|
||||
with a file. The first form returns a list of the platform specific
|
||||
@@ -80,7 +80,7 @@ set to the value 0, which results in the resource fork being stripped
|
||||
off the file.
|
||||
.RE
|
||||
.TP
|
||||
\fBfile channels ?\fIpattern\fR?
|
||||
\fBfile channels\fR ?\fIpattern\fR?
|
||||
.
|
||||
If \fIpattern\fR is not specified, returns a list of names of all
|
||||
registered open channels in this interpreter. If \fIpattern\fR is
|
||||
@@ -203,7 +203,7 @@ is always canonical for the current platform: \fB/\fR for Unix and
|
||||
Windows.
|
||||
.RE
|
||||
.TP
|
||||
\fBfile link ?\fI\-linktype\fR? \fIlinkName\fR ?\fItarget\fR?
|
||||
\fBfile link\fR ?\fI\-linktype\fR? \fIlinkName\fR ?\fItarget\fR?
|
||||
.
|
||||
If only one argument is given, that argument is assumed to be
|
||||
\fIlinkName\fR, and this command returns the value of the link given by
|
||||
@@ -241,11 +241,9 @@ as relative to the cwd). Furthermore,
|
||||
paths are always expanded
|
||||
to absolute form. When creating links on filesystems that either do not
|
||||
support any links, or do not support the specific type requested, an
|
||||
error message will be returned. In particular Windows 95, 98 and ME do
|
||||
not support any links at present, but most Unix platforms support both
|
||||
symbolic and hard links (the latter for files only) and Windows
|
||||
NT/2000/XP (on NTFS drives) support symbolic
|
||||
directory links and hard file links.
|
||||
error message will be returned. Most Unix platforms support both
|
||||
symbolic and hard links (the latter for files only). Windows
|
||||
supports symbolic directory links and hard file links on NTFS drives.
|
||||
.RE
|
||||
.TP
|
||||
\fBfile lstat \fIname varName\fR
|
||||
@@ -257,7 +255,7 @@ is for the link rather than the file it refers to. On systems that
|
||||
do not support symbolic links this option behaves exactly the same
|
||||
as the \fBstat\fR option.
|
||||
.TP
|
||||
\fBfile mkdir ?\fIdir\fR ...?
|
||||
\fBfile mkdir\fR ?\fIdir\fR ...?
|
||||
.
|
||||
Creates each directory specified. For each pathname \fIdir\fR specified,
|
||||
this command will create all non-existing parent directories as
|
||||
|
||||
@@ -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 for n "" Tcl "Tcl Built-In Commands"
|
||||
.so man.macros
|
||||
.BS
|
||||
@@ -49,7 +49,7 @@ each loop iteration), so changes in the variables will be visible.
|
||||
See below for an example:
|
||||
.SH EXAMPLES
|
||||
.PP
|
||||
Print a line for each of the integers from 0 to 10:
|
||||
Print a line for each of the integers from 0 to 9:
|
||||
.PP
|
||||
.CS
|
||||
\fBfor\fR {set x 0} {$x<10} {incr x} {
|
||||
|
||||
+1
-7
@@ -204,13 +204,7 @@ of the form
|
||||
it refers to the home
|
||||
directory of the user whose account information resides on the specified NT
|
||||
domain server. Otherwise, user account information is obtained from
|
||||
the local computer. On Windows 95 and 98, \fBglob\fR accepted patterns
|
||||
like
|
||||
.QW .../
|
||||
and
|
||||
.QW ..../
|
||||
for successively higher up parent directories, but later versions of
|
||||
Windows do not accept these forms.
|
||||
the local computer.
|
||||
.PP
|
||||
Since the backslash character has a special meaning to the glob
|
||||
command, glob patterns containing Windows style path separators need
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
[Fri Sep 22 16:07:30 PDT 2006]
|
||||
|
||||
The problem is pass by reference vs value. There isn't a nice way to do it
|
||||
like C so we're inventing a different way, trying to keep it readable.
|
||||
|
||||
proc tcl_ref {setme} {
|
||||
upvar $setme ptr
|
||||
set ptr "some string"
|
||||
}
|
||||
|
||||
/*
|
||||
* how this works is that the compiler sees the &setme and generates code like:
|
||||
* upvar ${&setme} setme
|
||||
*/
|
||||
void
|
||||
L_ref(string &setme)
|
||||
{
|
||||
setme = "some string";
|
||||
}
|
||||
|
||||
It does mean that if I want to call gets() from L I need to do
|
||||
|
||||
while (gets(fd, &buf) > 0) {
|
||||
...
|
||||
}
|
||||
|
||||
which isn't very C like. That's OK, L isn't C because strings are first
|
||||
class in L and they aren't in C. Oscar wacked that into my head. Slowly.
|
||||
|
||||
The next issue is compound types like arrays / hashes. I want those to be
|
||||
implicit references, like C. So no &my_array in args, it's just my_array.
|
||||
|
||||
/*
|
||||
* as above, the compiler sees foo[] and subs in &foo as the parameter
|
||||
* and does the upvar ${&foo} foo
|
||||
*/
|
||||
void
|
||||
L_array_ref(int foo[])
|
||||
{
|
||||
foo[3] = 3;
|
||||
}
|
||||
|
||||
/*
|
||||
* as above, the compiler sees foo{} and does the code like
|
||||
* upvar $foo 0foo
|
||||
*
|
||||
* Note also the new full specified syntax for a hash declaration.
|
||||
* The following are the same thing and for 1.0 we implement the
|
||||
* first one only. But the second form allows us to have var/poly/int
|
||||
* etc. as keys or indices. The syntax is "value" varname{"key"} where
|
||||
* value is the type of the value and key is the type of the key. Nifty.
|
||||
* hash foo{};
|
||||
* string foo{string};
|
||||
*
|
||||
* For 1.0 this is just
|
||||
* L_hash_ref(hash foo)
|
||||
* and I do want to insist on the {} in declarations (args and formal) because
|
||||
* it gets people used to the foo{"string"} syntax.
|
||||
*/
|
||||
void
|
||||
L_hash_ref(string foo{string})
|
||||
{
|
||||
int mine{};
|
||||
|
||||
foo{"some key"} = "some value";
|
||||
}
|
||||
|
||||
A calling wrinkle.
|
||||
|
||||
When calling an L function/tcl proc which expects a reference, i.e.,
|
||||
func(string &buf) or proc foo {bufname} { upvar $bufname buf ... },
|
||||
from an L context, there is a question as to whether or not the
|
||||
L variable needs a leading &. And the answer is: depends on what you
|
||||
want. All the leading ampersand does is to push the name of the
|
||||
variable on the stack instead of the value of the variable (w/ all
|
||||
the COW semantics). So consider this
|
||||
|
||||
void
|
||||
stomp(string &buf)
|
||||
{
|
||||
buf = "stomped";
|
||||
}
|
||||
|
||||
void
|
||||
L_caller()
|
||||
{
|
||||
string foo = "bar";
|
||||
string fooname = "foo";
|
||||
|
||||
if (what_I_would_expect) {
|
||||
stomp(&foo); // foo will get "stomped"
|
||||
} else {
|
||||
stomp(fooname); // foo will get "stomped" this way too
|
||||
}
|
||||
}
|
||||
|
||||
The stomp(fooname) could work but we should disallow it in L 1.0 - we
|
||||
can allow it in the future. Tim points out that we can throw a syntax
|
||||
error for L calling L and the type mismatch but not for L calling tcl,
|
||||
i.e., calling gets, unless we have some sort of extern int gets(FILE fd,
|
||||
string &buf) that we use to load the function signature table (what is
|
||||
that called?)
|
||||
|
||||
Tcl calling L
|
||||
|
||||
Suppose we had an L procedure that implemented puts, maybe it's written
|
||||
in C, but it would be declared like
|
||||
|
||||
void
|
||||
L_puts(string stuff_to_print[])
|
||||
{
|
||||
print it
|
||||
}
|
||||
|
||||
If we are in tcl and we do
|
||||
|
||||
set stuff [list a b c]
|
||||
|
||||
and we want to print it it would look like
|
||||
|
||||
puts $stuff
|
||||
|
||||
but if we're calling L that won't work, it should be an arg miss match because
|
||||
|
||||
L_puts $stuff
|
||||
|
||||
is like calling
|
||||
|
||||
L_puts("a", "b", "c")
|
||||
|
||||
and L_puts wants a single arg.
|
||||
|
||||
We get around this by noting that L implements pass by reference by passing
|
||||
by name and doing an upvar so the calling syntax is:
|
||||
|
||||
L_puts stuff
|
||||
|
||||
Kind of annoying but that's a ramification of the impedance mismatch between
|
||||
L and tcl. If you want to make breakfast you have to break some eggs.
|
||||
|
||||
============================================================================
|
||||
|
||||
Structs
|
||||
|
||||
struct foo {
|
||||
int a; /* I am A */
|
||||
string b; /* oh, love those strings */
|
||||
}
|
||||
|
||||
results in the creation of a list in ::L like
|
||||
|
||||
# Note the offset into the list is the index into the struct "list"
|
||||
set ::L::{struct foo} [list \
|
||||
[list int a {I am A}] \
|
||||
[list string b {oh, love those strings}] \
|
||||
]
|
||||
|
||||
and now I can pass a struct to tcl just like an other COW thingy and I
|
||||
can make a little struct command that gets me fields, sets them, does
|
||||
introspection, etc.
|
||||
|
||||
And the cool thing is L can do the introspection which means I can write
|
||||
my little preferences struct and call some wacky code that takes the
|
||||
struct and con's up the code to make a preference dialogue.
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
struct node {
|
||||
double i;
|
||||
};
|
||||
|
||||
struct node tree[100000];
|
||||
|
||||
int
|
||||
insert(int node, struct node element)
|
||||
{
|
||||
/* using Tcl's {} as NULL */
|
||||
if (tree[node] == "{}") {
|
||||
tree[node] = element;
|
||||
} else if (tree[node].i > element.i) {
|
||||
insert(2*node+1, element);
|
||||
} else {
|
||||
insert(2*node+2, element);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
print(int node)
|
||||
{
|
||||
if (tree[node] == "{}") {
|
||||
return;
|
||||
}
|
||||
print(2*node+1);
|
||||
puts(tree[node].i);
|
||||
print(2*node+2);
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
struct node tmp;
|
||||
int i;
|
||||
|
||||
namespace("import", "::tcl::mathfunc::*");
|
||||
for (i = 0; i < 100; i++) {
|
||||
tmp.i = floor(rand()*100);
|
||||
insert(0, tmp);
|
||||
}
|
||||
print(0);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
typedef string FILE;
|
||||
|
||||
main(int ac, string av[])
|
||||
{
|
||||
int i;
|
||||
FILE fd;
|
||||
|
||||
if (ac == 1) {
|
||||
puts("-nonewline", read("stdin"));
|
||||
} else {
|
||||
for (i = 1; defined(av[i]); i++) {
|
||||
fd = open(av[i], "r");
|
||||
puts("-nonewline", read(fd));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
main(int argc, string argv[])
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; defined(argv[i]); i++) {
|
||||
printf("[%d] = %s\n", i, argv[i]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
typedef string FILE;
|
||||
|
||||
main(int ac, string av[], hash env)
|
||||
{
|
||||
int i;
|
||||
string regex;
|
||||
FILE fd;
|
||||
|
||||
if (ac < 2) {
|
||||
error("Not enough arguments.");
|
||||
}
|
||||
regex = av[1];
|
||||
ac--;
|
||||
if (ac == 1) {
|
||||
grep(regex, "stdin");
|
||||
} else {
|
||||
for (i = 2; defined(av[i]); i++) {
|
||||
fd = open(av[i], "r");
|
||||
grep(regex, fd);
|
||||
close(fd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
grep(string regex, FILE in)
|
||||
{
|
||||
string buf;
|
||||
|
||||
while (gets(in, &buf) >= 0) {
|
||||
if (buf =~ /${regex}/) {
|
||||
printf("%s\n", buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
#lang(L)
|
||||
|
||||
/*
|
||||
* Demonstrate interop between L and tcl.
|
||||
* We want to show that you can pass any data structure between L and tcl.
|
||||
*
|
||||
* Base types, pass them, modify them.
|
||||
* Structures, pass them, iterate over the fields.
|
||||
* Arrays & hashes.
|
||||
* Pointers to base types.
|
||||
*/
|
||||
main(int ac, string av[])
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* L calling tcl functions
|
||||
*/
|
||||
L_to_tcl()
|
||||
{
|
||||
string s = "Hi there mom";
|
||||
int a = 1234;
|
||||
|
||||
puts(a); // prints 1234\n
|
||||
puts(s); // prints Hi there mom\n
|
||||
set(&s, "Hi yourself");
|
||||
puts(s); // prints Hi yourself\n
|
||||
puts(:nonewline, "Hi "); // prints Hi
|
||||
puts("there"); // prints there\n
|
||||
}
|
||||
|
||||
set(string &out, string value)
|
||||
{
|
||||
out = value;
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
#pragma language L
|
||||
|
||||
julia(int size, int depth, double zreal, double zimag)
|
||||
{
|
||||
double z[2];
|
||||
double real_min = -1.2, real_max = 1.2, imag_min = -1.2;
|
||||
double xreal, ximag;
|
||||
double delta = (real_max - real_min) / size;
|
||||
int i = 0, j = 0;
|
||||
|
||||
wm("title", ".", "Pretty Julia");
|
||||
wm("geometry", ".", "+1+1");
|
||||
canvas(".c1", "-width", size, "-height", size);
|
||||
pack(".c1");
|
||||
update();
|
||||
z[0] = zreal;
|
||||
z[1] = zimag;
|
||||
xreal = real_min;
|
||||
while (i < size) {
|
||||
j = 0;
|
||||
ximag = imag_min;
|
||||
while (j < size) {
|
||||
double count = 0.0;
|
||||
double x[2];
|
||||
|
||||
x[0] = xreal;
|
||||
x[1] = ximag;
|
||||
while ((count < depth) && (complex_abs(x) < 2.0)) {
|
||||
count = count + 1;
|
||||
x = complex_add(complex_multiply(x, x), z);
|
||||
}
|
||||
if (complex_abs(x) <= 2.0) {
|
||||
.c1("create", "rectangle", i, j, i, j,
|
||||
"-outline", make_color(0, 0, 0));
|
||||
} else {
|
||||
double intensity = count / depth;
|
||||
|
||||
if (intensity > 0.001) {
|
||||
.c1("create", "rectangle", i, j, i, j,
|
||||
"-outline",
|
||||
make_color(round(255.0 / depth *
|
||||
(depth -
|
||||
depth * intensity)),
|
||||
round(255.0 / depth * (depth -
|
||||
depth * intensity)),
|
||||
round(255.0 / depth * depth)));
|
||||
}
|
||||
}
|
||||
j++;
|
||||
ximag = ximag + delta;
|
||||
} i++;
|
||||
puts("-nonewline", format("%d .. ", i));
|
||||
flush("stdout");
|
||||
update();
|
||||
xreal = xreal + delta;
|
||||
} z[0] = zreal;
|
||||
z[1] = zimag;
|
||||
puts("\nDONE");
|
||||
}
|
||||
|
||||
string
|
||||
make_color(int r, int g, int b)
|
||||
{
|
||||
return format("#%02X%02X%02X", r, g, b);
|
||||
}
|
||||
|
||||
double
|
||||
complex_multiply(double c1[2], double c2[2])
|
||||
{
|
||||
double c3[2];
|
||||
|
||||
c3[0] = c1[0] * c2[0] - c1[1] * c2[1];
|
||||
c3[1] = c1[0] * c2[1] + c1[1] * c2[0];
|
||||
return c3;
|
||||
}
|
||||
|
||||
double
|
||||
complex_add(double c1[2], double c2[2])
|
||||
{
|
||||
double c3[2];
|
||||
|
||||
c3[0] = c1[0] + c2[0];
|
||||
c3[1] = c1[1] + c2[1];
|
||||
return c3;
|
||||
}
|
||||
|
||||
#pragma end
|
||||
|
||||
interp alias {} sqrt {} tcl::mathfunc::sqrt
|
||||
interp alias {} round {} tcl::mathfunc::round
|
||||
proc complex_abs {x} {
|
||||
puts "complex_abs $x"
|
||||
set a [lindex $x 0]
|
||||
set b [lindex $x 1]
|
||||
expr {sqrt(($a * $a)+($b * $b))}
|
||||
}
|
||||
#puts [time {julia 100 25 -0.74543 0.11302}]
|
||||
puts [time {julia 300 25 -0.84543 0.21302}]
|
||||
# bigger, different coords:
|
||||
#julia 256 25 -0.84543 0.21302
|
||||
# if you raise the depth, the islands get smaller:
|
||||
#julia 256 50 -0.84543 0.21302
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
.\" The L Programming Language
|
||||
.\" Copyright (c) 2006 BitMover, Inc.
|
||||
.\"
|
||||
.\" process with
|
||||
.\" groff -R -me l-language.me > l-language.ps
|
||||
.\"
|
||||
.\" Commands for refer
|
||||
.R1
|
||||
database references
|
||||
accumulate
|
||||
.R2
|
||||
.\" Title, authors, etc.
|
||||
.+c
|
||||
.(l C
|
||||
.sz 16
|
||||
.b "The L Programming Language"
|
||||
.sz
|
||||
or
|
||||
.sz 12
|
||||
Tcl for C Programmers
|
||||
.sz
|
||||
.sp 3
|
||||
.i "Oscar Bonilla, Tim Daly, Jr., Jeff Hobbs, Larry McVoy"
|
||||
.sp
|
||||
BitMover, Inc.
|
||||
300 Orchard City Drive, Suite 132
|
||||
Campbell, CA 95008
|
||||
\f(CR
|
||||
l@bitmover.com
|
||||
\fP
|
||||
.)l
|
||||
.sp 3
|
||||
.\" Abstract
|
||||
.(l F
|
||||
.b Abstract.
|
||||
This paper describes a new programming language called L. The goal of
|
||||
L is to make it easy for C programmers to take full advantage of
|
||||
Tcl/Tk without requiring them to be proficient in Tcl. L is a new
|
||||
programming language that shares most of its syntax and semantics with
|
||||
C, including pointers and a weak static type system. We have modified
|
||||
the Tcl parser to add a special command which can be used to switch
|
||||
between L and Tcl syntax. Source code written in L syntax is passed to
|
||||
a simple compiler which emits Tcl bytecode. So L source code can be
|
||||
mixed freely with Tcl source code, and Tcl and L can share data and
|
||||
functions transparently. L is free and open source, and the authors
|
||||
hope it will bring many new people to the Tcl community.
|
||||
.)l
|
||||
.\" Main text
|
||||
.sh 1 "Introduction"
|
||||
.lp
|
||||
At BitMover, we are great fans of code reading. We spend much more
|
||||
time reading our source code than writing it. Most of our source base
|
||||
is written in C, but our GUI is written in Tcl. It would greatly
|
||||
simplify things for us if everything was in a common language.
|
||||
However, using Tk from C would be difficult and error-prone.
|
||||
.pp
|
||||
For that reason, we've decided to implement a new language that shares
|
||||
the Tcl runtime. By keeping the language similar to C we can use the
|
||||
same idioms as we would in C, avoiding confusion. To make access to Tk
|
||||
and other Tcl libraries seamless, the language runs right in the Tcl
|
||||
runtime. Its functions are Tcl functions, and its types are Tcl types.
|
||||
.pp
|
||||
In keeping with the grand tradition of one letter language names, this
|
||||
new language is called L. In the next section, we will go into more
|
||||
detail about some interesting aspects of the language. After that we
|
||||
discuss its implementation as a front-end for Tcl. Finally we touch
|
||||
on our plans for the future of L, and tell you where you can get a
|
||||
copy.
|
||||
.sh 1 "The L Language"
|
||||
.lp
|
||||
Say that we're mostly like C and then go on to describe where we're
|
||||
different. Explain how L types correspond to Tcl types, and give an
|
||||
example of the interaction between the two languages.
|
||||
.\" This is an example reference so that I don't forget how to make one
|
||||
.[
|
||||
kernighan cherry eqn
|
||||
.]
|
||||
.sh 1 "The Implementation"
|
||||
.lp
|
||||
The first step in processing an L program is to read in the source
|
||||
code. L source code can be in its own file, or it can be in a mixed
|
||||
file together with Tcl source code.
|
||||
.sh 2 "Parsing Mixed Languages"
|
||||
.lp
|
||||
The most obvious approach to embedding L code within a Tcl program
|
||||
would be to pass the L code as an argument to a new Tcl command which
|
||||
implements L. However, the Tcl syntax rule that "braces nest within a
|
||||
word" [cite endekalogue/tcl book?] means that we would still be
|
||||
required to match (or escape) braces within the L code. This would be
|
||||
an unpleasant wrinkle for the L programmer to deal with.
|
||||
.pp
|
||||
In order to free the brace characters from the reign of Tcl, it was
|
||||
necessary to modify the Tcl parser. We added support for special
|
||||
comments that start with the word "pragma". The parser consumes the
|
||||
input from an opening pragma to a closing pragma, and packages it as a
|
||||
pair of Tcl words -- the name of the command that implements L,
|
||||
followed by the source code between the pragmas. In this way, the
|
||||
result of parsing embedded L code is the same as if the L code had
|
||||
been properly escaped.
|
||||
.sh 1 "..."
|
||||
.lp
|
||||
Mention using Tcl to generate C code, and explain how L pointers work.
|
||||
Take opportunity to release bile about Tcl being a bizarre backend for
|
||||
a C compiler.
|
||||
.sh 1 "Current Status, Availability"
|
||||
.lp
|
||||
L is completely finished and golden, and has a magic shield of +2
|
||||
anti-bitrot. You can get it from sunsite, tsx-11, or wuarchive.
|
||||
Build instructions are for sissies.
|
||||
.\" All done, print the references
|
||||
.[
|
||||
$LIST$
|
||||
.]
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,129 @@
|
||||
Outline
|
||||
What is it?
|
||||
Why is that interesting?
|
||||
Why not some other runtime?
|
||||
Why not just tcl?
|
||||
Language details
|
||||
Code examples
|
||||
Status or what doesn't work yet
|
||||
Future directions
|
||||
License and Availability
|
||||
What people are saying
|
||||
What is it?
|
||||
C-like syntax on top of the Tcl runtime
|
||||
Alternate compiler that generates tcl byte codes
|
||||
Does not change tcl system
|
||||
Interoperates with the tcl system
|
||||
Leverages the tcl runtime
|
||||
An example of a multi-syntax system (can have tcl & L in same file)
|
||||
Why not some other runtime?
|
||||
Lotso good stuff about the tcl runtime
|
||||
Why not pure tcl?
|
||||
Tcl cons from below
|
||||
Why did we do it?
|
||||
Already comitted to tcl/tk
|
||||
Tcl pros
|
||||
Stable runtime
|
||||
Easy to extend in C
|
||||
Powerful, dynamic language
|
||||
Tcl cons
|
||||
Hard to read (for us)
|
||||
No structs - probably the single biggest reason
|
||||
Lots of missing syntactic sugar
|
||||
foo[3] or [lindex foo 3]
|
||||
if (buf =~ /blah.*blech/)
|
||||
or
|
||||
if {[regexp blah.*blah buf]}
|
||||
etc.
|
||||
Pass by reference with upvar is annoying
|
||||
We're a conservative development organization. We sell
|
||||
to enterprise customers and we support releases going back
|
||||
indefinitely in some cases. All code goes through peer review and
|
||||
is optimized for ease of reading more than for ease of writing.
|
||||
We found tcl to be suboptimal in this environment, particularly
|
||||
because of the lack of structs but also because of the lack of
|
||||
syntactic sugar - calling procs to do array indexing is way over
|
||||
our threshold of pain for readability.
|
||||
Language details
|
||||
C-like syntax compiled to tcl byte code
|
||||
L can call tcl, tcl can call L
|
||||
Additions over C
|
||||
perl like regex in statements
|
||||
associative arrays
|
||||
defined() for variables, hashes, arrays
|
||||
defined(foo) [info exists] or winfo ???
|
||||
defined(foo{"bar"})
|
||||
defined(blech[2])
|
||||
strings are a basic type like int/float
|
||||
Additions over tcl
|
||||
structs
|
||||
type checking
|
||||
pass by reference improvements
|
||||
function fingerprints
|
||||
Types
|
||||
string (same as tcl string)
|
||||
int, float (type checked)
|
||||
var (unknown type, strongly typed on first assignment)
|
||||
poly (like tcl variable, no type checking)
|
||||
hash (associative array, currently string types for key/val)
|
||||
Implemented as dicts
|
||||
string types as key/values
|
||||
We could allow
|
||||
hash poly foo{poly}
|
||||
if we ever want that fucked up syntax.
|
||||
structs
|
||||
like C structs
|
||||
implemented as lists
|
||||
fields are in ::L::{struct name} as a list of lists,
|
||||
each list is {type name comments}
|
||||
struct struct {
|
||||
string type;
|
||||
string name;
|
||||
string comments;
|
||||
}
|
||||
Pass by reference or value?
|
||||
base types are all by value, COW, like tcl
|
||||
arrays and hashes are implicit references
|
||||
pass an array to a proc, modify array[3], caller sees
|
||||
base types and structures may be passed by reference
|
||||
pass by reference is done with &variable in the
|
||||
caller which is an alias for "variable", i.e.,
|
||||
we pass by name.
|
||||
In the callee the argument also wants a & and it means
|
||||
do an automagic upvar to get the real variable
|
||||
Returns
|
||||
All returns are by value
|
||||
all types just work as expected
|
||||
push the object onto the stack
|
||||
the other end gets the object into it's
|
||||
variable name.
|
||||
Code examples
|
||||
printenv.l
|
||||
Status or what doesn't work yet
|
||||
Well there are issues
|
||||
Future directions
|
||||
Scoping so you can do modules
|
||||
Precompiled modules (and byte code loader)
|
||||
Optimizations
|
||||
Debugging support
|
||||
Having an L contest for the best ($10K seem right?)
|
||||
License and Availability
|
||||
Same license as Tcl
|
||||
Exported as tarballs nightly
|
||||
What people are saying
|
||||
"It'll make your jaw drop"
|
||||
-- Steve Jobs
|
||||
"It's an amazing, amazing innovation."
|
||||
-- Steve Ballmer
|
||||
"I want to thank Larry McVoy"
|
||||
-- Richard Stallman
|
||||
"L == Tcl 9.0"
|
||||
-- Jeff Hobbs
|
||||
"L? Of course I like it. It's named for me. Right?"
|
||||
-- Linus Torvalds
|
||||
"It's like perl without the nastiest bits"
|
||||
-- Donal K Fellows
|
||||
"I think that's easier to read."
|
||||
-- Larry Wall
|
||||
"L is the coolest thing I've ever seen"
|
||||
-- Vadim Gelfer
|
||||
@@ -0,0 +1,9 @@
|
||||
main(int argc, string argv[], hash env)
|
||||
{
|
||||
string key, val;
|
||||
|
||||
foreach (env as key => val) {
|
||||
printf("env{%s} = %s\n", key, val);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
%A Brian W. Kernighan
|
||||
%A Lorinda L. Cherry
|
||||
%T A System for Typesetting Mathematics
|
||||
%J J. Comm. ACM
|
||||
%V 18
|
||||
%N 3
|
||||
%D March 1978
|
||||
%P 151-157
|
||||
%K eqn
|
||||
|
||||
%A Fred Brooks
|
||||
%T The Mythical Man Month
|
||||
%D 1975
|
||||
%K mythical man month
|
||||
|
||||
%A The Tcler's Wiki
|
||||
%T shimmering
|
||||
%J http://wiki.tcl.tk/3033
|
||||
%D Dec 2005
|
||||
%K shimmering
|
||||
|
||||
%A The Tcler's Wiki
|
||||
%T use_ref
|
||||
%J http://wiki.tcl.tk/15120
|
||||
%D Dec 2005
|
||||
%K pass by reference
|
||||
|
||||
%A Michael Hind
|
||||
%T Pointer Analysis: Haven't We Solved This Problem Yet?"
|
||||
%D 2001
|
||||
%K aliasing1
|
||||
|
||||
%A Steven S. Muchnick
|
||||
%T Advanced Compiler Design and Implementation
|
||||
%D 1997
|
||||
%I Morgan Kaufmann
|
||||
%K optimization
|
||||
|
||||
%A Brian W. Kernighan
|
||||
%A Dennis M. Ritchie
|
||||
%I Prentice-Hall, Inc.
|
||||
%T The C Programming Language
|
||||
%D 1978
|
||||
%K C
|
||||
|
||||
%T Pointer-Induced Aliasing: A Clarification
|
||||
%A Thomas J. Marlowe
|
||||
%A Jong-Deok Choi
|
||||
%A William G. Landi
|
||||
%A Michael G. Burke
|
||||
%A Barbara G. Ryder
|
||||
%A Paul Carini
|
||||
%J ACM SIGPLAN Notices
|
||||
%D September 1993
|
||||
%N Volume 28, No. 9
|
||||
%K aliasing2
|
||||
+11
-9
@@ -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 library n "8.0" Tcl "Tcl Built-In Commands"
|
||||
.so man.macros
|
||||
.BS
|
||||
@@ -19,7 +19,7 @@ auto_execok, auto_import, auto_load, auto_mkindex, auto_qualify, auto_reset, tcl
|
||||
\fBauto_qualify \fIcommand namespace\fR
|
||||
\fBauto_reset\fR
|
||||
\fBtcl_findLibrary \fIbasename version patch initScript enVarName varName\fR
|
||||
\fBparray \fIarrayName\fR
|
||||
\fBparray \fIarrayName\fR ?\fIpattern\fR?
|
||||
\fBtcl_endOfWord \fIstr start\fR
|
||||
\fBtcl_startOfNextWord \fIstr start\fR
|
||||
\fBtcl_startOfPreviousWord \fIstr start\fR
|
||||
@@ -139,7 +139,7 @@ as its first characters then it is assumed to be a procedure
|
||||
definition and the next word of the line is taken as the
|
||||
procedure's name.
|
||||
Procedure definitions that do not appear in this way (e.g.\ they
|
||||
have spaces before the \fBproc\fR) will not be indexed. If your
|
||||
have spaces before the \fBproc\fR) will not be indexed. If your
|
||||
script contains
|
||||
.QW dangerous
|
||||
code, such as global initialization
|
||||
@@ -178,7 +178,7 @@ performing the actual auto-loading of functions at runtime.
|
||||
This is a standard search procedure for use by extensions during
|
||||
their initialization. They call this procedure to look for their
|
||||
script library in several standard directories.
|
||||
The last component of the name of the library directory is
|
||||
The last component of the name of the library directory is
|
||||
normally \fIbasenameversion\fR
|
||||
(e.g., tk8.0), but it might be
|
||||
.QW library
|
||||
@@ -196,9 +196,11 @@ bin or bin/\fIarch\fR directory;
|
||||
relative to the executable file in the current build tree;
|
||||
relative to the executable file in a parallel build tree.
|
||||
.TP
|
||||
\fBparray \fIarrayName\fR
|
||||
Prints on standard output the names and values of all the elements
|
||||
in the array \fIarrayName\fR.
|
||||
\fBparray \fIarrayName\fR ?\fIpattern\fR?
|
||||
Prints on standard output the names and values of all the elements in the
|
||||
array \fIarrayName\fR, or just the names that match \fIpattern\fR (using the
|
||||
matching rules of \fBstring match\fR) and their values if \fIpattern\fR is
|
||||
given.
|
||||
\fIArrayName\fR must be an array accessible to the caller of \fBparray\fR.
|
||||
It may be either local or global.
|
||||
.TP
|
||||
@@ -283,7 +285,7 @@ a default value is used.
|
||||
.TP
|
||||
\fBenv(TCLLIBPATH)\fR
|
||||
If set, then it must contain a valid Tcl list giving directories to
|
||||
search during auto-load operations. Directories must be specified in
|
||||
search during auto-load operations. Directories must be specified in
|
||||
Tcl format, using
|
||||
.QW /
|
||||
as the path separator, regardless of platform.
|
||||
@@ -312,7 +314,7 @@ Unix, words are comprised of numbers, letters or underscores.
|
||||
.SH "SEE ALSO"
|
||||
env(n), info(n), re_syntax(n)
|
||||
.SH KEYWORDS
|
||||
auto-exec, auto-load, library, unknown, word, whitespace
|
||||
auto-exec, auto-load, library, unknown, word, whitespace
|
||||
'\"Local Variables:
|
||||
'\"mode: nroff
|
||||
'\"End:
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ by \fIfirst\fR must exist or \fIfirst\fR must indicate before the
|
||||
start of the list.
|
||||
.PP
|
||||
If \fIlast\fR is less than \fIfirst\fR, then any specified elements
|
||||
will be inserted into the list at the point specified by \fIfirst\fR
|
||||
will be inserted into the list before the point specified by \fIfirst\fR
|
||||
with no elements being deleted.
|
||||
.PP
|
||||
The \fIelement\fR arguments specify zero or more new arguments to
|
||||
|
||||
+286
-20
@@ -13,29 +13,43 @@ msgcat \- Tcl message catalog
|
||||
.SH SYNOPSIS
|
||||
\fBpackage require Tcl 8.5\fR
|
||||
.sp
|
||||
\fBpackage require msgcat 1.5\fR
|
||||
\fBpackage require msgcat 1.6\fR
|
||||
.sp
|
||||
\fB::msgcat::mc \fIsrc-string\fR ?\fIarg arg ...\fR?
|
||||
.sp
|
||||
\fB::msgcat::mcmax ?\fIsrc-string src-string ...\fR?
|
||||
.sp
|
||||
.VS "TIP 412"
|
||||
\fB::msgcat::mcexists\fR ?\fB-exactnamespace\fR? ?\fB-exactlocale\fR? \fIsrc-string\fR
|
||||
.VE "TIP 412"
|
||||
.sp
|
||||
\fB::msgcat::mclocale \fR?\fInewLocale\fR?
|
||||
.sp
|
||||
\fB::msgcat::mcpreferences\fR
|
||||
.sp
|
||||
.VS "TIP 412"
|
||||
\fB::msgcat::mcloadedlocales subcommand\fR ?\fIlocale\fR?
|
||||
.VE "TIP 412"
|
||||
.sp
|
||||
\fB::msgcat::mcload \fIdirname\fR
|
||||
.sp
|
||||
\fB::msgcat::mcset \fIlocale src-string \fR?\fItranslate-string\fR?
|
||||
.sp
|
||||
\fB::msgcat::mcmset \fIlocale src-trans-list\fR
|
||||
.sp
|
||||
.VS "TIP 404"
|
||||
\fB::msgcat::mcflset \fIsrc-string \fR?\fItranslate-string\fR?
|
||||
.sp
|
||||
\fB::msgcat::mcflmset \fIsrc-trans-list\fR
|
||||
.VE "TIP 404"
|
||||
.sp
|
||||
\fB::msgcat::mcunknown \fIlocale src-string\fR ?\fIarg arg ...\fR?
|
||||
.sp
|
||||
.VS "TIP 412"
|
||||
\fB::msgcat::mcpackagelocale subcommand\fR ?\fIlocale\fR?
|
||||
.sp
|
||||
\fB::msgcat::mcpackageconfig subcommand\fR \fIoption\fR ?\fIvalue\fR?
|
||||
.sp
|
||||
\fB::msgcat::mcforgetpackage\fR
|
||||
.VE "TIP 412"
|
||||
.BE
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
@@ -46,18 +60,23 @@ Text strings are defined in a
|
||||
which is independent from the application, and
|
||||
which can be edited or localized without modifying
|
||||
the application source code. New languages
|
||||
or locales are provided by adding a new file to
|
||||
or locales may be provided by adding a new file to
|
||||
the message catalog.
|
||||
.PP
|
||||
Use of the message catalog is optional by any application
|
||||
or package, but is encouraged if the application or package
|
||||
wishes to be enabled for multi-lingual applications.
|
||||
\fBmsgcat\fR distinguises packages by its namespace.
|
||||
Each package has its own message catalog and configuration settings in \fBmsgcat\fR.
|
||||
.PP
|
||||
A \fIlocale\fR is a specification string describing a user language like \fBde_ch\fR for Swiss German.
|
||||
In \fBmsgcat\fR, there is a global locale initialized by the system locale of the current system.
|
||||
Each package may decide to use the global locale or to use a package specific locale.
|
||||
.PP
|
||||
The global locale may be changed on demand, for example by a user initiated language change or within a multi user application like a web server.
|
||||
.SH COMMANDS
|
||||
.TP
|
||||
\fB::msgcat::mc \fIsrc-string\fR ?\fIarg arg ...\fR?
|
||||
.
|
||||
Returns a translation of \fIsrc-string\fR according to the
|
||||
user's current locale. If additional arguments past \fIsrc-string\fR
|
||||
current locale. If additional arguments past \fIsrc-string\fR
|
||||
are given, the \fBformat\fR command is used to substitute the
|
||||
additional arguments in the translation of \fIsrc-string\fR.
|
||||
.RS
|
||||
@@ -84,6 +103,18 @@ of the longest translated string. This is useful when designing
|
||||
localized GUIs, which may require that all buttons, for example, be a
|
||||
fixed width (which will be the width of the widest button).
|
||||
.TP
|
||||
\fB::msgcat::mcexists\fR ?\fB-exactnamespace\fR? ?\fB-exactlocale\fR? \fIsrc-string\fR
|
||||
.
|
||||
.VS "TIP 412"
|
||||
Return true, if there is a translation for the given \fIsrc-string\fR.
|
||||
.PP
|
||||
.RS
|
||||
The search may be limited by the option \fB\-exactnamespace\fR to only check the current namespace and not any parent namespaces.
|
||||
.PP
|
||||
It may also be limited by the option \fB\-exactlocale\fR to only check the first prefered locale (e.g. first element returned by \fB::msgcat::mcpreferences\fR if global locale is used).
|
||||
.RE
|
||||
.VE "TIP 412"
|
||||
.TP
|
||||
\fB::msgcat::mclocale \fR?\fInewLocale\fR?
|
||||
.
|
||||
This function sets the locale to \fInewLocale\fR. If \fInewLocale\fR
|
||||
@@ -93,6 +124,13 @@ case-insensitive manner, and returns locales in lowercase.
|
||||
The initial locale is determined by the locale specified in
|
||||
the user's environment. See \fBLOCALE SPECIFICATION\fR
|
||||
below for a description of the locale string format.
|
||||
.RS
|
||||
.PP
|
||||
.VS "TIP 412"
|
||||
If the locale is set, the preference list of locales is evaluated.
|
||||
Locales in this list are loaded now, if not jet loaded.
|
||||
.VE "TIP 412"
|
||||
.RE
|
||||
.TP
|
||||
\fB::msgcat::mcpreferences\fR
|
||||
.
|
||||
@@ -103,13 +141,26 @@ preference. The list is derived from the current
|
||||
locale set in msgcat by \fB::msgcat::mclocale\fR, and
|
||||
cannot be set independently. For example, if the
|
||||
current locale is en_US_funky, then \fB::msgcat::mcpreferences\fR
|
||||
returns \fB{en_US_funky en_US en {}}\fR.
|
||||
returns \fB{en_us_funky en_us en {}}\fR.
|
||||
.TP
|
||||
\fB::msgcat:mcloadedlocales subcommand\fR ?\fIlocale\fR?
|
||||
.
|
||||
This group of commands manage the list of loaded locales for packages not setting a package locale.
|
||||
.PP
|
||||
.RS
|
||||
The subcommand \fBget\fR returns the list of currently loaded locales.
|
||||
.PP
|
||||
The subcommand \fBpresent\fR requires the argument \fIlocale\fR and returns true, if this locale is loaded.
|
||||
.PP
|
||||
The subcommand \fBclear\fR removes all locales and their data, which are not in the current preference list.
|
||||
.RE
|
||||
.TP
|
||||
\fB::msgcat::mcload \fIdirname\fR
|
||||
.
|
||||
.VS "TIP 412"
|
||||
Searches the specified directory for files that match
|
||||
the language specifications returned by \fB::msgcat::mcpreferences\fR
|
||||
(note that these are all lowercase), extended by the file extension
|
||||
the language specifications returned by \fB::msgcat::mcloadedlocales get\fR
|
||||
(or \fBmsgcat::mcpackagelocale preferences\fR if a package locale is set) (note that these are all lowercase), extended by the file extension
|
||||
.QW .msg .
|
||||
Each matching file is
|
||||
read in order, assuming a UTF-8 encoding. The file contents are
|
||||
@@ -118,6 +169,11 @@ may be present in the message file either directly in their UTF-8
|
||||
encoded form, or by use of the backslash-u quoting recognized by Tcl
|
||||
evaluation. The number of message files which matched the specification
|
||||
and were loaded is returned.
|
||||
.RS
|
||||
.PP
|
||||
In addition, the given folder is stored in the \fBmsgcat\fR package configuration option \fImcfolder\fR to eventually load message catalog files required by a locale change.
|
||||
.VE "TIP 412"
|
||||
.RE
|
||||
.TP
|
||||
\fB::msgcat::mcset \fIlocale src-string \fR?\fItranslate-string\fR?
|
||||
.
|
||||
@@ -138,16 +194,13 @@ faster than multiple invocations of \fB::msgcat::mcset\fR. The function
|
||||
returns the number of translations set.
|
||||
.TP
|
||||
\fB::msgcat::mcflset \fIsrc-string \fR?\fItranslate-string\fR?
|
||||
.VS "TIP 404"
|
||||
Sets the translation for \fIsrc-string\fR to \fItranslate-string\fR in the
|
||||
current namespace for the locale implied by the name of the message catalog
|
||||
being loaded via \fB::msgcat::mcload\fR. If \fItranslate-string\fR is not
|
||||
specified, \fIsrc-string\fR is used for both. The function returns
|
||||
\fItranslate-string\fR.
|
||||
.VE "TIP 404"
|
||||
.TP
|
||||
\fB::msgcat::mcflmset \fIsrc-trans-list\fR
|
||||
.VS "TIP 404"
|
||||
Sets the translation for multiple source strings in \fIsrc-trans-list\fR in
|
||||
the current namespace for the locale implied by the name of the message
|
||||
catalog being loaded via \fB::msgcat::mcload\fR. \fIsrc-trans-list\fR must
|
||||
@@ -155,7 +208,6 @@ have an even number of elements and is in the form {\fIsrc-string
|
||||
translate-string\fR ?\fIsrc-string translate-string ...\fR?}
|
||||
\fB::msgcat::mcflmset\fR can be significantly faster than multiple invocations
|
||||
of \fB::msgcat::mcflset\fR. The function returns the number of translations set.
|
||||
.VE "TIP 404"
|
||||
.TP
|
||||
\fB::msgcat::mcunknown \fIlocale src-string\fR ?\fIarg arg ...\fR?
|
||||
.
|
||||
@@ -168,7 +220,18 @@ application, for example to log error messages for each unknown
|
||||
string. The \fB::msgcat::mcunknown\fR procedure is invoked at the
|
||||
same stack context as the call to \fB::msgcat::mc\fR. The return value
|
||||
of \fB::msgcat::mcunknown\fR is used as the return value for the call
|
||||
to \fB::msgcat::mc\fR.
|
||||
to \fB::msgcat::mc\fR.
|
||||
.VS "TIP 412"
|
||||
.RS
|
||||
.PP
|
||||
Note that this routine is only called if the concerned package did not set a package locale unknown command name.
|
||||
.RE
|
||||
.TP
|
||||
\fB::msgcat::mcforgetpackage\fR
|
||||
.
|
||||
The calling package clears all its state within the \fBmsgcat\fR package including all settings and translations.
|
||||
.VE "TIP 412"
|
||||
.PP
|
||||
.SH "LOCALE SPECIFICATION"
|
||||
.PP
|
||||
The locale is specified to \fBmsgcat\fR by a locale string
|
||||
@@ -217,15 +280,15 @@ When a locale is specified by the user, a
|
||||
search is performed during string translation. For example, if a user
|
||||
specifies
|
||||
en_GB_Funky, the locales
|
||||
.QW en_GB_Funky ,
|
||||
.QW en_GB ,
|
||||
.QW en_gb_funky ,
|
||||
.QW en_gb ,
|
||||
.QW en
|
||||
and
|
||||
.MT
|
||||
(the empty string)
|
||||
are searched in order until a matching translation
|
||||
string is found. If no translation string is available, then
|
||||
\fB::msgcat::mcunknown\fR is called.
|
||||
the unknown handler is called.
|
||||
.SH "NAMESPACES AND MESSAGE CATALOGS"
|
||||
.PP
|
||||
Strings stored in the message catalog are stored relative
|
||||
@@ -321,7 +384,7 @@ the package. For example, a short \fBes.msg\fR might contain:
|
||||
.PP
|
||||
.CS
|
||||
namespace eval ::mypackage {
|
||||
\fB::msgcat::mcflset\fR "Free Beer!" "Cerveza Gracias!"
|
||||
\fB::msgcat::mcflset\fR "Free Beer" "Cerveza Gratis"
|
||||
}
|
||||
.CE
|
||||
.SH "RECOMMENDED MESSAGE SETUP FOR PACKAGES"
|
||||
@@ -373,6 +436,209 @@ formatting substitution is done directly.
|
||||
# ... where that key is mapped to one of the
|
||||
# human-oriented versions by \fBmsgcat::mcset\fR
|
||||
.CE
|
||||
.VS "TIP 412"
|
||||
.SH Package private locale
|
||||
.PP
|
||||
A package using \fBmsgcat\fR may choose to use its own package private
|
||||
locale and its own set of loaded locales, independent to the global
|
||||
locale set by \fB::msgcat::mclocale\fR.
|
||||
.PP
|
||||
This allows a package to change its locale without causing any locales load or removal in other packages and not to invoke the global locale change callback (see below).
|
||||
.PP
|
||||
This action is controled by the following ensemble:
|
||||
.TP
|
||||
\fB::msgcat::mcpackagelocale set\fR ?\fIlocale\fR?
|
||||
.
|
||||
Set or change a package private locale.
|
||||
The package private locale is set to the given \fIlocale\fR if the \fIlocale\fR is given.
|
||||
If the option \fIlocale\fR is not given, the package is set to package private locale mode, but no locale is changed (e.g. if the global locale was valid for the package before, it is copied to the package private locale).
|
||||
.PP
|
||||
.RS
|
||||
This command may cause the load of locales.
|
||||
.RE
|
||||
.TP
|
||||
\fB::msgcat::mcpackagelocale get\fR
|
||||
.
|
||||
Return the package private locale or the global locale, if no package private locale is set.
|
||||
.TP
|
||||
\fB::msgcat::mcpackagelocale preferences\fR
|
||||
.
|
||||
Return the package private preferences or the global preferences,
|
||||
if no package private locale is set.
|
||||
.TP
|
||||
\fB::msgcat::mcpackagelocale loaded\fR
|
||||
.
|
||||
Return the list of locales loaded for this package.
|
||||
.TP
|
||||
\fB::msgcat::mcpackagelocale isset\fR
|
||||
.
|
||||
Returns true, if a package private locale is set.
|
||||
.TP
|
||||
\fB::msgcat::mcpackagelocale unset\fR
|
||||
.
|
||||
Unset the package private locale and use the globale locale.
|
||||
Load and remove locales to adjust the list of loaded locales for the
|
||||
package to the global loaded locales list.
|
||||
.TP
|
||||
\fB::msgcat::mcpackagelocale present\fR \fIlocale\fR
|
||||
.
|
||||
Returns true, if the given locale is loaded for the package.
|
||||
.TP
|
||||
\fB::msgcat::mcpackagelocale clear\fR
|
||||
.
|
||||
Clear any loaded locales of the package not present in the package preferences.
|
||||
.PP
|
||||
.SH Changing package options
|
||||
.PP
|
||||
Each package using msgcat has a set of options within \fBmsgcat\fR.
|
||||
The package options are described in the next sectionPackage options.
|
||||
Each package option may be set or unset individually using the following ensemble:
|
||||
.TP
|
||||
\fB::msgcat::mcpackageconfig get\fR \fIoption\fR
|
||||
.
|
||||
Return the current value of the given \fIoption\fR.
|
||||
This call returns an error if the option is not set for the package.
|
||||
.TP
|
||||
\fB::msgcat::mcpackageconfig isset\fR \fIoption\fR
|
||||
.
|
||||
Returns 1, if the given \fIoption\fR is set for the package, 0 otherwise.
|
||||
.TP
|
||||
\fB::msgcat::mcpackageconfig set\fR \fIoption\fR \fIvalue\fR
|
||||
.
|
||||
Set the given \fIoption\fR to the given \fIvalue\fR.
|
||||
This may invoke additional actions in dependency of the \fIoption\fR.
|
||||
The return value is 0 or the number of loaded packages for the option \fBmcfolder\fR.
|
||||
.TP
|
||||
\fB::msgcat::mcpackageconfig unset\fR \fIoption\fR
|
||||
.
|
||||
Unsets the given \fIoption\fR for the package.
|
||||
No action is taken if the \fIoption\fR is not set for the package.
|
||||
The empty string is returned.
|
||||
.SS Package options
|
||||
.PP
|
||||
The following package options are available for each package:
|
||||
.TP
|
||||
\fBmcfolder\fR
|
||||
.
|
||||
This is the message folder of the package. This option is set by mcload and by the subcommand set. Both are identical and both return the number of loaded message catalog files.
|
||||
.RS
|
||||
.PP
|
||||
Setting or changing this value will load all locales contained in the preferences valid for the package. This implies also to invoke any set loadcmd (see below).
|
||||
.PP
|
||||
Unsetting this value will disable message file load for the package.
|
||||
.RE
|
||||
.TP
|
||||
\fBloadcmd\fR
|
||||
.
|
||||
This callback is invoked before a set of message catalog files are loaded for the package which has this property set.
|
||||
.PP
|
||||
.RS
|
||||
This callback may be used to do any preparation work for message file load or to get the message data from another source like a data base. In this case, no message files are used (mcfolder is unset).
|
||||
.PP
|
||||
See section \fBcallback invocation\fR below.
|
||||
The parameter list appended to this callback is the list of locales to load.
|
||||
.PP
|
||||
If this callback is changed, it is called with the preferences valid for the package.
|
||||
.RE
|
||||
.TP
|
||||
\fBchangecmd\fR
|
||||
.
|
||||
This callback is invoked when a default local change was performed. Its purpose is to allow a package to update any dependency on the default locale like showing the GUI in another language.
|
||||
.PP
|
||||
.RS
|
||||
See the callback invocation section below.
|
||||
The parameter list appended to this callback is \fBmcpreferences\fR.
|
||||
The registered callbacks are invoked in no particular order.
|
||||
.RE
|
||||
.TP
|
||||
\fBunknowncmd\fR
|
||||
.
|
||||
Use a package locale mcunknown procedure instead of the standard version supplied by the msgcat package (msgcat::mcunknown).
|
||||
.PP
|
||||
.RS
|
||||
The called procedure must return the formatted message which will finally be returned by msgcat::mc.
|
||||
.PP
|
||||
A generic unknown handler is used if set to the empty string. This consists in returning the key if no arguments are given. With given arguments, format is used to process the arguments.
|
||||
.PP
|
||||
See section \fBcallback invocation\fR below.
|
||||
The appended arguments are identical to \fB::msgcat::mcunknown\fR.
|
||||
.RE
|
||||
.SS Callback invocation
|
||||
A package may decide to register one or multiple callbacks, as described above.
|
||||
.PP
|
||||
Callbacks are invoked, if:
|
||||
.PP
|
||||
1. the callback command is set,
|
||||
.PP
|
||||
2. the command is not the empty string,
|
||||
.PP
|
||||
3. the registering namespace exists.
|
||||
.PP
|
||||
If a called routine fails with an error, the \fBbgerror\fR routine for the interpreter is invoked after command completion.
|
||||
Only exception is the callback \fBunknowncmd\fR, where an error causes the invoking \fBmc\fR-command to fail with that error.
|
||||
.PP
|
||||
.SS Examples
|
||||
Packages which display a GUI may update their widgets when the global locale changes.
|
||||
To register to a callback, use:
|
||||
.CS
|
||||
namespace eval gui {
|
||||
msgcat::mcpackageconfig changecmd updateGUI
|
||||
|
||||
proc updateGui args {
|
||||
puts "New locale is '[lindex $args 0]'."
|
||||
}
|
||||
}
|
||||
% msgcat::mclocale fr
|
||||
fr
|
||||
% New locale is 'fr'.
|
||||
.CE
|
||||
.PP
|
||||
If locales (or additional locales) are contained in another source like a data base, a package may use the load callback and not mcload:
|
||||
.CS
|
||||
namespace eval db {
|
||||
msgcat::mcpackageconfig loadcmd loadMessages
|
||||
|
||||
proc loadMessages args {
|
||||
foreach locale $args {
|
||||
if {[LocaleInDB $locale]} {
|
||||
msgcat::mcmset $locale [GetLocaleList $locale]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.CE
|
||||
.PP
|
||||
The \fBclock\fR command implementation uses \fBmsgcat\fR with a package locale to implement the command line parameter \fB-locale\fR.
|
||||
Here are some sketches of the implementation:
|
||||
.PP
|
||||
First, a package locale is initialized and the generic unknown function is desactivated:
|
||||
.CS
|
||||
msgcat::mcpackagelocale set
|
||||
msgcat::mcpackageconfig unknowncmd ""
|
||||
.CE
|
||||
As an example, the user requires the week day in a certain locale as follows:
|
||||
.CS
|
||||
clock format clock seconds -format %A -locale fr
|
||||
.CE
|
||||
\fBclock\fR sets the package locale to \fBfr\fR and looks for the day name as follows:
|
||||
.CS
|
||||
msgcat::mcpackagelocale set $locale
|
||||
return [lindex [msgcat::mc DAYS_OF_WEEK_FULL] $day]
|
||||
### Returns "mercredi"
|
||||
.CE
|
||||
Within \fBclock\fR, some message-catalog items are heavy in computation and thus are dynamically cached using:
|
||||
.CS
|
||||
proc ::tcl::clock::LocalizeFormat { locale format } {
|
||||
set key FORMAT_$format
|
||||
if { [::msgcat::mcexists -exactlocale -exactnamespace $key] } {
|
||||
return [mc $key]
|
||||
}
|
||||
#...expensive computation of format clipped...
|
||||
mcset $locale $key $format
|
||||
return $format
|
||||
}
|
||||
.CE
|
||||
.VE "TIP 412"
|
||||
.SH CREDITS
|
||||
.PP
|
||||
The message catalog code was developed by Mark Harrison.
|
||||
|
||||
@@ -37,7 +37,7 @@ the \fBoo::object\fR class, which is not publicly visible by default:
|
||||
oo::class create c {
|
||||
method count {} {
|
||||
\fBmy\fR variable counter
|
||||
print [incr counter]
|
||||
puts [incr counter]
|
||||
}
|
||||
}
|
||||
c create o
|
||||
|
||||
+7
-5
@@ -96,9 +96,11 @@ forward to the proper implementation of the method (which it does by invoking
|
||||
the \fBnext\fR command as filters are inserted into the front of the method
|
||||
call chain) and is responsible for returning the result of \fBnext\fR.
|
||||
.PP
|
||||
Filters are not invoked when processing an invocation of the \fBunknown\fR
|
||||
method because of a failure to locate a method implementation, or when
|
||||
invoking either constructors or destructors.
|
||||
Filters are invoked when processing an invokation of the \fBunknown\fR
|
||||
method because of a failure to locate a method implementation, but \fInot\fR
|
||||
when invoking either constructors or destructors. (Note however that the
|
||||
\fBdestroy\fR method is a conventional method, and filters are invoked as
|
||||
normal when it is called.)
|
||||
.SH EXAMPLES
|
||||
.PP
|
||||
This example demonstrates how to use the \fBnext\fR command to call the
|
||||
@@ -120,7 +122,7 @@ oo::class create theSubclass {
|
||||
}
|
||||
}
|
||||
theSubclass create obj
|
||||
oo::define obj method example args {
|
||||
oo::objdefine obj method example args {
|
||||
puts "per-object method, args = $args"
|
||||
\fBnext\fR x {*}$args y
|
||||
\fBnext\fR
|
||||
@@ -174,7 +176,7 @@ oo::class create cache {
|
||||
}
|
||||
|
||||
oo::object create demo
|
||||
oo::define demo {
|
||||
oo::objdefine demo {
|
||||
mixin cache
|
||||
method compute {a b c} {
|
||||
after 3000 \fI;# Simulate deep thought\fR
|
||||
|
||||
+13
-48
@@ -361,63 +361,28 @@ may cause this error.
|
||||
A BREAK condition has been detected by your UART (see above).
|
||||
.SH "PORTABILITY ISSUES"
|
||||
.TP
|
||||
\fBWindows \fR(all versions)
|
||||
\fBWindows \fR
|
||||
.
|
||||
Valid values for \fIfileName\fR to open a serial port are of the form
|
||||
\fBcom\fIX\fB:\fR, where \fIX\fR is a number, generally from 1 to 4.
|
||||
This notation only works for serial ports from 1 to 9, if the system
|
||||
happens to have more than four. An attempt to open a serial port that
|
||||
\fBcom\fIX\fB\fR, where \fIX\fR is a number, generally from 1 to 9.
|
||||
A legacy form accepted as well is \fBcom\fIX\fB:\fR. This notation only
|
||||
works for serial ports from 1 to 9. An attempt to open a serial port that
|
||||
does not exist or has a number greater than 9 will fail. An alternate
|
||||
form of opening serial ports is to use the filename \fB\e\e.\ecomX\fR,
|
||||
where X is any number that corresponds to a serial port; please note
|
||||
that this method is considerably slower on Windows 95 and Windows 98.
|
||||
.TP
|
||||
\fBWindows NT\fR
|
||||
.
|
||||
form of opening serial ports is to use the filename \fB//./comX\fR,
|
||||
where X is any number that corresponds to a serial port.
|
||||
.PP
|
||||
.RS
|
||||
When running Tcl interactively, there may be some strange interactions
|
||||
between the real console, if one is present, and a command pipeline that uses
|
||||
standard input or output. If a command pipeline is opened for reading, some
|
||||
of the lines entered at the console will be sent to the command pipeline and
|
||||
some will be sent to the Tcl evaluator. If a command pipeline is opened for
|
||||
writing, keystrokes entered into the console are not visible until the
|
||||
pipe is closed. This behavior occurs whether the command pipeline is
|
||||
executing 16-bit or 32-bit applications. These problems only occur because
|
||||
both Tcl and the child application are competing for the console at
|
||||
the same time. If the command pipeline is started from a script, so that Tcl
|
||||
is not accessing the console, or if the command pipeline does not use
|
||||
standard input or output, but is redirected from or to a file, then the
|
||||
above problems do not occur.
|
||||
.TP
|
||||
\fBWindows 95\fR
|
||||
.
|
||||
A command pipeline that executes a 16-bit DOS application cannot be opened
|
||||
for both reading and writing, since 16-bit DOS applications that receive
|
||||
standard input from a pipe and send standard output to a pipe run
|
||||
synchronously. Command pipelines that do not execute 16-bit DOS
|
||||
applications run asynchronously and can be opened for both reading and
|
||||
writing.
|
||||
.RS
|
||||
.PP
|
||||
When running Tcl interactively, there may be some strange interactions
|
||||
between the real console, if one is present, and a command pipeline that uses
|
||||
standard input or output. If a command pipeline is opened for reading from
|
||||
a 32-bit application, some of the keystrokes entered at the console will be
|
||||
sent to the command pipeline and some will be sent to the Tcl evaluator. If
|
||||
a command pipeline is opened for writing to a 32-bit application, no output
|
||||
is visible on the console until the pipe is closed. These problems only
|
||||
occur because both Tcl and the child application are competing for the
|
||||
console at the same time. If the command pipeline is started from a script,
|
||||
so that Tcl is not accessing the console, or if the command pipeline does
|
||||
not use standard input or output, but is redirected from or to a file, then
|
||||
the above problems do not occur.
|
||||
.PP
|
||||
Whether or not Tcl is running interactively, if a command pipeline is opened
|
||||
for reading from a 16-bit DOS application, the call to \fBopen\fR will not
|
||||
return until end-of-file has been received from the command pipeline's
|
||||
standard output. If a command pipeline is opened for writing to a 16-bit DOS
|
||||
application, no data will be sent to the command pipeline's standard output
|
||||
until the pipe is actually closed. This problem occurs because 16-bit DOS
|
||||
applications are run synchronously, as described above.
|
||||
pipe is closed. These problems only occur because both Tcl and the child
|
||||
application are competing for the console at the same time. If the command
|
||||
pipeline is started from a script, so that Tcl is not accessing the console,
|
||||
or if the command pipeline does not use standard input or output, but is
|
||||
redirected from or to a file, then the above problems do not occur.
|
||||
.RE
|
||||
.TP
|
||||
\fBUnix\fR\0\0\0\0\0\0\0
|
||||
|
||||
+25
-1
@@ -683,9 +683,33 @@ earlier in the RE taking priority over ones starting later. Note that
|
||||
outer subexpressions thus take priority over their component
|
||||
subexpressions.
|
||||
.PP
|
||||
Note that the quantifiers \fB{1,1}\fR and \fB{1,1}?\fR can be used to
|
||||
The quantifiers \fB{1,1}\fR and \fB{1,1}?\fR can be used to
|
||||
force longest and shortest preference, respectively, on a
|
||||
subexpression or a whole RE.
|
||||
.RS
|
||||
.PP
|
||||
\fBNOTE:\fR This means that you can usually make a RE be non-greedy overall by
|
||||
putting \fB{1,1}?\fR after one of the first non-constraint atoms or
|
||||
parenthesized sub-expressions in it. \fIIt pays to experiment\fR with the
|
||||
placing of this non-greediness override on a suitable range of input texts
|
||||
when you are writing a RE if you are using this level of complexity.
|
||||
.PP
|
||||
For example, this regular expression is non-greedy, and will match the
|
||||
shortest substring possible given that
|
||||
.QW \fBabc\fR
|
||||
will be matched as early as possible (the quantifier does not change that):
|
||||
.PP
|
||||
.CS
|
||||
ab{1,1}?c.*x.*cba
|
||||
.CE
|
||||
.PP
|
||||
The atom
|
||||
.QW \fBa\fR
|
||||
has no greediness preference, we explicitly give one for
|
||||
.QW \fBb\fR ,
|
||||
and the remaining quantifiers are overridden to be non-greedy by the preceding
|
||||
non-greedy quantifier.
|
||||
.RE
|
||||
.PP
|
||||
Match lengths are measured in characters, not collating elements. An
|
||||
empty string is considered longer than no match at all. For example,
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ the \fB(?x)\fR embedded option (see the \fBre_syntax\fR manual page).
|
||||
.TP 15
|
||||
\fB\-indices\fR
|
||||
.
|
||||
Changes what is stored in the \fIsubMatchVar\fRs.
|
||||
Changes what is stored in the \fImatchVar\fR and \fIsubMatchVar\fRs.
|
||||
Instead of storing the matching characters from \fIstring\fR,
|
||||
each variable
|
||||
will contain a list of two decimal strings giving the indices
|
||||
|
||||
@@ -97,6 +97,10 @@ writable channel event on the socket to get notified when the
|
||||
asynchronous connection has succeeded or failed. See the \fBvwait\fR
|
||||
and the \fBchan\fR commands for more details on the event loop and
|
||||
channel events.
|
||||
.PP
|
||||
The \fBchan configure\fR option \fB-connecting\fR may be used to check if the connect is still running. To verify a successful connect, the option \fB-error\fR may be checked when \fB-connecting\fR returned 0.
|
||||
.PP
|
||||
Operation without the event queue requires at the moment calls to \fBchan configure\fR to advance the internal state machine.
|
||||
.RE
|
||||
.SH "SERVER SOCKETS"
|
||||
.PP
|
||||
@@ -186,6 +190,10 @@ sockets, this option returns a list of three elements; these are the
|
||||
address, the host name and the port to which the peer socket is connected
|
||||
or bound. If the host name cannot be computed, the second element of the
|
||||
list is identical to the address, its first element.
|
||||
.TP
|
||||
\fB\-connecting\fR
|
||||
.
|
||||
This option is not supported by server sockets. For client sockets, this option returns 1 if an asyncroneous connect is still in progress, 0 otherwise.
|
||||
.PP
|
||||
.SH "EXAMPLES"
|
||||
.PP
|
||||
|
||||
@@ -43,6 +43,8 @@ or
|
||||
which will be safely substituted by the Tcl interpreter into
|
||||
.QW ^Z .
|
||||
.PP
|
||||
A leading BOM (Byte order mark) contained in the file is ignored for unicode encodings (utf-8, unicode).
|
||||
.PP
|
||||
The \fB\-encoding\fR option is used to specify the encoding of
|
||||
the data stored in \fIfileName\fR. When the \fB\-encoding\fR option
|
||||
is omitted, the system encoding is assumed.
|
||||
|
||||
@@ -143,15 +143,6 @@ incomplete commands.
|
||||
.SH "STANDARD CHANNELS"
|
||||
.PP
|
||||
See \fBTcl_StandardChannels\fR for more explanations.
|
||||
.SH ZIPVFS
|
||||
.PP
|
||||
When a zipfile is concatenated to the end of a \fBtclsh\fR, on
|
||||
startup the contents of the zip archive will be mounted as the
|
||||
virtual file system /zvfs. If a top level directory tcl8.6 is
|
||||
present in the zip archive, it will become the directory loaded
|
||||
as env(TCL_LIBRARY). If a file named \fBmain.tcl\fR is present
|
||||
in the top level directory of the zip archive, it will be sourced
|
||||
instead of the shell's normal command line handing.
|
||||
.SH "SEE ALSO"
|
||||
auto_path(n), encoding(n), env(n), fconfigure(n)
|
||||
.SH KEYWORDS
|
||||
|
||||
@@ -642,14 +642,6 @@ This test can only be run on any Windows platform.
|
||||
.
|
||||
This test can only be run on any Windows NT platform.
|
||||
.TP
|
||||
\fI95\fR
|
||||
.
|
||||
This test can only be run on any Windows 95 platform.
|
||||
.TP
|
||||
\fI98\fR
|
||||
.
|
||||
This test can only be run on any Windows 98 platform.
|
||||
.TP
|
||||
\fImac\fR
|
||||
.
|
||||
This test can only be run on any Mac platform.
|
||||
|
||||
+7
-7
@@ -299,6 +299,11 @@ so extension writers can specify which package to load depending on the
|
||||
C run-time library that is in use. This is not an indication that this core
|
||||
contains symbols.
|
||||
.TP
|
||||
\fBengine\fR
|
||||
.
|
||||
The name of the Tcl language implementation. When the interpreter is first
|
||||
created, this is always set to the string \fBTcl\fR.
|
||||
.TP
|
||||
\fBmachine\fR
|
||||
.
|
||||
The instruction set executed by this machine, such as
|
||||
@@ -308,18 +313,13 @@ is the value returned by \fBuname -m\fR.
|
||||
\fBos\fR
|
||||
.
|
||||
The name of the operating system running on this machine,
|
||||
such as \fBWindows 95\fR, \fBWindows NT\fR, or \fBSunOS\fR.
|
||||
such as \fBWindows NT\fR or \fBSunOS\fR.
|
||||
On UNIX machines, this is the value returned by \fBuname -s\fR.
|
||||
On Windows 95 and Windows 98, the value returned will be \fBWindows
|
||||
95\fR to provide better backwards compatibility to Windows 95; to
|
||||
distinguish between the two, check the \fBosVersion\fR.
|
||||
.TP
|
||||
\fBosVersion\fR
|
||||
.
|
||||
The version number for the operating system running on this machine.
|
||||
On UNIX machines, this is the value returned by \fBuname -r\fR. On
|
||||
Windows 95, the version will be 4.0; on Windows 98, the version will
|
||||
be 4.10.
|
||||
On UNIX machines, this is the value returned by \fBuname -r\fR.
|
||||
.TP
|
||||
\fBpathSeparator\fR
|
||||
.VS 8.6
|
||||
|
||||
-114
@@ -1,114 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 2014 Sean Woods
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution
|
||||
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
'\"
|
||||
.TH zvfs n 0.1 Zvfs "Zvfs Commands"
|
||||
.so man.macros
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
zvfs \- Mount and work with ZIP files within Tcl
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
\fBpackage require zvfs \fR?\fB0.1\fR?
|
||||
.sp
|
||||
\fB::zvfs::add\fR ?\fB\-fconfigure \fIoptpairs...\fR? \fIarchive file1\fR ?\fIfile2 ...\fR?
|
||||
\fB::zvfs::append\fR \fIarchive\fR ?\fIsource destination\fR? ?\fIsource destination...\fR?
|
||||
\fB::zvfs::dump\fR \fIzipfile\fR
|
||||
\fB::zvfs::exists\fR \fIfilename\fR
|
||||
\fB::zvfs::info\fR \fIfile\fR
|
||||
\fB::zvfs::list\fR ?\fB\-glob\fR|\fB\-regexp\fR? ?\fIpattern\fR?
|
||||
\fB::zvfs::mount ?\fIarchive\fR? ?\fImountpoint\fR?
|
||||
\fB::zvfs::start\fR \fIzipfile\fR
|
||||
\fB::zvfs::unmount \fIarchive\fR
|
||||
.fi
|
||||
.BE
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
The \fBzvfs\fR package provides tcl with the ability to manipulate
|
||||
the contents of a zip file archive as a virtual file system.
|
||||
.TP
|
||||
\fB::zvfs::mount ?\fIarchive\fR? ?\fImountpoint\fR?
|
||||
.
|
||||
The \fB::zvfs::mount\fR procedure mounts a zipfile as a VFS.
|
||||
After this command
|
||||
executes, files contained in the ZIP archive, \fIarchive\fR, will appear to Tcl to be
|
||||
regular files at the mount point.
|
||||
.RS
|
||||
.PP
|
||||
With no \fImountpoint\fR, returns the mount point for \fIarchive\fR. With no \fIarchive\fR,
|
||||
return all archive/mount pairs. If \fImountpoint\fR is specified as an empty
|
||||
string, mount on file path.
|
||||
.RE
|
||||
.TP
|
||||
\fB::zvfs::unmount \fIarchive\fR
|
||||
.
|
||||
Unmounts a previously mounted zip, \fIarchive\fR.
|
||||
.TP
|
||||
\fB::zvfs::append\fR \fIarchive\fR ?\fIsource destination\fR? ?\fIsource destination...\fR?
|
||||
.
|
||||
This command reads \fIsource\fR files and appends them (using the name
|
||||
\fIdestination\fR) to the zip archive named \fIarchive\fR. A new zip archive is created
|
||||
if it does not already exist. If \fIarchive\fR refers to a file which exists but
|
||||
is not a zip archive, then this command turns \fIarchive\fR into a zip archive by
|
||||
appending the necessary records and the table of contents. Treat all files
|
||||
as binary.
|
||||
.RS
|
||||
.PP
|
||||
Note: No duplicate checking is done, so multiple occurances of the same file is
|
||||
allowed.
|
||||
.RE
|
||||
.TP
|
||||
\fB::zvfs::add\fR ?\fB\-fconfigure \fIoptpairs...\fR? \fIarchive file1\fR ?\fIfile2 ...\fR?
|
||||
.
|
||||
This command is similar to \fBzvfs::append\fR in that it adds files to the zip archive
|
||||
named \fIarchive\fR, however file names are relative the current directory. In
|
||||
addition, \fBfconfigure\fR is used to apply option pairs to set upon opening of
|
||||
each file. Otherwise, default translation is allowed for those file
|
||||
extensions listed in the \fB::zvfs::auto_ext\fR variable. Binary translation will be
|
||||
used for unknown extensions.
|
||||
.RS
|
||||
.PP
|
||||
NOTE: Use
|
||||
.QW "\fB\-fconfigure {}\fR"
|
||||
to use auto translation for all.
|
||||
.RE
|
||||
.TP
|
||||
\fB::zvfs::exists\fR \fIfilename\fR
|
||||
.
|
||||
Return TRUE if the given filename exists in the mounted ZVFS and FALSE if it does
|
||||
not.
|
||||
.TP
|
||||
\fB::zvfs::info\fR \fIfile\fR
|
||||
.
|
||||
Return information about the given file in the mounted ZVFS. The information
|
||||
consists of (1) the name of the ZIP archive that contains the file, (2) the
|
||||
size of the file after decompressions, (3) the compressed size of the file,
|
||||
and (4) the offset of the compressed data in the archive.
|
||||
.RS
|
||||
.PP
|
||||
Note: querying the mount point gives the start of zip data offset in (4),
|
||||
which can be used to truncate the zip info off an executable.
|
||||
.RE
|
||||
.TP
|
||||
\fB::zvfs::list\fR ?\fB\-glob\fR|\fB\-regexp\fR? ?\fIpattern\fR?
|
||||
.
|
||||
Return a list of all files in the mounted ZVFS. The order of the names in the list
|
||||
is arbitrary.
|
||||
.TP
|
||||
\fB::zvfs::dump\fR \fIzipfile\fR
|
||||
.
|
||||
Describe the contents of a zip.
|
||||
.TP
|
||||
\fB::zvfs::start\fR \fIzipfile\fR
|
||||
.
|
||||
This command strips returns the offset of zip data.
|
||||
.SH "SEE ALSO"
|
||||
tclsh(1), file(n), zlib(n)
|
||||
.SH "KEYWORDS"
|
||||
compress, filesystem, zip
|
||||
'\" Local Variables:
|
||||
'\" mode: nroff
|
||||
'\" End:
|
||||
+386
@@ -0,0 +1,386 @@
|
||||
/*
|
||||
* used to be: tclsh gen-l-ast2.tcl to regenerate
|
||||
* As of Feb 2008 it is maintained by hand.
|
||||
*/
|
||||
#include "tclInt.h"
|
||||
#include "Lcompile.h"
|
||||
|
||||
private void
|
||||
ast_init(void *node, Node_k type, YYLTYPE beg, YYLTYPE end)
|
||||
{
|
||||
Ast *ast = (Ast *)node;
|
||||
|
||||
ast->type = type;
|
||||
ast->loc.beg = beg.beg;
|
||||
ast->loc.end = end.end;
|
||||
ast->loc.line = beg.line;
|
||||
ast->loc.file = beg.file;
|
||||
ast->next = L->ast_list;
|
||||
L->ast_list = (void *)ast;
|
||||
}
|
||||
|
||||
Block *
|
||||
ast_mkBlock(VarDecl *decls, Stmt *body, YYLTYPE beg, YYLTYPE end)
|
||||
{
|
||||
Block *block = (Block *)ckalloc(sizeof(Block));
|
||||
memset(block, 0, sizeof(Block));
|
||||
block->body = body;
|
||||
block->decls = decls;
|
||||
ast_init(block, L_NODE_BLOCK, beg, end);
|
||||
return (block);
|
||||
}
|
||||
|
||||
Expr *
|
||||
ast_mkExpr(Expr_k kind, Op_k op, Expr *a, Expr *b, Expr *c, YYLTYPE beg,
|
||||
YYLTYPE end)
|
||||
{
|
||||
Expr *expr = (Expr *)ckalloc(sizeof(Expr));
|
||||
memset(expr, 0, sizeof(Expr));
|
||||
expr->a = a;
|
||||
expr->b = b;
|
||||
expr->c = c;
|
||||
expr->kind = kind;
|
||||
expr->op = op;
|
||||
ast_init(expr, L_NODE_EXPR, beg, end);
|
||||
return (expr);
|
||||
}
|
||||
|
||||
ForEach *
|
||||
ast_mkForeach(Expr *expr, Expr *key, Expr *value, Stmt *body,
|
||||
YYLTYPE beg, YYLTYPE end)
|
||||
{
|
||||
ForEach *foreach = (ForEach *)ckalloc(sizeof(ForEach));
|
||||
memset(foreach, 0, sizeof(ForEach));
|
||||
foreach->expr = expr;
|
||||
foreach->key = key;
|
||||
foreach->value = value;
|
||||
foreach->body = body;
|
||||
ast_init(foreach, L_NODE_FOREACH_LOOP, beg, end);
|
||||
return (foreach);
|
||||
}
|
||||
|
||||
FnDecl *
|
||||
ast_mkFnDecl(VarDecl *decl, Block *body, YYLTYPE beg, YYLTYPE end)
|
||||
{
|
||||
FnDecl *fndecl = (FnDecl *)ckalloc(sizeof(FnDecl));
|
||||
memset(fndecl, 0, sizeof(FnDecl));
|
||||
fndecl->body = body;
|
||||
fndecl->decl = decl;
|
||||
/*
|
||||
* Propagate tracing attributes from L->options, which come
|
||||
* from cmd-line options or #pragmas. Any attributes
|
||||
* specified in the function declaration end up overwriting
|
||||
* these.
|
||||
*/
|
||||
fndecl->attrs = Tcl_NewDictObj();
|
||||
hash_put(fndecl->attrs, "fntrace", hash_get(L->options, "fntrace"));
|
||||
hash_put(fndecl->attrs, "fnhook", hash_get(L->options, "fnhook"));
|
||||
hash_put(fndecl->attrs, "trace_depth",
|
||||
hash_get(L->options, "trace_depth"));
|
||||
ast_init(fndecl, L_NODE_FUNCTION_DECL, beg, end);
|
||||
return (fndecl);
|
||||
}
|
||||
|
||||
Cond *
|
||||
ast_mkIfUnless(Expr *expr, Stmt *if_body, Stmt *else_body, YYLTYPE beg,
|
||||
YYLTYPE end)
|
||||
{
|
||||
Cond *cond = (Cond *)ckalloc(sizeof(Cond));
|
||||
memset(cond, 0, sizeof(Cond));
|
||||
cond->cond = expr;
|
||||
cond->else_body = else_body;
|
||||
cond->if_body = if_body;
|
||||
ast_init(cond, L_NODE_IF_UNLESS, beg, end);
|
||||
return (cond);
|
||||
}
|
||||
|
||||
Loop *
|
||||
ast_mkLoop(Loop_k kind, Expr *pre, Expr *cond, Expr *post, Stmt *body,
|
||||
YYLTYPE beg, YYLTYPE end)
|
||||
{
|
||||
Loop *loop = (Loop *)ckalloc(sizeof(Loop));
|
||||
memset(loop, 0, sizeof(Loop));
|
||||
loop->cond = cond;
|
||||
loop->post = post;
|
||||
loop->pre = pre;
|
||||
loop->kind = kind;
|
||||
loop->body = body;
|
||||
ast_init(loop, L_NODE_LOOP, beg, end);
|
||||
return (loop);
|
||||
}
|
||||
|
||||
Switch *
|
||||
ast_mkSwitch(Expr *expr, Case *cases, YYLTYPE beg, YYLTYPE end)
|
||||
{
|
||||
Switch *sw = (Switch *)ckalloc(sizeof(Switch));
|
||||
memset(sw, 0, sizeof(Switch));
|
||||
sw->expr = expr;
|
||||
sw->cases = cases;
|
||||
ast_init(sw, L_NODE_SWITCH, beg, end);
|
||||
return (sw);
|
||||
}
|
||||
|
||||
Case *
|
||||
ast_mkCase(Expr *expr, Stmt *body, YYLTYPE beg, YYLTYPE end)
|
||||
{
|
||||
Case *c = (Case *)ckalloc(sizeof(Case));
|
||||
memset(c, 0, sizeof(Case));
|
||||
c->expr = expr;
|
||||
c->body = body;
|
||||
ast_init(c, L_NODE_CASE, beg, end);
|
||||
return (c);
|
||||
}
|
||||
|
||||
Try *
|
||||
ast_mkTry(Stmt *try, Expr *msg, Stmt *catch)
|
||||
{
|
||||
Try *t = (Try *)ckalloc(sizeof(Try));
|
||||
memset(t, 0, sizeof(Try));
|
||||
t->try = try;
|
||||
t->msg = msg;
|
||||
t->catch = catch;
|
||||
return (t);
|
||||
}
|
||||
|
||||
Stmt *
|
||||
ast_mkStmt(Stmt_k kind, Stmt *next, YYLTYPE beg, YYLTYPE end)
|
||||
{
|
||||
Stmt *stmt = (Stmt *)ckalloc(sizeof(Stmt));
|
||||
memset(stmt, 0, sizeof(Stmt));
|
||||
stmt->next = next;
|
||||
stmt->kind = kind;
|
||||
ast_init(stmt, L_NODE_STMT, beg, end);
|
||||
return (stmt);
|
||||
}
|
||||
|
||||
TopLev *
|
||||
ast_mkTopLevel(Toplv_k kind, TopLev *next, YYLTYPE beg, YYLTYPE end)
|
||||
{
|
||||
TopLev *toplev = (TopLev *)ckalloc(sizeof(TopLev));
|
||||
memset(toplev, 0, sizeof(TopLev));
|
||||
toplev->next = next;
|
||||
toplev->kind = kind;
|
||||
ast_init(toplev, L_NODE_TOPLEVEL, beg, end);
|
||||
return (toplev);
|
||||
}
|
||||
|
||||
VarDecl *
|
||||
ast_mkVarDecl(Type *type, Expr *id, YYLTYPE beg, YYLTYPE end)
|
||||
{
|
||||
VarDecl *vardecl = (VarDecl *)ckalloc(sizeof(VarDecl));
|
||||
memset(vardecl, 0, sizeof(VarDecl));
|
||||
vardecl->id = id;
|
||||
vardecl->type = type;
|
||||
ast_init(vardecl, L_NODE_VAR_DECL, beg, end);
|
||||
return (vardecl);
|
||||
}
|
||||
|
||||
ClsDecl *
|
||||
ast_mkClsDecl(VarDecl *decl, YYLTYPE beg, YYLTYPE end)
|
||||
{
|
||||
ClsDecl *clsdecl = (ClsDecl *)ckalloc(sizeof(ClsDecl));
|
||||
memset(clsdecl, 0, sizeof(ClsDecl));
|
||||
clsdecl->decl = decl;
|
||||
ast_init(clsdecl, L_NODE_CLASS_DECL, beg, end);
|
||||
return (clsdecl);
|
||||
}
|
||||
|
||||
/* Build a default constructor if the user didn't provide one. */
|
||||
FnDecl *
|
||||
ast_mkConstructor(ClsDecl *class)
|
||||
{
|
||||
char *name;
|
||||
Type *type;
|
||||
Expr *id;
|
||||
VarDecl *decl;
|
||||
Block *block;
|
||||
FnDecl *fn;
|
||||
YYLTYPE loc = class->node.loc;
|
||||
|
||||
type = type_mkFunc(class->decl->type, NULL);
|
||||
name = cksprintf("%s_new", class->decl->id->str);
|
||||
id = ast_mkId(name, loc, loc);
|
||||
decl = ast_mkVarDecl(type, id, loc, loc);
|
||||
decl->flags |= SCOPE_GLOBAL | DECL_CLASS_FN | DECL_PUBLIC |
|
||||
DECL_CLASS_CONST;
|
||||
decl->clsdecl = class;
|
||||
block = ast_mkBlock(NULL, NULL, loc, loc);
|
||||
fn = ast_mkFnDecl(decl, block, loc, loc);
|
||||
|
||||
return (fn);
|
||||
}
|
||||
|
||||
/* Build a default destructor if the user didn't provide one. */
|
||||
FnDecl *
|
||||
ast_mkDestructor(ClsDecl *class)
|
||||
{
|
||||
char *name;
|
||||
Type *type;
|
||||
Expr *id, *self;
|
||||
VarDecl *decl, *parm;
|
||||
Block *block;
|
||||
FnDecl *fn;
|
||||
YYLTYPE loc = class->node.loc;
|
||||
|
||||
self = ast_mkId("self", loc, loc);
|
||||
parm = ast_mkVarDecl(class->decl->type, self, loc, loc);
|
||||
parm->flags = SCOPE_LOCAL | DECL_LOCAL_VAR;
|
||||
type = type_mkFunc(L_void, parm);
|
||||
name = cksprintf("%s_delete", class->decl->id->str);
|
||||
id = ast_mkId(name, loc, loc);
|
||||
decl = ast_mkVarDecl(type, id, loc, loc);
|
||||
decl->flags |= SCOPE_GLOBAL | DECL_CLASS_FN | DECL_PUBLIC |
|
||||
DECL_CLASS_DESTR;
|
||||
decl->clsdecl = class;
|
||||
block = ast_mkBlock(NULL, NULL, loc, loc);
|
||||
fn = ast_mkFnDecl(decl, block, loc, loc);
|
||||
|
||||
return (fn);
|
||||
}
|
||||
|
||||
Expr *
|
||||
ast_mkUnOp(Op_k op, Expr *e1, YYLTYPE beg, YYLTYPE end)
|
||||
{
|
||||
return (ast_mkExpr(L_EXPR_UNOP, op, e1, NULL, NULL, beg, end));
|
||||
}
|
||||
|
||||
Expr *
|
||||
ast_mkBinOp(Op_k op, Expr *e1, Expr *e2, YYLTYPE beg, YYLTYPE end)
|
||||
{
|
||||
return (ast_mkExpr(L_EXPR_BINOP, op, e1, e2, NULL, beg, end));
|
||||
}
|
||||
|
||||
Expr *
|
||||
ast_mkTrinOp(Op_k op, Expr *e1, Expr *e2, Expr *e3, YYLTYPE beg,
|
||||
YYLTYPE end)
|
||||
{
|
||||
return (ast_mkExpr(L_EXPR_TRINOP, op, e1, e2, e3, beg, end));
|
||||
}
|
||||
|
||||
Expr *
|
||||
ast_mkConst(Type *type, char *str, YYLTYPE beg, YYLTYPE end)
|
||||
{
|
||||
Expr *e = ast_mkExpr(L_EXPR_CONST, L_OP_NONE, NULL, NULL, NULL,
|
||||
beg, end);
|
||||
e->type = type;
|
||||
e->str = str;
|
||||
return (e);
|
||||
}
|
||||
|
||||
Expr *
|
||||
ast_mkRegexp(char *re, YYLTYPE beg, YYLTYPE end)
|
||||
{
|
||||
Expr *e = ast_mkExpr(L_EXPR_RE, L_OP_NONE, NULL, NULL, NULL, beg, end);
|
||||
e->str = re;
|
||||
e->type = L_string;
|
||||
return (e);
|
||||
}
|
||||
|
||||
Expr *
|
||||
ast_mkFnCall(Expr *id, Expr *arg_list, YYLTYPE beg, YYLTYPE end)
|
||||
{
|
||||
Expr *e = ast_mkExpr(L_EXPR_FUNCALL, L_OP_NONE, id, arg_list, NULL,
|
||||
beg, end);
|
||||
return (e);
|
||||
}
|
||||
|
||||
Expr *
|
||||
ast_mkId(char *name, YYLTYPE beg, YYLTYPE end)
|
||||
{
|
||||
Expr *e = ast_mkExpr(L_EXPR_ID, L_OP_NONE, NULL, NULL, NULL, beg, end);
|
||||
e->str = ckstrdup(name);
|
||||
return (e);
|
||||
}
|
||||
|
||||
private Type *
|
||||
type_alloc(Type_k kind)
|
||||
{
|
||||
Type *type = (Type *)ckalloc(sizeof(Type));
|
||||
memset(type, 0, sizeof(Type));
|
||||
type->kind = kind;
|
||||
type->list = L->type_list;
|
||||
L->type_list = type;
|
||||
return (type);
|
||||
}
|
||||
|
||||
Type *
|
||||
type_dup(Type *type)
|
||||
{
|
||||
Type *dup = (Type *)ckalloc(sizeof(Type));
|
||||
*dup = *type;
|
||||
if (type->name) {
|
||||
dup->name = ckstrdup(type->name);
|
||||
}
|
||||
if ((type->kind == L_STRUCT) && type->u.struc.tag) {
|
||||
dup->u.struc.tag = ckstrdup(type->u.struc.tag);
|
||||
}
|
||||
dup->list = L->type_list;
|
||||
L->type_list = dup;
|
||||
return (dup);
|
||||
}
|
||||
|
||||
Type *
|
||||
type_mkScalar(Type_k kind)
|
||||
{
|
||||
Type *type = type_alloc(kind);
|
||||
return (type);
|
||||
}
|
||||
|
||||
Type *
|
||||
type_mkArray(Expr *size, Type *base_type)
|
||||
{
|
||||
Type *type = type_alloc(L_ARRAY);
|
||||
type->u.array.size = size;
|
||||
type->base_type = base_type;
|
||||
return (type);
|
||||
}
|
||||
|
||||
Type *
|
||||
type_mkHash(Type *index_type, Type *base_type)
|
||||
{
|
||||
Type *type = type_alloc(L_HASH);
|
||||
type->u.hash.idx_type = index_type;
|
||||
type->base_type = base_type;
|
||||
return (type);
|
||||
}
|
||||
|
||||
Type *
|
||||
type_mkStruct(char *tag, VarDecl *members)
|
||||
{
|
||||
Type *type = type_alloc(L_STRUCT);
|
||||
type->u.struc.tag = ckstrdup(tag);
|
||||
type->u.struc.members = members;
|
||||
return (type);
|
||||
}
|
||||
|
||||
Type *
|
||||
type_mkNameOf(Type *base_type)
|
||||
{
|
||||
Type *type = type_alloc(L_NAMEOF);
|
||||
type->base_type = base_type;
|
||||
return (type);
|
||||
}
|
||||
|
||||
Type *
|
||||
type_mkFunc(Type *ret_type, VarDecl *formals)
|
||||
{
|
||||
Type *type = type_alloc(L_FUNCTION);
|
||||
type->base_type = ret_type;
|
||||
type->u.func.formals = formals;
|
||||
return (type);
|
||||
}
|
||||
|
||||
Type *
|
||||
type_mkList(Type *a)
|
||||
{
|
||||
Type *type = type_alloc(L_LIST);
|
||||
type->base_type = a;
|
||||
return (type);
|
||||
}
|
||||
|
||||
Type *
|
||||
type_mkClass(void)
|
||||
{
|
||||
Type *type = type_alloc(L_CLASS);
|
||||
return (type);
|
||||
}
|
||||
+490
@@ -0,0 +1,490 @@
|
||||
/*
|
||||
* used to be: tclsh gen-l-ast2.tcl to regenerate
|
||||
* As of Feb 2008 it is maintained by hand.
|
||||
*/
|
||||
#ifndef L_AST_H
|
||||
#define L_AST_H
|
||||
|
||||
#define unless(p) if (!(p))
|
||||
#define private static
|
||||
|
||||
typedef struct Ast Ast;
|
||||
typedef struct Block Block;
|
||||
typedef struct VarDecl VarDecl;
|
||||
typedef struct FnDecl FnDecl;
|
||||
typedef struct ClsDecl ClsDecl;
|
||||
typedef struct Stmt Stmt;
|
||||
typedef struct TopLev TopLev;
|
||||
typedef struct ClsLev ClsLev;
|
||||
typedef struct Cond Cond;
|
||||
typedef struct Loop Loop;
|
||||
typedef struct ForEach ForEach;
|
||||
typedef struct Switch Switch;
|
||||
typedef struct Case Case;
|
||||
typedef struct Expr Expr;
|
||||
typedef struct Type Type;
|
||||
typedef struct Try Try;
|
||||
typedef struct Sym Sym;
|
||||
|
||||
/*
|
||||
* Source-file offset and line # of an AST node, token, or
|
||||
* nonterminal. Set by the scanner and parser.
|
||||
*/
|
||||
typedef struct {
|
||||
int beg; // source offset of first char
|
||||
int end; // source offset of last char + 1
|
||||
int line; // line # of first char adjusted for any #include's
|
||||
char *file; // file name
|
||||
} YYLTYPE;
|
||||
#define YYLTYPE YYLTYPE
|
||||
|
||||
typedef enum {
|
||||
L_LOOP_DO,
|
||||
L_LOOP_FOR,
|
||||
L_LOOP_WHILE,
|
||||
} Loop_k;
|
||||
|
||||
typedef enum {
|
||||
L_STMT_BLOCK,
|
||||
L_STMT_BREAK,
|
||||
L_STMT_COND,
|
||||
L_STMT_CONTINUE,
|
||||
L_STMT_DECL,
|
||||
L_STMT_EXPR,
|
||||
L_STMT_FOREACH,
|
||||
L_STMT_SWITCH,
|
||||
L_STMT_LOOP,
|
||||
L_STMT_RETURN,
|
||||
L_STMT_GOTO,
|
||||
L_STMT_LABEL,
|
||||
L_STMT_PRAGMA,
|
||||
L_STMT_TRY,
|
||||
} Stmt_k;
|
||||
|
||||
typedef enum {
|
||||
L_TOPLEVEL_CLASS,
|
||||
L_TOPLEVEL_FUN,
|
||||
L_TOPLEVEL_GLOBAL,
|
||||
L_TOPLEVEL_STMT,
|
||||
} Toplv_k;
|
||||
|
||||
typedef enum {
|
||||
L_NODE_BLOCK,
|
||||
L_NODE_EXPR,
|
||||
L_NODE_FOREACH_LOOP,
|
||||
L_NODE_FUNCTION_DECL,
|
||||
L_NODE_IF_UNLESS,
|
||||
L_NODE_SWITCH,
|
||||
L_NODE_CASE,
|
||||
L_NODE_LOOP,
|
||||
L_NODE_STMT,
|
||||
L_NODE_TOPLEVEL,
|
||||
L_NODE_CLSLEVEL,
|
||||
L_NODE_VAR_DECL,
|
||||
L_NODE_CLASS_DECL,
|
||||
} Node_k;
|
||||
|
||||
/*
|
||||
* A compiler temp.
|
||||
*/
|
||||
typedef struct Tmp Tmp;
|
||||
struct Tmp {
|
||||
int free;
|
||||
int idx; // local variable slot #
|
||||
char *name;
|
||||
Tmp *next;
|
||||
};
|
||||
|
||||
/*
|
||||
* An L type name is represented with exactly one instance of a
|
||||
* Type structure. All references to the type name point to that
|
||||
* structure, so pointer comparison can be used to check for name
|
||||
* equivalence of types.
|
||||
*
|
||||
* L_int, L_float, etc are the global Type pointers for the
|
||||
* pre-defined types. L_INT, L_FLOAT, etc are the type kinds
|
||||
* (enum) used in the type structure.
|
||||
*
|
||||
* L_NAMEOF is like an address in other languages. An expression
|
||||
* of this type holds the name of an lvalue (e.g., &p has the value
|
||||
* "p"). The base_type is the type of the name.
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
L_INT = 0x0001,
|
||||
L_FLOAT = 0x0002,
|
||||
L_STRING = 0x0004,
|
||||
L_ARRAY = 0x0008,
|
||||
L_HASH = 0x0010,
|
||||
L_STRUCT = 0x0020,
|
||||
L_LIST = 0x0040,
|
||||
L_VOID = 0x0080,
|
||||
L_POLY = 0x0100,
|
||||
L_NAMEOF = 0x0200,
|
||||
L_FUNCTION = 0x0400,
|
||||
L_CLASS = 0x0800,
|
||||
L_WIDGET = 0x1000,
|
||||
} Type_k;
|
||||
|
||||
struct Type {
|
||||
Type_k kind;
|
||||
Type *base_type; // for array, hash, list, nameof, etc
|
||||
Type *next; // for linking list types
|
||||
char *name; // if a typedef, the type name being declared
|
||||
union {
|
||||
struct {
|
||||
Expr *size;
|
||||
} array;
|
||||
struct {
|
||||
Type *idx_type;
|
||||
} hash;
|
||||
struct {
|
||||
char *tag;
|
||||
VarDecl *members;
|
||||
} struc;
|
||||
struct {
|
||||
VarDecl *formals;
|
||||
} func;
|
||||
struct {
|
||||
ClsDecl *clsdecl;
|
||||
} class;
|
||||
} u;
|
||||
Type *list; // links all type structures ever allocated
|
||||
};
|
||||
|
||||
struct Ast {
|
||||
Node_k type;
|
||||
Ast *next; // links all nodes in an AST
|
||||
YYLTYPE loc;
|
||||
};
|
||||
|
||||
struct Block {
|
||||
Ast node;
|
||||
Stmt *body;
|
||||
VarDecl *decls;
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
L_EXPR_ID,
|
||||
L_EXPR_CONST,
|
||||
L_EXPR_FUNCALL,
|
||||
L_EXPR_UNOP,
|
||||
L_EXPR_BINOP,
|
||||
L_EXPR_TRINOP,
|
||||
L_EXPR_RE,
|
||||
} Expr_k;
|
||||
|
||||
typedef enum {
|
||||
L_OP_NONE,
|
||||
L_OP_CAST,
|
||||
L_OP_BANG,
|
||||
L_OP_ADDROF,
|
||||
L_OP_MINUS,
|
||||
L_OP_UMINUS,
|
||||
L_OP_PLUS,
|
||||
L_OP_UPLUS,
|
||||
L_OP_PLUSPLUS_PRE,
|
||||
L_OP_PLUSPLUS_POST,
|
||||
L_OP_MINUSMINUS_PRE,
|
||||
L_OP_MINUSMINUS_POST,
|
||||
L_OP_EQUALS,
|
||||
L_OP_EQPLUS,
|
||||
L_OP_EQMINUS,
|
||||
L_OP_EQSTAR,
|
||||
L_OP_EQSLASH,
|
||||
L_OP_EQPERC,
|
||||
L_OP_EQBITAND,
|
||||
L_OP_EQBITOR,
|
||||
L_OP_EQBITXOR,
|
||||
L_OP_EQLSHIFT,
|
||||
L_OP_EQRSHIFT,
|
||||
L_OP_EQTWID,
|
||||
L_OP_BANGTWID,
|
||||
L_OP_EQDOT,
|
||||
L_OP_STAR,
|
||||
L_OP_SLASH,
|
||||
L_OP_PERC,
|
||||
L_OP_STR_EQ,
|
||||
L_OP_STR_NE,
|
||||
L_OP_STR_GT,
|
||||
L_OP_STR_LT,
|
||||
L_OP_STR_GE,
|
||||
L_OP_STR_LE,
|
||||
L_OP_EQUALEQUAL,
|
||||
L_OP_NOTEQUAL,
|
||||
L_OP_GREATER,
|
||||
L_OP_LESSTHAN,
|
||||
L_OP_GREATEREQ,
|
||||
L_OP_LESSTHANEQ,
|
||||
L_OP_ANDAND,
|
||||
L_OP_OROR,
|
||||
L_OP_LSHIFT,
|
||||
L_OP_RSHIFT,
|
||||
L_OP_BITOR,
|
||||
L_OP_BITAND,
|
||||
L_OP_BITXOR,
|
||||
L_OP_BITNOT,
|
||||
L_OP_DEFINED,
|
||||
L_OP_ARRAY_INDEX,
|
||||
L_OP_HASH_INDEX,
|
||||
L_OP_DOT,
|
||||
L_OP_POINTS,
|
||||
L_OP_CLASS_INDEX,
|
||||
L_OP_INTERP_STRING,
|
||||
L_OP_INTERP_RE,
|
||||
L_OP_LIST,
|
||||
L_OP_KV,
|
||||
L_OP_COMMA,
|
||||
L_OP_ARRAY_SLICE,
|
||||
L_OP_EXPAND,
|
||||
L_OP_CONCAT,
|
||||
L_OP_CMDSUBST,
|
||||
L_OP_TERNARY_COND,
|
||||
L_OP_FILE,
|
||||
} Op_k;
|
||||
|
||||
/*
|
||||
* Flags for L expression compilation. Bits are used for simplicity
|
||||
* even though some of these are mutually exclusive. These are used
|
||||
* in various places such as calls to compile_expr() and in the AST.
|
||||
*/
|
||||
typedef enum {
|
||||
L_EXPR_RE_I = 0x00000001, // expr is an re with "i" qualifier
|
||||
L_EXPR_RE_G = 0x00000002, // expr is an re with "g" qualifier
|
||||
L_EXPR_RE_T = 0x00000004, // expr is an re with "t" qualifier
|
||||
L_EXPR_DEEP = 0x00000008, // expr is the result of a deep dive
|
||||
L_IDX_ARRAY = 0x00000010, // what kind of thing we're indexing
|
||||
L_IDX_HASH = 0x00000020,
|
||||
L_IDX_STRING = 0x00000040,
|
||||
L_LVALUE = 0x00000080, // if we will be writing the obj
|
||||
L_DELETE = 0x00000100, // delete from parent hash/array/string
|
||||
L_PUSH_VAL = 0x00000200, // what we want INST_L_INDEX to leave on
|
||||
L_PUSH_PTR = 0x00000400, // the stack
|
||||
L_PUSH_VALPTR = 0x00000800,
|
||||
L_PUSH_PTRVAL = 0x00001000,
|
||||
L_DISCARD = 0x00002000, // have compile_expr push nothing
|
||||
L_PUSH_NAME = 0x00004000, // have compile_expr push name not val
|
||||
L_PUSH_NEW = 0x00008000, // whether INST_L_DEEP_WRITE should push
|
||||
L_PUSH_OLD = 0x00010000, // the new or old value
|
||||
L_SAVE_IDX = 0x00020000, // save idx to a tmp var (for copy in/out)
|
||||
L_REUSE_IDX = 0x00040000, // get idx from tmp var instead of expr
|
||||
L_NOTUSED = 0x00080000, // do not update used_p in symtab entry
|
||||
L_NOWARN = 0x00100000, // issue no err if symbol undefined
|
||||
L_SPLIT_RE = 0x00200000, // split on a regexp
|
||||
L_SPLIT_STR = 0x00400000, // split on a string
|
||||
L_SPLIT_LIM = 0x00800000, // enforce split limit
|
||||
L_INSERT_ELT = 0x01000000, // insert a single elt into a list
|
||||
L_INSERT_LIST = 0x02000000, // insert a list into a list
|
||||
L_NEG_OK = 0x04000000, // indexing element -1 is OK
|
||||
L_EXPR_RE_L = 0x08000000, // expr is an re with "l" qualifier
|
||||
} Expr_f;
|
||||
|
||||
struct Expr {
|
||||
Ast node;
|
||||
Expr_k kind;
|
||||
Op_k op;
|
||||
Type *type;
|
||||
Expr *a;
|
||||
Expr *b;
|
||||
Expr *c;
|
||||
Expr_f flags;
|
||||
Sym *sym; // for id, ptr to symbol table entry
|
||||
char *str; // for constants/id/re/struct-index
|
||||
union {
|
||||
struct {
|
||||
Tmp *idx;
|
||||
Tmp *val;
|
||||
} deepdive;
|
||||
} u;
|
||||
Expr *next;
|
||||
};
|
||||
|
||||
struct ForEach {
|
||||
Ast node;
|
||||
Expr *expr;
|
||||
Expr *key;
|
||||
Expr *value;
|
||||
Stmt *body;
|
||||
};
|
||||
|
||||
struct FnDecl {
|
||||
Ast node;
|
||||
Block *body;
|
||||
VarDecl *decl;
|
||||
FnDecl *next;
|
||||
Tcl_Obj *attrs; // hash of function attributes, if any
|
||||
};
|
||||
|
||||
struct ClsDecl {
|
||||
Ast node;
|
||||
VarDecl *decl;
|
||||
VarDecl *clsvars;
|
||||
VarDecl *instvars;
|
||||
FnDecl *fns;
|
||||
FnDecl *constructors;
|
||||
FnDecl *destructors;
|
||||
Tcl_HashTable *symtab;
|
||||
};
|
||||
|
||||
struct Cond {
|
||||
Ast node;
|
||||
Expr *cond;
|
||||
Stmt *else_body;
|
||||
Stmt *if_body;
|
||||
};
|
||||
|
||||
struct Loop {
|
||||
Ast node;
|
||||
Expr *cond;
|
||||
Expr *post;
|
||||
Expr *pre;
|
||||
Loop_k kind;
|
||||
Stmt *body;
|
||||
};
|
||||
|
||||
struct Switch {
|
||||
Ast node;
|
||||
Expr *expr;
|
||||
Case *cases;
|
||||
};
|
||||
|
||||
struct Case {
|
||||
Ast node;
|
||||
Expr *expr;
|
||||
Stmt *body;
|
||||
Case *next;
|
||||
};
|
||||
|
||||
struct Try {
|
||||
Ast node;
|
||||
Stmt *try;
|
||||
Stmt *catch;
|
||||
Expr *msg;
|
||||
};
|
||||
|
||||
struct Stmt {
|
||||
Ast node;
|
||||
Stmt *next;
|
||||
Stmt_k kind;
|
||||
union {
|
||||
Block *block;
|
||||
Expr *expr;
|
||||
ForEach *foreach;
|
||||
Cond *cond;
|
||||
Loop *loop;
|
||||
Switch *swich; // not a typo -- illegal to call it "switch"
|
||||
VarDecl *decl;
|
||||
char *label;
|
||||
Try *try;
|
||||
} u;
|
||||
};
|
||||
|
||||
struct TopLev {
|
||||
Ast node;
|
||||
TopLev *next;
|
||||
Toplv_k kind;
|
||||
union {
|
||||
ClsDecl *class;
|
||||
FnDecl *fun;
|
||||
Stmt *stmt;
|
||||
VarDecl *global;
|
||||
} u;
|
||||
};
|
||||
|
||||
/*
|
||||
* These encode both scope information and the kind of declaration.
|
||||
* Some flags are redundant but were chosen for clarity.
|
||||
*/
|
||||
typedef enum {
|
||||
SCOPE_LOCAL = 0x00000001, // scope the symbol should go in
|
||||
SCOPE_SCRIPT = 0x00000002, // visible in current script
|
||||
SCOPE_GLOBAL = 0x00000004, // visible across scripts
|
||||
SCOPE_CLASS = 0x00000008, // visible in a class
|
||||
DECL_GLOBAL_VAR = 0x00000010, // the kind of declaration
|
||||
DECL_LOCAL_VAR = 0x00000020,
|
||||
DECL_ERR = 0x00000040, // added on undeclared var
|
||||
DECL_FN = 0x00000080, // regular function
|
||||
DECL_CLASS_VAR = 0x00000100, // class variable
|
||||
DECL_CLASS_INST_VAR = 0x00000200, // class instance variable
|
||||
DECL_CLASS_FN = 0x00000400, // class member fn
|
||||
DECL_CLASS_CONST = 0x00000800, // class constructor
|
||||
DECL_CLASS_DESTR = 0x00001000, // class destructor
|
||||
DECL_REST_ARG = 0x00002000, // ...arg formal parameter
|
||||
DECL_EXTERN = 0x00004000, // decl has extern qualifier
|
||||
DECL_PRIVATE = 0x00008000, // decl has private qualifier
|
||||
DECL_PUBLIC = 0x00010000, // decl has public qualifier
|
||||
DECL_REF = 0x00020000, // decl has & qualifier
|
||||
DECL_ARGUSED = 0x00040000, // decl has _argused qualifier
|
||||
DECL_OPTIONAL = 0x00080000, // decl has _optional qualifier
|
||||
DECL_NAME_EQUIV = 0x00100000, // decl has _mustbetype qualifier
|
||||
DECL_FORWARD = 0x00200000, // a forward decl
|
||||
DECL_DONE = 0x00400000, // decl already processed
|
||||
FN_PROTO_ONLY = 0x00800000, // compile fn proto only
|
||||
FN_PROTO_AND_BODY = 0x01000000, // compile entire fn decl
|
||||
} Decl_f;
|
||||
|
||||
struct VarDecl {
|
||||
Ast node;
|
||||
Expr *id;
|
||||
char *tclprefix; // prepend to L var name to create Tcl var name
|
||||
Expr *initializer;
|
||||
Expr *attrs; // optional _attributes(...)
|
||||
Type *type;
|
||||
ClsDecl *clsdecl; // for class member fns, class & instance vars
|
||||
Sym *refsym; // for a call-by-ref parm x, ptr to &x sym
|
||||
VarDecl *next;
|
||||
Decl_f flags;
|
||||
};
|
||||
|
||||
extern Expr *ast_mkBinOp(Op_k op, Expr *e1, Expr *e2, YYLTYPE beg,
|
||||
YYLTYPE end);
|
||||
extern Block *ast_mkBlock(VarDecl *decls,Stmt *body, YYLTYPE beg,
|
||||
YYLTYPE end);
|
||||
extern Case *ast_mkCase(Expr *expr, Stmt *body, YYLTYPE beg,
|
||||
YYLTYPE end);
|
||||
extern ClsDecl *ast_mkClsDecl(VarDecl *decl, YYLTYPE beg, YYLTYPE end);
|
||||
extern Expr *ast_mkConst(Type *type, char *str, YYLTYPE beg,
|
||||
YYLTYPE end);
|
||||
extern FnDecl *ast_mkConstructor(ClsDecl *class);
|
||||
extern FnDecl *ast_mkDestructor(ClsDecl *class);
|
||||
extern Expr *ast_mkExpr(Expr_k kind, Op_k op, Expr *a, Expr *b, Expr *c,
|
||||
YYLTYPE beg, YYLTYPE end);
|
||||
extern Expr *ast_mkFnCall(Expr *id, Expr *arg_list, YYLTYPE beg,
|
||||
YYLTYPE end);
|
||||
extern FnDecl *ast_mkFnDecl(VarDecl *decl, Block *body, YYLTYPE beg,
|
||||
YYLTYPE end);
|
||||
extern ForEach *ast_mkForeach(Expr *hash, Expr *key, Expr *value,
|
||||
Stmt *body, YYLTYPE beg, YYLTYPE end);
|
||||
extern Expr *ast_mkId(char *name, YYLTYPE beg, YYLTYPE end);
|
||||
extern Cond *ast_mkIfUnless(Expr *expr, Stmt *if_body, Stmt *else_body,
|
||||
YYLTYPE beg, YYLTYPE end);
|
||||
extern Loop *ast_mkLoop(Loop_k kind, Expr *pre, Expr *cond, Expr *post,
|
||||
Stmt *body, YYLTYPE beg, YYLTYPE end);
|
||||
extern Expr *ast_mkRegexp(char *re, YYLTYPE beg, YYLTYPE end);
|
||||
extern Stmt *ast_mkStmt(Stmt_k kind, Stmt *next, YYLTYPE beg,
|
||||
YYLTYPE end);
|
||||
extern Switch *ast_mkSwitch(Expr *expr, Case *cases, YYLTYPE beg,
|
||||
YYLTYPE end);
|
||||
extern TopLev *ast_mkTopLevel(Toplv_k kind, TopLev *next, YYLTYPE beg,
|
||||
YYLTYPE end);
|
||||
extern Expr *ast_mkTrinOp(Op_k op, Expr *e1, Expr *e2, Expr *e3,
|
||||
YYLTYPE beg, YYLTYPE end);
|
||||
extern Try *ast_mkTry(Stmt *try, Expr *msg, Stmt *catch);
|
||||
extern Expr *ast_mkUnOp(Op_k op, Expr *e1, YYLTYPE beg, YYLTYPE end);
|
||||
extern VarDecl *ast_mkVarDecl(Type *type, Expr *name, YYLTYPE beg,
|
||||
YYLTYPE end);
|
||||
extern void hash_dump(Tcl_Obj *hash);
|
||||
extern char *hash_get(Tcl_Obj *hash, char *key);
|
||||
extern void hash_put(Tcl_Obj *hash, char *key, char *val);
|
||||
extern void hash_rm(Tcl_Obj *hash, char *key);
|
||||
extern Type *type_dup(Type *type);
|
||||
extern Type *type_mkArray(Expr *size, Type *base_type);
|
||||
extern Type *type_mkClass(void);
|
||||
extern Type *type_mkFunc(Type *base_type, VarDecl *formals);
|
||||
extern Type *type_mkHash(Type *index_type, Type *base_type);
|
||||
extern Type *type_mkList(Type *a);
|
||||
extern Type *type_mkNameOf(Type *base_type);
|
||||
extern Type *type_mkScalar(Type_k kind);
|
||||
extern Type *type_mkStruct(char *tag, VarDecl *members);
|
||||
|
||||
#endif /* L_AST_H */
|
||||
+8167
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,606 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2008 BitMover, Inc.
|
||||
*/
|
||||
#ifndef L_COMPILE_H
|
||||
#define L_COMPILE_H
|
||||
|
||||
#include <setjmp.h>
|
||||
#include "tclInt.h"
|
||||
#include "tclCompile.h"
|
||||
#include "Last.h"
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
/* For jump fix-ups. */
|
||||
typedef struct Jmp Jmp;
|
||||
struct Jmp {
|
||||
int op; // jmp instruction bytecode (e.g., INST_JUMP1)
|
||||
int size; // size of jmp instruction (1 or 4 bytes)
|
||||
int offset; // bytecode offset of jmp instruction
|
||||
Jmp *next;
|
||||
};
|
||||
|
||||
/* Semantic stack frame. */
|
||||
typedef enum {
|
||||
OUTER = 0x0001, // is outer-most
|
||||
SCRIPT = 0x0002, // is file scope
|
||||
TOPLEV = 0x0004, // is for file top-levels
|
||||
CLS_OUTER = 0x0008, // is class outer-most
|
||||
CLS_TOPLEV = 0x0010, // is for class top-levels
|
||||
FUNC = 0x0020, // frame is at top level of a proc
|
||||
LOOP = 0x0040, // frame is for a loop
|
||||
SWITCH = 0x0080, // frame is for a switch stmt
|
||||
SKIP = 0x0100, // skip frame when searching enclosing scopes
|
||||
SEARCH = 0x0200, // don't skip this frame
|
||||
KEEPSYMS = 0x0400, // don't free symtab when scope is closed
|
||||
} Frame_f;
|
||||
typedef enum {
|
||||
LABEL_USE = 0x01, // label is being referenced
|
||||
LABEL_DEF = 0x02, // label is being defined
|
||||
} Label_f;
|
||||
typedef struct Label {
|
||||
char *name;
|
||||
int offset;
|
||||
Jmp *fixups;
|
||||
} Label;
|
||||
typedef struct Frame {
|
||||
CompileEnv *envPtr;
|
||||
CompileEnv *bodyEnvPtr;
|
||||
CompileEnv *prologueEnvPtr;
|
||||
Proc *proc;
|
||||
char *name;
|
||||
Tcl_HashTable *symtab;
|
||||
Tcl_HashTable *labeltab;
|
||||
ClsDecl *clsdecl;
|
||||
Frame_f flags;
|
||||
// When a compile frame corresponds to a block in the code, we
|
||||
// store the AST node of the block here.
|
||||
Ast *block;
|
||||
// We collect jump fix-ups for all of the jumps emitted for break and
|
||||
// continue statements, so that we can stuff in the correct jump targets
|
||||
// once we're done compiling the loops.
|
||||
Jmp *continue_jumps;
|
||||
Jmp *break_jumps;
|
||||
// Jump fix-up for the jump to the prologue code at the end of a proc,
|
||||
// and the bytecode offset for the jump back.
|
||||
Jmp *end_jmp;
|
||||
int proc_top;
|
||||
// Fix-ups for return stmts which all jmp to the end.
|
||||
Jmp *ret_jmps;
|
||||
// List of temps allocated in this frame.
|
||||
Tmp *tmps;
|
||||
struct Frame *prevFrame;
|
||||
} Frame;
|
||||
|
||||
/* Per-scope tables. Scopes are opened and close at parse time. */
|
||||
typedef struct scope Scope;
|
||||
struct scope {
|
||||
Tcl_HashTable *structs;
|
||||
Tcl_HashTable *typedefs;
|
||||
Scope *prev;
|
||||
};
|
||||
|
||||
/*
|
||||
* Global L state. There is only one of these, reachable via L->global.
|
||||
* The general L command line is
|
||||
* tclsh [-tclsh_opt1] ... [-tclsh_optn] script_name [-script_opt1] ... [-script_optm]
|
||||
*/
|
||||
typedef struct {
|
||||
int tclsh_argc;
|
||||
Tcl_Obj *tclsh_argv;
|
||||
int script_argc;
|
||||
Tcl_Obj *script_argv;
|
||||
int forceL; // wrap input in #lang L directive
|
||||
} Lglobal;
|
||||
|
||||
/*
|
||||
* Per-interp L state. When an interp is created, one of these is
|
||||
* allocated for each interp and associated with the interp. Whenever
|
||||
* the compiler is entered, it is extracted from the interp.
|
||||
*/
|
||||
typedef struct {
|
||||
Lglobal *global; // L global state
|
||||
Frame *frame; // current semantic stack frame
|
||||
Scope *curr_scope;
|
||||
Ast *ast_list; // list of all AST nodes
|
||||
Type *type_list; // list of all type descriptors
|
||||
void *ast; // ptr to AST root, set by parser
|
||||
Tcl_Obj *errs;
|
||||
int err; // =1 if there was any compile error
|
||||
char *dir; // absolute path to dir containing L->file
|
||||
char *file;
|
||||
int line;
|
||||
int prev_token_len;
|
||||
int token_off; // offset of curr token from start of input
|
||||
int prev_token_off; // offset of prev token from start of input
|
||||
Tcl_Obj *script; // src of script being compiled
|
||||
int script_len;
|
||||
Tcl_Obj *options; // hash of command-line options
|
||||
FnDecl *enclosing_func;
|
||||
Frame *enclosing_func_frame;
|
||||
Ast *mains_ast; // root of AST when main() last seen
|
||||
Tcl_HashTable *include_table;
|
||||
Tcl_Interp *interp;
|
||||
Op_k idx_op; // kind of enclosing index (. -> [] {})
|
||||
int tmpnum; // for creating tmp variables
|
||||
char *toplev; // name of toplevel proc
|
||||
jmp_buf jmp; // for syntax error longjmp bail out
|
||||
int expr_level; // compile_expr() recursion depth
|
||||
int call_level; // compile_expr() level of last fn call
|
||||
Tcl_Obj *fn_calls; // list of all fn calls compiled
|
||||
Tcl_Obj *fn_decls; // hash of all L fns
|
||||
} Linterp;
|
||||
|
||||
/*
|
||||
* Symbol table entry, for variables and functions (typedef and struct
|
||||
* names have their own tables). The tclname can be different from
|
||||
* the L name if we have to mangle the name as we do for L globals.
|
||||
* The decl pointer is used to get line# info for error messages.
|
||||
*/
|
||||
typedef enum {
|
||||
L_SYM_LVAR = 0x0001, // a local variable
|
||||
L_SYM_GVAR = 0x0002, // a global variable
|
||||
L_SYM_LSHADOW = 0x0004, // a global upvar shadow (these
|
||||
// are also locals)
|
||||
L_SYM_FN = 0x0008, // a function
|
||||
L_SYM_FNBODY = 0x0010, // function body has been declared
|
||||
} Sym_k;
|
||||
struct Sym {
|
||||
Sym_k kind;
|
||||
char *name; // the L name
|
||||
char *tclname; // the tcl name (can be same as L name)
|
||||
Type *type;
|
||||
int idx; // slot# for local var
|
||||
int used_p; // TRUE iff var has been referenced
|
||||
VarDecl *decl;
|
||||
};
|
||||
|
||||
/*
|
||||
* For our getopt. Note that this renders libc's getopt unusable,
|
||||
* but the #define's are kept for compatibility with our getopt.
|
||||
*/
|
||||
|
||||
#define getopt mygetopt
|
||||
#define optind myoptind
|
||||
#define optarg myoptarg
|
||||
#define optopt myoptopt
|
||||
|
||||
extern int optind;
|
||||
extern int optopt;
|
||||
extern char *optarg;
|
||||
|
||||
typedef struct {
|
||||
char *name; /* name w args ex: "url:" */
|
||||
int ret; /* return value from getopt */
|
||||
} longopt;
|
||||
|
||||
#define GETOPT_EOF -1
|
||||
#define GETOPT_ERR 256
|
||||
|
||||
extern char *cksprintf(const char *fmt, ...);
|
||||
extern char *ckstrdup(const char *str);
|
||||
extern char *ckstrndup(const char *str, int len);
|
||||
extern char *ckvsprintf(const char *fmt, va_list ap, int len);
|
||||
extern int getopt(int ac, char **av, char *opts, longopt *lopts);
|
||||
extern void getoptReset(void);
|
||||
extern void L_bomb(const char *format, ...);
|
||||
extern void L_compile_attributes(Tcl_Obj *hash, Expr *expr,
|
||||
char *allowed[]);
|
||||
extern char *L_dirname(char *path);
|
||||
extern void L_err(const char *s, ...);
|
||||
extern void L_errf(void *node, const char *format, ...);
|
||||
extern int L_isUndef(Tcl_Obj *o);
|
||||
extern void L_lex_begLhtml();
|
||||
extern void L_lex_endLhtml();
|
||||
extern void L_lex_begReArg(int kind);
|
||||
extern void L_lex_start(void);
|
||||
extern int L_parse(void); // yyparse
|
||||
extern void L_scope_enter();
|
||||
extern void L_scope_leave();
|
||||
extern void L_set_baseType(Type *type, Type *base_type);
|
||||
extern void L_set_declBaseType(VarDecl *decl, Type *base_type);
|
||||
extern Tcl_Obj *L_split(Tcl_Interp *interp, Tcl_Obj *strobj,
|
||||
Tcl_Obj *delimobj, Tcl_Obj *limobj, Expr_f flags);
|
||||
extern Type *L_struct_lookup(char *tag, int local);
|
||||
extern Type *L_struct_store(char *tag, VarDecl *members);
|
||||
extern void L_synerr(const char *s); // yyerror
|
||||
extern void L_synerr2(const char *s, int offset);
|
||||
extern void L_trace(const char *format, ...);
|
||||
extern char *L_type_str(Type_k kind);
|
||||
extern void L_typeck_init();
|
||||
extern int L_typeck_arrElt(Type *var, Type *array);
|
||||
extern void L_typeck_assign(Expr *lhs, Type *rhs);
|
||||
extern int L_typeck_compat(Type *lhs, Type *rhs);
|
||||
extern int L_typeck_declType(VarDecl *decl);
|
||||
extern void L_typeck_deny(Type_k deny, Expr *expr);
|
||||
extern void L_typeck_expect(Type_k want, Expr *expr, char *msg);
|
||||
extern void L_typeck_fncall(VarDecl *formals, Expr *call);
|
||||
extern void L_typeck_main(VarDecl *decl);
|
||||
extern int L_typeck_same(Type *a, Type *b);
|
||||
extern Type *L_typedef_lookup(char *name);
|
||||
extern void L_typedef_store(VarDecl *decl);
|
||||
extern Tcl_Obj **L_undefObjPtrPtr();
|
||||
extern void L_warnf(void *node, const char *format, ...);
|
||||
|
||||
extern Linterp *L;
|
||||
extern char *L_attrs_attribute[];
|
||||
extern char *L_attrs_cmdLine[];
|
||||
extern char *L_attrs_pragma[];
|
||||
extern Tcl_ObjType L_undefType;
|
||||
extern Type *L_int;
|
||||
extern Type *L_float;
|
||||
extern Type *L_string;
|
||||
extern Type *L_void;
|
||||
extern Type *L_poly;
|
||||
extern Type *L_widget;
|
||||
|
||||
static inline int
|
||||
istype(Expr *expr, int type_flags)
|
||||
{
|
||||
return (expr->type && (expr->type->kind & type_flags));
|
||||
}
|
||||
static inline int
|
||||
isarray(Expr *expr)
|
||||
{
|
||||
return (expr->type && (expr->type->kind == L_ARRAY));
|
||||
}
|
||||
static inline int
|
||||
ishash(Expr *expr)
|
||||
{
|
||||
return (expr->type && (expr->type->kind == L_HASH));
|
||||
}
|
||||
static inline int
|
||||
isstruct(Expr *expr)
|
||||
{
|
||||
return (expr->type && (expr->type->kind == L_STRUCT));
|
||||
}
|
||||
static inline int
|
||||
isint(Expr *expr)
|
||||
{
|
||||
return (expr->type && (expr->type->kind == L_INT));
|
||||
}
|
||||
static inline int
|
||||
isfloat(Expr *expr)
|
||||
{
|
||||
return (expr->type && (expr->type->kind == L_FLOAT));
|
||||
}
|
||||
static inline int
|
||||
isstring(Expr *expr)
|
||||
{
|
||||
return (expr->type && (expr->type->kind == L_STRING));
|
||||
}
|
||||
static inline int
|
||||
iswidget(Expr *expr)
|
||||
{
|
||||
return (expr->type && (expr->type->kind == L_WIDGET));
|
||||
}
|
||||
static inline int
|
||||
isvoid(Expr *expr)
|
||||
{
|
||||
return (expr->type && (expr->type->kind == L_VOID));
|
||||
}
|
||||
static inline int
|
||||
ispoly(Expr *expr)
|
||||
{
|
||||
return (expr->type && (expr->type->kind == L_POLY));
|
||||
}
|
||||
static inline int
|
||||
isscalar(Expr *expr)
|
||||
{
|
||||
return (expr->type && (expr->type->kind & (L_INT |
|
||||
L_FLOAT |
|
||||
L_STRING |
|
||||
L_WIDGET |
|
||||
L_POLY)));
|
||||
}
|
||||
static inline int
|
||||
isconst(Expr *expr)
|
||||
{
|
||||
return (expr->kind == L_EXPR_CONST);
|
||||
}
|
||||
static inline int
|
||||
islist(Expr *expr)
|
||||
{
|
||||
return (expr->type && (expr->type->kind == L_LIST));
|
||||
}
|
||||
static inline int
|
||||
isclass(Expr *expr)
|
||||
{
|
||||
return (expr->type && (expr->type->kind == L_CLASS));
|
||||
}
|
||||
static inline int
|
||||
isregexp(Expr *expr)
|
||||
{
|
||||
return ((expr->kind == L_EXPR_RE) ||
|
||||
((expr->kind == L_EXPR_BINOP) && (expr->op == L_OP_INTERP_RE)));
|
||||
}
|
||||
static inline int
|
||||
ispolytype(Type *type)
|
||||
{
|
||||
return (type->kind == L_POLY);
|
||||
}
|
||||
static inline int
|
||||
islisttype(Type *type)
|
||||
{
|
||||
return (type->kind == L_LIST);
|
||||
}
|
||||
static inline int
|
||||
ishashtype(Type *type)
|
||||
{
|
||||
return (type->kind == L_HASH);
|
||||
}
|
||||
static inline int
|
||||
isfntype(Type *type)
|
||||
{
|
||||
return (type->kind == L_FUNCTION);
|
||||
}
|
||||
static inline int
|
||||
isinttype(Type *type)
|
||||
{
|
||||
return (type->kind == L_INT);
|
||||
}
|
||||
static inline int
|
||||
isvoidtype(Type *type)
|
||||
{
|
||||
return (type->kind == L_VOID);
|
||||
}
|
||||
static inline int
|
||||
isnameoftype(Type *type)
|
||||
{
|
||||
return (type->kind == L_NAMEOF);
|
||||
}
|
||||
static inline int
|
||||
isclasstype(Type *type)
|
||||
{
|
||||
return (type->kind == L_CLASS);
|
||||
}
|
||||
static inline int
|
||||
isarrayoftype(Type *type, Type_k kind)
|
||||
{
|
||||
return ((type->kind == L_ARRAY) && (type->base_type->kind & kind));
|
||||
}
|
||||
static inline int
|
||||
ishashoftype(Type *type, Type_k base, Type_k elt)
|
||||
{
|
||||
return ((type->kind == L_HASH) &&
|
||||
(type->base_type->kind & base) &&
|
||||
(type->u.hash.idx_type->kind & elt));
|
||||
}
|
||||
static inline int
|
||||
isaddrof(Expr *expr)
|
||||
{
|
||||
return ((expr->kind == L_EXPR_UNOP) && (expr->op == L_OP_ADDROF));
|
||||
}
|
||||
static inline int
|
||||
isexpand(Expr *expr)
|
||||
{
|
||||
return ((expr->kind == L_EXPR_UNOP) && (expr->op == L_OP_EXPAND));
|
||||
}
|
||||
static inline int
|
||||
iskv(Expr *expr)
|
||||
{
|
||||
return ((expr->kind == L_EXPR_BINOP) && (expr->op == L_OP_KV));
|
||||
}
|
||||
static inline int
|
||||
isinterp(Expr *expr)
|
||||
{
|
||||
return ((expr->kind == L_EXPR_BINOP) && (expr->op == L_OP_INTERP_STRING));
|
||||
}
|
||||
static inline int
|
||||
isid(Expr *expr, char *s)
|
||||
{
|
||||
return ((expr->kind == L_EXPR_ID) && !strcmp(expr->str, s));
|
||||
}
|
||||
static inline int
|
||||
isarrayof(Expr *expr, Type_k kind)
|
||||
{
|
||||
return (isarray(expr) && (expr->type->base_type->kind & kind));
|
||||
}
|
||||
/*
|
||||
* Return the flags that match the kind of variable we can
|
||||
* dereference: globals, locals, class variables, and class instance
|
||||
* variables.
|
||||
*/
|
||||
static inline int
|
||||
canDeref(Sym *sym)
|
||||
{
|
||||
return (sym->decl->flags & (DECL_GLOBAL_VAR | DECL_LOCAL_VAR |
|
||||
DECL_FN | DECL_CLASS_INST_VAR |
|
||||
DECL_CLASS_VAR));
|
||||
}
|
||||
/*
|
||||
* This checks whether the Expr node is a deep-dive operation that has
|
||||
* left a deep-ptr on the run-time stack.
|
||||
*/
|
||||
static inline int
|
||||
isdeepdive(Expr *expr)
|
||||
{
|
||||
return (expr->flags & (L_PUSH_PTR | L_PUSH_PTRVAL | L_PUSH_VALPTR));
|
||||
}
|
||||
static inline int
|
||||
isClsConstructor(VarDecl *decl)
|
||||
{
|
||||
return (decl->flags & DECL_CLASS_CONST);
|
||||
}
|
||||
static inline int
|
||||
isClsDestructor(VarDecl *decl)
|
||||
{
|
||||
return (decl->flags & DECL_CLASS_DESTR);
|
||||
}
|
||||
static inline int
|
||||
isClsFnPublic(VarDecl *decl)
|
||||
{
|
||||
return ((decl->flags & (DECL_CLASS_FN | DECL_PUBLIC)) ==
|
||||
(DECL_CLASS_FN | DECL_PUBLIC));
|
||||
}
|
||||
static inline int
|
||||
isClsFnPrivate(VarDecl *decl)
|
||||
{
|
||||
return ((decl->flags & (DECL_CLASS_FN | DECL_PRIVATE)) ==
|
||||
(DECL_CLASS_FN | DECL_PRIVATE));
|
||||
}
|
||||
static inline int
|
||||
typeis(Type *type, char *name)
|
||||
{
|
||||
return (type->name && !strcmp(type->name, name));
|
||||
}
|
||||
static inline int
|
||||
typeisf(Expr *expr, char *name)
|
||||
{
|
||||
return (expr->type->name && !strcmp(expr->type->name, name));
|
||||
}
|
||||
static inline void
|
||||
emit_load_scalar(int idx)
|
||||
{
|
||||
/*
|
||||
* The next line is a hack so we can generate disassemblable
|
||||
* code even in the presence of obscure compilation errors
|
||||
* that cause the value of a function name to be attempted to
|
||||
* be loaded. Without this, tcl will die trying to output a
|
||||
* disassembly since the local # (-1) would be invalid.
|
||||
*/
|
||||
if (idx == -1) idx = 0;
|
||||
|
||||
if (idx <= 255) {
|
||||
TclEmitInstInt1(INST_LOAD_SCALAR1, idx, L->frame->envPtr);
|
||||
} else {
|
||||
TclEmitInstInt4(INST_LOAD_SCALAR4, idx, L->frame->envPtr);
|
||||
}
|
||||
}
|
||||
static inline void
|
||||
emit_store_scalar(int idx)
|
||||
{
|
||||
if (idx <= 255) {
|
||||
TclEmitInstInt1(INST_STORE_SCALAR1, idx, L->frame->envPtr);
|
||||
} else {
|
||||
TclEmitInstInt4(INST_STORE_SCALAR4, idx, L->frame->envPtr);
|
||||
}
|
||||
}
|
||||
static inline void
|
||||
push_litf(const char *str, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int len = 64;
|
||||
char *buf;
|
||||
|
||||
va_start(ap, str);
|
||||
while (!(buf = ckvsprintf(str, ap, len))) {
|
||||
va_end(ap);
|
||||
va_start(ap, str);
|
||||
len *= 2;
|
||||
}
|
||||
va_end(ap);
|
||||
/*
|
||||
* Subtle: register the literal in the body CompileEnv since
|
||||
* all the code ends up there anyway. If we put it in the
|
||||
* prologue CompileEnv, we'd have to fix-up all the literal
|
||||
* numbers when we splice the prologue into the body.
|
||||
*/
|
||||
TclEmitPush(TclRegisterNewLiteral(L->frame->bodyEnvPtr, buf, strlen(buf)),
|
||||
L->frame->envPtr);
|
||||
ckfree(buf);
|
||||
}
|
||||
static inline void
|
||||
push_lit(const char *str)
|
||||
{
|
||||
/* See comment above about registering in the body CompileEnv. */
|
||||
TclEmitPush(TclRegisterNewLiteral(L->frame->bodyEnvPtr, str,
|
||||
strlen(str)), L->frame->envPtr);
|
||||
}
|
||||
static inline void
|
||||
emit_invoke(int size)
|
||||
{
|
||||
if (size < 256) {
|
||||
TclEmitInstInt1(INST_INVOKE_STK1, size, L->frame->envPtr);
|
||||
} else {
|
||||
TclEmitInstInt4(INST_INVOKE_STK4, size, L->frame->envPtr);
|
||||
}
|
||||
}
|
||||
static inline void
|
||||
emit_invoke_expanded()
|
||||
{
|
||||
TclEmitOpcode(INST_INVOKE_EXPANDED, L->frame->envPtr);
|
||||
}
|
||||
static inline void
|
||||
emit_pop()
|
||||
{
|
||||
TclEmitOpcode(INST_POP, L->frame->envPtr);
|
||||
}
|
||||
static inline int
|
||||
currOffset(CompileEnv *envPtr)
|
||||
{
|
||||
/* Offset of the next instruction to be generated. */
|
||||
return (envPtr->codeNext - envPtr->codeStart);
|
||||
}
|
||||
|
||||
/*
|
||||
* REVERSE() assumes that l is a singly linked list of type type with
|
||||
* forward pointers named ptr. The last element in the list becomes
|
||||
* the first and is stored back into l.
|
||||
*/
|
||||
#define REVERSE(type,ptr,l) \
|
||||
do { \
|
||||
type *a, *b, *c; \
|
||||
for (a = NULL, b = l, c = (l ? ((type *)l)->ptr : NULL); \
|
||||
b != NULL; \
|
||||
b->ptr = a, a = b, b = c, c = (c ? c->ptr : NULL)) ; \
|
||||
*(type **)&(l) = a; \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* APPEND() starts at a, walks ptr until the end, and then attaches b
|
||||
* to a. (Note that it's actually NCONC).
|
||||
*/
|
||||
#define APPEND(type,ptr,a,b) \
|
||||
do { \
|
||||
type *runner; \
|
||||
for (runner = a; runner->ptr; runner = runner->ptr) ; \
|
||||
runner->ptr = b; \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* Like APPEND() but if a is NULL, set a to b.
|
||||
*/
|
||||
#define APPEND_OR_SET(type,ptr,a,b) \
|
||||
do { \
|
||||
if (a) { \
|
||||
type *runner; \
|
||||
for (runner = a; runner->ptr; runner = runner->ptr) ; \
|
||||
runner->ptr = b; \
|
||||
} else { \
|
||||
a = b; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* YYLOC_DEFAULT() is invoked by the scanner after matching a pattern
|
||||
* and before executing its code. It tracks the source-file offset
|
||||
* and line #.
|
||||
*/
|
||||
extern YYLTYPE L_lloc;
|
||||
#define YYLLOC_DEFAULT(c,r,n) \
|
||||
do { \
|
||||
if (n) { \
|
||||
(c).beg = YYRHSLOC(r,1).beg; \
|
||||
(c).end = YYRHSLOC(r,n).end; \
|
||||
} else { \
|
||||
(c).beg = YYRHSLOC(r,0).beg; \
|
||||
(c).end = YYRHSLOC(r,0).end; \
|
||||
} \
|
||||
(c).line = L->line; \
|
||||
(c).file = L->file; \
|
||||
} while (0)
|
||||
|
||||
#ifdef TCL_COMPILE_DEBUG
|
||||
#define ASSERT(c) unless (c) \
|
||||
L_bomb("Assertion failed: %s:%d: %s\n", __FILE__, __LINE__, #c)
|
||||
#else
|
||||
#define ASSERT(c) do {} while(0)
|
||||
#endif
|
||||
|
||||
#endif /* L_COMPILE_H */
|
||||
@@ -0,0 +1,238 @@
|
||||
#include "Lcompile.h"
|
||||
|
||||
/* for compat with code below */
|
||||
#define streq(a, b) (!strcmp(a, b))
|
||||
#define strneq(a, b, n) (!strncmp(a, b, n))
|
||||
#define assert(x)
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 L.W.McVoy
|
||||
*
|
||||
* This version handles
|
||||
*
|
||||
* - (leaves it and returns)
|
||||
* -- end of options
|
||||
* -a
|
||||
* -abcd
|
||||
* -r <arg>
|
||||
* -r<arg>
|
||||
* -abcr <arg>
|
||||
* -abcr<arg>
|
||||
* -r<arg> -R<arg>, etc.
|
||||
* --long
|
||||
* --long:<arg>
|
||||
* --long=<arg>
|
||||
* --long <arg>
|
||||
*
|
||||
* Patterns in getopt string:
|
||||
* d boolean option -d
|
||||
* d: required arg -dARG or -d ARG
|
||||
* d; required arg no space -dARG
|
||||
* d| optionial arg no space -dARG or -d
|
||||
*
|
||||
* With long options:
|
||||
* long boolean option --long
|
||||
* long: required arg --long=ARG or --long ARG
|
||||
* long; required arg no space --long=ARG
|
||||
* long| optionial arg no space --long=ARG or --long
|
||||
*/
|
||||
|
||||
int optopt; /* option that is in error, if we return an error */
|
||||
int optind; /* next arg in argv we process */
|
||||
char *optarg; /* argument to an option */
|
||||
static int n; /* current position == av[optind][n] */
|
||||
static int lastn; /* saved copy of last n */
|
||||
|
||||
private int doLong(int ac, char **av, longopt *lopts);
|
||||
|
||||
void
|
||||
getoptReset(void)
|
||||
{
|
||||
optopt = optind = 0;
|
||||
optarg = 0;
|
||||
}
|
||||
|
||||
void
|
||||
getoptConsumed(int n1)
|
||||
{
|
||||
optind--;
|
||||
unless (optind) optind = 1;
|
||||
n = lastn + n1;
|
||||
// TRACE("optind = %d, n = %d, n1 = %d", optind, n, n1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns:
|
||||
* - char if option found
|
||||
* - GETOPT_EOF(-1) if end of arguments reached
|
||||
* - GETOPT_ERR(256) if unknown option found.
|
||||
*/
|
||||
int
|
||||
getopt(int ac, char **av, char *opts, longopt *lopts)
|
||||
{
|
||||
char *t;
|
||||
|
||||
optarg = 0; /* clear out arg from last round */
|
||||
optopt = 0; /* clear error return */
|
||||
if (!optind) {
|
||||
optind = 1;
|
||||
lastn = n;
|
||||
n = 1;
|
||||
}
|
||||
// TRACE("GETOPT ind=%d n=%d av[%d]='%s'", optind, n, optind, av[optind]);
|
||||
|
||||
if ((optind >= ac) || (av[optind][0] != '-') || !av[optind][1]) {
|
||||
return (GETOPT_EOF);
|
||||
}
|
||||
/* Stop processing options at a -- and return arguments after */
|
||||
if (streq(av[optind], "--")) {
|
||||
optind++;
|
||||
lastn = n;
|
||||
n = 1;
|
||||
return (GETOPT_EOF);
|
||||
}
|
||||
if (strneq(av[optind], "--", 2)) return (doLong(ac, av, lopts));
|
||||
|
||||
assert(av[optind][n]);
|
||||
for (t = (char *)opts; *t; t++) {
|
||||
if (*t == av[optind][n]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!*t) {
|
||||
optopt = av[optind][n];
|
||||
// TRACE("%s", "ran out of option letters");
|
||||
lastn = n;
|
||||
if (av[optind][n+1]) {
|
||||
n++;
|
||||
} else {
|
||||
n = 1;
|
||||
optind++;
|
||||
}
|
||||
return (GETOPT_ERR);
|
||||
}
|
||||
|
||||
/* OK, we found a legit option, let's see what to do with it.
|
||||
* If it isn't one that takes an option, just advance and return.
|
||||
*/
|
||||
if (t[1] != ':' && t[1] != '|' && t[1] != ';') {
|
||||
lastn = n;
|
||||
if (!av[optind][n+1]) {
|
||||
optind++;
|
||||
n = 1;
|
||||
} else {
|
||||
n++;
|
||||
}
|
||||
// TRACE("Legit singleton %c", *t);
|
||||
return (*t);
|
||||
}
|
||||
|
||||
/* got one with an option, see if it is cozied up to the flag */
|
||||
if (av[optind][n+1]) {
|
||||
optarg = &av[optind][n+1];
|
||||
optind++;
|
||||
lastn = n;
|
||||
n = 1;
|
||||
// TRACE("%c with %s", *t, optarg);
|
||||
return (*t);
|
||||
}
|
||||
|
||||
/* If it was not there, and it is optional, OK */
|
||||
if (t[1] == '|') {
|
||||
optind++;
|
||||
lastn = n;
|
||||
n = 1;
|
||||
// TRACE("%c without arg", *t);
|
||||
return (*t);
|
||||
}
|
||||
|
||||
/* was it supposed to be there? */
|
||||
if (t[1] == ';') {
|
||||
optind++;
|
||||
optopt = *t;
|
||||
// TRACE("%s", "wanted another word");
|
||||
return (GETOPT_ERR);
|
||||
}
|
||||
|
||||
/* Nope, there had better be another word. */
|
||||
if ((optind + 1 == ac) || (av[optind+1][0] == '-')) {
|
||||
optopt = av[optind][n];
|
||||
// TRACE("%s", "wanted another word");
|
||||
return (GETOPT_ERR);
|
||||
}
|
||||
optarg = av[optind+1];
|
||||
optind += 2;
|
||||
lastn = n;
|
||||
n = 1;
|
||||
// TRACE("%c with arg %s", *t, optarg);
|
||||
return (*t);
|
||||
}
|
||||
|
||||
private int
|
||||
doLong(int ac, char **av, longopt *lopts)
|
||||
{
|
||||
char *s, *t;
|
||||
int len1, len2;
|
||||
|
||||
unless (lopts) {
|
||||
err: n = 1;
|
||||
optind++;
|
||||
optopt = 0;
|
||||
return (GETOPT_ERR);
|
||||
}
|
||||
/* len of option without =value part */
|
||||
s = av[optind] + 2;
|
||||
unless (t = strchr(s, '=')) t = strchr(s, ':');
|
||||
len1 = t ? (t - s) : strlen(s);
|
||||
for (; (t = lopts->name); lopts++) {
|
||||
s = av[optind] + 2;
|
||||
/* len of lopts array without suffix */
|
||||
len2 = strlen(t);
|
||||
if (strspn(t+len2-1, ":;|") == 1) --len2;
|
||||
|
||||
if ((len1 == len2) && strneq(s, t, len1)) {
|
||||
s += len1;
|
||||
t += len2;
|
||||
break; /* found a match */
|
||||
}
|
||||
}
|
||||
unless (t) goto err;
|
||||
|
||||
/* OK, we found a legit option, let's see what to do with it.
|
||||
* If it isn't one that takes an option, just advance and return.
|
||||
*/
|
||||
unless (*t) {
|
||||
/* got option anyway */
|
||||
if ((*s == '=') || (*s == ':')) goto err;
|
||||
optind++;
|
||||
n = 1;
|
||||
return (lopts->ret);
|
||||
}
|
||||
|
||||
/* got one with an option, see if it is cozied up to the flag */
|
||||
if ((*s == '=') || (*s == ':')) {
|
||||
optarg = s + 1;
|
||||
optind++;
|
||||
n = 1;
|
||||
return (lopts->ret);
|
||||
}
|
||||
|
||||
/* If it was not there, and it is optional, OK */
|
||||
if (*t == '|') {
|
||||
optind++;
|
||||
n = 1;
|
||||
return (lopts->ret);
|
||||
}
|
||||
|
||||
/* was it supposed to be there? */
|
||||
if (*t == ';') goto err;
|
||||
|
||||
/* Nope, there had better be another word. */
|
||||
if ((optind + 1 == ac) || (av[optind+1][0] == '-')) {
|
||||
goto err;
|
||||
}
|
||||
optarg = av[optind+1];
|
||||
optind += 2;
|
||||
n = 1;
|
||||
return (lopts->ret);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,233 @@
|
||||
/* A Bison parser, made by GNU Bison 2.3. */
|
||||
|
||||
/* Skeleton interface for Bison GLR parsers in C
|
||||
|
||||
Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* As a special exception, you may create a larger work that contains
|
||||
part or all of the Bison parser skeleton and distribute that work
|
||||
under terms of your choice, so long as that work isn't itself a
|
||||
parser generator using the skeleton or a modified version thereof
|
||||
as a parser skeleton. Alternatively, if you modify or redistribute
|
||||
the parser skeleton itself, you may (at your option) remove this
|
||||
special exception, which will cause the skeleton and the resulting
|
||||
Bison output files to be licensed under the GNU General Public
|
||||
License without this special exception.
|
||||
|
||||
This special exception was added by the Free Software Foundation in
|
||||
version 2.2 of Bison. */
|
||||
|
||||
/* Tokens. */
|
||||
#ifndef YYTOKENTYPE
|
||||
# define YYTOKENTYPE
|
||||
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
||||
know about them. */
|
||||
enum yytokentype {
|
||||
END = 0,
|
||||
T_ANDAND = 258,
|
||||
T_ARROW = 259,
|
||||
T_ATTRIBUTE = 260,
|
||||
T_BANG = 261,
|
||||
T_BANGTWID = 262,
|
||||
T_BITAND = 263,
|
||||
T_BITOR = 264,
|
||||
T_BITNOT = 265,
|
||||
T_BITXOR = 266,
|
||||
T_BREAK = 267,
|
||||
T_CLASS = 268,
|
||||
T_COLON = 269,
|
||||
T_COMMA = 270,
|
||||
T_CONSTRUCTOR = 271,
|
||||
T_CONTINUE = 272,
|
||||
T_DEFINED = 273,
|
||||
T_DESTRUCTOR = 274,
|
||||
T_DO = 275,
|
||||
T_DOT = 276,
|
||||
T_DOTDOT = 277,
|
||||
T_ELLIPSIS = 278,
|
||||
T_ELSE = 279,
|
||||
T_EQ = 280,
|
||||
T_EQBITAND = 281,
|
||||
T_EQBITOR = 282,
|
||||
T_EQBITXOR = 283,
|
||||
T_EQDOT = 284,
|
||||
T_EQLSHIFT = 285,
|
||||
T_EQMINUS = 286,
|
||||
T_EQPERC = 287,
|
||||
T_EQPLUS = 288,
|
||||
T_EQRSHIFT = 289,
|
||||
T_EQSTAR = 290,
|
||||
T_EQSLASH = 291,
|
||||
T_EQTWID = 292,
|
||||
T_EQUALS = 293,
|
||||
T_EQUALEQUAL = 294,
|
||||
T_EXPAND = 295,
|
||||
T_EXTERN = 296,
|
||||
T_FLOAT = 297,
|
||||
T_FLOAT_LITERAL = 298,
|
||||
T_FOR = 299,
|
||||
T_FOREACH = 300,
|
||||
T_GOTO = 301,
|
||||
T_GE = 302,
|
||||
T_GREATER = 303,
|
||||
T_GREATEREQ = 304,
|
||||
T_GT = 305,
|
||||
T_HTML = 306,
|
||||
T_ID = 307,
|
||||
T_IF = 308,
|
||||
T_INSTANCE = 309,
|
||||
T_INT = 310,
|
||||
T_INT_LITERAL = 311,
|
||||
T_LHTML_EXPR_START = 312,
|
||||
T_LHTML_EXPR_END = 313,
|
||||
T_LBRACE = 314,
|
||||
T_LBRACKET = 315,
|
||||
T_LE = 316,
|
||||
T_LEFT_INTERPOL = 317,
|
||||
T_LEFT_INTERPOL_RE = 318,
|
||||
T_LESSTHAN = 319,
|
||||
T_LESSTHANEQ = 320,
|
||||
T_LPAREN = 321,
|
||||
T_LSHIFT = 322,
|
||||
T_LT = 323,
|
||||
T_MINUS = 324,
|
||||
T_MINUSMINUS = 325,
|
||||
T_NE = 326,
|
||||
T_NOTEQUAL = 327,
|
||||
T_OROR = 328,
|
||||
T_PATTERN = 329,
|
||||
T_PERC = 330,
|
||||
T_PLUS = 331,
|
||||
T_PLUSPLUS = 332,
|
||||
T_POINTS = 333,
|
||||
T_POLY = 334,
|
||||
T_PRIVATE = 335,
|
||||
T_PUBLIC = 336,
|
||||
T_QUESTION = 337,
|
||||
T_RBRACE = 338,
|
||||
T_RBRACKET = 339,
|
||||
T_RE = 340,
|
||||
T_RE_MODIFIER = 341,
|
||||
T_RETURN = 342,
|
||||
T_RIGHT_INTERPOL = 343,
|
||||
T_RIGHT_INTERPOL_RE = 344,
|
||||
T_RPAREN = 345,
|
||||
T_RSHIFT = 346,
|
||||
T_TRY = 347,
|
||||
T_SEMI = 348,
|
||||
T_SLASH = 349,
|
||||
T_SPLIT = 350,
|
||||
T_STAR = 351,
|
||||
T_START_BACKTICK = 352,
|
||||
T_STR_BACKTICK = 353,
|
||||
T_STR_LITERAL = 354,
|
||||
T_STRCAT = 355,
|
||||
T_STRING = 356,
|
||||
T_STRUCT = 357,
|
||||
T_SUBST = 358,
|
||||
T_TYPE = 359,
|
||||
T_TYPEDEF = 360,
|
||||
T_UNLESS = 361,
|
||||
T_ARGUSED = 362,
|
||||
T_OPTIONAL = 363,
|
||||
T_MUSTBETYPE = 364,
|
||||
T_VOID = 365,
|
||||
T_WIDGET = 366,
|
||||
T_WHILE = 367,
|
||||
T_PRAGMA = 368,
|
||||
T_SWITCH = 369,
|
||||
T_CASE = 370,
|
||||
T_DEFAULT = 371,
|
||||
LOWEST = 372,
|
||||
ADDRESS = 373,
|
||||
UMINUS = 374,
|
||||
UPLUS = 375,
|
||||
PREFIX_INCDEC = 376,
|
||||
HIGHEST = 377
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
/* Copy the first part of user declarations. */
|
||||
#line 1 "/Users/rob/bk/dev-L-lhtml-fix/src/gui/tcltk/tcl/generic/Lgrammar.y"
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006-2008 BitMover, Inc.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include "Lcompile.h"
|
||||
|
||||
/* L_lex is generated by flex. */
|
||||
extern int L_lex (void);
|
||||
|
||||
#define YYERROR_VERBOSE
|
||||
#define L_error L_synerr
|
||||
|
||||
|
||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||
typedef union YYSTYPE
|
||||
#line 53 "/Users/rob/bk/dev-L-lhtml-fix/src/gui/tcltk/tcl/generic/Lgrammar.y"
|
||||
{
|
||||
long i;
|
||||
char *s;
|
||||
Tcl_Obj *obj;
|
||||
Type *Type;
|
||||
Expr *Expr;
|
||||
Block *Block;
|
||||
ForEach *ForEach;
|
||||
Switch *Switch;
|
||||
Case *Case;
|
||||
FnDecl *FnDecl;
|
||||
Cond *Cond;
|
||||
Loop *Loop;
|
||||
Stmt *Stmt;
|
||||
TopLev *TopLev;
|
||||
VarDecl *VarDecl;
|
||||
ClsDecl *ClsDecl;
|
||||
struct {
|
||||
Type *t;
|
||||
char *s;
|
||||
} Typename;
|
||||
}
|
||||
/* Line 2616 of glr.c. */
|
||||
#line 209 "Lgrammar.h"
|
||||
YYSTYPE;
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
#endif
|
||||
|
||||
#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
|
||||
typedef struct YYLTYPE
|
||||
{
|
||||
|
||||
int first_line;
|
||||
int first_column;
|
||||
int last_line;
|
||||
int last_column;
|
||||
|
||||
} YYLTYPE;
|
||||
# define YYLTYPE_IS_DECLARED 1
|
||||
# define YYLTYPE_IS_TRIVIAL 1
|
||||
#endif
|
||||
|
||||
|
||||
extern YYSTYPE L_lval;
|
||||
|
||||
extern YYLTYPE L_lloc;
|
||||
|
||||
|
||||
+1750
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+1334
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,498 @@
|
||||
/*
|
||||
* Type-checking helpers for the L programming language.
|
||||
*
|
||||
* Copyright (c) 2006-2008 BitMover, Inc.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include "tclInt.h"
|
||||
#include "Lcompile.h"
|
||||
#include "Lgrammar.h"
|
||||
|
||||
private int typeck_declType(Type *type, VarDecl *decl, int nameof_ok);
|
||||
private int typeck_decls(VarDecl *a, VarDecl *b);
|
||||
private void typeck_fmt(Expr *actuals);
|
||||
private int typeck_list(Type *a, Type *b);
|
||||
|
||||
/* Create the pre-defined types. */
|
||||
void
|
||||
L_typeck_init()
|
||||
{
|
||||
L_int = type_mkScalar(L_INT);
|
||||
L_float = type_mkScalar(L_FLOAT);
|
||||
L_string = type_mkScalar(L_STRING);
|
||||
L_widget = type_mkScalar(L_WIDGET);
|
||||
L_void = type_mkScalar(L_VOID);
|
||||
L_poly = type_mkScalar(L_POLY);
|
||||
}
|
||||
|
||||
private Tcl_Obj *typenmObj = NULL;
|
||||
|
||||
private void
|
||||
str_add(char *s)
|
||||
{
|
||||
if (typenmObj) {
|
||||
Tcl_AppendPrintfToObj(typenmObj, " or %s", s);
|
||||
} else {
|
||||
typenmObj = Tcl_NewStringObj(s, -1);
|
||||
Tcl_IncrRefCount(typenmObj);
|
||||
}
|
||||
}
|
||||
|
||||
char *
|
||||
L_type_str(Type_k kind)
|
||||
{
|
||||
if (typenmObj) {
|
||||
Tcl_DecrRefCount(typenmObj);
|
||||
typenmObj = NULL;
|
||||
}
|
||||
if (kind & L_INT) str_add("int");
|
||||
if (kind & L_FLOAT) str_add("float");
|
||||
if (kind & L_STRING) str_add("string");
|
||||
if (kind & L_WIDGET) str_add("widget");
|
||||
if (kind & L_VOID) str_add("void");
|
||||
if (kind & L_POLY) str_add("poly");
|
||||
if (kind & L_HASH) str_add("hash");
|
||||
if (kind & L_STRUCT) str_add("struct");
|
||||
if (kind & L_ARRAY) str_add("array");
|
||||
if (kind & L_LIST) str_add("list");
|
||||
if (kind & L_FUNCTION) str_add("function");
|
||||
if (kind & L_NAMEOF) str_add("nameof");
|
||||
if (kind & L_CLASS ) str_add("class");
|
||||
return (Tcl_GetString(typenmObj));
|
||||
}
|
||||
|
||||
private void
|
||||
pr_err(Type_k got, Type_k want, char *bef, char *aft, void *node)
|
||||
{
|
||||
Tcl_Obj *obj = Tcl_NewObj();
|
||||
|
||||
Tcl_IncrRefCount(obj);
|
||||
if (bef) Tcl_AppendPrintfToObj(obj, "%s, ", bef);
|
||||
Tcl_AppendPrintfToObj(obj, "expected type %s", L_type_str(want));
|
||||
Tcl_AppendPrintfToObj(obj, " but got %s", L_type_str(got));
|
||||
if (aft) Tcl_AppendPrintfToObj(obj, " %s", aft);
|
||||
L_errf(node, Tcl_GetString(obj));
|
||||
Tcl_DecrRefCount(obj);
|
||||
}
|
||||
|
||||
void
|
||||
L_typeck_deny(Type_k deny, Expr *expr)
|
||||
{
|
||||
ASSERT(expr->type);
|
||||
|
||||
if (hash_get(L->options, "poly")) return;
|
||||
|
||||
if (expr->type->kind & deny) {
|
||||
L_errf(expr, "type %s illegal", L_type_str(expr->type->kind));
|
||||
expr->type = L_poly; // minimize cascading errors
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
L_typeck_expect(Type_k want, Expr *expr, char *msg)
|
||||
{
|
||||
ASSERT(expr->type);
|
||||
|
||||
if (hash_get(L->options, "poly") ||
|
||||
((expr->type->kind | want) & L_POLY)) return;
|
||||
|
||||
unless (expr->type->kind & want) {
|
||||
pr_err(expr->type->kind, want, NULL, msg, expr);
|
||||
expr->type = L_poly; // minimize cascading errors
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
L_typeck_compat(Type *lhs, Type *rhs)
|
||||
{
|
||||
if ((lhs->kind == L_POLY) || (rhs->kind == L_POLY)) {
|
||||
return (TRUE);
|
||||
}
|
||||
if (lhs->kind == L_FLOAT) {
|
||||
return (rhs->kind & (L_INT|L_FLOAT));
|
||||
} else {
|
||||
return (L_typeck_same(lhs, rhs));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
L_typeck_assign(Expr *lhs, Type *rhs)
|
||||
{
|
||||
if (hash_get(L->options, "poly")) return;
|
||||
unless (lhs && rhs) return;
|
||||
|
||||
if ((rhs->kind == L_VOID) || (lhs->type->kind == L_VOID)) {
|
||||
L_errf(lhs, "type void illegal");
|
||||
}
|
||||
unless (L_typeck_compat(lhs->type, rhs)) {
|
||||
L_errf(lhs, "assignment of incompatible types");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
L_typeck_fncall(VarDecl *formals, Expr *call)
|
||||
{
|
||||
int i, type_ok;
|
||||
int rest_arg = 0;
|
||||
Expr *actuals = call->b;
|
||||
|
||||
if (hash_get(L->options, "poly")) return;
|
||||
|
||||
for (i = 1; actuals && formals; ++i) {
|
||||
if (isexpand(actuals)) return;
|
||||
rest_arg = formals->flags & DECL_REST_ARG; // is it "...id"?
|
||||
if (formals->flags & DECL_NAME_EQUIV) {
|
||||
type_ok = (formals->type == actuals->type);
|
||||
} else {
|
||||
type_ok = L_typeck_compat(formals->type, actuals->type);
|
||||
}
|
||||
unless (type_ok || rest_arg) {
|
||||
L_errf(call, "parameter %d has incompatible type", i);
|
||||
}
|
||||
if (typeis(formals->type, "FMT")) {
|
||||
typeck_fmt(actuals);
|
||||
}
|
||||
actuals = actuals->next;
|
||||
formals = formals->next;
|
||||
}
|
||||
if (actuals && !rest_arg) {
|
||||
L_errf(call, "too many arguments for function %s",
|
||||
call->a->str);
|
||||
}
|
||||
if (formals) {
|
||||
unless ((formals->flags & DECL_REST_ARG) ||
|
||||
(!formals->next && (formals->flags & DECL_OPTIONAL))) {
|
||||
L_errf(call, "not enough arguments for function %s",
|
||||
call->a->str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Type check a FMT arg, like
|
||||
* printf(FMT format, ...args)
|
||||
* by checking that the number of % format specifiers in "format" matches the
|
||||
* number of actuals in ...args. We can do this only if "format" is a
|
||||
* string constant and there are no (expand) operators in the args list.
|
||||
*/
|
||||
private void
|
||||
typeck_fmt(Expr *actuals)
|
||||
{
|
||||
int i, nargs = 0;
|
||||
Expr *a;
|
||||
Tcl_Obj *obj, **objv;
|
||||
|
||||
unless (isconst(actuals) && isstring(actuals)) return;
|
||||
|
||||
for (a = actuals->next; a; a = a->next) {
|
||||
if (a->op == L_OP_EXPAND) return;
|
||||
++nargs;
|
||||
}
|
||||
|
||||
obj = Tcl_NewObj();
|
||||
objv = (Tcl_Obj **)ckalloc(nargs * sizeof(Tcl_Obj *));
|
||||
for (i = 0; i < nargs; ++i) {
|
||||
objv[i] = Tcl_NewIntObj(1);
|
||||
Tcl_IncrRefCount(objv[i]);
|
||||
}
|
||||
if (Tcl_AppendFormatToObj(L->interp, obj, actuals->str,
|
||||
nargs, objv) == TCL_ERROR) {
|
||||
Tcl_ResetResult(L->interp);
|
||||
L_warnf(actuals, "bad format specifier");
|
||||
}
|
||||
Tcl_DecrRefCount(obj);
|
||||
for (i = 0; i < nargs; ++i) {
|
||||
Tcl_DecrRefCount(objv[i]);
|
||||
}
|
||||
ckfree((char *)objv);
|
||||
}
|
||||
|
||||
/*
|
||||
* Typecheck the declaration of main() against the allowable forms:
|
||||
*
|
||||
* void|int main()
|
||||
* void|int main(void)
|
||||
* void|int main(string av[])
|
||||
* void|int main(int ac, string av[])
|
||||
* void|int main(int ac, string av[], string env{string})
|
||||
*/
|
||||
void
|
||||
L_typeck_main(VarDecl *decl)
|
||||
{
|
||||
int n;
|
||||
Type *type = decl->type;
|
||||
VarDecl *v;
|
||||
|
||||
unless (isinttype(type->base_type) || isvoidtype(type->base_type)) {
|
||||
L_errf(decl, "main must have int or void return type");
|
||||
}
|
||||
|
||||
/*
|
||||
* Avoid later unused-variable errors on the argc, argv, or
|
||||
* env formals by marking them as used.
|
||||
*/
|
||||
for (n = 0, v = type->u.func.formals; v; v = v->next, ++n) {
|
||||
v->flags |= DECL_ARGUSED;
|
||||
}
|
||||
|
||||
v = type->u.func.formals;
|
||||
switch (n) {
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
unless (isvoidtype(v->type) ||
|
||||
isarrayoftype(v->type, L_STRING)) {
|
||||
L_errf(v, "invalid parameter types for main()");
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
unless (isinttype(v->type) &&
|
||||
isarrayoftype(v->next->type, L_STRING)) {
|
||||
L_errf(v, "invalid parameter types for main()");
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
unless (isinttype(v->type) &&
|
||||
isarrayoftype(v->next->type, L_STRING) &&
|
||||
ishashoftype(v->next->next->type, L_STRING, L_STRING)) {
|
||||
L_errf(v, "invalid parameter types for main()");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
L_errf(v, "too many formal parameters for main()");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Check that a declaration uses legal types. This basically checks
|
||||
* for voids and name-of anywhere in the type where they aren't allowed.
|
||||
*/
|
||||
int
|
||||
L_typeck_declType(VarDecl *decl)
|
||||
{
|
||||
return (typeck_declType(decl->type, decl, FALSE));
|
||||
}
|
||||
private int
|
||||
typeck_declType(Type *type, VarDecl *decl, int nameof_ok)
|
||||
{
|
||||
int ret = 1;
|
||||
char *s = NULL;
|
||||
VarDecl *v;
|
||||
|
||||
switch (type->kind) {
|
||||
case L_VOID:
|
||||
s = "void";
|
||||
ret = 0;
|
||||
break;
|
||||
case L_FUNCTION:
|
||||
/* First check the return type. Void is legal here. */
|
||||
unless (isvoidtype(type->base_type)) {
|
||||
ret = typeck_declType(type->base_type, decl, FALSE);
|
||||
}
|
||||
/* Now look at the formals. */
|
||||
v = type->u.func.formals;
|
||||
for (v = type->u.func.formals; v; v = v->next) {
|
||||
/* To type-check all formals, don't short-circuit. */
|
||||
ret = typeck_declType(v->type, v, TRUE) && ret;
|
||||
}
|
||||
break;
|
||||
case L_NAMEOF:
|
||||
if (nameof_ok) {
|
||||
/* Pass FALSE since name-of of a name-of is illegal. */
|
||||
ret = typeck_declType(type->base_type, decl, FALSE);
|
||||
} else {
|
||||
s = "name-of";
|
||||
ret = 0;
|
||||
}
|
||||
break;
|
||||
case L_ARRAY:
|
||||
ret = typeck_declType(type->base_type, decl, FALSE);
|
||||
break;
|
||||
case L_HASH:
|
||||
ret = typeck_declType(type->base_type, decl, FALSE) &&
|
||||
typeck_declType(type->u.hash.idx_type, decl, FALSE);
|
||||
break;
|
||||
case L_STRUCT:
|
||||
for (v = type->u.struc.members; v; v = v->next) {
|
||||
/* To type-check all members, don't short-circuit. */
|
||||
ret = typeck_declType(v->type, v, FALSE) && ret;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (s) {
|
||||
if (decl->id) {
|
||||
L_errf(decl->id,
|
||||
"type %s illegal in declaration of '%s'",
|
||||
s, decl->id->str);
|
||||
} else {
|
||||
L_errf(decl, "type %s illegal", s);
|
||||
}
|
||||
}
|
||||
return (ret);
|
||||
}
|
||||
|
||||
/*
|
||||
* Determine if two declaration lists have structurally equivalent
|
||||
* type declarations.
|
||||
*/
|
||||
private int
|
||||
typeck_decls(VarDecl *a, VarDecl *b)
|
||||
{
|
||||
for (; a && b; a = a->next, b = b->next) {
|
||||
unless (L_typeck_same(a->type, b->type) &&
|
||||
((a->flags & (DECL_OPTIONAL | DECL_NAME_EQUIV)) ==
|
||||
(b->flags & (DECL_OPTIONAL | DECL_NAME_EQUIV)))) {
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
/* Not the same if one has more declarations. */
|
||||
return !(a || b);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check that a variable type is compatible with the element type of
|
||||
* an array type or a list type (which can be compatible with an array
|
||||
* type).
|
||||
*/
|
||||
int
|
||||
L_typeck_arrElt(Type *var, Type *array)
|
||||
{
|
||||
switch (array->kind) {
|
||||
case L_ARRAY:
|
||||
// Var must be compat with array element type.
|
||||
return (L_typeck_compat(var, array->base_type));
|
||||
case L_LIST:
|
||||
// Var must be compat with all list elements.
|
||||
for (; array; array = array->next) {
|
||||
unless (L_typeck_compat(var, array->base_type)) {
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
return (1);
|
||||
default:
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Determine if something is structurally compatible with a list type.
|
||||
*/
|
||||
private int
|
||||
typeck_list(Type *a, Type *b)
|
||||
{
|
||||
Type *l, *t;
|
||||
VarDecl *m;
|
||||
|
||||
ASSERT((a->kind == L_LIST) || (b->kind == L_LIST));
|
||||
|
||||
/* If only one of a,b is a list, put that in "l". */
|
||||
if (a->kind == L_LIST) {
|
||||
l = a;
|
||||
t = b;
|
||||
} else {
|
||||
l = b;
|
||||
t = a;
|
||||
}
|
||||
|
||||
switch (t->kind) {
|
||||
case L_ARRAY:
|
||||
/*
|
||||
* A list type is compatible with an array type iff all the
|
||||
* list elements have the same type as the array base type.
|
||||
*/
|
||||
for (; l; l = l->next) {
|
||||
ASSERT(l->kind == L_LIST);
|
||||
unless (L_typeck_compat(t->base_type, l->base_type)) {
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
return (1);
|
||||
case L_STRUCT:
|
||||
/*
|
||||
* A list type is compatible with a struct type iff the list
|
||||
* element types match up with the struct member types.
|
||||
*/
|
||||
m = t->u.struc.members;
|
||||
while (m && l) {
|
||||
ASSERT(l->kind == L_LIST);
|
||||
unless (L_typeck_compat(l->base_type, m->type)) {
|
||||
return (0);
|
||||
}
|
||||
m = m->next;
|
||||
l = l->next;
|
||||
}
|
||||
return !(l || m); // not the same if one has more elements
|
||||
case L_LIST:
|
||||
/*
|
||||
* Two list types are compatible iff element types
|
||||
* match up, although one can have more.
|
||||
*/
|
||||
for (; t && l; t = t->next, l = l->next) {
|
||||
unless (L_typeck_same(l->base_type, t->base_type)) {
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
return (1);
|
||||
default:
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Determine if two types are structurally equivalent. Note that
|
||||
* polys match anything and strings and widgets are compatible.
|
||||
*/
|
||||
int
|
||||
L_typeck_same(Type *a, Type *b)
|
||||
{
|
||||
unless (a && b) return (0);
|
||||
|
||||
/* Polys match anything. */
|
||||
if ((a->kind == L_POLY) || (b->kind == L_POLY)) return (1);
|
||||
|
||||
/* Strings and widgets are compatible. */
|
||||
if ((a->kind & (L_STRING|L_WIDGET)) && (b->kind & (L_STRING|L_WIDGET))){
|
||||
return (1);
|
||||
}
|
||||
|
||||
if ((a->kind == L_LIST) || (b->kind == L_LIST)) {
|
||||
return (typeck_list(a, b));
|
||||
}
|
||||
|
||||
unless (a->kind == b->kind) return (0);
|
||||
|
||||
switch (a->kind) {
|
||||
case L_INT:
|
||||
case L_FLOAT:
|
||||
case L_STRING:
|
||||
case L_WIDGET:
|
||||
case L_VOID:
|
||||
return (1);
|
||||
case L_ARRAY:
|
||||
/* Element types must match (array sizes are ignored). */
|
||||
return (L_typeck_same(a->base_type, b->base_type));
|
||||
case L_HASH:
|
||||
/* Element types must match and index types must match. */
|
||||
return (L_typeck_same(a->base_type, b->base_type) &&
|
||||
L_typeck_same(a->u.hash.idx_type, b->u.hash.idx_type));
|
||||
case L_STRUCT:
|
||||
/* Struct members must match in type and number
|
||||
* but member names can be different. */
|
||||
return (typeck_decls(a->u.struc.members, b->u.struc.members));
|
||||
case L_NAMEOF:
|
||||
return (L_typeck_same(a->base_type, b->base_type));
|
||||
case L_FUNCTION:
|
||||
/* Return types must match and all arg types must match. */
|
||||
return (L_typeck_same(a->base_type, b->base_type) &&
|
||||
typeck_decls(a->u.func.formals, b->u.func.formals));
|
||||
case L_CLASS:
|
||||
/* Must be the same class. */
|
||||
return (a->u.class.clsdecl == b->u.class.clsdecl);
|
||||
default:
|
||||
L_bomb("bad type kind in L_typeck_same");
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,446 @@
|
||||
#include "blowfish.h"
|
||||
|
||||
static u32 bfp[] =
|
||||
{
|
||||
0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344,
|
||||
0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89,
|
||||
0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c,
|
||||
0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917,
|
||||
0x9216d5d9, 0x8979fb1b,
|
||||
};
|
||||
|
||||
static u32 ks0[] =
|
||||
{
|
||||
0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7,
|
||||
0xb8e1afed, 0x6a267e96, 0xba7c9045, 0xf12c7f99,
|
||||
0x24a19947, 0xb3916cf7, 0x0801f2e2, 0x858efc16,
|
||||
0x636920d8, 0x71574e69, 0xa458fea3, 0xf4933d7e,
|
||||
0x0d95748f, 0x728eb658, 0x718bcd58, 0x82154aee,
|
||||
0x7b54a41d, 0xc25a59b5, 0x9c30d539, 0x2af26013,
|
||||
0xc5d1b023, 0x286085f0, 0xca417918, 0xb8db38ef,
|
||||
0x8e79dcb0, 0x603a180e, 0x6c9e0e8b, 0xb01e8a3e,
|
||||
0xd71577c1, 0xbd314b27, 0x78af2fda, 0x55605c60,
|
||||
0xe65525f3, 0xaa55ab94, 0x57489862, 0x63e81440,
|
||||
0x55ca396a, 0x2aab10b6, 0xb4cc5c34, 0x1141e8ce,
|
||||
0xa15486af, 0x7c72e993, 0xb3ee1411, 0x636fbc2a,
|
||||
0x2ba9c55d, 0x741831f6, 0xce5c3e16, 0x9b87931e,
|
||||
0xafd6ba33, 0x6c24cf5c, 0x7a325381, 0x28958677,
|
||||
0x3b8f4898, 0x6b4bb9af, 0xc4bfe81b, 0x66282193,
|
||||
0x61d809cc, 0xfb21a991, 0x487cac60, 0x5dec8032,
|
||||
0xef845d5d, 0xe98575b1, 0xdc262302, 0xeb651b88,
|
||||
0x23893e81, 0xd396acc5, 0x0f6d6ff3, 0x83f44239,
|
||||
0x2e0b4482, 0xa4842004, 0x69c8f04a, 0x9e1f9b5e,
|
||||
0x21c66842, 0xf6e96c9a, 0x670c9c61, 0xabd388f0,
|
||||
0x6a51a0d2, 0xd8542f68, 0x960fa728, 0xab5133a3,
|
||||
0x6eef0b6c, 0x137a3be4, 0xba3bf050, 0x7efb2a98,
|
||||
0xa1f1651d, 0x39af0176, 0x66ca593e, 0x82430e88,
|
||||
0x8cee8619, 0x456f9fb4, 0x7d84a5c3, 0x3b8b5ebe,
|
||||
0xe06f75d8, 0x85c12073, 0x401a449f, 0x56c16aa6,
|
||||
0x4ed3aa62, 0x363f7706, 0x1bfedf72, 0x429b023d,
|
||||
0x37d0d724, 0xd00a1248, 0xdb0fead3, 0x49f1c09b,
|
||||
0x075372c9, 0x80991b7b, 0x25d479d8, 0xf6e8def7,
|
||||
0xe3fe501a, 0xb6794c3b, 0x976ce0bd, 0x04c006ba,
|
||||
0xc1a94fb6, 0x409f60c4, 0x5e5c9ec2, 0x196a2463,
|
||||
0x68fb6faf, 0x3e6c53b5, 0x1339b2eb, 0x3b52ec6f,
|
||||
0x6dfc511f, 0x9b30952c, 0xcc814544, 0xaf5ebd09,
|
||||
0xbee3d004, 0xde334afd, 0x660f2807, 0x192e4bb3,
|
||||
0xc0cba857, 0x45c8740f, 0xd20b5f39, 0xb9d3fbdb,
|
||||
0x5579c0bd, 0x1a60320a, 0xd6a100c6, 0x402c7279,
|
||||
0x679f25fe, 0xfb1fa3cc, 0x8ea5e9f8, 0xdb3222f8,
|
||||
0x3c7516df, 0xfd616b15, 0x2f501ec8, 0xad0552ab,
|
||||
0x323db5fa, 0xfd238760, 0x53317b48, 0x3e00df82,
|
||||
0x9e5c57bb, 0xca6f8ca0, 0x1a87562e, 0xdf1769db,
|
||||
0xd542a8f6, 0x287effc3, 0xac6732c6, 0x8c4f5573,
|
||||
0x695b27b0, 0xbbca58c8, 0xe1ffa35d, 0xb8f011a0,
|
||||
0x10fa3d98, 0xfd2183b8, 0x4afcb56c, 0x2dd1d35b,
|
||||
0x9a53e479, 0xb6f84565, 0xd28e49bc, 0x4bfb9790,
|
||||
0xe1ddf2da, 0xa4cb7e33, 0x62fb1341, 0xcee4c6e8,
|
||||
0xef20cada, 0x36774c01, 0xd07e9efe, 0x2bf11fb4,
|
||||
0x95dbda4d, 0xae909198, 0xeaad8e71, 0x6b93d5a0,
|
||||
0xd08ed1d0, 0xafc725e0, 0x8e3c5b2f, 0x8e7594b7,
|
||||
0x8ff6e2fb, 0xf2122b64, 0x8888b812, 0x900df01c,
|
||||
0x4fad5ea0, 0x688fc31c, 0xd1cff191, 0xb3a8c1ad,
|
||||
0x2f2f2218, 0xbe0e1777, 0xea752dfe, 0x8b021fa1,
|
||||
0xe5a0cc0f, 0xb56f74e8, 0x18acf3d6, 0xce89e299,
|
||||
0xb4a84fe0, 0xfd13e0b7, 0x7cc43b81, 0xd2ada8d9,
|
||||
0x165fa266, 0x80957705, 0x93cc7314, 0x211a1477,
|
||||
0xe6ad2065, 0x77b5fa86, 0xc75442f5, 0xfb9d35cf,
|
||||
0xebcdaf0c, 0x7b3e89a0, 0xd6411bd3, 0xae1e7e49,
|
||||
0x00250e2d, 0x2071b35e, 0x226800bb, 0x57b8e0af,
|
||||
0x2464369b, 0xf009b91e, 0x5563911d, 0x59dfa6aa,
|
||||
0x78c14389, 0xd95a537f, 0x207d5ba2, 0x02e5b9c5,
|
||||
0x83260376, 0x6295cfa9, 0x11c81968, 0x4e734a41,
|
||||
0xb3472dca, 0x7b14a94a, 0x1b510052, 0x9a532915,
|
||||
0xd60f573f, 0xbc9bc6e4, 0x2b60a476, 0x81e67400,
|
||||
0x08ba6fb5, 0x571be91f, 0xf296ec6b, 0x2a0dd915,
|
||||
0xb6636521, 0xe7b9f9b6, 0xff34052e, 0xc5855664,
|
||||
0x53b02d5d, 0xa99f8fa1, 0x08ba4799, 0x6e85076a
|
||||
};
|
||||
|
||||
static u32 ks1[]=
|
||||
{
|
||||
0x4b7a70e9, 0xb5b32944, 0xdb75092e, 0xc4192623,
|
||||
0xad6ea6b0, 0x49a7df7d, 0x9cee60b8, 0x8fedb266,
|
||||
0xecaa8c71, 0x699a17ff, 0x5664526c, 0xc2b19ee1,
|
||||
0x193602a5, 0x75094c29, 0xa0591340, 0xe4183a3e,
|
||||
0x3f54989a, 0x5b429d65, 0x6b8fe4d6, 0x99f73fd6,
|
||||
0xa1d29c07, 0xefe830f5, 0x4d2d38e6, 0xf0255dc1,
|
||||
0x4cdd2086, 0x8470eb26, 0x6382e9c6, 0x021ecc5e,
|
||||
0x09686b3f, 0x3ebaefc9, 0x3c971814, 0x6b6a70a1,
|
||||
0x687f3584, 0x52a0e286, 0xb79c5305, 0xaa500737,
|
||||
0x3e07841c, 0x7fdeae5c, 0x8e7d44ec, 0x5716f2b8,
|
||||
0xb03ada37, 0xf0500c0d, 0xf01c1f04, 0x0200b3ff,
|
||||
0xae0cf51a, 0x3cb574b2, 0x25837a58, 0xdc0921bd,
|
||||
0xd19113f9, 0x7ca92ff6, 0x94324773, 0x22f54701,
|
||||
0x3ae5e581, 0x37c2dadc, 0xc8b57634, 0x9af3dda7,
|
||||
0xa9446146, 0x0fd0030e, 0xecc8c73e, 0xa4751e41,
|
||||
0xe238cd99, 0x3bea0e2f, 0x3280bba1, 0x183eb331,
|
||||
0x4e548b38, 0x4f6db908, 0x6f420d03, 0xf60a04bf,
|
||||
0x2cb81290, 0x24977c79, 0x5679b072, 0xbcaf89af,
|
||||
0xde9a771f, 0xd9930810, 0xb38bae12, 0xdccf3f2e,
|
||||
0x5512721f, 0x2e6b7124, 0x501adde6, 0x9f84cd87,
|
||||
0x7a584718, 0x7408da17, 0xbc9f9abc, 0xe94b7d8c,
|
||||
0xec7aec3a, 0xdb851dfa, 0x63094366, 0xc464c3d2,
|
||||
0xef1c1847, 0x3215d908, 0xdd433b37, 0x24c2ba16,
|
||||
0x12a14d43, 0x2a65c451, 0x50940002, 0x133ae4dd,
|
||||
0x71dff89e, 0x10314e55, 0x81ac77d6, 0x5f11199b,
|
||||
0x043556f1, 0xd7a3c76b, 0x3c11183b, 0x5924a509,
|
||||
0xf28fe6ed, 0x97f1fbfa, 0x9ebabf2c, 0x1e153c6e,
|
||||
0x86e34570, 0xeae96fb1, 0x860e5e0a, 0x5a3e2ab3,
|
||||
0x771fe71c, 0x4e3d06fa, 0x2965dcb9, 0x99e71d0f,
|
||||
0x803e89d6, 0x5266c825, 0x2e4cc978, 0x9c10b36a,
|
||||
0xc6150eba, 0x94e2ea78, 0xa5fc3c53, 0x1e0a2df4,
|
||||
0xf2f74ea7, 0x361d2b3d, 0x1939260f, 0x19c27960,
|
||||
0x5223a708, 0xf71312b6, 0xebadfe6e, 0xeac31f66,
|
||||
0xe3bc4595, 0xa67bc883, 0xb17f37d1, 0x018cff28,
|
||||
0xc332ddef, 0xbe6c5aa5, 0x65582185, 0x68ab9802,
|
||||
0xeecea50f, 0xdb2f953b, 0x2aef7dad, 0x5b6e2f84,
|
||||
0x1521b628, 0x29076170, 0xecdd4775, 0x619f1510,
|
||||
0x13cca830, 0xeb61bd96, 0x0334fe1e, 0xaa0363cf,
|
||||
0xb5735c90, 0x4c70a239, 0xd59e9e0b, 0xcbaade14,
|
||||
0xeecc86bc, 0x60622ca7, 0x9cab5cab, 0xb2f3846e,
|
||||
0x648b1eaf, 0x19bdf0ca, 0xa02369b9, 0x655abb50,
|
||||
0x40685a32, 0x3c2ab4b3, 0x319ee9d5, 0xc021b8f7,
|
||||
0x9b540b19, 0x875fa099, 0x95f7997e, 0x623d7da8,
|
||||
0xf837889a, 0x97e32d77, 0x11ed935f, 0x16681281,
|
||||
0x0e358829, 0xc7e61fd6, 0x96dedfa1, 0x7858ba99,
|
||||
0x57f584a5, 0x1b227263, 0x9b83c3ff, 0x1ac24696,
|
||||
0xcdb30aeb, 0x532e3054, 0x8fd948e4, 0x6dbc3128,
|
||||
0x58ebf2ef, 0x34c6ffea, 0xfe28ed61, 0xee7c3c73,
|
||||
0x5d4a14d9, 0xe864b7e3, 0x42105d14, 0x203e13e0,
|
||||
0x45eee2b6, 0xa3aaabea, 0xdb6c4f15, 0xfacb4fd0,
|
||||
0xc742f442, 0xef6abbb5, 0x654f3b1d, 0x41cd2105,
|
||||
0xd81e799e, 0x86854dc7, 0xe44b476a, 0x3d816250,
|
||||
0xcf62a1f2, 0x5b8d2646, 0xfc8883a0, 0xc1c7b6a3,
|
||||
0x7f1524c3, 0x69cb7492, 0x47848a0b, 0x5692b285,
|
||||
0x095bbf00, 0xad19489d, 0x1462b174, 0x23820e00,
|
||||
0x58428d2a, 0x0c55f5ea, 0x1dadf43e, 0x233f7061,
|
||||
0x3372f092, 0x8d937e41, 0xd65fecf1, 0x6c223bdb,
|
||||
0x7cde3759, 0xcbee7460, 0x4085f2a7, 0xce77326e,
|
||||
0xa6078084, 0x19f8509e, 0xe8efd855, 0x61d99735,
|
||||
0xa969a7aa, 0xc50c06c2, 0x5a04abfc, 0x800bcadc,
|
||||
0x9e447a2e, 0xc3453484, 0xfdd56705, 0x0e1e9ec9,
|
||||
0xdb73dbd3, 0x105588cd, 0x675fda79, 0xe3674340,
|
||||
0xc5c43465, 0x713e38d8, 0x3d28f89e, 0xf16dff20,
|
||||
0x153e21e7, 0x8fb03d4a, 0xe6e39f2b, 0xdb83adf7
|
||||
};
|
||||
|
||||
static u32 ks2[] =
|
||||
{
|
||||
0xe93d5a68, 0x948140f7, 0xf64c261c, 0x94692934,
|
||||
0x411520f7, 0x7602d4f7, 0xbcf46b2e, 0xd4a20068,
|
||||
0xd4082471, 0x3320f46a, 0x43b7d4b7, 0x500061af,
|
||||
0x1e39f62e, 0x97244546, 0x14214f74, 0xbf8b8840,
|
||||
0x4d95fc1d, 0x96b591af, 0x70f4ddd3, 0x66a02f45,
|
||||
0xbfbc09ec, 0x03bd9785, 0x7fac6dd0, 0x31cb8504,
|
||||
0x96eb27b3, 0x55fd3941, 0xda2547e6, 0xabca0a9a,
|
||||
0x28507825, 0x530429f4, 0x0a2c86da, 0xe9b66dfb,
|
||||
0x68dc1462, 0xd7486900, 0x680ec0a4, 0x27a18dee,
|
||||
0x4f3ffea2, 0xe887ad8c, 0xb58ce006, 0x7af4d6b6,
|
||||
0xaace1e7c, 0xd3375fec, 0xce78a399, 0x406b2a42,
|
||||
0x20fe9e35, 0xd9f385b9, 0xee39d7ab, 0x3b124e8b,
|
||||
0x1dc9faf7, 0x4b6d1856, 0x26a36631, 0xeae397b2,
|
||||
0x3a6efa74, 0xdd5b4332, 0x6841e7f7, 0xca7820fb,
|
||||
0xfb0af54e, 0xd8feb397, 0x454056ac, 0xba489527,
|
||||
0x55533a3a, 0x20838d87, 0xfe6ba9b7, 0xd096954b,
|
||||
0x55a867bc, 0xa1159a58, 0xcca92963, 0x99e1db33,
|
||||
0xa62a4a56, 0x3f3125f9, 0x5ef47e1c, 0x9029317c,
|
||||
0xfdf8e802, 0x04272f70, 0x80bb155c, 0x05282ce3,
|
||||
0x95c11548, 0xe4c66d22, 0x48c1133f, 0xc70f86dc,
|
||||
0x07f9c9ee, 0x41041f0f, 0x404779a4, 0x5d886e17,
|
||||
0x325f51eb, 0xd59bc0d1, 0xf2bcc18f, 0x41113564,
|
||||
0x257b7834, 0x602a9c60, 0xdff8e8a3, 0x1f636c1b,
|
||||
0x0e12b4c2, 0x02e1329e, 0xaf664fd1, 0xcad18115,
|
||||
0x6b2395e0, 0x333e92e1, 0x3b240b62, 0xeebeb922,
|
||||
0x85b2a20e, 0xe6ba0d99, 0xde720c8c, 0x2da2f728,
|
||||
0xd0127845, 0x95b794fd, 0x647d0862, 0xe7ccf5f0,
|
||||
0x5449a36f, 0x877d48fa, 0xc39dfd27, 0xf33e8d1e,
|
||||
0x0a476341, 0x992eff74, 0x3a6f6eab, 0xf4f8fd37,
|
||||
0xa812dc60, 0xa1ebddf8, 0x991be14c, 0xdb6e6b0d,
|
||||
0xc67b5510, 0x6d672c37, 0x2765d43b, 0xdcd0e804,
|
||||
0xf1290dc7, 0xcc00ffa3, 0xb5390f92, 0x690fed0b,
|
||||
0x667b9ffb, 0xcedb7d9c, 0xa091cf0b, 0xd9155ea3,
|
||||
0xbb132f88, 0x515bad24, 0x7b9479bf, 0x763bd6eb,
|
||||
0x37392eb3, 0xcc115979, 0x8026e297, 0xf42e312d,
|
||||
0x6842ada7, 0xc66a2b3b, 0x12754ccc, 0x782ef11c,
|
||||
0x6a124237, 0xb79251e7, 0x06a1bbe6, 0x4bfb6350,
|
||||
0x1a6b1018, 0x11caedfa, 0x3d25bdd8, 0xe2e1c3c9,
|
||||
0x44421659, 0x0a121386, 0xd90cec6e, 0xd5abea2a,
|
||||
0x64af674e, 0xda86a85f, 0xbebfe988, 0x64e4c3fe,
|
||||
0x9dbc8057, 0xf0f7c086, 0x60787bf8, 0x6003604d,
|
||||
0xd1fd8346, 0xf6381fb0, 0x7745ae04, 0xd736fccc,
|
||||
0x83426b33, 0xf01eab71, 0xb0804187, 0x3c005e5f,
|
||||
0x77a057be, 0xbde8ae24, 0x55464299, 0xbf582e61,
|
||||
0x4e58f48f, 0xf2ddfda2, 0xf474ef38, 0x8789bdc2,
|
||||
0x5366f9c3, 0xc8b38e74, 0xb475f255, 0x46fcd9b9,
|
||||
0x7aeb2661, 0x8b1ddf84, 0x846a0e79, 0x915f95e2,
|
||||
0x466e598e, 0x20b45770, 0x8cd55591, 0xc902de4c,
|
||||
0xb90bace1, 0xbb8205d0, 0x11a86248, 0x7574a99e,
|
||||
0xb77f19b6, 0xe0a9dc09, 0x662d09a1, 0xc4324633,
|
||||
0xe85a1f02, 0x09f0be8c, 0x4a99a025, 0x1d6efe10,
|
||||
0x1ab93d1d, 0x0ba5a4df, 0xa186f20f, 0x2868f169,
|
||||
0xdcb7da83, 0x573906fe, 0xa1e2ce9b, 0x4fcd7f52,
|
||||
0x50115e01, 0xa70683fa, 0xa002b5c4, 0x0de6d027,
|
||||
0x9af88c27, 0x773f8641, 0xc3604c06, 0x61a806b5,
|
||||
0xf0177a28, 0xc0f586e0, 0x006058aa, 0x30dc7d62,
|
||||
0x11e69ed7, 0x2338ea63, 0x53c2dd94, 0xc2c21634,
|
||||
0xbbcbee56, 0x90bcb6de, 0xebfc7da1, 0xce591d76,
|
||||
0x6f05e409, 0x4b7c0188, 0x39720a3d, 0x7c927c24,
|
||||
0x86e3725f, 0x724d9db9, 0x1ac15bb4, 0xd39eb8fc,
|
||||
0xed545578, 0x08fca5b5, 0xd83d7cd3, 0x4dad0fc4,
|
||||
0x1e50ef5e, 0xb161e6f8, 0xa28514d9, 0x6c51133c,
|
||||
0x6fd5c7e7, 0x56e14ec4, 0x362abfce, 0xddc6c837,
|
||||
0xd79a3234, 0x92638212, 0x670efa8e, 0x406000e0
|
||||
};
|
||||
|
||||
static u32 ks3[] =
|
||||
{
|
||||
0x3a39ce37, 0xd3faf5cf, 0xabc27737, 0x5ac52d1b,
|
||||
0x5cb0679e, 0x4fa33742, 0xd3822740, 0x99bc9bbe,
|
||||
0xd5118e9d, 0xbf0f7315, 0xd62d1c7e, 0xc700c47b,
|
||||
0xb78c1b6b, 0x21a19045, 0xb26eb1be, 0x6a366eb4,
|
||||
0x5748ab2f, 0xbc946e79, 0xc6a376d2, 0x6549c2c8,
|
||||
0x530ff8ee, 0x468dde7d, 0xd5730a1d, 0x4cd04dc6,
|
||||
0x2939bbdb, 0xa9ba4650, 0xac9526e8, 0xbe5ee304,
|
||||
0xa1fad5f0, 0x6a2d519a, 0x63ef8ce2, 0x9a86ee22,
|
||||
0xc089c2b8, 0x43242ef6, 0xa51e03aa, 0x9cf2d0a4,
|
||||
0x83c061ba, 0x9be96a4d, 0x8fe51550, 0xba645bd6,
|
||||
0x2826a2f9, 0xa73a3ae1, 0x4ba99586, 0xef5562e9,
|
||||
0xc72fefd3, 0xf752f7da, 0x3f046f69, 0x77fa0a59,
|
||||
0x80e4a915, 0x87b08601, 0x9b09e6ad, 0x3b3ee593,
|
||||
0xe990fd5a, 0x9e34d797, 0x2cf0b7d9, 0x022b8b51,
|
||||
0x96d5ac3a, 0x017da67d, 0xd1cf3ed6, 0x7c7d2d28,
|
||||
0x1f9f25cf, 0xadf2b89b, 0x5ad6b472, 0x5a88f54c,
|
||||
0xe029ac71, 0xe019a5e6, 0x47b0acfd, 0xed93fa9b,
|
||||
0xe8d3c48d, 0x283b57cc, 0xf8d56629, 0x79132e28,
|
||||
0x785f0191, 0xed756055, 0xf7960e44, 0xe3d35e8c,
|
||||
0x15056dd4, 0x88f46dba, 0x03a16125, 0x0564f0bd,
|
||||
0xc3eb9e15, 0x3c9057a2, 0x97271aec, 0xa93a072a,
|
||||
0x1b3f6d9b, 0x1e6321f5, 0xf59c66fb, 0x26dcf319,
|
||||
0x7533d928, 0xb155fdf5, 0x03563482, 0x8aba3cbb,
|
||||
0x28517711, 0xc20ad9f8, 0xabcc5167, 0xccad925f,
|
||||
0x4de81751, 0x3830dc8e, 0x379d5862, 0x9320f991,
|
||||
0xea7a90c2, 0xfb3e7bce, 0x5121ce64, 0x774fbe32,
|
||||
0xa8b6e37e, 0xc3293d46, 0x48de5369, 0x6413e680,
|
||||
0xa2ae0810, 0xdd6db224, 0x69852dfd, 0x09072166,
|
||||
0xb39a460a, 0x6445c0dd, 0x586cdecf, 0x1c20c8ae,
|
||||
0x5bbef7dd, 0x1b588d40, 0xccd2017f, 0x6bb4e3bb,
|
||||
0xdda26a7e, 0x3a59ff45, 0x3e350a44, 0xbcb4cdd5,
|
||||
0x72eacea8, 0xfa6484bb, 0x8d6612ae, 0xbf3c6f47,
|
||||
0xd29be463, 0x542f5d9e, 0xaec2771b, 0xf64e6370,
|
||||
0x740e0d8d, 0xe75b1357, 0xf8721671, 0xaf537d5d,
|
||||
0x4040cb08, 0x4eb4e2cc, 0x34d2466a, 0x0115af84,
|
||||
0xe1b00428, 0x95983a1d, 0x06b89fb4, 0xce6ea048,
|
||||
0x6f3f3b82, 0x3520ab82, 0x011a1d4b, 0x277227f8,
|
||||
0x611560b1, 0xe7933fdc, 0xbb3a792b, 0x344525bd,
|
||||
0xa08839e1, 0x51ce794b, 0x2f32c9b7, 0xa01fbac9,
|
||||
0xe01cc87e, 0xbcc7d1f6, 0xcf0111c3, 0xa1e8aac7,
|
||||
0x1a908749, 0xd44fbd9a, 0xd0dadecb, 0xd50ada38,
|
||||
0x0339c32a, 0xc6913667, 0x8df9317c, 0xe0b12b4f,
|
||||
0xf79e59b7, 0x43f5bb3a, 0xf2d519ff, 0x27d9459c,
|
||||
0xbf97222c, 0x15e6fc2a, 0x0f91fc71, 0x9b941525,
|
||||
0xfae59361, 0xceb69ceb, 0xc2a86459, 0x12baa8d1,
|
||||
0xb6c1075e, 0xe3056a0c, 0x10d25065, 0xcb03a442,
|
||||
0xe0ec6e0e, 0x1698db3b, 0x4c98a0be, 0x3278e964,
|
||||
0x9f1f9532, 0xe0d392df, 0xd3a0342b, 0x8971f21e,
|
||||
0x1b0a7441, 0x4ba3348c, 0xc5be7120, 0xc37632d8,
|
||||
0xdf359f8d, 0x9b992f2e, 0xe60b6f47, 0x0fe3f11d,
|
||||
0xe54cda54, 0x1edad891, 0xce6279cf, 0xcd3e7e6f,
|
||||
0x1618b166, 0xfd2c1d05, 0x848fd2c5, 0xf6fb2299,
|
||||
0xf523f357, 0xa6327623, 0x93a83531, 0x56cccd02,
|
||||
0xacf08162, 0x5a75ebb5, 0x6e163697, 0x88d273cc,
|
||||
0xde966292, 0x81b949d0, 0x4c50901b, 0x71c65614,
|
||||
0xe6c6c7bd, 0x327a140a, 0x45e1d006, 0xc3f27b9a,
|
||||
0xc9aa53fd, 0x62a80f00, 0xbb25bfe2, 0x35bdd2f6,
|
||||
0x71126905, 0xb2040222, 0xb6cbcf7c, 0xcd769c2b,
|
||||
0x53113ec0, 0x1640e3d3, 0x38abbd60, 0x2547adf0,
|
||||
0xba38209c, 0xf746ce76, 0x77afa1c5, 0x20756060,
|
||||
0x85cbfe4e, 0x8ae88dd8, 0x7aaaf9b0, 0x4cf9aa7e,
|
||||
0x1948c25c, 0x02fb8a8c, 0x01c36ae4, 0xd6ebe1f9,
|
||||
0x90d4f869, 0xa65cdea0, 0x3f09252d, 0xc208e69f,
|
||||
0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6
|
||||
};
|
||||
|
||||
#define N 16
|
||||
|
||||
static u32
|
||||
F(blf_ctx *bc, u32 x)
|
||||
{
|
||||
u32 a, b, c, d, y;
|
||||
|
||||
d = x & 0x00FF;
|
||||
x >>= 8;
|
||||
c = x & 0x00FF;
|
||||
x >>= 8;
|
||||
b = x & 0x00FF;
|
||||
x >>= 8;
|
||||
a = x & 0x00FF;
|
||||
y = bc->S[0][a] + bc->S[1][b];
|
||||
y = y ^ bc->S[2][c];
|
||||
y = y + bc->S[3][d];
|
||||
|
||||
return y;
|
||||
}
|
||||
|
||||
static void
|
||||
Blowfish_encipher(blf_ctx *bc, u32 *xl, u32 *xr)
|
||||
{
|
||||
u32 Xl, Xr;
|
||||
u32 temp;
|
||||
short i;
|
||||
|
||||
Xl = *xl;
|
||||
Xr = *xr;
|
||||
|
||||
for (i = 0; i < N; ++i) {
|
||||
Xl = Xl ^ bc->P[i];
|
||||
Xr = F(bc, Xl) ^ Xr;
|
||||
|
||||
temp = Xl;
|
||||
Xl = Xr;
|
||||
Xr = temp;
|
||||
}
|
||||
|
||||
temp = Xl;
|
||||
Xl = Xr;
|
||||
Xr = temp;
|
||||
|
||||
Xr = Xr ^ bc->P[N];
|
||||
Xl = Xl ^ bc->P[N + 1];
|
||||
|
||||
*xl = Xl;
|
||||
*xr = Xr;
|
||||
}
|
||||
|
||||
static void
|
||||
Blowfish_decipher(blf_ctx *bc, u32 *xl, u32 *xr)
|
||||
{
|
||||
u32 Xl, Xr;
|
||||
u32 temp;
|
||||
short i;
|
||||
|
||||
Xl = *xl;
|
||||
Xr = *xr;
|
||||
|
||||
for (i = N + 1; i > 1; --i) {
|
||||
Xl = Xl ^ bc->P[i];
|
||||
Xr = F(bc, Xl) ^ Xr;
|
||||
|
||||
/* Exchange Xl and Xr */
|
||||
temp = Xl;
|
||||
Xl = Xr;
|
||||
Xr = temp;
|
||||
}
|
||||
|
||||
/* Exchange Xl and Xr */
|
||||
temp = Xl;
|
||||
Xl = Xr;
|
||||
Xr = temp;
|
||||
|
||||
Xr = Xr ^ bc->P[1];
|
||||
Xl = Xl ^ bc->P[0];
|
||||
|
||||
*xl = Xl;
|
||||
*xr = Xr;
|
||||
}
|
||||
|
||||
static short
|
||||
InitializeBlowfish(blf_ctx *bc, u8 key[], int keybytes)
|
||||
{
|
||||
short i, j, k;
|
||||
u32 data, datal, datar;
|
||||
|
||||
/* initialise p & s-boxes without file read */
|
||||
for (i = 0; i < N+2; i++) {
|
||||
bc->P[i] = bfp[i];
|
||||
}
|
||||
for (i = 0; i < 256; i++) {
|
||||
bc->S[0][i] = ks0[i];
|
||||
bc->S[1][i] = ks1[i];
|
||||
bc->S[2][i] = ks2[i];
|
||||
bc->S[3][i] = ks3[i];
|
||||
}
|
||||
|
||||
j = 0;
|
||||
for (i = 0; i < N + 2; ++i) {
|
||||
data = 0x00000000;
|
||||
for (k = 0; k < 4; ++k) {
|
||||
data = (data << 8) | key[j];
|
||||
j = j + 1;
|
||||
if (j >= keybytes) j = 0;
|
||||
}
|
||||
bc->P[i] = bc->P[i] ^ data;
|
||||
}
|
||||
|
||||
datal = 0x00000000;
|
||||
datar = 0x00000000;
|
||||
|
||||
for (i = 0; i < N + 2; i += 2) {
|
||||
Blowfish_encipher(bc, &datal, &datar);
|
||||
|
||||
bc->P[i] = datal;
|
||||
bc->P[i + 1] = datar;
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; ++i) {
|
||||
for (j = 0; j < 256; j += 2) {
|
||||
Blowfish_encipher(bc, &datal, &datar);
|
||||
|
||||
bc->S[i][j] = datal;
|
||||
bc->S[i][j + 1] = datar;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
blf_key (blf_ctx *c, u8 *k, int len)
|
||||
{
|
||||
InitializeBlowfish(c, k, len);
|
||||
}
|
||||
|
||||
void
|
||||
blf_enc(blf_ctx *c, u32 *data, int blocks)
|
||||
{
|
||||
u32 *d;
|
||||
int i;
|
||||
|
||||
d = data;
|
||||
for (i = 0; i < blocks; i++) {
|
||||
Blowfish_encipher(c, d, d+1);
|
||||
d += 2;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
blf_dec(blf_ctx *c, u32 *data, int blocks)
|
||||
{
|
||||
u32 *d;
|
||||
int i;
|
||||
|
||||
d = data;
|
||||
for (i = 0; i < blocks; i++) {
|
||||
Blowfish_decipher(c, d, d+1);
|
||||
d += 2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
typedef unsigned int u32;
|
||||
typedef unsigned char u8;
|
||||
|
||||
typedef struct {
|
||||
u32 S[4][256];
|
||||
u32 P[18];
|
||||
} blf_ctx;
|
||||
|
||||
void blf_enc(blf_ctx *c, u32 *data, int blocks);
|
||||
void blf_dec(blf_ctx *c, u32 *data, int blocks);
|
||||
void blf_key(blf_ctx *c, unsigned char *key, int len);
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
char *
|
||||
keydecode(char *key)
|
||||
{
|
||||
unsigned int len, half, i, j;
|
||||
char *newkey;
|
||||
|
||||
if (key == NULL) {
|
||||
err: return (key);
|
||||
}
|
||||
len = strlen(key);
|
||||
half = len / 2;
|
||||
if ((len %2) != 0) goto err; /* len must be even */
|
||||
|
||||
newkey = malloc(len);
|
||||
|
||||
/* unpack the old bytes */
|
||||
for (j = 1, i = 0; i < half; i++, j +=2) newkey[j] = key[i];
|
||||
|
||||
/* unpack the even bytes */
|
||||
for (j = 0, i = half; i < len; i++, j +=2) newkey[j] = key[i];
|
||||
|
||||
memcpy(key, newkey, len);
|
||||
free(newkey);
|
||||
return (key);
|
||||
}
|
||||
@@ -259,7 +259,7 @@ newcolor(
|
||||
return COLORLESS; /* too many colors */
|
||||
}
|
||||
n = cm->ncds * 2;
|
||||
if (n < MAX_COLOR + 1) {
|
||||
if (n > MAX_COLOR + 1) {
|
||||
n = MAX_COLOR + 1;
|
||||
}
|
||||
if (cm->cd == cm->cdspace) {
|
||||
@@ -777,18 +777,19 @@ dumpcolors(
|
||||
}
|
||||
|
||||
/*
|
||||
* It's hard to do this more efficiently.
|
||||
* Unfortunately, it's hard to do this next bit more efficiently.
|
||||
*
|
||||
* Spencer's original coding has the loop iterating from CHR_MIN
|
||||
* to CHR_MAX, but that's utterly unusable for 32-bit chr, or
|
||||
* even 16-bit. For debugging purposes it seems fine to print
|
||||
* only chr codes up to 1000 or so.
|
||||
*/
|
||||
|
||||
for (c=CHR_MIN ; c<CHR_MAX ; c++) {
|
||||
for (c=CHR_MIN ; c<1000 ; c++) {
|
||||
if (GETCOLOR(cm, c) == co) {
|
||||
dumpchr(c, f);
|
||||
}
|
||||
}
|
||||
assert(c == CHR_MAX);
|
||||
if (GETCOLOR(cm, c) == co) {
|
||||
dumpchr(c, f);
|
||||
}
|
||||
fprintf(f, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,6 +81,7 @@ addchr(
|
||||
struct cvec *cv, /* character vector */
|
||||
pchr c) /* character to add */
|
||||
{
|
||||
assert(cv->nchrs < cv->chrspace);
|
||||
cv->chrs[cv->nchrs++] = (chr)c;
|
||||
}
|
||||
|
||||
|
||||
@@ -1138,24 +1138,6 @@ newline(void)
|
||||
return CHR('\n');
|
||||
}
|
||||
|
||||
/*
|
||||
- ch - return the chr sequence for regc_locale.c's fake collating element ch
|
||||
* This helps confine use of CHR to this source file. Beware that the caller
|
||||
* knows how long the sequence is.
|
||||
^ #ifdef REG_DEBUG
|
||||
^ static const chr *ch(NOPARMS);
|
||||
^ #endif
|
||||
*/
|
||||
#ifdef REG_DEBUG
|
||||
static const chr *
|
||||
ch(void)
|
||||
{
|
||||
static const chr chstr[] = { CHR('c'), CHR('h'), CHR('\0') };
|
||||
|
||||
return chstr;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
- chrnamed - return the chr known by a given (chr string) name
|
||||
* The code is a bit clumsy, but this routine gets only such specialized
|
||||
|
||||
+255
-242
@@ -140,7 +140,7 @@ static const crange alphaRangeTable[] = {
|
||||
{0x3f7, 0x481}, {0x48a, 0x52f}, {0x531, 0x556}, {0x561, 0x587},
|
||||
{0x5d0, 0x5ea}, {0x5f0, 0x5f2}, {0x620, 0x64a}, {0x671, 0x6d3},
|
||||
{0x6fa, 0x6fc}, {0x712, 0x72f}, {0x74d, 0x7a5}, {0x7ca, 0x7ea},
|
||||
{0x800, 0x815}, {0x840, 0x858}, {0x8a0, 0x8b2}, {0x904, 0x939},
|
||||
{0x800, 0x815}, {0x840, 0x858}, {0x8a0, 0x8b4}, {0x904, 0x939},
|
||||
{0x958, 0x961}, {0x971, 0x980}, {0x985, 0x98c}, {0x993, 0x9a8},
|
||||
{0x9aa, 0x9b0}, {0x9b6, 0x9b9}, {0x9df, 0x9e1}, {0xa05, 0xa0a},
|
||||
{0xa13, 0xa28}, {0xa2a, 0xa30}, {0xa59, 0xa5c}, {0xa72, 0xa74},
|
||||
@@ -148,55 +148,58 @@ static const crange alphaRangeTable[] = {
|
||||
{0xab5, 0xab9}, {0xb05, 0xb0c}, {0xb13, 0xb28}, {0xb2a, 0xb30},
|
||||
{0xb35, 0xb39}, {0xb5f, 0xb61}, {0xb85, 0xb8a}, {0xb8e, 0xb90},
|
||||
{0xb92, 0xb95}, {0xba8, 0xbaa}, {0xbae, 0xbb9}, {0xc05, 0xc0c},
|
||||
{0xc0e, 0xc10}, {0xc12, 0xc28}, {0xc2a, 0xc39}, {0xc85, 0xc8c},
|
||||
{0xc8e, 0xc90}, {0xc92, 0xca8}, {0xcaa, 0xcb3}, {0xcb5, 0xcb9},
|
||||
{0xd05, 0xd0c}, {0xd0e, 0xd10}, {0xd12, 0xd3a}, {0xd7a, 0xd7f},
|
||||
{0xd85, 0xd96}, {0xd9a, 0xdb1}, {0xdb3, 0xdbb}, {0xdc0, 0xdc6},
|
||||
{0xe01, 0xe30}, {0xe40, 0xe46}, {0xe94, 0xe97}, {0xe99, 0xe9f},
|
||||
{0xea1, 0xea3}, {0xead, 0xeb0}, {0xec0, 0xec4}, {0xedc, 0xedf},
|
||||
{0xf40, 0xf47}, {0xf49, 0xf6c}, {0xf88, 0xf8c}, {0x1000, 0x102a},
|
||||
{0x1050, 0x1055}, {0x105a, 0x105d}, {0x106e, 0x1070}, {0x1075, 0x1081},
|
||||
{0x10a0, 0x10c5}, {0x10d0, 0x10fa}, {0x10fc, 0x1248}, {0x124a, 0x124d},
|
||||
{0x1250, 0x1256}, {0x125a, 0x125d}, {0x1260, 0x1288}, {0x128a, 0x128d},
|
||||
{0x1290, 0x12b0}, {0x12b2, 0x12b5}, {0x12b8, 0x12be}, {0x12c2, 0x12c5},
|
||||
{0x12c8, 0x12d6}, {0x12d8, 0x1310}, {0x1312, 0x1315}, {0x1318, 0x135a},
|
||||
{0x1380, 0x138f}, {0x13a0, 0x13f4}, {0x1401, 0x166c}, {0x166f, 0x167f},
|
||||
{0x1681, 0x169a}, {0x16a0, 0x16ea}, {0x16f1, 0x16f8}, {0x1700, 0x170c},
|
||||
{0x170e, 0x1711}, {0x1720, 0x1731}, {0x1740, 0x1751}, {0x1760, 0x176c},
|
||||
{0x176e, 0x1770}, {0x1780, 0x17b3}, {0x1820, 0x1877}, {0x1880, 0x18a8},
|
||||
{0x18b0, 0x18f5}, {0x1900, 0x191e}, {0x1950, 0x196d}, {0x1970, 0x1974},
|
||||
{0x1980, 0x19ab}, {0x19c1, 0x19c7}, {0x1a00, 0x1a16}, {0x1a20, 0x1a54},
|
||||
{0x1b05, 0x1b33}, {0x1b45, 0x1b4b}, {0x1b83, 0x1ba0}, {0x1bba, 0x1be5},
|
||||
{0x1c00, 0x1c23}, {0x1c4d, 0x1c4f}, {0x1c5a, 0x1c7d}, {0x1ce9, 0x1cec},
|
||||
{0x1cee, 0x1cf1}, {0x1d00, 0x1dbf}, {0x1e00, 0x1f15}, {0x1f18, 0x1f1d},
|
||||
{0x1f20, 0x1f45}, {0x1f48, 0x1f4d}, {0x1f50, 0x1f57}, {0x1f5f, 0x1f7d},
|
||||
{0x1f80, 0x1fb4}, {0x1fb6, 0x1fbc}, {0x1fc2, 0x1fc4}, {0x1fc6, 0x1fcc},
|
||||
{0x1fd0, 0x1fd3}, {0x1fd6, 0x1fdb}, {0x1fe0, 0x1fec}, {0x1ff2, 0x1ff4},
|
||||
{0x1ff6, 0x1ffc}, {0x2090, 0x209c}, {0x210a, 0x2113}, {0x2119, 0x211d},
|
||||
{0x212a, 0x212d}, {0x212f, 0x2139}, {0x213c, 0x213f}, {0x2145, 0x2149},
|
||||
{0x2c00, 0x2c2e}, {0x2c30, 0x2c5e}, {0x2c60, 0x2ce4}, {0x2ceb, 0x2cee},
|
||||
{0x2d00, 0x2d25}, {0x2d30, 0x2d67}, {0x2d80, 0x2d96}, {0x2da0, 0x2da6},
|
||||
{0x2da8, 0x2dae}, {0x2db0, 0x2db6}, {0x2db8, 0x2dbe}, {0x2dc0, 0x2dc6},
|
||||
{0x2dc8, 0x2dce}, {0x2dd0, 0x2dd6}, {0x2dd8, 0x2dde}, {0x3031, 0x3035},
|
||||
{0x3041, 0x3096}, {0x309d, 0x309f}, {0x30a1, 0x30fa}, {0x30fc, 0x30ff},
|
||||
{0x3105, 0x312d}, {0x3131, 0x318e}, {0x31a0, 0x31ba}, {0x31f0, 0x31ff},
|
||||
{0x3400, 0x4db5}, {0x4e00, 0x9fcc}, {0xa000, 0xa48c}, {0xa4d0, 0xa4fd},
|
||||
{0xa500, 0xa60c}, {0xa610, 0xa61f}, {0xa640, 0xa66e}, {0xa67f, 0xa69d},
|
||||
{0xa6a0, 0xa6e5}, {0xa717, 0xa71f}, {0xa722, 0xa788}, {0xa78b, 0xa78e},
|
||||
{0xa790, 0xa7ad}, {0xa7f7, 0xa801}, {0xa803, 0xa805}, {0xa807, 0xa80a},
|
||||
{0xa80c, 0xa822}, {0xa840, 0xa873}, {0xa882, 0xa8b3}, {0xa8f2, 0xa8f7},
|
||||
{0xa90a, 0xa925}, {0xa930, 0xa946}, {0xa960, 0xa97c}, {0xa984, 0xa9b2},
|
||||
{0xa9e0, 0xa9e4}, {0xa9e6, 0xa9ef}, {0xa9fa, 0xa9fe}, {0xaa00, 0xaa28},
|
||||
{0xaa40, 0xaa42}, {0xaa44, 0xaa4b}, {0xaa60, 0xaa76}, {0xaa7e, 0xaaaf},
|
||||
{0xaab9, 0xaabd}, {0xaadb, 0xaadd}, {0xaae0, 0xaaea}, {0xaaf2, 0xaaf4},
|
||||
{0xab01, 0xab06}, {0xab09, 0xab0e}, {0xab11, 0xab16}, {0xab20, 0xab26},
|
||||
{0xab28, 0xab2e}, {0xab30, 0xab5a}, {0xab5c, 0xab5f}, {0xabc0, 0xabe2},
|
||||
{0xac00, 0xd7a3}, {0xd7b0, 0xd7c6}, {0xd7cb, 0xd7fb}, {0xf900, 0xfa6d},
|
||||
{0xfa70, 0xfad9}, {0xfb00, 0xfb06}, {0xfb13, 0xfb17}, {0xfb1f, 0xfb28},
|
||||
{0xfb2a, 0xfb36}, {0xfb38, 0xfb3c}, {0xfb46, 0xfbb1}, {0xfbd3, 0xfd3d},
|
||||
{0xfd50, 0xfd8f}, {0xfd92, 0xfdc7}, {0xfdf0, 0xfdfb}, {0xfe70, 0xfe74},
|
||||
{0xfe76, 0xfefc}, {0xff21, 0xff3a}, {0xff41, 0xff5a}, {0xff66, 0xffbe},
|
||||
{0xffc2, 0xffc7}, {0xffca, 0xffcf}, {0xffd2, 0xffd7}, {0xffda, 0xffdc}
|
||||
{0xc0e, 0xc10}, {0xc12, 0xc28}, {0xc2a, 0xc39}, {0xc58, 0xc5a},
|
||||
{0xc85, 0xc8c}, {0xc8e, 0xc90}, {0xc92, 0xca8}, {0xcaa, 0xcb3},
|
||||
{0xcb5, 0xcb9}, {0xd05, 0xd0c}, {0xd0e, 0xd10}, {0xd12, 0xd3a},
|
||||
{0xd5f, 0xd61}, {0xd7a, 0xd7f}, {0xd85, 0xd96}, {0xd9a, 0xdb1},
|
||||
{0xdb3, 0xdbb}, {0xdc0, 0xdc6}, {0xe01, 0xe30}, {0xe40, 0xe46},
|
||||
{0xe94, 0xe97}, {0xe99, 0xe9f}, {0xea1, 0xea3}, {0xead, 0xeb0},
|
||||
{0xec0, 0xec4}, {0xedc, 0xedf}, {0xf40, 0xf47}, {0xf49, 0xf6c},
|
||||
{0xf88, 0xf8c}, {0x1000, 0x102a}, {0x1050, 0x1055}, {0x105a, 0x105d},
|
||||
{0x106e, 0x1070}, {0x1075, 0x1081}, {0x10a0, 0x10c5}, {0x10d0, 0x10fa},
|
||||
{0x10fc, 0x1248}, {0x124a, 0x124d}, {0x1250, 0x1256}, {0x125a, 0x125d},
|
||||
{0x1260, 0x1288}, {0x128a, 0x128d}, {0x1290, 0x12b0}, {0x12b2, 0x12b5},
|
||||
{0x12b8, 0x12be}, {0x12c2, 0x12c5}, {0x12c8, 0x12d6}, {0x12d8, 0x1310},
|
||||
{0x1312, 0x1315}, {0x1318, 0x135a}, {0x1380, 0x138f}, {0x13a0, 0x13f5},
|
||||
{0x13f8, 0x13fd}, {0x1401, 0x166c}, {0x166f, 0x167f}, {0x1681, 0x169a},
|
||||
{0x16a0, 0x16ea}, {0x16f1, 0x16f8}, {0x1700, 0x170c}, {0x170e, 0x1711},
|
||||
{0x1720, 0x1731}, {0x1740, 0x1751}, {0x1760, 0x176c}, {0x176e, 0x1770},
|
||||
{0x1780, 0x17b3}, {0x1820, 0x1877}, {0x1880, 0x18a8}, {0x18b0, 0x18f5},
|
||||
{0x1900, 0x191e}, {0x1950, 0x196d}, {0x1970, 0x1974}, {0x1980, 0x19ab},
|
||||
{0x19b0, 0x19c9}, {0x1a00, 0x1a16}, {0x1a20, 0x1a54}, {0x1b05, 0x1b33},
|
||||
{0x1b45, 0x1b4b}, {0x1b83, 0x1ba0}, {0x1bba, 0x1be5}, {0x1c00, 0x1c23},
|
||||
{0x1c4d, 0x1c4f}, {0x1c5a, 0x1c7d}, {0x1ce9, 0x1cec}, {0x1cee, 0x1cf1},
|
||||
{0x1d00, 0x1dbf}, {0x1e00, 0x1f15}, {0x1f18, 0x1f1d}, {0x1f20, 0x1f45},
|
||||
{0x1f48, 0x1f4d}, {0x1f50, 0x1f57}, {0x1f5f, 0x1f7d}, {0x1f80, 0x1fb4},
|
||||
{0x1fb6, 0x1fbc}, {0x1fc2, 0x1fc4}, {0x1fc6, 0x1fcc}, {0x1fd0, 0x1fd3},
|
||||
{0x1fd6, 0x1fdb}, {0x1fe0, 0x1fec}, {0x1ff2, 0x1ff4}, {0x1ff6, 0x1ffc},
|
||||
{0x2090, 0x209c}, {0x210a, 0x2113}, {0x2119, 0x211d}, {0x212a, 0x212d},
|
||||
{0x212f, 0x2139}, {0x213c, 0x213f}, {0x2145, 0x2149}, {0x2c00, 0x2c2e},
|
||||
{0x2c30, 0x2c5e}, {0x2c60, 0x2ce4}, {0x2ceb, 0x2cee}, {0x2d00, 0x2d25},
|
||||
{0x2d30, 0x2d67}, {0x2d80, 0x2d96}, {0x2da0, 0x2da6}, {0x2da8, 0x2dae},
|
||||
{0x2db0, 0x2db6}, {0x2db8, 0x2dbe}, {0x2dc0, 0x2dc6}, {0x2dc8, 0x2dce},
|
||||
{0x2dd0, 0x2dd6}, {0x2dd8, 0x2dde}, {0x3031, 0x3035}, {0x3041, 0x3096},
|
||||
{0x309d, 0x309f}, {0x30a1, 0x30fa}, {0x30fc, 0x30ff}, {0x3105, 0x312d},
|
||||
{0x3131, 0x318e}, {0x31a0, 0x31ba}, {0x31f0, 0x31ff}, {0x3400, 0x4db5},
|
||||
{0x4e00, 0x9fd5}, {0xa000, 0xa48c}, {0xa4d0, 0xa4fd}, {0xa500, 0xa60c},
|
||||
{0xa610, 0xa61f}, {0xa640, 0xa66e}, {0xa67f, 0xa69d}, {0xa6a0, 0xa6e5},
|
||||
{0xa717, 0xa71f}, {0xa722, 0xa788}, {0xa78b, 0xa7ad}, {0xa7b0, 0xa7b7},
|
||||
{0xa7f7, 0xa801}, {0xa803, 0xa805}, {0xa807, 0xa80a}, {0xa80c, 0xa822},
|
||||
{0xa840, 0xa873}, {0xa882, 0xa8b3}, {0xa8f2, 0xa8f7}, {0xa90a, 0xa925},
|
||||
{0xa930, 0xa946}, {0xa960, 0xa97c}, {0xa984, 0xa9b2}, {0xa9e0, 0xa9e4},
|
||||
{0xa9e6, 0xa9ef}, {0xa9fa, 0xa9fe}, {0xaa00, 0xaa28}, {0xaa40, 0xaa42},
|
||||
{0xaa44, 0xaa4b}, {0xaa60, 0xaa76}, {0xaa7e, 0xaaaf}, {0xaab9, 0xaabd},
|
||||
{0xaadb, 0xaadd}, {0xaae0, 0xaaea}, {0xaaf2, 0xaaf4}, {0xab01, 0xab06},
|
||||
{0xab09, 0xab0e}, {0xab11, 0xab16}, {0xab20, 0xab26}, {0xab28, 0xab2e},
|
||||
{0xab30, 0xab5a}, {0xab5c, 0xab65}, {0xab70, 0xabe2}, {0xac00, 0xd7a3},
|
||||
{0xd7b0, 0xd7c6}, {0xd7cb, 0xd7fb}, {0xdc00, 0xdc3e}, {0xdc40, 0xdc7e},
|
||||
{0xde80, 0xdebe}, {0xdec0, 0xdefe}, {0xdf00, 0xdf3e}, {0xdf40, 0xdf7e},
|
||||
{0xdf80, 0xdfbe}, {0xdfc0, 0xdffe}, {0xf900, 0xfa6d}, {0xfa70, 0xfad9},
|
||||
{0xfb00, 0xfb06}, {0xfb13, 0xfb17}, {0xfb1f, 0xfb28}, {0xfb2a, 0xfb36},
|
||||
{0xfb38, 0xfb3c}, {0xfb46, 0xfbb1}, {0xfbd3, 0xfd3d}, {0xfd50, 0xfd8f},
|
||||
{0xfd92, 0xfdc7}, {0xfdf0, 0xfdfb}, {0xfe70, 0xfe74}, {0xfe76, 0xfefc},
|
||||
{0xff21, 0xff3a}, {0xff41, 0xff5a}, {0xff66, 0xffbe}, {0xffc2, 0xffc7},
|
||||
{0xffca, 0xffcf}, {0xffd2, 0xffd7}, {0xffda, 0xffdc}
|
||||
#if TCL_UTF_MAX > 4
|
||||
,{0x10000, 0x1000b}, {0x1000d, 0x10026}, {0x10028, 0x1003a}, {0x1003f, 0x1004d},
|
||||
{0x10050, 0x1005d}, {0x10080, 0x100fa}, {0x10280, 0x1029c}, {0x102a0, 0x102d0},
|
||||
@@ -204,30 +207,33 @@ static const crange alphaRangeTable[] = {
|
||||
{0x10380, 0x1039d}, {0x103a0, 0x103c3}, {0x103c8, 0x103cf}, {0x10400, 0x1049d},
|
||||
{0x10500, 0x10527}, {0x10530, 0x10563}, {0x10600, 0x10736}, {0x10740, 0x10755},
|
||||
{0x10760, 0x10767}, {0x10800, 0x10805}, {0x1080a, 0x10835}, {0x1083f, 0x10855},
|
||||
{0x10860, 0x10876}, {0x10880, 0x1089e}, {0x10900, 0x10915}, {0x10920, 0x10939},
|
||||
{0x10980, 0x109b7}, {0x10a10, 0x10a13}, {0x10a15, 0x10a17}, {0x10a19, 0x10a33},
|
||||
{0x10a60, 0x10a7c}, {0x10a80, 0x10a9c}, {0x10ac0, 0x10ac7}, {0x10ac9, 0x10ae4},
|
||||
{0x10b00, 0x10b35}, {0x10b40, 0x10b55}, {0x10b60, 0x10b72}, {0x10b80, 0x10b91},
|
||||
{0x10c00, 0x10c48}, {0x11003, 0x11037}, {0x11083, 0x110af}, {0x110d0, 0x110e8},
|
||||
{0x11103, 0x11126}, {0x11150, 0x11172}, {0x11183, 0x111b2}, {0x111c1, 0x111c4},
|
||||
{0x11200, 0x11211}, {0x11213, 0x1122b}, {0x112b0, 0x112de}, {0x11305, 0x1130c},
|
||||
{0x11313, 0x11328}, {0x1132a, 0x11330}, {0x11335, 0x11339}, {0x1135d, 0x11361},
|
||||
{0x11480, 0x114af}, {0x11580, 0x115ae}, {0x11600, 0x1162f}, {0x11680, 0x116aa},
|
||||
{0x118a0, 0x118df}, {0x11ac0, 0x11af8}, {0x12000, 0x12398}, {0x13000, 0x1342e},
|
||||
{0x16800, 0x16a38}, {0x16a40, 0x16a5e}, {0x16ad0, 0x16aed}, {0x16b00, 0x16b2f},
|
||||
{0x16b40, 0x16b43}, {0x16b63, 0x16b77}, {0x16b7d, 0x16b8f}, {0x16f00, 0x16f44},
|
||||
{0x16f93, 0x16f9f}, {0x1bc00, 0x1bc6a}, {0x1bc70, 0x1bc7c}, {0x1bc80, 0x1bc88},
|
||||
{0x1bc90, 0x1bc99}, {0x1d400, 0x1d454}, {0x1d456, 0x1d49c}, {0x1d4a9, 0x1d4ac},
|
||||
{0x1d4ae, 0x1d4b9}, {0x1d4bd, 0x1d4c3}, {0x1d4c5, 0x1d505}, {0x1d507, 0x1d50a},
|
||||
{0x1d50d, 0x1d514}, {0x1d516, 0x1d51c}, {0x1d51e, 0x1d539}, {0x1d53b, 0x1d53e},
|
||||
{0x1d540, 0x1d544}, {0x1d54a, 0x1d550}, {0x1d552, 0x1d6a5}, {0x1d6a8, 0x1d6c0},
|
||||
{0x1d6c2, 0x1d6da}, {0x1d6dc, 0x1d6fa}, {0x1d6fc, 0x1d714}, {0x1d716, 0x1d734},
|
||||
{0x1d736, 0x1d74e}, {0x1d750, 0x1d76e}, {0x1d770, 0x1d788}, {0x1d78a, 0x1d7a8},
|
||||
{0x1d7aa, 0x1d7c2}, {0x1d7c4, 0x1d7cb}, {0x1e800, 0x1e8c4}, {0x1ee00, 0x1ee03},
|
||||
{0x1ee05, 0x1ee1f}, {0x1ee29, 0x1ee32}, {0x1ee34, 0x1ee37}, {0x1ee4d, 0x1ee4f},
|
||||
{0x1ee67, 0x1ee6a}, {0x1ee6c, 0x1ee72}, {0x1ee74, 0x1ee77}, {0x1ee79, 0x1ee7c},
|
||||
{0x1ee80, 0x1ee89}, {0x1ee8b, 0x1ee9b}, {0x1eea1, 0x1eea3}, {0x1eea5, 0x1eea9},
|
||||
{0x1eeab, 0x1eebb}, {0x20000, 0x2a6d6}, {0x2a700, 0x2b734}, {0x2b740, 0x2b81d},
|
||||
{0x10860, 0x10876}, {0x10880, 0x1089e}, {0x108e0, 0x108f2}, {0x10900, 0x10915},
|
||||
{0x10920, 0x10939}, {0x10980, 0x109b7}, {0x10a10, 0x10a13}, {0x10a15, 0x10a17},
|
||||
{0x10a19, 0x10a33}, {0x10a60, 0x10a7c}, {0x10a80, 0x10a9c}, {0x10ac0, 0x10ac7},
|
||||
{0x10ac9, 0x10ae4}, {0x10b00, 0x10b35}, {0x10b40, 0x10b55}, {0x10b60, 0x10b72},
|
||||
{0x10b80, 0x10b91}, {0x10c00, 0x10c48}, {0x10c80, 0x10cb2}, {0x10cc0, 0x10cf2},
|
||||
{0x11003, 0x11037}, {0x11083, 0x110af}, {0x110d0, 0x110e8}, {0x11103, 0x11126},
|
||||
{0x11150, 0x11172}, {0x11183, 0x111b2}, {0x111c1, 0x111c4}, {0x11200, 0x11211},
|
||||
{0x11213, 0x1122b}, {0x11280, 0x11286}, {0x1128a, 0x1128d}, {0x1128f, 0x1129d},
|
||||
{0x1129f, 0x112a8}, {0x112b0, 0x112de}, {0x11305, 0x1130c}, {0x11313, 0x11328},
|
||||
{0x1132a, 0x11330}, {0x11335, 0x11339}, {0x1135d, 0x11361}, {0x11480, 0x114af},
|
||||
{0x11580, 0x115ae}, {0x115d8, 0x115db}, {0x11600, 0x1162f}, {0x11680, 0x116aa},
|
||||
{0x11700, 0x11719}, {0x118a0, 0x118df}, {0x11ac0, 0x11af8}, {0x12000, 0x12399},
|
||||
{0x12480, 0x12543}, {0x13000, 0x1342e}, {0x14400, 0x14646}, {0x16800, 0x16a38},
|
||||
{0x16a40, 0x16a5e}, {0x16ad0, 0x16aed}, {0x16b00, 0x16b2f}, {0x16b40, 0x16b43},
|
||||
{0x16b63, 0x16b77}, {0x16b7d, 0x16b8f}, {0x16f00, 0x16f44}, {0x16f93, 0x16f9f},
|
||||
{0x1bc00, 0x1bc6a}, {0x1bc70, 0x1bc7c}, {0x1bc80, 0x1bc88}, {0x1bc90, 0x1bc99},
|
||||
{0x1d400, 0x1d454}, {0x1d456, 0x1d49c}, {0x1d4a9, 0x1d4ac}, {0x1d4ae, 0x1d4b9},
|
||||
{0x1d4bd, 0x1d4c3}, {0x1d4c5, 0x1d505}, {0x1d507, 0x1d50a}, {0x1d50d, 0x1d514},
|
||||
{0x1d516, 0x1d51c}, {0x1d51e, 0x1d539}, {0x1d53b, 0x1d53e}, {0x1d540, 0x1d544},
|
||||
{0x1d54a, 0x1d550}, {0x1d552, 0x1d6a5}, {0x1d6a8, 0x1d6c0}, {0x1d6c2, 0x1d6da},
|
||||
{0x1d6dc, 0x1d6fa}, {0x1d6fc, 0x1d714}, {0x1d716, 0x1d734}, {0x1d736, 0x1d74e},
|
||||
{0x1d750, 0x1d76e}, {0x1d770, 0x1d788}, {0x1d78a, 0x1d7a8}, {0x1d7aa, 0x1d7c2},
|
||||
{0x1d7c4, 0x1d7cb}, {0x1e800, 0x1e8c4}, {0x1ee00, 0x1ee03}, {0x1ee05, 0x1ee1f},
|
||||
{0x1ee29, 0x1ee32}, {0x1ee34, 0x1ee37}, {0x1ee4d, 0x1ee4f}, {0x1ee67, 0x1ee6a},
|
||||
{0x1ee6c, 0x1ee72}, {0x1ee74, 0x1ee77}, {0x1ee79, 0x1ee7c}, {0x1ee80, 0x1ee89},
|
||||
{0x1ee8b, 0x1ee9b}, {0x1eea1, 0x1eea3}, {0x1eea5, 0x1eea9}, {0x1eeab, 0x1eebb},
|
||||
{0x20000, 0x2a6d6}, {0x2a700, 0x2b734}, {0x2b740, 0x2b81d}, {0x2b820, 0x2cea1},
|
||||
{0x2f800, 0x2fa1d}
|
||||
#endif
|
||||
};
|
||||
@@ -240,27 +246,27 @@ static const chr alphaCharTable[] = {
|
||||
0x6ff, 0x710, 0x7b1, 0x7f4, 0x7f5, 0x7fa, 0x81a, 0x824, 0x828,
|
||||
0x93d, 0x950, 0x98f, 0x990, 0x9b2, 0x9bd, 0x9ce, 0x9dc, 0x9dd,
|
||||
0x9f0, 0x9f1, 0xa0f, 0xa10, 0xa32, 0xa33, 0xa35, 0xa36, 0xa38,
|
||||
0xa39, 0xa5e, 0xab2, 0xab3, 0xabd, 0xad0, 0xae0, 0xae1, 0xb0f,
|
||||
0xb10, 0xb32, 0xb33, 0xb3d, 0xb5c, 0xb5d, 0xb71, 0xb83, 0xb99,
|
||||
0xb9a, 0xb9c, 0xb9e, 0xb9f, 0xba3, 0xba4, 0xbd0, 0xc3d, 0xc58,
|
||||
0xc59, 0xc60, 0xc61, 0xcbd, 0xcde, 0xce0, 0xce1, 0xcf1, 0xcf2,
|
||||
0xd3d, 0xd4e, 0xd60, 0xd61, 0xdbd, 0xe32, 0xe33, 0xe81, 0xe82,
|
||||
0xe84, 0xe87, 0xe88, 0xe8a, 0xe8d, 0xea5, 0xea7, 0xeaa, 0xeab,
|
||||
0xeb2, 0xeb3, 0xebd, 0xec6, 0xf00, 0x103f, 0x1061, 0x1065, 0x1066,
|
||||
0x108e, 0x10c7, 0x10cd, 0x1258, 0x12c0, 0x17d7, 0x17dc, 0x18aa, 0x1aa7,
|
||||
0x1bae, 0x1baf, 0x1cf5, 0x1cf6, 0x1f59, 0x1f5b, 0x1f5d, 0x1fbe, 0x2071,
|
||||
0x207f, 0x2102, 0x2107, 0x2115, 0x2124, 0x2126, 0x2128, 0x214e, 0x2183,
|
||||
0x2184, 0x2cf2, 0x2cf3, 0x2d27, 0x2d2d, 0x2d6f, 0x2e2f, 0x3005, 0x3006,
|
||||
0x303b, 0x303c, 0xa62a, 0xa62b, 0xa7b0, 0xa7b1, 0xa8fb, 0xa9cf, 0xaa7a,
|
||||
0xaab1, 0xaab5, 0xaab6, 0xaac0, 0xaac2, 0xab64, 0xab65, 0xfb1d, 0xfb3e,
|
||||
0xfb40, 0xfb41, 0xfb43, 0xfb44
|
||||
0xa39, 0xa5e, 0xab2, 0xab3, 0xabd, 0xad0, 0xae0, 0xae1, 0xaf9,
|
||||
0xb0f, 0xb10, 0xb32, 0xb33, 0xb3d, 0xb5c, 0xb5d, 0xb71, 0xb83,
|
||||
0xb99, 0xb9a, 0xb9c, 0xb9e, 0xb9f, 0xba3, 0xba4, 0xbd0, 0xc3d,
|
||||
0xc60, 0xc61, 0xcbd, 0xcde, 0xce0, 0xce1, 0xcf1, 0xcf2, 0xd3d,
|
||||
0xd4e, 0xdbd, 0xe32, 0xe33, 0xe81, 0xe82, 0xe84, 0xe87, 0xe88,
|
||||
0xe8a, 0xe8d, 0xea5, 0xea7, 0xeaa, 0xeab, 0xeb2, 0xeb3, 0xebd,
|
||||
0xec6, 0xf00, 0x103f, 0x1061, 0x1065, 0x1066, 0x108e, 0x10c7, 0x10cd,
|
||||
0x1258, 0x12c0, 0x17d7, 0x17dc, 0x18aa, 0x1aa7, 0x1bae, 0x1baf, 0x1cf5,
|
||||
0x1cf6, 0x1f59, 0x1f5b, 0x1f5d, 0x1fbe, 0x2071, 0x207f, 0x2102, 0x2107,
|
||||
0x2115, 0x2124, 0x2126, 0x2128, 0x214e, 0x2183, 0x2184, 0x2cf2, 0x2cf3,
|
||||
0x2d27, 0x2d2d, 0x2d6f, 0x2e2f, 0x3005, 0x3006, 0x303b, 0x303c, 0xa62a,
|
||||
0xa62b, 0xa8fb, 0xa8fd, 0xa9cf, 0xaa7a, 0xaab1, 0xaab5, 0xaab6, 0xaac0,
|
||||
0xaac2, 0xfb1d, 0xfb3e, 0xfb40, 0xfb41, 0xfb43, 0xfb44
|
||||
#if TCL_UTF_MAX > 4
|
||||
,0x1003c, 0x1003d, 0x10808, 0x10837, 0x10838, 0x1083c, 0x109be, 0x109bf, 0x10a00,
|
||||
0x11176, 0x111da, 0x1130f, 0x11310, 0x11332, 0x11333, 0x1133d, 0x114c4, 0x114c5,
|
||||
0x114c7, 0x11644, 0x118ff, 0x16f50, 0x1b000, 0x1b001, 0x1d49e, 0x1d49f, 0x1d4a2,
|
||||
0x1d4a5, 0x1d4a6, 0x1d4bb, 0x1d546, 0x1ee21, 0x1ee22, 0x1ee24, 0x1ee27, 0x1ee39,
|
||||
0x1ee3b, 0x1ee42, 0x1ee47, 0x1ee49, 0x1ee4b, 0x1ee51, 0x1ee52, 0x1ee54, 0x1ee57,
|
||||
0x1ee59, 0x1ee5b, 0x1ee5d, 0x1ee5f, 0x1ee61, 0x1ee62, 0x1ee64, 0x1ee7e
|
||||
,0x1003c, 0x1003d, 0x10808, 0x10837, 0x10838, 0x1083c, 0x108f4, 0x108f5, 0x109be,
|
||||
0x109bf, 0x10a00, 0x11176, 0x111da, 0x111dc, 0x11288, 0x1130f, 0x11310, 0x11332,
|
||||
0x11333, 0x1133d, 0x11350, 0x114c4, 0x114c5, 0x114c7, 0x11644, 0x118ff, 0x16f50,
|
||||
0x1b000, 0x1b001, 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4bb, 0x1d546,
|
||||
0x1ee21, 0x1ee22, 0x1ee24, 0x1ee27, 0x1ee39, 0x1ee3b, 0x1ee42, 0x1ee47, 0x1ee49,
|
||||
0x1ee4b, 0x1ee51, 0x1ee52, 0x1ee54, 0x1ee57, 0x1ee59, 0x1ee5b, 0x1ee5d, 0x1ee5f,
|
||||
0x1ee61, 0x1ee62, 0x1ee64, 0x1ee7e
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -309,8 +315,8 @@ static const crange digitRangeTable[] = {
|
||||
#if TCL_UTF_MAX > 4
|
||||
,{0x104a0, 0x104a9}, {0x11066, 0x1106f}, {0x110f0, 0x110f9}, {0x11136, 0x1113f},
|
||||
{0x111d0, 0x111d9}, {0x112f0, 0x112f9}, {0x114d0, 0x114d9}, {0x11650, 0x11659},
|
||||
{0x116c0, 0x116c9}, {0x118e0, 0x118e9}, {0x16a60, 0x16a69}, {0x16b50, 0x16b59},
|
||||
{0x1d7ce, 0x1d7ff}
|
||||
{0x116c0, 0x116c9}, {0x11730, 0x11739}, {0x118e0, 0x118e9}, {0x16a60, 0x16a69},
|
||||
{0x16b50, 0x16b59}, {0x1d7ce, 0x1d7ff}
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -342,8 +348,9 @@ static const crange punctRangeTable[] = {
|
||||
#if TCL_UTF_MAX > 4
|
||||
,{0x10100, 0x10102}, {0x10a50, 0x10a58}, {0x10af0, 0x10af6}, {0x10b39, 0x10b3f},
|
||||
{0x10b99, 0x10b9c}, {0x11047, 0x1104d}, {0x110be, 0x110c1}, {0x11140, 0x11143},
|
||||
{0x111c5, 0x111c8}, {0x11238, 0x1123d}, {0x115c1, 0x115c9}, {0x11641, 0x11643},
|
||||
{0x12470, 0x12474}, {0x16b37, 0x16b3b}
|
||||
{0x111c5, 0x111c9}, {0x111dd, 0x111df}, {0x11238, 0x1123d}, {0x115c1, 0x115d7},
|
||||
{0x11641, 0x11643}, {0x1173c, 0x1173e}, {0x12470, 0x12474}, {0x16b37, 0x16b3b},
|
||||
{0x1da87, 0x1da8b}
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -359,12 +366,13 @@ static const chr punctCharTable[] = {
|
||||
0x1945, 0x1a1e, 0x1a1f, 0x1c7e, 0x1c7f, 0x1cd3, 0x207d, 0x207e, 0x208d,
|
||||
0x208e, 0x2329, 0x232a, 0x27c5, 0x27c6, 0x29fc, 0x29fd, 0x2cfe, 0x2cff,
|
||||
0x2d70, 0x3030, 0x303d, 0x30a0, 0x30fb, 0xa4fe, 0xa4ff, 0xa673, 0xa67e,
|
||||
0xa8ce, 0xa8cf, 0xa92e, 0xa92f, 0xa95f, 0xa9de, 0xa9df, 0xaade, 0xaadf,
|
||||
0xaaf0, 0xaaf1, 0xabeb, 0xfd3e, 0xfd3f, 0xfe63, 0xfe68, 0xfe6a, 0xfe6b,
|
||||
0xff1a, 0xff1b, 0xff1f, 0xff20, 0xff3f, 0xff5b, 0xff5d
|
||||
0xa8ce, 0xa8cf, 0xa8fc, 0xa92e, 0xa92f, 0xa95f, 0xa9de, 0xa9df, 0xaade,
|
||||
0xaadf, 0xaaf0, 0xaaf1, 0xabeb, 0xfd3e, 0xfd3f, 0xfe63, 0xfe68, 0xfe6a,
|
||||
0xfe6b, 0xff1a, 0xff1b, 0xff1f, 0xff20, 0xff3f, 0xff5b, 0xff5d
|
||||
#if TCL_UTF_MAX > 4
|
||||
,0x1039f, 0x103d0, 0x1056f, 0x10857, 0x1091f, 0x1093f, 0x10a7f, 0x110bb, 0x110bc,
|
||||
0x11174, 0x11175, 0x111cd, 0x114c6, 0x16a6e, 0x16a6f, 0x16af5, 0x16b44, 0x1bc9f
|
||||
0x11174, 0x11175, 0x111cd, 0x111db, 0x112a9, 0x114c6, 0x16a6e, 0x16a6f, 0x16af5,
|
||||
0x16b44, 0x1bc9f
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -395,23 +403,25 @@ static const crange lowerRangeTable[] = {
|
||||
{0x61, 0x7a}, {0xdf, 0xf6}, {0xf8, 0xff}, {0x17e, 0x180},
|
||||
{0x199, 0x19b}, {0x1bd, 0x1bf}, {0x233, 0x239}, {0x24f, 0x293},
|
||||
{0x295, 0x2af}, {0x37b, 0x37d}, {0x3ac, 0x3ce}, {0x3d5, 0x3d7},
|
||||
{0x3ef, 0x3f3}, {0x430, 0x45f}, {0x561, 0x587}, {0x1d00, 0x1d2b},
|
||||
{0x1d6b, 0x1d77}, {0x1d79, 0x1d9a}, {0x1e95, 0x1e9d}, {0x1eff, 0x1f07},
|
||||
{0x1f10, 0x1f15}, {0x1f20, 0x1f27}, {0x1f30, 0x1f37}, {0x1f40, 0x1f45},
|
||||
{0x1f50, 0x1f57}, {0x1f60, 0x1f67}, {0x1f70, 0x1f7d}, {0x1f80, 0x1f87},
|
||||
{0x1f90, 0x1f97}, {0x1fa0, 0x1fa7}, {0x1fb0, 0x1fb4}, {0x1fc2, 0x1fc4},
|
||||
{0x1fd0, 0x1fd3}, {0x1fe0, 0x1fe7}, {0x1ff2, 0x1ff4}, {0x2146, 0x2149},
|
||||
{0x2c30, 0x2c5e}, {0x2c76, 0x2c7b}, {0x2d00, 0x2d25}, {0xa72f, 0xa731},
|
||||
{0xa771, 0xa778}, {0xa793, 0xa795}, {0xab30, 0xab5a}, {0xfb00, 0xfb06},
|
||||
{0xfb13, 0xfb17}, {0xff41, 0xff5a}
|
||||
{0x3ef, 0x3f3}, {0x430, 0x45f}, {0x561, 0x587}, {0x13f8, 0x13fd},
|
||||
{0x1d00, 0x1d2b}, {0x1d6b, 0x1d77}, {0x1d79, 0x1d9a}, {0x1e95, 0x1e9d},
|
||||
{0x1eff, 0x1f07}, {0x1f10, 0x1f15}, {0x1f20, 0x1f27}, {0x1f30, 0x1f37},
|
||||
{0x1f40, 0x1f45}, {0x1f50, 0x1f57}, {0x1f60, 0x1f67}, {0x1f70, 0x1f7d},
|
||||
{0x1f80, 0x1f87}, {0x1f90, 0x1f97}, {0x1fa0, 0x1fa7}, {0x1fb0, 0x1fb4},
|
||||
{0x1fc2, 0x1fc4}, {0x1fd0, 0x1fd3}, {0x1fe0, 0x1fe7}, {0x1ff2, 0x1ff4},
|
||||
{0x2146, 0x2149}, {0x2c30, 0x2c5e}, {0x2c76, 0x2c7b}, {0x2d00, 0x2d25},
|
||||
{0xa72f, 0xa731}, {0xa771, 0xa778}, {0xa793, 0xa795}, {0xab30, 0xab5a},
|
||||
{0xab60, 0xab65}, {0xab70, 0xabbf}, {0xfb00, 0xfb06}, {0xfb13, 0xfb17},
|
||||
{0xff41, 0xff5a}
|
||||
#if TCL_UTF_MAX > 4
|
||||
,{0x10428, 0x1044f}, {0x118c0, 0x118df}, {0x1d41a, 0x1d433}, {0x1d44e, 0x1d454},
|
||||
{0x1d456, 0x1d467}, {0x1d482, 0x1d49b}, {0x1d4b6, 0x1d4b9}, {0x1d4bd, 0x1d4c3},
|
||||
{0x1d4c5, 0x1d4cf}, {0x1d4ea, 0x1d503}, {0x1d51e, 0x1d537}, {0x1d552, 0x1d56b},
|
||||
{0x1d586, 0x1d59f}, {0x1d5ba, 0x1d5d3}, {0x1d5ee, 0x1d607}, {0x1d622, 0x1d63b},
|
||||
{0x1d656, 0x1d66f}, {0x1d68a, 0x1d6a5}, {0x1d6c2, 0x1d6da}, {0x1d6dc, 0x1d6e1},
|
||||
{0x1d6fc, 0x1d714}, {0x1d716, 0x1d71b}, {0x1d736, 0x1d74e}, {0x1d750, 0x1d755},
|
||||
{0x1d770, 0x1d788}, {0x1d78a, 0x1d78f}, {0x1d7aa, 0x1d7c2}, {0x1d7c4, 0x1d7c9}
|
||||
,{0x10428, 0x1044f}, {0x10cc0, 0x10cf2}, {0x118c0, 0x118df}, {0x1d41a, 0x1d433},
|
||||
{0x1d44e, 0x1d454}, {0x1d456, 0x1d467}, {0x1d482, 0x1d49b}, {0x1d4b6, 0x1d4b9},
|
||||
{0x1d4bd, 0x1d4c3}, {0x1d4c5, 0x1d4cf}, {0x1d4ea, 0x1d503}, {0x1d51e, 0x1d537},
|
||||
{0x1d552, 0x1d56b}, {0x1d586, 0x1d59f}, {0x1d5ba, 0x1d5d3}, {0x1d5ee, 0x1d607},
|
||||
{0x1d622, 0x1d63b}, {0x1d656, 0x1d66f}, {0x1d68a, 0x1d6a5}, {0x1d6c2, 0x1d6da},
|
||||
{0x1d6dc, 0x1d6e1}, {0x1d6fc, 0x1d714}, {0x1d716, 0x1d71b}, {0x1d736, 0x1d74e},
|
||||
{0x1d750, 0x1d755}, {0x1d770, 0x1d788}, {0x1d78a, 0x1d78f}, {0x1d7aa, 0x1d7c2},
|
||||
{0x1d7c4, 0x1d7c9}
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -481,7 +491,7 @@ static const chr lowerCharTable[] = {
|
||||
0xa763, 0xa765, 0xa767, 0xa769, 0xa76b, 0xa76d, 0xa76f, 0xa77a, 0xa77c,
|
||||
0xa77f, 0xa781, 0xa783, 0xa785, 0xa787, 0xa78c, 0xa78e, 0xa791, 0xa797,
|
||||
0xa799, 0xa79b, 0xa79d, 0xa79f, 0xa7a1, 0xa7a3, 0xa7a5, 0xa7a7, 0xa7a9,
|
||||
0xa7fa, 0xab64, 0xab65
|
||||
0xa7b5, 0xa7b7, 0xa7fa
|
||||
#if TCL_UTF_MAX > 4
|
||||
,0x1d4bb, 0x1d7cb
|
||||
#endif
|
||||
@@ -498,20 +508,20 @@ static const crange upperRangeTable[] = {
|
||||
{0x18e, 0x191}, {0x196, 0x198}, {0x1b1, 0x1b3}, {0x1f6, 0x1f8},
|
||||
{0x243, 0x246}, {0x388, 0x38a}, {0x391, 0x3a1}, {0x3a3, 0x3ab},
|
||||
{0x3d2, 0x3d4}, {0x3fd, 0x42f}, {0x531, 0x556}, {0x10a0, 0x10c5},
|
||||
{0x1f08, 0x1f0f}, {0x1f18, 0x1f1d}, {0x1f28, 0x1f2f}, {0x1f38, 0x1f3f},
|
||||
{0x1f48, 0x1f4d}, {0x1f68, 0x1f6f}, {0x1fb8, 0x1fbb}, {0x1fc8, 0x1fcb},
|
||||
{0x1fd8, 0x1fdb}, {0x1fe8, 0x1fec}, {0x1ff8, 0x1ffb}, {0x210b, 0x210d},
|
||||
{0x2110, 0x2112}, {0x2119, 0x211d}, {0x212a, 0x212d}, {0x2130, 0x2133},
|
||||
{0x2c00, 0x2c2e}, {0x2c62, 0x2c64}, {0x2c6d, 0x2c70}, {0x2c7e, 0x2c80},
|
||||
{0xa7aa, 0xa7ad}, {0xff21, 0xff3a}
|
||||
{0x13a0, 0x13f5}, {0x1f08, 0x1f0f}, {0x1f18, 0x1f1d}, {0x1f28, 0x1f2f},
|
||||
{0x1f38, 0x1f3f}, {0x1f48, 0x1f4d}, {0x1f68, 0x1f6f}, {0x1fb8, 0x1fbb},
|
||||
{0x1fc8, 0x1fcb}, {0x1fd8, 0x1fdb}, {0x1fe8, 0x1fec}, {0x1ff8, 0x1ffb},
|
||||
{0x210b, 0x210d}, {0x2110, 0x2112}, {0x2119, 0x211d}, {0x212a, 0x212d},
|
||||
{0x2130, 0x2133}, {0x2c00, 0x2c2e}, {0x2c62, 0x2c64}, {0x2c6d, 0x2c70},
|
||||
{0x2c7e, 0x2c80}, {0xa7aa, 0xa7ad}, {0xa7b0, 0xa7b4}, {0xff21, 0xff3a}
|
||||
#if TCL_UTF_MAX > 4
|
||||
,{0x10400, 0x10427}, {0x118a0, 0x118bf}, {0x1d400, 0x1d419}, {0x1d434, 0x1d44d},
|
||||
{0x1d468, 0x1d481}, {0x1d4a9, 0x1d4ac}, {0x1d4ae, 0x1d4b5}, {0x1d4d0, 0x1d4e9},
|
||||
{0x1d507, 0x1d50a}, {0x1d50d, 0x1d514}, {0x1d516, 0x1d51c}, {0x1d53b, 0x1d53e},
|
||||
{0x1d540, 0x1d544}, {0x1d54a, 0x1d550}, {0x1d56c, 0x1d585}, {0x1d5a0, 0x1d5b9},
|
||||
{0x1d5d4, 0x1d5ed}, {0x1d608, 0x1d621}, {0x1d63c, 0x1d655}, {0x1d670, 0x1d689},
|
||||
{0x1d6a8, 0x1d6c0}, {0x1d6e2, 0x1d6fa}, {0x1d71c, 0x1d734}, {0x1d756, 0x1d76e},
|
||||
{0x1d790, 0x1d7a8}
|
||||
,{0x10400, 0x10427}, {0x10c80, 0x10cb2}, {0x118a0, 0x118bf}, {0x1d400, 0x1d419},
|
||||
{0x1d434, 0x1d44d}, {0x1d468, 0x1d481}, {0x1d4a9, 0x1d4ac}, {0x1d4ae, 0x1d4b5},
|
||||
{0x1d4d0, 0x1d4e9}, {0x1d507, 0x1d50a}, {0x1d50d, 0x1d514}, {0x1d516, 0x1d51c},
|
||||
{0x1d53b, 0x1d53e}, {0x1d540, 0x1d544}, {0x1d54a, 0x1d550}, {0x1d56c, 0x1d585},
|
||||
{0x1d5a0, 0x1d5b9}, {0x1d5d4, 0x1d5ed}, {0x1d608, 0x1d621}, {0x1d63c, 0x1d655},
|
||||
{0x1d670, 0x1d689}, {0x1d6a8, 0x1d6c0}, {0x1d6e2, 0x1d6fa}, {0x1d71c, 0x1d734},
|
||||
{0x1d756, 0x1d76e}, {0x1d790, 0x1d7a8}
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -580,8 +590,7 @@ static const chr upperCharTable[] = {
|
||||
0xa756, 0xa758, 0xa75a, 0xa75c, 0xa75e, 0xa760, 0xa762, 0xa764, 0xa766,
|
||||
0xa768, 0xa76a, 0xa76c, 0xa76e, 0xa779, 0xa77b, 0xa77d, 0xa77e, 0xa780,
|
||||
0xa782, 0xa784, 0xa786, 0xa78b, 0xa78d, 0xa790, 0xa792, 0xa796, 0xa798,
|
||||
0xa79a, 0xa79c, 0xa79e, 0xa7a0, 0xa7a2, 0xa7a4, 0xa7a6, 0xa7a8, 0xa7b0,
|
||||
0xa7b1
|
||||
0xa79a, 0xa79c, 0xa79e, 0xa7a0, 0xa7a2, 0xa7a4, 0xa7a6, 0xa7a8, 0xa7b6
|
||||
#if TCL_UTF_MAX > 4
|
||||
,0x1d49c, 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d504, 0x1d505, 0x1d538,
|
||||
0x1d539, 0x1d546, 0x1d7ca
|
||||
@@ -600,8 +609,8 @@ static const crange graphRangeTable[] = {
|
||||
{0x559, 0x55f}, {0x561, 0x587}, {0x58d, 0x58f}, {0x591, 0x5c7},
|
||||
{0x5d0, 0x5ea}, {0x5f0, 0x5f4}, {0x606, 0x61b}, {0x61e, 0x6dc},
|
||||
{0x6de, 0x70d}, {0x710, 0x74a}, {0x74d, 0x7b1}, {0x7c0, 0x7fa},
|
||||
{0x800, 0x82d}, {0x830, 0x83e}, {0x840, 0x85b}, {0x8a0, 0x8b2},
|
||||
{0x8e4, 0x983}, {0x985, 0x98c}, {0x993, 0x9a8}, {0x9aa, 0x9b0},
|
||||
{0x800, 0x82d}, {0x830, 0x83e}, {0x840, 0x85b}, {0x8a0, 0x8b4},
|
||||
{0x8e3, 0x983}, {0x985, 0x98c}, {0x993, 0x9a8}, {0x9aa, 0x9b0},
|
||||
{0x9b6, 0x9b9}, {0x9bc, 0x9c4}, {0x9cb, 0x9ce}, {0x9df, 0x9e3},
|
||||
{0x9e6, 0x9fb}, {0xa01, 0xa03}, {0xa05, 0xa0a}, {0xa13, 0xa28},
|
||||
{0xa2a, 0xa30}, {0xa3e, 0xa42}, {0xa4b, 0xa4d}, {0xa59, 0xa5c},
|
||||
@@ -614,66 +623,67 @@ static const crange graphRangeTable[] = {
|
||||
{0xba8, 0xbaa}, {0xbae, 0xbb9}, {0xbbe, 0xbc2}, {0xbc6, 0xbc8},
|
||||
{0xbca, 0xbcd}, {0xbe6, 0xbfa}, {0xc00, 0xc03}, {0xc05, 0xc0c},
|
||||
{0xc0e, 0xc10}, {0xc12, 0xc28}, {0xc2a, 0xc39}, {0xc3d, 0xc44},
|
||||
{0xc46, 0xc48}, {0xc4a, 0xc4d}, {0xc60, 0xc63}, {0xc66, 0xc6f},
|
||||
{0xc78, 0xc7f}, {0xc81, 0xc83}, {0xc85, 0xc8c}, {0xc8e, 0xc90},
|
||||
{0xc92, 0xca8}, {0xcaa, 0xcb3}, {0xcb5, 0xcb9}, {0xcbc, 0xcc4},
|
||||
{0xcc6, 0xcc8}, {0xcca, 0xccd}, {0xce0, 0xce3}, {0xce6, 0xcef},
|
||||
{0xd01, 0xd03}, {0xd05, 0xd0c}, {0xd0e, 0xd10}, {0xd12, 0xd3a},
|
||||
{0xd3d, 0xd44}, {0xd46, 0xd48}, {0xd4a, 0xd4e}, {0xd60, 0xd63},
|
||||
{0xd66, 0xd75}, {0xd79, 0xd7f}, {0xd85, 0xd96}, {0xd9a, 0xdb1},
|
||||
{0xdb3, 0xdbb}, {0xdc0, 0xdc6}, {0xdcf, 0xdd4}, {0xdd8, 0xddf},
|
||||
{0xde6, 0xdef}, {0xdf2, 0xdf4}, {0xe01, 0xe3a}, {0xe3f, 0xe5b},
|
||||
{0xe94, 0xe97}, {0xe99, 0xe9f}, {0xea1, 0xea3}, {0xead, 0xeb9},
|
||||
{0xebb, 0xebd}, {0xec0, 0xec4}, {0xec8, 0xecd}, {0xed0, 0xed9},
|
||||
{0xedc, 0xedf}, {0xf00, 0xf47}, {0xf49, 0xf6c}, {0xf71, 0xf97},
|
||||
{0xf99, 0xfbc}, {0xfbe, 0xfcc}, {0xfce, 0xfda}, {0x1000, 0x10c5},
|
||||
{0x10d0, 0x1248}, {0x124a, 0x124d}, {0x1250, 0x1256}, {0x125a, 0x125d},
|
||||
{0x1260, 0x1288}, {0x128a, 0x128d}, {0x1290, 0x12b0}, {0x12b2, 0x12b5},
|
||||
{0x12b8, 0x12be}, {0x12c2, 0x12c5}, {0x12c8, 0x12d6}, {0x12d8, 0x1310},
|
||||
{0x1312, 0x1315}, {0x1318, 0x135a}, {0x135d, 0x137c}, {0x1380, 0x1399},
|
||||
{0x13a0, 0x13f4}, {0x1400, 0x167f}, {0x1681, 0x169c}, {0x16a0, 0x16f8},
|
||||
{0x1700, 0x170c}, {0x170e, 0x1714}, {0x1720, 0x1736}, {0x1740, 0x1753},
|
||||
{0x1760, 0x176c}, {0x176e, 0x1770}, {0x1780, 0x17dd}, {0x17e0, 0x17e9},
|
||||
{0x17f0, 0x17f9}, {0x1800, 0x180d}, {0x1810, 0x1819}, {0x1820, 0x1877},
|
||||
{0x1880, 0x18aa}, {0x18b0, 0x18f5}, {0x1900, 0x191e}, {0x1920, 0x192b},
|
||||
{0x1930, 0x193b}, {0x1944, 0x196d}, {0x1970, 0x1974}, {0x1980, 0x19ab},
|
||||
{0x19b0, 0x19c9}, {0x19d0, 0x19da}, {0x19de, 0x1a1b}, {0x1a1e, 0x1a5e},
|
||||
{0x1a60, 0x1a7c}, {0x1a7f, 0x1a89}, {0x1a90, 0x1a99}, {0x1aa0, 0x1aad},
|
||||
{0x1ab0, 0x1abe}, {0x1b00, 0x1b4b}, {0x1b50, 0x1b7c}, {0x1b80, 0x1bf3},
|
||||
{0x1bfc, 0x1c37}, {0x1c3b, 0x1c49}, {0x1c4d, 0x1c7f}, {0x1cc0, 0x1cc7},
|
||||
{0x1cd0, 0x1cf6}, {0x1d00, 0x1df5}, {0x1dfc, 0x1f15}, {0x1f18, 0x1f1d},
|
||||
{0x1f20, 0x1f45}, {0x1f48, 0x1f4d}, {0x1f50, 0x1f57}, {0x1f5f, 0x1f7d},
|
||||
{0x1f80, 0x1fb4}, {0x1fb6, 0x1fc4}, {0x1fc6, 0x1fd3}, {0x1fd6, 0x1fdb},
|
||||
{0x1fdd, 0x1fef}, {0x1ff2, 0x1ff4}, {0x1ff6, 0x1ffe}, {0x2010, 0x2027},
|
||||
{0x2030, 0x205e}, {0x2074, 0x208e}, {0x2090, 0x209c}, {0x20a0, 0x20bd},
|
||||
{0x20d0, 0x20f0}, {0x2100, 0x2189}, {0x2190, 0x23fa}, {0x2400, 0x2426},
|
||||
{0x2440, 0x244a}, {0x2460, 0x2b73}, {0x2b76, 0x2b95}, {0x2b98, 0x2bb9},
|
||||
{0x2bbd, 0x2bc8}, {0x2bca, 0x2bd1}, {0x2c00, 0x2c2e}, {0x2c30, 0x2c5e},
|
||||
{0x2c60, 0x2cf3}, {0x2cf9, 0x2d25}, {0x2d30, 0x2d67}, {0x2d7f, 0x2d96},
|
||||
{0x2da0, 0x2da6}, {0x2da8, 0x2dae}, {0x2db0, 0x2db6}, {0x2db8, 0x2dbe},
|
||||
{0x2dc0, 0x2dc6}, {0x2dc8, 0x2dce}, {0x2dd0, 0x2dd6}, {0x2dd8, 0x2dde},
|
||||
{0x2de0, 0x2e42}, {0x2e80, 0x2e99}, {0x2e9b, 0x2ef3}, {0x2f00, 0x2fd5},
|
||||
{0x2ff0, 0x2ffb}, {0x3001, 0x303f}, {0x3041, 0x3096}, {0x3099, 0x30ff},
|
||||
{0x3105, 0x312d}, {0x3131, 0x318e}, {0x3190, 0x31ba}, {0x31c0, 0x31e3},
|
||||
{0x31f0, 0x321e}, {0x3220, 0x32fe}, {0x3300, 0x4db5}, {0x4dc0, 0x9fcc},
|
||||
{0xa000, 0xa48c}, {0xa490, 0xa4c6}, {0xa4d0, 0xa62b}, {0xa640, 0xa69d},
|
||||
{0xa69f, 0xa6f7}, {0xa700, 0xa78e}, {0xa790, 0xa7ad}, {0xa7f7, 0xa82b},
|
||||
{0xa830, 0xa839}, {0xa840, 0xa877}, {0xa880, 0xa8c4}, {0xa8ce, 0xa8d9},
|
||||
{0xa8e0, 0xa8fb}, {0xa900, 0xa953}, {0xa95f, 0xa97c}, {0xa980, 0xa9cd},
|
||||
{0xa9cf, 0xa9d9}, {0xa9de, 0xa9fe}, {0xaa00, 0xaa36}, {0xaa40, 0xaa4d},
|
||||
{0xaa50, 0xaa59}, {0xaa5c, 0xaac2}, {0xaadb, 0xaaf6}, {0xab01, 0xab06},
|
||||
{0xab09, 0xab0e}, {0xab11, 0xab16}, {0xab20, 0xab26}, {0xab28, 0xab2e},
|
||||
{0xab30, 0xab5f}, {0xabc0, 0xabed}, {0xabf0, 0xabf9}, {0xac00, 0xd7a3},
|
||||
{0xd7b0, 0xd7c6}, {0xd7cb, 0xd7fb}, {0xdc00, 0xdc3e}, {0xdc40, 0xdc7e},
|
||||
{0xdc80, 0xdcbe}, {0xdcc0, 0xdcfe}, {0xdd80, 0xddbe}, {0xddc0, 0xddfe},
|
||||
{0xde80, 0xdebe}, {0xdec0, 0xdefe}, {0xdf00, 0xdf3e}, {0xdf40, 0xdf7e},
|
||||
{0xc46, 0xc48}, {0xc4a, 0xc4d}, {0xc58, 0xc5a}, {0xc60, 0xc63},
|
||||
{0xc66, 0xc6f}, {0xc78, 0xc7f}, {0xc81, 0xc83}, {0xc85, 0xc8c},
|
||||
{0xc8e, 0xc90}, {0xc92, 0xca8}, {0xcaa, 0xcb3}, {0xcb5, 0xcb9},
|
||||
{0xcbc, 0xcc4}, {0xcc6, 0xcc8}, {0xcca, 0xccd}, {0xce0, 0xce3},
|
||||
{0xce6, 0xcef}, {0xd01, 0xd03}, {0xd05, 0xd0c}, {0xd0e, 0xd10},
|
||||
{0xd12, 0xd3a}, {0xd3d, 0xd44}, {0xd46, 0xd48}, {0xd4a, 0xd4e},
|
||||
{0xd5f, 0xd63}, {0xd66, 0xd75}, {0xd79, 0xd7f}, {0xd85, 0xd96},
|
||||
{0xd9a, 0xdb1}, {0xdb3, 0xdbb}, {0xdc0, 0xdc6}, {0xdcf, 0xdd4},
|
||||
{0xdd8, 0xddf}, {0xde6, 0xdef}, {0xdf2, 0xdf4}, {0xe01, 0xe3a},
|
||||
{0xe3f, 0xe5b}, {0xe94, 0xe97}, {0xe99, 0xe9f}, {0xea1, 0xea3},
|
||||
{0xead, 0xeb9}, {0xebb, 0xebd}, {0xec0, 0xec4}, {0xec8, 0xecd},
|
||||
{0xed0, 0xed9}, {0xedc, 0xedf}, {0xf00, 0xf47}, {0xf49, 0xf6c},
|
||||
{0xf71, 0xf97}, {0xf99, 0xfbc}, {0xfbe, 0xfcc}, {0xfce, 0xfda},
|
||||
{0x1000, 0x10c5}, {0x10d0, 0x1248}, {0x124a, 0x124d}, {0x1250, 0x1256},
|
||||
{0x125a, 0x125d}, {0x1260, 0x1288}, {0x128a, 0x128d}, {0x1290, 0x12b0},
|
||||
{0x12b2, 0x12b5}, {0x12b8, 0x12be}, {0x12c2, 0x12c5}, {0x12c8, 0x12d6},
|
||||
{0x12d8, 0x1310}, {0x1312, 0x1315}, {0x1318, 0x135a}, {0x135d, 0x137c},
|
||||
{0x1380, 0x1399}, {0x13a0, 0x13f5}, {0x13f8, 0x13fd}, {0x1400, 0x167f},
|
||||
{0x1681, 0x169c}, {0x16a0, 0x16f8}, {0x1700, 0x170c}, {0x170e, 0x1714},
|
||||
{0x1720, 0x1736}, {0x1740, 0x1753}, {0x1760, 0x176c}, {0x176e, 0x1770},
|
||||
{0x1780, 0x17dd}, {0x17e0, 0x17e9}, {0x17f0, 0x17f9}, {0x1800, 0x180d},
|
||||
{0x1810, 0x1819}, {0x1820, 0x1877}, {0x1880, 0x18aa}, {0x18b0, 0x18f5},
|
||||
{0x1900, 0x191e}, {0x1920, 0x192b}, {0x1930, 0x193b}, {0x1944, 0x196d},
|
||||
{0x1970, 0x1974}, {0x1980, 0x19ab}, {0x19b0, 0x19c9}, {0x19d0, 0x19da},
|
||||
{0x19de, 0x1a1b}, {0x1a1e, 0x1a5e}, {0x1a60, 0x1a7c}, {0x1a7f, 0x1a89},
|
||||
{0x1a90, 0x1a99}, {0x1aa0, 0x1aad}, {0x1ab0, 0x1abe}, {0x1b00, 0x1b4b},
|
||||
{0x1b50, 0x1b7c}, {0x1b80, 0x1bf3}, {0x1bfc, 0x1c37}, {0x1c3b, 0x1c49},
|
||||
{0x1c4d, 0x1c7f}, {0x1cc0, 0x1cc7}, {0x1cd0, 0x1cf6}, {0x1d00, 0x1df5},
|
||||
{0x1dfc, 0x1f15}, {0x1f18, 0x1f1d}, {0x1f20, 0x1f45}, {0x1f48, 0x1f4d},
|
||||
{0x1f50, 0x1f57}, {0x1f5f, 0x1f7d}, {0x1f80, 0x1fb4}, {0x1fb6, 0x1fc4},
|
||||
{0x1fc6, 0x1fd3}, {0x1fd6, 0x1fdb}, {0x1fdd, 0x1fef}, {0x1ff2, 0x1ff4},
|
||||
{0x1ff6, 0x1ffe}, {0x2010, 0x2027}, {0x2030, 0x205e}, {0x2074, 0x208e},
|
||||
{0x2090, 0x209c}, {0x20a0, 0x20be}, {0x20d0, 0x20f0}, {0x2100, 0x218b},
|
||||
{0x2190, 0x23fa}, {0x2400, 0x2426}, {0x2440, 0x244a}, {0x2460, 0x2b73},
|
||||
{0x2b76, 0x2b95}, {0x2b98, 0x2bb9}, {0x2bbd, 0x2bc8}, {0x2bca, 0x2bd1},
|
||||
{0x2bec, 0x2bef}, {0x2c00, 0x2c2e}, {0x2c30, 0x2c5e}, {0x2c60, 0x2cf3},
|
||||
{0x2cf9, 0x2d25}, {0x2d30, 0x2d67}, {0x2d7f, 0x2d96}, {0x2da0, 0x2da6},
|
||||
{0x2da8, 0x2dae}, {0x2db0, 0x2db6}, {0x2db8, 0x2dbe}, {0x2dc0, 0x2dc6},
|
||||
{0x2dc8, 0x2dce}, {0x2dd0, 0x2dd6}, {0x2dd8, 0x2dde}, {0x2de0, 0x2e42},
|
||||
{0x2e80, 0x2e99}, {0x2e9b, 0x2ef3}, {0x2f00, 0x2fd5}, {0x2ff0, 0x2ffb},
|
||||
{0x3001, 0x303f}, {0x3041, 0x3096}, {0x3099, 0x30ff}, {0x3105, 0x312d},
|
||||
{0x3131, 0x318e}, {0x3190, 0x31ba}, {0x31c0, 0x31e3}, {0x31f0, 0x321e},
|
||||
{0x3220, 0x32fe}, {0x3300, 0x4db5}, {0x4dc0, 0x9fd5}, {0xa000, 0xa48c},
|
||||
{0xa490, 0xa4c6}, {0xa4d0, 0xa62b}, {0xa640, 0xa6f7}, {0xa700, 0xa7ad},
|
||||
{0xa7b0, 0xa7b7}, {0xa7f7, 0xa82b}, {0xa830, 0xa839}, {0xa840, 0xa877},
|
||||
{0xa880, 0xa8c4}, {0xa8ce, 0xa8d9}, {0xa8e0, 0xa8fd}, {0xa900, 0xa953},
|
||||
{0xa95f, 0xa97c}, {0xa980, 0xa9cd}, {0xa9cf, 0xa9d9}, {0xa9de, 0xa9fe},
|
||||
{0xaa00, 0xaa36}, {0xaa40, 0xaa4d}, {0xaa50, 0xaa59}, {0xaa5c, 0xaac2},
|
||||
{0xaadb, 0xaaf6}, {0xab01, 0xab06}, {0xab09, 0xab0e}, {0xab11, 0xab16},
|
||||
{0xab20, 0xab26}, {0xab28, 0xab2e}, {0xab30, 0xab65}, {0xab70, 0xabed},
|
||||
{0xabf0, 0xabf9}, {0xac00, 0xd7a3}, {0xd7b0, 0xd7c6}, {0xd7cb, 0xd7fb},
|
||||
{0xdc00, 0xdc3e}, {0xdc40, 0xdc7e}, {0xdc80, 0xdcbe}, {0xdcc0, 0xdcfe},
|
||||
{0xdd00, 0xdd3e}, {0xdd40, 0xdd7e}, {0xdd80, 0xddbe}, {0xddc0, 0xddfe},
|
||||
{0xde00, 0xde3e}, {0xde40, 0xde7e}, {0xde80, 0xdebe}, {0xdec0, 0xdefe},
|
||||
{0xdf00, 0xdf3e}, {0xdf40, 0xdf7e}, {0xdf80, 0xdfbe}, {0xdfc0, 0xdffe},
|
||||
{0xf900, 0xfa6d}, {0xfa70, 0xfad9}, {0xfb00, 0xfb06}, {0xfb13, 0xfb17},
|
||||
{0xfb1d, 0xfb36}, {0xfb38, 0xfb3c}, {0xfb46, 0xfbc1}, {0xfbd3, 0xfd3f},
|
||||
{0xfd50, 0xfd8f}, {0xfd92, 0xfdc7}, {0xfdf0, 0xfdfd}, {0xfe00, 0xfe19},
|
||||
{0xfe20, 0xfe2d}, {0xfe30, 0xfe52}, {0xfe54, 0xfe66}, {0xfe68, 0xfe6b},
|
||||
{0xfe70, 0xfe74}, {0xfe76, 0xfefc}, {0xff01, 0xffbe}, {0xffc2, 0xffc7},
|
||||
{0xffca, 0xffcf}, {0xffd2, 0xffd7}, {0xffda, 0xffdc}, {0xffe0, 0xffe6},
|
||||
{0xffe8, 0xffee}
|
||||
{0xfe20, 0xfe52}, {0xfe54, 0xfe66}, {0xfe68, 0xfe6b}, {0xfe70, 0xfe74},
|
||||
{0xfe76, 0xfefc}, {0xff01, 0xffbe}, {0xffc2, 0xffc7}, {0xffca, 0xffcf},
|
||||
{0xffd2, 0xffd7}, {0xffda, 0xffdc}, {0xffe0, 0xffe6}, {0xffe8, 0xffee}
|
||||
#if TCL_UTF_MAX > 4
|
||||
,{0x10000, 0x1000b}, {0x1000d, 0x10026}, {0x10028, 0x1003a}, {0x1003f, 0x1004d},
|
||||
{0x10050, 0x1005d}, {0x10080, 0x100fa}, {0x10100, 0x10102}, {0x10107, 0x10133},
|
||||
@@ -683,45 +693,48 @@ static const crange graphRangeTable[] = {
|
||||
{0x10400, 0x1049d}, {0x104a0, 0x104a9}, {0x10500, 0x10527}, {0x10530, 0x10563},
|
||||
{0x10600, 0x10736}, {0x10740, 0x10755}, {0x10760, 0x10767}, {0x10800, 0x10805},
|
||||
{0x1080a, 0x10835}, {0x1083f, 0x10855}, {0x10857, 0x1089e}, {0x108a7, 0x108af},
|
||||
{0x10900, 0x1091b}, {0x1091f, 0x10939}, {0x10980, 0x109b7}, {0x10a00, 0x10a03},
|
||||
{0x10a0c, 0x10a13}, {0x10a15, 0x10a17}, {0x10a19, 0x10a33}, {0x10a38, 0x10a3a},
|
||||
{0x10a3f, 0x10a47}, {0x10a50, 0x10a58}, {0x10a60, 0x10a9f}, {0x10ac0, 0x10ae6},
|
||||
{0x10aeb, 0x10af6}, {0x10b00, 0x10b35}, {0x10b39, 0x10b55}, {0x10b58, 0x10b72},
|
||||
{0x10b78, 0x10b91}, {0x10b99, 0x10b9c}, {0x10ba9, 0x10baf}, {0x10c00, 0x10c48},
|
||||
{0x10e60, 0x10e7e}, {0x11000, 0x1104d}, {0x11052, 0x1106f}, {0x1107f, 0x110bc},
|
||||
{0x110be, 0x110c1}, {0x110d0, 0x110e8}, {0x110f0, 0x110f9}, {0x11100, 0x11134},
|
||||
{0x11136, 0x11143}, {0x11150, 0x11176}, {0x11180, 0x111c8}, {0x111d0, 0x111da},
|
||||
{0x111e1, 0x111f4}, {0x11200, 0x11211}, {0x11213, 0x1123d}, {0x112b0, 0x112ea},
|
||||
{0x112f0, 0x112f9}, {0x11301, 0x11303}, {0x11305, 0x1130c}, {0x11313, 0x11328},
|
||||
{0x1132a, 0x11330}, {0x11335, 0x11339}, {0x1133c, 0x11344}, {0x1134b, 0x1134d},
|
||||
{0x1135d, 0x11363}, {0x11366, 0x1136c}, {0x11370, 0x11374}, {0x11480, 0x114c7},
|
||||
{0x114d0, 0x114d9}, {0x11580, 0x115b5}, {0x115b8, 0x115c9}, {0x11600, 0x11644},
|
||||
{0x11650, 0x11659}, {0x11680, 0x116b7}, {0x116c0, 0x116c9}, {0x118a0, 0x118f2},
|
||||
{0x11ac0, 0x11af8}, {0x12000, 0x12398}, {0x12400, 0x1246e}, {0x12470, 0x12474},
|
||||
{0x13000, 0x1342e}, {0x16800, 0x16a38}, {0x16a40, 0x16a5e}, {0x16a60, 0x16a69},
|
||||
{0x16ad0, 0x16aed}, {0x16af0, 0x16af5}, {0x16b00, 0x16b45}, {0x16b50, 0x16b59},
|
||||
{0x16b5b, 0x16b61}, {0x16b63, 0x16b77}, {0x16b7d, 0x16b8f}, {0x16f00, 0x16f44},
|
||||
{0x16f50, 0x16f7e}, {0x16f8f, 0x16f9f}, {0x1bc00, 0x1bc6a}, {0x1bc70, 0x1bc7c},
|
||||
{0x1bc80, 0x1bc88}, {0x1bc90, 0x1bc99}, {0x1bc9c, 0x1bc9f}, {0x1d000, 0x1d0f5},
|
||||
{0x1d100, 0x1d126}, {0x1d129, 0x1d172}, {0x1d17b, 0x1d1dd}, {0x1d200, 0x1d245},
|
||||
{0x1d300, 0x1d356}, {0x1d360, 0x1d371}, {0x1d400, 0x1d454}, {0x1d456, 0x1d49c},
|
||||
{0x1d4a9, 0x1d4ac}, {0x1d4ae, 0x1d4b9}, {0x1d4bd, 0x1d4c3}, {0x1d4c5, 0x1d505},
|
||||
{0x1d507, 0x1d50a}, {0x1d50d, 0x1d514}, {0x1d516, 0x1d51c}, {0x1d51e, 0x1d539},
|
||||
{0x1d53b, 0x1d53e}, {0x1d540, 0x1d544}, {0x1d54a, 0x1d550}, {0x1d552, 0x1d6a5},
|
||||
{0x1d6a8, 0x1d7cb}, {0x1d7ce, 0x1d7ff}, {0x1e800, 0x1e8c4}, {0x1e8c7, 0x1e8d6},
|
||||
{0x108e0, 0x108f2}, {0x108fb, 0x1091b}, {0x1091f, 0x10939}, {0x10980, 0x109b7},
|
||||
{0x109bc, 0x109cf}, {0x109d2, 0x10a03}, {0x10a0c, 0x10a13}, {0x10a15, 0x10a17},
|
||||
{0x10a19, 0x10a33}, {0x10a38, 0x10a3a}, {0x10a3f, 0x10a47}, {0x10a50, 0x10a58},
|
||||
{0x10a60, 0x10a9f}, {0x10ac0, 0x10ae6}, {0x10aeb, 0x10af6}, {0x10b00, 0x10b35},
|
||||
{0x10b39, 0x10b55}, {0x10b58, 0x10b72}, {0x10b78, 0x10b91}, {0x10b99, 0x10b9c},
|
||||
{0x10ba9, 0x10baf}, {0x10c00, 0x10c48}, {0x10c80, 0x10cb2}, {0x10cc0, 0x10cf2},
|
||||
{0x10cfa, 0x10cff}, {0x10e60, 0x10e7e}, {0x11000, 0x1104d}, {0x11052, 0x1106f},
|
||||
{0x1107f, 0x110bc}, {0x110be, 0x110c1}, {0x110d0, 0x110e8}, {0x110f0, 0x110f9},
|
||||
{0x11100, 0x11134}, {0x11136, 0x11143}, {0x11150, 0x11176}, {0x11180, 0x111cd},
|
||||
{0x111d0, 0x111df}, {0x111e1, 0x111f4}, {0x11200, 0x11211}, {0x11213, 0x1123d},
|
||||
{0x11280, 0x11286}, {0x1128a, 0x1128d}, {0x1128f, 0x1129d}, {0x1129f, 0x112a9},
|
||||
{0x112b0, 0x112ea}, {0x112f0, 0x112f9}, {0x11300, 0x11303}, {0x11305, 0x1130c},
|
||||
{0x11313, 0x11328}, {0x1132a, 0x11330}, {0x11335, 0x11339}, {0x1133c, 0x11344},
|
||||
{0x1134b, 0x1134d}, {0x1135d, 0x11363}, {0x11366, 0x1136c}, {0x11370, 0x11374},
|
||||
{0x11480, 0x114c7}, {0x114d0, 0x114d9}, {0x11580, 0x115b5}, {0x115b8, 0x115dd},
|
||||
{0x11600, 0x11644}, {0x11650, 0x11659}, {0x11680, 0x116b7}, {0x116c0, 0x116c9},
|
||||
{0x11700, 0x11719}, {0x1171d, 0x1172b}, {0x11730, 0x1173f}, {0x118a0, 0x118f2},
|
||||
{0x11ac0, 0x11af8}, {0x12000, 0x12399}, {0x12400, 0x1246e}, {0x12470, 0x12474},
|
||||
{0x12480, 0x12543}, {0x13000, 0x1342e}, {0x14400, 0x14646}, {0x16800, 0x16a38},
|
||||
{0x16a40, 0x16a5e}, {0x16a60, 0x16a69}, {0x16ad0, 0x16aed}, {0x16af0, 0x16af5},
|
||||
{0x16b00, 0x16b45}, {0x16b50, 0x16b59}, {0x16b5b, 0x16b61}, {0x16b63, 0x16b77},
|
||||
{0x16b7d, 0x16b8f}, {0x16f00, 0x16f44}, {0x16f50, 0x16f7e}, {0x16f8f, 0x16f9f},
|
||||
{0x1bc00, 0x1bc6a}, {0x1bc70, 0x1bc7c}, {0x1bc80, 0x1bc88}, {0x1bc90, 0x1bc99},
|
||||
{0x1bc9c, 0x1bc9f}, {0x1d000, 0x1d0f5}, {0x1d100, 0x1d126}, {0x1d129, 0x1d172},
|
||||
{0x1d17b, 0x1d1e8}, {0x1d200, 0x1d245}, {0x1d300, 0x1d356}, {0x1d360, 0x1d371},
|
||||
{0x1d400, 0x1d454}, {0x1d456, 0x1d49c}, {0x1d4a9, 0x1d4ac}, {0x1d4ae, 0x1d4b9},
|
||||
{0x1d4bd, 0x1d4c3}, {0x1d4c5, 0x1d505}, {0x1d507, 0x1d50a}, {0x1d50d, 0x1d514},
|
||||
{0x1d516, 0x1d51c}, {0x1d51e, 0x1d539}, {0x1d53b, 0x1d53e}, {0x1d540, 0x1d544},
|
||||
{0x1d54a, 0x1d550}, {0x1d552, 0x1d6a5}, {0x1d6a8, 0x1d7cb}, {0x1d7ce, 0x1da8b},
|
||||
{0x1da9b, 0x1da9f}, {0x1daa1, 0x1daaf}, {0x1e800, 0x1e8c4}, {0x1e8c7, 0x1e8d6},
|
||||
{0x1ee00, 0x1ee03}, {0x1ee05, 0x1ee1f}, {0x1ee29, 0x1ee32}, {0x1ee34, 0x1ee37},
|
||||
{0x1ee4d, 0x1ee4f}, {0x1ee67, 0x1ee6a}, {0x1ee6c, 0x1ee72}, {0x1ee74, 0x1ee77},
|
||||
{0x1ee79, 0x1ee7c}, {0x1ee80, 0x1ee89}, {0x1ee8b, 0x1ee9b}, {0x1eea1, 0x1eea3},
|
||||
{0x1eea5, 0x1eea9}, {0x1eeab, 0x1eebb}, {0x1f000, 0x1f02b}, {0x1f030, 0x1f093},
|
||||
{0x1f0a0, 0x1f0ae}, {0x1f0b1, 0x1f0bf}, {0x1f0c1, 0x1f0cf}, {0x1f0d1, 0x1f0f5},
|
||||
{0x1f100, 0x1f10c}, {0x1f110, 0x1f12e}, {0x1f130, 0x1f16b}, {0x1f170, 0x1f19a},
|
||||
{0x1f1e6, 0x1f202}, {0x1f210, 0x1f23a}, {0x1f240, 0x1f248}, {0x1f300, 0x1f32c},
|
||||
{0x1f330, 0x1f37d}, {0x1f380, 0x1f3ce}, {0x1f3d4, 0x1f3f7}, {0x1f400, 0x1f4fe},
|
||||
{0x1f500, 0x1f54a}, {0x1f550, 0x1f579}, {0x1f57b, 0x1f5a3}, {0x1f5a5, 0x1f642},
|
||||
{0x1f645, 0x1f6cf}, {0x1f6e0, 0x1f6ec}, {0x1f6f0, 0x1f6f3}, {0x1f700, 0x1f773},
|
||||
{0x1f780, 0x1f7d4}, {0x1f800, 0x1f80b}, {0x1f810, 0x1f847}, {0x1f850, 0x1f859},
|
||||
{0x1f860, 0x1f887}, {0x1f890, 0x1f8ad}, {0x20000, 0x2a6d6}, {0x2a700, 0x2b734},
|
||||
{0x2b740, 0x2b81d}, {0x2f800, 0x2fa1d}, {0xe0100, 0xe01ef}
|
||||
{0x1f1e6, 0x1f202}, {0x1f210, 0x1f23a}, {0x1f240, 0x1f248}, {0x1f300, 0x1f579},
|
||||
{0x1f57b, 0x1f5a3}, {0x1f5a5, 0x1f6d0}, {0x1f6e0, 0x1f6ec}, {0x1f6f0, 0x1f6f3},
|
||||
{0x1f700, 0x1f773}, {0x1f780, 0x1f7d4}, {0x1f800, 0x1f80b}, {0x1f810, 0x1f847},
|
||||
{0x1f850, 0x1f859}, {0x1f860, 0x1f887}, {0x1f890, 0x1f8ad}, {0x1f910, 0x1f918},
|
||||
{0x1f980, 0x1f984}, {0x20000, 0x2a6d6}, {0x2a700, 0x2b734}, {0x2b740, 0x2b81d},
|
||||
{0x2b820, 0x2cea1}, {0x2f800, 0x2fa1d}, {0xe0100, 0xe01ef}
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -731,23 +744,23 @@ static const chr graphCharTable[] = {
|
||||
0x38c, 0x589, 0x58a, 0x85e, 0x98f, 0x990, 0x9b2, 0x9c7, 0x9c8,
|
||||
0x9d7, 0x9dc, 0x9dd, 0xa0f, 0xa10, 0xa32, 0xa33, 0xa35, 0xa36,
|
||||
0xa38, 0xa39, 0xa3c, 0xa47, 0xa48, 0xa51, 0xa5e, 0xab2, 0xab3,
|
||||
0xad0, 0xb0f, 0xb10, 0xb32, 0xb33, 0xb47, 0xb48, 0xb56, 0xb57,
|
||||
0xb5c, 0xb5d, 0xb82, 0xb83, 0xb99, 0xb9a, 0xb9c, 0xb9e, 0xb9f,
|
||||
0xba3, 0xba4, 0xbd0, 0xbd7, 0xc55, 0xc56, 0xc58, 0xc59, 0xcd5,
|
||||
0xcd6, 0xcde, 0xcf1, 0xcf2, 0xd57, 0xd82, 0xd83, 0xdbd, 0xdca,
|
||||
0xdd6, 0xe81, 0xe82, 0xe84, 0xe87, 0xe88, 0xe8a, 0xe8d, 0xea5,
|
||||
0xea7, 0xeaa, 0xeab, 0xec6, 0x10c7, 0x10cd, 0x1258, 0x12c0, 0x1772,
|
||||
0x1773, 0x1940, 0x1cf8, 0x1cf9, 0x1f59, 0x1f5b, 0x1f5d, 0x2070, 0x2071,
|
||||
0x2d27, 0x2d2d, 0x2d6f, 0x2d70, 0xa7b0, 0xa7b1, 0xab64, 0xab65, 0xfb3e,
|
||||
0xfb40, 0xfb41, 0xfb43, 0xfb44, 0xfffc, 0xfffd
|
||||
0xad0, 0xaf9, 0xb0f, 0xb10, 0xb32, 0xb33, 0xb47, 0xb48, 0xb56,
|
||||
0xb57, 0xb5c, 0xb5d, 0xb82, 0xb83, 0xb99, 0xb9a, 0xb9c, 0xb9e,
|
||||
0xb9f, 0xba3, 0xba4, 0xbd0, 0xbd7, 0xc55, 0xc56, 0xcd5, 0xcd6,
|
||||
0xcde, 0xcf1, 0xcf2, 0xd57, 0xd82, 0xd83, 0xdbd, 0xdca, 0xdd6,
|
||||
0xe81, 0xe82, 0xe84, 0xe87, 0xe88, 0xe8a, 0xe8d, 0xea5, 0xea7,
|
||||
0xeaa, 0xeab, 0xec6, 0x10c7, 0x10cd, 0x1258, 0x12c0, 0x1772, 0x1773,
|
||||
0x1940, 0x1cf8, 0x1cf9, 0x1f59, 0x1f5b, 0x1f5d, 0x2070, 0x2071, 0x2d27,
|
||||
0x2d2d, 0x2d6f, 0x2d70, 0xfb3e, 0xfb40, 0xfb41, 0xfb43, 0xfb44, 0xfffc,
|
||||
0xfffd
|
||||
#if TCL_UTF_MAX > 4
|
||||
,0x1003c, 0x1003d, 0x101a0, 0x1056f, 0x10808, 0x10837, 0x10838, 0x1083c, 0x1093f,
|
||||
0x109be, 0x109bf, 0x10a05, 0x10a06, 0x111cd, 0x1130f, 0x11310, 0x11332, 0x11333,
|
||||
0x11347, 0x11348, 0x11357, 0x118ff, 0x16a6e, 0x16a6f, 0x1b000, 0x1b001, 0x1d49e,
|
||||
0x1d49f, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4bb, 0x1d546, 0x1ee21, 0x1ee22, 0x1ee24,
|
||||
0x1ee27, 0x1ee39, 0x1ee3b, 0x1ee42, 0x1ee47, 0x1ee49, 0x1ee4b, 0x1ee51, 0x1ee52,
|
||||
0x1ee54, 0x1ee57, 0x1ee59, 0x1ee5b, 0x1ee5d, 0x1ee5f, 0x1ee61, 0x1ee62, 0x1ee64,
|
||||
0x1ee7e, 0x1eef0, 0x1eef1, 0x1f250, 0x1f251
|
||||
,0x1003c, 0x1003d, 0x101a0, 0x1056f, 0x10808, 0x10837, 0x10838, 0x1083c, 0x108f4,
|
||||
0x108f5, 0x1093f, 0x10a05, 0x10a06, 0x11288, 0x1130f, 0x11310, 0x11332, 0x11333,
|
||||
0x11347, 0x11348, 0x11350, 0x11357, 0x118ff, 0x16a6e, 0x16a6f, 0x1b000, 0x1b001,
|
||||
0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4bb, 0x1d546, 0x1ee21, 0x1ee22,
|
||||
0x1ee24, 0x1ee27, 0x1ee39, 0x1ee3b, 0x1ee42, 0x1ee47, 0x1ee49, 0x1ee4b, 0x1ee51,
|
||||
0x1ee52, 0x1ee54, 0x1ee57, 0x1ee59, 0x1ee5b, 0x1ee5d, 0x1ee5f, 0x1ee61, 0x1ee62,
|
||||
0x1ee64, 0x1ee7e, 0x1eef0, 0x1eef1, 0x1f250, 0x1f251, 0x1f9c0
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
+1565
-396
File diff suppressed because it is too large
Load Diff
+148
-98
@@ -83,9 +83,6 @@ static int lexdigits(struct vars *, int, int, int);
|
||||
static int brenext(struct vars *, pchr);
|
||||
static void skip(struct vars *);
|
||||
static chr newline(NOPARMS);
|
||||
#ifdef REG_DEBUG
|
||||
static const chr *ch(NOPARMS);
|
||||
#endif
|
||||
static chr chrnamed(struct vars *, const chr *, const chr *, pchr);
|
||||
/* === regc_color.c === */
|
||||
static void initcm(struct vars *, struct colormap *);
|
||||
@@ -119,17 +116,22 @@ static void dropstate(struct nfa *, struct state *);
|
||||
static void freestate(struct nfa *, struct state *);
|
||||
static void destroystate(struct nfa *, struct state *);
|
||||
static void newarc(struct nfa *, int, pcolor, struct state *, struct state *);
|
||||
static void createarc(struct nfa *, int, pcolor, struct state *, struct state *);
|
||||
static struct arc *allocarc(struct nfa *, struct state *);
|
||||
static void freearc(struct nfa *, struct arc *);
|
||||
static void changearctarget(struct arc *, struct state *);
|
||||
static int hasnonemptyout(struct state *);
|
||||
static int nonemptyouts(struct state *);
|
||||
static int nonemptyins(struct state *);
|
||||
static struct arc *findarc(struct state *, int, pcolor);
|
||||
static void cparc(struct nfa *, struct arc *, struct state *, struct state *);
|
||||
static void sortins(struct nfa *, struct state *);
|
||||
static int sortins_cmp(const void *, const void *);
|
||||
static void sortouts(struct nfa *, struct state *);
|
||||
static int sortouts_cmp(const void *, const void *);
|
||||
static void moveins(struct nfa *, struct state *, struct state *);
|
||||
static void copyins(struct nfa *, struct state *, struct state *, int);
|
||||
static void copyins(struct nfa *, struct state *, struct state *);
|
||||
static void mergeins(struct nfa *, struct state *, struct arc **, int);
|
||||
static void moveouts(struct nfa *, struct state *, struct state *);
|
||||
static void copyouts(struct nfa *, struct state *, struct state *, int);
|
||||
static void copyouts(struct nfa *, struct state *, struct state *);
|
||||
static void cloneouts(struct nfa *, struct state *, struct state *, struct state *, int);
|
||||
static void delsub(struct nfa *, struct state *, struct state *);
|
||||
static void deltraverse(struct nfa *, struct state *, struct state *);
|
||||
@@ -139,33 +141,40 @@ static void cleartraverse(struct nfa *, struct state *);
|
||||
static void specialcolors(struct nfa *);
|
||||
static long optimize(struct nfa *, FILE *);
|
||||
static void pullback(struct nfa *, FILE *);
|
||||
static int pull(struct nfa *, struct arc *);
|
||||
static int pull(struct nfa *, struct arc *, struct state **);
|
||||
static void pushfwd(struct nfa *, FILE *);
|
||||
static int push(struct nfa *, struct arc *);
|
||||
static int push(struct nfa *, struct arc *, struct state **);
|
||||
#define INCOMPATIBLE 1 /* destroys arc */
|
||||
#define SATISFIED 2 /* constraint satisfied */
|
||||
#define COMPATIBLE 3 /* compatible but not satisfied yet */
|
||||
static int combine(struct arc *, struct arc *);
|
||||
static void fixempties(struct nfa *, FILE *);
|
||||
static struct state *emptyreachable(struct state *, struct state *);
|
||||
static void replaceempty(struct nfa *, struct state *, struct state *);
|
||||
static struct state *emptyreachable(struct nfa *, struct state *,
|
||||
struct state *, struct arc **);
|
||||
static int isconstraintarc(struct arc *);
|
||||
static int hasconstraintout(struct state *);
|
||||
static void fixconstraintloops(struct nfa *, FILE *);
|
||||
static int findconstraintloop(struct nfa *, struct state *);
|
||||
static void breakconstraintloop(struct nfa *, struct state *);
|
||||
static void clonesuccessorstates(struct nfa *, struct state *, struct state *,
|
||||
struct state *, struct arc *, char *, char *, int);
|
||||
static void cleanup(struct nfa *);
|
||||
static void markreachable(struct nfa *, struct state *, struct state *, struct state *);
|
||||
static void markcanreach(struct nfa *, struct state *, struct state *, struct state *);
|
||||
static long analyze(struct nfa *);
|
||||
static void compact(struct nfa *, struct cnfa *);
|
||||
static void carcsort(struct carc *, struct carc *);
|
||||
static void carcsort(struct carc *, size_t);
|
||||
static int carc_cmp(const void *, const void *);
|
||||
static void freecnfa(struct cnfa *);
|
||||
static void dumpnfa(struct nfa *, FILE *);
|
||||
#ifdef REG_DEBUG
|
||||
static void dumpstate(struct state *, FILE *);
|
||||
static void dumparcs(struct state *, FILE *);
|
||||
static int dumprarcs(struct arc *, struct state *, FILE *, int);
|
||||
static void dumparc(struct arc *, struct state *, FILE *);
|
||||
#endif
|
||||
static void dumpcnfa(struct cnfa *, FILE *);
|
||||
#ifdef REG_DEBUG
|
||||
static void dumpcstate(int, struct carc *, struct cnfa *, FILE *);
|
||||
static void dumpcstate(int, struct cnfa *, FILE *);
|
||||
#endif
|
||||
/* === regc_cvec.c === */
|
||||
static struct cvec *clearcvec(struct cvec *);
|
||||
@@ -210,11 +219,12 @@ struct vars {
|
||||
struct subre *tree; /* subexpression tree */
|
||||
struct subre *treechain; /* all tree nodes allocated */
|
||||
struct subre *treefree; /* any free tree nodes */
|
||||
int ntree; /* number of tree nodes */
|
||||
int ntree; /* number of tree nodes, plus one */
|
||||
struct cvec *cv; /* interface cvec */
|
||||
struct cvec *cv2; /* utility cvec */
|
||||
struct subre *lacons; /* lookahead-constraint vector */
|
||||
int nlacons; /* size of lacons */
|
||||
size_t spaceused; /* approx. space used for compilation */
|
||||
};
|
||||
|
||||
/* parsing macros; most know that `v' is the struct vars pointer */
|
||||
@@ -223,13 +233,13 @@ struct vars {
|
||||
#define EAT(t) (SEE(t) && next(v)) /* if next is this, swallow it */
|
||||
#define VISERR(vv) ((vv)->err != 0)/* have we seen an error yet? */
|
||||
#define ISERR() VISERR(v)
|
||||
#define VERR(vv,e) \
|
||||
((vv)->nexttype = EOS, ((vv)->err) ? (vv)->err : ((vv)->err = (e)))
|
||||
#define VERR(vv,e) ((vv)->nexttype = EOS, \
|
||||
(vv)->err = ((vv)->err ? (vv)->err : (e)))
|
||||
#define ERR(e) VERR(v, e) /* record an error */
|
||||
#define NOERR() {if (ISERR()) return;} /* if error seen, return */
|
||||
#define NOERRN() {if (ISERR()) return NULL;} /* NOERR with retval */
|
||||
#define NOERRZ() {if (ISERR()) return 0;} /* NOERR with retval */
|
||||
#define INSIST(c, e) ((c) ? 0 : ERR(e)) /* if condition false, error */
|
||||
#define INSIST(c, e) do { if (!(c)) ERR(e); } while (0) /* error if c false */
|
||||
#define NOTE(b) (v->re->re_info |= (b)) /* note visible condition */
|
||||
#define EMPTYARC(x, y) newarc(v->nfa, EMPTY, 0, x, y)
|
||||
|
||||
@@ -258,12 +268,14 @@ struct vars {
|
||||
((a)->type == PLAIN || (a)->type == AHEAD || (a)->type == BEHIND)
|
||||
|
||||
/* static function list */
|
||||
static struct fns functions = {
|
||||
static const struct fns functions = {
|
||||
rfree, /* regfree insides */
|
||||
};
|
||||
|
||||
/*
|
||||
- compile - compile regular expression
|
||||
* Note: on failure, no resources remain allocated, so regfree()
|
||||
* need not be applied to re.
|
||||
^ int compile(regex_t *, const chr *, size_t, int);
|
||||
*/
|
||||
int
|
||||
@@ -324,6 +336,7 @@ compile(
|
||||
v->cv2 = NULL;
|
||||
v->lacons = NULL;
|
||||
v->nlacons = 0;
|
||||
v->spaceused = 0;
|
||||
re->re_magic = REMAGIC;
|
||||
re->re_info = 0; /* bits get set during parse */
|
||||
re->re_csize = sizeof(chr);
|
||||
@@ -593,13 +606,15 @@ makesearch(
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (b != NULL && s->tmp == NULL) {
|
||||
/*
|
||||
* Must be split if not already in the list (fixes bugs 505048,
|
||||
* 230589, 840258, 504785).
|
||||
*/
|
||||
|
||||
s->tmp = slist;
|
||||
/*
|
||||
* We want to mark states as being in the list already by having non
|
||||
* NULL tmp fields, but we can't just store the old slist value in tmp
|
||||
* because that doesn't work for the first such state. Instead, the
|
||||
* first list entry gets its own address in tmp.
|
||||
*/
|
||||
if (b != NULL && s->tmp == NULL) {
|
||||
s->tmp = (slist != NULL) ? slist : s;
|
||||
slist = s;
|
||||
}
|
||||
}
|
||||
@@ -610,8 +625,9 @@ makesearch(
|
||||
|
||||
for (s=slist ; s!=NULL ; s=s2) {
|
||||
s2 = newstate(nfa);
|
||||
|
||||
copyouts(nfa, s, s2, 1);
|
||||
NOERR();
|
||||
copyouts(nfa, s, s2);
|
||||
NOERR();
|
||||
for (a=s->ins ; a!=NULL ; a=b) {
|
||||
b = a->inchain;
|
||||
|
||||
@@ -620,7 +636,7 @@ makesearch(
|
||||
freearc(nfa, a);
|
||||
}
|
||||
}
|
||||
s2 = s->tmp;
|
||||
s2 = (s->tmp != s) ? s->tmp : NULL;
|
||||
s->tmp = NULL; /* clean up while we're at it */
|
||||
}
|
||||
}
|
||||
@@ -982,6 +998,7 @@ parseqatom(
|
||||
NOERR();
|
||||
assert(v->nextvalue > 0);
|
||||
atom = subre(v, 'b', BACKR, lp, rp);
|
||||
NOERR();
|
||||
subno = v->nextvalue;
|
||||
atom->subno = subno;
|
||||
EMPTYARC(lp, rp); /* temporarily, so there's something */
|
||||
@@ -996,13 +1013,13 @@ parseqatom(
|
||||
switch (v->nexttype) {
|
||||
case '*':
|
||||
m = 0;
|
||||
n = INFINITY;
|
||||
n = DUPINF;
|
||||
qprefer = (v->nextvalue) ? LONGER : SHORTER;
|
||||
NEXT();
|
||||
break;
|
||||
case '+':
|
||||
m = 1;
|
||||
n = INFINITY;
|
||||
n = DUPINF;
|
||||
qprefer = (v->nextvalue) ? LONGER : SHORTER;
|
||||
NEXT();
|
||||
break;
|
||||
@@ -1019,7 +1036,7 @@ parseqatom(
|
||||
if (SEE(DIGIT)) {
|
||||
n = scannum(v);
|
||||
} else {
|
||||
n = INFINITY;
|
||||
n = DUPINF;
|
||||
}
|
||||
if (m > n) {
|
||||
ERR(REG_BADBR);
|
||||
@@ -1102,11 +1119,17 @@ parseqatom(
|
||||
/*
|
||||
* Prepare a general-purpose state skeleton.
|
||||
*
|
||||
* ---> [s] ---prefix---> [begin] ---atom---> [end] ----rest---> [rp]
|
||||
* / /
|
||||
* [lp] ----> [s2] ----bypass---------------------
|
||||
* In the no-backrefs case, we want this:
|
||||
*
|
||||
* where bypass is an empty, and prefix is some repetitions of atom
|
||||
* [lp] ---> [s] ---prefix---> [begin] ---atom---> [end] ---rest---> [rp]
|
||||
*
|
||||
* where prefix is some repetitions of atom. In the general case we need
|
||||
*
|
||||
* [lp] ---> [s] ---iterator---> [s2] ---rest---> [rp]
|
||||
*
|
||||
* where the iterator wraps around [begin] ---atom---> [end]
|
||||
*
|
||||
* We make the s state here for both cases; s2 is made below if needed
|
||||
*/
|
||||
|
||||
s = newstate(v->nfa); /* first, new endpoints for the atom */
|
||||
@@ -1117,11 +1140,9 @@ parseqatom(
|
||||
NOERR();
|
||||
atom->begin = s;
|
||||
atom->end = s2;
|
||||
s = newstate(v->nfa); /* and spots for prefix and bypass */
|
||||
s2 = newstate(v->nfa);
|
||||
s = newstate(v->nfa); /* set up starting state */
|
||||
NOERR();
|
||||
EMPTYARC(lp, s);
|
||||
EMPTYARC(lp, s2);
|
||||
NOERR();
|
||||
|
||||
/*
|
||||
@@ -1129,6 +1150,7 @@ parseqatom(
|
||||
*/
|
||||
|
||||
t = subre(v, '.', COMBINE(qprefer, atom->flags), lp, rp);
|
||||
NOERR();
|
||||
t->left = atom;
|
||||
atomp = &t->left;
|
||||
|
||||
@@ -1142,6 +1164,7 @@ parseqatom(
|
||||
|
||||
assert(top->op == '=' && top->left == NULL && top->right == NULL);
|
||||
top->left = subre(v, '=', top->flags, top->begin, lp);
|
||||
NOERR();
|
||||
top->op = '.';
|
||||
top->right = t;
|
||||
|
||||
@@ -1166,27 +1189,8 @@ parseqatom(
|
||||
}
|
||||
|
||||
/*
|
||||
* It's quantifier time; first, turn x{0,...} into x{1,...}|empty
|
||||
*/
|
||||
|
||||
if (m == 0) {
|
||||
EMPTYARC(s2, atom->end);/* the bypass */
|
||||
assert(PREF(qprefer) != 0);
|
||||
f = COMBINE(qprefer, atom->flags);
|
||||
t = subre(v, '|', f, lp, atom->end);
|
||||
NOERR();
|
||||
t->left = atom;
|
||||
t->right = subre(v, '|', PREF(f), s2, atom->end);
|
||||
NOERR();
|
||||
t->right->left = subre(v, '=', 0, s2, atom->end);
|
||||
NOERR();
|
||||
*atomp = t;
|
||||
atomp = &t->left;
|
||||
m = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Deal with the rest of the quantifier.
|
||||
* It's quantifier time. If the atom is just a backref, we'll let it deal
|
||||
* with quantifiers internally.
|
||||
*/
|
||||
|
||||
if (atomtype == BACKREF) {
|
||||
@@ -1204,21 +1208,29 @@ parseqatom(
|
||||
atom->min = (short) m;
|
||||
atom->max = (short) n;
|
||||
atom->flags |= COMBINE(qprefer, atom->flags);
|
||||
/* rest of branch can be strung starting from atom->end */
|
||||
s2 = atom->end;
|
||||
} else if (m == 1 && n == 1) {
|
||||
/*
|
||||
* No/vacuous quantifier: done.
|
||||
*/
|
||||
|
||||
EMPTYARC(s, atom->begin); /* empty prefix */
|
||||
} else {
|
||||
/* rest of branch can be strung starting from atom->end */
|
||||
s2 = atom->end;
|
||||
} else if (m > 0 && !(atom->flags & BACKR)) {
|
||||
/*
|
||||
* Turn x{m,n} into x{m-1,n-1}x, with capturing parens in only second
|
||||
* x
|
||||
* If there's no backrefs involved, we can turn x{m,n} into
|
||||
* x{m-1,n-1}x, with capturing parens in only the second x. This
|
||||
* is valid because we only care about capturing matches from the
|
||||
* final iteration of the quantifier. It's a win because we can
|
||||
* implement the backref-free left side as a plain DFA node, since
|
||||
* we don't really care where its submatches are.
|
||||
*/
|
||||
|
||||
dupnfa(v->nfa, atom->begin, atom->end, s, atom->begin);
|
||||
assert(m >= 1 && m != INFINITY && n >= 1);
|
||||
repeat(v, s, atom->begin, m-1, (n == INFINITY) ? n : n-1);
|
||||
assert(m >= 1 && m != DUPINF && n >= 1);
|
||||
repeat(v, s, atom->begin, m-1, (n == DUPINF) ? n : n-1);
|
||||
f = COMBINE(qprefer, atom->flags);
|
||||
t = subre(v, '.', f, s, atom->end); /* prefix and atom */
|
||||
NOERR();
|
||||
@@ -1226,6 +1238,24 @@ parseqatom(
|
||||
NOERR();
|
||||
t->right = atom;
|
||||
*atomp = t;
|
||||
/* rest of branch can be strung starting from atom->end */
|
||||
s2 = atom->end;
|
||||
} else {
|
||||
/* general case: need an iteration node */
|
||||
s2 = newstate(v->nfa);
|
||||
NOERR();
|
||||
moveouts(v->nfa, atom->end, s2);
|
||||
NOERR();
|
||||
dupnfa(v->nfa, atom->begin, atom->end, s, s2);
|
||||
repeat(v, s, s2, m, n);
|
||||
f = COMBINE(qprefer, atom->flags);
|
||||
t = subre(v, '*', f, s, s2);
|
||||
NOERR();
|
||||
t->min = (short) m;
|
||||
t->max = (short) n;
|
||||
t->left = atom;
|
||||
*atomp = t;
|
||||
/* rest of branch is to be strung from iteration's end state */
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1234,10 +1264,10 @@ parseqatom(
|
||||
|
||||
t = top->right;
|
||||
if (!(SEE('|') || SEE(stopper) || SEE(EOS))) {
|
||||
t->right = parsebranch(v, stopper, type, atom->end, rp, 1);
|
||||
t->right = parsebranch(v, stopper, type, s2, rp, 1);
|
||||
} else {
|
||||
EMPTYARC(atom->end, rp);
|
||||
t->right = subre(v, '=', 0, atom->end, rp);
|
||||
EMPTYARC(s2, rp);
|
||||
t->right = subre(v, '=', 0, s2, rp);
|
||||
}
|
||||
NOERR();
|
||||
assert(SEE('|') || SEE(stopper) || SEE(EOS));
|
||||
@@ -1304,6 +1334,8 @@ scannum(
|
||||
|
||||
/*
|
||||
- repeat - replicate subNFA for quantifiers
|
||||
* The sub-NFA strung from lp to rp is modified to represent m to n
|
||||
* repetitions of its initial contents.
|
||||
* The duplication sequences used here are chosen carefully so that any
|
||||
* pointers starting out pointing into the subexpression end up pointing into
|
||||
* the last occurrence. (Note that it may not be strung between the same left
|
||||
@@ -1323,7 +1355,7 @@ repeat(
|
||||
#define SOME 2
|
||||
#define INF 3
|
||||
#define PAIR(x, y) ((x)*4 + (y))
|
||||
#define REDUCE(x) ( ((x) == INFINITY) ? INF : (((x) > 1) ? SOME : (x)) )
|
||||
#define REDUCE(x) ( ((x) == DUPINF) ? INF : (((x) > 1) ? SOME : (x)) )
|
||||
const int rm = REDUCE(m);
|
||||
const int rn = REDUCE(n);
|
||||
struct state *s, *s2;
|
||||
@@ -1713,11 +1745,11 @@ subre(
|
||||
v->treechain = ret;
|
||||
}
|
||||
|
||||
assert(strchr("|.b(=", op) != NULL);
|
||||
assert(strchr("=b|.*(", op) != NULL);
|
||||
|
||||
ret->op = op;
|
||||
ret->flags = flags;
|
||||
ret->retry = 0;
|
||||
ret->id = 0; /* will be assigned later */
|
||||
ret->subno = 0;
|
||||
ret->min = ret->max = 1;
|
||||
ret->left = NULL;
|
||||
@@ -1770,7 +1802,8 @@ freesrnode(
|
||||
}
|
||||
sr->flags = 0;
|
||||
|
||||
if (v != NULL) {
|
||||
if (v != NULL && v->treechain != NULL) {
|
||||
/* we're still parsing, maybe we can reuse the subre */
|
||||
sr->left = v->treefree;
|
||||
v->treefree = sr;
|
||||
} else {
|
||||
@@ -1798,7 +1831,7 @@ optst(
|
||||
}
|
||||
|
||||
/*
|
||||
- numst - number tree nodes (assigning retry indexes)
|
||||
- numst - number tree nodes (assigning "id" indexes)
|
||||
^ static int numst(struct subre *, int);
|
||||
*/
|
||||
static int /* next number */
|
||||
@@ -1811,7 +1844,7 @@ numst(
|
||||
assert(t != NULL);
|
||||
|
||||
i = start;
|
||||
t->retry = (short) i++;
|
||||
t->id = (short) i++;
|
||||
if (t->left != NULL) {
|
||||
i = numst(t->left, i);
|
||||
}
|
||||
@@ -1823,6 +1856,19 @@ numst(
|
||||
|
||||
/*
|
||||
- markst - mark tree nodes as INUSE
|
||||
* Note: this is a great deal more subtle than it looks. During initial
|
||||
* parsing of a regex, all subres are linked into the treechain list;
|
||||
* discarded ones are also linked into the treefree list for possible reuse.
|
||||
* After we are done creating all subres required for a regex, we run markst()
|
||||
* then cleanst(), which results in discarding all subres not reachable from
|
||||
* v->tree. We then clear v->treechain, indicating that subres must be found
|
||||
* by descending from v->tree. This changes the behavior of freesubre(): it
|
||||
* will henceforth FREE() unwanted subres rather than sticking them into the
|
||||
* treefree list. (Doing that any earlier would result in dangling links in
|
||||
* the treechain list.) This all means that freev() will clean up correctly
|
||||
* if invoked before or after markst()+cleanst(); but it would not work if
|
||||
* called partway through this state conversion, so we mustn't error out
|
||||
* in or between these two functions.
|
||||
^ static void markst(struct subre *);
|
||||
*/
|
||||
static void
|
||||
@@ -1929,24 +1975,26 @@ newlacon(
|
||||
struct state *end,
|
||||
int pos)
|
||||
{
|
||||
struct subre *sub;
|
||||
int n;
|
||||
struct subre *newlacons;
|
||||
struct subre *sub;
|
||||
|
||||
if (v->nlacons == 0) {
|
||||
v->lacons = (struct subre *) MALLOC(2 * sizeof(struct subre));
|
||||
n = 1; /* skip 0th */
|
||||
v->nlacons = 2;
|
||||
newlacons = (struct subre *) MALLOC(2 * sizeof(struct subre));
|
||||
} else {
|
||||
v->lacons = (struct subre *) REALLOC(v->lacons,
|
||||
(v->nlacons+1)*sizeof(struct subre));
|
||||
n = v->nlacons++;
|
||||
n = v->nlacons;
|
||||
newlacons = (struct subre *) REALLOC(v->lacons,
|
||||
(n + 1) * sizeof(struct subre));
|
||||
}
|
||||
|
||||
if (v->lacons == NULL) {
|
||||
if (newlacons == NULL) {
|
||||
ERR(REG_ESPACE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
v->lacons = newlacons;
|
||||
v->nlacons = n + 1;
|
||||
sub = &v->lacons[n];
|
||||
sub->begin = begin;
|
||||
sub->end = end;
|
||||
@@ -1994,18 +2042,20 @@ rfree(
|
||||
g = (struct guts *) re->re_guts;
|
||||
re->re_guts = NULL;
|
||||
re->re_fns = NULL;
|
||||
g->magic = 0;
|
||||
freecm(&g->cmap);
|
||||
if (g->tree != NULL) {
|
||||
freesubre(NULL, g->tree);
|
||||
if (g != NULL) {
|
||||
g->magic = 0;
|
||||
freecm(&g->cmap);
|
||||
if (g->tree != NULL) {
|
||||
freesubre(NULL, g->tree);
|
||||
}
|
||||
if (g->lacons != NULL) {
|
||||
freelacons(g->lacons, g->nlacons);
|
||||
}
|
||||
if (!NULLCNFA(g->search)) {
|
||||
freecnfa(&g->search);
|
||||
}
|
||||
FREE(g);
|
||||
}
|
||||
if (g->lacons != NULL) {
|
||||
freelacons(g->lacons, g->nlacons);
|
||||
}
|
||||
if (!NULLCNFA(g->search)) {
|
||||
freecnfa(&g->search);
|
||||
}
|
||||
FREE(g);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2037,11 +2087,11 @@ dump(
|
||||
|
||||
fprintf(f, "\n\n\n========= DUMP ==========\n");
|
||||
fprintf(f, "nsub %d, info 0%lo, csize %d, ntree %d\n",
|
||||
re->re_nsub, re->re_info, re->re_csize, g->ntree);
|
||||
(int) re->re_nsub, re->re_info, re->re_csize, g->ntree);
|
||||
|
||||
dumpcolors(&g->cmap, f);
|
||||
if (!NULLCNFA(g->search)) {
|
||||
printf("\nsearch:\n");
|
||||
fprintf(f, "\nsearch:\n");
|
||||
dumpcnfa(&g->search, f);
|
||||
}
|
||||
for (i = 1; i < g->nlacons; i++) {
|
||||
@@ -2108,7 +2158,7 @@ stdump(
|
||||
}
|
||||
if (t->min != 1 || t->max != 1) {
|
||||
fprintf(f, " {%d,", t->min);
|
||||
if (t->max != INFINITY) {
|
||||
if (t->max != DUPINF) {
|
||||
fprintf(f, "%d", t->max);
|
||||
}
|
||||
fprintf(f, "}");
|
||||
@@ -2146,14 +2196,14 @@ stid(
|
||||
size_t bufsize)
|
||||
{
|
||||
/*
|
||||
* Big enough for hex int or decimal t->retry?
|
||||
* Big enough for hex int or decimal t->id?
|
||||
*/
|
||||
|
||||
if (bufsize < sizeof(void*)*2 + 3 || bufsize < sizeof(t->retry)*3 + 1) {
|
||||
if (bufsize < sizeof(void*)*2 + 3 || bufsize < sizeof(t->id)*3 + 1) {
|
||||
return "unable";
|
||||
}
|
||||
if (t->retry != 0) {
|
||||
sprintf(buf, "%d", t->retry);
|
||||
if (t->id != 0) {
|
||||
sprintf(buf, "%d", t->id);
|
||||
} else {
|
||||
sprintf(buf, "%p", t);
|
||||
}
|
||||
|
||||
@@ -60,12 +60,6 @@
|
||||
#ifdef __REG_REGOFF_T
|
||||
#undef __REG_REGOFF_T
|
||||
#endif
|
||||
#ifdef __REG_VOID_T
|
||||
#undef __REG_VOID_T
|
||||
#endif
|
||||
#ifdef __REG_CONST
|
||||
#undef __REG_CONST
|
||||
#endif
|
||||
#ifdef __REG_NOFRONT
|
||||
#undef __REG_NOFRONT
|
||||
#endif
|
||||
@@ -75,8 +69,6 @@
|
||||
/* Interface types */
|
||||
#define __REG_WIDE_T Tcl_UniChar
|
||||
#define __REG_REGOFF_T long /* Not really right, but good enough... */
|
||||
#define __REG_VOID_T void
|
||||
#define __REG_CONST const
|
||||
/* Names and declarations */
|
||||
#define __REG_WIDE_COMPILE TclReComp
|
||||
#define __REG_WIDE_EXEC TclReExec
|
||||
|
||||
+15
-14
@@ -84,7 +84,7 @@ longest(
|
||||
|
||||
if (v->eflags®_FTRACE) {
|
||||
while (cp < realstop) {
|
||||
FDEBUG(("+++ at c%d +++\n", css - d->ssets));
|
||||
FDEBUG(("+++ at c%d +++\n", (int) (css - d->ssets)));
|
||||
co = GETCOLOR(cm, *cp);
|
||||
FDEBUG(("char %c, color %ld\n", (char)*cp, (long)co));
|
||||
ss = css->outs[co];
|
||||
@@ -118,7 +118,7 @@ longest(
|
||||
* Shutdown.
|
||||
*/
|
||||
|
||||
FDEBUG(("+++ shutdown at c%d +++\n", css - d->ssets));
|
||||
FDEBUG(("+++ shutdown at c%d +++\n", (int) (css - d->ssets)));
|
||||
if (cp == v->stop && stop == v->stop) {
|
||||
if (hitstopp != NULL) {
|
||||
*hitstopp = 1;
|
||||
@@ -213,7 +213,7 @@ shortest(
|
||||
|
||||
if (v->eflags®_FTRACE) {
|
||||
while (cp < realmax) {
|
||||
FDEBUG(("--- at c%d ---\n", css - d->ssets));
|
||||
FDEBUG(("--- at c%d ---\n", (int) (css - d->ssets)));
|
||||
co = GETCOLOR(cm, *cp);
|
||||
FDEBUG(("char %c, color %ld\n", (char)*cp, (long)co));
|
||||
ss = css->outs[co];
|
||||
@@ -516,14 +516,14 @@ miss(
|
||||
gotState = 0;
|
||||
for (i = 0; i < d->nstates; i++) {
|
||||
if (ISBSET(css->states, i)) {
|
||||
for (ca = cnfa->states[i]+1; ca->co != COLORLESS; ca++) {
|
||||
for (ca = cnfa->states[i]; ca->co != COLORLESS; ca++) {
|
||||
if (ca->co == co) {
|
||||
BSET(d->work, ca->to);
|
||||
gotState = 1;
|
||||
if (ca->to == cnfa->post) {
|
||||
isPost = 1;
|
||||
}
|
||||
if (!cnfa->states[ca->to]->co) {
|
||||
if (!(cnfa->stflags[ca->to] & CNFA_NOPROGRESS)) {
|
||||
noProgress = 0;
|
||||
}
|
||||
FDEBUG(("%d -> %d\n", i, ca->to));
|
||||
@@ -537,8 +537,8 @@ miss(
|
||||
doLAConstraints = 0;
|
||||
for (i = 0; i < d->nstates; i++) {
|
||||
if (ISBSET(d->work, i)) {
|
||||
for (ca = cnfa->states[i]+1; ca->co != COLORLESS; ca++) {
|
||||
if (ca->co <= cnfa->ncolors) {
|
||||
for (ca = cnfa->states[i]; ca->co != COLORLESS; ca++) {
|
||||
if (ca->co < cnfa->ncolors) {
|
||||
continue; /* NOTE CONTINUE */
|
||||
}
|
||||
sawLAConstraints = 1;
|
||||
@@ -553,7 +553,7 @@ miss(
|
||||
if (ca->to == cnfa->post) {
|
||||
isPost = 1;
|
||||
}
|
||||
if (!cnfa->states[ca->to]->co) {
|
||||
if (!(cnfa->stflags[ca->to] & CNFA_NOPROGRESS)) {
|
||||
noProgress = 0;
|
||||
}
|
||||
FDEBUG(("%d :> %d\n", i, ca->to));
|
||||
@@ -572,7 +572,7 @@ miss(
|
||||
|
||||
for (p = d->ssets, i = d->nssused; i > 0; p++, i--) {
|
||||
if (HIT(h, d->work, p, d->wordsper)) {
|
||||
FDEBUG(("cached c%d\n", p - d->ssets));
|
||||
FDEBUG(("cached c%d\n", (int) (p - d->ssets)));
|
||||
break; /* NOTE BREAK OUT */
|
||||
}
|
||||
}
|
||||
@@ -594,7 +594,8 @@ miss(
|
||||
}
|
||||
|
||||
if (!sawLAConstraints) { /* lookahead conds. always cache miss */
|
||||
FDEBUG(("c%d[%d]->c%d\n", css - d->ssets, co, p - d->ssets));
|
||||
FDEBUG(("c%d[%d]->c%d\n",
|
||||
(int) (css - d->ssets), co, (int) (p - d->ssets)));
|
||||
css->outs[co] = p;
|
||||
css->inchain[co] = p->ins;
|
||||
p->ins.ss = css;
|
||||
@@ -663,7 +664,7 @@ getVacantSS(
|
||||
ap = ss->ins;
|
||||
while ((p = ap.ss) != NULL) {
|
||||
co = ap.co;
|
||||
FDEBUG(("zapping c%d's %ld outarc\n", p - d->ssets, (long)co));
|
||||
FDEBUG(("zapping c%d's %ld outarc\n", (int) (p - d->ssets), (long)co));
|
||||
p->outs[co] = NULL;
|
||||
ap = p->inchain[co];
|
||||
p->inchain[co].ss = NULL; /* paranoia */
|
||||
@@ -680,7 +681,7 @@ getVacantSS(
|
||||
if (p == NULL) {
|
||||
continue; /* NOTE CONTINUE */
|
||||
}
|
||||
FDEBUG(("del outarc %d from c%d's in chn\n", i, p - d->ssets));
|
||||
FDEBUG(("del outarc %d from c%d's in chn\n", i, (int) (p - d->ssets)));
|
||||
if (p->ins.ss == ss && p->ins.co == i) {
|
||||
p->ins = ss->inchain[i];
|
||||
} else {
|
||||
@@ -772,7 +773,7 @@ pickNextSS(
|
||||
if ((ss->lastseen == NULL || ss->lastseen < ancient)
|
||||
&& !(ss->flags&LOCKED)) {
|
||||
d->search = ss + 1;
|
||||
FDEBUG(("replacing c%d\n", ss - d->ssets));
|
||||
FDEBUG(("replacing c%d\n", (int) (ss - d->ssets)));
|
||||
return ss;
|
||||
}
|
||||
}
|
||||
@@ -780,7 +781,7 @@ pickNextSS(
|
||||
if ((ss->lastseen == NULL || ss->lastseen < ancient)
|
||||
&& !(ss->flags&LOCKED)) {
|
||||
d->search = ss + 1;
|
||||
FDEBUG(("replacing c%d\n", ss - d->ssets));
|
||||
FDEBUG(("replacing c%d\n", (int) (ss - d->ssets)));
|
||||
return ss;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -41,7 +41,7 @@ static const char unk[] = "*** unknown regex error code 0x%x ***";
|
||||
* Struct to map among codes, code names, and explanations.
|
||||
*/
|
||||
|
||||
static struct rerr {
|
||||
static const struct rerr {
|
||||
int code;
|
||||
const char *name;
|
||||
const char *explain;
|
||||
@@ -62,7 +62,7 @@ regerror(
|
||||
char *errbuf, /* Result buffer (unless errbuf_size==0) */
|
||||
size_t errbuf_size) /* Available space in errbuf, can be 0 */
|
||||
{
|
||||
struct rerr *r;
|
||||
const struct rerr *r;
|
||||
const char *msg;
|
||||
char convbuf[sizeof(unk)+50]; /* 50 = plenty for int */
|
||||
size_t len;
|
||||
|
||||
+1
-1
@@ -16,5 +16,5 @@
|
||||
{ REG_INVARG, "REG_INVARG", "invalid argument to regex function" },
|
||||
{ REG_MIXED, "REG_MIXED", "character widths of regex and string differ" },
|
||||
{ REG_BADOPT, "REG_BADOPT", "invalid embedded option" },
|
||||
{ REG_ETOOBIG, "REG_ETOOBIG", "nfa has too many states" },
|
||||
{ REG_ETOOBIG, "REG_ETOOBIG", "regular expression is too complex" },
|
||||
{ REG_ECOLORS, "REG_ECOLORS", "too many colors" },
|
||||
|
||||
+17
-45
@@ -92,12 +92,6 @@ extern "C" {
|
||||
#ifdef __REG_REGOFF_T
|
||||
#undef __REG_REGOFF_T
|
||||
#endif
|
||||
#ifdef __REG_VOID_T
|
||||
#undef __REG_VOID_T
|
||||
#endif
|
||||
#ifdef __REG_CONST
|
||||
#undef __REG_CONST
|
||||
#endif
|
||||
#ifdef __REG_NOFRONT
|
||||
#undef __REG_NOFRONT
|
||||
#endif
|
||||
@@ -107,8 +101,6 @@ extern "C" {
|
||||
/* interface types */
|
||||
#define __REG_WIDE_T Tcl_UniChar
|
||||
#define __REG_REGOFF_T long /* not really right, but good enough... */
|
||||
#define __REG_VOID_T void
|
||||
#define __REG_CONST const
|
||||
/* names and declarations */
|
||||
#define __REG_WIDE_COMPILE TclReComp
|
||||
#define __REG_WIDE_EXEC TclReExec
|
||||
@@ -133,26 +125,6 @@ typedef __REG_REGOFF_T regoff_t;
|
||||
typedef long regoff_t;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* For benefit of old compilers, we offer <sys/types.h> the option of
|
||||
* overriding the `void' type used to declare nonexistent return types.
|
||||
*/
|
||||
#ifdef __REG_VOID_T
|
||||
typedef __REG_VOID_T re_void;
|
||||
#else
|
||||
typedef void re_void;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Also for benefit of old compilers, <sys/types.h> can supply a macro which
|
||||
* expands to a substitute for `const'.
|
||||
*/
|
||||
#ifndef __REG_CONST
|
||||
#define __REG_CONST const
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* other interface types
|
||||
*/
|
||||
@@ -197,13 +169,13 @@ typedef struct {
|
||||
/*
|
||||
* compilation
|
||||
^ #ifndef __REG_NOCHAR
|
||||
^ int re_comp(regex_t *, __REG_CONST char *, size_t, int);
|
||||
^ int re_comp(regex_t *, const char *, size_t, int);
|
||||
^ #endif
|
||||
^ #ifndef __REG_NOFRONT
|
||||
^ int regcomp(regex_t *, __REG_CONST char *, int);
|
||||
^ int regcomp(regex_t *, const char *, int);
|
||||
^ #endif
|
||||
^ #ifdef __REG_WIDE_T
|
||||
^ int __REG_WIDE_COMPILE(regex_t *, __REG_CONST __REG_WIDE_T *, size_t, int);
|
||||
^ int __REG_WIDE_COMPILE(regex_t *, const __REG_WIDE_T *, size_t, int);
|
||||
^ #endif
|
||||
*/
|
||||
#define REG_BASIC 000000 /* BREs (convenience) */
|
||||
@@ -228,14 +200,14 @@ typedef struct {
|
||||
/*
|
||||
* execution
|
||||
^ #ifndef __REG_NOCHAR
|
||||
^ int re_exec(regex_t *, __REG_CONST char *, size_t,
|
||||
^ int re_exec(regex_t *, const char *, size_t,
|
||||
^ rm_detail_t *, size_t, regmatch_t [], int);
|
||||
^ #endif
|
||||
^ #ifndef __REG_NOFRONT
|
||||
^ int regexec(regex_t *, __REG_CONST char *, size_t, regmatch_t [], int);
|
||||
^ int regexec(regex_t *, const char *, size_t, regmatch_t [], int);
|
||||
^ #endif
|
||||
^ #ifdef __REG_WIDE_T
|
||||
^ int __REG_WIDE_EXEC(regex_t *, __REG_CONST __REG_WIDE_T *, size_t,
|
||||
^ int __REG_WIDE_EXEC(regex_t *, const __REG_WIDE_T *, size_t,
|
||||
^ rm_detail_t *, size_t, regmatch_t [], int);
|
||||
^ #endif
|
||||
*/
|
||||
@@ -248,7 +220,7 @@ typedef struct {
|
||||
|
||||
/*
|
||||
* misc generics (may be more functions here eventually)
|
||||
^ re_void regfree(regex_t *);
|
||||
^ void regfree(regex_t *);
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -260,7 +232,7 @@ typedef struct {
|
||||
* of character is used for error reports is independent of what kind is used
|
||||
* in matching.
|
||||
*
|
||||
^ extern size_t regerror(int, __REG_CONST regex_t *, char *, size_t);
|
||||
^ extern size_t regerror(int, const regex_t *, char *, size_t);
|
||||
*/
|
||||
#define REG_OKAY 0 /* no errors detected */
|
||||
#define REG_NOMATCH 1 /* failed to match */
|
||||
@@ -280,7 +252,7 @@ typedef struct {
|
||||
#define REG_INVARG 16 /* invalid argument to regex function */
|
||||
#define REG_MIXED 17 /* character widths of regex and string differ */
|
||||
#define REG_BADOPT 18 /* invalid embedded option */
|
||||
#define REG_ETOOBIG 19 /* nfa has too many states */
|
||||
#define REG_ETOOBIG 19 /* regular expression is too complex */
|
||||
#define REG_ECOLORS 20 /* too many colors */
|
||||
/* two specials for debugging and testing */
|
||||
#define REG_ATOI 101 /* convert error-code name to number */
|
||||
@@ -293,25 +265,25 @@ typedef struct {
|
||||
/* automatically gathered by fwd; do not hand-edit */
|
||||
/* === regproto.h === */
|
||||
#ifndef __REG_NOCHAR
|
||||
int re_comp(regex_t *, __REG_CONST char *, size_t, int);
|
||||
int re_comp(regex_t *, const char *, size_t, int);
|
||||
#endif
|
||||
#ifndef __REG_NOFRONT
|
||||
int regcomp(regex_t *, __REG_CONST char *, int);
|
||||
int regcomp(regex_t *, const char *, int);
|
||||
#endif
|
||||
#ifdef __REG_WIDE_T
|
||||
MODULE_SCOPE int __REG_WIDE_COMPILE(regex_t *, __REG_CONST __REG_WIDE_T *, size_t, int);
|
||||
MODULE_SCOPE int __REG_WIDE_COMPILE(regex_t *, const __REG_WIDE_T *, size_t, int);
|
||||
#endif
|
||||
#ifndef __REG_NOCHAR
|
||||
int re_exec(regex_t *, __REG_CONST char *, size_t, rm_detail_t *, size_t, regmatch_t [], int);
|
||||
int re_exec(regex_t *, const char *, size_t, rm_detail_t *, size_t, regmatch_t [], int);
|
||||
#endif
|
||||
#ifndef __REG_NOFRONT
|
||||
int regexec(regex_t *, __REG_CONST char *, size_t, regmatch_t [], int);
|
||||
int regexec(regex_t *, const char *, size_t, regmatch_t [], int);
|
||||
#endif
|
||||
#ifdef __REG_WIDE_T
|
||||
MODULE_SCOPE int __REG_WIDE_EXEC(regex_t *, __REG_CONST __REG_WIDE_T *, size_t, rm_detail_t *, size_t, regmatch_t [], int);
|
||||
MODULE_SCOPE int __REG_WIDE_EXEC(regex_t *, const __REG_WIDE_T *, size_t, rm_detail_t *, size_t, regmatch_t [], int);
|
||||
#endif
|
||||
MODULE_SCOPE re_void regfree(regex_t *);
|
||||
MODULE_SCOPE size_t regerror(int, __REG_CONST regex_t *, char *, size_t);
|
||||
MODULE_SCOPE void regfree(regex_t *);
|
||||
MODULE_SCOPE size_t regerror(int, const regex_t *, char *, size_t);
|
||||
/* automatically gathered by fwd; do not hand-edit */
|
||||
/* =====^!^===== end forwards =====^!^===== */
|
||||
|
||||
|
||||
+588
-471
File diff suppressed because it is too large
Load Diff
+61
-20
@@ -99,7 +99,7 @@
|
||||
#define xxx 1
|
||||
|
||||
#define DUPMAX _POSIX2_RE_DUP_MAX
|
||||
#define INFINITY (DUPMAX+1)
|
||||
#define DUPINF (DUPMAX+1)
|
||||
|
||||
#define REMAGIC 0xfed7 /* magic number for main struct */
|
||||
|
||||
@@ -186,7 +186,14 @@ struct colordesc {
|
||||
union tree *block; /* block of solid color, if any */
|
||||
};
|
||||
|
||||
/* the color map itself */
|
||||
/*
|
||||
* The color map itself
|
||||
*
|
||||
* Much of the data in the colormap struct is only used at compile time.
|
||||
* However, the bulk of the space usage is in the "tree" structure, so it's
|
||||
* not clear that there's much point in converting the rest to a more compact
|
||||
* form when compilation is finished.
|
||||
*/
|
||||
struct colormap {
|
||||
int magic;
|
||||
#define CMMAGIC 0x876
|
||||
@@ -242,14 +249,15 @@ struct cvec {
|
||||
struct state;
|
||||
|
||||
struct arc {
|
||||
int type;
|
||||
#define ARCFREE '\0'
|
||||
int type; /* 0 if free, else an NFA arc type code */
|
||||
color co;
|
||||
struct state *from; /* where it's from (and contained within) */
|
||||
struct state *to; /* where it's to */
|
||||
struct arc *outchain; /* *from's outs chain or free chain */
|
||||
#define freechain outchain
|
||||
struct arc *outchain; /* link in *from's outs chain or free chain */
|
||||
struct arc *outchainRev; /* back-link in *from's outs chain */
|
||||
#define freechain outchain /* we do not maintain "freechainRev" */
|
||||
struct arc *inchain; /* *to's ins chain */
|
||||
struct arc *inchainRev; /* back-link in *to's ins chain */
|
||||
struct arc *colorchain; /* color's arc chain */
|
||||
struct arc *colorchainRev; /* back-link in color's arc chain */
|
||||
};
|
||||
@@ -288,20 +296,28 @@ struct nfa {
|
||||
struct colormap *cm; /* the color map */
|
||||
color bos[2]; /* colors, if any, assigned to BOS and BOL */
|
||||
color eos[2]; /* colors, if any, assigned to EOS and EOL */
|
||||
size_t size; /* Current NFA size; differs from nstates as
|
||||
* it also counts the number of states created
|
||||
* by children of this state. */
|
||||
struct vars *v; /* simplifies compile error reporting */
|
||||
struct nfa *parent; /* parent NFA, if any */
|
||||
};
|
||||
|
||||
/*
|
||||
* definitions for compacted NFA
|
||||
*
|
||||
* The main space savings in a compacted NFA is from making the arcs as small
|
||||
* as possible. We store only the transition color and next-state number for
|
||||
* each arc. The list of out arcs for each state is an array beginning at
|
||||
* cnfa.states[statenumber], and terminated by a dummy carc struct with
|
||||
* co == COLORLESS.
|
||||
*
|
||||
* The non-dummy carc structs are of two types: plain arcs and LACON arcs.
|
||||
* Plain arcs just store the transition color number as "co". LACON arcs
|
||||
* store the lookahead constraint number plus cnfa.ncolors as "co". LACON
|
||||
* arcs can be distinguished from plain by testing for co >= cnfa.ncolors.
|
||||
*/
|
||||
|
||||
struct carc {
|
||||
color co; /* COLORLESS is list terminator */
|
||||
int to; /* state number */
|
||||
int to; /* next-state number */
|
||||
};
|
||||
|
||||
struct cnfa {
|
||||
@@ -313,27 +329,52 @@ struct cnfa {
|
||||
int post; /* teardown state number */
|
||||
color bos[2]; /* colors, if any, assigned to BOS and BOL */
|
||||
color eos[2]; /* colors, if any, assigned to EOS and EOL */
|
||||
char *stflags; /* vector of per-state flags bytes */
|
||||
#define CNFA_NOPROGRESS 01 /* flag bit for a no-progress state */
|
||||
struct carc **states; /* vector of pointers to outarc lists */
|
||||
/* states[n] are pointers into a single malloc'd array of arcs */
|
||||
struct carc *arcs; /* the area for the lists */
|
||||
};
|
||||
#define ZAPCNFA(cnfa) ((cnfa).nstates = 0)
|
||||
#define NULLCNFA(cnfa) ((cnfa).nstates == 0)
|
||||
|
||||
/*
|
||||
* Used to limit the maximum NFA size to something sane. [Bug 1810264]
|
||||
* This symbol limits the transient heap space used by the regex compiler,
|
||||
* and thereby also the maximum complexity of NFAs that we'll deal with.
|
||||
* Currently we only count NFA states and arcs against this; the other
|
||||
* transient data is generally not large enough to notice compared to those.
|
||||
* Note that we do not charge anything for the final output data structures
|
||||
* (the compacted NFA and the colormap).
|
||||
*/
|
||||
|
||||
#ifndef REG_MAX_STATES
|
||||
# define REG_MAX_STATES 100000
|
||||
#ifndef REG_MAX_COMPILE_SPACE
|
||||
#define REG_MAX_COMPILE_SPACE \
|
||||
(100000 * sizeof(struct state) + 100000 * sizeof(struct arcbatch))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* subexpression tree
|
||||
*
|
||||
* "op" is one of:
|
||||
* '=' plain regex without interesting substructure (implemented as DFA)
|
||||
* 'b' back-reference (has no substructure either)
|
||||
* '(' capture node: captures the match of its single child
|
||||
* '.' concatenation: matches a match for left, then a match for right
|
||||
* '|' alternation: matches a match for left or a match for right
|
||||
* '*' iteration: matches some number of matches of its single child
|
||||
*
|
||||
* Note: the right child of an alternation must be another alternation or
|
||||
* NULL; hence, an N-way branch requires N alternation nodes, not N-1 as you
|
||||
* might expect. This could stand to be changed. Actually I'd rather see
|
||||
* a single alternation node with N children, but that will take revising
|
||||
* the representation of struct subre.
|
||||
*
|
||||
* Note: when a backref is directly quantified, we stick the min/max counts
|
||||
* into the backref rather than plastering an iteration node on top. This is
|
||||
* for efficiency: there is no need to search for possible division points.
|
||||
*/
|
||||
|
||||
struct subre {
|
||||
char op; /* '|', '.' (concat), 'b' (backref), '(',
|
||||
* '=' */
|
||||
char op; /* see type codes above */
|
||||
char flags;
|
||||
#define LONGER 01 /* prefers longer match */
|
||||
#define SHORTER 02 /* prefers shorter match */
|
||||
@@ -349,10 +390,10 @@ struct subre {
|
||||
#define PREF(f) ((f)&NOPROP)
|
||||
#define PREF2(f1, f2) ((PREF(f1) != 0) ? PREF(f1) : PREF(f2))
|
||||
#define COMBINE(f1, f2) (UP((f1)|(f2)) | PREF2(f1, f2))
|
||||
short retry; /* index into retry memory */
|
||||
short id; /* ID of subre (1..ntree-1) */
|
||||
int subno; /* subexpression number (for 'b' and '(') */
|
||||
short min; /* min repetitions, for backref only */
|
||||
short max; /* max repetitions, for backref only */
|
||||
short min; /* min repetitions for iteration or backref */
|
||||
short max; /* max repetitions for iteration or backref */
|
||||
struct subre *left; /* left child, if any (also freelist chain) */
|
||||
struct subre *right; /* right child, if any */
|
||||
struct state *begin; /* outarcs from here... */
|
||||
@@ -382,7 +423,7 @@ struct guts {
|
||||
size_t nsub; /* copy of re_nsub */
|
||||
struct subre *tree;
|
||||
struct cnfa search; /* for fast preliminary search */
|
||||
int ntree;
|
||||
int ntree; /* number of subre's, plus one */
|
||||
struct colormap cmap;
|
||||
int FUNCPTR(compare, (const chr *, const chr *, size_t));
|
||||
struct subre *lacons; /* lookahead-constraint vector */
|
||||
|
||||
+7
-12
@@ -2,8 +2,8 @@
|
||||
#
|
||||
# This file contains the declarations for all supported public
|
||||
# functions that are exported by the Tcl library via the stubs table.
|
||||
# This file is used to generate the tclDecls.h, tclPlatDecls.h,
|
||||
# tclStub.c, and tclPlatStub.c files.
|
||||
# This file is used to generate the tclDecls.h, tclPlatDecls.h
|
||||
# and tclStubInit.c files.
|
||||
#
|
||||
# Copyright (c) 1998-1999 by Scriptics Corporation.
|
||||
# Copyright (c) 2001, 2002 by Kevin B. Kenny. All rights reserved.
|
||||
@@ -37,7 +37,7 @@ declare 1 {
|
||||
void *clientDataPtr)
|
||||
}
|
||||
declare 2 {
|
||||
void Tcl_Panic(const char *format, ...)
|
||||
TCL_NORETURN void Tcl_Panic(const char *format, ...)
|
||||
}
|
||||
declare 3 {
|
||||
char *Tcl_Alloc(unsigned int size)
|
||||
@@ -480,7 +480,7 @@ declare 132 {
|
||||
void Tcl_EventuallyFree(ClientData clientData, Tcl_FreeProc *freeProc)
|
||||
}
|
||||
declare 133 {
|
||||
void Tcl_Exit(int status)
|
||||
TCL_NORETURN void Tcl_Exit(int status)
|
||||
}
|
||||
declare 134 {
|
||||
int Tcl_ExposeCommand(Tcl_Interp *interp, const char *hiddenCmdToken,
|
||||
@@ -815,7 +815,7 @@ declare 229 {
|
||||
void Tcl_SetMaxBlockTime(const Tcl_Time *timePtr)
|
||||
}
|
||||
declare 230 {
|
||||
void Tcl_SetPanicProc(Tcl_PanicProc *panicProc)
|
||||
void Tcl_SetPanicProc(TCL_NORETURN1 Tcl_PanicProc *panicProc)
|
||||
}
|
||||
declare 231 {
|
||||
int Tcl_SetRecursionLimit(Tcl_Interp *interp, int depth)
|
||||
@@ -986,7 +986,7 @@ declare 277 {
|
||||
Tcl_Pid Tcl_WaitPid(Tcl_Pid pid, int *statPtr, int options)
|
||||
}
|
||||
declare 278 {
|
||||
void Tcl_PanicVA(const char *format, va_list argList)
|
||||
TCL_NORETURN void Tcl_PanicVA(const char *format, va_list argList)
|
||||
}
|
||||
declare 279 {
|
||||
void Tcl_GetVersion(int *major, int *minor, int *patchLevel, int *type)
|
||||
@@ -1872,7 +1872,7 @@ declare 518 {
|
||||
|
||||
# TIP#121 (exit handler) dkf for Joe Mistachkin
|
||||
declare 519 {
|
||||
Tcl_ExitProc *Tcl_SetExitProc(Tcl_ExitProc *proc)
|
||||
Tcl_ExitProc *Tcl_SetExitProc(TCL_NORETURN1 Tcl_ExitProc *proc)
|
||||
}
|
||||
|
||||
# TIP#143 (resource limits) dkf
|
||||
@@ -2326,11 +2326,6 @@ declare 630 {
|
||||
|
||||
# ----- BASELINE -- FOR -- 8.6.0 ----- #
|
||||
|
||||
# ZipVfs
|
||||
declare 631 {
|
||||
int Tcl_Zvfs_Boot(Tcl_Interp *interp)
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
|
||||
# Define the platform specific public Tcl interface. These functions are only
|
||||
|
||||
+65
-33
@@ -9,6 +9,7 @@
|
||||
* Copyright (c) 1994-1998 Sun Microsystems, Inc.
|
||||
* Copyright (c) 1998-2000 by Scriptics Corporation.
|
||||
* Copyright (c) 2002 by Kevin B. Kenny. All rights reserved.
|
||||
* Copyright (c) 2007 BitMover, Inc.
|
||||
*
|
||||
* See the file "license.terms" for information on usage and redistribution of
|
||||
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
@@ -56,10 +57,10 @@ extern "C" {
|
||||
#define TCL_MAJOR_VERSION 8
|
||||
#define TCL_MINOR_VERSION 6
|
||||
#define TCL_RELEASE_LEVEL TCL_FINAL_RELEASE
|
||||
#define TCL_RELEASE_SERIAL 2
|
||||
#define TCL_RELEASE_SERIAL 5
|
||||
|
||||
#define TCL_VERSION "8.6"
|
||||
#define TCL_PATCH_LEVEL "8.6.2"
|
||||
#define TCL_PATCH_LEVEL "8.6.5"
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------------
|
||||
@@ -76,16 +77,6 @@ extern "C" {
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* STRICT: See MSDN Article Q83456
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
# ifndef STRICT
|
||||
# define STRICT
|
||||
# endif
|
||||
#endif /* _WIN32 */
|
||||
|
||||
/*
|
||||
* Utility macros: STRINGIFY takes an argument and wraps it in "" (double
|
||||
* quotation marks), JOIN joins two arguments.
|
||||
@@ -153,8 +144,20 @@ extern "C" {
|
||||
#endif
|
||||
#if defined(__GNUC__) && (__GNUC__ > 2)
|
||||
# define TCL_FORMAT_PRINTF(a,b) __attribute__ ((__format__ (__printf__, a, b)))
|
||||
# define TCL_NORETURN __attribute__ ((noreturn))
|
||||
# if defined(BUILD_tcl) || defined(BUILD_tk)
|
||||
# define TCL_NORETURN1 __attribute__ ((noreturn))
|
||||
# else
|
||||
# define TCL_NORETURN1 /* nothing */
|
||||
# endif
|
||||
#else
|
||||
# define TCL_FORMAT_PRINTF(a,b)
|
||||
# if defined(_MSC_VER) && (_MSC_VER >= 1310)
|
||||
# define TCL_NORETURN _declspec(noreturn)
|
||||
# else
|
||||
# define TCL_NORETURN /* nothing */
|
||||
# endif
|
||||
# define TCL_NORETURN1 /* nothing */
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -402,16 +405,12 @@ typedef long LONG;
|
||||
* Don't know what platform it is and configure hasn't discovered what is
|
||||
* going on for us. Try to guess...
|
||||
*/
|
||||
# ifdef NO_LIMITS_H
|
||||
# error please define either TCL_WIDE_INT_TYPE or TCL_WIDE_INT_IS_LONG
|
||||
# else /* !NO_LIMITS_H */
|
||||
# include <limits.h>
|
||||
# if (INT_MAX < LONG_MAX)
|
||||
# define TCL_WIDE_INT_IS_LONG 1
|
||||
# else
|
||||
# define TCL_WIDE_INT_TYPE long long
|
||||
# endif
|
||||
# endif /* NO_LIMITS_H */
|
||||
# include <limits.h>
|
||||
# if (INT_MAX < LONG_MAX)
|
||||
# define TCL_WIDE_INT_IS_LONG 1
|
||||
# else
|
||||
# define TCL_WIDE_INT_TYPE long long
|
||||
# endif
|
||||
# endif /* _WIN32 */
|
||||
#endif /* !TCL_WIDE_INT_TYPE & !TCL_WIDE_INT_IS_LONG */
|
||||
#ifdef TCL_WIDE_INT_IS_LONG
|
||||
@@ -613,6 +612,10 @@ typedef void (Tcl_ThreadCreateProc) (ClientData clientData);
|
||||
#define TCL_REG_NEWLINE 000300 /* Newlines are line terminators. */
|
||||
#define TCL_REG_CANMATCH 001000 /* Report details on partial/limited
|
||||
* matches. */
|
||||
#define TCL_REG_BYTEOFFSET 002000 /* Use byte offsets instead of
|
||||
character offsets. */
|
||||
#define TCL_REG_PCRE 0x08000000 /* Make sure it doesn't conflict with
|
||||
* existing TCL_REG_* or PCRE_* bits */
|
||||
|
||||
/*
|
||||
* Flags values passed to Tcl_RegExpExecObj.
|
||||
@@ -809,7 +812,16 @@ typedef struct Tcl_ObjType {
|
||||
*/
|
||||
|
||||
typedef struct Tcl_Obj {
|
||||
int refCount; /* When 0 the object will be freed. */
|
||||
#ifndef TCL_MEM_DEBUG
|
||||
unsigned int undef:1; /* Used by L to mark an object as having
|
||||
* the undef value. Steal a bit from
|
||||
* refCount to avoid increasing the
|
||||
* Tcl_Obj memory footprint. */
|
||||
int refCount:31; /* When 0 the object will be freed. */
|
||||
#else
|
||||
int refCount;
|
||||
int undef;
|
||||
#endif
|
||||
char *bytes; /* This points to the first byte of the
|
||||
* object's string representation. The array
|
||||
* must be followed by a null byte (i.e., at
|
||||
@@ -830,18 +842,19 @@ typedef struct Tcl_Obj {
|
||||
union { /* The internal representation: */
|
||||
long longValue; /* - an long integer value. */
|
||||
double doubleValue; /* - a double-precision floating value. */
|
||||
void *otherValuePtr; /* - another, type-specific value. */
|
||||
void *otherValuePtr; /* - another, type-specific value,
|
||||
not used internally any more. */
|
||||
Tcl_WideInt wideValue; /* - a long long value. */
|
||||
struct { /* - internal rep as two pointers. */
|
||||
struct { /* - internal rep as two pointers.
|
||||
* the main use of which is a bignum's
|
||||
* tightly packed fields, where the alloc,
|
||||
* used and signum flags are packed into
|
||||
* ptr2 with everything else hung off ptr1. */
|
||||
void *ptr1;
|
||||
void *ptr2;
|
||||
} twoPtrValue;
|
||||
struct { /* - internal rep as a pointer and a long,
|
||||
* the main use of which is a bignum's
|
||||
* tightly packed fields, where the alloc,
|
||||
* used and signum flags are packed into a
|
||||
* single word with everything else hung
|
||||
* off the pointer. */
|
||||
not used internally any more. */
|
||||
void *ptr;
|
||||
unsigned long value;
|
||||
} ptrAndLongRep;
|
||||
@@ -1998,6 +2011,9 @@ typedef struct Tcl_Token {
|
||||
* literal character prefix "{*}". This word is
|
||||
* marked to be expanded - that is, broken into
|
||||
* words after substitution is complete.
|
||||
* TCL_TOKEN_PRAGMA - This token handles pragma directives that might
|
||||
* switch the parser used. Currently only the L
|
||||
* language is supported.
|
||||
*/
|
||||
|
||||
#define TCL_TOKEN_WORD 1
|
||||
@@ -2009,6 +2025,7 @@ typedef struct Tcl_Token {
|
||||
#define TCL_TOKEN_SUB_EXPR 64
|
||||
#define TCL_TOKEN_OPERATOR 128
|
||||
#define TCL_TOKEN_EXPAND_WORD 256
|
||||
#define TCL_TOKEN_PRAGMA 512
|
||||
|
||||
/*
|
||||
* Parsing error types. On any parsing error, one of these values will be
|
||||
@@ -2144,11 +2161,28 @@ typedef struct Tcl_EncodingType {
|
||||
* substituting one or more "close" characters in
|
||||
* the destination buffer and then continue to
|
||||
* convert the source.
|
||||
* TCL_ENCODING_NO_TERMINATE - If set, Tcl_ExternalToUtf will not append a
|
||||
* terminating NUL byte. Knowing that it will
|
||||
* not need space to do so, it will fill all
|
||||
* dstLen bytes with encoded UTF-8 content, as
|
||||
* other circumstances permit. If clear, the
|
||||
* default behavior is to reserve a byte in
|
||||
* the dst space for NUL termination, and to
|
||||
* append the NUL byte.
|
||||
* TCL_ENCODING_CHAR_LIMIT - If set and dstCharsPtr is not NULL, then
|
||||
* Tcl_ExternalToUtf takes the initial value
|
||||
* of *dstCharsPtr is taken as a limit of the
|
||||
* maximum number of chars to produce in the
|
||||
* encoded UTF-8 content. Otherwise, the
|
||||
* number of chars produced is controlled only
|
||||
* by other limiting factors.
|
||||
*/
|
||||
|
||||
#define TCL_ENCODING_START 0x01
|
||||
#define TCL_ENCODING_END 0x02
|
||||
#define TCL_ENCODING_STOPONERROR 0x04
|
||||
#define TCL_ENCODING_NO_TERMINATE 0x08
|
||||
#define TCL_ENCODING_CHAR_LIMIT 0x10
|
||||
|
||||
/*
|
||||
* The following definitions are the error codes returned by the conversion
|
||||
@@ -2419,9 +2453,7 @@ EXTERN void Tcl_MainEx(int argc, char **argv,
|
||||
Tcl_AppInitProc *appInitProc, Tcl_Interp *interp);
|
||||
EXTERN const char * Tcl_PkgInitStubsCheck(Tcl_Interp *interp,
|
||||
const char *version, int exact);
|
||||
#if defined(TCL_THREADS) && defined(USE_THREAD_ALLOC)
|
||||
EXTERN void Tcl_GetMemoryInfo(Tcl_DString *dsPtr);
|
||||
#endif
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------------
|
||||
@@ -2508,7 +2540,7 @@ EXTERN void Tcl_GetMemoryInfo(Tcl_DString *dsPtr);
|
||||
# define Tcl_DecrRefCount(objPtr) \
|
||||
do { \
|
||||
Tcl_Obj *_objPtr = (objPtr); \
|
||||
if (--(_objPtr)->refCount <= 0) { \
|
||||
if ((_objPtr)->refCount-- <= 1) { \
|
||||
TclFreeObj(_objPtr); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@
|
||||
* until Tcl uses config.h properly.
|
||||
*/
|
||||
|
||||
#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__BORLANDC__)
|
||||
#if defined(_MSC_VER) || defined(__MSVCRT__) || defined(__BORLANDC__)
|
||||
typedef unsigned long caddr_t;
|
||||
#endif
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user