mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-08-08 18:25:13 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
645e30d193 | ||
|
|
6a254321ad | ||
|
|
04b6e11ebb | ||
|
|
c0d9cc4211 | ||
|
|
accea6db68 | ||
|
|
93a1e33a1d | ||
|
|
49e794c553 | ||
|
|
88ba3d332f | ||
|
|
002b9b7d1f | ||
|
|
6563aa9221 | ||
|
|
48c4080d0d | ||
|
|
63400d5d02 | ||
|
|
04c5cba268 | ||
|
|
d7163c0a58 | ||
|
|
db2cc12fd0 | ||
|
|
7e78575709 | ||
|
|
f9a85a156a | ||
|
|
c81bad8950 | ||
|
|
158e69f984 | ||
|
|
211e7860a2 | ||
|
|
e3fbd37fc0 | ||
|
|
a11166dddc | ||
|
|
9ff012ca23 | ||
|
|
3d70dbe593 | ||
|
|
91e1aa523d | ||
|
|
00a6930855 | ||
|
|
6fc82eafd5 | ||
|
|
0755be2ff9 | ||
|
|
b4ebc2134b | ||
|
|
30ad432609 | ||
|
|
1a92955799 | ||
|
|
a319e6a7a3 | ||
|
|
eb9568566a | ||
|
|
d5629ce34a | ||
|
|
c2143a71d6 | ||
|
|
c340180d81 | ||
|
|
c837b82803 | ||
|
|
e601ff27f4 | ||
|
|
c131cbff03 | ||
|
|
50f095c92f | ||
|
|
16cb098b72 | ||
|
|
9742c552f2 | ||
|
|
8434f2222e | ||
|
|
d6eba4239f | ||
|
|
81fe8b23e9 | ||
|
|
02e090934a | ||
|
|
87b7d7bad5 | ||
|
|
cf126971ad | ||
|
|
c896cfc95e | ||
|
|
a447fcd20c | ||
|
|
a861a3390f | ||
|
|
2cf6e61086 | ||
|
|
c8f002c7d3 | ||
|
|
cd08e51eda | ||
|
|
bb0027a9ac | ||
|
|
3325ddc49c | ||
|
|
c6f1a33c06 | ||
|
|
1509d42fcb | ||
|
|
273a74fa89 | ||
|
|
2ed0e35f86 | ||
|
|
217598dadc | ||
|
|
52489d4445 | ||
|
|
e8832397ea | ||
|
|
caf23d249c | ||
|
|
640748eecf | ||
|
|
88bce5a2ef | ||
|
|
1bfb97dba5 | ||
|
|
fc5734fe23 | ||
|
|
3650b4b8dd | ||
|
|
4b3d3a8e46 | ||
|
|
4a2a22f4c0 | ||
|
|
b8df32232a | ||
|
|
a762e609e7 | ||
|
|
12b0043a6d | ||
|
|
5dde258a9e | ||
|
|
a945ec3929 | ||
|
|
7601152fab | ||
|
|
fae437e835 | ||
|
|
1a715ef2fc | ||
|
|
a5d5099417 | ||
|
|
b275314e2d | ||
|
|
c5f5043618 | ||
|
|
2ab9a04ffc | ||
|
|
865b9df14c | ||
|
|
c76e14da4b | ||
|
|
7db2ed2d82 | ||
|
|
3a9e26be57 | ||
|
|
e68e0410ab | ||
|
|
e1a4f3a428 | ||
|
|
536545f3a4 | ||
|
|
8b752b00fd | ||
|
|
613f5e1a89 | ||
|
|
524346a3a3 | ||
|
|
26e0cadc37 | ||
|
|
e68d4575b3 | ||
|
|
bb3f671805 | ||
|
|
88e7e94146 | ||
|
|
1154ccedaf | ||
|
|
97650f4efc | ||
|
|
d257636504 | ||
|
|
ccaf65bc63 | ||
|
|
87675353bf | ||
|
|
ce4ccb4b11 | ||
|
|
bc933ef16d | ||
|
|
53d4308dbb | ||
|
|
574fb2d568 | ||
|
|
05811fd755 | ||
|
|
0e4d575330 | ||
|
|
24c7d80020 | ||
|
|
9222837b27 | ||
|
|
260008e546 | ||
|
|
8a731ca829 | ||
|
|
32e1e0a486 | ||
|
|
e5fb671032 | ||
|
|
c7ca99d4b0 | ||
|
|
df0e7316a9 | ||
|
|
39f4191608 | ||
|
|
d57650a5ff | ||
|
|
5a08f1ce21 | ||
|
|
720623af84 | ||
|
|
fb8135fa99 | ||
|
|
4fa887b790 | ||
|
|
4144248075 | ||
|
|
e0e5bf84b0 | ||
|
|
b5480d74b8 | ||
|
|
676385e29c | ||
|
|
01241d47b4 | ||
|
|
ba29c4ec25 | ||
|
|
e2aaf4c4f9 | ||
|
|
7cca31a2f2 | ||
|
|
60491a948b | ||
|
|
2a10b47aaf | ||
|
|
12bebc0445 | ||
|
|
febef6caec | ||
|
|
9be0c25bf0 | ||
|
|
976e627098 | ||
|
|
3424c3868f | ||
|
|
1ae7286376 | ||
|
|
87542d29a5 | ||
|
|
1a31ed21b1 | ||
|
|
e776192e4f | ||
|
|
5c1180b3c4 | ||
|
|
e317006080 | ||
|
|
253862fd4c | ||
|
|
366eea36d3 | ||
|
|
1ce5149ac8 | ||
|
|
4f25ebb043 | ||
|
|
93b68a0e09 | ||
|
|
7431029172 | ||
|
|
58612f1de0 | ||
|
|
02097d3eab | ||
|
|
f25bfb75aa | ||
|
|
c732d2c6dc | ||
|
|
8c165d891d | ||
|
|
ca98bf5758 | ||
|
|
0bfb02fff7 | ||
|
|
24c0aad7e7 | ||
|
|
5719c1092f | ||
|
|
271efced67 | ||
|
|
abd741b1f6 | ||
|
|
9280d3ef89 | ||
|
|
dafdc66ff0 | ||
|
|
56c4720342 | ||
|
|
1e0bab9276 | ||
|
|
74886d31e7 | ||
|
|
04e6065479 | ||
|
|
10e5b8bd0a | ||
|
|
9801d40c50 | ||
|
|
c026349221 | ||
|
|
9757c359ef | ||
|
|
6b98e4b563 | ||
|
|
ee000ba4fc | ||
|
|
8efe435c05 | ||
|
|
4f6bb8b24b | ||
|
|
1921f1d7a4 | ||
|
|
4515534cd2 | ||
|
|
f958596b44 | ||
|
|
2c5690250c | ||
|
|
592e8d4d01 | ||
|
|
0c15323de7 | ||
|
|
e96c9728da | ||
|
|
75d1fe1611 | ||
|
|
6c35d22c39 | ||
|
|
3420246357 | ||
|
|
1d6412adeb | ||
|
|
4cdb01db9b | ||
|
|
44995b2e39 | ||
|
|
e9955c8373 | ||
|
|
39fd0b540d | ||
|
|
d7215705ee | ||
|
|
5346290247 | ||
|
|
2e04746125 | ||
|
|
9af3fbce7c | ||
|
|
1485e106a4 | ||
|
|
da4160c30a | ||
|
|
f6d0f937fd | ||
|
|
69078d4b3b | ||
|
|
0624954c7e | ||
|
|
5e424082ce | ||
|
|
44536b35c4 | ||
|
|
8b9f2372c7 | ||
|
|
3ae2b51f08 | ||
|
|
2f1afb737f | ||
|
|
e9bca3aded | ||
|
|
86eff18354 | ||
|
|
9411f454b0 | ||
|
|
717be1971f | ||
|
|
efea623135 | ||
|
|
670ddffd5b | ||
|
|
769b430fce | ||
|
|
7067cb3620 | ||
|
|
4a713ec2e3 | ||
|
|
b0e5f19eab | ||
|
|
54049e5db0 | ||
|
|
b408954b40 | ||
|
|
a49aecd528 | ||
|
|
5504898e82 | ||
|
|
4fd2214bc6 | ||
|
|
ec3bc3961d | ||
|
|
78df825093 | ||
|
|
68cd8af38b | ||
|
|
660bc8dd09 | ||
|
|
c0c9ea051b | ||
|
|
6390a83f8b | ||
|
|
db7c8e9a72 | ||
|
|
158c687b65 | ||
|
|
fcc618005a | ||
|
|
308a2f7637 | ||
|
|
a46c847244 | ||
|
|
5683e9b26a | ||
|
|
0c2d3f4cba | ||
|
|
e41fdc9310 | ||
|
|
1565b72064 | ||
|
|
5181e40827 | ||
|
|
cfaee611d8 | ||
|
|
458be8e0ed | ||
|
|
a900a6248c | ||
|
|
9bbd181ae0 | ||
|
|
d4e7d3a191 | ||
|
|
39ceb25bdb | ||
|
|
5372019fab | ||
|
|
5df5f6d538 | ||
|
|
77714df234 | ||
|
|
b87f8b2159 | ||
|
|
8bb936e4f7 | ||
|
|
fba798c78e | ||
|
|
9306c70c63 | ||
|
|
3c9160d912 | ||
|
|
53c71a12c8 | ||
|
|
2de3aceee7 | ||
|
|
289dd0cf98 | ||
|
|
db85e524b4 | ||
|
|
0164db681e | ||
|
|
83ccf991a6 | ||
|
|
1f41899519 | ||
|
|
77f6f42074 | ||
|
|
45119f0446 | ||
|
|
b2d52318fa | ||
|
|
3a8b410924 | ||
|
|
2243f537c6 | ||
|
|
84614e1373 | ||
|
|
fdbcd8e289 | ||
|
|
64bd62a1be | ||
|
|
900c877b41 | ||
|
|
82b6cb3fb2 | ||
|
|
6cbfbcc58c | ||
|
|
b85481146a | ||
|
|
b219268ad8 | ||
|
|
a05fafb944 | ||
|
|
c20cd1facb | ||
|
|
8a9566d401 | ||
|
|
b756bb754c | ||
|
|
0c76a0c911 | ||
|
|
71cd15d49b | ||
|
|
8c6d399ada | ||
|
|
2b7ed18a60 | ||
|
|
34a89c5066 | ||
|
|
969e2ed98b | ||
|
|
0dd1580afc | ||
|
|
b98ec53ee4 | ||
|
|
b4cbf822eb | ||
|
|
c47dc59adc | ||
|
|
83c1796f41 | ||
|
|
cf44a9aea7 | ||
|
|
5c0a0514da | ||
|
|
1207eeacc2 | ||
|
|
8e521837dc | ||
|
|
08e49d20f0 | ||
|
|
e91ff6ce3d | ||
|
|
7655146399 | ||
|
|
216eb8c9f2 | ||
|
|
78ab8f674f | ||
|
|
133c20e252 | ||
|
|
9515e8a7f8 | ||
|
|
23c5a17453 | ||
|
|
5fbb0954b8 | ||
|
|
4f940944da | ||
|
|
69991a5827 | ||
|
|
20c37f213a | ||
|
|
3ded9a63e3 | ||
|
|
e0c471a9e6 | ||
|
|
6b44f458f2 | ||
|
|
01c56de45c | ||
|
|
8b3ba7ff05 | ||
|
|
d1a6f01efb | ||
|
|
c2a6d50e58 | ||
|
|
f294a2c217 | ||
|
|
4358321afa | ||
|
|
45a44d49bf | ||
|
|
fecc10cd95 | ||
|
|
01e5c81773 | ||
|
|
eaff5ee3c5 | ||
|
|
aef1ffd56f | ||
|
|
51dec47b37 | ||
|
|
007a50a493 | ||
|
|
491bdd7ae5 | ||
|
|
73b0698996 | ||
|
|
06446ccf94 | ||
|
|
62a3e4f0c5 | ||
|
|
355e7c1cd1 | ||
|
|
bb88b0fc9e | ||
|
|
9a636f47ce | ||
|
|
0e95c1ddc1 | ||
|
|
df33b92836 | ||
|
|
680e8701b5 | ||
|
|
817e9f41d1 | ||
|
|
5123689ba0 | ||
|
|
f3849179e5 | ||
|
|
bd02036a4e | ||
|
|
db8837cbe1 | ||
|
|
72a23c9797 | ||
|
|
280a38c306 | ||
|
|
03b31c0ce8 | ||
|
|
8b3df748a3 | ||
|
|
e601aa1d35 | ||
|
|
b0299a2ebb | ||
|
|
d7e1f00c13 | ||
|
|
cc9305dd68 | ||
|
|
b0940840ac | ||
|
|
643a599471 | ||
|
|
b4c4ccc2b3 | ||
|
|
bba97eb2c1 | ||
|
|
c3b407f430 | ||
|
|
c307773eec | ||
|
|
a31932aa0b | ||
|
|
aa96fda183 | ||
|
|
588db0a892 | ||
|
|
4416fcdb02 | ||
|
|
11652ab3dc | ||
|
|
26b23c1a49 | ||
|
|
18bcecb07d | ||
|
|
fa770c8662 | ||
|
|
d9b739c32f | ||
|
|
9901390012 | ||
|
|
e966383bf4 | ||
|
|
cd6a695eb9 | ||
|
|
0f8d586a9f | ||
|
|
8d6c48b983 | ||
|
|
b4e4c0d14a | ||
|
|
e53c632297 | ||
|
|
21db0b2a65 | ||
|
|
5b041382df | ||
|
|
9ffbeca717 | ||
|
|
cf3b4b64d0 | ||
|
|
fd6748e22c | ||
|
|
9651150243 | ||
|
|
642cb8f829 | ||
|
|
3c31a486e7 | ||
|
|
0d8bed5636 | ||
|
|
01228b70de | ||
|
|
9208d17fa9 | ||
|
|
af27eacb6a | ||
|
|
e69bfebb45 | ||
|
|
bcae0fce72 | ||
|
|
9101a31079 | ||
|
|
c3937ec780 | ||
|
|
fff9bf0b8d | ||
|
|
64dba31e7f | ||
|
|
c1a29a5b2d | ||
|
|
374f5a14de | ||
|
|
bfcf1f3af0 | ||
|
|
65ccf9fc1d | ||
|
|
d0039cbcf8 | ||
|
|
345cea780a | ||
|
|
564801f795 | ||
|
|
b23e820381 | ||
|
|
e5352bc7bf | ||
|
|
914feea9d0 | ||
|
|
f0250de62e | ||
|
|
ef01750240 | ||
|
|
7651439487 | ||
|
|
550245801e | ||
|
|
f9abaa2c4c | ||
|
|
0e721e7569 | ||
|
|
0fb1ffb1bf | ||
|
|
b86796bf87 | ||
|
|
602bbf31c1 | ||
|
|
d8a0245ce7 | ||
|
|
34ba97434f | ||
|
|
ed86e78c90 | ||
|
|
dfdb1797c3 | ||
|
|
7086e7071e | ||
|
|
98254360e3 | ||
|
|
a75c057f10 | ||
|
|
dc2546ac9f | ||
|
|
ad950f8307 | ||
|
|
2794679661 | ||
|
|
06b00abcdd | ||
|
|
70e7d534a9 | ||
|
|
0b3551fbee | ||
|
|
abe017f60d | ||
|
|
381fb12e1e | ||
|
|
10b6b2be55 | ||
|
|
6f38107f80 | ||
|
|
0179dd6542 | ||
|
|
45119af166 | ||
|
|
e4e1a4dcb4 | ||
|
|
80cce3da95 | ||
|
|
842e86794f | ||
|
|
3309b786a3 | ||
|
|
4bda3f10ca | ||
|
|
bd16a5dcf5 | ||
|
|
4162fa07ae | ||
|
|
b418ecd84f | ||
|
|
8d69a1a3ae | ||
|
|
616429b508 | ||
|
|
9b2d067768 | ||
|
|
69e2658bf6 | ||
|
|
4aacc3a71d | ||
|
|
762a801e00 | ||
|
|
4bb2bc3f61 | ||
|
|
9f007dfecc | ||
|
|
6b45a3ca82 | ||
|
|
50997c6eeb | ||
|
|
0d76958cf7 | ||
|
|
11ee57d90c | ||
|
|
ea6cfe9ebd | ||
|
|
3f3eed2770 | ||
|
|
be2a1a68ef | ||
|
|
8e86444744 | ||
|
|
beda758b1f | ||
|
|
5ece6d436f | ||
|
|
5bb18f9a19 | ||
|
|
894dd62eb2 | ||
|
|
2992e1e967 | ||
|
|
82841af7d0 | ||
|
|
318b76e913 | ||
|
|
30d2f3d50f | ||
|
|
30f8c3953f | ||
|
|
29ae55f112 | ||
|
|
2b548aa648 | ||
|
|
bb0146c2a9 | ||
|
|
4518a4baae | ||
|
|
bec30531f7 | ||
|
|
fc6edc45c0 | ||
|
|
5e5d541531 | ||
|
|
52d1aeee3d | ||
|
|
44ea3fbdf5 | ||
|
|
338963d177 | ||
|
|
e1dd105c0a | ||
|
|
a10778dc32 | ||
|
|
d9e9746c06 | ||
|
|
c57b2479ff | ||
|
|
b85810aec0 | ||
|
|
cae601224e | ||
|
|
ae40480115 | ||
|
|
22312b71e0 | ||
|
|
a67cef01b1 | ||
|
|
e9f87b5b7d | ||
|
|
2b25d624f6 | ||
|
|
3460813bdb | ||
|
|
73784c645d | ||
|
|
25d810906c | ||
|
|
a9b8959efa | ||
|
|
e2742e46ba | ||
|
|
1109455ce9 | ||
|
|
7ea5e9779b | ||
|
|
fab5b110fb | ||
|
|
aed7fd9b97 | ||
|
|
24fad99e2b | ||
|
|
a4b36db458 | ||
|
|
1239777d4f | ||
|
|
9b3add5beb | ||
|
|
3cd5bcdd19 | ||
|
|
b5b61c616b | ||
|
|
8c9a50bee1 | ||
|
|
d99361e657 | ||
|
|
b9cecb91a0 | ||
|
|
aea13e9790 | ||
|
|
931394cbc1 | ||
|
|
704a47c475 | ||
|
|
091e20bbee | ||
|
|
cce7171088 | ||
|
|
82c035a823 | ||
|
|
8419d367e1 | ||
|
|
375d580671 | ||
|
|
f51cb8ff8c | ||
|
|
29e8831621 | ||
|
|
b9f71f19cc | ||
|
|
1a2b5d37e1 | ||
|
|
1cca533e2e | ||
|
|
c03ae96659 | ||
|
|
5a670b1ed9 | ||
|
|
ad949da96b | ||
|
|
0e78e603f6 | ||
|
|
213e640e1e | ||
|
|
e7b8bef1b1 | ||
|
|
b68e774421 | ||
|
|
78d5bae94e | ||
|
|
ff44279401 | ||
|
|
610ab194c8 | ||
|
|
29d29c8fff | ||
|
|
7c6b64d023 | ||
|
|
3d4daee374 | ||
|
|
9e7f6bbd59 | ||
|
|
255ef6389e | ||
|
|
0d8a73638f | ||
|
|
5499894828 | ||
|
|
3db472b9eb | ||
|
|
b365aa0589 | ||
|
|
30171f79ab | ||
|
|
75142d452b | ||
|
|
b7c49edf13 | ||
|
|
ec2da99ffe | ||
|
|
8adfa272f7 | ||
|
|
80dac38c5e | ||
|
|
2cec70b9f1 | ||
|
|
13ca549a75 | ||
|
|
5092aba5a7 | ||
|
|
11e2becaac | ||
|
|
dac3c91005 | ||
|
|
d0b0fefa03 | ||
|
|
adc8c84856 | ||
|
|
14d293acb2 | ||
|
|
f499b06243 | ||
|
|
d945f5cd8e | ||
|
|
d200e455d0 | ||
|
|
f9507c28ae | ||
|
|
065fbd27af | ||
|
|
1b177bd731 | ||
|
|
7742ddebf1 | ||
|
|
1fa140687e | ||
|
|
b9752825a0 | ||
|
|
776209d6c7 | ||
|
|
dee049eb91 | ||
|
|
275fc3ad0f | ||
|
|
897668ee8d | ||
|
|
ab3399e0c6 | ||
|
|
4947ebdb4c | ||
|
|
c527b2d483 | ||
|
|
23a1adea4a | ||
|
|
3877f72ba2 | ||
|
|
331dbc1bb7 | ||
|
|
be750e4c49 | ||
|
|
709ae8c6ee | ||
|
|
f87685c324 | ||
|
|
837491d810 | ||
|
|
796d61fbdd | ||
|
|
64d15509b6 | ||
|
|
367c7a47d4 | ||
|
|
fbc8ecb7ef | ||
|
|
f0440388e9 | ||
|
|
a79986b830 | ||
|
|
bcb05e75f5 | ||
|
|
4ec8e00f60 | ||
|
|
5ee2aaf2fa | ||
|
|
a64d6fe0c3 | ||
|
|
1a4648ff0d | ||
|
|
8165afc445 | ||
|
|
9c2c67e6fe | ||
|
|
93ede233f5 | ||
|
|
2666f92821 | ||
|
|
428046f8d4 | ||
|
|
ea52d7066d | ||
|
|
3f96f4dc41 | ||
|
|
51576fb3c6 | ||
|
|
50d780b566 | ||
|
|
2648a72df7 | ||
|
|
92790e5bf0 | ||
|
|
927c155774 | ||
|
|
b7575ffe6f | ||
|
|
02a81e05f9 | ||
|
|
ed8e1f68e9 | ||
|
|
cb581495e6 | ||
|
|
2e729273d6 | ||
|
|
107f7dfbd0 | ||
|
|
9b53a24f31 | ||
|
|
dbfb6dcd33 | ||
|
|
c79cea6dff | ||
|
|
c3a8cbaaad | ||
|
|
c3995d9998 | ||
|
|
c25fb64881 | ||
|
|
710ddc4f18 | ||
|
|
e83d80b8ed | ||
|
|
fbbf9b3bb9 | ||
|
|
971d51580b | ||
|
|
f64b50a08c | ||
|
|
5edafffd36 | ||
|
|
0279f8e90c | ||
|
|
190c4f5f0a | ||
|
|
2a73b93df4 | ||
|
|
74392f6a54 | ||
|
|
37c82725c8 | ||
|
|
6a164e0c96 | ||
|
|
7215de245c | ||
|
|
80e25d4d46 | ||
|
|
0ab3728b12 | ||
|
|
78af9bbcd3 | ||
|
|
bdef2a413a | ||
|
|
3735969c7d | ||
|
|
49701457c2 | ||
|
|
0edad74997 | ||
|
|
5449dd0f25 | ||
|
|
a870c5670e | ||
|
|
75addd5e5f | ||
|
|
80df876864 | ||
|
|
f693ad146e | ||
|
|
74ffbcb6bf | ||
|
|
07708e1946 | ||
|
|
448b17aa3c | ||
|
|
92b16366dd | ||
|
|
076ab0334d | ||
|
|
3843c413d0 | ||
|
|
4316896018 | ||
|
|
b2872512f1 | ||
|
|
23cbcc6c19 | ||
|
|
03ec521cc5 | ||
|
|
3a7456dd96 | ||
|
|
1cbcf2e795 | ||
|
|
841822701a | ||
|
|
3f6f053ce5 | ||
|
|
7a5350baa0 | ||
|
|
5e893e1c88 | ||
|
|
35687a9d8c | ||
|
|
d954473dee | ||
|
|
9839bbe557 | ||
|
|
9f136c0720 | ||
|
|
b608206eca | ||
|
|
52afa962d1 | ||
|
|
e74dc3213f | ||
|
|
768fca8336 | ||
|
|
a17e599f81 | ||
|
|
a04bc34180 | ||
|
|
c8ea038e69 | ||
|
|
aa2aab3c16 | ||
|
|
b178c8ccc4 | ||
|
|
f67d13aa6c | ||
|
|
c2713865e3 | ||
|
|
9887c18aca | ||
|
|
4d4f699ca4 | ||
|
|
80a6975034 | ||
|
|
fe96109760 | ||
|
|
e3e4e81446 | ||
|
|
630e182b7b | ||
|
|
81b51460c9 | ||
|
|
3067fbef53 | ||
|
|
7d27c823de | ||
|
|
2729e106a7 | ||
|
|
c2bea5f96f | ||
|
|
f11966ffc5 | ||
|
|
2c8a9dfa1d | ||
|
|
f4e421e6e4 | ||
|
|
7093d0f541 | ||
|
|
fd51e5ffa2 | ||
|
|
7d13ff5f2f | ||
|
|
892a39950d | ||
|
|
68f1e3edc3 | ||
|
|
d2d1b42b07 | ||
|
|
760b53a84b | ||
|
|
002389585a | ||
|
|
396452de26 | ||
|
|
600f9b0ccc | ||
|
|
04a76783ab | ||
|
|
147e184ccc | ||
|
|
84b113cd22 | ||
|
|
426cf563bd | ||
|
|
ec93a21372 | ||
|
|
c7925b99cb | ||
|
|
5b5d192929 | ||
|
|
8850be4b1c | ||
|
|
9113b58f6f | ||
|
|
4a38e61393 | ||
|
|
4b35e1c1dd | ||
|
|
d2b04478d4 | ||
|
|
2c4c30aa95 | ||
|
|
576890b7ee | ||
|
|
cb487d7d0d | ||
|
|
6013d43f59 | ||
|
|
cb4956ee99 | ||
|
|
648185ab4a | ||
|
|
b3324f97a8 | ||
|
|
68254a0303 | ||
|
|
d2079671fb | ||
|
|
04d843a2a8 | ||
|
|
eeeb962b2f | ||
|
|
e0327bc8b4 | ||
|
|
000f1a3cb2 | ||
|
|
26cfe0be87 | ||
|
|
a12f5cabb2 | ||
|
|
f6bd542788 | ||
|
|
a220f55509 | ||
|
|
2ca209c11d | ||
|
|
0e41b407b9 | ||
|
|
e0c40012bd | ||
|
|
5e147124b5 | ||
|
|
a034c8b849 | ||
|
|
b83f0407c6 | ||
|
|
c64a20f3dc | ||
|
|
5b0d29bb52 | ||
|
|
722c4bfec2 | ||
|
|
6255b43511 | ||
|
|
b29b2ed560 | ||
|
|
b497173564 | ||
|
|
a81b1d4ad4 | ||
|
|
c1ecb3c1f5 | ||
|
|
cc72668cfb | ||
|
|
fbe01355c8 | ||
|
|
81e895c01e | ||
|
|
d38d6e7c76 | ||
|
|
6bb1878b51 | ||
|
|
d9ec2d0749 | ||
|
|
720e5c1bc3 | ||
|
|
fb9087861f | ||
|
|
125ecb5684 | ||
|
|
d8cf039f97 | ||
|
|
7bec0760a8 | ||
|
|
c87d4863f6 | ||
|
|
9bfe901c33 | ||
|
|
97db7bd4a1 | ||
|
|
2c5f66eda7 | ||
|
|
300f275f23 | ||
|
|
f59c437a25 | ||
|
|
6986fd9e3b | ||
|
|
4bc30f78dc | ||
|
|
08a946e008 | ||
|
|
f047348491 | ||
|
|
e41dc70020 | ||
|
|
652a871c29 | ||
|
|
b2ed6e5826 | ||
|
|
edad70670f | ||
|
|
3feec03433 | ||
|
|
ddcd5fdff6 | ||
|
|
bb527fc271 | ||
|
|
a845a69707 | ||
|
|
f004bf6ac4 | ||
|
|
de326cc0de | ||
|
|
90b4416b5b | ||
|
|
9703cc49e0 | ||
|
|
d803322e27 | ||
|
|
3d76b07def | ||
|
|
09b503c8e1 | ||
|
|
0f37a9942f | ||
|
|
fa63c49821 | ||
|
|
d39d93b834 | ||
|
|
9edcd89542 | ||
|
|
7da99edea7 | ||
|
|
ba9dda1a2e | ||
|
|
337c5bd131 | ||
|
|
c73a41af8e | ||
|
|
0df87bb609 | ||
|
|
e4d3d4de4c | ||
|
|
6d7d248e72 | ||
|
|
e9e4c32114 | ||
|
|
5f7e08323a | ||
|
|
e3f1699f55 | ||
|
|
65be086611 | ||
|
|
e4d910bf0f | ||
|
|
1964ad8c34 | ||
|
|
951366c145 | ||
|
|
9f4503d6e9 | ||
|
|
d8988b2fff | ||
|
|
92fcb5efbe | ||
|
|
6468d18e5c | ||
|
|
6b7e85b994 | ||
|
|
cd5aafcf8c | ||
|
|
037ca2f14c | ||
|
|
270a173cf3 | ||
|
|
561f9a30af | ||
|
|
f987e9d257 | ||
|
|
de76abc1e9 | ||
|
|
4a0d893695 | ||
|
|
0846f581e8 | ||
|
|
490abf53b1 | ||
|
|
3c1a79b314 | ||
|
|
5d52e7d045 | ||
|
|
004b178558 | ||
|
|
3bcfa9dedd | ||
|
|
631aa1d3dc | ||
|
|
ee006e3a4c | ||
|
|
9449f6d3a8 | ||
|
|
c07c873533 | ||
|
|
f6ec6d13dc | ||
|
|
342b8b6e21 | ||
|
|
0150aabe35 | ||
|
|
8484abf02c | ||
|
|
bafbfdd24c | ||
|
|
20e0b9749c | ||
|
|
3a7bc75ff7 | ||
|
|
40b97583b8 | ||
|
|
c20e2bdcf1 | ||
|
|
1c8c2190b1 | ||
|
|
180d45ba81 | ||
|
|
c51d1a1973 | ||
|
|
577c6c8499 | ||
|
|
6f9344dadf | ||
|
|
652def8074 | ||
|
|
209215672e | ||
|
|
25b222faf6 | ||
|
|
6bc35ae56a | ||
|
|
31b53af2fa | ||
|
|
a474de9b9a | ||
|
|
c0629aa10f | ||
|
|
82b6d266fd | ||
|
|
75f5aaea27 | ||
|
|
f508cb0ac9 | ||
|
|
f3c383d683 | ||
|
|
13105fc158 | ||
|
|
b0c4483ed2 | ||
|
|
714720fcfe | ||
|
|
4766a52862 | ||
|
|
11d82f03b4 | ||
|
|
a0ed1cb86a | ||
|
|
f753cd6292 | ||
|
|
93a37297e6 | ||
|
|
4134cae3c5 | ||
|
|
682d48cd09 | ||
|
|
53cdf751a3 | ||
|
|
087c8fdae3 | ||
|
|
7a999fcb7b | ||
|
|
dda680cb80 | ||
|
|
6b7d911c5d | ||
|
|
9e644e648d | ||
|
|
17da6427fe | ||
|
|
01ed3db59b | ||
|
|
e8cb70b957 | ||
|
|
63c2d5de0f | ||
|
|
675bc4e954 | ||
|
|
d8cb51834b | ||
|
|
6c686258e3 | ||
|
|
c111e171cd | ||
|
|
8f451ef727 | ||
|
|
5086915ebd | ||
|
|
416bd7a9f3 | ||
|
|
997b6fd0c7 | ||
|
|
2ba3b73c58 | ||
|
|
ff48177d25 | ||
|
|
4e5caae2c6 | ||
|
|
b33160bf45 | ||
|
|
535c0e75d1 | ||
|
|
d1a2daf76a | ||
|
|
2b763dfe15 | ||
|
|
f1a87ef6ad | ||
|
|
cbd8990652 | ||
|
|
82e236e2d6 | ||
|
|
b0cfa28a12 | ||
|
|
6fc7423473 | ||
|
|
40a64a7a48 | ||
|
|
944bc6ce43 | ||
|
|
9c76d118cc | ||
|
|
a8289c62db | ||
|
|
b6610515d5 | ||
|
|
26f609ffc3 | ||
|
|
6f43b11362 | ||
|
|
dd3127cf7a | ||
|
|
aa321494cf | ||
|
|
68bd3b6bfa | ||
|
|
bbb5bcc6f8 | ||
|
|
667a550e7b | ||
|
|
713fa62a74 | ||
|
|
83cd972a1a |
@@ -9,4 +9,13 @@ patches
|
||||
*.patch *.log log patches applied
|
||||
*.prj
|
||||
releases
|
||||
*.flc
|
||||
autom4te.cache
|
||||
intl
|
||||
Makefile.in
|
||||
configure
|
||||
config.hin
|
||||
aclocal.m4
|
||||
ABOUT-NLS
|
||||
INSTALL
|
||||
COPYING
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
patch_list='Bison Patches <[email protected]>'
|
||||
@@ -1,324 +0,0 @@
|
||||
Notes on the Free Translation Project
|
||||
*************************************
|
||||
|
||||
Free software is going international! The Free Translation Project
|
||||
is a way to get maintainers of free software, translators, and users all
|
||||
together, so that will gradually become able to speak many languages.
|
||||
A few packages already provide translations for their messages.
|
||||
|
||||
If you found this `ABOUT-NLS' file inside a distribution, you may
|
||||
assume that the distributed package does use GNU `gettext' internally,
|
||||
itself available at your nearest GNU archive site. But you do _not_
|
||||
need to install GNU `gettext' prior to configuring, installing or using
|
||||
this package with messages translated.
|
||||
|
||||
Installers will find here some useful hints. These notes also
|
||||
explain how users should proceed for getting the programs to use the
|
||||
available translations. They tell how people wanting to contribute and
|
||||
work at translations should contact the appropriate team.
|
||||
|
||||
When reporting bugs in the `intl/' directory or bugs which may be
|
||||
related to internationalization, you should tell about the version of
|
||||
`gettext' which is used. The information can be found in the
|
||||
`intl/VERSION' file, in internationalized packages.
|
||||
|
||||
Quick configuration advice
|
||||
==========================
|
||||
|
||||
If you want to exploit the full power of internationalization, you
|
||||
should configure it using
|
||||
|
||||
./configure --with-included-gettext
|
||||
|
||||
to force usage of internationalizing routines provided within this
|
||||
package, despite the existence of internationalizing capabilities in the
|
||||
operating system where this package is being installed. So far, only
|
||||
the `gettext' implementation in the GNU C library version 2 provides as
|
||||
many features (such as locale alias, message inheritance, automatic
|
||||
charset conversion or plural form handling) as the implementation here.
|
||||
It is also not possible to offer this additional functionality on top
|
||||
of a `catgets' implementation. Future versions of GNU `gettext' will
|
||||
very likely convey even more functionality. So it might be a good idea
|
||||
to change to GNU `gettext' as soon as possible.
|
||||
|
||||
So you need _not_ provide this option if you are using GNU libc 2 or
|
||||
you have installed a recent copy of the GNU gettext package with the
|
||||
included `libintl'.
|
||||
|
||||
INSTALL Matters
|
||||
===============
|
||||
|
||||
Some packages are "localizable" when properly installed; the
|
||||
programs they contain can be made to speak your own native language.
|
||||
Most such packages use GNU `gettext'. Other packages have their own
|
||||
ways to internationalization, predating GNU `gettext'.
|
||||
|
||||
By default, this package will be installed to allow translation of
|
||||
messages. It will automatically detect whether the system already
|
||||
provides the GNU `gettext' functions. If not, the GNU `gettext' own
|
||||
library will be used. This library is wholly contained within this
|
||||
package, usually in the `intl/' subdirectory, so prior installation of
|
||||
the GNU `gettext' package is _not_ required. Installers may use
|
||||
special options at configuration time for changing the default
|
||||
behaviour. The commands:
|
||||
|
||||
./configure --with-included-gettext
|
||||
./configure --disable-nls
|
||||
|
||||
will respectively bypass any pre-existing `gettext' to use the
|
||||
internationalizing routines provided within this package, or else,
|
||||
_totally_ disable translation of messages.
|
||||
|
||||
When you already have GNU `gettext' installed on your system and run
|
||||
configure without an option for your new package, `configure' will
|
||||
probably detect the previously built and installed `libintl.a' file and
|
||||
will decide to use this. This might be not what is desirable. You
|
||||
should use the more recent version of the GNU `gettext' library. I.e.
|
||||
if the file `intl/VERSION' shows that the library which comes with this
|
||||
package is more recent, you should use
|
||||
|
||||
./configure --with-included-gettext
|
||||
|
||||
to prevent auto-detection.
|
||||
|
||||
The configuration process will not test for the `catgets' function
|
||||
and therefore it will not be used. The reason is that even an
|
||||
emulation of `gettext' on top of `catgets' could not provide all the
|
||||
extensions of the GNU `gettext' library.
|
||||
|
||||
Internationalized packages have usually many `po/LL.po' files, where
|
||||
LL gives an ISO 639 two-letter code identifying the language. Unless
|
||||
translations have been forbidden at `configure' time by using the
|
||||
`--disable-nls' switch, all available translations are installed
|
||||
together with the package. However, the environment variable `LINGUAS'
|
||||
may be set, prior to configuration, to limit the installed set.
|
||||
`LINGUAS' should then contain a space separated list of two-letter
|
||||
codes, stating which languages are allowed.
|
||||
|
||||
Using This Package
|
||||
==================
|
||||
|
||||
As a user, if your language has been installed for this package, you
|
||||
only have to set the `LANG' environment variable to the appropriate
|
||||
`LL_CC' combination. Here `LL' is an ISO 639 two-letter language code,
|
||||
and `CC' is an ISO 3166 two-letter country code. For example, let's
|
||||
suppose that you speak German and live in Germany. At the shell
|
||||
prompt, merely execute `setenv LANG de_DE' (in `csh'),
|
||||
`export LANG; LANG=de_DE' (in `sh') or `export LANG=de_DE' (in `bash').
|
||||
This can be done from your `.login' or `.profile' file, once and for
|
||||
all.
|
||||
|
||||
You might think that the country code specification is redundant.
|
||||
But in fact, some languages have dialects in different countries. For
|
||||
example, `de_AT' is used for Austria, and `pt_BR' for Brazil. The
|
||||
country code serves to distinguish the dialects.
|
||||
|
||||
Not all programs have translations for all languages. By default, an
|
||||
English message is shown in place of a nonexistent translation. If you
|
||||
understand other languages, you can set up a priority list of languages.
|
||||
This is done through a different environment variable, called
|
||||
`LANGUAGE'. GNU `gettext' gives preference to `LANGUAGE' over `LANG'
|
||||
for the purpose of message handling, but you still need to have `LANG'
|
||||
set to the primary language; this is required by other parts of the
|
||||
system libraries. For example, some Swedish users who would rather
|
||||
read translations in German than English for when Swedish is not
|
||||
available, set `LANGUAGE' to `sv:de' while leaving `LANG' to `sv_SE'.
|
||||
|
||||
In the `LANGUAGE' environment variable, but not in the `LANG'
|
||||
environment variable, `LL_CC' combinations can be abbreviated as `LL'
|
||||
to denote the language's main dialect. For example, `de' is equivalent
|
||||
to `de_DE' (German as spoken in Germany), and `pt' to `pt_PT'
|
||||
(Portuguese as spoken in Portugal) in this context.
|
||||
|
||||
Translating Teams
|
||||
=================
|
||||
|
||||
For the Free Translation Project to be a success, we need interested
|
||||
people who like their own language and write it well, and who are also
|
||||
able to synergize with other translators speaking the same language.
|
||||
Each translation team has its own mailing list. The up-to-date list of
|
||||
teams can be found at the Free Translation Project's homepage,
|
||||
`http://www.iro.umontreal.ca/contrib/po/HTML/', in the "National teams"
|
||||
area.
|
||||
|
||||
If you'd like to volunteer to _work_ at translating messages, you
|
||||
should become a member of the translating team for your own language.
|
||||
The subscribing address is _not_ the same as the list itself, it has
|
||||
`-request' appended. For example, speakers of Swedish can send a
|
||||
message to `[email protected]', having this message body:
|
||||
|
||||
subscribe
|
||||
|
||||
Keep in mind that team members are expected to participate
|
||||
_actively_ in translations, or at solving translational difficulties,
|
||||
rather than merely lurking around. If your team does not exist yet and
|
||||
you want to start one, or if you are unsure about what to do or how to
|
||||
get started, please write to `[email protected]' to reach the
|
||||
coordinator for all translator teams.
|
||||
|
||||
The English team is special. It works at improving and uniformizing
|
||||
the terminology in use. Proven linguistic skill are praised more than
|
||||
programming skill, here.
|
||||
|
||||
Available Packages
|
||||
==================
|
||||
|
||||
Languages are not equally supported in all packages. The following
|
||||
matrix shows the current state of internationalization, as of September
|
||||
2001. The matrix shows, in regard of each package, for which languages
|
||||
PO files have been submitted to translation coordination, with a
|
||||
translation percentage of at least 50%.
|
||||
|
||||
Ready PO files bg cs da de el en eo es et fi fr gl he hr id it ja
|
||||
+----------------------------------------------------+
|
||||
a2ps | [] [] [] |
|
||||
bash | [] [] [] [] |
|
||||
bfd | |
|
||||
binutils | [] |
|
||||
bison | [] [] [] [] [] |
|
||||
clisp | [] [] [] [] |
|
||||
cpio | [] [] [] [] [] |
|
||||
diffutils | [] [] [] [] [] [] [] |
|
||||
enscript | [] [] |
|
||||
error | [] [] |
|
||||
fetchmail | |
|
||||
fileutils | [] [] [] [] [] [] [] [] |
|
||||
findutils | [] [] [] [] [] [] [] [] |
|
||||
flex | [] [] [] |
|
||||
freetype | |
|
||||
gas | |
|
||||
gawk | [] [] |
|
||||
gcal | |
|
||||
gcc | |
|
||||
gettext | [] [] [] [] [] [] [] [] [] [] |
|
||||
gnupg | [] [] [] [] [] [] [] |
|
||||
gprof | |
|
||||
grep | [] [] [] [] [] [] [] [] |
|
||||
hello | [] [] [] [] [] [] [] [] [] [] [] |
|
||||
id-utils | [] [] [] |
|
||||
indent | [] [] [] [] [] |
|
||||
jpilot | [] |
|
||||
kbd | |
|
||||
ld | [] |
|
||||
libc | [] [] [] [] [] [] [] [] |
|
||||
lilypond | [] |
|
||||
lynx | [] [] [] [] |
|
||||
m4 | [] [] [] [] [] [] [] [] |
|
||||
make | [] [] [] [] [] [] |
|
||||
mysecretdiary | [] |
|
||||
nano | [] [] [] |
|
||||
opcodes | |
|
||||
parted | [] [] [] |
|
||||
ptx | [] [] [] [] [] [] [] |
|
||||
python | |
|
||||
recode | [] [] [] [] [] [] [] [] [] |
|
||||
sed | [] [] [] [] [] [] [] [] [] [] [] [] |
|
||||
sh-utils | [] [] [] [] [] [] [] [] [] [] |
|
||||
sharutils | [] [] [] [] [] [] [] [] |
|
||||
sketch | |
|
||||
soundtracker | [] [] [] |
|
||||
sp | |
|
||||
tar | [] [] [] [] [] [] [] [] |
|
||||
texinfo | [] [] [] [] [] [] |
|
||||
textutils | [] [] [] [] [] [] [] [] |
|
||||
util-linux | [] [] |
|
||||
wdiff | [] [] [] |
|
||||
wget | [] [] [] [] [] [] [] [] [] [] |
|
||||
+----------------------------------------------------+
|
||||
bg cs da de el en eo es et fi fr gl he hr id it ja
|
||||
0 14 24 32 11 1 8 23 13 1 33 22 4 0 7 9 18
|
||||
|
||||
ko lv nb nl nn no pl pt pt_BR ru sk sl sv tr uk zh
|
||||
+----------------------------------------------------+
|
||||
a2ps | [] [] [] | 6
|
||||
bash | | 4
|
||||
bfd | | 0
|
||||
binutils | | 1
|
||||
bison | [] | 6
|
||||
clisp | [] | 5
|
||||
cpio | [] [] [] [] [] | 10
|
||||
diffutils | [] [] [] [] | 11
|
||||
enscript | [] [] [] | 5
|
||||
error | [] [] | 4
|
||||
fetchmail | | 0
|
||||
fileutils | [] [] [] [] [] [] [] [] [] | 17
|
||||
findutils | [] [] [] [] [] [] [] [] | 16
|
||||
flex | [] [] [] | 6
|
||||
freetype | | 0
|
||||
gas | | 0
|
||||
gawk | [] | 3
|
||||
gcal | | 0
|
||||
gcc | | 0
|
||||
gettext | [] [] [] [] [] [] [] [] | 18
|
||||
gnupg | [] [] [] | 10
|
||||
gprof | | 0
|
||||
grep | [] [] [] [] | 12
|
||||
hello | [] [] [] [] [] [] [] [] [] [] [] | 22
|
||||
id-utils | [] [] [] | 6
|
||||
indent | [] [] [] [] [] [] [] | 12
|
||||
jpilot | | 1
|
||||
kbd | [] | 1
|
||||
ld | | 1
|
||||
libc | [] [] [] [] [] [] [] [] | 16
|
||||
lilypond | [] [] | 3
|
||||
lynx | [] [] [] [] | 8
|
||||
m4 | [] [] [] [] | 12
|
||||
make | [] [] [] [] [] [] | 12
|
||||
mysecretdiary | | 1
|
||||
nano | [] | 4
|
||||
opcodes | [] | 1
|
||||
parted | [] [] | 5
|
||||
ptx | [] [] [] [] [] [] [] [] | 15
|
||||
python | | 0
|
||||
recode | [] [] [] [] | 13
|
||||
sed | [] [] [] [] [] [] [] | 19
|
||||
sh-utils | [] [] [] [] [] [] [] [] [] [] [] | 21
|
||||
sharutils | [] [] [] | 11
|
||||
sketch | | 0
|
||||
soundtracker | | 3
|
||||
sp | | 0
|
||||
tar | [] [] [] [] [] [] [] | 15
|
||||
texinfo | [] | 7
|
||||
textutils | [] [] [] [] [] [] [] [] | 16
|
||||
util-linux | [] [] | 4
|
||||
wdiff | [] [] [] [] | 7
|
||||
wget | [] [] [] [] [] [] [] | 17
|
||||
+----------------------------------------------------+
|
||||
33 teams ko lv nb nl nn no pl pt pt_BR ru sk sl sv tr uk zh
|
||||
53 domains 9 1 6 20 0 6 17 1 13 25 10 11 23 21 2 2 387
|
||||
|
||||
Some counters in the preceding matrix are higher than the number of
|
||||
visible blocks let us expect. This is because a few extra PO files are
|
||||
used for implementing regional variants of languages, or language
|
||||
dialects.
|
||||
|
||||
For a PO file in the matrix above to be effective, the package to
|
||||
which it applies should also have been internationalized and
|
||||
distributed as such by its maintainer. There might be an observable
|
||||
lag between the mere existence a PO file and its wide availability in a
|
||||
distribution.
|
||||
|
||||
If September 2001 seems to be old, you may fetch a more recent copy
|
||||
of this `ABOUT-NLS' file on most GNU archive sites. The most
|
||||
up-to-date matrix with full percentage details can be found at
|
||||
`http://www.iro.umontreal.ca/contrib/po/HTML/matrix.html'.
|
||||
|
||||
Using `gettext' in new packages
|
||||
===============================
|
||||
|
||||
If you are writing a freely available program and want to
|
||||
internationalize it you are welcome to use GNU `gettext' in your
|
||||
package. Of course you have to respect the GNU Library General Public
|
||||
License which covers the use of the GNU `gettext' library. This means
|
||||
in particular that even non-free programs can use `libintl' as a shared
|
||||
library, whereas only free software can use `libintl' as a static
|
||||
library or use modified versions of `libintl'.
|
||||
|
||||
Once the sources are changed appropriately and the setup can handle
|
||||
to use of `gettext' the only thing missing are the translations. The
|
||||
Free Translation Project is also available for packages which are not
|
||||
developed inside the GNU project. Therefore the information given above
|
||||
applies also for every other Free Software Project. Contact
|
||||
`[email protected]' to make the `.pot' files available to
|
||||
the translation teams.
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
-*- outline -*-
|
||||
|
||||
This file attempts to describe the rules to use when hacking Bison.
|
||||
Don't put this file into the distribution. Don't mention it in the
|
||||
ChangeLog.
|
||||
|
||||
* Administrivia
|
||||
|
||||
** If you incorporate a change from somebody on the net:
|
||||
First, if it is a large change, you must make sure they have signed
|
||||
the appropriate paperwork. Second, be sure to add their name and
|
||||
email address to THANKS.
|
||||
|
||||
** If a change fixes a test, mention the test in the ChangeLog entry.
|
||||
|
||||
** Bug reports
|
||||
If somebody reports a new bug, mention his name in the ChangeLog entry
|
||||
and in the test case you write. Put him into THANKS.
|
||||
|
||||
The correct response to most actual bugs is to write a new test case
|
||||
which demonstrates the bug. Then fix the bug, re-run the test suite,
|
||||
and check everything in.
|
||||
|
||||
** Visible changes
|
||||
Which include serious bug fixes, must be mentioned in NEWS.
|
||||
|
||||
|
||||
* Test suite
|
||||
|
||||
** make check
|
||||
Use liberally.
|
||||
|
||||
** Release checks
|
||||
Try to run the test suite with more severe conditions before a
|
||||
release:
|
||||
|
||||
- Configure the package with --enable-gcc-warnings, so that one checks
|
||||
that 1. Bison compiles cleanly, 2. the parsers it produces compile
|
||||
cleanly too.
|
||||
|
||||
- Change tests/bison to run `valgrind -q bison' to run Bison under
|
||||
Valgrind.
|
||||
|
||||
- Run the test suite with `./testsuite PREPARSER='valgrind -q' to make
|
||||
sure the parser behave properly.
|
||||
|
||||
- Change tests/atlocal/CFLAGS to add your preferred options. For
|
||||
instance, `-traditional' to check that the parsers are K&R. Note
|
||||
that it does not make sense for glr.c, which should be ANSI,
|
||||
but currently is actually GNU C, nor for lalr1.cc, which anyway is
|
||||
not exercised yet in the test suite.
|
||||
|
||||
- Change tests/atlocal/CC to use a C++ compiler.
|
||||
|
||||
|
||||
* Release Procedure
|
||||
|
||||
** Tests
|
||||
See above.
|
||||
|
||||
** Update the foreign files
|
||||
Running `make update' in the top level should make it all for you.
|
||||
This covers PO files too. Beware that it happens that some PO files
|
||||
contain serious problems and are rejected by recent Gettext releases:
|
||||
fix them all, and complain to the Translation Project!
|
||||
|
||||
Note that there might be *new* PO files. Don't forget to update the
|
||||
whole machinery, which not only includes LINGUAS, but `cvs add'ing the
|
||||
PO files too.
|
||||
|
||||
** Update NEWS
|
||||
The version number, *and* the date of the release (including for
|
||||
betas).
|
||||
|
||||
** Update ChangeLog
|
||||
Should have an entry similar to `Version 1.49b.'.
|
||||
Check all this in once `make distcheck' passes.
|
||||
|
||||
** make alpha
|
||||
Running `make alpha' is absolutely perfect for beta releases: it makes
|
||||
the tarballs, the xdeltas, and prepares (in /tmp/) a proto
|
||||
announcement. It is so neat, that that's what I use anyway for
|
||||
genuine releases, but adjusting things by hand (e.g., the urls in the
|
||||
announcement file, the ChangeLog which is not needed etc.).
|
||||
|
||||
If it fails, you're on your own...
|
||||
|
||||
It requires GNU Make.
|
||||
|
||||
** Upload
|
||||
Put the tarballs/xdeltas where they should be. Or put it somewhere,
|
||||
and send the URL to [email protected].
|
||||
|
||||
** Bump the version number
|
||||
In configure.ac. Run `make', check this in.
|
||||
|
||||
** Announce
|
||||
Complete/fix the announcement file, and send it at least to
|
||||
[email protected] (if a real release, or a ``serious beta''),
|
||||
[email protected], and [email protected].
|
||||
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bison.
|
||||
|
||||
GNU Bison 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.
|
||||
|
||||
GNU Bison 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 GNU Bison; see the file COPYING. If not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA.
|
||||
@@ -1,231 +0,0 @@
|
||||
Copyright 1994, 1995, 1996, 1999, 2000, 2001 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
This file is free documentation; the Free Software Foundation gives
|
||||
unlimited permission to copy, distribute and modify it.
|
||||
|
||||
Basic Installation
|
||||
==================
|
||||
|
||||
These are generic installation instructions.
|
||||
|
||||
The `configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
those values to create a `Makefile' in each directory of the package.
|
||||
It may also create one or more `.h' files containing system-dependent
|
||||
definitions. Finally, it creates a shell script `config.status' that
|
||||
you can run in the future to recreate the current configuration, and a
|
||||
file `config.log' containing compiler output (useful mainly for
|
||||
debugging `configure').
|
||||
|
||||
It can also use an optional file (typically called `config.cache'
|
||||
and enabled with `--cache-file=config.cache' or simply `-C') that saves
|
||||
the results of its tests to speed up reconfiguring. (Caching is
|
||||
disabled by default to prevent problems with accidental use of stale
|
||||
cache files.)
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how `configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the `README' so they can
|
||||
be considered for the next release. If you are using the cache, and at
|
||||
some point `config.cache' contains results you don't want to keep, you
|
||||
may remove or edit it.
|
||||
|
||||
The file `configure.ac' (or `configure.in') is used to create
|
||||
`configure' by a program called `autoconf'. You only need
|
||||
`configure.ac' if you want to change it or regenerate `configure' using
|
||||
a newer version of `autoconf'.
|
||||
|
||||
The simplest way to compile this package is:
|
||||
|
||||
1. `cd' to the directory containing the package's source code and type
|
||||
`./configure' to configure the package for your system. If you're
|
||||
using `csh' on an old version of System V, you might need to type
|
||||
`sh ./configure' instead to prevent `csh' from trying to execute
|
||||
`configure' itself.
|
||||
|
||||
Running `configure' takes awhile. While running, it prints some
|
||||
messages telling which features it is checking for.
|
||||
|
||||
2. Type `make' to compile the package.
|
||||
|
||||
3. Optionally, type `make check' to run any self-tests that come with
|
||||
the package.
|
||||
|
||||
4. Type `make install' to install the programs and any data files and
|
||||
documentation.
|
||||
|
||||
5. You can remove the program binaries and object files from the
|
||||
source code directory by typing `make clean'. To also remove the
|
||||
files that `configure' created (so you can compile the package for
|
||||
a different kind of computer), type `make distclean'. There is
|
||||
also a `make maintainer-clean' target, but that is intended mainly
|
||||
for the package's developers. If you use it, you may have to get
|
||||
all sorts of other programs in order to regenerate files that came
|
||||
with the distribution.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the `configure' script does not know about. Run `./configure --help'
|
||||
for details on some of the pertinent environment variables.
|
||||
|
||||
You can give `configure' initial values for variables by setting
|
||||
them in the environment. You can do that on the command line like this:
|
||||
|
||||
./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
|
||||
|
||||
*Note Defining Variables::, for more details.
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you must use a version of `make' that
|
||||
supports the `VPATH' variable, such as GNU `make'. `cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the `configure' script. `configure' automatically checks for the
|
||||
source code in the directory that `configure' is in and in `..'.
|
||||
|
||||
If you have to use a `make' that does not support the `VPATH'
|
||||
variable, you have to compile the package for one architecture at a
|
||||
time in the source code directory. After you have installed the
|
||||
package for one architecture, use `make distclean' before reconfiguring
|
||||
for another architecture.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
By default, `make install' will install the package's files in
|
||||
`/usr/local/bin', `/usr/local/man', etc. You can specify an
|
||||
installation prefix other than `/usr/local' by giving `configure' the
|
||||
option `--prefix=PATH'.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
give `configure' the option `--exec-prefix=PATH', the package will use
|
||||
PATH as the prefix for installing programs and libraries.
|
||||
Documentation and other data files will still use the regular prefix.
|
||||
|
||||
In addition, if you use an unusual directory layout you can give
|
||||
options like `--bindir=PATH' to specify different values for particular
|
||||
kinds of files. Run `configure --help' for a list of the directories
|
||||
you can set and what kinds of files go in them.
|
||||
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving `configure' the
|
||||
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
Some packages pay attention to `--enable-FEATURE' options to
|
||||
`configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
||||
is something like `gnu-as' or `x' (for the X Window System). The
|
||||
`README' should mention any `--enable-' and `--with-' options that the
|
||||
package recognizes.
|
||||
|
||||
For packages that use the X Window System, `configure' can usually
|
||||
find the X include and library files automatically, but if it doesn't,
|
||||
you can use the `configure' options `--x-includes=DIR' and
|
||||
`--x-libraries=DIR' to specify their locations.
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features `configure' cannot figure out
|
||||
automatically, but needs to determine by the type of host the package
|
||||
will run on. Usually `configure' can figure that out, but if it prints
|
||||
a message saying it cannot guess the host type, give it the
|
||||
`--build=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as `sun4', or a canonical name which has the form:
|
||||
|
||||
CPU-COMPANY-SYSTEM
|
||||
|
||||
where SYSTEM can have one of these forms:
|
||||
|
||||
OS KERNEL-OS
|
||||
|
||||
See the file `config.sub' for the possible values of each field. If
|
||||
`config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the host type.
|
||||
|
||||
If you are _building_ compiler tools for cross-compiling, you should
|
||||
use the `--target=TYPE' option to select the type of system they will
|
||||
produce code for.
|
||||
|
||||
If you want to _use_ a cross compiler, that generates code for a
|
||||
platform different from the build platform, you should specify the host
|
||||
platform (i.e., that on which the generated programs will eventually be
|
||||
run) with `--host=TYPE'. In this case, you should also specify the
|
||||
build platform with `--build=TYPE', because, in this case, it may not
|
||||
be possible to guess the build platform (it sometimes involves
|
||||
compiling and running simple test programs, and this can't be done if
|
||||
the compiler is a cross compiler).
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
If you want to set default values for `configure' scripts to share,
|
||||
you can create a site shell script called `config.site' that gives
|
||||
default values for variables like `CC', `cache_file', and `prefix'.
|
||||
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
||||
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
`CONFIG_SITE' environment variable to the location of the site script.
|
||||
A warning: not all `configure' scripts look for a site script.
|
||||
|
||||
Defining Variables
|
||||
==================
|
||||
|
||||
Variables not defined in a site shell script can be set in the
|
||||
environment passed to `configure'. However, some packages may run
|
||||
configure again during the build, and the customized values of these
|
||||
variables may be lost. In order to avoid this problem, you should set
|
||||
them in the `configure' command line, using `VAR=value'. For example:
|
||||
|
||||
./configure CC=/usr/local2/bin/gcc
|
||||
|
||||
will cause the specified gcc to be used as the C compiler (unless it is
|
||||
overridden in the site shell script).
|
||||
|
||||
`configure' Invocation
|
||||
======================
|
||||
|
||||
`configure' recognizes the following options to control how it
|
||||
operates.
|
||||
|
||||
`--help'
|
||||
`-h'
|
||||
Print a summary of the options to `configure', and exit.
|
||||
|
||||
`--version'
|
||||
`-V'
|
||||
Print the version of Autoconf used to generate the `configure'
|
||||
script, and exit.
|
||||
|
||||
`--cache-file=FILE'
|
||||
Enable the cache: use and save the results of the tests in FILE,
|
||||
traditionally `config.cache'. FILE defaults to `/dev/null' to
|
||||
disable caching.
|
||||
|
||||
`--config-cache'
|
||||
`-C'
|
||||
Alias for `--cache-file=config.cache'.
|
||||
|
||||
`--quiet'
|
||||
`--silent'
|
||||
`-q'
|
||||
Do not print messages saying which checks are being made. To
|
||||
suppress all normal output, redirect it to `/dev/null' (any error
|
||||
messages will still be shown).
|
||||
|
||||
`--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
`configure' can determine that directory automatically.
|
||||
|
||||
`configure' also accepts some other, not widely useful, options. Run
|
||||
`configure --help' for more details.
|
||||
|
||||
+20
-5
@@ -1,13 +1,28 @@
|
||||
## Copyright (C) 2001, 2002 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA
|
||||
## 02111-1307 USA
|
||||
|
||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
||||
AUTOMAKE_OPTIONS = 1.5 check-news readme-alpha dist-bzip2
|
||||
AUTOMAKE_OPTIONS = 1.6 check-news readme-alpha dist-bzip2
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
SUBDIRS = config intl po lib src doc m4 tests
|
||||
SUBDIRS = config po lib data src doc m4 tests
|
||||
|
||||
EXTRA_DIST = REFERENCES configure.bat OChangeLog Makefile.maint GNUmakefile
|
||||
|
||||
DISTCLEANFILES = intl/libintl.h
|
||||
EXTRA_DIST = REFERENCES OChangeLog Makefile.maint GNUmakefile
|
||||
|
||||
|
||||
## ---------------------------- ##
|
||||
|
||||
-466
@@ -1,466 +0,0 @@
|
||||
# Makefile.in generated automatically by automake 1.5a from Makefile.am.
|
||||
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
|
||||
# Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
top_builddir = .
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = @program_transform_name@
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
|
||||
EXEEXT = @EXEEXT@
|
||||
OBJEXT = @OBJEXT@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
AMTAR = @AMTAR@
|
||||
AWK = @AWK@
|
||||
BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@
|
||||
CATALOGS = @CATALOGS@
|
||||
CATOBJEXT = @CATOBJEXT@
|
||||
CC = @CC@
|
||||
CPP = @CPP@
|
||||
DATADIRNAME = @DATADIRNAME@
|
||||
DEPDIR = @DEPDIR@
|
||||
GENCAT = @GENCAT@
|
||||
GLIBC21 = @GLIBC21@
|
||||
GMOFILES = @GMOFILES@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
INSTOBJEXT = @INSTOBJEXT@
|
||||
INTLBISON = @INTLBISON@
|
||||
INTLLIBS = @INTLLIBS@
|
||||
INTLOBJS = @INTLOBJS@
|
||||
INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@
|
||||
LIBICONV = @LIBICONV@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
M4 = @M4@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
MSGFMT = @MSGFMT@
|
||||
PACKAGE = @PACKAGE@
|
||||
POFILES = @POFILES@
|
||||
POSUB = @POSUB@
|
||||
RANLIB = @RANLIB@
|
||||
U = @U@
|
||||
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
|
||||
USE_NLS = @USE_NLS@
|
||||
VERSION = @VERSION@
|
||||
WARNING_CFLAGS = @WARNING_CFLAGS@
|
||||
am__include = @am__include@
|
||||
am__quote = @am__quote@
|
||||
install_sh = @install_sh@
|
||||
|
||||
AUTOMAKE_OPTIONS = 1.5 check-news readme-alpha dist-bzip2
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
SUBDIRS = config intl po lib src doc m4 tests
|
||||
|
||||
EXTRA_DIST = REFERENCES configure.bat OChangeLog Makefile.maint GNUmakefile
|
||||
|
||||
DISTCLEANFILES = intl/libintl.h
|
||||
|
||||
move_if_change = $(srcdir)/config/move-if-change
|
||||
prev_version_file = $(srcdir)/config/prev-version.txt
|
||||
release_archive_dir = releases
|
||||
|
||||
# Uploading betas.
|
||||
hosts = alpha
|
||||
alpha_host = alpha.gnu.org
|
||||
alpha_url_dir = gnu/bison
|
||||
|
||||
# Files to update automatically.
|
||||
wget_files = $(srcdir)/config/config.guess $(srcdir)/config/config.sub \
|
||||
$(srcdir)/config/texinfo.tex
|
||||
|
||||
|
||||
cvs_files = $(srcdir)/config/missing
|
||||
subdir = .
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
|
||||
CONFIG_HEADER = config.h
|
||||
CONFIG_CLEAN_FILES = intl/Makefile
|
||||
DIST_SOURCES =
|
||||
|
||||
RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \
|
||||
uninstall-info-recursive all-recursive install-data-recursive \
|
||||
install-exec-recursive installdirs-recursive install-recursive \
|
||||
uninstall-recursive check-recursive installcheck-recursive
|
||||
DIST_COMMON = README ././stamp-h.in ./stamp-h.in ABOUT-NLS AUTHORS \
|
||||
COPYING ChangeLog INSTALL Makefile.am Makefile.in NEWS \
|
||||
README-alpha THANKS aclocal.m4 config.hin configure \
|
||||
configure.in
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
all: config.h
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-recursive
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) && \
|
||||
CONFIG_HEADERS= CONFIG_LINKS= \
|
||||
CONFIG_FILES=$@ $(SHELL) ./config.status
|
||||
|
||||
$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
$(SHELL) ./config.status --recheck
|
||||
$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
|
||||
cd $(srcdir) && $(AUTOCONF)
|
||||
|
||||
$(ACLOCAL_M4): configure.in m4/c-bs-a.m4 m4/codeset.m4 m4/dmalloc.m4 m4/error.m4 m4/gettext.m4 m4/glibc21.m4 m4/iconv.m4 m4/isc-posix.m4 m4/lcmessage.m4 m4/m4.m4 m4/malloc.m4 m4/mbrtowc.m4 m4/mbstate_t.m4 m4/prereq.m4 m4/progtest.m4 m4/realloc.m4 m4/strerror_r.m4 m4/warning.m4
|
||||
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
|
||||
config.h: stamp-h
|
||||
@if test ! -f $@; then \
|
||||
rm -f stamp-h; \
|
||||
$(MAKE) stamp-h; \
|
||||
else :; fi
|
||||
stamp-h: $(srcdir)/config.hin $(top_builddir)/config.status
|
||||
@rm -f stamp-h stamp-hT
|
||||
@echo timestamp > stamp-hT 2> /dev/null
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES= CONFIG_HEADERS=config.h:config.hin \
|
||||
$(SHELL) ./config.status
|
||||
@mv stamp-hT stamp-h
|
||||
$(srcdir)/config.hin: $(srcdir)/./stamp-h.in
|
||||
@if test ! -f $@; then \
|
||||
rm -f $(srcdir)/./stamp-h.in; \
|
||||
$(MAKE) $(srcdir)/./stamp-h.in; \
|
||||
else :; fi
|
||||
$(srcdir)/./stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
@rm -f $(srcdir)/./stamp-h.in $(srcdir)/./stamp-h.inT
|
||||
@echo timestamp > $(srcdir)/./stamp-h.inT 2> /dev/null
|
||||
cd $(top_srcdir) && $(AUTOHEADER)
|
||||
@mv $(srcdir)/./stamp-h.inT $(srcdir)/./stamp-h.in
|
||||
|
||||
distclean-hdr:
|
||||
-rm -f config.h
|
||||
intl/Makefile: $(top_builddir)/config.status $(top_srcdir)/intl/Makefile.in
|
||||
cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= CONFIG_LINKS= $(SHELL) ./config.status
|
||||
uninstall-info-am:
|
||||
|
||||
# This directory's subdirectories are mostly independent; you can cd
|
||||
# into them and run `make' without going through this Makefile.
|
||||
# To change the values of `make' variables: instead of editing Makefiles,
|
||||
# (1) if the variable is set in `config.status', edit `config.status'
|
||||
# (which will cause the Makefiles to be regenerated when you run `make');
|
||||
# (2) otherwise, pass the desired values on the `make' command line.
|
||||
$(RECURSIVE_TARGETS):
|
||||
@set fnord $(MAKEFLAGS); amf=$$2; \
|
||||
dot_seen=no; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
dot_seen=yes; \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done; \
|
||||
if test "$$dot_seen" = "no"; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
|
||||
fi; test -z "$$fail"
|
||||
|
||||
mostlyclean-recursive clean-recursive distclean-recursive \
|
||||
maintainer-clean-recursive:
|
||||
@set fnord $(MAKEFLAGS); amf=$$2; \
|
||||
dot_seen=no; \
|
||||
case "$@" in \
|
||||
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
|
||||
*) list='$(SUBDIRS)' ;; \
|
||||
esac; \
|
||||
rev=''; for subdir in $$list; do \
|
||||
if test "$$subdir" = "."; then :; else \
|
||||
rev="$$subdir $$rev"; \
|
||||
fi; \
|
||||
done; \
|
||||
rev="$$rev ."; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
for subdir in $$rev; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done && test -z "$$fail"
|
||||
tags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
|
||||
done
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
mkid -fID $$unique $(LISP)
|
||||
|
||||
TAGS: tags-recursive $(HEADERS) $(SOURCES) config.hin $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
|
||||
fi; \
|
||||
done; \
|
||||
list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)config.hin$$unique$(LISP)$$tags" \
|
||||
|| etags $(ETAGS_ARGS) $$tags config.hin $$unique $(LISP)
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& cd $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) $$here
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
top_distdir = .
|
||||
# Avoid unsightly `./'.
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
|
||||
GZIP_ENV = --best
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@if sed 15q $(srcdir)/NEWS | fgrep -e "$(VERSION)" >/dev/null; \
|
||||
then :; else \
|
||||
echo "NEWS not updated; not releasing" 1>&2; \
|
||||
exit 1; \
|
||||
fi
|
||||
-chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
|
||||
mkdir $(distdir)
|
||||
$(mkinstalldirs) $(distdir)/./. $(distdir)/intl $(distdir)/po $(distdir)/tests
|
||||
@for file in $(DISTFILES); do \
|
||||
if test -f $$file; then d=.; else d=$(srcdir); fi; \
|
||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
$(mkinstalldirs) "$(distdir)/$$dir"; \
|
||||
fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pR $$d/$$file $(distdir) \
|
||||
|| exit 1; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
for subdir in $(SUBDIRS); do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test -d $(distdir)/$$subdir \
|
||||
|| mkdir $(distdir)/$$subdir \
|
||||
|| exit 1; \
|
||||
(cd $$subdir && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) \
|
||||
top_distdir="$(top_distdir)" \
|
||||
distdir=../$(distdir)/$$subdir \
|
||||
distdir) \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
|
||||
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
|
||||
|| chmod -R a+r $(distdir)
|
||||
dist-gzip: distdir
|
||||
$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||
-chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
|
||||
|
||||
dist-bzip2: distdir
|
||||
$(AMTAR) chof - $(distdir) | bzip2 -9 -c >$(distdir).tar.bz2
|
||||
-chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
|
||||
|
||||
dist dist-all: distdir
|
||||
$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||
$(AMTAR) chof - $(distdir) | bzip2 -9 -c >$(distdir).tar.bz2
|
||||
-chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
|
||||
|
||||
# This target untars the dist file and tries a VPATH configuration. Then
|
||||
# it guarantees that the distribution is self-contained by making another
|
||||
# tarfile.
|
||||
distcheck: dist
|
||||
-chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir)
|
||||
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf -
|
||||
chmod -R a-w $(distdir); chmod a+w $(distdir)
|
||||
mkdir $(distdir)/=build
|
||||
mkdir $(distdir)/=inst
|
||||
chmod a-w $(distdir)
|
||||
dc_install_base=`$(am__cd) $(distdir)/=inst && pwd` \
|
||||
&& cd $(distdir)/=build \
|
||||
&& ../configure --srcdir=.. --prefix=$$dc_install_base \
|
||||
--with-included-gettext \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) check \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
|
||||
&& (test `find $$dc_install_base -type f -print | wc -l` -le 1 \
|
||||
|| { echo "ERROR: files left after uninstall:" ; \
|
||||
find $$dc_install_base -type f -print ; \
|
||||
exit 1; } >&2 ) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dist-gzip \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distclean \
|
||||
&& rm -f $(distdir).tar.gz \
|
||||
&& (test `find . -type f -print | wc -l` -eq 0 \
|
||||
|| { echo "ERROR: files left after distclean:" ; \
|
||||
find . -type f -print ; \
|
||||
exit 1; } >&2 )
|
||||
-chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir)
|
||||
@echo "$(distdir).tar.gz is ready for distribution" | \
|
||||
sed 'h;s/./=/g;p;x;p;x'
|
||||
check-am: all-am
|
||||
check: check-recursive
|
||||
all-am: Makefile config.h
|
||||
installdirs: installdirs-recursive
|
||||
installdirs-am:
|
||||
|
||||
install: install-recursive
|
||||
install-exec: install-exec-recursive
|
||||
install-data: install-data-recursive
|
||||
uninstall: uninstall-recursive
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-recursive
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
|
||||
-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-recursive
|
||||
|
||||
clean-am: clean-generic mostlyclean-am
|
||||
|
||||
distclean: distclean-recursive
|
||||
-rm -f config.status config.cache config.log
|
||||
distclean-am: clean-am distclean-generic distclean-hdr distclean-tags
|
||||
|
||||
dvi: dvi-recursive
|
||||
|
||||
dvi-am:
|
||||
|
||||
info: info-recursive
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-info: install-info-recursive
|
||||
|
||||
install-man:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive
|
||||
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-recursive
|
||||
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
|
||||
uninstall-am: uninstall-info-am
|
||||
|
||||
uninstall-info: uninstall-info-recursive
|
||||
|
||||
.PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \
|
||||
clean-generic clean-recursive dist dist-all dist-bzip2 \
|
||||
dist-gzip distcheck distclean distclean-generic distclean-hdr \
|
||||
distclean-recursive distclean-tags distdir dvi dvi-am \
|
||||
dvi-recursive info info-am info-recursive install install-am \
|
||||
install-data install-data-am install-data-recursive \
|
||||
install-exec install-exec-am install-exec-recursive \
|
||||
install-info install-info-am install-info-recursive install-man \
|
||||
install-recursive install-strip installcheck installcheck-am \
|
||||
installdirs installdirs-am installdirs-recursive \
|
||||
maintainer-clean maintainer-clean-generic \
|
||||
maintainer-clean-recursive mostlyclean mostlyclean-generic \
|
||||
mostlyclean-recursive tags tags-recursive uninstall \
|
||||
uninstall-am uninstall-info-am uninstall-info-recursive \
|
||||
uninstall-recursive
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
@@ -1,7 +1,282 @@
|
||||
Bison News
|
||||
----------
|
||||
|
||||
Changes in version 1.29d:
|
||||
Changes in version 1.49b, 2002-08-12:
|
||||
|
||||
* GLR parsing
|
||||
The declaration
|
||||
%glr-parser
|
||||
causes Bison to produce a Generalized LR (GLR) parser, capable of handling
|
||||
almost any context-free grammar, ambiguous or not. The new declarations
|
||||
%dprec and %merge on grammar rules allow parse-time resolution of
|
||||
ambiguities. Contributed by Paul Hilfinger.
|
||||
|
||||
* Output Directory
|
||||
When not in Yacc compatibility mode, when the output file was not
|
||||
specified, runnning `bison foo/bar.y' created `foo/bar.c'. It
|
||||
now creates `bar.c'.
|
||||
|
||||
* Undefined token
|
||||
The undefined token was systematically mapped to 2 which prevented
|
||||
the use of 2 from the user. This is no longer the case.
|
||||
|
||||
* Unknown token numbers
|
||||
If yylex returned a code out of range, yyparse could die. This is
|
||||
no longer the case.
|
||||
|
||||
* Error token
|
||||
According to POSIX, the error token should be numbered as 256.
|
||||
Bison extends this requirement by making it a preference: *if* the
|
||||
user specified that one of her tokens is numbered 256, then error
|
||||
will be mapped onto another number.
|
||||
|
||||
* Verbose error messages
|
||||
They no longer report `..., expecting error or...' for state where
|
||||
error recovery is possible.
|
||||
|
||||
* End token
|
||||
Defaults to `$end' instead of `$'.
|
||||
|
||||
* Error recovery now conforms to documentation and to POSIX
|
||||
When a Bison-generated parser encounters a syntax error, it now pops
|
||||
the stack until it finds a state that allows shifting the error
|
||||
token. Formerly, it popped the stack until it found a state that
|
||||
allowed some non-error action other than a default reduction on the
|
||||
error token. The new behavior has long been the documented behavior,
|
||||
and has long been required by POSIX. For more details, please see
|
||||
<http://mail.gnu.org/pipermail/bug-bison/2002-May/001452.html>.
|
||||
|
||||
* Traces
|
||||
Popped tokens and nonterminals are now reported.
|
||||
|
||||
* Larger grammars
|
||||
Larger grammars are now supported (larger token numbers, larger grammar
|
||||
size (= sum of the LHS and RHS lengths), larger LALR tables).
|
||||
Formerly, many of these numbers ran afoul of 16-bit limits;
|
||||
now these limits are 32 bits on most hosts.
|
||||
|
||||
* Explicit initial rule
|
||||
Bison used to play hacks with the initial rule, which the user does
|
||||
not write. It is now explicit, and visible in the reports and
|
||||
graphs as rule 0.
|
||||
|
||||
* Useless rules
|
||||
Before, Bison reported the useless rules, but, although not used,
|
||||
included them in the parsers. They are now actually removed.
|
||||
|
||||
* Useless rules, useless nonterminals
|
||||
They are now reported, as a warning, with their locations.
|
||||
|
||||
* Rules never reduced
|
||||
Rules that can never be reduced because of conflicts are now
|
||||
reported.
|
||||
|
||||
* Incorrect `Token not used'
|
||||
On a grammar such as
|
||||
|
||||
%token useless useful
|
||||
%%
|
||||
exp: '0' %prec useful;
|
||||
|
||||
where a token was used to set the precedence of the last rule,
|
||||
bison reported both `useful' and `useless' as useless tokens.
|
||||
|
||||
* Revert the C++ namespace changes introduced in 1.31
|
||||
as they caused too many portability hassles.
|
||||
|
||||
* Default locations
|
||||
By an accident of design, the default computation of @$ was
|
||||
performed after another default computation was performed: @$ = @1.
|
||||
The latter is now removed: YYLLOC_DEFAULT is fully responsible of
|
||||
the computation of @$.
|
||||
|
||||
* Token end-of-file
|
||||
The token end of file may be specified by the user, in which case,
|
||||
the user symbol is used in the reports, the graphs, and the verbose
|
||||
error messages instead of `$end', which remains being the default.
|
||||
For instance
|
||||
%token YYEOF 0
|
||||
or
|
||||
%token YYEOF 0 "end of file"
|
||||
|
||||
* Semantic parser
|
||||
This old option, which has been broken for ages, is removed.
|
||||
|
||||
* New translations
|
||||
Brazilian Portuguese, thanks to Alexandre Folle de Menezes.
|
||||
Croatian, thanks to Denis Lackovic.
|
||||
|
||||
* Incorrect token definitions
|
||||
When fed with `%token 'a' "A"', Bison used to output `#define 'a' 65'.
|
||||
|
||||
* Token definitions as enums
|
||||
Tokens are output both as the traditional #define's, and, provided
|
||||
the compiler supports ANSI C or is a C++ compiler, as enums.
|
||||
This helps debuggers producing symbols instead of values.
|
||||
|
||||
* Reports
|
||||
In addition to --verbose, bison supports --report=THINGS, which
|
||||
produces additional information:
|
||||
- itemset
|
||||
complete the core item sets with their closure
|
||||
- lookahead
|
||||
explicitly associate lookaheads to items
|
||||
- solved
|
||||
describe shift/reduce conflicts solving.
|
||||
Bison used to systematically output this information on top of
|
||||
the report. Solved conflicts are now attached to their states.
|
||||
|
||||
* Type clashes
|
||||
Previous versions don't complain when there is a type clash on
|
||||
the default action if the rule has a mid-rule action, such as in:
|
||||
|
||||
%type <foo> bar
|
||||
%%
|
||||
bar: '0' {} '0';
|
||||
|
||||
This is fixed.
|
||||
|
||||
* GNU M4 is now required when using Bison.
|
||||
|
||||
Changes in version 1.35, 2002-03-25:
|
||||
|
||||
* C Skeleton
|
||||
Some projects use Bison's C parser with C++ compilers, and define
|
||||
YYSTYPE as a class. The recent adjustment of C parsers for data
|
||||
alignment and 64 bit architectures made this impossible.
|
||||
|
||||
Because for the time being no real solution for C++ parser
|
||||
generation exists, kludges were implemented in the parser to
|
||||
maintain this use. In the future, when Bison has C++ parsers, this
|
||||
kludge will be disabled.
|
||||
|
||||
This kludge also addresses some C++ problems when the stack was
|
||||
extended.
|
||||
|
||||
|
||||
Changes in version 1.34, 2002-03-12:
|
||||
|
||||
* File name clashes are detected
|
||||
$ bison foo.y -d -o foo.x
|
||||
fatal error: header and parser would both be named `foo.x'
|
||||
|
||||
* A missing `;' at the end of a rule triggers a warning
|
||||
In accordance with POSIX, and in agreement with other
|
||||
Yacc implementations, Bison will mandate this semicolon in the near
|
||||
future. This eases the implementation of a Bison parser of Bison
|
||||
grammars by making this grammar LALR(1) instead of LR(2). To
|
||||
facilitate the transition, this release introduces a warning.
|
||||
|
||||
* Revert the C++ namespace changes introduced in 1.31, as they caused too
|
||||
many portability hassles.
|
||||
|
||||
* DJGPP support added.
|
||||
|
||||
* Fix test suite portability problems.
|
||||
|
||||
Changes in version 1.33, 2002-02-07:
|
||||
|
||||
* Fix C++ issues
|
||||
Groff could not be compiled for the definition of size_t was lacking
|
||||
under some conditions.
|
||||
|
||||
* Catch invalid @n
|
||||
As is done with $n.
|
||||
|
||||
Changes in version 1.32, 2002-01-23:
|
||||
|
||||
* Fix Yacc output file names
|
||||
|
||||
* Portability fixes
|
||||
|
||||
* Italian, Dutch translations
|
||||
|
||||
Changes in version 1.31, 2002-01-14:
|
||||
|
||||
* Many Bug Fixes
|
||||
|
||||
* GNU Gettext and %expect
|
||||
GNU Gettext asserts 10 s/r conflicts, but there are 7. Now that
|
||||
Bison dies on incorrect %expectations, we fear there will be
|
||||
too many bug reports for Gettext, so _for the time being_, %expect
|
||||
does not trigger an error when the input file is named `plural.y'.
|
||||
|
||||
* Use of alloca in parsers
|
||||
If YYSTACK_USE_ALLOCA is defined to 0, then the parsers will use
|
||||
malloc exclusively. Since 1.29, but was not NEWS'ed.
|
||||
|
||||
alloca is used only when compiled with GCC, to avoid portability
|
||||
problems as on AIX.
|
||||
|
||||
* When the generated parser lacks debugging code, YYDEBUG is now 0
|
||||
(as POSIX requires) instead of being undefined.
|
||||
|
||||
* User Actions
|
||||
Bison has always permitted actions such as { $$ = $1 }: it adds the
|
||||
ending semicolon. Now if in Yacc compatibility mode, the semicolon
|
||||
is no longer output: one has to write { $$ = $1; }.
|
||||
|
||||
* Better C++ compliance
|
||||
The output parsers try to respect C++ namespaces.
|
||||
[This turned out to be a failed experiment, and it was reverted later.]
|
||||
|
||||
* Reduced Grammars
|
||||
Fixed bugs when reporting useless nonterminals.
|
||||
|
||||
* 64 bit hosts
|
||||
The parsers work properly on 64 bit hosts.
|
||||
|
||||
* Error messages
|
||||
Some calls to strerror resulted in scrambled or missing error messages.
|
||||
|
||||
* %expect
|
||||
When the number of shift/reduce conflicts is correct, don't issue
|
||||
any warning.
|
||||
|
||||
* The verbose report includes the rule line numbers.
|
||||
|
||||
* Rule line numbers are fixed in traces.
|
||||
|
||||
* Swedish translation
|
||||
|
||||
* Parse errors
|
||||
Verbose parse error messages from the parsers are better looking.
|
||||
Before: parse error: unexpected `'/'', expecting `"number"' or `'-'' or `'(''
|
||||
Now: parse error: unexpected '/', expecting "number" or '-' or '('
|
||||
|
||||
* Fixed parser memory leaks.
|
||||
When the generated parser was using malloc to extend its stacks, the
|
||||
previous allocations were not freed.
|
||||
|
||||
* Fixed verbose output file.
|
||||
Some newlines were missing.
|
||||
Some conflicts in state descriptions were missing.
|
||||
|
||||
* Fixed conflict report.
|
||||
Option -v was needed to get the result.
|
||||
|
||||
* %expect
|
||||
Was not used.
|
||||
Mismatches are errors, not warnings.
|
||||
|
||||
* Fixed incorrect processing of some invalid input.
|
||||
|
||||
* Fixed CPP guards: 9foo.h uses BISON_9FOO_H instead of 9FOO_H.
|
||||
|
||||
* Fixed some typos in the documentation.
|
||||
|
||||
* %token MY_EOF 0 is supported.
|
||||
Before, MY_EOF was silently renumbered as 257.
|
||||
|
||||
* doc/refcard.tex is updated.
|
||||
|
||||
* %output, %file-prefix, %name-prefix.
|
||||
New.
|
||||
|
||||
* --output
|
||||
New, aliasing `--output-file'.
|
||||
|
||||
Changes in version 1.30, 2001-10-26:
|
||||
|
||||
* `--defines' and `--graph' have now an optionnal argument which is the
|
||||
output file name. `-d' and `-g' do not change, they do not take any
|
||||
@@ -10,11 +285,9 @@ Changes in version 1.29d:
|
||||
* `%source_extension' and `%header_extension' are removed, failed
|
||||
experiment.
|
||||
|
||||
* The test suite is more portable.
|
||||
|
||||
* Better portability.
|
||||
|
||||
Changes in version 1.29:
|
||||
* Portability fixes.
|
||||
|
||||
Changes in version 1.29, 2001-09-07:
|
||||
|
||||
* The output file does not define const, as this caused problems when used
|
||||
with common autoconfiguration schemes. If you still use ancient compilers
|
||||
@@ -45,8 +318,11 @@ Changes in version 1.29:
|
||||
* New directives.
|
||||
`%yacc', `%fixed_output_files', `%defines', `%no_parser', `%verbose',
|
||||
`%debug', `%source_extension' and `%header_extension'.
|
||||
|
||||
* @$
|
||||
Automatic location tracking.
|
||||
|
||||
Changes in version 1.28:
|
||||
Changes in version 1.28, 1999-07-06:
|
||||
|
||||
* Should compile better now with K&R compilers.
|
||||
|
||||
@@ -78,7 +354,7 @@ Changes in version 1.26:
|
||||
* Generated parsers should now work even on operating systems which do
|
||||
not provide alloca().
|
||||
|
||||
Changes in version 1.25:
|
||||
Changes in version 1.25, 1995-10-16:
|
||||
|
||||
* Errors in the input grammar are not fatal; Bison keeps reading
|
||||
the grammar file, and reports all the errors found in it.
|
||||
@@ -119,3 +395,28 @@ Changes in version 1.22:
|
||||
Changes in version 1.20:
|
||||
|
||||
Output file does not redefine const for C++.
|
||||
|
||||
Local Variables:
|
||||
mode: outline
|
||||
End:
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2001, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Autoconf.
|
||||
|
||||
GNU Autoconf 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.
|
||||
|
||||
GNU Autoconf 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 autoconf; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
-*- outline -*-
|
||||
|
||||
These notes intend to help people working on the CVS versions of
|
||||
Bison.
|
||||
|
||||
* Requirements
|
||||
|
||||
Only the sources are installed in the CVS repository (to ease the
|
||||
maintenance, merges etc.), therefore you will have to the maintainer
|
||||
tools we depend upon:
|
||||
|
||||
- Automake 1.6 or 1.6.1
|
||||
|
||||
- Autoconf 2.53a or better
|
||||
ftp://alpha.gnu.org/gnu/autoconf/autoconf-2.53a.tar.gz (992 kB)
|
||||
ftp://alpha.gnu.org/gnu/autoconf/autoconf-2.53a.tar.bz2 (756 kB)
|
||||
|
||||
- Gettext 0.11.3 pre 2 or better
|
||||
http://www.lrde.epita.fr/~akim/download/gettext-0.11.3-pre2.tar.gz
|
||||
|
||||
Only building the initial full source tree will be a bit painful,
|
||||
later, a plain `cvs update -P & make' should be sufficient.
|
||||
|
||||
* First CVS checkout
|
||||
|
||||
Obviously, if you are reading these notes, you did manage to check out
|
||||
Bison from CVS. For the records, you will find all the relevant
|
||||
information on:
|
||||
|
||||
http://savannah.gnu.org/cvs/?group_id=56
|
||||
|
||||
The next step is asking the installation of all the missing files:
|
||||
|
||||
$ ./bootstrap
|
||||
|
||||
And there you are! Just
|
||||
|
||||
$ ./configure && make && make check
|
||||
|
||||
At this point, there should be no difference between your local copy,
|
||||
and the CVS master copy:
|
||||
|
||||
$ cvs diff
|
||||
|
||||
should output no difference, except maybe the date in po/*.po files.
|
||||
|
||||
Enjoy!
|
||||
|
||||
* Troubleshooting
|
||||
|
||||
Unfortunately the current Gettext still does not include all the
|
||||
needed tools so that the bootstrapping always perform successfully.
|
||||
|
||||
If you experiment problems, I suggest the following:
|
||||
|
||||
1. Do a regular CVS checkout
|
||||
|
||||
2. Fetch a recent tarball.
|
||||
http://www.lrde.epita.fr/~akim/download/bison-1.49b.tar.gz
|
||||
|
||||
3. Extract it
|
||||
|
||||
4. Override the content of your checkout with the content of this
|
||||
tarball, i.e.:
|
||||
cp -r bison-1.49b/* bison-cvs
|
||||
|
||||
5. Proceed on ./configure && make etc.
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bison.
|
||||
|
||||
GNU Bison 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.
|
||||
|
||||
GNU Bison 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 Bison; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
@@ -1,28 +1,59 @@
|
||||
Bison was originally written by Robert Corbett. It would not be what
|
||||
it is today without the invaluable help of these people:
|
||||
|
||||
Airy Andre [email protected]
|
||||
Akim Demaille [email protected]
|
||||
Albert Chin-A-Young [email protected]
|
||||
Alexander Belopolsky [email protected]
|
||||
Daniel Hagerty [email protected]
|
||||
David J. MacKenzie [email protected]
|
||||
Fabrice Bauzac [email protected]
|
||||
Hans Aberg [email protected]
|
||||
Jesse Thilo [email protected]
|
||||
Jim Meyering [email protected]
|
||||
Juan Manuel Guerrero [email protected]
|
||||
Keith Browne [email protected]
|
||||
Laurent Mascherpa [email protected]
|
||||
Marc Autret [email protected]
|
||||
Neil Booth [email protected]
|
||||
Noah Friedman [email protected]
|
||||
Pascal Bart [email protected]
|
||||
Paul Eggert [email protected]
|
||||
Piotr Gackiewicz [email protected]
|
||||
Richard Stallman rms@gnu.org
|
||||
Robert Anisko [email protected]
|
||||
Shura [email protected]
|
||||
Airy Andre [email protected]
|
||||
Akim Demaille [email protected]
|
||||
Albert Chin-A-Young [email protected]
|
||||
Alexander Belopolsky [email protected]
|
||||
Andreas Schwab [email protected]
|
||||
Arnold Robbins [email protected]
|
||||
Benoit Perrot [email protected]
|
||||
Bruce Lilly [email protected]
|
||||
Cris Bailiff [email protected]
|
||||
Cris van Pelt [email protected]
|
||||
Daniel Hagerty [email protected]
|
||||
David J. MacKenzie [email protected]
|
||||
Dick Streefland [email protected]
|
||||
Enrico Scholz [email protected]
|
||||
Evgeny Stambulchik [email protected]
|
||||
Fabrice Bauzac [email protected]
|
||||
Florian Krohm [email protected]
|
||||
H. Merijn Brand [email protected]
|
||||
Hans Aberg [email protected]
|
||||
Jesse Thilo jthilo@gnu.org
|
||||
Jim Meyering [email protected]
|
||||
Juan Manuel Guerrero [email protected]
|
||||
Kees Zeelenberg [email protected]
|
||||
Keith Browne [email protected]
|
||||
Laurent Mascherpa [email protected]
|
||||
Magnus Fromreide [email protected]
|
||||
Marc Autret [email protected]
|
||||
Matt Kraai [email protected]
|
||||
Michael Hayes [email protected]
|
||||
Mike Castle [email protected]
|
||||
Neil Booth [email protected]
|
||||
Nelson H. F. Beebe [email protected]
|
||||
Nicolas Burrus [email protected]
|
||||
Nicolas Tisserand [email protected]
|
||||
Noah Friedman [email protected]
|
||||
Pascal Bart [email protected]
|
||||
Paul Eggert [email protected]
|
||||
Paul Hilfinger [email protected]
|
||||
Per Allansson [email protected]
|
||||
Peter Hámorský [email protected]
|
||||
Piotr Gackiewicz [email protected]
|
||||
R Blake [email protected]
|
||||
Raja R Harinath [email protected]
|
||||
Richard Stallman [email protected]
|
||||
Robert Anisko [email protected]
|
||||
Shura [email protected]
|
||||
Tim Josling [email protected]
|
||||
Tom Lane [email protected]
|
||||
Tom Tromey [email protected]
|
||||
Wayne Green [email protected]
|
||||
Wolfram Wagner [email protected]
|
||||
Wwp [email protected]
|
||||
Zack Weinberg [email protected]
|
||||
|
||||
Many people are not named here because we lost track of them. We
|
||||
thank them! Please, help us keeping this list up to date.
|
||||
|
||||
@@ -0,0 +1,298 @@
|
||||
-*- outline -*-
|
||||
|
||||
* URGENT: Documenting C++ output
|
||||
Write a first documentation for C++ output.
|
||||
|
||||
|
||||
* Documentation
|
||||
Before releasing, make sure the documentation refers to the current
|
||||
`output' format.
|
||||
|
||||
|
||||
* Error messages
|
||||
Some are really funky. For instance
|
||||
|
||||
type clash (`%s' `%s') on default action
|
||||
|
||||
is really weird. Revisit them all.
|
||||
|
||||
|
||||
* read_pipe.c
|
||||
This is not portable to DOS for instance. Implement a more portable
|
||||
scheme. Sources of inspiration include GNU diff, and Free Recode.
|
||||
|
||||
|
||||
* value_components_used
|
||||
Was defined but not used: where was it coming from? It can't be to
|
||||
check if %union is used, since the user is free to $<foo>n on her
|
||||
union, doesn't she?
|
||||
|
||||
|
||||
* Report
|
||||
|
||||
** GLR
|
||||
How would Paul like to display the conflicted actions? In particular,
|
||||
what when two reductions are possible on a given lookahead, but one is
|
||||
part of $default. Should we make the two reductions explicit, or just
|
||||
keep $default? See the following point.
|
||||
|
||||
** Disabled Reductions
|
||||
See `tests/conflicts.at (Defaulted Conflicted Reduction)', and decide
|
||||
what we want to do.
|
||||
|
||||
** Documentation
|
||||
Extend with error productions. The hard part will probably be finding
|
||||
the right rule so that a single state does not exhibit too many yet
|
||||
undocumented ``features''. Maybe an empty action ought to be
|
||||
presented too. Shall we try to make a single grammar with all these
|
||||
features, or should we have several very small grammars?
|
||||
|
||||
** --report=conflict-path
|
||||
Provide better assistance for understanding the conflicts by providing
|
||||
a sample text exhibiting the (LALR) ambiguity. See the paper from
|
||||
DeRemer and Penello: they already provide the algorithm.
|
||||
|
||||
|
||||
* Extentions
|
||||
|
||||
** yyerror, yysymprint interface
|
||||
It should be improved, in particular when using Bison features such as
|
||||
locations, and YYPARSE_PARAMS. For the time being, it is recommended
|
||||
to #define yyerror and yyprint to steal internal variables...
|
||||
|
||||
** Several %unions
|
||||
I think this is a pleasant (but useless currently) feature, but in the
|
||||
future, I want a means to %include other bits of grammars, and _then_
|
||||
it will be important for the various bits to define their needs in
|
||||
%union.
|
||||
|
||||
When implementing multiple-%union support, bare the following in mind:
|
||||
|
||||
- when --yacc, this must be flagged as an error. Don't make it fatal
|
||||
though.
|
||||
|
||||
- The #line must now appear *inside* the definition of yystype.
|
||||
Something like
|
||||
|
||||
{
|
||||
#line 12 "foo.y"
|
||||
int ival;
|
||||
#line 23 "foo.y"
|
||||
char *sval;
|
||||
}
|
||||
|
||||
* Unit rules
|
||||
Maybe we could expand unit rules, i.e., transform
|
||||
|
||||
exp: arith | bool;
|
||||
arith: exp '+' exp;
|
||||
bool: exp '&' exp;
|
||||
|
||||
into
|
||||
|
||||
exp: exp '+' exp | exp '&' exp;
|
||||
|
||||
when there are no actions. This can significantly speed up some
|
||||
grammars. I can't find the papers. In particular the book `LR
|
||||
parsing: Theory and Practice' is impossible to find, but according to
|
||||
`Parsing Techniques: a Practical Guide', it includes information about
|
||||
this issue. Does anybody have it?
|
||||
|
||||
|
||||
|
||||
* Documentation
|
||||
|
||||
** History/Bibliography
|
||||
Some history of Bison and some bibliography would be most welcome.
|
||||
Are there any Texinfo standards for bibliography?
|
||||
|
||||
|
||||
|
||||
|
||||
* Coding system independence
|
||||
Paul notes:
|
||||
|
||||
Currently Bison assumes 8-bit bytes (i.e. that UCHAR_MAX is
|
||||
255). It also assumes that the 8-bit character encoding is
|
||||
the same for the invocation of 'bison' as it is for the
|
||||
invocation of 'cc', but this is not necessarily true when
|
||||
people run bison on an ASCII host and then use cc on an EBCDIC
|
||||
host. I don't think these topics are worth our time
|
||||
addressing (unless we find a gung-ho volunteer for EBCDIC or
|
||||
PDP-10 ports :-) but they should probably be documented
|
||||
somewhere.
|
||||
|
||||
|
||||
|
||||
* --graph
|
||||
Show reductions. []
|
||||
|
||||
* Broken options ?
|
||||
** %no-lines [ok]
|
||||
** %no-parser []
|
||||
** %pure-parser []
|
||||
** %token-table []
|
||||
** Options which could use parse_dquoted_param ().
|
||||
Maybe transfered in lex.c.
|
||||
*** %skeleton [ok]
|
||||
*** %output []
|
||||
*** %file-prefix []
|
||||
*** %name-prefix []
|
||||
|
||||
** Skeleton strategy. []
|
||||
Must we keep %no-parser?
|
||||
%token-table?
|
||||
*** New skeletons. []
|
||||
|
||||
* src/print_graph.c
|
||||
Find the best graph parameters. []
|
||||
|
||||
* doc/bison.texinfo
|
||||
** Update
|
||||
informations about ERROR_VERBOSE. []
|
||||
** Add explainations about
|
||||
skeleton muscles. []
|
||||
%skeleton. []
|
||||
|
||||
* testsuite
|
||||
** tests/pure-parser.at []
|
||||
New tests.
|
||||
|
||||
* input synclines
|
||||
Some users create their foo.y files, and equip them with #line. Bison
|
||||
should recognize these, and preserve them.
|
||||
|
||||
* BTYacc
|
||||
See if we can integrate backtracking in Bison. Contact the BTYacc
|
||||
maintainers.
|
||||
|
||||
** Keeping the conflicted actions
|
||||
First, analyze the differences between byacc and btyacc (I'm referring
|
||||
to the executables). Find where the conflicts are preserved.
|
||||
|
||||
** Compare with the GLR tables
|
||||
See how isomorphic the way BTYacc and the way the GLR adjustements in
|
||||
Bison are compatible. *As much as possible* one should try to use the
|
||||
same implementation in the Bison executables. I insist: it should be
|
||||
very feasible to use the very same conflict tables.
|
||||
|
||||
** Adjust the skeletons
|
||||
Import the skeletons for C and C++.
|
||||
|
||||
** Improve the skeletons
|
||||
Have them support yysymprint, yydestruct and so forth.
|
||||
|
||||
|
||||
* Precedence
|
||||
|
||||
** Partial order
|
||||
It is unfortunate that there is a total order for precedence. It
|
||||
makes it impossible to have modular precedence information. We should
|
||||
move to partial orders (sounds like series/parallel orders to me).
|
||||
|
||||
This will be possible with a Bison parser for the grammar, as it will
|
||||
make it much easier to extend the grammar.
|
||||
|
||||
** Correlation b/w precedence and associativity
|
||||
Also, I fail to understand why we have to assign the same
|
||||
associativity to operators with the same precedence. For instance,
|
||||
why can't I decide that the precedence of * and / is the same, but the
|
||||
latter is nonassoc?
|
||||
|
||||
If there is really no profound motivation, we should find a new syntax
|
||||
to allow specifying this.
|
||||
|
||||
** RR conflicts
|
||||
See if we can use precedence between rules to solve RR conflicts. See
|
||||
what POSIX says.
|
||||
|
||||
|
||||
* $undefined
|
||||
From Hans:
|
||||
- If the Bison generated parser experiences an undefined number in the
|
||||
character range, that character is written out in diagnostic messages, an
|
||||
addition to the $undefined value.
|
||||
|
||||
Suggest: Change the name $undefined to undefined; looks better in outputs.
|
||||
|
||||
|
||||
* Default Action
|
||||
From Hans:
|
||||
- For use with my C++ parser, I transported the "switch (yyn)" statement
|
||||
that Bison writes to the bison.simple skeleton file. This way, I can remove
|
||||
the current default rule $$ = $1 implementation, which causes a double
|
||||
assignment to $$ which may not be OK under C++, replacing it with a
|
||||
"default:" part within the switch statement.
|
||||
|
||||
Note that the default rule $$ = $1, when typed, is perfectly OK under C,
|
||||
but in the C++ implementation I made, this rule is different from
|
||||
$<type_name>$ = $<type_name>1. I therefore think that one should implement
|
||||
a Bison option where every typed default rule is explicitly written out
|
||||
(same typed ruled can of course be grouped together).
|
||||
|
||||
Note: Robert Anisko handles this. He knows how to do it.
|
||||
|
||||
|
||||
* Warnings
|
||||
It would be nice to have warning support. See how Autoconf handles
|
||||
them, it is fairly well described there. It would be very nice to
|
||||
implement this in such a way that other programs could use
|
||||
lib/warnings.[ch].
|
||||
|
||||
Don't work on this without first announcing you do, as I already have
|
||||
thought about it, and know many of the components that can be used to
|
||||
implement it.
|
||||
|
||||
|
||||
* Pre and post actions.
|
||||
From: Florian Krohm <[email protected]>
|
||||
Subject: YYACT_EPILOGUE
|
||||
To: [email protected]
|
||||
X-Sent: 1 week, 4 days, 14 hours, 38 minutes, 11 seconds ago
|
||||
|
||||
The other day I had the need for explicitly building the parse tree. I
|
||||
used %locations for that and defined YYLLOC_DEFAULT to call a function
|
||||
that returns the tree node for the production. Easy. But I also needed
|
||||
to assign the S-attribute to the tree node. That cannot be done in
|
||||
YYLLOC_DEFAULT, because it is invoked before the action is executed.
|
||||
The way I solved this was to define a macro YYACT_EPILOGUE that would
|
||||
be invoked after the action. For reasons of symmetry I also added
|
||||
YYACT_PROLOGUE. Although I had no use for that I can envision how it
|
||||
might come in handy for debugging purposes.
|
||||
All is needed is to add
|
||||
|
||||
#if YYLSP_NEEDED
|
||||
YYACT_EPILOGUE (yyval, (yyvsp - yylen), yylen, yyloc, (yylsp - yylen));
|
||||
#else
|
||||
YYACT_EPILOGUE (yyval, (yyvsp - yylen), yylen);
|
||||
#endif
|
||||
|
||||
at the proper place to bison.simple. Ditto for YYACT_PROLOGUE.
|
||||
|
||||
I was wondering what you think about adding YYACT_PROLOGUE/EPILOGUE
|
||||
to bison. If you're interested, I'll work on a patch.
|
||||
|
||||
* Move to Graphviz
|
||||
Well, VCG seems really dead. Move to Graphviz instead. Also, equip
|
||||
the parser with a means to create the (visual) parse tree.
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2001, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bison.
|
||||
|
||||
GNU Bison 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.
|
||||
|
||||
GNU Bison 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 Bison; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
Vendored
-1535
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,6 @@
|
||||
#! /bin/sh
|
||||
|
||||
echo "Bootstrapping CVS Bison..."
|
||||
|
||||
echo "running: autoreconf --verbose --install --force"
|
||||
autoreconf --verbose --install --force
|
||||
@@ -1,2 +1,9 @@
|
||||
Makefile
|
||||
*.t
|
||||
Makefile.in
|
||||
mkinstalldirs
|
||||
missing
|
||||
config.sub
|
||||
config.guess
|
||||
mdate-sh
|
||||
texinfo.tex
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
||||
EXTRA_DIST = move-if-change prev-version.txt
|
||||
EXTRA_DIST = move-if-change prev-version.txt config.rpath
|
||||
|
||||
@@ -1,221 +0,0 @@
|
||||
# Makefile.in generated automatically by automake 1.5a from Makefile.am.
|
||||
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
|
||||
# Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = @program_transform_name@
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
|
||||
EXEEXT = @EXEEXT@
|
||||
OBJEXT = @OBJEXT@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
AMTAR = @AMTAR@
|
||||
AWK = @AWK@
|
||||
BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@
|
||||
CATALOGS = @CATALOGS@
|
||||
CATOBJEXT = @CATOBJEXT@
|
||||
CC = @CC@
|
||||
CPP = @CPP@
|
||||
DATADIRNAME = @DATADIRNAME@
|
||||
DEPDIR = @DEPDIR@
|
||||
GENCAT = @GENCAT@
|
||||
GLIBC21 = @GLIBC21@
|
||||
GMOFILES = @GMOFILES@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
INSTOBJEXT = @INSTOBJEXT@
|
||||
INTLBISON = @INTLBISON@
|
||||
INTLLIBS = @INTLLIBS@
|
||||
INTLOBJS = @INTLOBJS@
|
||||
INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@
|
||||
LIBICONV = @LIBICONV@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
M4 = @M4@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
MSGFMT = @MSGFMT@
|
||||
PACKAGE = @PACKAGE@
|
||||
POFILES = @POFILES@
|
||||
POSUB = @POSUB@
|
||||
RANLIB = @RANLIB@
|
||||
U = @U@
|
||||
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
|
||||
USE_NLS = @USE_NLS@
|
||||
VERSION = @VERSION@
|
||||
WARNING_CFLAGS = @WARNING_CFLAGS@
|
||||
am__include = @am__include@
|
||||
am__quote = @am__quote@
|
||||
install_sh = @install_sh@
|
||||
|
||||
EXTRA_DIST = move-if-change prev-version.txt
|
||||
subdir = config
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
DIST_SOURCES =
|
||||
DIST_COMMON = Makefile.am Makefile.in config.guess config.sub depcomp \
|
||||
install-sh mdate-sh missing mkinstalldirs texinfo.tex
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu config/Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) && \
|
||||
CONFIG_HEADERS= CONFIG_LINKS= \
|
||||
CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
|
||||
uninstall-info-am:
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
top_distdir = ..
|
||||
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@for file in $(DISTFILES); do \
|
||||
if test -f $$file; then d=.; else d=$(srcdir); fi; \
|
||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
$(mkinstalldirs) "$(distdir)/$$dir"; \
|
||||
fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pR $$d/$$file $(distdir) \
|
||||
|| exit 1; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile
|
||||
|
||||
installdirs:
|
||||
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
|
||||
distclean-am: clean-am distclean-generic
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-man:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
|
||||
uninstall-am: uninstall-info-am
|
||||
|
||||
.PHONY: all all-am check check-am clean clean-generic distclean \
|
||||
distclean-generic distdir dvi dvi-am info info-am install \
|
||||
install-am install-data install-data-am install-exec \
|
||||
install-exec-am install-info install-info-am install-man \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
maintainer-clean maintainer-clean-generic mostlyclean \
|
||||
mostlyclean-generic uninstall uninstall-am uninstall-info-am
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
Vendored
-1308
File diff suppressed because it is too large
Load Diff
Vendored
-1413
File diff suppressed because it is too large
Load Diff
+119
-107
@@ -31,7 +31,16 @@ if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
||||
fi
|
||||
# `libtool' can also be set to `yes' or `no'.
|
||||
|
||||
depfile=${depfile-`echo "$object" | sed 's,\([^/]*\)$,.deps/\1,;s/\.\([^.]*\)$/.P\1/'`}
|
||||
if test -z "$depfile"; then
|
||||
base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'`
|
||||
dir=`echo "$object" | sed 's,/.*$,/,'`
|
||||
if test "$dir" = "$object"; then
|
||||
dir=
|
||||
fi
|
||||
# FIXME: should be _deps on DOS.
|
||||
depfile="$dir.deps/$base"
|
||||
fi
|
||||
|
||||
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
||||
|
||||
rm -f "$tmpdepfile"
|
||||
@@ -198,17 +207,22 @@ aix)
|
||||
;;
|
||||
|
||||
tru64)
|
||||
# The Tru64 AIX compiler uses -MD to generate dependencies as a side
|
||||
# The Tru64 compiler uses -MD to generate dependencies as a side
|
||||
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
|
||||
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||
# dependencies in `foo.d' instead, so we check for that too.
|
||||
# Subdirectories are respected.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
|
||||
tmpdepfile1="$object.d"
|
||||
tmpdepfile2=`echo "$object" | sed -e 's/.o$/.d/'`
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1="$dir.libs/$base.lo.d"
|
||||
tmpdepfile2="$dir.libs/$base.d"
|
||||
"$@" -Wc,-MD
|
||||
else
|
||||
tmpdepfile1="$dir$base.o.d"
|
||||
tmpdepfile2="$dir$base.d"
|
||||
"$@" -MD
|
||||
fi
|
||||
|
||||
@@ -240,34 +254,40 @@ tru64)
|
||||
|
||||
dashmstdout)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the proprocessed file to stdout, regardless of -o,
|
||||
# because we must use -o when running libtool.
|
||||
test -z "$dashmflag" && dashmflag=-M
|
||||
( IFS=" "
|
||||
case " $* " in
|
||||
*" --mode=compile "*) # this is libtool, let us make it quiet
|
||||
for arg
|
||||
do # cycle over the arguments
|
||||
case "$arg" in
|
||||
"--mode=compile")
|
||||
# insert --quiet before "--mode=compile"
|
||||
set fnord "$@" --quiet
|
||||
shift # fnord
|
||||
;;
|
||||
esac
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # "$arg"
|
||||
done
|
||||
# always write the proprocessed file to stdout, regardless of -o.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test $1 != '--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove `-o $object'. We will use -o /dev/null later,
|
||||
# however we can't do the remplacement now because
|
||||
# `-o $object' might simply not be used
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
"$@" $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
|
||||
) &
|
||||
proc=$!
|
||||
"$@"
|
||||
stat=$?
|
||||
wait "$proc"
|
||||
if test "$stat" != 0; then exit $stat; fi
|
||||
done
|
||||
|
||||
test -z "$dashmflag" && dashmflag=-M
|
||||
"$@" -o /dev/null $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
tr ' ' '
|
||||
@@ -285,36 +305,31 @@ dashXmstdout)
|
||||
;;
|
||||
|
||||
makedepend)
|
||||
"$@" || exit $?
|
||||
# X makedepend
|
||||
(
|
||||
shift
|
||||
cleared=no
|
||||
for arg in "$@"; do
|
||||
case $cleared in no)
|
||||
set ""; shift
|
||||
cleared=yes
|
||||
esac
|
||||
case "$arg" in
|
||||
-D*|-I*)
|
||||
set fnord "$@" "$arg"; shift;;
|
||||
-*)
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"; shift;;
|
||||
esac
|
||||
done
|
||||
obj_suffix="`echo $object | sed 's/^.*\././'`"
|
||||
touch "$tmpdepfile"
|
||||
${MAKEDEPEND-makedepend} 2>/dev/null -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
||||
) &
|
||||
proc=$!
|
||||
"$@"
|
||||
stat=$?
|
||||
wait "$proc"
|
||||
if test "$stat" != 0; then exit $stat; fi
|
||||
shift
|
||||
cleared=no
|
||||
for arg in "$@"; do
|
||||
case $cleared in
|
||||
no)
|
||||
set ""; shift
|
||||
cleared=yes ;;
|
||||
esac
|
||||
case "$arg" in
|
||||
-D*|-I*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
-*)
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
esac
|
||||
done
|
||||
obj_suffix="`echo $object | sed 's/^.*\././'`"
|
||||
touch "$tmpdepfile"
|
||||
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
tail +3 "$tmpdepfile" | tr ' ' '
|
||||
sed '1,2d' "$tmpdepfile" | tr ' ' '
|
||||
' | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
@@ -324,35 +339,39 @@ makedepend)
|
||||
|
||||
cpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the proprocessed file to stdout, regardless of -o,
|
||||
# because we must use -o when running libtool.
|
||||
( IFS=" "
|
||||
case " $* " in
|
||||
*" --mode=compile "*)
|
||||
for arg
|
||||
do # cycle over the arguments
|
||||
case $arg in
|
||||
"--mode=compile")
|
||||
# insert --quiet before "--mode=compile"
|
||||
set fnord "$@" --quiet
|
||||
shift # fnord
|
||||
;;
|
||||
esac
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # "$arg"
|
||||
done
|
||||
# always write the proprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test $1 != '--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove `-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
"$@" -E |
|
||||
done
|
||||
|
||||
"$@" -E |
|
||||
sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
|
||||
sed '$ s: \\$::' > "$tmpdepfile"
|
||||
) &
|
||||
proc=$!
|
||||
"$@"
|
||||
stat=$?
|
||||
wait "$proc"
|
||||
if test "$stat" != 0; then exit $stat; fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
cat < "$tmpdepfile" >> "$depfile"
|
||||
@@ -364,32 +383,25 @@ msvisualcpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the proprocessed file to stdout, regardless of -o,
|
||||
# because we must use -o when running libtool.
|
||||
( IFS=" "
|
||||
case " $* " in
|
||||
*" --mode=compile "*)
|
||||
for arg
|
||||
do # cycle over the arguments
|
||||
case $arg in
|
||||
"--mode=compile")
|
||||
# insert --quiet before "--mode=compile"
|
||||
set fnord "$@" --quiet
|
||||
shift # fnord
|
||||
;;
|
||||
esac
|
||||
"$@" || exit $?
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case "$arg" in
|
||||
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
||||
set fnord "$@"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # "$arg"
|
||||
done
|
||||
;;
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
"$@" -E |
|
||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
|
||||
) &
|
||||
proc=$!
|
||||
"$@"
|
||||
stat=$?
|
||||
wait "$proc"
|
||||
if test "$stat" != 0; then exit $stat; fi
|
||||
done
|
||||
"$@" -E |
|
||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
|
||||
|
||||
+18
-18
@@ -109,7 +109,7 @@ then
|
||||
echo "install: no input file specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
:
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]; then
|
||||
@@ -120,7 +120,7 @@ if [ x"$dir_arg" != x ]; then
|
||||
instcmd=:
|
||||
chmodcmd=""
|
||||
else
|
||||
instcmd=mkdir
|
||||
instcmd=$mkdirprog
|
||||
fi
|
||||
else
|
||||
|
||||
@@ -128,9 +128,9 @@ else
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
|
||||
if [ -f $src -o -d $src ]
|
||||
if [ -f "$src" ] || [ -d "$src" ]
|
||||
then
|
||||
true
|
||||
:
|
||||
else
|
||||
echo "install: $src does not exist"
|
||||
exit 1
|
||||
@@ -141,7 +141,7 @@ else
|
||||
echo "install: no destination specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
:
|
||||
fi
|
||||
|
||||
# If destination is a directory, append the input filename; if your system
|
||||
@@ -151,7 +151,7 @@ else
|
||||
then
|
||||
dst="$dst"/`basename $src`
|
||||
else
|
||||
true
|
||||
:
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -163,8 +163,8 @@ dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||
|
||||
# Skip lots of stat calls in the usual case.
|
||||
if [ ! -d "$dstdir" ]; then
|
||||
defaultIFS='
|
||||
'
|
||||
defaultIFS='
|
||||
'
|
||||
IFS="${IFS-${defaultIFS}}"
|
||||
|
||||
oIFS="${IFS}"
|
||||
@@ -183,7 +183,7 @@ while [ $# -ne 0 ] ; do
|
||||
then
|
||||
$mkdirprog "${pathcomp}"
|
||||
else
|
||||
true
|
||||
:
|
||||
fi
|
||||
|
||||
pathcomp="${pathcomp}/"
|
||||
@@ -194,10 +194,10 @@ if [ x"$dir_arg" != x ]
|
||||
then
|
||||
$doit $instcmd $dst &&
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi
|
||||
else
|
||||
|
||||
# If we're going to rename the final executable, determine the name now.
|
||||
@@ -216,7 +216,7 @@ else
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
true
|
||||
:
|
||||
fi
|
||||
|
||||
# Make a temp file name in the proper directory.
|
||||
@@ -235,10 +235,10 @@ else
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
|
||||
|
||||
@@ -1,97 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Get modification time of a file or directory and pretty-print it.
|
||||
# Copyright 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
# written by Ulrich Drepper <[email protected]>, June 1995
|
||||
#
|
||||
# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Prevent date giving response in another language.
|
||||
LANG=C
|
||||
export LANG
|
||||
LC_ALL=C
|
||||
export LC_ALL
|
||||
LC_TIME=C
|
||||
export LC_TIME
|
||||
|
||||
# Get the extended ls output of the file or directory.
|
||||
# On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below.
|
||||
if ls -L /dev/null 1>/dev/null 2>&1; then
|
||||
set - x`ls -L -l -d $1`
|
||||
else
|
||||
set - x`ls -l -d $1`
|
||||
fi
|
||||
# The month is at least the fourth argument
|
||||
# (3 shifts here, the next inside the loop).
|
||||
shift
|
||||
shift
|
||||
shift
|
||||
|
||||
# Find the month. Next argument is day, followed by the year or time.
|
||||
month=
|
||||
until test $month
|
||||
do
|
||||
shift
|
||||
case $1 in
|
||||
Jan) month=January; nummonth=1;;
|
||||
Feb) month=February; nummonth=2;;
|
||||
Mar) month=March; nummonth=3;;
|
||||
Apr) month=April; nummonth=4;;
|
||||
May) month=May; nummonth=5;;
|
||||
Jun) month=June; nummonth=6;;
|
||||
Jul) month=July; nummonth=7;;
|
||||
Aug) month=August; nummonth=8;;
|
||||
Sep) month=September; nummonth=9;;
|
||||
Oct) month=October; nummonth=10;;
|
||||
Nov) month=November; nummonth=11;;
|
||||
Dec) month=December; nummonth=12;;
|
||||
esac
|
||||
done
|
||||
|
||||
day=$2
|
||||
|
||||
# Here we have to deal with the problem that the ls output gives either
|
||||
# the time of day or the year.
|
||||
case $3 in
|
||||
*:*) set `date`; eval year=\$$#
|
||||
case $2 in
|
||||
Jan) nummonthtod=1;;
|
||||
Feb) nummonthtod=2;;
|
||||
Mar) nummonthtod=3;;
|
||||
Apr) nummonthtod=4;;
|
||||
May) nummonthtod=5;;
|
||||
Jun) nummonthtod=6;;
|
||||
Jul) nummonthtod=7;;
|
||||
Aug) nummonthtod=8;;
|
||||
Sep) nummonthtod=9;;
|
||||
Oct) nummonthtod=10;;
|
||||
Nov) nummonthtod=11;;
|
||||
Dec) nummonthtod=12;;
|
||||
esac
|
||||
# For the first six month of the year the time notation can also
|
||||
# be used for files modified in the last year.
|
||||
if (expr $nummonth \> $nummonthtod) > /dev/null;
|
||||
then
|
||||
year=`expr $year - 1`
|
||||
fi;;
|
||||
*) year=$3;;
|
||||
esac
|
||||
|
||||
# The result.
|
||||
echo $day $month $year
|
||||
-336
@@ -1,336 +0,0 @@
|
||||
#! /bin/sh
|
||||
# Common stub for a few missing GNU programs while installing.
|
||||
# Copyright 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
|
||||
# Originally by Fran,cois Pinard <[email protected]>, 1996.
|
||||
|
||||
# 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., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo 1>&2 "Try \`$0 --help' for more information"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
run=:
|
||||
|
||||
# In the cases where this matters, `missing' is being run in the
|
||||
# srcdir already.
|
||||
if test -f configure.ac; then
|
||||
configure_ac=configure.ac
|
||||
else
|
||||
configure_ac=configure.in
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
--run)
|
||||
# Try to run requested program, and just exit if it succeeds.
|
||||
run=
|
||||
shift
|
||||
"$@" && exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
# If it does not exist, or fails to run (possibly an outdated version),
|
||||
# try to emulate it.
|
||||
case "$1" in
|
||||
|
||||
-h|--h|--he|--hel|--help)
|
||||
echo "\
|
||||
$0 [OPTION]... PROGRAM [ARGUMENT]...
|
||||
|
||||
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
|
||||
error status if there is no known handling for PROGRAM.
|
||||
|
||||
Options:
|
||||
-h, --help display this help and exit
|
||||
-v, --version output version information and exit
|
||||
--run try to run the given command, and emulate it if it fails
|
||||
|
||||
Supported PROGRAM values:
|
||||
aclocal touch file \`aclocal.m4'
|
||||
autoconf touch file \`configure'
|
||||
autoheader touch file \`config.h.in'
|
||||
automake touch all \`Makefile.in' files
|
||||
bison create \`y.tab.[ch]', if possible, from existing .[ch]
|
||||
flex create \`lex.yy.c', if possible, from existing .c
|
||||
help2man touch the output file
|
||||
lex create \`lex.yy.c', if possible, from existing .c
|
||||
makeinfo touch the output file
|
||||
tar try tar, gnutar, gtar, then tar without non-portable flags
|
||||
yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
|
||||
;;
|
||||
|
||||
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
|
||||
echo "missing 0.4 - GNU automake"
|
||||
;;
|
||||
|
||||
-*)
|
||||
echo 1>&2 "$0: Unknown \`$1' option"
|
||||
echo 1>&2 "Try \`$0 --help' for more information"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
aclocal)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
|
||||
to install the \`Automake' and \`Perl' packages. Grab them from
|
||||
any GNU archive site."
|
||||
touch aclocal.m4
|
||||
;;
|
||||
|
||||
autoconf)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified \`${configure_ac}'. You might want to install the
|
||||
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
|
||||
archive site."
|
||||
touch configure
|
||||
;;
|
||||
|
||||
autoheader)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified \`acconfig.h' or \`${configure_ac}'. You might want
|
||||
to install the \`Autoconf' and \`GNU m4' packages. Grab them
|
||||
from any GNU archive site."
|
||||
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
|
||||
test -z "$files" && files="config.h"
|
||||
touch_files=
|
||||
for f in $files; do
|
||||
case "$f" in
|
||||
*:*) touch_files="$touch_files "`echo "$f" |
|
||||
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
|
||||
*) touch_files="$touch_files $f.in";;
|
||||
esac
|
||||
done
|
||||
touch $touch_files
|
||||
;;
|
||||
|
||||
automake)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
|
||||
You might want to install the \`Automake' and \`Perl' packages.
|
||||
Grab them from any GNU archive site."
|
||||
find . -type f -name Makefile.am -print |
|
||||
sed 's/\.am$/.in/' |
|
||||
while read f; do touch "$f"; done
|
||||
;;
|
||||
|
||||
autom4te)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is needed, and you do not seem to have it handy on your
|
||||
system. You might have modified some files without having the
|
||||
proper tools for further handling them.
|
||||
You can get \`$1Help2man' as part of \`Autoconf' from any GNU
|
||||
archive site."
|
||||
|
||||
file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
|
||||
test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
|
||||
if test -f "$file"; then
|
||||
touch $file
|
||||
else
|
||||
test -z "$file" || exec >$file
|
||||
echo "#! /bin/sh"
|
||||
echo "# Created by GNU Automake missing as a replacement of"
|
||||
echo "# $ $@"
|
||||
echo "exit 0"
|
||||
chmod +x $file
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
bison|yacc)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified a \`.y' file. You may need the \`Bison' package
|
||||
in order for those modifications to take effect. You can get
|
||||
\`Bison' from any GNU archive site."
|
||||
rm -f y.tab.c y.tab.h
|
||||
if [ $# -ne 1 ]; then
|
||||
eval LASTARG="\${$#}"
|
||||
case "$LASTARG" in
|
||||
*.y)
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
|
||||
if [ -f "$SRCFILE" ]; then
|
||||
cp "$SRCFILE" y.tab.c
|
||||
fi
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
|
||||
if [ -f "$SRCFILE" ]; then
|
||||
cp "$SRCFILE" y.tab.h
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if [ ! -f y.tab.h ]; then
|
||||
echo >y.tab.h
|
||||
fi
|
||||
if [ ! -f y.tab.c ]; then
|
||||
echo 'main() { return 0; }' >y.tab.c
|
||||
fi
|
||||
;;
|
||||
|
||||
lex|flex)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified a \`.l' file. You may need the \`Flex' package
|
||||
in order for those modifications to take effect. You can get
|
||||
\`Flex' from any GNU archive site."
|
||||
rm -f lex.yy.c
|
||||
if [ $# -ne 1 ]; then
|
||||
eval LASTARG="\${$#}"
|
||||
case "$LASTARG" in
|
||||
*.l)
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
|
||||
if [ -f "$SRCFILE" ]; then
|
||||
cp "$SRCFILE" lex.yy.c
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if [ ! -f lex.yy.c ]; then
|
||||
echo 'main() { return 0; }' >lex.yy.c
|
||||
fi
|
||||
;;
|
||||
|
||||
help2man)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified a dependency of a manual page. You may need the
|
||||
\`Help2man' package in order for those modifications to take
|
||||
effect. You can get \`Help2man' from any GNU archive site."
|
||||
|
||||
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
|
||||
if test -z "$file"; then
|
||||
file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
|
||||
fi
|
||||
if [ -f "$file" ]; then
|
||||
touch $file
|
||||
else
|
||||
test -z "$file" || exec >$file
|
||||
echo ".ab help2man is required to generate this page"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
makeinfo)
|
||||
if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
|
||||
# We have makeinfo, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified a \`.texi' or \`.texinfo' file, or any other file
|
||||
indirectly affecting the aspect of the manual. The spurious
|
||||
call might also be the consequence of using a buggy \`make' (AIX,
|
||||
DU, IRIX). You might want to install the \`Texinfo' package or
|
||||
the \`GNU make' package. Grab either from any GNU archive site."
|
||||
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
|
||||
if test -z "$file"; then
|
||||
file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
|
||||
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
|
||||
fi
|
||||
touch $file
|
||||
;;
|
||||
|
||||
tar)
|
||||
shift
|
||||
if test -n "$run"; then
|
||||
echo 1>&2 "ERROR: \`tar' requires --run"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# We have already tried tar in the generic part.
|
||||
# Look for gnutar/gtar before invocation to avoid ugly error
|
||||
# messages.
|
||||
if (gnutar --version > /dev/null 2>&1); then
|
||||
gnutar ${1+"$@"} && exit 0
|
||||
fi
|
||||
if (gtar --version > /dev/null 2>&1); then
|
||||
gtar ${1+"$@"} && exit 0
|
||||
fi
|
||||
firstarg="$1"
|
||||
if shift; then
|
||||
case "$firstarg" in
|
||||
*o*)
|
||||
firstarg=`echo "$firstarg" | sed s/o//`
|
||||
tar "$firstarg" ${1+"$@"} && exit 0
|
||||
;;
|
||||
esac
|
||||
case "$firstarg" in
|
||||
*h*)
|
||||
firstarg=`echo "$firstarg" | sed s/h//`
|
||||
tar "$firstarg" ${1+"$@"} && exit 0
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: I can't seem to be able to run \`tar' with the given arguments.
|
||||
You may want to install GNU tar or Free paxutils, or check the
|
||||
command line arguments."
|
||||
exit 1
|
||||
;;
|
||||
|
||||
*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is needed, and you do not seem to have it handy on your
|
||||
system. You might have modified some files without having the
|
||||
proper tools for further handling them. Check the \`README' file,
|
||||
it often tells you about the needed prerequirements for installing
|
||||
this package. You may also peek at any GNU archive site, in case
|
||||
some other package would contain this missing \`$1' program."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
@@ -1,101 +0,0 @@
|
||||
#! /bin/sh
|
||||
# mkinstalldirs --- make directory hierarchy
|
||||
# Author: Noah Friedman <[email protected]>
|
||||
# Created: 1993-05-16
|
||||
# Public domain
|
||||
|
||||
# $Id$
|
||||
|
||||
errstatus=0
|
||||
dirmode=""
|
||||
|
||||
usage="\
|
||||
Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
|
||||
|
||||
# process command line arguments
|
||||
while test $# -gt 0 ; do
|
||||
case "${1}" in
|
||||
-h | --help | --h* ) # -h for help
|
||||
echo "${usage}" 1>&2; exit 0 ;;
|
||||
-m ) # -m PERM arg
|
||||
shift
|
||||
test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; }
|
||||
dirmode="${1}"
|
||||
shift ;;
|
||||
-- ) shift; break ;; # stop option processing
|
||||
-* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option
|
||||
* ) break ;; # first non-opt arg
|
||||
esac
|
||||
done
|
||||
|
||||
for file
|
||||
do
|
||||
if test -d "$file"; then
|
||||
shift
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
case $# in
|
||||
0) exit 0 ;;
|
||||
esac
|
||||
|
||||
case $dirmode in
|
||||
'')
|
||||
if mkdir -p -- . 2>/dev/null; then
|
||||
echo "mkdir -p -- $*"
|
||||
exec mkdir -p -- "$@"
|
||||
fi ;;
|
||||
*)
|
||||
if mkdir -m "$dirmode" -p -- . 2>/dev/null; then
|
||||
echo "mkdir -m $dirmode -p -- $*"
|
||||
exec mkdir -m "$dirmode" -p -- "$@"
|
||||
fi ;;
|
||||
esac
|
||||
|
||||
for file
|
||||
do
|
||||
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
|
||||
shift
|
||||
|
||||
pathcomp=
|
||||
for d
|
||||
do
|
||||
pathcomp="$pathcomp$d"
|
||||
case "$pathcomp" in
|
||||
-* ) pathcomp=./$pathcomp ;;
|
||||
esac
|
||||
|
||||
if test ! -d "$pathcomp"; then
|
||||
echo "mkdir $pathcomp"
|
||||
|
||||
mkdir "$pathcomp" || lasterr=$?
|
||||
|
||||
if test ! -d "$pathcomp"; then
|
||||
errstatus=$lasterr
|
||||
else
|
||||
if test ! -z "$dirmode"; then
|
||||
echo "chmod $dirmode $pathcomp"
|
||||
|
||||
lasterr=""
|
||||
chmod "$dirmode" "$pathcomp" || lasterr=$?
|
||||
|
||||
if test ! -z "$lasterr"; then
|
||||
errstatus=$lasterr
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
pathcomp="$pathcomp/"
|
||||
done
|
||||
done
|
||||
|
||||
exit $errstatus
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 3
|
||||
# End:
|
||||
# mkinstalldirs ends here
|
||||
@@ -1 +1 @@
|
||||
1.29c
|
||||
1.49a
|
||||
|
||||
-6288
File diff suppressed because it is too large
Load Diff
@@ -1,28 +0,0 @@
|
||||
@echo off
|
||||
echo Configuring bison for go32
|
||||
rem This batch file assumes a unix-type "sed" program
|
||||
|
||||
echo # Makefile generated by "configure.bat"> Makefile
|
||||
echo all.dos : bison >> Makefile
|
||||
|
||||
if exist config.sed del config.sed
|
||||
|
||||
echo "s/@srcdir@/./g ">> config.sed
|
||||
echo "s/@CC@/gcc/g ">> config.sed
|
||||
echo "s/@INSTALL@//g ">> config.sed
|
||||
echo "s/@INSTALL_PROGRAM@//g ">> config.sed
|
||||
echo "s/@INSTALL_DATA@//g ">> config.sed
|
||||
echo "s/@DEFS@/-DHAVE_STRERROR/g ">> config.sed
|
||||
echo "s/@LIBS@//g ">> config.sed
|
||||
echo "s/@ALLOCA@//g ">> config.sed
|
||||
|
||||
echo "/^bison[ ]*:/,/-o/ { ">> config.sed
|
||||
echo " s/ \$(CC)/ >bison.rf/ ">> config.sed
|
||||
echo " /-o/ a\ ">> config.sed
|
||||
echo " $(CC) @bison.rf ">> config.sed
|
||||
echo "} ">> config.sed
|
||||
|
||||
sed -e "s/^\"//" -e "s/\"$//" -e "s/[ ]*$//" config.sed > config2.sed
|
||||
sed -f config2.sed Makefile.in >> Makefile
|
||||
del config.sed
|
||||
del config2.sed
|
||||
+36
-24
@@ -1,5 +1,7 @@
|
||||
# Configure template for GNU Bison. -*-Autoconf-*-
|
||||
#
|
||||
# Copyright (C) 2001, 2002 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 of the License, or
|
||||
@@ -16,30 +18,35 @@
|
||||
# 02111-1307 USA
|
||||
|
||||
# We need a recent Autoconf to run a recent Autotest.
|
||||
AC_PREREQ(2.52e)
|
||||
AC_PREREQ(2.53)
|
||||
|
||||
AC_INIT([GNU Bison], [1.29d], [[email protected]])
|
||||
AC_INIT([GNU Bison], [1.49b], [[email protected]])
|
||||
AC_CONFIG_AUX_DIR(config)
|
||||
|
||||
AM_INIT_AUTOMAKE([bison], [1.29d])
|
||||
AM_INIT_AUTOMAKE
|
||||
AM_CONFIG_HEADER(config.h:config.hin)
|
||||
|
||||
# Initialize the test suite.
|
||||
AC_CONFIG_TESTDIR(tests)
|
||||
AC_CONFIG_FILES([tests/Makefile tests/atlocal])
|
||||
AC_CONFIG_FILES([tests/bison], [chmod +x tests/bison])
|
||||
# Needed by tests/atlocal.in.
|
||||
AC_SUBST([GCC])
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CC
|
||||
AM_PROG_LEX
|
||||
AC_PROG_YACC
|
||||
AC_MINIX
|
||||
AC_ISC_POSIX
|
||||
AM_PROG_CC_STDC
|
||||
AC_PROG_RANLIB
|
||||
# GNU M4 is needed to build the testsuite.
|
||||
BISON_AC_PROG_GNU_M4
|
||||
if test "$ac_cv_prog_gnu_m4" != yes; then
|
||||
missing_dir=`cd $ac_aux_dir && pwd`
|
||||
M4="$missing_dir/missing m4"
|
||||
AM_MISSING_PROG([AUTOM4TE], [autom4te])
|
||||
BISON_PROG_GNU_M4
|
||||
if test x"$ac_cv_prog_gnu_m4" != xyes; then
|
||||
AC_MSG_ERROR([GNU M4 1.4 is required])
|
||||
fi
|
||||
AC_DEFINE_UNQUOTED([M4], ["$M4"], [Define to the GNU M4 executable name.])
|
||||
|
||||
AC_ARG_ENABLE(gcc-warnings,
|
||||
[ --enable-gcc-warnings turn on lots of GCC warnings (not recommended)],
|
||||
@@ -49,6 +56,9 @@ AC_ARG_ENABLE(gcc-warnings,
|
||||
esac],
|
||||
[enableval=no])
|
||||
if test "${enableval}" = yes; then
|
||||
BISON_WARNING(-Werror)
|
||||
AC_SUBST([WERROR_CFLAGS], [$WARNING_CFLAGS])
|
||||
WARNING_CFLAGS=
|
||||
BISON_WARNING(-Wall)
|
||||
BISON_WARNING(-W)
|
||||
BISON_WARNING(-Wbad-function-cast)
|
||||
@@ -61,7 +71,6 @@ if test "${enableval}" = yes; then
|
||||
BISON_WARNING(-Wshadow)
|
||||
BISON_WARNING(-Wstrict-prototypes)
|
||||
BISON_WARNING(-Wwrite-strings)
|
||||
CFLAGS="$CFLAGS $WARNING_CFLAGS"
|
||||
fi
|
||||
|
||||
# Checks for libraries.
|
||||
@@ -69,11 +78,7 @@ AC_DEFINE([_GNU_SOURCE],1,[Define to 1 for GNU C library extensions.])
|
||||
|
||||
# Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS(ctype.h locale.h memory.h stdlib.h string.h unistd.h)
|
||||
|
||||
# Checks for typedefs.
|
||||
|
||||
# Checks for structures.
|
||||
AC_CHECK_HEADERS([ctype.h locale.h memory.h stdlib.h string.h unistd.h])
|
||||
|
||||
# Checks for compiler characteristics.
|
||||
AC_C_CONST
|
||||
@@ -82,26 +87,33 @@ AM_C_PROTOTYPES
|
||||
|
||||
# Checks for library functions.
|
||||
AC_FUNC_ALLOCA
|
||||
AC_CHECK_FUNCS(mkstemp setlocale)
|
||||
AC_CHECK_DECLS([stpcpy, strndup, strnlen, memchr])
|
||||
AC_REPLACE_FUNCS(stpcpy strndup strnlen strspn memchr)
|
||||
AC_FUNC_OBSTACK
|
||||
AC_FUNC_ERROR_AT_LINE
|
||||
AC_FUNC_STRNLEN
|
||||
UTILS_FUNC_MKSTEMP
|
||||
AC_CHECK_FUNCS(setlocale)
|
||||
AC_CHECK_DECLS([getenv, getopt, free, stpcpy, strchr, strspn, strnlen,
|
||||
malloc, memchr, memrchr])
|
||||
AC_REPLACE_FUNCS(stpcpy strchr strspn memchr memrchr)
|
||||
jm_FUNC_MALLOC
|
||||
jm_FUNC_REALLOC
|
||||
jm_PREREQ_QUOTEARG
|
||||
jm_PREREQ_ERROR
|
||||
AM_WITH_DMALLOC
|
||||
BISON_PREREQ_TIMEVAR
|
||||
|
||||
ALL_LINGUAS="de es et fr ja nl tr ru"
|
||||
AM_GNU_GETTEXT
|
||||
# Gettext.
|
||||
AM_GNU_GETTEXT(external, need-ngettext)
|
||||
AM_GNU_GETTEXT_VERSION(0.11.5)
|
||||
|
||||
# This is necessary so that .o files in LIBOBJS are also built via
|
||||
# the ANSI2KNR-filtering rules.
|
||||
LIBOBJS=`echo $LIBOBJS|sed 's/\.o /\$U.o /g;s/\.o$/\$U.o/'`
|
||||
AC_SUBST(LIBOBJS)
|
||||
LIB@&t@OBJS=`echo $LIB@&t@OBJS|sed 's/\.o /\$U.o /g;s/\.o$/\$U.o/'`
|
||||
AC_SUBST(LIB@&t@OBJS)
|
||||
|
||||
AC_OUTPUT([Makefile
|
||||
config/Makefile
|
||||
intl/Makefile po/Makefile.in
|
||||
po/Makefile.in
|
||||
data/Makefile
|
||||
lib/Makefile src/Makefile doc/Makefile
|
||||
m4/Makefile
|
||||
tests/Makefile])
|
||||
m4/Makefile])
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
Makefile.in
|
||||
Makefile
|
||||
@@ -0,0 +1,21 @@
|
||||
## Copyright (C) 2002 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA
|
||||
## 02111-1307 USA
|
||||
|
||||
dist_pkgdata_DATA = c.m4 yacc.c lalr1.cc glr.c
|
||||
|
||||
m4sugardir = $(pkgdatadir)/m4sugar
|
||||
dist_m4sugar_DATA = m4sugar/m4sugar.m4 m4sugar/version.m4
|
||||
@@ -0,0 +1,182 @@
|
||||
m4_divert(-1) -*- C -*-
|
||||
|
||||
# C M4 Macros for Bison.
|
||||
# Copyright (C) 2002 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA
|
||||
# 02111-1307 USA
|
||||
|
||||
|
||||
## ----------- ##
|
||||
## Copuright. ##
|
||||
## ----------- ##
|
||||
|
||||
# b4_copyright(TITLE, YEARS)
|
||||
# --------------------------
|
||||
m4_define([b4_copyright],
|
||||
[/* A Bison parser, made from b4_filename, by GNU bison b4_version. */
|
||||
|
||||
/* $1,
|
||||
Copyright (C) $2 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., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* As a special exception, when this file is copied by Bison into a
|
||||
Bison output file, you may use that output file without restriction.
|
||||
This special exception was added by the Free Software Foundation
|
||||
in version 1.24 of Bison. */])
|
||||
|
||||
|
||||
## ------------ ##
|
||||
## Data Types. ##
|
||||
## ------------ ##
|
||||
|
||||
|
||||
# b4_ints_in(INT1, INT2, LOW, HIGH)
|
||||
# ---------------------------------
|
||||
# Return 1 iff both INT1 and INT2 are in [LOW, HIGH], 0 otherwise.
|
||||
m4_define([b4_ints_in],
|
||||
[m4_eval([$3 <= $1 && $1 <= $4 && $3 <= $2 && $2 <= $4])])
|
||||
|
||||
|
||||
# b4_int_type(MIN, MAX)
|
||||
# ---------------------
|
||||
# Return the smallest int type able to handle numbers ranging from
|
||||
# MIN to MAX (included).
|
||||
m4_define([b4_int_type],
|
||||
[m4_if(b4_ints_in($@, [0], [255]), [1], [unsigned char],
|
||||
b4_ints_in($@, [-128], [128]), [1], [signed char],
|
||||
|
||||
b4_ints_in($@, [0], [65535]), [1], [unsigned short],
|
||||
b4_ints_in($@, [-32768], [32767]), [1], [short],
|
||||
|
||||
m4_eval([0 <= $1]), [1], [unsigned int],
|
||||
|
||||
[int])])
|
||||
|
||||
# b4_int_type_for(NAME)
|
||||
# ---------------------
|
||||
# Return the smallest int type able to handle numbers ranging from
|
||||
# `NAME_min' to `NAME_max' (included).
|
||||
m4_define([b4_int_type_for],
|
||||
[b4_int_type($1_min, $1_max)])
|
||||
|
||||
|
||||
## ------------------------- ##
|
||||
## Assigning token numbers. ##
|
||||
## ------------------------- ##
|
||||
|
||||
# b4_token_define(TOKEN-NAME, TOKEN-NUMBER)
|
||||
# -----------------------------------------
|
||||
# Output the definition of this token as #define.
|
||||
m4_define([b4_token_define],
|
||||
[#define $1 $2
|
||||
])
|
||||
|
||||
|
||||
# b4_token_enum(TOKEN-NAME, TOKEN-NUMBER)
|
||||
# ---------------------------------------
|
||||
# Output the definition of this token as an enum.
|
||||
m4_define([b4_token_enum],
|
||||
[$1 = $2])
|
||||
|
||||
|
||||
# b4_token_defines(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
|
||||
# -------------------------------------------------------
|
||||
# Output the definition of the tokens (if there are) as enums and #define.
|
||||
m4_define([b4_token_defines],
|
||||
[m4_if([$@], [[]], [],
|
||||
[/* Tokens. */
|
||||
#ifndef YYTOKENTYPE
|
||||
# if defined (__STDC__) || defined (__cplusplus)
|
||||
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
||||
know about them. */
|
||||
enum yytokentype {
|
||||
m4_map_sep([ b4_token_enum], [,
|
||||
],
|
||||
[$@])
|
||||
};
|
||||
# endif
|
||||
/* POSIX requires `int' for tokens in interfaces. */
|
||||
# define YYTOKENTYPE int
|
||||
#endif /* !YYTOKENTYPE */
|
||||
m4_map([b4_token_define], [$@])
|
||||
])
|
||||
])
|
||||
|
||||
|
||||
## ---------------------------------------------- ##
|
||||
## Declaring C functions in both K&R and ANSI-C. ##
|
||||
## ---------------------------------------------- ##
|
||||
|
||||
|
||||
# b4_c_function(NAME, RETURN-VALUE, [TYPE1, NAME1], ...)
|
||||
# ------------------------------------------------
|
||||
# Declare the function NAME.
|
||||
m4_define([b4_c_function],
|
||||
[$2
|
||||
#if defined (__STDC__) || defined (__cplusplus)
|
||||
$1 (b4_c_ansi_args(m4_shiftn(2, $@)))
|
||||
#else
|
||||
$1 (b4_c_knr_arg_names(m4_shiftn(2, $@)))
|
||||
b4_c_knr_arg_decls(m4_shiftn(2, $@))
|
||||
#endif[]dnl
|
||||
])
|
||||
|
||||
|
||||
# b4_c_ansi_args([TYPE1, NAME1], ...)
|
||||
# -----------------------------------
|
||||
# Output the arguments ANSI-C definition.
|
||||
m4_define([b4_c_ansi_args],
|
||||
[m4_map_sep([b4_c_ansi_arg], [, ], [$@])])
|
||||
|
||||
m4_define([b4_c_ansi_arg],
|
||||
[$1 $2])
|
||||
|
||||
|
||||
# b4_c_knr_args([TYPE1, NAME1], ...)
|
||||
# ----------------------------------
|
||||
# Output the argument names.
|
||||
m4_define([b4_c_knr_arg_names],
|
||||
[m4_map_sep([b4_c_knr_arg_name], [, ], [$@])])
|
||||
|
||||
m4_define([b4_c_knr_arg_name],
|
||||
[$2])
|
||||
|
||||
|
||||
# b4_c_knr_args([TYPE1, NAME1], ...)
|
||||
# ----------------------------------
|
||||
# Output the K&R argument declarations.
|
||||
m4_define([b4_c_knr_arg_decls],
|
||||
[m4_map_sep([b4_c_knr_arg_decl],
|
||||
[
|
||||
],
|
||||
[$@])])
|
||||
|
||||
m4_define([b4_c_knr_arg_decl],
|
||||
[ $1 $2;])
|
||||
+1870
File diff suppressed because it is too large
Load Diff
+894
@@ -0,0 +1,894 @@
|
||||
m4_divert(-1)
|
||||
# C++ skeleton for Bison
|
||||
# Copyright (C) 2002 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA
|
||||
# 02111-1307 USA
|
||||
|
||||
m4_include([c.m4])
|
||||
|
||||
# b4_lhs_value([TYPE])
|
||||
# --------------------
|
||||
# Expansion of $<TYPE>$.
|
||||
m4_define([b4_lhs_value],
|
||||
[yyval[]m4_ifval([$1], [.$1])])
|
||||
|
||||
|
||||
# b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
|
||||
# --------------------------------------
|
||||
# Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
|
||||
# symbols on RHS.
|
||||
m4_define([b4_rhs_value],
|
||||
[semantic_stack_@<:@m4_eval([$1 - $2])@:>@m4_ifval([$3], [.$3])])
|
||||
|
||||
|
||||
# b4_lhs_location()
|
||||
# -----------------
|
||||
# Expansion of @$.
|
||||
m4_define([b4_lhs_location],
|
||||
[yyloc])
|
||||
|
||||
|
||||
# b4_rhs_location(RULE-LENGTH, NUM)
|
||||
# ---------------------------------
|
||||
# Expansion of @NUM, where the current rule has RULE-LENGTH symbols
|
||||
# on RHS.
|
||||
m4_define([b4_rhs_location],
|
||||
[location_stack_@<:@m4_eval([$1 - $2])@:>@])
|
||||
|
||||
|
||||
m4_define_default([b4_input_suffix], [.y])
|
||||
|
||||
m4_define_default([b4_output_parser_suffix],
|
||||
[m4_translit(b4_input_suffix, [yY], [cC])])
|
||||
|
||||
m4_define_default([b4_output_parser_name],
|
||||
[b4_output_prefix[]b4_output_infix[]b4_output_parser_suffix[]])
|
||||
|
||||
|
||||
m4_define_default([b4_output_header_suffix],
|
||||
[m4_translit(b4_input_suffix, [yY], [hH])])
|
||||
|
||||
m4_define_default([b4_output_header_name],
|
||||
[b4_output_prefix[]b4_output_infix[]b4_output_header_suffix[]])
|
||||
|
||||
m4_define_default([b4_header_guard],
|
||||
[m4_bpatsubst(m4_toupper([BISON_]b4_output_header_name),
|
||||
[[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]], [_])])
|
||||
|
||||
m4_define([b4_inherit],
|
||||
[m4_ifdef([b4_root],
|
||||
[: public b4_root
|
||||
],
|
||||
[])])
|
||||
|
||||
m4_define([b4_param],
|
||||
[m4_ifdef([b4_root],
|
||||
[,
|
||||
const Param& param],
|
||||
[])])
|
||||
|
||||
m4_define([b4_constructor],
|
||||
[m4_ifdef([b4_root],
|
||||
[b4_root (param),
|
||||
],
|
||||
[])])
|
||||
|
||||
|
||||
m4_divert(0)dnl
|
||||
#output "b4_output_header_name"
|
||||
b4_copyright([C++ Skeleton parser for LALR(1) parsing with Bison],
|
||||
[2002])
|
||||
#ifndef b4_header_guard
|
||||
# define b4_header_guard
|
||||
|
||||
#include "stack.hh"
|
||||
#include "location.hh"
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
/* Using locations. */
|
||||
#define YYLSP_NEEDED b4_locations_flag
|
||||
|
||||
/* Copy the first part of user declarations. */
|
||||
b4_pre_prologue
|
||||
|
||||
/* Line __line__ of __file__. */
|
||||
#line __oline__ "__ofile__"
|
||||
|
||||
/* Tokens. */
|
||||
b4_token_defines(b4_tokens)
|
||||
|
||||
/* Enabling traces. */
|
||||
#ifndef YYDEBUG
|
||||
# define YYDEBUG b4_debug
|
||||
#endif
|
||||
|
||||
/* Enabling verbose error message. */
|
||||
#ifndef YYERROR_VERBOSE
|
||||
# define YYERROR_VERBOSE b4_error_verbose
|
||||
#endif
|
||||
|
||||
#ifndef YYSTYPE
|
||||
m4_ifdef([b4_stype],
|
||||
[#line b4_stype_line "b4_filename"
|
||||
typedef union b4_stype yystype;
|
||||
/* Line __line__ of __file__. */
|
||||
#line __oline__ "__ofile__"],
|
||||
[typedef int yystype;])
|
||||
# define YYSTYPE yystype
|
||||
#endif
|
||||
|
||||
/* Copy the second part of user declarations. */
|
||||
b4_post_prologue
|
||||
|
||||
/* Line __line__ of __file__. */
|
||||
#line __oline__ "__ofile__"
|
||||
#ifndef YYLLOC_DEFAULT
|
||||
# define YYLLOC_DEFAULT(Current, Rhs, N) \
|
||||
Current.last_line = Rhs[[N]].last_line; \
|
||||
Current.last_column = Rhs[[N]].last_column;
|
||||
#endif
|
||||
|
||||
m4_if(b4_locations_flag, [0], [],
|
||||
[#ifndef YYLTYPE
|
||||
typedef struct yyltype
|
||||
{
|
||||
int first_line;
|
||||
int first_column;
|
||||
int last_line;
|
||||
int last_column;
|
||||
} yyltype;
|
||||
# define YYLTYPE yyltype
|
||||
#endif])
|
||||
|
||||
namespace yy
|
||||
{
|
||||
class b4_name;
|
||||
|
||||
template < typename P >
|
||||
struct Traits
|
||||
{
|
||||
};
|
||||
|
||||
template < >
|
||||
struct Traits< b4_name >
|
||||
{
|
||||
typedef b4_int_type_for([b4_translate]) TokenNumberType;
|
||||
typedef b4_int_type_for([b4_rhs]) RhsNumberType;
|
||||
typedef int StateType;
|
||||
typedef yystype SemanticType;
|
||||
typedef b4_ltype LocationType;
|
||||
};
|
||||
}
|
||||
|
||||
namespace yy
|
||||
{
|
||||
class b4_name b4_inherit
|
||||
{
|
||||
public:
|
||||
|
||||
typedef Traits< b4_name >::TokenNumberType TokenNumberType;
|
||||
typedef Traits< b4_name >::RhsNumberType RhsNumberType;
|
||||
typedef Traits< b4_name >::StateType StateType;
|
||||
typedef Traits< b4_name >::SemanticType SemanticType;
|
||||
typedef Traits< b4_name >::LocationType LocationType;
|
||||
|
||||
typedef Stack< StateType > StateStack;
|
||||
typedef Stack< SemanticType > SemanticStack;
|
||||
typedef Stack< LocationType > LocationStack;
|
||||
|
||||
#if YYLSP_NEEDED
|
||||
b4_name (bool debug,
|
||||
LocationType initlocation[]b4_param) :
|
||||
b4_constructor[]debug_ (debug),
|
||||
cdebug_ (std::cerr),
|
||||
initlocation_ (initlocation)
|
||||
#else
|
||||
b4_name (bool debug[]b4_param) :
|
||||
b4_constructor[]debug_ (debug),
|
||||
cdebug_ (std::cerr)
|
||||
#endif
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~b4_name ()
|
||||
{
|
||||
}
|
||||
|
||||
virtual int parse ();
|
||||
|
||||
private:
|
||||
|
||||
virtual void lex_ ();
|
||||
virtual void error_ ();
|
||||
virtual void print_ ();
|
||||
|
||||
/* Stacks. */
|
||||
StateStack state_stack_;
|
||||
SemanticStack semantic_stack_;
|
||||
LocationStack location_stack_;
|
||||
|
||||
/* Tables. */
|
||||
static const b4_int_type_for([b4_pact]) pact_[[]];
|
||||
static const b4_int_type_for([b4_pact]) pact_ninf_;
|
||||
static const b4_int_type_for([b4_defact]) defact_[[]];
|
||||
static const b4_int_type_for([b4_pgoto]) pgoto_[[]];
|
||||
static const b4_int_type_for([b4_defgoto]) defgoto_[[]];
|
||||
static const b4_int_type_for([b4_table]) table_[[]];
|
||||
static const b4_int_type_for([b4_table]) table_ninf_;
|
||||
static const b4_int_type_for([b4_check]) check_[[]];
|
||||
static const b4_int_type_for([b4_r1]) r1_[[]];
|
||||
static const b4_int_type_for([b4_r2]) r2_[[]];
|
||||
|
||||
#if YYDEBUG || YYERROR_VERBOSE
|
||||
static const char* const name_[[]];
|
||||
#endif
|
||||
|
||||
/* More tables, for debugging. */
|
||||
#if YYDEBUG
|
||||
static const RhsNumberType rhs_[[]];
|
||||
static const b4_int_type_for([b4_prhs]) prhs_[[]];
|
||||
static const b4_int_type_for([b4_rline]) rline_[[]];
|
||||
static const b4_int_type_for([b4_stos]) stos_[[]];
|
||||
static const b4_int_type_for([b4_toknum]) token_number_[[]];
|
||||
#endif
|
||||
|
||||
/* Even more tables. */
|
||||
static inline TokenNumberType translate_ (int token);
|
||||
|
||||
/* Constants. */
|
||||
static const int eof_;
|
||||
static const int last_;
|
||||
static const int nnts_;
|
||||
static const int empty_;
|
||||
static const int final_;
|
||||
static const int terror_;
|
||||
static const int errcode_;
|
||||
static const int ntokens_;
|
||||
static const int initdepth_;
|
||||
static const unsigned user_token_number_max_;
|
||||
static const TokenNumberType undef_token_;
|
||||
|
||||
/* State. */
|
||||
int n_;
|
||||
int len_;
|
||||
int state_;
|
||||
|
||||
/* Debugging. */
|
||||
int debug_;
|
||||
std::ostream &cdebug_;
|
||||
|
||||
/* Lookahead and lookahead in internal form. */
|
||||
int looka_;
|
||||
int ilooka_;
|
||||
|
||||
/* Message. */
|
||||
std::string message;
|
||||
|
||||
/* Semantic value and location of lookahead token. */
|
||||
SemanticType value;
|
||||
LocationType location;
|
||||
|
||||
/* @$ and $$. */
|
||||
SemanticType yyval;
|
||||
LocationType yyloc;
|
||||
|
||||
/* Initial location. */
|
||||
LocationType initlocation_;
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* not b4_header_guard */
|
||||
|
||||
#output "b4_output_prefix[]b4_output_infix[].cc"
|
||||
b4_copyright([C++ Skeleton parser for LALR(1) parsing with Bison],
|
||||
[2002])
|
||||
|
||||
#include "b4_output_header_name"
|
||||
|
||||
/* Enable debugging if requested. */
|
||||
#if YYDEBUG
|
||||
# define YYCDEBUG if (debug_) cdebug_
|
||||
#else /* !YYDEBUG */
|
||||
# define YYCDEBUG if (0) cdebug_
|
||||
#endif /* !YYDEBUG */
|
||||
|
||||
int
|
||||
yy::b4_name::parse ()
|
||||
{
|
||||
int nerrs = 0;
|
||||
int errstatus = 0;
|
||||
|
||||
/* Initialize stack. */
|
||||
state_stack_ = StateStack (0);
|
||||
semantic_stack_ = SemanticStack (1);
|
||||
location_stack_ = LocationStack (1);
|
||||
|
||||
/* Start. */
|
||||
state_ = 0;
|
||||
looka_ = empty_;
|
||||
#if YYLSP_NEEDED
|
||||
location = initlocation_;
|
||||
#endif
|
||||
YYCDEBUG << "Starting parse" << std::endl;
|
||||
|
||||
/* New state. */
|
||||
yynewstate:
|
||||
state_stack_.push (state_);
|
||||
YYCDEBUG << "Entering state " << state_ << std::endl;
|
||||
goto yybackup;
|
||||
|
||||
/* Backup. */
|
||||
yybackup:
|
||||
|
||||
/* Try to take a decision without lookahead. */
|
||||
n_ = pact_[[state_]];
|
||||
if (n_ == pact_ninf_)
|
||||
goto yydefault;
|
||||
|
||||
/* Read a lookahead token. */
|
||||
if (looka_ == empty_)
|
||||
{
|
||||
YYCDEBUG << "Reading a token: ";
|
||||
lex_ ();
|
||||
}
|
||||
|
||||
/* Convert token to internal form. */
|
||||
if (looka_ <= 0)
|
||||
{
|
||||
looka_ = eof_;
|
||||
ilooka_ = 0;
|
||||
YYCDEBUG << "Now at end of input." << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
ilooka_ = translate_ (looka_);
|
||||
#if YYDEBUG
|
||||
if (debug_)
|
||||
{
|
||||
YYCDEBUG << "Next token is " << looka_
|
||||
<< " (" << name_[[ilooka_]];
|
||||
print_ ();
|
||||
YYCDEBUG << ')' << std::endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
n_ += ilooka_;
|
||||
if (n_ < 0 || n_ > last_ || check_[[n_]] != ilooka_)
|
||||
goto yydefault;
|
||||
|
||||
/* Reduce or error. */
|
||||
n_ = table_[[n_]];
|
||||
if (n_ < 0)
|
||||
{
|
||||
if (n_ == table_ninf_)
|
||||
goto yyerrlab;
|
||||
else
|
||||
{
|
||||
n_ = -n_;
|
||||
goto yyreduce;
|
||||
}
|
||||
}
|
||||
else if (n_ == 0)
|
||||
goto yyerrlab;
|
||||
|
||||
/* Accept? */
|
||||
if (n_ == final_)
|
||||
goto yyacceptlab;
|
||||
|
||||
/* Shift the lookahead token. */
|
||||
YYCDEBUG << "Shifting token " << looka_
|
||||
<< " (" << name_[[ilooka_]] << "), ";
|
||||
|
||||
/* Discard the token being shifted unless it is eof. */
|
||||
if (looka_ != eof_)
|
||||
looka_ = empty_;
|
||||
|
||||
semantic_stack_.push (value);
|
||||
location_stack_.push (location);
|
||||
|
||||
/* Count tokens shifted since error; after three, turn off error
|
||||
status. */
|
||||
if (errstatus)
|
||||
--errstatus;
|
||||
|
||||
state_ = n_;
|
||||
goto yynewstate;
|
||||
|
||||
/* Default action. */
|
||||
yydefault:
|
||||
n_ = defact_[[state_]];
|
||||
if (n_ == 0)
|
||||
goto yyerrlab;
|
||||
goto yyreduce;
|
||||
|
||||
/* Reduce. */
|
||||
yyreduce:
|
||||
len_ = r2_[[n_]];
|
||||
if (len_)
|
||||
{
|
||||
yyval = semantic_stack_[[len_ - 1]];
|
||||
yyloc = location_stack_[[len_ - 1]];
|
||||
}
|
||||
else
|
||||
{
|
||||
yyval = semantic_stack_[[0]];
|
||||
yyloc = location_stack_[[0]];
|
||||
}
|
||||
|
||||
#if YYDEBUG
|
||||
if (debug_)
|
||||
{
|
||||
YYCDEBUG << "Reducing via rule " << n_ - 1
|
||||
<< " (line " << rline_[[n_]] << "), ";
|
||||
for (b4_int_type_for([b4_prhs]) i = prhs_[[n_]];
|
||||
rhs_[[i]] >= 0; ++i)
|
||||
YYCDEBUG << name_[[rhs_[i]]] << ' ';
|
||||
YYCDEBUG << "-> " << name_[[r1_[n_]]] << std::endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (len_)
|
||||
{
|
||||
Slice< LocationType, LocationStack > slice (location_stack_, len_);
|
||||
YYLLOC_DEFAULT (yyloc, slice, len_);
|
||||
}
|
||||
|
||||
switch (n_)
|
||||
{
|
||||
b4_actions
|
||||
}
|
||||
|
||||
/* Line __line__ of __file__. */
|
||||
#line __oline__ "__ofile__"
|
||||
|
||||
state_stack_.pop (len_);
|
||||
semantic_stack_.pop (len_);
|
||||
location_stack_.pop (len_);
|
||||
|
||||
#if YYDEBUG
|
||||
if (debug_)
|
||||
{
|
||||
YYCDEBUG << "state stack now";
|
||||
for (StateStack::ConstIterator i = state_stack_.begin ();
|
||||
i != state_stack_.end (); ++i)
|
||||
YYCDEBUG << ' ' << *i;
|
||||
YYCDEBUG << std::endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
semantic_stack_.push (yyval);
|
||||
location_stack_.push (yyloc);
|
||||
|
||||
/* Shift the result of the reduction. */
|
||||
n_ = r1_[[n_]];
|
||||
state_ = pgoto_[[n_ - ntokens_]] + state_stack_[[0]];
|
||||
if (state_ >= 0 && state_ <= last_ && check_[[state_]] == state_stack_[[0]])
|
||||
state_ = table_[[state_]];
|
||||
else
|
||||
state_ = defgoto_[[n_ - ntokens_]];
|
||||
goto yynewstate;
|
||||
|
||||
/* Report and recover from errors. This is very incomplete. */
|
||||
yyerrlab:
|
||||
/* If not already recovering from an error, report this error. */
|
||||
if (!errstatus)
|
||||
{
|
||||
++nerrs;
|
||||
|
||||
#if YYERROR_VERBOSE
|
||||
n_ = pact_[[state_]];
|
||||
if (pact_ninf_ < n_ && n_ < last_)
|
||||
{
|
||||
message = "parse error, unexpected ";
|
||||
message += name_[[ilooka_]];
|
||||
{
|
||||
int count = 0;
|
||||
for (int x = (n_ < 0 ? -n_ : 0); x < ntokens_ + nnts_; ++x)
|
||||
if (check_[[x + n_]] == x && x != terror_)
|
||||
++count;
|
||||
if (count < 5)
|
||||
{
|
||||
count = 0;
|
||||
for (int x = (n_ < 0 ? -n_ : 0); x < ntokens_ + nnts_; ++x)
|
||||
if (check_[[x + n_]] == x && x != terror_)
|
||||
{
|
||||
message += (!count++) ? ", expecting " : " or ";
|
||||
message += name_[[x]];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
message = "parse error";
|
||||
error_ ();
|
||||
}
|
||||
goto yyerrlab1;
|
||||
|
||||
/* Error raised explicitly by an action. */
|
||||
yyerrlab1:
|
||||
if (errstatus == 3)
|
||||
{
|
||||
/* If just tried and failed to reuse lookahead token after an
|
||||
error, discard it. */
|
||||
|
||||
/* Return failure if at end of input. */
|
||||
if (looka_ == eof_)
|
||||
goto yyabortlab;
|
||||
YYCDEBUG << "Discarding token " << looka_
|
||||
<< " (" << name_[[ilooka_]] << ")." << std::endl;
|
||||
looka_ = empty_;
|
||||
}
|
||||
|
||||
/* Else will try to reuse lookahead token after shifting the error
|
||||
token. */
|
||||
|
||||
errstatus = 3;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
n_ = pact_[[state_]];
|
||||
if (n_ != pact_ninf_)
|
||||
{
|
||||
n_ += terror_;
|
||||
if (0 <= n_ && n_ <= last_ && check_[[n_]] == terror_)
|
||||
{
|
||||
n_ = table_[[n_]];
|
||||
if (0 < n_)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Pop the current state because it cannot handle the error token. */
|
||||
if (!state_stack_.height ())
|
||||
goto yyabortlab;
|
||||
|
||||
#if YYDEBUG
|
||||
if (debug_)
|
||||
{
|
||||
if (stos_[[state_]] < ntokens_)
|
||||
{
|
||||
YYCDEBUG << "Error: popping token "
|
||||
<< token_number_[[stos_[state_]]]
|
||||
<< " (" << name_[[stos_[state_]]];
|
||||
# ifdef YYPRINT
|
||||
YYPRINT (stderr, token_number_[[stos_[state_]]],
|
||||
semantic_stack_.top ());
|
||||
# endif
|
||||
YYCDEBUG << ')' << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
YYCDEBUG << "Error: popping nonterminal ("
|
||||
<< name_[[stos_[state_]]] << ')' << std::endl;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
state_ = (state_stack_.pop (), state_stack_[[0]]);
|
||||
semantic_stack_.pop ();
|
||||
location_stack_.pop ();;
|
||||
|
||||
#if YYDEBUG
|
||||
if (debug_)
|
||||
{
|
||||
YYCDEBUG << "Error: state stack now";
|
||||
for (StateStack::ConstIterator i = state_stack_.begin ();
|
||||
i != state_stack_.end (); ++i)
|
||||
YYCDEBUG << ' ' << *i;
|
||||
YYCDEBUG << std::endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (n_ == final_)
|
||||
goto yyacceptlab;
|
||||
|
||||
YYCDEBUG << "Shifting error token, ";
|
||||
|
||||
semantic_stack_.push (value);
|
||||
location_stack_.push (location);
|
||||
|
||||
state_ = n_;
|
||||
goto yynewstate;
|
||||
|
||||
/* Accept. */
|
||||
yyacceptlab:
|
||||
return 0;
|
||||
|
||||
/* Abort. */
|
||||
yyabortlab:
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
yy::b4_name::lex_ ()
|
||||
{
|
||||
#if YYLSP_NEEDED
|
||||
looka_ = yylex (&value, &location);
|
||||
#else
|
||||
looka_ = yylex (&value);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* YYPACT[[STATE-NUM]] -- Index in YYTABLE of the portion describing
|
||||
STATE-NUM. */
|
||||
const b4_int_type_for([b4_pact]) yy::b4_name::pact_ninf_ = b4_pact_ninf;
|
||||
const b4_int_type_for([b4_pact])
|
||||
yy::b4_name::pact_[[]] =
|
||||
{
|
||||
b4_pact
|
||||
};
|
||||
|
||||
/* YYDEFACT[[S]] -- default rule to reduce with in state S when YYTABLE
|
||||
doesn't specify something else to do. Zero means the default is an
|
||||
error. */
|
||||
const b4_int_type_for([b4_defact])
|
||||
yy::b4_name::defact_[[]] =
|
||||
{
|
||||
b4_defact
|
||||
};
|
||||
|
||||
/* YYPGOTO[[NTERM-NUM]]. */
|
||||
const b4_int_type_for([b4_pgoto])
|
||||
yy::b4_name::pgoto_[[]] =
|
||||
{
|
||||
b4_pgoto
|
||||
};
|
||||
|
||||
/* YYDEFGOTO[[NTERM-NUM]]. */
|
||||
const b4_int_type_for([b4_defgoto])
|
||||
yy::b4_name::defgoto_[[]] =
|
||||
{
|
||||
b4_defgoto
|
||||
};
|
||||
|
||||
/* YYTABLE[[YYPACT[STATE-NUM]]]. What to do in state STATE-NUM. If
|
||||
positive, shift that token. If negative, reduce the rule which
|
||||
number is the opposite. If zero, do what YYDEFACT says. */
|
||||
const b4_int_type_for([b4_table]) yy::b4_name::table_ninf_ = b4_table_ninf;
|
||||
const b4_int_type_for([b4_table])
|
||||
yy::b4_name::table_[[]] =
|
||||
{
|
||||
b4_table
|
||||
};
|
||||
|
||||
/* YYCHECK. */
|
||||
const b4_int_type_for([b4_check])
|
||||
yy::b4_name::check_[[]] =
|
||||
{
|
||||
b4_check
|
||||
};
|
||||
|
||||
#if YYDEBUG
|
||||
/* STOS_[[STATE-NUM]] -- The (internal number of the) accessing
|
||||
symbol of state STATE-NUM. */
|
||||
const b4_int_type_for([b4_stos])
|
||||
yy::b4_name::stos_[[]] =
|
||||
{
|
||||
b4_stos
|
||||
};
|
||||
|
||||
/* TOKEN_NUMBER_[[YYLEX-NUM]] -- Internal token number corresponding
|
||||
to YYLEX-NUM. */
|
||||
const b4_int_type_for([b4_toknum])
|
||||
yy::b4_name::token_number_[[]] =
|
||||
{
|
||||
b4_toknum
|
||||
};
|
||||
#endif
|
||||
|
||||
/* YYR1[[YYN]] -- Symbol number of symbol that rule YYN derives. */
|
||||
const b4_int_type_for([b4_r1])
|
||||
yy::b4_name::r1_[[]] =
|
||||
{
|
||||
b4_r1
|
||||
};
|
||||
|
||||
/* YYR2[[YYN]] -- Number of symbols composing right hand side of rule YYN. */
|
||||
const b4_int_type_for([b4_r2])
|
||||
yy::b4_name::r2_[[]] =
|
||||
{
|
||||
b4_r2
|
||||
};
|
||||
|
||||
#if YYDEBUG || YYERROR_VERBOSE
|
||||
/* YYTNAME[[SYMBOL-NUM]] -- String name of the symbol SYMBOL-NUM.
|
||||
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
|
||||
const char*
|
||||
const yy::b4_name::name_[[]] =
|
||||
{
|
||||
b4_tname
|
||||
};
|
||||
#endif
|
||||
|
||||
#if YYDEBUG
|
||||
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
|
||||
const yy::b4_name::RhsNumberType
|
||||
yy::b4_name::rhs_[[]] =
|
||||
{
|
||||
b4_rhs
|
||||
};
|
||||
|
||||
/* YYPRHS[[YYN]] -- Index of the first RHS symbol of rule number YYN in
|
||||
YYRHS. */
|
||||
const b4_int_type_for([b4_prhs])
|
||||
yy::b4_name::prhs_[[]] =
|
||||
{
|
||||
b4_prhs
|
||||
};
|
||||
|
||||
/* YYRLINE[[YYN]] -- source line where rule number YYN was defined. */
|
||||
const b4_int_type_for([b4_rline])
|
||||
yy::b4_name::rline_[[]] =
|
||||
{
|
||||
b4_rline
|
||||
};
|
||||
#endif
|
||||
|
||||
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
|
||||
yy::b4_name::TokenNumberType
|
||||
yy::b4_name::translate_ (int token)
|
||||
{
|
||||
static
|
||||
const TokenNumberType
|
||||
translate_[[]] =
|
||||
{
|
||||
b4_translate
|
||||
};
|
||||
if ((unsigned) token <= user_token_number_max_)
|
||||
return translate_[[token]];
|
||||
else
|
||||
return undef_token_;
|
||||
}
|
||||
|
||||
const int yy::b4_name::eof_ = 0;
|
||||
const int yy::b4_name::last_ = b4_last;
|
||||
const int yy::b4_name::nnts_ = b4_nterms_number;
|
||||
const int yy::b4_name::empty_ = -2;
|
||||
const int yy::b4_name::final_ = b4_final_state_number;
|
||||
const int yy::b4_name::terror_ = 1;
|
||||
const int yy::b4_name::errcode_ = 256;
|
||||
const int yy::b4_name::ntokens_ = b4_tokens_number;
|
||||
const int yy::b4_name::initdepth_ = b4_initdepth;
|
||||
|
||||
const unsigned yy::b4_name::user_token_number_max_ = b4_user_token_number_max;
|
||||
const yy::b4_name::TokenNumberType yy::b4_name::undef_token_ = b4_undef_token_number;
|
||||
|
||||
b4_epilogue
|
||||
|
||||
#output "stack.hh"
|
||||
b4_copyright([2002])
|
||||
|
||||
#ifndef BISON_STACK_HH
|
||||
# define BISON_STACK_HH
|
||||
|
||||
#include <deque>
|
||||
|
||||
namespace yy
|
||||
{
|
||||
template < class T, class S = std::deque< T > >
|
||||
class Stack
|
||||
{
|
||||
public:
|
||||
|
||||
typedef typename S::iterator Iterator;
|
||||
typedef typename S::const_iterator ConstIterator;
|
||||
|
||||
Stack () : seq_ ()
|
||||
{
|
||||
}
|
||||
|
||||
Stack (unsigned n) : seq_ (n)
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
T&
|
||||
operator [[]] (unsigned index)
|
||||
{
|
||||
return seq_[[index]];
|
||||
}
|
||||
|
||||
inline
|
||||
const T&
|
||||
operator [[]] (unsigned index) const
|
||||
{
|
||||
return seq_[[index]];
|
||||
}
|
||||
|
||||
inline
|
||||
void
|
||||
push (const T& t)
|
||||
{
|
||||
seq_.push_front (t);
|
||||
}
|
||||
|
||||
inline
|
||||
void
|
||||
pop (unsigned n = 1)
|
||||
{
|
||||
for (; n; --n)
|
||||
seq_.pop_front ();
|
||||
}
|
||||
|
||||
inline
|
||||
unsigned
|
||||
height () const
|
||||
{
|
||||
return seq_.size ();
|
||||
}
|
||||
|
||||
inline ConstIterator begin () const { return seq_.begin (); }
|
||||
inline ConstIterator end () const { return seq_.end (); }
|
||||
|
||||
private:
|
||||
|
||||
S seq_;
|
||||
};
|
||||
|
||||
template < class T, class S = Stack< T > >
|
||||
class Slice
|
||||
{
|
||||
public:
|
||||
|
||||
Slice (const S& stack,
|
||||
unsigned range) : stack_ (stack),
|
||||
range_ (range)
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
const T&
|
||||
operator [[]] (unsigned index) const
|
||||
{
|
||||
return stack_[[range_ - index]];
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
const S& stack_;
|
||||
unsigned range_;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // not BISON_STACK_HH
|
||||
|
||||
#output "location.hh"
|
||||
b4_copyright([2002])
|
||||
|
||||
#ifndef BISON_LOCATION_HH
|
||||
# define BISON_LOCATION_HH
|
||||
|
||||
namespace yy
|
||||
{
|
||||
struct Position
|
||||
{
|
||||
int line;
|
||||
int column;
|
||||
};
|
||||
|
||||
struct Location
|
||||
{
|
||||
Position first;
|
||||
Position last;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // not BISON_LOCATION_HH
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,9 @@
|
||||
# This file is part of -*- Autoconf -*-.
|
||||
# Version of Autoconf.
|
||||
# Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
m4_define([m4_PACKAGE_NAME], [GNU Autoconf])
|
||||
m4_define([m4_PACKAGE_TARNAME], [autoconf])
|
||||
m4_define([m4_PACKAGE_VERSION], [2.52h])
|
||||
m4_define([m4_PACKAGE_STRING], [GNU Autoconf 2.52h])
|
||||
m4_define([m4_PACKAGE_BUGREPORT], [[email protected]])
|
||||
+1292
File diff suppressed because it is too large
Load Diff
@@ -6,6 +6,7 @@ bison.dvi
|
||||
bison.fn
|
||||
bison.ky
|
||||
bison.log
|
||||
bison.pdf
|
||||
bison.pg
|
||||
bison.ps
|
||||
bison.toc
|
||||
@@ -14,3 +15,7 @@ bison.vr
|
||||
refcard.dvi
|
||||
refcard.log
|
||||
refcard.ps
|
||||
Makefile.in
|
||||
*.info*
|
||||
stamp-vti
|
||||
version.texi
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
||||
AUTOMAKE_OPTIONS = 1.4
|
||||
|
||||
info_TEXINFOS = bison.texinfo
|
||||
man_MANS = bison.1
|
||||
|
||||
-403
@@ -1,403 +0,0 @@
|
||||
# Makefile.in generated automatically by automake 1.5a from Makefile.am.
|
||||
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
|
||||
# Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = @program_transform_name@
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
|
||||
EXEEXT = @EXEEXT@
|
||||
OBJEXT = @OBJEXT@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
AMTAR = @AMTAR@
|
||||
AWK = @AWK@
|
||||
BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@
|
||||
CATALOGS = @CATALOGS@
|
||||
CATOBJEXT = @CATOBJEXT@
|
||||
CC = @CC@
|
||||
CPP = @CPP@
|
||||
DATADIRNAME = @DATADIRNAME@
|
||||
DEPDIR = @DEPDIR@
|
||||
GENCAT = @GENCAT@
|
||||
GLIBC21 = @GLIBC21@
|
||||
GMOFILES = @GMOFILES@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
INSTOBJEXT = @INSTOBJEXT@
|
||||
INTLBISON = @INTLBISON@
|
||||
INTLLIBS = @INTLLIBS@
|
||||
INTLOBJS = @INTLOBJS@
|
||||
INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@
|
||||
LIBICONV = @LIBICONV@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
M4 = @M4@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
MSGFMT = @MSGFMT@
|
||||
PACKAGE = @PACKAGE@
|
||||
POFILES = @POFILES@
|
||||
POSUB = @POSUB@
|
||||
RANLIB = @RANLIB@
|
||||
U = @U@
|
||||
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
|
||||
USE_NLS = @USE_NLS@
|
||||
VERSION = @VERSION@
|
||||
WARNING_CFLAGS = @WARNING_CFLAGS@
|
||||
am__include = @am__include@
|
||||
am__quote = @am__quote@
|
||||
install_sh = @install_sh@
|
||||
|
||||
AUTOMAKE_OPTIONS = 1.4
|
||||
|
||||
info_TEXINFOS = bison.texinfo
|
||||
man_MANS = bison.1
|
||||
bison_TEXINFOS = gpl.texi fdl.texi
|
||||
|
||||
EXTRA_DIST = FAQ bison.1 bison.rnh refcard.tex
|
||||
|
||||
CLEANFILES = refcard.dvi refcard.log refcard.ps
|
||||
subdir = doc
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
DIST_SOURCES =
|
||||
TEXINFO_TEX = $(top_srcdir)/config/texinfo.tex
|
||||
INFO_DEPS = bison.info
|
||||
DVIS = bison.dvi
|
||||
TEXINFOS = bison.texinfo
|
||||
|
||||
NROFF = nroff
|
||||
MANS = $(man_MANS)
|
||||
DIST_COMMON = $(bison_TEXINFOS) Makefile.am Makefile.in stamp-vti \
|
||||
version.texi
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .dvi .info .ps .texinfo
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu doc/Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) && \
|
||||
CONFIG_HEADERS= CONFIG_LINKS= \
|
||||
CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
|
||||
|
||||
$(srcdir)/version.texi: $(srcdir)/stamp-vti
|
||||
@:
|
||||
$(srcdir)/stamp-vti: bison.texinfo $(top_srcdir)/configure.in
|
||||
@(set `$(SHELL) $(top_srcdir)/config/mdate-sh $(srcdir)/bison.texinfo`; \
|
||||
echo "@set UPDATED $$1 $$2 $$3"; \
|
||||
echo "@set UPDATED-MONTH $$2 $$3"; \
|
||||
echo "@set EDITION $(VERSION)"; \
|
||||
echo "@set VERSION $(VERSION)") > vti.tmp
|
||||
@cmp -s vti.tmp $(srcdir)/version.texi \
|
||||
|| (echo "Updating $(srcdir)/version.texi"; \
|
||||
cp vti.tmp $(srcdir)/version.texi)
|
||||
-@rm -f vti.tmp
|
||||
@cp $(srcdir)/version.texi $@
|
||||
|
||||
mostlyclean-vti:
|
||||
-rm -f vti.tmp
|
||||
|
||||
maintainer-clean-vti:
|
||||
-rm -f $(srcdir)/stamp-vti $(srcdir)/version.texi
|
||||
|
||||
bison.info: bison.texinfo $(srcdir)/version.texi $(bison_TEXINFOS)
|
||||
bison.dvi: bison.texinfo $(srcdir)/version.texi $(bison_TEXINFOS)
|
||||
|
||||
.texinfo.info:
|
||||
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
|
||||
cd $(srcdir) \
|
||||
&& $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) \
|
||||
`echo $< | sed 's,.*/,,'`
|
||||
|
||||
.texinfo.dvi:
|
||||
TEXINPUTS="$(top_srcdir)/config$(PATH_SEPARATOR)$$TEXINPUTS" \
|
||||
MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \
|
||||
$(TEXI2DVI) $<
|
||||
|
||||
.texinfo:
|
||||
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
|
||||
cd $(srcdir) \
|
||||
&& $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) \
|
||||
`echo $< | sed 's,.*/,,'`
|
||||
|
||||
MAKEINFO = @MAKEINFO@
|
||||
TEXI2DVI = texi2dvi
|
||||
DVIPS = dvips
|
||||
.dvi.ps:
|
||||
$(DVIPS) $< -o $@
|
||||
|
||||
uninstall-info-am:
|
||||
$(PRE_UNINSTALL)
|
||||
@if (install-info --version && \
|
||||
install-info --version | fgrep -i -v debian) >/dev/null 2>&1; then \
|
||||
list='$(INFO_DEPS)'; \
|
||||
for file in $$list; do \
|
||||
echo " install-info --info-dir=$(DESTDIR)$(infodir) --remove $(DESTDIR)$(infodir)/$$file"; \
|
||||
install-info --info-dir=$(DESTDIR)$(infodir) --remove $(DESTDIR)$(infodir)/$$file; \
|
||||
done; \
|
||||
else :; fi
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(INFO_DEPS)'; \
|
||||
for file in $$list; do \
|
||||
(if cd $(DESTDIR)$(infodir); then \
|
||||
echo " rm -f $$file $$file-[0-9] $$file-[0-9][0-9])"; \
|
||||
rm -f $$file $$file-[0-9] $$file-[0-9][0-9]; \
|
||||
else :; fi); \
|
||||
done
|
||||
|
||||
dist-info: $(INFO_DEPS)
|
||||
list='$(INFO_DEPS)'; \
|
||||
for base in $$list; do \
|
||||
d=$(srcdir); \
|
||||
for file in $$d/$$base*; do \
|
||||
relfile=`expr "$$file" : "$$d/\(.*\)"`; \
|
||||
test -f $(distdir)/$$relfile || \
|
||||
cp -p $$file $(distdir)/$$relfile; \
|
||||
done; \
|
||||
done
|
||||
|
||||
mostlyclean-aminfo:
|
||||
-rm -f bison.aux bison.cp bison.cps bison.dvi bison.fn bison.ky bison.log \
|
||||
bison.pg bison.ps bison.toc bison.tp bison.vr
|
||||
|
||||
maintainer-clean-aminfo:
|
||||
cd $(srcdir) && \
|
||||
for i in $(INFO_DEPS); do \
|
||||
rm -f $$i; \
|
||||
if test "`echo $$i-[0-9]*`" != "$$i-[0-9]*"; then \
|
||||
rm -f $$i-[0-9]*; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
man1dir = $(mandir)/man1
|
||||
install-man1: $(man1_MANS) $(man_MANS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(man1dir)
|
||||
@list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
|
||||
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
|
||||
for i in $$l2; do \
|
||||
case "$$i" in \
|
||||
*.1*) list="$$list $$i" ;; \
|
||||
esac; \
|
||||
done; \
|
||||
for i in $$list; do \
|
||||
if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
|
||||
else file=$$i; fi; \
|
||||
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
|
||||
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
|
||||
inst=`echo $$inst | sed -e 's/^.*\///'`; \
|
||||
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
|
||||
echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst"; \
|
||||
$(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst; \
|
||||
done
|
||||
uninstall-man1:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
|
||||
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
|
||||
for i in $$l2; do \
|
||||
case "$$i" in \
|
||||
*.1*) list="$$list $$i" ;; \
|
||||
esac; \
|
||||
done; \
|
||||
for i in $$list; do \
|
||||
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
|
||||
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
|
||||
inst=`echo $$inst | sed -e 's/^.*\///'`; \
|
||||
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
|
||||
echo " rm -f $(DESTDIR)$(man1dir)/$$inst"; \
|
||||
rm -f $(DESTDIR)$(man1dir)/$$inst; \
|
||||
done
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
top_distdir = ..
|
||||
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@for file in $(DISTFILES); do \
|
||||
if test -f $$file; then d=.; else d=$(srcdir); fi; \
|
||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
$(mkinstalldirs) "$(distdir)/$$dir"; \
|
||||
fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pR $$d/$$file $(distdir) \
|
||||
|| exit 1; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
$(MAKE) $(AM_MAKEFLAGS) \
|
||||
top_distdir="${top_distdir}" distdir="$(distdir)" \
|
||||
dist-info
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(INFO_DEPS) $(MANS)
|
||||
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(DESTDIR)$(infodir) $(DESTDIR)$(man1dir)
|
||||
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
|
||||
distclean-am: clean-am distclean-generic
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am: $(DVIS)
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am: $(INFO_DEPS)
|
||||
|
||||
install-data-am: install-info-am install-man
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am: $(INFO_DEPS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(infodir)
|
||||
@list='$(INFO_DEPS)'; \
|
||||
for file in $$list; do \
|
||||
d=$(srcdir); \
|
||||
for ifile in echo $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9]; do \
|
||||
if test -f $$ifile; then \
|
||||
relfile=`expr "$$ifile" : "$$d/\(.*\)"`; \
|
||||
echo " $(INSTALL_DATA) $$ifile $(DESTDIR)$(infodir)/$$relfile"; \
|
||||
$(INSTALL_DATA) $$ifile $(DESTDIR)$(infodir)/$$relfile; \
|
||||
else : ; fi; \
|
||||
done; \
|
||||
done
|
||||
@$(POST_INSTALL)
|
||||
@if (install-info --version && \
|
||||
install-info --version | fgrep -i -v debian) >/dev/null 2>&1; then \
|
||||
list='$(INFO_DEPS)'; \
|
||||
for file in $$list; do \
|
||||
echo " install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file";\
|
||||
install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file || :;\
|
||||
done; \
|
||||
else : ; fi
|
||||
install-man: install-man1
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
|
||||
maintainer-clean-am: distclean-am maintainer-clean-aminfo \
|
||||
maintainer-clean-generic maintainer-clean-vti
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-aminfo mostlyclean-generic mostlyclean-vti
|
||||
|
||||
uninstall-am: uninstall-info-am uninstall-man
|
||||
|
||||
uninstall-man: uninstall-man1
|
||||
|
||||
.PHONY: all all-am check check-am clean clean-generic dist-info \
|
||||
distclean distclean-generic distdir dvi dvi-am info info-am \
|
||||
install install-am install-data install-data-am install-exec \
|
||||
install-exec-am install-info install-info-am install-man \
|
||||
install-man1 install-strip installcheck installcheck-am \
|
||||
installdirs maintainer-clean maintainer-clean-aminfo \
|
||||
maintainer-clean-generic maintainer-clean-vti mostlyclean \
|
||||
mostlyclean-aminfo mostlyclean-generic mostlyclean-vti \
|
||||
uninstall uninstall-am uninstall-info-am uninstall-man \
|
||||
uninstall-man1
|
||||
|
||||
|
||||
refcard.dvi: refcard.tex
|
||||
tex refcard.tex
|
||||
|
||||
refcard.ps: refcard.dvi
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
+2
-2
@@ -262,9 +262,9 @@ and so on.
|
||||
.ns
|
||||
.TP
|
||||
.B \-\-debug
|
||||
Output a definition of the macro
|
||||
In the parser file, define the macro
|
||||
.B YYDEBUG
|
||||
into the parser file,
|
||||
to 1 if it is not already defined,
|
||||
so that the debugging facilities are compiled.
|
||||
.TP
|
||||
.B \-v
|
||||
|
||||
-145
@@ -1,145 +0,0 @@
|
||||
Ceci est le fichier Info bison.info, produit par Makeinfo version 4.0b
|
||||
à partir bison.texinfo.
|
||||
|
||||
START-INFO-DIR-ENTRY
|
||||
* bison: (bison). GNU Project parser generator (yacc replacement).
|
||||
END-INFO-DIR-ENTRY
|
||||
|
||||
This file documents the Bison parser generator.
|
||||
|
||||
Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1995, 1998, 1999,
|
||||
2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of this
|
||||
manual provided the copyright notice and this permission notice are
|
||||
preserved on all copies.
|
||||
|
||||
Permission is granted to copy and distribute modified versions of
|
||||
this manual under the conditions for verbatim copying, provided also
|
||||
that the sections entitled "GNU General Public License" and "Conditions
|
||||
for Using Bison" are included exactly as in the original, and provided
|
||||
that the entire resulting derived work is distributed under the terms
|
||||
of a permission notice identical to this one.
|
||||
|
||||
Permission is granted to copy and distribute translations of this
|
||||
manual into another language, under the above conditions for modified
|
||||
versions, except that the sections entitled "GNU General Public
|
||||
License", "Conditions for Using Bison" and this permission notice may be
|
||||
included in translations approved by the Free Software Foundation
|
||||
instead of in the original English.
|
||||
|
||||
|
||||
Indirect:
|
||||
bison.info-1: 1313
|
||||
bison.info-2: 50691
|
||||
bison.info-3: 100581
|
||||
bison.info-4: 150131
|
||||
bison.info-5: 197908
|
||||
|
||||
Tag Table:
|
||||
(Indirect)
|
||||
Node: Top1313
|
||||
Node: Introduction8969
|
||||
Node: Conditions10244
|
||||
Node: Copying11708
|
||||
Node: Concepts30911
|
||||
Node: Language and Grammar31990
|
||||
Node: Grammar in Bison37006
|
||||
Node: Semantic Values38930
|
||||
Node: Semantic Actions41031
|
||||
Node: Locations Overview42220
|
||||
Node: Bison Parser43667
|
||||
Node: Stages45979
|
||||
Node: Grammar Layout47262
|
||||
Node: Examples48519
|
||||
Node: RPN Calc49717
|
||||
Node: Rpcalc Decls50691
|
||||
Node: Rpcalc Rules52278
|
||||
Node: Rpcalc Input54078
|
||||
Node: Rpcalc Line55539
|
||||
Node: Rpcalc Expr56654
|
||||
Node: Rpcalc Lexer58599
|
||||
Node: Rpcalc Main61171
|
||||
Node: Rpcalc Error61569
|
||||
Node: Rpcalc Gen62577
|
||||
Node: Rpcalc Compile63726
|
||||
Node: Infix Calc64601
|
||||
Node: Simple Error Recovery67308
|
||||
Node: Location Tracking Calc69197
|
||||
Node: Ltcalc Decls69927
|
||||
Node: Ltcalc Rules70836
|
||||
Node: Ltcalc Lexer72897
|
||||
Node: Multi-function Calc75235
|
||||
Node: Mfcalc Decl76802
|
||||
Node: Mfcalc Rules78825
|
||||
Node: Mfcalc Symtab80205
|
||||
Node: Exercises86578
|
||||
Node: Grammar File87084
|
||||
Node: Grammar Outline87932
|
||||
Node: C Declarations88666
|
||||
Node: Bison Declarations89246
|
||||
Node: Grammar Rules89658
|
||||
Node: C Code90118
|
||||
Node: Symbols91048
|
||||
Node: Rules96129
|
||||
Node: Recursion97768
|
||||
Node: Semantics99487
|
||||
Node: Value Type100581
|
||||
Node: Multiple Types101253
|
||||
Node: Actions102270
|
||||
Node: Action Types105055
|
||||
Node: Mid-Rule Actions106358
|
||||
Node: Locations111928
|
||||
Node: Location Type112576
|
||||
Node: Actions and Locations113134
|
||||
Node: Location Default Action115290
|
||||
Node: Declarations116753
|
||||
Node: Token Decl118072
|
||||
Node: Precedence Decl120085
|
||||
Node: Union Decl121636
|
||||
Node: Type Decl122480
|
||||
Node: Expect Decl123386
|
||||
Node: Start Decl124932
|
||||
Node: Pure Decl125310
|
||||
Node: Decl Summary126987
|
||||
Node: Multiple Parsers132370
|
||||
Node: Interface133864
|
||||
Node: Parser Function134736
|
||||
Node: Lexical135571
|
||||
Node: Calling Convention136977
|
||||
Node: Token Values139748
|
||||
Node: Token Positions140897
|
||||
Node: Pure Calling141782
|
||||
Node: Error Reporting144714
|
||||
Node: Action Features146836
|
||||
Node: Algorithm150131
|
||||
Node: Look-Ahead152424
|
||||
Node: Shift/Reduce154556
|
||||
Node: Precedence157468
|
||||
Node: Why Precedence158119
|
||||
Node: Using Precedence159984
|
||||
Node: Precedence Examples160952
|
||||
Node: How Precedence161653
|
||||
Node: Contextual Precedence162802
|
||||
Node: Parser States164593
|
||||
Node: Reduce/Reduce165836
|
||||
Node: Mystery Conflicts169397
|
||||
Node: Stack Overflow172783
|
||||
Node: Error Recovery174156
|
||||
Node: Context Dependency179292
|
||||
Node: Semantic Tokens180140
|
||||
Node: Lexical Tie-ins183157
|
||||
Node: Tie-in Recovery184705
|
||||
Node: Debugging186877
|
||||
Node: Invocation190178
|
||||
Node: Bison Options191430
|
||||
Node: Environment Variables195398
|
||||
Node: Option Cross Key196246
|
||||
Node: VMS Invocation197124
|
||||
Node: Table of Symbols197908
|
||||
Node: Glossary205547
|
||||
Node: Copying This Manual211851
|
||||
Node: GNU Free Documentation License212060
|
||||
Node: Index231925
|
||||
|
||||
End Tag Table
|
||||
-1076
File diff suppressed because it is too large
Load Diff
-1427
File diff suppressed because it is too large
Load Diff
-1317
File diff suppressed because it is too large
Load Diff
-1261
File diff suppressed because it is too large
Load Diff
-1036
File diff suppressed because it is too large
Load Diff
+2
-1
@@ -56,7 +56,8 @@ foo_tab.c.
|
||||
.indent -1
|
||||
2 /DEBUG
|
||||
.skip
|
||||
Output a definition of the macro YYDEBUG into the parser file,
|
||||
In the parser file,
|
||||
define the macro YYDEBUG to 1 if it is not already defined,
|
||||
so that the debugging facilities are compiled.
|
||||
.skip
|
||||
.indent -1
|
||||
|
||||
+1326
-473
File diff suppressed because it is too large
Load Diff
+44
-38
@@ -6,7 +6,7 @@
|
||||
% This file can be printed with 1 or 2 columns per page (see below).
|
||||
% Specify how many you want here. Nothing else needs to be changed
|
||||
% unless you are maintaining the documentation.
|
||||
% For printing reference cards to use in books, specify one column
|
||||
% For printing reference cards to use in books, specify one column
|
||||
% per page and reduce to 80%.
|
||||
% Note that if columnsperpage is set to 2, there will be a few overfull
|
||||
% boxes, but they are not serious. Just uncomment \finalout.
|
||||
@@ -19,7 +19,7 @@
|
||||
\def\finalout{\overfullrule=0pt}
|
||||
%\finalout
|
||||
|
||||
% Copyright (c) 1998 Free Software Foundation, Inc.
|
||||
% Copyright (c) 1998, 2001 Free Software Foundation, Inc.
|
||||
%
|
||||
% This file is part of Bison.
|
||||
%
|
||||
@@ -51,11 +51,11 @@
|
||||
% Which mode to use is controlled by setting \columnsperpage above.
|
||||
%
|
||||
% Authors:
|
||||
% Brendan Kehoe
|
||||
% Brendan Kehoe
|
||||
% UUCP: widener!brendan
|
||||
% Internet: [email protected]
|
||||
% Internet: [email protected]
|
||||
%
|
||||
% Gavin Nicol
|
||||
% Gavin Nicol
|
||||
% Internet: [email protected]
|
||||
%
|
||||
% This refcard format was created by Steve Gildea.
|
||||
@@ -66,12 +66,12 @@
|
||||
% We only change the following to change the version numbers and
|
||||
% such.
|
||||
|
||||
\def\bisonversion{1.20} % the bison version
|
||||
\def\bisonversion{1.31} % the bison version
|
||||
|
||||
\def\refcardversion{0.4a} % reference card version
|
||||
\def\month{August} % month
|
||||
\def\year{1998} % year
|
||||
\def\version{\month\ \year, Bison Refcard Version \refcardversion}
|
||||
\def\refcardversion{0.5} % reference card version
|
||||
\def\month{November} % month
|
||||
\def\year{2001} % year
|
||||
\def\version{\month\ \year, Bison Refcard Version \refcardversion}
|
||||
|
||||
% for copyright notices
|
||||
\def\small{\smallfont\textfont2=\smallsy\baselineskip=.8\baselineskip}
|
||||
@@ -90,7 +90,7 @@
|
||||
|
||||
Permission is granted to make and distribute copies of this card
|
||||
provided the copyright notice and this permission notice
|
||||
are preserved on all copies.
|
||||
are preserved on all copies.
|
||||
\vskip .2\baselineskip
|
||||
For information, write to the:
|
||||
\vskip .2\baselineskip
|
||||
@@ -115,7 +115,7 @@ For information, write to the:
|
||||
|
||||
Permission is granted to make and distribute copies of this card
|
||||
provided the copyright notice and this permission notice
|
||||
are preserved on all copies.
|
||||
are preserved on all copies.
|
||||
\vskip .2\baselineskip
|
||||
For information, write to the:
|
||||
\vskip .2\baselineskip
|
||||
@@ -136,7 +136,7 @@ For information, write to the:
|
||||
|
||||
\def\ncolumns{\the\columnsperpage}
|
||||
|
||||
\message{[\ncolumns\space
|
||||
\message{[\ncolumns\space
|
||||
column\if 1\ncolumns\else s\fi\space per page]}
|
||||
|
||||
\def\scaledmag#1{ scaled \magstep #1}
|
||||
@@ -227,7 +227,7 @@ For information, write to the:
|
||||
\def\bye{\par\vfill\supereject
|
||||
\if a\abc \else\null\vfill\eject\fi
|
||||
\if a\abc \else\null\vfill\eject\fi
|
||||
\end}
|
||||
\end}
|
||||
\fi
|
||||
|
||||
% we won't be using math mode much, so redefine some of the characters
|
||||
@@ -316,41 +316,44 @@ Options can be used as: \kbd{bison {\it options} {\it filename}}
|
||||
\section{Command Line Options}
|
||||
%*****************************
|
||||
|
||||
\key{Display usage information.} {-h}
|
||||
\key{Display version information.} {-V}
|
||||
\key{Generate token and {\tt YYSTYPE} definitions.} {-d}
|
||||
\key{Prepend a prefix to external symbols.} {-p {\it prefix}}
|
||||
\key{Don't put {\tt \#line} directives in the parser.} {-l}
|
||||
\key{Specify the output file.} {-o {\it filename}}
|
||||
\key{Debug or {\it trace} mode.} {-t}
|
||||
\key{Debug or {\it trace} mode.} {-t}
|
||||
\key{Verbose description of the parser.} {-v}
|
||||
\key{Emulate {\tt yacc} (generate {\tt y.tab.*} files).} {-y}
|
||||
|
||||
\vskip .10truein
|
||||
{\bf Note:} The token and {\tt YYSTYPE} definitions are generated
|
||||
to a file called {\tt y.tab.h} if the {\tt -y} option is used,
|
||||
{\bf Note:} The token and {\tt YYSTYPE} definitions are generated
|
||||
to a file called {\tt y.tab.h} if the {\tt -y} option is used,
|
||||
otherwise it will have the format {\tt {\it name}.tab.h}, where
|
||||
{\it name} is the leading part of the parser definition filename.
|
||||
|
||||
\section{Definitions}
|
||||
%********************
|
||||
|
||||
\key{Declare a terminal symbol.}{\%token <{\it t\/}>
|
||||
\key{Declare a terminal symbol.}{\%token <{\it t\/}>
|
||||
{\it n}}
|
||||
|
||||
\key{Declare a terminal symbol, and define its association.}
|
||||
\key{Declare a terminal symbol, and define its association.}
|
||||
{{\it association} <{\it t\/}> {\it n}}
|
||||
|
||||
\vskip .2\baselineskip
|
||||
\key{Generate a reentrant (pure) parser.}
|
||||
\key{Generate a reentrant (pure) parser.}
|
||||
{\%pure_parser}
|
||||
|
||||
\key{Define the union of all data types used in the parser.}
|
||||
\key{Define the union of all data types used in the parser.}
|
||||
{\%union\{{\it field list}\} }
|
||||
|
||||
\vskip .2\baselineskip
|
||||
\key{Tell {\tt bison} where to start parsing.}
|
||||
{\%start {\it m}}
|
||||
\key{Tell {\tt bison} where to start parsing.}
|
||||
{\%start {\it m}}
|
||||
|
||||
\key{Tell {\tt bison} the data type of symbols.}
|
||||
{\%type <{\it t\/}> {\it s1}\dots{\it sn}}
|
||||
\key{Tell {\tt bison} the data type of symbols.}
|
||||
{\%type <{\it t\/}> {\it s1}\dots{\it sn}}
|
||||
|
||||
\vskip .10truein
|
||||
|
||||
@@ -362,8 +365,8 @@ definition, {\it n} is a {\it terminal} symbol name, {\it m} is a
|
||||
\vskip .10truein
|
||||
|
||||
The {\tt <{\it t\/}>} after {\tt \%token, \%left, \%right} and {\tt
|
||||
\%nonassoc} is optional. Additionally, precedence may be overridden with
|
||||
embedded {\tt \%prec} commands.
|
||||
\%nonassoc} is optional. Additionally, precedence may be overridden
|
||||
in the rules with {\tt \%prec} commands.
|
||||
|
||||
\section{Parser Definition Files}
|
||||
%*********************************
|
||||
@@ -379,7 +382,7 @@ The general form for a parser definition is:
|
||||
|
||||
\%\%
|
||||
|
||||
Rule definition 1
|
||||
Rule definition 1
|
||||
\vdots
|
||||
Rule definition {\it n}
|
||||
|
||||
@@ -397,8 +400,9 @@ The general form for a parser definition is:
|
||||
|
||||
Rules take the form:
|
||||
|
||||
\vskip -\baselineskip
|
||||
\beginexample
|
||||
non-terminal : {\it statement} 1
|
||||
non-terminal : {\it statement} 1
|
||||
| {\it statement} 2
|
||||
\vdots
|
||||
| {\it statement n}
|
||||
@@ -406,12 +410,12 @@ Rules take the form:
|
||||
\endexample
|
||||
|
||||
Where {\it statements} can be either empty, or contain
|
||||
a mixture of C code (enclosed in {\tt \{...\}}), and the
|
||||
a mixture of C code (enclosed in {\tt \{...\}}), and the
|
||||
symbols that make up the non-terminal. For example:
|
||||
|
||||
\vskip -\baselineskip
|
||||
\beginexample
|
||||
expression : number '$+$' number \{ \$\$ $=$ \$1 $+$ \$3 \}
|
||||
expression : number '$+$' number \{ \$\$ $=$ \$1 $+$ \$3 \}
|
||||
| number '$-$' number \{ \$\$ $=$ \$1 $-$ \$3 \}
|
||||
| number '$/$' number \{ \$\$ $=$ \$1 $/$ \$3 \}
|
||||
| number '$*$' number \{ \$\$ $=$ \$1 $*$ \$3 \}
|
||||
@@ -428,7 +432,7 @@ For altering the precedence of a symbol use:
|
||||
For example:
|
||||
\vskip -\baselineskip
|
||||
\beginexample
|
||||
foo : gnu bar gnu \%prec bar
|
||||
foo : gnu bar gnu \%prec bar
|
||||
;
|
||||
\endexample
|
||||
|
||||
@@ -438,16 +442,18 @@ For example:
|
||||
\key{Recognize an error \& continue parsing.}{error}
|
||||
\key{Access data associated with a symbol.} {\$\$, \$0\dots\${\it n}}
|
||||
\key{Access a field of the data union.} {\$\$.{\it t},
|
||||
\$0.{\it t}\dots\${\it n}.{\it t}}
|
||||
\key{Access data's line position.} {@{\it n}.{\it line\_spec}}
|
||||
\key{Access data's column position.} {@{\it n}.{\it column\_spec}}
|
||||
\$0.{\it t}\dots\${\it n}.{\it t}}
|
||||
\key{Access symbol's location.} {@\$, @0\dots@{\it n}}
|
||||
\key{Access data's line location.} {@{\it x}.{\it line\_spec}}
|
||||
\key{Access data's column location.} {@{\it x}.{\it column\_spec}}
|
||||
|
||||
|
||||
\vskip .10truein
|
||||
%
|
||||
Where {\it t} is a type defined in the {\tt \%union}, {\it n} is a
|
||||
number, {\it line\_spec} one of {\tt first_line} and {\tt last_line},
|
||||
and {\it column\_spec} is specified as either {\tt first_column} or {\tt
|
||||
last_column}.
|
||||
number, {\it x} is a number or \$, {\it line\_spec} one of {\tt
|
||||
first_line} and {\tt last_line}, and {\it column\_spec} is specified
|
||||
as either {\tt first_column} or {\tt last_column}.
|
||||
|
||||
\section {Variables and Types}
|
||||
%*****************************
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
@set UPDATED 20 September 2001
|
||||
@set UPDATED-MONTH September 2001
|
||||
@set EDITION 1.29d
|
||||
@set VERSION 1.29d
|
||||
@@ -1,4 +0,0 @@
|
||||
@set UPDATED 20 September 2001
|
||||
@set UPDATED-MONTH September 2001
|
||||
@set EDITION 1.29d
|
||||
@set VERSION 1.29d
|
||||
@@ -1 +0,0 @@
|
||||
Makefile
|
||||
@@ -1,4 +0,0 @@
|
||||
2001-09-13 GNU <[email protected]>
|
||||
|
||||
* Version 0.10.40 released.
|
||||
|
||||
@@ -1,313 +0,0 @@
|
||||
# Makefile for directory with message catalog handling in GNU NLS Utilities.
|
||||
# Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Library 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
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
# USA.
|
||||
|
||||
PACKAGE = @PACKAGE@
|
||||
VERSION = @VERSION@
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
top_builddir = ..
|
||||
VPATH = @srcdir@
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
transform = @program_transform_name@
|
||||
libdir = @libdir@
|
||||
includedir = @includedir@
|
||||
datadir = @datadir@
|
||||
localedir = $(datadir)/locale
|
||||
gettextsrcdir = $(datadir)/gettext/intl
|
||||
aliaspath = $(localedir)
|
||||
subdir = intl
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
mkinstalldirs = $(SHELL) `case "$(MKINSTALLDIRS)" in /*) echo "$(MKINSTALLDIRS)" ;; *) echo "$(top_builddir)/$(MKINSTALLDIRS)" ;; esac`
|
||||
|
||||
l = @INTL_LIBTOOL_SUFFIX_PREFIX@
|
||||
|
||||
AR = ar
|
||||
CC = @CC@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
RANLIB = @RANLIB@
|
||||
YACC = @INTLBISON@ -y -d
|
||||
YFLAGS = --name-prefix=__gettext
|
||||
|
||||
DEFS = -DLOCALEDIR=\"$(localedir)\" -DLOCALE_ALIAS_PATH=\"$(aliaspath)\" \
|
||||
-DLIBDIR=\"$(libdir)\" @DEFS@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CFLAGS = @CFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
|
||||
COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
|
||||
|
||||
HEADERS = $(COMHDRS) libgnuintl.h libgettext.h loadinfo.h
|
||||
COMHDRS = gettext.h gettextP.h hash-string.h
|
||||
SOURCES = $(COMSRCS) intl-compat.c
|
||||
COMSRCS = bindtextdom.c dcgettext.c dgettext.c gettext.c \
|
||||
finddomain.c loadmsgcat.c localealias.c textdomain.c l10nflist.c \
|
||||
explodename.c dcigettext.c dcngettext.c dngettext.c ngettext.c plural.y \
|
||||
localcharset.c
|
||||
OBJECTS = @INTLOBJS@ bindtextdom.$lo dcgettext.$lo dgettext.$lo gettext.$lo \
|
||||
finddomain.$lo loadmsgcat.$lo localealias.$lo textdomain.$lo l10nflist.$lo \
|
||||
explodename.$lo dcigettext.$lo dcngettext.$lo dngettext.$lo ngettext.$lo \
|
||||
plural.$lo localcharset.$lo
|
||||
GETTOBJS = intl-compat.$lo
|
||||
DISTFILES.common = Makefile.in \
|
||||
config.charset locale.alias ref-add.sin ref-del.sin $(HEADERS) $(SOURCES)
|
||||
DISTFILES.generated = plural.c
|
||||
DISTFILES.normal = VERSION
|
||||
DISTFILES.gettext = COPYING.LIB-2 COPYING.LIB-2.1 libintl.glibc
|
||||
DISTFILES.obsolete = xopen-msg.sed linux-msg.sed po2tbl.sed.in cat-compat.c
|
||||
|
||||
# Libtool's library version information for libintl.
|
||||
# Before making a gettext release, the gettext maintainer must change this
|
||||
# according to the libtool documentation, section "Library interface versions".
|
||||
# Maintainers of other packages that include the intl directory must *not*
|
||||
# change these values.
|
||||
LTV_CURRENT=1
|
||||
LTV_REVISION=1
|
||||
LTV_AGE=0
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .y .o .lo .sin .sed
|
||||
.c.o:
|
||||
$(COMPILE) $<
|
||||
.c.lo:
|
||||
$(LIBTOOL) --mode=compile $(COMPILE) $<
|
||||
|
||||
.y.c:
|
||||
$(YACC) $(YFLAGS) --output $@ $<
|
||||
rm -f $*.h
|
||||
|
||||
.sin.sed:
|
||||
sed -e '/^#/d' -e 's/@''PACKAGE''@/@PACKAGE@/g' $< > t-$@
|
||||
mv t-$@ $@
|
||||
|
||||
INCLUDES = -I.. -I. -I$(top_srcdir)/intl
|
||||
|
||||
all: all-@USE_INCLUDED_LIBINTL@
|
||||
all-yes: libintl.$la libintl.h charset.alias ref-add.sed ref-del.sed
|
||||
all-no: all-no-@BUILD_INCLUDED_LIBINTL@
|
||||
all-no-yes: libgnuintl.$la
|
||||
all-no-no:
|
||||
|
||||
libintl.a libgnuintl.a: $(OBJECTS)
|
||||
rm -f $@
|
||||
$(AR) cru $@ $(OBJECTS)
|
||||
$(RANLIB) $@
|
||||
|
||||
libintl.la libgnuintl.la: $(OBJECTS)
|
||||
$(LIBTOOL) --mode=link \
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) $(LDFLAGS) -o $@ \
|
||||
$(OBJECTS) @LIBICONV@ \
|
||||
-version-info $(LTV_CURRENT):$(LTV_REVISION):$(LTV_AGE) \
|
||||
-rpath $(libdir) \
|
||||
-no-undefined
|
||||
|
||||
libintl.h: libgnuintl.h
|
||||
cp $(srcdir)/libgnuintl.h libintl.h
|
||||
|
||||
charset.alias: config.charset
|
||||
$(SHELL) $(srcdir)/config.charset '@host@' > t-$@
|
||||
mv t-$@ $@
|
||||
|
||||
check: all
|
||||
|
||||
# This installation goal is only used in GNU gettext. Packages which
|
||||
# only use the library should use install instead.
|
||||
|
||||
# We must not install the libintl.h/libintl.a files if we are on a
|
||||
# system which has the GNU gettext() function in its C library or in a
|
||||
# separate library.
|
||||
# If you want to use the one which comes with this version of the
|
||||
# package, you have to use `configure --with-included-gettext'.
|
||||
install: install-exec install-data
|
||||
install-exec: all
|
||||
if test "$(PACKAGE)" = "gettext" \
|
||||
&& test '@INTLOBJS@' = '$(GETTOBJS)'; then \
|
||||
$(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir); \
|
||||
$(INSTALL_DATA) libintl.h $(DESTDIR)$(includedir)/libintl.h; \
|
||||
$(LIBTOOL) --mode=install \
|
||||
$(INSTALL_DATA) libintl.$la $(DESTDIR)$(libdir)/libintl.$la; \
|
||||
else \
|
||||
: ; \
|
||||
fi
|
||||
if test '@USE_INCLUDED_LIBINTL@' = yes; then \
|
||||
$(mkinstalldirs) $(DESTDIR)$(libdir); \
|
||||
temp=$(DESTDIR)$(libdir)/t-charset.alias; \
|
||||
dest=$(DESTDIR)$(libdir)/charset.alias; \
|
||||
if test -f $(DESTDIR)$(libdir)/charset.alias; then \
|
||||
orig=$(DESTDIR)$(libdir)/charset.alias; \
|
||||
sed -f ref-add.sed $$orig > $$temp; \
|
||||
$(INSTALL_DATA) $$temp $$dest; \
|
||||
rm -f $$temp; \
|
||||
else \
|
||||
if test @GLIBC21@ = no; then \
|
||||
orig=charset.alias; \
|
||||
sed -f ref-add.sed $$orig > $$temp; \
|
||||
$(INSTALL_DATA) $$temp $$dest; \
|
||||
rm -f $$temp; \
|
||||
fi; \
|
||||
fi; \
|
||||
$(mkinstalldirs) $(DESTDIR)$(localedir); \
|
||||
test -f $(DESTDIR)$(localedir)/locale.alias \
|
||||
&& orig=$(DESTDIR)$(localedir)/locale.alias \
|
||||
|| orig=$(srcdir)/locale.alias; \
|
||||
temp=$(DESTDIR)$(localedir)/t-locale.alias; \
|
||||
dest=$(DESTDIR)$(localedir)/locale.alias; \
|
||||
sed -f ref-add.sed $$orig > $$temp; \
|
||||
$(INSTALL_DATA) $$temp $$dest; \
|
||||
rm -f $$temp; \
|
||||
else \
|
||||
: ; \
|
||||
fi
|
||||
install-data: all
|
||||
if test "$(PACKAGE)" = "gettext"; then \
|
||||
$(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
|
||||
$(INSTALL_DATA) VERSION $(DESTDIR)$(gettextsrcdir)/VERSION; \
|
||||
$(INSTALL_DATA) ChangeLog.inst $(DESTDIR)$(gettextsrcdir)/ChangeLog; \
|
||||
dists="COPYING.LIB-2 COPYING.LIB-2.1 $(DISTFILES.common)"; \
|
||||
for file in $$dists; do \
|
||||
$(INSTALL_DATA) $(srcdir)/$$file \
|
||||
$(DESTDIR)$(gettextsrcdir)/$$file; \
|
||||
done; \
|
||||
chmod a+x $(DESTDIR)$(gettextsrcdir)/config.charset; \
|
||||
dists="$(DISTFILES.generated)"; \
|
||||
for file in $$dists; do \
|
||||
if test -f $$file; then dir=.; else dir=$(srcdir); fi; \
|
||||
$(INSTALL_DATA) $$dir/$$file \
|
||||
$(DESTDIR)$(gettextsrcdir)/$$file; \
|
||||
done; \
|
||||
dists="$(DISTFILES.obsolete)"; \
|
||||
for file in $$dists; do \
|
||||
rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
|
||||
done; \
|
||||
else \
|
||||
: ; \
|
||||
fi
|
||||
|
||||
# Define this as empty until I found a useful application.
|
||||
installcheck:
|
||||
|
||||
uninstall:
|
||||
if test "$(PACKAGE)" = "gettext" \
|
||||
&& test '@INTLOBJS@' = '$(GETTOBJS)'; then \
|
||||
rm -f $(DESTDIR)$(includedir)/libintl.h; \
|
||||
$(LIBTOOL) --mode=uninstall \
|
||||
rm -f $(DESTDIR)$(libdir)/libintl.$la; \
|
||||
else \
|
||||
: ; \
|
||||
fi
|
||||
if test '@USE_INCLUDED_LIBINTL@' = yes; then \
|
||||
if test -f $(DESTDIR)$(libdir)/charset.alias; then \
|
||||
temp=$(DESTDIR)$(libdir)/t-charset.alias; \
|
||||
dest=$(DESTDIR)$(libdir)/charset.alias; \
|
||||
sed -f ref-del.sed $$dest > $$temp; \
|
||||
if grep '^# Packages using this file: $$' $$temp > /dev/null; then \
|
||||
rm -f $$dest; \
|
||||
else \
|
||||
$(INSTALL_DATA) $$temp $$dest; \
|
||||
fi; \
|
||||
rm -f $$temp; \
|
||||
fi; \
|
||||
if test -f $(DESTDIR)$(localedir)/locale.alias; then \
|
||||
temp=$(DESTDIR)$(localedir)/t-locale.alias; \
|
||||
dest=$(DESTDIR)$(localedir)/locale.alias; \
|
||||
sed -f ref-del.sed $$dest > $$temp; \
|
||||
if grep '^# Packages using this file: $$' $$temp > /dev/null; then \
|
||||
rm -f $$dest; \
|
||||
else \
|
||||
$(INSTALL_DATA) $$temp $$dest; \
|
||||
fi; \
|
||||
rm -f $$temp; \
|
||||
fi; \
|
||||
else \
|
||||
: ; \
|
||||
fi
|
||||
if test "$(PACKAGE)" = "gettext"; then \
|
||||
for file in VERSION ChangeLog COPYING.LIB-2 COPYING.LIB-2.1 $(DISTFILES.common) $(DISTFILES.generated); do \
|
||||
rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
|
||||
done; \
|
||||
else \
|
||||
: ; \
|
||||
fi
|
||||
|
||||
info dvi:
|
||||
|
||||
$(OBJECTS): ../config.h libgnuintl.h
|
||||
bindtextdom.$lo finddomain.$lo loadmsgcat.$lo: gettextP.h gettext.h loadinfo.h
|
||||
dcgettext.$lo: gettextP.h gettext.h hash-string.h loadinfo.h
|
||||
|
||||
tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES)
|
||||
here=`pwd`; cd $(srcdir) && etags -o $$here/TAGS $(HEADERS) $(SOURCES)
|
||||
|
||||
id: ID
|
||||
|
||||
ID: $(HEADERS) $(SOURCES)
|
||||
here=`pwd`; cd $(srcdir) && mkid -f$$here/ID $(HEADERS) $(SOURCES)
|
||||
|
||||
|
||||
mostlyclean:
|
||||
rm -f *.a *.la *.o *.lo core core.*
|
||||
rm -f libintl.h charset.alias ref-add.sed ref-del.sed
|
||||
rm -f -r .libs _libs
|
||||
|
||||
clean: mostlyclean
|
||||
|
||||
distclean: clean
|
||||
rm -f Makefile ID TAGS
|
||||
if test "$(PACKAGE)" = gettext; then \
|
||||
rm -f ChangeLog.inst $(DISTFILES.normal); \
|
||||
else \
|
||||
: ; \
|
||||
fi
|
||||
|
||||
maintainer-clean: distclean
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
|
||||
# GNU gettext needs not contain the file `VERSION' but contains some
|
||||
# other files which should not be distributed in other packages.
|
||||
distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
dist distdir: Makefile
|
||||
if test "$(PACKAGE)" = gettext; then \
|
||||
additional="$(DISTFILES.gettext)"; \
|
||||
else \
|
||||
additional="$(DISTFILES.normal)"; \
|
||||
fi; \
|
||||
$(MAKE) $(DISTFILES.common) $(DISTFILES.generated) $$additional; \
|
||||
for file in ChangeLog $(DISTFILES.common) $(DISTFILES.generated) $$additional; do \
|
||||
if test -f $$file; then dir=.; else dir=$(srcdir); fi; \
|
||||
ln $$dir/$$file $(distdir) 2> /dev/null \
|
||||
|| cp -p $$dir/$$file $(distdir); \
|
||||
done
|
||||
|
||||
Makefile: Makefile.in ../config.status
|
||||
cd .. \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make not to export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
@@ -1 +0,0 @@
|
||||
GNU gettext library from gettext-0.10.40
|
||||
@@ -1,369 +0,0 @@
|
||||
/* Implementation of the bindtextdomain(3) function
|
||||
Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef _LIBC
|
||||
# include <libintl.h>
|
||||
#else
|
||||
# include "libgnuintl.h"
|
||||
#endif
|
||||
#include "gettextP.h"
|
||||
|
||||
#ifdef _LIBC
|
||||
/* We have to handle multi-threaded applications. */
|
||||
# include <bits/libc-lock.h>
|
||||
#else
|
||||
/* Provide dummy implementation if this is outside glibc. */
|
||||
# define __libc_rwlock_define(CLASS, NAME)
|
||||
# define __libc_rwlock_wrlock(NAME)
|
||||
# define __libc_rwlock_unlock(NAME)
|
||||
#endif
|
||||
|
||||
/* The internal variables in the standalone libintl.a must have different
|
||||
names than the internal variables in GNU libc, otherwise programs
|
||||
using libintl.a cannot be linked statically. */
|
||||
#if !defined _LIBC
|
||||
# define _nl_default_dirname _nl_default_dirname__
|
||||
# define _nl_domain_bindings _nl_domain_bindings__
|
||||
#endif
|
||||
|
||||
/* Some compilers, like SunOS4 cc, don't have offsetof in <stddef.h>. */
|
||||
#ifndef offsetof
|
||||
# define offsetof(type,ident) ((size_t)&(((type*)0)->ident))
|
||||
#endif
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
/* Contains the default location of the message catalogs. */
|
||||
extern const char _nl_default_dirname[];
|
||||
|
||||
/* List with bindings of specific domains. */
|
||||
extern struct binding *_nl_domain_bindings;
|
||||
|
||||
/* Lock variable to protect the global data in the gettext implementation. */
|
||||
__libc_rwlock_define (extern, _nl_state_lock)
|
||||
|
||||
|
||||
/* Names for the libintl functions are a problem. They must not clash
|
||||
with existing names and they should follow ANSI C. But this source
|
||||
code is also used in GNU C Library where the names have a __
|
||||
prefix. So we have to make a difference here. */
|
||||
#ifdef _LIBC
|
||||
# define BINDTEXTDOMAIN __bindtextdomain
|
||||
# define BIND_TEXTDOMAIN_CODESET __bind_textdomain_codeset
|
||||
# ifndef strdup
|
||||
# define strdup(str) __strdup (str)
|
||||
# endif
|
||||
#else
|
||||
# define BINDTEXTDOMAIN bindtextdomain__
|
||||
# define BIND_TEXTDOMAIN_CODESET bind_textdomain_codeset__
|
||||
#endif
|
||||
|
||||
/* Prototypes for local functions. */
|
||||
static void set_binding_values PARAMS ((const char *domainname,
|
||||
const char **dirnamep,
|
||||
const char **codesetp));
|
||||
|
||||
/* Specifies the directory name *DIRNAMEP and the output codeset *CODESETP
|
||||
to be used for the DOMAINNAME message catalog.
|
||||
If *DIRNAMEP or *CODESETP is NULL, the corresponding attribute is not
|
||||
modified, only the current value is returned.
|
||||
If DIRNAMEP or CODESETP is NULL, the corresponding attribute is neither
|
||||
modified nor returned. */
|
||||
static void
|
||||
set_binding_values (domainname, dirnamep, codesetp)
|
||||
const char *domainname;
|
||||
const char **dirnamep;
|
||||
const char **codesetp;
|
||||
{
|
||||
struct binding *binding;
|
||||
int modified;
|
||||
|
||||
/* Some sanity checks. */
|
||||
if (domainname == NULL || domainname[0] == '\0')
|
||||
{
|
||||
if (dirnamep)
|
||||
*dirnamep = NULL;
|
||||
if (codesetp)
|
||||
*codesetp = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
__libc_rwlock_wrlock (_nl_state_lock);
|
||||
|
||||
modified = 0;
|
||||
|
||||
for (binding = _nl_domain_bindings; binding != NULL; binding = binding->next)
|
||||
{
|
||||
int compare = strcmp (domainname, binding->domainname);
|
||||
if (compare == 0)
|
||||
/* We found it! */
|
||||
break;
|
||||
if (compare < 0)
|
||||
{
|
||||
/* It is not in the list. */
|
||||
binding = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (binding != NULL)
|
||||
{
|
||||
if (dirnamep)
|
||||
{
|
||||
const char *dirname = *dirnamep;
|
||||
|
||||
if (dirname == NULL)
|
||||
/* The current binding has be to returned. */
|
||||
*dirnamep = binding->dirname;
|
||||
else
|
||||
{
|
||||
/* The domain is already bound. If the new value and the old
|
||||
one are equal we simply do nothing. Otherwise replace the
|
||||
old binding. */
|
||||
char *result = binding->dirname;
|
||||
if (strcmp (dirname, result) != 0)
|
||||
{
|
||||
if (strcmp (dirname, _nl_default_dirname) == 0)
|
||||
result = (char *) _nl_default_dirname;
|
||||
else
|
||||
{
|
||||
#if defined _LIBC || defined HAVE_STRDUP
|
||||
result = strdup (dirname);
|
||||
#else
|
||||
size_t len = strlen (dirname) + 1;
|
||||
result = (char *) malloc (len);
|
||||
if (__builtin_expect (result != NULL, 1))
|
||||
memcpy (result, dirname, len);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (__builtin_expect (result != NULL, 1))
|
||||
{
|
||||
if (binding->dirname != _nl_default_dirname)
|
||||
free (binding->dirname);
|
||||
|
||||
binding->dirname = result;
|
||||
modified = 1;
|
||||
}
|
||||
}
|
||||
*dirnamep = result;
|
||||
}
|
||||
}
|
||||
|
||||
if (codesetp)
|
||||
{
|
||||
const char *codeset = *codesetp;
|
||||
|
||||
if (codeset == NULL)
|
||||
/* The current binding has be to returned. */
|
||||
*codesetp = binding->codeset;
|
||||
else
|
||||
{
|
||||
/* The domain is already bound. If the new value and the old
|
||||
one are equal we simply do nothing. Otherwise replace the
|
||||
old binding. */
|
||||
char *result = binding->codeset;
|
||||
if (result == NULL || strcmp (codeset, result) != 0)
|
||||
{
|
||||
#if defined _LIBC || defined HAVE_STRDUP
|
||||
result = strdup (codeset);
|
||||
#else
|
||||
size_t len = strlen (codeset) + 1;
|
||||
result = (char *) malloc (len);
|
||||
if (__builtin_expect (result != NULL, 1))
|
||||
memcpy (result, codeset, len);
|
||||
#endif
|
||||
|
||||
if (__builtin_expect (result != NULL, 1))
|
||||
{
|
||||
if (binding->codeset != NULL)
|
||||
free (binding->codeset);
|
||||
|
||||
binding->codeset = result;
|
||||
binding->codeset_cntr++;
|
||||
modified = 1;
|
||||
}
|
||||
}
|
||||
*codesetp = result;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((dirnamep == NULL || *dirnamep == NULL)
|
||||
&& (codesetp == NULL || *codesetp == NULL))
|
||||
{
|
||||
/* Simply return the default values. */
|
||||
if (dirnamep)
|
||||
*dirnamep = _nl_default_dirname;
|
||||
if (codesetp)
|
||||
*codesetp = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We have to create a new binding. */
|
||||
size_t len = strlen (domainname) + 1;
|
||||
struct binding *new_binding =
|
||||
(struct binding *) malloc (offsetof (struct binding, domainname) + len);
|
||||
|
||||
if (__builtin_expect (new_binding == NULL, 0))
|
||||
goto failed;
|
||||
|
||||
memcpy (new_binding->domainname, domainname, len);
|
||||
|
||||
if (dirnamep)
|
||||
{
|
||||
const char *dirname = *dirnamep;
|
||||
|
||||
if (dirname == NULL)
|
||||
/* The default value. */
|
||||
dirname = _nl_default_dirname;
|
||||
else
|
||||
{
|
||||
if (strcmp (dirname, _nl_default_dirname) == 0)
|
||||
dirname = _nl_default_dirname;
|
||||
else
|
||||
{
|
||||
char *result;
|
||||
#if defined _LIBC || defined HAVE_STRDUP
|
||||
result = strdup (dirname);
|
||||
if (__builtin_expect (result == NULL, 0))
|
||||
goto failed_dirname;
|
||||
#else
|
||||
size_t len = strlen (dirname) + 1;
|
||||
result = (char *) malloc (len);
|
||||
if (__builtin_expect (result == NULL, 0))
|
||||
goto failed_dirname;
|
||||
memcpy (result, dirname, len);
|
||||
#endif
|
||||
dirname = result;
|
||||
}
|
||||
}
|
||||
*dirnamep = dirname;
|
||||
new_binding->dirname = (char *) dirname;
|
||||
}
|
||||
else
|
||||
/* The default value. */
|
||||
new_binding->dirname = (char *) _nl_default_dirname;
|
||||
|
||||
new_binding->codeset_cntr = 0;
|
||||
|
||||
if (codesetp)
|
||||
{
|
||||
const char *codeset = *codesetp;
|
||||
|
||||
if (codeset != NULL)
|
||||
{
|
||||
char *result;
|
||||
|
||||
#if defined _LIBC || defined HAVE_STRDUP
|
||||
result = strdup (codeset);
|
||||
if (__builtin_expect (result == NULL, 0))
|
||||
goto failed_codeset;
|
||||
#else
|
||||
size_t len = strlen (codeset) + 1;
|
||||
result = (char *) malloc (len);
|
||||
if (__builtin_expect (result == NULL, 0))
|
||||
goto failed_codeset;
|
||||
memcpy (result, codeset, len);
|
||||
#endif
|
||||
codeset = result;
|
||||
new_binding->codeset_cntr++;
|
||||
}
|
||||
*codesetp = codeset;
|
||||
new_binding->codeset = (char *) codeset;
|
||||
}
|
||||
else
|
||||
new_binding->codeset = NULL;
|
||||
|
||||
/* Now enqueue it. */
|
||||
if (_nl_domain_bindings == NULL
|
||||
|| strcmp (domainname, _nl_domain_bindings->domainname) < 0)
|
||||
{
|
||||
new_binding->next = _nl_domain_bindings;
|
||||
_nl_domain_bindings = new_binding;
|
||||
}
|
||||
else
|
||||
{
|
||||
binding = _nl_domain_bindings;
|
||||
while (binding->next != NULL
|
||||
&& strcmp (domainname, binding->next->domainname) > 0)
|
||||
binding = binding->next;
|
||||
|
||||
new_binding->next = binding->next;
|
||||
binding->next = new_binding;
|
||||
}
|
||||
|
||||
modified = 1;
|
||||
|
||||
/* Here we deal with memory allocation failures. */
|
||||
if (0)
|
||||
{
|
||||
failed_codeset:
|
||||
if (new_binding->dirname != _nl_default_dirname)
|
||||
free (new_binding->dirname);
|
||||
failed_dirname:
|
||||
free (new_binding);
|
||||
failed:
|
||||
if (dirnamep)
|
||||
*dirnamep = NULL;
|
||||
if (codesetp)
|
||||
*codesetp = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* If we modified any binding, we flush the caches. */
|
||||
if (modified)
|
||||
++_nl_msg_cat_cntr;
|
||||
|
||||
__libc_rwlock_unlock (_nl_state_lock);
|
||||
}
|
||||
|
||||
/* Specify that the DOMAINNAME message catalog will be found
|
||||
in DIRNAME rather than in the system locale data base. */
|
||||
char *
|
||||
BINDTEXTDOMAIN (domainname, dirname)
|
||||
const char *domainname;
|
||||
const char *dirname;
|
||||
{
|
||||
set_binding_values (domainname, &dirname, NULL);
|
||||
return (char *) dirname;
|
||||
}
|
||||
|
||||
/* Specify the character encoding in which the messages from the
|
||||
DOMAINNAME message catalog will be returned. */
|
||||
char *
|
||||
BIND_TEXTDOMAIN_CODESET (domainname, codeset)
|
||||
const char *domainname;
|
||||
const char *codeset;
|
||||
{
|
||||
set_binding_values (domainname, NULL, &codeset);
|
||||
return (char *) codeset;
|
||||
}
|
||||
|
||||
#ifdef _LIBC
|
||||
/* Aliases for function names in GNU C Library. */
|
||||
weak_alias (__bindtextdomain, bindtextdomain);
|
||||
weak_alias (__bind_textdomain_codeset, bind_textdomain_codeset);
|
||||
#endif
|
||||
@@ -1,438 +0,0 @@
|
||||
#! /bin/sh
|
||||
# Output a system dependent table of character encoding aliases.
|
||||
#
|
||||
# Copyright (C) 2000-2001 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Library 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
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
# USA.
|
||||
#
|
||||
# The table consists of lines of the form
|
||||
# ALIAS CANONICAL
|
||||
#
|
||||
# ALIAS is the (system dependent) result of "nl_langinfo (CODESET)".
|
||||
# ALIAS is compared in a case sensitive way.
|
||||
#
|
||||
# CANONICAL is the GNU canonical name for this character encoding.
|
||||
# It must be an encoding supported by libiconv. Support by GNU libc is
|
||||
# also desirable. CANONICAL is case insensitive. Usually an upper case
|
||||
# MIME charset name is preferred.
|
||||
# The current list of GNU canonical charset names is as follows.
|
||||
#
|
||||
# name used by which systems a MIME name?
|
||||
# ASCII, ANSI_X3.4-1968 glibc solaris freebsd
|
||||
# ISO-8859-1 glibc aix hpux irix osf solaris freebsd yes
|
||||
# ISO-8859-2 glibc aix hpux irix osf solaris freebsd yes
|
||||
# ISO-8859-3 glibc yes
|
||||
# ISO-8859-4 osf solaris freebsd yes
|
||||
# ISO-8859-5 glibc aix hpux irix osf solaris freebsd yes
|
||||
# ISO-8859-6 glibc aix hpux solaris yes
|
||||
# ISO-8859-7 glibc aix hpux irix osf solaris yes
|
||||
# ISO-8859-8 glibc aix hpux osf solaris yes
|
||||
# ISO-8859-9 glibc aix hpux irix osf solaris yes
|
||||
# ISO-8859-13 glibc
|
||||
# ISO-8859-15 glibc aix osf solaris freebsd
|
||||
# KOI8-R glibc solaris freebsd yes
|
||||
# KOI8-U glibc freebsd yes
|
||||
# CP437 dos
|
||||
# CP775 dos
|
||||
# CP850 aix osf dos
|
||||
# CP852 dos
|
||||
# CP855 dos
|
||||
# CP856 aix
|
||||
# CP857 dos
|
||||
# CP861 dos
|
||||
# CP862 dos
|
||||
# CP864 dos
|
||||
# CP865 dos
|
||||
# CP866 freebsd dos
|
||||
# CP869 dos
|
||||
# CP874 win32 dos
|
||||
# CP922 aix
|
||||
# CP932 aix win32 dos
|
||||
# CP943 aix
|
||||
# CP949 osf win32 dos
|
||||
# CP950 win32 dos
|
||||
# CP1046 aix
|
||||
# CP1124 aix
|
||||
# CP1129 aix
|
||||
# CP1250 win32
|
||||
# CP1251 glibc win32
|
||||
# CP1252 aix win32
|
||||
# CP1253 win32
|
||||
# CP1254 win32
|
||||
# CP1255 win32
|
||||
# CP1256 win32
|
||||
# CP1257 win32
|
||||
# GB2312 glibc aix hpux irix solaris freebsd yes
|
||||
# EUC-JP glibc aix hpux irix osf solaris freebsd yes
|
||||
# EUC-KR glibc aix hpux irix osf solaris freebsd yes
|
||||
# EUC-TW glibc aix hpux irix osf solaris
|
||||
# BIG5 glibc aix hpux osf solaris freebsd yes
|
||||
# BIG5-HKSCS glibc
|
||||
# GBK aix osf win32 dos
|
||||
# GB18030 glibc
|
||||
# SHIFT_JIS hpux osf solaris freebsd yes
|
||||
# JOHAB glibc win32
|
||||
# TIS-620 glibc aix hpux osf solaris
|
||||
# VISCII glibc yes
|
||||
# HP-ROMAN8 hpux
|
||||
# HP-ARABIC8 hpux
|
||||
# HP-GREEK8 hpux
|
||||
# HP-HEBREW8 hpux
|
||||
# HP-TURKISH8 hpux
|
||||
# HP-KANA8 hpux
|
||||
# DEC-KANJI osf
|
||||
# DEC-HANYU osf
|
||||
# UTF-8 glibc aix hpux osf solaris yes
|
||||
#
|
||||
# Note: Names which are not marked as being a MIME name should not be used in
|
||||
# Internet protocols for information interchange (mail, news, etc.).
|
||||
#
|
||||
# Note: ASCII and ANSI_X3.4-1968 are synonymous canonical names. Applications
|
||||
# must understand both names and treat them as equivalent.
|
||||
#
|
||||
# The first argument passed to this file is the canonical host specification,
|
||||
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
|
||||
# or
|
||||
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
|
||||
|
||||
host="$1"
|
||||
os=`echo "$host" | sed -e 's/^[^-]*-[^-]*-\(.*\)$/\1/'`
|
||||
echo "# This file contains a table of character encoding aliases,"
|
||||
echo "# suitable for operating system '${os}'."
|
||||
echo "# It was automatically generated from config.charset."
|
||||
# List of references, updated during installation:
|
||||
echo "# Packages using this file: "
|
||||
case "$os" in
|
||||
linux* | *-gnu*)
|
||||
# With glibc-2.1 or newer, we don't need any canonicalization,
|
||||
# because glibc has iconv and both glibc and libiconv support all
|
||||
# GNU canonical names directly. Therefore, the Makefile does not
|
||||
# need to install the alias file at all.
|
||||
# The following applies only to glibc-2.0.x and older libcs.
|
||||
echo "ISO_646.IRV:1983 ASCII"
|
||||
;;
|
||||
aix*)
|
||||
echo "ISO8859-1 ISO-8859-1"
|
||||
echo "ISO8859-2 ISO-8859-2"
|
||||
echo "ISO8859-5 ISO-8859-5"
|
||||
echo "ISO8859-6 ISO-8859-6"
|
||||
echo "ISO8859-7 ISO-8859-7"
|
||||
echo "ISO8859-8 ISO-8859-8"
|
||||
echo "ISO8859-9 ISO-8859-9"
|
||||
echo "ISO8859-15 ISO-8859-15"
|
||||
echo "IBM-850 CP850"
|
||||
echo "IBM-856 CP856"
|
||||
echo "IBM-921 ISO-8859-13"
|
||||
echo "IBM-922 CP922"
|
||||
echo "IBM-932 CP932"
|
||||
echo "IBM-943 CP943"
|
||||
echo "IBM-1046 CP1046"
|
||||
echo "IBM-1124 CP1124"
|
||||
echo "IBM-1129 CP1129"
|
||||
echo "IBM-1252 CP1252"
|
||||
echo "IBM-eucCN GB2312"
|
||||
echo "IBM-eucJP EUC-JP"
|
||||
echo "IBM-eucKR EUC-KR"
|
||||
echo "IBM-eucTW EUC-TW"
|
||||
echo "big5 BIG5"
|
||||
echo "GBK GBK"
|
||||
echo "TIS-620 TIS-620"
|
||||
echo "UTF-8 UTF-8"
|
||||
;;
|
||||
hpux*)
|
||||
echo "iso88591 ISO-8859-1"
|
||||
echo "iso88592 ISO-8859-2"
|
||||
echo "iso88595 ISO-8859-5"
|
||||
echo "iso88596 ISO-8859-6"
|
||||
echo "iso88597 ISO-8859-7"
|
||||
echo "iso88598 ISO-8859-8"
|
||||
echo "iso88599 ISO-8859-9"
|
||||
echo "iso885915 ISO-8859-15"
|
||||
echo "roman8 HP-ROMAN8"
|
||||
echo "arabic8 HP-ARABIC8"
|
||||
echo "greek8 HP-GREEK8"
|
||||
echo "hebrew8 HP-HEBREW8"
|
||||
echo "turkish8 HP-TURKISH8"
|
||||
echo "kana8 HP-KANA8"
|
||||
echo "tis620 TIS-620"
|
||||
echo "big5 BIG5"
|
||||
echo "eucJP EUC-JP"
|
||||
echo "eucKR EUC-KR"
|
||||
echo "eucTW EUC-TW"
|
||||
echo "hp15CN GB2312"
|
||||
#echo "ccdc ?" # what is this?
|
||||
echo "SJIS SHIFT_JIS"
|
||||
echo "utf8 UTF-8"
|
||||
;;
|
||||
irix*)
|
||||
echo "ISO8859-1 ISO-8859-1"
|
||||
echo "ISO8859-2 ISO-8859-2"
|
||||
echo "ISO8859-5 ISO-8859-5"
|
||||
echo "ISO8859-7 ISO-8859-7"
|
||||
echo "ISO8859-9 ISO-8859-9"
|
||||
echo "eucCN GB2312"
|
||||
echo "eucJP EUC-JP"
|
||||
echo "eucKR EUC-KR"
|
||||
echo "eucTW EUC-TW"
|
||||
;;
|
||||
osf*)
|
||||
echo "ISO8859-1 ISO-8859-1"
|
||||
echo "ISO8859-2 ISO-8859-2"
|
||||
echo "ISO8859-4 ISO-8859-4"
|
||||
echo "ISO8859-5 ISO-8859-5"
|
||||
echo "ISO8859-7 ISO-8859-7"
|
||||
echo "ISO8859-8 ISO-8859-8"
|
||||
echo "ISO8859-9 ISO-8859-9"
|
||||
echo "ISO8859-15 ISO-8859-15"
|
||||
echo "cp850 CP850"
|
||||
echo "big5 BIG5"
|
||||
echo "dechanyu DEC-HANYU"
|
||||
echo "dechanzi GB2312"
|
||||
echo "deckanji DEC-KANJI"
|
||||
echo "deckorean EUC-KR"
|
||||
echo "eucJP EUC-JP"
|
||||
echo "eucKR EUC-KR"
|
||||
echo "eucTW EUC-TW"
|
||||
echo "GBK GBK"
|
||||
echo "KSC5601 CP949"
|
||||
echo "sdeckanji EUC-JP"
|
||||
echo "SJIS SHIFT_JIS"
|
||||
echo "TACTIS TIS-620"
|
||||
echo "UTF-8 UTF-8"
|
||||
;;
|
||||
solaris*)
|
||||
echo "646 ASCII"
|
||||
echo "ISO8859-1 ISO-8859-1"
|
||||
echo "ISO8859-2 ISO-8859-2"
|
||||
echo "ISO8859-4 ISO-8859-4"
|
||||
echo "ISO8859-5 ISO-8859-5"
|
||||
echo "ISO8859-6 ISO-8859-6"
|
||||
echo "ISO8859-7 ISO-8859-7"
|
||||
echo "ISO8859-8 ISO-8859-8"
|
||||
echo "ISO8859-9 ISO-8859-9"
|
||||
echo "ISO8859-15 ISO-8859-15"
|
||||
echo "koi8-r KOI8-R"
|
||||
echo "BIG5 BIG5"
|
||||
echo "gb2312 GB2312"
|
||||
echo "cns11643 EUC-TW"
|
||||
echo "5601 EUC-KR"
|
||||
echo "eucJP EUC-JP"
|
||||
echo "PCK SHIFT_JIS"
|
||||
echo "TIS620.2533 TIS-620"
|
||||
#echo "sun_eu_greek ?" # what is this?
|
||||
echo "UTF-8 UTF-8"
|
||||
;;
|
||||
freebsd*)
|
||||
# FreeBSD 4.2 doesn't have nl_langinfo(CODESET); therefore
|
||||
# localcharset.c falls back to using the full locale name
|
||||
# from the environment variables.
|
||||
echo "C ASCII"
|
||||
echo "US-ASCII ASCII"
|
||||
for l in la_LN lt_LN; do
|
||||
echo "$l.ASCII ASCII"
|
||||
done
|
||||
for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \
|
||||
fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT la_LN \
|
||||
lt_LN nl_BE nl_NL no_NO pt_PT sv_SE; do
|
||||
echo "$l.ISO_8859-1 ISO-8859-1"
|
||||
echo "$l.DIS_8859-15 ISO-8859-15"
|
||||
done
|
||||
for l in cs_CZ hr_HR hu_HU la_LN lt_LN pl_PL sl_SI; do
|
||||
echo "$l.ISO_8859-2 ISO-8859-2"
|
||||
done
|
||||
for l in la_LN lt_LT; do
|
||||
echo "$l.ISO_8859-4 ISO-8859-4"
|
||||
done
|
||||
for l in ru_RU ru_SU; do
|
||||
echo "$l.KOI8-R KOI8-R"
|
||||
echo "$l.ISO_8859-5 ISO-8859-5"
|
||||
echo "$l.CP866 CP866"
|
||||
done
|
||||
echo "uk_UA.KOI8-U KOI8-U"
|
||||
echo "zh_TW.BIG5 BIG5"
|
||||
echo "zh_TW.Big5 BIG5"
|
||||
echo "zh_CN.EUC GB2312"
|
||||
echo "ja_JP.EUC EUC-JP"
|
||||
echo "ja_JP.SJIS SHIFT_JIS"
|
||||
echo "ja_JP.Shift_JIS SHIFT_JIS"
|
||||
echo "ko_KR.EUC EUC-KR"
|
||||
;;
|
||||
beos*)
|
||||
# BeOS has a single locale, and it has UTF-8 encoding.
|
||||
echo "* UTF-8"
|
||||
;;
|
||||
msdosdjgpp*)
|
||||
# DJGPP 2.03 doesn't have nl_langinfo(CODESET); therefore
|
||||
# localcharset.c falls back to using the full locale name
|
||||
# from the environment variables.
|
||||
echo "#"
|
||||
echo "# The encodings given here may not all be correct."
|
||||
echo "# If you find that the encoding given for your language and"
|
||||
echo "# country is not the one your DOS machine actually uses, just"
|
||||
echo "# correct it in this file, and send a mail to"
|
||||
echo "# Juan Manuel Guerrero <[email protected]>"
|
||||
echo "# and Bruno Haible <[email protected]>."
|
||||
echo "#"
|
||||
echo "C ASCII"
|
||||
# ISO-8859-1 languages
|
||||
echo "ca CP850"
|
||||
echo "ca_ES CP850"
|
||||
echo "da CP865" # not CP850 ??
|
||||
echo "da_DK CP865" # not CP850 ??
|
||||
echo "de CP850"
|
||||
echo "de_AT CP850"
|
||||
echo "de_CH CP850"
|
||||
echo "de_DE CP850"
|
||||
echo "en CP850"
|
||||
echo "en_AU CP850" # not CP437 ??
|
||||
echo "en_CA CP850"
|
||||
echo "en_GB CP850"
|
||||
echo "en_NZ CP437"
|
||||
echo "en_US CP437"
|
||||
echo "en_ZA CP850" # not CP437 ??
|
||||
echo "es CP850"
|
||||
echo "es_AR CP850"
|
||||
echo "es_BO CP850"
|
||||
echo "es_CL CP850"
|
||||
echo "es_CO CP850"
|
||||
echo "es_CR CP850"
|
||||
echo "es_CU CP850"
|
||||
echo "es_DO CP850"
|
||||
echo "es_EC CP850"
|
||||
echo "es_ES CP850"
|
||||
echo "es_GT CP850"
|
||||
echo "es_HN CP850"
|
||||
echo "es_MX CP850"
|
||||
echo "es_NI CP850"
|
||||
echo "es_PA CP850"
|
||||
echo "es_PY CP850"
|
||||
echo "es_PE CP850"
|
||||
echo "es_SV CP850"
|
||||
echo "es_UY CP850"
|
||||
echo "es_VE CP850"
|
||||
echo "et CP850"
|
||||
echo "et_EE CP850"
|
||||
echo "eu CP850"
|
||||
echo "eu_ES CP850"
|
||||
echo "fi CP850"
|
||||
echo "fi_FI CP850"
|
||||
echo "fr CP850"
|
||||
echo "fr_BE CP850"
|
||||
echo "fr_CA CP850"
|
||||
echo "fr_CH CP850"
|
||||
echo "fr_FR CP850"
|
||||
echo "ga CP850"
|
||||
echo "ga_IE CP850"
|
||||
echo "gd CP850"
|
||||
echo "gd_GB CP850"
|
||||
echo "gl CP850"
|
||||
echo "gl_ES CP850"
|
||||
echo "id CP850" # not CP437 ??
|
||||
echo "id_ID CP850" # not CP437 ??
|
||||
echo "is CP861" # not CP850 ??
|
||||
echo "is_IS CP861" # not CP850 ??
|
||||
echo "it CP850"
|
||||
echo "it_CH CP850"
|
||||
echo "it_IT CP850"
|
||||
echo "lt CP775"
|
||||
echo "lt_LT CP775"
|
||||
echo "lv CP775"
|
||||
echo "lv_LV CP775"
|
||||
echo "nb CP865" # not CP850 ??
|
||||
echo "nb_NO CP865" # not CP850 ??
|
||||
echo "nl CP850"
|
||||
echo "nl_BE CP850"
|
||||
echo "nl_NL CP850"
|
||||
echo "nn CP865" # not CP850 ??
|
||||
echo "nn_NO CP865" # not CP850 ??
|
||||
echo "no CP865" # not CP850 ??
|
||||
echo "no_NO CP865" # not CP850 ??
|
||||
echo "pt CP850"
|
||||
echo "pt_BR CP850"
|
||||
echo "pt_PT CP850"
|
||||
echo "sv CP850"
|
||||
echo "sv_SE CP850"
|
||||
# ISO-8859-2 languages
|
||||
echo "cs CP852"
|
||||
echo "cs_CZ CP852"
|
||||
echo "hr CP852"
|
||||
echo "hr_HR CP852"
|
||||
echo "hu CP852"
|
||||
echo "hu_HU CP852"
|
||||
echo "pl CP852"
|
||||
echo "pl_PL CP852"
|
||||
echo "ro CP852"
|
||||
echo "ro_RO CP852"
|
||||
echo "sk CP852"
|
||||
echo "sk_SK CP852"
|
||||
echo "sl CP852"
|
||||
echo "sl_SI CP852"
|
||||
echo "sq CP852"
|
||||
echo "sq_AL CP852"
|
||||
echo "sr CP852" # CP852 or CP866 or CP855 ??
|
||||
echo "sr_YU CP852" # CP852 or CP866 or CP855 ??
|
||||
# ISO-8859-3 languages
|
||||
echo "mt CP850"
|
||||
echo "mt_MT CP850"
|
||||
# ISO-8859-5 languages
|
||||
echo "be CP866"
|
||||
echo "be_BE CP866"
|
||||
echo "bg CP866" # not CP855 ??
|
||||
echo "bg_BG CP866" # not CP855 ??
|
||||
echo "mk CP866" # not CP855 ??
|
||||
echo "mk_MK CP866" # not CP855 ??
|
||||
echo "ru KOI8-R" # not CP866 ??
|
||||
echo "ru_RU KOI8-R" # not CP866 ??
|
||||
# ISO-8859-6 languages
|
||||
echo "ar CP864"
|
||||
echo "ar_AE CP864"
|
||||
echo "ar_DZ CP864"
|
||||
echo "ar_EG CP864"
|
||||
echo "ar_IQ CP864"
|
||||
echo "ar_IR CP864"
|
||||
echo "ar_JO CP864"
|
||||
echo "ar_KW CP864"
|
||||
echo "ar_MA CP864"
|
||||
echo "ar_OM CP864"
|
||||
echo "ar_QA CP864"
|
||||
echo "ar_SA CP864"
|
||||
echo "ar_SY CP864"
|
||||
# ISO-8859-7 languages
|
||||
echo "el CP869"
|
||||
echo "el_GR CP869"
|
||||
# ISO-8859-8 languages
|
||||
echo "he CP862"
|
||||
echo "he_IL CP862"
|
||||
# ISO-8859-9 languages
|
||||
echo "tr CP857"
|
||||
echo "tr_TR CP857"
|
||||
# Japanese
|
||||
echo "ja CP932"
|
||||
echo "ja_JP CP932"
|
||||
# Chinese
|
||||
echo "zh_CN GBK"
|
||||
echo "zh_TW CP950" # not CP938 ??
|
||||
# Korean
|
||||
echo "kr CP949" # not CP934 ??
|
||||
echo "kr_KR CP949" # not CP934 ??
|
||||
# Thai
|
||||
echo "th CP874"
|
||||
echo "th_TH CP874"
|
||||
# Other
|
||||
echo "eo CP850"
|
||||
echo "eo_EO CP850"
|
||||
;;
|
||||
esac
|
||||
@@ -1,58 +0,0 @@
|
||||
/* Implementation of the dcgettext(3) function.
|
||||
Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "gettextP.h"
|
||||
#ifdef _LIBC
|
||||
# include <libintl.h>
|
||||
#else
|
||||
# include "libgnuintl.h"
|
||||
#endif
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
/* Names for the libintl functions are a problem. They must not clash
|
||||
with existing names and they should follow ANSI C. But this source
|
||||
code is also used in GNU C Library where the names have a __
|
||||
prefix. So we have to make a difference here. */
|
||||
#ifdef _LIBC
|
||||
# define DCGETTEXT __dcgettext
|
||||
# define DCIGETTEXT __dcigettext
|
||||
#else
|
||||
# define DCGETTEXT dcgettext__
|
||||
# define DCIGETTEXT dcigettext__
|
||||
#endif
|
||||
|
||||
/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
|
||||
locale. */
|
||||
char *
|
||||
DCGETTEXT (domainname, msgid, category)
|
||||
const char *domainname;
|
||||
const char *msgid;
|
||||
int category;
|
||||
{
|
||||
return DCIGETTEXT (domainname, msgid, NULL, 0, 0, category);
|
||||
}
|
||||
|
||||
#ifdef _LIBC
|
||||
/* Alias for function name in GNU C Library. */
|
||||
weak_alias (__dcgettext, dcgettext);
|
||||
#endif
|
||||
-1259
File diff suppressed because it is too large
Load Diff
@@ -1,60 +0,0 @@
|
||||
/* Implementation of the dcngettext(3) function.
|
||||
Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "gettextP.h"
|
||||
#ifdef _LIBC
|
||||
# include <libintl.h>
|
||||
#else
|
||||
# include "libgnuintl.h"
|
||||
#endif
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
/* Names for the libintl functions are a problem. They must not clash
|
||||
with existing names and they should follow ANSI C. But this source
|
||||
code is also used in GNU C Library where the names have a __
|
||||
prefix. So we have to make a difference here. */
|
||||
#ifdef _LIBC
|
||||
# define DCNGETTEXT __dcngettext
|
||||
# define DCIGETTEXT __dcigettext
|
||||
#else
|
||||
# define DCNGETTEXT dcngettext__
|
||||
# define DCIGETTEXT dcigettext__
|
||||
#endif
|
||||
|
||||
/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
|
||||
locale. */
|
||||
char *
|
||||
DCNGETTEXT (domainname, msgid1, msgid2, n, category)
|
||||
const char *domainname;
|
||||
const char *msgid1;
|
||||
const char *msgid2;
|
||||
unsigned long int n;
|
||||
int category;
|
||||
{
|
||||
return DCIGETTEXT (domainname, msgid1, msgid2, 1, n, category);
|
||||
}
|
||||
|
||||
#ifdef _LIBC
|
||||
/* Alias for function name in GNU C Library. */
|
||||
weak_alias (__dcngettext, dcngettext);
|
||||
#endif
|
||||
@@ -1,59 +0,0 @@
|
||||
/* Implementation of the dgettext(3) function.
|
||||
Copyright (C) 1995-1997, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <locale.h>
|
||||
|
||||
#include "gettextP.h"
|
||||
#ifdef _LIBC
|
||||
# include <libintl.h>
|
||||
#else
|
||||
# include "libgnuintl.h"
|
||||
#endif
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
/* Names for the libintl functions are a problem. They must not clash
|
||||
with existing names and they should follow ANSI C. But this source
|
||||
code is also used in GNU C Library where the names have a __
|
||||
prefix. So we have to make a difference here. */
|
||||
#ifdef _LIBC
|
||||
# define DGETTEXT __dgettext
|
||||
# define DCGETTEXT __dcgettext
|
||||
#else
|
||||
# define DGETTEXT dgettext__
|
||||
# define DCGETTEXT dcgettext__
|
||||
#endif
|
||||
|
||||
/* Look up MSGID in the DOMAINNAME message catalog of the current
|
||||
LC_MESSAGES locale. */
|
||||
char *
|
||||
DGETTEXT (domainname, msgid)
|
||||
const char *domainname;
|
||||
const char *msgid;
|
||||
{
|
||||
return DCGETTEXT (domainname, msgid, LC_MESSAGES);
|
||||
}
|
||||
|
||||
#ifdef _LIBC
|
||||
/* Alias for function name in GNU C Library. */
|
||||
weak_alias (__dgettext, dgettext);
|
||||
#endif
|
||||
@@ -1,61 +0,0 @@
|
||||
/* Implementation of the dngettext(3) function.
|
||||
Copyright (C) 1995-1997, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <locale.h>
|
||||
|
||||
#include "gettextP.h"
|
||||
#ifdef _LIBC
|
||||
# include <libintl.h>
|
||||
#else
|
||||
# include "libgnuintl.h"
|
||||
#endif
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
/* Names for the libintl functions are a problem. They must not clash
|
||||
with existing names and they should follow ANSI C. But this source
|
||||
code is also used in GNU C Library where the names have a __
|
||||
prefix. So we have to make a difference here. */
|
||||
#ifdef _LIBC
|
||||
# define DNGETTEXT __dngettext
|
||||
# define DCNGETTEXT __dcngettext
|
||||
#else
|
||||
# define DNGETTEXT dngettext__
|
||||
# define DCNGETTEXT dcngettext__
|
||||
#endif
|
||||
|
||||
/* Look up MSGID in the DOMAINNAME message catalog of the current
|
||||
LC_MESSAGES locale and skip message according to the plural form. */
|
||||
char *
|
||||
DNGETTEXT (domainname, msgid1, msgid2, n)
|
||||
const char *domainname;
|
||||
const char *msgid1;
|
||||
const char *msgid2;
|
||||
unsigned long int n;
|
||||
{
|
||||
return DCNGETTEXT (domainname, msgid1, msgid2, n, LC_MESSAGES);
|
||||
}
|
||||
|
||||
#ifdef _LIBC
|
||||
/* Alias for function name in GNU C Library. */
|
||||
weak_alias (__dngettext, dngettext);
|
||||
#endif
|
||||
@@ -1,192 +0,0 @@
|
||||
/* Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc.
|
||||
Contributed by Ulrich Drepper <[email protected]>, 1995.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "loadinfo.h"
|
||||
|
||||
/* On some strange systems still no definition of NULL is found. Sigh! */
|
||||
#ifndef NULL
|
||||
# if defined __STDC__ && __STDC__
|
||||
# define NULL ((void *) 0)
|
||||
# else
|
||||
# define NULL 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
char *
|
||||
_nl_find_language (name)
|
||||
const char *name;
|
||||
{
|
||||
while (name[0] != '\0' && name[0] != '_' && name[0] != '@'
|
||||
&& name[0] != '+' && name[0] != ',')
|
||||
++name;
|
||||
|
||||
return (char *) name;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
_nl_explode_name (name, language, modifier, territory, codeset,
|
||||
normalized_codeset, special, sponsor, revision)
|
||||
char *name;
|
||||
const char **language;
|
||||
const char **modifier;
|
||||
const char **territory;
|
||||
const char **codeset;
|
||||
const char **normalized_codeset;
|
||||
const char **special;
|
||||
const char **sponsor;
|
||||
const char **revision;
|
||||
{
|
||||
enum { undecided, xpg, cen } syntax;
|
||||
char *cp;
|
||||
int mask;
|
||||
|
||||
*modifier = NULL;
|
||||
*territory = NULL;
|
||||
*codeset = NULL;
|
||||
*normalized_codeset = NULL;
|
||||
*special = NULL;
|
||||
*sponsor = NULL;
|
||||
*revision = NULL;
|
||||
|
||||
/* Now we determine the single parts of the locale name. First
|
||||
look for the language. Termination symbols are `_' and `@' if
|
||||
we use XPG4 style, and `_', `+', and `,' if we use CEN syntax. */
|
||||
mask = 0;
|
||||
syntax = undecided;
|
||||
*language = cp = name;
|
||||
cp = _nl_find_language (*language);
|
||||
|
||||
if (*language == cp)
|
||||
/* This does not make sense: language has to be specified. Use
|
||||
this entry as it is without exploding. Perhaps it is an alias. */
|
||||
cp = strchr (*language, '\0');
|
||||
else if (cp[0] == '_')
|
||||
{
|
||||
/* Next is the territory. */
|
||||
cp[0] = '\0';
|
||||
*territory = ++cp;
|
||||
|
||||
while (cp[0] != '\0' && cp[0] != '.' && cp[0] != '@'
|
||||
&& cp[0] != '+' && cp[0] != ',' && cp[0] != '_')
|
||||
++cp;
|
||||
|
||||
mask |= TERRITORY;
|
||||
|
||||
if (cp[0] == '.')
|
||||
{
|
||||
/* Next is the codeset. */
|
||||
syntax = xpg;
|
||||
cp[0] = '\0';
|
||||
*codeset = ++cp;
|
||||
|
||||
while (cp[0] != '\0' && cp[0] != '@')
|
||||
++cp;
|
||||
|
||||
mask |= XPG_CODESET;
|
||||
|
||||
if (*codeset != cp && (*codeset)[0] != '\0')
|
||||
{
|
||||
*normalized_codeset = _nl_normalize_codeset (*codeset,
|
||||
cp - *codeset);
|
||||
if (strcmp (*codeset, *normalized_codeset) == 0)
|
||||
free ((char *) *normalized_codeset);
|
||||
else
|
||||
mask |= XPG_NORM_CODESET;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cp[0] == '@' || (syntax != xpg && cp[0] == '+'))
|
||||
{
|
||||
/* Next is the modifier. */
|
||||
syntax = cp[0] == '@' ? xpg : cen;
|
||||
cp[0] = '\0';
|
||||
*modifier = ++cp;
|
||||
|
||||
while (syntax == cen && cp[0] != '\0' && cp[0] != '+'
|
||||
&& cp[0] != ',' && cp[0] != '_')
|
||||
++cp;
|
||||
|
||||
mask |= XPG_MODIFIER | CEN_AUDIENCE;
|
||||
}
|
||||
|
||||
if (syntax != xpg && (cp[0] == '+' || cp[0] == ',' || cp[0] == '_'))
|
||||
{
|
||||
syntax = cen;
|
||||
|
||||
if (cp[0] == '+')
|
||||
{
|
||||
/* Next is special application (CEN syntax). */
|
||||
cp[0] = '\0';
|
||||
*special = ++cp;
|
||||
|
||||
while (cp[0] != '\0' && cp[0] != ',' && cp[0] != '_')
|
||||
++cp;
|
||||
|
||||
mask |= CEN_SPECIAL;
|
||||
}
|
||||
|
||||
if (cp[0] == ',')
|
||||
{
|
||||
/* Next is sponsor (CEN syntax). */
|
||||
cp[0] = '\0';
|
||||
*sponsor = ++cp;
|
||||
|
||||
while (cp[0] != '\0' && cp[0] != '_')
|
||||
++cp;
|
||||
|
||||
mask |= CEN_SPONSOR;
|
||||
}
|
||||
|
||||
if (cp[0] == '_')
|
||||
{
|
||||
/* Next is revision (CEN syntax). */
|
||||
cp[0] = '\0';
|
||||
*revision = ++cp;
|
||||
|
||||
mask |= CEN_REVISION;
|
||||
}
|
||||
}
|
||||
|
||||
/* For CEN syntax values it might be important to have the
|
||||
separator character in the file name, not for XPG syntax. */
|
||||
if (syntax == xpg)
|
||||
{
|
||||
if (*territory != NULL && (*territory)[0] == '\0')
|
||||
mask &= ~TERRITORY;
|
||||
|
||||
if (*codeset != NULL && (*codeset)[0] == '\0')
|
||||
mask &= ~XPG_CODESET;
|
||||
|
||||
if (*modifier != NULL && (*modifier)[0] == '\0')
|
||||
mask &= ~XPG_MODIFIER;
|
||||
}
|
||||
|
||||
return mask;
|
||||
}
|
||||
@@ -1,198 +0,0 @@
|
||||
/* Handle list of needed message catalogs
|
||||
Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
Written by Ulrich Drepper <[email protected]>, 1995.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined HAVE_UNISTD_H || defined _LIBC
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "gettextP.h"
|
||||
#ifdef _LIBC
|
||||
# include <libintl.h>
|
||||
#else
|
||||
# include "libgnuintl.h"
|
||||
#endif
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
/* List of already loaded domains. */
|
||||
static struct loaded_l10nfile *_nl_loaded_domains;
|
||||
|
||||
|
||||
/* Return a data structure describing the message catalog described by
|
||||
the DOMAINNAME and CATEGORY parameters with respect to the currently
|
||||
established bindings. */
|
||||
struct loaded_l10nfile *
|
||||
internal_function
|
||||
_nl_find_domain (dirname, locale, domainname, domainbinding)
|
||||
const char *dirname;
|
||||
char *locale;
|
||||
const char *domainname;
|
||||
struct binding *domainbinding;
|
||||
{
|
||||
struct loaded_l10nfile *retval;
|
||||
const char *language;
|
||||
const char *modifier;
|
||||
const char *territory;
|
||||
const char *codeset;
|
||||
const char *normalized_codeset;
|
||||
const char *special;
|
||||
const char *sponsor;
|
||||
const char *revision;
|
||||
const char *alias_value;
|
||||
int mask;
|
||||
|
||||
/* LOCALE can consist of up to four recognized parts for the XPG syntax:
|
||||
|
||||
language[_territory[.codeset]][@modifier]
|
||||
|
||||
and six parts for the CEN syntax:
|
||||
|
||||
language[_territory][+audience][+special][,[sponsor][_revision]]
|
||||
|
||||
Beside the first part all of them are allowed to be missing. If
|
||||
the full specified locale is not found, the less specific one are
|
||||
looked for. The various parts will be stripped off according to
|
||||
the following order:
|
||||
(1) revision
|
||||
(2) sponsor
|
||||
(3) special
|
||||
(4) codeset
|
||||
(5) normalized codeset
|
||||
(6) territory
|
||||
(7) audience/modifier
|
||||
*/
|
||||
|
||||
/* If we have already tested for this locale entry there has to
|
||||
be one data set in the list of loaded domains. */
|
||||
retval = _nl_make_l10nflist (&_nl_loaded_domains, dirname,
|
||||
strlen (dirname) + 1, 0, locale, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL, NULL, domainname, 0);
|
||||
if (retval != NULL)
|
||||
{
|
||||
/* We know something about this locale. */
|
||||
int cnt;
|
||||
|
||||
if (retval->decided == 0)
|
||||
_nl_load_domain (retval, domainbinding);
|
||||
|
||||
if (retval->data != NULL)
|
||||
return retval;
|
||||
|
||||
for (cnt = 0; retval->successor[cnt] != NULL; ++cnt)
|
||||
{
|
||||
if (retval->successor[cnt]->decided == 0)
|
||||
_nl_load_domain (retval->successor[cnt], domainbinding);
|
||||
|
||||
if (retval->successor[cnt]->data != NULL)
|
||||
break;
|
||||
}
|
||||
return cnt >= 0 ? retval : NULL;
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
/* See whether the locale value is an alias. If yes its value
|
||||
*overwrites* the alias name. No test for the original value is
|
||||
done. */
|
||||
alias_value = _nl_expand_alias (locale);
|
||||
if (alias_value != NULL)
|
||||
{
|
||||
#if defined _LIBC || defined HAVE_STRDUP
|
||||
locale = strdup (alias_value);
|
||||
if (locale == NULL)
|
||||
return NULL;
|
||||
#else
|
||||
size_t len = strlen (alias_value) + 1;
|
||||
locale = (char *) malloc (len);
|
||||
if (locale == NULL)
|
||||
return NULL;
|
||||
|
||||
memcpy (locale, alias_value, len);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Now we determine the single parts of the locale name. First
|
||||
look for the language. Termination symbols are `_' and `@' if
|
||||
we use XPG4 style, and `_', `+', and `,' if we use CEN syntax. */
|
||||
mask = _nl_explode_name (locale, &language, &modifier, &territory,
|
||||
&codeset, &normalized_codeset, &special,
|
||||
&sponsor, &revision);
|
||||
|
||||
/* Create all possible locale entries which might be interested in
|
||||
generalization. */
|
||||
retval = _nl_make_l10nflist (&_nl_loaded_domains, dirname,
|
||||
strlen (dirname) + 1, mask, language, territory,
|
||||
codeset, normalized_codeset, modifier, special,
|
||||
sponsor, revision, domainname, 1);
|
||||
if (retval == NULL)
|
||||
/* This means we are out of core. */
|
||||
return NULL;
|
||||
|
||||
if (retval->decided == 0)
|
||||
_nl_load_domain (retval, domainbinding);
|
||||
if (retval->data == NULL)
|
||||
{
|
||||
int cnt;
|
||||
for (cnt = 0; retval->successor[cnt] != NULL; ++cnt)
|
||||
{
|
||||
if (retval->successor[cnt]->decided == 0)
|
||||
_nl_load_domain (retval->successor[cnt], domainbinding);
|
||||
if (retval->successor[cnt]->data != NULL)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* The room for an alias was dynamically allocated. Free it now. */
|
||||
if (alias_value != NULL)
|
||||
free (locale);
|
||||
|
||||
/* The space for normalized_codeset is dynamically allocated. Free it. */
|
||||
if (mask & XPG_NORM_CODESET)
|
||||
free ((void *) normalized_codeset);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
#ifdef _LIBC
|
||||
static void __attribute__ ((unused))
|
||||
free_mem (void)
|
||||
{
|
||||
struct loaded_l10nfile *runp = _nl_loaded_domains;
|
||||
|
||||
while (runp != NULL)
|
||||
{
|
||||
struct loaded_l10nfile *here = runp;
|
||||
if (runp->data != NULL)
|
||||
_nl_unload_domain ((struct loaded_domain *) runp->data);
|
||||
runp = runp->next;
|
||||
free ((char *) here->filename);
|
||||
free (here);
|
||||
}
|
||||
}
|
||||
|
||||
text_set_element (__libc_subfreeres, free_mem);
|
||||
#endif
|
||||
@@ -1,64 +0,0 @@
|
||||
/* Implementation of gettext(3) function.
|
||||
Copyright (C) 1995, 1997, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef _LIBC
|
||||
# define __need_NULL
|
||||
# include <stddef.h>
|
||||
#else
|
||||
# include <stdlib.h> /* Just for NULL. */
|
||||
#endif
|
||||
|
||||
#include "gettextP.h"
|
||||
#ifdef _LIBC
|
||||
# include <libintl.h>
|
||||
#else
|
||||
# include "libgnuintl.h"
|
||||
#endif
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
/* Names for the libintl functions are a problem. They must not clash
|
||||
with existing names and they should follow ANSI C. But this source
|
||||
code is also used in GNU C Library where the names have a __
|
||||
prefix. So we have to make a difference here. */
|
||||
#ifdef _LIBC
|
||||
# define GETTEXT __gettext
|
||||
# define DCGETTEXT __dcgettext
|
||||
#else
|
||||
# define GETTEXT gettext__
|
||||
# define DCGETTEXT dcgettext__
|
||||
#endif
|
||||
|
||||
/* Look up MSGID in the current default message catalog for the current
|
||||
LC_MESSAGES locale. If not found, returns MSGID itself (the default
|
||||
text). */
|
||||
char *
|
||||
GETTEXT (msgid)
|
||||
const char *msgid;
|
||||
{
|
||||
return DCGETTEXT (NULL, msgid, LC_MESSAGES);
|
||||
}
|
||||
|
||||
#ifdef _LIBC
|
||||
/* Alias for function name in GNU C Library. */
|
||||
weak_alias (__gettext, gettext);
|
||||
#endif
|
||||
-102
@@ -1,102 +0,0 @@
|
||||
/* Description of GNU message catalog format: general file layout.
|
||||
Copyright (C) 1995, 1997, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA. */
|
||||
|
||||
#ifndef _GETTEXT_H
|
||||
#define _GETTEXT_H 1
|
||||
|
||||
#if HAVE_LIMITS_H || _LIBC
|
||||
# include <limits.h>
|
||||
#endif
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
/* The magic number of the GNU message catalog format. */
|
||||
#define _MAGIC 0x950412de
|
||||
#define _MAGIC_SWAPPED 0xde120495
|
||||
|
||||
/* Revision number of the currently used .mo (binary) file format. */
|
||||
#define MO_REVISION_NUMBER 0
|
||||
|
||||
/* The following contortions are an attempt to use the C preprocessor
|
||||
to determine an unsigned integral type that is 32 bits wide. An
|
||||
alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but
|
||||
as of version autoconf-2.13, the AC_CHECK_SIZEOF macro doesn't work
|
||||
when cross-compiling. */
|
||||
|
||||
#if __STDC__
|
||||
# define UINT_MAX_32_BITS 4294967295U
|
||||
#else
|
||||
# define UINT_MAX_32_BITS 0xFFFFFFFF
|
||||
#endif
|
||||
|
||||
/* If UINT_MAX isn't defined, assume it's a 32-bit type.
|
||||
This should be valid for all systems GNU cares about because
|
||||
that doesn't include 16-bit systems, and only modern systems
|
||||
(that certainly have <limits.h>) have 64+-bit integral types. */
|
||||
|
||||
#ifndef UINT_MAX
|
||||
# define UINT_MAX UINT_MAX_32_BITS
|
||||
#endif
|
||||
|
||||
#if UINT_MAX == UINT_MAX_32_BITS
|
||||
typedef unsigned nls_uint32;
|
||||
#else
|
||||
# if USHRT_MAX == UINT_MAX_32_BITS
|
||||
typedef unsigned short nls_uint32;
|
||||
# else
|
||||
# if ULONG_MAX == UINT_MAX_32_BITS
|
||||
typedef unsigned long nls_uint32;
|
||||
# else
|
||||
/* The following line is intended to throw an error. Using #error is
|
||||
not portable enough. */
|
||||
"Cannot determine unsigned 32-bit data type."
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/* Header for binary .mo file format. */
|
||||
struct mo_file_header
|
||||
{
|
||||
/* The magic number. */
|
||||
nls_uint32 magic;
|
||||
/* The revision number of the file format. */
|
||||
nls_uint32 revision;
|
||||
/* The number of strings pairs. */
|
||||
nls_uint32 nstrings;
|
||||
/* Offset of table with start offsets of original strings. */
|
||||
nls_uint32 orig_tab_offset;
|
||||
/* Offset of table with start offsets of translation strings. */
|
||||
nls_uint32 trans_tab_offset;
|
||||
/* Size of hashing table. */
|
||||
nls_uint32 hash_tab_size;
|
||||
/* Offset of first hashing entry. */
|
||||
nls_uint32 hash_tab_offset;
|
||||
};
|
||||
|
||||
struct string_desc
|
||||
{
|
||||
/* Length of addressed string. */
|
||||
nls_uint32 length;
|
||||
/* Offset of string in file. */
|
||||
nls_uint32 offset;
|
||||
};
|
||||
|
||||
/* @@ begin of epilog @@ */
|
||||
|
||||
#endif /* gettext.h */
|
||||
-252
@@ -1,252 +0,0 @@
|
||||
/* Header describing internals of libintl library.
|
||||
Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
Written by Ulrich Drepper <[email protected]>, 1995.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA. */
|
||||
|
||||
#ifndef _GETTEXTP_H
|
||||
#define _GETTEXTP_H
|
||||
|
||||
#include <stddef.h> /* Get size_t. */
|
||||
|
||||
#ifdef _LIBC
|
||||
# include "../iconv/gconv_int.h"
|
||||
#else
|
||||
# if HAVE_ICONV
|
||||
# include <iconv.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include "loadinfo.h"
|
||||
|
||||
#include "gettext.h" /* Get nls_uint32. */
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
#ifndef PARAMS
|
||||
# if __STDC__
|
||||
# define PARAMS(args) args
|
||||
# else
|
||||
# define PARAMS(args) ()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef internal_function
|
||||
# define internal_function
|
||||
#endif
|
||||
|
||||
/* Tell the compiler when a conditional or integer expression is
|
||||
almost always true or almost always false. */
|
||||
#ifndef HAVE_BUILTIN_EXPECT
|
||||
# define __builtin_expect(expr, val) (expr)
|
||||
#endif
|
||||
|
||||
#ifndef W
|
||||
# define W(flag, data) ((flag) ? SWAP (data) : (data))
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _LIBC
|
||||
# include <byteswap.h>
|
||||
# define SWAP(i) bswap_32 (i)
|
||||
#else
|
||||
static inline nls_uint32
|
||||
SWAP (i)
|
||||
nls_uint32 i;
|
||||
{
|
||||
return (i << 24) | ((i & 0xff00) << 8) | ((i >> 8) & 0xff00) | (i >> 24);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* This is the representation of the expressions to determine the
|
||||
plural form. */
|
||||
struct expression
|
||||
{
|
||||
int nargs; /* Number of arguments. */
|
||||
enum operator
|
||||
{
|
||||
/* Without arguments: */
|
||||
var, /* The variable "n". */
|
||||
num, /* Decimal number. */
|
||||
/* Unary operators: */
|
||||
lnot, /* Logical NOT. */
|
||||
/* Binary operators: */
|
||||
mult, /* Multiplication. */
|
||||
divide, /* Division. */
|
||||
module, /* Module operation. */
|
||||
plus, /* Addition. */
|
||||
minus, /* Subtraction. */
|
||||
less_than, /* Comparison. */
|
||||
greater_than, /* Comparison. */
|
||||
less_or_equal, /* Comparison. */
|
||||
greater_or_equal, /* Comparison. */
|
||||
equal, /* Comparision for equality. */
|
||||
not_equal, /* Comparision for inequality. */
|
||||
land, /* Logical AND. */
|
||||
lor, /* Logical OR. */
|
||||
/* Ternary operators: */
|
||||
qmop /* Question mark operator. */
|
||||
} operation;
|
||||
union
|
||||
{
|
||||
unsigned long int num; /* Number value for `num'. */
|
||||
struct expression *args[3]; /* Up to three arguments. */
|
||||
} val;
|
||||
};
|
||||
|
||||
/* This is the data structure to pass information to the parser and get
|
||||
the result in a thread-safe way. */
|
||||
struct parse_args
|
||||
{
|
||||
const char *cp;
|
||||
struct expression *res;
|
||||
};
|
||||
|
||||
|
||||
/* The representation of an opened message catalog. */
|
||||
struct loaded_domain
|
||||
{
|
||||
const char *data;
|
||||
int use_mmap;
|
||||
size_t mmap_size;
|
||||
int must_swap;
|
||||
nls_uint32 nstrings;
|
||||
struct string_desc *orig_tab;
|
||||
struct string_desc *trans_tab;
|
||||
nls_uint32 hash_size;
|
||||
nls_uint32 *hash_tab;
|
||||
int codeset_cntr;
|
||||
#ifdef _LIBC
|
||||
__gconv_t conv;
|
||||
#else
|
||||
# if HAVE_ICONV
|
||||
iconv_t conv;
|
||||
# endif
|
||||
#endif
|
||||
char **conv_tab;
|
||||
|
||||
struct expression *plural;
|
||||
unsigned long int nplurals;
|
||||
};
|
||||
|
||||
/* We want to allocate a string at the end of the struct. But ISO C
|
||||
doesn't allow zero sized arrays. */
|
||||
#ifdef __GNUC__
|
||||
# define ZERO 0
|
||||
#else
|
||||
# define ZERO 1
|
||||
#endif
|
||||
|
||||
/* A set of settings bound to a message domain. Used to store settings
|
||||
from bindtextdomain() and bind_textdomain_codeset(). */
|
||||
struct binding
|
||||
{
|
||||
struct binding *next;
|
||||
char *dirname;
|
||||
int codeset_cntr; /* Incremented each time codeset changes. */
|
||||
char *codeset;
|
||||
char domainname[ZERO];
|
||||
};
|
||||
|
||||
/* A counter which is incremented each time some previous translations
|
||||
become invalid.
|
||||
This variable is part of the external ABI of the GNU libintl. */
|
||||
extern int _nl_msg_cat_cntr;
|
||||
|
||||
struct loaded_l10nfile *_nl_find_domain PARAMS ((const char *__dirname,
|
||||
char *__locale,
|
||||
const char *__domainname,
|
||||
struct binding *__domainbinding))
|
||||
internal_function;
|
||||
void _nl_load_domain PARAMS ((struct loaded_l10nfile *__domain,
|
||||
struct binding *__domainbinding))
|
||||
internal_function;
|
||||
void _nl_unload_domain PARAMS ((struct loaded_domain *__domain))
|
||||
internal_function;
|
||||
const char *_nl_init_domain_conv PARAMS ((struct loaded_l10nfile *__domain_file,
|
||||
struct loaded_domain *__domain,
|
||||
struct binding *__domainbinding))
|
||||
internal_function;
|
||||
void _nl_free_domain_conv PARAMS ((struct loaded_domain *__domain))
|
||||
internal_function;
|
||||
|
||||
char *_nl_find_msg PARAMS ((struct loaded_l10nfile *domain_file,
|
||||
struct binding *domainbinding,
|
||||
const char *msgid, size_t *lengthp))
|
||||
internal_function;
|
||||
|
||||
#ifdef _LIBC
|
||||
extern char *__gettext PARAMS ((const char *__msgid));
|
||||
extern char *__dgettext PARAMS ((const char *__domainname,
|
||||
const char *__msgid));
|
||||
extern char *__dcgettext PARAMS ((const char *__domainname,
|
||||
const char *__msgid, int __category));
|
||||
extern char *__ngettext PARAMS ((const char *__msgid1, const char *__msgid2,
|
||||
unsigned long int __n));
|
||||
extern char *__dngettext PARAMS ((const char *__domainname,
|
||||
const char *__msgid1, const char *__msgid2,
|
||||
unsigned long int n));
|
||||
extern char *__dcngettext PARAMS ((const char *__domainname,
|
||||
const char *__msgid1, const char *__msgid2,
|
||||
unsigned long int __n, int __category));
|
||||
extern char *__dcigettext PARAMS ((const char *__domainname,
|
||||
const char *__msgid1, const char *__msgid2,
|
||||
int __plural, unsigned long int __n,
|
||||
int __category));
|
||||
extern char *__textdomain PARAMS ((const char *__domainname));
|
||||
extern char *__bindtextdomain PARAMS ((const char *__domainname,
|
||||
const char *__dirname));
|
||||
extern char *__bind_textdomain_codeset PARAMS ((const char *__domainname,
|
||||
const char *__codeset));
|
||||
#else
|
||||
extern char *gettext__ PARAMS ((const char *__msgid));
|
||||
extern char *dgettext__ PARAMS ((const char *__domainname,
|
||||
const char *__msgid));
|
||||
extern char *dcgettext__ PARAMS ((const char *__domainname,
|
||||
const char *__msgid, int __category));
|
||||
extern char *ngettext__ PARAMS ((const char *__msgid1, const char *__msgid2,
|
||||
unsigned long int __n));
|
||||
extern char *dngettext__ PARAMS ((const char *__domainname,
|
||||
const char *__msgid1, const char *__msgid2,
|
||||
unsigned long int __n));
|
||||
extern char *dcngettext__ PARAMS ((const char *__domainname,
|
||||
const char *__msgid1, const char *__msgid2,
|
||||
unsigned long int __n, int __category));
|
||||
extern char *dcigettext__ PARAMS ((const char *__domainname,
|
||||
const char *__msgid1, const char *__msgid2,
|
||||
int __plural, unsigned long int __n,
|
||||
int __category));
|
||||
extern char *textdomain__ PARAMS ((const char *__domainname));
|
||||
extern char *bindtextdomain__ PARAMS ((const char *__domainname,
|
||||
const char *__dirname));
|
||||
extern char *bind_textdomain_codeset__ PARAMS ((const char *__domainname,
|
||||
const char *__codeset));
|
||||
#endif
|
||||
|
||||
#ifdef _LIBC
|
||||
extern void __gettext_free_exp PARAMS ((struct expression *exp))
|
||||
internal_function;
|
||||
extern int __gettextparse PARAMS ((void *arg));
|
||||
#else
|
||||
extern void gettext_free_exp__ PARAMS ((struct expression *exp))
|
||||
internal_function;
|
||||
extern int gettextparse__ PARAMS ((void *arg));
|
||||
#endif
|
||||
|
||||
/* @@ begin of epilog @@ */
|
||||
|
||||
#endif /* gettextP.h */
|
||||
@@ -1,59 +0,0 @@
|
||||
/* Description of GNU message catalog format: string hashing function.
|
||||
Copyright (C) 1995, 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA. */
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
#ifndef PARAMS
|
||||
# if __STDC__
|
||||
# define PARAMS(Args) Args
|
||||
# else
|
||||
# define PARAMS(Args) ()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* We assume to have `unsigned long int' value with at least 32 bits. */
|
||||
#define HASHWORDBITS 32
|
||||
|
||||
|
||||
/* Defines the so called `hashpjw' function by P.J. Weinberger
|
||||
[see Aho/Sethi/Ullman, COMPILERS: Principles, Techniques and Tools,
|
||||
1986, 1987 Bell Telephone Laboratories, Inc.] */
|
||||
static unsigned long int hash_string PARAMS ((const char *__str_param));
|
||||
|
||||
static inline unsigned long int
|
||||
hash_string (str_param)
|
||||
const char *str_param;
|
||||
{
|
||||
unsigned long int hval, g;
|
||||
const char *str = str_param;
|
||||
|
||||
/* Compute the hash value for the given string. */
|
||||
hval = 0;
|
||||
while (*str != '\0')
|
||||
{
|
||||
hval <<= 4;
|
||||
hval += (unsigned long int) *str++;
|
||||
g = hval & ((unsigned long int) 0xf << (HASHWORDBITS - 4));
|
||||
if (g != 0)
|
||||
{
|
||||
hval ^= g >> (HASHWORDBITS - 8);
|
||||
hval ^= g;
|
||||
}
|
||||
}
|
||||
return hval;
|
||||
}
|
||||
@@ -1,166 +0,0 @@
|
||||
/* intl-compat.c - Stub functions to call gettext functions from GNU gettext
|
||||
Library.
|
||||
Copyright (C) 1995, 2000, 2001 Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "libgnuintl.h"
|
||||
#include "gettextP.h"
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
/* This file redirects the gettext functions (without prefix or suffix) to
|
||||
those defined in the included GNU gettext library (with "__" suffix).
|
||||
It is compiled into libintl when the included GNU gettext library is
|
||||
configured --with-included-gettext.
|
||||
|
||||
This redirection works also in the case that the system C library or
|
||||
the system libintl library contain gettext/textdomain/... functions.
|
||||
If it didn't, we would need to add preprocessor level redirections to
|
||||
libgnuintl.h of the following form:
|
||||
|
||||
# define gettext gettext__
|
||||
# define dgettext dgettext__
|
||||
# define dcgettext dcgettext__
|
||||
# define ngettext ngettext__
|
||||
# define dngettext dngettext__
|
||||
# define dcngettext dcngettext__
|
||||
# define textdomain textdomain__
|
||||
# define bindtextdomain bindtextdomain__
|
||||
# define bind_textdomain_codeset bind_textdomain_codeset__
|
||||
|
||||
How does this redirection work? There are two cases.
|
||||
A. When libintl.a is linked into an executable, it works because
|
||||
functions defined in the executable always override functions in
|
||||
the shared libraries.
|
||||
B. When libintl.so is used, it works because
|
||||
1. those systems defining gettext/textdomain/... in the C library
|
||||
(namely, Solaris 2.4 and newer, and GNU libc 2.0 and newer) are
|
||||
ELF systems and define these symbols as weak, thus explicitly
|
||||
letting other shared libraries override it.
|
||||
2. those systems defining gettext/textdomain/... in a standalone
|
||||
libintl.so library (namely, Solaris 2.3 and newer) have this
|
||||
shared library in /usr/lib, and the linker will search /usr/lib
|
||||
*after* the directory where the GNU gettext library is installed.
|
||||
|
||||
A third case, namely when libintl.a is linked into a shared library
|
||||
whose name is not libintl.so, is not supported. In this case, on
|
||||
Solaris, when -lintl precedes the linker option for the shared library
|
||||
containing GNU gettext, the system's gettext would indeed override
|
||||
the GNU gettext. Anyone doing this kind of stuff must be clever enough
|
||||
to 1. compile libintl.a with -fPIC, 2. remove -lintl from his linker
|
||||
command line. */
|
||||
|
||||
|
||||
#undef gettext
|
||||
#undef dgettext
|
||||
#undef dcgettext
|
||||
#undef ngettext
|
||||
#undef dngettext
|
||||
#undef dcngettext
|
||||
#undef textdomain
|
||||
#undef bindtextdomain
|
||||
#undef bind_textdomain_codeset
|
||||
|
||||
|
||||
char *
|
||||
gettext (msgid)
|
||||
const char *msgid;
|
||||
{
|
||||
return gettext__ (msgid);
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
dgettext (domainname, msgid)
|
||||
const char *domainname;
|
||||
const char *msgid;
|
||||
{
|
||||
return dgettext__ (domainname, msgid);
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
dcgettext (domainname, msgid, category)
|
||||
const char *domainname;
|
||||
const char *msgid;
|
||||
int category;
|
||||
{
|
||||
return dcgettext__ (domainname, msgid, category);
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
ngettext (msgid1, msgid2, n)
|
||||
const char *msgid1;
|
||||
const char *msgid2;
|
||||
unsigned long int n;
|
||||
{
|
||||
return ngettext__ (msgid1, msgid2, n);
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
dngettext (domainname, msgid1, msgid2, n)
|
||||
const char *domainname;
|
||||
const char *msgid1;
|
||||
const char *msgid2;
|
||||
unsigned long int n;
|
||||
{
|
||||
return dngettext__ (domainname, msgid1, msgid2, n);
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
dcngettext (domainname, msgid1, msgid2, n, category)
|
||||
const char *domainname;
|
||||
const char *msgid1;
|
||||
const char *msgid2;
|
||||
unsigned long int n;
|
||||
int category;
|
||||
{
|
||||
return dcngettext__ (domainname, msgid1, msgid2, n, category);
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
textdomain (domainname)
|
||||
const char *domainname;
|
||||
{
|
||||
return textdomain__ (domainname);
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
bindtextdomain (domainname, dirname)
|
||||
const char *domainname;
|
||||
const char *dirname;
|
||||
{
|
||||
return bindtextdomain__ (domainname, dirname);
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
bind_textdomain_codeset (domainname, codeset)
|
||||
const char *domainname;
|
||||
const char *codeset;
|
||||
{
|
||||
return bind_textdomain_codeset__ (domainname, codeset);
|
||||
}
|
||||
@@ -1,405 +0,0 @@
|
||||
/* Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
Contributed by Ulrich Drepper <[email protected]>, 1995.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA. */
|
||||
|
||||
/* Tell glibc's <string.h> to provide a prototype for stpcpy().
|
||||
This must come before <config.h> because <config.h> may include
|
||||
<features.h>, and once <features.h> has been included, it's too late. */
|
||||
#ifndef _GNU_SOURCE
|
||||
# define _GNU_SOURCE 1
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#if !HAVE_STRCHR && !defined _LIBC
|
||||
# ifndef strchr
|
||||
# define strchr index
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined _LIBC || defined HAVE_ARGZ_H
|
||||
# include <argz.h>
|
||||
#endif
|
||||
#include <ctype.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "loadinfo.h"
|
||||
|
||||
/* On some strange systems still no definition of NULL is found. Sigh! */
|
||||
#ifndef NULL
|
||||
# if defined __STDC__ && __STDC__
|
||||
# define NULL ((void *) 0)
|
||||
# else
|
||||
# define NULL 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
#ifdef _LIBC
|
||||
/* Rename the non ANSI C functions. This is required by the standard
|
||||
because some ANSI C functions will require linking with this object
|
||||
file and the name space must not be polluted. */
|
||||
# ifndef stpcpy
|
||||
# define stpcpy(dest, src) __stpcpy(dest, src)
|
||||
# endif
|
||||
#else
|
||||
# ifndef HAVE_STPCPY
|
||||
static char *stpcpy PARAMS ((char *dest, const char *src));
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Define function which are usually not available. */
|
||||
|
||||
#if !defined _LIBC && !defined HAVE___ARGZ_COUNT
|
||||
/* Returns the number of strings in ARGZ. */
|
||||
static size_t argz_count__ PARAMS ((const char *argz, size_t len));
|
||||
|
||||
static size_t
|
||||
argz_count__ (argz, len)
|
||||
const char *argz;
|
||||
size_t len;
|
||||
{
|
||||
size_t count = 0;
|
||||
while (len > 0)
|
||||
{
|
||||
size_t part_len = strlen (argz);
|
||||
argz += part_len + 1;
|
||||
len -= part_len + 1;
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
# undef __argz_count
|
||||
# define __argz_count(argz, len) argz_count__ (argz, len)
|
||||
#endif /* !_LIBC && !HAVE___ARGZ_COUNT */
|
||||
|
||||
#if !defined _LIBC && !defined HAVE___ARGZ_STRINGIFY
|
||||
/* Make '\0' separated arg vector ARGZ printable by converting all the '\0's
|
||||
except the last into the character SEP. */
|
||||
static void argz_stringify__ PARAMS ((char *argz, size_t len, int sep));
|
||||
|
||||
static void
|
||||
argz_stringify__ (argz, len, sep)
|
||||
char *argz;
|
||||
size_t len;
|
||||
int sep;
|
||||
{
|
||||
while (len > 0)
|
||||
{
|
||||
size_t part_len = strlen (argz);
|
||||
argz += part_len;
|
||||
len -= part_len + 1;
|
||||
if (len > 0)
|
||||
*argz++ = sep;
|
||||
}
|
||||
}
|
||||
# undef __argz_stringify
|
||||
# define __argz_stringify(argz, len, sep) argz_stringify__ (argz, len, sep)
|
||||
#endif /* !_LIBC && !HAVE___ARGZ_STRINGIFY */
|
||||
|
||||
#if !defined _LIBC && !defined HAVE___ARGZ_NEXT
|
||||
static char *argz_next__ PARAMS ((char *argz, size_t argz_len,
|
||||
const char *entry));
|
||||
|
||||
static char *
|
||||
argz_next__ (argz, argz_len, entry)
|
||||
char *argz;
|
||||
size_t argz_len;
|
||||
const char *entry;
|
||||
{
|
||||
if (entry)
|
||||
{
|
||||
if (entry < argz + argz_len)
|
||||
entry = strchr (entry, '\0') + 1;
|
||||
|
||||
return entry >= argz + argz_len ? NULL : (char *) entry;
|
||||
}
|
||||
else
|
||||
if (argz_len > 0)
|
||||
return argz;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
# undef __argz_next
|
||||
# define __argz_next(argz, len, entry) argz_next__ (argz, len, entry)
|
||||
#endif /* !_LIBC && !HAVE___ARGZ_NEXT */
|
||||
|
||||
|
||||
/* Return number of bits set in X. */
|
||||
static int pop PARAMS ((int x));
|
||||
|
||||
static inline int
|
||||
pop (x)
|
||||
int x;
|
||||
{
|
||||
/* We assume that no more than 16 bits are used. */
|
||||
x = ((x & ~0x5555) >> 1) + (x & 0x5555);
|
||||
x = ((x & ~0x3333) >> 2) + (x & 0x3333);
|
||||
x = ((x >> 4) + x) & 0x0f0f;
|
||||
x = ((x >> 8) + x) & 0xff;
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
|
||||
struct loaded_l10nfile *
|
||||
_nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len, mask, language,
|
||||
territory, codeset, normalized_codeset, modifier, special,
|
||||
sponsor, revision, filename, do_allocate)
|
||||
struct loaded_l10nfile **l10nfile_list;
|
||||
const char *dirlist;
|
||||
size_t dirlist_len;
|
||||
int mask;
|
||||
const char *language;
|
||||
const char *territory;
|
||||
const char *codeset;
|
||||
const char *normalized_codeset;
|
||||
const char *modifier;
|
||||
const char *special;
|
||||
const char *sponsor;
|
||||
const char *revision;
|
||||
const char *filename;
|
||||
int do_allocate;
|
||||
{
|
||||
char *abs_filename;
|
||||
struct loaded_l10nfile *last = NULL;
|
||||
struct loaded_l10nfile *retval;
|
||||
char *cp;
|
||||
size_t entries;
|
||||
int cnt;
|
||||
|
||||
/* Allocate room for the full file name. */
|
||||
abs_filename = (char *) malloc (dirlist_len
|
||||
+ strlen (language)
|
||||
+ ((mask & TERRITORY) != 0
|
||||
? strlen (territory) + 1 : 0)
|
||||
+ ((mask & XPG_CODESET) != 0
|
||||
? strlen (codeset) + 1 : 0)
|
||||
+ ((mask & XPG_NORM_CODESET) != 0
|
||||
? strlen (normalized_codeset) + 1 : 0)
|
||||
+ (((mask & XPG_MODIFIER) != 0
|
||||
|| (mask & CEN_AUDIENCE) != 0)
|
||||
? strlen (modifier) + 1 : 0)
|
||||
+ ((mask & CEN_SPECIAL) != 0
|
||||
? strlen (special) + 1 : 0)
|
||||
+ (((mask & CEN_SPONSOR) != 0
|
||||
|| (mask & CEN_REVISION) != 0)
|
||||
? (1 + ((mask & CEN_SPONSOR) != 0
|
||||
? strlen (sponsor) + 1 : 0)
|
||||
+ ((mask & CEN_REVISION) != 0
|
||||
? strlen (revision) + 1 : 0)) : 0)
|
||||
+ 1 + strlen (filename) + 1);
|
||||
|
||||
if (abs_filename == NULL)
|
||||
return NULL;
|
||||
|
||||
retval = NULL;
|
||||
last = NULL;
|
||||
|
||||
/* Construct file name. */
|
||||
memcpy (abs_filename, dirlist, dirlist_len);
|
||||
__argz_stringify (abs_filename, dirlist_len, PATH_SEPARATOR);
|
||||
cp = abs_filename + (dirlist_len - 1);
|
||||
*cp++ = '/';
|
||||
cp = stpcpy (cp, language);
|
||||
|
||||
if ((mask & TERRITORY) != 0)
|
||||
{
|
||||
*cp++ = '_';
|
||||
cp = stpcpy (cp, territory);
|
||||
}
|
||||
if ((mask & XPG_CODESET) != 0)
|
||||
{
|
||||
*cp++ = '.';
|
||||
cp = stpcpy (cp, codeset);
|
||||
}
|
||||
if ((mask & XPG_NORM_CODESET) != 0)
|
||||
{
|
||||
*cp++ = '.';
|
||||
cp = stpcpy (cp, normalized_codeset);
|
||||
}
|
||||
if ((mask & (XPG_MODIFIER | CEN_AUDIENCE)) != 0)
|
||||
{
|
||||
/* This component can be part of both syntaces but has different
|
||||
leading characters. For CEN we use `+', else `@'. */
|
||||
*cp++ = (mask & CEN_AUDIENCE) != 0 ? '+' : '@';
|
||||
cp = stpcpy (cp, modifier);
|
||||
}
|
||||
if ((mask & CEN_SPECIAL) != 0)
|
||||
{
|
||||
*cp++ = '+';
|
||||
cp = stpcpy (cp, special);
|
||||
}
|
||||
if ((mask & (CEN_SPONSOR | CEN_REVISION)) != 0)
|
||||
{
|
||||
*cp++ = ',';
|
||||
if ((mask & CEN_SPONSOR) != 0)
|
||||
cp = stpcpy (cp, sponsor);
|
||||
if ((mask & CEN_REVISION) != 0)
|
||||
{
|
||||
*cp++ = '_';
|
||||
cp = stpcpy (cp, revision);
|
||||
}
|
||||
}
|
||||
|
||||
*cp++ = '/';
|
||||
stpcpy (cp, filename);
|
||||
|
||||
/* Look in list of already loaded domains whether it is already
|
||||
available. */
|
||||
last = NULL;
|
||||
for (retval = *l10nfile_list; retval != NULL; retval = retval->next)
|
||||
if (retval->filename != NULL)
|
||||
{
|
||||
int compare = strcmp (retval->filename, abs_filename);
|
||||
if (compare == 0)
|
||||
/* We found it! */
|
||||
break;
|
||||
if (compare < 0)
|
||||
{
|
||||
/* It's not in the list. */
|
||||
retval = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
last = retval;
|
||||
}
|
||||
|
||||
if (retval != NULL || do_allocate == 0)
|
||||
{
|
||||
free (abs_filename);
|
||||
return retval;
|
||||
}
|
||||
|
||||
retval = (struct loaded_l10nfile *)
|
||||
malloc (sizeof (*retval) + (__argz_count (dirlist, dirlist_len)
|
||||
* (1 << pop (mask))
|
||||
* sizeof (struct loaded_l10nfile *)));
|
||||
if (retval == NULL)
|
||||
return NULL;
|
||||
|
||||
retval->filename = abs_filename;
|
||||
retval->decided = (__argz_count (dirlist, dirlist_len) != 1
|
||||
|| ((mask & XPG_CODESET) != 0
|
||||
&& (mask & XPG_NORM_CODESET) != 0));
|
||||
retval->data = NULL;
|
||||
|
||||
if (last == NULL)
|
||||
{
|
||||
retval->next = *l10nfile_list;
|
||||
*l10nfile_list = retval;
|
||||
}
|
||||
else
|
||||
{
|
||||
retval->next = last->next;
|
||||
last->next = retval;
|
||||
}
|
||||
|
||||
entries = 0;
|
||||
/* If the DIRLIST is a real list the RETVAL entry corresponds not to
|
||||
a real file. So we have to use the DIRLIST separation mechanism
|
||||
of the inner loop. */
|
||||
cnt = __argz_count (dirlist, dirlist_len) == 1 ? mask - 1 : mask;
|
||||
for (; cnt >= 0; --cnt)
|
||||
if ((cnt & ~mask) == 0
|
||||
&& ((cnt & CEN_SPECIFIC) == 0 || (cnt & XPG_SPECIFIC) == 0)
|
||||
&& ((cnt & XPG_CODESET) == 0 || (cnt & XPG_NORM_CODESET) == 0))
|
||||
{
|
||||
/* Iterate over all elements of the DIRLIST. */
|
||||
char *dir = NULL;
|
||||
|
||||
while ((dir = __argz_next ((char *) dirlist, dirlist_len, dir))
|
||||
!= NULL)
|
||||
retval->successor[entries++]
|
||||
= _nl_make_l10nflist (l10nfile_list, dir, strlen (dir) + 1, cnt,
|
||||
language, territory, codeset,
|
||||
normalized_codeset, modifier, special,
|
||||
sponsor, revision, filename, 1);
|
||||
}
|
||||
retval->successor[entries] = NULL;
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* Normalize codeset name. There is no standard for the codeset
|
||||
names. Normalization allows the user to use any of the common
|
||||
names. The return value is dynamically allocated and has to be
|
||||
freed by the caller. */
|
||||
const char *
|
||||
_nl_normalize_codeset (codeset, name_len)
|
||||
const char *codeset;
|
||||
size_t name_len;
|
||||
{
|
||||
int len = 0;
|
||||
int only_digit = 1;
|
||||
char *retval;
|
||||
char *wp;
|
||||
size_t cnt;
|
||||
|
||||
for (cnt = 0; cnt < name_len; ++cnt)
|
||||
if (isalnum (codeset[cnt]))
|
||||
{
|
||||
++len;
|
||||
|
||||
if (isalpha (codeset[cnt]))
|
||||
only_digit = 0;
|
||||
}
|
||||
|
||||
retval = (char *) malloc ((only_digit ? 3 : 0) + len + 1);
|
||||
|
||||
if (retval != NULL)
|
||||
{
|
||||
if (only_digit)
|
||||
wp = stpcpy (retval, "iso");
|
||||
else
|
||||
wp = retval;
|
||||
|
||||
for (cnt = 0; cnt < name_len; ++cnt)
|
||||
if (isalpha (codeset[cnt]))
|
||||
*wp++ = tolower (codeset[cnt]);
|
||||
else if (isdigit (codeset[cnt]))
|
||||
*wp++ = codeset[cnt];
|
||||
|
||||
*wp = '\0';
|
||||
}
|
||||
|
||||
return (const char *) retval;
|
||||
}
|
||||
|
||||
|
||||
/* @@ begin of epilog @@ */
|
||||
|
||||
/* We don't want libintl.a to depend on any other library. So we
|
||||
avoid the non-standard function stpcpy. In GNU C Library this
|
||||
function is available, though. Also allow the symbol HAVE_STPCPY
|
||||
to be defined. */
|
||||
#if !_LIBC && !HAVE_STPCPY
|
||||
static char *
|
||||
stpcpy (dest, src)
|
||||
char *dest;
|
||||
const char *src;
|
||||
{
|
||||
while ((*dest++ = *src++) != '\0')
|
||||
/* Do nothing. */ ;
|
||||
return dest - 1;
|
||||
}
|
||||
#endif
|
||||
@@ -1,49 +0,0 @@
|
||||
/* Convenience header for conditional use of GNU <libintl.h>.
|
||||
Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA. */
|
||||
|
||||
#ifndef _LIBGETTEXT_H
|
||||
#define _LIBGETTEXT_H 1
|
||||
|
||||
/* NLS can be disabled through the configure --disable-nls option. */
|
||||
#if ENABLE_NLS
|
||||
|
||||
/* Get declarations of GNU message catalog functions. */
|
||||
# include <libintl.h>
|
||||
|
||||
#else
|
||||
|
||||
# define gettext(Msgid) (Msgid)
|
||||
# define dgettext(Domainname, Msgid) (Msgid)
|
||||
# define dcgettext(Domainname, Msgid, Category) (Msgid)
|
||||
# define ngettext(Msgid1, Msgid2, N) \
|
||||
((N) == 1 ? (char *) (Msgid1) : (char *) (Msgid2))
|
||||
# define dngettext(Domainname, Msgid1, Msgid2, N) \
|
||||
((N) == 1 ? (char *) (Msgid1) : (char *) (Msgid2))
|
||||
# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
|
||||
((N) == 1 ? (char *) (Msgid1) : (char *) (Msgid2))
|
||||
# define textdomain(Domainname) ((char *) (Domainname))
|
||||
# define bindtextdomain(Domainname, Dirname) ((char *) (Dirname))
|
||||
# define bind_textdomain_codeset(Domainname, Codeset) ((char *) (Codeset))
|
||||
|
||||
#endif
|
||||
|
||||
/* For automatical extraction of messages sometimes no real
|
||||
translation is needed. Instead the string itself is the result. */
|
||||
#define gettext_noop(Str) (Str)
|
||||
|
||||
#endif /* _LIBGETTEXT_H */
|
||||
@@ -1,128 +0,0 @@
|
||||
/* Message catalogs for internationalization.
|
||||
Copyright (C) 1995-1997, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA. */
|
||||
|
||||
#ifndef _LIBINTL_H
|
||||
#define _LIBINTL_H 1
|
||||
|
||||
#include <locale.h>
|
||||
|
||||
/* The LC_MESSAGES locale category is the category used by the functions
|
||||
gettext() and dgettext(). It is specified in POSIX, but not in ANSI C.
|
||||
On systems that don't define it, use an arbitrary value instead.
|
||||
On Solaris, <locale.h> defines __LOCALE_H then includes <libintl.h> (i.e.
|
||||
this file!) and then only defines LC_MESSAGES. To avoid a redefinition
|
||||
warning, don't define LC_MESSAGES in this case. */
|
||||
#if !defined LC_MESSAGES && !defined __LOCALE_H
|
||||
# define LC_MESSAGES 1729
|
||||
#endif
|
||||
|
||||
/* We define an additional symbol to signal that we use the GNU
|
||||
implementation of gettext. */
|
||||
#define __USE_GNU_GETTEXT 1
|
||||
|
||||
/* Resolve a platform specific conflict on DJGPP. GNU gettext takes
|
||||
precedence over _conio_gettext. */
|
||||
#ifdef __DJGPP__
|
||||
# undef gettext
|
||||
# define gettext gettext
|
||||
#endif
|
||||
|
||||
#ifndef PARAMS
|
||||
# if __STDC__ || defined __cplusplus
|
||||
# define PARAMS(args) args
|
||||
# else
|
||||
# define PARAMS(args) ()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Look up MSGID in the current default message catalog for the current
|
||||
LC_MESSAGES locale. If not found, returns MSGID itself (the default
|
||||
text). */
|
||||
extern char *gettext PARAMS ((const char *__msgid));
|
||||
|
||||
/* Look up MSGID in the DOMAINNAME message catalog for the current
|
||||
LC_MESSAGES locale. */
|
||||
extern char *dgettext PARAMS ((const char *__domainname, const char *__msgid));
|
||||
|
||||
/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
|
||||
locale. */
|
||||
extern char *dcgettext PARAMS ((const char *__domainname, const char *__msgid,
|
||||
int __category));
|
||||
|
||||
|
||||
/* Similar to `gettext' but select the plural form corresponding to the
|
||||
number N. */
|
||||
extern char *ngettext PARAMS ((const char *__msgid1, const char *__msgid2,
|
||||
unsigned long int __n));
|
||||
|
||||
/* Similar to `dgettext' but select the plural form corresponding to the
|
||||
number N. */
|
||||
extern char *dngettext PARAMS ((const char *__domainname, const char *__msgid1,
|
||||
const char *__msgid2, unsigned long int __n));
|
||||
|
||||
/* Similar to `dcgettext' but select the plural form corresponding to the
|
||||
number N. */
|
||||
extern char *dcngettext PARAMS ((const char *__domainname, const char *__msgid1,
|
||||
const char *__msgid2, unsigned long int __n,
|
||||
int __category));
|
||||
|
||||
|
||||
/* Set the current default message catalog to DOMAINNAME.
|
||||
If DOMAINNAME is null, return the current default.
|
||||
If DOMAINNAME is "", reset to the default of "messages". */
|
||||
extern char *textdomain PARAMS ((const char *__domainname));
|
||||
|
||||
/* Specify that the DOMAINNAME message catalog will be found
|
||||
in DIRNAME rather than in the system locale data base. */
|
||||
extern char *bindtextdomain PARAMS ((const char *__domainname,
|
||||
const char *__dirname));
|
||||
|
||||
/* Specify the character encoding in which the messages from the
|
||||
DOMAINNAME message catalog will be returned. */
|
||||
extern char *bind_textdomain_codeset PARAMS ((const char *__domainname,
|
||||
const char *__codeset));
|
||||
|
||||
|
||||
/* Optimized version of the functions above. */
|
||||
#if defined __OPTIMIZED
|
||||
/* These are macros, but could also be inline functions. */
|
||||
|
||||
# define gettext(msgid) \
|
||||
dgettext (NULL, msgid)
|
||||
|
||||
# define dgettext(domainname, msgid) \
|
||||
dcgettext (domainname, msgid, LC_MESSAGES)
|
||||
|
||||
# define ngettext(msgid1, msgid2, n) \
|
||||
dngettext (NULL, msgid1, msgid2, n)
|
||||
|
||||
# define dngettext(domainname, msgid1, msgid2, n) \
|
||||
dcngettext (domainname, msgid1, msgid2, n, LC_MESSAGES)
|
||||
|
||||
#endif /* Optimizing. */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* libintl.h */
|
||||
-109
@@ -1,109 +0,0 @@
|
||||
/* Copyright (C) 1996-1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <[email protected]>, 1996.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA. */
|
||||
|
||||
#ifndef _LOADINFO_H
|
||||
#define _LOADINFO_H 1
|
||||
|
||||
#ifndef PARAMS
|
||||
# if __STDC__
|
||||
# define PARAMS(args) args
|
||||
# else
|
||||
# define PARAMS(args) ()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef internal_function
|
||||
# define internal_function
|
||||
#endif
|
||||
|
||||
/* Tell the compiler when a conditional or integer expression is
|
||||
almost always true or almost always false. */
|
||||
#ifndef HAVE_BUILTIN_EXPECT
|
||||
# define __builtin_expect(expr, val) (expr)
|
||||
#endif
|
||||
|
||||
/* Separator in PATH like lists of pathnames. */
|
||||
#if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined __DJGPP__
|
||||
/* Win32, OS/2, DOS */
|
||||
# define PATH_SEPARATOR ';'
|
||||
#else
|
||||
/* Unix */
|
||||
# define PATH_SEPARATOR ':'
|
||||
#endif
|
||||
|
||||
/* Encoding of locale name parts. */
|
||||
#define CEN_REVISION 1
|
||||
#define CEN_SPONSOR 2
|
||||
#define CEN_SPECIAL 4
|
||||
#define XPG_NORM_CODESET 8
|
||||
#define XPG_CODESET 16
|
||||
#define TERRITORY 32
|
||||
#define CEN_AUDIENCE 64
|
||||
#define XPG_MODIFIER 128
|
||||
|
||||
#define CEN_SPECIFIC (CEN_REVISION|CEN_SPONSOR|CEN_SPECIAL|CEN_AUDIENCE)
|
||||
#define XPG_SPECIFIC (XPG_CODESET|XPG_NORM_CODESET|XPG_MODIFIER)
|
||||
|
||||
|
||||
struct loaded_l10nfile
|
||||
{
|
||||
const char *filename;
|
||||
int decided;
|
||||
|
||||
const void *data;
|
||||
|
||||
struct loaded_l10nfile *next;
|
||||
struct loaded_l10nfile *successor[1];
|
||||
};
|
||||
|
||||
|
||||
/* Normalize codeset name. There is no standard for the codeset
|
||||
names. Normalization allows the user to use any of the common
|
||||
names. The return value is dynamically allocated and has to be
|
||||
freed by the caller. */
|
||||
extern const char *_nl_normalize_codeset PARAMS ((const char *codeset,
|
||||
size_t name_len));
|
||||
|
||||
extern struct loaded_l10nfile *
|
||||
_nl_make_l10nflist PARAMS ((struct loaded_l10nfile **l10nfile_list,
|
||||
const char *dirlist, size_t dirlist_len, int mask,
|
||||
const char *language, const char *territory,
|
||||
const char *codeset,
|
||||
const char *normalized_codeset,
|
||||
const char *modifier, const char *special,
|
||||
const char *sponsor, const char *revision,
|
||||
const char *filename, int do_allocate));
|
||||
|
||||
|
||||
extern const char *_nl_expand_alias PARAMS ((const char *name));
|
||||
|
||||
/* normalized_codeset is dynamically allocated and has to be freed by
|
||||
the caller. */
|
||||
extern int _nl_explode_name PARAMS ((char *name, const char **language,
|
||||
const char **modifier,
|
||||
const char **territory,
|
||||
const char **codeset,
|
||||
const char **normalized_codeset,
|
||||
const char **special,
|
||||
const char **sponsor,
|
||||
const char **revision));
|
||||
|
||||
extern char *_nl_find_language PARAMS ((const char *name));
|
||||
|
||||
#endif /* loadinfo.h */
|
||||
@@ -1,567 +0,0 @@
|
||||
/* Load needed message catalogs.
|
||||
Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA. */
|
||||
|
||||
/* Tell glibc's <string.h> to provide a prototype for mempcpy().
|
||||
This must come before <config.h> because <config.h> may include
|
||||
<features.h>, and once <features.h> has been included, it's too late. */
|
||||
#ifndef _GNU_SOURCE
|
||||
# define _GNU_SOURCE 1
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
# define alloca __builtin_alloca
|
||||
# define HAVE_ALLOCA 1
|
||||
#else
|
||||
# if defined HAVE_ALLOCA_H || defined _LIBC
|
||||
# include <alloca.h>
|
||||
# else
|
||||
# ifdef _AIX
|
||||
#pragma alloca
|
||||
# else
|
||||
# ifndef alloca
|
||||
char *alloca ();
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined HAVE_UNISTD_H || defined _LIBC
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef _LIBC
|
||||
# include <langinfo.h>
|
||||
# include <locale.h>
|
||||
#endif
|
||||
|
||||
#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
|
||||
|| (defined _LIBC && defined _POSIX_MAPPED_FILES)
|
||||
# include <sys/mman.h>
|
||||
# undef HAVE_MMAP
|
||||
# define HAVE_MMAP 1
|
||||
#else
|
||||
# undef HAVE_MMAP
|
||||
#endif
|
||||
|
||||
#include "gettext.h"
|
||||
#include "gettextP.h"
|
||||
|
||||
#ifdef _LIBC
|
||||
# include "../locale/localeinfo.h"
|
||||
#endif
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
#ifdef _LIBC
|
||||
/* Rename the non ISO C functions. This is required by the standard
|
||||
because some ISO C functions will require linking with this object
|
||||
file and the name space must not be polluted. */
|
||||
# define open __open
|
||||
# define close __close
|
||||
# define read __read
|
||||
# define mmap __mmap
|
||||
# define munmap __munmap
|
||||
#endif
|
||||
|
||||
/* Names for the libintl functions are a problem. They must not clash
|
||||
with existing names and they should follow ANSI C. But this source
|
||||
code is also used in GNU C Library where the names have a __
|
||||
prefix. So we have to make a difference here. */
|
||||
#ifdef _LIBC
|
||||
# define PLURAL_PARSE __gettextparse
|
||||
#else
|
||||
# define PLURAL_PARSE gettextparse__
|
||||
#endif
|
||||
|
||||
/* For those losing systems which don't have `alloca' we have to add
|
||||
some additional code emulating it. */
|
||||
#ifdef HAVE_ALLOCA
|
||||
# define freea(p) /* nothing */
|
||||
#else
|
||||
# define alloca(n) malloc (n)
|
||||
# define freea(p) free (p)
|
||||
#endif
|
||||
|
||||
/* For systems that distinguish between text and binary I/O.
|
||||
O_BINARY is usually declared in <fcntl.h>. */
|
||||
#if !defined O_BINARY && defined _O_BINARY
|
||||
/* For MSC-compatible compilers. */
|
||||
# define O_BINARY _O_BINARY
|
||||
# define O_TEXT _O_TEXT
|
||||
#endif
|
||||
#ifdef __BEOS__
|
||||
/* BeOS 5 has O_BINARY and O_TEXT, but they have no effect. */
|
||||
# undef O_BINARY
|
||||
# undef O_TEXT
|
||||
#endif
|
||||
/* On reasonable systems, binary I/O is the default. */
|
||||
#ifndef O_BINARY
|
||||
# define O_BINARY 0
|
||||
#endif
|
||||
|
||||
/* We need a sign, whether a new catalog was loaded, which can be associated
|
||||
with all translations. This is important if the translations are
|
||||
cached by one of GCC's features. */
|
||||
int _nl_msg_cat_cntr;
|
||||
|
||||
#if (defined __GNUC__ && !defined __APPLE_CC__) \
|
||||
|| (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)
|
||||
|
||||
/* These structs are the constant expression for the germanic plural
|
||||
form determination. It represents the expression "n != 1". */
|
||||
static const struct expression plvar =
|
||||
{
|
||||
.nargs = 0,
|
||||
.operation = var,
|
||||
};
|
||||
static const struct expression plone =
|
||||
{
|
||||
.nargs = 0,
|
||||
.operation = num,
|
||||
.val =
|
||||
{
|
||||
.num = 1
|
||||
}
|
||||
};
|
||||
static struct expression germanic_plural =
|
||||
{
|
||||
.nargs = 2,
|
||||
.operation = not_equal,
|
||||
.val =
|
||||
{
|
||||
.args =
|
||||
{
|
||||
[0] = (struct expression *) &plvar,
|
||||
[1] = (struct expression *) &plone
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
# define INIT_GERMANIC_PLURAL()
|
||||
|
||||
#else
|
||||
|
||||
/* For compilers without support for ISO C 99 struct/union initializers:
|
||||
Initialization at run-time. */
|
||||
|
||||
static struct expression plvar;
|
||||
static struct expression plone;
|
||||
static struct expression germanic_plural;
|
||||
|
||||
static void
|
||||
init_germanic_plural ()
|
||||
{
|
||||
if (plone.val.num == 0)
|
||||
{
|
||||
plvar.nargs = 0;
|
||||
plvar.operation = var;
|
||||
|
||||
plone.nargs = 0;
|
||||
plone.operation = num;
|
||||
plone.val.num = 1;
|
||||
|
||||
germanic_plural.nargs = 2;
|
||||
germanic_plural.operation = not_equal;
|
||||
germanic_plural.val.args[0] = &plvar;
|
||||
germanic_plural.val.args[1] = &plone;
|
||||
}
|
||||
}
|
||||
|
||||
# define INIT_GERMANIC_PLURAL() init_germanic_plural ()
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* Initialize the codeset dependent parts of an opened message catalog.
|
||||
Return the header entry. */
|
||||
const char *
|
||||
internal_function
|
||||
_nl_init_domain_conv (domain_file, domain, domainbinding)
|
||||
struct loaded_l10nfile *domain_file;
|
||||
struct loaded_domain *domain;
|
||||
struct binding *domainbinding;
|
||||
{
|
||||
/* Find out about the character set the file is encoded with.
|
||||
This can be found (in textual form) in the entry "". If this
|
||||
entry does not exist or if this does not contain the `charset='
|
||||
information, we will assume the charset matches the one the
|
||||
current locale and we don't have to perform any conversion. */
|
||||
char *nullentry;
|
||||
size_t nullentrylen;
|
||||
|
||||
/* Preinitialize fields, to avoid recursion during _nl_find_msg. */
|
||||
domain->codeset_cntr =
|
||||
(domainbinding != NULL ? domainbinding->codeset_cntr : 0);
|
||||
#ifdef _LIBC
|
||||
domain->conv = (__gconv_t) -1;
|
||||
#else
|
||||
# if HAVE_ICONV
|
||||
domain->conv = (iconv_t) -1;
|
||||
# endif
|
||||
#endif
|
||||
domain->conv_tab = NULL;
|
||||
|
||||
/* Get the header entry. */
|
||||
nullentry = _nl_find_msg (domain_file, domainbinding, "", &nullentrylen);
|
||||
|
||||
if (nullentry != NULL)
|
||||
{
|
||||
#if defined _LIBC || HAVE_ICONV
|
||||
const char *charsetstr;
|
||||
|
||||
charsetstr = strstr (nullentry, "charset=");
|
||||
if (charsetstr != NULL)
|
||||
{
|
||||
size_t len;
|
||||
char *charset;
|
||||
const char *outcharset;
|
||||
|
||||
charsetstr += strlen ("charset=");
|
||||
len = strcspn (charsetstr, " \t\n");
|
||||
|
||||
charset = (char *) alloca (len + 1);
|
||||
# if defined _LIBC || HAVE_MEMPCPY
|
||||
*((char *) mempcpy (charset, charsetstr, len)) = '\0';
|
||||
# else
|
||||
memcpy (charset, charsetstr, len);
|
||||
charset[len] = '\0';
|
||||
# endif
|
||||
|
||||
/* The output charset should normally be determined by the
|
||||
locale. But sometimes the locale is not used or not correctly
|
||||
set up, so we provide a possibility for the user to override
|
||||
this. Moreover, the value specified through
|
||||
bind_textdomain_codeset overrides both. */
|
||||
if (domainbinding != NULL && domainbinding->codeset != NULL)
|
||||
outcharset = domainbinding->codeset;
|
||||
else
|
||||
{
|
||||
outcharset = getenv ("OUTPUT_CHARSET");
|
||||
if (outcharset == NULL || outcharset[0] == '\0')
|
||||
{
|
||||
# ifdef _LIBC
|
||||
outcharset = (*_nl_current[LC_CTYPE])->values[_NL_ITEM_INDEX (CODESET)].string;
|
||||
# else
|
||||
# if HAVE_ICONV
|
||||
extern const char *locale_charset (void);
|
||||
outcharset = locale_charset ();
|
||||
# endif
|
||||
# endif
|
||||
}
|
||||
}
|
||||
|
||||
# ifdef _LIBC
|
||||
/* We always want to use transliteration. */
|
||||
outcharset = norm_add_slashes (outcharset, "TRANSLIT");
|
||||
charset = norm_add_slashes (charset, NULL);
|
||||
if (__gconv_open (outcharset, charset, &domain->conv,
|
||||
GCONV_AVOID_NOCONV)
|
||||
!= __GCONV_OK)
|
||||
domain->conv = (__gconv_t) -1;
|
||||
# else
|
||||
# if HAVE_ICONV
|
||||
/* When using GNU libiconv, we want to use transliteration. */
|
||||
# if _LIBICONV_VERSION >= 0x0105
|
||||
len = strlen (outcharset);
|
||||
{
|
||||
char *tmp = (char *) alloca (len + 10 + 1);
|
||||
memcpy (tmp, outcharset, len);
|
||||
memcpy (tmp + len, "//TRANSLIT", 10 + 1);
|
||||
outcharset = tmp;
|
||||
}
|
||||
# endif
|
||||
domain->conv = iconv_open (outcharset, charset);
|
||||
# if _LIBICONV_VERSION >= 0x0105
|
||||
freea (outcharset);
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
|
||||
freea (charset);
|
||||
}
|
||||
#endif /* _LIBC || HAVE_ICONV */
|
||||
}
|
||||
|
||||
return nullentry;
|
||||
}
|
||||
|
||||
/* Frees the codeset dependent parts of an opened message catalog. */
|
||||
void
|
||||
internal_function
|
||||
_nl_free_domain_conv (domain)
|
||||
struct loaded_domain *domain;
|
||||
{
|
||||
if (domain->conv_tab != NULL && domain->conv_tab != (char **) -1)
|
||||
free (domain->conv_tab);
|
||||
|
||||
#ifdef _LIBC
|
||||
if (domain->conv != (__gconv_t) -1)
|
||||
__gconv_close (domain->conv);
|
||||
#else
|
||||
# if HAVE_ICONV
|
||||
if (domain->conv != (iconv_t) -1)
|
||||
iconv_close (domain->conv);
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Load the message catalogs specified by FILENAME. If it is no valid
|
||||
message catalog do nothing. */
|
||||
void
|
||||
internal_function
|
||||
_nl_load_domain (domain_file, domainbinding)
|
||||
struct loaded_l10nfile *domain_file;
|
||||
struct binding *domainbinding;
|
||||
{
|
||||
int fd;
|
||||
size_t size;
|
||||
#ifdef _LIBC
|
||||
struct stat64 st;
|
||||
#else
|
||||
struct stat st;
|
||||
#endif
|
||||
struct mo_file_header *data = (struct mo_file_header *) -1;
|
||||
int use_mmap = 0;
|
||||
struct loaded_domain *domain;
|
||||
const char *nullentry;
|
||||
|
||||
domain_file->decided = 1;
|
||||
domain_file->data = NULL;
|
||||
|
||||
/* Note that it would be useless to store domainbinding in domain_file
|
||||
because domainbinding might be == NULL now but != NULL later (after
|
||||
a call to bind_textdomain_codeset). */
|
||||
|
||||
/* If the record does not represent a valid locale the FILENAME
|
||||
might be NULL. This can happen when according to the given
|
||||
specification the locale file name is different for XPG and CEN
|
||||
syntax. */
|
||||
if (domain_file->filename == NULL)
|
||||
return;
|
||||
|
||||
/* Try to open the addressed file. */
|
||||
fd = open (domain_file->filename, O_RDONLY | O_BINARY);
|
||||
if (fd == -1)
|
||||
return;
|
||||
|
||||
/* We must know about the size of the file. */
|
||||
if (
|
||||
#ifdef _LIBC
|
||||
__builtin_expect (fstat64 (fd, &st) != 0, 0)
|
||||
#else
|
||||
__builtin_expect (fstat (fd, &st) != 0, 0)
|
||||
#endif
|
||||
|| __builtin_expect ((size = (size_t) st.st_size) != st.st_size, 0)
|
||||
|| __builtin_expect (size < sizeof (struct mo_file_header), 0))
|
||||
{
|
||||
/* Something went wrong. */
|
||||
close (fd);
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef HAVE_MMAP
|
||||
/* Now we are ready to load the file. If mmap() is available we try
|
||||
this first. If not available or it failed we try to load it. */
|
||||
data = (struct mo_file_header *) mmap (NULL, size, PROT_READ,
|
||||
MAP_PRIVATE, fd, 0);
|
||||
|
||||
if (__builtin_expect (data != (struct mo_file_header *) -1, 1))
|
||||
{
|
||||
/* mmap() call was successful. */
|
||||
close (fd);
|
||||
use_mmap = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* If the data is not yet available (i.e. mmap'ed) we try to load
|
||||
it manually. */
|
||||
if (data == (struct mo_file_header *) -1)
|
||||
{
|
||||
size_t to_read;
|
||||
char *read_ptr;
|
||||
|
||||
data = (struct mo_file_header *) malloc (size);
|
||||
if (data == NULL)
|
||||
return;
|
||||
|
||||
to_read = size;
|
||||
read_ptr = (char *) data;
|
||||
do
|
||||
{
|
||||
long int nb = (long int) read (fd, read_ptr, to_read);
|
||||
if (nb <= 0)
|
||||
{
|
||||
#ifdef EINTR
|
||||
if (nb == -1 && errno == EINTR)
|
||||
continue;
|
||||
#endif
|
||||
close (fd);
|
||||
return;
|
||||
}
|
||||
read_ptr += nb;
|
||||
to_read -= nb;
|
||||
}
|
||||
while (to_read > 0);
|
||||
|
||||
close (fd);
|
||||
}
|
||||
|
||||
/* Using the magic number we can test whether it really is a message
|
||||
catalog file. */
|
||||
if (__builtin_expect (data->magic != _MAGIC && data->magic != _MAGIC_SWAPPED,
|
||||
0))
|
||||
{
|
||||
/* The magic number is wrong: not a message catalog file. */
|
||||
#ifdef HAVE_MMAP
|
||||
if (use_mmap)
|
||||
munmap ((caddr_t) data, size);
|
||||
else
|
||||
#endif
|
||||
free (data);
|
||||
return;
|
||||
}
|
||||
|
||||
domain = (struct loaded_domain *) malloc (sizeof (struct loaded_domain));
|
||||
if (domain == NULL)
|
||||
return;
|
||||
domain_file->data = domain;
|
||||
|
||||
domain->data = (char *) data;
|
||||
domain->use_mmap = use_mmap;
|
||||
domain->mmap_size = size;
|
||||
domain->must_swap = data->magic != _MAGIC;
|
||||
|
||||
/* Fill in the information about the available tables. */
|
||||
switch (W (domain->must_swap, data->revision))
|
||||
{
|
||||
case 0:
|
||||
domain->nstrings = W (domain->must_swap, data->nstrings);
|
||||
domain->orig_tab = (struct string_desc *)
|
||||
((char *) data + W (domain->must_swap, data->orig_tab_offset));
|
||||
domain->trans_tab = (struct string_desc *)
|
||||
((char *) data + W (domain->must_swap, data->trans_tab_offset));
|
||||
domain->hash_size = W (domain->must_swap, data->hash_tab_size);
|
||||
domain->hash_tab = (nls_uint32 *)
|
||||
((char *) data + W (domain->must_swap, data->hash_tab_offset));
|
||||
break;
|
||||
default:
|
||||
/* This is an invalid revision. */
|
||||
#ifdef HAVE_MMAP
|
||||
if (use_mmap)
|
||||
munmap ((caddr_t) data, size);
|
||||
else
|
||||
#endif
|
||||
free (data);
|
||||
free (domain);
|
||||
domain_file->data = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Now initialize the character set converter from the character set
|
||||
the file is encoded with (found in the header entry) to the domain's
|
||||
specified character set or the locale's character set. */
|
||||
nullentry = _nl_init_domain_conv (domain_file, domain, domainbinding);
|
||||
|
||||
/* Also look for a plural specification. */
|
||||
if (nullentry != NULL)
|
||||
{
|
||||
const char *plural;
|
||||
const char *nplurals;
|
||||
|
||||
plural = strstr (nullentry, "plural=");
|
||||
nplurals = strstr (nullentry, "nplurals=");
|
||||
if (plural == NULL || nplurals == NULL)
|
||||
goto no_plural;
|
||||
else
|
||||
{
|
||||
/* First get the number. */
|
||||
char *endp;
|
||||
unsigned long int n;
|
||||
struct parse_args args;
|
||||
|
||||
nplurals += 9;
|
||||
while (*nplurals != '\0' && isspace (*nplurals))
|
||||
++nplurals;
|
||||
#if defined HAVE_STRTOUL || defined _LIBC
|
||||
n = strtoul (nplurals, &endp, 10);
|
||||
#else
|
||||
for (endp = nplurals, n = 0; *endp >= '0' && *endp <= '9'; endp++)
|
||||
n = n * 10 + (*endp - '0');
|
||||
#endif
|
||||
domain->nplurals = n;
|
||||
if (nplurals == endp)
|
||||
goto no_plural;
|
||||
|
||||
/* Due to the restrictions bison imposes onto the interface of the
|
||||
scanner function we have to put the input string and the result
|
||||
passed up from the parser into the same structure which address
|
||||
is passed down to the parser. */
|
||||
plural += 7;
|
||||
args.cp = plural;
|
||||
if (PLURAL_PARSE (&args) != 0)
|
||||
goto no_plural;
|
||||
domain->plural = args.res;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* By default we are using the Germanic form: singular form only
|
||||
for `one', the plural form otherwise. Yes, this is also what
|
||||
English is using since English is a Germanic language. */
|
||||
no_plural:
|
||||
INIT_GERMANIC_PLURAL ();
|
||||
domain->plural = &germanic_plural;
|
||||
domain->nplurals = 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef _LIBC
|
||||
void
|
||||
internal_function
|
||||
_nl_unload_domain (domain)
|
||||
struct loaded_domain *domain;
|
||||
{
|
||||
if (domain->plural != &germanic_plural)
|
||||
__gettext_free_exp (domain->plural);
|
||||
|
||||
_nl_free_domain_conv (domain);
|
||||
|
||||
# ifdef _POSIX_MAPPED_FILES
|
||||
if (domain->use_mmap)
|
||||
munmap ((caddr_t) domain->data, domain->mmap_size);
|
||||
else
|
||||
# endif /* _POSIX_MAPPED_FILES */
|
||||
free ((void *) domain->data);
|
||||
|
||||
free (domain);
|
||||
}
|
||||
#endif
|
||||
@@ -1,271 +0,0 @@
|
||||
/* Determine a canonical name for the current locale's character encoding.
|
||||
|
||||
Copyright (C) 2000-2001 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA. */
|
||||
|
||||
/* Written by Bruno Haible <[email protected]>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_STDDEF_H
|
||||
# include <stddef.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#if HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#else
|
||||
# include <strings.h>
|
||||
#endif
|
||||
#if HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#if defined _WIN32 || defined __WIN32__
|
||||
# undef WIN32 /* avoid warning on mingw32 */
|
||||
# define WIN32
|
||||
#endif
|
||||
|
||||
#ifndef WIN32
|
||||
# if HAVE_LANGINFO_CODESET
|
||||
# include <langinfo.h>
|
||||
# else
|
||||
# if HAVE_SETLOCALE
|
||||
# include <locale.h>
|
||||
# endif
|
||||
# endif
|
||||
#else /* WIN32 */
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
#ifndef DIRECTORY_SEPARATOR
|
||||
# define DIRECTORY_SEPARATOR '/'
|
||||
#endif
|
||||
|
||||
#ifndef ISSLASH
|
||||
# define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR)
|
||||
#endif
|
||||
|
||||
/* The following static variable is declared 'volatile' to avoid a
|
||||
possible multithread problem in the function get_charset_aliases. If we
|
||||
are running in a threaded environment, and if two threads initialize
|
||||
'charset_aliases' simultaneously, both will produce the same value,
|
||||
and everything will be ok if the two assignments to 'charset_aliases'
|
||||
are atomic. But I don't know what will happen if the two assignments mix. */
|
||||
#if __STDC__ != 1
|
||||
# define volatile /* empty */
|
||||
#endif
|
||||
/* Pointer to the contents of the charset.alias file, if it has already been
|
||||
read, else NULL. Its format is:
|
||||
ALIAS_1 '\0' CANONICAL_1 '\0' ... ALIAS_n '\0' CANONICAL_n '\0' '\0' */
|
||||
static const char * volatile charset_aliases;
|
||||
|
||||
/* Return a pointer to the contents of the charset.alias file. */
|
||||
static const char *
|
||||
get_charset_aliases ()
|
||||
{
|
||||
const char *cp;
|
||||
|
||||
cp = charset_aliases;
|
||||
if (cp == NULL)
|
||||
{
|
||||
#ifndef WIN32
|
||||
FILE *fp;
|
||||
const char *dir = LIBDIR;
|
||||
const char *base = "charset.alias";
|
||||
char *file_name;
|
||||
|
||||
/* Concatenate dir and base into freshly allocated file_name. */
|
||||
{
|
||||
size_t dir_len = strlen (dir);
|
||||
size_t base_len = strlen (base);
|
||||
int add_slash = (dir_len > 0 && !ISSLASH (dir[dir_len - 1]));
|
||||
file_name = (char *) malloc (dir_len + add_slash + base_len + 1);
|
||||
if (file_name != NULL)
|
||||
{
|
||||
memcpy (file_name, dir, dir_len);
|
||||
if (add_slash)
|
||||
file_name[dir_len] = DIRECTORY_SEPARATOR;
|
||||
memcpy (file_name + dir_len + add_slash, base, base_len + 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (file_name == NULL || (fp = fopen (file_name, "r")) == NULL)
|
||||
/* Out of memory or file not found, treat it as empty. */
|
||||
cp = "";
|
||||
else
|
||||
{
|
||||
/* Parse the file's contents. */
|
||||
int c;
|
||||
char buf1[50+1];
|
||||
char buf2[50+1];
|
||||
char *res_ptr = NULL;
|
||||
size_t res_size = 0;
|
||||
size_t l1, l2;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
c = getc (fp);
|
||||
if (c == EOF)
|
||||
break;
|
||||
if (c == '\n' || c == ' ' || c == '\t')
|
||||
continue;
|
||||
if (c == '#')
|
||||
{
|
||||
/* Skip comment, to end of line. */
|
||||
do
|
||||
c = getc (fp);
|
||||
while (!(c == EOF || c == '\n'));
|
||||
if (c == EOF)
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
ungetc (c, fp);
|
||||
if (fscanf(fp, "%50s %50s", buf1, buf2) < 2)
|
||||
break;
|
||||
l1 = strlen (buf1);
|
||||
l2 = strlen (buf2);
|
||||
if (res_size == 0)
|
||||
{
|
||||
res_size = l1 + 1 + l2 + 1;
|
||||
res_ptr = malloc (res_size + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
res_size += l1 + 1 + l2 + 1;
|
||||
res_ptr = realloc (res_ptr, res_size + 1);
|
||||
}
|
||||
if (res_ptr == NULL)
|
||||
{
|
||||
/* Out of memory. */
|
||||
res_size = 0;
|
||||
break;
|
||||
}
|
||||
strcpy (res_ptr + res_size - (l2 + 1) - (l1 + 1), buf1);
|
||||
strcpy (res_ptr + res_size - (l2 + 1), buf2);
|
||||
}
|
||||
fclose (fp);
|
||||
if (res_size == 0)
|
||||
cp = "";
|
||||
else
|
||||
{
|
||||
*(res_ptr + res_size) = '\0';
|
||||
cp = res_ptr;
|
||||
}
|
||||
}
|
||||
|
||||
if (file_name != NULL)
|
||||
free (file_name);
|
||||
|
||||
#else /* WIN32 */
|
||||
|
||||
/* To avoid the troubles of installing a separate file in the same
|
||||
directory as the DLL and of retrieving the DLL's directory at
|
||||
runtime, simply inline the aliases here. */
|
||||
|
||||
cp = "CP936" "\0" "GBK" "\0"
|
||||
"CP1361" "\0" "JOHAB" "\0";
|
||||
#endif
|
||||
|
||||
charset_aliases = cp;
|
||||
}
|
||||
|
||||
return cp;
|
||||
}
|
||||
|
||||
/* Determine the current locale's character encoding, and canonicalize it
|
||||
into one of the canonical names listed in config.charset.
|
||||
The result must not be freed; it is statically allocated.
|
||||
If the canonical name cannot be determined, the result is a non-canonical
|
||||
name. */
|
||||
|
||||
#ifdef STATIC
|
||||
STATIC
|
||||
#endif
|
||||
const char *
|
||||
locale_charset ()
|
||||
{
|
||||
const char *codeset;
|
||||
const char *aliases;
|
||||
|
||||
#ifndef WIN32
|
||||
|
||||
# if HAVE_LANGINFO_CODESET
|
||||
|
||||
/* Most systems support nl_langinfo (CODESET) nowadays. */
|
||||
codeset = nl_langinfo (CODESET);
|
||||
|
||||
# else
|
||||
|
||||
/* On old systems which lack it, use setlocale or getenv. */
|
||||
const char *locale = NULL;
|
||||
|
||||
/* But most old systems don't have a complete set of locales. Some
|
||||
(like SunOS 4 or DJGPP) have only the C locale. Therefore we don't
|
||||
use setlocale here; it would return "C" when it doesn't support the
|
||||
locale name the user has set. */
|
||||
# if HAVE_SETLOCALE && 0
|
||||
locale = setlocale (LC_CTYPE, NULL);
|
||||
# endif
|
||||
if (locale == NULL || locale[0] == '\0')
|
||||
{
|
||||
locale = getenv ("LC_ALL");
|
||||
if (locale == NULL || locale[0] == '\0')
|
||||
{
|
||||
locale = getenv ("LC_CTYPE");
|
||||
if (locale == NULL || locale[0] == '\0')
|
||||
locale = getenv ("LANG");
|
||||
}
|
||||
}
|
||||
|
||||
/* On some old systems, one used to set locale = "iso8859_1". On others,
|
||||
you set it to "language_COUNTRY.charset". In any case, we resolve it
|
||||
through the charset.alias file. */
|
||||
codeset = locale;
|
||||
|
||||
# endif
|
||||
|
||||
#else /* WIN32 */
|
||||
|
||||
static char buf[2 + 10 + 1];
|
||||
|
||||
/* Win32 has a function returning the locale's codepage as a number. */
|
||||
sprintf (buf, "CP%u", GetACP ());
|
||||
codeset = buf;
|
||||
|
||||
#endif
|
||||
|
||||
if (codeset == NULL)
|
||||
/* The canonical name cannot be determined. */
|
||||
codeset = "";
|
||||
|
||||
/* Resolve alias. */
|
||||
for (aliases = get_charset_aliases ();
|
||||
*aliases != '\0';
|
||||
aliases += strlen (aliases) + 1, aliases += strlen (aliases) + 1)
|
||||
if (strcmp (codeset, aliases) == 0
|
||||
|| (aliases[0] == '*' && aliases[1] == '\0'))
|
||||
{
|
||||
codeset = aliases + strlen (aliases) + 1;
|
||||
break;
|
||||
}
|
||||
|
||||
return codeset;
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
# Locale name alias data base.
|
||||
# Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Library 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
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
# USA.
|
||||
|
||||
# The format of this file is the same as for the corresponding file of
|
||||
# the X Window System, which normally can be found in
|
||||
# /usr/lib/X11/locale/locale.alias
|
||||
# A single line contains two fields: an alias and a substitution value.
|
||||
# All entries are case independent.
|
||||
|
||||
# Note: This file is far from being complete. If you have a value for
|
||||
# your own site which you think might be useful for others too, share
|
||||
# it with the rest of us. Send it using the `glibcbug' script to
|
||||
# [email protected].
|
||||
|
||||
# Packages using this file:
|
||||
|
||||
bokmal no_NO.ISO-8859-1
|
||||
bokmål no_NO.ISO-8859-1
|
||||
catalan ca_ES.ISO-8859-1
|
||||
croatian hr_HR.ISO-8859-2
|
||||
czech cs_CZ.ISO-8859-2
|
||||
danish da_DK.ISO-8859-1
|
||||
dansk da_DK.ISO-8859-1
|
||||
deutsch de_DE.ISO-8859-1
|
||||
dutch nl_NL.ISO-8859-1
|
||||
eesti et_EE.ISO-8859-1
|
||||
estonian et_EE.ISO-8859-1
|
||||
finnish fi_FI.ISO-8859-1
|
||||
français fr_FR.ISO-8859-1
|
||||
french fr_FR.ISO-8859-1
|
||||
galego gl_ES.ISO-8859-1
|
||||
galician gl_ES.ISO-8859-1
|
||||
german de_DE.ISO-8859-1
|
||||
greek el_GR.ISO-8859-7
|
||||
hebrew he_IL.ISO-8859-8
|
||||
hrvatski hr_HR.ISO-8859-2
|
||||
hungarian hu_HU.ISO-8859-2
|
||||
icelandic is_IS.ISO-8859-1
|
||||
italian it_IT.ISO-8859-1
|
||||
japanese ja_JP.eucJP
|
||||
japanese.euc ja_JP.eucJP
|
||||
ja_JP ja_JP.eucJP
|
||||
ja_JP.ujis ja_JP.eucJP
|
||||
japanese.sjis ja_JP.SJIS
|
||||
korean ko_KR.eucKR
|
||||
korean.euc ko_KR.eucKR
|
||||
ko_KR ko_KR.eucKR
|
||||
lithuanian lt_LT.ISO-8859-13
|
||||
nb_NO no_NO.ISO-8859-1
|
||||
nb_NO.ISO-8859-1 no_NO.ISO-8859-1
|
||||
norwegian no_NO.ISO-8859-1
|
||||
nynorsk nn_NO.ISO-8859-1
|
||||
polish pl_PL.ISO-8859-2
|
||||
portuguese pt_PT.ISO-8859-1
|
||||
romanian ro_RO.ISO-8859-2
|
||||
russian ru_RU.ISO-8859-5
|
||||
slovak sk_SK.ISO-8859-2
|
||||
slovene sl_SI.ISO-8859-2
|
||||
slovenian sl_SI.ISO-8859-2
|
||||
spanish es_ES.ISO-8859-1
|
||||
swedish sv_SE.ISO-8859-1
|
||||
thai th_TH.TIS-620
|
||||
turkish tr_TR.ISO-8859-9
|
||||
@@ -1,404 +0,0 @@
|
||||
/* Handle aliases for locale names.
|
||||
Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA. */
|
||||
|
||||
/* Tell glibc's <string.h> to provide a prototype for mempcpy().
|
||||
This must come before <config.h> because <config.h> may include
|
||||
<features.h>, and once <features.h> has been included, it's too late. */
|
||||
#ifndef _GNU_SOURCE
|
||||
# define _GNU_SOURCE 1
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
# define alloca __builtin_alloca
|
||||
# define HAVE_ALLOCA 1
|
||||
#else
|
||||
# if defined HAVE_ALLOCA_H || defined _LIBC
|
||||
# include <alloca.h>
|
||||
# else
|
||||
# ifdef _AIX
|
||||
#pragma alloca
|
||||
# else
|
||||
# ifndef alloca
|
||||
char *alloca ();
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <string.h>
|
||||
#if !HAVE_STRCHR && !defined _LIBC
|
||||
# ifndef strchr
|
||||
# define strchr index
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include "gettextP.h"
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
#ifdef _LIBC
|
||||
/* Rename the non ANSI C functions. This is required by the standard
|
||||
because some ANSI C functions will require linking with this object
|
||||
file and the name space must not be polluted. */
|
||||
# define strcasecmp __strcasecmp
|
||||
|
||||
# ifndef mempcpy
|
||||
# define mempcpy __mempcpy
|
||||
# endif
|
||||
# define HAVE_MEMPCPY 1
|
||||
|
||||
/* We need locking here since we can be called from different places. */
|
||||
# include <bits/libc-lock.h>
|
||||
|
||||
__libc_lock_define_initialized (static, lock);
|
||||
#endif
|
||||
|
||||
#ifndef internal_function
|
||||
# define internal_function
|
||||
#endif
|
||||
|
||||
/* For those losing systems which don't have `alloca' we have to add
|
||||
some additional code emulating it. */
|
||||
#ifdef HAVE_ALLOCA
|
||||
# define freea(p) /* nothing */
|
||||
#else
|
||||
# define alloca(n) malloc (n)
|
||||
# define freea(p) free (p)
|
||||
#endif
|
||||
|
||||
#if defined _LIBC_REENTRANT || defined HAVE_FGETS_UNLOCKED
|
||||
# undef fgets
|
||||
# define fgets(buf, len, s) fgets_unlocked (buf, len, s)
|
||||
#endif
|
||||
#if defined _LIBC_REENTRANT || defined HAVE_FEOF_UNLOCKED
|
||||
# undef feof
|
||||
# define feof(s) feof_unlocked (s)
|
||||
#endif
|
||||
|
||||
|
||||
struct alias_map
|
||||
{
|
||||
const char *alias;
|
||||
const char *value;
|
||||
};
|
||||
|
||||
|
||||
static char *string_space;
|
||||
static size_t string_space_act;
|
||||
static size_t string_space_max;
|
||||
static struct alias_map *map;
|
||||
static size_t nmap;
|
||||
static size_t maxmap;
|
||||
|
||||
|
||||
/* Prototypes for local functions. */
|
||||
static size_t read_alias_file PARAMS ((const char *fname, int fname_len))
|
||||
internal_function;
|
||||
static int extend_alias_table PARAMS ((void));
|
||||
static int alias_compare PARAMS ((const struct alias_map *map1,
|
||||
const struct alias_map *map2));
|
||||
|
||||
|
||||
const char *
|
||||
_nl_expand_alias (name)
|
||||
const char *name;
|
||||
{
|
||||
static const char *locale_alias_path = LOCALE_ALIAS_PATH;
|
||||
struct alias_map *retval;
|
||||
const char *result = NULL;
|
||||
size_t added;
|
||||
|
||||
#ifdef _LIBC
|
||||
__libc_lock_lock (lock);
|
||||
#endif
|
||||
|
||||
do
|
||||
{
|
||||
struct alias_map item;
|
||||
|
||||
item.alias = name;
|
||||
|
||||
if (nmap > 0)
|
||||
retval = (struct alias_map *) bsearch (&item, map, nmap,
|
||||
sizeof (struct alias_map),
|
||||
(int (*) PARAMS ((const void *,
|
||||
const void *))
|
||||
) alias_compare);
|
||||
else
|
||||
retval = NULL;
|
||||
|
||||
/* We really found an alias. Return the value. */
|
||||
if (retval != NULL)
|
||||
{
|
||||
result = retval->value;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Perhaps we can find another alias file. */
|
||||
added = 0;
|
||||
while (added == 0 && locale_alias_path[0] != '\0')
|
||||
{
|
||||
const char *start;
|
||||
|
||||
while (locale_alias_path[0] == PATH_SEPARATOR)
|
||||
++locale_alias_path;
|
||||
start = locale_alias_path;
|
||||
|
||||
while (locale_alias_path[0] != '\0'
|
||||
&& locale_alias_path[0] != PATH_SEPARATOR)
|
||||
++locale_alias_path;
|
||||
|
||||
if (start < locale_alias_path)
|
||||
added = read_alias_file (start, locale_alias_path - start);
|
||||
}
|
||||
}
|
||||
while (added != 0);
|
||||
|
||||
#ifdef _LIBC
|
||||
__libc_lock_unlock (lock);
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
static size_t
|
||||
internal_function
|
||||
read_alias_file (fname, fname_len)
|
||||
const char *fname;
|
||||
int fname_len;
|
||||
{
|
||||
FILE *fp;
|
||||
char *full_fname;
|
||||
size_t added;
|
||||
static const char aliasfile[] = "/locale.alias";
|
||||
|
||||
full_fname = (char *) alloca (fname_len + sizeof aliasfile);
|
||||
#ifdef HAVE_MEMPCPY
|
||||
mempcpy (mempcpy (full_fname, fname, fname_len),
|
||||
aliasfile, sizeof aliasfile);
|
||||
#else
|
||||
memcpy (full_fname, fname, fname_len);
|
||||
memcpy (&full_fname[fname_len], aliasfile, sizeof aliasfile);
|
||||
#endif
|
||||
|
||||
fp = fopen (full_fname, "r");
|
||||
freea (full_fname);
|
||||
if (fp == NULL)
|
||||
return 0;
|
||||
|
||||
added = 0;
|
||||
while (!feof (fp))
|
||||
{
|
||||
/* It is a reasonable approach to use a fix buffer here because
|
||||
a) we are only interested in the first two fields
|
||||
b) these fields must be usable as file names and so must not
|
||||
be that long
|
||||
*/
|
||||
char buf[BUFSIZ];
|
||||
char *alias;
|
||||
char *value;
|
||||
char *cp;
|
||||
|
||||
if (fgets (buf, sizeof buf, fp) == NULL)
|
||||
/* EOF reached. */
|
||||
break;
|
||||
|
||||
/* Possibly not the whole line fits into the buffer. Ignore
|
||||
the rest of the line. */
|
||||
if (strchr (buf, '\n') == NULL)
|
||||
{
|
||||
char altbuf[BUFSIZ];
|
||||
do
|
||||
if (fgets (altbuf, sizeof altbuf, fp) == NULL)
|
||||
/* Make sure the inner loop will be left. The outer loop
|
||||
will exit at the `feof' test. */
|
||||
break;
|
||||
while (strchr (altbuf, '\n') == NULL);
|
||||
}
|
||||
|
||||
cp = buf;
|
||||
/* Ignore leading white space. */
|
||||
while (isspace (cp[0]))
|
||||
++cp;
|
||||
|
||||
/* A leading '#' signals a comment line. */
|
||||
if (cp[0] != '\0' && cp[0] != '#')
|
||||
{
|
||||
alias = cp++;
|
||||
while (cp[0] != '\0' && !isspace (cp[0]))
|
||||
++cp;
|
||||
/* Terminate alias name. */
|
||||
if (cp[0] != '\0')
|
||||
*cp++ = '\0';
|
||||
|
||||
/* Now look for the beginning of the value. */
|
||||
while (isspace (cp[0]))
|
||||
++cp;
|
||||
|
||||
if (cp[0] != '\0')
|
||||
{
|
||||
size_t alias_len;
|
||||
size_t value_len;
|
||||
|
||||
value = cp++;
|
||||
while (cp[0] != '\0' && !isspace (cp[0]))
|
||||
++cp;
|
||||
/* Terminate value. */
|
||||
if (cp[0] == '\n')
|
||||
{
|
||||
/* This has to be done to make the following test
|
||||
for the end of line possible. We are looking for
|
||||
the terminating '\n' which do not overwrite here. */
|
||||
*cp++ = '\0';
|
||||
*cp = '\n';
|
||||
}
|
||||
else if (cp[0] != '\0')
|
||||
*cp++ = '\0';
|
||||
|
||||
if (nmap >= maxmap)
|
||||
if (__builtin_expect (extend_alias_table (), 0))
|
||||
return added;
|
||||
|
||||
alias_len = strlen (alias) + 1;
|
||||
value_len = strlen (value) + 1;
|
||||
|
||||
if (string_space_act + alias_len + value_len > string_space_max)
|
||||
{
|
||||
/* Increase size of memory pool. */
|
||||
size_t new_size = (string_space_max
|
||||
+ (alias_len + value_len > 1024
|
||||
? alias_len + value_len : 1024));
|
||||
char *new_pool = (char *) realloc (string_space, new_size);
|
||||
if (new_pool == NULL)
|
||||
return added;
|
||||
|
||||
if (__builtin_expect (string_space != new_pool, 0))
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < nmap; i++)
|
||||
{
|
||||
map[i].alias += new_pool - string_space;
|
||||
map[i].value += new_pool - string_space;
|
||||
}
|
||||
}
|
||||
|
||||
string_space = new_pool;
|
||||
string_space_max = new_size;
|
||||
}
|
||||
|
||||
map[nmap].alias = memcpy (&string_space[string_space_act],
|
||||
alias, alias_len);
|
||||
string_space_act += alias_len;
|
||||
|
||||
map[nmap].value = memcpy (&string_space[string_space_act],
|
||||
value, value_len);
|
||||
string_space_act += value_len;
|
||||
|
||||
++nmap;
|
||||
++added;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Should we test for ferror()? I think we have to silently ignore
|
||||
errors. --drepper */
|
||||
fclose (fp);
|
||||
|
||||
if (added > 0)
|
||||
qsort (map, nmap, sizeof (struct alias_map),
|
||||
(int (*) PARAMS ((const void *, const void *))) alias_compare);
|
||||
|
||||
return added;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
extend_alias_table ()
|
||||
{
|
||||
size_t new_size;
|
||||
struct alias_map *new_map;
|
||||
|
||||
new_size = maxmap == 0 ? 100 : 2 * maxmap;
|
||||
new_map = (struct alias_map *) realloc (map, (new_size
|
||||
* sizeof (struct alias_map)));
|
||||
if (new_map == NULL)
|
||||
/* Simply don't extend: we don't have any more core. */
|
||||
return -1;
|
||||
|
||||
map = new_map;
|
||||
maxmap = new_size;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#ifdef _LIBC
|
||||
static void __attribute__ ((unused))
|
||||
free_mem (void)
|
||||
{
|
||||
if (string_space != NULL)
|
||||
free (string_space);
|
||||
if (map != NULL)
|
||||
free (map);
|
||||
}
|
||||
text_set_element (__libc_subfreeres, free_mem);
|
||||
#endif
|
||||
|
||||
|
||||
static int
|
||||
alias_compare (map1, map2)
|
||||
const struct alias_map *map1;
|
||||
const struct alias_map *map2;
|
||||
{
|
||||
#if defined _LIBC || defined HAVE_STRCASECMP
|
||||
return strcasecmp (map1->alias, map2->alias);
|
||||
#else
|
||||
const unsigned char *p1 = (const unsigned char *) map1->alias;
|
||||
const unsigned char *p2 = (const unsigned char *) map2->alias;
|
||||
unsigned char c1, c2;
|
||||
|
||||
if (p1 == p2)
|
||||
return 0;
|
||||
|
||||
do
|
||||
{
|
||||
/* I know this seems to be odd but the tolower() function in
|
||||
some systems libc cannot handle nonalpha characters. */
|
||||
c1 = isupper (*p1) ? tolower (*p1) : *p1;
|
||||
c2 = isupper (*p2) ? tolower (*p2) : *p2;
|
||||
if (c1 == '\0')
|
||||
break;
|
||||
++p1;
|
||||
++p2;
|
||||
}
|
||||
while (c1 == c2);
|
||||
|
||||
return c1 - c2;
|
||||
#endif
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
/* Implementation of ngettext(3) function.
|
||||
Copyright (C) 1995, 1997, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef _LIBC
|
||||
# define __need_NULL
|
||||
# include <stddef.h>
|
||||
#else
|
||||
# include <stdlib.h> /* Just for NULL. */
|
||||
#endif
|
||||
|
||||
#include "gettextP.h"
|
||||
#ifdef _LIBC
|
||||
# include <libintl.h>
|
||||
#else
|
||||
# include "libgnuintl.h"
|
||||
#endif
|
||||
|
||||
#include <locale.h>
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
/* Names for the libintl functions are a problem. They must not clash
|
||||
with existing names and they should follow ANSI C. But this source
|
||||
code is also used in GNU C Library where the names have a __
|
||||
prefix. So we have to make a difference here. */
|
||||
#ifdef _LIBC
|
||||
# define NGETTEXT __ngettext
|
||||
# define DCNGETTEXT __dcngettext
|
||||
#else
|
||||
# define NGETTEXT ngettext__
|
||||
# define DCNGETTEXT dcngettext__
|
||||
#endif
|
||||
|
||||
/* Look up MSGID in the current default message catalog for the current
|
||||
LC_MESSAGES locale. If not found, returns MSGID itself (the default
|
||||
text). */
|
||||
char *
|
||||
NGETTEXT (msgid1, msgid2, n)
|
||||
const char *msgid1;
|
||||
const char *msgid2;
|
||||
unsigned long int n;
|
||||
{
|
||||
return DCNGETTEXT (NULL, msgid1, msgid2, n, LC_MESSAGES);
|
||||
}
|
||||
|
||||
#ifdef _LIBC
|
||||
/* Alias for function name in GNU C Library. */
|
||||
weak_alias (__ngettext, ngettext);
|
||||
#endif
|
||||
-1326
File diff suppressed because it is too large
Load Diff
-413
@@ -1,413 +0,0 @@
|
||||
%{
|
||||
/* Expression parsing for plural form selection.
|
||||
Copyright (C) 2000, 2001 Free Software Foundation, Inc.
|
||||
Written by Ulrich Drepper <[email protected]>, 2000.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA. */
|
||||
|
||||
/* The bison generated parser uses alloca. AIX 3 forces us to put this
|
||||
declaration at the beginning of the file. The declaration in bison's
|
||||
skeleton file comes too late. This must come before <config.h>
|
||||
because <config.h> may include arbitrary system headers. */
|
||||
#if defined _AIX && !defined __GNUC__
|
||||
#pragma alloca
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "gettextP.h"
|
||||
|
||||
/* Names for the libintl functions are a problem. They must not clash
|
||||
with existing names and they should follow ANSI C. But this source
|
||||
code is also used in GNU C Library where the names have a __
|
||||
prefix. So we have to make a difference here. */
|
||||
#ifdef _LIBC
|
||||
# define FREE_EXPRESSION __gettext_free_exp
|
||||
#else
|
||||
# define FREE_EXPRESSION gettext_free_exp__
|
||||
# define __gettextparse gettextparse__
|
||||
#endif
|
||||
|
||||
#define YYLEX_PARAM &((struct parse_args *) arg)->cp
|
||||
#define YYPARSE_PARAM arg
|
||||
%}
|
||||
%pure_parser
|
||||
%expect 10
|
||||
|
||||
%union {
|
||||
unsigned long int num;
|
||||
enum operator op;
|
||||
struct expression *exp;
|
||||
}
|
||||
|
||||
%{
|
||||
/* Prototypes for local functions. */
|
||||
static struct expression *new_exp PARAMS ((int nargs, enum operator op,
|
||||
struct expression * const *args));
|
||||
static inline struct expression *new_exp_0 PARAMS ((enum operator op));
|
||||
static inline struct expression *new_exp_1 PARAMS ((enum operator op,
|
||||
struct expression *right));
|
||||
static struct expression *new_exp_2 PARAMS ((enum operator op,
|
||||
struct expression *left,
|
||||
struct expression *right));
|
||||
static inline struct expression *new_exp_3 PARAMS ((enum operator op,
|
||||
struct expression *bexp,
|
||||
struct expression *tbranch,
|
||||
struct expression *fbranch));
|
||||
static int yylex PARAMS ((YYSTYPE *lval, const char **pexp));
|
||||
static void yyerror PARAMS ((const char *str));
|
||||
|
||||
/* Allocation of expressions. */
|
||||
|
||||
static struct expression *
|
||||
new_exp (nargs, op, args)
|
||||
int nargs;
|
||||
enum operator op;
|
||||
struct expression * const *args;
|
||||
{
|
||||
int i;
|
||||
struct expression *newp;
|
||||
|
||||
/* If any of the argument could not be malloc'ed, just return NULL. */
|
||||
for (i = nargs - 1; i >= 0; i--)
|
||||
if (args[i] == NULL)
|
||||
goto fail;
|
||||
|
||||
/* Allocate a new expression. */
|
||||
newp = (struct expression *) malloc (sizeof (*newp));
|
||||
if (newp != NULL)
|
||||
{
|
||||
newp->nargs = nargs;
|
||||
newp->operation = op;
|
||||
for (i = nargs - 1; i >= 0; i--)
|
||||
newp->val.args[i] = args[i];
|
||||
return newp;
|
||||
}
|
||||
|
||||
fail:
|
||||
for (i = nargs - 1; i >= 0; i--)
|
||||
FREE_EXPRESSION (args[i]);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline struct expression *
|
||||
new_exp_0 (op)
|
||||
enum operator op;
|
||||
{
|
||||
return new_exp (0, op, NULL);
|
||||
}
|
||||
|
||||
static inline struct expression *
|
||||
new_exp_1 (op, right)
|
||||
enum operator op;
|
||||
struct expression *right;
|
||||
{
|
||||
struct expression *args[1];
|
||||
|
||||
args[0] = right;
|
||||
return new_exp (1, op, args);
|
||||
}
|
||||
|
||||
static struct expression *
|
||||
new_exp_2 (op, left, right)
|
||||
enum operator op;
|
||||
struct expression *left;
|
||||
struct expression *right;
|
||||
{
|
||||
struct expression *args[2];
|
||||
|
||||
args[0] = left;
|
||||
args[1] = right;
|
||||
return new_exp (2, op, args);
|
||||
}
|
||||
|
||||
static inline struct expression *
|
||||
new_exp_3 (op, bexp, tbranch, fbranch)
|
||||
enum operator op;
|
||||
struct expression *bexp;
|
||||
struct expression *tbranch;
|
||||
struct expression *fbranch;
|
||||
{
|
||||
struct expression *args[3];
|
||||
|
||||
args[0] = bexp;
|
||||
args[1] = tbranch;
|
||||
args[2] = fbranch;
|
||||
return new_exp (3, op, args);
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
/* This declares that all operators have the same associativity and the
|
||||
precedence order as in C. See [Harbison, Steele: C, A Reference Manual].
|
||||
There is no unary minus and no bitwise operators.
|
||||
Operators with the same syntactic behaviour have been merged into a single
|
||||
token, to save space in the array generated by bison. */
|
||||
%right '?' /* ? */
|
||||
%left '|' /* || */
|
||||
%left '&' /* && */
|
||||
%left EQUOP2 /* == != */
|
||||
%left CMPOP2 /* < > <= >= */
|
||||
%left ADDOP2 /* + - */
|
||||
%left MULOP2 /* * / % */
|
||||
%right '!' /* ! */
|
||||
|
||||
%token <op> EQUOP2 CMPOP2 ADDOP2 MULOP2
|
||||
%token <num> NUMBER
|
||||
%type <exp> exp
|
||||
|
||||
%%
|
||||
|
||||
start: exp
|
||||
{
|
||||
if ($1 == NULL)
|
||||
YYABORT;
|
||||
((struct parse_args *) arg)->res = $1;
|
||||
}
|
||||
;
|
||||
|
||||
exp: exp '?' exp ':' exp
|
||||
{
|
||||
$$ = new_exp_3 (qmop, $1, $3, $5);
|
||||
}
|
||||
| exp '|' exp
|
||||
{
|
||||
$$ = new_exp_2 (lor, $1, $3);
|
||||
}
|
||||
| exp '&' exp
|
||||
{
|
||||
$$ = new_exp_2 (land, $1, $3);
|
||||
}
|
||||
| exp EQUOP2 exp
|
||||
{
|
||||
$$ = new_exp_2 ($2, $1, $3);
|
||||
}
|
||||
| exp CMPOP2 exp
|
||||
{
|
||||
$$ = new_exp_2 ($2, $1, $3);
|
||||
}
|
||||
| exp ADDOP2 exp
|
||||
{
|
||||
$$ = new_exp_2 ($2, $1, $3);
|
||||
}
|
||||
| exp MULOP2 exp
|
||||
{
|
||||
$$ = new_exp_2 ($2, $1, $3);
|
||||
}
|
||||
| '!' exp
|
||||
{
|
||||
$$ = new_exp_1 (lnot, $2);
|
||||
}
|
||||
| 'n'
|
||||
{
|
||||
$$ = new_exp_0 (var);
|
||||
}
|
||||
| NUMBER
|
||||
{
|
||||
if (($$ = new_exp_0 (num)) != NULL)
|
||||
$$->val.num = $1;
|
||||
}
|
||||
| '(' exp ')'
|
||||
{
|
||||
$$ = $2;
|
||||
}
|
||||
;
|
||||
|
||||
%%
|
||||
|
||||
void
|
||||
internal_function
|
||||
FREE_EXPRESSION (exp)
|
||||
struct expression *exp;
|
||||
{
|
||||
if (exp == NULL)
|
||||
return;
|
||||
|
||||
/* Handle the recursive case. */
|
||||
switch (exp->nargs)
|
||||
{
|
||||
case 3:
|
||||
FREE_EXPRESSION (exp->val.args[2]);
|
||||
/* FALLTHROUGH */
|
||||
case 2:
|
||||
FREE_EXPRESSION (exp->val.args[1]);
|
||||
/* FALLTHROUGH */
|
||||
case 1:
|
||||
FREE_EXPRESSION (exp->val.args[0]);
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
free (exp);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
yylex (lval, pexp)
|
||||
YYSTYPE *lval;
|
||||
const char **pexp;
|
||||
{
|
||||
const char *exp = *pexp;
|
||||
int result;
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (exp[0] == '\0')
|
||||
{
|
||||
*pexp = exp;
|
||||
return YYEOF;
|
||||
}
|
||||
|
||||
if (exp[0] != ' ' && exp[0] != '\t')
|
||||
break;
|
||||
|
||||
++exp;
|
||||
}
|
||||
|
||||
result = *exp++;
|
||||
switch (result)
|
||||
{
|
||||
case '0': case '1': case '2': case '3': case '4':
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
{
|
||||
unsigned long int n = result - '0';
|
||||
while (exp[0] >= '0' && exp[0] <= '9')
|
||||
{
|
||||
n *= 10;
|
||||
n += exp[0] - '0';
|
||||
++exp;
|
||||
}
|
||||
lval->num = n;
|
||||
result = NUMBER;
|
||||
}
|
||||
break;
|
||||
|
||||
case '=':
|
||||
if (exp[0] == '=')
|
||||
{
|
||||
++exp;
|
||||
lval->op = equal;
|
||||
result = EQUOP2;
|
||||
}
|
||||
else
|
||||
result = YYERRCODE;
|
||||
break;
|
||||
|
||||
case '!':
|
||||
if (exp[0] == '=')
|
||||
{
|
||||
++exp;
|
||||
lval->op = not_equal;
|
||||
result = EQUOP2;
|
||||
}
|
||||
break;
|
||||
|
||||
case '&':
|
||||
case '|':
|
||||
if (exp[0] == result)
|
||||
++exp;
|
||||
else
|
||||
result = YYERRCODE;
|
||||
break;
|
||||
|
||||
case '<':
|
||||
if (exp[0] == '=')
|
||||
{
|
||||
++exp;
|
||||
lval->op = less_or_equal;
|
||||
}
|
||||
else
|
||||
lval->op = less_than;
|
||||
result = CMPOP2;
|
||||
break;
|
||||
|
||||
case '>':
|
||||
if (exp[0] == '=')
|
||||
{
|
||||
++exp;
|
||||
lval->op = greater_or_equal;
|
||||
}
|
||||
else
|
||||
lval->op = greater_than;
|
||||
result = CMPOP2;
|
||||
break;
|
||||
|
||||
case '*':
|
||||
lval->op = mult;
|
||||
result = MULOP2;
|
||||
break;
|
||||
|
||||
case '/':
|
||||
lval->op = divide;
|
||||
result = MULOP2;
|
||||
break;
|
||||
|
||||
case '%':
|
||||
lval->op = module;
|
||||
result = MULOP2;
|
||||
break;
|
||||
|
||||
case '+':
|
||||
lval->op = plus;
|
||||
result = ADDOP2;
|
||||
break;
|
||||
|
||||
case '-':
|
||||
lval->op = minus;
|
||||
result = ADDOP2;
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
case '?':
|
||||
case ':':
|
||||
case '(':
|
||||
case ')':
|
||||
/* Nothing, just return the character. */
|
||||
break;
|
||||
|
||||
case ';':
|
||||
case '\n':
|
||||
case '\0':
|
||||
/* Be safe and let the user call this function again. */
|
||||
--exp;
|
||||
result = YYEOF;
|
||||
break;
|
||||
|
||||
default:
|
||||
result = YYERRCODE;
|
||||
#if YYDEBUG != 0
|
||||
--exp;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
*pexp = exp;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
yyerror (str)
|
||||
const char *str;
|
||||
{
|
||||
/* Do nothing. We don't print error messages here. */
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
# Add this package to a list of references stored in a text file.
|
||||
#
|
||||
# Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Library 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
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
# USA.
|
||||
#
|
||||
# Written by Bruno Haible <[email protected]>.
|
||||
#
|
||||
/^# Packages using this file: / {
|
||||
s/# Packages using this file://
|
||||
ta
|
||||
:a
|
||||
s/ @PACKAGE@ / @PACKAGE@ /
|
||||
tb
|
||||
s/ $/ @PACKAGE@ /
|
||||
:b
|
||||
s/^/# Packages using this file:/
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
# Remove this package from a list of references stored in a text file.
|
||||
#
|
||||
# Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Library 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
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
# USA.
|
||||
#
|
||||
# Written by Bruno Haible <[email protected]>.
|
||||
#
|
||||
/^# Packages using this file: / {
|
||||
s/# Packages using this file://
|
||||
s/ @PACKAGE@ / /
|
||||
s/^/# Packages using this file:/
|
||||
}
|
||||
@@ -1,142 +0,0 @@
|
||||
/* Implementation of the textdomain(3) function.
|
||||
Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef _LIBC
|
||||
# include <libintl.h>
|
||||
#else
|
||||
# include "libgnuintl.h"
|
||||
#endif
|
||||
#include "gettextP.h"
|
||||
|
||||
#ifdef _LIBC
|
||||
/* We have to handle multi-threaded applications. */
|
||||
# include <bits/libc-lock.h>
|
||||
#else
|
||||
/* Provide dummy implementation if this is outside glibc. */
|
||||
# define __libc_rwlock_define(CLASS, NAME)
|
||||
# define __libc_rwlock_wrlock(NAME)
|
||||
# define __libc_rwlock_unlock(NAME)
|
||||
#endif
|
||||
|
||||
/* The internal variables in the standalone libintl.a must have different
|
||||
names than the internal variables in GNU libc, otherwise programs
|
||||
using libintl.a cannot be linked statically. */
|
||||
#if !defined _LIBC
|
||||
# define _nl_default_default_domain _nl_default_default_domain__
|
||||
# define _nl_current_default_domain _nl_current_default_domain__
|
||||
#endif
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
/* Name of the default text domain. */
|
||||
extern const char _nl_default_default_domain[];
|
||||
|
||||
/* Default text domain in which entries for gettext(3) are to be found. */
|
||||
extern const char *_nl_current_default_domain;
|
||||
|
||||
|
||||
/* Names for the libintl functions are a problem. They must not clash
|
||||
with existing names and they should follow ANSI C. But this source
|
||||
code is also used in GNU C Library where the names have a __
|
||||
prefix. So we have to make a difference here. */
|
||||
#ifdef _LIBC
|
||||
# define TEXTDOMAIN __textdomain
|
||||
# ifndef strdup
|
||||
# define strdup(str) __strdup (str)
|
||||
# endif
|
||||
#else
|
||||
# define TEXTDOMAIN textdomain__
|
||||
#endif
|
||||
|
||||
/* Lock variable to protect the global data in the gettext implementation. */
|
||||
__libc_rwlock_define (extern, _nl_state_lock)
|
||||
|
||||
/* Set the current default message catalog to DOMAINNAME.
|
||||
If DOMAINNAME is null, return the current default.
|
||||
If DOMAINNAME is "", reset to the default of "messages". */
|
||||
char *
|
||||
TEXTDOMAIN (domainname)
|
||||
const char *domainname;
|
||||
{
|
||||
char *new_domain;
|
||||
char *old_domain;
|
||||
|
||||
/* A NULL pointer requests the current setting. */
|
||||
if (domainname == NULL)
|
||||
return (char *) _nl_current_default_domain;
|
||||
|
||||
__libc_rwlock_wrlock (_nl_state_lock);
|
||||
|
||||
old_domain = (char *) _nl_current_default_domain;
|
||||
|
||||
/* If domain name is the null string set to default domain "messages". */
|
||||
if (domainname[0] == '\0'
|
||||
|| strcmp (domainname, _nl_default_default_domain) == 0)
|
||||
{
|
||||
_nl_current_default_domain = _nl_default_default_domain;
|
||||
new_domain = (char *) _nl_current_default_domain;
|
||||
}
|
||||
else if (strcmp (domainname, old_domain) == 0)
|
||||
/* This can happen and people will use it to signal that some
|
||||
environment variable changed. */
|
||||
new_domain = old_domain;
|
||||
else
|
||||
{
|
||||
/* If the following malloc fails `_nl_current_default_domain'
|
||||
will be NULL. This value will be returned and so signals we
|
||||
are out of core. */
|
||||
#if defined _LIBC || defined HAVE_STRDUP
|
||||
new_domain = strdup (domainname);
|
||||
#else
|
||||
size_t len = strlen (domainname) + 1;
|
||||
new_domain = (char *) malloc (len);
|
||||
if (new_domain != NULL)
|
||||
memcpy (new_domain, domainname, len);
|
||||
#endif
|
||||
|
||||
if (new_domain != NULL)
|
||||
_nl_current_default_domain = new_domain;
|
||||
}
|
||||
|
||||
/* We use this possibility to signal a change of the loaded catalogs
|
||||
since this is most likely the case and there is no other easy we
|
||||
to do it. Do it only when the call was successful. */
|
||||
if (new_domain != NULL)
|
||||
{
|
||||
++_nl_msg_cat_cntr;
|
||||
|
||||
if (old_domain != new_domain && old_domain != _nl_default_default_domain)
|
||||
free (old_domain);
|
||||
}
|
||||
|
||||
__libc_rwlock_unlock (_nl_state_lock);
|
||||
|
||||
return new_domain;
|
||||
}
|
||||
|
||||
#ifdef _LIBC
|
||||
/* Alias for function name in GNU C Library. */
|
||||
weak_alias (__textdomain, textdomain);
|
||||
#endif
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
*_.c
|
||||
.deps
|
||||
Makefile
|
||||
ansi2knr
|
||||
ansi2knr ansi2knr.*
|
||||
Makefile.in
|
||||
|
||||
+48
-9
@@ -1,22 +1,61 @@
|
||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
||||
## Copyright (C) 2001, 2002 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA
|
||||
## 02111-1307 USA
|
||||
|
||||
AUTOMAKE_OPTIONS = ansi2knr
|
||||
|
||||
CFLAGS = @CFLAGS@ $(WARNING_CFLAGS)
|
||||
|
||||
noinst_LIBRARIES = libbison.a
|
||||
|
||||
INCLUDES = -I.. -I$(srcdir) -I../intl
|
||||
# config.h is in build/., and system.h is in src/src/.
|
||||
INCLUDES = -I$(top_builddir) \
|
||||
-I$(top_srcdir)/src \
|
||||
-I$(top_srcdir)/lib
|
||||
|
||||
# Heck, we are still using an old version of Automake which does not
|
||||
# understand LIBOBJ additions using $objext...
|
||||
|
||||
EXTRA_DIST = malloc.c realloc.c
|
||||
# understand inner AC_LIBOBJ (i.e., from Autoconf itself, not from
|
||||
# configure.in).
|
||||
EXTRA_DIST = malloc.c realloc.c strnlen.c
|
||||
|
||||
libbison_a_SOURCES = \
|
||||
error.c error.h \
|
||||
argmatch.h argmatch.c \
|
||||
gettext.h \
|
||||
basename.c dirname.h dirname.c \
|
||||
getopt.h getopt.c getopt1.c \
|
||||
obstack.h obstack.c \
|
||||
hash.h hash.c \
|
||||
quote.h quote.c quotearg.h quotearg.c \
|
||||
xalloc.h xmalloc.c xstrdup.c
|
||||
readpipe.c unlocked-io.h \
|
||||
xalloc.h xmalloc.c xstrdup.c xstrndup.c \
|
||||
$(bitsets_sources) $(additional_bitsets_sources) $(timevars_sources)
|
||||
|
||||
libbison_a_LIBADD = @LIBOBJS@
|
||||
# Implementation of bitsets
|
||||
bitsets_sources = \
|
||||
libiberty.h \
|
||||
abitset.c bitset.c bitset_stats.h ebitset.c lbitset.h \
|
||||
abitset.h bitset.h bitsetv.c ebitset.h \
|
||||
bbitset.h bitset_stats.c bitsetv.h lbitset.c
|
||||
|
||||
# Additional bitset operations.
|
||||
additional_bitsets_sources = \
|
||||
bitsetv-print.h bitsetv-print.c
|
||||
|
||||
# timevars, stolen from GCC.
|
||||
timevars_sources = \
|
||||
timevar.h timevar.c timevar.def
|
||||
|
||||
libbison_a_LIBADD = @LIBOBJS@ @ALLOCA@
|
||||
libbison_a_DEPENDENCIES = $(libbison_a_LIBADD)
|
||||
|
||||
-400
@@ -1,400 +0,0 @@
|
||||
# Makefile.in generated automatically by automake 1.5a from Makefile.am.
|
||||
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
|
||||
# Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = @program_transform_name@
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
|
||||
EXEEXT = @EXEEXT@
|
||||
OBJEXT = @OBJEXT@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
AMTAR = @AMTAR@
|
||||
AWK = @AWK@
|
||||
BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@
|
||||
CATALOGS = @CATALOGS@
|
||||
CATOBJEXT = @CATOBJEXT@
|
||||
CC = @CC@
|
||||
CPP = @CPP@
|
||||
DATADIRNAME = @DATADIRNAME@
|
||||
DEPDIR = @DEPDIR@
|
||||
GENCAT = @GENCAT@
|
||||
GLIBC21 = @GLIBC21@
|
||||
GMOFILES = @GMOFILES@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
INSTOBJEXT = @INSTOBJEXT@
|
||||
INTLBISON = @INTLBISON@
|
||||
INTLLIBS = @INTLLIBS@
|
||||
INTLOBJS = @INTLOBJS@
|
||||
INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@
|
||||
LIBICONV = @LIBICONV@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
M4 = @M4@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
MSGFMT = @MSGFMT@
|
||||
PACKAGE = @PACKAGE@
|
||||
POFILES = @POFILES@
|
||||
POSUB = @POSUB@
|
||||
RANLIB = @RANLIB@
|
||||
U = @U@
|
||||
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
|
||||
USE_NLS = @USE_NLS@
|
||||
VERSION = @VERSION@
|
||||
WARNING_CFLAGS = @WARNING_CFLAGS@
|
||||
am__include = @am__include@
|
||||
am__quote = @am__quote@
|
||||
install_sh = @install_sh@
|
||||
|
||||
AUTOMAKE_OPTIONS = ansi2knr
|
||||
|
||||
noinst_LIBRARIES = libbison.a
|
||||
|
||||
INCLUDES = -I.. -I$(srcdir) -I../intl
|
||||
|
||||
|
||||
# Heck, we are still using an old version of Automake which does not
|
||||
# understand LIBOBJ additions using $objext...
|
||||
EXTRA_DIST = malloc.c realloc.c
|
||||
|
||||
libbison_a_SOURCES = \
|
||||
error.c error.h \
|
||||
getopt.h getopt.c getopt1.c \
|
||||
obstack.h obstack.c \
|
||||
quote.h quote.c quotearg.h quotearg.c \
|
||||
xalloc.h xmalloc.c xstrdup.c
|
||||
|
||||
|
||||
libbison_a_LIBADD = @LIBOBJS@
|
||||
libbison_a_DEPENDENCIES = $(libbison_a_LIBADD)
|
||||
subdir = lib
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
LIBRARIES = $(noinst_LIBRARIES)
|
||||
|
||||
libbison_a_AR = $(AR) cru
|
||||
am_libbison_a_OBJECTS = error$U.$(OBJEXT) getopt$U.$(OBJEXT) \
|
||||
getopt1$U.$(OBJEXT) obstack$U.$(OBJEXT) quote$U.$(OBJEXT) \
|
||||
quotearg$U.$(OBJEXT) xmalloc$U.$(OBJEXT) xstrdup$U.$(OBJEXT)
|
||||
libbison_a_OBJECTS = $(am_libbison_a_OBJECTS)
|
||||
|
||||
DEFS = @DEFS@
|
||||
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
depcomp = $(SHELL) $(top_srcdir)/config/depcomp
|
||||
@AMDEP_TRUE@DEP_FILES = $(DEPDIR)/error$U.Po $(DEPDIR)/getopt$U.Po \
|
||||
@AMDEP_TRUE@ $(DEPDIR)/getopt1$U.Po $(DEPDIR)/malloc.Po \
|
||||
@AMDEP_TRUE@ $(DEPDIR)/memchr.Po $(DEPDIR)/obstack$U.Po \
|
||||
@AMDEP_TRUE@ $(DEPDIR)/quote$U.Po $(DEPDIR)/quotearg$U.Po \
|
||||
@AMDEP_TRUE@ $(DEPDIR)/realloc.Po $(DEPDIR)/stpcpy.Po \
|
||||
@AMDEP_TRUE@ $(DEPDIR)/strndup.Po $(DEPDIR)/strnlen.Po \
|
||||
@AMDEP_TRUE@ $(DEPDIR)/strspn.Po $(DEPDIR)/xmalloc$U.Po \
|
||||
@AMDEP_TRUE@ $(DEPDIR)/xstrdup$U.Po
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
CFLAGS = @CFLAGS@
|
||||
DIST_SOURCES = $(libbison_a_SOURCES)
|
||||
DIST_COMMON = Makefile.am Makefile.in ansi2knr.1 ansi2knr.c malloc.c \
|
||||
memchr.c realloc.c stpcpy.c strndup.c strnlen.c strspn.c
|
||||
SOURCES = $(libbison_a_SOURCES)
|
||||
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .o .obj
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu lib/Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) && \
|
||||
CONFIG_HEADERS= CONFIG_LINKS= \
|
||||
CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
|
||||
|
||||
AR = ar
|
||||
|
||||
clean-noinstLIBRARIES:
|
||||
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
|
||||
libbison.a: $(libbison_a_OBJECTS) $(libbison_a_DEPENDENCIES)
|
||||
-rm -f libbison.a
|
||||
$(libbison_a_AR) libbison.a $(libbison_a_OBJECTS) $(libbison_a_LIBADD)
|
||||
$(RANLIB) libbison.a
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT) core *.core
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
ANSI2KNR = @ANSI2KNR@
|
||||
ansi2knr: ansi2knr.$(OBJEXT)
|
||||
$(LINK) ansi2knr.$(OBJEXT) $(LIBS)
|
||||
ansi2knr.$(OBJEXT): $(CONFIG_HEADER)
|
||||
|
||||
clean-krextra:
|
||||
-rm -f ansi2knr
|
||||
|
||||
mostlyclean-kr:
|
||||
-rm -f *_.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/error$U.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/getopt$U.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/getopt1$U.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/malloc.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/memchr.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/obstack$U.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/quote$U.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/quotearg$U.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/realloc.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/stpcpy.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strndup.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strnlen.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strspn.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/xmalloc$U.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/xstrdup$U.Po@am__quote@
|
||||
|
||||
distclean-depend:
|
||||
-rm -rf $(DEPDIR)
|
||||
|
||||
.c.o:
|
||||
@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
$(COMPILE) -c `test -f $< || echo '$(srcdir)/'`$<
|
||||
|
||||
.c.obj:
|
||||
@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
$(COMPILE) -c `cygpath -w $<`
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
alloca_.c: alloca.c $(ANSI2KNR)
|
||||
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/alloca.c; then echo $(srcdir)/alloca.c; else echo alloca.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > alloca_.c || rm -f alloca_.c
|
||||
error_.c: error.c $(ANSI2KNR)
|
||||
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/error.c; then echo $(srcdir)/error.c; else echo error.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > error_.c || rm -f error_.c
|
||||
getopt_.c: getopt.c $(ANSI2KNR)
|
||||
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/getopt.c; then echo $(srcdir)/getopt.c; else echo getopt.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > getopt_.c || rm -f getopt_.c
|
||||
getopt1_.c: getopt1.c $(ANSI2KNR)
|
||||
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/getopt1.c; then echo $(srcdir)/getopt1.c; else echo getopt1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > getopt1_.c || rm -f getopt1_.c
|
||||
malloc_.c: malloc.c $(ANSI2KNR)
|
||||
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/malloc.c; then echo $(srcdir)/malloc.c; else echo malloc.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > malloc_.c || rm -f malloc_.c
|
||||
memchr_.c: memchr.c $(ANSI2KNR)
|
||||
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/memchr.c; then echo $(srcdir)/memchr.c; else echo memchr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > memchr_.c || rm -f memchr_.c
|
||||
obstack_.c: obstack.c $(ANSI2KNR)
|
||||
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/obstack.c; then echo $(srcdir)/obstack.c; else echo obstack.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > obstack_.c || rm -f obstack_.c
|
||||
quote_.c: quote.c $(ANSI2KNR)
|
||||
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/quote.c; then echo $(srcdir)/quote.c; else echo quote.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > quote_.c || rm -f quote_.c
|
||||
quotearg_.c: quotearg.c $(ANSI2KNR)
|
||||
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/quotearg.c; then echo $(srcdir)/quotearg.c; else echo quotearg.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > quotearg_.c || rm -f quotearg_.c
|
||||
realloc_.c: realloc.c $(ANSI2KNR)
|
||||
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/realloc.c; then echo $(srcdir)/realloc.c; else echo realloc.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > realloc_.c || rm -f realloc_.c
|
||||
stpcpy_.c: stpcpy.c $(ANSI2KNR)
|
||||
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/stpcpy.c; then echo $(srcdir)/stpcpy.c; else echo stpcpy.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > stpcpy_.c || rm -f stpcpy_.c
|
||||
strndup_.c: strndup.c $(ANSI2KNR)
|
||||
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/strndup.c; then echo $(srcdir)/strndup.c; else echo strndup.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > strndup_.c || rm -f strndup_.c
|
||||
strnlen_.c: strnlen.c $(ANSI2KNR)
|
||||
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/strnlen.c; then echo $(srcdir)/strnlen.c; else echo strnlen.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > strnlen_.c || rm -f strnlen_.c
|
||||
strspn_.c: strspn.c $(ANSI2KNR)
|
||||
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/strspn.c; then echo $(srcdir)/strspn.c; else echo strspn.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > strspn_.c || rm -f strspn_.c
|
||||
xmalloc_.c: xmalloc.c $(ANSI2KNR)
|
||||
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/xmalloc.c; then echo $(srcdir)/xmalloc.c; else echo xmalloc.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > xmalloc_.c || rm -f xmalloc_.c
|
||||
xstrdup_.c: xstrdup.c $(ANSI2KNR)
|
||||
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/xstrdup.c; then echo $(srcdir)/xstrdup.c; else echo xstrdup.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > xstrdup_.c || rm -f xstrdup_.c
|
||||
alloca_.$(OBJEXT) error_.$(OBJEXT) getopt_.$(OBJEXT) getopt1_.$(OBJEXT) \
|
||||
malloc_.$(OBJEXT) memchr_.$(OBJEXT) obstack_.$(OBJEXT) quote_.$(OBJEXT) \
|
||||
quotearg_.$(OBJEXT) realloc_.$(OBJEXT) stpcpy_.$(OBJEXT) \
|
||||
strndup_.$(OBJEXT) strnlen_.$(OBJEXT) strspn_.$(OBJEXT) \
|
||||
xmalloc_.$(OBJEXT) xstrdup_.$(OBJEXT) : $(ANSI2KNR)
|
||||
uninstall-info-am:
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
mkid -fID $$unique $(LISP)
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|
||||
|| etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& cd $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) $$here
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
top_distdir = ..
|
||||
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@for file in $(DISTFILES); do \
|
||||
if test -f $$file; then d=.; else d=$(srcdir); fi; \
|
||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
$(mkinstalldirs) "$(distdir)/$$dir"; \
|
||||
fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pR $$d/$$file $(distdir) \
|
||||
|| exit 1; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(ANSI2KNR) $(LIBRARIES)
|
||||
|
||||
installdirs:
|
||||
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-krextra clean-noinstLIBRARIES \
|
||||
mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
|
||||
distclean-am: clean-am distclean-compile distclean-depend \
|
||||
distclean-generic distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-man:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr
|
||||
|
||||
uninstall-am: uninstall-info-am
|
||||
|
||||
.PHONY: GTAGS all all-am check check-am clean clean-generic \
|
||||
clean-krextra clean-noinstLIBRARIES distclean distclean-compile \
|
||||
distclean-depend distclean-generic distclean-tags distdir dvi \
|
||||
dvi-am info info-am install install-am install-data \
|
||||
install-data-am install-exec install-exec-am install-info \
|
||||
install-info-am install-man install-strip installcheck \
|
||||
installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
||||
mostlyclean-generic mostlyclean-kr tags uninstall uninstall-am \
|
||||
uninstall-info-am
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
+653
@@ -0,0 +1,653 @@
|
||||
/* Array bitsets.
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
Contributed by Michael Hayes ([email protected]).
|
||||
|
||||
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 of the License, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "abitset.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
/* This file implements fixed size bitsets stored as an array
|
||||
of words. Any unused bits in the last word must be zero. */
|
||||
|
||||
typedef struct abitset_struct
|
||||
{
|
||||
unsigned int n_bits; /* Number of bits. */
|
||||
bitset_word words[1]; /* The array of bits. */
|
||||
}
|
||||
*abitset;
|
||||
|
||||
|
||||
struct bitset_struct
|
||||
{
|
||||
struct bbitset_struct b;
|
||||
struct abitset_struct a;
|
||||
};
|
||||
|
||||
static void abitset_unused_clear PARAMS ((bitset));
|
||||
|
||||
static int abitset_small_list PARAMS ((bitset, bitset_bindex *, bitset_bindex,
|
||||
bitset_bindex *));
|
||||
|
||||
static void abitset_set PARAMS ((bitset, bitset_bindex));
|
||||
static void abitset_reset PARAMS ((bitset, bitset_bindex));
|
||||
static int abitset_test PARAMS ((bitset, bitset_bindex));
|
||||
static int abitset_size PARAMS ((bitset));
|
||||
static int abitset_op1 PARAMS ((bitset, enum bitset_ops));
|
||||
static int abitset_op2 PARAMS ((bitset, bitset, enum bitset_ops));
|
||||
static int abitset_op3 PARAMS ((bitset, bitset, bitset, enum bitset_ops));
|
||||
static int abitset_op4 PARAMS ((bitset, bitset, bitset, bitset,
|
||||
enum bitset_ops));
|
||||
static int abitset_list PARAMS ((bitset, bitset_bindex *, bitset_bindex,
|
||||
bitset_bindex *));
|
||||
static int abitset_reverse_list
|
||||
PARAMS ((bitset, bitset_bindex *, bitset_bindex, bitset_bindex *));
|
||||
|
||||
#define ABITSET_N_WORDS(N) (((N) + BITSET_WORD_BITS - 1) / BITSET_WORD_BITS)
|
||||
#define ABITSET_WORDS(X) ((X)->a.words)
|
||||
#define ABITSET_N_BITS(X) ((X)->a.n_bits)
|
||||
|
||||
|
||||
/* Return size in bits of bitset SRC. */
|
||||
static int
|
||||
abitset_size (src)
|
||||
bitset src;
|
||||
{
|
||||
return ABITSET_N_BITS (src);
|
||||
}
|
||||
|
||||
|
||||
/* Find list of up to NUM bits set in BSET starting from and including
|
||||
*NEXT and store in array LIST. Return with actual number of bits
|
||||
found and with *NEXT indicating where search stopped. */
|
||||
static int
|
||||
abitset_small_list (src, list, num, next)
|
||||
bitset src;
|
||||
bitset_bindex *list;
|
||||
bitset_bindex num;
|
||||
bitset_bindex *next;
|
||||
{
|
||||
bitset_bindex bitno;
|
||||
bitset_bindex count;
|
||||
bitset_windex size;
|
||||
bitset_word word;
|
||||
|
||||
word = ABITSET_WORDS (src)[0];
|
||||
|
||||
/* Short circuit common case. */
|
||||
if (!word)
|
||||
return 0;
|
||||
|
||||
size = ABITSET_N_BITS (src);
|
||||
bitno = *next;
|
||||
if (bitno >= size)
|
||||
return 0;
|
||||
|
||||
word >>= bitno;
|
||||
|
||||
/* If num is 1, we could speed things up with a binary search
|
||||
of the word of interest. */
|
||||
|
||||
if (num >= BITSET_WORD_BITS)
|
||||
{
|
||||
for (count = 0; word; bitno++)
|
||||
{
|
||||
if (word & 1)
|
||||
list[count++] = bitno;
|
||||
word >>= 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (count = 0; word; bitno++)
|
||||
{
|
||||
if (word & 1)
|
||||
{
|
||||
list[count++] = bitno;
|
||||
if (count >= num)
|
||||
{
|
||||
bitno++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
word >>= 1;
|
||||
}
|
||||
}
|
||||
|
||||
*next = bitno;
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
/* Set bit BITNO in bitset DST. */
|
||||
static void
|
||||
abitset_set (dst, bitno)
|
||||
bitset dst ATTRIBUTE_UNUSED;
|
||||
bitset_bindex bitno ATTRIBUTE_UNUSED;
|
||||
{
|
||||
/* This should never occur for abitsets. */
|
||||
abort ();
|
||||
}
|
||||
|
||||
|
||||
/* Reset bit BITNO in bitset DST. */
|
||||
static void
|
||||
abitset_reset (dst, bitno)
|
||||
bitset dst ATTRIBUTE_UNUSED;
|
||||
bitset_bindex bitno ATTRIBUTE_UNUSED;
|
||||
{
|
||||
/* This should never occur for abitsets. */
|
||||
abort ();
|
||||
}
|
||||
|
||||
|
||||
/* Test bit BITNO in bitset SRC. */
|
||||
static int
|
||||
abitset_test (src, bitno)
|
||||
bitset src ATTRIBUTE_UNUSED;
|
||||
bitset_bindex bitno ATTRIBUTE_UNUSED;
|
||||
{
|
||||
/* This should never occur for abitsets. */
|
||||
abort ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Find list of up to NUM bits set in BSET in reverse order, starting
|
||||
from and including NEXT and store in array LIST. Return with
|
||||
actual number of bits found and with *NEXT indicating where search
|
||||
stopped. */
|
||||
static int
|
||||
abitset_reverse_list (src, list, num, next)
|
||||
bitset src;
|
||||
bitset_bindex *list;
|
||||
bitset_bindex num;
|
||||
bitset_bindex *next;
|
||||
{
|
||||
bitset_bindex bitno;
|
||||
bitset_bindex rbitno;
|
||||
bitset_bindex count;
|
||||
bitset_windex windex;
|
||||
unsigned int bitcnt;
|
||||
bitset_bindex bitoff;
|
||||
bitset_word word;
|
||||
bitset_word *srcp = ABITSET_WORDS (src);
|
||||
bitset_bindex n_bits = ABITSET_N_BITS (src);
|
||||
|
||||
rbitno = *next;
|
||||
|
||||
/* If num is 1, we could speed things up with a binary search
|
||||
of the word of interest. */
|
||||
|
||||
if (rbitno >= n_bits)
|
||||
return 0;
|
||||
|
||||
count = 0;
|
||||
|
||||
bitno = n_bits - (rbitno + 1);
|
||||
|
||||
windex = bitno / BITSET_WORD_BITS;
|
||||
bitcnt = bitno % BITSET_WORD_BITS;
|
||||
bitoff = windex * BITSET_WORD_BITS;
|
||||
|
||||
do
|
||||
{
|
||||
word = srcp[windex] << (BITSET_WORD_BITS - 1 - bitcnt);
|
||||
for (; word; bitcnt--)
|
||||
{
|
||||
if (word & BITSET_MSB)
|
||||
{
|
||||
list[count++] = bitoff + bitcnt;
|
||||
if (count >= num)
|
||||
{
|
||||
*next = n_bits - (bitoff + bitcnt);
|
||||
return count;
|
||||
}
|
||||
}
|
||||
word <<= 1;
|
||||
}
|
||||
bitoff -= BITSET_WORD_BITS;
|
||||
bitcnt = BITSET_WORD_BITS - 1;
|
||||
}
|
||||
while (windex--);
|
||||
|
||||
*next = n_bits - (bitoff + 1);
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
/* Find list of up to NUM bits set in BSET starting from and including
|
||||
*NEXT and store in array LIST. Return with actual number of bits
|
||||
found and with *NEXT indicating where search stopped. */
|
||||
static int
|
||||
abitset_list (src, list, num, next)
|
||||
bitset src;
|
||||
bitset_bindex *list;
|
||||
bitset_bindex num;
|
||||
bitset_bindex *next;
|
||||
{
|
||||
bitset_bindex bitno;
|
||||
bitset_bindex count;
|
||||
bitset_windex windex;
|
||||
bitset_bindex bitoff;
|
||||
bitset_windex size = src->b.csize;
|
||||
bitset_word *srcp = ABITSET_WORDS (src);
|
||||
bitset_word word;
|
||||
|
||||
bitno = *next;
|
||||
|
||||
count = 0;
|
||||
if (!bitno)
|
||||
{
|
||||
/* Many bitsets are zero, so make this common case fast. */
|
||||
for (windex = 0; windex < size && !srcp[windex]; windex++)
|
||||
continue;
|
||||
if (windex >= size)
|
||||
return 0;
|
||||
|
||||
/* If num is 1, we could speed things up with a binary search
|
||||
of the current word. */
|
||||
|
||||
bitoff = windex * BITSET_WORD_BITS;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bitno >= ABITSET_N_BITS (src))
|
||||
return 0;
|
||||
|
||||
windex = bitno / BITSET_WORD_BITS;
|
||||
bitno = bitno % BITSET_WORD_BITS;
|
||||
|
||||
if (bitno)
|
||||
{
|
||||
/* Handle the case where we start within a word.
|
||||
Most often, this is executed with large bitsets
|
||||
with many set bits where we filled the array
|
||||
on the previous call to this function. */
|
||||
|
||||
bitoff = windex * BITSET_WORD_BITS;
|
||||
word = srcp[windex] >> bitno;
|
||||
for (bitno = bitoff + bitno; word; bitno++)
|
||||
{
|
||||
if (word & 1)
|
||||
{
|
||||
list[count++] = bitno;
|
||||
if (count >= num)
|
||||
{
|
||||
*next = bitno + 1;
|
||||
return count;
|
||||
}
|
||||
}
|
||||
word >>= 1;
|
||||
}
|
||||
windex++;
|
||||
}
|
||||
bitoff = windex * BITSET_WORD_BITS;
|
||||
}
|
||||
|
||||
for (; windex < size; windex++, bitoff += BITSET_WORD_BITS)
|
||||
{
|
||||
if (!(word = srcp[windex]))
|
||||
continue;
|
||||
|
||||
if ((count + BITSET_WORD_BITS) < num)
|
||||
{
|
||||
for (bitno = bitoff; word; bitno++)
|
||||
{
|
||||
if (word & 1)
|
||||
list[count++] = bitno;
|
||||
word >>= 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (bitno = bitoff; word; bitno++)
|
||||
{
|
||||
if (word & 1)
|
||||
{
|
||||
list[count++] = bitno;
|
||||
if (count >= num)
|
||||
{
|
||||
*next = bitno + 1;
|
||||
return count;
|
||||
}
|
||||
}
|
||||
word >>= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*next = bitoff;
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
/* Ensure that any unused bits within the last word are clear. */
|
||||
static inline void
|
||||
abitset_unused_clear (dst)
|
||||
bitset dst;
|
||||
{
|
||||
unsigned int last_bit;
|
||||
|
||||
last_bit = ABITSET_N_BITS (dst) % BITSET_WORD_BITS;
|
||||
if (last_bit)
|
||||
ABITSET_WORDS (dst)[dst->b.csize - 1] &=
|
||||
((bitset_word) 1 << last_bit) - 1;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
abitset_op1 (dst, op)
|
||||
bitset dst;
|
||||
enum bitset_ops op;
|
||||
{
|
||||
unsigned int i;
|
||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||
unsigned int bytes;
|
||||
|
||||
bytes = sizeof (bitset_word) * dst->b.csize;
|
||||
|
||||
switch (op)
|
||||
{
|
||||
case BITSET_OP_ZERO:
|
||||
memset (dstp, 0, bytes);
|
||||
break;
|
||||
|
||||
case BITSET_OP_ONES:
|
||||
memset (dstp, -1, bytes);
|
||||
abitset_unused_clear (dst);
|
||||
break;
|
||||
|
||||
case BITSET_OP_EMPTY_P:
|
||||
for (i = 0; i < dst->b.csize; i++)
|
||||
if (dstp[i])
|
||||
return 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
abitset_op2 (dst, src, op)
|
||||
bitset dst;
|
||||
bitset src;
|
||||
enum bitset_ops op;
|
||||
{
|
||||
unsigned int i;
|
||||
bitset_word *srcp = ABITSET_WORDS (src);
|
||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||
bitset_windex size = dst->b.csize;
|
||||
|
||||
switch (op)
|
||||
{
|
||||
case BITSET_OP_COPY:
|
||||
if (srcp == dstp)
|
||||
break;
|
||||
memcpy (dstp, srcp, sizeof (bitset_word) * size);
|
||||
break;
|
||||
|
||||
case BITSET_OP_NOT:
|
||||
for (i = 0; i < size; i++)
|
||||
*dstp++ = ~(*srcp++);
|
||||
abitset_unused_clear (dst);
|
||||
break;
|
||||
|
||||
case BITSET_OP_EQUAL_P:
|
||||
for (i = 0; i < size; i++)
|
||||
if (*srcp++ != *dstp++)
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case BITSET_OP_SUBSET_P:
|
||||
for (i = 0; i < size; i++, dstp++, srcp++)
|
||||
if (*dstp != (*srcp | *dstp))
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case BITSET_OP_DISJOINT_P:
|
||||
for (i = 0; i < size; i++)
|
||||
if (*srcp++ & *dstp++)
|
||||
return 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
abitset_op3 (dst, src1, src2, op)
|
||||
bitset dst;
|
||||
bitset src1;
|
||||
bitset src2;
|
||||
enum bitset_ops op;
|
||||
{
|
||||
unsigned int i;
|
||||
int changed = 0;
|
||||
bitset_word *src1p = ABITSET_WORDS (src1);
|
||||
bitset_word *src2p = ABITSET_WORDS (src2);
|
||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||
bitset_windex size = dst->b.csize;
|
||||
|
||||
switch (op)
|
||||
{
|
||||
case BITSET_OP_OR:
|
||||
for (i = 0; i < size; i++, dstp++)
|
||||
{
|
||||
bitset_word tmp = *src1p++ | *src2p++;
|
||||
|
||||
if (*dstp != tmp)
|
||||
{
|
||||
changed = 1;
|
||||
*dstp = tmp;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case BITSET_OP_AND:
|
||||
for (i = 0; i < size; i++, dstp++)
|
||||
{
|
||||
bitset_word tmp = *src1p++ & *src2p++;
|
||||
|
||||
if (*dstp != tmp)
|
||||
{
|
||||
changed = 1;
|
||||
*dstp = tmp;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case BITSET_OP_XOR:
|
||||
for (i = 0; i < size; i++, dstp++)
|
||||
{
|
||||
bitset_word tmp = *src1p++ ^ *src2p++;
|
||||
|
||||
if (*dstp != tmp)
|
||||
{
|
||||
changed = 1;
|
||||
*dstp = tmp;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case BITSET_OP_ANDN:
|
||||
for (i = 0; i < size; i++, dstp++)
|
||||
{
|
||||
bitset_word tmp = *src1p++ & ~(*src2p++);
|
||||
|
||||
if (*dstp != tmp)
|
||||
{
|
||||
changed = 1;
|
||||
*dstp = tmp;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
abitset_op4 (dst, src1, src2, src3, op)
|
||||
bitset dst;
|
||||
bitset src1;
|
||||
bitset src2;
|
||||
bitset src3;
|
||||
enum bitset_ops op;
|
||||
{
|
||||
unsigned int i;
|
||||
int changed = 0;
|
||||
bitset_word *src1p = ABITSET_WORDS (src1);
|
||||
bitset_word *src2p = ABITSET_WORDS (src2);
|
||||
bitset_word *src3p = ABITSET_WORDS (src3);
|
||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||
bitset_windex size = dst->b.csize;
|
||||
|
||||
switch (op)
|
||||
{
|
||||
case BITSET_OP_OR_AND:
|
||||
for (i = 0; i < size; i++, dstp++)
|
||||
{
|
||||
bitset_word tmp = (*src1p++ | *src2p++) & *src3p++;
|
||||
|
||||
if (*dstp != tmp)
|
||||
{
|
||||
changed = 1;
|
||||
*dstp = tmp;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case BITSET_OP_AND_OR:
|
||||
for (i = 0; i < size; i++, dstp++)
|
||||
{
|
||||
bitset_word tmp = (*src1p++ & *src2p++) | *src3p++;
|
||||
|
||||
if (*dstp != tmp)
|
||||
{
|
||||
changed = 1;
|
||||
*dstp = tmp;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case BITSET_OP_ANDN_OR:
|
||||
for (i = 0; i < size; i++, dstp++)
|
||||
{
|
||||
bitset_word tmp = (*src1p++ & ~(*src2p++)) | *src3p++;
|
||||
|
||||
if (*dstp != tmp)
|
||||
{
|
||||
changed = 1;
|
||||
*dstp = tmp;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
|
||||
/* Vector of operations for single word bitsets. */
|
||||
struct bitset_ops_struct abitset_small_ops = {
|
||||
abitset_set,
|
||||
abitset_reset,
|
||||
abitset_test,
|
||||
abitset_size,
|
||||
abitset_op1,
|
||||
abitset_op2,
|
||||
abitset_op3,
|
||||
abitset_op4,
|
||||
abitset_small_list,
|
||||
abitset_reverse_list,
|
||||
NULL,
|
||||
BITSET_ARRAY
|
||||
};
|
||||
|
||||
|
||||
/* Vector of operations for multiple word bitsets. */
|
||||
struct bitset_ops_struct abitset_ops = {
|
||||
abitset_set,
|
||||
abitset_reset,
|
||||
abitset_test,
|
||||
abitset_size,
|
||||
abitset_op1,
|
||||
abitset_op2,
|
||||
abitset_op3,
|
||||
abitset_op4,
|
||||
abitset_list,
|
||||
abitset_reverse_list,
|
||||
NULL,
|
||||
BITSET_ARRAY
|
||||
};
|
||||
|
||||
|
||||
int
|
||||
abitset_bytes (n_bits)
|
||||
bitset_bindex n_bits;
|
||||
{
|
||||
unsigned int bytes, size;
|
||||
|
||||
size = ABITSET_N_WORDS (n_bits);
|
||||
bytes = size * sizeof (bitset_word);
|
||||
return sizeof (struct bitset_struct) + bytes - sizeof (bitset_word);
|
||||
}
|
||||
|
||||
|
||||
bitset
|
||||
abitset_init (bset, n_bits)
|
||||
bitset bset;
|
||||
bitset_bindex n_bits;
|
||||
{
|
||||
bitset_windex size;
|
||||
|
||||
size = ABITSET_N_WORDS (n_bits);
|
||||
ABITSET_N_BITS (bset) = n_bits;
|
||||
|
||||
/* Use optimized routines if bitset fits within a single word.
|
||||
There is probably little merit if using caching since
|
||||
the small bitset will always fit in the cache. */
|
||||
if (size == 1)
|
||||
bset->b.ops = &abitset_small_ops;
|
||||
else
|
||||
bset->b.ops = &abitset_ops;
|
||||
|
||||
bset->b.cindex = 0;
|
||||
bset->b.csize = size;
|
||||
bset->b.cdata = ABITSET_WORDS (bset);
|
||||
return bset;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/* Functions to support abitsets.
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
Contributed by Michael Hayes ([email protected]).
|
||||
|
||||
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 of the License, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _ABITSET_H
|
||||
#define _ABITSET_H
|
||||
|
||||
#include "bbitset.h"
|
||||
|
||||
extern int abitset_bytes PARAMS ((bitset_bindex));
|
||||
|
||||
extern bitset abitset_init PARAMS ((bitset, bitset_bindex));
|
||||
|
||||
#endif
|
||||
+66
-66
@@ -22,18 +22,18 @@
|
||||
your main control loop, etc. to force garbage collection. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#if HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#if HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef emacs
|
||||
#include "blockinput.h"
|
||||
# include "blockinput.h"
|
||||
#endif
|
||||
|
||||
/* If compiling with GCC 2, this file's not needed. */
|
||||
@@ -41,41 +41,41 @@
|
||||
|
||||
/* If someone has defined alloca as a macro,
|
||||
there must be some other way alloca is supposed to work. */
|
||||
#ifndef alloca
|
||||
# ifndef alloca
|
||||
|
||||
#ifdef emacs
|
||||
#ifdef static
|
||||
# ifdef emacs
|
||||
# ifdef static
|
||||
/* actually, only want this if static is defined as ""
|
||||
-- this is for usg, in which emacs must undefine static
|
||||
in order to make unexec workable
|
||||
*/
|
||||
#ifndef STACK_DIRECTION
|
||||
# ifndef STACK_DIRECTION
|
||||
you
|
||||
lose
|
||||
-- must know STACK_DIRECTION at compile-time
|
||||
#endif /* STACK_DIRECTION undefined */
|
||||
#endif /* static */
|
||||
#endif /* emacs */
|
||||
# endif /* STACK_DIRECTION undefined */
|
||||
# endif /* static */
|
||||
# endif /* emacs */
|
||||
|
||||
/* If your stack is a linked list of frames, you have to
|
||||
provide an "address metric" ADDRESS_FUNCTION macro. */
|
||||
|
||||
#if defined (CRAY) && defined (CRAY_STACKSEG_END)
|
||||
# if defined (CRAY) && defined (CRAY_STACKSEG_END)
|
||||
long i00afunc ();
|
||||
#define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg))
|
||||
#else
|
||||
#define ADDRESS_FUNCTION(arg) &(arg)
|
||||
#endif
|
||||
# define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg))
|
||||
# else
|
||||
# define ADDRESS_FUNCTION(arg) &(arg)
|
||||
# endif
|
||||
|
||||
#if __STDC__
|
||||
# if __STDC__
|
||||
typedef void *pointer;
|
||||
#else
|
||||
# else
|
||||
typedef char *pointer;
|
||||
#endif
|
||||
# endif
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
# ifndef NULL
|
||||
# define NULL 0
|
||||
# endif
|
||||
|
||||
/* Different portions of Emacs need to call different versions of
|
||||
malloc. The Emacs executable needs alloca to call xmalloc, because
|
||||
@@ -83,13 +83,14 @@ typedef char *pointer;
|
||||
hand, the utilities in lib-src need alloca to call malloc; some of
|
||||
them are very simple, and don't have an xmalloc routine.
|
||||
|
||||
Non-Emacs programs expect this to call use xmalloc.
|
||||
Non-Emacs programs expect this to call xmalloc.
|
||||
|
||||
Callers below should use malloc. */
|
||||
|
||||
#ifndef emacs
|
||||
#define malloc xmalloc
|
||||
#endif
|
||||
# ifndef emacs
|
||||
# undef malloc
|
||||
# define malloc xmalloc
|
||||
# endif
|
||||
extern pointer malloc ();
|
||||
|
||||
/* Define STACK_DIRECTION if you know the direction of stack
|
||||
@@ -100,18 +101,18 @@ extern pointer malloc ();
|
||||
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||
STACK_DIRECTION = 0 => direction of growth unknown */
|
||||
|
||||
#ifndef STACK_DIRECTION
|
||||
#define STACK_DIRECTION 0 /* Direction unknown. */
|
||||
#endif
|
||||
# ifndef STACK_DIRECTION
|
||||
# define STACK_DIRECTION 0 /* Direction unknown. */
|
||||
# endif
|
||||
|
||||
#if STACK_DIRECTION != 0
|
||||
# if STACK_DIRECTION != 0
|
||||
|
||||
#define STACK_DIR STACK_DIRECTION /* Known at compile-time. */
|
||||
# define STACK_DIR STACK_DIRECTION /* Known at compile-time. */
|
||||
|
||||
#else /* STACK_DIRECTION == 0; need run-time code. */
|
||||
# else /* STACK_DIRECTION == 0; need run-time code. */
|
||||
|
||||
static int stack_dir; /* 1 or -1 once known. */
|
||||
#define STACK_DIR stack_dir
|
||||
# define STACK_DIR stack_dir
|
||||
|
||||
static void
|
||||
find_stack_direction ()
|
||||
@@ -135,7 +136,7 @@ find_stack_direction ()
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* STACK_DIRECTION == 0 */
|
||||
# endif /* STACK_DIRECTION == 0 */
|
||||
|
||||
/* An "alloca header" is used to:
|
||||
(a) chain together all alloca'ed blocks;
|
||||
@@ -144,9 +145,9 @@ find_stack_direction ()
|
||||
It is very important that sizeof(header) agree with malloc
|
||||
alignment chunk size. The following default should work okay. */
|
||||
|
||||
#ifndef ALIGN_SIZE
|
||||
#define ALIGN_SIZE sizeof(double)
|
||||
#endif
|
||||
# ifndef ALIGN_SIZE
|
||||
# define ALIGN_SIZE sizeof(double)
|
||||
# endif
|
||||
|
||||
typedef union hdr
|
||||
{
|
||||
@@ -168,16 +169,15 @@ static header *last_alloca_header = NULL; /* -> last alloca header. */
|
||||
implementations of C, for example under Gould's UTX/32. */
|
||||
|
||||
pointer
|
||||
alloca (size)
|
||||
unsigned size;
|
||||
alloca (size_t size)
|
||||
{
|
||||
auto char probe; /* Probes stack depth: */
|
||||
register char *depth = ADDRESS_FUNCTION (probe);
|
||||
|
||||
#if STACK_DIRECTION == 0
|
||||
# if STACK_DIRECTION == 0
|
||||
if (STACK_DIR == 0) /* Unknown growth direction. */
|
||||
find_stack_direction ();
|
||||
#endif
|
||||
# endif
|
||||
|
||||
/* Reclaim garbage, defined as all alloca'd storage that
|
||||
was allocated from deeper in the stack than currently. */
|
||||
@@ -185,9 +185,9 @@ alloca (size)
|
||||
{
|
||||
register header *hp; /* Traverses linked list. */
|
||||
|
||||
#ifdef emacs
|
||||
# ifdef emacs
|
||||
BLOCK_INPUT;
|
||||
#endif
|
||||
# endif
|
||||
|
||||
for (hp = last_alloca_header; hp != NULL;)
|
||||
if ((STACK_DIR > 0 && hp->h.deep > depth)
|
||||
@@ -204,9 +204,9 @@ alloca (size)
|
||||
|
||||
last_alloca_header = hp; /* -> last valid storage. */
|
||||
|
||||
#ifdef emacs
|
||||
# ifdef emacs
|
||||
UNBLOCK_INPUT;
|
||||
#endif
|
||||
# endif
|
||||
}
|
||||
|
||||
if (size == 0)
|
||||
@@ -232,15 +232,15 @@ alloca (size)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined (CRAY) && defined (CRAY_STACKSEG_END)
|
||||
# if defined (CRAY) && defined (CRAY_STACKSEG_END)
|
||||
|
||||
#ifdef DEBUG_I00AFUNC
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
# ifdef DEBUG_I00AFUNC
|
||||
# include <stdio.h>
|
||||
# endif
|
||||
|
||||
#ifndef CRAY_STACK
|
||||
#define CRAY_STACK
|
||||
#ifndef CRAY2
|
||||
# ifndef CRAY_STACK
|
||||
# define CRAY_STACK
|
||||
# ifndef CRAY2
|
||||
/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */
|
||||
struct stack_control_header
|
||||
{
|
||||
@@ -292,7 +292,7 @@ struct stack_segment_linkage
|
||||
long sss7;
|
||||
};
|
||||
|
||||
#else /* CRAY2 */
|
||||
# else /* CRAY2 */
|
||||
/* The following structure defines the vector of words
|
||||
returned by the STKSTAT library routine. */
|
||||
struct stk_stat
|
||||
@@ -345,10 +345,10 @@ struct stk_trailer
|
||||
long unknown14;
|
||||
};
|
||||
|
||||
#endif /* CRAY2 */
|
||||
#endif /* not CRAY_STACK */
|
||||
# endif /* CRAY2 */
|
||||
# endif /* not CRAY_STACK */
|
||||
|
||||
#ifdef CRAY2
|
||||
# ifdef CRAY2
|
||||
/* Determine a "stack measure" for an arbitrary ADDRESS.
|
||||
I doubt that "lint" will like this much. */
|
||||
|
||||
@@ -419,7 +419,7 @@ i00afunc (long *address)
|
||||
return (result);
|
||||
}
|
||||
|
||||
#else /* not CRAY2 */
|
||||
# else /* not CRAY2 */
|
||||
/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP.
|
||||
Determine the number of the cell within the stack,
|
||||
given the address of the cell. The purpose of this
|
||||
@@ -464,9 +464,9 @@ i00afunc (long address)
|
||||
|
||||
while (!(this_segment <= address && address <= stkl))
|
||||
{
|
||||
#ifdef DEBUG_I00AFUNC
|
||||
# ifdef DEBUG_I00AFUNC
|
||||
fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl);
|
||||
#endif
|
||||
# endif
|
||||
if (pseg == 0)
|
||||
break;
|
||||
stkl = stkl - pseg;
|
||||
@@ -485,9 +485,9 @@ i00afunc (long address)
|
||||
|
||||
while (pseg != 0)
|
||||
{
|
||||
#ifdef DEBUG_I00AFUNC
|
||||
# ifdef DEBUG_I00AFUNC
|
||||
fprintf (stderr, "%011o %011o\n", pseg, size);
|
||||
#endif
|
||||
# endif
|
||||
stkl = stkl - pseg;
|
||||
ssptr = (struct stack_segment_linkage *) stkl;
|
||||
size = ssptr->sssize;
|
||||
@@ -497,8 +497,8 @@ i00afunc (long address)
|
||||
return (result);
|
||||
}
|
||||
|
||||
#endif /* not CRAY2 */
|
||||
#endif /* CRAY */
|
||||
# endif /* not CRAY2 */
|
||||
# endif /* CRAY */
|
||||
|
||||
#endif /* no alloca */
|
||||
# endif /* no alloca */
|
||||
#endif /* not GCC version 2 */
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
.TH ANSI2KNR 1 "19 Jan 1996"
|
||||
.SH NAME
|
||||
ansi2knr \- convert ANSI C to Kernighan & Ritchie C
|
||||
.SH SYNOPSIS
|
||||
.I ansi2knr
|
||||
[--varargs] input_file [output_file]
|
||||
.SH DESCRIPTION
|
||||
If no output_file is supplied, output goes to stdout.
|
||||
.br
|
||||
There are no error messages.
|
||||
.sp
|
||||
.I ansi2knr
|
||||
recognizes function definitions by seeing a non-keyword identifier at the left
|
||||
margin, followed by a left parenthesis, with a right parenthesis as the last
|
||||
character on the line, and with a left brace as the first token on the
|
||||
following line (ignoring possible intervening comments). It will recognize a
|
||||
multi-line header provided that no intervening line ends with a left or right
|
||||
brace or a semicolon. These algorithms ignore whitespace and comments, except
|
||||
that the function name must be the first thing on the line.
|
||||
.sp
|
||||
The following constructs will confuse it:
|
||||
.br
|
||||
- Any other construct that starts at the left margin and follows the
|
||||
above syntax (such as a macro or function call).
|
||||
.br
|
||||
- Some macros that tinker with the syntax of the function header.
|
||||
.sp
|
||||
The --varargs switch is obsolete, and is recognized only for
|
||||
backwards compatibility. The present version of
|
||||
.I ansi2knr
|
||||
will always attempt to convert a ... argument to va_alist and va_dcl.
|
||||
.SH AUTHOR
|
||||
L. Peter Deutsch <[email protected]> wrote the original ansi2knr and
|
||||
continues to maintain the current version; most of the code in the current
|
||||
version is his work. ansi2knr also includes contributions by Francois
|
||||
Pinard <[email protected]> and Jim Avera <[email protected]>.
|
||||
-739
@@ -1,739 +0,0 @@
|
||||
/* Copyright (C) 1989, 2000 Aladdin Enterprises. All rights reserved. */
|
||||
|
||||
/*$Id$*/
|
||||
/* Convert ANSI C function definitions to K&R ("traditional C") syntax */
|
||||
|
||||
/*
|
||||
ansi2knr is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY. No author or distributor accepts responsibility to anyone for the
|
||||
consequences of using it or for whether it serves any particular purpose or
|
||||
works at all, unless he says so in writing. Refer to the GNU General Public
|
||||
License (the "GPL") for full details.
|
||||
|
||||
Everyone is granted permission to copy, modify and redistribute ansi2knr,
|
||||
but only under the conditions described in the GPL. A copy of this license
|
||||
is supposed to have been given to you along with ansi2knr so you can know
|
||||
your rights and responsibilities. It should be in a file named COPYLEFT,
|
||||
or, if there is no file named COPYLEFT, a file named COPYING. Among other
|
||||
things, the copyright notice and this notice must be preserved on all
|
||||
copies.
|
||||
|
||||
We explicitly state here what we believe is already implied by the GPL: if
|
||||
the ansi2knr program is distributed as a separate set of sources and a
|
||||
separate executable file which are aggregated on a storage medium together
|
||||
with another program, this in itself does not bring the other program under
|
||||
the GPL, nor does the mere fact that such a program or the procedures for
|
||||
constructing it invoke the ansi2knr executable bring any other part of the
|
||||
program under the GPL.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Usage:
|
||||
ansi2knr [--filename FILENAME] [INPUT_FILE [OUTPUT_FILE]]
|
||||
* --filename provides the file name for the #line directive in the output,
|
||||
* overriding input_file (if present).
|
||||
* If no input_file is supplied, input is read from stdin.
|
||||
* If no output_file is supplied, output goes to stdout.
|
||||
* There are no error messages.
|
||||
*
|
||||
* ansi2knr recognizes function definitions by seeing a non-keyword
|
||||
* identifier at the left margin, followed by a left parenthesis, with a
|
||||
* right parenthesis as the last character on the line, and with a left
|
||||
* brace as the first token on the following line (ignoring possible
|
||||
* intervening comments and/or preprocessor directives), except that a line
|
||||
* consisting of only
|
||||
* identifier1(identifier2)
|
||||
* will not be considered a function definition unless identifier2 is
|
||||
* the word "void", and a line consisting of
|
||||
* identifier1(identifier2, <<arbitrary>>)
|
||||
* will not be considered a function definition.
|
||||
* ansi2knr will recognize a multi-line header provided that no intervening
|
||||
* line ends with a left or right brace or a semicolon. These algorithms
|
||||
* ignore whitespace, comments, and preprocessor directives, except that
|
||||
* the function name must be the first thing on the line. The following
|
||||
* constructs will confuse it:
|
||||
* - Any other construct that starts at the left margin and
|
||||
* follows the above syntax (such as a macro or function call).
|
||||
* - Some macros that tinker with the syntax of function headers.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The original and principal author of ansi2knr is L. Peter Deutsch
|
||||
* <[email protected]>. Other authors are noted in the change history
|
||||
* that follows (in reverse chronological order):
|
||||
|
||||
lpd 2000-04-12 backs out Eggert's changes because of bugs:
|
||||
- concatlits didn't declare the type of its bufend argument;
|
||||
- concatlits didn't't recognize when it was inside a comment;
|
||||
- scanstring could scan backward past the beginning of the string; when
|
||||
- the check for \ + newline in scanstring was unnecessary.
|
||||
|
||||
2000-03-05 Paul Eggert <[email protected]>
|
||||
|
||||
Add support for concatenated string literals.
|
||||
* ansi2knr.c (concatlits): New decl.
|
||||
(main): Invoke concatlits to concatenate string literals.
|
||||
(scanstring): Handle backslash-newline correctly. Work with
|
||||
character constants. Fix bug when scanning backwards through
|
||||
backslash-quote. Check for unterminated strings.
|
||||
(convert1): Parse character constants, too.
|
||||
(appendline, concatlits): New functions.
|
||||
* ansi2knr.1: Document this.
|
||||
|
||||
lpd 1999-08-17 added code to allow preprocessor directives
|
||||
wherever comments are allowed
|
||||
lpd 1999-04-12 added minor fixes from Pavel Roskin
|
||||
<[email protected]> for clean compilation with
|
||||
gcc -W -Wall
|
||||
lpd 1999-03-22 added hack to recognize lines consisting of
|
||||
identifier1(identifier2, xxx) as *not* being procedures
|
||||
lpd 1999-02-03 made indentation of preprocessor commands consistent
|
||||
lpd 1999-01-28 fixed two bugs: a '/' in an argument list caused an
|
||||
endless loop; quoted strings within an argument list
|
||||
confused the parser
|
||||
lpd 1999-01-24 added a check for write errors on the output,
|
||||
suggested by Jim Meyering <[email protected]>
|
||||
lpd 1998-11-09 added further hack to recognize identifier(void)
|
||||
as being a procedure
|
||||
lpd 1998-10-23 added hack to recognize lines consisting of
|
||||
identifier1(identifier2) as *not* being procedures
|
||||
lpd 1997-12-08 made input_file optional; only closes input and/or
|
||||
output file if not stdin or stdout respectively; prints
|
||||
usage message on stderr rather than stdout; adds
|
||||
--filename switch (changes suggested by
|
||||
<[email protected]>)
|
||||
lpd 1996-01-21 added code to cope with not HAVE_CONFIG_H and with
|
||||
compilers that don't understand void, as suggested by
|
||||
Tom Lane
|
||||
lpd 1996-01-15 changed to require that the first non-comment token
|
||||
on the line following a function header be a left brace,
|
||||
to reduce sensitivity to macros, as suggested by Tom Lane
|
||||
<[email protected]>
|
||||
lpd 1995-06-22 removed #ifndefs whose sole purpose was to define
|
||||
undefined preprocessor symbols as 0; changed all #ifdefs
|
||||
for configuration symbols to #ifs
|
||||
lpd 1995-04-05 changed copyright notice to make it clear that
|
||||
including ansi2knr in a program does not bring the entire
|
||||
program under the GPL
|
||||
lpd 1994-12-18 added conditionals for systems where ctype macros
|
||||
don't handle 8-bit characters properly, suggested by
|
||||
Francois Pinard <[email protected]>;
|
||||
removed --varargs switch (this is now the default)
|
||||
lpd 1994-10-10 removed CONFIG_BROKETS conditional
|
||||
lpd 1994-07-16 added some conditionals to help GNU `configure',
|
||||
suggested by Francois Pinard <[email protected]>;
|
||||
properly erase prototype args in function parameters,
|
||||
contributed by Jim Avera <[email protected]>;
|
||||
correct error in writeblanks (it shouldn't erase EOLs)
|
||||
lpd 1989-xx-xx original version
|
||||
*/
|
||||
|
||||
/* Most of the conditionals here are to make ansi2knr work with */
|
||||
/* or without the GNU configure machinery. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
|
||||
/*
|
||||
For properly autoconfiguring ansi2knr, use AC_CONFIG_HEADER(config.h).
|
||||
This will define HAVE_CONFIG_H and so, activate the following lines.
|
||||
*/
|
||||
|
||||
# if STDC_HEADERS || HAVE_STRING_H
|
||||
# include <string.h>
|
||||
# else
|
||||
# include <strings.h>
|
||||
# endif
|
||||
|
||||
#else /* not HAVE_CONFIG_H */
|
||||
|
||||
/* Otherwise do it the hard way */
|
||||
|
||||
# ifdef BSD
|
||||
# include <strings.h>
|
||||
# else
|
||||
# ifdef VMS
|
||||
extern int strlen(), strncmp();
|
||||
# else
|
||||
# include <string.h>
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif /* not HAVE_CONFIG_H */
|
||||
|
||||
#if STDC_HEADERS
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
/*
|
||||
malloc and free should be declared in stdlib.h,
|
||||
but if you've got a K&R compiler, they probably aren't.
|
||||
*/
|
||||
# ifdef MSDOS
|
||||
# include <malloc.h>
|
||||
# else
|
||||
# ifdef VMS
|
||||
extern char *malloc();
|
||||
extern void free();
|
||||
# else
|
||||
extern char *malloc();
|
||||
extern int free();
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
/* Define NULL (for *very* old compilers). */
|
||||
#ifndef NULL
|
||||
# define NULL (0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The ctype macros don't always handle 8-bit characters correctly.
|
||||
* Compensate for this here.
|
||||
*/
|
||||
#ifdef isascii
|
||||
# undef HAVE_ISASCII /* just in case */
|
||||
# define HAVE_ISASCII 1
|
||||
#else
|
||||
#endif
|
||||
#if STDC_HEADERS || !HAVE_ISASCII
|
||||
# define is_ascii(c) 1
|
||||
#else
|
||||
# define is_ascii(c) isascii(c)
|
||||
#endif
|
||||
|
||||
#define is_space(c) (is_ascii(c) && isspace(c))
|
||||
#define is_alpha(c) (is_ascii(c) && isalpha(c))
|
||||
#define is_alnum(c) (is_ascii(c) && isalnum(c))
|
||||
|
||||
/* Scanning macros */
|
||||
#define isidchar(ch) (is_alnum(ch) || (ch) == '_')
|
||||
#define isidfirstchar(ch) (is_alpha(ch) || (ch) == '_')
|
||||
|
||||
/* Forward references */
|
||||
char *ppdirforward();
|
||||
char *ppdirbackward();
|
||||
char *skipspace();
|
||||
char *scanstring();
|
||||
int writeblanks();
|
||||
int test1();
|
||||
int convert1();
|
||||
|
||||
/* The main program */
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{ FILE *in = stdin;
|
||||
FILE *out = stdout;
|
||||
char *filename = 0;
|
||||
char *program_name = argv[0];
|
||||
char *output_name = 0;
|
||||
#define bufsize 5000 /* arbitrary size */
|
||||
char *buf;
|
||||
char *line;
|
||||
char *more;
|
||||
char *usage =
|
||||
"Usage: ansi2knr [--filename FILENAME] [INPUT_FILE [OUTPUT_FILE]]\n";
|
||||
/*
|
||||
* In previous versions, ansi2knr recognized a --varargs switch.
|
||||
* If this switch was supplied, ansi2knr would attempt to convert
|
||||
* a ... argument to va_alist and va_dcl; if this switch was not
|
||||
* supplied, ansi2knr would simply drop any such arguments.
|
||||
* Now, ansi2knr always does this conversion, and we only
|
||||
* check for this switch for backward compatibility.
|
||||
*/
|
||||
int convert_varargs = 1;
|
||||
int output_error;
|
||||
|
||||
while ( argc > 1 && argv[1][0] == '-' ) {
|
||||
if ( !strcmp(argv[1], "--varargs") ) {
|
||||
convert_varargs = 1;
|
||||
argc--;
|
||||
argv++;
|
||||
continue;
|
||||
}
|
||||
if ( !strcmp(argv[1], "--filename") && argc > 2 ) {
|
||||
filename = argv[2];
|
||||
argc -= 2;
|
||||
argv += 2;
|
||||
continue;
|
||||
}
|
||||
fprintf(stderr, "%s: Unrecognized switch: %s\n", program_name,
|
||||
argv[1]);
|
||||
fprintf(stderr, usage);
|
||||
exit(1);
|
||||
}
|
||||
switch ( argc )
|
||||
{
|
||||
default:
|
||||
fprintf(stderr, usage);
|
||||
exit(0);
|
||||
case 3:
|
||||
output_name = argv[2];
|
||||
out = fopen(output_name, "w");
|
||||
if ( out == NULL ) {
|
||||
fprintf(stderr, "%s: Cannot open output file %s\n",
|
||||
program_name, output_name);
|
||||
exit(1);
|
||||
}
|
||||
/* falls through */
|
||||
case 2:
|
||||
in = fopen(argv[1], "r");
|
||||
if ( in == NULL ) {
|
||||
fprintf(stderr, "%s: Cannot open input file %s\n",
|
||||
program_name, argv[1]);
|
||||
exit(1);
|
||||
}
|
||||
if ( filename == 0 )
|
||||
filename = argv[1];
|
||||
/* falls through */
|
||||
case 1:
|
||||
break;
|
||||
}
|
||||
if ( filename )
|
||||
fprintf(out, "#line 1 \"%s\"\n", filename);
|
||||
buf = malloc(bufsize);
|
||||
if ( buf == NULL )
|
||||
{
|
||||
fprintf(stderr, "Unable to allocate read buffer!\n");
|
||||
exit(1);
|
||||
}
|
||||
line = buf;
|
||||
while ( fgets(line, (unsigned)(buf + bufsize - line), in) != NULL )
|
||||
{
|
||||
test: line += strlen(line);
|
||||
switch ( test1(buf) )
|
||||
{
|
||||
case 2: /* a function header */
|
||||
convert1(buf, out, 1, convert_varargs);
|
||||
break;
|
||||
case 1: /* a function */
|
||||
/* Check for a { at the start of the next line. */
|
||||
more = ++line;
|
||||
f: if ( line >= buf + (bufsize - 1) ) /* overflow check */
|
||||
goto wl;
|
||||
if ( fgets(line, (unsigned)(buf + bufsize - line), in) == NULL )
|
||||
goto wl;
|
||||
switch ( *skipspace(ppdirforward(more), 1) )
|
||||
{
|
||||
case '{':
|
||||
/* Definitely a function header. */
|
||||
convert1(buf, out, 0, convert_varargs);
|
||||
fputs(more, out);
|
||||
break;
|
||||
case 0:
|
||||
/* The next line was blank or a comment: */
|
||||
/* keep scanning for a non-comment. */
|
||||
line += strlen(line);
|
||||
goto f;
|
||||
default:
|
||||
/* buf isn't a function header, but */
|
||||
/* more might be. */
|
||||
fputs(buf, out);
|
||||
strcpy(buf, more);
|
||||
line = buf;
|
||||
goto test;
|
||||
}
|
||||
break;
|
||||
case -1: /* maybe the start of a function */
|
||||
if ( line != buf + (bufsize - 1) ) /* overflow check */
|
||||
continue;
|
||||
/* falls through */
|
||||
default: /* not a function */
|
||||
wl: fputs(buf, out);
|
||||
break;
|
||||
}
|
||||
line = buf;
|
||||
}
|
||||
if ( line != buf )
|
||||
fputs(buf, out);
|
||||
free(buf);
|
||||
if ( output_name ) {
|
||||
output_error = ferror(out);
|
||||
output_error |= fclose(out);
|
||||
} else { /* out == stdout */
|
||||
fflush(out);
|
||||
output_error = ferror(out);
|
||||
}
|
||||
if ( output_error ) {
|
||||
fprintf(stderr, "%s: error writing to %s\n", program_name,
|
||||
(output_name ? output_name : "stdout"));
|
||||
exit(1);
|
||||
}
|
||||
if ( in != stdin )
|
||||
fclose(in);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Skip forward or backward over one or more preprocessor directives.
|
||||
*/
|
||||
char *
|
||||
ppdirforward(p)
|
||||
char *p;
|
||||
{
|
||||
for (; *p == '#'; ++p) {
|
||||
for (; *p != '\r' && *p != '\n'; ++p)
|
||||
if (*p == 0)
|
||||
return p;
|
||||
if (*p == '\r' && p[1] == '\n')
|
||||
++p;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
char *
|
||||
ppdirbackward(p, limit)
|
||||
char *p;
|
||||
char *limit;
|
||||
{
|
||||
char *np = p;
|
||||
|
||||
for (;; p = --np) {
|
||||
if (*np == '\n' && np[-1] == '\r')
|
||||
--np;
|
||||
for (; np > limit && np[-1] != '\r' && np[-1] != '\n'; --np)
|
||||
if (np[-1] == 0)
|
||||
return np;
|
||||
if (*np != '#')
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Skip over whitespace, comments, and preprocessor directives,
|
||||
* in either direction.
|
||||
*/
|
||||
char *
|
||||
skipspace(p, dir)
|
||||
char *p;
|
||||
int dir; /* 1 for forward, -1 for backward */
|
||||
{
|
||||
for ( ; ; ) {
|
||||
while ( is_space(*p) )
|
||||
p += dir;
|
||||
if ( !(*p == '/' && p[dir] == '*') )
|
||||
break;
|
||||
p += dir; p += dir;
|
||||
while ( !(*p == '*' && p[dir] == '/') ) {
|
||||
if ( *p == 0 )
|
||||
return p; /* multi-line comment?? */
|
||||
p += dir;
|
||||
}
|
||||
p += dir; p += dir;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
/* Scan over a quoted string, in either direction. */
|
||||
char *
|
||||
scanstring(p, dir)
|
||||
char *p;
|
||||
int dir;
|
||||
{
|
||||
for (p += dir; ; p += dir)
|
||||
if (*p == '"' && p[-dir] != '\\')
|
||||
return p + dir;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write blanks over part of a string.
|
||||
* Don't overwrite end-of-line characters.
|
||||
*/
|
||||
int
|
||||
writeblanks(start, end)
|
||||
char *start;
|
||||
char *end;
|
||||
{ char *p;
|
||||
for ( p = start; p < end; p++ )
|
||||
if ( *p != '\r' && *p != '\n' )
|
||||
*p = ' ';
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Test whether the string in buf is a function definition.
|
||||
* The string may contain and/or end with a newline.
|
||||
* Return as follows:
|
||||
* 0 - definitely not a function definition;
|
||||
* 1 - definitely a function definition;
|
||||
* 2 - definitely a function prototype (NOT USED);
|
||||
* -1 - may be the beginning of a function definition,
|
||||
* append another line and look again.
|
||||
* The reason we don't attempt to convert function prototypes is that
|
||||
* Ghostscript's declaration-generating macros look too much like
|
||||
* prototypes, and confuse the algorithms.
|
||||
*/
|
||||
int
|
||||
test1(buf)
|
||||
char *buf;
|
||||
{ char *p = buf;
|
||||
char *bend;
|
||||
char *endfn;
|
||||
int contin;
|
||||
|
||||
if ( !isidfirstchar(*p) )
|
||||
return 0; /* no name at left margin */
|
||||
bend = skipspace(ppdirbackward(buf + strlen(buf) - 1, buf), -1);
|
||||
switch ( *bend )
|
||||
{
|
||||
case ';': contin = 0 /*2*/; break;
|
||||
case ')': contin = 1; break;
|
||||
case '{': return 0; /* not a function */
|
||||
case '}': return 0; /* not a function */
|
||||
default: contin = -1;
|
||||
}
|
||||
while ( isidchar(*p) )
|
||||
p++;
|
||||
endfn = p;
|
||||
p = skipspace(p, 1);
|
||||
if ( *p++ != '(' )
|
||||
return 0; /* not a function */
|
||||
p = skipspace(p, 1);
|
||||
if ( *p == ')' )
|
||||
return 0; /* no parameters */
|
||||
/* Check that the apparent function name isn't a keyword. */
|
||||
/* We only need to check for keywords that could be followed */
|
||||
/* by a left parenthesis (which, unfortunately, is most of them). */
|
||||
{ static char *words[] =
|
||||
{ "asm", "auto", "case", "char", "const", "double",
|
||||
"extern", "float", "for", "if", "int", "long",
|
||||
"register", "return", "short", "signed", "sizeof",
|
||||
"static", "switch", "typedef", "unsigned",
|
||||
"void", "volatile", "while", 0
|
||||
};
|
||||
char **key = words;
|
||||
char *kp;
|
||||
unsigned len = endfn - buf;
|
||||
|
||||
while ( (kp = *key) != 0 )
|
||||
{ if ( strlen(kp) == len && !strncmp(kp, buf, len) )
|
||||
return 0; /* name is a keyword */
|
||||
key++;
|
||||
}
|
||||
}
|
||||
{
|
||||
char *id = p;
|
||||
int len;
|
||||
/*
|
||||
* Check for identifier1(identifier2) and not
|
||||
* identifier1(void), or identifier1(identifier2, xxxx).
|
||||
*/
|
||||
|
||||
while ( isidchar(*p) )
|
||||
p++;
|
||||
len = p - id;
|
||||
p = skipspace(p, 1);
|
||||
if (*p == ',' ||
|
||||
(*p == ')' && (len != 4 || strncmp(id, "void", 4)))
|
||||
)
|
||||
return 0; /* not a function */
|
||||
}
|
||||
/*
|
||||
* If the last significant character was a ), we need to count
|
||||
* parentheses, because it might be part of a formal parameter
|
||||
* that is a procedure.
|
||||
*/
|
||||
if (contin > 0) {
|
||||
int level = 0;
|
||||
|
||||
for (p = skipspace(buf, 1); *p; p = skipspace(p + 1, 1))
|
||||
level += (*p == '(' ? 1 : *p == ')' ? -1 : 0);
|
||||
if (level > 0)
|
||||
contin = -1;
|
||||
}
|
||||
return contin;
|
||||
}
|
||||
|
||||
/* Convert a recognized function definition or header to K&R syntax. */
|
||||
int
|
||||
convert1(buf, out, header, convert_varargs)
|
||||
char *buf;
|
||||
FILE *out;
|
||||
int header; /* Boolean */
|
||||
int convert_varargs; /* Boolean */
|
||||
{ char *endfn;
|
||||
char *p;
|
||||
/*
|
||||
* The breaks table contains pointers to the beginning and end
|
||||
* of each argument.
|
||||
*/
|
||||
char **breaks;
|
||||
unsigned num_breaks = 2; /* for testing */
|
||||
char **btop;
|
||||
char **bp;
|
||||
char **ap;
|
||||
char *vararg = 0;
|
||||
|
||||
/* Pre-ANSI implementations don't agree on whether strchr */
|
||||
/* is called strchr or index, so we open-code it here. */
|
||||
for ( endfn = buf; *(endfn++) != '('; )
|
||||
;
|
||||
top: p = endfn;
|
||||
breaks = (char **)malloc(sizeof(char *) * num_breaks * 2);
|
||||
if ( breaks == NULL )
|
||||
{ /* Couldn't allocate break table, give up */
|
||||
fprintf(stderr, "Unable to allocate break table!\n");
|
||||
fputs(buf, out);
|
||||
return -1;
|
||||
}
|
||||
btop = breaks + num_breaks * 2 - 2;
|
||||
bp = breaks;
|
||||
/* Parse the argument list */
|
||||
do
|
||||
{ int level = 0;
|
||||
char *lp = NULL;
|
||||
char *rp = NULL;
|
||||
char *end = NULL;
|
||||
|
||||
if ( bp >= btop )
|
||||
{ /* Filled up break table. */
|
||||
/* Allocate a bigger one and start over. */
|
||||
free((char *)breaks);
|
||||
num_breaks <<= 1;
|
||||
goto top;
|
||||
}
|
||||
*bp++ = p;
|
||||
/* Find the end of the argument */
|
||||
for ( ; end == NULL; p++ )
|
||||
{ switch(*p)
|
||||
{
|
||||
case ',':
|
||||
if ( !level ) end = p;
|
||||
break;
|
||||
case '(':
|
||||
if ( !level ) lp = p;
|
||||
level++;
|
||||
break;
|
||||
case ')':
|
||||
if ( --level < 0 ) end = p;
|
||||
else rp = p;
|
||||
break;
|
||||
case '/':
|
||||
if (p[1] == '*')
|
||||
p = skipspace(p, 1) - 1;
|
||||
break;
|
||||
case '"':
|
||||
p = scanstring(p, 1) - 1;
|
||||
break;
|
||||
default:
|
||||
;
|
||||
}
|
||||
}
|
||||
/* Erase any embedded prototype parameters. */
|
||||
if ( lp && rp )
|
||||
writeblanks(lp + 1, rp);
|
||||
p--; /* back up over terminator */
|
||||
/* Find the name being declared. */
|
||||
/* This is complicated because of procedure and */
|
||||
/* array modifiers. */
|
||||
for ( ; ; )
|
||||
{ p = skipspace(p - 1, -1);
|
||||
switch ( *p )
|
||||
{
|
||||
case ']': /* skip array dimension(s) */
|
||||
case ')': /* skip procedure args OR name */
|
||||
{ int level = 1;
|
||||
while ( level )
|
||||
switch ( *--p )
|
||||
{
|
||||
case ']': case ')':
|
||||
level++;
|
||||
break;
|
||||
case '[': case '(':
|
||||
level--;
|
||||
break;
|
||||
case '/':
|
||||
if (p > buf && p[-1] == '*')
|
||||
p = skipspace(p, -1) + 1;
|
||||
break;
|
||||
case '"':
|
||||
p = scanstring(p, -1) + 1;
|
||||
break;
|
||||
default: ;
|
||||
}
|
||||
}
|
||||
if ( *p == '(' && *skipspace(p + 1, 1) == '*' )
|
||||
{ /* We found the name being declared */
|
||||
while ( !isidfirstchar(*p) )
|
||||
p = skipspace(p, 1) + 1;
|
||||
goto found;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
goto found;
|
||||
}
|
||||
}
|
||||
found: if ( *p == '.' && p[-1] == '.' && p[-2] == '.' )
|
||||
{ if ( convert_varargs )
|
||||
{ *bp++ = "va_alist";
|
||||
vararg = p-2;
|
||||
}
|
||||
else
|
||||
{ p++;
|
||||
if ( bp == breaks + 1 ) /* sole argument */
|
||||
writeblanks(breaks[0], p);
|
||||
else
|
||||
writeblanks(bp[-1] - 1, p);
|
||||
bp--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ while ( isidchar(*p) ) p--;
|
||||
*bp++ = p+1;
|
||||
}
|
||||
p = end;
|
||||
}
|
||||
while ( *p++ == ',' );
|
||||
*bp = p;
|
||||
/* Make a special check for 'void' arglist */
|
||||
if ( bp == breaks+2 )
|
||||
{ p = skipspace(breaks[0], 1);
|
||||
if ( !strncmp(p, "void", 4) )
|
||||
{ p = skipspace(p+4, 1);
|
||||
if ( p == breaks[2] - 1 )
|
||||
{ bp = breaks; /* yup, pretend arglist is empty */
|
||||
writeblanks(breaks[0], p + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Put out the function name and left parenthesis. */
|
||||
p = buf;
|
||||
while ( p != endfn ) putc(*p, out), p++;
|
||||
/* Put out the declaration. */
|
||||
if ( header )
|
||||
{ fputs(");", out);
|
||||
for ( p = breaks[0]; *p; p++ )
|
||||
if ( *p == '\r' || *p == '\n' )
|
||||
putc(*p, out);
|
||||
}
|
||||
else
|
||||
{ for ( ap = breaks+1; ap < bp; ap += 2 )
|
||||
{ p = *ap;
|
||||
while ( isidchar(*p) )
|
||||
putc(*p, out), p++;
|
||||
if ( ap < bp - 1 )
|
||||
fputs(", ", out);
|
||||
}
|
||||
fputs(") ", out);
|
||||
/* Put out the argument declarations */
|
||||
for ( ap = breaks+2; ap <= bp; ap += 2 )
|
||||
(*ap)[-1] = ';';
|
||||
if ( vararg != 0 )
|
||||
{ *vararg = 0;
|
||||
fputs(breaks[0], out); /* any prior args */
|
||||
fputs("va_dcl", out); /* the final arg */
|
||||
fputs(bp[0], out);
|
||||
}
|
||||
else
|
||||
fputs(breaks[0], out);
|
||||
}
|
||||
free((char *)breaks);
|
||||
return 0;
|
||||
}
|
||||
+309
@@ -0,0 +1,309 @@
|
||||
/* argmatch.c -- find a match for a string in an array
|
||||
Copyright (C) 1990, 1998, 1999, 2001 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Written by David MacKenzie <[email protected]>
|
||||
Modified by Akim Demaille <[email protected]> */
|
||||
|
||||
#include "argmatch.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef STDC_HEADERS
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_LOCALE_H
|
||||
# include <locale.h>
|
||||
#endif
|
||||
|
||||
#if ENABLE_NLS
|
||||
# include <libintl.h>
|
||||
# define _(Text) gettext (Text)
|
||||
#else
|
||||
# define _(Text) Text
|
||||
#endif
|
||||
|
||||
#include "error.h"
|
||||
#include "quotearg.h"
|
||||
#include "quote.h"
|
||||
|
||||
/* When reporting an invalid argument, show nonprinting characters
|
||||
by using the quoting style ARGMATCH_QUOTING_STYLE. Do not use
|
||||
literal_quoting_style. */
|
||||
#ifndef ARGMATCH_QUOTING_STYLE
|
||||
# define ARGMATCH_QUOTING_STYLE locale_quoting_style
|
||||
#endif
|
||||
|
||||
/* The following test is to work around the gross typo in
|
||||
systems like Sony NEWS-OS Release 4.0C, whereby EXIT_FAILURE
|
||||
is defined to 0, not 1. */
|
||||
#if !EXIT_FAILURE
|
||||
# undef EXIT_FAILURE
|
||||
# define EXIT_FAILURE 1
|
||||
#endif
|
||||
|
||||
/* Non failing version of argmatch call this function after failing. */
|
||||
#ifndef ARGMATCH_DIE
|
||||
# define ARGMATCH_DIE exit (EXIT_FAILURE)
|
||||
#endif
|
||||
|
||||
#ifdef ARGMATCH_DIE_DECL
|
||||
ARGMATCH_DIE_DECL;
|
||||
#endif
|
||||
|
||||
static void
|
||||
__argmatch_die (void)
|
||||
{
|
||||
ARGMATCH_DIE;
|
||||
}
|
||||
|
||||
/* Used by XARGMATCH and XARGCASEMATCH. See description in argmatch.h.
|
||||
Default to __argmatch_die, but allow caller to change this at run-time. */
|
||||
argmatch_exit_fn argmatch_die = __argmatch_die;
|
||||
|
||||
|
||||
/* If ARG is an unambiguous match for an element of the
|
||||
null-terminated array ARGLIST, return the index in ARGLIST
|
||||
of the matched element, else -1 if it does not match any element
|
||||
or -2 if it is ambiguous (is a prefix of more than one element).
|
||||
If SENSITIVE, comparison is case sensitive.
|
||||
|
||||
If VALLIST is none null, use it to resolve ambiguities limited to
|
||||
synonyms, i.e., for
|
||||
"yes", "yop" -> 0
|
||||
"no", "nope" -> 1
|
||||
"y" is a valid argument, for `0', and "n" for `1'. */
|
||||
|
||||
static int
|
||||
__argmatch_internal (const char *arg, const char *const *arglist,
|
||||
const char *vallist, size_t valsize,
|
||||
int case_sensitive)
|
||||
{
|
||||
int i; /* Temporary index in ARGLIST. */
|
||||
size_t arglen; /* Length of ARG. */
|
||||
int matchind = -1; /* Index of first nonexact match. */
|
||||
int ambiguous = 0; /* If nonzero, multiple nonexact match(es). */
|
||||
|
||||
arglen = strlen (arg);
|
||||
|
||||
/* Test all elements for either exact match or abbreviated matches. */
|
||||
for (i = 0; arglist[i]; i++)
|
||||
{
|
||||
if (case_sensitive
|
||||
? !strncmp (arglist[i], arg, arglen)
|
||||
: !strncasecmp (arglist[i], arg, arglen))
|
||||
{
|
||||
if (strlen (arglist[i]) == arglen)
|
||||
/* Exact match found. */
|
||||
return i;
|
||||
else if (matchind == -1)
|
||||
/* First nonexact match found. */
|
||||
matchind = i;
|
||||
else
|
||||
{
|
||||
/* Second nonexact match found. */
|
||||
if (vallist == NULL
|
||||
|| memcmp (vallist + valsize * matchind,
|
||||
vallist + valsize * i, valsize))
|
||||
{
|
||||
/* There is a real ambiguity, or we could not
|
||||
disambiguate. */
|
||||
ambiguous = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ambiguous)
|
||||
return -2;
|
||||
else
|
||||
return matchind;
|
||||
}
|
||||
|
||||
/* argmatch - case sensitive version */
|
||||
int
|
||||
argmatch (const char *arg, const char *const *arglist,
|
||||
const char *vallist, size_t valsize)
|
||||
{
|
||||
return __argmatch_internal (arg, arglist, vallist, valsize, 1);
|
||||
}
|
||||
|
||||
/* argcasematch - case insensitive version */
|
||||
int
|
||||
argcasematch (const char *arg, const char *const *arglist,
|
||||
const char *vallist, size_t valsize)
|
||||
{
|
||||
return __argmatch_internal (arg, arglist, vallist, valsize, 0);
|
||||
}
|
||||
|
||||
/* Error reporting for argmatch.
|
||||
CONTEXT is a description of the type of entity that was being matched.
|
||||
VALUE is the invalid value that was given.
|
||||
PROBLEM is the return value from argmatch. */
|
||||
|
||||
void
|
||||
argmatch_invalid (const char *context, const char *value, int problem)
|
||||
{
|
||||
char const *format = (problem == -1
|
||||
? _("invalid argument %s for %s")
|
||||
: _("ambiguous argument %s for %s"));
|
||||
|
||||
error (0, 0, format, quotearg_n_style (0, ARGMATCH_QUOTING_STYLE, value),
|
||||
quote_n (1, context));
|
||||
}
|
||||
|
||||
/* List the valid arguments for argmatch.
|
||||
ARGLIST is the same as in argmatch.
|
||||
VALLIST is a pointer to an array of values.
|
||||
VALSIZE is the size of the elements of VALLIST */
|
||||
void
|
||||
argmatch_valid (const char *const *arglist,
|
||||
const char *vallist, size_t valsize)
|
||||
{
|
||||
int i;
|
||||
const char *last_val = NULL;
|
||||
|
||||
/* We try to put synonyms on the same line. The assumption is that
|
||||
synonyms follow each other */
|
||||
fprintf (stderr, _("Valid arguments are:"));
|
||||
for (i = 0; arglist[i]; i++)
|
||||
if ((i == 0)
|
||||
|| memcmp (last_val, vallist + valsize * i, valsize))
|
||||
{
|
||||
fprintf (stderr, "\n - `%s'", arglist[i]);
|
||||
last_val = vallist + valsize * i;
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (stderr, ", `%s'", arglist[i]);
|
||||
}
|
||||
putc ('\n', stderr);
|
||||
}
|
||||
|
||||
/* Never failing versions of the previous functions.
|
||||
|
||||
CONTEXT is the context for which argmatch is called (e.g.,
|
||||
"--version-control", or "$VERSION_CONTROL" etc.). Upon failure,
|
||||
calls the (supposed never to return) function EXIT_FN. */
|
||||
|
||||
int
|
||||
__xargmatch_internal (const char *context,
|
||||
const char *arg, const char *const *arglist,
|
||||
const char *vallist, size_t valsize,
|
||||
int case_sensitive,
|
||||
argmatch_exit_fn exit_fn)
|
||||
{
|
||||
int res = __argmatch_internal (arg, arglist,
|
||||
vallist, valsize,
|
||||
case_sensitive);
|
||||
if (res >= 0)
|
||||
/* Success. */
|
||||
return res;
|
||||
|
||||
/* We failed. Explain why. */
|
||||
argmatch_invalid (context, arg, res);
|
||||
argmatch_valid (arglist, vallist, valsize);
|
||||
(*exit_fn) ();
|
||||
|
||||
return -1; /* To please the compilers. */
|
||||
}
|
||||
|
||||
/* Look for VALUE in VALLIST, an array of objects of size VALSIZE and
|
||||
return the first corresponding argument in ARGLIST */
|
||||
const char *
|
||||
argmatch_to_argument (const char *value,
|
||||
const char *const *arglist,
|
||||
const char *vallist, size_t valsize)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; arglist[i]; i++)
|
||||
if (!memcmp (value, vallist + valsize * i, valsize))
|
||||
return arglist[i];
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef TEST
|
||||
/*
|
||||
* Based on "getversion.c" by David MacKenzie <[email protected]>
|
||||
*/
|
||||
char *program_name;
|
||||
extern const char *getenv ();
|
||||
|
||||
/* When to make backup files. */
|
||||
enum backup_type
|
||||
{
|
||||
/* Never make backups. */
|
||||
none,
|
||||
|
||||
/* Make simple backups of every file. */
|
||||
simple,
|
||||
|
||||
/* Make numbered backups of files that already have numbered backups,
|
||||
and simple backups of the others. */
|
||||
numbered_existing,
|
||||
|
||||
/* Make numbered backups of every file. */
|
||||
numbered
|
||||
};
|
||||
|
||||
/* Two tables describing arguments (keys) and their corresponding
|
||||
values */
|
||||
static const char *const backup_args[] =
|
||||
{
|
||||
"no", "none", "off",
|
||||
"simple", "never",
|
||||
"existing", "nil",
|
||||
"numbered", "t",
|
||||
0
|
||||
};
|
||||
|
||||
static const enum backup_type backup_vals[] =
|
||||
{
|
||||
none, none, none,
|
||||
simple, simple,
|
||||
numbered_existing, numbered_existing,
|
||||
numbered, numbered
|
||||
};
|
||||
|
||||
int
|
||||
main (int argc, const char *const *argv)
|
||||
{
|
||||
const char *cp;
|
||||
enum backup_type backup_type = none;
|
||||
|
||||
program_name = (char *) argv[0];
|
||||
|
||||
if (argc > 2)
|
||||
{
|
||||
fprintf (stderr, "Usage: %s [VERSION_CONTROL]\n", program_name);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
if ((cp = getenv ("VERSION_CONTROL")))
|
||||
backup_type = XARGCASEMATCH ("$VERSION_CONTROL", cp,
|
||||
backup_args, backup_vals);
|
||||
|
||||
if (argc == 2)
|
||||
backup_type = XARGCASEMATCH (program_name, argv[1],
|
||||
backup_args, backup_vals);
|
||||
|
||||
printf ("The version control is `%s'\n",
|
||||
ARGMATCH_TO_ARGUMENT (backup_type, backup_args, backup_vals));
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
+129
@@ -0,0 +1,129 @@
|
||||
/* argmatch.h -- definitions and prototypes for argmatch.c
|
||||
Copyright (C) 1990, 1998, 1999, 2001 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Written by David MacKenzie <[email protected]>
|
||||
Modified by Akim Demaille <[email protected]> */
|
||||
|
||||
#ifndef ARGMATCH_H_
|
||||
# define ARGMATCH_H_ 1
|
||||
|
||||
# if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
# endif
|
||||
|
||||
# include <sys/types.h>
|
||||
|
||||
# ifndef PARAMS
|
||||
# if PROTOTYPES || (defined (__STDC__) && __STDC__)
|
||||
# define PARAMS(args) args
|
||||
# else
|
||||
# define PARAMS(args) ()
|
||||
# endif /* GCC. */
|
||||
# endif /* Not PARAMS. */
|
||||
|
||||
/* Assert there are as many real arguments as there are values
|
||||
(argument list ends with a NULL guard). There is no execution
|
||||
cost, since it will be statically evalauted to `assert (0)' or
|
||||
`assert (1)'. Unfortunately there is no -Wassert-0. */
|
||||
|
||||
# undef ARRAY_CARDINALITY
|
||||
# define ARRAY_CARDINALITY(Array) (sizeof ((Array)) / sizeof (*(Array)))
|
||||
|
||||
# define ARGMATCH_ASSERT(Arglist, Vallist) \
|
||||
assert (ARRAY_CARDINALITY ((Arglist)) == ARRAY_CARDINALITY ((Vallist)) + 1)
|
||||
|
||||
/* Return the index of the element of ARGLIST (NULL terminated) that
|
||||
matches with ARG. If VALLIST is not NULL, then use it to resolve
|
||||
false ambiguities (i.e., different matches of ARG but corresponding
|
||||
to the same values in VALLIST). */
|
||||
|
||||
int argmatch
|
||||
PARAMS ((const char *arg, const char *const *arglist,
|
||||
const char *vallist, size_t valsize));
|
||||
int argcasematch
|
||||
PARAMS ((const char *arg, const char *const *arglist,
|
||||
const char *vallist, size_t valsize));
|
||||
|
||||
# define ARGMATCH(Arg, Arglist, Vallist) \
|
||||
argmatch ((Arg), (Arglist), (const char *) (Vallist), sizeof (*(Vallist)))
|
||||
|
||||
# define ARGCASEMATCH(Arg, Arglist, Vallist) \
|
||||
argcasematch ((Arg), (Arglist), (const char *) (Vallist), sizeof (*(Vallist)))
|
||||
|
||||
/* xargmatch calls this function when it fails. This function should not
|
||||
return. By default, this is a function that calls ARGMATCH_DIE which
|
||||
in turn defaults to `exit (EXIT_FAILURE)'. */
|
||||
typedef void (*argmatch_exit_fn) PARAMS ((void));
|
||||
extern argmatch_exit_fn argmatch_die;
|
||||
|
||||
/* Report on stderr why argmatch failed. Report correct values. */
|
||||
|
||||
void argmatch_invalid
|
||||
PARAMS ((const char *context, const char *value, int problem));
|
||||
|
||||
/* Left for compatibility with the old name invalid_arg */
|
||||
|
||||
# define invalid_arg(Context, Value, Problem) \
|
||||
argmatch_invalid ((Context), (Value), (Problem))
|
||||
|
||||
|
||||
|
||||
/* Report on stderr the list of possible arguments. */
|
||||
|
||||
void argmatch_valid
|
||||
PARAMS ((const char *const *arglist,
|
||||
const char *vallist, size_t valsize));
|
||||
|
||||
# define ARGMATCH_VALID(Arglist, Vallist) \
|
||||
argmatch_valid (Arglist, (const char *) Vallist, sizeof (*(Vallist)))
|
||||
|
||||
|
||||
|
||||
/* Same as argmatch, but upon failure, reports a explanation on the
|
||||
failure, and exits using the function EXIT_FN. */
|
||||
|
||||
int __xargmatch_internal
|
||||
PARAMS ((const char *context,
|
||||
const char *arg, const char *const *arglist,
|
||||
const char *vallist, size_t valsize,
|
||||
int case_sensitive, argmatch_exit_fn exit_fn));
|
||||
|
||||
/* Programmer friendly interface to __xargmatch_internal. */
|
||||
|
||||
# define XARGMATCH(Context, Arg, Arglist, Vallist) \
|
||||
(Vallist [__xargmatch_internal ((Context), (Arg), (Arglist), \
|
||||
(const char *) (Vallist), \
|
||||
sizeof (*(Vallist)), \
|
||||
1, argmatch_die)])
|
||||
|
||||
# define XARGCASEMATCH(Context, Arg, Arglist, Vallist) \
|
||||
(Vallist [__xargmatch_internal ((Context), (Arg), (Arglist), \
|
||||
(const char *) (Vallist), \
|
||||
sizeof (*(Vallist)), \
|
||||
0, argmatch_die)])
|
||||
|
||||
/* Convert a value into a corresponding argument. */
|
||||
|
||||
const char *argmatch_to_argument
|
||||
PARAMS ((char const *value, const char *const *arglist,
|
||||
const char *vallist, size_t valsize));
|
||||
|
||||
# define ARGMATCH_TO_ARGUMENT(Value, Arglist, Vallist) \
|
||||
argmatch_to_argument ((Value), (Arglist), \
|
||||
(const char *) (Vallist), sizeof (*(Vallist)))
|
||||
|
||||
#endif /* ARGMATCH_H_ */
|
||||
@@ -0,0 +1,79 @@
|
||||
/* basename.c -- return the last element in a path
|
||||
Copyright (C) 1990, 1998, 1999, 2000, 2001 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#if STDC_HEADERS || HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#include "dirname.h"
|
||||
|
||||
/* In general, we can't use the builtin `basename' function if available,
|
||||
since it has different meanings in different environments.
|
||||
In some environments the builtin `basename' modifies its argument.
|
||||
|
||||
Return the address of the last file name component of NAME. If
|
||||
NAME has no file name components because it is all slashes, return
|
||||
NAME if it is empty, the address of its last slash otherwise. */
|
||||
|
||||
char *
|
||||
base_name (char const *name)
|
||||
{
|
||||
char const *base = name + FILESYSTEM_PREFIX_LEN (name);
|
||||
char const *p;
|
||||
|
||||
for (p = base; *p; p++)
|
||||
{
|
||||
if (ISSLASH (*p))
|
||||
{
|
||||
/* Treat multiple adjacent slashes like a single slash. */
|
||||
do p++;
|
||||
while (ISSLASH (*p));
|
||||
|
||||
/* If the file name ends in slash, use the trailing slash as
|
||||
the basename if no non-slashes have been found. */
|
||||
if (! *p)
|
||||
{
|
||||
if (ISSLASH (*base))
|
||||
base = p - 1;
|
||||
break;
|
||||
}
|
||||
|
||||
/* *P is a non-slash preceded by a slash. */
|
||||
base = p;
|
||||
}
|
||||
}
|
||||
|
||||
return (char *) base;
|
||||
}
|
||||
|
||||
/* Return the length of of the basename NAME. Typically NAME is the
|
||||
value returned by base_name. Act like strlen (NAME), except omit
|
||||
redundant trailing slashes. */
|
||||
|
||||
size_t
|
||||
base_len (char const *name)
|
||||
{
|
||||
size_t len;
|
||||
|
||||
for (len = strlen (name); 1 < len && ISSLASH (name[len - 1]); len--)
|
||||
continue;
|
||||
|
||||
return len;
|
||||
}
|
||||
+230
@@ -0,0 +1,230 @@
|
||||
/* Base bitset stuff.
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
Contributed by Michael Hayes ([email protected]).
|
||||
|
||||
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 of the License, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _BBITSET_H
|
||||
#define _BBITSET_H
|
||||
|
||||
#include "libiberty.h"
|
||||
|
||||
#ifdef HAVE_LIMITS_H
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
/* Currently we support three flavours of bitsets:
|
||||
BITSET_ARRAY: Array of bits (fixed size, faster).
|
||||
BITSET_LIST: Linked list of array of bits (variable size, least storage
|
||||
for large very sparse sets).
|
||||
BITSET_TABLE: Expandable table of pointers to array of bits
|
||||
(variable size, less storage for large sparse sets).
|
||||
|
||||
BITSET_STATS: Wrapper bitset for internal use only.
|
||||
*/
|
||||
enum bitset_type {BITSET_ARRAY, BITSET_LIST, BITSET_TABLE, BITSET_TYPE_NUM,
|
||||
BITSET_STATS};
|
||||
#define BITSET_TYPE_NAMES {"abitset", "lbitset", "ebitset"}
|
||||
|
||||
enum bitset_alloc_type {BITSET_MALLOC, BITSET_OBALLOC};
|
||||
|
||||
/* Non-zero to use inline functions instead of macros. */
|
||||
#define BITSET_INLINE 0
|
||||
|
||||
/* Data type used to store a word of bits. */
|
||||
typedef unsigned long bitset_word;
|
||||
#define BITSET_WORD_BITS ((unsigned) (CHAR_BIT * sizeof (bitset_word)))
|
||||
|
||||
/* Bit index. In theory we might need a type wider than size_t, but
|
||||
in practice we lose at most a factor of CHAR_BIT by going with
|
||||
size_t, and that is good enough. */
|
||||
typedef size_t bitset_bindex;
|
||||
|
||||
/* Word index. */
|
||||
typedef size_t bitset_windex;
|
||||
|
||||
#define BITSET_INDEX_MAX ((bitset_word) 1 << (BITSET_WORD_BITS - 1))
|
||||
|
||||
#define BITSET_MSB ((bitset_word) 1 << (BITSET_WORD_BITS - 1))
|
||||
|
||||
#define BITSET_LIST_SIZE 1024
|
||||
|
||||
enum bitset_ops {BITSET_OP_ZERO, BITSET_OP_ONES,
|
||||
BITSET_OP_COPY, BITSET_OP_NOT,
|
||||
BITSET_OP_EMPTY_P, BITSET_OP_EQUAL_P,
|
||||
BITSET_OP_SUBSET_P, BITSET_OP_DISJOINT_P,
|
||||
BITSET_OP_AND, BITSET_OP_OR, BITSET_OP_XOR, BITSET_OP_ANDN,
|
||||
BITSET_OP_OR_AND, BITSET_OP_AND_OR, BITSET_OP_ANDN_OR};
|
||||
|
||||
/* Return size in bits of bitset SRC. */
|
||||
#define BITSET_SIZE_(SRC) (SRC)->b.ops->size (SRC)
|
||||
|
||||
/* Return type of bitset SRC. */
|
||||
#define BITSET_TYPE_(DST) (DST)->b.ops->type
|
||||
|
||||
/* Set bit BITNO in bitset DST. */
|
||||
#define BITSET_SET_(DST, BITNO) (DST)->b.ops->set (DST, BITNO)
|
||||
|
||||
/* Reset bit BITNO in bitset DST. */
|
||||
#define BITSET_RESET_(DST, BITNO) (DST)->b.ops->reset (DST, BITNO)
|
||||
|
||||
/* Return non-zero if bit BITNO in bitset SRC is set. */
|
||||
#define BITSET_TEST_(SRC, BITNO) (SRC)->b.ops->test (SRC, BITNO)
|
||||
|
||||
/* Free bitset SRC. */
|
||||
#define BITSET_FREE_(SRC)\
|
||||
((SRC)->b.ops->free ? (SRC)->b.ops->free (SRC) :(void)0)
|
||||
|
||||
/* Perform operation OP on DST. */
|
||||
#define BITSET_OP1_(DST, OP) (DST)->b.ops->op1 (DST, OP)
|
||||
|
||||
/* Perform operation OP on SRC and store in DST. */
|
||||
#define BITSET_OP2_(DST, SRC, OP) (DST)->b.ops->op2 (DST, SRC, OP)
|
||||
|
||||
/* DST = SRC1 OP SRC2. */
|
||||
#define BITSET_OP3_(DST, SRC1, SRC2, OP) \
|
||||
(DST)->b.ops->op3 (DST, SRC1, SRC2, OP)
|
||||
|
||||
/* DST = (SRC1 OP1 SRC2) OP2 SRC3. */
|
||||
#define BITSET_OP4_(DST, SRC1, SRC2, SRC3, OP) \
|
||||
(DST)->b.ops->op4 (DST, SRC1, SRC2, SRC3, OP)
|
||||
|
||||
/* DST = 0. */
|
||||
#define BITSET_ZERO_(DST) BITSET_OP1_ (DST, BITSET_OP_ZERO);
|
||||
|
||||
/* DST = ~0. */
|
||||
#define BITSET_ONES_(DST) BITSET_OP1_ (DST, BITSET_OP_ONES);
|
||||
|
||||
/* Return SRC == 0. */
|
||||
#define BITSET_EMPTY_P_(SRC) BITSET_OP1_ (SRC, BITSET_OP_EMPTY_P);
|
||||
|
||||
/* Return DST == SRC. */
|
||||
#define BITSET_EQUAL_P_(DST, SRC) BITSET_OP2_ (DST, SRC, BITSET_OP_EQUAL_P)
|
||||
|
||||
/* Return DST == DST | SRC. */
|
||||
#define BITSET_SUBSET_P_(DST, SRC) BITSET_OP2_ (DST, SRC, BITSET_OP_SUBSET_P)
|
||||
|
||||
/* Return DST & SRC == 0. */
|
||||
#define BITSET_DISJOINT_P_(DST, SRC)\
|
||||
BITSET_OP2_ (DST, SRC, BITSET_OP_DISJOINT_P)
|
||||
|
||||
/* DST = SRC. */
|
||||
#define BITSET_COPY_(DST, SRC) BITSET_OP2_ (DST, SRC, BITSET_OP_COPY)
|
||||
|
||||
/* DST = ~SRC. */
|
||||
#define BITSET_NOT_(DST, SRC) BITSET_OP2_ (DST, SRC, BITSET_OP_NOT)
|
||||
|
||||
/* DST = SRC1 | SRC2. */
|
||||
#define BITSET_OR_(DST, SRC1, SRC2) BITSET_OP3_ (DST, SRC1, SRC2,\
|
||||
BITSET_OP_OR)
|
||||
|
||||
/* DST = SRC1 ^ SRC2. */
|
||||
#define BITSET_XOR_(DST, SRC1, SRC2) BITSET_OP3_ (DST, SRC1, SRC2,\
|
||||
BITSET_OP_XOR)
|
||||
|
||||
/* DST = SRC1 & SRC2. */
|
||||
#define BITSET_AND_(DST, SRC1, SRC2) BITSET_OP3_ (DST, SRC1, SRC2, \
|
||||
BITSET_OP_AND)
|
||||
|
||||
/* DST = SRC1 & ~SRC2. */
|
||||
#define BITSET_ANDN_(DST, SRC1, SRC2) BITSET_OP3_ (DST, SRC1, SRC2, \
|
||||
BITSET_OP_ANDN)
|
||||
|
||||
/* DST = (SRC1 & SRC2) | SRC3. Return non-zero if
|
||||
DST != (SRC1 & SRC2) | SRC3. */
|
||||
#define BITSET_AND_OR_(DST, SRC1, SRC2, SRC3)\
|
||||
BITSET_OP4_ (DST, SRC1, SRC2, SRC3, BITSET_OP_AND_OR)
|
||||
|
||||
/* DST = (SRC1 | SRC2) & SRC3. Return non-zero if
|
||||
DST != (SRC1 | SRC2) & SRC3. */
|
||||
#define BITSET_OR_AND_(DST, SRC1, SRC2, SRC3)\
|
||||
BITSET_OP4_ (DST, SRC1, SRC2, SRC3, BITSET_OP_OR_AND)
|
||||
|
||||
/* DST = (SRC1 & ~SRC2) | SRC3. Return non-zero if
|
||||
DST != (SRC1 & ~SRC2) | SRC3. */
|
||||
#define BITSET_ANDN_OR_(DST, SRC1, SRC2, SRC3)\
|
||||
BITSET_OP4_ (DST, SRC1, SRC2, SRC3, BITSET_OP_ANDN_OR)
|
||||
|
||||
/* Find list of up to NUM bits set in BSET starting from and including
|
||||
*NEXT. Return with actual number of bits found and with *NEXT
|
||||
indicating where search stopped. */
|
||||
#define BITSET_LIST_(BSET, LIST, NUM, NEXT) \
|
||||
(BSET)->b.ops->list (BSET, LIST, NUM, NEXT)
|
||||
|
||||
/* Find reverse list of up to NUM bits set in BSET starting from and
|
||||
including NEXT. Return with actual number of bits found and with
|
||||
*NEXT indicating where search stopped. */
|
||||
#define BITSET_REVERSE_LIST_(BSET, LIST, NUM, NEXT) \
|
||||
(BSET)->b.ops->reverse_list (BSET, LIST, NUM, NEXT)
|
||||
|
||||
|
||||
struct bbitset_struct
|
||||
{
|
||||
struct bitset_ops_struct *ops;
|
||||
bitset_windex cindex; /* Cache word index. */
|
||||
bitset_windex csize; /* Cache size in words. */
|
||||
bitset_word *cdata; /* Cache data pointer. */
|
||||
/* Perhaps we could sacrifice another word to indicate
|
||||
that the bitset is known to be zero, that a bit has been set
|
||||
in the cache, and that a bit has been cleared in the cache.
|
||||
This would speed up some of the searches but slightly slow down
|
||||
bit set/reset operations of cached bits. */
|
||||
};
|
||||
|
||||
|
||||
typedef struct bitset_struct *bitset;
|
||||
|
||||
|
||||
/* The contents of this structure should be considered private. */
|
||||
struct bitset_ops_struct
|
||||
{
|
||||
void (*set) PARAMS ((struct bitset_struct *, bitset_bindex));
|
||||
void (*reset) PARAMS ((struct bitset_struct *, bitset_bindex));
|
||||
int (*test) PARAMS ((struct bitset_struct *, bitset_bindex));
|
||||
int (*size) PARAMS ((struct bitset_struct *));
|
||||
int (*op1) PARAMS ((struct bitset_struct *, enum bitset_ops));
|
||||
int (*op2) PARAMS ((struct bitset_struct *, struct bitset_struct *,
|
||||
enum bitset_ops));
|
||||
int (*op3) PARAMS ((struct bitset_struct *, struct bitset_struct *,
|
||||
struct bitset_struct *, enum bitset_ops));
|
||||
int (*op4) PARAMS ((struct bitset_struct *, struct bitset_struct *,
|
||||
struct bitset_struct *, struct bitset_struct *,
|
||||
enum bitset_ops));
|
||||
int (*list) PARAMS ((struct bitset_struct *, bitset_bindex *,
|
||||
bitset_bindex, bitset_bindex *));
|
||||
int (*reverse_list) PARAMS ((struct bitset_struct *, bitset_bindex *,
|
||||
bitset_bindex, bitset_bindex *));
|
||||
void (*free) PARAMS ((struct bitset_struct *));
|
||||
enum bitset_type type;
|
||||
};
|
||||
|
||||
#define BITSET_COMPATIBLE_(BSET1, BSET2) ((BSET1)->b.ops == (BSET2)->b.ops)
|
||||
|
||||
#define BITSET_CHECK2_(DST, SRC) \
|
||||
if (!BITSET_COMPATIBLE_ (DST, SRC)) abort ();
|
||||
|
||||
#define BITSET_CHECK3_(DST, SRC1, SRC2) \
|
||||
if (!BITSET_COMPATIBLE_ (DST, SRC1) \
|
||||
|| !BITSET_COMPATIBLE_ (DST, SRC2)) abort ();
|
||||
|
||||
#define BITSET_CHECK4_(DST, SRC1, SRC2, SRC3) \
|
||||
if (!BITSET_COMPATIBLE_ (DST, SRC1) || !BITSET_COMPATIBLE_ (DST, SRC2) \
|
||||
|| !BITSET_COMPATIBLE_ (DST, SRC3)) abort ();
|
||||
|
||||
|
||||
extern int bitset_op4 PARAMS ((bitset, bitset, bitset, bitset,
|
||||
enum bitset_ops op));
|
||||
|
||||
#endif /* _BBITSET_H */
|
||||
+609
@@ -0,0 +1,609 @@
|
||||
/* General bitsets.
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
Contributed by Michael Hayes ([email protected]).
|
||||
|
||||
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 of the License, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "bitset.h"
|
||||
#include "abitset.h"
|
||||
#include "lbitset.h"
|
||||
#include "ebitset.h"
|
||||
#include "bitset_stats.h"
|
||||
#include "obstack.h"
|
||||
|
||||
static void bitset_print PARAMS ((FILE *, bitset, int));
|
||||
|
||||
|
||||
/* Return number of bytes required to create a N_BIT bitset
|
||||
of TYPE. The bitset may grow to require more bytes than this. */
|
||||
int
|
||||
bitset_bytes (type, n_bits)
|
||||
enum bitset_type type;
|
||||
bitset_bindex n_bits;
|
||||
{
|
||||
unsigned int bytes;
|
||||
|
||||
if (bitset_stats_enabled)
|
||||
return bitset_stats_bytes ();
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case BITSET_ARRAY:
|
||||
bytes = abitset_bytes (n_bits);
|
||||
break;
|
||||
|
||||
case BITSET_LIST:
|
||||
bytes = lbitset_bytes (n_bits);
|
||||
break;
|
||||
|
||||
case BITSET_TABLE:
|
||||
bytes = ebitset_bytes (n_bits);
|
||||
break;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
||||
return bytes;
|
||||
}
|
||||
|
||||
|
||||
/* Initialise bitset BSET of TYPE for N_BITS. */
|
||||
bitset
|
||||
bitset_init (bset, n_bits, type)
|
||||
bitset bset;
|
||||
bitset_bindex n_bits;
|
||||
enum bitset_type type;
|
||||
{
|
||||
if (bitset_stats_enabled)
|
||||
return bitset_stats_init (bset, n_bits, type);
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case BITSET_ARRAY:
|
||||
return abitset_init (bset, n_bits);
|
||||
|
||||
case BITSET_LIST:
|
||||
return lbitset_init (bset, n_bits);
|
||||
|
||||
case BITSET_TABLE:
|
||||
return ebitset_init (bset, n_bits);
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Select a bitset type for a set of N_BITS and with attribute hints
|
||||
specified by ATTR. For variable size bitsets, N_BITS is only a
|
||||
hint and may be zero. */
|
||||
enum bitset_type
|
||||
bitset_type_choose (n_bits, attr)
|
||||
bitset_bindex n_bits ATTRIBUTE_UNUSED;
|
||||
unsigned int attr;
|
||||
{
|
||||
enum bitset_type type;
|
||||
|
||||
/* Check attributes. */
|
||||
if (attr & BITSET_FIXED && attr & BITSET_VARIABLE)
|
||||
abort ();
|
||||
if (attr & BITSET_SPARSE && attr & BITSET_DENSE)
|
||||
abort ();
|
||||
|
||||
/* Note that sometimes we will be asked for a zero length
|
||||
fixed size bitset. */
|
||||
|
||||
/* Choose the type of bitset. */
|
||||
|
||||
type = BITSET_ARRAY;
|
||||
/* Currently, the simple bitsets do not support a variable size. */
|
||||
if (attr & BITSET_VARIABLE || attr & BITSET_SPARSE)
|
||||
{
|
||||
type = BITSET_LIST;
|
||||
if (attr & BITSET_DENSE || attr & BITSET_GREEDY)
|
||||
type = BITSET_TABLE;
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
/* Create a bitset of N_BITS of type TYPE. */
|
||||
bitset
|
||||
bitset_alloc (n_bits, type)
|
||||
bitset_bindex n_bits;
|
||||
enum bitset_type type;
|
||||
{
|
||||
unsigned int bytes;
|
||||
bitset bset;
|
||||
|
||||
bytes = bitset_bytes (type, n_bits);
|
||||
|
||||
bset = (bitset) xcalloc (1, bytes);
|
||||
|
||||
/* The cache is disabled until some elements are allocated. If we
|
||||
have variable length arrays, then we may need to allocate a dummy
|
||||
element. */
|
||||
|
||||
return bitset_init (bset, n_bits, type);
|
||||
}
|
||||
|
||||
|
||||
/* Create a bitset of N_BITS of type TYPE. */
|
||||
bitset
|
||||
bitset_obstack_alloc (bobstack, n_bits, type)
|
||||
struct obstack *bobstack;
|
||||
bitset_bindex n_bits;
|
||||
enum bitset_type type;
|
||||
{
|
||||
unsigned int bytes;
|
||||
bitset bset;
|
||||
|
||||
bytes = bitset_bytes (type, n_bits);
|
||||
|
||||
bset = obstack_alloc (bobstack, bytes);
|
||||
memset (bset, 0, bytes);
|
||||
|
||||
return bitset_init (bset, n_bits, type);
|
||||
}
|
||||
|
||||
|
||||
/* Create a bitset of N_BITS and with attribute hints specified by
|
||||
ATTR. */
|
||||
bitset
|
||||
bitset_create (n_bits, attr)
|
||||
bitset_bindex n_bits;
|
||||
unsigned int attr;
|
||||
{
|
||||
enum bitset_type type;
|
||||
|
||||
type = bitset_type_choose (n_bits, attr);
|
||||
|
||||
return bitset_alloc (n_bits, type);
|
||||
}
|
||||
|
||||
|
||||
/* Free bitset BSET. */
|
||||
void
|
||||
bitset_free (bset)
|
||||
bitset bset;
|
||||
{
|
||||
BITSET_FREE_ (bset);
|
||||
free (bset);
|
||||
}
|
||||
|
||||
|
||||
/* Free bitset BSET allocated on obstack. */
|
||||
void
|
||||
bitset_obstack_free (bset)
|
||||
bitset bset;
|
||||
{
|
||||
BITSET_FREE_ (bset);
|
||||
}
|
||||
|
||||
|
||||
/* Return bitset type. */
|
||||
enum bitset_type
|
||||
bitset_type_get (bset)
|
||||
bitset bset;
|
||||
{
|
||||
enum bitset_type type;
|
||||
|
||||
type = BITSET_TYPE_ (bset);
|
||||
if (type != BITSET_STATS)
|
||||
return type;
|
||||
|
||||
return bitset_stats_type_get (bset);
|
||||
}
|
||||
|
||||
|
||||
/* Find next bit set in SRC starting from and including BITNO.
|
||||
Return -1 if SRC empty. */
|
||||
int
|
||||
bitset_next (src, bitno)
|
||||
bitset src;
|
||||
bitset_bindex bitno;
|
||||
{
|
||||
bitset_bindex val;
|
||||
bitset_bindex next = bitno;
|
||||
|
||||
if (!bitset_list (src, &val, 1, &next))
|
||||
return -1;
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
/* Find previous bit set in SRC starting from and including BITNO.
|
||||
Return -1 if SRC empty. */
|
||||
int
|
||||
bitset_prev (src, bitno)
|
||||
bitset src;
|
||||
bitset_bindex bitno;
|
||||
{
|
||||
bitset_bindex val;
|
||||
bitset_bindex next = bitno;
|
||||
|
||||
if (!bitset_reverse_list (src, &val, 1, &next))
|
||||
return -1;
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
/* Find first set bit. */
|
||||
int
|
||||
bitset_first (src)
|
||||
bitset src;
|
||||
{
|
||||
return bitset_next (src, 0);
|
||||
}
|
||||
|
||||
|
||||
/* Find last set bit. */
|
||||
int
|
||||
bitset_last (src)
|
||||
bitset src;
|
||||
{
|
||||
return bitset_prev (src, 0);
|
||||
}
|
||||
|
||||
|
||||
/* Return non-zero if BITNO in SRC is the only set bit. */
|
||||
int
|
||||
bitset_only_set_p (src, bitno)
|
||||
bitset src;
|
||||
bitset_bindex bitno;
|
||||
{
|
||||
bitset_bindex val[2];
|
||||
bitset_bindex next = 0;
|
||||
|
||||
if (bitset_list (src, val, 2, &next) != 1)
|
||||
return 0;
|
||||
return val[0] == bitno;
|
||||
}
|
||||
|
||||
|
||||
/* Toggle bit BITNO in bitset BSET and return non-zero if now set. */
|
||||
int
|
||||
bitset_toggle (bset, bitno)
|
||||
bitset bset;
|
||||
bitset_bindex bitno;
|
||||
{
|
||||
/* This routine is for completeness. It could be optimized if
|
||||
required. */
|
||||
if (bitset_test (bset, bitno))
|
||||
{
|
||||
bitset_reset (bset, bitno);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
bitset_set (bset, bitno);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Print contents of bitset BSET to FILE. */
|
||||
static void
|
||||
bitset_print (file, bset, verbose)
|
||||
FILE *file;
|
||||
bitset bset;
|
||||
int verbose;
|
||||
{
|
||||
unsigned int i, pos;
|
||||
bitset_iterator iter;
|
||||
|
||||
if (verbose)
|
||||
fprintf (file, "n_bits = %d, set = {", bitset_size (bset));
|
||||
|
||||
pos = 30;
|
||||
BITSET_FOR_EACH (iter, bset, i, 0)
|
||||
{
|
||||
if (pos > 70)
|
||||
{
|
||||
fprintf (file, "\n");
|
||||
pos = 0;
|
||||
}
|
||||
|
||||
fprintf (file, "%d ", i);
|
||||
pos += 1 + (i >= 10) + (i >= 100);
|
||||
};
|
||||
|
||||
if (verbose)
|
||||
fprintf (file, "}\n");
|
||||
}
|
||||
|
||||
|
||||
/* DST = SRC. Return non-zero if DST != SRC. */
|
||||
int
|
||||
bitset_copy (dst, src)
|
||||
bitset dst;
|
||||
bitset src;
|
||||
{
|
||||
unsigned int i;
|
||||
bitset_iterator iter;
|
||||
|
||||
if (BITSET_COMPATIBLE_ (dst, src))
|
||||
return BITSET_COPY_ (dst, src);
|
||||
|
||||
/* Convert bitset types. We assume that the DST bitset
|
||||
is large enough to hold the SRC bitset. */
|
||||
bitset_zero (dst);
|
||||
BITSET_FOR_EACH (iter, src, i, 0)
|
||||
{
|
||||
bitset_set (dst, i);
|
||||
};
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* Return size in bits of bitset SRC. */
|
||||
int
|
||||
bitset_size (src)
|
||||
bitset src;
|
||||
{
|
||||
return BITSET_SIZE_ (src);
|
||||
}
|
||||
|
||||
|
||||
/* Return number of bits set in bitset SRC. */
|
||||
int
|
||||
bitset_count (src)
|
||||
bitset src;
|
||||
{
|
||||
bitset_bindex list[BITSET_LIST_SIZE];
|
||||
bitset_bindex next;
|
||||
int num;
|
||||
int count;
|
||||
|
||||
/* This could be greatly sped up by adding a count method for each
|
||||
bitset implementation that uses a direct technique (based on
|
||||
masks) for counting the number of bits set in a word. */
|
||||
|
||||
next = 0;
|
||||
for (count = 0; (num = bitset_list (src, list, BITSET_LIST_SIZE, &next));
|
||||
count += num)
|
||||
continue;
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
/* DST = 0. */
|
||||
int
|
||||
bitset_zero (dst)
|
||||
bitset dst;
|
||||
{
|
||||
return BITSET_ZERO_ (dst);
|
||||
}
|
||||
|
||||
|
||||
/* DST = ~0. */
|
||||
int
|
||||
bitset_ones (dst)
|
||||
bitset dst;
|
||||
{
|
||||
return BITSET_ONES_ (dst);
|
||||
}
|
||||
|
||||
|
||||
/* Return SRC == 0. */
|
||||
int
|
||||
bitset_empty_p (src)
|
||||
bitset src;
|
||||
{
|
||||
return BITSET_EMPTY_P_ (src);
|
||||
}
|
||||
|
||||
|
||||
/* Return DST == DST | SRC. */
|
||||
int
|
||||
bitset_subset_p (dst, src)
|
||||
bitset dst;
|
||||
bitset src;
|
||||
{
|
||||
return BITSET_SUBSET_P_ (dst, src);
|
||||
}
|
||||
|
||||
|
||||
/* Return DST == SRC. */
|
||||
int
|
||||
bitset_equal_p (dst, src)
|
||||
bitset dst;
|
||||
bitset src;
|
||||
{
|
||||
return BITSET_EQUAL_P_ (dst, src);
|
||||
}
|
||||
|
||||
|
||||
/* Return DST & SRC == 0. */
|
||||
int
|
||||
bitset_disjoint_p (dst, src)
|
||||
bitset dst;
|
||||
bitset src;
|
||||
{
|
||||
return BITSET_DISJOINT_P_ (dst, src);
|
||||
}
|
||||
|
||||
|
||||
/* DST = ~SRC. */
|
||||
int
|
||||
bitset_not (dst, src)
|
||||
bitset dst;
|
||||
bitset src;
|
||||
{
|
||||
return BITSET_NOT_ (dst, src);
|
||||
}
|
||||
|
||||
|
||||
/* DST = SRC1 | SRC2. Return non-zero if DST != SRC1 | SRC2. */
|
||||
int
|
||||
bitset_or (dst, src1, src2)
|
||||
bitset dst;
|
||||
bitset src1;
|
||||
bitset src2;
|
||||
{
|
||||
return BITSET_OR_ (dst, src1, src2);
|
||||
}
|
||||
|
||||
|
||||
/* DST = SRC1 & SRC2. Return non-zero if DST != SRC1 & SRC2. */
|
||||
int
|
||||
bitset_and (dst, src1, src2)
|
||||
bitset dst;
|
||||
bitset src1;
|
||||
bitset src2;
|
||||
{
|
||||
return BITSET_AND_ (dst, src1, src2);
|
||||
}
|
||||
|
||||
|
||||
/* DST = SRC1 ^ SRC2. Return non-zero if DST != SRC1 ^ SRC2. */
|
||||
int
|
||||
bitset_xor (dst, src1, src2)
|
||||
bitset dst;
|
||||
bitset src1;
|
||||
bitset src2;
|
||||
{
|
||||
return BITSET_XOR_ (dst, src1, src2);
|
||||
}
|
||||
|
||||
|
||||
/* DST = SRC1 & ~SRC2. Return non-zero if DST != SRC1 & ~SRC2. */
|
||||
int
|
||||
bitset_andn (dst, src1, src2)
|
||||
bitset dst;
|
||||
bitset src1;
|
||||
bitset src2;
|
||||
{
|
||||
return BITSET_ANDN_ (dst, src1, src2);
|
||||
}
|
||||
|
||||
|
||||
/* This is a fallback for implementations that do not support
|
||||
four operand operations. */
|
||||
int
|
||||
bitset_op4 (dst, src1, src2, src3, op)
|
||||
bitset dst;
|
||||
bitset src1;
|
||||
bitset src2;
|
||||
bitset src3;
|
||||
enum bitset_ops op;
|
||||
{
|
||||
int changed = 0;
|
||||
bitset tmp;
|
||||
|
||||
/* Create temporary bitset. */
|
||||
tmp = bitset_alloc (0, bitset_type_get (dst));
|
||||
|
||||
switch (op)
|
||||
{
|
||||
case BITSET_OP_OR_AND:
|
||||
BITSET_OR_ (tmp, src1, src2);
|
||||
changed = BITSET_AND_ (dst, src3, tmp);
|
||||
break;
|
||||
|
||||
case BITSET_OP_AND_OR:
|
||||
BITSET_AND_ (tmp, src1, src2);
|
||||
changed = BITSET_OR_ (dst, src3, tmp);
|
||||
break;
|
||||
|
||||
case BITSET_OP_ANDN_OR:
|
||||
BITSET_ANDN_ (tmp, src1, src2);
|
||||
changed = BITSET_OR_ (dst, src3, tmp);
|
||||
break;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
||||
bitset_free (tmp);
|
||||
return changed;
|
||||
}
|
||||
|
||||
|
||||
/* DST = (SRC1 | SRC2) & SRC3. Return non-zero if
|
||||
DST != (SRC1 | SRC2) & SRC3. */
|
||||
int
|
||||
bitset_or_and (dst, src1, src2, src3)
|
||||
bitset dst;
|
||||
bitset src1;
|
||||
bitset src2;
|
||||
bitset src3;
|
||||
{
|
||||
return BITSET_OR_AND_ (dst, src1, src2, src3);
|
||||
}
|
||||
|
||||
|
||||
/* DST = (SRC1 & SRC2) | SRC3. Return non-zero if
|
||||
DST != (SRC1 & SRC2) | SRC3. */
|
||||
int
|
||||
bitset_and_or (dst, src1, src2, src3)
|
||||
bitset dst;
|
||||
bitset src1;
|
||||
bitset src2;
|
||||
bitset src3;
|
||||
{
|
||||
return BITSET_AND_OR_ (dst, src1, src2, src3);
|
||||
}
|
||||
|
||||
|
||||
/* DST = (SRC1 & ~SRC2) | SRC3. Return non-zero if
|
||||
DST != (SRC1 & ~SRC2) | SRC3. */
|
||||
int
|
||||
bitset_andn_or (dst, src1, src2, src3)
|
||||
bitset dst;
|
||||
bitset src1;
|
||||
bitset src2;
|
||||
bitset src3;
|
||||
{
|
||||
return BITSET_ANDN_OR_ (dst, src1, src2, src3);
|
||||
}
|
||||
|
||||
|
||||
/* Dump bitset BSET to FILE. */
|
||||
void
|
||||
bitset_dump (file, bset)
|
||||
FILE *file;
|
||||
bitset bset;
|
||||
{
|
||||
bitset_print (file, bset, 0);
|
||||
}
|
||||
|
||||
|
||||
/* Function to be called from debugger to print bitset. */
|
||||
void
|
||||
debug_bitset (bset)
|
||||
bitset bset;
|
||||
{
|
||||
if (bset)
|
||||
bitset_print (stderr, bset, 1);
|
||||
}
|
||||
|
||||
|
||||
/* Release memory associated with bitsets. */
|
||||
void
|
||||
bitset_release_memory ()
|
||||
{
|
||||
lbitset_release_memory ();
|
||||
ebitset_release_memory ();
|
||||
}
|
||||
+329
@@ -0,0 +1,329 @@
|
||||
/* Generic bitsets.
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
Contributed by Michael Hayes ([email protected]).
|
||||
|
||||
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 of the License, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _BITSET_H
|
||||
#define _BITSET_H
|
||||
|
||||
/* This file is the public interface to the bitset abstract data type.
|
||||
Only use the functions and macros defined in this file. */
|
||||
|
||||
#include "bbitset.h"
|
||||
#include "obstack.h"
|
||||
#include <stdio.h>
|
||||
|
||||
/* Attributes used to select a bitset implementation. */
|
||||
enum bitset_attr {BITSET_FIXED = 1, /* Bitset size fixed. */
|
||||
BITSET_VARIABLE = 2, /* Bitset size variable. */
|
||||
BITSET_DENSE = 4, /* Bitset dense. */
|
||||
BITSET_SPARSE = 8, /* Bitset sparse. */
|
||||
BITSET_FRUGAL = 16, /* Prefer most compact. */
|
||||
BITSET_GREEDY = 32}; /* Prefer fastest. */
|
||||
|
||||
typedef unsigned int bitset_attrs;
|
||||
|
||||
/* The contents of the structure should be considered to be private.
|
||||
While I would like to make this structure opaque, it needs to be
|
||||
visible for the inline bit set/test functions. */
|
||||
struct bitset_struct
|
||||
{
|
||||
struct bbitset_struct b;
|
||||
};
|
||||
|
||||
|
||||
/* The contents of this structure should be considered private.
|
||||
It is used for iterating over set bits. */
|
||||
typedef struct
|
||||
{
|
||||
bitset_bindex list[BITSET_LIST_SIZE];
|
||||
bitset_bindex next;
|
||||
int num;
|
||||
int i;
|
||||
} bitset_iterator;
|
||||
|
||||
|
||||
/* Return bytes required for bitset of desired type and size. */
|
||||
extern int bitset_bytes PARAMS ((enum bitset_type, bitset_bindex));
|
||||
|
||||
/* Initialise a bitset with desired type and size. */
|
||||
extern bitset bitset_init PARAMS ((bitset, bitset_bindex, enum bitset_type));
|
||||
|
||||
/* Select an implementation type based on the desired bitset size
|
||||
and attributes. */
|
||||
extern enum bitset_type bitset_type_choose PARAMS ((bitset_bindex,
|
||||
bitset_attrs));
|
||||
|
||||
/* Create a bitset of desired type and size. The bitset is zeroed. */
|
||||
extern bitset bitset_alloc PARAMS ((bitset_bindex, enum bitset_type));
|
||||
|
||||
/* Free bitset. */
|
||||
extern void bitset_free PARAMS ((bitset));
|
||||
|
||||
/* Create a bitset of desired type and size using an obstack. The
|
||||
bitset is zeroed. */
|
||||
extern bitset bitset_obstack_alloc PARAMS ((struct obstack *bobstack,
|
||||
bitset_bindex, enum bitset_type));
|
||||
|
||||
/* Free bitset allocated on obstack. */
|
||||
extern void bitset_obstack_free PARAMS ((bitset));
|
||||
|
||||
/* Create a bitset of desired size and attributes. The bitset is zeroed. */
|
||||
extern bitset bitset_create PARAMS ((bitset_bindex, bitset_attrs));
|
||||
|
||||
/* Return size in bits of bitset SRC. */
|
||||
extern int bitset_size PARAMS ((bitset));
|
||||
|
||||
/* Return number of bits set in bitset SRC. */
|
||||
extern int bitset_count PARAMS ((bitset));
|
||||
|
||||
/* Return bitset type. */
|
||||
extern enum bitset_type bitset_type_get PARAMS ((bitset));
|
||||
|
||||
#if BITSET_INLINE
|
||||
static inline void bitset_set PARAMS ((bitset, bitset_bindex));
|
||||
static inline void bitset_reset PARAMS ((bitset, bitset_bindex));
|
||||
static inline int bitset_test PARAMS ((bitset, bitset_bindex));
|
||||
|
||||
/* Set bit BITNO in bitset BSET. */
|
||||
static inline void bitset_set (bset, bitno)
|
||||
bitset bset;
|
||||
bitset_bindex bitno;
|
||||
{
|
||||
bitset_windex index = bitno / BITSET_WORD_BITS;
|
||||
bitset_windex offset = index - bset->b.cindex;
|
||||
|
||||
if (offset < bset->b.csize)
|
||||
bset->b.cdata[offset] |= ((bitset_word) 1 << (bitno % BITSET_WORD_BITS));
|
||||
else
|
||||
BITSET_SET_ (bset, bitno);
|
||||
}
|
||||
|
||||
|
||||
/* Reset bit BITNO in bitset BSET. */
|
||||
static inline void bitset_reset (bset, bitno)
|
||||
bitset bset;
|
||||
bitset_bindex bitno;
|
||||
{
|
||||
bitset_windex index = bitno / BITSET_WORD_BITS;
|
||||
bitset_windex offset = index - bset->b.cindex;
|
||||
|
||||
if (offset < bset->b.csize)
|
||||
bset->b.cdata[offset] &= ~((bitset_word) 1 << (bitno % BITSET_WORD_BITS));
|
||||
else
|
||||
BITSET_RESET_ (bset, bitno);
|
||||
}
|
||||
|
||||
|
||||
/* Test bit BITNO in bitset BSET. */
|
||||
static inline int bitset_test (bset, bitno)
|
||||
bitset bset;
|
||||
bitset_bindex bitno;
|
||||
{
|
||||
bitset_windex index = bitno / BITSET_WORD_BITS;
|
||||
bitset_windex offset = index - bset->b.cindex;
|
||||
|
||||
if (offset < bset->b.csize)
|
||||
return (bset->b.cdata[offset] >> (bitno % BITSET_WORD_BITS)) & 1;
|
||||
else
|
||||
return BITSET_TEST_ (bset, bitno);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ! BITSET_INLINE
|
||||
|
||||
/* Set bit BITNO in bitset BSET. */
|
||||
#define bitset_set(bset, bitno) \
|
||||
do \
|
||||
{ \
|
||||
bitset_bindex _bitno = (bitno); \
|
||||
bitset_windex _index = _bitno / BITSET_WORD_BITS; \
|
||||
bitset_windex _offset = _index - (bset)->b.cindex; \
|
||||
\
|
||||
if (_offset < (bset)->b.csize) \
|
||||
(bset)->b.cdata[_offset] |= \
|
||||
((bitset_word) 1 << (_bitno % BITSET_WORD_BITS)); \
|
||||
else \
|
||||
BITSET_SET_ ((bset), _bitno); \
|
||||
} while (0)
|
||||
|
||||
|
||||
/* Reset bit BITNO in bitset BSET. */
|
||||
#define bitset_reset(bset, bitno) \
|
||||
do \
|
||||
{ \
|
||||
bitset_bindex _bitno = (bitno); \
|
||||
bitset_windex _index = _bitno / BITSET_WORD_BITS; \
|
||||
bitset_windex _offset = _index - (bset)->b.cindex; \
|
||||
\
|
||||
if (_offset < (bset)->b.csize) \
|
||||
(bset)->b.cdata[_offset] &= \
|
||||
~((bitset_word) 1 << (_bitno % BITSET_WORD_BITS)); \
|
||||
else \
|
||||
BITSET_RESET_ ((bset), _bitno); \
|
||||
} while (0)
|
||||
|
||||
|
||||
/* Test bit BITNO in bitset BSET. */
|
||||
#define bitset_test(bset, bitno) \
|
||||
(((((bitno) / BITSET_WORD_BITS) - (bset)->b.cindex) < (bset)->b.csize) \
|
||||
? (((int) \
|
||||
((bset)->b.cdata[(((bitno) / BITSET_WORD_BITS) - (bset)->b.cindex)] \
|
||||
>> ((bitno) % BITSET_WORD_BITS))) \
|
||||
& 1) \
|
||||
: BITSET_TEST_ ((bset), (bitno)))
|
||||
#endif
|
||||
|
||||
|
||||
/* Toggle bit BITNO in bitset BSET and return non-zero if now set. */
|
||||
extern int bitset_toggle PARAMS ((bitset, bitset_bindex));
|
||||
|
||||
/* DST = 0. */
|
||||
extern int bitset_zero PARAMS ((bitset));
|
||||
|
||||
/* DST = ~0. */
|
||||
extern int bitset_ones PARAMS ((bitset));
|
||||
|
||||
/* Return non-zero if all bits in bitset SRC are reset. */
|
||||
extern int bitset_empty_p PARAMS ((bitset));
|
||||
|
||||
/* Return DST == DST | SRC. */
|
||||
extern int bitset_subset_p PARAMS ((bitset, bitset));
|
||||
|
||||
/* Return DST == SRC. */
|
||||
extern int bitset_equal_p PARAMS ((bitset, bitset));
|
||||
|
||||
/* Return DST & SRC == 0. */
|
||||
extern int bitset_disjoint_p PARAMS ((bitset, bitset));
|
||||
|
||||
/* DST == SRC. */
|
||||
extern int bitset_copy PARAMS ((bitset, bitset));
|
||||
|
||||
/* DST = ~SRC. */
|
||||
extern int bitset_not PARAMS ((bitset, bitset));
|
||||
|
||||
/* DST = SRC1 | SRC2. Return non-zero if DST != SRC1 | SRC2. */
|
||||
extern int bitset_or PARAMS ((bitset, bitset, bitset));
|
||||
|
||||
/* DST = SRC1 & SRC2. Return non-zero if DST != SRC1 & SRC2. */
|
||||
extern int bitset_and PARAMS ((bitset, bitset, bitset));
|
||||
|
||||
/* DST = SRC1 ^ SRC2. Return non-zero if DST != SRC1 ^ SRC2. */
|
||||
extern int bitset_xor PARAMS ((bitset, bitset, bitset));
|
||||
|
||||
/* DST = SRC1 & ~SRC2. Return non-zero if DST != SRC1 & ~SRC2. */
|
||||
extern int bitset_andn PARAMS ((bitset, bitset, bitset));
|
||||
|
||||
/* DST = (SRC1 | SRC2) & SRC3. Return non-zero if
|
||||
DST != (SRC1 | SRC2) & SRC3. */
|
||||
extern int bitset_or_and PARAMS ((bitset, bitset, bitset, bitset));
|
||||
|
||||
/* DST = (SRC1 & SRC2) | SRC3. Return non-zero if
|
||||
DST != (SRC1 & SRC2) | SRC3. */
|
||||
extern int bitset_and_or PARAMS ((bitset, bitset, bitset, bitset));
|
||||
|
||||
/* DST = (SRC1 & ~SRC2) | SRC3. Return non-zero if
|
||||
DST != (SRC1 & ~SRC2) | SRC3. */
|
||||
extern int bitset_andn_or PARAMS ((bitset, bitset, bitset, bitset));
|
||||
|
||||
/* Find next bit set in BSET starting from and including BITNO. */
|
||||
extern int bitset_next PARAMS ((bitset, bitset_bindex));
|
||||
|
||||
/* Find previous bit set in BSET starting from and including BITNO. */
|
||||
extern int bitset_prev PARAMS ((bitset, bitset_bindex));
|
||||
|
||||
/* Return non-zero if BITNO in SRC is the only set bit. */
|
||||
extern int bitset_only_set_p PARAMS ((bitset, bitset_bindex));
|
||||
|
||||
/* Find list of up to NUM bits set in BSET starting from and including
|
||||
*NEXT. Return with actual number of bits found and with *NEXT
|
||||
indicating where search stopped. */
|
||||
#define bitset_list(BSET, LIST, NUM, NEXT) \
|
||||
BITSET_LIST_ (BSET, LIST, NUM, NEXT)
|
||||
|
||||
/* Find reverse list of up to NUM bits set in BSET starting from and
|
||||
including NEXT. Return with actual number of bits found and with
|
||||
*NEXT indicating where search stopped. */
|
||||
#define bitset_reverse_list(BSET, LIST, NUM, NEXT) \
|
||||
BITSET_REVERSE_LIST_ (BSET, LIST, NUM, NEXT)
|
||||
|
||||
/* Find first set bit. */
|
||||
extern int bitset_first PARAMS ((bitset));
|
||||
|
||||
/* Find last set bit. */
|
||||
extern int bitset_last PARAMS ((bitset));
|
||||
|
||||
/* Dump bitset. */
|
||||
extern void bitset_dump PARAMS ((FILE *, bitset));
|
||||
|
||||
/* Loop over all elements of BSET, starting with MIN, setting BIT
|
||||
to the index of each set bit. */
|
||||
#define BITSET_FOR_EACH(ITER, BSET, BIT, MIN) \
|
||||
for (ITER.next = (MIN), ITER.num = BITSET_LIST_SIZE; \
|
||||
(ITER.num == BITSET_LIST_SIZE) \
|
||||
&& (ITER.num = bitset_list (BSET, ITER.list, \
|
||||
BITSET_LIST_SIZE, &ITER.next));) \
|
||||
for (ITER.i = 0; (BIT) = ITER.list[ITER.i], ITER.i < ITER.num; ITER.i++)
|
||||
|
||||
|
||||
/* Loop over all elements of BSET, in reverse order starting with
|
||||
MIN, setting BIT to the index of each set bit. */
|
||||
#define BITSET_FOR_EACH_REVERSE(ITER, BSET, BIT, MIN) \
|
||||
for (ITER.next = (MIN), ITER.num = BITSET_LIST_SIZE; \
|
||||
(ITER.num == BITSET_LIST_SIZE) \
|
||||
&& (ITER.num = bitset_list_reverse (BSET, ITER.list, \
|
||||
BITSET_LIST_SIZE, &ITER.next));) \
|
||||
for (ITER.i = 0; (BIT) = ITER.list[ITER.i], ITER.i < ITER.num; ITER.i++)
|
||||
|
||||
|
||||
/* Define set operations in terms of logical operations. */
|
||||
|
||||
#define bitset_diff(DST, SRC1, SRC2) bitset_andn (DST, SRC1, SRC2)
|
||||
|
||||
#define bitset_intersection(DST, SRC1, SRC2) bitset_and (DST, SRC1, SRC2)
|
||||
|
||||
#define bitset_union(DST, SRC1, SRC2) bitset_or (DST, SRC1, SRC2)
|
||||
|
||||
#define bitset_diff_union(DST, SRC1, SRC2, SRC3) \
|
||||
bitset_andn_or (DST, SRC1, SRC2, SRC3)
|
||||
|
||||
|
||||
/* Release any memory tied up with bitsets. */
|
||||
extern void bitset_release_memory PARAMS ((void));
|
||||
|
||||
/* Enable bitset stats gathering. */
|
||||
extern void bitset_stats_enable PARAMS ((void));
|
||||
|
||||
/* Disable bitset stats gathering. */
|
||||
extern void bitset_stats_disable PARAMS ((void));
|
||||
|
||||
/* Read bitset stats file of accummulated stats. */
|
||||
void bitset_stats_read PARAMS ((const char *filename));
|
||||
|
||||
/* Write bitset stats file of accummulated stats. */
|
||||
void bitset_stats_write PARAMS ((const char *filename));
|
||||
|
||||
/* Dump bitset stats. */
|
||||
extern void bitset_stats_dump PARAMS ((FILE *));
|
||||
|
||||
/* Function to debug bitset from debugger. */
|
||||
extern void debug_bitset PARAMS ((bitset));
|
||||
|
||||
/* Function to debug bitset stats from debugger. */
|
||||
extern void debug_bitset_stats PARAMS ((void));
|
||||
|
||||
#endif /* _BITSET_H */
|
||||
|
||||
@@ -0,0 +1,630 @@
|
||||
/* Bitset statistics.
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
Contributed by Michael Hayes ([email protected]).
|
||||
|
||||
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 of the License, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* This file is a wrapper bitset implementation for the other bitset
|
||||
implementations. It provides bitset compatibility checking and
|
||||
statistics gathering without having to instrument the bitset
|
||||
implementations. When statistics gathering is enabled, the bitset
|
||||
operations get vectored through here and we then call the appropriate
|
||||
routines.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "bbitset.h"
|
||||
#include "abitset.h"
|
||||
#include "ebitset.h"
|
||||
#include "lbitset.h"
|
||||
#include "bitset_stats.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "gettext.h"
|
||||
#define _(Msgid) gettext (Msgid)
|
||||
|
||||
/* Configuration macros. */
|
||||
#define BITSET_STATS_FILE "bitset.dat"
|
||||
#define BITSET_LOG_COUNT_BINS 10
|
||||
#define BITSET_LOG_SIZE_BINS 16
|
||||
#define BITSET_DENSITY_BINS 20
|
||||
|
||||
|
||||
/* Accessor macros. */
|
||||
#define BITSET_STATS_ALLOCS_INC(TYPE) \
|
||||
bitset_stats_info->types[(TYPE)].allocs++
|
||||
#define BITSET_STATS_FREES_INC(BSET) \
|
||||
bitset_stats_info->types[BITSET_TYPE_ (BSET)].frees++
|
||||
#define BITSET_STATS_SETS_INC(BSET) \
|
||||
bitset_stats_info->types[BITSET_TYPE_ (BSET)].sets++
|
||||
#define BITSET_STATS_CACHE_SETS_INC(BSET) \
|
||||
bitset_stats_info->types[BITSET_TYPE_ (BSET)].cache_sets++
|
||||
#define BITSET_STATS_RESETS_INC(BSET) \
|
||||
bitset_stats_info->types[BITSET_TYPE_ (BSET)].resets++
|
||||
#define BITSET_STATS_CACHE_RESETS_INC(BSET) \
|
||||
bitset_stats_info->types[BITSET_TYPE_ (BSET)].cache_resets++
|
||||
#define BITSET_STATS_TESTS_INC(BSET) \
|
||||
bitset_stats_info->types[BITSET_TYPE_ (BSET)].tests++
|
||||
#define BITSET_STATS_CACHE_TESTS_INC(BSET) \
|
||||
bitset_stats_info->types[BITSET_TYPE_ (BSET)].cache_tests++
|
||||
#define BITSET_STATS_LISTS_INC(BSET) \
|
||||
bitset_stats_info->types[BITSET_TYPE_ (BSET)].lists++
|
||||
#define BITSET_STATS_LIST_COUNTS_INC(BSET, I) \
|
||||
bitset_stats_info->types[BITSET_TYPE_ (BSET)].list_counts[(I)]++
|
||||
#define BITSET_STATS_LIST_SIZES_INC(BSET, I) \
|
||||
bitset_stats_info->types[BITSET_TYPE_ (BSET)].list_sizes[(I)]++
|
||||
#define BITSET_STATS_LIST_DENSITY_INC(BSET, I) \
|
||||
bitset_stats_info->types[BITSET_TYPE_ (BSET)].list_density[(I)]++
|
||||
|
||||
|
||||
typedef struct bitset_stats_struct
|
||||
{
|
||||
bitset bset;
|
||||
} *bitset_stats;
|
||||
|
||||
|
||||
struct bitset_struct
|
||||
{
|
||||
struct bbitset_struct b;
|
||||
struct bitset_stats_struct s;
|
||||
};
|
||||
|
||||
|
||||
struct bitset_type_info_struct
|
||||
{
|
||||
unsigned int allocs;
|
||||
unsigned int frees;
|
||||
unsigned int lists;
|
||||
unsigned int sets;
|
||||
unsigned int cache_sets;
|
||||
unsigned int resets;
|
||||
unsigned int cache_resets;
|
||||
unsigned int tests;
|
||||
unsigned int cache_tests;
|
||||
unsigned int list_counts[BITSET_LOG_COUNT_BINS];
|
||||
unsigned int list_sizes[BITSET_LOG_SIZE_BINS];
|
||||
unsigned int list_density[BITSET_DENSITY_BINS];
|
||||
};
|
||||
|
||||
struct bitset_stats_info_struct
|
||||
{
|
||||
unsigned int runs;
|
||||
struct bitset_type_info_struct types[BITSET_TYPE_NUM];
|
||||
};
|
||||
|
||||
|
||||
struct bitset_stats_info_struct bitset_stats_info_data;
|
||||
struct bitset_stats_info_struct *bitset_stats_info;
|
||||
int bitset_stats_enabled = 0;
|
||||
|
||||
|
||||
static void bitset_stats_set PARAMS ((bitset, bitset_bindex));
|
||||
static void bitset_stats_reset PARAMS ((bitset, bitset_bindex));
|
||||
static int bitset_stats_test PARAMS ((bitset, bitset_bindex));
|
||||
static int bitset_stats_size PARAMS ((bitset));
|
||||
static int bitset_stats_op1 PARAMS ((bitset, enum bitset_ops));
|
||||
static int bitset_stats_op2 PARAMS ((bitset, bitset, enum bitset_ops));
|
||||
static int bitset_stats_op3 PARAMS ((bitset, bitset, bitset, enum bitset_ops));
|
||||
static int bitset_stats_op4 PARAMS ((bitset, bitset, bitset, bitset,
|
||||
enum bitset_ops));
|
||||
static int bitset_stats_list PARAMS ((bitset, bitset_bindex *, bitset_bindex,
|
||||
bitset_bindex *));
|
||||
static int bitset_stats_reverse_list
|
||||
PARAMS ((bitset, bitset_bindex *, bitset_bindex, bitset_bindex *));
|
||||
static void bitset_stats_free PARAMS ((bitset));
|
||||
static void bitset_percent_histogram_print PARAMS ((FILE *, const char *,
|
||||
const char *,
|
||||
unsigned int,
|
||||
unsigned int *));
|
||||
static void bitset_log_histogram_print PARAMS ((FILE *, const char *,
|
||||
const char *,
|
||||
unsigned int,
|
||||
unsigned int *));
|
||||
static void bitset_stats_print_1
|
||||
PARAMS ((FILE *, const char *, struct bitset_type_info_struct *));
|
||||
static void bitset_stats_print PARAMS ((FILE *, int));
|
||||
|
||||
|
||||
/* Print a percentage histogram with message MSG to FILE. */
|
||||
static void
|
||||
bitset_percent_histogram_print (file, name, msg, n_bins, bins)
|
||||
FILE *file;
|
||||
const char *name;
|
||||
const char *msg;
|
||||
unsigned int n_bins;
|
||||
unsigned int *bins;
|
||||
{
|
||||
unsigned int i;
|
||||
unsigned int total;
|
||||
|
||||
total = 0;
|
||||
for (i = 0; i < n_bins; i++)
|
||||
total += bins[i];
|
||||
|
||||
if (!total)
|
||||
return;
|
||||
|
||||
fprintf (file, "%s %s", name, msg);
|
||||
for (i = 0; i < n_bins; i++)
|
||||
fprintf (file, "%.0f-%.0f%%\t%8d (%5.1f%%)\n",
|
||||
i * 100.0 / n_bins,
|
||||
(i + 1) * 100.0 / n_bins, bins[i],
|
||||
(100.0 * bins[i]) / total);
|
||||
}
|
||||
|
||||
|
||||
/* Print a log histogram with message MSG to FILE. */
|
||||
static void
|
||||
bitset_log_histogram_print (file, name, msg, n_bins, bins)
|
||||
FILE *file;
|
||||
const char *name;
|
||||
const char *msg;
|
||||
unsigned int n_bins;
|
||||
unsigned int *bins;
|
||||
{
|
||||
unsigned int i;
|
||||
unsigned int total;
|
||||
unsigned int max_width;
|
||||
unsigned int last_bin;
|
||||
|
||||
total = 0;
|
||||
for (i = 0; i < n_bins; i++)
|
||||
total += bins[i];
|
||||
|
||||
if (!total)
|
||||
return;
|
||||
|
||||
for (i = n_bins; i > 3 && ! bins[i - 1]; i--)
|
||||
continue;
|
||||
last_bin = i - 1;
|
||||
|
||||
/* 2 * ceil (log10 (2) * (N - 1)) + 1. */
|
||||
max_width = 2 * (unsigned int) (0.30103 * (n_bins - 1) + 0.9999) + 1;
|
||||
|
||||
fprintf (file, "%s %s", name, msg);
|
||||
for (i = 0; i < 2; i++)
|
||||
fprintf (file, "%*d\t%8d (%5.1f%%)\n",
|
||||
max_width, i, bins[i], 100.0 * bins[i] / total);
|
||||
|
||||
for (; i <= last_bin; i++)
|
||||
fprintf (file, "%*d-%d\t%8d (%5.1f%%)\n",
|
||||
max_width - ((unsigned int) (0.30103 * (i) + 0.9999) + 1),
|
||||
1 << (i - 1), (1 << i) - 1, bins[i],
|
||||
(100.0 * bins[i]) / total);
|
||||
}
|
||||
|
||||
|
||||
/* Print bitset statistics to FILE. */
|
||||
static void
|
||||
bitset_stats_print_1 (file, name, stats)
|
||||
FILE *file;
|
||||
const char *name;
|
||||
struct bitset_type_info_struct *stats;
|
||||
{
|
||||
if (!stats)
|
||||
return;
|
||||
|
||||
fprintf (file, "%s:\n", name);
|
||||
fprintf (file, _("%d bitset_allocs, %d freed (%.2f%%).\n"),
|
||||
stats->allocs, stats->frees,
|
||||
stats->allocs ? 100.0 * stats->frees / stats->allocs : 0);
|
||||
fprintf (file, _("%d bitset_sets, %d cached (%.2f%%)\n"),
|
||||
stats->sets, stats->cache_sets,
|
||||
stats->sets ? 100.0 * stats->cache_sets / stats->sets : 0);
|
||||
fprintf (file, _("%d bitset_resets, %d cached (%.2f%%)\n"),
|
||||
stats->resets, stats->cache_resets,
|
||||
stats->resets ? 100.0 * stats->cache_resets / stats->resets : 0);
|
||||
fprintf (file, _("%d bitset_tests, %d cached (%.2f%%)\n"),
|
||||
stats->tests, stats->cache_tests,
|
||||
stats->tests ? 100.0 * stats->cache_tests / stats->tests : 0);
|
||||
|
||||
fprintf (file, _("%d bitset_lists\n"), stats->lists);
|
||||
|
||||
bitset_log_histogram_print (file, name, _("count log histogram\n"),
|
||||
BITSET_LOG_COUNT_BINS, stats->list_counts);
|
||||
|
||||
bitset_log_histogram_print (file, name, _("size log histogram\n"),
|
||||
BITSET_LOG_SIZE_BINS, stats->list_sizes);
|
||||
|
||||
bitset_percent_histogram_print (file, name, _("density histogram\n"),
|
||||
BITSET_DENSITY_BINS, stats->list_density);
|
||||
}
|
||||
|
||||
|
||||
/* Print all bitset statistics to FILE. */
|
||||
static void
|
||||
bitset_stats_print (file, verbose)
|
||||
FILE *file;
|
||||
int verbose ATTRIBUTE_UNUSED;
|
||||
{
|
||||
int i;
|
||||
static const char *names[] = BITSET_TYPE_NAMES;
|
||||
|
||||
if (!bitset_stats_info)
|
||||
return;
|
||||
|
||||
fprintf (file, _("Bitset statistics:\n\n"));
|
||||
|
||||
if (bitset_stats_info->runs > 1)
|
||||
fprintf (file, _("Accumulated runs = %d\n"), bitset_stats_info->runs);
|
||||
|
||||
for (i = 0; i < BITSET_TYPE_NUM; i++)
|
||||
bitset_stats_print_1 (file, names[i], &bitset_stats_info->types[i]);
|
||||
}
|
||||
|
||||
|
||||
/* Initialise bitset statistics logging. */
|
||||
void
|
||||
bitset_stats_enable ()
|
||||
{
|
||||
if (!bitset_stats_info)
|
||||
bitset_stats_info = &bitset_stats_info_data;
|
||||
bitset_stats_enabled = 1;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
bitset_stats_disable ()
|
||||
{
|
||||
bitset_stats_enabled = 0;
|
||||
}
|
||||
|
||||
|
||||
/* Read bitset statistics file. */
|
||||
void
|
||||
bitset_stats_read (filename)
|
||||
const char *filename;
|
||||
{
|
||||
FILE *file;
|
||||
|
||||
if (!bitset_stats_info)
|
||||
return;
|
||||
|
||||
if (!filename)
|
||||
filename = BITSET_STATS_FILE;
|
||||
|
||||
file = fopen (filename, "r");
|
||||
if (file)
|
||||
{
|
||||
if (fread (&bitset_stats_info_data, sizeof (bitset_stats_info_data),
|
||||
1, file) != 1)
|
||||
{
|
||||
if (ferror (file))
|
||||
perror (_("Could not read stats file."));
|
||||
else
|
||||
fprintf (stderr, _("Bad stats file size.\n"));
|
||||
}
|
||||
fclose (file);
|
||||
}
|
||||
bitset_stats_info_data.runs++;
|
||||
}
|
||||
|
||||
|
||||
/* Write bitset statistics file. */
|
||||
void
|
||||
bitset_stats_write (filename)
|
||||
const char *filename;
|
||||
{
|
||||
FILE *file;
|
||||
|
||||
if (!bitset_stats_info)
|
||||
return;
|
||||
|
||||
if (!filename)
|
||||
filename = BITSET_STATS_FILE;
|
||||
|
||||
file = fopen (filename, "w");
|
||||
if (file)
|
||||
{
|
||||
if (fwrite (&bitset_stats_info_data, sizeof (bitset_stats_info_data),
|
||||
1, file) != 1)
|
||||
perror (_("Could not write stats file."));
|
||||
fclose (file);
|
||||
}
|
||||
else
|
||||
perror (_("Could not open stats file for writing."));
|
||||
}
|
||||
|
||||
|
||||
/* Dump bitset statistics to FILE. */
|
||||
void
|
||||
bitset_stats_dump (file)
|
||||
FILE *file;
|
||||
{
|
||||
bitset_stats_print (file, 0);
|
||||
}
|
||||
|
||||
|
||||
/* Function to be called from debugger to print bitset stats. */
|
||||
void
|
||||
debug_bitset_stats (void)
|
||||
{
|
||||
bitset_stats_print (stderr, 1);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
bitset_stats_set (dst, bitno)
|
||||
bitset dst;
|
||||
bitset_bindex bitno;
|
||||
{
|
||||
bitset bset = dst->s.bset;
|
||||
bitset_windex wordno = bitno / BITSET_WORD_BITS;
|
||||
bitset_windex offset = wordno - bset->b.cindex;
|
||||
|
||||
BITSET_STATS_SETS_INC (bset);
|
||||
|
||||
if (offset < bset->b.csize)
|
||||
{
|
||||
bset->b.cdata[offset] |= (bitset_word) 1 << (bitno % BITSET_WORD_BITS);
|
||||
BITSET_STATS_CACHE_SETS_INC (bset);
|
||||
}
|
||||
else
|
||||
BITSET_SET_ (bset, bitno);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
bitset_stats_reset (dst, bitno)
|
||||
bitset dst;
|
||||
bitset_bindex bitno;
|
||||
{
|
||||
bitset bset = dst->s.bset;
|
||||
bitset_windex wordno = bitno / BITSET_WORD_BITS;
|
||||
bitset_windex offset = wordno - bset->b.cindex;
|
||||
|
||||
BITSET_STATS_RESETS_INC (bset);
|
||||
|
||||
if (offset < bset->b.csize)
|
||||
{
|
||||
bset->b.cdata[offset] &=
|
||||
~((bitset_word) 1 << (bitno % BITSET_WORD_BITS));
|
||||
BITSET_STATS_CACHE_RESETS_INC (bset);
|
||||
}
|
||||
else
|
||||
BITSET_RESET_ (bset, bitno);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
bitset_stats_test (src, bitno)
|
||||
bitset src;
|
||||
bitset_bindex bitno;
|
||||
{
|
||||
bitset bset = src->s.bset;
|
||||
bitset_windex wordno = bitno / BITSET_WORD_BITS;
|
||||
bitset_windex offset = wordno - bset->b.cindex;
|
||||
|
||||
BITSET_STATS_TESTS_INC (bset);
|
||||
|
||||
if (offset < bset->b.csize)
|
||||
{
|
||||
BITSET_STATS_CACHE_TESTS_INC (bset);
|
||||
return (bset->b.cdata[offset] >> (bitno % BITSET_WORD_BITS)) & 1;
|
||||
}
|
||||
else
|
||||
return BITSET_TEST_ (bset, bitno);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
bitset_stats_size (src)
|
||||
bitset src;
|
||||
{
|
||||
return BITSET_SIZE_ (src->s.bset);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
bitset_stats_op1 (dst, op)
|
||||
bitset dst;
|
||||
enum bitset_ops op;
|
||||
{
|
||||
return BITSET_OP1_ (dst->s.bset, op);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
bitset_stats_op2 (dst, src, op)
|
||||
bitset dst;
|
||||
bitset src;
|
||||
enum bitset_ops op;
|
||||
{
|
||||
BITSET_CHECK2_ (dst, src);
|
||||
return BITSET_OP2_ (dst->s.bset, src->s.bset, op);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
bitset_stats_op3 (dst, src1, src2, op)
|
||||
bitset dst;
|
||||
bitset src1;
|
||||
bitset src2;
|
||||
enum bitset_ops op;
|
||||
{
|
||||
BITSET_CHECK3_ (dst, src1, src2);
|
||||
return BITSET_OP3_ (dst->s.bset, src1->s.bset, src2->s.bset, op);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
bitset_stats_op4 (dst, src1, src2, src3, op)
|
||||
bitset dst;
|
||||
bitset src1;
|
||||
bitset src2;
|
||||
bitset src3;
|
||||
enum bitset_ops op;
|
||||
{
|
||||
BITSET_CHECK4_ (dst, src1, src2, src3);
|
||||
|
||||
/* This is a bit of a hack. If the implementation handles
|
||||
a four operand operation then vector to it, passing
|
||||
the enclosed bitsets. Otherwise use the fallback
|
||||
bitset_op4 routine. */
|
||||
if (dst->s.bset->b.ops->op4 != bitset_op4)
|
||||
return BITSET_OP4_ (dst->s.bset, src1->s.bset, src2->s.bset,
|
||||
src3->s.bset, op);
|
||||
|
||||
return bitset_op4 (dst, src1, src2, src3, op);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
bitset_stats_list (bset, list, num, next)
|
||||
bitset bset;
|
||||
bitset_bindex *list;
|
||||
bitset_bindex num;
|
||||
bitset_bindex *next;
|
||||
{
|
||||
bitset_bindex count;
|
||||
bitset_bindex tmp;
|
||||
bitset_bindex size;
|
||||
bitset_bindex i;
|
||||
enum bitset_type type;
|
||||
|
||||
count = BITSET_LIST_ (bset->s.bset, list, num, next);
|
||||
|
||||
type = BITSET_TYPE_ (bset->s.bset);
|
||||
BITSET_STATS_LISTS_INC (bset->s.bset);
|
||||
|
||||
/* Log histogram of number of set bits. */
|
||||
for (i = 0, tmp = count; tmp; tmp >>= 1, i++)
|
||||
continue;
|
||||
if (i >= BITSET_LOG_COUNT_BINS)
|
||||
i = BITSET_LOG_COUNT_BINS - 1;
|
||||
BITSET_STATS_LIST_COUNTS_INC (bset->s.bset, i);
|
||||
|
||||
/* Log histogram of number of bits in set. */
|
||||
size = BITSET_SIZE_ (bset->s.bset);
|
||||
for (i = 0, tmp = size; tmp; tmp >>= 1, i++)
|
||||
continue;
|
||||
if (i >= BITSET_LOG_SIZE_BINS)
|
||||
i = BITSET_LOG_SIZE_BINS - 1;
|
||||
BITSET_STATS_LIST_SIZES_INC (bset->s.bset, i);
|
||||
|
||||
/* Histogram of fraction of bits set. */
|
||||
i = size ? (count * BITSET_DENSITY_BINS) / size : 0;
|
||||
if (i >= BITSET_DENSITY_BINS)
|
||||
i = BITSET_DENSITY_BINS - 1;
|
||||
BITSET_STATS_LIST_DENSITY_INC (bset->s.bset, i);
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
bitset_stats_reverse_list (bset, list, num, next)
|
||||
bitset bset;
|
||||
bitset_bindex *list;
|
||||
bitset_bindex num;
|
||||
bitset_bindex *next;
|
||||
{
|
||||
return BITSET_REVERSE_LIST_ (bset->s.bset, list, num, next);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
bitset_stats_free (bset)
|
||||
bitset bset;
|
||||
{
|
||||
BITSET_STATS_FREES_INC (bset->s.bset);
|
||||
BITSET_FREE_ (bset->s.bset);
|
||||
}
|
||||
|
||||
|
||||
struct bitset_ops_struct bitset_stats_ops = {
|
||||
bitset_stats_set,
|
||||
bitset_stats_reset,
|
||||
bitset_stats_test,
|
||||
bitset_stats_size,
|
||||
bitset_stats_op1,
|
||||
bitset_stats_op2,
|
||||
bitset_stats_op3,
|
||||
bitset_stats_op4,
|
||||
bitset_stats_list,
|
||||
bitset_stats_reverse_list,
|
||||
bitset_stats_free,
|
||||
BITSET_STATS
|
||||
};
|
||||
|
||||
|
||||
/* Return enclosed bitset type. */
|
||||
enum bitset_type
|
||||
bitset_stats_type_get (bset)
|
||||
bitset bset;
|
||||
{
|
||||
return BITSET_TYPE_ (bset->s.bset);
|
||||
}
|
||||
|
||||
|
||||
int bitset_stats_bytes (void)
|
||||
{
|
||||
return sizeof (struct bitset_struct);
|
||||
}
|
||||
|
||||
|
||||
bitset
|
||||
bitset_stats_init (bset, n_bits, type)
|
||||
bitset bset;
|
||||
bitset_bindex n_bits;
|
||||
enum bitset_type type;
|
||||
{
|
||||
unsigned int bytes;
|
||||
bitset sbset;
|
||||
|
||||
bset->b.ops = &bitset_stats_ops;
|
||||
|
||||
/* Disable cache. */
|
||||
bset->b.cindex = 0;
|
||||
bset->b.csize = 0;
|
||||
bset->b.cdata = 0;
|
||||
|
||||
/* Set up the actual bitset implementation that
|
||||
we are a wrapper over. */
|
||||
switch (type)
|
||||
{
|
||||
case BITSET_ARRAY:
|
||||
bytes = abitset_bytes (n_bits);
|
||||
sbset = (bitset) xcalloc (1, bytes);
|
||||
abitset_init (sbset, n_bits);
|
||||
break;
|
||||
|
||||
case BITSET_LIST:
|
||||
bytes = lbitset_bytes (n_bits);
|
||||
sbset = (bitset) xcalloc (1, bytes);
|
||||
lbitset_init (sbset, n_bits);
|
||||
break;
|
||||
|
||||
case BITSET_TABLE:
|
||||
bytes = ebitset_bytes (n_bits);
|
||||
sbset = (bitset) xcalloc (1, bytes);
|
||||
ebitset_init (sbset, n_bits);
|
||||
break;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
||||
bset->s.bset = sbset;
|
||||
|
||||
BITSET_STATS_ALLOCS_INC (type);
|
||||
|
||||
return bset;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/* Functions to support bitset statistics.
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
Contributed by Michael Hayes ([email protected]).
|
||||
|
||||
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 of the License, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _BITSET_STATS_H
|
||||
#define _BITSET_STATS_H
|
||||
|
||||
#include "bbitset.h"
|
||||
|
||||
extern int bitset_stats_enabled;
|
||||
|
||||
extern enum bitset_type bitset_stats_type_get PARAMS ((bitset));
|
||||
|
||||
extern int bitset_stats_bytes PARAMS ((void));
|
||||
|
||||
extern bitset bitset_stats_init PARAMS ((bitset, bitset_bindex,
|
||||
enum bitset_type));
|
||||
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user